diff --git a/argus/life/supervisor/_core.py b/argus/life/supervisor/_core.py index 6596050fe..7f92720f0 100644 --- a/argus/life/supervisor/_core.py +++ b/argus/life/supervisor/_core.py @@ -1817,9 +1817,9 @@ def _continuation_line(self, item_id: str, chinese: bool) -> str: pending = [] if not pending: return ( - "计划里暂时没有下一项,Planner 正在决定接下来做什么。" + "计划里暂时没有下一项,正在考虑接下来做什么。" if chinese - else "Nothing is queued yet; the Planner is deciding what comes next." + else "Nothing is queued yet; the next step is being considered." ) next_title = " ".join(str(pending[0].title or "").split()) or ( "下一项" if chinese else "the next item" @@ -2135,11 +2135,11 @@ def _message_id(legacy: str) -> str: ) elif overall_complete and independent_review_required and review == "done": continuation = ( - "独立 Reviewer 已复核本轮产出,未发现阻断问题。" + "本次结果已由独立审阅者检查,未发现需要先修正的问题。" if chinese else ( - "An independent Reviewer reviewed this run's output and " - "found no blocking issues." + "An independent reader checked this result and " + "found no issues that need fixing before proceeding." ) ) elif str(outcome.get("stage_certification") or "").strip() == "deferred": diff --git a/argus/release_manifest.json b/argus/release_manifest.json index c69519d23..812e75259 100644 --- a/argus/release_manifest.json +++ b/argus/release_manifest.json @@ -1,6 +1,6 @@ { "package_version": "0.1.8", - "release_id": "0.1.8+901a92ac03f54664", + "release_id": "0.1.8+057b2aeae2b5e64e", "schema_version": 1, - "source_digest": "901a92ac03f54664634bf33d57067cca393e7039321795e2fdcffc41378aa28a" + "source_digest": "057b2aeae2b5e64e0118bc9559681345bbc0b5bb4c56420f9f5fa34617a07c67" } diff --git a/argus/roles/prompts/manager.py b/argus/roles/prompts/manager.py index 457da9586..c34fa4960 100644 --- a/argus/roles/prompts/manager.py +++ b/argus/roles/prompts/manager.py @@ -60,7 +60,10 @@ _USER_FACING_STYLE = ( RESEARCHER_VOICE + "\n\n" "Lead with the answer in plain language, and match the depth, tone, and detail the " - "operator's request calls for. Mention evidence when it matters; leave out internal " + "operator's request calls for. Do not assume research expertise; explain a " + "necessary unfamiliar term when first used and say what the result means " + "for the person. Give professional detail when requested, without changing " + "numbers, sources or uncertainty. Mention evidence when it matters; leave out internal " "exchanges between roles and the sequence of tool calls. If work cannot proceed, " "say why and what happens next. " "Ask one clear question only when the operator must decide. Satisfy the stated " diff --git a/argus/roles/prompts/voice.py b/argus/roles/prompts/voice.py index e0be60d49..85ae70d79 100644 --- a/argus/roles/prompts/voice.py +++ b/argus/roles/prompts/voice.py @@ -2,7 +2,7 @@ Every role ends its turn with a few lines the code parses. Everything else it writes for a person, whether a reason, a next step, a note, a question, or a -heading, should read as a thoughtful researcher writes to a colleague. This +heading, should be understandable without knowing Argus or the field. This paragraph is shared by the Manager, Planner, Engineer, and Reviewer prompts so that the standard is one standard. See ``docs/how-argus-speaks.md``. """ @@ -10,10 +10,16 @@ RESEARCHER_VOICE = ( "## How to write for the person who will read this\n" - "Write to a colleague in the person's language: precise, natural, plain. " - "Name what you are checking or changing and why; lead results with what " - "was found, then evidence, limits and next steps. Explain unfamiliar terms " - "when needed. If work stops, say the cause, its effect and whether work " + "Write in the person's language: precise, natural, plain. By default assume " + "an ordinary reader, not a research colleague or someone who knows Argus. " + "Lead with the answer and what it means for the person; then include the " + "evidence and limits that matter. Name what you are checking or changing " + "and why. Explain necessary unfamiliar terms in everyday words at first use. " + "Offer next steps only when the person needs to act. Match depth to the " + "request: answer simple questions directly without a forced template, and " + "retain precise terms and professional detail when asked. Preserve numbers, " + "sources and uncertainty; simpler language must not change the conclusion. " + "If work stops, say the cause, its effect and whether work " "will continue or needs the person to act. Never invent progress, completion " "or retries. Call files files and results results. Keep internal role names, " "rounds, field names, status tokens, tool arguments and workflow terms " @@ -28,8 +34,9 @@ # the brief must state its own ban on protocol labels next to the prose field # it defines, the way the front-door prompt does for REPLY. RESEARCHER_VOICE_BRIEF = ( - "Write plainly in their language; state the work, result and next step " - "without internal tokens." + "Write plainly for an ordinary reader in their language; lead with the " + "answer and its meaning, explain necessary terms, preserve uncertainty, " + "and give a next step only when they need to act, without internal tokens." ) __all__ = ["RESEARCHER_VOICE", "RESEARCHER_VOICE_BRIEF"] diff --git a/argus/tools/resource_ledger/resource_ledger_status.schema.json b/argus/tools/resource_ledger/resource_ledger_status.schema.json index c06a5ad3b..7a5222acd 100644 --- a/argus/tools/resource_ledger/resource_ledger_status.schema.json +++ b/argus/tools/resource_ledger/resource_ledger_status.schema.json @@ -41,6 +41,19 @@ } }, "$defs": { + "ResourceDeviceStatus": { + "type": "object", + "additionalProperties": false, + "required": ["index", "name", "total_memory_mib", "used_memory_mib", "utilization_percent", "reserved"], + "properties": { + "index": {"type": "string"}, + "name": {"type": "string"}, + "total_memory_mib": {"type": "integer", "minimum": 0}, + "used_memory_mib": {"type": "integer", "minimum": 0}, + "utilization_percent": {"type": "number", "minimum": 0, "maximum": 100}, + "reserved": {"type": "boolean"} + } + }, "ResourceAcceleratorStatus": { "type": "object", "additionalProperties": false, @@ -68,6 +81,10 @@ }, "detail": { "type": "string" + }, + "devices": { + "type": "array", + "items": {"$ref": "#/$defs/ResourceDeviceStatus"} } } }, diff --git a/argus/tools/resource_ledger/status_schema_generated.py b/argus/tools/resource_ledger/status_schema_generated.py index ff37bc323..9d5fc60b9 100644 --- a/argus/tools/resource_ledger/status_schema_generated.py +++ b/argus/tools/resource_ledger/status_schema_generated.py @@ -17,7 +17,25 @@ 'items': {'$ref': '#/$defs/ResourceAcceleratorStatus'}}, 'holders': {'type': 'array', 'items': {'$ref': '#/$defs/ResourceHolderStatus'}}, 'queue': {'type': 'array', 'items': {'$ref': '#/$defs/ResourceQueueStatus'}}}, - '$defs': {'ResourceAcceleratorStatus': {'type': 'object', + '$defs': {'ResourceDeviceStatus': {'type': 'object', + 'additionalProperties': False, + 'required': ['index', + 'name', + 'total_memory_mib', + 'used_memory_mib', + 'utilization_percent', + 'reserved'], + 'properties': {'index': {'type': 'string'}, + 'name': {'type': 'string'}, + 'total_memory_mib': {'type': 'integer', + 'minimum': 0}, + 'used_memory_mib': {'type': 'integer', + 'minimum': 0}, + 'utilization_percent': {'type': 'number', + 'minimum': 0, + 'maximum': 100}, + 'reserved': {'type': 'boolean'}}}, + 'ResourceAcceleratorStatus': {'type': 'object', 'additionalProperties': False, 'required': ['kind', 'status', 'device_count', 'detail'], 'properties': {'kind': {'type': 'string'}, @@ -27,7 +45,9 @@ 'degraded']}, 'device_count': {'type': 'integer', 'minimum': 0}, - 'detail': {'type': 'string'}}}, + 'detail': {'type': 'string'}, + 'devices': {'type': 'array', + 'items': {'$ref': '#/$defs/ResourceDeviceStatus'}}}}, 'ResourceYieldResponse': {'type': 'object', 'additionalProperties': False, 'required': ['decision', 'reason'], diff --git a/argus/webapi/artifacts.py b/argus/webapi/artifacts.py index ee9b0e3b3..7d156ba46 100644 --- a/argus/webapi/artifacts.py +++ b/argus/webapi/artifacts.py @@ -180,6 +180,7 @@ def registered_delivery_artifacts( title = "Delivered results" targets: list[Any] = [] completion_summaries: list[object] = [] + reply_references: list[object] = [] if isinstance(delivery, dict): title = str(delivery.get("title") or title).strip() or title raw_targets = delivery.get("targets") @@ -190,6 +191,14 @@ def registered_delivery_artifacts( from ..core.transcript import read_turns for turn in reversed(read_turns(life_dir)): + if ( + turn.get("role") == "argus" + and not turn.get("mission_result") + and not turn.get("delivery") + and turn.get("success") is not False + and not turn.get("live") + ): + reply_references.append(turn.get("text")) if (turn.get("mission_result") is True and turn.get("success") is True and not turn.get("item_id")): # A resumed direct task can verify already-written outputs without @@ -247,6 +256,17 @@ def registered_delivery_artifacts( "group_title": title, }) if resolved_workspace: + from ..life.delivery import referenced_delivery_paths + + for path in referenced_delivery_paths(resolved_workspace, reply_references, limit=12): + if path not in seen: + seen.add(path) + results.append({ + "path": path, + "why": "File referenced in a saved reply; not an independently reviewed result.", + "source": "reply", + "group_title": "Referenced files", + }) from ..life.delivery import linked_report_paths for path in linked_report_paths(resolved_workspace, [row["path"] for row in results]): diff --git a/argus/webapi/routes/meta.py b/argus/webapi/routes/meta.py index 0b1c4eca8..20fdb90a9 100644 --- a/argus/webapi/routes/meta.py +++ b/argus/webapi/routes/meta.py @@ -32,6 +32,11 @@ def _resource_status_payload(snapshot: dict[str, Any], *, now: float) -> dict[st from ...tools.resource_ledger.status_schema_generated import validate_resource_status probe = snapshot["probe"] + reserved_devices = { + device["identity"] + for record in snapshot["grants"] + for device in record["grant"]["devices"] + } holders = [] for record in snapshot["grants"]: owner = record["owner"] @@ -72,6 +77,17 @@ def _resource_status_payload(snapshot: dict[str, Any], *, now: float) -> dict[st "status": accelerator["status"], "device_count": len(accelerator["devices"]), "detail": accelerator["detail"], + "devices": [ + { + "index": device["index"], + "name": device["name"], + "total_memory_mib": device["total_memory_mib"], + "used_memory_mib": device["used_memory_mib"], + "utilization_percent": device["utilization_percent"], + "reserved": device["identity"] in reserved_devices, + } + for device in accelerator["devices"] + ], } for accelerator in probe["accelerators"] ], diff --git a/docs/how-argus-speaks.md b/docs/how-argus-speaks.md index 237da27bc..b75e21dac 100644 --- a/docs/how-argus-speaks.md +++ b/docs/how-argus-speaks.md @@ -12,6 +12,14 @@ every word is doing work. It is a request for accuracy and grace. ## Principles +Default to an ordinary reader, not someone who knows Argus or the field. Lead +with the answer and what it means for that person, then the evidence and limits +that matter. Explain necessary unfamiliar terms in everyday words at first use. +Keep numbers, sources and uncertainty intact. Simple questions need direct +answers, not a fixed multi-section template; professional questions still need +precise terminology and detail. Give a next step only when the person needs to +act. Internal technical records and parsed closing lines remain unchanged. + 1. **Say what happened and what it means, in the words of the field.** "The effect held on the untouched worlds" rather than "the artifact passed the gate." "The comparison went against the mechanism" rather than "the diff --git a/docs/web-control-responsiveness.md b/docs/web-control-responsiveness.md index acbef81ff..88a62a68a 100644 --- a/docs/web-control-responsiveness.md +++ b/docs/web-control-responsiveness.md @@ -1,5 +1,33 @@ # Web request cancellation +## Workbench navigation and runtime controls + +The main views are Map, Conversation, and Workbench. Workbench modules are +Research timeline, Execution, AI IDE, and Runtime controls, in that order. +Runtime controls replaces the separate operations modal and project overview. +Legacy `view=mission` links open the conversation; removed or invalid module +selections open Runtime controls. Task history and execution capabilities are +unchanged. New work and adjustments belong in the conversation rather than a +second composer inside runtime controls. + +Runtime controls reads device telemetry while visible and keeps maintenance, +recovery, and diagnostics collapsed until needed. Opening the page does not +check/apply source updates, restart a daemon, or submit work. Safe pause drains +current work, and maintenance commands retain command revisions and explicit +confirmation. Read-only views cannot execute controls. + +Each GPU card displays the host's original device index, reported model, +compute utilization, memory usage, and Argus reservation state. Computing, +reserved, memory occupied, and no activity are distinct observations. Host +telemetry includes other programs; zero utilization is not proof that a device +is exclusively available. Probe failures remain visible rather than becoming +idle cards. The authenticated resource API exposes these normalized facts +without device UUIDs, owner identities, or private project paths. + +The attachment button uses the existing Argus mark while retaining its Add files +label and file-picker behavior. Core transitions use brief opacity/transform +feedback, do not replay on every streamed fragment, and honor reduced motion. + The composer stops its current Manager request on the server. Every submission has a fresh `request_id`; `POST /api/projects/{sid}/message/cancel` targets that identity. The cancellation POST has its own connection lifetime and a five-second diff --git a/frontend/core/src/eventRender/index.ts b/frontend/core/src/eventRender/index.ts index 57b7539cc..8bee1594f 100644 --- a/frontend/core/src/eventRender/index.ts +++ b/frontend/core/src/eventRender/index.ts @@ -606,7 +606,7 @@ export function renderEvent(event: TypedArgusEvent, context: RenderContext): Ren case 'ui.argus': { const body = stringField(event, 'text'); // A reply that is still being worked on has steps before it has words. - const working = Array.isArray(row(event).steps) && (row(event).steps as unknown[]).length > 0; + const working = row(event).live === true || (Array.isArray(row(event).steps) && (row(event).steps as unknown[]).length > 0); return body.trim() || working ? model('manager', 'role.argus', '▌', body, 'bright', { expandable: context.density === 'full', rule: true }) : hidden(); @@ -718,7 +718,7 @@ export function renderLine(event: EventMsg, context: RenderContext): RenderedLin const modelValue = renderEvent(event as TypedArgusEvent, context); if (modelValue.visibility === 'hidden') return null; const text = renderText(modelValue); - if (!text && !(event.type === 'ui.argus' && Array.isArray(event.steps) && event.steps.length > 0)) return null; + if (!text && !(event.type === 'ui.argus' && (event.live === true || (Array.isArray(event.steps) && event.steps.length > 0)))) return null; return { role: modelValue.role, labelKey: modelValue.labelKey, diff --git a/frontend/core/src/release.generated.ts b/frontend/core/src/release.generated.ts index 35bc94cc3..33a746520 100644 --- a/frontend/core/src/release.generated.ts +++ b/frontend/core/src/release.generated.ts @@ -1,3 +1,3 @@ // Generated by argus.release_tools.generate_manifest. Do not edit. -export const RELEASE_ID = "0.1.8+901a92ac03f54664"; -export const RELEASE_SOURCE_DIGEST = "901a92ac03f54664634bf33d57067cca393e7039321795e2fdcffc41378aa28a"; +export const RELEASE_ID = "0.1.8+057b2aeae2b5e64e"; +export const RELEASE_SOURCE_DIGEST = "057b2aeae2b5e64e0118bc9559681345bbc0b5bb4c56420f9f5fa34617a07c67"; diff --git a/frontend/core/src/resourceStatus.generated.ts b/frontend/core/src/resourceStatus.generated.ts index e283cf0ff..a85a2796c 100644 --- a/frontend/core/src/resourceStatus.generated.ts +++ b/frontend/core/src/resourceStatus.generated.ts @@ -1,10 +1,20 @@ // Generated by argus.release_tools.generate_resource_status. Do not edit. +export interface ResourceDeviceStatus { + readonly "index": string; + readonly "name": string; + readonly "total_memory_mib": number; + readonly "used_memory_mib": number; + readonly "utilization_percent": number; + readonly "reserved": boolean; +} + export interface ResourceAcceleratorStatus { readonly "kind": string; readonly "status": "available" | "absent" | "inaccessible" | "degraded"; readonly "device_count": number; readonly "detail": string; + readonly "devices"?: ReadonlyArray; } export interface ResourceYieldResponse { diff --git a/frontend/tui/bundle/argus.mjs b/frontend/tui/bundle/argus.mjs index 2d8331b44..23490c721 100644 --- a/frontend/tui/bundle/argus.mjs +++ b/frontend/tui/bundle/argus.mjs @@ -1,21 +1,21 @@ import { createRequire as __argusCreateRequire } from 'node:module'; const require = __argusCreateRequire(import.meta.url); -var gv=Object.create;var Nm=Object.defineProperty;var dv=Object.getOwnPropertyDescriptor;var pv=Object.getOwnPropertyNames;var mv=Object.getPrototypeOf,Ev=Object.prototype.hasOwnProperty;var qr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var xm=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(i){throw r=[i],i}};var Ar=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Iv=(e,t)=>{for(var r in t)Nm(e,r,{get:t[r],enumerable:!0})},hv=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of pv(t))!Ev.call(e,s)&&s!==r&&Nm(e,s,{get:()=>t[s],enumerable:!(i=dv(t,s))||i.enumerable});return e};var Me=(e,t,r)=>(r=e!=null?gv(mv(e)):{},hv(t||!e||!e.__esModule?Nm(r,"default",{value:e,enumerable:!0}):r,e));var aC=Ar(Xt=>{"use strict";var gf=Symbol.for("react.element"),Cv=Symbol.for("react.portal"),Bv=Symbol.for("react.fragment"),Dv=Symbol.for("react.strict_mode"),yv=Symbol.for("react.profiler"),Qv=Symbol.for("react.provider"),wv=Symbol.for("react.context"),vv=Symbol.for("react.forward_ref"),_v=Symbol.for("react.suspense"),Sv=Symbol.for("react.memo"),Rv=Symbol.for("react.lazy"),qh=Symbol.iterator;function bv(e){return e===null||typeof e!="object"?null:(e=qh&&e[qh]||e["@@iterator"],typeof e=="function"?e:null)}var Zh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},eC=Object.assign,tC={};function Bu(e,t,r){this.props=e,this.context=t,this.refs=tC,this.updater=r||Zh}Bu.prototype.isReactComponent={};Bu.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")};Bu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function rC(){}rC.prototype=Bu.prototype;function Om(e,t,r){this.props=e,this.context=t,this.refs=tC,this.updater=r||Zh}var Lm=Om.prototype=new rC;Lm.constructor=Om;eC(Lm,Bu.prototype);Lm.isPureReactComponent=!0;var zh=Array.isArray,nC=Object.prototype.hasOwnProperty,Mm={current:null},oC={key:!0,ref:!0,__self:!0,__source:!0};function iC(e,t,r){var i,s={},a=null,u=null;if(t!=null)for(i in t.ref!==void 0&&(u=t.ref),t.key!==void 0&&(a=""+t.key),t)nC.call(t,i)&&!oC.hasOwnProperty(i)&&(s[i]=t[i]);var p=arguments.length-2;if(p===1)s.children=r;else if(1{"use strict";AC.exports=aC()});var hC=Ar((_1,Ad)=>{Ad.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Ad.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ad.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var jm=Ar((S1,Su)=>{var zr=global.process,tl=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};tl(zr)?(CC=qr("assert"),vu=hC(),BC=/^win/i.test(zr.platform),Ef=qr("events"),typeof Ef!="function"&&(Ef=Ef.EventEmitter),zr.__signal_exit_emitter__?Kn=zr.__signal_exit_emitter__:(Kn=zr.__signal_exit_emitter__=new Ef,Kn.count=0,Kn.emitted={}),Kn.infinite||(Kn.setMaxListeners(1/0),Kn.infinite=!0),Su.exports=function(e,t){if(!tl(global.process))return function(){};CC.equal(typeof e,"function","a callback must be provided for exit handler"),_u===!1&&Hm();var r="exit";t&&t.alwaysLast&&(r="afterexit");var i=function(){Kn.removeListener(r,e),Kn.listeners("exit").length===0&&Kn.listeners("afterexit").length===0&&ld()};return Kn.on(r,e),i},ld=function(){!_u||!tl(global.process)||(_u=!1,vu.forEach(function(t){try{zr.removeListener(t,ud[t])}catch{}}),zr.emit=cd,zr.reallyExit=Wm,Kn.count-=1)},Su.exports.unload=ld,rl=function(t,r,i){Kn.emitted[t]||(Kn.emitted[t]=!0,Kn.emit(t,r,i))},ud={},vu.forEach(function(e){ud[e]=function(){if(tl(global.process)){var r=zr.listeners(e);r.length===Kn.count&&(ld(),rl("exit",null,e),rl("afterexit",null,e),BC&&e==="SIGHUP"&&(e="SIGINT"),zr.kill(zr.pid,e))}}}),Su.exports.signals=function(){return vu},_u=!1,Hm=function(){_u||!tl(global.process)||(_u=!0,Kn.count+=1,vu=vu.filter(function(t){try{return zr.on(t,ud[t]),!0}catch{return!1}}),zr.emit=yC,zr.reallyExit=DC)},Su.exports.load=Hm,Wm=zr.reallyExit,DC=function(t){tl(global.process)&&(zr.exitCode=t||0,rl("exit",zr.exitCode,null),rl("afterexit",zr.exitCode,null),Wm.call(zr,zr.exitCode))},cd=zr.emit,yC=function(t,r){if(t==="exit"&&tl(global.process)){r!==void 0&&(zr.exitCode=r);var i=cd.apply(this,arguments);return rl("exit",zr.exitCode,null),rl("afterexit",zr.exitCode,null),i}else return cd.apply(this,arguments)}):Su.exports=function(){return function(){}};var CC,vu,BC,Ef,Kn,ld,rl,ud,_u,Hm,Wm,DC,cd,yC});var GC=Ar(Pr=>{"use strict";function rE(e,t){var r=e.length;e.push(t);e:for(;0>>1,s=e[i];if(0>>1;igd(p,r))Egd(I,p)?(e[i]=I,e[E]=r,i=E):(e[i]=p,e[u]=r,i=u);else if(Egd(I,r))e[i]=I,e[E]=r,i=E;else break e}}return t}function gd(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(kC=performance,Pr.unstable_now=function(){return kC.now()}):(Zm=Date,NC=Zm.now(),Pr.unstable_now=function(){return Zm.now()-NC});var kC,Zm,NC,Ps=[],cA=[],B_=1,Oi=null,Eo=3,md=!1,nl=!1,Cf=!1,OC=typeof setTimeout=="function"?setTimeout:null,LC=typeof clearTimeout=="function"?clearTimeout:null,xC=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function nE(e){for(var t=gs(cA);t!==null;){if(t.callback===null)pd(cA);else if(t.startTime<=e)pd(cA),t.sortIndex=t.expirationTime,rE(Ps,t);else break;t=gs(cA)}}function oE(e){if(Cf=!1,nE(e),!nl)if(gs(Ps)!==null)nl=!0,sE(iE);else{var t=gs(cA);t!==null&&aE(oE,t.startTime-e)}}function iE(e,t){nl=!1,Cf&&(Cf=!1,LC(Bf),Bf=-1),md=!0;var r=Eo;try{for(nE(t),Oi=gs(Ps);Oi!==null&&(!(Oi.expirationTime>t)||e&&!UC());){var i=Oi.callback;if(typeof i=="function"){Oi.callback=null,Eo=Oi.priorityLevel;var s=i(Oi.expirationTime<=t);t=Pr.unstable_now(),typeof s=="function"?Oi.callback=s:Oi===gs(Ps)&&pd(Ps),nE(t)}else pd(Ps);Oi=gs(Ps)}if(Oi!==null)var a=!0;else{var u=gs(cA);u!==null&&aE(oE,u.startTime-t),a=!1}return a}finally{Oi=null,Eo=r,md=!1}}var Ed=!1,dd=null,Bf=-1,MC=5,PC=-1;function UC(){return!(Pr.unstable_now()-PCe||125i?(e.sortIndex=r,rE(cA,e),gs(Ps)===null&&e===gs(cA)&&(Cf?(LC(Bf),Bf=-1):Cf=!0,aE(oE,r-i))):(e.sortIndex=s,rE(Ps,e),nl||md||(nl=!0,sE(iE))),e};Pr.unstable_shouldYield=UC;Pr.unstable_wrapCallback=function(e){var t=Eo;return function(){var r=Eo;Eo=t;try{return e.apply(this,arguments)}finally{Eo=r}}}});var WC=Ar((G1,HC)=>{"use strict";HC.exports=GC()});var KC=Ar((H1,jC)=>{jC.exports=function(t){var r={},i=qt(),s=WC(),a=Object.assign;function u(n){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+n,l=1;ltypeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var xm=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(i){throw r=[i],i}};var Ar=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Iv=(e,t)=>{for(var r in t)Nm(e,r,{get:t[r],enumerable:!0})},hv=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of pv(t))!Ev.call(e,s)&&s!==r&&Nm(e,s,{get:()=>t[s],enumerable:!(i=dv(t,s))||i.enumerable});return e};var Me=(e,t,r)=>(r=e!=null?gv(mv(e)):{},hv(t||!e||!e.__esModule?Nm(r,"default",{value:e,enumerable:!0}):r,e));var aC=Ar(Xt=>{"use strict";var gf=Symbol.for("react.element"),Cv=Symbol.for("react.portal"),Bv=Symbol.for("react.fragment"),Dv=Symbol.for("react.strict_mode"),yv=Symbol.for("react.profiler"),Qv=Symbol.for("react.provider"),wv=Symbol.for("react.context"),vv=Symbol.for("react.forward_ref"),_v=Symbol.for("react.suspense"),Sv=Symbol.for("react.memo"),Rv=Symbol.for("react.lazy"),qh=Symbol.iterator;function bv(e){return e===null||typeof e!="object"?null:(e=qh&&e[qh]||e["@@iterator"],typeof e=="function"?e:null)}var Zh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},eC=Object.assign,tC={};function Bu(e,t,r){this.props=e,this.context=t,this.refs=tC,this.updater=r||Zh}Bu.prototype.isReactComponent={};Bu.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")};Bu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function rC(){}rC.prototype=Bu.prototype;function Om(e,t,r){this.props=e,this.context=t,this.refs=tC,this.updater=r||Zh}var Lm=Om.prototype=new rC;Lm.constructor=Om;eC(Lm,Bu.prototype);Lm.isPureReactComponent=!0;var zh=Array.isArray,nC=Object.prototype.hasOwnProperty,Mm={current:null},oC={key:!0,ref:!0,__self:!0,__source:!0};function iC(e,t,r){var i,s={},a=null,u=null;if(t!=null)for(i in t.ref!==void 0&&(u=t.ref),t.key!==void 0&&(a=""+t.key),t)nC.call(t,i)&&!oC.hasOwnProperty(i)&&(s[i]=t[i]);var p=arguments.length-2;if(p===1)s.children=r;else if(1{"use strict";AC.exports=aC()});var hC=Ar((_1,Ad)=>{Ad.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Ad.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ad.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var jm=Ar((S1,Su)=>{var zr=global.process,tl=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};tl(zr)?(CC=qr("assert"),vu=hC(),BC=/^win/i.test(zr.platform),Ef=qr("events"),typeof Ef!="function"&&(Ef=Ef.EventEmitter),zr.__signal_exit_emitter__?Kn=zr.__signal_exit_emitter__:(Kn=zr.__signal_exit_emitter__=new Ef,Kn.count=0,Kn.emitted={}),Kn.infinite||(Kn.setMaxListeners(1/0),Kn.infinite=!0),Su.exports=function(e,t){if(!tl(global.process))return function(){};CC.equal(typeof e,"function","a callback must be provided for exit handler"),_u===!1&&Hm();var r="exit";t&&t.alwaysLast&&(r="afterexit");var i=function(){Kn.removeListener(r,e),Kn.listeners("exit").length===0&&Kn.listeners("afterexit").length===0&&ld()};return Kn.on(r,e),i},ld=function(){!_u||!tl(global.process)||(_u=!1,vu.forEach(function(t){try{zr.removeListener(t,ud[t])}catch{}}),zr.emit=cd,zr.reallyExit=Wm,Kn.count-=1)},Su.exports.unload=ld,rl=function(t,r,i){Kn.emitted[t]||(Kn.emitted[t]=!0,Kn.emit(t,r,i))},ud={},vu.forEach(function(e){ud[e]=function(){if(tl(global.process)){var r=zr.listeners(e);r.length===Kn.count&&(ld(),rl("exit",null,e),rl("afterexit",null,e),BC&&e==="SIGHUP"&&(e="SIGINT"),zr.kill(zr.pid,e))}}}),Su.exports.signals=function(){return vu},_u=!1,Hm=function(){_u||!tl(global.process)||(_u=!0,Kn.count+=1,vu=vu.filter(function(t){try{return zr.on(t,ud[t]),!0}catch{return!1}}),zr.emit=yC,zr.reallyExit=DC)},Su.exports.load=Hm,Wm=zr.reallyExit,DC=function(t){tl(global.process)&&(zr.exitCode=t||0,rl("exit",zr.exitCode,null),rl("afterexit",zr.exitCode,null),Wm.call(zr,zr.exitCode))},cd=zr.emit,yC=function(t,r){if(t==="exit"&&tl(global.process)){r!==void 0&&(zr.exitCode=r);var i=cd.apply(this,arguments);return rl("exit",zr.exitCode,null),rl("afterexit",zr.exitCode,null),i}else return cd.apply(this,arguments)}):Su.exports=function(){return function(){}};var CC,vu,BC,Ef,Kn,ld,rl,ud,_u,Hm,Wm,DC,cd,yC});var GC=Ar(Pr=>{"use strict";function rE(e,t){var r=e.length;e.push(t);e:for(;0>>1,s=e[i];if(0>>1;igd(p,r))Egd(I,p)?(e[i]=I,e[E]=r,i=E):(e[i]=p,e[u]=r,i=u);else if(Egd(I,r))e[i]=I,e[E]=r,i=E;else break e}}return t}function gd(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(kC=performance,Pr.unstable_now=function(){return kC.now()}):(Zm=Date,NC=Zm.now(),Pr.unstable_now=function(){return Zm.now()-NC});var kC,Zm,NC,Ps=[],cA=[],B_=1,Oi=null,Eo=3,md=!1,nl=!1,Cf=!1,OC=typeof setTimeout=="function"?setTimeout:null,LC=typeof clearTimeout=="function"?clearTimeout:null,xC=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function nE(e){for(var t=gs(cA);t!==null;){if(t.callback===null)pd(cA);else if(t.startTime<=e)pd(cA),t.sortIndex=t.expirationTime,rE(Ps,t);else break;t=gs(cA)}}function oE(e){if(Cf=!1,nE(e),!nl)if(gs(Ps)!==null)nl=!0,sE(iE);else{var t=gs(cA);t!==null&&aE(oE,t.startTime-e)}}function iE(e,t){nl=!1,Cf&&(Cf=!1,LC(Bf),Bf=-1),md=!0;var r=Eo;try{for(nE(t),Oi=gs(Ps);Oi!==null&&(!(Oi.expirationTime>t)||e&&!UC());){var i=Oi.callback;if(typeof i=="function"){Oi.callback=null,Eo=Oi.priorityLevel;var s=i(Oi.expirationTime<=t);t=Pr.unstable_now(),typeof s=="function"?Oi.callback=s:Oi===gs(Ps)&&pd(Ps),nE(t)}else pd(Ps);Oi=gs(Ps)}if(Oi!==null)var a=!0;else{var u=gs(cA);u!==null&&aE(oE,u.startTime-t),a=!1}return a}finally{Oi=null,Eo=r,md=!1}}var Ed=!1,dd=null,Bf=-1,MC=5,PC=-1;function UC(){return!(Pr.unstable_now()-PCe||125i?(e.sortIndex=r,rE(cA,e),gs(Ps)===null&&e===gs(cA)&&(Cf?(LC(Bf),Bf=-1):Cf=!0,aE(oE,r-i))):(e.sortIndex=s,rE(Ps,e),nl||md||(nl=!0,sE(iE))),e};Pr.unstable_shouldYield=UC;Pr.unstable_wrapCallback=function(e){var t=Eo;return function(){var r=Eo;Eo=t;try{return e.apply(this,arguments)}finally{Eo=r}}}});var WC=Ar((G1,HC)=>{"use strict";HC.exports=GC()});var KC=Ar((H1,jC)=>{jC.exports=function(t){var r={},i=qt(),s=WC(),a=Object.assign;function u(n){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+n,l=1;lz||m[F]!==C[z]){var ue=` `+m[F].replace(" at new "," at ");return n.displayName&&ue.includes("")&&(ue=ue.replace("",n.displayName)),ue}while(1<=F&&0<=z);break}}}finally{BA=!1,Error.prepareStackTrace=l}return(n=n?n.displayName||n.name:"")?Ki(n):""}var ei=Object.prototype.hasOwnProperty,Pa=[],Ji=-1;function ti(n){return{current:n}}function pr(n){0>Ji||(n.current=Pa[Ji],Pa[Ji]=null,Ji--)}function $t(n,o){Ji++,Pa[Ji]=n.current,n.current=o}var br={},Jr=ti(br),Q=ti(!1),R=br;function H(n,o){var l=n.type.contextTypes;if(!l)return br;var c=n.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===o)return c.__reactInternalMemoizedMaskedChildContext;var m={},C;for(C in l)m[C]=o[C];return c&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=o,n.__reactInternalMemoizedMaskedChildContext=m),m}function K(n){return n=n.childContextTypes,n!=null}function oe(){pr(Q),pr(Jr)}function Ie(n,o,l){if(Jr.current!==br)throw Error(u(168));$t(Jr,o),$t(Q,l)}function Ne(n,o,l){var c=n.stateNode;if(o=o.childContextTypes,typeof c.getChildContext!="function")return l;c=c.getChildContext();for(var m in c)if(!(m in o))throw Error(u(108,_e(n)||"Unknown",m));return a({},l,c)}function xe(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||br,R=Jr.current,$t(Jr,n),$t(Q,Q.current),!0}function Ye(n,o,l){var c=n.stateNode;if(!c)throw Error(u(169));l?(n=Ne(n,o,R),c.__reactInternalMemoizedMergedChildContext=n,pr(Q),pr(Jr),$t(Jr,n)):pr(Q),$t(Q,l)}var Oe=Math.clz32?Math.clz32:er,rt=Math.log,Qt=Math.LN2;function er(n){return n>>>=0,n===0?32:31-(rt(n)/Qt|0)|0}var Fr=64,tr=4194304;function vn(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function zn(n,o){var l=n.pendingLanes;if(l===0)return 0;var c=0,m=n.suspendedLanes,C=n.pingedLanes,F=l&268435455;if(F!==0){var z=F&~m;z!==0?c=vn(z):(C&=F,C!==0&&(c=vn(C)))}else F=l&~m,F!==0?c=vn(F):C!==0&&(c=vn(C));if(c===0)return 0;if(o!==0&&o!==c&&(o&m)===0&&(m=c&-c,C=o&-o,m>=C||m===16&&(C&4194240)!==0))return o;if((c&4)!==0&&(c|=l&16),o=n.entangledLanes,o!==0)for(n=n.entanglements,o&=c;0l;l++)o.push(n);return o}function Ga(n,o,l){n.pendingLanes|=o,o!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,o=31-Oe(o),n[o]=l}function Gp(n,o){var l=n.pendingLanes&~o;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=o,n.mutableReadLanes&=o,n.entangledLanes&=o,o=n.entanglements;var c=n.eventTimes;for(n=n.expirationTimes;0>=F,m-=F,Di=1<<32-Oe(o)+m|l<q?(V=U,U=null):V=U.sibling;var de=Ze(d,U,S[q],N);if(de===null){U===null&&(U=V);break}n&&U&&de.alternate===null&&o(d,U),B=C(de,B,q),O===null?_=de:O.sibling=de,O=de,U=V}if(q===S.length)return l(d,U),kr&&$i(d,q),_;if(U===null){for(;qq?(V=U,U=null):V=U.sibling;var We=Ze(d,U,de.value,N);if(We===null){U===null&&(U=V);break}n&&U&&We.alternate===null&&o(d,U),B=C(We,B,q),O===null?_=We:O.sibling=We,O=We,U=V}if(de.done)return l(d,U),kr&&$i(d,q),_;if(U===null){for(;!de.done;q++,de=S.next())de=Rt(d,de.value,N),de!==null&&(B=C(de,B,q),O===null?_=de:O.sibling=de,O=de);return kr&&$i(d,q),_}for(U=c(d,U);!de.done;q++,de=S.next())de=A(U,d,q,de.value,N),de!==null&&(n&&de.alternate!==null&&U.delete(de.key===null?q:de.key),B=C(de,B,q),O===null?_=de:O.sibling=de,O=de);return n&&U.forEach(function(gt){return o(d,gt)}),kr&&$i(d,q),_}function h(d,B,S,N){if(typeof S=="object"&&S!==null&&S.type===y&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case E:e:{for(var _=S.key,O=B;O!==null;){if(O.key===_){if(_=S.type,_===y){if(O.tag===7){l(d,O.sibling),B=m(O,S.props.children),B.return=d,d=B;break e}}else if(O.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===X&&Ai(_)===O.type){l(d,O.sibling),B=m(O,S.props),B.ref=kl(d,O,S),B.return=d,d=B;break e}l(d,O);break}else o(d,O);O=O.sibling}S.type===y?(B=fi(S.props.children,d.mode,N,S.key),B.return=d,d=B):(N=cu(S.type,S.key,S.props,null,d.mode,N),N.ref=kl(d,B,S),N.return=d,d=N)}return F(d);case I:e:{for(O=S.key;B!==null;){if(B.key===O)if(B.tag===4&&B.stateNode.containerInfo===S.containerInfo&&B.stateNode.implementation===S.implementation){l(d,B.sibling),B=m(B,S.children||[]),B.return=d,d=B;break e}else{l(d,B);break}else o(d,B);B=B.sibling}B=fa(S,d.mode,N),B.return=d,d=B}return F(d);case X:return O=S._init,h(d,B,O(S._payload),N)}if(j(S))return f(d,B,S,N);if(ye(S))return g(d,B,S,N);gc(d,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,B!==null&&B.tag===6?(l(d,B.sibling),B=m(B,S),B.return=d,d=B):(l(d,B),B=Uo(S,d.mode,N),B.return=d,d=B),F(d)):l(d,B)}return h}var zi=vA(!0),_A=vA(!1),SA=ti(null),RA=null,yi=null,Qo=null;function ar(){Qo=yi=RA=null}function ng(n,o,l){kt?($t(SA,o._currentValue),o._currentValue=l):($t(SA,o._currentValue2),o._currentValue2=l)}function Nl(n){var o=SA.current;pr(SA),kt?n._currentValue=o:n._currentValue2=o}function dc(n,o,l){for(;n!==null;){var c=n.alternate;if((n.childLanes&o)!==o?(n.childLanes|=o,c!==null&&(c.childLanes|=o)):c!==null&&(c.childLanes&o)!==o&&(c.childLanes|=o),n===l)break;n=n.return}}function co(n,o){RA=n,Qo=yi=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&o)!==0&&(to=!0),n.firstContext=null)}function Ht(n){var o=kt?n._currentValue:n._currentValue2;if(Qo!==n)if(n={context:n,memoizedValue:o,next:null},yi===null){if(RA===null)throw Error(u(308));yi=n,RA.dependencies={lanes:0,firstContext:n}}else yi=yi.next=n;return o}var Qi=null;function Ya(n){Qi===null?Qi=[n]:Qi.push(n)}function Va(n,o,l,c){var m=o.interleaved;return m===null?(l.next=l,Ya(o)):(l.next=m.next,m.next=l),o.interleaved=l,Xi(n,c)}function Xi(n,o){n.lanes|=o;var l=n.alternate;for(l!==null&&(l.lanes|=o),l=n,n=n.return;n!==null;)n.childLanes|=o,l=n.alternate,l!==null&&(l.childLanes|=o),l=n,n=n.return;return l.tag===3?l.stateNode:null}var ra=!1;function xl(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function og(n,o){n=n.updateQueue,o.updateQueue===n&&(o.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Zi(n,o){return{eventTime:n,lane:o,tag:0,payload:null,callback:null,next:null}}function Zn(n,o,l){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(Pt&2)!==0){var m=c.pending;return m===null?o.next=o:(o.next=m.next,m.next=o),c.pending=o,Xi(n,l)}return m=c.interleaved,m===null?(o.next=o,Ya(c)):(o.next=m.next,m.next=o),c.interleaved=o,Xi(n,l)}function bA(n,o,l){if(o=o.updateQueue,o!==null&&(o=o.shared,(l&4194240)!==0)){var c=o.lanes;c&=n.pendingLanes,l|=c,o.lanes=l,eg(n,l)}}function ig(n,o){var l=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,l===c)){var m=null,C=null;if(l=l.firstBaseUpdate,l!==null){do{var F={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};C===null?m=C=F:C=C.next=F,l=l.next}while(l!==null);C===null?m=C=o:C=C.next=o}else m=C=o;l={baseState:c.baseState,firstBaseUpdate:m,lastBaseUpdate:C,shared:c.shared,effects:c.effects},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=o:n.next=o,l.lastBaseUpdate=o}function Tl(n,o,l,c){var m=n.updateQueue;ra=!1;var C=m.firstBaseUpdate,F=m.lastBaseUpdate,z=m.shared.pending;if(z!==null){m.shared.pending=null;var ue=z,Te=ue.next;ue.next=null,F===null?C=Te:F.next=Te,F=ue;var ut=n.alternate;ut!==null&&(ut=ut.updateQueue,z=ut.lastBaseUpdate,z!==F&&(z===null?ut.firstBaseUpdate=Te:z.next=Te,ut.lastBaseUpdate=ue))}if(C!==null){var Rt=m.baseState;F=0,ut=Te=ue=null,z=C;do{var Ze=z.lane,A=z.eventTime;if((c&Ze)===Ze){ut!==null&&(ut=ut.next={eventTime:A,lane:0,tag:z.tag,payload:z.payload,callback:z.callback,next:null});e:{var f=n,g=z;switch(Ze=o,A=l,g.tag){case 1:if(f=g.payload,typeof f=="function"){Rt=f.call(A,Rt,Ze);break e}Rt=f;break e;case 3:f.flags=f.flags&-65537|128;case 0:if(f=g.payload,Ze=typeof f=="function"?f.call(A,Rt,Ze):f,Ze==null)break e;Rt=a({},Rt,Ze);break e;case 2:ra=!0}}z.callback!==null&&z.lane!==0&&(n.flags|=64,Ze=m.effects,Ze===null?m.effects=[z]:Ze.push(z))}else A={eventTime:A,lane:Ze,tag:z.tag,payload:z.payload,callback:z.callback,next:null},ut===null?(Te=ut=A,ue=Rt):ut=ut.next=A,F|=Ze;if(z=z.next,z===null){if(z=m.shared.pending,z===null)break;Ze=z,z=Ze.next,Ze.next=null,m.lastBaseUpdate=Ze,m.shared.pending=null}}while(!0);if(ut===null&&(ue=Rt),m.baseState=ue,m.firstBaseUpdate=Te,m.lastBaseUpdate=ut,o=m.shared.interleaved,o!==null){m=o;do F|=m.lane,m=m.next;while(m!==o)}else C===null&&(m.shared.lanes=0);ua|=F,n.lanes=F,n.memoizedState=Rt}}function sg(n,o,l){if(n=o.effects,o.effects=null,n!==null)for(o=0;ol?l:4,n(!0);var c=Ec.transition;Ec.transition={};try{n(!1),o()}finally{Gt=l,Ec.transition=c}}function gg(){return li().memoizedState}function Bh(n,o,l){var c=bs(n);if(l={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null},dg(n))pg(o,l);else if(l=Va(n,o,l,c),l!==null){var m=Wr();oo(l,n,c,m),mg(l,o,c)}}function nm(n,o,l){var c=bs(n),m={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null};if(dg(n))pg(o,m);else{var C=n.alternate;if(n.lanes===0&&(C===null||C.lanes===0)&&(C=o.lastRenderedReducer,C!==null))try{var F=o.lastRenderedState,z=C(F,l);if(m.hasEagerState=!0,m.eagerState=z,ii(z,F)){var ue=o.interleaved;ue===null?(m.next=m,Ya(o)):(m.next=ue.next,ue.next=m),o.interleaved=m;return}}catch{}l=Va(n,o,m,c),l!==null&&(m=Wr(),oo(l,n,c,m),mg(l,o,c))}}function dg(n){var o=n.alternate;return n===Hr||o!==null&&o===Hr}function pg(n,o){oa=Ol=!0;var l=n.pending;l===null?o.next=o:(o.next=l.next,l.next=o),n.pending=o}function mg(n,o,l){if((l&4194240)!==0){var c=o.lanes;c&=n.pendingLanes,l|=c,o.lanes=l,eg(n,l)}}var Ul={readContext:Ht,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useInsertionEffect:_n,useLayoutEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useMutableSource:_n,useSyncExternalStore:_n,useId:_n,unstable_isNewReconciler:!1},wc={readContext:Ht,useCallback:function(n,o){return ts().memoizedState=[n,o===void 0?null:o],n},useContext:Ht,useEffect:cg,useImperativeHandle:function(n,o,l){return l=l!=null?l.concat([n]):null,Xa(4194308,4,Zp.bind(null,o,n),l)},useLayoutEffect:function(n,o){return Xa(4194308,4,n,o)},useInsertionEffect:function(n,o){return Xa(4,2,n,o)},useMemo:function(n,o){var l=ts();return o=o===void 0?null:o,n=n(),l.memoizedState=[n,o],n},useReducer:function(n,o,l){var c=ts();return o=l!==void 0?l(o):o,c.memoizedState=c.baseState=o,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:o},c.queue=n,n=n.dispatch=Bh.bind(null,Hr,n),[c.memoizedState,n]},useRef:function(n){var o=ts();return n={current:n},o.memoizedState=n},useState:Xp,useDebugValue:fg,useDeferredValue:function(n){return ts().memoizedState=n},useTransition:function(){var n=Xp(!1),o=n[0];return n=Ch.bind(null,n[1]),ts().memoizedState=n,[o,n]},useMutableSource:function(){},useSyncExternalStore:function(n,o,l){var c=Hr,m=ts();if(kr){if(l===void 0)throw Error(u(407));l=l()}else{if(l=o(),In===null)throw Error(u(349));(Rs&30)!==0||$p(c,o,l)}m.memoizedState=l;var C={value:l,getSnapshot:o};return m.queue=C,cg(lg.bind(null,c,C,n),[n]),c.flags|=2048,za(9,qp.bind(null,c,C,l,o),void 0,null),l},useId:function(){var n=ts(),o=In.identifierPrefix;if(kr){var l=Vi,c=Di;l=(c&~(1<<32-Oe(c)-1)).toString(32)+l,o=":"+o+"R"+l,l=ia++,0Vc&&(o.flags|=128,c=!0,xt(m,!1),o.lanes=4194304)}else{if(!c)if(n=qa(C),n!==null){if(o.flags|=128,c=!0,n=n.updateQueue,n!==null&&(o.updateQueue=n,o.flags|=4),xt(m,!0),m.tail===null&&m.tailMode==="hidden"&&!C.alternate&&!kr)return Tn(o),null}else 2*Ir()-m.renderingStartTime>Vc&&l!==1073741824&&(o.flags|=128,c=!0,xt(m,!1),o.lanes=4194304);m.isBackwards?(C.sibling=o.child,o.child=C):(n=m.last,n!==null?n.sibling=C:o.child=C,m.last=C)}return m.tail!==null?(o=m.tail,m.rendering=o,m.tail=o.sibling,m.renderingStartTime=Ir(),o.sibling=null,n=Sr.current,$t(Sr,c?n&1|2:n&1),o):(Tn(o),null);case 22:case 23:return au(),l=o.memoizedState!==null,n!==null&&n.memoizedState!==null!==l&&(o.flags|=8192),l&&(o.mode&1)!==0?(Tr&1073741824)!==0&&(Tn(o),Je&&o.subtreeFlags&6&&(o.flags|=8192)):Tn(o),null;case 24:return null;case 25:return null}throw Error(u(156,o.tag))}function lm(n,o){switch(fc(o),o.tag){case 1:return K(o.type)&&oe(),n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 3:return $a(),pr(Q),pr(Jr),mc(),n=o.flags,(n&65536)!==0&&(n&128)===0?(o.flags=n&-65537|128,o):null;case 5:return wi(o),null;case 13:if(pr(Sr),n=o.memoizedState,n!==null&&n.dehydrated!==null){if(o.alternate===null)throw Error(u(340));wA()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 19:return pr(Sr),null;case 4:return $a(),null;case 10:return Nl(o.type._context),null;case 22:case 23:return au(),null;case 24:return null;default:return null}}var Gc=!1,Hn=!1,um=typeof WeakSet=="function"?WeakSet:Set,At=null;function aa(n,o){var l=n.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(c){Or(n,o,c)}else l.current=null}function UA(n,o,l){try{l()}catch(c){Or(n,o,c)}}var vg=!1;function _g(n,o){for(Ke(n.containerInfo),At=o;At!==null;)if(n=At,o=n.child,(n.subtreeFlags&1028)!==0&&o!==null)o.return=n,At=o;else for(;At!==null;){n=At;try{var l=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(l!==null){var c=l.memoizedProps,m=l.memoizedState,C=n.stateNode,F=C.getSnapshotBeforeUpdate(n.elementType===n.type?c:Mo(n.type,c),m);C.__reactInternalSnapshotBeforeUpdate=F}break;case 3:Je&&No(n.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(u(163))}}catch(z){Or(n,n.return,z)}if(o=n.sibling,o!==null){o.return=n.return,At=o;break}At=n.return}return l=vg,vg=!1,l}function GA(n,o,l){var c=o.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var m=c=c.next;do{if((m.tag&n)===n){var C=m.destroy;m.destroy=void 0,C!==void 0&&UA(o,l,C)}m=m.next}while(m!==c)}}function Kl(n,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var l=o=o.next;do{if((l.tag&n)===n){var c=l.create;l.destroy=c()}l=l.next}while(l!==o)}}function Hc(n){var o=n.ref;if(o!==null){var l=n.stateNode;n.tag===5?n=ae(l):n=l,typeof o=="function"?o(n):o.current=n}}function Jl(n){var o=n.alternate;o!==null&&(n.alternate=null,Jl(o)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(o=n.stateNode,o!==null&&_r(o)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function Sg(n){return n.tag===5||n.tag===3||n.tag===4}function Rg(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Sg(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Wc(n,o,l){var c=n.tag;if(c===5||c===6)n=n.stateNode,o?Bi(l,n,o):Vs(l,n);else if(c!==4&&(n=n.child,n!==null))for(Wc(n,o,l),n=n.sibling;n!==null;)Wc(n,o,l),n=n.sibling}function Aa(n,o,l){var c=n.tag;if(c===5||c===6)n=n.stateNode,o?Ci(l,n,o):Ur(l,n);else if(c!==4&&(n=n.child,n!==null))for(Aa(n,o,l),n=n.sibling;n!==null;)Aa(n,o,l),n=n.sibling}var En=null,wo=!1;function Wn(n,o,l){for(l=l.child;l!==null;)jc(n,o,l),l=l.sibling}function jc(n,o,l){if(oi&&typeof oi.onCommitFiberUnmount=="function")try{oi.onCommitFiberUnmount(wl,l)}catch{}switch(l.tag){case 5:Hn||aa(l,o);case 6:if(Je){var c=En,m=wo;En=null,Wn(n,o,l),En=c,wo=m,En!==null&&(wo?ko(En,l.stateNode):zo(En,l.stateNode))}else Wn(n,o,l);break;case 18:Je&&En!==null&&(wo?cn(En,l.stateNode):Vt(En,l.stateNode));break;case 4:Je?(c=En,m=wo,En=l.stateNode.containerInfo,wo=!0,Wn(n,o,l),En=c,wo=m):(Ut&&(c=l.stateNode.containerInfo,m=Wi(c),qs(c,m)),Wn(n,o,l));break;case 0:case 11:case 14:case 15:if(!Hn&&(c=l.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){m=c=c.next;do{var C=m,F=C.destroy;C=C.tag,F!==void 0&&((C&2)!==0||(C&4)!==0)&&UA(l,o,F),m=m.next}while(m!==c)}Wn(n,o,l);break;case 1:if(!Hn&&(aa(l,o),c=l.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=l.memoizedProps,c.state=l.memoizedState,c.componentWillUnmount()}catch(z){Or(l,o,z)}Wn(n,o,l);break;case 21:Wn(n,o,l);break;case 22:l.mode&1?(Hn=(c=Hn)||l.memoizedState!==null,Wn(n,o,l),Hn=c):Wn(n,o,l);break;default:Wn(n,o,l)}}function Yl(n){var o=n.updateQueue;if(o!==null){n.updateQueue=null;var l=n.stateNode;l===null&&(l=n.stateNode=new um),o.forEach(function(c){var m=zc.bind(null,n,c);l.has(c)||(l.add(c),c.then(m,m))})}}function Po(n,o){var l=o.deletions;if(l!==null)for(var c=0;c";case HA:return":has("+(Yc(n)||"")+")";case nA:return'[role="'+n.value+'"]';case ql:return'"'+n.value+'"';case $l:return'[data-testname="'+n.value+'"]';default:throw Error(u(365))}}function xg(n,o){var l=[];n=[n,0];for(var c=0;cm&&(m=F),c&=~C}if(c=m,c=Ir()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*Tg(c/1960))-c,10n?16:n,as===null)var c=!1;else{if(n=as,as=null,ru=0,(Pt&6)!==0)throw Error(u(331));var m=Pt;for(Pt|=4,At=n.current;At!==null;){var C=At,F=C.child;if((At.flags&16)!==0){var z=C.deletions;if(z!==null){for(var ue=0;ueIr()-oA?ca(n,0):Zl|=l),Bn(n,o)}function Pg(n,o){o===0&&((n.mode&1)===0?o=1:(o=tr,tr<<=1,(tr&130023424)===0&&(tr=4194304)));var l=Wr();n=Xi(n,o),n!==null&&(Ga(n,o,l),Bn(n,l))}function mm(n){var o=n.memoizedState,l=0;o!==null&&(l=o.retryLane),Pg(n,l)}function zc(n,o){var l=0;switch(n.tag){case 13:var c=n.stateNode,m=n.memoizedState;m!==null&&(l=m.retryLane);break;case 19:c=n.stateNode;break;default:throw Error(u(314))}c!==null&&c.delete(o),Pg(n,l)}var Ug;Ug=function(n,o,l){if(n!==null)if(n.memoizedProps!==o.pendingProps||Q.current)to=!0;else{if((n.lanes&l)===0&&(o.flags&128)===0)return to=!1,Am(n,o,l);to=(n.flags&131072)!==0}else to=!1,kr&&(o.flags&1048576)!==0&&cc(o,Rl,o.index);switch(o.lanes=0,o.tag){case 2:var c=o.type;LA(n,o),n=o.pendingProps;var m=H(o,Jr.current);co(o,l),m=xA(null,o,c,n,m,l);var C=Ag();return o.flags|=1,typeof m=="object"&&m!==null&&typeof m.render=="function"&&m.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,K(c)?(C=!0,xe(o)):C=!1,o.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,xl(o),m.updater=Sc,o.stateNode=m,m._reactInternals=o,Eg(o,c,n,l),o=OA(null,o,c,!0,C,l)):(o.tag=0,kr&&C&&ta(o),Gn(null,o,m,l),o=o.child),o;case 16:c=o.elementType;e:{switch(LA(n,o),n=o.pendingProps,m=c._init,c=m(c._payload),o.type=c,m=o.tag=Hg(c),n=Mo(c,n),m){case 0:o=Lc(null,o,c,n,l);break e;case 1:o=tA(null,o,c,n,l);break e;case 11:o=Nc(null,o,c,n,l);break e;case 14:o=xc(null,o,c,Mo(c.type,n),l);break e}throw Error(u(306,c,""))}return o;case 0:return c=o.type,m=o.pendingProps,m=o.elementType===c?m:Mo(c,m),Lc(n,o,c,m,l);case 1:return c=o.type,m=o.pendingProps,m=o.elementType===c?m:Mo(c,m),tA(n,o,c,m,l);case 3:e:{if(rs(o),n===null)throw Error(u(387));c=o.pendingProps,C=o.memoizedState,m=C.element,og(n,o),Tl(o,c,null,l);var F=o.memoizedState;if(c=F.element,_t&&C.isDehydrated)if(C={element:c,isDehydrated:!1,cache:F.cache,pendingSuspenseBoundaries:F.pendingSuspenseBoundaries,transitions:F.transitions},o.updateQueue.baseState=C,o.memoizedState=C,o.flags&256){m=TA(Error(u(423)),o),o=Hl(n,o,c,l,m);break e}else if(c!==m){m=TA(Error(u(424)),o),o=Hl(n,o,c,l,m);break e}else for(_t&&(Oo=Se(o.stateNode.containerInfo),uo=o,kr=!0,ai=null,Ka=!1),l=_A(o,null,c,l),o.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(wA(),c===m){o=ns(n,o,l);break e}Gn(n,o,c,l)}o=o.child}return o;case 5:return ag(o),n===null&&Ja(o),c=o.type,m=o.pendingProps,C=n!==null?n.memoizedProps:null,F=m.children,Y(c,m)?F=null:C!==null&&Y(c,C)&&(o.flags|=32),Cg(n,o),Gn(n,o,F,l),o.child;case 6:return n===null&&Ja(o),null;case 13:return Wl(n,o,l);case 4:return pc(o,o.stateNode.containerInfo),c=o.pendingProps,n===null?o.child=zi(o,null,c,l):Gn(n,o,c,l),o.child;case 11:return c=o.type,m=o.pendingProps,m=o.elementType===c?m:Mo(c,m),Nc(n,o,c,m,l);case 7:return Gn(n,o,o.pendingProps,l),o.child;case 8:return Gn(n,o,o.pendingProps.children,l),o.child;case 12:return Gn(n,o,o.pendingProps.children,l),o.child;case 10:e:{if(c=o.type._context,m=o.pendingProps,C=o.memoizedProps,F=m.value,ng(o,c,F),C!==null)if(ii(C.value,F)){if(C.children===m.children&&!Q.current){o=ns(n,o,l);break e}}else for(C=o.child,C!==null&&(C.return=o);C!==null;){var z=C.dependencies;if(z!==null){F=C.child;for(var ue=z.firstContext;ue!==null;){if(ue.context===c){if(C.tag===1){ue=Zi(-1,l&-l),ue.tag=2;var Te=C.updateQueue;if(Te!==null){Te=Te.shared;var ut=Te.pending;ut===null?ue.next=ue:(ue.next=ut.next,ut.next=ue),Te.pending=ue}}C.lanes|=l,ue=C.alternate,ue!==null&&(ue.lanes|=l),dc(C.return,l,o),z.lanes|=l;break}ue=ue.next}}else if(C.tag===10)F=C.type===o.type?null:C.child;else if(C.tag===18){if(F=C.return,F===null)throw Error(u(341));F.lanes|=l,z=F.alternate,z!==null&&(z.lanes|=l),dc(F,l,o),F=C.sibling}else F=C.child;if(F!==null)F.return=C;else for(F=C;F!==null;){if(F===o){F=null;break}if(C=F.sibling,C!==null){C.return=F.return,F=C;break}F=F.return}C=F}Gn(n,o,m.children,l),o=o.child}return o;case 9:return m=o.type,c=o.pendingProps.children,co(o,l),m=Ht(m),c=c(m),o.flags|=1,Gn(n,o,c,l),o.child;case 14:return c=o.type,m=Mo(c,o.pendingProps),m=Mo(c.type,m),xc(n,o,c,m,l);case 15:return Tc(n,o,o.type,o.pendingProps,l);case 17:return c=o.type,m=o.pendingProps,m=o.elementType===c?m:Mo(c,m),LA(n,o),o.tag=1,K(c)?(n=!0,xe(o)):n=!1,co(o,l),sm(o,c,m),Eg(o,c,m,l),OA(null,o,c,!0,n,l);case 19:return yg(n,o,l);case 22:return Oc(n,o,l)}throw Error(u(156,o.tag))};function Gg(n,o){return ni(n,o)}function Em(n,o,l,c){this.tag=n,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vo(n,o,l,c){return new Em(n,o,l,c)}function ci(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Hg(n){if(typeof n=="function")return ci(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Z)return 11;if(n===ie)return 14}return 2}function _o(n,o){var l=n.alternate;return l===null?(l=vo(n.tag,o,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=o,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&14680064,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,o=n.dependencies,l.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l}function cu(n,o,l,c,m,C){var F=2;if(c=n,typeof n=="function")ci(n)&&(F=1);else if(typeof n=="string")F=5;else e:switch(n){case y:return fi(l.children,m,C,o);case D:F=8,m|=8;break;case v:return n=vo(12,l,o,m|2),n.elementType=v,n.lanes=C,n;case ee:return n=vo(13,l,o,m),n.elementType=ee,n.lanes=C,n;case W:return n=vo(19,l,o,m),n.elementType=W,n.lanes=C,n;case $:return Ns(l,m,C,o);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case T:F=10;break e;case P:F=9;break e;case Z:F=11;break e;case ie:F=14;break e;case X:F=16,c=null;break e}throw Error(u(130,n==null?n:typeof n,""))}return o=vo(F,l,o,m),o.elementType=n,o.type=c,o.lanes=C,o}function fi(n,o,l,c){return n=vo(7,n,c,o),n.lanes=l,n}function Ns(n,o,l,c){return n=vo(22,n,c,o),n.elementType=$,n.lanes=l,n.stateNode={isHidden:!1},n}function Uo(n,o,l){return n=vo(6,n,null,o),n.lanes=l,n}function fa(n,o,l){return o=vo(4,n.children!==null?n.children:[],n.key,o),o.lanes=l,o.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},o}function Im(n,o,l,c,m){this.tag=o,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=et,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Zf(0),this.expirationTimes=Zf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zf(0),this.identifierPrefix=c,this.onRecoverableError=m,_t&&(this.mutableSourceEagerHydrationData=null)}function Wg(n,o,l,c,m,C,F,z,ue){return n=new Im(n,o,l,z,ue),o===1?(o=1,C===!0&&(o|=8)):o=0,C=vo(3,null,null,o),n.current=C,C.stateNode=n,C.memoizedState={element:c,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},xl(C),n}function jg(n){if(!n)return br;n=n._reactInternals;e:{if(ge(n)!==n||n.tag!==1)throw Error(u(170));var o=n;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(K(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(u(171))}if(n.tag===1){var l=n.type;if(K(l))return Ne(n,l,o)}return o}function Xc(n){var o=n._reactInternals;if(o===void 0)throw typeof n.render=="function"?Error(u(188)):(n=Object.keys(n).join(","),Error(u(268,n)));return n=be(o),n===null?null:n.stateNode}function ga(n,o){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l=Te&&C>=Rt&&m<=ut&&F<=Ze){n.splice(o,1);break}else if(c!==Te||l.width!==ue.width||ZeF){if(!(C!==Rt||l.height!==ue.height||utm)){Te>c&&(ue.width+=Te-c,ue.x=c),utC&&(ue.height+=Rt-C,ue.y=C),Zel&&(l=F)),FVc&&(o.flags|=128,c=!0,xt(m,!1),o.lanes=4194304)}else{if(!c)if(n=qa(C),n!==null){if(o.flags|=128,c=!0,n=n.updateQueue,n!==null&&(o.updateQueue=n,o.flags|=4),xt(m,!0),m.tail===null&&m.tailMode==="hidden"&&!C.alternate&&!kr)return Tn(o),null}else 2*Ir()-m.renderingStartTime>Vc&&l!==1073741824&&(o.flags|=128,c=!0,xt(m,!1),o.lanes=4194304);m.isBackwards?(C.sibling=o.child,o.child=C):(n=m.last,n!==null?n.sibling=C:o.child=C,m.last=C)}return m.tail!==null?(o=m.tail,m.rendering=o,m.tail=o.sibling,m.renderingStartTime=Ir(),o.sibling=null,n=Sr.current,$t(Sr,c?n&1|2:n&1),o):(Tn(o),null);case 22:case 23:return au(),l=o.memoizedState!==null,n!==null&&n.memoizedState!==null!==l&&(o.flags|=8192),l&&(o.mode&1)!==0?(Tr&1073741824)!==0&&(Tn(o),Je&&o.subtreeFlags&6&&(o.flags|=8192)):Tn(o),null;case 24:return null;case 25:return null}throw Error(u(156,o.tag))}function lm(n,o){switch(fc(o),o.tag){case 1:return K(o.type)&&oe(),n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 3:return $a(),pr(Q),pr(Jr),mc(),n=o.flags,(n&65536)!==0&&(n&128)===0?(o.flags=n&-65537|128,o):null;case 5:return wi(o),null;case 13:if(pr(Sr),n=o.memoizedState,n!==null&&n.dehydrated!==null){if(o.alternate===null)throw Error(u(340));wA()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 19:return pr(Sr),null;case 4:return $a(),null;case 10:return Nl(o.type._context),null;case 22:case 23:return au(),null;case 24:return null;default:return null}}var Gc=!1,Hn=!1,um=typeof WeakSet=="function"?WeakSet:Set,At=null;function aa(n,o){var l=n.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(c){Or(n,o,c)}else l.current=null}function UA(n,o,l){try{l()}catch(c){Or(n,o,c)}}var vg=!1;function _g(n,o){for(Ke(n.containerInfo),At=o;At!==null;)if(n=At,o=n.child,(n.subtreeFlags&1028)!==0&&o!==null)o.return=n,At=o;else for(;At!==null;){n=At;try{var l=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(l!==null){var c=l.memoizedProps,m=l.memoizedState,C=n.stateNode,F=C.getSnapshotBeforeUpdate(n.elementType===n.type?c:Mo(n.type,c),m);C.__reactInternalSnapshotBeforeUpdate=F}break;case 3:Je&&No(n.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(u(163))}}catch(z){Or(n,n.return,z)}if(o=n.sibling,o!==null){o.return=n.return,At=o;break}At=n.return}return l=vg,vg=!1,l}function GA(n,o,l){var c=o.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var m=c=c.next;do{if((m.tag&n)===n){var C=m.destroy;m.destroy=void 0,C!==void 0&&UA(o,l,C)}m=m.next}while(m!==c)}}function Kl(n,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var l=o=o.next;do{if((l.tag&n)===n){var c=l.create;l.destroy=c()}l=l.next}while(l!==o)}}function Hc(n){var o=n.ref;if(o!==null){var l=n.stateNode;n.tag===5?n=ae(l):n=l,typeof o=="function"?o(n):o.current=n}}function Jl(n){var o=n.alternate;o!==null&&(n.alternate=null,Jl(o)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(o=n.stateNode,o!==null&&_r(o)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function Sg(n){return n.tag===5||n.tag===3||n.tag===4}function Rg(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Sg(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Wc(n,o,l){var c=n.tag;if(c===5||c===6)n=n.stateNode,o?Bi(l,n,o):Vs(l,n);else if(c!==4&&(n=n.child,n!==null))for(Wc(n,o,l),n=n.sibling;n!==null;)Wc(n,o,l),n=n.sibling}function Aa(n,o,l){var c=n.tag;if(c===5||c===6)n=n.stateNode,o?Ci(l,n,o):Ur(l,n);else if(c!==4&&(n=n.child,n!==null))for(Aa(n,o,l),n=n.sibling;n!==null;)Aa(n,o,l),n=n.sibling}var En=null,wo=!1;function Wn(n,o,l){for(l=l.child;l!==null;)jc(n,o,l),l=l.sibling}function jc(n,o,l){if(oi&&typeof oi.onCommitFiberUnmount=="function")try{oi.onCommitFiberUnmount(wl,l)}catch{}switch(l.tag){case 5:Hn||aa(l,o);case 6:if(Je){var c=En,m=wo;En=null,Wn(n,o,l),En=c,wo=m,En!==null&&(wo?ko(En,l.stateNode):zo(En,l.stateNode))}else Wn(n,o,l);break;case 18:Je&&En!==null&&(wo?cn(En,l.stateNode):Vt(En,l.stateNode));break;case 4:Je?(c=En,m=wo,En=l.stateNode.containerInfo,wo=!0,Wn(n,o,l),En=c,wo=m):(Ut&&(c=l.stateNode.containerInfo,m=Wi(c),qs(c,m)),Wn(n,o,l));break;case 0:case 11:case 14:case 15:if(!Hn&&(c=l.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){m=c=c.next;do{var C=m,F=C.destroy;C=C.tag,F!==void 0&&((C&2)!==0||(C&4)!==0)&&UA(l,o,F),m=m.next}while(m!==c)}Wn(n,o,l);break;case 1:if(!Hn&&(aa(l,o),c=l.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=l.memoizedProps,c.state=l.memoizedState,c.componentWillUnmount()}catch(z){Or(l,o,z)}Wn(n,o,l);break;case 21:Wn(n,o,l);break;case 22:l.mode&1?(Hn=(c=Hn)||l.memoizedState!==null,Wn(n,o,l),Hn=c):Wn(n,o,l);break;default:Wn(n,o,l)}}function Yl(n){var o=n.updateQueue;if(o!==null){n.updateQueue=null;var l=n.stateNode;l===null&&(l=n.stateNode=new um),o.forEach(function(c){var m=zc.bind(null,n,c);l.has(c)||(l.add(c),c.then(m,m))})}}function Po(n,o){var l=o.deletions;if(l!==null)for(var c=0;c";case HA:return":has("+(Yc(n)||"")+")";case nA:return'[role="'+n.value+'"]';case ql:return'"'+n.value+'"';case $l:return'[data-testname="'+n.value+'"]';default:throw Error(u(365))}}function xg(n,o){var l=[];n=[n,0];for(var c=0;cm&&(m=F),c&=~C}if(c=m,c=Ir()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*Tg(c/1960))-c,10n?16:n,as===null)var c=!1;else{if(n=as,as=null,ru=0,(Pt&6)!==0)throw Error(u(331));var m=Pt;for(Pt|=4,At=n.current;At!==null;){var C=At,F=C.child;if((At.flags&16)!==0){var z=C.deletions;if(z!==null){for(var ue=0;ueIr()-oA?ca(n,0):Zl|=l),Bn(n,o)}function Pg(n,o){o===0&&((n.mode&1)===0?o=1:(o=tr,tr<<=1,(tr&130023424)===0&&(tr=4194304)));var l=Wr();n=Xi(n,o),n!==null&&(Ga(n,o,l),Bn(n,l))}function mm(n){var o=n.memoizedState,l=0;o!==null&&(l=o.retryLane),Pg(n,l)}function zc(n,o){var l=0;switch(n.tag){case 13:var c=n.stateNode,m=n.memoizedState;m!==null&&(l=m.retryLane);break;case 19:c=n.stateNode;break;default:throw Error(u(314))}c!==null&&c.delete(o),Pg(n,l)}var Ug;Ug=function(n,o,l){if(n!==null)if(n.memoizedProps!==o.pendingProps||Q.current)to=!0;else{if((n.lanes&l)===0&&(o.flags&128)===0)return to=!1,Am(n,o,l);to=(n.flags&131072)!==0}else to=!1,kr&&(o.flags&1048576)!==0&&cc(o,Rl,o.index);switch(o.lanes=0,o.tag){case 2:var c=o.type;LA(n,o),n=o.pendingProps;var m=H(o,Jr.current);co(o,l),m=xA(null,o,c,n,m,l);var C=Ag();return o.flags|=1,typeof m=="object"&&m!==null&&typeof m.render=="function"&&m.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,K(c)?(C=!0,xe(o)):C=!1,o.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,xl(o),m.updater=Sc,o.stateNode=m,m._reactInternals=o,Eg(o,c,n,l),o=OA(null,o,c,!0,C,l)):(o.tag=0,kr&&C&&ta(o),Gn(null,o,m,l),o=o.child),o;case 16:c=o.elementType;e:{switch(LA(n,o),n=o.pendingProps,m=c._init,c=m(c._payload),o.type=c,m=o.tag=Hg(c),n=Mo(c,n),m){case 0:o=Lc(null,o,c,n,l);break e;case 1:o=tA(null,o,c,n,l);break e;case 11:o=Nc(null,o,c,n,l);break e;case 14:o=xc(null,o,c,Mo(c.type,n),l);break e}throw Error(u(306,c,""))}return o;case 0:return c=o.type,m=o.pendingProps,m=o.elementType===c?m:Mo(c,m),Lc(n,o,c,m,l);case 1:return c=o.type,m=o.pendingProps,m=o.elementType===c?m:Mo(c,m),tA(n,o,c,m,l);case 3:e:{if(rs(o),n===null)throw Error(u(387));c=o.pendingProps,C=o.memoizedState,m=C.element,og(n,o),Tl(o,c,null,l);var F=o.memoizedState;if(c=F.element,_t&&C.isDehydrated)if(C={element:c,isDehydrated:!1,cache:F.cache,pendingSuspenseBoundaries:F.pendingSuspenseBoundaries,transitions:F.transitions},o.updateQueue.baseState=C,o.memoizedState=C,o.flags&256){m=TA(Error(u(423)),o),o=Hl(n,o,c,l,m);break e}else if(c!==m){m=TA(Error(u(424)),o),o=Hl(n,o,c,l,m);break e}else for(_t&&(Oo=Se(o.stateNode.containerInfo),uo=o,kr=!0,ai=null,Ka=!1),l=_A(o,null,c,l),o.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(wA(),c===m){o=ns(n,o,l);break e}Gn(n,o,c,l)}o=o.child}return o;case 5:return ag(o),n===null&&Ja(o),c=o.type,m=o.pendingProps,C=n!==null?n.memoizedProps:null,F=m.children,Y(c,m)?F=null:C!==null&&Y(c,C)&&(o.flags|=32),Cg(n,o),Gn(n,o,F,l),o.child;case 6:return n===null&&Ja(o),null;case 13:return Wl(n,o,l);case 4:return pc(o,o.stateNode.containerInfo),c=o.pendingProps,n===null?o.child=zi(o,null,c,l):Gn(n,o,c,l),o.child;case 11:return c=o.type,m=o.pendingProps,m=o.elementType===c?m:Mo(c,m),Nc(n,o,c,m,l);case 7:return Gn(n,o,o.pendingProps,l),o.child;case 8:return Gn(n,o,o.pendingProps.children,l),o.child;case 12:return Gn(n,o,o.pendingProps.children,l),o.child;case 10:e:{if(c=o.type._context,m=o.pendingProps,C=o.memoizedProps,F=m.value,ng(o,c,F),C!==null)if(ii(C.value,F)){if(C.children===m.children&&!Q.current){o=ns(n,o,l);break e}}else for(C=o.child,C!==null&&(C.return=o);C!==null;){var z=C.dependencies;if(z!==null){F=C.child;for(var ue=z.firstContext;ue!==null;){if(ue.context===c){if(C.tag===1){ue=Zi(-1,l&-l),ue.tag=2;var Te=C.updateQueue;if(Te!==null){Te=Te.shared;var ut=Te.pending;ut===null?ue.next=ue:(ue.next=ut.next,ut.next=ue),Te.pending=ue}}C.lanes|=l,ue=C.alternate,ue!==null&&(ue.lanes|=l),dc(C.return,l,o),z.lanes|=l;break}ue=ue.next}}else if(C.tag===10)F=C.type===o.type?null:C.child;else if(C.tag===18){if(F=C.return,F===null)throw Error(u(341));F.lanes|=l,z=F.alternate,z!==null&&(z.lanes|=l),dc(F,l,o),F=C.sibling}else F=C.child;if(F!==null)F.return=C;else for(F=C;F!==null;){if(F===o){F=null;break}if(C=F.sibling,C!==null){C.return=F.return,F=C;break}F=F.return}C=F}Gn(n,o,m.children,l),o=o.child}return o;case 9:return m=o.type,c=o.pendingProps.children,co(o,l),m=Ht(m),c=c(m),o.flags|=1,Gn(n,o,c,l),o.child;case 14:return c=o.type,m=Mo(c,o.pendingProps),m=Mo(c.type,m),xc(n,o,c,m,l);case 15:return Tc(n,o,o.type,o.pendingProps,l);case 17:return c=o.type,m=o.pendingProps,m=o.elementType===c?m:Mo(c,m),LA(n,o),o.tag=1,K(c)?(n=!0,xe(o)):n=!1,co(o,l),sm(o,c,m),Eg(o,c,m,l),OA(null,o,c,!0,n,l);case 19:return yg(n,o,l);case 22:return Oc(n,o,l)}throw Error(u(156,o.tag))};function Gg(n,o){return ni(n,o)}function Em(n,o,l,c){this.tag=n,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vo(n,o,l,c){return new Em(n,o,l,c)}function ci(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Hg(n){if(typeof n=="function")return ci(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Z)return 11;if(n===ie)return 14}return 2}function _o(n,o){var l=n.alternate;return l===null?(l=vo(n.tag,o,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=o,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&14680064,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,o=n.dependencies,l.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l}function cu(n,o,l,c,m,C){var F=2;if(c=n,typeof n=="function")ci(n)&&(F=1);else if(typeof n=="string")F=5;else e:switch(n){case y:return fi(l.children,m,C,o);case D:F=8,m|=8;break;case v:return n=vo(12,l,o,m|2),n.elementType=v,n.lanes=C,n;case ee:return n=vo(13,l,o,m),n.elementType=ee,n.lanes=C,n;case W:return n=vo(19,l,o,m),n.elementType=W,n.lanes=C,n;case $:return Ns(l,m,C,o);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case T:F=10;break e;case P:F=9;break e;case Z:F=11;break e;case ie:F=14;break e;case X:F=16,c=null;break e}throw Error(u(130,n==null?n:typeof n,""))}return o=vo(F,l,o,m),o.elementType=n,o.type=c,o.lanes=C,o}function fi(n,o,l,c){return n=vo(7,n,c,o),n.lanes=l,n}function Ns(n,o,l,c){return n=vo(22,n,c,o),n.elementType=$,n.lanes=l,n.stateNode={isHidden:!1},n}function Uo(n,o,l){return n=vo(6,n,null,o),n.lanes=l,n}function fa(n,o,l){return o=vo(4,n.children!==null?n.children:[],n.key,o),o.lanes=l,o.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},o}function Im(n,o,l,c,m){this.tag=o,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=et,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Zf(0),this.expirationTimes=Zf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zf(0),this.identifierPrefix=c,this.onRecoverableError=m,_t&&(this.mutableSourceEagerHydrationData=null)}function Wg(n,o,l,c,m,C,F,z,ue){return n=new Im(n,o,l,z,ue),o===1?(o=1,C===!0&&(o|=8)):o=0,C=vo(3,null,null,o),n.current=C,C.stateNode=n,C.memoizedState={element:c,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},xl(C),n}function jg(n){if(!n)return br;n=n._reactInternals;e:{if(ge(n)!==n||n.tag!==1)throw Error(u(170));var o=n;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(K(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(u(171))}if(n.tag===1){var l=n.type;if(K(l))return Ne(n,l,o)}return o}function Xc(n){var o=n._reactInternals;if(o===void 0)throw typeof n.render=="function"?Error(u(188)):(n=Object.keys(n).join(","),Error(u(268,n)));return n=be(o),n===null?null:n.stateNode}function ga(n,o){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l=Te&&C>=Rt&&m<=ut&&F<=Ze){n.splice(o,1);break}else if(c!==Te||l.width!==ue.width||ZeF){if(!(C!==Rt||l.height!==ue.height||utm)){Te>c&&(ue.width+=Te-c,ue.x=c),utC&&(ue.height+=Rt-C,ue.y=C),Zel&&(l=F)),F ")+` No matching component was found for: - `)+n.join(" > ")}return null},r.getPublicRootInstance=function(n){return n=n.current,n.child?n.child.tag===5?ae(n.child.stateNode):n.child.stateNode:null},r.injectIntoDevTools=function(n){if(n={bundleType:n.bundleType,version:n.version,rendererPackageName:n.rendererPackageName,rendererConfig:n.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:p.ReactCurrentDispatcher,findHostInstanceByFiber:Kg,findFiberByHostInstance:n.findFiberByHostInstance||Jg,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")n=!1;else{var o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(o.isDisabled||!o.supportsFiber)n=!0;else{try{wl=o.inject(n),oi=o}catch{}n=!!o.checkDCE}}return n},r.isAlreadyRendering=function(){return!1},r.observeVisibleRects=function(n,o,l,c){if(!ce)throw Error(u(363));n=zl(n,o);var m=lr(n,l,c).disconnect;return{disconnect:function(){m()}}},r.registerMutableSourceForHydration=function(n,o){var l=o._getVersion;l=l(o._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[o,l]:n.mutableSourceEagerHydrationData.push(o,l)},r.runWithPriority=function(n,o){var l=Gt;try{return Gt=n,o()}finally{Gt=l}},r.shouldError=function(){return null},r.shouldSuspend=function(){return!1},r.updateContainer=function(n,o,l,c){var m=o.current,C=Wr(),F=bs(m);return l=jg(l),o.context===null?o.context=l:o.pendingContext=l,o=Zi(C,F),o.payload={element:n},c=c===void 0?null:c,c!==null&&(o.callback=c),n=Zn(m,o,F),n!==null&&(oo(n,m,F,C),bA(n,m,F)),F},r}});var YC=Ar((W1,JC)=>{"use strict";JC.exports=KC()});var VC=Ar(ol=>{"use strict";ol.ConcurrentRoot=1;ol.ContinuousEventPriority=4;ol.DefaultEventPriority=16;ol.DiscreteEventPriority=1;ol.IdleEventPriority=536870912;ol.LegacyRoot=0});var qC=Ar((K1,$C)=>{"use strict";$C.exports=VC()});var aB=Ar((ux,sB)=>{sB.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var ya=Ar((Hx,wB)=>{"use strict";var yB=["nodebuffer","arraybuffer","fragments"],QB=typeof Blob<"u";QB&&yB.push("blob");wB.exports={BINARY_TYPES:yB,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:QB,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Sf=Ar((Wx,Sd)=>{"use strict";var{EMPTY_BUFFER:eS}=ya(),hE=Buffer[Symbol.species];function tS(e,t){if(e.length===0)return eS;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),i=0;for(let s=0;s{"use strict";var SB=Symbol("kDone"),BE=Symbol("kRun"),DE=class{constructor(t){this[SB]=()=>{this.pending--,this[BE]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[BE]()}[BE](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[SB])}}};RB.exports=DE});var xu=Ar((Kx,xB)=>{"use strict";var Rf=qr("zlib"),FB=Sf(),nS=bB(),{kStatusCode:kB}=ya(),oS=Buffer[Symbol.species],iS=Buffer.from([0,0,255,255]),bd=Symbol("permessage-deflate"),Qa=Symbol("total-length"),ku=Symbol("callback"),fA=Symbol("buffers"),Nu=Symbol("error"),Rd,yE=class{constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!Rd){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Rd=new nS(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[ku];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,i=t.find(s=>!(r.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>s.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(i.server_no_context_takeover=!0),r.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(i.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?i.client_max_window_bits=r.clientMaxWindowBits:(i.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(i=>{let s=r[i];if(s.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(s=s[0],i==="client_max_window_bits"){if(s!==!0){let a=+s;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else if(i==="server_max_window_bits"){let a=+s;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=a}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else throw new Error(`Unknown parameter "${i}"`);r[i]=s})}),t}decompress(t,r,i){Rd.add(s=>{this._decompress(t,r,(a,u)=>{s(),i(a,u)})})}compress(t,r,i){Rd.add(s=>{this._compress(t,r,(a,u)=>{s(),i(a,u)})})}_decompress(t,r,i){let s=this._isServer?"client":"server";if(!this._inflate){let a=`${s}_max_window_bits`,u=typeof this.params[a]!="number"?Rf.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=Rf.createInflateRaw({...this._options.zlibInflateOptions,windowBits:u}),this._inflate[bd]=this,this._inflate[Qa]=0,this._inflate[fA]=[],this._inflate.on("error",aS),this._inflate.on("data",NB)}this._inflate[ku]=i,this._inflate.write(t),r&&this._inflate.write(iS),this._inflate.flush(()=>{let a=this._inflate[Nu];if(a){this._inflate.close(),this._inflate=null,i(a);return}let u=FB.concat(this._inflate[fA],this._inflate[Qa]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Qa]=0,this._inflate[fA]=[],r&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),i(null,u)})}_compress(t,r,i){let s=this._isServer?"server":"client";if(!this._deflate){let a=`${s}_max_window_bits`,u=typeof this.params[a]!="number"?Rf.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=Rf.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:u}),this._deflate[Qa]=0,this._deflate[fA]=[],this._deflate.on("data",sS)}this._deflate[ku]=i,this._deflate.write(t),this._deflate.flush(Rf.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=FB.concat(this._deflate[fA],this._deflate[Qa]);r&&(a=new oS(a.buffer,a.byteOffset,a.length-4)),this._deflate[ku]=null,this._deflate[Qa]=0,this._deflate[fA]=[],r&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),i(null,a)})}};xB.exports=yE;function sS(e){this[fA].push(e),this[Qa]+=e.length}function NB(e){if(this[Qa]+=e.length,this[bd]._maxPayload<1||this[Qa]<=this[bd]._maxPayload){this[fA].push(e);return}this[Nu]=new RangeError("Max payload size exceeded"),this[Nu].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Nu][kB]=1009,this.removeListener("data",NB),this.reset()}function aS(e){if(this[bd]._inflate=null,this[Nu]){this[ku](this[Nu]);return}e[kB]=1007,this[ku](e)}});var Tu=Ar((Jx,Fd)=>{"use strict";var{isUtf8:TB}=qr("buffer"),{hasBlob:AS}=ya(),lS=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function uS(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function QE(e){let t=e.length,r=0;for(;r=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}function cS(e){return AS&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Fd.exports={isBlob:cS,isValidStatusCode:uS,isValidUTF8:QE,tokenChars:lS};if(TB)Fd.exports.isValidUTF8=function(e){return e.length<24?QE(e):TB(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=qr("utf-8-validate");Fd.exports.isValidUTF8=function(t){return t.length<32?QE(t):e(t)}}catch{}});var RE=Ar((Yx,HB)=>{"use strict";var{Writable:fS}=qr("stream"),OB=xu(),{BINARY_TYPES:gS,EMPTY_BUFFER:LB,kStatusCode:dS,kWebSocket:pS}=ya(),{concat:wE,toArrayBuffer:mS,unmask:ES}=Sf(),{isValidStatusCode:IS,isValidUTF8:MB}=Tu(),kd=Buffer[Symbol.species],Li=0,PB=1,UB=2,GB=3,vE=4,_E=5,Nd=6,SE=class extends fS{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||gS[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[pS]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Li}_write(t,r,i){if(this._opcode===8&&this._state==Li)return i();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){i(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(i)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t=i.length?r.set(this._buffers.shift(),s):(r.set(new Uint8Array(i.buffer,i.byteOffset,t),s),this._buffers[0]=new kd(i.buffer,i.byteOffset+t,i.length-t)),t-=i.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Li:this.getInfo(t);break;case PB:this.getPayloadLength16(t);break;case UB:this.getPayloadLength64(t);break;case GB:this.getMask();break;case vE:this.getData(t);break;case _E:case Nd:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let s=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(s);return}let i=(r[0]&64)===64;if(i&&!this._extensions[OB.extensionName]){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(s);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(s);return}if(!this._fragmented){let s=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(s);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(s);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let s=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(s);return}if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(s);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let s=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(s);return}}else{let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(s);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let s=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(s);return}}else if(this._masked){let s=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(s);return}this._payloadLength===126?this._state=PB:this._payloadLength===127?this._state=UB:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),i=r.readUInt32BE(0);if(i>Math.pow(2,21)-1){let s=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(s);return}this._payloadLength=i*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=GB:this._state=vE}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=vE}getData(t){let r=LB;if(this._payloadLength){if(this._bufferedBytes7){this.controlMessage(r,t);return}if(this._compressed){this._state=_E,this.decompress(r,t);return}if(r.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let i=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(i);return}this._messageLength=this._totalPayloadLength,this._fragments.push(r)}this.dataMessage(t)}decompress(t,r){this._extensions[OB.extensionName].decompress(t,this._fin,(s,a)=>{if(s)return r(s);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let u=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(u);return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let u=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");r(u);return}this._fragments.push(a)}this.dataMessage(r),this._state===Li&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Li;return}let r=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let s;this._binaryType==="nodebuffer"?s=wE(i,r):this._binaryType==="arraybuffer"?s=mS(wE(i,r)):this._binaryType==="blob"?s=new Blob(i):s=i,this._allowSynchronousEvents?(this.emit("message",s,!0),this._state=Li):(this._state=Nd,setImmediate(()=>{this.emit("message",s,!0),this._state=Li,this.startLoop(t)}))}else{let s=wE(i,r);if(!this._skipUTF8Validation&&!MB(s)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===_E||this._allowSynchronousEvents?(this.emit("message",s,!1),this._state=Li):(this._state=Nd,setImmediate(()=>{this.emit("message",s,!1),this._state=Li,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,LB),this.end();else{let i=t.readUInt16BE(0);if(!IS(i)){let a=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let s=new kd(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!MB(s)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(a);return}this._loop=!1,this.emit("conclude",i,s),this.end()}this._state=Li;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Li):(this._state=Nd,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Li,this.startLoop(r)}))}createError(t,r,i,s,a){this._loop=!1,this._errored=!0;let u=new t(i?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(u,this.createError),u.code=a,u[dS]=s,u}};HB.exports=SE});var kE=Ar(($x,KB)=>{"use strict";var{Duplex:Vx}=qr("stream"),{randomFillSync:hS}=qr("crypto"),{types:{isUint8Array:CS}}=qr("util"),WB=xu(),{EMPTY_BUFFER:BS,kWebSocket:DS,NOOP:yS}=ya(),{isBlob:Ou,isValidStatusCode:QS}=Tu(),{mask:jB,toBuffer:sl}=Sf(),Mi=Symbol("kByteLength"),wS=Buffer.alloc(4),xd=8*1024,al,Lu=xd,ds=0,vS=1,_S=2,bE=class e{constructor(t,r,i){this._extensions=r||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ds,this.onerror=yS,this[DS]=void 0}static frame(t,r){let i,s=!1,a=2,u=!1;r.mask&&(i=r.maskBuffer||wS,r.generateMask?r.generateMask(i):(Lu===xd&&(al===void 0&&(al=Buffer.alloc(xd)),hS(al,0,xd),Lu=0),i[0]=al[Lu++],i[1]=al[Lu++],i[2]=al[Lu++],i[3]=al[Lu++]),u=(i[0]|i[1]|i[2]|i[3])===0,a=6);let p;typeof t=="string"?(!r.mask||u)&&r[Mi]!==void 0?p=r[Mi]:(t=Buffer.from(t),p=t.length):(p=t.length,s=r.mask&&r.readOnly&&!u);let E=p;p>=65536?(a+=8,E=127):p>125&&(a+=2,E=126);let I=Buffer.allocUnsafe(s?p+a:a);return I[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(I[0]|=64),I[1]=E,E===126?I.writeUInt16BE(p,2):E===127&&(I[2]=I[3]=0,I.writeUIntBE(p,4,6)),r.mask?(I[1]|=128,I[a-4]=i[0],I[a-3]=i[1],I[a-2]=i[2],I[a-1]=i[3],u?[I,t]:s?(jB(t,i,I,a,p),[I]):(jB(t,i,t,0,p),[I,t])):[I,t]}close(t,r,i,s){let a;if(t===void 0)a=BS;else{if(typeof t!="number"||!QS(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let p=Buffer.byteLength(r);if(p>123)throw new RangeError("The message must not be greater than 123 bytes");if(a=Buffer.allocUnsafe(2+p),a.writeUInt16BE(t,0),typeof r=="string")a.write(r,2);else if(CS(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let u={[Mi]:a.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ds?this.enqueue([this.dispatch,a,!1,u,s]):this.sendFrame(e.frame(a,u),s)}ping(t,r,i){let s,a;if(typeof t=="string"?(s=Buffer.byteLength(t),a=!1):Ou(t)?(s=t.size,a=!1):(t=sl(t),s=t.length,a=sl.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[Mi]:s,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};Ou(t)?this._state!==ds?this.enqueue([this.getBlobData,t,!1,u,i]):this.getBlobData(t,!1,u,i):this._state!==ds?this.enqueue([this.dispatch,t,!1,u,i]):this.sendFrame(e.frame(t,u),i)}pong(t,r,i){let s,a;if(typeof t=="string"?(s=Buffer.byteLength(t),a=!1):Ou(t)?(s=t.size,a=!1):(t=sl(t),s=t.length,a=sl.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[Mi]:s,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};Ou(t)?this._state!==ds?this.enqueue([this.getBlobData,t,!1,u,i]):this.getBlobData(t,!1,u,i):this._state!==ds?this.enqueue([this.dispatch,t,!1,u,i]):this.sendFrame(e.frame(t,u),i)}send(t,r,i){let s=this._extensions[WB.extensionName],a=r.binary?2:1,u=r.compress,p,E;typeof t=="string"?(p=Buffer.byteLength(t),E=!1):Ou(t)?(p=t.size,E=!1):(t=sl(t),p=t.length,E=sl.readOnly),this._firstFragment?(this._firstFragment=!1,u&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(u=p>=s._threshold),this._compress=u):(u=!1,a=0),r.fin&&(this._firstFragment=!0);let I={[Mi]:p,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:E,rsv1:u};Ou(t)?this._state!==ds?this.enqueue([this.getBlobData,t,this._compress,I,i]):this.getBlobData(t,this._compress,I,i):this._state!==ds?this.enqueue([this.dispatch,t,this._compress,I,i]):this.dispatch(t,this._compress,I,i)}getBlobData(t,r,i,s){this._bufferedBytes+=i[Mi],this._state=_S,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let p=new Error("The socket was closed while the blob was being read");process.nextTick(FE,this,p,s);return}this._bufferedBytes-=i[Mi];let u=sl(a);r?this.dispatch(u,r,i,s):(this._state=ds,this.sendFrame(e.frame(u,i),s),this.dequeue())}).catch(a=>{process.nextTick(SS,this,a,s)})}dispatch(t,r,i,s){if(!r){this.sendFrame(e.frame(t,i),s);return}let a=this._extensions[WB.extensionName];this._bufferedBytes+=i[Mi],this._state=vS,a.compress(t,i.fin,(u,p)=>{if(this._socket.destroyed){let E=new Error("The socket was closed while data was being compressed");FE(this,E,s);return}this._bufferedBytes-=i[Mi],this._state=ds,i.readOnly=!1,this.sendFrame(e.frame(p,i),s),this.dequeue()})}dequeue(){for(;this._state===ds&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Mi],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Mi],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};KB.exports=bE;function FE(e,t,r){typeof r=="function"&&r(t);for(let i=0;i{"use strict";var{kForOnEventAttribute:bf,kListener:NE}=ya(),JB=Symbol("kCode"),YB=Symbol("kData"),VB=Symbol("kError"),$B=Symbol("kMessage"),qB=Symbol("kReason"),Mu=Symbol("kTarget"),zB=Symbol("kType"),XB=Symbol("kWasClean"),wa=class{constructor(t){this[Mu]=null,this[zB]=t}get target(){return this[Mu]}get type(){return this[zB]}};Object.defineProperty(wa.prototype,"target",{enumerable:!0});Object.defineProperty(wa.prototype,"type",{enumerable:!0});var Al=class extends wa{constructor(t,r={}){super(t),this[JB]=r.code===void 0?0:r.code,this[qB]=r.reason===void 0?"":r.reason,this[XB]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[JB]}get reason(){return this[qB]}get wasClean(){return this[XB]}};Object.defineProperty(Al.prototype,"code",{enumerable:!0});Object.defineProperty(Al.prototype,"reason",{enumerable:!0});Object.defineProperty(Al.prototype,"wasClean",{enumerable:!0});var Pu=class extends wa{constructor(t,r={}){super(t),this[VB]=r.error===void 0?null:r.error,this[$B]=r.message===void 0?"":r.message}get error(){return this[VB]}get message(){return this[$B]}};Object.defineProperty(Pu.prototype,"error",{enumerable:!0});Object.defineProperty(Pu.prototype,"message",{enumerable:!0});var Ff=class extends wa{constructor(t,r={}){super(t),this[YB]=r.data===void 0?null:r.data}get data(){return this[YB]}};Object.defineProperty(Ff.prototype,"data",{enumerable:!0});var RS={addEventListener(e,t,r={}){for(let s of this.listeners(e))if(!r[bf]&&s[NE]===t&&!s[bf])return;let i;if(e==="message")i=function(a,u){let p=new Ff("message",{data:u?a:a.toString()});p[Mu]=this,Td(t,this,p)};else if(e==="close")i=function(a,u){let p=new Al("close",{code:a,reason:u.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});p[Mu]=this,Td(t,this,p)};else if(e==="error")i=function(a){let u=new Pu("error",{error:a,message:a.message});u[Mu]=this,Td(t,this,u)};else if(e==="open")i=function(){let a=new wa("open");a[Mu]=this,Td(t,this,a)};else return;i[bf]=!!r[bf],i[NE]=t,r.once?this.once(e,i):this.on(e,i)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[NE]===t&&!r[bf]){this.removeListener(e,r);break}}};ZB.exports={CloseEvent:Al,ErrorEvent:Pu,Event:wa,EventTarget:RS,MessageEvent:Ff};function Td(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var Od=Ar((zx,tD)=>{"use strict";var{tokenChars:kf}=Tu();function Gs(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function bS(e){let t=Object.create(null),r=Object.create(null),i=!1,s=!1,a=!1,u,p,E=-1,I=-1,y=-1,D=0;for(;D{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(i=>[t].concat(Object.keys(i).map(s=>{let a=i[s];return Array.isArray(a)||(a=[a]),a.map(u=>u===!0?s:`${s}=${u}`).join("; ")})).join("; ")).join(", ")}).join(", ")}tD.exports={format:FS,parse:bS}});var Ud=Ar((eT,gD)=>{"use strict";var kS=qr("events"),NS=qr("https"),xS=qr("http"),oD=qr("net"),TS=qr("tls"),{randomBytes:OS,createHash:LS}=qr("crypto"),{Duplex:Xx,Readable:Zx}=qr("stream"),{URL:xE}=qr("url"),gA=xu(),MS=RE(),PS=kE(),{isBlob:US}=Tu(),{BINARY_TYPES:rD,CLOSE_TIMEOUT:GS,EMPTY_BUFFER:Ld,GUID:HS,kForOnEventAttribute:TE,kListener:WS,kStatusCode:jS,kWebSocket:Jn,NOOP:iD}=ya(),{EventTarget:{addEventListener:KS,removeEventListener:JS}}=eD(),{format:YS,parse:VS}=Od(),{toBuffer:$S}=Sf(),sD=Symbol("kAborted"),OE=[8,13],va=["CONNECTING","OPEN","CLOSING","CLOSED"],qS=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,en=class e extends kS{constructor(t,r,i){super(),this._binaryType=rD[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Ld,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(i=r,r=[]):r=[r]),aD(this,t,r,i)):(this._autoPong=i.autoPong,this._closeTimeout=i.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){rD.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,i){let s=new MS({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:i.maxBufferedChunks,maxFragments:i.maxFragments,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation}),a=new PS(t,this._extensions,i.generateMask);this._receiver=s,this._sender=a,this._socket=t,s[Jn]=this,a[Jn]=this,t[Jn]=this,s.on("conclude",ZS),s.on("drain",eR),s.on("error",tR),s.on("message",rR),s.on("ping",nR),s.on("pong",oR),a.onerror=iR,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",uD),t.on("data",Pd),t.on("end",cD),t.on("error",fD),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[gA.extensionName]&&this._extensions[gA.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){mi(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),lD(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=r=void 0):typeof r=="function"&&(i=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){LE(this,t,i);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||Ld,r,i)}pong(t,r,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=r=void 0):typeof r=="function"&&(i=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){LE(this,t,i);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||Ld,r,i)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(i=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){LE(this,t,i);return}let s={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[gA.extensionName]||(s.compress=!1),this._sender.send(t||Ld,s,i)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){mi(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(en,"CONNECTING",{enumerable:!0,value:va.indexOf("CONNECTING")});Object.defineProperty(en.prototype,"CONNECTING",{enumerable:!0,value:va.indexOf("CONNECTING")});Object.defineProperty(en,"OPEN",{enumerable:!0,value:va.indexOf("OPEN")});Object.defineProperty(en.prototype,"OPEN",{enumerable:!0,value:va.indexOf("OPEN")});Object.defineProperty(en,"CLOSING",{enumerable:!0,value:va.indexOf("CLOSING")});Object.defineProperty(en.prototype,"CLOSING",{enumerable:!0,value:va.indexOf("CLOSING")});Object.defineProperty(en,"CLOSED",{enumerable:!0,value:va.indexOf("CLOSED")});Object.defineProperty(en.prototype,"CLOSED",{enumerable:!0,value:va.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(en.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(en.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[TE])return t[WS];return null},set(t){for(let r of this.listeners(e))if(r[TE]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[TE]:!0})}})});en.prototype.addEventListener=KS;en.prototype.removeEventListener=JS;gD.exports=en;function aD(e,t,r,i){let s={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:GS,protocolVersion:OE[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...i,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=s.autoPong,e._closeTimeout=s.closeTimeout,!OE.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${OE.join(", ")})`);let a;if(t instanceof xE)a=t;else try{a=new xE(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),e._url=a.href;let u=a.protocol==="wss:",p=a.protocol==="ws+unix:",E;if(a.protocol!=="ws:"&&!u&&!p?E=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!a.pathname?E="The URL's pathname is empty":a.hash&&(E="The URL contains a fragment identifier"),E){let Z=new SyntaxError(E);if(e._redirects===0)throw Z;Md(e,Z);return}let I=u?443:80,y=OS(16).toString("base64"),D=u?NS.request:xS.request,v=new Set,T;if(s.createConnection=s.createConnection||(u?XS:zS),s.defaultPort=s.defaultPort||I,s.port=a.port||I,s.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,s.headers={...s.headers,"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":y,Connection:"Upgrade",Upgrade:"websocket"},s.path=a.pathname+a.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(T=new gA({...s.perMessageDeflate,isServer:!1,maxPayload:s.maxPayload}),s.headers["Sec-WebSocket-Extensions"]=YS({[gA.extensionName]:T.offer()})),r.length){for(let Z of r){if(typeof Z!="string"||!qS.test(Z)||v.has(Z))throw new SyntaxError("An invalid or duplicated subprotocol was specified");v.add(Z)}s.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(a.username||a.password)&&(s.auth=`${a.username}:${a.password}`),p){let Z=s.path.split(":");s.socketPath=Z[0],s.path=Z[1]}let P;if(s.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?s.socketPath:a.host;let Z=i&&i.headers;if(i={...i,headers:{}},Z)for(let[ee,W]of Object.entries(Z))i.headers[ee.toLowerCase()]=W}else if(e.listenerCount("redirect")===0){let Z=p?e._originalIpc?s.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!Z||e._originalSecure&&!u)&&(delete s.headers.authorization,delete s.headers.cookie,Z||delete s.headers.host,s.auth=void 0)}s.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),P=e._req=D(s),e._redirects&&e.emit("redirect",e.url,P)}else P=e._req=D(s);s.timeout&&P.on("timeout",()=>{mi(e,P,"Opening handshake has timed out")}),P.on("error",Z=>{P===null||P[sD]||(P=e._req=null,Md(e,Z))}),P.on("response",Z=>{let ee=Z.headers.location,W=Z.statusCode;if(ee&&s.followRedirects&&W>=300&&W<400){if(++e._redirects>s.maxRedirects){mi(e,P,"Maximum redirects exceeded");return}P.abort();let ie;try{ie=new xE(ee,t)}catch{let $=new SyntaxError(`Invalid URL: ${ee}`);Md(e,$);return}aD(e,ie,r,i)}else e.emit("unexpected-response",P,Z)||mi(e,P,`Unexpected server response: ${Z.statusCode}`)}),P.on("upgrade",(Z,ee,W)=>{if(e.emit("upgrade",Z),e.readyState!==en.CONNECTING)return;P=e._req=null;let ie=Z.headers.upgrade;if(ie===void 0||ie.toLowerCase()!=="websocket"){mi(e,ee,"Invalid Upgrade header");return}let X=LS("sha1").update(y+HS).digest("base64");if(Z.headers["sec-websocket-accept"]!==X){mi(e,ee,"Invalid Sec-WebSocket-Accept header");return}let $=Z.headers["sec-websocket-protocol"],Ee;if($!==void 0?v.size?v.has($)||(Ee="Server sent an invalid subprotocol"):Ee="Server sent a subprotocol but none was requested":v.size&&(Ee="Server sent no subprotocol"),Ee){mi(e,ee,Ee);return}$&&(e._protocol=$);let ye=Z.headers["sec-websocket-extensions"];if(ye!==void 0){if(!T){mi(e,ee,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let le;try{le=VS(ye)}catch{mi(e,ee,"Invalid Sec-WebSocket-Extensions header");return}let _e=Object.keys(le);if(_e.length!==1||_e[0]!==gA.extensionName){mi(e,ee,"Server indicated an extension that was not requested");return}try{T.accept(le[gA.extensionName])}catch{mi(e,ee,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[gA.extensionName]=T}e.setSocket(ee,W,{allowSynchronousEvents:s.allowSynchronousEvents,generateMask:s.generateMask,maxBufferedChunks:s.maxBufferedChunks,maxFragments:s.maxFragments,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),s.finishRequest?s.finishRequest(P,e):P.end()}function Md(e,t){e._readyState=en.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function zS(e){return e.path=e.socketPath,oD.connect(e)}function XS(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=oD.isIP(e.host)?"":e.host),TS.connect(e)}function mi(e,t,r){e._readyState=en.CLOSING;let i=new Error(r);Error.captureStackTrace(i,mi),t.setHeader?(t[sD]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(Md,e,i)):(t.destroy(i),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function LE(e,t,r){if(t){let i=US(t)?t.size:$S(t).length;e._socket?e._sender._bufferedBytes+=i:e._bufferedAmount+=i}if(r){let i=new Error(`WebSocket is not open: readyState ${e.readyState} (${va[e.readyState]})`);process.nextTick(r,i)}}function ZS(e,t){let r=this[Jn];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Jn]!==void 0&&(r._socket.removeListener("data",Pd),process.nextTick(AD,r._socket),e===1005?r.close():r.close(e,t))}function eR(){let e=this[Jn];e.isPaused||e._socket.resume()}function tR(e){let t=this[Jn];t._socket[Jn]!==void 0&&(t._socket.removeListener("data",Pd),process.nextTick(AD,t._socket),t.close(e[jS])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function nD(){this[Jn].emitClose()}function rR(e,t){this[Jn].emit("message",e,t)}function nR(e){let t=this[Jn];t._autoPong&&t.pong(e,!this._isServer,iD),t.emit("ping",e)}function oR(e){this[Jn].emit("pong",e)}function AD(e){e.resume()}function iR(e){let t=this[Jn];t.readyState!==en.CLOSED&&(t.readyState===en.OPEN&&(t._readyState=en.CLOSING,lD(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function lD(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function uD(){let e=this[Jn];if(this.removeListener("close",uD),this.removeListener("data",Pd),this.removeListener("end",cD),e._readyState=en.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[Jn]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",nD),e._receiver.on("finish",nD))}function Pd(e){this[Jn]._receiver.write(e)||this.pause()}function cD(){let e=this[Jn];e._readyState=en.CLOSING,e._receiver.end(),this.end()}function fD(){let e=this[Jn];this.removeListener("error",fD),this.on("error",iD),e&&(e._readyState=en.CLOSING,this.destroy())}});var ED=Ar((rT,mD)=>{"use strict";var tT=Ud(),{Duplex:sR}=qr("stream");function dD(e){e.emit("close")}function aR(){!this.destroyed&&this._writableState.finished&&this.destroy()}function pD(e){this.removeListener("error",pD),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function AR(e,t){let r=!0,i=new sR({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(a,u){let p=!u&&i._readableState.objectMode?a.toString():a;i.push(p)||e.pause()}),e.once("error",function(a){i.destroyed||(r=!1,i.destroy(a))}),e.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(s,a){if(e.readyState===e.CLOSED){a(s),process.nextTick(dD,i);return}let u=!1;e.once("error",function(E){u=!0,a(E)}),e.once("close",function(){u||a(s),process.nextTick(dD,i)}),r&&e.terminate()},i._final=function(s){if(e.readyState===e.CONNECTING){e.once("open",function(){i._final(s)});return}e._socket!==null&&(e._socket._writableState.finished?(s(),i._readableState.endEmitted&&i.destroy()):(e._socket.once("finish",function(){s()}),e.close()))},i._read=function(){e.isPaused&&e.resume()},i._write=function(s,a,u){if(e.readyState===e.CONNECTING){e.once("open",function(){i._write(s,a,u)});return}e.send(s,u)},i.on("end",aR),i.on("error",pD),i}mD.exports=AR});var ME=Ar((nT,ID)=>{"use strict";var{tokenChars:lR}=Tu();function uR(e){let t=new Set,r=-1,i=-1,s=0;for(s;s{"use strict";var cR=qr("events"),Gd=qr("http"),{Duplex:oT}=qr("stream"),{createHash:fR}=qr("crypto"),hD=Od(),ll=xu(),gR=ME(),dR=Ud(),{CLOSE_TIMEOUT:pR,GUID:mR,kWebSocket:ER}=ya(),IR=/^[+/0-9A-Za-z]{22}==$/,CD=0,BD=1,yD=2,PE=class extends cR{constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:pR,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:dR,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Gd.createServer((i,s)=>{let a=Gd.STATUS_CODES[426];s.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),s.end(a)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=hR(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,a,u)=>{this.handleUpgrade(s,a,u,i)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=CD}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===yD){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(Nf,this);return}if(t&&this.once("close",t),this._state!==BD)if(this._state=BD,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Nf,this):process.nextTick(Nf,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Nf(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,i,s){r.on("error",DD);let a=t.headers["sec-websocket-key"],u=t.headers.upgrade,p=+t.headers["sec-websocket-version"];if(t.method!=="GET"){ul(this,t,r,405,"Invalid HTTP method");return}if(u===void 0||u.toLowerCase()!=="websocket"){ul(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!IR.test(a)){ul(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(p!==13&&p!==8){ul(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){xf(r,400);return}let E=t.headers["sec-websocket-protocol"],I=new Set;if(E!==void 0)try{I=gR.parse(E)}catch{ul(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let y=t.headers["sec-websocket-extensions"],D={};if(this.options.perMessageDeflate&&y!==void 0){let v=new ll({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let T=hD.parse(y);T[ll.extensionName]&&(v.accept(T[ll.extensionName]),D[ll.extensionName]=v)}catch{ul(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let v={origin:t.headers[`${p===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(v,(T,P,Z,ee)=>{if(!T)return xf(r,P||401,Z,ee);this.completeUpgrade(D,a,I,t,r,i,s)});return}if(!this.options.verifyClient(v))return xf(r,401)}this.completeUpgrade(D,a,I,t,r,i,s)}completeUpgrade(t,r,i,s,a,u,p){if(!a.readable||!a.writable)return a.destroy();if(a[ER])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>CD)return xf(a,503);let I=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${fR("sha1").update(r+mR).digest("base64")}`],y=new this.options.WebSocket(null,void 0,this.options);if(i.size){let D=this.options.handleProtocols?this.options.handleProtocols(i,s):i.values().next().value;D&&(I.push(`Sec-WebSocket-Protocol: ${D}`),y._protocol=D)}if(t[ll.extensionName]){let D=t[ll.extensionName].params,v=hD.format({[ll.extensionName]:[D]});I.push(`Sec-WebSocket-Extensions: ${v}`),y._extensions=t}this.emit("headers",I,s),a.write(I.concat(`\r + `)+n.join(" > ")}return null},r.getPublicRootInstance=function(n){return n=n.current,n.child?n.child.tag===5?ae(n.child.stateNode):n.child.stateNode:null},r.injectIntoDevTools=function(n){if(n={bundleType:n.bundleType,version:n.version,rendererPackageName:n.rendererPackageName,rendererConfig:n.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:p.ReactCurrentDispatcher,findHostInstanceByFiber:Kg,findFiberByHostInstance:n.findFiberByHostInstance||Jg,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")n=!1;else{var o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(o.isDisabled||!o.supportsFiber)n=!0;else{try{wl=o.inject(n),oi=o}catch{}n=!!o.checkDCE}}return n},r.isAlreadyRendering=function(){return!1},r.observeVisibleRects=function(n,o,l,c){if(!ce)throw Error(u(363));n=zl(n,o);var m=ur(n,l,c).disconnect;return{disconnect:function(){m()}}},r.registerMutableSourceForHydration=function(n,o){var l=o._getVersion;l=l(o._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[o,l]:n.mutableSourceEagerHydrationData.push(o,l)},r.runWithPriority=function(n,o){var l=Gt;try{return Gt=n,o()}finally{Gt=l}},r.shouldError=function(){return null},r.shouldSuspend=function(){return!1},r.updateContainer=function(n,o,l,c){var m=o.current,C=Wr(),F=bs(m);return l=jg(l),o.context===null?o.context=l:o.pendingContext=l,o=Zi(C,F),o.payload={element:n},c=c===void 0?null:c,c!==null&&(o.callback=c),n=Zn(m,o,F),n!==null&&(oo(n,m,F,C),bA(n,m,F)),F},r}});var YC=Ar((W1,JC)=>{"use strict";JC.exports=KC()});var VC=Ar(ol=>{"use strict";ol.ConcurrentRoot=1;ol.ContinuousEventPriority=4;ol.DefaultEventPriority=16;ol.DiscreteEventPriority=1;ol.IdleEventPriority=536870912;ol.LegacyRoot=0});var qC=Ar((K1,$C)=>{"use strict";$C.exports=VC()});var aB=Ar((ux,sB)=>{sB.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var ya=Ar((Hx,wB)=>{"use strict";var yB=["nodebuffer","arraybuffer","fragments"],QB=typeof Blob<"u";QB&&yB.push("blob");wB.exports={BINARY_TYPES:yB,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:QB,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Sf=Ar((Wx,Sd)=>{"use strict";var{EMPTY_BUFFER:eS}=ya(),hE=Buffer[Symbol.species];function tS(e,t){if(e.length===0)return eS;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),i=0;for(let s=0;s{"use strict";var SB=Symbol("kDone"),BE=Symbol("kRun"),DE=class{constructor(t){this[SB]=()=>{this.pending--,this[BE]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[BE]()}[BE](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[SB])}}};RB.exports=DE});var xu=Ar((Kx,xB)=>{"use strict";var Rf=qr("zlib"),FB=Sf(),nS=bB(),{kStatusCode:kB}=ya(),oS=Buffer[Symbol.species],iS=Buffer.from([0,0,255,255]),bd=Symbol("permessage-deflate"),Qa=Symbol("total-length"),ku=Symbol("callback"),fA=Symbol("buffers"),Nu=Symbol("error"),Rd,yE=class{constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!Rd){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Rd=new nS(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[ku];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,i=t.find(s=>!(r.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>s.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(i.server_no_context_takeover=!0),r.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(i.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?i.client_max_window_bits=r.clientMaxWindowBits:(i.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(i=>{let s=r[i];if(s.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(s=s[0],i==="client_max_window_bits"){if(s!==!0){let a=+s;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else if(i==="server_max_window_bits"){let a=+s;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=a}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else throw new Error(`Unknown parameter "${i}"`);r[i]=s})}),t}decompress(t,r,i){Rd.add(s=>{this._decompress(t,r,(a,u)=>{s(),i(a,u)})})}compress(t,r,i){Rd.add(s=>{this._compress(t,r,(a,u)=>{s(),i(a,u)})})}_decompress(t,r,i){let s=this._isServer?"client":"server";if(!this._inflate){let a=`${s}_max_window_bits`,u=typeof this.params[a]!="number"?Rf.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=Rf.createInflateRaw({...this._options.zlibInflateOptions,windowBits:u}),this._inflate[bd]=this,this._inflate[Qa]=0,this._inflate[fA]=[],this._inflate.on("error",aS),this._inflate.on("data",NB)}this._inflate[ku]=i,this._inflate.write(t),r&&this._inflate.write(iS),this._inflate.flush(()=>{let a=this._inflate[Nu];if(a){this._inflate.close(),this._inflate=null,i(a);return}let u=FB.concat(this._inflate[fA],this._inflate[Qa]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Qa]=0,this._inflate[fA]=[],r&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),i(null,u)})}_compress(t,r,i){let s=this._isServer?"server":"client";if(!this._deflate){let a=`${s}_max_window_bits`,u=typeof this.params[a]!="number"?Rf.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=Rf.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:u}),this._deflate[Qa]=0,this._deflate[fA]=[],this._deflate.on("data",sS)}this._deflate[ku]=i,this._deflate.write(t),this._deflate.flush(Rf.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=FB.concat(this._deflate[fA],this._deflate[Qa]);r&&(a=new oS(a.buffer,a.byteOffset,a.length-4)),this._deflate[ku]=null,this._deflate[Qa]=0,this._deflate[fA]=[],r&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),i(null,a)})}};xB.exports=yE;function sS(e){this[fA].push(e),this[Qa]+=e.length}function NB(e){if(this[Qa]+=e.length,this[bd]._maxPayload<1||this[Qa]<=this[bd]._maxPayload){this[fA].push(e);return}this[Nu]=new RangeError("Max payload size exceeded"),this[Nu].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Nu][kB]=1009,this.removeListener("data",NB),this.reset()}function aS(e){if(this[bd]._inflate=null,this[Nu]){this[ku](this[Nu]);return}e[kB]=1007,this[ku](e)}});var Tu=Ar((Jx,Fd)=>{"use strict";var{isUtf8:TB}=qr("buffer"),{hasBlob:AS}=ya(),lS=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function uS(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function QE(e){let t=e.length,r=0;for(;r=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}function cS(e){return AS&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Fd.exports={isBlob:cS,isValidStatusCode:uS,isValidUTF8:QE,tokenChars:lS};if(TB)Fd.exports.isValidUTF8=function(e){return e.length<24?QE(e):TB(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=qr("utf-8-validate");Fd.exports.isValidUTF8=function(t){return t.length<32?QE(t):e(t)}}catch{}});var RE=Ar((Yx,HB)=>{"use strict";var{Writable:fS}=qr("stream"),OB=xu(),{BINARY_TYPES:gS,EMPTY_BUFFER:LB,kStatusCode:dS,kWebSocket:pS}=ya(),{concat:wE,toArrayBuffer:mS,unmask:ES}=Sf(),{isValidStatusCode:IS,isValidUTF8:MB}=Tu(),kd=Buffer[Symbol.species],Li=0,PB=1,UB=2,GB=3,vE=4,_E=5,Nd=6,SE=class extends fS{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||gS[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[pS]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Li}_write(t,r,i){if(this._opcode===8&&this._state==Li)return i();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){i(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(i)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t=i.length?r.set(this._buffers.shift(),s):(r.set(new Uint8Array(i.buffer,i.byteOffset,t),s),this._buffers[0]=new kd(i.buffer,i.byteOffset+t,i.length-t)),t-=i.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Li:this.getInfo(t);break;case PB:this.getPayloadLength16(t);break;case UB:this.getPayloadLength64(t);break;case GB:this.getMask();break;case vE:this.getData(t);break;case _E:case Nd:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let s=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(s);return}let i=(r[0]&64)===64;if(i&&!this._extensions[OB.extensionName]){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(s);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(s);return}if(!this._fragmented){let s=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(s);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(s);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let s=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(s);return}if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(s);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let s=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(s);return}}else{let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(s);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let s=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(s);return}}else if(this._masked){let s=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(s);return}this._payloadLength===126?this._state=PB:this._payloadLength===127?this._state=UB:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),i=r.readUInt32BE(0);if(i>Math.pow(2,21)-1){let s=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(s);return}this._payloadLength=i*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=GB:this._state=vE}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=vE}getData(t){let r=LB;if(this._payloadLength){if(this._bufferedBytes7){this.controlMessage(r,t);return}if(this._compressed){this._state=_E,this.decompress(r,t);return}if(r.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let i=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(i);return}this._messageLength=this._totalPayloadLength,this._fragments.push(r)}this.dataMessage(t)}decompress(t,r){this._extensions[OB.extensionName].decompress(t,this._fin,(s,a)=>{if(s)return r(s);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let u=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(u);return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){let u=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");r(u);return}this._fragments.push(a)}this.dataMessage(r),this._state===Li&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Li;return}let r=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let s;this._binaryType==="nodebuffer"?s=wE(i,r):this._binaryType==="arraybuffer"?s=mS(wE(i,r)):this._binaryType==="blob"?s=new Blob(i):s=i,this._allowSynchronousEvents?(this.emit("message",s,!0),this._state=Li):(this._state=Nd,setImmediate(()=>{this.emit("message",s,!0),this._state=Li,this.startLoop(t)}))}else{let s=wE(i,r);if(!this._skipUTF8Validation&&!MB(s)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===_E||this._allowSynchronousEvents?(this.emit("message",s,!1),this._state=Li):(this._state=Nd,setImmediate(()=>{this.emit("message",s,!1),this._state=Li,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,LB),this.end();else{let i=t.readUInt16BE(0);if(!IS(i)){let a=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let s=new kd(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!MB(s)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(a);return}this._loop=!1,this.emit("conclude",i,s),this.end()}this._state=Li;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Li):(this._state=Nd,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Li,this.startLoop(r)}))}createError(t,r,i,s,a){this._loop=!1,this._errored=!0;let u=new t(i?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(u,this.createError),u.code=a,u[dS]=s,u}};HB.exports=SE});var kE=Ar(($x,KB)=>{"use strict";var{Duplex:Vx}=qr("stream"),{randomFillSync:hS}=qr("crypto"),{types:{isUint8Array:CS}}=qr("util"),WB=xu(),{EMPTY_BUFFER:BS,kWebSocket:DS,NOOP:yS}=ya(),{isBlob:Ou,isValidStatusCode:QS}=Tu(),{mask:jB,toBuffer:sl}=Sf(),Mi=Symbol("kByteLength"),wS=Buffer.alloc(4),xd=8*1024,al,Lu=xd,ds=0,vS=1,_S=2,bE=class e{constructor(t,r,i){this._extensions=r||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ds,this.onerror=yS,this[DS]=void 0}static frame(t,r){let i,s=!1,a=2,u=!1;r.mask&&(i=r.maskBuffer||wS,r.generateMask?r.generateMask(i):(Lu===xd&&(al===void 0&&(al=Buffer.alloc(xd)),hS(al,0,xd),Lu=0),i[0]=al[Lu++],i[1]=al[Lu++],i[2]=al[Lu++],i[3]=al[Lu++]),u=(i[0]|i[1]|i[2]|i[3])===0,a=6);let p;typeof t=="string"?(!r.mask||u)&&r[Mi]!==void 0?p=r[Mi]:(t=Buffer.from(t),p=t.length):(p=t.length,s=r.mask&&r.readOnly&&!u);let E=p;p>=65536?(a+=8,E=127):p>125&&(a+=2,E=126);let I=Buffer.allocUnsafe(s?p+a:a);return I[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(I[0]|=64),I[1]=E,E===126?I.writeUInt16BE(p,2):E===127&&(I[2]=I[3]=0,I.writeUIntBE(p,4,6)),r.mask?(I[1]|=128,I[a-4]=i[0],I[a-3]=i[1],I[a-2]=i[2],I[a-1]=i[3],u?[I,t]:s?(jB(t,i,I,a,p),[I]):(jB(t,i,t,0,p),[I,t])):[I,t]}close(t,r,i,s){let a;if(t===void 0)a=BS;else{if(typeof t!="number"||!QS(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let p=Buffer.byteLength(r);if(p>123)throw new RangeError("The message must not be greater than 123 bytes");if(a=Buffer.allocUnsafe(2+p),a.writeUInt16BE(t,0),typeof r=="string")a.write(r,2);else if(CS(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let u={[Mi]:a.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ds?this.enqueue([this.dispatch,a,!1,u,s]):this.sendFrame(e.frame(a,u),s)}ping(t,r,i){let s,a;if(typeof t=="string"?(s=Buffer.byteLength(t),a=!1):Ou(t)?(s=t.size,a=!1):(t=sl(t),s=t.length,a=sl.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[Mi]:s,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};Ou(t)?this._state!==ds?this.enqueue([this.getBlobData,t,!1,u,i]):this.getBlobData(t,!1,u,i):this._state!==ds?this.enqueue([this.dispatch,t,!1,u,i]):this.sendFrame(e.frame(t,u),i)}pong(t,r,i){let s,a;if(typeof t=="string"?(s=Buffer.byteLength(t),a=!1):Ou(t)?(s=t.size,a=!1):(t=sl(t),s=t.length,a=sl.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[Mi]:s,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};Ou(t)?this._state!==ds?this.enqueue([this.getBlobData,t,!1,u,i]):this.getBlobData(t,!1,u,i):this._state!==ds?this.enqueue([this.dispatch,t,!1,u,i]):this.sendFrame(e.frame(t,u),i)}send(t,r,i){let s=this._extensions[WB.extensionName],a=r.binary?2:1,u=r.compress,p,E;typeof t=="string"?(p=Buffer.byteLength(t),E=!1):Ou(t)?(p=t.size,E=!1):(t=sl(t),p=t.length,E=sl.readOnly),this._firstFragment?(this._firstFragment=!1,u&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(u=p>=s._threshold),this._compress=u):(u=!1,a=0),r.fin&&(this._firstFragment=!0);let I={[Mi]:p,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:E,rsv1:u};Ou(t)?this._state!==ds?this.enqueue([this.getBlobData,t,this._compress,I,i]):this.getBlobData(t,this._compress,I,i):this._state!==ds?this.enqueue([this.dispatch,t,this._compress,I,i]):this.dispatch(t,this._compress,I,i)}getBlobData(t,r,i,s){this._bufferedBytes+=i[Mi],this._state=_S,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let p=new Error("The socket was closed while the blob was being read");process.nextTick(FE,this,p,s);return}this._bufferedBytes-=i[Mi];let u=sl(a);r?this.dispatch(u,r,i,s):(this._state=ds,this.sendFrame(e.frame(u,i),s),this.dequeue())}).catch(a=>{process.nextTick(SS,this,a,s)})}dispatch(t,r,i,s){if(!r){this.sendFrame(e.frame(t,i),s);return}let a=this._extensions[WB.extensionName];this._bufferedBytes+=i[Mi],this._state=vS,a.compress(t,i.fin,(u,p)=>{if(this._socket.destroyed){let E=new Error("The socket was closed while data was being compressed");FE(this,E,s);return}this._bufferedBytes-=i[Mi],this._state=ds,i.readOnly=!1,this.sendFrame(e.frame(p,i),s),this.dequeue()})}dequeue(){for(;this._state===ds&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Mi],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Mi],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};KB.exports=bE;function FE(e,t,r){typeof r=="function"&&r(t);for(let i=0;i{"use strict";var{kForOnEventAttribute:bf,kListener:NE}=ya(),JB=Symbol("kCode"),YB=Symbol("kData"),VB=Symbol("kError"),$B=Symbol("kMessage"),qB=Symbol("kReason"),Mu=Symbol("kTarget"),zB=Symbol("kType"),XB=Symbol("kWasClean"),wa=class{constructor(t){this[Mu]=null,this[zB]=t}get target(){return this[Mu]}get type(){return this[zB]}};Object.defineProperty(wa.prototype,"target",{enumerable:!0});Object.defineProperty(wa.prototype,"type",{enumerable:!0});var Al=class extends wa{constructor(t,r={}){super(t),this[JB]=r.code===void 0?0:r.code,this[qB]=r.reason===void 0?"":r.reason,this[XB]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[JB]}get reason(){return this[qB]}get wasClean(){return this[XB]}};Object.defineProperty(Al.prototype,"code",{enumerable:!0});Object.defineProperty(Al.prototype,"reason",{enumerable:!0});Object.defineProperty(Al.prototype,"wasClean",{enumerable:!0});var Pu=class extends wa{constructor(t,r={}){super(t),this[VB]=r.error===void 0?null:r.error,this[$B]=r.message===void 0?"":r.message}get error(){return this[VB]}get message(){return this[$B]}};Object.defineProperty(Pu.prototype,"error",{enumerable:!0});Object.defineProperty(Pu.prototype,"message",{enumerable:!0});var Ff=class extends wa{constructor(t,r={}){super(t),this[YB]=r.data===void 0?null:r.data}get data(){return this[YB]}};Object.defineProperty(Ff.prototype,"data",{enumerable:!0});var RS={addEventListener(e,t,r={}){for(let s of this.listeners(e))if(!r[bf]&&s[NE]===t&&!s[bf])return;let i;if(e==="message")i=function(a,u){let p=new Ff("message",{data:u?a:a.toString()});p[Mu]=this,Td(t,this,p)};else if(e==="close")i=function(a,u){let p=new Al("close",{code:a,reason:u.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});p[Mu]=this,Td(t,this,p)};else if(e==="error")i=function(a){let u=new Pu("error",{error:a,message:a.message});u[Mu]=this,Td(t,this,u)};else if(e==="open")i=function(){let a=new wa("open");a[Mu]=this,Td(t,this,a)};else return;i[bf]=!!r[bf],i[NE]=t,r.once?this.once(e,i):this.on(e,i)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[NE]===t&&!r[bf]){this.removeListener(e,r);break}}};ZB.exports={CloseEvent:Al,ErrorEvent:Pu,Event:wa,EventTarget:RS,MessageEvent:Ff};function Td(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var Od=Ar((zx,tD)=>{"use strict";var{tokenChars:kf}=Tu();function Gs(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function bS(e){let t=Object.create(null),r=Object.create(null),i=!1,s=!1,a=!1,u,p,E=-1,I=-1,y=-1,D=0;for(;D{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(i=>[t].concat(Object.keys(i).map(s=>{let a=i[s];return Array.isArray(a)||(a=[a]),a.map(u=>u===!0?s:`${s}=${u}`).join("; ")})).join("; ")).join(", ")}).join(", ")}tD.exports={format:FS,parse:bS}});var Ud=Ar((eT,gD)=>{"use strict";var kS=qr("events"),NS=qr("https"),xS=qr("http"),oD=qr("net"),TS=qr("tls"),{randomBytes:OS,createHash:LS}=qr("crypto"),{Duplex:Xx,Readable:Zx}=qr("stream"),{URL:xE}=qr("url"),gA=xu(),MS=RE(),PS=kE(),{isBlob:US}=Tu(),{BINARY_TYPES:rD,CLOSE_TIMEOUT:GS,EMPTY_BUFFER:Ld,GUID:HS,kForOnEventAttribute:TE,kListener:WS,kStatusCode:jS,kWebSocket:Jn,NOOP:iD}=ya(),{EventTarget:{addEventListener:KS,removeEventListener:JS}}=eD(),{format:YS,parse:VS}=Od(),{toBuffer:$S}=Sf(),sD=Symbol("kAborted"),OE=[8,13],va=["CONNECTING","OPEN","CLOSING","CLOSED"],qS=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,en=class e extends kS{constructor(t,r,i){super(),this._binaryType=rD[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Ld,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(i=r,r=[]):r=[r]),aD(this,t,r,i)):(this._autoPong=i.autoPong,this._closeTimeout=i.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){rD.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,i){let s=new MS({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:i.maxBufferedChunks,maxFragments:i.maxFragments,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation}),a=new PS(t,this._extensions,i.generateMask);this._receiver=s,this._sender=a,this._socket=t,s[Jn]=this,a[Jn]=this,t[Jn]=this,s.on("conclude",ZS),s.on("drain",eR),s.on("error",tR),s.on("message",rR),s.on("ping",nR),s.on("pong",oR),a.onerror=iR,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",uD),t.on("data",Pd),t.on("end",cD),t.on("error",fD),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[gA.extensionName]&&this._extensions[gA.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){mi(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),lD(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=r=void 0):typeof r=="function"&&(i=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){LE(this,t,i);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||Ld,r,i)}pong(t,r,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(i=t,t=r=void 0):typeof r=="function"&&(i=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){LE(this,t,i);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||Ld,r,i)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,i){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(i=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){LE(this,t,i);return}let s={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[gA.extensionName]||(s.compress=!1),this._sender.send(t||Ld,s,i)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){mi(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(en,"CONNECTING",{enumerable:!0,value:va.indexOf("CONNECTING")});Object.defineProperty(en.prototype,"CONNECTING",{enumerable:!0,value:va.indexOf("CONNECTING")});Object.defineProperty(en,"OPEN",{enumerable:!0,value:va.indexOf("OPEN")});Object.defineProperty(en.prototype,"OPEN",{enumerable:!0,value:va.indexOf("OPEN")});Object.defineProperty(en,"CLOSING",{enumerable:!0,value:va.indexOf("CLOSING")});Object.defineProperty(en.prototype,"CLOSING",{enumerable:!0,value:va.indexOf("CLOSING")});Object.defineProperty(en,"CLOSED",{enumerable:!0,value:va.indexOf("CLOSED")});Object.defineProperty(en.prototype,"CLOSED",{enumerable:!0,value:va.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(en.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(en.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[TE])return t[WS];return null},set(t){for(let r of this.listeners(e))if(r[TE]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[TE]:!0})}})});en.prototype.addEventListener=KS;en.prototype.removeEventListener=JS;gD.exports=en;function aD(e,t,r,i){let s={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:GS,protocolVersion:OE[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...i,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=s.autoPong,e._closeTimeout=s.closeTimeout,!OE.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${OE.join(", ")})`);let a;if(t instanceof xE)a=t;else try{a=new xE(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),e._url=a.href;let u=a.protocol==="wss:",p=a.protocol==="ws+unix:",E;if(a.protocol!=="ws:"&&!u&&!p?E=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!a.pathname?E="The URL's pathname is empty":a.hash&&(E="The URL contains a fragment identifier"),E){let Z=new SyntaxError(E);if(e._redirects===0)throw Z;Md(e,Z);return}let I=u?443:80,y=OS(16).toString("base64"),D=u?NS.request:xS.request,v=new Set,T;if(s.createConnection=s.createConnection||(u?XS:zS),s.defaultPort=s.defaultPort||I,s.port=a.port||I,s.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,s.headers={...s.headers,"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":y,Connection:"Upgrade",Upgrade:"websocket"},s.path=a.pathname+a.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(T=new gA({...s.perMessageDeflate,isServer:!1,maxPayload:s.maxPayload}),s.headers["Sec-WebSocket-Extensions"]=YS({[gA.extensionName]:T.offer()})),r.length){for(let Z of r){if(typeof Z!="string"||!qS.test(Z)||v.has(Z))throw new SyntaxError("An invalid or duplicated subprotocol was specified");v.add(Z)}s.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(a.username||a.password)&&(s.auth=`${a.username}:${a.password}`),p){let Z=s.path.split(":");s.socketPath=Z[0],s.path=Z[1]}let P;if(s.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?s.socketPath:a.host;let Z=i&&i.headers;if(i={...i,headers:{}},Z)for(let[ee,W]of Object.entries(Z))i.headers[ee.toLowerCase()]=W}else if(e.listenerCount("redirect")===0){let Z=p?e._originalIpc?s.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!Z||e._originalSecure&&!u)&&(delete s.headers.authorization,delete s.headers.cookie,Z||delete s.headers.host,s.auth=void 0)}s.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),P=e._req=D(s),e._redirects&&e.emit("redirect",e.url,P)}else P=e._req=D(s);s.timeout&&P.on("timeout",()=>{mi(e,P,"Opening handshake has timed out")}),P.on("error",Z=>{P===null||P[sD]||(P=e._req=null,Md(e,Z))}),P.on("response",Z=>{let ee=Z.headers.location,W=Z.statusCode;if(ee&&s.followRedirects&&W>=300&&W<400){if(++e._redirects>s.maxRedirects){mi(e,P,"Maximum redirects exceeded");return}P.abort();let ie;try{ie=new xE(ee,t)}catch{let $=new SyntaxError(`Invalid URL: ${ee}`);Md(e,$);return}aD(e,ie,r,i)}else e.emit("unexpected-response",P,Z)||mi(e,P,`Unexpected server response: ${Z.statusCode}`)}),P.on("upgrade",(Z,ee,W)=>{if(e.emit("upgrade",Z),e.readyState!==en.CONNECTING)return;P=e._req=null;let ie=Z.headers.upgrade;if(ie===void 0||ie.toLowerCase()!=="websocket"){mi(e,ee,"Invalid Upgrade header");return}let X=LS("sha1").update(y+HS).digest("base64");if(Z.headers["sec-websocket-accept"]!==X){mi(e,ee,"Invalid Sec-WebSocket-Accept header");return}let $=Z.headers["sec-websocket-protocol"],Ee;if($!==void 0?v.size?v.has($)||(Ee="Server sent an invalid subprotocol"):Ee="Server sent a subprotocol but none was requested":v.size&&(Ee="Server sent no subprotocol"),Ee){mi(e,ee,Ee);return}$&&(e._protocol=$);let ye=Z.headers["sec-websocket-extensions"];if(ye!==void 0){if(!T){mi(e,ee,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let le;try{le=VS(ye)}catch{mi(e,ee,"Invalid Sec-WebSocket-Extensions header");return}let _e=Object.keys(le);if(_e.length!==1||_e[0]!==gA.extensionName){mi(e,ee,"Server indicated an extension that was not requested");return}try{T.accept(le[gA.extensionName])}catch{mi(e,ee,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[gA.extensionName]=T}e.setSocket(ee,W,{allowSynchronousEvents:s.allowSynchronousEvents,generateMask:s.generateMask,maxBufferedChunks:s.maxBufferedChunks,maxFragments:s.maxFragments,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),s.finishRequest?s.finishRequest(P,e):P.end()}function Md(e,t){e._readyState=en.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function zS(e){return e.path=e.socketPath,oD.connect(e)}function XS(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=oD.isIP(e.host)?"":e.host),TS.connect(e)}function mi(e,t,r){e._readyState=en.CLOSING;let i=new Error(r);Error.captureStackTrace(i,mi),t.setHeader?(t[sD]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(Md,e,i)):(t.destroy(i),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function LE(e,t,r){if(t){let i=US(t)?t.size:$S(t).length;e._socket?e._sender._bufferedBytes+=i:e._bufferedAmount+=i}if(r){let i=new Error(`WebSocket is not open: readyState ${e.readyState} (${va[e.readyState]})`);process.nextTick(r,i)}}function ZS(e,t){let r=this[Jn];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Jn]!==void 0&&(r._socket.removeListener("data",Pd),process.nextTick(AD,r._socket),e===1005?r.close():r.close(e,t))}function eR(){let e=this[Jn];e.isPaused||e._socket.resume()}function tR(e){let t=this[Jn];t._socket[Jn]!==void 0&&(t._socket.removeListener("data",Pd),process.nextTick(AD,t._socket),t.close(e[jS])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function nD(){this[Jn].emitClose()}function rR(e,t){this[Jn].emit("message",e,t)}function nR(e){let t=this[Jn];t._autoPong&&t.pong(e,!this._isServer,iD),t.emit("ping",e)}function oR(e){this[Jn].emit("pong",e)}function AD(e){e.resume()}function iR(e){let t=this[Jn];t.readyState!==en.CLOSED&&(t.readyState===en.OPEN&&(t._readyState=en.CLOSING,lD(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function lD(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function uD(){let e=this[Jn];if(this.removeListener("close",uD),this.removeListener("data",Pd),this.removeListener("end",cD),e._readyState=en.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[Jn]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",nD),e._receiver.on("finish",nD))}function Pd(e){this[Jn]._receiver.write(e)||this.pause()}function cD(){let e=this[Jn];e._readyState=en.CLOSING,e._receiver.end(),this.end()}function fD(){let e=this[Jn];this.removeListener("error",fD),this.on("error",iD),e&&(e._readyState=en.CLOSING,this.destroy())}});var ED=Ar((rT,mD)=>{"use strict";var tT=Ud(),{Duplex:sR}=qr("stream");function dD(e){e.emit("close")}function aR(){!this.destroyed&&this._writableState.finished&&this.destroy()}function pD(e){this.removeListener("error",pD),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function AR(e,t){let r=!0,i=new sR({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(a,u){let p=!u&&i._readableState.objectMode?a.toString():a;i.push(p)||e.pause()}),e.once("error",function(a){i.destroyed||(r=!1,i.destroy(a))}),e.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(s,a){if(e.readyState===e.CLOSED){a(s),process.nextTick(dD,i);return}let u=!1;e.once("error",function(E){u=!0,a(E)}),e.once("close",function(){u||a(s),process.nextTick(dD,i)}),r&&e.terminate()},i._final=function(s){if(e.readyState===e.CONNECTING){e.once("open",function(){i._final(s)});return}e._socket!==null&&(e._socket._writableState.finished?(s(),i._readableState.endEmitted&&i.destroy()):(e._socket.once("finish",function(){s()}),e.close()))},i._read=function(){e.isPaused&&e.resume()},i._write=function(s,a,u){if(e.readyState===e.CONNECTING){e.once("open",function(){i._write(s,a,u)});return}e.send(s,u)},i.on("end",aR),i.on("error",pD),i}mD.exports=AR});var ME=Ar((nT,ID)=>{"use strict";var{tokenChars:lR}=Tu();function uR(e){let t=new Set,r=-1,i=-1,s=0;for(s;s{"use strict";var cR=qr("events"),Gd=qr("http"),{Duplex:oT}=qr("stream"),{createHash:fR}=qr("crypto"),hD=Od(),ll=xu(),gR=ME(),dR=Ud(),{CLOSE_TIMEOUT:pR,GUID:mR,kWebSocket:ER}=ya(),IR=/^[+/0-9A-Za-z]{22}==$/,CD=0,BD=1,yD=2,PE=class extends cR{constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:pR,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:dR,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Gd.createServer((i,s)=>{let a=Gd.STATUS_CODES[426];s.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),s.end(a)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=hR(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,a,u)=>{this.handleUpgrade(s,a,u,i)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=CD}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===yD){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(Nf,this);return}if(t&&this.once("close",t),this._state!==BD)if(this._state=BD,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Nf,this):process.nextTick(Nf,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Nf(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,i,s){r.on("error",DD);let a=t.headers["sec-websocket-key"],u=t.headers.upgrade,p=+t.headers["sec-websocket-version"];if(t.method!=="GET"){ul(this,t,r,405,"Invalid HTTP method");return}if(u===void 0||u.toLowerCase()!=="websocket"){ul(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!IR.test(a)){ul(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(p!==13&&p!==8){ul(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){xf(r,400);return}let E=t.headers["sec-websocket-protocol"],I=new Set;if(E!==void 0)try{I=gR.parse(E)}catch{ul(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let y=t.headers["sec-websocket-extensions"],D={};if(this.options.perMessageDeflate&&y!==void 0){let v=new ll({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let T=hD.parse(y);T[ll.extensionName]&&(v.accept(T[ll.extensionName]),D[ll.extensionName]=v)}catch{ul(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let v={origin:t.headers[`${p===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(v,(T,P,Z,ee)=>{if(!T)return xf(r,P||401,Z,ee);this.completeUpgrade(D,a,I,t,r,i,s)});return}if(!this.options.verifyClient(v))return xf(r,401)}this.completeUpgrade(D,a,I,t,r,i,s)}completeUpgrade(t,r,i,s,a,u,p){if(!a.readable||!a.writable)return a.destroy();if(a[ER])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>CD)return xf(a,503);let I=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${fR("sha1").update(r+mR).digest("base64")}`],y=new this.options.WebSocket(null,void 0,this.options);if(i.size){let D=this.options.handleProtocols?this.options.handleProtocols(i,s):i.values().next().value;D&&(I.push(`Sec-WebSocket-Protocol: ${D}`),y._protocol=D)}if(t[ll.extensionName]){let D=t[ll.extensionName].params,v=hD.format({[ll.extensionName]:[D]});I.push(`Sec-WebSocket-Extensions: ${v}`),y._extensions=t}this.emit("headers",I,s),a.write(I.concat(`\r `).join(`\r `)),a.removeListener("error",DD),y.setSocket(a,u,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(y),y.on("close",()=>{this.clients.delete(y),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Nf,this)})),p(y,s)}};QD.exports=PE;function hR(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return function(){for(let i of Object.keys(t))e.removeListener(i,t[i])}}function Nf(e){e._state=yD,e.emit("close")}function DD(){this.destroy()}function xf(e,t,r,i){r=r||Gd.STATUS_CODES[t],i={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...i},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Gd.STATUS_CODES[t]}\r `+Object.keys(i).map(s=>`${s}: ${i[s]}`).join(`\r `)+`\r \r -`+r)}function ul(e,t,r,i,s,a){if(e.listenerCount("wsClientError")){let u=new Error(s);Error.captureStackTrace(u,ul),e.emit("wsClientError",u,r,t)}else xf(r,i,s,a)}});var CR,BR,DR,yR,QR,wR,vD,vR,Hd,UE=xm(()=>{CR=Me(ED(),1),BR=Me(Od(),1),DR=Me(xu(),1),yR=Me(RE(),1),QR=Me(kE(),1),wR=Me(ME(),1),vD=Me(Ud(),1),vR=Me(wD(),1),Hd=vD.default});var Wd,_D=xm(()=>{UE();Wd=global;Wd.WebSocket||=Hd;Wd.window||=global;Wd.self||=global;Wd.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:"InternalApp",isEnabled:!0,isValid:!0},{type:2,value:"InternalAppContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdoutContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStderrContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdinContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalFocusContext",isEnabled:!0,isValid:!0}]});var SD=Ar((jd,GE)=>{(function(t,r){typeof jd=="object"&&typeof GE=="object"?GE.exports=r():typeof define=="function"&&define.amd?define([],r):typeof jd=="object"?jd.ReactDevToolsBackend=r():t.ReactDevToolsBackend=r()})(self,()=>(()=>{var e={602:((s,a,u)=>{"use strict";var p;function E(se){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?E=function(j){return typeof j}:E=function(j){return j&&typeof Symbol=="function"&&j.constructor===Symbol&&j!==Symbol.prototype?"symbol":typeof j},E(se)}var I=u(206),y=u(189),D=Object.assign,v=y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=[],P=null;function Z(){if(P===null){var se=new Map;try{ie.useContext({_currentValue:null}),ie.useState(null),ie.useReducer(function(te){return te},null),ie.useRef(null),typeof ie.useCacheRefresh=="function"&&ie.useCacheRefresh(),ie.useLayoutEffect(function(){}),ie.useInsertionEffect(function(){}),ie.useEffect(function(){}),ie.useImperativeHandle(void 0,function(){return null}),ie.useDebugValue(null),ie.useCallback(function(){}),ie.useMemo(function(){return null}),typeof ie.useMemoCache=="function"&&ie.useMemoCache(0)}finally{var x=T;T=[]}for(var j=0;j"u"?ie:new Proxy(ie,X),Ee=0;function ye(se,x,j){var ae=x[j].source,te=0;e:for(;teCe;Ce++)if(fe=ye(Y,Ge,Ce),fe!==-1){Ee=Ce,Ge=fe;break e}Ge=-1}}e:{if(Y=He,fe=Z().get(nt.primitive),fe!==void 0){for(Ce=0;CeGe-Y?null:He.slice(Y,Ge-1),He!==null){if(Ge=0,te!==null){for(;GeGe;te--)Ae=ve.pop()}for(te=He.length-Ge-1;1<=te;te--)Ge=[],Y=He[te],(fe=He[te-1].functionName)?(Ce=fe.lastIndexOf("."),Ce===-1&&(Ce=0),fe.slice(Ce,Ce+3)==="use"&&(Ce+=3),fe=fe.slice(Ce)):fe="",fe={id:null,isStateEditable:!1,name:fe,value:void 0,subHooks:Ge},j&&(fe.hookSource={lineNumber:Y.lineNumber,columnNumber:Y.columnNumber,functionName:Y.functionName,fileName:Y.fileName}),Ae.push(fe),ve.push(Ae),Ae=Ge;te=He}Ge=nt.primitive,nt={id:Ge==="Context"||Ge==="DebugValue"?null:Ke++,isStateEditable:Ge==="Reducer"||Ge==="State",name:Ge,value:nt.value,subHooks:[]},j&&(Ge={lineNumber:null,functionName:null,fileName:null,columnNumber:null},He&&1<=He.length&&(He=He[0],Ge.lineNumber=He.lineNumber,Ge.functionName=He.functionName,Ge.fileName=He.fileName,Ge.columnNumber=He.columnNumber),nt.hookSource=Ge),Ae.push(nt)}return ge(ae,null),ae}function ge(se,x){for(var j=[],ae=0;ae{"use strict";s.exports=u(602)}),9:((s,a)=>{"use strict";var u;function p(ge){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?p=function(ze){return typeof ze}:p=function(ze){return ze&&typeof Symbol=="function"&&ze.constructor===Symbol&&ze!==Symbol.prototype?"symbol":typeof ze},p(ge)}var E=Symbol.for("react.element"),I=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),P=Symbol.for("react.context"),Z=Symbol.for("react.server_context"),ee=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),ie=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Ee=Symbol.for("react.offscreen"),ye=Symbol.for("react.cache"),le=Symbol.for("react.client.reference");function _e(ge){if(p(ge)==="object"&&ge!==null){var ct=ge.$$typeof;switch(ct){case E:switch(ge=ge.type,ge){case y:case v:case D:case W:case ie:return ge;default:switch(ge=ge&&ge.$$typeof,ge){case Z:case P:case ee:case $:case X:case T:return ge;default:return ct}}case I:return ct}}}a.ContextConsumer=P,a.ContextProvider=T,u=E,a.ForwardRef=ee,a.Fragment=y,a.Lazy=$,a.Memo=X,a.Portal=I,a.Profiler=v,a.StrictMode=D,a.Suspense=W,u=ie,u=function(){return!1},u=function(){return!1},u=function(ge){return _e(ge)===P},u=function(ge){return _e(ge)===T},a.isElement=function(ge){return p(ge)==="object"&&ge!==null&&ge.$$typeof===E},u=function(ge){return _e(ge)===ee},u=function(ge){return _e(ge)===y},u=function(ge){return _e(ge)===$},u=function(ge){return _e(ge)===X},u=function(ge){return _e(ge)===I},u=function(ge){return _e(ge)===v},u=function(ge){return _e(ge)===D},u=function(ge){return _e(ge)===W},u=function(ge){return _e(ge)===ie},u=function(ge){return typeof ge=="string"||typeof ge=="function"||ge===y||ge===v||ge===D||ge===W||ge===ie||ge===Ee||ge===ye||p(ge)==="object"&&ge!==null&&(ge.$$typeof===$||ge.$$typeof===X||ge.$$typeof===T||ge.$$typeof===P||ge.$$typeof===ee||ge.$$typeof===le||ge.getModuleId!==void 0)},a.typeOf=_e}),550:((s,a,u)=>{"use strict";s.exports=u(9)}),978:((s,a)=>{"use strict";function u(J){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?u=function(at){return typeof at}:u=function(at){return at&&typeof Symbol=="function"&&at.constructor===Symbol&&at!==Symbol.prototype?"symbol":typeof at},u(J)}var p=Symbol.for("react.element"),E=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),v=Symbol.for("react.provider"),T=Symbol.for("react.context"),P=Symbol.for("react.server_context"),Z=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),$=Symbol.for("react.debug_trace_mode"),Ee=Symbol.for("react.offscreen"),ye=Symbol.for("react.cache"),le=Symbol.for("react.default_value"),_e=Symbol.for("react.postpone"),ge=Symbol.iterator;function ct(J){return J===null||u(J)!=="object"?null:(J=ge&&J[ge]||J["@@iterator"],typeof J=="function"?J:null)}var ze={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},be=Object.assign,se={};function x(J,ce,at){this.props=J,this.context=ce,this.refs=se,this.updater=at||ze}x.prototype.isReactComponent={},x.prototype.setState=function(J,ce){if(u(J)!=="object"&&typeof J!="function"&&J!=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,J,ce,"setState")},x.prototype.forceUpdate=function(J){this.updater.enqueueForceUpdate(this,J,"forceUpdate")};function j(){}j.prototype=x.prototype;function ae(J,ce,at){this.props=J,this.context=ce,this.refs=se,this.updater=at||ze}var te=ae.prototype=new j;te.constructor=ae,be(te,x.prototype),te.isPureReactComponent=!0;var Ae=Array.isArray,Ke=Object.prototype.hasOwnProperty,ve={current:null},st={key:!0,ref:!0,__self:!0,__source:!0};function nt(J,ce,at){var mt,St={},Nt=null,Zt=null;if(ce!=null)for(mt in ce.ref!==void 0&&(Zt=ce.ref),ce.key!==void 0&&(Nt=""+ce.key),ce)Ke.call(ce,mt)&&!st.hasOwnProperty(mt)&&(St[mt]=ce[mt]);var sr=arguments.length-2;if(sr===1)St.children=at;else if(1{"use strict";s.exports=u(978)}),206:(function(s,a,u){var p,E,I;function y(D){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?y=function(T){return typeof T}:y=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},y(D)}(function(D,v){"use strict";E=[u(430)],p=v,I=typeof p=="function"?p.apply(a,E):p,I!==void 0&&(s.exports=I)})(this,function(v){"use strict";var T=/(^|@)\S+:\d+/,P=/^\s*at .*(\S+:\d+|\(native\))/m,Z=/^(eval@)?(\[native code])?$/;return{parse:function(W){if(typeof W.stacktrace<"u"||typeof W["opera#sourceloc"]<"u")return this.parseOpera(W);if(W.stack&&W.stack.match(P))return this.parseV8OrIE(W);if(W.stack)return this.parseFFOrSafari(W);throw new Error("Cannot parse given Error object")},extractLocation:function(W){if(W.indexOf(":")===-1)return[W];var ie=/(.+?)(?::(\d+))?(?::(\d+))?$/,X=ie.exec(W.replace(/[()]/g,""));return[X[1],X[2]||void 0,X[3]||void 0]},parseV8OrIE:function(W){var ie=W.stack.split(` +`+r)}function ul(e,t,r,i,s,a){if(e.listenerCount("wsClientError")){let u=new Error(s);Error.captureStackTrace(u,ul),e.emit("wsClientError",u,r,t)}else xf(r,i,s,a)}});var CR,BR,DR,yR,QR,wR,vD,vR,Hd,UE=xm(()=>{CR=Me(ED(),1),BR=Me(Od(),1),DR=Me(xu(),1),yR=Me(RE(),1),QR=Me(kE(),1),wR=Me(ME(),1),vD=Me(Ud(),1),vR=Me(wD(),1),Hd=vD.default});var Wd,_D=xm(()=>{UE();Wd=global;Wd.WebSocket||=Hd;Wd.window||=global;Wd.self||=global;Wd.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:"InternalApp",isEnabled:!0,isValid:!0},{type:2,value:"InternalAppContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdoutContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStderrContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdinContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalFocusContext",isEnabled:!0,isValid:!0}]});var SD=Ar((jd,GE)=>{(function(t,r){typeof jd=="object"&&typeof GE=="object"?GE.exports=r():typeof define=="function"&&define.amd?define([],r):typeof jd=="object"?jd.ReactDevToolsBackend=r():t.ReactDevToolsBackend=r()})(self,()=>(()=>{var e={602:((s,a,u)=>{"use strict";var p;function E(se){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?E=function(j){return typeof j}:E=function(j){return j&&typeof Symbol=="function"&&j.constructor===Symbol&&j!==Symbol.prototype?"symbol":typeof j},E(se)}var I=u(206),y=u(189),D=Object.assign,v=y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=[],P=null;function Z(){if(P===null){var se=new Map;try{ie.useContext({_currentValue:null}),ie.useState(null),ie.useReducer(function(te){return te},null),ie.useRef(null),typeof ie.useCacheRefresh=="function"&&ie.useCacheRefresh(),ie.useLayoutEffect(function(){}),ie.useInsertionEffect(function(){}),ie.useEffect(function(){}),ie.useImperativeHandle(void 0,function(){return null}),ie.useDebugValue(null),ie.useCallback(function(){}),ie.useMemo(function(){return null}),typeof ie.useMemoCache=="function"&&ie.useMemoCache(0)}finally{var x=T;T=[]}for(var j=0;j"u"?ie:new Proxy(ie,X),Ee=0;function ye(se,x,j){var ae=x[j].source,te=0;e:for(;teCe;Ce++)if(fe=ye(Y,Ge,Ce),fe!==-1){Ee=Ce,Ge=fe;break e}Ge=-1}}e:{if(Y=He,fe=Z().get(nt.primitive),fe!==void 0){for(Ce=0;CeGe-Y?null:He.slice(Y,Ge-1),He!==null){if(Ge=0,te!==null){for(;GeGe;te--)Ae=ve.pop()}for(te=He.length-Ge-1;1<=te;te--)Ge=[],Y=He[te],(fe=He[te-1].functionName)?(Ce=fe.lastIndexOf("."),Ce===-1&&(Ce=0),fe.slice(Ce,Ce+3)==="use"&&(Ce+=3),fe=fe.slice(Ce)):fe="",fe={id:null,isStateEditable:!1,name:fe,value:void 0,subHooks:Ge},j&&(fe.hookSource={lineNumber:Y.lineNumber,columnNumber:Y.columnNumber,functionName:Y.functionName,fileName:Y.fileName}),Ae.push(fe),ve.push(Ae),Ae=Ge;te=He}Ge=nt.primitive,nt={id:Ge==="Context"||Ge==="DebugValue"?null:Ke++,isStateEditable:Ge==="Reducer"||Ge==="State",name:Ge,value:nt.value,subHooks:[]},j&&(Ge={lineNumber:null,functionName:null,fileName:null,columnNumber:null},He&&1<=He.length&&(He=He[0],Ge.lineNumber=He.lineNumber,Ge.functionName=He.functionName,Ge.fileName=He.fileName,Ge.columnNumber=He.columnNumber),nt.hookSource=Ge),Ae.push(nt)}return ge(ae,null),ae}function ge(se,x){for(var j=[],ae=0;ae{"use strict";s.exports=u(602)}),9:((s,a)=>{"use strict";var u;function p(ge){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?p=function(ze){return typeof ze}:p=function(ze){return ze&&typeof Symbol=="function"&&ze.constructor===Symbol&&ze!==Symbol.prototype?"symbol":typeof ze},p(ge)}var E=Symbol.for("react.element"),I=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),P=Symbol.for("react.context"),Z=Symbol.for("react.server_context"),ee=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),ie=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Ee=Symbol.for("react.offscreen"),ye=Symbol.for("react.cache"),le=Symbol.for("react.client.reference");function _e(ge){if(p(ge)==="object"&&ge!==null){var ct=ge.$$typeof;switch(ct){case E:switch(ge=ge.type,ge){case y:case v:case D:case W:case ie:return ge;default:switch(ge=ge&&ge.$$typeof,ge){case Z:case P:case ee:case $:case X:case T:return ge;default:return ct}}case I:return ct}}}a.ContextConsumer=P,a.ContextProvider=T,u=E,a.ForwardRef=ee,a.Fragment=y,a.Lazy=$,a.Memo=X,a.Portal=I,a.Profiler=v,a.StrictMode=D,a.Suspense=W,u=ie,u=function(){return!1},u=function(){return!1},u=function(ge){return _e(ge)===P},u=function(ge){return _e(ge)===T},a.isElement=function(ge){return p(ge)==="object"&&ge!==null&&ge.$$typeof===E},u=function(ge){return _e(ge)===ee},u=function(ge){return _e(ge)===y},u=function(ge){return _e(ge)===$},u=function(ge){return _e(ge)===X},u=function(ge){return _e(ge)===I},u=function(ge){return _e(ge)===v},u=function(ge){return _e(ge)===D},u=function(ge){return _e(ge)===W},u=function(ge){return _e(ge)===ie},u=function(ge){return typeof ge=="string"||typeof ge=="function"||ge===y||ge===v||ge===D||ge===W||ge===ie||ge===Ee||ge===ye||p(ge)==="object"&&ge!==null&&(ge.$$typeof===$||ge.$$typeof===X||ge.$$typeof===T||ge.$$typeof===P||ge.$$typeof===ee||ge.$$typeof===le||ge.getModuleId!==void 0)},a.typeOf=_e}),550:((s,a,u)=>{"use strict";s.exports=u(9)}),978:((s,a)=>{"use strict";function u(J){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?u=function(at){return typeof at}:u=function(at){return at&&typeof Symbol=="function"&&at.constructor===Symbol&&at!==Symbol.prototype?"symbol":typeof at},u(J)}var p=Symbol.for("react.element"),E=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),v=Symbol.for("react.provider"),T=Symbol.for("react.context"),P=Symbol.for("react.server_context"),Z=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),$=Symbol.for("react.debug_trace_mode"),Ee=Symbol.for("react.offscreen"),ye=Symbol.for("react.cache"),le=Symbol.for("react.default_value"),_e=Symbol.for("react.postpone"),ge=Symbol.iterator;function ct(J){return J===null||u(J)!=="object"?null:(J=ge&&J[ge]||J["@@iterator"],typeof J=="function"?J:null)}var ze={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},be=Object.assign,se={};function x(J,ce,at){this.props=J,this.context=ce,this.refs=se,this.updater=at||ze}x.prototype.isReactComponent={},x.prototype.setState=function(J,ce){if(u(J)!=="object"&&typeof J!="function"&&J!=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,J,ce,"setState")},x.prototype.forceUpdate=function(J){this.updater.enqueueForceUpdate(this,J,"forceUpdate")};function j(){}j.prototype=x.prototype;function ae(J,ce,at){this.props=J,this.context=ce,this.refs=se,this.updater=at||ze}var te=ae.prototype=new j;te.constructor=ae,be(te,x.prototype),te.isPureReactComponent=!0;var Ae=Array.isArray,Ke=Object.prototype.hasOwnProperty,ve={current:null},st={key:!0,ref:!0,__self:!0,__source:!0};function nt(J,ce,at){var mt,St={},Nt=null,Zt=null;if(ce!=null)for(mt in ce.ref!==void 0&&(Zt=ce.ref),ce.key!==void 0&&(Nt=""+ce.key),ce)Ke.call(ce,mt)&&!st.hasOwnProperty(mt)&&(St[mt]=ce[mt]);var sr=arguments.length-2;if(sr===1)St.children=at;else if(1{"use strict";s.exports=u(978)}),206:(function(s,a,u){var p,E,I;function y(D){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?y=function(T){return typeof T}:y=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},y(D)}(function(D,v){"use strict";E=[u(430)],p=v,I=typeof p=="function"?p.apply(a,E):p,I!==void 0&&(s.exports=I)})(this,function(v){"use strict";var T=/(^|@)\S+:\d+/,P=/^\s*at .*(\S+:\d+|\(native\))/m,Z=/^(eval@)?(\[native code])?$/;return{parse:function(W){if(typeof W.stacktrace<"u"||typeof W["opera#sourceloc"]<"u")return this.parseOpera(W);if(W.stack&&W.stack.match(P))return this.parseV8OrIE(W);if(W.stack)return this.parseFFOrSafari(W);throw new Error("Cannot parse given Error object")},extractLocation:function(W){if(W.indexOf(":")===-1)return[W];var ie=/(.+?)(?::(\d+))?(?::(\d+))?$/,X=ie.exec(W.replace(/[()]/g,""));return[X[1],X[2]||void 0,X[3]||void 0]},parseV8OrIE:function(W){var ie=W.stack.split(` `).filter(function(X){return!!X.match(P)},this);return ie.map(function(X){X.indexOf("(eval ")>-1&&(X=X.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var $=X.replace(/^\s+/,"").replace(/\(eval code/g,"("),Ee=$.match(/ (\((.+):(\d+):(\d+)\)$)/);$=Ee?$.replace(Ee[0],""):$;var ye=$.split(/\s+/).slice(1),le=this.extractLocation(Ee?Ee[1]:ye.pop()),_e=ye.join(" ")||void 0,ge=["eval",""].indexOf(le[0])>-1?void 0:le[0];return new v({functionName:_e,fileName:ge,lineNumber:le[1],columnNumber:le[2],source:X})},this)},parseFFOrSafari:function(W){var ie=W.stack.split(` `).filter(function(X){return!X.match(Z)},this);return ie.map(function(X){if(X.indexOf(" > eval")>-1&&(X=X.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),X.indexOf("@")===-1&&X.indexOf(":")===-1)return new v({functionName:X});var $=/((.*".+"[^@]*)?[^@]*)(?:@)/,Ee=X.match($),ye=Ee&&Ee[1]?Ee[1]:void 0,le=this.extractLocation(X.replace($,""));return new v({functionName:ye,fileName:le[0],lineNumber:le[1],columnNumber:le[2],source:X})},this)},parseOpera:function(W){return!W.stacktrace||W.message.indexOf(` `)>-1&&W.message.split(` @@ -44,7 +44,7 @@ No matching component was found for: `))):Ut=Y.stylize("[Circular]","special")),se(Je)){if(kt&&et.match(/^\d+$/))return Ut;Je=JSON.stringify(""+et),Je.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Je=Je.substr(1,Je.length-2),Je=Y.stylize(Je,"name")):(Je=Je.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Je=Y.stylize(Je,"string"))}return Je+": "+Ut}function Ee(Y,fe,Ce){var yt=0,et=Y.reduce(function(kt,Je){return yt++,Je.indexOf(` `)>=0&&yt++,kt+Je.replace(/\u001b\[\d\d?m/g,"").length+1},0);return et>60?Ce[0]+(fe===""?"":fe+` `)+" "+Y.join(`, - `)+" "+Ce[1]:Ce[0]+fe+" "+Y.join(", ")+" "+Ce[1]}function ye(Y){return Array.isArray(Y)}a.isArray=ye;function le(Y){return typeof Y=="boolean"}a.isBoolean=le;function _e(Y){return Y===null}a.isNull=_e;function ge(Y){return Y==null}a.isNullOrUndefined=ge;function ct(Y){return typeof Y=="number"}a.isNumber=ct;function ze(Y){return typeof Y=="string"}a.isString=ze;function be(Y){return E(Y)==="symbol"}a.isSymbol=be;function se(Y){return Y===void 0}a.isUndefined=se;function x(Y){return j(Y)&&ve(Y)==="[object RegExp]"}a.isRegExp=x;function j(Y){return E(Y)==="object"&&Y!==null}a.isObject=j;function ae(Y){return j(Y)&&ve(Y)==="[object Date]"}a.isDate=ae;function te(Y){return j(Y)&&(ve(Y)==="[object Error]"||Y instanceof Error)}a.isError=te;function Ae(Y){return typeof Y=="function"}a.isFunction=Ae;function Ke(Y){return Y===null||typeof Y=="boolean"||typeof Y=="number"||typeof Y=="string"||E(Y)==="symbol"||typeof Y>"u"}a.isPrimitive=Ke,a.isBuffer=u(715);function ve(Y){return Object.prototype.toString.call(Y)}function st(Y){return Y<10?"0"+Y.toString(10):Y.toString(10)}var nt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ge(){var Y=new Date,fe=[st(Y.getHours()),st(Y.getMinutes()),st(Y.getSeconds())].join(":");return[Y.getDate(),nt[Y.getMonth()],fe].join(" ")}a.log=function(){console.log("%s - %s",Ge(),a.format.apply(a,arguments))},a.inherits=u(718),a._extend=function(Y,fe){if(!fe||!j(fe))return Y;for(var Ce=Object.keys(fe),yt=Ce.length;yt--;)Y[Ce[yt]]=fe[Ce[yt]];return Y};function He(Y,fe){return Object.prototype.hasOwnProperty.call(Y,fe)}}),695:(s=>{s.exports=a,a.Node=E,a.create=a;function a(I){var y=this;if(y instanceof a||(y=new a),y.tail=null,y.head=null,y.length=0,I&&typeof I.forEach=="function")I.forEach(function(T){y.push(T)});else if(arguments.length>0)for(var D=0,v=arguments.length;D1)D=y;else if(this.head)v=this.head.next,D=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var T=0;v!==null;T++)D=I(D,v.value,T),v=v.next;return D},a.prototype.reduceReverse=function(I,y){var D,v=this.tail;if(arguments.length>1)D=y;else if(this.tail)v=this.tail.prev,D=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var T=this.length-1;v!==null;T--)D=I(D,v.value,T),v=v.prev;return D},a.prototype.toArray=function(){for(var I=new Array(this.length),y=0,D=this.head;D!==null;y++)I[y]=D.value,D=D.next;return I},a.prototype.toArrayReverse=function(){for(var I=new Array(this.length),y=0,D=this.tail;D!==null;y++)I[y]=D.value,D=D.prev;return I},a.prototype.slice=function(I,y){y=y||this.length,y<0&&(y+=this.length),I=I||0,I<0&&(I+=this.length);var D=new a;if(ythis.length&&(y=this.length);for(var v=0,T=this.head;T!==null&&vthis.length&&(y=this.length);for(var v=this.length,T=this.tail;T!==null&&v>y;v--)T=T.prev;for(;T!==null&&v>I;v--,T=T.prev)D.push(T.value);return D},a.prototype.reverse=function(){for(var I=this.head,y=this.tail,D=I;D!==null;D=D.prev){var v=D.prev;D.prev=D.next,D.next=v}return this.head=y,this.tail=I,this};function u(I,y){I.tail=new E(y,I.tail,null,I),I.head||(I.head=I.tail),I.length++}function p(I,y){I.head=new E(y,null,I.head,I),I.tail||(I.tail=I.head),I.length++}function E(I,y,D,v){if(!(this instanceof E))return new E(I,y,D,v);this.list=v,this.value=I,y?(y.next=this,this.prev=y):this.prev=null,D?(D.prev=this,this.next=D):this.next=null}})},t={};function r(s){var a=t[s];if(a!==void 0)return a.exports;var u=t[s]={exports:{}};return e[s].call(u.exports,u,u.exports,r),u.exports}r.n=s=>{var a=s&&s.__esModule?()=>s.default:()=>s;return r.d(a,{a}),a},r.d=(s,a)=>{for(var u in a)r.o(a,u)&&!r.o(s,u)&&Object.defineProperty(s,u,{enumerable:!0,get:a[u]})},r.o=(s,a)=>Object.prototype.hasOwnProperty.call(s,a),r.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{connectToDevTools:()=>Ze});function s(A,f){if(!(A instanceof f))throw new TypeError("Cannot call a class as a function")}function a(A,f){for(var g=0;g1?d-1:0),S=1;S=0&&d.splice(B,1)}}}]),A})(),I=r(172),y=r.n(I),D="fmkadmapgofadopljbjfkapdkoienihi",v="dnjnjgbfilfphmojnmhliehogmojhclc",T="ikiahnapldjmdmpkmfhjdjilojjhgcbf",P=!1,Z=!1,ee=1,W=2,ie=3,X=4,$=5,Ee=6,ye=7,le=1,_e=2,ge="React::DevTools::defaultTab",ct="React::DevTools::componentFilters",ze="React::DevTools::lastSelection",be="React::DevTools::openInEditorUrl",se="React::DevTools::openInEditorUrlPreset",x="React::DevTools::parseHookNames",j="React::DevTools::recordChangeDescriptions",ae="React::DevTools::reloadAndProfile",te="React::DevTools::breakOnConsoleErrors",Ae="React::DevTools::theme",Ke="React::DevTools::appendComponentStack",ve="React::DevTools::showInlineWarningsAndErrors",st="React::DevTools::traceUpdatesEnabled",nt="React::DevTools::hideConsoleLogsInStrictMode",Ge="React::DevTools::supportsProfiling",He=5;function Y(A){try{return localStorage.getItem(A)}catch{return null}}function fe(A){try{localStorage.removeItem(A)}catch{}}function Ce(A,f){try{return localStorage.setItem(A,f)}catch{}}function yt(A){try{return sessionStorage.getItem(A)}catch{return null}}function et(A){try{sessionStorage.removeItem(A)}catch{}}function kt(A,f){try{return sessionStorage.setItem(A,f)}catch{}}var Je=function(f,g){return f===g};function Ut(A){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Je,g=void 0,h=[],d=void 0,B=!1,S=function(O,U){return f(O,h[U])},N=function(){for(var O=arguments.length,U=Array(O),q=0;qB.length;){var S=this.rects.pop();S.remove()}if(B.length!==0){for(;this.rects.lengthf.left+f.width&&(N=f.left+f.width-d-B),S+="px",N+="px",{style:{top:S,left:N}}}function lr(A,f,g){mt(g.style,{borderTopWidth:A[f+"Top"]+"px",borderLeftWidth:A[f+"Left"]+"px",borderRightWidth:A[f+"Right"]+"px",borderBottomWidth:A[f+"Bottom"]+"px",borderStyle:"solid"})}var Ur={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"},Vs=2e3,qo=null,Do=null;function qn(A){if(window.document==null){A.emit("hideNativeHighlight");return}qo=null,Do!==null&&(Do.remove(),Do=null)}function Ci(A,f,g,h){if(window.document==null){A!=null&&A[0]!=null&&g.emit("showNativeHighlight",A[0]);return}qo!==null&&clearTimeout(qo),A!=null&&(Do===null&&(Do=new Zt(g)),Do.inspect(A,f),h&&(qo=setTimeout(function(){return qn(g)},Vs)))}var Bi=new Set;function zo(A,f){A.addListener("clearNativeElementHighlight",S),A.addListener("highlightNativeElement",N),A.addListener("shutdown",d),A.addListener("startInspectingNative",g),A.addListener("stopInspectingNative",d);function g(){h(window)}function h(je){je&&typeof je.addEventListener=="function"?(je.addEventListener("click",_,!0),je.addEventListener("mousedown",O,!0),je.addEventListener("mouseover",O,!0),je.addEventListener("mouseup",O,!0),je.addEventListener("pointerdown",U,!0),je.addEventListener("pointermove",V,!0),je.addEventListener("pointerup",de,!0)):f.emit("startInspectingNative")}function d(){qn(f),B(window),Bi.forEach(function(je){try{B(je.contentWindow)}catch{}}),Bi=new Set}function B(je){je&&typeof je.removeEventListener=="function"?(je.removeEventListener("click",_,!0),je.removeEventListener("mousedown",O,!0),je.removeEventListener("mouseover",O,!0),je.removeEventListener("mouseup",O,!0),je.removeEventListener("pointerdown",U,!0),je.removeEventListener("pointermove",V,!0),je.removeEventListener("pointerup",de,!0)):f.emit("stopInspectingNative")}function S(){qn(f)}function N(je){var Dt=je.displayName,Wt=je.hideAfterTimeout,cr=je.id,ot=je.openNativeElementsPanel,or=je.rendererID,Cr=je.scrollIntoView,rr=f.rendererInterfaces[or];if(rr==null){console.warn('Invalid renderer id "'.concat(or,'" for element "').concat(cr,'"')),qn(f);return}if(!rr.hasFiberWithId(cr)){qn(f);return}var wr=rr.findNativeNodesForFiberID(cr);if(wr!=null&&wr[0]!=null){var Br=wr[0];Cr&&typeof Br.scrollIntoView=="function"&&Br.scrollIntoView({block:"nearest",inline:"nearest"}),Ci(wr,Dt,f,Wt),ot&&(window.__REACT_DEVTOOLS_GLOBAL_HOOK__.$0=Br,A.send("syncSelectionToNativeElementsPanel"))}else qn(f)}function _(je){je.preventDefault(),je.stopPropagation(),d(),A.send("stopInspectingNative",!0)}function O(je){je.preventDefault(),je.stopPropagation()}function U(je){je.preventDefault(),je.stopPropagation(),We(gt(je))}var q=null;function V(je){je.preventDefault(),je.stopPropagation();var Dt=gt(je);if(q!==Dt){if(q=Dt,Dt.tagName==="IFRAME"){var Wt=Dt;try{if(!Bi.has(Wt)){var cr=Wt.contentWindow;h(cr),Bi.add(Wt)}}catch{}}Ci([Dt],null,f,!1),We(Dt)}}function de(je){je.preventDefault(),je.stopPropagation()}var We=y()(Ut(function(je){var Dt=f.getIDForNode(je);Dt!==null&&A.send("selectFiber",Dt)}),200,{leading:!1});function gt(je){return je.composed?je.composedPath()[0]:je.target}}var ko="#f0f0f0",Xo=["#37afa9","#63b19e","#80b393","#97b488","#abb67d","#beb771","#cfb965","#dfba57","#efbb49","#febc38"],nn=null;function Hi(A,f){if(window.document==null){var g=[];mn(A,function(B,S,N){g.push({node:N,color:S})}),f.emit("drawTraceUpdates",g);return}nn===null&&Ds();var h=nn;h.width=window.innerWidth,h.height=window.innerHeight;var d=h.getContext("2d");d.clearRect(0,0,h.width,h.height),mn(A,function(B,S){B!==null&&$s(d,B,S)})}function mn(A,f){A.forEach(function(g,h){var d=g.count,B=g.rect,S=Math.min(Xo.length-1,d-1),N=Xo[S];f(B,N,h)})}function $s(A,f,g){var h=f.height,d=f.left,B=f.top,S=f.width;A.lineWidth=1,A.strokeStyle=ko,A.strokeRect(d-1,B-1,S+2,h+2),A.lineWidth=1,A.strokeStyle=ko,A.strokeRect(d+1,B+1,S-1,h-1),A.strokeStyle=g,A.setLineDash([0]),A.lineWidth=1,A.strokeRect(d,B,S-1,h-1),A.setLineDash([0])}function No(A){if(window.document==null){A.emit("disableTraceUpdates");return}nn!==null&&(nn.parentNode!=null&&nn.parentNode.removeChild(nn),nn=null)}function Ds(){nn=window.document.createElement("canvas"),nn.style.cssText=` + `)+" "+Ce[1]:Ce[0]+fe+" "+Y.join(", ")+" "+Ce[1]}function ye(Y){return Array.isArray(Y)}a.isArray=ye;function le(Y){return typeof Y=="boolean"}a.isBoolean=le;function _e(Y){return Y===null}a.isNull=_e;function ge(Y){return Y==null}a.isNullOrUndefined=ge;function ct(Y){return typeof Y=="number"}a.isNumber=ct;function ze(Y){return typeof Y=="string"}a.isString=ze;function be(Y){return E(Y)==="symbol"}a.isSymbol=be;function se(Y){return Y===void 0}a.isUndefined=se;function x(Y){return j(Y)&&ve(Y)==="[object RegExp]"}a.isRegExp=x;function j(Y){return E(Y)==="object"&&Y!==null}a.isObject=j;function ae(Y){return j(Y)&&ve(Y)==="[object Date]"}a.isDate=ae;function te(Y){return j(Y)&&(ve(Y)==="[object Error]"||Y instanceof Error)}a.isError=te;function Ae(Y){return typeof Y=="function"}a.isFunction=Ae;function Ke(Y){return Y===null||typeof Y=="boolean"||typeof Y=="number"||typeof Y=="string"||E(Y)==="symbol"||typeof Y>"u"}a.isPrimitive=Ke,a.isBuffer=u(715);function ve(Y){return Object.prototype.toString.call(Y)}function st(Y){return Y<10?"0"+Y.toString(10):Y.toString(10)}var nt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ge(){var Y=new Date,fe=[st(Y.getHours()),st(Y.getMinutes()),st(Y.getSeconds())].join(":");return[Y.getDate(),nt[Y.getMonth()],fe].join(" ")}a.log=function(){console.log("%s - %s",Ge(),a.format.apply(a,arguments))},a.inherits=u(718),a._extend=function(Y,fe){if(!fe||!j(fe))return Y;for(var Ce=Object.keys(fe),yt=Ce.length;yt--;)Y[Ce[yt]]=fe[Ce[yt]];return Y};function He(Y,fe){return Object.prototype.hasOwnProperty.call(Y,fe)}}),695:(s=>{s.exports=a,a.Node=E,a.create=a;function a(I){var y=this;if(y instanceof a||(y=new a),y.tail=null,y.head=null,y.length=0,I&&typeof I.forEach=="function")I.forEach(function(T){y.push(T)});else if(arguments.length>0)for(var D=0,v=arguments.length;D1)D=y;else if(this.head)v=this.head.next,D=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var T=0;v!==null;T++)D=I(D,v.value,T),v=v.next;return D},a.prototype.reduceReverse=function(I,y){var D,v=this.tail;if(arguments.length>1)D=y;else if(this.tail)v=this.tail.prev,D=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var T=this.length-1;v!==null;T--)D=I(D,v.value,T),v=v.prev;return D},a.prototype.toArray=function(){for(var I=new Array(this.length),y=0,D=this.head;D!==null;y++)I[y]=D.value,D=D.next;return I},a.prototype.toArrayReverse=function(){for(var I=new Array(this.length),y=0,D=this.tail;D!==null;y++)I[y]=D.value,D=D.prev;return I},a.prototype.slice=function(I,y){y=y||this.length,y<0&&(y+=this.length),I=I||0,I<0&&(I+=this.length);var D=new a;if(ythis.length&&(y=this.length);for(var v=0,T=this.head;T!==null&&vthis.length&&(y=this.length);for(var v=this.length,T=this.tail;T!==null&&v>y;v--)T=T.prev;for(;T!==null&&v>I;v--,T=T.prev)D.push(T.value);return D},a.prototype.reverse=function(){for(var I=this.head,y=this.tail,D=I;D!==null;D=D.prev){var v=D.prev;D.prev=D.next,D.next=v}return this.head=y,this.tail=I,this};function u(I,y){I.tail=new E(y,I.tail,null,I),I.head||(I.head=I.tail),I.length++}function p(I,y){I.head=new E(y,null,I.head,I),I.tail||(I.tail=I.head),I.length++}function E(I,y,D,v){if(!(this instanceof E))return new E(I,y,D,v);this.list=v,this.value=I,y?(y.next=this,this.prev=y):this.prev=null,D?(D.prev=this,this.next=D):this.next=null}})},t={};function r(s){var a=t[s];if(a!==void 0)return a.exports;var u=t[s]={exports:{}};return e[s].call(u.exports,u,u.exports,r),u.exports}r.n=s=>{var a=s&&s.__esModule?()=>s.default:()=>s;return r.d(a,{a}),a},r.d=(s,a)=>{for(var u in a)r.o(a,u)&&!r.o(s,u)&&Object.defineProperty(s,u,{enumerable:!0,get:a[u]})},r.o=(s,a)=>Object.prototype.hasOwnProperty.call(s,a),r.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{connectToDevTools:()=>Ze});function s(A,f){if(!(A instanceof f))throw new TypeError("Cannot call a class as a function")}function a(A,f){for(var g=0;g1?d-1:0),S=1;S=0&&d.splice(B,1)}}}]),A})(),I=r(172),y=r.n(I),D="fmkadmapgofadopljbjfkapdkoienihi",v="dnjnjgbfilfphmojnmhliehogmojhclc",T="ikiahnapldjmdmpkmfhjdjilojjhgcbf",P=!1,Z=!1,ee=1,W=2,ie=3,X=4,$=5,Ee=6,ye=7,le=1,_e=2,ge="React::DevTools::defaultTab",ct="React::DevTools::componentFilters",ze="React::DevTools::lastSelection",be="React::DevTools::openInEditorUrl",se="React::DevTools::openInEditorUrlPreset",x="React::DevTools::parseHookNames",j="React::DevTools::recordChangeDescriptions",ae="React::DevTools::reloadAndProfile",te="React::DevTools::breakOnConsoleErrors",Ae="React::DevTools::theme",Ke="React::DevTools::appendComponentStack",ve="React::DevTools::showInlineWarningsAndErrors",st="React::DevTools::traceUpdatesEnabled",nt="React::DevTools::hideConsoleLogsInStrictMode",Ge="React::DevTools::supportsProfiling",He=5;function Y(A){try{return localStorage.getItem(A)}catch{return null}}function fe(A){try{localStorage.removeItem(A)}catch{}}function Ce(A,f){try{return localStorage.setItem(A,f)}catch{}}function yt(A){try{return sessionStorage.getItem(A)}catch{return null}}function et(A){try{sessionStorage.removeItem(A)}catch{}}function kt(A,f){try{return sessionStorage.setItem(A,f)}catch{}}var Je=function(f,g){return f===g};function Ut(A){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Je,g=void 0,h=[],d=void 0,B=!1,S=function(O,U){return f(O,h[U])},N=function(){for(var O=arguments.length,U=Array(O),q=0;qB.length;){var S=this.rects.pop();S.remove()}if(B.length!==0){for(;this.rects.lengthf.left+f.width&&(N=f.left+f.width-d-B),S+="px",N+="px",{style:{top:S,left:N}}}function ur(A,f,g){mt(g.style,{borderTopWidth:A[f+"Top"]+"px",borderLeftWidth:A[f+"Left"]+"px",borderRightWidth:A[f+"Right"]+"px",borderBottomWidth:A[f+"Bottom"]+"px",borderStyle:"solid"})}var Ur={background:"rgba(120, 170, 210, 0.7)",padding:"rgba(77, 200, 0, 0.3)",margin:"rgba(255, 155, 0, 0.3)",border:"rgba(255, 200, 50, 0.3)"},Vs=2e3,qo=null,Do=null;function qn(A){if(window.document==null){A.emit("hideNativeHighlight");return}qo=null,Do!==null&&(Do.remove(),Do=null)}function Ci(A,f,g,h){if(window.document==null){A!=null&&A[0]!=null&&g.emit("showNativeHighlight",A[0]);return}qo!==null&&clearTimeout(qo),A!=null&&(Do===null&&(Do=new Zt(g)),Do.inspect(A,f),h&&(qo=setTimeout(function(){return qn(g)},Vs)))}var Bi=new Set;function zo(A,f){A.addListener("clearNativeElementHighlight",S),A.addListener("highlightNativeElement",N),A.addListener("shutdown",d),A.addListener("startInspectingNative",g),A.addListener("stopInspectingNative",d);function g(){h(window)}function h(je){je&&typeof je.addEventListener=="function"?(je.addEventListener("click",_,!0),je.addEventListener("mousedown",O,!0),je.addEventListener("mouseover",O,!0),je.addEventListener("mouseup",O,!0),je.addEventListener("pointerdown",U,!0),je.addEventListener("pointermove",V,!0),je.addEventListener("pointerup",de,!0)):f.emit("startInspectingNative")}function d(){qn(f),B(window),Bi.forEach(function(je){try{B(je.contentWindow)}catch{}}),Bi=new Set}function B(je){je&&typeof je.removeEventListener=="function"?(je.removeEventListener("click",_,!0),je.removeEventListener("mousedown",O,!0),je.removeEventListener("mouseover",O,!0),je.removeEventListener("mouseup",O,!0),je.removeEventListener("pointerdown",U,!0),je.removeEventListener("pointermove",V,!0),je.removeEventListener("pointerup",de,!0)):f.emit("stopInspectingNative")}function S(){qn(f)}function N(je){var Dt=je.displayName,Wt=je.hideAfterTimeout,fr=je.id,ot=je.openNativeElementsPanel,or=je.rendererID,Cr=je.scrollIntoView,rr=f.rendererInterfaces[or];if(rr==null){console.warn('Invalid renderer id "'.concat(or,'" for element "').concat(fr,'"')),qn(f);return}if(!rr.hasFiberWithId(fr)){qn(f);return}var wr=rr.findNativeNodesForFiberID(fr);if(wr!=null&&wr[0]!=null){var Br=wr[0];Cr&&typeof Br.scrollIntoView=="function"&&Br.scrollIntoView({block:"nearest",inline:"nearest"}),Ci(wr,Dt,f,Wt),ot&&(window.__REACT_DEVTOOLS_GLOBAL_HOOK__.$0=Br,A.send("syncSelectionToNativeElementsPanel"))}else qn(f)}function _(je){je.preventDefault(),je.stopPropagation(),d(),A.send("stopInspectingNative",!0)}function O(je){je.preventDefault(),je.stopPropagation()}function U(je){je.preventDefault(),je.stopPropagation(),We(gt(je))}var q=null;function V(je){je.preventDefault(),je.stopPropagation();var Dt=gt(je);if(q!==Dt){if(q=Dt,Dt.tagName==="IFRAME"){var Wt=Dt;try{if(!Bi.has(Wt)){var fr=Wt.contentWindow;h(fr),Bi.add(Wt)}}catch{}}Ci([Dt],null,f,!1),We(Dt)}}function de(je){je.preventDefault(),je.stopPropagation()}var We=y()(Ut(function(je){var Dt=f.getIDForNode(je);Dt!==null&&A.send("selectFiber",Dt)}),200,{leading:!1});function gt(je){return je.composed?je.composedPath()[0]:je.target}}var ko="#f0f0f0",Xo=["#37afa9","#63b19e","#80b393","#97b488","#abb67d","#beb771","#cfb965","#dfba57","#efbb49","#febc38"],nn=null;function Hi(A,f){if(window.document==null){var g=[];mn(A,function(B,S,N){g.push({node:N,color:S})}),f.emit("drawTraceUpdates",g);return}nn===null&&Ds();var h=nn;h.width=window.innerWidth,h.height=window.innerHeight;var d=h.getContext("2d");d.clearRect(0,0,h.width,h.height),mn(A,function(B,S){B!==null&&$s(d,B,S)})}function mn(A,f){A.forEach(function(g,h){var d=g.count,B=g.rect,S=Math.min(Xo.length-1,d-1),N=Xo[S];f(B,N,h)})}function $s(A,f,g){var h=f.height,d=f.left,B=f.top,S=f.width;A.lineWidth=1,A.strokeStyle=ko,A.strokeRect(d-1,B-1,S+2,h+2),A.lineWidth=1,A.strokeStyle=ko,A.strokeRect(d+1,B+1,S-1,h-1),A.strokeStyle=g,A.setLineDash([0]),A.lineWidth=1,A.strokeRect(d,B,S-1,h-1),A.setLineDash([0])}function No(A){if(window.document==null){A.emit("disableTraceUpdates");return}nn!==null&&(nn.parentNode!=null&&nn.parentNode.removeChild(nn),nn=null)}function Ds(){nn=window.document.createElement("canvas"),nn.style.cssText=` xx-background-color: red; xx-opacity: 0.5; bottom: 0; @@ -55,22 +55,22 @@ No matching component was found for: top: 0; z-index: 1000000000; `;var A=window.document.documentElement;A.insertBefore(nn,A.firstChild)}function Wi(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Wi=function(g){return typeof g}:Wi=function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},Wi(A)}var ys=250,Qs=3e3,qs=250,ws=(typeof performance>"u"?"undefined":Wi(performance))==="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()},yo=new Map,on=null,ji=null,vs=!1,Gr=null;function _s(A){on=A,on.addListener("traceUpdates",zs)}function Zo(A){vs=A,vs||(yo.clear(),ji!==null&&(cancelAnimationFrame(ji),ji=null),Gr!==null&&(clearTimeout(Gr),Gr=null),No(on))}function zs(A){vs&&(A.forEach(function(f){var g=yo.get(f),h=ws(),d=g!=null?g.lastMeasuredAt:0,B=g!=null?g.rect:null;(B===null||d+qsA.length)&&(f=A.length);for(var g=0,h=new Array(f);g"u"||!(Symbol.iterator in Object(A)))){var g=[],h=!0,d=!1,B=void 0;try{for(var S=A[Symbol.iterator](),N;!(h=(N=S.next()).done)&&(g.push(N.value),!(f&&g.length===f));h=!0);}catch(_){d=!0,B=_}finally{try{!h&&S.return!=null&&S.return()}finally{if(d)throw B}}return g}}function dr(A){if(Array.isArray(A))return A}var ur=function(f,g){var h=Oa(f),d=Oa(g),B=h.pop(),S=d.pop(),N=ei(h,d);return N!==0?N:B&&S?ei(B.split("."),S.split(".")):B||S?B?-1:1:0},Vt=function(f){return typeof f=="string"&&/^[v\d]/.test(f)&&Zs.test(f)},cn=function(f,g,h){ti(h);var d=ur(f,g);return Pa[h].includes(d)},ac=function(f,g){var h=g.match(/^([<>=~^]+)/),d=h?h[1]:"=";if(d!=="^"&&d!=="~")return cn(f,g,d);var B=Oa(f),S=Pe(B,5),N=S[0],_=S[1],O=S[2],U=S[4],q=Oa(g),V=Pe(q,5),de=V[0],We=V[1],gt=V[2],je=V[4],Dt=[N,_,O],Wt=[de,We??"x",gt??"x"];if(je&&(!U||ei(Dt,Wt)!==0||ei(U.split("."),je.split("."))===-1))return!1;var cr=Wt.findIndex(function(or){return or!=="0"})+1,ot=d==="~"?2:cr>1?cr:1;return!(ei(Dt.slice(0,ot),Wt.slice(0,ot))!==0||ei(Dt.slice(ot),Wt.slice(ot))===-1)},Zs=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Oa=function(f){if(typeof f!="string")throw new TypeError("Invalid argument expected string");var g=f.match(Zs);if(!g)throw new Error("Invalid argument not valid semver ('".concat(f,"' received)"));return g.shift(),g},La=function(f){return f==="*"||f==="x"||f==="X"},Ki=function(f){var g=parseInt(f,10);return isNaN(g)?f:g},BA=function(f,g){return Se(f)!==Se(g)?[String(f),String(g)]:[f,g]},Ma=function(f,g){if(La(f)||La(g))return 0;var h=BA(Ki(f),Ki(g)),d=Pe(h,2),B=d[0],S=d[1];return B>S?1:B":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},Ji=Object.keys(Pa),ti=function(f){if(typeof f!="string")throw new TypeError("Invalid operator type, expected string but got ".concat(Se(f)));if(Ji.indexOf(f)===-1)throw new Error("Invalid operator, expected one of ".concat(Ji.join("|")))},pr=r(730),$t=r.n(pr),br=r(550);function Jr(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jr=function(g){return typeof g}:Jr=function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},Jr(A)}var Q=Symbol.for("react.element"),R=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),oe=Symbol.for("react.profiler"),Ie=Symbol.for("react.provider"),Ne=Symbol.for("react.context"),xe=Symbol.for("react.server_context"),Ye=Symbol.for("react.forward_ref"),Oe=Symbol.for("react.suspense"),rt=Symbol.for("react.suspense_list"),Qt=Symbol.for("react.memo"),er=Symbol.for("react.lazy"),Fr=Symbol.for("react.scope"),tr=Symbol.for("react.debug_trace_mode"),vn=Symbol.for("react.offscreen"),zn=Symbol.for("react.legacy_hidden"),Ua=Symbol.for("react.cache"),ri=Symbol.for("react.tracing_marker"),DA=Symbol.for("react.default_value"),Dl=Symbol.for("react.memo_cache_sentinel"),Zf=Symbol.for("react.postpone"),Ga=Symbol.iterator,Gp="@@iterator";function eg(A){if(A===null||Jr(A)!=="object")return null;var f=Ga&&A[Ga]||A[Gp];return typeof f=="function"?f:null}var Gt=1,yl=2,ni=5,ea=6,yA=7,Ha=8,Ir=9,Ac=10,Ql=11,lc=12,Hp=13,wl=14,oi=1,Wp=2,jp=3,ii=4,Yi=1,vl=Array.isArray;let To=vl;var uc=r(169);function _l(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_l=function(g){return typeof g}:_l=function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},_l(A)}function si(A){return Rl(A)||Sl(A)||ja(A)||Wa()}function Wa(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ja(A,f){if(A){if(typeof A=="string")return lo(A,f);var g=Object.prototype.toString.call(A).slice(8,-1);if(g==="Object"&&A.constructor&&(g=A.constructor.name),g==="Map"||g==="Set")return Array.from(A);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return lo(A,f)}}function Sl(A){if(typeof Symbol<"u"&&Symbol.iterator in Object(A))return Array.from(A)}function Rl(A){if(Array.isArray(A))return lo(A)}function lo(A,f){(f==null||f>A.length)&&(f=A.length);for(var g=0,h=new Array(f);gf.toString()?1:f.toString()>A.toString()?-1:0}function $i(A){for(var f=new Set,g=A,h=function(){var B=[].concat(si(Object.keys(g)),si(Object.getOwnPropertySymbols(g))),S=Object.getOwnPropertyDescriptors(g);B.forEach(function(N){S[N].enumerable&&f.add(N)}),g=Object.getPrototypeOf(g)};g!=null;)h();return f}function cc(A,f,g,h){var d=A.displayName;return d||"".concat(g,"(").concat(ta(f,h),")")}function ta(A){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Anonymous",g=Ss.get(A);if(g!=null)return g;var h=f;return typeof A.displayName=="string"?h=A.displayName:typeof A.name=="string"&&A.name!==""&&(h=A.name),Ss.set(A,h),h}var fc=0;function uo(){return++fc}function Oo(A){for(var f="",g=0;g=0){var h=A.match(/[^()]+/g);h!=null&&(A=h.pop(),g=h)}break;default:break}return[A,g]}function gc(A,f){for(var g in A)if(!(g in f))return!0;for(var h in f)if(A[h]!==f[h])return!0;return!1}function Ai(A,f){return f.reduce(function(g,h){if(g){if(Xn.call(g,h))return g[h];if(typeof g[Symbol.iterator]=="function")return Array.from(g)[h]}return null},A)}function vA(A,f){var g=f.length,h=f[g-1];if(A!=null){var d=Ai(A,f.slice(0,g-1));d&&(To(d)?d.splice(h,1):delete d[h])}}function zi(A,f,g){var h=f.length;if(A!=null){var d=Ai(A,f.slice(0,h-1));if(d){var B=f[h-1],S=g[h-1];d[S]=d[B],To(d)?d.splice(B,1):delete d[B]}}}function _A(A,f,g){var h=f.length,d=f[h-1];if(A!=null){var B=Ai(A,f.slice(0,h-1));B&&(B[d]=g)}}function SA(A){if(A===null)return"null";if(A===void 0)return"undefined";if((0,br.isElement)(A))return"react_element";if(typeof HTMLElement<"u"&&A instanceof HTMLElement)return"html_element";var f=_l(A);switch(f){case"bigint":return"bigint";case"boolean":return"boolean";case"function":return"function";case"number":return Number.isNaN(A)?"nan":Number.isFinite(A)?"number":"infinity";case"object":if(To(A))return"array";if(ArrayBuffer.isView(A))return Xn.call(A.constructor,"BYTES_PER_ELEMENT")?"typed_array":"data_view";if(A.constructor&&A.constructor.name==="ArrayBuffer")return"array_buffer";if(typeof A[Symbol.iterator]=="function"){var g=A[Symbol.iterator]();if(g)return g===A?"opaque_iterator":"iterator"}else{if(A.constructor&&A.constructor.name==="RegExp")return"regexp";var h=Object.prototype.toString.call(A);if(h==="[object Date]")return"date";if(h==="[object HTMLAllCollection]")return"html_all_collection"}return ng(A)?"object":"class_instance";case"string":return"string";case"symbol":return"symbol";case"undefined":return Object.prototype.toString.call(A)==="[object HTMLAllCollection]"?"html_all_collection":"undefined";default:return"unknown"}}function RA(A){var f=(0,br.typeOf)(A);switch(f){case br.ContextConsumer:return"ContextConsumer";case br.ContextProvider:return"ContextProvider";case br.ForwardRef:return"ForwardRef";case br.Fragment:return"Fragment";case br.Lazy:return"Lazy";case br.Memo:return"Memo";case br.Portal:return"Portal";case br.Profiler:return"Profiler";case br.StrictMode:return"StrictMode";case br.Suspense:return"Suspense";case rt:return"SuspenseList";case ri:return"TracingMarker";default:var g=A.type;return typeof g=="string"?g:typeof g=="function"?ta(g,"Anonymous"):g!=null?"NotImplementedInDevtools":"Element"}}var yi=50;function Qo(A){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yi;return A.length>f?A.slice(0,f)+"\u2026":A}function ar(A,f){if(A!=null&&Xn.call(A,Ht.type))return f?A[Ht.preview_long]:A[Ht.preview_short];var g=SA(A);switch(g){case"html_element":return"<".concat(Qo(A.tagName.toLowerCase())," />");case"function":return Qo("\u0192 ".concat(typeof A.name=="function"?"":A.name,"() {}"));case"string":return'"'.concat(A,'"');case"bigint":return Qo(A.toString()+"n");case"regexp":return Qo(A.toString());case"symbol":return Qo(A.toString());case"react_element":return"<".concat(Qo(RA(A)||"Unknown")," />");case"array_buffer":return"ArrayBuffer(".concat(A.byteLength,")");case"data_view":return"DataView(".concat(A.buffer.byteLength,")");case"array":if(f){for(var h="",d=0;d0&&(h+=", "),h+=ar(A[d],!1),!(h.length>yi));d++);return"[".concat(Qo(h),"]")}else{var B=Xn.call(A,Ht.size)?A[Ht.size]:A.length;return"Array(".concat(B,")")}case"typed_array":var S="".concat(A.constructor.name,"(").concat(A.length,")");if(f){for(var N="",_=0;_0&&(N+=", "),N+=A[_],!(N.length>yi));_++);return"".concat(S," [").concat(Qo(N),"]")}else return S;case"iterator":var O=A.constructor.name;if(f){for(var U=Array.from(A),q="",V=0;V0&&(q+=", "),To(de)){var We=ar(de[0],!0),gt=ar(de[1],!1);q+="".concat(We," => ").concat(gt)}else q+=ar(de,!1);if(q.length>yi)break}return"".concat(O,"(").concat(A.size,") {").concat(Qo(q),"}")}else return"".concat(O,"(").concat(A.size,")");case"opaque_iterator":return A[Symbol.toStringTag];case"date":return A.toString();case"class_instance":return A.constructor.name;case"object":if(f){for(var je=Array.from($i(A)).sort(Vi),Dt="",Wt=0;Wt0&&(Dt+=", "),Dt+="".concat(cr.toString(),": ").concat(ar(A[cr],!1)),Dt.length>yi)break}return"{".concat(Qo(Dt),"}")}else return"{\u2026}";case"boolean":case"number":case"infinity":case"nan":case"null":case"undefined":return A;default:try{return Qo(String(A))}catch{return"unserializable"}}}var ng=function(f){var g=Object.getPrototypeOf(f);if(!g)return!0;var h=Object.getPrototypeOf(g);return!h};function Nl(A,f){var g=Object.keys(A);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(A);f&&(h=h.filter(function(d){return Object.getOwnPropertyDescriptor(A,d).enumerable})),g.push.apply(g,h)}return g}function dc(A){for(var f=1;f5&&arguments[5]!==void 0?arguments[5]:0,S=SA(A),N;switch(S){case"html_element":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.tagName,type:S};case"function":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:typeof A.name=="function"||!A.name?"function":A.name,type:S};case"string":return N=d(h),N||A.length<=500?A:A.slice(0,500)+"...";case"bigint":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.toString(),type:S};case"symbol":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.toString(),type:S};case"react_element":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:RA(A)||"Unknown",type:S};case"array_buffer":case"data_view":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:S==="data_view"?"DataView":"ArrayBuffer",size:A.byteLength,type:S};case"array":return N=d(h),B>=Qi&&!N?Ya(S,!0,A,f,h):A.map(function(q,V){return Va(q,f,g,h.concat([V]),d,N?1:B+1)});case"html_all_collection":case"typed_array":case"iterator":if(N=d(h),B>=Qi&&!N)return Ya(S,!0,A,f,h);var _={unserializable:!0,type:S,readonly:!0,size:S==="typed_array"?A.length:void 0,preview_short:ar(A,!1),preview_long:ar(A,!0),name:!A.constructor||A.constructor.name==="Object"?"":A.constructor.name};return Array.from(A).forEach(function(q,V){return _[V]=Va(q,f,g,h.concat([V]),d,N?1:B+1)}),g.push(h),_;case"opaque_iterator":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A[Symbol.toStringTag],type:S};case"date":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.toString(),type:S};case"regexp":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.toString(),type:S};case"object":if(N=d(h),B>=Qi&&!N)return Ya(S,!0,A,f,h);var O={};return $i(A).forEach(function(q){var V=q.toString();O[V]=Va(A[q],f,g,h.concat([V]),d,N?1:B+1)}),O;case"class_instance":if(N=d(h),B>=Qi&&!N)return Ya(S,!0,A,f,h);var U={unserializable:!0,type:S,readonly:!0,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.constructor.name};return $i(A).forEach(function(q){var V=q.toString();U[V]=Va(A[q],f,g,h.concat([V]),d,N?1:B+1)}),g.push(h),U;case"infinity":case"nan":case"undefined":return f.push(h),{type:S};default:return A}}function Xi(A,f,g,h){var d=getInObject(A,g);if(d!=null&&(d[Ht.unserializable]||(delete d[Ht.inspectable],delete d[Ht.inspected],delete d[Ht.name],delete d[Ht.preview_long],delete d[Ht.preview_short],delete d[Ht.readonly],delete d[Ht.size],delete d[Ht.type])),h!==null&&f.unserializable.length>0){for(var B=f.unserializable[0],S=B.length===g.length,N=0;NA.length)&&(f=A.length);for(var g=0,h=new Array(f);g2&&arguments[2]!==void 0?arguments[2]:[];if(A!==null){var h=[],d=[],B=Va(A,h,d,g,f);return{data:B,cleaned:h,unserializable:d}}else return null}function Sr(A,f){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,h=f[g],d=Zn(A)?A.slice():Lo({},A);return g+1===f.length?Zn(d)?d.splice(h,1):delete d[h]:d[h]=Sr(A[h],f,g+1),d}function qa(A,f,g){var h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,d=f[h],B=Zn(A)?A.slice():Lo({},A);if(h+1===f.length){var S=g[h];B[S]=B[d],Zn(B)?B.splice(d,1):delete B[d]}else B[d]=qa(A[d],f,g,h+1);return B}function kA(A,f,g){var h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(h>=f.length)return g;var d=f[h],B=Zn(A)?A.slice():Lo({},A);return B[d]=kA(A[d],f,g,h+1),B}function mc(A){var f=null,g=null,h=A.current;if(h!=null){var d=h.stateNode;d!=null&&(f=d.effectDuration!=null?d.effectDuration:null,g=d.passiveEffectDuration!=null?d.passiveEffectDuration:null)}return{effectDuration:f,passiveEffectDuration:g}}function NA(A){if(A===void 0)return"undefined";var f=new Set;return JSON.stringify(A,function(g,h){if(es(h)==="object"&&h!==null){if(f.has(h))return;f.add(h)}return typeof h=="bigint"?h.toString()+"n":h},2)}function Ec(A,f){if(A==null||A.length===0||typeof A[0]=="string"&&A[0].match(/([^%]|^)(%c)/g)||f===void 0)return A;var g=/([^%]|^)((%%)*)(%([oOdisf]))/g;if(typeof A[0]=="string"&&A[0].match(g))return["%c".concat(A[0]),f].concat(bA(A.slice(1)));var h=A.reduce(function(d,B,S){switch(S>0&&(d+=" "),es(B)){case"string":case"boolean":case"symbol":return d+="%s";case"number":var N=Number.isInteger(B)?"%i":"%f";return d+=N;default:return d+="%o"}},"%c");return[h,f].concat(bA(A))}function Rs(A){for(var f=arguments.length,g=new Array(f>1?f-1:0),h=1;h0&&arguments[0]!==void 0?arguments[0]:"",f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return ur(A,f)===1}function Nr(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return ur(A,f)>-1}var Ol=r(987),oa=60111,ia="Symbol(react.concurrent_mode)",Ic=60110,_n="Symbol(react.context)",hc="Symbol(react.server_context)",xA="Symbol(react.async_mode)",Ag=60103,ts="Symbol(react.element)",li=60129,Ll="Symbol(react.debug_trace_mode)",Cc=60112,Bc="Symbol(react.forward_ref)",Yp=60107,Vp="Symbol(react.fragment)",$p=60116,qp="Symbol(react.lazy)",lg=60115,ug="Symbol(react.memo)",zp=60106,Xp="Symbol(react.portal)",za=60114,Dc="Symbol(react.profiler)",Xa=60109,Za="Symbol(react.provider)",cg=60119,yc="Symbol(react.scope)",Ml=60108,Pl="Symbol(react.strict_mode)",Zp=60113,em="Symbol(react.suspense)",fg=60120,tm="Symbol(react.suspense_list)",rm="Symbol(react.server_context.defaultValue)",Qc=!1,Ch=!1,gg=!1,Bh=!1;function nm(A,f){return A===f&&(A!==0||1/A===1/f)||A!==A&&f!==f}var dg=typeof Object.is=="function"?Object.is:nm;let pg=dg;var mg=Object.prototype.hasOwnProperty;let Ul=mg;var wc=new Map;function om(A){var f=new Set,g={};return vc(A,f,g),{sources:Array.from(f).sort(),resolvedStyles:g}}function vc(A,f,g){A!=null&&(To(A)?A.forEach(function(h){h!=null&&(To(h)?vc(h,f,g):Mo(h,f,g))}):Mo(A,f,g),g=Object.fromEntries(Object.entries(g).sort()))}function Mo(A,f,g){var h=Object.keys(A);h.forEach(function(d){var B=A[d];if(typeof B=="string")if(d===B)f.add(d);else{var S=_c(B);S!=null&&(g[d]=S)}else{var N={};g[d]=N,vc([B],f,N)}})}function _c(A){if(wc.has(A))return wc.get(A);for(var f=0;fA.length)&&(f=A.length);for(var g=0,h=new Array(f);g"u"||!(Symbol.iterator in Object(A)))){var g=[],h=!0,d=!1,B=void 0;try{for(var S=A[Symbol.iterator](),N;!(h=(N=S.next()).done)&&(g.push(N.value),!(f&&g.length===f));h=!0);}catch(_){d=!0,B=_}finally{try{!h&&S.return!=null&&S.return()}finally{if(d)throw B}}return g}}function dr(A){if(Array.isArray(A))return A}var cr=function(f,g){var h=Oa(f),d=Oa(g),B=h.pop(),S=d.pop(),N=ei(h,d);return N!==0?N:B&&S?ei(B.split("."),S.split(".")):B||S?B?-1:1:0},Vt=function(f){return typeof f=="string"&&/^[v\d]/.test(f)&&Zs.test(f)},cn=function(f,g,h){ti(h);var d=cr(f,g);return Pa[h].includes(d)},ac=function(f,g){var h=g.match(/^([<>=~^]+)/),d=h?h[1]:"=";if(d!=="^"&&d!=="~")return cn(f,g,d);var B=Oa(f),S=Pe(B,5),N=S[0],_=S[1],O=S[2],U=S[4],q=Oa(g),V=Pe(q,5),de=V[0],We=V[1],gt=V[2],je=V[4],Dt=[N,_,O],Wt=[de,We??"x",gt??"x"];if(je&&(!U||ei(Dt,Wt)!==0||ei(U.split("."),je.split("."))===-1))return!1;var fr=Wt.findIndex(function(or){return or!=="0"})+1,ot=d==="~"?2:fr>1?fr:1;return!(ei(Dt.slice(0,ot),Wt.slice(0,ot))!==0||ei(Dt.slice(ot),Wt.slice(ot))===-1)},Zs=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Oa=function(f){if(typeof f!="string")throw new TypeError("Invalid argument expected string");var g=f.match(Zs);if(!g)throw new Error("Invalid argument not valid semver ('".concat(f,"' received)"));return g.shift(),g},La=function(f){return f==="*"||f==="x"||f==="X"},Ki=function(f){var g=parseInt(f,10);return isNaN(g)?f:g},BA=function(f,g){return Se(f)!==Se(g)?[String(f),String(g)]:[f,g]},Ma=function(f,g){if(La(f)||La(g))return 0;var h=BA(Ki(f),Ki(g)),d=Pe(h,2),B=d[0],S=d[1];return B>S?1:B":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},Ji=Object.keys(Pa),ti=function(f){if(typeof f!="string")throw new TypeError("Invalid operator type, expected string but got ".concat(Se(f)));if(Ji.indexOf(f)===-1)throw new Error("Invalid operator, expected one of ".concat(Ji.join("|")))},pr=r(730),$t=r.n(pr),br=r(550);function Jr(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jr=function(g){return typeof g}:Jr=function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},Jr(A)}var Q=Symbol.for("react.element"),R=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),oe=Symbol.for("react.profiler"),Ie=Symbol.for("react.provider"),Ne=Symbol.for("react.context"),xe=Symbol.for("react.server_context"),Ye=Symbol.for("react.forward_ref"),Oe=Symbol.for("react.suspense"),rt=Symbol.for("react.suspense_list"),Qt=Symbol.for("react.memo"),er=Symbol.for("react.lazy"),Fr=Symbol.for("react.scope"),tr=Symbol.for("react.debug_trace_mode"),vn=Symbol.for("react.offscreen"),zn=Symbol.for("react.legacy_hidden"),Ua=Symbol.for("react.cache"),ri=Symbol.for("react.tracing_marker"),DA=Symbol.for("react.default_value"),Dl=Symbol.for("react.memo_cache_sentinel"),Zf=Symbol.for("react.postpone"),Ga=Symbol.iterator,Gp="@@iterator";function eg(A){if(A===null||Jr(A)!=="object")return null;var f=Ga&&A[Ga]||A[Gp];return typeof f=="function"?f:null}var Gt=1,yl=2,ni=5,ea=6,yA=7,Ha=8,Ir=9,Ac=10,Ql=11,lc=12,Hp=13,wl=14,oi=1,Wp=2,jp=3,ii=4,Yi=1,vl=Array.isArray;let To=vl;var uc=r(169);function _l(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_l=function(g){return typeof g}:_l=function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},_l(A)}function si(A){return Rl(A)||Sl(A)||ja(A)||Wa()}function Wa(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ja(A,f){if(A){if(typeof A=="string")return lo(A,f);var g=Object.prototype.toString.call(A).slice(8,-1);if(g==="Object"&&A.constructor&&(g=A.constructor.name),g==="Map"||g==="Set")return Array.from(A);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return lo(A,f)}}function Sl(A){if(typeof Symbol<"u"&&Symbol.iterator in Object(A))return Array.from(A)}function Rl(A){if(Array.isArray(A))return lo(A)}function lo(A,f){(f==null||f>A.length)&&(f=A.length);for(var g=0,h=new Array(f);gf.toString()?1:f.toString()>A.toString()?-1:0}function $i(A){for(var f=new Set,g=A,h=function(){var B=[].concat(si(Object.keys(g)),si(Object.getOwnPropertySymbols(g))),S=Object.getOwnPropertyDescriptors(g);B.forEach(function(N){S[N].enumerable&&f.add(N)}),g=Object.getPrototypeOf(g)};g!=null;)h();return f}function cc(A,f,g,h){var d=A.displayName;return d||"".concat(g,"(").concat(ta(f,h),")")}function ta(A){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Anonymous",g=Ss.get(A);if(g!=null)return g;var h=f;return typeof A.displayName=="string"?h=A.displayName:typeof A.name=="string"&&A.name!==""&&(h=A.name),Ss.set(A,h),h}var fc=0;function uo(){return++fc}function Oo(A){for(var f="",g=0;g=0){var h=A.match(/[^()]+/g);h!=null&&(A=h.pop(),g=h)}break;default:break}return[A,g]}function gc(A,f){for(var g in A)if(!(g in f))return!0;for(var h in f)if(A[h]!==f[h])return!0;return!1}function Ai(A,f){return f.reduce(function(g,h){if(g){if(Xn.call(g,h))return g[h];if(typeof g[Symbol.iterator]=="function")return Array.from(g)[h]}return null},A)}function vA(A,f){var g=f.length,h=f[g-1];if(A!=null){var d=Ai(A,f.slice(0,g-1));d&&(To(d)?d.splice(h,1):delete d[h])}}function zi(A,f,g){var h=f.length;if(A!=null){var d=Ai(A,f.slice(0,h-1));if(d){var B=f[h-1],S=g[h-1];d[S]=d[B],To(d)?d.splice(B,1):delete d[B]}}}function _A(A,f,g){var h=f.length,d=f[h-1];if(A!=null){var B=Ai(A,f.slice(0,h-1));B&&(B[d]=g)}}function SA(A){if(A===null)return"null";if(A===void 0)return"undefined";if((0,br.isElement)(A))return"react_element";if(typeof HTMLElement<"u"&&A instanceof HTMLElement)return"html_element";var f=_l(A);switch(f){case"bigint":return"bigint";case"boolean":return"boolean";case"function":return"function";case"number":return Number.isNaN(A)?"nan":Number.isFinite(A)?"number":"infinity";case"object":if(To(A))return"array";if(ArrayBuffer.isView(A))return Xn.call(A.constructor,"BYTES_PER_ELEMENT")?"typed_array":"data_view";if(A.constructor&&A.constructor.name==="ArrayBuffer")return"array_buffer";if(typeof A[Symbol.iterator]=="function"){var g=A[Symbol.iterator]();if(g)return g===A?"opaque_iterator":"iterator"}else{if(A.constructor&&A.constructor.name==="RegExp")return"regexp";var h=Object.prototype.toString.call(A);if(h==="[object Date]")return"date";if(h==="[object HTMLAllCollection]")return"html_all_collection"}return ng(A)?"object":"class_instance";case"string":return"string";case"symbol":return"symbol";case"undefined":return Object.prototype.toString.call(A)==="[object HTMLAllCollection]"?"html_all_collection":"undefined";default:return"unknown"}}function RA(A){var f=(0,br.typeOf)(A);switch(f){case br.ContextConsumer:return"ContextConsumer";case br.ContextProvider:return"ContextProvider";case br.ForwardRef:return"ForwardRef";case br.Fragment:return"Fragment";case br.Lazy:return"Lazy";case br.Memo:return"Memo";case br.Portal:return"Portal";case br.Profiler:return"Profiler";case br.StrictMode:return"StrictMode";case br.Suspense:return"Suspense";case rt:return"SuspenseList";case ri:return"TracingMarker";default:var g=A.type;return typeof g=="string"?g:typeof g=="function"?ta(g,"Anonymous"):g!=null?"NotImplementedInDevtools":"Element"}}var yi=50;function Qo(A){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yi;return A.length>f?A.slice(0,f)+"\u2026":A}function ar(A,f){if(A!=null&&Xn.call(A,Ht.type))return f?A[Ht.preview_long]:A[Ht.preview_short];var g=SA(A);switch(g){case"html_element":return"<".concat(Qo(A.tagName.toLowerCase())," />");case"function":return Qo("\u0192 ".concat(typeof A.name=="function"?"":A.name,"() {}"));case"string":return'"'.concat(A,'"');case"bigint":return Qo(A.toString()+"n");case"regexp":return Qo(A.toString());case"symbol":return Qo(A.toString());case"react_element":return"<".concat(Qo(RA(A)||"Unknown")," />");case"array_buffer":return"ArrayBuffer(".concat(A.byteLength,")");case"data_view":return"DataView(".concat(A.buffer.byteLength,")");case"array":if(f){for(var h="",d=0;d0&&(h+=", "),h+=ar(A[d],!1),!(h.length>yi));d++);return"[".concat(Qo(h),"]")}else{var B=Xn.call(A,Ht.size)?A[Ht.size]:A.length;return"Array(".concat(B,")")}case"typed_array":var S="".concat(A.constructor.name,"(").concat(A.length,")");if(f){for(var N="",_=0;_0&&(N+=", "),N+=A[_],!(N.length>yi));_++);return"".concat(S," [").concat(Qo(N),"]")}else return S;case"iterator":var O=A.constructor.name;if(f){for(var U=Array.from(A),q="",V=0;V0&&(q+=", "),To(de)){var We=ar(de[0],!0),gt=ar(de[1],!1);q+="".concat(We," => ").concat(gt)}else q+=ar(de,!1);if(q.length>yi)break}return"".concat(O,"(").concat(A.size,") {").concat(Qo(q),"}")}else return"".concat(O,"(").concat(A.size,")");case"opaque_iterator":return A[Symbol.toStringTag];case"date":return A.toString();case"class_instance":return A.constructor.name;case"object":if(f){for(var je=Array.from($i(A)).sort(Vi),Dt="",Wt=0;Wt0&&(Dt+=", "),Dt+="".concat(fr.toString(),": ").concat(ar(A[fr],!1)),Dt.length>yi)break}return"{".concat(Qo(Dt),"}")}else return"{\u2026}";case"boolean":case"number":case"infinity":case"nan":case"null":case"undefined":return A;default:try{return Qo(String(A))}catch{return"unserializable"}}}var ng=function(f){var g=Object.getPrototypeOf(f);if(!g)return!0;var h=Object.getPrototypeOf(g);return!h};function Nl(A,f){var g=Object.keys(A);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(A);f&&(h=h.filter(function(d){return Object.getOwnPropertyDescriptor(A,d).enumerable})),g.push.apply(g,h)}return g}function dc(A){for(var f=1;f5&&arguments[5]!==void 0?arguments[5]:0,S=SA(A),N;switch(S){case"html_element":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.tagName,type:S};case"function":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:typeof A.name=="function"||!A.name?"function":A.name,type:S};case"string":return N=d(h),N||A.length<=500?A:A.slice(0,500)+"...";case"bigint":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.toString(),type:S};case"symbol":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.toString(),type:S};case"react_element":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:RA(A)||"Unknown",type:S};case"array_buffer":case"data_view":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:S==="data_view"?"DataView":"ArrayBuffer",size:A.byteLength,type:S};case"array":return N=d(h),B>=Qi&&!N?Ya(S,!0,A,f,h):A.map(function(q,V){return Va(q,f,g,h.concat([V]),d,N?1:B+1)});case"html_all_collection":case"typed_array":case"iterator":if(N=d(h),B>=Qi&&!N)return Ya(S,!0,A,f,h);var _={unserializable:!0,type:S,readonly:!0,size:S==="typed_array"?A.length:void 0,preview_short:ar(A,!1),preview_long:ar(A,!0),name:!A.constructor||A.constructor.name==="Object"?"":A.constructor.name};return Array.from(A).forEach(function(q,V){return _[V]=Va(q,f,g,h.concat([V]),d,N?1:B+1)}),g.push(h),_;case"opaque_iterator":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A[Symbol.toStringTag],type:S};case"date":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.toString(),type:S};case"regexp":return f.push(h),{inspectable:!1,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.toString(),type:S};case"object":if(N=d(h),B>=Qi&&!N)return Ya(S,!0,A,f,h);var O={};return $i(A).forEach(function(q){var V=q.toString();O[V]=Va(A[q],f,g,h.concat([V]),d,N?1:B+1)}),O;case"class_instance":if(N=d(h),B>=Qi&&!N)return Ya(S,!0,A,f,h);var U={unserializable:!0,type:S,readonly:!0,preview_short:ar(A,!1),preview_long:ar(A,!0),name:A.constructor.name};return $i(A).forEach(function(q){var V=q.toString();U[V]=Va(A[q],f,g,h.concat([V]),d,N?1:B+1)}),g.push(h),U;case"infinity":case"nan":case"undefined":return f.push(h),{type:S};default:return A}}function Xi(A,f,g,h){var d=getInObject(A,g);if(d!=null&&(d[Ht.unserializable]||(delete d[Ht.inspectable],delete d[Ht.inspected],delete d[Ht.name],delete d[Ht.preview_long],delete d[Ht.preview_short],delete d[Ht.readonly],delete d[Ht.size],delete d[Ht.type])),h!==null&&f.unserializable.length>0){for(var B=f.unserializable[0],S=B.length===g.length,N=0;NA.length)&&(f=A.length);for(var g=0,h=new Array(f);g2&&arguments[2]!==void 0?arguments[2]:[];if(A!==null){var h=[],d=[],B=Va(A,h,d,g,f);return{data:B,cleaned:h,unserializable:d}}else return null}function Sr(A,f){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,h=f[g],d=Zn(A)?A.slice():Lo({},A);return g+1===f.length?Zn(d)?d.splice(h,1):delete d[h]:d[h]=Sr(A[h],f,g+1),d}function qa(A,f,g){var h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,d=f[h],B=Zn(A)?A.slice():Lo({},A);if(h+1===f.length){var S=g[h];B[S]=B[d],Zn(B)?B.splice(d,1):delete B[d]}else B[d]=qa(A[d],f,g,h+1);return B}function kA(A,f,g){var h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(h>=f.length)return g;var d=f[h],B=Zn(A)?A.slice():Lo({},A);return B[d]=kA(A[d],f,g,h+1),B}function mc(A){var f=null,g=null,h=A.current;if(h!=null){var d=h.stateNode;d!=null&&(f=d.effectDuration!=null?d.effectDuration:null,g=d.passiveEffectDuration!=null?d.passiveEffectDuration:null)}return{effectDuration:f,passiveEffectDuration:g}}function NA(A){if(A===void 0)return"undefined";var f=new Set;return JSON.stringify(A,function(g,h){if(es(h)==="object"&&h!==null){if(f.has(h))return;f.add(h)}return typeof h=="bigint"?h.toString()+"n":h},2)}function Ec(A,f){if(A==null||A.length===0||typeof A[0]=="string"&&A[0].match(/([^%]|^)(%c)/g)||f===void 0)return A;var g=/([^%]|^)((%%)*)(%([oOdisf]))/g;if(typeof A[0]=="string"&&A[0].match(g))return["%c".concat(A[0]),f].concat(bA(A.slice(1)));var h=A.reduce(function(d,B,S){switch(S>0&&(d+=" "),es(B)){case"string":case"boolean":case"symbol":return d+="%s";case"number":var N=Number.isInteger(B)?"%i":"%f";return d+=N;default:return d+="%o"}},"%c");return[h,f].concat(bA(A))}function Rs(A){for(var f=arguments.length,g=new Array(f>1?f-1:0),h=1;h0&&arguments[0]!==void 0?arguments[0]:"",f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return cr(A,f)===1}function Nr(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return cr(A,f)>-1}var Ol=r(987),oa=60111,ia="Symbol(react.concurrent_mode)",Ic=60110,_n="Symbol(react.context)",hc="Symbol(react.server_context)",xA="Symbol(react.async_mode)",Ag=60103,ts="Symbol(react.element)",li=60129,Ll="Symbol(react.debug_trace_mode)",Cc=60112,Bc="Symbol(react.forward_ref)",Yp=60107,Vp="Symbol(react.fragment)",$p=60116,qp="Symbol(react.lazy)",lg=60115,ug="Symbol(react.memo)",zp=60106,Xp="Symbol(react.portal)",za=60114,Dc="Symbol(react.profiler)",Xa=60109,Za="Symbol(react.provider)",cg=60119,yc="Symbol(react.scope)",Ml=60108,Pl="Symbol(react.strict_mode)",Zp=60113,em="Symbol(react.suspense)",fg=60120,tm="Symbol(react.suspense_list)",rm="Symbol(react.server_context.defaultValue)",Qc=!1,Ch=!1,gg=!1,Bh=!1;function nm(A,f){return A===f&&(A!==0||1/A===1/f)||A!==A&&f!==f}var dg=typeof Object.is=="function"?Object.is:nm;let pg=dg;var mg=Object.prototype.hasOwnProperty;let Ul=mg;var wc=new Map;function om(A){var f=new Set,g={};return vc(A,f,g),{sources:Array.from(f).sort(),resolvedStyles:g}}function vc(A,f,g){A!=null&&(To(A)?A.forEach(function(h){h!=null&&(To(h)?vc(h,f,g):Mo(h,f,g))}):Mo(A,f,g),g=Object.fromEntries(Object.entries(g).sort()))}function Mo(A,f,g){var h=Object.keys(A);h.forEach(function(d){var B=A[d];if(typeof B=="string")if(d===B)f.add(d);else{var S=_c(B);S!=null&&(g[d]=S)}else{var N={};g[d]=N,vc([B],f,N)}})}function _c(A){if(wc.has(A))return wc.get(A);for(var f=0;f"u"?"undefined":tA(Reflect))==="object"&&Reflect.construct){try{Reflect.construct(N,[])}catch(gt){d=gt}Reflect.construct(A,[],N)}else{try{N.call()}catch(gt){d=gt}A.call(N.prototype)}}else{try{throw Error()}catch(gt){d=gt}A()}}catch(gt){if(gt&&d&&typeof gt.stack=="string"){for(var _=gt.stack.split(` `),O=d.stack.split(` `),U=_.length-1,q=O.length-1;U>=1&&q>=0&&_[U]!==O[q];)q--;for(;U>=1&&q>=0;U--,q--)if(_[U]!==O[q]){if(U!==1||q!==1)do if(U--,q--,q<0||_[U]!==O[q]){var V=` `+_[U].replace(" at new "," at ");return V}while(U>=1&&q>=0);break}}}finally{Hl=!1,Error.prepareStackTrace=B,g.current=S,Lc()}var de=A?A.displayName||A.name:"",We=de?rs(de):"";return We}function Mc(A,f,g){return Wl(A,!0,g)}function rA(A,f,g){return Wl(A,!1,g)}function am(A){var f=A.prototype;return!!(f&&f.isReactComponent)}function Pc(A,f,g){return"";switch(A){case SUSPENSE_NUMBER:case SUSPENSE_SYMBOL_STRING:return rs("Suspense",f);case SUSPENSE_LIST_NUMBER:case SUSPENSE_LIST_SYMBOL_STRING:return rs("SuspenseList",f)}if(tA(A)==="object")switch(A.$$typeof){case FORWARD_REF_NUMBER:case FORWARD_REF_SYMBOL_STRING:return rA(A.render,f,g);case MEMO_NUMBER:case MEMO_SYMBOL_STRING:return Pc(A.type,f,g);case LAZY_NUMBER:case LAZY_SYMBOL_STRING:{var h=A,d=h._payload,B=h._init;try{return Pc(B(d),f,g)}catch{}}}}function jl(A,f,g){var h=A.HostComponent,d=A.LazyComponent,B=A.SuspenseComponent,S=A.SuspenseListComponent,N=A.FunctionComponent,_=A.IndeterminateComponent,O=A.SimpleMemoComponent,U=A.ForwardRef,q=A.ClassComponent,V=null;switch(f.tag){case h:return rs(f.type,V);case d:return rs("Lazy",V);case B:return rs("Suspense",V);case S:return rs("SuspenseList",V);case N:case _:case O:return rA(f.type,V,g);case U:return rA(f.type.render,V,g);case q:return Mc(f.type,V,g);default:return""}}function yg(A,f,g){try{var h="",d=f;do h+=jl(A,d,g),d=d.return;while(d);return h}catch(B){return` Error generating stack: `+B.message+` `+B.stack}}function LA(A,f){return MA(A)||Qg(A,f)||Am(A,f)||ns()}function ns(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Am(A,f){if(A){if(typeof A=="string")return ui(A,f);var g=Object.prototype.toString.call(A).slice(8,-1);if(g==="Object"&&A.constructor&&(g=A.constructor.name),g==="Map"||g==="Set")return Array.from(A);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return ui(A,f)}}function ui(A,f){(f==null||f>A.length)&&(f=A.length);for(var g=0,h=new Array(f);g"u"||!(Symbol.iterator in Object(A)))){var g=[],h=!0,d=!1,B=void 0;try{for(var S=A[Symbol.iterator](),N;!(h=(N=S.next()).done)&&(g.push(N.value),!(f&&g.length===f));h=!0);}catch(_){d=!0,B=_}finally{try{!h&&S.return!=null&&S.return()}finally{if(d)throw B}}return g}}function MA(A){if(Array.isArray(A))return A}function os(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?os=function(g){return typeof g}:os=function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},os(A)}var PA=10,sa=null,Uc=typeof performance<"u"&&typeof performance.mark=="function"&&typeof performance.clearMarks=="function",xt=!1;if(Uc){var Tn="__v3",wg={};Object.defineProperty(wg,"startTime",{get:function(){return xt=!0,0},set:function(){}});try{performance.mark(Tn,wg)}catch{}finally{performance.clearMarks(Tn)}}xt&&(sa=performance);var lm=(typeof performance>"u"?"undefined":os(performance))==="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()};function Gc(A){sa=A,Uc=A!==null,xt=A!==null}function Hn(A){var f=A.getDisplayNameForFiber,g=A.getIsProfiling,h=A.getLaneLabelMap,d=A.workTagMap,B=A.currentDispatcherRef,S=A.reactVersion,N=0,_=null,O=[],U=null,q=new Map,V=!1,de=!1;function We(){var tt=lm();return U?(U.startTime===0&&(U.startTime=tt-PA),tt-U.startTime):0}function gt(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.getInternalModuleRanges=="function"){var tt=__REACT_DEVTOOLS_GLOBAL_HOOK__.getInternalModuleRanges();if(Zn(tt))return tt}return null}function je(){return U}function Dt(tt){for(var It=[],Jt=1,nr=0;nr0){var nr=O[O.length-1];Jt=nr.type==="render-idle"?nr.depth:nr.depth+1}var An=Dt(It),Mr={type:tt,batchUID:N,depth:Jt,lanes:An,timestamp:We(),duration:0};if(O.push(Mr),U){var jn=U,po=jn.batchUIDToMeasuresMap,Ln=jn.laneToReactMeasureMap,di=po.get(N);di!=null?di.push(Mr):po.set(N,[Mr]),An.forEach(function(ma){di=Ln.get(ma),di&&di.push(Mr)})}}function Cr(tt){var It=We();if(O.length===0){console.error('Unexpected type "%s" completed at %sms while currentReactMeasuresStack is empty.',tt,It);return}var Jt=O.pop();Jt.type!==tt&&console.error('Unexpected type "%s" completed at %sms before "%s" completed.',tt,It,Jt.type),Jt.duration=It-Jt.timestamp,U&&(U.duration=We()+PA)}function rr(tt){V&&(or("commit",tt),de=!0),xt&&(ot("--commit-start-".concat(tt)),cr())}function wr(){V&&(Cr("commit"),Cr("render-idle")),xt&&ot("--commit-stop")}function Br(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"render",warning:null}),xt&&ot("--component-render-start-".concat(It))}}function Dn(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-render-stop")}function Ot(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"layout-effect-mount",warning:null}),xt&&ot("--component-layout-effect-mount-start-".concat(It))}}function Rn(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-layout-effect-mount-stop")}function an(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"layout-effect-unmount",warning:null}),xt&&ot("--component-layout-effect-unmount-start-".concat(It))}}function Vr(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-layout-effect-unmount-stop")}function bt(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"passive-effect-mount",warning:null}),xt&&ot("--component-passive-effect-mount-start-".concat(It))}}function Dr(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-passive-effect-mount-stop")}function bn(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"passive-effect-unmount",warning:null}),xt&&ot("--component-passive-effect-unmount-start-".concat(It))}}function io(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-passive-effect-unmount-stop")}function qe(tt,It,Jt){if(V||xt){var nr=f(tt)||"Unknown",An=tt.alternate===null?"mount":"update",Mr="";It!==null&&os(It)==="object"&&typeof It.message=="string"?Mr=It.message:typeof It=="string"&&(Mr=It),V&&U&&U.thrownErrors.push({componentName:nr,message:Mr,phase:An,timestamp:We(),type:"thrown-error"}),xt&&ot("--error-".concat(nr,"-").concat(An,"-").concat(Mr))}}var pt=typeof WeakMap=="function"?WeakMap:Map,Ct=new pt,Lr=0;function gn(tt){return Ct.has(tt)||Ct.set(tt,Lr++),Ct.get(tt)}function $r(tt,It,Jt){if(V||xt){var nr=Ct.has(It)?"resuspend":"suspend",An=gn(It),Mr=f(tt)||"Unknown",jn=tt.alternate===null?"mount":"update",po=It.displayName||"",Ln=null;V&&(Ln={componentName:Mr,depth:0,duration:0,id:"".concat(An),phase:jn,promiseName:po,resolution:"unresolved",timestamp:We(),type:"suspense",warning:null},U&&U.suspenseEvents.push(Ln)),xt&&ot("--suspense-".concat(nr,"-").concat(An,"-").concat(Mr,"-").concat(jn,"-").concat(Jt,"-").concat(po)),It.then(function(){Ln&&(Ln.duration=We()-Ln.timestamp,Ln.resolution="resolved"),xt&&ot("--suspense-resolved-".concat(An,"-").concat(Mr))},function(){Ln&&(Ln.duration=We()-Ln.timestamp,Ln.resolution="rejected"),xt&&ot("--suspense-rejected-".concat(An,"-").concat(Mr))})}}function dn(tt){V&&or("layout-effects",tt),xt&&ot("--layout-effects-start-".concat(tt))}function On(){V&&Cr("layout-effects"),xt&&ot("--layout-effects-stop")}function pa(tt){V&&or("passive-effects",tt),xt&&ot("--passive-effects-start-".concat(tt))}function gi(){V&&Cr("passive-effects"),xt&&ot("--passive-effects-stop")}function xs(tt){V&&(de&&(de=!1,N++),(O.length===0||O[O.length-1].type!=="render-idle")&&or("render-idle",tt),or("render",tt)),xt&&ot("--render-start-".concat(tt))}function Ts(){V&&Cr("render"),xt&&ot("--render-yield")}function As(){V&&Cr("render"),xt&&ot("--render-stop")}function ls(tt){V&&U&&U.schedulingEvents.push({lanes:Dt(tt),timestamp:We(),type:"schedule-render",warning:null}),xt&&ot("--schedule-render-".concat(tt))}function sA(tt,It){if(V||xt){var Jt=f(tt)||"Unknown";V&&U&&U.schedulingEvents.push({componentName:Jt,lanes:Dt(It),timestamp:We(),type:"schedule-force-update",warning:null}),xt&&ot("--schedule-forced-update-".concat(It,"-").concat(Jt))}}function Os(tt){for(var It=[],Jt=tt;Jt!==null;)It.push(Jt),Jt=Jt.return;return It}function Zc(tt,It){if(V||xt){var Jt=f(tt)||"Unknown";if(V&&U){var nr={componentName:Jt,lanes:Dt(It),timestamp:We(),type:"schedule-state-update",warning:null};q.set(nr,Os(tt)),U.schedulingEvents.push(nr)}xt&&ot("--schedule-state-update-".concat(It,"-").concat(Jt))}}function ef(tt){if(V!==tt)if(V=tt,V){var It=new Map;if(xt){var Jt=gt();if(Jt)for(var nr=0;nr=0)&&Object.prototype.propertyIsEnumerable.call(A,h)&&(g[h]=A[h])}return g}function At(A,f){if(A==null)return{};var g={},h=Object.keys(A),d,B;for(B=0;B=0)&&(g[d]=A[d]);return g}function aa(A,f){var g=Object.keys(A);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(A);f&&(h=h.filter(function(d){return Object.getOwnPropertyDescriptor(A,d).enumerable})),g.push.apply(g,h)}return g}function UA(A){for(var f=1;fA.length)&&(f=A.length);for(var g=0,h=new Array(f);g"u"||!(Symbol.iterator in Object(A)))){var g=[],h=!0,d=!1,B=void 0;try{for(var S=A[Symbol.iterator](),N;!(h=(N=S.next()).done)&&(g.push(N.value),!(f&&g.length===f));h=!0);}catch(_){d=!0,B=_}finally{try{!h&&S.return!=null&&S.return()}finally{if(d)throw B}}return g}}function MA(A){if(Array.isArray(A))return A}function os(A){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?os=function(g){return typeof g}:os=function(g){return g&&typeof Symbol=="function"&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},os(A)}var PA=10,sa=null,Uc=typeof performance<"u"&&typeof performance.mark=="function"&&typeof performance.clearMarks=="function",xt=!1;if(Uc){var Tn="__v3",wg={};Object.defineProperty(wg,"startTime",{get:function(){return xt=!0,0},set:function(){}});try{performance.mark(Tn,wg)}catch{}finally{performance.clearMarks(Tn)}}xt&&(sa=performance);var lm=(typeof performance>"u"?"undefined":os(performance))==="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()};function Gc(A){sa=A,Uc=A!==null,xt=A!==null}function Hn(A){var f=A.getDisplayNameForFiber,g=A.getIsProfiling,h=A.getLaneLabelMap,d=A.workTagMap,B=A.currentDispatcherRef,S=A.reactVersion,N=0,_=null,O=[],U=null,q=new Map,V=!1,de=!1;function We(){var tt=lm();return U?(U.startTime===0&&(U.startTime=tt-PA),tt-U.startTime):0}function gt(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.getInternalModuleRanges=="function"){var tt=__REACT_DEVTOOLS_GLOBAL_HOOK__.getInternalModuleRanges();if(Zn(tt))return tt}return null}function je(){return U}function Dt(tt){for(var It=[],Jt=1,nr=0;nr0){var nr=O[O.length-1];Jt=nr.type==="render-idle"?nr.depth:nr.depth+1}var An=Dt(It),Mr={type:tt,batchUID:N,depth:Jt,lanes:An,timestamp:We(),duration:0};if(O.push(Mr),U){var jn=U,po=jn.batchUIDToMeasuresMap,Ln=jn.laneToReactMeasureMap,di=po.get(N);di!=null?di.push(Mr):po.set(N,[Mr]),An.forEach(function(ma){di=Ln.get(ma),di&&di.push(Mr)})}}function Cr(tt){var It=We();if(O.length===0){console.error('Unexpected type "%s" completed at %sms while currentReactMeasuresStack is empty.',tt,It);return}var Jt=O.pop();Jt.type!==tt&&console.error('Unexpected type "%s" completed at %sms before "%s" completed.',tt,It,Jt.type),Jt.duration=It-Jt.timestamp,U&&(U.duration=We()+PA)}function rr(tt){V&&(or("commit",tt),de=!0),xt&&(ot("--commit-start-".concat(tt)),fr())}function wr(){V&&(Cr("commit"),Cr("render-idle")),xt&&ot("--commit-stop")}function Br(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"render",warning:null}),xt&&ot("--component-render-start-".concat(It))}}function Dn(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-render-stop")}function Ot(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"layout-effect-mount",warning:null}),xt&&ot("--component-layout-effect-mount-start-".concat(It))}}function Rn(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-layout-effect-mount-stop")}function an(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"layout-effect-unmount",warning:null}),xt&&ot("--component-layout-effect-unmount-start-".concat(It))}}function Vr(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-layout-effect-unmount-stop")}function bt(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"passive-effect-mount",warning:null}),xt&&ot("--component-passive-effect-mount-start-".concat(It))}}function Dr(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-passive-effect-mount-stop")}function bn(tt){if(V||xt){var It=f(tt)||"Unknown";V&&V&&(_={componentName:It,duration:0,timestamp:We(),type:"passive-effect-unmount",warning:null}),xt&&ot("--component-passive-effect-unmount-start-".concat(It))}}function io(){V&&_&&(U&&U.componentMeasures.push(_),_.duration=We()-_.timestamp,_=null),xt&&ot("--component-passive-effect-unmount-stop")}function qe(tt,It,Jt){if(V||xt){var nr=f(tt)||"Unknown",An=tt.alternate===null?"mount":"update",Mr="";It!==null&&os(It)==="object"&&typeof It.message=="string"?Mr=It.message:typeof It=="string"&&(Mr=It),V&&U&&U.thrownErrors.push({componentName:nr,message:Mr,phase:An,timestamp:We(),type:"thrown-error"}),xt&&ot("--error-".concat(nr,"-").concat(An,"-").concat(Mr))}}var pt=typeof WeakMap=="function"?WeakMap:Map,Ct=new pt,Lr=0;function gn(tt){return Ct.has(tt)||Ct.set(tt,Lr++),Ct.get(tt)}function $r(tt,It,Jt){if(V||xt){var nr=Ct.has(It)?"resuspend":"suspend",An=gn(It),Mr=f(tt)||"Unknown",jn=tt.alternate===null?"mount":"update",po=It.displayName||"",Ln=null;V&&(Ln={componentName:Mr,depth:0,duration:0,id:"".concat(An),phase:jn,promiseName:po,resolution:"unresolved",timestamp:We(),type:"suspense",warning:null},U&&U.suspenseEvents.push(Ln)),xt&&ot("--suspense-".concat(nr,"-").concat(An,"-").concat(Mr,"-").concat(jn,"-").concat(Jt,"-").concat(po)),It.then(function(){Ln&&(Ln.duration=We()-Ln.timestamp,Ln.resolution="resolved"),xt&&ot("--suspense-resolved-".concat(An,"-").concat(Mr))},function(){Ln&&(Ln.duration=We()-Ln.timestamp,Ln.resolution="rejected"),xt&&ot("--suspense-rejected-".concat(An,"-").concat(Mr))})}}function dn(tt){V&&or("layout-effects",tt),xt&&ot("--layout-effects-start-".concat(tt))}function On(){V&&Cr("layout-effects"),xt&&ot("--layout-effects-stop")}function pa(tt){V&&or("passive-effects",tt),xt&&ot("--passive-effects-start-".concat(tt))}function gi(){V&&Cr("passive-effects"),xt&&ot("--passive-effects-stop")}function xs(tt){V&&(de&&(de=!1,N++),(O.length===0||O[O.length-1].type!=="render-idle")&&or("render-idle",tt),or("render",tt)),xt&&ot("--render-start-".concat(tt))}function Ts(){V&&Cr("render"),xt&&ot("--render-yield")}function As(){V&&Cr("render"),xt&&ot("--render-stop")}function ls(tt){V&&U&&U.schedulingEvents.push({lanes:Dt(tt),timestamp:We(),type:"schedule-render",warning:null}),xt&&ot("--schedule-render-".concat(tt))}function sA(tt,It){if(V||xt){var Jt=f(tt)||"Unknown";V&&U&&U.schedulingEvents.push({componentName:Jt,lanes:Dt(It),timestamp:We(),type:"schedule-force-update",warning:null}),xt&&ot("--schedule-forced-update-".concat(It,"-").concat(Jt))}}function Os(tt){for(var It=[],Jt=tt;Jt!==null;)It.push(Jt),Jt=Jt.return;return It}function Zc(tt,It){if(V||xt){var Jt=f(tt)||"Unknown";if(V&&U){var nr={componentName:Jt,lanes:Dt(It),timestamp:We(),type:"schedule-state-update",warning:null};q.set(nr,Os(tt)),U.schedulingEvents.push(nr)}xt&&ot("--schedule-state-update-".concat(It,"-").concat(Jt))}}function ef(tt){if(V!==tt)if(V=tt,V){var It=new Map;if(xt){var Jt=gt();if(Jt)for(var nr=0;nr=0)&&Object.prototype.propertyIsEnumerable.call(A,h)&&(g[h]=A[h])}return g}function At(A,f){if(A==null)return{};var g={},h=Object.keys(A),d,B;for(B=0;B=0)&&(g[d]=A[d]);return g}function aa(A,f){var g=Object.keys(A);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(A);f&&(h=h.filter(function(d){return Object.getOwnPropertyDescriptor(A,d).enumerable})),g.push.apply(g,h)}return g}function UA(A){for(var f=1;f"u"||!(Symbol.iterator in Object(A)))){var g=[],h=!0,d=!1,B=void 0;try{for(var S=A[Symbol.iterator](),N;!(h=(N=S.next()).done)&&(g.push(N.value),!(f&&g.length===f));h=!0);}catch(_){d=!0,B=_}finally{try{!h&&S.return!=null&&S.return()}finally{if(d)throw B}}return g}}function Hc(A){if(Array.isArray(A))return A}function Jl(A){return Wc(A)||Rg(A)||En(A)||Sg()}function Sg(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rg(A){if(typeof Symbol<"u"&&Symbol.iterator in Object(A))return Array.from(A)}function Wc(A){if(Array.isArray(A))return wo(A)}function Aa(A,f){var g;if(typeof Symbol>"u"||A[Symbol.iterator]==null){if(Array.isArray(A)||(g=En(A))||f&&A&&typeof A.length=="number"){g&&(A=g);var h=0,d=function(){};return{s:d,n:function(){return h>=A.length?{done:!0}:{done:!1,value:A[h++]}},e:function(O){throw O},f:d}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,S=!1,N;return{s:function(){g=A[Symbol.iterator]()},n:function(){var O=g.next();return B=O.done,O},e:function(O){S=!0,N=O},f:function(){try{!B&&g.return!=null&&g.return()}finally{if(S)throw N}}}}function En(A,f){if(A){if(typeof A=="string")return wo(A,f);var g=Object.prototype.toString.call(A).slice(8,-1);if(g==="Object"&&A.constructor&&(g=A.constructor.name),g==="Map"||g==="Set")return Array.from(A);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return wo(A,f)}}function wo(A,f){(f==null||f>A.length)&&(f=A.length);for(var g=0,h=new Array(f);g"u"?"undefined":Wn(performance))==="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()};function Po(A){var f={ImmediatePriority:99,UserBlockingPriority:98,NormalPriority:97,LowPriority:96,IdlePriority:95,NoPriority:90};fn(A,"17.0.2")&&(f={ImmediatePriority:1,UserBlockingPriority:2,NormalPriority:3,LowPriority:4,IdlePriority:5,NoPriority:0});var g=0;Nr(A,"18.0.0-alpha")?g=24:Nr(A,"16.9.0")?g=1:Nr(A,"16.3.0")&&(g=2);var h=null;fn(A,"17.0.1")?h={CacheComponent:24,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:26,HostSingleton:27,HostText:6,IncompleteClassComponent:17,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:23,MemoComponent:14,Mode:8,OffscreenComponent:22,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,TracingMarkerComponent:25,YieldComponent:-1}:Nr(A,"17.0.0-alpha")?h={CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:-1,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:24,MemoComponent:14,Mode:8,OffscreenComponent:23,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,TracingMarkerComponent:-1,YieldComponent:-1}:Nr(A,"16.6.0-beta.0")?h={CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:-1,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:-1,MemoComponent:14,Mode:8,OffscreenComponent:-1,Profiler:12,ScopeComponent:-1,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,TracingMarkerComponent:-1,YieldComponent:-1}:Nr(A,"16.4.3-alpha")?h={CacheComponent:-1,ClassComponent:2,ContextConsumer:11,ContextProvider:12,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:-1,ForwardRef:13,Fragment:9,FunctionComponent:0,HostComponent:7,HostPortal:6,HostRoot:5,HostHoistable:-1,HostSingleton:-1,HostText:8,IncompleteClassComponent:-1,IndeterminateComponent:4,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:10,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,TracingMarkerComponent:-1,YieldComponent:-1}:h={CacheComponent:-1,ClassComponent:2,ContextConsumer:12,ContextProvider:13,CoroutineComponent:7,CoroutineHandlerPhase:8,DehydratedSuspenseComponent:-1,ForwardRef:14,Fragment:10,FunctionComponent:1,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:-1,HostSingleton:-1,HostText:6,IncompleteClassComponent:-1,IndeterminateComponent:0,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:11,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,TracingMarkerComponent:-1,YieldComponent:9};function d(bt){var Dr=Wn(bt)==="object"&&bt!==null?bt.$$typeof:bt;return Wn(Dr)==="symbol"?Dr.toString():Dr}var B=h,S=B.CacheComponent,N=B.ClassComponent,_=B.IncompleteClassComponent,O=B.FunctionComponent,U=B.IndeterminateComponent,q=B.ForwardRef,V=B.HostRoot,de=B.HostHoistable,We=B.HostSingleton,gt=B.HostComponent,je=B.HostPortal,Dt=B.HostText,Wt=B.Fragment,cr=B.LazyComponent,ot=B.LegacyHiddenComponent,or=B.MemoComponent,Cr=B.OffscreenComponent,rr=B.Profiler,wr=B.ScopeComponent,Br=B.SimpleMemoComponent,Dn=B.SuspenseComponent,Ot=B.SuspenseListComponent,Rn=B.TracingMarkerComponent;function an(bt){var Dr=d(bt);switch(Dr){case lg:case ug:return an(bt.type);case Cc:case Bc:return bt.render;default:return bt}}function Vr(bt){var Dr=bt.elementType,bn=bt.type,io=bt.tag,qe=bn;Wn(bn)==="object"&&bn!==null&&(qe=an(bn));var pt=null;switch(io){case S:return"Cache";case N:case _:return ta(qe);case O:case U:return ta(qe);case q:return cc(Dr,qe,"ForwardRef","Anonymous");case V:var Ct=bt.stateNode;return Ct!=null&&Ct._debugRootType!==null?Ct._debugRootType:null;case gt:case We:case de:return bn;case je:case Dt:return null;case Wt:return"Fragment";case cr:return"Lazy";case or:case Br:return cc(Dr,qe,"Memo","Anonymous");case Dn:return"Suspense";case ot:return"LegacyHidden";case Cr:return"Offscreen";case wr:return"Scope";case Ot:return"SuspenseList";case rr:return"Profiler";case Rn:return"TracingMarker";default:var Lr=d(bn);switch(Lr){case oa:case ia:case xA:return null;case Xa:case Za:return pt=bt.type._context||bt.type.context,"".concat(pt.displayName||"Context",".Provider");case Ic:case _n:case hc:return pt=bt.type._context||bt.type,"".concat(pt.displayName||"Context",".Consumer");case Ml:case Pl:return null;case za:case Dc:return"Profiler(".concat(bt.memoizedProps.id,")");case cg:case yc:return"Scope";default:return null}}}return{getDisplayNameForFiber:Vr,getTypeSymbol:d,ReactPriorityLevels:f,ReactTypeOfWork:h,StrictModeBits:g}}var ro=new Map,xr=new Map;function cm(A,f,g,h){var d=g.reconcilerVersion||g.version,B=Po(d),S=B.getDisplayNameForFiber,N=B.getTypeSymbol,_=B.ReactPriorityLevels,O=B.ReactTypeOfWork,U=B.StrictModeBits,q=O.CacheComponent,V=O.ClassComponent,de=O.ContextConsumer,We=O.DehydratedSuspenseComponent,gt=O.ForwardRef,je=O.Fragment,Dt=O.FunctionComponent,Wt=O.HostRoot,cr=O.HostHoistable,ot=O.HostSingleton,or=O.HostPortal,Cr=O.HostComponent,rr=O.HostText,wr=O.IncompleteClassComponent,Br=O.IndeterminateComponent,Dn=O.LegacyHiddenComponent,Ot=O.MemoComponent,Rn=O.OffscreenComponent,an=O.SimpleMemoComponent,Vr=O.SuspenseComponent,bt=O.SuspenseListComponent,Dr=O.TracingMarkerComponent,bn=_.ImmediatePriority,io=_.UserBlockingPriority,qe=_.NormalPriority,pt=_.LowPriority,Ct=_.IdlePriority,Lr=_.NoPriority,gn=g.getLaneLabelMap,$r=g.injectProfilingHooks,dn=g.overrideHookState,On=g.overrideHookStateDeletePath,pa=g.overrideHookStateRenamePath,gi=g.overrideProps,xs=g.overridePropsDeletePath,Ts=g.overridePropsRenamePath,As=g.scheduleRefresh,ls=g.setErrorHandler,sA=g.setSuspenseHandler,Os=g.scheduleUpdate,Zc=typeof ls=="function"&&typeof Os=="function",ef=typeof sA=="function"&&typeof Os=="function";typeof As=="function"&&(g.scheduleRefresh=function(){try{A.emit("fastRefreshScheduled")}finally{return As.apply(void 0,arguments)}});var tt=null,It=null;if(typeof $r=="function"){var Jt=Hn({getDisplayNameForFiber:S,getIsProfiling:function(){return Ni},getLaneLabelMap:gn,currentDispatcherRef:g.currentDispatcherRef,workTagMap:O,reactVersion:d});$r(Jt.profilingHooks),tt=Jt.getTimelineData,It=Jt.toggleProfilingStatus}var nr=new Set,An=new Map,Mr=new Map,jn=new Map,po=new Map;function Ln(){var w=Aa(jn.keys()),b;try{for(w.s();!(b=w.n()).done;){var L=b.value,M=xr.get(L);M!=null&&(nr.add(M),Qe(L))}}catch(wt){w.e(wt)}finally{w.f()}var re=Aa(po.keys()),he;try{for(re.s();!(he=re.n()).done;){var Le=he.value,Bt=xr.get(Le);Bt!=null&&(nr.add(Bt),Qe(Le))}}catch(wt){re.e(wt)}finally{re.f()}jn.clear(),po.clear(),XA()}function di(w,b,L){var M=xr.get(w);M!=null&&(An.delete(M),L.has(w)?(L.delete(w),nr.add(M),XA(),Qe(w)):nr.delete(M))}function ma(w){di(w,An,jn)}function aA(w){di(w,Mr,po)}function Qe(w){So!==null&&So.id===w&&(sf=!0)}function Re(w,b,L){if(b==="error"){var M=Fi(w);if(M!=null&&cs.get(M)===!0)return}var re=Rs.apply(void 0,Jl(L));P&&ke("onErrorOrWarning",w,null,"".concat(b,': "').concat(re,'"')),nr.add(w);var he=b==="error"?An:Mr,Le=he.get(w);if(Le!=null){var Bt=Le.get(re)||0;Le.set(re,Bt+1)}else he.set(w,new Map([[re,1]]));Dw()}Sn(g,Re),Zl();var ke=function(b,L,M){var re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";if(P){var he=L.tag+":"+(S(L)||"null"),Le=Fi(L)||"",Bt=M?M.tag+":"+(S(M)||"null"):"",wt=M?Fi(M)||"":"";console.groupCollapsed("[renderer] %c".concat(b," %c").concat(he," (").concat(Le,") %c").concat(M?"".concat(Bt," (").concat(wt,")"):""," %c").concat(re),"color: red; font-weight: bold;","color: blue;","color: purple;","color: black;"),console.log(new Error().stack.split(` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,S=!1,N;return{s:function(){g=A[Symbol.iterator]()},n:function(){var O=g.next();return B=O.done,O},e:function(O){S=!0,N=O},f:function(){try{!B&&g.return!=null&&g.return()}finally{if(S)throw N}}}}function En(A,f){if(A){if(typeof A=="string")return wo(A,f);var g=Object.prototype.toString.call(A).slice(8,-1);if(g==="Object"&&A.constructor&&(g=A.constructor.name),g==="Map"||g==="Set")return Array.from(A);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return wo(A,f)}}function wo(A,f){(f==null||f>A.length)&&(f=A.length);for(var g=0,h=new Array(f);g"u"?"undefined":Wn(performance))==="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()};function Po(A){var f={ImmediatePriority:99,UserBlockingPriority:98,NormalPriority:97,LowPriority:96,IdlePriority:95,NoPriority:90};fn(A,"17.0.2")&&(f={ImmediatePriority:1,UserBlockingPriority:2,NormalPriority:3,LowPriority:4,IdlePriority:5,NoPriority:0});var g=0;Nr(A,"18.0.0-alpha")?g=24:Nr(A,"16.9.0")?g=1:Nr(A,"16.3.0")&&(g=2);var h=null;fn(A,"17.0.1")?h={CacheComponent:24,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:26,HostSingleton:27,HostText:6,IncompleteClassComponent:17,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:23,MemoComponent:14,Mode:8,OffscreenComponent:22,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,TracingMarkerComponent:25,YieldComponent:-1}:Nr(A,"17.0.0-alpha")?h={CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:-1,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:24,MemoComponent:14,Mode:8,OffscreenComponent:23,Profiler:12,ScopeComponent:21,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,TracingMarkerComponent:-1,YieldComponent:-1}:Nr(A,"16.6.0-beta.0")?h={CacheComponent:-1,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:-1,HostSingleton:-1,HostText:6,IncompleteClassComponent:17,IndeterminateComponent:2,LazyComponent:16,LegacyHiddenComponent:-1,MemoComponent:14,Mode:8,OffscreenComponent:-1,Profiler:12,ScopeComponent:-1,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,TracingMarkerComponent:-1,YieldComponent:-1}:Nr(A,"16.4.3-alpha")?h={CacheComponent:-1,ClassComponent:2,ContextConsumer:11,ContextProvider:12,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:-1,ForwardRef:13,Fragment:9,FunctionComponent:0,HostComponent:7,HostPortal:6,HostRoot:5,HostHoistable:-1,HostSingleton:-1,HostText:8,IncompleteClassComponent:-1,IndeterminateComponent:4,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:10,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,TracingMarkerComponent:-1,YieldComponent:-1}:h={CacheComponent:-1,ClassComponent:2,ContextConsumer:12,ContextProvider:13,CoroutineComponent:7,CoroutineHandlerPhase:8,DehydratedSuspenseComponent:-1,ForwardRef:14,Fragment:10,FunctionComponent:1,HostComponent:5,HostPortal:4,HostRoot:3,HostHoistable:-1,HostSingleton:-1,HostText:6,IncompleteClassComponent:-1,IndeterminateComponent:0,LazyComponent:-1,LegacyHiddenComponent:-1,MemoComponent:-1,Mode:11,OffscreenComponent:-1,Profiler:15,ScopeComponent:-1,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,TracingMarkerComponent:-1,YieldComponent:9};function d(bt){var Dr=Wn(bt)==="object"&&bt!==null?bt.$$typeof:bt;return Wn(Dr)==="symbol"?Dr.toString():Dr}var B=h,S=B.CacheComponent,N=B.ClassComponent,_=B.IncompleteClassComponent,O=B.FunctionComponent,U=B.IndeterminateComponent,q=B.ForwardRef,V=B.HostRoot,de=B.HostHoistable,We=B.HostSingleton,gt=B.HostComponent,je=B.HostPortal,Dt=B.HostText,Wt=B.Fragment,fr=B.LazyComponent,ot=B.LegacyHiddenComponent,or=B.MemoComponent,Cr=B.OffscreenComponent,rr=B.Profiler,wr=B.ScopeComponent,Br=B.SimpleMemoComponent,Dn=B.SuspenseComponent,Ot=B.SuspenseListComponent,Rn=B.TracingMarkerComponent;function an(bt){var Dr=d(bt);switch(Dr){case lg:case ug:return an(bt.type);case Cc:case Bc:return bt.render;default:return bt}}function Vr(bt){var Dr=bt.elementType,bn=bt.type,io=bt.tag,qe=bn;Wn(bn)==="object"&&bn!==null&&(qe=an(bn));var pt=null;switch(io){case S:return"Cache";case N:case _:return ta(qe);case O:case U:return ta(qe);case q:return cc(Dr,qe,"ForwardRef","Anonymous");case V:var Ct=bt.stateNode;return Ct!=null&&Ct._debugRootType!==null?Ct._debugRootType:null;case gt:case We:case de:return bn;case je:case Dt:return null;case Wt:return"Fragment";case fr:return"Lazy";case or:case Br:return cc(Dr,qe,"Memo","Anonymous");case Dn:return"Suspense";case ot:return"LegacyHidden";case Cr:return"Offscreen";case wr:return"Scope";case Ot:return"SuspenseList";case rr:return"Profiler";case Rn:return"TracingMarker";default:var Lr=d(bn);switch(Lr){case oa:case ia:case xA:return null;case Xa:case Za:return pt=bt.type._context||bt.type.context,"".concat(pt.displayName||"Context",".Provider");case Ic:case _n:case hc:return pt=bt.type._context||bt.type,"".concat(pt.displayName||"Context",".Consumer");case Ml:case Pl:return null;case za:case Dc:return"Profiler(".concat(bt.memoizedProps.id,")");case cg:case yc:return"Scope";default:return null}}}return{getDisplayNameForFiber:Vr,getTypeSymbol:d,ReactPriorityLevels:f,ReactTypeOfWork:h,StrictModeBits:g}}var ro=new Map,xr=new Map;function cm(A,f,g,h){var d=g.reconcilerVersion||g.version,B=Po(d),S=B.getDisplayNameForFiber,N=B.getTypeSymbol,_=B.ReactPriorityLevels,O=B.ReactTypeOfWork,U=B.StrictModeBits,q=O.CacheComponent,V=O.ClassComponent,de=O.ContextConsumer,We=O.DehydratedSuspenseComponent,gt=O.ForwardRef,je=O.Fragment,Dt=O.FunctionComponent,Wt=O.HostRoot,fr=O.HostHoistable,ot=O.HostSingleton,or=O.HostPortal,Cr=O.HostComponent,rr=O.HostText,wr=O.IncompleteClassComponent,Br=O.IndeterminateComponent,Dn=O.LegacyHiddenComponent,Ot=O.MemoComponent,Rn=O.OffscreenComponent,an=O.SimpleMemoComponent,Vr=O.SuspenseComponent,bt=O.SuspenseListComponent,Dr=O.TracingMarkerComponent,bn=_.ImmediatePriority,io=_.UserBlockingPriority,qe=_.NormalPriority,pt=_.LowPriority,Ct=_.IdlePriority,Lr=_.NoPriority,gn=g.getLaneLabelMap,$r=g.injectProfilingHooks,dn=g.overrideHookState,On=g.overrideHookStateDeletePath,pa=g.overrideHookStateRenamePath,gi=g.overrideProps,xs=g.overridePropsDeletePath,Ts=g.overridePropsRenamePath,As=g.scheduleRefresh,ls=g.setErrorHandler,sA=g.setSuspenseHandler,Os=g.scheduleUpdate,Zc=typeof ls=="function"&&typeof Os=="function",ef=typeof sA=="function"&&typeof Os=="function";typeof As=="function"&&(g.scheduleRefresh=function(){try{A.emit("fastRefreshScheduled")}finally{return As.apply(void 0,arguments)}});var tt=null,It=null;if(typeof $r=="function"){var Jt=Hn({getDisplayNameForFiber:S,getIsProfiling:function(){return Ni},getLaneLabelMap:gn,currentDispatcherRef:g.currentDispatcherRef,workTagMap:O,reactVersion:d});$r(Jt.profilingHooks),tt=Jt.getTimelineData,It=Jt.toggleProfilingStatus}var nr=new Set,An=new Map,Mr=new Map,jn=new Map,po=new Map;function Ln(){var w=Aa(jn.keys()),b;try{for(w.s();!(b=w.n()).done;){var L=b.value,M=xr.get(L);M!=null&&(nr.add(M),Qe(L))}}catch(wt){w.e(wt)}finally{w.f()}var re=Aa(po.keys()),he;try{for(re.s();!(he=re.n()).done;){var Le=he.value,Bt=xr.get(Le);Bt!=null&&(nr.add(Bt),Qe(Le))}}catch(wt){re.e(wt)}finally{re.f()}jn.clear(),po.clear(),XA()}function di(w,b,L){var M=xr.get(w);M!=null&&(An.delete(M),L.has(w)?(L.delete(w),nr.add(M),XA(),Qe(w)):nr.delete(M))}function ma(w){di(w,An,jn)}function aA(w){di(w,Mr,po)}function Qe(w){So!==null&&So.id===w&&(sf=!0)}function Re(w,b,L){if(b==="error"){var M=Fi(w);if(M!=null&&cs.get(M)===!0)return}var re=Rs.apply(void 0,Jl(L));P&&ke("onErrorOrWarning",w,null,"".concat(b,': "').concat(re,'"')),nr.add(w);var he=b==="error"?An:Mr,Le=he.get(w);if(Le!=null){var Bt=Le.get(re)||0;Le.set(re,Bt+1)}else he.set(w,new Map([[re,1]]));Dw()}Sn(g,Re),Zl();var ke=function(b,L,M){var re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";if(P){var he=L.tag+":"+(S(L)||"null"),Le=Fi(L)||"",Bt=M?M.tag+":"+(S(M)||"null"):"",wt=M?Fi(M)||"":"";console.groupCollapsed("[renderer] %c".concat(b," %c").concat(he," (").concat(Le,") %c").concat(M?"".concat(Bt," (").concat(wt,")"):""," %c").concat(re),"color: red; font-weight: bold;","color: blue;","color: purple;","color: black;"),console.log(new Error().stack.split(` `).slice(1).join(` -`)),console.groupEnd()}},Ue=new Set,dt=new Set,jt=new Set,Yt=!1,mr=new Set;function Fn(w){jt.clear(),Ue.clear(),dt.clear(),w.forEach(function(b){if(b.isEnabled)switch(b.type){case Wp:b.isValid&&b.value!==""&&Ue.add(new RegExp(b.value,"i"));break;case oi:jt.add(b.value);break;case jp:b.isValid&&b.value!==""&&dt.add(new RegExp(b.value,"i"));break;case ii:Ue.add(new RegExp("\\("));break;default:console.warn('Invalid component filter type "'.concat(b.type,'"'));break}})}window.__REACT_DEVTOOLS_COMPONENT_FILTERS__!=null?Fn(window.__REACT_DEVTOOLS_COMPONENT_FILTERS__):Fn(bl());function so(w){if(Ni)throw Error("Cannot modify filter preferences while profiling");A.getFiberRoots(f).forEach(function(b){kn=Ls(b.current),yr(Ee),XA(b),kn=-1}),Fn(w),Iu.clear(),A.getFiberRoots(f).forEach(function(b){kn=Ls(b.current),Zg(kn,b.current),us(b.current,null,!1,!1),XA(b),kn=-1}),yw(),XA()}function Si(w){var b=w._debugSource,L=w.tag,M=w.type,re=w.key;switch(L){case We:return!0;case or:case rr:case Dn:case Rn:return!0;case Wt:return!1;case je:return re===null;default:var he=N(M);switch(he){case oa:case ia:case xA:case Ml:case Pl:return!0;default:break}}var Le=Mn(w);if(jt.has(Le))return!0;if(Ue.size>0){var Bt=S(w);if(Bt!=null){var wt=Aa(Ue),ht;try{for(wt.s();!(ht=wt.n()).done;){var vt=ht.value;if(vt.test(Bt))return!0}}catch(Go){wt.e(Go)}finally{wt.f()}}}if(b!=null&&dt.size>0){var zt=b.fileName,Pn=Aa(dt),jr;try{for(Pn.s();!(jr=Pn.n()).done;){var mo=jr.value;if(mo.test(zt))return!0}}catch(Go){Pn.e(Go)}finally{Pn.f()}}return!1}function Mn(w){var b=w.type,L=w.tag;switch(L){case V:case wr:return Gt;case Dt:case Br:return ni;case gt:return ea;case Wt:return Ql;case Cr:case cr:case ot:return yA;case or:case rr:case je:return Ir;case Ot:case an:return Ha;case Vr:return lc;case bt:return Hp;case Dr:return wl;default:var M=N(b);switch(M){case oa:case ia:case xA:return Ir;case Xa:case Za:return yl;case Ic:case _n:return yl;case Ml:case Pl:return Ir;case za:case Dc:return Ac;default:return Ir}}}var Ri=new Map,qA=new Map,kn=-1;function Ls(w){var b=null;if(ro.has(w))b=ro.get(w);else{var L=w.alternate;L!==null&&ro.has(L)&&(b=ro.get(L))}var M=!1;b===null&&(M=!0,b=uo());var re=b;ro.has(w)||(ro.set(w,re),xr.set(re,w));var he=w.alternate;return he!==null&&(ro.has(he)||ro.set(he,re)),P&&M&&ke("getOrGenerateFiberID()",w,w.return,"Generated a new UID"),re}function bi(w){var b=Fi(w);if(b!==null)return b;throw Error('Could not find ID for Fiber "'.concat(S(w)||"",'"'))}function Fi(w){if(ro.has(w))return ro.get(w);var b=w.alternate;return b!==null&&ro.has(b)?ro.get(b):null}function mw(w){P&&ke("untrackFiberID()",w,w.return,"schedule after delay"),tf.add(w);var b=w.alternate;b!==null&&tf.add(b),rf===null&&(rf=setTimeout(yh,1e3))}var tf=new Set,rf=null;function yh(){rf!==null&&(clearTimeout(rf),rf=null),tf.forEach(function(w){var b=Fi(w);b!==null&&(xr.delete(b),ma(b),aA(b)),ro.delete(w);var L=w.alternate;L!==null&&ro.delete(L),cs.has(b)&&(cs.delete(b),cs.size===0&&ls!=null&&ls(Wh))}),tf.clear()}function Ew(w,b){switch(Mn(b)){case Gt:case ni:case Ha:case ea:if(w===null)return{context:null,didHooksChange:!1,isFirstMount:!0,props:null,state:null};var L={context:Iw(b),didHooksChange:!1,isFirstMount:!1,props:hm(w.memoizedProps,b.memoizedProps),state:hm(w.memoizedState,b.memoizedState)},M=Bw(w.memoizedState,b.memoizedState);return L.hooks=M,L.didHooksChange=M!==null&&M.length>0,L;default:return null}}function Qh(w){switch(Mn(w)){case Gt:case ea:case ni:case Ha:if(mu!==null){var b=bi(w),L=wh(w);L!==null&&mu.set(b,L)}break;default:break}}var fu={};function wh(w){var b=fu,L=fu;switch(Mn(w)){case Gt:var M=w.stateNode;return M!=null&&(M.constructor&&M.constructor.contextType!=null?L=M.context:(b=M.context,b&&Object.keys(b).length===0&&(b=fu))),[b,L];case ea:case ni:case Ha:var re=w.dependencies;return re&&re.firstContext&&(L=re.firstContext),[b,L];default:return null}}function vh(w){var b=Fi(w);if(b!==null){Qh(w);for(var L=w.child;L!==null;)vh(L),L=L.sibling}}function Iw(w){if(mu!==null){var b=bi(w),L=mu.has(b)?mu.get(b):null,M=wh(w);if(L==null||M==null)return null;var re=_g(L,2),he=re[0],Le=re[1],Bt=_g(M,2),wt=Bt[0],ht=Bt[1];switch(Mn(w)){case Gt:if(L&&M){if(wt!==fu)return hm(he,wt);if(ht!==fu)return Le!==ht}break;case ea:case ni:case Ha:if(ht!==fu){for(var vt=Le,zt=ht;vt&&zt;){if(!pg(vt.memoizedValue,zt.memoizedValue))return!0;vt=vt.next,zt=zt.next}return!1}break;default:break}}return null}function hw(w){var b=w.queue;if(!b)return!1;var L=Ul.bind(b);return L("pending")?!0:L("value")&&L("getSnapshot")&&typeof b.getSnapshot=="function"}function Cw(w,b){var L=w.memoizedState,M=b.memoizedState;return hw(w)?L!==M:!1}function Bw(w,b){if(w==null||b==null)return null;var L=[],M=0;if(b.hasOwnProperty("baseState")&&b.hasOwnProperty("memoizedState")&&b.hasOwnProperty("next")&&b.hasOwnProperty("queue"))for(;b!==null;)Cw(w,b)&&L.push(M),b=b.next,w=w.next,M++;return L}function hm(w,b){if(w==null||b==null||b.hasOwnProperty("baseState")&&b.hasOwnProperty("memoizedState")&&b.hasOwnProperty("next")&&b.hasOwnProperty("queue"))return null;var L=new Set([].concat(Jl(Object.keys(w)),Jl(Object.keys(b)))),M=[],re=Aa(L),he;try{for(re.s();!(he=re.n()).done;){var Le=he.value;w[Le]!==b[Le]&&M.push(Le)}}catch(Bt){re.e(Bt)}finally{re.f()}return M}function Cm(w,b){switch(b.tag){case V:case Dt:case de:case Ot:case an:case gt:var L=1;return(jc(b)&L)===L;default:return w.memoizedProps!==b.memoizedProps||w.memoizedState!==b.memoizedState||w.ref!==b.ref}}var ki=[],gu=[],zA=[],Yg=[],nf=new Map,Vg=0,du=null;function yr(w){ki.push(w)}function $g(){return Ni&&Ms!=null&&Ms.durations.length>0?!1:ki.length===0&&gu.length===0&&zA.length===0&&du===null}function _h(w){$g()||(Yg!==null?Yg.push(w):A.emit("operations",w))}var of=null;function Sh(){of!==null&&(clearTimeout(of),of=null)}function Dw(){Sh(),of=setTimeout(function(){if(of=null,!(ki.length>0)&&(Bm(),!$g())){var w=new Array(3+ki.length);w[0]=f,w[1]=kn,w[2]=0;for(var b=0;b0?2+b:0)+ki.length),M=0;if(L[M++]=f,L[M++]=kn,L[M++]=Vg,nf.forEach(function(Bt,wt){var ht=Bt.encodedString,vt=ht.length;L[M++]=vt;for(var zt=0;zt0){L[M++]=W,L[M++]=b;for(var re=gu.length-1;re>=0;re--)L[M++]=gu[re];for(var he=0;he0?w.forEach(function(b){A.emit("operations",b)}):(AA!==null&&(lA=!0),A.getFiberRoots(f).forEach(function(b){kn=Ls(b.current),Zg(kn,b.current),Ni&&Qm(b)&&(Ms={changeDescriptions:lf?new Map:null,durations:[],commitTime:Yl()-_m,maxActualDuration:0,priorityLevel:null,updaters:xh(b),effectDuration:null,passiveEffectDuration:null}),us(b.current,null,!1,!1),XA(b),kn=-1}))}function xh(w){return w.memoizedUpdaters!=null?Array.from(w.memoizedUpdaters).filter(function(b){return Fi(b)!==null}).map(qg):null}function Sw(w){tf.has(w)||Dm(w,!1)}function Rw(w){if(Ni&&Qm(w)&&Ms!==null){var b=mc(w),L=b.effectDuration,M=b.passiveEffectDuration;Ms.effectDuration=L,Ms.passiveEffectDuration=M}}function bw(w,b){var L=w.current,M=L.alternate;yh(),kn=Ls(L),AA!==null&&(lA=!0),Yt&&mr.clear();var re=Qm(w);if(Ni&&re&&(Ms={changeDescriptions:lf?new Map:null,durations:[],commitTime:Yl()-_m,maxActualDuration:0,priorityLevel:b==null?null:sv(b),updaters:xh(w),effectDuration:null,passiveEffectDuration:null}),M){var he=M.memoizedState!=null&&M.memoizedState.element!=null&&M.memoizedState.isDehydrated!==!0,Le=L.memoizedState!=null&&L.memoizedState.element!=null&&L.memoizedState.isDehydrated!==!0;!he&&Le?(Zg(kn,L),us(L,null,!1,!1)):he&&Le?ym(L,M,null,!1):he&&!Le&&(nv(kn),Dm(L,!1))}else Zg(kn,L),us(L,null,!1,!1);if(Ni&&re&&!$g()){var Bt=uf.get(kn);Bt!=null?Bt.push(Ms):uf.set(kn,[Ms])}XA(w),Yt&&A.emit("traceUpdates",mr),kn=-1}function Th(w){var b=[],L=Ea(w);if(!L)return b;for(var M=L;;){if(M.tag===Cr||M.tag===rr)b.push(M);else if(M.child){M.child.return=M,M=M.child;continue}if(M===L)return b;for(;!M.sibling;){if(!M.return||M.return===L)return b;M=M.return}M.sibling.return=M.return,M=M.sibling}return b}function Oh(w){try{var b=Ea(w);if(b===null)return null;var L=Th(w);return L.map(function(M){return M.stateNode}).filter(Boolean)}catch{return null}}function Fw(w){var b=xr.get(w);return b!=null?S(b):null}function kw(w){return g.findFiberByHostInstance(w)}function Nw(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,L=g.findFiberByHostInstance(w);if(L!=null){if(b)for(;L!==null&&Si(L);)L=L.return;return bi(L)}return null}function Lh(w){if(Mh(w)!==w)throw new Error("Unable to find node on an unmounted component.")}function Mh(w){var b=w,L=w;if(w.alternate)for(;b.return;)b=b.return;else{var M=b;do{b=M;var re=2,he=4096;(b.flags&(re|he))!==0&&(L=b.return),M=b.return}while(M)}return b.tag===Wt?L:null}function Ea(w){var b=xr.get(w);if(b==null)return console.warn('Could not find Fiber with id "'.concat(w,'"')),null;var L=b.alternate;if(!L){var M=Mh(b);if(M===null)throw new Error("Unable to find node on an unmounted component.");return M!==b?null:b}for(var re=b,he=L;;){var Le=re.return;if(Le===null)break;var Bt=Le.alternate;if(Bt===null){var wt=Le.return;if(wt!==null){re=he=wt;continue}break}if(Le.child===Bt.child){for(var ht=Le.child;ht;){if(ht===re)return Lh(Le),b;if(ht===he)return Lh(Le),L;ht=ht.sibling}throw new Error("Unable to find node on an unmounted component.")}if(re.return!==he.return)re=Le,he=Bt;else{for(var vt=!1,zt=Le.child;zt;){if(zt===re){vt=!0,re=Le,he=Bt;break}if(zt===he){vt=!0,he=Le,re=Bt;break}zt=zt.sibling}if(!vt){for(zt=Bt.child;zt;){if(zt===re){vt=!0,re=Bt,he=Le;break}if(zt===he){vt=!0,he=Bt,re=Le;break}zt=zt.sibling}if(!vt)throw new Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(re.alternate!==he)throw new Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(re.tag!==Wt)throw new Error("Unable to find node on an unmounted component.");return re.stateNode.current===re?b:L}function xw(w,b){af(w)&&(window.$attribute=Ai(So,b))}function Tw(w){var b=xr.get(w);if(b==null){console.warn('Could not find Fiber with id "'.concat(w,'"'));return}var L=b.elementType,M=b.tag,re=b.type;switch(M){case V:case wr:case Br:case Dt:h.$type=re;break;case gt:h.$type=re.render;break;case Ot:case an:h.$type=L!=null&&L.type!=null?L.type:re;break;default:h.$type=null;break}}function qg(w){return{displayName:S(w)||"Anonymous",id:bi(w),key:w.key,type:Mn(w)}}function Ow(w){var b=Ea(w);if(b==null)return null;var L=b._debugOwner,M=[qg(b)];if(L)for(var re=L;re!==null;)M.unshift(qg(re)),re=re._debugOwner||null;return M}function Lw(w){var b=null,L=null,M=Ea(w);return M!==null&&(b=M.stateNode,M.memoizedProps!==null&&(L=M.memoizedProps.style)),{instance:b,style:L}}function Ph(w){var b=w.tag,L=w.type;switch(b){case V:case wr:var M=w.stateNode;return typeof L.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function";default:return!1}}function Uh(w){for(var b=w.return;b!==null;){if(Ph(b))return Fi(b);b=b.return}return null}function Gh(w){var b=Ea(w);if(b==null)return null;var L=b._debugOwner,M=b._debugSource,re=b.stateNode,he=b.key,Le=b.memoizedProps,Bt=b.memoizedState,wt=b.dependencies,ht=b.tag,vt=b.type,zt=Mn(b),Pn=(ht===Dt||ht===an||ht===gt)&&(!!Bt||!!wt),jr=!Pn&&ht!==q,mo=N(vt),Go=!1,Ro=null;if(ht===V||ht===Dt||ht===wr||ht===Br||ht===Ot||ht===gt||ht===an){if(Go=!0,re&&re.context!=null){var hu=zt===Gt&&!(vt.contextTypes||vt.contextType);hu||(Ro=re.context)}}else if(mo===Ic||mo===_n){var xi=vt._context||vt;Ro=xi._currentValue||null;for(var pi=b.return;pi!==null;){var uA=pi.type,Cu=N(uA);if(Cu===Xa||Cu===Za){var ff=uA._context||uA.context;if(ff===xi){Ro=pi.memoizedProps.value;break}}pi=pi.return}}var ha=!1;Ro!==null&&(ha=!!vt.contextTypes,Ro={value:Ro});var Ca=null;if(L){Ca=[];for(var Ti=L;Ti!==null;)Ca.push(qg(Ti)),Ti=Ti._debugOwner||null}var ed=ht===Vr&&Bt!==null,Jh=null;if(Pn){var Rm={};for(var bm in console)try{Rm[bm]=console[bm],console[bm]=function(){}}catch{}try{Jh=(0,Ol.inspectHooksOfFiber)(b,g.currentDispatcherRef,!0)}finally{for(var Yh in Rm)try{console[Yh]=Rm[Yh]}catch{}}}for(var Vh=null,td=b;td.return!==null;)td=td.return;var Fm=td.stateNode;Fm!=null&&Fm._debugRootType!==null&&(Vh=Fm._debugRootType);var lv=jn.get(w)||new Map,uv=po.get(w)||new Map,km=!1,rd;if(Ph(b)){var cv=128;km=(b.flags&cv)!==0||cs.get(w)===!0,rd=km?w:Uh(b)}else rd=Uh(b);var $h={stylex:null};return gg&&Le!=null&&Le.hasOwnProperty("xstyle")&&($h.stylex=om(Le.xstyle)),{id:w,canEditHooks:typeof dn=="function",canEditFunctionProps:typeof gi=="function",canEditHooksAndDeletePaths:typeof On=="function",canEditHooksAndRenamePaths:typeof pa=="function",canEditFunctionPropsDeletePaths:typeof xs=="function",canEditFunctionPropsRenamePaths:typeof Ts=="function",canToggleError:Zc&&rd!=null,isErrored:km,targetErrorBoundaryID:rd,canToggleSuspense:ef&&(!ed||Eu.has(w)),canViewSource:Go,hasLegacyContext:ha,key:he??null,displayName:S(b),type:zt,context:Ro,hooks:Jh,props:Le,state:jr?Bt:null,errors:Array.from(lv.entries()),warnings:Array.from(uv.entries()),owners:Ca,source:M||null,rootType:Vh,rendererPackageName:g.rendererPackageName,rendererVersion:g.version,plugins:$h}}var So=null,sf=!1,zg={};function af(w){return So!==null&&So.id===w}function Mw(w){return af(w)&&!sf}function Pw(w){var b=zg;w.forEach(function(L){b[L]||(b[L]={}),b=b[L]})}function Af(w,b){return function(M){switch(b){case"hooks":if(M.length===1||M[M.length-2]==="hookSource"&&M[M.length-1]==="fileName"||M[M.length-1]==="subHooks"||M[M.length-2]==="subHooks")return!0;break;default:break}var re=w===null?zg:zg[w];if(!re)return!1;for(var he=0;he0){var Bt=S(w);if(Bt!=null){var wt=Aa(Ue),ht;try{for(wt.s();!(ht=wt.n()).done;){var vt=ht.value;if(vt.test(Bt))return!0}}catch(Go){wt.e(Go)}finally{wt.f()}}}if(b!=null&&dt.size>0){var zt=b.fileName,Pn=Aa(dt),jr;try{for(Pn.s();!(jr=Pn.n()).done;){var mo=jr.value;if(mo.test(zt))return!0}}catch(Go){Pn.e(Go)}finally{Pn.f()}}return!1}function Mn(w){var b=w.type,L=w.tag;switch(L){case V:case wr:return Gt;case Dt:case Br:return ni;case gt:return ea;case Wt:return Ql;case Cr:case fr:case ot:return yA;case or:case rr:case je:return Ir;case Ot:case an:return Ha;case Vr:return lc;case bt:return Hp;case Dr:return wl;default:var M=N(b);switch(M){case oa:case ia:case xA:return Ir;case Xa:case Za:return yl;case Ic:case _n:return yl;case Ml:case Pl:return Ir;case za:case Dc:return Ac;default:return Ir}}}var Ri=new Map,qA=new Map,kn=-1;function Ls(w){var b=null;if(ro.has(w))b=ro.get(w);else{var L=w.alternate;L!==null&&ro.has(L)&&(b=ro.get(L))}var M=!1;b===null&&(M=!0,b=uo());var re=b;ro.has(w)||(ro.set(w,re),xr.set(re,w));var he=w.alternate;return he!==null&&(ro.has(he)||ro.set(he,re)),P&&M&&ke("getOrGenerateFiberID()",w,w.return,"Generated a new UID"),re}function bi(w){var b=Fi(w);if(b!==null)return b;throw Error('Could not find ID for Fiber "'.concat(S(w)||"",'"'))}function Fi(w){if(ro.has(w))return ro.get(w);var b=w.alternate;return b!==null&&ro.has(b)?ro.get(b):null}function mw(w){P&&ke("untrackFiberID()",w,w.return,"schedule after delay"),tf.add(w);var b=w.alternate;b!==null&&tf.add(b),rf===null&&(rf=setTimeout(yh,1e3))}var tf=new Set,rf=null;function yh(){rf!==null&&(clearTimeout(rf),rf=null),tf.forEach(function(w){var b=Fi(w);b!==null&&(xr.delete(b),ma(b),aA(b)),ro.delete(w);var L=w.alternate;L!==null&&ro.delete(L),cs.has(b)&&(cs.delete(b),cs.size===0&&ls!=null&&ls(Wh))}),tf.clear()}function Ew(w,b){switch(Mn(b)){case Gt:case ni:case Ha:case ea:if(w===null)return{context:null,didHooksChange:!1,isFirstMount:!0,props:null,state:null};var L={context:Iw(b),didHooksChange:!1,isFirstMount:!1,props:hm(w.memoizedProps,b.memoizedProps),state:hm(w.memoizedState,b.memoizedState)},M=Bw(w.memoizedState,b.memoizedState);return L.hooks=M,L.didHooksChange=M!==null&&M.length>0,L;default:return null}}function Qh(w){switch(Mn(w)){case Gt:case ea:case ni:case Ha:if(mu!==null){var b=bi(w),L=wh(w);L!==null&&mu.set(b,L)}break;default:break}}var fu={};function wh(w){var b=fu,L=fu;switch(Mn(w)){case Gt:var M=w.stateNode;return M!=null&&(M.constructor&&M.constructor.contextType!=null?L=M.context:(b=M.context,b&&Object.keys(b).length===0&&(b=fu))),[b,L];case ea:case ni:case Ha:var re=w.dependencies;return re&&re.firstContext&&(L=re.firstContext),[b,L];default:return null}}function vh(w){var b=Fi(w);if(b!==null){Qh(w);for(var L=w.child;L!==null;)vh(L),L=L.sibling}}function Iw(w){if(mu!==null){var b=bi(w),L=mu.has(b)?mu.get(b):null,M=wh(w);if(L==null||M==null)return null;var re=_g(L,2),he=re[0],Le=re[1],Bt=_g(M,2),wt=Bt[0],ht=Bt[1];switch(Mn(w)){case Gt:if(L&&M){if(wt!==fu)return hm(he,wt);if(ht!==fu)return Le!==ht}break;case ea:case ni:case Ha:if(ht!==fu){for(var vt=Le,zt=ht;vt&&zt;){if(!pg(vt.memoizedValue,zt.memoizedValue))return!0;vt=vt.next,zt=zt.next}return!1}break;default:break}}return null}function hw(w){var b=w.queue;if(!b)return!1;var L=Ul.bind(b);return L("pending")?!0:L("value")&&L("getSnapshot")&&typeof b.getSnapshot=="function"}function Cw(w,b){var L=w.memoizedState,M=b.memoizedState;return hw(w)?L!==M:!1}function Bw(w,b){if(w==null||b==null)return null;var L=[],M=0;if(b.hasOwnProperty("baseState")&&b.hasOwnProperty("memoizedState")&&b.hasOwnProperty("next")&&b.hasOwnProperty("queue"))for(;b!==null;)Cw(w,b)&&L.push(M),b=b.next,w=w.next,M++;return L}function hm(w,b){if(w==null||b==null||b.hasOwnProperty("baseState")&&b.hasOwnProperty("memoizedState")&&b.hasOwnProperty("next")&&b.hasOwnProperty("queue"))return null;var L=new Set([].concat(Jl(Object.keys(w)),Jl(Object.keys(b)))),M=[],re=Aa(L),he;try{for(re.s();!(he=re.n()).done;){var Le=he.value;w[Le]!==b[Le]&&M.push(Le)}}catch(Bt){re.e(Bt)}finally{re.f()}return M}function Cm(w,b){switch(b.tag){case V:case Dt:case de:case Ot:case an:case gt:var L=1;return(jc(b)&L)===L;default:return w.memoizedProps!==b.memoizedProps||w.memoizedState!==b.memoizedState||w.ref!==b.ref}}var ki=[],gu=[],zA=[],Yg=[],nf=new Map,Vg=0,du=null;function yr(w){ki.push(w)}function $g(){return Ni&&Ms!=null&&Ms.durations.length>0?!1:ki.length===0&&gu.length===0&&zA.length===0&&du===null}function _h(w){$g()||(Yg!==null?Yg.push(w):A.emit("operations",w))}var of=null;function Sh(){of!==null&&(clearTimeout(of),of=null)}function Dw(){Sh(),of=setTimeout(function(){if(of=null,!(ki.length>0)&&(Bm(),!$g())){var w=new Array(3+ki.length);w[0]=f,w[1]=kn,w[2]=0;for(var b=0;b0?2+b:0)+ki.length),M=0;if(L[M++]=f,L[M++]=kn,L[M++]=Vg,nf.forEach(function(Bt,wt){var ht=Bt.encodedString,vt=ht.length;L[M++]=vt;for(var zt=0;zt0){L[M++]=W,L[M++]=b;for(var re=gu.length-1;re>=0;re--)L[M++]=gu[re];for(var he=0;he0?w.forEach(function(b){A.emit("operations",b)}):(AA!==null&&(lA=!0),A.getFiberRoots(f).forEach(function(b){kn=Ls(b.current),Zg(kn,b.current),Ni&&Qm(b)&&(Ms={changeDescriptions:lf?new Map:null,durations:[],commitTime:Yl()-_m,maxActualDuration:0,priorityLevel:null,updaters:xh(b),effectDuration:null,passiveEffectDuration:null}),us(b.current,null,!1,!1),XA(b),kn=-1}))}function xh(w){return w.memoizedUpdaters!=null?Array.from(w.memoizedUpdaters).filter(function(b){return Fi(b)!==null}).map(qg):null}function Sw(w){tf.has(w)||Dm(w,!1)}function Rw(w){if(Ni&&Qm(w)&&Ms!==null){var b=mc(w),L=b.effectDuration,M=b.passiveEffectDuration;Ms.effectDuration=L,Ms.passiveEffectDuration=M}}function bw(w,b){var L=w.current,M=L.alternate;yh(),kn=Ls(L),AA!==null&&(lA=!0),Yt&&mr.clear();var re=Qm(w);if(Ni&&re&&(Ms={changeDescriptions:lf?new Map:null,durations:[],commitTime:Yl()-_m,maxActualDuration:0,priorityLevel:b==null?null:sv(b),updaters:xh(w),effectDuration:null,passiveEffectDuration:null}),M){var he=M.memoizedState!=null&&M.memoizedState.element!=null&&M.memoizedState.isDehydrated!==!0,Le=L.memoizedState!=null&&L.memoizedState.element!=null&&L.memoizedState.isDehydrated!==!0;!he&&Le?(Zg(kn,L),us(L,null,!1,!1)):he&&Le?ym(L,M,null,!1):he&&!Le&&(nv(kn),Dm(L,!1))}else Zg(kn,L),us(L,null,!1,!1);if(Ni&&re&&!$g()){var Bt=uf.get(kn);Bt!=null?Bt.push(Ms):uf.set(kn,[Ms])}XA(w),Yt&&A.emit("traceUpdates",mr),kn=-1}function Th(w){var b=[],L=Ea(w);if(!L)return b;for(var M=L;;){if(M.tag===Cr||M.tag===rr)b.push(M);else if(M.child){M.child.return=M,M=M.child;continue}if(M===L)return b;for(;!M.sibling;){if(!M.return||M.return===L)return b;M=M.return}M.sibling.return=M.return,M=M.sibling}return b}function Oh(w){try{var b=Ea(w);if(b===null)return null;var L=Th(w);return L.map(function(M){return M.stateNode}).filter(Boolean)}catch{return null}}function Fw(w){var b=xr.get(w);return b!=null?S(b):null}function kw(w){return g.findFiberByHostInstance(w)}function Nw(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,L=g.findFiberByHostInstance(w);if(L!=null){if(b)for(;L!==null&&Si(L);)L=L.return;return bi(L)}return null}function Lh(w){if(Mh(w)!==w)throw new Error("Unable to find node on an unmounted component.")}function Mh(w){var b=w,L=w;if(w.alternate)for(;b.return;)b=b.return;else{var M=b;do{b=M;var re=2,he=4096;(b.flags&(re|he))!==0&&(L=b.return),M=b.return}while(M)}return b.tag===Wt?L:null}function Ea(w){var b=xr.get(w);if(b==null)return console.warn('Could not find Fiber with id "'.concat(w,'"')),null;var L=b.alternate;if(!L){var M=Mh(b);if(M===null)throw new Error("Unable to find node on an unmounted component.");return M!==b?null:b}for(var re=b,he=L;;){var Le=re.return;if(Le===null)break;var Bt=Le.alternate;if(Bt===null){var wt=Le.return;if(wt!==null){re=he=wt;continue}break}if(Le.child===Bt.child){for(var ht=Le.child;ht;){if(ht===re)return Lh(Le),b;if(ht===he)return Lh(Le),L;ht=ht.sibling}throw new Error("Unable to find node on an unmounted component.")}if(re.return!==he.return)re=Le,he=Bt;else{for(var vt=!1,zt=Le.child;zt;){if(zt===re){vt=!0,re=Le,he=Bt;break}if(zt===he){vt=!0,he=Le,re=Bt;break}zt=zt.sibling}if(!vt){for(zt=Bt.child;zt;){if(zt===re){vt=!0,re=Bt,he=Le;break}if(zt===he){vt=!0,he=Bt,re=Le;break}zt=zt.sibling}if(!vt)throw new Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(re.alternate!==he)throw new Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(re.tag!==Wt)throw new Error("Unable to find node on an unmounted component.");return re.stateNode.current===re?b:L}function xw(w,b){af(w)&&(window.$attribute=Ai(So,b))}function Tw(w){var b=xr.get(w);if(b==null){console.warn('Could not find Fiber with id "'.concat(w,'"'));return}var L=b.elementType,M=b.tag,re=b.type;switch(M){case V:case wr:case Br:case Dt:h.$type=re;break;case gt:h.$type=re.render;break;case Ot:case an:h.$type=L!=null&&L.type!=null?L.type:re;break;default:h.$type=null;break}}function qg(w){return{displayName:S(w)||"Anonymous",id:bi(w),key:w.key,type:Mn(w)}}function Ow(w){var b=Ea(w);if(b==null)return null;var L=b._debugOwner,M=[qg(b)];if(L)for(var re=L;re!==null;)M.unshift(qg(re)),re=re._debugOwner||null;return M}function Lw(w){var b=null,L=null,M=Ea(w);return M!==null&&(b=M.stateNode,M.memoizedProps!==null&&(L=M.memoizedProps.style)),{instance:b,style:L}}function Ph(w){var b=w.tag,L=w.type;switch(b){case V:case wr:var M=w.stateNode;return typeof L.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function";default:return!1}}function Uh(w){for(var b=w.return;b!==null;){if(Ph(b))return Fi(b);b=b.return}return null}function Gh(w){var b=Ea(w);if(b==null)return null;var L=b._debugOwner,M=b._debugSource,re=b.stateNode,he=b.key,Le=b.memoizedProps,Bt=b.memoizedState,wt=b.dependencies,ht=b.tag,vt=b.type,zt=Mn(b),Pn=(ht===Dt||ht===an||ht===gt)&&(!!Bt||!!wt),jr=!Pn&&ht!==q,mo=N(vt),Go=!1,Ro=null;if(ht===V||ht===Dt||ht===wr||ht===Br||ht===Ot||ht===gt||ht===an){if(Go=!0,re&&re.context!=null){var hu=zt===Gt&&!(vt.contextTypes||vt.contextType);hu||(Ro=re.context)}}else if(mo===Ic||mo===_n){var xi=vt._context||vt;Ro=xi._currentValue||null;for(var pi=b.return;pi!==null;){var uA=pi.type,Cu=N(uA);if(Cu===Xa||Cu===Za){var ff=uA._context||uA.context;if(ff===xi){Ro=pi.memoizedProps.value;break}}pi=pi.return}}var ha=!1;Ro!==null&&(ha=!!vt.contextTypes,Ro={value:Ro});var Ca=null;if(L){Ca=[];for(var Ti=L;Ti!==null;)Ca.push(qg(Ti)),Ti=Ti._debugOwner||null}var ed=ht===Vr&&Bt!==null,Jh=null;if(Pn){var Rm={};for(var bm in console)try{Rm[bm]=console[bm],console[bm]=function(){}}catch{}try{Jh=(0,Ol.inspectHooksOfFiber)(b,g.currentDispatcherRef,!0)}finally{for(var Yh in Rm)try{console[Yh]=Rm[Yh]}catch{}}}for(var Vh=null,td=b;td.return!==null;)td=td.return;var Fm=td.stateNode;Fm!=null&&Fm._debugRootType!==null&&(Vh=Fm._debugRootType);var lv=jn.get(w)||new Map,uv=po.get(w)||new Map,km=!1,rd;if(Ph(b)){var cv=128;km=(b.flags&cv)!==0||cs.get(w)===!0,rd=km?w:Uh(b)}else rd=Uh(b);var $h={stylex:null};return gg&&Le!=null&&Le.hasOwnProperty("xstyle")&&($h.stylex=om(Le.xstyle)),{id:w,canEditHooks:typeof dn=="function",canEditFunctionProps:typeof gi=="function",canEditHooksAndDeletePaths:typeof On=="function",canEditHooksAndRenamePaths:typeof pa=="function",canEditFunctionPropsDeletePaths:typeof xs=="function",canEditFunctionPropsRenamePaths:typeof Ts=="function",canToggleError:Zc&&rd!=null,isErrored:km,targetErrorBoundaryID:rd,canToggleSuspense:ef&&(!ed||Eu.has(w)),canViewSource:Go,hasLegacyContext:ha,key:he??null,displayName:S(b),type:zt,context:Ro,hooks:Jh,props:Le,state:jr?Bt:null,errors:Array.from(lv.entries()),warnings:Array.from(uv.entries()),owners:Ca,source:M||null,rootType:Vh,rendererPackageName:g.rendererPackageName,rendererVersion:g.version,plugins:$h}}var So=null,sf=!1,zg={};function af(w){return So!==null&&So.id===w}function Mw(w){return af(w)&&!sf}function Pw(w){var b=zg;w.forEach(function(L){b[L]||(b[L]={}),b=b[L]})}function Af(w,b){return function(M){switch(b){case"hooks":if(M.length===1||M[M.length-2]==="hookSource"&&M[M.length-1]==="fileName"||M[M.length-1]==="subHooks"||M[M.length-2]==="subHooks")return!0;break;default:break}var re=w===null?zg:zg[w];if(!re)return!1;for(var he=0;he"),"color: var(--dom-tag-name-color); font-weight: normal;"),b.props!==null&&console.log("Props:",b.props),b.state!==null&&console.log("State:",b.state),b.hooks!==null&&console.log("Hooks:",b.hooks);var M=Oh(w);M!==null&&console.log("Nodes:",M),b.source!==null&&console.log("Location:",b.source),(window.chrome||/firefox/i.test(navigator.userAgent))&&console.log("Right-click any value to save it as a global variable for further inspection."),L&&console.groupEnd()}function Kw(w,b,L,M){var re=Ea(b);if(re!==null){var he=re.stateNode;switch(w){case"context":switch(M=M.slice(1),re.tag){case V:M.length===0||vA(he.context,M),he.forceUpdate();break;case Dt:break}break;case"hooks":typeof On=="function"&&On(re,L,M);break;case"props":he===null?typeof xs=="function"&&xs(re,M):(re.pendingProps=Sr(he.props,M),he.forceUpdate());break;case"state":vA(he.state,M),he.forceUpdate();break}}}function Jw(w,b,L,M,re){var he=Ea(b);if(he!==null){var Le=he.stateNode;switch(w){case"context":switch(M=M.slice(1),re=re.slice(1),he.tag){case V:M.length===0||zi(Le.context,M,re),Le.forceUpdate();break;case Dt:break}break;case"hooks":typeof pa=="function"&&pa(he,L,M,re);break;case"props":Le===null?typeof Ts=="function"&&Ts(he,M,re):(he.pendingProps=qa(Le.props,M,re),Le.forceUpdate());break;case"state":zi(Le.state,M,re),Le.forceUpdate();break}}}function Yw(w,b,L,M,re){var he=Ea(b);if(he!==null){var Le=he.stateNode;switch(w){case"context":switch(M=M.slice(1),he.tag){case V:M.length===0?Le.context=re:_A(Le.context,M,re),Le.forceUpdate();break;case Dt:break}break;case"hooks":typeof dn=="function"&&dn(he,L,M,re);break;case"props":he.tag===V?(he.pendingProps=kA(Le.props,M,re),Le.forceUpdate()):typeof gi=="function"&&gi(he,M,re);break;case"state":he.tag===V&&(_A(Le.state,M,re),Le.forceUpdate());break}}}var Ms=null,pu=null,mu=null,wm=null,vm=null,Ni=!1,_m=0,lf=!1,uf=null;function Vw(){var w=[];if(uf===null)throw Error("getProfilingData() called before any profiling data was recorded");uf.forEach(function(wt,ht){var vt=[],zt=[],Pn=pu!==null&&pu.get(ht)||"Unknown";wm?.forEach(function(jr,mo){vm!=null&&vm.get(mo)===ht&&zt.push([mo,jr])}),wt.forEach(function(jr,mo){for(var Go=jr.changeDescriptions,Ro=jr.durations,hu=jr.effectDuration,xi=jr.maxActualDuration,pi=jr.passiveEffectDuration,uA=jr.priorityLevel,Cu=jr.commitTime,ff=jr.updaters,ha=[],Ca=[],Ti=0;Ti1?Iu.set(L,M-1):Iu.delete(L),Xg.delete(w)}function Sm(w){for(var b=null,L=null,M=w.child,re=0;re<3&&M!==null;re++){var he=S(M);if(he!==null&&(typeof M.type=="function"?b=he:L===null&&(L=he)),b!==null)break;M=M.child}return b||L||"Anonymous"}function Kh(w){var b=w.key,L=S(w),M=w.index;switch(w.tag){case Wt:var re=bi(w),he=Xg.get(re);if(he===void 0)throw new Error("Expected mounted root to have known pseudo key.");L=he;break;case Cr:L=w.type;break;default:break}return{displayName:L,key:b,index:M}}function ov(w){var b=xr.get(w);if(b==null)return null;for(var L=[];b!==null;)L.push(Kh(b)),b=b.return;return L.reverse(),L}function iv(){if(AA===null||Ia===null)return null;for(var w=Ia;w!==null&&Si(w);)w=w.return;return w===null?null:{id:bi(w),isFullMatch:cf===AA.length-1}}var sv=function(b){if(b==null)return"Unknown";switch(b){case bn:return"Immediate";case io:return"User-Blocking";case qe:return"Normal";case pt:return"Low";case Ct:return"Idle";case Lr:default:return"Unknown"}};function av(w){Yt=w}function Av(w){return xr.has(w)}return{cleanup:vw,clearErrorsAndWarnings:Ln,clearErrorsForFiberID:ma,clearWarningsForFiberID:aA,getSerializedElementValueByPath:Hw,deletePath:Kw,findNativeNodesForFiberID:Oh,flushInitialOperations:_w,getBestMatchForTrackedPath:iv,getDisplayNameForFiberID:Fw,getFiberForNative:kw,getFiberIDForNative:Nw,getInstanceAndStyle:Lw,getOwnersList:Ow,getPathForElement:ov,getProfilingData:Vw,handleCommitFiberRoot:bw,handleCommitFiberUnmount:Sw,handlePostCommitFiberRoot:Rw,hasFiberWithId:Av,inspectElement:Ww,logElementToConsole:jw,patchConsoleForStrictMode:ua,prepareViewAttributeSource:xw,prepareViewElementSource:Tw,overrideError:zw,overrideSuspense:ev,overrideValueAtPath:Yw,renamePath:Jw,renderer:g,setTraceUpdatesEnabled:av,setTrackedPath:jh,startProfiling:Hh,stopProfiling:$w,storeAsGlobal:Gw,unpatchConsoleForStrictMode:Xl,updateComponentFilters:so}}function bg(A){return Ng(A)||kg(A)||HA(A)||Fg()}function Fg(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kg(A){if(typeof Symbol<"u"&&Symbol.iterator in Object(A))return Array.from(A)}function Ng(A){if(Array.isArray(A))return nA(A)}function Vl(A,f){var g;if(typeof Symbol>"u"||A[Symbol.iterator]==null){if(Array.isArray(A)||(g=HA(A))||f&&A&&typeof A.length=="number"){g&&(A=g);var h=0,d=function(){};return{s:d,n:function(){return h>=A.length?{done:!0}:{done:!1,value:A[h++]}},e:function(O){throw O},f:d}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,S=!1,N;return{s:function(){g=A[Symbol.iterator]()},n:function(){var O=g.next();return B=O.done,O},e:function(O){S=!0,N=O},f:function(){try{!B&&g.return!=null&&g.return()}finally{if(S)throw N}}}}function HA(A,f){if(A){if(typeof A=="string")return nA(A,f);var g=Object.prototype.toString.call(A).slice(8,-1);if(g==="Object"&&A.constructor&&(g=A.constructor.name),g==="Map"||g==="Set")return Array.from(A);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return nA(A,f)}}function nA(A,f){(f==null||f>A.length)&&(f=A.length);for(var g=0,h=new Array(f);g=2&&Yc.test(A[0])&&A[1]==="color: ".concat(zl(f)||"")}function zl(A){switch(A){case"warn":return Tr.browserTheme==="light"?"rgba(250, 180, 50, 0.75)":"rgba(250, 180, 50, 0.5)";case"error":return Tr.browserTheme==="light"?"rgba(250, 123, 130, 0.75)":"rgba(250, 123, 130, 0.5)";default:return Tr.browserTheme==="light"?"rgba(125, 125, 125, 0.75)":"rgba(125, 125, 125, 0.5)"}}var Tg=new Map,no=console,jA={};for(var Yr in console)jA[Yr]=console[Yr];var Pt=null,In=!1;try{In=global===void 0}catch{}function hn(A){no=A,jA={};for(var f in no)jA[f]=console[f]}function Sn(A,f){var g=A.currentDispatcherRef,h=A.getCurrentFiber,d=A.findFiberByHostInstance,B=A.version;if(typeof d=="function"&&g!=null&&typeof h=="function"){var S=Po(B),N=S.ReactTypeOfWork;Tg.set(A,{currentDispatcherRef:g,getCurrentFiber:h,workTagMap:N,onErrorOrWarning:f})}}var Tr={appendComponentStack:!1,breakOnConsoleErrors:!1,showInlineWarningsAndErrors:!1,hideConsoleLogsInStrictMode:!1,browserTheme:"dark"};function la(A){var f=A.appendComponentStack,g=A.breakOnConsoleErrors,h=A.showInlineWarningsAndErrors,d=A.hideConsoleLogsInStrictMode,B=A.browserTheme;if(Tr.appendComponentStack=f,Tr.breakOnConsoleErrors=g,Tr.showInlineWarningsAndErrors=h,Tr.hideConsoleLogsInStrictMode=d,Tr.browserTheme=B,f||g||h){if(Pt!==null)return;var S={};Pt=function(){for(var _ in S)try{no[_]=S[_]}catch{}},$l.forEach(function(N){try{var _=S[N]=no[N].__REACT_DEVTOOLS_ORIGINAL_METHOD__?no[N].__REACT_DEVTOOLS_ORIGINAL_METHOD__:no[N],O=function(){for(var q=!1,V=arguments.length,de=new Array(V),We=0;We0?de[de.length-1]:null,je=typeof gt=="string"&&Jc(gt);q=!je}var Dt=Tr.showInlineWarningsAndErrors&&(N==="error"||N==="warn"),Wt=Vl(Tg.values()),cr;try{for(Wt.s();!(cr=Wt.n()).done;){var ot=cr.value,or=ot.currentDispatcherRef,Cr=ot.getCurrentFiber,rr=ot.onErrorOrWarning,wr=ot.workTagMap,Br=Cr();if(Br!=null)try{if(Dt&&typeof rr=="function"&&rr(Br,N,de.slice()),q){var Dn=yg(wr,Br,or);Dn!==""&&(xg(de,N)&&(de[0]="".concat(de[0]," %s")),de.push(Dn))}}catch(Ot){setTimeout(function(){throw Ot},0)}finally{break}}}catch(Ot){Wt.e(Ot)}finally{Wt.f()}if(Tr.breakOnConsoleErrors)debugger;_.apply(void 0,de)};O.__REACT_DEVTOOLS_ORIGINAL_METHOD__=_,_.__REACT_DEVTOOLS_OVERRIDE_METHOD__=O,no[N]=O}catch{}})}else Cn()}function Cn(){Pt!==null&&(Pt(),Pt=null)}var is=null;function ua(){if(Qc){var A=["error","group","groupCollapsed","info","log","trace","warn"];if(is!==null)return;var f={};is=function(){for(var h in f)try{no[h]=f[h]}catch{}},A.forEach(function(g){try{var h=f[g]=no[g].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__?no[g].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__:no[g],d=function(){if(!Tr.hideConsoleLogsInStrictMode){for(var S=arguments.length,N=new Array(S),_=0;_A.length)&&(f=A.length);for(var g=0,h=new Array(f);g=2&&Yc.test(A[0])&&A[1]==="color: ".concat(zl(f)||"")}function zl(A){switch(A){case"warn":return Tr.browserTheme==="light"?"rgba(250, 180, 50, 0.75)":"rgba(250, 180, 50, 0.5)";case"error":return Tr.browserTheme==="light"?"rgba(250, 123, 130, 0.75)":"rgba(250, 123, 130, 0.5)";default:return Tr.browserTheme==="light"?"rgba(125, 125, 125, 0.75)":"rgba(125, 125, 125, 0.5)"}}var Tg=new Map,no=console,jA={};for(var Yr in console)jA[Yr]=console[Yr];var Pt=null,In=!1;try{In=global===void 0}catch{}function hn(A){no=A,jA={};for(var f in no)jA[f]=console[f]}function Sn(A,f){var g=A.currentDispatcherRef,h=A.getCurrentFiber,d=A.findFiberByHostInstance,B=A.version;if(typeof d=="function"&&g!=null&&typeof h=="function"){var S=Po(B),N=S.ReactTypeOfWork;Tg.set(A,{currentDispatcherRef:g,getCurrentFiber:h,workTagMap:N,onErrorOrWarning:f})}}var Tr={appendComponentStack:!1,breakOnConsoleErrors:!1,showInlineWarningsAndErrors:!1,hideConsoleLogsInStrictMode:!1,browserTheme:"dark"};function la(A){var f=A.appendComponentStack,g=A.breakOnConsoleErrors,h=A.showInlineWarningsAndErrors,d=A.hideConsoleLogsInStrictMode,B=A.browserTheme;if(Tr.appendComponentStack=f,Tr.breakOnConsoleErrors=g,Tr.showInlineWarningsAndErrors=h,Tr.hideConsoleLogsInStrictMode=d,Tr.browserTheme=B,f||g||h){if(Pt!==null)return;var S={};Pt=function(){for(var _ in S)try{no[_]=S[_]}catch{}},$l.forEach(function(N){try{var _=S[N]=no[N].__REACT_DEVTOOLS_ORIGINAL_METHOD__?no[N].__REACT_DEVTOOLS_ORIGINAL_METHOD__:no[N],O=function(){for(var q=!1,V=arguments.length,de=new Array(V),We=0;We0?de[de.length-1]:null,je=typeof gt=="string"&&Jc(gt);q=!je}var Dt=Tr.showInlineWarningsAndErrors&&(N==="error"||N==="warn"),Wt=Vl(Tg.values()),fr;try{for(Wt.s();!(fr=Wt.n()).done;){var ot=fr.value,or=ot.currentDispatcherRef,Cr=ot.getCurrentFiber,rr=ot.onErrorOrWarning,wr=ot.workTagMap,Br=Cr();if(Br!=null)try{if(Dt&&typeof rr=="function"&&rr(Br,N,de.slice()),q){var Dn=yg(wr,Br,or);Dn!==""&&(xg(de,N)&&(de[0]="".concat(de[0]," %s")),de.push(Dn))}}catch(Ot){setTimeout(function(){throw Ot},0)}finally{break}}}catch(Ot){Wt.e(Ot)}finally{Wt.f()}if(Tr.breakOnConsoleErrors)debugger;_.apply(void 0,de)};O.__REACT_DEVTOOLS_ORIGINAL_METHOD__=_,_.__REACT_DEVTOOLS_OVERRIDE_METHOD__=O,no[N]=O}catch{}})}else Cn()}function Cn(){Pt!==null&&(Pt(),Pt=null)}var is=null;function ua(){if(Qc){var A=["error","group","groupCollapsed","info","log","trace","warn"];if(is!==null)return;var f={};is=function(){for(var h in f)try{no[h]=f[h]}catch{}},A.forEach(function(g){try{var h=f[g]=no[g].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__?no[g].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__:no[g],d=function(){if(!Tr.hideConsoleLogsInStrictMode){for(var S=arguments.length,N=new Array(S),_=0;_A.length)&&(f=A.length);for(var g=0,h=new Array(f);g"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function oo(A){return oo=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},oo(A)}function Bn(A,f,g){return f in A?Object.defineProperty(A,f,{value:g,enumerable:!0,configurable:!0,writable:!0}):A[f]=g,A}var Og=100,iu=[{version:0,minNpmVersion:'"<4.11.0"',maxNpmVersion:'"<4.11.0"'},{version:1,minNpmVersion:"4.13.0",maxNpmVersion:"4.21.0"},{version:2,minNpmVersion:"4.22.0",maxNpmVersion:null}],su=iu[iu.length-1],fm=(function(A){JA(g,A);var f=nu(g);function g(h){var d;return tu(this,g),d=f.call(this),Bn(Wr(d),"_isShutdown",!1),Bn(Wr(d),"_messageQueue",[]),Bn(Wr(d),"_timeoutID",null),Bn(Wr(d),"_wallUnlisten",null),Bn(Wr(d),"_flush",function(){if(d._timeoutID!==null&&(clearTimeout(d._timeoutID),d._timeoutID=null),d._messageQueue.length){for(var B=0;B1?B-1:0),N=1;N"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function $A(A){return $A=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},$A(A)}function Tt(A,f,g){return f in A?Object.defineProperty(A,f,{value:g,enumerable:!0,configurable:!0,writable:!0}):A[f]=g,A}var ks=function(f){if(P){for(var g,h=arguments.length,d=new Array(h>1?h-1:0),B=1;BA.length)&&(f=A.length);for(var g=0,h=new Array(f);g0?"development":"production";var pt=Function.prototype.toString;if(qe.Mount&&qe.Mount._renderNewRootComponent){var Ct=pt.call(qe.Mount._renderNewRootComponent);return Ct.indexOf("function")!==0?"production":Ct.indexOf("storedMeasure")!==-1?"development":Ct.indexOf("should be a pure function")!==-1?Ct.indexOf("NODE_ENV")!==-1||Ct.indexOf("development")!==-1||Ct.indexOf("true")!==-1?"development":Ct.indexOf("nextElement")!==-1||Ct.indexOf("nextComponent")!==-1?"unminified":"development":Ct.indexOf("nextElement")!==-1||Ct.indexOf("nextComponent")!==-1?"unminified":"outdated"}}catch{}return"production"}function S(qe){try{var pt=Function.prototype.toString,Ct=pt.call(qe);Ct.indexOf("^_^")>-1&&(de=!0,setTimeout(function(){throw new Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build")}))}catch{}}function N(qe,pt){if(qe==null||qe.length===0||typeof qe[0]=="string"&&qe[0].match(/([^%]|^)(%c)/g)||pt===void 0)return qe;var Ct=/([^%]|^)((%%)*)(%([oOdisf]))/g;if(typeof qe[0]=="string"&&qe[0].match(Ct))return["%c".concat(qe[0]),pt].concat(uu(qe.slice(1)));var Lr=qe.reduce(function(gn,$r,dn){switch(dn>0&&(gn+=" "),_i($r)){case"string":case"boolean":case"symbol":return gn+="%s";case"number":var On=Number.isInteger($r)?"%i":"%f";return gn+=On;default:return gn+="%o"}},"%c");return[Lr,pt].concat(uu(qe))}var _=null;function O(qe){var pt=qe.hideConsoleLogsInStrictMode,Ct=qe.browserTheme,Lr=["error","group","groupCollapsed","info","log","trace","warn"];if(_===null){var gn={};_=function(){for(var dn in gn)try{f[dn]=gn[dn]}catch{}},Lr.forEach(function($r){try{var dn=gn[$r]=f[$r].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__?f[$r].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__:f[$r],On=function(){if(!pt){var gi;switch($r){case"warn":gi=Ct==="light"?"rgba(250, 180, 50, 0.75)":"rgba(250, 180, 50, 0.5)";break;case"error":gi=Ct==="light"?"rgba(250, 123, 130, 0.75)":"rgba(250, 123, 130, 0.5)";break;default:gi=Ct==="light"?"rgba(125, 125, 125, 0.75)":"rgba(125, 125, 125, 0.5)";break}if(gi){for(var xs=arguments.length,Ts=new Array(xs),As=0;As1?pt[1]:null;return Ct}function Dn(){return wr}function Ot(qe){var pt=Br(qe);pt!==null&&rr.push(pt)}function Rn(qe){if(rr.length>0){var pt=rr.pop(),Ct=Br(qe);Ct!==null&&wr.push([pt,Ct])}}var an={},Vr=new Map,bt={},Dr=new Map,bn=new Map,io={rendererInterfaces:Vr,listeners:bt,backends:bn,renderers:Dr,emit:Dt,getFiberRoots:Wt,inject:V,on:gt,off:je,sub:We,supportsFiber:!0,checkDCE:S,onCommitFiberUnmount:cr,onCommitFiberRoot:ot,onPostCommitFiberRoot:or,setStrictMode:Cr,getInternalModuleRanges:Dn,registerInternalModuleStart:Ot,registerInternalModuleStop:Rn};return Object.defineProperty(A,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{configurable:!1,enumerable:!1,get:function(){return io}}),io}function Gg(A,f,g){var h=A[f];return A[f]=function(d){return g.call(this,h,arguments)},h}function Em(A,f){var g={};for(var h in f)g[h]=Gg(A,h,f[h]);return g}function vo(A,f){for(var g in f)A[g]=f[g]}function ci(A){typeof A.forceUpdate=="function"?A.forceUpdate():A.updater!=null&&typeof A.updater.enqueueForceUpdate=="function"&&A.updater.enqueueForceUpdate(this,function(){},"forceUpdate")}function Hg(A,f){var g=Object.keys(A);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(A);f&&(h=h.filter(function(d){return Object.getOwnPropertyDescriptor(A,d).enumerable})),g.push.apply(g,h)}return g}function _o(A){for(var f=1;f0?de[de.length-1]:0;je(Ue,jt,Yt),de.push(jt),S.set(Ue,q(dt._topLevelWrapper));try{var mr=Re.apply(this,ke);return de.pop(),mr}catch(so){throw de=[],so}finally{if(de.length===0){var Fn=S.get(Ue);if(Fn===void 0)throw new Error("Expected to find root ID.");Dn(Fn)}}},performUpdateIfNecessary:function(Re,ke){var Ue=ke[0];if(Uo(Ue)===Ir)return Re.apply(this,ke);var dt=q(Ue);de.push(dt);var jt=fa(Ue);try{var Yt=Re.apply(this,ke),mr=fa(Ue);return V(jt,mr)||Dt(Ue,dt,mr),de.pop(),Yt}catch(so){throw de=[],so}finally{if(de.length===0){var Fn=S.get(Ue);if(Fn===void 0)throw new Error("Expected to find root ID.");Dn(Fn)}}},receiveComponent:function(Re,ke){var Ue=ke[0];if(Uo(Ue)===Ir)return Re.apply(this,ke);var dt=q(Ue);de.push(dt);var jt=fa(Ue);try{var Yt=Re.apply(this,ke),mr=fa(Ue);return V(jt,mr)||Dt(Ue,dt,mr),de.pop(),Yt}catch(so){throw de=[],so}finally{if(de.length===0){var Fn=S.get(Ue);if(Fn===void 0)throw new Error("Expected to find root ID.");Dn(Fn)}}},unmountComponent:function(Re,ke){var Ue=ke[0];if(Uo(Ue)===Ir)return Re.apply(this,ke);var dt=q(Ue);de.push(dt);try{var jt=Re.apply(this,ke);return de.pop(),Wt(Ue,dt),jt}catch(mr){throw de=[],mr}finally{if(de.length===0){var Yt=S.get(Ue);if(Yt===void 0)throw new Error("Expected to find root ID.");Dn(Yt)}}}}));function gt(){We!==null&&(g.Component?vo(g.Component.Mixin,We):vo(g.Reconciler,We)),We=null}function je(Qe,Re,ke){var Ue=ke===0;if(P&&console.log("%crecordMount()","color: green; font-weight: bold;",Re,Ns(Qe).displayName),Ue){var dt=Qe._currentElement!=null&&Qe._currentElement._owner!=null;Ot(ee),Ot(Re),Ot(Ql),Ot(0),Ot(0),Ot(0),Ot(dt?1:0)}else{var jt=Uo(Qe),Yt=Ns(Qe),mr=Yt.displayName,Fn=Yt.key,so=Qe._currentElement!=null&&Qe._currentElement._owner!=null?q(Qe._currentElement._owner):0,Si=Rn(mr),Mn=Rn(Fn);Ot(ee),Ot(Re),Ot(jt),Ot(ke),Ot(so),Ot(Si),Ot(Mn)}}function Dt(Qe,Re,ke){Ot(ie),Ot(Re);var Ue=ke.map(q);Ot(Ue.length);for(var dt=0;dt0?2+Re:0)+or.length),Ue=0;if(ke[Ue++]=f,ke[Ue++]=Qe,ke[Ue++]=wr,Cr.forEach(function(Yt,mr){ke[Ue++]=mr.length;for(var Fn=Ka(mr),so=0;so0){ke[Ue++]=W,ke[Ue++]=Re;for(var dt=0;dt"),"color: var(--dom-tag-name-color); font-weight: normal;"),Re.props!==null&&console.log("Props:",Re.props),Re.state!==null&&console.log("State:",Re.state),Re.context!==null&&console.log("Context:",Re.context);var Ue=_(Qe);Ue!==null&&console.log("Node:",Ue),(window.chrome||/firefox/i.test(navigator.userAgent))&&console.log("Right-click any value to save it as a global variable for further inspection."),ke&&console.groupEnd()}function $r(Qe,Re){var ke=Lr(Qe);ke!==null&&(window.$attribute=Ai(ke,Re))}function dn(Qe){var Re=d.get(Qe);if(Re==null){console.warn('Could not find instance with id "'.concat(Qe,'"'));return}var ke=Re._currentElement;if(ke==null){console.warn('Could not find element with id "'.concat(Qe,'"'));return}h.$type=ke.type}function On(Qe,Re,ke,Ue){var dt=d.get(Re);if(dt!=null){var jt=dt._instance;if(jt!=null)switch(Qe){case"context":vA(jt.context,Ue),ci(jt);break;case"hooks":throw new Error("Hooks not supported by this renderer");case"props":var Yt=dt._currentElement;dt._currentElement=_o(_o({},Yt),{},{props:Sr(Yt.props,Ue)}),ci(jt);break;case"state":vA(jt.state,Ue),ci(jt);break}}}function pa(Qe,Re,ke,Ue,dt){var jt=d.get(Re);if(jt!=null){var Yt=jt._instance;if(Yt!=null)switch(Qe){case"context":zi(Yt.context,Ue,dt),ci(Yt);break;case"hooks":throw new Error("Hooks not supported by this renderer");case"props":var mr=jt._currentElement;jt._currentElement=_o(_o({},mr),{},{props:qa(mr.props,Ue,dt)}),ci(Yt);break;case"state":zi(Yt.state,Ue,dt),ci(Yt);break}}}function gi(Qe,Re,ke,Ue,dt){var jt=d.get(Re);if(jt!=null){var Yt=jt._instance;if(Yt!=null)switch(Qe){case"context":_A(Yt.context,Ue,dt),ci(Yt);break;case"hooks":throw new Error("Hooks not supported by this renderer");case"props":var mr=jt._currentElement;jt._currentElement=_o(_o({},mr),{},{props:kA(mr.props,Ue,dt)}),ci(Yt);break;case"state":_A(Yt.state,Ue,dt),ci(Yt);break}}}var xs=function(){throw new Error("getProfilingData not supported by this renderer")},Ts=function(){throw new Error("handleCommitFiberRoot not supported by this renderer")},As=function(){throw new Error("handleCommitFiberUnmount not supported by this renderer")},ls=function(){throw new Error("handlePostCommitFiberRoot not supported by this renderer")},sA=function(){throw new Error("overrideError not supported by this renderer")},Os=function(){throw new Error("overrideSuspense not supported by this renderer")},Zc=function(){},ef=function(){};function tt(){return null}function It(Qe){return null}function Jt(Qe){}function nr(Qe){}function An(Qe){}function Mr(Qe){return null}function jn(){}function po(Qe){}function Ln(Qe){}function di(){}function ma(){}function aA(Qe){return d.has(Qe)}return{clearErrorsAndWarnings:jn,clearErrorsForFiberID:po,clearWarningsForFiberID:Ln,cleanup:gt,getSerializedElementValueByPath:pt,deletePath:On,flushInitialOperations:ot,getBestMatchForTrackedPath:tt,getDisplayNameForFiberID:U,getFiberForNative:O,getFiberIDForNative:N,getInstanceAndStyle:bn,findNativeNodesForFiberID:function(Re){var ke=_(Re);return ke==null?null:[ke]},getOwnersList:Mr,getPathForElement:It,getProfilingData:xs,handleCommitFiberRoot:Ts,handleCommitFiberUnmount:As,handlePostCommitFiberRoot:ls,hasFiberWithId:aA,inspectElement:Ct,logElementToConsole:gn,overrideError:sA,overrideSuspense:Os,overrideValueAtPath:gi,renamePath:pa,patchConsoleForStrictMode:di,prepareViewAttributeSource:$r,prepareViewElementSource:dn,renderer:g,setTraceUpdatesEnabled:nr,setTrackedPath:An,startProfiling:Zc,stopProfiling:ef,storeAsGlobal:qe,unpatchConsoleForStrictMode:ma,updateComponentFilters:Jt}}function Wg(A){return!ag(A)}function jg(A,f,g){if(A==null)return function(){};var h=[A.sub("renderer-attached",function(S){var N=S.id,_=S.renderer,O=S.rendererInterface;f.setRendererInterface(N,O),O.flushInitialOperations()}),A.sub("unsupported-renderer-version",function(S){f.onUnsupportedRenderer(S)}),A.sub("fastRefreshScheduled",f.onFastRefreshScheduled),A.sub("operations",f.onHookOperations),A.sub("traceUpdates",f.onTraceUpdates)],d=function(N,_){if(Wg(_.reconcilerVersion||_.version)){var O=A.rendererInterfaces.get(N);O==null&&(typeof _.findFiberByHostInstance=="function"?O=cm(A,N,_,g):_.ComponentTree&&(O=Im(A,N,_,g)),O!=null&&A.rendererInterfaces.set(N,O)),O!=null?A.emit("renderer-attached",{id:N,renderer:_,rendererInterface:O}):A.emit("unsupported-renderer-version",N)}};A.renderers.forEach(function(S,N){d(N,S)}),h.push(A.sub("renderer",function(S){var N=S.id,_=S.renderer;d(N,_)})),A.emit("react-devtools",f),A.reactDevtoolsAgent=f;var B=function(){h.forEach(function(N){return N()}),A.rendererInterfaces.forEach(function(N){N.cleanup()}),A.reactDevtoolsAgent=null};return f.addListener("shutdown",B),h.push(function(){f.removeListener("shutdown",B)}),function(){h.forEach(function(S){return S()})}}function Xc(A,f){var g=!1,h={bottom:0,left:0,right:0,top:0},d=f[A];if(d!=null){for(var B=0,S=Object.keys(h);B1?g-1:0),d=1;d=0&&or.splice(bn,1)}},send:function(Dr,bn,io){rr.readyState===rr.OPEN?(P&&Rt("wall.send()",Dr,bn),rr.send(JSON.stringify({event:Dr,payload:bn}))):(P&&Rt("wall.send()","Shutting down bridge because of closed WebSocket connection"),ot!==null&&ot.shutdown(),cr())}}),ot.addListener("updateComponentFilters",function(bt){ut=bt}),je!=null&&ot!=null&&ot.addListener("updateConsolePatchSettings",function(bt){return ue(je,bt)}),window.__REACT_DEVTOOLS_COMPONENT_FILTERS__==null&&ot.send("overrideComponentFilters",ut);var Ot=new dm(ot);if(Ot.addListener("shutdown",function(){Te.emit("shutdown")}),jg(Te,Ot,window),q!=null||Te.resolveRNStyle!=null)Kg(ot,Ot,q||Te.resolveRNStyle,d||Te.nativeStyleEditorValidAttributes||null);else{var Rn,an,Vr=function(){ot!==null&&Kg(ot,Ot,Rn,an)};Te.hasOwnProperty("resolveRNStyle")||Object.defineProperty(Te,"resolveRNStyle",{enumerable:!1,get:function(){return Rn},set:function(Dr){Rn=Dr,Vr()}}),Te.hasOwnProperty("nativeStyleEditorValidAttributes")||Object.defineProperty(Te,"nativeStyleEditorValidAttributes",{enumerable:!1,get:function(){return an},set:function(Dr){an=Dr,Vr()}})}};function wr(){P&&Rt("WebSocket.onclose"),ot!==null&&ot.emit("shutdown"),cr()}function Br(){P&&Rt("WebSocket.onerror"),cr()}function Dn(Ot){var Rn;try{if(typeof Ot.data=="string")Rn=JSON.parse(Ot.data),P&&Rt("WebSocket.onmessage",Rn);else throw Error()}catch{console.error("[React DevTools] Failed to parse JSON: "+Ot.data);return}or.forEach(function(an){try{an(Rn)}catch(Vr){throw console.log("[React DevTools] Error calling listener",Rn),console.log("error:",Vr),Vr}})}}})(),i})())});var _R={};var RD,bD=xm(()=>{_D();RD=Me(SD(),1);RD.default.connectToDevTools()});var OD=Ar((ET,bR)=>{bR.exports={single:{topLeft:"\u250C",top:"\u2500",topRight:"\u2510",right:"\u2502",bottomRight:"\u2518",bottom:"\u2500",bottomLeft:"\u2514",left:"\u2502"},double:{topLeft:"\u2554",top:"\u2550",topRight:"\u2557",right:"\u2551",bottomRight:"\u255D",bottom:"\u2550",bottomLeft:"\u255A",left:"\u2551"},round:{topLeft:"\u256D",top:"\u2500",topRight:"\u256E",right:"\u2502",bottomRight:"\u256F",bottom:"\u2500",bottomLeft:"\u2570",left:"\u2502"},bold:{topLeft:"\u250F",top:"\u2501",topRight:"\u2513",right:"\u2503",bottomRight:"\u251B",bottom:"\u2501",bottomLeft:"\u2517",left:"\u2503"},singleDouble:{topLeft:"\u2553",top:"\u2500",topRight:"\u2556",right:"\u2551",bottomRight:"\u255C",bottom:"\u2500",bottomLeft:"\u2559",left:"\u2551"},doubleSingle:{topLeft:"\u2552",top:"\u2550",topRight:"\u2555",right:"\u2502",bottomRight:"\u255B",bottom:"\u2550",bottomLeft:"\u2558",left:"\u2502"},classic:{topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},arrow:{topLeft:"\u2198",top:"\u2193",topRight:"\u2199",right:"\u2190",bottomRight:"\u2196",bottom:"\u2191",bottomLeft:"\u2197",left:"\u2192"}}});var MD=Ar((IT,WE)=>{"use strict";var LD=OD();WE.exports=LD;WE.exports.default=LD});var Ay=Ar((SO,nI)=>{"use strict";var ay=(e,t)=>{for(let r of Reflect.ownKeys(t))Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));return e};nI.exports=ay;nI.exports.default=ay});var uy=Ar((RO,Xd)=>{"use strict";var fb=Ay(),zd=new WeakMap,ly=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,i=0,s=e.displayName||e.name||"",a=function(...u){if(zd.set(a,++i),i===1)r=e.apply(this,u),e=null;else if(t.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return r};return fb(a,e),zd.set(a,i),a};Xd.exports=ly;Xd.exports.default=ly;Xd.exports.callCount=e=>{if(!zd.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return zd.get(e)}});var _y=Ar((VO,vy)=>{"use strict";var Db=/[|\\{}()[\]^$+*?.-]/g;vy.exports=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(Db,"\\$&")}});var Fy=Ar(($O,by)=>{"use strict";var yb=_y(),Qb=typeof process=="object"&&process&&typeof process.cwd=="function"?process.cwd():".",Ry=[].concat(qr("module").builtinModules,"bootstrap_node","node").map(e=>new RegExp(`(?:\\((?:node:)?${e}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${e}(?:\\.js)?:\\d+:\\d+$)`));Ry.push(/\((?:node:)?internal\/[^:]+:\d+:\d+\)$/,/\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var iI=class e{constructor(t){t={ignoredPackages:[],...t},"internals"in t||(t.internals=e.nodeInternals()),"cwd"in t||(t.cwd=Qb),this._cwd=t.cwd.replace(/\\/g,"/"),this._internals=[].concat(t.internals,wb(t.ignoredPackages)),this._wrapCallSite=t.wrapCallSite||!1}static nodeInternals(){return[...Ry]}clean(t,r=0){r=" ".repeat(r),Array.isArray(t)||(t=t.split(` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pm(A,f){if(A){if(typeof A=="string")return zc(A,f);var g=Object.prototype.toString.call(A).slice(8,-1);if(g==="Object"&&A.constructor&&(g=A.constructor.name),g==="Map"||g==="Set")return Array.from(A);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return zc(A,f)}}function Pg(A){if(typeof Symbol<"u"&&Symbol.iterator in Object(A))return Array.from(A)}function mm(A){if(Array.isArray(A))return zc(A)}function zc(A,f){(f==null||f>A.length)&&(f=A.length);for(var g=0,h=new Array(f);g0?"development":"production";var pt=Function.prototype.toString;if(qe.Mount&&qe.Mount._renderNewRootComponent){var Ct=pt.call(qe.Mount._renderNewRootComponent);return Ct.indexOf("function")!==0?"production":Ct.indexOf("storedMeasure")!==-1?"development":Ct.indexOf("should be a pure function")!==-1?Ct.indexOf("NODE_ENV")!==-1||Ct.indexOf("development")!==-1||Ct.indexOf("true")!==-1?"development":Ct.indexOf("nextElement")!==-1||Ct.indexOf("nextComponent")!==-1?"unminified":"development":Ct.indexOf("nextElement")!==-1||Ct.indexOf("nextComponent")!==-1?"unminified":"outdated"}}catch{}return"production"}function S(qe){try{var pt=Function.prototype.toString,Ct=pt.call(qe);Ct.indexOf("^_^")>-1&&(de=!0,setTimeout(function(){throw new Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build")}))}catch{}}function N(qe,pt){if(qe==null||qe.length===0||typeof qe[0]=="string"&&qe[0].match(/([^%]|^)(%c)/g)||pt===void 0)return qe;var Ct=/([^%]|^)((%%)*)(%([oOdisf]))/g;if(typeof qe[0]=="string"&&qe[0].match(Ct))return["%c".concat(qe[0]),pt].concat(uu(qe.slice(1)));var Lr=qe.reduce(function(gn,$r,dn){switch(dn>0&&(gn+=" "),_i($r)){case"string":case"boolean":case"symbol":return gn+="%s";case"number":var On=Number.isInteger($r)?"%i":"%f";return gn+=On;default:return gn+="%o"}},"%c");return[Lr,pt].concat(uu(qe))}var _=null;function O(qe){var pt=qe.hideConsoleLogsInStrictMode,Ct=qe.browserTheme,Lr=["error","group","groupCollapsed","info","log","trace","warn"];if(_===null){var gn={};_=function(){for(var dn in gn)try{f[dn]=gn[dn]}catch{}},Lr.forEach(function($r){try{var dn=gn[$r]=f[$r].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__?f[$r].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__:f[$r],On=function(){if(!pt){var gi;switch($r){case"warn":gi=Ct==="light"?"rgba(250, 180, 50, 0.75)":"rgba(250, 180, 50, 0.5)";break;case"error":gi=Ct==="light"?"rgba(250, 123, 130, 0.75)":"rgba(250, 123, 130, 0.5)";break;default:gi=Ct==="light"?"rgba(125, 125, 125, 0.75)":"rgba(125, 125, 125, 0.5)";break}if(gi){for(var xs=arguments.length,Ts=new Array(xs),As=0;As1?pt[1]:null;return Ct}function Dn(){return wr}function Ot(qe){var pt=Br(qe);pt!==null&&rr.push(pt)}function Rn(qe){if(rr.length>0){var pt=rr.pop(),Ct=Br(qe);Ct!==null&&wr.push([pt,Ct])}}var an={},Vr=new Map,bt={},Dr=new Map,bn=new Map,io={rendererInterfaces:Vr,listeners:bt,backends:bn,renderers:Dr,emit:Dt,getFiberRoots:Wt,inject:V,on:gt,off:je,sub:We,supportsFiber:!0,checkDCE:S,onCommitFiberUnmount:fr,onCommitFiberRoot:ot,onPostCommitFiberRoot:or,setStrictMode:Cr,getInternalModuleRanges:Dn,registerInternalModuleStart:Ot,registerInternalModuleStop:Rn};return Object.defineProperty(A,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{configurable:!1,enumerable:!1,get:function(){return io}}),io}function Gg(A,f,g){var h=A[f];return A[f]=function(d){return g.call(this,h,arguments)},h}function Em(A,f){var g={};for(var h in f)g[h]=Gg(A,h,f[h]);return g}function vo(A,f){for(var g in f)A[g]=f[g]}function ci(A){typeof A.forceUpdate=="function"?A.forceUpdate():A.updater!=null&&typeof A.updater.enqueueForceUpdate=="function"&&A.updater.enqueueForceUpdate(this,function(){},"forceUpdate")}function Hg(A,f){var g=Object.keys(A);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(A);f&&(h=h.filter(function(d){return Object.getOwnPropertyDescriptor(A,d).enumerable})),g.push.apply(g,h)}return g}function _o(A){for(var f=1;f0?de[de.length-1]:0;je(Ue,jt,Yt),de.push(jt),S.set(Ue,q(dt._topLevelWrapper));try{var mr=Re.apply(this,ke);return de.pop(),mr}catch(so){throw de=[],so}finally{if(de.length===0){var Fn=S.get(Ue);if(Fn===void 0)throw new Error("Expected to find root ID.");Dn(Fn)}}},performUpdateIfNecessary:function(Re,ke){var Ue=ke[0];if(Uo(Ue)===Ir)return Re.apply(this,ke);var dt=q(Ue);de.push(dt);var jt=fa(Ue);try{var Yt=Re.apply(this,ke),mr=fa(Ue);return V(jt,mr)||Dt(Ue,dt,mr),de.pop(),Yt}catch(so){throw de=[],so}finally{if(de.length===0){var Fn=S.get(Ue);if(Fn===void 0)throw new Error("Expected to find root ID.");Dn(Fn)}}},receiveComponent:function(Re,ke){var Ue=ke[0];if(Uo(Ue)===Ir)return Re.apply(this,ke);var dt=q(Ue);de.push(dt);var jt=fa(Ue);try{var Yt=Re.apply(this,ke),mr=fa(Ue);return V(jt,mr)||Dt(Ue,dt,mr),de.pop(),Yt}catch(so){throw de=[],so}finally{if(de.length===0){var Fn=S.get(Ue);if(Fn===void 0)throw new Error("Expected to find root ID.");Dn(Fn)}}},unmountComponent:function(Re,ke){var Ue=ke[0];if(Uo(Ue)===Ir)return Re.apply(this,ke);var dt=q(Ue);de.push(dt);try{var jt=Re.apply(this,ke);return de.pop(),Wt(Ue,dt),jt}catch(mr){throw de=[],mr}finally{if(de.length===0){var Yt=S.get(Ue);if(Yt===void 0)throw new Error("Expected to find root ID.");Dn(Yt)}}}}));function gt(){We!==null&&(g.Component?vo(g.Component.Mixin,We):vo(g.Reconciler,We)),We=null}function je(Qe,Re,ke){var Ue=ke===0;if(P&&console.log("%crecordMount()","color: green; font-weight: bold;",Re,Ns(Qe).displayName),Ue){var dt=Qe._currentElement!=null&&Qe._currentElement._owner!=null;Ot(ee),Ot(Re),Ot(Ql),Ot(0),Ot(0),Ot(0),Ot(dt?1:0)}else{var jt=Uo(Qe),Yt=Ns(Qe),mr=Yt.displayName,Fn=Yt.key,so=Qe._currentElement!=null&&Qe._currentElement._owner!=null?q(Qe._currentElement._owner):0,Si=Rn(mr),Mn=Rn(Fn);Ot(ee),Ot(Re),Ot(jt),Ot(ke),Ot(so),Ot(Si),Ot(Mn)}}function Dt(Qe,Re,ke){Ot(ie),Ot(Re);var Ue=ke.map(q);Ot(Ue.length);for(var dt=0;dt0?2+Re:0)+or.length),Ue=0;if(ke[Ue++]=f,ke[Ue++]=Qe,ke[Ue++]=wr,Cr.forEach(function(Yt,mr){ke[Ue++]=mr.length;for(var Fn=Ka(mr),so=0;so0){ke[Ue++]=W,ke[Ue++]=Re;for(var dt=0;dt"),"color: var(--dom-tag-name-color); font-weight: normal;"),Re.props!==null&&console.log("Props:",Re.props),Re.state!==null&&console.log("State:",Re.state),Re.context!==null&&console.log("Context:",Re.context);var Ue=_(Qe);Ue!==null&&console.log("Node:",Ue),(window.chrome||/firefox/i.test(navigator.userAgent))&&console.log("Right-click any value to save it as a global variable for further inspection."),ke&&console.groupEnd()}function $r(Qe,Re){var ke=Lr(Qe);ke!==null&&(window.$attribute=Ai(ke,Re))}function dn(Qe){var Re=d.get(Qe);if(Re==null){console.warn('Could not find instance with id "'.concat(Qe,'"'));return}var ke=Re._currentElement;if(ke==null){console.warn('Could not find element with id "'.concat(Qe,'"'));return}h.$type=ke.type}function On(Qe,Re,ke,Ue){var dt=d.get(Re);if(dt!=null){var jt=dt._instance;if(jt!=null)switch(Qe){case"context":vA(jt.context,Ue),ci(jt);break;case"hooks":throw new Error("Hooks not supported by this renderer");case"props":var Yt=dt._currentElement;dt._currentElement=_o(_o({},Yt),{},{props:Sr(Yt.props,Ue)}),ci(jt);break;case"state":vA(jt.state,Ue),ci(jt);break}}}function pa(Qe,Re,ke,Ue,dt){var jt=d.get(Re);if(jt!=null){var Yt=jt._instance;if(Yt!=null)switch(Qe){case"context":zi(Yt.context,Ue,dt),ci(Yt);break;case"hooks":throw new Error("Hooks not supported by this renderer");case"props":var mr=jt._currentElement;jt._currentElement=_o(_o({},mr),{},{props:qa(mr.props,Ue,dt)}),ci(Yt);break;case"state":zi(Yt.state,Ue,dt),ci(Yt);break}}}function gi(Qe,Re,ke,Ue,dt){var jt=d.get(Re);if(jt!=null){var Yt=jt._instance;if(Yt!=null)switch(Qe){case"context":_A(Yt.context,Ue,dt),ci(Yt);break;case"hooks":throw new Error("Hooks not supported by this renderer");case"props":var mr=jt._currentElement;jt._currentElement=_o(_o({},mr),{},{props:kA(mr.props,Ue,dt)}),ci(Yt);break;case"state":_A(Yt.state,Ue,dt),ci(Yt);break}}}var xs=function(){throw new Error("getProfilingData not supported by this renderer")},Ts=function(){throw new Error("handleCommitFiberRoot not supported by this renderer")},As=function(){throw new Error("handleCommitFiberUnmount not supported by this renderer")},ls=function(){throw new Error("handlePostCommitFiberRoot not supported by this renderer")},sA=function(){throw new Error("overrideError not supported by this renderer")},Os=function(){throw new Error("overrideSuspense not supported by this renderer")},Zc=function(){},ef=function(){};function tt(){return null}function It(Qe){return null}function Jt(Qe){}function nr(Qe){}function An(Qe){}function Mr(Qe){return null}function jn(){}function po(Qe){}function Ln(Qe){}function di(){}function ma(){}function aA(Qe){return d.has(Qe)}return{clearErrorsAndWarnings:jn,clearErrorsForFiberID:po,clearWarningsForFiberID:Ln,cleanup:gt,getSerializedElementValueByPath:pt,deletePath:On,flushInitialOperations:ot,getBestMatchForTrackedPath:tt,getDisplayNameForFiberID:U,getFiberForNative:O,getFiberIDForNative:N,getInstanceAndStyle:bn,findNativeNodesForFiberID:function(Re){var ke=_(Re);return ke==null?null:[ke]},getOwnersList:Mr,getPathForElement:It,getProfilingData:xs,handleCommitFiberRoot:Ts,handleCommitFiberUnmount:As,handlePostCommitFiberRoot:ls,hasFiberWithId:aA,inspectElement:Ct,logElementToConsole:gn,overrideError:sA,overrideSuspense:Os,overrideValueAtPath:gi,renamePath:pa,patchConsoleForStrictMode:di,prepareViewAttributeSource:$r,prepareViewElementSource:dn,renderer:g,setTraceUpdatesEnabled:nr,setTrackedPath:An,startProfiling:Zc,stopProfiling:ef,storeAsGlobal:qe,unpatchConsoleForStrictMode:ma,updateComponentFilters:Jt}}function Wg(A){return!ag(A)}function jg(A,f,g){if(A==null)return function(){};var h=[A.sub("renderer-attached",function(S){var N=S.id,_=S.renderer,O=S.rendererInterface;f.setRendererInterface(N,O),O.flushInitialOperations()}),A.sub("unsupported-renderer-version",function(S){f.onUnsupportedRenderer(S)}),A.sub("fastRefreshScheduled",f.onFastRefreshScheduled),A.sub("operations",f.onHookOperations),A.sub("traceUpdates",f.onTraceUpdates)],d=function(N,_){if(Wg(_.reconcilerVersion||_.version)){var O=A.rendererInterfaces.get(N);O==null&&(typeof _.findFiberByHostInstance=="function"?O=cm(A,N,_,g):_.ComponentTree&&(O=Im(A,N,_,g)),O!=null&&A.rendererInterfaces.set(N,O)),O!=null?A.emit("renderer-attached",{id:N,renderer:_,rendererInterface:O}):A.emit("unsupported-renderer-version",N)}};A.renderers.forEach(function(S,N){d(N,S)}),h.push(A.sub("renderer",function(S){var N=S.id,_=S.renderer;d(N,_)})),A.emit("react-devtools",f),A.reactDevtoolsAgent=f;var B=function(){h.forEach(function(N){return N()}),A.rendererInterfaces.forEach(function(N){N.cleanup()}),A.reactDevtoolsAgent=null};return f.addListener("shutdown",B),h.push(function(){f.removeListener("shutdown",B)}),function(){h.forEach(function(S){return S()})}}function Xc(A,f){var g=!1,h={bottom:0,left:0,right:0,top:0},d=f[A];if(d!=null){for(var B=0,S=Object.keys(h);B1?g-1:0),d=1;d=0&&or.splice(bn,1)}},send:function(Dr,bn,io){rr.readyState===rr.OPEN?(P&&Rt("wall.send()",Dr,bn),rr.send(JSON.stringify({event:Dr,payload:bn}))):(P&&Rt("wall.send()","Shutting down bridge because of closed WebSocket connection"),ot!==null&&ot.shutdown(),fr())}}),ot.addListener("updateComponentFilters",function(bt){ut=bt}),je!=null&&ot!=null&&ot.addListener("updateConsolePatchSettings",function(bt){return ue(je,bt)}),window.__REACT_DEVTOOLS_COMPONENT_FILTERS__==null&&ot.send("overrideComponentFilters",ut);var Ot=new dm(ot);if(Ot.addListener("shutdown",function(){Te.emit("shutdown")}),jg(Te,Ot,window),q!=null||Te.resolveRNStyle!=null)Kg(ot,Ot,q||Te.resolveRNStyle,d||Te.nativeStyleEditorValidAttributes||null);else{var Rn,an,Vr=function(){ot!==null&&Kg(ot,Ot,Rn,an)};Te.hasOwnProperty("resolveRNStyle")||Object.defineProperty(Te,"resolveRNStyle",{enumerable:!1,get:function(){return Rn},set:function(Dr){Rn=Dr,Vr()}}),Te.hasOwnProperty("nativeStyleEditorValidAttributes")||Object.defineProperty(Te,"nativeStyleEditorValidAttributes",{enumerable:!1,get:function(){return an},set:function(Dr){an=Dr,Vr()}})}};function wr(){P&&Rt("WebSocket.onclose"),ot!==null&&ot.emit("shutdown"),fr()}function Br(){P&&Rt("WebSocket.onerror"),fr()}function Dn(Ot){var Rn;try{if(typeof Ot.data=="string")Rn=JSON.parse(Ot.data),P&&Rt("WebSocket.onmessage",Rn);else throw Error()}catch{console.error("[React DevTools] Failed to parse JSON: "+Ot.data);return}or.forEach(function(an){try{an(Rn)}catch(Vr){throw console.log("[React DevTools] Error calling listener",Rn),console.log("error:",Vr),Vr}})}}})(),i})())});var _R={};var RD,bD=xm(()=>{_D();RD=Me(SD(),1);RD.default.connectToDevTools()});var OD=Ar((ET,bR)=>{bR.exports={single:{topLeft:"\u250C",top:"\u2500",topRight:"\u2510",right:"\u2502",bottomRight:"\u2518",bottom:"\u2500",bottomLeft:"\u2514",left:"\u2502"},double:{topLeft:"\u2554",top:"\u2550",topRight:"\u2557",right:"\u2551",bottomRight:"\u255D",bottom:"\u2550",bottomLeft:"\u255A",left:"\u2551"},round:{topLeft:"\u256D",top:"\u2500",topRight:"\u256E",right:"\u2502",bottomRight:"\u256F",bottom:"\u2500",bottomLeft:"\u2570",left:"\u2502"},bold:{topLeft:"\u250F",top:"\u2501",topRight:"\u2513",right:"\u2503",bottomRight:"\u251B",bottom:"\u2501",bottomLeft:"\u2517",left:"\u2503"},singleDouble:{topLeft:"\u2553",top:"\u2500",topRight:"\u2556",right:"\u2551",bottomRight:"\u255C",bottom:"\u2500",bottomLeft:"\u2559",left:"\u2551"},doubleSingle:{topLeft:"\u2552",top:"\u2550",topRight:"\u2555",right:"\u2502",bottomRight:"\u255B",bottom:"\u2550",bottomLeft:"\u2558",left:"\u2502"},classic:{topLeft:"+",top:"-",topRight:"+",right:"|",bottomRight:"+",bottom:"-",bottomLeft:"+",left:"|"},arrow:{topLeft:"\u2198",top:"\u2193",topRight:"\u2199",right:"\u2190",bottomRight:"\u2196",bottom:"\u2191",bottomLeft:"\u2197",left:"\u2192"}}});var MD=Ar((IT,WE)=>{"use strict";var LD=OD();WE.exports=LD;WE.exports.default=LD});var Ay=Ar((SO,nI)=>{"use strict";var ay=(e,t)=>{for(let r of Reflect.ownKeys(t))Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));return e};nI.exports=ay;nI.exports.default=ay});var uy=Ar((RO,Xd)=>{"use strict";var fb=Ay(),zd=new WeakMap,ly=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,i=0,s=e.displayName||e.name||"",a=function(...u){if(zd.set(a,++i),i===1)r=e.apply(this,u),e=null;else if(t.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return r};return fb(a,e),zd.set(a,i),a};Xd.exports=ly;Xd.exports.default=ly;Xd.exports.callCount=e=>{if(!zd.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return zd.get(e)}});var _y=Ar((VO,vy)=>{"use strict";var Db=/[|\\{}()[\]^$+*?.-]/g;vy.exports=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(Db,"\\$&")}});var Fy=Ar(($O,by)=>{"use strict";var yb=_y(),Qb=typeof process=="object"&&process&&typeof process.cwd=="function"?process.cwd():".",Ry=[].concat(qr("module").builtinModules,"bootstrap_node","node").map(e=>new RegExp(`(?:\\((?:node:)?${e}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${e}(?:\\.js)?:\\d+:\\d+$)`));Ry.push(/\((?:node:)?internal\/[^:]+:\d+:\d+\)$/,/\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var iI=class e{constructor(t){t={ignoredPackages:[],...t},"internals"in t||(t.internals=e.nodeInternals()),"cwd"in t||(t.cwd=Qb),this._cwd=t.cwd.replace(/\\/g,"/"),this._internals=[].concat(t.internals,wb(t.ignoredPackages)),this._wrapCallSite=t.wrapCallSite||!1}static nodeInternals(){return[...Ry]}clean(t,r=0){r=" ".repeat(r),Array.isArray(t)||(t=t.split(` `)),!/^\s*at /.test(t[0])&&/^\s*at /.test(t[1])&&(t=t.slice(1));let i=!1,s=null,a=[];return t.forEach(u=>{if(u=u.replace(/\\/g,"/"),this._internals.some(E=>E.test(u)))return;let p=/^\s*at /.test(u);i?u=u.trimEnd().replace(/^(\s+)at /,"$1"):(u=u.trim(),p&&(u=u.slice(3))),u=u.replace(`${this._cwd}/`,""),u&&(p?(s&&(a.push(s),s=null),a.push(u)):(i=!0,s=u))}),a.map(u=>`${r}${u} `).join("")}captureString(t,r=this.captureString){typeof t=="function"&&(r=t,t=1/0);let{stackTraceLimit:i}=Error;t&&(Error.stackTraceLimit=t);let s={};Error.captureStackTrace(s,r);let{stack:a}=s;return Error.stackTraceLimit=i,this.clean(a)}capture(t,r=this.capture){typeof t=="function"&&(r=t,t=1/0);let{prepareStackTrace:i,stackTraceLimit:s}=Error;Error.prepareStackTrace=(p,E)=>this._wrapCallSite?E.map(this._wrapCallSite):E,t&&(Error.stackTraceLimit=t);let a={};Error.captureStackTrace(a,r);let{stack:u}=a;return Object.assign(Error,{prepareStackTrace:i,stackTraceLimit:s}),u}at(t=this.at){let[r]=this.capture(1,t);if(!r)return{};let i={line:r.getLineNumber(),column:r.getColumnNumber()};Sy(i,r.getFileName(),this._cwd),r.isConstructor()&&Object.defineProperty(i,"constructor",{value:!0,configurable:!0}),r.isEval()&&(i.evalOrigin=r.getEvalOrigin()),r.isNative()&&(i.native=!0);let s;try{s=r.getTypeName()}catch{}s&&s!=="Object"&&s!=="[object Object]"&&(i.type=s);let a=r.getFunctionName();a&&(i.function=a);let u=r.getMethodName();return u&&a!==u&&(i.method=u),i}parseLine(t){let r=t&&t.match(vb);if(!r)return null;let i=r[1]==="new",s=r[2],a=r[3],u=r[4],p=Number(r[5]),E=Number(r[6]),I=r[7],y=r[8],D=r[9],v=r[10]==="native",T=r[11]===")",P,Z={};if(y&&(Z.line=Number(y)),D&&(Z.column=Number(D)),T&&I){let ee=0;for(let W=I.length-1;W>0;W--)if(I.charAt(W)===")")ee++;else if(I.charAt(W)==="("&&I.charAt(W-1)===" "&&(ee--,ee===-1&&I.charAt(W-1)===" ")){let ie=I.slice(0,W-1);I=I.slice(W+1),s+=` (${ie}`;break}}if(s){let ee=s.match(_b);ee&&(s=ee[1],P=ee[2])}return Sy(Z,I,this._cwd),i&&Object.defineProperty(Z,"constructor",{value:!0,configurable:!0}),a&&(Z.evalOrigin=a,Z.evalLine=p,Z.evalColumn=E,Z.evalFile=u&&u.replace(/\\/g,"/")),v&&(Z.native=!0),s&&(Z.function=s),P&&s!==P&&(Z.method=P),Z}};function Sy(e,t,r){t&&(t=t.replace(/\\/g,"/"),t.startsWith(`${r}/`)&&(t=t.slice(r.length+1)),e.file=t)}function wb(e){if(e.length===0)return[];let t=e.map(r=>yb(r));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${t.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var vb=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),_b=/^(.*?) \[as (.*?)\]$/;by.exports=iI});var I0=Ar(pp=>{"use strict";var BF=qt(),DF=Symbol.for("react.element"),yF=Symbol.for("react.fragment"),QF=Object.prototype.hasOwnProperty,wF=BF.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,vF={key:!0,ref:!0,__self:!0,__source:!0};function E0(e,t,r){var i,s={},a=null,u=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(u=t.ref);for(i in t)QF.call(t,i)&&!vF.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps,t)s[i]===void 0&&(s[i]=t[i]);return{$$typeof:DF,type:e,key:a,ref:u,props:s,_owner:wF.current}}pp.Fragment=yF;pp.jsx=E0;pp.jsxs=E0});var Lt=Ar((h2,h0)=>{"use strict";h0.exports=I0()});var xn=Me(qt(),1);import{Stream as Lb}from"node:stream";import sp from"node:process";var Py=Me(qt(),1);import Ob from"node:process";function lC(e,t,{signal:r,edges:i}={}){let s,a=null,u=i!=null&&i.includes("leading"),p=i==null||i.includes("trailing"),E=()=>{a!==null&&(e.apply(s,a),s=void 0,a=null)},I=()=>{p&&E(),T()},y=null,D=()=>{y!=null&&clearTimeout(y),y=setTimeout(()=>{y=null,I()},t)},v=()=>{y!==null&&(clearTimeout(y),y=null)},T=()=>{v(),s=void 0,a=null},P=()=>{E()},Z=function(...ee){if(r?.aborted)return;s=this,a=ee;let W=y==null;D(),u&&W&&E()};return Z.schedule=D,Z.cancel=T,Z.flush=P,r?.addEventListener("abort",T,{once:!0}),Z}function uC(e,t=0,r={}){typeof r!="object"&&(r={});let{leading:i=!1,trailing:s=!0,maxWait:a}=r,u=Array(2);i&&(u[0]="leading"),s&&(u[1]="trailing");let p,E=null,I=lC(function(...v){p=e.apply(this,v),E=null},t,{edges:u}),y=function(...v){return a!=null&&(E===null&&(E=Date.now()),Date.now()-E>=a)?(p=e.apply(this,v),E=Date.now(),I.cancel(),I.schedule(),p):(I.apply(this,v),p)},D=()=>(I.flush(),p);return y.cancel=I.cancel,y.flush=D,y}function sd(e,t=0,r={}){let{leading:i=!0,trailing:s=!0}=r;return uC(e,t,{leading:i,maxWait:t,trailing:s})}var Ho={};Iv(Ho,{ConEmu:()=>IC,beep:()=>u_,beginSynchronizedOutput:()=>pC,clearScreen:()=>n_,clearTerminal:()=>s_,clearViewport:()=>o_,cursorBackward:()=>Hv,cursorDown:()=>Uv,cursorForward:()=>Gv,cursorGetPosition:()=>Kv,cursorHide:()=>Vv,cursorLeft:()=>gC,cursorMove:()=>Pv,cursorNextLine:()=>Jv,cursorPrevLine:()=>Yv,cursorRestorePosition:()=>jv,cursorSavePosition:()=>Wv,cursorShow:()=>$v,cursorTo:()=>Mv,cursorUp:()=>fC,endSynchronizedOutput:()=>mC,enterAlternativeScreen:()=>a_,eraseDown:()=>Zv,eraseEndLine:()=>zv,eraseLine:()=>dC,eraseLines:()=>qv,eraseScreen:()=>ad,eraseStartLine:()=>Xv,eraseUp:()=>e_,exitAlternativeScreen:()=>A_,iTerm:()=>EC,image:()=>f_,link:()=>c_,scrollDown:()=>r_,scrollUp:()=>t_,setCwd:()=>g_,synchronizedOutput:()=>l_});import yu from"node:process";import Tv from"node:os";var Du=globalThis.window?.document!==void 0,o1=globalThis.process?.versions?.node!==void 0,i1=globalThis.process?.versions?.bun!==void 0,s1=globalThis.Deno?.version?.deno!==void 0,a1=globalThis.process?.versions?.electron!==void 0,A1=globalThis.navigator?.userAgent?.includes("jsdom")===!0,l1=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,u1=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,c1=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,f1=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,df=globalThis.navigator?.userAgentData?.platform,g1=df==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",d1=df==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",p1=df==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",m1=df==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),E1=df==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var ir="\x1B[",Qu="\x1B]",ZA="\x07",pf=";",cC=!Du&&yu.env.TERM_PROGRAM==="Apple_Terminal",Ov=!Du&&yu.platform==="win32",Lv=!Du&&(yu.env.TERM?.startsWith("screen")||yu.env.TERM?.startsWith("tmux")||yu.env.TMUX!==void 0),Um=Du?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:yu.cwd,wu=e=>Lv?"\x1BPtmux;"+e.replaceAll("\x1B","\x1B\x1B")+"\x1B\\":e,Mv=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof t!="number"?ir+(e+1)+"G":ir+(t+1)+pf+(e+1)+"H"},Pv=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let r="";return e<0?r+=ir+-e+"D":e>0&&(r+=ir+e+"C"),t<0?r+=ir+-t+"A":t>0&&(r+=ir+t+"B"),r},fC=(e=1)=>ir+e+"A",Uv=(e=1)=>ir+e+"B",Gv=(e=1)=>ir+e+"C",Hv=(e=1)=>ir+e+"D",gC=ir+"G",Wv=cC?"\x1B7":ir+"s",jv=cC?"\x1B8":ir+"u",Kv=ir+"6n",Jv=ir+"E",Yv=ir+"F",Vv=ir+"?25l",$v=ir+"?25h",qv=e=>{let t="";for(let r=0;r{if(Du||!Ov)return!1;let e=Tv.release().split("."),t=Number(e[0]),r=Number(e[2]??0);return t<10||t===10&&r<10586},s_=i_()?`${ad}${ir}0f`:`${ad}${ir}3J${ir}H`,a_=ir+"?1049h",A_=ir+"?1049l",pC=ir+"?2026h",mC=ir+"?2026l",l_=e=>pC+e+mC,u_=ZA,c_=(e,t)=>{let r=wu(`${Qu}8${pf}${pf}${t}${ZA}`),i=wu(`${Qu}8${pf}${pf}${ZA}`);return r+e+i},f_=(e,t={})=>{let r=`${Qu}1337;File=inline=1`;t.width&&(r+=`;width=${t.width}`),t.height&&(r+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0");let i=Buffer.from(e);return wu(r+`;size=${i.byteLength}:`+i.toString("base64")+ZA)},EC={setCwd:(e=Um())=>wu(`${Qu}50;CurrentDir=${e}${ZA}`),annotation(e,t={}){let r=`${Qu}1337;`,i=t.x!==void 0,s=t.y!==void 0;if((i||s)&&!(i&&s&&t.length!==void 0))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replaceAll("|",""),r+=t.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",t.length>0?r+=(i?[e,t.length,t.x,t.y]:[t.length,e]).join("|"):r+=e,wu(r+ZA)}},IC={setCwd:(e=Um())=>wu(`${Qu}9;9;${e}${ZA}`)},g_=(e=Um())=>EC.setCwd(e)+IC.setCwd(e);import{env as mf}from"node:process";var d_=mf.CI!=="0"&&mf.CI!=="false"&&("CI"in mf||"CONTINUOUS_INTEGRATION"in mf||Object.keys(mf).some(e=>e.startsWith("CI_"))),el=d_;var p_=e=>{let t=new Set;do for(let r of Reflect.ownKeys(e))t.add([e,r]);while((e=Reflect.getPrototypeOf(e))&&e!==Object.prototype);return t};function Gm(e,{include:t,exclude:r}={}){let i=s=>{let a=u=>typeof u=="string"?s===u:u.test(s);return t?t.some(a):r?!r.some(a):!0};for(let[s,a]of p_(e.constructor.prototype)){if(a==="constructor"||!i(a))continue;let u=Reflect.getOwnPropertyDescriptor(s,a);u&&typeof u.value=="function"&&(e[a]=e[a].bind(e))}return e}var Uy=Me(jm(),1);import{PassThrough as QC}from"node:stream";var wC=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],Km={},m_=e=>{let t=new QC,r=new QC;t.write=s=>{e("stdout",s)},r.write=s=>{e("stderr",s)};let i=new console.Console(t,r);for(let s of wC)Km[s]=console[s],console[s]=i[s];return()=>{for(let s of wC)console[s]=Km[s];Km={}}},vC=m_;var E_=(()=>{var e=import.meta.url;return(function(t){t=t||{};var r;r||(r=typeof t<"u"?t:{});var i,s;r.ready=new Promise(function(Q,R){i=Q,s=R});var a=Object.assign({},r),u="";typeof document<"u"&&document.currentScript&&(u=document.currentScript.src),e&&(u=e),u.indexOf("blob:")!==0?u=u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):u="";var p=r.print||console.log.bind(console),E=r.printErr||console.warn.bind(console);Object.assign(r,a),a=null;var I;r.wasmBinary&&(I=r.wasmBinary);var y=r.noExitRuntime||!0;typeof WebAssembly!="object"&&ae("no native wasm support detected");var D,v=!1;function T(Q,R,H){H=R+H;for(var K="";!(R>=H);){var oe=Q[R++];if(!oe)break;if(oe&128){var Ie=Q[R++]&63;if((oe&224)==192)K+=String.fromCharCode((oe&31)<<6|Ie);else{var Ne=Q[R++]&63;oe=(oe&240)==224?(oe&15)<<12|Ie<<6|Ne:(oe&7)<<18|Ie<<12|Ne<<6|Q[R++]&63,65536>oe?K+=String.fromCharCode(oe):(oe-=65536,K+=String.fromCharCode(55296|oe>>10,56320|oe&1023))}}else K+=String.fromCharCode(oe)}return K}var P,Z,ee,W,ie,X,$,Ee,ye;function le(){var Q=D.buffer;P=Q,r.HEAP8=Z=new Int8Array(Q),r.HEAP16=W=new Int16Array(Q),r.HEAP32=X=new Int32Array(Q),r.HEAPU8=ee=new Uint8Array(Q),r.HEAPU16=ie=new Uint16Array(Q),r.HEAPU32=$=new Uint32Array(Q),r.HEAPF32=Ee=new Float32Array(Q),r.HEAPF64=ye=new Float64Array(Q)}var _e,ge=[],ct=[],ze=[];function be(){var Q=r.preRun.shift();ge.unshift(Q)}var se=0,x=null,j=null;function ae(Q){throw r.onAbort&&r.onAbort(Q),Q="Aborted("+Q+")",E(Q),v=!0,Q=new WebAssembly.RuntimeError(Q+". Build with -sASSERTIONS for more info."),s(Q),Q}function te(Q){return Q.startsWith("data:application/octet-stream;base64,")}var Ae;if(Ae="data:application/octet-stream;base64,AGFzbQEAAAABugM3YAF/AGACf38AYAF/AX9gA39/fwBgAn98AGACf38Bf2ADf39/AX9gBH9/f30BfWADf398AGAAAGAEf39/fwBgAX8BfGACf38BfGAFf39/f38Bf2AAAX9gA39/fwF9YAZ/f31/fX8AYAV/f39/fwBgAn9/AX1gBX9/f319AX1gAX8BfWADf35/AX5gB39/f39/f38AYAZ/f39/f38AYAR/f39/AX9gBn9/f319fQF9YAR/f31/AGADf399AX1gBn98f39/fwF/YAR/fHx/AGACf30AYAh/f39/f39/fwBgDX9/f39/f39/f39/f38AYAp/f39/f39/f39/AGAFf39/f38BfGAEfHx/fwF9YA1/fX1/f399fX9/f39/AX9gB39/f319f38AYAJ+fwF/YAN/fX0BfWABfAF8YAN/fHwAYAR/f319AGAHf39/fX19fQF9YA1/fX99f31/fX19fX1/AX9gC39/f39/f399fX19AX9gCH9/f39/f319AGAEf39+fgBgB39/f39/f38Bf2ACfH8BfGAFf398fH8AYAN/f38BfGAEf39/fABgA39/fQBgBn9/fX99fwF/ArUBHgFhAWEAHwFhAWIAAwFhAWMACQFhAWQAFgFhAWUAEQFhAWYAIAFhAWcAAAFhAWgAIQFhAWkAAwFhAWoAAAFhAWsAFwFhAWwACgFhAW0ABQFhAW4AAwFhAW8AAQFhAXAAFwFhAXEABgFhAXIAAAFhAXMAIgFhAXQACgFhAXUADQFhAXYAFgFhAXcAAgFhAXgAAwFhAXkAGAFhAXoAAgFhAUEAAQFhAUIAEQFhAUMAAQFhAUQAAAOiAqACAgMSBwcACRkDAAoRBgYKEwAPDxMBBiMTCgcHGgMUASQFJRQHAwMKCgMmAQYYDxobFAAKBw8KBwMDAgkCAAAFGwACBwIHBgIDAQMIDAABKAkHBQURACkZASoAAAIrLAIALQcHBy4HLwkFCgMCMA0xAgMJAgACAQYKAQIBBQEACQIFAQEABQAODQ0GFQIBHBUGAgkCEAAAAAUyDzMMBQYINAUCAwUODg41AgMCAgIDBgICNgIBDAwMAQsLCwsLCx0CAAIAAAABABABBQICAQMCEgMMCwEBAQEBAQsLAQICAwICAgICAgIDAgIICAEICAgEBAQEBAQEBAQABAQABAQEBAAEBAQBAQEICAEBAQEBAQEBCAgBAQEAAg4CAgUBAR4DBAcBcAHUAdQBBQcBAYACgIACBg0CfwFBkMQEC38BQQALByQIAUUCAAFGAG0BRwCwAQFIAK8BAUkAYQFKAQABSwAjAUwApgEJjQMBAEEBC9MBqwGqAaUB5QHiAZwB0AFazwHOAVlZWpsBmgGZAc0BzAHLAcoBWpgByQFZWVqbAZoBmQHIAccBxgGjAZcBpAGWAaMBvQKVAbwCxQG7Ajq6Ajq5ApQBuAI+twI+xAFqwwFqwgFqaWjBAcABvwGhAZcBtgK+AbUClgGhAbQCmAGzAjqxAjqwAr0BrwKuAq0CrAKrAqoCqAKnAqYCpQKkAqMCogKhArwBoAKfAp4CnQKcApsCmgKZApgClwKWApUClAKTApICkQKQAo8CjgKyAo0CjAKLAooCiAKHAqkChQI+hAK7AYMCggKBAoAC/gH9AfwB+QG6AfgBuQH3AfYB9QH0AfMB8gHxAYYC8AHvAbgB+wH6Ae4B7QG3AesBlQHqATrpAT7oAT7nAZQB0QE67AE+iQLmATrkAeMBOuEB4AHfAT7eAd0B3AG2AdsB2gHZAdgB1wHWAdUBtQHUAdMB0gH/AWloaWiPAZABsgGxAZEBhQGSAbQBswGRAa4BrQGsAakBqAGnAYUBCtj+A6ACMwEBfyAAQQEgABshAAJAA0AgABBhIgENAUGIxAAoAgAiAQRAIAERCQAMAQsLEAIACyABC+0BAgJ9A39DAADAfyEEAkACQAJAAkAgAkEHcSIGDgUCAQEBAAELQQMhBQwBCyAGQQFrQQJPDQEgAkHw/wNxQQR2IQcCfSACQQhxBEAgASAHEJ4BvgwBC0EAIAdB/w9xIgFrIAEgAsFBAEgbsgshAyAGQQFGBEAgAyADXA0BQwAAwH8gAyADQwAAgH9bIANDAACA/1tyIgEbIQQgAUUhBQwBCyADIANcDQBBAEECIANDAACAf1sgA0MAAID/W3IiARshBUMAAMB/IAMgARshBAsgACAFOgAEIAAgBDgCAA8LQfQNQakYQTpB+RYQCwALZwIBfQF/QwAAwH8hAgJAAkACQCABQQdxDgQCAAABAAtBxBJBqRhByQBBuhIQCwALIAFB8P8DcUEEdiEDIAFBCHEEQCAAIAMQngG+DwtBACADQf8PcSIAayAAIAHBQQBIG7IhAgsgAgt4AgF/AX0jAEEQayIEJAAgBEEIaiAAQQMgAkECR0EBdCABQf4BcUECRxsgAhAoQwAAwH8hBQJAAkACQCAELQAMQQFrDgIAAQILIAQqAgghBQwBCyAEKgIIIAOUQwrXIzyUIQULIARBEGokACAFQwAAAAAgBSAFWxsLeAIBfwF9IwBBEGsiBCQAIARBCGogAEEBIAJBAkZBAXQgAUH+AXFBAkcbIAIQKEMAAMB/IQUCQAJAAkAgBC0ADEEBaw4CAAECCyAEKgIIIQUMAQsgBCoCCCADlEMK1yM8lCEFCyAEQRBqJAAgBUMAAAAAIAUgBVsbC8wCAQV/IAAEQCAAQQRrIgEoAgAiBSEDIAEhAiAAQQhrKAIAIgAgAEF+cSIERwRAIAEgBGsiAigCBCIAIAIoAgg2AgggAigCCCAANgIEIAQgBWohAwsgASAFaiIEKAIAIgEgASAEakEEaygCAEcEQCAEKAIEIgAgBCgCCDYCCCAEKAIIIAA2AgQgASADaiEDCyACIAM2AgAgA0F8cSACakEEayADQQFyNgIAIAICfyACKAIAQQhrIgFB/wBNBEAgAUEDdkEBawwBCyABQR0gAWciAGt2QQRzIABBAnRrQe4AaiABQf8fTQ0AGkE/IAFBHiAAa3ZBAnMgAEEBdGtBxwBqIgAgAEE/TxsLIgFBBHQiAEHgMmo2AgQgAiAAQegyaiIAKAIANgIIIAAgAjYCACACKAIIIAI2AgRB6DpB6DopAwBCASABrYaENwMACwsOAEHYMigCABEJABBYAAunAQIBfQJ/IABBFGoiByACIAFBAkkiCCAEIAUQNSEGAkAgByACIAggBCAFEC0iBEMAAAAAYCADIARecQ0AIAZDAAAAAGBFBEAgAyEEDAELIAYgAyADIAZdGyEECyAAQRRqIgAgASACIAUQOCAAIAEgAhAwkiAAIAEgAiAFEDcgACABIAIQL5KSIgMgBCADIAReGyADIAQgBCAEXBsgBCAEWyADIANbcRsLvwEBA38gAC0AAEEgcUUEQAJAIAEhAwJAIAIgACIBKAIQIgAEfyAABSABEJ0BDQEgASgCEAsgASgCFCIFa0sEQCABIAMgAiABKAIkEQYAGgwCCwJAIAEoAlBBAEgNACACIQADQCAAIgRFDQEgAyAEQQFrIgBqLQAAQQpHDQALIAEgAyAEIAEoAiQRBgAgBEkNASADIARqIQMgAiAEayECIAEoAhQhBQsgBSADIAIQKxogASABKAIUIAJqNgIUCwsLCwYAIAAQIwtQAAJAAkACQAJAAkAgAg4EBAABAgMLIAAgASABQQxqEEMPCyAAIAEgAUEMaiADEEQPCyAAIAEgAUEMahBCDwsQJAALIAAgASABQQxqIAMQRQttAQF/IwBBgAJrIgUkACAEQYDABHEgAiADTHJFBEAgBSABQf8BcSACIANrIgNBgAIgA0GAAkkiARsQKhogAUUEQANAIAAgBUGAAhAmIANBgAJrIgNB/wFLDQALCyAAIAUgAxAmCyAFQYACaiQAC/ICAgJ/AX4CQCACRQ0AIAAgAToAACAAIAJqIgNBAWsgAToAACACQQNJDQAgACABOgACIAAgAToAASADQQNrIAE6AAAgA0ECayABOgAAIAJBB0kNACAAIAE6AAMgA0EEayABOgAAIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIBNgIAIAMgAiAEa0F8cSIEaiICQQRrIAE2AgAgBEEJSQ0AIAMgATYCCCADIAE2AgQgAkEIayABNgIAIAJBDGsgATYCACAEQRlJDQAgAyABNgIYIAMgATYCFCADIAE2AhAgAyABNgIMIAJBEGsgATYCACACQRRrIAE2AgAgAkEYayABNgIAIAJBHGsgATYCACAEIANBBHFBGHIiBGsiAkEgSQ0AIAGtQoGAgIAQfiEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkEgayICQR9LDQALCyAAC4AEAQN/IAJBgARPBEAgACABIAIQFyAADwsgACACaiEDAkAgACABc0EDcUUEQAJAIABBA3FFBEAgACECDAELIAJFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICQQNxRQ0BIAIgA0kNAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgACADQQRrIgRLBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAtIAQF/IwBBEGsiBCQAIAQgAzYCDAJAIABFBEBBAEEAIAEgAiAEKAIMEHEMAQsgACgC9AMgACABIAIgBCgCDBBxCyAEQRBqJAALkwECAX0BfyMAQRBrIgYkACAGQQhqIABB6ABqIAAgAkEBdGovAWIQH0MAAMB/IQUCQAJAAkAgBi0ADEEBaw4CAAECCyAGKgIIIQUMAQsgBioCCCADlEMK1yM8lCEFCyAALQADQRB0QYCAwABxBEAgBSAAIAEgAiAEEFQiA0MAAAAAIAMgA1sbkiEFCyAGQRBqJAAgBQu1AQECfyAAKAIEQQFqIgEgACgCACICKALsAyACKALoAyICa0ECdU8EQANAIAAoAggiAUUEQCAAQQA2AgggAEIANwIADwsgACABKAIENgIAIAAgASgCCDYCBCAAIAEoAgA2AgggARAjIAAoAgRBAWoiASAAKAIAIgIoAuwDIAIoAugDIgJrQQJ1Tw0ACwsgACABNgIEIAIgAUECdGooAgAtABdBEHRBgIAwcUGAgCBGBEAgABB9CwuBAQIBfwF9IwBBEGsiAyQAIANBCGogAEEDIAJBAkdBAXQgAUH+AXFBAkcbIAIQU0MAAMB/IQQCQAJAAkAgAy0ADEEBaw4CAAECCyADKgIIIQQMAQsgAyoCCEMAAAAAlEMK1yM8lCEECyADQRBqJAAgBEMAAAAAl0MAAAAAIAQgBFsbC4EBAgF/AX0jAEEQayIDJAAgA0EIaiAAQQEgAkECRkEBdCABQf4BcUECRxsgAhBTQwAAwH8hBAJAAkACQCADLQAMQQFrDgIAAQILIAMqAgghBAwBCyADKgIIQwAAAACUQwrXIzyUIQQLIANBEGokACAEQwAAAACXQwAAAAAgBCAEWxsLeAICfQF/IAAgAkEDdGoiByoC+AMhBkMAAMB/IQUCQAJAAkAgBy0A/ANBAWsOAgABAgsgBiEFDAELIAYgA5RDCtcjPJQhBQsgAC0AF0EQdEGAgMAAcQR9IAUgAEEUaiABIAIgBBBUIgNDAAAAACADIANbG5IFIAULC1EBAX8CQCABKALoAyICIAEoAuwDRwRAIABCADcCBCAAIAE2AgAgAigCAC0AF0EQdEGAgDBxQYCAIEcNASAAEH0PCyAAQgA3AgAgAEEANgIICwvoAgECfwJAIAAgAUYNACABIAAgAmoiBGtBACACQQF0a00EQCAAIAEgAhArDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkEBayECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkEBayICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQQRrIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkEBayICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AA0AgAyABKAIANgIAIAFBBGohASADQQRqIQMgAkEEayICQQNLDQALCyACRQ0AA0AgAyABLQAAOgAAIANBAWohAyABQQFqIQEgAkEBayICDQALCyAAC5QCAgF8AX8CQCAAIAGiIgAQbCIERAAAAAAAAPA/oCAEIAREAAAAAAAAAABjGyIEIARiIgUgBJlELUMc6+I2Gj9jRXJFBEAgACAEoSEADAELIAUgBEQAAAAAAADwv6CZRC1DHOviNho/Y0VyRQRAIAAgBKFEAAAAAAAA8D+gIQAMAQsgACAEoSEAIAIEQCAARAAAAAAAAPA/oCEADAELIAMNACAAAnxEAAAAAAAAAAAgBQ0AGkQAAAAAAADwPyAERAAAAAAAAOA/ZA0AGkQAAAAAAADwP0QAAAAAAAAAACAERAAAAAAAAOC/oJlELUMc6+I2Gj9jGwugIQALIAAgAGIgASABYnIEQEMAAMB/DwsgACABo7YLkwECAX0BfyMAQRBrIgYkACAGQQhqIABB6ABqIAAgAkEBdGovAV4QH0MAAMB/IQUCQAJAAkAgBi0ADEEBaw4CAAECCyAGKgIIIQUMAQsgBioCCCADlEMK1yM8lCEFCyAALQADQRB0QYCAwABxBEAgBSAAIAEgAiAEEFQiA0MAAAAAIAMgA1sbkiEFCyAGQRBqJAAgBQtQAAJAAkACQAJAAkAgAg4EBAABAgMLIAAgASABQR5qEEMPCyAAIAEgAUEeaiADEEQPCyAAIAEgAUEeahBCDwsQJAALIAAgASABQR5qIAMQRQt+AgF/AX0jAEEQayIEJAAgBEEIaiAAQQMgAkECR0EBdCABQf4BcUECRxsgAhBQQwAAwH8hBQJAAkACQCAELQAMQQFrDgIAAQILIAQqAgghBQwBCyAEKgIIIAOUQwrXIzyUIQULIARBEGokACAFQwAAAACXQwAAAAAgBSAFWxsLfgIBfwF9IwBBEGsiBCQAIARBCGogAEEBIAJBAkZBAXQgAUH+AXFBAkcbIAIQUEMAAMB/IQUCQAJAAkAgBC0ADEEBaw4CAAECCyAEKgIIIQUMAQsgBCoCCCADlEMK1yM8lCEFCyAEQRBqJAAgBUMAAAAAl0MAAAAAIAUgBVsbC08AAkACQAJAIANB/wFxIgMOBAACAgECCyABIAEvAABB+P8DcTsAAA8LIAEgAS8AAEH4/wNxQQRyOwAADwsgACABIAJBAUECIANBAUYbEEwLNwEBfyABIAAoAgQiA0EBdWohASAAKAIAIQAgASACIANBAXEEfyABKAIAIABqKAIABSAACxEBAAtiAgJ9An8CQCAAKALkA0UNACAAQfwAaiIDIABBGmoiBC8BABAgIgIgAlwEQCADIABBGGoiBC8BABAgIgIgAlwNASADIAAvARgQIEMAAAAAXkUNAQsgAyAELwEAECAhAQsgAQtfAQN/IAEEQEEMEB4iAyABKQIENwIEIAMhAiABKAIAIgEEQCADIQQDQEEMEB4iAiABKQIENwIEIAQgAjYCACACIQQgASgCACIBDQALCyACIAAoAgA2AgAgACADNgIACwvXawMtfxx9AX4CfwJAIAAtAABBBHEEQCAAKAKgASAMRw0BCyAAKAKkASAAKAL0AygCDEcNAEEAIAAtAKgBIANGDQEaCyAAQoCAgPyLgIDAv383AoADIABCgYCAgBA3AvgCIABCgICA/IuAgMC/fzcC8AIgAEEANgKsAUEBCyErAkACQAJAAkAgACgCCARAIABBFGoiDkECQQEgBhAiIT4gDkECQQEgBhAhITwgDkEAQQEgBhAiITsgDkEAQQEgBhAhIUAgBCABIAUgAiAAKAL4AiAAQfACaiIOKgIAIAAoAvwCIAAqAvQCIAAqAoADIAAqAoQDID4gPJIiPiA7IECSIjwgACgC9AMiEBB7DQEgACgCrAEiEUUNAyAAQbABaiETA0AgBCABIAUgAiATIB1BGGxqIg4oAgggDioCACAOKAIMIA4qAgQgDioCECAOKgIUID4gPCAQEHsNAiAdQQFqIh0gEUcNAAsMAgsgCEUEQCAAKAKsASITRQ0CIABBsAFqIRADQAJAAkAgECAdQRhsIhFqIg4qAgAiPiA+XCABIAFcckUEQCA+IAGTi0MXt9E4XQ0BDAILIAEgAVsgPiA+W3INAQsCQCAQIBFqIhEqAgQiPiA+XCACIAJcckUEQCA+IAKTi0MXt9E4XQ0BDAILIAIgAlsgPiA+W3INAQsgESgCCCAERw0AIBEoAgwgBUYNAwsgEyAdQQFqIh1HDQALDAILAkAgAEHwAmoiDioCACI+ID5cIAEgAVxyRQRAID4gAZOLQxe30ThdDQEMBAsgASABWyA+ID5bcg0DCyAOQQAgACgC/AIgBUYbQQAgACgC+AIgBEYbQQACfyACIAJcIg4gACoC9AIiPiA+XHJFBEAgPiACk4tDF7fROF0MAQtBACA+ID5bDQAaIA4LGyEOCyAORSArcgRAIA4hHQwCCyAAIA4qAhA4ApQDIAAgDioCFDgCmAMgCkEMQRAgCBtqIgMgAygCAEEBajYCACAOIR0MAgtBACEdCyAGIUAgByFHIAtBAWohIiMAQaABayINJAACQAJAIARBAUYgASABW3JFBEAgDUGqCzYCICAAQQVB2CUgDUEgahAsDAELIAVBAUYgAiACW3JFBEAgDUHZCjYCECAAQQVB2CUgDUEQahAsDAELIApBAEEEIAgbaiILIAsoAgBBAWo2AgAgACAALQCIA0H8AXEgAC0AFEEDcSILIANBASADGyIsIAsbIg9BA3FyOgCIAyAAQawDaiIQIA9BAUdBA3QiC2ogAEEUaiIUQQNBAiAPQQJGGyIRIA8gQBAiIgY4AgAgECAPQQFGQQN0Ig5qIBQgESAPIEAQISIHOAIAIAAgFEEAIA8gQBAiIjw4ArADIAAgFEEAIA8gQBAhIjs4ArgDIABBvANqIhAgC2ogFCARIA8QMDgCACAOIBBqIBQgESAPEC84AgAgACAUQQAgDxAwOALAAyAAIBRBACAPEC84AsgDIAsgAEHMA2oiC2ogFCARIA8gQBA4OAIAIAsgDmogFCARIA8gQBA3OAIAIAAgFEEAIA8gQBA4OALQAyAAIBRBACAPIEAQNyI6OALYAyAGIAeSIT4gPCA7kiE8AkACQCAAKAIIIgsEQEMAAMB/IAEgPpMgBEEBRhshBkMAAMB/IAIgPJMgBUEBRhshPiAAAn0gBCAFckUEQCAAIABBAiAPIAYgQCBAECU4ApQDIABBACAPID4gRyBAECUMAQsgBEEDTyAFQQNPcg0EIA1BiAFqIAAgBiAGIAAqAswDIAAqAtQDkiAAKgK8A5IgACoCxAOSIjyTIgdDAAAAACAHQwAAAABeGyAGIAZcG0GBgAggBEEDdEH4//8HcXZB/wFxID4gPiAAKgLQAyA6kiAAKgLAA5IgACoCyAOSIjuTIgdDAAAAACAHQwAAAABeGyA+ID5cG0GBgAggBUEDdEH4//8HcXZB/wFxIAsREAAgDSoCjAEiPUMAAAAAYCANKgKIASIHQwAAAABgcUUEQCANID27OQMIIA0gB7s5AwAgAEEBQdwdIA0QLCANKgKMASIHQwAAAAAgB0MAAAAAXhshPSANKgKIASIHQwAAAAAgB0MAAAAAXhshBwsgCiAKKAIUQQFqNgIUIAogCUECdGoiCSAJKAIYQQFqNgIYIAAgAEECIA8gPCAHkiAGIARBAWtBAkkbIEAgQBAlOAKUAyAAQQAgDyA7ID2SID4gBUEBa0ECSRsgRyBAECULOAKYAwwBCwJAIAAoAuADRQRAIAAoAuwDIAAoAugDa0ECdSELDAELIA1BiAFqIAAQMgJAIA0oAogBRQRAQQAhCyANKAKMAUUNAQsgDUGAAWohEEEAIQsDQCANQQA2AoABIA0gDSkDiAE3A3ggECANKAKQARA8IA1BiAFqEC4gDSgCgAEiCQRAA0AgCSgCACEOIAkQJyAOIgkNAAsLIAtBAWohCyANQQA2AoABIA0oAowBIA0oAogBcg0ACwsgDSgCkAEiCUUNAANAIAkoAgAhDiAJECcgDiIJDQALCyALRQRAIAAgAEECIA8gBEEBa0EBSwR9IAEgPpMFIAAqAswDIAAqAtQDkiAAKgK8A5IgACoCxAOSCyBAIEAQJTgClAMgACAAQQAgDyAFQQFrQQFLBH0gAiA8kwUgACoC0AMgACoC2AOSIAAqAsADkiAAKgLIA5ILIEcgQBAlOAKYAwwBCwJAIAgNACAFQQJGIAIgPJMiBiAGW3EgBkMAAAAAX3EgBCAFckUgBEECRiABID6TIgdDAAAAAF9xcnJFDQAgACAAQQIgD0MAAAAAQwAAAAAgByAHQwAAAABdGyAHIARBAkYbIAcgB1wbIEAgQBAlOAKUAyAAIABBACAPQwAAAABDAAAAACAGIAZDAAAAAF0bIAYgBUECRhsgBiAGXBsgRyBAECU4ApgDDAELIAAQTyAAIAAtAIgDQfsBcToAiAMgABBeQQMhEyAALQAUQQJ2QQNxIQkCQAJAIA9BAkcNAAJAIAlBAmsOAgIAAQtBAiETDAELIAkhEwsgAC8AFSEnIBQgEyAPIEAQOCEGIBQgEyAPEDAhByAUIBMgDyBAEDchOyAUIBMgDxAvITpBACEQIBQgEUEAIBNBAkkbIhYgDyBAEDghPyAUIBYgDxAwIT0gFCAWIA8gQBA3IUEgFCAWIA8QLyFEIBQgFiAPIEAQYCFCIBQgFiAPEEshQyAAIA9BACABID6TIlAgBiAHkiA7IDqSkiJKID8gPZIgQSBEkpIiRiATQQFLIhkbIEAgQBB6ITsgACAPQQEgAiA8kyJRIEYgSiAZGyBHIEAQeiFFAkACQCAEIAUgGRsiHA0AIA1BiAFqIAAQMgJAAkAgDSgCiAEiDiANKAKMASIJckUNAANAIA4oAuwDIA4oAugDIg5rQQJ1IAlNDQQCQCAOIAlBAnRqKAIAIgkQeUUNACAQDQIgCRA7IgYgBlsgBotDF7fROF1xDQIgCRBAIgYgBlwEQCAJIRAMAQsgCSEQIAaLQxe30ThdDQILIA1BiAFqEC4gDSgCjAEiCSANKAKIASIOcg0ACwwBC0EAIRALIA0oApABIglFDQADQCAJKAIAIQ4gCRAnIA4iCQ0ACwsgDUGIAWogABAyIA0oAowBIQkCQCANKAKIASIORQRAQwAAAAAhPSAJRQ0BCyBFIEVcIiMgBUEAR3IhKCA7IDtcIiQgBEEAR3IhKUMAAAAAIT0DQCAOKALsAyAOKALoAyIOa0ECdSAJTQ0CIA4gCUECdGooAgAiDhB4AkAgDi8AFSAOLQAXQRB0ciIJQYCAMHFBgIAQRgRAIA4QdyAOIA4tAAAiCUEBciIOQfsBcSAOIAlBBHEbOgAADAELIAgEfyAOIA4tABRBA3EiCSAPIAkbIDsgRRB2IA4vABUgDi0AF0EQdHIFIAkLQYDgAHFBgMAARg0AIA5BFGohEQJAIA4gEEYEQCAQQQA2ApwBIBAgDDYCmAFDAAAAACEHDAELIBQtAABBAnZBA3EhCQJAAkAgD0ECRw0AQQMhEgJAIAlBAmsOAgIAAQtBAiESDAELIAkhEgsgDUGAgID+BzYCaCANQYCAgP4HNgJQIA1B+ABqIA5B/ABqIhcgDi8BHhAfIDsgRSASQQFLIh4bIT4CQAJAAkACQCANLQB8IgkOBAABAQABCwJAIBcgDi8BGBAgIgYgBlwNACAXIA4vARgQIEMAAAAAXkUNACAOKAL0Ay0ACEEBcSIJDQBDAADAf0MAAAAAIAkbIQcMAgtDAADAfyEGDAILIA0qAnghB0MAAMB/IQYCQCAJQQFrDgIBAAILIAcgPpRDCtcjPJQhBgwBCyAHIQYLIA4tABdBEHRBgIDAAHEEQCAGIBEgD0GBAiASQQN0dkEBcSA7EFQiBkMAAAAAIAYgBlsbkiEGCyAOKgL4AyEHQQAhH0EAIRgCQAJAAkAgDi0A/ANBAWsOAgEAAgsgOyAHlEMK1yM8lCEHCyAHIAdcDQAgB0MAAAAAYCEYCyAOKgKABCEHAkACQAJAIA4tAIQEQQFrDgIBAAILIEUgB5RDCtcjPJQhBwsgByAHXA0AIAdDAAAAAGAhHwsCQCAOAn0gBiAGXCIJID4gPlxyRQRAIA4qApwBIgcgB1sEQCAOKAL0Ay0AEEEBcUUNAyAOKAKYASAMRg0DCyARIBIgDyA7EDggESASIA8QMJIgESASIA8gOxA3IBEgEiAPEC+SkiIHIAYgBiAHXRsgByAGIAkbIAYgBlsgByAHW3EbDAELIBggHnEEQCARQQIgDyA7EDggEUECIA8QMJIgEUECIA8gOxA3IBFBAiAPEC+SkiIHIA4gD0EAIDsgOxAxIgYgBiAHXRsgByAGIAYgBlwbIAYgBlsgByAHW3EbDAELIB4gH0VyRQRAIBFBACAPIDsQOCARQQAgDxAwkiARQQAgDyA7EDcgEUEAIA8QL5KSIgcgDiAPQQEgRSA7EDEiBiAGIAddGyAHIAYgBiAGXBsgBiAGWyAHIAdbcRsMAQtBASEaIA1BATYCZCANQQE2AnggEUECQQEgOxAiIBFBAkEBIDsQIZIhPiARQQBBASA7ECIhPCARQQBBASA7ECEhOkMAAMB/IQdBASEVQwAAwH8hBiAYBEAgDiAPQQAgOyA7EDEhBiANQQA2AnggDSA+IAaSIgY4AmhBACEVCyA8IDqSITwgHwRAIA4gD0EBIEUgOxAxIQcgDUEANgJkIA0gPCAHkiIHOAJQQQAhGgsCQAJAAkAgAC0AF0EQdEGAgAxxQYCACEYiCSASQQJJIiBxRQRAIAkgJHINAiAGIAZcDQEMAgsgJCAGIAZbcg0CC0ECIRUgDUECNgJ4IA0gOzgCaCA7IQYLAkAgIEEBIAkbBEAgCSAjcg0CIAcgB1wNAQwCCyAjIAcgB1tyDQELQQIhGiANQQI2AmQgDSBFOAJQIEUhBwsCQCAXIA4vAXoQICI6IDpcDQACfyAVIB5yRQRAIBcgDi8BehAgIQcgDUEANgJkIA0gPCAGID6TIAeVkjgCUEEADAELIBogIHINASAXIA4vAXoQICEGIA1BADYCeCANIAYgByA8k5QgPpI4AmhBAAshGkEAIRULIA4vABZBD3EiCUUEQCAALQAVQQR2IQkLAkAgFUUgCUEFRiAeciAYIClyIAlBBEdycnINACANQQA2AnggDSA7OAJoIBcgDi8BehAgIgYgBlwNAEEAIRogFyAOLwF6ECAhBiANQQA2AmQgDSA7ID6TIAaVOAJQCyAOLwAWQQ9xIhhFBEAgAC0AFUEEdiEYCwJAICAgKHIgH3IgGEEFRnIgGkUgGEEER3JyDQAgDUEANgJkIA0gRTgCUCAXIA4vAXoQICIGIAZcDQAgFyAOLwF6ECAhBiANQQA2AnggDSAGIEUgPJOUOAJoCyAOIA9BAiA7IDsgDUH4AGogDUHoAGoQPyAOIA9BACBFIDsgDUHkAGogDUHQAGoQPyAOIA0qAmggDSoCUCAPIA0oAnggDSgCZCA7IEVBAEEFIAogIiAMED0aIA4gEkECdEH8JWooAgBBAnRqKgKUAyEGIBEgEiAPIDsQOCARIBIgDxAwkiARIBIgDyA7EDcgESASIA8QL5KSIgcgBiAGIAddGyAHIAYgBiAGXBsgBiAGWyAHIAdbcRsLIgc4ApwBCyAOIAw2ApgBCyA9IAcgESATQQEgOxAiIBEgE0EBIDsQIZKSkiE9CyANQYgBahAuIA0oAowBIgkgDSgCiAEiDnINAAsLIA0oApABIgkEQANAIAkoAgAhDiAJECcgDiIJDQALCyA7IEUgGRshByA9QwAAAACSIQYgC0ECTwRAIBQgEyAHEE0gC0EBa7OUIAaSIQYLIEIgQ5IhPiAFIAQgGRshGiBHIEAgGRshTSBAIEcgGRshSSANQdAAaiAAEDJBACAcIAYgB14iCxsgHCAcQQJGGyAcICdBgIADcSIfGyEeIBQgFiBFIDsgGRsiRBBNIU8gDSgCVCIRIA0oAlAiCXIEQEEBQQIgRCBEXCIpGyEtIAtFIBxBAUZyIS4gE0ECSSEZIABB8gBqIS8gAEH8AGohMCATQQJ0IgtB7CVqITEgC0HcJWohMiAWQQJ0Ig5B7CVqIRwgDkHcJWohICALQfwlaiEkIA5B/CVqISMgGkEARyIzIAhyITQgGkUiNSAIQQFzcSE2IBogH3JFITcgDUHwAGohOCANQYABaiEnQYECIBNBA3R2Qf8BcSEoIBpBAWtBAkkhOQNAIA1BADYCgAEgDUIANwN4AkAgACgC7AMiCyAAKALoAyIORg0AIAsgDmsiC0EASA0DIA1BiAFqIAtBAnVBACAnEEohECANKAKMASANKAJ8IA0oAngiC2siDmsgCyAOEDMhDiANIA0oAngiCzYCjAEgDSAONgJ4IA0pA5ABIVYgDSANKAJ8Ig42ApABIA0oAoABIRIgDSBWNwJ8IA0gEjYClAEgECALNgIAIAsgDkcEQCANIA4gCyAOa0EDakF8cWo2ApABCyALRQ0AIAsQJwsgFC0AACIOQQJ2QQNxIQsCQAJAIA5BA3EiDiAsIA4bIhJBAkcNAEEDIRACQCALQQJrDgICAAELQQIhEAwBCyALIRALIAAvABUhCyAUIBAgBxBNIT8CQCAJIBFyRQRAQwAAAAAhQ0EAIRFDAAAAACFCQwAAAAAhQUEAIRUMAQsgC0GAgANxISUgEEECSSEYIBBBAnQiC0HsJWohISALQdwlaiEqQQAhFUMAAAAAIUEgESEOQwAAAAAhQkMAAAAAIUNBACEXQwAAAAAhPQNAIAkoAuwDIAkoAugDIglrQQJ1IA5NDQQCQCAJIA5BAnRqKAIAIgkvABUgCS0AF0EQdHIiC0GAgDBxQYCAEEYgC0GA4ABxQYDAAEZyDQAgDUGIAWoiESAJQRRqIgsgKigCACADECggDS0AjAEhJiARIAsgISgCACADECggDS0AjAEhESAJIBs2AtwDIBUgJkEDRmohFSARQQNGIREgCyAQQQEgOxAiIUsgCyAQQQEgOxAhIU4gCSAXIAkgFxsiF0YhJiAJKgKcASE8IAsgEiAYIEkgQBA1IToCQCALIBIgGCBJIEAQLSIGQwAAAABgIAYgPF1xDQAgOkMAAAAAYEUEQCA8IQYMAQsgOiA8IDogPF4bIQYLIBEgFWohFQJAICVFQwAAAAAgPyAmGyI8IEsgTpIiOiA9IAaSkpIgB15Fcg0AIA0oAnggDSgCfEYNACAOIREMAwsgCRB5BEAgQiAJEDuSIUIgQyAJEEAgCSoCnAGUkyFDCyBBIDwgOiAGkpIiBpIhQSA9IAaSIT0gDSgCfCILIA0oAoABRwRAIAsgCTYCACANIAtBBGo2AnwMAQsgCyANKAJ4ayILQQJ1IhFBAWoiDkGAgICABE8NBSANQYgBakH/////AyALQQF1IiYgDiAOICZJGyALQfz///8HTxsgESAnEEohDiANKAKQASAJNgIAIA0gDSgCkAFBBGo2ApABIA0oAowBIA0oAnwgDSgCeCIJayILayAJIAsQMyELIA0gDSgCeCIJNgKMASANIAs2AnggDSkDkAEhViANIA0oAnwiCzYCkAEgDSgCgAEhESANIFY3AnwgDSARNgKUASAOIAk2AgAgCSALRwRAIA0gCyAJIAtrQQNqQXxxajYCkAELIAlFDQAgCRAnCyANQQA2AnAgDSANKQNQNwNoIDggDSgCWBA8IA1B0ABqEC4gDSgCcCIJBEADQCAJKAIAIQsgCRAnIAsiCQ0ACwtBACERIA1BADYCcCANKAJUIg4gDSgCUCIJcg0ACwtDAACAPyBCIEJDAACAP10bIEIgQkMAAAAAXhshPCANKAJ8IRcgDSgCeCEJAn0CQAJ9AkACQAJAIB5FDQAgFCAPQQAgQCBAEDUhBiAUIA9BACBAIEAQLSE6IBQgD0EBIEcgQBA1IT8gFCAPQQEgRyBAEC0hPSAGID8gE0EBSyILGyBKkyIGIAZbIAYgQV5xDQEgOiA9IAsbIEqTIgYgBlsgBiBBXXENASAAKAL0Ay0AFEEBcQ0AIEEgPEMAAAAAWw0DGiAAEDsiBiAGXA0CIEEgABA7QwAAAABbDQMaDAILIAchBgsgBiAGWw0CIAYhBwsgBwshBiBBjEMAAAAAIEFDAAAAAF0bIT8gBgwBCyAGIEGTIT8gBgshByA2RQRAAkAgCSAXRgRAQwAAAAAhQQwBC0MAAIA/IEMgQ0MAAIA/XRsgQyBDQwAAAABeGyE9QwAAAAAhQSAJIQ4DQCAOKAIAIgsqApwBITogC0EUaiIQIA8gGSBJIEAQNSFCAkAgECAPIBkgSSBAEC0iBkMAAAAAYCAGIDpdcQ0AIEJDAAAAAGBFBEAgOiEGDAELIEIgOiA6IEJdGyEGCwJAID9DAAAAAF0EQCAGIAsQQIyUIjpDAAAAAF4gOkMAAAAAXXJFDQEgCyATIA8gPyA9lSA6lCAGkiJCIAcgOxAlITogQiBCXCA6IDpcciA6IEJbcg0BIEEgOiAGk5IhQSALEEAgCyoCnAGUID2SIT0MAQsgP0MAAAAAXkUNACALEDsiQkMAAAAAXiBCQwAAAABdckUNACALIBMgDyA/IDyVIEKUIAaSIkMgByA7ECUhOiBDIENcIDogOlxyIDogQ1tyDQAgPCBCkyE8IEEgOiAGk5IhQQsgDkEEaiIOIBdHDQALID8gQZMiQiA9lSFLIEIgPJUhTiAALwAVQYCAA3FFIC5yISVDAAAAACFBIAkhCwNAIAsoAgAiDioCnAEhPCAOQRRqIhggDyAZIEkgQBA1IToCQCAYIA8gGSBJIEAQLSIGQwAAAABgIAYgPF1xDQAgOkMAAAAAYEUEQCA8IQYMAQsgOiA8IDogPF4bIQYLAn0gDiATIA8CfSBCQwAAAABdBEAgBiAGIA4QQIyUIjxDAAAAAFsNAhogBiA8kiA9QwAAAABbDQEaIEsgPJQgBpIMAQsgBiBCQwAAAABeRQ0BGiAGIA4QOyI8QwAAAABeIDxDAAAAAF1yRQ0BGiBOIDyUIAaSCyAHIDsQJQshQyAYIBNBASA7ECIhPCAYIBNBASA7ECEhOiAYIBZBASA7ECIhUiAYIBZBASA7ECEhUyANIEMgPCA6kiJUkiJVOAJoIA1BADYCYCBSIFOSITwCQCAOQfwAaiIQIA4vAXoQICI6IDpbBEAgECAOLwF6ECAhOiANQQA2AmQgDSA8IFUgVJMiPCA6lCA8IDqVIBkbkjgCeAwBCyAjKAIAIRACQCApDQAgDiAQQQN0aiIhKgL4AyE6QQAhEgJAAkACQCAhLQD8A0EBaw4CAQACCyBEIDqUQwrXIzyUIToLIDogOlwNACA6QwAAAABgIRILICUgNSASQQFzcXFFDQAgDi8AFkEPcSISBH8gEgUgAC0AFUEEdgtBBEcNACANQYgBaiAYICAoAgAgDxAoIA0tAIwBQQNGDQAgDUGIAWogGCAcKAIAIA8QKCANLQCMAUEDRg0AIA1BADYCZCANIEQ4AngMAQsgDkH4A2oiEiAQQQN0aiIQKgIAIToCQAJAAkACQCAQLQAEQQFrDgIBAAILIEQgOpRDCtcjPJQhOgsgOkMAAAAAYA0BCyANIC02AmQgDSBEOAJ4DAELAkACfwJAAkACQCAWQQJrDgICAAELIDwgDiAPQQAgRCA7EDGSITpBAAwCC0EBIRAgDSA8IA4gD0EBIEQgOxAxkiI6OAJ4IBNBAU0NDAwCCyA8IA4gD0EAIEQgOxAxkiE6QQALIRAgDSA6OAJ4CyANIDMgEiAQQQN0ajEABEIghkKAgICAIFFxIDogOlxyNgJkCyAOIA8gEyAHIDsgDUHgAGogDUHoAGoQPyAOIA8gFiBEIDsgDUHkAGogDUH4AGoQPyAOICMoAgBBA3RqIhAqAvgDIToCQAJAAkACQCAQLQD8A0EBaw4CAQACCyBEIDqUQwrXIzyUIToLQQEhECA6QwAAAABgDQELQQEhECAOLwAWQQ9xIhIEfyASBSAALQAVQQR2C0EERw0AIA1BiAFqIBggICgCACAPECggDS0AjAFBA0YNACANQYgBaiAYIBwoAgAgDxAoIA0tAIwBQQNGIRALIA4gDSoCaCI8IA0qAngiOiATQQFLIhIbIDogPCASGyAALQCIA0EDcSANKAJgIhggDSgCZCIhIBIbICEgGCASGyA7IEUgCCAQcSIQQQRBByAQGyAKICIgDBA9GiBBIEMgBpOSIUEgAAJ/IAAtAIgDIhBBBHFFBEBBACAOLQCIA0EEcUUNARoLQQQLIBBB+wFxcjoAiAMgC0EEaiILIBdHDQALCyA/IEGTIT8LIAAgAC0AiAMiC0H7AXFBBCA/QwAAAABdQQJ0IAtBBHFBAnYbcjoAiAMgFCATIA8gQBBgIBQgEyAPEEuSITogFCATIA8gQBB/IBQgEyAPEFKSIUsgFCATIAcQTSFCAn8CQAJ9ID9DAAAAAF5FIB5BAkdyRQRAIA1BiAFqIDAgLyAkKAIAQQF0ai8BABAfAkAgDS0AjAEEQCAUIA8gKCBJIEAQNSIGIAZbDQELQwAAAAAMAgtDAAAAACAUIA8gKCBJIEAQNSA6kyBLkyAHID+TkyI/QwAAAABeRQ0BGgsgP0MAAAAAYEUNASA/CyE8IBQtAABBBHZBB3EMAQsgPyE8IBQtAABBBHZBB3EiC0EAIAtBA2tBA08bCyELQwAAAAAhBgJAAkAgFQ0AQwAAAAAhPQJAAkACQAJAAkAgC0EBaw4FAAECBAMGCyA8QwAAAD+UIT0MBQsgPCE9DAQLIBcgCWsiC0EFSQ0CIEIgPCALQQJ1QQFrs5WSIUIMAgsgQiA8IBcgCWtBAnVBAWqzlSI9kiFCDAILIDxDAAAAP5QgFyAJa0ECdbOVIj0gPZIgQpIhQgwBC0MAAAAAIT0LIDogPZIhPSAAEHwhEgJAIAkgF0YiGARAQwAAAAAhP0MAAAAAIToMAQsgF0EEayElIDwgFbOVIU4gMigCACEhQwAAAAAhOkMAAAAAIT8gCSELA0AgDUGIAWogCygCACIOQRRqIhAgISAPECggPUMAAACAIE5DAAAAgCA8QwAAAABeGyJBIA0tAIwBQQNHG5IhPSAIBEACfwJAAkACQAJAIBNBAWsOAwECAwALQQEhFSAOQaADagwDC0EDIRUgDkGoA2oMAgtBACEVIA5BnANqDAELQQIhFSAOQaQDagshKiAOIBVBAnRqICoqAgAgPZI4ApwDCyAlKAIAIRUgDUGIAWogECAxKAIAIA8QKCA9QwAAAIAgQiAOIBVGG5JDAAAAgCBBIA0tAIwBQQNHG5IhPQJAIDRFBEAgPSAQIBNBASA7ECIgECATQQEgOxAhkiAOKgKcAZKSIT0gRCEGDAELIA4gEyA7EF0gPZIhPSASBEAgDhBOIUEgEEEAIA8gOxBBIUMgDioCmAMgEEEAQQEgOxAiIBBBAEEBIDsQIZKSIEEgQ5IiQZMiQyA/ID8gQ10bIEMgPyA/ID9cGyA/ID9bIEMgQ1txGyE/IEEgOiA6IEFdGyBBIDogOiA6XBsgOiA6WyBBIEFbcRshOgwBCyAOIBYgOxBdIkEgBiAGIEFdGyBBIAYgBiAGXBsgBiAGWyBBIEFbcRshBgsgC0EEaiILIBdHDQALCyA/IDqSIAYgEhshQQJ9IDkEQCAAIBYgDyBGIEGSIE0gQBAlIEaTDAELIEQgQSA3GyFBIEQLIT8gH0UEQCAAIBYgDyBGIEGSIE0gQBAlIEaTIUELIEsgPZIhPAJAIAhFDQAgCSELIBgNAANAIAsoAgAiFS8AFkEPcSIORQRAIAAtABVBBHYhDgsCQAJAAkACQCAOQQRrDgIAAQILIA1BiAFqIBVBFGoiECAgKAIAIA8QKEEEIQ4gDS0AjAFBA0YNASANQYgBaiAQIBwoAgAgDxAoIA0tAIwBQQNGDQEgFSAjKAIAQQN0aiIOKgL4AyE9AkACQAJAIA4tAPwDQQFrDgIBAAILIEQgPZRDCtcjPJQhPQsgPiEGID1DAAAAAGANAwsgFSAkKAIAQQJ0aioClAMhBiANIBVB/ABqIg4gFS8BehAgIjogOlsEfSAQIBZBASA7ECIgECAWQQEgOxAhkiAGIA4gFS8BehAgIjqUIAYgOpUgGRuSBSBBCzgCeCANIAYgECATQQEgOxAiIBAgE0EBIDsQIZKSOAKIASANQQA2AmggDUEANgJkIBUgDyATIAcgOyANQegAaiANQYgBahA/IBUgDyAWIEQgOyANQeQAaiANQfgAahA/IA0qAngiOiANKgKIASI9IBNBAUsiGCIOGyEGIB9BAEcgAC8AFUEPcUEER3EiECAZcSA9IDogDhsiOiA6XHIhDiAVIDogBiAPIA4gECAYcSAGIAZcciA7IEVBAUECIAogIiAMED0aID4hBgwCC0EFQQEgFC0AAEEIcRshDgsgFSAWIDsQXSEGIA1BiAFqIBVBFGoiECAgKAIAIhggDxAoID8gBpMhOgJAIA0tAIwBQQNHBEAgHCgCACESDAELIA1BiAFqIBAgHCgCACISIA8QKCANLQCMAUEDRw0AID4gOkMAAAA/lCIGQwAAAAAgBkMAAAAAXhuSIQYMAQsgDUGIAWogECASIA8QKCA+IQYgDS0AjAFBA0YNACANQYgBaiAQIBggDxAoIA0tAIwBQQNGBEAgPiA6QwAAAAAgOkMAAAAAXhuSIQYMAQsCQAJAIA5BAWsOAgIAAQsgPiA6QwAAAD+UkiEGDAELID4gOpIhBgsCfwJAAkACQAJAIBZBAWsOAwECAwALQQEhECAVQaADagwDC0EDIRAgFUGoA2oMAgtBACEQIBVBnANqDAELQQIhECAVQaQDagshDiAVIBBBAnRqIAYgTCAOKgIAkpI4ApwDIAtBBGoiCyAXRw0ACwsgCQRAIAkQJwsgPCBIIDwgSF4bIDwgSCBIIEhcGyBIIEhbIDwgPFtxGyFIIEwgT0MAAAAAIBsbIEGSkiFMIBtBAWohGyANKAJQIgkgEXINAAsLAkAgCEUNACAfRQRAIAAQfEUNAQsgACAWIA8CfSBGIESSIBpFDQAaIAAgFkECdEH8JWooAgBBA3RqIgkqAvgDIQYCQAJAAkAgCS0A/ANBAWsOAgEAAgsgTSAGlEMK1yM8lCEGCyAGQwAAAABgRQ0AIAAgD0GBAiAWQQN0dkEBcSBNIEAQMQwBCyBGIEySCyBHIEAQJSEGQwAAAAAhPCAALwAVQQ9xIQkCQAJAAkACQAJAAkACQAJAAkAgBiBGkyBMkyIGQwAAAABgRQRAQwAAAAAhQyAJQQJrDgICAQcLQwAAAAAhQyAJQQJrDgcBAAUGBAIDBgsgPiAGkiE+DAULID4gBkMAAAA/lJIhPgwECyAGIBuzIjqVITwgPiAGIDogOpKVkiE+DAMLID4gBiAbQQFqs5UiPJIhPgwCCyAbQQJJBEAMAgsgDUGIAWogABAyIAYgG0EBa7OVITwMAgsgBiAbs5UhQwsgDUGIAWogABAyIBtFDQELIBZBAnQiCUHcJWohECAJQfwlaiERIA1BOGohGCANQcgAaiEZIA1B8ABqIRUgDUGQAWohHCANQYABaiEfQQAhEgNAIA1BADYCgAEgDSANKQOIATcDeCAfIA0oApABEDwgDUEANgJwIA0gDSkDeCJWNwNoIBUgDSgCgAEiCxA8IA0oAmwhCQJAAkAgDSgCaCIOBEBDAAAAACE6QwAAAAAhP0MAAAAAIQYMAQtDAAAAACE6QwAAAAAhP0MAAAAAIQYgCUUNAQsDQCAOKALsAyAOKALoAyIOa0ECdSAJTQ0FAkAgDiAJQQJ0aigCACIJLwAVIAktABdBEHRyIhdBgIAwcUGAgBBGIBdBgOAAcUGAwABGcg0AIAkoAtwDIBJHDQIgCUEUaiEOIAkgESgCAEECdGoqApQDIj1DAAAAAGAEfyA9IA4gFkEBIDsQIiAOIBZBASA7ECGSkiI9IAYgBiA9XRsgPSAGIAYgBlwbIAYgBlsgPSA9W3EbIQYgCS0AFgUgF0EIdgtBD3EiFwR/IBcFIAAtABVBBHYLQQVHDQAgFC0AAEEIcUUNACAJEE4gDkEAIA8gOxBBkiI9ID8gPSA/XhsgPSA/ID8gP1wbID8gP1sgPSA9W3EbIj8gCSoCmAMgDkEAQQEgOxAiIA5BAEEBIDsQIZKSID2TIj0gOiA6ID1dGyA9IDogOiA6XBsgOiA6WyA9ID1bcRsiOpIiPSAGIAYgPV0bID0gBiAGIAZcGyAGIAZbID0gPVtxGyEGCyANQQA2AkggDSANKQNoNwNAIBkgDSgCcBA8IA1B6ABqEC4gDSgCSCIJBEADQCAJKAIAIQ4gCRAnIA4iCQ0ACwsgDUEANgJIIA0oAmwiCSANKAJoIg5yDQALCyANIA0pA2g3A4gBIBwgDSgCcBB1IA0gVjcDaCAVIAsQdSA+IE9DAAAAACASG5IhPiBDIAaSIT0gDSgCbCEJAkAgDSgCaCIOIA0oAogBRgRAIAkgDSgCjAFGDQELID4gP5IhQiA+ID2SIUsgPCA9kiEGA0AgDigC7AMgDigC6AMiDmtBAnUgCU0NBQJAIA4gCUECdGooAgAiCS8AFSAJLQAXQRB0ciIXQYCAMHFBgIAQRiAXQYDgAHFBgMAARnINACAJQRRqIQ4CQAJAAkACQAJAAkAgF0EIdkEPcSIXBH8gFwUgAC0AFUEEdgtBAWsOBQEDAgQABgsgFC0AAEEIcQ0ECyAOIBYgDyA7EFEhOiAJIBAoAgBBAnRqID4gOpI4ApwDDAQLIA4gFiAPIDsQYiE/AkACQAJAAkAgFkECaw4CAgABCyAJKgKUAyE6QQIhDgwCC0EBIQ4gCSoCmAMhOgJAIBYOAgIADwtBAyEODAELIAkqApQDITpBACEOCyAJIA5BAnRqIEsgP5MgOpM4ApwDDAMLAkACQAJAAkAgFkECaw4CAgABCyAJKgKUAyE/QQIhDgwCC0EBIQ4gCSoCmAMhPwJAIBYOAgIADgtBAyEODAELIAkqApQDIT9BACEOCyAJIA5BAnRqID4gPSA/k0MAAAA/lJI4ApwDDAILIA4gFiAPIDsQQSE6IAkgECgCAEECdGogPiA6kjgCnAMgCSARKAIAQQN0aiIXKgL4AyE/AkACQAJAIBctAPwDQQFrDgIBAAILIEQgP5RDCtcjPJQhPwsgP0MAAAAAYA0CCwJAAkACfSATQQFNBEAgCSoCmAMgDiAWQQEgOxAiIA4gFkEBIDsQIZKSITogBgwBCyAGITogCSoClAMgDiATQQEgOxAiIA4gE0EBIDsQIZKSCyI/ID9cIAkqApQDIkEgQVxyRQRAID8gQZOLQxe30ThdDQEMAgsgPyA/WyBBIEFbcg0BCyAJKgKYAyJBIEFcIg4gOiA6XHJFBEAgOiBBk4tDF7fROF1FDQEMAwsgOiA6Ww0AIA4NAgsgCSA/IDogD0EAQQAgOyBFQQFBAyAKICIgDBA9GgwBCyAJIEIgCRBOkyAOQQAgDyBEEFGSOAKgAwsgDUEANgI4IA0gDSkDaDcDMCAYIA0oAnAQPCANQegAahAuIA0oAjgiCQRAA0AgCSgCACEOIAkQJyAOIgkNAAsLIA1BADYCOCANKAJsIQkgDSgCaCIOIA0oAogBRw0AIAkgDSgCjAFHDQALCyANKAJwIgkEQANAIAkoAgAhDiAJECcgDiIJDQALCyALBEADQCALKAIAIQkgCxAnIAkiCw0ACwsgPCA+kiA9kiE+IBJBAWoiEiAbRw0ACwsgDSgCkAEiCUUNAANAIAkoAgAhCyAJECcgCyIJDQALCyAAQZQDaiIQIABBAiAPIFAgQCBAECU4AgAgAEGYA2oiESAAQQAgDyBRIEcgQBAlOAIAAkAgEEGBAiATQQN0dkEBcUECdGoCfQJAIB5BAUcEQCAALQAXQQNxIglBAkYgHkECR3INAQsgACATIA8gSCBJIEAQJQwBCyAeQQJHIAlBAkdyDQEgSiAAIA8gEyBIIEkgQBB0Ij4gSiAHkiIGIAYgPl4bID4gBiAGIAZcGyAGIAZbID4gPltxGyIGIAYgSl0bIEogBiAGIAZcGyAGIAZbIEogSltxGws4AgALAkAgEEGBAiAWQQN0dkEBcUECdGoCfQJAIBpBAUcEQCAaQQJHIgkgAC0AF0EDcSILQQJGcg0BCyAAIBYgDyBGIEySIE0gQBAlDAELIAkgC0ECR3INASBGIAAgDyAWIEYgTJIgTSBAEHQiByBGIESSIgYgBiAHXhsgByAGIAYgBlwbIAYgBlsgByAHW3EbIgYgBiBGXRsgRiAGIAYgBlwbIAYgBlsgRiBGW3EbCzgCAAsCQCAIRQ0AAkAgAC8AFUGAgANxQYCAAkcNACANQYgBaiAAEDIDQCANKAKMASIJIA0oAogBIgtyRQRAIA0oApABIglFDQIDQCAJKAIAIQsgCRAnIAsiCQ0ACwwCCyALKALsAyALKALoAyILa0ECdSAJTQ0DIAsgCUECdGooAgAiCS8AFUGA4ABxQYDAAEcEQCAJAn8CQAJAAkAgFkECaw4CAAECCyAJQZQDaiEOIBAqAgAgCSoCnAOTIQZBAAwCCyAJQZQDaiEOIBAqAgAgCSoCpAOTIQZBAgwBCyARKgIAIQYCQAJAIBYOAgABCgsgCUGYA2ohDiAGIAkqAqADkyEGQQEMAQsgCUGYA2ohDiAGIAkqAqgDkyEGQQMLQQJ0aiAGIA4qAgCTOAKcAwsgDUGIAWoQLgwACwALAkAgEyAWckEBcUUNACAWQQFxIRQgE0EBcSEVIA1BiAFqIAAQMgNAIA0oAowBIgkgDSgCiAEiC3JFBEAgDSgCkAEiCUUNAgNAIAkoAgAhCyAJECcgCyIJDQALDAILIAsoAuwDIAsoAugDIgtrQQJ1IAlNDQMCQCALIAlBAnRqKAIAIgkvABUgCS0AF0EQdHIiC0GAgDBxQYCAEEYgC0GA4ABxQYDAAEZyDQAgFQRAAn8CfwJAAkACQCATQQFrDgMAAQINCyAJQZgDaiEOIAlBqANqIQtBASESIBEMAwsgCUGUA2ohDkECIRIgCUGcA2oMAQsgCUGUA2ohDkEAIRIgCUGkA2oLIQsgEAshGyAJIBJBAnRqIBsqAgAgDioCAJMgCyoCAJM4ApwDCyAURQ0AAn8CfwJAAkACQCAWQQFrDgMAAQIMCyAJQZgDaiELIAlBqANqIRJBASEXIBEMAwsgCUGUA2ohCyAJQZwDaiESQQIMAQsgCUGUA2ohCyAJQaQDaiESQQALIRcgEAshDiAJIBdBAnRqIA4qAgAgCyoCAJMgEioCAJM4ApwDCyANQYgBahAuDAALAAsgAC8AFUGA4ABxICJBAUZyRQRAIAAtAABBCHFFDQELIAAgACAeIAQgE0EBSxsgDyAKICIgDEMAAAAAQwAAAAAgOyBFEH4aCyANKAJYIglFDQIDQCAJKAIAIQsgCRAnIAsiCQ0ACwwCCxACAAsgABBeCyANQaABaiQADAELECQACyAAIAM6AKgBIAAgACgC9AMoAgw2AqQBIB0NACAKIAooAggiAyAAKAKsASIOQQFqIgkgAyAJSxs2AgggDkEIRgRAIABBADYCrAFBACEOCyAIBH8gAEHwAmoFIAAgDkEBajYCrAEgACAOQRhsakGwAWoLIgMgBTYCDCADIAQ2AgggAyACOAIEIAMgATgCACADIAAqApQDOAIQIAMgACoCmAM4AhRBACEdCyAIBEAgACAAKQKUAzcCjAMgACAALQAAIgNBAXIiBEH7AXEgBCADQQRxGzoAAAsgACAMNgKgASArIB1Fcgs1AQF/IAEgACgCBCICQQF1aiEBIAAoAgAhACABIAJBAXEEfyABKAIAIABqKAIABSAACxECAAt9ACAAQRRqIgAgAUGBAiACQQN0dkH/AXEgAyAEEC0gACACQQEgBBAiIAAgAkEBIAQQIZKSIQQCQAJAAkACQCAFKAIADgMAAQADCyAGKgIAIgMgAyAEIAMgBF0bIAQgBFwbIQQMAQsgBCAEXA0BIAVBAjYCAAsgBiAEOAIACwuMAQIBfwF9IAAoAuQDRQRAQwAAAAAPCyAAQfwAaiIBIAAvARwQICICIAJbBEAgASAALwEcECAPCwJAIAAoAvQDLQAIQQFxDQAgASAALwEYECAiAiACXA0AIAEgAC8BGBAgQwAAAABdRQ0AIAEgAC8BGBAgjA8LQwAAgD9DAAAAACAAKAL0Ay0ACEEBcRsLcAIBfwF9IwBBEGsiBCQAIARBCGogACABQQJ0QdwlaigCACACEChDAADAfyEFAkACQAJAIAQtAAxBAWsOAgABAgsgBCoCCCEFDAELIAQqAgggA5RDCtcjPJQhBQsgBEEQaiQAIAVDAAAAACAFIAVbGwtHAQF/IAIvAAYiA0EHcQRAIAAgAUHoAGogAxAfDwsgAUHoAGohASACLwAOIgNBB3EEQCAAIAEgAxAfDwsgACABIAIvABAQHwtHAQF/IAIvAAIiA0EHcQRAIAAgAUHoAGogAxAfDwsgAUHoAGohASACLwAOIgNBB3EEQCAAIAEgAxAfDwsgACABIAIvABAQHwt7AAJAAkACQAJAIANBAWsOAgABAgsgAi8ACiIDQQdxRQ0BDAILIAIvAAgiA0EHcUUNAAwBCyACLwAEIgNBB3EEQAwBCyABQegAaiEBIAIvAAwiA0EHcQRAIAAgASADEB8PCyAAIAEgAi8AEBAfDwsgACABQegAaiADEB8LewACQAJAAkACQCADQQFrDgIAAQILIAIvAAgiA0EHcUUNAQwCCyACLwAKIgNBB3FFDQAMAQsgAi8AACIDQQdxBEAMAQsgAUHoAGohASACLwAMIgNBB3EEQCAAIAEgAxAfDwsgACABIAIvABAQHw8LIAAgAUHoAGogAxAfC84BAgN/An0jAEEQayIDJABBASEEIANBCGogAEH8AGoiBSAAIAFBAXRqQe4AaiIBLwEAEB8CQAJAIAMqAggiByACKgIAIgZcBEAgByAHWwRAIAItAAQhAgwCCyAGIAZcIQQLIAItAAQhAiAERQ0AIAMtAAwgAkH/AXFGDQELIAUgASAGIAIQOQNAIAAtAAAiAUEEcQ0BIAAgAUEEcjoAACAAKAIQIgEEQCAAIAERAAALIABBgICA/gc2ApwBIAAoAuQDIgANAAsLIANBEGokAAuFAQIDfwF+AkAgAEKAgICAEFQEQCAAIQUMAQsDQCABQQFrIgEgAEIKgCIFQvYBfiAAfKdBMHI6AAAgAEL/////nwFWIQIgBSEAIAINAAsLIAWnIgIEQANAIAFBAWsiASACQQpuIgNB9gFsIAJqQTByOgAAIAJBCUshBCADIQIgBA0ACwsgAQs3AQJ/QQQQHiICIAE2AgBBBBAeIgMgATYCAEHBOyAAQeI7QfooQb8BIAJB4jtB/ihBwAEgAxAHCw8AIAAgASACQQFBAhCLAQteAQF/IABBADYCDCAAIAM2AhACQCABBEAgAUGAgICABE8NASABQQJ0EB4hBAsgACAENgIAIAAgBCACQQJ0aiICNgIIIAAgBCABQQJ0ajYCDCAAIAI2AgQgAA8LEFgAC3kCAX8BfSMAQRBrIgMkACADQQhqIAAgAUECdEHcJWooAgAgAhBTQwAAwH8hBAJAAkACQCADLQAMQQFrDgIAAQILIAMqAgghBAwBCyADKgIIQwAAAACUQwrXIzyUIQQLIANBEGokACAEQwAAAACXQwAAAAAgBCAEWxsLnAoBC38jAEEQayIIJAAgASABLwAAQXhxIANyIgM7AAACQAJAAkACQAJAAkACQAJAAkACQCADQQhxBEAgA0H//wNxIgZBBHYhBCAGQT9NBH8gACAEQQJ0akEEagUgBEEEayIEIAAoAhgiACgCBCAAKAIAIgBrQQJ1Tw0CIAAgBEECdGoLIAI4AgAMCgsCfyACi0MAAABPXQRAIAKoDAELQYCAgIB4CyIEQf8PakH+H0sgBLIgAlxyRQRAIANBD3FBACAEa0GAEHIgBCACQwAAAABdG0EEdHIhAwwKCyAAIAAvAQAiC0EBajsBACALQYAgTw0DIAtBA00EQCAAIAtBAnRqIAI4AgQMCQsgACgCGCIDRQRAQRgQHiIDQgA3AgAgA0IANwIQIANCADcCCCAAIAM2AhgLAkAgAygCBCIEIAMoAghHBEAgBCACOAIAIAMgBEEEajYCBAwBCyAEIAMoAgAiB2siBEECdSIJQQFqIgZBgICAgARPDQECf0H/////AyAEQQF1IgUgBiAFIAZLGyAEQfz///8HTxsiBkUEQEEAIQUgCQwBCyAGQYCAgIAETw0GIAZBAnQQHiEFIAMoAgQgAygCACIHayIEQQJ1CyEKIAUgCUECdGoiCSACOAIAIAkgCkECdGsgByAEEDMhByADIAUgBkECdGo2AgggAyAJQQRqNgIEIAMoAgAhBCADIAc2AgAgBEUNACAEECMLIAAoAhgiBigCECIDIAYoAhQiAEEFdEcNByADQQFqQQBIDQAgA0H+////A0sNASADIABBBnQiACADQWBxQSBqIgQgACAESxsiAE8NByAAQQBODQILEAIAC0H/////ByEAIANB/////wdPDQULIAhBADYCCCAIQgA3AwAgCCAAEJ8BIAYoAgwhBCAIIAgoAgQiByAGKAIQIgBBH3FqIABBYHFqIgM2AgQgB0UEQCADQQFrIQUMAwsgA0EBayIFIAdBAWtzQR9LDQIgCCgCACEKDAMLQZUlQeEXQSJB3BcQCwALEFgACyAIKAIAIgogBUEFdkEAIANBIU8bQQJ0akEANgIACyAKIAdBA3ZB/P///wFxaiEDAkAgB0EfcSIHRQRAIABBAEwNASAAQSBtIQUgAEEfakE/TwRAIAMgBCAFQQJ0EDMaCyAAIAVBBXRrIgBBAEwNASADIAVBAnQiBWoiAyADKAIAQX9BICAAa3YiAEF/c3EgBCAFaigCACAAcXI2AgAMAQsgAEEATA0AQX8gB3QhDEEgIAdrIQkgAEEgTgRAIAxBf3MhDSADKAIAIQUDQCADIAUgDXEgBCgCACIFIAd0cjYCACADIAMoAgQgDHEgBSAJdnIiBTYCBCAEQQRqIQQgA0EEaiEDIABBP0shDiAAQSBrIQAgDg0ACyAAQQBMDQELIAMgAygCAEF/IAkgCSAAIAAgCUobIgVrdiAMcUF/c3EgBCgCAEF/QSAgAGt2cSIEIAd0cjYCACAAIAVrIgBBAEwNACADIAUgB2pBA3ZB/P///wFxaiIDIAMoAgBBf0EgIABrdkF/c3EgBCAFdnI2AgALIAYoAgwhACAGIAo2AgwgBiAIKAIEIgM2AhAgBiAIKAIINgIUIABFDQAgABAjIAYoAhAhAwsgBiADQQFqNgIQIAYoAgwgA0EDdkH8////AXFqIgAgACgCAEF+IAN3cTYCACABLwAAIQMLIANBB3EgC0EEdHJBCHIhAwsgASADOwAAIAhBEGokAAuPAQIBfwF9IwBBEGsiAyQAIANBCGogAEHoAGogAEHUAEHWACABQf4BcUECRhtqLwEAIgEgAC8BWCABQQdxGxAfQwAAwH8hBAJAAkACQCADLQAMQQFrDgIAAQILIAMqAgghBAwBCyADKgIIIAKUQwrXIzyUIQQLIANBEGokACAEQwAAAACXQwAAAAAgBCAEWxsL2AICBH8BfSMAQSBrIgMkAAJAIAAoAgwiAQRAIAAgACoClAMgACoCmAMgAREnACIFIAVbDQEgA0GqHjYCACAAQQVB2CUgAxAsECQACyADQRBqIAAQMgJAIAMoAhAiAiADKAIUIgFyRQ0AAkADQCABIAIoAuwDIAIoAugDIgJrQQJ1SQRAIAIgAUECdGooAgAiASgC3AMNAyABLwAVIAEtABdBEHRyIgJBgOAAcUGAwABHBEAgAkEIdkEPcSICBH8gAgUgAC0AFUEEdgtBBUYEQCAALQAUQQhxDQQLIAEtAABBAnENAyAEIAEgBBshBAsgA0EQahAuIAMoAhQiASADKAIQIgJyDQEMAwsLEAIACyABIQQLIAMoAhgiAQRAA0AgASgCACECIAEQIyACIgENAAsLIARFBEAgACoCmAMhBQwBCyAEEE4gBCoCoAOSIQULIANBIGokACAFC6EDAQh/AkAgACgC6AMiBSAAKALsAyIHRwRAA0AgACAFKAIAIgIoAuQDRwRAAkAgACgC9AMoAgAiAQRAIAIgACAGIAERBgAiAQ0BC0GIBBAeIgEgAigCEDYCECABIAIpAgg3AgggASACKQIANwIAIAFBFGogAkEUakHoABArGiABQgA3AoABIAFB/ABqIgNBADsBACABQgA3AogBIAFCADcCkAEgAyACQfwAahCgASABQZgBaiACQZgBakHQAhArGiABQQA2AvADIAFCADcC6AMgAigC7AMiAyACKALoAyIERwRAIAMgBGsiBEEASA0FIAEgBBAeIgM2AuwDIAEgAzYC6AMgASADIARqNgLwAyACKALoAyIEIAIoAuwDIghHBEADQCADIAQoAgA2AgAgA0EEaiEDIARBBGoiBCAIRw0ACwsgASADNgLsAwsgASACKQL0AzcC9AMgASACKAKEBDYChAQgASACKQL8AzcC/AMgAUEANgLkAwsgBSABNgIAIAEgADYC5AMLIAZBAWohBiAFQQRqIgUgB0cNAAsLDwsQAgALUAACQAJAAkACQAJAIAIOBAQAAQIDCyAAIAEgAUEwahBDDwsgACABIAFBMGogAxBEDwsgACABIAFBMGoQQg8LECQACyAAIAEgAUEwaiADEEULcAIBfwF9IwBBEGsiBCQAIARBCGogACABQQJ0QdwlaigCACACEDZDAADAfyEFAkACQAJAIAQtAAxBAWsOAgABAgsgBCoCCCEFDAELIAQqAgggA5RDCtcjPJQhBQsgBEEQaiQAIAVDAAAAACAFIAVbGwt5AgF/AX0jAEEQayIDJAAgA0EIaiAAIAFBAnRB7CVqKAIAIAIQU0MAAMB/IQQCQAJAAkAgAy0ADEEBaw4CAAECCyADKgIIIQQMAQsgAyoCCEMAAAAAlEMK1yM8lCEECyADQRBqJAAgBEMAAAAAl0MAAAAAIAQgBFsbC1QAAkACQAJAAkACQCACDgQEAAECAwsgACABIAFBwgBqEEMPCyAAIAEgAUHCAGogAxBEDwsgACABIAFBwgBqEEIPCxAkAAsgACABIAFBwgBqIAMQRQsvACAAIAJFQQF0IgIgASADEGAgACACIAEQS5IgACACIAEgAxB/IAAgAiABEFKSkgvOAQIDfwJ9IwBBEGsiAyQAQQEhBCADQQhqIABB/ABqIgUgACABQQF0akH2AGoiAS8BABAfAkACQCADKgIIIgcgAioCACIGXARAIAcgB1sEQCACLQAEIQIMAgsgBiAGXCEECyACLQAEIQIgBEUNACADLQAMIAJB/wFxRg0BCyAFIAEgBiACEDkDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQALCyADQRBqJAALzgECA38CfSMAQRBrIgMkAEEBIQQgA0EIaiAAQfwAaiIFIAAgAUEBdGpB8gBqIgEvAQAQHwJAAkAgAyoCCCIHIAIqAgAiBlwEQCAHIAdbBEAgAi0ABCECDAILIAYgBlwhBAsgAi0ABCECIARFDQAgAy0ADCACQf8BcUYNAQsgBSABIAYgAhA5A0AgAC0AACIBQQRxDQEgACABQQRyOgAAIAAoAhAiAQRAIAAgAREAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsgA0EQaiQACwoAIABBMGtBCkkLBQAQAgALBAAgAAsUACAABEAgACAAKAIAKAIEEQAACwsrAQF/IAAoAgwiAQRAIAEQIwsgACgCACIBBEAgACABNgIEIAEQIwsgABAjC4EEAQN/IwBBEGsiAyQAIABCADcCBCAAQcEgOwAVIABCADcCDCAAQoCAgICAgIACNwIYIAAgAC0AF0HgAXE6ABcgACAALQAAQeABcUEFcjoAACAAIAAtABRBgAFxOgAUIABBIGpBAEHOABAqGiAAQgA3AXIgAEGEgBA2AW4gAEEANgF6IABCADcCgAEgAEIANwKIASAAQgA3ApABIABCADcCoAEgAEKAgICAgICA4P8ANwKYASAAQQA6AKgBIABBrAFqQQBBxAEQKhogAEHwAmohBCAAQbABaiECA0AgAkKAgID8i4CAwL9/NwIQIAJCgYCAgBA3AgggAkKAgID8i4CAwL9/NwIAIAJBGGoiAiAERw0ACyAAQoCAgPyLgIDAv383AvACIABCgICA/IuAgMC/fzcCgAMgAEKBgICAEDcC+AIgAEKAgID+h4CA4P8ANwKUAyAAQoCAgP6HgIDg/wA3AowDIABBiANqIgIgAi0AAEH4AXE6AAAgAEGcA2pBAEHYABAqGiAAQQA6AIQEIABBgICA/gc2AoAEIABBADoA/AMgAEGAgID+BzYC+AMgACABNgL0AyABBEAgAS0ACEEBcQRAIAAgAC0AFEHzAXFBCHI6ABQgACAALwAVQfD/A3FBBHI7ABULIANBEGokACAADwsgA0GiGjYCACADEHIQJAALMwAgACABQQJ0QfwlaigCAEECdGoqApQDIABBFGoiACABQQEgAhAiIAAgAUEBIAIQIZKSC44DAQp/IwBB0AJrIgEkACAAKALoAyIDIAAoAuwDIgVHBEAgAUGMAmohBiABQeABaiEHIAFBIGohCCABQRxqIQkgAUEQaiEEA0AgAygCACICLQAXQRB0QYCAMHFBgIAgRgRAIAFBCGpBAEHEAhAqGiABQYCAgP4HNgIMIARBADoACCAEQgA3AgAgCUEAQcQBECoaIAghAANAIABCgICA/IuAgMC/fzcCECAAQoGAgIAQNwIIIABCgICA/IuAgMC/fzcCACAAQRhqIgAgB0cNAAsgAUKAgID8i4CAwL9/NwPwASABQoGAgIAQNwPoASABQoCAgPyLgIDAv383A+ABIAFCgICA/oeAgOD/ADcChAIgAUKAgID+h4CA4P8ANwL8ASABIAEtAPgBQfgBcToA+AEgBkEAQcAAECoaIAJBmAFqIAFBCGpBxAIQKxogAkIANwKMAyACIAItAAAiAEEBciIKQfsBcSAKIABBBHEbOgAAIAIQTyACEF4LIANBBGoiAyAFRw0ACwsgAUHQAmokAAtMAQF/QQEhAQJAIAAtAB5BB3ENACAALQAiQQdxDQAgAC0ALkEHcQ0AIAAtACpBB3ENACAALQAmQQdxDQAgAC0AKEEHcUEARyEBCyABC3YCAX8BfSMAQRBrIgQkACAEQQhqIAAgAUECdEHcJWooAgAgAhBQQwAAwH8hBQJAAkACQCAELQAMQQFrDgIAAQILIAQqAgghBQwBCyAEKgIIIAOUQwrXIzyUIQULIARBEGokACAFQwAAAACXQwAAAAAgBSAFWxsLogQCBn8CfgJ/QQghBAJAAkAgAEFHSw0AA0BBCCAEIARBCE0bIQRB6DopAwAiBwJ/QQggAEEDakF8cSAAQQhNGyIAQf8ATQRAIABBA3ZBAWsMAQsgAEEdIABnIgFrdkEEcyABQQJ0a0HuAGogAEH/H00NABpBPyAAQR4gAWt2QQJzIAFBAXRrQccAaiIBIAFBP08bCyIDrYgiCFBFBEADQCAIIAh6IgiIIQcCfiADIAinaiIDQQR0IgJB6DJqKAIAIgEgAkHgMmoiBkcEQCABIAQgABBjIgUNBSABKAIEIgUgASgCCDYCCCABKAIIIAU2AgQgASAGNgIIIAEgAkHkMmoiAigCADYCBCACIAE2AgAgASgCBCABNgIIIANBAWohAyAHQgGIDAELQeg6Qeg6KQMAQn4gA62JgzcDACAHQgGFCyIIQgBSDQALQeg6KQMAIQcLAkAgB1BFBEBBPyAHeadrIgZBBHQiAkHoMmooAgAhAQJAIAdCgICAgARUDQBB4wAhAyABIAJB4DJqIgJGDQADQCADRQ0BIAEgBCAAEGMiBQ0FIANBAWshAyABKAIIIgEgAkcNAAsgAiEBCyAAQTBqEGQNASABRQ0EIAEgBkEEdEHgMmoiAkYNBANAIAEgBCAAEGMiBQ0EIAEoAggiASACRw0ACwwECyAAQTBqEGRFDQMLQQAhBSAEIARBAWtxDQEgAEFHTQ0ACwsgBQwBC0EACwtwAgF/AX0jAEEQayIEJAAgBEEIaiAAIAFBAnRB7CVqKAIAIAIQKEMAAMB/IQUCQAJAAkAgBC0ADEEBaw4CAAECCyAEKgIIIQUMAQsgBCoCCCADlEMK1yM8lCEFCyAEQRBqJAAgBUMAAAAAIAUgBVsbC6ADAQN/IAEgAEEEaiIEakEBa0EAIAFrcSIFIAJqIAAgACgCACIBakEEa00EfyAAKAIEIgMgACgCCDYCCCAAKAIIIAM2AgQgBCAFRwRAIAAgAEEEaygCAEF+cWsiAyAFIARrIgQgAygCAGoiBTYCACAFQXxxIANqQQRrIAU2AgAgACAEaiIAIAEgBGsiATYCAAsCQCABIAJBGGpPBEAgACACakEIaiIDIAEgAmtBCGsiATYCACABQXxxIANqQQRrIAFBAXI2AgAgAwJ/IAMoAgBBCGsiAUH/AE0EQCABQQN2QQFrDAELIAFnIQQgAUEdIARrdkEEcyAEQQJ0a0HuAGogAUH/H00NABpBPyABQR4gBGt2QQJzIARBAXRrQccAaiIBIAFBP08bCyIBQQR0IgRB4DJqNgIEIAMgBEHoMmoiBCgCADYCCCAEIAM2AgAgAygCCCADNgIEQeg6Qeg6KQMAQgEgAa2GhDcDACAAIAJBCGoiATYCACABQXxxIABqQQRrIAE2AgAMAQsgACABakEEayABNgIACyAAQQRqBSADCwvmAwEFfwJ/QbAwKAIAIgEgAEEHakF4cSIDaiECAkAgA0EAIAEgAk8bDQAgAj8AQRB0SwRAIAIQFkUNAQtBsDAgAjYCACABDAELQfw7QTA2AgBBfwsiAkF/RwRAIAAgAmoiA0EQayIBQRA2AgwgAUEQNgIAAkACf0HgOigCACIABH8gACgCCAVBAAsgAkYEQCACIAJBBGsoAgBBfnFrIgRBBGsoAgAhBSAAIAM2AghBcCAEIAVBfnFrIgAgACgCAGpBBGstAABBAXFFDQEaIAAoAgQiAyAAKAIINgIIIAAoAgggAzYCBCAAIAEgAGsiATYCAAwCCyACQRA2AgwgAkEQNgIAIAIgAzYCCCACIAA2AgRB4DogAjYCAEEQCyACaiIAIAEgAGsiATYCAAsgAUF8cSAAakEEayABQQFyNgIAIAACfyAAKAIAQQhrIgFB/wBNBEAgAUEDdkEBawwBCyABQR0gAWciA2t2QQRzIANBAnRrQe4AaiABQf8fTQ0AGkE/IAFBHiADa3ZBAnMgA0EBdGtBxwBqIgEgAUE/TxsLIgFBBHQiA0HgMmo2AgQgACADQegyaiIDKAIANgIIIAMgADYCACAAKAIIIAA2AgRB6DpB6DopAwBCASABrYaENwMACyACQX9HC80BAgN/An0jAEEQayIDJABBASEEIANBCGogAEH8AGoiBSAAIAFBAXRqQSBqIgEvAQAQHwJAAkAgAyoCCCIHIAIqAgAiBlwEQCAHIAdbBEAgAi0ABCECDAILIAYgBlwhBAsgAi0ABCECIARFDQAgAy0ADCACQf8BcUYNAQsgBSABIAYgAhA5A0AgAC0AACIBQQRxDQEgACABQQRyOgAAIAAoAhAiAQRAIAAgAREAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsgA0EQaiQAC0ABAX8CQEGsOy0AAEEBcQRAQag7KAIAIQIMAQtBAUGAJxAMIQJBrDtBAToAAEGoOyACNgIACyACIAAgAUEAEBMLzQECA38CfSMAQRBrIgMkAEEBIQQgA0EIaiAAQfwAaiIFIAAgAUEBdGpBMmoiAS8BABAfAkACQCADKgIIIgcgAioCACIGXARAIAcgB1sEQCACLQAEIQIMAgsgBiAGXCEECyACLQAEIQIgBEUNACADLQAMIAJB/wFxRg0BCyAFIAEgBiACEDkDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQALCyADQRBqJAALDwAgASAAKAIAaiACOQMACw0AIAEgACgCAGorAwALCwAgAARAIAAQIwsLxwECBH8CfSMAQRBrIgIkACACQQhqIABB/ABqIgQgAEEeaiIFLwEAEB9BASEDAkACQCACKgIIIgcgASoCACIGXARAIAcgB1sEQCABLQAEIQEMAgsgBiAGXCEDCyABLQAEIQEgA0UNACACLQAMIAFB/wFxRg0BCyAEIAUgBiABEDkDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQALCyACQRBqJAALlgMCA34CfyAAvSICQjSIp0H/D3EiBEH/D0YEQCAARAAAAAAAAPA/oiIAIACjDwsgAkIBhiIBQoCAgICAgIDw/wBYBEAgAEQAAAAAAAAAAKIgACABQoCAgICAgIDw/wBRGw8LAn4gBEUEQEEAIQQgAkIMhiIBQgBZBEADQCAEQQFrIQQgAUIBhiIBQgBZDQALCyACQQEgBGuthgwBCyACQv////////8Hg0KAgICAgICACIQLIQEgBEH/B0oEQANAAkAgAUKAgICAgICACH0iA0IAUw0AIAMiAUIAUg0AIABEAAAAAAAAAACiDwsgAUIBhiEBIARBAWsiBEH/B0oNAAtB/wchBAsCQCABQoCAgICAgIAIfSIDQgBTDQAgAyIBQgBSDQAgAEQAAAAAAAAAAKIPCyABQv////////8HWARAA0AgBEEBayEEIAFCgICAgICAgARUIQUgAUIBhiEBIAUNAAsLIAJCgICAgICAgICAf4MgAUKAgICAgICACH0gBK1CNIaEIAFBASAEa62IIARBAEobhL8LiwEBA38DQCAAQQR0IgFB5DJqIAFB4DJqIgI2AgAgAUHoMmogAjYCACAAQQFqIgBBwABHDQALQTAQZBpBmDtBBjYCAEGcO0EANgIAEJwBQZw7Qcg7KAIANgIAQcg7QZg7NgIAQcw7QcMBNgIAQdA7QQA2AgAQjwFB0DtByDsoAgA2AgBByDtBzDs2AgALjwEBAn8jAEEQayIEJAACfUMAAAAAIAAvABVBgOAAcUUNABogBEEIaiAAQRRqIgBBASACQQJGQQF0IAFB/gFxQQJHGyIFIAIQNgJAIAQtAAxFDQAgBEEIaiAAIAUgAhA2IAQtAAxBA0YNACAAIAEgAiADEIEBDAELIAAgASACIAMQgAGMCyEDIARBEGokACADC4QBAQJ/AkACQCAAKALoAyICIAAoAuwDIgNGDQADQCACKAIAIAFGDQEgAkEEaiICIANHDQALDAELIAIgA0YNACABLQAXQRB0QYCAMHFBgIAgRgRAIAAgACgC4ANBAWs2AuADCyACIAJBBGoiASADIAFrEDMaIAAgA0EEazYC7ANBAQ8LQQALCwBByDEgACABEEkLPAAgAEUEQCACQQVHQQAgAhtFBEBBuDAgAyAEEEkaDwsgAyAEEHAaDwsgACABIAIgAyAEIAAoAgQRDQAaCyYBAX8jAEEQayIBJAAgASAANgIMQbgwQdglIAAQSRogAUEQaiQAC4cDAwN/BXwCfSAAKgKgA7siBiACoCECIAAqApwDuyIHIAGgIQggACgC9AMqAhgiC0MAAAAAXARAIAAqApADuyEJIAAqAowDIQwgACAHIAu7IgFBACAALQAAQRBxIgNBBHYiBBA0OAKcAyAAIAYgAUEAIAQQNDgCoAMgASAMuyIHohBsIgYgBmIiBEUgBplELUMc6+I2Gj9jcUUEQCAEIAZEAAAAAAAA8L+gmUQtQxzr4jYaP2NFciEFCyACIAmgIQogCCAHoCEHAn8gASAJohBsIgYgBmIiBEUEQEEAIAaZRC1DHOviNho/Yw0BGgsgBCAGRAAAAAAAAPC/oJlELUMc6+I2Gj9jRXILIQQgACAHIAEgA0EARyIDIAVxIAMgBUEBc3EQNCAIIAFBACADEDSTOAKMAyAAIAogASADIARxIAMgBEEBc3EQNCACIAFBACADEDSTOAKQAwsgACgC6AMiAyAAKALsAyIARwRAA0AgAygCACAIIAIQcyADQQRqIgMgAEcNAAsLC1UBAX0gAEEUaiIAIAEgAkECSSICIAQgBRA1IQYgACABIAIgBCAFEC0iBUMAAAAAYCADIAVecQR9IAUFIAZDAAAAAGBFBEAgAw8LIAYgAyADIAZdGwsLeAEBfwJAIAAoAgAiAgRAA0AgAUUNAiACIAEoAgQ2AgQgAiABKAIINgIIIAEoAgAhASAAKAIAIQAgAigCACICDQALCyAAIAEQPA8LAkAgAEUNACAAKAIAIgFFDQAgAEEANgIAA0AgASgCACEAIAEQIyAAIgENAAsLC5kCAgZ/AX0gAEEUaiEHQQMhBCAALQAUQQJ2QQNxIQUCQAJ/AkAgAUEBIAAoAuQDGyIIQQJGBEACQCAFQQJrDgIEAAILQQIhBAwDC0ECIQRBACAFQQFLDQEaCyAECyEGIAUhBAsgACAEIAggAyACIARBAkkiBRsQbiEKIAAgBiAIIAIgAyAFGxBuIQMgAEGcA2oiAEEBIAFBAkZBAXQiCCAFG0ECdGogCiAHIAQgASACECKSOAIAIABBAyABQQJHQQF0IgkgBRtBAnRqIAogByAEIAEgAhAhkjgCACAAIAhBASAGQQF2IgQbQQJ0aiADIAcgBiABIAIQIpI4AgAgACAJQQMgBBtBAnRqIAMgByAGIAEgAhAhkjgCAAvUAgEDfyMAQdACayIBJAAgAUEIakEAQcQCECoaIAFBADoAGCABQgA3AxAgAUGAgID+BzYCDCABQRxqQQBBxAEQKhogAUHgAWohAyABQSBqIQIDQCACQoCAgPyLgIDAv383AhAgAkKBgICAEDcCCCACQoCAgPyLgIDAv383AgAgAkEYaiICIANHDQALIAFCgICA/IuAgMC/fzcD8AEgAUKBgICAEDcD6AEgAUKAgID8i4CAwL9/NwPgASABQoCAgP6HgIDg/wA3AoQCIAFCgICA/oeAgOD/ADcC/AEgASABLQD4AUH4AXE6APgBIAFBjAJqQQBBwAAQKhogAEGYAWogAUEIakHEAhArGiAAQgA3AowDIAAgAC0AAEEBcjoAACAAEE8gACgC6AMiAiAAKALsAyIARwRAA0AgAigCABB3IAJBBGoiAiAARw0ACwsgAUHQAmokAAuuAgIKfwJ9IwBBIGsiASQAIAFBgAI7AB4gAEHuAGohByAAQfgDaiEFIABB8gBqIQggAEH2AGohCSAAQfwAaiEDQQAhAANAIAFBEGogAyAJIAFBHmogBGotAAAiAkEBdCIEaiIGLwEAEB8CQAJAIAEtABRFDQAgAUEIaiADIAYvAQAQHyABIAMgBCAIai8BABAfIAEtAAwgAS0ABEcNAAJAIAEqAggiDCAMXCIKIAEqAgAiCyALXHJFBEAgDCALk4tDF7fROF0NAQwCCyAKRSALIAtbcg0BCyABQRBqIAMgBi8BABAfDAELIAFBEGogAyAEIAdqLwEAEB8LIAUgAkEDdGoiAiABLQAUOgAEIAIgASgCEDYCAEEBIQQgACECQQEhACACRQ0ACyABQSBqJAALMgACf0EAIAAvABVBgOAAcUGAwABGDQAaQQEgABA7QwAAAABcDQAaIAAQQEMAAAAAXAsLewEBfSADIASTIgMgA1sEfUMAAAAAIABBFGoiACABIAIgBSAGEDUiByAEkyAHIAdcGyIHQ///f38gACABIAIgBSAGEC0iBSAEkyAFIAVcGyIEIAMgAyAEXhsiAyADIAddGyAHIAMgAyADXBsgAyADWyAHIAdbcRsFIAMLC98FAwR/BX0BfCAJQwAAAABdIAhDAAAAAF1yBH8gDQUgBSESIAEhEyADIRQgByERIAwqAhgiFUMAAAAAXARAIAG7IBW7IhZBAEEAEDQhEyADuyAWQQBBABA0IRQgBbsgFkEAQQAQNCESIAe7IBZBAEEAEDQhEQsCf0EAIAAgBEcNABogEiATk4tDF7fROF0gEyATXCINIBIgElxyRQ0AGkEAIBIgElsNABogDQshDAJAIAIgBkcNACAUIBRcIg0gESARXHJFBEAgESAUk4tDF7fROF0hDwwBCyARIBFbDQAgDSEPC0EBIQ5BASENAkAgDA0AIAEgCpMhAQJAIABFBEAgASABXCIAIAggCFxyRQRAQQAhDCABIAiTi0MXt9E4XUUNAgwDC0EAIQwgCCAIWw0BIAANAgwBCyAAQQJGIQwgAEECRw0AIARBAUcNACABIAhgDQECQCAIIAhcIgAgASABXHJFBEAgASAIk4tDF7fROF1FDQEMAwtBACENIAEgAVsNAkEBIQ0gAA0CC0EAIQ0MAQtBACENIAggCFwiACABIAVdRXINACAMRSABIAFcIhAgBSAFXHIgBEECR3JyDQBBASENIAEgCGANAEEAIQ0gACAQcg0AIAEgCJOLQxe30ThdIQ0LAkAgDw0AIAMgC5MhAQJAAkAgAkUEQCABIAFcIgIgCSAJXHJFBEBBACEAIAEgCZOLQxe30ThdRQ0CDAQLQQAhACAJIAlbDQEgAg0DDAELIAJBAkYhACACQQJHIAZBAUdyDQAgASAJYARADAMLIAkgCVwiACABIAFcckUEQCABIAmTi0MXt9E4XUUNAgwDC0EAIQ4gASABWw0CQQEhDiAADQIMAQsgCSAJXCICIAEgB11Fcg0AIABFIAEgAVwiBCAHIAdcciAGQQJHcnINACABIAlgDQFBACEOIAIgBHINASABIAmTi0MXt9E4XSEODAELQQAhDgsgDSAOcQsL4wEBA38jAEEQayIBJAACQAJAIAAtABRBCHFFDQBBASEDIAAvABVB8AFxQdAARg0AIAEgABAyIAEoAgQhAAJAIAEoAgAiAkUEQEEAIQMgAEUNAQsDQCACKALsAyACKALoAyICa0ECdSAATQ0DIAIgAEECdGooAgAiAC8AFSAALQAXQRB0ciIAQYDgAHFBgMAARyAAQYAecUGACkZxIgMNASABEC4gASgCBCIAIAEoAgAiAnINAAsLIAEoAggiAEUNAANAIAAoAgAhAiAAECMgAiIADQALCyABQRBqJAAgAw8LEAIAC7IBAQR/AkACQCAAKAIEIgMgACgCACIEKALsAyAEKALoAyIBa0ECdUkEQCABIANBAnRqIQIDQCACKAIAIgEtABdBEHRBgIAwcUGAgCBHDQMgASgC7AMgASgC6ANGDQJBDBAeIgIgBDYCBCACIAM2AgggAiAAKAIINgIAQQAhAyAAQQA2AgQgACABNgIAIAAgAjYCCCABIQQgASgC6AMiAiABKALsA0cNAAsLEAIACyAAEC4LC4wQAgx/B30jAEEgayINJAAgDUEIaiABEDIgDSgCCCIOIA0oAgwiDHIEQCADQQEgAxshFSAAQRRqIRQgBUEBaiEWA0ACQAJAAn8CQAJAAkACQAJAIAwgDigC7AMgDigC6AMiDmtBAnVJBEAgDiAMQQJ0aigCACILLwAVIAstABdBEHRyIgxBgIAwcUGAgBBGDQgCQAJAIAxBDHZBA3EOAwEKAAoLIAkhFyAKIRogASgC9AMtABRBBHFFBEAgACoClAMgFEECQQEQMCAUQQJBARAvkpMhFyAAKgKYAyAUQQBBARAwIBRBAEEBEC+SkyEaCyALQRRqIQ8gAS0AFEECdkEDcSEQAkACfwJAIANBAkciE0UEQEEAIQ5BAyEMAkAgEEECaw4CBAACC0ECIQwMAwtBAiEMQQAgEEEBSw0BGgsgDAshDiAQIQwLIA9BAkEBIBcQIiAPQQJBASAXECGSIR0gD0EAQQEgFxAiIRwgD0EAQQEgFxAhIRsgCyoC+AMhGAJAAkACQAJAIAstAPwDQQFrDgIBAAILIBggF5RDCtcjPJQhGAsgGEMAAAAAYEUNACAdIAsgA0EAIBcgFxAxkiEYDAELIA1BGGogDyALQTJqIhAgAxBFQwAAwH8hGCANLQAcRQ0AIA1BGGogDyAQIAMQRCANLQAcRQ0AIA1BGGogDyAQIAMQRSANLQAcQQNGDQAgDUEYaiAPIBAgAxBEIA0tABxBA0YNACALQQIgAyAAKgKUAyAUQQIgAxBLIBRBAiADEFKSkyAPQQIgAyAXEFEgD0ECIAMgFxCDAZKTIBcgFxAlIRgLIBwgG5IhHCALKgKABCEZAkACQAJAIAstAIQEQQFrDgIBAAILIBkgGpRDCtcjPJQhGQsgGUMAAAAAYEUNACAcIAsgA0EBIBogFxAxkiEZDAMLIA1BGGogDyALQTJqIhAQQwJAIA0tABxFDQAgDUEYaiAPIBAQQiANLQAcRQ0AIA1BGGogDyAQEEMgDS0AHEEDRg0AIA1BGGogDyAQEEIgDS0AHEEDRg0AIAtBACADIAAqApgDIBRBACADEEsgFEEAIAMQUpKTIA9BACADIBoQUSAPQQAgAyAaEIMBkpMgGiAXECUhGQwDC0MAAMB/IRkgGCAYXA0GIAtB/ABqIhAgC0H6AGoiEi8BABAgIhsgG1sNAwwFCyALLQAAQQhxDQggCxBPIAAgCyACIAstABRBA3EiDCAVIAwbIAQgFiAGIAsqApwDIAeSIAsqAqADIAiSIAkgChB+IBFyIQxBACERIAxBAXFFDQhBASERIAsgCy0AAEEBcjoAAAwICxACAAsgGCAYXCAZIBlcRg0BIAtB/ABqIhAgC0H6AGoiEi8BABAgIhsgG1wNASAYIBhcBEAgGSAckyAQIAsvAXoQIJQgHZIhGAwCCyAZIBlbDQELIBwgGCAdkyAQIBIvAQAQIJWSIRkLIBggGFwNASAZIBlbDQMLQQAMAQtBAQshEiALIBcgGCACQQFHIAxBAklxIBdDAAAAAF5xIBJxIhAbIBkgA0ECIBIgEBsgGSAZXCAXIBpBAEEGIAQgBSAGED0aIAsqApQDIA9BAkEBIBcQIiAPQQJBASAXECGSkiEYIAsqApgDIA9BAEEBIBcQIiAPQQBBASAXECGSkiEZC0EBIRAgCyAYIBkgA0EAQQAgFyAaQQFBASAEIAUgBhA9GiAAIAEgCyADIAxBASAXIBoQggEgACABIAsgAyAOQQAgFyAaEIIBIBFBAXFFBEAgCy0AAEEBcSEQCyABLQAUIhJBAnZBA3EhDAJAAn8CQAJAAkACQAJAAkACQAJAAkACfwJAIBNFBEBBACERQQMhDiAMQQJrDgIDDQELQQIhDkEAIAxBAUsNARoLIA4LIREgEkEEcUUNBCASQQhxRQ0BIAwhDgsgASEMIA8QXw0BDAILAkAgCy0ANEEHcQ0AIAstADhBB3ENACALLQBCQQdxDQAgDCEOIAEhDCALQUBrLwEAQQdxRQ0CDAELIAwhDgsgACEMCwJ/AkACQAJAIA5BAWsOAwABAgULIAtBmANqIQ4gC0GoA2ohE0EBIRIgDEGYA2oMAgsgC0GUA2ohDiALQZwDaiETQQIhEiAMQZQDagwBCyALQZQDaiEOIAtBpANqIRNBACESIAxBlANqCyEMIAsgEkECdGogDCoCACAOKgIAkyATKgIAkzgCnAMLIBFBAXFFDQUCQAJAIBFBAnEEQCABIQwgDxBfDQEMAgsgCy0ANEEHcQ0AIAstADhBB3ENACALLQBCQQdxDQAgASEMIAtBQGsvAQBBB3FFDQELIAAhDAsgEUEBaw4DAQIDAAsQJAALIAtBmANqIREgC0GoA2ohDkEBIRMgDEGYA2oMAgsgC0GUA2ohESALQZwDaiEOQQIhEyAMQZQDagwBCyALQZQDaiERIAtBpANqIQ5BACETIAxBlANqCyEMIAsgE0ECdGogDCoCACARKgIAkyAOKgIAkzgCnAMLIAsqAqADIRsgCyoCnAMgB0MAAAAAIA8QXxuTIRcCfQJAIAstADRBB3ENACALLQA4QQdxDQAgCy0AQkEHcQ0AIAtBQGsvAQBBB3ENAEMAAAAADAELIAgLIRogCyAXOAKcAyALIBsgGpM4AqADIBAhEQsgDUEIahAuIA0oAgwiDCANKAIIIg5yDQALCyANKAIQIgwEQANAIAwoAgAhACAMECMgACIMDQALCyANQSBqJAAgEUEBcQt2AgF/AX0jAEEQayIEJAAgBEEIaiAAIAFBAnRB7CVqKAIAIAIQUEMAAMB/IQUCQAJAAkAgBC0ADEEBaw4CAAECCyAEKgIIIQUMAQsgBCoCCCADlEMK1yM8lCEFCyAEQRBqJAAgBUMAAAAAl0MAAAAAIAUgBVsbC3gCAX8BfSMAQRBrIgQkACAEQQhqIABBAyACQQJHQQF0IAFB/gFxQQJHGyACEDZDAADAfyEFAkACQAJAIAQtAAxBAWsOAgABAgsgBCoCCCEFDAELIAQqAgggA5RDCtcjPJQhBQsgBEEQaiQAIAVDAAAAACAFIAVbGwt4AgF/AX0jAEEQayIEJAAgBEEIaiAAQQEgAkECRkEBdCABQf4BcUECRxsgAhA2QwAAwH8hBQJAAkACQCAELQAMQQFrDgIAAQILIAQqAgghBQwBCyAEKgIIIAOUQwrXIzyUIQULIARBEGokACAFQwAAAAAgBSAFWxsLoA0BBH8jAEEQayIJJAAgCUEIaiACQRRqIgggA0ECRkEBdEEBIARB/gFxQQJGIgobIgsgAxA2IAYgByAKGyEHAkACQAJAAkACQAJAIAktAAxFDQAgCUEIaiAIIAsgAxA2IAktAAxBA0YNACAIIAQgAyAHEIEBIABBFGogBCADEDCSIAggBCADIAcQIpIhBkEBIQMCQAJ/AkACQAJAAkAgBA4EAgMBAAcLQQIhAwwBC0EAIQMLIAMgC0YNAgJAAkAgBA4EAgIAAQYLIABBlANqIQNBAAwCCyAAQZQDaiEDQQAMAQsgAEGYA2ohA0EBCyEAIAMqAgAgAiAAQQJ0aioClAOTIAaTIQYLIAIgBEECdEHcJWooAgBBAnRqIAY4ApwDDAULIAlBCGogCCADQQJHQQF0QQMgChsiCiADEDYCQCAJLQAMRQ0AIAlBCGogCCAKIAMQNiAJLQAMQQNGDQACfwJAAkACQCAEDgQCAgABBQsgAEGUA2ohBUEADAILIABBlANqIQVBAAwBCyAAQZgDaiEFQQELIQEgBSoCACACQZQDaiIFIAFBAnRqKgIAkyAAQRRqIAQgAxAvkyAIIAQgAyAHECGTIAggBCADIAcQgAGTIQZBASEDAkACfwJAAkACQAJAIAQOBAIDAQAHC0ECIQMMAQtBACEDCyADIAtGDQICQAJAIAQOBAICAAEGCyAAQZQDaiEDQQAMAgsgAEGUA2ohA0EADAELIABBmANqIQNBAQshACADKgIAIAUgAEECdGoqAgCTIAaTIQYLIAIgBEECdEHcJWooAgBBAnRqIAY4ApwDDAULAkACQAJAIAUEQCABLQAUQQR2QQdxIgBBBUsNCEEBIAB0IgBBMnENASAAQQlxBEAgBEECdEHcJWooAgAhACAIIAQgAyAGEEEgASAAQQJ0IgBqIgEqArwDkiEGIAAgAmogAigC9AMtABRBAnEEfSAGBSAGIAEqAswDkgs4ApwDDAkLIAEgBEECdEHsJWooAgBBAnRqIgAqArwDIAggBCADIAYQYpIhBiACKAL0Ay0AFEECcUUEQCAGIAAqAswDkiEGCwJAAkACQAJAIAQOBAEBAgAICyABKgKUAyACKgKUA5MhB0ECIQMMAgsgASoCmAMgAioCmAOTIQdBASEDAkAgBA4CAgAHC0EDIQMMAQsgASoClAMgAioClAOTIQdBACEDCyACIANBAnRqIAcgBpM4ApwDDAgLIAIvABZBD3EiBUUEQCABLQAVQQR2IQULIAVBBUYEQCABLQAUQQhxRQ0CCyABLwAVQYCAA3FBgIACRgRAIAVBAmsOAgEHAwsgBUEISw0HQQEgBXRB8wNxDQYgBUECRw0CC0EAIQACfQJ/AkACQAJAAkACfwJAAkACQCAEDgQCAgABBAsgASoClAMhB0ECIQAgAUG8A2oMAgsgASoClAMhByABQcQDagwBCyABKgKYAyEHAkACQCAEDgIAAQMLQQMhACABQcADagwBC0EBIQAgAUHIA2oLIQUgByAFKgIAkyABQbwDaiIIIABBAnRqKgIAkyIHIAIoAvQDLQAUQQJxDQUaAkAgBA4EAAIDBAELQQMhACABQdADagwECxAkAAtBASEAIAFB2ANqDAILQQIhACABQcwDagwBC0EAIQAgAUHUA2oLIQUgByAFKgIAkyABIABBAnRqKgLMA5MLIAIgBEECdCIFQfwlaigCAEECdGoqApQDIAJBFGoiACAEQQEgBhAiIAAgBEEBIAYQIZKSk0MAAAA/lCAIIAVB3CVqKAIAIgVBAnRqKgIAkiAAIAQgAyAGEEGSIQYgAiAFQQJ0aiACKAL0Ay0AFEECcQR9IAYFIAYgASAFQQJ0aioCzAOSCzgCnAMMBgsgAS8AFUGAgANxQYCAAkcNBAsgASAEQQJ0QewlaigCAEECdGoiACoCvAMgCCAEIAMgBhBikiEGIAIoAvQDLQAUQQJxRQRAIAYgACoCzAOSIQYLAkACQCAEDgQBAQMAAgsgASoClAMgAioClAOTIQdBAiEDDAMLIAEqApgDIAIqApgDkyEHQQEhAwJAIAQOAgMAAQtBAyEDDAILECQACyABKgKUAyACKgKUA5MhB0EAIQMLIAIgA0ECdGogByAGkzgCnAMMAQsgBEECdEHcJWooAgAhACAIIAQgAyAGEEEgASAAQQJ0IgBqIgEqArwDkiEGIAAgAmogAigC9AMtABRBAnEEfSAGBSAGIAEqAswDkgs4ApwDCyAJQRBqJAALcAIBfwF9IwBBEGsiBCQAIARBCGogACABQQJ0QewlaigCACACEDZDAADAfyEFAkACQAJAIAQtAAxBAWsOAgABAgsgBCoCCCEFDAELIAQqAgggA5RDCtcjPJQhBQsgBEEQaiQAIAVDAAAAACAFIAVbGwscACAAIAFBCCACpyACQiCIpyADpyADQiCIpxAVCwUAEFgACzkAIABFBEBBAA8LAn8gAUGAf3FBgL8DRiABQf8ATXJFBEBB/DtBGTYCAEF/DAELIAAgAToAAEEBCwvEAgACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCABQQlrDhIACgsMCgsCAwQFDAsMDAoLBwgJCyACIAIoAgAiAUEEajYCACAAIAEoAgA2AgAPCwALIAIgAigCACIBQQRqNgIAIAAgATIBADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATMBADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATAAADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATEAADcDAA8LAAsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKwMAOQMADwsgACACIAMRAQALDwsgAiACKAIAIgFBBGo2AgAgACABNAIANwMADwsgAiACKAIAIgFBBGo2AgAgACABNQIANwMADwsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKQMANwMAC84BAgN/An0jAEEQayIDJABBASEEIANBCGogAEH8AGoiBSAAIAFBAXRqQegAaiIBLwEAEB8CQAJAIAMqAggiByACKgIAIgZcBEAgByAHWwRAIAItAAQhAgwCCyAGIAZcIQQLIAItAAQhAiAERQ0AIAMtAAwgAkH/AXFGDQELIAUgASAGIAIQOQNAIAAtAAAiAUEEcQ0BIAAgAUEEcjoAACAAKAIQIgEEQCAAIAERAAALIABBgICA/gc2ApwBIAAoAuQDIgANAAsLIANBEGokAAtdAQR/IAAoAgAhAgNAIAIsAAAiAxBXBEBBfyEEIAAgAkEBaiICNgIAIAFBzJmz5gBNBH9BfyADQTBrIgMgAUEKbCIEaiADIARB/////wdzShsFIAQLIQEMAQsLIAELrhQCEn8BfiMAQdAAayIIJAAgCCABNgJMIAhBN2ohFyAIQThqIRQCQAJAAkACQANAIAEhDSAHIA5B/////wdzSg0BIAcgDmohDgJAAkACQCANIgctAAAiCQRAA0ACQAJAIAlB/wFxIgFFBEAgByEBDAELIAFBJUcNASAHIQkDQCAJLQABQSVHBEAgCSEBDAILIAdBAWohByAJLQACIQogCUECaiIBIQkgCkElRg0ACwsgByANayIHIA5B/////wdzIhhKDQcgAARAIAAgDSAHECYLIAcNBiAIIAE2AkwgAUEBaiEHQX8hEgJAIAEsAAEiChBXRQ0AIAEtAAJBJEcNACABQQNqIQcgCkEwayESQQEhFQsgCCAHNgJMQQAhDAJAIAcsAAAiCUEgayIBQR9LBEAgByEKDAELIAchCkEBIAF0IgFBidEEcUUNAANAIAggB0EBaiIKNgJMIAEgDHIhDCAHLAABIglBIGsiAUEgTw0BIAohB0EBIAF0IgFBidEEcQ0ACwsCQCAJQSpGBEACfwJAIAosAAEiARBXRQ0AIAotAAJBJEcNACABQQJ0IARqQcABa0EKNgIAIApBA2ohCUEBIRUgCiwAAUEDdCADakGAA2soAgAMAQsgFQ0GIApBAWohCSAARQRAIAggCTYCTEEAIRVBACETDAMLIAIgAigCACIBQQRqNgIAQQAhFSABKAIACyETIAggCTYCTCATQQBODQFBACATayETIAxBgMAAciEMDAELIAhBzABqEIkBIhNBAEgNCCAIKAJMIQkLQQAhB0F/IQsCfyAJLQAAQS5HBEAgCSEBQQAMAQsgCS0AAUEqRgRAAn8CQCAJLAACIgEQV0UNACAJLQADQSRHDQAgAUECdCAEakHAAWtBCjYCACAJQQRqIQEgCSwAAkEDdCADakGAA2soAgAMAQsgFQ0GIAlBAmohAUEAIABFDQAaIAIgAigCACIKQQRqNgIAIAooAgALIQsgCCABNgJMIAtBf3NBH3YMAQsgCCAJQQFqNgJMIAhBzABqEIkBIQsgCCgCTCEBQQELIQ8DQCAHIRFBHCEKIAEiECwAACIHQfsAa0FGSQ0JIBBBAWohASAHIBFBOmxqQf8qai0AACIHQQFrQQhJDQALIAggATYCTAJAAkAgB0EbRwRAIAdFDQsgEkEATgRAIAQgEkECdGogBzYCACAIIAMgEkEDdGopAwA3A0AMAgsgAEUNCCAIQUBrIAcgAiAGEIcBDAILIBJBAE4NCgtBACEHIABFDQcLIAxB//97cSIJIAwgDEGAwABxGyEMQQAhEkGPCSEWIBQhCgJAAkACQAJ/AkACQAJAAkACfwJAAkACQAJAAkACQAJAIBAsAAAiB0FfcSAHIAdBD3FBA0YbIAcgERsiB0HYAGsOIQQUFBQUFBQUFA4UDwYODg4UBhQUFBQCBQMUFAkUARQUBAALAkAgB0HBAGsOBw4UCxQODg4ACyAHQdMARg0JDBMLIAgpA0AhGUGPCQwFC0EAIQcCQAJAAkACQAJAAkACQCARQf8BcQ4IAAECAwQaBQYaCyAIKAJAIA42AgAMGQsgCCgCQCAONgIADBgLIAgoAkAgDqw3AwAMFwsgCCgCQCAOOwEADBYLIAgoAkAgDjoAAAwVCyAIKAJAIA42AgAMFAsgCCgCQCAOrDcDAAwTC0EIIAsgC0EITRshCyAMQQhyIQxB+AAhBwsgFCENIAgpA0AiGVBFBEAgB0EgcSEQA0AgDUEBayINIBmnQQ9xQZAvai0AACAQcjoAACAZQg9WIQkgGUIEiCEZIAkNAAsLIAxBCHFFIAgpA0BQcg0DIAdBBHZBjwlqIRZBAiESDAMLIBQhByAIKQNAIhlQRQRAA0AgB0EBayIHIBmnQQdxQTByOgAAIBlCB1YhDSAZQgOIIRkgDQ0ACwsgByENIAxBCHFFDQIgCyAUIA1rIgdBAWogByALSBshCwwCCyAIKQNAIhlCAFMEQCAIQgAgGX0iGTcDQEEBIRJBjwkMAQsgDEGAEHEEQEEBIRJBkAkMAQtBkQlBjwkgDEEBcSISGwshFiAZIBQQRyENCyAPQQAgC0EASBsNDiAMQf//e3EgDCAPGyEMIAgpA0AiGUIAUiALckUEQCAUIQ1BACELDAwLIAsgGVAgFCANa2oiByAHIAtIGyELDAsLQQAhDAJ/Qf////8HIAsgC0H/////B08bIgoiEUEARyEQAkACfwJAAkAgCCgCQCIHQY4lIAcbIg0iD0EDcUUgEUVyDQADQCAPLQAAIgxFDQIgEUEBayIRQQBHIRAgD0EBaiIPQQNxRQ0BIBENAAsLIBBFDQICQCAPLQAARSARQQRJckUEQANAIA8oAgAiB0F/cyAHQYGChAhrcUGAgYKEeHENAiAPQQRqIQ8gEUEEayIRQQNLDQALCyARRQ0DC0EADAELQQELIRADQCAQRQRAIA8tAAAhDEEBIRAMAQsgDyAMRQ0CGiAPQQFqIQ8gEUEBayIRRQ0BQQAhEAwACwALQQALIgcgDWsgCiAHGyIHIA1qIQogC0EATgRAIAkhDCAHIQsMCwsgCSEMIAchCyAKLQAADQ0MCgsgCwRAIAgoAkAMAgtBACEHIABBICATQQAgDBApDAILIAhBADYCDCAIIAgpA0A+AgggCCAIQQhqIgc2AkBBfyELIAcLIQlBACEHAkADQCAJKAIAIg1FDQEgCEEEaiANEIYBIgpBAEgiDSAKIAsgB2tLckUEQCAJQQRqIQkgCyAHIApqIgdLDQEMAgsLIA0NDQtBPSEKIAdBAEgNCyAAQSAgEyAHIAwQKSAHRQRAQQAhBwwBC0EAIQogCCgCQCEJA0AgCSgCACINRQ0BIAhBBGogDRCGASINIApqIgogB0sNASAAIAhBBGogDRAmIAlBBGohCSAHIApLDQALCyAAQSAgEyAHIAxBgMAAcxApIBMgByAHIBNIGyEHDAgLIA9BACALQQBIGw0IQT0hCiAAIAgrA0AgEyALIAwgByAFERwAIgdBAE4NBwwJCyAIIAgpA0A8ADdBASELIBchDSAJIQwMBAsgBy0AASEJIAdBAWohBwwACwALIAANByAVRQ0CQQEhBwNAIAQgB0ECdGooAgAiAARAIAMgB0EDdGogACACIAYQhwFBASEOIAdBAWoiB0EKRw0BDAkLC0EBIQ4gB0EKTw0HA0AgBCAHQQJ0aigCAA0BIAdBAWoiB0EKRw0ACwwHC0EcIQoMBAsgCyAKIA1rIhAgCyAQShsiCSASQf////8Hc0oNAkE9IQogEyAJIBJqIgsgCyATSBsiByAYSg0DIABBICAHIAsgDBApIAAgFiASECYgAEEwIAcgCyAMQYCABHMQKSAAQTAgCSAQQQAQKSAAIA0gEBAmIABBICAHIAsgDEGAwABzECkMAQsLQQAhDgwDC0E9IQoLQfw7IAo2AgALQX8hDgsgCEHQAGokACAOC9kCAQR/IwBB0AFrIgUkACAFIAI2AswBIAVBoAFqIgJBAEEoECoaIAUgBSgCzAE2AsgBAkBBACABIAVByAFqIAVB0ABqIAIgAyAEEIoBQQBIBEBBfyEEDAELQQEgBiAAKAJMQQBOGyEGIAAoAgAhByAAKAJIQQBMBEAgACAHQV9xNgIACwJ/AkACQCAAKAIwRQRAIABB0AA2AjAgAEEANgIcIABCADcDECAAKAIsIQggACAFNgIsDAELIAAoAhANAQtBfyAAEJ0BDQEaCyAAIAEgBUHIAWogBUHQAGogBUGgAWogAyAEEIoBCyECIAgEQCAAQQBBACAAKAIkEQYAGiAAQQA2AjAgACAINgIsIABBADYCHCAAKAIUIQEgAEIANwMQIAJBfyABGyECCyAAIAAoAgAiACAHQSBxcjYCAEF/IAIgAEEgcRshBCAGRQ0ACyAFQdABaiQAIAQLfwIBfwF+IAC9IgNCNIinQf8PcSICQf8PRwR8IAJFBEAgASAARAAAAAAAAAAAYQR/QQAFIABEAAAAAAAA8EOiIAEQjAEhACABKAIAQUBqCzYCACAADwsgASACQf4HazYCACADQv////////+HgH+DQoCAgICAgIDwP4S/BSAACwsVACAARQRAQQAPC0H8OyAANgIAQX8LzgECA38CfSMAQRBrIgMkAEEBIQQgA0EIaiAAQfwAaiIFIAAgAUEBdGpBxABqIgEvAQAQHwJAAkAgAyoCCCIHIAIqAgAiBlwEQCAHIAdbBEAgAi0ABCECDAILIAYgBlwhBAsgAi0ABCECIARFDQAgAy0ADCACQf8BcUYNAQsgBSABIAYgAhA5A0AgAC0AACIBQQRxDQEgACABQQRyOgAAIAAoAhAiAQRAIAAgAREAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsgA0EQaiQAC9EDAEHUO0GoHBAcQdU7QYoWQQFBAUEAEBtB1jtB/RJBAUGAf0H/ABAEQdc7QfYSQQFBgH9B/wAQBEHYO0H0EkEBQQBB/wEQBEHZO0GUCkECQYCAfkH//wEQBEHaO0GLCkECQQBB//8DEARB2ztBsQpBBEGAgICAeEH/////BxAEQdw7QagKQQRBAEF/EARB3TtB+BhBBEGAgICAeEH/////BxAEQd47Qe8YQQRBAEF/EARB3ztBjxBCgICAgICAgICAf0L///////////8AEIQBQeA7QY4QQgBCfxCEAUHhO0GIEEEEEA1B4jtB9BtBCBANQeM7QaQZEA5B5DtBmSIQDkHlO0EEQZcZEAhB5jtBAkGwGRAIQec7QQRBvxkQCEHoO0GPFhAaQek7QQBB1CEQAUHqO0EAQboiEAFB6ztBAUHyIRABQew7QQJB5B4QAUHtO0EDQYMfEAFB7jtBBEGrHxABQe87QQVByB8QAUHwO0EEQd8iEAFB8TtBBUH9IhABQeo7QQBBriAQAUHrO0EBQY0gEAFB7DtBAkHwIBABQe07QQNBziAQAUHuO0EEQbMhEAFB7ztBBUGRIRABQfI7QQZB7h8QAUHzO0EHQaQjEAELJQAgAEH0JjYCACAALQAEBEAgACgCCEH9DxBmCyAAKAIIEAYgAAsDAAALJQAgAEHsJzYCACAALQAEBEAgACgCCEH9DxBmCyAAKAIIEAYgAAs3AQJ/QQQQHiICIAE2AgBBBBAeIgMgATYCAEGjOyAAQeI7QfooQcEBIAJB4jtB/ihBwgEgAxAHCzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBQALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQMACwkAIAEgABEAAAsHACAAEQ4ACzUBAX8gASAAKAIEIgJBAXVqIQEgACgCACEAIAEgAkEBcQR/IAEoAgAgAGooAgAFIAALEQAACzABAX8jAEEQayICJAAgAiABNgIIIAJBCGogABECACEAIAIoAggQBiACQRBqJAAgAAsMACABIAAoAgARAAALCQAgAEEBOgAEC9coAQJ/QaA7QaE7QaI7QQBBjCZBB0GPJkEAQY8mQQBB2RZBkSZBCBAFQQgQHiIAQoiAgIAQNwMAQaA7QZcbQQZBoCZBuCZBCSAAQQEQAEGkO0GlO0GmO0GgO0GMJkEKQYwmQQtBjCZBDEG4EUGRJkENEAVBBBAeIgBBDjYCAEGkO0HoFEECQcAmQcgmQQ8gAEEAEABBoDtBowxBAkHMJkHUJkEQQREQA0GgO0GAHEEDQaQnQbAnQRJBExADQbg7Qbk7Qbo7QQBBjCZBFEGPJkEAQY8mQQBB6RZBkSZBFRAFQQgQHiIAQoiAgIAQNwMAQbg7QegcQQJBuCdByCZBFiAAQQEQAEG7O0G8O0G9O0G4O0GMJkEXQYwmQRhBjCZBGUHPEUGRJkEaEAVBBBAeIgBBGzYCAEG7O0HoFEECQcAnQcgmQRwgAEEAEABBuDtBowxBAkHIJ0HUJkEdQR4QA0G4O0GAHEEDQaQnQbAnQRJBHxADQb47Qb87QcA7QQBBjCZBIEGPJkEAQY8mQQBB2hpBkSZBIRAFQb47QQFB+CdBjCZBIkEjEA9BvjtBkBtBAUH4J0GMJkEiQSMQA0G+O0HpCEECQfwnQcgmQSRBJRADQQgQHiIAQQA2AgQgAEEmNgIAQb47Qa0cQQRBkChBoChBJyAAQQAQAEEIEB4iAEEANgIEIABBKDYCAEG+O0GkEUEDQagoQbQoQSkgAEEAEABBCBAeIgBBADYCBCAAQSo2AgBBvjtByB1BA0G8KEHIKEErIABBABAAQQgQHiIAQQA2AgQgAEEsNgIAQb47QaYQQQNB0ChByChBLSAAQQAQAEEIEB4iAEEANgIEIABBLjYCAEG+O0HLHEEDQdwoQbAnQS8gAEEAEABBCBAeIgBBADYCBCAAQTA2AgBBvjtB0h1BAkHoKEHUJkExIABBABAAQQgQHiIAQQA2AgQgAEEyNgIAQb47QZcQQQJB8ChB1CZBMyAAQQAQAEHBO0GECkH4KEE0QZEmQTUQCkHiD0EAEEhB6g5BCBBIQYITQRAQSEHxFUEYEEhBgxdBIBBIQfAOQSgQSEHBOxAJQaM7Qf8aQfgoQTZBkSZBNxAKQYMXQQAQkwFB8A5BCBCTAUGjOxAJQcI7QYobQfgoQThBkSZBORAKQQQQHiIAQQg2AgBBBBAeIgFBCDYCAEHCO0GEG0HiO0H6KEE6IABB4jtB/ihBOyABEAdBBBAeIgBBADYCAEEEEB4iAUEANgIAQcI7QeUOQds7QdQmQTwgAEHbO0HIKEE9IAEQB0HCOxAJQcM7QcQ7QcU7QQBBjCZBPkGPJkEAQY8mQQBB+xtBkSZBPxAFQcM7QQFBhClBjCZBwABBwQAQD0HDO0HXDkEBQYQpQYwmQcAAQcEAEANBwztB0BpBAkGIKUHUJkHCAEHDABADQcM7QekIQQJBkClByCZBxABBxQAQA0EIEB4iAEEANgIEIABBxgA2AgBBwztB9w9BAkGQKUHIJkHHACAAQQAQAEEIEB4iAEEANgIEIABByAA2AgBBwztB6htBA0GYKUHIKEHJACAAQQAQAEEIEB4iAEEANgIEIABBygA2AgBBwztBnxtBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABBzAA2AgBBwztB0BRBBEGwKUHAKUHNACAAQQAQAEEIEB4iAEEANgIEIABBzgA2AgBBwztBiA1BBEGwKUHAKUHNACAAQQAQAEEIEB4iAEEANgIEIABBzwA2AgBBwztB3RNBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB0AA2AgBBwztB+QtBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB0QA2AgBBwztBuBBBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB0gA2AgBBwztB5RpBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB0wA2AgBBwztB/BRBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB1AA2AgBBwztBlRNBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB1QA2AgBBwztBtQpBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB1gA2AgBBwztBuBVBBEGwKUHAKUHNACAAQQAQAEEIEB4iAEEANgIEIABB1wA2AgBBwztBmw1BBEGwKUHAKUHNACAAQQAQAEEIEB4iAEEANgIEIABB2AA2AgBBwztB7RNBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB2QA2AgBBwztBxAlBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB2gA2AgBBwztB8QhBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB2wA2AgBBwztBhwlBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB3QA2AgBBwztB1BBBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB3gA2AgBBwztB5gxBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB3wA2AgBBwztBzBNBAkGQKUHIJkHHACAAQQAQAEEIEB4iAEEANgIEIABB4AA2AgBBwztBrAlBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB4QA2AgBBwztBnxZBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB4gA2AgBBwztBoRdBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB4wA2AgBBwztBvw1BA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB5AA2AgBBwztB+xNBAkGQKUHIJkHHACAAQQAQAEEIEB4iAEEANgIEIABB5QA2AgBBwztBkQ9BA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB5gA2AgBBwztBwQxBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB5wA2AgBBwztBvhNBAkGQKUHIJkHHACAAQQAQAEEIEB4iAEEANgIEIABB6AA2AgBBwztBsxdBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB6QA2AgBBwztBzw1BA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB6gA2AgBBwztBpQ9BA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB6wA2AgBBwztB0gxBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB7AA2AgBBwztBiRdBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB7QA2AgBBwztBrA1BA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB7gA2AgBBwztB9w5BA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB7wA2AgBBwztBrQxBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB8AA2AgBBwztB/RhBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB8QA2AgBBwztBshRBA0HIKUH+KEHcACAAQQAQAEEIEB4iAEEANgIEIABB8gA2AgBBwztBlBJBBEGwKUHAKUHNACAAQQAQAEEIEB4iAEEANgIEIABB8wA2AgBBwztBzhlBBEGwKUHAKUHNACAAQQAQAEEIEB4iAEEANgIEIABB9AA2AgBBwztB4g1BBEGwKUHAKUHNACAAQQAQAEEIEB4iAEEANgIEIABB9QA2AgBBwztBrRNBBEGwKUHAKUHNACAAQQAQAEEIEB4iAEEANgIEIABB9gA2AgBBwztB+gxBBEGwKUHAKUHNACAAQQAQAEEIEB4iAEEANgIEIABB9wA2AgBBwztBnhVBA0GkKUHIKEHLACAAQQAQAEEIEB4iAEEANgIEIABB+AA2AgBBwztBrxtBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABB+gA2AgBBwztB3BRBA0HcKUGwJ0H7ACAAQQAQAEEIEB4iAEEANgIEIABB/AA2AgBBwztBiQxBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABB/QA2AgBBwztBxhBBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABB/gA2AgBBwztB8hpBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABB/wA2AgBBwztBjRVBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABBgAE2AgBBwztBoRNBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABBgQE2AgBBwztBxwpBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABBggE2AgBBwztBwhVBA0HcKUGwJ0H7ACAAQQAQAEEIEB4iAEEANgIEIABBgwE2AgBBwztB4RBBAkHoKUHUJkGEASAAQQAQAEEIEB4iAEEANgIEIABBhQE2AgBBwztBuAlBAkHwKUH6KEGGASAAQQAQAEEIEB4iAEEANgIEIABBhwE2AgBBwztBrRZBAkHwKUH6KEGGASAAQQAQAEEIEB4iAEEANgIEIABBiAE2AgBBwztBqhdBAkHoKUHUJkGEASAAQQAQAEEIEB4iAEEANgIEIABBiQE2AgBBwztBmw9BAkHoKUHUJkGEASAAQQAQAEEIEB4iAEEANgIEIABBigE2AgBBwztBvxdBAkHoKUHUJkGEASAAQQAQAEEIEB4iAEEANgIEIABBiwE2AgBBwztBsg9BAkHoKUHUJkGEASAAQQAQAEEIEB4iAEEANgIEIABBjAE2AgBBwztBlRdBAkHoKUHUJkGEASAAQQAQAEEIEB4iAEEANgIEIABBjQE2AgBBwztBhA9BAkHoKUHUJkGEASAAQQAQAEEIEB4iAEEANgIEIABBjgE2AgBBwztBihlBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABBjwE2AgBBwztBwRRBAkHwKUH6KEGGASAAQQAQAEEIEB4iAEEANgIEIABBkAE2AgBBwztBnhJBA0H4KUGEKkGRASAAQQAQAEEIEB4iAEEANgIEIABBkgE2AgBBwztB0AlBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABBkwE2AgBBwztB/AhBAkHUKUHUJkH5ACAAQQAQAEEIEB4iAEEANgIEIABBlAE2AgBBwztB2RlBA0HcKUGwJ0H7ACAAQQAQAEEIEB4iAEEANgIEIABBlQE2AgBBwztBtBNBA0GMKkGYKkGWASAAQQAQAEEIEB4iAEEANgIEIABBlwE2AgBBwztBhxxBBEGgKkGgKEGYASAAQQAQAEEIEB4iAEEANgIEIABBmQE2AgBBwztBnBxBA0GwKkHIKEGaASAAQQAQAEEIEB4iAEEANgIEIABBmwE2AgBBwztBmgpBAkG8KkHUJkGcASAAQQAQAEEIEB4iAEEANgIEIABBnQE2AgBBwztBmQxBAkHEKkHUJkGeASAAQQAQAEEIEB4iAEEANgIEIABBnwE2AgBBwztBkxxBA0HMKkGwJ0GgASAAQQAQAEEIEB4iAEEANgIEIABBoQE2AgBBwztBuxZBA0HYKkHIKEGiASAAQQAQAEEIEB4iAEEANgIEIABBowE2AgBBwztBvxtBAkHkKkHUJkGkASAAQQAQAEEIEB4iAEEANgIEIABBpQE2AgBBwztB0xtBA0HYKkHIKEGiASAAQQAQAEEIEB4iAEEANgIEIABBpgE2AgBBwztBqB1BA0HsKkHIKEGnASAAQQAQAEEIEB4iAEEANgIEIABBqAE2AgBBwztBph1BAkGQKUHIJkHHACAAQQAQAEEIEB4iAEEANgIEIABBqQE2AgBBwztBuR1BA0H4KkHIKEGqASAAQQAQAEEIEB4iAEEANgIEIABBqwE2AgBBwztBtx1BAkGQKUHIJkHHACAAQQAQAEEIEB4iAEEANgIEIABBrAE2AgBBwztB3whBAkGQKUHIJkHHACAAQQAQAEEIEB4iAEEANgIEIABBrQE2AgBBwztB1whBAkGEK0HUJkGuASAAQQAQAEEIEB4iAEEANgIEIABBrwE2AgBBwztB3hVBAkGQKUHIJkHHACAAQQAQAEEIEB4iAEEANgIEIABBsAE2AgBBwztB3AlBAkGEK0HUJkGuASAAQQAQAEEIEB4iAEEANgIEIABBsQE2AgBBwztB6QlBBUGQK0GkK0GyASAAQQAQAEEIEB4iAEEANgIEIABBswE2AgBBwztB5w9BAkHwKUH6KEGGASAAQQAQAEEIEB4iAEEANgIEIABBtAE2AgBBwztB0Q9BAkHwKUH6KEGGASAAQQAQAEEIEB4iAEEANgIEIABBtQE2AgBBwztBhhNBAkHwKUH6KEGGASAAQQAQAEEIEB4iAEEANgIEIABBtgE2AgBBwztB+BVBAkHwKUH6KEGGASAAQQAQAEEIEB4iAEEANgIEIABBtwE2AgBBwztByxdBAkHwKUH6KEGGASAAQQAQAEEIEB4iAEEANgIEIABBuAE2AgBBwztBvw9BAkHwKUH6KEGGASAAQQAQAEEIEB4iAEEANgIEIABBuQE2AgBBwztB+QlBAkGsK0HUJkG6ASAAQQAQAEEIEB4iAEEANgIEIABBuwE2AgBBwztBzBVBA0H4KUGEKkGRASAAQQAQAEEIEB4iAEEANgIEIABBvAE2AgBBwztBqBJBA0H4KUGEKkGRASAAQQAQAEEIEB4iAEEANgIEIABBvQE2AgBBwztB5BlBA0H4KUGEKkGRASAAQQAQAEEIEB4iAEEANgIEIABBvgE2AgBBwztBqxVBAkHUKUHUJkH5ACAAQQAQAAtZAQF/IAAgACgCSCIBQQFrIAFyNgJIIAAoAgAiAUEIcQRAIAAgAUEgcjYCAEF/DwsgAEIANwIEIAAgACgCLCIBNgIcIAAgATYCFCAAIAEgACgCMGo2AhBBAAtHAAJAIAFBA00EfyAAIAFBAnRqQQRqBSABQQRrIgEgACgCGCIAKAIEIAAoAgAiAGtBAnVPDQEgACABQQJ0agsoAgAPCxACAAs4AQF/IAFBAEgEQBACAAsgAUEBa0EFdkEBaiIBQQJ0EB4hAiAAIAE2AgggAEEANgIEIAAgAjYCAAvSBQEJfyAAIAEvAQA7AQAgACABKQIENwIEIAAgASkCDDcCDCAAIAEoAhQ2AhQCQAJAIAEoAhgiA0UNAEEYEB4iBUEANgIIIAVCADcCACADKAIEIgEgAygCACICRwRAIAEgAmsiAkEASA0CIAUgAhAeIgE2AgAgBSABIAJqNgIIIAMoAgAiAiADKAIEIgZHBEADQCABIAIoAgA2AgAgAUEEaiEBIAJBBGoiAiAGRw0ACwsgBSABNgIECyAFQgA3AgwgBUEANgIUIAMoAhAiAUUNACAFQQxqIAEQnwEgAygCDCEGIAUgBSgCECIEIAMoAhAiAkEfcWogAkFgcWoiATYCEAJAAkAgBEUEQCABQQFrIQMMAQsgAUEBayIDIARBAWtzQSBJDQELIAUoAgwgA0EFdkEAIAFBIU8bQQJ0akEANgIACyAFKAIMIARBA3ZB/P///wFxaiEBIARBH3EiA0UEQCACQQBMDQEgAkEgbSEDIAJBH2pBP08EQCABIAYgA0ECdBAzGgsgAiADQQV0ayICQQBMDQEgASADQQJ0IgNqIgEgASgCAEF/QSAgAmt2IgFBf3NxIAMgBmooAgAgAXFyNgIADAELIAJBAEwNAEF/IAN0IQhBICADayEEIAJBIE4EQCAIQX9zIQkgASgCACEHA0AgASAHIAlxIAYoAgAiByADdHI2AgAgASABKAIEIAhxIAcgBHZyIgc2AgQgBkEEaiEGIAFBBGohASACQT9LIQogAkEgayECIAoNAAsgAkEATA0BCyABIAEoAgBBfyAEIAQgAiACIARKGyIEa3YgCHFBf3NxIAYoAgBBf0EgIAJrdnEiBiADdHI2AgAgAiAEayICQQBMDQAgASADIARqQQN2Qfz///8BcWoiASABKAIAQX9BICACa3ZBf3NxIAYgBHZyNgIACyAAKAIYIQEgACAFNgIYIAEEQCABEFsLDwsQAgALvQMBB38gAARAIwBBIGsiBiQAIAAoAgAiASgC5AMiAwRAIAMgARBvGiABQQA2AuQDCyABKALsAyICIAEoAugDIgNHBEBBASACIANrQQJ1IgIgAkEBTRshBEEAIQIDQCADIAJBAnRqKAIAQQA2AuQDIAJBAWoiAiAERw0ACwsgASADNgLsAwJAIAMgAUHwA2oiAigCAEYNACAGQQhqQQBBACACEEoiAigCBCABKALsAyABKALoAyIEayIFayIDIAQgBRAzIQUgASgC6AMhBCABIAU2AugDIAIgBDYCBCABKALsAyEFIAEgAigCCDYC7AMgAiAFNgIIIAEoAvADIQcgASACKAIMNgLwAyACIAQ2AgAgAiAHNgIMIAQgBUcEQCACIAUgBCAFa0EDakF8cWo2AggLIARFDQAgBBAnIAEoAugDIQMLIAMEQCABIAM2AuwDIAMQJwsgASgClAEhAyABQQA2ApQBIAMEQCADEFsLIAEQJyAAKAIIIQEgAEEANgIIIAEEQCABIAEoAgAoAgQRAAALIAAoAgQhASAAQQA2AgQgAQRAIAEgASgCACgCBBEAAAsgBkEgaiQAIAAQIwsLtQEBAX8jAEEQayICJAACfyABBEAgASgCACEBQYgEEB4gARBcIAENARogAkH3GTYCACACEHIQJAALQZQ7LQAARQRAQfg6QQM2AgBBiDtCgICAgICAgMA/NwIAQYA7QgA3AgBBlDtBAToAAEH8OkH8Oi0AAEH+AXE6AABB9DpBADYCAEGQO0EANgIAC0GIBBAeQfQ6EFwLIQEgAEIANwIEIAAgATYCACABIAA2AgQgAkEQaiQAIAALGwEBfyAABEAgACgCACIBBEAgARAjCyAAECMLC0kBAn9BBBAeIQFBIBAeIgBBADYCHCAAQoCAgICAgIDAPzcCFCAAQgA3AgwgAEEAOgAIIABBAzYCBCAAQQA2AgAgASAANgIAIAELIAAgAkEFR0EAIAIbRQRAQbgwIAMgBBBJDwsgAyAEEHALIgEBfiABIAKtIAOtQiCGhCAEIAARFQAiBUIgiKckASAFpwuoAQEFfyAAKAJUIgMoAgAhBSADKAIEIgQgACgCFCAAKAIcIgdrIgYgBCAGSRsiBgRAIAUgByAGECsaIAMgAygCACAGaiIFNgIAIAMgAygCBCAGayIENgIECyAEIAIgAiAESxsiBARAIAUgASAEECsaIAMgAygCACAEaiIFNgIAIAMgAygCBCAEazYCBAsgBUEAOgAAIAAgACgCLCIBNgIcIAAgATYCFCACCwQAQgALBABBAAuKBQIGfgJ/IAEgASgCAEEHakF4cSIBQRBqNgIAIAAhCSABKQMAIQMgASkDCCEGIwBBIGsiCCQAAkAgBkL///////////8AgyIEQoCAgICAgMCAPH0gBEKAgICAgIDA/8MAfVQEQCAGQgSGIANCPIiEIQQgA0L//////////w+DIgNCgYCAgICAgIAIWgRAIARCgYCAgICAgIDAAHwhAgwCCyAEQoCAgICAgICAQH0hAiADQoCAgICAgICACFINASACIARCAYN8IQIMAQsgA1AgBEKAgICAgIDA//8AVCAEQoCAgICAgMD//wBRG0UEQCAGQgSGIANCPIiEQv////////8Dg0KAgICAgICA/P8AhCECDAELQoCAgICAgID4/wAhAiAEQv///////7//wwBWDQBCACECIARCMIinIgBBkfcASQ0AIAMhAiAGQv///////z+DQoCAgICAgMAAhCIFIQcCQCAAQYH3AGsiAUHAAHEEQCACIAFBQGqthiEHQgAhAgwBCyABRQ0AIAcgAa0iBIYgAkHAACABa62IhCEHIAIgBIYhAgsgCCACNwMQIAggBzcDGAJAQYH4ACAAayIAQcAAcQRAIAUgAEFAaq2IIQNCACEFDAELIABFDQAgBUHAACAAa62GIAMgAK0iAoiEIQMgBSACiCEFCyAIIAM3AwAgCCAFNwMIIAgpAwhCBIYgCCkDACIDQjyIhCECIAgpAxAgCCkDGIRCAFKtIANC//////////8Pg4QiA0KBgICAgICAgAhaBEAgAkIBfCECDAELIANCgICAgICAgIAIUg0AIAJCAYMgAnwhAgsgCEEgaiQAIAkgAiAGQoCAgICAgICAgH+DhL85AwALmRgDEn8BfAN+IwBBsARrIgwkACAMQQA2AiwCQCABvSIZQgBTBEBBASERQZkJIRMgAZoiAb0hGQwBCyAEQYAQcQRAQQEhEUGcCSETDAELQZ8JQZoJIARBAXEiERshEyARRSEVCwJAIBlCgICAgICAgPj/AINCgICAgICAgPj/AFEEQCAAQSAgAiARQQNqIgMgBEH//3txECkgACATIBEQJiAAQe0VQdweIAVBIHEiBRtB4RpB4B4gBRsgASABYhtBAxAmIABBICACIAMgBEGAwABzECkgAyACIAIgA0gbIQoMAQsgDEEQaiESAkACfwJAIAEgDEEsahCMASIBIAGgIgFEAAAAAAAAAABiBEAgDCAMKAIsIgZBAWs2AiwgBUEgciIOQeEARw0BDAMLIAVBIHIiDkHhAEYNAiAMKAIsIQlBBiADIANBAEgbDAELIAwgBkEdayIJNgIsIAFEAAAAAAAAsEGiIQFBBiADIANBAEgbCyELIAxBMGpBoAJBACAJQQBOG2oiDSEHA0AgBwJ/IAFEAAAAAAAA8EFjIAFEAAAAAAAAAABmcQRAIAGrDAELQQALIgM2AgAgB0EEaiEHIAEgA7ihRAAAAABlzc1BoiIBRAAAAAAAAAAAYg0ACwJAIAlBAEwEQCAJIQMgByEGIA0hCAwBCyANIQggCSEDA0BBHSADIANBHU4bIQMCQCAHQQRrIgYgCEkNACADrSEaQgAhGQNAIAYgGUL/////D4MgBjUCACAahnwiG0KAlOvcA4AiGUKA7JSjDH4gG3w+AgAgBkEEayIGIAhPDQALIBmnIgZFDQAgCEEEayIIIAY2AgALA0AgCCAHIgZJBEAgBkEEayIHKAIARQ0BCwsgDCAMKAIsIANrIgM2AiwgBiEHIANBAEoNAAsLIANBAEgEQCALQRlqQQluQQFqIQ8gDkHmAEYhEANAQQlBACADayIDIANBCU4bIQoCQCAGIAhNBEAgCCgCACEHDAELQYCU69wDIAp2IRRBfyAKdEF/cyEWQQAhAyAIIQcDQCAHIAMgBygCACIXIAp2ajYCACAWIBdxIBRsIQMgB0EEaiIHIAZJDQALIAgoAgAhByADRQ0AIAYgAzYCACAGQQRqIQYLIAwgDCgCLCAKaiIDNgIsIA0gCCAHRUECdGoiCCAQGyIHIA9BAnRqIAYgBiAHa0ECdSAPShshBiADQQBIDQALC0EAIQMCQCAGIAhNDQAgDSAIa0ECdUEJbCEDQQohByAIKAIAIgpBCkkNAANAIANBAWohAyAKIAdBCmwiB08NAAsLIAsgA0EAIA5B5gBHG2sgDkHnAEYgC0EAR3FrIgcgBiANa0ECdUEJbEEJa0gEQEEEQaQCIAlBAEgbIAxqIAdBgMgAaiIKQQltIg9BAnRqQdAfayEJQQohByAPQXdsIApqIgpBB0wEQANAIAdBCmwhByAKQQFqIgpBCEcNAAsLAkAgCSgCACIQIBAgB24iDyAHbCIKRiAJQQRqIhQgBkZxDQAgECAKayEQAkAgD0EBcUUEQEQAAAAAAABAQyEBIAdBgJTr3ANHIAggCU9yDQEgCUEEay0AAEEBcUUNAQtEAQAAAAAAQEMhAQtEAAAAAAAA4D9EAAAAAAAA8D9EAAAAAAAA+D8gBiAURhtEAAAAAAAA+D8gECAHQQF2IhRGGyAQIBRJGyEYAkAgFQ0AIBMtAABBLUcNACAYmiEYIAGaIQELIAkgCjYCACABIBigIAFhDQAgCSAHIApqIgM2AgAgA0GAlOvcA08EQANAIAlBADYCACAIIAlBBGsiCUsEQCAIQQRrIghBADYCAAsgCSAJKAIAQQFqIgM2AgAgA0H/k+vcA0sNAAsLIA0gCGtBAnVBCWwhA0EKIQcgCCgCACIKQQpJDQADQCADQQFqIQMgCiAHQQpsIgdPDQALCyAJQQRqIgcgBiAGIAdLGyEGCwNAIAYiByAITSIKRQRAIAdBBGsiBigCAEUNAQsLAkAgDkHnAEcEQCAEQQhxIQkMAQsgA0F/c0F/IAtBASALGyIGIANKIANBe0pxIgkbIAZqIQtBf0F+IAkbIAVqIQUgBEEIcSIJDQBBdyEGAkAgCg0AIAdBBGsoAgAiDkUNAEEKIQpBACEGIA5BCnANAANAIAYiCUEBaiEGIA4gCkEKbCIKcEUNAAsgCUF/cyEGCyAHIA1rQQJ1QQlsIQogBUFfcUHGAEYEQEEAIQkgCyAGIApqQQlrIgZBACAGQQBKGyIGIAYgC0obIQsMAQtBACEJIAsgAyAKaiAGakEJayIGQQAgBkEAShsiBiAGIAtKGyELC0F/IQogC0H9////B0H+////ByAJIAtyIhAbSg0BIAsgEEEAR2pBAWohDgJAIAVBX3EiFUHGAEYEQCADIA5B/////wdzSg0DIANBACADQQBKGyEGDAELIBIgAyADQR91IgZzIAZrrSASEEciBmtBAUwEQANAIAZBAWsiBkEwOgAAIBIgBmtBAkgNAAsLIAZBAmsiDyAFOgAAIAZBAWtBLUErIANBAEgbOgAAIBIgD2siBiAOQf////8Hc0oNAgsgBiAOaiIDIBFB/////wdzSg0BIABBICACIAMgEWoiBSAEECkgACATIBEQJiAAQTAgAiAFIARBgIAEcxApAkACQAJAIBVBxgBGBEAgDEEQaiIGQQhyIQMgBkEJciEJIA0gCCAIIA1LGyIKIQgDQCAINQIAIAkQRyEGAkAgCCAKRwRAIAYgDEEQak0NAQNAIAZBAWsiBkEwOgAAIAYgDEEQaksNAAsMAQsgBiAJRw0AIAxBMDoAGCADIQYLIAAgBiAJIAZrECYgCEEEaiIIIA1NDQALIBAEQCAAQYwlQQEQJgsgC0EATCAHIAhNcg0BA0AgCDUCACAJEEciBiAMQRBqSwRAA0AgBkEBayIGQTA6AAAgBiAMQRBqSw0ACwsgACAGQQkgCyALQQlOGxAmIAtBCWshBiAIQQRqIgggB08NAyALQQlKIQMgBiELIAMNAAsMAgsCQCALQQBIDQAgByAIQQRqIAcgCEsbIQogDEEQaiIGQQhyIQMgBkEJciENIAghBwNAIA0gBzUCACANEEciBkYEQCAMQTA6ABggAyEGCwJAIAcgCEcEQCAGIAxBEGpNDQEDQCAGQQFrIgZBMDoAACAGIAxBEGpLDQALDAELIAAgBkEBECYgBkEBaiEGIAkgC3JFDQAgAEGMJUEBECYLIAAgBiALIA0gBmsiBiAGIAtKGxAmIAsgBmshCyAHQQRqIgcgCk8NASALQQBODQALCyAAQTAgC0ESakESQQAQKSAAIA8gEiAPaxAmDAILIAshBgsgAEEwIAZBCWpBCUEAECkLIABBICACIAUgBEGAwABzECkgBSACIAIgBUgbIQoMAQsgEyAFQRp0QR91QQlxaiELAkAgA0ELSw0AQQwgA2shBkQAAAAAAAAwQCEYA0AgGEQAAAAAAAAwQKIhGCAGQQFrIgYNAAsgCy0AAEEtRgRAIBggAZogGKGgmiEBDAELIAEgGKAgGKEhAQsgEUECciEJIAVBIHEhCCASIAwoAiwiByAHQR91IgZzIAZrrSASEEciBkYEQCAMQTA6AA8gDEEPaiEGCyAGQQJrIg0gBUEPajoAACAGQQFrQS1BKyAHQQBIGzoAACAEQQhxIQYgDEEQaiEHA0AgByIFAn8gAZlEAAAAAAAA4EFjBEAgAaoMAQtBgICAgHgLIgdBkC9qLQAAIAhyOgAAIAYgA0EASnJFIAEgB7ehRAAAAAAAADBAoiIBRAAAAAAAAAAAYXEgBUEBaiIHIAxBEGprQQFHckUEQCAFQS46AAEgBUECaiEHCyABRAAAAAAAAAAAYg0AC0F/IQpB/f///wcgCSASIA1rIgVqIgZrIANIDQAgAEEgIAIgBgJ/AkAgA0UNACAHIAxBEGprIghBAmsgA04NACADQQJqDAELIAcgDEEQamsiCAsiB2oiAyAEECkgACALIAkQJiAAQTAgAiADIARBgIAEcxApIAAgDEEQaiAIECYgAEEwIAcgCGtBAEEAECkgACANIAUQJiAAQSAgAiADIARBgMAAcxApIAMgAiACIANIGyEKCyAMQbAEaiQAIAoLRgEBfyAAKAI8IQMjAEEQayIAJAAgAyABpyABQiCIpyACQf8BcSAAQQhqEBQQjQEhAiAAKQMIIQEgAEEQaiQAQn8gASACGwu+AgEHfyMAQSBrIgMkACADIAAoAhwiBDYCECAAKAIUIQUgAyACNgIcIAMgATYCGCADIAUgBGsiATYCFCABIAJqIQVBAiEGIANBEGohAQJ/A0ACQAJAAkAgACgCPCABIAYgA0EMahAYEI0BRQRAIAUgAygCDCIHRg0BIAdBAE4NAgwDCyAFQX9HDQILIAAgACgCLCIBNgIcIAAgATYCFCAAIAEgACgCMGo2AhAgAgwDCyABIAcgASgCBCIISyIJQQN0aiIEIAcgCEEAIAkbayIIIAQoAgBqNgIAIAFBDEEEIAkbaiIBIAEoAgAgCGs2AgAgBSAHayEFIAYgCWshBiAEIQEMAQsLIABBADYCHCAAQgA3AxAgACAAKAIAQSByNgIAQQAgBkECRg0AGiACIAEoAgRrCyEEIANBIGokACAECwkAIAAoAjwQGQsjAQF/Qcg7KAIAIgAEQANAIAAoAgARCQAgACgCBCIADQALCwu/AgEFfyMAQeAAayICJAAgAiAANgIAIwBBEGsiAyQAIAMgAjYCDCMAQZABayIAJAAgAEGgL0GQARArIgAgAkEQaiIFIgE2AiwgACABNgIUIABB/////wdBfiABayIEIARB/////wdPGyIENgIwIAAgASAEaiIBNgIcIAAgATYCECAAQbsTIAJBAEEAEIsBGiAEBEAgACgCFCIBIAEgACgCEEZrQQA6AAALIABBkAFqJAAgA0EQaiQAAkAgBSIAQQNxBEADQCAALQAARQ0CIABBAWoiAEEDcQ0ACwsDQCAAIgFBBGohACABKAIAIgNBf3MgA0GBgoQIa3FBgIGChHhxRQ0ACwNAIAEiAEEBaiEBIAAtAAANAAsLIAAgBWtBAWoiABBhIgEEfyABIAUgABArBUEACyEAIAJB4ABqJAAgAAvFAQICfwF8IwBBMGsiBiQAIAEoAgghBwJAQbQ7LQAAQQFxBEBBsDsoAgAhAQwBC0EFQZAnEAwhAUG0O0EBOgAAQbA7IAE2AgALIAYgBTYCKCAGIAQ4AiAgBiADNgIYIAYgAjgCEAJ/IAEgB0GXGyAGQQxqIAZBEGoQEiIIRAAAAAAAAPBBYyAIRAAAAAAAAAAAZnEEQCAIqwwBC0EACyEBIAYoAgwhAyAAIAEpAwA3AwAgACABKQMINwMIIAMQESAGQTBqJAALCQAgABCQARAjCwwAIAAoAghB6BwQZgsJACAAEJIBECMLVQECfyMAQTBrIgIkACABIAAoAgQiA0EBdWohASAAKAIAIQAgAiABIANBAXEEfyABKAIAIABqKAIABSAACxEBAEEwEB4gAkEwECshACACQTBqJAAgAAs7AQF/IAEgACgCBCIFQQF1aiEBIAAoAgAhACABIAIgAyAEIAVBAXEEfyABKAIAIABqKAIABSAACxEdAAs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERIACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRDAALNQEBfyABIAAoAgQiAkEBdWohASAAKAIAIQAgASACQQFxBH8gASgCACAAaigCAAUgAAsRCwALYQECfyMAQRBrIgIkACABIAAoAgQiA0EBdWohASAAKAIAIQAgAiABIANBAXEEfyABKAIAIABqKAIABSAACxEBAEEQEB4iACACKQMINwMIIAAgAikDADcDACACQRBqJAAgAAtjAQJ/IwBBEGsiAyQAIAEgACgCBCIEQQF1aiEBIAAoAgAhACADIAEgAiAEQQFxBH8gASgCACAAaigCAAUgAAsRAwBBEBAeIgAgAykDCDcDCCAAIAMpAwA3AwAgA0EQaiQAIAALNwEBfyABIAAoAgQiA0EBdWohASAAKAIAIQAgASACIANBAXEEfyABKAIAIABqKAIABSAACxEEAAs5AQF/IAEgACgCBCIEQQF1aiEBIAAoAgAhACABIAIgAyAEQQFxBH8gASgCACAAaigCAAUgAAsRCAALCQAgASAAEQIACwUAQcM7Cw8AIAEgACgCAGogAjYCAAsNACABIAAoAgBqKAIACxgBAX9BEBAeIgBCADcDCCAAQQA2AgAgAAsYAQF/QRAQHiIAQgA3AwAgAEIANwMIIAALDABBMBAeQQBBMBAqCzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRHgALBQBBvjsLIQAgACABKAIAIAEgASwAC0EASBtBuzsgAigCABAQNgIACyoBAX9BDBAeIgFBADoABCABIAAoAgA2AgggAEEANgIAIAFB2Cc2AgAgAQsFAEG7OwsFAEG4OwshACAAIAEoAgAgASABLAALQQBIG0GkOyACKAIAEBA2AgAL2AEBBH8jAEEgayIDJAAgASgCACIEQfD///8HSQRAAkACQCAEQQtPBEAgBEEPckEBaiIFEB4hBiADIAVBgICAgHhyNgIQIAMgBjYCCCADIAQ2AgwgBCAGaiEFDAELIAMgBDoAEyADQQhqIgYgBGohBSAERQ0BCyAGIAFBBGogBBArGgsgBUEAOgAAIAMgAjYCACADQRhqIANBCGogAyAAEQMAIAMoAhgQHSADKAIYIgAQBiADKAIAEAYgAywAE0EASARAIAMoAggQIwsgA0EgaiQAIAAPCxACAAsqAQF/QQwQHiIBQQA6AAQgASAAKAIANgIIIABBADYCACABQeAmNgIAIAELBQBBpDsLaQECfyMAQRBrIgYkACABIAAoAgQiB0EBdWohASAAKAIAIQAgBiABIAIgAyAEIAUgB0EBcQR/IAEoAgAgAGooAgAFIAALERAAQRAQHiIAIAYpAwg3AwggACAGKQMANwMAIAZBEGokACAACwUAQaA7Cx0AIAAoAgAiACAALQAAQfcBcUEIQQAgARtyOgAAC6oBAgJ/AX0jAEEQayICJAAgACgCACEAIAFB/wFxIgNBBkkEQAJ/AkACQAJAIANBBGsOAgABAgsgAEHUA2ogAC0AiANBA3FBAkYNAhogAEHMA2oMAgsgAEHMA2ogAC0AiANBA3FBAkYNARogAEHUA2oMAQsgACABQf8BcUECdGpBzANqCyoCACEEIAJBEGokACAEuw8LIAJB7hA2AgAgAEEFQdglIAIQLBAkAAuqAQICfwF9IwBBEGsiAiQAIAAoAgAhACABQf8BcSIDQQZJBEACfwJAAkACQCADQQRrDgIAAQILIABBxANqIAAtAIgDQQNxQQJGDQIaIABBvANqDAILIABBvANqIAAtAIgDQQNxQQJGDQEaIABBxANqDAELIAAgAUH/AXFBAnRqQbwDagsqAgAhBCACQRBqJAAgBLsPCyACQe4QNgIAIABBBUHYJSACECwQJAALqgECAn8BfSMAQRBrIgIkACAAKAIAIQAgAUH/AXEiA0EGSQRAAn8CQAJAAkAgA0EEaw4CAAECCyAAQbQDaiAALQCIA0EDcUECRg0CGiAAQawDagwCCyAAQawDaiAALQCIA0EDcUECRg0BGiAAQbQDagwBCyAAIAFB/wFxQQJ0akGsA2oLKgIAIQQgAkEQaiQAIAS7DwsgAkHuEDYCACAAQQVB2CUgAhAsECQAC08AIAAgASgCACIBKgKcA7s5AwAgACABKgKkA7s5AwggACABKgKgA7s5AxAgACABKgKoA7s5AxggACABKgKMA7s5AyAgACABKgKQA7s5AygLDAAgACgCACoCkAO7CwwAIAAoAgAqAowDuwsMACAAKAIAKgKoA7sLDAAgACgCACoCoAO7CwwAIAAoAgAqAqQDuwsMACAAKAIAKgKcA7sL6AMCBH0FfyMAQUBqIgokACAAKAIAIQAgCkEIakEAQTgQKhpB8DpB8DooAgBBAWo2AgAgABB4IAAtABRBA3EiCCADQQEgA0H/AXEbIAgbIQkgAEEUaiEIIAG2IQQgACoC+AMhBQJ9AkACQAJAIAAtAPwDQQFrDgIBAAILIAUgBJRDCtcjPJQhBQsgBUMAAAAAYEUNACAAIAlB/wFxQQAgBCAEEDEgCEECQQEgBBAiIAhBAkEBIAQQIZKSDAELIAggCUH/AXFBACAEIAQQLSIFIAVbBEBBAiELIAggCUH/AXFBACAEIAQQLQwBCyAEIARcIQsgBAshByACtiEFIAAqAoAEIQYgACAHAn0CQAJAAkAgAC0AhARBAWsOAgEAAgsgBiAFlEMK1yM8lCEGCyAGQwAAAABgRQ0AIAAgCUH/AXFBASAFIAQQMSAIQQBBASAEECIgCEEAQQEgBBAhkpIMAQsgCCAJQf8BcSIJQQEgBSAEEC0iBiAGWwRAQQIhDCAIIAlBASAFIAQQLQwBCyAFIAVcIQwgBQsgA0H/AXEgCyAMIAQgBUEBQQAgCkEIakEAQfA6KAIAED0EQCAAIAAtAIgDQQNxIAQgBRB2IABEAAAAAAAAAABEAAAAAAAAAAAQcwsgCkFAayQACw0AIAAoAgAtAABBAXELFQAgACgCACIAIAAtAABB/gFxOgAACxAAIAAoAgAtAABBBHFBAnYLegECfyMAQRBrIgEkACAAKAIAIgAoAggEQANAIAAtAAAiAkEEcUUEQCAAIAJBBHI6AAAgACgCECICBEAgACACEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQELCyABQRBqJAAPCyABQYAINgIAIABBBUHYJSABECwQJAALLgEBfyAAKAIIIQEgAEEANgIIIAEEQCABIAEoAgAoAgQRAAALIAAoAgBBADYCEAsXACAAKAIEKAIIIgAgACgCACgCCBEAAAsuAQF/IAAoAgghAiAAIAE2AgggAgRAIAIgAigCACgCBBEAAAsgACgCAEEFNgIQCz4BAX8gACgCBCEBIABBADYCBCABBEAgASABKAIAKAIEEQAACyAAKAIAIgBBADYCCCAAIAAtAABB7wFxOgAAC0kBAX8jAEEQayIGJAAgBiABKAIEKAIEIgEgAiADIAQgBSABKAIAKAIIERAAIAAgBisDALY4AgAgACAGKwMItjgCBCAGQRBqJAALcwECfyMAQRBrIgIkACAAKAIEIQMgACABNgIEIAMEQCADIAMoAgAoAgQRAAALIAAoAgAiACgC6AMgACgC7ANHBEAgAkH5IzYCACAAQQVB2CUgAhAsECQACyAAQQQ2AgggACAALQAAQRByOgAAIAJBEGokAAs8AQF/AkAgACgCACIAKALsAyAAKALoAyIAa0ECdSABTQ0AIAAgAUECdGooAgAiAEUNACAAKAIEIQILIAILGQAgACgCACgC5AMiAEUEQEEADwsgACgCBAsXACAAKAIAIgAoAuwDIAAoAugDa0ECdQuOAwEDfyMAQdACayICJAACQCAAKAIAIgAoAuwDIAAoAugDRg0AIAEoAgAiAygC5AMhASAAIAMQb0UNACAAIAFGBEAgAkEIakEAQcQCECoaIAJBADoAGCACQgA3AxAgAkGAgID+BzYCDCACQRxqQQBBxAEQKhogAkHgAWohBCACQSBqIQEDQCABQoCAgPyLgIDAv383AhAgAUKBgICAEDcCCCABQoCAgPyLgIDAv383AgAgAUEYaiIBIARHDQALIAJCgICA/IuAgMC/fzcD8AEgAkKBgICAEDcD6AEgAkKAgID8i4CAwL9/NwPgASACQoCAgP6HgIDg/wA3AoQCIAJCgICA/oeAgOD/ADcC/AEgAiACLQD4AUH4AXE6APgBIAJBjAJqQQBBwAAQKhogA0GYAWogAkEIakHEAhArGiADQQA2AuQDCwNAIAAtAAAiAUEEcQ0BIAAgAUEEcjoAACAAKAIQIgEEQCAAIAERAAALIABBgICA/gc2ApwBIAAoAuQDIgANAAsLIAJB0AJqJAAL4AcBCH8jAEHQAGsiByQAIAAoAgAhAAJAAkAgASgCACIIKALkA0UEQCAAKAIIDQEgCC0AF0EQdEGAgDBxQYCAIEYEQCAAIAAoAuADQQFqNgLgAwsgACgC6AMiASACQQJ0aiEGAkAgACgC7AMiBCAAQfADaiIDKAIAIgVJBEAgBCAGRgRAIAYgCDYCACAAIAZBBGo2AuwDDAILIAQgBCICQQRrIgFLBEADQCACIAEoAgA2AgAgAkEEaiECIAFBBGoiASAESQ0ACwsgACACNgLsAyAGQQRqIgEgBEcEQCAEIAQgAWsiAUF8cWsgBiABEDMaCyAGIAg2AgAMAQsgBCABa0ECdUEBaiIEQYCAgIAETw0DAkAgB0EgakH/////AyAFIAFrIgFBAXUiBSAEIAQgBUkbIAFB/P///wdPGyACIAMQSiIDKAIIIgIgAygCDEcNACADKAIEIgEgAygCACIESwRAIAMgASABIARrQQJ1QQFqQX5tQQJ0IgRqIAEgAiABayIBEDMgAWoiAjYCCCADIAMoAgQgBGo2AgQMAQsgB0E4akEBIAIgBGtBAXUgAiAERhsiASABQQJ2IAMoAhAQSiIFKAIIIQQCfyADKAIIIgIgAygCBCIBRgRAIAQhAiABDAELIAQgAiABa2ohAgNAIAQgASgCADYCACABQQRqIQEgBEEEaiIEIAJHDQALIAMoAgghASADKAIECyEEIAMoAgAhCSADIAUoAgA2AgAgBSAJNgIAIAMgBSgCBDYCBCAFIAQ2AgQgAyACNgIIIAUgATYCCCADKAIMIQogAyAFKAIMNgIMIAUgCjYCDCABIARHBEAgBSABIAQgAWtBA2pBfHFqNgIICyAJRQ0AIAkQIyADKAIIIQILIAIgCDYCACADIAMoAghBBGo2AgggAyADKAIEIAYgACgC6AMiAWsiAmsgASACEDM2AgQgAygCCCAGIAAoAuwDIAZrIgQQMyEGIAAoAugDIQEgACADKAIENgLoAyADIAE2AgQgACgC7AMhAiAAIAQgBmo2AuwDIAMgAjYCCCAAKALwAyEEIAAgAygCDDYC8AMgAyABNgIAIAMgBDYCDCABIAJHBEAgAyACIAEgAmtBA2pBfHFqNgIICyABRQ0AIAEQIwsgCCAANgLkAwNAIAAtAAAiAUEEcUUEQCAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQELCyAHQdAAaiQADwsgB0HEIzYCECAAQQVB2CUgB0EQahAsECQACyAHQckkNgIAIABBBUHYJSAHECwQJAALEAIACxAAIAAoAgAtAABBAnFBAXYLWQIBfwF9IwBBEGsiAiQAIAJBCGogACgCACIAQfwAaiAAIAFB/wFxQQF0ai8BaBAfQwAAwH8hAwJAAkAgAi0ADA4EAQAAAQALIAIqAgghAwsgAkEQaiQAIAMLTgEBfyMAQRBrIgMkACADQQhqIAEoAgAiAUH8AGogASACQf8BcUEBdGovAUQQHyADLQAMIQEgACADKgIIuzkDCCAAIAE2AgAgA0EQaiQAC14CAX8BfCMAQRBrIgIkACACQQhqIAAoAgAiAEH8AGogACABQf8BcUEBdGovAVYQH0QAAAAAAAD4fyEDAkACQCACLQAMDgQBAAABAAsgAioCCLshAwsgAkEQaiQAIAMLJAEBfUMAAMB/IAAoAgAiAEH8AGogAC8BehAgIgEgASABXBu7C0QBAX8jAEEQayICJAAgAkEIaiABKAIAIgFB/ABqIAEvAXgQHyACLQAMIQEgACACKgIIuzkDCCAAIAE2AgAgAkEQaiQAC0QBAX8jAEEQayICJAAgAkEIaiABKAIAIgFB/ABqIAEvAXYQHyACLQAMIQEgACACKgIIuzkDCCAAIAE2AgAgAkEQaiQAC0QBAX8jAEEQayICJAAgAkEIaiABKAIAIgFB/ABqIAEvAXQQHyACLQAMIQEgACACKgIIuzkDCCAAIAE2AgAgAkEQaiQAC0QBAX8jAEEQayICJAAgAkEIaiABKAIAIgFB/ABqIAEvAXIQHyACLQAMIQEgACACKgIIuzkDCCAAIAE2AgAgAkEQaiQAC0QBAX8jAEEQayICJAAgAkEIaiABKAIAIgFB/ABqIAEvAXAQHyACLQAMIQEgACACKgIIuzkDCCAAIAE2AgAgAkEQaiQAC0QBAX8jAEEQayICJAAgAkEIaiABKAIAIgFB/ABqIAEvAW4QHyACLQAMIQEgACACKgIIuzkDCCAAIAE2AgAgAkEQaiQAC0gCAX8BfQJ9IAAoAgAiAEH8AGoiASAALwEcECAiAiACXARAQwAAgD9DAAAAACAAKAL0Ay0ACEEBcRsMAQsgASAALwEcECALuws2AgF/AX0gACgCACIAQfwAaiIBIAAvARoQICICIAJcBEBEAAAAAAAAAAAPCyABIAAvARoQILsLRAEBfyMAQRBrIgIkACACQQhqIAEoAgAiAUH8AGogAS8BHhAfIAItAAwhASAAIAIqAgi7OQMIIAAgATYCACACQRBqJAALEAAgACgCAC0AF0ECdkEDcQsNACAAKAIALQAXQQNxC04BAX8jAEEQayIDJAAgA0EIaiABKAIAIgFB/ABqIAEgAkH/AXFBAXRqLwEgEB8gAy0ADCEBIAAgAyoCCLs5AwggACABNgIAIANBEGokAAsQACAAKAIALQAUQQR2QQdxCw0AIAAoAgAvABVBDnYLDQAgACgCAC0AFEEDcQsQACAAKAIALQAUQQJ2QQNxCw0AIAAoAgAvABZBD3ELEAAgACgCAC8AFUEEdkEPcQsNACAAKAIALwAVQQ9xC04BAX8jAEEQayIDJAAgA0EIaiABKAIAIgFB/ABqIAEgAkH/AXFBAXRqLwEyEB8gAy0ADCEBIAAgAyoCCLs5AwggACABNgIAIANBEGokAAsQACAAKAIALwAVQQx2QQNxCxAAIAAoAgAtABdBBHZBAXELgQECA38BfSMAQRBrIgMkACAAKAIAIQQCfSACtiIGIAZcBEBBACEAQwAAwH8MAQtBAEECIAZDAACAf1sgBkMAAID/W3IiBRshAEMAAMB/IAYgBRsLIQYgAyAAOgAMIAMgBjgCCCADIAMpAwg3AwAgBCABQf8BcSADEIgBIANBEGokAAt5AgF9An8jAEEQayIEJAAgACgCACEFIAQCfyACtiIDIANcBEBDAADAfyEDQQAMAQtDAADAfyADIANDAACAf1sgA0MAAID/W3IiABshAyAARQs6AAwgBCADOAIIIAQgBCkDCDcDACAFIAFB/wFxIAQQiAEgBEEQaiQAC3EBAX8CQCAAKAIAIgAtAAAiAkECcUEBdiABRg0AIAAgAkH9AXFBAkEAIAEbcjoAAANAIAAtAAAiAUEEcQ0BIAAgAUEEcjoAACAAKAIQIgEEQCAAIAERAAALIABBgICA/gc2ApwBIAAoAuQDIgANAAsLC4EBAgN/AX0jAEEQayIDJAAgACgCACEEAn0gArYiBiAGXARAQQAhAEMAAMB/DAELQQBBAiAGQwAAgH9bIAZDAACA/1tyIgUbIQBDAADAfyAGIAUbCyEGIAMgADoADCADIAY4AgggAyADKQMINwMAIAQgAUH/AXEgAxCOASADQRBqJAALeQIBfQJ/IwBBEGsiBCQAIAAoAgAhBSAEAn8gArYiAyADXARAQwAAwH8hA0EADAELQwAAwH8gAyADQwAAgH9bIANDAACA/1tyIgAbIQMgAEULOgAMIAQgAzgCCCAEIAQpAwg3AwAgBSABQf8BcSAEEI4BIARBEGokAAv5AQICfQR/IwBBEGsiBSQAIAAoAgAhAAJ/IAK2IgMgA1wEQEMAAMB/IQNBAAwBC0MAAMB/IAMgA0MAAIB/WyADQwAAgP9bciIGGyEDIAZFCyEGQQEhByAFQQhqIABB/ABqIgggACABQf8BcUEBdGpB1gBqIgEvAQAQHwJAAkAgAyAFKgIIIgRcBH8gBCAEWw0BIAMgA1wFIAcLRQ0AIAUtAAwgBkYNAQsgCCABIAMgBhA5A0AgAC0AACIBQQRxDQEgACABQQRyOgAAIAAoAhAiAQRAIAAgAREAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsgBUEQaiQAC7UBAgN/An0CQCAAKAIAIgBB/ABqIgMgAEH6AGoiAi8BABAgIgYgAbYiBVsNACAFIAVbIgRFIAYgBlxxDQACQCAEIAVDAAAAAFsgBYtDAACAf1tyRXFFBEAgAiACLwEAQfj/A3E7AQAMAQsgAyACIAVBAxBMCwNAIAAtAAAiAkEEcQ0BIAAgAkEEcjoAACAAKAIQIgIEQCAAIAIRAAALIABBgICA/gc2ApwBIAAoAuQDIgANAAsLC3wCA38BfSMAQRBrIgIkACAAKAIAIQMCfSABtiIFIAVcBEBBACEAQwAAwH8MAQtBAEECIAVDAACAf1sgBUMAAID/W3IiBBshAEMAAMB/IAUgBBsLIQUgAiAAOgAMIAIgBTgCCCACIAIpAwg3AwAgA0EBIAIQVSACQRBqJAALdAIBfQJ/IwBBEGsiAyQAIAAoAgAhBCADAn8gAbYiAiACXARAQwAAwH8hAkEADAELQwAAwH8gAiACQwAAgH9bIAJDAACA/1tyIgAbIQIgAEULOgAMIAMgAjgCCCADIAMpAwg3AwAgBEEBIAMQVSADQRBqJAALfAIDfwF9IwBBEGsiAiQAIAAoAgAhAwJ9IAG2IgUgBVwEQEEAIQBDAADAfwwBC0EAQQIgBUMAAIB/WyAFQwAAgP9bciIEGyEAQwAAwH8gBSAEGwshBSACIAA6AAwgAiAFOAIIIAIgAikDCDcDACADQQAgAhBVIAJBEGokAAt0AgF9An8jAEEQayIDJAAgACgCACEEIAMCfyABtiICIAJcBEBDAADAfyECQQAMAQtDAADAfyACIAJDAACAf1sgAkMAAID/W3IiABshAiAARQs6AAwgAyACOAIIIAMgAykDCDcDACAEQQAgAxBVIANBEGokAAt8AgN/AX0jAEEQayICJAAgACgCACEDAn0gAbYiBSAFXARAQQAhAEMAAMB/DAELQQBBAiAFQwAAgH9bIAVDAACA/1tyIgQbIQBDAADAfyAFIAQbCyEFIAIgADoADCACIAU4AgggAiACKQMINwMAIANBASACEFYgAkEQaiQAC3QCAX0CfyMAQRBrIgMkACAAKAIAIQQgAwJ/IAG2IgIgAlwEQEMAAMB/IQJBAAwBC0MAAMB/IAIgAkMAAIB/WyACQwAAgP9bciIAGyECIABFCzoADCADIAI4AgggAyADKQMINwMAIARBASADEFYgA0EQaiQAC3wCA38BfSMAQRBrIgIkACAAKAIAIQMCfSABtiIFIAVcBEBBACEAQwAAwH8MAQtBAEECIAVDAACAf1sgBUMAAID/W3IiBBshAEMAAMB/IAUgBBsLIQUgAiAAOgAMIAIgBTgCCCACIAIpAwg3AwAgA0EAIAIQViACQRBqJAALdAIBfQJ/IwBBEGsiAyQAIAAoAgAhBCADAn8gAbYiAiACXARAQwAAwH8hAkEADAELQwAAwH8gAiACQwAAgH9bIAJDAACA/1tyIgAbIQIgAEULOgAMIAMgAjgCCCADIAMpAwg3AwAgBEEAIAMQViADQRBqJAALPwEBfyMAQRBrIgEkACAAKAIAIQAgAUEDOgAMIAFBgICA/gc2AgggASABKQMINwMAIABBASABEEYgAUEQaiQAC3wCA38BfSMAQRBrIgIkACAAKAIAIQMCfSABtiIFIAVcBEBBACEAQwAAwH8MAQtBAEECIAVDAACAf1sgBUMAAID/W3IiBBshAEMAAMB/IAUgBBsLIQUgAiAAOgAMIAIgBTgCCCACIAIpAwg3AwAgA0EBIAIQRiACQRBqJAALdAIBfQJ/IwBBEGsiAyQAIAAoAgAhBCADAn8gAbYiAiACXARAQwAAwH8hAkEADAELQwAAwH8gAiACQwAAgH9bIAJDAACA/1tyIgAbIQIgAEULOgAMIAMgAjgCCCADIAMpAwg3AwAgBEEBIAMQRiADQRBqJAALPwEBfyMAQRBrIgEkACAAKAIAIQAgAUEDOgAMIAFBgICA/gc2AgggASABKQMINwMAIABBACABEEYgAUEQaiQAC3wCA38BfSMAQRBrIgIkACAAKAIAIQMCfSABtiIFIAVcBEBBACEAQwAAwH8MAQtBAEECIAVDAACAf1sgBUMAAID/W3IiBBshAEMAAMB/IAUgBBsLIQUgAiAAOgAMIAIgBTgCCCACIAIpAwg3AwAgA0EAIAIQRiACQRBqJAALdAIBfQJ/IwBBEGsiAyQAIAAoAgAhBCADAn8gAbYiAiACXARAQwAAwH8hAkEADAELQwAAwH8gAiACQwAAgH9bIAJDAACA/1tyIgAbIQIgAEULOgAMIAMgAjgCCCADIAMpAwg3AwAgBEEAIAMQRiADQRBqJAALoAECA38CfQJAIAAoAgAiAEH8AGoiAyAAQRxqIgIvAQAQICIGIAG2IgVbDQAgBSAFWyIERSAGIAZccQ0AAkAgBEUEQCACIAIvAQBB+P8DcTsBAAwBCyADIAIgBUEDEEwLA0AgAC0AACICQQRxDQEgACACQQRyOgAAIAAoAhAiAgRAIAAgAhEAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsLoAECA38CfQJAIAAoAgAiAEH8AGoiAyAAQRpqIgIvAQAQICIGIAG2IgVbDQAgBSAFWyIERSAGIAZccQ0AAkAgBEUEQCACIAIvAQBB+P8DcTsBAAwBCyADIAIgBUEDEEwLA0AgAC0AACICQQRxDQEgACACQQRyOgAAIAAoAhAiAgRAIAAgAhEAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsLPQEBfyMAQRBrIgEkACAAKAIAIQAgAUEDOgAMIAFBgICA/gc2AgggASABKQMINwMAIAAgARBrIAFBEGokAAt6AgN/AX0jAEEQayICJAAgACgCACEDAn0gAbYiBSAFXARAQQAhAEMAAMB/DAELQQBBAiAFQwAAgH9bIAVDAACA/1tyIgQbIQBDAADAfyAFIAQbCyEFIAIgADoADCACIAU4AgggAiACKQMINwMAIAMgAhBrIAJBEGokAAtyAgF9An8jAEEQayIDJAAgACgCACEEIAMCfyABtiICIAJcBEBDAADAfyECQQAMAQtDAADAfyACIAJDAACAf1sgAkMAAID/W3IiABshAiAARQs6AAwgAyACOAIIIAMgAykDCDcDACAEIAMQayADQRBqJAALoAECA38CfQJAIAAoAgAiAEH8AGoiAyAAQRhqIgIvAQAQICIGIAG2IgVbDQAgBSAFWyIERSAGIAZccQ0AAkAgBEUEQCACIAIvAQBB+P8DcTsBAAwBCyADIAIgBUEDEEwLA0AgAC0AACICQQRxDQEgACACQQRyOgAAIAAoAhAiAgRAIAAgAhEAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsLkAEBAX8CQCAAKAIAIgBBF2otAAAiAkECdkEDcSABQf8BcUYNACAAIAAvABUgAkEQdHIiAjsAFSAAIAJB///PB3EgAUEDcUESdHJBEHY6ABcDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQALCwuNAQEBfwJAIAAoAgAiAEEXai0AACICQQNxIAFB/wFxRg0AIAAgAC8AFSACQRB0ciICOwAVIAAgAkH///MHcSABQQNxQRB0ckEQdjoAFwNAIAAtAAAiAUEEcQ0BIAAgAUEEcjoAACAAKAIQIgEEQCAAIAERAAALIABBgICA/gc2ApwBIAAoAuQDIgANAAsLC0MBAX8jAEEQayICJAAgACgCACEAIAJBAzoADCACQYCAgP4HNgIIIAIgAikDCDcDACAAIAFB/wFxIAIQZSACQRBqJAALgAECA38BfSMAQRBrIgMkACAAKAIAIQQCfSACtiIGIAZcBEBBACEAQwAAwH8MAQtBAEECIAZDAACAf1sgBkMAAID/W3IiBRshAEMAAMB/IAYgBRsLIQYgAyAAOgAMIAMgBjgCCCADIAMpAwg3AwAgBCABQf8BcSADEGUgA0EQaiQAC3gCAX0CfyMAQRBrIgQkACAAKAIAIQUgBAJ/IAK2IgMgA1wEQEMAAMB/IQNBAAwBC0MAAMB/IAMgA0MAAIB/WyADQwAAgP9bciIAGyEDIABFCzoADCAEIAM4AgggBCAEKQMINwMAIAUgAUH/AXEgBBBlIARBEGokAAt3AQF/AkAgACgCACIALQAUIgJBBHZBB3EgAUH/AXFGDQAgACACQY8BcSABQQR0QfAAcXI6ABQDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQALCwuJAQEBfwJAIAFB/wFxIAAoAgAiAC8AFSICQQ52Rg0AIABBF2ogAiAALQAXQRB0ciICQRB2OgAAIAAgAkH//wBxIAFBDnRyOwAVA0AgAC0AACIBQQRxDQEgACABQQRyOgAAIAAoAhAiAQRAIAAgAREAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsLcAEBfwJAIAAoAgAiAC0AFCICQQNxIAFB/wFxRg0AIAAgAkH8AXEgAUEDcXI6ABQDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQALCwt2AQF/AkAgACgCACIALQAUIgJBAnZBA3EgAUH/AXFGDQAgACACQfMBcSABQQJ0QQxxcjoAFANAIAAtAAAiAUEEcQ0BIAAgAUEEcjoAACAAKAIQIgEEQCAAIAERAAALIABBgICA/gc2ApwBIAAoAuQDIgANAAsLC48BAQF/AkAgACgCACIALwAVIgJBCHZBD3EgAUH/AXFGDQAgAEEXaiACIAAtABdBEHRyIgJBEHY6AAAgACACQf/hA3EgAUEPcUEIdHI7ABUDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQALCwuPAQEBfwJAIAFB/wFxIAAoAgAiAC8AFSAAQRdqLQAAQRB0ciICQfABcUEEdkYNACAAIAJBEHY6ABcgACACQY/+A3EgAUEEdEHwAXFyOwAVA0AgAC0AACIBQQRxDQEgACABQQRyOgAAIAAoAhAiAQRAIAAgAREAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsLhwEBAX8CQCAAKAIAIgAvABUgAEEXai0AAEEQdHIiAkEPcSABQf8BcUYNACAAIAJBEHY6ABcgACACQfD/A3EgAUEPcXI7ABUDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALkAyIADQALCwtDAQF/IwBBEGsiAiQAIAAoAgAhACACQQM6AAwgAkGAgID+BzYCCCACIAIpAwg3AwAgACABQf8BcSACEGcgAkEQaiQAC4ABAgN/AX0jAEEQayIDJAAgACgCACEEAn0gArYiBiAGXARAQQAhAEMAAMB/DAELQQBBAiAGQwAAgH9bIAZDAACA/1tyIgUbIQBDAADAfyAGIAUbCyEGIAMgADoADCADIAY4AgggAyADKQMINwMAIAQgAUH/AXEgAxBnIANBEGokAAt4AgF9An8jAEEQayIEJAAgACgCACEFIAQCfyACtiIDIANcBEBDAADAfyEDQQAMAQtDAADAfyADIANDAACAf1sgA0MAAID/W3IiABshAyAARQs6AAwgBCADOAIIIAQgBCkDCDcDACAFIAFB/wFxIAQQZyAEQRBqJAALjwEBAX8CQCAAKAIAIgAvABUiAkEMdkEDcSABQf8BcUYNACAAQRdqIAIgAC0AF0EQdHIiAkEQdjoAACAAIAJB/58DcSABQQNxQQx0cjsAFQNAIAAtAAAiAUEEcQ0BIAAgAUEEcjoAACAAKAIQIgEEQCAAIAERAAALIABBgICA/gc2ApwBIAAoAuQDIgANAAsLC5ABAQF/AkAgACgCACIAQRdqLQAAIgJBBHZBAXEgAUH/AXFGDQAgACAALwAVIAJBEHRyIgI7ABUgACACQf//vwdxIAFBAXFBFHRyQRB2OgAXA0AgAC0AACIBQQRxDQEgACABQQRyOgAAIAAoAhAiAQRAIAAgAREAAAsgAEGAgID+BzYCnAEgACgC5AMiAA0ACwsL9g0CCH8CfSMAQRBrIgIkAAJAAkAgASgCACIFLQAUIAAoAgAiAS0AFHNB/wBxDQAgBS8AFSAFLQAXQRB0ciABLwAVIAEtABdBEHRyc0H//z9xDQAgBUH8AGohByABQfwAaiEIAkAgAS8AGCIAQQdxRQRAIAUtABhBB3FFDQELIAggABAgIgogByAFLwAYECAiC1sNACAKIApbIAsgC1tyDQELAkAgAS8AGiIAQQdxRQRAIAUtABpBB3FFDQELIAggABAgIgogByAFLwAaECAiC1sNACAKIApbIAsgC1tyDQELAkAgAS8AHCIAQQdxRQRAIAUtABxBB3FFDQELIAggABAgIgogByAFLwAcECAiC1sNACAKIApbIAsgC1tyDQELAkAgAS8AHiIAQQdxRQRAIAUtAB5BB3FFDQELIAJBCGogCCAAEB8gAiAHIAUvAB4QH0EBIQAgAioCCCIKIAIqAgAiC1wEfyAKIApbDQIgCyALXAUgAAtFDQEgAi0ADCACLQAERw0BCyAFQSBqIQAgAUEgaiEGA0ACQCAGIANBAXRqLwAAIgRBB3FFBEAgAC0AAEEHcUUNAQsgAkEIaiAIIAQQHyACIAcgAC8AABAfQQEhBCACKgIIIgogAioCACILXAR/IAogClsNAyALIAtcBSAEC0UNAiACLQAMIAItAARHDQILIABBAmohACADQQFqIgNBCUcNAAsgBUEyaiEAIAFBMmohBkEAIQMDQAJAIAYgA0EBdGovAAAiBEEHcUUEQCAALQAAQQdxRQ0BCyACQQhqIAggBBAfIAIgByAALwAAEB9BASEEIAIqAggiCiACKgIAIgtcBH8gCiAKWw0DIAsgC1wFIAQLRQ0CIAItAAwgAi0ABEcNAgsgAEECaiEAIANBAWoiA0EJRw0ACyAFQcQAaiEAIAFBxABqIQZBACEDA0ACQCAGIANBAXRqLwAAIgRBB3FFBEAgAC0AAEEHcUUNAQsgAkEIaiAIIAQQHyACIAcgAC8AABAfQQEhBCACKgIIIgogAioCACILXAR/IAogClsNAyALIAtcBSAEC0UNAiACLQAMIAItAARHDQILIABBAmohACADQQFqIgNBCUcNAAsgBUHWAGohACABQdYAaiEGQQAhAwNAAkAgBiADQQF0ai8AACIEQQdxRQRAIAAtAABBB3FFDQELIAJBCGogCCAEEB8gAiAHIAAvAAAQH0EBIQQgAioCCCIKIAIqAgAiC1wEfyAKIApbDQMgCyALXAUgBAtFDQIgAi0ADCACLQAERw0CCyAAQQJqIQAgA0EBaiIDQQlHDQALIAVB6ABqIQAgAUHoAGohBkEAIQMDQAJAIAYgA0EBdGovAAAiBEEHcUUEQCAALQAAQQdxRQ0BCyACQQhqIAggBBAfIAIgByAALwAAEB9BASEEIAIqAggiCiACKgIAIgtcBH8gCiAKWw0DIAsgC1wFIAQLRQ0CIAItAAwgAi0ABEcNAgsgAEECaiEAIANBAWoiA0EDRw0ACyAFQe4AaiEAIAFB7gBqIQlBACEEQQAhAwNAAkAgCSADQQF0ai8AACIGQQdxRQRAIAAtAABBB3FFDQELIAJBCGogCCAGEB8gAiAHIAAvAAAQH0EBIQMgAioCCCIKIAIqAgAiC1wEfyAKIApbDQMgCyALXAUgAwtFDQIgAi0ADCACLQAERw0CCyAAQQJqIQBBASEDIAQhBkEBIQQgBkUNAAsgBUHyAGohACABQfIAaiEJQQAhBEEAIQMDQAJAIAkgA0EBdGovAAAiBkEHcUUEQCAALQAAQQdxRQ0BCyACQQhqIAggBhAfIAIgByAALwAAEB9BASEDIAIqAggiCiACKgIAIgtcBH8gCiAKWw0DIAsgC1wFIAMLRQ0CIAItAAwgAi0ABEcNAgsgAEECaiEAQQEhAyAEIQZBASEEIAZFDQALIAVB9gBqIQAgAUH2AGohCUEAIQRBACEDA0ACQCAJIANBAXRqLwAAIgZBB3FFBEAgAC0AAEEHcUUNAQsgAkEIaiAIIAYQHyACIAcgAC8AABAfQQEhAyACKgIIIgogAioCACILXAR/IAogClsNAyALIAtcBSADC0UNAiACLQAMIAItAARHDQILIABBAmohAEEBIQMgBCEGQQEhBCAGRQ0ACyABLwB6IgBBB3FFBEAgBS0AekEHcUUNAgsgCCAAECAiCiAHIAUvAHoQICILWw0BIAogClsNACALIAtcDQELIAFBFGogBUEUakHoABArGiABQfwAaiAFQfwAahCgAQNAIAEtAAAiAEEEcQ0BIAEgAEEEcjoAACABKAIQIgAEQCABIAARAAALIAFBgICA/gc2ApwBIAEoAuQDIgENAAsLIAJBEGokAAvGAwEEfyMAQaAEayICJAAgACgCBCEBIABBADYCBCABBEAgASABKAIAKAIEEQAACyAAKAIIIQEgAEEANgIIIAEEQCABIAEoAgAoAgQRAAALAkAgACgCACIAKALoAyAAKALsA0YEQCAAKALkAw0BIAAgAkEYaiAAKAL0AxBcIgEpAgA3AgAgACABKAIQNgIQIAAgASkCCDcCCCAAQRRqIAFBFGpB6AAQKxogACABKQKMATcCjAEgACABKQKEATcChAEgACABKQJ8NwJ8IAEoApQBIQQgAUEANgKUASAAKAKUASEDIAAgBDYClAEgAwRAIAMQWwsgAEGYAWogAUGYAWpB0AIQKxogACgC6AMiAwRAIAAgAzYC7AMgAxAjCyAAIAEoAugDNgLoAyAAIAEoAuwDNgLsAyAAIAEoAvADNgLwAyABQQA2AvADIAFCADcC6AMgACABKQL8AzcC/AMgACABKQL0AzcC9AMgACABKAKEBDYChAQgASgClAEhACABQQA2ApQBIAAEQCAAEFsLIAJBoARqJAAPCyACQfAcNgIQIABBBUHYJSACQRBqECwQJAALIAJB5hE2AgAgAEEFQdglIAIQLBAkAAsLAEEMEB4gABCiAQsLAEEMEB5BABCiAQsNACAAKAIALQAIQQFxCwoAIAAoAgAoAhQLGQAgAUH/AXEEQBACAAsgACgCACgCEEEBcQsYACAAKAIAIgAgAC0ACEH+AXEgAXI6AAgLJgAgASAAKAIAIgAoAhRHBEAgACABNgIUIAAgACgCDEEBajYCDAsLkgEBAn8jAEEQayICJAAgACgCACEAIAFDAAAAAGAEQCABIAAqAhhcBEAgACABOAIYIAAgACgCDEEBajYCDAsgAkEQaiQADwsgAkGIFDYCACMAQRBrIgMkACADIAI2AgwCQCAARQRAQbgwQdglIAIQSRoMAQsgAEEAQQVB2CUgAiAAKAIEEQ0AGgsgA0EQaiQAECQACz8AIAFB/wFxRQRAIAIgACgCACIAKAIQIgFBAXFHBEAgACABQX5xIAJyNgIQIAAgACgCDEEBajYCDAsPCxACAAsL4CYjAEGACAuBHk9ubHkgbGVhZiBub2RlcyB3aXRoIGN1c3RvbSBtZWFzdXJlIGZ1bmN0aW9ucyBzaG91bGQgbWFudWFsbHkgbWFyayB0aGVtc2VsdmVzIGFzIGRpcnR5AGlzRGlydHkAbWFya0RpcnR5AGRlc3Ryb3kAc2V0RGlzcGxheQBnZXREaXNwbGF5AHNldEZsZXgALSsgICAwWDB4AC0wWCswWCAwWC0weCsweCAweABzZXRGbGV4R3JvdwBnZXRGbGV4R3JvdwBzZXRPdmVyZmxvdwBnZXRPdmVyZmxvdwBoYXNOZXdMYXlvdXQAY2FsY3VsYXRlTGF5b3V0AGdldENvbXB1dGVkTGF5b3V0AHVuc2lnbmVkIHNob3J0AGdldENoaWxkQ291bnQAdW5zaWduZWQgaW50AHNldEp1c3RpZnlDb250ZW50AGdldEp1c3RpZnlDb250ZW50AGF2YWlsYWJsZUhlaWdodCBpcyBpbmRlZmluaXRlIHNvIGhlaWdodFNpemluZ01vZGUgbXVzdCBiZSBTaXppbmdNb2RlOjpNYXhDb250ZW50AGF2YWlsYWJsZVdpZHRoIGlzIGluZGVmaW5pdGUgc28gd2lkdGhTaXppbmdNb2RlIG11c3QgYmUgU2l6aW5nTW9kZTo6TWF4Q29udGVudABzZXRBbGlnbkNvbnRlbnQAZ2V0QWxpZ25Db250ZW50AGdldFBhcmVudABpbXBsZW1lbnQAc2V0TWF4SGVpZ2h0UGVyY2VudABzZXRIZWlnaHRQZXJjZW50AHNldE1pbkhlaWdodFBlcmNlbnQAc2V0RmxleEJhc2lzUGVyY2VudABzZXRHYXBQZXJjZW50AHNldFBvc2l0aW9uUGVyY2VudABzZXRNYXJnaW5QZXJjZW50AHNldE1heFdpZHRoUGVyY2VudABzZXRXaWR0aFBlcmNlbnQAc2V0TWluV2lkdGhQZXJjZW50AHNldFBhZGRpbmdQZXJjZW50AGhhbmRsZS50eXBlKCkgPT0gU3R5bGVWYWx1ZUhhbmRsZTo6VHlwZTo6UG9pbnQgfHwgaGFuZGxlLnR5cGUoKSA9PSBTdHlsZVZhbHVlSGFuZGxlOjpUeXBlOjpQZXJjZW50AGNyZWF0ZURlZmF1bHQAdW5pdAByaWdodABoZWlnaHQAc2V0TWF4SGVpZ2h0AGdldE1heEhlaWdodABzZXRIZWlnaHQAZ2V0SGVpZ2h0AHNldE1pbkhlaWdodABnZXRNaW5IZWlnaHQAZ2V0Q29tcHV0ZWRIZWlnaHQAZ2V0Q29tcHV0ZWRSaWdodABsZWZ0AGdldENvbXB1dGVkTGVmdAByZXNldABfX2Rlc3RydWN0AGZsb2F0AHVpbnQ2NF90AHVzZVdlYkRlZmF1bHRzAHNldFVzZVdlYkRlZmF1bHRzAHNldEFsaWduSXRlbXMAZ2V0QWxpZ25JdGVtcwBzZXRGbGV4QmFzaXMAZ2V0RmxleEJhc2lzAENhbm5vdCBnZXQgbGF5b3V0IHByb3BlcnRpZXMgb2YgbXVsdGktZWRnZSBzaG9ydGhhbmRzAHNldFBvaW50U2NhbGVGYWN0b3IATWVhc3VyZUNhbGxiYWNrV3JhcHBlcgBEaXJ0aWVkQ2FsbGJhY2tXcmFwcGVyAENhbm5vdCByZXNldCBhIG5vZGUgc3RpbGwgYXR0YWNoZWQgdG8gYSBvd25lcgBzZXRCb3JkZXIAZ2V0Qm9yZGVyAGdldENvbXB1dGVkQm9yZGVyAGdldE51bWJlcgBoYW5kbGUudHlwZSgpID09IFN0eWxlVmFsdWVIYW5kbGU6OlR5cGU6Ok51bWJlcgB1bnNpZ25lZCBjaGFyAHRvcABnZXRDb21wdXRlZFRvcABzZXRGbGV4V3JhcABnZXRGbGV4V3JhcABzZXRHYXAAZ2V0R2FwACVwAHNldEhlaWdodEF1dG8Ac2V0RmxleEJhc2lzQXV0bwBzZXRQb3NpdGlvbkF1dG8Ac2V0TWFyZ2luQXV0bwBzZXRXaWR0aEF1dG8AU2NhbGUgZmFjdG9yIHNob3VsZCBub3QgYmUgbGVzcyB0aGFuIHplcm8Ac2V0QXNwZWN0UmF0aW8AZ2V0QXNwZWN0UmF0aW8Ac2V0UG9zaXRpb24AZ2V0UG9zaXRpb24Abm90aWZ5T25EZXN0cnVjdGlvbgBzZXRGbGV4RGlyZWN0aW9uAGdldEZsZXhEaXJlY3Rpb24Ac2V0RGlyZWN0aW9uAGdldERpcmVjdGlvbgBzZXRNYXJnaW4AZ2V0TWFyZ2luAGdldENvbXB1dGVkTWFyZ2luAG1hcmtMYXlvdXRTZWVuAG5hbgBib3R0b20AZ2V0Q29tcHV0ZWRCb3R0b20AYm9vbABlbXNjcmlwdGVuOjp2YWwAc2V0RmxleFNocmluawBnZXRGbGV4U2hyaW5rAHNldEFsd2F5c0Zvcm1zQ29udGFpbmluZ0Jsb2NrAE1lYXN1cmVDYWxsYmFjawBEaXJ0aWVkQ2FsbGJhY2sAZ2V0TGVuZ3RoAHdpZHRoAHNldE1heFdpZHRoAGdldE1heFdpZHRoAHNldFdpZHRoAGdldFdpZHRoAHNldE1pbldpZHRoAGdldE1pbldpZHRoAGdldENvbXB1dGVkV2lkdGgAcHVzaAAvaG9tZS9ydW5uZXIvd29yay95b2dhL3lvZ2EvamF2YXNjcmlwdC8uLi95b2dhL3N0eWxlL1NtYWxsVmFsdWVCdWZmZXIuaAAvaG9tZS9ydW5uZXIvd29yay95b2dhL3lvZ2EvamF2YXNjcmlwdC8uLi95b2dhL3N0eWxlL1N0eWxlVmFsdWVQb29sLmgAdW5zaWduZWQgbG9uZwBzZXRCb3hTaXppbmcAZ2V0Qm94U2l6aW5nAHN0ZDo6d3N0cmluZwBzdGQ6OnN0cmluZwBzdGQ6OnUxNnN0cmluZwBzdGQ6OnUzMnN0cmluZwBzZXRQYWRkaW5nAGdldFBhZGRpbmcAZ2V0Q29tcHV0ZWRQYWRkaW5nAFRyaWVkIHRvIGNvbnN0cnVjdCBZR05vZGUgd2l0aCBudWxsIGNvbmZpZwBBdHRlbXB0aW5nIHRvIGNvbnN0cnVjdCBOb2RlIHdpdGggbnVsbCBjb25maWcAY3JlYXRlV2l0aENvbmZpZwBpbmYAc2V0QWxpZ25TZWxmAGdldEFsaWduU2VsZgBTaXplAHZhbHVlAFZhbHVlAGNyZWF0ZQBtZWFzdXJlAHNldFBvc2l0aW9uVHlwZQBnZXRQb3NpdGlvblR5cGUAaXNSZWZlcmVuY2VCYXNlbGluZQBzZXRJc1JlZmVyZW5jZUJhc2VsaW5lAGNvcHlTdHlsZQBkb3VibGUATm9kZQBleHRlbmQAaW5zZXJ0Q2hpbGQAZ2V0Q2hpbGQAcmVtb3ZlQ2hpbGQAdm9pZABzZXRFeHBlcmltZW50YWxGZWF0dXJlRW5hYmxlZABpc0V4cGVyaW1lbnRhbEZlYXR1cmVFbmFibGVkAGRpcnRpZWQAQ2Fubm90IHJlc2V0IGEgbm9kZSB3aGljaCBzdGlsbCBoYXMgY2hpbGRyZW4gYXR0YWNoZWQAdW5zZXRNZWFzdXJlRnVuYwB1bnNldERpcnRpZWRGdW5jAHNldEVycmF0YQBnZXRFcnJhdGEATWVhc3VyZSBmdW5jdGlvbiByZXR1cm5lZCBhbiBpbnZhbGlkIGRpbWVuc2lvbiB0byBZb2dhOiBbd2lkdGg9JWYsIGhlaWdodD0lZl0ARXhwZWN0IGN1c3RvbSBiYXNlbGluZSBmdW5jdGlvbiB0byBub3QgcmV0dXJuIE5hTgBOQU4ASU5GAGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHNob3J0PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1bnNpZ25lZCBzaG9ydD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8aW50PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1bnNpZ25lZCBpbnQ+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PGZsb2F0PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1aW50OF90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxpbnQ4X3Q+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHVpbnQxNl90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzxpbnQxNl90PgBlbXNjcmlwdGVuOjptZW1vcnlfdmlldzx1aW50MzJfdD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8aW50MzJfdD4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8Y2hhcj4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8dW5zaWduZWQgY2hhcj4Ac3RkOjpiYXNpY19zdHJpbmc8dW5zaWduZWQgY2hhcj4AZW1zY3JpcHRlbjo6bWVtb3J5X3ZpZXc8c2lnbmVkIGNoYXI+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PGxvbmc+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PHVuc2lnbmVkIGxvbmc+AGVtc2NyaXB0ZW46Om1lbW9yeV92aWV3PGRvdWJsZT4AQ2hpbGQgYWxyZWFkeSBoYXMgYSBvd25lciwgaXQgbXVzdCBiZSByZW1vdmVkIGZpcnN0LgBDYW5ub3Qgc2V0IG1lYXN1cmUgZnVuY3Rpb246IE5vZGVzIHdpdGggbWVhc3VyZSBmdW5jdGlvbnMgY2Fubm90IGhhdmUgY2hpbGRyZW4uAENhbm5vdCBhZGQgY2hpbGQ6IE5vZGVzIHdpdGggbWVhc3VyZSBmdW5jdGlvbnMgY2Fubm90IGhhdmUgY2hpbGRyZW4uAChudWxsKQBpbmRleCA8IDQwOTYgJiYgIlNtYWxsVmFsdWVCdWZmZXIgY2FuIG9ubHkgaG9sZCB1cCB0byA0MDk2IGNodW5rcyIAJXMKAAEAAAADAAAAAAAAAAIAAAADAAAAAQAAAAIAAAAAAAAAAQAAAAEAQYwmCwdpaQB2AHZpAEGgJgs3ox0AAKEdAADhHQAA2x0AAOEdAADbHQAAaWlpZmlmaQDUHQAApB0AAHZpaQClHQAA6B0AAGlpaQBB4CYLCcQAAADFAAAAxgBB9CYLDsQAAADHAAAAyAAAANQdAEGQJws+ox0AAOEdAADbHQAA4R0AANsdAADoHQAA4x0AAOgdAABpaWlpAAAAANQdAAC5HQAA1B0AALsdAAC8HQAA6B0AQdgnCwnJAAAAygAAAMsAQewnCxbJAAAAzAAAAMgAAAC/HQAA1B0AAL8dAEGQKAuiA9QdAAC/HQAA2x0AANUdAAB2aWlpaQAAANQdAAC/HQAA4R0AAHZpaWYAAAAA1B0AAL8dAADbHQAAdmlpaQAAAADUHQAAvx0AANUdAADVHQAAwB0AANsdAADbHQAAwB0AANUdAADAHQAAaQBkaWkAdmlpZAAAxB0AAMQdAAC/HQAA1B0AAMQdAADUHQAAxB0AAMMdAADUHQAAxB0AANsdAADUHQAAxB0AANsdAADiHQAAdmlpaWQAAADUHQAAxB0AAOIdAADbHQAAxR0AAMIdAADFHQAA2x0AAMIdAADFHQAA4h0AAMUdAADiHQAAxR0AANsdAABkaWlpAAAAAOEdAADEHQAA2x0AAGZpaWkAAAAA1B0AAMQdAADEHQAA3B0AANQdAADEHQAAxB0AANwdAADFHQAAxB0AAMQdAADEHQAAxB0AANwdAADUHQAAxB0AANUdAADVHQAAxB0AANQdAADEHQAAoR0AANQdAADEHQAAuR0AANUdAADFHQAAAAAAANQdAADEHQAA4h0AAOIdAADbHQAAdmlpZGRpAADBHQAAxR0AQcArC0EZAAoAGRkZAAAAAAUAAAAAAAAJAAAAAAsAAAAAAAAAABkAEQoZGRkDCgcAAQAJCxgAAAkGCwAACwAGGQAAABkZGQBBkSwLIQ4AAAAAAAAAABkACg0ZGRkADQAAAgAJDgAAAAkADgAADgBByywLAQwAQdcsCxUTAAAAABMAAAAACQwAAAAAAAwAAAwAQYUtCwEQAEGRLQsVDwAAAAQPAAAAAAkQAAAAAAAQAAAQAEG/LQsBEgBByy0LHhEAAAAAEQAAAAAJEgAAAAAAEgAAEgAAGgAAABoaGgBBgi4LDhoAAAAaGhoAAAAAAAAJAEGzLgsBFABBvy4LFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB7S4LARYAQfkuCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQcQvCwHSAEHsLwsI//////////8AQbAwCwkQIgEAAAAAAAUAQcQwCwHNAEHcMAsKzgAAAM8AAAD8HQBB9DALAQIAQYQxCwj//////////wBByDELAQUAQdQxCwHQAEHsMQsOzgAAANEAAAAIHgAAAAQAQYQyCwEBAEGUMgsF/////woAQdgyCwHT",!te(Ae)){var Ke=Ae;Ae=r.locateFile?r.locateFile(Ke,u):u+Ke}function ve(){var Q=Ae;try{if(Q==Ae&&I)return new Uint8Array(I);if(te(Q))try{var R=Pa(Q.slice(37)),H=new Uint8Array(R.length);for(Q=0;Q=R?"_"+Q:Q}function He(Q,R){return Q=Ge(Q),function(){return R.apply(this,arguments)}}var Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}],fe=[];function Ce(Q){var R=Error,H=He(Q,function(K){this.name=Q,this.message=K,K=Error(K).stack,K!==void 0&&(this.stack=this.toString()+` -`+K.replace(/^Error(:[^\n]*)?\n/,""))});return H.prototype=Object.create(R.prototype),H.prototype.constructor=H,H.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},H}var yt=void 0;function et(Q){throw new yt(Q)}var kt=Q=>(Q||et("Cannot use deleted val. handle = "+Q),Y[Q].value),Je=Q=>{switch(Q){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var R=fe.length?fe.pop():Y.length;return Y[R]={ga:1,value:Q},R}},Ut=void 0,_t=void 0;function Xe(Q){for(var R="";ee[Q];)R+=_t[ee[Q++]];return R}var Mt=[];function Kr(){for(;Mt.length;){var Q=Mt.pop();Q.M.$=!1,Q.delete()}}var _r=void 0,wn={};function J(Q,R){for(R===void 0&&et("ptr should not be undefined");Q.R;)R=Q.ba(R),Q=Q.R;return R}var ce={};function at(Q){Q=ti(Q);var R=Xe(Q);return $t(Q),R}function mt(Q,R){var H=ce[Q];return H===void 0&&et(R+" has unknown type "+at(Q)),H}function St(){}var Nt=!1;function Zt(Q){--Q.count.value,Q.count.value===0&&(Q.T?Q.U.W(Q.T):Q.P.N.W(Q.O))}function sr(Q,R,H){return R===H?Q:H.R===void 0?null:(Q=sr(Q,R,H.R),Q===null?null:H.na(Q))}var lr={};function Ur(Q,R){return R=J(Q,R),wn[R]}var Vs=void 0;function qo(Q){throw new Vs(Q)}function Do(Q,R){return R.P&&R.O||qo("makeClassHandle requires ptr and ptrType"),!!R.U!=!!R.T&&qo("Both smartPtrType and smartPtr must be specified"),R.count={value:1},qn(Object.create(Q,{M:{value:R}}))}function qn(Q){return typeof FinalizationRegistry>"u"?(qn=R=>R,Q):(Nt=new FinalizationRegistry(R=>{Zt(R.M)}),qn=R=>{var H=R.M;return H.T&&Nt.register(R,{M:H},R),R},St=R=>{Nt.unregister(R)},qn(Q))}var Ci={};function Bi(Q){for(;Q.length;){var R=Q.pop();Q.pop()(R)}}function zo(Q){return this.fromWireType(X[Q>>2])}var ko={},Xo={};function nn(Q,R,H){function K(xe){xe=H(xe),xe.length!==Q.length&&qo("Mismatched type converter count");for(var Ye=0;Ye{ce.hasOwnProperty(xe)?oe[Ye]=ce[xe]:(Ie.push(xe),ko.hasOwnProperty(xe)||(ko[xe]=[]),ko[xe].push(()=>{oe[Ye]=ce[xe],++Ne,Ne===Ie.length&&K(oe)}))}),Ie.length===0&&K(oe)}function Hi(Q){switch(Q){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+Q)}}function mn(Q,R,H={}){if(!("argPackAdvance"in R))throw new TypeError("registerType registeredInstance requires argPackAdvance");var K=R.name;if(Q||et('type "'+K+'" must have a positive integer typeid pointer'),ce.hasOwnProperty(Q)){if(H.ua)return;et("Cannot register type '"+K+"' twice")}ce[Q]=R,delete Xo[Q],ko.hasOwnProperty(Q)&&(R=ko[Q],delete ko[Q],R.forEach(oe=>oe()))}function $s(Q){et(Q.M.P.N.name+" instance already deleted")}function No(){}function Ds(Q,R,H){if(Q[R].S===void 0){var K=Q[R];Q[R]=function(){return Q[R].S.hasOwnProperty(arguments.length)||et("Function '"+H+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+Q[R].S+")!"),Q[R].S[arguments.length].apply(this,arguments)},Q[R].S=[],Q[R].S[K.Z]=K}}function Wi(Q,R){r.hasOwnProperty(Q)?(et("Cannot register public name '"+Q+"' twice"),Ds(r,Q,Q),r.hasOwnProperty(void 0)&&et("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),r[Q].S[void 0]=R):r[Q]=R}function ys(Q,R,H,K,oe,Ie,Ne,xe){this.name=Q,this.constructor=R,this.X=H,this.W=K,this.R=oe,this.pa=Ie,this.ba=Ne,this.na=xe,this.ja=[]}function Qs(Q,R,H){for(;R!==H;)R.ba||et("Expected null or instance of "+H.name+", got an instance of "+R.name),Q=R.ba(Q),R=R.R;return Q}function qs(Q,R){return R===null?(this.ea&&et("null is not a valid "+this.name),0):(R.M||et('Cannot pass "'+Se(R)+'" as a '+this.name),R.M.O||et("Cannot pass deleted object as a pointer of type "+this.name),Qs(R.M.O,R.M.P.N,this.N))}function ws(Q,R){if(R===null){if(this.ea&&et("null is not a valid "+this.name),this.da){var H=this.fa();return Q!==null&&Q.push(this.W,H),H}return 0}if(R.M||et('Cannot pass "'+Se(R)+'" as a '+this.name),R.M.O||et("Cannot pass deleted object as a pointer of type "+this.name),!this.ca&&R.M.P.ca&&et("Cannot convert argument of type "+(R.M.U?R.M.U.name:R.M.P.name)+" to parameter type "+this.name),H=Qs(R.M.O,R.M.P.N,this.N),this.da)switch(R.M.T===void 0&&et("Passing raw pointer to smart pointer is illegal"),this.Ba){case 0:R.M.U===this?H=R.M.T:et("Cannot convert argument of type "+(R.M.U?R.M.U.name:R.M.P.name)+" to parameter type "+this.name);break;case 1:H=R.M.T;break;case 2:if(R.M.U===this)H=R.M.T;else{var K=R.clone();H=this.xa(H,Je(function(){K.delete()})),Q!==null&&Q.push(this.W,H)}break;default:et("Unsupporting sharing policy")}return H}function yo(Q,R){return R===null?(this.ea&&et("null is not a valid "+this.name),0):(R.M||et('Cannot pass "'+Se(R)+'" as a '+this.name),R.M.O||et("Cannot pass deleted object as a pointer of type "+this.name),R.M.P.ca&&et("Cannot convert argument of type "+R.M.P.name+" to parameter type "+this.name),Qs(R.M.O,R.M.P.N,this.N))}function on(Q,R,H,K){this.name=Q,this.N=R,this.ea=H,this.ca=K,this.da=!1,this.W=this.xa=this.fa=this.ka=this.Ba=this.wa=void 0,R.R!==void 0?this.toWireType=ws:(this.toWireType=K?qs:yo,this.V=null)}function ji(Q,R){r.hasOwnProperty(Q)||qo("Replacing nonexistant public symbol"),r[Q]=R,r[Q].Z=void 0}function vs(Q,R){var H=[];return function(){if(H.length=0,Object.assign(H,arguments),Q.includes("j")){var K=r["dynCall_"+Q];K=H&&H.length?K.apply(null,[R].concat(H)):K.call(null,R)}else K=_e.get(R).apply(null,H);return K}}function Gr(Q,R){Q=Xe(Q);var H=Q.includes("j")?vs(Q,R):_e.get(R);return typeof H!="function"&&et("unknown function pointer with signature "+Q+": "+R),H}var _s=void 0;function Zo(Q,R){function H(Ie){oe[Ie]||ce[Ie]||(Xo[Ie]?Xo[Ie].forEach(H):(K.push(Ie),oe[Ie]=!0))}var K=[],oe={};throw R.forEach(H),new _s(Q+": "+K.map(at).join([", "]))}function zs(Q,R,H,K,oe){var Ie=R.length;2>Ie&&et("argTypes array size mismatch! Must at least get return value and 'this' types!");var Ne=R[1]!==null&&H!==null,xe=!1;for(H=1;H>2]);return H}function Xs(Q){4>2])};case 3:return function(H){return this.fromWireType(ye[H>>3])};default:throw new TypeError("Unknown float type: "+Q)}}function lt(Q,R,H){switch(R){case 0:return H?function(K){return Z[K]}:function(K){return ee[K]};case 1:return H?function(K){return W[K>>1]}:function(K){return ie[K>>1]};case 2:return H?function(K){return X[K>>2]}:function(K){return $[K>>2]};default:throw new TypeError("Unknown integer type: "+Q)}}function Kt(Q,R){for(var H="",K=0;!(K>=R/2);++K){var oe=W[Q+2*K>>1];if(oe==0)break;H+=String.fromCharCode(oe)}return H}function sn(Q,R,H){if(H===void 0&&(H=2147483647),2>H)return 0;H-=2;var K=R;H=H<2*Q.length?H/2:Q.length;for(var oe=0;oe>1]=Q.charCodeAt(oe),R+=2;return W[R>>1]=0,R-K}function Et(Q){return 2*Q.length}function dr(Q,R){for(var H=0,K="";!(H>=R/4);){var oe=X[Q+4*H>>2];if(oe==0)break;++H,65536<=oe?(oe-=65536,K+=String.fromCharCode(55296|oe>>10,56320|oe&1023)):K+=String.fromCharCode(oe)}return K}function ur(Q,R,H){if(H===void 0&&(H=2147483647),4>H)return 0;var K=R;H=K+H-4;for(var oe=0;oe=Ie){var Ne=Q.charCodeAt(++oe);Ie=65536+((Ie&1023)<<10)|Ne&1023}if(X[R>>2]=Ie,R+=4,R+4>H)break}return X[R>>2]=0,R-K}function Vt(Q){for(var R=0,H=0;H=K&&++H,R+=4}return R}var cn={};function ac(Q){var R=cn[Q];return R===void 0?Xe(Q):R}var Zs=[];function Oa(Q){var R=Zs.length;return Zs.push(Q),R}function La(Q,R){for(var H=Array(Q),K=0;K>2],"parameter "+K);return H}var Ki=[],BA=[null,[],[]];yt=r.BindingError=Ce("BindingError"),r.count_emval_handles=function(){for(var Q=0,R=5;Rei;++ei)Ma[ei]=String.fromCharCode(ei);_t=Ma,r.getInheritedInstanceCount=function(){return Object.keys(wn).length},r.getLiveInheritedInstances=function(){var Q=[],R;for(R in wn)wn.hasOwnProperty(R)&&Q.push(wn[R]);return Q},r.flushPendingDeletes=Kr,r.setDelayFunction=function(Q){_r=Q,Mt.length&&_r&&_r(Kr)},Vs=r.InternalError=Ce("InternalError"),No.prototype.isAliasOf=function(Q){if(!(this instanceof No&&Q instanceof No))return!1;var R=this.M.P.N,H=this.M.O,K=Q.M.P.N;for(Q=Q.M.O;R.R;)H=R.ba(H),R=R.R;for(;K.R;)Q=K.ba(Q),K=K.R;return R===K&&H===Q},No.prototype.clone=function(){if(this.M.O||$s(this),this.M.aa)return this.M.count.value+=1,this;var Q=qn,R=Object,H=R.create,K=Object.getPrototypeOf(this),oe=this.M;return Q=Q(H.call(R,K,{M:{value:{count:oe.count,$:oe.$,aa:oe.aa,O:oe.O,P:oe.P,T:oe.T,U:oe.U}}})),Q.M.count.value+=1,Q.M.$=!1,Q},No.prototype.delete=function(){this.M.O||$s(this),this.M.$&&!this.M.aa&&et("Object already scheduled for deletion"),St(this),Zt(this.M),this.M.aa||(this.M.T=void 0,this.M.O=void 0)},No.prototype.isDeleted=function(){return!this.M.O},No.prototype.deleteLater=function(){return this.M.O||$s(this),this.M.$&&!this.M.aa&&et("Object already scheduled for deletion"),Mt.push(this),Mt.length===1&&_r&&_r(Kr),this.M.$=!0,this},on.prototype.qa=function(Q){return this.ka&&(Q=this.ka(Q)),Q},on.prototype.ha=function(Q){this.W&&this.W(Q)},on.prototype.argPackAdvance=8,on.prototype.readValueFromPointer=zo,on.prototype.deleteObject=function(Q){Q!==null&&Q.delete()},on.prototype.fromWireType=function(Q){function R(){return this.da?Do(this.N.X,{P:this.wa,O:H,U:this,T:Q}):Do(this.N.X,{P:this,O:Q})}var H=this.qa(Q);if(!H)return this.ha(Q),null;var K=Ur(this.N,H);if(K!==void 0)return K.M.count.value===0?(K.M.O=H,K.M.T=Q,K.clone()):(K=K.clone(),this.ha(Q),K);if(K=this.N.pa(H),K=lr[K],!K)return R.call(this);K=this.ca?K.la:K.pointerType;var oe=sr(H,this.N,K.N);return oe===null?R.call(this):this.da?Do(K.N.X,{P:K,O:oe,U:this,T:Q}):Do(K.N.X,{P:K,O:oe})},_s=r.UnboundTypeError=Ce("UnboundTypeError");var Pa=typeof atob=="function"?atob:function(Q){var R="",H=0;Q=Q.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(Q.charAt(H++)),oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(Q.charAt(H++)),Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(Q.charAt(H++)),Ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(Q.charAt(H++));K=K<<2|oe>>4,oe=(oe&15)<<4|Ie>>2;var xe=(Ie&3)<<6|Ne;R+=String.fromCharCode(K),Ie!==64&&(R+=String.fromCharCode(oe)),Ne!==64&&(R+=String.fromCharCode(xe))}while(HNe.ta).concat(oe.map(Ne=>Ne.za));nn([Q],Ie,Ne=>{var xe={};return oe.forEach((Ye,Oe)=>{var rt=Ne[Oe],Qt=Ye.ra,er=Ye.sa,Fr=Ne[Oe+oe.length],tr=Ye.ya,vn=Ye.Aa;xe[Ye.oa]={read:zn=>rt.fromWireType(Qt(er,zn)),write:(zn,Ua)=>{var ri=[];tr(vn,zn,Fr.toWireType(ri,Ua)),Bi(ri)}}}),[{name:R.name,fromWireType:function(Ye){var Oe={},rt;for(rt in xe)Oe[rt]=xe[rt].read(Ye);return K(Ye),Oe},toWireType:function(Ye,Oe){for(var rt in xe)if(!(rt in Oe))throw new TypeError('Missing field: "'+rt+'"');var Qt=H();for(rt in xe)xe[rt].write(Qt,Oe[rt]);return Ye!==null&&Ye.push(K,Qt),Qt},argPackAdvance:8,readValueFromPointer:zo,V:K}]})},v:function(){},B:function(Q,R,H,K,oe){var Ie=Hi(H);R=Xe(R),mn(Q,{name:R,fromWireType:function(Ne){return!!Ne},toWireType:function(Ne,xe){return xe?K:oe},argPackAdvance:8,readValueFromPointer:function(Ne){if(H===1)var xe=Z;else if(H===2)xe=W;else if(H===4)xe=X;else throw new TypeError("Unknown boolean type size: "+R);return this.fromWireType(xe[Ne>>Ie])},V:null})},f:function(Q,R,H,K,oe,Ie,Ne,xe,Ye,Oe,rt,Qt,er){rt=Xe(rt),Ie=Gr(oe,Ie),xe&&(xe=Gr(Ne,xe)),Oe&&(Oe=Gr(Ye,Oe)),er=Gr(Qt,er);var Fr=Ge(rt);Wi(Fr,function(){Zo("Cannot construct "+rt+" due to unbound types",[K])}),nn([Q,R,H],K?[K]:[],function(tr){if(tr=tr[0],K)var vn=tr.N,zn=vn.X;else zn=No.prototype;tr=He(Fr,function(){if(Object.getPrototypeOf(this)!==Ua)throw new yt("Use 'new' to construct "+rt);if(ri.Y===void 0)throw new yt(rt+" has no accessible constructor");var Dl=ri.Y[arguments.length];if(Dl===void 0)throw new yt("Tried to invoke ctor of "+rt+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(ri.Y).toString()+") parameters instead!");return Dl.apply(this,arguments)});var Ua=Object.create(zn,{constructor:{value:tr}});tr.prototype=Ua;var ri=new ys(rt,tr,Ua,er,vn,Ie,xe,Oe);vn=new on(rt,ri,!0,!1),zn=new on(rt+"*",ri,!1,!1);var DA=new on(rt+" const*",ri,!1,!0);return lr[Q]={pointerType:zn,la:DA},ji(Fr,tr),[vn,zn,DA]})},d:function(Q,R,H,K,oe,Ie,Ne){var xe=xo(H,K);R=Xe(R),Ie=Gr(oe,Ie),nn([],[Q],function(Ye){function Oe(){Zo("Cannot call "+rt+" due to unbound types",xe)}Ye=Ye[0];var rt=Ye.name+"."+R;R.startsWith("@@")&&(R=Symbol[R.substring(2)]);var Qt=Ye.N.constructor;return Qt[R]===void 0?(Oe.Z=H-1,Qt[R]=Oe):(Ds(Qt,R,rt),Qt[R].S[H-1]=Oe),nn([],xe,function(er){return er=zs(rt,[er[0],null].concat(er.slice(1)),null,Ie,Ne),Qt[R].S===void 0?(er.Z=H-1,Qt[R]=er):Qt[R].S[H-1]=er,[]}),[]})},p:function(Q,R,H,K,oe,Ie){0{Zo("Cannot construct "+xe.name+" due to unbound types",Ne)},nn([],Ne,function(Oe){return Oe.splice(1,0,null),xe.N.Y[R-1]=zs(Ye,Oe,null,oe,Ie),[]}),[]})},a:function(Q,R,H,K,oe,Ie,Ne,xe){var Ye=xo(H,K);R=Xe(R),Ie=Gr(oe,Ie),nn([],[Q],function(Oe){function rt(){Zo("Cannot call "+Qt+" due to unbound types",Ye)}Oe=Oe[0];var Qt=Oe.name+"."+R;R.startsWith("@@")&&(R=Symbol[R.substring(2)]),xe&&Oe.N.ja.push(R);var er=Oe.N.X,Fr=er[R];return Fr===void 0||Fr.S===void 0&&Fr.className!==Oe.name&&Fr.Z===H-2?(rt.Z=H-2,rt.className=Oe.name,er[R]=rt):(Ds(er,R,Qt),er[R].S[H-2]=rt),nn([],Ye,function(tr){return tr=zs(Qt,tr,Oe,Ie,Ne),er[R].S===void 0?(tr.Z=H-2,er[R]=tr):er[R].S[H-2]=tr,[]}),[]})},A:function(Q,R){R=Xe(R),mn(Q,{name:R,fromWireType:function(H){var K=kt(H);return Xs(H),K},toWireType:function(H,K){return Je(K)},argPackAdvance:8,readValueFromPointer:zo,V:null})},n:function(Q,R,H){H=Hi(H),R=Xe(R),mn(Q,{name:R,fromWireType:function(K){return K},toWireType:function(K,oe){return oe},argPackAdvance:8,readValueFromPointer:Pe(R,H),V:null})},e:function(Q,R,H,K,oe){R=Xe(R),oe===-1&&(oe=4294967295),oe=Hi(H);var Ie=xe=>xe;if(K===0){var Ne=32-8*H;Ie=xe=>xe<>>Ne}H=R.includes("unsigned")?function(xe,Ye){return Ye>>>0}:function(xe,Ye){return Ye},mn(Q,{name:R,fromWireType:Ie,toWireType:H,argPackAdvance:8,readValueFromPointer:lt(R,oe,K!==0),V:null})},b:function(Q,R,H){function K(Ie){Ie>>=2;var Ne=$;return new oe(P,Ne[Ie+1],Ne[Ie])}var oe=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][R];H=Xe(H),mn(Q,{name:H,fromWireType:K,argPackAdvance:8,readValueFromPointer:K},{ua:!0})},o:function(Q,R){R=Xe(R);var H=R==="std::string";mn(Q,{name:R,fromWireType:function(K){var oe=$[K>>2],Ie=K+4;if(H)for(var Ne=Ie,xe=0;xe<=oe;++xe){var Ye=Ie+xe;if(xe==oe||ee[Ye]==0){if(Ne=Ne?T(ee,Ne,Ye-Ne):"",Oe===void 0)var Oe=Ne;else Oe+="\0",Oe+=Ne;Ne=Ye+1}}else{for(Oe=Array(oe),xe=0;xe=Ye?xe++:2047>=Ye?xe+=2:55296<=Ye&&57343>=Ye?(xe+=4,++Ie):xe+=3}Ie=xe}else Ie=oe.length;if(xe=pr(4+Ie+1),Ye=xe+4,$[xe>>2]=Ie,H&&Ne){if(Ne=Ye,Ye=Ie+1,Ie=ee,0=rt){var Qt=oe.charCodeAt(++Oe);rt=65536+((rt&1023)<<10)|Qt&1023}if(127>=rt){if(Ne>=Ye)break;Ie[Ne++]=rt}else{if(2047>=rt){if(Ne+1>=Ye)break;Ie[Ne++]=192|rt>>6}else{if(65535>=rt){if(Ne+2>=Ye)break;Ie[Ne++]=224|rt>>12}else{if(Ne+3>=Ye)break;Ie[Ne++]=240|rt>>18,Ie[Ne++]=128|rt>>12&63}Ie[Ne++]=128|rt>>6&63}Ie[Ne++]=128|rt&63}}Ie[Ne]=0}}else if(Ne)for(Ne=0;Neie,xe=1;else R===4&&(K=dr,oe=ur,Ie=Vt,Ne=()=>$,xe=2);mn(Q,{name:H,fromWireType:function(Ye){for(var Oe=$[Ye>>2],rt=Ne(),Qt,er=Ye+4,Fr=0;Fr<=Oe;++Fr){var tr=Ye+4+Fr*R;(Fr==Oe||rt[tr>>xe]==0)&&(er=K(er,tr-er),Qt===void 0?Qt=er:(Qt+="\0",Qt+=er),er=tr+R)}return $t(Ye),Qt},toWireType:function(Ye,Oe){typeof Oe!="string"&&et("Cannot pass non-string to C++ string type "+H);var rt=Ie(Oe),Qt=pr(4+rt+R);return $[Qt>>2]=rt>>xe,oe(Oe,Qt+4,rt+R),Ye!==null&&Ye.push($t,Qt),Qt},argPackAdvance:8,readValueFromPointer:zo,V:function(Ye){$t(Ye)}})},k:function(Q,R,H,K,oe,Ie){Ci[Q]={name:Xe(R),fa:Gr(H,K),W:Gr(oe,Ie),ia:[]}},h:function(Q,R,H,K,oe,Ie,Ne,xe,Ye,Oe){Ci[Q].ia.push({oa:Xe(R),ta:H,ra:Gr(K,oe),sa:Ie,za:Ne,ya:Gr(xe,Ye),Aa:Oe})},C:function(Q,R){R=Xe(R),mn(Q,{va:!0,name:R,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(Q,R,H,K,oe){Q=Zs[Q],R=kt(R),H=ac(H);var Ie=[];return $[K>>2]=Je(Ie),Q(R,H,Ie,oe)},t:function(Q,R,H,K){Q=Zs[Q],R=kt(R),H=ac(H),Q(R,H,null,K)},g:Xs,m:function(Q,R){var H=La(Q,R),K=H[0];R=K.name+"_$"+H.slice(1).map(function(Ne){return Ne.name}).join("_")+"$";var oe=Ki[R];if(oe!==void 0)return oe;var Ie=Array(Q-1);return oe=Oa((Ne,xe,Ye,Oe)=>{for(var rt=0,Qt=0;Qt>>=0,2147483648=H;H*=2){var K=R*(1+.2/H);K=Math.min(K,Q+100663296);var oe=Math;K=Math.max(Q,K),oe=oe.min.call(oe,2147483648,K+(65536-K%65536)%65536);e:{try{D.grow(oe-P.byteLength+65535>>>16),le();var Ie=1;break e}catch{}Ie=void 0}if(Ie)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(Q,R,H,K){for(var oe=0,Ie=0;Ie>2],xe=$[R+4>>2];R+=8;for(var Ye=0;Ye>2]=oe,0}};(function(){function Q(oe){r.asm=oe.exports,D=r.asm.E,le(),_e=r.asm.J,ct.unshift(r.asm.F),se--,r.monitorRunDependencies&&r.monitorRunDependencies(se),se==0&&(x!==null&&(clearInterval(x),x=null),j&&(oe=j,j=null,oe()))}function R(oe){Q(oe.instance)}function H(oe){return st().then(function(Ie){return WebAssembly.instantiate(Ie,K)}).then(function(Ie){return Ie}).then(oe,function(Ie){E("failed to asynchronously prepare wasm: "+Ie),ae(Ie)})}var K={a:Ji};if(se++,r.monitorRunDependencies&&r.monitorRunDependencies(se),r.instantiateWasm)try{return r.instantiateWasm(K,Q)}catch(oe){E("Module.instantiateWasm callback failed with error: "+oe),s(oe)}return(function(){return I||typeof WebAssembly.instantiateStreaming!="function"||te(Ae)||typeof fetch!="function"?H(R):fetch(Ae,{credentials:"same-origin"}).then(function(oe){return WebAssembly.instantiateStreaming(oe,K).then(R,function(Ie){return E("wasm streaming compile failed: "+Ie),E("falling back to ArrayBuffer instantiation"),H(R)})})})().catch(s),{}})(),r.___wasm_call_ctors=function(){return(r.___wasm_call_ctors=r.asm.F).apply(null,arguments)};var ti=r.___getTypeName=function(){return(ti=r.___getTypeName=r.asm.G).apply(null,arguments)};r.__embind_initialize_bindings=function(){return(r.__embind_initialize_bindings=r.asm.H).apply(null,arguments)};var pr=r._malloc=function(){return(pr=r._malloc=r.asm.I).apply(null,arguments)},$t=r._free=function(){return($t=r._free=r.asm.K).apply(null,arguments)};r.dynCall_jiji=function(){return(r.dynCall_jiji=r.asm.L).apply(null,arguments)};var br;j=function Q(){br||Jr(),br||(j=Q)};function Jr(){function Q(){if(!br&&(br=!0,r.calledRun=!0,!v)){if(nt(ct),i(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;){var R=r.postRun.shift();ze.unshift(R)}nt(ze)}}if(!(01?p-1:0),I=1;Ia?e.Node.createWithConfig(a):e.Node.createDefault()),t(e.Node.prototype,"free",function(){e.Node.destroy(this)}),t(e.Node.prototype,"freeRecursive",function(){for(let s=0,a=this.getChildCount();s1&&arguments[1]!==void 0?arguments[1]:NaN,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:If.LTR;return s.call(this,a,u,p)}),{Config:e.Config,Node:e.Node,...FC}}var C_=Xm(await _C()),ft=C_;var ND=Me(YC(),1),xD=Me(qC(),1);import SR from"node:process";function AE({onlyFirst:e=!1}={}){let s="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(s,e?void 0:"g")}var D_=AE();function Df(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(D_,"")}var zC=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],XC=12288,ZC=65510,eB=[12288,12288,65281,65376,65504,65510];var tB=4352,rB=262141,lE=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var Id=(e,t)=>{let r=0,i=Math.floor(e.length/2)-1;for(;r<=i;){let s=Math.floor((r+i)/2),a=s*2;if(te[a+1])r=s+1;else return!0}return!1};var nB=19968,[w_,v_]=__(lE);function __(e){let t=e[0],r=e[1];for(let i=0;i=s&&nB<=a)return[s,a];a-s>r-t&&(t=s,r=a)}return[t,r]}var oB=e=>e<161||e>1114109?!1:Id(zC,e),yf=e=>eZC?!1:Id(eB,e);var Qf=e=>e>=w_&&e<=v_?!0:erB?!1:Id(lE,e);function S_(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function iB(e,{ambiguousAsWide:t=!1}={}){return S_(e),yf(e)||Qf(e)||t&&oB(e)?2:1}var AB=Me(aB(),1),R_=new Intl.Segmenter,b_=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function ln(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:i=!1}=t;if(i||(e=Df(e)),e.length===0)return 0;let s=0,a={ambiguousAsWide:!r};for(let{segment:u}of R_.segment(e)){let p=u.codePointAt(0);if(!(p<=31||p>=127&&p<=159)&&!(p>=8203&&p<=8207||p===65279)&&!(p>=768&&p<=879||p>=6832&&p<=6911||p>=7616&&p<=7679||p>=8400&&p<=8447||p>=65056&&p<=65071)&&!(p>=55296&&p<=57343)&&!(p>=65024&&p<=65039)&&!b_.test(u)){if((0,AB.default)().test(u)){s+=2;continue}s+=iB(p,a)}}return s}function il(e){let t=0;for(let r of e.split(` +`+K.replace(/^Error(:[^\n]*)?\n/,""))});return H.prototype=Object.create(R.prototype),H.prototype.constructor=H,H.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},H}var yt=void 0;function et(Q){throw new yt(Q)}var kt=Q=>(Q||et("Cannot use deleted val. handle = "+Q),Y[Q].value),Je=Q=>{switch(Q){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var R=fe.length?fe.pop():Y.length;return Y[R]={ga:1,value:Q},R}},Ut=void 0,_t=void 0;function Xe(Q){for(var R="";ee[Q];)R+=_t[ee[Q++]];return R}var Mt=[];function Kr(){for(;Mt.length;){var Q=Mt.pop();Q.M.$=!1,Q.delete()}}var _r=void 0,wn={};function J(Q,R){for(R===void 0&&et("ptr should not be undefined");Q.R;)R=Q.ba(R),Q=Q.R;return R}var ce={};function at(Q){Q=ti(Q);var R=Xe(Q);return $t(Q),R}function mt(Q,R){var H=ce[Q];return H===void 0&&et(R+" has unknown type "+at(Q)),H}function St(){}var Nt=!1;function Zt(Q){--Q.count.value,Q.count.value===0&&(Q.T?Q.U.W(Q.T):Q.P.N.W(Q.O))}function sr(Q,R,H){return R===H?Q:H.R===void 0?null:(Q=sr(Q,R,H.R),Q===null?null:H.na(Q))}var ur={};function Ur(Q,R){return R=J(Q,R),wn[R]}var Vs=void 0;function qo(Q){throw new Vs(Q)}function Do(Q,R){return R.P&&R.O||qo("makeClassHandle requires ptr and ptrType"),!!R.U!=!!R.T&&qo("Both smartPtrType and smartPtr must be specified"),R.count={value:1},qn(Object.create(Q,{M:{value:R}}))}function qn(Q){return typeof FinalizationRegistry>"u"?(qn=R=>R,Q):(Nt=new FinalizationRegistry(R=>{Zt(R.M)}),qn=R=>{var H=R.M;return H.T&&Nt.register(R,{M:H},R),R},St=R=>{Nt.unregister(R)},qn(Q))}var Ci={};function Bi(Q){for(;Q.length;){var R=Q.pop();Q.pop()(R)}}function zo(Q){return this.fromWireType(X[Q>>2])}var ko={},Xo={};function nn(Q,R,H){function K(xe){xe=H(xe),xe.length!==Q.length&&qo("Mismatched type converter count");for(var Ye=0;Ye{ce.hasOwnProperty(xe)?oe[Ye]=ce[xe]:(Ie.push(xe),ko.hasOwnProperty(xe)||(ko[xe]=[]),ko[xe].push(()=>{oe[Ye]=ce[xe],++Ne,Ne===Ie.length&&K(oe)}))}),Ie.length===0&&K(oe)}function Hi(Q){switch(Q){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+Q)}}function mn(Q,R,H={}){if(!("argPackAdvance"in R))throw new TypeError("registerType registeredInstance requires argPackAdvance");var K=R.name;if(Q||et('type "'+K+'" must have a positive integer typeid pointer'),ce.hasOwnProperty(Q)){if(H.ua)return;et("Cannot register type '"+K+"' twice")}ce[Q]=R,delete Xo[Q],ko.hasOwnProperty(Q)&&(R=ko[Q],delete ko[Q],R.forEach(oe=>oe()))}function $s(Q){et(Q.M.P.N.name+" instance already deleted")}function No(){}function Ds(Q,R,H){if(Q[R].S===void 0){var K=Q[R];Q[R]=function(){return Q[R].S.hasOwnProperty(arguments.length)||et("Function '"+H+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+Q[R].S+")!"),Q[R].S[arguments.length].apply(this,arguments)},Q[R].S=[],Q[R].S[K.Z]=K}}function Wi(Q,R){r.hasOwnProperty(Q)?(et("Cannot register public name '"+Q+"' twice"),Ds(r,Q,Q),r.hasOwnProperty(void 0)&&et("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),r[Q].S[void 0]=R):r[Q]=R}function ys(Q,R,H,K,oe,Ie,Ne,xe){this.name=Q,this.constructor=R,this.X=H,this.W=K,this.R=oe,this.pa=Ie,this.ba=Ne,this.na=xe,this.ja=[]}function Qs(Q,R,H){for(;R!==H;)R.ba||et("Expected null or instance of "+H.name+", got an instance of "+R.name),Q=R.ba(Q),R=R.R;return Q}function qs(Q,R){return R===null?(this.ea&&et("null is not a valid "+this.name),0):(R.M||et('Cannot pass "'+Se(R)+'" as a '+this.name),R.M.O||et("Cannot pass deleted object as a pointer of type "+this.name),Qs(R.M.O,R.M.P.N,this.N))}function ws(Q,R){if(R===null){if(this.ea&&et("null is not a valid "+this.name),this.da){var H=this.fa();return Q!==null&&Q.push(this.W,H),H}return 0}if(R.M||et('Cannot pass "'+Se(R)+'" as a '+this.name),R.M.O||et("Cannot pass deleted object as a pointer of type "+this.name),!this.ca&&R.M.P.ca&&et("Cannot convert argument of type "+(R.M.U?R.M.U.name:R.M.P.name)+" to parameter type "+this.name),H=Qs(R.M.O,R.M.P.N,this.N),this.da)switch(R.M.T===void 0&&et("Passing raw pointer to smart pointer is illegal"),this.Ba){case 0:R.M.U===this?H=R.M.T:et("Cannot convert argument of type "+(R.M.U?R.M.U.name:R.M.P.name)+" to parameter type "+this.name);break;case 1:H=R.M.T;break;case 2:if(R.M.U===this)H=R.M.T;else{var K=R.clone();H=this.xa(H,Je(function(){K.delete()})),Q!==null&&Q.push(this.W,H)}break;default:et("Unsupporting sharing policy")}return H}function yo(Q,R){return R===null?(this.ea&&et("null is not a valid "+this.name),0):(R.M||et('Cannot pass "'+Se(R)+'" as a '+this.name),R.M.O||et("Cannot pass deleted object as a pointer of type "+this.name),R.M.P.ca&&et("Cannot convert argument of type "+R.M.P.name+" to parameter type "+this.name),Qs(R.M.O,R.M.P.N,this.N))}function on(Q,R,H,K){this.name=Q,this.N=R,this.ea=H,this.ca=K,this.da=!1,this.W=this.xa=this.fa=this.ka=this.Ba=this.wa=void 0,R.R!==void 0?this.toWireType=ws:(this.toWireType=K?qs:yo,this.V=null)}function ji(Q,R){r.hasOwnProperty(Q)||qo("Replacing nonexistant public symbol"),r[Q]=R,r[Q].Z=void 0}function vs(Q,R){var H=[];return function(){if(H.length=0,Object.assign(H,arguments),Q.includes("j")){var K=r["dynCall_"+Q];K=H&&H.length?K.apply(null,[R].concat(H)):K.call(null,R)}else K=_e.get(R).apply(null,H);return K}}function Gr(Q,R){Q=Xe(Q);var H=Q.includes("j")?vs(Q,R):_e.get(R);return typeof H!="function"&&et("unknown function pointer with signature "+Q+": "+R),H}var _s=void 0;function Zo(Q,R){function H(Ie){oe[Ie]||ce[Ie]||(Xo[Ie]?Xo[Ie].forEach(H):(K.push(Ie),oe[Ie]=!0))}var K=[],oe={};throw R.forEach(H),new _s(Q+": "+K.map(at).join([", "]))}function zs(Q,R,H,K,oe){var Ie=R.length;2>Ie&&et("argTypes array size mismatch! Must at least get return value and 'this' types!");var Ne=R[1]!==null&&H!==null,xe=!1;for(H=1;H>2]);return H}function Xs(Q){4>2])};case 3:return function(H){return this.fromWireType(ye[H>>3])};default:throw new TypeError("Unknown float type: "+Q)}}function lt(Q,R,H){switch(R){case 0:return H?function(K){return Z[K]}:function(K){return ee[K]};case 1:return H?function(K){return W[K>>1]}:function(K){return ie[K>>1]};case 2:return H?function(K){return X[K>>2]}:function(K){return $[K>>2]};default:throw new TypeError("Unknown integer type: "+Q)}}function Kt(Q,R){for(var H="",K=0;!(K>=R/2);++K){var oe=W[Q+2*K>>1];if(oe==0)break;H+=String.fromCharCode(oe)}return H}function sn(Q,R,H){if(H===void 0&&(H=2147483647),2>H)return 0;H-=2;var K=R;H=H<2*Q.length?H/2:Q.length;for(var oe=0;oe>1]=Q.charCodeAt(oe),R+=2;return W[R>>1]=0,R-K}function Et(Q){return 2*Q.length}function dr(Q,R){for(var H=0,K="";!(H>=R/4);){var oe=X[Q+4*H>>2];if(oe==0)break;++H,65536<=oe?(oe-=65536,K+=String.fromCharCode(55296|oe>>10,56320|oe&1023)):K+=String.fromCharCode(oe)}return K}function cr(Q,R,H){if(H===void 0&&(H=2147483647),4>H)return 0;var K=R;H=K+H-4;for(var oe=0;oe=Ie){var Ne=Q.charCodeAt(++oe);Ie=65536+((Ie&1023)<<10)|Ne&1023}if(X[R>>2]=Ie,R+=4,R+4>H)break}return X[R>>2]=0,R-K}function Vt(Q){for(var R=0,H=0;H=K&&++H,R+=4}return R}var cn={};function ac(Q){var R=cn[Q];return R===void 0?Xe(Q):R}var Zs=[];function Oa(Q){var R=Zs.length;return Zs.push(Q),R}function La(Q,R){for(var H=Array(Q),K=0;K>2],"parameter "+K);return H}var Ki=[],BA=[null,[],[]];yt=r.BindingError=Ce("BindingError"),r.count_emval_handles=function(){for(var Q=0,R=5;Rei;++ei)Ma[ei]=String.fromCharCode(ei);_t=Ma,r.getInheritedInstanceCount=function(){return Object.keys(wn).length},r.getLiveInheritedInstances=function(){var Q=[],R;for(R in wn)wn.hasOwnProperty(R)&&Q.push(wn[R]);return Q},r.flushPendingDeletes=Kr,r.setDelayFunction=function(Q){_r=Q,Mt.length&&_r&&_r(Kr)},Vs=r.InternalError=Ce("InternalError"),No.prototype.isAliasOf=function(Q){if(!(this instanceof No&&Q instanceof No))return!1;var R=this.M.P.N,H=this.M.O,K=Q.M.P.N;for(Q=Q.M.O;R.R;)H=R.ba(H),R=R.R;for(;K.R;)Q=K.ba(Q),K=K.R;return R===K&&H===Q},No.prototype.clone=function(){if(this.M.O||$s(this),this.M.aa)return this.M.count.value+=1,this;var Q=qn,R=Object,H=R.create,K=Object.getPrototypeOf(this),oe=this.M;return Q=Q(H.call(R,K,{M:{value:{count:oe.count,$:oe.$,aa:oe.aa,O:oe.O,P:oe.P,T:oe.T,U:oe.U}}})),Q.M.count.value+=1,Q.M.$=!1,Q},No.prototype.delete=function(){this.M.O||$s(this),this.M.$&&!this.M.aa&&et("Object already scheduled for deletion"),St(this),Zt(this.M),this.M.aa||(this.M.T=void 0,this.M.O=void 0)},No.prototype.isDeleted=function(){return!this.M.O},No.prototype.deleteLater=function(){return this.M.O||$s(this),this.M.$&&!this.M.aa&&et("Object already scheduled for deletion"),Mt.push(this),Mt.length===1&&_r&&_r(Kr),this.M.$=!0,this},on.prototype.qa=function(Q){return this.ka&&(Q=this.ka(Q)),Q},on.prototype.ha=function(Q){this.W&&this.W(Q)},on.prototype.argPackAdvance=8,on.prototype.readValueFromPointer=zo,on.prototype.deleteObject=function(Q){Q!==null&&Q.delete()},on.prototype.fromWireType=function(Q){function R(){return this.da?Do(this.N.X,{P:this.wa,O:H,U:this,T:Q}):Do(this.N.X,{P:this,O:Q})}var H=this.qa(Q);if(!H)return this.ha(Q),null;var K=Ur(this.N,H);if(K!==void 0)return K.M.count.value===0?(K.M.O=H,K.M.T=Q,K.clone()):(K=K.clone(),this.ha(Q),K);if(K=this.N.pa(H),K=ur[K],!K)return R.call(this);K=this.ca?K.la:K.pointerType;var oe=sr(H,this.N,K.N);return oe===null?R.call(this):this.da?Do(K.N.X,{P:K,O:oe,U:this,T:Q}):Do(K.N.X,{P:K,O:oe})},_s=r.UnboundTypeError=Ce("UnboundTypeError");var Pa=typeof atob=="function"?atob:function(Q){var R="",H=0;Q=Q.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(Q.charAt(H++)),oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(Q.charAt(H++)),Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(Q.charAt(H++)),Ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(Q.charAt(H++));K=K<<2|oe>>4,oe=(oe&15)<<4|Ie>>2;var xe=(Ie&3)<<6|Ne;R+=String.fromCharCode(K),Ie!==64&&(R+=String.fromCharCode(oe)),Ne!==64&&(R+=String.fromCharCode(xe))}while(HNe.ta).concat(oe.map(Ne=>Ne.za));nn([Q],Ie,Ne=>{var xe={};return oe.forEach((Ye,Oe)=>{var rt=Ne[Oe],Qt=Ye.ra,er=Ye.sa,Fr=Ne[Oe+oe.length],tr=Ye.ya,vn=Ye.Aa;xe[Ye.oa]={read:zn=>rt.fromWireType(Qt(er,zn)),write:(zn,Ua)=>{var ri=[];tr(vn,zn,Fr.toWireType(ri,Ua)),Bi(ri)}}}),[{name:R.name,fromWireType:function(Ye){var Oe={},rt;for(rt in xe)Oe[rt]=xe[rt].read(Ye);return K(Ye),Oe},toWireType:function(Ye,Oe){for(var rt in xe)if(!(rt in Oe))throw new TypeError('Missing field: "'+rt+'"');var Qt=H();for(rt in xe)xe[rt].write(Qt,Oe[rt]);return Ye!==null&&Ye.push(K,Qt),Qt},argPackAdvance:8,readValueFromPointer:zo,V:K}]})},v:function(){},B:function(Q,R,H,K,oe){var Ie=Hi(H);R=Xe(R),mn(Q,{name:R,fromWireType:function(Ne){return!!Ne},toWireType:function(Ne,xe){return xe?K:oe},argPackAdvance:8,readValueFromPointer:function(Ne){if(H===1)var xe=Z;else if(H===2)xe=W;else if(H===4)xe=X;else throw new TypeError("Unknown boolean type size: "+R);return this.fromWireType(xe[Ne>>Ie])},V:null})},f:function(Q,R,H,K,oe,Ie,Ne,xe,Ye,Oe,rt,Qt,er){rt=Xe(rt),Ie=Gr(oe,Ie),xe&&(xe=Gr(Ne,xe)),Oe&&(Oe=Gr(Ye,Oe)),er=Gr(Qt,er);var Fr=Ge(rt);Wi(Fr,function(){Zo("Cannot construct "+rt+" due to unbound types",[K])}),nn([Q,R,H],K?[K]:[],function(tr){if(tr=tr[0],K)var vn=tr.N,zn=vn.X;else zn=No.prototype;tr=He(Fr,function(){if(Object.getPrototypeOf(this)!==Ua)throw new yt("Use 'new' to construct "+rt);if(ri.Y===void 0)throw new yt(rt+" has no accessible constructor");var Dl=ri.Y[arguments.length];if(Dl===void 0)throw new yt("Tried to invoke ctor of "+rt+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(ri.Y).toString()+") parameters instead!");return Dl.apply(this,arguments)});var Ua=Object.create(zn,{constructor:{value:tr}});tr.prototype=Ua;var ri=new ys(rt,tr,Ua,er,vn,Ie,xe,Oe);vn=new on(rt,ri,!0,!1),zn=new on(rt+"*",ri,!1,!1);var DA=new on(rt+" const*",ri,!1,!0);return ur[Q]={pointerType:zn,la:DA},ji(Fr,tr),[vn,zn,DA]})},d:function(Q,R,H,K,oe,Ie,Ne){var xe=xo(H,K);R=Xe(R),Ie=Gr(oe,Ie),nn([],[Q],function(Ye){function Oe(){Zo("Cannot call "+rt+" due to unbound types",xe)}Ye=Ye[0];var rt=Ye.name+"."+R;R.startsWith("@@")&&(R=Symbol[R.substring(2)]);var Qt=Ye.N.constructor;return Qt[R]===void 0?(Oe.Z=H-1,Qt[R]=Oe):(Ds(Qt,R,rt),Qt[R].S[H-1]=Oe),nn([],xe,function(er){return er=zs(rt,[er[0],null].concat(er.slice(1)),null,Ie,Ne),Qt[R].S===void 0?(er.Z=H-1,Qt[R]=er):Qt[R].S[H-1]=er,[]}),[]})},p:function(Q,R,H,K,oe,Ie){0{Zo("Cannot construct "+xe.name+" due to unbound types",Ne)},nn([],Ne,function(Oe){return Oe.splice(1,0,null),xe.N.Y[R-1]=zs(Ye,Oe,null,oe,Ie),[]}),[]})},a:function(Q,R,H,K,oe,Ie,Ne,xe){var Ye=xo(H,K);R=Xe(R),Ie=Gr(oe,Ie),nn([],[Q],function(Oe){function rt(){Zo("Cannot call "+Qt+" due to unbound types",Ye)}Oe=Oe[0];var Qt=Oe.name+"."+R;R.startsWith("@@")&&(R=Symbol[R.substring(2)]),xe&&Oe.N.ja.push(R);var er=Oe.N.X,Fr=er[R];return Fr===void 0||Fr.S===void 0&&Fr.className!==Oe.name&&Fr.Z===H-2?(rt.Z=H-2,rt.className=Oe.name,er[R]=rt):(Ds(er,R,Qt),er[R].S[H-2]=rt),nn([],Ye,function(tr){return tr=zs(Qt,tr,Oe,Ie,Ne),er[R].S===void 0?(tr.Z=H-2,er[R]=tr):er[R].S[H-2]=tr,[]}),[]})},A:function(Q,R){R=Xe(R),mn(Q,{name:R,fromWireType:function(H){var K=kt(H);return Xs(H),K},toWireType:function(H,K){return Je(K)},argPackAdvance:8,readValueFromPointer:zo,V:null})},n:function(Q,R,H){H=Hi(H),R=Xe(R),mn(Q,{name:R,fromWireType:function(K){return K},toWireType:function(K,oe){return oe},argPackAdvance:8,readValueFromPointer:Pe(R,H),V:null})},e:function(Q,R,H,K,oe){R=Xe(R),oe===-1&&(oe=4294967295),oe=Hi(H);var Ie=xe=>xe;if(K===0){var Ne=32-8*H;Ie=xe=>xe<>>Ne}H=R.includes("unsigned")?function(xe,Ye){return Ye>>>0}:function(xe,Ye){return Ye},mn(Q,{name:R,fromWireType:Ie,toWireType:H,argPackAdvance:8,readValueFromPointer:lt(R,oe,K!==0),V:null})},b:function(Q,R,H){function K(Ie){Ie>>=2;var Ne=$;return new oe(P,Ne[Ie+1],Ne[Ie])}var oe=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][R];H=Xe(H),mn(Q,{name:H,fromWireType:K,argPackAdvance:8,readValueFromPointer:K},{ua:!0})},o:function(Q,R){R=Xe(R);var H=R==="std::string";mn(Q,{name:R,fromWireType:function(K){var oe=$[K>>2],Ie=K+4;if(H)for(var Ne=Ie,xe=0;xe<=oe;++xe){var Ye=Ie+xe;if(xe==oe||ee[Ye]==0){if(Ne=Ne?T(ee,Ne,Ye-Ne):"",Oe===void 0)var Oe=Ne;else Oe+="\0",Oe+=Ne;Ne=Ye+1}}else{for(Oe=Array(oe),xe=0;xe=Ye?xe++:2047>=Ye?xe+=2:55296<=Ye&&57343>=Ye?(xe+=4,++Ie):xe+=3}Ie=xe}else Ie=oe.length;if(xe=pr(4+Ie+1),Ye=xe+4,$[xe>>2]=Ie,H&&Ne){if(Ne=Ye,Ye=Ie+1,Ie=ee,0=rt){var Qt=oe.charCodeAt(++Oe);rt=65536+((rt&1023)<<10)|Qt&1023}if(127>=rt){if(Ne>=Ye)break;Ie[Ne++]=rt}else{if(2047>=rt){if(Ne+1>=Ye)break;Ie[Ne++]=192|rt>>6}else{if(65535>=rt){if(Ne+2>=Ye)break;Ie[Ne++]=224|rt>>12}else{if(Ne+3>=Ye)break;Ie[Ne++]=240|rt>>18,Ie[Ne++]=128|rt>>12&63}Ie[Ne++]=128|rt>>6&63}Ie[Ne++]=128|rt&63}}Ie[Ne]=0}}else if(Ne)for(Ne=0;Neie,xe=1;else R===4&&(K=dr,oe=cr,Ie=Vt,Ne=()=>$,xe=2);mn(Q,{name:H,fromWireType:function(Ye){for(var Oe=$[Ye>>2],rt=Ne(),Qt,er=Ye+4,Fr=0;Fr<=Oe;++Fr){var tr=Ye+4+Fr*R;(Fr==Oe||rt[tr>>xe]==0)&&(er=K(er,tr-er),Qt===void 0?Qt=er:(Qt+="\0",Qt+=er),er=tr+R)}return $t(Ye),Qt},toWireType:function(Ye,Oe){typeof Oe!="string"&&et("Cannot pass non-string to C++ string type "+H);var rt=Ie(Oe),Qt=pr(4+rt+R);return $[Qt>>2]=rt>>xe,oe(Oe,Qt+4,rt+R),Ye!==null&&Ye.push($t,Qt),Qt},argPackAdvance:8,readValueFromPointer:zo,V:function(Ye){$t(Ye)}})},k:function(Q,R,H,K,oe,Ie){Ci[Q]={name:Xe(R),fa:Gr(H,K),W:Gr(oe,Ie),ia:[]}},h:function(Q,R,H,K,oe,Ie,Ne,xe,Ye,Oe){Ci[Q].ia.push({oa:Xe(R),ta:H,ra:Gr(K,oe),sa:Ie,za:Ne,ya:Gr(xe,Ye),Aa:Oe})},C:function(Q,R){R=Xe(R),mn(Q,{va:!0,name:R,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(Q,R,H,K,oe){Q=Zs[Q],R=kt(R),H=ac(H);var Ie=[];return $[K>>2]=Je(Ie),Q(R,H,Ie,oe)},t:function(Q,R,H,K){Q=Zs[Q],R=kt(R),H=ac(H),Q(R,H,null,K)},g:Xs,m:function(Q,R){var H=La(Q,R),K=H[0];R=K.name+"_$"+H.slice(1).map(function(Ne){return Ne.name}).join("_")+"$";var oe=Ki[R];if(oe!==void 0)return oe;var Ie=Array(Q-1);return oe=Oa((Ne,xe,Ye,Oe)=>{for(var rt=0,Qt=0;Qt>>=0,2147483648=H;H*=2){var K=R*(1+.2/H);K=Math.min(K,Q+100663296);var oe=Math;K=Math.max(Q,K),oe=oe.min.call(oe,2147483648,K+(65536-K%65536)%65536);e:{try{D.grow(oe-P.byteLength+65535>>>16),le();var Ie=1;break e}catch{}Ie=void 0}if(Ie)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(Q,R,H,K){for(var oe=0,Ie=0;Ie>2],xe=$[R+4>>2];R+=8;for(var Ye=0;Ye>2]=oe,0}};(function(){function Q(oe){r.asm=oe.exports,D=r.asm.E,le(),_e=r.asm.J,ct.unshift(r.asm.F),se--,r.monitorRunDependencies&&r.monitorRunDependencies(se),se==0&&(x!==null&&(clearInterval(x),x=null),j&&(oe=j,j=null,oe()))}function R(oe){Q(oe.instance)}function H(oe){return st().then(function(Ie){return WebAssembly.instantiate(Ie,K)}).then(function(Ie){return Ie}).then(oe,function(Ie){E("failed to asynchronously prepare wasm: "+Ie),ae(Ie)})}var K={a:Ji};if(se++,r.monitorRunDependencies&&r.monitorRunDependencies(se),r.instantiateWasm)try{return r.instantiateWasm(K,Q)}catch(oe){E("Module.instantiateWasm callback failed with error: "+oe),s(oe)}return(function(){return I||typeof WebAssembly.instantiateStreaming!="function"||te(Ae)||typeof fetch!="function"?H(R):fetch(Ae,{credentials:"same-origin"}).then(function(oe){return WebAssembly.instantiateStreaming(oe,K).then(R,function(Ie){return E("wasm streaming compile failed: "+Ie),E("falling back to ArrayBuffer instantiation"),H(R)})})})().catch(s),{}})(),r.___wasm_call_ctors=function(){return(r.___wasm_call_ctors=r.asm.F).apply(null,arguments)};var ti=r.___getTypeName=function(){return(ti=r.___getTypeName=r.asm.G).apply(null,arguments)};r.__embind_initialize_bindings=function(){return(r.__embind_initialize_bindings=r.asm.H).apply(null,arguments)};var pr=r._malloc=function(){return(pr=r._malloc=r.asm.I).apply(null,arguments)},$t=r._free=function(){return($t=r._free=r.asm.K).apply(null,arguments)};r.dynCall_jiji=function(){return(r.dynCall_jiji=r.asm.L).apply(null,arguments)};var br;j=function Q(){br||Jr(),br||(j=Q)};function Jr(){function Q(){if(!br&&(br=!0,r.calledRun=!0,!v)){if(nt(ct),i(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;){var R=r.postRun.shift();ze.unshift(R)}nt(ze)}}if(!(01?p-1:0),I=1;Ia?e.Node.createWithConfig(a):e.Node.createDefault()),t(e.Node.prototype,"free",function(){e.Node.destroy(this)}),t(e.Node.prototype,"freeRecursive",function(){for(let s=0,a=this.getChildCount();s1&&arguments[1]!==void 0?arguments[1]:NaN,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:If.LTR;return s.call(this,a,u,p)}),{Config:e.Config,Node:e.Node,...FC}}var C_=Xm(await _C()),ft=C_;var ND=Me(YC(),1),xD=Me(qC(),1);import SR from"node:process";function AE({onlyFirst:e=!1}={}){let s="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(s,e?void 0:"g")}var D_=AE();function Df(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(D_,"")}var zC=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],XC=12288,ZC=65510,eB=[12288,12288,65281,65376,65504,65510];var tB=4352,rB=262141,lE=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var Id=(e,t)=>{let r=0,i=Math.floor(e.length/2)-1;for(;r<=i;){let s=Math.floor((r+i)/2),a=s*2;if(te[a+1])r=s+1;else return!0}return!1};var nB=19968,[w_,v_]=__(lE);function __(e){let t=e[0],r=e[1];for(let i=0;i=s&&nB<=a)return[s,a];a-s>r-t&&(t=s,r=a)}return[t,r]}var oB=e=>e<161||e>1114109?!1:Id(zC,e),yf=e=>eZC?!1:Id(eB,e);var Qf=e=>e>=w_&&e<=v_?!0:erB?!1:Id(lE,e);function S_(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function iB(e,{ambiguousAsWide:t=!1}={}){return S_(e),yf(e)||Qf(e)||t&&oB(e)?2:1}var AB=Me(aB(),1),R_=new Intl.Segmenter,b_=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function ln(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:i=!1}=t;if(i||(e=Df(e)),e.length===0)return 0;let s=0,a={ambiguousAsWide:!r};for(let{segment:u}of R_.segment(e)){let p=u.codePointAt(0);if(!(p<=31||p>=127&&p<=159)&&!(p>=8203&&p<=8207||p===65279)&&!(p>=768&&p<=879||p>=6832&&p<=6911||p>=7616&&p<=7679||p>=8400&&p<=8447||p>=65056&&p<=65071)&&!(p>=55296&&p<=57343)&&!(p>=65024&&p<=65039)&&!b_.test(u)){if((0,AB.default)().test(u)){s+=2;continue}s+=iB(p,a)}}return s}function il(e){let t=0;for(let r of e.split(` `))t=Math.max(t,ln(r));return t}var lB={},F_=e=>{if(e.length===0)return{width:0,height:0};let t=lB[e];if(t)return t;let r=il(e),i=e.split(` `).length;return lB[e]={width:r,height:i},{width:r,height:i}},uE=F_;var uB=(e=0)=>t=>`\x1B[${t+e}m`,cB=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,fB=(e=0)=>(t,r,i)=>`\x1B[${38+e};2;${t};${r};${i}m`,Xr={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Ix=Object.keys(Xr.modifier),k_=Object.keys(Xr.color),N_=Object.keys(Xr.bgColor),hx=[...k_,...N_];function x_(){let e=new Map;for(let[t,r]of Object.entries(Xr)){for(let[i,s]of Object.entries(r))Xr[i]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[i]=Xr[i],e.set(s[0],s[1]);Object.defineProperty(Xr,t,{value:r,enumerable:!1})}return Object.defineProperty(Xr,"codes",{value:e,enumerable:!1}),Xr.color.close="\x1B[39m",Xr.bgColor.close="\x1B[49m",Xr.color.ansi=uB(),Xr.color.ansi256=cB(),Xr.color.ansi16m=fB(),Xr.bgColor.ansi=uB(10),Xr.bgColor.ansi256=cB(10),Xr.bgColor.ansi16m=fB(10),Object.defineProperties(Xr,{rgbToAnsi256:{value(t,r,i){return t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[i]=r;i.length===3&&(i=[...i].map(a=>a+a).join(""));let s=Number.parseInt(i,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:t=>Xr.rgbToAnsi256(...Xr.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,i,s;if(t>=232)r=((t-232)*10+8)/255,i=r,s=r;else{t-=16;let p=t%36;r=Math.floor(t/36)/5,i=Math.floor(p/6)/5,s=p%6/5}let a=Math.max(r,i,s)*2;if(a===0)return 30;let u=30+(Math.round(s)<<2|Math.round(i)<<1|Math.round(r));return a===2&&(u+=60),u},enumerable:!1},rgbToAnsi:{value:(t,r,i)=>Xr.ansi256ToAnsi(Xr.rgbToAnsi256(t,r,i)),enumerable:!1},hexToAnsi:{value:t=>Xr.ansi256ToAnsi(Xr.hexToAnsi256(t)),enumerable:!1}}),Xr}var T_=x_(),Zr=T_;var Cd=new Set(["\x1B","\x9B"]),O_=39,fE="\x07",pB="[",L_="]",mB="m",hd=`${L_}8;;`,gB=e=>`${Cd.values().next().value}${pB}${e}${mB}`,dB=e=>`${Cd.values().next().value}${hd}${e}${fE}`,M_=e=>e.split(" ").map(t=>ln(t)),cE=(e,t,r)=>{let i=[...t],s=!1,a=!1,u=ln(Df(e.at(-1)));for(let[p,E]of i.entries()){let I=ln(E);if(u+I<=r?e[e.length-1]+=E:(e.push(E),u=0),Cd.has(E)&&(s=!0,a=i.slice(p+1,p+1+hd.length).join("")===hd),s){a?E===fE&&(s=!1,a=!1):E===mB&&(s=!1);continue}u+=I,u===r&&p0&&e.length>1&&(e[e.length-2]+=e.pop())},P_=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(ln(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},U_=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",s,a,u=M_(e),p=[""];for(let[D,v]of e.split(" ").entries()){r.trim!==!1&&(p[p.length-1]=p.at(-1).trimStart());let T=ln(p.at(-1));if(D!==0&&(T>=t&&(r.wordWrap===!1||r.trim===!1)&&(p.push(""),T=0),(T>0||r.trim===!1)&&(p[p.length-1]+=" ",T++)),r.hard&&u[D]>t){let P=t-T,Z=1+Math.floor((u[D]-P-1)/t);Math.floor((u[D]-1)/t)t&&T>0&&u[D]>0){if(r.wordWrap===!1&&Tt&&r.wordWrap===!1){cE(p,v,t);continue}p[p.length-1]+=v}r.trim!==!1&&(p=p.map(D=>P_(D)));let E=p.join(` `),I=[...E],y=0;for(let[D,v]of I.entries()){if(i+=v,Cd.has(v)){let{groups:P}=new RegExp(`(?:\\${pB}(?\\d+)m|\\${hd}(?.*)${fE})`).exec(E.slice(y))||{groups:{}};if(P.code!==void 0){let Z=Number.parseFloat(P.code);s=Z===O_?void 0:Z}else P.uri!==void 0&&(a=P.uri.length===0?void 0:P.uri)}let T=Zr.codes.get(Number(s));I[D+1]===` @@ -121,7 +121,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(r.setEncoding("utf8"),t){this.rawModeEnabledCount===0&&(r.ref(),r.setRawMode(!0),r.addListener("readable",this.handleReadable)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount===0&&(r.setRawMode(!1),r.removeListener("readable",this.handleReadable),r.unref())};handleReadable=()=>{let t;for(;(t=this.props.stdin.read())!==null;)this.handleInput(t),this.internal_eventEmitter.emit("input",t)};handleInput=t=>{t===""&&this.props.exitOnCtrlC&&this.handleExit(),t===Tb&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(t===Nb&&this.focusNext(),t===xb&&this.focusPrevious())};handleExit=t=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(t)};enableFocus=()=>{this.setState({isFocusEnabled:!0})};disableFocus=()=>{this.setState({isFocusEnabled:!1})};focus=t=>{this.setState(r=>r.focusables.some(s=>s?.id===t)?{activeFocusId:t}:r)};focusNext=()=>{this.setState(t=>{let r=t.focusables.find(s=>s.isActive)?.id;return{activeFocusId:this.findNextFocusable(t)??r}})};focusPrevious=()=>{this.setState(t=>{let r=t.focusables.findLast(s=>s.isActive)?.id;return{activeFocusId:this.findPreviousFocusable(t)??r}})};addFocusable=(t,{autoFocus:r})=>{this.setState(i=>{let s=i.activeFocusId;return!s&&r&&(s=t),{activeFocusId:s,focusables:[...i.focusables,{id:t,isActive:!0}]}})};removeFocusable=t=>{this.setState(r=>({activeFocusId:r.activeFocusId===t?void 0:r.activeFocusId,focusables:r.focusables.filter(i=>i.id!==t)}))};activateFocusable=t=>{this.setState(r=>({focusables:r.focusables.map(i=>i.id!==t?i:{id:t,isActive:!0})}))};deactivateFocusable=t=>{this.setState(r=>({activeFocusId:r.activeFocusId===t?void 0:r.activeFocusId,focusables:r.focusables.map(i=>i.id!==t?i:{id:t,isActive:!1})}))};findNextFocusable=t=>{let r=t.focusables.findIndex(i=>i.id===t.activeFocusId);for(let i=r+1;i{let r=t.focusables.findIndex(i=>i.id===t.activeFocusId);for(let i=r-1;i>=0;i--){let s=t.focusables[i];if(s?.isActive)return s.id}}};var My=()=>{},Pf=class{options;log;throttledLog;isUnmounted;lastOutput;container;rootNode;fullStaticOutput;exitPromise;restoreConsole;unsubscribeResize;constructor(t){Gm(this),this.options=t,this.rootNode=wd("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.rootNode.onRender=t.debug?this.onRender:sd(this.onRender,32,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=py.create(t.stdout),this.throttledLog=t.debug?this.log:sd(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.fullStaticOutput="",this.container=cl.createContainer(this.rootNode,0,null,!1,null,"id",()=>{},null),this.unsubscribeExit=(0,Uy.default)(this.unmount,{alwaysLast:!1}),Ob.env.DEV==="true"&&cl.injectIntoDevTools({bundleType:0,version:"16.13.1",rendererPackageName:"ink"}),t.patchConsole&&this.patchConsole(),el||(t.stdout.on("resize",this.resized),this.unsubscribeResize=()=>{t.stdout.off("resize",this.resized)})}resized=()=>{this.calculateLayout(),this.onRender()};resolveExitPromise=()=>{};rejectExitPromise=()=>{};unsubscribeExit=()=>{};calculateLayout=()=>{let t=this.options.stdout.columns||80;this.rootNode.yogaNode.setWidth(t),this.rootNode.yogaNode.calculateLayout(void 0,void 0,ft.DIRECTION_LTR)};onRender=()=>{if(this.isUnmounted)return;let{output:t,outputHeight:r,staticOutput:i}=sy(this.rootNode),s=i&&i!==` `;if(this.options.debug){s&&(this.fullStaticOutput+=i),this.options.stdout.write(this.fullStaticOutput+t);return}if(el){s&&this.options.stdout.write(i),this.lastOutput=t;return}if(s&&(this.fullStaticOutput+=i),r>=this.options.stdout.rows){this.options.stdout.write(Ho.clearTerminal+this.fullStaticOutput+t),this.lastOutput=t;return}s&&(this.log.clear(),this.options.stdout.write(i),this.log(t)),!s&&t!==this.lastOutput&&this.throttledLog(t),this.lastOutput=t};render(t){let r=Py.default.createElement(Mf,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,exitOnCtrlC:this.options.exitOnCtrlC,onExit:this.unmount},t);cl.updateContainer(r,this.container,null,My)}writeToStdout(t){if(!this.isUnmounted){if(this.options.debug){this.options.stdout.write(t+this.fullStaticOutput+this.lastOutput);return}if(el){this.options.stdout.write(t);return}this.log.clear(),this.options.stdout.write(t),this.log(this.lastOutput)}}writeToStderr(t){if(!this.isUnmounted){if(this.options.debug){this.options.stderr.write(t),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(el){this.options.stderr.write(t);return}this.log.clear(),this.options.stderr.write(t),this.log(this.lastOutput)}}unmount(t){this.isUnmounted||(this.calculateLayout(),this.onRender(),this.unsubscribeExit(),typeof this.restoreConsole=="function"&&this.restoreConsole(),typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),el?this.options.stdout.write(this.lastOutput+` `):this.options.debug||this.log.done(),this.isUnmounted=!0,cl.updateContainer(null,this.container,null,My),Ku.delete(this.options.stdout),t instanceof Error?this.rejectExitPromise(t):this.resolveExitPromise())}async waitUntilExit(){return this.exitPromise||=new Promise((t,r)=>{this.resolveExitPromise=t,this.rejectExitPromise=r}),this.exitPromise}clear(){!el&&!this.options.debug&&this.log.clear()}patchConsole(){this.options.debug||(this.restoreConsole=vC((t,r)=>{t==="stdout"&&this.writeToStdout(r),t==="stderr"&&(r.startsWith("The above error occurred")||this.writeToStderr(r))}))}};var Mb=(e,t)=>{let r={stdout:sp.stdout,stdin:sp.stdin,stderr:sp.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0,...Pb(t)},i=Ub(r.stdout,()=>new Pf(r));return i.render(e),{rerender:i.render,unmount(){i.unmount()},waitUntilExit:i.waitUntilExit,cleanup:()=>Ku.delete(r.stdout),clear:i.clear}},lI=Mb,Pb=(e={})=>e instanceof Lb?{stdout:e,stdin:sp.stdin}:e,Ub=(e,t)=>{let r=Ku.get(e);return r||(r=t(),Ku.set(e,r)),r};var Sa=Me(qt(),1);function Uf(e){let{items:t,children:r,style:i}=e,[s,a]=(0,Sa.useState)(0),u=(0,Sa.useMemo)(()=>t.slice(s),[t,s]);(0,Sa.useLayoutEffect)(()=>{a(t.length)},[t.length]);let p=u.map((I,y)=>r(I,s+y)),E=(0,Sa.useMemo)(()=>({position:"absolute",flexDirection:"column",...i}),[i]);return Sa.default.createElement("ink-box",{internal_static:!0,style:E},p)}var Gb=Me(qt(),1);var Hb=Me(qt(),1);var Wb=Me(qt(),1);var uI=Me(qt(),1);import{Buffer as jb}from"node:buffer";var Kb=/^(?:\x1b)([a-zA-Z0-9])$/,Jb=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,Gy={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"},Hy=[...Object.values(Gy),"backspace"],Yb=e=>["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(e),Vb=e=>["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(e),$b=(e="")=>{let t;jb.isBuffer(e)?e[0]>127&&e[1]===void 0?(e[0]-=128,e="\x1B"+String(e)):e=String(e):e!==void 0&&typeof e!="string"?e=String(e):e||(e="");let r={name:"",ctrl:!1,meta:!1,shift:!1,option:!1,sequence:e,raw:e};if(r.sequence=r.sequence||e||r.name,e==="\r")r.raw=void 0,r.name="return";else if(e===` -`)r.name="enter";else if(e===" ")r.name="tab";else if(e==="\b"||e==="\x1B\b")r.name="backspace",r.meta=e.charAt(0)==="\x1B";else if(e==="\x7F"||e==="\x1B\x7F")r.name="delete",r.meta=e.charAt(0)==="\x1B";else if(e==="\x1B"||e==="\x1B\x1B")r.name="escape",r.meta=e.length===2;else if(e===" "||e==="\x1B ")r.name="space",r.meta=e.length===2;else if(e.length===1&&e<="")r.name=String.fromCharCode(e.charCodeAt(0)+97-1),r.ctrl=!0;else if(e.length===1&&e>="0"&&e<="9")r.name="number";else if(e.length===1&&e>="a"&&e<="z")r.name=e;else if(e.length===1&&e>="A"&&e<="Z")r.name=e.toLowerCase(),r.shift=!0;else if(t=Kb.exec(e))r.meta=!0,r.shift=/^[A-Z]$/.test(t[1]);else if(t=Jb.exec(e)){let i=[...e];i[0]==="\x1B"&&i[1]==="\x1B"&&(r.option=!0);let s=[t[1],t[2],t[4],t[6]].filter(Boolean).join(""),a=(t[3]||t[5]||1)-1;r.ctrl=!!(a&4),r.meta=!!(a&10),r.shift=!!(a&1),r.code=s,r.name=Gy[s],r.shift=Yb(s)||r.shift,r.ctrl=Vb(s)||r.ctrl}return r},Wy=$b;var jy=Me(qt(),1);var qb=()=>(0,jy.useContext)(tp),ap=qb;var zb=(e,t={})=>{let{stdin:r,setRawMode:i,internal_exitOnCtrlC:s,internal_eventEmitter:a}=ap();(0,uI.useEffect)(()=>{if(t.isActive!==!1)return i(!0),()=>{i(!1)}},[t.isActive,i]),(0,uI.useEffect)(()=>{if(t.isActive===!1)return;let u=p=>{let E=Wy(p),I={upArrow:E.name==="up",downArrow:E.name==="down",leftArrow:E.name==="left",rightArrow:E.name==="right",pageDown:E.name==="pagedown",pageUp:E.name==="pageup",return:E.name==="return",escape:E.name==="escape",ctrl:E.ctrl,shift:E.shift,tab:E.name==="tab",backspace:E.name==="backspace",delete:E.name==="delete",meta:E.meta||E.name==="escape"||E.option},y=E.ctrl?E.name:E.sequence;Hy.includes(E.name)&&(y=""),y.startsWith("\x1B")&&(y=y.slice(1)),y.length===1&&typeof y[0]=="string"&&/[A-Z]/.test(y[0])&&(I.shift=!0),(!(y==="c"&&I.ctrl)||!s)&&cl.batchedUpdates(()=>{e(y,I)})};return a?.on("input",u),()=>{a?.removeListener("input",u)}},[t.isActive,r,s,e])},Ei=zb;var Ky=Me(qt(),1);var Xb=()=>(0,Ky.useContext)(ep),ms=Xb;var Jy=Me(qt(),1);var Zb=()=>(0,Jy.useContext)(rp),Ra=Zb;var eF=Me(qt(),1);var cI=Me(qt(),1);var tF=Me(qt(),1);var Yy={schema:1,id:"argus",name:"Argus",tagline:"Autonomous Work Lab",terminal_wordmark:"argus",assets:{}};function Vy(e){if(!e||typeof e!="object")throw new Error("Invalid application brand");let t=e;if(t.schema!==1||typeof t.id!="string"||!/^[a-z][a-z0-9-]{0,39}$/.test(t.id))throw new Error("Invalid application brand identity");for(let[s,a]of[["name",48],["tagline",100],["terminal_wordmark",24]]){let u=t[s];if(typeof u!="string"||!u.trim()||u.length>a||/[\x00-\x1f\x7f-\x9f]/.test(u))throw new Error(`Invalid application brand ${s}`)}if(!/^[a-z0-9 -]+$/.test(String(t.terminal_wordmark)))throw new Error("Invalid terminal wordmark");if(!t.assets||typeof t.assets!="object"||Array.isArray(t.assets))throw new Error("Invalid application brand assets");let r={},i=["mark","mark_dark","logo","logo_dark","icon","icon_dark"];for(let s of i){let a=t.assets[s];if(a!==void 0&&a!==`/api/application-brand/assets/${s}`)throw new Error(`Invalid application brand asset ${s}`);if(typeof a=="string")r[s]=a;else if(t.id!=="argus")throw new Error(`Missing application brand asset ${s}`)}return{schema:1,id:t.id,name:String(t.name),tagline:String(t.tagline),terminal_wordmark:String(t.terminal_wordmark),assets:r}}function Un(){let e=process.env.ARGUS_TUI_APPLICATION_BRAND;return e?Vy(JSON.parse(e)):Yy}UE();var fI="application.workflows.v1";function $y(e,t="Tool execution"){return e==="host"?t:e}function qy(e,t){let r="/api/application-workflows",i=s=>`${r}/${encodeURIComponent(s)}`;return{catalog:()=>e(r),create:s=>t(r,s),open:s=>t(`${r}/open`,{project:s}),snapshot:s=>e(i(s)),action:(s,a)=>t(i(s),a),document:(s,a)=>e(`${i(s)}/document?path=${encodeURIComponent(a)}`)}}import{randomUUID as lp}from"node:crypto";import{homedir as lF}from"node:os";import{posix as uF,win32 as hI}from"node:path";var gI=class extends Error{status;method;path;code;detail;constructor(t,r,i,s,a="",u=""){super(t),this.name="ApiError",this.status=r,this.method=i,this.path=s,this.code=a,this.detail=u}};function rF(e){let t=e.replace(/\s+/g," ").trim();if(!t)return{detail:"",code:""};try{let r=JSON.parse(e),i=r.detail&&typeof r.detail=="object"&&!Array.isArray(r.detail)?r.detail:void 0,s=typeof r.code=="string"&&r.code.trim()?r.code.trim():typeof i?.code=="string"?i.code.trim():"";if(i)for(let a of["message","detail"]){let u=i[a];if(typeof u=="string"&&u.trim())return{detail:u.trim(),code:s}}for(let a of["detail","error","message"]){let u=r[a];if(typeof u=="string"&&u.trim())return{detail:u.trim(),code:s};if(Array.isArray(u)){let p=u.map(E=>E&&typeof E=="object"?String(E.msg??""):"").filter(Boolean);if(p.length)return{detail:p.join("; "),code:s}}}return{detail:"",code:s}}catch{}return{detail:t.startsWith("typeof D=="string"):[],u=dI(i?.major),p=dI(i?.minor);if(!r||!i||!s)return{compatible:!1,reason:"malformed /api/meta response"};if(typeof s.source_root!="string"||dI(s.pid)===null||typeof s.package_version!="string"||typeof s.release_id!="string")return{compatible:!1,reason:"malformed /api/meta runtime identity"};if(r.service!==zy)return{compatible:!1,reason:`unexpected service ${String(r.service||"unknown")}`};let E=e;if(i.name!==fl.name||u!==fl.major)return{compatible:!1,reason:`protocol ${String(i.name||"unknown")}/${String(u)} is incompatible with client ${fl.name}/${fl.major}`,meta:E};if(p===null||p!a.includes(D));if(I.length>0)return{compatible:!1,reason:`missing capabilities: ${I.join(", ")}`,meta:E};if(s.source_root_matches_config===!1)return{compatible:!1,reason:"backend is running from a different installation than configured",meta:E};if(t&&s.release_id!==t.releaseId)return{compatible:!1,reason:"backend and client installations are out of sync; restart or reinstall Argus",meta:E};if(t?.sourceDigest){if(typeof s.runtime_source_digest!="string"||!s.runtime_source_digest)return{compatible:!1,reason:"backend cannot verify this local installation; restart it from the current checkout",meta:E};if(s.runtime_source_digest!==t.sourceDigest)return{compatible:!1,reason:"backend is running code from a different local installation; restart it",meta:E}}let y=s.release_matches_source===!1?Ap:void 0;return{compatible:!0,reason:"",...y?{warning:y}:{},meta:E}}function Zy(e,t,r){let i=mI(e,t);if(!i.compatible||!i.meta)throw new Error(`incompatible Argus API: ${i.reason}`);return i.warning&&r?.(i.warning),i.meta}function EI(e){let t=Wf(e),r=Wf(t?.daemon);if(!t||t.schema_version!==Hf)throw new Error(`incompatible snapshot schema: expected ${Hf}, got ${String(t?.schema_version??"missing")}`);if(!r)throw new Error("invalid snapshot: daemon section is missing");let s=["read_status","read_error","protocol_compatible","protocol_error"].filter(p=>!Object.hasOwn(r,p));if(s.length>0)throw new Error(`invalid snapshot: daemon fields missing: ${s.join(", ")}`);let u=["spend_usd","spend_status","usage_summary","daemon_commands","observability","mission_view","partial","diagnostics"].filter(p=>!Object.hasOwn(t,p));if(u.length>0)throw new Error(`invalid snapshot: fields missing: ${u.join(", ")}`);if(!Array.isArray(t.diagnostics))throw new Error("invalid snapshot: diagnostics must be an array");return e}function e0(e,t={releaseId:Gf}){return mI(e,t)}function t0(e,t){return Zy(e,{releaseId:Gf},t)}function II(e){let t=typeof e=="string"||e instanceof URL?String(e):e.url;try{let r=new URL(t);return r.username="",r.password="",r.searchParams.has("token")&&r.searchParams.set("token","[redacted]"),r.toString()}catch{return t}}function gl(e,t){return typeof e=="object"&&e!==null?e[t]:void 0}function oF(e){let t=gl(e,"cause"),r=new Set;for(;gl(t,"cause")&&!r.has(t);)r.add(t),t=gl(t,"cause");return t??e}function iF(e,t,r="GET"){let i=oF(e),s=String(gl(i,"code")??"").trim(),a=String(gl(i,"address")??"").trim(),u=String(gl(i,"port")??"").trim(),p=a&&u?`${a}:${u}`:a,E=i instanceof Error?i.message.trim():String(i??"").trim(),I=e instanceof Error?e.message.trim():String(e??"").trim(),y;return s==="ECONNREFUSED"?y=`connection refused${p?` by ${p}`:""}`:s==="ECONNRESET"?y="connection reset by the local service":s==="ETIMEDOUT"?y="connection timed out":s==="ENOTFOUND"?y="host name could not be resolved":E&&E!==I?y=E:y=I||"network request failed",`${r.toUpperCase()} ${II(t)} failed: ${y}${s?` (${s})`:""}`}function r0(e){return e%1e3===0?`${e/1e3}s`:`${e}ms`}async function sF(e,t,r,i,s){let a=Number.isFinite(r)&&r>0?Math.max(1,Math.trunc(r)):1,u=new AbortController,p=t.signal,E=!1,I=!1,y=()=>u.abort(p?.reason);p?.aborted?y():p?.addEventListener("abort",y,{once:!0});let D=(async()=>{let P=await fetch(e,{...t,signal:u.signal});return I=!0,await s(P)})(),v,T=new Promise((P,Z)=>{v=setTimeout(()=>{E=!0;let ee=new Error(`request timed out after ${r0(a)}`);u.abort(ee),Z(ee)},a)});try{return await Promise.race([D,T])}catch(P){throw E?new Error(`${i.toUpperCase()} ${II(e)} timed out after ${r0(a)}; the local Argus service did not respond`,{cause:P}):p?.aborted?p.reason instanceof Error?p.reason:new Error(`${i.toUpperCase()} ${II(e)} was aborted`,{cause:P}):I&&gl(P,"cause")===void 0?P:new Error(iF(P,e,i),{cause:P})}finally{v&&clearTimeout(v),p?.removeEventListener("abort",y)}}function Hs(e,t,r,i,s=t.method??"GET"){return sF(e,t,r,s,i)}function cF(e,t=lF()){let r=p=>p.includes("\\")||/^[A-Za-z]:[\\/]/.test(p),i=r(e)?hI:uF,s=i.resolve(e),a=p=>i===hI?p.toLowerCase():p,u=r(t)===(i===hI)?a(i.resolve(t)):"";if(!(a(s)===u||a(s)===a(i.parse(s).root)))return s}function fF(e,t=""){let r=t.trim();return e===4401?{code:e,reason:r||"event stream authentication was rejected",retryable:!1}:e===4404?{code:e,reason:r||"the selected project no longer exists",retryable:!1}:{code:e,reason:r,retryable:!0}}function CI(e){let t=e.item?.title||"new mission";return e.daemon?.admission_required?`\u2192 queued: choose one running session to park before starting ${t}`:e.daemon&&e.daemon.rc!==0?`\u2192 queued but not running: ${e.daemon.error||"background executor failed to start"}`:`\u2192 dispatched to the team: ${t}`}function n0(e){let t=[],r;for(;(r=e.indexOf(` +`)r.name="enter";else if(e===" ")r.name="tab";else if(e==="\b"||e==="\x1B\b")r.name="backspace",r.meta=e.charAt(0)==="\x1B";else if(e==="\x7F"||e==="\x1B\x7F")r.name="delete",r.meta=e.charAt(0)==="\x1B";else if(e==="\x1B"||e==="\x1B\x1B")r.name="escape",r.meta=e.length===2;else if(e===" "||e==="\x1B ")r.name="space",r.meta=e.length===2;else if(e.length===1&&e<="")r.name=String.fromCharCode(e.charCodeAt(0)+97-1),r.ctrl=!0;else if(e.length===1&&e>="0"&&e<="9")r.name="number";else if(e.length===1&&e>="a"&&e<="z")r.name=e;else if(e.length===1&&e>="A"&&e<="Z")r.name=e.toLowerCase(),r.shift=!0;else if(t=Kb.exec(e))r.meta=!0,r.shift=/^[A-Z]$/.test(t[1]);else if(t=Jb.exec(e)){let i=[...e];i[0]==="\x1B"&&i[1]==="\x1B"&&(r.option=!0);let s=[t[1],t[2],t[4],t[6]].filter(Boolean).join(""),a=(t[3]||t[5]||1)-1;r.ctrl=!!(a&4),r.meta=!!(a&10),r.shift=!!(a&1),r.code=s,r.name=Gy[s],r.shift=Yb(s)||r.shift,r.ctrl=Vb(s)||r.ctrl}return r},Wy=$b;var jy=Me(qt(),1);var qb=()=>(0,jy.useContext)(tp),ap=qb;var zb=(e,t={})=>{let{stdin:r,setRawMode:i,internal_exitOnCtrlC:s,internal_eventEmitter:a}=ap();(0,uI.useEffect)(()=>{if(t.isActive!==!1)return i(!0),()=>{i(!1)}},[t.isActive,i]),(0,uI.useEffect)(()=>{if(t.isActive===!1)return;let u=p=>{let E=Wy(p),I={upArrow:E.name==="up",downArrow:E.name==="down",leftArrow:E.name==="left",rightArrow:E.name==="right",pageDown:E.name==="pagedown",pageUp:E.name==="pageup",return:E.name==="return",escape:E.name==="escape",ctrl:E.ctrl,shift:E.shift,tab:E.name==="tab",backspace:E.name==="backspace",delete:E.name==="delete",meta:E.meta||E.name==="escape"||E.option},y=E.ctrl?E.name:E.sequence;Hy.includes(E.name)&&(y=""),y.startsWith("\x1B")&&(y=y.slice(1)),y.length===1&&typeof y[0]=="string"&&/[A-Z]/.test(y[0])&&(I.shift=!0),(!(y==="c"&&I.ctrl)||!s)&&cl.batchedUpdates(()=>{e(y,I)})};return a?.on("input",u),()=>{a?.removeListener("input",u)}},[t.isActive,r,s,e])},Ei=zb;var Ky=Me(qt(),1);var Xb=()=>(0,Ky.useContext)(ep),ms=Xb;var Jy=Me(qt(),1);var Zb=()=>(0,Jy.useContext)(rp),Ra=Zb;var eF=Me(qt(),1);var cI=Me(qt(),1);var tF=Me(qt(),1);var Yy={schema:1,id:"argus",name:"Argus",tagline:"Autonomous Work Lab",terminal_wordmark:"argus",assets:{}};function Vy(e){if(!e||typeof e!="object")throw new Error("Invalid application brand");let t=e;if(t.schema!==1||typeof t.id!="string"||!/^[a-z][a-z0-9-]{0,39}$/.test(t.id))throw new Error("Invalid application brand identity");for(let[s,a]of[["name",48],["tagline",100],["terminal_wordmark",24]]){let u=t[s];if(typeof u!="string"||!u.trim()||u.length>a||/[\x00-\x1f\x7f-\x9f]/.test(u))throw new Error(`Invalid application brand ${s}`)}if(!/^[a-z0-9 -]+$/.test(String(t.terminal_wordmark)))throw new Error("Invalid terminal wordmark");if(!t.assets||typeof t.assets!="object"||Array.isArray(t.assets))throw new Error("Invalid application brand assets");let r={},i=["mark","mark_dark","logo","logo_dark","icon","icon_dark"];for(let s of i){let a=t.assets[s];if(a!==void 0&&a!==`/api/application-brand/assets/${s}`)throw new Error(`Invalid application brand asset ${s}`);if(typeof a=="string")r[s]=a;else if(t.id!=="argus")throw new Error(`Missing application brand asset ${s}`)}return{schema:1,id:t.id,name:String(t.name),tagline:String(t.tagline),terminal_wordmark:String(t.terminal_wordmark),assets:r}}function Un(){let e=process.env.ARGUS_TUI_APPLICATION_BRAND;return e?Vy(JSON.parse(e)):Yy}UE();var fI="application.workflows.v1";function $y(e,t="Tool execution"){return e==="host"?t:e}function qy(e,t){let r="/api/application-workflows",i=s=>`${r}/${encodeURIComponent(s)}`;return{catalog:()=>e(r),create:s=>t(r,s),open:s=>t(`${r}/open`,{project:s}),snapshot:s=>e(i(s)),action:(s,a)=>t(i(s),a),document:(s,a)=>e(`${i(s)}/document?path=${encodeURIComponent(a)}`)}}import{randomUUID as lp}from"node:crypto";import{homedir as lF}from"node:os";import{posix as uF,win32 as hI}from"node:path";var gI=class extends Error{status;method;path;code;detail;constructor(t,r,i,s,a="",u=""){super(t),this.name="ApiError",this.status=r,this.method=i,this.path=s,this.code=a,this.detail=u}};function rF(e){let t=e.replace(/\s+/g," ").trim();if(!t)return{detail:"",code:""};try{let r=JSON.parse(e),i=r.detail&&typeof r.detail=="object"&&!Array.isArray(r.detail)?r.detail:void 0,s=typeof r.code=="string"&&r.code.trim()?r.code.trim():typeof i?.code=="string"?i.code.trim():"";if(i)for(let a of["message","detail"]){let u=i[a];if(typeof u=="string"&&u.trim())return{detail:u.trim(),code:s}}for(let a of["detail","error","message"]){let u=r[a];if(typeof u=="string"&&u.trim())return{detail:u.trim(),code:s};if(Array.isArray(u)){let p=u.map(E=>E&&typeof E=="object"?String(E.msg??""):"").filter(Boolean);if(p.length)return{detail:p.join("; "),code:s}}}return{detail:"",code:s}}catch{}return{detail:t.startsWith("typeof D=="string"):[],u=dI(i?.major),p=dI(i?.minor);if(!r||!i||!s)return{compatible:!1,reason:"malformed /api/meta response"};if(typeof s.source_root!="string"||dI(s.pid)===null||typeof s.package_version!="string"||typeof s.release_id!="string")return{compatible:!1,reason:"malformed /api/meta runtime identity"};if(r.service!==zy)return{compatible:!1,reason:`unexpected service ${String(r.service||"unknown")}`};let E=e;if(i.name!==fl.name||u!==fl.major)return{compatible:!1,reason:`protocol ${String(i.name||"unknown")}/${String(u)} is incompatible with client ${fl.name}/${fl.major}`,meta:E};if(p===null||p!a.includes(D));if(I.length>0)return{compatible:!1,reason:`missing capabilities: ${I.join(", ")}`,meta:E};if(s.source_root_matches_config===!1)return{compatible:!1,reason:"backend is running from a different installation than configured",meta:E};if(t&&s.release_id!==t.releaseId)return{compatible:!1,reason:"backend and client installations are out of sync; restart or reinstall Argus",meta:E};if(t?.sourceDigest){if(typeof s.runtime_source_digest!="string"||!s.runtime_source_digest)return{compatible:!1,reason:"backend cannot verify this local installation; restart it from the current checkout",meta:E};if(s.runtime_source_digest!==t.sourceDigest)return{compatible:!1,reason:"backend is running code from a different local installation; restart it",meta:E}}let y=s.release_matches_source===!1?Ap:void 0;return{compatible:!0,reason:"",...y?{warning:y}:{},meta:E}}function Zy(e,t,r){let i=mI(e,t);if(!i.compatible||!i.meta)throw new Error(`incompatible Argus API: ${i.reason}`);return i.warning&&r?.(i.warning),i.meta}function EI(e){let t=Wf(e),r=Wf(t?.daemon);if(!t||t.schema_version!==Hf)throw new Error(`incompatible snapshot schema: expected ${Hf}, got ${String(t?.schema_version??"missing")}`);if(!r)throw new Error("invalid snapshot: daemon section is missing");let s=["read_status","read_error","protocol_compatible","protocol_error"].filter(p=>!Object.hasOwn(r,p));if(s.length>0)throw new Error(`invalid snapshot: daemon fields missing: ${s.join(", ")}`);let u=["spend_usd","spend_status","usage_summary","daemon_commands","observability","mission_view","partial","diagnostics"].filter(p=>!Object.hasOwn(t,p));if(u.length>0)throw new Error(`invalid snapshot: fields missing: ${u.join(", ")}`);if(!Array.isArray(t.diagnostics))throw new Error("invalid snapshot: diagnostics must be an array");return e}function e0(e,t={releaseId:Gf}){return mI(e,t)}function t0(e,t){return Zy(e,{releaseId:Gf},t)}function II(e){let t=typeof e=="string"||e instanceof URL?String(e):e.url;try{let r=new URL(t);return r.username="",r.password="",r.searchParams.has("token")&&r.searchParams.set("token","[redacted]"),r.toString()}catch{return t}}function gl(e,t){return typeof e=="object"&&e!==null?e[t]:void 0}function oF(e){let t=gl(e,"cause"),r=new Set;for(;gl(t,"cause")&&!r.has(t);)r.add(t),t=gl(t,"cause");return t??e}function iF(e,t,r="GET"){let i=oF(e),s=String(gl(i,"code")??"").trim(),a=String(gl(i,"address")??"").trim(),u=String(gl(i,"port")??"").trim(),p=a&&u?`${a}:${u}`:a,E=i instanceof Error?i.message.trim():String(i??"").trim(),I=e instanceof Error?e.message.trim():String(e??"").trim(),y;return s==="ECONNREFUSED"?y=`connection refused${p?` by ${p}`:""}`:s==="ECONNRESET"?y="connection reset by the local service":s==="ETIMEDOUT"?y="connection timed out":s==="ENOTFOUND"?y="host name could not be resolved":E&&E!==I?y=E:y=I||"network request failed",`${r.toUpperCase()} ${II(t)} failed: ${y}${s?` (${s})`:""}`}function r0(e){return e%1e3===0?`${e/1e3}s`:`${e}ms`}async function sF(e,t,r,i,s){let a=Number.isFinite(r)&&r>0?Math.max(1,Math.trunc(r)):1,u=new AbortController,p=t.signal,E=!1,I=!1,y=()=>u.abort(p?.reason);p?.aborted?y():p?.addEventListener("abort",y,{once:!0});let D=(async()=>{let P=await fetch(e,{...t,signal:u.signal});return I=!0,await s(P)})(),v,T=new Promise((P,Z)=>{v=setTimeout(()=>{E=!0;let ee=new Error(`request timed out after ${r0(a)}`);u.abort(ee),Z(ee)},a)});try{return await Promise.race([D,T])}catch(P){throw E?new Error(`${i.toUpperCase()} ${II(e)} timed out after ${r0(a)}; the local Argus service did not respond`,{cause:P}):p?.aborted?p.reason instanceof Error?p.reason:new Error(`${i.toUpperCase()} ${II(e)} was aborted`,{cause:P}):I&&gl(P,"cause")===void 0?P:new Error(iF(P,e,i),{cause:P})}finally{v&&clearTimeout(v),p?.removeEventListener("abort",y)}}function Hs(e,t,r,i,s=t.method??"GET"){return sF(e,t,r,s,i)}function cF(e,t=lF()){let r=p=>p.includes("\\")||/^[A-Za-z]:[\\/]/.test(p),i=r(e)?hI:uF,s=i.resolve(e),a=p=>i===hI?p.toLowerCase():p,u=r(t)===(i===hI)?a(i.resolve(t)):"";if(!(a(s)===u||a(s)===a(i.parse(s).root)))return s}function fF(e,t=""){let r=t.trim();return e===4401?{code:e,reason:r||"event stream authentication was rejected",retryable:!1}:e===4404?{code:e,reason:r||"the selected project no longer exists",retryable:!1}:{code:e,reason:r,retryable:!0}}function CI(e){let t=e.item?.title||"new mission";return e.daemon?.admission_required?`\u2192 queued: choose one running session to park before starting ${t}`:e.daemon&&e.daemon.rc!==0?`\u2192 queued but not running: ${e.daemon.error||"background executor failed to start"}`:`\u2192 dispatched to the team: ${t}`}function n0(e){let t=[],r;for(;(r=e.indexOf(` `))>=0;){let i=e.slice(0,r);e=e.slice(r+2);for(let s of i.split(` `)){let a=s.trim();if(a.startsWith("data:"))try{t.push(JSON.parse(a.slice(5).trim()))}catch{}}}return{frames:t,rest:e}}var Es=class{httpBase;wsBase;project;token;onCompatibilityWarning;metaTimeoutMs;readTimeoutMs;metaPromise;constructor(t){this.httpBase=`http://${t.host}:${t.port}`,this.wsBase=`ws://${t.host}:${t.port}`,this.project=t.project,this.token=t.token,this.onCompatibilityWarning=t.onCompatibilityWarning,this.metaTimeoutMs=t.metaTimeoutMs??8e3,this.readTimeoutMs=t.readTimeoutMs??12e3}authHeaders(){return this.token?{Authorization:`Bearer ${this.token}`}:{}}p(t){return`${this.httpBase}/api/projects/${encodeURIComponent(this.project)}${t}`}workflows=qy(t=>this.workflowRequest("GET",t),(t,r)=>this.workflowRequest("POST",t,r));workflowRequest(t,r,i){return Hs(`${this.httpBase}${r}`,{method:t,headers:{"Content-Type":"application/json",...this.authHeaders()},body:i===void 0?void 0:JSON.stringify(i)},this.readTimeoutMs,async s=>(await Yn(s,t,r),await s.json()))}meta(){if(!this.metaPromise){let t="/api/meta",r=Hs(`${this.httpBase}${t}`,{headers:this.authHeaders()},this.metaTimeoutMs,async i=>{if(i.status===404)throw new Error("incompatible Argus API: service does not expose /api/meta");return await Yn(i,"GET",t),t0(await i.json(),this.onCompatibilityWarning)});this.metaPromise=r,r.catch(()=>{this.metaPromise===r&&(this.metaPromise=void 0)})}return this.metaPromise}async listProjects(){return await this.meta(),Hs(`${this.httpBase}/api/projects`,{headers:this.authHeaders()},this.readTimeoutMs,async t=>(await Yn(t,"GET","/api/projects"),(await t.json()).projects))}async createDaemon(t="",r="",i=process.cwd(),s,a=lp()){let u="/api/daemons",p=cF(i),E={objective:t,name:r,launch_cwd:i,command_id:a,expected_revision:s};p&&(E.workdir=p);let I=JSON.stringify(E),y=()=>fetch(`${this.httpBase}${u}`,{method:"POST",headers:{"Content-Type":"application/json",Connection:"close",...this.authHeaders()},body:I}),D=await y();return D.status===400&&/Invalid HTTP request received/i.test(await D.clone().text())&&(D=await y()),await Yn(D,"POST",u),await D.json()}async replaceDaemon(t,r=!1,i,s=lp()){return await this.post("/daemon/replace",{victim_sid:t,resume_continuous:r,command_id:s,expected_revision:i})}async scheduleDaemonUpgrade(t,r,i=lp()){let s=`/api/projects/${encodeURIComponent(t)}/daemon/upgrade-schedule`,a=await fetch(`${this.httpBase}${s}`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders()},body:JSON.stringify({command_id:i,expected_revision:r})});return await Yn(a,"POST",s),await a.json()}stopDaemon(t=lp()){let r="/daemon/stop";return Hs(this.p(r),{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders()},body:JSON.stringify({force:!1,drain:!1,command_id:t})},this.readTimeoutMs,async i=>{await Yn(i,"POST",r);let s=await i.json(),a=Number(s.rc??0);if(!Number.isFinite(a)||![0,1].includes(a)){let u=String(s.error??s.message??`rc=${String(s.rc??"unknown")}`);throw new Error(`executor did not stop cleanly: ${u}`)}return s})}async setProjectLaunchCwd(t,r){let i=`/api/projects/${encodeURIComponent(t)}/launch-cwd`,s=await fetch(`${this.httpBase}${i}`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders()},body:JSON.stringify({launch_cwd:r})});await Yn(s,"POST",i)}async setProjectWorkdir(t,r){let i=`/api/projects/${encodeURIComponent(t)}/workdir`,s=await fetch(`${this.httpBase}${i}`,{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders()},body:JSON.stringify({workdir:r})});await Yn(s,"POST",i)}async renameProject(t){let r=this.p(""),i=await fetch(r,{method:"PATCH",headers:{"Content-Type":"application/json",...this.authHeaders()},body:JSON.stringify({name:t})});return await Yn(i,"PATCH",r),await i.json()}async snapshot(t=1,r,i=!1){return await this.meta(),Hs(this.p(`/snapshot?compact=true&events_limit=${t}`+(i?"&prewarm=true":"")),{headers:this.authHeaders(),signal:r},this.readTimeoutMs,async s=>(await Yn(s,"GET","/snapshot"),EI(await s.json())))}async postTask(t){let r=await fetch(this.p("/tasks"),{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders()},body:JSON.stringify({text:t})});return await Yn(r,"POST","/tasks"),(await r.json()).item}async postNudge(t){let r=await fetch(this.p("/nudge"),{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders()},body:JSON.stringify({text:t})});await Yn(r,"POST","/nudge")}async message(t,r){let i=await fetch(this.p("/message"),{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders()},body:JSON.stringify({text:t}),signal:r});return await Yn(i,"POST","/message"),await i.json()}async messageStream(t,r,i){let s=await fetch(this.p("/message/stream"),{method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders()},body:JSON.stringify({text:t}),signal:i});if(await Yn(s,"POST","/message/stream"),!s.body)throw new Error("Manager stream returned no response body");let a=I=>{if(!i?.aborted)if(I.type==="phase"){let y=Number(I.quiet_s??0);r.onPhase?.(String(I.label??""),String(I.role??"manager"),{heartbeat:I.heartbeat===!0,quietS:Number.isFinite(y)?y:0,kind:String(I.kind??""),detail:String(I.detail??"")})}else I.type==="delta"?r.onDelta?.(String(I.text??""),String(I.message_id??""),String(I.fragment_mode??"auto")):I.type==="done"?r.onDone?.(I.result??{}):I.type==="error"&&r.onError?.(new Error(String(I.error??"stream error")))},u=s.body.getReader(),p=new TextDecoder,E="";for(;;){let{done:I,value:y}=await u.read();if(I)break;E+=p.decode(y,{stream:!0});let D=n0(E);E=D.rest,D.frames.forEach(a)}i?.aborted||n0(E+` @@ -134,9 +134,9 @@ ${s}`}var c0=["all","attention","milestones","messages"],mF=new Set([G.LIFE_MISS Next action: ${I}`:u,a)}else if([G.SKILL_CREATED,G.SKILL_UPDATED].includes(r)){let s=Fe(t,"skill_id")||Fe(t,"name");s&&(Na(e.learned_skills,"id",s,{id:s,name:Fe(t,"name"),version:Ks(t,"version")??1,scope:Fe(t,"scope"),path:Fe(t,"path"),status:"active",updated_at:i,mission_id:e.mission.id,mission_title:e.mission.title}),Vn(e,t,"reviewer",r===G.SKILL_CREATED?"Capability unlocked":"Capability upgraded",Fe(t,"name"),"skill"))}else if(r===G.SKILL_EVOLUTION_COMPLETED)e.storage.project_skill_dir=Fe(t,"project_skill_dir")||e.storage.project_skill_dir,e.storage.global_skill_dir=Fe(t,"global_skill_dir")||e.storage.global_skill_dir,e.storage.project_skill_count=Ks(t,"project_skill_count")??e.storage.project_skill_count,e.storage.global_skill_count=Ks(t,"global_skill_count")??e.storage.global_skill_count;else if(r===G.SKILL_HISTORY_COMPRESSED)e.storage.skill_history_compressed+=Ks(t,"count")??0,e.storage.skill_history_bytes_saved+=Ks(t,"bytes_saved")??0;else if(r===G.SKILL_TIDIED){let s=Fe(t,"name");if(s){let a=e.learned_skills.find(p=>p.name===s),u={source_path:Fe(t,"path"),source_placement:Fe(t,"placement"),source_vertical:Fe(t,"vertical"),updated_at:i};a?Object.assign(a,u):Na(e.learned_skills,"id",s,{id:s,name:s,version:1,scope:"",path:"",status:"active",...u}),Vn(e,t,"manager","Capability promoted to source",s,"skill")}}else if([G.WIKI_INITIALIZED,G.WIKI_EVOLUTION_COMPLETED].includes(r)){let s=[...(Array.isArray(t.paths)?t.paths:[]).map(a=>String(a)),Fe(t,"path")].filter(Boolean);e.storage.wiki_paths=[...new Set([...e.storage.wiki_paths,...s])]}else if(r===G.WIKI_RETIRED_COMPRESSED)e.storage.wiki_retired_compressed+=Ks(t,"count")??0,e.storage.wiki_retired_bytes_saved+=Ks(t,"bytes_saved")??0;else if([G.WIKI_CREATED,G.WIKI_UPDATED].includes(r)){let s=Fe(t,"page_id");s&&(Na(e.learned_wiki_pages,"id",s,{id:s,title:Fe(t,"title")||s,card_type:Fe(t,"card_type"),status:Fe(t,"status")||"scratch",path:Fe(t,"path"),updated_at:i}),Vn(e,t,"reviewer",r===G.WIKI_CREATED?"Knowledge captured":"Knowledge refined",Fe(t,"title")||s,"skill"))}else if(r===G.WIKI_RETIRED){let s=Fe(t,"page_id");if(s){let a=e.learned_wiki_pages.find(u=>u.id===s);a?Object.assign(a,{status:"retired",updated_at:i}):Na(e.learned_wiki_pages,"id",s,{id:s,title:s,card_type:Fe(t,"card_type"),status:"retired",path:"",updated_at:i}),Vn(e,t,"reviewer","Knowledge retired",s,"error")}}else if([G.WIKI_PROMOTION_PROMOTED,G.WIKI_PROMOTION_DEMOTED].includes(r)){let s=Fe(t,"page_id");if(s){let a=e.learned_wiki_pages.find(p=>p.id===s);a?Object.assign(a,{status:Fe(t,"to_status"),updated_at:i}):Na(e.learned_wiki_pages,"id",s,{id:s,title:s,card_type:Fe(t,"card_type"),status:Fe(t,"to_status"),path:"",updated_at:i});let u=r===G.WIKI_PROMOTION_PROMOTED;Vn(e,t,"reviewer",u?"Knowledge promoted":"Knowledge demoted",`${s} \u2192 ${Fe(t,"to_status")}`,u?"success":"neutral")}}else if(r===G.RESEARCH_ACHIEVEMENT_CERTIFIED)e.achievement={id:Fe(t,"achievement_id"),title:Fe(t,"title"),goal:Fe(t,"goal"),summary:Fe(t,"summary"),rejected_attempts:e.review.rejected_attempts,skills_learned:e.learned_skills.filter(s=>s.status==="active").length,artifacts:e.artifacts.length,elapsed_seconds:e.mission.elapsed_seconds,evidence:Array.isArray(t.evidence)?t.evidence.map(String):[],reviewer_certified:!0,certified_at:i};else if([G.LIFE_MISSION_COMPLETED,G.LIFE_MISSION_FAILED].includes(r)){let s=r===G.LIFE_MISSION_FAILED?pl({...t,outcome_class:"failed",status:Fe(t,"status")||"failed",success:!1}):pl(t),a="final_output"in t?Fe(t,"final_output"):Fe(t,"item_id")===e.mission.id&&e.mission.started_at!=null&&(e.mission.completed_at==null||e.mission.completed_at===i)&&e.mission.final_output||"";e.mission.id=Fe(t,"item_id")||e.mission.id,e.mission.title=Fe(t,"title")||e.mission.title,e.mission.objective=Fe(t,"objective")||e.mission.objective,e.mission.summary=Fe(t,"summary"),e.mission.final_output=a,e.mission.status=s.missionStatus,e.mission.completed_at=i;let u=t.delivery;t.success===!0&&u&&typeof u=="object"&&!Array.isArray(u)?e.delivery=JSON.parse(JSON.stringify(u)):t.success!==!0&&(e.delivery=null),e.outcome=xI(t),yn(e,"engineer",s.missionStatus==="complete"?"done":s.missionStatus,s.label,i),Vn(e,t,"engineer",s.label,Fe(t,"summary")||Fe(t,"title")||Fe(t,"status"),UF(s.tone)),Ko(e,t,"engineer","completion",s.label,Fe(t,"summary")||Fe(t,"title")||Fe(t,"status"),s.missionStatus)}return e.updated_at=Date.now()/1e3,e}function HF(e,t,r){let i=t.backlog.find(D=>MF.has(D.status)),s=t.backlog.find(D=>D.status==="pending"),a=t.backlog.find(D=>D.id===e.mission.id),u=i??a,p=!!(i||s||t.continuous?.enabled||t.continuous?.done_reason||t.continuous?.done_at||e.mission.id||!["","idle"].includes(e.mission.status));t.continuous?.enabled&&(e.routing.route=e.routing.route||"team",e.routing.continuous=!0,e.routing.open_ended=t.continuous.open_ended===!0,e.routing.lifetime=e.routing.open_ended?"standing":e.routing.lifetime||"bounded");let E=u?.objective||u?.title||(t.continuous?.enabled?t.continuous.objective:"")||t.session.objective||(e.mission.id?"":s?.objective)||(e.mission.id?"":s?.title)||e.mission.objective;E&&(e.mission.objective=E,u?e.mission.title=(u.title||E.split(` `)[0]).slice(0,240):e.mission.title||(e.mission.title=E.split(` `)[0].slice(0,240))),i?((i.id!==e.mission.id||i.started_ts!=null&&i.started_ts!==e.mission.started_at||e.mission.completed_at!=null)&&(e.mission.summary="",e.mission.final_output="",e.mission.started_at=i.started_ts??null,e.mission.completed_at=null),e.mission.id=i.id,e.mission.status="working",e.mission.started_at=e.mission.started_at??i.started_ts??null):a?a.status==="pending"&&(e.mission.status="queued"):t.continuous?.done_reason||t.continuous?.done_at?e.mission.status="complete":s||t.continuous?.enabled?e.mission.status="queued":t.daemon.alive&&(e.mission.status="idle"),t.roles.forEach(D=>{D.active?yn(e,D.role,"active",D.label||D.status||"Working",Date.now()/1e3-(D.age_s??0)):p||yn(e,D.role,"waiting","Waiting",Date.now()/1e3);let v=e.roles.find(T=>T.role===D.role);v&&Object.assign(v,{backend:D.backend,model:D.model,effort:D.effort})});let I=t.roles.filter(D=>D.active);I.length?e.active_role=I[I.length-1].role:p||(e.active_role=""),t.backlog.forEach(D=>{let v={id:D.id,title:D.title,objective:D.objective,status:D.status,deps:D.deps??[],branch_id:D.id,parent_branch_id:D.deps?.[0]??null,acceptance_check:D.acceptance_check??"",plan_hypothesis:D.plan_hypothesis??"",goal_contribution:D.goal_contribution??"",expected_regressions:D.expected_regressions??"",decision_rule:D.decision_rule??"",non_goals:D.non_goals??[]};Na(e.dag,"id",v.id,v)});let y=u?.outcome?.execution_status?u.outcome:e.mission.id?void 0:[...t.backlog].filter(D=>D.outcome?.execution_status).sort((D,v)=>Number(D.finished_ts??0)-Number(v.finished_ts??0)).at(-1)?.outcome;return!i&&y&&(e.outcome=xI({outcome:y,status:"done",success:!0})),r.forEach(D=>{Na(e.artifacts,"path",D.path,{id:D.path,path:D.path,title:D.name,kind:D.kind,why:D.why,exists:D.exists,storage_path:D.storage_path,source:D.source})}),p}function WF(e,t,r,i){i||(t.roles.forEach(u=>{u.active||yn(e,u.role,"waiting","Waiting",Date.now()/1e3)}),e.active_role="");let s=Date.now()/1e3,a=e.mission.campaign_started_at??t.session.created??e.mission.started_at;a&&(e.mission.campaign_started_at=a,e.mission.campaign_elapsed_seconds=Math.max(0,s-a)),e.mission.started_at&&e.mission.status==="working"?e.mission.elapsed_seconds=Math.max(0,s-e.mission.started_at):e.mission.started_at&&e.mission.completed_at&&(e.mission.elapsed_seconds=Math.max(0,e.mission.completed_at-e.mission.started_at)),e.achievement?.reviewer_certified&&(e.achievement.elapsed_seconds=e.mission.elapsed_seconds,e.achievement.rejected_attempts=e.review.rejected_attempts,e.achievement.skills_learned=e.learned_skills.filter(u=>u.status==="active").length,e.achievement.artifacts=r.filter(u=>u.exists).length)}function y0(e,t=[],r=[]){let i=e.mission_view?PF(e.mission_view):TI();i.storage??=TI().storage,i.storage.skill_history_compressed??=0,i.storage.wiki_retired_compressed??=0,i.storage.skill_history_bytes_saved??=0,i.storage.wiki_retired_bytes_saved??=0,i.learned_wiki_pages??=[],i.role_work??=[],i.delivery??=null,i.outcome??={};let s=i.last_event_ts,a=HF(i,e,r),u=[...t].sort((p,E)=>Number(p.ts??0)-Number(E.ts??0));return u.filter(p=>p.ts==null||Number(p.ts)>s).forEach(p=>D0(i,p)),i.mission.final_output||(i.mission.final_output=jF(u,i.mission)),WF(i,e,r,a),i}function jF(e,t){if(!t.id||["working","queued","grounding","framed"].includes(t.status))return"";let r=e.reduce(D0,TI()).mission;return r.id!==t.id||r.started_at==null||r.completed_at==null||t.started_at!=null&&r.started_at!==t.started_at||t.completed_at!=null&&r.completed_at!==t.completed_at?"":r.final_output||""}function Q0(e){return String(e||"").replace(/\\([*_`~])/g,"$1").replace(/\\\\(?=[A-Za-z])/g,"\\")}function OI(e){let t=Math.max(0,Math.floor(e)),r=Math.floor(t/3600),i=Math.floor(t%3600/60);return r?`${r}h ${i}m`:i?`${i}m`:`${t}s`}function zu(e,t){let r=typeof e=="string"?e.trim():"";return r.length>t?`${r.slice(0,t-1).trimEnd()}\u2026`:r}function w0(e,t){let r=t==="zh-CN",i=zu(e.route,40),s=zu(e.workflow_mode,40),a=zu(e.execution_task,160),u;i==="self"?u=r?"\u8BA1\u5212\u7531 Manager \u76F4\u63A5\u5904\u7406":"Manager plans to handle this request":s==="staged"?u=i==="team"?r?"\u8BA1\u5212\u7531\u56E2\u961F\u5206\u9636\u6BB5\u63A8\u8FDB":"The team plans to work in stages":r?"\u8BA1\u5212\u5206\u9636\u6BB5\u63A8\u8FDB":"The plan is to work in stages":s==="direct"?u=i==="team"?r?"\u8BA1\u5212\u7531\u56E2\u961F\u76F4\u63A5\u5904\u7406":"The team plans to handle this task directly":r?"\u8BA1\u5212\u76F4\u63A5\u5904\u7406\u8FD9\u9879\u5DE5\u4F5C":"The plan is to handle this task directly":u=r?"\u5904\u7406\u65B9\u6848\u5DF2\u786E\u5B9A":"A plan is ready",a&&(u+=`${r?"\uFF1A":": "}${a}`);let p="";e.lifetime==="standing"&&e.open_ended!==!1||!e.lifetime&&e.open_ended===!0?p=r?"\u6301\u7EED\u8DDF\u8FDB\u540E\u7EED\u5DE5\u4F5C\u3002":"Keep following up on subsequent work.":e.lifetime==="bounded_increment"?p=r?"\u672C\u6B21\u53EA\u63A8\u8FDB\u4E00\u4E2A\u660E\u786E\u7684\u589E\u91CF\u3002":"Limit this run to one defined increment.":e.lifetime==="bounded"&&(p=e.continuous===!0&&e.open_ended===!1?r?"\u5B8C\u6210\u8FD9\u6B21\u76EE\u6807\u540E\u7ED3\u675F\u3002":"Finish once this objective is met.":r?"\u8303\u56F4\u9650\u4E8E\u672C\u6B21\u76EE\u6807\u3002":"Keep the work within this objective.");let E=zu(e.reason,320),I=E&&!/^(?:\[manager\]|manager routed\b|\{)/i.test(E)&&E!==(zu(e.execution_task,320)||zu(e.objective,320))?E:"";return[u,[p,I].filter(Boolean).join(r?"":" ")].filter(Boolean).join(` -`)}function KF(e){let t=e;return t=t.replace(/^(\s*(?:authorization|proxy-authorization)\s*:).*$/gim,"$1 "),t=t.replace(/^(\s*(?:x-api-key|api-key|cookie|set-cookie)\s*:).*$/gim,"$1 "),t=t.replace(/gh[pousr]_[A-Za-z0-9]{20,}/g,"").replace(/xox[baprs]-[A-Za-z0-9-]{10,}/g,"").replace(/AKIA[0-9A-Z]{16}/g,"").replace(/\bbearer\s+[A-Za-z0-9._\-+/=]{16,}/gi,"").replace(/(?").replace(/(?").replace(/\b([a-z][a-z0-9+.\-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi,"$1@"),{text:e,sensitive:t!==e}}function v0(e){return KF($u(e))}function it(e,t){let r=String(e??"").replace(/```[a-z]*\n?/gi,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"[$1]").trim();return r.length<=t?r:`${r.slice(0,t-1).trimEnd()}\u2026`}var fr=e=>e,pe=(e,t)=>String(fr(e)[t]??"");function Xu(e,t){return`${e} ${t}${e===1?"":"s"}`}function Be(e,t,r){return e.locale==="zh-CN"?r:t}function JF(e,t){let r=pe(e,"error_code"),i=pe(e,"failure_stage"),s=pe(e,"stop_kind"),a=["daemon_shutdown","operator_pause","operator_abort"].includes(s);if(r==="cancelled"&&i==="commit"&&pe(e,"status")==="issued")return{text:Be(t,"Applying the adjustment was interrupted; the saved decision is waiting to be applied.","\u5E94\u7528\u8C03\u6574\u65F6\u88AB\u4E2D\u65AD\uFF0C\u5DF2\u4FDD\u5B58\u7684\u51B3\u5B9A\u7B49\u5F85\u7EE7\u7EED\u5904\u7406\u3002"),tone:"warn"};if(r==="timeout"&&i==="commit")return{text:Be(t,"Manager reached a decision, but applying the adjustment timed out.","Manager \u5DF2\u4F5C\u51FA\u5224\u65AD\uFF0C\u4F46\u5E94\u7528\u8C03\u6574\u8D85\u65F6\u3002"),tone:"warn"};let u={trial_quota_exceeded:["The remaining trial quota cannot cover this Manager check.","\u5269\u4F59\u8BD5\u7528\u989D\u5EA6\u4E0D\u8DB3\u4EE5\u542F\u52A8\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"],observation_incomplete:["Manager could not fully read the required project evidence; this check has stopped.","Manager \u672A\u80FD\u5B8C\u6574\u8BFB\u53D6\u6240\u9700\u7684\u9879\u76EE\u8D44\u6599\uFF0C\u8FD9\u6B21\u68C0\u67E5\u5DF2\u505C\u6B62\u3002"],timeout:["The model did not respond before the Manager check timed out.","\u6A21\u578B\u672A\u5728\u65F6\u9650\u5185\u8FD4\u56DE\uFF0CManager \u8FD9\u6B21\u68C0\u67E5\u5DF2\u7ED3\u675F\u3002"],cancelled:["This Manager check was cancelled.","\u5DF2\u53D6\u6D88\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"],superseded:["New input or evidence superseded this Manager check.","\u65B0\u7684\u64CD\u4F5C\u6216\u8BC1\u636E\u5DF2\u53D6\u4EE3\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"]};if(Object.hasOwn(u,r)&&!(r==="cancelled"&&a))return{text:Be(t,...u[r]),tone:r==="cancelled"||r==="superseded"?"dim":"warn"};let p={budget_exhausted:["The project budget limit prevented this Manager check.","\u9879\u76EE\u9884\u7B97\u5DF2\u8FBE\u4E0A\u9650\uFF0CManager \u6682\u672A\u5B8C\u6210\u68C0\u67E5\u3002"],provider_cooldown:["The model service asked Manager to wait before calling again.","\u6A21\u578B\u670D\u52A1\u8981\u6C42\u7A0D\u540E\u518D\u8C03\u7528\uFF0CManager \u6682\u672A\u5B8C\u6210\u68C0\u67E5\u3002"],provider_fence:["The model service is not accepting calls; Manager could not finish this check.","\u6A21\u578B\u670D\u52A1\u5F53\u524D\u4E0D\u63A5\u53D7\u8C03\u7528\uFF0CManager \u672A\u5B8C\u6210\u8FD9\u6B21\u68C0\u67E5\u3002"],backend_unavailable:["The model service was unavailable for this Manager check.","\u6A21\u578B\u670D\u52A1\u4E0D\u53EF\u7528\uFF0CManager \u672A\u5B8C\u6210\u8FD9\u6B21\u68C0\u67E5\u3002"],transient_error:["A temporary model service error interrupted this Manager check.","\u6A21\u578B\u670D\u52A1\u7684\u4E34\u65F6\u9519\u8BEF\u4E2D\u65AD\u4E86\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"],permanent_error:["The model call failed; Manager could not finish this check.","\u6A21\u578B\u8C03\u7528\u5931\u8D25\uFF0CManager \u672A\u5B8C\u6210\u8FD9\u6B21\u68C0\u67E5\u3002"],daemon_shutdown:["Argus stopped, ending this Manager check.","Argus \u5DF2\u505C\u6B62\uFF0C\u8FD9\u6B21 Manager \u68C0\u67E5\u5DF2\u7ED3\u675F\u3002"],operator_pause:["This Manager check was paused by your request.","\u5DF2\u6309\u4F60\u7684\u8981\u6C42\u6682\u505C\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"],operator_abort:["This Manager check was cancelled by your request.","\u5DF2\u6309\u4F60\u7684\u8981\u6C42\u53D6\u6D88\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"]};if(Object.hasOwn(p,s))return{text:Be(t,...p[s]),tone:a?"dim":"warn"};let E=pe(e,"status");return E==="cancelled"||E==="superseded"?{text:Be(t,"This Manager check was cancelled.","\u8FD9\u6B21 Manager \u68C0\u67E5\u5DF2\u53D6\u6D88\u3002"),tone:"dim"}:{text:i==="commit"&&["continue","wait","steer"].includes(pe(e,"action"))?Be(t,"Manager reached a decision, but the team adjustment could not be applied.","Manager \u5DF2\u4F5C\u51FA\u5224\u65AD\uFF0C\u4F46\u56E2\u961F\u8C03\u6574\u672A\u80FD\u751F\u6548\u3002"):i==="decision"?Be(t,"Manager returned a decision that could not be validated.","Manager \u8FD4\u56DE\u7684\u5224\u65AD\u6216\u5F15\u7528\u4F9D\u636E\u672A\u901A\u8FC7\u6838\u9A8C\u3002"):Be(t,"Manager could not finish this check.","Manager \u672A\u80FD\u5B8C\u6210\u8FD9\u6B21\u68C0\u67E5\u3002"),tone:"warn"}}function we(e,t,r,i,s,a={}){let u=v0(i);return{visibility:a.visibility??(s==="err"||s==="warn"?"alert":"normal"),role:e,labelKey:t,glyph:r,tone:s,segments:u.text?[{kind:"text",text:u.text}]:[],expandable:a.expandable===!0,sensitive:u.sensitive||a.sensitive===!0,fallback:a.fallback===!0,rule:a.rule===!0,reasoning:a.reasoning===!0}}function Fo(){return{visibility:"hidden",role:"system",labelKey:"event.hidden",glyph:"",tone:"dim",segments:[],expandable:!1,sensitive:!1,fallback:!1,rule:!1,reasoning:!1}}function LI(e,t){if(fr(e).operator_alert===!0){let s=it(pe(e,"text")||pe(e,"reason")||e.type,170);return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",s,"err",{rule:!0})}if(t.unknownEventPolicy==="hide")return Fo();let r=String(e.type||"?"),i=pe(e,"text").trim();return we("system","event.fallback","\u2022",`[${r}]${i?` ${i}`:""}`,"dim",{fallback:!0})}function Cp(e,t="engineer"){let r=pe(e,"agent_layer");return r||(e.type.startsWith("life.manager.")?"manager":e.type.startsWith("life.planner.")?"planner":e.type.startsWith("round.review.")?"reviewer":t)}function YF(e,t){let r=pe(e,"phase"),i=pe(e,"cause")||pe(e,"backend_error"),s=pe(e,"error");if(!r||!i)return`${Be(t,"could not work out where this request belongs","\u6CA1\u80FD\u5224\u65AD\u8FD9\u4E2A\u8BF7\u6C42\u8BE5\u5F52\u8C01")} ${it(s,t.density==="full"?160:140)}`;let a={backend:["model service","\u6A21\u578B\u670D\u52A1"],parse:["reading the answer","\u8BFB\u53D6\u56DE\u7B54"],contract:["answer shape:","\u56DE\u7B54\u683C\u5F0F\uFF1A"],timeout:["timed out","\u8D85\u65F6"]},u=a[r]?Be(t,a[r][0],a[r][1]):r,p=Number(fr(e).attempts||0),E=p>1?Be(t,` (attempt ${p})`,` (\u7B2C${p}\u6B21\u5C1D\u8BD5)`):"",I=`${Be(t,"could not work out where this request belongs","\u6CA1\u80FD\u5224\u65AD\u8FD9\u4E2A\u8BF7\u6C42\u8BE5\u5F52\u8C01")} \xB7 ${u} ${i}${E}`;return s?`${I} \xB7 ${Be(t,"error text","\u539F\u59CB\u9519\u8BEF")}: ${s}`:I}function Zu(e){let t=fr(e).round_index??fr(e).round;return typeof t=="string"||typeof t=="number"?t:"?"}function VF(e,t){let r=pe(e,"kind"),i=Cp(e),s=`role.${i}`;if(r==="reasoning"){if(!t.showReasoning)return Fo();let u=it(pe(e,"text"),280);return u?we(i,s,"\u2234",u,"dim",{expandable:t.density==="full",reasoning:!0}):Fo()}if(r==="assistant_message"||r==="agent_message"||r==="message"){if(Vu(fr(e)))return LI(e,t);let u=v0(pe(e,"text"));return u.text?we(i,s,"\u258C",u.text,"bright",{expandable:t.density==="full",sensitive:u.sensitive}):Fo()}if(r==="command_execution"){let u=pe(e,"text")||pe(e,"command")||pe(e,"action_summary"),p=pe(e,"status")==="failed"?"err":"dim";return u?we(i,s,"\u25B8 $",u,p,{expandable:t.density==="full"}):Fo()}if(r==="tool_use"||r==="file_change"){let u=pe(e,"text")||pe(e,"action_summary");if(!u&&t.density==="full")return Fo();let p=r==="file_change"?Be(t,"(file change)","\uFF08\u6587\u4EF6\u53D8\u66F4\uFF09"):Be(t,"(tool)","\uFF08\u5DE5\u5177\uFF09");return we(i,s,r==="file_change"?"\u270E":"\u2699",u||p,pe(e,"status")==="failed"?"err":"dim",{expandable:t.density==="full"})}if(t.density==="full")return Fo();let a=String(fr(e).text??fr(e).action_summary??"").split(` -`)[0]?.trim()??"";return a?we(i,s,"\u25B8",it(a,160),"dim"):Fo()}function Bp(e,t){let r=Ws(fr(e).canonical_type??e.type);if(r&&r!==e.type)return Bp({...e,type:r},t);switch(e.type){case"advisor.consultation.requested":case"life.manager.supervision.issued":return Fo();case"advisor.consultation.completed":{let i=pe(e,"question").trim(),s=pe(e,"summary").trim();return!i&&!s?Fo():we("advisor","role.advisor","\u25C7",[i,s].filter(Boolean).join(` -`),"info",{expandable:!0})}case"advisor.consultation.cancelled":{let i=it(pe(e,"question"),160);return we("advisor","role.advisor","\u25C7",`${Be(t,"Consultation cancelled","\u5DF2\u53D6\u6D88\u54A8\u8BE2")}${i?` \xB7 ${i}`:""}`,"dim")}case"advisor.consultation.failed":case"advisor.consultation.timed_out":case"advisor.consultation.model_mismatch":{let i=e.type.endsWith("model_mismatch")?Be(t,"The provider returned a different model","\u63A5\u5165\u8FD4\u56DE\u7684\u6A21\u578B\u4E0E\u6240\u9009\u6A21\u578B\u4E0D\u4E00\u81F4"):e.type.endsWith("timed_out")?Be(t,"The advisor did not respond in time","\u987E\u95EE\u672A\u5728\u65F6\u9650\u5185\u8FD4\u56DE"):Be(t,"The consultation did not finish","\u987E\u95EE\u54A8\u8BE2\u672A\u5B8C\u6210"),s=it(pe(e,"question"),160);return we("advisor","role.advisor","\u25C7",`${i}${s?` \xB7 ${s}`:""}`,"warn",{expandable:!0})}case"life.manager.supervision.applied":return we("manager","role.manager","\u{1F9ED}",pe(e,"summary")||pe(e,"reason"),"info",{expandable:!0,rule:!0});case"life.peer.message.processed":return we("manager","role.peer","\u2194",pe(e,"text"),"info",{expandable:!0});case"life.manager.supervision.failed":{let i=JF(e,t);return we("manager","role.manager","\u{1F9ED}",i.text,i.tone,{expandable:!0})}case"engineer.progress":return VF(e,t);case"life.manager.intent.started":return we("manager","role.manager","\u{1F9ED}",Be(t,"Working out how to handle your request\u2026","\u6B63\u5728\u5B89\u6392\u5904\u7406\u65B9\u5F0F\u2026"),"info");case"life.manager.intent.completed":return we("manager","role.manager","\u{1F9ED}",w0(fr(e),t.locale),"info",{expandable:!0});case"life.manager.intent.failed":return we("manager","role.manager","\u26A0",YF(e,t),"err",{expandable:t.density==="full"});case"life.manager.stage_decision":{let i=pe(e,"target_stage")||pe(e,"stage")||pe(e,"current_stage");return we("manager","role.manager","\u{1F9ED}",`${pe(e,"action")}${i?` \u2192 ${i}`:""} ${it(pe(e,"reason"),t.density==="full"?140:120)}`,"info")}case"life.research.second_reading":{let i=Cp(e,"manager"),s=it(pe(e,"supported"),160),a=Be(t,"reread the evidence and reworked the plan","\u91CD\u8BFB\u4E86\u8BC1\u636E\u5E76\u91CD\u6392\u4E86\u8BA1\u5212");return we(i,`role.${i}`,"\u{1F4D6}",s?`${a} \xB7 ${s}`:a,"info")}case"life.letter.written":{let i=Cp(e,"manager");return we(i,`role.${i}`,"\u2709",Be(t,"wrote you a letter","\u7ED9\u4F60\u5199\u4E86\u4E00\u5C01\u4FE1"),"accent")}case"life.planner.start":return we("planner","role.planner","\u{1F4CB}",`${Be(t,"planning","\u6B63\u5728\u89C4\u5212")} ${it(pe(e,"objective"),t.density==="full"?160:140)}`,"accent");case"life.planner.verdict":return pe(e,"status")==="done"||fr(e).project_done===!0?we("planner","role.planner","\u{1F3C1}",Be(t,"the project is finished","\u9879\u76EE\u5DF2\u5B8C\u6210"),"ok"):we("planner","role.planner","\u{1F4CB}",Be(t,`lined up ${pe(e,"queued")||pe(e,"n")||"next"} task(s) to do next`,`\u5DF2\u6392\u597D ${pe(e,"queued")||pe(e,"n")||"\u4E0B\u4E00"} \u4E2A\u63A5\u4E0B\u6765\u8981\u505A\u7684\u4EFB\u52A1`),"accent");case"life.planner.task_added":return we("planner","role.planner","\uFF0B",`${Be(t,"added a task","\u65B0\u589E\u4EFB\u52A1")} \xB7 ${it(pe(e,"title")||pe(e,"objective"),t.density==="full"?160:140)}`,"accent");case"life.planner.task_skipped":{let s=pe(e,"skip_category")==="paper_review_purchase_deferred"?Be(t,"put off another paper review","\u63A8\u8FDF\u4E86\u518D\u4E70\u4E00\u6B21\u8BC4\u5BA1"):Be(t,"skipped a task already planned","\u8DF3\u8FC7\u4E86\u5DF2\u5728\u8BA1\u5212\u4E2D\u7684\u4EFB\u52A1");return we("planner","role.planner","\u23ED",`${s} ${it(pe(e,"title"),t.density==="full"?140:120)}`,"dim")}case"life.planner.preview_skipped":return we("planner","role.planner","\u23ED",Be(t,"skipped the plan preview: the research Planner owns the campaign plan","\u8DF3\u8FC7\u4E86\u8BA1\u5212\u9884\u89C8:\u7814\u7A76\u89C4\u5212\u5E08\u8D1F\u8D23\u6574\u4E2A\u8BA1\u5212"),"dim");case"life.planner.normalized":return we("planner","role.planner","\u224B",`${Be(t,"tidied the plan","\u6574\u7406\u4E86\u8BA1\u5212")} \xB7 ${it(pe(e,"diagnostic"),180)}`,"dim");case"life.planner.waiting":return we("planner","role.planner","\u231B",`${Be(t,"waiting","\u7B49\u5F85\u4E2D")} \xB7 ${it(pe(e,"reason"),180)}`,"info");case"life.planner.waiting_woken":return we("planner","role.planner","\u21BB",`${Be(t,"resumed","\u5DF2\u5524\u9192")} \xB7 ${it(pe(e,"wake_reason"),180)}`,"info");case"life.planner.terminal_idle":return we("planner","role.planner","\u2161",`${Be(t,"nothing left to plan","\u6682\u65F6\u6CA1\u6709\u8981\u89C4\u5212\u7684")} \xB7 ${it(pe(e,"reason"),180)}`,"dim");case"life.planner.verification_probe":return t.showReasoning?we("planner","role.planner","\u2315",`${Be(t,"checking that the plan still holds","\u68C0\u67E5\u8BA1\u5212\u662F\u5426\u4ECD\u7136\u6210\u7ACB")} \xB7 ${it(pe(e,"reason"),180)}`,"dim"):Fo();case"life.planner.error":return we("planner","role.planner","\u26A0",`${Be(t,"the Planner hit an error","\u89C4\u5212\u8005\u51FA\u9519")} ${it(pe(e,"error")||pe(e,"text"),t.density==="full"?160:140)}`,"err");case"life.mission.started":return we("engineer","role.engineer","\u{1F680}",it(pe(e,"title")||pe(e,"objective")||pe(e,"text")||Be(t,"started work on this task","\u5F00\u59CB\u505A\u8FD9\u9879\u4EFB\u52A1"),t.density==="full"?180:160),"info",{rule:!0});case"round.start":return we("engineer","role.engineer","\u2500\u2500",Be(t,`round ${Zu(e)}`,`\u7B2C ${Zu(e)} \u8F6E`),"dim",{rule:!0});case"life.phase.started":{let i=pe(e,"label")||pe(e,"phase"),s=Cp(e);return i?we(s,`role.${s}`,"\u{1F504}",Be(t,`entering ${i}`,`\u8FDB\u5165 ${i}`),"info"):Fo()}case"round.review.started":return we("reviewer","role.reviewer","\u{1F504}",Be(t,`the Reviewer checks round ${Zu(e)}`,`\u5BA1\u9605\u8005\u68C0\u67E5\u7B2C ${Zu(e)} \u8F6E`),"info");case"round.review.deferred":return we("engineer","role.engineer","\u21AA",Be(t,`carries on into the next round without a review \xB7 ${it(pe(e,"next_step"),t.density==="full"?180:160)}`,`\u4E0D\u7ECF\u5BA1\u9605\u76F4\u63A5\u8FDB\u5165\u4E0B\u4E00\u8F6E \xB7 ${it(pe(e,"next_step"),t.density==="full"?180:160)}`),"info");case"round.main.completed":return we("engineer","role.engineer","\u2705",Be(t,`finished round ${Zu(e)} of work`,`\u7B2C ${Zu(e)} \u8F6E\u5DE5\u4F5C\u5DF2\u5B8C\u6210`),"info");case"round.review.completed":{if(e.review_skipped===!0)return we("reviewer","role.reviewer","\u21AA",`${Be(t,"no review this round","\u8FD9\u4E00\u8F6E\u6CA1\u6709\u5BA1\u9605")} \xB7 ${it(pe(e,"reason"),t.density==="full"?200:160)}`,"info");let i=pe(e,"status"),s=i==="done"?it(pe(e,"residual_risk"),200):"";if(s)return we("reviewer","role.reviewer","\u26A0",`${Be(t,"verified with residual risk","\u5DF2\u9A8C\u8BC1\uFF0C\u4F46\u6709\u6B8B\u4F59\u98CE\u9669")}: ${s} \xB7 ${it(pe(e,"reason"),t.density==="full"?200:160)}`,"warn");let a=i==="done"?"ok":i==="blocked"||i==="no_progress"?"err":"warn";return we("reviewer","role.reviewer",i==="done"?"\u2705":i==="blocked"||i==="no_progress"?"\u26D4":"\u21BB",`${qF(i,t)} \xB7 ${it(pe(e,"reason"),t.density==="full"?200:160)}`,a)}case"life.mission.completed":{let i=pl(fr(e)),s=it(pe(e,"summary"),240),a=it(pe(e,"residual_risk"),200);if(a&&i.tone==="ok"){let u=Be(t,"completed with residual risk","\u5DF2\u5B8C\u6210\uFF0C\u4F46\u6709\u6B8B\u4F59\u98CE\u9669"),p=s.includes(a)?s:`${a}${s?` \xB7 ${s}`:""}`;return we("engineer","role.engineer","\u26A0",`${u} \xB7 ${p}`,"warn",{rule:!0})}return we("engineer","role.engineer",i.glyph,s?`${i.label} \xB7 ${s}`:i.label,i.tone,{rule:!0})}case"life.mission.failed":return we("engineer","role.engineer","\u274C",`${Be(t,"this task failed","\u8FD9\u9879\u4EFB\u52A1\u5931\u8D25\u4E86")} ${it(pe(e,"reason")||pe(e,"error"),t.density==="full"?160:140)}`,"err",{rule:!0});case"loop.start":return we("engineer","role.engineer","\u25B6",it(pe(e,"text")||pe(e,"objective"),t.density==="full"?16e3:160),"info",{expandable:t.density==="full"});case"loop.done":return we("engineer","role.engineer","\u{1F3C1}",`${Be(t,"the run finished","\u8FD9\u6B21\u8FD0\u884C\u7ED3\u675F")} ${it(pe(e,"text"),t.density==="full"?140:120)}`,"dim");case"life.inbox.queued":return we("system","role.operator","\u{1F4E5}",`${Be(t,"you added guidance","\u4F60\u8FFD\u52A0\u4E86\u6307\u5BFC")} \xB7 ${it(pe(e,"text"),t.density==="full"?180:160)}`,"accent");case"daemon.parked":{let i=pe(e,"replaced_by"),s=Be(t,"Argus set this project aside with its state saved","Argus \u5DF2\u628A\u8FD9\u4E2A\u9879\u76EE\u6401\u7F6E\uFF0C\u72B6\u6001\u5DF2\u4FDD\u5B58");return we("system","role.system","\u2161",i?`${s} \xB7 ${Be(t,`continued as ${i}`,`\u7531 ${i} \u63A5\u7EED`)}`:s,"warn",{rule:!0})}case"accounting.journal_repaired":{let i=fr(e).damaged_lines,s=fr(e).liabilities,a=Array.isArray(i)?i.length:0,u=Array.isArray(s)?s.length:0,p=it(pe(e,"damaged_copy"),120),E=`the usage journal was repaired: ${a} damaged line(s) set aside${p?` in ${p}`:""}, ${u} call(s) written back as a liability`,I=`\u7528\u91CF\u8D26\u672C\u5DF2\u4FEE\u590D\uFF1A${a} \u884C\u635F\u574F\u8BB0\u5F55\u5DF2\u53E6\u5B58${p?`\u5230 ${p}`:""}\uFF0C${u} \u6B21\u8C03\u7528\u6309\u8D1F\u503A\u8BB0\u56DE`;return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",Be(t,E,I),"warn",{rule:!0})}case"provider.request.denied":{let i=pe(e,"provider");return we("system","event.quota","\u23F8",`${Be(t,`a request to ${i||"the model service"} was held back`,`\u53D1\u5F80${i||"\u6A21\u578B\u670D\u52A1"}\u7684\u4E00\u6B21\u8BF7\u6C42\u88AB\u6682\u7F13`)} \xB7 ${it(pe(e,"reason"),160)}`,"warn",{rule:!0})}case"round.reviewer_backend_failure":{let i=it(pe(e,"text"),150),s=t.density==="full"?Be(t,"the Reviewer's model service is unreachable \u2014 waiting rather than going on unchecked","\u5BA1\u9605\u8005\u7684\u6A21\u578B\u670D\u52A1\u8FDE\u4E0D\u4E0A \u2014 \u5148\u7B49\u5F85\uFF0C\u4E0D\u5728\u65E0\u4EBA\u5BA1\u9605\u7684\u60C5\u51B5\u4E0B\u7EE7\u7EED"):Be(t,"the Reviewer's model service is unreachable \u2014 waiting","\u5BA1\u9605\u8005\u7684\u6A21\u578B\u670D\u52A1\u8FDE\u4E0D\u4E0A \u2014 \u5148\u7B49\u5F85");return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",`${s} \xB7 ${i}`,"err",{rule:!0})}case"round.stall":return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",it(pe(e,"text")||Be(t,t.density==="full"?"no progress this round \u2014 keeping a close eye on it":"no progress this round","\u8FD9\u4E00\u8F6E\u6CA1\u6709\u8FDB\u5C55"),170),"warn");case"round.escalated":return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",it(pe(e,"text")||Be(t,"many rounds without a finish \u2014 raising what is blocking the work","\u8F6E\u6B21\u5DF2\u7ECF\u5F88\u591A\u8FD8\u6CA1\u505A\u5B8C \u2014 \u628A\u5916\u90E8\u963B\u788D\u63D0\u51FA\u6765"),170),"warn");case"life.planner.stall_escalation":return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",`${Be(t,"the Planner is stuck","\u89C4\u5212\u8005\u5361\u4F4F\u4E86")} \u2014 ${it(pe(e,"reason")||pe(e,"text"),150)}`,"warn");case"life.budget.pause":return pe(e,"stop_kind")==="cost_unreconciled"||pe(e,"reason").startsWith("unresolved provider cost")?we("system","event.budget","$",Be(t,"Provider usage awaits reconciliation \u2014 not budget exhaustion","\u8C03\u7528\u8D39\u7528\u5F85\u5BF9\u8D26 \u2014 \u5E76\u975E\u9884\u7B97\u8017\u5C3D"),"warn"):we("system","event.watch","\u23F8",Be(t,`budget cap reached \u2014 paused \xB7 ${it(pe(e,"text")||pe(e,"reason"),140)}`,`\u5DF2\u8FBE\u5230\u9884\u7B97\u4E0A\u9650 \u2014 \u5DF2\u6682\u505C \xB7 ${it(pe(e,"text")||pe(e,"reason"),140)}`),"warn");case"budget.reservation.denied":return pe(e,"reason").startsWith("unresolved provider cost")?we("system","event.budget","$",Be(t,"Provider usage awaits reconciliation \u2014 not budget exhaustion","\u8C03\u7528\u8D39\u7528\u5F85\u5BF9\u8D26 \u2014 \u5E76\u975E\u9884\u7B97\u8017\u5C3D"),"warn"):we("system","event.budget","$",`${Be(t,"budget denied","\u9884\u7B97\u7533\u8BF7\u88AB\u62D2\u7EDD")} \u2014 ${it(pe(e,"reason")||pe(e,"text"),t.density==="full"?160:150)}`,"err",{rule:!0});case"budget.unpriced.blocked":return we("system","event.budget","$",Be(t,"Provider usage awaits reconciliation \u2014 not budget exhaustion","\u8C03\u7528\u8D39\u7528\u5F85\u5BF9\u8D26 \u2014 \u5E76\u975E\u9884\u7B97\u8017\u5C3D"),"warn");case"budget.unpriced.acknowledged":return we("system","event.budget","$",Be(t,"Single-call cost risk approved; original usage remains pending","\u5DF2\u6279\u51C6\u5355\u7B14\u8D39\u7528\u98CE\u9669\uFF1B\u539F\u59CB\u8D39\u7528\u4ECD\u5F85\u5BF9\u8D26"),"warn");case"life.lifecycle.block":return we("system","event.watch","\u26D4",`${Be(t,"blocked \u2014 needs you","\u5361\u4F4F\u4E86 \u2014 \u9700\u8981\u4F60\u6765\u5904\u7406")} \xB7 ${it(pe(e,"text")||pe(e,"reason"),150)}`,"err",{rule:!0});case"life.daemon.idle_timeout":return we("system","event.watch","\u{1F7E6}",it(pe(e,"text")||Be(t,"nothing to do for a while \u2014 standing by","\u4E00\u6BB5\u65F6\u95F4\u6CA1\u6709\u4E8B\u505A \u2014 \u5F85\u547D\u4E2D"),150),"dim");case"operator_alert":return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",it(pe(e,"text")||pe(e,"reason")||e.type,170),"err",{rule:!0});case"life.supervisor.error":return we("system","role.system","\u26A0",`${Be(t,"Argus hit an internal error while coordinating the work","Argus \u5728\u7EDF\u7B79\u5DE5\u4F5C\u65F6\u9047\u5230\u5185\u90E8\u9519\u8BEF")} \xB7 ${it(pe(e,"error"),160)}`,"err",{rule:!0});case"life.auth_failure":return we("system","role.system","\u{1F511}",Be(t,"the model service rejected the sign-in \u2014 refresh the credentials and Argus will carry on","\u6A21\u578B\u670D\u52A1\u62D2\u7EDD\u4E86\u767B\u5F55 \u2014 \u66F4\u65B0\u51ED\u636E\u540E Argus \u4F1A\u7EE7\u7EED"),"err",{rule:!0});case"life.planner.deferred":return we("planner","role.planner","\u231B",`${Be(t,"planning is on hold","\u89C4\u5212\u6682\u7F13")} \xB7 ${it(pe(e,"reason"),180)}`,"dim");case"life.post_mission.stop":return we("system","role.system","\u25A0",`${Be(t,"stopped after this task","\u8FD9\u9879\u4EFB\u52A1\u4E4B\u540E\u505C\u4E0B")} \xB7 ${it(pe(e,"reason"),180)}`,"info");case"life.planner.final_submission_skipped":return we("planner","role.planner","\u23ED",`${Be(t,"dropped an outdated final-submission task","\u8DF3\u8FC7\u4E86\u4E00\u9879\u8FC7\u65F6\u7684\u6700\u7EC8\u63D0\u4EA4\u4EFB\u52A1")} \xB7 ${it(pe(e,"title"),140)}`,"dim");case"life.execution_host.blocked":return we("system","event.watch","\u26D4",it(pe(e,"reason")||Be(t,"the program that runs code for Argus could not be started","\u4E3A Argus \u8FD0\u884C\u4EE3\u7801\u7684\u7A0B\u5E8F\u65E0\u6CD5\u542F\u52A8"),t.density==="full"?260:180),"err",{rule:!0});case"life.mission.provider_configuration_disabled":{let i=Number(fr(e).streak||0),s=Be(t,`the model configuration failed ${Xu(i,"time")} in a row \u2014 this task is paused until you decide`,`\u6A21\u578B\u914D\u7F6E\u8FDE\u7EED ${i} \u6B21\u5931\u8D25 \u2014 \u8FD9\u9879\u4EFB\u52A1\u5DF2\u6682\u505C\uFF0C\u7B49\u5F85\u4F60\u7684\u51B3\u5B9A`),a=it(pe(e,"text"),160);return we("system","event.watch","\u26D4",a?`${s} \xB7 ${a}`:s,"err",{rule:!0})}case"life.iteration.continued":return we("critic","role.critic","\u{1F501}",Be(t,"lined up the next iteration","\u6392\u597D\u4E86\u4E0B\u4E00\u8F6E\u8FED\u4EE3"),"dim");case"life.learned_vertical.promoted":return we("manager","role.manager","\u2605",Be(t,`made the learned domain "${pe(e,"vertical")}" official`,`\u628A\u65B0\u5B66\u5230\u7684\u9886\u57DF\u300C${pe(e,"vertical")}\u300D\u6B63\u5F0F\u6536\u5F55`),"accent");case"life.learned_vertical.promotion_failed":return we("manager","role.manager","\u26A0",`${Be(t,`could not record "${pe(e,"vertical")}" as a formal domain`,`\u672A\u80FD\u628A\u300C${pe(e,"vertical")}\u300D\u6536\u5F55\u4E3A\u6B63\u5F0F\u9886\u57DF`)} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"life.review.waived":return we("planner","role.planner","\u21AA",`${Be(t,"this task will skip the independent review","\u8FD9\u9879\u4EFB\u52A1\u5C06\u4E0D\u505A\u72EC\u7ACB\u5BA1\u9605")} \xB7 ${it(pe(e,"reason"),160)}`,"dim");case"life.manager.feedback.exhausted":{let i=Number(fr(e).attempts||0);return we("manager","role.manager","\u26A0",`${Be(t,`the Manager's objection went unanswered ${Xu(i,"time")} \u2014 planning pauses for a while`,`\u7BA1\u7406\u8005\u7684\u5F02\u8BAE ${i} \u6B21\u672A\u88AB\u56DE\u5E94 \u2014 \u89C4\u5212\u6682\u505C\u4E00\u6BB5\u65F6\u95F4`)} \xB7 ${it(pe(e,"reason"),140)}`,"warn")}case"life.manager.feedback.persisted":{let i=pe(e,"stage"),s=i?Be(t,`sent the plan back for another pass at ${i}`,`\u628A\u8BA1\u5212\u9000\u56DE ${i} \u9636\u6BB5\u518D\u6539\u4E00\u8F6E`):Be(t,"sent the plan back for another pass","\u628A\u8BA1\u5212\u9000\u56DE\u518D\u6539\u4E00\u8F6E");return we("manager","role.manager","\u21A9",`${s} \xB7 ${it(pe(e,"reason"),160)}`,"info")}case"life.manager.goal_contract.failed":return we("manager","role.manager","\u26A0",`${Be(t,"could not save the agreed goal","\u672A\u80FD\u4FDD\u5B58\u5546\u5B9A\u7684\u76EE\u6807")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"life.manager.intent.superseded":return we("manager","role.manager","\u21B7",Be(t,"a newer instruction replaced this request","\u66F4\u65B0\u7684\u6307\u4EE4\u53D6\u4EE3\u4E86\u8FD9\u4E2A\u8BF7\u6C42"),"info");case"life.manager.project_report.failed":return we("manager","role.manager","\u26A0",`${Be(t,"could not deliver the project report","\u672A\u80FD\u9001\u51FA\u9879\u76EE\u62A5\u544A")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"life.planner.completion_circuit_opened":{let i=Number(fr(e).consecutive_rejections||0);return we("planner","role.planner","\u23F8",Be(t,`the same completion requirement turned the plan back ${Xu(i,"time")} \u2014 pausing completion attempts until something changes`,`\u540C\u4E00\u9879\u5B8C\u6210\u8981\u6C42\u5DF2 ${i} \u6B21\u6253\u56DE\u8BA1\u5212 \u2014 \u6682\u505C\u5B8C\u6210\u5C1D\u8BD5\uFF0C\u76F4\u5230\u60C5\u51B5\u53D8\u5316`),"warn")}case"life.planner.completion_rejected":return we("manager","role.manager","\u21A9",`${Be(t,"the Manager did not accept the completion claim","\u7BA1\u7406\u8005\u672A\u63A5\u53D7\u5B8C\u6210\u7684\u8BF4\u6CD5")} \xB7 ${it(pe(e,"reason"),160)}`,"info");case"life.planner.continuation_required":return we("planner","role.planner","\u21BB",Be(t,"finished one increment; the standing objective continues","\u5B8C\u6210\u4E86\u4E00\u4E2A\u589E\u91CF\uFF1B\u957F\u671F\u76EE\u6807\u7EE7\u7EED\u63A8\u8FDB"),"dim");case"life.planner.superseded":return we("planner","role.planner","\u21B7",Be(t,"dropped an outdated planning pass after a newer instruction","\u6536\u5230\u66F4\u65B0\u7684\u6307\u4EE4\uFF0C\u653E\u5F03\u4E86\u8FC7\u65F6\u7684\u89C4\u5212"),"dim");case"life.planner.wait_overridden":return we("planner","role.planner","\uFF0B",`${Be(t,"scheduled independent work instead of waiting","\u4E0D\u518D\u5E72\u7B49\uFF0C\u5B89\u6392\u4E86\u72EC\u7ACB\u7684\u5DE5\u4F5C")} \xB7 ${it(pe(e,"task_title"),140)}`,"info");case"life.daemon.degraded":return we("system","role.system","\u26A0",`${Be(t,"Argus started, but the objective did not reach the Manager","Argus \u5DF2\u542F\u52A8\uFF0C\u4F46\u76EE\u6807\u6CA1\u6709\u4EA4\u5230\u7BA1\u7406\u8005\u624B\u4E0A")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"round.orphan_process_group":{let i=fr(e).cleanup_succeeded===!0;return we("engineer","role.engineer","\u26A0",i?Be(t,"background processes outlived the turn and were cleaned up","\u6709\u540E\u53F0\u8FDB\u7A0B\u5728\u8FD9\u4E00\u8F6E\u7ED3\u675F\u540E\u4ECD\u5728\u8FD0\u884C\uFF0C\u5DF2\u6E05\u7406"):Be(t,"background processes outlived the turn and could not be cleaned up","\u6709\u540E\u53F0\u8FDB\u7A0B\u5728\u8FD9\u4E00\u8F6E\u7ED3\u675F\u540E\u4ECD\u5728\u8FD0\u884C\uFF0C\u672A\u80FD\u6E05\u7406"),"warn")}case"round.model_configuration_error":return we("engineer","role.engineer","\u26D4",`${Be(t,"the model configuration is not usable","\u6A21\u578B\u914D\u7F6E\u65E0\u6CD5\u4F7F\u7528")} \xB7 ${it(pe(e,"text")||pe(e,"error"),160)}`,"err",{rule:!0});case"round.watchdog.retry":{let i=Number(fr(e).attempt||0),s=Number(fr(e).max_attempts||0);return we("engineer","role.engineer","\u21BB",Be(t,`the model call failed \u2014 retrying in a fresh session (attempt ${i} of ${s})`,`\u6A21\u578B\u8C03\u7528\u5931\u8D25 \u2014 \u5728\u65B0\u4F1A\u8BDD\u4E2D\u91CD\u8BD5\uFF08\u7B2C ${i} \u6B21\uFF0C\u5171 ${s} \u6B21\uFF09`),"warn")}case"round.watchdog.retry_exhausted":{let i=Number(fr(e).attempt||0),s=it(pe(e,"fatal_error"),140),a=Be(t,`the model call kept failing \u2014 giving up after ${Xu(i,"attempt")}`,`\u6A21\u578B\u8C03\u7528\u6301\u7EED\u5931\u8D25 \u2014 ${i} \u6B21\u540E\u653E\u5F03`);return we("engineer","role.engineer","\u26D4",s?`${a} \xB7 ${s}`:a,"err",{rule:!0})}case"round.backend_failure.backoff":{let i=Math.round(Number(fr(e).seconds||0));return we("engineer","role.engineer","\u23F3",it(pe(e,"text")||Be(t,`the model service failed \u2014 waiting ${i}s before trying again`,`\u6A21\u578B\u670D\u52A1\u51FA\u9519 \u2014 \u7B49\u5F85 ${i} \u79D2\u540E\u518D\u8BD5`),200),"warn")}case"round.backend_failure.hold_interrupted":return we("engineer","role.engineer","\u21AA",it(pe(e,"text")||Be(t,"the wait after a model-service failure ended early","\u6A21\u578B\u670D\u52A1\u51FA\u9519\u540E\u7684\u7B49\u5F85\u63D0\u524D\u7ED3\u675F"),180),"info");case"round.provider_turn_cap.restart":return we("engineer","role.engineer","\u21BB",Be(t,"reached the per-call turn allowance \u2014 continuing the same task in a fresh session","\u8FBE\u5230\u5355\u6B21\u8C03\u7528\u7684\u8F6E\u6B21\u4E0A\u9650 \u2014 \u5728\u65B0\u4F1A\u8BDD\u4E2D\u7EE7\u7EED\u540C\u4E00\u4EFB\u52A1"),"info");case"round.provider_turn_cap.reviewer_restart":return we("reviewer","role.reviewer","\u21BB",Be(t,"the review reached its turn allowance \u2014 restarting it in a fresh session","\u5BA1\u9605\u8FBE\u5230\u8F6E\u6B21\u4E0A\u9650 \u2014 \u5728\u65B0\u4F1A\u8BDD\u4E2D\u91CD\u65B0\u5F00\u59CB"),"info");case"round.reviewer_backend_failure.backoff":{let i=Math.round(Number(fr(e).seconds||0)),s=it(pe(e,"text"),200);return we("reviewer","role.reviewer","\u23F3",s||Be(t,`the Reviewer's model service is unavailable \u2014 retrying in ${i}s`,`\u5BA1\u9605\u8005\u7684\u6A21\u578B\u670D\u52A1\u4E0D\u53EF\u7528 \u2014 ${i} \u79D2\u540E\u91CD\u8BD5`),"warn")}case"round.external_work_wait.started":return we("engineer","role.engineer","\u231B",`${Be(t,"waiting for background work to report","\u7B49\u5F85\u540E\u53F0\u5DE5\u4F5C\u6C47\u62A5")} \xB7 ${it(pe(e,"work_id"),80)}`,"dim");case"round.external_work_wait.completed":return we("engineer","role.engineer","\u21BB",Be(t,"background work reported \u2014 resuming","\u540E\u53F0\u5DE5\u4F5C\u5DF2\u6C47\u62A5 \u2014 \u7EE7\u7EED"),"dim");case"round.external_work_review.required":return we("reviewer","role.reviewer","\u231B",`${Be(t,"background work finished \u2014 an independent review of its result is required before resuming","\u540E\u53F0\u5DE5\u4F5C\u5DF2\u7ED3\u675F \u2014 \u6062\u590D\u524D\u9700\u8981\u5BF9\u5176\u7ED3\u679C\u505A\u4E00\u6B21\u72EC\u7ACB\u5BA1\u9605")} \xB7 ${it(pe(e,"work_id"),80)}`,"dim");case"round.external_work_review.completed":return we("reviewer","role.reviewer","\u2713",`${Be(t,"background work result reviewed","\u540E\u53F0\u5DE5\u4F5C\u7ED3\u679C\u5DF2\u5BA1\u9605")} \xB7 ${it(pe(e,"review_status"),40)}`,"dim");case"plan.draft.failed":return we("planner","role.planner","\u26A0",`${Be(t,"could not draft the plan","\u672A\u80FD\u8D77\u8349\u8BA1\u5212")} \xB7 ${it(pe(e,"reason"),140)}`,"err");case"plan.draft.done":{let i=Number(fr(e).steps||0);return we("planner","role.planner","\u{1F4CB}",Be(t,`drafted a plan with ${Xu(i,"step")}`,`\u8D77\u8349\u4E86\u4E00\u4EFD ${i} \u6B65\u7684\u8BA1\u5212`),"dim")}case"team.learning.review.started":return we("manager","role.manager","\u{1F4DA}",Be(t,"reviewing what this task taught the team","\u6574\u7406\u8FD9\u9879\u4EFB\u52A1\u7ED9\u56E2\u961F\u5E26\u6765\u7684\u7ECF\u9A8C"),"dim");case"team.learning.review.failed":return we("manager","role.manager","\u26A0",`${Be(t,"the team learning review failed","\u56E2\u961F\u7ECF\u9A8C\u6574\u7406\u5931\u8D25")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"team.learning.review.completed":{let i=Number(fr(e).created||0),s=Number(fr(e).updated||0);return we("manager","role.manager","\u{1F4DA}",Be(t,`kept ${i} new and ${s} updated team procedures`,`\u4FDD\u7559\u4E86 ${i} \u6761\u65B0\u7684\u3001${s} \u6761\u66F4\u65B0\u7684\u56E2\u961F\u505A\u6CD5`),"dim")}case"team.learning.promotion.quarantined":return we("manager","role.manager","\u26A0",Be(t,"set aside a new procedure that would have judged its own work","\u6401\u7F6E\u4E86\u4E00\u6761\u4F1A\u8BC4\u5224\u81EA\u5DF1\u5DE5\u4F5C\u7684\u65B0\u505A\u6CD5"),"warn");case"self.learning.review.failed":return we("system","role.system","\u26A0",`${Be(t,"the review of Argus's own conversation habits failed","\u5BF9 Argus \u81EA\u8EAB\u5BF9\u8BDD\u4E60\u60EF\u7684\u590D\u76D8\u5931\u8D25")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"domain.promotion":return we("manager","role.manager","\u2605",it(pe(e,"text"),180),"dim");case"idea.portfolio.formed":{let i=fr(e).selection,s=i&&typeof i=="object"?String(i.route_id??""):"",a=Number(fr(e).route_count||0),u=it(pe(e,"text"),180),p=a>0?Be(t,`formed an idea portfolio of ${Xu(a,"route")}`,`\u7EC4\u6210\u4E86 ${a} \u6761\u601D\u8DEF\u7684\u7EC4\u5408`):Be(t,"formed an idea portfolio","\u7EC4\u6210\u4E86\u601D\u8DEF\u7EC4\u5408");return we("engineer","role.engineer","\u{1F4A1}",s?Be(t,`chose route ${s} from the idea portfolio`,`\u4ECE\u601D\u8DEF\u7EC4\u5408\u4E2D\u9009\u5B9A\u4E86\u8DEF\u7EBF ${s}`):u||p,"accent")}case"user.note":{let i=Array.isArray(fr(e).tags)?fr(e).tags.map(String):[];if(i.includes("config"))return Fo();if(i.includes("planner"))return we("planner","role.planner","\u{1F4DD}",Be(t,"updated the research plan","\u66F4\u65B0\u4E86\u7814\u7A76\u8BA1\u5212"),"dim");let s=it(pe(e,"summary")||pe(e,"text")||pe(e,"title"),180);return we("system","role.operator","\u{1F4DD}",`${Be(t,"you added a note","\u4F60\u6DFB\u52A0\u4E86\u4E00\u6761\u7B14\u8BB0")}${s?` \xB7 ${s}`:""}`,"accent")}case"ui.operator":{let i=pe(e,"text");return i.trim()?we("system","role.operator","\u203A",i,"accent",{rule:!0}):Fo()}case"ui.argus":{let i=pe(e,"text"),s=Array.isArray(fr(e).steps)&&fr(e).steps.length>0;return i.trim()||s?we("manager","role.argus","\u258C",i,"bright",{expandable:t.density==="full",rule:!0}):Fo()}case"agent.io.start":case"agent.io.stream":case"agent.io.complete":case"agent.io.error":case"usage.recorded":case"provider.request.started":case"provider.request.completed":case"codex.util.completed":case"skill.cost.completed":case"budget.reservation.created":case"budget.reservation.settled":case"budget.reservation.released":case"round.checkpoint.recorded":case"round.checkpoint.failed":case"round.secret_redacted":case"role.session.turn":case"engineer.skill_maintenance.completed":case"life.status":case"life.mission.skipped":case"life.mission.orphaned":case"life.mission.requeued":case"life.manager.plan_challenge.decided":case"life.vertical.resolved":case"life.manager.backend_resolved":case"life.planner.backend_resolved":case"life.planner.dependency_dropped":case"life.planner.parallel_dropped":case"life.engineer.backend_resolved":case"life.reviewer.backend_resolved":case"life.curator.backend_resolved":case"life.runtime_failure.circuit_opened":case"life.runtime_failure.circuit_blocked":case"life.runtime_failure.canary_passed":case"life.runtime.incident.detected":case"life.runtime.incident.recovered":case"life.runtime.incident.escalated":case"life.plan.revision.proposed":case"life.plan.revision.rejected":case"life.plan.revision.committed":case"life.plan.node.superseded":case"life.lifecycle.transition":case"life.inbox.drained":case"life.operator_question.pending":case"life.operator_question.answered":case"project.completed":case"project.completion_refused":case"daemon.command.submitted":case"daemon.command.completed":case"daemon.command.rejected":case"idea.search.started":case"idea.search.completed":case"idea.search.skipped":case"venue.research.started":case"venue.research.completed":case"research.achievement.certified":case"skill.library.available":case"skill.created":case"skill.updated":case"skill.archived":case"skill.tidied":case"skill.history.compressed":case"skill.evolution.completed":case"wiki.initialized":case"wiki.hook.warning":case"wiki.created":case"wiki.updated":case"wiki.retired":case"wiki.promotion.promoted":case"wiki.promotion.demoted":case"wiki.retired.compressed":case"wiki.evolution.completed":case"knowledge.learned":case"knowledge.recalled":case"life.planner.verdict.discarded":case"life.manager.feedback.unresolved":case"life.manager.project_report":case"life.plan.revision.rolled_back":case"life.planner.completion_circuit.notify_failed":case"life.planner.completion_circuit_holding":case"life.planner.external_poll_suppressed":case"life.planner.waiting_contract.normalized":case"life.daemon.ready":case"plan.draft.start":case"team.learning.review.skipped":case"self.learning.review.started":case"self.learning.review.completed":case"manager.live_view.updated":case"manager.live_view.rejected":case"idea.portfolio.nested_skipped":case"manager.turn.started":case"manager.turn.cancelled":case"life.config.parse_failed":return LI(e,t);default:return LI(e,t)}}function MI(e){return e.segments.map(t=>t.text).join("")}var $F={"role.manager":["Manager","Manager"],"role.planner":["Planner","Planner"],"role.engineer":["Engineer","Engineer"],"role.reviewer":["Reviewer","Reviewer"],"role.advisor":["Advisor","\u987E\u95EE"],"role.peer":["Project exchange","\u9879\u76EE\u4EA4\u6D41"],"role.critic":["Critic","Critic"],"role.system":["Argus","Argus"],"role.argus":["Argus","Argus"],"role.operator":["You","\u4F60"],"event.notice":["Notice","\u901A\u77E5"],"event.watch":["Watch","\u76D1\u63A7"],"event.budget":["Budget","\u9884\u7B97"],"event.quota":["Quota","\u989D\u5EA6"],"event.fallback":["Argus","Argus"],"event.hidden":["",""]};function PI(e,t){let r=$F[e];if(r)return t==="zh-CN"?r[1]:r[0];let i=e.startsWith("role.")?e.slice(5):e;return i?`${i.slice(0,1).toUpperCase()}${i.slice(1)}`:""}function _0(e,t){let r=Bp(e,t);if(r.visibility==="hidden")return null;let i=MI(r);return!i&&!(e.type==="ui.argus"&&Array.isArray(e.steps)&&e.steps.length>0)?null:{role:r.role,labelKey:r.labelKey,label:PI(r.labelKey,t.locale),glyph:r.glyph,text:i,tone:r.tone,rule:r.rule,reasoning:r.reasoning,expand:r.expandable,sensitive:r.sensitive}}function qF(e,t){let r={done:["the Reviewer was satisfied","\u5BA1\u9605\u8005\u8BA4\u53EF\u4E86\u8FD9\u4E00\u8F6E"],blocked:["the Reviewer found the work stuck","\u5BA1\u9605\u8005\u8BA4\u4E3A\u5DE5\u4F5C\u5361\u4F4F\u4E86"],no_progress:["the Reviewer saw no progress","\u5BA1\u9605\u8005\u6CA1\u6709\u770B\u5230\u8FDB\u5C55"]};if(!e)return Be(t,"the Reviewer gave no verdict","\u5BA1\u9605\u8005\u6CA1\u6709\u7ED9\u51FA\u7ED3\u8BBA");let i=r[e]??["the Reviewer asked for another pass","\u5BA1\u9605\u8005\u8981\u6C42\u518D\u6539\u4E00\u8F6E"];return Be(t,i[0],i[1])}var Yf={manager:"Manager",planner:"Planner",engineer:"Engineer",reviewer:"Reviewer",critic:"Critic",system:"Argus"};function Dp(e){switch(e){case"bright":return"white";case"dim":return"gray";case"accent":return me.accent;case"ok":return me.success;case"warn":return me.warning;case"err":return me.error;case"info":return me.info}}function yp(e){return me.role[e]??"gray"}function vr(e,t){let r=(e||"").replace(/```[a-z]*\n?/gi,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"[$1]").trim();return r.length<=t?r:r.slice(0,t-1).trimEnd()+"\u2026"}var Ve=(e,t)=>String(e[t]??"");function zF(e){let t=Ve(e,"phase"),r=Ve(e,"cause")||Ve(e,"backend_error"),i=Ve(e,"error");if(!t||!r)return`\u6CA1\u80FD\u5224\u65AD\u8FD9\u4E2A\u8BF7\u6C42\u8BE5\u5F52\u8C01 ${vr(i,160)}`;let s={backend:"\u6A21\u578B\u670D\u52A1",parse:"\u8BFB\u53D6\u56DE\u7B54",contract:"\u56DE\u7B54\u683C\u5F0F\uFF1A",timeout:"\u8D85\u65F6"},a=Number(e.attempts||0),u=a>1?` (\u7B2C${a}\u6B21\u5C1D\u8BD5)`:"",p=`\u6CA1\u80FD\u5224\u65AD\u8FD9\u4E2A\u8BF7\u6C42\u8BE5\u5F52\u8C01 \xB7 ${s[t]||t} ${r}${u}`;return i?`${p} \xB7 \u539F\u59CB\u9519\u8BEF: ${i}`:p}var UI=e=>{let t=e,r=t.round_index??t.round;return typeof r=="string"||typeof r=="number"?r:"?"};function S0(e){let t=Ve(e,"type");if(t==="engineer.progress"){let i=Ve(e,"kind"),s=Ve(e,"agent_layer")||"engineer",a=Yf[s]||"Engineer";if(i==="reasoning"){let u=vr(Ve(e,"text"),280);return u?{role:s,label:a,glyph:"\u2234",text:u,tone:"dim",reasoning:!0}:null}if(i==="assistant_message"||i==="agent_message"||i==="message"){if(Vu(e))return null;let u=$u(Ve(e,"text"));return u?{role:s,label:a,glyph:"\u258C",text:u,tone:"bright",expand:!0}:null}if(i==="command_execution"){let u=Ve(e,"text")||Ve(e,"command")||Ve(e,"action_summary");return u?{role:s,label:a,glyph:"\u25B8 $",text:u,tone:Ve(e,"status")==="failed"?"err":"dim",expand:!0}:null}if(i==="tool_use"||i==="file_change"){let u=Ve(e,"text")||Ve(e,"action_summary");return u?{role:s,label:a,glyph:i==="file_change"?"\u270E":"\u2699",text:u,tone:Ve(e,"status")==="failed"?"err":"dim",expand:!0}:null}return null}if(t==="role.activity"){let i=Ve(e,"status");if(i==="running")return null;let s=Ve(e,"role")||"engineer",a=e.milestone===!0;return i!=="error"&&!a?null:{role:s,label:Yf[s]||s,glyph:i==="error"?"\u2715":"\u2713",text:vr(Ve(e,"label")||"activity completed",180),tone:i==="error"?"err":"ok"}}if(t==="life.manager.intent.started")return{role:"manager",label:"Manager",glyph:"\u{1F9ED}",text:"\u5224\u65AD\u8FD9\u662F\u4EC0\u4E48\u6837\u7684\u8BF7\u6C42\u2026",tone:"info"};if(t==="life.manager.intent.completed")return{role:"manager",label:"Manager",glyph:"\u{1F9ED}",text:`\u2192 ${hp({route:Ve(e,"route")||"team",vertical:Ve(e,"vertical"),workflow_mode:Ve(e,"workflow_mode"),lifetime:Ve(e,"lifetime"),continuous:e.continuous===!0,open_ended:e.open_ended===!0})||Ve(e,"kind")||"resolved"}`,tone:"info"};if(t==="life.manager.intent.failed")return{role:"manager",label:"Manager",glyph:"\u26A0",text:zF(e),tone:"err",expand:!0};if(t==="life.manager.stage_decision"){let i=Ve(e,"target_stage")||Ve(e,"stage")||Ve(e,"current_stage");return{role:"manager",label:"Manager",glyph:"\u{1F9ED}",text:`${Ve(e,"action")}${i?` \u2192 ${i}`:""} ${vr(Ve(e,"reason"),140)}`,tone:"info"}}if(t==="life.research.second_reading"){let i=Ve(e,"agent_layer")||"manager",s=vr(Ve(e,"supported"),160),a="reread the evidence and reworked the plan";return{role:i,label:Yf[i]||i,glyph:"\u{1F4D6}",text:s?`${a} \xB7 ${s}`:a,tone:"info"}}if(t==="life.letter.written"){let i=Ve(e,"agent_layer")||"manager";return{role:i,label:Yf[i]||i,glyph:"\u2709",text:"wrote you a letter",tone:"accent"}}if(t==="life.planner.start")return{role:"planner",label:"Planner",glyph:"\u{1F4CB}",text:`planning ${vr(Ve(e,"objective"),160)}`,tone:"accent"};if(t==="life.planner.verdict")return Ve(e,"status")==="done"||e.project_done===!0?{role:"planner",label:"Planner",glyph:"\u{1F3C1}",text:"the project is finished",tone:"ok"}:{role:"planner",label:"Planner",glyph:"\u{1F4CB}",text:`lined up ${Ve(e,"queued")||Ve(e,"n")||"next"} task(s) to do next`,tone:"accent"};if(t==="life.planner.task_added")return{role:"planner",label:"Planner",glyph:"\uFF0B",text:`added a task \xB7 ${vr(Ve(e,"title")||Ve(e,"objective"),160)}`,tone:"accent"};if(t==="life.planner.task_skipped")return{role:"planner",label:"Planner",glyph:"\u23ED",text:`skipped a task already planned ${vr(Ve(e,"title"),140)}`,tone:"dim"};if(t==="life.planner.error")return{role:"planner",label:"Planner",glyph:"\u26A0",text:`the Planner hit an error ${vr(Ve(e,"error")||Ve(e,"text"),160)}`,tone:"err"};if(t==="life.mission.started"||t==="mission.started")return{role:"engineer",label:"Engineer",glyph:"\u{1F680}",text:vr(Ve(e,"title")||Ve(e,"objective")||Ve(e,"text")||"started work on this task",180),tone:"info",rule:!0};if(t==="round.started"||t==="round.start")return{role:"engineer",label:"Engineer",glyph:"\u2500\u2500",text:`round ${UI(e)}`,tone:"dim",rule:!0};if(t==="life.phase.started"){let i=Ve(e,"label")||Ve(e,"phase");if(!i)return null;let s=Ve(e,"agent_layer")||"engineer";return{role:s,label:Yf[s]||s,glyph:"\u{1F504}",text:`\u8FDB\u5165 ${i}`,tone:"info"}}if(t==="round.review.started")return{role:"reviewer",label:"Reviewer",glyph:"\u{1F504}",text:`the Reviewer checks round ${UI(e)}`,tone:"info"};if(t==="round.review.deferred")return{role:"engineer",label:"Engineer",glyph:"\u21AA",text:`carries on into the next round without a review \xB7 ${vr(Ve(e,"next_step"),180)}`,tone:"info"};if(t==="round.main.completed")return{role:"engineer",label:"Engineer",glyph:"\u2705",text:`finished round ${UI(e)} of work`,tone:"info"};if(t==="round.review.completed"){if(e.review_skipped===!0)return{role:"reviewer",label:"Reviewer",glyph:"\u21AA",text:`no review this round \xB7 ${vr(Ve(e,"reason"),200)}`,tone:"info"};let i=Ve(e,"status"),s=i==="done"?"ok":i==="blocked"||i==="no_progress"?"err":"warn";return{role:"reviewer",label:"Reviewer",glyph:i==="done"?"\u2705":i==="blocked"||i==="no_progress"?"\u26D4":"\u21BB",text:`${ek(i)} \xB7 ${vr(Ve(e,"reason"),200)}`,tone:s}}if(t==="life.mission.completed"||t==="mission.completed"||t==="loop.completed"){let i=pl(e),s=vr(Ve(e,"summary"),240);return{role:"engineer",label:"Engineer",glyph:i.glyph,text:s?`${i.label} \xB7 ${s}`:i.label,tone:i.tone,rule:!0}}if(t==="life.mission.failed"||t==="mission.error")return{role:"engineer",label:"Engineer",glyph:"\u274C",text:`this task failed ${vr(Ve(e,"reason")||Ve(e,"error"),160)}`,tone:"err",rule:!0};if(t==="loop.start")return{role:"engineer",label:"Engineer",glyph:"\u25B6",text:vr(Ve(e,"text")||Ve(e,"objective"),16e3),tone:"info",expand:!0};if(t==="loop.done")return{role:"engineer",label:"Engineer",glyph:"\u{1F3C1}",text:`the run finished ${vr(Ve(e,"text"),140)}`,tone:"dim"};if(t==="life.inbox.queued")return{role:"system",label:"You",glyph:"\u{1F4E5}",text:`you added guidance \xB7 ${vr(Ve(e,"text"),180)}`,tone:"accent"};if(t==="daemon.parked")return{role:"system",label:"Argus",glyph:"\u2161",text:`Argus set this project aside with its state saved${Ve(e,"replaced_by")?` \xB7 continued as ${Ve(e,"replaced_by")}`:""}`,tone:"warn",rule:!0};if(t==="provider.request.denied")return{role:"system",label:"Quota",glyph:"\u23F8",text:`a request to ${Ve(e,"provider")||"the model service"} was held back \xB7 ${vr(Ve(e,"reason"),160)}`,tone:"warn",rule:!0};if(t==="round.reviewer_backend_failure")return{role:"system",label:"Watch",glyph:"\u{1F441}",text:`the Reviewer's model service is unreachable \u2014 waiting rather than going on unchecked \xB7 ${vr(Ve(e,"text"),150)}`,tone:"err",rule:!0};if(t==="round.stall")return{role:"system",label:"Watch",glyph:"\u{1F441}",text:vr(Ve(e,"text")||"no progress this round \u2014 keeping a close eye on it",170),tone:"warn"};if(t==="round.escalated")return{role:"system",label:"Watch",glyph:"\u{1F441}",text:vr(Ve(e,"text")||"many rounds without a finish \u2014 raising what is blocking the work",170),tone:"warn"};if(t==="life.planner.stall_escalation")return{role:"system",label:"Watch",glyph:"\u{1F441}",text:`the Planner is stuck \u2014 ${vr(Ve(e,"reason")||Ve(e,"text"),150)}`,tone:"warn"};if((t==="life.budget.pause"||t==="budget.reservation.denied")&&(Ve(e,"stop_kind")==="cost_unreconciled"||Ve(e,"reason").startsWith("unresolved provider cost")))return{role:"system",label:"Budget",glyph:"$",text:"Provider usage awaits reconciliation \u2014 not budget exhaustion",tone:"warn"};if(t==="life.budget.pause")return{role:"system",label:"Watch",glyph:"\u23F8",text:`budget cap reached \u2014 paused \xB7 ${vr(Ve(e,"text")||Ve(e,"reason"),140)}`,tone:"warn"};if(t==="budget.reservation.denied")return{role:"system",label:"Budget",glyph:"$",text:`budget denied \u2014 ${vr(Ve(e,"reason")||Ve(e,"text"),160)}`,tone:"err",rule:!0};if(t==="budget.unpriced.blocked")return{role:"system",label:"Budget",glyph:"$",text:"Provider usage awaits reconciliation \u2014 not budget exhaustion",tone:"warn"};if(t==="budget.unpriced.acknowledged")return{role:"system",label:"Budget",glyph:"$",text:"Single-call cost risk approved; original usage remains pending",tone:"warn"};if(t==="life.lifecycle.block")return{role:"system",label:"Watch",glyph:"\u26D4",text:`blocked \u2014 needs you \xB7 ${vr(Ve(e,"text")||Ve(e,"reason"),150)}`,tone:"err",rule:!0};if(t==="life.daemon.idle_timeout")return{role:"system",label:"Watch",glyph:"\u{1F7E6}",text:vr(Ve(e,"text")||"nothing to do for a while \u2014 standing by",150),tone:"dim"};if(t==="ui.operator")return{role:"system",label:"You",glyph:"\u203A",text:Ve(e,"text"),tone:"accent",rule:!0};if(t==="ui.argus"){let i=Ve(e,"text");return i?{role:"manager",label:"Argus",glyph:"\u258C",text:i,tone:"bright"}:null}if(t==="ui.activity"){let i=Ve(e,"text");return i?{role:"manager",label:"Steps",glyph:"\u22EE",text:i,tone:"dim"}:null}let r=_0(e,XF);if(r)return ZF(r);if(e.operator_alert===!0){let i=vr(Ve(e,"text")||Ve(e,"reason")||t,170);if(i)return{role:"system",label:"Watch",glyph:"\u{1F441}",text:i,tone:"err",rule:!0}}return null}var XF={locale:"en",showReasoning:!0,unknownEventPolicy:"hide",density:"full"};function ZF(e){return{role:e.role,label:e.labelKey==="event.notice"?"Watch":e.label,glyph:e.glyph,text:e.text,tone:e.tone,...e.rule?{rule:!0}:{},...e.reasoning?{reasoning:!0}:{},...e.expand?{expand:!0}:{}}}function GI(e){let t=e,r=String(t.kind??"");return String(t.type)==="engineer.progress"&&["assistant_message","agent_message","message","reasoning"].includes(r)||String(t.type)==="ui.argus"?String(t.message_id??""):""}function ek(e){let t={done:"the Reviewer was satisfied",blocked:"the Reviewer found the work stuck",no_progress:"the Reviewer saw no progress"};return e?t[e]??"the Reviewer asked for another pass":"the Reviewer gave no verdict"}var R0=["turning it over","consulting a hundred eyes","reading the room","weighing it","thinking it through","cross-checking the evidence","running the numbers","sizing up the angles","following the thread","letting it settle"],HI=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function b0(e,t,r=20){return e.length===0?"":e[Math.floor(t/r)%e.length]}function WI(e){return HI[e%HI.length]}function F0(e,t,r=!1,i=0){let s=`${b0(R0,t)}\u2026`;if(r){let u=Math.max(0,Math.floor(Number.isFinite(i)?i:0));return`${s} \xB7 Manager alive \xB7 ${u}s quiet`}let a=e||s;return a.includes("[SESSION HANDOFF")?"Manager context refreshed \xB7 working on your message\u2026":a.replace(/^Manager\s*·\s*/i,"").slice(0,100)}var k0="a hundred eyes on your research \u2014 some never close";var N0=["All quiet. Argus keeps watch.","Nothing stirring \u2014 some eyes stay open.","Standing watch. Say the word.","Resting, not sleeping.","Quiet stretch. The watch continues.","No signal yet \u2014 Argus doesn't blink first.","The feed is calm. So is Argus.","Waiting, unhurried."];function x0(e,t=3800){return e.length===0?"":e[Math.floor(Date.now()/t)%e.length]}function Qp(e){let t=[],r=new Map,i=new Set(e.map(s=>String(s.recovered_from_message_id??"")).filter(Boolean));return e.forEach(s=>{if(i.has(GI(s))&&s.final_delivery!==!0)return;let a=S0(s);if(!a)return;let u=GI(s);if(u&&r.has(u)){let E=r.get(u),I={...t[E],ev:{...t[E].ev,...s},r:{...t[E].r,...a,text:QI(t[E].r.text,a.text,jf(s))}};if(E===t.length-1){t[E]=I;return}t.splice(E,1);for(let[y,D]of r)D>E&&r.set(y,D-1);t.push(I),r.set(u,t.length-1);return}let p=u||EA(s);u&&r.set(u,t.length),t.push({ev:s,r:a,key:p,mid:u})}),t}function T0(e,t=""){let r=e.at(-1),i=t?e.findIndex(p=>p.mid===t):-1,s=!!(r?.mid&&r.ev.type==="engineer.progress"&&r.ev.replace===!0),a=i>=0?i:s?e.length-1:-1,u=a>=0?e[a]:null;return{committed:u?e.filter((p,E)=>E!==a):e,live:u}}var Jo=Me(Lt(),1);function O0({r:e,compact:t,width:r}){let i=t?`${e.label.slice(0,1)} `:e.label.padEnd(9),s=Math.max(12,r-(t?8:15));return(0,Jo.jsxs)(De,{flexDirection:"column",children:[e.rule&&(0,Jo.jsx)(k,{dimColor:!0,children:" \u2500\u2500"}),(0,Jo.jsxs)(De,{children:[(0,Jo.jsx)(k,{children:" "}),(0,Jo.jsx)(k,{color:yp(e.role),bold:!0,children:i}),(0,Jo.jsx)(De,{width:s,children:(0,Jo.jsxs)(k,{color:e.reasoning?void 0:Dp(e.tone),dimColor:e.reasoning,italic:e.reasoning,wrap:e.expand||e.tone==="bright"?"wrap":"truncate-end",children:[e.glyph," ",e.text]})})]})]})}function L0({events:e,width:t,mode:r="all",liveMessageId:i="",collapsed:s=!1,showIdle:a=!0,showReasoning:u=!1}){let p=(0,ml.useMemo)(()=>{let ie=Qp(e),X=u?ie:ie.filter($=>!$.r.reasoning);return r==="conversation"?X.filter($=>["ui.operator","ui.argus","ui.activity"].includes(String($.ev.type??""))||$.r.reasoning):X},[e,r,u]),{committed:E,live:I}=T0(p,i),y=I&&jf(I.ev)==="append"?I:null,D=I&&!y&&I.ev.type!=="ui.argus"?I:null,{write:v}=Ra(),T=(0,ml.useRef)(new Set),P=(0,ml.useRef)(null),Z=t<80,ee=!a&&p.length===0,W=E.filter(ie=>!T.current.has(ie.key)||jf(ie.ev)!=="append");return(0,ml.useEffect)(()=>{if(!y){P.current&&(v(` +`)}function KF(e){let t=e;return t=t.replace(/^(\s*(?:authorization|proxy-authorization)\s*:).*$/gim,"$1 "),t=t.replace(/^(\s*(?:x-api-key|api-key|cookie|set-cookie)\s*:).*$/gim,"$1 "),t=t.replace(/gh[pousr]_[A-Za-z0-9]{20,}/g,"").replace(/xox[baprs]-[A-Za-z0-9-]{10,}/g,"").replace(/AKIA[0-9A-Z]{16}/g,"").replace(/\bbearer\s+[A-Za-z0-9._\-+/=]{16,}/gi,"").replace(/(?").replace(/(?").replace(/\b([a-z][a-z0-9+.\-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi,"$1@"),{text:e,sensitive:t!==e}}function v0(e){return KF($u(e))}function it(e,t){let r=String(e??"").replace(/```[a-z]*\n?/gi,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"[$1]").trim();return r.length<=t?r:`${r.slice(0,t-1).trimEnd()}\u2026`}var lr=e=>e,pe=(e,t)=>String(lr(e)[t]??"");function Xu(e,t){return`${e} ${t}${e===1?"":"s"}`}function Be(e,t,r){return e.locale==="zh-CN"?r:t}function JF(e,t){let r=pe(e,"error_code"),i=pe(e,"failure_stage"),s=pe(e,"stop_kind"),a=["daemon_shutdown","operator_pause","operator_abort"].includes(s);if(r==="cancelled"&&i==="commit"&&pe(e,"status")==="issued")return{text:Be(t,"Applying the adjustment was interrupted; the saved decision is waiting to be applied.","\u5E94\u7528\u8C03\u6574\u65F6\u88AB\u4E2D\u65AD\uFF0C\u5DF2\u4FDD\u5B58\u7684\u51B3\u5B9A\u7B49\u5F85\u7EE7\u7EED\u5904\u7406\u3002"),tone:"warn"};if(r==="timeout"&&i==="commit")return{text:Be(t,"Manager reached a decision, but applying the adjustment timed out.","Manager \u5DF2\u4F5C\u51FA\u5224\u65AD\uFF0C\u4F46\u5E94\u7528\u8C03\u6574\u8D85\u65F6\u3002"),tone:"warn"};let u={trial_quota_exceeded:["The remaining trial quota cannot cover this Manager check.","\u5269\u4F59\u8BD5\u7528\u989D\u5EA6\u4E0D\u8DB3\u4EE5\u542F\u52A8\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"],observation_incomplete:["Manager could not fully read the required project evidence; this check has stopped.","Manager \u672A\u80FD\u5B8C\u6574\u8BFB\u53D6\u6240\u9700\u7684\u9879\u76EE\u8D44\u6599\uFF0C\u8FD9\u6B21\u68C0\u67E5\u5DF2\u505C\u6B62\u3002"],timeout:["The model did not respond before the Manager check timed out.","\u6A21\u578B\u672A\u5728\u65F6\u9650\u5185\u8FD4\u56DE\uFF0CManager \u8FD9\u6B21\u68C0\u67E5\u5DF2\u7ED3\u675F\u3002"],cancelled:["This Manager check was cancelled.","\u5DF2\u53D6\u6D88\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"],superseded:["New input or evidence superseded this Manager check.","\u65B0\u7684\u64CD\u4F5C\u6216\u8BC1\u636E\u5DF2\u53D6\u4EE3\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"]};if(Object.hasOwn(u,r)&&!(r==="cancelled"&&a))return{text:Be(t,...u[r]),tone:r==="cancelled"||r==="superseded"?"dim":"warn"};let p={budget_exhausted:["The project budget limit prevented this Manager check.","\u9879\u76EE\u9884\u7B97\u5DF2\u8FBE\u4E0A\u9650\uFF0CManager \u6682\u672A\u5B8C\u6210\u68C0\u67E5\u3002"],provider_cooldown:["The model service asked Manager to wait before calling again.","\u6A21\u578B\u670D\u52A1\u8981\u6C42\u7A0D\u540E\u518D\u8C03\u7528\uFF0CManager \u6682\u672A\u5B8C\u6210\u68C0\u67E5\u3002"],provider_fence:["The model service is not accepting calls; Manager could not finish this check.","\u6A21\u578B\u670D\u52A1\u5F53\u524D\u4E0D\u63A5\u53D7\u8C03\u7528\uFF0CManager \u672A\u5B8C\u6210\u8FD9\u6B21\u68C0\u67E5\u3002"],backend_unavailable:["The model service was unavailable for this Manager check.","\u6A21\u578B\u670D\u52A1\u4E0D\u53EF\u7528\uFF0CManager \u672A\u5B8C\u6210\u8FD9\u6B21\u68C0\u67E5\u3002"],transient_error:["A temporary model service error interrupted this Manager check.","\u6A21\u578B\u670D\u52A1\u7684\u4E34\u65F6\u9519\u8BEF\u4E2D\u65AD\u4E86\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"],permanent_error:["The model call failed; Manager could not finish this check.","\u6A21\u578B\u8C03\u7528\u5931\u8D25\uFF0CManager \u672A\u5B8C\u6210\u8FD9\u6B21\u68C0\u67E5\u3002"],daemon_shutdown:["Argus stopped, ending this Manager check.","Argus \u5DF2\u505C\u6B62\uFF0C\u8FD9\u6B21 Manager \u68C0\u67E5\u5DF2\u7ED3\u675F\u3002"],operator_pause:["This Manager check was paused by your request.","\u5DF2\u6309\u4F60\u7684\u8981\u6C42\u6682\u505C\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"],operator_abort:["This Manager check was cancelled by your request.","\u5DF2\u6309\u4F60\u7684\u8981\u6C42\u53D6\u6D88\u8FD9\u6B21 Manager \u68C0\u67E5\u3002"]};if(Object.hasOwn(p,s))return{text:Be(t,...p[s]),tone:a?"dim":"warn"};let E=pe(e,"status");return E==="cancelled"||E==="superseded"?{text:Be(t,"This Manager check was cancelled.","\u8FD9\u6B21 Manager \u68C0\u67E5\u5DF2\u53D6\u6D88\u3002"),tone:"dim"}:{text:i==="commit"&&["continue","wait","steer"].includes(pe(e,"action"))?Be(t,"Manager reached a decision, but the team adjustment could not be applied.","Manager \u5DF2\u4F5C\u51FA\u5224\u65AD\uFF0C\u4F46\u56E2\u961F\u8C03\u6574\u672A\u80FD\u751F\u6548\u3002"):i==="decision"?Be(t,"Manager returned a decision that could not be validated.","Manager \u8FD4\u56DE\u7684\u5224\u65AD\u6216\u5F15\u7528\u4F9D\u636E\u672A\u901A\u8FC7\u6838\u9A8C\u3002"):Be(t,"Manager could not finish this check.","Manager \u672A\u80FD\u5B8C\u6210\u8FD9\u6B21\u68C0\u67E5\u3002"),tone:"warn"}}function we(e,t,r,i,s,a={}){let u=v0(i);return{visibility:a.visibility??(s==="err"||s==="warn"?"alert":"normal"),role:e,labelKey:t,glyph:r,tone:s,segments:u.text?[{kind:"text",text:u.text}]:[],expandable:a.expandable===!0,sensitive:u.sensitive||a.sensitive===!0,fallback:a.fallback===!0,rule:a.rule===!0,reasoning:a.reasoning===!0}}function Fo(){return{visibility:"hidden",role:"system",labelKey:"event.hidden",glyph:"",tone:"dim",segments:[],expandable:!1,sensitive:!1,fallback:!1,rule:!1,reasoning:!1}}function LI(e,t){if(lr(e).operator_alert===!0){let s=it(pe(e,"text")||pe(e,"reason")||e.type,170);return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",s,"err",{rule:!0})}if(t.unknownEventPolicy==="hide")return Fo();let r=String(e.type||"?"),i=pe(e,"text").trim();return we("system","event.fallback","\u2022",`[${r}]${i?` ${i}`:""}`,"dim",{fallback:!0})}function Cp(e,t="engineer"){let r=pe(e,"agent_layer");return r||(e.type.startsWith("life.manager.")?"manager":e.type.startsWith("life.planner.")?"planner":e.type.startsWith("round.review.")?"reviewer":t)}function YF(e,t){let r=pe(e,"phase"),i=pe(e,"cause")||pe(e,"backend_error"),s=pe(e,"error");if(!r||!i)return`${Be(t,"could not work out where this request belongs","\u6CA1\u80FD\u5224\u65AD\u8FD9\u4E2A\u8BF7\u6C42\u8BE5\u5F52\u8C01")} ${it(s,t.density==="full"?160:140)}`;let a={backend:["model service","\u6A21\u578B\u670D\u52A1"],parse:["reading the answer","\u8BFB\u53D6\u56DE\u7B54"],contract:["answer shape:","\u56DE\u7B54\u683C\u5F0F\uFF1A"],timeout:["timed out","\u8D85\u65F6"]},u=a[r]?Be(t,a[r][0],a[r][1]):r,p=Number(lr(e).attempts||0),E=p>1?Be(t,` (attempt ${p})`,` (\u7B2C${p}\u6B21\u5C1D\u8BD5)`):"",I=`${Be(t,"could not work out where this request belongs","\u6CA1\u80FD\u5224\u65AD\u8FD9\u4E2A\u8BF7\u6C42\u8BE5\u5F52\u8C01")} \xB7 ${u} ${i}${E}`;return s?`${I} \xB7 ${Be(t,"error text","\u539F\u59CB\u9519\u8BEF")}: ${s}`:I}function Zu(e){let t=lr(e).round_index??lr(e).round;return typeof t=="string"||typeof t=="number"?t:"?"}function VF(e,t){let r=pe(e,"kind"),i=Cp(e),s=`role.${i}`;if(r==="reasoning"){if(!t.showReasoning)return Fo();let u=it(pe(e,"text"),280);return u?we(i,s,"\u2234",u,"dim",{expandable:t.density==="full",reasoning:!0}):Fo()}if(r==="assistant_message"||r==="agent_message"||r==="message"){if(Vu(lr(e)))return LI(e,t);let u=v0(pe(e,"text"));return u.text?we(i,s,"\u258C",u.text,"bright",{expandable:t.density==="full",sensitive:u.sensitive}):Fo()}if(r==="command_execution"){let u=pe(e,"text")||pe(e,"command")||pe(e,"action_summary"),p=pe(e,"status")==="failed"?"err":"dim";return u?we(i,s,"\u25B8 $",u,p,{expandable:t.density==="full"}):Fo()}if(r==="tool_use"||r==="file_change"){let u=pe(e,"text")||pe(e,"action_summary");if(!u&&t.density==="full")return Fo();let p=r==="file_change"?Be(t,"(file change)","\uFF08\u6587\u4EF6\u53D8\u66F4\uFF09"):Be(t,"(tool)","\uFF08\u5DE5\u5177\uFF09");return we(i,s,r==="file_change"?"\u270E":"\u2699",u||p,pe(e,"status")==="failed"?"err":"dim",{expandable:t.density==="full"})}if(t.density==="full")return Fo();let a=String(lr(e).text??lr(e).action_summary??"").split(` +`)[0]?.trim()??"";return a?we(i,s,"\u25B8",it(a,160),"dim"):Fo()}function Bp(e,t){let r=Ws(lr(e).canonical_type??e.type);if(r&&r!==e.type)return Bp({...e,type:r},t);switch(e.type){case"advisor.consultation.requested":case"life.manager.supervision.issued":return Fo();case"advisor.consultation.completed":{let i=pe(e,"question").trim(),s=pe(e,"summary").trim();return!i&&!s?Fo():we("advisor","role.advisor","\u25C7",[i,s].filter(Boolean).join(` +`),"info",{expandable:!0})}case"advisor.consultation.cancelled":{let i=it(pe(e,"question"),160);return we("advisor","role.advisor","\u25C7",`${Be(t,"Consultation cancelled","\u5DF2\u53D6\u6D88\u54A8\u8BE2")}${i?` \xB7 ${i}`:""}`,"dim")}case"advisor.consultation.failed":case"advisor.consultation.timed_out":case"advisor.consultation.model_mismatch":{let i=e.type.endsWith("model_mismatch")?Be(t,"The provider returned a different model","\u63A5\u5165\u8FD4\u56DE\u7684\u6A21\u578B\u4E0E\u6240\u9009\u6A21\u578B\u4E0D\u4E00\u81F4"):e.type.endsWith("timed_out")?Be(t,"The advisor did not respond in time","\u987E\u95EE\u672A\u5728\u65F6\u9650\u5185\u8FD4\u56DE"):Be(t,"The consultation did not finish","\u987E\u95EE\u54A8\u8BE2\u672A\u5B8C\u6210"),s=it(pe(e,"question"),160);return we("advisor","role.advisor","\u25C7",`${i}${s?` \xB7 ${s}`:""}`,"warn",{expandable:!0})}case"life.manager.supervision.applied":return we("manager","role.manager","\u{1F9ED}",pe(e,"summary")||pe(e,"reason"),"info",{expandable:!0,rule:!0});case"life.peer.message.processed":return we("manager","role.peer","\u2194",pe(e,"text"),"info",{expandable:!0});case"life.manager.supervision.failed":{let i=JF(e,t);return we("manager","role.manager","\u{1F9ED}",i.text,i.tone,{expandable:!0})}case"engineer.progress":return VF(e,t);case"life.manager.intent.started":return we("manager","role.manager","\u{1F9ED}",Be(t,"Working out how to handle your request\u2026","\u6B63\u5728\u5B89\u6392\u5904\u7406\u65B9\u5F0F\u2026"),"info");case"life.manager.intent.completed":return we("manager","role.manager","\u{1F9ED}",w0(lr(e),t.locale),"info",{expandable:!0});case"life.manager.intent.failed":return we("manager","role.manager","\u26A0",YF(e,t),"err",{expandable:t.density==="full"});case"life.manager.stage_decision":{let i=pe(e,"target_stage")||pe(e,"stage")||pe(e,"current_stage");return we("manager","role.manager","\u{1F9ED}",`${pe(e,"action")}${i?` \u2192 ${i}`:""} ${it(pe(e,"reason"),t.density==="full"?140:120)}`,"info")}case"life.research.second_reading":{let i=Cp(e,"manager"),s=it(pe(e,"supported"),160),a=Be(t,"reread the evidence and reworked the plan","\u91CD\u8BFB\u4E86\u8BC1\u636E\u5E76\u91CD\u6392\u4E86\u8BA1\u5212");return we(i,`role.${i}`,"\u{1F4D6}",s?`${a} \xB7 ${s}`:a,"info")}case"life.letter.written":{let i=Cp(e,"manager");return we(i,`role.${i}`,"\u2709",Be(t,"wrote you a letter","\u7ED9\u4F60\u5199\u4E86\u4E00\u5C01\u4FE1"),"accent")}case"life.planner.start":return we("planner","role.planner","\u{1F4CB}",`${Be(t,"planning","\u6B63\u5728\u89C4\u5212")} ${it(pe(e,"objective"),t.density==="full"?160:140)}`,"accent");case"life.planner.verdict":return pe(e,"status")==="done"||lr(e).project_done===!0?we("planner","role.planner","\u{1F3C1}",Be(t,"the project is finished","\u9879\u76EE\u5DF2\u5B8C\u6210"),"ok"):we("planner","role.planner","\u{1F4CB}",Be(t,`lined up ${pe(e,"queued")||pe(e,"n")||"next"} task(s) to do next`,`\u5DF2\u6392\u597D ${pe(e,"queued")||pe(e,"n")||"\u4E0B\u4E00"} \u4E2A\u63A5\u4E0B\u6765\u8981\u505A\u7684\u4EFB\u52A1`),"accent");case"life.planner.task_added":return we("planner","role.planner","\uFF0B",`${Be(t,"added a task","\u65B0\u589E\u4EFB\u52A1")} \xB7 ${it(pe(e,"title")||pe(e,"objective"),t.density==="full"?160:140)}`,"accent");case"life.planner.task_skipped":{let s=pe(e,"skip_category")==="paper_review_purchase_deferred"?Be(t,"put off another paper review","\u63A8\u8FDF\u4E86\u518D\u4E70\u4E00\u6B21\u8BC4\u5BA1"):Be(t,"skipped a task already planned","\u8DF3\u8FC7\u4E86\u5DF2\u5728\u8BA1\u5212\u4E2D\u7684\u4EFB\u52A1");return we("planner","role.planner","\u23ED",`${s} ${it(pe(e,"title"),t.density==="full"?140:120)}`,"dim")}case"life.planner.preview_skipped":return we("planner","role.planner","\u23ED",Be(t,"skipped the plan preview: the research Planner owns the campaign plan","\u8DF3\u8FC7\u4E86\u8BA1\u5212\u9884\u89C8:\u7814\u7A76\u89C4\u5212\u5E08\u8D1F\u8D23\u6574\u4E2A\u8BA1\u5212"),"dim");case"life.planner.normalized":return we("planner","role.planner","\u224B",`${Be(t,"tidied the plan","\u6574\u7406\u4E86\u8BA1\u5212")} \xB7 ${it(pe(e,"diagnostic"),180)}`,"dim");case"life.planner.waiting":return we("planner","role.planner","\u231B",`${Be(t,"waiting","\u7B49\u5F85\u4E2D")} \xB7 ${it(pe(e,"reason"),180)}`,"info");case"life.planner.waiting_woken":return we("planner","role.planner","\u21BB",`${Be(t,"resumed","\u5DF2\u5524\u9192")} \xB7 ${it(pe(e,"wake_reason"),180)}`,"info");case"life.planner.terminal_idle":return we("planner","role.planner","\u2161",`${Be(t,"nothing left to plan","\u6682\u65F6\u6CA1\u6709\u8981\u89C4\u5212\u7684")} \xB7 ${it(pe(e,"reason"),180)}`,"dim");case"life.planner.verification_probe":return t.showReasoning?we("planner","role.planner","\u2315",`${Be(t,"checking that the plan still holds","\u68C0\u67E5\u8BA1\u5212\u662F\u5426\u4ECD\u7136\u6210\u7ACB")} \xB7 ${it(pe(e,"reason"),180)}`,"dim"):Fo();case"life.planner.error":return we("planner","role.planner","\u26A0",`${Be(t,"the Planner hit an error","\u89C4\u5212\u8005\u51FA\u9519")} ${it(pe(e,"error")||pe(e,"text"),t.density==="full"?160:140)}`,"err");case"life.mission.started":return we("engineer","role.engineer","\u{1F680}",it(pe(e,"title")||pe(e,"objective")||pe(e,"text")||Be(t,"started work on this task","\u5F00\u59CB\u505A\u8FD9\u9879\u4EFB\u52A1"),t.density==="full"?180:160),"info",{rule:!0});case"round.start":return we("engineer","role.engineer","\u2500\u2500",Be(t,`round ${Zu(e)}`,`\u7B2C ${Zu(e)} \u8F6E`),"dim",{rule:!0});case"life.phase.started":{let i=pe(e,"label")||pe(e,"phase"),s=Cp(e);return i?we(s,`role.${s}`,"\u{1F504}",Be(t,`entering ${i}`,`\u8FDB\u5165 ${i}`),"info"):Fo()}case"round.review.started":return we("reviewer","role.reviewer","\u{1F504}",Be(t,`the Reviewer checks round ${Zu(e)}`,`\u5BA1\u9605\u8005\u68C0\u67E5\u7B2C ${Zu(e)} \u8F6E`),"info");case"round.review.deferred":return we("engineer","role.engineer","\u21AA",Be(t,`carries on into the next round without a review \xB7 ${it(pe(e,"next_step"),t.density==="full"?180:160)}`,`\u4E0D\u7ECF\u5BA1\u9605\u76F4\u63A5\u8FDB\u5165\u4E0B\u4E00\u8F6E \xB7 ${it(pe(e,"next_step"),t.density==="full"?180:160)}`),"info");case"round.main.completed":return we("engineer","role.engineer","\u2705",Be(t,`finished round ${Zu(e)} of work`,`\u7B2C ${Zu(e)} \u8F6E\u5DE5\u4F5C\u5DF2\u5B8C\u6210`),"info");case"round.review.completed":{if(e.review_skipped===!0)return we("reviewer","role.reviewer","\u21AA",`${Be(t,"no review this round","\u8FD9\u4E00\u8F6E\u6CA1\u6709\u5BA1\u9605")} \xB7 ${it(pe(e,"reason"),t.density==="full"?200:160)}`,"info");let i=pe(e,"status"),s=i==="done"?it(pe(e,"residual_risk"),200):"";if(s)return we("reviewer","role.reviewer","\u26A0",`${Be(t,"verified with residual risk","\u5DF2\u9A8C\u8BC1\uFF0C\u4F46\u6709\u6B8B\u4F59\u98CE\u9669")}: ${s} \xB7 ${it(pe(e,"reason"),t.density==="full"?200:160)}`,"warn");let a=i==="done"?"ok":i==="blocked"||i==="no_progress"?"err":"warn";return we("reviewer","role.reviewer",i==="done"?"\u2705":i==="blocked"||i==="no_progress"?"\u26D4":"\u21BB",`${qF(i,t)} \xB7 ${it(pe(e,"reason"),t.density==="full"?200:160)}`,a)}case"life.mission.completed":{let i=pl(lr(e)),s=it(pe(e,"summary"),240),a=it(pe(e,"residual_risk"),200);if(a&&i.tone==="ok"){let u=Be(t,"completed with residual risk","\u5DF2\u5B8C\u6210\uFF0C\u4F46\u6709\u6B8B\u4F59\u98CE\u9669"),p=s.includes(a)?s:`${a}${s?` \xB7 ${s}`:""}`;return we("engineer","role.engineer","\u26A0",`${u} \xB7 ${p}`,"warn",{rule:!0})}return we("engineer","role.engineer",i.glyph,s?`${i.label} \xB7 ${s}`:i.label,i.tone,{rule:!0})}case"life.mission.failed":return we("engineer","role.engineer","\u274C",`${Be(t,"this task failed","\u8FD9\u9879\u4EFB\u52A1\u5931\u8D25\u4E86")} ${it(pe(e,"reason")||pe(e,"error"),t.density==="full"?160:140)}`,"err",{rule:!0});case"loop.start":return we("engineer","role.engineer","\u25B6",it(pe(e,"text")||pe(e,"objective"),t.density==="full"?16e3:160),"info",{expandable:t.density==="full"});case"loop.done":return we("engineer","role.engineer","\u{1F3C1}",`${Be(t,"the run finished","\u8FD9\u6B21\u8FD0\u884C\u7ED3\u675F")} ${it(pe(e,"text"),t.density==="full"?140:120)}`,"dim");case"life.inbox.queued":return we("system","role.operator","\u{1F4E5}",`${Be(t,"you added guidance","\u4F60\u8FFD\u52A0\u4E86\u6307\u5BFC")} \xB7 ${it(pe(e,"text"),t.density==="full"?180:160)}`,"accent");case"daemon.parked":{let i=pe(e,"replaced_by"),s=Be(t,"Argus set this project aside with its state saved","Argus \u5DF2\u628A\u8FD9\u4E2A\u9879\u76EE\u6401\u7F6E\uFF0C\u72B6\u6001\u5DF2\u4FDD\u5B58");return we("system","role.system","\u2161",i?`${s} \xB7 ${Be(t,`continued as ${i}`,`\u7531 ${i} \u63A5\u7EED`)}`:s,"warn",{rule:!0})}case"accounting.journal_repaired":{let i=lr(e).damaged_lines,s=lr(e).liabilities,a=Array.isArray(i)?i.length:0,u=Array.isArray(s)?s.length:0,p=it(pe(e,"damaged_copy"),120),E=`the usage journal was repaired: ${a} damaged line(s) set aside${p?` in ${p}`:""}, ${u} call(s) written back as a liability`,I=`\u7528\u91CF\u8D26\u672C\u5DF2\u4FEE\u590D\uFF1A${a} \u884C\u635F\u574F\u8BB0\u5F55\u5DF2\u53E6\u5B58${p?`\u5230 ${p}`:""}\uFF0C${u} \u6B21\u8C03\u7528\u6309\u8D1F\u503A\u8BB0\u56DE`;return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",Be(t,E,I),"warn",{rule:!0})}case"provider.request.denied":{let i=pe(e,"provider");return we("system","event.quota","\u23F8",`${Be(t,`a request to ${i||"the model service"} was held back`,`\u53D1\u5F80${i||"\u6A21\u578B\u670D\u52A1"}\u7684\u4E00\u6B21\u8BF7\u6C42\u88AB\u6682\u7F13`)} \xB7 ${it(pe(e,"reason"),160)}`,"warn",{rule:!0})}case"round.reviewer_backend_failure":{let i=it(pe(e,"text"),150),s=t.density==="full"?Be(t,"the Reviewer's model service is unreachable \u2014 waiting rather than going on unchecked","\u5BA1\u9605\u8005\u7684\u6A21\u578B\u670D\u52A1\u8FDE\u4E0D\u4E0A \u2014 \u5148\u7B49\u5F85\uFF0C\u4E0D\u5728\u65E0\u4EBA\u5BA1\u9605\u7684\u60C5\u51B5\u4E0B\u7EE7\u7EED"):Be(t,"the Reviewer's model service is unreachable \u2014 waiting","\u5BA1\u9605\u8005\u7684\u6A21\u578B\u670D\u52A1\u8FDE\u4E0D\u4E0A \u2014 \u5148\u7B49\u5F85");return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",`${s} \xB7 ${i}`,"err",{rule:!0})}case"round.stall":return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",it(pe(e,"text")||Be(t,t.density==="full"?"no progress this round \u2014 keeping a close eye on it":"no progress this round","\u8FD9\u4E00\u8F6E\u6CA1\u6709\u8FDB\u5C55"),170),"warn");case"round.escalated":return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",it(pe(e,"text")||Be(t,"many rounds without a finish \u2014 raising what is blocking the work","\u8F6E\u6B21\u5DF2\u7ECF\u5F88\u591A\u8FD8\u6CA1\u505A\u5B8C \u2014 \u628A\u5916\u90E8\u963B\u788D\u63D0\u51FA\u6765"),170),"warn");case"life.planner.stall_escalation":return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",`${Be(t,"the Planner is stuck","\u89C4\u5212\u8005\u5361\u4F4F\u4E86")} \u2014 ${it(pe(e,"reason")||pe(e,"text"),150)}`,"warn");case"life.budget.pause":return pe(e,"stop_kind")==="cost_unreconciled"||pe(e,"reason").startsWith("unresolved provider cost")?we("system","event.budget","$",Be(t,"Provider usage awaits reconciliation \u2014 not budget exhaustion","\u8C03\u7528\u8D39\u7528\u5F85\u5BF9\u8D26 \u2014 \u5E76\u975E\u9884\u7B97\u8017\u5C3D"),"warn"):we("system","event.watch","\u23F8",Be(t,`budget cap reached \u2014 paused \xB7 ${it(pe(e,"text")||pe(e,"reason"),140)}`,`\u5DF2\u8FBE\u5230\u9884\u7B97\u4E0A\u9650 \u2014 \u5DF2\u6682\u505C \xB7 ${it(pe(e,"text")||pe(e,"reason"),140)}`),"warn");case"budget.reservation.denied":return pe(e,"reason").startsWith("unresolved provider cost")?we("system","event.budget","$",Be(t,"Provider usage awaits reconciliation \u2014 not budget exhaustion","\u8C03\u7528\u8D39\u7528\u5F85\u5BF9\u8D26 \u2014 \u5E76\u975E\u9884\u7B97\u8017\u5C3D"),"warn"):we("system","event.budget","$",`${Be(t,"budget denied","\u9884\u7B97\u7533\u8BF7\u88AB\u62D2\u7EDD")} \u2014 ${it(pe(e,"reason")||pe(e,"text"),t.density==="full"?160:150)}`,"err",{rule:!0});case"budget.unpriced.blocked":return we("system","event.budget","$",Be(t,"Provider usage awaits reconciliation \u2014 not budget exhaustion","\u8C03\u7528\u8D39\u7528\u5F85\u5BF9\u8D26 \u2014 \u5E76\u975E\u9884\u7B97\u8017\u5C3D"),"warn");case"budget.unpriced.acknowledged":return we("system","event.budget","$",Be(t,"Single-call cost risk approved; original usage remains pending","\u5DF2\u6279\u51C6\u5355\u7B14\u8D39\u7528\u98CE\u9669\uFF1B\u539F\u59CB\u8D39\u7528\u4ECD\u5F85\u5BF9\u8D26"),"warn");case"life.lifecycle.block":return we("system","event.watch","\u26D4",`${Be(t,"blocked \u2014 needs you","\u5361\u4F4F\u4E86 \u2014 \u9700\u8981\u4F60\u6765\u5904\u7406")} \xB7 ${it(pe(e,"text")||pe(e,"reason"),150)}`,"err",{rule:!0});case"life.daemon.idle_timeout":return we("system","event.watch","\u{1F7E6}",it(pe(e,"text")||Be(t,"nothing to do for a while \u2014 standing by","\u4E00\u6BB5\u65F6\u95F4\u6CA1\u6709\u4E8B\u505A \u2014 \u5F85\u547D\u4E2D"),150),"dim");case"operator_alert":return we("system","event.notice",t.density==="full"?"\u{1F441}":"!",it(pe(e,"text")||pe(e,"reason")||e.type,170),"err",{rule:!0});case"life.supervisor.error":return we("system","role.system","\u26A0",`${Be(t,"Argus hit an internal error while coordinating the work","Argus \u5728\u7EDF\u7B79\u5DE5\u4F5C\u65F6\u9047\u5230\u5185\u90E8\u9519\u8BEF")} \xB7 ${it(pe(e,"error"),160)}`,"err",{rule:!0});case"life.auth_failure":return we("system","role.system","\u{1F511}",Be(t,"the model service rejected the sign-in \u2014 refresh the credentials and Argus will carry on","\u6A21\u578B\u670D\u52A1\u62D2\u7EDD\u4E86\u767B\u5F55 \u2014 \u66F4\u65B0\u51ED\u636E\u540E Argus \u4F1A\u7EE7\u7EED"),"err",{rule:!0});case"life.planner.deferred":return we("planner","role.planner","\u231B",`${Be(t,"planning is on hold","\u89C4\u5212\u6682\u7F13")} \xB7 ${it(pe(e,"reason"),180)}`,"dim");case"life.post_mission.stop":return we("system","role.system","\u25A0",`${Be(t,"stopped after this task","\u8FD9\u9879\u4EFB\u52A1\u4E4B\u540E\u505C\u4E0B")} \xB7 ${it(pe(e,"reason"),180)}`,"info");case"life.planner.final_submission_skipped":return we("planner","role.planner","\u23ED",`${Be(t,"dropped an outdated final-submission task","\u8DF3\u8FC7\u4E86\u4E00\u9879\u8FC7\u65F6\u7684\u6700\u7EC8\u63D0\u4EA4\u4EFB\u52A1")} \xB7 ${it(pe(e,"title"),140)}`,"dim");case"life.execution_host.blocked":return we("system","event.watch","\u26D4",it(pe(e,"reason")||Be(t,"the program that runs code for Argus could not be started","\u4E3A Argus \u8FD0\u884C\u4EE3\u7801\u7684\u7A0B\u5E8F\u65E0\u6CD5\u542F\u52A8"),t.density==="full"?260:180),"err",{rule:!0});case"life.mission.provider_configuration_disabled":{let i=Number(lr(e).streak||0),s=Be(t,`the model configuration failed ${Xu(i,"time")} in a row \u2014 this task is paused until you decide`,`\u6A21\u578B\u914D\u7F6E\u8FDE\u7EED ${i} \u6B21\u5931\u8D25 \u2014 \u8FD9\u9879\u4EFB\u52A1\u5DF2\u6682\u505C\uFF0C\u7B49\u5F85\u4F60\u7684\u51B3\u5B9A`),a=it(pe(e,"text"),160);return we("system","event.watch","\u26D4",a?`${s} \xB7 ${a}`:s,"err",{rule:!0})}case"life.iteration.continued":return we("critic","role.critic","\u{1F501}",Be(t,"lined up the next iteration","\u6392\u597D\u4E86\u4E0B\u4E00\u8F6E\u8FED\u4EE3"),"dim");case"life.learned_vertical.promoted":return we("manager","role.manager","\u2605",Be(t,`made the learned domain "${pe(e,"vertical")}" official`,`\u628A\u65B0\u5B66\u5230\u7684\u9886\u57DF\u300C${pe(e,"vertical")}\u300D\u6B63\u5F0F\u6536\u5F55`),"accent");case"life.learned_vertical.promotion_failed":return we("manager","role.manager","\u26A0",`${Be(t,`could not record "${pe(e,"vertical")}" as a formal domain`,`\u672A\u80FD\u628A\u300C${pe(e,"vertical")}\u300D\u6536\u5F55\u4E3A\u6B63\u5F0F\u9886\u57DF`)} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"life.review.waived":return we("planner","role.planner","\u21AA",`${Be(t,"this task will skip the independent review","\u8FD9\u9879\u4EFB\u52A1\u5C06\u4E0D\u505A\u72EC\u7ACB\u5BA1\u9605")} \xB7 ${it(pe(e,"reason"),160)}`,"dim");case"life.manager.feedback.exhausted":{let i=Number(lr(e).attempts||0);return we("manager","role.manager","\u26A0",`${Be(t,`the Manager's objection went unanswered ${Xu(i,"time")} \u2014 planning pauses for a while`,`\u7BA1\u7406\u8005\u7684\u5F02\u8BAE ${i} \u6B21\u672A\u88AB\u56DE\u5E94 \u2014 \u89C4\u5212\u6682\u505C\u4E00\u6BB5\u65F6\u95F4`)} \xB7 ${it(pe(e,"reason"),140)}`,"warn")}case"life.manager.feedback.persisted":{let i=pe(e,"stage"),s=i?Be(t,`sent the plan back for another pass at ${i}`,`\u628A\u8BA1\u5212\u9000\u56DE ${i} \u9636\u6BB5\u518D\u6539\u4E00\u8F6E`):Be(t,"sent the plan back for another pass","\u628A\u8BA1\u5212\u9000\u56DE\u518D\u6539\u4E00\u8F6E");return we("manager","role.manager","\u21A9",`${s} \xB7 ${it(pe(e,"reason"),160)}`,"info")}case"life.manager.goal_contract.failed":return we("manager","role.manager","\u26A0",`${Be(t,"could not save the agreed goal","\u672A\u80FD\u4FDD\u5B58\u5546\u5B9A\u7684\u76EE\u6807")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"life.manager.intent.superseded":return we("manager","role.manager","\u21B7",Be(t,"a newer instruction replaced this request","\u66F4\u65B0\u7684\u6307\u4EE4\u53D6\u4EE3\u4E86\u8FD9\u4E2A\u8BF7\u6C42"),"info");case"life.manager.project_report.failed":return we("manager","role.manager","\u26A0",`${Be(t,"could not deliver the project report","\u672A\u80FD\u9001\u51FA\u9879\u76EE\u62A5\u544A")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"life.planner.completion_circuit_opened":{let i=Number(lr(e).consecutive_rejections||0);return we("planner","role.planner","\u23F8",Be(t,`the same completion requirement turned the plan back ${Xu(i,"time")} \u2014 pausing completion attempts until something changes`,`\u540C\u4E00\u9879\u5B8C\u6210\u8981\u6C42\u5DF2 ${i} \u6B21\u6253\u56DE\u8BA1\u5212 \u2014 \u6682\u505C\u5B8C\u6210\u5C1D\u8BD5\uFF0C\u76F4\u5230\u60C5\u51B5\u53D8\u5316`),"warn")}case"life.planner.completion_rejected":return we("manager","role.manager","\u21A9",`${Be(t,"the Manager did not accept the completion claim","\u7BA1\u7406\u8005\u672A\u63A5\u53D7\u5B8C\u6210\u7684\u8BF4\u6CD5")} \xB7 ${it(pe(e,"reason"),160)}`,"info");case"life.planner.continuation_required":return we("planner","role.planner","\u21BB",Be(t,"finished one increment; the standing objective continues","\u5B8C\u6210\u4E86\u4E00\u4E2A\u589E\u91CF\uFF1B\u957F\u671F\u76EE\u6807\u7EE7\u7EED\u63A8\u8FDB"),"dim");case"life.planner.superseded":return we("planner","role.planner","\u21B7",Be(t,"dropped an outdated planning pass after a newer instruction","\u6536\u5230\u66F4\u65B0\u7684\u6307\u4EE4\uFF0C\u653E\u5F03\u4E86\u8FC7\u65F6\u7684\u89C4\u5212"),"dim");case"life.planner.wait_overridden":return we("planner","role.planner","\uFF0B",`${Be(t,"scheduled independent work instead of waiting","\u4E0D\u518D\u5E72\u7B49\uFF0C\u5B89\u6392\u4E86\u72EC\u7ACB\u7684\u5DE5\u4F5C")} \xB7 ${it(pe(e,"task_title"),140)}`,"info");case"life.daemon.degraded":return we("system","role.system","\u26A0",`${Be(t,"Argus started, but the objective did not reach the Manager","Argus \u5DF2\u542F\u52A8\uFF0C\u4F46\u76EE\u6807\u6CA1\u6709\u4EA4\u5230\u7BA1\u7406\u8005\u624B\u4E0A")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"round.orphan_process_group":{let i=lr(e).cleanup_succeeded===!0;return we("engineer","role.engineer","\u26A0",i?Be(t,"background processes outlived the turn and were cleaned up","\u6709\u540E\u53F0\u8FDB\u7A0B\u5728\u8FD9\u4E00\u8F6E\u7ED3\u675F\u540E\u4ECD\u5728\u8FD0\u884C\uFF0C\u5DF2\u6E05\u7406"):Be(t,"background processes outlived the turn and could not be cleaned up","\u6709\u540E\u53F0\u8FDB\u7A0B\u5728\u8FD9\u4E00\u8F6E\u7ED3\u675F\u540E\u4ECD\u5728\u8FD0\u884C\uFF0C\u672A\u80FD\u6E05\u7406"),"warn")}case"round.model_configuration_error":return we("engineer","role.engineer","\u26D4",`${Be(t,"the model configuration is not usable","\u6A21\u578B\u914D\u7F6E\u65E0\u6CD5\u4F7F\u7528")} \xB7 ${it(pe(e,"text")||pe(e,"error"),160)}`,"err",{rule:!0});case"round.watchdog.retry":{let i=Number(lr(e).attempt||0),s=Number(lr(e).max_attempts||0);return we("engineer","role.engineer","\u21BB",Be(t,`the model call failed \u2014 retrying in a fresh session (attempt ${i} of ${s})`,`\u6A21\u578B\u8C03\u7528\u5931\u8D25 \u2014 \u5728\u65B0\u4F1A\u8BDD\u4E2D\u91CD\u8BD5\uFF08\u7B2C ${i} \u6B21\uFF0C\u5171 ${s} \u6B21\uFF09`),"warn")}case"round.watchdog.retry_exhausted":{let i=Number(lr(e).attempt||0),s=it(pe(e,"fatal_error"),140),a=Be(t,`the model call kept failing \u2014 giving up after ${Xu(i,"attempt")}`,`\u6A21\u578B\u8C03\u7528\u6301\u7EED\u5931\u8D25 \u2014 ${i} \u6B21\u540E\u653E\u5F03`);return we("engineer","role.engineer","\u26D4",s?`${a} \xB7 ${s}`:a,"err",{rule:!0})}case"round.backend_failure.backoff":{let i=Math.round(Number(lr(e).seconds||0));return we("engineer","role.engineer","\u23F3",it(pe(e,"text")||Be(t,`the model service failed \u2014 waiting ${i}s before trying again`,`\u6A21\u578B\u670D\u52A1\u51FA\u9519 \u2014 \u7B49\u5F85 ${i} \u79D2\u540E\u518D\u8BD5`),200),"warn")}case"round.backend_failure.hold_interrupted":return we("engineer","role.engineer","\u21AA",it(pe(e,"text")||Be(t,"the wait after a model-service failure ended early","\u6A21\u578B\u670D\u52A1\u51FA\u9519\u540E\u7684\u7B49\u5F85\u63D0\u524D\u7ED3\u675F"),180),"info");case"round.provider_turn_cap.restart":return we("engineer","role.engineer","\u21BB",Be(t,"reached the per-call turn allowance \u2014 continuing the same task in a fresh session","\u8FBE\u5230\u5355\u6B21\u8C03\u7528\u7684\u8F6E\u6B21\u4E0A\u9650 \u2014 \u5728\u65B0\u4F1A\u8BDD\u4E2D\u7EE7\u7EED\u540C\u4E00\u4EFB\u52A1"),"info");case"round.provider_turn_cap.reviewer_restart":return we("reviewer","role.reviewer","\u21BB",Be(t,"the review reached its turn allowance \u2014 restarting it in a fresh session","\u5BA1\u9605\u8FBE\u5230\u8F6E\u6B21\u4E0A\u9650 \u2014 \u5728\u65B0\u4F1A\u8BDD\u4E2D\u91CD\u65B0\u5F00\u59CB"),"info");case"round.reviewer_backend_failure.backoff":{let i=Math.round(Number(lr(e).seconds||0)),s=it(pe(e,"text"),200);return we("reviewer","role.reviewer","\u23F3",s||Be(t,`the Reviewer's model service is unavailable \u2014 retrying in ${i}s`,`\u5BA1\u9605\u8005\u7684\u6A21\u578B\u670D\u52A1\u4E0D\u53EF\u7528 \u2014 ${i} \u79D2\u540E\u91CD\u8BD5`),"warn")}case"round.external_work_wait.started":return we("engineer","role.engineer","\u231B",`${Be(t,"waiting for background work to report","\u7B49\u5F85\u540E\u53F0\u5DE5\u4F5C\u6C47\u62A5")} \xB7 ${it(pe(e,"work_id"),80)}`,"dim");case"round.external_work_wait.completed":return we("engineer","role.engineer","\u21BB",Be(t,"background work reported \u2014 resuming","\u540E\u53F0\u5DE5\u4F5C\u5DF2\u6C47\u62A5 \u2014 \u7EE7\u7EED"),"dim");case"round.external_work_review.required":return we("reviewer","role.reviewer","\u231B",`${Be(t,"background work finished \u2014 an independent review of its result is required before resuming","\u540E\u53F0\u5DE5\u4F5C\u5DF2\u7ED3\u675F \u2014 \u6062\u590D\u524D\u9700\u8981\u5BF9\u5176\u7ED3\u679C\u505A\u4E00\u6B21\u72EC\u7ACB\u5BA1\u9605")} \xB7 ${it(pe(e,"work_id"),80)}`,"dim");case"round.external_work_review.completed":return we("reviewer","role.reviewer","\u2713",`${Be(t,"background work result reviewed","\u540E\u53F0\u5DE5\u4F5C\u7ED3\u679C\u5DF2\u5BA1\u9605")} \xB7 ${it(pe(e,"review_status"),40)}`,"dim");case"plan.draft.failed":return we("planner","role.planner","\u26A0",`${Be(t,"could not draft the plan","\u672A\u80FD\u8D77\u8349\u8BA1\u5212")} \xB7 ${it(pe(e,"reason"),140)}`,"err");case"plan.draft.done":{let i=Number(lr(e).steps||0);return we("planner","role.planner","\u{1F4CB}",Be(t,`drafted a plan with ${Xu(i,"step")}`,`\u8D77\u8349\u4E86\u4E00\u4EFD ${i} \u6B65\u7684\u8BA1\u5212`),"dim")}case"team.learning.review.started":return we("manager","role.manager","\u{1F4DA}",Be(t,"reviewing what this task taught the team","\u6574\u7406\u8FD9\u9879\u4EFB\u52A1\u7ED9\u56E2\u961F\u5E26\u6765\u7684\u7ECF\u9A8C"),"dim");case"team.learning.review.failed":return we("manager","role.manager","\u26A0",`${Be(t,"the team learning review failed","\u56E2\u961F\u7ECF\u9A8C\u6574\u7406\u5931\u8D25")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"team.learning.review.completed":{let i=Number(lr(e).created||0),s=Number(lr(e).updated||0);return we("manager","role.manager","\u{1F4DA}",Be(t,`kept ${i} new and ${s} updated team procedures`,`\u4FDD\u7559\u4E86 ${i} \u6761\u65B0\u7684\u3001${s} \u6761\u66F4\u65B0\u7684\u56E2\u961F\u505A\u6CD5`),"dim")}case"team.learning.promotion.quarantined":return we("manager","role.manager","\u26A0",Be(t,"set aside a new procedure that would have judged its own work","\u6401\u7F6E\u4E86\u4E00\u6761\u4F1A\u8BC4\u5224\u81EA\u5DF1\u5DE5\u4F5C\u7684\u65B0\u505A\u6CD5"),"warn");case"self.learning.review.failed":return we("system","role.system","\u26A0",`${Be(t,"the review of Argus's own conversation habits failed","\u5BF9 Argus \u81EA\u8EAB\u5BF9\u8BDD\u4E60\u60EF\u7684\u590D\u76D8\u5931\u8D25")} \xB7 ${it(pe(e,"error"),140)}`,"warn");case"domain.promotion":return we("manager","role.manager","\u2605",it(pe(e,"text"),180),"dim");case"idea.portfolio.formed":{let i=lr(e).selection,s=i&&typeof i=="object"?String(i.route_id??""):"",a=Number(lr(e).route_count||0),u=it(pe(e,"text"),180),p=a>0?Be(t,`formed an idea portfolio of ${Xu(a,"route")}`,`\u7EC4\u6210\u4E86 ${a} \u6761\u601D\u8DEF\u7684\u7EC4\u5408`):Be(t,"formed an idea portfolio","\u7EC4\u6210\u4E86\u601D\u8DEF\u7EC4\u5408");return we("engineer","role.engineer","\u{1F4A1}",s?Be(t,`chose route ${s} from the idea portfolio`,`\u4ECE\u601D\u8DEF\u7EC4\u5408\u4E2D\u9009\u5B9A\u4E86\u8DEF\u7EBF ${s}`):u||p,"accent")}case"user.note":{let i=Array.isArray(lr(e).tags)?lr(e).tags.map(String):[];if(i.includes("config"))return Fo();if(i.includes("planner"))return we("planner","role.planner","\u{1F4DD}",Be(t,"updated the research plan","\u66F4\u65B0\u4E86\u7814\u7A76\u8BA1\u5212"),"dim");let s=it(pe(e,"summary")||pe(e,"text")||pe(e,"title"),180);return we("system","role.operator","\u{1F4DD}",`${Be(t,"you added a note","\u4F60\u6DFB\u52A0\u4E86\u4E00\u6761\u7B14\u8BB0")}${s?` \xB7 ${s}`:""}`,"accent")}case"ui.operator":{let i=pe(e,"text");return i.trim()?we("system","role.operator","\u203A",i,"accent",{rule:!0}):Fo()}case"ui.argus":{let i=pe(e,"text"),s=lr(e).live===!0||Array.isArray(lr(e).steps)&&lr(e).steps.length>0;return i.trim()||s?we("manager","role.argus","\u258C",i,"bright",{expandable:t.density==="full",rule:!0}):Fo()}case"agent.io.start":case"agent.io.stream":case"agent.io.complete":case"agent.io.error":case"usage.recorded":case"provider.request.started":case"provider.request.completed":case"codex.util.completed":case"skill.cost.completed":case"budget.reservation.created":case"budget.reservation.settled":case"budget.reservation.released":case"round.checkpoint.recorded":case"round.checkpoint.failed":case"round.secret_redacted":case"role.session.turn":case"engineer.skill_maintenance.completed":case"life.status":case"life.mission.skipped":case"life.mission.orphaned":case"life.mission.requeued":case"life.manager.plan_challenge.decided":case"life.vertical.resolved":case"life.manager.backend_resolved":case"life.planner.backend_resolved":case"life.planner.dependency_dropped":case"life.planner.parallel_dropped":case"life.engineer.backend_resolved":case"life.reviewer.backend_resolved":case"life.curator.backend_resolved":case"life.runtime_failure.circuit_opened":case"life.runtime_failure.circuit_blocked":case"life.runtime_failure.canary_passed":case"life.runtime.incident.detected":case"life.runtime.incident.recovered":case"life.runtime.incident.escalated":case"life.plan.revision.proposed":case"life.plan.revision.rejected":case"life.plan.revision.committed":case"life.plan.node.superseded":case"life.lifecycle.transition":case"life.inbox.drained":case"life.operator_question.pending":case"life.operator_question.answered":case"project.completed":case"project.completion_refused":case"daemon.command.submitted":case"daemon.command.completed":case"daemon.command.rejected":case"idea.search.started":case"idea.search.completed":case"idea.search.skipped":case"venue.research.started":case"venue.research.completed":case"research.achievement.certified":case"skill.library.available":case"skill.created":case"skill.updated":case"skill.archived":case"skill.tidied":case"skill.history.compressed":case"skill.evolution.completed":case"wiki.initialized":case"wiki.hook.warning":case"wiki.created":case"wiki.updated":case"wiki.retired":case"wiki.promotion.promoted":case"wiki.promotion.demoted":case"wiki.retired.compressed":case"wiki.evolution.completed":case"knowledge.learned":case"knowledge.recalled":case"life.planner.verdict.discarded":case"life.manager.feedback.unresolved":case"life.manager.project_report":case"life.plan.revision.rolled_back":case"life.planner.completion_circuit.notify_failed":case"life.planner.completion_circuit_holding":case"life.planner.external_poll_suppressed":case"life.planner.waiting_contract.normalized":case"life.daemon.ready":case"plan.draft.start":case"team.learning.review.skipped":case"self.learning.review.started":case"self.learning.review.completed":case"manager.live_view.updated":case"manager.live_view.rejected":case"idea.portfolio.nested_skipped":case"manager.turn.started":case"manager.turn.cancelled":case"life.config.parse_failed":return LI(e,t);default:return LI(e,t)}}function MI(e){return e.segments.map(t=>t.text).join("")}var $F={"role.manager":["Manager","Manager"],"role.planner":["Planner","Planner"],"role.engineer":["Engineer","Engineer"],"role.reviewer":["Reviewer","Reviewer"],"role.advisor":["Advisor","\u987E\u95EE"],"role.peer":["Project exchange","\u9879\u76EE\u4EA4\u6D41"],"role.critic":["Critic","Critic"],"role.system":["Argus","Argus"],"role.argus":["Argus","Argus"],"role.operator":["You","\u4F60"],"event.notice":["Notice","\u901A\u77E5"],"event.watch":["Watch","\u76D1\u63A7"],"event.budget":["Budget","\u9884\u7B97"],"event.quota":["Quota","\u989D\u5EA6"],"event.fallback":["Argus","Argus"],"event.hidden":["",""]};function PI(e,t){let r=$F[e];if(r)return t==="zh-CN"?r[1]:r[0];let i=e.startsWith("role.")?e.slice(5):e;return i?`${i.slice(0,1).toUpperCase()}${i.slice(1)}`:""}function _0(e,t){let r=Bp(e,t);if(r.visibility==="hidden")return null;let i=MI(r);return!i&&!(e.type==="ui.argus"&&(e.live===!0||Array.isArray(e.steps)&&e.steps.length>0))?null:{role:r.role,labelKey:r.labelKey,label:PI(r.labelKey,t.locale),glyph:r.glyph,text:i,tone:r.tone,rule:r.rule,reasoning:r.reasoning,expand:r.expandable,sensitive:r.sensitive}}function qF(e,t){let r={done:["the Reviewer was satisfied","\u5BA1\u9605\u8005\u8BA4\u53EF\u4E86\u8FD9\u4E00\u8F6E"],blocked:["the Reviewer found the work stuck","\u5BA1\u9605\u8005\u8BA4\u4E3A\u5DE5\u4F5C\u5361\u4F4F\u4E86"],no_progress:["the Reviewer saw no progress","\u5BA1\u9605\u8005\u6CA1\u6709\u770B\u5230\u8FDB\u5C55"]};if(!e)return Be(t,"the Reviewer gave no verdict","\u5BA1\u9605\u8005\u6CA1\u6709\u7ED9\u51FA\u7ED3\u8BBA");let i=r[e]??["the Reviewer asked for another pass","\u5BA1\u9605\u8005\u8981\u6C42\u518D\u6539\u4E00\u8F6E"];return Be(t,i[0],i[1])}var Yf={manager:"Manager",planner:"Planner",engineer:"Engineer",reviewer:"Reviewer",critic:"Critic",system:"Argus"};function Dp(e){switch(e){case"bright":return"white";case"dim":return"gray";case"accent":return me.accent;case"ok":return me.success;case"warn":return me.warning;case"err":return me.error;case"info":return me.info}}function yp(e){return me.role[e]??"gray"}function vr(e,t){let r=(e||"").replace(/```[a-z]*\n?/gi,"").replace(/\[([^\]]+)\]\([^)]+\)/g,"[$1]").trim();return r.length<=t?r:r.slice(0,t-1).trimEnd()+"\u2026"}var Ve=(e,t)=>String(e[t]??"");function zF(e){let t=Ve(e,"phase"),r=Ve(e,"cause")||Ve(e,"backend_error"),i=Ve(e,"error");if(!t||!r)return`\u6CA1\u80FD\u5224\u65AD\u8FD9\u4E2A\u8BF7\u6C42\u8BE5\u5F52\u8C01 ${vr(i,160)}`;let s={backend:"\u6A21\u578B\u670D\u52A1",parse:"\u8BFB\u53D6\u56DE\u7B54",contract:"\u56DE\u7B54\u683C\u5F0F\uFF1A",timeout:"\u8D85\u65F6"},a=Number(e.attempts||0),u=a>1?` (\u7B2C${a}\u6B21\u5C1D\u8BD5)`:"",p=`\u6CA1\u80FD\u5224\u65AD\u8FD9\u4E2A\u8BF7\u6C42\u8BE5\u5F52\u8C01 \xB7 ${s[t]||t} ${r}${u}`;return i?`${p} \xB7 \u539F\u59CB\u9519\u8BEF: ${i}`:p}var UI=e=>{let t=e,r=t.round_index??t.round;return typeof r=="string"||typeof r=="number"?r:"?"};function S0(e){let t=Ve(e,"type");if(t==="engineer.progress"){let i=Ve(e,"kind"),s=Ve(e,"agent_layer")||"engineer",a=Yf[s]||"Engineer";if(i==="reasoning"){let u=vr(Ve(e,"text"),280);return u?{role:s,label:a,glyph:"\u2234",text:u,tone:"dim",reasoning:!0}:null}if(i==="assistant_message"||i==="agent_message"||i==="message"){if(Vu(e))return null;let u=$u(Ve(e,"text"));return u?{role:s,label:a,glyph:"\u258C",text:u,tone:"bright",expand:!0}:null}if(i==="command_execution"){let u=Ve(e,"text")||Ve(e,"command")||Ve(e,"action_summary");return u?{role:s,label:a,glyph:"\u25B8 $",text:u,tone:Ve(e,"status")==="failed"?"err":"dim",expand:!0}:null}if(i==="tool_use"||i==="file_change"){let u=Ve(e,"text")||Ve(e,"action_summary");return u?{role:s,label:a,glyph:i==="file_change"?"\u270E":"\u2699",text:u,tone:Ve(e,"status")==="failed"?"err":"dim",expand:!0}:null}return null}if(t==="role.activity"){let i=Ve(e,"status");if(i==="running")return null;let s=Ve(e,"role")||"engineer",a=e.milestone===!0;return i!=="error"&&!a?null:{role:s,label:Yf[s]||s,glyph:i==="error"?"\u2715":"\u2713",text:vr(Ve(e,"label")||"activity completed",180),tone:i==="error"?"err":"ok"}}if(t==="life.manager.intent.started")return{role:"manager",label:"Manager",glyph:"\u{1F9ED}",text:"\u5224\u65AD\u8FD9\u662F\u4EC0\u4E48\u6837\u7684\u8BF7\u6C42\u2026",tone:"info"};if(t==="life.manager.intent.completed")return{role:"manager",label:"Manager",glyph:"\u{1F9ED}",text:`\u2192 ${hp({route:Ve(e,"route")||"team",vertical:Ve(e,"vertical"),workflow_mode:Ve(e,"workflow_mode"),lifetime:Ve(e,"lifetime"),continuous:e.continuous===!0,open_ended:e.open_ended===!0})||Ve(e,"kind")||"resolved"}`,tone:"info"};if(t==="life.manager.intent.failed")return{role:"manager",label:"Manager",glyph:"\u26A0",text:zF(e),tone:"err",expand:!0};if(t==="life.manager.stage_decision"){let i=Ve(e,"target_stage")||Ve(e,"stage")||Ve(e,"current_stage");return{role:"manager",label:"Manager",glyph:"\u{1F9ED}",text:`${Ve(e,"action")}${i?` \u2192 ${i}`:""} ${vr(Ve(e,"reason"),140)}`,tone:"info"}}if(t==="life.research.second_reading"){let i=Ve(e,"agent_layer")||"manager",s=vr(Ve(e,"supported"),160),a="reread the evidence and reworked the plan";return{role:i,label:Yf[i]||i,glyph:"\u{1F4D6}",text:s?`${a} \xB7 ${s}`:a,tone:"info"}}if(t==="life.letter.written"){let i=Ve(e,"agent_layer")||"manager";return{role:i,label:Yf[i]||i,glyph:"\u2709",text:"wrote you a letter",tone:"accent"}}if(t==="life.planner.start")return{role:"planner",label:"Planner",glyph:"\u{1F4CB}",text:`planning ${vr(Ve(e,"objective"),160)}`,tone:"accent"};if(t==="life.planner.verdict")return Ve(e,"status")==="done"||e.project_done===!0?{role:"planner",label:"Planner",glyph:"\u{1F3C1}",text:"the project is finished",tone:"ok"}:{role:"planner",label:"Planner",glyph:"\u{1F4CB}",text:`lined up ${Ve(e,"queued")||Ve(e,"n")||"next"} task(s) to do next`,tone:"accent"};if(t==="life.planner.task_added")return{role:"planner",label:"Planner",glyph:"\uFF0B",text:`added a task \xB7 ${vr(Ve(e,"title")||Ve(e,"objective"),160)}`,tone:"accent"};if(t==="life.planner.task_skipped")return{role:"planner",label:"Planner",glyph:"\u23ED",text:`skipped a task already planned ${vr(Ve(e,"title"),140)}`,tone:"dim"};if(t==="life.planner.error")return{role:"planner",label:"Planner",glyph:"\u26A0",text:`the Planner hit an error ${vr(Ve(e,"error")||Ve(e,"text"),160)}`,tone:"err"};if(t==="life.mission.started"||t==="mission.started")return{role:"engineer",label:"Engineer",glyph:"\u{1F680}",text:vr(Ve(e,"title")||Ve(e,"objective")||Ve(e,"text")||"started work on this task",180),tone:"info",rule:!0};if(t==="round.started"||t==="round.start")return{role:"engineer",label:"Engineer",glyph:"\u2500\u2500",text:`round ${UI(e)}`,tone:"dim",rule:!0};if(t==="life.phase.started"){let i=Ve(e,"label")||Ve(e,"phase");if(!i)return null;let s=Ve(e,"agent_layer")||"engineer";return{role:s,label:Yf[s]||s,glyph:"\u{1F504}",text:`\u8FDB\u5165 ${i}`,tone:"info"}}if(t==="round.review.started")return{role:"reviewer",label:"Reviewer",glyph:"\u{1F504}",text:`the Reviewer checks round ${UI(e)}`,tone:"info"};if(t==="round.review.deferred")return{role:"engineer",label:"Engineer",glyph:"\u21AA",text:`carries on into the next round without a review \xB7 ${vr(Ve(e,"next_step"),180)}`,tone:"info"};if(t==="round.main.completed")return{role:"engineer",label:"Engineer",glyph:"\u2705",text:`finished round ${UI(e)} of work`,tone:"info"};if(t==="round.review.completed"){if(e.review_skipped===!0)return{role:"reviewer",label:"Reviewer",glyph:"\u21AA",text:`no review this round \xB7 ${vr(Ve(e,"reason"),200)}`,tone:"info"};let i=Ve(e,"status"),s=i==="done"?"ok":i==="blocked"||i==="no_progress"?"err":"warn";return{role:"reviewer",label:"Reviewer",glyph:i==="done"?"\u2705":i==="blocked"||i==="no_progress"?"\u26D4":"\u21BB",text:`${ek(i)} \xB7 ${vr(Ve(e,"reason"),200)}`,tone:s}}if(t==="life.mission.completed"||t==="mission.completed"||t==="loop.completed"){let i=pl(e),s=vr(Ve(e,"summary"),240);return{role:"engineer",label:"Engineer",glyph:i.glyph,text:s?`${i.label} \xB7 ${s}`:i.label,tone:i.tone,rule:!0}}if(t==="life.mission.failed"||t==="mission.error")return{role:"engineer",label:"Engineer",glyph:"\u274C",text:`this task failed ${vr(Ve(e,"reason")||Ve(e,"error"),160)}`,tone:"err",rule:!0};if(t==="loop.start")return{role:"engineer",label:"Engineer",glyph:"\u25B6",text:vr(Ve(e,"text")||Ve(e,"objective"),16e3),tone:"info",expand:!0};if(t==="loop.done")return{role:"engineer",label:"Engineer",glyph:"\u{1F3C1}",text:`the run finished ${vr(Ve(e,"text"),140)}`,tone:"dim"};if(t==="life.inbox.queued")return{role:"system",label:"You",glyph:"\u{1F4E5}",text:`you added guidance \xB7 ${vr(Ve(e,"text"),180)}`,tone:"accent"};if(t==="daemon.parked")return{role:"system",label:"Argus",glyph:"\u2161",text:`Argus set this project aside with its state saved${Ve(e,"replaced_by")?` \xB7 continued as ${Ve(e,"replaced_by")}`:""}`,tone:"warn",rule:!0};if(t==="provider.request.denied")return{role:"system",label:"Quota",glyph:"\u23F8",text:`a request to ${Ve(e,"provider")||"the model service"} was held back \xB7 ${vr(Ve(e,"reason"),160)}`,tone:"warn",rule:!0};if(t==="round.reviewer_backend_failure")return{role:"system",label:"Watch",glyph:"\u{1F441}",text:`the Reviewer's model service is unreachable \u2014 waiting rather than going on unchecked \xB7 ${vr(Ve(e,"text"),150)}`,tone:"err",rule:!0};if(t==="round.stall")return{role:"system",label:"Watch",glyph:"\u{1F441}",text:vr(Ve(e,"text")||"no progress this round \u2014 keeping a close eye on it",170),tone:"warn"};if(t==="round.escalated")return{role:"system",label:"Watch",glyph:"\u{1F441}",text:vr(Ve(e,"text")||"many rounds without a finish \u2014 raising what is blocking the work",170),tone:"warn"};if(t==="life.planner.stall_escalation")return{role:"system",label:"Watch",glyph:"\u{1F441}",text:`the Planner is stuck \u2014 ${vr(Ve(e,"reason")||Ve(e,"text"),150)}`,tone:"warn"};if((t==="life.budget.pause"||t==="budget.reservation.denied")&&(Ve(e,"stop_kind")==="cost_unreconciled"||Ve(e,"reason").startsWith("unresolved provider cost")))return{role:"system",label:"Budget",glyph:"$",text:"Provider usage awaits reconciliation \u2014 not budget exhaustion",tone:"warn"};if(t==="life.budget.pause")return{role:"system",label:"Watch",glyph:"\u23F8",text:`budget cap reached \u2014 paused \xB7 ${vr(Ve(e,"text")||Ve(e,"reason"),140)}`,tone:"warn"};if(t==="budget.reservation.denied")return{role:"system",label:"Budget",glyph:"$",text:`budget denied \u2014 ${vr(Ve(e,"reason")||Ve(e,"text"),160)}`,tone:"err",rule:!0};if(t==="budget.unpriced.blocked")return{role:"system",label:"Budget",glyph:"$",text:"Provider usage awaits reconciliation \u2014 not budget exhaustion",tone:"warn"};if(t==="budget.unpriced.acknowledged")return{role:"system",label:"Budget",glyph:"$",text:"Single-call cost risk approved; original usage remains pending",tone:"warn"};if(t==="life.lifecycle.block")return{role:"system",label:"Watch",glyph:"\u26D4",text:`blocked \u2014 needs you \xB7 ${vr(Ve(e,"text")||Ve(e,"reason"),150)}`,tone:"err",rule:!0};if(t==="life.daemon.idle_timeout")return{role:"system",label:"Watch",glyph:"\u{1F7E6}",text:vr(Ve(e,"text")||"nothing to do for a while \u2014 standing by",150),tone:"dim"};if(t==="ui.operator")return{role:"system",label:"You",glyph:"\u203A",text:Ve(e,"text"),tone:"accent",rule:!0};if(t==="ui.argus"){let i=Ve(e,"text");return i?{role:"manager",label:"Argus",glyph:"\u258C",text:i,tone:"bright"}:null}if(t==="ui.activity"){let i=Ve(e,"text");return i?{role:"manager",label:"Steps",glyph:"\u22EE",text:i,tone:"dim"}:null}let r=_0(e,XF);if(r)return ZF(r);if(e.operator_alert===!0){let i=vr(Ve(e,"text")||Ve(e,"reason")||t,170);if(i)return{role:"system",label:"Watch",glyph:"\u{1F441}",text:i,tone:"err",rule:!0}}return null}var XF={locale:"en",showReasoning:!0,unknownEventPolicy:"hide",density:"full"};function ZF(e){return{role:e.role,label:e.labelKey==="event.notice"?"Watch":e.label,glyph:e.glyph,text:e.text,tone:e.tone,...e.rule?{rule:!0}:{},...e.reasoning?{reasoning:!0}:{},...e.expand?{expand:!0}:{}}}function GI(e){let t=e,r=String(t.kind??"");return String(t.type)==="engineer.progress"&&["assistant_message","agent_message","message","reasoning"].includes(r)||String(t.type)==="ui.argus"?String(t.message_id??""):""}function ek(e){let t={done:"the Reviewer was satisfied",blocked:"the Reviewer found the work stuck",no_progress:"the Reviewer saw no progress"};return e?t[e]??"the Reviewer asked for another pass":"the Reviewer gave no verdict"}var R0=["turning it over","consulting a hundred eyes","reading the room","weighing it","thinking it through","cross-checking the evidence","running the numbers","sizing up the angles","following the thread","letting it settle"],HI=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function b0(e,t,r=20){return e.length===0?"":e[Math.floor(t/r)%e.length]}function WI(e){return HI[e%HI.length]}function F0(e,t,r=!1,i=0){let s=`${b0(R0,t)}\u2026`;if(r){let u=Math.max(0,Math.floor(Number.isFinite(i)?i:0));return`${s} \xB7 Manager alive \xB7 ${u}s quiet`}let a=e||s;return a.includes("[SESSION HANDOFF")?"Manager context refreshed \xB7 working on your message\u2026":a.replace(/^Manager\s*·\s*/i,"").slice(0,100)}var k0="a hundred eyes on your research \u2014 some never close";var N0=["All quiet. Argus keeps watch.","Nothing stirring \u2014 some eyes stay open.","Standing watch. Say the word.","Resting, not sleeping.","Quiet stretch. The watch continues.","No signal yet \u2014 Argus doesn't blink first.","The feed is calm. So is Argus.","Waiting, unhurried."];function x0(e,t=3800){return e.length===0?"":e[Math.floor(Date.now()/t)%e.length]}function Qp(e){let t=[],r=new Map,i=new Set(e.map(s=>String(s.recovered_from_message_id??"")).filter(Boolean));return e.forEach(s=>{if(i.has(GI(s))&&s.final_delivery!==!0)return;let a=S0(s);if(!a)return;let u=GI(s);if(u&&r.has(u)){let E=r.get(u),I={...t[E],ev:{...t[E].ev,...s},r:{...t[E].r,...a,text:QI(t[E].r.text,a.text,jf(s))}};if(E===t.length-1){t[E]=I;return}t.splice(E,1);for(let[y,D]of r)D>E&&r.set(y,D-1);t.push(I),r.set(u,t.length-1);return}let p=u||EA(s);u&&r.set(u,t.length),t.push({ev:s,r:a,key:p,mid:u})}),t}function T0(e,t=""){let r=e.at(-1),i=t?e.findIndex(p=>p.mid===t):-1,s=!!(r?.mid&&r.ev.type==="engineer.progress"&&r.ev.replace===!0),a=i>=0?i:s?e.length-1:-1,u=a>=0?e[a]:null;return{committed:u?e.filter((p,E)=>E!==a):e,live:u}}var Jo=Me(Lt(),1);function O0({r:e,compact:t,width:r}){let i=t?`${e.label.slice(0,1)} `:e.label.padEnd(9),s=Math.max(12,r-(t?8:15));return(0,Jo.jsxs)(De,{flexDirection:"column",children:[e.rule&&(0,Jo.jsx)(k,{dimColor:!0,children:" \u2500\u2500"}),(0,Jo.jsxs)(De,{children:[(0,Jo.jsx)(k,{children:" "}),(0,Jo.jsx)(k,{color:yp(e.role),bold:!0,children:i}),(0,Jo.jsx)(De,{width:s,children:(0,Jo.jsxs)(k,{color:e.reasoning?void 0:Dp(e.tone),dimColor:e.reasoning,italic:e.reasoning,wrap:e.expand||e.tone==="bright"?"wrap":"truncate-end",children:[e.glyph," ",e.text]})})]})]})}function L0({events:e,width:t,mode:r="all",liveMessageId:i="",collapsed:s=!1,showIdle:a=!0,showReasoning:u=!1}){let p=(0,ml.useMemo)(()=>{let ie=Qp(e),X=u?ie:ie.filter($=>!$.r.reasoning);return r==="conversation"?X.filter($=>["ui.operator","ui.argus","ui.activity"].includes(String($.ev.type??""))||$.r.reasoning):X},[e,r,u]),{committed:E,live:I}=T0(p,i),y=I&&jf(I.ev)==="append"?I:null,D=I&&!y&&I.ev.type!=="ui.argus"?I:null,{write:v}=Ra(),T=(0,ml.useRef)(new Set),P=(0,ml.useRef)(null),Z=t<80,ee=!a&&p.length===0,W=E.filter(ie=>!T.current.has(ie.key)||jf(ie.ev)!=="append");return(0,ml.useEffect)(()=>{if(!y){P.current&&(v(` `),P.current=null);return}let ie=P.current,X="";!ie||ie.key!==y.key?(ie&&v(` `),X=` ${Z?`${y.r.label.slice(0,1)} `:y.r.label.padEnd(9)}${y.r.glyph} ${y.r.text}`):y.r.text.startsWith(ie.text)?X=y.r.text.slice(ie.text.length):y.r.text!==ie.text&&(X=` ${Z?`${y.r.label.slice(0,1)} `:y.r.label.padEnd(9)}${y.r.glyph} ${y.r.text}`),T.current.add(y.key),P.current={key:y.key,text:y.r.text},X&&v(X)},[Z,I?.key,y?.key,y?.r.glyph,y?.r.label,y?.r.text,v]),(0,Jo.jsxs)(De,{flexDirection:"column",marginTop:s||ee?0:1,children:[(0,Jo.jsx)(Uf,{items:W,children:ie=>(0,Jo.jsx)(O0,{r:ie.r,compact:Z,width:t},ie.key)}),!s&&D?(0,Jo.jsx)(O0,{r:D.r,compact:Z,width:t}):null,!s&&a&&p.length===0?(0,Jo.jsx)(k,{dimColor:!0,children:` ${x0(N0)}`}):null]})}var ec=Me(qt(),1);var H0=Me(Lt(),1),tk={enabled:!1,activate:()=>()=>{}},M0=(0,ec.createContext)(tk);function P0({controller:e,children:t}){return(0,H0.jsx)(M0.Provider,{value:e,children:t})}function U0(e){let t=(0,ec.useContext)(M0);return(0,ec.useEffect)(()=>t.activate(e),[t,e.column,e.rowsAboveFrameBottom]),t.enabled}var jI=class{constructor(t,r){this.target=t;this.enabled=r??!!(t.isTTY&&process.env.TERM!=="dumb"),this.rawWrite=t.write.bind(t),this.stdout=this.enabled?new Proxy(t,{get:(i,s)=>{if(s==="write")return this.write;let a=Reflect.get(i,s,i);return typeof a=="function"?a.bind(i):a}}):t}target;enabled;stdout;active=null;anchoredRows=0;anchored=!1;baseAfterNewline=!0;pending=null;disposed=!1;rawWrite;activate(t){if(!this.enabled||this.disposed)return()=>{};let r=Symbol("ime-cursor-target");return this.active={token:r,target:{rowsAboveFrameBottom:Math.max(0,Math.floor(t.rowsAboveFrameBottom)),column:Math.max(0,Math.floor(t.column))}},this.scheduleAnchor(),()=>{this.active?.token===r&&(this.active=null,this.cancelAnchor(),this.restoreFrameCursor())}}dispose(){this.disposed||(this.disposed=!0,this.active=null,this.cancelAnchor(),this.restoreFrameCursor(),this.rawWrite(Ho.cursorShow))}write=(...t)=>{this.cancelAnchor(),this.restoreFrameCursor();let r=t[0],i=Buffer.isBuffer(r)?r.toString():String(r??""),s=this.rawWrite(...t);return this.observeFrameEnd(i),this.scheduleAnchor(),s};observeFrameEnd(t){(t.includes(` @@ -155,8 +155,8 @@ Next action: ${I}`:u,a)}else if([G.SKILL_CREATED,G.SKILL_UPDATED].includes(r)){l `).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"")}function BQ(e,t){let r=/(?:\u001b)?\[200~/.test(e),i=/(?:\u001b)?\[201~/.test(e),s=Array.from(e).length>1;if(!(t||r||i||s))return{handled:!1,active:t,text:e,pasted:!1};let u=Zk(e);return t&&!e&&(u=` `),{handled:!0,active:i?!1:t||r,text:u,pasted:r||i||t||s}}var Ao=Me(Lt(),1);function yQ(e,t,r){return r.ctrl&&(t==="c"||t==="d")?"exit":r.escape?"dismiss":e.busy?null:r.downArrow||t==="j"?"next":r.upArrow||t==="k"?"previous":r.return?"replace":null}var DQ=(e,t)=>e.length<=t?e:`${e.slice(0,Math.max(1,t-1))}\u2026`;function QQ({state:e,width:t}){let r=Math.max(20,t-12);return(0,Ao.jsxs)(De,{flexDirection:"column",borderStyle:"round",borderColor:me.warning,paddingX:2,marginTop:1,children:[(0,Ao.jsx)(k,{bold:!0,color:me.warning,children:`Concurrent work limit reached \xB7 ${e.activeCount}/${e.limit}`}),(0,Ao.jsx)(k,{dimColor:!0,children:"Choose one running session to park. Its files, backlog, checkpoints, skills, and wiki stay saved."}),(0,Ao.jsx)(De,{flexDirection:"column",marginTop:1,children:e.running.map((i,s)=>{let a=s===e.selection,u=i.label||i.display_name||i.id,p=i.activity||i.current_task||i.continuous_objective||"standing by";return(0,Ao.jsxs)(De,{flexDirection:"column",children:[(0,Ao.jsxs)(De,{children:[(0,Ao.jsx)(k,{color:a?me.accent:"gray",children:a?"\u203A ":" "}),(0,Ao.jsx)(k,{color:i.daemon_alive?me.success:"gray",children:i.daemon_alive?"\u25CF ":"\u25CB "}),(0,Ao.jsx)(k,{bold:a,color:a?me.accent:void 0,children:DQ(u,Math.max(12,r-24))}),(0,Ao.jsx)(k,{dimColor:!0,children:` ${i.id} pid ${i.daemon_pid??"\u2014"}`})]}),(0,Ao.jsx)(k,{dimColor:!0,children:` ${DQ(p,r)}`})]},i.id)})}),(0,Ao.jsx)(De,{marginTop:1,children:e.error?(0,Ao.jsx)(k,{color:me.error,children:e.error}):e.busy?(0,Ao.jsx)(k,{color:me.accent,children:"Parking selected session and starting queued work\u2026"}):(0,Ao.jsx)(k,{dimColor:!0,children:"\u2191/\u2193 select \xB7 Enter park & replace \xB7 Esc leave new work queued"})})]})}function wQ(e,t=!1,r=!1){return(t||r)&&e.toLowerCase()==="r"}var un=e=>String(e??"").trim(),eN=/^[a-z][a-z -]+ requires an operator-owned decision before continuing\.?$/i,tN=e=>{let t=un(e);return eN.test(t)?"":t},vQ=(e,t)=>{let r=/[\u3400-\u9fff]/.test(`${e} ${t}`);return{id:"custom",label:r?"\u81EA\u5DF1\u8F93\u5165":"Write my own answer",description:r?"\u76F4\u63A5\u544A\u8BC9 Argus \u4F60\u7684\u51B3\u5B9A\u3002":"Tell Argus your decision directly.",requires_note:!0}};function _Q(e,t,r){let i=[...e,...t],s=new Map(t.map(I=>[un(I.id),I])),a=(I,y)=>{let D=s.get(I)??(un(y.id)===I?y:void 0);return{task_title:un(D?.title)||void 0,task_status:un(D?.status)||void 0}},u=[],p=new Set;for(let I of i){let y=un(I.id),D=I.operator_decision;if(D&&typeof D=="object"&&!Array.isArray(D)){let P=D,Z=un(P.id);if(!Z||p.has(Z)||un(P.status)!=="pending")continue;p.add(Z);let ee=un(P.options_source),W=P.kind==="domain_intake",ie=(ee==="agent"||W&&ee==="workflow")&&Array.isArray(P.options)?P.options.filter($=>!!un($?.id)&&!!un($?.label)).map($=>({...$,requires_note:$.requires_note===!0})):[];ie.some($=>$.id==="custom")||ie.push(vQ(un(P.title),un(P.question)));let X=un(P.item_id)||y;u.push({id:Z,...W?{kind:"domain_intake"}:{},item_id:X,revision:Number(P.revision??1),status:"pending",title:un(P.title)||un(I.title)||"Decision required",reason:tN(P.reason),question:un(P.question)||un(I.pending_question),evidence:Array.isArray(P.evidence)?P.evidence.filter($=>un($?.label)!=="Acceptance check"):[],options:ie,options_source:W?"workflow":ie.length?"agent":"none",selected_option:"",note:"",...a(X,I),...W?{task_title:un(P.task_title),task_status:void 0}:{},...typeof P.asked_at=="number"&&Number.isFinite(P.asked_at)&&P.asked_at>0?{asked_at:P.asked_at}:{}});continue}let v=un(I.pending_question??I.question??I.text);if(!y||!v)continue;let T=`legacy-${y}`;p.has(T)||(p.add(T),u.push({id:T,item_id:y,revision:1,status:"pending",title:un(I.title??I.objective)||"Blocked task",reason:"",question:v,evidence:[],options:[vQ(un(I.title??I.objective),v)],options_source:"none",selected_option:"",note:"",legacy:!0,...a(y,I)}))}if(!r)return u;let E=u.map(I=>({...I,is_current_task:I.kind==="domain_intake"?void 0:I.item_id===r}));return[...E.filter(I=>I.kind==="domain_intake"),...E.filter(I=>I.is_current_task),...E.filter(I=>I.kind!=="domain_intake"&&!I.is_current_task)]}var Vo=Me(qt(),1);function rN(e){return String(e.message_id??"").startsWith("mission-result-")}function nN(e){let t=[];for(let r of e){if(rN(r))continue;let i=String(r.text??"").trim();if(!i)continue;let s=r.role==="operator"?"ui.operator":r.role==="argus"?"ui.argus":"";s&&t.push({type:s,text:i,...typeof r.ts=="number"?{ts:r.ts}:{},...r.message_id?{message_id:r.message_id}:{}})}return t}function SQ(e,t,r=400){let i=nN(t),s=new Map;for(let p of e){let E=String(p.type??"");if(E!=="ui.operator"&&E!=="ui.argus")continue;let I=`${E}\0${String(p.text??"")}`;s.set(I,(s.get(I)??0)+1)}let a=new Array(i.length).fill(!0);for(let p=i.length-1;p>=0;p-=1){let E=i[p],I=`${String(E.type??"")}\0${String(E.text??"")}`,y=s.get(I)??0;y>0&&(a[p]=!1,s.set(I,y-1))}let u=i.filter((p,E)=>a[E]).reduce((p,E)=>bp(p,E,Number.MAX_SAFE_INTEGER),[...e]).sort((p,E)=>Number(p.ts??0)-Number(E.ts??0));return u.length>r?u.slice(u.length-r):u}var th=400,oN=50;function RQ(e,t){let[r,i]=(0,Vo.useState)(null),[s,a]=(0,Vo.useState)([]),[u,p]=(0,Vo.useState)(!1),[E,I]=(0,Vo.useState)(""),[y,D]=(0,Vo.useState)(""),v=(0,Vo.useRef)(null),T=(0,Vo.useRef)(!0);(0,Vo.useEffect)(()=>{a([]),i(null),p(!1),I(""),D("")},[t]),(0,Vo.useEffect)(()=>{T.current=!0;let ee=!0,W,ie=1e3,X,$=[],Ee=()=>{if(X=void 0,!ee||$.length===0)return;let _e=$;$=[],a(ge=>_e.reduce((ct,ze)=>bp(ct,ze,th),ge))},ye=_e=>{ee&&($.push(_e),X||(X=setTimeout(Ee,oN)))},le=()=>{!ee||!T.current||(v.current=e.connectStream({replay:60,onOpen:()=>{ee&&(ie=1e3,p(!0),D(""))},onEvent:ye,onClose:_e=>{if(ee){if(Ee(),p(!1),!_e.retryable){D(`event stream closed (${_e.code}): ${_e.reason}`);return}T.current&&(W=setTimeout(le,ie),ie=Math.min(ie*2,1e4))}},onError:_e=>{ee&&D(_e.message||"event stream unavailable")}}))};return le(),()=>{ee=!1,W&&clearTimeout(W),X&&clearTimeout(X),$=[],v.current?.close()}},[e]),(0,Vo.useEffect)(()=>{let ee=!0;return e.getTranscript(th).then(W=>{ee&&a(ie=>SQ(ie,W,th))},()=>{}),()=>{ee=!1}},[e]),(0,Vo.useEffect)(()=>{let ee=!0,W=!1,ie=!0,X,$=async()=>{if(W)return;W=!0;let ye=new AbortController;X=ye;try{let le=await e.snapshot(1,ye.signal,ie);ie=!1,ee&&(i(_e=>_e&&JSON.stringify(_e)===JSON.stringify(le)?_e:le),I(""))}catch(le){ee&&I(le.message||"snapshot refresh failed")}finally{W=!1,X===ye&&(X=void 0)}};$();let Ee=setInterval($,5e3);return()=>{ee=!1,X?.abort(),clearInterval(Ee)}},[e]);let P=()=>{v.current?.close()};return{snap:r,setSnap:i,events:s,setEvents:a,connected:u,snapshotError:E,streamError:y,wsRef:v,closeStream:P,shutdown:()=>{T.current=!1,P()}}}var $o=Me(qt(),1);var iN=1e3;function bQ({api:e,projectRef:t,setEvents:r,setNotice:i,captureAdmission:s}){let[a,u]=(0,$o.useState)(!1),[p,E]=(0,$o.useState)(""),[I,y]=(0,$o.useState)(!1),[D,v]=(0,$o.useState)(0),[T,P]=(0,$o.useState)([]),[Z,ee]=(0,$o.useState)(0),[W,ie]=(0,$o.useState)(0),X=(0,$o.useRef)(null),$=(0,$o.useRef)(0),Ee=()=>{let _e=!!X.current;return $.current+=1,X.current?.controller.abort(),X.current=null,u(!1),E(""),y(!1),v(0),P([]),ee(0),_e},ye=()=>{Ee()?i("stopped waiting \xB7 server-side work may still finish in the project timeline"):i("no Manager reply is currently in flight")};return(0,$o.useEffect)(()=>()=>{$.current+=1,X.current?.controller.abort(),X.current=null},[]),(0,$o.useEffect)(()=>{if(!a)return;let _e=setInterval(()=>ie(ge=>ge+1),iN);return()=>clearInterval(_e)},[a]),{pending:a,phase:p,phaseHeartbeat:I,phaseQuietS:D,steps:T,startedAt:Z,tick:W,managerRequestRef:X,cancelManagerTurn:Ee,stopWaiting:ye,submitFreeText:async _e=>{if(X.current){i("Argus is still working \xB7 wait or switch daemons to cancel");return}let ge=t.current,ct=++$.current,ze=new AbortController;X.current={id:ct,project:ge,controller:ze,messageId:""};let be=()=>{let ve=X.current;return!!(ve&&ve.id===ct&&ve.project===ge&&t.current===ge&&!ze.signal.aborted)},se=`argus-${Date.now()}`;r(ve=>[...ve,{type:"ui.operator",text:_e,ts:Date.now()/1e3,event_id:`local-${ge}-${ct}-operator`,message_id:`local-${ct}-operator`,local_request_id:ct,local_optimistic:!0}]),E(""),P([]),ee(Date.now()),ie(0),u(!0),i("");let x=(ve,st=se,nt="auto")=>{be()&&r(Ge=>be()?[...Ge,{type:"ui.argus",text:ve,message_id:st,fragment_mode:nt,ts:Date.now()/1e3}]:Ge)},j=[],ae=!1,te=()=>{if(ae||!be())return;ae=!0;let ve=eQ(X0(j));ve&&r(st=>be()?[...st,{type:"ui.activity",text:ve,ts:Date.now()/1e3}]:st)},Ae=!1,Ke=null;try{try{await e.messageStream(_e,{onPhase:(ve,st,nt)=>{be()&&(E(ve),y(nt.heartbeat),v(nt.quietS),j=z0(j,{label:ve,role:st,kind:nt.kind,detail:nt.detail,heartbeat:nt.heartbeat,quietS:nt.quietS}),P(j))},onDelta:(ve,st,nt)=>{if(!be())return;Ae=!0,te(),E(""),y(!1),v(0);let Ge=st||se,He=X.current;He?.id===ct&&(He.messageId=Ge),x(ve,Ge,nt==="append"||nt==="snapshot"?nt:"auto")},onDone:ve=>{be()&&(te(),ve.kind==="task"?(s(ve.daemon,ge,!!ve.continuous),Ae||x(CI(ve))):Ae||x(ve.reply||"[Manager reply unavailable] No task was dispatched."))},onError:ve=>{be()&&(Ke=ve)}},ze.signal)}catch(ve){be()&&(Ke=ve)}if(!be())return;if(Ke&&!Ae)try{let ve=await e.message(_e,ze.signal);if(!be())return;ve.kind==="chat"&&ve.reply?x(ve.reply):ve.kind==="task"?(s(ve.daemon,ge,!!ve.continuous),x(CI(ve))):x(ve.reply||"(no response)")}catch(ve){be()&&x(`(couldn\u2019t reach Argus: ${ve.message})`)}}finally{X.current?.id===ct&&(te(),X.current=null,u(!1),y(!1),v(0),P([]))}}}}var FQ=Me(qt(),1);function kQ(e,t){let[r,i]=(0,FQ.useState)(null);return{panel:r,setPanel:i,openPanel:(a,u={})=>{let p=!["help","backlog","events"].includes(a);if(i({kind:a,page:0,...u,loading:p}),!p)return;let I={status:()=>Promise.all([e.getStatus(),e.getResources()]),doctor:()=>e.getDoctor(),journal:()=>e.getJournal(20),config:()=>e.getConfig(),identity:()=>e.getIdentity(),daemons:()=>e.listProjects(),artifacts:()=>e.getArtifacts(),artifact:()=>e.getArtifact(String(u.path??"")),task:()=>e.getBacklogItem(String(u.itemId??""))}[a];I&&I().then(y=>i(D=>{if(!D||D.kind!==a)return D;let v=D.selection??0;if(a==="daemons"){let P=El(Bs(y),String(u.query??"")).findIndex(Z=>Z.id===t);v=P>=0?P:0}return{...D,loading:!1,data:y,selection:v}}),y=>i(D=>D&&D.kind===a?{...D,loading:!1,error:y.message}:D))}}}function NQ(e,t){let r=_I(e);if(!r)return;if(!r.cmd){let p=SI(r.name);t.setNotice(p?`unknown ${r.name} \u2014 did you mean ${p}?`:`unknown command ${r.name} \u2014 /help`);return}let i=p=>()=>t.setNotice(p),s=p=>t.setNotice(`error: ${p.message}`),a=p=>t.setNotice(`usage: ${p}`),u=p=>t.setEvents(E=>[...E,{type:"ui.argus",text:p,message_id:`local-${Date.now()}`,ts:Date.now()/1e3}]);switch(r.cmd.name){case"/crystalpilot":t.api.message(e).then(p=>t.setNotice(p.reply||"CrystalPilot command handled"),s);break;case"/help":t.openPanel("help");break;case"/status":t.openPanel("status");break;case"/roles":t.openPanel("config");break;case"/doctor":t.openPanel("doctor");break;case"/identity":if(!r.rest)t.openPanel("identity");else if(r.rest.toLowerCase().startsWith("set ")){let p=r.rest.slice(4).trim();p?t.api.setIdentity(p).then(i("identity updated"),s):a("/identity set ")}else a("/identity [set ]");break;case"/journal":t.openPanel("journal");break;case"/backlog":t.openPanel("backlog",{all:r.rest.trim()==="all",selection:0});break;case"/daemons":t.openPanel("daemons",{query:r.rest});break;case"/artifacts":t.openPanel("artifacts");break;case"/artifact":r.rest?t.openPanel("artifact",{path:r.rest}):a("/artifact ");break;case"/events":t.openPanel("events",{...vI(r.rest)});break;case"/find":r.rest?t.openPanel("events",{filter:"all",query:r.rest}):a("/find ");break;case"/item":r.rest?t.openPanel("task",{itemId:r.rest}):a("/item ");break;case"/resume":case"/attach":t.switchProject(r.rest);break;case"/rename":if(!r.rest){a("/rename ");break}t.api.renameProject(r.rest).then(p=>{t.setSnap(E=>E&&E.session.id===p.sid?{...E,session:{...E.session,display_name:p.name}}:E),t.projectRef.current===p.sid&&t.setNotice(`renamed conversation to ${p.name}`)},s);break;case"/clear":t.setEvents([]),t.setNotice("feed cleared");break;case"/run":t.setPanel(null),t.setNotice("already following the live daemon feed");break;case"/reconnect":t.setNotice("reconnecting\u2026"),t.closeStream();break;case"/cancel":t.stopWaiting();break;case"/abort":t.api.abortMission("operator used /abort").then(p=>t.setNotice(p.message),s);break;case"/quit":t.quit();break;case"/task":r.rest?t.api.postTask(r.rest).then(p=>t.setNotice(`queued ${p.id}`),s):a("/task ");break;case"/plan":r.rest?t.api.previewPlan(r.rest).then(p=>{if(p.error){u(`Planner could not draft a plan: ${p.error}`);return}let E=["Planner preview (nothing queued):"];p.steps.forEach((I,y)=>{E.push(`${y+1}. ${I.title}${I.detail?` \u2014 ${I.detail}`:""}`)}),p.notes.length&&E.push(`Notes: ${p.notes.join("; ")}`),E.push("Use /task to queue it."),u(E.join(` -`))},s):a("/plan ");break;case"/nudge":r.rest?t.api.postNudge(r.rest).then(i("nudge sent"),s):a("/nudge ");break;case"/rewrite":r.rest?t.rewriteDraft(r.rest):a("/rewrite \u2014 or press Ctrl+R to rewrite what you already typed");break;case"/note":r.rest?t.api.postNote(r.rest).then(i("note added"),s):a("/note ");break;case"/done":r.rest?t.api.disposeBacklog(r.rest,"done").then(i(`done ${r.rest}`),s):a("/done ");break;case"/skip":r.rest?t.api.disposeBacklog(r.rest,"skip").then(i(`skipped ${r.rest}`),s):a("/skip ");break;case"/stop":r.rest?t.api.stopBacklog(r.rest).then(i(`stopped ${r.rest}`),s):a("/stop ");break;case"/new":t.openNewDaemon(r.rest);break;case"/backend":r.rest?t.api.setConfig("backend",r.rest).then(()=>t.setNotice(`backend set to ${r.rest}`),s):t.openPanel("config");break;case"/config":{if(!r.rest){t.openPanel("config");break}let p=r.rest.split(/\s+/).filter(Boolean),E=p.find(y=>{let D=y.indexOf("=");return D<=0||D===y.length-1});if(E){t.setNotice(`expected key=value, got ${E}`);break}let I=p.map(y=>{let D=y.indexOf("=");return t.api.setConfig(y.slice(0,D),y.slice(D+1))});Promise.all(I).then(()=>t.setNotice(`updated ${I.length} setting(s)`),s);break}case"/reset":t.api.resetManager().then(i("Manager context reset"),s);break;case"/skills":t.api.skills(r.rest||"ls").then(u,s);break;default:t.setNotice(`${r.cmd.name} not yet wired`)}}var ho=Me(Lt(),1);function xQ({card:e,selection:t,note:r,busy:i,error:s}){let a=e.options[t],u=e.options.length===0,p=e.kind==="domain_intake",E=/[\u3400-\u9fff]/.test(e.title);return(0,ho.jsxs)(De,{flexDirection:"column",borderStyle:"round",borderColor:me.warning,paddingX:1,marginTop:1,children:[p?null:(0,ho.jsx)(k,{color:me.warning,bold:!0,children:"ACTION REQUIRED"}),(0,ho.jsx)(k,{bold:!0,wrap:"wrap",children:e.title}),p&&e.task_title?(0,ho.jsx)(k,{dimColor:!0,wrap:"wrap",children:e.task_title}):null,(0,ho.jsx)(De,{marginTop:1,children:(0,ho.jsx)(k,{wrap:"wrap",children:e.question})}),e.options.length?(0,ho.jsx)(De,{flexDirection:"column",marginTop:1,children:e.options.map((I,y)=>(0,ho.jsxs)(k,{color:y===t?me.accent:void 0,wrap:"wrap",children:[y===t?"\u203A ":" ",y+1,". ",I.label,I.description&&I.description!==e.question?` \u2014 ${I.description}`:""]},I.id))}):null,p||u||a?.requires_note?(0,ho.jsxs)(De,{marginTop:1,children:[(0,ho.jsx)(k,{color:me.accent,children:E?"\u56DE\u7B54 / \u8865\u5145 \u203A ":"Your response \u203A "}),(0,ho.jsx)(k,{children:r.value}),i?null:(0,ho.jsx)(k,{inverse:!0,children:" "})]}):null,s?(0,ho.jsx)(k,{color:me.error,wrap:"wrap",children:s}):null,(0,ho.jsx)(k,{dimColor:!0,children:i?E?"\u6B63\u5728\u63D0\u4EA4\u2026":"Sending your answer\u2026":p?E?"\u2191/\u2193 \u9009\u62E9 \xB7 Enter \u786E\u8BA4 \xB7 \u53EF\u8F93\u5165\u8865\u5145\u8BF4\u660E":"\u2191/\u2193 select \xB7 Enter confirm \xB7 type to add details":u?"Type your answer \xB7 Enter send":"\u2191/\u2193 or number select \xB7 Enter confirm \xB7 typing selects an option that accepts guidance"})]})}var Qn=Me(Lt(),1);function Np(e,t,r){return!e?.admission_required||!e.running_daemons?.length?null:{targetProject:t,running:e.running_daemons,limit:e.limit??e.running_daemons.length,activeCount:e.active_count??e.running_daemons.length,selection:0,resumeContinuous:r,busy:!1,error:""}}function TQ({host:e,port:t,token:r,project:i,initialNotice:s="",initialAdmission:a,initialResumeContinuous:u=!1,exitPolicy:p="detach",onProjectChange:E,trackDaemonCreation:I=y=>y}){let{exit:y}=ms(),{stdout:D}=Ra(),v=hA(),[T,P]=(0,gr.useState)(i),Z=(0,gr.useRef)(T);Z.current=T;let ee=(0,gr.useMemo)(()=>new Es({host:e,port:t,project:T,token:r}),[e,t,T,r]),{snap:W,setSnap:ie,events:X,setEvents:$,connected:Ee,snapshotError:ye,streamError:le,closeStream:_e,shutdown:ge}=RQ(ee,T),[ct,ze]=(0,gr.useState)(jo),[be,se]=(0,gr.useState)(a0),[x,j]=(0,gr.useState)(0),[ae,te]=(0,gr.useState)(s),{panel:Ae,setPanel:Ke,openPanel:ve}=kQ(ee,T),[st,nt]=(0,gr.useState)(null),[Ge,He]=(0,gr.useState)(()=>Np(a,i,u)),[Y,fe]=(0,gr.useState)(!1),[Ce]=(0,gr.useState)(IQ),yt=(0,gr.useMemo)(()=>_Q(W?.pending_questions??[],(W?.backlog??[]).map(Se=>({...Se})))[0]??null,[W?.backlog,W?.pending_questions]),[et,kt]=(0,gr.useState)(null),Je=et??yt,[Ut,_t]=(0,gr.useState)(0),[Xe,Mt]=(0,gr.useState)(jo),[Kr,_r]=(0,gr.useState)(!1),[wn,J]=(0,gr.useState)(""),ce=(0,gr.useRef)(!1);(0,gr.useEffect)(()=>{j(0)},[ct.value]),(0,gr.useEffect)(()=>{_t(0),Mt(jo),_r(!1),J("")},[Je?.id]);let at=(0,gr.useRef)(!1),mt=(0,gr.useRef)(!0),St=(0,gr.useRef)(0),Nt=(0,gr.useRef)(!1),Zt=(0,gr.useRef)(!1);(0,gr.useEffect)(()=>(mt.current=!0,()=>{mt.current=!1}),[]),(0,gr.useEffect)(()=>{if(D.isTTY)return D.write("\x1B[?2004h"),()=>{D.write("\x1B[?2004l")}},[D]);let sr=(Se,Pe,lt)=>{let Kt=Np(Se,Pe,lt);Kt&&(St.current=0,He(Kt))};(0,gr.useEffect)(()=>{let Se=W?.daemon_admission;Ge||!Se||Se.requested_at<=St.current||He(Np(Se,Se.target_sid||T,Se.resume_continuous))},[T,Ge,W?.daemon_admission]);let lr=async()=>{if(!Ge||Ge.busy)return;let Se=Ge.running[Ge.selection];if(Se){He(Pe=>Pe&&{...Pe,busy:!0,error:""});try{let lt=await new Es({host:e,port:t,project:Ge.targetProject,token:r}).replaceDaemon(Se.id,Ge.resumeContinuous,W?.daemon_commands?.revision);if(lt.rc!==0){let Kt=Np(lt,Ge.targetProject,Ge.resumeContinuous);He(Kt??{...Ge,busy:!1,error:lt.error||"could not replace the selected session"});return}St.current=Date.now()/1e3,He(null),te(`parked ${Se.label||Se.id} \xB7 queued work started`)}catch(Pe){He(lt=>lt&&{...lt,busy:!1,error:Pe.message})}}},{pending:Ur,phase:Vs,phaseHeartbeat:qo,phaseQuietS:Do,steps:qn,startedAt:Ci,tick:Bi,managerRequestRef:zo,cancelManagerTurn:ko,stopWaiting:Xo,submitFreeText:nn}=bQ({api:ee,projectRef:Z,setEvents:$,setNotice:te,captureAdmission:sr}),Hi=Se=>Se===Z.current?!1:(ko(),Z.current=Se,P(Se),E?.(Se),He(null),St.current=0,!0),mn=()=>{mt.current=!1,ko(),ge(),y()},$s=async Se=>{let Pe=wI(Se);if(Pe.kind==="list"){ve("daemons");return}let lt=Pe.query;try{let Kt=await ee.listProjects(),sn=Kt.find(Et=>Et.id===lt)||Kt.find(Et=>Et.id.startsWith(lt))||Kt.find(Et=>(Et.label||"").toLowerCase().includes(lt.toLowerCase()))||El(Kt,lt)[0];if(!sn){te(`no project matching "${lt}" \u2014 /daemons to list`);return}if(sn.id===T){te(`already on ${sn.id}`);return}Hi(sn.id),te(`switched to ${sn.label||sn.id}`)}catch(Kt){te(`error: ${Kt.message}`)}},No=Se=>{if(Ke(null),Se.id===T){te(`already on ${Se.label||Se.id}`);return}Hi(Se.id),te(`switched to ${Se.label||Se.id}`)},Ds=(Se="")=>{Ke(null),fe(!1),te(""),nt(Vf(Se))},Wi=async()=>{if(!st||st.busy)return;if(at.current){nt(lt=>lt&&{...lt,error:"a daemon is already being created"});return}let{objective:Se,name:Pe}=rc(st);at.current=!0,nt(lt=>lt&&{...lt,busy:!0,error:""});try{let lt=await I(ee.createDaemon(Se,Pe));if(!mt.current)return;Ke(null),nt(null),Hi(lt.sid),sr(lt.start,lt.sid,!!Se),te(lt.start?.admission_required?`created ${lt.sid} \xB7 choose running work to park`:lt.spawned?`created ${lt.sid} \xB7 campaign started`:`created ${lt.sid} \xB7 message ${Un().name} when ready`)}catch(lt){if(!mt.current)return;nt(Kt=>Kt&&{...Kt,busy:!1,error:lt.message||"daemon creation failed"})}finally{at.current=!1}},ys=Se=>{let Pe=(Se||"").trim();if(!Pe){te("nothing to rewrite \xB7 type a prompt first");return}Zt.current||(Zt.current=!0,te("Manager is rewriting your prompt\u2026"),ee.rewritePrompt(Pe).then(lt=>{if(Zt.current=!1,lt.error||!lt.rewritten.trim()){te(`rewrite failed \xB7 ${lt.error||"empty rewrite"} \xB7 your prompt is unchanged`);return}ze(Ui(lt.rewritten));let Kt=["Rewrote your prompt (not sent \u2014 edit it, then Enter):","",`was: ${Pe}`];lt.changes.length&&Kt.push("","made explicit:",...lt.changes.map(sn=>` - ${sn}`)),lt.questions.length&&Kt.push("","Manager asks (answer these, or they stay unspecified):",...lt.questions.map(sn=>` ? ${sn}`)),$(sn=>[...sn,{type:"ui.activity",text:Kt.join(` -`),ts:Date.now()/1e3}]),te("prompt rewritten \xB7 review it, then Enter to send")},lt=>{Zt.current=!1,te(`rewrite failed \xB7 ${lt.message} \xB7 your prompt is unchanged`)}))},Qs=Se=>{NQ(Se,{api:ee,openPanel:ve,setPanel:Ke,setEvents:$,setNotice:te,setSnap:ie,projectRef:Z,closeStream:_e,stopWaiting:Xo,quit:mn,switchProject:$s,openNewDaemon:Ds,rewriteDraft:ys})},qs=()=>{let Se=ct.value.trim();if(Se){if(!Jf(Se)&&zo.current){te(`${Un().name} is still working \xB7 wait or switch daemons to cancel`);return}ze(jo),j(0),se(Pe=>BI(Pe,Se)),Jf(Se)?Qs(Se):nn(Se)}},ws=async()=>{if(!Je||ce.current)return;let Se=Je.options.length===0,Pe=Je.options[Ut],lt=Xe.value.trim();if((Se||Pe?.requires_note)&&!lt){J("Type the requested answer before confirming.");return}if(!(!Se&&!Pe)){ce.current=!0,kt(Je),_r(!0),J("");try{let Kt=Je.kind==="domain_intake"?await ee.answerDomain(Je.id,Se?"custom":Pe.id,lt):Je.legacy?await ee.answerPending(Je.item_id,lt):await ee.resolveDecision(Je.id,Se?"custom":Pe.id,lt);if(Kt.resolved===!1||Kt.kind==="error"||Kt.kind==="cancelled"){J(String(Kt.reply||"A more specific answer is required.")),ie(await ee.snapshot());return}te(String(Kt.reply||"Your answer was delivered to the team.")),ie(await ee.snapshot())}catch(Kt){J(Kt.message)}finally{ce.current=!1,kt(null),_r(!1)}}};Ei((Se,Pe)=>{let lt=BQ(Se,Nt.current);if(lt.handled){if(Nt.current=lt.active,Je&<.text){let Et=Je.options.length===0,ur=Je.options[Ut]?.requires_note||Je.kind==="domain_intake"?Ut:Je.options.findIndex(Vt=>Vt.id==="custom");(Et||ur>=0)&&(ur>=0&&_t(ur),Mt(Vt=>hs(Vt,lt.text)));return}if(lt.text&&!Ae){if(Ge)return;if(st){let Et=$f(st,lt.text,{});nt(Et.draft)}else ze(Et=>hs(Et,lt.text)),se(Et=>Et.pos===0?Et:{...Et,pos:0});lt.pasted&<.text.length>20&&te(`pasted ${Array.from(lt.text).length} chars \xB7 Enter to send`)}return}if(Je){if(Pe.ctrl&&(Se==="c"||Se==="d")){mn();return}if(Kr)return;if(Je.options.length===0){Pe.return?ws():Pe.leftArrow?Mt(ba):Pe.rightArrow?Mt(Fa):Pe.backspace||Pe.delete?Mt(pA):Pe.ctrl&&Se==="w"?Mt(Ju):Pe.ctrl&&Se==="u"?Mt(mA):Pe.ctrl&&Se==="k"?Mt(Yu):Se&&!Pe.ctrl&&!Pe.meta&&Mt(ur=>hs(ur,Se)),J("");return}if(Pe.downArrow){_t(ur=>hl(ur,Je.options.length,1));return}if(Pe.upArrow){_t(ur=>hl(ur,Je.options.length,-1));return}if(Pe.return){ws();return}if(Je.options[Ut]?.requires_note||Je.kind==="domain_intake"&&(Xe.value||!/^[1-9]$/.test(Se))){Pe.leftArrow?Mt(ba):Pe.rightArrow?Mt(Fa):Pe.backspace||Pe.delete?Mt(pA):Pe.ctrl&&Se==="w"?Mt(Ju):Pe.ctrl&&Se==="u"?Mt(mA):Pe.ctrl&&Se==="k"?Mt(Yu):Se&&!Pe.ctrl&&!Pe.meta&&Mt(ur=>hs(ur,Se)),J("");return}if(/^[1-9]$/.test(Se)){let ur=Number(Se)-1;urVt.id==="custom");ur>=0&&(_t(ur),Mt(Vt=>hs(Vt,Se)),J(""))}return}if(Ge){let Et=yQ(Ge,Se,Pe);Et==="exit"?mn():Et==="dismiss"?(St.current=Date.now()/1e3,He(null),te("new work remains queued")):Et==="next"?He(dr=>dr&&{...dr,selection:hl(dr.selection,dr.running.length,1)}):Et==="previous"?He(dr=>dr&&{...dr,selection:hl(dr.selection,dr.running.length,-1)}):Et==="replace"&&lr();return}if(st){if(Pe.ctrl&&Se==="d"){mn();return}if(Pe.ctrl&&Se==="c"){st.busy||nt(null);return}let Et=$f(st,Se,Pe);Et.intent==="submit"?Wi():Et.intent==="cancel"?nt(null):Et.draft!==st&&nt(Et.draft);return}if(Pe.ctrl&&Se==="c"){if(Y){mn();return}fe(!0),te(`Ctrl-C again to exit \xB7 Ctrl-D also quits \xB7 ${p==="stop-all"?"current executor and this launch's owned API will stop gracefully":p==="stop-api"?"executor keeps running; this launch's owned API will stop":"terminal UI exits; local API and executor keep running"}`);return}if(Pe.ctrl&&Se==="d"){mn();return}if(wQ(Se,Pe.ctrl,Pe.meta)){ys(ct.value);return}if(Y&&fe(!1),Ae){let Et=Ae.kind==="daemons"||Ae.kind==="artifacts"||Ae.kind==="backlog",dr=Ae.kind==="daemons"?El(Bs(Ae.data??[]),Ae.query??""):[],ur=Ae.kind==="backlog"?Ae.all?W?.backlog??[]:Rp(W?.backlog??[],!1):[];if(Pe.escape||Se==="q")Ke(null);else if(Ae.kind==="daemons"&&Se==="n")Ke(null),Ds();else if(Ae.kind==="daemons"&&Se==="/")Ke(null),ze(Ui("/daemons ")),j(0);else if(Et&&(Pe.downArrow||Se==="j")){let Vt=Ae.kind==="daemons"?dr.length:Ae.kind==="backlog"?ur.length:Array.isArray(Ae.data)?Ae.data.length:0;Ke(cn=>cn&&{...cn,selection:hl(cn.selection??0,Vt,1)})}else if(Et&&(Pe.upArrow||Se==="k")){let Vt=Ae.kind==="daemons"?dr.length:Ae.kind==="backlog"?ur.length:Array.isArray(Ae.data)?Ae.data.length:0;Ke(cn=>cn&&{...cn,selection:hl(cn.selection??0,Vt,-1)})}else if(Et&&Pe.return)if(Ae.kind==="daemons"){let Vt=dr[Ae.selection??0];Vt&&No(Vt)}else if(Ae.kind==="artifacts"){let cn=(Ae.data??[])[Ae.selection??0];cn?.exists?ve("artifact",{path:cn.path}):cn&&(Ke(null),te(`artifact is declared but missing: ${cn.path}`))}else{let Vt=ur[Ae.selection??0];Vt&&ve("task",{itemId:Vt.id})}else Pe.return?Ke(null):Pe.downArrow||Se==="j"?Ke(Vt=>Vt&&{...Vt,page:(Vt.page??0)+1}):(Pe.upArrow||Se==="k")&&Ke(Vt=>Vt&&{...Vt,page:Math.max(0,(Vt.page??0)-1)});return}let Kt=gp(ct.value),sn=Kt.length>0;if(Pe.escape&&zo.current&&!sn){Xo();return}if(Pe.escape){sn&&ze(jo);return}if(sn){if(Pe.upArrow){j(dr=>(dr-1+Kt.length)%Kt.length);return}if(Pe.downArrow){j(dr=>(dr+1)%Kt.length);return}let Et=Kt[Math.min(x,Kt.length-1)];if(Pe.tab){ze(Ui(dp(Et))),j(0);return}if(Pe.return){let dr=ct.value.trim(),ur=dr.toLowerCase()===Et.name.toLowerCase()||(Et.aliases??[]).some(Vt=>Vt.toLowerCase()===dr.toLowerCase());if(!ur&&Et.arg)ze(Ui(dp(Et))),j(0);else{let Vt=ur?dr:Et.name;ze(jo),j(0),se(cn=>BI(cn,Vt)),Qs(Vt)}return}}if(Pe.return){qs();return}if(Pe.leftArrow){ze(ba);return}if(Pe.rightArrow){ze(Fa);return}if(Pe.upArrow){let Et=A0(be,ct.value);se(Et.h),ze(Ui(Et.value));return}if(Pe.downArrow){let Et=l0(be);se(Et.h),ze(Ui(Et.value));return}if(Pe.ctrl&&Se==="a"){ze(up);return}if(Pe.ctrl&&Se==="e"){ze(cp);return}if(Pe.ctrl&&Se==="b"){ze(ba);return}if(Pe.ctrl&&Se==="f"){ze(Fa);return}if(Pe.ctrl&&Se==="w"){ze(Ju);return}if(Pe.ctrl&&Se==="u"){ze(mA);return}if(Pe.ctrl&&Se==="k"){ze(Yu);return}if(Pe.backspace||Pe.delete){ze(pA),se(Et=>Et.pos===0?Et:{...Et,pos:0});return}if(Se==="?"&&ct.value===""){ve("help");return}Se&&!Pe.ctrl&&!Pe.meta&&(ze(Et=>hs(Et,Se)),se(Et=>Et.pos===0?Et:{...Et,pos:0}))});let yo=gp(ct.value),on=yo.length>0&&!Ge&&!st&&!Ae,ji=Ur?["manager"]:[],vs=uQ(W?.roles??[],X),Gr=(Vs||"handling your message").replace(/^Manager\s*·\s*/i,"").replace(/[.…]+$/u,""),_s=Ur?cQ(vs,"manager",Gr,Math.max(0,(Date.now()-Ci)/1e3)):vs,Zo=W?y0({...W,roles:_s},X):null,zs=W?.partial?(W.diagnostics??[]).map(Se=>`${Se.section}: ${Se.message}`).join(" \xB7 "):"",xo=W?.observability?.slo.status==="degraded"?W.observability.slo.violations.join(" \xB7 "):"",Xs=ye?`snapshot refresh failed \xB7 ${ye}`:W?.partial?`snapshot partial \xB7 ${zs||"backend reported incomplete state"}`:xo?`SLO degraded \xB7 ${xo}`:le&&!Ee?`event stream reconnecting \xB7 ${le}`:"";return(0,Qn.jsxs)(De,{flexDirection:"column",paddingX:1,children:[(0,Qn.jsx)(C0,{width:v.columns,vertical:Zo?.routing.vertical}),on?null:(0,Qn.jsx)(rQ,{alert:ZI(X)}),Je?(0,Qn.jsx)(xQ,{card:Je,selection:Ut,note:Xe,busy:Kr,error:wn}):Ge?(0,Qn.jsx)(QQ,{state:Ge,width:v.columns}):st?(0,Qn.jsx)(_p,{draft:st}):(0,Qn.jsxs)(Qn.Fragment,{children:[Zo&&!on&&!Ae?(0,Qn.jsx)(CQ,{view:Zo,width:v.columns,height:v.rows,busy:Ur,spentUsd:W?.global_spend_usd,spendStatus:W?.global_spend_status}):null,(0,Qn.jsx)(L0,{events:X,width:v.columns,mode:"all",liveMessageId:zo.current?.messageId,collapsed:on||!!Ae,showIdle:!Zo,showReasoning:Ce}),Ae?(0,Qn.jsx)(EQ,{panel:Ae,snap:W,events:X,viewportRows:v.rows,viewportColumns:v.columns,activeProject:T}):(0,Qn.jsxs)(Qn.Fragment,{children:[Ur&&!on&&(0,Qn.jsx)(tQ,{tick:Bi,phase:Vs,heartbeat:qo,quietS:Do,steps:qn,width:v.columns,elapsedS:Math.max(0,Math.floor((Date.now()-Ci)/1e3))}),(0,Qn.jsxs)(De,{flexDirection:"column",flexShrink:0,children:[(0,Qn.jsx)(Y0,{items:yo,selected:Math.min(x,yo.length-1),maxVisible:J0(v.rows)}),(0,Qn.jsx)(wp,{edit:ct,width:v.columns,rowsBelow:on?0:1})]}),on?null:(0,Qn.jsx)(V0,{notice:ae,health:Xs,width:v.columns})]})]})]})}var Co=Me(qt(),1);var hi=Me(Lt(),1),rh="/new /open /use /run /resume /recover /stop /spec /conversation /file /status /exit";function OQ(e,t){let r=[""],i=0;for(let s of e.replace(/\t/g," ")){if(s===` +`))},s):a("/plan ");break;case"/nudge":r.rest?t.api.postNudge(r.rest).then(i("nudge sent"),s):a("/nudge ");break;case"/rewrite":r.rest?t.rewriteDraft(r.rest):a("/rewrite \u2014 or press Ctrl+R to rewrite what you already typed");break;case"/note":r.rest?t.api.postNote(r.rest).then(i("note added"),s):a("/note ");break;case"/done":r.rest?t.api.disposeBacklog(r.rest,"done").then(i(`done ${r.rest}`),s):a("/done ");break;case"/skip":r.rest?t.api.disposeBacklog(r.rest,"skip").then(i(`skipped ${r.rest}`),s):a("/skip ");break;case"/stop":r.rest?t.api.stopBacklog(r.rest).then(i(`stopped ${r.rest}`),s):a("/stop ");break;case"/new":t.openNewDaemon(r.rest);break;case"/backend":r.rest?t.api.setConfig("backend",r.rest).then(()=>t.setNotice(`backend set to ${r.rest}`),s):t.openPanel("config");break;case"/config":{if(!r.rest){t.openPanel("config");break}let p=r.rest.split(/\s+/).filter(Boolean),E=p.find(y=>{let D=y.indexOf("=");return D<=0||D===y.length-1});if(E){t.setNotice(`expected key=value, got ${E}`);break}let I=p.map(y=>{let D=y.indexOf("=");return t.api.setConfig(y.slice(0,D),y.slice(D+1))});Promise.all(I).then(()=>t.setNotice(`updated ${I.length} setting(s)`),s);break}case"/reset":t.api.resetManager().then(i("Manager context reset"),s);break;case"/skills":t.api.skills(r.rest||"ls").then(u,s);break;default:t.setNotice(`${r.cmd.name} not yet wired`)}}var ho=Me(Lt(),1);function xQ({card:e,selection:t,note:r,busy:i,error:s}){let a=e.options[t],u=e.options.length===0,p=e.kind==="domain_intake",E=/[\u3400-\u9fff]/.test(e.title);return(0,ho.jsxs)(De,{flexDirection:"column",borderStyle:"round",borderColor:me.warning,paddingX:1,marginTop:1,children:[p?null:(0,ho.jsx)(k,{color:me.warning,bold:!0,children:"ACTION REQUIRED"}),(0,ho.jsx)(k,{bold:!0,wrap:"wrap",children:e.title}),p&&e.task_title?(0,ho.jsx)(k,{dimColor:!0,wrap:"wrap",children:e.task_title}):null,(0,ho.jsx)(De,{marginTop:1,children:(0,ho.jsx)(k,{wrap:"wrap",children:e.question})}),e.options.length?(0,ho.jsx)(De,{flexDirection:"column",marginTop:1,children:e.options.map((I,y)=>(0,ho.jsxs)(k,{color:y===t?me.accent:void 0,wrap:"wrap",children:[y===t?"\u203A ":" ",y+1,". ",I.label,I.description&&I.description!==e.question?` \u2014 ${I.description}`:""]},I.id))}):null,p||u||a?.requires_note?(0,ho.jsxs)(De,{marginTop:1,children:[(0,ho.jsx)(k,{color:me.accent,children:E?"\u56DE\u7B54 / \u8865\u5145 \u203A ":"Your response \u203A "}),(0,ho.jsx)(k,{children:r.value}),i?null:(0,ho.jsx)(k,{inverse:!0,children:" "})]}):null,s?(0,ho.jsx)(k,{color:me.error,wrap:"wrap",children:s}):null,(0,ho.jsx)(k,{dimColor:!0,children:i?E?"\u6B63\u5728\u63D0\u4EA4\u2026":"Sending your answer\u2026":p?E?"\u2191/\u2193 \u9009\u62E9 \xB7 Enter \u786E\u8BA4 \xB7 \u53EF\u8F93\u5165\u8865\u5145\u8BF4\u660E":"\u2191/\u2193 select \xB7 Enter confirm \xB7 type to add details":u?"Type your answer \xB7 Enter send":"\u2191/\u2193 or number select \xB7 Enter confirm \xB7 typing selects an option that accepts guidance"})]})}var Qn=Me(Lt(),1);function Np(e,t,r){return!e?.admission_required||!e.running_daemons?.length?null:{targetProject:t,running:e.running_daemons,limit:e.limit??e.running_daemons.length,activeCount:e.active_count??e.running_daemons.length,selection:0,resumeContinuous:r,busy:!1,error:""}}function TQ({host:e,port:t,token:r,project:i,initialNotice:s="",initialAdmission:a,initialResumeContinuous:u=!1,exitPolicy:p="detach",onProjectChange:E,trackDaemonCreation:I=y=>y}){let{exit:y}=ms(),{stdout:D}=Ra(),v=hA(),[T,P]=(0,gr.useState)(i),Z=(0,gr.useRef)(T);Z.current=T;let ee=(0,gr.useMemo)(()=>new Es({host:e,port:t,project:T,token:r}),[e,t,T,r]),{snap:W,setSnap:ie,events:X,setEvents:$,connected:Ee,snapshotError:ye,streamError:le,closeStream:_e,shutdown:ge}=RQ(ee,T),[ct,ze]=(0,gr.useState)(jo),[be,se]=(0,gr.useState)(a0),[x,j]=(0,gr.useState)(0),[ae,te]=(0,gr.useState)(s),{panel:Ae,setPanel:Ke,openPanel:ve}=kQ(ee,T),[st,nt]=(0,gr.useState)(null),[Ge,He]=(0,gr.useState)(()=>Np(a,i,u)),[Y,fe]=(0,gr.useState)(!1),[Ce]=(0,gr.useState)(IQ),yt=(0,gr.useMemo)(()=>_Q(W?.pending_questions??[],(W?.backlog??[]).map(Se=>({...Se})))[0]??null,[W?.backlog,W?.pending_questions]),[et,kt]=(0,gr.useState)(null),Je=et??yt,[Ut,_t]=(0,gr.useState)(0),[Xe,Mt]=(0,gr.useState)(jo),[Kr,_r]=(0,gr.useState)(!1),[wn,J]=(0,gr.useState)(""),ce=(0,gr.useRef)(!1);(0,gr.useEffect)(()=>{j(0)},[ct.value]),(0,gr.useEffect)(()=>{_t(0),Mt(jo),_r(!1),J("")},[Je?.id]);let at=(0,gr.useRef)(!1),mt=(0,gr.useRef)(!0),St=(0,gr.useRef)(0),Nt=(0,gr.useRef)(!1),Zt=(0,gr.useRef)(!1);(0,gr.useEffect)(()=>(mt.current=!0,()=>{mt.current=!1}),[]),(0,gr.useEffect)(()=>{if(D.isTTY)return D.write("\x1B[?2004h"),()=>{D.write("\x1B[?2004l")}},[D]);let sr=(Se,Pe,lt)=>{let Kt=Np(Se,Pe,lt);Kt&&(St.current=0,He(Kt))};(0,gr.useEffect)(()=>{let Se=W?.daemon_admission;Ge||!Se||Se.requested_at<=St.current||He(Np(Se,Se.target_sid||T,Se.resume_continuous))},[T,Ge,W?.daemon_admission]);let ur=async()=>{if(!Ge||Ge.busy)return;let Se=Ge.running[Ge.selection];if(Se){He(Pe=>Pe&&{...Pe,busy:!0,error:""});try{let lt=await new Es({host:e,port:t,project:Ge.targetProject,token:r}).replaceDaemon(Se.id,Ge.resumeContinuous,W?.daemon_commands?.revision);if(lt.rc!==0){let Kt=Np(lt,Ge.targetProject,Ge.resumeContinuous);He(Kt??{...Ge,busy:!1,error:lt.error||"could not replace the selected session"});return}St.current=Date.now()/1e3,He(null),te(`parked ${Se.label||Se.id} \xB7 queued work started`)}catch(Pe){He(lt=>lt&&{...lt,busy:!1,error:Pe.message})}}},{pending:Ur,phase:Vs,phaseHeartbeat:qo,phaseQuietS:Do,steps:qn,startedAt:Ci,tick:Bi,managerRequestRef:zo,cancelManagerTurn:ko,stopWaiting:Xo,submitFreeText:nn}=bQ({api:ee,projectRef:Z,setEvents:$,setNotice:te,captureAdmission:sr}),Hi=Se=>Se===Z.current?!1:(ko(),Z.current=Se,P(Se),E?.(Se),He(null),St.current=0,!0),mn=()=>{mt.current=!1,ko(),ge(),y()},$s=async Se=>{let Pe=wI(Se);if(Pe.kind==="list"){ve("daemons");return}let lt=Pe.query;try{let Kt=await ee.listProjects(),sn=Kt.find(Et=>Et.id===lt)||Kt.find(Et=>Et.id.startsWith(lt))||Kt.find(Et=>(Et.label||"").toLowerCase().includes(lt.toLowerCase()))||El(Kt,lt)[0];if(!sn){te(`no project matching "${lt}" \u2014 /daemons to list`);return}if(sn.id===T){te(`already on ${sn.id}`);return}Hi(sn.id),te(`switched to ${sn.label||sn.id}`)}catch(Kt){te(`error: ${Kt.message}`)}},No=Se=>{if(Ke(null),Se.id===T){te(`already on ${Se.label||Se.id}`);return}Hi(Se.id),te(`switched to ${Se.label||Se.id}`)},Ds=(Se="")=>{Ke(null),fe(!1),te(""),nt(Vf(Se))},Wi=async()=>{if(!st||st.busy)return;if(at.current){nt(lt=>lt&&{...lt,error:"a daemon is already being created"});return}let{objective:Se,name:Pe}=rc(st);at.current=!0,nt(lt=>lt&&{...lt,busy:!0,error:""});try{let lt=await I(ee.createDaemon(Se,Pe));if(!mt.current)return;Ke(null),nt(null),Hi(lt.sid),sr(lt.start,lt.sid,!!Se),te(lt.start?.admission_required?`created ${lt.sid} \xB7 choose running work to park`:lt.spawned?`created ${lt.sid} \xB7 campaign started`:`created ${lt.sid} \xB7 message ${Un().name} when ready`)}catch(lt){if(!mt.current)return;nt(Kt=>Kt&&{...Kt,busy:!1,error:lt.message||"daemon creation failed"})}finally{at.current=!1}},ys=Se=>{let Pe=(Se||"").trim();if(!Pe){te("nothing to rewrite \xB7 type a prompt first");return}Zt.current||(Zt.current=!0,te("Manager is rewriting your prompt\u2026"),ee.rewritePrompt(Pe).then(lt=>{if(Zt.current=!1,lt.error||!lt.rewritten.trim()){te(`rewrite failed \xB7 ${lt.error||"empty rewrite"} \xB7 your prompt is unchanged`);return}ze(Ui(lt.rewritten));let Kt=["Rewrote your prompt (not sent \u2014 edit it, then Enter):","",`was: ${Pe}`];lt.changes.length&&Kt.push("","made explicit:",...lt.changes.map(sn=>` - ${sn}`)),lt.questions.length&&Kt.push("","Manager asks (answer these, or they stay unspecified):",...lt.questions.map(sn=>` ? ${sn}`)),$(sn=>[...sn,{type:"ui.activity",text:Kt.join(` +`),ts:Date.now()/1e3}]),te("prompt rewritten \xB7 review it, then Enter to send")},lt=>{Zt.current=!1,te(`rewrite failed \xB7 ${lt.message} \xB7 your prompt is unchanged`)}))},Qs=Se=>{NQ(Se,{api:ee,openPanel:ve,setPanel:Ke,setEvents:$,setNotice:te,setSnap:ie,projectRef:Z,closeStream:_e,stopWaiting:Xo,quit:mn,switchProject:$s,openNewDaemon:Ds,rewriteDraft:ys})},qs=()=>{let Se=ct.value.trim();if(Se){if(!Jf(Se)&&zo.current){te(`${Un().name} is still working \xB7 wait or switch daemons to cancel`);return}ze(jo),j(0),se(Pe=>BI(Pe,Se)),Jf(Se)?Qs(Se):nn(Se)}},ws=async()=>{if(!Je||ce.current)return;let Se=Je.options.length===0,Pe=Je.options[Ut],lt=Xe.value.trim();if((Se||Pe?.requires_note)&&!lt){J("Type the requested answer before confirming.");return}if(!(!Se&&!Pe)){ce.current=!0,kt(Je),_r(!0),J("");try{let Kt=Je.kind==="domain_intake"?await ee.answerDomain(Je.id,Se?"custom":Pe.id,lt):Je.legacy?await ee.answerPending(Je.item_id,lt):await ee.resolveDecision(Je.id,Se?"custom":Pe.id,lt);if(Kt.resolved===!1||Kt.kind==="error"||Kt.kind==="cancelled"){J(String(Kt.reply||"A more specific answer is required.")),ie(await ee.snapshot());return}te(String(Kt.reply||"Your answer was delivered to the team.")),ie(await ee.snapshot())}catch(Kt){J(Kt.message)}finally{ce.current=!1,kt(null),_r(!1)}}};Ei((Se,Pe)=>{let lt=BQ(Se,Nt.current);if(lt.handled){if(Nt.current=lt.active,Je&<.text){let Et=Je.options.length===0,cr=Je.options[Ut]?.requires_note||Je.kind==="domain_intake"?Ut:Je.options.findIndex(Vt=>Vt.id==="custom");(Et||cr>=0)&&(cr>=0&&_t(cr),Mt(Vt=>hs(Vt,lt.text)));return}if(lt.text&&!Ae){if(Ge)return;if(st){let Et=$f(st,lt.text,{});nt(Et.draft)}else ze(Et=>hs(Et,lt.text)),se(Et=>Et.pos===0?Et:{...Et,pos:0});lt.pasted&<.text.length>20&&te(`pasted ${Array.from(lt.text).length} chars \xB7 Enter to send`)}return}if(Je){if(Pe.ctrl&&(Se==="c"||Se==="d")){mn();return}if(Kr)return;if(Je.options.length===0){Pe.return?ws():Pe.leftArrow?Mt(ba):Pe.rightArrow?Mt(Fa):Pe.backspace||Pe.delete?Mt(pA):Pe.ctrl&&Se==="w"?Mt(Ju):Pe.ctrl&&Se==="u"?Mt(mA):Pe.ctrl&&Se==="k"?Mt(Yu):Se&&!Pe.ctrl&&!Pe.meta&&Mt(cr=>hs(cr,Se)),J("");return}if(Pe.downArrow){_t(cr=>hl(cr,Je.options.length,1));return}if(Pe.upArrow){_t(cr=>hl(cr,Je.options.length,-1));return}if(Pe.return){ws();return}if(Je.options[Ut]?.requires_note||Je.kind==="domain_intake"&&(Xe.value||!/^[1-9]$/.test(Se))){Pe.leftArrow?Mt(ba):Pe.rightArrow?Mt(Fa):Pe.backspace||Pe.delete?Mt(pA):Pe.ctrl&&Se==="w"?Mt(Ju):Pe.ctrl&&Se==="u"?Mt(mA):Pe.ctrl&&Se==="k"?Mt(Yu):Se&&!Pe.ctrl&&!Pe.meta&&Mt(cr=>hs(cr,Se)),J("");return}if(/^[1-9]$/.test(Se)){let cr=Number(Se)-1;crVt.id==="custom");cr>=0&&(_t(cr),Mt(Vt=>hs(Vt,Se)),J(""))}return}if(Ge){let Et=yQ(Ge,Se,Pe);Et==="exit"?mn():Et==="dismiss"?(St.current=Date.now()/1e3,He(null),te("new work remains queued")):Et==="next"?He(dr=>dr&&{...dr,selection:hl(dr.selection,dr.running.length,1)}):Et==="previous"?He(dr=>dr&&{...dr,selection:hl(dr.selection,dr.running.length,-1)}):Et==="replace"&&ur();return}if(st){if(Pe.ctrl&&Se==="d"){mn();return}if(Pe.ctrl&&Se==="c"){st.busy||nt(null);return}let Et=$f(st,Se,Pe);Et.intent==="submit"?Wi():Et.intent==="cancel"?nt(null):Et.draft!==st&&nt(Et.draft);return}if(Pe.ctrl&&Se==="c"){if(Y){mn();return}fe(!0),te(`Ctrl-C again to exit \xB7 Ctrl-D also quits \xB7 ${p==="stop-all"?"current executor and this launch's owned API will stop gracefully":p==="stop-api"?"executor keeps running; this launch's owned API will stop":"terminal UI exits; local API and executor keep running"}`);return}if(Pe.ctrl&&Se==="d"){mn();return}if(wQ(Se,Pe.ctrl,Pe.meta)){ys(ct.value);return}if(Y&&fe(!1),Ae){let Et=Ae.kind==="daemons"||Ae.kind==="artifacts"||Ae.kind==="backlog",dr=Ae.kind==="daemons"?El(Bs(Ae.data??[]),Ae.query??""):[],cr=Ae.kind==="backlog"?Ae.all?W?.backlog??[]:Rp(W?.backlog??[],!1):[];if(Pe.escape||Se==="q")Ke(null);else if(Ae.kind==="daemons"&&Se==="n")Ke(null),Ds();else if(Ae.kind==="daemons"&&Se==="/")Ke(null),ze(Ui("/daemons ")),j(0);else if(Et&&(Pe.downArrow||Se==="j")){let Vt=Ae.kind==="daemons"?dr.length:Ae.kind==="backlog"?cr.length:Array.isArray(Ae.data)?Ae.data.length:0;Ke(cn=>cn&&{...cn,selection:hl(cn.selection??0,Vt,1)})}else if(Et&&(Pe.upArrow||Se==="k")){let Vt=Ae.kind==="daemons"?dr.length:Ae.kind==="backlog"?cr.length:Array.isArray(Ae.data)?Ae.data.length:0;Ke(cn=>cn&&{...cn,selection:hl(cn.selection??0,Vt,-1)})}else if(Et&&Pe.return)if(Ae.kind==="daemons"){let Vt=dr[Ae.selection??0];Vt&&No(Vt)}else if(Ae.kind==="artifacts"){let cn=(Ae.data??[])[Ae.selection??0];cn?.exists?ve("artifact",{path:cn.path}):cn&&(Ke(null),te(`artifact is declared but missing: ${cn.path}`))}else{let Vt=cr[Ae.selection??0];Vt&&ve("task",{itemId:Vt.id})}else Pe.return?Ke(null):Pe.downArrow||Se==="j"?Ke(Vt=>Vt&&{...Vt,page:(Vt.page??0)+1}):(Pe.upArrow||Se==="k")&&Ke(Vt=>Vt&&{...Vt,page:Math.max(0,(Vt.page??0)-1)});return}let Kt=gp(ct.value),sn=Kt.length>0;if(Pe.escape&&zo.current&&!sn){Xo();return}if(Pe.escape){sn&&ze(jo);return}if(sn){if(Pe.upArrow){j(dr=>(dr-1+Kt.length)%Kt.length);return}if(Pe.downArrow){j(dr=>(dr+1)%Kt.length);return}let Et=Kt[Math.min(x,Kt.length-1)];if(Pe.tab){ze(Ui(dp(Et))),j(0);return}if(Pe.return){let dr=ct.value.trim(),cr=dr.toLowerCase()===Et.name.toLowerCase()||(Et.aliases??[]).some(Vt=>Vt.toLowerCase()===dr.toLowerCase());if(!cr&&Et.arg)ze(Ui(dp(Et))),j(0);else{let Vt=cr?dr:Et.name;ze(jo),j(0),se(cn=>BI(cn,Vt)),Qs(Vt)}return}}if(Pe.return){qs();return}if(Pe.leftArrow){ze(ba);return}if(Pe.rightArrow){ze(Fa);return}if(Pe.upArrow){let Et=A0(be,ct.value);se(Et.h),ze(Ui(Et.value));return}if(Pe.downArrow){let Et=l0(be);se(Et.h),ze(Ui(Et.value));return}if(Pe.ctrl&&Se==="a"){ze(up);return}if(Pe.ctrl&&Se==="e"){ze(cp);return}if(Pe.ctrl&&Se==="b"){ze(ba);return}if(Pe.ctrl&&Se==="f"){ze(Fa);return}if(Pe.ctrl&&Se==="w"){ze(Ju);return}if(Pe.ctrl&&Se==="u"){ze(mA);return}if(Pe.ctrl&&Se==="k"){ze(Yu);return}if(Pe.backspace||Pe.delete){ze(pA),se(Et=>Et.pos===0?Et:{...Et,pos:0});return}if(Se==="?"&&ct.value===""){ve("help");return}Se&&!Pe.ctrl&&!Pe.meta&&(ze(Et=>hs(Et,Se)),se(Et=>Et.pos===0?Et:{...Et,pos:0}))});let yo=gp(ct.value),on=yo.length>0&&!Ge&&!st&&!Ae,ji=Ur?["manager"]:[],vs=uQ(W?.roles??[],X),Gr=(Vs||"handling your message").replace(/^Manager\s*·\s*/i,"").replace(/[.…]+$/u,""),_s=Ur?cQ(vs,"manager",Gr,Math.max(0,(Date.now()-Ci)/1e3)):vs,Zo=W?y0({...W,roles:_s},X):null,zs=W?.partial?(W.diagnostics??[]).map(Se=>`${Se.section}: ${Se.message}`).join(" \xB7 "):"",xo=W?.observability?.slo.status==="degraded"?W.observability.slo.violations.join(" \xB7 "):"",Xs=ye?`snapshot refresh failed \xB7 ${ye}`:W?.partial?`snapshot partial \xB7 ${zs||"backend reported incomplete state"}`:xo?`SLO degraded \xB7 ${xo}`:le&&!Ee?`event stream reconnecting \xB7 ${le}`:"";return(0,Qn.jsxs)(De,{flexDirection:"column",paddingX:1,children:[(0,Qn.jsx)(C0,{width:v.columns,vertical:Zo?.routing.vertical}),on?null:(0,Qn.jsx)(rQ,{alert:ZI(X)}),Je?(0,Qn.jsx)(xQ,{card:Je,selection:Ut,note:Xe,busy:Kr,error:wn}):Ge?(0,Qn.jsx)(QQ,{state:Ge,width:v.columns}):st?(0,Qn.jsx)(_p,{draft:st}):(0,Qn.jsxs)(Qn.Fragment,{children:[Zo&&!on&&!Ae?(0,Qn.jsx)(CQ,{view:Zo,width:v.columns,height:v.rows,busy:Ur,spentUsd:W?.global_spend_usd,spendStatus:W?.global_spend_status}):null,(0,Qn.jsx)(L0,{events:X,width:v.columns,mode:"all",liveMessageId:zo.current?.messageId,collapsed:on||!!Ae,showIdle:!Zo,showReasoning:Ce}),Ae?(0,Qn.jsx)(EQ,{panel:Ae,snap:W,events:X,viewportRows:v.rows,viewportColumns:v.columns,activeProject:T}):(0,Qn.jsxs)(Qn.Fragment,{children:[Ur&&!on&&(0,Qn.jsx)(tQ,{tick:Bi,phase:Vs,heartbeat:qo,quietS:Do,steps:qn,width:v.columns,elapsedS:Math.max(0,Math.floor((Date.now()-Ci)/1e3))}),(0,Qn.jsxs)(De,{flexDirection:"column",flexShrink:0,children:[(0,Qn.jsx)(Y0,{items:yo,selected:Math.min(x,yo.length-1),maxVisible:J0(v.rows)}),(0,Qn.jsx)(wp,{edit:ct,width:v.columns,rowsBelow:on?0:1})]}),on?null:(0,Qn.jsx)(V0,{notice:ae,health:Xs,width:v.columns})]})]})]})}var Co=Me(qt(),1);var hi=Me(Lt(),1),rh="/new /open /use /run /resume /recover /stop /spec /conversation /file /status /exit";function OQ(e,t){let r=[""],i=0;for(let s of e.replace(/\t/g," ")){if(s===` `){r.push(""),i=0;continue}let a=ln(s);i+a>t&&(r.push(""),i=0),r[r.length-1]+=s,i+=a}return r}function LQ({api:e,initialProject:t="",initialObjective:r=""}){let{exit:i}=ms(),s=hA(),[a,u]=(0,Co.useState)(null),[p,E]=(0,Co.useState)(t),[I,y]=(0,Co.useState)(null),[D,v]=(0,Co.useState)(jo),[T,P]=(0,Co.useState)(""),[Z,ee]=(0,Co.useState)(""),[W,ie]=(0,Co.useState)(!1),[X,$]=(0,Co.useState)(rh),[Ee,ye]=(0,Co.useState)(null),[le,_e]=(0,Co.useState)(0),[ge,ct]=(0,Co.useState)(null),[ze,be]=(0,Co.useState)({project:"",domain:"",profile:"",mode:"design",objective:r});(0,Co.useEffect)(()=>{let te=!1;return e.workflows.catalog().then(Ae=>{te||u(Ae)}).catch(Ae=>{te||ee(String(Ae))}),()=>{te=!0}},[e]),(0,Co.useEffect)(()=>{let te=!1,Ae=!1;if(y(null),!p)return;let Ke=async()=>{if(!Ae){Ae=!0;try{let st=await e.workflows.snapshot(p);te||(y(st),ee(""))}catch(st){te||ee(String(st))}finally{Ae=!1}}};Ke();let ve=setInterval(()=>{Ke()},2e3);return()=>{te=!0,clearInterval(ve)}},[e,p]);async function se(te){if(W)return;let Ae=te.trim();P(""),ie(!0);try{if(ge){if(!Ae)throw new Error(`Provide ${ge}; Escape cancels creation.`);let He={...ze};if(ge==="mode"){if(Ae!=="design"&&Ae!=="verify")throw new Error("Choose design or verify.");He.mode=Ae}else He[ge]=Ae;if(ge==="domain"&&!a?.domains[Ae])throw new Error("Choose one of the listed domains.");if(ge==="profile"&&!a?.domains[He.domain]?.includes(Ae))throw new Error("Choose a listed profile.");be(He);let fe={project:"domain",domain:"profile",profile:"mode",mode:"objective",objective:null}[ge];if(fe){ct(fe);let yt=fe==="domain"?a?.domains.digital_circuit?"digital_circuit":"":fe==="profile"?a?.domains[He.domain][0]||"":fe==="mode"?"design":He.objective;v(Ui(yt));return}let Ce=await e.workflows.create(He);E(Ce.id),u(await e.workflows.catalog()),ct(null),$("Created without model calls. /run starts engineering; plain messages ask Coordinator."),v(jo);return}v(jo);let Ke=Ae.indexOf(" "),ve=Ke<0?Ae:Ae.slice(0,Ke),st=Ke<0?"":Ae.slice(Ke+1).trim();if(ve==="/exit"){i();return}if(ve==="/help"||!Ae){$(rh);return}if(ve==="/new"){ct("project"),v(Ui(st||process.cwd())),ye(null);return}if(ve==="/open"){let He=await e.workflows.open(st);E(He.id),u(await e.workflows.catalog());return}if(ve==="/use"){let He=await e.workflows.snapshot(st);E(He.id);return}if(!p)throw new Error("Create /new or /open an existing work order first.");if(ve==="/file"){let He=await e.workflows.document(p,st);ye(`${He.path}${He.truncated?" (first 128 KiB)":""} ${He.text}`),_e(0);return}if(ve==="/spec"){let He=await e.workflows.snapshot(p);ye(He.plan?`${He.plan.roadmap.join(` diff --git a/frontend/web/dist/assets/AdminDataApp-Bcx_5Da8.js b/frontend/web/dist/assets/AdminDataApp-Bcx_5Da8.js new file mode 100644 index 000000000..6507fb7f1 --- /dev/null +++ b/frontend/web/dist/assets/AdminDataApp-Bcx_5Da8.js @@ -0,0 +1,13 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i,n as a,o,t as ee}from"./query-CUzIxVzm.js";import{H as s,K as c,O as l,k as u,q as d}from"./index-DbdG0NfU.js";import{A as te,C as f,E as p,F as ne,I as re,L as ie,M as ae,N as oe,O as se,P as ce,R as m,S as le,_ as ue,b as de,c as h,d as fe,f as pe,g as me,i as g,j as he,k as ge,l as _e,n as ve,p as ye,r as _,s as v,t as be,u as xe,w as y,x as Se}from"./AppearanceControls-vjVM_spw.js";import{n as Ce,t as we}from"./history-CBChoFHN.js";import{n as Te,t as Ee}from"./code-xml-DMjjpBic.js";import{r as De,t as Oe}from"./useWorkbenchTheme-CXN9ftdE.js";var ke=m(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ae=m(`FileJson`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),je=m(`Menu`,[[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}],[`line`,{x1:`4`,x2:`20`,y1:`6`,y2:`6`,key:`1owob3`}],[`line`,{x1:`4`,x2:`20`,y1:`18`,y2:`18`,key:`yk5zj1`}]]),b=m(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Me=m(`Users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),x=e(t(),1),S=6e4,Ne=12e4,Pe=class extends c{loginURL;constructor(e){super(e.status===401?`数据后台登录已过期,请重新登录。`:e.message,e.status,e.method,e.path,e.status===401?`admin_authentication_required`:e.code),this.name=`AdminAPIError`,this.loginURL=e.status===401?`/admin/login`:null}};function C(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function w(e,t){return`/admin/api/training/${e}/${encodeURIComponent(t.tenant)}/${encodeURIComponent(t.sid)}`}async function T(e,t,n){try{await d(e,t,n)}catch(e){throw e instanceof c&&n.startsWith(`/admin/`)?new Pe(e):e}}function E(e,t=`GET`){return new Pe(new c(`数据后台响应格式不正确。`,502,t,e,`invalid_admin_response`))}async function D(e,t={}){return s(e,{method:`GET`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{Accept:`application/json`},signal:t.signal},S,async t=>{await T(t,`GET`,e);try{return await t.json()}catch{throw E(e)}})}function Fe(e){let t=e?.match(/(?:^|;)\s*filename\*=UTF-8''([^;]+)/i)?.[1],n=e?.match(/(?:^|;)\s*filename\s*=\s*(?:"([^"]*)"|([^;]+))/i),r=n?.[1]??n?.[2]?.trim()??``;if(t)try{r=decodeURIComponent(t.trim())}catch{}return r.length>0&&r.length<=180&&/\.zip$/i.test(r)&&!/[\x00-\x1f\x7f/\\:]/.test(r)&&!r.startsWith(`.`)?r:`argus-observations.zip`}var O={overview(e={}){return D(`/admin/api/training/collaboration`+C({purpose:e.purpose??`internal_training`,offset:e.offset??0,tenant:e.tenant,query:e.query}),e)},detail(e){return D(w(`collaboration`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId}),e)},observations(e){return D(w(`observations`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId,cursor:e.cursor,limit:e.limit}),e)},async identity(e={}){let t=`/admin/status`,n=await D(t,e);if(n?.role!==`admin`||typeof n.readonly!=`boolean`)throw E(t);return n},async workspaceIdentity(e={}){let t=`/invite/status`,n=await D(t,e);if(typeof n?.key_id!=`string`||typeof n.role!=`string`||typeof n.readonly!=`boolean`)throw E(t);return{key_id:n.key_id,role:n.role,readonly:n.readonly}},collector(e={}){return D(`/admin/api/research/status`,e)},projectDirectory(e,t={}){return D(`/admin/api/tenants/${encodeURIComponent(e)}/projects`,t)},audit(e={}){return D(`/admin/api/training/audit`+C({limit:e.limit}),e)},exportObservations(e,t={}){let n=`/admin/api/training/export-observations`;return s(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{"Content-Type":`application/json`,Accept:`application/zip`},body:JSON.stringify({purpose:e.purpose,projects:e.projects.map(({tenant_id:e,sid:t})=>({tenant_id:e,sid:t}))}),signal:t.signal},Ne,async e=>{if(await T(e,`POST`,n),e.headers.get(`Content-Type`)?.split(`;`)[0].trim().toLowerCase()!==`application/zip`)throw E(n,`POST`);return{blob:await e.blob(),filename:Fe(e.headers.get(`Content-Disposition`))}})}},k=new Set([`thinking`,`analysis`,`reasoning`,`redacted_thinking`,`signature`]),Ie=RegExp(`^(${de.join(`|`)})(?:[.-][a-z0-9_.-]+)?$`);function A(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function j(e){return typeof e==`string`?e:``}function M(e){return e==null?``:JSON.stringify(e,null,2)}function N(e){return JSON.stringify([e.tenant_id,e.sid])}function Le(e){return e.title?.trim()||e.sid||`未命名项目`}function Re(e){return(e.mission_title||e.title)?.trim().replace(/^#+\s*/,``).split(` +`)[0]||(e.task_id?`任务 ${e.task_id}`:`项目活动`)}function ze(e){return typeof e==`string`?e===`operator`||e===`unknown`?e:e.match(Ie)?.[1]??`unknown`:`unknown`}function Be(e){return typeof e.role==`string`?ze(e.role):ze(e.runtime?.run_label)}function Ve(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{tenant:t.get(`tenant`),sid:t.get(`sid`),taskId:t.get(`task_id`)??t.get(`task`)}}function He(e){let t=e[0];if(!t)return[];let n=JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id]),r=new Map,i=new Map;for(let t of e){if(JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id])!==n)throw Error(`Cannot merge observations from different project, purpose, or task scopes.`);for(let e of t.episodes){if(N(e)!==N(t)||t.task_id!==null&&e.task_id!==t.task_id)throw Error(`Observation episode does not match its page scope.`);let n=r.get(e.episode_id);if(n&&n.task_id!==e.task_id)throw Error(`Observation episode changed task association.`);let a=i.get(e.episode_id)??new Map;for(let t of e.events){if(!Number.isSafeInteger(t.sequence)||t.sequence<0)throw Error(`Observation sequence is invalid.`);a.set(t.sequence,t)}i.set(e.episode_id,a),r.set(e.episode_id,{...e,events:[]})}}return[...r.values()].sort((e,t)=>e.episode_id-t.episode_id).map(e=>({...e,events:[...i.get(e.episode_id).values()].sort((e,t)=>e.sequence-t.sequence)}))}function P(e){return[e.type,e.role,e.channel].some(e=>typeof e==`string`&&k.has(e))}function Ue(e){return Array.isArray(e)?e.map(e=>{let t=A(e),n=A(t?.function);return!t||!n?``:[j(n.name),typeof n.arguments==`string`?n.arguments:M(n.arguments)].filter(Boolean).join(` +`)}).filter(Boolean).join(` + +`):``}function F(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(F).filter(Boolean).join(` +`);let t=A(e);return!t||P(t)?``:t.type===`text`||t.type===`input_text`||t.type===`output_text`?j(t.text):t.type===`toolCall`||t.type===`tool_call`?[j(t.name),typeof t.arguments==`string`?t.arguments:M(t.arguments)].filter(Boolean).join(` +`):`content`in t||`tool_calls`in t?[F(t.content),Ue(t.tool_calls)].filter(Boolean).join(` + +`):``}function We(e){if(!Array.isArray(e))return``;let t={system:`系统`,developer:`开发者`,user:`用户`,assistant:`模型`,toolResult:`工具返回`,tool:`工具返回`};return e.map(e=>{let n=A(e);if(!n||P(n))return``;let r=[F(n.content),Ue(n.tool_calls)].filter(Boolean).join(` + +`);return r?`${t[j(n.role)]||j(n.role)||`消息`}\n${r}`:``}).filter(Boolean).join(` + +`)}function I(e){let t=e.payload,[n,r]={context:[`模型输入`,`input`],provider_request:[`模型请求`,`input`],message_delta:[`模型公开输出片段`,`output`],message_end:[`模型消息`,`output`],session_message:[`历史会话消息`,`output`],agent_end:[`模型输出`,`output`],tool_call:[`工具调用`,`tool`],tool_result:[`工具返回`,`tool`],tool_execution_start:[`工具执行开始`,`tool`],tool_execution_update:[`工具执行进度`,`tool`],tool_execution_end:[`工具执行结束`,`tool`],settled:[`本段过程结束`,`status`],quarantine:[`过程状态记录`,`status`],capture_warning:[`采集提示`,`status`]}[e.kind]??[`过程事件 · ${e.kind}`,`other`],i=``;e.kind===`message_delta`?i=t.type===`text_delta`||t.type===`toolcall_delta`?j(t.delta):``:[`context`,`provider_request`,`message_end`,`session_message`,`agent_end`].includes(e.kind)?i=We(t.messages):e.kind===`tool_call`?i=M(t.input):e.kind===`tool_result`?i=F(t.content):e.kind===`tool_execution_start`?i=M(t.args):e.kind===`tool_execution_update`?i=F(t.partialResult):e.kind===`tool_execution_end`?i=F(t.result):(e.kind===`quarantine`||e.kind===`capture_warning`)&&(i=j(t.reason));let a=e.kind===`tool_result`||e.kind===`tool_execution_end`;return{key:e.id??String(e.sequence),kind:e.kind,title:n,category:r,text:i,toolName:j(t.toolName)||null,toolCallId:j(t.toolCallId)||null,result:a?t.isError===!0?`error`:t.isError===!1?`success`:`unknown`:null,timestamp:typeof e.observed_at==`number`&&Number.isFinite(e.observed_at)?e.observed_at:null}}function L(){let{locale:e,t,setLocale:n}=u();return{locale:e,t,setLocale:n,text:(t,n)=>e===`zh-CN`?t:n}}function Ge(e,t){return typeof e==`number`&&Number.isFinite(e)?new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e*1e3):`—`}function R(e,t){return y(e)?f(e,e=>l(e,{},t)):{operator:[`用户`,`User`],unknown:[`角色未记录`,`Unassigned role`],system:[`系统`,`System`],developer:[`运行指令`,`Instructions`],user:[`用户 / 任务`,`User / task`],assistant:[`模型`,`Assistant`],tool:[`工具`,`Tool`]}[e]?.[t===`zh-CN`?0:1]??e}function Ke(e,t){return{complete:[`调用已结束`,`Call ended`],capturing:[`尚无结束记录`,`No end record yet`],interrupted:[`采集中断`,`Capture interrupted`],quarantined:[`需检查记录`,`Record needs attention`],approved:[`已验收`,`Reviewed`],not_approved:[`未验收`,`Not reviewed`],unknown:[`结果未确认`,`Outcome unconfirmed`],running:[`采集正常`,`Collector running`],storage_error:[`存储异常`,`Storage unavailable`],starting:[`正在启动`,`Starting`],listening:[`已连接`,`Listening`],unavailable:[`暂不可用`,`Unavailable`]}[e||`unknown`]?.[t===`zh-CN`?0:1]??e??`—`}function qe(e,t){return{context:[`Agent 上下文`,`Agent context`],provider_request:[`模型实际输入`,`Model request`],message_end:[`公开消息`,`Public message`],agent_end:[`调用结果`,`Call output`],message_delta:[`公开输出增量`,`Public output increments`],tool_call:[`工具调用`,`Tool call`],tool_result:[`工具结果`,`Tool result`],tool_execution_start:[`工具开始执行`,`Tool execution started`],tool_execution_update:[`工具执行更新`,`Tool execution update`],tool_execution_end:[`工具执行结束`,`Tool execution ended`],settled:[`采集已收尾`,`Capture settled`],quarantine:[`记录不完整`,`Incomplete record`],capture_warning:[`采集提示`,`Capture notice`]}[e]?.[t===`zh-CN`?0:1]??e}var z=n(),B=e=>JSON.stringify(e,null,2);function V({value:e}){let{text:t}=L();return(0,z.jsxs)(v,{label:t(`原始 JSON`,`Raw JSON`),children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(ue,{text:B(e),label:t(`复制 JSON`,`Copy JSON`),copiedLabel:t(`已复制`,`Copied`)})}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(e)})]})}function Je({message:e,index:t}){let{locale:n,text:r}=L(),[i,a]=(0,x.useState)(!1),o=F(e);return(0,z.jsxs)(`details`,{className:`admin-data-message`,onToggle:e=>a(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,z.jsx)(`strong`,{children:R(e.role||`unknown`,n)}),(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[o.length.toLocaleString(n),` `,r(`字符`,`characters`)]}),(0,z.jsx)(ne,{size:13})]}),i?(0,z.jsxs)(`div`,{className:`admin-data-message-body`,children:[o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(ue,{text:o,label:r(`复制内容`,`Copy text`),copiedLabel:r(`已复制`,`Copied`)}),(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:o})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:r(`这条消息没有公开文本;结构见下方。`,`This message has no public text; its structure is below.`)}),(0,z.jsx)(V,{value:e})]}):null]})}function H({event:e}){let{locale:t,text:n}=L(),r=I(e),i=e.payload,a=Array.isArray(i.messages)?i.messages:[];return(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[e.kind===`provider_request`?(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[typeof i.model==`string`?(0,z.jsx)(g,{children:i.model}):null,typeof i.reasoning_effort==`string`?(0,z.jsx)(g,{children:i.reasoning_effort}):null,(0,z.jsxs)(`span`,{children:[a.length.toLocaleString(t),` `,n(`条消息`,`messages`),` · `,(i.tools?.length||0).toLocaleString(t),` `,n(`个工具定义`,`tool definitions`)]})]}):null,a.length?(0,z.jsx)(`div`,{className:`admin-data-message-list`,children:a.map((e,t)=>(0,z.jsx)(Je,{message:e,index:t},t))}):r.text?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(ue,{text:r.text,label:n(`复制内容`,`Copy text`),copiedLabel:n(`已复制`,`Copied`)})}),r.category===`tool`||e.kind===`message_delta`?(0,z.jsx)(`pre`,{className:`admin-data-code`,children:r.text}):(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:r.text})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:n(`此事件保留了状态和结构,没有公开文本。`,`This event contains status and structure, with no public text.`)}),i.tools?.length?(0,z.jsx)(v,{label:n(`工具定义`,`Tool definitions`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(i.tools)})}):null,(0,z.jsx)(V,{value:e})]})}function U(e){let t=[];for(let n of e){let e=n.kind===`message_delta`?JSON.stringify([n.kind,n.payload.type,n.payload.message_index,n.payload.content_index,n.payload.toolCallId]):`event:${n.sequence}`,r=t[t.length-1];n.kind===`message_delta`&&r?.key===e?r.events.push(n):t.push({key:e,events:[n]})}return t}function W({group:e}){let{locale:t,text:n}=L(),[r,i]=(0,x.useState)(!1),a=e.events[0],o=I(a),ee=o.category===`tool`?ge:o.category===`input`?Ee:b,s=e.events.length>1,c=s?e.events.map(e=>I(e).text).join(``):o.text,l=a.kind===`provider_request`?`${a.payload.messages?.length??0} ${n(`条消息`,`messages`)} · ${a.payload.tools?.length??0} ${n(`个工具`,`tools`)}`:(a.payload.messages?F(a.payload.messages):c).replace(/\s+/g,` `).slice(0,110);return(0,z.jsxs)(`details`,{className:`admin-data-event`,"data-event-kind":a.kind,onToggle:e=>i(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{className:`admin-data-event-icon`,children:(0,z.jsx)(ee,{size:15})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`admin-data-event-title`,children:[(0,z.jsxs)(`strong`,{children:[qe(a.kind,t),o.toolName?` · ${o.toolName}`:``]}),s?(0,z.jsxs)(g,{children:[e.events.length,` `,n(`条增量`,`increments`)]}):null,o.result===`error`?(0,z.jsx)(g,{color:p.error,children:n(`工具报告错误`,`Tool reported an error`)}):null,o.result===`success`?(0,z.jsx)(g,{color:p.success,children:n(`工具报告成功`,`Tool reported success`)}):null]}),l?(0,z.jsx)(`p`,{className:`admin-data-event-preview`,children:l}):null]}),(0,z.jsx)(`span`,{className:`admin-data-event-time`,children:Ge(a.observed_at,t)}),(0,z.jsx)(ne,{size:14})]}),r?s?(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[(0,z.jsx)(ue,{text:c,label:n(`复制输出`,`Copy output`),copiedLabel:n(`已复制`,`Copied`)}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:c}),(0,z.jsx)(V,{value:e.events})]}):(0,z.jsx)(H,{event:a}):null]})}function Ye({episode:e,readonly:t,onDownload:n}){let{locale:r,text:i}=L(),[a,o]=(0,x.useState)(`all`),[ee,s]=(0,x.useState)(0),c=(0,x.useMemo)(()=>U(e.events.filter(e=>{let t=I(e).category;return a===`all`||(a===`tools`?t===`tool`:t===`input`||t===`output`)})),[e.events,a]);(0,x.useEffect)(()=>s(0),[e.episode_id,a]);let l=Math.max(1,Math.ceil(c.length/60)),u=Math.min(ee,l-1),d=c.slice(u*60,u*60+60),te=e.events.length,f=e.collection.event_count,ne=e.quality.approved===!0&&e.quality.state===`approved`;return(0,z.jsxs)(`section`,{className:`admin-data-inspector`,"aria-label":i(`过程详情`,`Process details`),children:[(0,z.jsxs)(`div`,{className:`admin-data-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h3`,{children:[R(e.role,r),` `,(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[`· #`,e.episode_id]})]}),(0,z.jsxs)(`p`,{children:[Ge(e.started_at,r),` · `,e.task_id?`${i(`任务`,`Task`)} ${e.task_id}`:i(`项目级 / 未关联任务`,`Project-level / no task association`)]})]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:t,onClick:()=>n(e),title:t?i(`只读会话不能导出`,`Exports are disabled for read-only sessions`):i(`下载当前已加载的原始记录`,`Download the raw records currently loaded`),children:[(0,z.jsx)(ce,{size:14}),` JSON`]})]}),(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[(0,z.jsx)(g,{children:Ke(e.state,r)}),(0,z.jsx)(g,{color:ne?p.success:void 0,children:ne?i(`已验收`,`Reviewed`):i(`未验收`,`Not reviewed`)}),(0,z.jsxs)(`span`,{children:[i(`已加载`,`Loaded`),` `,te.toLocaleString(r),` / `,f.toLocaleString(r),` `,i(`条事件`,`events`)]}),e.runtime.run_label?(0,z.jsx)(`code`,{children:e.runtime.run_label}):null]}),!e.collection.complete||e.collection.historical_data_unavailable||te(0,z.jsx)(`button`,{type:`button`,"aria-pressed":a===e,className:a===e?`active`:``,onClick:()=>o(e),children:e===`all`?i(`全部事件`,`All events`):e===`messages`?i(`模型输入 / 输出`,`Model input / output`):i(`工具轨迹`,`Tool trace`)},e))}),c.length?(0,z.jsx)(`div`,{className:`admin-data-timeline`,children:d.map(t=>(0,z.jsx)(W,{group:t},`${e.episode_id}:${t.events[0].sequence}`))}):(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(Ae,{size:24}),(0,z.jsx)(`p`,{children:i(`当前已加载的记录中没有此类事件。`,`No events of this type are present in the loaded records.`)})]}),c.length>60?(0,z.jsxs)(`div`,{className:`admin-data-paging`,"aria-label":i(`当前过程的事件分页`,`Event pages for this process`),children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!u,onClick:()=>s(u-1),title:i(`上一段事件`,`Previous event group`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[u*60+1,`–`,Math.min(c.length,u*60+60),` / `,c.length.toLocaleString(r),` `,i(`组事件`,`event groups`)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:u+1>=l,onClick:()=>s(u+1),title:i(`下一段事件`,`Next event group`),children:(0,z.jsx)(Te,{size:14})})]}):null,(0,z.jsx)(V,{value:{...e,events:void 0,loaded_event_count:te}})]})}function Xe(e,t,n=``){let r=new URL(e);return r.searchParams.set(`tenant`,t.tenant_id),r.searchParams.set(`sid`,t.sid),n?r.searchParams.set(`task_id`,n):r.searchParams.delete(`task_id`),r.searchParams.delete(`task`),`${r.pathname}${r.search}${r.hash}`}function Ze(e,t,n,r){if(e.some(e=>N(e)===t))return null;let i=r&&n.sid?e.filter(e=>e.sid===n.sid&&(!n.tenant||e.tenant_id===n.tenant)):[],a=i.length===1?i[0]:void 0;if(r&&n.sid&&!a)return null;let o=a??e[0];return{key:o?N(o):``,taskId:a&&n.taskId||``}}async function Qe(e,t,n){let r=await t(),i=r.role===`trial`&&r.key_id===e.tenant_id;return i&&n(`/?project=${encodeURIComponent(e.sid)}`),{matched:i,identity:r}}var $e=Array.from({length:11},(e,t)=>`trial-${String(t+1).padStart(2,`0`)}`),G=(e,t)=>e<1&&!(t instanceof Pe&&[401,403].includes(t.status));function et(e){let[t,n]=(0,x.useState)(e);return(0,x.useEffect)(()=>{let t=window.setTimeout(()=>n(e),250);return()=>window.clearTimeout(t)},[e]),t}function tt(){let{locale:e,text:t,t:n}=L(),{themeMode:s,cycleTheme:c}=Oe(),l=i(),[u]=(0,x.useState)(()=>Ve(window.location.search)),[d,f]=(0,x.useState)(!!u.sid),[p,ne]=(0,x.useState)(u.tenant||``),[m,ge]=(0,x.useState)(``),[y,Ee]=(0,x.useState)(`internal_training`),[b,S]=(0,x.useState)(0),[Ne,C]=(0,x.useState)(u.tenant&&u.sid?N({tenant_id:u.tenant,sid:u.sid}):``),[w,T]=(0,x.useState)(u.taskId||``),[E,D]=(0,x.useState)(null),[Fe,k]=(0,x.useState)(null),[Ie,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(null),[P,Ue]=(0,x.useState)(()=>new Map),[F,We]=(0,x.useState)(``),[I,qe]=(0,x.useState)(!1),[B,V]=(0,x.useState)(null),Je=et(m),H=r({queryKey:[`admin-data`,`identity`],queryFn:({signal:e})=>O.identity({signal:e}),staleTime:3e4,retry:!1}),U=H.data?.role===`admin`,W=H.data?.readonly!==!1,tt=!!Je||d,K=r({queryKey:[`admin-data`,`overview`,y,p,tt?`all-pages`:b],queryFn:async({signal:e})=>{let t=await O.overview({purpose:y,tenant:p,offset:tt?0:b,signal:e}),n=[t],r=new Set([t.offset]);for(;tt&&n[n.length-1].has_more_projects;){let t=n[n.length-1].next_offset;if(t===null||r.has(t))throw Error(`Invalid project pagination`);r.add(t),n.push(await O.overview({purpose:y,tenant:p,offset:t,signal:e}))}return n},enabled:U,retry:G,refetchInterval:!tt&&2e4}),q=(0,x.useMemo)(()=>{let e=K.data;if(!e?.length)return;let t=e[e.length-1];return{...e[0],projects:e.flatMap(e=>e.projects),tasks:e.flatMap(e=>e.tasks),has_more_projects:t.has_more_projects,next_offset:t.next_offset,completeness:{...e[0].completeness,page_truncated:e.some(e=>e.completeness.page_truncated)}}},[K.data]),J=r({queryKey:[`admin-data`,`collector`],queryFn:({signal:e})=>O.collector({signal:e}),enabled:U,retry:G,refetchInterval:15e3}),nt=r({queryKey:[`admin-data`,`audit`],queryFn:({signal:e})=>O.audit({signal:e}),enabled:U&&j===`audit`,retry:G}),rt=q?.projects??[],it=(0,x.useMemo)(()=>[...new Set(rt.map(e=>e.tenant_id))].sort(),[rt]),at=o({queries:it.map(e=>({queryKey:[`admin-data`,`directory`,e],queryFn:({signal:t})=>O.projectDirectory(e,{signal:t}),enabled:U,staleTime:6e4,retry:G}))}),ot=new Map;at.forEach((e,t)=>{for(let n of e.data?.projects??[])n.title&&ot.set(N({tenant_id:it[t],sid:n.id}),n.title)});let st=e=>ot.get(N(e))||Le(e),ct=Je.trim().toLocaleLowerCase(e),lt=rt.filter(t=>!ct||[st(t),t.title,t.tenant_id,t.sid,...(q?.tasks??[]).filter(e=>N(e)===N(t)).flatMap(e=>[Re(e),e.task_id||``])].some(t=>t.toLocaleLowerCase(e).includes(ct))),Y=lt.find(e=>N(e)===Ne)??null,ut=(q?.tasks??[]).filter(e=>Y&&N(e)===N(Y)),dt=ut.filter(e=>e.task_id),ft=ut.find(e=>e.task_id===w)??null;(0,x.useEffect)(()=>{if(!q)return;let e=Ze(lt,Ne,u,d);if(!e)return;C(e.key),k(null),D(null),T(e.taskId);let t=lt.find(t=>N(t)===e.key);t&&xt(t,e.taskId)},[q,Ne,u,d,Je,at.map(e=>e.dataUpdatedAt).join(`,`)]);let pt=[y,Y?.tenant_id,Y?.sid,w||null],X=r({queryKey:[`admin-data`,`detail`,...pt],queryFn:({signal:e})=>O.detail({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,signal:e}),enabled:U&&!!Y?.eligible,retry:G}),Z=ft??(w&&X.data?.task_id===w?X.data:null),mt=!w||!!Z,Q=ee({queryKey:[`admin-data`,`observations`,...pt],queryFn:({pageParam:e,signal:t})=>O.observations({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,cursor:e,limit:200,signal:t}),initialPageParam:null,getNextPageParam:e=>e.pagination.has_more?e.pagination.next_cursor:void 0,enabled:U&&!!Y?.eligible&&mt,retry:G}),ht=(0,x.useMemo)(()=>He(Q.data?.pages??[]),[Q.data]),gt=ht.filter(e=>E===null||Be(e)===E),_t=gt.find(e=>e.episode_id===Fe)??gt[0]??null,vt=new Map;for(let e of w?Z?[Z]:[]:ut)for(let t of e.roles){let e=ze(t.role),n=vt.get(e);vt.set(e,{...t,role:e,observations:(n?.observations||0)+t.observations,episodes:(n?.episodes||0)+t.episodes,tool_pairs:(n?.tool_pairs||0)+t.tool_pairs})}let yt=ht.reduce((e,t)=>e+t.events.length,0),bt=P.size?[...P.values()]:Y?[Y]:[],$=a({mutationFn:()=>{if(W||!bt.length||bt.length>20)throw Error(t(`请选择最多 20 个可导出的项目。`,`Select up to 20 eligible projects.`));return O.exportObservations({purpose:y,projects:bt})},onSuccess:e=>{ve(e.blob,e.filename),We(t(`全部保留过程已下载。`,`All retained process data downloaded.`)),l.invalidateQueries({queryKey:[`admin-data`,`audit`]})}}),xt=(e,t=``)=>{window.history.replaceState(window.history.state,``,Xe(window.location.href,e,t))},St=e=>{f(!1),C(N(e)),T(``),D(null),k(null),A(!1),xt(e)},Ct=e=>{T(e),k(null),D(null),Y&&xt(Y,e)},wt=e=>Ue(t=>{let n=new Map(t),r=N(e);return n.has(r)?n.delete(r):n.size<20&&n.set(r,e),n}),Tt=()=>{l.invalidateQueries({queryKey:[`admin-data`]})},Et=e=>{W||ve(new Blob([JSON.stringify({scope:`loaded_observations`,loaded_event_count:e.events.length,episode:e},null,2)],{type:`application/json`}),`${e.tenant_id}-${e.sid}-process-${e.episode_id}.json`)},Dt=async()=>{if(!(!Y||I)){qe(!0);try{let e=await Qe(Y,()=>O.workspaceIdentity(),e=>window.location.assign(e));V(e.identity.role===`trial`?e.identity.key_id:null),e.matched||M(`workspace`)}catch{V(null),M(`workspace`)}finally{qe(!1)}}},Ot=e=>e instanceof Pe&&e.status===401?t(`数据后台登录已过期,请重新登录。`,`Your administrator session expired. Sign in again.`):e instanceof Error?e.message:t(`暂时无法读取数据。`,`Data is temporarily unavailable.`);return(0,z.jsxs)(fe,{className:`admin-data-workspace h-full`,style:{"--sidebar-width":`292px`},children:[Ie?(0,z.jsx)(`button`,{type:`button`,className:`admin-data-scrim lg:hidden`,"aria-label":t(`关闭项目列表`,`Close projects`),onClick:()=>A(!1)}):null,(0,z.jsxs)(pe,{mobileOpen:Ie,className:`admin-data-sidebar`,"aria-label":t(`数据项目`,`Data projects`),children:[(0,z.jsxs)(`div`,{className:`admin-data-sidebar-brand`,children:[(0,z.jsx)(De,{size:25}),(0,z.jsx)(g,{children:t(`数据`,`Data`)}),(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button ml-auto lg:hidden`,onClick:()=>A(!1),"aria-label":n(`common.close`),children:(0,z.jsx)(se,{size:18})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-heading`,children:[(0,z.jsx)(`span`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`span`,{children:q?.total_projects??`—`})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-controls`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`账号`,`Account`)}),(0,z.jsxs)(`select`,{"aria-label":t(`筛选账号`,`Filter account`),value:p,onChange:e=>{f(!1),ne(e.target.value),S(0),T(``)},children:[(0,z.jsx)(`option`,{value:``,children:t(`全部 11 个账号`,`All 11 accounts`)}),$e.map(e=>(0,z.jsx)(`option`,{children:e},e))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-search`,children:[(0,z.jsx)(he,{size:15}),(0,z.jsx)(`input`,{"aria-label":t(`搜索项目、任务或 SID`,`Search projects, tasks or SID`),placeholder:t(`搜索项目或任务…`,`Search projects or tasks…`),value:m,onChange:e=>{f(!1),ge(e.target.value),S(0)}})]})]}),(0,z.jsxs)(`div`,{className:`admin-data-projects`,"aria-busy":K.isFetching,children:[K.isPending&&U?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(h,{}),(0,z.jsx)(`p`,{children:t(`正在读取项目…`,`Loading projects…`)})]}):null,K.error?(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`alert`,children:[Ot(K.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void K.refetch(),children:n(`common.retry`)})]}):null,!K.isPending&&!lt.length&&!K.error?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(ke,{size:22}),(0,z.jsx)(`p`,{children:t(`没有符合筛选条件的项目。`,`No projects match these filters.`)})]}):null,lt.map(n=>{let r=N(n)===Ne,i=(q?.tasks??[]).filter(e=>N(e)===N(n)).reduce((e,t)=>e+t.collection.retained_episodes,0);return(0,z.jsxs)(`div`,{"data-testid":`project-${n.tenant_id}-${n.sid}`,className:`admin-data-project ${r?`active`:``}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-project-open`,"aria-current":r?`page`:void 0,onClick:()=>St(n),children:[(0,z.jsx)(`span`,{className:`admin-data-project-title`,children:st(n)}),(0,z.jsxs)(`span`,{className:`admin-data-project-id`,children:[n.tenant_id,` · `,n.sid]}),(0,z.jsx)(`span`,{className:`admin-data-project-meta`,children:n.eligible?i?`${i.toLocaleString(e)} ${t(`段保留过程`,`retained processes`)}`:t(`尚无保留过程`,`No process data retained`):t(`当前用途不可读取`,`Unavailable for this purpose`)})]}),(0,z.jsx)(`input`,{type:`checkbox`,className:`admin-data-project-check`,"aria-label":`${t(`选择导出项目`,`Select project for export`)} ${st(n)} ${n.tenant_id} ${n.sid}`,checked:P.has(N(n)),disabled:W||!n.eligible||P.size>=20&&!P.has(N(n)),onChange:()=>wt(n)})]},N(n))})]}),(0,z.jsxs)(`div`,{className:`admin-data-paging`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!b||K.isFetching,onClick:()=>S(Math.max(0,b-20)),title:t(`上一页项目`,`Previous project page`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[t(`第`,`Page`),` `,Math.floor(b/20)+1,` `,t(`页`,``)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!q?.has_more_projects||K.isFetching,onClick:()=>S(q?.next_offset??b+20),title:t(`下一页项目`,`Next project page`),children:(0,z.jsx)(Te,{size:14})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-footer`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`audit`),children:[(0,z.jsx)(we,{size:15}),t(`导出记录`,`Export history`)]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`diagnostics`),children:[(0,z.jsx)(ie,{size:15}),t(`采集诊断`,`Capture diagnostics`)]}),(0,z.jsxs)(`a`,{href:`/invite`,children:[(0,z.jsx)(oe,{size:15}),t(`用户工作空间`,`User workspace`)]})]})]}),(0,z.jsxs)(`main`,{className:`admin-data-surface`,children:[(0,z.jsxs)(xe,{children:[(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button lg:hidden`,onClick:()=>A(!0),"aria-label":t(`打开项目列表`,`Open projects`),children:(0,z.jsx)(je,{size:18})}),(0,z.jsx)(`span`,{className:`admin-data-header-title`,children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(g,{children:W?t(`只读管理员`,`Read-only administrator`):t(`管理员`,`Administrator`)}),(0,z.jsxs)(`div`,{className:`ml-auto flex items-center gap-1 sm:gap-2`,children:[(0,z.jsx)(be,{themeMode:s,onCycleTheme:c}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:Tt,disabled:K.isFetching||!U,title:t(`刷新数据`,`Refresh data`),children:K.isFetching?(0,z.jsx)(h,{}):(0,z.jsx)(ae,{size:14})}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!Y?.eligible||$.isPending,onClick:()=>{We(``),M(`export`)},children:[(0,z.jsx)(ce,{size:14}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:t(`导出`,`Export`)})]})]})]}),(0,z.jsx)(`div`,{className:`admin-data-content`,children:U?Y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-project-heading`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`p`,{className:`admin-data-eyebrow`,children:[(0,z.jsx)(ke,{size:13}),t(`已授权的过程数据`,`Authorized process data`)]}),(0,z.jsx)(`h1`,{children:st(Y)}),(0,z.jsxs)(`div`,{className:`admin-data-project-identity`,children:[(0,z.jsxs)(`code`,{children:[Y.tenant_id,` / `,Y.sid]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:I,onClick:()=>void Dt(),children:[I?(0,z.jsx)(h,{}):(0,z.jsx)(oe,{size:13}),t(`在用户端打开`,`Open in user workspace`)]}),(0,z.jsx)(ue,{text:`${window.location.origin}/admin/data?tenant=${encodeURIComponent(Y.tenant_id)}&sid=${encodeURIComponent(Y.sid)}`,label:t(`复制后台链接`,`Copy data link`),copiedLabel:t(`已复制`,`Copied`)})]})]}),(0,z.jsxs)(`span`,{className:`admin-data-collector-status`,children:[(0,z.jsx)(_e,{ok:J.data?.state===`running`}),J.error?t(`采集状态暂不可读`,`Capture status unavailable`):Ke(J.data?.state,e)]})]}),(0,z.jsxs)(`div`,{className:`admin-data-context-bar`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field flex-1`,children:[(0,z.jsx)(`span`,{children:t(`查看范围`,`View scope`)}),(0,z.jsxs)(`select`,{value:w,onChange:e=>Ct(e.target.value),"aria-label":t(`选择任务或整个项目`,`Select a task or the entire project`),children:[(0,z.jsx)(`option`,{value:``,children:t(`整个项目 · 包含任务创建前的过程`,`Entire project · includes pre-task processes`)}),w&&!dt.some(e=>e.task_id===w)?(0,z.jsxs)(`option`,{value:w,children:[Z?Re(Z):t(`链接中的任务`,`Linked task`),` · `,w]}):null,dt.map(e=>(0,z.jsxs)(`option`,{value:e.task_id,children:[Re(e),` · `,e.task_id]},e.task_id))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`数据用途`,`Data purpose`)}),(0,z.jsxs)(`select`,{value:y,onChange:e=>{Ee(e.target.value),Ue(new Map),S(0)},children:[(0,z.jsx)(`option`,{value:`internal_training`,children:t(`内部训练`,`Internal training`)}),(0,z.jsx)(`option`,{value:`external_sharing`,children:t(`对外共享`,`External sharing`)})]})]})]}),Y.eligible?(0,z.jsxs)(z.Fragment,{children:[w&&Z?(0,z.jsxs)(v,{label:t(`任务目标与来源`,`Task objective and source`),children:[(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:Z.objective||Z.request?.text||Z.title})}),(0,z.jsx)(`code`,{children:Z.task_id})]}):null,mt?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-role-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h2`,{children:[(0,z.jsx)(Me,{size:17}),t(`多 Agent 过程`,`Multi-agent processes`)]}),(0,z.jsx)(`p`,{children:t(`查看各角色实际留下的记录。角色缺失、中断和质量验收分别标记。`,`Inspect the records each role actually produced. Missing roles, interruptions and review status are shown separately.`)})]}),(0,z.jsx)(`button`,{type:`button`,className:`admin-data-text-button ${E===null?`active`:``}`,onClick:()=>{D(null),k(null)},children:t(`全部角色`,`All roles`)})]}),(0,z.jsx)(`div`,{className:`admin-data-roles`,children:de.map(r=>{let i=vt.get(r),a=Math.max(i?.episodes||0,ht.filter(e=>Be(e)===r).length),o=ht.filter(e=>Be(e)===r).length;return(0,z.jsxs)(`button`,{type:`button`,"data-testid":`role-${r}`,className:`admin-data-role ${E===r?`active`:``}`,style:{"--role-color":Se(r)},"aria-pressed":E===r,onClick:()=>{D(r),k(null)},children:[(0,z.jsxs)(`span`,{className:`admin-data-role-label`,children:[(0,z.jsx)(`span`,{className:`admin-data-role-mark`,children:R(r,e).slice(0,1)}),(0,z.jsx)(`strong`,{children:R(r,e)}),(0,z.jsx)(`span`,{children:r})]}),(0,z.jsx)(`span`,{className:`admin-data-role-description`,children:le(r,n)}),(0,z.jsx)(`span`,{className:`admin-data-role-count`,children:a?`${a.toLocaleString(e)} ${t(`段过程`,`processes`)}`:i?.observations?t(`仅有活动记录`,`Activity records only`):t(`尚未采到记录`,`No records captured`)}),(0,z.jsx)(`span`,{className:`admin-data-role-footnote`,children:o?`${t(`正文已加载`,`Content loaded`)} ${o.toLocaleString(e)}`:t(`按原始记录归属角色`,`Role comes from recorded metadata`)})]},r)})}),vt.get(`unknown`)?.episodes||ht.some(e=>Be(e)===`unknown`)?(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-unknown`,onClick:()=>{D(`unknown`),k(null)},children:[(0,z.jsx)(Ae,{size:14}),t(`另有角色未记录的过程,保留原样查看`,`Some processes have no recorded role. View them as captured.`),` `,(0,z.jsx)(Te,{size:13})]}):null,(0,z.jsxs)(`div`,{className:`admin-data-record-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{children:E?R(E,e):t(`全部保留过程`,`All retained processes`)}),(0,z.jsxs)(`p`,{children:[ht.length.toLocaleString(e),` `,t(`段已加载`,`processes loaded`),` · `,yt.toLocaleString(e),` `,t(`条原始事件`,`raw events`),` `,Q.hasNextPage?t(`· 还有后续页`,`· more pages available`):``]})]}),gt.length?(0,z.jsx)(`select`,{className:`admin-data-episode-select`,"aria-label":t(`选择过程记录`,`Select a process`),value:_t?.episode_id??``,onChange:e=>k(Number(e.target.value)),children:gt.map(t=>(0,z.jsxs)(`option`,{"data-testid":`episode-${t.episode_id}`,value:t.episode_id,children:[`#`,t.episode_id,` · `,R(t.role,e),` · `,Ge(t.started_at,e)]},t.episode_id))}):null]}),Q.error?(0,z.jsxs)(`div`,{role:`alert`,className:`admin-data-notice`,children:[Ot(Q.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void Q.refetch(),children:n(`common.retry`)})]}):null,_t?(0,z.jsx)(Ye,{episode:_t,readonly:W,onDownload:Et},_t.episode_id):(0,z.jsxs)(`div`,{className:`admin-data-empty admin-data-record-empty`,children:[Q.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(Ae,{size:28}),(0,z.jsx)(`p`,{children:Q.isPending?t(`正在读取真实过程…`,`Loading recorded processes…`):E&&(vt.get(E)?.episodes||0)>0?t(`该角色有记录,当前页尚未加载其正文。`,`This role has recorded processes; their content is on a later page.`):t(`当前范围没有保留的模型过程。项目活动不等同于完整模型轨迹。`,`No model processes are retained in this scope. Project activity does not establish a complete model trace.`)})]}),Q.hasNextPage?(0,z.jsx)(`div`,{className:`admin-data-load-more`,"data-testid":`load-more-observations`,children:(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:Q.isFetchingNextPage,onClick:()=>void Q.fetchNextPage(),children:[Q.isFetchingNextPage?(0,z.jsx)(h,{}):(0,z.jsx)(Te,{size:14}),t(`加载后续原始记录`,`Load more original records`)]})}):null,X.data?.segments.some(e=>e.source_kind!==`tool_episode`)?(0,z.jsxs)(v,{label:t(`项目活动与任务来源`,`Project activity and task sources`),children:[(0,z.jsx)(`div`,{className:`admin-data-activity`,children:X.data.segments.filter(e=>e.source_kind!==`tool_episode`).map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:R(t.role,e)}),(0,z.jsx)(`span`,{children:t.summary}),(0,z.jsx)(`time`,{children:Ge(t.started_at,e)})]},t.id))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`活动顺序来自记录时间,不表示已证实的 Agent 交接。`,`Activity follows recorded timestamps; it does not establish an agent handoff.`)})]}):null,(0,z.jsxs)(`p`,{className:`admin-data-bottom-note`,children:[(0,z.jsx)(te,{size:14}),t(`过程已采集不代表任务成功,也不代表训练质量已验收。原始记录保留缺失和中断状态。`,`Captured processes do not establish task success or training quality. Missing data and interruptions remain visible.`)]})]}):(0,z.jsx)(`div`,{className:`admin-data-notice`,role:`status`,children:X.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(h,{}),t(`正在核对链接中的任务…`,`Checking the linked task…`)]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{children:[X.error instanceof Pe&&X.error.status===404?t(`链接中的任务 ID 不存在或当前用途下不可读取。这不表示项目没有过程数据。`,`The linked task ID does not exist or is unavailable for this purpose. This does not mean the project has no process data.`):t(`暂时无法核对该任务,请重试或查看整个项目。`,`This task could not be verified. Retry or view the entire project.`),` `,(0,z.jsx)(`code`,{children:w})]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>Ct(``),children:t(`查看整个项目`,`View entire project`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void X.refetch(),children:n(`common.retry`)})]})})]}):(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`status`,children:[t(`当前用途下没有可读取的授权记录。请选择其他项目或数据用途。`,`No authorized records are available for this purpose. Choose another project or purpose.`),(0,z.jsx)(v,{children:(0,z.jsx)(`pre`,{children:Y.reason})})]})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(ke,{size:32}),(0,z.jsx)(`h1`,{children:d&&u.sid?t(`链接中的项目未找到`,`Linked project not found`):t(`选择一个项目`,`Select a project`)}),(0,z.jsx)(`p`,{children:d&&u.sid?t(`当前账号与用途下找不到此 SID,没有替你打开其他项目。请检查链接或选择左侧项目。`,`This SID is not available for the selected account and purpose. Check the link or choose a project from the list.`):t(`从左侧查看各账号的真实过程数据。`,`Choose a project to inspect its recorded processes.`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>A(!0),children:t(`浏览项目`,`Browse projects`)})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(De,{size:38}),(0,z.jsx)(`h1`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`p`,{children:H.error?Ot(H.error):t(`正在验证管理员身份…`,`Checking administrator access…`)}),H.error?(0,z.jsx)(`a`,{className:`brand-button brand-button-primary`,href:`/admin/login`,children:t(`管理员登录`,`Administrator sign in`)}):(0,z.jsx)(h,{})]})})]}),(0,z.jsx)(ye,{open:j===`workspace`,onClose:()=>M(null),label:t(`打开用户工作空间`,`Open user workspace`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`需要对应的用户账号`,`Use the matching user account`)}),(0,z.jsxs)(`p`,{children:[t(`这个项目属于`,`This project belongs to`),` `,(0,z.jsx)(`strong`,{children:Y?.tenant_id}),t(`。`,`. `),B?(0,z.jsxs)(z.Fragment,{children:[t(`当前用户端账号是`,`Your current user account is`),` `,(0,z.jsx)(`strong`,{children:B}),t(`。`,`. `)]}):t(`你尚未登录用户工作空间。`,`You are not signed in to a user workspace.`)]}),(0,z.jsx)(`p`,{children:t(`请在用户端使用对应邀请码登录,再打开这个项目。管理员登录不会切换用户账号。`,`Sign in to the user workspace with the matching invitation before opening this project. Administrator access does not switch your user account.`)}),(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(`a`,{className:`brand-button brand-button-primary inline-flex items-center gap-2`,href:`/invite`,target:`_blank`,rel:`noopener`,children:[t(`打开用户登录入口`,`Open user sign in`),(0,z.jsx)(oe,{size:14})]})]})]})}),(0,z.jsx)(ye,{open:j===`export`,onClose:()=>M(null),label:t(`导出全部保留过程`,`Export all retained processes`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出全部保留过程`,`Export all retained processes`)}),(0,z.jsx)(`p`,{children:t(`ZIP 包含所选项目的全部已保留输入、输出和工具轨迹,包括未验收、未结束和失败的记录。`,`The ZIP includes all retained inputs, outputs and tool traces for these projects, including unreviewed, unfinished and failed records.`)}),(0,z.jsx)(`ul`,{className:`admin-data-export-projects`,children:bt.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(re,{size:14}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:st(e)}),(0,z.jsxs)(`code`,{children:[e.tenant_id,` / `,e.sid]})]})]},N(e)))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`可在项目列表勾选多个项目;一次最多 20 个。`,`Use project checkboxes to select up to 20 projects per export.`)}),W?(0,z.jsx)(`p`,{role:`status`,children:t(`只读管理员不能导出数据。`,`Read-only administrators cannot export data.`)}):null,$.error?(0,z.jsx)(`p`,{role:`alert`,className:`admin-data-notice`,children:Ot($.error)}):null,F?(0,z.jsx)(`p`,{role:`status`,children:F}):null,(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!bt.length||$.isPending,onClick:()=>$.mutate(),children:[$.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(ce,{size:14}),t(`下载 ZIP`,`Download ZIP`)]})]})]})}),(0,z.jsx)(ye,{open:j===`audit`,onClose:()=>M(null),label:t(`导出记录`,`Export history`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出记录`,`Export history`)}),(0,z.jsx)(`p`,{children:t(`服务器记录的导出范围、操作身份与结果。`,`Server-recorded export scope, operator and outcome.`)}),nt.isPending?(0,z.jsx)(h,{}):nt.error?(0,z.jsx)(`p`,{role:`alert`,children:Ot(nt.error)}):nt.data?.events.length?(0,z.jsx)(`div`,{className:`admin-data-table-wrap`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:t(`时间`,`Time`)}),(0,z.jsx)(`th`,{children:t(`操作`,`Action`)}),(0,z.jsx)(`th`,{children:t(`身份 / 用途`,`Actor / purpose`)}),(0,z.jsx)(`th`,{children:t(`结果`,`Outcome`)})]})}),(0,z.jsx)(`tbody`,{children:nt.data.events.map(n=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:Ge(n.created_at,e)}),(0,z.jsxs)(`td`,{children:[n.action,(0,z.jsxs)(`small`,{children:[n.projects??`—`,` `,t(`个项目`,`projects`)]})]}),(0,z.jsxs)(`td`,{children:[n.actor,(0,z.jsx)(`small`,{children:n.purpose===`external_sharing`?t(`对外共享`,`External sharing`):t(`内部训练`,`Internal training`)})]}),(0,z.jsx)(`td`,{children:n.outcome})]},n.id))})]})}):(0,z.jsx)(`p`,{children:t(`尚无导出记录。`,`No export history yet.`)})]})}),(0,z.jsx)(ye,{open:j===`diagnostics`,onClose:()=>M(null),label:t(`采集诊断`,`Capture diagnostics`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`采集诊断`,`Capture diagnostics`)}),(0,z.jsx)(`p`,{children:J.error?Ot(J.error):Ke(J.data?.state,e)}),(0,z.jsx)(`div`,{className:`admin-data-diagnostics`,children:Object.entries(J.data?.tool_capture?.tenants??{}).map(([n,r])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:Ke(r.state,e)}),(0,z.jsxs)(`span`,{children:[r.counts.events_received??0,` `,t(`条接收事件`,`events received`)]}),r.last_error_code?(0,z.jsx)(`code`,{children:r.last_error_code}):null]},n))}),(0,z.jsx)(v,{label:t(`完整诊断数据`,`Full diagnostic data`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:JSON.stringify({collector:J.data,project:Y,collection:X.data?.collection,gaps:X.data?.gaps,completeness:q?.completeness},null,2)})})]})})]})}export{tt as default,ve as saveDownload}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AdminDataApp-BdHngqo1.js b/frontend/web/dist/assets/AdminDataApp-BdHngqo1.js new file mode 100644 index 000000000..d35264cf4 --- /dev/null +++ b/frontend/web/dist/assets/AdminDataApp-BdHngqo1.js @@ -0,0 +1,13 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i,n as a,o,t as ee}from"./query-CUzIxVzm.js";import{H as s,K as c,O as l,k as u,q as d}from"./index-Cb5-aRKO.js";import{A as te,C as f,E as p,F as ne,I as re,L as ie,M as ae,N as oe,O as se,P as ce,R as m,S as le,_ as ue,b as de,c as h,d as fe,f as pe,g as me,i as g,j as he,k as ge,l as _e,n as ve,p as ye,r as _,s as v,t as be,u as xe,w as y,x as Se}from"./AppearanceControls-BNJdEiGG.js";import{n as Ce,t as we}from"./history-DuGaxgzd.js";import{n as Te,t as Ee}from"./code-xml-C6UZnqwl.js";import{r as De,t as Oe}from"./useWorkbenchTheme-Bu46ZOFm.js";var ke=m(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ae=m(`FileJson`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),je=m(`Menu`,[[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}],[`line`,{x1:`4`,x2:`20`,y1:`6`,y2:`6`,key:`1owob3`}],[`line`,{x1:`4`,x2:`20`,y1:`18`,y2:`18`,key:`yk5zj1`}]]),b=m(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Me=m(`Users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),x=e(t(),1),S=6e4,Ne=12e4,Pe=class extends c{loginURL;constructor(e){super(e.status===401?`数据后台登录已过期,请重新登录。`:e.message,e.status,e.method,e.path,e.status===401?`admin_authentication_required`:e.code),this.name=`AdminAPIError`,this.loginURL=e.status===401?`/admin/login`:null}};function C(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function w(e,t){return`/admin/api/training/${e}/${encodeURIComponent(t.tenant)}/${encodeURIComponent(t.sid)}`}async function T(e,t,n){try{await d(e,t,n)}catch(e){throw e instanceof c&&n.startsWith(`/admin/`)?new Pe(e):e}}function E(e,t=`GET`){return new Pe(new c(`数据后台响应格式不正确。`,502,t,e,`invalid_admin_response`))}async function D(e,t={}){return s(e,{method:`GET`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{Accept:`application/json`},signal:t.signal},S,async t=>{await T(t,`GET`,e);try{return await t.json()}catch{throw E(e)}})}function Fe(e){let t=e?.match(/(?:^|;)\s*filename\*=UTF-8''([^;]+)/i)?.[1],n=e?.match(/(?:^|;)\s*filename\s*=\s*(?:"([^"]*)"|([^;]+))/i),r=n?.[1]??n?.[2]?.trim()??``;if(t)try{r=decodeURIComponent(t.trim())}catch{}return r.length>0&&r.length<=180&&/\.zip$/i.test(r)&&!/[\x00-\x1f\x7f/\\:]/.test(r)&&!r.startsWith(`.`)?r:`argus-observations.zip`}var O={overview(e={}){return D(`/admin/api/training/collaboration`+C({purpose:e.purpose??`internal_training`,offset:e.offset??0,tenant:e.tenant,query:e.query}),e)},detail(e){return D(w(`collaboration`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId}),e)},observations(e){return D(w(`observations`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId,cursor:e.cursor,limit:e.limit}),e)},async identity(e={}){let t=`/admin/status`,n=await D(t,e);if(n?.role!==`admin`||typeof n.readonly!=`boolean`)throw E(t);return n},async workspaceIdentity(e={}){let t=`/invite/status`,n=await D(t,e);if(typeof n?.key_id!=`string`||typeof n.role!=`string`||typeof n.readonly!=`boolean`)throw E(t);return{key_id:n.key_id,role:n.role,readonly:n.readonly}},collector(e={}){return D(`/admin/api/research/status`,e)},projectDirectory(e,t={}){return D(`/admin/api/tenants/${encodeURIComponent(e)}/projects`,t)},audit(e={}){return D(`/admin/api/training/audit`+C({limit:e.limit}),e)},exportObservations(e,t={}){let n=`/admin/api/training/export-observations`;return s(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{"Content-Type":`application/json`,Accept:`application/zip`},body:JSON.stringify({purpose:e.purpose,projects:e.projects.map(({tenant_id:e,sid:t})=>({tenant_id:e,sid:t}))}),signal:t.signal},Ne,async e=>{if(await T(e,`POST`,n),e.headers.get(`Content-Type`)?.split(`;`)[0].trim().toLowerCase()!==`application/zip`)throw E(n,`POST`);return{blob:await e.blob(),filename:Fe(e.headers.get(`Content-Disposition`))}})}},k=new Set([`thinking`,`analysis`,`reasoning`,`redacted_thinking`,`signature`]),Ie=RegExp(`^(${de.join(`|`)})(?:[.-][a-z0-9_.-]+)?$`);function A(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function j(e){return typeof e==`string`?e:``}function M(e){return e==null?``:JSON.stringify(e,null,2)}function N(e){return JSON.stringify([e.tenant_id,e.sid])}function Le(e){return e.title?.trim()||e.sid||`未命名项目`}function Re(e){return(e.mission_title||e.title)?.trim().replace(/^#+\s*/,``).split(` +`)[0]||(e.task_id?`任务 ${e.task_id}`:`项目活动`)}function ze(e){return typeof e==`string`?e===`operator`||e===`unknown`?e:e.match(Ie)?.[1]??`unknown`:`unknown`}function Be(e){return typeof e.role==`string`?ze(e.role):ze(e.runtime?.run_label)}function Ve(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{tenant:t.get(`tenant`),sid:t.get(`sid`),taskId:t.get(`task_id`)??t.get(`task`)}}function He(e){let t=e[0];if(!t)return[];let n=JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id]),r=new Map,i=new Map;for(let t of e){if(JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id])!==n)throw Error(`Cannot merge observations from different project, purpose, or task scopes.`);for(let e of t.episodes){if(N(e)!==N(t)||t.task_id!==null&&e.task_id!==t.task_id)throw Error(`Observation episode does not match its page scope.`);let n=r.get(e.episode_id);if(n&&n.task_id!==e.task_id)throw Error(`Observation episode changed task association.`);let a=i.get(e.episode_id)??new Map;for(let t of e.events){if(!Number.isSafeInteger(t.sequence)||t.sequence<0)throw Error(`Observation sequence is invalid.`);a.set(t.sequence,t)}i.set(e.episode_id,a),r.set(e.episode_id,{...e,events:[]})}}return[...r.values()].sort((e,t)=>e.episode_id-t.episode_id).map(e=>({...e,events:[...i.get(e.episode_id).values()].sort((e,t)=>e.sequence-t.sequence)}))}function P(e){return[e.type,e.role,e.channel].some(e=>typeof e==`string`&&k.has(e))}function Ue(e){return Array.isArray(e)?e.map(e=>{let t=A(e),n=A(t?.function);return!t||!n?``:[j(n.name),typeof n.arguments==`string`?n.arguments:M(n.arguments)].filter(Boolean).join(` +`)}).filter(Boolean).join(` + +`):``}function F(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(F).filter(Boolean).join(` +`);let t=A(e);return!t||P(t)?``:t.type===`text`||t.type===`input_text`||t.type===`output_text`?j(t.text):t.type===`toolCall`||t.type===`tool_call`?[j(t.name),typeof t.arguments==`string`?t.arguments:M(t.arguments)].filter(Boolean).join(` +`):`content`in t||`tool_calls`in t?[F(t.content),Ue(t.tool_calls)].filter(Boolean).join(` + +`):``}function We(e){if(!Array.isArray(e))return``;let t={system:`系统`,developer:`开发者`,user:`用户`,assistant:`模型`,toolResult:`工具返回`,tool:`工具返回`};return e.map(e=>{let n=A(e);if(!n||P(n))return``;let r=[F(n.content),Ue(n.tool_calls)].filter(Boolean).join(` + +`);return r?`${t[j(n.role)]||j(n.role)||`消息`}\n${r}`:``}).filter(Boolean).join(` + +`)}function I(e){let t=e.payload,[n,r]={context:[`模型输入`,`input`],provider_request:[`模型请求`,`input`],message_delta:[`模型公开输出片段`,`output`],message_end:[`模型消息`,`output`],session_message:[`历史会话消息`,`output`],agent_end:[`模型输出`,`output`],tool_call:[`工具调用`,`tool`],tool_result:[`工具返回`,`tool`],tool_execution_start:[`工具执行开始`,`tool`],tool_execution_update:[`工具执行进度`,`tool`],tool_execution_end:[`工具执行结束`,`tool`],settled:[`本段过程结束`,`status`],quarantine:[`过程状态记录`,`status`],capture_warning:[`采集提示`,`status`]}[e.kind]??[`过程事件 · ${e.kind}`,`other`],i=``;e.kind===`message_delta`?i=t.type===`text_delta`||t.type===`toolcall_delta`?j(t.delta):``:[`context`,`provider_request`,`message_end`,`session_message`,`agent_end`].includes(e.kind)?i=We(t.messages):e.kind===`tool_call`?i=M(t.input):e.kind===`tool_result`?i=F(t.content):e.kind===`tool_execution_start`?i=M(t.args):e.kind===`tool_execution_update`?i=F(t.partialResult):e.kind===`tool_execution_end`?i=F(t.result):(e.kind===`quarantine`||e.kind===`capture_warning`)&&(i=j(t.reason));let a=e.kind===`tool_result`||e.kind===`tool_execution_end`;return{key:e.id??String(e.sequence),kind:e.kind,title:n,category:r,text:i,toolName:j(t.toolName)||null,toolCallId:j(t.toolCallId)||null,result:a?t.isError===!0?`error`:t.isError===!1?`success`:`unknown`:null,timestamp:typeof e.observed_at==`number`&&Number.isFinite(e.observed_at)?e.observed_at:null}}function L(){let{locale:e,t,setLocale:n}=u();return{locale:e,t,setLocale:n,text:(t,n)=>e===`zh-CN`?t:n}}function Ge(e,t){return typeof e==`number`&&Number.isFinite(e)?new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e*1e3):`—`}function R(e,t){return y(e)?f(e,e=>l(e,{},t)):{operator:[`用户`,`User`],unknown:[`角色未记录`,`Unassigned role`],system:[`系统`,`System`],developer:[`运行指令`,`Instructions`],user:[`用户 / 任务`,`User / task`],assistant:[`模型`,`Assistant`],tool:[`工具`,`Tool`]}[e]?.[t===`zh-CN`?0:1]??e}function Ke(e,t){return{complete:[`调用已结束`,`Call ended`],capturing:[`尚无结束记录`,`No end record yet`],interrupted:[`采集中断`,`Capture interrupted`],quarantined:[`需检查记录`,`Record needs attention`],approved:[`已验收`,`Reviewed`],not_approved:[`未验收`,`Not reviewed`],unknown:[`结果未确认`,`Outcome unconfirmed`],running:[`采集正常`,`Collector running`],storage_error:[`存储异常`,`Storage unavailable`],starting:[`正在启动`,`Starting`],listening:[`已连接`,`Listening`],unavailable:[`暂不可用`,`Unavailable`]}[e||`unknown`]?.[t===`zh-CN`?0:1]??e??`—`}function qe(e,t){return{context:[`Agent 上下文`,`Agent context`],provider_request:[`模型实际输入`,`Model request`],message_end:[`公开消息`,`Public message`],agent_end:[`调用结果`,`Call output`],message_delta:[`公开输出增量`,`Public output increments`],tool_call:[`工具调用`,`Tool call`],tool_result:[`工具结果`,`Tool result`],tool_execution_start:[`工具开始执行`,`Tool execution started`],tool_execution_update:[`工具执行更新`,`Tool execution update`],tool_execution_end:[`工具执行结束`,`Tool execution ended`],settled:[`采集已收尾`,`Capture settled`],quarantine:[`记录不完整`,`Incomplete record`],capture_warning:[`采集提示`,`Capture notice`]}[e]?.[t===`zh-CN`?0:1]??e}var z=n(),B=e=>JSON.stringify(e,null,2);function V({value:e}){let{text:t}=L();return(0,z.jsxs)(v,{label:t(`原始 JSON`,`Raw JSON`),children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(ue,{text:B(e),label:t(`复制 JSON`,`Copy JSON`),copiedLabel:t(`已复制`,`Copied`)})}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(e)})]})}function Je({message:e,index:t}){let{locale:n,text:r}=L(),[i,a]=(0,x.useState)(!1),o=F(e);return(0,z.jsxs)(`details`,{className:`admin-data-message`,onToggle:e=>a(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,z.jsx)(`strong`,{children:R(e.role||`unknown`,n)}),(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[o.length.toLocaleString(n),` `,r(`字符`,`characters`)]}),(0,z.jsx)(ne,{size:13})]}),i?(0,z.jsxs)(`div`,{className:`admin-data-message-body`,children:[o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(ue,{text:o,label:r(`复制内容`,`Copy text`),copiedLabel:r(`已复制`,`Copied`)}),(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:o})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:r(`这条消息没有公开文本;结构见下方。`,`This message has no public text; its structure is below.`)}),(0,z.jsx)(V,{value:e})]}):null]})}function H({event:e}){let{locale:t,text:n}=L(),r=I(e),i=e.payload,a=Array.isArray(i.messages)?i.messages:[];return(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[e.kind===`provider_request`?(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[typeof i.model==`string`?(0,z.jsx)(g,{children:i.model}):null,typeof i.reasoning_effort==`string`?(0,z.jsx)(g,{children:i.reasoning_effort}):null,(0,z.jsxs)(`span`,{children:[a.length.toLocaleString(t),` `,n(`条消息`,`messages`),` · `,(i.tools?.length||0).toLocaleString(t),` `,n(`个工具定义`,`tool definitions`)]})]}):null,a.length?(0,z.jsx)(`div`,{className:`admin-data-message-list`,children:a.map((e,t)=>(0,z.jsx)(Je,{message:e,index:t},t))}):r.text?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(ue,{text:r.text,label:n(`复制内容`,`Copy text`),copiedLabel:n(`已复制`,`Copied`)})}),r.category===`tool`||e.kind===`message_delta`?(0,z.jsx)(`pre`,{className:`admin-data-code`,children:r.text}):(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:r.text})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:n(`此事件保留了状态和结构,没有公开文本。`,`This event contains status and structure, with no public text.`)}),i.tools?.length?(0,z.jsx)(v,{label:n(`工具定义`,`Tool definitions`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(i.tools)})}):null,(0,z.jsx)(V,{value:e})]})}function U(e){let t=[];for(let n of e){let e=n.kind===`message_delta`?JSON.stringify([n.kind,n.payload.type,n.payload.message_index,n.payload.content_index,n.payload.toolCallId]):`event:${n.sequence}`,r=t[t.length-1];n.kind===`message_delta`&&r?.key===e?r.events.push(n):t.push({key:e,events:[n]})}return t}function W({group:e}){let{locale:t,text:n}=L(),[r,i]=(0,x.useState)(!1),a=e.events[0],o=I(a),ee=o.category===`tool`?ge:o.category===`input`?Ee:b,s=e.events.length>1,c=s?e.events.map(e=>I(e).text).join(``):o.text,l=a.kind===`provider_request`?`${a.payload.messages?.length??0} ${n(`条消息`,`messages`)} · ${a.payload.tools?.length??0} ${n(`个工具`,`tools`)}`:(a.payload.messages?F(a.payload.messages):c).replace(/\s+/g,` `).slice(0,110);return(0,z.jsxs)(`details`,{className:`admin-data-event`,"data-event-kind":a.kind,onToggle:e=>i(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{className:`admin-data-event-icon`,children:(0,z.jsx)(ee,{size:15})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`admin-data-event-title`,children:[(0,z.jsxs)(`strong`,{children:[qe(a.kind,t),o.toolName?` · ${o.toolName}`:``]}),s?(0,z.jsxs)(g,{children:[e.events.length,` `,n(`条增量`,`increments`)]}):null,o.result===`error`?(0,z.jsx)(g,{color:p.error,children:n(`工具报告错误`,`Tool reported an error`)}):null,o.result===`success`?(0,z.jsx)(g,{color:p.success,children:n(`工具报告成功`,`Tool reported success`)}):null]}),l?(0,z.jsx)(`p`,{className:`admin-data-event-preview`,children:l}):null]}),(0,z.jsx)(`span`,{className:`admin-data-event-time`,children:Ge(a.observed_at,t)}),(0,z.jsx)(ne,{size:14})]}),r?s?(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[(0,z.jsx)(ue,{text:c,label:n(`复制输出`,`Copy output`),copiedLabel:n(`已复制`,`Copied`)}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:c}),(0,z.jsx)(V,{value:e.events})]}):(0,z.jsx)(H,{event:a}):null]})}function Ye({episode:e,readonly:t,onDownload:n}){let{locale:r,text:i}=L(),[a,o]=(0,x.useState)(`all`),[ee,s]=(0,x.useState)(0),c=(0,x.useMemo)(()=>U(e.events.filter(e=>{let t=I(e).category;return a===`all`||(a===`tools`?t===`tool`:t===`input`||t===`output`)})),[e.events,a]);(0,x.useEffect)(()=>s(0),[e.episode_id,a]);let l=Math.max(1,Math.ceil(c.length/60)),u=Math.min(ee,l-1),d=c.slice(u*60,u*60+60),te=e.events.length,f=e.collection.event_count,ne=e.quality.approved===!0&&e.quality.state===`approved`;return(0,z.jsxs)(`section`,{className:`admin-data-inspector`,"aria-label":i(`过程详情`,`Process details`),children:[(0,z.jsxs)(`div`,{className:`admin-data-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h3`,{children:[R(e.role,r),` `,(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[`· #`,e.episode_id]})]}),(0,z.jsxs)(`p`,{children:[Ge(e.started_at,r),` · `,e.task_id?`${i(`任务`,`Task`)} ${e.task_id}`:i(`项目级 / 未关联任务`,`Project-level / no task association`)]})]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:t,onClick:()=>n(e),title:t?i(`只读会话不能导出`,`Exports are disabled for read-only sessions`):i(`下载当前已加载的原始记录`,`Download the raw records currently loaded`),children:[(0,z.jsx)(ce,{size:14}),` JSON`]})]}),(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[(0,z.jsx)(g,{children:Ke(e.state,r)}),(0,z.jsx)(g,{color:ne?p.success:void 0,children:ne?i(`已验收`,`Reviewed`):i(`未验收`,`Not reviewed`)}),(0,z.jsxs)(`span`,{children:[i(`已加载`,`Loaded`),` `,te.toLocaleString(r),` / `,f.toLocaleString(r),` `,i(`条事件`,`events`)]}),e.runtime.run_label?(0,z.jsx)(`code`,{children:e.runtime.run_label}):null]}),!e.collection.complete||e.collection.historical_data_unavailable||te(0,z.jsx)(`button`,{type:`button`,"aria-pressed":a===e,className:a===e?`active`:``,onClick:()=>o(e),children:e===`all`?i(`全部事件`,`All events`):e===`messages`?i(`模型输入 / 输出`,`Model input / output`):i(`工具轨迹`,`Tool trace`)},e))}),c.length?(0,z.jsx)(`div`,{className:`admin-data-timeline`,children:d.map(t=>(0,z.jsx)(W,{group:t},`${e.episode_id}:${t.events[0].sequence}`))}):(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(Ae,{size:24}),(0,z.jsx)(`p`,{children:i(`当前已加载的记录中没有此类事件。`,`No events of this type are present in the loaded records.`)})]}),c.length>60?(0,z.jsxs)(`div`,{className:`admin-data-paging`,"aria-label":i(`当前过程的事件分页`,`Event pages for this process`),children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!u,onClick:()=>s(u-1),title:i(`上一段事件`,`Previous event group`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[u*60+1,`–`,Math.min(c.length,u*60+60),` / `,c.length.toLocaleString(r),` `,i(`组事件`,`event groups`)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:u+1>=l,onClick:()=>s(u+1),title:i(`下一段事件`,`Next event group`),children:(0,z.jsx)(Te,{size:14})})]}):null,(0,z.jsx)(V,{value:{...e,events:void 0,loaded_event_count:te}})]})}function Xe(e,t,n=``){let r=new URL(e);return r.searchParams.set(`tenant`,t.tenant_id),r.searchParams.set(`sid`,t.sid),n?r.searchParams.set(`task_id`,n):r.searchParams.delete(`task_id`),r.searchParams.delete(`task`),`${r.pathname}${r.search}${r.hash}`}function Ze(e,t,n,r){if(e.some(e=>N(e)===t))return null;let i=r&&n.sid?e.filter(e=>e.sid===n.sid&&(!n.tenant||e.tenant_id===n.tenant)):[],a=i.length===1?i[0]:void 0;if(r&&n.sid&&!a)return null;let o=a??e[0];return{key:o?N(o):``,taskId:a&&n.taskId||``}}async function Qe(e,t,n){let r=await t(),i=r.role===`trial`&&r.key_id===e.tenant_id;return i&&n(`/?project=${encodeURIComponent(e.sid)}`),{matched:i,identity:r}}var $e=Array.from({length:11},(e,t)=>`trial-${String(t+1).padStart(2,`0`)}`),G=(e,t)=>e<1&&!(t instanceof Pe&&[401,403].includes(t.status));function et(e){let[t,n]=(0,x.useState)(e);return(0,x.useEffect)(()=>{let t=window.setTimeout(()=>n(e),250);return()=>window.clearTimeout(t)},[e]),t}function tt(){let{locale:e,text:t,t:n}=L(),{themeMode:s,cycleTheme:c}=Oe(),l=i(),[u]=(0,x.useState)(()=>Ve(window.location.search)),[d,f]=(0,x.useState)(!!u.sid),[p,ne]=(0,x.useState)(u.tenant||``),[m,ge]=(0,x.useState)(``),[y,Ee]=(0,x.useState)(`internal_training`),[b,S]=(0,x.useState)(0),[Ne,C]=(0,x.useState)(u.tenant&&u.sid?N({tenant_id:u.tenant,sid:u.sid}):``),[w,T]=(0,x.useState)(u.taskId||``),[E,D]=(0,x.useState)(null),[Fe,k]=(0,x.useState)(null),[Ie,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(null),[P,Ue]=(0,x.useState)(()=>new Map),[F,We]=(0,x.useState)(``),[I,qe]=(0,x.useState)(!1),[B,V]=(0,x.useState)(null),Je=et(m),H=r({queryKey:[`admin-data`,`identity`],queryFn:({signal:e})=>O.identity({signal:e}),staleTime:3e4,retry:!1}),U=H.data?.role===`admin`,W=H.data?.readonly!==!1,tt=!!Je||d,K=r({queryKey:[`admin-data`,`overview`,y,p,tt?`all-pages`:b],queryFn:async({signal:e})=>{let t=await O.overview({purpose:y,tenant:p,offset:tt?0:b,signal:e}),n=[t],r=new Set([t.offset]);for(;tt&&n[n.length-1].has_more_projects;){let t=n[n.length-1].next_offset;if(t===null||r.has(t))throw Error(`Invalid project pagination`);r.add(t),n.push(await O.overview({purpose:y,tenant:p,offset:t,signal:e}))}return n},enabled:U,retry:G,refetchInterval:!tt&&2e4}),q=(0,x.useMemo)(()=>{let e=K.data;if(!e?.length)return;let t=e[e.length-1];return{...e[0],projects:e.flatMap(e=>e.projects),tasks:e.flatMap(e=>e.tasks),has_more_projects:t.has_more_projects,next_offset:t.next_offset,completeness:{...e[0].completeness,page_truncated:e.some(e=>e.completeness.page_truncated)}}},[K.data]),J=r({queryKey:[`admin-data`,`collector`],queryFn:({signal:e})=>O.collector({signal:e}),enabled:U,retry:G,refetchInterval:15e3}),nt=r({queryKey:[`admin-data`,`audit`],queryFn:({signal:e})=>O.audit({signal:e}),enabled:U&&j===`audit`,retry:G}),rt=q?.projects??[],it=(0,x.useMemo)(()=>[...new Set(rt.map(e=>e.tenant_id))].sort(),[rt]),at=o({queries:it.map(e=>({queryKey:[`admin-data`,`directory`,e],queryFn:({signal:t})=>O.projectDirectory(e,{signal:t}),enabled:U,staleTime:6e4,retry:G}))}),ot=new Map;at.forEach((e,t)=>{for(let n of e.data?.projects??[])n.title&&ot.set(N({tenant_id:it[t],sid:n.id}),n.title)});let st=e=>ot.get(N(e))||Le(e),ct=Je.trim().toLocaleLowerCase(e),lt=rt.filter(t=>!ct||[st(t),t.title,t.tenant_id,t.sid,...(q?.tasks??[]).filter(e=>N(e)===N(t)).flatMap(e=>[Re(e),e.task_id||``])].some(t=>t.toLocaleLowerCase(e).includes(ct))),Y=lt.find(e=>N(e)===Ne)??null,ut=(q?.tasks??[]).filter(e=>Y&&N(e)===N(Y)),dt=ut.filter(e=>e.task_id),ft=ut.find(e=>e.task_id===w)??null;(0,x.useEffect)(()=>{if(!q)return;let e=Ze(lt,Ne,u,d);if(!e)return;C(e.key),k(null),D(null),T(e.taskId);let t=lt.find(t=>N(t)===e.key);t&&xt(t,e.taskId)},[q,Ne,u,d,Je,at.map(e=>e.dataUpdatedAt).join(`,`)]);let pt=[y,Y?.tenant_id,Y?.sid,w||null],X=r({queryKey:[`admin-data`,`detail`,...pt],queryFn:({signal:e})=>O.detail({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,signal:e}),enabled:U&&!!Y?.eligible,retry:G}),Z=ft??(w&&X.data?.task_id===w?X.data:null),mt=!w||!!Z,Q=ee({queryKey:[`admin-data`,`observations`,...pt],queryFn:({pageParam:e,signal:t})=>O.observations({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,cursor:e,limit:200,signal:t}),initialPageParam:null,getNextPageParam:e=>e.pagination.has_more?e.pagination.next_cursor:void 0,enabled:U&&!!Y?.eligible&&mt,retry:G}),ht=(0,x.useMemo)(()=>He(Q.data?.pages??[]),[Q.data]),gt=ht.filter(e=>E===null||Be(e)===E),_t=gt.find(e=>e.episode_id===Fe)??gt[0]??null,vt=new Map;for(let e of w?Z?[Z]:[]:ut)for(let t of e.roles){let e=ze(t.role),n=vt.get(e);vt.set(e,{...t,role:e,observations:(n?.observations||0)+t.observations,episodes:(n?.episodes||0)+t.episodes,tool_pairs:(n?.tool_pairs||0)+t.tool_pairs})}let yt=ht.reduce((e,t)=>e+t.events.length,0),bt=P.size?[...P.values()]:Y?[Y]:[],$=a({mutationFn:()=>{if(W||!bt.length||bt.length>20)throw Error(t(`请选择最多 20 个可导出的项目。`,`Select up to 20 eligible projects.`));return O.exportObservations({purpose:y,projects:bt})},onSuccess:e=>{ve(e.blob,e.filename),We(t(`全部保留过程已下载。`,`All retained process data downloaded.`)),l.invalidateQueries({queryKey:[`admin-data`,`audit`]})}}),xt=(e,t=``)=>{window.history.replaceState(window.history.state,``,Xe(window.location.href,e,t))},St=e=>{f(!1),C(N(e)),T(``),D(null),k(null),A(!1),xt(e)},Ct=e=>{T(e),k(null),D(null),Y&&xt(Y,e)},wt=e=>Ue(t=>{let n=new Map(t),r=N(e);return n.has(r)?n.delete(r):n.size<20&&n.set(r,e),n}),Tt=()=>{l.invalidateQueries({queryKey:[`admin-data`]})},Et=e=>{W||ve(new Blob([JSON.stringify({scope:`loaded_observations`,loaded_event_count:e.events.length,episode:e},null,2)],{type:`application/json`}),`${e.tenant_id}-${e.sid}-process-${e.episode_id}.json`)},Dt=async()=>{if(!(!Y||I)){qe(!0);try{let e=await Qe(Y,()=>O.workspaceIdentity(),e=>window.location.assign(e));V(e.identity.role===`trial`?e.identity.key_id:null),e.matched||M(`workspace`)}catch{V(null),M(`workspace`)}finally{qe(!1)}}},Ot=e=>e instanceof Pe&&e.status===401?t(`数据后台登录已过期,请重新登录。`,`Your administrator session expired. Sign in again.`):e instanceof Error?e.message:t(`暂时无法读取数据。`,`Data is temporarily unavailable.`);return(0,z.jsxs)(fe,{className:`admin-data-workspace h-full`,style:{"--sidebar-width":`292px`},children:[Ie?(0,z.jsx)(`button`,{type:`button`,className:`admin-data-scrim lg:hidden`,"aria-label":t(`关闭项目列表`,`Close projects`),onClick:()=>A(!1)}):null,(0,z.jsxs)(pe,{mobileOpen:Ie,className:`admin-data-sidebar`,"aria-label":t(`数据项目`,`Data projects`),children:[(0,z.jsxs)(`div`,{className:`admin-data-sidebar-brand`,children:[(0,z.jsx)(De,{size:25}),(0,z.jsx)(g,{children:t(`数据`,`Data`)}),(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button ml-auto lg:hidden`,onClick:()=>A(!1),"aria-label":n(`common.close`),children:(0,z.jsx)(se,{size:18})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-heading`,children:[(0,z.jsx)(`span`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`span`,{children:q?.total_projects??`—`})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-controls`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`账号`,`Account`)}),(0,z.jsxs)(`select`,{"aria-label":t(`筛选账号`,`Filter account`),value:p,onChange:e=>{f(!1),ne(e.target.value),S(0),T(``)},children:[(0,z.jsx)(`option`,{value:``,children:t(`全部 11 个账号`,`All 11 accounts`)}),$e.map(e=>(0,z.jsx)(`option`,{children:e},e))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-search`,children:[(0,z.jsx)(he,{size:15}),(0,z.jsx)(`input`,{"aria-label":t(`搜索项目、任务或 SID`,`Search projects, tasks or SID`),placeholder:t(`搜索项目或任务…`,`Search projects or tasks…`),value:m,onChange:e=>{f(!1),ge(e.target.value),S(0)}})]})]}),(0,z.jsxs)(`div`,{className:`admin-data-projects`,"aria-busy":K.isFetching,children:[K.isPending&&U?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(h,{}),(0,z.jsx)(`p`,{children:t(`正在读取项目…`,`Loading projects…`)})]}):null,K.error?(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`alert`,children:[Ot(K.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void K.refetch(),children:n(`common.retry`)})]}):null,!K.isPending&&!lt.length&&!K.error?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(ke,{size:22}),(0,z.jsx)(`p`,{children:t(`没有符合筛选条件的项目。`,`No projects match these filters.`)})]}):null,lt.map(n=>{let r=N(n)===Ne,i=(q?.tasks??[]).filter(e=>N(e)===N(n)).reduce((e,t)=>e+t.collection.retained_episodes,0);return(0,z.jsxs)(`div`,{"data-testid":`project-${n.tenant_id}-${n.sid}`,className:`admin-data-project ${r?`active`:``}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-project-open`,"aria-current":r?`page`:void 0,onClick:()=>St(n),children:[(0,z.jsx)(`span`,{className:`admin-data-project-title`,children:st(n)}),(0,z.jsxs)(`span`,{className:`admin-data-project-id`,children:[n.tenant_id,` · `,n.sid]}),(0,z.jsx)(`span`,{className:`admin-data-project-meta`,children:n.eligible?i?`${i.toLocaleString(e)} ${t(`段保留过程`,`retained processes`)}`:t(`尚无保留过程`,`No process data retained`):t(`当前用途不可读取`,`Unavailable for this purpose`)})]}),(0,z.jsx)(`input`,{type:`checkbox`,className:`admin-data-project-check`,"aria-label":`${t(`选择导出项目`,`Select project for export`)} ${st(n)} ${n.tenant_id} ${n.sid}`,checked:P.has(N(n)),disabled:W||!n.eligible||P.size>=20&&!P.has(N(n)),onChange:()=>wt(n)})]},N(n))})]}),(0,z.jsxs)(`div`,{className:`admin-data-paging`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!b||K.isFetching,onClick:()=>S(Math.max(0,b-20)),title:t(`上一页项目`,`Previous project page`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[t(`第`,`Page`),` `,Math.floor(b/20)+1,` `,t(`页`,``)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!q?.has_more_projects||K.isFetching,onClick:()=>S(q?.next_offset??b+20),title:t(`下一页项目`,`Next project page`),children:(0,z.jsx)(Te,{size:14})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-footer`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`audit`),children:[(0,z.jsx)(we,{size:15}),t(`导出记录`,`Export history`)]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`diagnostics`),children:[(0,z.jsx)(ie,{size:15}),t(`采集诊断`,`Capture diagnostics`)]}),(0,z.jsxs)(`a`,{href:`/invite`,children:[(0,z.jsx)(oe,{size:15}),t(`用户工作空间`,`User workspace`)]})]})]}),(0,z.jsxs)(`main`,{className:`admin-data-surface`,children:[(0,z.jsxs)(xe,{children:[(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button lg:hidden`,onClick:()=>A(!0),"aria-label":t(`打开项目列表`,`Open projects`),children:(0,z.jsx)(je,{size:18})}),(0,z.jsx)(`span`,{className:`admin-data-header-title`,children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(g,{children:W?t(`只读管理员`,`Read-only administrator`):t(`管理员`,`Administrator`)}),(0,z.jsxs)(`div`,{className:`ml-auto flex items-center gap-1 sm:gap-2`,children:[(0,z.jsx)(be,{themeMode:s,onCycleTheme:c}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:Tt,disabled:K.isFetching||!U,title:t(`刷新数据`,`Refresh data`),children:K.isFetching?(0,z.jsx)(h,{}):(0,z.jsx)(ae,{size:14})}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!Y?.eligible||$.isPending,onClick:()=>{We(``),M(`export`)},children:[(0,z.jsx)(ce,{size:14}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:t(`导出`,`Export`)})]})]})]}),(0,z.jsx)(`div`,{className:`admin-data-content`,children:U?Y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-project-heading`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`p`,{className:`admin-data-eyebrow`,children:[(0,z.jsx)(ke,{size:13}),t(`已授权的过程数据`,`Authorized process data`)]}),(0,z.jsx)(`h1`,{children:st(Y)}),(0,z.jsxs)(`div`,{className:`admin-data-project-identity`,children:[(0,z.jsxs)(`code`,{children:[Y.tenant_id,` / `,Y.sid]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:I,onClick:()=>void Dt(),children:[I?(0,z.jsx)(h,{}):(0,z.jsx)(oe,{size:13}),t(`在用户端打开`,`Open in user workspace`)]}),(0,z.jsx)(ue,{text:`${window.location.origin}/admin/data?tenant=${encodeURIComponent(Y.tenant_id)}&sid=${encodeURIComponent(Y.sid)}`,label:t(`复制后台链接`,`Copy data link`),copiedLabel:t(`已复制`,`Copied`)})]})]}),(0,z.jsxs)(`span`,{className:`admin-data-collector-status`,children:[(0,z.jsx)(_e,{ok:J.data?.state===`running`}),J.error?t(`采集状态暂不可读`,`Capture status unavailable`):Ke(J.data?.state,e)]})]}),(0,z.jsxs)(`div`,{className:`admin-data-context-bar`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field flex-1`,children:[(0,z.jsx)(`span`,{children:t(`查看范围`,`View scope`)}),(0,z.jsxs)(`select`,{value:w,onChange:e=>Ct(e.target.value),"aria-label":t(`选择任务或整个项目`,`Select a task or the entire project`),children:[(0,z.jsx)(`option`,{value:``,children:t(`整个项目 · 包含任务创建前的过程`,`Entire project · includes pre-task processes`)}),w&&!dt.some(e=>e.task_id===w)?(0,z.jsxs)(`option`,{value:w,children:[Z?Re(Z):t(`链接中的任务`,`Linked task`),` · `,w]}):null,dt.map(e=>(0,z.jsxs)(`option`,{value:e.task_id,children:[Re(e),` · `,e.task_id]},e.task_id))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`数据用途`,`Data purpose`)}),(0,z.jsxs)(`select`,{value:y,onChange:e=>{Ee(e.target.value),Ue(new Map),S(0)},children:[(0,z.jsx)(`option`,{value:`internal_training`,children:t(`内部训练`,`Internal training`)}),(0,z.jsx)(`option`,{value:`external_sharing`,children:t(`对外共享`,`External sharing`)})]})]})]}),Y.eligible?(0,z.jsxs)(z.Fragment,{children:[w&&Z?(0,z.jsxs)(v,{label:t(`任务目标与来源`,`Task objective and source`),children:[(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:Z.objective||Z.request?.text||Z.title})}),(0,z.jsx)(`code`,{children:Z.task_id})]}):null,mt?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-role-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h2`,{children:[(0,z.jsx)(Me,{size:17}),t(`多 Agent 过程`,`Multi-agent processes`)]}),(0,z.jsx)(`p`,{children:t(`查看各角色实际留下的记录。角色缺失、中断和质量验收分别标记。`,`Inspect the records each role actually produced. Missing roles, interruptions and review status are shown separately.`)})]}),(0,z.jsx)(`button`,{type:`button`,className:`admin-data-text-button ${E===null?`active`:``}`,onClick:()=>{D(null),k(null)},children:t(`全部角色`,`All roles`)})]}),(0,z.jsx)(`div`,{className:`admin-data-roles`,children:de.map(r=>{let i=vt.get(r),a=Math.max(i?.episodes||0,ht.filter(e=>Be(e)===r).length),o=ht.filter(e=>Be(e)===r).length;return(0,z.jsxs)(`button`,{type:`button`,"data-testid":`role-${r}`,className:`admin-data-role ${E===r?`active`:``}`,style:{"--role-color":Se(r)},"aria-pressed":E===r,onClick:()=>{D(r),k(null)},children:[(0,z.jsxs)(`span`,{className:`admin-data-role-label`,children:[(0,z.jsx)(`span`,{className:`admin-data-role-mark`,children:R(r,e).slice(0,1)}),(0,z.jsx)(`strong`,{children:R(r,e)}),(0,z.jsx)(`span`,{children:r})]}),(0,z.jsx)(`span`,{className:`admin-data-role-description`,children:le(r,n)}),(0,z.jsx)(`span`,{className:`admin-data-role-count`,children:a?`${a.toLocaleString(e)} ${t(`段过程`,`processes`)}`:i?.observations?t(`仅有活动记录`,`Activity records only`):t(`尚未采到记录`,`No records captured`)}),(0,z.jsx)(`span`,{className:`admin-data-role-footnote`,children:o?`${t(`正文已加载`,`Content loaded`)} ${o.toLocaleString(e)}`:t(`按原始记录归属角色`,`Role comes from recorded metadata`)})]},r)})}),vt.get(`unknown`)?.episodes||ht.some(e=>Be(e)===`unknown`)?(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-unknown`,onClick:()=>{D(`unknown`),k(null)},children:[(0,z.jsx)(Ae,{size:14}),t(`另有角色未记录的过程,保留原样查看`,`Some processes have no recorded role. View them as captured.`),` `,(0,z.jsx)(Te,{size:13})]}):null,(0,z.jsxs)(`div`,{className:`admin-data-record-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{children:E?R(E,e):t(`全部保留过程`,`All retained processes`)}),(0,z.jsxs)(`p`,{children:[ht.length.toLocaleString(e),` `,t(`段已加载`,`processes loaded`),` · `,yt.toLocaleString(e),` `,t(`条原始事件`,`raw events`),` `,Q.hasNextPage?t(`· 还有后续页`,`· more pages available`):``]})]}),gt.length?(0,z.jsx)(`select`,{className:`admin-data-episode-select`,"aria-label":t(`选择过程记录`,`Select a process`),value:_t?.episode_id??``,onChange:e=>k(Number(e.target.value)),children:gt.map(t=>(0,z.jsxs)(`option`,{"data-testid":`episode-${t.episode_id}`,value:t.episode_id,children:[`#`,t.episode_id,` · `,R(t.role,e),` · `,Ge(t.started_at,e)]},t.episode_id))}):null]}),Q.error?(0,z.jsxs)(`div`,{role:`alert`,className:`admin-data-notice`,children:[Ot(Q.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void Q.refetch(),children:n(`common.retry`)})]}):null,_t?(0,z.jsx)(Ye,{episode:_t,readonly:W,onDownload:Et},_t.episode_id):(0,z.jsxs)(`div`,{className:`admin-data-empty admin-data-record-empty`,children:[Q.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(Ae,{size:28}),(0,z.jsx)(`p`,{children:Q.isPending?t(`正在读取真实过程…`,`Loading recorded processes…`):E&&(vt.get(E)?.episodes||0)>0?t(`该角色有记录,当前页尚未加载其正文。`,`This role has recorded processes; their content is on a later page.`):t(`当前范围没有保留的模型过程。项目活动不等同于完整模型轨迹。`,`No model processes are retained in this scope. Project activity does not establish a complete model trace.`)})]}),Q.hasNextPage?(0,z.jsx)(`div`,{className:`admin-data-load-more`,"data-testid":`load-more-observations`,children:(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:Q.isFetchingNextPage,onClick:()=>void Q.fetchNextPage(),children:[Q.isFetchingNextPage?(0,z.jsx)(h,{}):(0,z.jsx)(Te,{size:14}),t(`加载后续原始记录`,`Load more original records`)]})}):null,X.data?.segments.some(e=>e.source_kind!==`tool_episode`)?(0,z.jsxs)(v,{label:t(`项目活动与任务来源`,`Project activity and task sources`),children:[(0,z.jsx)(`div`,{className:`admin-data-activity`,children:X.data.segments.filter(e=>e.source_kind!==`tool_episode`).map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:R(t.role,e)}),(0,z.jsx)(`span`,{children:t.summary}),(0,z.jsx)(`time`,{children:Ge(t.started_at,e)})]},t.id))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`活动顺序来自记录时间,不表示已证实的 Agent 交接。`,`Activity follows recorded timestamps; it does not establish an agent handoff.`)})]}):null,(0,z.jsxs)(`p`,{className:`admin-data-bottom-note`,children:[(0,z.jsx)(te,{size:14}),t(`过程已采集不代表任务成功,也不代表训练质量已验收。原始记录保留缺失和中断状态。`,`Captured processes do not establish task success or training quality. Missing data and interruptions remain visible.`)]})]}):(0,z.jsx)(`div`,{className:`admin-data-notice`,role:`status`,children:X.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(h,{}),t(`正在核对链接中的任务…`,`Checking the linked task…`)]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{children:[X.error instanceof Pe&&X.error.status===404?t(`链接中的任务 ID 不存在或当前用途下不可读取。这不表示项目没有过程数据。`,`The linked task ID does not exist or is unavailable for this purpose. This does not mean the project has no process data.`):t(`暂时无法核对该任务,请重试或查看整个项目。`,`This task could not be verified. Retry or view the entire project.`),` `,(0,z.jsx)(`code`,{children:w})]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>Ct(``),children:t(`查看整个项目`,`View entire project`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void X.refetch(),children:n(`common.retry`)})]})})]}):(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`status`,children:[t(`当前用途下没有可读取的授权记录。请选择其他项目或数据用途。`,`No authorized records are available for this purpose. Choose another project or purpose.`),(0,z.jsx)(v,{children:(0,z.jsx)(`pre`,{children:Y.reason})})]})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(ke,{size:32}),(0,z.jsx)(`h1`,{children:d&&u.sid?t(`链接中的项目未找到`,`Linked project not found`):t(`选择一个项目`,`Select a project`)}),(0,z.jsx)(`p`,{children:d&&u.sid?t(`当前账号与用途下找不到此 SID,没有替你打开其他项目。请检查链接或选择左侧项目。`,`This SID is not available for the selected account and purpose. Check the link or choose a project from the list.`):t(`从左侧查看各账号的真实过程数据。`,`Choose a project to inspect its recorded processes.`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>A(!0),children:t(`浏览项目`,`Browse projects`)})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(De,{size:38}),(0,z.jsx)(`h1`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`p`,{children:H.error?Ot(H.error):t(`正在验证管理员身份…`,`Checking administrator access…`)}),H.error?(0,z.jsx)(`a`,{className:`brand-button brand-button-primary`,href:`/admin/login`,children:t(`管理员登录`,`Administrator sign in`)}):(0,z.jsx)(h,{})]})})]}),(0,z.jsx)(ye,{open:j===`workspace`,onClose:()=>M(null),label:t(`打开用户工作空间`,`Open user workspace`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`需要对应的用户账号`,`Use the matching user account`)}),(0,z.jsxs)(`p`,{children:[t(`这个项目属于`,`This project belongs to`),` `,(0,z.jsx)(`strong`,{children:Y?.tenant_id}),t(`。`,`. `),B?(0,z.jsxs)(z.Fragment,{children:[t(`当前用户端账号是`,`Your current user account is`),` `,(0,z.jsx)(`strong`,{children:B}),t(`。`,`. `)]}):t(`你尚未登录用户工作空间。`,`You are not signed in to a user workspace.`)]}),(0,z.jsx)(`p`,{children:t(`请在用户端使用对应邀请码登录,再打开这个项目。管理员登录不会切换用户账号。`,`Sign in to the user workspace with the matching invitation before opening this project. Administrator access does not switch your user account.`)}),(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(`a`,{className:`brand-button brand-button-primary inline-flex items-center gap-2`,href:`/invite`,target:`_blank`,rel:`noopener`,children:[t(`打开用户登录入口`,`Open user sign in`),(0,z.jsx)(oe,{size:14})]})]})]})}),(0,z.jsx)(ye,{open:j===`export`,onClose:()=>M(null),label:t(`导出全部保留过程`,`Export all retained processes`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出全部保留过程`,`Export all retained processes`)}),(0,z.jsx)(`p`,{children:t(`ZIP 包含所选项目的全部已保留输入、输出和工具轨迹,包括未验收、未结束和失败的记录。`,`The ZIP includes all retained inputs, outputs and tool traces for these projects, including unreviewed, unfinished and failed records.`)}),(0,z.jsx)(`ul`,{className:`admin-data-export-projects`,children:bt.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(re,{size:14}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:st(e)}),(0,z.jsxs)(`code`,{children:[e.tenant_id,` / `,e.sid]})]})]},N(e)))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`可在项目列表勾选多个项目;一次最多 20 个。`,`Use project checkboxes to select up to 20 projects per export.`)}),W?(0,z.jsx)(`p`,{role:`status`,children:t(`只读管理员不能导出数据。`,`Read-only administrators cannot export data.`)}):null,$.error?(0,z.jsx)(`p`,{role:`alert`,className:`admin-data-notice`,children:Ot($.error)}):null,F?(0,z.jsx)(`p`,{role:`status`,children:F}):null,(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!bt.length||$.isPending,onClick:()=>$.mutate(),children:[$.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(ce,{size:14}),t(`下载 ZIP`,`Download ZIP`)]})]})]})}),(0,z.jsx)(ye,{open:j===`audit`,onClose:()=>M(null),label:t(`导出记录`,`Export history`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出记录`,`Export history`)}),(0,z.jsx)(`p`,{children:t(`服务器记录的导出范围、操作身份与结果。`,`Server-recorded export scope, operator and outcome.`)}),nt.isPending?(0,z.jsx)(h,{}):nt.error?(0,z.jsx)(`p`,{role:`alert`,children:Ot(nt.error)}):nt.data?.events.length?(0,z.jsx)(`div`,{className:`admin-data-table-wrap`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:t(`时间`,`Time`)}),(0,z.jsx)(`th`,{children:t(`操作`,`Action`)}),(0,z.jsx)(`th`,{children:t(`身份 / 用途`,`Actor / purpose`)}),(0,z.jsx)(`th`,{children:t(`结果`,`Outcome`)})]})}),(0,z.jsx)(`tbody`,{children:nt.data.events.map(n=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:Ge(n.created_at,e)}),(0,z.jsxs)(`td`,{children:[n.action,(0,z.jsxs)(`small`,{children:[n.projects??`—`,` `,t(`个项目`,`projects`)]})]}),(0,z.jsxs)(`td`,{children:[n.actor,(0,z.jsx)(`small`,{children:n.purpose===`external_sharing`?t(`对外共享`,`External sharing`):t(`内部训练`,`Internal training`)})]}),(0,z.jsx)(`td`,{children:n.outcome})]},n.id))})]})}):(0,z.jsx)(`p`,{children:t(`尚无导出记录。`,`No export history yet.`)})]})}),(0,z.jsx)(ye,{open:j===`diagnostics`,onClose:()=>M(null),label:t(`采集诊断`,`Capture diagnostics`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`采集诊断`,`Capture diagnostics`)}),(0,z.jsx)(`p`,{children:J.error?Ot(J.error):Ke(J.data?.state,e)}),(0,z.jsx)(`div`,{className:`admin-data-diagnostics`,children:Object.entries(J.data?.tool_capture?.tenants??{}).map(([n,r])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:Ke(r.state,e)}),(0,z.jsxs)(`span`,{children:[r.counts.events_received??0,` `,t(`条接收事件`,`events received`)]}),r.last_error_code?(0,z.jsx)(`code`,{children:r.last_error_code}):null]},n))}),(0,z.jsx)(v,{label:t(`完整诊断数据`,`Full diagnostic data`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:JSON.stringify({collector:J.data,project:Y,collection:X.data?.collection,gaps:X.data?.gaps,completeness:q?.completeness},null,2)})})]})})]})}export{tt as default,ve as saveDownload}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AdminDataApp-BonVgDiU.js b/frontend/web/dist/assets/AdminDataApp-BonVgDiU.js new file mode 100644 index 000000000..2ac3ff4f9 --- /dev/null +++ b/frontend/web/dist/assets/AdminDataApp-BonVgDiU.js @@ -0,0 +1,13 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i,n as a,o,t as ee}from"./query-CUzIxVzm.js";import{H as s,K as c,O as l,k as u,q as d}from"./index-W1lBlVkr.js";import{A as te,C as f,E as p,F as ne,I as re,L as ie,M as ae,N as oe,O as se,P as ce,R as m,S as le,_ as ue,b as de,c as h,d as fe,f as pe,g as me,i as g,j as he,k as ge,l as _e,n as ve,p as ye,r as _,s as v,t as be,u as xe,w as y,x as Se}from"./AppearanceControls-BFWF0z-J.js";import{n as Ce,t as we}from"./history-BtuT-8i3.js";import{n as Te,t as Ee}from"./code-xml-DwzUAooI.js";import{r as De,t as Oe}from"./useWorkbenchTheme-D7cPkLzc.js";var ke=m(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ae=m(`FileJson`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),je=m(`Menu`,[[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}],[`line`,{x1:`4`,x2:`20`,y1:`6`,y2:`6`,key:`1owob3`}],[`line`,{x1:`4`,x2:`20`,y1:`18`,y2:`18`,key:`yk5zj1`}]]),b=m(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Me=m(`Users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),x=e(t(),1),S=6e4,Ne=12e4,Pe=class extends c{loginURL;constructor(e){super(e.status===401?`数据后台登录已过期,请重新登录。`:e.message,e.status,e.method,e.path,e.status===401?`admin_authentication_required`:e.code),this.name=`AdminAPIError`,this.loginURL=e.status===401?`/admin/login`:null}};function C(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function w(e,t){return`/admin/api/training/${e}/${encodeURIComponent(t.tenant)}/${encodeURIComponent(t.sid)}`}async function T(e,t,n){try{await d(e,t,n)}catch(e){throw e instanceof c&&n.startsWith(`/admin/`)?new Pe(e):e}}function E(e,t=`GET`){return new Pe(new c(`数据后台响应格式不正确。`,502,t,e,`invalid_admin_response`))}async function D(e,t={}){return s(e,{method:`GET`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{Accept:`application/json`},signal:t.signal},S,async t=>{await T(t,`GET`,e);try{return await t.json()}catch{throw E(e)}})}function Fe(e){let t=e?.match(/(?:^|;)\s*filename\*=UTF-8''([^;]+)/i)?.[1],n=e?.match(/(?:^|;)\s*filename\s*=\s*(?:"([^"]*)"|([^;]+))/i),r=n?.[1]??n?.[2]?.trim()??``;if(t)try{r=decodeURIComponent(t.trim())}catch{}return r.length>0&&r.length<=180&&/\.zip$/i.test(r)&&!/[\x00-\x1f\x7f/\\:]/.test(r)&&!r.startsWith(`.`)?r:`argus-observations.zip`}var O={overview(e={}){return D(`/admin/api/training/collaboration`+C({purpose:e.purpose??`internal_training`,offset:e.offset??0,tenant:e.tenant,query:e.query}),e)},detail(e){return D(w(`collaboration`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId}),e)},observations(e){return D(w(`observations`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId,cursor:e.cursor,limit:e.limit}),e)},async identity(e={}){let t=`/admin/status`,n=await D(t,e);if(n?.role!==`admin`||typeof n.readonly!=`boolean`)throw E(t);return n},async workspaceIdentity(e={}){let t=`/invite/status`,n=await D(t,e);if(typeof n?.key_id!=`string`||typeof n.role!=`string`||typeof n.readonly!=`boolean`)throw E(t);return{key_id:n.key_id,role:n.role,readonly:n.readonly}},collector(e={}){return D(`/admin/api/research/status`,e)},projectDirectory(e,t={}){return D(`/admin/api/tenants/${encodeURIComponent(e)}/projects`,t)},audit(e={}){return D(`/admin/api/training/audit`+C({limit:e.limit}),e)},exportObservations(e,t={}){let n=`/admin/api/training/export-observations`;return s(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{"Content-Type":`application/json`,Accept:`application/zip`},body:JSON.stringify({purpose:e.purpose,projects:e.projects.map(({tenant_id:e,sid:t})=>({tenant_id:e,sid:t}))}),signal:t.signal},Ne,async e=>{if(await T(e,`POST`,n),e.headers.get(`Content-Type`)?.split(`;`)[0].trim().toLowerCase()!==`application/zip`)throw E(n,`POST`);return{blob:await e.blob(),filename:Fe(e.headers.get(`Content-Disposition`))}})}},k=new Set([`thinking`,`analysis`,`reasoning`,`redacted_thinking`,`signature`]),Ie=RegExp(`^(${de.join(`|`)})(?:[.-][a-z0-9_.-]+)?$`);function A(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function j(e){return typeof e==`string`?e:``}function M(e){return e==null?``:JSON.stringify(e,null,2)}function N(e){return JSON.stringify([e.tenant_id,e.sid])}function Le(e){return e.title?.trim()||e.sid||`未命名项目`}function Re(e){return(e.mission_title||e.title)?.trim().replace(/^#+\s*/,``).split(` +`)[0]||(e.task_id?`任务 ${e.task_id}`:`项目活动`)}function ze(e){return typeof e==`string`?e===`operator`||e===`unknown`?e:e.match(Ie)?.[1]??`unknown`:`unknown`}function Be(e){return typeof e.role==`string`?ze(e.role):ze(e.runtime?.run_label)}function Ve(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{tenant:t.get(`tenant`),sid:t.get(`sid`),taskId:t.get(`task_id`)??t.get(`task`)}}function He(e){let t=e[0];if(!t)return[];let n=JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id]),r=new Map,i=new Map;for(let t of e){if(JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id])!==n)throw Error(`Cannot merge observations from different project, purpose, or task scopes.`);for(let e of t.episodes){if(N(e)!==N(t)||t.task_id!==null&&e.task_id!==t.task_id)throw Error(`Observation episode does not match its page scope.`);let n=r.get(e.episode_id);if(n&&n.task_id!==e.task_id)throw Error(`Observation episode changed task association.`);let a=i.get(e.episode_id)??new Map;for(let t of e.events){if(!Number.isSafeInteger(t.sequence)||t.sequence<0)throw Error(`Observation sequence is invalid.`);a.set(t.sequence,t)}i.set(e.episode_id,a),r.set(e.episode_id,{...e,events:[]})}}return[...r.values()].sort((e,t)=>e.episode_id-t.episode_id).map(e=>({...e,events:[...i.get(e.episode_id).values()].sort((e,t)=>e.sequence-t.sequence)}))}function P(e){return[e.type,e.role,e.channel].some(e=>typeof e==`string`&&k.has(e))}function Ue(e){return Array.isArray(e)?e.map(e=>{let t=A(e),n=A(t?.function);return!t||!n?``:[j(n.name),typeof n.arguments==`string`?n.arguments:M(n.arguments)].filter(Boolean).join(` +`)}).filter(Boolean).join(` + +`):``}function F(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(F).filter(Boolean).join(` +`);let t=A(e);return!t||P(t)?``:t.type===`text`||t.type===`input_text`||t.type===`output_text`?j(t.text):t.type===`toolCall`||t.type===`tool_call`?[j(t.name),typeof t.arguments==`string`?t.arguments:M(t.arguments)].filter(Boolean).join(` +`):`content`in t||`tool_calls`in t?[F(t.content),Ue(t.tool_calls)].filter(Boolean).join(` + +`):``}function We(e){if(!Array.isArray(e))return``;let t={system:`系统`,developer:`开发者`,user:`用户`,assistant:`模型`,toolResult:`工具返回`,tool:`工具返回`};return e.map(e=>{let n=A(e);if(!n||P(n))return``;let r=[F(n.content),Ue(n.tool_calls)].filter(Boolean).join(` + +`);return r?`${t[j(n.role)]||j(n.role)||`消息`}\n${r}`:``}).filter(Boolean).join(` + +`)}function I(e){let t=e.payload,[n,r]={context:[`模型输入`,`input`],provider_request:[`模型请求`,`input`],message_delta:[`模型公开输出片段`,`output`],message_end:[`模型消息`,`output`],session_message:[`历史会话消息`,`output`],agent_end:[`模型输出`,`output`],tool_call:[`工具调用`,`tool`],tool_result:[`工具返回`,`tool`],tool_execution_start:[`工具执行开始`,`tool`],tool_execution_update:[`工具执行进度`,`tool`],tool_execution_end:[`工具执行结束`,`tool`],settled:[`本段过程结束`,`status`],quarantine:[`过程状态记录`,`status`],capture_warning:[`采集提示`,`status`]}[e.kind]??[`过程事件 · ${e.kind}`,`other`],i=``;e.kind===`message_delta`?i=t.type===`text_delta`||t.type===`toolcall_delta`?j(t.delta):``:[`context`,`provider_request`,`message_end`,`session_message`,`agent_end`].includes(e.kind)?i=We(t.messages):e.kind===`tool_call`?i=M(t.input):e.kind===`tool_result`?i=F(t.content):e.kind===`tool_execution_start`?i=M(t.args):e.kind===`tool_execution_update`?i=F(t.partialResult):e.kind===`tool_execution_end`?i=F(t.result):(e.kind===`quarantine`||e.kind===`capture_warning`)&&(i=j(t.reason));let a=e.kind===`tool_result`||e.kind===`tool_execution_end`;return{key:e.id??String(e.sequence),kind:e.kind,title:n,category:r,text:i,toolName:j(t.toolName)||null,toolCallId:j(t.toolCallId)||null,result:a?t.isError===!0?`error`:t.isError===!1?`success`:`unknown`:null,timestamp:typeof e.observed_at==`number`&&Number.isFinite(e.observed_at)?e.observed_at:null}}function L(){let{locale:e,t,setLocale:n}=u();return{locale:e,t,setLocale:n,text:(t,n)=>e===`zh-CN`?t:n}}function Ge(e,t){return typeof e==`number`&&Number.isFinite(e)?new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e*1e3):`—`}function R(e,t){return y(e)?f(e,e=>l(e,{},t)):{operator:[`用户`,`User`],unknown:[`角色未记录`,`Unassigned role`],system:[`系统`,`System`],developer:[`运行指令`,`Instructions`],user:[`用户 / 任务`,`User / task`],assistant:[`模型`,`Assistant`],tool:[`工具`,`Tool`]}[e]?.[t===`zh-CN`?0:1]??e}function Ke(e,t){return{complete:[`调用已结束`,`Call ended`],capturing:[`尚无结束记录`,`No end record yet`],interrupted:[`采集中断`,`Capture interrupted`],quarantined:[`需检查记录`,`Record needs attention`],approved:[`已验收`,`Reviewed`],not_approved:[`未验收`,`Not reviewed`],unknown:[`结果未确认`,`Outcome unconfirmed`],running:[`采集正常`,`Collector running`],storage_error:[`存储异常`,`Storage unavailable`],starting:[`正在启动`,`Starting`],listening:[`已连接`,`Listening`],unavailable:[`暂不可用`,`Unavailable`]}[e||`unknown`]?.[t===`zh-CN`?0:1]??e??`—`}function qe(e,t){return{context:[`Agent 上下文`,`Agent context`],provider_request:[`模型实际输入`,`Model request`],message_end:[`公开消息`,`Public message`],agent_end:[`调用结果`,`Call output`],message_delta:[`公开输出增量`,`Public output increments`],tool_call:[`工具调用`,`Tool call`],tool_result:[`工具结果`,`Tool result`],tool_execution_start:[`工具开始执行`,`Tool execution started`],tool_execution_update:[`工具执行更新`,`Tool execution update`],tool_execution_end:[`工具执行结束`,`Tool execution ended`],settled:[`采集已收尾`,`Capture settled`],quarantine:[`记录不完整`,`Incomplete record`],capture_warning:[`采集提示`,`Capture notice`]}[e]?.[t===`zh-CN`?0:1]??e}var z=n(),B=e=>JSON.stringify(e,null,2);function V({value:e}){let{text:t}=L();return(0,z.jsxs)(v,{label:t(`原始 JSON`,`Raw JSON`),children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(ue,{text:B(e),label:t(`复制 JSON`,`Copy JSON`),copiedLabel:t(`已复制`,`Copied`)})}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(e)})]})}function Je({message:e,index:t}){let{locale:n,text:r}=L(),[i,a]=(0,x.useState)(!1),o=F(e);return(0,z.jsxs)(`details`,{className:`admin-data-message`,onToggle:e=>a(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,z.jsx)(`strong`,{children:R(e.role||`unknown`,n)}),(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[o.length.toLocaleString(n),` `,r(`字符`,`characters`)]}),(0,z.jsx)(ne,{size:13})]}),i?(0,z.jsxs)(`div`,{className:`admin-data-message-body`,children:[o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(ue,{text:o,label:r(`复制内容`,`Copy text`),copiedLabel:r(`已复制`,`Copied`)}),(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:o})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:r(`这条消息没有公开文本;结构见下方。`,`This message has no public text; its structure is below.`)}),(0,z.jsx)(V,{value:e})]}):null]})}function H({event:e}){let{locale:t,text:n}=L(),r=I(e),i=e.payload,a=Array.isArray(i.messages)?i.messages:[];return(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[e.kind===`provider_request`?(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[typeof i.model==`string`?(0,z.jsx)(g,{children:i.model}):null,typeof i.reasoning_effort==`string`?(0,z.jsx)(g,{children:i.reasoning_effort}):null,(0,z.jsxs)(`span`,{children:[a.length.toLocaleString(t),` `,n(`条消息`,`messages`),` · `,(i.tools?.length||0).toLocaleString(t),` `,n(`个工具定义`,`tool definitions`)]})]}):null,a.length?(0,z.jsx)(`div`,{className:`admin-data-message-list`,children:a.map((e,t)=>(0,z.jsx)(Je,{message:e,index:t},t))}):r.text?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(ue,{text:r.text,label:n(`复制内容`,`Copy text`),copiedLabel:n(`已复制`,`Copied`)})}),r.category===`tool`||e.kind===`message_delta`?(0,z.jsx)(`pre`,{className:`admin-data-code`,children:r.text}):(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:r.text})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:n(`此事件保留了状态和结构,没有公开文本。`,`This event contains status and structure, with no public text.`)}),i.tools?.length?(0,z.jsx)(v,{label:n(`工具定义`,`Tool definitions`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(i.tools)})}):null,(0,z.jsx)(V,{value:e})]})}function U(e){let t=[];for(let n of e){let e=n.kind===`message_delta`?JSON.stringify([n.kind,n.payload.type,n.payload.message_index,n.payload.content_index,n.payload.toolCallId]):`event:${n.sequence}`,r=t[t.length-1];n.kind===`message_delta`&&r?.key===e?r.events.push(n):t.push({key:e,events:[n]})}return t}function W({group:e}){let{locale:t,text:n}=L(),[r,i]=(0,x.useState)(!1),a=e.events[0],o=I(a),ee=o.category===`tool`?ge:o.category===`input`?Ee:b,s=e.events.length>1,c=s?e.events.map(e=>I(e).text).join(``):o.text,l=a.kind===`provider_request`?`${a.payload.messages?.length??0} ${n(`条消息`,`messages`)} · ${a.payload.tools?.length??0} ${n(`个工具`,`tools`)}`:(a.payload.messages?F(a.payload.messages):c).replace(/\s+/g,` `).slice(0,110);return(0,z.jsxs)(`details`,{className:`admin-data-event`,"data-event-kind":a.kind,onToggle:e=>i(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{className:`admin-data-event-icon`,children:(0,z.jsx)(ee,{size:15})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`admin-data-event-title`,children:[(0,z.jsxs)(`strong`,{children:[qe(a.kind,t),o.toolName?` · ${o.toolName}`:``]}),s?(0,z.jsxs)(g,{children:[e.events.length,` `,n(`条增量`,`increments`)]}):null,o.result===`error`?(0,z.jsx)(g,{color:p.error,children:n(`工具报告错误`,`Tool reported an error`)}):null,o.result===`success`?(0,z.jsx)(g,{color:p.success,children:n(`工具报告成功`,`Tool reported success`)}):null]}),l?(0,z.jsx)(`p`,{className:`admin-data-event-preview`,children:l}):null]}),(0,z.jsx)(`span`,{className:`admin-data-event-time`,children:Ge(a.observed_at,t)}),(0,z.jsx)(ne,{size:14})]}),r?s?(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[(0,z.jsx)(ue,{text:c,label:n(`复制输出`,`Copy output`),copiedLabel:n(`已复制`,`Copied`)}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:c}),(0,z.jsx)(V,{value:e.events})]}):(0,z.jsx)(H,{event:a}):null]})}function Ye({episode:e,readonly:t,onDownload:n}){let{locale:r,text:i}=L(),[a,o]=(0,x.useState)(`all`),[ee,s]=(0,x.useState)(0),c=(0,x.useMemo)(()=>U(e.events.filter(e=>{let t=I(e).category;return a===`all`||(a===`tools`?t===`tool`:t===`input`||t===`output`)})),[e.events,a]);(0,x.useEffect)(()=>s(0),[e.episode_id,a]);let l=Math.max(1,Math.ceil(c.length/60)),u=Math.min(ee,l-1),d=c.slice(u*60,u*60+60),te=e.events.length,f=e.collection.event_count,ne=e.quality.approved===!0&&e.quality.state===`approved`;return(0,z.jsxs)(`section`,{className:`admin-data-inspector`,"aria-label":i(`过程详情`,`Process details`),children:[(0,z.jsxs)(`div`,{className:`admin-data-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h3`,{children:[R(e.role,r),` `,(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[`· #`,e.episode_id]})]}),(0,z.jsxs)(`p`,{children:[Ge(e.started_at,r),` · `,e.task_id?`${i(`任务`,`Task`)} ${e.task_id}`:i(`项目级 / 未关联任务`,`Project-level / no task association`)]})]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:t,onClick:()=>n(e),title:t?i(`只读会话不能导出`,`Exports are disabled for read-only sessions`):i(`下载当前已加载的原始记录`,`Download the raw records currently loaded`),children:[(0,z.jsx)(ce,{size:14}),` JSON`]})]}),(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[(0,z.jsx)(g,{children:Ke(e.state,r)}),(0,z.jsx)(g,{color:ne?p.success:void 0,children:ne?i(`已验收`,`Reviewed`):i(`未验收`,`Not reviewed`)}),(0,z.jsxs)(`span`,{children:[i(`已加载`,`Loaded`),` `,te.toLocaleString(r),` / `,f.toLocaleString(r),` `,i(`条事件`,`events`)]}),e.runtime.run_label?(0,z.jsx)(`code`,{children:e.runtime.run_label}):null]}),!e.collection.complete||e.collection.historical_data_unavailable||te(0,z.jsx)(`button`,{type:`button`,"aria-pressed":a===e,className:a===e?`active`:``,onClick:()=>o(e),children:e===`all`?i(`全部事件`,`All events`):e===`messages`?i(`模型输入 / 输出`,`Model input / output`):i(`工具轨迹`,`Tool trace`)},e))}),c.length?(0,z.jsx)(`div`,{className:`admin-data-timeline`,children:d.map(t=>(0,z.jsx)(W,{group:t},`${e.episode_id}:${t.events[0].sequence}`))}):(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(Ae,{size:24}),(0,z.jsx)(`p`,{children:i(`当前已加载的记录中没有此类事件。`,`No events of this type are present in the loaded records.`)})]}),c.length>60?(0,z.jsxs)(`div`,{className:`admin-data-paging`,"aria-label":i(`当前过程的事件分页`,`Event pages for this process`),children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!u,onClick:()=>s(u-1),title:i(`上一段事件`,`Previous event group`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[u*60+1,`–`,Math.min(c.length,u*60+60),` / `,c.length.toLocaleString(r),` `,i(`组事件`,`event groups`)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:u+1>=l,onClick:()=>s(u+1),title:i(`下一段事件`,`Next event group`),children:(0,z.jsx)(Te,{size:14})})]}):null,(0,z.jsx)(V,{value:{...e,events:void 0,loaded_event_count:te}})]})}function Xe(e,t,n=``){let r=new URL(e);return r.searchParams.set(`tenant`,t.tenant_id),r.searchParams.set(`sid`,t.sid),n?r.searchParams.set(`task_id`,n):r.searchParams.delete(`task_id`),r.searchParams.delete(`task`),`${r.pathname}${r.search}${r.hash}`}function Ze(e,t,n,r){if(e.some(e=>N(e)===t))return null;let i=r&&n.sid?e.filter(e=>e.sid===n.sid&&(!n.tenant||e.tenant_id===n.tenant)):[],a=i.length===1?i[0]:void 0;if(r&&n.sid&&!a)return null;let o=a??e[0];return{key:o?N(o):``,taskId:a&&n.taskId||``}}async function Qe(e,t,n){let r=await t(),i=r.role===`trial`&&r.key_id===e.tenant_id;return i&&n(`/?project=${encodeURIComponent(e.sid)}`),{matched:i,identity:r}}var $e=Array.from({length:11},(e,t)=>`trial-${String(t+1).padStart(2,`0`)}`),G=(e,t)=>e<1&&!(t instanceof Pe&&[401,403].includes(t.status));function et(e){let[t,n]=(0,x.useState)(e);return(0,x.useEffect)(()=>{let t=window.setTimeout(()=>n(e),250);return()=>window.clearTimeout(t)},[e]),t}function tt(){let{locale:e,text:t,t:n}=L(),{themeMode:s,cycleTheme:c}=Oe(),l=i(),[u]=(0,x.useState)(()=>Ve(window.location.search)),[d,f]=(0,x.useState)(!!u.sid),[p,ne]=(0,x.useState)(u.tenant||``),[m,ge]=(0,x.useState)(``),[y,Ee]=(0,x.useState)(`internal_training`),[b,S]=(0,x.useState)(0),[Ne,C]=(0,x.useState)(u.tenant&&u.sid?N({tenant_id:u.tenant,sid:u.sid}):``),[w,T]=(0,x.useState)(u.taskId||``),[E,D]=(0,x.useState)(null),[Fe,k]=(0,x.useState)(null),[Ie,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(null),[P,Ue]=(0,x.useState)(()=>new Map),[F,We]=(0,x.useState)(``),[I,qe]=(0,x.useState)(!1),[B,V]=(0,x.useState)(null),Je=et(m),H=r({queryKey:[`admin-data`,`identity`],queryFn:({signal:e})=>O.identity({signal:e}),staleTime:3e4,retry:!1}),U=H.data?.role===`admin`,W=H.data?.readonly!==!1,tt=!!Je||d,K=r({queryKey:[`admin-data`,`overview`,y,p,tt?`all-pages`:b],queryFn:async({signal:e})=>{let t=await O.overview({purpose:y,tenant:p,offset:tt?0:b,signal:e}),n=[t],r=new Set([t.offset]);for(;tt&&n[n.length-1].has_more_projects;){let t=n[n.length-1].next_offset;if(t===null||r.has(t))throw Error(`Invalid project pagination`);r.add(t),n.push(await O.overview({purpose:y,tenant:p,offset:t,signal:e}))}return n},enabled:U,retry:G,refetchInterval:!tt&&2e4}),q=(0,x.useMemo)(()=>{let e=K.data;if(!e?.length)return;let t=e[e.length-1];return{...e[0],projects:e.flatMap(e=>e.projects),tasks:e.flatMap(e=>e.tasks),has_more_projects:t.has_more_projects,next_offset:t.next_offset,completeness:{...e[0].completeness,page_truncated:e.some(e=>e.completeness.page_truncated)}}},[K.data]),J=r({queryKey:[`admin-data`,`collector`],queryFn:({signal:e})=>O.collector({signal:e}),enabled:U,retry:G,refetchInterval:15e3}),nt=r({queryKey:[`admin-data`,`audit`],queryFn:({signal:e})=>O.audit({signal:e}),enabled:U&&j===`audit`,retry:G}),rt=q?.projects??[],it=(0,x.useMemo)(()=>[...new Set(rt.map(e=>e.tenant_id))].sort(),[rt]),at=o({queries:it.map(e=>({queryKey:[`admin-data`,`directory`,e],queryFn:({signal:t})=>O.projectDirectory(e,{signal:t}),enabled:U,staleTime:6e4,retry:G}))}),ot=new Map;at.forEach((e,t)=>{for(let n of e.data?.projects??[])n.title&&ot.set(N({tenant_id:it[t],sid:n.id}),n.title)});let st=e=>ot.get(N(e))||Le(e),ct=Je.trim().toLocaleLowerCase(e),lt=rt.filter(t=>!ct||[st(t),t.title,t.tenant_id,t.sid,...(q?.tasks??[]).filter(e=>N(e)===N(t)).flatMap(e=>[Re(e),e.task_id||``])].some(t=>t.toLocaleLowerCase(e).includes(ct))),Y=lt.find(e=>N(e)===Ne)??null,ut=(q?.tasks??[]).filter(e=>Y&&N(e)===N(Y)),dt=ut.filter(e=>e.task_id),ft=ut.find(e=>e.task_id===w)??null;(0,x.useEffect)(()=>{if(!q)return;let e=Ze(lt,Ne,u,d);if(!e)return;C(e.key),k(null),D(null),T(e.taskId);let t=lt.find(t=>N(t)===e.key);t&&xt(t,e.taskId)},[q,Ne,u,d,Je,at.map(e=>e.dataUpdatedAt).join(`,`)]);let pt=[y,Y?.tenant_id,Y?.sid,w||null],X=r({queryKey:[`admin-data`,`detail`,...pt],queryFn:({signal:e})=>O.detail({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,signal:e}),enabled:U&&!!Y?.eligible,retry:G}),Z=ft??(w&&X.data?.task_id===w?X.data:null),mt=!w||!!Z,Q=ee({queryKey:[`admin-data`,`observations`,...pt],queryFn:({pageParam:e,signal:t})=>O.observations({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,cursor:e,limit:200,signal:t}),initialPageParam:null,getNextPageParam:e=>e.pagination.has_more?e.pagination.next_cursor:void 0,enabled:U&&!!Y?.eligible&&mt,retry:G}),ht=(0,x.useMemo)(()=>He(Q.data?.pages??[]),[Q.data]),gt=ht.filter(e=>E===null||Be(e)===E),_t=gt.find(e=>e.episode_id===Fe)??gt[0]??null,vt=new Map;for(let e of w?Z?[Z]:[]:ut)for(let t of e.roles){let e=ze(t.role),n=vt.get(e);vt.set(e,{...t,role:e,observations:(n?.observations||0)+t.observations,episodes:(n?.episodes||0)+t.episodes,tool_pairs:(n?.tool_pairs||0)+t.tool_pairs})}let yt=ht.reduce((e,t)=>e+t.events.length,0),bt=P.size?[...P.values()]:Y?[Y]:[],$=a({mutationFn:()=>{if(W||!bt.length||bt.length>20)throw Error(t(`请选择最多 20 个可导出的项目。`,`Select up to 20 eligible projects.`));return O.exportObservations({purpose:y,projects:bt})},onSuccess:e=>{ve(e.blob,e.filename),We(t(`全部保留过程已下载。`,`All retained process data downloaded.`)),l.invalidateQueries({queryKey:[`admin-data`,`audit`]})}}),xt=(e,t=``)=>{window.history.replaceState(window.history.state,``,Xe(window.location.href,e,t))},St=e=>{f(!1),C(N(e)),T(``),D(null),k(null),A(!1),xt(e)},Ct=e=>{T(e),k(null),D(null),Y&&xt(Y,e)},wt=e=>Ue(t=>{let n=new Map(t),r=N(e);return n.has(r)?n.delete(r):n.size<20&&n.set(r,e),n}),Tt=()=>{l.invalidateQueries({queryKey:[`admin-data`]})},Et=e=>{W||ve(new Blob([JSON.stringify({scope:`loaded_observations`,loaded_event_count:e.events.length,episode:e},null,2)],{type:`application/json`}),`${e.tenant_id}-${e.sid}-process-${e.episode_id}.json`)},Dt=async()=>{if(!(!Y||I)){qe(!0);try{let e=await Qe(Y,()=>O.workspaceIdentity(),e=>window.location.assign(e));V(e.identity.role===`trial`?e.identity.key_id:null),e.matched||M(`workspace`)}catch{V(null),M(`workspace`)}finally{qe(!1)}}},Ot=e=>e instanceof Pe&&e.status===401?t(`数据后台登录已过期,请重新登录。`,`Your administrator session expired. Sign in again.`):e instanceof Error?e.message:t(`暂时无法读取数据。`,`Data is temporarily unavailable.`);return(0,z.jsxs)(fe,{className:`admin-data-workspace h-full`,style:{"--sidebar-width":`292px`},children:[Ie?(0,z.jsx)(`button`,{type:`button`,className:`admin-data-scrim lg:hidden`,"aria-label":t(`关闭项目列表`,`Close projects`),onClick:()=>A(!1)}):null,(0,z.jsxs)(pe,{mobileOpen:Ie,className:`admin-data-sidebar`,"aria-label":t(`数据项目`,`Data projects`),children:[(0,z.jsxs)(`div`,{className:`admin-data-sidebar-brand`,children:[(0,z.jsx)(De,{size:25}),(0,z.jsx)(g,{children:t(`数据`,`Data`)}),(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button ml-auto lg:hidden`,onClick:()=>A(!1),"aria-label":n(`common.close`),children:(0,z.jsx)(se,{size:18})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-heading`,children:[(0,z.jsx)(`span`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`span`,{children:q?.total_projects??`—`})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-controls`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`账号`,`Account`)}),(0,z.jsxs)(`select`,{"aria-label":t(`筛选账号`,`Filter account`),value:p,onChange:e=>{f(!1),ne(e.target.value),S(0),T(``)},children:[(0,z.jsx)(`option`,{value:``,children:t(`全部 11 个账号`,`All 11 accounts`)}),$e.map(e=>(0,z.jsx)(`option`,{children:e},e))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-search`,children:[(0,z.jsx)(he,{size:15}),(0,z.jsx)(`input`,{"aria-label":t(`搜索项目、任务或 SID`,`Search projects, tasks or SID`),placeholder:t(`搜索项目或任务…`,`Search projects or tasks…`),value:m,onChange:e=>{f(!1),ge(e.target.value),S(0)}})]})]}),(0,z.jsxs)(`div`,{className:`admin-data-projects`,"aria-busy":K.isFetching,children:[K.isPending&&U?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(h,{}),(0,z.jsx)(`p`,{children:t(`正在读取项目…`,`Loading projects…`)})]}):null,K.error?(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`alert`,children:[Ot(K.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void K.refetch(),children:n(`common.retry`)})]}):null,!K.isPending&&!lt.length&&!K.error?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(ke,{size:22}),(0,z.jsx)(`p`,{children:t(`没有符合筛选条件的项目。`,`No projects match these filters.`)})]}):null,lt.map(n=>{let r=N(n)===Ne,i=(q?.tasks??[]).filter(e=>N(e)===N(n)).reduce((e,t)=>e+t.collection.retained_episodes,0);return(0,z.jsxs)(`div`,{"data-testid":`project-${n.tenant_id}-${n.sid}`,className:`admin-data-project ${r?`active`:``}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-project-open`,"aria-current":r?`page`:void 0,onClick:()=>St(n),children:[(0,z.jsx)(`span`,{className:`admin-data-project-title`,children:st(n)}),(0,z.jsxs)(`span`,{className:`admin-data-project-id`,children:[n.tenant_id,` · `,n.sid]}),(0,z.jsx)(`span`,{className:`admin-data-project-meta`,children:n.eligible?i?`${i.toLocaleString(e)} ${t(`段保留过程`,`retained processes`)}`:t(`尚无保留过程`,`No process data retained`):t(`当前用途不可读取`,`Unavailable for this purpose`)})]}),(0,z.jsx)(`input`,{type:`checkbox`,className:`admin-data-project-check`,"aria-label":`${t(`选择导出项目`,`Select project for export`)} ${st(n)} ${n.tenant_id} ${n.sid}`,checked:P.has(N(n)),disabled:W||!n.eligible||P.size>=20&&!P.has(N(n)),onChange:()=>wt(n)})]},N(n))})]}),(0,z.jsxs)(`div`,{className:`admin-data-paging`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!b||K.isFetching,onClick:()=>S(Math.max(0,b-20)),title:t(`上一页项目`,`Previous project page`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[t(`第`,`Page`),` `,Math.floor(b/20)+1,` `,t(`页`,``)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!q?.has_more_projects||K.isFetching,onClick:()=>S(q?.next_offset??b+20),title:t(`下一页项目`,`Next project page`),children:(0,z.jsx)(Te,{size:14})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-footer`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`audit`),children:[(0,z.jsx)(we,{size:15}),t(`导出记录`,`Export history`)]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`diagnostics`),children:[(0,z.jsx)(ie,{size:15}),t(`采集诊断`,`Capture diagnostics`)]}),(0,z.jsxs)(`a`,{href:`/invite`,children:[(0,z.jsx)(oe,{size:15}),t(`用户工作空间`,`User workspace`)]})]})]}),(0,z.jsxs)(`main`,{className:`admin-data-surface`,children:[(0,z.jsxs)(xe,{children:[(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button lg:hidden`,onClick:()=>A(!0),"aria-label":t(`打开项目列表`,`Open projects`),children:(0,z.jsx)(je,{size:18})}),(0,z.jsx)(`span`,{className:`admin-data-header-title`,children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(g,{children:W?t(`只读管理员`,`Read-only administrator`):t(`管理员`,`Administrator`)}),(0,z.jsxs)(`div`,{className:`ml-auto flex items-center gap-1 sm:gap-2`,children:[(0,z.jsx)(be,{themeMode:s,onCycleTheme:c}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:Tt,disabled:K.isFetching||!U,title:t(`刷新数据`,`Refresh data`),children:K.isFetching?(0,z.jsx)(h,{}):(0,z.jsx)(ae,{size:14})}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!Y?.eligible||$.isPending,onClick:()=>{We(``),M(`export`)},children:[(0,z.jsx)(ce,{size:14}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:t(`导出`,`Export`)})]})]})]}),(0,z.jsx)(`div`,{className:`admin-data-content`,children:U?Y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-project-heading`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`p`,{className:`admin-data-eyebrow`,children:[(0,z.jsx)(ke,{size:13}),t(`已授权的过程数据`,`Authorized process data`)]}),(0,z.jsx)(`h1`,{children:st(Y)}),(0,z.jsxs)(`div`,{className:`admin-data-project-identity`,children:[(0,z.jsxs)(`code`,{children:[Y.tenant_id,` / `,Y.sid]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:I,onClick:()=>void Dt(),children:[I?(0,z.jsx)(h,{}):(0,z.jsx)(oe,{size:13}),t(`在用户端打开`,`Open in user workspace`)]}),(0,z.jsx)(ue,{text:`${window.location.origin}/admin/data?tenant=${encodeURIComponent(Y.tenant_id)}&sid=${encodeURIComponent(Y.sid)}`,label:t(`复制后台链接`,`Copy data link`),copiedLabel:t(`已复制`,`Copied`)})]})]}),(0,z.jsxs)(`span`,{className:`admin-data-collector-status`,children:[(0,z.jsx)(_e,{ok:J.data?.state===`running`}),J.error?t(`采集状态暂不可读`,`Capture status unavailable`):Ke(J.data?.state,e)]})]}),(0,z.jsxs)(`div`,{className:`admin-data-context-bar`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field flex-1`,children:[(0,z.jsx)(`span`,{children:t(`查看范围`,`View scope`)}),(0,z.jsxs)(`select`,{value:w,onChange:e=>Ct(e.target.value),"aria-label":t(`选择任务或整个项目`,`Select a task or the entire project`),children:[(0,z.jsx)(`option`,{value:``,children:t(`整个项目 · 包含任务创建前的过程`,`Entire project · includes pre-task processes`)}),w&&!dt.some(e=>e.task_id===w)?(0,z.jsxs)(`option`,{value:w,children:[Z?Re(Z):t(`链接中的任务`,`Linked task`),` · `,w]}):null,dt.map(e=>(0,z.jsxs)(`option`,{value:e.task_id,children:[Re(e),` · `,e.task_id]},e.task_id))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`数据用途`,`Data purpose`)}),(0,z.jsxs)(`select`,{value:y,onChange:e=>{Ee(e.target.value),Ue(new Map),S(0)},children:[(0,z.jsx)(`option`,{value:`internal_training`,children:t(`内部训练`,`Internal training`)}),(0,z.jsx)(`option`,{value:`external_sharing`,children:t(`对外共享`,`External sharing`)})]})]})]}),Y.eligible?(0,z.jsxs)(z.Fragment,{children:[w&&Z?(0,z.jsxs)(v,{label:t(`任务目标与来源`,`Task objective and source`),children:[(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:Z.objective||Z.request?.text||Z.title})}),(0,z.jsx)(`code`,{children:Z.task_id})]}):null,mt?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-role-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h2`,{children:[(0,z.jsx)(Me,{size:17}),t(`多 Agent 过程`,`Multi-agent processes`)]}),(0,z.jsx)(`p`,{children:t(`查看各角色实际留下的记录。角色缺失、中断和质量验收分别标记。`,`Inspect the records each role actually produced. Missing roles, interruptions and review status are shown separately.`)})]}),(0,z.jsx)(`button`,{type:`button`,className:`admin-data-text-button ${E===null?`active`:``}`,onClick:()=>{D(null),k(null)},children:t(`全部角色`,`All roles`)})]}),(0,z.jsx)(`div`,{className:`admin-data-roles`,children:de.map(r=>{let i=vt.get(r),a=Math.max(i?.episodes||0,ht.filter(e=>Be(e)===r).length),o=ht.filter(e=>Be(e)===r).length;return(0,z.jsxs)(`button`,{type:`button`,"data-testid":`role-${r}`,className:`admin-data-role ${E===r?`active`:``}`,style:{"--role-color":Se(r)},"aria-pressed":E===r,onClick:()=>{D(r),k(null)},children:[(0,z.jsxs)(`span`,{className:`admin-data-role-label`,children:[(0,z.jsx)(`span`,{className:`admin-data-role-mark`,children:R(r,e).slice(0,1)}),(0,z.jsx)(`strong`,{children:R(r,e)}),(0,z.jsx)(`span`,{children:r})]}),(0,z.jsx)(`span`,{className:`admin-data-role-description`,children:le(r,n)}),(0,z.jsx)(`span`,{className:`admin-data-role-count`,children:a?`${a.toLocaleString(e)} ${t(`段过程`,`processes`)}`:i?.observations?t(`仅有活动记录`,`Activity records only`):t(`尚未采到记录`,`No records captured`)}),(0,z.jsx)(`span`,{className:`admin-data-role-footnote`,children:o?`${t(`正文已加载`,`Content loaded`)} ${o.toLocaleString(e)}`:t(`按原始记录归属角色`,`Role comes from recorded metadata`)})]},r)})}),vt.get(`unknown`)?.episodes||ht.some(e=>Be(e)===`unknown`)?(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-unknown`,onClick:()=>{D(`unknown`),k(null)},children:[(0,z.jsx)(Ae,{size:14}),t(`另有角色未记录的过程,保留原样查看`,`Some processes have no recorded role. View them as captured.`),` `,(0,z.jsx)(Te,{size:13})]}):null,(0,z.jsxs)(`div`,{className:`admin-data-record-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{children:E?R(E,e):t(`全部保留过程`,`All retained processes`)}),(0,z.jsxs)(`p`,{children:[ht.length.toLocaleString(e),` `,t(`段已加载`,`processes loaded`),` · `,yt.toLocaleString(e),` `,t(`条原始事件`,`raw events`),` `,Q.hasNextPage?t(`· 还有后续页`,`· more pages available`):``]})]}),gt.length?(0,z.jsx)(`select`,{className:`admin-data-episode-select`,"aria-label":t(`选择过程记录`,`Select a process`),value:_t?.episode_id??``,onChange:e=>k(Number(e.target.value)),children:gt.map(t=>(0,z.jsxs)(`option`,{"data-testid":`episode-${t.episode_id}`,value:t.episode_id,children:[`#`,t.episode_id,` · `,R(t.role,e),` · `,Ge(t.started_at,e)]},t.episode_id))}):null]}),Q.error?(0,z.jsxs)(`div`,{role:`alert`,className:`admin-data-notice`,children:[Ot(Q.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void Q.refetch(),children:n(`common.retry`)})]}):null,_t?(0,z.jsx)(Ye,{episode:_t,readonly:W,onDownload:Et},_t.episode_id):(0,z.jsxs)(`div`,{className:`admin-data-empty admin-data-record-empty`,children:[Q.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(Ae,{size:28}),(0,z.jsx)(`p`,{children:Q.isPending?t(`正在读取真实过程…`,`Loading recorded processes…`):E&&(vt.get(E)?.episodes||0)>0?t(`该角色有记录,当前页尚未加载其正文。`,`This role has recorded processes; their content is on a later page.`):t(`当前范围没有保留的模型过程。项目活动不等同于完整模型轨迹。`,`No model processes are retained in this scope. Project activity does not establish a complete model trace.`)})]}),Q.hasNextPage?(0,z.jsx)(`div`,{className:`admin-data-load-more`,"data-testid":`load-more-observations`,children:(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:Q.isFetchingNextPage,onClick:()=>void Q.fetchNextPage(),children:[Q.isFetchingNextPage?(0,z.jsx)(h,{}):(0,z.jsx)(Te,{size:14}),t(`加载后续原始记录`,`Load more original records`)]})}):null,X.data?.segments.some(e=>e.source_kind!==`tool_episode`)?(0,z.jsxs)(v,{label:t(`项目活动与任务来源`,`Project activity and task sources`),children:[(0,z.jsx)(`div`,{className:`admin-data-activity`,children:X.data.segments.filter(e=>e.source_kind!==`tool_episode`).map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:R(t.role,e)}),(0,z.jsx)(`span`,{children:t.summary}),(0,z.jsx)(`time`,{children:Ge(t.started_at,e)})]},t.id))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`活动顺序来自记录时间,不表示已证实的 Agent 交接。`,`Activity follows recorded timestamps; it does not establish an agent handoff.`)})]}):null,(0,z.jsxs)(`p`,{className:`admin-data-bottom-note`,children:[(0,z.jsx)(te,{size:14}),t(`过程已采集不代表任务成功,也不代表训练质量已验收。原始记录保留缺失和中断状态。`,`Captured processes do not establish task success or training quality. Missing data and interruptions remain visible.`)]})]}):(0,z.jsx)(`div`,{className:`admin-data-notice`,role:`status`,children:X.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(h,{}),t(`正在核对链接中的任务…`,`Checking the linked task…`)]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{children:[X.error instanceof Pe&&X.error.status===404?t(`链接中的任务 ID 不存在或当前用途下不可读取。这不表示项目没有过程数据。`,`The linked task ID does not exist or is unavailable for this purpose. This does not mean the project has no process data.`):t(`暂时无法核对该任务,请重试或查看整个项目。`,`This task could not be verified. Retry or view the entire project.`),` `,(0,z.jsx)(`code`,{children:w})]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>Ct(``),children:t(`查看整个项目`,`View entire project`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void X.refetch(),children:n(`common.retry`)})]})})]}):(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`status`,children:[t(`当前用途下没有可读取的授权记录。请选择其他项目或数据用途。`,`No authorized records are available for this purpose. Choose another project or purpose.`),(0,z.jsx)(v,{children:(0,z.jsx)(`pre`,{children:Y.reason})})]})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(ke,{size:32}),(0,z.jsx)(`h1`,{children:d&&u.sid?t(`链接中的项目未找到`,`Linked project not found`):t(`选择一个项目`,`Select a project`)}),(0,z.jsx)(`p`,{children:d&&u.sid?t(`当前账号与用途下找不到此 SID,没有替你打开其他项目。请检查链接或选择左侧项目。`,`This SID is not available for the selected account and purpose. Check the link or choose a project from the list.`):t(`从左侧查看各账号的真实过程数据。`,`Choose a project to inspect its recorded processes.`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>A(!0),children:t(`浏览项目`,`Browse projects`)})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(De,{size:38}),(0,z.jsx)(`h1`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`p`,{children:H.error?Ot(H.error):t(`正在验证管理员身份…`,`Checking administrator access…`)}),H.error?(0,z.jsx)(`a`,{className:`brand-button brand-button-primary`,href:`/admin/login`,children:t(`管理员登录`,`Administrator sign in`)}):(0,z.jsx)(h,{})]})})]}),(0,z.jsx)(ye,{open:j===`workspace`,onClose:()=>M(null),label:t(`打开用户工作空间`,`Open user workspace`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`需要对应的用户账号`,`Use the matching user account`)}),(0,z.jsxs)(`p`,{children:[t(`这个项目属于`,`This project belongs to`),` `,(0,z.jsx)(`strong`,{children:Y?.tenant_id}),t(`。`,`. `),B?(0,z.jsxs)(z.Fragment,{children:[t(`当前用户端账号是`,`Your current user account is`),` `,(0,z.jsx)(`strong`,{children:B}),t(`。`,`. `)]}):t(`你尚未登录用户工作空间。`,`You are not signed in to a user workspace.`)]}),(0,z.jsx)(`p`,{children:t(`请在用户端使用对应邀请码登录,再打开这个项目。管理员登录不会切换用户账号。`,`Sign in to the user workspace with the matching invitation before opening this project. Administrator access does not switch your user account.`)}),(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(`a`,{className:`brand-button brand-button-primary inline-flex items-center gap-2`,href:`/invite`,target:`_blank`,rel:`noopener`,children:[t(`打开用户登录入口`,`Open user sign in`),(0,z.jsx)(oe,{size:14})]})]})]})}),(0,z.jsx)(ye,{open:j===`export`,onClose:()=>M(null),label:t(`导出全部保留过程`,`Export all retained processes`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出全部保留过程`,`Export all retained processes`)}),(0,z.jsx)(`p`,{children:t(`ZIP 包含所选项目的全部已保留输入、输出和工具轨迹,包括未验收、未结束和失败的记录。`,`The ZIP includes all retained inputs, outputs and tool traces for these projects, including unreviewed, unfinished and failed records.`)}),(0,z.jsx)(`ul`,{className:`admin-data-export-projects`,children:bt.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(re,{size:14}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:st(e)}),(0,z.jsxs)(`code`,{children:[e.tenant_id,` / `,e.sid]})]})]},N(e)))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`可在项目列表勾选多个项目;一次最多 20 个。`,`Use project checkboxes to select up to 20 projects per export.`)}),W?(0,z.jsx)(`p`,{role:`status`,children:t(`只读管理员不能导出数据。`,`Read-only administrators cannot export data.`)}):null,$.error?(0,z.jsx)(`p`,{role:`alert`,className:`admin-data-notice`,children:Ot($.error)}):null,F?(0,z.jsx)(`p`,{role:`status`,children:F}):null,(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!bt.length||$.isPending,onClick:()=>$.mutate(),children:[$.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(ce,{size:14}),t(`下载 ZIP`,`Download ZIP`)]})]})]})}),(0,z.jsx)(ye,{open:j===`audit`,onClose:()=>M(null),label:t(`导出记录`,`Export history`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出记录`,`Export history`)}),(0,z.jsx)(`p`,{children:t(`服务器记录的导出范围、操作身份与结果。`,`Server-recorded export scope, operator and outcome.`)}),nt.isPending?(0,z.jsx)(h,{}):nt.error?(0,z.jsx)(`p`,{role:`alert`,children:Ot(nt.error)}):nt.data?.events.length?(0,z.jsx)(`div`,{className:`admin-data-table-wrap`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:t(`时间`,`Time`)}),(0,z.jsx)(`th`,{children:t(`操作`,`Action`)}),(0,z.jsx)(`th`,{children:t(`身份 / 用途`,`Actor / purpose`)}),(0,z.jsx)(`th`,{children:t(`结果`,`Outcome`)})]})}),(0,z.jsx)(`tbody`,{children:nt.data.events.map(n=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:Ge(n.created_at,e)}),(0,z.jsxs)(`td`,{children:[n.action,(0,z.jsxs)(`small`,{children:[n.projects??`—`,` `,t(`个项目`,`projects`)]})]}),(0,z.jsxs)(`td`,{children:[n.actor,(0,z.jsx)(`small`,{children:n.purpose===`external_sharing`?t(`对外共享`,`External sharing`):t(`内部训练`,`Internal training`)})]}),(0,z.jsx)(`td`,{children:n.outcome})]},n.id))})]})}):(0,z.jsx)(`p`,{children:t(`尚无导出记录。`,`No export history yet.`)})]})}),(0,z.jsx)(ye,{open:j===`diagnostics`,onClose:()=>M(null),label:t(`采集诊断`,`Capture diagnostics`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`采集诊断`,`Capture diagnostics`)}),(0,z.jsx)(`p`,{children:J.error?Ot(J.error):Ke(J.data?.state,e)}),(0,z.jsx)(`div`,{className:`admin-data-diagnostics`,children:Object.entries(J.data?.tool_capture?.tenants??{}).map(([n,r])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:Ke(r.state,e)}),(0,z.jsxs)(`span`,{children:[r.counts.events_received??0,` `,t(`条接收事件`,`events received`)]}),r.last_error_code?(0,z.jsx)(`code`,{children:r.last_error_code}):null]},n))}),(0,z.jsx)(v,{label:t(`完整诊断数据`,`Full diagnostic data`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:JSON.stringify({collector:J.data,project:Y,collection:X.data?.collection,gaps:X.data?.gaps,completeness:q?.completeness},null,2)})})]})})]})}export{tt as default,ve as saveDownload}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AdminDataApp-C6QkHG3T.js b/frontend/web/dist/assets/AdminDataApp-C6QkHG3T.js new file mode 100644 index 000000000..0b5be1b71 --- /dev/null +++ b/frontend/web/dist/assets/AdminDataApp-C6QkHG3T.js @@ -0,0 +1,13 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,c as i,n as a,o,t as ee}from"./query-dCPZk0Xc.js";import{D as s,K as c,O as l,V as u,q as d}from"./index-DPfzOfKU.js";import{A as te,C as f,E as p,F as ne,I as re,L as m,M as ie,N as ae,O as oe,P as se,S as ce,_ as le,b as ue,c as h,d as de,f as fe,g as pe,i as g,j as me,k as he,l as ge,n as _e,p as ve,r as _,s as v,t as ye,u as be,w as y,x as xe}from"./AppearanceControls-Bc1ibrT3.js";import{t as Se}from"./activity-BEiyr9-4.js";import{n as Ce,t as we}from"./history-B00Gliyq.js";import{t as Te}from"./code-xml-DnBfjec4.js";import{r as Ee,t as De}from"./useWorkbenchTheme-BqK4B8rm.js";var Oe=m(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ke=m(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ae=m(`FileJson`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),je=m(`Menu`,[[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}],[`line`,{x1:`4`,x2:`20`,y1:`6`,y2:`6`,key:`1owob3`}],[`line`,{x1:`4`,x2:`20`,y1:`18`,y2:`18`,key:`yk5zj1`}]]),b=m(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Me=m(`Users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),x=e(n(),1),S=6e4,Ne=12e4,Pe=class extends c{loginURL;constructor(e){super(e.status===401?`数据后台登录已过期,请重新登录。`:e.message,e.status,e.method,e.path,e.status===401?`admin_authentication_required`:e.code),this.name=`AdminAPIError`,this.loginURL=e.status===401?`/admin/login`:null}};function C(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function w(e,t){return`/admin/api/training/${e}/${encodeURIComponent(t.tenant)}/${encodeURIComponent(t.sid)}`}async function T(e,t,n){try{await d(e,t,n)}catch(e){throw e instanceof c&&n.startsWith(`/admin/`)?new Pe(e):e}}function E(e,t=`GET`){return new Pe(new c(`数据后台响应格式不正确。`,502,t,e,`invalid_admin_response`))}async function D(e,t={}){return u(e,{method:`GET`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{Accept:`application/json`},signal:t.signal},S,async t=>{await T(t,`GET`,e);try{return await t.json()}catch{throw E(e)}})}function Fe(e){let t=e?.match(/(?:^|;)\s*filename\*=UTF-8''([^;]+)/i)?.[1],n=e?.match(/(?:^|;)\s*filename\s*=\s*(?:"([^"]*)"|([^;]+))/i),r=n?.[1]??n?.[2]?.trim()??``;if(t)try{r=decodeURIComponent(t.trim())}catch{}return r.length>0&&r.length<=180&&/\.zip$/i.test(r)&&!/[\x00-\x1f\x7f/\\:]/.test(r)&&!r.startsWith(`.`)?r:`argus-observations.zip`}var O={overview(e={}){return D(`/admin/api/training/collaboration`+C({purpose:e.purpose??`internal_training`,offset:e.offset??0,tenant:e.tenant,query:e.query}),e)},detail(e){return D(w(`collaboration`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId}),e)},observations(e){return D(w(`observations`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId,cursor:e.cursor,limit:e.limit}),e)},async identity(e={}){let t=`/admin/status`,n=await D(t,e);if(n?.role!==`admin`||typeof n.readonly!=`boolean`)throw E(t);return n},async workspaceIdentity(e={}){let t=`/invite/status`,n=await D(t,e);if(typeof n?.key_id!=`string`||typeof n.role!=`string`||typeof n.readonly!=`boolean`)throw E(t);return{key_id:n.key_id,role:n.role,readonly:n.readonly}},collector(e={}){return D(`/admin/api/research/status`,e)},projectDirectory(e,t={}){return D(`/admin/api/tenants/${encodeURIComponent(e)}/projects`,t)},audit(e={}){return D(`/admin/api/training/audit`+C({limit:e.limit}),e)},exportObservations(e,t={}){let n=`/admin/api/training/export-observations`;return u(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{"Content-Type":`application/json`,Accept:`application/zip`},body:JSON.stringify({purpose:e.purpose,projects:e.projects.map(({tenant_id:e,sid:t})=>({tenant_id:e,sid:t}))}),signal:t.signal},Ne,async e=>{if(await T(e,`POST`,n),e.headers.get(`Content-Type`)?.split(`;`)[0].trim().toLowerCase()!==`application/zip`)throw E(n,`POST`);return{blob:await e.blob(),filename:Fe(e.headers.get(`Content-Disposition`))}})}},k=new Set([`thinking`,`analysis`,`reasoning`,`redacted_thinking`,`signature`]),Ie=RegExp(`^(${ue.join(`|`)})(?:[.-][a-z0-9_.-]+)?$`);function A(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function j(e){return typeof e==`string`?e:``}function M(e){return e==null?``:JSON.stringify(e,null,2)}function N(e){return JSON.stringify([e.tenant_id,e.sid])}function Le(e){return e.title?.trim()||e.sid||`未命名项目`}function Re(e){return(e.mission_title||e.title)?.trim().replace(/^#+\s*/,``).split(` +`)[0]||(e.task_id?`任务 ${e.task_id}`:`项目活动`)}function ze(e){return typeof e==`string`?e===`operator`||e===`unknown`?e:e.match(Ie)?.[1]??`unknown`:`unknown`}function Be(e){return typeof e.role==`string`?ze(e.role):ze(e.runtime?.run_label)}function Ve(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{tenant:t.get(`tenant`),sid:t.get(`sid`),taskId:t.get(`task_id`)??t.get(`task`)}}function He(e){let t=e[0];if(!t)return[];let n=JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id]),r=new Map,i=new Map;for(let t of e){if(JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id])!==n)throw Error(`Cannot merge observations from different project, purpose, or task scopes.`);for(let e of t.episodes){if(N(e)!==N(t)||t.task_id!==null&&e.task_id!==t.task_id)throw Error(`Observation episode does not match its page scope.`);let n=r.get(e.episode_id);if(n&&n.task_id!==e.task_id)throw Error(`Observation episode changed task association.`);let a=i.get(e.episode_id)??new Map;for(let t of e.events){if(!Number.isSafeInteger(t.sequence)||t.sequence<0)throw Error(`Observation sequence is invalid.`);a.set(t.sequence,t)}i.set(e.episode_id,a),r.set(e.episode_id,{...e,events:[]})}}return[...r.values()].sort((e,t)=>e.episode_id-t.episode_id).map(e=>({...e,events:[...i.get(e.episode_id).values()].sort((e,t)=>e.sequence-t.sequence)}))}function P(e){return[e.type,e.role,e.channel].some(e=>typeof e==`string`&&k.has(e))}function Ue(e){return Array.isArray(e)?e.map(e=>{let t=A(e),n=A(t?.function);return!t||!n?``:[j(n.name),typeof n.arguments==`string`?n.arguments:M(n.arguments)].filter(Boolean).join(` +`)}).filter(Boolean).join(` + +`):``}function F(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(F).filter(Boolean).join(` +`);let t=A(e);return!t||P(t)?``:t.type===`text`||t.type===`input_text`||t.type===`output_text`?j(t.text):t.type===`toolCall`||t.type===`tool_call`?[j(t.name),typeof t.arguments==`string`?t.arguments:M(t.arguments)].filter(Boolean).join(` +`):`content`in t||`tool_calls`in t?[F(t.content),Ue(t.tool_calls)].filter(Boolean).join(` + +`):``}function We(e){if(!Array.isArray(e))return``;let t={system:`系统`,developer:`开发者`,user:`用户`,assistant:`模型`,toolResult:`工具返回`,tool:`工具返回`};return e.map(e=>{let n=A(e);if(!n||P(n))return``;let r=[F(n.content),Ue(n.tool_calls)].filter(Boolean).join(` + +`);return r?`${t[j(n.role)]||j(n.role)||`消息`}\n${r}`:``}).filter(Boolean).join(` + +`)}function I(e){let t=e.payload,[n,r]={context:[`模型输入`,`input`],provider_request:[`模型请求`,`input`],message_delta:[`模型公开输出片段`,`output`],message_end:[`模型消息`,`output`],session_message:[`历史会话消息`,`output`],agent_end:[`模型输出`,`output`],tool_call:[`工具调用`,`tool`],tool_result:[`工具返回`,`tool`],tool_execution_start:[`工具执行开始`,`tool`],tool_execution_update:[`工具执行进度`,`tool`],tool_execution_end:[`工具执行结束`,`tool`],settled:[`本段过程结束`,`status`],quarantine:[`过程状态记录`,`status`],capture_warning:[`采集提示`,`status`]}[e.kind]??[`过程事件 · ${e.kind}`,`other`],i=``;e.kind===`message_delta`?i=t.type===`text_delta`||t.type===`toolcall_delta`?j(t.delta):``:[`context`,`provider_request`,`message_end`,`session_message`,`agent_end`].includes(e.kind)?i=We(t.messages):e.kind===`tool_call`?i=M(t.input):e.kind===`tool_result`?i=F(t.content):e.kind===`tool_execution_start`?i=M(t.args):e.kind===`tool_execution_update`?i=F(t.partialResult):e.kind===`tool_execution_end`?i=F(t.result):(e.kind===`quarantine`||e.kind===`capture_warning`)&&(i=j(t.reason));let a=e.kind===`tool_result`||e.kind===`tool_execution_end`;return{key:e.id??String(e.sequence),kind:e.kind,title:n,category:r,text:i,toolName:j(t.toolName)||null,toolCallId:j(t.toolCallId)||null,result:a?t.isError===!0?`error`:t.isError===!1?`success`:`unknown`:null,timestamp:typeof e.observed_at==`number`&&Number.isFinite(e.observed_at)?e.observed_at:null}}function L(){let{locale:e,t,setLocale:n}=l();return{locale:e,t,setLocale:n,text:(t,n)=>e===`zh-CN`?t:n}}function Ge(e,t){return typeof e==`number`&&Number.isFinite(e)?new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e*1e3):`—`}function R(e,t){return y(e)?f(e,e=>s(e,{},t)):{operator:[`用户`,`User`],unknown:[`角色未记录`,`Unassigned role`],system:[`系统`,`System`],developer:[`运行指令`,`Instructions`],user:[`用户 / 任务`,`User / task`],assistant:[`模型`,`Assistant`],tool:[`工具`,`Tool`]}[e]?.[t===`zh-CN`?0:1]??e}function Ke(e,t){return{complete:[`调用已结束`,`Call ended`],capturing:[`尚无结束记录`,`No end record yet`],interrupted:[`采集中断`,`Capture interrupted`],quarantined:[`需检查记录`,`Record needs attention`],approved:[`已验收`,`Reviewed`],not_approved:[`未验收`,`Not reviewed`],unknown:[`结果未确认`,`Outcome unconfirmed`],running:[`采集正常`,`Collector running`],storage_error:[`存储异常`,`Storage unavailable`],starting:[`正在启动`,`Starting`],listening:[`已连接`,`Listening`],unavailable:[`暂不可用`,`Unavailable`]}[e||`unknown`]?.[t===`zh-CN`?0:1]??e??`—`}function qe(e,t){return{context:[`Agent 上下文`,`Agent context`],provider_request:[`模型实际输入`,`Model request`],message_end:[`公开消息`,`Public message`],agent_end:[`调用结果`,`Call output`],message_delta:[`公开输出增量`,`Public output increments`],tool_call:[`工具调用`,`Tool call`],tool_result:[`工具结果`,`Tool result`],tool_execution_start:[`工具开始执行`,`Tool execution started`],tool_execution_update:[`工具执行更新`,`Tool execution update`],tool_execution_end:[`工具执行结束`,`Tool execution ended`],settled:[`采集已收尾`,`Capture settled`],quarantine:[`记录不完整`,`Incomplete record`],capture_warning:[`采集提示`,`Capture notice`]}[e]?.[t===`zh-CN`?0:1]??e}var z=t(),B=e=>JSON.stringify(e,null,2);function V({value:e}){let{text:t}=L();return(0,z.jsxs)(v,{label:t(`原始 JSON`,`Raw JSON`),children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(le,{text:B(e),label:t(`复制 JSON`,`Copy JSON`),copiedLabel:t(`已复制`,`Copied`)})}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(e)})]})}function Je({message:e,index:t}){let{locale:n,text:r}=L(),[i,a]=(0,x.useState)(!1),o=F(e);return(0,z.jsxs)(`details`,{className:`admin-data-message`,onToggle:e=>a(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,z.jsx)(`strong`,{children:R(e.role||`unknown`,n)}),(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[o.length.toLocaleString(n),` `,r(`字符`,`characters`)]}),(0,z.jsx)(ne,{size:13})]}),i?(0,z.jsxs)(`div`,{className:`admin-data-message-body`,children:[o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(le,{text:o,label:r(`复制内容`,`Copy text`),copiedLabel:r(`已复制`,`Copied`)}),(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(pe,{children:o})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:r(`这条消息没有公开文本;结构见下方。`,`This message has no public text; its structure is below.`)}),(0,z.jsx)(V,{value:e})]}):null]})}function H({event:e}){let{locale:t,text:n}=L(),r=I(e),i=e.payload,a=Array.isArray(i.messages)?i.messages:[];return(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[e.kind===`provider_request`?(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[typeof i.model==`string`?(0,z.jsx)(g,{children:i.model}):null,typeof i.reasoning_effort==`string`?(0,z.jsx)(g,{children:i.reasoning_effort}):null,(0,z.jsxs)(`span`,{children:[a.length.toLocaleString(t),` `,n(`条消息`,`messages`),` · `,(i.tools?.length||0).toLocaleString(t),` `,n(`个工具定义`,`tool definitions`)]})]}):null,a.length?(0,z.jsx)(`div`,{className:`admin-data-message-list`,children:a.map((e,t)=>(0,z.jsx)(Je,{message:e,index:t},t))}):r.text?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(le,{text:r.text,label:n(`复制内容`,`Copy text`),copiedLabel:n(`已复制`,`Copied`)})}),r.category===`tool`||e.kind===`message_delta`?(0,z.jsx)(`pre`,{className:`admin-data-code`,children:r.text}):(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(pe,{children:r.text})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:n(`此事件保留了状态和结构,没有公开文本。`,`This event contains status and structure, with no public text.`)}),i.tools?.length?(0,z.jsx)(v,{label:n(`工具定义`,`Tool definitions`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(i.tools)})}):null,(0,z.jsx)(V,{value:e})]})}function U(e){let t=[];for(let n of e){let e=n.kind===`message_delta`?JSON.stringify([n.kind,n.payload.type,n.payload.message_index,n.payload.content_index,n.payload.toolCallId]):`event:${n.sequence}`,r=t[t.length-1];n.kind===`message_delta`&&r?.key===e?r.events.push(n):t.push({key:e,events:[n]})}return t}function W({group:e}){let{locale:t,text:n}=L(),[r,i]=(0,x.useState)(!1),a=e.events[0],o=I(a),ee=o.category===`tool`?he:o.category===`input`?Te:b,s=e.events.length>1,c=s?e.events.map(e=>I(e).text).join(``):o.text,l=a.kind===`provider_request`?`${a.payload.messages?.length??0} ${n(`条消息`,`messages`)} · ${a.payload.tools?.length??0} ${n(`个工具`,`tools`)}`:(a.payload.messages?F(a.payload.messages):c).replace(/\s+/g,` `).slice(0,110);return(0,z.jsxs)(`details`,{className:`admin-data-event`,"data-event-kind":a.kind,onToggle:e=>i(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{className:`admin-data-event-icon`,children:(0,z.jsx)(ee,{size:15})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`admin-data-event-title`,children:[(0,z.jsxs)(`strong`,{children:[qe(a.kind,t),o.toolName?` · ${o.toolName}`:``]}),s?(0,z.jsxs)(g,{children:[e.events.length,` `,n(`条增量`,`increments`)]}):null,o.result===`error`?(0,z.jsx)(g,{color:p.error,children:n(`工具报告错误`,`Tool reported an error`)}):null,o.result===`success`?(0,z.jsx)(g,{color:p.success,children:n(`工具报告成功`,`Tool reported success`)}):null]}),l?(0,z.jsx)(`p`,{className:`admin-data-event-preview`,children:l}):null]}),(0,z.jsx)(`span`,{className:`admin-data-event-time`,children:Ge(a.observed_at,t)}),(0,z.jsx)(ne,{size:14})]}),r?s?(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[(0,z.jsx)(le,{text:c,label:n(`复制输出`,`Copy output`),copiedLabel:n(`已复制`,`Copied`)}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:c}),(0,z.jsx)(V,{value:e.events})]}):(0,z.jsx)(H,{event:a}):null]})}function Ye({episode:e,readonly:t,onDownload:n}){let{locale:r,text:i}=L(),[a,o]=(0,x.useState)(`all`),[ee,s]=(0,x.useState)(0),c=(0,x.useMemo)(()=>U(e.events.filter(e=>{let t=I(e).category;return a===`all`||(a===`tools`?t===`tool`:t===`input`||t===`output`)})),[e.events,a]);(0,x.useEffect)(()=>s(0),[e.episode_id,a]);let l=Math.max(1,Math.ceil(c.length/60)),u=Math.min(ee,l-1),d=c.slice(u*60,u*60+60),te=e.events.length,f=e.collection.event_count,ne=e.quality.approved===!0&&e.quality.state===`approved`;return(0,z.jsxs)(`section`,{className:`admin-data-inspector`,"aria-label":i(`过程详情`,`Process details`),children:[(0,z.jsxs)(`div`,{className:`admin-data-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h3`,{children:[R(e.role,r),` `,(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[`· #`,e.episode_id]})]}),(0,z.jsxs)(`p`,{children:[Ge(e.started_at,r),` · `,e.task_id?`${i(`任务`,`Task`)} ${e.task_id}`:i(`项目级 / 未关联任务`,`Project-level / no task association`)]})]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:t,onClick:()=>n(e),title:t?i(`只读会话不能导出`,`Exports are disabled for read-only sessions`):i(`下载当前已加载的原始记录`,`Download the raw records currently loaded`),children:[(0,z.jsx)(se,{size:14}),` JSON`]})]}),(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[(0,z.jsx)(g,{children:Ke(e.state,r)}),(0,z.jsx)(g,{color:ne?p.success:void 0,children:ne?i(`已验收`,`Reviewed`):i(`未验收`,`Not reviewed`)}),(0,z.jsxs)(`span`,{children:[i(`已加载`,`Loaded`),` `,te.toLocaleString(r),` / `,f.toLocaleString(r),` `,i(`条事件`,`events`)]}),e.runtime.run_label?(0,z.jsx)(`code`,{children:e.runtime.run_label}):null]}),!e.collection.complete||e.collection.historical_data_unavailable||te(0,z.jsx)(`button`,{type:`button`,"aria-pressed":a===e,className:a===e?`active`:``,onClick:()=>o(e),children:e===`all`?i(`全部事件`,`All events`):e===`messages`?i(`模型输入 / 输出`,`Model input / output`):i(`工具轨迹`,`Tool trace`)},e))}),c.length?(0,z.jsx)(`div`,{className:`admin-data-timeline`,children:d.map(t=>(0,z.jsx)(W,{group:t},`${e.episode_id}:${t.events[0].sequence}`))}):(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(Ae,{size:24}),(0,z.jsx)(`p`,{children:i(`当前已加载的记录中没有此类事件。`,`No events of this type are present in the loaded records.`)})]}),c.length>60?(0,z.jsxs)(`div`,{className:`admin-data-paging`,"aria-label":i(`当前过程的事件分页`,`Event pages for this process`),children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!u,onClick:()=>s(u-1),title:i(`上一段事件`,`Previous event group`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[u*60+1,`–`,Math.min(c.length,u*60+60),` / `,c.length.toLocaleString(r),` `,i(`组事件`,`event groups`)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:u+1>=l,onClick:()=>s(u+1),title:i(`下一段事件`,`Next event group`),children:(0,z.jsx)(Oe,{size:14})})]}):null,(0,z.jsx)(V,{value:{...e,events:void 0,loaded_event_count:te}})]})}function Xe(e,t,n=``){let r=new URL(e);return r.searchParams.set(`tenant`,t.tenant_id),r.searchParams.set(`sid`,t.sid),n?r.searchParams.set(`task_id`,n):r.searchParams.delete(`task_id`),r.searchParams.delete(`task`),`${r.pathname}${r.search}${r.hash}`}function Ze(e,t,n,r){if(e.some(e=>N(e)===t))return null;let i=r&&n.sid?e.filter(e=>e.sid===n.sid&&(!n.tenant||e.tenant_id===n.tenant)):[],a=i.length===1?i[0]:void 0;if(r&&n.sid&&!a)return null;let o=a??e[0];return{key:o?N(o):``,taskId:a&&n.taskId||``}}async function Qe(e,t,n){let r=await t(),i=r.role===`trial`&&r.key_id===e.tenant_id;return i&&n(`/?project=${encodeURIComponent(e.sid)}`),{matched:i,identity:r}}var $e=Array.from({length:11},(e,t)=>`trial-${String(t+1).padStart(2,`0`)}`),G=(e,t)=>e<1&&!(t instanceof Pe&&[401,403].includes(t.status));function et(e){let[t,n]=(0,x.useState)(e);return(0,x.useEffect)(()=>{let t=window.setTimeout(()=>n(e),250);return()=>window.clearTimeout(t)},[e]),t}function tt(){let{locale:e,text:t,t:n}=L(),{themeMode:s,cycleTheme:c}=De(),l=i(),[u]=(0,x.useState)(()=>Ve(window.location.search)),[d,f]=(0,x.useState)(!!u.sid),[p,ne]=(0,x.useState)(u.tenant||``),[m,he]=(0,x.useState)(``),[y,Te]=(0,x.useState)(`internal_training`),[b,S]=(0,x.useState)(0),[Ne,C]=(0,x.useState)(u.tenant&&u.sid?N({tenant_id:u.tenant,sid:u.sid}):``),[w,T]=(0,x.useState)(u.taskId||``),[E,D]=(0,x.useState)(null),[Fe,k]=(0,x.useState)(null),[Ie,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(null),[P,Ue]=(0,x.useState)(()=>new Map),[F,We]=(0,x.useState)(``),[I,qe]=(0,x.useState)(!1),[B,V]=(0,x.useState)(null),Je=et(m),H=r({queryKey:[`admin-data`,`identity`],queryFn:({signal:e})=>O.identity({signal:e}),staleTime:3e4,retry:!1}),U=H.data?.role===`admin`,W=H.data?.readonly!==!1,tt=!!Je||d,K=r({queryKey:[`admin-data`,`overview`,y,p,tt?`all-pages`:b],queryFn:async({signal:e})=>{let t=await O.overview({purpose:y,tenant:p,offset:tt?0:b,signal:e}),n=[t],r=new Set([t.offset]);for(;tt&&n[n.length-1].has_more_projects;){let t=n[n.length-1].next_offset;if(t===null||r.has(t))throw Error(`Invalid project pagination`);r.add(t),n.push(await O.overview({purpose:y,tenant:p,offset:t,signal:e}))}return n},enabled:U,retry:G,refetchInterval:!tt&&2e4}),q=(0,x.useMemo)(()=>{let e=K.data;if(!e?.length)return;let t=e[e.length-1];return{...e[0],projects:e.flatMap(e=>e.projects),tasks:e.flatMap(e=>e.tasks),has_more_projects:t.has_more_projects,next_offset:t.next_offset,completeness:{...e[0].completeness,page_truncated:e.some(e=>e.completeness.page_truncated)}}},[K.data]),J=r({queryKey:[`admin-data`,`collector`],queryFn:({signal:e})=>O.collector({signal:e}),enabled:U,retry:G,refetchInterval:15e3}),nt=r({queryKey:[`admin-data`,`audit`],queryFn:({signal:e})=>O.audit({signal:e}),enabled:U&&j===`audit`,retry:G}),rt=q?.projects??[],it=(0,x.useMemo)(()=>[...new Set(rt.map(e=>e.tenant_id))].sort(),[rt]),at=o({queries:it.map(e=>({queryKey:[`admin-data`,`directory`,e],queryFn:({signal:t})=>O.projectDirectory(e,{signal:t}),enabled:U,staleTime:6e4,retry:G}))}),ot=new Map;at.forEach((e,t)=>{for(let n of e.data?.projects??[])n.title&&ot.set(N({tenant_id:it[t],sid:n.id}),n.title)});let st=e=>ot.get(N(e))||Le(e),ct=Je.trim().toLocaleLowerCase(e),lt=rt.filter(t=>!ct||[st(t),t.title,t.tenant_id,t.sid,...(q?.tasks??[]).filter(e=>N(e)===N(t)).flatMap(e=>[Re(e),e.task_id||``])].some(t=>t.toLocaleLowerCase(e).includes(ct))),Y=lt.find(e=>N(e)===Ne)??null,ut=(q?.tasks??[]).filter(e=>Y&&N(e)===N(Y)),dt=ut.filter(e=>e.task_id),ft=ut.find(e=>e.task_id===w)??null;(0,x.useEffect)(()=>{if(!q)return;let e=Ze(lt,Ne,u,d);if(!e)return;C(e.key),k(null),D(null),T(e.taskId);let t=lt.find(t=>N(t)===e.key);t&&xt(t,e.taskId)},[q,Ne,u,d,Je,at.map(e=>e.dataUpdatedAt).join(`,`)]);let pt=[y,Y?.tenant_id,Y?.sid,w||null],X=r({queryKey:[`admin-data`,`detail`,...pt],queryFn:({signal:e})=>O.detail({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,signal:e}),enabled:U&&!!Y?.eligible,retry:G}),Z=ft??(w&&X.data?.task_id===w?X.data:null),mt=!w||!!Z,Q=ee({queryKey:[`admin-data`,`observations`,...pt],queryFn:({pageParam:e,signal:t})=>O.observations({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,cursor:e,limit:200,signal:t}),initialPageParam:null,getNextPageParam:e=>e.pagination.has_more?e.pagination.next_cursor:void 0,enabled:U&&!!Y?.eligible&&mt,retry:G}),ht=(0,x.useMemo)(()=>He(Q.data?.pages??[]),[Q.data]),gt=ht.filter(e=>E===null||Be(e)===E),_t=gt.find(e=>e.episode_id===Fe)??gt[0]??null,vt=new Map;for(let e of w?Z?[Z]:[]:ut)for(let t of e.roles){let e=ze(t.role),n=vt.get(e);vt.set(e,{...t,role:e,observations:(n?.observations||0)+t.observations,episodes:(n?.episodes||0)+t.episodes,tool_pairs:(n?.tool_pairs||0)+t.tool_pairs})}let yt=ht.reduce((e,t)=>e+t.events.length,0),bt=P.size?[...P.values()]:Y?[Y]:[],$=a({mutationFn:()=>{if(W||!bt.length||bt.length>20)throw Error(t(`请选择最多 20 个可导出的项目。`,`Select up to 20 eligible projects.`));return O.exportObservations({purpose:y,projects:bt})},onSuccess:e=>{_e(e.blob,e.filename),We(t(`全部保留过程已下载。`,`All retained process data downloaded.`)),l.invalidateQueries({queryKey:[`admin-data`,`audit`]})}}),xt=(e,t=``)=>{window.history.replaceState(window.history.state,``,Xe(window.location.href,e,t))},St=e=>{f(!1),C(N(e)),T(``),D(null),k(null),A(!1),xt(e)},Ct=e=>{T(e),k(null),D(null),Y&&xt(Y,e)},wt=e=>Ue(t=>{let n=new Map(t),r=N(e);return n.has(r)?n.delete(r):n.size<20&&n.set(r,e),n}),Tt=()=>{l.invalidateQueries({queryKey:[`admin-data`]})},Et=e=>{W||_e(new Blob([JSON.stringify({scope:`loaded_observations`,loaded_event_count:e.events.length,episode:e},null,2)],{type:`application/json`}),`${e.tenant_id}-${e.sid}-process-${e.episode_id}.json`)},Dt=async()=>{if(!(!Y||I)){qe(!0);try{let e=await Qe(Y,()=>O.workspaceIdentity(),e=>window.location.assign(e));V(e.identity.role===`trial`?e.identity.key_id:null),e.matched||M(`workspace`)}catch{V(null),M(`workspace`)}finally{qe(!1)}}},Ot=e=>e instanceof Pe&&e.status===401?t(`数据后台登录已过期,请重新登录。`,`Your administrator session expired. Sign in again.`):e instanceof Error?e.message:t(`暂时无法读取数据。`,`Data is temporarily unavailable.`);return(0,z.jsxs)(de,{className:`admin-data-workspace h-full`,style:{"--sidebar-width":`292px`},children:[Ie?(0,z.jsx)(`button`,{type:`button`,className:`admin-data-scrim lg:hidden`,"aria-label":t(`关闭项目列表`,`Close projects`),onClick:()=>A(!1)}):null,(0,z.jsxs)(fe,{mobileOpen:Ie,className:`admin-data-sidebar`,"aria-label":t(`数据项目`,`Data projects`),children:[(0,z.jsxs)(`div`,{className:`admin-data-sidebar-brand`,children:[(0,z.jsx)(Ee,{size:25}),(0,z.jsx)(g,{children:t(`数据`,`Data`)}),(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button ml-auto lg:hidden`,onClick:()=>A(!1),"aria-label":n(`common.close`),children:(0,z.jsx)(oe,{size:18})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-heading`,children:[(0,z.jsx)(`span`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`span`,{children:q?.total_projects??`—`})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-controls`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`账号`,`Account`)}),(0,z.jsxs)(`select`,{"aria-label":t(`筛选账号`,`Filter account`),value:p,onChange:e=>{f(!1),ne(e.target.value),S(0),T(``)},children:[(0,z.jsx)(`option`,{value:``,children:t(`全部 11 个账号`,`All 11 accounts`)}),$e.map(e=>(0,z.jsx)(`option`,{children:e},e))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-search`,children:[(0,z.jsx)(me,{size:15}),(0,z.jsx)(`input`,{"aria-label":t(`搜索项目、任务或 SID`,`Search projects, tasks or SID`),placeholder:t(`搜索项目或任务…`,`Search projects or tasks…`),value:m,onChange:e=>{f(!1),he(e.target.value),S(0)}})]})]}),(0,z.jsxs)(`div`,{className:`admin-data-projects`,"aria-busy":K.isFetching,children:[K.isPending&&U?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(h,{}),(0,z.jsx)(`p`,{children:t(`正在读取项目…`,`Loading projects…`)})]}):null,K.error?(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`alert`,children:[Ot(K.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void K.refetch(),children:n(`common.retry`)})]}):null,!K.isPending&&!lt.length&&!K.error?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(ke,{size:22}),(0,z.jsx)(`p`,{children:t(`没有符合筛选条件的项目。`,`No projects match these filters.`)})]}):null,lt.map(n=>{let r=N(n)===Ne,i=(q?.tasks??[]).filter(e=>N(e)===N(n)).reduce((e,t)=>e+t.collection.retained_episodes,0);return(0,z.jsxs)(`div`,{"data-testid":`project-${n.tenant_id}-${n.sid}`,className:`admin-data-project ${r?`active`:``}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-project-open`,"aria-current":r?`page`:void 0,onClick:()=>St(n),children:[(0,z.jsx)(`span`,{className:`admin-data-project-title`,children:st(n)}),(0,z.jsxs)(`span`,{className:`admin-data-project-id`,children:[n.tenant_id,` · `,n.sid]}),(0,z.jsx)(`span`,{className:`admin-data-project-meta`,children:n.eligible?i?`${i.toLocaleString(e)} ${t(`段保留过程`,`retained processes`)}`:t(`尚无保留过程`,`No process data retained`):t(`当前用途不可读取`,`Unavailable for this purpose`)})]}),(0,z.jsx)(`input`,{type:`checkbox`,className:`admin-data-project-check`,"aria-label":`${t(`选择导出项目`,`Select project for export`)} ${st(n)} ${n.tenant_id} ${n.sid}`,checked:P.has(N(n)),disabled:W||!n.eligible||P.size>=20&&!P.has(N(n)),onChange:()=>wt(n)})]},N(n))})]}),(0,z.jsxs)(`div`,{className:`admin-data-paging`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!b||K.isFetching,onClick:()=>S(Math.max(0,b-20)),title:t(`上一页项目`,`Previous project page`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[t(`第`,`Page`),` `,Math.floor(b/20)+1,` `,t(`页`,``)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!q?.has_more_projects||K.isFetching,onClick:()=>S(q?.next_offset??b+20),title:t(`下一页项目`,`Next project page`),children:(0,z.jsx)(Oe,{size:14})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-footer`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`audit`),children:[(0,z.jsx)(we,{size:15}),t(`导出记录`,`Export history`)]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`diagnostics`),children:[(0,z.jsx)(Se,{size:15}),t(`采集诊断`,`Capture diagnostics`)]}),(0,z.jsxs)(`a`,{href:`/invite`,children:[(0,z.jsx)(ae,{size:15}),t(`用户工作空间`,`User workspace`)]})]})]}),(0,z.jsxs)(`main`,{className:`admin-data-surface`,children:[(0,z.jsxs)(be,{children:[(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button lg:hidden`,onClick:()=>A(!0),"aria-label":t(`打开项目列表`,`Open projects`),children:(0,z.jsx)(je,{size:18})}),(0,z.jsx)(`span`,{className:`admin-data-header-title`,children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(g,{children:W?t(`只读管理员`,`Read-only administrator`):t(`管理员`,`Administrator`)}),(0,z.jsxs)(`div`,{className:`ml-auto flex items-center gap-1 sm:gap-2`,children:[(0,z.jsx)(ye,{themeMode:s,onCycleTheme:c}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:Tt,disabled:K.isFetching||!U,title:t(`刷新数据`,`Refresh data`),children:K.isFetching?(0,z.jsx)(h,{}):(0,z.jsx)(ie,{size:14})}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!Y?.eligible||$.isPending,onClick:()=>{We(``),M(`export`)},children:[(0,z.jsx)(se,{size:14}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:t(`导出`,`Export`)})]})]})]}),(0,z.jsx)(`div`,{className:`admin-data-content`,children:U?Y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-project-heading`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`p`,{className:`admin-data-eyebrow`,children:[(0,z.jsx)(ke,{size:13}),t(`已授权的过程数据`,`Authorized process data`)]}),(0,z.jsx)(`h1`,{children:st(Y)}),(0,z.jsxs)(`div`,{className:`admin-data-project-identity`,children:[(0,z.jsxs)(`code`,{children:[Y.tenant_id,` / `,Y.sid]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:I,onClick:()=>void Dt(),children:[I?(0,z.jsx)(h,{}):(0,z.jsx)(ae,{size:13}),t(`在用户端打开`,`Open in user workspace`)]}),(0,z.jsx)(le,{text:`${window.location.origin}/admin/data?tenant=${encodeURIComponent(Y.tenant_id)}&sid=${encodeURIComponent(Y.sid)}`,label:t(`复制后台链接`,`Copy data link`),copiedLabel:t(`已复制`,`Copied`)})]})]}),(0,z.jsxs)(`span`,{className:`admin-data-collector-status`,children:[(0,z.jsx)(ge,{ok:J.data?.state===`running`}),J.error?t(`采集状态暂不可读`,`Capture status unavailable`):Ke(J.data?.state,e)]})]}),(0,z.jsxs)(`div`,{className:`admin-data-context-bar`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field flex-1`,children:[(0,z.jsx)(`span`,{children:t(`查看范围`,`View scope`)}),(0,z.jsxs)(`select`,{value:w,onChange:e=>Ct(e.target.value),"aria-label":t(`选择任务或整个项目`,`Select a task or the entire project`),children:[(0,z.jsx)(`option`,{value:``,children:t(`整个项目 · 包含任务创建前的过程`,`Entire project · includes pre-task processes`)}),w&&!dt.some(e=>e.task_id===w)?(0,z.jsxs)(`option`,{value:w,children:[Z?Re(Z):t(`链接中的任务`,`Linked task`),` · `,w]}):null,dt.map(e=>(0,z.jsxs)(`option`,{value:e.task_id,children:[Re(e),` · `,e.task_id]},e.task_id))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`数据用途`,`Data purpose`)}),(0,z.jsxs)(`select`,{value:y,onChange:e=>{Te(e.target.value),Ue(new Map),S(0)},children:[(0,z.jsx)(`option`,{value:`internal_training`,children:t(`内部训练`,`Internal training`)}),(0,z.jsx)(`option`,{value:`external_sharing`,children:t(`对外共享`,`External sharing`)})]})]})]}),Y.eligible?(0,z.jsxs)(z.Fragment,{children:[w&&Z?(0,z.jsxs)(v,{label:t(`任务目标与来源`,`Task objective and source`),children:[(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(pe,{children:Z.objective||Z.request?.text||Z.title})}),(0,z.jsx)(`code`,{children:Z.task_id})]}):null,mt?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-role-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h2`,{children:[(0,z.jsx)(Me,{size:17}),t(`多 Agent 过程`,`Multi-agent processes`)]}),(0,z.jsx)(`p`,{children:t(`查看各角色实际留下的记录。角色缺失、中断和质量验收分别标记。`,`Inspect the records each role actually produced. Missing roles, interruptions and review status are shown separately.`)})]}),(0,z.jsx)(`button`,{type:`button`,className:`admin-data-text-button ${E===null?`active`:``}`,onClick:()=>{D(null),k(null)},children:t(`全部角色`,`All roles`)})]}),(0,z.jsx)(`div`,{className:`admin-data-roles`,children:ue.map(r=>{let i=vt.get(r),a=Math.max(i?.episodes||0,ht.filter(e=>Be(e)===r).length),o=ht.filter(e=>Be(e)===r).length;return(0,z.jsxs)(`button`,{type:`button`,"data-testid":`role-${r}`,className:`admin-data-role ${E===r?`active`:``}`,style:{"--role-color":xe(r)},"aria-pressed":E===r,onClick:()=>{D(r),k(null)},children:[(0,z.jsxs)(`span`,{className:`admin-data-role-label`,children:[(0,z.jsx)(`span`,{className:`admin-data-role-mark`,children:R(r,e).slice(0,1)}),(0,z.jsx)(`strong`,{children:R(r,e)}),(0,z.jsx)(`span`,{children:r})]}),(0,z.jsx)(`span`,{className:`admin-data-role-description`,children:ce(r,n)}),(0,z.jsx)(`span`,{className:`admin-data-role-count`,children:a?`${a.toLocaleString(e)} ${t(`段过程`,`processes`)}`:i?.observations?t(`仅有活动记录`,`Activity records only`):t(`尚未采到记录`,`No records captured`)}),(0,z.jsx)(`span`,{className:`admin-data-role-footnote`,children:o?`${t(`正文已加载`,`Content loaded`)} ${o.toLocaleString(e)}`:t(`按原始记录归属角色`,`Role comes from recorded metadata`)})]},r)})}),vt.get(`unknown`)?.episodes||ht.some(e=>Be(e)===`unknown`)?(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-unknown`,onClick:()=>{D(`unknown`),k(null)},children:[(0,z.jsx)(Ae,{size:14}),t(`另有角色未记录的过程,保留原样查看`,`Some processes have no recorded role. View them as captured.`),` `,(0,z.jsx)(Oe,{size:13})]}):null,(0,z.jsxs)(`div`,{className:`admin-data-record-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{children:E?R(E,e):t(`全部保留过程`,`All retained processes`)}),(0,z.jsxs)(`p`,{children:[ht.length.toLocaleString(e),` `,t(`段已加载`,`processes loaded`),` · `,yt.toLocaleString(e),` `,t(`条原始事件`,`raw events`),` `,Q.hasNextPage?t(`· 还有后续页`,`· more pages available`):``]})]}),gt.length?(0,z.jsx)(`select`,{className:`admin-data-episode-select`,"aria-label":t(`选择过程记录`,`Select a process`),value:_t?.episode_id??``,onChange:e=>k(Number(e.target.value)),children:gt.map(t=>(0,z.jsxs)(`option`,{"data-testid":`episode-${t.episode_id}`,value:t.episode_id,children:[`#`,t.episode_id,` · `,R(t.role,e),` · `,Ge(t.started_at,e)]},t.episode_id))}):null]}),Q.error?(0,z.jsxs)(`div`,{role:`alert`,className:`admin-data-notice`,children:[Ot(Q.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void Q.refetch(),children:n(`common.retry`)})]}):null,_t?(0,z.jsx)(Ye,{episode:_t,readonly:W,onDownload:Et},_t.episode_id):(0,z.jsxs)(`div`,{className:`admin-data-empty admin-data-record-empty`,children:[Q.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(Ae,{size:28}),(0,z.jsx)(`p`,{children:Q.isPending?t(`正在读取真实过程…`,`Loading recorded processes…`):E&&(vt.get(E)?.episodes||0)>0?t(`该角色有记录,当前页尚未加载其正文。`,`This role has recorded processes; their content is on a later page.`):t(`当前范围没有保留的模型过程。项目活动不等同于完整模型轨迹。`,`No model processes are retained in this scope. Project activity does not establish a complete model trace.`)})]}),Q.hasNextPage?(0,z.jsx)(`div`,{className:`admin-data-load-more`,"data-testid":`load-more-observations`,children:(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:Q.isFetchingNextPage,onClick:()=>void Q.fetchNextPage(),children:[Q.isFetchingNextPage?(0,z.jsx)(h,{}):(0,z.jsx)(Oe,{size:14}),t(`加载后续原始记录`,`Load more original records`)]})}):null,X.data?.segments.some(e=>e.source_kind!==`tool_episode`)?(0,z.jsxs)(v,{label:t(`项目活动与任务来源`,`Project activity and task sources`),children:[(0,z.jsx)(`div`,{className:`admin-data-activity`,children:X.data.segments.filter(e=>e.source_kind!==`tool_episode`).map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:R(t.role,e)}),(0,z.jsx)(`span`,{children:t.summary}),(0,z.jsx)(`time`,{children:Ge(t.started_at,e)})]},t.id))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`活动顺序来自记录时间,不表示已证实的 Agent 交接。`,`Activity follows recorded timestamps; it does not establish an agent handoff.`)})]}):null,(0,z.jsxs)(`p`,{className:`admin-data-bottom-note`,children:[(0,z.jsx)(te,{size:14}),t(`过程已采集不代表任务成功,也不代表训练质量已验收。原始记录保留缺失和中断状态。`,`Captured processes do not establish task success or training quality. Missing data and interruptions remain visible.`)]})]}):(0,z.jsx)(`div`,{className:`admin-data-notice`,role:`status`,children:X.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(h,{}),t(`正在核对链接中的任务…`,`Checking the linked task…`)]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{children:[X.error instanceof Pe&&X.error.status===404?t(`链接中的任务 ID 不存在或当前用途下不可读取。这不表示项目没有过程数据。`,`The linked task ID does not exist or is unavailable for this purpose. This does not mean the project has no process data.`):t(`暂时无法核对该任务,请重试或查看整个项目。`,`This task could not be verified. Retry or view the entire project.`),` `,(0,z.jsx)(`code`,{children:w})]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>Ct(``),children:t(`查看整个项目`,`View entire project`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void X.refetch(),children:n(`common.retry`)})]})})]}):(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`status`,children:[t(`当前用途下没有可读取的授权记录。请选择其他项目或数据用途。`,`No authorized records are available for this purpose. Choose another project or purpose.`),(0,z.jsx)(v,{children:(0,z.jsx)(`pre`,{children:Y.reason})})]})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(ke,{size:32}),(0,z.jsx)(`h1`,{children:d&&u.sid?t(`链接中的项目未找到`,`Linked project not found`):t(`选择一个项目`,`Select a project`)}),(0,z.jsx)(`p`,{children:d&&u.sid?t(`当前账号与用途下找不到此 SID,没有替你打开其他项目。请检查链接或选择左侧项目。`,`This SID is not available for the selected account and purpose. Check the link or choose a project from the list.`):t(`从左侧查看各账号的真实过程数据。`,`Choose a project to inspect its recorded processes.`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>A(!0),children:t(`浏览项目`,`Browse projects`)})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(Ee,{size:38}),(0,z.jsx)(`h1`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`p`,{children:H.error?Ot(H.error):t(`正在验证管理员身份…`,`Checking administrator access…`)}),H.error?(0,z.jsx)(`a`,{className:`brand-button brand-button-primary`,href:`/admin/login`,children:t(`管理员登录`,`Administrator sign in`)}):(0,z.jsx)(h,{})]})})]}),(0,z.jsx)(ve,{open:j===`workspace`,onClose:()=>M(null),label:t(`打开用户工作空间`,`Open user workspace`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`需要对应的用户账号`,`Use the matching user account`)}),(0,z.jsxs)(`p`,{children:[t(`这个项目属于`,`This project belongs to`),` `,(0,z.jsx)(`strong`,{children:Y?.tenant_id}),t(`。`,`. `),B?(0,z.jsxs)(z.Fragment,{children:[t(`当前用户端账号是`,`Your current user account is`),` `,(0,z.jsx)(`strong`,{children:B}),t(`。`,`. `)]}):t(`你尚未登录用户工作空间。`,`You are not signed in to a user workspace.`)]}),(0,z.jsx)(`p`,{children:t(`请在用户端使用对应邀请码登录,再打开这个项目。管理员登录不会切换用户账号。`,`Sign in to the user workspace with the matching invitation before opening this project. Administrator access does not switch your user account.`)}),(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(`a`,{className:`brand-button brand-button-primary inline-flex items-center gap-2`,href:`/invite`,target:`_blank`,rel:`noopener`,children:[t(`打开用户登录入口`,`Open user sign in`),(0,z.jsx)(ae,{size:14})]})]})]})}),(0,z.jsx)(ve,{open:j===`export`,onClose:()=>M(null),label:t(`导出全部保留过程`,`Export all retained processes`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出全部保留过程`,`Export all retained processes`)}),(0,z.jsx)(`p`,{children:t(`ZIP 包含所选项目的全部已保留输入、输出和工具轨迹,包括未验收、未结束和失败的记录。`,`The ZIP includes all retained inputs, outputs and tool traces for these projects, including unreviewed, unfinished and failed records.`)}),(0,z.jsx)(`ul`,{className:`admin-data-export-projects`,children:bt.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(re,{size:14}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:st(e)}),(0,z.jsxs)(`code`,{children:[e.tenant_id,` / `,e.sid]})]})]},N(e)))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`可在项目列表勾选多个项目;一次最多 20 个。`,`Use project checkboxes to select up to 20 projects per export.`)}),W?(0,z.jsx)(`p`,{role:`status`,children:t(`只读管理员不能导出数据。`,`Read-only administrators cannot export data.`)}):null,$.error?(0,z.jsx)(`p`,{role:`alert`,className:`admin-data-notice`,children:Ot($.error)}):null,F?(0,z.jsx)(`p`,{role:`status`,children:F}):null,(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!bt.length||$.isPending,onClick:()=>$.mutate(),children:[$.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(se,{size:14}),t(`下载 ZIP`,`Download ZIP`)]})]})]})}),(0,z.jsx)(ve,{open:j===`audit`,onClose:()=>M(null),label:t(`导出记录`,`Export history`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出记录`,`Export history`)}),(0,z.jsx)(`p`,{children:t(`服务器记录的导出范围、操作身份与结果。`,`Server-recorded export scope, operator and outcome.`)}),nt.isPending?(0,z.jsx)(h,{}):nt.error?(0,z.jsx)(`p`,{role:`alert`,children:Ot(nt.error)}):nt.data?.events.length?(0,z.jsx)(`div`,{className:`admin-data-table-wrap`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:t(`时间`,`Time`)}),(0,z.jsx)(`th`,{children:t(`操作`,`Action`)}),(0,z.jsx)(`th`,{children:t(`身份 / 用途`,`Actor / purpose`)}),(0,z.jsx)(`th`,{children:t(`结果`,`Outcome`)})]})}),(0,z.jsx)(`tbody`,{children:nt.data.events.map(n=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:Ge(n.created_at,e)}),(0,z.jsxs)(`td`,{children:[n.action,(0,z.jsxs)(`small`,{children:[n.projects??`—`,` `,t(`个项目`,`projects`)]})]}),(0,z.jsxs)(`td`,{children:[n.actor,(0,z.jsx)(`small`,{children:n.purpose===`external_sharing`?t(`对外共享`,`External sharing`):t(`内部训练`,`Internal training`)})]}),(0,z.jsx)(`td`,{children:n.outcome})]},n.id))})]})}):(0,z.jsx)(`p`,{children:t(`尚无导出记录。`,`No export history yet.`)})]})}),(0,z.jsx)(ve,{open:j===`diagnostics`,onClose:()=>M(null),label:t(`采集诊断`,`Capture diagnostics`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`采集诊断`,`Capture diagnostics`)}),(0,z.jsx)(`p`,{children:J.error?Ot(J.error):Ke(J.data?.state,e)}),(0,z.jsx)(`div`,{className:`admin-data-diagnostics`,children:Object.entries(J.data?.tool_capture?.tenants??{}).map(([n,r])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:Ke(r.state,e)}),(0,z.jsxs)(`span`,{children:[r.counts.events_received??0,` `,t(`条接收事件`,`events received`)]}),r.last_error_code?(0,z.jsx)(`code`,{children:r.last_error_code}):null]},n))}),(0,z.jsx)(v,{label:t(`完整诊断数据`,`Full diagnostic data`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:JSON.stringify({collector:J.data,project:Y,collection:X.data?.collection,gaps:X.data?.gaps,completeness:q?.completeness},null,2)})})]})})]})}export{tt as default,_e as saveDownload}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AdminDataApp-D7m1m69B.js b/frontend/web/dist/assets/AdminDataApp-D7m1m69B.js new file mode 100644 index 000000000..bf16ae11e --- /dev/null +++ b/frontend/web/dist/assets/AdminDataApp-D7m1m69B.js @@ -0,0 +1,13 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i,n as a,o,t as ee}from"./query-CUzIxVzm.js";import{H as s,K as c,O as l,k as u,q as d}from"./index-DbVni4qR.js";import{A as te,C as f,E as p,F as ne,I as re,L as ie,M as ae,N as oe,O as se,P as ce,R as m,S as le,_ as ue,b as de,c as h,d as fe,f as pe,g as me,i as g,j as he,k as ge,l as _e,n as ve,p as ye,r as _,s as v,t as be,u as xe,w as y,x as Se}from"./AppearanceControls-C_eUyO2x.js";import{n as Ce,t as we}from"./history-MzF_RldS.js";import{n as Te,t as Ee}from"./code-xml-CTbPls4H.js";import{r as De,t as Oe}from"./useWorkbenchTheme-CV-C3OBr.js";var ke=m(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ae=m(`FileJson`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),je=m(`Menu`,[[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}],[`line`,{x1:`4`,x2:`20`,y1:`6`,y2:`6`,key:`1owob3`}],[`line`,{x1:`4`,x2:`20`,y1:`18`,y2:`18`,key:`yk5zj1`}]]),b=m(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Me=m(`Users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),x=e(t(),1),S=6e4,Ne=12e4,Pe=class extends c{loginURL;constructor(e){super(e.status===401?`数据后台登录已过期,请重新登录。`:e.message,e.status,e.method,e.path,e.status===401?`admin_authentication_required`:e.code),this.name=`AdminAPIError`,this.loginURL=e.status===401?`/admin/login`:null}};function C(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function w(e,t){return`/admin/api/training/${e}/${encodeURIComponent(t.tenant)}/${encodeURIComponent(t.sid)}`}async function T(e,t,n){try{await d(e,t,n)}catch(e){throw e instanceof c&&n.startsWith(`/admin/`)?new Pe(e):e}}function E(e,t=`GET`){return new Pe(new c(`数据后台响应格式不正确。`,502,t,e,`invalid_admin_response`))}async function D(e,t={}){return s(e,{method:`GET`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{Accept:`application/json`},signal:t.signal},S,async t=>{await T(t,`GET`,e);try{return await t.json()}catch{throw E(e)}})}function Fe(e){let t=e?.match(/(?:^|;)\s*filename\*=UTF-8''([^;]+)/i)?.[1],n=e?.match(/(?:^|;)\s*filename\s*=\s*(?:"([^"]*)"|([^;]+))/i),r=n?.[1]??n?.[2]?.trim()??``;if(t)try{r=decodeURIComponent(t.trim())}catch{}return r.length>0&&r.length<=180&&/\.zip$/i.test(r)&&!/[\x00-\x1f\x7f/\\:]/.test(r)&&!r.startsWith(`.`)?r:`argus-observations.zip`}var O={overview(e={}){return D(`/admin/api/training/collaboration`+C({purpose:e.purpose??`internal_training`,offset:e.offset??0,tenant:e.tenant,query:e.query}),e)},detail(e){return D(w(`collaboration`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId}),e)},observations(e){return D(w(`observations`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId,cursor:e.cursor,limit:e.limit}),e)},async identity(e={}){let t=`/admin/status`,n=await D(t,e);if(n?.role!==`admin`||typeof n.readonly!=`boolean`)throw E(t);return n},async workspaceIdentity(e={}){let t=`/invite/status`,n=await D(t,e);if(typeof n?.key_id!=`string`||typeof n.role!=`string`||typeof n.readonly!=`boolean`)throw E(t);return{key_id:n.key_id,role:n.role,readonly:n.readonly}},collector(e={}){return D(`/admin/api/research/status`,e)},projectDirectory(e,t={}){return D(`/admin/api/tenants/${encodeURIComponent(e)}/projects`,t)},audit(e={}){return D(`/admin/api/training/audit`+C({limit:e.limit}),e)},exportObservations(e,t={}){let n=`/admin/api/training/export-observations`;return s(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{"Content-Type":`application/json`,Accept:`application/zip`},body:JSON.stringify({purpose:e.purpose,projects:e.projects.map(({tenant_id:e,sid:t})=>({tenant_id:e,sid:t}))}),signal:t.signal},Ne,async e=>{if(await T(e,`POST`,n),e.headers.get(`Content-Type`)?.split(`;`)[0].trim().toLowerCase()!==`application/zip`)throw E(n,`POST`);return{blob:await e.blob(),filename:Fe(e.headers.get(`Content-Disposition`))}})}},k=new Set([`thinking`,`analysis`,`reasoning`,`redacted_thinking`,`signature`]),Ie=RegExp(`^(${de.join(`|`)})(?:[.-][a-z0-9_.-]+)?$`);function A(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function j(e){return typeof e==`string`?e:``}function M(e){return e==null?``:JSON.stringify(e,null,2)}function N(e){return JSON.stringify([e.tenant_id,e.sid])}function Le(e){return e.title?.trim()||e.sid||`未命名项目`}function Re(e){return(e.mission_title||e.title)?.trim().replace(/^#+\s*/,``).split(` +`)[0]||(e.task_id?`任务 ${e.task_id}`:`项目活动`)}function ze(e){return typeof e==`string`?e===`operator`||e===`unknown`?e:e.match(Ie)?.[1]??`unknown`:`unknown`}function Be(e){return typeof e.role==`string`?ze(e.role):ze(e.runtime?.run_label)}function Ve(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{tenant:t.get(`tenant`),sid:t.get(`sid`),taskId:t.get(`task_id`)??t.get(`task`)}}function He(e){let t=e[0];if(!t)return[];let n=JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id]),r=new Map,i=new Map;for(let t of e){if(JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id])!==n)throw Error(`Cannot merge observations from different project, purpose, or task scopes.`);for(let e of t.episodes){if(N(e)!==N(t)||t.task_id!==null&&e.task_id!==t.task_id)throw Error(`Observation episode does not match its page scope.`);let n=r.get(e.episode_id);if(n&&n.task_id!==e.task_id)throw Error(`Observation episode changed task association.`);let a=i.get(e.episode_id)??new Map;for(let t of e.events){if(!Number.isSafeInteger(t.sequence)||t.sequence<0)throw Error(`Observation sequence is invalid.`);a.set(t.sequence,t)}i.set(e.episode_id,a),r.set(e.episode_id,{...e,events:[]})}}return[...r.values()].sort((e,t)=>e.episode_id-t.episode_id).map(e=>({...e,events:[...i.get(e.episode_id).values()].sort((e,t)=>e.sequence-t.sequence)}))}function P(e){return[e.type,e.role,e.channel].some(e=>typeof e==`string`&&k.has(e))}function Ue(e){return Array.isArray(e)?e.map(e=>{let t=A(e),n=A(t?.function);return!t||!n?``:[j(n.name),typeof n.arguments==`string`?n.arguments:M(n.arguments)].filter(Boolean).join(` +`)}).filter(Boolean).join(` + +`):``}function F(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(F).filter(Boolean).join(` +`);let t=A(e);return!t||P(t)?``:t.type===`text`||t.type===`input_text`||t.type===`output_text`?j(t.text):t.type===`toolCall`||t.type===`tool_call`?[j(t.name),typeof t.arguments==`string`?t.arguments:M(t.arguments)].filter(Boolean).join(` +`):`content`in t||`tool_calls`in t?[F(t.content),Ue(t.tool_calls)].filter(Boolean).join(` + +`):``}function We(e){if(!Array.isArray(e))return``;let t={system:`系统`,developer:`开发者`,user:`用户`,assistant:`模型`,toolResult:`工具返回`,tool:`工具返回`};return e.map(e=>{let n=A(e);if(!n||P(n))return``;let r=[F(n.content),Ue(n.tool_calls)].filter(Boolean).join(` + +`);return r?`${t[j(n.role)]||j(n.role)||`消息`}\n${r}`:``}).filter(Boolean).join(` + +`)}function I(e){let t=e.payload,[n,r]={context:[`模型输入`,`input`],provider_request:[`模型请求`,`input`],message_delta:[`模型公开输出片段`,`output`],message_end:[`模型消息`,`output`],session_message:[`历史会话消息`,`output`],agent_end:[`模型输出`,`output`],tool_call:[`工具调用`,`tool`],tool_result:[`工具返回`,`tool`],tool_execution_start:[`工具执行开始`,`tool`],tool_execution_update:[`工具执行进度`,`tool`],tool_execution_end:[`工具执行结束`,`tool`],settled:[`本段过程结束`,`status`],quarantine:[`过程状态记录`,`status`],capture_warning:[`采集提示`,`status`]}[e.kind]??[`过程事件 · ${e.kind}`,`other`],i=``;e.kind===`message_delta`?i=t.type===`text_delta`||t.type===`toolcall_delta`?j(t.delta):``:[`context`,`provider_request`,`message_end`,`session_message`,`agent_end`].includes(e.kind)?i=We(t.messages):e.kind===`tool_call`?i=M(t.input):e.kind===`tool_result`?i=F(t.content):e.kind===`tool_execution_start`?i=M(t.args):e.kind===`tool_execution_update`?i=F(t.partialResult):e.kind===`tool_execution_end`?i=F(t.result):(e.kind===`quarantine`||e.kind===`capture_warning`)&&(i=j(t.reason));let a=e.kind===`tool_result`||e.kind===`tool_execution_end`;return{key:e.id??String(e.sequence),kind:e.kind,title:n,category:r,text:i,toolName:j(t.toolName)||null,toolCallId:j(t.toolCallId)||null,result:a?t.isError===!0?`error`:t.isError===!1?`success`:`unknown`:null,timestamp:typeof e.observed_at==`number`&&Number.isFinite(e.observed_at)?e.observed_at:null}}function L(){let{locale:e,t,setLocale:n}=u();return{locale:e,t,setLocale:n,text:(t,n)=>e===`zh-CN`?t:n}}function Ge(e,t){return typeof e==`number`&&Number.isFinite(e)?new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e*1e3):`—`}function R(e,t){return y(e)?f(e,e=>l(e,{},t)):{operator:[`用户`,`User`],unknown:[`角色未记录`,`Unassigned role`],system:[`系统`,`System`],developer:[`运行指令`,`Instructions`],user:[`用户 / 任务`,`User / task`],assistant:[`模型`,`Assistant`],tool:[`工具`,`Tool`]}[e]?.[t===`zh-CN`?0:1]??e}function Ke(e,t){return{complete:[`调用已结束`,`Call ended`],capturing:[`尚无结束记录`,`No end record yet`],interrupted:[`采集中断`,`Capture interrupted`],quarantined:[`需检查记录`,`Record needs attention`],approved:[`已验收`,`Reviewed`],not_approved:[`未验收`,`Not reviewed`],unknown:[`结果未确认`,`Outcome unconfirmed`],running:[`采集正常`,`Collector running`],storage_error:[`存储异常`,`Storage unavailable`],starting:[`正在启动`,`Starting`],listening:[`已连接`,`Listening`],unavailable:[`暂不可用`,`Unavailable`]}[e||`unknown`]?.[t===`zh-CN`?0:1]??e??`—`}function qe(e,t){return{context:[`Agent 上下文`,`Agent context`],provider_request:[`模型实际输入`,`Model request`],message_end:[`公开消息`,`Public message`],agent_end:[`调用结果`,`Call output`],message_delta:[`公开输出增量`,`Public output increments`],tool_call:[`工具调用`,`Tool call`],tool_result:[`工具结果`,`Tool result`],tool_execution_start:[`工具开始执行`,`Tool execution started`],tool_execution_update:[`工具执行更新`,`Tool execution update`],tool_execution_end:[`工具执行结束`,`Tool execution ended`],settled:[`采集已收尾`,`Capture settled`],quarantine:[`记录不完整`,`Incomplete record`],capture_warning:[`采集提示`,`Capture notice`]}[e]?.[t===`zh-CN`?0:1]??e}var z=n(),B=e=>JSON.stringify(e,null,2);function V({value:e}){let{text:t}=L();return(0,z.jsxs)(v,{label:t(`原始 JSON`,`Raw JSON`),children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(ue,{text:B(e),label:t(`复制 JSON`,`Copy JSON`),copiedLabel:t(`已复制`,`Copied`)})}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(e)})]})}function Je({message:e,index:t}){let{locale:n,text:r}=L(),[i,a]=(0,x.useState)(!1),o=F(e);return(0,z.jsxs)(`details`,{className:`admin-data-message`,onToggle:e=>a(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,z.jsx)(`strong`,{children:R(e.role||`unknown`,n)}),(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[o.length.toLocaleString(n),` `,r(`字符`,`characters`)]}),(0,z.jsx)(ne,{size:13})]}),i?(0,z.jsxs)(`div`,{className:`admin-data-message-body`,children:[o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(ue,{text:o,label:r(`复制内容`,`Copy text`),copiedLabel:r(`已复制`,`Copied`)}),(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:o})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:r(`这条消息没有公开文本;结构见下方。`,`This message has no public text; its structure is below.`)}),(0,z.jsx)(V,{value:e})]}):null]})}function H({event:e}){let{locale:t,text:n}=L(),r=I(e),i=e.payload,a=Array.isArray(i.messages)?i.messages:[];return(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[e.kind===`provider_request`?(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[typeof i.model==`string`?(0,z.jsx)(g,{children:i.model}):null,typeof i.reasoning_effort==`string`?(0,z.jsx)(g,{children:i.reasoning_effort}):null,(0,z.jsxs)(`span`,{children:[a.length.toLocaleString(t),` `,n(`条消息`,`messages`),` · `,(i.tools?.length||0).toLocaleString(t),` `,n(`个工具定义`,`tool definitions`)]})]}):null,a.length?(0,z.jsx)(`div`,{className:`admin-data-message-list`,children:a.map((e,t)=>(0,z.jsx)(Je,{message:e,index:t},t))}):r.text?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(ue,{text:r.text,label:n(`复制内容`,`Copy text`),copiedLabel:n(`已复制`,`Copied`)})}),r.category===`tool`||e.kind===`message_delta`?(0,z.jsx)(`pre`,{className:`admin-data-code`,children:r.text}):(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:r.text})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:n(`此事件保留了状态和结构,没有公开文本。`,`This event contains status and structure, with no public text.`)}),i.tools?.length?(0,z.jsx)(v,{label:n(`工具定义`,`Tool definitions`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(i.tools)})}):null,(0,z.jsx)(V,{value:e})]})}function U(e){let t=[];for(let n of e){let e=n.kind===`message_delta`?JSON.stringify([n.kind,n.payload.type,n.payload.message_index,n.payload.content_index,n.payload.toolCallId]):`event:${n.sequence}`,r=t[t.length-1];n.kind===`message_delta`&&r?.key===e?r.events.push(n):t.push({key:e,events:[n]})}return t}function W({group:e}){let{locale:t,text:n}=L(),[r,i]=(0,x.useState)(!1),a=e.events[0],o=I(a),ee=o.category===`tool`?ge:o.category===`input`?Ee:b,s=e.events.length>1,c=s?e.events.map(e=>I(e).text).join(``):o.text,l=a.kind===`provider_request`?`${a.payload.messages?.length??0} ${n(`条消息`,`messages`)} · ${a.payload.tools?.length??0} ${n(`个工具`,`tools`)}`:(a.payload.messages?F(a.payload.messages):c).replace(/\s+/g,` `).slice(0,110);return(0,z.jsxs)(`details`,{className:`admin-data-event`,"data-event-kind":a.kind,onToggle:e=>i(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{className:`admin-data-event-icon`,children:(0,z.jsx)(ee,{size:15})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`admin-data-event-title`,children:[(0,z.jsxs)(`strong`,{children:[qe(a.kind,t),o.toolName?` · ${o.toolName}`:``]}),s?(0,z.jsxs)(g,{children:[e.events.length,` `,n(`条增量`,`increments`)]}):null,o.result===`error`?(0,z.jsx)(g,{color:p.error,children:n(`工具报告错误`,`Tool reported an error`)}):null,o.result===`success`?(0,z.jsx)(g,{color:p.success,children:n(`工具报告成功`,`Tool reported success`)}):null]}),l?(0,z.jsx)(`p`,{className:`admin-data-event-preview`,children:l}):null]}),(0,z.jsx)(`span`,{className:`admin-data-event-time`,children:Ge(a.observed_at,t)}),(0,z.jsx)(ne,{size:14})]}),r?s?(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[(0,z.jsx)(ue,{text:c,label:n(`复制输出`,`Copy output`),copiedLabel:n(`已复制`,`Copied`)}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:c}),(0,z.jsx)(V,{value:e.events})]}):(0,z.jsx)(H,{event:a}):null]})}function Ye({episode:e,readonly:t,onDownload:n}){let{locale:r,text:i}=L(),[a,o]=(0,x.useState)(`all`),[ee,s]=(0,x.useState)(0),c=(0,x.useMemo)(()=>U(e.events.filter(e=>{let t=I(e).category;return a===`all`||(a===`tools`?t===`tool`:t===`input`||t===`output`)})),[e.events,a]);(0,x.useEffect)(()=>s(0),[e.episode_id,a]);let l=Math.max(1,Math.ceil(c.length/60)),u=Math.min(ee,l-1),d=c.slice(u*60,u*60+60),te=e.events.length,f=e.collection.event_count,ne=e.quality.approved===!0&&e.quality.state===`approved`;return(0,z.jsxs)(`section`,{className:`admin-data-inspector`,"aria-label":i(`过程详情`,`Process details`),children:[(0,z.jsxs)(`div`,{className:`admin-data-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h3`,{children:[R(e.role,r),` `,(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[`· #`,e.episode_id]})]}),(0,z.jsxs)(`p`,{children:[Ge(e.started_at,r),` · `,e.task_id?`${i(`任务`,`Task`)} ${e.task_id}`:i(`项目级 / 未关联任务`,`Project-level / no task association`)]})]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:t,onClick:()=>n(e),title:t?i(`只读会话不能导出`,`Exports are disabled for read-only sessions`):i(`下载当前已加载的原始记录`,`Download the raw records currently loaded`),children:[(0,z.jsx)(ce,{size:14}),` JSON`]})]}),(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[(0,z.jsx)(g,{children:Ke(e.state,r)}),(0,z.jsx)(g,{color:ne?p.success:void 0,children:ne?i(`已验收`,`Reviewed`):i(`未验收`,`Not reviewed`)}),(0,z.jsxs)(`span`,{children:[i(`已加载`,`Loaded`),` `,te.toLocaleString(r),` / `,f.toLocaleString(r),` `,i(`条事件`,`events`)]}),e.runtime.run_label?(0,z.jsx)(`code`,{children:e.runtime.run_label}):null]}),!e.collection.complete||e.collection.historical_data_unavailable||te(0,z.jsx)(`button`,{type:`button`,"aria-pressed":a===e,className:a===e?`active`:``,onClick:()=>o(e),children:e===`all`?i(`全部事件`,`All events`):e===`messages`?i(`模型输入 / 输出`,`Model input / output`):i(`工具轨迹`,`Tool trace`)},e))}),c.length?(0,z.jsx)(`div`,{className:`admin-data-timeline`,children:d.map(t=>(0,z.jsx)(W,{group:t},`${e.episode_id}:${t.events[0].sequence}`))}):(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(Ae,{size:24}),(0,z.jsx)(`p`,{children:i(`当前已加载的记录中没有此类事件。`,`No events of this type are present in the loaded records.`)})]}),c.length>60?(0,z.jsxs)(`div`,{className:`admin-data-paging`,"aria-label":i(`当前过程的事件分页`,`Event pages for this process`),children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!u,onClick:()=>s(u-1),title:i(`上一段事件`,`Previous event group`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[u*60+1,`–`,Math.min(c.length,u*60+60),` / `,c.length.toLocaleString(r),` `,i(`组事件`,`event groups`)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:u+1>=l,onClick:()=>s(u+1),title:i(`下一段事件`,`Next event group`),children:(0,z.jsx)(Te,{size:14})})]}):null,(0,z.jsx)(V,{value:{...e,events:void 0,loaded_event_count:te}})]})}function Xe(e,t,n=``){let r=new URL(e);return r.searchParams.set(`tenant`,t.tenant_id),r.searchParams.set(`sid`,t.sid),n?r.searchParams.set(`task_id`,n):r.searchParams.delete(`task_id`),r.searchParams.delete(`task`),`${r.pathname}${r.search}${r.hash}`}function Ze(e,t,n,r){if(e.some(e=>N(e)===t))return null;let i=r&&n.sid?e.filter(e=>e.sid===n.sid&&(!n.tenant||e.tenant_id===n.tenant)):[],a=i.length===1?i[0]:void 0;if(r&&n.sid&&!a)return null;let o=a??e[0];return{key:o?N(o):``,taskId:a&&n.taskId||``}}async function Qe(e,t,n){let r=await t(),i=r.role===`trial`&&r.key_id===e.tenant_id;return i&&n(`/?project=${encodeURIComponent(e.sid)}`),{matched:i,identity:r}}var $e=Array.from({length:11},(e,t)=>`trial-${String(t+1).padStart(2,`0`)}`),G=(e,t)=>e<1&&!(t instanceof Pe&&[401,403].includes(t.status));function et(e){let[t,n]=(0,x.useState)(e);return(0,x.useEffect)(()=>{let t=window.setTimeout(()=>n(e),250);return()=>window.clearTimeout(t)},[e]),t}function tt(){let{locale:e,text:t,t:n}=L(),{themeMode:s,cycleTheme:c}=Oe(),l=i(),[u]=(0,x.useState)(()=>Ve(window.location.search)),[d,f]=(0,x.useState)(!!u.sid),[p,ne]=(0,x.useState)(u.tenant||``),[m,ge]=(0,x.useState)(``),[y,Ee]=(0,x.useState)(`internal_training`),[b,S]=(0,x.useState)(0),[Ne,C]=(0,x.useState)(u.tenant&&u.sid?N({tenant_id:u.tenant,sid:u.sid}):``),[w,T]=(0,x.useState)(u.taskId||``),[E,D]=(0,x.useState)(null),[Fe,k]=(0,x.useState)(null),[Ie,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(null),[P,Ue]=(0,x.useState)(()=>new Map),[F,We]=(0,x.useState)(``),[I,qe]=(0,x.useState)(!1),[B,V]=(0,x.useState)(null),Je=et(m),H=r({queryKey:[`admin-data`,`identity`],queryFn:({signal:e})=>O.identity({signal:e}),staleTime:3e4,retry:!1}),U=H.data?.role===`admin`,W=H.data?.readonly!==!1,tt=!!Je||d,K=r({queryKey:[`admin-data`,`overview`,y,p,tt?`all-pages`:b],queryFn:async({signal:e})=>{let t=await O.overview({purpose:y,tenant:p,offset:tt?0:b,signal:e}),n=[t],r=new Set([t.offset]);for(;tt&&n[n.length-1].has_more_projects;){let t=n[n.length-1].next_offset;if(t===null||r.has(t))throw Error(`Invalid project pagination`);r.add(t),n.push(await O.overview({purpose:y,tenant:p,offset:t,signal:e}))}return n},enabled:U,retry:G,refetchInterval:!tt&&2e4}),q=(0,x.useMemo)(()=>{let e=K.data;if(!e?.length)return;let t=e[e.length-1];return{...e[0],projects:e.flatMap(e=>e.projects),tasks:e.flatMap(e=>e.tasks),has_more_projects:t.has_more_projects,next_offset:t.next_offset,completeness:{...e[0].completeness,page_truncated:e.some(e=>e.completeness.page_truncated)}}},[K.data]),J=r({queryKey:[`admin-data`,`collector`],queryFn:({signal:e})=>O.collector({signal:e}),enabled:U,retry:G,refetchInterval:15e3}),nt=r({queryKey:[`admin-data`,`audit`],queryFn:({signal:e})=>O.audit({signal:e}),enabled:U&&j===`audit`,retry:G}),rt=q?.projects??[],it=(0,x.useMemo)(()=>[...new Set(rt.map(e=>e.tenant_id))].sort(),[rt]),at=o({queries:it.map(e=>({queryKey:[`admin-data`,`directory`,e],queryFn:({signal:t})=>O.projectDirectory(e,{signal:t}),enabled:U,staleTime:6e4,retry:G}))}),ot=new Map;at.forEach((e,t)=>{for(let n of e.data?.projects??[])n.title&&ot.set(N({tenant_id:it[t],sid:n.id}),n.title)});let st=e=>ot.get(N(e))||Le(e),ct=Je.trim().toLocaleLowerCase(e),lt=rt.filter(t=>!ct||[st(t),t.title,t.tenant_id,t.sid,...(q?.tasks??[]).filter(e=>N(e)===N(t)).flatMap(e=>[Re(e),e.task_id||``])].some(t=>t.toLocaleLowerCase(e).includes(ct))),Y=lt.find(e=>N(e)===Ne)??null,ut=(q?.tasks??[]).filter(e=>Y&&N(e)===N(Y)),dt=ut.filter(e=>e.task_id),ft=ut.find(e=>e.task_id===w)??null;(0,x.useEffect)(()=>{if(!q)return;let e=Ze(lt,Ne,u,d);if(!e)return;C(e.key),k(null),D(null),T(e.taskId);let t=lt.find(t=>N(t)===e.key);t&&xt(t,e.taskId)},[q,Ne,u,d,Je,at.map(e=>e.dataUpdatedAt).join(`,`)]);let pt=[y,Y?.tenant_id,Y?.sid,w||null],X=r({queryKey:[`admin-data`,`detail`,...pt],queryFn:({signal:e})=>O.detail({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,signal:e}),enabled:U&&!!Y?.eligible,retry:G}),Z=ft??(w&&X.data?.task_id===w?X.data:null),mt=!w||!!Z,Q=ee({queryKey:[`admin-data`,`observations`,...pt],queryFn:({pageParam:e,signal:t})=>O.observations({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,cursor:e,limit:200,signal:t}),initialPageParam:null,getNextPageParam:e=>e.pagination.has_more?e.pagination.next_cursor:void 0,enabled:U&&!!Y?.eligible&&mt,retry:G}),ht=(0,x.useMemo)(()=>He(Q.data?.pages??[]),[Q.data]),gt=ht.filter(e=>E===null||Be(e)===E),_t=gt.find(e=>e.episode_id===Fe)??gt[0]??null,vt=new Map;for(let e of w?Z?[Z]:[]:ut)for(let t of e.roles){let e=ze(t.role),n=vt.get(e);vt.set(e,{...t,role:e,observations:(n?.observations||0)+t.observations,episodes:(n?.episodes||0)+t.episodes,tool_pairs:(n?.tool_pairs||0)+t.tool_pairs})}let yt=ht.reduce((e,t)=>e+t.events.length,0),bt=P.size?[...P.values()]:Y?[Y]:[],$=a({mutationFn:()=>{if(W||!bt.length||bt.length>20)throw Error(t(`请选择最多 20 个可导出的项目。`,`Select up to 20 eligible projects.`));return O.exportObservations({purpose:y,projects:bt})},onSuccess:e=>{ve(e.blob,e.filename),We(t(`全部保留过程已下载。`,`All retained process data downloaded.`)),l.invalidateQueries({queryKey:[`admin-data`,`audit`]})}}),xt=(e,t=``)=>{window.history.replaceState(window.history.state,``,Xe(window.location.href,e,t))},St=e=>{f(!1),C(N(e)),T(``),D(null),k(null),A(!1),xt(e)},Ct=e=>{T(e),k(null),D(null),Y&&xt(Y,e)},wt=e=>Ue(t=>{let n=new Map(t),r=N(e);return n.has(r)?n.delete(r):n.size<20&&n.set(r,e),n}),Tt=()=>{l.invalidateQueries({queryKey:[`admin-data`]})},Et=e=>{W||ve(new Blob([JSON.stringify({scope:`loaded_observations`,loaded_event_count:e.events.length,episode:e},null,2)],{type:`application/json`}),`${e.tenant_id}-${e.sid}-process-${e.episode_id}.json`)},Dt=async()=>{if(!(!Y||I)){qe(!0);try{let e=await Qe(Y,()=>O.workspaceIdentity(),e=>window.location.assign(e));V(e.identity.role===`trial`?e.identity.key_id:null),e.matched||M(`workspace`)}catch{V(null),M(`workspace`)}finally{qe(!1)}}},Ot=e=>e instanceof Pe&&e.status===401?t(`数据后台登录已过期,请重新登录。`,`Your administrator session expired. Sign in again.`):e instanceof Error?e.message:t(`暂时无法读取数据。`,`Data is temporarily unavailable.`);return(0,z.jsxs)(fe,{className:`admin-data-workspace h-full`,style:{"--sidebar-width":`292px`},children:[Ie?(0,z.jsx)(`button`,{type:`button`,className:`admin-data-scrim lg:hidden`,"aria-label":t(`关闭项目列表`,`Close projects`),onClick:()=>A(!1)}):null,(0,z.jsxs)(pe,{mobileOpen:Ie,className:`admin-data-sidebar`,"aria-label":t(`数据项目`,`Data projects`),children:[(0,z.jsxs)(`div`,{className:`admin-data-sidebar-brand`,children:[(0,z.jsx)(De,{size:25}),(0,z.jsx)(g,{children:t(`数据`,`Data`)}),(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button ml-auto lg:hidden`,onClick:()=>A(!1),"aria-label":n(`common.close`),children:(0,z.jsx)(se,{size:18})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-heading`,children:[(0,z.jsx)(`span`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`span`,{children:q?.total_projects??`—`})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-controls`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`账号`,`Account`)}),(0,z.jsxs)(`select`,{"aria-label":t(`筛选账号`,`Filter account`),value:p,onChange:e=>{f(!1),ne(e.target.value),S(0),T(``)},children:[(0,z.jsx)(`option`,{value:``,children:t(`全部 11 个账号`,`All 11 accounts`)}),$e.map(e=>(0,z.jsx)(`option`,{children:e},e))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-search`,children:[(0,z.jsx)(he,{size:15}),(0,z.jsx)(`input`,{"aria-label":t(`搜索项目、任务或 SID`,`Search projects, tasks or SID`),placeholder:t(`搜索项目或任务…`,`Search projects or tasks…`),value:m,onChange:e=>{f(!1),ge(e.target.value),S(0)}})]})]}),(0,z.jsxs)(`div`,{className:`admin-data-projects`,"aria-busy":K.isFetching,children:[K.isPending&&U?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(h,{}),(0,z.jsx)(`p`,{children:t(`正在读取项目…`,`Loading projects…`)})]}):null,K.error?(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`alert`,children:[Ot(K.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void K.refetch(),children:n(`common.retry`)})]}):null,!K.isPending&&!lt.length&&!K.error?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(ke,{size:22}),(0,z.jsx)(`p`,{children:t(`没有符合筛选条件的项目。`,`No projects match these filters.`)})]}):null,lt.map(n=>{let r=N(n)===Ne,i=(q?.tasks??[]).filter(e=>N(e)===N(n)).reduce((e,t)=>e+t.collection.retained_episodes,0);return(0,z.jsxs)(`div`,{"data-testid":`project-${n.tenant_id}-${n.sid}`,className:`admin-data-project ${r?`active`:``}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-project-open`,"aria-current":r?`page`:void 0,onClick:()=>St(n),children:[(0,z.jsx)(`span`,{className:`admin-data-project-title`,children:st(n)}),(0,z.jsxs)(`span`,{className:`admin-data-project-id`,children:[n.tenant_id,` · `,n.sid]}),(0,z.jsx)(`span`,{className:`admin-data-project-meta`,children:n.eligible?i?`${i.toLocaleString(e)} ${t(`段保留过程`,`retained processes`)}`:t(`尚无保留过程`,`No process data retained`):t(`当前用途不可读取`,`Unavailable for this purpose`)})]}),(0,z.jsx)(`input`,{type:`checkbox`,className:`admin-data-project-check`,"aria-label":`${t(`选择导出项目`,`Select project for export`)} ${st(n)} ${n.tenant_id} ${n.sid}`,checked:P.has(N(n)),disabled:W||!n.eligible||P.size>=20&&!P.has(N(n)),onChange:()=>wt(n)})]},N(n))})]}),(0,z.jsxs)(`div`,{className:`admin-data-paging`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!b||K.isFetching,onClick:()=>S(Math.max(0,b-20)),title:t(`上一页项目`,`Previous project page`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[t(`第`,`Page`),` `,Math.floor(b/20)+1,` `,t(`页`,``)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!q?.has_more_projects||K.isFetching,onClick:()=>S(q?.next_offset??b+20),title:t(`下一页项目`,`Next project page`),children:(0,z.jsx)(Te,{size:14})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-footer`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`audit`),children:[(0,z.jsx)(we,{size:15}),t(`导出记录`,`Export history`)]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`diagnostics`),children:[(0,z.jsx)(ie,{size:15}),t(`采集诊断`,`Capture diagnostics`)]}),(0,z.jsxs)(`a`,{href:`/invite`,children:[(0,z.jsx)(oe,{size:15}),t(`用户工作空间`,`User workspace`)]})]})]}),(0,z.jsxs)(`main`,{className:`admin-data-surface`,children:[(0,z.jsxs)(xe,{children:[(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button lg:hidden`,onClick:()=>A(!0),"aria-label":t(`打开项目列表`,`Open projects`),children:(0,z.jsx)(je,{size:18})}),(0,z.jsx)(`span`,{className:`admin-data-header-title`,children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(g,{children:W?t(`只读管理员`,`Read-only administrator`):t(`管理员`,`Administrator`)}),(0,z.jsxs)(`div`,{className:`ml-auto flex items-center gap-1 sm:gap-2`,children:[(0,z.jsx)(be,{themeMode:s,onCycleTheme:c}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:Tt,disabled:K.isFetching||!U,title:t(`刷新数据`,`Refresh data`),children:K.isFetching?(0,z.jsx)(h,{}):(0,z.jsx)(ae,{size:14})}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!Y?.eligible||$.isPending,onClick:()=>{We(``),M(`export`)},children:[(0,z.jsx)(ce,{size:14}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:t(`导出`,`Export`)})]})]})]}),(0,z.jsx)(`div`,{className:`admin-data-content`,children:U?Y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-project-heading`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`p`,{className:`admin-data-eyebrow`,children:[(0,z.jsx)(ke,{size:13}),t(`已授权的过程数据`,`Authorized process data`)]}),(0,z.jsx)(`h1`,{children:st(Y)}),(0,z.jsxs)(`div`,{className:`admin-data-project-identity`,children:[(0,z.jsxs)(`code`,{children:[Y.tenant_id,` / `,Y.sid]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:I,onClick:()=>void Dt(),children:[I?(0,z.jsx)(h,{}):(0,z.jsx)(oe,{size:13}),t(`在用户端打开`,`Open in user workspace`)]}),(0,z.jsx)(ue,{text:`${window.location.origin}/admin/data?tenant=${encodeURIComponent(Y.tenant_id)}&sid=${encodeURIComponent(Y.sid)}`,label:t(`复制后台链接`,`Copy data link`),copiedLabel:t(`已复制`,`Copied`)})]})]}),(0,z.jsxs)(`span`,{className:`admin-data-collector-status`,children:[(0,z.jsx)(_e,{ok:J.data?.state===`running`}),J.error?t(`采集状态暂不可读`,`Capture status unavailable`):Ke(J.data?.state,e)]})]}),(0,z.jsxs)(`div`,{className:`admin-data-context-bar`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field flex-1`,children:[(0,z.jsx)(`span`,{children:t(`查看范围`,`View scope`)}),(0,z.jsxs)(`select`,{value:w,onChange:e=>Ct(e.target.value),"aria-label":t(`选择任务或整个项目`,`Select a task or the entire project`),children:[(0,z.jsx)(`option`,{value:``,children:t(`整个项目 · 包含任务创建前的过程`,`Entire project · includes pre-task processes`)}),w&&!dt.some(e=>e.task_id===w)?(0,z.jsxs)(`option`,{value:w,children:[Z?Re(Z):t(`链接中的任务`,`Linked task`),` · `,w]}):null,dt.map(e=>(0,z.jsxs)(`option`,{value:e.task_id,children:[Re(e),` · `,e.task_id]},e.task_id))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`数据用途`,`Data purpose`)}),(0,z.jsxs)(`select`,{value:y,onChange:e=>{Ee(e.target.value),Ue(new Map),S(0)},children:[(0,z.jsx)(`option`,{value:`internal_training`,children:t(`内部训练`,`Internal training`)}),(0,z.jsx)(`option`,{value:`external_sharing`,children:t(`对外共享`,`External sharing`)})]})]})]}),Y.eligible?(0,z.jsxs)(z.Fragment,{children:[w&&Z?(0,z.jsxs)(v,{label:t(`任务目标与来源`,`Task objective and source`),children:[(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(me,{children:Z.objective||Z.request?.text||Z.title})}),(0,z.jsx)(`code`,{children:Z.task_id})]}):null,mt?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-role-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h2`,{children:[(0,z.jsx)(Me,{size:17}),t(`多 Agent 过程`,`Multi-agent processes`)]}),(0,z.jsx)(`p`,{children:t(`查看各角色实际留下的记录。角色缺失、中断和质量验收分别标记。`,`Inspect the records each role actually produced. Missing roles, interruptions and review status are shown separately.`)})]}),(0,z.jsx)(`button`,{type:`button`,className:`admin-data-text-button ${E===null?`active`:``}`,onClick:()=>{D(null),k(null)},children:t(`全部角色`,`All roles`)})]}),(0,z.jsx)(`div`,{className:`admin-data-roles`,children:de.map(r=>{let i=vt.get(r),a=Math.max(i?.episodes||0,ht.filter(e=>Be(e)===r).length),o=ht.filter(e=>Be(e)===r).length;return(0,z.jsxs)(`button`,{type:`button`,"data-testid":`role-${r}`,className:`admin-data-role ${E===r?`active`:``}`,style:{"--role-color":Se(r)},"aria-pressed":E===r,onClick:()=>{D(r),k(null)},children:[(0,z.jsxs)(`span`,{className:`admin-data-role-label`,children:[(0,z.jsx)(`span`,{className:`admin-data-role-mark`,children:R(r,e).slice(0,1)}),(0,z.jsx)(`strong`,{children:R(r,e)}),(0,z.jsx)(`span`,{children:r})]}),(0,z.jsx)(`span`,{className:`admin-data-role-description`,children:le(r,n)}),(0,z.jsx)(`span`,{className:`admin-data-role-count`,children:a?`${a.toLocaleString(e)} ${t(`段过程`,`processes`)}`:i?.observations?t(`仅有活动记录`,`Activity records only`):t(`尚未采到记录`,`No records captured`)}),(0,z.jsx)(`span`,{className:`admin-data-role-footnote`,children:o?`${t(`正文已加载`,`Content loaded`)} ${o.toLocaleString(e)}`:t(`按原始记录归属角色`,`Role comes from recorded metadata`)})]},r)})}),vt.get(`unknown`)?.episodes||ht.some(e=>Be(e)===`unknown`)?(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-unknown`,onClick:()=>{D(`unknown`),k(null)},children:[(0,z.jsx)(Ae,{size:14}),t(`另有角色未记录的过程,保留原样查看`,`Some processes have no recorded role. View them as captured.`),` `,(0,z.jsx)(Te,{size:13})]}):null,(0,z.jsxs)(`div`,{className:`admin-data-record-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{children:E?R(E,e):t(`全部保留过程`,`All retained processes`)}),(0,z.jsxs)(`p`,{children:[ht.length.toLocaleString(e),` `,t(`段已加载`,`processes loaded`),` · `,yt.toLocaleString(e),` `,t(`条原始事件`,`raw events`),` `,Q.hasNextPage?t(`· 还有后续页`,`· more pages available`):``]})]}),gt.length?(0,z.jsx)(`select`,{className:`admin-data-episode-select`,"aria-label":t(`选择过程记录`,`Select a process`),value:_t?.episode_id??``,onChange:e=>k(Number(e.target.value)),children:gt.map(t=>(0,z.jsxs)(`option`,{"data-testid":`episode-${t.episode_id}`,value:t.episode_id,children:[`#`,t.episode_id,` · `,R(t.role,e),` · `,Ge(t.started_at,e)]},t.episode_id))}):null]}),Q.error?(0,z.jsxs)(`div`,{role:`alert`,className:`admin-data-notice`,children:[Ot(Q.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void Q.refetch(),children:n(`common.retry`)})]}):null,_t?(0,z.jsx)(Ye,{episode:_t,readonly:W,onDownload:Et},_t.episode_id):(0,z.jsxs)(`div`,{className:`admin-data-empty admin-data-record-empty`,children:[Q.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(Ae,{size:28}),(0,z.jsx)(`p`,{children:Q.isPending?t(`正在读取真实过程…`,`Loading recorded processes…`):E&&(vt.get(E)?.episodes||0)>0?t(`该角色有记录,当前页尚未加载其正文。`,`This role has recorded processes; their content is on a later page.`):t(`当前范围没有保留的模型过程。项目活动不等同于完整模型轨迹。`,`No model processes are retained in this scope. Project activity does not establish a complete model trace.`)})]}),Q.hasNextPage?(0,z.jsx)(`div`,{className:`admin-data-load-more`,"data-testid":`load-more-observations`,children:(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:Q.isFetchingNextPage,onClick:()=>void Q.fetchNextPage(),children:[Q.isFetchingNextPage?(0,z.jsx)(h,{}):(0,z.jsx)(Te,{size:14}),t(`加载后续原始记录`,`Load more original records`)]})}):null,X.data?.segments.some(e=>e.source_kind!==`tool_episode`)?(0,z.jsxs)(v,{label:t(`项目活动与任务来源`,`Project activity and task sources`),children:[(0,z.jsx)(`div`,{className:`admin-data-activity`,children:X.data.segments.filter(e=>e.source_kind!==`tool_episode`).map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:R(t.role,e)}),(0,z.jsx)(`span`,{children:t.summary}),(0,z.jsx)(`time`,{children:Ge(t.started_at,e)})]},t.id))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`活动顺序来自记录时间,不表示已证实的 Agent 交接。`,`Activity follows recorded timestamps; it does not establish an agent handoff.`)})]}):null,(0,z.jsxs)(`p`,{className:`admin-data-bottom-note`,children:[(0,z.jsx)(te,{size:14}),t(`过程已采集不代表任务成功,也不代表训练质量已验收。原始记录保留缺失和中断状态。`,`Captured processes do not establish task success or training quality. Missing data and interruptions remain visible.`)]})]}):(0,z.jsx)(`div`,{className:`admin-data-notice`,role:`status`,children:X.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(h,{}),t(`正在核对链接中的任务…`,`Checking the linked task…`)]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{children:[X.error instanceof Pe&&X.error.status===404?t(`链接中的任务 ID 不存在或当前用途下不可读取。这不表示项目没有过程数据。`,`The linked task ID does not exist or is unavailable for this purpose. This does not mean the project has no process data.`):t(`暂时无法核对该任务,请重试或查看整个项目。`,`This task could not be verified. Retry or view the entire project.`),` `,(0,z.jsx)(`code`,{children:w})]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>Ct(``),children:t(`查看整个项目`,`View entire project`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void X.refetch(),children:n(`common.retry`)})]})})]}):(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`status`,children:[t(`当前用途下没有可读取的授权记录。请选择其他项目或数据用途。`,`No authorized records are available for this purpose. Choose another project or purpose.`),(0,z.jsx)(v,{children:(0,z.jsx)(`pre`,{children:Y.reason})})]})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(ke,{size:32}),(0,z.jsx)(`h1`,{children:d&&u.sid?t(`链接中的项目未找到`,`Linked project not found`):t(`选择一个项目`,`Select a project`)}),(0,z.jsx)(`p`,{children:d&&u.sid?t(`当前账号与用途下找不到此 SID,没有替你打开其他项目。请检查链接或选择左侧项目。`,`This SID is not available for the selected account and purpose. Check the link or choose a project from the list.`):t(`从左侧查看各账号的真实过程数据。`,`Choose a project to inspect its recorded processes.`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>A(!0),children:t(`浏览项目`,`Browse projects`)})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(De,{size:38}),(0,z.jsx)(`h1`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`p`,{children:H.error?Ot(H.error):t(`正在验证管理员身份…`,`Checking administrator access…`)}),H.error?(0,z.jsx)(`a`,{className:`brand-button brand-button-primary`,href:`/admin/login`,children:t(`管理员登录`,`Administrator sign in`)}):(0,z.jsx)(h,{})]})})]}),(0,z.jsx)(ye,{open:j===`workspace`,onClose:()=>M(null),label:t(`打开用户工作空间`,`Open user workspace`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`需要对应的用户账号`,`Use the matching user account`)}),(0,z.jsxs)(`p`,{children:[t(`这个项目属于`,`This project belongs to`),` `,(0,z.jsx)(`strong`,{children:Y?.tenant_id}),t(`。`,`. `),B?(0,z.jsxs)(z.Fragment,{children:[t(`当前用户端账号是`,`Your current user account is`),` `,(0,z.jsx)(`strong`,{children:B}),t(`。`,`. `)]}):t(`你尚未登录用户工作空间。`,`You are not signed in to a user workspace.`)]}),(0,z.jsx)(`p`,{children:t(`请在用户端使用对应邀请码登录,再打开这个项目。管理员登录不会切换用户账号。`,`Sign in to the user workspace with the matching invitation before opening this project. Administrator access does not switch your user account.`)}),(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(`a`,{className:`brand-button brand-button-primary inline-flex items-center gap-2`,href:`/invite`,target:`_blank`,rel:`noopener`,children:[t(`打开用户登录入口`,`Open user sign in`),(0,z.jsx)(oe,{size:14})]})]})]})}),(0,z.jsx)(ye,{open:j===`export`,onClose:()=>M(null),label:t(`导出全部保留过程`,`Export all retained processes`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出全部保留过程`,`Export all retained processes`)}),(0,z.jsx)(`p`,{children:t(`ZIP 包含所选项目的全部已保留输入、输出和工具轨迹,包括未验收、未结束和失败的记录。`,`The ZIP includes all retained inputs, outputs and tool traces for these projects, including unreviewed, unfinished and failed records.`)}),(0,z.jsx)(`ul`,{className:`admin-data-export-projects`,children:bt.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(re,{size:14}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:st(e)}),(0,z.jsxs)(`code`,{children:[e.tenant_id,` / `,e.sid]})]})]},N(e)))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`可在项目列表勾选多个项目;一次最多 20 个。`,`Use project checkboxes to select up to 20 projects per export.`)}),W?(0,z.jsx)(`p`,{role:`status`,children:t(`只读管理员不能导出数据。`,`Read-only administrators cannot export data.`)}):null,$.error?(0,z.jsx)(`p`,{role:`alert`,className:`admin-data-notice`,children:Ot($.error)}):null,F?(0,z.jsx)(`p`,{role:`status`,children:F}):null,(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!bt.length||$.isPending,onClick:()=>$.mutate(),children:[$.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(ce,{size:14}),t(`下载 ZIP`,`Download ZIP`)]})]})]})}),(0,z.jsx)(ye,{open:j===`audit`,onClose:()=>M(null),label:t(`导出记录`,`Export history`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出记录`,`Export history`)}),(0,z.jsx)(`p`,{children:t(`服务器记录的导出范围、操作身份与结果。`,`Server-recorded export scope, operator and outcome.`)}),nt.isPending?(0,z.jsx)(h,{}):nt.error?(0,z.jsx)(`p`,{role:`alert`,children:Ot(nt.error)}):nt.data?.events.length?(0,z.jsx)(`div`,{className:`admin-data-table-wrap`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:t(`时间`,`Time`)}),(0,z.jsx)(`th`,{children:t(`操作`,`Action`)}),(0,z.jsx)(`th`,{children:t(`身份 / 用途`,`Actor / purpose`)}),(0,z.jsx)(`th`,{children:t(`结果`,`Outcome`)})]})}),(0,z.jsx)(`tbody`,{children:nt.data.events.map(n=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:Ge(n.created_at,e)}),(0,z.jsxs)(`td`,{children:[n.action,(0,z.jsxs)(`small`,{children:[n.projects??`—`,` `,t(`个项目`,`projects`)]})]}),(0,z.jsxs)(`td`,{children:[n.actor,(0,z.jsx)(`small`,{children:n.purpose===`external_sharing`?t(`对外共享`,`External sharing`):t(`内部训练`,`Internal training`)})]}),(0,z.jsx)(`td`,{children:n.outcome})]},n.id))})]})}):(0,z.jsx)(`p`,{children:t(`尚无导出记录。`,`No export history yet.`)})]})}),(0,z.jsx)(ye,{open:j===`diagnostics`,onClose:()=>M(null),label:t(`采集诊断`,`Capture diagnostics`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`采集诊断`,`Capture diagnostics`)}),(0,z.jsx)(`p`,{children:J.error?Ot(J.error):Ke(J.data?.state,e)}),(0,z.jsx)(`div`,{className:`admin-data-diagnostics`,children:Object.entries(J.data?.tool_capture?.tenants??{}).map(([n,r])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:Ke(r.state,e)}),(0,z.jsxs)(`span`,{children:[r.counts.events_received??0,` `,t(`条接收事件`,`events received`)]}),r.last_error_code?(0,z.jsx)(`code`,{children:r.last_error_code}):null]},n))}),(0,z.jsx)(v,{label:t(`完整诊断数据`,`Full diagnostic data`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:JSON.stringify({collector:J.data,project:Y,collection:X.data?.collection,gaps:X.data?.gaps,completeness:q?.completeness},null,2)})})]})})]})}export{tt as default,ve as saveDownload}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AdminDataApp-g0GVVQx7.js b/frontend/web/dist/assets/AdminDataApp-g0GVVQx7.js new file mode 100644 index 000000000..37b70b803 --- /dev/null +++ b/frontend/web/dist/assets/AdminDataApp-g0GVVQx7.js @@ -0,0 +1,13 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,c as i,n as a,o,t as ee}from"./query-dCPZk0Xc.js";import{D as s,G as c,K as l,O as u,V as d}from"./index-Cr9q41CR.js";import{A as te,C as f,E as p,F as ne,I as re,L as m,M as ie,N as ae,O as oe,P as se,S as ce,_ as le,b as ue,c as h,d as de,f as fe,g as pe,i as g,j as me,k as he,l as ge,n as _e,p as ve,r as _,s as v,t as ye,u as be,w as y,x as xe}from"./AppearanceControls-BIflq6l1.js";import{t as Se}from"./activity-DRTghqfr.js";import{n as Ce,t as we}from"./history-DKaffr1B.js";import{t as Te}from"./code-xml-Cgb6b1v3.js";import{r as Ee,t as De}from"./useWorkbenchTheme-Drg51S8W.js";var Oe=m(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ke=m(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ae=m(`FileJson`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),je=m(`Menu`,[[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}],[`line`,{x1:`4`,x2:`20`,y1:`6`,y2:`6`,key:`1owob3`}],[`line`,{x1:`4`,x2:`20`,y1:`18`,y2:`18`,key:`yk5zj1`}]]),b=m(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Me=m(`Users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),x=e(n(),1),S=6e4,Ne=12e4,Pe=class extends c{loginURL;constructor(e){super(e.status===401?`数据后台登录已过期,请重新登录。`:e.message,e.status,e.method,e.path,e.status===401?`admin_authentication_required`:e.code),this.name=`AdminAPIError`,this.loginURL=e.status===401?`/admin/login`:null}};function C(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function w(e,t){return`/admin/api/training/${e}/${encodeURIComponent(t.tenant)}/${encodeURIComponent(t.sid)}`}async function T(e,t,n){try{await l(e,t,n)}catch(e){throw e instanceof c&&n.startsWith(`/admin/`)?new Pe(e):e}}function E(e,t=`GET`){return new Pe(new c(`数据后台响应格式不正确。`,502,t,e,`invalid_admin_response`))}async function D(e,t={}){return d(e,{method:`GET`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{Accept:`application/json`},signal:t.signal},S,async t=>{await T(t,`GET`,e);try{return await t.json()}catch{throw E(e)}})}function Fe(e){let t=e?.match(/(?:^|;)\s*filename\*=UTF-8''([^;]+)/i)?.[1],n=e?.match(/(?:^|;)\s*filename\s*=\s*(?:"([^"]*)"|([^;]+))/i),r=n?.[1]??n?.[2]?.trim()??``;if(t)try{r=decodeURIComponent(t.trim())}catch{}return r.length>0&&r.length<=180&&/\.zip$/i.test(r)&&!/[\x00-\x1f\x7f/\\:]/.test(r)&&!r.startsWith(`.`)?r:`argus-observations.zip`}var O={overview(e={}){return D(`/admin/api/training/collaboration`+C({purpose:e.purpose??`internal_training`,offset:e.offset??0,tenant:e.tenant,query:e.query}),e)},detail(e){return D(w(`collaboration`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId}),e)},observations(e){return D(w(`observations`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId,cursor:e.cursor,limit:e.limit}),e)},async identity(e={}){let t=`/admin/status`,n=await D(t,e);if(n?.role!==`admin`||typeof n.readonly!=`boolean`)throw E(t);return n},async workspaceIdentity(e={}){let t=`/invite/status`,n=await D(t,e);if(typeof n?.key_id!=`string`||typeof n.role!=`string`||typeof n.readonly!=`boolean`)throw E(t);return{key_id:n.key_id,role:n.role,readonly:n.readonly}},collector(e={}){return D(`/admin/api/research/status`,e)},projectDirectory(e,t={}){return D(`/admin/api/tenants/${encodeURIComponent(e)}/projects`,t)},audit(e={}){return D(`/admin/api/training/audit`+C({limit:e.limit}),e)},exportObservations(e,t={}){let n=`/admin/api/training/export-observations`;return d(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{"Content-Type":`application/json`,Accept:`application/zip`},body:JSON.stringify({purpose:e.purpose,projects:e.projects.map(({tenant_id:e,sid:t})=>({tenant_id:e,sid:t}))}),signal:t.signal},Ne,async e=>{if(await T(e,`POST`,n),e.headers.get(`Content-Type`)?.split(`;`)[0].trim().toLowerCase()!==`application/zip`)throw E(n,`POST`);return{blob:await e.blob(),filename:Fe(e.headers.get(`Content-Disposition`))}})}},k=new Set([`thinking`,`analysis`,`reasoning`,`redacted_thinking`,`signature`]),Ie=RegExp(`^(${ue.join(`|`)})(?:[.-][a-z0-9_.-]+)?$`);function A(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function j(e){return typeof e==`string`?e:``}function M(e){return e==null?``:JSON.stringify(e,null,2)}function N(e){return JSON.stringify([e.tenant_id,e.sid])}function Le(e){return e.title?.trim()||e.sid||`未命名项目`}function Re(e){return(e.mission_title||e.title)?.trim().replace(/^#+\s*/,``).split(` +`)[0]||(e.task_id?`任务 ${e.task_id}`:`项目活动`)}function ze(e){return typeof e==`string`?e===`operator`||e===`unknown`?e:e.match(Ie)?.[1]??`unknown`:`unknown`}function Be(e){return typeof e.role==`string`?ze(e.role):ze(e.runtime?.run_label)}function Ve(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{tenant:t.get(`tenant`),sid:t.get(`sid`),taskId:t.get(`task_id`)??t.get(`task`)}}function He(e){let t=e[0];if(!t)return[];let n=JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id]),r=new Map,i=new Map;for(let t of e){if(JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id])!==n)throw Error(`Cannot merge observations from different project, purpose, or task scopes.`);for(let e of t.episodes){if(N(e)!==N(t)||t.task_id!==null&&e.task_id!==t.task_id)throw Error(`Observation episode does not match its page scope.`);let n=r.get(e.episode_id);if(n&&n.task_id!==e.task_id)throw Error(`Observation episode changed task association.`);let a=i.get(e.episode_id)??new Map;for(let t of e.events){if(!Number.isSafeInteger(t.sequence)||t.sequence<0)throw Error(`Observation sequence is invalid.`);a.set(t.sequence,t)}i.set(e.episode_id,a),r.set(e.episode_id,{...e,events:[]})}}return[...r.values()].sort((e,t)=>e.episode_id-t.episode_id).map(e=>({...e,events:[...i.get(e.episode_id).values()].sort((e,t)=>e.sequence-t.sequence)}))}function P(e){return[e.type,e.role,e.channel].some(e=>typeof e==`string`&&k.has(e))}function Ue(e){return Array.isArray(e)?e.map(e=>{let t=A(e),n=A(t?.function);return!t||!n?``:[j(n.name),typeof n.arguments==`string`?n.arguments:M(n.arguments)].filter(Boolean).join(` +`)}).filter(Boolean).join(` + +`):``}function F(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(F).filter(Boolean).join(` +`);let t=A(e);return!t||P(t)?``:t.type===`text`||t.type===`input_text`||t.type===`output_text`?j(t.text):t.type===`toolCall`||t.type===`tool_call`?[j(t.name),typeof t.arguments==`string`?t.arguments:M(t.arguments)].filter(Boolean).join(` +`):`content`in t||`tool_calls`in t?[F(t.content),Ue(t.tool_calls)].filter(Boolean).join(` + +`):``}function We(e){if(!Array.isArray(e))return``;let t={system:`系统`,developer:`开发者`,user:`用户`,assistant:`模型`,toolResult:`工具返回`,tool:`工具返回`};return e.map(e=>{let n=A(e);if(!n||P(n))return``;let r=[F(n.content),Ue(n.tool_calls)].filter(Boolean).join(` + +`);return r?`${t[j(n.role)]||j(n.role)||`消息`}\n${r}`:``}).filter(Boolean).join(` + +`)}function I(e){let t=e.payload,[n,r]={context:[`模型输入`,`input`],provider_request:[`模型请求`,`input`],message_delta:[`模型公开输出片段`,`output`],message_end:[`模型消息`,`output`],session_message:[`历史会话消息`,`output`],agent_end:[`模型输出`,`output`],tool_call:[`工具调用`,`tool`],tool_result:[`工具返回`,`tool`],tool_execution_start:[`工具执行开始`,`tool`],tool_execution_update:[`工具执行进度`,`tool`],tool_execution_end:[`工具执行结束`,`tool`],settled:[`本段过程结束`,`status`],quarantine:[`过程状态记录`,`status`],capture_warning:[`采集提示`,`status`]}[e.kind]??[`过程事件 · ${e.kind}`,`other`],i=``;e.kind===`message_delta`?i=t.type===`text_delta`||t.type===`toolcall_delta`?j(t.delta):``:[`context`,`provider_request`,`message_end`,`session_message`,`agent_end`].includes(e.kind)?i=We(t.messages):e.kind===`tool_call`?i=M(t.input):e.kind===`tool_result`?i=F(t.content):e.kind===`tool_execution_start`?i=M(t.args):e.kind===`tool_execution_update`?i=F(t.partialResult):e.kind===`tool_execution_end`?i=F(t.result):(e.kind===`quarantine`||e.kind===`capture_warning`)&&(i=j(t.reason));let a=e.kind===`tool_result`||e.kind===`tool_execution_end`;return{key:e.id??String(e.sequence),kind:e.kind,title:n,category:r,text:i,toolName:j(t.toolName)||null,toolCallId:j(t.toolCallId)||null,result:a?t.isError===!0?`error`:t.isError===!1?`success`:`unknown`:null,timestamp:typeof e.observed_at==`number`&&Number.isFinite(e.observed_at)?e.observed_at:null}}function L(){let{locale:e,t,setLocale:n}=u();return{locale:e,t,setLocale:n,text:(t,n)=>e===`zh-CN`?t:n}}function Ge(e,t){return typeof e==`number`&&Number.isFinite(e)?new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e*1e3):`—`}function R(e,t){return y(e)?f(e,e=>s(e,{},t)):{operator:[`用户`,`User`],unknown:[`角色未记录`,`Unassigned role`],system:[`系统`,`System`],developer:[`运行指令`,`Instructions`],user:[`用户 / 任务`,`User / task`],assistant:[`模型`,`Assistant`],tool:[`工具`,`Tool`]}[e]?.[t===`zh-CN`?0:1]??e}function Ke(e,t){return{complete:[`调用已结束`,`Call ended`],capturing:[`尚无结束记录`,`No end record yet`],interrupted:[`采集中断`,`Capture interrupted`],quarantined:[`需检查记录`,`Record needs attention`],approved:[`已验收`,`Reviewed`],not_approved:[`未验收`,`Not reviewed`],unknown:[`结果未确认`,`Outcome unconfirmed`],running:[`采集正常`,`Collector running`],storage_error:[`存储异常`,`Storage unavailable`],starting:[`正在启动`,`Starting`],listening:[`已连接`,`Listening`],unavailable:[`暂不可用`,`Unavailable`]}[e||`unknown`]?.[t===`zh-CN`?0:1]??e??`—`}function qe(e,t){return{context:[`Agent 上下文`,`Agent context`],provider_request:[`模型实际输入`,`Model request`],message_end:[`公开消息`,`Public message`],agent_end:[`调用结果`,`Call output`],message_delta:[`公开输出增量`,`Public output increments`],tool_call:[`工具调用`,`Tool call`],tool_result:[`工具结果`,`Tool result`],tool_execution_start:[`工具开始执行`,`Tool execution started`],tool_execution_update:[`工具执行更新`,`Tool execution update`],tool_execution_end:[`工具执行结束`,`Tool execution ended`],settled:[`采集已收尾`,`Capture settled`],quarantine:[`记录不完整`,`Incomplete record`],capture_warning:[`采集提示`,`Capture notice`]}[e]?.[t===`zh-CN`?0:1]??e}var z=t(),B=e=>JSON.stringify(e,null,2);function V({value:e}){let{text:t}=L();return(0,z.jsxs)(v,{label:t(`原始 JSON`,`Raw JSON`),children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(le,{text:B(e),label:t(`复制 JSON`,`Copy JSON`),copiedLabel:t(`已复制`,`Copied`)})}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(e)})]})}function Je({message:e,index:t}){let{locale:n,text:r}=L(),[i,a]=(0,x.useState)(!1),o=F(e);return(0,z.jsxs)(`details`,{className:`admin-data-message`,onToggle:e=>a(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,z.jsx)(`strong`,{children:R(e.role||`unknown`,n)}),(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[o.length.toLocaleString(n),` `,r(`字符`,`characters`)]}),(0,z.jsx)(ne,{size:13})]}),i?(0,z.jsxs)(`div`,{className:`admin-data-message-body`,children:[o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(le,{text:o,label:r(`复制内容`,`Copy text`),copiedLabel:r(`已复制`,`Copied`)}),(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(pe,{children:o})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:r(`这条消息没有公开文本;结构见下方。`,`This message has no public text; its structure is below.`)}),(0,z.jsx)(V,{value:e})]}):null]})}function H({event:e}){let{locale:t,text:n}=L(),r=I(e),i=e.payload,a=Array.isArray(i.messages)?i.messages:[];return(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[e.kind===`provider_request`?(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[typeof i.model==`string`?(0,z.jsx)(g,{children:i.model}):null,typeof i.reasoning_effort==`string`?(0,z.jsx)(g,{children:i.reasoning_effort}):null,(0,z.jsxs)(`span`,{children:[a.length.toLocaleString(t),` `,n(`条消息`,`messages`),` · `,(i.tools?.length||0).toLocaleString(t),` `,n(`个工具定义`,`tool definitions`)]})]}):null,a.length?(0,z.jsx)(`div`,{className:`admin-data-message-list`,children:a.map((e,t)=>(0,z.jsx)(Je,{message:e,index:t},t))}):r.text?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(le,{text:r.text,label:n(`复制内容`,`Copy text`),copiedLabel:n(`已复制`,`Copied`)})}),r.category===`tool`||e.kind===`message_delta`?(0,z.jsx)(`pre`,{className:`admin-data-code`,children:r.text}):(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(pe,{children:r.text})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:n(`此事件保留了状态和结构,没有公开文本。`,`This event contains status and structure, with no public text.`)}),i.tools?.length?(0,z.jsx)(v,{label:n(`工具定义`,`Tool definitions`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(i.tools)})}):null,(0,z.jsx)(V,{value:e})]})}function U(e){let t=[];for(let n of e){let e=n.kind===`message_delta`?JSON.stringify([n.kind,n.payload.type,n.payload.message_index,n.payload.content_index,n.payload.toolCallId]):`event:${n.sequence}`,r=t[t.length-1];n.kind===`message_delta`&&r?.key===e?r.events.push(n):t.push({key:e,events:[n]})}return t}function W({group:e}){let{locale:t,text:n}=L(),[r,i]=(0,x.useState)(!1),a=e.events[0],o=I(a),ee=o.category===`tool`?he:o.category===`input`?Te:b,s=e.events.length>1,c=s?e.events.map(e=>I(e).text).join(``):o.text,l=a.kind===`provider_request`?`${a.payload.messages?.length??0} ${n(`条消息`,`messages`)} · ${a.payload.tools?.length??0} ${n(`个工具`,`tools`)}`:(a.payload.messages?F(a.payload.messages):c).replace(/\s+/g,` `).slice(0,110);return(0,z.jsxs)(`details`,{className:`admin-data-event`,"data-event-kind":a.kind,onToggle:e=>i(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{className:`admin-data-event-icon`,children:(0,z.jsx)(ee,{size:15})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`admin-data-event-title`,children:[(0,z.jsxs)(`strong`,{children:[qe(a.kind,t),o.toolName?` · ${o.toolName}`:``]}),s?(0,z.jsxs)(g,{children:[e.events.length,` `,n(`条增量`,`increments`)]}):null,o.result===`error`?(0,z.jsx)(g,{color:p.error,children:n(`工具报告错误`,`Tool reported an error`)}):null,o.result===`success`?(0,z.jsx)(g,{color:p.success,children:n(`工具报告成功`,`Tool reported success`)}):null]}),l?(0,z.jsx)(`p`,{className:`admin-data-event-preview`,children:l}):null]}),(0,z.jsx)(`span`,{className:`admin-data-event-time`,children:Ge(a.observed_at,t)}),(0,z.jsx)(ne,{size:14})]}),r?s?(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[(0,z.jsx)(le,{text:c,label:n(`复制输出`,`Copy output`),copiedLabel:n(`已复制`,`Copied`)}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:c}),(0,z.jsx)(V,{value:e.events})]}):(0,z.jsx)(H,{event:a}):null]})}function Ye({episode:e,readonly:t,onDownload:n}){let{locale:r,text:i}=L(),[a,o]=(0,x.useState)(`all`),[ee,s]=(0,x.useState)(0),c=(0,x.useMemo)(()=>U(e.events.filter(e=>{let t=I(e).category;return a===`all`||(a===`tools`?t===`tool`:t===`input`||t===`output`)})),[e.events,a]);(0,x.useEffect)(()=>s(0),[e.episode_id,a]);let l=Math.max(1,Math.ceil(c.length/60)),u=Math.min(ee,l-1),d=c.slice(u*60,u*60+60),te=e.events.length,f=e.collection.event_count,ne=e.quality.approved===!0&&e.quality.state===`approved`;return(0,z.jsxs)(`section`,{className:`admin-data-inspector`,"aria-label":i(`过程详情`,`Process details`),children:[(0,z.jsxs)(`div`,{className:`admin-data-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h3`,{children:[R(e.role,r),` `,(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[`· #`,e.episode_id]})]}),(0,z.jsxs)(`p`,{children:[Ge(e.started_at,r),` · `,e.task_id?`${i(`任务`,`Task`)} ${e.task_id}`:i(`项目级 / 未关联任务`,`Project-level / no task association`)]})]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:t,onClick:()=>n(e),title:t?i(`只读会话不能导出`,`Exports are disabled for read-only sessions`):i(`下载当前已加载的原始记录`,`Download the raw records currently loaded`),children:[(0,z.jsx)(se,{size:14}),` JSON`]})]}),(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[(0,z.jsx)(g,{children:Ke(e.state,r)}),(0,z.jsx)(g,{color:ne?p.success:void 0,children:ne?i(`已验收`,`Reviewed`):i(`未验收`,`Not reviewed`)}),(0,z.jsxs)(`span`,{children:[i(`已加载`,`Loaded`),` `,te.toLocaleString(r),` / `,f.toLocaleString(r),` `,i(`条事件`,`events`)]}),e.runtime.run_label?(0,z.jsx)(`code`,{children:e.runtime.run_label}):null]}),!e.collection.complete||e.collection.historical_data_unavailable||te(0,z.jsx)(`button`,{type:`button`,"aria-pressed":a===e,className:a===e?`active`:``,onClick:()=>o(e),children:e===`all`?i(`全部事件`,`All events`):e===`messages`?i(`模型输入 / 输出`,`Model input / output`):i(`工具轨迹`,`Tool trace`)},e))}),c.length?(0,z.jsx)(`div`,{className:`admin-data-timeline`,children:d.map(t=>(0,z.jsx)(W,{group:t},`${e.episode_id}:${t.events[0].sequence}`))}):(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(Ae,{size:24}),(0,z.jsx)(`p`,{children:i(`当前已加载的记录中没有此类事件。`,`No events of this type are present in the loaded records.`)})]}),c.length>60?(0,z.jsxs)(`div`,{className:`admin-data-paging`,"aria-label":i(`当前过程的事件分页`,`Event pages for this process`),children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!u,onClick:()=>s(u-1),title:i(`上一段事件`,`Previous event group`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[u*60+1,`–`,Math.min(c.length,u*60+60),` / `,c.length.toLocaleString(r),` `,i(`组事件`,`event groups`)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:u+1>=l,onClick:()=>s(u+1),title:i(`下一段事件`,`Next event group`),children:(0,z.jsx)(Oe,{size:14})})]}):null,(0,z.jsx)(V,{value:{...e,events:void 0,loaded_event_count:te}})]})}function Xe(e,t,n=``){let r=new URL(e);return r.searchParams.set(`tenant`,t.tenant_id),r.searchParams.set(`sid`,t.sid),n?r.searchParams.set(`task_id`,n):r.searchParams.delete(`task_id`),r.searchParams.delete(`task`),`${r.pathname}${r.search}${r.hash}`}function Ze(e,t,n,r){if(e.some(e=>N(e)===t))return null;let i=r&&n.sid?e.filter(e=>e.sid===n.sid&&(!n.tenant||e.tenant_id===n.tenant)):[],a=i.length===1?i[0]:void 0;if(r&&n.sid&&!a)return null;let o=a??e[0];return{key:o?N(o):``,taskId:a&&n.taskId||``}}async function Qe(e,t,n){let r=await t(),i=r.role===`trial`&&r.key_id===e.tenant_id;return i&&n(`/?project=${encodeURIComponent(e.sid)}`),{matched:i,identity:r}}var $e=Array.from({length:11},(e,t)=>`trial-${String(t+1).padStart(2,`0`)}`),G=(e,t)=>e<1&&!(t instanceof Pe&&[401,403].includes(t.status));function et(e){let[t,n]=(0,x.useState)(e);return(0,x.useEffect)(()=>{let t=window.setTimeout(()=>n(e),250);return()=>window.clearTimeout(t)},[e]),t}function tt(){let{locale:e,text:t,t:n}=L(),{themeMode:s,cycleTheme:c}=De(),l=i(),[u]=(0,x.useState)(()=>Ve(window.location.search)),[d,f]=(0,x.useState)(!!u.sid),[p,ne]=(0,x.useState)(u.tenant||``),[m,he]=(0,x.useState)(``),[y,Te]=(0,x.useState)(`internal_training`),[b,S]=(0,x.useState)(0),[Ne,C]=(0,x.useState)(u.tenant&&u.sid?N({tenant_id:u.tenant,sid:u.sid}):``),[w,T]=(0,x.useState)(u.taskId||``),[E,D]=(0,x.useState)(null),[Fe,k]=(0,x.useState)(null),[Ie,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(null),[P,Ue]=(0,x.useState)(()=>new Map),[F,We]=(0,x.useState)(``),[I,qe]=(0,x.useState)(!1),[B,V]=(0,x.useState)(null),Je=et(m),H=r({queryKey:[`admin-data`,`identity`],queryFn:({signal:e})=>O.identity({signal:e}),staleTime:3e4,retry:!1}),U=H.data?.role===`admin`,W=H.data?.readonly!==!1,tt=!!Je||d,K=r({queryKey:[`admin-data`,`overview`,y,p,tt?`all-pages`:b],queryFn:async({signal:e})=>{let t=await O.overview({purpose:y,tenant:p,offset:tt?0:b,signal:e}),n=[t],r=new Set([t.offset]);for(;tt&&n[n.length-1].has_more_projects;){let t=n[n.length-1].next_offset;if(t===null||r.has(t))throw Error(`Invalid project pagination`);r.add(t),n.push(await O.overview({purpose:y,tenant:p,offset:t,signal:e}))}return n},enabled:U,retry:G,refetchInterval:!tt&&2e4}),q=(0,x.useMemo)(()=>{let e=K.data;if(!e?.length)return;let t=e[e.length-1];return{...e[0],projects:e.flatMap(e=>e.projects),tasks:e.flatMap(e=>e.tasks),has_more_projects:t.has_more_projects,next_offset:t.next_offset,completeness:{...e[0].completeness,page_truncated:e.some(e=>e.completeness.page_truncated)}}},[K.data]),J=r({queryKey:[`admin-data`,`collector`],queryFn:({signal:e})=>O.collector({signal:e}),enabled:U,retry:G,refetchInterval:15e3}),nt=r({queryKey:[`admin-data`,`audit`],queryFn:({signal:e})=>O.audit({signal:e}),enabled:U&&j===`audit`,retry:G}),rt=q?.projects??[],it=(0,x.useMemo)(()=>[...new Set(rt.map(e=>e.tenant_id))].sort(),[rt]),at=o({queries:it.map(e=>({queryKey:[`admin-data`,`directory`,e],queryFn:({signal:t})=>O.projectDirectory(e,{signal:t}),enabled:U,staleTime:6e4,retry:G}))}),ot=new Map;at.forEach((e,t)=>{for(let n of e.data?.projects??[])n.title&&ot.set(N({tenant_id:it[t],sid:n.id}),n.title)});let st=e=>ot.get(N(e))||Le(e),ct=Je.trim().toLocaleLowerCase(e),lt=rt.filter(t=>!ct||[st(t),t.title,t.tenant_id,t.sid,...(q?.tasks??[]).filter(e=>N(e)===N(t)).flatMap(e=>[Re(e),e.task_id||``])].some(t=>t.toLocaleLowerCase(e).includes(ct))),Y=lt.find(e=>N(e)===Ne)??null,ut=(q?.tasks??[]).filter(e=>Y&&N(e)===N(Y)),dt=ut.filter(e=>e.task_id),ft=ut.find(e=>e.task_id===w)??null;(0,x.useEffect)(()=>{if(!q)return;let e=Ze(lt,Ne,u,d);if(!e)return;C(e.key),k(null),D(null),T(e.taskId);let t=lt.find(t=>N(t)===e.key);t&&xt(t,e.taskId)},[q,Ne,u,d,Je,at.map(e=>e.dataUpdatedAt).join(`,`)]);let pt=[y,Y?.tenant_id,Y?.sid,w||null],X=r({queryKey:[`admin-data`,`detail`,...pt],queryFn:({signal:e})=>O.detail({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,signal:e}),enabled:U&&!!Y?.eligible,retry:G}),Z=ft??(w&&X.data?.task_id===w?X.data:null),mt=!w||!!Z,Q=ee({queryKey:[`admin-data`,`observations`,...pt],queryFn:({pageParam:e,signal:t})=>O.observations({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,cursor:e,limit:200,signal:t}),initialPageParam:null,getNextPageParam:e=>e.pagination.has_more?e.pagination.next_cursor:void 0,enabled:U&&!!Y?.eligible&&mt,retry:G}),ht=(0,x.useMemo)(()=>He(Q.data?.pages??[]),[Q.data]),gt=ht.filter(e=>E===null||Be(e)===E),_t=gt.find(e=>e.episode_id===Fe)??gt[0]??null,vt=new Map;for(let e of w?Z?[Z]:[]:ut)for(let t of e.roles){let e=ze(t.role),n=vt.get(e);vt.set(e,{...t,role:e,observations:(n?.observations||0)+t.observations,episodes:(n?.episodes||0)+t.episodes,tool_pairs:(n?.tool_pairs||0)+t.tool_pairs})}let yt=ht.reduce((e,t)=>e+t.events.length,0),bt=P.size?[...P.values()]:Y?[Y]:[],$=a({mutationFn:()=>{if(W||!bt.length||bt.length>20)throw Error(t(`请选择最多 20 个可导出的项目。`,`Select up to 20 eligible projects.`));return O.exportObservations({purpose:y,projects:bt})},onSuccess:e=>{_e(e.blob,e.filename),We(t(`全部保留过程已下载。`,`All retained process data downloaded.`)),l.invalidateQueries({queryKey:[`admin-data`,`audit`]})}}),xt=(e,t=``)=>{window.history.replaceState(window.history.state,``,Xe(window.location.href,e,t))},St=e=>{f(!1),C(N(e)),T(``),D(null),k(null),A(!1),xt(e)},Ct=e=>{T(e),k(null),D(null),Y&&xt(Y,e)},wt=e=>Ue(t=>{let n=new Map(t),r=N(e);return n.has(r)?n.delete(r):n.size<20&&n.set(r,e),n}),Tt=()=>{l.invalidateQueries({queryKey:[`admin-data`]})},Et=e=>{W||_e(new Blob([JSON.stringify({scope:`loaded_observations`,loaded_event_count:e.events.length,episode:e},null,2)],{type:`application/json`}),`${e.tenant_id}-${e.sid}-process-${e.episode_id}.json`)},Dt=async()=>{if(!(!Y||I)){qe(!0);try{let e=await Qe(Y,()=>O.workspaceIdentity(),e=>window.location.assign(e));V(e.identity.role===`trial`?e.identity.key_id:null),e.matched||M(`workspace`)}catch{V(null),M(`workspace`)}finally{qe(!1)}}},Ot=e=>e instanceof Pe&&e.status===401?t(`数据后台登录已过期,请重新登录。`,`Your administrator session expired. Sign in again.`):e instanceof Error?e.message:t(`暂时无法读取数据。`,`Data is temporarily unavailable.`);return(0,z.jsxs)(de,{className:`admin-data-workspace h-full`,style:{"--sidebar-width":`292px`},children:[Ie?(0,z.jsx)(`button`,{type:`button`,className:`admin-data-scrim lg:hidden`,"aria-label":t(`关闭项目列表`,`Close projects`),onClick:()=>A(!1)}):null,(0,z.jsxs)(fe,{mobileOpen:Ie,className:`admin-data-sidebar`,"aria-label":t(`数据项目`,`Data projects`),children:[(0,z.jsxs)(`div`,{className:`admin-data-sidebar-brand`,children:[(0,z.jsx)(Ee,{size:25}),(0,z.jsx)(g,{children:t(`数据`,`Data`)}),(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button ml-auto lg:hidden`,onClick:()=>A(!1),"aria-label":n(`common.close`),children:(0,z.jsx)(oe,{size:18})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-heading`,children:[(0,z.jsx)(`span`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`span`,{children:q?.total_projects??`—`})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-controls`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`账号`,`Account`)}),(0,z.jsxs)(`select`,{"aria-label":t(`筛选账号`,`Filter account`),value:p,onChange:e=>{f(!1),ne(e.target.value),S(0),T(``)},children:[(0,z.jsx)(`option`,{value:``,children:t(`全部 11 个账号`,`All 11 accounts`)}),$e.map(e=>(0,z.jsx)(`option`,{children:e},e))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-search`,children:[(0,z.jsx)(me,{size:15}),(0,z.jsx)(`input`,{"aria-label":t(`搜索项目、任务或 SID`,`Search projects, tasks or SID`),placeholder:t(`搜索项目或任务…`,`Search projects or tasks…`),value:m,onChange:e=>{f(!1),he(e.target.value),S(0)}})]})]}),(0,z.jsxs)(`div`,{className:`admin-data-projects`,"aria-busy":K.isFetching,children:[K.isPending&&U?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(h,{}),(0,z.jsx)(`p`,{children:t(`正在读取项目…`,`Loading projects…`)})]}):null,K.error?(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`alert`,children:[Ot(K.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void K.refetch(),children:n(`common.retry`)})]}):null,!K.isPending&&!lt.length&&!K.error?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(ke,{size:22}),(0,z.jsx)(`p`,{children:t(`没有符合筛选条件的项目。`,`No projects match these filters.`)})]}):null,lt.map(n=>{let r=N(n)===Ne,i=(q?.tasks??[]).filter(e=>N(e)===N(n)).reduce((e,t)=>e+t.collection.retained_episodes,0);return(0,z.jsxs)(`div`,{"data-testid":`project-${n.tenant_id}-${n.sid}`,className:`admin-data-project ${r?`active`:``}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-project-open`,"aria-current":r?`page`:void 0,onClick:()=>St(n),children:[(0,z.jsx)(`span`,{className:`admin-data-project-title`,children:st(n)}),(0,z.jsxs)(`span`,{className:`admin-data-project-id`,children:[n.tenant_id,` · `,n.sid]}),(0,z.jsx)(`span`,{className:`admin-data-project-meta`,children:n.eligible?i?`${i.toLocaleString(e)} ${t(`段保留过程`,`retained processes`)}`:t(`尚无保留过程`,`No process data retained`):t(`当前用途不可读取`,`Unavailable for this purpose`)})]}),(0,z.jsx)(`input`,{type:`checkbox`,className:`admin-data-project-check`,"aria-label":`${t(`选择导出项目`,`Select project for export`)} ${st(n)} ${n.tenant_id} ${n.sid}`,checked:P.has(N(n)),disabled:W||!n.eligible||P.size>=20&&!P.has(N(n)),onChange:()=>wt(n)})]},N(n))})]}),(0,z.jsxs)(`div`,{className:`admin-data-paging`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!b||K.isFetching,onClick:()=>S(Math.max(0,b-20)),title:t(`上一页项目`,`Previous project page`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[t(`第`,`Page`),` `,Math.floor(b/20)+1,` `,t(`页`,``)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!q?.has_more_projects||K.isFetching,onClick:()=>S(q?.next_offset??b+20),title:t(`下一页项目`,`Next project page`),children:(0,z.jsx)(Oe,{size:14})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-footer`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`audit`),children:[(0,z.jsx)(we,{size:15}),t(`导出记录`,`Export history`)]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`diagnostics`),children:[(0,z.jsx)(Se,{size:15}),t(`采集诊断`,`Capture diagnostics`)]}),(0,z.jsxs)(`a`,{href:`/invite`,children:[(0,z.jsx)(ae,{size:15}),t(`用户工作空间`,`User workspace`)]})]})]}),(0,z.jsxs)(`main`,{className:`admin-data-surface`,children:[(0,z.jsxs)(be,{children:[(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button lg:hidden`,onClick:()=>A(!0),"aria-label":t(`打开项目列表`,`Open projects`),children:(0,z.jsx)(je,{size:18})}),(0,z.jsx)(`span`,{className:`admin-data-header-title`,children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(g,{children:W?t(`只读管理员`,`Read-only administrator`):t(`管理员`,`Administrator`)}),(0,z.jsxs)(`div`,{className:`ml-auto flex items-center gap-1 sm:gap-2`,children:[(0,z.jsx)(ye,{themeMode:s,onCycleTheme:c}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:Tt,disabled:K.isFetching||!U,title:t(`刷新数据`,`Refresh data`),children:K.isFetching?(0,z.jsx)(h,{}):(0,z.jsx)(ie,{size:14})}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!Y?.eligible||$.isPending,onClick:()=>{We(``),M(`export`)},children:[(0,z.jsx)(se,{size:14}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:t(`导出`,`Export`)})]})]})]}),(0,z.jsx)(`div`,{className:`admin-data-content`,children:U?Y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-project-heading`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`p`,{className:`admin-data-eyebrow`,children:[(0,z.jsx)(ke,{size:13}),t(`已授权的过程数据`,`Authorized process data`)]}),(0,z.jsx)(`h1`,{children:st(Y)}),(0,z.jsxs)(`div`,{className:`admin-data-project-identity`,children:[(0,z.jsxs)(`code`,{children:[Y.tenant_id,` / `,Y.sid]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:I,onClick:()=>void Dt(),children:[I?(0,z.jsx)(h,{}):(0,z.jsx)(ae,{size:13}),t(`在用户端打开`,`Open in user workspace`)]}),(0,z.jsx)(le,{text:`${window.location.origin}/admin/data?tenant=${encodeURIComponent(Y.tenant_id)}&sid=${encodeURIComponent(Y.sid)}`,label:t(`复制后台链接`,`Copy data link`),copiedLabel:t(`已复制`,`Copied`)})]})]}),(0,z.jsxs)(`span`,{className:`admin-data-collector-status`,children:[(0,z.jsx)(ge,{ok:J.data?.state===`running`}),J.error?t(`采集状态暂不可读`,`Capture status unavailable`):Ke(J.data?.state,e)]})]}),(0,z.jsxs)(`div`,{className:`admin-data-context-bar`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field flex-1`,children:[(0,z.jsx)(`span`,{children:t(`查看范围`,`View scope`)}),(0,z.jsxs)(`select`,{value:w,onChange:e=>Ct(e.target.value),"aria-label":t(`选择任务或整个项目`,`Select a task or the entire project`),children:[(0,z.jsx)(`option`,{value:``,children:t(`整个项目 · 包含任务创建前的过程`,`Entire project · includes pre-task processes`)}),w&&!dt.some(e=>e.task_id===w)?(0,z.jsxs)(`option`,{value:w,children:[Z?Re(Z):t(`链接中的任务`,`Linked task`),` · `,w]}):null,dt.map(e=>(0,z.jsxs)(`option`,{value:e.task_id,children:[Re(e),` · `,e.task_id]},e.task_id))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`数据用途`,`Data purpose`)}),(0,z.jsxs)(`select`,{value:y,onChange:e=>{Te(e.target.value),Ue(new Map),S(0)},children:[(0,z.jsx)(`option`,{value:`internal_training`,children:t(`内部训练`,`Internal training`)}),(0,z.jsx)(`option`,{value:`external_sharing`,children:t(`对外共享`,`External sharing`)})]})]})]}),Y.eligible?(0,z.jsxs)(z.Fragment,{children:[w&&Z?(0,z.jsxs)(v,{label:t(`任务目标与来源`,`Task objective and source`),children:[(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(pe,{children:Z.objective||Z.request?.text||Z.title})}),(0,z.jsx)(`code`,{children:Z.task_id})]}):null,mt?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-role-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h2`,{children:[(0,z.jsx)(Me,{size:17}),t(`多 Agent 过程`,`Multi-agent processes`)]}),(0,z.jsx)(`p`,{children:t(`查看各角色实际留下的记录。角色缺失、中断和质量验收分别标记。`,`Inspect the records each role actually produced. Missing roles, interruptions and review status are shown separately.`)})]}),(0,z.jsx)(`button`,{type:`button`,className:`admin-data-text-button ${E===null?`active`:``}`,onClick:()=>{D(null),k(null)},children:t(`全部角色`,`All roles`)})]}),(0,z.jsx)(`div`,{className:`admin-data-roles`,children:ue.map(r=>{let i=vt.get(r),a=Math.max(i?.episodes||0,ht.filter(e=>Be(e)===r).length),o=ht.filter(e=>Be(e)===r).length;return(0,z.jsxs)(`button`,{type:`button`,"data-testid":`role-${r}`,className:`admin-data-role ${E===r?`active`:``}`,style:{"--role-color":xe(r)},"aria-pressed":E===r,onClick:()=>{D(r),k(null)},children:[(0,z.jsxs)(`span`,{className:`admin-data-role-label`,children:[(0,z.jsx)(`span`,{className:`admin-data-role-mark`,children:R(r,e).slice(0,1)}),(0,z.jsx)(`strong`,{children:R(r,e)}),(0,z.jsx)(`span`,{children:r})]}),(0,z.jsx)(`span`,{className:`admin-data-role-description`,children:ce(r,n)}),(0,z.jsx)(`span`,{className:`admin-data-role-count`,children:a?`${a.toLocaleString(e)} ${t(`段过程`,`processes`)}`:i?.observations?t(`仅有活动记录`,`Activity records only`):t(`尚未采到记录`,`No records captured`)}),(0,z.jsx)(`span`,{className:`admin-data-role-footnote`,children:o?`${t(`正文已加载`,`Content loaded`)} ${o.toLocaleString(e)}`:t(`按原始记录归属角色`,`Role comes from recorded metadata`)})]},r)})}),vt.get(`unknown`)?.episodes||ht.some(e=>Be(e)===`unknown`)?(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-unknown`,onClick:()=>{D(`unknown`),k(null)},children:[(0,z.jsx)(Ae,{size:14}),t(`另有角色未记录的过程,保留原样查看`,`Some processes have no recorded role. View them as captured.`),` `,(0,z.jsx)(Oe,{size:13})]}):null,(0,z.jsxs)(`div`,{className:`admin-data-record-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{children:E?R(E,e):t(`全部保留过程`,`All retained processes`)}),(0,z.jsxs)(`p`,{children:[ht.length.toLocaleString(e),` `,t(`段已加载`,`processes loaded`),` · `,yt.toLocaleString(e),` `,t(`条原始事件`,`raw events`),` `,Q.hasNextPage?t(`· 还有后续页`,`· more pages available`):``]})]}),gt.length?(0,z.jsx)(`select`,{className:`admin-data-episode-select`,"aria-label":t(`选择过程记录`,`Select a process`),value:_t?.episode_id??``,onChange:e=>k(Number(e.target.value)),children:gt.map(t=>(0,z.jsxs)(`option`,{"data-testid":`episode-${t.episode_id}`,value:t.episode_id,children:[`#`,t.episode_id,` · `,R(t.role,e),` · `,Ge(t.started_at,e)]},t.episode_id))}):null]}),Q.error?(0,z.jsxs)(`div`,{role:`alert`,className:`admin-data-notice`,children:[Ot(Q.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void Q.refetch(),children:n(`common.retry`)})]}):null,_t?(0,z.jsx)(Ye,{episode:_t,readonly:W,onDownload:Et},_t.episode_id):(0,z.jsxs)(`div`,{className:`admin-data-empty admin-data-record-empty`,children:[Q.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(Ae,{size:28}),(0,z.jsx)(`p`,{children:Q.isPending?t(`正在读取真实过程…`,`Loading recorded processes…`):E&&(vt.get(E)?.episodes||0)>0?t(`该角色有记录,当前页尚未加载其正文。`,`This role has recorded processes; their content is on a later page.`):t(`当前范围没有保留的模型过程。项目活动不等同于完整模型轨迹。`,`No model processes are retained in this scope. Project activity does not establish a complete model trace.`)})]}),Q.hasNextPage?(0,z.jsx)(`div`,{className:`admin-data-load-more`,"data-testid":`load-more-observations`,children:(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:Q.isFetchingNextPage,onClick:()=>void Q.fetchNextPage(),children:[Q.isFetchingNextPage?(0,z.jsx)(h,{}):(0,z.jsx)(Oe,{size:14}),t(`加载后续原始记录`,`Load more original records`)]})}):null,X.data?.segments.some(e=>e.source_kind!==`tool_episode`)?(0,z.jsxs)(v,{label:t(`项目活动与任务来源`,`Project activity and task sources`),children:[(0,z.jsx)(`div`,{className:`admin-data-activity`,children:X.data.segments.filter(e=>e.source_kind!==`tool_episode`).map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:R(t.role,e)}),(0,z.jsx)(`span`,{children:t.summary}),(0,z.jsx)(`time`,{children:Ge(t.started_at,e)})]},t.id))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`活动顺序来自记录时间,不表示已证实的 Agent 交接。`,`Activity follows recorded timestamps; it does not establish an agent handoff.`)})]}):null,(0,z.jsxs)(`p`,{className:`admin-data-bottom-note`,children:[(0,z.jsx)(te,{size:14}),t(`过程已采集不代表任务成功,也不代表训练质量已验收。原始记录保留缺失和中断状态。`,`Captured processes do not establish task success or training quality. Missing data and interruptions remain visible.`)]})]}):(0,z.jsx)(`div`,{className:`admin-data-notice`,role:`status`,children:X.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(h,{}),t(`正在核对链接中的任务…`,`Checking the linked task…`)]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{children:[X.error instanceof Pe&&X.error.status===404?t(`链接中的任务 ID 不存在或当前用途下不可读取。这不表示项目没有过程数据。`,`The linked task ID does not exist or is unavailable for this purpose. This does not mean the project has no process data.`):t(`暂时无法核对该任务,请重试或查看整个项目。`,`This task could not be verified. Retry or view the entire project.`),` `,(0,z.jsx)(`code`,{children:w})]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>Ct(``),children:t(`查看整个项目`,`View entire project`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void X.refetch(),children:n(`common.retry`)})]})})]}):(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`status`,children:[t(`当前用途下没有可读取的授权记录。请选择其他项目或数据用途。`,`No authorized records are available for this purpose. Choose another project or purpose.`),(0,z.jsx)(v,{children:(0,z.jsx)(`pre`,{children:Y.reason})})]})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(ke,{size:32}),(0,z.jsx)(`h1`,{children:d&&u.sid?t(`链接中的项目未找到`,`Linked project not found`):t(`选择一个项目`,`Select a project`)}),(0,z.jsx)(`p`,{children:d&&u.sid?t(`当前账号与用途下找不到此 SID,没有替你打开其他项目。请检查链接或选择左侧项目。`,`This SID is not available for the selected account and purpose. Check the link or choose a project from the list.`):t(`从左侧查看各账号的真实过程数据。`,`Choose a project to inspect its recorded processes.`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>A(!0),children:t(`浏览项目`,`Browse projects`)})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(Ee,{size:38}),(0,z.jsx)(`h1`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`p`,{children:H.error?Ot(H.error):t(`正在验证管理员身份…`,`Checking administrator access…`)}),H.error?(0,z.jsx)(`a`,{className:`brand-button brand-button-primary`,href:`/admin/login`,children:t(`管理员登录`,`Administrator sign in`)}):(0,z.jsx)(h,{})]})})]}),(0,z.jsx)(ve,{open:j===`workspace`,onClose:()=>M(null),label:t(`打开用户工作空间`,`Open user workspace`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`需要对应的用户账号`,`Use the matching user account`)}),(0,z.jsxs)(`p`,{children:[t(`这个项目属于`,`This project belongs to`),` `,(0,z.jsx)(`strong`,{children:Y?.tenant_id}),t(`。`,`. `),B?(0,z.jsxs)(z.Fragment,{children:[t(`当前用户端账号是`,`Your current user account is`),` `,(0,z.jsx)(`strong`,{children:B}),t(`。`,`. `)]}):t(`你尚未登录用户工作空间。`,`You are not signed in to a user workspace.`)]}),(0,z.jsx)(`p`,{children:t(`请在用户端使用对应邀请码登录,再打开这个项目。管理员登录不会切换用户账号。`,`Sign in to the user workspace with the matching invitation before opening this project. Administrator access does not switch your user account.`)}),(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(`a`,{className:`brand-button brand-button-primary inline-flex items-center gap-2`,href:`/invite`,target:`_blank`,rel:`noopener`,children:[t(`打开用户登录入口`,`Open user sign in`),(0,z.jsx)(ae,{size:14})]})]})]})}),(0,z.jsx)(ve,{open:j===`export`,onClose:()=>M(null),label:t(`导出全部保留过程`,`Export all retained processes`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出全部保留过程`,`Export all retained processes`)}),(0,z.jsx)(`p`,{children:t(`ZIP 包含所选项目的全部已保留输入、输出和工具轨迹,包括未验收、未结束和失败的记录。`,`The ZIP includes all retained inputs, outputs and tool traces for these projects, including unreviewed, unfinished and failed records.`)}),(0,z.jsx)(`ul`,{className:`admin-data-export-projects`,children:bt.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(re,{size:14}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:st(e)}),(0,z.jsxs)(`code`,{children:[e.tenant_id,` / `,e.sid]})]})]},N(e)))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`可在项目列表勾选多个项目;一次最多 20 个。`,`Use project checkboxes to select up to 20 projects per export.`)}),W?(0,z.jsx)(`p`,{role:`status`,children:t(`只读管理员不能导出数据。`,`Read-only administrators cannot export data.`)}):null,$.error?(0,z.jsx)(`p`,{role:`alert`,className:`admin-data-notice`,children:Ot($.error)}):null,F?(0,z.jsx)(`p`,{role:`status`,children:F}):null,(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!bt.length||$.isPending,onClick:()=>$.mutate(),children:[$.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(se,{size:14}),t(`下载 ZIP`,`Download ZIP`)]})]})]})}),(0,z.jsx)(ve,{open:j===`audit`,onClose:()=>M(null),label:t(`导出记录`,`Export history`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出记录`,`Export history`)}),(0,z.jsx)(`p`,{children:t(`服务器记录的导出范围、操作身份与结果。`,`Server-recorded export scope, operator and outcome.`)}),nt.isPending?(0,z.jsx)(h,{}):nt.error?(0,z.jsx)(`p`,{role:`alert`,children:Ot(nt.error)}):nt.data?.events.length?(0,z.jsx)(`div`,{className:`admin-data-table-wrap`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:t(`时间`,`Time`)}),(0,z.jsx)(`th`,{children:t(`操作`,`Action`)}),(0,z.jsx)(`th`,{children:t(`身份 / 用途`,`Actor / purpose`)}),(0,z.jsx)(`th`,{children:t(`结果`,`Outcome`)})]})}),(0,z.jsx)(`tbody`,{children:nt.data.events.map(n=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:Ge(n.created_at,e)}),(0,z.jsxs)(`td`,{children:[n.action,(0,z.jsxs)(`small`,{children:[n.projects??`—`,` `,t(`个项目`,`projects`)]})]}),(0,z.jsxs)(`td`,{children:[n.actor,(0,z.jsx)(`small`,{children:n.purpose===`external_sharing`?t(`对外共享`,`External sharing`):t(`内部训练`,`Internal training`)})]}),(0,z.jsx)(`td`,{children:n.outcome})]},n.id))})]})}):(0,z.jsx)(`p`,{children:t(`尚无导出记录。`,`No export history yet.`)})]})}),(0,z.jsx)(ve,{open:j===`diagnostics`,onClose:()=>M(null),label:t(`采集诊断`,`Capture diagnostics`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`采集诊断`,`Capture diagnostics`)}),(0,z.jsx)(`p`,{children:J.error?Ot(J.error):Ke(J.data?.state,e)}),(0,z.jsx)(`div`,{className:`admin-data-diagnostics`,children:Object.entries(J.data?.tool_capture?.tenants??{}).map(([n,r])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:Ke(r.state,e)}),(0,z.jsxs)(`span`,{children:[r.counts.events_received??0,` `,t(`条接收事件`,`events received`)]}),r.last_error_code?(0,z.jsx)(`code`,{children:r.last_error_code}):null]},n))}),(0,z.jsx)(v,{label:t(`完整诊断数据`,`Full diagnostic data`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:JSON.stringify({collector:J.data,project:Y,collection:X.data?.collection,gaps:X.data?.gaps,completeness:q?.completeness},null,2)})})]})})]})}export{tt as default,_e as saveDownload}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AdminDataApp-sFLn0VsP.js b/frontend/web/dist/assets/AdminDataApp-sFLn0VsP.js new file mode 100644 index 000000000..48e17b523 --- /dev/null +++ b/frontend/web/dist/assets/AdminDataApp-sFLn0VsP.js @@ -0,0 +1,13 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,c as i,n as a,o,t as ee}from"./query-dCPZk0Xc.js";import{D as s,G as c,K as l,O as u,V as d}from"./index-Dkv2HM-n.js";import{A as te,C as f,E as p,F as ne,I as re,L as m,M as ie,N as ae,O as oe,P as se,S as ce,_ as le,b as ue,c as h,d as de,f as fe,g as pe,i as g,j as me,k as he,l as ge,n as _e,p as ve,r as _,s as v,t as ye,u as be,w as y,x as xe}from"./AppearanceControls-DpaE5wy6.js";import{t as Se}from"./activity-BmXzrCrJ.js";import{n as Ce,t as we}from"./history-BylQ-TOW.js";import{t as Te}from"./code-xml-xZvprTy7.js";import{r as Ee,t as De}from"./useWorkbenchTheme-DMn1yhZa.js";var Oe=m(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ke=m(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ae=m(`FileJson`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),je=m(`Menu`,[[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}],[`line`,{x1:`4`,x2:`20`,y1:`6`,y2:`6`,key:`1owob3`}],[`line`,{x1:`4`,x2:`20`,y1:`18`,y2:`18`,key:`yk5zj1`}]]),b=m(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Me=m(`Users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),x=e(n(),1),S=6e4,Ne=12e4,Pe=class extends c{loginURL;constructor(e){super(e.status===401?`数据后台登录已过期,请重新登录。`:e.message,e.status,e.method,e.path,e.status===401?`admin_authentication_required`:e.code),this.name=`AdminAPIError`,this.loginURL=e.status===401?`/admin/login`:null}};function C(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function w(e,t){return`/admin/api/training/${e}/${encodeURIComponent(t.tenant)}/${encodeURIComponent(t.sid)}`}async function T(e,t,n){try{await l(e,t,n)}catch(e){throw e instanceof c&&n.startsWith(`/admin/`)?new Pe(e):e}}function E(e,t=`GET`){return new Pe(new c(`数据后台响应格式不正确。`,502,t,e,`invalid_admin_response`))}async function D(e,t={}){return d(e,{method:`GET`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{Accept:`application/json`},signal:t.signal},S,async t=>{await T(t,`GET`,e);try{return await t.json()}catch{throw E(e)}})}function Fe(e){let t=e?.match(/(?:^|;)\s*filename\*=UTF-8''([^;]+)/i)?.[1],n=e?.match(/(?:^|;)\s*filename\s*=\s*(?:"([^"]*)"|([^;]+))/i),r=n?.[1]??n?.[2]?.trim()??``;if(t)try{r=decodeURIComponent(t.trim())}catch{}return r.length>0&&r.length<=180&&/\.zip$/i.test(r)&&!/[\x00-\x1f\x7f/\\:]/.test(r)&&!r.startsWith(`.`)?r:`argus-observations.zip`}var O={overview(e={}){return D(`/admin/api/training/collaboration`+C({purpose:e.purpose??`internal_training`,offset:e.offset??0,tenant:e.tenant,query:e.query}),e)},detail(e){return D(w(`collaboration`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId}),e)},observations(e){return D(w(`observations`,e)+C({purpose:e.purpose??`internal_training`,task_id:e.taskId,cursor:e.cursor,limit:e.limit}),e)},async identity(e={}){let t=`/admin/status`,n=await D(t,e);if(n?.role!==`admin`||typeof n.readonly!=`boolean`)throw E(t);return n},async workspaceIdentity(e={}){let t=`/invite/status`,n=await D(t,e);if(typeof n?.key_id!=`string`||typeof n.role!=`string`||typeof n.readonly!=`boolean`)throw E(t);return{key_id:n.key_id,role:n.role,readonly:n.readonly}},collector(e={}){return D(`/admin/api/research/status`,e)},projectDirectory(e,t={}){return D(`/admin/api/tenants/${encodeURIComponent(e)}/projects`,t)},audit(e={}){return D(`/admin/api/training/audit`+C({limit:e.limit}),e)},exportObservations(e,t={}){let n=`/admin/api/training/export-observations`;return d(n,{method:`POST`,credentials:`same-origin`,cache:`no-store`,redirect:`error`,headers:{"Content-Type":`application/json`,Accept:`application/zip`},body:JSON.stringify({purpose:e.purpose,projects:e.projects.map(({tenant_id:e,sid:t})=>({tenant_id:e,sid:t}))}),signal:t.signal},Ne,async e=>{if(await T(e,`POST`,n),e.headers.get(`Content-Type`)?.split(`;`)[0].trim().toLowerCase()!==`application/zip`)throw E(n,`POST`);return{blob:await e.blob(),filename:Fe(e.headers.get(`Content-Disposition`))}})}},k=new Set([`thinking`,`analysis`,`reasoning`,`redacted_thinking`,`signature`]),Ie=RegExp(`^(${ue.join(`|`)})(?:[.-][a-z0-9_.-]+)?$`);function A(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function j(e){return typeof e==`string`?e:``}function M(e){return e==null?``:JSON.stringify(e,null,2)}function N(e){return JSON.stringify([e.tenant_id,e.sid])}function Le(e){return e.title?.trim()||e.sid||`未命名项目`}function Re(e){return(e.mission_title||e.title)?.trim().replace(/^#+\s*/,``).split(` +`)[0]||(e.task_id?`任务 ${e.task_id}`:`项目活动`)}function ze(e){return typeof e==`string`?e===`operator`||e===`unknown`?e:e.match(Ie)?.[1]??`unknown`:`unknown`}function Be(e){return typeof e.role==`string`?ze(e.role):ze(e.runtime?.run_label)}function Ve(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{tenant:t.get(`tenant`),sid:t.get(`sid`),taskId:t.get(`task_id`)??t.get(`task`)}}function He(e){let t=e[0];if(!t)return[];let n=JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id]),r=new Map,i=new Map;for(let t of e){if(JSON.stringify([t.tenant_id,t.sid,t.purpose,t.task_id])!==n)throw Error(`Cannot merge observations from different project, purpose, or task scopes.`);for(let e of t.episodes){if(N(e)!==N(t)||t.task_id!==null&&e.task_id!==t.task_id)throw Error(`Observation episode does not match its page scope.`);let n=r.get(e.episode_id);if(n&&n.task_id!==e.task_id)throw Error(`Observation episode changed task association.`);let a=i.get(e.episode_id)??new Map;for(let t of e.events){if(!Number.isSafeInteger(t.sequence)||t.sequence<0)throw Error(`Observation sequence is invalid.`);a.set(t.sequence,t)}i.set(e.episode_id,a),r.set(e.episode_id,{...e,events:[]})}}return[...r.values()].sort((e,t)=>e.episode_id-t.episode_id).map(e=>({...e,events:[...i.get(e.episode_id).values()].sort((e,t)=>e.sequence-t.sequence)}))}function P(e){return[e.type,e.role,e.channel].some(e=>typeof e==`string`&&k.has(e))}function Ue(e){return Array.isArray(e)?e.map(e=>{let t=A(e),n=A(t?.function);return!t||!n?``:[j(n.name),typeof n.arguments==`string`?n.arguments:M(n.arguments)].filter(Boolean).join(` +`)}).filter(Boolean).join(` + +`):``}function F(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(F).filter(Boolean).join(` +`);let t=A(e);return!t||P(t)?``:t.type===`text`||t.type===`input_text`||t.type===`output_text`?j(t.text):t.type===`toolCall`||t.type===`tool_call`?[j(t.name),typeof t.arguments==`string`?t.arguments:M(t.arguments)].filter(Boolean).join(` +`):`content`in t||`tool_calls`in t?[F(t.content),Ue(t.tool_calls)].filter(Boolean).join(` + +`):``}function We(e){if(!Array.isArray(e))return``;let t={system:`系统`,developer:`开发者`,user:`用户`,assistant:`模型`,toolResult:`工具返回`,tool:`工具返回`};return e.map(e=>{let n=A(e);if(!n||P(n))return``;let r=[F(n.content),Ue(n.tool_calls)].filter(Boolean).join(` + +`);return r?`${t[j(n.role)]||j(n.role)||`消息`}\n${r}`:``}).filter(Boolean).join(` + +`)}function I(e){let t=e.payload,[n,r]={context:[`模型输入`,`input`],provider_request:[`模型请求`,`input`],message_delta:[`模型公开输出片段`,`output`],message_end:[`模型消息`,`output`],session_message:[`历史会话消息`,`output`],agent_end:[`模型输出`,`output`],tool_call:[`工具调用`,`tool`],tool_result:[`工具返回`,`tool`],tool_execution_start:[`工具执行开始`,`tool`],tool_execution_update:[`工具执行进度`,`tool`],tool_execution_end:[`工具执行结束`,`tool`],settled:[`本段过程结束`,`status`],quarantine:[`过程状态记录`,`status`],capture_warning:[`采集提示`,`status`]}[e.kind]??[`过程事件 · ${e.kind}`,`other`],i=``;e.kind===`message_delta`?i=t.type===`text_delta`||t.type===`toolcall_delta`?j(t.delta):``:[`context`,`provider_request`,`message_end`,`session_message`,`agent_end`].includes(e.kind)?i=We(t.messages):e.kind===`tool_call`?i=M(t.input):e.kind===`tool_result`?i=F(t.content):e.kind===`tool_execution_start`?i=M(t.args):e.kind===`tool_execution_update`?i=F(t.partialResult):e.kind===`tool_execution_end`?i=F(t.result):(e.kind===`quarantine`||e.kind===`capture_warning`)&&(i=j(t.reason));let a=e.kind===`tool_result`||e.kind===`tool_execution_end`;return{key:e.id??String(e.sequence),kind:e.kind,title:n,category:r,text:i,toolName:j(t.toolName)||null,toolCallId:j(t.toolCallId)||null,result:a?t.isError===!0?`error`:t.isError===!1?`success`:`unknown`:null,timestamp:typeof e.observed_at==`number`&&Number.isFinite(e.observed_at)?e.observed_at:null}}function L(){let{locale:e,t,setLocale:n}=u();return{locale:e,t,setLocale:n,text:(t,n)=>e===`zh-CN`?t:n}}function Ge(e,t){return typeof e==`number`&&Number.isFinite(e)?new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(e*1e3):`—`}function R(e,t){return y(e)?f(e,e=>s(e,{},t)):{operator:[`用户`,`User`],unknown:[`角色未记录`,`Unassigned role`],system:[`系统`,`System`],developer:[`运行指令`,`Instructions`],user:[`用户 / 任务`,`User / task`],assistant:[`模型`,`Assistant`],tool:[`工具`,`Tool`]}[e]?.[t===`zh-CN`?0:1]??e}function Ke(e,t){return{complete:[`调用已结束`,`Call ended`],capturing:[`尚无结束记录`,`No end record yet`],interrupted:[`采集中断`,`Capture interrupted`],quarantined:[`需检查记录`,`Record needs attention`],approved:[`已验收`,`Reviewed`],not_approved:[`未验收`,`Not reviewed`],unknown:[`结果未确认`,`Outcome unconfirmed`],running:[`采集正常`,`Collector running`],storage_error:[`存储异常`,`Storage unavailable`],starting:[`正在启动`,`Starting`],listening:[`已连接`,`Listening`],unavailable:[`暂不可用`,`Unavailable`]}[e||`unknown`]?.[t===`zh-CN`?0:1]??e??`—`}function qe(e,t){return{context:[`Agent 上下文`,`Agent context`],provider_request:[`模型实际输入`,`Model request`],message_end:[`公开消息`,`Public message`],agent_end:[`调用结果`,`Call output`],message_delta:[`公开输出增量`,`Public output increments`],tool_call:[`工具调用`,`Tool call`],tool_result:[`工具结果`,`Tool result`],tool_execution_start:[`工具开始执行`,`Tool execution started`],tool_execution_update:[`工具执行更新`,`Tool execution update`],tool_execution_end:[`工具执行结束`,`Tool execution ended`],settled:[`采集已收尾`,`Capture settled`],quarantine:[`记录不完整`,`Incomplete record`],capture_warning:[`采集提示`,`Capture notice`]}[e]?.[t===`zh-CN`?0:1]??e}var z=t(),B=e=>JSON.stringify(e,null,2);function V({value:e}){let{text:t}=L();return(0,z.jsxs)(v,{label:t(`原始 JSON`,`Raw JSON`),children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(le,{text:B(e),label:t(`复制 JSON`,`Copy JSON`),copiedLabel:t(`已复制`,`Copied`)})}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(e)})]})}function Je({message:e,index:t}){let{locale:n,text:r}=L(),[i,a]=(0,x.useState)(!1),o=F(e);return(0,z.jsxs)(`details`,{className:`admin-data-message`,onToggle:e=>a(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:String(t+1).padStart(2,`0`)}),(0,z.jsx)(`strong`,{children:R(e.role||`unknown`,n)}),(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[o.length.toLocaleString(n),` `,r(`字符`,`characters`)]}),(0,z.jsx)(ne,{size:13})]}),i?(0,z.jsxs)(`div`,{className:`admin-data-message-body`,children:[o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(le,{text:o,label:r(`复制内容`,`Copy text`),copiedLabel:r(`已复制`,`Copied`)}),(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(pe,{children:o})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:r(`这条消息没有公开文本;结构见下方。`,`This message has no public text; its structure is below.`)}),(0,z.jsx)(V,{value:e})]}):null]})}function H({event:e}){let{locale:t,text:n}=L(),r=I(e),i=e.payload,a=Array.isArray(i.messages)?i.messages:[];return(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[e.kind===`provider_request`?(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[typeof i.model==`string`?(0,z.jsx)(g,{children:i.model}):null,typeof i.reasoning_effort==`string`?(0,z.jsx)(g,{children:i.reasoning_effort}):null,(0,z.jsxs)(`span`,{children:[a.length.toLocaleString(t),` `,n(`条消息`,`messages`),` · `,(i.tools?.length||0).toLocaleString(t),` `,n(`个工具定义`,`tool definitions`)]})]}):null,a.length?(0,z.jsx)(`div`,{className:`admin-data-message-list`,children:a.map((e,t)=>(0,z.jsx)(Je,{message:e,index:t},t))}):r.text?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`admin-data-raw-actions`,children:(0,z.jsx)(le,{text:r.text,label:n(`复制内容`,`Copy text`),copiedLabel:n(`已复制`,`Copied`)})}),r.category===`tool`||e.kind===`message_delta`?(0,z.jsx)(`pre`,{className:`admin-data-code`,children:r.text}):(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(pe,{children:r.text})})]}):(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:n(`此事件保留了状态和结构,没有公开文本。`,`This event contains status and structure, with no public text.`)}),i.tools?.length?(0,z.jsx)(v,{label:n(`工具定义`,`Tool definitions`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:B(i.tools)})}):null,(0,z.jsx)(V,{value:e})]})}function U(e){let t=[];for(let n of e){let e=n.kind===`message_delta`?JSON.stringify([n.kind,n.payload.type,n.payload.message_index,n.payload.content_index,n.payload.toolCallId]):`event:${n.sequence}`,r=t[t.length-1];n.kind===`message_delta`&&r?.key===e?r.events.push(n):t.push({key:e,events:[n]})}return t}function W({group:e}){let{locale:t,text:n}=L(),[r,i]=(0,x.useState)(!1),a=e.events[0],o=I(a),ee=o.category===`tool`?he:o.category===`input`?Te:b,s=e.events.length>1,c=s?e.events.map(e=>I(e).text).join(``):o.text,l=a.kind===`provider_request`?`${a.payload.messages?.length??0} ${n(`条消息`,`messages`)} · ${a.payload.tools?.length??0} ${n(`个工具`,`tools`)}`:(a.payload.messages?F(a.payload.messages):c).replace(/\s+/g,` `).slice(0,110);return(0,z.jsxs)(`details`,{className:`admin-data-event`,"data-event-kind":a.kind,onToggle:e=>i(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{className:`admin-data-event-icon`,children:(0,z.jsx)(ee,{size:15})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`admin-data-event-title`,children:[(0,z.jsxs)(`strong`,{children:[qe(a.kind,t),o.toolName?` · ${o.toolName}`:``]}),s?(0,z.jsxs)(g,{children:[e.events.length,` `,n(`条增量`,`increments`)]}):null,o.result===`error`?(0,z.jsx)(g,{color:p.error,children:n(`工具报告错误`,`Tool reported an error`)}):null,o.result===`success`?(0,z.jsx)(g,{color:p.success,children:n(`工具报告成功`,`Tool reported success`)}):null]}),l?(0,z.jsx)(`p`,{className:`admin-data-event-preview`,children:l}):null]}),(0,z.jsx)(`span`,{className:`admin-data-event-time`,children:Ge(a.observed_at,t)}),(0,z.jsx)(ne,{size:14})]}),r?s?(0,z.jsxs)(`div`,{className:`admin-data-event-body`,children:[(0,z.jsx)(le,{text:c,label:n(`复制输出`,`Copy output`),copiedLabel:n(`已复制`,`Copied`)}),(0,z.jsx)(`pre`,{className:`admin-data-code`,children:c}),(0,z.jsx)(V,{value:e.events})]}):(0,z.jsx)(H,{event:a}):null]})}function Ye({episode:e,readonly:t,onDownload:n}){let{locale:r,text:i}=L(),[a,o]=(0,x.useState)(`all`),[ee,s]=(0,x.useState)(0),c=(0,x.useMemo)(()=>U(e.events.filter(e=>{let t=I(e).category;return a===`all`||(a===`tools`?t===`tool`:t===`input`||t===`output`)})),[e.events,a]);(0,x.useEffect)(()=>s(0),[e.episode_id,a]);let l=Math.max(1,Math.ceil(c.length/60)),u=Math.min(ee,l-1),d=c.slice(u*60,u*60+60),te=e.events.length,f=e.collection.event_count,ne=e.quality.approved===!0&&e.quality.state===`approved`;return(0,z.jsxs)(`section`,{className:`admin-data-inspector`,"aria-label":i(`过程详情`,`Process details`),children:[(0,z.jsxs)(`div`,{className:`admin-data-section-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h3`,{children:[R(e.role,r),` `,(0,z.jsxs)(`span`,{className:`admin-data-subtle`,children:[`· #`,e.episode_id]})]}),(0,z.jsxs)(`p`,{children:[Ge(e.started_at,r),` · `,e.task_id?`${i(`任务`,`Task`)} ${e.task_id}`:i(`项目级 / 未关联任务`,`Project-level / no task association`)]})]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:t,onClick:()=>n(e),title:t?i(`只读会话不能导出`,`Exports are disabled for read-only sessions`):i(`下载当前已加载的原始记录`,`Download the raw records currently loaded`),children:[(0,z.jsx)(se,{size:14}),` JSON`]})]}),(0,z.jsxs)(`div`,{className:`admin-data-inline-meta`,children:[(0,z.jsx)(g,{children:Ke(e.state,r)}),(0,z.jsx)(g,{color:ne?p.success:void 0,children:ne?i(`已验收`,`Reviewed`):i(`未验收`,`Not reviewed`)}),(0,z.jsxs)(`span`,{children:[i(`已加载`,`Loaded`),` `,te.toLocaleString(r),` / `,f.toLocaleString(r),` `,i(`条事件`,`events`)]}),e.runtime.run_label?(0,z.jsx)(`code`,{children:e.runtime.run_label}):null]}),!e.collection.complete||e.collection.historical_data_unavailable||te(0,z.jsx)(`button`,{type:`button`,"aria-pressed":a===e,className:a===e?`active`:``,onClick:()=>o(e),children:e===`all`?i(`全部事件`,`All events`):e===`messages`?i(`模型输入 / 输出`,`Model input / output`):i(`工具轨迹`,`Tool trace`)},e))}),c.length?(0,z.jsx)(`div`,{className:`admin-data-timeline`,children:d.map(t=>(0,z.jsx)(W,{group:t},`${e.episode_id}:${t.events[0].sequence}`))}):(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(Ae,{size:24}),(0,z.jsx)(`p`,{children:i(`当前已加载的记录中没有此类事件。`,`No events of this type are present in the loaded records.`)})]}),c.length>60?(0,z.jsxs)(`div`,{className:`admin-data-paging`,"aria-label":i(`当前过程的事件分页`,`Event pages for this process`),children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!u,onClick:()=>s(u-1),title:i(`上一段事件`,`Previous event group`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[u*60+1,`–`,Math.min(c.length,u*60+60),` / `,c.length.toLocaleString(r),` `,i(`组事件`,`event groups`)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:u+1>=l,onClick:()=>s(u+1),title:i(`下一段事件`,`Next event group`),children:(0,z.jsx)(Oe,{size:14})})]}):null,(0,z.jsx)(V,{value:{...e,events:void 0,loaded_event_count:te}})]})}function Xe(e,t,n=``){let r=new URL(e);return r.searchParams.set(`tenant`,t.tenant_id),r.searchParams.set(`sid`,t.sid),n?r.searchParams.set(`task_id`,n):r.searchParams.delete(`task_id`),r.searchParams.delete(`task`),`${r.pathname}${r.search}${r.hash}`}function Ze(e,t,n,r){if(e.some(e=>N(e)===t))return null;let i=r&&n.sid?e.filter(e=>e.sid===n.sid&&(!n.tenant||e.tenant_id===n.tenant)):[],a=i.length===1?i[0]:void 0;if(r&&n.sid&&!a)return null;let o=a??e[0];return{key:o?N(o):``,taskId:a&&n.taskId||``}}async function Qe(e,t,n){let r=await t(),i=r.role===`trial`&&r.key_id===e.tenant_id;return i&&n(`/?project=${encodeURIComponent(e.sid)}`),{matched:i,identity:r}}var $e=Array.from({length:11},(e,t)=>`trial-${String(t+1).padStart(2,`0`)}`),G=(e,t)=>e<1&&!(t instanceof Pe&&[401,403].includes(t.status));function et(e){let[t,n]=(0,x.useState)(e);return(0,x.useEffect)(()=>{let t=window.setTimeout(()=>n(e),250);return()=>window.clearTimeout(t)},[e]),t}function tt(){let{locale:e,text:t,t:n}=L(),{themeMode:s,cycleTheme:c}=De(),l=i(),[u]=(0,x.useState)(()=>Ve(window.location.search)),[d,f]=(0,x.useState)(!!u.sid),[p,ne]=(0,x.useState)(u.tenant||``),[m,he]=(0,x.useState)(``),[y,Te]=(0,x.useState)(`internal_training`),[b,S]=(0,x.useState)(0),[Ne,C]=(0,x.useState)(u.tenant&&u.sid?N({tenant_id:u.tenant,sid:u.sid}):``),[w,T]=(0,x.useState)(u.taskId||``),[E,D]=(0,x.useState)(null),[Fe,k]=(0,x.useState)(null),[Ie,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(null),[P,Ue]=(0,x.useState)(()=>new Map),[F,We]=(0,x.useState)(``),[I,qe]=(0,x.useState)(!1),[B,V]=(0,x.useState)(null),Je=et(m),H=r({queryKey:[`admin-data`,`identity`],queryFn:({signal:e})=>O.identity({signal:e}),staleTime:3e4,retry:!1}),U=H.data?.role===`admin`,W=H.data?.readonly!==!1,tt=!!Je||d,K=r({queryKey:[`admin-data`,`overview`,y,p,tt?`all-pages`:b],queryFn:async({signal:e})=>{let t=await O.overview({purpose:y,tenant:p,offset:tt?0:b,signal:e}),n=[t],r=new Set([t.offset]);for(;tt&&n[n.length-1].has_more_projects;){let t=n[n.length-1].next_offset;if(t===null||r.has(t))throw Error(`Invalid project pagination`);r.add(t),n.push(await O.overview({purpose:y,tenant:p,offset:t,signal:e}))}return n},enabled:U,retry:G,refetchInterval:!tt&&2e4}),q=(0,x.useMemo)(()=>{let e=K.data;if(!e?.length)return;let t=e[e.length-1];return{...e[0],projects:e.flatMap(e=>e.projects),tasks:e.flatMap(e=>e.tasks),has_more_projects:t.has_more_projects,next_offset:t.next_offset,completeness:{...e[0].completeness,page_truncated:e.some(e=>e.completeness.page_truncated)}}},[K.data]),J=r({queryKey:[`admin-data`,`collector`],queryFn:({signal:e})=>O.collector({signal:e}),enabled:U,retry:G,refetchInterval:15e3}),nt=r({queryKey:[`admin-data`,`audit`],queryFn:({signal:e})=>O.audit({signal:e}),enabled:U&&j===`audit`,retry:G}),rt=q?.projects??[],it=(0,x.useMemo)(()=>[...new Set(rt.map(e=>e.tenant_id))].sort(),[rt]),at=o({queries:it.map(e=>({queryKey:[`admin-data`,`directory`,e],queryFn:({signal:t})=>O.projectDirectory(e,{signal:t}),enabled:U,staleTime:6e4,retry:G}))}),ot=new Map;at.forEach((e,t)=>{for(let n of e.data?.projects??[])n.title&&ot.set(N({tenant_id:it[t],sid:n.id}),n.title)});let st=e=>ot.get(N(e))||Le(e),ct=Je.trim().toLocaleLowerCase(e),lt=rt.filter(t=>!ct||[st(t),t.title,t.tenant_id,t.sid,...(q?.tasks??[]).filter(e=>N(e)===N(t)).flatMap(e=>[Re(e),e.task_id||``])].some(t=>t.toLocaleLowerCase(e).includes(ct))),Y=lt.find(e=>N(e)===Ne)??null,ut=(q?.tasks??[]).filter(e=>Y&&N(e)===N(Y)),dt=ut.filter(e=>e.task_id),ft=ut.find(e=>e.task_id===w)??null;(0,x.useEffect)(()=>{if(!q)return;let e=Ze(lt,Ne,u,d);if(!e)return;C(e.key),k(null),D(null),T(e.taskId);let t=lt.find(t=>N(t)===e.key);t&&xt(t,e.taskId)},[q,Ne,u,d,Je,at.map(e=>e.dataUpdatedAt).join(`,`)]);let pt=[y,Y?.tenant_id,Y?.sid,w||null],X=r({queryKey:[`admin-data`,`detail`,...pt],queryFn:({signal:e})=>O.detail({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,signal:e}),enabled:U&&!!Y?.eligible,retry:G}),Z=ft??(w&&X.data?.task_id===w?X.data:null),mt=!w||!!Z,Q=ee({queryKey:[`admin-data`,`observations`,...pt],queryFn:({pageParam:e,signal:t})=>O.observations({purpose:y,tenant:Y.tenant_id,sid:Y.sid,taskId:w||null,cursor:e,limit:200,signal:t}),initialPageParam:null,getNextPageParam:e=>e.pagination.has_more?e.pagination.next_cursor:void 0,enabled:U&&!!Y?.eligible&&mt,retry:G}),ht=(0,x.useMemo)(()=>He(Q.data?.pages??[]),[Q.data]),gt=ht.filter(e=>E===null||Be(e)===E),_t=gt.find(e=>e.episode_id===Fe)??gt[0]??null,vt=new Map;for(let e of w?Z?[Z]:[]:ut)for(let t of e.roles){let e=ze(t.role),n=vt.get(e);vt.set(e,{...t,role:e,observations:(n?.observations||0)+t.observations,episodes:(n?.episodes||0)+t.episodes,tool_pairs:(n?.tool_pairs||0)+t.tool_pairs})}let yt=ht.reduce((e,t)=>e+t.events.length,0),bt=P.size?[...P.values()]:Y?[Y]:[],$=a({mutationFn:()=>{if(W||!bt.length||bt.length>20)throw Error(t(`请选择最多 20 个可导出的项目。`,`Select up to 20 eligible projects.`));return O.exportObservations({purpose:y,projects:bt})},onSuccess:e=>{_e(e.blob,e.filename),We(t(`全部保留过程已下载。`,`All retained process data downloaded.`)),l.invalidateQueries({queryKey:[`admin-data`,`audit`]})}}),xt=(e,t=``)=>{window.history.replaceState(window.history.state,``,Xe(window.location.href,e,t))},St=e=>{f(!1),C(N(e)),T(``),D(null),k(null),A(!1),xt(e)},Ct=e=>{T(e),k(null),D(null),Y&&xt(Y,e)},wt=e=>Ue(t=>{let n=new Map(t),r=N(e);return n.has(r)?n.delete(r):n.size<20&&n.set(r,e),n}),Tt=()=>{l.invalidateQueries({queryKey:[`admin-data`]})},Et=e=>{W||_e(new Blob([JSON.stringify({scope:`loaded_observations`,loaded_event_count:e.events.length,episode:e},null,2)],{type:`application/json`}),`${e.tenant_id}-${e.sid}-process-${e.episode_id}.json`)},Dt=async()=>{if(!(!Y||I)){qe(!0);try{let e=await Qe(Y,()=>O.workspaceIdentity(),e=>window.location.assign(e));V(e.identity.role===`trial`?e.identity.key_id:null),e.matched||M(`workspace`)}catch{V(null),M(`workspace`)}finally{qe(!1)}}},Ot=e=>e instanceof Pe&&e.status===401?t(`数据后台登录已过期,请重新登录。`,`Your administrator session expired. Sign in again.`):e instanceof Error?e.message:t(`暂时无法读取数据。`,`Data is temporarily unavailable.`);return(0,z.jsxs)(de,{className:`admin-data-workspace h-full`,style:{"--sidebar-width":`292px`},children:[Ie?(0,z.jsx)(`button`,{type:`button`,className:`admin-data-scrim lg:hidden`,"aria-label":t(`关闭项目列表`,`Close projects`),onClick:()=>A(!1)}):null,(0,z.jsxs)(fe,{mobileOpen:Ie,className:`admin-data-sidebar`,"aria-label":t(`数据项目`,`Data projects`),children:[(0,z.jsxs)(`div`,{className:`admin-data-sidebar-brand`,children:[(0,z.jsx)(Ee,{size:25}),(0,z.jsx)(g,{children:t(`数据`,`Data`)}),(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button ml-auto lg:hidden`,onClick:()=>A(!1),"aria-label":n(`common.close`),children:(0,z.jsx)(oe,{size:18})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-heading`,children:[(0,z.jsx)(`span`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`span`,{children:q?.total_projects??`—`})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-controls`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`账号`,`Account`)}),(0,z.jsxs)(`select`,{"aria-label":t(`筛选账号`,`Filter account`),value:p,onChange:e=>{f(!1),ne(e.target.value),S(0),T(``)},children:[(0,z.jsx)(`option`,{value:``,children:t(`全部 11 个账号`,`All 11 accounts`)}),$e.map(e=>(0,z.jsx)(`option`,{children:e},e))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-search`,children:[(0,z.jsx)(me,{size:15}),(0,z.jsx)(`input`,{"aria-label":t(`搜索项目、任务或 SID`,`Search projects, tasks or SID`),placeholder:t(`搜索项目或任务…`,`Search projects or tasks…`),value:m,onChange:e=>{f(!1),he(e.target.value),S(0)}})]})]}),(0,z.jsxs)(`div`,{className:`admin-data-projects`,"aria-busy":K.isFetching,children:[K.isPending&&U?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(h,{}),(0,z.jsx)(`p`,{children:t(`正在读取项目…`,`Loading projects…`)})]}):null,K.error?(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`alert`,children:[Ot(K.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void K.refetch(),children:n(`common.retry`)})]}):null,!K.isPending&&!lt.length&&!K.error?(0,z.jsxs)(`div`,{className:`admin-data-empty`,children:[(0,z.jsx)(ke,{size:22}),(0,z.jsx)(`p`,{children:t(`没有符合筛选条件的项目。`,`No projects match these filters.`)})]}):null,lt.map(n=>{let r=N(n)===Ne,i=(q?.tasks??[]).filter(e=>N(e)===N(n)).reduce((e,t)=>e+t.collection.retained_episodes,0);return(0,z.jsxs)(`div`,{"data-testid":`project-${n.tenant_id}-${n.sid}`,className:`admin-data-project ${r?`active`:``}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-project-open`,"aria-current":r?`page`:void 0,onClick:()=>St(n),children:[(0,z.jsx)(`span`,{className:`admin-data-project-title`,children:st(n)}),(0,z.jsxs)(`span`,{className:`admin-data-project-id`,children:[n.tenant_id,` · `,n.sid]}),(0,z.jsx)(`span`,{className:`admin-data-project-meta`,children:n.eligible?i?`${i.toLocaleString(e)} ${t(`段保留过程`,`retained processes`)}`:t(`尚无保留过程`,`No process data retained`):t(`当前用途不可读取`,`Unavailable for this purpose`)})]}),(0,z.jsx)(`input`,{type:`checkbox`,className:`admin-data-project-check`,"aria-label":`${t(`选择导出项目`,`Select project for export`)} ${st(n)} ${n.tenant_id} ${n.sid}`,checked:P.has(N(n)),disabled:W||!n.eligible||P.size>=20&&!P.has(N(n)),onChange:()=>wt(n)})]},N(n))})]}),(0,z.jsxs)(`div`,{className:`admin-data-paging`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!b||K.isFetching,onClick:()=>S(Math.max(0,b-20)),title:t(`上一页项目`,`Previous project page`),children:(0,z.jsx)(Ce,{size:14})}),(0,z.jsxs)(`span`,{children:[t(`第`,`Page`),` `,Math.floor(b/20)+1,` `,t(`页`,``)]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:!q?.has_more_projects||K.isFetching,onClick:()=>S(q?.next_offset??b+20),title:t(`下一页项目`,`Next project page`),children:(0,z.jsx)(Oe,{size:14})})]}),(0,z.jsxs)(`div`,{className:`admin-data-sidebar-footer`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`audit`),children:[(0,z.jsx)(we,{size:15}),t(`导出记录`,`Export history`)]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>M(`diagnostics`),children:[(0,z.jsx)(Se,{size:15}),t(`采集诊断`,`Capture diagnostics`)]}),(0,z.jsxs)(`a`,{href:`/invite`,children:[(0,z.jsx)(ae,{size:15}),t(`用户工作空间`,`User workspace`)]})]})]}),(0,z.jsxs)(`main`,{className:`admin-data-surface`,children:[(0,z.jsxs)(be,{children:[(0,z.jsx)(`button`,{type:`button`,className:`inline-flex admin-data-icon-button lg:hidden`,onClick:()=>A(!0),"aria-label":t(`打开项目列表`,`Open projects`),children:(0,z.jsx)(je,{size:18})}),(0,z.jsx)(`span`,{className:`admin-data-header-title`,children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(g,{children:W?t(`只读管理员`,`Read-only administrator`):t(`管理员`,`Administrator`)}),(0,z.jsxs)(`div`,{className:`ml-auto flex items-center gap-1 sm:gap-2`,children:[(0,z.jsx)(ye,{themeMode:s,onCycleTheme:c}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:Tt,disabled:K.isFetching||!U,title:t(`刷新数据`,`Refresh data`),children:K.isFetching?(0,z.jsx)(h,{}):(0,z.jsx)(ie,{size:14})}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!Y?.eligible||$.isPending,onClick:()=>{We(``),M(`export`)},children:[(0,z.jsx)(se,{size:14}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:t(`导出`,`Export`)})]})]})]}),(0,z.jsx)(`div`,{className:`admin-data-content`,children:U?Y?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-project-heading`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`p`,{className:`admin-data-eyebrow`,children:[(0,z.jsx)(ke,{size:13}),t(`已授权的过程数据`,`Authorized process data`)]}),(0,z.jsx)(`h1`,{children:st(Y)}),(0,z.jsxs)(`div`,{className:`admin-data-project-identity`,children:[(0,z.jsxs)(`code`,{children:[Y.tenant_id,` / `,Y.sid]}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:I,onClick:()=>void Dt(),children:[I?(0,z.jsx)(h,{}):(0,z.jsx)(ae,{size:13}),t(`在用户端打开`,`Open in user workspace`)]}),(0,z.jsx)(le,{text:`${window.location.origin}/admin/data?tenant=${encodeURIComponent(Y.tenant_id)}&sid=${encodeURIComponent(Y.sid)}`,label:t(`复制后台链接`,`Copy data link`),copiedLabel:t(`已复制`,`Copied`)})]})]}),(0,z.jsxs)(`span`,{className:`admin-data-collector-status`,children:[(0,z.jsx)(ge,{ok:J.data?.state===`running`}),J.error?t(`采集状态暂不可读`,`Capture status unavailable`):Ke(J.data?.state,e)]})]}),(0,z.jsxs)(`div`,{className:`admin-data-context-bar`,children:[(0,z.jsxs)(`label`,{className:`admin-data-field flex-1`,children:[(0,z.jsx)(`span`,{children:t(`查看范围`,`View scope`)}),(0,z.jsxs)(`select`,{value:w,onChange:e=>Ct(e.target.value),"aria-label":t(`选择任务或整个项目`,`Select a task or the entire project`),children:[(0,z.jsx)(`option`,{value:``,children:t(`整个项目 · 包含任务创建前的过程`,`Entire project · includes pre-task processes`)}),w&&!dt.some(e=>e.task_id===w)?(0,z.jsxs)(`option`,{value:w,children:[Z?Re(Z):t(`链接中的任务`,`Linked task`),` · `,w]}):null,dt.map(e=>(0,z.jsxs)(`option`,{value:e.task_id,children:[Re(e),` · `,e.task_id]},e.task_id))]})]}),(0,z.jsxs)(`label`,{className:`admin-data-field`,children:[(0,z.jsx)(`span`,{children:t(`数据用途`,`Data purpose`)}),(0,z.jsxs)(`select`,{value:y,onChange:e=>{Te(e.target.value),Ue(new Map),S(0)},children:[(0,z.jsx)(`option`,{value:`internal_training`,children:t(`内部训练`,`Internal training`)}),(0,z.jsx)(`option`,{value:`external_sharing`,children:t(`对外共享`,`External sharing`)})]})]})]}),Y.eligible?(0,z.jsxs)(z.Fragment,{children:[w&&Z?(0,z.jsxs)(v,{label:t(`任务目标与来源`,`Task objective and source`),children:[(0,z.jsx)(`div`,{className:`admin-data-prose`,children:(0,z.jsx)(pe,{children:Z.objective||Z.request?.text||Z.title})}),(0,z.jsx)(`code`,{children:Z.task_id})]}):null,mt?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`admin-data-role-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h2`,{children:[(0,z.jsx)(Me,{size:17}),t(`多 Agent 过程`,`Multi-agent processes`)]}),(0,z.jsx)(`p`,{children:t(`查看各角色实际留下的记录。角色缺失、中断和质量验收分别标记。`,`Inspect the records each role actually produced. Missing roles, interruptions and review status are shown separately.`)})]}),(0,z.jsx)(`button`,{type:`button`,className:`admin-data-text-button ${E===null?`active`:``}`,onClick:()=>{D(null),k(null)},children:t(`全部角色`,`All roles`)})]}),(0,z.jsx)(`div`,{className:`admin-data-roles`,children:ue.map(r=>{let i=vt.get(r),a=Math.max(i?.episodes||0,ht.filter(e=>Be(e)===r).length),o=ht.filter(e=>Be(e)===r).length;return(0,z.jsxs)(`button`,{type:`button`,"data-testid":`role-${r}`,className:`admin-data-role ${E===r?`active`:``}`,style:{"--role-color":xe(r)},"aria-pressed":E===r,onClick:()=>{D(r),k(null)},children:[(0,z.jsxs)(`span`,{className:`admin-data-role-label`,children:[(0,z.jsx)(`span`,{className:`admin-data-role-mark`,children:R(r,e).slice(0,1)}),(0,z.jsx)(`strong`,{children:R(r,e)}),(0,z.jsx)(`span`,{children:r})]}),(0,z.jsx)(`span`,{className:`admin-data-role-description`,children:ce(r,n)}),(0,z.jsx)(`span`,{className:`admin-data-role-count`,children:a?`${a.toLocaleString(e)} ${t(`段过程`,`processes`)}`:i?.observations?t(`仅有活动记录`,`Activity records only`):t(`尚未采到记录`,`No records captured`)}),(0,z.jsx)(`span`,{className:`admin-data-role-footnote`,children:o?`${t(`正文已加载`,`Content loaded`)} ${o.toLocaleString(e)}`:t(`按原始记录归属角色`,`Role comes from recorded metadata`)})]},r)})}),vt.get(`unknown`)?.episodes||ht.some(e=>Be(e)===`unknown`)?(0,z.jsxs)(`button`,{type:`button`,className:`admin-data-unknown`,onClick:()=>{D(`unknown`),k(null)},children:[(0,z.jsx)(Ae,{size:14}),t(`另有角色未记录的过程,保留原样查看`,`Some processes have no recorded role. View them as captured.`),` `,(0,z.jsx)(Oe,{size:13})]}):null,(0,z.jsxs)(`div`,{className:`admin-data-record-heading`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{children:E?R(E,e):t(`全部保留过程`,`All retained processes`)}),(0,z.jsxs)(`p`,{children:[ht.length.toLocaleString(e),` `,t(`段已加载`,`processes loaded`),` · `,yt.toLocaleString(e),` `,t(`条原始事件`,`raw events`),` `,Q.hasNextPage?t(`· 还有后续页`,`· more pages available`):``]})]}),gt.length?(0,z.jsx)(`select`,{className:`admin-data-episode-select`,"aria-label":t(`选择过程记录`,`Select a process`),value:_t?.episode_id??``,onChange:e=>k(Number(e.target.value)),children:gt.map(t=>(0,z.jsxs)(`option`,{"data-testid":`episode-${t.episode_id}`,value:t.episode_id,children:[`#`,t.episode_id,` · `,R(t.role,e),` · `,Ge(t.started_at,e)]},t.episode_id))}):null]}),Q.error?(0,z.jsxs)(`div`,{role:`alert`,className:`admin-data-notice`,children:[Ot(Q.error),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void Q.refetch(),children:n(`common.retry`)})]}):null,_t?(0,z.jsx)(Ye,{episode:_t,readonly:W,onDownload:Et},_t.episode_id):(0,z.jsxs)(`div`,{className:`admin-data-empty admin-data-record-empty`,children:[Q.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(Ae,{size:28}),(0,z.jsx)(`p`,{children:Q.isPending?t(`正在读取真实过程…`,`Loading recorded processes…`):E&&(vt.get(E)?.episodes||0)>0?t(`该角色有记录,当前页尚未加载其正文。`,`This role has recorded processes; their content is on a later page.`):t(`当前范围没有保留的模型过程。项目活动不等同于完整模型轨迹。`,`No model processes are retained in this scope. Project activity does not establish a complete model trace.`)})]}),Q.hasNextPage?(0,z.jsx)(`div`,{className:`admin-data-load-more`,"data-testid":`load-more-observations`,children:(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,disabled:Q.isFetchingNextPage,onClick:()=>void Q.fetchNextPage(),children:[Q.isFetchingNextPage?(0,z.jsx)(h,{}):(0,z.jsx)(Oe,{size:14}),t(`加载后续原始记录`,`Load more original records`)]})}):null,X.data?.segments.some(e=>e.source_kind!==`tool_episode`)?(0,z.jsxs)(v,{label:t(`项目活动与任务来源`,`Project activity and task sources`),children:[(0,z.jsx)(`div`,{className:`admin-data-activity`,children:X.data.segments.filter(e=>e.source_kind!==`tool_episode`).map(t=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{children:R(t.role,e)}),(0,z.jsx)(`span`,{children:t.summary}),(0,z.jsx)(`time`,{children:Ge(t.started_at,e)})]},t.id))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`活动顺序来自记录时间,不表示已证实的 Agent 交接。`,`Activity follows recorded timestamps; it does not establish an agent handoff.`)})]}):null,(0,z.jsxs)(`p`,{className:`admin-data-bottom-note`,children:[(0,z.jsx)(te,{size:14}),t(`过程已采集不代表任务成功,也不代表训练质量已验收。原始记录保留缺失和中断状态。`,`Captured processes do not establish task success or training quality. Missing data and interruptions remain visible.`)]})]}):(0,z.jsx)(`div`,{className:`admin-data-notice`,role:`status`,children:X.isPending?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(h,{}),t(`正在核对链接中的任务…`,`Checking the linked task…`)]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{children:[X.error instanceof Pe&&X.error.status===404?t(`链接中的任务 ID 不存在或当前用途下不可读取。这不表示项目没有过程数据。`,`The linked task ID does not exist or is unavailable for this purpose. This does not mean the project has no process data.`):t(`暂时无法核对该任务,请重试或查看整个项目。`,`This task could not be verified. Retry or view the entire project.`),` `,(0,z.jsx)(`code`,{children:w})]}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>Ct(``),children:t(`查看整个项目`,`View entire project`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>void X.refetch(),children:n(`common.retry`)})]})})]}):(0,z.jsxs)(`div`,{className:`admin-data-notice`,role:`status`,children:[t(`当前用途下没有可读取的授权记录。请选择其他项目或数据用途。`,`No authorized records are available for this purpose. Choose another project or purpose.`),(0,z.jsx)(v,{children:(0,z.jsx)(`pre`,{children:Y.reason})})]})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(ke,{size:32}),(0,z.jsx)(`h1`,{children:d&&u.sid?t(`链接中的项目未找到`,`Linked project not found`):t(`选择一个项目`,`Select a project`)}),(0,z.jsx)(`p`,{children:d&&u.sid?t(`当前账号与用途下找不到此 SID,没有替你打开其他项目。请检查链接或选择左侧项目。`,`This SID is not available for the selected account and purpose. Check the link or choose a project from the list.`):t(`从左侧查看各账号的真实过程数据。`,`Choose a project to inspect its recorded processes.`)}),(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>A(!0),children:t(`浏览项目`,`Browse projects`)})]}):(0,z.jsxs)(`div`,{className:`admin-data-welcome`,children:[(0,z.jsx)(Ee,{size:38}),(0,z.jsx)(`h1`,{children:t(`数据工作台`,`Data workbench`)}),(0,z.jsx)(`p`,{children:H.error?Ot(H.error):t(`正在验证管理员身份…`,`Checking administrator access…`)}),H.error?(0,z.jsx)(`a`,{className:`brand-button brand-button-primary`,href:`/admin/login`,children:t(`管理员登录`,`Administrator sign in`)}):(0,z.jsx)(h,{})]})})]}),(0,z.jsx)(ve,{open:j===`workspace`,onClose:()=>M(null),label:t(`打开用户工作空间`,`Open user workspace`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`需要对应的用户账号`,`Use the matching user account`)}),(0,z.jsxs)(`p`,{children:[t(`这个项目属于`,`This project belongs to`),` `,(0,z.jsx)(`strong`,{children:Y?.tenant_id}),t(`。`,`. `),B?(0,z.jsxs)(z.Fragment,{children:[t(`当前用户端账号是`,`Your current user account is`),` `,(0,z.jsx)(`strong`,{children:B}),t(`。`,`. `)]}):t(`你尚未登录用户工作空间。`,`You are not signed in to a user workspace.`)]}),(0,z.jsx)(`p`,{children:t(`请在用户端使用对应邀请码登录,再打开这个项目。管理员登录不会切换用户账号。`,`Sign in to the user workspace with the matching invitation before opening this project. Administrator access does not switch your user account.`)}),(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(`a`,{className:`brand-button brand-button-primary inline-flex items-center gap-2`,href:`/invite`,target:`_blank`,rel:`noopener`,children:[t(`打开用户登录入口`,`Open user sign in`),(0,z.jsx)(ae,{size:14})]})]})]})}),(0,z.jsx)(ve,{open:j===`export`,onClose:()=>M(null),label:t(`导出全部保留过程`,`Export all retained processes`),children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出全部保留过程`,`Export all retained processes`)}),(0,z.jsx)(`p`,{children:t(`ZIP 包含所选项目的全部已保留输入、输出和工具轨迹,包括未验收、未结束和失败的记录。`,`The ZIP includes all retained inputs, outputs and tool traces for these projects, including unreviewed, unfinished and failed records.`)}),(0,z.jsx)(`ul`,{className:`admin-data-export-projects`,children:bt.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(re,{size:14}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:st(e)}),(0,z.jsxs)(`code`,{children:[e.tenant_id,` / `,e.sid]})]})]},N(e)))}),(0,z.jsx)(`p`,{className:`admin-data-subtle`,children:t(`可在项目列表勾选多个项目;一次最多 20 个。`,`Use project checkboxes to select up to 20 projects per export.`)}),W?(0,z.jsx)(`p`,{role:`status`,children:t(`只读管理员不能导出数据。`,`Read-only administrators cannot export data.`)}):null,$.error?(0,z.jsx)(`p`,{role:`alert`,className:`admin-data-notice`,children:Ot($.error)}):null,F?(0,z.jsx)(`p`,{role:`status`,children:F}):null,(0,z.jsxs)(`div`,{className:`admin-data-modal-actions`,children:[(0,z.jsx)(_,{className:`inline-flex items-center justify-center gap-2`,onClick:()=>M(null),children:n(`common.cancel`)}),(0,z.jsxs)(_,{className:`inline-flex items-center justify-center gap-2`,variant:`primary`,disabled:W||!bt.length||$.isPending,onClick:()=>$.mutate(),children:[$.isPending?(0,z.jsx)(h,{}):(0,z.jsx)(se,{size:14}),t(`下载 ZIP`,`Download ZIP`)]})]})]})}),(0,z.jsx)(ve,{open:j===`audit`,onClose:()=>M(null),label:t(`导出记录`,`Export history`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`导出记录`,`Export history`)}),(0,z.jsx)(`p`,{children:t(`服务器记录的导出范围、操作身份与结果。`,`Server-recorded export scope, operator and outcome.`)}),nt.isPending?(0,z.jsx)(h,{}):nt.error?(0,z.jsx)(`p`,{role:`alert`,children:Ot(nt.error)}):nt.data?.events.length?(0,z.jsx)(`div`,{className:`admin-data-table-wrap`,children:(0,z.jsxs)(`table`,{children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`th`,{children:t(`时间`,`Time`)}),(0,z.jsx)(`th`,{children:t(`操作`,`Action`)}),(0,z.jsx)(`th`,{children:t(`身份 / 用途`,`Actor / purpose`)}),(0,z.jsx)(`th`,{children:t(`结果`,`Outcome`)})]})}),(0,z.jsx)(`tbody`,{children:nt.data.events.map(n=>(0,z.jsxs)(`tr`,{children:[(0,z.jsx)(`td`,{children:Ge(n.created_at,e)}),(0,z.jsxs)(`td`,{children:[n.action,(0,z.jsxs)(`small`,{children:[n.projects??`—`,` `,t(`个项目`,`projects`)]})]}),(0,z.jsxs)(`td`,{children:[n.actor,(0,z.jsx)(`small`,{children:n.purpose===`external_sharing`?t(`对外共享`,`External sharing`):t(`内部训练`,`Internal training`)})]}),(0,z.jsx)(`td`,{children:n.outcome})]},n.id))})]})}):(0,z.jsx)(`p`,{children:t(`尚无导出记录。`,`No export history yet.`)})]})}),(0,z.jsx)(ve,{open:j===`diagnostics`,onClose:()=>M(null),label:t(`采集诊断`,`Capture diagnostics`),width:`max-w-3xl`,children:(0,z.jsxs)(`div`,{className:`admin-data-modal-content`,children:[(0,z.jsx)(`h2`,{children:t(`采集诊断`,`Capture diagnostics`)}),(0,z.jsx)(`p`,{children:J.error?Ot(J.error):Ke(J.data?.state,e)}),(0,z.jsx)(`div`,{className:`admin-data-diagnostics`,children:Object.entries(J.data?.tool_capture?.tenants??{}).map(([n,r])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:Ke(r.state,e)}),(0,z.jsxs)(`span`,{children:[r.counts.events_received??0,` `,t(`条接收事件`,`events received`)]}),r.last_error_code?(0,z.jsx)(`code`,{children:r.last_error_code}):null]},n))}),(0,z.jsx)(v,{label:t(`完整诊断数据`,`Full diagnostic data`),children:(0,z.jsx)(`pre`,{className:`admin-data-code`,children:JSON.stringify({collector:J.data,project:Y,collection:X.data?.collection,gaps:X.data?.gaps,completeness:q?.completeness},null,2)})})]})})]})}export{tt as default,_e as saveDownload}; \ No newline at end of file diff --git a/frontend/web/dist/assets/App-ButSXpk-.js b/frontend/web/dist/assets/App-ButSXpk-.js new file mode 100644 index 000000000..dd2ba3fda --- /dev/null +++ b/frontend/web/dist/assets/App-ButSXpk-.js @@ -0,0 +1,48 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ResearchWorkbenchPanel-7s5IqqE9.js","./rolldown-runtime-hePW80VL.js","./icons-DHjcpj5P.js","./query-dCPZk0Xc.js","./index-Cr9q41CR.js","./markdown-BGG43fCg.js","./markdown-DvoRHisr.css","./index-CNuZH30Y.css","./AppearanceControls-BIflq6l1.js","./activity-DRTghqfr.js","./sliders-horizontal-BIXOePK5.js","./code-xml-Cgb6b1v3.js","./useWorkbenchTheme-Drg51S8W.js","./ResearchWorkbenchPanel-BHFSJIDp.css","./MapPanel-BvIILI52.js","./history-DKaffr1B.js","./format-BNcptKD6.js","./MapPanel-H65d2ArA.css"])))=>i.map(i=>d[i]); +import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y}from"./icons-DHjcpj5P.js";import{S as b,a as x,c as S,n as C,r as w}from"./query-dCPZk0Xc.js";import{i as T}from"./markdown-BGG43fCg.js";import{A as E,B as D,C as O,D as k,E as A,G as j,L as M,M as N,N as P,O as F,P as I,R as ee,S as te,T as L,W as ne,_ as re,a as ie,b as ae,c as oe,d as se,f as ce,g as le,h as ue,i as de,j as fe,k as pe,l as me,m as he,n as ge,o as _e,p as ve,q as ye,r as be,s as xe,t as Se,u as Ce,v as we,w as Te,x as Ee,y as De,z as Oe}from"./index-Cr9q41CR.js";import{A as ke,C as Ae,D as je,E as R,F as Me,I as Ne,L as z,M as Pe,N as Fe,O as Ie,P as Le,S as Re,T as ze,_ as Be,a as Ve,b as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,j as Ye,k as Xe,l as Ze,m as Qe,n as $e,o as et,p as tt,r as B,s as nt,t as rt,u as it,v as at,w as ot,y as st}from"./AppearanceControls-BIflq6l1.js";import{a as ct,c as V,i as lt,l as ut,n as dt,o as H,r as ft,s as pt,t as mt}from"./format-BNcptKD6.js";import{a as ht,i as gt,n as _t,r as vt,t as yt}from"./useWorkbenchTheme-Drg51S8W.js";var U=t(y(),1),bt=`local_request_id`,xt=e=>Array.isArray(e)&&e.length>0;function St(e,t,n,r,i=Date.now(),a=!0,o){let s=e.findIndex(e=>e.type===`ui.argus`&&Number(e[bt])===n);if(s<0)return!r.length&&!a?e:[...e,{type:`ui.argus`,agent_layer:`manager`,text:``,ts:i/1e3,event_id:`local-${t}-${n}-argus`,message_id:`local-${n}-argus`,fragment_mode:`snapshot`,steps:r,live:a,...o?{status:o}:{},[bt]:n}];let c=[...e];return c[s]={...c[s],...r.length?{steps:r}:{},live:a,...o?{status:o}:{}},c}function Ct(e,t,n=Date.now(),r=`stopped`){return e.map(e=>{if(e.type!==`ui.argus`||Number(e[bt])!==t||e.live!==!0)return e;let i=Array.isArray(e.steps)?e.steps.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return t.ended_ts||t.status!==`running`?e:{...t,ended_ts:n/1e3,status:r}}):e.steps;return{...e,live:!1,status:r,...i===void 0?{}:{steps:i}}})}function wt(e,t,n,r=Date.now()){return{type:`ui.operator`,agent_layer:`operator`,text:n,ts:r/1e3,event_id:`local-${e}-${t}-operator`,message_id:`local-${t}-operator`,[bt]:t}}function Tt(e,t,n,r,i,a=Date.now(),o=`auto`){let s=r.trim();if(!s)return e;let c=e.findIndex(e=>e.type===`ui.argus`&&Number(e[bt])===n),l=i.endsWith(`-argus`)?`${i.slice(0,-6)}-operator`:``,u=l?e.map(e=>e.type===`ui.operator`&&Number(e[bt])===n?{...e,message_id:l}:e):e,d=u.find(e=>e.type===`ui.operator`&&Number(e[bt])===n),f=d?Math.max(0,a-Number(d.ts??a/1e3)*1e3):0;if(c<0)return[...u,{type:`ui.argus`,agent_layer:`manager`,text:s,ts:a/1e3,event_id:`local-${t}-${n}-argus`,message_id:i||`local-${n}-argus`,fragment_mode:o,response_latency_ms:f,[bt]:n}];let p=u[c],m=[...u];return m[c]={...p,text:O(String(p.text??``),s,o),message_id:i||p.message_id,fragment_mode:o},m}function Et(e,t,n){let r=e.filter(e=>e.type!==`engineer.progress`||e.turn_step!==!0),i=new Map,a=[...r];r.forEach((e,t)=>{let n=String(e.type??``);if(n!==`ui.operator`&&n!==`ui.argus`)return;let r=`${n}\u0000${String(e.text??``)}`;i.set(r,[t,...i.get(r)??[]])});let o=t.map(e=>({type:e.role===`operator`?`ui.operator`:`ui.argus`,agent_layer:e.role===`operator`?`operator`:`manager`,text:e.text,ts:e.ts,message_id:e.message_id||`transcript-${e.ts}-${e.role}`,...e.mission_result===!0?{mission_result:!0}:{},...typeof e.item_id==`string`?{item_id:e.item_id}:{},...typeof e.success==`boolean`?{success:e.success}:{},...typeof e.summary==`string`?{summary:e.summary}:{},...typeof e.delivery_id==`string`?{delivery_id:e.delivery_id}:{},...e.delivery&&typeof e.delivery==`object`?{delivery:e.delivery}:{},...xt(e.steps)?{steps:e.steps}:{}})),s=Array(o.length).fill(!0);for(let e=o.length-1;e>=0;--e){let n=o[e],r=`${String(n.type)}\u0000${String(n.text??``)}`,c=i.get(r)??[],l=t[e].message_id,u=e=>{let t=a[e];return n.item_id&&t.item_id&&n.item_id!==t.item_id?!1:n.mission_result!==!0&&t.mission_result!==!0||!!(l&&t.message_id===l)||!!(!l&&n.delivery_id&&n.delivery_id===t.delivery_id)},d=c.findIndex(e=>u(e)&&!!(l&&a[e].message_id===l));if(d<0&&(d=c.findIndex(u)),d>=0){s[e]=!1;let[t]=c.splice(d,1),r=a[t];if(l&&r.message_id===l){let e={};for(let t of[`mission_result`,`item_id`,`success`])(r[t]==null||r[t]===``)&&n[t]!=null&&(e[t]=n[t]);a[t]={...r,...e}}}}let c=[...o.filter((e,t)=>s[t]),...a],l=Array(c.length).fill(!0),u=new Set,d=n.map(e=>{let t=String(e.message_id??``),n=t?c.findIndex((e,n)=>!u.has(n)&&String(e.message_id??``)===t):-1,r=Number(e.ts??0);if(n<0&&(n=c.findIndex((t,n)=>{if(u.has(n)||t.type!==e.type||t.text!==e.text)return!1;let i=Number(t.ts??0);return Math.abs(i-r)<=5})),n>=0){u.add(n),l[n]=!1;let t=c[n];return{...e,...t.mission_result===!0?{mission_result:!0}:{},...typeof t.item_id==`string`?{item_id:t.item_id}:{},...typeof t.success==`boolean`?{success:t.success}:{},...typeof t.summary==`string`?{summary:t.summary}:{},...typeof t.delivery_id==`string`?{delivery_id:t.delivery_id}:{},...t.delivery&&typeof t.delivery==`object`?{delivery:t.delivery}:{},...xt(t.steps)?{steps:t.steps,live:!1}:{}}}return e});return[...c.filter((e,t)=>l[t]),...d].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0))}function Dt(e,t,n,r,i){let a=le(e,t,120);return{query:a,events:(0,U.useMemo)(()=>e?Et(n,a.data??[],i===e?r:[]):[],[e,n,a.data,r,i]),status:a.isError?`error`:a.isPending?`loading`:`ready`}}var Ot=z(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),kt=z(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),At=z(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),jt=z(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Mt=z(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Nt=z(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Pt=z(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ft=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),It=z(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Lt=z(`Diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Rt=z(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),zt=z(`FilePenLine`,[[`path`,{d:`m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2`,key:`142zxg`}],[`path`,{d:`M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`2t3380`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),Bt=z(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Vt=z(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ht=z(`Layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),W=z(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),G=z(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Ut=z(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),Wt=z(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Gt=z(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),Kt=z(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),qt=z(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Jt=z(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),Yt=z(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Xt=z(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),Zt=z(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),Qt=z(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),$t=z(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),en={"global/agent-team-lead.md":{title:`多智能体团队协作`,summary:`判断何时值得并行工作,按文件与职责拆分协作,并独立审查汇总结果;不替代原有角色与授权。`,originalName:`Agent Team Lead`,source:`argus/builtin_skills/agent-team-lead.md`,sourceSha256:`b490cc96572941fa4a2fe4937bd3e86c9802c132439ae779fcf8e88241ba9521`},"global/curator/argus-curator-role.md":{title:`团队成果整理`,summary:`维护团队候选成果池和比较记录,归纳后续策略;整理者不代替执行者完成工程任务。`,originalName:`Team Curator`,source:`argus/builtin_skills/curator/argus-curator-role.md`,sourceSha256:`3dfd743254a91f88feef76e85683225dc5b510b7f417f6430ef7b975b8eb0f5b`},"global/engineer/minimal-coding-agent.md":{title:`最小且严谨的软件修改`,summary:`用足够小的改动实现、修复或重构软件与界面,保留既有行为,避免无依据的抽象和新增依赖。`,originalName:`极简而严谨的 Coding Agent`,source:`argus/builtin_skills/engineer/minimal-coding-agent.md`,sourceSha256:`aa47c79252eb5086451530ae25aac77ce87bd4315eda1e9defae2af719295cab`},"global/engineer/pdf-chat.md":{title:`分段阅读 PDF`,summary:`按页或章节阅读并核对版本、页码;图片和版式需查看实际页面,回答只依据相关证据。`,originalName:`Progressive PDF Reading`,source:`argus/builtin_skills/engineer/pdf-chat.md`,sourceSha256:`141bd41eb888191aedc391f0df2ba100ab5aee3e7970f9afc21a6f50f4deca5f`},"global/engineer/presentation-master.md":{title:`可编辑演示文稿`,summary:`使用已有 PPT Master 工具制作或修改可编辑演示文稿和原生 PPT 图,经指定解释器运行并核对导出效果;科研绘图路线由科研垂域决定。`,originalName:`Editable Presentations with PPT Master`,source:`argus/builtin_skills/engineer/presentation-master.md`,sourceSha256:`b9f5ed3935b538a18280ac79a504a3b28b432b66efb884e3e06284b4f1729ff3`},"global/engineer/skill-authoring-guide.md":{title:`编写与审阅技能和 Wiki 页面`,summary:`只在证据表明有可复用做法时写技能;先学操作者材料再忠实编辑;Wiki 更新来自一手来源;审阅者按证据真实、无冗余、不倒退、层级正确来判断一次修改。`,originalName:`Writing and Reviewing Skills and Wiki Pages`,source:`argus/builtin_skills/engineer/skill-authoring-guide.md`,sourceSha256:`cf4073da950ef34a359fa3f4b9c77c9d00ebd56bcb79a678efc3e04197ec7e79`},"global/engineer/web-primary-source-evidence.md":{title:`查证一手网络来源`,summary:`为软件、产品、接口和基准等现实信息寻找并保留一手来源,让重要结论能够追溯。`,originalName:`Web Primary-Source Evidence`,source:`argus/builtin_skills/engineer/web-primary-source-evidence.md`,sourceSha256:`632930eb13afc66ebf4742ab6c87fa586edee916c3eeacef25f50215e78f776f`},"global/manager/evidence-based-stage-decision.md":{title:`经理的职责与阶段决定`,summary:`经理是唯一改变阶段的角色;结合规划和评审证据决定继续、推进、返回或结束,部署始终需要操作者批准。`,originalName:`The Manager's role and stage decisions`,source:`argus/builtin_skills/manager/evidence-based-stage-decision.md`,sourceSha256:`d664fa7b6e92045335da59739575326b89e70d38662c1ffdc79774c599e36817`},"global/performance-profile-ground-truth.md":{title:`真实工作负载性能分析`,summary:`用指定环境和代表性输入定位瓶颈,对照未开启剖析的实测结果;不顺带执行未要求的优化。`,originalName:`Performance Profile Ground Truth`,source:`argus/builtin_skills/performance-profile-ground-truth.md`,sourceSha256:`42430420ce8bd31047780e9b08ac5eab366f849eb222805ca05492779095f4d0`},"global/planner/dependency-aware-task-decomposition.md":{title:`规划者的职责与按依赖拆解任务`,summary:`规划者只读只派、不执行,阶段只由经理改变;把目标与已有证据整理成最小、可执行、有真实依赖且能明确验收的任务集合。`,originalName:`The Planner's role and dependency-aware task decomposition`,source:`argus/builtin_skills/planner/dependency-aware-task-decomposition.md`,sourceSha256:`06d5295c6777a64c90a28a5603884e557a72ad5961b19a3f411dc1e83e331886`},"global/project-venv-package-management.md":{title:`项目环境、依赖与运行前核查`,summary:`使用项目自身的环境与锁文件,只安装任务需要的依赖,在承载论断的运行前只核查它真正用到的资源;不修改 Argus 框架自己的运行环境。`,originalName:`Project Environment and Dependencies`,source:`argus/builtin_skills/project-venv-package-management.md`,sourceSha256:`ab8728ad9fff58e8bc4672e5bc2446135f376b55b52392a6104b2eb52e9ed327`},"global/reviewer/argus-reviewer-role.md":{title:`评审者的职责与给执行者的下一步`,summary:`独立判断执行结果是否成立、需要补充或转向,把检查结果提炼成执行者需要的那一个下一步;评审有争议时以带标签的证据而非角色权威定论,不替执行者作完成声明。`,originalName:`The Reviewer's role`,source:`argus/builtin_skills/reviewer/argus-reviewer-role.md`,sourceSha256:`8457a177a4376eab0e4bef7a652e3276ce3b6f9a0ab421fd15bd96eb057cf852`},"global/reviewer/engineer-process-audit.md":{title:`核对执行过程与证据`,summary:`当成果或验证声明存在争议时检查任务相关回执和日志,区分缺少记录与确实未执行。`,originalName:`Engineer Process Audit`,source:`argus/builtin_skills/reviewer/engineer-process-audit.md`,sourceSha256:`b109fb737e747b863244c9b03e1b23ff82acf724ef420bc547ad457c1cf65ac5`},"global/reviewer/web-source-evidence-audit.md":{title:`审查网络证据是否支撑结论`,summary:`核对实际取得的来源与重要现实信息声明是否一致,不把有链接等同于已经证实。`,originalName:`Web Source-Evidence Audit`,source:`argus/builtin_skills/reviewer/web-source-evidence-audit.md`,sourceSha256:`35dbb6288199c52d4ecfd4e241a54346f5ef8af985f50bf24121e687ea9dc22e`},"global/stale-blocker-verification-probe.md":{title:`核实旧阻塞与易变的外部事实`,summary:`用最小且已授权的探针判断记录中的阻塞是否仍然存在;只在决策依赖时核实外部事实,把身份、许可与执行当作三个不同的问题。`,originalName:`Verify a Recorded Blocker or a Changing External Fact`,source:`argus/builtin_skills/stale-blocker-verification-probe.md`,sourceSha256:`3eb5f473bbf1cf482a840e7af3c84bc939a6710b60f84415ad94e6932a9122b3`},"vertical/argus_maintenance/engineer/argus-maintenance-execution.md":{title:`Argus 小范围维护`,summary:`按核心与领域职责检查和简化框架,用小而可复用的修改解决明确问题。`,originalName:`Argus Maintenance`,source:`argus/verticals/argus_maintenance/skills/engineer/argus-maintenance-execution.md`,sourceSha256:`138f9b7e2503c5ce0307e575fa0555a62e1820c559e105d60cc6e31ab9991c0f`},"vertical/argus_maintenance/reviewer/argus-maintenance-review.md":{title:`Argus 维护变更评审`,summary:`核对补丁是否真正简化、复用和解耦,并用验证结果证明行为,而不是只看代码缩短。`,originalName:`Argus Maintenance Review`,source:`argus/verticals/argus_maintenance/skills/reviewer/argus-maintenance-review.md`,sourceSha256:`d6ad0f8eb29d5ca3d5a66fbc7df34de86e42229f15e8e2e22ce601a8ae08c4f8`},"vertical/chemistry/engineer/batteries/battery-identity-and-data-normalization.md":{title:`电池对象与测试数据对齐`,summary:`在循环分析前统一电芯、电极、电解液、测试协议和时间序列身份;不用于分子计算或一般光谱分析。`,originalName:`Battery Cell Identity and Electrochemical Data Normalization`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-identity-and-data-normalization.md`,sourceSha256:`d1cfc1cb94cf4e4828fcd2b75fb0f1dc57181208f2fad1f19c343a9d169462e6`},"vertical/chemistry/engineer/batteries/battery-model-validation.md":{title:`电池模型与退化解释验证`,summary:`用防止数据泄漏的实测电芯数据验证预测和退化解释,明确模型边界;不把预测当作实测。`,originalName:`Battery Model Boundary and Degradation Validation`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-model-validation.md`,sourceSha256:`fe4ec1ec78ec21dd0d568b71276c2f85e13b6216d5a7770f5f75d09baabc6d27`},"vertical/chemistry/engineer/batteries/cycling-and-degradation-analysis.md":{title:`电池循环与退化分析`,summary:`分析循环、倍率、阻抗和退化轨迹,保留电芯与协议对照,并避免评估数据泄漏。`,originalName:`Battery Cycling and Degradation Analysis Workflow`,source:`argus/domains/chemistry/skills/engineer/batteries/cycling-and-degradation-analysis.md`,sourceSha256:`3e0870b82fbc40463f81ca8eb1e84576c9fe1ae5fe501da6d2b274535fd16d2e`},"vertical/chemistry/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md":{title:`生化结合与功能实验分析`,summary:`分析亲和力、动力学、抑制和功能证据,核对构建体、辅因子、状态与实验对照;对接结果不能单独证明活性。`,originalName:`Biochemical Binding, Kinetics, and Functional Assay Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md`,sourceSha256:`12d235a655a1b6b6022a84a5c36e3c291df6227cb40bd2dc78f19012deff62e5`},"vertical/chemistry/engineer/biochemistry/biochemistry-structural-computational-evidence.md":{title:`生化结构与模拟的证据边界`,summary:`把结构、分子对接、动力学和突变结果作为待验证假设,结合真实实验边界解释,不直接宣称亲和力成立。`,originalName:`Biochemistry Structural, Docking, and MD Evidence Boundary Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-structural-computational-evidence.md`,sourceSha256:`47283774a89fa87050fd35df791c961dce37588ec9c92c9d4e357d59a9f14d6c`},"vertical/chemistry/engineer/biochemistry/biochemistry-system-and-assay-normalization.md":{title:`生化体系与实验对象对齐`,summary:`统一序列、构建体、分子状态、配体、辅因子、突变、结构和实验身份,再开展比较。`,originalName:`Biochemistry and Chemical Biology System Identity Normalization`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-system-and-assay-normalization.md`,sourceSha256:`9b7d80ae04064e9a1b5465dc1fee60f5511491694aaa20e423ae92779ad12ee5`},"vertical/chemistry/engineer/characterization/characterization-data-and-sample-normalization.md":{title:`表征样品与原始数据对齐`,summary:`保留衍射、光谱、质谱、核磁和显微原始数据及仪器信息;不把不同测试方式统一成简单拟峰。`,originalName:`Characterization Sample, Instrument Data, and Metadata Normalization`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-data-and-sample-normalization.md`,sourceSha256:`dad27a33c24c37fdc17a7f7386478246e7847edde9cac4cc2939590ab3e07b9c`},"vertical/chemistry/engineer/characterization/characterization-validation-and-integration.md":{title:`多种表征证据交叉验证`,summary:`综合不同仪器证据时保留各自适用范围和限制,避免跨测试方式作过强推断。`,originalName:`Characterization Validation and Multimodal Evidence Integration`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-validation-and-integration.md`,sourceSha256:`9671988085d6a0127a4739300c9c851e904016f8f17c31fafb676303b7d736c1`},"vertical/chemistry/engineer/characterization/modality-specific-interpretation-workflow.md":{title:`按测试方式解释表征结果`,summary:`依据衍射、光谱、质谱、核磁或显微的具体机制选择对照和模型,不使用一套解释套用全部数据。`,originalName:`Modality-Specific Chemical Characterization Interpretation Workflow`,source:`argus/domains/chemistry/skills/engineer/characterization/modality-specific-interpretation-workflow.md`,sourceSha256:`c09d9f9710e8ee7a72ff7cfd0f04ec741ea792a61a8b8abf56c038c26b126e46`},"vertical/chemistry/engineer/chemistry-execution.md":{title:`化学研究执行指南`,summary:`按任务选择领域流程,核实实际工具能力,保留一手证据并验证科学结论;实体实验仍需明确授权。`,originalName:`Chemistry Research Execution`,source:`argus/domains/chemistry/skills/engineer/chemistry-execution.md`,sourceSha256:`d6ad8b3ae0254319e31de1ca91a7c75fd06c70795d3948b38b8d35b895e69d59`},"vertical/chemistry/engineer/chemistry-toolkit.md":{title:`化学方法与工具导航`,summary:`先选择科学问题对应的方法,再查看具体工具说明;这是导航目录,不是自动安装或执行脚本。`,originalName:`Chemistry Skill and Capability Router`,source:`argus/domains/chemistry/skills/engineer/chemistry-toolkit.md`,sourceSha256:`14840bc5603ce237373ab4832f7bf747c24e6d4ef524eb2ccd112a8bb9eaea70`},"vertical/chemistry/engineer/computational_chemistry/computational-identity-normalization.md":{title:`计算化学对象与输入对齐`,summary:`在量子化学、力场、分子动力学或自由能计算前,统一分子或周期体系的输入与状态。`,originalName:`Computational Chemistry Identity and Input Normalization`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-identity-normalization.md`,sourceSha256:`fd9bebbdc28731a9eeab536279466e3b97c289a49db515f509c713f4b3f0df7b`},"vertical/chemistry/engineer/computational_chemistry/computational-validation-and-interpretation.md":{title:`计算收敛性与结论边界`,summary:`验证数值收敛、模型敏感性和适用范围,区分计算预测与实验测量,不外推为生物活性证明。`,originalName:`Computational Chemistry Convergence and Interpretation Validation`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-validation-and-interpretation.md`,sourceSha256:`ed1bffff26a5cb22ff61c60dcbf3464cbcff0f15200b9d604436bcd6243ab3f7`},"vertical/chemistry/engineer/computational_chemistry/electronic-structure-simulation-workflow.md":{title:`可复现电子结构与分子模拟`,summary:`组织分子或周期体系计算,分别检查方法选择和数值收敛,保留可复现的输入与输出。`,originalName:`Reproducible Electronic-Structure and Molecular Simulation Workflow`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/electronic-structure-simulation-workflow.md`,sourceSha256:`13c5d42ae2f417c7f16665e33f3660fad9f76163be2a08401edd57662ab6f22c`},"vertical/chemistry/engineer/crystallography/cif-and-structure-validation.md":{title:`CIF 与晶体结构检查`,summary:`核对格式、对称性、组成、几何、占位、位移参数和精修证据;不代替从头解结构。`,originalName:`CIF and Crystal Structure Validation`,source:`argus/domains/chemistry/skills/engineer/crystallography/cif-and-structure-validation.md`,sourceSha256:`b49527c827b69b5a37543059faf997fa8d0c9c3f60ed2c0a0e6807ddf5b0e802`},"vertical/chemistry/engineer/crystallography/diffraction-and-crystal-identity.md":{title:`衍射数据与晶体对象对齐`,summary:`核对单晶或粉末衍射的波长、几何、晶胞、对称性、物相及 CIF 来源。`,originalName:`Diffraction and Crystal Structure Identity`,source:`argus/domains/chemistry/skills/engineer/crystallography/diffraction-and-crystal-identity.md`,sourceSha256:`97367c0fad622c1d2ae19868b12a8de571bbc99c282c8b5eec4c4b97ed3615ed`},"vertical/chemistry/engineer/crystallography/structure-solution-and-refinement.md":{title:`晶体结构求解与精修`,summary:`结合数据处理、对称性检验、化学约束、残差和替代解释完成结构求解及精修。`,originalName:`Crystal Structure Solution and Refinement Workflow`,source:`argus/domains/chemistry/skills/engineer/crystallography/structure-solution-and-refinement.md`,sourceSha256:`8f5d913cf3bfc6c421f2d137ece735eba96e3b6840da63d6c4d40c22bc518e08`},"vertical/chemistry/engineer/foundations/chemical-identity-and-representation.md":{title:`化学对象与表达方式核实`,summary:`先核对分子、反应、材料、晶体、样品、序列或配方身份;这是跨领域基础,不替代专门流程。`,originalName:`Chemical Identity and Representation`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-identity-and-representation.md`,sourceSha256:`b1b0f0148ae94a1ad6ad60b6383cc8f6b1596b387d885ca896148486004ac392`},"vertical/chemistry/engineer/foundations/chemical-risk-and-authorization.md":{title:`化学风险与授权边界`,summary:`识别化学、生物、热、电、压力、辐射和仪器风险;文档建议不等于允许开展实体操作。`,originalName:`Chemical Risk and Authorization Boundary`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-risk-and-authorization.md`,sourceSha256:`2d6cb4a8421bb62bbde199f7aa131f5f678019ffbeed231f0676e9095f176b5e`},"vertical/chemistry/engineer/foundations/chemistry-workflow-output-contract.md":{title:`化学任务输入与交付约定`,summary:`明确输入、决策、能力核实、证据、验证方式、输出与停止条件,用于缺少更具体流程的任务。`,originalName:`Chemistry Workflow and Output Contract`,source:`argus/domains/chemistry/skills/engineer/foundations/chemistry-workflow-output-contract.md`,sourceSha256:`1b52c242611bb39cbbe929dc2bee8072e501ab56b23907df50a51c5c0b4f15fd`},"vertical/chemistry/engineer/foundations/computational-reproducibility.md":{title:`化学计算与分析的可复现性`,summary:`保留计算、模拟、数据处理和模型训练的输入、环境、数值设置、诊断与主要输出。`,originalName:`Chemistry Computational Reproducibility`,source:`argus/domains/chemistry/skills/engineer/foundations/computational-reproducibility.md`,sourceSha256:`d92b4a7b6e65c92138ef785a04a47f1fae6ab4ef2e6c4af111264cdc081a0bd8`},"vertical/chemistry/engineer/foundations/dataset-curation-and-leakage.md":{title:`化学数据整理与泄漏控制`,summary:`核对数据来源、去重、分组、标签和划分方式,避免分子、反应或样品间的信息泄漏。`,originalName:`Chemistry Dataset Curation and Leakage Control`,source:`argus/domains/chemistry/skills/engineer/foundations/dataset-curation-and-leakage.md`,sourceSha256:`ceeaf0a929c67df26cc91651721d943749c7e2c3bad6c7978cb78fa085bf948b`},"vertical/chemistry/engineer/foundations/evidence-provenance-and-claim-levels.md":{title:`化学证据来源与结论强度`,summary:`区分检索、整理、预测、计算、模拟、测量与推断,让结论不超出证据能支持的程度。`,originalName:`Chemistry Evidence Provenance and Claim Levels`,source:`argus/domains/chemistry/skills/engineer/foundations/evidence-provenance-and-claim-levels.md`,sourceSha256:`c8b6454e673aae3298d4089c1603b9edfe63c4be7f5f3ad8fd6f24ef2b2910f5`},"vertical/chemistry/engineer/foundations/failure-diagnosis-and-negative-results.md":{title:`化学任务失败与负结果分析`,summary:`保留失败证据,区分实现缺陷、资源问题和科学假设被否定,不把负结果隐去。`,originalName:`Chemistry Failure Diagnosis and Negative Results`,source:`argus/domains/chemistry/skills/engineer/foundations/failure-diagnosis-and-negative-results.md`,sourceSha256:`068cf8400d770fb6c97edbd26d6788adb1acc0e7d6ea00e3b14949c7a9a64a40`},"vertical/chemistry/engineer/foundations/uncertainty-and-applicability-domain.md":{title:`化学结果的不确定性与适用范围`,summary:`判断模型、计算、测量或文献结论能否用于当前实际体系,并量化或说明不确定性。`,originalName:`Chemistry Uncertainty and Applicability Domain`,source:`argus/domains/chemistry/skills/engineer/foundations/uncertainty-and-applicability-domain.md`,sourceSha256:`d552b6cad9e2a942e44a1a4c98647236488186458d3f2cd4bdd395a34c23d8ae`},"vertical/chemistry/engineer/foundations/units-conditions-and-normalization.md":{title:`化学单位与条件规范化`,summary:`比较不同来源前明确单位、计量基础、环境条件、样品归一方式和报告约定。`,originalName:`Chemical Units Conditions and Normalization`,source:`argus/domains/chemistry/skills/engineer/foundations/units-conditions-and-normalization.md`,sourceSha256:`540d6c4a3389900be51e3e9a7bdcf7f16169bb72246d53cbb1fbac247b527cde`},"vertical/chemistry/engineer/materials_science/materials-discovery-and-optimization.md":{title:`材料发现与优化研究`,summary:`限定设计空间、性质目标、基线与不确定性,组织可验证的筛选或工艺优化,不替代晶体精修。`,originalName:`Materials Discovery and Optimization Workflow`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-discovery-and-optimization.md`,sourceSha256:`02d2aeacb74302eb2853345772f5096cce5b26db15ab5d229a210ccfabe04cbd`},"vertical/chemistry/engineer/materials_science/materials-identity-processing-and-property-data.md":{title:`材料组成、工艺与性能数据`,summary:`统一组成、物相、工艺历史、样品形态、微结构和测试条件,建立可比的性能记录。`,originalName:`Materials Identity Processing and Property Data`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-identity-processing-and-property-data.md`,sourceSha256:`ec0ac9c5a4b62eb9d027a97f9c78cc9ed986776e48f9f3bbf94f015a8d689521`},"vertical/chemistry/engineer/materials_science/processing-structure-property-validation.md":{title:`工艺—结构—性能关系验证`,summary:`用可比样品、对照和不确定性检验材料关系声明,保留机理解释的适用边界。`,originalName:`Materials Processing Structure Property Validation`,source:`argus/domains/chemistry/skills/engineer/materials_science/processing-structure-property-validation.md`,sourceSha256:`7c556e48b0b97de122d0f342839c92ece5e33f36c1aa3f7efbcc6fbc319ea06c`},"vertical/chemistry/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md":{title:`MOF 构筑单元与拓扑识别`,summary:`从来源结构核实节点、连接体、连通性、穿插、缺陷、客体和网络拓扑,不以普通 CIF 检查代替。`,originalName:`MOF Framework Identity Node Linker and Topology`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md`,sourceSha256:`7a6490bd8dad40deeb548f03541673b91df2bd9bddbe3e9c8cf58d73b3ee31b8`},"vertical/chemistry/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md":{title:`MOF 数据、预测与结构生成`,summary:`组织拓扑相关去重、泄漏控制、性质预测和生成结构的分阶段验证;生成不等于可合成。`,originalName:`MOF Datasets Prediction and Structure Generation`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md`,sourceSha256:`8f1d023caf19aeb5801036cc58e2531cd8d39bb398008a4b614c654b3073ab51`},"vertical/chemistry/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md":{title:`MOF 孔隙、吸附与性质分析`,summary:`关联原始等温线、活化和样品状态,检查孔隙、吸附、输运模型及不确定性。`,originalName:`MOF Porosity Adsorption and Structure Property Workflow`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md`,sourceSha256:`98088eef9fa108d0f0aa8fab9f746315414cc64edbcfab0d0da8accd4ab83b0b`},"vertical/chemistry/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md":{title:`MOF 合成与后处理证据`,summary:`整理合成、活化、溶剂交换、缺陷调节和后修饰的证据,核对样品关联与表征要求。`,originalName:`MOF Synthesis Activation and Postsynthetic Evidence`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md`,sourceSha256:`b65377f7d995a638f721e8dea34a99807e97c948ec274bbc3f9cc1d35ccf1f5a`},"vertical/chemistry/engineer/organic_synthesis/reaction-identity-and-records.md":{title:`有机反应对象与记录对齐`,summary:`核对反应物、映射、计量、立体化学、条件、后处理和收率,用于路线或数据整理。`,originalName:`Organic Reaction Identity and Records`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/reaction-identity-and-records.md`,sourceSha256:`02221beebf4e39d9bd0e5c4090de61aba6596ceb48fb3a5f29b3e54466999d87`},"vertical/chemistry/engineer/organic_synthesis/retrosynthesis-and-route-design.md":{title:`有机逆合成与路线设计`,summary:`结合目标、断键、已有先例、选择性、供应和安全设计候选路线;候选仍需证据验证。`,originalName:`Organic Retrosynthesis and Route Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/retrosynthesis-and-route-design.md`,sourceSha256:`6ee1e514bf05cc052de12ee39497c783d1dd6ca9549335cbe62e7f2106ec8de4`},"vertical/chemistry/engineer/organic_synthesis/route-validation-and-experiment-design.md":{title:`有机路线验证与实验设计`,summary:`把候选路线转化为有对照、分析读数和停止条件的验证计划;不授权自动开展实体实验。`,originalName:`Organic Route Validation and Experiment Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/route-validation-and-experiment-design.md`,sourceSha256:`9a543fdca5cc4fa3ed0cc9cef2395af55ffaa35758b3c36895a2309d1d09dc80`},"vertical/chemistry/engineer/tools/aizynthfinder.md":{title:`AiZynthFinder 逆合成候选`,summary:`在明确模型、原料库、配置和预算后使用本地搜索生成候选路线;搜索结果不是可行性证明。`,originalName:`AiZynthFinder Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/aizynthfinder.md`,sourceSha256:`fd406198b2a436d954aefb95c1062f945e08cf98806ca7ceaba5d402c006f4dc`},"vertical/chemistry/engineer/tools/askcos.md":{title:`ASKCOS 路线与反应预测`,summary:`仅使用已获授权的部署,记录接口、模型、数据库、预算与结果来源;不假定已有服务权限。`,originalName:`ASKCOS Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/askcos.md`,sourceSha256:`31689603c8f5b80f2ed94a25ef05148edf311287e64bf336fc98fea5aeeaf486`},"vertical/chemistry/engineer/tools/chembl.md":{title:`ChEMBL 生物活性资料检索`,summary:`检索分子、靶点、实验和活性记录,核对版本、单位及来源;已有记录不证明新体系的活性。`,originalName:`ChEMBL Bioactivity Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/chembl.md`,sourceSha256:`9b33111794504afb064302785f66bd7fcbccac9e855d83df0eb84297f00b4863`},"vertical/chemistry/engineer/tools/chemcrow.md":{title:`ChemCrow 工具集成参考`,summary:`研究公开工具集成方式及其依赖、安全和证据要求;架构借鉴不等于复现论文结果。`,originalName:`ChemCrow Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemcrow.md`,sourceSha256:`877388249df2ed635a78ae2edb68b1d25fa2cd5305eec4e09c289fb0f1bd1ba3`},"vertical/chemistry/engineer/tools/chemos.md":{title:`ChemOS 实验室编排参考`,summary:`仅在设备服务、设施归属、安全联锁、数据约定和恢复机制已具备时评估编排能力。`,originalName:`ChemOS Orchestration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemos.md`,sourceSha256:`2dbb97df4b7107f08f00bbdd88fef587eda0b6d3d04e5850b619550e7a9c4cc3`},"vertical/chemistry/engineer/tools/coscientist.md":{title:`Coscientist 系统集成参考`,summary:`依据确切公开实现借鉴组件和架构,保留授权边界;不宣称得到可直接运行的自主实验室。`,originalName:`Coscientist Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/coscientist.md`,sourceSha256:`8a47d850deb1d7dfb2ddeecbea4cba38ceecec129a6e2b2d8ad403e9bbff5252`},"vertical/chemistry/engineer/tools/deepchem.md":{title:`DeepChem 分子机器学习`,summary:`先明确目标、对象、分组、泄漏控制、基线和适用范围,再选择数据、特征、模型与评估工具。`,originalName:`DeepChem Molecular Machine Learning`,source:`argus/domains/chemistry/skills/engineer/tools/deepchem.md`,sourceSha256:`27a9bd06792446cfeeafb63db293fcd8305d59ca3da164810e1267c13e6dcdeb`},"vertical/chemistry/engineer/tools/guacamol.md":{title:`GuacaMol 分子设计基准`,summary:`按确定任务、评分、参考数据、预算和有效性检查评估方法;结论仅限对应基准。`,originalName:`GuacaMol Molecular Design Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/guacamol.md`,sourceSha256:`f626a4b92ec2b081620f5da146f6baebe3b5cc44df824e77fc2becd0b3e87e7e`},"vertical/chemistry/engineer/tools/olympus.md":{title:`Olympus 反应优化基准`,summary:`使用规划器和模拟曲面作有对照的优化研究,明确参数空间、噪声和预算;模拟不等于实体实验。`,originalName:`Olympus Reaction Optimization`,source:`argus/domains/chemistry/skills/engineer/tools/olympus.md`,sourceSha256:`160f357db2ec4527b7368d2b41a2ab43d2ab6b76130e8a27b2a035e0531c4be2`},"vertical/chemistry/engineer/tools/openbabel.md":{title:`Open Babel 化学格式转换`,summary:`转换结构格式并核对解析、氢原子、坐标和互操作性,保留原始身份及转换来源。`,originalName:`Open Babel Structure Conversion`,source:`argus/domains/chemistry/skills/engineer/tools/openbabel.md`,sourceSha256:`6eca4f250101ad817f624a76ca6c22193c73fd67a8d13d76a39bcf07d848fd75`},"vertical/chemistry/engineer/tools/orca.md":{title:`ORCA 量子化学计算`,summary:`在用户提供并授权的安装上计算,记录版本、分子状态、方法、基组、数值设置和主要输出。`,originalName:`ORCA Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/orca.md`,sourceSha256:`683637ad2fb781da58295e67229859794085fb01fcaaa43c10e11e13c8a91085`},"vertical/chemistry/engineer/tools/ord.md":{title:`开放反应数据库读写规范`,summary:`按数据库结构验证反应角色、数量、条件、结果与来源;结构有效不等于实验可复现。`,originalName:`Open Reaction Database I/O`,source:`argus/domains/chemistry/skills/engineer/tools/ord.md`,sourceSha256:`eb81cbde5711e04c578cc89a5b233a3de109c5b68b7322adeefd0996df21b8da`},"vertical/chemistry/engineer/tools/psi4.md":{title:`Psi4 量子化学计算`,summary:`明确分子状态、方法、基组、选项、收敛和单位,保留计算输出来源。`,originalName:`Psi4 Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/psi4.md`,sourceSha256:`2d8bf9817a90f90fe2407d8e4d71e6ffbf431f64207f61b8c2fca8acda199a69`},"vertical/chemistry/engineer/tools/pubchem.md":{title:`PubChem 公共资料检索`,summary:`通过核实的标识和带日期的查询取得公共化合物、性质及安全记录,保留原始响应与来源边界。`,originalName:`PubChem PUG REST Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/pubchem.md`,sourceSha256:`9aa66ea316f8180a29884f78b1ae927adf55f727476fa0529c01e7300161c89e`},"vertical/chemistry/engineer/tools/pyscf.md":{title:`PySCF 电子结构计算`,summary:`先确定电荷、自旋、几何、方法、基组、边界和收敛要求,再组织分子或周期体系计算。`,originalName:`PySCF Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/pyscf.md`,sourceSha256:`9ccb368195807ed7390cf2397506d004f849ccd1c0e1d51532b31e42e579dbc2`},"vertical/chemistry/engineer/tools/rdkit.md":{title:`RDKit 分子数据处理`,summary:`用于解析、规范化、立体化学、子结构、描述符、指纹与构象等处理;不直接证明化学身份或可行性。`,originalName:`RDKit Molecular Integrity`,source:`argus/domains/chemistry/skills/engineer/tools/rdkit.md`,sourceSha256:`b9330a5a8c90fb31bf3b551555d4f439cca90f9ecd45506734ce5051628ee074`},"vertical/chemistry/engineer/tools/tdc.md":{title:`TDC 药物研究数据基准`,summary:`使用明确任务、版本、许可、划分和评估器开展比较,核对污染与证据边界。`,originalName:`Therapeutics Data Commons Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/tdc.md`,sourceSha256:`a1aaed9bff60b1df25ccc8a9846ebcd30784c1f814cb20633e8a5ef57e11decb`},"vertical/chemistry/engineer/workflows/chemistry-playground.md":{title:`受限化学假设试探`,summary:`仅对明确提出的候选问题开展有边界的计算优先试探,保留问题、结果和负证据,并经过评审。`,originalName:`Chemistry Playground Bounded Hypothesis Probe`,source:`argus/domains/chemistry/skills/engineer/workflows/chemistry-playground.md`,sourceSha256:`72326a42543600e3fffedf0562c171466cc25b433cb8c05913e9fcfac3eb2d12`},"vertical/chemistry/manager/chemistry-manager.md":{title:`化学任务协调与分流`,summary:`为科学问题选择专门技能组合,保留原研究阶段、证据强度与授权边界。`,originalName:`Chemistry Manager Context`,source:`argus/domains/chemistry/skills/manager/chemistry-manager.md`,sourceSha256:`ecc7e16be351188d3c6ae75aa0e55c4b3978f1916e67c45754766cb63085f336`},"vertical/chemistry/planner/chemistry-planning.md":{title:`化学研究规划`,summary:`选择最贴合任务的流程,保持证据和安全要求;未完成时才安排具有科学判别力的后续工作。`,originalName:`Chemistry Research Planning`,source:`argus/domains/chemistry/skills/planner/chemistry-planning.md`,sourceSha256:`c9258fa062f3853d7a04950d0e0045b10be65c41c11248d6fe5c981e0ed02e02`},"vertical/chemistry/reviewer/battery-review.md":{title:`电池与电化学证据评审`,summary:`独立核对电芯身份、协议可比性、单位、循环退化证据和防泄漏模型评估。`,originalName:`Battery and Electrochemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/battery-review.md`,sourceSha256:`e0aa8763587e38281b5c2c5b6f7c92b3e07264b1cee076539751de8971d87725`},"vertical/chemistry/reviewer/biochemistry-review.md":{title:`生化与化学生物学评审`,summary:`检查构建体、结构、实验、动力学、模拟和功能声明,保留各自对照与结论边界。`,originalName:`Biochemistry and Chemical Biology Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/biochemistry-review.md`,sourceSha256:`68f2cc57f10d6c9bf30c41c249ebe7fc192b8ac4b763cb6ff40d9a41377135d0`},"vertical/chemistry/reviewer/characterization-review.md":{title:`化学表征证据评审`,summary:`独立核对原始仪器数据、校准、对照、归属和多模态证据,避免用通用解释越过测试边界。`,originalName:`Chemical Characterization Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/characterization-review.md`,sourceSha256:`3ba8858ac408729e78fa27a9338cd6eb435bd64d38da803d837aaec111ef8d67`},"vertical/chemistry/reviewer/chemistry-playground-review.md":{title:`化学试探结果评审`,summary:`检查受限问题与结果、证据和状态历史,防止未经确认的探索被当作正式科学结论。`,originalName:`Chemistry Playground Promotion Gate`,source:`argus/domains/chemistry/skills/reviewer/chemistry-playground-review.md`,sourceSha256:`309f1ff685c93c46c47239d9db1a3b85c41c6c384e986532e774ed3795e8d3c0`},"vertical/chemistry/reviewer/chemistry-review.md":{title:`化学研究综合评审`,summary:`按问题转交专门评审方法,核对对象、原始证据、对照、可复现性、不确定性和安全要求。`,originalName:`Chemistry Research Review`,source:`argus/domains/chemistry/skills/reviewer/chemistry-review.md`,sourceSha256:`bc2587f915788c94f8de55a0f2947a18e7bd368cccf1b400d1479e1681c64cf7`},"vertical/chemistry/reviewer/computational-review.md":{title:`计算化学证据评审`,summary:`审查输入身份、数值收敛、方法有效性,以及计算结果和测量结果之间的界线。`,originalName:`Computational Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/computational-review.md`,sourceSha256:`cab134d61ce5d45bf0240d2219eca03002e7b6315c4abf3738c2740229353e68`},"vertical/chemistry/reviewer/crystallography-review.md":{title:`晶体学证据评审`,summary:`独立检查衍射、对称性、精修、CIF、物相声明和结构不确定性,不替代其他领域评审。`,originalName:`Crystallography Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/crystallography-review.md`,sourceSha256:`034223d76528f09aede5febdb7fff1c848819f82564a8be7acf23ebc1a25d369`},"vertical/chemistry/reviewer/materials-science-review.md":{title:`材料科学证据评审`,summary:`核对非 MOF 材料的身份、工艺、性质和发现声明,不把结论跨用到晶体精修或电池循环。`,originalName:`Materials Science Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/materials-science-review.md`,sourceSha256:`ac639340d34bc5dae734e9f9841e91762cb31ec42c73c5a108dc69b25c2b76ba`},"vertical/chemistry/reviewer/mof-reticular-chemistry-review.md":{title:`MOF 与网状化学证据评审`,summary:`核对构筑单元、拓扑、合成活化、孔隙吸附、后修饰、数据与生成结构的证据。`,originalName:`MOF and Reticular Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/mof-reticular-chemistry-review.md`,sourceSha256:`d095ca81ab168c658696b20de0e149647cdbfcffe545cff73e3ed9ccaeb37dcf`},"vertical/chemistry/reviewer/organic-synthesis-review.md":{title:`有机合成与逆合成评审`,summary:`独立核对反应记录、路线先例、选择性、分析证据、安全和实际可行性声明。`,originalName:`Organic Synthesis and Retrosynthesis Review`,source:`argus/domains/chemistry/skills/reviewer/organic-synthesis-review.md`,sourceSha256:`0ce7fdeee239a78b9d74f7e64dbd55b38d99b9e88bf141399ec999d30f519ad0`},"vertical/chemistry/scientist/chemistry-adaptation.md":{title:`根据证据改进化学方法`,summary:`只有证据显示现有方法在对象、能力、验证或安全等机制层面存在缺口时,才调整可复用流程。`,originalName:`Chemistry Skill Adaptation`,source:`argus/domains/chemistry/skills/scientist/chemistry-adaptation.md`,sourceSha256:`d231961e4c85bee737df313c376e046dba50ed5a375460a924176db507f8ee9a`},"vertical/chemistry/scientist/chemistry-distillation.md":{title:`沉淀可复用化学流程`,summary:`在技能匹配缺失后归纳带范围、证据、验证和停止条件的方法,而不是保存目标答案或工具教程。`,originalName:`Chemistry Skill Distillation`,source:`argus/domains/chemistry/skills/scientist/chemistry-distillation.md`,sourceSha256:`1f7c9b2cddae0e19332d6e38edbac2671026d04e5ca0f3203f3d777e5e51d010`},"vertical/kernel_engineering/engineer/kernel-benchmark-measurement-integrity.md":{title:`GPU 算子工程:先算屋顶线,隔离测量`,summary:`先用屋顶线定瓶颈再改机制而非参数;一次干净的隔离运行足以筛选想法,要主张或保留的提升必须在官方条件下测量;审阅只看正确性与基准证据。`,originalName:`Kernel Engineering: Roofline First, Measure in Isolation`,source:`argus/verticals/kernel_engineering/skills/engineer/kernel-benchmark-measurement-integrity.md`,sourceSha256:`b6bbe44b147dfea2dd68810db53571a9fae5db238c2bcde24d51c79756bf1785`},"vertical/learning/learning-curation.md":{title:`学习任务的整理与审阅`,summary:`把操作者材料变成有证据锚点的项目 Skill/Wiki 修改或诚实的空操作,说明 CHANGE_PLAN.json 的约定以及审阅者如何判断修改是否忠实、无冗余、不倒退、层级正确。`,originalName:`Learning Curation`,source:`argus/verticals/learning/skills/learning-curation.md`,sourceSha256:`71490b8d95eecb97a88a18e8bc4dd0a1aa163d7c0f82a02114440aae1f5f6999`},"vertical/math/engineer/math-research-execution.md":{title:`数学研究执行`,summary:`忠实保留命题与范围,诚实区分结果类别;需要 Lean 证据时实际编译,不虚构证明。`,originalName:`Math Research Execution`,source:`argus/verticals/math/skills/engineer/math-research-execution.md`,sourceSha256:`ddcf8321ce873130c1de3e71b78d816115182813e8a6dfdd4bc89d0fe9629736`},"vertical/math/manager/math-research-manager.md":{title:`数学研究任务协调`,summary:`在通用协调流程中保持研究目标、范围、求解和评审职责,不另造一套权限体系。`,originalName:`Math Research Manager Context`,source:`argus/verticals/math/skills/manager/math-research-manager.md`,sourceSha256:`e228b24cd82e6dee678458b5e32c4e1fc6092151b06c7eee198b158bdd1a1b95`},"vertical/math/planner/math-research-planning.md":{title:`数学研究规划`,summary:`围绕范围界定、求解和评审安排动态任务,保持原有角色与生命周期规则。`,originalName:`Math Research Planning`,source:`argus/verticals/math/skills/planner/math-research-planning.md`,sourceSha256:`e3320bf8a0b986eae0251ce1004962659ab2a9505a2cc73da63c33b94d2799f4`},"vertical/math/reviewer/math-research-review.md":{title:`数学研究独立评审`,summary:`检查正确性、新意、意义、命题忠实性和真实形式化证据,不以叙述代替证明。`,originalName:`Math Research Review`,source:`argus/verticals/math/skills/reviewer/math-research-review.md`,sourceSha256:`21b7e0f172bbb695ae9950c0e9dd1cdac60ae6aa21df0962a88a1b06ba505251`},"vertical/math/scientist/math-research-adaptation.md":{title:`改进数学研究方法`,summary:`在评审确认方法失败或技能缺口后,按已有适应阶段调整可复用方法。`,originalName:`Math Research Scientist Adaptation`,source:`argus/verticals/math/skills/scientist/math-research-adaptation.md`,sourceSha256:`fd8961cb0155e3fc05428cf0b5dbd6be86ed048636dc657b3b23abbee6495933`},"vertical/math/scientist/math-research-distillation.md":{title:`沉淀数学研究方法`,summary:`在首次匹配缺失后整理可复用研究方法,不假定已经失败,也不代替当前任务的执行。`,originalName:`Math Research Skill Distillation`,source:`argus/verticals/math/skills/scientist/math-research-distillation.md`,sourceSha256:`83a7367798b1ac327861deaa94accf1d77da0e140ebc8da8137442a30a83b09a`},"vertical/research/engineer/ablation-planner.md":{title:`选择有判别力的消融实验`,summary:`只选择能区分结果解释、说明所选方法作用的必要消融,而不是机械穷举组合。`,originalName:`Choosing ablations that distinguish explanations`,source:`argus/verticals/research/skills/engineer/ablation-planner.md`,sourceSha256:`f5c9bff3d6b5bc9dc4b50316e172856fcc01d708685c08a1ff29650871369858`},"vertical/research/engineer/method-card.md":{title:`方法卡、可执行规范与审阅锚点`,summary:`在 METHOD.md 中写清方法、组件、协议和证伪条件;以钉版参考实现为底把方法写成 diff;先写 tests/spec 再跑承载论断的实验;用代码锚点让不在场的审阅者找到机制;规划者据此写实现简报。`,originalName:`Method card (METHOD.md), executable spec and review anchors`,source:`argus/verticals/research/skills/engineer/method-card.md`,sourceSha256:`2e756a2fd09bca2abe4175fea4042af6905a6166b629c940909b10090cfe6855`},"vertical/research/engineer/novelty-check.md":{title:`检验研究想法的新意`,summary:`通过当前来源对照最接近的已有工作,判断一条候选想法的差异,而非先宣称创新。`,originalName:`Testing the idea's novelty`,source:`argus/verticals/research/skills/engineer/novelty-check.md`,sourceSha256:`e20a0f4290c72b07c9b09fa77633ecc915f0f7a8b90d8efd4c627fb9d12f8c16`},"vertical/research/engineer/paper-chart-styling.md":{title:`论文数据图样式`,summary:`统一数据图的配色、尺寸、标记和字体嵌入,遵守所选期刊会议版式;不改变数据本身。`,originalName:`Styling data figures for publication`,source:`argus/verticals/research/skills/engineer/paper-chart-styling.md`,sourceSha256:`c40b9f431de9cd01f16e245d819563566fc5db02c2217505599921adcca65b75`},"vertical/research/engineer/paper-framework-figure-studio.md":{title:`论文图的路线选择与概念图编排`,summary:`按表达内容选渲染路线:数据图走 SciencePlots/Matplotlib,概念与框架图默认以图像蓝图重建为可编辑 PPT,无图像接口时直接原生绘制;生成图像只用于不承载论断的部分。`,originalName:`Composing a conceptual paper figure`,source:`argus/verticals/research/skills/engineer/paper-framework-figure-studio.md`,sourceSha256:`e01ffd101b8fcd701b86918d93994079dfc87d9df79dbcd348bdfe3508cfcd9b`},"vertical/research/engineer/references/ideation/ideation-patterns/overview.md":{title:`研究构思模式总览`,summary:`汇总各研究构思模式的定义、操作特征与适用时机,帮助为路线挑选机制视角;模式在语料中常见不代表适合当前问题,也不替代创新性与正确性验证。`,originalName:`engineer/references/ideation/ideation-patterns/overview`,source:`argus/verticals/research/skills/engineer/references/ideation/ideation-patterns/overview.md`,sourceSha256:`8b2b43b5ce63c70a1b54c0ff5fb3f1954bc8ef6c05bda95a71a011d2f5f4eb34`},"vertical/research/engineer/references/paper-writing-craft.md":{title:`论文写作方法参考`,summary:`提供论文论证和表达的写作参考,需结合真实证据与所选期刊会议要求使用。`,originalName:`engineer/references/paper-writing-craft`,source:`argus/verticals/research/skills/engineer/references/paper-writing-craft.md`,sourceSha256:`bd645d2f2f48987c988c54b6b22843b22ee3b5a9dc0ce950bff4acdc0fcf3eeb`},"vertical/research/engineer/research-grind.md":{title:`沿诊断阶梯打磨研究结果`,summary:`把首次实现当作草稿,在固定声明下沿诊断阶梯逐级排查;结果异常先怀疑设置;从原始逐种子行算数;依据证据而非尝试次数判断何时足够。`,originalName:`Working a research result into shape`,source:`argus/verticals/research/skills/engineer/research-grind.md`,sourceSha256:`e955fe1ac7aa975a9172394bdca4e8b2ed6a504355ab00573a26badf442f038a`},"vertical/research/engineer/rl-training-collapse-diagnosis.md":{title:`强化学习训练健康诊断`,summary:`检查奖励、优势、梯度、KL、截断和吞吐异常,先诊断配置与过程,再归因方法;不同训练目标不能混用规则。`,originalName:`RL Training Health Diagnosis`,source:`argus/verticals/research/skills/engineer/rl-training-collapse-diagnosis.md`,sourceSha256:`d48fd69adaac73ad45c41cd9565798a94a476de52c9354097abe2d8604db8782`},"vertical/research/engineer/sources-and-citations.md":{title:`对照来源核对论断与引用`,summary:`把稿件中的论断对回支撑它的证据,把引用对回被引的原文,并用 Semantic Scholar 核对版本;补充全局的一手来源技能,不另起一轮整篇审阅。`,originalName:`Checking claims and citations against their sources`,source:`argus/verticals/research/skills/engineer/sources-and-citations.md`,sourceSha256:`450410c4b428e31104819c07a98e19b615ced499e0d2d4df473305ca789d55ed`},"vertical/research/engineer/training-infrastructure.md":{title:`训练基础设施的选择、搭建与调参`,summary:`训练或大规模推理需要框架时,用实时来源调查候选、在隔离环境中试装并剖析一步真实更新、以官方配方为锚每次只改一个因素,并把结论写成带日期的项目决策记录;不按记忆推荐技术栈。`,originalName:`Training infrastructure: choosing, standing up and tuning it`,source:`argus/verticals/research/skills/engineer/training-infrastructure.md`,sourceSha256:`4c495369ffba7ff2b9954a2fafd72b874e63abc6065a5afab7c61ce10afb9087`},"vertical/research/engineer/venue-format-preflight.md":{title:`投稿前的编译与泄露检查`,summary:`用目标会场的官方作者模板编译完整稿件并核对结构,同时检查稿件没有泄露内部路径、角色名与运行时用语。`,originalName:`Preparing the draft for the venue`,source:`argus/verticals/research/skills/engineer/venue-format-preflight.md`,sourceSha256:`e146afba818a8436d0807aff610084d6a321277778e7ce299bd96f9f57795eb0`},"vertical/research/engineer/venue-format-research.md":{title:`选择投稿目标并核对要求`,summary:`根据研究内容选择合适期刊会议,获取当前官方作者要求,而非沿用过时模板。`,originalName:`Choosing a venue and reading its requirements`,source:`argus/verticals/research/skills/engineer/venue-format-research.md`,sourceSha256:`aad2d0ec25649231ec233f4abb5b216af313a7a1dfa699cc6f0c8b23be7cbcf2`},"vertical/research/engineer/venue-paper-drafting.md":{title:`面向投稿目标撰写论文`,summary:`先定论证形状,按所选作者模板和确认的证据写完整论文,读一次强范文校准视觉与结构标准;不把未验证探索写成既定结论。`,originalName:`Writing for the selected venue`,source:`argus/verticals/research/skills/engineer/venue-paper-drafting.md`,sourceSha256:`d7bb7d7e59f5ce6e20433fa843e3d7002575b1892b131c0d0f7f247e986281f1`},"vertical/research/research-experiment-playbook.md":{title:`通过实验发展研究想法`,summary:`忠实实现已选想法,通过适应性实验形成足以支撑论文的证据,而不是只完成首次运行。`,originalName:`Developing an idea through experiments`,source:`argus/verticals/research/skills/research-experiment-playbook.md`,sourceSha256:`df8f6a724b93f063a6e0dd2e36af1838fca72eea689f062b096d3ad0c4ad2c85`},"vertical/research/research-idea-playbook.md":{title:`寻找并选择研究想法`,summary:`从来源中发现候选可能性,经独立审查后作最终选择,不把构思直接当作实验结果。`,originalName:`Finding a research idea`,source:`argus/verticals/research/skills/research-idea-playbook.md`,sourceSha256:`91104461d9115ee280db1f5e89d3c35bc8301422bfd7d9a70c66fa559c09eed6`},"vertical/research/research-paper-playbook.md":{title:`撰写完整研究论文`,summary:`从已确认的正向证据组织论文、编译并准备投稿材料,保持证据与论述一致。`,originalName:`Writing the research paper`,source:`argus/verticals/research/skills/research-paper-playbook.md`,sourceSha256:`2efcabc2904fe55831b0f5d9c61846c544aab2a211687f0fbf51ad417e66afec`},"vertical/research/research-review-playbook.md":{title:`对论文形成独立判断`,summary:`综合科学性、图示、语言和整体论证,判断工作是否成立并提出建设性意见。`,originalName:`Reaching a judgment on the paper`,source:`argus/verticals/research/skills/research-review-playbook.md`,sourceSha256:`368d0bc3b8dba80c1e8d84257a10f95bbe2124a35d03a30e553e1d6b56ae829a`},"vertical/research/reviewer/academic-paper-peer-review-benchmark.md":{title:`按目标期刊会议评审论文`,summary:`以独立评审视角判断当前稿件,提供科学指导并更新评审记录。`,originalName:`Reading the paper as a venue reviewer`,source:`argus/verticals/research/skills/reviewer/academic-paper-peer-review-benchmark.md`,sourceSha256:`6446f17af2a751bd9570b4351e4b28d84d09cc06ed2c59174111f17f39e0cbc9`},"vertical/research/reviewer/claim-to-code-trace.md":{title:`追溯声明到实际代码`,summary:`沿配置和执行路径核对公式、比较条件与观测,判断研究声明是否对应实际产生证据的代码。`,originalName:`Claim-to-Code Trace`,source:`argus/verticals/research/skills/reviewer/claim-to-code-trace.md`,sourceSha256:`fef3ef16ce27a9c1e9ec5f095c73bb734da06aedba74fa994122e28d32c293ee`},"vertical/research/reviewer/experiment-results-review.md":{title:`判断实验真正说明了什么`,summary:`亲自读代码、配置、评测器和原始行,判断证据对固定声明的支持与缺口;低于基线的结果在阶梯未走完前是修复请求;训练类实验另核对基础设施决策记录。`,originalName:`What the experiments establish`,source:`argus/verticals/research/skills/reviewer/experiment-results-review.md`,sourceSha256:`bc158d8b51107b697d290eb6ed461f2a596aa601bc78cce7e88089743411533e`},"vertical/research/reviewer/strongest-argument-against.md":{title:`寻找最有力的科学反对意见`,summary:`在最终评审中识别论文最关键的科学弱点,不通过直接改稿掩盖它。`,originalName:`The strongest argument against the paper`,source:`argus/verticals/research/skills/reviewer/strongest-argument-against.md`,sourceSha256:`6cc3e7990dacb420a04ff945cb1f221852bd249b981a60def70dfcace2ac3418`},"vertical/research/reviewer/venue-academic-language-review.md":{title:`审查论文论证与学术表达`,summary:`对照目标期刊会议的当前惯例阅读论证与语言,指出问题,不擅自编辑论文。`,originalName:`Reading the paper's argument and language`,source:`argus/verticals/research/skills/reviewer/venue-academic-language-review.md`,sourceSha256:`a2fe9faf57ff0a09181f42de2ac2b5080158e08c430078fb48722fd6b9893f66`},"vertical/software/engineer/software-change-implementation.md":{title:`有边界的软件实现与拆解`,summary:`结合仓库结构选择合适工具,以与任务规模相称的检查完成软件修改;分阶段工作按架构边界拆解,每个任务写明兼容性风险与独立预言机。`,originalName:`Software Change Implementation`,source:`argus/verticals/software/skills/engineer/software-change-implementation.md`,sourceSha256:`34dad5e10c880fb48964573768b72d8377829ca8163ddd21987c2c05538d70a9`},"vertical/software/reviewer/software-change-review.md":{title:`软件修改独立评审`,summary:`检查真实调用路径、兼容性与验证证据,不依赖参考答案或仅凭完成声明判断。`,originalName:`Software Change Review`,source:`argus/verticals/software/skills/reviewer/software-change-review.md`,sourceSha256:`5d1a66ff65accae04ec02005724735c9767308ac63c005b8be6e269eb9acb25f`}};function tn(e){if(!e.is_default||![`bundled`,`shared`].includes(e.source)||!(e.scope===`global`?[`global:${e.source}`]:e.scope===`vertical`?[`vertical:${e.vertical}:${e.source}`,...e.source===`bundled`?[`domain:${e.vertical}:bundled`]:[]]:[]).includes(e.library))return null;let t=e.scope===`global`?`global/${e.path}`:`vertical/${e.vertical}/${e.path}`,n=Object.hasOwn(en,t)?en[t]:null;return n?.originalName===e.name?n:null}function nn(e,t){let n=t===`zh-CN`?tn(e):null;return{title:n?.title??e.name,summary:n?.summary??e.description,guide:n}}function rn(e,t){let n=nn(e,t);return`${e.name} ${e.description} ${e.path} ${e.vertical} ${n.title} ${n.summary}`.toLocaleLowerCase()}var an={research:`科研`,software:`软件开发`,math:`数学研究`,chemistry:`化学`,kernel_engineering:`GPU 算子工程`,argus_maintenance:`Argus 维护`,learning:`资料学习`};function on(e,t){return t===`zh-CN`&&Object.hasOwn(an,e)?an[e]:e}var sn={fact:[`记录可核对的环境、对象或事实,供后续工作查证;记录本身不保证事实仍然有效。`,`Records checkable facts for later verification; a saved record is not a guarantee that it is still current.`],lesson:[`保留工作中得到的经验和问题,帮助类似任务少走弯路;不能代替当前证据或评审。`,`Keeps lessons from work to inform similar tasks; it does not replace current evidence or review.`],survey:[`整理问答或调研材料与来源,为后续查阅提供线索;结论仍需结合原文核对。`,`Organizes answers or research and their sources for later reference; check conclusions against the original evidence.`],principles:[`归纳可反复参考的建议,帮助选择方法;应检查所引用的经验与适用条件。`,`Distills recurring guidance for choosing methods; check the cited lessons and applicability.`],note:[`保存关于你的背景、偏好或计划,帮助后续任务理解上下文;不是工具使用授权。`,`Keeps personal context, preferences or plans for later work; it is not authorization to use tools.`],profile:[`汇总 Argus 对你的背景与偏好的了解,方便核对是否准确;不代表公开资料或任务完成情况。`,`Summarizes personal context and preferences for inspection; it is neither a public record nor a task-completion report.`],page:[`一般参考资料。具体用途取决于原文和来源,不能仅凭“已保存”判断内容可靠或适用。`,`General reference material. Its use depends on the original content and sources, not merely on being saved.`]};function cn(e,t){return(Object.hasOwn(sn,e)?sn[e]:sn.page)[t===`zh-CN`?0:1]}var ln={private:[`你的个人背景资料,与共享知识分开保存。这里不改变既有读取权限或模型的数据处理方式。`,`Personal context is stored separately from shared knowledge. This view does not change existing access or model data handling.`],global:[`跨项目参考的通用资料;不要把个人信息当作公共知识放在这里。`,`General reference across projects; personal information does not belong in shared knowledge.`],vertical:[`同一领域可复用的专门资料,使用前仍要核对当前任务的条件。`,`Domain-specific reference; verify that it applies to the current task.`],project:[`围绕当前项目保存的资料与背景;分类不是操作系统沙箱或文件权限边界。`,`Material associated with this project; the category is not an OS sandbox or file-permission boundary.`]};function un(e,t){return Object.hasOwn(ln,e)?ln[e][t===`zh-CN`?0:1]:t===`zh-CN`?`范围尚未确认,请以来源说明为准。`:`Scope not confirmed; consult the source.`}var dn={active:`label.status.inProgress`,claimed:`label.status.inProgress`,in_progress:`label.status.inProgress`,running:`label.status.inProgress`,working:`label.status.inProgress`,pending:`label.status.waiting`,queued:`label.status.waiting`,waiting:`label.status.waiting`,idle:`label.status.waiting`,accepted:`label.status.completed`,complete:`label.status.completed`,completed:`label.status.completed`,done:`label.status.completed`,success:`label.status.completed`,blocked:`label.status.blocked`,failed:`label.status.failed`,error:`label.status.failed`,rejected:`label.status.needsChanges`,continue:`label.status.needsChanges`,skipped:`label.status.skipped`,paused:`label.status.paused`,paused_cost:`label.outcome.costUnreconciled`,stopped:`label.status.paused`,cancelled:`label.status.cancelled`,aborted:`label.status.cancelled`,not_started:`label.status.waiting`,available:`label.status.available`,absent:`label.status.unavailable`,inaccessible:`label.status.inaccessible`,degraded:`label.status.limited`,healthy:`label.status.healthy`},fn={system:`label.role.argus`,operator:`label.role.you`},pn={completed:`label.outcome.workCompleted`,done:`label.outcome.workCompleted`,success:`label.outcome.workCompleted`,paused:`label.outcome.workPaused`,blocked:`label.outcome.workBlocked`,failed:`label.outcome.workFailed`,error:`label.outcome.workFailed`,aborted:`label.outcome.workEnded`,ended:`label.outcome.workEnded`,incomplete:`label.outcome.workIncomplete`,research_incomplete:`label.outcome.workIncomplete`,paused_no_breakthrough:`label.outcome.workIncomplete`,exhausted_current_methods:`label.outcome.workIncomplete`,stalled:`label.outcome.workStalled`,no_progress:`label.outcome.workStalled`,max_rounds:`label.outcome.workStalled`,infra_blocked:`label.outcome.workBlocked`,supervisor_error:`label.outcome.workFailed`},mn={accepted:`label.outcome.reviewPassed`,done:`label.outcome.reviewPassed`,passed:`label.outcome.reviewPassed`,continue:`label.outcome.reviewNeedsChanges`,rejected:`label.outcome.reviewNeedsChanges`,blocked:`label.outcome.reviewBlocked`,stale:`label.outcome.reviewOutdated`,pending:`label.outcome.reviewPending`,pending_review:`label.outcome.reviewPending`},hn={certified:`label.outcome.stageApproved`,not_certified:`label.outcome.stageNotApproved`,revoked:`label.outcome.stageRevoked`,intentionally_skipped:`label.outcome.stageNotNeeded`,deferred:`label.outcome.stagePending`},gn={budget_exhausted:`label.outcome.budgetPaused`,budget_pause:`label.outcome.budgetPaused`,cost_unreconciled:`label.outcome.costUnreconciled`,operator_input_required:`label.outcome.waitingForYou`,operator_abort:`label.outcome.stoppedByYou`,operator_pause:`label.outcome.pausedByYou`,daemon_shutdown:`label.outcome.sessionPaused`,backend_unavailable:`label.outcome.serviceUnavailable`,provider_cooldown:`label.outcome.serviceCoolingDown`,provider_fence:`label.outcome.serviceUnavailable`,transient_error:`label.outcome.temporaryIssue`,permanent_error:`label.outcome.serviceError`,planner_empty_plan:`label.outcome.needsPlan`},_n={cuda:`label.resource.nvidiaGpu`,rocm:`label.resource.amdGpu`,mps:`label.resource.appleGpu`,cpu:`label.resource.cpu`};function vn(e,t){return t(dn[String(e??``).toLowerCase()]??`label.status.updated`)}function yn(e,t){let n=String(e??``).toLowerCase();return ot(n)?Ae(n,t):t(fn[n]??`label.role.argus`)}function bn(e,t){return t(`label.priority`,{priority:e})}function xn(e,t){if(!e?.execution_status)return[];let n=[t(pn[e.execution_status.toLowerCase()]??`label.outcome.workUpdated`)],r=mn[String(e.review_status??``).toLowerCase()],i=hn[String(e.stage_certification??``).toLowerCase()],a=gn[String(e.interruption_kind??``).toLowerCase()];return r&&n.push(t(r)),i&&n.push(t(i)),a&&n.push(t(a)),e.resumable&&n.push(t(`label.outcome.canResume`)),n}function Sn(e,t){return t(_n[e.toLowerCase()]??`label.resource.accelerator`)}function Cn(e,t){return t(e===`strict`?`label.resource.enforced`:`label.resource.advisory`)}function wn(e,t){return t(e===`yield`?`label.resource.released`:`label.resource.kept`)}var K=n(),Tn=e=>[`knowledge-feed`,e];function En(e=!0,t=50){return x({queryKey:Tn(t),queryFn:({signal:e})=>P.knowledgeFeed(t,e),enabled:e,staleTime:5e3,refetchInterval:1e4})}var Dn={en:{learned:`Learned`,recalled:`Recalled`,promoted:`Promoted`,corrected:`Corrected`},zh:{learned:`学到了`,recalled:`读取了`,promoted:`提升了`,corrected:`纠正了`}},On={en:{private:`About you`,global:`Global`,vertical:`Vertical`,project:`Project`},zh:{private:`关于你`,global:`全局`,vertical:`垂直领域`,project:`项目`}};function kn(e,t=60){let n=[...e].sort((e,t)=>t.ts-e.ts),r=[];for(let e of n){let n=r[r.length-1];if(e.kind===`recalled`&&n?.kind===`recalls`&&n.role===e.role&&n.ts-e.ts<=t){n.events.push(e);continue}r.push(e.kind===`recalled`?{kind:`recalls`,ts:e.ts,role:e.role,events:[e]}:{kind:`single`,event:e})}return r}function An(e,t,n=null){return e.path?e.scope===`project`?n&&e.source_project&&e.source_project!==n?null:t.find(t=>t.scope===`project`&&t.path===e.path)??null:t.find(t=>t.scope===e.scope&&t.vertical===e.vertical&&t.path===e.path)??null:null}var jn={learned:`bg-blue/10 text-blue`,recalled:`bg-line/60 text-ink-dim`,promoted:`bg-ok/10 text-ok`,corrected:`bg-warn/10 text-warn`};function Mn({events:e,items:t,sid:n,projectNames:r={},query:i=``,onSelect:a,selected:o}){let{locale:s,t:c}=F(),l=s===`zh-CN`,u=Dn[l?`zh`:`en`],d=On[l?`zh`:`en`],f=e=>H(e,l?`zh-CN`:`en`),p=i.trim().toLocaleLowerCase(),m=kn(p?e.filter(e=>`${e.title} ${e.path} ${e.vertical} ${e.source_project} ${e.role} ${e.note}`.toLocaleLowerCase().includes(p)):e),h=e=>[d[e.scope]??e.scope,on(e.vertical,s),e.source_project?`${l?`来自 `:`from `}${r[e.source_project]||e.source_project}`:``,l&&e.role?yn(e.role,c):e.role].filter(Boolean).join(` · `),g=e=>!!(e&&o&&e.scope===o.scope&&e.vertical===o.vertical&&e.path===o.path),_=(e,r)=>{let i=An(e,t,n),o=e.title||e.path;return i?(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(i),"aria-pressed":g(i),"data-feed-title":!0,className:`${r} text-left hover:text-blue ${g(i)?`text-blue`:`text-ink`}`,children:o}):(0,K.jsx)(`span`,{"data-feed-title":!0,className:`${r} text-ink`,title:e.path,children:o})};return m.length===0?(0,K.jsx)(`p`,{className:`p-3 text-sm leading-relaxed text-ink-faint`,children:p?l?`没有匹配的学习动态。`:`No feed lines match the search.`:l?`还没有学习动态。Argus 在任务后反思写下教训、把已有知识读进提示、或把评审通过的页面提升到共享层时,都会在这里留下一行。`:`Nothing learned yet. A line appears here whenever Argus writes a lesson after a mission, reads existing knowledge into a prompt, or promotes a reviewed page to a shared level.`}):(0,K.jsx)(`ol`,{className:`space-y-1`,"aria-label":l?`学习动态`:`Learning feed`,children:m.map(e=>e.kind===`single`?(0,K.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":e.event.kind,children:[(0,K.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,K.jsx)(`time`,{dateTime:new Date(e.event.ts*1e3).toISOString(),children:f(e.event.ts)}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${jn[e.event.kind]??jn.learned}`,children:u[e.event.kind]??e.event.kind})]}),_(e.event,`mt-1 block w-full break-words text-sm font-medium`),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.event)}),e.event.note&&(0,K.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-ink-dim`,children:e.event.note})]},`${e.event.ts}/${e.event.kind}/${e.event.path}`):(0,K.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":`recalls`,children:[(0,K.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,K.jsx)(`time`,{dateTime:new Date(e.ts*1e3).toISOString(),children:f(e.ts)}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${jn.recalled}`,children:u.recalled})]}),(0,K.jsx)(`span`,{className:`mt-1 block text-sm font-medium text-ink`,"data-feed-title":!0,children:e.events.length===1?e.events[0].title||e.events[0].path:l?`读取了 ${e.events.length} 条已有知识`:`Recalled ${e.events.length} existing pages`}),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.events[0])}),e.events.length>1&&(0,K.jsx)(`span`,{className:`mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-xs`,children:e.events.map(e=>(0,K.jsx)(`span`,{children:_(e,`inline text-xs text-ink-dim`)},`${e.ts}/${e.scope}/${e.vertical}/${e.path}`))})]},`${e.ts}/recalls/${e.role}`))})}function Nn({guide:e,item:t}){let{t:n}=F();return(0,K.jsxs)(`section`,{"data-skill-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-4 text-sm leading-relaxed text-ink`,children:[(0,K.jsx)(`h4`,{className:`font-semibold`,children:`这项方法有什么用`}),(0,K.jsx)(`p`,{className:`mt-2`,children:e.summary}),(0,K.jsxs)(`dl`,{className:`mt-3 space-y-2 text-xs text-ink-dim`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`font-medium`,children:`什么时候参考`}),(0,K.jsx)(`dd`,{children:`当前任务与上面的用途相符时,由既有任务与技能选择流程按需读取;浏览本页不会运行工具或发起模型任务。`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`font-medium`,children:`目录标注的角色`}),(0,K.jsxs)(`dd`,{children:[yn(t.role,n),`;这只是说明,不调整角色职责或权限。`]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`font-medium`,children:`需要注意`}),(0,K.jsx)(`dd`,{children:`这是随包版本的中文导读,不是完整执行指令,也不是已经完成或验证的证据。具体步骤、前置条件、软件许可和授权限制请对照原文。`})]})]})]})}function Pn({item:e}){let{locale:t}=F(),n=t===`zh-CN`;return(0,K.jsxs)(`section`,{"data-knowledge-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-3 text-xs leading-relaxed text-ink-dim`,children:[(0,K.jsx)(`h4`,{className:`font-semibold text-ink`,children:n?`这类知识怎样帮助工作`:`How this kind of knowledge helps`}),(0,K.jsx)(`p`,{className:`mt-2`,children:cn(e.kind,t)}),(0,K.jsx)(`p`,{className:`mt-2`,children:un(e.scope,t)}),(0,K.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n?`以上解释条目类型与范围,不是这篇正文的翻译或真实性证明。具体内容、来源和适用条件仍以原文为准。`:`This explains the kind and scope, not the page itself or its validity. Consult the original content, sources and conditions.`})]})}function Fn({sid:e,channel:t,onOpenKnowledge:n,onOpenSkills:r}){let{locale:i}=F(),a=i===`zh-CN`,o=S(),s=x({queryKey:[`learning-status`,e],queryFn:({signal:t})=>P.learningStatus(e,t),enabled:!!e,refetchInterval:2e3,staleTime:1e3}),c=(0,U.useRef)(``);(0,U.useEffect)(()=>{let t=`${e}:${s.data?.revision??0}`;if(!(!s.data?.revision||t===c.current)){c.current=t;for(let e of[`skill-library`,`wiki-library`,`knowledge-feed`])o.invalidateQueries({queryKey:[e]})}},[e,s.data?.revision,o]);let l=C({mutationFn:e=>P.retryLearning(e.sid,e.id),onSuccess:(e,t)=>o.setQueryData([`learning-status`,t.sid],e)});if(!e||!s.data?.jobs.length)return null;let u=s.data.jobs,d=u.find(e=>e.status===`running`)??u.find(e=>e.status===`queued`),f=d??u[0],p=!!d||s.data.pending>0,m=!p&&f.status===`skipped`&&f.outcome.reason===`paused`;if(!p&&f.status===`skipped`&&(!m||!t))return null;let h={cost_unreconciled:[`上一次模型调用的费用尚未结算,结算前暂停新的模型调用`,`model calls are paused until an earlier call's cost is settled`],budget_exhausted:[`今日模型预算已用完`,`today's model budget is used up`],provider_cooldown:[`模型服务暂时限流`,`the model provider is briefly rate-limited`],operator_pause:[`模型调用已暂停`,`model calls are paused`]},g=h[f.outcome.detail??``]??h.operator_pause,_=m||!p&&f.status===`failed`,v=a?{knowledge:`知识库`,skills:`技能库`,preferences:`用户偏好`}:{knowledge:`Knowledge base`,skills:`Skill library`,preferences:`Preferences`},y=t?[t]:[`knowledge`,`skills`,`preferences`],b=p?y:y.filter(e=>(f.outcome.counts?.[e]??0)>0);if(!p&&!_&&!b.length)return null;let w=e=>{let t=f.outcome.counts?.[e]??0;return p?f.status===`running`?a?`${v[e]}正在更新`:`Updating ${v[e].toLowerCase()}`:a?`${v[e]}等待更新`:`${v[e]} update queued`:a?`${v[e]}已更新 · ${t} 条`:`${v[e]} updated · ${t}`},T=(f.outcome.items??[]).filter(e=>!t||e.channel===t);return(0,K.jsxs)(`div`,{className:`px-2 py-1.5 text-[11px] leading-5 text-ink-dim`,"data-learning-status":f.status,children:[(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:[p?(0,K.jsx)(W,{className:`h-3 w-3 animate-spin text-blue`}):_?(0,K.jsx)(Bt,{className:`h-3 w-3 text-ink-faint`}):(0,K.jsx)(Jt,{className:`h-3 w-3 text-blue`}),m&&(0,K.jsx)(`span`,{children:a?`本轮未学习:${g[0]}。回复不受影响。`:`Learning skipped: ${g[1]}. Your reply is unaffected.`}),!p&&f.status===`failed`&&(0,K.jsx)(`span`,{children:a?`本轮学习未完成,回复不受影响。`:`Learning from this turn did not finish. Your reply is unaffected.`}),!_&&b.map(e=>(0,K.jsx)(`span`,{children:w(e)},e)),s.data.pending>1&&(0,K.jsx)(`span`,{children:a?`还有 ${s.data.pending-1} 轮待学习`:`${s.data.pending-1} more queued`}),_&&f.retryable!==!1&&(0,K.jsx)(`button`,{type:`button`,disabled:l.isPending,className:`text-blue underline`,onClick:()=>l.mutate({sid:e,id:f.id}),children:a?`重试学习`:`Retry learning`})]}),p&&!t&&(0,K.jsx)(`p`,{className:`text-ink-faint`,children:a?`正在整理本轮的知识、方法和偏好,你可以继续工作。`:`Saving useful knowledge, methods and preferences. You can keep working.`}),T.length>0&&!t&&(0,K.jsxs)(`details`,{className:`mt-0.5`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-blue`,children:a?`查看本轮学到了什么`:`What this turn taught Argus`}),(0,K.jsx)(`ul`,{className:`pl-4 list-disc`,children:T.map((e,t)=>(0,K.jsx)(`li`,{children:(e.channel===`skills`?r:n)?(0,K.jsx)(`button`,{type:`button`,className:`text-left underline`,onClick:e.channel===`skills`?r:n,children:e.title}):e.title},t))})]}),(l.isError||s.isError)&&(0,K.jsx)(`p`,{role:`alert`,children:a?`暂时无法同步学习状态,请稍后重试。`:`Learning status could not be refreshed. Please retry.`})]})}var In=e=>`${e.library}/${e.path}`,Ln=e=>e.filter(e=>!e.is_default&&e.updated_at!=null).sort((e,t)=>(t.updated_at??0)-(e.updated_at??0)||In(e).localeCompare(In(t)));function Rn(e,t=!0){return x({queryKey:[`skill-library`,e],queryFn:({signal:t})=>P.skillLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var zn={en:{fact:`Fact`,lesson:`Lesson`,survey:`Survey`,principles:`Principles`,note:`Note`,profile:`Profile`,page:`Page`},zh:{fact:`事实`,lesson:`经验教训`,survey:`调研摘要`,principles:`原则`,note:`个人记录`,profile:`个人概况`,page:`参考页面`}},Bn=e=>e.kind in zn.en?e.kind:`page`,Vn=e=>[`wiki-library`,e];function Hn(e,t=!0){return x({queryKey:Vn(e),queryFn:({signal:t})=>P.wikiLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var Un=[`feed`,`global`,`vertical`,`project`],Wn={"zh-CN":{feed:`学习动态`,global:`全局项目`,vertical:`垂直领域`,project:`项目`},en:{feed:`Learning feed`,global:`Across projects`,vertical:`Vertical`,project:`Project`}};function Gn(e,t,n,r){let i=r===`zh-CN`,a=e=>n===`feed`||e===n||n===`global`&&e===`private`,o=(e?.items??[]).filter(e=>a(e.scope)).map(e=>({kind:`knowledge`,item:e,id:`knowledge/${e.scope}/${e.vertical}/${e.path}`,title:e.title,description:e.description,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at,search:`${e.title} ${e.description} ${e.path}`})),s=(n===`feed`?Ln(t?.items??[]):t?.items??[]).filter(e=>a(e.scope)).map(e=>{let t=nn(e,r);return{kind:`skill`,item:e,id:`skill/${e.library}/${e.path}`,title:t.title,description:t.summary,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at??0,search:rn(e,r)}}),c=n===`feed`?[]:(e?.libraries??[]).filter(e=>a(e.scope)).flatMap(e=>[{kind:`index`,content:e.index_markdown,name:`INDEX.md`,title:i?`索引`:`Index`},{kind:`principles`,content:e.principles,name:`principles.md`,title:i?`原则`:`Principles`},{kind:`profile`,content:e.profile,name:`profile.md`,title:i?`个人概况(原私有范围)`:`Personal profile (private scope)`}].flatMap(t=>t.content?.trim()?[{kind:t.kind,content:t.content,id:`${t.kind}/${e.scope}/${e.vertical}/${e.root}`,title:t.title,description:``,path:`${e.root}/${t.name}`,scope:e.scope,vertical:e.vertical,updated:0,search:`${t.title} ${t.name}`}]:[]));return[...o,...s,...c].sort((e,t)=>t.updated-e.updated||e.id.localeCompare(t.id))}function Kn({onOpen:e,compact:t=!1}){let{locale:n}=F(),r=n===`zh-CN`?`技能库`:`Skill library`;return(0,K.jsx)(`section`,{className:`shrink-0 ${t?`py-2`:`mx-2 py-1`}`,"data-learning-navigation":!0,children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>e(`feed`),"aria-label":r,title:r,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-ink-dim hover:bg-bg hover:text-ink ${t?`justify-center`:``}`,children:[(0,K.jsx)(At,{size:16,"aria-hidden":`true`}),!t&&r]})})}function qn({sid:e,initialScope:t=`feed`,initialSelection:n=null,projectNames:r={}}){let i=(0,U.useRef)(e);return(0,K.jsx)(Jn,{sid:e,initialScope:t,initialSelection:i.current===e?n:null,projectNames:r},e??`no-project`)}function Jn({sid:e,initialScope:t,initialSelection:n,projectNames:r}){let{locale:i}=F(),a=i===`zh-CN`,o=Wn[i],[s,c]=(0,U.useState)(t),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(``),[p,m]=(0,U.useState)(()=>n?n.kind===`skill`?`skill/${n.item.library}/${n.item.path}`:`knowledge/${n.item.scope}/${n.item.vertical}/${n.item.path}`:null),h=Hn(e),g=Rn(e),_=En(s===`feed`),v=Gn(h.data,g.data,s,i),y=v.find(e=>e.id===p),b=y?.kind===`knowledge`?y.item:null,S=y?.kind===`skill`?y.item:null,C=x({queryKey:[`wiki-document`,e,b?.scope,b?.vertical,b?.path,b?.updated_at],queryFn:({signal:t})=>{if(!b)throw Error(`No knowledge document selected`);return P.wikiDocument(e,b.scope,b.vertical,b.path,t)},enabled:!!b}),w=x({queryKey:[`skill-document`,e,S?.library,S?.path,S?.updated_at],queryFn:({signal:t})=>{if(!S)throw Error(`No skill document selected`);return P.skillDocument(e,S.library,S.path,t)},enabled:!!S}),T=l.trim().toLocaleLowerCase(),E=v.filter(e=>(s!==`vertical`||!d||e.vertical===d)&&(!T||`${e.search} ${e.vertical}`.toLocaleLowerCase().includes(T))),D=[...new Set([...h.data?.verticals??[],...g.data?.verticals??[]])].sort(),O=e=>e.scope===`private`?a?`个人记录 · 原私有范围,不共享`:`Personal record · private, not shared`:`${o[e.scope]}${e.vertical?` · ${on(e.vertical,i)}`:``}`,k=e=>e.kind===`skill`?a?`技能`:`Skill`:e.kind===`knowledge`?zn[a?`zh`:`en`][Bn(e.item)]:e.kind===`principles`?a?`原则`:`Principles`:e.kind===`profile`?a?`个人概况`:`Profile`:a?`索引`:`Index`,A=S?w:C,j=S?nn(S,i).guide:null,M=e=>{c(e),m(null),f(``)};return(0,K.jsxs)(`div`,{className:`flex h-[min(780px,84dvh)] min-h-0 flex-col`,"data-learning-library":!0,children:[(0,K.jsx)(Qe,{title:a?`技能库`:`Skill library`,sub:a?`在一起查看学到的知识、可复用的方法和原始资料。`:`Explore learned knowledge, reusable methods and original sources together.`}),(0,K.jsx)(Fn,{sid:e,onOpenKnowledge:()=>M(`feed`),onOpenSkills:()=>M(`feed`)}),(0,K.jsx)(`nav`,{"aria-label":a?`学习资源分类`:`Learning resource categories`,className:`flex shrink-0 overflow-x-auto border-b border-line/60 px-4`,children:Un.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>M(e),className:`shrink-0 border-b-2 px-3 py-2.5 text-sm ${s===e?`border-blue text-ink`:`border-transparent text-ink-faint hover:text-ink`}`,children:o[e]},e))}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,K.jsxs)(`aside`,{className:`${y?`hidden md:flex`:`flex`} min-h-0 w-full flex-col md:w-80 md:shrink-0 md:border-r md:border-line/60`,children:[(0,K.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,K.jsx)(`input`,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":a?`搜索知识与技能`:`Search knowledge and skills`,placeholder:a?`搜索知识与技能`:`Search knowledge and skills`,className:`w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink`}),s===`vertical`&&(0,K.jsxs)(`select`,{value:d,onChange:e=>{f(e.target.value),m(null)},"aria-label":a?`垂直领域`:`Vertical`,className:`w-full rounded-md border border-line bg-bg px-2 py-2 text-sm text-ink`,children:[(0,K.jsx)(`option`,{value:``,children:a?`所有领域`:`All verticals`}),D.map(e=>(0,K.jsx)(`option`,{value:e,children:on(e,i)},e))]}),s===`feed`&&(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`学习记录与文件更新分开展示。文件变更不等于知识已验证。`:`Learning records and file updates are separate. An update does not prove knowledge is verified.`}),s===`global`&&(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`跨项目共享的知识和方法;个人记录保留原私有范围,不会被共享。`:`Shared knowledge and methods across projects. Personal records retain their private scope.`})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:[h.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`知识无法加载。`:`Knowledge could not load.`,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void h.refetch(),children:a?`重试`:`Retry`})]}),g.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`技能无法加载。`:`Skills could not load.`,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void g.refetch(),children:a?`重试`:`Retry`})]}),h.data?.errors.length||g.data?.errors.length?(0,K.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-err`,children:a?`部分资料无法读取;已加载的内容仍可查看。`:`Some sources could not be read; loaded material remains available.`}):null,s===`feed`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`学习记录`:`Learning records`}),_.isPending&&(0,K.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载学习记录…`:`Loading learning records…`}),_.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`学习记录无法加载。`:`Learning records could not load.`,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void _.refetch(),children:a?`重试`:`Retry`})]}),_.data&&(0,K.jsx)(Mn,{events:_.data.events,items:h.data?.items??[],sid:e,projectNames:r,query:l,selected:b,onSelect:e=>{m(`knowledge/${e.scope}/${e.vertical}/${e.path}`)}}),(0,K.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`文件更新`:`File updates`})]}),(h.isPending||g.isPending)&&(0,K.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载资料…`:`Loading material…`}),!h.isPending&&!g.isPending&&!h.isError&&!g.isError&&!E.length&&(0,K.jsx)(`p`,{className:`p-3 text-sm text-ink-faint`,children:s===`project`&&!e?a?`选择一个项目以查看资料。`:`Select a project to see its material.`:a?`当前分类或筛选条件下没有资料。`:`No material matches this category or filter.`}),E.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>m(e.id),"aria-pressed":y?.id===e.id,className:`block w-full rounded-md px-3 py-3 text-left ${y?.id===e.id?`bg-blue/10`:`hover:bg-bg`}`,children:[(0,K.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-line/60 px-1.5 text-[10px] text-ink-dim`,children:k(e)}),(0,K.jsx)(`span`,{className:`break-words text-sm font-medium text-ink`,children:e.title})]}),e.description&&(0,K.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs text-ink-dim`,children:e.description}),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:O(e)}),e.updated>0&&(0,K.jsx)(`time`,{className:`mt-1 block text-[11px] text-ink-faint`,dateTime:new Date(e.updated*1e3).toISOString(),children:new Date(e.updated*1e3).toLocaleString(i)})]},e.id))]})]}),(0,K.jsx)(`article`,{className:`${y?`block`:`hidden md:block`} min-w-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:y?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`mb-4 text-sm text-blue md:hidden`,onClick:()=>m(null),children:a?`← 返回列表`:`← Back to the list`}),(0,K.jsx)(`h3`,{className:`break-words text-lg font-semibold text-ink`,children:y.title}),(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[k(y),` · `,O(y)]}),(0,K.jsx)(`p`,{className:`mt-1 break-all text-xs text-ink-faint`,children:y.path}),b&&(0,K.jsx)(Pn,{item:b}),S&&j&&(0,K.jsx)(Nn,{item:S,guide:j}),(0,K.jsx)(`div`,{className:`mt-5 border-t border-line/60 pt-5 text-sm text-ink`,children:y.kind===`knowledge`||y.kind===`skill`?(0,K.jsxs)(K.Fragment,{children:[A.isPending&&(0,K.jsx)(`p`,{children:a?`正在加载全文…`:`Loading document…`}),A.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`text-err`,children:[A.error.message,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void A.refetch(),children:a?`重试`:`Retry`})]}),b&&C.data?.truncated&&(0,K.jsx)(`p`,{role:`status`,className:`mb-3 text-xs text-ink-faint`,children:a?`页面过长,已截断显示。`:`Page shortened for display.`}),A.data&&(j?(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2 text-blue`,children:a?`查看原始技能文档`:`Read the original skill`}),(0,K.jsx)(Ke,{children:A.data.content})]}):(0,K.jsx)(Ke,{children:A.data.content}))]}):(0,K.jsx)(Ke,{children:y.content})})]}):(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-ink-faint`,children:[(0,K.jsx)(At,{size:18,"aria-hidden":`true`}),a?`选择资料,阅读原文与使用条件。查看不会执行技能。`:`Select material to read its original and conditions. Reading does not execute a skill.`]})})]})]})}var Yn=[{value:`copilot`,label:`settings.backendLabel.copilot`},{value:`codex`,label:`settings.backendLabel.codex`},{value:`claude`,label:`settings.backendLabel.claude`},{value:`cursor`,label:`settings.backendLabel.cursor`},{value:`opencode`,label:`settings.backendLabel.opencode`},{value:`pi`,label:`settings.backendLabel.pi`},{value:`grok`,label:`settings.backendLabel.grok`},{value:`qoder`,label:`settings.backendLabel.qoder`},{value:`dsh`,label:`settings.backendLabel.dsh`}],Xn={copilot:`copilot`,codex:`codex`,claude:`claude`,cursor:`cursor`,opencode:`opencode`,pi:`pi`,grok:`grok`,qoder:`qoder`,dsh:`dsh`};function Zn(e){return Xn[e]??``}function Qn(e,t){let n=Zn(e);return n?t(`settings.backendLabel.${n}`):e}function $n(e){return e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.value??e?.roles[0]?.backend??``}function er(e){let t=e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.source??``;return t===`env`||t===`persisted`||t==="default"?t:``}function tr(e){return(e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.saved??``).trim()}function nr(e){return typeof e==`string`&&/^[\p{L}\p{N}_-][\p{L}\p{N}_.-]{0,127}$/u.test(e)}function rr(e){return e===void 0?{}:nr(e)?{sessionId:e}:null}function ir(e,t){return typeof e==`string`?e.trim().slice(0,t):``}function ar(e,t){return ir(e,t*2).replace(/!?(?:\[([^\]]+)\])\([^)]+\)/g,`$1`).replace(/[*_`#]/g,``).replace(/\s+/g,` `).trim().slice(0,t)}function or(e){let t=ir(e.completionId,300),n=rr(e.sessionId);if(!t||!n)return null;let r=ir(e.path,1e3);return{...n,deliveryId:t,title:ar(e.title,240)||`已完成的任务`,summary:ar(e.summary,500),...r?{path:r}:{}}}function sr(e,t){let n=ir(e.delivery_id,300),r=rr(t);return!n||!r?null:{...r,deliveryId:n,title:ir(e.title,240)||`Argus`,summary:ir(e.summary,1e3),...e.primary_target?.path?{path:ir(e.primary_target.path,1e3)}:{}}}function cr(){return typeof window>`u`||window.parent===window?null:window.parent}function lr(){return cr()!==null}function ur(){cr()?.postMessage({type:`argus:show-trial-setup`},`*`)}function dr(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=ir(t.deliveryId,300),r=rr(t.sessionId);if(!n||!r)return null;let i=ir(t.path,1e3);return{...r,deliveryId:n,title:ir(t.title,240)||`Argus`,summary:ir(t.summary,1e3),...i?{path:i}:{}}}function fr(e){let t=dr(e),n=cr();return!t||!n?Promise.resolve(!1):(n.postMessage({type:`argus:notify-completion`,payload:t},`*`),Promise.resolve(!0))}function pr(e){let t=cr();t&&t.postMessage({type:`argus:large-preview`,payload:e},`*`)}function mr(e){let t=typeof window<`u`?window.location?.ancestorOrigins?.[0]:void 0;if(t&&t!==`null`)return e===t;if(typeof document<`u`&&document.referrer)try{let t=new URL(document.referrer);if(t.protocol===`http:`||t.protocol===`https:`)return e===t.origin;if(t.protocol===`tauri:`&&t.hostname===`localhost`)return e===`tauri://localhost`}catch{}return[`http://tauri.localhost`,`https://tauri.localhost`,`tauri://localhost`].includes(e)}function hr(e){let t=cr();if(!t)return()=>void 0;let n=n=>{if(n.source!==t||!mr(n.origin)||n.data?.type!==`argus:open-delivery`)return;let r=dr(n.data.payload);r&&e(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function gr(e){let t=cr();if(!t)return()=>void 0;let n=n=>{n.source===t&&n.data?.type===`argus:new-chat`&&e()};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function _r(){if(typeof document>`u`)return()=>void 0;let e=cr();if(!e)return()=>void 0;let t=t=>{if(t.defaultPrevented||t.button!==0&&t.button!==1)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null;if(!n)return;let r;try{r=new URL(n.href,window.location.href)}catch{return}r.origin===window.location.origin||![`http:`,`https:`].includes(r.protocol)||(t.preventDefault(),e.postMessage({type:`argus:open-external`,payload:r.toString()},`*`))},n=t=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.shiftKey||!(t.ctrlKey||t.metaKey))return;let n=t.key===`,`?`argus:show-setup`:t.key.toLowerCase()===`n`?`argus:request-new-chat`:null;n&&(t.preventDefault(),e.postMessage({type:n},`*`))},r=()=>e.postMessage({type:`argus:cockpit-interaction`},`*`);return document.addEventListener(`click`,t,!0),document.addEventListener(`auxclick`,t,!0),window.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r,{passive:!0}),()=>{document.removeEventListener(`click`,t,!0),document.removeEventListener(`auxclick`,t,!0),window.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}}var vr=21600,yr=e=>!e||[`auto`,`inherit`,`default`].includes(e.toLowerCase());function br({sid:e,roles:t,running:n,lastCall:r,onOpenSettings:i}){let{locale:a,t:o}=F(),{data:s}=xe(e,!0),c=a===`zh-CN`,l=(n?t.find(e=>e.active):void 0)??t.find(e=>e.role===`manager`),u=s?.trial_mode===!0,d=!!r&&(n||Date.now()/1e3-(r.ts||0)e.role===f.role):void 0,_=g&&g.backend&&g.backend!==f?.backend?g.backend:``,v=g&&!yr(g.model)&&g.model!==f?.model?g.model:``,y=_||v?[Qn(_||g.backend,o),v||g.model||`auto`].join(` · `):``,b=(0,K.jsxs)(K.Fragment,{children:[u?c?`试用`:`Trial`:p?Qn(p,o):c?`模型信息待确认`:`Model information unavailable`,m?` · ${m}`:``,h?` · ${h}`:``,!u&&!f&&n&&l?.active?` · ${ot(l.role)?Ae(l.role,o):l.role}`:``]}),x=f?c?`最近一次模型调用实际使用的后端、模型和推理强度;点击更改`:`Backend, model and effort the latest model call actually used; click to change`:c?`当前配置的后端与模型;点击更改`:`Configured backend and model; click to change`;return(0,K.jsxs)(`div`,{className:`composer-runtime`,"aria-label":c?`当前后端与模型`:`Current backend and model`,children:[i&&!u?(0,K.jsxs)(`button`,{type:`button`,className:`composer-runtime-model`,onClick:i,title:x,"data-runtime-open-settings":!0,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}):(0,K.jsxs)(`span`,{className:`composer-runtime-model`,title:u?void 0:x,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}),(0,K.jsxs)(`details`,{className:`composer-runtime-details`,children:[(0,K.jsx)(`summary`,{children:c?`运行信息`:`Runtime details`}),(0,K.jsx)(`div`,{children:b})]}),y?(0,K.jsx)(`span`,{className:`composer-runtime-next`,"data-runtime-next":!0,children:c?`下次使用:${y}`:`next call: ${y}`}):null,u&&lr()?(0,K.jsx)(`button`,{type:`button`,onClick:ur,children:c?`更换 Key`:`Change Key`}):null]})}function xr({session:e}){let{locale:t}=F(),n=t===`zh-CN`,r=n?`会话目录`:`Session directory`,i=e.workdir||e.cwd||(n?`待确认`:`Pending confirmation`);return(0,K.jsxs)(`details`,{className:`session-workdir`,"data-session-workdir":!0,children:[(0,K.jsxs)(`summary`,{title:`${r}: ${i}`,"aria-label":`${r}: ${i}`,children:[(0,K.jsx)(`span`,{children:r}),(0,K.jsx)(`code`,{children:i})]}),(0,K.jsxs)(`div`,{className:`session-workdir__detail`,children:[(0,K.jsx)(`strong`,{children:r}),(0,K.jsx)(`code`,{children:i}),(0,K.jsx)(`p`,{children:n?`来自已加载会话快照的工作目录;不是每个任务的实际 cwd,也不是安全沙箱边界。`:`Working directory from the loaded session snapshot; not each task’s actual cwd or a security sandbox boundary.`})]})]})}function Sr(e){return!Number.isFinite(e)||e<=0?`$0.00`:e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(3)}`}function Cr({settledUsd:e,knownUsd:t=0,status:n=`empty`}){let r=typeof e==`number`&&Number.isFinite(e)?e:t,i=n===`partial`||n===`unpriced`;return`${Sr(Math.max(0,r||0))}${i?`+`:``}`}function wr({settledUsd:e,knownUsd:t,status:n,calls:r=0,premiumRequests:i=0,live:a=!1,compact:o=!1}){let s=Cr({settledUsd:e,knownUsd:t,status:n}),c=[`Cumulative settled project spend`,`${r} model call${r===1?``:`s`}`,i>0?`${i.toFixed(1)} premium requests`:``,n&&n!==`empty`?`pricing: ${n}`:``].filter(Boolean).join(` · `);return(0,K.jsxs)(`span`,{title:c,"aria-label":`Project spend ${s}`,className:`inline-flex shrink-0 items-center rounded-full border border-gold/25 bg-gold/8 font-mono tabular-nums text-gold ${o?`h-6 gap-1 px-2 text-[10px]`:`h-5 gap-1 px-1.5 text-[9px]`}`,children:[a?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-gold/80`}):null,(0,K.jsx)(`span`,{children:s})]})}var Tr=e=>String(e??``).trim(),Er=/^[a-z][a-z -]+ requires an operator-owned decision before continuing\.?$/i,Dr=e=>{let t=Tr(e);return Er.test(t)?``:t},Or=(e,t)=>{let n=/[\u3400-\u9fff]/.test(`${e}\n${t}`);return{id:`custom`,label:n?`自己输入`:`Write my own answer`,description:n?`直接告诉 Argus 你的决定。`:`Tell Argus your decision directly.`,requires_note:!0}};function kr(e,t,n){let r=[...e,...t],i=new Map(t.map(e=>[Tr(e.id),e])),a=(e,t)=>{let n=i.get(e)??(Tr(t.id)===e?t:void 0);return{task_title:Tr(n?.title)||void 0,task_status:Tr(n?.status)||void 0}},o=[],s=new Set;for(let e of r){let t=Tr(e.id),n=e.operator_decision;if(n&&typeof n==`object`&&!Array.isArray(n)){let r=n,i=Tr(r.id);if(!i||s.has(i)||Tr(r.status)!==`pending`)continue;s.add(i);let c=Tr(r.options_source),l=r.kind===`domain_intake`,u=(c===`agent`||l&&c===`workflow`)&&Array.isArray(r.options)?r.options.filter(e=>!!Tr(e?.id)&&!!Tr(e?.label)).map(e=>({...e,requires_note:e.requires_note===!0})):[];u.some(e=>e.id===`custom`)||u.push(Or(Tr(r.title),Tr(r.question)));let d=Tr(r.item_id)||t;o.push({id:i,...l?{kind:`domain_intake`}:{},item_id:d,revision:Number(r.revision??1),status:`pending`,title:Tr(r.title)||Tr(e.title)||`Decision required`,reason:Dr(r.reason),question:Tr(r.question)||Tr(e.pending_question),evidence:Array.isArray(r.evidence)?r.evidence.filter(e=>Tr(e?.label)!==`Acceptance check`):[],options:u,options_source:l?`workflow`:u.length?`agent`:`none`,selected_option:``,note:``,...a(d,e),...l?{task_title:Tr(r.task_title),task_status:void 0}:{},...typeof r.asked_at==`number`&&Number.isFinite(r.asked_at)&&r.asked_at>0?{asked_at:r.asked_at}:{}});continue}let r=Tr(e.pending_question??e.question??e.text);if(!t||!r)continue;let i=`legacy-${t}`;s.has(i)||(s.add(i),o.push({id:i,item_id:t,revision:1,status:`pending`,title:Tr(e.title??e.objective)||`Blocked task`,reason:``,question:r,evidence:[],options:[Or(Tr(e.title??e.objective),r)],options_source:`none`,selected_option:``,note:``,legacy:!0,...a(t,e)}))}if(!n)return o;let c=o.map(e=>({...e,is_current_task:e.kind===`domain_intake`?void 0:e.item_id===n}));return[...c.filter(e=>e.kind===`domain_intake`),...c.filter(e=>e.is_current_task),...c.filter(e=>e.kind!==`domain_intake`&&!e.is_current_task)]}function Ar(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function jr(e,t,n=``){let r=Ar(n,70);switch(e){case`manager`:return t?`正在整理任务进展`:`Summarizing progress`;case`planner`:return t?`正在安排接下来要做的事`:`Planning what to do next`;case`reviewer`:return r?t?`正在检查结果:${r}`:`Checking the result: ${r}`:t?`正在检查结果是否正确`:`Checking whether the result is correct`;default:return r?t?`正在处理:${r}`:`Working on: ${r}`:t?`正在处理当前任务`:`Working on the current task`}}var Mr=new Set([`running`,`in_progress`,`claimed`,`active`,`working`,`grounding`,`framed`]),Nr=new Set([`complete`,`completed`,`done`,`success`,`ended`]),Pr=new Set([`paused`,`stopped`,`cancelled`,`aborted`,`incomplete`,`blocked`,`stalled`]),Fr=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:null;function Ir(e){return String(e.item_id||e.mission_id||``).split(`:attempt:`)[0]}function Lr(e,t,n){let r=e?.backlog?.find(e=>e.id===n),i=Date.parse(e?.daemon.started_at_iso||``)/1e3;return Math.max(t?.mission.id===n&&t.mission.started_at||0,r?.started_ts||0,Number.isFinite(i)?i:0)}function Rr(e,t=0){let n=new Map;for(let r of e){if(Number(r.ts||0)zr.has(String(e.type||``))&&Ir(e)===t.id&&Number(e.ts||0)>=r);e?.type===`round.external_work_wait.started`&&(i=String(e.work_id||``)),a=e?.type===`round.external_work_wait.completed`}else return null;if(a)return null;let o=(e.background_work||[]).find(e=>i&&e.work_id===i||e.waited_by?.includes(t.id));return o?{workId:o.work_id,parts:(o.parts||[]).map(e=>({role:e.role,done:e.done,total:e.total,running:e.running})),done:o.done,total:o.total,lastProgressAt:Fr(o.last_progress_ts)}:i?{workId:i,parts:[],done:0,total:0,lastProgressAt:null}:null}function Vr(e,t,n=[],r=Date.now()/1e3){let i=t?.mission.id||e?.backlog?.find(e=>Mr.has(e.status)||e.status===`paused_external_work`)?.id||``,a=e?.backlog?.find(e=>e.id===i),o=Lr(e,t,i),s=e?.roles?.filter(e=>e.active)||[],c=(e?.backlog?.filter(e=>Mr.has(e.status)).length||0)>1,l=new Map;for(let e of t?.role_work||[])i&&(e.item_id||e.mission_id)!==i||e.tsMr.has(e.status)).sort((e,t)=>t.ts-e.ts).find(e=>s.some(t=>t.role===e.role))?.role||(c?``:(s.find(e=>e.role===t?.active_role)||s[0])?.role)||(e?``:t?.roles.find(e=>e.status===`active`)?.role)||``,d=n.filter(e=>{let t=Ir(e);return(!i||t===i)&&Number(e.ts||0)>=o&&!String(e.run_label||``).startsWith(`map-summary`)&&/(?:progress|round\.(?:main|review)|life\.(?:mission|phase)|work\.segment)/.test(String(e.type||``))}).map(e=>Fr(e.ts));for(let e of t?.role_work||[]){let t=e.item_id||e.mission_id;(!i||t===i)&&e.ts>=o&&e.kind!==`waiting`&&![`waiting`,`idle`].includes(e.status)&&d.push(Fr(e.ts))}let f=d.filter(e=>e!==null&&e<=r+5),p=f.length?Math.max(...f):null,m={state:`idle`,role:u,taskId:i,title:t?.mission.title||a?.title||t?.mission.objective||``,activityAt:p,activityAgeSeconds:p===null?null:Math.max(0,r-p),reason:``};if(!e||e.daemon.read_status===`error`)return{...m,state:`unknown`};if(e.manager_requests?.some(e=>e.status===`running`)??!1){let e=Fr(Rr(n)?.ts)??p;return{...m,state:`running`,role:`manager`,foreground:!0,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}if(!i){let e=[...n].reverse().find(e=>e.type===`ui.argus`&&e.mission_result===!0&&!e.item_id&&e.live!==!0);if(e){let t=Fr(e.ts);return{...m,state:`step_finished`,activityAt:t,activityAgeSeconds:t===null?null:Math.max(0,r-t),reason:e.success===!1?`task_failed`:``}}}let h=Br(e,a,n,o);if(h){let e=h.lastProgressAt??p;return{...m,state:`waiting`,role:``,reason:`background_work`,waitingOn:h,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}let g=String(a?.status||t?.mission.status||``).toLowerCase();if(Pr.has(g)||g.startsWith(`paused_`)||g===`research_incomplete`){let t=kr(e.pending_questions??[],e.backlog.map(e=>({...e})),i).some(e=>e.item_id===i);return{...m,state:`paused`,role:``,reason:t?`operator_input`:`not_running`}}if([`failed`,`error`].includes(g))return{...m,state:`step_finished`,role:``,reason:`task_failed`};if(Nr.has(g))return e.daemon.alive&&s.some(e=>e.role===`planner`)?{...m,state:`running`,role:`planner`}:{...m,role:``,state:e.daemon.alive&&(t?.routing?.continuous||e.continuous?.enabled)?`waiting`:`step_finished`};if(!e.daemon.alive)return Mr.has(g)?{...m,state:`paused`,role:``,reason:`not_running`}:{...m,role:``};let _=[...n].reverse().find(e=>e.type===`round.backend_failure.backoff`&&Number(e.ts||0)>=o&&(!i||Ir(e)===i));return _&&Number(_.ts||0)+Number(_.seconds||0)>r&&Number(_.ts||0)>=(p||0)?{...m,state:`waiting`,reason:`provider_wait`}:e.daemon.health?.stalled?{...m,state:`waiting`,reason:`no_recent_progress`}:u?{...m,state:`running`}:c&&s.length>0&&i?{...m,state:`unknown`}:{...m,state:`waiting`,reason:`awaiting_next_step`}}function Hr(e,t){let n=t===`zh-CN`;return e===null?``:e<60?n?`刚刚`:`just now`:e<3600?n?`${Math.floor(e/60)} 分钟前`:`${Math.floor(e/60)} min ago`:n?`${Math.floor(e/3600)} 小时前`:`${Math.floor(e/3600)} hr ago`}var Ur={"idea-route":[`条研究路线`,[`research route`,`research routes`]],"idea-review":[`次独立复核`,[`independent review`,`independent reviews`]],"idea-selector":[`次方案选择`,[`idea selection`,`idea selections`]]};function Wr(e,t){if(!e.total)return``;let[n,[r,i]]=Ur[e.role]??[`项子任务`,[`subtask`,`subtasks`]],a=e.total===1?r:i;return e.done===e.total?t?`${e.total} ${n}全部完成`:`all ${e.total} ${a} done`:t?`${e.total} ${n}中 ${e.done} ${n.slice(0,1)}完成`:`${e.done} of ${e.total} ${a} done`}function Gr(e,t){let n=t===`zh-CN`,r=e.waitingOn,i=(r?.parts??[]).map(e=>Wr(e,n)).filter(Boolean),a=i.length?i.join(n?`、`:`, `):r?.total?n?`${r.total} 项子任务中 ${r.done} 项完成`:`${r.done} of ${r.total} subtasks done`:``,o=Hr(e.activityAgeSeconds,t),s=o?n?o===`刚刚`?`,最近一次进展就在刚刚`:`,最近一次进展在 ${o}`:`, last progress ${o}`:``;return a?n?`正在等待后台团队:${a}${s}`:`Waiting for the background team: ${a}${s}`:n?`正在等待后台团队完成工作${s}`:`Waiting for the background team to finish${s}`}function Kr(e,t,n=!0){let r=t===`zh-CN`;return n?e.reason===`operator_input`?r?`当前任务等待你的回复`:`This task is waiting for your reply`:e.reason===`task_failed`?r?`这一步执行未完成`:`Execution of this step did not finish`:e.reason===`background_work`?Gr(e,t):e.state===`running`?e.foreground?r?`正在处理你的请求`:`Working on your request`:jr(e.role,r,e.title):e.reason===`provider_wait`?r?`模型服务暂时未能完成请求,等待后会重试`:`The model service could not complete the request; waiting before retrying`:e.reason===`no_recent_progress`?r?`暂时没有收到新的进展`:`No new progress received recently`:{running:[`正在处理当前任务`,`Working on the current task`],waiting:[`等待下一步工作`,`Waiting for the next step`],paused:[`当前任务未在运行`,`The current task is not running`],step_finished:[`这一步已结束`,`This step has ended`],idle:[`可以开始新任务`,`Ready for a new task`],unknown:[`暂时无法确认任务进度`,`Unable to confirm task progress right now`]}[e.state][+!r]:r?`实时连接已断开`:`Live connection lost`}var qr=new Set([`grounding`,`task`,`decision`,`agent_message`,`assistant_message`,`command_execution`,`tool_use`,`tool_result`,`handoff`,`review`,`verdict`,`completion`,`plan`,`file_change`,`result`]),Jr=/^(using a tool|running project command|inspecting project state|working|reporting progress|暂无详细记录)$/i;function Yr(e){let t=Te(e).replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/gim,``).trim();return Jr.test(t)||t.startsWith(`{`)?``:t}function Xr(e,t,n=``){if(n){if(/^(?:rg|grep|glob|search)$/.test(n))return t?`检索项目文件`:`Searching project files`;if(/^(?:view|read|read_file)$/.test(n))return t?`读取文件`:`Reading a file`;if(/apply_patch|edit|write/.test(n))return t?`编辑文件`:`Editing a file`;if(/bash|shell|exec|terminal/.test(n))return t?`运行终端命令`:`Running a command`;if(/playwright|browser/.test(n))return t?`检查浏览器交互`:`Checking browser interactions`}return({grounding:[`理解任务与检查项目`,`Understanding the task`],task:[`安排任务`,`Task assignment`],decision:[`确定执行方案`,`Execution decision`],plan:[`制定执行计划`,`Planning the work`],agent_message:[`更新执行进度`,`Progress update`],assistant_message:[`更新执行进度`,`Progress update`],command_execution:[`运行项目命令`,`Running a project command`],tool_use:[`使用工具`,`Using a tool`],tool_result:[`工具输出`,`Tool output`],file_change:[`更新项目文件`,`Updating project files`],handoff:[`整理结果与后续工作`,`Summarizing results and next steps`],review:[`检查实现与结果`,`Checking implementation and results`],verdict:[`说明检查结果`,`Explaining the check result`],completion:[`完成任务`,`Task completed`],result:[`产出结果`,`Result`]}[e]??[`处理当前任务`,`Working on the current task`])[+!t]}function Zr(e,t,n,r=0){let i=new Map;for(let a of e?.role_work??[]){if(a.role!==t||!qr.has(a.kind)||a.tst.ts-e.ts)}function Qr(e,t,n,r=0){return[...e].reverse().find(e=>e.type===`engineer.progress`&&Number(e.ts||0)>=r&&[`tool_use`,`command_execution`,`file_change`].includes(String(e.kind))&&String(e.agent_layer||e.actor||e.role)===t&&(!n||String(e.item_id||e.mission_id)===n))}function $r(e,t,n,r,i){return r||[`done`,`completed`,`failed`,`aborted`,`stopped`].includes(e?.mission.status??``)||i&&e?.mission.id!==i?!1:t.length?t.some(e=>e.role===n&&e.active):e?.active_role===n&&[`working`,`grounding`,`framed`,`running`].includes(e?.mission.status??``)}function ei(e,t){let n=Math.max(0,Math.floor(e));if(n<30)return``;let[r,i,a]=n<60?[n,`秒`,`s`]:n<3600?[Math.floor(n/60),`分钟`,`m`]:n<86400?[Math.floor(n/3600),`小时`,`h`]:[Math.floor(n/86400),`天`,`d`];return t?`上次更新 ${r} ${i}前`:`last update ${r}${a} ago`}function ti(e,t,n,r,i=!0,a=0){let o=Kr(e,r,i);if(!i||e.state!==`running`||e.foreground||!e.taskId||!e.role)return o;let s=Math.max(a,t?.mission.id===e.taskId&&t.mission.started_at||0),c=Zr(t,e.role,e.taskId,s).find(e=>e.detail&&[`agent_message`,`assistant_message`].includes(e.kind)||[`tool_use`,`command_execution`,`file_change`].includes(e.kind)),l=Qr(n,e.role,e.taskId,s);if(c?.detail&&[`agent_message`,`assistant_message`].includes(c.kind)&&(!l||Number(l.ts||0)=c.ts)){let t=Xr(String(l.kind),r===`zh-CN`,String(l.tool_name||``));return e.title?`${t}${r===`zh-CN`?`:`:`: `}${Ar(e.title,70)}`:t}return c&&[`tool_use`,`command_execution`,`file_change`].includes(c.kind)?Xr(c.kind,r===`zh-CN`):o}var ni=new Set([`running`,`in_progress`,`claimed`]);function ri({snap:e,streamOk:t,onStart:n,onStop:r,onManage:i,onOpenSessions:a,mobileView:o,onToggleMobileView:c,busy:l,snapshotStale:u=!1,readOnly:f=!1,missionView:p,events:h=[]}){let{t:g,locale:_}=F(),v=Vr(e,p,h),y=ti(v,p,h,_,t,Lr(e,p,v.taskId)),b=[`complete`,`completed`,`done`,`success`].includes(String(p?.mission.status||``).toLowerCase()),x=v.role||`manager`,S=v.state===`running`&&t&&!u,C=e.backlog.find(e=>ni.has(e.status)),w=v.title||C?.title||C?.objective||(b?p?.mission.summary||p?.mission.title:``)||e.session.objective||``,T=!!(e.partial||e.observability?.slo.status===`degraded`),E=typeof e.spend_usd==`number`?e.spend_usd:e.usage_summary?.known_cost_usd??0,D=e.daemon.alive&&e.daemon.control_available===!1,O=!e.daemon.alive&&[`running`,`waiting`].includes(Vr(e,p,h).state),k=D?g(`topbar.externallyManaged`):e.daemon.alive?g(`topbar.pauseDaemon`):g(O?`topbar.working`:`topbar.runDaemon`),A=T?[...(e.diagnostics??[]).map(e=>`${e.section}: ${e.message}`),...e.observability?.slo.violations??[]].join(` +`)||g(`common.degraded`):g(u?`common.stale`:t?`common.live`:`common.reconnecting`);return(0,K.jsxs)(it,{children:[a?(0,K.jsx)(`button`,{type:`button`,onClick:a,"aria-label":g(`topbar.openSessions`),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-ink-faint hover:bg-bg hover:text-ink lg:hidden`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,K.jsx)(`path`,{d:`M2.5 4h11M2.5 8h11M2.5 12h11`})})}):null,(0,K.jsxs)(`div`,{className:`topbar-heading flex min-w-0 flex-1 flex-col justify-center gap-0.5`,children:[(0,K.jsx)(`div`,{className:`topbar-title min-w-0 truncate text-sm font-semibold text-ink`,title:e.session.display_name||e.session.id,children:e.session.display_name||e.session.id}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[S?(0,K.jsx)(`span`,{"data-role-dot":x,"aria-label":g(`topbar.roleActive`,{role:yn(x,g)}),className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:R.role[x]||`rgb(var(--ink-faint))`}}):null,S||w?(0,K.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-ink-dim`,title:y,children:t?u?g(`common.stale`):y:g(`common.reconnecting`)}):null,(0,K.jsx)(xr,{session:e.session})]})]}),(0,K.jsx)(`span`,{title:A,className:`h-2 w-2 shrink-0 rounded-full transition-shadow duration-150 ${T||u?`bg-err ring-1 ring-err/30 ring-offset-1 ring-offset-panel`:t?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,children:(0,K.jsx)(`span`,{className:`sr-only`,children:A})}),E>0?(0,K.jsx)(wr,{settledUsd:e.spend_usd,knownUsd:e.usage_summary?.known_cost_usd,status:e.spend_status,calls:e.usage_summary?.call_count,premiumRequests:e.usage_summary?.premium_requests,live:e.daemon.alive,compact:!0}):null,c?(0,K.jsx)(`button`,{type:`button`,onClick:c,"aria-label":g(o===`activity`?`topbar.showPreview`:`topbar.showActivity`),title:g(o===`activity`?`topbar.showPreview`:`topbar.showActivity`),className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center lg:hidden`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:o===`activity`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`11`,rx:`1.5`}),(0,K.jsx)(`path`,{d:`M9.5 2.75v10.5`})]}):(0,K.jsx)(`path`,{d:`M3 4h10M3 8h10M3 12h7`})})}):null,f?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,disabled:l||D||O,onClick:e.daemon.alive?r:n,"aria-label":k,title:D?g(`topbar.externalDaemonHint`):k,className:`compact-control flex h-8 shrink-0 items-center gap-1 px-2 disabled:opacity-40`,children:[(0,K.jsx)(s,{icon:e.daemon.alive?m:d,className:`h-3 w-3`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:D?g(`common.external`):e.daemon.alive?g(`common.pause`):g(O?`common.working`:`common.run`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":g(`topbar.manageSession`),title:g(`topbar.manageSession`),onClick:i,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center text-sm tracking-widest`,children:`···`})]})]})}var ii=new Set([`done`,`success`,`completed`]),ai=new Set([`research_incomplete`,`paused_no_breakthrough`,`exhausted_current_methods`]),oi=new Set([`no_progress`,`max_rounds`]),si=new Set([`blocked`,`infra_blocked`]),ci=new Set([`error`,`failed`,`supervisor_error`]),li={completed:{glyph:`🎉`,tone:`ok`,missionStatus:`complete`},incomplete:{glyph:`◌`,tone:`warn`,missionStatus:`incomplete`},stalled:{glyph:`⏸`,tone:`warn`,missionStatus:`stalled`},blocked:{glyph:`⛔`,tone:`err`,missionStatus:`blocked`},failed:{glyph:`💥`,tone:`err`,missionStatus:`failed`},ended:{glyph:`■`,tone:`info`,missionStatus:`ended`}},ui={completed:`mission_completed`,incomplete:`mission_incomplete`,stalled:`mission_stalled`,blocked:`mission_blocked`,failed:`mission_failed`,ended:`mission_ended`},di={mission_completed:`The task was completed.`,mission_continued:`The task was completed and the project continues with the next one.`,mission_certified:`The final submission was checked and approved.`,mission_incomplete:`The task stopped with work still remaining.`,mission_stalled:`The task stopped because recent rounds made no useful progress.`,mission_blocked:`The task cannot continue until something outside it is resolved.`,mission_failed:`The task could not be completed.`,mission_paused:`The task was paused before it finished because {why}; its progress is saved and it can be resumed.`,mission_ended:`The task ended without a recorded outcome.`},fi={budget_exhausted:`the project reached its budget limit`,provider_cooldown:`the model service asked Argus to wait before calling again`,provider_fence:`the model provider is not accepting calls right now`,daemon_shutdown:`Argus was stopped`,operator_pause:`the operator paused the work`,operator_abort:`the operator cancelled the task`,backend_unavailable:`the model service was unavailable`,transient_error:`a temporary error interrupted the call`,permanent_error:`an error that will not clear on its own stopped the call`},pi={paused_budget:`budget_exhausted`,paused_provider_cooldown:`provider_cooldown`,paused_provider_fence:`provider_fence`,paused_daemon_shutdown:`daemon_shutdown`,paused_operator:`operator_pause`};function mi(e){return String(e??``).trim().toLowerCase()}function hi(e,t){if(e===`paused_external_work`)return`work outside Argus had to finish first`;let n=pi[e];return n?fi[n]:fi[t]?fi[t]:e.startsWith(`paused_`)?`the work was paused`:`the work was interrupted`}function gi(e){let t=mi(e);switch(t){case`completed`:case`incomplete`:case`stalled`:case`blocked`:case`failed`:case`ended`:return t;default:return null}}function _i(e){let t=mi(e.status);return e.success===!0||ii.has(t)?`completed`:ai.has(t)?`incomplete`:oi.has(t)?`stalled`:si.has(t)?`blocked`:ci.has(t)?`failed`:`ended`}function vi(e){let t=e.outcome;if(t&&typeof t==`object`&&!Array.isArray(t)){let n=t;return{execution_status:mi(n.execution_status)||_i(e),review_status:mi(n.review_status)||`not_assessed`,stage_certification:mi(n.stage_certification)||`not_assessed`,interruption_kind:mi(n.interruption_kind)||`none`,resumable:n.resumable===!0}}return{execution_status:_i(e),review_status:`not_assessed`,stage_certification:`not_assessed`,interruption_kind:mi(e.stop_kind)||`none`,resumable:e.resumable===!0}}function yi(e){if(e.success===!0&&e.campaign_continues===!0)return{outcomeClass:`completed`,kind:`mission_continued`,label:di.mission_continued,glyph:`↻`,tone:`info`,missionStatus:`continued`,technical:``};let t=gi(e.outcome_class)??_i(e),n=mi(e.status),r=li[t],i=ui[t],a=di[i],o=``;if(t===`completed`&&e.final_submission_certified===!0)i=`mission_certified`,a=di.mission_certified;else if(t===`ended`&&(o=String(e.status??``).trim(),n.startsWith(`paused_`)||e.resumable===!0)){let t=e.outcome&&typeof e.outcome==`object`&&!Array.isArray(e.outcome)?e.outcome:{},r=mi(e.stop_kind)||mi(t.interruption_kind);i=`mission_paused`,a=di.mission_paused.replace(`{why}`,hi(n,r))}return{outcomeClass:t,kind:i,label:a,glyph:r.glyph,tone:r.tone,missionStatus:r.missionStatus,technical:o}}function bi(e,t){let n=typeof e==`string`?e.trim():``;return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function xi(e,t){let n=t===`zh-CN`,r=bi(e.route,40),i=bi(e.workflow_mode,40),a=bi(e.execution_task,160),o;o=r===`self`?n?`计划由 Manager 直接处理`:`Manager plans to handle this request`:i===`staged`?r===`team`?n?`计划由团队分阶段推进`:`The team plans to work in stages`:n?`计划分阶段推进`:`The plan is to work in stages`:i===`direct`?r===`team`?n?`计划由团队直接处理`:`The team plans to handle this task directly`:n?`计划直接处理这项工作`:`The plan is to handle this task directly`:n?`处理方案已确定`:`A plan is ready`,a&&(o+=`${n?`:`:`: `}${a}`);let s=``;e.lifetime===`standing`&&e.open_ended!==!1||!e.lifetime&&e.open_ended===!0?s=n?`持续跟进后续工作。`:`Keep following up on subsequent work.`:e.lifetime===`bounded_increment`?s=n?`本次只推进一个明确的增量。`:`Limit this run to one defined increment.`:e.lifetime===`bounded`&&(s=e.continuous===!0&&e.open_ended===!1?n?`完成这次目标后结束。`:`Finish once this objective is met.`:n?`范围限于本次目标。`:`Keep the work within this objective.`);let c=bi(e.reason,320),l=c&&!/^(?:\[manager\]|manager routed\b|\{)/i.test(c)&&c!==(bi(e.execution_task,320)||bi(e.objective,320))?c:``;return[o,[s,l].filter(Boolean).join(n?``:` `)].filter(Boolean).join(` +`)}function Si(e){let t=e;return t=t.replace(/^(\s*(?:authorization|proxy-authorization)\s*:).*$/gim,`$1 `),t=t.replace(/^(\s*(?:x-api-key|api-key|cookie|set-cookie)\s*:).*$/gim,`$1 `),t=t.replace(/gh[pousr]_[A-Za-z0-9]{20,}/g,``).replace(/xox[baprs]-[A-Za-z0-9-]{10,}/g,``).replace(/AKIA[0-9A-Z]{16}/g,``).replace(/\bbearer\s+[A-Za-z0-9._\-+/=]{16,}/gi,``).replace(/(?`).replace(/(?`).replace(/\b([a-z][a-z0-9+.\-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi,`$1@`),{text:e,sensitive:t!==e}}function Ci(e){return Si(Te(e))}function q(e,t){let n=String(e??``).replace(/```[a-z]*\n?/gi,``).replace(/\[([^\]]+)\]\([^)]+\)/g,`[$1]`).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}var J=e=>e,Y=(e,t)=>String(J(e)[t]??``);function wi(e,t){return`${e} ${t}${e===1?``:`s`}`}function X(e,t,n){return e.locale===`zh-CN`?n:t}function Ti(e,t){let n=Y(e,`error_code`),r=Y(e,`failure_stage`),i=Y(e,`stop_kind`),a=[`daemon_shutdown`,`operator_pause`,`operator_abort`].includes(i);if(n===`cancelled`&&r===`commit`&&Y(e,`status`)===`issued`)return{text:X(t,`Applying the adjustment was interrupted; the saved decision is waiting to be applied.`,`应用调整时被中断,已保存的决定等待继续处理。`),tone:`warn`};if(n===`timeout`&&r===`commit`)return{text:X(t,`Manager reached a decision, but applying the adjustment timed out.`,`Manager 已作出判断,但应用调整超时。`),tone:`warn`};let o={trial_quota_exceeded:[`The remaining trial quota cannot cover this Manager check.`,`剩余试用额度不足以启动这次 Manager 检查。`],observation_incomplete:[`Manager could not fully read the required project evidence; this check has stopped.`,`Manager 未能完整读取所需的项目资料,这次检查已停止。`],timeout:[`The model did not respond before the Manager check timed out.`,`模型未在时限内返回,Manager 这次检查已结束。`],cancelled:[`This Manager check was cancelled.`,`已取消这次 Manager 检查。`],superseded:[`New input or evidence superseded this Manager check.`,`新的操作或证据已取代这次 Manager 检查。`]};if(Object.hasOwn(o,n)&&!(n===`cancelled`&&a))return{text:X(t,...o[n]),tone:n===`cancelled`||n===`superseded`?`dim`:`warn`};let s={budget_exhausted:[`The project budget limit prevented this Manager check.`,`项目预算已达上限,Manager 暂未完成检查。`],provider_cooldown:[`The model service asked Manager to wait before calling again.`,`模型服务要求稍后再调用,Manager 暂未完成检查。`],provider_fence:[`The model service is not accepting calls; Manager could not finish this check.`,`模型服务当前不接受调用,Manager 未完成这次检查。`],backend_unavailable:[`The model service was unavailable for this Manager check.`,`模型服务不可用,Manager 未完成这次检查。`],transient_error:[`A temporary model service error interrupted this Manager check.`,`模型服务的临时错误中断了这次 Manager 检查。`],permanent_error:[`The model call failed; Manager could not finish this check.`,`模型调用失败,Manager 未完成这次检查。`],daemon_shutdown:[`Argus stopped, ending this Manager check.`,`Argus 已停止,这次 Manager 检查已结束。`],operator_pause:[`This Manager check was paused by your request.`,`已按你的要求暂停这次 Manager 检查。`],operator_abort:[`This Manager check was cancelled by your request.`,`已按你的要求取消这次 Manager 检查。`]};if(Object.hasOwn(s,i))return{text:X(t,...s[i]),tone:a?`dim`:`warn`};let c=Y(e,`status`);return c===`cancelled`||c===`superseded`?{text:X(t,`This Manager check was cancelled.`,`这次 Manager 检查已取消。`),tone:`dim`}:{text:r===`commit`&&[`continue`,`wait`,`steer`].includes(Y(e,`action`))?X(t,`Manager reached a decision, but the team adjustment could not be applied.`,`Manager 已作出判断,但团队调整未能生效。`):r===`decision`?X(t,`Manager returned a decision that could not be validated.`,`Manager 返回的判断或引用依据未通过核验。`):X(t,`Manager could not finish this check.`,`Manager 未能完成这次检查。`),tone:`warn`}}function Z(e,t,n,r,i,a={}){let o=Ci(r);return{visibility:a.visibility??(i===`err`||i===`warn`?`alert`:`normal`),role:e,labelKey:t,glyph:n,tone:i,segments:o.text?[{kind:`text`,text:o.text}]:[],expandable:a.expandable===!0,sensitive:o.sensitive||a.sensitive===!0,fallback:a.fallback===!0,rule:a.rule===!0,reasoning:a.reasoning===!0}}function Ei(){return{visibility:`hidden`,role:`system`,labelKey:`event.hidden`,glyph:``,tone:`dim`,segments:[],expandable:!1,sensitive:!1,fallback:!1,rule:!1,reasoning:!1}}function Di(e,t){if(J(e).operator_alert===!0){let n=q(Y(e,`text`)||Y(e,`reason`)||e.type,170);return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,n,`err`,{rule:!0})}if(t.unknownEventPolicy===`hide`)return Ei();let n=String(e.type||`?`),r=Y(e,`text`).trim();return Z(`system`,`event.fallback`,`•`,`[${n}]${r?` ${r}`:``}`,`dim`,{fallback:!0})}function Oi(e,t=`engineer`){return Y(e,`agent_layer`)||(e.type.startsWith(`life.manager.`)?`manager`:e.type.startsWith(`life.planner.`)?`planner`:e.type.startsWith(`round.review.`)?`reviewer`:t)}function ki(e,t){let n=Y(e,`phase`),r=Y(e,`cause`)||Y(e,`backend_error`),i=Y(e,`error`);if(!n||!r)return`${X(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} ${q(i,t.density===`full`?160:140)}`;let a={backend:[`model service`,`模型服务`],parse:[`reading the answer`,`读取回答`],contract:[`answer shape:`,`回答格式:`],timeout:[`timed out`,`超时`]},o=a[n]?X(t,a[n][0],a[n][1]):n,s=Number(J(e).attempts||0),c=s>1?X(t,` (attempt ${s})`,` (第${s}次尝试)`):``,l=`${X(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} · ${o} ${r}${c}`;return i?`${l} · ${X(t,`error text`,`原始错误`)}: ${i}`:l}function Ai(e){let t=J(e).round_index??J(e).round;return typeof t==`string`||typeof t==`number`?t:`?`}function ji(e,t){let n=Y(e,`kind`),r=Oi(e),i=`role.${r}`;if(n===`reasoning`){if(!t.showReasoning)return Ei();let n=q(Y(e,`text`),280);return n?Z(r,i,`∴`,n,`dim`,{expandable:t.density===`full`,reasoning:!0}):Ei()}if(n===`assistant_message`||n===`agent_message`||n===`message`){if(te(J(e)))return Di(e,t);let n=Ci(Y(e,`text`));return n.text?Z(r,i,`▌`,n.text,`bright`,{expandable:t.density===`full`,sensitive:n.sensitive}):Ei()}if(n===`command_execution`){let n=Y(e,`text`)||Y(e,`command`)||Y(e,`action_summary`),a=Y(e,`status`)===`failed`?`err`:`dim`;return n?Z(r,i,`▸ $`,n,a,{expandable:t.density===`full`}):Ei()}if(n===`tool_use`||n===`file_change`){let a=Y(e,`text`)||Y(e,`action_summary`);if(!a&&t.density===`full`)return Ei();let o=n===`file_change`?X(t,`(file change)`,`(文件变更)`):X(t,`(tool)`,`(工具)`);return Z(r,i,n===`file_change`?`✎`:`⚙`,a||o,Y(e,`status`)===`failed`?`err`:`dim`,{expandable:t.density===`full`})}if(t.density===`full`)return Ei();let a=String(J(e).text??J(e).action_summary??``).split(` +`)[0]?.trim()??``;return a?Z(r,i,`▸`,q(a,160),`dim`):Ei()}function Mi(e,t){let n=A(J(e).canonical_type??e.type);if(n&&n!==e.type)return Mi({...e,type:n},t);switch(e.type){case`advisor.consultation.requested`:case`life.manager.supervision.issued`:return Ei();case`advisor.consultation.completed`:{let t=Y(e,`question`).trim(),n=Y(e,`summary`).trim();return!t&&!n?Ei():Z(`advisor`,`role.advisor`,`◇`,[t,n].filter(Boolean).join(` +`),`info`,{expandable:!0})}case`advisor.consultation.cancelled`:{let n=q(Y(e,`question`),160);return Z(`advisor`,`role.advisor`,`◇`,`${X(t,`Consultation cancelled`,`已取消咨询`)}${n?` · ${n}`:``}`,`dim`)}case`advisor.consultation.failed`:case`advisor.consultation.timed_out`:case`advisor.consultation.model_mismatch`:{let n=e.type.endsWith(`model_mismatch`)?X(t,`The provider returned a different model`,`接入返回的模型与所选模型不一致`):e.type.endsWith(`timed_out`)?X(t,`The advisor did not respond in time`,`顾问未在时限内返回`):X(t,`The consultation did not finish`,`顾问咨询未完成`),r=q(Y(e,`question`),160);return Z(`advisor`,`role.advisor`,`◇`,`${n}${r?` · ${r}`:``}`,`warn`,{expandable:!0})}case`life.manager.supervision.applied`:return Z(`manager`,`role.manager`,`🧭`,Y(e,`summary`)||Y(e,`reason`),`info`,{expandable:!0,rule:!0});case`life.peer.message.processed`:return Z(`manager`,`role.peer`,`↔`,Y(e,`text`),`info`,{expandable:!0});case`life.manager.supervision.failed`:{let n=Ti(e,t);return Z(`manager`,`role.manager`,`🧭`,n.text,n.tone,{expandable:!0})}case`engineer.progress`:return ji(e,t);case`life.manager.intent.started`:return Z(`manager`,`role.manager`,`🧭`,X(t,`Working out how to handle your request…`,`正在安排处理方式…`),`info`);case`life.manager.intent.completed`:return Z(`manager`,`role.manager`,`🧭`,xi(J(e),t.locale),`info`,{expandable:!0});case`life.manager.intent.failed`:return Z(`manager`,`role.manager`,`⚠`,ki(e,t),`err`,{expandable:t.density===`full`});case`life.manager.stage_decision`:{let n=Y(e,`target_stage`)||Y(e,`stage`)||Y(e,`current_stage`);return Z(`manager`,`role.manager`,`🧭`,`${Y(e,`action`)}${n?` → ${n}`:``} ${q(Y(e,`reason`),t.density===`full`?140:120)}`,`info`)}case`life.research.second_reading`:{let n=Oi(e,`manager`),r=q(Y(e,`supported`),160),i=X(t,`reread the evidence and reworked the plan`,`重读了证据并重排了计划`);return Z(n,`role.${n}`,`📖`,r?`${i} · ${r}`:i,`info`)}case`life.letter.written`:{let n=Oi(e,`manager`);return Z(n,`role.${n}`,`✉`,X(t,`wrote you a letter`,`给你写了一封信`),`accent`)}case`life.planner.start`:return Z(`planner`,`role.planner`,`📋`,`${X(t,`planning`,`正在规划`)} ${q(Y(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.verdict`:return Y(e,`status`)===`done`||J(e).project_done===!0?Z(`planner`,`role.planner`,`🏁`,X(t,`the project is finished`,`项目已完成`),`ok`):Z(`planner`,`role.planner`,`📋`,X(t,`lined up ${Y(e,`queued`)||Y(e,`n`)||`next`} task(s) to do next`,`已排好 ${Y(e,`queued`)||Y(e,`n`)||`下一`} 个接下来要做的任务`),`accent`);case`life.planner.task_added`:return Z(`planner`,`role.planner`,`+`,`${X(t,`added a task`,`新增任务`)} · ${q(Y(e,`title`)||Y(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.task_skipped`:return Z(`planner`,`role.planner`,`⏭`,`${Y(e,`skip_category`)===`paper_review_purchase_deferred`?X(t,`put off another paper review`,`推迟了再买一次评审`):X(t,`skipped a task already planned`,`跳过了已在计划中的任务`)} ${q(Y(e,`title`),t.density===`full`?140:120)}`,`dim`);case`life.planner.preview_skipped`:return Z(`planner`,`role.planner`,`⏭`,X(t,`skipped the plan preview: the research Planner owns the campaign plan`,`跳过了计划预览:研究规划师负责整个计划`),`dim`);case`life.planner.normalized`:return Z(`planner`,`role.planner`,`≋`,`${X(t,`tidied the plan`,`整理了计划`)} · ${q(Y(e,`diagnostic`),180)}`,`dim`);case`life.planner.waiting`:return Z(`planner`,`role.planner`,`⌛`,`${X(t,`waiting`,`等待中`)} · ${q(Y(e,`reason`),180)}`,`info`);case`life.planner.waiting_woken`:return Z(`planner`,`role.planner`,`↻`,`${X(t,`resumed`,`已唤醒`)} · ${q(Y(e,`wake_reason`),180)}`,`info`);case`life.planner.terminal_idle`:return Z(`planner`,`role.planner`,`Ⅱ`,`${X(t,`nothing left to plan`,`暂时没有要规划的`)} · ${q(Y(e,`reason`),180)}`,`dim`);case`life.planner.verification_probe`:return t.showReasoning?Z(`planner`,`role.planner`,`⌕`,`${X(t,`checking that the plan still holds`,`检查计划是否仍然成立`)} · ${q(Y(e,`reason`),180)}`,`dim`):Ei();case`life.planner.error`:return Z(`planner`,`role.planner`,`⚠`,`${X(t,`the Planner hit an error`,`规划者出错`)} ${q(Y(e,`error`)||Y(e,`text`),t.density===`full`?160:140)}`,`err`);case`life.mission.started`:return Z(`engineer`,`role.engineer`,`🚀`,q(Y(e,`title`)||Y(e,`objective`)||Y(e,`text`)||X(t,`started work on this task`,`开始做这项任务`),t.density===`full`?180:160),`info`,{rule:!0});case`round.start`:return Z(`engineer`,`role.engineer`,`──`,X(t,`round ${Ai(e)}`,`第 ${Ai(e)} 轮`),`dim`,{rule:!0});case`life.phase.started`:{let n=Y(e,`label`)||Y(e,`phase`),r=Oi(e);return n?Z(r,`role.${r}`,`🔄`,X(t,`entering ${n}`,`进入 ${n}`),`info`):Ei()}case`round.review.started`:return Z(`reviewer`,`role.reviewer`,`🔄`,X(t,`the Reviewer checks round ${Ai(e)}`,`审阅者检查第 ${Ai(e)} 轮`),`info`);case`round.review.deferred`:return Z(`engineer`,`role.engineer`,`↪`,X(t,`carries on into the next round without a review · ${q(Y(e,`next_step`),t.density===`full`?180:160)}`,`不经审阅直接进入下一轮 · ${q(Y(e,`next_step`),t.density===`full`?180:160)}`),`info`);case`round.main.completed`:return Z(`engineer`,`role.engineer`,`✅`,X(t,`finished round ${Ai(e)} of work`,`第 ${Ai(e)} 轮工作已完成`),`info`);case`round.review.completed`:{if(e.review_skipped===!0)return Z(`reviewer`,`role.reviewer`,`↪`,`${X(t,`no review this round`,`这一轮没有审阅`)} · ${q(Y(e,`reason`),t.density===`full`?200:160)}`,`info`);let n=Y(e,`status`),r=n===`done`?q(Y(e,`residual_risk`),200):``;if(r)return Z(`reviewer`,`role.reviewer`,`⚠`,`${X(t,`verified with residual risk`,`已验证,但有残余风险`)}: ${r} · ${q(Y(e,`reason`),t.density===`full`?200:160)}`,`warn`);let i=n===`done`?`ok`:n===`blocked`||n===`no_progress`?`err`:`warn`;return Z(`reviewer`,`role.reviewer`,n===`done`?`✅`:n===`blocked`||n===`no_progress`?`⛔`:`↻`,`${Li(n,t)} · ${q(Y(e,`reason`),t.density===`full`?200:160)}`,i)}case`life.mission.completed`:{let n=yi(J(e)),r=q(Y(e,`summary`),240),i=q(Y(e,`residual_risk`),200);return i&&n.tone===`ok`?Z(`engineer`,`role.engineer`,`⚠`,`${X(t,`completed with residual risk`,`已完成,但有残余风险`)} · ${r.includes(i)?r:`${i}${r?` · ${r}`:``}`}`,`warn`,{rule:!0}):Z(`engineer`,`role.engineer`,n.glyph,r?`${n.label} · ${r}`:n.label,n.tone,{rule:!0})}case`life.mission.failed`:return Z(`engineer`,`role.engineer`,`❌`,`${X(t,`this task failed`,`这项任务失败了`)} ${q(Y(e,`reason`)||Y(e,`error`),t.density===`full`?160:140)}`,`err`,{rule:!0});case`loop.start`:return Z(`engineer`,`role.engineer`,`▶`,q(Y(e,`text`)||Y(e,`objective`),t.density===`full`?16e3:160),`info`,{expandable:t.density===`full`});case`loop.done`:return Z(`engineer`,`role.engineer`,`🏁`,`${X(t,`the run finished`,`这次运行结束`)} ${q(Y(e,`text`),t.density===`full`?140:120)}`,`dim`);case`life.inbox.queued`:return Z(`system`,`role.operator`,`📥`,`${X(t,`you added guidance`,`你追加了指导`)} · ${q(Y(e,`text`),t.density===`full`?180:160)}`,`accent`);case`daemon.parked`:{let n=Y(e,`replaced_by`),r=X(t,`Argus set this project aside with its state saved`,`Argus 已把这个项目搁置,状态已保存`);return Z(`system`,`role.system`,`Ⅱ`,n?`${r} · ${X(t,`continued as ${n}`,`由 ${n} 接续`)}`:r,`warn`,{rule:!0})}case`accounting.journal_repaired`:{let n=J(e).damaged_lines,r=J(e).liabilities,i=Array.isArray(n)?n.length:0,a=Array.isArray(r)?r.length:0,o=q(Y(e,`damaged_copy`),120),s=`the usage journal was repaired: ${i} damaged line(s) set aside${o?` in ${o}`:``}, ${a} call(s) written back as a liability`,c=`用量账本已修复:${i} 行损坏记录已另存${o?`到 ${o}`:``},${a} 次调用按负债记回`;return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,X(t,s,c),`warn`,{rule:!0})}case`provider.request.denied`:{let n=Y(e,`provider`);return Z(`system`,`event.quota`,`⏸`,`${X(t,`a request to ${n||`the model service`} was held back`,`发往${n||`模型服务`}的一次请求被暂缓`)} · ${q(Y(e,`reason`),160)}`,`warn`,{rule:!0})}case`round.reviewer_backend_failure`:{let n=q(Y(e,`text`),150),r=t.density===`full`?X(t,`the Reviewer's model service is unreachable — waiting rather than going on unchecked`,`审阅者的模型服务连不上 — 先等待,不在无人审阅的情况下继续`):X(t,`the Reviewer's model service is unreachable — waiting`,`审阅者的模型服务连不上 — 先等待`);return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${r} · ${n}`,`err`,{rule:!0})}case`round.stall`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,q(Y(e,`text`)||X(t,t.density===`full`?`no progress this round — keeping a close eye on it`:`no progress this round`,`这一轮没有进展`),170),`warn`);case`round.escalated`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,q(Y(e,`text`)||X(t,`many rounds without a finish — raising what is blocking the work`,`轮次已经很多还没做完 — 把外部阻碍提出来`),170),`warn`);case`life.planner.stall_escalation`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${X(t,`the Planner is stuck`,`规划者卡住了`)} — ${q(Y(e,`reason`)||Y(e,`text`),150)}`,`warn`);case`life.budget.pause`:return Y(e,`stop_kind`)===`cost_unreconciled`||Y(e,`reason`).startsWith(`unresolved provider cost`)?Z(`system`,`event.budget`,`$`,X(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Z(`system`,`event.watch`,`⏸`,X(t,`budget cap reached — paused · ${q(Y(e,`text`)||Y(e,`reason`),140)}`,`已达到预算上限 — 已暂停 · ${q(Y(e,`text`)||Y(e,`reason`),140)}`),`warn`);case`budget.reservation.denied`:return Y(e,`reason`).startsWith(`unresolved provider cost`)?Z(`system`,`event.budget`,`$`,X(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Z(`system`,`event.budget`,`$`,`${X(t,`budget denied`,`预算申请被拒绝`)} — ${q(Y(e,`reason`)||Y(e,`text`),t.density===`full`?160:150)}`,`err`,{rule:!0});case`budget.unpriced.blocked`:return Z(`system`,`event.budget`,`$`,X(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`);case`budget.unpriced.acknowledged`:return Z(`system`,`event.budget`,`$`,X(t,`Single-call cost risk approved; original usage remains pending`,`已批准单笔费用风险;原始费用仍待对账`),`warn`);case`life.lifecycle.block`:return Z(`system`,`event.watch`,`⛔`,`${X(t,`blocked — needs you`,`卡住了 — 需要你来处理`)} · ${q(Y(e,`text`)||Y(e,`reason`),150)}`,`err`,{rule:!0});case`life.daemon.idle_timeout`:return Z(`system`,`event.watch`,`🟦`,q(Y(e,`text`)||X(t,`nothing to do for a while — standing by`,`一段时间没有事做 — 待命中`),150),`dim`);case`operator_alert`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,q(Y(e,`text`)||Y(e,`reason`)||e.type,170),`err`,{rule:!0});case`life.supervisor.error`:return Z(`system`,`role.system`,`⚠`,`${X(t,`Argus hit an internal error while coordinating the work`,`Argus 在统筹工作时遇到内部错误`)} · ${q(Y(e,`error`),160)}`,`err`,{rule:!0});case`life.auth_failure`:return Z(`system`,`role.system`,`🔑`,X(t,`the model service rejected the sign-in — refresh the credentials and Argus will carry on`,`模型服务拒绝了登录 — 更新凭据后 Argus 会继续`),`err`,{rule:!0});case`life.planner.deferred`:return Z(`planner`,`role.planner`,`⌛`,`${X(t,`planning is on hold`,`规划暂缓`)} · ${q(Y(e,`reason`),180)}`,`dim`);case`life.post_mission.stop`:return Z(`system`,`role.system`,`■`,`${X(t,`stopped after this task`,`这项任务之后停下`)} · ${q(Y(e,`reason`),180)}`,`info`);case`life.planner.final_submission_skipped`:return Z(`planner`,`role.planner`,`⏭`,`${X(t,`dropped an outdated final-submission task`,`跳过了一项过时的最终提交任务`)} · ${q(Y(e,`title`),140)}`,`dim`);case`life.execution_host.blocked`:return Z(`system`,`event.watch`,`⛔`,q(Y(e,`reason`)||X(t,`the program that runs code for Argus could not be started`,`为 Argus 运行代码的程序无法启动`),t.density===`full`?260:180),`err`,{rule:!0});case`life.mission.provider_configuration_disabled`:{let n=Number(J(e).streak||0),r=X(t,`the model configuration failed ${wi(n,`time`)} in a row — this task is paused until you decide`,`模型配置连续 ${n} 次失败 — 这项任务已暂停,等待你的决定`),i=q(Y(e,`text`),160);return Z(`system`,`event.watch`,`⛔`,i?`${r} · ${i}`:r,`err`,{rule:!0})}case`life.iteration.continued`:return Z(`critic`,`role.critic`,`🔁`,X(t,`lined up the next iteration`,`排好了下一轮迭代`),`dim`);case`life.learned_vertical.promoted`:return Z(`manager`,`role.manager`,`★`,X(t,`made the learned domain "${Y(e,`vertical`)}" official`,`把新学到的领域「${Y(e,`vertical`)}」正式收录`),`accent`);case`life.learned_vertical.promotion_failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`could not record "${Y(e,`vertical`)}" as a formal domain`,`未能把「${Y(e,`vertical`)}」收录为正式领域`)} · ${q(Y(e,`error`),140)}`,`warn`);case`life.review.waived`:return Z(`planner`,`role.planner`,`↪`,`${X(t,`this task will skip the independent review`,`这项任务将不做独立审阅`)} · ${q(Y(e,`reason`),160)}`,`dim`);case`life.manager.feedback.exhausted`:{let n=Number(J(e).attempts||0);return Z(`manager`,`role.manager`,`⚠`,`${X(t,`the Manager's objection went unanswered ${wi(n,`time`)} — planning pauses for a while`,`管理者的异议 ${n} 次未被回应 — 规划暂停一段时间`)} · ${q(Y(e,`reason`),140)}`,`warn`)}case`life.manager.feedback.persisted`:{let n=Y(e,`stage`);return Z(`manager`,`role.manager`,`↩`,`${n?X(t,`sent the plan back for another pass at ${n}`,`把计划退回 ${n} 阶段再改一轮`):X(t,`sent the plan back for another pass`,`把计划退回再改一轮`)} · ${q(Y(e,`reason`),160)}`,`info`)}case`life.manager.goal_contract.failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`could not save the agreed goal`,`未能保存商定的目标`)} · ${q(Y(e,`error`),140)}`,`warn`);case`life.manager.intent.superseded`:return Z(`manager`,`role.manager`,`↷`,X(t,`a newer instruction replaced this request`,`更新的指令取代了这个请求`),`info`);case`life.manager.project_report.failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`could not deliver the project report`,`未能送出项目报告`)} · ${q(Y(e,`error`),140)}`,`warn`);case`life.planner.completion_circuit_opened`:{let n=Number(J(e).consecutive_rejections||0);return Z(`planner`,`role.planner`,`⏸`,X(t,`the same completion requirement turned the plan back ${wi(n,`time`)} — pausing completion attempts until something changes`,`同一项完成要求已 ${n} 次打回计划 — 暂停完成尝试,直到情况变化`),`warn`)}case`life.planner.completion_rejected`:return Z(`manager`,`role.manager`,`↩`,`${X(t,`the Manager did not accept the completion claim`,`管理者未接受完成的说法`)} · ${q(Y(e,`reason`),160)}`,`info`);case`life.planner.continuation_required`:return Z(`planner`,`role.planner`,`↻`,X(t,`finished one increment; the standing objective continues`,`完成了一个增量;长期目标继续推进`),`dim`);case`life.planner.superseded`:return Z(`planner`,`role.planner`,`↷`,X(t,`dropped an outdated planning pass after a newer instruction`,`收到更新的指令,放弃了过时的规划`),`dim`);case`life.planner.wait_overridden`:return Z(`planner`,`role.planner`,`+`,`${X(t,`scheduled independent work instead of waiting`,`不再干等,安排了独立的工作`)} · ${q(Y(e,`task_title`),140)}`,`info`);case`life.daemon.degraded`:return Z(`system`,`role.system`,`⚠`,`${X(t,`Argus started, but the objective did not reach the Manager`,`Argus 已启动,但目标没有交到管理者手上`)} · ${q(Y(e,`error`),140)}`,`warn`);case`round.orphan_process_group`:return Z(`engineer`,`role.engineer`,`⚠`,J(e).cleanup_succeeded===!0?X(t,`background processes outlived the turn and were cleaned up`,`有后台进程在这一轮结束后仍在运行,已清理`):X(t,`background processes outlived the turn and could not be cleaned up`,`有后台进程在这一轮结束后仍在运行,未能清理`),`warn`);case`round.model_configuration_error`:return Z(`engineer`,`role.engineer`,`⛔`,`${X(t,`the model configuration is not usable`,`模型配置无法使用`)} · ${q(Y(e,`text`)||Y(e,`error`),160)}`,`err`,{rule:!0});case`round.watchdog.retry`:{let n=Number(J(e).attempt||0),r=Number(J(e).max_attempts||0);return Z(`engineer`,`role.engineer`,`↻`,X(t,`the model call failed — retrying in a fresh session (attempt ${n} of ${r})`,`模型调用失败 — 在新会话中重试(第 ${n} 次,共 ${r} 次)`),`warn`)}case`round.watchdog.retry_exhausted`:{let n=Number(J(e).attempt||0),r=q(Y(e,`fatal_error`),140),i=X(t,`the model call kept failing — giving up after ${wi(n,`attempt`)}`,`模型调用持续失败 — ${n} 次后放弃`);return Z(`engineer`,`role.engineer`,`⛔`,r?`${i} · ${r}`:i,`err`,{rule:!0})}case`round.backend_failure.backoff`:{let n=Math.round(Number(J(e).seconds||0));return Z(`engineer`,`role.engineer`,`⏳`,q(Y(e,`text`)||X(t,`the model service failed — waiting ${n}s before trying again`,`模型服务出错 — 等待 ${n} 秒后再试`),200),`warn`)}case`round.backend_failure.hold_interrupted`:return Z(`engineer`,`role.engineer`,`↪`,q(Y(e,`text`)||X(t,`the wait after a model-service failure ended early`,`模型服务出错后的等待提前结束`),180),`info`);case`round.provider_turn_cap.restart`:return Z(`engineer`,`role.engineer`,`↻`,X(t,`reached the per-call turn allowance — continuing the same task in a fresh session`,`达到单次调用的轮次上限 — 在新会话中继续同一任务`),`info`);case`round.provider_turn_cap.reviewer_restart`:return Z(`reviewer`,`role.reviewer`,`↻`,X(t,`the review reached its turn allowance — restarting it in a fresh session`,`审阅达到轮次上限 — 在新会话中重新开始`),`info`);case`round.reviewer_backend_failure.backoff`:{let n=Math.round(Number(J(e).seconds||0));return Z(`reviewer`,`role.reviewer`,`⏳`,q(Y(e,`text`),200)||X(t,`the Reviewer's model service is unavailable — retrying in ${n}s`,`审阅者的模型服务不可用 — ${n} 秒后重试`),`warn`)}case`round.external_work_wait.started`:return Z(`engineer`,`role.engineer`,`⌛`,`${X(t,`waiting for background work to report`,`等待后台工作汇报`)} · ${q(Y(e,`work_id`),80)}`,`dim`);case`round.external_work_wait.completed`:return Z(`engineer`,`role.engineer`,`↻`,X(t,`background work reported — resuming`,`后台工作已汇报 — 继续`),`dim`);case`round.external_work_review.required`:return Z(`reviewer`,`role.reviewer`,`⌛`,`${X(t,`background work finished — an independent review of its result is required before resuming`,`后台工作已结束 — 恢复前需要对其结果做一次独立审阅`)} · ${q(Y(e,`work_id`),80)}`,`dim`);case`round.external_work_review.completed`:return Z(`reviewer`,`role.reviewer`,`✓`,`${X(t,`background work result reviewed`,`后台工作结果已审阅`)} · ${q(Y(e,`review_status`),40)}`,`dim`);case`plan.draft.failed`:return Z(`planner`,`role.planner`,`⚠`,`${X(t,`could not draft the plan`,`未能起草计划`)} · ${q(Y(e,`reason`),140)}`,`err`);case`plan.draft.done`:{let n=Number(J(e).steps||0);return Z(`planner`,`role.planner`,`📋`,X(t,`drafted a plan with ${wi(n,`step`)}`,`起草了一份 ${n} 步的计划`),`dim`)}case`team.learning.review.started`:return Z(`manager`,`role.manager`,`📚`,X(t,`reviewing what this task taught the team`,`整理这项任务给团队带来的经验`),`dim`);case`team.learning.review.failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`the team learning review failed`,`团队经验整理失败`)} · ${q(Y(e,`error`),140)}`,`warn`);case`team.learning.review.completed`:{let n=Number(J(e).created||0),r=Number(J(e).updated||0);return Z(`manager`,`role.manager`,`📚`,X(t,`kept ${n} new and ${r} updated team procedures`,`保留了 ${n} 条新的、${r} 条更新的团队做法`),`dim`)}case`team.learning.promotion.quarantined`:return Z(`manager`,`role.manager`,`⚠`,X(t,`set aside a new procedure that would have judged its own work`,`搁置了一条会评判自己工作的新做法`),`warn`);case`self.learning.review.failed`:return Z(`system`,`role.system`,`⚠`,`${X(t,`the review of Argus's own conversation habits failed`,`对 Argus 自身对话习惯的复盘失败`)} · ${q(Y(e,`error`),140)}`,`warn`);case`domain.promotion`:return Z(`manager`,`role.manager`,`★`,q(Y(e,`text`),180),`dim`);case`idea.portfolio.formed`:{let n=J(e).selection,r=n&&typeof n==`object`?String(n.route_id??``):``,i=Number(J(e).route_count||0),a=q(Y(e,`text`),180),o=i>0?X(t,`formed an idea portfolio of ${wi(i,`route`)}`,`组成了 ${i} 条思路的组合`):X(t,`formed an idea portfolio`,`组成了思路组合`);return Z(`engineer`,`role.engineer`,`💡`,r?X(t,`chose route ${r} from the idea portfolio`,`从思路组合中选定了路线 ${r}`):a||o,`accent`)}case`user.note`:{let n=Array.isArray(J(e).tags)?J(e).tags.map(String):[];if(n.includes(`config`))return Ei();if(n.includes(`planner`))return Z(`planner`,`role.planner`,`📝`,X(t,`updated the research plan`,`更新了研究计划`),`dim`);let r=q(Y(e,`summary`)||Y(e,`text`)||Y(e,`title`),180);return Z(`system`,`role.operator`,`📝`,`${X(t,`you added a note`,`你添加了一条笔记`)}${r?` · ${r}`:``}`,`accent`)}case`ui.operator`:{let t=Y(e,`text`);return t.trim()?Z(`system`,`role.operator`,`›`,t,`accent`,{rule:!0}):Ei()}case`ui.argus`:{let n=Y(e,`text`),r=J(e).live===!0||Array.isArray(J(e).steps)&&J(e).steps.length>0;return n.trim()||r?Z(`manager`,`role.argus`,`▌`,n,`bright`,{expandable:t.density===`full`,rule:!0}):Ei()}case`agent.io.start`:case`agent.io.stream`:case`agent.io.complete`:case`agent.io.error`:case`usage.recorded`:case`provider.request.started`:case`provider.request.completed`:case`codex.util.completed`:case`skill.cost.completed`:case`budget.reservation.created`:case`budget.reservation.settled`:case`budget.reservation.released`:case`round.checkpoint.recorded`:case`round.checkpoint.failed`:case`round.secret_redacted`:case`role.session.turn`:case`engineer.skill_maintenance.completed`:case`life.status`:case`life.mission.skipped`:case`life.mission.orphaned`:case`life.mission.requeued`:case`life.manager.plan_challenge.decided`:case`life.vertical.resolved`:case`life.manager.backend_resolved`:case`life.planner.backend_resolved`:case`life.planner.dependency_dropped`:case`life.planner.parallel_dropped`:case`life.engineer.backend_resolved`:case`life.reviewer.backend_resolved`:case`life.curator.backend_resolved`:case`life.runtime_failure.circuit_opened`:case`life.runtime_failure.circuit_blocked`:case`life.runtime_failure.canary_passed`:case`life.runtime.incident.detected`:case`life.runtime.incident.recovered`:case`life.runtime.incident.escalated`:case`life.plan.revision.proposed`:case`life.plan.revision.rejected`:case`life.plan.revision.committed`:case`life.plan.node.superseded`:case`life.lifecycle.transition`:case`life.inbox.drained`:case`life.operator_question.pending`:case`life.operator_question.answered`:case`project.completed`:case`project.completion_refused`:case`daemon.command.submitted`:case`daemon.command.completed`:case`daemon.command.rejected`:case`idea.search.started`:case`idea.search.completed`:case`idea.search.skipped`:case`venue.research.started`:case`venue.research.completed`:case`research.achievement.certified`:case`skill.library.available`:case`skill.created`:case`skill.updated`:case`skill.archived`:case`skill.tidied`:case`skill.history.compressed`:case`skill.evolution.completed`:case`wiki.initialized`:case`wiki.hook.warning`:case`wiki.created`:case`wiki.updated`:case`wiki.retired`:case`wiki.promotion.promoted`:case`wiki.promotion.demoted`:case`wiki.retired.compressed`:case`wiki.evolution.completed`:case`knowledge.learned`:case`knowledge.recalled`:case`life.planner.verdict.discarded`:case`life.manager.feedback.unresolved`:case`life.manager.project_report`:case`life.plan.revision.rolled_back`:case`life.planner.completion_circuit.notify_failed`:case`life.planner.completion_circuit_holding`:case`life.planner.external_poll_suppressed`:case`life.planner.waiting_contract.normalized`:case`life.daemon.ready`:case`plan.draft.start`:case`team.learning.review.skipped`:case`self.learning.review.started`:case`self.learning.review.completed`:case`manager.live_view.updated`:case`manager.live_view.rejected`:case`idea.portfolio.nested_skipped`:case`manager.turn.started`:case`manager.turn.cancelled`:case`life.config.parse_failed`:return Di(e,t);default:return Di(e,t)}}function Ni(e){return e.segments.map(e=>e.text).join(``)}var Pi={"role.manager":[`Manager`,`Manager`],"role.planner":[`Planner`,`Planner`],"role.engineer":[`Engineer`,`Engineer`],"role.reviewer":[`Reviewer`,`Reviewer`],"role.advisor":[`Advisor`,`顾问`],"role.peer":[`Project exchange`,`项目交流`],"role.critic":[`Critic`,`Critic`],"role.system":[`Argus`,`Argus`],"role.argus":[`Argus`,`Argus`],"role.operator":[`You`,`你`],"event.notice":[`Notice`,`通知`],"event.watch":[`Watch`,`监控`],"event.budget":[`Budget`,`预算`],"event.quota":[`Quota`,`额度`],"event.fallback":[`Argus`,`Argus`],"event.hidden":[``,``]};function Fi(e,t){let n=Pi[e];if(n)return t===`zh-CN`?n[1]:n[0];let r=e.startsWith(`role.`)?e.slice(5):e;return r?`${r.slice(0,1).toUpperCase()}${r.slice(1)}`:``}function Ii(e,t){let n=Mi(e,t);if(n.visibility===`hidden`)return null;let r=Ni(n);return!r&&!(e.type===`ui.argus`&&(e.live===!0||Array.isArray(e.steps)&&e.steps.length>0))?null:{role:n.role,labelKey:n.labelKey,label:Fi(n.labelKey,t.locale),glyph:n.glyph,text:r,tone:n.tone,rule:n.rule,reasoning:n.reasoning,expand:n.expandable,sensitive:n.sensitive}}function Li(e,t){let n={done:[`the Reviewer was satisfied`,`审阅者认可了这一轮`],blocked:[`the Reviewer found the work stuck`,`审阅者认为工作卡住了`],no_progress:[`the Reviewer saw no progress`,`审阅者没有看到进展`]};if(!e)return X(t,`the Reviewer gave no verdict`,`审阅者没有给出结论`);let r=n[e]??[`the Reviewer asked for another pass`,`审阅者要求再改一轮`];return X(t,r[0],r[1])}var Ri=[{match:/External interrupt|daemon (?:stop|shutdown)|stopped by its operator/i,bare:/^(?:Engineer interrupted because daemon shutdown|Argus was stopped by its operator|Reviewer backend returned no complete judgment \([^)]*External interrupt)/,kind:`interrupt`,zh:`运行被操作员停下,这一轮没有做完;这不是对工作本身的评价`,en:`Argus was stopped by its operator before this round could finish; this says nothing about the work itself`},{match:/no complete judgment|before reaching a judgment|reached a conclusion|did not reach a conclusion/i,bare:/^(?:Reviewer backend (?:returned no complete judgment|ended before reaching a judgment)|The Reviewer's session ended before it reached a conclusion|The review did not reach a conclusion)/,kind:`reviewer`,zh:`审阅者的会话在得出结论前就结束了,这一轮没有评审意见`,en:`The Reviewer's session ended before it reached a conclusion, so this round was not judged`},{bare:/^Engineer backend failed before a trustworthy completed turn/,kind:`reviewer`,zh:`模型服务在工程师做完之前断开了;Argus 会换一个新会话重试,审阅等到那时再做`,en:`The model service dropped the Engineer's session before it finished; Argus retries in a fresh session and the review waits until then`},{bare:/^Retry in a fresh (?:\w+ )?session/,zh:`Argus 会换一个新会话再试一次`,en:`Argus will try again in a fresh session`},{bare:/^Restart the daemon when ready/,zh:`重新启动后,Argus 会从项目留下的状态继续,选择下一项具体任务`,en:`Once Argus is started again it continues from the saved project state and picks the next concrete task`},{bare:/^engineer round \d+ \((?:fresh|rotated|resumed)[^)]*\)\s*$/i,kind:`round`,zh:`工程师开始了新的一轮工作`,en:`The Engineer began a new round of work`},{match:/provider[\s-]?turn/i,bare:/^(?:One Engineer call|\d+ Engineer sessions in a row each) used (?:its|their) whole per-call provider-turn allowance/,zh:`继续换了个新会话接着做,之前的进展都在`,en:`Continued in a fresh session; earlier progress is kept`},{match:/budget (limit|cap|exhausted)|blocking budget|预算上限/i,bare:/^Paused because this project reached its budget limit/,zh:`花费到了预算上限,先暂停;提高预算后可以继续`,en:`Paused at the budget limit; work resumes once the budget is raised`},{match:/quarantin/i,bare:/^The task signature is quarantined out of planner rotation/,zh:`这个方向连续失败,先搁置,不再自动重试`,en:`This direction kept failing and is set aside; it will not retry on its own`},{match:/backend[\s\S]{0,24}?(fail|unavailable|paused)|backend_failure|provider cooldown|configured model is unavailable/i,bare:/^(?:backend failure; retrying in a fresh|The backend has failed the same way \d+ times in a row)/,zh:`模型服务暂时不稳定,稍后会自动重试`,en:`The model service was briefly unavailable; it retries after a short wait`}],zi=/Runner receipt:|Technical record:|技术记录[::]/i,Bi=/^(?:Runner receipt|Technical record|技术记录)\s*[::]\s*/i;function Vi(e){let t=String(e||``).trim(),n=t.search(zi);return n<0?{prose:t,receipt:``}:{prose:t.slice(0,n).trim(),receipt:t.slice(n).trim()}}function Hi(e,t){let n=String(e||``).trim(),{receipt:r}=Vi(n),i=r?Ri.find(e=>e.match?.test(n)):Ri.find(e=>e.bare?.test(n));return i?{summary:t?i.zh:i.en,receipt:r||n,kind:i.kind}:{summary:``,receipt:r}}function Ui(e,t){return t===`zh-CN`?e[0]:e[1]}function Wi(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``)}var Gi={grounding_started:[`正在阅读这项请求,弄清楚它要做什么`,`Reading the request to understand what it asks`],goal_framed:[`已经理解这项请求,项目目标已经确定。`,`The request is understood and the project goal is set.`],goal_not_understood:[`这项请求还没有被理解清楚。`,`The request could not be understood yet.`],request_not_routed:[`这项请求没能被安排下去。`,`The request could not be routed to the team.`],stage_advanced:[`研究进入了下一阶段。`,`The research moved to the next stage.`],stage_entered:[`研究进入「{stage}」阶段。`,`The research moved to the {stage} stage.`],stage_held:[`当前阶段暂不推进。`,`The current stage is on hold.`],stage_rolled_back:[`研究退回到了前一阶段。`,`The research went back a stage.`],stage_completed:[`当前阶段已完成。`,`The current stage is complete.`],stage_reconsidered:[`阶段安排已重新考虑。`,`The stage plan was reconsidered.`],stage_reviewed:[`阶段已复核。`,`The stage was reviewed.`],planning_started:[`正在规划下一步工作`,`Planning the next step`],task_added:[`计划中加入了一项新任务。`,`A new task was added to the plan.`],research_route_added:[`计划中加入了一条新的研究路线。`,`A new research route was added to the plan.`],planning_complete:[`下一步的计划已经排好。`,`The next step is planned.`],project_finished:[`项目已经完成。`,`The project is finished.`],task_delivered:[`成果已交付。`,`The result was delivered.`],planner_waiting:[`规划者在等待前一步完成。`,`The Planner is waiting for the previous step.`],planner_idle:[`暂时没有需要规划的工作。`,`Nothing to plan right now.`],planning_failed:[`这次规划没有成功。`,`Planning did not succeed this time.`],mission_started:[`开始处理这项任务`,`Work on the task started`],awaiting_engineer:[`等待工程师完成这一轮。`,`Waiting for the Engineer to finish the round.`],waiting_external:[`等待外部工作完成。`,`Waiting on work outside Argus.`],mission_completed:[`任务已完成。`,`The task is complete.`],mission_continued:[`任务将继续进行。`,`The task continues.`],mission_certified:[`成果已通过独立核对。`,`The result passed an independent check.`],mission_incomplete:[`任务没有完成。`,`The task was not completed.`],mission_stalled:[`任务停滞不前。`,`The task stalled.`],mission_blocked:[`任务被挡住了。`,`The task is blocked.`],mission_failed:[`任务没能完成。`,`The task could not be completed.`],mission_paused:[`任务在完成前暂停;进度已保存,可以继续。`,`The task was paused before it finished; its progress is saved and it can be resumed.`],mission_ended:[`任务已结束。`,`The task ended.`],mission_ready:[`可以开始新任务。`,`Ready for a new task.`],round_in_progress:[`这一轮正在进行。`,`The round is in progress.`],round_running:[`第 {n} 轮正在进行。`,`Round {n} is in progress.`],round_started:[`第 {n} 轮工作开始。`,`Round {n} started.`],progress_tool:[`正在使用工具`,`Using a tool`],progress_command:[`正在运行命令`,`Running a command`],progress_message:[`正在汇报进展`,`Reporting progress`],progress_file:[`正在更新项目文件`,`Updating project files`],progress_inspecting:[`正在查看项目状态`,`Looking at the project state`],engineer_round_finished:[`工程师完成了这一轮,结果已准备好供核对。`,`The Engineer finished the round; the result is ready to be checked.`],checking_started:[`正在阅读工程师的结果并核对证据`,`Reading the Engineer's result and checking the evidence`],continuing_before_check:[`先继续下一轮,核对稍后进行。`,`Continuing to the next round; the check comes later.`],check_postponed:[`这一轮的核对推迟了。`,`The check of this round was postponed.`],round_not_judged:[`这一轮没有人审阅。`,`No one reviewed this round.`],results_accepted:[`结果通过了核对。`,`The result passed the check.`],another_attempt_requested:[`审阅者要求再试一次。`,`The reviewer asked for another attempt.`],attempt_blocked:[`这次尝试被挡住了。`,`This attempt is blocked.`],replan_requested:[`审阅者要求重新规划。`,`The reviewer asked for a new plan.`],results_not_final:[`结果还不是最终的。`,`The result is not final yet.`],handed_off:[`已交给下一位。`,`Handed off to the next role.`],waiting:[`等待中`,`Waiting`],live_activity:[`正在工作`,`Working`],role_failed:[`{role} 执行失败`,`{role} failed`],capability_unlocked:[`解锁了一项新能力。`,`A new capability was unlocked.`],capability_upgraded:[`一项能力得到了升级。`,`A capability was upgraded.`],capability_promoted:[`一项能力被提升为来源。`,`A capability was promoted to a source.`],knowledge_captured:[`记下了一条新知识。`,`New knowledge was captured.`],knowledge_refined:[`一条知识得到了完善。`,`A piece of knowledge was refined.`],knowledge_promoted:[`一条知识被提升。`,`A piece of knowledge was promoted.`],knowledge_demoted:[`一条知识被降级。`,`A piece of knowledge was demoted.`],knowledge_retired:[`一条知识已退役。`,`A piece of knowledge was retired.`],"event.model_call.started":[`开始调用模型`,`Model call started`],"event.model_call.completed":[`模型调用完成`,`Model call completed`],"event.model_call.failed":[`模型调用失败`,`Model call failed`],"event.usage.recorded":[`已记录用量`,`Usage recorded`],"event.budget.reserved":[`已预留预算`,`Budget reserved`],"event.budget.settled":[`预算已结算`,`Budget settled`],"event.model_turn":[`与模型完成一次往返`,`One exchange with the model`],"event.instruction.received":[`收到你的指令`,`Your instruction was received`],"event.instruction.done":[`指令已执行`,`Instruction carried out`],"event.inbox.processed":[`已处理收件箱`,`Inbox processed`],"event.round.started":[`新的一轮开始`,`A new round started`],"event.round.finished":[`执行者完成了这一轮`,`The Engineer finished the round`],"event.review.finished":[`这一轮的审阅结束`,`Review of the round finished`],"event.retry.waiting":[`等待后重试`,`Waiting before retrying`],"event.retry.interrupted":[`等待被打断`,`The wait was interrupted`],"event.status":[`状态更新`,`Status update`],"event.planning.started":[`开始规划`,`Planning started`],"event.planning.failed":[`规划没有完成`,`Planning did not complete`],"event.planning.tidied":[`计划已整理`,`Plan tidied`],"event.planning.decided":[`规划结论`,`Planning decision`],"event.task.started":[`开始执行任务`,`Task execution started`],"event.task.ended":[`任务执行结束`,`Task execution ended`],"event.skills.ready":[`技能库已就绪`,`Skill library ready`],"event.routes.formed":[`已形成候选路线组合`,`Candidate route portfolio formed`],"event.lessons.skipped":[`本次没有总结经验`,`No lessons recorded this time`],"event.argus.reply":[`Argus 的回复`,`Reply from Argus`]},Ki={daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],paused_daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],operator_pause:[`你暂停了它`,`you paused it`],paused_operator:[`你暂停了它`,`you paused it`],operator_abort:[`你停止了它`,`you stopped it`],budget_exhausted:[`预算用完了`,`the budget ran out`],budget_pause:[`预算用完了`,`the budget ran out`],paused_budget:[`预算用完了`,`the budget ran out`],provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],paused_provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],provider_fence:[`模型服务不可用`,`the model service is unavailable`],paused_provider_fence:[`模型服务不可用`,`the model service is unavailable`],backend_unavailable:[`模型服务不可用`,`the model service is unavailable`],transient_error:[`出现了暂时性的问题`,`a temporary problem came up`],permanent_error:[`遇到了无法自动恢复的错误`,`an error could not be recovered from`],operator_input_required:[`需要你的回复`,`your reply is needed`],planner_empty_plan:[`需要一份新的计划`,`a new plan is needed`]},qi={pending:[`待开始`,`Waiting`],queued:[`待开始`,`Waiting`],not_started:[`待开始`,`Not started`],waiting:[`等待中`,`Waiting`],idle:[`空闲`,`Idle`],running:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],active:[`进行中`,`In progress`],working:[`进行中`,`In progress`],framed:[`已明确目标`,`Objective settled`],grounding:[`了解项目中`,`Getting oriented`],planned:[`已规划`,`Planned`],done:[`已完成`,`Done`],complete:[`已完成`,`Done`],completed:[`已完成`,`Done`],success:[`已完成`,`Done`],accepted:[`已完成`,`Done`],failed:[`失败`,`Failed`],error:[`出错`,`Failed`],blocked:[`受阻`,`Blocked`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],skipped:[`已跳过`,`Skipped`],ended:[`已结束`,`Ended`],incomplete:[`未完成`,`Not finished`],stalled:[`停滞`,`Stalled`],paused:[`已暂停`,`Paused`],stopped:[`已停止`,`Stopped`],cancelled:[`已停止`,`Stopped`],aborted:[`已停止`,`Stopped`],paused_external_work:[`等待外部工作完成`,`Waiting for external work`],superseded:[`已由新方案替代`,`Replaced by a newer plan`]},Ji={engineer_service_dropped:[`模型服务在工程师得出可核对的结果之前中断了会话,因此没有可以审阅的内容。Argus 会换一个新会话重试。`,`The model service dropped the session before the Engineer produced a checkable result, so there was nothing to review. Argus will retry in a fresh session.`],reviewer_unreachable:[`审阅者的会话在得出结论前就结束了,Argus 会再试一次。`,`The reviewer's session ended before it reached a conclusion; Argus will try again.`],argus_stopped:[`Argus 被停止了,任务随之暂停。`,`Argus was stopped, so the task paused.`],task_cancelled:[`这项任务被取消了。`,`The task was cancelled.`],session_length_limit:[`这一轮达到了单次会话的长度上限;已做的工作保留,会在新的会话里继续。`,`The round reached the length limit of one session; the work so far is kept and continues in a fresh session.`],tools_unavailable:[`执行环境里缺少需要的工具。`,`The tools the work needs are not available in the execution environment.`],model_unavailable:[`模型服务暂时不可用。`,`The model service is unavailable for now.`],sign_in_failed:[`模型服务的登录没有成功。`,`Signing in to the model service did not succeed.`],paused:[`任务被暂停了。`,`The task was paused.`],unknown:[`原因暂时不明。`,`The reason is not known yet.`],retry_wait_cut_short:[`在等待重试时 Argus 被要求停止。`,`Argus was asked to stop while waiting to retry.`]},Yi={idea:[`选题`,`Idea`],scope:[`研究定义`,`Scope`],research:[`文献与假设`,`Literature and hypotheses`],literature:[`文献与假设`,`Literature and hypotheses`],implementation:[`方法实现`,`Implementation`],implement:[`方法实现`,`Implementation`],experiment:[`实验验证`,`Experiments`],experiments:[`实验验证`,`Experiments`],analysis:[`结果分析`,`Analysis`],writing:[`论文写作`,`Writing`],review:[`最终审核`,`Final review`],delivery:[`成果交付`,`Delivery`],optimize:[`优化`,`Optimization`],solve:[`推导与验证`,`Derivation and verification`],hold:[`已暂停`,`Paused`],paused:[`已暂停`,`Paused`]},Xi={"provider.request.started":`event.model_call.started`,"provider.request.completed":`event.model_call.completed`,"provider.request.failed":`event.model_call.failed`,"agent.io.start":`event.model_call.started`,"agent.io.complete":`event.model_call.completed`,"usage.recorded":`event.usage.recorded`,"budget.reservation.created":`event.budget.reserved`,"budget.reservation.settled":`event.budget.settled`,"role.session.turn":`event.model_turn`,"daemon.command.submitted":`event.instruction.received`,"daemon.command.completed":`event.instruction.done`,"life.inbox.drained":`event.inbox.processed`,"round.start":`event.round.started`,"round.main.completed":`event.round.finished`,"round.review.completed":`event.review.finished`,"round.backend_failure.backoff":`event.retry.waiting`,"round.backend_failure.hold_interrupted":`event.retry.interrupted`,"life.status":`event.status`,"life.planner.start":`event.planning.started`,"life.planner.error":`event.planning.failed`,"life.planner.normalized":`event.planning.tidied`,"life.planner.verdict":`event.planning.decided`,"loop.start":`event.task.started`,"loop.done":`event.task.ended`,"skill.library.available":`event.skills.ready`,"idea.portfolio.formed":`event.routes.formed`,"team.learning.review.skipped":`event.lessons.skipped`,"ui.argus":`event.argus.reply`};function Zi(e,t){let n=String(e??``).trim(),r=Yi[n.toLowerCase()];return r?Ui(r,t):n}function Qi(e,t){let n=String(e??``).trim().toLowerCase(),r=Ki[n];return r?Ui(r,t):n}function $i(e,t,n){if(!t)return e;let r=Qi(t,n);return n===`zh-CN`?`${e.replace(/。$/,``)}(${r})。`:`${e.replace(/\.$/,``)} — ${r}.`}function ea(e,t,n){return t?n===`zh-CN`?`已完成 ${e} / ${t}`:`${e} of ${t} done`:Ui([`尚未规划`,`Not planned yet`],n)}var ta=[[/^Reporting progress$/i,`progress_message`],[/^(?:Running a command|running project command)$/i,`progress_command`],[/^Using a tool$/i,`progress_tool`],[/^inspecting project state$/i,`progress_inspecting`],[/^Working$/i,`live_activity`]],na=[...ta,[/^(?:Review not performed|No review this round)$/i,`round_not_judged`],[/^Goal framed$/i,`goal_framed`],[/^(?:Grounding project|Project grounding started)$/i,`grounding_started`],[/^Manager routing failed$/i,`request_not_routed`],[/^Stage reviewed$/i,`stage_reviewed`],[/^(?:Planning next work|Planning started)$/i,`planning_started`],[/^Planning complete$/i,`planning_complete`],[/^Planner waiting$/i,`planner_waiting`],[/^Project reviewed$/i,`project_finished`],[/^Research branch added$/i,`research_route_added`],[/^Task added$/i,`task_added`],[/^(?:Engineer handoff ready|Work ready for review)$/i,`engineer_round_finished`],[/^(?:Review started|Reviewing benchmark evidence)$/i,`checking_started`],[/^(?:Continuing before review|Continued before review)$/i,`continuing_before_check`],[/^Review deferred for one round$/i,`check_postponed`],[/^Waiting for the Engineer to finish$/i,`awaiting_engineer`],[/^Waiting on external work$/i,`waiting_external`],[/^(?:Evidence accepted|Accepted evidence)$/i,`results_accepted`],[/^(?:Attempt rejected|Requested another attempt)$/i,`another_attempt_requested`],[/^Handed off$/i,`handed_off`],[/^(?:Mission started|Starting mission)$/i,`mission_started`],[/^(?:Task completed|Mission complete)$/i,`mission_completed`],[/^Task failed$/i,`mission_failed`],[/^Awaiting Planner$/i,`planner_waiting`],[/^Ready for a new mission$/i,`mission_ready`],[/^Waiting$/i,`waiting`],[/^Capability unlocked$/i,`capability_unlocked`],[/^Capability upgraded$/i,`capability_upgraded`],[/^Capability promoted to source$/i,`capability_promoted`],[/^Knowledge captured$/i,`knowledge_captured`],[/^Knowledge refined$/i,`knowledge_refined`],[/^Knowledge promoted$/i,`knowledge_promoted`],[/^Knowledge demoted$/i,`knowledge_demoted`],[/^Knowledge retired$/i,`knowledge_retired`],[/^(?:request · started|io · start)$/i,`event.model_call.started`],[/^(?:request · completed|io · complete)$/i,`event.model_call.completed`],[/^usage · recorded$/i,`event.usage.recorded`],[/^reservation · created$/i,`event.budget.reserved`],[/^reservation · settled$/i,`event.budget.settled`],[/^Round (\d+) started$/i,(e,t)=>Wi(Ui(Gi.round_started,t),{n:e[1]})],[/^Running round (\d+)$/i,(e,t)=>Wi(Ui(Gi.round_running,t),{n:e[1]})],[/^Stage (?:·|→) (.+)$/i,(e,t)=>Wi(Ui(Gi.stage_entered,t),{stage:Zi(e[1],t)})],[/^Mission (ended|incomplete|stalled|blocked|failed)(?: · (\S+))?$/i,(e,t)=>$i(Ui(Gi[`mission_${e[1].toLowerCase()}`],t),e[2],t)],[/^(Manager|Planner|Engineer|Reviewer) failed$/i,(e,t)=>Wi(Ui(Gi.role_failed,t),{role:e[1]})],[/^(\d+) \/ (\d+) complete$/i,(e,t)=>ea(Number(e[1]),Number(e[2]),t)],[/^Not planned$/i,(e,t)=>ea(0,0,t)]];function ra(e){return e===`zh-CN`?`zh`:`en`}function ia(e,t,n){let r=String(e??``).trim(),i=typeof n==`string`?{kind:n}:n??{};if(!i.kind||i.kind===`live_activity`){for(let[e,n]of ta)if(e.test(r))return Ui(Gi[n],t)}let a=i.kind?Gi[i.kind]:void 0;if(i.kind){let e=!!i.language&&i.language!==ra(t);if(a&&(e||!r)&&!a[0].includes(`{`))return Ui(a,t);if(r&&!e)return r}for(let[e,n]of na){let i=r.match(e);if(i)return typeof n==`string`?Ui(Gi[n],t):n(i,t)}if(a){let e=Ui(a,t);if(!e.includes(`{`))return e;let n=r.match(/\d+/)?.[0];return n&&e.includes(`{n}`)?Wi(e,{n}):r}let o=qi[r.toLowerCase()];return o?Ui(o,t):r}function aa(e,t){let n=Ji[String(e??``).trim().toLowerCase()];return n?Ui(n,t):``}function oa(e,t){let n=String(e??``).trim().toLowerCase(),r=qi[n];return r?Ui(r,t):n}function sa(e,t){let n=Xi[String(e??``).trim()];return n?Ui(Gi[n],t):null}function ca(e){return/^(?:provider\.|agent\.io\.|usage\.|budget\.|role\.session\.turn$)/.test(String(e??``))}var la=[[/^Next action:\s*/i,[`下一步:`,`Next: `]],[/^(?:原因:|Reason:)\s*/i,[`原因:`,`Reason: `]],[/^The backend has failed the same way (\d+) times in a row \(([^)]*)\)\. Waiting ([\d.]+)s before the next attempt[^\n]*/i,(e,t)=>({text:t===`zh-CN`?`模型服务已连续 ${e[1]} 次以同样的方式失败;为了不让持续的故障白白花钱,${e[3]} 秒后再试。`:`The model service has failed the same way ${e[1]} times in a row; waiting ${e[3]} seconds before trying again so a standing failure does not keep costing money.`,technical:e[2]})],[/^review: \w+(?: \([^)]*\))? — /i,[``,``]],[/^status=(\S+) rounds=(\d+) reason=/i,(e,t)=>{let n=Ki[e[1].toLowerCase()],r=n?Ui(n,t):oa(e[1],t);return t===`zh-CN`?`任务已结束(${r}),共 ${e[2]} 轮。`:`Task ended — ${r}, after ${e[2]} rounds.`}],[/^engineer round (\d+) \((?:fresh session|new session)\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮,在新的会话里开始。`:`Round ${e[1]}, started in a fresh session.`],[/^engineer round (\d+) \([^)]*\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮开始。`:`Round ${e[1]} started.`],[/^backend failure; retrying in a fresh \w+ session after ([\d.]+)s\.?$/i,(e,t)=>t===`zh-CN`?`模型服务调用失败,${e[1]} 秒后在新的会话里重试。`:`The model service call failed; retrying in a fresh session after ${e[1]} seconds.`],[/^planner error: (.*; retry later)\.?$/i,(e,t)=>({text:t===`zh-CN`?`规划这一步没有完成,稍后会重试。`:`Planning did not complete; it will be retried later.`,technical:e[1]})],[/^mission failed\.?$/i,[`任务失败了。`,`The task failed.`]],[/^Engineer backend failed before a trustworthy completed turn; reviewer skipped\.?/i,[`这一轮模型服务没有完成调用,所以没有人审阅。`,`The model service did not complete this round, so no one reviewed it.`]],[/^Reviewer backend unavailable for (\d+) consecutive attempt\(s\); failing loud rather than settling the round without a real review\.?/i,(e,t)=>t===`zh-CN`?`审阅者的模型服务连续 ${e[1]} 次没有响应,这一轮因此没有得到审阅。`:`The reviewer's model service did not respond ${e[1]} times in a row, so this round was not reviewed.`],[/^The Reviewer's session ended before it reached a conclusion, so this round was not judged\.?/i,[`审阅者在得出结论前就中断了,这一轮没有被评判。`,`The reviewer stopped before reaching a conclusion, so this round was not judged.`]],[/^The wait after a repeated backend failure ended early: daemon stop requested\.?/i,[`在等待重试时 Argus 被要求停止,任务随之暂停。`,`Argus was asked to stop while waiting to retry, so the task paused.`]],[/^Backend call paused before a trustworthy completed turn \(stop_kind=(\w+)\); reviewer skipped\.?/i,(e,t)=>t===`zh-CN`?`这一轮在得出可信结果前被暂停(${Qi(e[1],t)}),所以没有人审阅。`:`This round was paused before it produced a trustworthy result (${Qi(e[1],t)}), so no one reviewed it.`],[/^One Engineer call used its whole per-call provider-turn allowance \([^)]*\); reviewer skipped\. The work so far is kept and the task continues in a fresh session from the checkpoint\.?/i,[`这一轮用完了单次调用的额度;已做的工作保留,会在新的会话里接着做,本轮没有审阅。`,`This round used up its per-call allowance; the work so far is kept and continues in a fresh session. No review this round.`]],[/^Execution host is unavailable; reviewer skipped\.?/i,[`执行环境暂时不可用,这一轮没有审阅。`,`The execution environment is unavailable, so this round was not reviewed.`]],[/^Copilot CLI exited with code \d+\.?/i,[`模型服务的调用没有完成。`,`The model service call did not complete.`]],[/^Grounded bounded plan completed with (\d+) step\(s\)\.?/i,(e,t)=>t===`zh-CN`?`规划完成,共 ${e[1]} 步。`:`Planning finished with ${e[1]} steps.`],[/^Retry in a fresh \w+ session; do not resume the failed thread\.(?:\s*If this repeats, pause the daemon and reduce concurrent \w+ load\.)?/i,[`接下来会在新的会话里重试这一轮。`,`The round will be retried in a fresh session.`]],[/^Restart the daemon to resume this mission from its checkpoint\.?/i,[`重新运行 Argus 即可从保存的进度继续。`,`Run Argus again to continue from the saved progress.`]],[/^Resume this mission when the operator is ready\.?/i,[`准备好后即可恢复这项任务。`,`Resume the task whenever you are ready.`]],[/^Resume from the persisted checkpoint after the blocking budget or provider condition has been cleared\.?/i,[`预算或模型服务恢复后,即可从保存的进度继续。`,`Once the budget or model service is back, the task continues from the saved progress.`]],[/^inspecting project state$/i,[`正在查看项目状态`,`Looking at the project state`]],[/^running project command$/i,[`正在运行项目命令`,`Running a project command`]],[/^using a tool$/i,[`正在使用工具`,`Using a tool`]]],ua=/^(?:[\w.]+_(?:streak|code|error|kind)=|error=|exit=|fatal_error=|Runner receipt:|stop_kind=|backend_)/i;function da(e,t){let n=e.trim(),r=[],i=[],a=!1;for(;n;){let e=!1;for(let[o,s]of la){let c=n.match(o);if(!c)continue;let l=typeof s==`function`?s(c,t):Ui(s,t);typeof l==`string`?r.push(l):(r.push(l.text),l.technical&&i.push(l.technical)),n=n.slice(c[0].length).replace(/^[\s;,]+/,``),e=!0,a=!0;break}e||(a&&ua.test(n)?i.push(n):r.push(n),n=``)}let o=t===`zh-CN`?``:` `;return{text:r.filter(Boolean).join(o).replace(/:\s+/g,`:`),technical:i.join(` `)}}function fa(e,t,n){let r=String(e??``).trim();if(n){let e=n.language&&n.language!==ra(t)?aa(n.cause,t):``;if(e)return{text:e,technical:String(n.technical??``)};if(n.technical)return{text:r,technical:String(n.technical)}}if(!r)return{text:``,technical:``};let i=r.split(/(\n[ \t]*\n|\n)/),a=[],o=[];return i.forEach((e,n)=>{if(n%2==1){a.push(e.includes(` + +`)||/\n[ \t]*\n/.test(e)?` + +`:` +`);return}let r=da(e,t);a.push(r.text),r.technical&&o.push(r.technical)}),{text:a.join(``).replace(/\n{3,}/g,` + +`).trim(),technical:o.join(` `)}}function pa(e,t){let n=e.split(/(\r?\n)/),r=n.findIndex((e,t)=>t%2==0&&e.trim()!==``),i=n[r]?.trim()??``,a=i.match(/^(?:Task continued|任务已继续)(?: · (.+))?$/),o=i.match(/^Could not complete (.+)\.$/)??i.match(/^未能完成:(.+)。$/);if(!a&&!o)return null;let s=t===`zh-CN`,c=[],l=``,u=!1;return{text:n.map((e,n)=>{if(n%2==1)return e;if(n===r){if(a){let e=a[1]??``,n=e.match(/^(.*?) · review=(\S+)$/),r=n?n[1]:e;return[s?`当时记录:工作继续推进。`:`Recorded then: work continued.`,r?`${s?`任务:`:`Task: `}${r}`:``,n?`${s?`当时记录的审阅状态:`:`Review status recorded then: `}${oa(n[2],t)}`:``].filter(Boolean).join(` +`)}let e=o[1];return/^(?:the current task|当前任务)$/.test(e)?s?`当时这项任务未能完成。`:`This task had not completed at that time.`:s?`当时未能完成:${e}。`:`Not completed at that time: ${e}.`}if(/^(?:Progress|Mission summary|本次进展|本次完成)[::]/.test(e)&&(u=!0),u)return e;let i=e.match(/^\s*(`{3,}|~{3,})/);if(i)return l?l===i[1][0]&&(l=``):l=i[1][0],e;if(l)return e;if(/^(?:Nothing is queued yet; the Planner is deciding what comes next\.|计划里暂时没有下一项,Planner 正在决定接下来做什么。)$/.test(e))return s?`当时尚未排入下一项任务,规划者还在决定接下来做什么。`:`At that time, nothing was queued and the Planner was still deciding what to do next.`;let d=e.match(/^(?:Next(?: action| up)?|下一步|接下来做)[::]\s*(.*)$/);if(d){let e=/^(?:Argus will diagnose the failure and choose a safe next step\.|Argus 会诊断原因并选择可恢复的方案。)$/.test(d[1])?s?`诊断当时的原因,再选择可恢复的方案。`:`Diagnose the cause and choose a recovery approach.`:d[1];return`${s?`当时记录的下一步:`:`Next step recorded at the time: `}${e}`}let f=e.match(/^(?:Reason:|原因:)\s*(.*)$/);if(f){let e=Vi(f[1]);if(e.prose===`Argus was stopped by its operator in the middle of this round; the Engineer's work so far is kept and nothing was retried.`){let t=Hi(f[1],s);return e.receipt&&c.push(e.receipt),s?`当时${t.summary}。已做的工作保留,当时没有重试。`:`At that time, ${t.summary}. Work done so far was kept, and no retry was made then.`}let n=fa(f[1],t);if(n.text!==f[1].trim()||n.technical)return n.technical&&c.push(n.technical),`${s?`当时记录的原因:`:`Reason recorded at the time: `}${n.text}`}return Bi.test(e.trim())?(c.push(e),``):e}).join(``),technical:c.join(` +`)}}var ma=3,ha=`engineer.progress`,ga=new Set([`tool_use`,`command_execution`,`file_change`]),_a=[`assistant_message`,`agent_message`,`message`],va=e=>e,Q=(e,t)=>String(va(e)[t]??``),ya=e=>Q(e,`type`)===ha?Q(e,`kind`):``;function ba(e,{locale:t,showReasoning:n,filter:r=`all`,query:i=``}){let a=[],o=new Map,s=0,c={locale:t,showReasoning:n,unknownEventPolicy:`hide`,density:`compact`};return e.forEach(e=>{let t=Ii(e,c);if(!t){!n&&Ee(e)&&s++;return}if(!De(e,t,r,i))return;let l=Q(e,`message_id`),u=!!l&&Q(e,`type`)===ha&&_a.includes(Q(e,`kind`));if(u&&o.has(l)){let n=o.get(l);a[n]={...a[n],ev:{...a[n].ev,...e},r:{...a[n].r,...t,text:O(a[n].r.text,t.text,ae(e))}};return}let d={ev:e,r:t,key:we(e)};u&&o.set(l,a.length),a.push(d)}),{list:a,hiddenReasoning:s}}function xa(e){let t=Q(e,`tool_name`)||Q(e,`tool`)||Q(e,`name`);if(t)return t;let n=Q(e,`text`).match(/^([A-Za-z_][\w.-]{0,40}):\s/);return n?n[1]:``}function Sa(e){let t=Q(e,`status`).toLowerCase();if(t===`running`||t===`started`||t===`in_progress`||t===`pending`)return`running`;if(t===`failed`||t===`error`||t===`errored`)return`failed`;let n=va(e).exit_code;return typeof n==`number`&&n!==0?`failed`:[`completed`,`complete`,`success`,`succeeded`,`done`,`ok`,`finished`].includes(t)?`completed`:``}function Ca(e,t){let n=Q(t,`call_id`),r=Q(e.ev,`call_id`);return n&&r?n===r:ya(e.ev)===ya(t)&&xa(e.ev)===xa(t)&&Q(e.ev,`text`)===Q(t,`text`)}var wa=(e,t)=>({kind:`step`,key:e.key,ev:e.ev,r:e.r,latest:e.ev,repeat:1,status:t});function Ta(e){let t=[],n=[],r=(e,t,r,i)=>{let[a]=n.splice(e,1);a.status=r,a.latest=t,i&&(a.result=i)};for(let i of e){let e=ya(i.ev);if(ga.has(e)){let e=Sa(i.ev);if(e!==`running`){let t=n.length-1;for(;t>=0&&!Ca(n[t],i.ev);)--t;if(t>=0){r(t,i.ev,e||`completed`);continue}}let a=wa(i,e);t.push(a),e===`running`&&n.push(a);continue}if(e===`tool_result`){let e=Q(i.ev,`call_id`),t=xa(i.ev),a=e?n.findIndex(t=>Q(t.ev,`call_id`)===e):n.findIndex(e=>!t||xa(e.ev)===t);if(a>=0){r(a,i.ev,Sa(i.ev)||`completed`,i);continue}}t.push(wa(i,``))}return t}var Ea=/fail|error|backoff|stall|denied|blocked|nudge|escalat/i,Da=/\b(?:fail(?:ed|ure)?|error|unavailable|unreachable|exited with code|backoff|retry(?:ing)?|stuck|skipped)\b/i;function Oa(e){if(ya(e.ev))return!1;let t=e.ev;return e.r.tone===`err`||e.r.tone===`warn`||Ea.test(Q(t,`type`))||va(t).backend_unavailable===!0||va(t).review_skipped===!0||Da.test(e.r.text)}var ka=e=>e.toLowerCase().replace(/\d+(?:\.\d+)?/g,`#`).replace(/\s+/g,` `).trim();function Aa(e){let t=e.ev;return ka(Q(t,`signature`)||Q(t,`cause`)||Q(t,`backend_error`)||Q(t,`error`)||Q(t,`reason`)||Q(t,`stop_kind`)||e.r.text)}function ja(e,t){return Oa(e)?`fail|${e.r.role}|${Q(e.ev,`type`)}|${Aa(e)}`:`text|${e.r.role}|${e.r.glyph}|${fa(e.r.text,t).text}`}function Ma(e,t){e.repeat+=t.repeat,e.latest=t.latest,e.r=t.r,t.status&&(e.status=t.status),t.result&&(e.result=t.result)}function Na(e,t){let n=[],r=[];for(let i of e){let e=ja(i,t),a=n[n.length-1];if(a&&r[r.length-1]===e){Ma(a,i);continue}n.push({...i}),r.push(e)}let i=r.map((e,t)=>ya(n[t].ev)?e:ka(e)),a=(e,t)=>{if(e+2*t>n.length)return!1;for(let n=0;ne.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,Ra=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,za=e=>Ra(e.replace(/^[a-z]+:\/\/(?:www\.)?/i,``).replace(/#.*$/,``).replace(/\/$/,``),48),Ba=/\*\*\* (?:Add|Update|Delete|Move to) File:\s*(\S+)/;function Va(e,t,n){for(let r of n){if(e){let t=e[r];if(typeof t==`string`&&t.trim())return t.trim();if(Array.isArray(t)&&typeof t[0]==`string`&&t[0].trim())return t[0].trim();continue}let n=t.match(RegExp(`"${r}":\\s*"((?:[^"\\\\]|\\\\.)*)"`));if(n&&n[1])return n[1].replace(/\\(.)/g,`$1`)}return``}function Ha(e){return Ua(e.ev)}function Ua(e){let t=Q(e,`text`);if(ya(e)===`file_change`){let e=t.match(Ba);if(e)return La(e[1].trim());let n=t.match(/^(\S+\.[A-Za-z0-9]{1,8})\b/);return n?La(n[1]):``}let n=t.replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),r=null;if(n.startsWith(`{`))try{let e=JSON.parse(n);r=e&&typeof e==`object`&&!Array.isArray(e)?e:null}catch{r=null}let i=Va(r,n,[`path`,`file_path`,`filePath`,`file`,`filename`,`target_file`,`notebook_path`,`paths`]);if(i&&!/^\.\/?$/.test(i))return La(i);let a=Va(r,n,[`url`,`uri`]);if(a)return za(a);let o=Va(r,n,[`pattern`,`query`,`regex`,`glob`,`q`]);if(o)return Ra(o,32);let s=n.match(Ba);return s?La(s[1].trim()):``}function Wa(e,t){let n=t===`zh-CN`,r=e.trim().replace(/\\/g,`/`).split(`/`).filter(e=>e&&e!==`**`&&e!==`.`),i=r[r.length-1]??`*`,a=r.slice(0,-1).filter(e=>!/[*?]/.test(e)),o;o=i===`*`||i===`*.*`?n?`所有文件`:`all files`:/^\*\.[\w.]+$/.test(i)?n?`${i.slice(1)} 文件`:`${i.slice(1)} files`:Ra(i,40);let s=a[a.length-1];return s?n?`${s} 里的 ${o}`:`${o} in ${s}`:o}var Ga=/^(glob|find|find_?files|list_?files|file_?search)$/i;function Ka(e,t){let n=t===`zh-CN`,r=xa(e),i=Fa(r,ya(e)),a=Ua(e);if(i===`search`){let t=Va(null,Q(e,`text`).replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),[`pattern`,`query`,`regex`,`glob`,`q`]);t&&(a=Ra(t,48))}if(i===`search`&&Ga.test(r)&&a)return`${n?`查找`:`Find`} ${Wa(a,t)}`;let o=a.startsWith(`/`)?La(a):a,[s,c,l,u]={read:[`查阅`,`查阅文件`,`Read`,`Read a file`],search:[`搜索:`,`搜索`,`Search:`,`Search`],fetch:[`读取`,`读取网页`,`Open`,`Open a page`],edit:[`修改`,`修改文件`,`Edit`,`Edit a file`],tool:[`调用`,`调用工具`,`Use`,`Use a tool`]}[i],d=i===`tool`?r:o;if(!d)return n?c:u;let f=n?s:l;return f.endsWith(`:`)?`${f}${d}`:`${f} ${d}`}function qa(e,t){let n=ya(e);return n===`command_execution`?{title:t===`zh-CN`?`正在运行命令`:`Running a command`,detail:``}:[`tool_use`,`file_change`].includes(n)?{title:{read:[`查看资料`,`Reading material`],search:[`查找相关信息`,`Searching for relevant information`],fetch:[`读取资料页面`,`Reading a source page`],edit:[`更新项目文件`,`Updating project files`],tool:[`执行一个工作步骤`,`Carrying out a work step`]}[Fa(xa(e),n)][t===`zh-CN`?0:1],detail:Ua(e)}:null}function Ja(e){let t=e[0],n=e[e.length-1],r=xa(t.ev)||(ya(t.ev)===`file_change`?`file`:`tool`),i=Fa(r,ya(t.ev)),a=[],o=0;for(let t of e){let e=Ha(t);e&&(o+=1,a.includes(e)||a.push(e))}let s=e.reduce((e,t)=>e+t.repeat,0),c=i===`read`||i===`edit`||i===`fetch`;return{kind:`group`,key:`group:${t.key}`,r:{...t.r,text:``},latest:n.latest,tool:r,action:i,steps:e,targets:a,count:c&&o===e.length?a.length:s,calls:s,failed:e.filter(e=>e.status===`failed`).length}}function Ya(e){let t=[],n=[],r=null,i=()=>{n.length>=3?t.push(Ja(n)):t.push(...n),n=[],r=null};for(let a of e){let e=Ia(a);if(e&&(r===null||r===e)){n.push(a),r=e;continue}i(),e?(n.push(a),r=e):t.push(a)}return i(),t}function Xa(e,t){return Ya(Na(Ta(e),t))}function Za(e,t,n){let r=t(`stream.fold.${e.action}`,{count:e.count,tool:e.tool}),i=e.targets.slice(0,ma);return`${r}${i.length?`${n===`zh-CN`?`:`:`: `}${i.join(n===`zh-CN`?`、`:`, `)}${e.targets.length>i.length?`…`:``}`:``}${e.failed?` · ${t(`stream.fold.failed`,{count:e.failed})}`:``}`}function Qa(e,t,n){return e.kind===`group`?Za(e,t,n):fa(e.r.text,n).text}var $a=new Set([`tool_use`,`command_execution`,`file_change`]),eo=new Set([`completed`,`failed`,`cancelled`,`canceled`,`error`,`done`,`stopped`]),to=()=>Date.now()/1e3;function no(e){return e.trim().replace(/[.…]+$/u,``).toLowerCase()}function ro(e,t,n=to()){let r=(t.label??``).trim();if(!r)return e;let i=t.heartbeat===!0,a=e.slice(),o=(t.callId??``).trim(),s=(t.status??``).trim().toLowerCase(),c=(t.kind??``).trim();if(o){let e=-1;for(let t=a.length-1;t>=0;--t)if(a[t].callId===o){e=t;break}if(e>=0){let i=a[e];return a[e]={...i,label:c===`tool_result`?i.label:r,detail:(t.detail||``).trim()||i.detail,tool:(t.tool||``).trim()||i.tool,output:(t.output||``).trim()||i.output,status:s||i.status,endedTs:eo.has(s)?n:i.endedTs},a}if(c===`tool_result`)return a}let l=a[a.length-1];if(c===`tool_result`)return!l||l.endedTs||l.heartbeat||(a[a.length-1]={...l,output:(t.output||``).trim()||l.output,status:s||`completed`,endedTs:n}),a;if(l&&!l.endedTs){if(no(l.label)===no(r)||i&&l.heartbeat)return a[a.length-1]={...l,label:r,detail:t.detail||l.detail,kind:t.kind||l.kind,heartbeat:i,endedTs:0},a;l.callId||(a[a.length-1]={...l,endedTs:n})}return a.push({id:`${a.length}:${r}:${n}`,role:(t.role||`manager`).trim()||`manager`,label:r,detail:(t.detail||``).trim(),kind:c,startedTs:n,endedTs:0,heartbeat:i,...t.tool?.trim()?{tool:t.tool.trim()}:{},...t.toolKind?.trim()?{toolKind:t.toolKind.trim()}:{},...o?{callId:o}:{},...s||o?{status:s||`running`}:{},...t.output?.trim()?{output:t.output.trim()}:{}}),a}function io(e,t=to()){return e.length===0?[]:e.map(e=>e.endedTs?e:{...e,endedTs:t})}function ao(e){if(!Number.isFinite(e)||e<1)return``;if(e<60)return`${Math.floor(e)}s`;let t=Math.floor(e/60),n=Math.floor(e%60);return n?`${t}m${n}s`:`${t}m`}function oo(e,t=to(),n=!1){return e.filter(e=>!e.heartbeat&&$a.has(e.kind)).map(e=>{let r=!e.endedTs&&(!e.status||e.status===`running`)?n?`completed`:`running`:e.status||`completed`;return{kind:e.kind,label:e.label,...e.detail?{detail:e.detail}:{},...e.tool?{tool:e.tool}:{},...e.toolKind?{tool_kind:e.toolKind}:{},...e.callId?{call_id:e.callId}:{},status:r,started_ts:e.startedTs,ended_ts:e.endedTs||(n?t:0),...e.output?{output:e.output}:{}}})}var so=e=>typeof e==`string`?e.trim():``,co=e=>typeof e==`number`&&Number.isFinite(e)?e:0;function lo(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(e=>{if(!e||typeof e!=`object`)return;let n=e,r=so(n.label);r&&t.push({kind:so(n.kind)||`tool_use`,label:r,...so(n.detail)?{detail:so(n.detail)}:{},...so(n.tool)?{tool:so(n.tool)}:{},...so(n.tool_kind)?{tool_kind:so(n.tool_kind)}:{},...so(n.call_id)?{call_id:so(n.call_id)}:{},status:so(n.status).toLowerCase()||`completed`,started_ts:co(n.started_ts),ended_ts:co(n.ended_ts),...so(n.output)?{output:so(n.output)}:{}})}),t}function uo(e,t=to()){if(!e.length)return 0;let n=Math.min(...e.map(e=>e.started_ts||t)),r=Math.max(...e.map(e=>e.ended_ts||t));return Math.max(0,r-n)}var fo={command_execution:Xe,tool_use:$t,file_change:zt},po=new Set([`failed`,`error`]),mo=new Set([`cancelled`,`canceled`,`stopped`]),ho=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,go=/^⚙\s*([\w.-]+)\s*·\s*(.*)$/su;function _o(e,t=`zh-CN`){let n=(e.tool??``).trim(),r=(e.detail??``).trim(),i=e.label.match(go);if(i){let e=i[1],a=r||i[2];return{primary:Ka({type:`engineer.progress`,kind:`tool_use`,tool_name:n||e,text:`${e}: ${a}`},t),secondary:a}}let a=e.label.replace(ho,``).trim();return{primary:a||n,secondary:r&&r!==a?r:``}}function vo({steps:e,live:t,startedTs:n,status:r=``}){let{t:i,locale:a}=F(),[o,s]=(0,U.useState)(!1),[,c]=(0,U.useState)(0);if((0,U.useEffect)(()=>{if(!t)return;let e=setInterval(()=>c(e=>e+1),1e3);return()=>clearInterval(e)},[t]),(0,U.useEffect)(()=>{t||s(!1)},[t]),!e.length&&!t)return null;let l=Date.now()/1e3,u=po.has(r)||e.some(e=>po.has(e.status)),d=mo.has(r)||e.some(e=>mo.has(e.status)),f=ao(t&&n?Math.max(0,l-n):uo(e,l))||`<1s`,p=[...e].reverse().find(e=>e.status===`running`),m=t?`${p?_o(p,a).primary:a===`zh-CN`?`正在准备回复`:`Preparing a reply`} · ${f}`:u?`${a===`zh-CN`?`过程出现问题,请查看详情`:`An issue occurred; see details`} · ${f}`:d?`${a===`zh-CN`?`已停止`:`Stopped`} · ${f}`:i(`chat.stepsDone`,{count:e.length,seconds:f});return(0,K.jsxs)(`div`,{className:`turn-steps mt-3 rounded-lg border border-line/50 bg-surface/50 text-xs`,"data-live":t||void 0,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,"aria-label":a===`zh-CN`?`查看工作过程`:`View work progress`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-ink-dim hover:text-ink`,children:[(0,K.jsx)(t?W:u?Pt:d?Yt:Ne,{size:14,"aria-hidden":`true`,className:`shrink-0 ${t?`animate-spin text-manager motion-reduce:animate-none`:u?`text-err`:d?`text-ink-faint`:`text-ok`}`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:m}),(0,K.jsx)(o?Me:Mt,{size:14,"aria-hidden":`true`,className:`shrink-0 text-ink-faint`})]}),o?(0,K.jsxs)(`ol`,{className:`space-y-1 border-t border-line/40 px-3 py-2`,children:[!e.length&&(0,K.jsx)(`li`,{className:`text-ink-faint`,children:a===`zh-CN`?`尚未记录工具操作。`:`No tool operations recorded yet.`}),e.map((e,n)=>{let{primary:r,secondary:o}=_o(e,a),s=e.status===`running`,c=po.has(e.status),u=mo.has(e.status),d=e.kind===`command_execution`?fo.command_execution:e.kind===`file_change`?fo.file_change:fo.tool_use,f=ao(Math.max(0,(e.ended_ts||l)-e.started_ts));return(0,K.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,K.jsx)(d,{size:13,"aria-hidden":`true`,className:`shrink-0 self-start mt-0.5 ${c?`text-err`:`text-ink-faint`}`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`${s&&t?`text-ink`:c?`text-err`:`text-ink-dim`}`,title:o||r,children:r}),o?(0,K.jsxs)(`details`,{className:`turn-step-raw inline`,children:[(0,K.jsx)(`summary`,{className:`ml-2 inline cursor-pointer list-none text-[11px] text-ink-faint hover:text-ink-dim`,children:i(`chat.stepRaw`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block break-all font-mono text-[11px] text-ink-faint`,children:o})]}):null,c&&e.output?(0,K.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-err/80`,children:e.output}):null]}),(0,K.jsx)(`span`,{className:`shrink-0 font-mono tabular-nums ${s&&t?`text-manager`:`text-ink-faint`}`,children:s&&t?(0,K.jsx)(W,{size:12,className:`animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):c?i(`chat.stepFailed`):u?a===`zh-CN`?`已停止`:`Stopped`:f})]},e.call_id||`${n}:${e.started_ts}`)})]}):null]})}var yo=new Set([`running`,`in_progress`,`claimed`]);function bo(e,t){let n;for(let r of t)r.item_id!==e.id||![`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.mission.orphaned`].includes(r.type)||(!n||r.ts>=n.ts)&&(n=r);if(n?.type===`life.mission.completed`&&!(n.ts(t.status===`done`||yo.has(t.status))&&(t.ts??0)>e?t.ts??0:e,0)}function So(e,t){return e.status===`failed`&&!e.pending_question&&(e.ts??0)t.status!==`done`&&!yo.has(t.status)&&(t.pending_question||t.status===`failed`&&!So(t,e))).sort((e,t)=>Number(!!t.pending_question)-Number(!!e.pending_question))}function wo(e){return e.find(e=>yo.has(e.status))??Co(e)[0]??e.find(e=>e.status===`pending`)??e.at(-1)}function To(e,t){let n=new Set,r=new Set;for(let i of e.links)i.kind===`dependency`&&(i.target===t&&n.add(i.source),i.source===t&&r.add(i.target));return{upstream:e.tasks.filter(e=>n.has(e.id)),downstream:e.tasks.filter(e=>r.has(e.id))}}function Eo(e){return e.status===`cancelled`?`aborted`:e.pending_question?`question`:yo.has(e.status)?`running`:e.outcome?.review_status===`unavailable`?`review_unavailable`:e.status===`failed`&&Do(e)?`held`:e.status.startsWith(`paused`)||e.status===`blocked`?`paused`:[`done`,`failed`,`aborted`,`skipped`,`superseded`,`pending`,`missing`].includes(e.status)?e.status:`unknown`}function Do(e){return e.outcome?.stage_certification===`not_certified`||!e.outcome?.execution_status&&/^manager stage hold:/i.test(e.last_error||``)}function Oo(e,t){let n=e=>t.some(t=>t.type===`life.mission.started`&&t.ts>e);return e.filter(e=>e.status===`done`&&e.outcome?.review_status===`done`&&e.outcome.stage_certification===`certified`).map(e=>({task:e,completion:bo(e,t)})).filter(({completion:e})=>e?.overall_complete===!0&&!n(e.ts)).map(({task:e})=>e).sort((e,t)=>(t.finished_ts??t.ts??0)-(e.finished_ts??e.ts??0))[0]}function ko(e){let t=new Set,n=[],r=new Map([...e.keys()].map(e=>[e,[]]));for(let[t,n]of e)for(let e of n)r.get(e).push(t);for(let r of e.keys()){let i=[[r,!1]];for(;i.length;){let[r,a]=i.pop();if(a)n.push(r);else if(!t.has(r)){t.add(r),i.push([r,!0]);for(let n of e.get(r))t.has(n)||i.push([n,!1])}}}let i=new Map;for(let e of n.reverse()){if(i.has(e))continue;let t=i.size,n=[e];for(;n.length;){let e=n.pop();if(!i.has(e)){i.set(e,t);for(let t of r.get(e))n.push(t)}}}return i}function Ao(e){let t=new Map(e.map(e=>[e.id,e])),n=[...t.values()].sort((e,t)=>(e.ts??0)-(t.ts??0)||e.id.localeCompare(t.id)),r=[],i=new Set;for(let e of n)for(let n of new Set(e.deps??[]))t.has(n)||i.add(n),r.push({id:JSON.stringify([`dep`,n,e.id]),source:n,target:e.id,kind:`dependency`,missing:!t.has(n)});let a=[...[...i].map(e=>({id:e,title:`未包含的依赖`,objective:`该引用不在当前数据范围内。`,status:`missing`,deps:[],role:`system`})),...n],o=new Map(a.map(e=>[e.id,0])),s=new Map(a.map(e=>[e.id,[]]));r.forEach(e=>{o.set(e.target,(o.get(e.target)??0)+1),s.get(e.source)?.push(e.target)});let c=a.filter(e=>o.get(e.id)===0).map(e=>e.id),l=0;for(let e=0;et.id!==e.id&&t.plan_id===e.superseded_by_plan_id);t.length&&r.push({id:JSON.stringify([`replacement`,e.id,e.superseded_by_plan_id]),source:e.id,target:t[0].id,kind:`replacement`,target_plan_id:e.superseded_by_plan_id,target_count:t.length})}if(u){let e=ko(s);r.filter(t=>t.kind===`dependency`&&e.get(t.source)===e.get(t.target)).forEach(e=>{e.cycle=!0})}return{tasks:a,links:r,missing:i.size,cyclic:u}}function jo(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function Mo(e){return e?.match(/route[-_ ]?(\d+)/i)?.[1]??e?.match(/(\d+)\s*$/)?.[1]??``}function No(e,t){if(!e)return``;if(e.kind===`review`)return e.verdict===`rejected`?t?`复核:驳回`:`Review: rejected`:e.verdict===`qualified`?t?`复核:通过`:`Review: qualified`:``;if(e.kind===`route`)return e.selected?t?`通过 · 被选中`:`Qualified · chosen`:e.verdict===`rejected`?t?`驳回`:`Rejected`:e.verdict===`qualified`?e.selected===!1?t?`通过 · 未选中`:`Qualified · not chosen`:t?`通过`:`Qualified`:``;let n=Mo(e.selected_route);return n?t?`已选研究路线 ${n}`:`Chose route ${n}`:``}function Po(e){return e?e.kind===`selection`?e.selected_route?`chosen`:``:e.selected?`chosen`:e.verdict??``:``}function Fo(e){let t=String(e||``).split(/\r?\n/).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY|NEXT_ACTION)\s*=\s*/i,``).trim()).filter(e=>e&&!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e)).join(` `);return t.length>160?`${t.slice(0,159)}…`:t}function Io(e){let t=new Map;for(let n of e){if(n.type!==`idea.portfolio.formed`)continue;let e=Number(n.width);if(!Number.isInteger(e)||e<=0)continue;let r=t.get(n.item_id);(!r||n.ts>=r.ts)&&t.set(n.item_id,{ts:n.ts,width:e})}return new Map([...t].map(([e,t])=>[e,t.width]))}function Lo(e,t,n,r=16){let i=new Map;for(let e of t){if(e.type!==`team.task`||!e.item_id)continue;let t=i.get(e.item_id)??new Map;t.set(e.id,e),i.set(e.item_id,t)}if(!i.size)return e;let a=new Set(e.tasks.map(e=>e.id)),o=[],s=[];for(let t of e.tasks){if(t.branch)continue;let e=[...i.get(t.id)?.values()??[]].filter(e=>!a.has(e.id)).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));if(!e.length)continue;let c=e.slice(0,r),l=new Set(c.map(e=>e.id));for(let e of c)a.add(e.id),o.push({id:e.id,title:jo(e,n),objective:Fo(e.text),excerpt:Fo(e.text),status:e.status||`unknown`,deps:[],pending_question:e.pending_question,role:`team`,team_role:e.team_role,...e.team_outcome?{team_outcome:e.team_outcome}:{},ts:e.ts,branch:!0,parent_id:t.id});let u=new Set(c.flatMap(e=>(e.deps??[]).filter(t=>l.has(t)&&t!==e.id)));for(let e of c){let n=[...new Set(e.deps??[])].filter(t=>l.has(t)&&t!==e.id);if(n.length)for(let t of n)s.push({id:JSON.stringify([`fanout`,t,e.id]),source:t,target:e.id,kind:`fanout`});else s.push({id:JSON.stringify([`fanout`,t.id,e.id]),source:t.id,target:e.id,kind:`fanout`});u.has(e.id)||s.push({id:JSON.stringify([`fanin`,e.id,t.id]),source:e.id,target:t.id,kind:`fanin`})}let d=e.length-c.length,f=`team-overflow:${t.id}`;d>0&&!a.has(f)&&(a.add(f),o.push({id:f,title:n?`还有 ${d} 条`:`+${d} more`,objective:n?`更多并行子任务收录在所属任务卡片中。`:`The remaining parallel subtasks live inside the owning card.`,status:`recorded`,deps:[],role:`team`,ts:e[r]?.ts,branch:!0,parent_id:t.id,overflow_count:d}),s.push({id:JSON.stringify([`fanout`,t.id,f]),source:t.id,target:f,kind:`fanout`},{id:JSON.stringify([`fanin`,f,t.id]),source:f,target:t.id,kind:`fanin`}))}return o.length?{...e,tasks:[...e.tasks,...o],links:[...e.links,...s]}:e}var Ro={"idea-route":[e=>`${e} 条研究路线`,e=>`${e} research route${e===1?``:`s`}`],"idea-review":[e=>`${e} 次独立复核`,e=>`${e} independent review${e===1?``:`s`}`],"idea-selector":[e=>`${e} 次方案选择`,e=>`${e} idea selection${e===1?``:`s`}`]},zo=[e=>`${e} 个并行子任务`,e=>`${e} parallel subtask${e===1?``:`s`}`],Bo={pending:[`尚未开始`,`have not started`],running:[`正在进行`,`are under way`],done:[`已经完成`,`are complete`],failed:[`没有完成`,`did not finish`],question:[`在等待答复`,`are waiting for an answer`],paused:[`已暂停`,`are paused`],superseded:[`已被新计划替代`,`were replaced by a new plan`],aborted:[`已取消`,`were cancelled`],skipped:[`已跳过`,`were skipped`]};function Vo(e,t,n){let r=e.map(({role:e,count:t})=>(Ro[e]??zo)[+!n](t)),i=n?r.length>1?`${r.slice(0,-1).join(`、`)}与 ${r[r.length-1]}`:r[0]:r.length>1?`${r.slice(0,-1).join(`, `)} and ${r[r.length-1]}`:r[0],a=(Bo[t]??[`已记录在案`,`are on record`])[+!n];return n?`${i}${a}`:`${i} ${a}`}function Ho(e,t){let n=e.filter(e=>e.team_outcome?.kind===`route`),r=n.filter(e=>e.team_outcome?.selected).map(e=>Mo(e.title)),i=n.filter(e=>e.team_outcome?.verdict===`rejected`&&!e.team_outcome.selected).map(e=>Mo(e.title)),a=n.filter(e=>e.team_outcome?.verdict===`qualified`&&!e.team_outcome.selected).map(e=>Mo(e.title)),o=[],s=e=>[...e].sort().join(t?`、`:`, `);return r.length&&o.push(t?`路线 ${s(r)} 通过并被选中`:`route ${s(r)} qualified and chosen`),a.length&&o.push(t?`路线 ${s(a)} 通过${r.length?`但未被选中`:`,等待选择`}`:`route${a.length>1?`s`:``} ${s(a)} qualified${r.length?` but not chosen`:`, selection pending`}`),i.length&&o.push(t?`路线 ${s(i)} 被驳回`:`route${i.length>1?`s`:``} ${s(i)} rejected`),o.length?t?`:${o.join(`,`)}`:`: ${o.join(`; `)}`:``}function Uo(e,t,n,r=3){let i=new Map;for(let t of e.tasks){if(!t.branch||t.overflow_count||t.group||!t.parent_id)continue;let e=JSON.stringify([t.parent_id,Eo(t)]);(i.get(e)??i.set(e,[]).get(e)).push(t)}let a=new Set(e.tasks.map(e=>e.id)),o=new Map,s=new Map;for(let[e,c]of i){if(c.lengthe.role===t);n?n.count++:d.push({role:t,count:1})}let f=c[0],p=t.has(u);o.set(u,{id:u,title:Vo(d,l,n)+Ho(c,n),objective:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,excerpt:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,status:f.status,deps:[],pending_question:f.pending_question,role:`team`,ts:f.ts,branch:!0,parent_id:i,group:{status:l,members:c.map(e=>e.id),counts:d,expanded:p}});for(let e of c)s.set(e.id,u)}if(!o.size)return e;let c=[],l=new Set;for(let n of e.tasks){let e=s.get(n.id);if(!e){c.push(n);continue}l.has(e)||(l.add(e),c.push(o.get(e))),t.has(e)&&c.push(n)}let u=[],d=new Set;for(let n of e.links){let e=s.get(n.source),r=s.get(n.target),i=n.source,a=n.target;if(e&&!t.has(e)&&(i=e),r&&!t.has(r)&&(a=r),r&&t.has(r)&&n.kind===`fanout`&&n.source===o.get(r).parent_id&&(i=r),i===a)continue;if(i===n.source&&a===n.target){u.push(n);continue}let c=JSON.stringify([n.kind,i,a]);d.has(c)||(d.add(c),u.push({...n,id:c,source:i,target:a}))}for(let[e,n]of o){if(!t.has(e))continue;let r=JSON.stringify([`fanout`,n.parent_id,e]);d.has(r)||(d.add(r),u.push({id:r,source:n.parent_id,target:e,kind:`fanout`}))}return{...e,tasks:c,links:u}}function Wo(e){return e.filter(e=>!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)).map(({source:e,target:t})=>({source:e,target:t}))}function Go(e,t,n,r=[]){let i=(e,t)=>r.find(n=>n.source===e&&n.target===t&&n.label),a=e.links.map(e=>{if(e.kind!==`dependency`)return e;let r=t.find(t=>t.source===e.source&&t.target===e.target)??i(e.source,e.target);return r?{...e,label:r.label,stated:!0,evidence:`${n?`执行依赖`:`Execution dependency`} · ${r.label}`}:e}),o=new Map(e.tasks.map(e=>[e.id,e.id])),s=e=>{let t=o.get(e);return t===e?e:s(t)},c=(e,t)=>{o.set(s(e),s(t))};for(let e of a.filter(e=>e.kind===`dependency`))c(e.source,e.target);for(let n of t)!o.has(n.source)||!o.has(n.target)||e.tasks.findIndex(e=>e.id===n.source)>=e.tasks.findIndex(e=>e.id===n.target)||s(n.source)===s(n.target)||(a.push({source:n.source,target:n.target,label:n.label,kind:`semantic`,stated:!0,id:`semantic:${n.source}:${n.target}`}),c(n.source,n.target));for(let t=1;tKo+Math.min(500,Math.max(0,e-8)*60);function Yo(e,t,n,r,i,a,o){let s=new Map(n.map(e=>[e,t[e].y+i[e].height/2]));for(let c=0;c<6;c++)for(let l of c%2?[...e].reverse():e){let e=new Set(l),c=[],u=[],d=0;l.forEach((f,p)=>{let m=s.get(f)*.8,h=.8;for(let o of a[r.get(f)]){let r=n[o.index];e.has(r)||(m+=(t[r].y+i[r].height/2)*o.weight,h+=o.weight)}c.push(d);let g=m/h-i[f].height/2-d;for(u.push({start:p,end:p,sum:g*h,weight:h});u.length>1;){let e=u[u.length-2],t=u[u.length-1];if(e.sum/e.weight<=t.sum/t.weight)break;e.end=t.end,e.sum+=t.sum,e.weight+=t.weight,u.pop()}d+=i[f].height+(p+1[e,t])),a=t.filter(e=>e.kind!==`replacement`&&e.source!==e.target).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:.4})),o=e.map(()=>[]),s=e.map(()=>[]),c=e.map(()=>[]);for(let e of a)o[e.source].push(e.target),s[e.target].push(e.source),c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let l=new Set(a.filter(e=>e.weight===1).map(e=>`${Math.min(e.source,e.target)}:${Math.max(e.source,e.target)}`)),u=(e,t)=>{let n=i.get(e),r=i.get(t);return l.has(`${Math.min(n,r)}:${Math.max(n,r)}`)?qo:qo*1.3},d=e.reduce((e,t)=>e+n[t].width*n[t].height,0),f=Math.sqrt(d/e.length),p=e.reduce((e,t)=>e+n[t].height,0)/e.length,m=Math.ceil(Math.sqrt(e.length)*1.8),h=e.map(()=>[]);for(let e of a)h[Math.max(e.source,e.target)].push(e);let g=e.map((t,n)=>{let r=0;return Array.from({length:Math.min(m,e.length-n)+1},(e,t)=>{if(t)for(let e of h[n+t-1])Math.min(e.source,e.target)1||s[e.target].length>1)&&(r+=e.weight*.9),r+=Math.max(0,Math.abs(e.target-e.source)-1)*e.weight);return r})}),_={},v=1/0,y=new Set;for(let t=1;t<=m;t++){let o=t*p+(t-1)*qo,l=Array(e.length+1).fill(1/0),m=Array(e.length+1).fill(0);l[0]=0;for(let r=1;r<=e.length;r++){let i=0;for(let a=r-1;a>=Math.max(0,r-t);a--){i+=n[e[a]].height+(a===r-1?0:qo);let t=g[a][r-a];a>0&&s[a].some(e=>s[a-1].includes(e))&&(t+=.7);let c=l[a]+.2+(i/o-1)**2+t;c0;t=m[t])h.unshift(e.slice(m[t],t));let b=JSON.stringify(h);if(y.has(b))continue;y.add(b);let x=h.map(e=>Math.max(...e.map(e=>n[e].width))),S=h.map(e=>e.reduce((e,t)=>e+n[t].height,0)+(e.length-1)*qo),C=x.reduce((e,t)=>e+t,0)+(h.length-1)*r,w=Math.max(...S),T={},E=0;h.forEach((e,t)=>{let i=(w-S[t])/2;e.forEach((r,a)=>{T[r]={x:E+(x[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1T[e].y));for(let t of e)T[t].y-=D;w=Math.max(...e.map(e=>T[e].y+n[e].height));let O=a.reduce((t,r)=>{let i=T[e[r.source]],a=T[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,a.length)/f,k=2*Math.log(C/w/2.1)**2+.08*C*w/d+.14*O+.08*l[e.length]/h.length;k[e,t])),a=e=>e.source!==e.target&&i.has(e.source)&&i.has(e.target),o=new Set,s=new Map;for(let e of t)!a(e)||e.kind!==`fanout`&&e.kind!==`fanin`||(e.kind===`fanout`?o.add(e.target):o.add(e.source),(s.get(e.source)??s.set(e.source,new Set).get(e.source)).add(e.target),(s.get(e.target)??s.set(e.target,new Set).get(e.target)).add(e.source));let c=e.map(()=>[]),l=t.filter(e=>e.kind!==`replacement`&&a(e)).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:e.kind===`fanout`||e.kind===`fanin`?.8:.4}));for(let e of l)c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let u=e.map(()=>[]);for(let e of t){if(!Zo.has(e.kind)||!a(e))continue;let t=i.get(e.source),n=i.get(e.target);td[e]))+1:f+1;d.push(e),f=Math.max(f,e)}let p=[];e.forEach((e,t)=>{(p[d[t]]??=[]).push(e)});let m=p.filter(e=>e?.length),h=(e,t)=>o.has(e)&&o.has(t)?qo/2:qo,g=e=>e.reduce((t,r,i)=>t+n[r].height+(i?h(e[i-1],r):0),0),_=e.reduce((e,t)=>e+n[t].width*n[t].height,0),v=Math.sqrt(_/e.length),y=e.filter(e=>!o.has(e)),b=(y.length?y:e).reduce((e,t)=>e+n[t].height,0)/Math.max(1,y.length||e.length),x=Math.ceil(Math.sqrt(e.length)*1.8),S={},C=1/0,w=new Set;for(let t=1;t<=x;t++){let a=t*b+(t-1)*qo,u=[];for(let e of m){let t=[],n=()=>{if(!t.length)return;let e=o.has(t[0]);if(e)u.push({nodes:t,isBranch:e});else{let n=[];for(let r of t)n.length&&g([...n,r])>a&&(u.push({nodes:n,isBranch:e}),n=[]),n.push(r);n.length&&u.push({nodes:n,isBranch:e})}t=[]};for(let r of e)t.length&&o.has(t[0])!==o.has(r)&&n(),t.push(r);n()}let d=[],f=[];for(let e of u){let t=d.at(-1),n=t&&e.nodes.some(e=>t.some(t=>s.get(e)?.has(t)));!t||n||f.at(-1)!==e.isBranch||g([...t,...e.nodes])>a?(d.push([...e.nodes]),f.push(e.isBranch)):t.push(...e.nodes)}let p=JSON.stringify(d);if(w.has(p))continue;w.add(p);let y=d.map(e=>Math.max(...e.map(e=>n[e].width))),x=d.map(g),T=y.reduce((e,t)=>e+t,0)+(d.length-1)*r,E=Math.max(...x),D={},O=0;d.forEach((e,t)=>{let i=(E-x[t])/2;e.forEach((r,a)=>{D[r]={x:O+(y[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1D[e].y));for(let t of e)D[t].y-=k;E=Math.max(...e.map(e=>D[e].y+n[e].height));let A=l.reduce((t,r)=>{let i=D[e[r.source]],a=D[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,l.length)/v,j=2*Math.log(T/E/2.1)**2+.08*T*E/_+.14*A;j=e.length*.3?Qo(e,t,n):Xo(e,t,n)}function es(e){let t=new Map,n=new Map,r=new Map;return e.map(e=>{let i=`${e.source}\u0000${e.target}`,a=(t.get(e.source)??0)+(n.get(e.target)??0)-(r.get(i)??0);return t.set(e.source,(t.get(e.source)??0)+1),n.set(e.target,(n.get(e.target)??0)+1),r.set(i,(r.get(i)??0)+1),a})}function ts(e,t){if(e.x===t.x&&e.y===t.y)return{sourceHandle:`right`,targetHandle:`bottom`};let n=t.x+t.width/2-e.x-e.width/2,r=t.y+t.height/2-e.y-e.height/2,i=r>0?t.y-e.y-e.height:e.y-t.y-t.height,a=n>0?t.x-e.x-e.width:e.x-t.x-t.width;return i>=0&&a<0?r>=0?{sourceHandle:`bottom`,targetHandle:`top`}:{sourceHandle:`top`,targetHandle:`bottom`}:n>=0?{sourceHandle:`right`,targetHandle:`left`}:{sourceHandle:`left`,targetHandle:`right`}}function ns(e,t){return e?.type!==`life.mission.completed`||e.overall_complete!==!1&&e.campaign_continues!==!0||e.outcome?.execution_status===`completed`&&e.outcome.review_status===`done`?``:t?`当次执行已结束;当时总体目标尚未完成${e.campaign_continues===!0?`,仍需后续工作`:``}。`:`This execution ended; the overall goal was not complete at that time${e.campaign_continues===!0?` and further work remained`:``}.`}function rs(e){let{total:t,qa:n=0,complete:r,ended:i=0,reviewUnavailable:a=0,held:o=0,running:s,pending:c,paused:l,hasOpenWork:u,role:d,current:f,waiting:p,zh:m}=e,h=t>0&&r===t&&i===0,g=n===t&&n>0?m?`已全部回答`:`all answered`:m?`已全部完成`:`all completed`,_=m?[t>n?`${t-n} 个任务`:``,n>0?`${n} 条问答`:``,r>0&&!h?`已完成 ${r} 个`:``,i>0?`${i} 个任务结束时目标还没完成`:``,a>0?`${a} 个结果尚未检查成功`:``,o>0?`${o} 个任务暂停,后续工作尚未安排`:``,s>1?`${s} 个任务同时进行`:``]:[t>n?`${t-n} ${t-n===1?`task`:`tasks`}`:``,n>0?`${n} Q&A`:``,r>0&&!h?`${r} done`:``,i>0?`${i} ended before their goals were complete`:``,a>0?`${a} ${a===1?`result has`:`results have`} not been checked successfully`:``,o>0?`${o} paused with no next step scheduled`:``,s>1?`${s} tasks in progress`:``],v=c?m?`正在处理你的消息`:`working on your message`:p||(l?h?g:u?m?`已暂停`:`paused`:t>0?m?`没有在进行的工作`:`nothing in progress`:m?`就绪`:`ready`:f||(d?jr(d,m):h?g:``));return[..._,v].filter(Boolean).join(` · `)}var is={width:1440,height:1080},as=[`plan`,`execution`,`review`,`revision`,`result`];function os(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function ss(e,t){let n=e.team_outcome;if(!n)return``;if(n.kind===`review`){let e=n.verdict===`rejected`?t?`复核结论:驳回`:`Verdict: rejected`:n.verdict===`qualified`?t?`复核结论:通过`:`Verdict: qualified`:``;if(!e)return``;let r=n.summary?us(n.summary,120):``;return r?`${e}${t?`。`:`. `}${r}`:e}if(n.kind===`route`){let e=n.title?t?`「${n.title}」`:`“${n.title}”`:``;if(n.selected)return t?`${e}通过独立复核,被选为唯一方案`:`${e} passed its independent review and was chosen`;if(n.verdict===`rejected`){let r=n.rejection?us(n.rejection,120):``;return(t?`${e}被独立复核驳回`:`${e} was rejected by its independent review`)+(r?t?`。${r}`:`. ${r}`:``)}return n.verdict===`qualified`?n.selected===!1?t?`${e}通过独立复核,但未被选中`:`${e} passed its independent review but was not chosen`:t?`${e}通过独立复核,等待选择`:`${e} passed its independent review; selection pending`:``}let r=Mo(n.selected_route);if(!r)return``;let i=n.selected_title?t?`(${n.selected_title})`:` (${n.selected_title})`:``,a=(n.rejected??[]).map(Mo).filter(Boolean);return(t?`选定研究路线 ${r}${i}`:`Chose route ${r}${i}`)+(a.length?t?`,驳回路线 ${a.join(`、`)}`:`; rejected route${a.length>1?`s`:``} ${a.join(`, `)}`:``)}function cs(e,t,n){return e.pending_question?t?`需要答复,展开查看具体问题`:`Needs your input; open to read the question`:e.status===`failed`?t?`本次执行失败,展开查看原因`:`This attempt failed; open to read the reason`:e.status===`blocked`?t?`执行受阻,展开查看原因`:`Work is blocked; open to read the reason`:ss(e,t)||(e.status===`done`?e.team_role===`idea-review`?t?`独立复核已完成,展开查看记录`:`Independent review completed; open to read the record`:t?`子任务执行已完成,展开查看记录`:`Subtask execution completed; open to read the record`:e.status===`pending`?n?t?`等待前置子任务完成后开始`:`Waiting for prerequisite subtasks to finish`:t?`等待分配 Agent 执行`:`Waiting for an agent to start`:yo.has(e.status||``)?e.team_role===`idea-route`?t?`正在开展来源研究,整理候选方案`:`Researching sources and developing a candidate idea`:e.team_role===`idea-review`?t?`正在独立核对依据、创新性和风险`:`Independently checking evidence, novelty and risks`:e.team_role===`idea-selector`?t?`正在对比研究路线及复核意见`:`Comparing research routes and independent reviews`:t?`Agent 正在执行此子任务`:`An agent is working on this subtask`:t?`展开查看子任务执行记录`:`Open to read the subtask record`)}var ls=e=>e?`这一步还没有留下记录`:`Nothing has been written down for this step yet.`;function us(e,t=140){let n=e.replace(/\s+/g,` `).trim();if(!n)return``;let r=n.match(/^.*?[。!?!?.](?=\s|$)/),i=(r?r[0]:n).trim();return i.length>t?`${i.slice(0,t-1).trimEnd()}…`:i}function ds(e){let t=e.replace(/\s+/g,` `).trim().split(/[。!?;;::,,\n]|\.(?=\s|$)|[!?](?=\s|$)/)[0]?.trim();return t&&t.length>=6&&t.length<=40?t:``}function fs(e){return String(e||``).split(/\r?\n/).filter(e=>!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e.trim())&&!/^\{\s*"[\w-]+"\s*:.*\}$/.test(e.trim())).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/i,``).replace(/^\s*NEXT_ACTION\s*=\s*/i,``)).join(` +`).trim()}function ps(e,t,n){switch(e.type){case`life.planner.task_added`:return n?`规划者把这项任务列入了计划。`:`The Planner added this task to the plan.`;case`life.mission.started`:return n?`工程师接手了这项任务,开始动手。`:`The Engineer picked up this task and began working.`;case`life.phase.started`:case`round.review.started`:return e.role===`reviewer`?n?`审阅者打开了工程师的工作,开始核查。`:`The Reviewer opened the Engineer's work to check it.`:``;case`life.mission.completed`:return ns(e,n)||(t===`done`?n?`任务完成,结果已经记录在案。`:`The task was finished; its result is on record.`:t===`paused_external_work`?n?`这项任务在等待后台团队的结果;结果就绪后会自动继续。`:`This task is waiting for its background team; it continues on its own once the results are in.`:t.startsWith(`paused`)?n?`这项任务的工作暂停了。`:`Work on this task was paused.`:n?`任务到此结束。`:`The task ended here.`);case`life.mission.failed`:return n?`任务没有达到目标就结束了。`:`The task ended without reaching its goal.`;default:return``}}var ms=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,hs=(e,t)=>e.length>t?`${e.slice(0,t-1).trimEnd()}…`:e;function gs(e){let t=e.slice(e.indexOf(`:`)+1).trim();if(!t)return``;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of[`path`,`file`,`file_path`,`pattern`,`query`,`url`,`command`,`paths`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim();if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}let n=Object.values(t).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n.trim():``}}catch{}return/^[{[]/.test(t)?/"(?:path|file|file_path|pattern|query|url|command)"\s*:\s*"([^"]+)/.exec(t)?.[1]??``:t}function _s(e){let t=(e.tool||e.label.replace(ms,``).split(`:`)[0]||``).trim().toLowerCase();return e.kind===`command_execution`?`run`:e.kind===`file_change`?`edit`:/^(view|read|cat|open|read_file|str_replace_editor)$/.test(t)?`read`:/^(rg|grep|search|find_text|semantic_search|codebase_search|web_search|search_web)$/.test(t)||/^(glob|find|list|ls|list_dir|find_files)$/.test(t)?`search`:/^(web_fetch|fetch|http_get|browse)$/.test(t)?`fetch`:/^(apply_patch|edit|write|create|write_file|edit_file|replace_in_file|str_replace)$/.test(t)?`edit`:/^(bash|shell|sh|execute|terminal|run)$/.test(t)?`run`:`other`}function vs(e,t){let n=(e.tool||``).trim(),r=e.label.replace(ms,``).trim(),i=n&&/\s/.test(n)&&n.length>8,a=hs(gs(r),72),o=hs(r,72),s=_s(e),c=i?n:s===`run`?t?`运行命令 \`${o}\``:`Ran \`${o}\``:s===`read`?t?`查看 ${a||(t?`一份文件`:``)}`:`Read ${a||`a file`}`:s===`search`?t?`查找 ${a||`内容`}`:`Looked for ${a||`something`}`:s===`fetch`?t?`读取网页 ${a||``}`.trim():`Fetched ${a||`a page`}`:s===`edit`?t?`修改文件 ${a||``}`.trim():`Edited ${a||`a file`}`:hs(/^[^:{]*:\s*[{[]/.test(r)?r.slice(0,r.indexOf(`:`)):r,80);return e.status===`failed`?`${c}${t?`(失败)`:` (failed)`}`:c}function ys(e,t,n){let r=new Map;e.forEach(e=>r.set(_s(e),(r.get(_s(e))??0)+1));let i=[],a=(e,t,a,o)=>{let s=r.get(e);s&&i.push(n?`${t}${s}${e===`run`?`条命令`:e===`fetch`?`个网页`:`处`}`:`${s} ${s===1?a:o}`)};a(`read`,`查看了`,`file read`,`files read`),a(`search`,`查找了`,`search`,`searches`),a(`fetch`,`读取了`,`page fetched`,`pages fetched`),a(`edit`,`修改了`,`file edited`,`files edited`),a(`run`,`运行了`,`command run`,`commands run`);let o=r.get(`other`);return o&&i.push(n?`${o}次其他操作`:`${o} other ${o===1?`action`:`actions`}`),t>0&&i.push(n?`另有 ${t} 步未列出`:`${t} more not listed`),i.length?n?`${i.join(`,`)}。`:`${i.join(`, `)}.`:``}function bs(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.status===`running`&&n.status&&n.status!==`running`&&(e.call_id&&n.call_id?e.call_id===n.call_id:!e.call_id&&!n.call_id&&e.kind===n.kind&&e.label===n.label&&(e.tool??``)===(n.tool??``))?t[t.length-1]={...e,status:n.status,...n.call_id?{call_id:n.call_id}:{}}:t.push(n)}return t}function xs(e,t){let n=bs(e.steps??[]),r=fs(e.text),i=e.tool_details_recorded===!1,a=i?t?`执行日志确认发生过工具活动,但这一轮没有记录详细工具步骤。`:`Execution logs confirm tool activity, but detailed tool steps were not recorded for this turn.`:``;return ws({id:e.id,kind:e.role===`reviewer`?`review`:`execution`,title:``,detail:``,status:e.status||`recorded`,ts:e.ts,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id],segment:!0,work:{steps:[...n],overflow:e.overflow??0,narrations:r?[r]:[],note:a,title:i?t?`已记录的执行`:`Recorded execution`:``,single:e.role===`manager`}},t)}var Ss=8,Cs=(e,t)=>{let n=Math.max(0,e.steps.length-Ss)+e.overflow;return[...e.steps.slice(0,Ss).map(e=>`· ${vs(e,t)}`),...n>0?[t?`· 另有 ${n} 步未列出`:`· ${n} more not listed`]:[]]};function ws(e,t){let n=e.work,r=n.narrations.join(` + +`);return e.title=n.title||ds(n.narrations[0]??``)||(n.single?t?`Argus 动手查证`:`Argus did the work`:n.steps.length?t?`做了 ${n.steps.length} 步操作`:`${n.steps.length} steps of work`:t?`说明了接下来要做什么`:`Said what comes next`),e.summary=us(n.narrations[0]??``)||ys(n.steps,n.overflow,t)||void 0,e.detail=[n.note,r,Cs(n,t).join(` +`)].filter(Boolean).join(` + +`)||ls(t),e.workCount=n.steps.length+n.overflow||void 0,e}function Ts(e,t){let n=e.work;if(!n||e.segment)return e;let r=e.detail===ls(t)?``:e.detail,i=n.narrations.filter(e=>!r.includes(e.slice(0,60))),a=n.steps.length+n.overflow,o=ys(n.steps,0,t),s=a?[t?`这一步里做的操作(${a} 步):${o}`:`What was done in this step (${a} actions): ${o}`,Cs(n,t).join(` +`)].join(` +`):``,c=n.narrations[n.narrations.length-1];return!e.closed&&c&&(e.title=ds(c)||e.title,e.summary=us(c)||e.summary),e.detail=[n.note,r,i.join(` + +`),s].filter(Boolean).join(` + +`)||ls(t),e.workCount=a||void 0,e}function Es(e,t){switch(e){case`done`:return t?`这项任务已经完成。`:`This task was completed.`;case`failed`:return t?`这项任务没有达到目标。`:`This task did not reach its goal.`;case`cancelled`:case`aborted`:return t?`这项任务被取消了。`:`This task was cancelled.`;case`skipped`:return t?`这项任务被跳过了。`:`This task was skipped.`;case`superseded`:return t?`这项任务被一个新的计划取代了。`:`A new plan took the place of this task.`;default:return``}}function Ds(e,t,n){let r=e.kind===`turn`,i=[{id:`${e.id}:brief`,kind:`plan`,title:r?n?e.turn_kind===`qa`?`你提出的问题`:`你提出的要求`:`What you asked`:n?`任务目标`:`Task goal`,detail:e.objective||e.title,status:`recorded`,source:`task`,eventIds:[]}],a=new Set,o=0,s,c=t.filter(t=>t.item_id===e.id).sort((e,t)=>e.ts-t.ts||(e.type===`team.task`&&t.type===`team.task`?(e.team_task_id||e.id).localeCompare(t.team_task_id||t.id):0)),l=new Map(c.filter(e=>e.type===`team.task`).map(e=>[e.id,e]));for(let e of c){if(a.has(e.id))continue;if(a.add(e.id),e.type===`team.task`){let t=[...new Set(e.deps||[])],r=t.map(e=>l.has(e)?os(l.get(e),n):n?`其他记录中的子任务`:`Task outside this view`),a=fs(e.text);i.push({id:e.id,kind:e.team_role===`idea-review`||e.role===`reviewer`?`review`:e.team_role===`idea-selector`?`plan`:`execution`,title:os(e,n),summary:cs(e,n,t.some(e=>l.has(e)&&l.get(e).status!==`done`)),detail:[a,e.reason&&!a.includes(e.reason)?e.reason:``,e.pending_question?`${n?`需要答复`:`Needs input`}: ${e.pending_question}`:``,r.length?`${n?`依赖`:`Depends on`}: ${r.join(` · `)}`:``].filter(Boolean).join(` + +`),status:e.pending_question?`question`:e.status||`unknown`,ts:e.ts,source:`team`,eventIds:[e.id],teamId:e.team_id,teamTaskId:e.team_task_id,teamRole:e.team_role,...e.team_outcome?{teamOutcome:e.team_outcome}:{},deps:t,updatedAt:e.updated_ts,revision:e.revision});continue}if(e.type===`work.segment`){i.push({...xs(e,n),episode:o});continue}if(e.type===`turn.replied`){let t=fs(e.text);i.push({id:e.id,kind:`result`,title:n?`Argus 的回答`:`What Argus answered`,summary:us(t)||void 0,detail:t||ls(n),status:e.status||`done`,ts:e.ts,source:`event`,eventIds:[e.id]});continue}e.type===`life.mission.started`&&(o++,s=void 0),e.type===`round.review.completed`&&(s=e);let t=e.type.includes(`review`)||e.type===`life.phase.started`&&e.role===`reviewer`?`review`:e.type===`life.planner.task_added`?`plan`:e.type===`life.mission.completed`||e.type===`life.mission.failed`?`result`:e.type===`round.start`||e.type===`round.main.completed`||e.type===`life.mission.started`||e.type===`life.phase.started`?`execution`:null;if(!t)continue;let r=e.round_index,c=e.type.endsWith(`.completed`)||e.type.endsWith(`.failed`),u=t===`review`&&e.review_skipped===!0,d=e.backend_unavailable===!0||t===`result`&&s?.backend_unavailable===!0,f=d?``:ns(e,n),p=(d?`review_unavailable`:u?`skipped`:e.status===`error`?`failed`:e.status)||(e.success===!1||e.type.endsWith(`.failed`)?`failed`:e.success===!0?`done`:c||e.type===`life.planner.task_added`||e.type===`life.mission.started`?`recorded`:`started`),m=Hi(e.text||``,n),h=String(e.text||``),g=m.receipt?h.lastIndexOf(m.receipt):-1,_=fs(g>=0?h.slice(0,g):h),v=p===`done`?n?`审阅通过`:`Review passed`:p===`continue`?n?`审阅:要求再改一轮`:`Review: another pass asked for`:[`blocked`,`replan`,`replan_requested`].includes(p)?n?`审阅:建议调整方向`:`Review: a change of course asked for`:p===`failed`?n?`审阅未通过`:`Review not passed`:``,y=m.kind===`interrupt`,b=t===`execution`&&!m.summary?ds(_):``,x=d?n?`当次审查异常`:`Review error on this attempt`:y?n?`这一轮没做完就被停下`:`Stopped before the round could finish`:u?n?`本轮未审阅`:`No review this round`:t===`review`?c?v||(n?`审阅意见`:`Review`):n?`开始审阅`:`Review started`:t===`result`?f?n?`本次执行已结束`:`This execution ended`:p===`paused_external_work`?n?`等待后台团队`:`Waiting for the background team`:n?`执行结果`:`Result of the work`:t===`plan`?n?`列入计划`:`Taken into the plan`:b||(m.kind===`round`?n?`新一轮开始`:`A new round began`:e.type===`life.mission.started`?n?`开始执行`:`Work started`:e.type===`round.main.completed`?n?`本轮执行记录`:`This round's work`:n?`一次执行尝试`:`An attempt at the work`),S=Hi(e.next_action||``,n),C=_||m.summary?``:ps(e,p,n);i.push({id:e.id,kind:t,title:x,summary:d?n?`审查器未能给出判断,不是审阅否决。`:`The Reviewer could not return a judgment; this was not a rejection.`:f||m.summary||us(_)||C||void 0,detail:[f,_||m.summary||(f?``:C||ls(n)),f&&e.stage_certification===`intentionally_skipped`?n?`本阶段认证被有意跳过;这不代表最终验收通过。`:`Stage certification was intentionally skipped; this is not final acceptance.`:``,u&&e.next_action&&!S.summary?`${n?`接下来`:`What happens next`}: ${e.next_action}`:``,m.receipt?`${n?`——技术记录:`:`— technical record: `}${m.receipt.replace(Bi,``)}`:``].filter(Boolean).join(` + +`),status:f&&p===`done`?`recorded`:p,completionScope:f||void 0,closed:c,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]}),!u&&!y&&e.next_action&&[`continue`,`blocked`,`replan`,`replan_requested`].includes(e.status||``)&&i.push({id:`${e.id}:next`,kind:`revision`,title:n?`建议的修改`:`Changes asked for`,detail:S.summary||e.next_action,status:`requested`,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]})}e.turn_kind===`qa`&&!i.some(e=>e.kind===`result`)&&i.push({id:`${e.id}:answer`,kind:`result`,title:yo.has(e.status)?n?`正在回答`:`Answering`:n?`回答状态`:`Answer status`,detail:e.summary||(e.status===`cancelled`?n?`本次回答已中断。`:`This answer was interrupted.`:``),status:e.status,source:`task`,eventIds:[]}),e.turn_kind!==`qa`&&!i.some(e=>e.kind===`execution`)&&yo.has(e.status)&&i.push({id:`${e.id}:active`,kind:`execution`,title:n?`正在进行的工作`:`Work under way`,detail:e.summary||``,status:e.status,source:`task`,eventIds:[]}),!i.some(e=>e.kind===`result`)&&[`done`,`failed`,`aborted`,`cancelled`,`skipped`,`superseded`].includes(e.status)&&i.push({id:`${e.id}:outcome`,kind:`result`,title:n?`任务的最终状态`:`Where this task ended up`,detail:e.summary||Es(e.status,n),status:e.status,source:`task`,eventIds:[]});let u=[],d=new Map,f=new Map,p=(e,t)=>{let n=e.work??={steps:[],overflow:0,narrations:[],note:``,title:``,single:!1};n.steps.push(...t.work.steps),n.overflow+=t.work.overflow,n.narrations.push(...t.work.narrations.filter(e=>!n.narrations.includes(e))),n.note||=t.work.note,e.eventIds.push(...t.eventIds),t.source===`interval`&&(e.source=`interval`)};for(let e of i){if(e.segment){let t=f.get(e.kind),r=u[u.length-1],i=t&&t.episode===e.episode?t:r?.segment&&r.kind===e.kind?r:void 0;i?(p(i,e),i.segment&&ws(i,n)):u.push({...e,eventIds:[...e.eventIds]});continue}let t=e.round!=null&&[`execution`,`review`].includes(e.kind),r=`${e.episode}:${e.round}:${e.kind}`,i=t?d.get(r):void 0;if(i)i.title=e.title,i.summary=e.summary??i.summary,i.detail=e.detail,i.status=e.status,i.closed=i.closed||e.closed,i.eventIds.push(...e.eventIds),e.source===`interval`&&(i.source=`interval`);else{let n={...e,eventIds:[...e.eventIds]};u.push(n),t&&(d.set(r,n),f.set(n.kind,n))}}return u.map(e=>{let{work:t,segment:r,closed:i,...a}=Ts(e,n);return a})}function Os(e,t,n=!0){let r=e.filter(e=>e.source===`team`),i=r.filter(e=>e.teamOutcome?.kind===`route`),a=r.find(e=>e.teamOutcome?.kind===`selection`)?.teamOutcome,o=i.find(e=>e.teamOutcome?.selected),s=[],c=e=>e.join(t?`、`:`, `);if(o||a?.selected_route){let e=Mo(o?.teamTaskId)||Mo(a?.selected_route),n=o?.teamOutcome?.title||a?.selected_title;s.push(t?`已选定研究路线 ${e}${n?`(${n})`:``}`:`route ${e} chosen${n?` (${n})`:``}`);let r=i.filter(e=>e.teamOutcome?.verdict===`rejected`&&!e.teamOutcome.selected).map(e=>Mo(e.teamTaskId)).filter(Boolean);r.length&&s.push(t?`路线 ${c(r)} 被驳回`:`route${r.length>1?`s`:``} ${c(r)} rejected`)}else if(i.some(e=>e.teamOutcome?.verdict)){let e=i.filter(e=>e.teamOutcome?.verdict===`qualified`).length,n=i.filter(e=>e.teamOutcome?.verdict===`rejected`).length;s.push(t?`复核结果:${e} 条路线通过、${n} 条驳回,等待选择`:`reviews so far: ${e} route${e===1?``:`s`} qualified, ${n} rejected; selection pending`)}let l=[...e].reverse().find(e=>e.source!==`team`&&e.kind===`review`&&[`done`,`continue`,`blocked`,`replan`,`replan_requested`,`failed`].includes(e.status));l&&s.push(l.status===`done`?t?`复核通过`:`review passed`:l.status===`continue`?t?`复核要求再改一轮`:`the review asked for another pass`:l.status===`failed`?t?`复核未通过`:`review not passed`:t?`复核建议调整方向`:`the review asked for a change of course`);let u=n?[...e].reverse().find(e=>e.source!==`team`&&e.kind===`execution`&&e.round!=null&&e.status===`started`):void 0;return u&&s.push(t?`第 ${u.round} 轮进行中`:`round ${u.round} under way`),s.length?(t?`当前结论:`:`So far: `)+s.join(t?`;`:`; `):``}var ks=480;function As(e,t,n,r=Ds(e,t,n),i=0,a=!1){let o=a&&r.length>0,s=o?ks:640,c=o?r.length:1,l=1/0;for(let e=1;!o&&e<=Math.min(3,r.length);e++){let t=Math.ceil(r.length/e),n=Math.max(640,t*232+(t-1)*108+96),i=408+(e-1)*236,a=Math.abs(Math.log(n/i/1.6))+.6*(t*e-r.length)/(t*e);a{let a=t*c,o=Math.min(a+c,r.length),s=m+t*340,l=r.slice(a,o);l.forEach((e,t)=>{h[e.id]={x:s,y:f+t*236}});let d=i+a+1,p=i+o,v=d===p?n?`环节 ${d}`:`Step ${d}`:n?`环节 ${d}–${p}`:`Steps ${d}–${p}`,y=Ms(g.slice(a,o)),b=Ns(l,y,_,t===0&&i===0,t===u-1,n,v);return _=y,{id:`steps:${i+a}`,title:b,x:s,y:f-38}});return{steps:r,links:Fs(r,n),columns:v,positions:h,width:d,height:p,...o?{stacked:o}:{}}}function js(e){let t;return e.map(e=>{if(typeof e.round==`number`)return t=e.round;if(e.kind!==`result`&&e.kind!==`plan`)return t})}function Ms(e){return[...new Set(e.filter(e=>typeof e==`number`))].sort((e,t)=>e-t)}function Ns(e,t,n,r,i,a,o){if(!t.length)return r&&i&&e.length>1&&e[0].kind===`plan`&&e[e.length-1].kind===`result`?a?`起点 → 结果`:`Setting out → Outcome`:r&&e.some(e=>e.kind===`plan`)?a?`起点`:`Setting out`:i&&e.some(e=>e.kind===`result`)?a?`结果`:`Outcome`:o;let s=t[0],c=t[t.length-1],l=t.length===1&&n.length>0&&n[n.length-1]===s,u=s===c?a?`第 ${s} 轮`:`Round ${s}`:a?`第 ${s}–${c} 轮`:`Rounds ${s}–${c}`;return l&&(u=e[0].kind===`review`?a?`${u} · 审阅`:`${u} · review`:a?`${u} · 续`:`${u} · cont.`),r&&e[0].kind===`plan`&&(u=a?`起点 · ${u}`:`Setting out · ${u}`),i&&e[e.length-1].kind===`result`&&(u=a?`${u} · 结果`:`${u} · Outcome`),u}function Ps(e){let t=e.stacked?900/e.width:Math.max(600/e.height,Math.min(1e3/e.height,is.width/e.width));return{width:e.width*t,height:e.height*t,scale:t}}function Fs(e,t){let n=e.filter(e=>e.source===`team`);if(n.length){let r=e.filter(e=>e.source!==`team`),i=new Map(n.map(e=>[e.id,e])),a=r.find(e=>e.source===`task`&&e.kind===`plan`),o=[];for(let e of n){for(let n of e.deps||[]){let r=i.get(n);!r||r.id===e.id||r.teamId!==e.teamId||o.push({id:`link:${r.id}:${e.id}`,source:r.id,target:e.id,relation:`dependency`,label:t?`前置任务`:`Depends on`,explanation:t?`${e.title} 的任务记录明确依赖 ${r.title}。`:`${e.title} explicitly depends on ${r.title} in its taskboard.`,contextual:!1})}a&&!e.deps?.length&&o.push({id:`link:${a.id}:${e.id}`,source:a.id,target:e.id,relation:`assignment`,label:t?`任务分支`:`Branch`,explanation:t?`该子任务属于当前主任务;此线不表示等待主任务完成。`:`This worker belongs to the current mission; the link does not require the parent to finish first.`,contextual:!0})}return[...Fs(r,t),...o]}return e.slice(1).map((n,r)=>{let i=e[r],a=i.episode===n.episode,o=a&&i.round!=null&&i.round===n.round,s=`record_order`,c=t?`接着`:`then`,l=t?`同一任务的相邻观察,未确认直接因果或执行依赖。`:`Adjacent observations of the same task; no causal dependency is asserted.`;i.kind===`plan`&&[`plan`,`execution`].includes(n.kind)?(s=`assignment`,c=t?n.kind===`plan`?`纳入计划`:`执行此任务`:n.kind===`plan`?`planned`:`carried out`,l=t?`同一任务的目标/计划与其执行记录关联。`:`The task brief or plan is linked to execution of that same task.`):i.kind===`execution`&&n.kind===`review`&&o?(s=`review`,c=t?`提交审阅`:`sent for review`,l=t?`同一个任务、同一执行段、同一轮次的执行与审查记录。`:`Execution and review belong to the same task, episode and numbered round.`):i.kind===`review`&&n.kind===`revision`&&n.eventIds.some(e=>i.eventIds.includes(e))?(s=`revision`,c=t?`提出修改`:`asked to change`,l=t?`这条修订建议来自对应的审查记录。`:`This revision was requested in the corresponding review.`):i.kind===`revision`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`修订建议之后出现了同一任务的下一轮执行;不表示建议的全部内容已被采纳。`:`A later round follows the revision request; this does not certify every requested change was applied.`):i.kind===`review`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`审阅之后出现了同一任务的下一轮执行。`:`A later round of the same task follows the review.`):i.kind===`execution`&&n.kind===`execution`&&i.round==null&&n.round!=null?(c=t?`进入第 ${n.round} 轮`:`round ${n.round} begins`,l=t?`任务开始执行后记录的一轮工作。`:`A round of work recorded after the task was taken up.`):i.kind===`result`&&n.kind===`execution`?(c=t?`再次开始`:`taken up again`,l=t?`上一次执行结束之后,这项任务又被接手。`:`The task was taken up again after an earlier execution ended.`):n.kind===`result`&&n.source===`task`?(s=`snapshot`,c=t?`最终状态`:`ended as`,l=t?`任务状态记录;部分执行过程可能缺失。`:`Links to the captured state of this task; intermediate records may be missing.`):n.kind===`result`&&[`review`,`execution`,`revision`].includes(i.kind)&&(s=`outcome`,c=t?`形成结果`:`led to`,l=t?`同一任务的后续完成/失败事件,不等同于成功认证。`:`A completion or failure event of this task, not a certification of success.`);let u=[`record_order`,`snapshot`].includes(s)||i.source===`interval`||n.source===`interval`;return(i.source===`interval`||n.source===`interval`)&&(l+=t?` 部分旧记录按唯一活动任务区间归属,因此使用虚线。`:` Some legacy observations are associated by the sole active mission window, so this link is dashed.`),{id:`link:${i.id}:${n.id}`,source:i.id,target:n.id,relation:s,label:c,explanation:l,contextual:u}})}function Is(e){let t=[],n=[];for(let r=0;r12&&(t.push(n),n=[]),n.push(...i)}return n.length&&t.push(n),t}function Ls(e,t,n,r){for(let i of[n,r]){let n={x:(i.x-t.x)/t.zoom,y:(i.y-t.y)/t.zoom},r=e.find(e=>!e.hidden&&n.x>=e.position.x&&n.x<=e.position.x+(e.width??1152)&&n.y>=e.position.y&&n.y<=e.position.y+(e.height??824));if(r)return r.id}return null}function Rs(e,t,n,r,i=Go(e,[],n),a,o=!1){let s=[],c={},l=[],u=new Map;for(let[r,i]of e.tasks.entries()){let e=Ds(i,t,n),a=i.status===`done`?ns(bo(i,t),n):``,d=i.kind===`turn`?``:Os(e,n,yo.has(i.status)),f=Is(e),p=f.length,m=e=>e===1?i.id:JSON.stringify([`part`,i.id,e]),h=0;for(let u=1;u<=p;u++){let g=f[u-1],_=m(u);if(s.push({id:_,task:i,ordinal:r+1,part:u,partCount:p,start:h+1,end:h+g.length,totalSteps:e.length,previousId:u>1?m(u-1):void 0,nextId:u1){let t=Fs([e[h-1],g[0]],n)[0];l.push({id:JSON.stringify([`continuation`,i.id,u]),source:m(u-1),target:_,kind:`continuation`,label:t?n?`继续`:`Continued`:n?`更多分支`:`More branches`,evidence:t?`${i.title} · ${t.label} · ${e[h-1].title} → ${g[0].title}`:`${i.title} · ${n?`同一任务的其他分支,不表示串行依赖。`:`Other branches of the same mission, without a serial dependency.`}`})}h+=g.length}u.set(i.id,m(p))}let d=s.slice(),f=new Map;if(a){s.length=0;for(let e of d){let t=a.has(e.task.id);if(f.set(e.id,t?e.id:e.task.id),!t&&e.part!==e.partCount)continue;let n=t?e.id:e.task.id;c[n]=c[e.id],s.push({...e,id:n,historyCount:e.partCount-1,historyExpanded:t})}}let p=e=>f.get(e)??e,m=Object.fromEntries(s.map(({id:e})=>[e,Ps(c[e])])),h=[...i.map(e=>({...e,source:p(u.get(e.source)),target:p(e.target)})),...l.filter(e=>p(e.source)!==p(e.target))],g=s.map(e=>e.id),_=JSON.stringify([g.map(e=>[e,m[e].width,m[e].height]),h.map(e=>[e.source,e.target,e.kind])]);return{cards:s,allCards:d,links:h,layouts:c,positions:r?.structure===_?r.positions:$o(g,h,m),frames:m,structure:_}}function zs({snapshot:e,view:t,events:n=[],connected:r,compact:i=!1}){let{locale:a}=F(),o=a===`zh-CN`,[s,c]=(0,U.useState)(()=>Date.now()/1e3);(0,U.useEffect)(()=>{let e=window.setInterval(()=>c(Date.now()/1e3),1e4);return()=>window.clearInterval(e)},[]);let l=Vr(e,t,n,s),u=l.activityAgeSeconds,d=l.waitingOn?``:u===null?o?`暂无本次运行的进展记录`:`No progress recorded for this run yet`:u<60?o?`刚刚有进展`:`Progress in the last minute`:u<3600?o?`${Math.floor(u/60)} 分钟前有进展`:`Progress ${Math.floor(u/60)} min ago`:o?`${Math.floor(u/3600)} 小时前有进展`:`Progress ${Math.floor(u/3600)} hr ago`;return(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-line/60 bg-panel px-4 py-2.5 text-xs`,"data-testid":`work-status`,"data-state":l.state,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r?l.state===`running`?`bg-blue`:`bg-ink-faint`:`bg-warn`}`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`font-medium text-ink`,children:Kr(l,a,r)}),d?(0,K.jsx)(`time`,{className:`text-ink-faint`,dateTime:l.activityAt?new Date(l.activityAt*1e3).toISOString():void 0,children:d}):null]}),r?!i&&l.title?(0,K.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-ink-dim`,title:l.title,children:l.title}):null:(0,K.jsx)(`p`,{className:`mt-1 leading-5 text-ink-faint`,children:o?`这里保留的是已收到的记录;连接恢复后继续更新。`:`These are the records already received. Updates resume when the connection returns.`})]})}function Bs(e,t,n){if(e.pending_question)return e.pending_question;let r=t.filter(t=>t.item_id===e.id&&(t.status===`failed`||t.success===!1||t.type.endsWith(`.failed`))).sort((e,t)=>t.ts-e.ts)[0],i=(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``),a=r?.reason||r?.text||i,o=Hi(a,n),s=o.receipt?a.lastIndexOf(o.receipt):-1,c=fs(s>=0?a.slice(0,s):a);return o.summary||c||(n?`这项任务没有完成,记录里没有写明原因。`:`This task did not finish, and the record does not say why.`)}function Vs(e){return(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``).trim()}function Hs(e,t,n,r=``){if(e.pending_question)return{reason:e.pending_question,next:n?`下一步:回答这个问题,团队才会继续。`:`Next: answer this question so the team can continue.`,detail:``,showDetail:!1};if(Do(e)){let t=Vs(e),i=r.trim();return{reason:i?n?`工作已暂停:${i}`:`Work paused: ${i}`:t?n?`工作已暂停:当前结果还没有满足要求,具体原因见下方说明。`:`Work paused: the current result does not yet meet the requirements. The reason is shown below.`:n?`工作已暂停:当前结果还没有满足要求,记录里没有说明具体原因。`:`Work paused: the current result does not yet meet the requirements. No specific reason was recorded.`,next:n?`工作不会自动继续。请看暂停原因,再在对话里告诉我接下来做什么。`:`Work will not resume on its own. Read the reason, then tell me what to do next in the conversation.`,detail:t,showDetail:!!t&&!i}}let i=Bs(e,t,n),a=Vs(e);return{reason:n?`执行失败:${i}`:`Execution failed: ${i}`,next:n?`下一步:查看原因后重试,或在对话里调整任务。`:`Next: check the reason, then retry or adjust the task in the conversation.`,detail:a&&!i.includes(a)?a:``,showDetail:!1}}var Us=(e,t=80)=>e.length>t?`${e.slice(0,t)}…`:e;function Ws(e,t,n,r=()=>``){let i=e.filter(e=>e.turn_kind!==`qa`&&e.kind!==`turn`),a=[...i].sort((e,t)=>(t.ts??0)-(e.ts??0)),o=a[0],s=o?Us((o.objective||o.title).trim()):n?`还没有任务`:`No task yet`,c=Oo(e,t),l=e=>{let t=Eo(e);return{held:n?`工作已暂停`:`work paused`,failed:n?`这项工作没有做完`:`this task did not finish`,review_unavailable:n?`结果检查没有完成`:`the result check did not finish`,done:n?`已完成`:`done`,running:n?`进行中`:`running`,pending:n?`待开始`:`planned`,question:n?`等你回答`:`waiting on you`,paused:n?`已暂停`:`paused`}[t]||(n?`还没有新的进展记录`:`No new progress has been recorded`)},u=c?n?`已确认:${Us(fs(r(c)||c.summary||c.title),160)}`:`Confirmed: ${Us(fs(r(c)||c.summary||c.title),160)}`:o?Eo(o)===`review_unavailable`?n?`这次结果检查没有完成,暂时不能确认结果。`:`The result check did not finish, so the result is not yet confirmed.`:n?`还没有经过检查确认的结果。`:`There is no checked, confirmed result yet.`:n?`还没有结果`:`No result yet`,d=i.find(e=>yo.has(e.status)),f=a.find(e=>[`question`,`held`,`failed`,`review_unavailable`].includes(Eo(e))),p=[...i].sort((e,t)=>(e.ts??0)-(t.ts??0)).find(e=>Eo(e)===`pending`);return{goal:s,current:d?n?`正在处理:${Us(d.title,70)}`:`Working on: ${Us(d.title,70)}`:o?l(o):n?`可以开始新任务`:`Ready for a new task`,conclusion:u,next:d?p?n?`待做任务:${Us(p.title,70)}`:`Queued next: ${Us(p.title,70)}`:n?`等当前工作完成,再查看检查结果。`:`Wait for the current work to finish, then check the result.`:f&&f===o?Hs(f,t,n,r(f)).next:p?n?`下一步:${Us(p.title,60)}`:`Next: ${Us(p.title,60)}`:c?n?`可以查看结果,或继续提出要求。`:`Read the result, or tell me what to do next.`:n?`还没有后续任务,可在对话里告诉我接下来做什么。`:`Nothing else is scheduled. Tell me what to do next in the conversation.`}}function Gs(e,t,n){let r=e?.model_revision&&e.model_revision!==n,i={...e?.cards};for(let[n,a]of Object.entries(t.cards)){if(r&&i[n]?.model_revision===e.model_revision)continue;let t=i[n];t?.version&&(a.version??0)(t.copy_revision??0)||(a.copy_revision??0)===(t.copy_revision??0)&&(a.generated_at>t.generated_at||a.generated_at===t.generated_at&&!t.input_revision))&&(i[n]=a)}let a=(t.cache_revision??0)<(e?.cache_revision??0);return{...e,...t,cards:i,...e?.version!=null||t.version!=null?{version:Math.max(e?.version??0,t.version??0)}:{},cache_revision:Math.max(t.cache_revision??0,e?.cache_revision??0),relations:(r||a)&&e?e.relations:t.relations,available:t.available??!0,...r?{model_revision:e.model_revision,available:e.available}:{}}}function Ks(e,t,n,r){let i=n?.cards[e.key],a=t.tasks.find(t=>t.id===e.task_id);if(!i||!a||(i.version??0)<(n?.version??0)||n?.model_revision&&i.model_revision!==n.model_revision)return!0;let o=[a.id,a.id+`:active`,a.id+`:outcome`].includes(e.key);if(o||!i.task_content_revision||!a.content_revision){if(a.revision&&i.task_revision!==a.revision||o&&i.task_status!==a.status)return!0}else if(i.task_content_revision!==a.content_revision)return!0;let s=i.event_ids||[];return e.event_ids.some(e=>{let n=s.indexOf(e),a=r?r.get(e):t.events.find(t=>t.id===e);return n<0||i.event_revisions&&a?.revision&&i.event_revisions[n]!==a.revision})||!o&&JSON.stringify(e.event_ids)!==JSON.stringify(s)}var qs=e=>`[[Argus引用 ${JSON.stringify(e)}]]\n`;function Js(e){let t=[];return{refs:t,text:e.split(` +`).filter(e=>{if(e.startsWith(`[[Argus引用 `)&&e.endsWith(`]]`))try{let n=JSON.parse(e.slice(10,-2));if(typeof n.task_id==`string`&&typeof n.source==`string`&&typeof n.task_title==`string`&&(n.part===void 0||Number.isInteger(n.part)&&n.part>0)&&(n.step_title===void 0||typeof n.step_title==`string`)&&(n.step_id===void 0||typeof n.step_id==`string`)&&(n.team_id===void 0||typeof n.team_id==`string`)&&(n.team_task_id===void 0||typeof n.team_task_id==`string`)&&(n.lang===void 0||typeof n.lang==`string`)&&Array.isArray(n.event_ids)&&n.event_ids.every(e=>typeof e==`string`))return t.push(n),!1}catch{}return!0}).join(` +`).replace(/^\n+/,``)}}function Ys(e,t,n=1/0){let r=Math.max(-1/0,...e.events.filter(e=>e.item_id===t&&e.type===`life.mission.started`&&e.ts<=n).map(e=>e.ts));return e.events.filter(e=>e.item_id===t&&e.ts>=r&&e.ts<=n&&[`round.main.completed`,`round.review.completed`].includes(e.type)).slice(-2).map(e=>e.id)}function Xs(e,t,n){return n.map(n=>({key:n.id,task_id:t.id,kind:n.kind,event_ids:[...new Set([...n.kind===`result`?Ys(e,t.id,n.ts):[],...n.eventIds])].slice(-16)}))}function Zs(e,t,n){let r=e.tasks.find(e=>e.id===n),i=(r?[r,...e.tasks.filter(e=>e.id!==n)]:e.tasks).map(t=>({key:t.id,task_id:t.id,kind:`task`,event_ids:[...new Set([...Ys(e,t.id),...e.events.filter(e=>e.item_id===t.id).slice(-2).map(e=>e.id)])]})),a=r?Xs(e,r,t):[];return[...i.slice(0,1),...a,...i.slice(1)]}var Qs=/Info: (?:Operation cancelled by user|Response was interrupted due to a server error\. Retrying\.\.\.)/gi;function $s({ev:e,r:t,first:n,last:r,latest:i,repeat:a=1,status:o=``,result:s}){let{locale:c,t:l}=F(),u=R.role[t.role]??R.inkFaint,d=je(t.tone),f=e.type===`engineer.progress`&&String(e.kind||``)===`tool_use`,p=[`agent_message`,`assistant_message`,`message`].includes(String(e.kind||``))?fs(t.text):t.text,m=f?{text:Ka(e,c),technical:t.text}:fa(p,c),h=s?fa(s.r.text,c).text:``,g=[m.technical,h?`${l(`stream.stepResult`)}: ${h}`:``].filter(Boolean).join(` +`);return(0,K.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${r?`animate-appear`:``} ${t.reasoning?`opacity-60`:``}`,style:t.rule?{marginTop:4}:void 0,children:[(0,K.jsxs)(`div`,{className:`relative flex justify-center`,children:[n?null:(0,K.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),r?null:(0,K.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,K.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:u,boxShadow:`0 0 0 1px ${u}55`}})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:u},title:t.label,children:t.label}),(0,K.jsx)(`span`,{className:`text-xs`,style:{color:d},children:t.glyph}),a>1?(0,K.jsxs)(`span`,{className:`rounded bg-line/60 px-1 font-mono text-[10px] tabular-nums text-ink-dim`,title:l(`stream.repeated`,{count:a}),"data-repeat":a,children:[`×`,a]}):null,o===`failed`?(0,K.jsx)(`span`,{className:`text-xs text-err`,children:l(`stream.stepFailed`)}):null,(0,K.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:dt(i??e)})]}),(0,K.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5 ${t.reasoning?`italic`:``}`,style:{color:d},title:g||void 0,children:m.text})]})]})}function ec({group:e,first:t,last:n,open:r,onToggle:i}){let{locale:a,t:o}=F(),s=R.role[e.r.role]??R.inkFaint,c=je(e.r.tone),l=Za(e,o,a);return(0,K.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${n?`animate-appear`:``}`,"data-feed-group":e.action,"data-open":r?`true`:`false`,children:[(0,K.jsxs)(`div`,{className:`relative flex justify-center`,children:[t?null:(0,K.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),n?null:(0,K.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,K.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:s,boxShadow:`0 0 0 1px ${s}55`}})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":r,title:o(r?`stream.fold.collapse`:`stream.fold.expand`),className:`block w-full rounded text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-blue-sky`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:s},title:e.r.label,children:e.r.label}),(0,K.jsx)(`span`,{className:`text-xs`,style:{color:c},children:e.r.glyph}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-ink-faint`,children:e.calls}),(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,K.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})}),(0,K.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:dt(e.latest)})]}),(0,K.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5`,style:{color:c},children:l})]}),r?(0,K.jsx)(`div`,{className:`mt-1 border-l border-line/50`,children:e.steps.map((t,n)=>(0,K.jsx)($s,{ev:t.ev,r:t.r,first:n===0,last:n===e.steps.length-1,latest:t.latest,repeat:t.repeat,status:t.status,result:t.result},t.key))}):null]})]})}function tc({rows:e}){let[t,n]=(0,U.useState)(()=>new Set),r=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,K.jsx)(K.Fragment,{children:e.map((n,i)=>n.kind===`group`?(0,K.jsx)(ec,{group:n,first:i===0,last:i===e.length-1,open:t.has(n.key),onToggle:()=>r(n.key)},n.key):(0,K.jsx)($s,{ev:n.ev,r:n.r,first:i===0,last:i===e.length-1,latest:n.latest,repeat:n.repeat,status:n.status,result:n.result},n.key))})}function nc({ev:e,r:t,artifacts:n,onOpenArtifact:r}){let{t:i,locale:a}=F(),o=String(e.type)===`ui.operator`,s=!o&&e.mission_result===!0,c=s&&typeof e.text==`string`?e.text:t.text,l=s?pa(c,a):null,u=s?ft(e):null,d=o?Js(t.text):null,f=d?.refs??[],p=d&&f.length?d.text:t.text,m=o?[]:lo(e.steps),h=Number(e.response_latency_ms??0),g=!o&&h>=100?` · ${(h/1e3).toFixed(1)}s`:``,_=(0,U.useRef)(null);return qe(_,(e,t)=>{_.current&&(t||e.fromTo(_.current,{autoAlpha:0,x:o?12:0,y:o?0:8},{autoAlpha:1,x:0,y:0,duration:.28,ease:`power2.out`,clearProps:`transform,opacity,visibility`}))}),(0,K.jsx)(`article`,{ref:_,"data-task-receipt":s||void 0,"data-task-receipt-id":s?String(e.message_id||e.event_id||``):void 0,className:`conversation-row group mx-auto w-full max-w-full px-4 py-3 sm:px-6 lg:max-w-[61.8vw]`,children:o?(0,K.jsxs)(`div`,{className:`flex items-end justify-end gap-2`,children:[(0,K.jsx)(Be,{text:t.text,label:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,K.jsx)(`time`,{className:`shrink-0 pb-1 font-mono text-[10px] tabular-nums text-ink-faint`,children:dt(e)}),(0,K.jsxs)(`div`,{className:`max-w-[calc(100%_-_3rem)] rounded-[18px] bg-conversation-user px-4 py-2.5 text-[15px] leading-relaxed text-ink ring-1 ring-line/35 sm:max-w-[82%]`,children:[f.length?(0,K.jsx)(`div`,{className:`mb-2 space-y-2`,children:f.map((e,t)=>(0,K.jsxs)(`blockquote`,{"aria-label":a===`zh-CN`?`引用`:`Reference`,className:`border-l-2 border-blue/40 pl-3 text-sm text-ink-dim`,children:[(0,K.jsxs)(`div`,{className:`text-xs text-ink-faint`,children:[a===`zh-CN`?`引用`:`Reference`,e.part?` · ${a===`zh-CN`?`第 ${e.part} 部分`:`Part ${e.part}`}`:``]}),(0,K.jsx)(`div`,{className:`font-medium`,children:e.task_title||e.step_title||e.task_id}),e.task_title&&e.step_title&&e.step_title!==e.task_title?(0,K.jsx)(`div`,{children:e.step_title}):null]},`${e.source}:${e.task_id}:${e.step_id}:${t}`))}):null,p?(0,K.jsx)(Ke,{artifacts:n,onOpenArtifact:r,children:p}):null]})]}):(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center`,children:(0,K.jsx)(_t,{size:26,className:`text-ink`})}),(0,K.jsxs)(`div`,{className:`relative min-w-0 flex-1 text-[15px] leading-relaxed text-ink`,children:[(0,K.jsxs)(`div`,{"data-task-receipt-header":s||void 0,className:s?`sticky -top-1.5 z-10 mb-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 bg-panel py-1`:`mb-1 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-xs font-semibold text-blue`,children:pe().name}),s?(0,K.jsx)(`span`,{className:`text-[11px] text-ink-dim`,children:a===`zh-CN`?`任务回报 · 当时记录`:`Task report · Recorded then`}):null,(0,K.jsx)(Be,{text:c,label:l?a===`zh-CN`?`复制原始回报`:`Copy original report`:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`ml-auto opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,K.jsxs)(`time`,{className:`font-mono text-[10px] tabular-nums text-ink-faint ${s?`basis-full sm:basis-auto`:``}`,dateTime:u?.toISOString(),title:u?.toLocaleString(a,{dateStyle:`full`,timeStyle:`long`}),children:[u?u.toLocaleString(a,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):dt(e),g]})]}),c?(0,K.jsx)(`div`,{"data-task-receipt-prose":s||void 0,children:(0,K.jsx)(Ke,{artifacts:n,onOpenArtifact:r,children:l?.text??c})}):null,m.length||e.live===!0?(0,K.jsx)(vo,{steps:m,live:e.live===!0,startedTs:Number(e.ts),status:e.success===!1?`failed`:String(e.status??``)}):null,l?(0,K.jsx)(nt,{className:`task-receipt-original`,label:a===`zh-CN`?`查看原始回报(含技术记录)`:`View original report (including technical records)`,children:(0,K.jsx)(`pre`,{"data-task-receipt-original":!0,className:`mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs text-ink-dim`,children:c})}):null]})]})})}function rc({role:e,rows:t,open:n,active:r,onToggle:i}){let{t:a,locale:o}=F(),s=R.role[e],c=(0,U.useRef)(null),l=(0,U.useRef)(!0),u=(0,U.useRef)(0),[d,f]=(0,U.useState)(!1),p=t[t.length-1]?.r.text.length??0,m=(0,U.useMemo)(()=>Xa(t,o),[t,o]),h=m.length?Qa(m[m.length-1],a,o):``;return(0,U.useEffect)(()=>{n&&!l.current&&c.current&&(c.current.scrollTop=u.current)},[n]),(0,U.useEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{l.current&&c.current&&(c.current.scrollTop=c.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[n,t.length,p]),(0,K.jsxs)(`section`,{className:`role-log-group border-b border-line/50`,"data-role":e,"data-open":n?`true`:`false`,"data-active":r?`true`:`false`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":n,className:`group flex h-11 w-full items-center gap-2 px-4 text-left transition-colors hover:bg-bg/60`,children:[(0,K.jsx)(`span`,{"data-role-dot":e,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:s}}),(0,K.jsx)(`span`,{className:`text-xs font-semibold text-ink-dim`,children:yn(e,a)}),(0,K.jsx)(`span`,{className:`font-mono text-xs text-ink-faint`,children:m.length}),h?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:h}):(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${n?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,K.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),n?(0,K.jsx)(`div`,{className:`grid grid-rows-[1fr]`,children:(0,K.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden`,children:[(0,K.jsx)(`div`,{ref:c,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollTop,l.current=t.scrollHeight-t.scrollTop-t.clientHeight<=2,f(!l.current)},className:`max-h-72 overflow-x-hidden overflow-y-auto border-t border-line/40 scroll-thin`,children:m.length>0?(0,K.jsx)(tc,{rows:m}):(0,K.jsx)(`div`,{className:`px-4 py-3 text-xs text-ink-faint`,children:a(`stream.noLogs`)})}),d?(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{l.current=!0,f(!1),c.current&&(c.current.scrollTop=c.current.scrollHeight)},className:`absolute bottom-2 right-3 rounded-full border border-line/60 bg-panel px-3 py-1 text-xs text-ink-dim shadow-glow hover:text-ink`,children:[`↓ `,a(`stream.jumpToLatest`)]}):null]})}):null]})}function ic(e){let t={manager:[],planner:[],engineer:[],reviewer:[]},n=[];return e.forEach(e=>{He.includes(e.r.role)?t[e.r.role].push(e):n.push(e)}),{roleRows:t,systemRows:n,lastRole:[...e].reverse().find(e=>He.includes(e.r.role))?.r.role??``}}function ac({rows:e}){let{t,locale:n}=F(),[r,i]=(0,U.useState)(!1),a=(0,U.useMemo)(()=>Xa(e,n),[e,n]);return(0,K.jsxs)(`section`,{className:`border-b border-line/50`,"data-system-open":r?`true`:`false`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex h-10 w-full items-center gap-2 px-4 text-left text-xs text-ink-faint hover:bg-bg/60`,children:[(0,K.jsx)(`span`,{children:t(`stream.system`)}),(0,K.jsx)(`span`,{className:`font-mono`,children:a.length}),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,K.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),r?(0,K.jsx)(`div`,{className:`border-t border-line/40`,children:(0,K.jsx)(tc,{rows:a})}):null]})}function oc({rows:e,live:t,followLatest:n,activeRole:r,activeTaskId:i}){let{roleRows:a,systemRows:o,lastRole:s}=(0,U.useMemo)(()=>ic(e),[e]),[c,l]=(0,U.useState)(()=>new Set(n&&s?[s]:[])),u=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{!n||!s||u.current||l(new Set([s]))},[s,n]),(0,K.jsxs)(`div`,{className:`bg-bg/25`,children:[He.map(e=>(0,K.jsx)(rc,{role:e,rows:a[e],open:c.has(e),active:t&&(r??s)===e&&(!i||a[e].some(e=>Ir(e.ev)===i)),onToggle:()=>{u.current=!0,l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}},e)),o.length>0?(0,K.jsx)(ac,{rows:o}):null]})}function sc(e){let t=e.delivery;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.delivery_id!=`string`||!n.delivery_id.trim()?null:n}function cc(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.type===`ui.operator`)return null;let r=sc(n);if(r)return r}}function lc({delivery:e,onOpen:t}){let{t:n}=F(),r=e.kind===`submission_certified`;return(0,K.jsxs)(`aside`,{className:`mx-auto my-3 flex w-full max-w-full gap-3 rounded-lg border border-ok/35 bg-ok/5 px-4 py-3 lg:max-w-[61.8vw]`,children:[(0,K.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-ok/15 font-semibold text-ok`,children:`✓`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-ok`,children:n(r?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,K.jsx)(`div`,{className:`mt-1 truncate text-sm font-semibold text-ink`,title:e.title,children:e.title}),t?(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`mt-2 rounded border border-ok/40 px-2 py-1 font-mono text-[10px] text-ok hover:border-ok hover:bg-ok/10`,children:n(e.primary_target?`mission.openResult`:`mission.viewTask`)}):null]})]})}function uc({group:e,artifacts:t,onOpenArtifact:n,onOpenDelivery:r}){let i=e=>e.ev.type===`ui.argus`&&/^(info:|operation cancelled|cancelled\b)/i.test(e.r.text.trim()),a=e.rows.filter(e=>e.ev.type===`ui.argus`).map(e=>{if(e.ev.mission_result===!0)return{reply:e,messages:[]};let t=e.r.text.match(Qs)??[],n=e.r.text.replace(Qs,``).trim(),r=e.ev.live===!0||Array.isArray(e.ev.steps)&&e.ev.steps.length>0;return{reply:(n||r)&&!i(e)?{...e,r:{...e.r,text:n}}:null,messages:i(e)&&t.length===0?[e.r.text]:t}}),o=a.flatMap(e=>e.reply?[e.reply]:[]),s=a.flatMap(e=>e.messages),c=(()=>{let t=new Set;return e.rows.flatMap(e=>{let n=sc(e.ev);return!n||t.has(n.delivery_id)?[]:(t.add(n.delivery_id),[n])})})();return(0,K.jsxs)(`section`,{className:`conversation-thread border-b border-line/60`,children:[(0,K.jsx)(nc,{ev:e.operator.ev,r:e.operator.r,artifacts:t,onOpenArtifact:n}),o.map(e=>(0,K.jsx)(nc,{ev:e.ev,r:e.r,artifacts:t,onOpenArtifact:n},e.key)),s.map((t,n)=>(0,K.jsx)(`div`,{className:`mx-auto w-full max-w-full px-6 py-1.5 text-center text-xs text-ink-faint lg:max-w-[61.8vw]`,children:t},`${e.key}-system-${n}`)),c.map(e=>(0,K.jsx)(lc,{delivery:e,onOpen:r},e.delivery_id))]})}function dc({events:e,connected:t,showReasoning:n,onToggleReasoning:r,embedded:i=!1,showHeader:a=!0,filter:o=`all`,query:s=``,skipFirst:c=0,artifacts:l,onOpenArtifact:u,onOpenDelivery:d,snapshot:f,missionView:p,historyStatus:m=`ready`,historyRefreshing:h=!1,onRetryHistory:g}){let{locale:_,t:v}=F(),[y,b]=(0,U.useState)(!0),x=(0,U.useRef)(!0),S=(0,U.useRef)(0),[C,w]=(0,U.useState)(()=>Date.now()),T=(0,U.useRef)(null),E=(0,U.useRef)(null),D=(0,U.useDeferredValue)(e),O=(0,U.useMemo)(()=>f?Vr(f,p,D):null,[D,p,f]),k=t&&(!f||O?.state===`running`),A=(0,U.useMemo)(()=>f||!t?null:Rr(D),[t,D,f]);(0,U.useEffect)(()=>{if(!A)return;w(Date.now());let e=window.setInterval(()=>w(Date.now()),1e3);return()=>window.clearInterval(e)},[A]);let j=A?Math.max(0,Math.floor((C-Number(A.ts??0)*1e3)/1e3)):0,M=(0,U.useMemo)(()=>ba(c>0?D.slice(c):D,{locale:_,showReasoning:n,filter:o,query:s}),[D,n,o,s,c,_]),N=(0,U.useMemo)(()=>{let e=[],t=[],n=[],r=null;M.list.forEach(i=>{i.ev.type===`ui.operator`?(r={key:i.key,operator:i,rows:[]},e.push(r)):i.ev.type===`ui.argus`?r?r.rows.push(i):t.push(i):n.push(i)});let i=new Set(M.list.filter(e=>e.ev.type===`ui.argus`).map(e=>sc(e.ev)?.delivery_id).filter(Boolean));return{groups:e,earlierReplies:t,projectWork:n,projectDeliveries:n.flatMap(e=>{let t=sc(e.ev);return!t||i.has(t.delivery_id)?[]:(i.add(t.delivery_id),[t])})}},[M.list]),P=(0,U.useMemo)(()=>D.filter(Ee).length,[D]),I=(0,U.useMemo)(()=>M.list.slice(-20).reduce((e,t)=>e+t.r.text.length,0),[M.list]);return(0,U.useEffect)(()=>{if(!y)return;let e=window.requestAnimationFrame(()=>{x.current&&T.current&&(T.current.scrollTop=T.current.scrollHeight,S.current=T.current.scrollTop)});return()=>window.cancelAnimationFrame(e)},[M.list.length,I,y]),(0,U.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<40;x.current=t||x.current&&e.scrollTop>=S.current-1,S.current=e.scrollTop,b(x.current)};e.addEventListener(`scroll`,t,{passive:!0});let n=null,r=new ResizeObserver(()=>{x.current&&(n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,x.current&&(e.scrollTop=e.scrollHeight,S.current=e.scrollTop)}))});return r.observe(e),E.current&&r.observe(E.current),()=>{e.removeEventListener(`scroll`,t),r.disconnect(),n!==null&&window.cancelAnimationFrame(n)}},[]),(0,K.jsxs)(`section`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden bg-panel ${i?``:`rounded-lg border border-line/80`}`,children:[a&&(0,K.jsx)(et,{title:v(`panel.activity`),right:(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[N.projectWork.length>0?(0,K.jsx)(`button`,{type:`button`,onClick:()=>{x.current=!1,b(!1),T.current?.scrollTo({top:0,behavior:`auto`})},className:`rounded px-1.5 py-0.5 text-xs text-blue-sky hover:bg-bg`,children:_===`zh-CN`?`查看工作进展`:`View work progress`}):null,(0,K.jsxs)(`button`,{onClick:r,className:`rounded px-1.5 py-0.5 text-xs transition-colors ${n?`text-blue-sky`:`text-ink-faint hover:text-ink-dim`}`,title:v(`stream.toggleReasoning`),children:[v(`stream.reasoning`),P?` ·${P}`:``]}),(0,K.jsx)(`span`,{className:`text-xs ${t?`text-ok`:`text-ink-faint`}`,children:t?`● ${v(`common.live`)}`:`○ ${v(`common.reconnecting`)}`})]})}),f?(0,K.jsx)(zs,{snapshot:f,view:p,events:D,connected:t,compact:!0}):A?(0,K.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line/60 bg-blue-deep/5 px-4 text-xs text-ink-dim`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-blue-sky`}),(0,K.jsx)(`span`,{className:`truncate`,children:v(`stream.backgroundWork`)}),(0,K.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono tabular-nums text-ink-faint`,children:[j,`s`]})]}):null,m===`ready`?null:(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 px-4 py-3 text-sm text-ink-faint`,role:m===`error`?`alert`:`status`,"data-conversation-history":m,children:[(0,K.jsx)(`span`,{children:v(m===`error`?`stream.historyError`:`stream.historyLoading`)}),m===`error`&&g?(0,K.jsx)(`button`,{type:`button`,onClick:g,disabled:h,className:`shrink-0 rounded px-2 py-1 text-blue-sky hover:bg-bg disabled:opacity-50`,children:v(`stream.historyRetry`)}):null]}),(0,K.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto pb-6 pt-1.5 scroll-thin`,"aria-busy":m===`loading`,children:(0,K.jsx)(`div`,{ref:E,className:`flow-root`,"data-event-stream-content":!0,children:M.list.length===0?m===`ready`?(0,K.jsx)(Ve,{children:v(`stream.ready`)}):null:(0,K.jsxs)(K.Fragment,{children:[N.projectWork.length>0?(0,K.jsxs)(`section`,{"data-project-work":!0,className:`mx-auto w-full max-w-full border-b border-line/60 lg:max-w-[61.8vw]`,children:[(0,K.jsxs)(`div`,{className:`flex h-10 items-center gap-2 border-b border-line/40 px-4 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink-faint`,children:[_===`zh-CN`?`项目工作进展`:`Project work progress`,(0,K.jsx)(`span`,{className:`font-mono font-normal tracking-normal`,children:N.projectWork.length})]}),(0,K.jsx)(oc,{rows:N.projectWork,live:k,followLatest:!0,activeRole:O?.role,activeTaskId:O?.taskId}),N.projectDeliveries.map(e=>(0,K.jsx)(lc,{delivery:e,onOpen:d},e.delivery_id))]},`project-work`):null,N.earlierReplies.map(e=>(0,K.jsx)(nc,{ev:e.ev,r:e.r,artifacts:l,onOpenArtifact:u},e.key)),N.groups.map(e=>(0,K.jsx)(uc,{group:e,artifacts:l,onOpenArtifact:u,onOpenDelivery:d},e.key))]})})}),!y&&(0,K.jsx)(`button`,{onClick:()=>{x.current=!0,b(!0),T.current&&(T.current.scrollTo({top:T.current.scrollHeight,behavior:`auto`}),S.current=T.current.scrollTop)},"aria-label":v(`stream.jumpToLatest`),title:v(`stream.jumpToLatest`),className:`absolute bottom-4 left-1/2 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-line/60 bg-panel text-sm text-ink-dim shadow-glow transition-all duration-200 hover:border-ink-faint hover:text-ink`,children:`↓`})]})}function fc(e){return e.nativeEvent.isComposing||e.keyCode===229}var pc=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function mc(e){return pc[e%pc.length]}var hc=[{id:`status`,name:`/status`,argument:`none`,desc:`roles, queued work, journal, and health`,group:`Everyday`,kind:`panel`},{id:`roles`,name:`/roles`,argument:`none`,desc:`per-role backend / model / effort + live activity`,group:`Everyday`,kind:`panel`},{id:`journal`,name:`/journal`,arg:`[N]`,argument:`optional`,desc:`recent journal entries (default 10)`,group:`Everyday`,kind:`panel`},{id:`backlog`,name:`/backlog`,arg:`[all]`,argument:`optional`,desc:`pending tasks (all = incl. done/skipped)`,group:`Everyday`,kind:`panel`},{id:`artifacts`,name:`/artifacts`,argument:`none`,desc:`result files the Reviewer has checked (Enter previews)`,group:`Everyday`,kind:`panel`},{id:`artifact`,name:`/artifact`,arg:``,argument:`required`,desc:`preview one reviewed result file`,group:`Everyday`,kind:`panel`},{id:`events`,name:`/events`,arg:`[filter] [query]`,argument:`optional`,desc:`search feed: all / watch / milestones / messages`,group:`Everyday`,kind:`panel`},{id:`find`,name:`/find`,arg:``,argument:`required`,desc:`search the current event buffer`,group:`Everyday`,kind:`panel`},{id:`cancel`,name:`/cancel`,argument:`none`,desc:`stop waiting for the current Manager reply`,group:`Everyday`,kind:`local`},{id:`ask`,name:`/ask`,arg:``,argument:`required`,desc:`answer inline — no task queued, no Planner/Engineer/Reviewer`,aliases:[`/chat`],group:`Everyday`,kind:`action`},{id:`crystalpilot`,name:`/crystalpilot`,arg:`[status|off|use ]`,argument:`optional`,desc:`enable crystallography tools in this Argus conversation`,group:`Everyday`,kind:`action`},{id:`task`,name:`/task`,arg:``,argument:`required`,desc:`queue work directly`,aliases:[`/add`],group:`Task management`,kind:`action`},{id:`plan`,name:`/plan`,arg:``,argument:`required`,desc:`preview a Planner-authored execution plan`,group:`Task management`,kind:`action`},{id:`rewrite`,name:`/rewrite`,arg:`[text]`,argument:`optional`,desc:`let the Manager rewrite your prompt before sending`,aliases:[`/refine`],group:`Task management`,kind:`action`},{id:`nudge`,name:`/nudge`,arg:``,argument:`required`,desc:`inject guidance into the running mission`,aliases:[`/inject`,`/notify`],group:`Task management`,kind:`action`},{id:`abort`,name:`/abort`,argument:`none`,desc:`immediately stop the running mission`,group:`Task management`,kind:`action`},{id:`note`,name:`/note`,arg:``,argument:`required`,desc:`append a manual note to the timeline`,group:`Task management`,kind:`action`},{id:`done`,name:`/done`,arg:``,argument:`required`,desc:`mark a task done`,group:`Task management`,kind:`action`},{id:`skip`,name:`/skip`,arg:``,argument:`required`,desc:`skip a task`,aliases:[`/rm`],group:`Task management`,kind:`action`},{id:`stop`,name:`/stop`,arg:``,argument:`required`,desc:`stop a task's auto-iteration`,group:`Task management`,kind:`action`},{id:`item`,name:`/item`,arg:``,argument:`required`,desc:`inspect a full task contract`,group:`Task management`,kind:`panel`},{id:`run`,name:`/run`,argument:`none`,desc:`return to the always-live mission feed`,group:`Task management`,kind:`local`},{id:`new`,name:`/new`,arg:`[objective]`,argument:`optional`,desc:`review, create, and switch to a fresh conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`daemons`,name:`/daemons`,arg:`[query]`,argument:`optional`,desc:`find every session + switch or create`,group:`Sessions & diagnostics`,kind:`panel`},{id:`resume`,name:`/resume`,arg:`[list|]`,argument:`optional`,desc:`switch to another project/session`,group:`Sessions & diagnostics`,kind:`action`},{id:`attach`,name:`/attach`,arg:``,argument:`required`,desc:`follow another project (read the stream)`,group:`Sessions & diagnostics`,kind:`action`},{id:`rename`,name:`/rename`,arg:``,argument:`required`,desc:`rename the current conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`doctor`,name:`/doctor`,argument:`none`,desc:`diagnose 'why isn't anything running'`,group:`Sessions & diagnostics`,kind:`panel`},{id:`backend`,name:`/backend`,arg:`[codex|claude|copilot|cursor|opencode|pi|grok|qoder|dsh]`,argument:`optional`,desc:`view or change the shared runner backend`,group:`Configuration`,kind:`action`},{id:`config`,name:`/config`,arg:`[key=value …]`,argument:`optional`,desc:`view or change runtime settings`,group:`Configuration`,kind:`panel`},{id:`identity`,name:`/identity`,arg:`[set ]`,argument:`optional`,desc:`view or replace the operator identity card`,group:`Configuration`,kind:`panel`},{id:`reset`,name:`/reset`,argument:`none`,desc:`drop the warm Manager conversation context`,group:`Configuration`,kind:`action`},{id:`skills`,name:`/skills`,arg:`[ls|promote ]`,argument:`optional`,desc:`inspect or promote runtime skills`,group:`Configuration`,kind:`action`},{id:`clear`,name:`/clear`,argument:`none`,desc:`clear the event feed view`,group:`Other`,kind:`local`},{id:`reconnect`,name:`/reconnect`,argument:`none`,desc:`reconnect the live event stream`,group:`Other`,kind:`local`},{id:`help`,name:`/help`,argument:`none`,desc:`keys + full command reference`,aliases:[`/?`,`/commands`],group:`Other`,kind:`local`},{id:`quit`,name:`/quit`,argument:`none`,desc:`leave the cockpit (background work keeps running)`,aliases:[`/exit`,`/q`],group:`Other`,kind:`local`}];new Map(hc.map(e=>[e.id,e]));var gc=new Map;for(let e of hc)for(let t of[e.name,...e.aliases??[]])gc.set(t.toLowerCase(),e);function _c(e){return e.argument===`required`}var vc=/^\/[A-Za-z0-9_-]+$/;function yc(e){if(!e.startsWith(`/`))return!1;let t=e.indexOf(` `),n=t===-1?e:e.slice(0,t);return vc.test(n)}function bc(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.slice(1).includes(`/`)}function xc(e){if(!bc(e))return[];let t=e.toLowerCase(),n=new Set,r=[];for(let e of hc)[e.name,...e.aliases??[]].some(e=>e.toLowerCase().startsWith(t))&&!n.has(e.name)&&(n.add(e.name),r.push(e));return r.sort((e,n)=>Number(Sc(n,t))-Number(Sc(e,t)))}function Sc(e,t){return[e.name,...e.aliases??[]].some(e=>e.toLowerCase()===t)}function Cc(e){return e.arg?`${e.name} `:e.name}function wc(e){let t=e.trim();if(!t)return{filter:`all`,query:``};let[n,...r]=t.split(/\s+/);return n.toLowerCase()===`watch`?{filter:`attention`,query:r.join(` `)}:re.includes(n.toLowerCase())?{filter:n.toLowerCase(),query:r.join(` `)}:{filter:`all`,query:t}}function Tc(e){if(!yc(e))return null;let t=e.indexOf(` `),n=(t===-1?e:e.slice(0,t)).toLowerCase(),r=t===-1?``:e.slice(t+1).trim(),i=gc.get(n)??null;return{cmd:i,name:i?i.name:n,rest:r}}function Ec(e){let t=e.toLowerCase(),n=null,r=0;for(let e of gc.keys()){let i=Dc(t,e);i>r&&(r=i,n=gc.get(e).name)}return r>=.6?n:null}function Dc(e,t){return 1-Oc(e,t)/(Math.max(e.length,t.length)||1)}function Oc(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},(e,t)=>[t,...Array(r).fill(0)]);for(let e=0;e<=r;e+=1)i[0][e]=e;for(let a=1;a<=n;a+=1)for(let n=1;n<=r;n+=1)i[a][n]=Math.min(i[a-1][n]+1,i[a][n-1]+1,i[a-1][n-1]+(e[a-1]===t[n-1]?0:1));return i[n][r]}function kc(e,t=!1,n=!1){return(t||n)&&e.toLowerCase()===`r`}var Ac={Everyday:`常用`,"Task management":`任务管理`,"Sessions & diagnostics":`会话与诊断`,Configuration:`配置`,Other:`其他`},jc={crystalpilot:`在当前 Argus 会话启用晶体学工具,保持原生界面`,status:`查看角色、队列、日志和健康状态`,roles:`查看各角色的后端、模型、推理强度和实时活动`,journal:`查看近期日志(默认 10 条)`,backlog:`查看待处理任务(all 包含已完成和已跳过)`,artifacts:`查看 Reviewer 批准的结果文件(按 Enter 预览)`,artifact:`预览一个已批准的结果文件`,events:`搜索动态:all / watch / milestones / messages`,find:`搜索当前事件缓冲区`,cancel:`停止等待当前 Manager 回复`,ask:`直接回答,不排任务、不走 Planner/Engineer/Reviewer`,task:`直接加入任务队列`,plan:`预览 Planner 编写的执行计划`,rewrite:`让 Manager 在发送前改写提示词`,nudge:`向正在运行的任务注入指导`,abort:`立即终止正在运行的任务`,note:`向时间线添加手动备注`,done:`将任务标记为完成`,skip:`跳过任务`,stop:`停止任务的自动迭代`,item:`查看完整任务契约`,run:`返回持续更新的任务动态`,new:`检查、创建并切换到新会话`,daemons:`查找全部会话并切换或创建`,resume:`切换到其他项目或会话`,attach:`跟随其他项目并读取其动态`,rename:`重命名当前会话`,doctor:`诊断为什么没有任务运行`,backend:`查看或更改共享 Runner 后端`,config:`查看或更改运行时设置`,identity:`查看或替换操作者身份卡`,reset:`清除 Manager 的热会话上下文`,skills:`查看或提升运行时 Skill`,clear:`清空事件动态视图`,reconnect:`重新连接实时动态`,help:`查看快捷键和完整命令参考`,quit:`离开控制台(后台工作继续运行)`};function Mc(e,t){return t===`zh-CN`?jc[e.id]:e.id===`reconnect`?`reconnect live activity`:e.desc}function Nc(e,t){return t===`zh-CN`?Ac[e.group]:e.group}function Pc(e,t){let n=new Map;for(let r of e){let e=Nc(r,t),i=r.aliases?.length?` (= ${r.aliases.join(`, `)})`:``,a=`${r.name}${r.arg?` ${r.arg}`:``}${i}`;n.has(e)||n.set(e,[]),n.get(e).push({label:a,desc:Mc(r,t)})}return[...n.entries()].map(([e,t])=>({group:e,rows:t}))}var Fc=`slash-completion-listbox`;function Ic(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function Lc(e){return`slash-completion-option-${e}`}function Rc({query:e,selected:t,onSelect:n}){let{locale:r,t:i}=F(),a=xc(e);if(a.length===0)return null;let o=a.slice(0,8),s=Ic(t,o.length);return(0,K.jsx)(`div`,{id:Fc,role:`listbox`,"aria-label":i(`slash.suggestions`),className:`slash-completion-menu scroll-thin border-b border-line/40`,children:o.map((e,t)=>(0,K.jsxs)(`button`,{id:Lc(e.id),type:`button`,role:`option`,"aria-selected":t===s,onPointerDown:e=>{e.preventDefault(),n(t)},className:`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm transition-colors ${t===s?`bg-blue/10 text-ink`:`text-ink-dim hover:bg-line/20`}`,children:[(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-blue`,children:e.name}),e.arg?(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-ink-faint`,children:e.arg}):null,(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:Mc(e,r)})]},e.id))})}var zc=32e3,Bc=10485760,Vc=26214400,Hc=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.pdf`,`.md`,`.markdown`,`.txt`,`.json`,`.csv`].join(`,`),Uc={".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".webp":`image/webp`,".pdf":`application/pdf`,".md":`text/markdown`,".markdown":`text/markdown`,".txt":`text/plain`,".json":`application/json`,".csv":`text/csv`};function Wc(e){let t=String(e||``).trim().toLowerCase(),n=t.lastIndexOf(`.`);return n>=0?t.slice(n):``}function Gc(e){return Uc[Wc(e.name)]||String(e.type||``).split(`;`,1)[0].trim()||`application/octet-stream`}function Kc(e){return Object.hasOwn(Uc,Wc(e.name))}function qc(e){return Gc(e).startsWith(`image/`)}function Jc(e){return[e.name,String(e.size),Gc(e),String(e.lastModified??``)].join(`::`)}function Yc(e,t){let n=[],r=[],i=new Set(e.map(Jc)),a=e.reduce((e,t)=>e+Math.max(0,t.size||0),0),o=e.length;for(let e of t){let t=Jc(e);if(!i.has(t)){if(i.add(t),!Kc(e)){r.push({code:`unsupported`,fileName:e.name});continue}if(o>=5){r.push({code:`too-many`,limitCount:5});continue}if(e.size>10485760){r.push({code:`too-large`,fileName:e.name,limitBytes:Bc});continue}if(a+e.size>26214400){r.push({code:`too-large-total`,limitBytes:Vc});continue}n.push(e),a+=e.size,o+=1}}return{accepted:n,issues:r}}function Xc(e){return e?Array.from(e):[]}function Zc(e){return Xc(e?.types).map(e=>String(e)).includes(`Files`)||Qc(e).length>0}function Qc(e){let t=Xc(e?.files).filter(e=>e instanceof File);if(t.length)return t;let n=[];for(let t of Xc(e?.items)){if(String(t?.kind||``)!==`file`||typeof t?.getAsFile!=`function`)continue;let e=t.getAsFile();e instanceof File&&n.push(e)}return n}function $c({file:e,removeLabel:t,onRemove:n,disabled:r=!1}){let[i,a]=(0,U.useState)(``);return(0,U.useEffect)(()=>{if(!qc(e)||typeof URL>`u`||typeof URL.createObjectURL!=`function`){a(``);return}let t=URL.createObjectURL(e);return a(t),()=>URL.revokeObjectURL(t)},[e]),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-2xl border border-line/50 bg-panel/80 px-2.5 py-2 text-xs shadow-[0_10px_24px_-20px_rgb(0_0_0/0.2)]`,children:[i?(0,K.jsx)(`img`,{src:i,alt:``,className:`h-10 w-10 shrink-0 rounded-xl border border-line/40 object-cover`}):null,(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate font-medium text-ink`,title:e.name,children:e.name}),(0,K.jsxs)(`div`,{className:`truncate text-ink-faint`,children:[ct(e.size),` · `,Gc(e)]})]}),(0,K.jsx)(`button`,{type:`button`,onClick:n,disabled:r,"aria-label":t,title:t,className:`send-control h-8 w-8 shrink-0 rounded-full border-line/60 text-ink-faint hover:border-err/50 hover:bg-err/10 hover:text-err`,children:`×`})]})}function el({value:e,onChange:t,inputRef:n,fileInputRef:r,onFiles:i,inputProps:a,onSend:o,onCancel:s,pending:c,disabled:l=!1,controls:u}){let{t:d,locale:f}=F(),p=f===`zh-CN`,{refs:m,text:h}=Js(e),g=e.length>zc;return(0,U.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.getClientRects().length&&(e.style.height=`0px`,e.style.height=`${Math.min(132,Math.max(28,e.scrollHeight))}px`)};t();let r=e.clientWidth,i=new ResizeObserver(()=>{e.clientWidth!==r&&(r=e.clientWidth,t())});return i.observe(e),()=>i.disconnect()},[n,h]),(0,K.jsxs)(`div`,{className:`composer-surface`,"data-pending":c,children:[m.length>0&&(0,K.jsx)(`div`,{className:`map-reference-chips`,children:m.map((e,n)=>(0,K.jsxs)(`span`,{children:[(0,K.jsxs)(`span`,{children:[p?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":p?`移除引用`:`Remove reference`,onClick:()=>t(m.filter((e,t)=>t!==n).map(qs).join(``)+h),children:(0,K.jsx)(Ie,{size:12})})]},`${e.task_id}:${e.step_id}:${n}`))}),(0,K.jsxs)(`form`,{className:`map-composer`,onSubmit:e=>{e.preventDefault(),!c&&!l&&!g&&o()},children:[(0,K.jsx)(`input`,{ref:r,type:`file`,multiple:!0,accept:Hc,hidden:!0,disabled:l||c,onChange:i}),(0,K.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":d(`chat.attach`),title:d(`chat.attach`),disabled:l||c,onClick:()=>r.current?.click(),children:(0,K.jsx)(`span`,{"aria-hidden":`true`,children:(0,K.jsx)(_t,{size:28})})}),(0,K.jsx)(`textarea`,{...a,ref:n,rows:1,value:h,disabled:l,onChange:e=>t(m.map(qs).join(``)+e.target.value),onKeyDown:e=>{if(g&&e.key===`Enter`&&!e.shiftKey&&!fc(e)){e.preventDefault();return}a.onKeyDown?.(e),!(e.defaultPrevented||fc(e))&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),!c&&!l&&o())}}),(0,K.jsx)(`button`,{type:c?`button`:`submit`,onClick:c?s:void 0,disabled:l||!c&&(!h.trim()||g),"aria-label":c?p?`停止回复`:`Stop reply`:p?`发送消息`:`Send message`,className:`map-send ${c?`is-pending`:``}`,children:c?(0,K.jsx)(Yt,{size:15}):(0,K.jsx)(kt,{size:20})})]}),g&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:d(`chat.messageTooLong`)}),u?(0,K.jsx)(`div`,{className:`composer-controls`,children:u}):null]})}var tl=[`auto`,`task`,`chat`];function nl({value:e,onChange:t,disabled:n=!1,tabIndex:r}){let{t:i}=F(),a={auto:i(`chat.routeAuto`),task:i(`chat.routeTask`),chat:i(`chat.routeChat`)};return(0,K.jsx)(`div`,{className:`route-seg`,role:`radiogroup`,"aria-label":i(`chat.routeLabel`),title:i(`chat.routeHint`),children:tl.map(i=>(0,K.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===i,disabled:n,tabIndex:r,onClick:()=>{i!==e&&t(i)},children:a[i]},i))})}function rl(e,t){if(!t.onRewrite||!kc(e.key,e.ctrlKey,e.metaKey))return!1;e.preventDefault();let n=t.value.trim();return n&&!t.disabled&&!t.pending&&!t.rewriting&&t.onRewrite(n),!0}function il({value:e,onChange:t,onSend:n,onCancel:r,disabled:i,pending:a,focusSignal:o,attachments:s,onAttachmentsChange:c,onRewrite:l,rewriting:u=!1,slashSelection:d,onSlashSelectionChange:f,routeOverride:p=`auto`,onRouteOverrideChange:m,footer:h}){let{t:g}=F(),_=(0,U.useRef)(null),v=(0,U.useRef)(null),y=(0,U.useRef)(!1),[b,x]=(0,U.useState)(0),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(``),[E,D]=(0,U.useState)(0),[O,k]=(0,U.useState)(!1),[A,j]=(0,U.useState)(!1);(0,U.useEffect)(()=>{a||j(!1)},[a]),(0,U.useEffect)(()=>{if(!a&&!u)return;let e=setInterval(()=>x(e=>e+1),1e3);return()=>clearInterval(e)},[a,u]),(0,U.useEffect)(()=>{o&&!i&&_.current?.focus()},[o,i]);let M=xc(e).slice(0,8),N=M.length>0&&!S,P=N?Ic(d,M.length):0,I=N?M[P]:void 0,ee=e=>{let n=M[e];n&&(t(Cc(n)),n.argument===`none`&&C(!0),f(0),_.current?.focus())},te=async()=>{if(!e.trim()||i||u||y.current)return;let t=a;if(t&&s.length){T(g(`chat.attachWhileRunning`));return}y.current=!0;try{(t?await n(e.trim(),[],void 0,{whileRunning:!0}):await n(e.trim(),s))&&(f(0),C(!1),T(``),j(t))}finally{y.current=!1}},L=e=>{if(!e.length||i||a||y.current)return;let{accepted:t,issues:n}=Yc(s,e);t.length&&c([...s,...t]),T(n.map(e=>e.code===`unsupported`?g(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?g(`chat.attachTooLarge`,{name:e.fileName,size:ct(e.limitBytes)}):e.code===`too-many`?g(`chat.attachTooMany`,{count:e.limitCount}):g(`chat.attachTotalTooLarge`,{size:ct(e.limitBytes)})).join(` `))},ne=(e,t)=>{Zc(e.dataTransfer)&&(e.preventDefault(),D(e=>Math.max(0,e+t)))};return(0,K.jsxs)(`div`,{className:`conversation-composer flex flex-col ${E>0?`rounded-3xl ring-2 ring-manager/60`:``}`,"data-compact":!O&&!e.trim()&&!s.length&&!a&&!u&&!w&&!E,onFocusCapture:()=>k(!0),onBlurCapture:e=>k(e.currentTarget.contains(e.relatedTarget)),onDragEnter:e=>ne(e,1),onDragOver:e=>ne(e,0),onDragLeave:e=>ne(e,-1),onDrop:e=>{Zc(e.dataTransfer)&&(e.preventDefault(),D(0),L(Qc(e.dataTransfer)))},children:[a?(0,K.jsx)(`div`,{className:`px-3 py-2 text-xs text-ink-faint`,role:`status`,children:g(A?`chat.queuedWhileRunning`:`chat.stopWaitingHint`)}):null,N?(0,K.jsx)(Rc,{query:e,selected:P,onSelect:ee}):null,s.length||w||E>0?(0,K.jsxs)(`div`,{className:`px-3 py-2`,children:[E>0?(0,K.jsx)(`div`,{className:`mb-2 text-xs text-manager`,children:g(`chat.attachDrop`)}):null,(0,K.jsx)(`div`,{className:`map-attachment-tray`,children:s.map((e,t)=>(0,K.jsx)($c,{file:e,removeLabel:g(`chat.attachRemove`,{name:e.name}),onRemove:()=>{c(s.filter(t=>t!==e)),T(``)}},`${e.name}:${e.lastModified}:${t}`))}),(0,K.jsx)(`div`,{className:`text-xs ${w?`text-err`:`text-ink-faint`}`,children:w||g(`chat.attachHint`,{count:5,perFile:ct(10485760),total:ct(26214400)})})]}):null,(0,K.jsx)(el,{value:e,onChange:e=>{t(e),f(0),C(!1)},inputRef:_,fileInputRef:v,onFiles:e=>{L(Array.from(e.target.files??[])),e.target.value=``},onSend:()=>void te(),onCancel:r,pending:a,disabled:i,inputProps:{onPaste:e=>{let t=Qc(e.clipboardData);t.length&&(e.preventDefault(),L(t))},onKeyDown:t=>{fc(t)||rl(t,{value:e,disabled:i,pending:a,rewriting:u,onRewrite:l})||(N?t.key===`ArrowDown`||t.key===`ArrowUp`?(t.preventDefault(),f(Ic(P+(t.key===`ArrowDown`?1:-1),M.length))):t.key===`Tab`||t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),ee(P)):t.key===`Escape`&&(t.preventDefault(),C(!0)):t.key===`Escape`&&a?(t.preventDefault(),r()):t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),te()))},"aria-label":g(`chat.messageArgus`),"aria-keyshortcuts":`Control+R Meta+R`,"aria-controls":N?Fc:void 0,"aria-expanded":N,"aria-activedescendant":I?Lc(I.id):void 0,placeholder:g(i?`chat.selectSession`:`chat.placeholder`)},controls:(0,K.jsxs)(K.Fragment,{children:[m?(0,K.jsx)(nl,{value:p,onChange:m,disabled:i||a}):null,l&&e.trim()?(0,K.jsx)(`button`,{type:`button`,onClick:()=>l(e.trim()),disabled:i||a||u,title:`Ctrl/⌘+R · ${g(`chat.rewriteHint`)}`,"aria-label":g(`chat.rewriteLabel`),"aria-keyshortcuts":`Control+R Meta+R`,children:u?`${mc(b)} ${g(`chat.rewriting`)}`:g(`chat.rewrite`)}):null]})}),h]})}function al(e,t,n,r=`en`){return e.map(e=>({id:`command-${e.id}`,label:Mc(e,r),hint:`${e.name}${e.arg?` ${e.arg}`:``}`,group:Nc(e,r),keywords:[e.name,...e.aliases??[]].join(` `),run:()=>_c(e)?n(`${e.name} `):t(e.name)}))}function ol(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=`${e.label} ${e.group} ${e.hint??``} ${e.keywords??``}`.toLowerCase();return n.every(e=>t.includes(e))}):e}function sl({open:e,onClose:t,items:n}){let{t:r}=F(),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(0),c=(0,U.useRef)(null),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{e&&(a(``),s(0),setTimeout(()=>c.current?.focus(),0))},[e]);let u=(0,U.useMemo)(()=>ol(n,i),[i,n]);(0,U.useEffect)(()=>{o>=u.length&&s(Math.max(0,u.length-1))},[u.length,o]),(0,U.useEffect)(()=>{l.current?.scrollIntoView({block:`nearest`})},[e,i,o]);let d=e=>{e&&(t(),e.run())},f=e=>{fc(e)||(e.key===`ArrowDown`?(e.preventDefault(),u.length&&s(e=>Math.min(u.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),d(u[o])))},p=[];for(let e of u){let t=p.find(t=>t.name===e.group);t||(t={name:e.group,items:[]},p.push(t)),t.items.push(e)}let m=-1;return(0,K.jsxs)(tt,{open:e,onClose:t,label:r(`help.palette`),width:`max-w-xl`,align:`top`,children:[(0,K.jsx)(`div`,{className:`border-b border-line px-4 py-3`,children:(0,K.jsx)(`input`,{ref:c,value:i,onChange:e=>a(e.target.value),onKeyDown:f,placeholder:r(`palette.placeholder`),role:`combobox`,"aria-expanded":e,"aria-autocomplete":`list`,"aria-controls":`command-palette-results`,"aria-activedescendant":u[o]?`palette-${u[o].id}`:void 0,className:`w-full bg-transparent font-mono text-sm text-ink outline-none placeholder:text-ink-faint`})}),(0,K.jsxs)(`div`,{id:`command-palette-results`,role:`listbox`,className:`max-h-[52vh] overflow-y-auto scroll-thin py-1.5`,children:[u.length===0&&(0,K.jsx)(`div`,{className:`px-4 py-6 text-center text-xs text-ink-faint`,children:r(`palette.noMatches`)}),p.map(e=>(0,K.jsxs)(`div`,{className:`mb-1`,children:[(0,K.jsx)(`div`,{className:`px-4 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.name}),e.items.map(e=>{m++;let t=m===o;return(0,K.jsxs)(`button`,{id:`palette-${e.id}`,ref:t?l:void 0,role:`option`,"aria-selected":t,onMouseEnter:()=>s(u.indexOf(e)),onClick:()=>d(e),className:`flex w-full items-center justify-between px-4 py-1.5 text-left text-sm transition-colors ${t?`bg-blue-deep/20 text-ink`:`text-ink-dim hover:bg-panel/60`}`,children:[(0,K.jsx)(`span`,{children:e.label}),e.hint&&(0,K.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:e.hint})]},e.id)})]},e.name))]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-4 py-1.5 text-[10px] text-ink-faint`,children:[(0,K.jsx)(`span`,{children:r(`palette.navigate`)}),(0,K.jsx)(`span`,{children:r(`palette.run`)}),(0,K.jsx)(`span`,{children:r(`palette.close`)})]})]})}var cl=[{keys:`⌘K / Ctrl+K`,desc:`help.palette`},{keys:`⌘B / Ctrl+B`,desc:`help.sessions`},{keys:`⌘J / Ctrl+J`,desc:`help.managerChat`},{keys:`⌘R / Ctrl+R`,desc:`help.rewrite`},{keys:`⌘T / Ctrl+T`,desc:`help.reasoning`},{keys:`⌘. / Ctrl+.`,desc:`help.kiosk`},{keys:`/`,desc:`help.composer`},{keys:`↵ Enter`,desc:`help.send`},{keys:`Shift+Enter`,desc:`help.newline`},{keys:`?`,desc:`help.thisHelp`},{keys:`Esc`,desc:`help.escape`}];function ll({open:e,onClose:t}){let{locale:n,t:r}=F(),i=Pc(hc,n);return(0,K.jsxs)(tt,{open:e,onClose:t,label:r(`help.title`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:r(`help.title`)}),(0,K.jsxs)(`div`,{className:`max-h-[70dvh] overflow-y-auto scroll-thin`,children:[(0,K.jsx)(`div`,{className:`p-4`,children:cl.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center justify-between py-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm text-ink-dim`,children:r(e.desc)}),(0,K.jsx)(`kbd`,{className:`rounded border border-line bg-surface px-2 py-0.5 font-mono text-[11px] text-ink`,children:e.keys})]},e.keys))}),(0,K.jsxs)(`div`,{className:`border-t border-line px-4 pb-4 pt-3`,children:[(0,K.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-ink-faint`,children:r(`help.commands`)}),i.map(e=>(0,K.jsxs)(`div`,{className:`mb-4`,children:[(0,K.jsx)(`p`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.group}),e.rows.map(e=>(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1`,children:[(0,K.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-ink`,children:e.label}),(0,K.jsx)(`span`,{className:`text-right text-xs text-ink-dim`,children:e.desc})]},e.label))]},e.group))]})]})]})}var ul=[[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]];function dl({sid:e,config:t,onSaved:n}){let{locale:r}=F(),i=r===`zh-CN`,a=t.roles.find(e=>e.role===`manager`),o=t.roles.find(e=>e.role===`engineer`),s=a&&a.backend!==`memory`?a:o,c=new Map(t.operator_knobs.map(e=>[e.name,e.value])),l=c.get(`ARGUS_SKILL_MAP_MODEL`)||`auto`,[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(``),m=(t.model_options??[]).map(e=>e.model);l!==`auto`&&!m.includes(l)&&m.unshift(l);let h=async(t,r)=>{if(!u){d(!0),p(``);try{await P.setConfig(e,t,r),await n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},g=i?`自动(轻量)`:`Auto (light)`,_=i?`跟随前台模型`:`Follow the front-door model`,v=[{name:`ARGUS_SKILL_MAP_REASONING_EFFORT`,label:i?`讲解生成强度`:`Explanation effort`,follow:g},{name:`ARGUS_SKILL_MAP_REVIEW_REASONING_EFFORT`,label:i?`讲解复核强度`:`Explanation review effort`,follow:i?`自动(中)`:`Auto (medium)`}];return(0,K.jsxs)(`section`,{className:`map-model-settings rounded-lg border border-line glass-card p-3`,"aria-label":i?`地图模型`:`Map model`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:i?`地图模型`:`Map model`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:i?`地图讲解与摘要用的模型;默认沿用前台(经理)的接入与账号,以低强度起草,不占用科研的推理预算。可以选一个便宜的。`:`The model that writes map explanations and summaries. By default it uses the front-door (Manager) runner and account at a light effort, not the research budget. A cheaper one is fine.`}),(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[s?.backend_label,` · `,s?.model||(i?`接入默认模型`:`Runner default model`)]}),t.map_model?.note&&(0,K.jsx)(`p`,{role:`status`,"data-map-model-note":!0,className:`mt-1 text-xs text-warn`,children:i?`已改用自动:所选摘要模型在当前接入(${t.map_model.backend})下不可用。`:t.map_model.note}),(0,K.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[i?`摘要模型`:`Summary model`,(0,K.jsxs)(`select`,{value:l,disabled:u,"aria-label":i?`摘要模型`:`Summary model`,onChange:e=>void h(`ARGUS_SKILL_MAP_MODEL`,e.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,K.jsx)(`option`,{value:`auto`,children:_}),m.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]}),v.map(e=>(0,K.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[e.label,(0,K.jsxs)(`select`,{value:c.get(e.name)||`auto`,disabled:u,onChange:t=>void h(e.name,t.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`,children:[(0,K.jsx)(`option`,{value:`auto`,children:e.follow}),ul.map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:i?t:e},e))]})]},e.name)),(0,K.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`复核用于检查讲解文字,保存后对新发起的讲解生效。`:`The review checks explanation text. Changes apply to newly requested explanations.`}),f&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:f})]})}function fl({sid:e,primaryModel:t}){let{locale:n}=F(),r=n===`zh-CN`,i=(e,t)=>r?e:t,a=S(),o=x({queryKey:[`advisor-settings`,e],queryFn:({signal:t})=>P.advisorSettings(e,t),enabled:!!e,retry:!1}),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(``),[h,g]=(0,U.useState)(!1),_=(0,U.useRef)(e);_.current=e,(0,U.useEffect)(()=>{c(o.data?.saved??null);let e=o.data?.saved;u(!!(e?.model&&!o.data?.model_options?.some(t=>t.backend===e.backend&&t.model===e.model)))},[e,o.data]),(0,U.useEffect)(()=>{m(``),g(!1),f(!1)},[e]);let v=e=>{c(t=>t&&{...t,...e}),g(!1)},y=o.data?.model_options??[],b=(e,t)=>JSON.stringify([e,t]),C=s&&y.some(e=>e.backend===s.backend&&e.model===s.model)?b(s.backend,s.model):``,w=async()=>{if(!s||d)return;let t=e;f(!0),m(``),g(!1);try{let{schema_version:e,...n}=s,r=await P.saveAdvisorSettings(t,{...n,model:n.model.trim()});a.setQueryData([`advisor-settings`,t],r),_.current===t&&g(!0)}catch(e){_.current===t&&m(e instanceof Error?e.message:String(e))}finally{_.current===t&&f(!1)}};return(0,K.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,"aria-label":i(`顾问模型`,`Advisor model`),children:[(0,K.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`顾问模型`,`Advisor model`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:i(`团队遇到难题时可以向它提问。只在咨询时调用,用量计入当前项目。`,`The team can consult this model on specific questions. It runs only when asked, and usage belongs to this project.`)}),t?(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[i(`当前执行模型:`,`Current execution model: `),t]}):null,o.isPending?(0,K.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-ink-faint`,children:i(`正在读取设置…`,`Loading settings…`)}):o.isError?(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-err`,role:`alert`,children:[i(`顾问设置读取失败。`,`Could not load advisor settings.`),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void o.refetch(),className:`underline`,children:i(`重试`,`Retry`)})]}):s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:s.enabled,disabled:d,onChange:e=>v({enabled:e.target.checked})}),i(`允许团队咨询顾问`,`Let the team consult the advisor`)]}),(0,K.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[y.length>0?(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim sm:col-span-2`,children:[i(`顾问使用的模型`,`Advisor model`),(0,K.jsxs)(`select`,{"aria-label":i(`选择顾问模型`,`Choose advisor model`),value:l?`custom`:C,disabled:d,onChange:e=>{if(e.target.value===`custom`){u(!0);return}let t=y.find(t=>b(t.backend,t.model)===e.target.value);t&&(u(!1),v({backend:t.backend,model:t.model}))},className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,K.jsx)(`option`,{value:``,disabled:!0,children:i(`选择模型`,`Choose a model`)}),y.map(e=>(0,K.jsx)(`option`,{value:b(e.backend,e.model),children:e.model},b(e.backend,e.model))),(0,K.jsx)(`option`,{value:`custom`,children:i(`配置其他模型…`,`Configure another model…`)})]})]}):null,l||y.length===0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`接入`,`Runner`),(0,K.jsxs)(`select`,{"aria-label":i(`顾问接入`,`Advisor runner`),value:s.backend,disabled:d,onChange:e=>v({backend:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,K.jsx)(`option`,{value:``,children:i(`选择接入`,`Choose a runner`)}),o.data?.supported_backends.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]}),(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`顾问使用的模型`,`Advisor model ID`),(0,K.jsx)(`input`,{value:s.model,disabled:d,onChange:e=>v({model:e.target.value}),placeholder:i(`填写该接入的模型标识`,`Model ID for this runner`),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}):null,(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`思考强度`,`Reasoning effort`),(0,K.jsxs)(`select`,{"aria-label":i(`顾问思考强度`,`Advisor reasoning effort`),value:s.effort,disabled:d,onChange:e=>v({effort:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,K.jsx)(`option`,{value:``,children:i(`模型默认`,`Model default`)}),[[`minimal`,`最低`],[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]].map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:r?t:e},e))]})]}),(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`每次角色调用最多咨询`,`Consultations per role call`),(0,K.jsx)(`input`,{type:`number`,min:1,max:20,value:s.max_calls_per_turn,disabled:d,onChange:e=>v({max_calls_per_turn:Number(e.target.value)}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}),o.data?.overridden_fields.length?(0,K.jsxs)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:[i(`运行服务另有指定设置;当前顾问:`,`The runtime overrides some saved settings. Current advisor: `),o.data.config.enabled?`${o.data.config.backend} · ${o.data.config.model}`:i(`未启用`,`disabled`)]}):null,(0,K.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:d||s.enabled&&(!s.backend||!s.model.trim()),className:`rounded border border-line px-3 py-2 text-xs text-ink hover:border-blue disabled:opacity-40`,children:d?i(`保存中…`,`Saving…`):i(`保存顾问设置`,`Save advisor settings`)}),h?(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-ink-dim`,children:i(`已保存,下次咨询生效。`,`Saved for the next consultation.`)}):null]}),p?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:p}):null]}):null]})}var pl=[/^\[?\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[.,]\d+)?(?:Z|[+-]\d{2}:?\d{2})?\]?\s*/,/^\[?(?:INFO|WARNING|WARN|ERROR|DEBUG|CRITICAL|TRACE)\]?\s*[:\-|]?\s*/i,/^(?:\[\d+\]|[\w.]+:)\s+/];function ml(e){let t=e.trim();for(let e of pl)t=t.replace(e,``);return t.trim()}var hl=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`;function gl(e,t=200){let n=String(e??``).split(/\r?\n/).map(ml).filter(e=>e&&!/^[-=_.\s]+$/.test(e));return n.length?hl(n[n.length-1],t):``}var _l=[{name:`ARGUS_SKILL_MAX_ACTIVE_DAEMONS`,group:`Limits`,label:`Active daemon limit`,description:`Maximum background sessions running on this host.`},{name:`ARGUS_SKILL_SAFE_MODE`,group:`Safety`,label:`Safe mode`,description:`Enable extra-conservative runtime guardrails.`},{name:`ARGUS_SKILL_OPERATOR_AVAILABLE`,group:`Safety`,label:`Operator available`,description:`Off suppresses operator questions: Argus decides on recorded assumptions.`},{name:`ARGUS_SKILL_ENABLE_TELEGRAM`,group:`Interface`,label:`Telegram`,description:`Enable the Telegram notification bridge.`},{name:`ARGUS_SKILL_SHOW_REASONING`,group:`Interface`,label:`Show reasoning`,description:`Stream role reasoning into the cockpit activity view.`}];function vl(e){let t=new Map(e.map(e=>[e.name,e]));return _l.flatMap(e=>{let n=t.get(e.name);return n?[{...n,group:e.group,label:e.label,doc:e.description}]:[]})}function yl(e,t){let n=new URL(e),r=n.protocol===`https:`?`wss:`:`ws:`,i=encodeURIComponent(t);return{webApi:`${n.origin}/api`,eventStream:`${r}//${n.host}/api/projects/${i}/stream`,daemon:`local process · events.jsonl · no TCP port`}}var bl=`ARGUS_SKILL_OPERATOR_AVAILABLE`,xl=new Set([`0`,`false`,`no`,`off`,`disable`,`disabled`]);function Sl(e){let t=(e??[]).find(e=>e.name===bl);return!!(t&&xl.has(t.value.trim().toLowerCase()))}function Cl(e){return e instanceof j?e.code===`trial_route_unavailable`||e.status===403||e.status===404:!1}function wl(e,t){let n=Cl(e);return{text:t(n?`operations.unavailableHere`:`operations.requestFailed`),technical:e instanceof Error?e.message:String(e||``),refused:n}}var Tl={ARGUS_SKILL_MAX_ACTIVE_DAEMONS:{label:`settings.knob.activeDaemons`,doc:`settings.knob.activeDaemonsDoc`},ARGUS_SKILL_SAFE_MODE:{label:`settings.knob.safeMode`,doc:`settings.knob.safeModeDoc`},ARGUS_SKILL_OPERATOR_AVAILABLE:{label:`settings.knob.operatorAvailable`,doc:`settings.knob.operatorAvailableDoc`},ARGUS_SKILL_ENABLE_TELEGRAM:{label:`settings.knob.telegram`,doc:`settings.knob.telegramDoc`},ARGUS_SKILL_SHOW_REASONING:{label:`settings.knob.showReasoning`,doc:`settings.knob.showReasoningDoc`}},El={Limits:`settings.group.limits`,Safety:`settings.group.safety`,Interface:`settings.group.interface`};function Dl(e,t){let n=e.trim();return n===`not applicable for this model`?t(`settings.source.notApplicable`):n.startsWith(`capability vault`)?t(`settings.source.vaultDefault`):n.startsWith(`default`)?t(`settings.source.default`):n.startsWith(`persisted:`)||n===`persisted`?t(`settings.source.saved`):n.startsWith(`ARGUS_SKILL_`)||n===`env`?t(`settings.source.environment`):n.startsWith(`global:`)?t(`settings.source.hostConfig`):t(`settings.source.other`)}function Ol(e,t){let n=e.value.trim().toLowerCase();return[`ARGUS_SKILL_SAFE_MODE`,`ARGUS_SKILL_OPERATOR_AVAILABLE`,`ARGUS_SKILL_ENABLE_TELEGRAM`,`ARGUS_SKILL_SHOW_REASONING`].includes(e.name)?t([`1`,`true`,`on`,`yes`].includes(n)?`settings.value.enabled`:`settings.value.disabled`):e.value}function kl(e,t){let n={low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`}[e.toLowerCase()];return n?t(`settings.effort.${n}`):e}function Al({message:e,retrying:t,onRetry:n,t:r}){return(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 px-4 py-8 text-center`,children:[(0,K.jsx)(`p`,{className:`text-sm text-err`,children:e}),(0,K.jsx)(`button`,{type:`button`,onClick:n,disabled:t,className:`rounded-md border border-err/40 px-3 py-1.5 text-xs font-medium text-err hover:bg-err/10 disabled:opacity-40`,children:r(t?`common.loading`:`common.retry`)})]})}function jl({sid:e,open:t,onClose:n}){let{t:r}=F(),{data:i,isLoading:a,isError:o,isFetching:s,refetch:c}=oe(e,t),l=!!(i&&(i.recommended||i.checks.length||i.log_tail.trim()));return(0,K.jsxs)(tt,{open:t,onClose:n,label:r(`doctor.title`),width:`max-w-3xl`,children:[(0,K.jsx)(Qe,{title:r(`doctor.title`),sub:r(`doctor.subtitle`)}),(0,K.jsxs)(`div`,{className:`p-4`,children:[a&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),!a&&o&&(0,K.jsx)(Al,{message:r(`doctor.loadError`),retrying:s,onRetry:()=>void c(),t:r}),!a&&!o&&!l&&(0,K.jsx)(Ve,{children:r(`doctor.empty`)}),!a&&!o&&i?.recommended&&(0,K.jsxs)(`div`,{className:`mb-4 rounded-lg border border-gold/40 bg-gold/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-gold`,children:r(`doctor.recommended`)}),(0,K.jsx)(`div`,{className:`mt-1 text-sm text-ink`,children:i.recommended.name}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:i.recommended.detail}),i.recommended.fix&&(0,K.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap break-words rounded bg-bg p-2 font-mono text-xs text-blue-sky`,children:i.recommended.fix})]}),!a&&!o&&(0,K.jsx)(`div`,{className:`space-y-1.5`,children:(i?.checks??[]).map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-line/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:e.ok?`text-ok`:`text-err`,children:e.ok?`✓`:`✗`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.name}),e.detail&&(0,K.jsx)(`div`,{className:`mt-0.5 text-[11px] text-ink-dim`,children:e.detail}),!e.ok&&e.fix&&(0,K.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words rounded bg-bg p-1.5 font-mono text-xs text-ink-dim`,children:e.fix})]})]},t))}),!a&&!o&&i?.log_tail?.trim()&&(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`doctor.daemonLog`)}),(0,K.jsxs)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:[(0,K.jsxs)(`span`,{className:`text-ink-faint`,children:[r(`doctor.lastEntry`),` · `]}),gl(i.log_tail)]}),(0,K.jsx)(nt,{children:(0,K.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:i.log_tail})})]})]})]})}function Ml({sid:e,open:t,onClose:n}){let{t:i}=F(),a=S(),{data:o,isLoading:c,isError:u,isFetching:d,refetch:f}=xe(e,t),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(``),[y,b]=(0,U.useState)(!1),[x,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(``),[O,k]=(0,U.useState)(``),[A,j]=(0,U.useState)(!1),[M,N]=(0,U.useState)(``);(0,U.useEffect)(()=>{t||m(!1)},[t]),(0,U.useEffect)(()=>{!t||!o||(g(o.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MODEL`)?.value??``),v(``))},[o,t]);let I=async()=>{await f(),await a.invalidateQueries({queryKey:[`map-copy`]})},ee=$n(o),te=er(o),L=tr(o),ne=e=>!e||(L?Zn(L)===e:e===Zn(ee)),re=_||Zn(ee),ie=async t=>{if(!(y||ne(t))){b(!0),C(``),T(!1);try{await P.setConfig(e,`ARGUS_SKILL_RUNNER_BACKEND`,t),await I(),C(i(`settings.backendSwitched`,{backend:Qn(t,i)}))}catch(e){T(!0),C(wl(e,i).text)}finally{b(!1)}}},ae=async t=>{if(!y){b(!0),C(``),T(!1);try{await P.setConfig(e,`ARGUS_SKILL_MAP_MODEL`,t||`auto`),await I(),C(t&&t!==`auto`?i(`settings.mapModelSet`,{model:t}):i(`settings.mapModelFollows`))}catch(e){T(!0),C(wl(e,i).text)}finally{b(!1)}}},oe=async()=>{if(!y){b(!0),C(``),T(!1);try{let t=h.trim()||`auto`;await P.setConfig(e,`ARGUS_SKILL_MODEL`,t,!0),await I(),C(i(`settings.modelAppliedToRoles`,{model:t}))}catch(e){T(!0),C(wl(e,i).text)}finally{b(!1)}}},se=async t=>{if(t.preventDefault(),!(!E.trim()||!O.trim()||A)){j(!0),N(``);try{await P.setConfig(e,E.trim(),O.trim()),await I(),N(i(`settings.applied`))}catch(e){N(wl(e,i).text)}finally{j(!1)}}},ce=vl(o?.operator_knobs??[]).reduce((e,t)=>((e[t.group]??=[]).push(t),e),{}),le=yl(window.location.origin,e),ue=!!(o&&(o.roles.length||o.operator_knobs.length));return(0,K.jsxs)(tt,{open:t,onClose:n,label:i(`common.settings`),width:`max-w-4xl`,children:[(0,K.jsx)(Qe,{title:i(`common.settings`),sub:i(`settings.subtitle`)}),(0,K.jsxs)(`div`,{className:`p-4`,children:[c&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),!c&&u&&(0,K.jsx)(Al,{message:i(`settings.loadError`),retrying:d,onRetry:()=>void f(),t:i}),!c&&!u&&!ue&&(0,K.jsx)(Ve,{children:i(`settings.empty`)}),!c&&!u&&ue&&o&&(0,K.jsxs)(`div`,{className:`space-y-4`,children:[!o.trial_mode&&(0,K.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:i(`settings.quickConfig`)}),(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:i(`settings.backend`)}),(0,K.jsxs)(`select`,{value:_||Zn(ee),disabled:y,onChange:e=>v(e.target.value),"aria-label":i(`settings.backend`),className:`h-8 min-w-44 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[Zn(ee)?null:(0,K.jsx)(`option`,{value:``,disabled:!0,children:ee?i(`settings.backendUnsupported`,{backend:ee}):i(`settings.backendUnavailable`)}),Yn.map(e=>(0,K.jsx)(`option`,{value:e.value,children:i(e.label)},e.value))]}),(0,K.jsx)(`button`,{type:`button`,"data-apply-backend":!0,onClick:()=>{re&&ie(re)},disabled:y||ne(re),className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:i(`settings.applyModel`)}),te&&(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,"data-backend-source":te,children:i(`settings.backendSource.${te}`)}),!ne(re)&&(0,K.jsx)(`span`,{className:`text-[10px] text-ink-dim`,"data-backend-change":!0,children:L?i(`settings.backendWillReplace`,{saved:Qn(L,i),backend:Qn(re,i)}):i(`settings.backendWillSave`,{backend:Qn(re,i)})})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:i(`settings.model`)}),(0,K.jsxs)(`select`,{value:h||`auto`,onChange:e=>g(e.target.value===`auto`?``:e.target.value),"aria-label":i(`settings.model`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,K.jsx)(`option`,{value:`auto`,children:o.model_auto_resolves_to?`auto → ${o.model_auto_resolves_to}`:i(`settings.modelPlaceholder`)}),(()=>{let e=o.model_options??[],t=new Set(e.filter(e=>e.invalid).map(e=>e.model)),n=e.map(e=>e.model),r=h.trim();return r&&r!==`auto`&&!n.includes(r)&&(n.unshift(r),t.add(r)),n.map(e=>(0,K.jsx)(`option`,{value:e,children:t.has(e)?`${e} (${i(`settings.modelUnavailable`)})`:e},e))})()]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void oe(),disabled:y,className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:i(`settings.applyModel`)})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:i(`settings.mapModel`)}),(0,K.jsxs)(`select`,{value:o.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||`auto`,disabled:y,onChange:e=>void ae(e.target.value),"aria-label":i(`settings.mapModel`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[(0,K.jsx)(`option`,{value:`auto`,children:i(`settings.mapModelFollows`)}),(()=>{let e=(o.model_options??[]).map(e=>e.model),t=o.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||``;return t&&t!==`auto`&&!e.includes(t)&&e.unshift(t),e.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})()]})]}),(o.model_options??[]).some(e=>e.offline)&&(0,K.jsx)(`p`,{className:`mt-1 text-[10px] text-ink-faint`,"data-model-offline":!0,children:i(`settings.modelOfflineList`)}),o.roles.some(e=>e.model&&h.trim()&&e.model!==h.trim())&&(0,K.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-ink-faint`,"data-role-models":!0,children:[i(`settings.rolesRunning`),` `,o.roles.map(e=>`${e.role} · ${e.model||`auto`}`).join(`,`),` — `,i(`settings.applyUnifies`)]}),x&&(0,K.jsx)(`div`,{role:w?`alert`:`status`,className:`mt-1.5 text-[10px] ${w?`text-err`:`text-ink-dim`}`,children:x})]}),o.trial_mode&&(0,K.jsx)(`section`,{className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,"aria-label":i(`settings.trialAccount`),children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`settings.trialAccount`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:`GPT-5.5 · high`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:i(`settings.trialKeyHint`)})]}),lr()&&(0,K.jsx)(`button`,{type:`button`,className:`compact-control px-3 py-2`,onClick:()=>{n(),ur()},children:i(`settings.changeTrialKey`)})]})}),p&&(0,K.jsx)(dl,{sid:e,config:o,onSaved:I}),p&&(0,K.jsx)(fl,{sid:e,primaryModel:o.roles.find(e=>e.role===`engineer`)?.model}),(0,K.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface/50`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":p,"aria-controls":`config-advanced-settings`,onClick:()=>m(e=>!e),className:`flex w-full items-center justify-between gap-3 px-3 py-3 text-left hover:bg-bg/30`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`block text-xs font-semibold text-ink`,children:i(`settings.advanced`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-ink-faint`,children:i(`settings.advancedHint`)})]}),(0,K.jsx)(s,{icon:r,className:`text-xs text-ink-faint transition-transform ${p?`rotate-180`:``}`})]}),p&&(0,K.jsxs)(`div`,{id:`config-advanced-settings`,className:`space-y-4 border-t border-line/70 p-3`,children:[(0,K.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:i(`settings.connection`)}),(0,K.jsxs)(`div`,{className:`mt-2 grid gap-2 text-[10px] sm:grid-cols-[100px_minmax(0,1fr)]`,children:[(0,K.jsx)(`span`,{className:`text-ink-faint`,children:i(`settings.webApi`)}),(0,K.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:le.webApi}),(0,K.jsx)(`span`,{className:`text-ink-faint`,children:i(`settings.eventStream`)}),(0,K.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:le.eventStream}),(0,K.jsx)(`span`,{className:`text-ink-faint`,children:i(`settings.taskDaemon`)}),(0,K.jsx)(`span`,{className:`text-ink-dim`,children:i(`settings.taskDaemonValue`)})]})]}),(0,K.jsxs)(`form`,{onSubmit:e=>void se(e),className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-blue`,children:i(`settings.overrideTitle`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-[10px] text-ink-faint`,children:i(`settings.overrideHint`)}),(0,K.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,K.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),placeholder:i(`settings.namePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,K.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:i(`settings.valuePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,K.jsx)(`button`,{disabled:A||!E.trim()||!O.trim(),title:i(`settings.applyAdvanced`),"aria-label":i(`settings.applyAdvanced`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:A?`…`:(0,K.jsx)(s,{icon:l})})]}),M?(0,K.jsx)(`div`,{className:`mt-2 text-xs text-ink-dim`,children:M}):null]}),o.roles.length>0&&(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:i(`settings.rolesTitle`)}),(0,K.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:o.roles.map(e=>(0,K.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:e.role===`curator`?i(`settings.role.curator`):yn(e.role,i)}),(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.backend_label})]}),(0,K.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px] text-ink-dim`,title:e.model,children:e.model}),(0,K.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-ink-faint`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:Dl(e.model_source,i)}),e.reasoning_effort&&(0,K.jsx)(`span`,{className:`ml-auto shrink-0`,style:{color:ze(e.reasoning_effort)},children:kl(e.reasoning_effort,i)})]}),(ot(e.role)||e.role===`curator`)&&(0,K.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-ink-faint`,children:ot(e.role)?Re(e.role,i):i(`settings.role.curatorDoc`)})]},e.role))})]}),Object.keys(ce).length>0&&(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:i(`settings.rawConfig`)}),Object.entries(ce).map(([e,t])=>(0,K.jsxs)(`div`,{className:`mt-3 first:mt-0`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:i(El[e])}),(0,K.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-line`,children:t.map((e,t)=>{let n=Tl[e.name],r=Ol(e,i);return(0,K.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] ${t?`border-t border-line/60`:``}`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-ink-dim`,children:i(n.label)}),(0,K.jsx)(`code`,{className:`mt-0.5 block break-all text-[9px] text-ink-faint`,children:e.name}),(0,K.jsx)(`div`,{className:`mt-1 text-[10px] leading-relaxed text-ink-faint`,children:i(n.doc)})]}),(0,K.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,K.jsxs)(`div`,{className:`text-[11px] text-ink`,children:[r,r!==e.value&&(0,K.jsxs)(`code`,{className:`ml-1 text-[9px] text-ink-faint`,children:[`(`,e.value,`)`]})]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Dl(e.source,i)})]})]},e.name)})})]},e))]}),(0,K.jsxs)(`p`,{className:`text-[10px] text-ink-faint`,children:[i(`settings.footer`),` `,(0,K.jsx)(`code`,{children:`argus --config-help`}),`.`]})]})]})]})]})]})}function Nl({sid:e,open:t,onClose:n}){let{t:r}=F(),{data:i,isLoading:a,refetch:o}=Ce(e,t),[c,l]=(0,U.useState)(``),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(``);(0,U.useEffect)(()=>{t&&i!=null&&l(i)},[i,t]);let h=async()=>{if(!d){f(!0),m(``);try{await P.setIdentity(e,c),await o(),m(r(`identity.saved`))}catch(e){m(wl(e,r).text)}finally{f(!1)}}};return(0,K.jsxs)(tt,{open:t,onClose:n,label:r(`identity.title`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:r(`identity.title`),sub:r(`identity.subtitle`)}),(0,K.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-5`,children:[a&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),a?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),rows:12,className:`w-full resize-y rounded-lg border border-line bg-bg p-3 font-sans text-sm leading-relaxed text-ink outline-none focus:border-blue`,placeholder:r(`identity.placeholder`)}),(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:d||c===(i??``),title:r(`identity.save`),"aria-label":r(`identity.save`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:d?`…`:(0,K.jsx)(s,{icon:u})})]})]})]})]})}function Pl({sid:e,open:t,onClose:n}){let{t:r}=F(),{data:i,isLoading:a}=le(e,t),o=i??[];return(0,K.jsxs)(tt,{open:t,onClose:n,label:r(`transcript.title`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:r(`transcript.title`),sub:r(`transcript.subtitle`)}),(0,K.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-4`,children:[a&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),!a&&o.length===0&&(0,K.jsx)(Ve,{children:r(`transcript.empty`)}),o.map((e,t)=>{let n=e.role===`operator`;return(0,K.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)] border-b border-line/50 py-2.5 last:border-b-0`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`font-mono text-[10px] font-semibold uppercase tracking-wide ${n?`text-ink-faint`:`text-blue-sky`}`,children:n?r(`transcript.operator`):`argus`}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:mt(e.ts)})]}),(0,K.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink-dim`,children:e.text})]},t)})]})]})}function Fl({card:e}){let{t,locale:n}=F(),r=typeof e.asked_at==`number`&&Number.isFinite(e.asked_at)&&e.asked_at>0?new Date(e.asked_at*1e3):null,i=e.task_status?.startsWith(`paused`);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] text-ink-faint`,"data-decision-task":e.item_id,children:[e.task_title?(0,K.jsx)(`span`,{className:`min-w-0 basis-full break-words text-xs leading-relaxed text-ink-dim`,title:e.task_title,children:t(`decision.taskName`,{title:e.task_title})}):null,e.kind!==`domain_intake`&&e.is_current_task!=null?(0,K.jsx)(`span`,{children:t(e.is_current_task?`decision.currentTask`:`decision.otherTask`)}):null,(0,K.jsx)(Je,{children:t(`decision.awaitingReply`)}),e.task_status?(0,K.jsx)(`span`,{children:i?t(`label.status.paused`):vn(e.task_status,t)}):null,r&&!Number.isNaN(r.getTime())?(0,K.jsx)(`time`,{dateTime:r.toISOString(),title:r.toLocaleString(n),children:t(`decision.askedAt`,{time:H(r,n)})}):null]})}function Il({questions:e,backlog:t,currentTaskId:n,onAnswer:r,onLocate:i}){let{t:a}=F(),o=kr(e,t,n);if(!o.length)return null;let s=o[0];return(0,K.jsxs)(`div`,{className:`mb-2 flex min-h-11 items-center gap-3 rounded-md border border-gold/40 bg-gold/5 px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s.title===s.task_title?null:(0,K.jsx)(`div`,{className:`truncate text-xs font-medium text-gold`,title:s.title,children:s.title}),(0,K.jsx)(Fl,{card:s}),(0,K.jsx)(`div`,{className:`truncate text-xs text-ink-dim`,title:s.reason||s.question,children:s.reason||s.question})]}),o.length>1?(0,K.jsxs)(`span`,{className:`font-mono text-xs text-ink-faint`,children:[`+`,o.length-1]}):null,i&&s.item_id?(0,K.jsx)(`button`,{onClick:()=>i(s.item_id),className:`shrink-0 text-xs text-ink-dim hover:text-gold`,children:a(`pending.showOnMap`)}):null,(0,K.jsx)(`button`,{onClick:r,className:`shrink-0 text-xs font-medium text-gold hover:text-gold-soft`,children:a(`pending.reviewRespond`)})]})}function Ll({reply:e,open:t,busy:n,onClose:r,onSubmit:i,error:a=``}){let{t:o,locale:s}=F(),c=s===`zh-CN`,l=(0,U.useMemo)(()=>e?.options[0]?.id??`custom`,[e]),[u,d]=(0,U.useState)(l),[f,p]=(0,U.useState)(``),[m,h]=(0,U.useState)(``);if((0,U.useEffect)(()=>{t&&(d(l),p(``),h(``))},[l,t,e?.id]),!e)return null;let g=e.options.length===0,_=e.kind===`domain_intake`,v=e.options.find(e=>e.id===u),y=g?!!f.trim():!!(v&&(!v.requires_note||f.trim())),b=()=>{if(!n){if(!y){h(o(`decision.noteRequired`));return}h(``),i(g?`custom`:u,f.trim())}};return(0,K.jsxs)(tt,{open:t,onClose:n?()=>void 0:r,label:o(`decision.operator`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:_?e.title:o(`decision.required`),sub:!_&&e.title!==e.task_title?e.title:void 0}),(0,K.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[(0,K.jsx)(Fl,{card:e}),e.reason?(0,K.jsxs)(`section`,{className:`rounded-md border border-gold/30 bg-gold/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-gold`,children:o(`decision.whyBlocked`)}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.reason})]}):null,e.evidence.length?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:o(`decision.evidence`)}),(0,K.jsx)(`div`,{className:`space-y-2`,children:e.evidence.map((e,t)=>(0,K.jsxs)(`div`,{className:`rounded border border-line/70 bg-bg/40 p-2.5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.label}),e.summary?(0,K.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:e.summary}):null,e.path?(0,K.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10px] text-blue-sky`,children:e.path}):null]},`${e.path}:${t}`))})]}):null,(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.question}),e.options.length?(0,K.jsx)(`div`,{className:`space-y-2`,children:e.options.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{d(e.id),h(``)},disabled:n,"aria-pressed":u===e.id,className:`w-full rounded-md border p-3 text-left ${u===e.id?`border-blue bg-blue/5`:`border-line bg-bg/30`}`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-ink`,children:e.label}),(0,K.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-ink-dim`,children:e.description})]},e.id))}):null,_||g||v?.requires_note||f?(0,K.jsx)(`textarea`,{"data-autofocus":!0,value:f,onChange:e=>{p(e.target.value),h(``)},onKeyDown:e=>{fc(e)||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},rows:3,disabled:n,"aria-label":_?c?`你的回答或补充说明`:`Your answer or additional details`:o(`decision.notePlaceholder`),placeholder:_?v?.requires_note?c?`填写你的回答…`:`Enter your answer…`:c?`补充说明(可选)`:`Additional details (optional)`:o(`decision.notePlaceholder`),className:`w-full resize-y rounded-lg border border-line bg-bg px-3 py-2 text-sm leading-relaxed text-ink outline-none focus:border-blue disabled:opacity-60`}):null,m||a?(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:m||a}):null,(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:_?c?`确认后继续这次任务。`:`Confirm to continue this request.`:o(`decision.resumeHint`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md px-3 py-2 text-xs text-ink-dim hover:bg-bg`,children:o(n?`decision.closeContinue`:`decision.later`)}),(0,K.jsx)(`button`,{type:`button`,onClick:b,disabled:n,className:`rounded-md border border-blue/35 bg-blue/8 px-3 py-2 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-50`,children:o(n?`decision.applying`:g||u===`custom`?`decision.sendAnswer`:u===`stop`?`decision.stopCampaign`:`decision.useOption`)})]})]})]})]})}function Rl({alert:e}){if(!e)return null;let t=e.tone===`block`,n=e.kind===`budget`;return(0,K.jsxs)(`div`,{className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border px-3.5 py-2 text-[13px] ${t?`border-err/50 bg-err/10 text-err`:`border-warn/50 bg-warn/10 text-warn`}`,role:t?`alert`:`status`,children:[(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-bold leading-none`,children:n?`$`:t?`!`:`i`}),(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold uppercase tracking-wide`,children:n?`budget alarm`:t?`action required`:`notice`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.text,children:e.text})]})}function zl({sid:e}){let{t}=F(),n=S(),{data:r}=xe(e,!0),[i,a]=(0,U.useState)(!1);if(!e||!Sl(r?.operator_knobs))return null;let o=async()=>{a(!0);try{await P.setConfig(e,bl,`1`),await n.invalidateQueries({queryKey:[`config`,e]})}finally{a(!1)}};return(0,K.jsxs)(`div`,{"data-no-operator-banner":!0,role:`status`,className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border border-warn/50 bg-warn/10 px-3.5 py-2 text-[13px] text-warn`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:t(`noOperator.banner`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:i,className:`shrink-0 rounded border border-warn/50 px-2 py-0.5 text-xs font-medium hover:bg-warn/10 disabled:opacity-40`,children:t(`noOperator.turnOff`)})]})}function Bl(e){let t=(e.label||e.display_name||``).trim();return!!(t&&t!==e.id)}function Vl(e){return[...e].sort((e,t)=>{if(e.daemon_alive!==t.daemon_alive)return e.daemon_alive?-1:1;let n=Bl(e);return n===Bl(t)?(t.last_active||0)-(e.last_active||0):n?-1:1})}function Hl(e){return Vl(e)[0]}function Ul(e,t){let n=t?.trim()||null;return n&&e.some(e=>e.id===n)?{id:n,requested:n,recovered:!1}:{id:Hl(e)?.id??null,requested:n,recovered:!!n}}function Wl(e,t,n){if(n){let e=t?.trim()||null;return{id:e,requested:e,recovered:!1}}return Ul(e,t)}function Gl(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return!0;let r=e.daemon_alive?`live running`:`stopped idle`,i=[e.id,e.label,e.display_name,e.objective,r].filter(Boolean).join(` `).toLowerCase();return n.every(e=>i.includes(e))}function Kl(e,t){return e.filter(e=>Gl(e,t))}function ql(e){let t=new Set;return[e.primary_target,...e.targets].filter(e=>!e?.path||t.has(e.path)?!1:(t.add(e.path),!0))}function Jl(e,t){if(t===`research`)for(let t of e){let e=ql(t).find(e=>/(?:^|\/)paper\/main\.pdf$/i.test(e.path.replace(/\\/g,`/`)));if(e)return{receipt:t,path:e.path}}let n=e[0];return n?{receipt:n,path:ql(n)[0]?.path||null}:null}function Yl(e){return e.replace(/\s*\bRESULT\s*=\s*/g,` + +`).replace(/\s*\b(?:STATUS|REVIEW_STATUS)\s*=\s*\S+/g,``).trim()}function Xl(e,t,n){let r=n.reduce((e,t)=>t.type===`ui.operator`?Math.max(e,Number(t.ts)||0):e,0),i=t&&(e===void 0||t.delivered_at>r)?t:null;return e?i&&i.delivered_at>e.delivered_at?i:e:i}function Zl(e,t){if(!t)return!1;let n=new Set([t]),r=[t];for(let t=0;te.id!==t&&n.has(e.id)&&[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))}var Ql=new Set([`done`,`passed`,`approved`,`accepted`]);function $l(e,t){let n=String(e.review_status||``).toLowerCase(),r=String(e.review_source||``).toLowerCase(),i=String(e.residual_risk||``).trim();return Ql.has(n)&&r===`reviewer`&&i?{independent:!0,text:t?`独立复核通过 · 有残余风险`:`Independently reviewed · residual risk`,title:t?`有一项检查在此环境中无法进行,已被接受为残余风险:${i}`:`One check was impossible here and its risk was accepted: ${i}`}:Ql.has(n)&&r===`reviewer`?{independent:!0,text:t?`独立复核通过`:`Independently reviewed`,title:t?`另一个审查角色检查过这份成果`:`A separate reviewer checked this result`}:!n||n===`not_assessed`||Ql.has(n)&&r?{independent:!1,text:t?`实现者自检 · 未独立复核`:`Self-checked · not independently reviewed`,title:t?`只有完成它的人自己检查过,没有另外的审查`:`Only the worker that produced it checked it; no separate review`}:Ql.has(n)?{independent:!1,text:t?`已完成 · 未记录是否独立复核`:`Completed · review source not recorded`,title:t?`这份较早的交付没有记录是谁检查的,不能确认经过独立复核`:`This older delivery did not record who checked it, so independent review cannot be confirmed`}:{independent:!1,text:t?`复核状态:${n}`:`Review: ${n}`,title:t?`独立复核没有通过或已过期`:`Independent review did not pass or is out of date`}}function eu(e,t,n){if(!n)return null;let r=e.snapshots?.find(e=>e.path===n&&e.stored);if(!r)return null;let i=t.filter(t=>t.delivery_id!==e.delivery_id&&t.delivered_att.delivered_at-e.delivered_at);for(let e of i){let t=e.snapshots?.find(e=>e.path===n);if(!(!t||t.sha256===r.sha256))return t.stored?{path:n,before:t.sha256,after:r.sha256}:null}return null}function tu({sid:e,change:t,zh:n}){let[r,i]=(0,U.useState)({open:!1,loading:!1,diff:``,error:``,truncated:!1});return(0,K.jsxs)(`div`,{className:`delivery-changes`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-expanded":r.open,onClick:()=>{if(r.open){i(e=>({...e,open:!1}));return}i(e=>({...e,open:!0,loading:!e.diff&&!e.error})),!(r.diff||r.error)&&P.deliveryDiff(e,t).then(e=>i(t=>({...t,loading:!1,truncated:e.truncated,diff:e.available?e.diff:``,error:e.available?e.diff?``:n?`内容没有变化`:`No content changes`:n?`上一版已不再保存,无法对比`:`The previous version is no longer kept`}))).catch(e=>i(t=>({...t,loading:!1,error:e instanceof Error?e.message:String(e)})))},children:r.open?n?`收起改动`:`Hide changes`:n?`查看与上一次交付相比的改动`:`Show changes since the previous delivery`}),r.open&&(r.loading?(0,K.jsx)(`p`,{children:n?`正在读取…`:`Loading…`}):r.error?(0,K.jsx)(`p`,{children:r.error}):(0,K.jsxs)(`pre`,{"aria-label":n?`改动`:`Changes`,children:[r.diff.split(` +`).map((e,t)=>(0,K.jsxs)(`span`,{className:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:void 0,children:[e,` +`]},t)),r.truncated?n?`…(改动过长,已截断)`:`… (truncated)`:``]}))]})}var nu=({children:e})=>(0,K.jsxs)(`span`,{children:[e,` `]}),ru=(0,U.memo)(function({children:e}){return(0,K.jsx)(T,{remarkPlugins:st,rehypePlugins:at,components:{p:nu,h1:nu,h2:nu,h3:nu,h4:nu,h5:nu,h6:nu,ul:nu,ol:nu,blockquote:nu,pre:nu,li:({children:e})=>(0,K.jsxs)(`span`,{className:`markdown-excerpt-item`,children:[e,` `]}),table:nu,thead:nu,tbody:nu,tr:nu,th:({children:e})=>(0,K.jsxs)(`strong`,{children:[e,` · `]}),td:nu,a:({children:e})=>(0,K.jsx)(`span`,{className:`markdown-excerpt-link`,children:e}),img:({alt:e})=>(0,K.jsx)(`span`,{children:e}),input:({checked:e})=>(0,K.jsx)(`span`,{children:e?`✓ `:`○ `}),hr:()=>(0,K.jsx)(`span`,{children:` · `}),code:({children:e})=>(0,K.jsx)(`code`,{children:e})},children:Yl(e)})});function iu({html:e,title:t,className:n=``,sid:r,path:i}){return r&&i?(0,K.jsx)(au,{sid:r,path:i,html:e,title:t,className:n}):(0,K.jsx)(`iframe`,{title:t,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white ${n}`})}function au({html:e,title:t,className:n,sid:r,path:i}){let{locale:a}=F(),o=a===`zh-CN`,s=x({queryKey:[`artifact-html`,r,i,e],queryFn:({signal:e})=>P.artifactPreview(r,i,e),enabled:!!(r&&i),staleTime:3e4,retry:1});if(r&&i&&s.isPending)return(0,K.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,role:`status`,children:o?`正在加载网页和配套资源…`:`Loading the website and its assets…`});if(r&&i&&s.isError)return(0,K.jsxs)(`div`,{className:`m-auto p-6 text-sm text-err`,role:`alert`,children:[o?`网页预览加载失败,请重试或下载文件。`:`Preview could not load. Retry or download the file.`,(0,K.jsx)(`button`,{type:`button`,className:`ml-3 underline`,onClick:()=>void s.refetch(),children:o?`重试`:`Retry`})]});let c=s.data?.served_page===!0;return(0,K.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col ${n}`,children:[!!s.data?.warnings.length&&(0,K.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`部分配套资源无法加载,页面可能不完整。`:`Some linked assets are unavailable; the preview may be incomplete.`}),!c&&(0,K.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`此后端尚未支持独立网页预览;当前为内嵌预览,交互脚本可能不可用。`:`This backend does not yet support standalone preview; embedded preview may not run interactive scripts.`}),(0,K.jsx)(`iframe`,{title:t,src:c?D(r,i):void 0,srcDoc:c?void 0:s.data?.html??e,sandbox:`allow-scripts allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]})}function ou(e){let t=e.trim();if(!t)return``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{try{return t.split(/\r?\n/).filter(Boolean).map(e=>JSON.parse(e)).map(e=>JSON.stringify(e,null,2)).join(` +`)}catch{return e}}}function su(e,t){let n=[],r=[],i=``,a=!1;for(let o=0;oe.some(e=>e.length>0))}function cu({value:e}){return(0,K.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:ou(e)||`(empty data)`})}function lu({value:e,delimiter:t}){let n=su(e,t).slice(0,200),r=n[0]??[];return(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4 scroll-thin`,children:n.length?(0,K.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsx)(`tr`,{children:r.slice(0,40).map((e,t)=>(0,K.jsx)(`th`,{className:`border border-line/60 bg-surface px-2 py-1.5 font-semibold text-ink`,children:e},t))})}),(0,K.jsx)(`tbody`,{children:n.slice(1).map((e,t)=>(0,K.jsx)(`tr`,{children:r.slice(0,40).map((t,n)=>(0,K.jsx)(`td`,{className:`border border-line/50 px-2 py-1.5 align-top text-ink-dim`,children:e[n]??``},n))},t))})]}):(0,K.jsx)(`div`,{className:`text-sm text-ink-faint`,children:`(empty table)`})})}var uu=``+new URL(`pdf.min-Bbvtrhlt.mjs`,import.meta.url).href,du=``+new URL(`pdf.worker.min-CLrFZWeq.mjs`,import.meta.url).href,fu=null,pu=0;function mu(){fu=null,pu+=1}function hu(){if(fu)return fu;let e=new URL(uu,import.meta.url),t=new URL(du,import.meta.url);pu&&(e.searchParams.set(`retry`,String(pu)),t.searchParams.set(`retry`,String(pu)));let n=Se(()=>import(e.href).then(e=>(e.GlobalWorkerOptions.workerSrc=t.href,e)),[],import.meta.url).catch(e=>{throw fu===n&&mu(),e});return fu=n,n}function gu(e,t,n,r){let i=Math.max(1,n-32)/Math.max(1,e),a=Math.max(1,r-32)/Math.max(1,t);return Math.min(2.5,i,a)}function _u({src:e,name:t,className:n=``,onPageOrientation:r,onRetry:i}){let{locale:a}=F(),o=a===`zh-CN`,s=(0,U.useRef)(null),c=(0,U.useRef)(null),l=(0,U.useRef)(null),[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(1),[m,h]=(0,U.useState)(1),[g,_]=(0,U.useState)({width:0,height:0}),[v,y]=(0,U.useState)(!0),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(0);(0,U.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>_({width:e.clientWidth,height:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,U.useEffect)(()=>{let t=!0,n=new AbortController,r=null;return d(null),p(1),h(1),l.current=null,c.current?.scrollTo(0,0),C(``),y(!0),Promise.all([fetch(e,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`PDF request failed (${e.status})`);return e.arrayBuffer()}),hu()]).then(async([e,n])=>{if(!t)return;r=n.getDocument({data:new Uint8Array(e)});let i=await r.promise;t&&(d(i),y(!1))}).catch(e=>{t&&(y(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!1,n.abort(),r?.destroy().catch(()=>{})}},[e,w]),(0,U.useEffect)(()=>{let e=s.current;if(!u||!e||g.width<=0||g.height<=0)return;let t=!1,n=null;return x(!0),C(``),u.getPage(f).then(e=>{if(t||!s.current)return;let i=e.getViewport({scale:1});r?.(i.width>i.height?`landscape`:`portrait`);let a=gu(i.width,i.height,g.width,g.height),o=e.getViewport({scale:a*m}),u=document.createElement(`canvas`),d=u.getContext(`2d`,{alpha:!1});if(!d)throw Error(`Canvas rendering is unavailable`);let f=Math.min(window.devicePixelRatio||1,2);return u.width=Math.max(1,Math.floor(o.width*f)),u.height=Math.max(1,Math.floor(o.height*f)),n=e.render({canvas:u,canvasContext:d,viewport:o,transform:f===1?void 0:[f,0,0,f,0,0]}),n.promise.then(()=>{if(t||!s.current)return;let e=s.current,n=e.getContext(`2d`,{alpha:!1});if(!n)throw Error(`Canvas rendering is unavailable`);e.width=u.width,e.height=u.height,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`,n.drawImage(u,0,0);let r=c.current,i=l.current;if(r&&i){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect();r.scrollLeft+=n.left+i.x*n.width-t.left-r.clientWidth/2,r.scrollTop+=n.top+i.y*n.height-t.top-r.clientHeight/2,l.current=null}})}).then(()=>{t||x(!1)}).catch(e=>{t||e instanceof Error&&e.name===`RenderingCancelledException`||(x(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!0,n?.cancel()}},[r,f,u,g.height,g.width,m]);let E=e=>{let t=c.current,n=s.current;if(t&&n&&n.clientWidth&&n.clientHeight){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();l.current={x:Math.max(0,Math.min(1,(e.left+t.clientWidth/2-r.left)/r.width)),y:Math.max(0,Math.min(1,(e.top+t.clientHeight/2-r.top)/r.height))}}h(t=>Math.max(.6,Math.min(2.2,Math.round((t+e)*100)/100)))},D=()=>{l.current=null,c.current?.scrollTo(0,0),h(1)},O=u?.numPages??0;return(0,K.jsxs)(`div`,{className:`pdf-viewer flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-bg ${n}`,"aria-busy":v||b,children:[(0,K.jsxs)(`div`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-2 border-b border-line/70 bg-panel px-3 py-1.5 text-[11px] text-ink-dim`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink`,title:t,children:t}),(0,K.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[o?`第`:`Page`,` `,f,` / `,O||`…`]}),(0,K.jsx)(`button`,{type:`button`,disabled:!u||f<=1,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.max(1,e-1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`上一页`:`Previous`}),(0,K.jsx)(`button`,{type:`button`,disabled:!u||f>=O,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.min(O,e+1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`下一页`:`Next`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o?`缩小`:`Zoom out`,disabled:!u||m<=.6,onClick:()=>E(-.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`−`}),(0,K.jsxs)(`span`,{className:`w-10 text-center font-mono tabular-nums`,children:[Math.round(m*100),`%`]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o?`放大`:`Zoom in`,disabled:!u||m>=2.2,onClick:()=>E(.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`+`}),(0,K.jsx)(`button`,{type:`button`,disabled:!u,onClick:D,className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`适合页面`:`Fit page`})]}),(0,K.jsxs)(`div`,{ref:c,className:`pdf-scroll-viewport relative min-h-0 min-w-0 flex-1 overflow-auto bg-surface/60 p-4 scroll-thin`,tabIndex:0,"aria-label":o?`PDF 页面滚动区域`:`PDF page scroll area`,children:[v?(0,K.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,K.jsx)(Ue,{})}):null,S?(0,K.jsxs)(`div`,{role:`alert`,className:`m-auto max-w-sm rounded border border-err/35 bg-err/5 p-4 text-center text-sm text-err`,children:[(0,K.jsx)(`p`,{children:o?`PDF 暂时无法预览`:`PDF preview is temporarily unavailable`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{mu(),i?i():T(e=>e+1)},className:`mt-3 rounded border border-line bg-panel px-3 py-1.5 text-ink hover:border-blue/50`,children:o?`重试预览`:`Retry preview`}),(0,K.jsxs)(`details`,{className:`mt-3 break-words text-xs text-ink-dim`,children:[(0,K.jsx)(`summary`,{children:o?`错误详情`:`Error details`}),S]})]}):null,S?null:(0,K.jsx)(`div`,{className:`pdf-page-stage flex min-h-full min-w-full w-max items-center justify-center`,children:(0,K.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`${t} · ${o?`第`:`page`} ${f}`,className:`block max-w-none shrink-0 bg-white shadow-xl`})})]})]})}function vu(e){return e.kind===`markdown`||e.mime?.split(`;`,1)[0].trim().toLowerCase()===`text/markdown`||/\.(?:md|markdown)$/i.test(e.name||e.path||``)}function yu(e){return e.title?.trim()||e.question}function bu({sid:e,path:t,onClose:n,delivery:r,deliveries:i=[],onSelectDelivery:a,onSelectPath:o,reviewActivity:s,artifacts:c=[]}){let{t:l,locale:u}=F(),d=u===`zh-CN`,f=r?ql(r):[],p=de(e,t),m=p.data,h=m?.source===`reader_foundation`?m.reader_foundation:void 0,g=m?.source===`progress_snapshot`,_=m?vu(m):!1,[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(0),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(!1),[O,k]=(0,U.useState)(`portrait`),A=m?.kind===`pdf`||t?.toLowerCase().endsWith(`.pdf`)===!0,j=!!(t&&/(?:^|[\\/])REVIEW\.md$/i.test(t));(0,U.useEffect)(()=>{if(!(!t||!A))return pr(!0),()=>pr(!1)},[t,A]),(0,U.useEffect)(()=>{if(k(`portrait`),y(null),x(``),!e||!t||!m||![`image`,`pdf`,`audio`,`video`].includes(m.kind))return;let n=!0,r=``,i=new AbortController;return P.artifactBlob(e,t,!1,i.signal).then(e=>{n&&(r=URL.createObjectURL(e),y(r))},e=>n&&x(e.message)),()=>{n=!1,i.abort(),r&&URL.revokeObjectURL(r)}},[e,t,m?.kind,S]);let M=async(n=!1)=>{if(!(!e||!t||!m)){T(!0),x(``);try{let r=n?await P.artifactBundle(e,t):await P.artifactBlob(e,t,!0);$e(r,n?`${m.name.replace(/\.html?$/i,``)}-website.zip`:m.name)}catch(e){x(e.message)}finally{T(!1)}}};return(0,K.jsxs)(tt,{open:!!(t||r),onClose:n,label:r?d?`交付成果`:`Delivery`:l(`artifact.preview`),width:r?E?`max-w-none`:`max-w-6xl`:A?`max-w-none`:`max-w-5xl`,viewport:r?E:A,showClose:!1,style:r?{height:E?`100dvh`:`min(92dvh, 960px)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:A?{maxWidth:O===`portrait`?`min(96vw, 76dvh)`:`min(96vw, 145dvh)`}:void 0,children:[r&&!E&&(0,K.jsxs)(`header`,{className:`delivery-header`,children:[(0,K.jsxs)(`div`,{className:`delivery-heading`,children:[(0,K.jsx)(`span`,{className:`delivery-mark`,children:(0,K.jsx)(Gt,{size:22})}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{children:[`DELIVERY · `,d?`交付成果`:`Your results`]}),(0,K.jsx)(`h2`,{children:d?`成果文件`:`Result files`})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:n,className:`delivery-return`,"aria-label":d?`关闭交付弹窗`:`Close delivery`,children:[d?`返回地图`:`Back to map`,` ×`]})]}),i.length>1?(0,K.jsx)(`select`,{"aria-label":d?`选择交付任务`:`Choose delivery`,className:`delivery-task-select`,value:r.delivery_id,onChange:e=>{let t=i.find(t=>t.delivery_id===e.target.value);t&&a?.(t)},children:i.map(e=>(0,K.jsx)(`option`,{value:e.delivery_id,children:e.title},e.delivery_id))}):(0,K.jsx)(`p`,{className:`delivery-task-title`,title:r.title,children:r.title}),(0,K.jsxs)(`div`,{className:`delivery-facts`,children:[(()=>{let e=$l(r,d);return(0,K.jsxs)(`span`,{className:e.independent?`delivery-review-independent`:`delivery-review-self`,title:e.title,children:[e.independent?(0,K.jsx)(Ft,{size:13}):null,e.text]})})(),(0,K.jsxs)(`span`,{children:[f.length,` `,d?`个文件`:`files`]})]}),r.summary&&(0,K.jsxs)(`details`,{className:`delivery-summary`,children:[(0,K.jsx)(`summary`,{children:d?`查看成果说明`:`Result summary`}),(0,K.jsx)(`p`,{children:(0,K.jsx)(ru,{children:r.summary})})]})]}),!E&&!!f.length&&(0,K.jsx)(`nav`,{className:`delivery-files`,"aria-label":d?`交付文件`:`Delivery files`,children:f.map(e=>(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":t===e.path,onClick:()=>o?.(e.path),title:e.path,children:[(0,K.jsx)(`span`,{children:e.path.split(`/`).at(-1)}),r?.primary_target?.path===e.path&&(0,K.jsx)(`small`,{children:d?`主要成果`:`Main result`})]},e.path))}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-line px-4 py-3 sm:px-5 ${t?``:`hidden`}`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink ${h||g?``:`font-mono`}`,title:h?.question??m?.progress_source?.title??m?.storage_path??m?.path??t??``,children:h?yu(h):g?m?.progress_source?.title||l(`artifact.title`):m?.name??t??l(`artifact.title`)}),(0,K.jsx)(`p`,{className:`mt-0.5 truncate text-[11px] text-ink-faint`,children:h?h.kind===`clarification`||h.kind===`progress_answer`?d?`阅读问答`:`Reading question and answer`:d?`背景说明 · 不计作研究进展`:`Background explanation · separate from research progress`:g?d?`保存的进展说明 · 提问来源`:`Saved progress explanation · question source`:m?`${m.kind} · ${ct(m.size)} · ${m.mime}`:d?`正在读取文件`:`Loading file`})]}),r&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>D(e=>!e),"aria-label":E?d?`收起预览`:`Exit full screen`:d?`全屏预览`:`Full screen preview`,title:d?`切换全屏预览`:`Toggle full screen preview`,className:`shrink-0 rounded-md border border-line p-2 text-ink-dim`,children:E?(0,K.jsx)(Wt,{size:16}):(0,K.jsx)(G,{size:16})}),m?.kind===`html`&&(0,K.jsx)(`button`,{type:`button`,disabled:w,onClick:()=>void M(!0),className:`shrink-0 rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-2 text-xs text-blue-sky disabled:opacity-50`,children:d?`下载完整网页`:`Download website`}),(0,K.jsx)(`button`,{type:`button`,disabled:!m||w,onClick:()=>void M(),className:`rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-1.5 text-xs text-blue-sky transition-colors hover:bg-blue-deep/20 disabled:cursor-wait disabled:opacity-50`,children:l(w?`artifact.downloading`:`artifact.download`)}),(!r||E)&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(`artifact.close`),onClick:n,className:`rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink`,children:`×`})]}),(0,K.jsxs)(`div`,{className:r?`flex min-h-0 flex-1 flex-col overflow-auto bg-bg/40 p-2 sm:p-3`:A?`flex min-h-0 flex-1 flex-col overflow-hidden bg-bg/40`:`flex min-h-64 max-h-[72vh] flex-col overflow-x-hidden overflow-y-auto bg-bg/40 p-3 scroll-thin sm:p-4`,children:[!t&&r&&(0,K.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,children:(0,K.jsx)(ru,{children:r.summary})}),r&&e&&(()=>{let n=eu(r,i,t);return n?(0,K.jsx)(tu,{sid:e,change:n,zh:d},`${n.before}:${n.after}`):null})(),p.isLoading?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,p.isError?(0,K.jsxs)(`div`,{className:`m-auto text-sm text-err`,children:[l(`artifact.unavailable`),` · `,p.error.message]}):null,m?.why&&!h&&!g&&!A&&!r?(0,K.jsxs)(`div`,{className:`mb-3 rounded-md border border-line bg-surface px-3 py-2 text-xs text-ink-dim`,children:[(0,K.jsx)(`span`,{className:`mr-1 text-ink-faint`,children:`Reviewer:`}),m.why]}):null,m?.kind===`text`&&!_?(0,K.jsxs)(`pre`,{className:`min-h-52 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-bg p-4 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:[m.preview||l(`artifact.empty`),m.truncated?`\n\n… ${l(`artifact.truncated`)}`:``]}):null,m&&_?(0,K.jsxs)(`div`,{className:`min-h-52 overflow-auto rounded-lg border border-line bg-bg p-4 text-sm text-ink-dim scroll-thin`,children:[j&&(0,K.jsxs)(`div`,{className:`mb-4 border-b border-line pb-3 text-xs leading-5 text-ink-faint`,role:`status`,children:[s===`revising`?d?`正在根据这份意见修改论文,修改后的版本尚待复审。`:`The paper is being revised against this opinion; the revised version awaits review.`:s===`reviewing`?d?`Reviewer 正在更新本轮审稿意见,内容会自动刷新。`:`The Reviewer is updating this round’s opinion. This file refreshes automatically.`:d?`这是最近保存的审稿意见,文件更新后会自动刷新。`:`This is the latest saved review. Changes to this file appear automatically.`,m.mtime!=null&&(0,K.jsxs)(`div`,{children:[d?`最近更新:`:`Last updated: `,new Date(m.mtime*1e3).toLocaleString(u)]})]}),(0,K.jsx)(Ke,{sid:e,basePath:t||``,artifacts:[...c,...f.map(e=>({path:e.path})),...h?.sources??[],...h?.progress_source?[{path:h.progress_source.path}]:[]],onOpenArtifact:o,children:m.preview||l(`artifact.empty`)}),m.truncated?(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 border-t border-line pt-2 text-xs text-ink-faint`,children:[l(`artifact.truncated`),` · `,l(`artifact.downloadHint`)]}):null]}):null,m?.kind===`json`?(0,K.jsx)(cu,{value:m.preview||``}):null,m?.kind===`table`?(0,K.jsx)(lu,{value:m.preview||``,delimiter:m.name.endsWith(`.tsv`)?` `:`,`}):null,m?.kind===`html`?(0,K.jsx)(`div`,{className:`flex flex-1 overflow-hidden rounded-lg border border-line ${r?`min-h-0`:`min-h-[60vh]`}`,children:(0,K.jsx)(iu,{sid:e,path:t,html:m.preview||``,title:`HTML preview: ${m.name}`})}):null,m?.kind===`image`&&v?(0,K.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-bg/50`,children:(0,K.jsx)(`img`,{src:v,alt:m.why||m.name,className:`max-h-[62vh] max-w-full object-contain`})}):null,m?.kind===`pdf`&&v?(0,K.jsx)(_u,{src:v,name:m.name,className:`min-h-0 overflow-hidden`,onPageOrientation:k,onRetry:()=>C(e=>e+1)}):null,m?.kind===`audio`&&v?(0,K.jsx)(`div`,{className:`m-auto w-full max-w-xl`,children:(0,K.jsx)(`audio`,{controls:!0,preload:`metadata`,src:v,className:`w-full`})}):null,m?.kind===`video`&&v?(0,K.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-black`,children:(0,K.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:v,className:`max-h-[62vh] max-w-full`})}):null,m&&[`image`,`pdf`,`audio`,`video`].includes(m.kind)&&!v&&!b?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,m?.kind===`binary`?(0,K.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,K.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-ink-dim`,children:l(`artifact.noPreview`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:l(`artifact.downloadHint`)})]}):null,b?(0,K.jsx)(`div`,{className:`mt-3 text-center text-xs text-err`,children:b}):null]})]})}var xu=[{label:[`从头讲清楚`,`Explain from the beginning`],question:[`请从头讲清楚这份说明。先用日常语言解释它在讨论什么、要判断什么,再按需要解释其中的对象和符号。涉及比较或公式时,请明确两边是什么、哪些条件下能比较,并用一个可复算的小例子说明。请分别说明标准背景知识、本次已有证据和仍未知的内容。`,`Explain this reading from the beginning using everyday language. Start with what it discusses and what we are trying to determine, then explain the necessary objects and symbols. For a comparison or formula, define both sides and when the comparison is valid, and work a small example I can recompute. Distinguish standard background, evidence from this run, and what remains unknown.`]},{label:[`带我算一遍`,`Work through an example`],question:[`请带我实际算一遍这份说明中的关键一步。先解释对象、输入和运算规则,再用一组明确标为教学例子的小数据展示中间步骤与结果,然后换一个输入让我能照着计算。请说明它怎样关系到正在判断的结论,以及这个例子还不能证明什么。`,`Walk me through the key operation in this reading. Explain the objects, inputs, and rules, then use a small example clearly labeled as a teaching example to show the intermediate steps and result. Change one input and work it again so I can follow the calculation. Explain how it relates to the conclusion being assessed and what the example does not prove.`]},{label:[`这说明了什么`,`What does this establish?`],question:[`这份说明究竟支持什么结论?请用我能懂的语言解释已经验证的部分、依赖的条件、未覆盖的情况,以及它和整个任务目标的关系。解释必要概念,并指出哪些只是记录中的说法、哪些有可核对的依据。`,`What conclusion does this reading support? Explain the part that has been checked, its assumptions, the cases it does not cover, and how it relates to the overall task. Explain the necessary concepts and distinguish reported claims from conclusions with verifiable supporting evidence.`]}];function Su({draft:e,onChange:t,onSubmit:n,disabled:r,children:i}){let a=F().locale===`zh-CN`,o=!!e.parentId||!!e.progressSource,s=(0,U.useRef)(null);return(0,K.jsxs)(K.Fragment,{children:[i,o&&!e.question.trim()?(0,K.jsxs)(`div`,{className:`mb-3 space-y-2`,"data-reading-question-suggestions":!0,children:[(0,K.jsx)(`p`,{className:`text-xs text-ink-dim`,children:a?`可以从这些问题开始,也可以直接输入。`:`Start with one of these questions, or write your own.`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:xu.map(n=>(0,K.jsx)(B,{type:`button`,className:`text-xs`,disabled:r,onClick:()=>{t({...e,question:n.question[+!a]}),s.current?.focus()},children:n.label[+!a]},n.label[1]))})]}):null,(0,K.jsx)(`textarea`,{ref:s,"aria-label":a?`想理解的问题`:`Question to understand`,className:`min-h-40 w-full rounded-lg border border-line bg-bg p-3 text-sm leading-6 text-ink`,maxLength:8e3,value:e.question,onChange:n=>t({...e,question:n.target.value})}),e.sourceTitle?(0,K.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[a?`从这项任务打开:`:`Opened from this task: `,e.sourceTitle]}):null,(0,K.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,K.jsx)(B,{"data-reading-submit":!0,disabled:!e.question.trim()||r,onClick:n,children:o?a?`提问`:`Ask question`:a?`生成并保存基础说明`:`Generate and save foundations`})})]})}var Cu=[1,0],wu=[{id:`up`,vector:[0,1],zh:`向上 1 格`,en:`Up 1 square`},{id:`right`,vector:[2,0],zh:`向右 2 格`,en:`Right 2 squares`},{id:`fraction`,vector:[1.5,0],zh:`向右 1.5 格`,en:`Right 1.5 squares`},{id:`zero`,vector:[0,0],zh:`留在原点`,en:`Stay at the origin`}];function Tu(e,t){return e[0]*t[1]-e[1]*t[0]===0?e.some(Boolean)||t.some(Boolean)?1:0:2}function Eu(e){if(!e)return!1;let t=[e.name,e.explanation,e.example,e.connection].join(` `);return/独立(?:的)?方向|线性(?:无关|独立)|independent\s+directions?\b|linear\s+independence\b|linearly\s+independent\b/iu.test(t)}function Du(){let{locale:e}=F(),t=e===`zh-CN`,n=(e,n)=>t?e:n,[r,i]=(0,U.useState)(wu[0]),a=(0,U.useId)(),o=r.vector,s=Tu(Cu,o),c=e=>62+e*36,l=e=>116-e*36,u=r.id===`up`?n(`只沿 A 左右移动,走不到 B 的终点;B 补上了上下方向。`,`Moving left or right along A cannot reach B’s endpoint. B adds an up-and-down direction.`):r.id===`right`?n(`走两次 A 就能代替 B。步子更长,并没有增加独立方向。`,`Two copies of A replace B. A longer step does not add an independent direction.`):r.id===`fraction`?n(`走两次 B 和走三次 A,都向右走了 3 格。虽然两者互相都不是整数倍,仍只有一个独立方向。`,`Two copies of B and three copies of A both move 3 squares right. Neither is an integer multiple of the other, but they still provide only one independent direction.`):n(`B 没有移动,没有增加方向;A 仍提供一个独立方向。`,`B does not move, so it adds no direction. A still provides one independent direction.`),d=n(`这两支箭头提供 ${s} 个独立方向`,`These two arrows provide ${s} independent direction${s===1?``:`s`}`);return(0,K.jsxs)(`section`,{className:`my-2 rounded-lg border border-line bg-surface p-3`,"aria-label":n(`平面上的独立方向示意`,`Independent directions in a plane`),"data-testid":`direction-example`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:n(`A 固定向右走 1 格。改变 B,看看它是否提供新的走法。允许把箭头缩放、反向,再相加。`,`A always moves 1 square right. Change B to see whether it adds a new way to move. Arrows may be scaled, reversed, and added.`)}),(0,K.jsxs)(`svg`,{viewBox:`0 0 210 180`,className:`mx-auto my-2 block w-full max-w-[260px]`,role:`img`,"aria-labelledby":`${a}-title ${a}-desc`,children:[(0,K.jsx)(`title`,{id:`${a}-title`,children:d}),(0,K.jsx)(`desc`,{id:`${a}-desc`,children:`A = (1, 0), B = (${o[0]}, ${o[1]}). ${u}`}),(0,K.jsxs)(`defs`,{children:[(0,K.jsx)(`marker`,{id:`${a}-a`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,K.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:R.accent})}),(0,K.jsx)(`marker`,{id:`${a}-b`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,K.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:R.success})})]}),(0,K.jsx)(`rect`,{x:`20`,y:`32`,width:`165`,height:`125`,rx:`4`,fill:R.accent,opacity:s===2?.07:0}),[-1,0,1,2,3].map(e=>(0,K.jsx)(`line`,{x1:c(e),x2:c(e),y1:`32`,y2:`157`,stroke:`rgb(var(--line))`},`x${e}`)),[-1,0,1,2].map(e=>(0,K.jsx)(`line`,{y1:l(e),y2:l(e),x1:`20`,x2:`185`,stroke:`rgb(var(--line))`},`y${e}`)),s===1?(0,K.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:R.accent,strokeWidth:`10`,opacity:`.09`}):null,(0,K.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:R.inkFaint}),(0,K.jsx)(`line`,{x1:c(0),x2:c(0),y1:`32`,y2:`157`,stroke:R.inkFaint}),[0,1,2,3].map(e=>(0,K.jsx)(`text`,{x:c(e)-3,y:l(0)+14,fill:R.inkFaint,fontSize:`9`,children:e},e)),r.id===`zero`?(0,K.jsx)(`circle`,{cx:c(0),cy:l(0),r:`5`,fill:`rgb(var(--surface))`,stroke:R.success,strokeWidth:`3`,"data-testid":`direction-b-zero`}):(0,K.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(o[0]),y2:l(o[1]),stroke:R.success,strokeWidth:`3`,markerEnd:`url(#${a}-b)`,"data-testid":`direction-b`}),(0,K.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(Cu[0]),y2:l(Cu[1]),stroke:R.accent,strokeWidth:`3`,markerEnd:`url(#${a}-a)`}),(0,K.jsx)(`text`,{x:c(Cu[0])+3,y:l(Cu[1])-10,fill:R.accent,fontSize:`12`,fontWeight:`600`,children:`A`}),(0,K.jsx)(`text`,{x:c(o[0])+(r.id===`zero`?-17:8),y:l(o[1])+(r.id===`up`?-3:28),fill:R.success,fontSize:`12`,fontWeight:`600`,children:`B`})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,role:`group`,"aria-label":n(`选择 B 的走法`,`Choose B’s movement`),children:wu.map(e=>(0,K.jsx)(B,{className:`text-[11px]`,variant:r.id===e.id?`primary`:`ghost`,"aria-pressed":r.id===e.id,onClick:()=>i(e),"data-choice":e.id,children:t?e.zh:e.en},e.id))}),(0,K.jsxs)(`div`,{className:`mt-3`,"aria-live":`polite`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium text-ink`,"data-testid":`direction-count`,children:d}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:u})]}),(0,K.jsx)(`p`,{className:`mt-3 border-t border-line pt-2 text-[11px] leading-5 text-ink-faint`,children:n(`这里只统计这两支箭头提供的方向。找到一些独立方向,不等于已经找全研究对象的所有方向;图里的数字不能用来计算曲面的 Picard 数,也不能证明研究中的条件。`,`This counts only the directions supplied by these two arrows. Finding some independent directions does not establish that they span the whole research object. These numbers cannot determine a surface’s Picard number or prove the conditions used in the research.`)})]})}function Ou({path:e,identity:t,artifacts:n,onOpenArtifact:r}){let{locale:i}=F(),a=i===`zh-CN`,o={artifacts:n,onOpenArtifact:r};return(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-learning-path":t,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`理解这个问题`:`Understand the question`}),(0,K.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-question":!0,children:(0,K.jsx)(Ke,{...o,children:e.question})}),(0,K.jsx)(`ol`,{className:`mt-4 grid list-none gap-5 p-0`,children:e.steps.map((e,n)=>(0,K.jsxs)(`li`,{className:`min-w-0 border-t border-line/50 pt-3`,"data-learning-step":n+1,children:[(0,K.jsxs)(`h4`,{className:`mb-2 text-sm font-medium text-ink`,children:[(0,K.jsxs)(`span`,{className:`mr-2 text-ink-faint`,children:[n+1,`.`]}),e.title]}),(0,K.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-explanation":!0,children:(0,K.jsx)(Ke,{...o,children:e.explanation})}),(0,K.jsxs)(`div`,{className:`mt-3 border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-learning-example":!0,children:[(0,K.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`例子`:`Example`}),(0,K.jsx)(Ke,{...o,children:e.example})]}),(0,K.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,"data-learning-check":!0,children:[(0,K.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`小问题`:`Try it`}),(0,K.jsx)(`div`,{"data-learning-check-question":!0,children:(0,K.jsx)(Ke,{...o,children:e.check.question})}),(0,K.jsx)(nt,{label:a?`点击看解答`:`Show the answer`,children:(0,K.jsx)(`div`,{"data-learning-check-answer":!0,children:(0,K.jsx)(Ke,{...o,children:e.check.answer})})},`${e.check.question}:${e.check.answer}`)]})]},`${t}:${n}`))})]})}var ku=0,Au=(e,t,n=0)=>[`explanation-progress`,...e,t,n];function ju(e,t,n=0){return t?[t.id,`${t.id}:active`,`${t.id}:outcome`].includes(e??``)?typeof t.started_ts==`number`&&Number.isFinite(t.started_ts)&&t.started_ts>=0?t.started_ts:n:0:n}function Mu(e,t,n){let r=++ku,i=n.map(e=>Au(t,e.key,e.startedAt));for(let t of i)e.setQueryData(t,{requestId:r,phase:null});return{update:t=>{for(let n of i)e.setQueryData(n,e=>e?.requestId===r?{requestId:r,phase:t}:e)},finish:()=>{for(let t of i)e.setQueryData(t,e=>e?.requestId===r?null:e)}}}function Nu(e,t,n=0){let r=x({queryKey:Au(e,t??``,n),queryFn:async()=>null,initialData:null,enabled:!1,staleTime:1/0,gcTime:72e5});return{active:!!r.data,phase:r.data?.phase??void 0}}function Pu(e,t){return e?{waiting_for_source:[`等待开始整理说明`,`Waiting to prepare the explanation`],planning:[`正在梳理概念与讲解顺序`,`Organizing the concepts and explanation`],writing:[`正在撰写说明`,`Writing the explanation`],reviewing:[`正在核对说明与来源`,`Checking the explanation against its sources`]}[e][+!t]:t?`正在整理说明`:`Preparing an explanation`}function Fu({value:e,expandLabel:t,clamp:n=!0}){let[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(null),{locale:c}=F();return(0,U.useEffect)(()=>{let e=s.current;if(!e||!n||r)return;let t=()=>o(e.scrollHeight>e.clientHeight+1);t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,n,r]),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{ref:s,className:`text-[13px] leading-6 text-ink-dim ${!n||r?``:`line-clamp-3`}`,children:(0,K.jsx)(Ke,{children:e})}),n&&(a||r)?(0,K.jsxs)(`button`,{type:`button`,className:`mt-0.5 text-xs text-blue-sky hover:underline`,onClick:()=>i(!r),"aria-expanded":r,children:[r?c===`zh-CN`?`收起`:`Show less`:t,(0,K.jsx)(Me,{size:11,className:`ml-1 inline ${r?`rotate-180`:``}`})]}):null]})}function Iu({generatedAt:e,pending:t=!1,generating:n=!1,phase:r,hasExplanation:i=!1,error:a,unavailable:o=!1,retry:s,retryDisabled:c=!1}){let{locale:l}=F(),u=l===`zh-CN`,d=ft({ts:e}),f=d?.toLocaleString(l,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,p=!!a||o;return!(i&&(f||t))&&!n&&!p?null:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,"data-testid":`research-brief-status`,children:[i&&(f||t)?(0,K.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,children:[t?`${u?`上次说明`:`Previous explanation`}${f||!p?` · `:``}`:``,f?(0,K.jsx)(`time`,{dateTime:d?.toISOString(),title:d?.toLocaleString(l),children:f}):null,t&&!p?`${f?` · `:``}${u?`待更新`:`update pending`}`:``]}):null,p?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:a?u?`说明生成未完成;不会自动重复请求。`:`The explanation could not be prepared. This request will not be repeated automatically.`:u?`说明暂未更新;可以手动重试。`:`The explanation has not been updated yet. You can retry manually.`}),s?(0,K.jsxs)(B,{className:`inline-flex items-center gap-1 text-xs`,disabled:n||c,onClick:()=>void s(),children:[(0,K.jsx)(Pe,{size:12}),u?`重试`:`Retry`]}):null]}):n?(0,K.jsxs)(`span`,{role:`status`,"data-explanation-phase":r??`pending`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint`,children:[(0,K.jsx)(Ue,{}),Pu(r,u)]}):null]})}function Lu({brief:e,identity:t,detail:n,learningPath:r,foundation:i,readingUnavailable:a=!1,teachingUnavailable:o=!1,artifacts:s,onOpenArtifact:c}){let{locale:l}=F(),u=l===`zh-CN`,d=(e,t)=>u?e:t;return(0,K.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-4`,"data-reader-explanation":t,children:[i?(0,K.jsxs)(`div`,{className:`rounded border border-line/60 p-2 text-xs text-ink-dim`,"data-foundation-id":i.id,children:[(0,K.jsxs)(`p`,{children:[d(`这次进展参考的基础说明:`,`Foundations used to explain this progress: `),i.question]}),c?(0,K.jsx)(B,{className:`mt-1 text-xs`,onClick:()=>c(i.path),children:d(`阅读这份基础说明`,`Read these foundations`)}):null]}):null,a?(0,K.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`阅读说明还需要核对,可以继续问这一步。`,`The reading explanation still needs checking. You can keep asking about this step.`)}):o?(0,K.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`这个概念的说明还没核对清楚,可以继续问这一步。`,`The explanation of this concept has not been checked clearly yet. You can keep asking about this step.`)}):null,r?(0,K.jsx)(Ou,{path:r,identity:t,artifacts:s,onOpenArtifact:c},t):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-why":t,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`这一步为什么有用`,`Why this step helps`)}),(0,K.jsx)(Fu,{value:e.why,expandLabel:d(`完整说明`,`Full explanation`),clamp:!1},`why:${t}`)]}),e.concept?(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-teaching":t,children:[(0,K.jsxs)(`h3`,{className:`mb-3 text-xs font-medium text-ink`,children:[d(`认识一个概念`,`One useful concept`),` · `,e.concept.name]}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3`,"data-reader-teaching-columns":t,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,"data-reader-definition":t,children:[(0,K.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`定义`,`Definition`)}),(0,K.jsx)(Fu,{value:e.concept.explanation,expandLabel:d(`完整定义`,`Full definition`),clamp:!1},`concept:${t}:${e.concept.name}`)]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-testid":`concept-example`,children:[(0,K.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`例子`,`Example`)}),(0,K.jsx)(Ke,{artifacts:s,onOpenArtifact:c,children:e.concept.example})]}),Eu(e.concept)?(0,K.jsx)(nt,{label:d(`动手看两个方向`,`Try two directions`),children:(0,K.jsx)(Du,{})}):null]}),(0,K.jsxs)(`div`,{className:`min-w-0`,"data-reader-connection":t,children:[(0,K.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`与本步的关系`,`Connection to this step`)}),(0,K.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,children:(0,K.jsx)(Ke,{artifacts:s,onOpenArtifact:c,children:e.concept.connection})})]})]})]}):null]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`结论到哪里为止`,`What this does and does not establish`)}),(0,K.jsx)(Fu,{value:e.scope,expandLabel:d(`完整适用范围`,`Full scope`),clamp:!1},`scope:${t}`)]}),(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-next-interpretation":t,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`解说对后续的理解`,`How the explanation interprets the follow-up`)}),(0,K.jsx)(Fu,{value:e.next,expandLabel:d(`完整解读`,`Full interpretation`),clamp:!1},`next:${t}`)]}),n?(0,K.jsx)(nt,{className:`min-w-0`,label:d(`详细说明与条件`,`Detailed explanation and conditions`),children:(0,K.jsx)(`div`,{className:`macro-reader-markdown text-[13px] leading-6 text-ink-dim`,children:(0,K.jsx)(Ke,{artifacts:s,onOpenArtifact:c,children:n})})},`detail:${t}`):null]})}function Ru(e){if(!e||typeof e!=`object`)return!1;let t=e;return[`source_id`,`title`,`path`,`task_id`,`card_key`].every(e=>typeof t[e]==`string`&&String(t[e]).trim())&&Number.isFinite(t.generated_at)&&t.generated_at>=0&&Number.isSafeInteger(t.copy_revision)&&t.copy_revision>=0}var zu=(e,t)=>[`reader-foundation-choice`,e,t],Bu=(e,t)=>`argus:reader-foundation:${e}:${t}`,Vu=e=>[`artifacts`,e,`reader`],Hu=(e,t)=>[`reader-foundation-request`,e,t],Uu=(e,t)=>`${Bu(e,t)}:request`;function Wu(e,t){let n=gt(Bu(e,t));if(!n)return{id:null,choice:0};try{let e=JSON.parse(n);if((typeof e?.id==`string`||e?.id===null)&&Number.isSafeInteger(e.choice)&&e.choice>=0)return e}catch{}return{id:n,choice:0}}function Gu(e,t){try{let n=JSON.parse(gt(Uu(e,t))||`null`);return typeof n?.id==`string`&&typeof n.draft?.question==`string`&&typeof n.beforeChoice==`number`?n:null}catch{return null}}function Ku(e,t,n,r){e.setQueryData(Hu(t,n),r),ht(Uu(t,n),JSON.stringify(r))}function qu(e,t,n,r){let i=e.getQueryData(Hu(t,n)),a=Gu(t,n);i?.id===r&&(!a||a.id===r)&&Ku(e,t,n,null)}function Ju(e,t){return x({queryKey:Hu(e,t),queryFn:b,enabled:!1,initialData:()=>Gu(e,t),staleTime:1/0,gcTime:1/0}).data??null}function Yu(e,t,n,r){let i={id:r,choice:Xu(e,t,n).choice+1};return e.setQueryData(zu(t,n),i),ht(Bu(t,n),JSON.stringify(i)),i}function Xu(e,t,n){let r=e.getQueryData(zu(t,n)),i=Wu(t,n);return r&&r.choice>=i.choice?r:i}function Zu(e,t){return x({queryKey:zu(e,t),queryFn:b,enabled:!1,initialData:()=>Wu(e,t),staleTime:1/0,gcTime:1/0}).data}function Qu(e,t=ne()===`question-foundation`){return x({queryKey:Vu(e),queryFn:async({signal:t})=>(await P.artifacts(e,t,!0)).filter(e=>e.source===`reader_foundation`),enabled:!!e&&t,refetchInterval:e=>e.state.data?.some(e=>e.reader_foundation?.state===`generating`)?5e3:!1,retry:!1,refetchOnWindowFocus:!1})}function $u(e){let t=e.reader_foundation;return!!t&&(t.kind??`foundation`)===`foundation`&&!t.parent_id&&!t.progress_source}function ed(e,t,n=!0){let r=S(),i=Qu(e,n),a=Ju(e,t),o=[`reader-foundation-create`,e,t],s=w({filters:{mutationKey:o,status:`pending`},select:e=>e.state.variables?.id}),c=Nu(o,s.at(-1)??a?.id),l=n=>({sid:n.sid??e,locale:n.locale??t}),u=C({mutationKey:o,mutationFn:async e=>{let t=l(e),n=Mu(r,[`reader-foundation-create`,t.sid,t.locale],[{key:e.id}]);try{let r={request_id:e.id,question:e.draft.question.trim(),locale:t.locale},i=e.draft.parentId?await P.askReaderFoundation(t.sid,e.draft.parentId,r,n.update):await P.generateReaderFoundation(t.sid,{...r,...e.draft.progressSource?{progress_source:{source_id:e.draft.progressSource.source_id}}:e.draft.sourceTaskId?{source_task_id:e.draft.sourceTaskId}:{}},n.update),a=i.reader_foundation;if(a?.id!==e.id||a.locale!==t.locale)throw Error(t.locale===`zh-CN`?`说明请求的结果尚未确认。`:`The result of this explanation request is unconfirmed.`);if(e.draft.parentId&&(a.kind!==`clarification`||a.parent_id!==e.draft.parentId))throw Error(t.locale===`zh-CN`?`追问与来源说明的对应关系尚未确认。`:`The question’s connection to its source is unconfirmed.`);if(e.draft.progressSource&&(a.progress_source?.source_id!==e.draft.progressSource.source_id||!e.draft.parentId&&a.kind!==`progress_answer`))throw Error(t.locale===`zh-CN`?`回答与这版进展说明的对应关系尚未确认。`:`The answer’s connection to this progress explanation is unconfirmed.`);return i}finally{n.finish(),await r.invalidateQueries({queryKey:Vu(t.sid)})}},onSuccess:(e,t)=>{let n=l(t);!t.draft.parentId&&!t.draft.progressSource&&$u(e)&&e.exists&&e.reader_foundation?.state===`complete`&&Xu(r,n.sid,n.locale).choice===t.beforeChoice&&Yu(r,n.sid,n.locale,e.reader_foundation.id),r.setQueryData(Vu(n.sid),t=>{let n=t?.find(t=>t.path===e.path);return n&&n.reader_foundation?.state!==`generating`&&e.reader_foundation?.state===`generating`?t:[...(t??[]).filter(t=>t.path!==e.path),e]}),t.draft.progressSource||r.invalidateQueries({queryKey:[`map-copy`,`project`,n.sid]})},onError:(e,t)=>{if(e instanceof j&&e.code===`reader_source_unavailable`){let e=l(t);Ku(r,e.sid,e.locale,{...t,rejected:`reader_source_unavailable`})}},retry:!1}),d=(i.data??[]).filter(e=>e.reader_foundation?.locale===t),f=d.some(e=>e.reader_foundation?.state===`generating`),p=d.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),m=u.variables&&l(u.variables),h=m?.sid===e&&m.locale===t,g=h&&u.isPending||s.length>0||c.active,_=a?.id??(h?u.variables?.id:void 0),v=d.find(e=>e.reader_foundation?.id===_),y=v?.reader_foundation?.state===`failed`,b=v?.reader_foundation?.state===`complete`,x=a?.rejected===`reader_source_unavailable`,T=!!a&&!x&&!v&&!g,E=g||f||!!a&&!x||i.isPending||i.isError;return(0,U.useEffect)(()=>{a&&(y||b)&&qu(r,e,t,a.id)},[r,e,t,a,y,b]),{client:r,list:i,notes:d,pendingRequest:a,progress:c,generation:u,waiting:f,overdue:p,creating:g,requested:v,confirmedFailure:y,confirmedComplete:b,requestRejected:x,unknownResult:T,creationBlocked:E,submit:n=>{if(!n.question.trim()||E)return null;let i=crypto.randomUUID(),a={id:i,sid:e,locale:t,draft:{...n,...n.progressSource?{progressSource:{...n.progressSource}}:{}},beforeChoice:Xu(r,e,t).choice};return Ku(r,e,t,a),u.mutate(a),i},retrySavedRequest:n=>u.mutate({...n,sid:n.sid??e,locale:n.locale??t})}}var td=(0,U.createContext)(null);function nd({card:e,cardKey:t,taskId:n,readOnly:r=!1,context:i}){let a=(0,U.useContext)(td),o=F().locale===`zh-CN`,[s,c]=(0,U.useState)(`idle`),[l,u]=(0,U.useState)(!1),d=(0,U.useRef)(0),f=i??a?.context,p=JSON.stringify([a?.sid,a?.readOnly,r,f,t,n,e?.copy_revision,e?.generated_at,e?.title]),m=(0,U.useRef)(p);if(m.current=p,(0,U.useEffect)(()=>(c(`idle`),()=>{d.current+=1}),[p]),!a?.sid||a.readOnly||r)return null;let h=!!e&&Number.isSafeInteger(e.copy_revision)&&!!e.title?.trim()&&!(f?.preview===`question-foundation`&&!f.foundationId),g=async()=>{if(!h||!f||s===`opening`)return;let r=++d.current;c(`opening`);try{let i=await a.source(t,n,f);if(r!==d.current||m.current!==p)return;if(i&&(i.copy_revision!==e.copy_revision||i.generated_at!==e.generated_at||i.title!==e.title))throw new j(`The selected explanation has changed.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);c(`idle`),i&&a.open(i)}catch(e){r===d.current&&m.current===p&&(u(e instanceof j&&e.code===`reader_source_unavailable`),c(`failed`))}};return(0,K.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-1`,children:[(0,K.jsxs)(B,{className:`inline-flex items-center gap-1 text-xs`,disabled:!h||s===`opening`,title:h?void 0:o?`这一步的说明写好后就可以提问。`:`Questions open once this step has an explanation.`,"data-testid":`progress-question-trigger`,"data-progress-question-card":t,"data-progress-question-state":s,onClick:()=>void g(),children:[(0,K.jsx)(Ut,{size:12}),o?`问这一步`:`Ask about this step`]}),s===`failed`?(0,K.jsx)(`span`,{role:`alert`,className:`text-xs text-ink-dim`,children:l?o?`这版说明暂不可用或已变化,未打开提问。请刷新页面后再试。`:`This explanation is unavailable or has changed. No question was opened. Reload this page and try again.`:o?`暂时无法读取这一步的提问材料,未打开提问。请再试一次。`:`The question material could not be loaded. No question was opened. Please try again.`}):null]})}function rd({sid:e,path:t,artifacts:n,onOpenArtifact:r}){let i=F().locale===`zh-CN`,a=x({queryKey:[`reading-question-artifact`,e,t],queryFn:async({signal:n})=>{let r=await P.artifact(e,t,n);if(r.exists&&r.path===t&&(r.truncated||typeof r.preview!=`string`)){let i=await P.artifactBlob(e,t,!1,n);return{...r,preview:await i.text(),truncated:!1}}return r},retry:!1,staleTime:1/0,refetchOnWindowFocus:!1});return a.isPending?(0,K.jsx)(`p`,{className:`text-xs text-ink-faint`,children:i?`正在读取保存内容…`:`Loading saved reading…`}):a.isError||!a.data?.exists||a.data.path!==t?(0,K.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[i?`保存内容暂时无法读取。`:`The saved reading could not be loaded.`,(0,K.jsx)(B,{className:`ml-2 text-xs`,onClick:()=>void a.refetch(),children:i?`重新读取`:`Reload`})]}):(0,K.jsxs)(`div`,{className:`min-w-0 max-w-full overflow-x-auto break-words`,"data-reading-artifact-path":t,children:[(0,K.jsx)(Ke,{artifacts:[...n,...a.data.reader_foundation?.sources??[]],onOpenArtifact:r,children:a.data.preview??``}),a.data.truncated?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`此处显示保存内容的节选。`:`This view shows an excerpt of the saved reading.`}):null]})}function id({sid:e,readOnly:t=!1,children:n}){let r=F().locale,i=r===`zh-CN`?`zh-CN`:`en-US`,a=i===`zh-CN`,o=ed(e??``,i,!!e),s=Zu(e??``,i).id,c=(0,U.useRef)(0),l=async(t,n,r)=>{let i=++c.current,{preview:a,foundationId:o,locale:s}=r,l=await P.mapQuestionSource(e??``,{card_key:t,task_id:n,locale:s,...a?{preview:a}:{},...a===`question-foundation`&&o?{foundation_id:o}:{}});if(i!==c.current)return null;if(!Ru(l)||l.card_key!==t||l.task_id!==n||!l.path.startsWith(`reader-progress/${e}/`))throw new j(`The reading source does not match this step.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);return l},[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(null);(0,U.useEffect)(()=>(d(null),p(null),h(null),_(!1),y(null),()=>{c.current+=1}),[e,i]);let b=u&&u.sid===e&&u.locale===i?u:null,x=b?.source,S=o.notes.filter(e=>Ru(e.reader_foundation?.progress_source)),C=o.pendingRequest?.draft.progressSource?o.pendingRequest:null,w=new Map;for(let t of S){let n=t.reader_foundation.progress_source;n.path.startsWith(`reader-progress/${e}/`)&&w.set(n.source_id,n)}C?.draft.progressSource&&w.set(C.draft.progressSource.source_id,C.draft.progressSource),x&&w.set(x.source_id,x);let T=[...o.list.data??[],...[...w.values()].map(e=>({path:e.path}))],E=e=>{e===x?.path?(_(!0),y(null)):y(e)},D=x?S.filter(e=>e.reader_foundation.progress_source.source_id===x.source_id):[],O=D.find(e=>e.reader_foundation?.id===m),k=O?.exists&&O.reader_foundation?.state===`complete`,A=C?.draft.progressSource?.source_id===x?.source_id?C:null,M=A?D.find(e=>e.reader_foundation?.id===A.id):void 0,N=!!A&&A.rejected===`reader_source_unavailable`,I=!!A&&!N&&!M&&!o.creating,ee=n=>{c.current+=1;let r=n??C?.draft.progressSource??[...w.values()].at(-1);if(!e||!Ru(r)||!r.path.startsWith(`reader-progress/${e}/`))return;d({sid:e,locale:i,source:{...r}}),_(!1),y(null);let a=S.filter(e=>e.reader_foundation?.progress_source?.source_id===r.source_id).at(-1);h(a?.reader_foundation?.id??null),p(n&&!t?{question:``,progressSource:{...r}}:null)},te=()=>{d(null),p(null),h(null),_(!1),y(null)},L=t=>{e&&(d({sid:e,locale:i,source:{...t}}),h(null),_(!1),y(null),p(e=>e?{question:e.question,progressSource:{...t}}:null))},re=()=>{if(t||!b||!f?.progressSource||f.progressSource.source_id!==b.source.source_id||f.parentId&&!D.some(e=>e.reader_foundation?.id===f.parentId&&e.exists&&e.reader_foundation?.state===`complete`))return;let e=o.submit(f);e&&(h(e),p(null))},ie=!!A&&o.creating||D.some(e=>e.reader_foundation?.state===`generating`);return(0,K.jsxs)(td.Provider,{value:{sid:e??``,readOnly:t,hasHistory:w.size>0,open:ee,source:l,context:{locale:i,preview:ne(),foundationId:s}},children:[n,(0,K.jsx)(tt,{open:!!b,onClose:te,label:a?`进展阅读问答`:`Questions about this progress`,children:b&&x?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Qe,{title:a?`哪里还不明白`:`What is still unclear`,sub:x.title}),(0,K.jsxs)(`div`,{className:`space-y-4 px-6 pb-6`,"data-testid":`progress-questions`,"data-project-id":b.sid,"data-progress-source-id":x.source_id,"data-progress-source-title":x.title,"data-reader-card":x.card_key,"data-reader-task-id":x.task_id,children:[(0,K.jsxs)(`div`,{className:`rounded-lg border border-line/70 p-3 text-xs text-ink-dim`,children:[(0,K.jsxs)(`p`,{children:[a?`引用打开提问时的这版说明:`:`Using the explanation selected when this question was opened: `,x.title]}),(0,K.jsx)(`time`,{dateTime:new Date(x.generated_at*1e3).toISOString(),className:`mt-1 block text-ink-faint`,children:new Date(x.generated_at*1e3).toLocaleString(r)}),(0,K.jsx)(B,{className:`mt-2 text-xs`,"data-reading-source-path":x.path,onClick:()=>_(e=>!e),children:g?a?`收起原说明`:`Hide original explanation`:a?`阅读当时说明`:`Read the original explanation`}),g?(0,K.jsx)(`div`,{className:`mt-3 text-[13px] leading-6`,children:(0,K.jsx)(rd,{sid:b.sid,path:x.path,artifacts:T,onOpenArtifact:E})}):null]}),w.size>1?(0,K.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`查看已保存的进展问答`:`Saved progress questions`,(0,K.jsx)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:x.source_id,disabled:o.creating,onChange:e=>{let t=w.get(e.target.value);t&&L(t)},children:[...w.values()].map(e=>(0,K.jsxs)(`option`,{value:e.source_id,children:[e.title,` · `,new Date(e.generated_at*1e3).toLocaleString(r)]},e.source_id))})]}):null,D.length?(0,K.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`已保存的问题`:`Saved questions`,(0,K.jsxs)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:m??``,onChange:e=>{h(e.target.value||null),y(null)},children:[(0,K.jsx)(`option`,{value:``,children:a?`选择一个问题`:`Choose a question`}),D.map(e=>(0,K.jsx)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,children:yu(e.reader_foundation)},e.path))]})]}):null,O?(0,K.jsxs)(`section`,{className:`space-y-3 text-[13px] leading-6`,"data-reading-question-id":O.reader_foundation.id,children:[k?(0,K.jsx)(nt,{label:a?`查看这次问题`:`View this question`,children:(0,K.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-ink-dim`,children:O.reader_foundation.question})},O.reader_foundation.id):(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words font-medium`,children:O.reader_foundation.question}),k?(0,K.jsx)(rd,{sid:b.sid,path:O.path,artifacts:T,onOpenArtifact:E}):(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:O.reader_foundation.state===`generating`?a?`回答仍在整理,尚未确认结束。`:`The answer is still being prepared; completion is unconfirmed.`:a?`这次回答未完成,原问题已保留。`:`This answer did not finish; its question is retained.`}),!t&&O.exists&&O.reader_foundation.state===`complete`?(0,K.jsx)(B,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x},parentId:O.reader_foundation.id,parentTitle:yu(O.reader_foundation)}),children:a?`继续问这份回答`:`Ask a follow-up to this answer`}):null,!t&&O.reader_foundation.state===`failed`?(0,K.jsx)(B,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:O.reader_foundation.question,progressSource:{...x},parentId:O.reader_foundation.parent_id??void 0}),children:a?`重新编辑问题`:`Edit this question`}):null]}):null,v?(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border border-line/70 p-3 text-[13px] leading-6`,"data-referenced-reading-path":v,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-ink-faint`,children:[(0,K.jsx)(`span`,{children:a?`引用的保存内容`:`Referenced saved reading`}),(0,K.jsx)(B,{className:`text-xs`,onClick:()=>y(null),children:a?`收起引用`:`Close referenced reading`})]}),(0,K.jsx)(rd,{sid:b.sid,path:v,artifacts:T,onOpenArtifact:E})]}):null,ie?(0,K.jsx)(Iu,{generating:!0,phase:A?o.progress.phase:void 0}):null,A?(0,K.jsxs)(`div`,{className:`space-y-2 text-xs text-ink-faint`,"data-pending-reading-question":A.id,children:[(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:A.draft.question}),N?(0,K.jsx)(`p`,{role:`status`,children:a?`引用的说明目前不可用,这次追问未发起。问题与原来源已保留。`:`The reading source is unavailable, so this question was not started. Its question and original source are saved.`}):I?(0,K.jsx)(`p`,{role:`status`,children:a?`这次请求的结果尚未确认;刷新不会重新生成。`:`The result of this request is unconfirmed. Refreshing does not generate it again.`}):null,!t&&!o.creating&&!o.waiting?(0,K.jsx)(B,{className:`text-xs`,onClick:()=>{N?(p({...A.draft}),o.generation.reset()):o.retrySavedRequest(A)},children:N?a?`编辑问题与来源`:`Edit question and source`:a?`重试同一请求`:`Retry this same request`}):null]}):C&&o.creationBlocked?(0,K.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`另一个阅读请求尚未结束。`:`Another reading request is still unresolved.`,(0,K.jsx)(B,{className:`ml-2 text-xs`,onClick:()=>ee(),children:a?`查看原问题`:`View the original question`})]}):null,o.list.isError?(0,K.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`保存的问答暂时读取失败。`:`Saved questions could not be loaded.`,(0,K.jsx)(B,{className:`ml-2 text-xs`,onClick:()=>void o.list.refetch(),children:a?`重新读取`:`Reload`})]}):null,f&&!t?(0,K.jsxs)(`section`,{className:`border-t border-line/60 pt-3`,children:[f.parentId?(0,K.jsxs)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:[a?`继续引用这份回答:`:`Following up on this answer: `,f.parentTitle||D.find(e=>e.reader_foundation?.id===f.parentId)?.reader_foundation?.question]}):null,(0,K.jsx)(Su,{draft:f,onChange:p,onSubmit:re,disabled:o.creationBlocked})]}):t?null:(0,K.jsx)(B,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x}}),children:a?`问这版说明`:`Ask about this explanation`})]})]}):null})]})}var ad=[`manager`,`planner`,`engineer`,`reviewer`],od=new Set([`planner`,`engineer`,`reviewer`]),sd=new Set([`running`,`in_progress`,`claimed`]),$=(e,t)=>String(e[t]??``).trim(),cd=(e,t)=>{let n=Number(e[t]);return Number.isFinite(n)?n:null};function ld(e){return JSON.parse(JSON.stringify(e))}function ud(){return{schema_version:7,bootstrapped:!1,language:``,mission:{id:``,title:``,objective:``,summary:``,final_output:``,status:`idle`,started_at:null,completed_at:null,elapsed_seconds:0,campaign_started_at:null,campaign_elapsed_seconds:0},stage:{id:``,label:``},routing:{route:``,vertical:``,workflow_mode:``,lifetime:``,continuous:!1,open_ended:!1},round:{current:0,max:0},active_role:``,roles:ad.map(e=>({role:e,status:`waiting`,label:`Waiting`,updated_at:0})),role_work:[],dag:[],timeline:[],artifacts:[],learned_skills:[],learned_wiki_pages:[],storage:{project_skill_dir:``,global_skill_dir:``,project_skill_count:0,global_skill_count:0,skill_history_compressed:0,wiki_retired_compressed:0,skill_history_bytes_saved:0,wiki_retired_bytes_saved:0,wiki_paths:[]},achievement:null,review:{status:``,reason:``,rejected_attempts:0},frontier:{change:``,summary:``,updated_at:0},delivery:null,outcome:{},last_event_ts:0,updated_at:0}}function dd(e,t,n,r){if(n==null||n===``)return;let i=e.findIndex(e=>e[t]===n);i>=0?e[i]={...e[i],...r}:e.push(r)}function fd(e,t,n,r,i){if(!ad.includes(t))return;n===`active`&&od.has(t)&&e.roles.forEach(e=>{od.has(e.role)&&e.role!==t&&e.status===`active`&&Object.assign(e,{status:`done`,label:`Handed off`,updated_at:i})});let a={role:t,status:n,label:r,updated_at:i};dd(e.roles,`role`,t,a),n===`active`?e.active_role=t:e.active_role===t&&(e.active_role=``)}function pd(e,t,n,r,i=``,a=`neutral`){let o=we(t);if(e.timeline.some(e=>e.id===o))return;let s={id:o,ts:Number(t.ts??Date.now()/1e3),type:A(t.type),role:n,title:r.slice(0,180),detail:i.slice(0,500),tone:a};[`item_id`,`branch_id`].forEach(e=>{let n=$(t,e);n&&(s[e]=n)}),e.timeline=[...e.timeline,s].slice(-120)}function md(e,t,n,r,i,a=``,o=``){if(!ad.includes(n))return;let s=$(t,`message_id`),c=s?`${n}:${s}`:we(t),l=e.role_work.find(e=>e.id===c),u=l&&l.detail.length>a.length?l.detail:a,d={id:c,ts:Number(t.ts??Date.now()/1e3),role:n,kind:r,title:i.slice(0,240),detail:u.slice(0,4e3),status:o,item_id:$(t,`item_id`),mission_id:e.mission.id,mission_title:e.mission.title.slice(0,240),round_index:cd(t,`round_index`)},f=e.role_work.findIndex(e=>e.id===c);f>=0?e.role_work[f]=d:e.role_work.push(d);let p=new Set;ad.forEach(t=>{e.role_work.filter(e=>e.role===t).slice(-40).forEach(e=>p.add(e.id))}),e.role_work=e.role_work.filter(e=>p.has(e.id))}function hd(e){return e===`ok`?`success`:e===`err`?`error`:`info`}var gd={agent_message:`Reporting progress`,assistant_message:`Reporting progress`,command_execution:`Running a command`,reasoning:`Reasoning`,tool_use:`Using a tool`,tool_result:`Inspecting tool output`,codex_idle:`Waiting for model output`};function _d(e,t){let n=A(t.type),r=Number(t.ts??Date.now()/1e3);if(e.last_event_ts=Math.max(e.last_event_ts,r),n===L.LIFE_MANAGER_INTENT_STARTED)e.mission.id=$(t,`item_id`)||$(t,`intent_id`),e.mission.title=$(t,`objective`).slice(0,240),e.mission.objective=$(t,`objective`),e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`grounding`,fd(e,`manager`,`active`,`Grounding project`,r),pd(e,t,`manager`,`Project grounding started`,$(t,`objective`)),md(e,t,`manager`,`grounding`,`Grounding project`,$(t,`objective`),`active`);else if(n===L.LIFE_MANAGER_INTENT_COMPLETED){let n=$(t,`execution_task`)||$(t,`objective`);e.mission.id=$(t,`item_id`),e.mission.title=n.slice(0,240),e.mission.objective=n,e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`framed`,e.routing.route=$(t,`route`)||e.routing.route||`team`,e.routing.vertical=$(t,`vertical`)||e.routing.vertical,e.routing.workflow_mode=$(t,`workflow_mode`)||e.routing.workflow_mode,e.routing.lifetime=$(t,`lifetime`)||e.routing.lifetime,`continuous`in t&&(e.routing.continuous=t.continuous===!0),`open_ended`in t&&(e.routing.open_ended=t.open_ended===!0);let i=$(t,`current_stage`),a=Array.isArray(t.stages)?t.stages:[];if(i)e.stage={id:i,label:i.replaceAll(`_`,` `)};else if(!e.stage.id&&a[0]){let t=String(a[0]);e.stage={id:t,label:t.replaceAll(`_`,` `)}}fd(e,`manager`,`done`,`Goal framed`,r),pd(e,t,`manager`,`Goal framed`,$(t,`reason`),`success`),md(e,t,`manager`,`decision`,`Goal framed`,$(t,`reason`)||$(t,`execution_task`),`done`)}else if(n===L.LIFE_MANAGER_INTENT_FAILED)e.mission.status=`failed`,fd(e,`manager`,`error`,`Manager routing failed`,r),pd(e,t,`manager`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`),md(e,t,`manager`,`grounding`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`);else if(n===L.LIFE_MANAGER_STAGE_DECISION){let n=$(t,`target_stage`)||$(t,`stage`)||$(t,`current_stage`);n&&(e.stage={id:n,label:n.replaceAll(`_`,` `)}),fd(e,`manager`,`done`,n?`Stage · ${n}`:`Stage reviewed`,r),pd(e,t,`manager`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`)),md(e,t,`manager`,`stage_decision`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`),$(t,`action`))}else if(n===L.LIFE_PLANNER_START)fd(e,`planner`,`active`,`Planning next work`,r),md(e,t,`planner`,`planning`,`Planning next work`,$(t,`objective`),`active`);else if(n===L.LIFE_PLANNER_TASK_ADDED){let n=$(t,`item_id`),i={id:n,title:$(t,`title`),objective:$(t,`objective`),status:`pending`,deps:Array.isArray(t.deps)?t.deps.map(String):[],branch_id:$(t,`branch_id`)||n,parent_branch_id:$(t,`parent_branch_id`)||null};dd(e.dag,`id`,n,i);let a=e.routing.vertical===`research`?`Research branch added`:`Task added`;fd(e,`planner`,`done`,a,r),pd(e,t,`planner`,a,i.title,`info`),md(e,t,`planner`,`task`,i.title||`Task added`,i.objective,`pending`)}else if(n===L.LIFE_PLANNER_VERDICT){let n=!!t.project_done,i=n&&t.delivery&&typeof t.delivery==`object`&&!Array.isArray(t.delivery)?JSON.parse(JSON.stringify(t.delivery)):null,a=i?`Task completed`:n?`Project reviewed`:`Planning complete`;i&&(e.delivery=i,e.mission.status=`complete`,e.mission.summary=i.summary||``,e.mission.completed_at=r),fd(e,`planner`,`done`,a,r),pd(e,t,`planner`,a,$(t,`reason`),n?`success`:`neutral`),md(e,t,`planner`,`verdict`,a,$(t,`reason`),n?`done`:`planned`)}else if(n===L.LIFE_PLANNER_WAITING){fd(e,`planner`,`waiting`,`Waiting on external work`,r);let n=$(t,`reason`)||$(t,`waiting_reason`);pd(e,t,`planner`,`Planner waiting`,n),md(e,t,`planner`,`waiting`,`Planner waiting`,n,`waiting`)}else if(n===L.LIFE_MISSION_STARTED)e.review={status:``,reason:``,rejected_attempts:0},e.delivery=null,e.mission.campaign_started_at??=r,e.mission={...e.mission,id:$(t,`item_id`),title:$(t,`title`),objective:$(t,`objective`),summary:``,final_output:``,status:`working`,started_at:r,completed_at:null},fd(e,`reviewer`,`waiting`,`Waiting for the Engineer to finish`,r),fd(e,`engineer`,`active`,`Starting mission`,r),pd(e,t,`engineer`,`Mission started`,$(t,`title`),`info`),md(e,t,`engineer`,`task`,$(t,`title`)||`Mission started`,$(t,`objective`),`active`);else if(n===L.ROUND_START)e.round={current:cd(t,`round_index`)??0,max:cd(t,`round_max`)??e.round.max},fd(e,`engineer`,`active`,`Running round ${e.round.current}`,r),pd(e,t,`engineer`,`Round ${e.round.current} started`);else if(n===L.ENGINEER_PROGRESS){let n=$(t,`agent_layer`)||$(t,`actor`)||`engineer`,i=n===`main`?`engineer`:n,a=$(t,`kind`),o=gd[a]??`Working`;fd(e,i,`active`,o,r),i===`engineer`&&[`assistant_message`,`agent_message`,`message`].includes(a)&&t.final_delivery===!0&&e.mission.started_at!=null&&e.mission.completed_at==null&&r>=e.mission.started_at&&(!t.item_id||$(t,`item_id`)===e.mission.id)&&(e.mission.final_output=Te(t.text));let s=$(t,`action_summary`)||$(t,`text`);s&&!Ee(t)&&!te(t)&&md(e,t,i,a||`progress`,o,s,`active`),[`reasoning`,`assistant_message`,`agent_message`].includes(a)||pd(e,t,i,o,$(t,`action_summary`)||$(t,`text`))}else if(n===L.ROUND_MAIN_COMPLETED)fd(e,`engineer`,`done`,`Work ready for review`,r),md(e,t,`engineer`,`handoff`,`Work ready for review`,$(t,`text`)||$(t,`summary`),`done`);else if(n===L.ROUND_REVIEW_STARTED)e.review={status:``,reason:``,rejected_attempts:e.review.rejected_attempts},fd(e,`reviewer`,`active`,`Reviewing benchmark evidence`,r),md(e,t,`reviewer`,`review`,`Review started`,``,`active`);else if(n===L.ROUND_REVIEW_DEFERRED){let n=$(t,`next_step`);fd(e,`engineer`,`active`,`Continuing before review`,r),fd(e,`reviewer`,`waiting`,`Review deferred for one round`,r),pd(e,t,`engineer`,`Continued before review`,n,`info`)}else if(n===L.ROUND_REVIEW_COMPLETED){let n=t.review_skipped===!0,i=n?`skipped`:$(t,`status`),a=$(t,`reason`);e.review={status:i,reason:a,rejected_attempts:e.review.rejected_attempts+ +!![`continue`,`blocked`].includes(i)};let o=$(t,`frontier_change`);o&&(e.frontier={change:o,summary:$(t,`frontier_summary`),updated_at:r});let s=n?`No review this round`:i===`done`?`Evidence accepted`:`Attempt rejected`;fd(e,`reviewer`,n?`waiting`:i===`done`?`done`:`rejected`,n?s:i===`done`?`Accepted evidence`:`Requested another attempt`,r),pd(e,t,`reviewer`,s,a,n?`info`:i===`done`?`success`:`error`);let c=$(t,`next_action`);md(e,t,`reviewer`,n?`review`:`verdict`,s,c?`${a}\n\nNext action: ${c}`:a,i)}else if([L.SKILL_CREATED,L.SKILL_UPDATED].includes(n)){let i=$(t,`skill_id`)||$(t,`name`);i&&(dd(e.learned_skills,`id`,i,{id:i,name:$(t,`name`),version:cd(t,`version`)??1,scope:$(t,`scope`),path:$(t,`path`),status:`active`,updated_at:r,mission_id:e.mission.id,mission_title:e.mission.title}),pd(e,t,`reviewer`,n===L.SKILL_CREATED?`Capability unlocked`:`Capability upgraded`,$(t,`name`),`skill`))}else if(n===L.SKILL_EVOLUTION_COMPLETED)e.storage.project_skill_dir=$(t,`project_skill_dir`)||e.storage.project_skill_dir,e.storage.global_skill_dir=$(t,`global_skill_dir`)||e.storage.global_skill_dir,e.storage.project_skill_count=cd(t,`project_skill_count`)??e.storage.project_skill_count,e.storage.global_skill_count=cd(t,`global_skill_count`)??e.storage.global_skill_count;else if(n===L.SKILL_HISTORY_COMPRESSED)e.storage.skill_history_compressed+=cd(t,`count`)??0,e.storage.skill_history_bytes_saved+=cd(t,`bytes_saved`)??0;else if(n===L.SKILL_TIDIED){let n=$(t,`name`);if(n){let i=e.learned_skills.find(e=>e.name===n),a={source_path:$(t,`path`),source_placement:$(t,`placement`),source_vertical:$(t,`vertical`),updated_at:r};i?Object.assign(i,a):dd(e.learned_skills,`id`,n,{id:n,name:n,version:1,scope:``,path:``,status:`active`,...a}),pd(e,t,`manager`,`Capability promoted to source`,n,`skill`)}}else if([L.WIKI_INITIALIZED,L.WIKI_EVOLUTION_COMPLETED].includes(n)){let n=[...(Array.isArray(t.paths)?t.paths:[]).map(e=>String(e)),$(t,`path`)].filter(Boolean);e.storage.wiki_paths=[...new Set([...e.storage.wiki_paths,...n])]}else if(n===L.WIKI_RETIRED_COMPRESSED)e.storage.wiki_retired_compressed+=cd(t,`count`)??0,e.storage.wiki_retired_bytes_saved+=cd(t,`bytes_saved`)??0;else if([L.WIKI_CREATED,L.WIKI_UPDATED].includes(n)){let i=$(t,`page_id`);i&&(dd(e.learned_wiki_pages,`id`,i,{id:i,title:$(t,`title`)||i,card_type:$(t,`card_type`),status:$(t,`status`)||`scratch`,path:$(t,`path`),updated_at:r}),pd(e,t,`reviewer`,n===L.WIKI_CREATED?`Knowledge captured`:`Knowledge refined`,$(t,`title`)||i,`skill`))}else if(n===L.WIKI_RETIRED){let n=$(t,`page_id`);if(n){let i=e.learned_wiki_pages.find(e=>e.id===n);i?Object.assign(i,{status:`retired`,updated_at:r}):dd(e.learned_wiki_pages,`id`,n,{id:n,title:n,card_type:$(t,`card_type`),status:`retired`,path:``,updated_at:r}),pd(e,t,`reviewer`,`Knowledge retired`,n,`error`)}}else if([L.WIKI_PROMOTION_PROMOTED,L.WIKI_PROMOTION_DEMOTED].includes(n)){let i=$(t,`page_id`);if(i){let a=e.learned_wiki_pages.find(e=>e.id===i);a?Object.assign(a,{status:$(t,`to_status`),updated_at:r}):dd(e.learned_wiki_pages,`id`,i,{id:i,title:i,card_type:$(t,`card_type`),status:$(t,`to_status`),path:``,updated_at:r});let o=n===L.WIKI_PROMOTION_PROMOTED;pd(e,t,`reviewer`,o?`Knowledge promoted`:`Knowledge demoted`,`${i} → ${$(t,`to_status`)}`,o?`success`:`neutral`)}}else if(n===L.RESEARCH_ACHIEVEMENT_CERTIFIED)e.achievement={id:$(t,`achievement_id`),title:$(t,`title`),goal:$(t,`goal`),summary:$(t,`summary`),rejected_attempts:e.review.rejected_attempts,skills_learned:e.learned_skills.filter(e=>e.status===`active`).length,artifacts:e.artifacts.length,elapsed_seconds:e.mission.elapsed_seconds,evidence:Array.isArray(t.evidence)?t.evidence.map(String):[],reviewer_certified:!0,certified_at:r};else if([L.LIFE_MISSION_COMPLETED,L.LIFE_MISSION_FAILED].includes(n)){let i=n===L.LIFE_MISSION_FAILED?yi({...t,outcome_class:`failed`,status:$(t,`status`)||`failed`,success:!1}):yi(t),a=`final_output`in t?$(t,`final_output`):$(t,`item_id`)===e.mission.id&&e.mission.started_at!=null&&(e.mission.completed_at==null||e.mission.completed_at===r)&&e.mission.final_output||``;e.mission.id=$(t,`item_id`)||e.mission.id,e.mission.title=$(t,`title`)||e.mission.title,e.mission.objective=$(t,`objective`)||e.mission.objective,e.mission.summary=$(t,`summary`),e.mission.final_output=a,e.mission.status=i.missionStatus,e.mission.completed_at=r;let o=t.delivery;t.success===!0&&o&&typeof o==`object`&&!Array.isArray(o)?e.delivery=JSON.parse(JSON.stringify(o)):t.success!==!0&&(e.delivery=null),e.outcome=vi(t),fd(e,`engineer`,i.missionStatus===`complete`?`done`:i.missionStatus,i.label,r),pd(e,t,`engineer`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),hd(i.tone)),md(e,t,`engineer`,`completion`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),i.missionStatus)}return e.updated_at=Date.now()/1e3,e}function vd(e,t,n){let r=t.backlog.find(e=>sd.has(e.status)),i=t.backlog.find(e=>e.status===`pending`),a=t.backlog.find(t=>t.id===e.mission.id),o=r??a,s=!!(r||i||t.continuous?.enabled||t.continuous?.done_reason||t.continuous?.done_at||e.mission.id||![``,`idle`].includes(e.mission.status));t.continuous?.enabled&&(e.routing.route=e.routing.route||`team`,e.routing.continuous=!0,e.routing.open_ended=t.continuous.open_ended===!0,e.routing.lifetime=e.routing.open_ended?`standing`:e.routing.lifetime||`bounded`);let c=o?.objective||o?.title||(t.continuous?.enabled?t.continuous.objective:``)||t.session.objective||(e.mission.id?``:i?.objective)||(e.mission.id?``:i?.title)||e.mission.objective;c&&(e.mission.objective=c,o?e.mission.title=(o.title||c.split(` +`)[0]).slice(0,240):e.mission.title||(e.mission.title=c.split(` +`)[0].slice(0,240))),r?((r.id!==e.mission.id||r.started_ts!=null&&r.started_ts!==e.mission.started_at||e.mission.completed_at!=null)&&(e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=r.started_ts??null,e.mission.completed_at=null),e.mission.id=r.id,e.mission.status=`working`,e.mission.started_at=e.mission.started_at??r.started_ts??null):a?a.status===`pending`&&(e.mission.status=`queued`):t.continuous?.done_reason||t.continuous?.done_at?e.mission.status=`complete`:i||t.continuous?.enabled?e.mission.status=`queued`:t.daemon.alive&&(e.mission.status=`idle`),t.roles.forEach(t=>{t.active?fd(e,t.role,`active`,t.label||t.status||`Working`,Date.now()/1e3-(t.age_s??0)):s||fd(e,t.role,`waiting`,`Waiting`,Date.now()/1e3);let n=e.roles.find(e=>e.role===t.role);n&&Object.assign(n,{backend:t.backend,model:t.model,effort:t.effort})});let l=t.roles.filter(e=>e.active);l.length?e.active_role=l[l.length-1].role:s||(e.active_role=``),t.backlog.forEach(t=>{let n={id:t.id,title:t.title,objective:t.objective,status:t.status,deps:t.deps??[],branch_id:t.id,parent_branch_id:t.deps?.[0]??null,acceptance_check:t.acceptance_check??``,plan_hypothesis:t.plan_hypothesis??``,goal_contribution:t.goal_contribution??``,expected_regressions:t.expected_regressions??``,decision_rule:t.decision_rule??``,non_goals:t.non_goals??[]};dd(e.dag,`id`,n.id,n)});let u=o?.outcome?.execution_status?o.outcome:e.mission.id?void 0:[...t.backlog].filter(e=>e.outcome?.execution_status).sort((e,t)=>Number(e.finished_ts??0)-Number(t.finished_ts??0)).at(-1)?.outcome;return!r&&u&&(e.outcome=vi({outcome:u,status:`done`,success:!0})),n.forEach(t=>{dd(e.artifacts,`path`,t.path,{id:t.path,path:t.path,title:t.name,kind:t.kind,why:t.why,exists:t.exists,storage_path:t.storage_path,source:t.source})}),s}function yd(e,t,n,r){r||(t.roles.forEach(t=>{t.active||fd(e,t.role,`waiting`,`Waiting`,Date.now()/1e3)}),e.active_role=``);let i=Date.now()/1e3,a=e.mission.campaign_started_at??t.session.created??e.mission.started_at;a&&(e.mission.campaign_started_at=a,e.mission.campaign_elapsed_seconds=Math.max(0,i-a)),e.mission.started_at&&e.mission.status===`working`?e.mission.elapsed_seconds=Math.max(0,i-e.mission.started_at):e.mission.started_at&&e.mission.completed_at&&(e.mission.elapsed_seconds=Math.max(0,e.mission.completed_at-e.mission.started_at)),e.achievement?.reviewer_certified&&(e.achievement.elapsed_seconds=e.mission.elapsed_seconds,e.achievement.rejected_attempts=e.review.rejected_attempts,e.achievement.skills_learned=e.learned_skills.filter(e=>e.status===`active`).length,e.achievement.artifacts=n.filter(e=>e.exists).length)}function bd(e,t=[],n=[]){let r=e.mission_view?ld(e.mission_view):ud();r.storage??=ud().storage,r.storage.skill_history_compressed??=0,r.storage.wiki_retired_compressed??=0,r.storage.skill_history_bytes_saved??=0,r.storage.wiki_retired_bytes_saved??=0,r.learned_wiki_pages??=[],r.role_work??=[],r.delivery??=null,r.outcome??={};let i=r.last_event_ts,a=vd(r,e,n),o=[...t].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0));return o.filter(e=>e.ts==null||Number(e.ts)>i).forEach(e=>_d(r,e)),r.mission.final_output||(r.mission.final_output=xd(o,r.mission)),yd(r,e,n,a),r}function xd(e,t){if(!t.id||[`working`,`queued`,`grounding`,`framed`].includes(t.status))return``;let n=e.reduce(_d,ud()).mission;return n.id!==t.id||n.started_at==null||n.completed_at==null||t.started_at!=null&&n.started_at!==t.started_at||t.completed_at!=null&&n.completed_at!==t.completed_at?``:n.final_output||``}function Sd(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h ${r}m`:r?`${r}m`:`${t}s`}var Cd=`__argus_live_progress__`,wd=new Set([`framed`,`grounding`,`queued`,`running`,`in_progress`,`working`]),Td=new Set([`complete`,`completed`,`done`,`success`]);function Ed(e){return Td.has(String(e?.mission.status||``).toLowerCase())}function Dd(e){return(e??[]).filter(e=>e.source===`manager_live`)}function Od(e){return Dd(e).filter(e=>e.exists)[0]??null}function kd(e){let t=e??[],n={markdown:0,pdf:1,html:2,text:3,table:4,json:5,image:6,video:7,audio:8,binary:9},r=t.filter(e=>e.exists&&e.source===`delivery`),i=t.filter(e=>e.exists&&e.source===`manager_live`),a=t.filter(e=>e.exists&&e.source!==`manager_live`&&e.source!==`delivery`);return a.length||r.length?[...r,...[...a].sort((e,t)=>(n[e.kind]??99)-(n[t.kind]??99)),...i]:i}function Ad(e){return kd(e).find(e=>e.exists)??null}function jd(e){let t=kd(e);return t.find(e=>e.source===`delivery`)??t.find(e=>e.source!==`manager_live`)??t[0]??null}function Md(e){let t=e.path.split(`/`);return t[t.length-1]||e.path}function Nd(e,t){if(e){let n=String(e.mission.status||``).toLowerCase();if(wd.has(n))return Cd;let r=e.delivery?.primary_target?.path;if(r)return r;if(Ed(e))return jd(t)?.path??`__argus_live_progress__`;let i=Od(t);return i?i.path:Cd}return Ad(t)?.path??``}function Pd(e){let t=String(e.agent_layer??e.actor??``);if(t===`main`)return`engineer`;if(t)return t;let n=String(e.type??``);return n.startsWith(`round.review`)||n.startsWith(`reviewer`)?`reviewer`:n.startsWith(`life.planner`)?`planner`:n.startsWith(`life.manager`)||n.startsWith(`manager`)?`manager`:n.startsWith(`engineer`)||n.startsWith(`round.`)?`engineer`:``}function Fd(e,t=[],n,r=`en`){if(n&&Vr(n,e,t).state!==`running`||Ed(e))return null;let i=String(e?.active_role??``);if(!i)return null;let a=e?.roles.find(e=>e.role===i),o=``;for(let n=t.length-1;n>=0;--n){let r=t[n];if(e?.mission.id&&Ir(r)!==e.mission.id||e?.mission.started_at&&Number(r.ts||0)k(e,{},r)):i,label:a?.label||`Working`,detail:o}}function Id({view:e,artifacts:t=[],onOpenArtifact:n,routeVisible:r,snapshot:i,connected:a}){let{locale:o,t:s}=F(),c=e.dag.filter(e=>[`done`,`completed`].includes(e.status)).length,l=[...t].filter(e=>e.exists&&e.source!==`manager_live`).sort((e,t)=>Number(t.mtime??0)-Number(e.mtime??0)).slice(0,4),u=e=>[`running`,`in_progress`,`claimed`].includes(e),d=a&&i?.daemon.alive!==!1,f=e=>e===`done`?`text-ok`:u(e)?`text-blue-sky`:[`failed`,`blocked`,`rejected`].includes(e)?`text-err`:`text-ink-faint`;return(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 text-sm text-ink-dim scroll-thin`,children:[(0,K.jsx)(`section`,{className:`rounded-lg border border-blue-deep/30 bg-blue-deep/10 p-4`,children:(0,K.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.stage`)}),(0,K.jsx)(`dd`,{className:`mt-1 text-sm font-medium text-blue-sky`,children:Zi(e.stage.id,o)===e.stage.id?e.stage.label||e.stage.id||`—`:Zi(e.stage.id,o)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.totalTime`)}),(0,K.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:Sd(e.mission.campaign_elapsed_seconds)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.round`)}),(0,K.jsxs)(`dd`,{className:`mt-1 text-sm text-ink`,children:[e.round.current||`—`,e.round.max?` / ${e.round.max}`:``]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.dagProgress`)}),(0,K.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:ea(c,e.dag.length,o)})]})]})}),r&&e.dag.length?(0,K.jsxs)(`section`,{className:`mt-5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:s(`mission.researchDag`)}),(0,K.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.dag.map(e=>(0,K.jsx)(`li`,{className:`rounded-md border border-line/60 bg-panel px-3 py-2.5`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,"aria-hidden":`true`,children:e.status===`done`?`✓`:d&&u(e.status)?`●`:`○`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium leading-5 text-ink`,children:(0,K.jsx)(Ke,{children:e.title})}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,children:!d&&u(e.status)?a?o===`zh-CN`?`当前未在运行`:`Not currently running`:o===`zh-CN`?`断连前记录:进行中`:`Last received state: in progress`:oa(e.status,o)})]})]})},e.id))})]}):null,l.length?(0,K.jsxs)(`section`,{className:`mt-5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:o===`zh-CN`?`已生成的文件`:`Files produced so far`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o===`zh-CN`?`文件已生成,结论是否成立仍以核验记录为准。`:`A saved file is not a verification of its conclusions.`}),(0,K.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:l.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),title:e.storage_path||e.path,className:`rounded border border-line/70 bg-panel px-2.5 py-1.5 font-mono text-xs text-blue-sky hover:border-blue/60`,children:[Md(e),` ↗`]},e.path))})]}):null]})}function Ld({sid:e,artifacts:t,error:n=!1,onExpand:r,onOpenFile:i,className:a=``,embedded:o=!1,onCollapse:c,missionView:l,activityEvents:u=[],requestedPath:d,requestedPathToken:p,routeVisible:m=!0,snapshot:h,connected:g=!0}){let{t:_,locale:v}=F(),y=(0,U.useMemo)(()=>kd(t),[t]),b=(0,U.useMemo)(()=>Ad(t),[t]),x=Ed(l),S=(0,U.useMemo)(()=>{if(!x)return null;let e=l?.delivery?.primary_target?.path;return y.find(t=>t.path===e&&t.exists)??jd(t)},[t,x,l?.delivery?.primary_target?.path,y]),[C,w]=(0,U.useState)(null);(0,U.useEffect)(()=>{w(x&&S?S.path:null)},[x,S?.path,l?.mission.id,e]),(0,U.useEffect)(()=>{if(!d)return;let e=y.find(e=>e.path===d&&e.exists);e&&w(e.path)},[y,d,p]);let T=e=>{w(e),e!==`__argus_live_progress__`&&i?.()},E=C??Nd(l,t),D=E===Cd,O=D?null:y.find(e=>e.path===E)??(x?S:b),k=de(e,O?.exists?O.path:null,O?.mtime??null),A=k.data,j=A?vu(A):!1,[M,N]=(0,U.useState)(null),[I,ee]=(0,U.useState)(``),[te,L]=(0,U.useState)(!1),[ne,re]=(0,U.useState)(``),ie=(0,U.useMemo)(()=>g?Fd(l,u,h,v):null,[u,l,h,g,v]);(0,U.useEffect)(()=>{if(N(null),ee(``),!e||!O||!A||![`image`,`pdf`,`audio`,`video`].includes(A.kind))return;let t=!0,n=``,r=new AbortController;return P.artifactBlob(e,O.path,!1,r.signal).then(e=>{t&&(n=URL.createObjectURL(e),N(n))},e=>t&&ee(e.message)),()=>{t=!1,r.abort(),n&&URL.revokeObjectURL(n)}},[e,O?.path,A?.kind,A?.mtime]);let ae=l?.delivery??null,oe=ae?.primary_target?.path??``,se=!!(x&&!D&&O&&(O.source===`delivery`||O.path===oe)),ce=v===`zh-CN`?ae?.kind===`submission_certified`?`交付已认证`:`已完成`:ae?.kind===`submission_certified`?`Certified delivery`:`Delivered result`,le=se?ce:D?_(`research.liveProgress`):y[0]?.group_title||_(`research.artifact`),ue=async()=>{if(!(!e||!O)){L(!0),re(``);try{let t=await P.artifactBlob(e,O.path,!0);$e(t,O.name)}catch(e){re(e.message)}finally{L(!1)}}};return(0,K.jsxs)(`section`,{className:`glass-panel glass-panel--side flex min-h-0 flex-col overflow-hidden ${o?``:`rounded-lg border`} ${a}`,"aria-label":_(`research.canvas`),children:[(0,K.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-line/50 bg-panel px-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full ${se?`bg-ok`:ie?`animate-pulse bg-blue`:`bg-ink-faint/60`}`}),(0,K.jsx)(`h2`,{className:`max-w-24 truncate text-sm font-semibold text-ink sm:max-w-48`,children:le})]}),l||y.length>0?(0,K.jsxs)(`label`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:_(`research.previewArtifact`)}),(0,K.jsxs)(`select`,{value:D?Cd:O?.path??``,onChange:e=>T(e.target.value),title:D?_(`research.liveProgress`):O?.storage_path||O?.path,className:`h-8 w-full min-w-0 max-w-64 truncate rounded-md border border-line/50 bg-bg px-2 font-mono text-xs text-ink-dim outline-none focus:border-blue/60`,children:[l?(0,K.jsx)(`option`,{value:Cd,children:_(`research.liveProgress`)}):null,y.map(e=>(0,K.jsxs)(`option`,{value:e.path,disabled:!e.exists,title:e.storage_path||e.path,children:[e.source===`delivery`?`${_(`research.optionDelivery`)} · `:``,Md(e),e.exists?``:` · ${_(`research.optionPending`)}`]},e.path))]})]}):(0,K.jsx)(`div`,{className:`flex-1`}),(0,K.jsx)(`div`,{className:`shrink-0`,children:O?(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>void ue(),disabled:te||!O.exists,title:_(`artifact.download`),"aria-label":_(`artifact.download`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink disabled:opacity-40`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,K.jsx)(`path`,{d:`M8 2.25v7.5M5.25 7.5 8 10.25 10.75 7.5M3 13.25h10`})})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(O.path),title:_(`research.openLarge`),"aria-label":_(`research.openLarge`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,K.jsx)(`path`,{d:`M6 3H3v3M10 3h3v3M6 13H3v-3M10 13h3v-3`})})})]}):null}),c?(0,K.jsx)(`button`,{type:`button`,onClick:c,"aria-label":_(`research.collapse`),title:_(`research.collapse`),className:`hidden h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink lg:flex`,children:(0,K.jsx)(s,{icon:f,className:`h-3.5 w-3.5`})}):null]}),h?(0,K.jsx)(zs,{snapshot:h,view:l,events:u,connected:g,compact:!0}):ie?(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-line/50 bg-blue-deep/10 px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(`span`,{"data-role-dot":ie.role,className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:R.role[ie.role]??R.inkFaint},"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`font-semibold text-ink`,children:ie.roleLabel}),(0,K.jsx)(`span`,{className:`text-blue-sky`,children:_(`mission.active`)}),(0,K.jsxs)(`span`,{className:`truncate text-ink-faint`,children:[`· `,ia(ie.label,v,{kind:l?.roles.find(e=>e.role===ie.role)?.kind,language:l?.language})]})]}),ie.detail?(0,K.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-ink-dim`,children:ie.detail}):null]}):null,(0,K.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col bg-bg`,children:[D&&l?(0,K.jsx)(Id,{view:l,artifacts:t,onOpenArtifact:T,routeVisible:m,snapshot:h,connected:g}):null,!D&&n?(0,K.jsx)(`div`,{className:`m-auto max-w-sm px-6 text-center text-sm text-warn`,children:_(`research.unavailable`)}):null,!D&&!n&&y.length===0?(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,K.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,K.jsx)(`h3`,{className:`mt-3 text-xs text-ink-faint`,children:_(`research.noPreview`)})]}):null,!D&&!n&&y.length>0&&!O?(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,K.jsx)(Ue,{}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:_(`research.waiting`)})]}):null,O&&!O.exists?(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,K.jsx)(Ue,{}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:_(`research.updating`)})]}):null,O?.exists&&k.isLoading?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,O?.exists&&k.isError?(0,K.jsxs)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:[_(`artifact.unavailable`),` · `,k.error.message]}):null,A?.kind===`text`&&!j?(0,K.jsxs)(`pre`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:[A.preview||`(empty file)`,A.truncated?` + +… live preview truncated · expand to inspect the complete file`:``]}):null,A&&j?(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-5 text-sm text-ink-dim scroll-thin`,children:(0,K.jsx)(Ke,{sid:e,basePath:A.path,artifacts:t,onOpenArtifact:T,children:A.preview||`(empty file)`})}):null,A?.kind===`json`?(0,K.jsx)(cu,{value:A.preview||``}):null,A?.kind===`table`?(0,K.jsx)(lu,{value:A.preview||``,delimiter:A.name.endsWith(`.tsv`)?` `:`,`}):null,A?.kind===`html`&&!A.truncated?(0,K.jsx)(iu,{sid:e,path:A.path,html:A.preview||``,title:`Live HTML preview: ${A.name}`}):null,A?.kind===`html`&&A.truncated?(0,K.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-warn`,children:_(`artifact.htmlTooLarge`)}):null,A?.kind===`image`&&M?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4`,children:(0,K.jsx)(`img`,{src:M,alt:A.why||A.name,className:`max-h-full max-w-full object-contain`})}):null,A?.kind===`pdf`&&M?(0,K.jsx)(_u,{src:M,name:A.name}):null,A?.kind===`audio`&&M?(0,K.jsx)(`div`,{className:`m-auto w-full max-w-xl px-6`,children:(0,K.jsx)(`audio`,{controls:!0,preload:`metadata`,src:M,className:`w-full`})}):null,A?.kind===`video`&&M?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-2`,children:(0,K.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:M,className:`max-h-full max-w-full`})}):null,A?.kind===`binary`?(0,K.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-ink-dim`,children:_(`research.fileUnavailable`)}):null,A&&[`image`,`pdf`,`audio`,`video`].includes(A.kind)&&!M&&!I?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,I?(0,K.jsx)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:I}):null]}),!D&&A?(0,K.jsxs)(`footer`,{className:`flex h-9 items-center gap-2 border-t border-line px-4 font-mono text-xs text-ink-faint`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:A.storage_path||A.path,children:A.path}),ne?(0,K.jsx)(`span`,{className:`ml-auto truncate text-err`,title:ne,children:_(`research.downloadFailed`)}):null,(0,K.jsx)(`span`,{className:`shrink-0`,children:ct(A.size)})]}):null]})}function Rd({notice:e,onClose:t}){if((0,U.useEffect)(()=>{if(!e)return;let n=window.setTimeout(t,e.tone===`error`?8e3:4e3);return()=>window.clearTimeout(n)},[e,t]),!e)return null;let n=e.tone===`error`?`border-err/60 bg-err/10 text-err`:e.tone===`success`?`border-ok/60 bg-ok/10 text-ok`:`border-blue-deep/60 bg-panel text-blue-sky`;return(0,K.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,"aria-live":e.tone===`error`?`assertive`:`polite`,className:`fixed bottom-4 left-4 right-4 z-[70] flex items-start gap-2 rounded-md border px-3 py-2.5 shadow-glow sm:left-auto sm:max-w-md ${n}`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0`,children:e.tone===`error`?`!`:e.tone===`success`?`✓`:`i`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-xs leading-relaxed text-ink-dim`,children:e.message}),(0,K.jsx)(`button`,{type:`button`,"aria-label":`dismiss notification`,onClick:t,className:`shrink-0 rounded px-1 text-base leading-none opacity-70 hover:bg-white/5 hover:opacity-100`,children:`×`})]})}function zd({open:e,sid:t,name:n,alive:r,controlAvailable:i=!0,busy:a,onClose:o,onRename:s,onStart:c,onStop:l,onDelete:u}){let{t:d}=F(),[f,p]=(0,U.useState)(n),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1);(0,U.useEffect)(()=>{e&&(p(n),h(!1),_(!1))},[e,n,t]);let v=async e=>{e.preventDefault(),await s(f.trim())},y=r&&!g,b=async()=>{if(y){await l()&&_(!0);return}await c()&&_(!1)};return(0,K.jsxs)(tt,{open:e,onClose:()=>!a&&o(),label:d(`manage.daemon`),width:`max-w-lg`,children:[(0,K.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-ink`,children:d(`topbar.manageSession`)}),(0,K.jsx)(`p`,{className:`mt-0.5 font-mono text-[10px] text-ink-faint`,children:t})]}),(0,K.jsx)(`form`,{onSubmit:e=>void v(e),className:`border-b border-line p-5`,children:(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.displayName`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),maxLength:80,disabled:a,className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg/50 px-3 text-sm text-ink outline-none focus:border-blue-deep disabled:opacity-50`}),(0,K.jsx)(`button`,{type:`submit`,disabled:a||f.trim()===n,className:`rounded border border-line px-3 text-xs text-ink-dim hover:bg-surface disabled:opacity-40`,children:d(`common.save`)})]})]})}),(0,K.jsxs)(`div`,{className:`border-b border-line p-5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.executor`)}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center justify-between rounded border border-line bg-bg/30 p-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm text-ink`,children:d(y?i?`manage.running`:`manage.runningExternally`:`manage.paused`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:d(y?i?`manage.stopNowHint`:`manage.externalHint`:`manage.resumeHint`)})]}),(0,K.jsx)(`button`,{type:`button`,disabled:a||!i,onClick:()=>void b(),className:`rounded border px-3 py-1.5 text-xs disabled:cursor-wait disabled:opacity-50 ${y?`border-warn/50 text-warn hover:bg-warn/10`:`border-blue-deep bg-blue-deep text-white hover:bg-blue-deep/80`}`,children:d(a?`manage.working`:i?y?`manage.stopNow`:`manage.resume`:`common.external`)})]})]}),(0,K.jsxs)(`div`,{className:`p-5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:d(`manage.deleteSession`)}),(0,K.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-ink-faint`,children:d(`manage.deleteHint`)}),m?(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded border border-err/40 bg-err/5 p-3`,children:[(0,K.jsx)(`span`,{className:`text-xs text-ink-dim`,children:d(`manage.confirmQuestion`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`rounded px-2 py-1 text-xs text-ink-faint hover:bg-surface`,children:d(`common.cancel`)}),(0,K.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void u(),className:`rounded bg-err px-3 py-1 text-xs font-medium text-bg disabled:opacity-50`,children:d(`manage.confirmDelete`)})]})]}):(0,K.jsx)(`button`,{type:`button`,disabled:a||y,onClick:()=>h(!0),className:`mt-3 rounded border border-err/40 px-3 py-1.5 text-xs text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-40`,children:d(`manage.delete`)})]})]})}var Bd={科学环境已就绪:`Scientific environment ready`,更新科学环境校验:`Update scientific environment checks`,验证科学环境依赖和关键模块:`Validating scientific dependencies and required modules`,"科学环境 · 上次检查结果":`Scientific environment · previous check`,"下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。":`The results below predate this operation. Refer to the latest error above or check the environment again.`,"科学环境 · ⟦0⟧ 项待配置":`Scientific environment · ⟦0⟧ item(s) to configure`,科学环境:`Scientific environment`,检查环境:`Check environment`,"免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。":`Free scientific components are configured automatically; SHELX requires academic authorization from the official website before entering download credentials.`,修复依赖:`Repair dependencies`,"继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。":`Confirm the official PLATON license before continuing. The same installation or repair action will prepare the complete runtime; no separate repair button is required.`,同意并继续:`Agree and continue`,"请先确认 PLATON 使用许可,再继续安装或修复依赖。":`Confirm the PLATON license before installing or repairing dependencies.`,依赖修复完成:`Dependency repair complete`,依赖修复未完成:`Dependency repair incomplete`,环境操作未完成:`Environment operation incomplete`,"依赖修复未完成:⟦0⟧。请查看组件检查结果;不会报告修复成功。":`Dependency repair is incomplete: ⟦0⟧. Check the component results; this is not reported as a successful repair.`,"PLATON 已可用,保留当前安装。":`PLATON is already available; keeping the existing installation.`,"准备 PLATON 官方环境":`Prepare official PLATON runtime`,"下载、验证并配置":`Download, verify and configure`,"我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。":`I confirm that my use complies with the official PLATON license; for commercial use, I have obtained separate authorization.`,"PLATON 官方允许注明来源的学术、科学及非商业用途;商业用途需自行取得许可。本操作只从官方网站下载到插件私有目录,不安装系统运行库、不修改系统 PATH。":`The publisher permits acknowledged academic, scientific and non-commercial use of PLATON; commercial use requires a separate license. This downloads from official sites into the plugin's private directory, without installing system runtimes or changing the system PATH.`,"PLATON 缺少 Windows Salford 运行库(0xC0000135)。请点击“修复依赖”,确认许可后会在同一流程准备完整运行环境。":`PLATON is missing the Windows Salford runtime (0xC0000135). Click Repair dependencies and confirm the license to prepare the complete runtime in the same action.`,"正在校验 PLATON 官方程序与 Windows 配套运行环境…":`Verifying the official PLATON program and Windows runtime…`,"正在提取官方 Salford 运行库(不执行系统安装程序)…":`Extracting the official Salford runtime without executing the system installer…`,"正在实际运行 PLATON,验证 Windows 运行库和校验规则…":`Running PLATON to verify the Windows runtime and validation rules…`,"PLATON 官方 Windows 运行环境验证通过。":`The official PLATON Windows runtime passed verification.`,"PLATON 官方运行环境已可用,保留当前安装。":`The official PLATON runtime is already available; keeping the existing installation.`,"配置 SHELX":`Configure SHELX`,"SHELX 授权安装":`SHELX authorized installation`,学术授权:`Academic authorization`,前往官网申请:`Apply on official website`,"填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。":`Enter the username and password from the authorization email to download and install automatically. Credentials are used only for this official download, are not saved, and are not sent to the model.`,用户名:`Username`,"SHELX 用户名":`SHELX username`,密码:`Password`,"SHELX 密码":`SHELX password`,"查看许可 ↗":`View license ↗`,"下载并安装 SHELX":`Download and install SHELX`,取消:`Cancel`,科学软件健康检查:`Scientific software health check`,"点击“检查环境”可验证科学内核与外部程序。":`Click “Check environment” to verify the scientific kernel and external programs.`,可用:`Available`,待授权安装:`Authorization required`,待修复:`Needs repair`,查看检查详情:`View check details`,查看原因与安装方式:`View cause and installation method`,"官方安装说明 ↗":`Official installation instructions ↗`,使用已有安装:`Use existing installation`,"DIALS 环境目录":`DIALS environment directory`,"Systre JAR 路径(需要已有 Java)":`Systre JAR path (existing Java required)`,"⟦0⟧ 可执行文件路径":`⟦0⟧ executable path`,"填写运行 Argus 的电脑上的路径,验证成功后生效。":`Enter the path on the computer running Argus. It takes effect after successful verification.`,验证并使用:`Verify and use`,最近检查:`Last checked`,"· 检查不调用模型":`· Check does not call the model`,无法读取插件列表:`Unable to read plugin list`,插件操作未完成:`Plugin operation incomplete`,插件:`Plugins`,关闭插件列表:`Close plugin list`,"按需安装研究工具,沿用 Argus 的模型与执行后端。":`Install research tools as needed, using Argus's model and execution backend.`,"正在读取插件…":`Reading plugins…`,暂无可用插件:`No plugins available`,已启用:`Enabled`,已停用:`Disabled`,未安装:`Not installed`,"· 当前后端":`· Current backend`,安装:`Install`,打开工作台:`Open workbench`,启用:`Enable`,更新至:`Update to`,停用:`Disable`,卸载:`Uninstall`,"原生会话输入 ⟦0⟧ 可启用后台工具。卸载保留会话、研究数据和科学软件。":`Native session input ⟦0⟧ can enable background tools. Uninstalling preserves sessions, research data, and scientific software.`,"首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。":`First installation automatically configures standalone Python, DIALS, Systre / Java, and free academic PLATON components. SHELX can be installed later by entering authorization details.`,"暂不支持,敬请期待。当前插件支持 Codex、Copilot 和 Pi。":`Not supported yet. Stay tuned. Current plugins support Codex, Copilot, and Pi.`,"安装科学环境需要 Python 3.11–3.13。请安装 Python 后重试,或设置 ARGUS_PLUGIN_PYTHON。":`Installing the scientific environment requires Python 3.11–3.13. Install Python and try again, or set ARGUS_PLUGIN_PYTHON.`,准备安装:`Prepare installation`,获取并校验插件包:`Download and verify plugin package`,"安装独立运行环境(首次可能需要几分钟)":`Install standalone environment (may take several minutes the first time)`,"插件仍有任务运行,请等任务结束或先暂停,再进行此操作。":`This plugin still has running tasks. Wait for them to finish or pause them before continuing.`,"此插件版本尚未提供可校验的发行包。":`No verifiable release package is available for this plugin version.`,"插件包校验失败,未安装。":`Plugin package verification failed. Not installed.`,正在准备:`Preparing`,"当前系统或 Argus 插件接口版本暂不支持此插件。":`This plugin is not currently supported by the system or Argus plugin API version.`,"插件发行包尚未发布。":`The plugin release package has not been published.`,安装完成:`Installation complete`,环境检查完成:`Environment check complete`,"此插件已有安装或更新操作正在进行。":`An installation or update operation for this plugin is already in progress.`,插件尚未安装:`Plugin not installed`,"安装进程已中断;已有可用版本保持不变,可重试。":`Installation was interrupted. The existing available version is unchanged; you can retry.`,"安装未完成,已有版本保持不变":`Installation incomplete; existing version unchanged`,"此版本已安装,可启用插件。":`This version is installed. You can enable the plugin.`,请先安装插件:`Install the plugin first`,请先更新插件以使用环境管理功能:`Update the plugin first to use environment management`,"插件包超过允许大小。":`The plugin package exceeds the allowed size.`,科学计算内核:`Scientific computing kernel`,"cctbx · Gemmi · RDKit · 科学服务":`cctbx · Gemmi · RDKit · scientific services`,衍射帧处理与探测器格式支持:`Diffraction frame processing and detector format support`,周期网络与拓扑识别:`Periodic networks and topology identification`,"本地 checkCIF 结构校验 · 学术免费":`Local checkCIF structure validation · free for academic use`,"结构精修 · 需要学术授权":`Structure refinement · academic authorization required`,"结构求解 · 需要学术授权":`Structure solution · academic authorization required`,全部组件可用:`All components available`,部分组件需要配置或修复:`Some components require configuration or repair`,"PLATON 官网中间证书已更换,请更新插件安装器":`The PLATON official-site intermediate certificate has changed. Update the plugin installer.`,"PLATON Mac 发行包架构不符":`PLATON Mac release package architecture mismatch`,"请输入授权邮件中的用户名和密码。":`Enter the username and password from the authorization email.`,请选择有效的科学软件路径:`Select a valid scientific software path`,检查科学软件与运行环境:`Check scientific software and runtime environment`,"正在修复科学 Python 依赖":`Repairing scientific Python dependencies`,"(首次下载可能需要几分钟)":`(The initial download may take several minutes)`,"from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('科学内核及工作台资源可用')":`from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('Scientific kernel and workbench resources available')`,"; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · 探测器格式插件可用')":`; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · detector format plugins available')`,"Systre 19.6.0 · pcu 拓扑计算通过":`Systre 19.6.0 · pcu topology calculation passed`,"正在安装 Apple Rosetta 2 兼容组件":`Installing Apple Rosetta 2 compatibility components`,"从 SHELX 官方站点下载":`Downloading from the official SHELX site`,"SHELX 下载内容不是支持的可执行程序":`SHELX download is not a supported executable`,"已可用,保留当前安装":`Already available; keeping current installation`,正在安装:`Installing`,"尚未安装 DIALS":`DIALS is not installed`,"PLATON 编译需要 Apple 命令行工具;请运行 xcode-select --install,然后点击修复依赖。":`PLATON compilation requires Apple Command Line Tools; run xcode-select --install, then click Repair dependencies.`,"SHELX 官方 Mac 版需要 Rosetta 2,请先同意安装兼容组件。":`The official Mac version of SHELX requires Rosetta 2. Agree to install the compatibility components first.`,"暂未完成;可在健康检查中重试":`Not completed; retry from the health check`,"SHELX 下载或启动失败;请核对授权、网络及系统平台后重试。":`SHELX download or launch failed; check authorization, network, and system platform, then retry.`,"尚未安装 Systre":`Systre is not installed`,"尚未安装 Java":`Java is not installed`,"Systre 未能识别内置 pcu 网络":`Systre could not identify the built-in pcu network`,"尚未安装 PLATON":`PLATON is not installed`,"PLATON 安装配方已更新,点击修复依赖即可使用当前版本。":`The PLATON installation recipe has been updated. Click Repair dependencies to use the current version.`,"PLATON 未生成校验规则;请检查运行库":`PLATON did not generate verification rules; check the runtime`,"请输入 SHELX 授权信息以安装":`Enter SHELX authorization details to install`,"无法启动,请核对平台与运行库":`Unable to start; check the platform and runtime`,"衍射数据处理、结构求解、精修与三维晶体研究工作台":`Diffraction data processing, structure solution, refinement and a 3D crystallography workbench`,"正在准备 ⟦0⟧ 工作台,首次需要几分钟":`Preparing the ⟦0⟧ workbench; the first time takes a few minutes`,"⟦0⟧ 暂时无法使用":`⟦0⟧ is unavailable for now`,"管理 ⟦0⟧":`Manage ⟦0⟧`,"原生会话输入 ⟦0⟧ 可启用后台工具。":`Native session input ⟦0⟧ can enable background tools.`,"研究工具由服务方提供,沿用 Argus 的模型与执行后端。":`Research tools are provided by the service and use Argus's model and execution backend.`,"此插件由服务方提供并维护,无需停用或卸载。":`This plugin is provided and maintained by the service; there is nothing to disable or uninstall.`},Vd=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Hd=/⟦\d+⟧/g,Ud=Object.entries(Bd).filter(([e])=>e.includes(`⟦`)).sort((e,t)=>t[0].length-e[0].length).map(([e,t])=>({regex:RegExp(`^`+e.split(Hd).map(Vd).join(`([\\s\\S]*?)`)+`$`),slots:e.match(Hd)??[],target:t})),Wd=new RegExp(Object.keys(Bd).filter(e=>e.length>1&&!e.includes(`⟦`)).sort((e,t)=>t.length-e.length).map(Vd).join(`|`),`g`);function Gd(e,t){if(t===`zh-CN`||!/[\u3400-\u9fff]/.test(e))return e;if(Bd[e.trim()])return e.replace(e.trim(),Bd[e.trim()]);for(let t of Ud){let n=t.regex.exec(e.trim());if(n){let e=new Map(t.slots.map((e,t)=>[e,n[t+1]]));return t.target.replace(Hd,t=>e.get(t)??t)}}return e.replace(Wd,e=>Bd[e])}function Kd(){let{locale:e}=F();return t=>typeof t==`string`?Gd(t,e):t}var qd=ye(),Jd=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;function Yd({health:e,setup:t,running:n,act:r,platform:i,machine:a}){let o=Kd(),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(``),[p,m]=(0,U.useState)(``),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(``),[y,b]=(0,U.useState)(!1),[x,S]=(0,U.useState)(!1),[C,w]=(0,U.useState)(!1),T=t.windows_runtime,E=t.license?.platform_consent,D=E?.platform===i&&E?.machines.includes(a||``),O=e?.components||[],k=O.filter(e=>e.status!==`ready`),A=k.some(e=>e.license_required),j=k.some(e=>e.automatic);async function M(e){e.preventDefault();let n=await r(t.license.action,{username:d,password:p,accept_platform_license:y});m(``),n&&(u(!1),f(``),c(!0))}return(0,K.jsxs)(`div`,{className:`mt-5 border-t border-line/60 pt-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:()=>c(!s),className:`inline-flex items-center gap-2 text-sm text-ink-dim hover:text-ink`,children:[(0,K.jsx)(ke,{size:16,strokeWidth:1.5}),(0,K.jsx)(`span`,{children:o(e?.stale?o(`科学环境 · 上次检查结果`):e?.checked?e.ready?o(`科学环境已就绪`):o(`科学环境 · ${k.length} 项待配置`):o(`科学环境`))}),(0,K.jsx)(Me,{size:13,className:`transition-transform duration-200 ${s?`rotate-180`:``}`})]}),(0,K.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint hover:text-ink disabled:opacity-45`,disabled:n,onClick:()=>{c(!0),r(`health`)},children:[(0,K.jsx)(Pe,{size:12}),o(`检查环境`)]})]}),e?.stale&&(0,K.jsx)(`p`,{role:`status`,className:`mt-2 text-xs leading-relaxed text-ink-dim`,children:o(`下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。`)}),o((A||j||!e?.checked)&&(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:o(` 免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。 `)})),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[o((j||!e?.checked||e.stale)&&(0,K.jsxs)(`button`,{className:Jd,disabled:n,onClick:()=>{c(!0),r(`repair`)},children:[(0,K.jsx)(Le,{size:14}),o(`修复依赖`)]})),o(t.license&&(0,K.jsxs)(`button`,{className:Jd,disabled:n,onClick:()=>{u(!l),m(``),f(``)},children:[(0,K.jsx)(Vt,{size:14}),o(o(A?`配置 SHELX`:`SHELX 授权安装`))]}))]}),T&&(0,K.jsxs)(`div`,{className:`mt-3`,children:[(0,K.jsxs)(`button`,{type:`button`,className:Jd,disabled:n,onClick:()=>{w(!C),S(!1)},children:[(0,K.jsx)(Le,{size:14}),o(`准备 PLATON 官方环境`)]}),C&&(0,K.jsxs)(`form`,{className:`mt-3 rounded-lg bg-bg/70 p-3`,onSubmit:async e=>{e.preventDefault(),x&&await r(T.action,{accept_software_license:!0})&&(w(!1),S(!1),c(!0))},children:[(0,K.jsxs)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:[o(T.notice),` `,(0,K.jsx)(`a`,{href:T.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)})]}),(0,K.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5`}),o(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,K.jsx)(`button`,{type:`submit`,className:Jd,disabled:n||!x,children:o(`下载、验证并配置`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>{w(!1),S(!1)},children:o(`取消`)})]})]})]}),o(l&&t.license&&(0,K.jsxs)(`form`,{onSubmit:M,className:`mt-4 rounded-lg bg-bg/70 p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm`,children:[(0,K.jsxs)(`span`,{className:`font-medium`,children:[o(t.license.name),o(` 学术授权`)]}),(0,K.jsxs)(`a`,{href:t.license.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-blue`,children:[o(`前往官网申请`),(0,K.jsx)(Fe,{size:11})]})]}),(0,K.jsx)(`p`,{className:`mb-3 mt-1.5 text-xs leading-relaxed text-ink-faint`,children:o(`填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。`)}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`用户名`),(0,K.jsx)(`input`,{"aria-label":o(`SHELX 用户名`),value:d,onChange:e=>f(e.target.value),required:!0,maxLength:200,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]}),(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`密码`),(0,K.jsx)(`input`,{"aria-label":o(`SHELX 密码`),type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,maxLength:500,autoComplete:`new-password`,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]})]}),o(D&&E&&(0,K.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-faint`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5`}),(0,K.jsxs)(`span`,{children:[o(E.text),` `,(0,K.jsx)(`a`,{href:E.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`查看许可 ↗`)})]})]})),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`submit`,className:Jd,disabled:n||!d.trim()||!p.trim(),children:[(0,K.jsx)(Le,{size:14}),o(`下载并安装 SHELX`)]}),(0,K.jsx)(`button`,{type:`button`,className:`px-2 text-xs text-ink-faint`,onClick:()=>{u(!1),f(``),m(``)},children:o(`取消`)})]})]})),s&&(0,K.jsxs)(`div`,{className:`mt-3`,"aria-label":o(`科学软件健康检查`),children:[o(!O.length&&(0,K.jsx)(`p`,{className:`py-2 text-xs text-ink-faint`,children:o(`点击“检查环境”可验证科学内核与外部程序。`)})),O.map(e=>(0,K.jsx)(`div`,{className:`border-b border-line/40 py-2.5 last:border-0`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[o(e.status===`ready`?(0,K.jsx)(Ne,{size:15,strokeWidth:1.7,className:`mt-0.5 shrink-0 text-blue/75`}):(0,K.jsx)(It,{size:15,strokeWidth:1.5,className:`mt-0.5 shrink-0 text-ink-faint`})),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,K.jsx)(`span`,{children:o(e.name)}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-ink-faint`,children:o(e.status===`ready`?o(`可用`):e.license_required?o(`待授权安装`):o(`待修复`))})]}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-ink-faint`,children:o(e.description)}),(0,K.jsxs)(`details`,{className:`mt-1.5 text-xs text-ink-faint`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer hover:text-ink-dim`,children:o(e.status===`ready`?o(`查看检查详情`):o(`查看原因与安装方式`))}),(0,K.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words leading-relaxed`,children:o(e.detail)}),e.path&&(0,K.jsx)(`p`,{className:`mt-1 break-all leading-relaxed`,children:e.path}),(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)}),o(e.id!==`python`&&t.actions.includes(`configure`)&&(0,K.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>{g(e.id),v(``)},className:`text-blue`,children:o(`使用已有安装`)}))]})]})]})]})},e.id)),o(h&&(0,K.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),await r(`configure`,{paths:{[h]:_}})&&(g(null),v(``))},className:`mt-3 rounded-lg bg-bg/70 p-3`,children:[(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(o(h===`dials`?`DIALS 环境目录`:h===`systre`?`Systre JAR 路径(需要已有 Java)`:`${h.toUpperCase()} 可执行文件路径`)),(0,K.jsx)(`input`,{required:!0,value:_,onChange:e=>v(e.target.value),className:`mt-2 w-full rounded-md border border-line bg-panel px-2 py-2 text-sm text-ink`})]}),(0,K.jsx)(`p`,{className:`mt-1.5 text-xs text-ink-faint`,children:o(`填写运行 Argus 的电脑上的路径,验证成功后生效。`)}),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,K.jsx)(`button`,{className:Jd,disabled:n,children:o(`验证并使用`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>g(null),children:o(`取消`)})]})]})),o(e?.checked&&(0,K.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[o(`最近检查 `),o(new Date(e.checked*1e3).toLocaleString()),o(` · 检查不调用模型`)]}))]})]})}function Xd(e){return e.installed&&e.enabled&&e.supported?`ready`:e.managed_by_host?!e.supported||e.operation?.status===`failed`?`unavailable`:`preparing`:`manual`}var Zd=e=>`正在准备 ${e} 工作台,首次需要几分钟`,Qd=e=>`${e} 暂时无法使用`,$d=e=>`flex h-9 min-w-0 flex-1 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`;function ef({plugins:e,compact:t=!1,pending:n,onLaunch:r,onManage:i}){let a=Kd(),o=e.filter(e=>Xd(e)!==`manual`),s=!e.length||e.some(e=>Xd(e)===`manual`);return(0,K.jsxs)(K.Fragment,{children:[o.map(e=>{let o=Xd(e),s=!t&&(0,K.jsx)(`button`,{type:`button`,onClick:i,"aria-label":a(`管理 ${e.name}`),title:a(`管理 ${e.name}`),className:`icon-control mr-1 shrink-0 p-1.5 text-ink-faint hover:text-ink`,children:(0,K.jsx)(Rt,{size:15})});if(o===`ready`)return(0,K.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:n===e.id,onClick:()=>r(e),title:e.name,"aria-label":e.name,className:`${$d(t)} disabled:opacity-60`,children:[(0,K.jsx)(Lt,{size:17,strokeWidth:1.5,className:`shrink-0 text-blue`}),!t&&(0,K.jsx)(`span`,{className:`truncate`,children:e.name}),!t&&(0,K.jsx)(Ot,{size:13,className:`shrink-0 text-ink-faint`})]}),s]},e.id);let c=o===`preparing`?Zd(e.name):Qd(e.name),l=o===`preparing`?e.operation?.progress:e.operation?.error||e.reason;return(0,K.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,K.jsxs)(`div`,{role:`status`,title:a(l||c),className:`flex min-w-0 flex-1 items-center text-sm text-ink-faint ${t?`h-9 justify-center`:`gap-2 px-3 py-1.5`}`,children:[o===`preparing`?(0,K.jsx)(W,{size:17,strokeWidth:1.5,className:`shrink-0 animate-spin`}):(0,K.jsx)(Lt,{size:17,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,K.jsxs)(`div`,{className:`min-w-0 leading-snug`,children:[(0,K.jsx)(`p`,{children:a(c)}),l&&(0,K.jsx)(`p`,{className:`mt-0.5 truncate text-xs`,children:a(l)})]})]}),s]},e.id)}),s&&(0,K.jsx)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,children:(0,K.jsxs)(`button`,{type:`button`,onClick:i,title:a(`插件`),"aria-label":a(`插件`),className:$d(t),children:[(0,K.jsx)(jt,{size:16,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,K.jsx)(`span`,{children:a(`插件`)})]})})]})}function tf({compact:e=!1}){let t=Kd(),{locale:n}=F(),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)([]),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(!1),_=(0,U.useRef)(null),v=a.some(e=>Xd(e)===`preparing`),y=a.length>0&&a.every(e=>e.managed_by_host);async function b(e){let n=await fetch(`/api/plugins`,{headers:I(),signal:e});if(!n.ok)throw Error(t(`无法读取插件列表`));let r=await n.json();e?.aborted||o(r.plugins)}(0,U.useEffect)(()=>{r||(m(null),g(!1))},[r]),(0,U.useEffect)(()=>{let e=new AbortController,t=()=>b(e.signal).catch(t=>{!e.signal.aborted&&r&&c(t.message)});r&&(_.current?.focus(),c(``),u(!0)),t().finally(()=>{e.signal.aborted||u(!1)});let n=r||v?window.setInterval(t,r?1500:4e3):0,a=e=>{e.key===`Escape`&&i(!1)};return r&&window.addEventListener(`keydown`,a),()=>{e.abort(),n&&window.clearInterval(n),window.removeEventListener(`keydown`,a)}},[r,v]);async function x(e,n,r){let i=e.setup?.windows_runtime;if(i&&!i.accepted&&[`install`,`update`,`repair`,i.action].includes(n)&&r?.accept_software_license!==!0)return m({pluginId:e.id,action:n}),g(!1),c(``),!1;f(e.id),c(``);try{let i=await fetch(`/api/plugins/${e.id}/${n===`launch`?`launch`:`manage/${n}`}`,{method:`POST`,headers:{...I(),"Content-Type":`application/json`},body:r?JSON.stringify(r):void 0}),a=await i.json();if(!i.ok)throw Error(a.detail||t(`插件操作未完成`));return n===`launch`?window.location.assign(a.url):await b(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{f(null)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ef,{plugins:a,compact:e,pending:d,onLaunch:e=>void x(e,`launch`),onManage:()=>i(!0)}),r&&(0,qd.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:()=>i(!1),children:(0,K.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`plugin-title`,onClick:e=>e.stopPropagation(),className:`max-h-[85vh] w-full max-w-xl overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h2`,{id:`plugin-title`,className:`text-lg font-semibold`,children:t(`插件`)}),(0,K.jsx)(`button`,{ref:_,type:`button`,"aria-label":t(`关闭插件列表`),className:`icon-control p-1.5`,onClick:()=>i(!1),children:(0,K.jsx)(Ie,{size:18})})]}),(0,K.jsx)(`p`,{className:`mb-6 mt-2 text-sm text-ink-faint`,children:t(t(y?`研究工具由服务方提供,沿用 Argus 的模型与执行后端。`:`按需安装研究工具,沿用 Argus 的模型与执行后端。`))}),t(s&&(0,K.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-ink-dim`,children:t(s)})),t(l&&(0,K.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`正在读取插件…`)})),t(!l&&!a.length&&(0,K.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`暂无可用插件`)})),t(a.map(e=>{let r=e.operation?.status===`running`||d===e.id,i=r||!e.supported,a=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;return(0,K.jsxs)(`article`,{className:`rounded-xl border border-line/70 p-4`,"data-testid":`plugin-${e.id}`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(Lt,{size:24,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-medium`,children:t(e.name)}),(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t(e.installed_version||e.version)})]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:t(e.description)})]})]}),(0,K.jsxs)(`div`,{className:`mt-4 text-xs text-ink-faint`,children:[t(e.installed?e.enabled?t(`已启用`):t(`已停用`):t(`未安装`)),t(` · 当前后端 `),t(Array.from(new Set(Object.values(e.backends))).join(` / `))]}),t(!e.supported&&(0,K.jsx)(`p`,{className:`mt-3 text-sm text-ink-dim`,children:t(e.reason)})),t(e.operation?.status===`running`&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-sm text-ink-dim`,children:[(0,K.jsx)(W,{size:14,className:`animate-spin`}),t(e.operation.progress)]})),t(e.operation?.status===`failed`&&(0,K.jsx)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-ink-dim`,children:t(e.operation.error)})),(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[t(!e.installed&&!e.managed_by_host&&(0,K.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`install`),children:[(0,K.jsx)(Le,{size:14}),t(`安装`)]})),t(e.installed&&e.enabled&&(0,K.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`launch`),children:[t(`打开工作台`),(0,K.jsx)(Ot,{size:14})]})),t(e.installed&&!e.enabled&&!e.managed_by_host&&(0,K.jsx)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`enable`),children:t(`启用`)})),t(e.update_available&&!e.managed_by_host&&(0,K.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`update`),children:[(0,K.jsx)(Pe,{size:14}),e.environment_update?t(`更新科学环境校验`):(0,K.jsxs)(K.Fragment,{children:[t(`更新至 `),t(e.version)]})]})),t(e.installed&&e.enabled&&!e.managed_by_host&&(0,K.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`disable`),children:t(`停用`)})),t(e.installed&&!e.managed_by_host&&(0,K.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`uninstall`),children:t(`卸载`)}))]}),p?.pluginId===e.id&&e.setup?.windows_runtime&&(0,K.jsxs)(`form`,{className:`mt-4 rounded-lg bg-bg/70 p-3`,onSubmit:async t=>{t.preventDefault(),!(!h||r)&&await x(e,p.action,{accept_software_license:!0})&&(m(null),g(!1))},children:[(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:t(`继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。`)}),(0,K.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:[t(e.setup.windows_runtime.notice),` `,(0,K.jsx)(`a`,{href:e.setup.windows_runtime.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:t(`官方安装说明 ↗`)})]}),(0,K.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`mt-0.5`}),t(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,K.jsx)(`button`,{type:`submit`,className:a,disabled:r||!h,children:t(`同意并继续`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,disabled:r,onClick:()=>{m(null),g(!1)},children:t(`取消`)})]})]}),(0,K.jsx)(`p`,{className:`mt-4 text-xs leading-relaxed text-ink-faint`,children:t(e.installed?t(`原生会话输入 ${e.command||``} 可启用后台工具。卸载保留会话、研究数据和科学软件。`):t(`首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。`))}),t(e.rights_notice&&(0,K.jsx)(`p`,{className:`mt-3 text-[10px] leading-relaxed text-ink-faint`,"data-testid":`plugin-rights-notice`,children:t(n===`zh-CN`&&e.rights_notice_zh||e.rights_notice)})),t(e.installed&&e.setup&&(0,K.jsx)(Yd,{health:e.health,setup:e.setup,running:r,platform:e.platform,machine:e.machine,act:(t,n)=>x(e,t,n)}))]},e.id)}))]})}),document.body)]})}var nf=[`all`,`installed`,`available`,`builtin`],rf=[`install`,`update`,`enable`,`disable`,`uninstall`],af=new Set([`install`,`update`,`uninstall`]),of={query:``,kind:`all`,tag:null};function sf(e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}){return e.VITE_ARGUS_HOSTED_TRIAL===`1`}function cf(e,t){switch(t){case`all`:return!0;case`installed`:return e===`installed`||e===`package`;case`available`:return e===`available`;case`builtin`:return e===`builtin`}}function lf(e,t){let n=t.trim().toLowerCase();return!n||[e.name,e.purpose,e.purpose_zh??``,...e.routing_path??[],...e.tags,...e.requires].join(` +`).toLowerCase().includes(n)}function uf(e,t){return e.filter(e=>cf(e.kind,t.kind)&&(!t.tag||e.tags.includes(t.tag))&&(!t.routingPath||(e.routing_path??[]).join(`/`)===t.routingPath||(e.routing_path??[]).join(`/`).startsWith(`${t.routingPath}/`))&&lf(e,t.query))}function df(e){let t=new Set;for(let n of e){let e=n.routing_path??[];for(let n=1;n<=e.length;n++)t.add(e.slice(0,n).join(`/`))}return[...t].sort()}function ff(e){let t=new Set;for(let n of e)for(let e of n.tags)e.trim()&&t.add(e.trim());return[...t].sort((e,t)=>e.localeCompare(t))}function pf(e,t){let n=t||e.managed_by_host;return e.actions.filter(e=>rf.includes(e)&&!(n&&af.has(e)))}var mf=e=>`verticals.action.${e}`,hf=e=>`verticals.kind.${e}`,gf=e=>`verticals.filter.${e}`,_f=e=>`verticals.operation.${e}`;function vf(e,t){return t===`zh-CN`&&e.purpose_zh&&e.purpose_zh.trim()?e.purpose_zh:e.purpose}function yf(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function bf(e){if(!e||e.status!==`running`)return null;let t=Number(e.progress);return!Number.isFinite(t)||t<=0?null:Math.max(0,Math.min(100,Math.round(t)))}var xf=e=>e.operation?.status===`running`;function Sf(e){return e.some(xf)}function Cf(e,t){return e?t?1500:4e3:t?4e3:0}function wf(e){if(e instanceof j){if(e.detail)return e.detail;let t=/^[A-Z]+ \S+ → \S+: ([\s\S]+)$/.exec(e.message);return t?t[1]:``}return e instanceof Error?e.message:String(e??``)}function Tf(e){return e instanceof j&&e.status===409}function Ef(e){return e instanceof j&&e.status===404}function Df(e,t){return Array.isArray(e)&&e.includes(t)}function Of(e){return new Set(e.map(e=>e.name))}var kf=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`,Af=e=>`rounded-full border px-2.5 py-0.5 text-xs transition-colors ${e?`border-blue/60 bg-blue/10 text-blue`:`border-line text-ink-dim hover:border-blue/40 hover:text-ink`}`,jf=e=>`rounded px-1.5 py-0.5 text-[10px] font-semibold ${e===`ok`?`bg-ok/10 text-ok`:e===`warn`?`bg-warn/10 text-warn`:e===`blue`?`bg-blue/10 text-blue`:`bg-line text-ink-dim`}`,Mf={install:Le,update:Pe,enable:qt,disable:Kt,uninstall:Zt};function Nf(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}catch{return n.toISOString()}}function Pf({compact:e=!1,onOpen:t}){let{t:n}=F();return(0,K.jsxs)(`button`,{type:`button`,onClick:t,title:n(`verticals.entry`),"aria-label":n(`verticals.entry`),"data-testid":`vertical-store-entry`,className:`mx-2 my-1 flex h-9 shrink-0 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`,children:[(0,K.jsx)(Xt,{size:17,strokeWidth:1.5}),!e&&(0,K.jsx)(`span`,{children:n(`verticals.entry`)})]})}function Ff({row:e,locale:t,hosted:n,busy:r,failure:i,known:a,onAct:o,onJump:s,onTag:c}){let{t:l}=F(),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),m=xf(e),h=r||m,g=pf(e,n),_=e.operation,v=bf(_),y=e=>rf.includes(e)?l(mf(e)):e,b=_&&rf.includes(_.action)?l(_f(_.action)):l(`verticals.operationRunning`),x=e.kind===`installed`?`ok`:e.kind===`available`?`neutral`:`blue`,S=async(t=!1)=>{d(!1),await o(e,`uninstall`,t?{force:!0}:void 0)};return(0,K.jsxs)(`article`,{id:`vertical-${e.name}`,"data-testid":`vertical-${e.name}`,"data-kind":e.kind,tabIndex:-1,className:`flex flex-col rounded-xl border border-line/70 p-4 outline-none focus-visible:border-blue/60`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(Ht,{size:22,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:jf(x),"data-testid":`vertical-kind`,children:l(hf(e.kind))}),e.kind!==`available`&&(0,K.jsx)(`span`,{className:jf(e.enabled?`ok`:`neutral`),children:e.enabled?l(`verticals.enabled`):l(`verticals.disabledState`)}),e.update_available&&(0,K.jsx)(`span`,{className:jf(`warn`),"data-testid":`vertical-update`,children:l(`verticals.updateAvailable`)})]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:vf(e,t)}),e.routing_path?.length?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:e.routing_path.join(` / `)}):null]})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-ink-faint`,children:[e.installed_version&&(0,K.jsx)(`span`,{children:l(`verticals.installedVersion`,{version:e.installed_version})}),e.version&&e.version!==e.installed_version&&(0,K.jsx)(`span`,{children:l(`verticals.catalogVersion`,{version:e.version})}),e.size_bytes!=null&&(0,K.jsxs)(`span`,{children:[l(`verticals.size`),` `,yf(e.size_bytes)]})]}),e.requires.length>0&&(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.requires`)}),e.requires.map(e=>a.has(e)&&s?(0,K.jsx)(`button`,{type:`button`,onClick:()=>s(e),"aria-label":l(`verticals.jumpTo`,{name:e}),title:l(`verticals.jumpTo`,{name:e}),className:`rounded-full border border-line px-2 py-0.5 font-mono text-ink-dim transition-colors hover:border-blue/60 hover:text-blue`,children:e},e):(0,K.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.shared.length>0&&(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.shared`)}),e.shared.map(e=>(0,K.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.tags.length>0&&(0,K.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.tags.map(e=>c?(0,K.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint transition-colors hover:text-blue`,children:[`#`,e]},e):(0,K.jsxs)(`span`,{className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint`,children:[`#`,e]},e))}),e.missing_python.length>0&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-start gap-2 rounded-lg bg-warn/10 p-2.5 text-xs leading-relaxed text-warn`,"data-testid":`vertical-missing-python`,children:[(0,K.jsx)(Qt,{size:14,className:`mt-0.5 shrink-0`}),(0,K.jsx)(`span`,{children:l(`verticals.missingPython`,{packages:e.missing_python.join(`, `)})})]}),!!e.runtime_issues?.length&&(0,K.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-runtime-issues`,children:l(`verticals.runtimeIssues`,{issues:e.runtime_issues.join(`; `)})}),!!e.install_issues?.length&&(0,K.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-install-issues`,children:l(`verticals.installIssues`,{issues:e.install_issues.join(`; `)})}),e.used_by.length>0&&(0,K.jsxs)(`div`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:()=>p(e=>!e),className:`inline-flex items-center gap-1 transition-colors hover:text-ink`,"data-testid":`vertical-used-by`,children:[e.used_by.length===1?l(`verticals.usedByOne`):l(`verticals.usedBy`,{count:e.used_by.length}),f?(0,K.jsx)(Nt,{size:12}):(0,K.jsx)(Me,{size:12})]}),f&&(0,K.jsx)(`ul`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono`,children:e.used_by.map(e=>(0,K.jsx)(`li`,{className:`rounded bg-bg px-1.5 py-0.5`,children:e},e))})]}),m&&_&&(0,K.jsxs)(`div`,{className:`mt-3`,"data-testid":`vertical-progress`,children:[(0,K.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-ink-dim`,children:[(0,K.jsx)(W,{size:14,className:`animate-spin`}),(0,K.jsx)(`span`,{children:b}),v!=null&&(0,K.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-ink-faint`,children:[v,`%`]})]}),(0,K.jsx)(`div`,{role:`progressbar`,"aria-label":b,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":v??void 0,className:`mt-1.5 h-1 overflow-hidden rounded bg-line`,children:v==null?(0,K.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`}):(0,K.jsx)(`div`,{className:`h-full rounded bg-blue transition-[width] duration-500`,style:{width:`${v}%`}})}),_.message&&(0,K.jsx)(`p`,{className:`mt-1 break-words text-xs text-ink-faint`,children:_.message})]}),_?.status===`failed`&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-err`,"data-testid":`vertical-operation-failed`,children:[l(`verticals.operationFailed`,{action:y(_.action)}),_.message?` — ${_.message}`:``]}),i&&(0,K.jsxs)(`div`,{role:`alert`,className:`mt-3 rounded-lg border border-err/30 bg-err/5 p-2.5 text-sm text-ink-dim`,"data-testid":`vertical-failure`,children:[(0,K.jsx)(`p`,{className:`break-words`,children:i.text}),i.offerForce&&(0,K.jsxs)(`button`,{type:`button`,className:`${kf} mt-2 border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(!0),children:[(0,K.jsx)(Zt,{size:14}),l(`verticals.removeAnyway`)]})]}),g.length>0&&(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:g.map(t=>{let n=Mf[t];if(t===`uninstall`)return u?(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`${kf} border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(),"data-testid":`vertical-confirm-uninstall`,children:[(0,K.jsx)(Zt,{size:14}),l(`verticals.confirmUninstall`)]}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint hover:text-ink`,onClick:()=>d(!1),children:l(`common.cancel`)}),(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:l(`verticals.confirmUninstallHint`,{name:e.name})})]},t):(0,K.jsxs)(`button`,{type:`button`,className:kf,disabled:h,onClick:()=>d(!0),"data-action":t,children:[(0,K.jsx)(n,{size:14}),l(mf(t))]},t);let r=t===`update`&&e.version?l(`verticals.updateTo`,{version:e.version}):l(mf(t));return(0,K.jsxs)(`button`,{type:`button`,className:kf,disabled:h,onClick:()=>void o(e,t),"data-action":t,children:[(0,K.jsx)(n,{size:14}),r]},t)})})]})}function If({payload:e,filter:t,onFilter:n,hosted:r,supported:i,loading:a,refreshing:o,error:s,pending:c,failures:l,onAct:u,onRefresh:d,onJump:f}){let{t:p,locale:m}=F(),h=e?.verticals??[],g=(0,U.useMemo)(()=>ff(h),[h]),_=(0,U.useMemo)(()=>df(h),[h]),v=(0,U.useMemo)(()=>Of(h),[h]),y=(0,U.useMemo)(()=>uf(h,t),[h,t]),b=t.query.trim()!==``||t.kind!==`all`||t.tag!==null||!!t.routingPath,x=e?.catalog;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:p(r?`verticals.hostedNote`:`verticals.intro`)}),i===!1&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 rounded-lg border border-line bg-bg/70 p-3 text-sm text-ink-dim`,"data-testid":`vertical-store-too-old`,children:p(`verticals.tooOld`)}),i!==!1&&(0,K.jsxs)(K.Fragment,{children:[x&&(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-faint`,"data-testid":`vertical-catalog`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,title:x.source,children:p(`verticals.catalogSource`,{source:x.source})}),x.release_tag&&(0,K.jsx)(`span`,{className:`rounded bg-bg px-1.5 py-0.5 font-mono`,children:p(`verticals.catalogRelease`,{tag:x.release_tag})}),(0,K.jsx)(`span`,{children:x.fetched_at?p(`verticals.catalogFetched`,{time:Nf(x.fetched_at,m)}):p(`verticals.catalogNever`)}),(0,K.jsxs)(`button`,{type:`button`,className:`${kf} ml-auto`,disabled:o||a,onClick:d,"data-testid":`vertical-refresh-catalog`,children:[(0,K.jsx)(Pe,{size:14,className:o?`animate-spin`:``}),p(o?`verticals.refreshing`:`verticals.refreshCatalog`)]})]}),x?.error&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-3 rounded-lg border border-warn/40 bg-warn/10 p-2.5 text-sm text-warn`,"data-testid":`vertical-catalog-error`,children:p(`verticals.catalogError`,{error:x.error})}),s&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-err`,"data-testid":`vertical-store-error`,children:s}),(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-line bg-bg px-2.5 focus-within:border-blue/60`,children:[(0,K.jsx)(Ye,{size:14,className:`shrink-0 text-ink-faint`}),(0,K.jsx)(`span`,{className:`sr-only`,children:p(`verticals.search`)}),(0,K.jsx)(`input`,{type:`search`,value:t.query,onChange:e=>n({...t,query:e.target.value}),placeholder:p(`verticals.searchPlaceholder`),className:`min-w-0 flex-1 bg-transparent text-sm text-ink outline-none placeholder:text-ink-faint`})]}),(0,K.jsx)(`div`,{role:`group`,"aria-label":p(`verticals.kindFilter`),className:`flex flex-wrap gap-1`,children:nf.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":t.kind===e,onClick:()=>n({...t,kind:e}),className:`h-8 rounded-md px-2.5 text-xs font-medium transition-colors ${t.kind===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:p(gf(e))},e))})]}),_.length>0&&(0,K.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink-faint`,children:[p(`verticals.routingPath`),(0,K.jsxs)(`select`,{className:`rounded-md border border-line bg-bg p-1.5`,value:t.routingPath??``,onChange:e=>n({...t,routingPath:e.target.value}),children:[(0,K.jsx)(`option`,{value:``,children:p(`verticals.filter.all`)}),_.map(e=>(0,K.jsx)(`option`,{value:e,children:e.replaceAll(`/`,` / `)},e))]})]}),(g.length>0||b)&&(0,K.jsxs)(`div`,{role:`group`,"aria-label":p(`verticals.tagFilter`),className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[g.map(e=>(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":t.tag===e,className:Af(t.tag===e),onClick:()=>n({...t,tag:t.tag===e?null:e}),children:[`#`,e]},e)),b&&(0,K.jsx)(`button`,{type:`button`,className:`ml-1 text-xs text-ink-faint hover:text-ink`,onClick:()=>n(of),children:p(`verticals.clearFilters`)})]}),h.length>0&&(0,K.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`verticals.count`,{shown:y.length,total:h.length})}),a&&!e&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.loading`)}),e&&h.length===0&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.none`)}),h.length>0&&y.length===0&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.noMatches`)}),y.length>0&&(0,K.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,"data-testid":`vertical-grid`,children:y.map(e=>(0,K.jsx)(Ff,{row:e,locale:m,hosted:r,busy:c===e.name,failure:l[e.name],known:v,onAct:u,onJump:f,onTag:e=>n({...t,tag:e})},e.name))})]})]})}function Lf({open:e,onClose:t}){let{t:n}=F(),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)({}),[_,v]=(0,U.useState)(of),y=(0,U.useRef)(null),b=(0,U.useRef)(t);b.current=t;let x=(0,U.useRef)(n);x.current=n;let S=Sf(r?.verticals??[]),C=!!r?.host.managed_by_host||sf();(0,U.useEffect)(()=>{if(!e||a!==null)return;let t=!1;return P.meta().then(e=>{t||o(Df(e.capabilities,N))},()=>{t||o(!0)}),()=>{t=!0}},[e,a]),(0,U.useEffect)(()=>{if(a!==!0||!e&&!S)return;let t=new AbortController,n=()=>P.verticals(t.signal).then(e=>{t.signal.aborted||(i(e),f(e=>e?.source===`load`?null:e))},n=>{t.signal.aborted||(Ef(n)?o(!1):e&&f({text:x.current(`verticals.loadFailed`),source:`load`}))});e&&c(!0),n().finally(()=>{t.signal.aborted||c(!1)});let r=Cf(e,S),s=r?window.setInterval(n,r):0;return()=>{t.abort(),s&&window.clearInterval(s)}},[e,S,a]),(0,U.useEffect)(()=>{if(!e){g({}),f(e=>e?.source===`refresh`?null:e);return}y.current?.focus();let t=e=>{e.key===`Escape`&&b.current()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let w=(0,U.useCallback)(async()=>{try{i(await P.verticals()),f(e=>e?.source===`load`?null:e)}catch(e){Ef(e)?o(!1):f({text:x.current(`verticals.loadFailed`),source:`load`})}},[]),T=(0,U.useCallback)(async(e,t,n={})=>{m(e.name),g(t=>{let{[e.name]:n,...r}=t;return r});try{return await P.manageVertical(e.name,t,n),await w(),!0}catch(r){let i=wf(r)||x.current(`verticals.actionFailed`),a=t===`uninstall`&&Tf(r)&&!n.force;return g(t=>({...t,[e.name]:{text:i,offerForce:a}})),!1}finally{m(null)}},[w]),E=(0,U.useCallback)(async()=>{u(!0),f(null);try{i(await P.refreshVerticalCatalog())}catch(e){f({text:wf(e)||x.current(`verticals.loadFailed`),source:`refresh`})}finally{u(!1)}},[]),D=(0,U.useCallback)(e=>{v(of),!(typeof document>`u`)&&window.setTimeout(()=>{let t=document.getElementById(`vertical-${e}`);t?.scrollIntoView?.({block:`nearest`,behavior:`smooth`}),t?.focus?.()},0)},[]);return e?(0,qd.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:t,children:(0,K.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`vertical-store-title`,onClick:e=>e.stopPropagation(),className:`flex max-h-[85vh] w-full max-w-4xl flex-col overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl scroll-thin`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`h2`,{id:`vertical-store-title`,className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Xt,{size:20,strokeWidth:1.5,className:`text-blue`}),n(`verticals.title`)]}),(0,K.jsx)(`button`,{ref:y,type:`button`,"aria-label":n(`verticals.close`),className:`icon-control p-1.5`,onClick:t,children:(0,K.jsx)(Ie,{size:18})})]}),(0,K.jsx)(If,{payload:r,filter:_,onFilter:v,hosted:C,supported:a,loading:s,refreshing:l,error:d?.text??``,pending:p,failures:h,onAct:T,onRefresh:()=>void E(),onJump:D})]})}),document.body):null}function Rf(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)||e}function zf(e,t,n){if(e.length===0)return`local`;let r=n.trim(),i=r?e.filter(e=>e.launch_cwd?.trim()===r):[];return i.length===0||t&&!i.some(e=>e.id===t)?`all`:`local`}function Bf({projects:e,activeId:t,activeWork:n,localCwd:i,onSelect:o,onPrefetch:c,onManage:l,onResume:u,resumingId:p,onOpenPanel:m,onOpenLearning:h,onOpenVerticals:y,onNew:b,loading:x,creating:S=!1,error:C,onRetry:w,mobileOpen:T=!1,collapsed:E=!1,onToggleCollapse:D,themeMode:O,onCycleTheme:k}){let{t:A,locale:j}=F(),[M,N]=(0,U.useState)(`local`),P=(0,U.useRef)(!1),[I,ee]=(0,U.useState)(``),[te,L]=(0,U.useState)(()=>new Set),ne=E&&!T,re=i.trim(),ie=(0,U.useMemo)(()=>re?e.filter(e=>e.launch_cwd?.trim()===re):[],[re,e]);(0,U.useEffect)(()=>{P.current||x||e.length===0||(P.current=!0,N(zf(e,t,re)))},[t,x,re,e]);let ae=M===`local`?ie:e,oe=I.trim()?Kl(ae,I):ae,se=(0,U.useMemo)(()=>{if(M===`local`)return oe.length>0?[[re||`Local`,oe]]:[];let e=new Map;return oe.forEach(t=>{let n=t.launch_cwd?.trim()||A(`common.unassigned`),r=e.get(n)??[];r.push(t),e.set(n,r)}),[...e.entries()]},[re,M,oe]),ce=e=>te.has(e)&&!I.trim();return(0,K.jsxs)(Ge,{mobileOpen:T,collapsed:E,children:[(0,K.jsx)(`div`,{className:`chrome-seam-surface flex h-12 shrink-0 items-center border-b border-line/50 ${ne?`justify-center`:`justify-between px-4`}`,children:ne?(0,K.jsx)(vt,{size:22,compact:!0}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(vt,{size:24}),(0,K.jsx)(`button`,{type:`button`,onClick:D,"aria-label":A(`sidebar.collapse`),title:`${A(`sidebar.collapse`)} · Ctrl/⌘ B`,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,K.jsx)(s,{icon:_,className:`h-3.5 w-3.5`})})]})}),ne?(0,K.jsx)(`div`,{className:`flex h-12 shrink-0 items-center justify-center`,children:(0,K.jsx)(`button`,{type:`button`,onClick:D,"aria-label":A(`sidebar.expand`),title:`${A(`sidebar.expand`)} · Ctrl/⌘ B`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink`,children:(0,K.jsx)(s,{icon:f,className:`h-3.5 w-3.5`})})}):null,ne?(0,K.jsx)(tf,{compact:!0}):null,ne&&h?(0,K.jsx)(Kn,{onOpen:h,compact:!0}):null,ne&&y?(0,K.jsx)(Pf,{compact:!0,onOpen:y}):null,ne?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`nav`,{"aria-label":j===`zh-CN`?`工具与知识`:`Tools and knowledge`,"data-sidebar-resources":!0,className:`shrink-0 overflow-y-auto overscroll-contain border-b border-line/50 px-2 py-2 scroll-thin [&>section]:mx-2 [&>section]:border-0 [&>section]:py-0 [&>section>div>button:first-child]:px-3`,style:{maxHeight:`min(40dvh, 360px)`},children:[(0,K.jsx)(tf,{}),h&&(0,K.jsx)(Kn,{onOpen:h}),y?(0,K.jsx)(Pf,{onOpen:y}):null]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pb-1 pt-3`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:j===`zh-CN`?`项目`:`Projects`}),ie.length>0&&ie.lengthN(e.target.value),className:`min-w-0 bg-transparent text-xs text-ink-faint`,children:[(0,K.jsx)(`option`,{value:`local`,children:A(`common.local`)}),(0,K.jsx)(`option`,{value:`all`,children:A(`common.all`)})]}):null,(0,K.jsx)(`button`,{type:`button`,onClick:b,disabled:S,"aria-label":A(`sidebar.create`),title:A(`sidebar.create`),className:`ml-auto flex h-8 items-center justify-center rounded-md px-2 text-xs text-ink-dim hover:bg-bg disabled:opacity-40`,children:S?`…`:j===`zh-CN`?`+ 新建`:`+ New`})]}),(0,K.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,K.jsx)(`label`,{className:`sr-only`,htmlFor:`daemon-search`,children:A(`sidebar.find`)}),(0,K.jsxs)(`div`,{className:`flex items-center rounded-md border border-line/60 bg-bg/60 px-2 focus-within:border-blue/60`,children:[(0,K.jsx)(`input`,{id:`daemon-search`,value:I,onChange:e=>ee(e.target.value),placeholder:A(`sidebar.find`),className:`h-8 min-w-0 flex-1 bg-transparent text-xs text-ink outline-none placeholder:text-ink-faint`}),I?(0,K.jsx)(`button`,{type:`button`,"aria-label":A(`sidebar.clearSearch`),onClick:()=>ee(``),className:`px-1 text-sm text-ink-faint hover:text-ink`,children:`×`}):null]})]}),(0,K.jsxs)(`div`,{className:`mobile-scroll-region min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-3 pb-3 scroll-thin`,children:[x&&e.length===0?(0,K.jsx)(`div`,{className:`px-1 py-3 text-xs text-ink-faint`,children:A(`common.loading`)}):null,C?(0,K.jsx)(`button`,{type:`button`,onClick:w,className:`mb-2 w-full rounded-md bg-err/5 px-3 py-2 text-left text-xs text-err`,children:A(`sidebar.refreshFailed`)}):null,!x&&!C&&oe.length===0?(0,K.jsxs)(`div`,{className:`px-1 py-4 text-xs text-ink-faint`,children:[(0,K.jsx)(`div`,{children:I.trim()?A(`sidebar.noMatches`,{query:I.trim()}):A(`sidebar.noSessions`)}),I.trim()?(0,K.jsx)(`button`,{type:`button`,onClick:()=>ee(``),className:`mt-2 text-xs text-ink-dim underline underline-offset-2 hover:text-ink`,children:A(`sidebar.clearSearch`)}):null]}):null,se.map(([e,i])=>(0,K.jsxs)(`section`,{className:`mb-1 last:mb-0`,children:[i.length>1&&se.length>1?(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":!ce(e),title:e,onClick:()=>L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),className:`mb-1 flex h-7 w-full items-center gap-2 rounded-md px-1.5 text-left text-[11px] font-medium text-ink-faint hover:bg-bg/70 hover:text-ink-dim`,children:[(0,K.jsx)(s,{icon:r,className:`h-2.5 w-2.5 transition-transform ${ce(e)?`-rotate-90`:``}`}),(0,K.jsx)(s,{icon:v,className:`h-3 w-3`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Rf(e)})]}):null,i.length===1||se.length===1||!ce(e)?i.map(e=>{let r=e.id===t,i=r&&n?.sessionId===e.id?n:void 0,a=i?Kr(i.status,j,i.connected):void 0,f=Bl(e),m=f?(e.label||e.display_name||``).trim():e.objective.trim()||A(`sidebar.unnamedSession`),h=e.daemon_alive&&e.daemon_protocol_compatible===!1,_=h&&e.daemon_protocol_error===`daemon release is incompatible with WebAPI release`,v=h&&!_,y=!e.daemon_alive&&e.last_active>0&&!!e.workdir?.trim();return(0,K.jsxs)(`div`,{"data-active":r?`true`:`false`,onPointerEnter:()=>{r||c?.(e.id)},className:`session-card group relative mb-0.5 h-14 w-full rounded-md transition-colors duration-150 ease-panel ${r?`text-ink`:`text-ink-dim hover:text-ink`}`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`absolute left-0 transition-colors ${r?`inset-y-1 w-px bg-blue`:`inset-y-2 w-px bg-transparent group-hover:bg-ink-faint/30`}`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>o(e.id),onFocus:()=>{r||c?.(e.id)},"aria-current":r?`page`:void 0,title:`${m}${!f&&m!==e.id?` · ${e.id}`:``}${e.objective&&e.objective!==m?` — ${e.objective}`:``}`,className:`flex h-14 w-full min-w-0 flex-col justify-center px-2.5 text-left ${y?`pr-[4.75rem]`:`pr-10`}`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(Ze,{ok:e.daemon_alive&&!v,title:v?A(`sidebar.updateRequired`):e.daemon_alive?A(`sidebar.daemonAlive`):A(`sidebar.stopped`)}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:m})]}),(0,K.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5 pl-3.5 text-[11px] text-ink-faint`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate ${v?`text-warn`:``}`,title:a,"data-session-work-state":i?.status.state,children:v?A(`sidebar.updateRequired`):a??(e.daemon_alive?A(`sidebar.runningFor`,{uptime:ut(e.uptime_seconds)}):e.last_active>0?A(`sidebar.lastActive`,{time:H(e.last_active,j)}):A(`sidebar.stopped`))}),_&&(0,K.jsx)(`span`,{title:A(`sidebar.updateAvailableHint`),className:`shrink-0 rounded border border-line px-1 text-[10px] leading-4`,children:A(`sidebar.updateAvailable`)})]})]}),y&&u?(0,K.jsx)(`button`,{type:`button`,disabled:p!=null,onClick:t=>{t.stopPropagation(),u(e.id)},"aria-label":A(`sidebar.resume`),title:A(`sidebar.resumeHint`,{workdir:e.workdir??``}),className:`absolute right-9 top-3 flex h-8 w-8 items-center justify-center rounded-md text-blue opacity-100 hover:bg-blue/10 disabled:opacity-40 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:p===e.id?`…`:(0,K.jsx)(s,{icon:d,className:`h-3 w-3`})}):null,(0,K.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),l(e.id)},"aria-label":A(`sidebar.manage`,{name:m}),title:A(`sidebar.manageHint`),className:`absolute right-1 top-3 flex h-8 w-8 items-center justify-center rounded-md text-ink-faint opacity-100 transition-opacity hover:bg-panel-raised hover:text-ink sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,K.jsx)(s,{icon:g,className:`h-4 w-4`})})]},e.id)}):null]},e))]}),(0,K.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between border-t border-line/50 px-4 py-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>m(`config`),className:`icon-control flex h-8 w-8 items-center justify-center`,"aria-label":A(`sidebar.openSettings`),title:A(`common.settings`),children:(0,K.jsx)(s,{icon:a,className:`h-3.5 w-3.5`})}),null,(0,K.jsx)(rt,{themeMode:O,onCycleTheme:k})]})]})]})}var Vf=new Set([`done`,`completed`,`failed`,`skipped`]);function Hf(e){return Vf.has(e.status)}function Uf(e,t){return e.filter(e=>Hf(e)===t)}var Wf={in_progress:`rgb(var(--blue))`,running:`rgb(var(--blue))`,pending:`rgb(var(--ink-faint))`,queued:`rgb(var(--ink-faint))`,done:`rgb(var(--blue))`,completed:`rgb(var(--blue))`,blocked:`rgb(var(--err))`,failed:`rgb(var(--err))`};function Gf({items:e,onDispose:t,onStop:n,onInspect:r,busy:i,readOnly:a=!1}){let{t:o}=F(),[s,c]=(0,U.useState)(!1),l=Uf(e,!1),u=Uf(e,!0),d=s?u:l;return(0,K.jsxs)(`section`,{className:`card flex flex-col ${d.length>0?`min-h-0 flex-1`:`shrink-0`}`,children:[(0,K.jsx)(et,{title:o(`panel.backlog`),right:(0,K.jsx)(`button`,{className:`text-[10px] text-ink-faint transition-colors hover:text-ink`,onClick:()=>c(e=>!e),children:o(s?`backlog.active`:`backlog.history`,{count:s?l.length:u.length})})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[d.length===0&&(0,K.jsx)(Ve,{children:o(s?`backlog.noHistory`:`backlog.empty`)}),d.map(e=>{let s=Wf[e.status]??`rgb(var(--ink-faint))`,c=e.iterate;return(0,K.jsx)(`div`,{className:`group border-b border-line/60 px-3 py-2 last:border-0`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>r?.(e.id),disabled:!r,className:`block max-w-full truncate text-left text-xs font-medium text-ink enabled:hover:text-blue-sky enabled:focus-visible:outline-none enabled:focus-visible:underline`,title:r?o(`backlog.viewDetails`):void 0,children:e.title||e.objective}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[(0,K.jsx)(Je,{color:s,children:vn(e.status,o)}),typeof e.priority==`number`&&(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:bn(e.priority,o)}),c&&(0,K.jsxs)(`span`,{className:`text-[10px] text-blue-sky`,children:[`↻ `,o(`backlog.iterating`)]})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100`,children:[!a&&c&&(0,K.jsx)(B,{variant:`ghost`,onClick:()=>n(e.id),disabled:i,title:o(`backlog.stopIterating`),children:o(`backlog.stop`)}),!a&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{variant:`ghost`,onClick:()=>t(e.id,`done`),disabled:i,title:o(`backlog.markDone`),children:`✓`}),(0,K.jsx)(B,{variant:`ghost`,onClick:()=>t(e.id,`rm`),disabled:i,title:o(`backlog.remove`),children:`✕`})]})]})]})},e.id)})]})]})}var Kf={win:`rgb(var(--blue))`,milestone:`rgb(var(--blue))`,insight:`rgb(var(--ink-dim))`,decision:`rgb(var(--ink-dim))`,failure:`rgb(var(--err))`,note:`rgb(var(--ink-faint))`};function qf({entries:e}){let{t}=F(),n=[...e].reverse();return(0,K.jsxs)(`section`,{className:`card flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(et,{title:t(`panel.journal`),right:(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.length})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[e.length===0&&(0,K.jsx)(Ve,{children:`no journal entries yet`}),n.map(e=>{let t=Kf[e.kind]??`rgb(var(--ink-faint))`,n=String(e.extra?.pricing_status??``),r=e.extra&&Object.prototype.hasOwnProperty.call(e.extra,`cost_usd`)?e.extra.cost_usd:e.cost_usd,i=typeof r==`number`&&r>0?`${V(r)}${n===`partial`||n===`unpriced`?`+`:``}`:n===`partial`||n===`unpriced`?n:``;return(0,K.jsxs)(`div`,{className:`border-b border-line/60 px-3 py-2 last:border-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full`,style:{background:t}}),(0,K.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide`,style:{color:t},children:e.kind}),(0,K.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:mt(e.ts)})]}),(0,K.jsx)(`div`,{className:`mt-1 text-xs font-medium text-ink`,children:e.title}),e.summary&&(0,K.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-snug text-ink-dim`,children:e.summary}),(0,K.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(e.tags??[]).slice(0,4).map(e=>(0,K.jsx)(`span`,{className:`rounded bg-line/60 px-1 text-[9px] text-ink-faint`,children:e},e)),i?(0,K.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:i}):null]})]},e.id)})]})]})}function Jf(e){return e==null?``:e<3?`now`:e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h`}function Yf({roles:e}){let{t}=F(),n=new Map(e.map(e=>[e.role,e])),r=He.map(e=>n.get(e)).filter(Boolean),i=e.filter(e=>!ot(e.role)),a=[...r,...i];return(0,K.jsxs)(`section`,{className:`card`,children:[(0,K.jsx)(et,{title:t(`panel.roles`)}),(0,K.jsx)(`div`,{children:a.map(e=>{let n=R.role[e.role]??R.info;return(0,K.jsxs)(`div`,{className:`grid grid-cols-[84px_minmax(0,1fr)_auto] items-center gap-2 border-b border-line/60 px-3 py-2 last:border-b-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{"data-role-dot":e.role,"aria-hidden":`true`,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{background:n}}),(0,K.jsx)(`span`,{className:`text-[11px] font-medium capitalize`,style:{color:e.active?n:R.inkDim},children:ot(e.role)?Ae(e.role,t):e.role})]}),(0,K.jsx)(`div`,{className:`min-w-0 truncate font-mono text-[10px] text-ink-faint`,title:e.model,children:e.model||`—`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-right`,children:[(0,K.jsx)(`span`,{className:`text-[10px]`,style:{color:e.active?R.ink:R.inkFaint},children:e.active?e.status||`active`:`idle`}),e.active&&Jf(e.age_s)&&(0,K.jsxs)(`span`,{className:`text-[10px] tabular-nums text-ink-faint`,children:[`· `,Jf(e.age_s)]}),e.effort&&(0,K.jsxs)(`span`,{className:`text-[10px]`,style:{color:ze(e.effort)},children:[`· `,e.effort]})]})]},e.role)})})]})}function Xf({open:e,snap:t,journal:n,busy:r,onClose:i,onDispose:a,onStop:o,onInspect:s}){let{t:c}=F();return(0,K.jsxs)(tt,{open:e,onClose:i,label:`Project inspector`,width:`max-w-6xl`,children:[(0,K.jsx)(Qe,{title:c(`panel.project`),sub:t.session.display_name||t.session.id}),(0,K.jsxs)(`div`,{className:`h-[68vh] min-h-0 space-y-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid lg:grid-cols-[minmax(0,1.4fr)_minmax(300px,0.8fr)] lg:gap-3 lg:space-y-0 lg:overflow-hidden`,children:[(0,K.jsx)(Gf,{items:t.backlog,onDispose:a,onStop:o,onInspect:s,busy:r}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,K.jsx)(Yf,{roles:t.roles}),(0,K.jsx)(qf,{entries:n})]})]})]})}var Zf=e=>e?new Date(e*1e3).toLocaleString():`—`;function Qf({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`rounded-md border border-line/70 bg-bg/40 px-3 py-2`,children:[(0,K.jsx)(`div`,{className:`text-[9px] font-semibold uppercase tracking-wider text-ink-faint`,children:e}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:t})]})}function $f({sid:e,itemId:t,onClose:n,onDone:r,onSkip:i,onStop:a,busy:o,readOnly:s=!1}){let{t:c}=F(),l=_e(e,t),u=l.data,d=u?Hf(u):!1,f=xn(u?.outcome,c);return(0,K.jsxs)(tt,{open:!!t,onClose:n,label:c(`task.details`),width:`max-w-3xl`,showClose:!1,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 border-b border-line px-4 py-3 sm:flex-nowrap sm:px-5`,children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink`,children:u?.title||c(`task.details`)}),u?(0,K.jsx)(Je,{children:vn(u.status,c)}):null]})}),!s&&u&&!d?(0,K.jsxs)(`div`,{className:`order-3 flex w-full shrink-0 items-center justify-end gap-1 sm:order-none sm:w-auto`,children:[u.iterate?(0,K.jsx)(B,{onClick:()=>a(u.id),disabled:o,children:c(`task.stopLoop`)}):null,(0,K.jsx)(B,{onClick:()=>r(u.id),disabled:o,children:c(`task.done`)}),(0,K.jsx)(B,{variant:`danger`,onClick:()=>i(u.id),disabled:o,children:c(`task.skip`)})]}):null,(0,K.jsx)(`button`,{type:`button`,"aria-label":c(`task.close`),onClick:n,className:`order-2 rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink sm:order-none`,children:`×`})]}),(0,K.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto p-4 scroll-thin sm:p-5`,children:[l.isLoading?(0,K.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,K.jsx)(Ue,{})}):null,l.isError?(0,K.jsx)(`div`,{className:`rounded-md border border-err/40 bg-err/5 p-3 text-xs text-err`,children:l.error.message}):null,u?(0,K.jsxs)(`div`,{className:`space-y-4`,children:[u.pending_question?(0,K.jsxs)(`div`,{className:`rounded-lg border border-warn/40 bg-warn/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-warn`,children:c(`task.waitingOnYou`)}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:u.pending_question})]}):null,(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.objective`)}),(0,K.jsx)(`div`,{className:`whitespace-pre-wrap rounded-lg border border-line bg-bg/50 p-3 text-sm leading-relaxed text-ink-dim`,children:u.objective||u.original_objective||c(`task.noObjective`)})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[(0,K.jsx)(Qf,{label:c(`task.priority`),value:bn(u.priority,c)}),(0,K.jsx)(Qf,{label:c(`task.started`),value:Zf(u.started_ts)}),(0,K.jsx)(Qf,{label:c(`task.finished`),value:Zf(u.finished_ts)})]}),f.length?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.outcome`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,K.jsx)(Je,{children:e},e))})]}):null,u.iterate||u.iteration_cycles_done||u.iteration_cost_usd?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.iteration`)}),(0,K.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,K.jsx)(Qf,{label:c(`task.mode`),value:u.iterate?c(`task.autoIterate`):c(`task.singlePass`)}),(0,K.jsx)(Qf,{label:c(`task.cycles`),value:`${u.iteration_cycles_done??0}/${u.iteration_max_cycles??`—`}`}),(0,K.jsx)(Qf,{label:c(`task.cost`),value:`$${(u.iteration_cost_usd??0).toFixed(2)}`})]})]}):null,u.last_error?(0,K.jsxs)(`section`,{className:`rounded-lg border border-err/30 bg-err/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:c(`task.lastError`)}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs leading-relaxed text-ink-dim`,children:u.last_error})]}):null,u.notes?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.notes`)}),(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-relaxed text-ink-dim`,children:u.notes})]}):null,u.tags?.length||u.deps?.length?(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(u.tags??[]).map(e=>(0,K.jsxs)(Je,{children:[`#`,e]},`tag-${e}`)),u.deps?.length?(0,K.jsx)(Je,{children:c(`task.dependsOnCount`,{count:u.deps.length})}):null]}):null]}):null]})]})}function ep({onPointerDown:e,onReset:t,onNudge:n,value:r,min:i=240,max:a=600,label:o=`Resize panel`}){return(0,K.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":o,"aria-valuenow":r,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:e,onDoubleClick:t,onKeyDown:e=>{e.key===`ArrowLeft`?(e.preventDefault(),n(-16)):e.key===`ArrowRight`?(e.preventDefault(),n(16)):e.key===`Home`&&(e.preventDefault(),t())},className:`group relative hidden w-2 shrink-0 cursor-col-resize items-center justify-center outline-none lg:flex`,children:(0,K.jsx)(`span`,{className:`h-full w-px bg-line/30 transition-colors duration-150 group-hover:bg-blue/70 group-focus:bg-blue/70`})})}var tp=[`handshake.service`,`handshake.project`,`handshake.ready`];function np(){let{t:e}=F(),t=(0,U.useRef)(null);return qe(t,(e,t)=>{if(t){e.set(`[data-handshake-line], [data-handshake-node]`,{opacity:1,scale:1,clearProps:`transform`});return}e.to(`[data-handshake-mark]`,{scale:1.055,duration:.75,ease:`sine.inOut`,repeat:-1,yoyo:!0,transformOrigin:`50% 50%`}),e.timeline({repeat:-1,repeatDelay:.25}).fromTo(`[data-handshake-line]`,{scaleX:0,opacity:.25,transformOrigin:`0% 50%`},{scaleX:1,opacity:.8,duration:.9,ease:`power2.inOut`}).fromTo(`[data-handshake-node]`,{autoAlpha:.25,scale:.72},{autoAlpha:1,scale:1,duration:.28,stagger:.16,ease:`back.out(1.8)`},.12).to(`[data-handshake-node]`,{autoAlpha:.35,duration:.3,stagger:.08},`+=0.35`)}),(0,K.jsxs)(`div`,{ref:t,role:`status`,"aria-label":e(`handshake.connecting`),className:`w-full max-w-xl px-6 text-center`,children:[(0,K.jsx)(`div`,{"data-handshake-mark":!0,className:`handshake-mark glass-card mx-auto flex h-16 w-16 items-center justify-center rounded-3xl text-blue shadow-glow sm:h-20 sm:w-20`,children:(0,K.jsx)(_t,{size:48,className:`text-ink`})}),(0,K.jsxs)(`div`,{className:`relative mx-auto mt-8 h-10 max-w-sm sm:max-w-md`,children:[(0,K.jsx)(`div`,{className:`absolute left-[10%] right-[10%] top-3 h-px bg-line/80`}),(0,K.jsx)(`div`,{"data-handshake-line":!0,className:`handshake-line absolute left-[10%] right-[10%] top-3 h-px`}),(0,K.jsx)(`div`,{className:`relative flex justify-between`,children:tp.map(t=>(0,K.jsxs)(`div`,{className:`flex w-20 flex-col items-center gap-2.5`,children:[(0,K.jsx)(`span`,{"data-handshake-node":!0,className:`handshake-node h-6 w-6 rounded-full border ring-4 ring-bg`,children:(0,K.jsx)(`span`,{className:`m-auto mt-[7px] block h-2 w-2 rounded-full bg-blue`})}),(0,K.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:e(t)})]},t))})]}),(0,K.jsx)(`p`,{className:`mt-9 text-base font-medium text-ink-dim`,children:e(`handshake.title`)}),(0,K.jsx)(`p`,{className:`mt-1.5 text-sm text-ink-faint`,children:e(`handshake.detail`)})]})}function rp({loading:e,hasProjects:t,error:n,onRetry:r,onNew:i,onChoose:a,canCreate:o}){let{t:s,locale:c}=F();return(0,K.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-4 px-6 text-center`,children:[e?(0,K.jsx)(np,{}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h1`,{className:`text-2xl font-semibold text-ink`,children:c===`zh-CN`?t?`继续你的项目`:`开始一个项目`:t?`Continue your work`:`Start a project`}),(0,K.jsx)(`p`,{className:`max-w-md text-sm leading-relaxed ${n?`text-err`:`text-ink-faint`}`,children:n||s(t?`landing.selectOrCreate`:`landing.noSessions`)})]}),!e&&(0,K.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[n?(0,K.jsx)(B,{onClick:r,variant:`danger`,children:s(`common.retry`)}):null,t?(0,K.jsx)(B,{onClick:a,children:s(`landing.select`)}):o?(0,K.jsx)(B,{onClick:i,variant:`primary`,children:s(`landing.new`)}):null,!t&&!n?(0,K.jsx)(`span`,{className:`lg:hidden`,children:(0,K.jsx)(B,{onClick:a,children:s(`landing.menu`)})}):null]})]})}function ip({active:e,onSelect:t,onOpenSessions:n,sidebarOpen:r=!1}){let{t:a}=F(),l=[{id:`map`,label:a(`mobile.map`),icon:p},{id:`activity`,label:a(`mobile.activity`),icon:o},{id:`workbench`,label:a(`mobile.workbench`),icon:i},{id:`preview`,label:a(`mobile.preview`),icon:c}];return(0,K.jsxs)(`nav`,{"aria-label":a(`mobile.views`),className:`mobile-tabbar glass-panel glass-panel--raised fixed inset-x-0 bottom-0 z-40 items-stretch border-t border-line/60 lg:hidden ${r?`hidden`:`flex`}`,children:[n?(0,K.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":a(`topbar.openSessions`),className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 text-ink-faint active:bg-panel-raised`,children:[(0,K.jsx)(s,{icon:h,className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-[10px] leading-none`,children:a(`mobile.sessions`)})]}):null,l.map(n=>{let r=n.id===e;return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-current":r?`page`:void 0,className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 active:bg-panel-raised ${r?`text-blue`:`text-ink-faint`}`,children:[(0,K.jsx)(s,{icon:n.icon,className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-[10px] leading-none`,children:n.label})]},n.id)})]})}function ap(e,t,n){let r=n?.height??t,i=t-r-(n?.offsetTop??0);return{keyboardInset:i>24?Math.round(i):0,compact:e<1024&&r<=600}}function op(){let[e,t]=(0,U.useState)(()=>typeof window<`u`&&ap(window.innerWidth,window.innerHeight,window.visualViewport).compact);return(0,U.useEffect)(()=>{let e=window.visualViewport,n=document.documentElement,r=null,i=()=>{r!=null&&window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let r=ap(window.innerWidth,window.innerHeight,e);n.style.setProperty(`--keyboard-inset`,`${r.keyboardInset}px`),n.dataset.compactViewport=String(r.compact),t(r.compact)})};return i(),e?.addEventListener(`resize`,i),e?.addEventListener(`scroll`,i),window.addEventListener(`resize`,i),()=>{r!=null&&window.cancelAnimationFrame(r),e?.removeEventListener(`resize`,i),e?.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),n.style.removeProperty(`--keyboard-inset`),delete n.dataset.compactViewport}},[]),e}var sp={[L.LIFE_LIFECYCLE_BLOCK]:`block`,[L.ROUND_REVIEWER_BACKEND_FAILURE]:`block`,[L.LIFE_BUDGET_PAUSE]:`warn`,[L.ROUND_STALL]:`warn`,[L.ROUND_ESCALATED]:`warn`,[L.LIFE_PLANNER_STALL_ESCALATION]:`warn`},cp=new Set([L.BUDGET_RESERVATION_DENIED,L.BUDGET_UNPRICED_BLOCKED]),lp=new Set([L.LIFE_MISSION_STARTED,L.ROUND_MAIN_COMPLETED,L.LIFE_MISSION_COMPLETED,L.LOOP_DONE,L.ROUND_START,`ui.operator`]),up=new Set([L.BUDGET_RESERVATION_CREATED,L.PROVIDER_REQUEST_STARTED]);function dp(e){let t=A(e.canonical_type??e.type);if(e.event_validation?.status===`invalid`)return t===L.ROLE_SESSION_TURN?null:{tone:`warn`,kind:`validation`,text:`invalid event ${t||`unknown`}: ${e.event_validation.errors.join(`; `)}`};if(cp.has(t))return{tone:`block`,kind:`budget`,text:`Budget exhausted or blocked — ${String(e.reason??e.text??t).trim()}`};let n=e.operator_alert===!0?`block`:sp[t];return n?{tone:n,text:String(e.text??e.reason??t).trim()}:null}function fp(e){let t=null;for(let n of e){let e=A(n.canonical_type??n.type),r=dp(n);r?t=r:(t?.kind===`validation`||t?.kind===`budget`&&up.has(e)||t&&t.kind!==`budget`&&lp.has(e))&&(t=null)}return t}async function pp(e,t){let n=Tc(e.trim());if(!n)return{kind:`not-command`};if(!n.cmd){let e=Ec(n.name);return{kind:`error`,message:e?`Unknown command ${n.name}. Did you mean ${e}?`:`Unknown command ${n.name}. Use /help for the full list.`}}if(n.cmd.id===`ask`||n.cmd.id===`crystalpilot`)return{kind:`not-command`};if(_c(n.cmd)&&!n.rest)return{kind:`error`,message:`Usage: ${n.cmd.name}${n.cmd.arg?` ${n.cmd.arg}`:``}`};try{await t[n.cmd.id](n.rest)}catch(e){return{kind:`error`,message:e instanceof Error?e.message:String(e??`Command failed`)}}return{kind:`handled`}}function mp({activeSid:e,activityEventsRef:t,notify:n,onClearEvents:r,onDispose:i,onOpenConfig:a,onOpenDoctor:o,onOpenHelp:s,onOpenIdentity:c,onOpenInspector:l,onOpenNewDaemon:u,onOpenOperations:d,onOpenSidebar:f,onOpenSkills:p,onReconnectEvents:m,onRenameProject:h,onRewriteDraft:g,onSelectProject:_,onSetArtifactPath:v,onSetEventFilter:y,onSetEventQuery:b,onSetTaskItemId:x,onSetWorkspaceView:S,onShowArtifacts:C,onStopIteration:w,onStopWaiting:T,refetchSnapshot:E}){return{status:async()=>l(),roles:async()=>d(),journal:async()=>l(),backlog:async()=>l(),item:async e=>{e&&x(e)},artifacts:async()=>C(),artifact:async e=>{e&&v(e)},events:async e=>{S(`activity`);let{filter:t,query:n}=wc(e);y(t),b(n)},find:async e=>{S(`activity`),y(`all`),b(e)},run:async()=>S(`activity`),clear:async()=>{S(`activity`),y(`all`),b(``),r(t.current.length)},cancel:async()=>T(),task:async t=>{e&&(await P.addTask(e,t),E(),n(`success`,`Task queued.`))},rewrite:async e=>{let t=e.trim();if(!t){n(`info`,`Type your prompt in the composer and press Rewrite, or use /rewrite .`);return}g(t)},plan:async t=>{if(!e)return;let r=await P.previewPlan(e,t);r.error?n(`error`,r.error):n(`info`,r.steps.map(e=>e.title).join(` +`)||`Plan preview ready.`)},nudge:async t=>{e&&(await P.nudge(e,t),n(`success`,`Guidance injected.`))},abort:async t=>{e&&(await P.abortMission(e,t||`operator abort`),n(`info`,`Abort requested.`))},note:async t=>{e&&(await P.note(e,t),n(`success`,`Note appended to timeline.`))},done:async e=>{e&&i(e,`done`)},skip:async e=>{e&&i(e,`rm`)},stop:async e=>{e&&w(e)},new:async()=>u(),daemons:async()=>f(),resume:async e=>{e&&e!==`list`?_(e):f()},attach:async e=>{e&&_(e)},rename:async t=>{!e||!t||await h(t)},doctor:async()=>o(),backend:async t=>{if(!e||!t){a();return}await P.setConfig(e,`runner_backend`,t),n(`success`,`Backend set to ${t}.`)},config:async t=>{if(!e||!t){a();return}let r=t.indexOf(`=`);r>0?(await P.setConfig(e,t.slice(0,r).trim(),t.slice(r+1).trim()),n(`success`,`Config updated.`)):a()},identity:async()=>c(),reset:async()=>{e&&(await P.resetManager(e),n(`success`,`Manager context reset.`))},skills:async t=>{if([``,`ls`,`list`].includes(t.trim().toLowerCase())){p();return}e&&n(`info`,(await P.skills(e,t||`ls`)).slice(0,400))},reconnect:async()=>m(),help:async()=>s(),quit:async()=>n(`info`,`Background work continues; close this browser tab when ready.`)}}function hp(e){return e.kind===`error`?(typeof e.reply==`string`?e.reply.trim():``)||`Manager could not handle this message.`:null}function gp(e,t){e.kind===`task`&&t.dispatchTask(e);let n=hp(e);n&&t.notifyError(n),t.refetchTranscript()}var _p={skipFirst:0,reconnectKey:0};function vp(e,t){return t.kind===`clear`?{...e,skipFirst:Math.max(0,t.offset)}:t.kind===`reconnect`?{skipFirst:0,reconnectKey:e.reconnectKey+1}:{...e,skipFirst:0}}function yp(e,t){if(!t.length)return e;let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return t?{...e,spend_usd:t.spend_usd,known_cost_usd:t.known_cost_usd,spend_status:t.spend_status,usage_calls:t.usage_calls,premium_requests:t.premium_requests,cost_updated_at:t.updated_at}:e})}async function bp(e,t,n,r=``){let i=await e.createDaemon(``,t,r),a=n.trim();return{created:i,startCampaign:a?()=>e.setContinuous(i.sid,!0,a):null}}var xp=e=>e instanceof Error?e.message:String(e||`Unknown error`);function Sp({localCwd:e,notify:t,onFocusComposer:n,queryClient:r,refetchProjects:i,selectProject:a,translate:o}){let[s,c]=(0,U.useState)(!1),l=(0,U.useRef)(!1);return{createDaemon:async(s,u,d)=>{if(l.current)return!1;l.current=!0,c(!0);try{let{created:c,startCampaign:l}=await bp(P,s,u,d),f=String(c.workdir||d||``);return r.setQueryData([`projects`],t=>({local_cwd:t?.local_cwd??e,projects:[{id:c.sid,label:s||c.sid,display_name:s,objective:``,launch_cwd:f,workdir:f,last_active:Date.now()/1e3,daemon_alive:!1,daemon_pid:null,uptime_seconds:null},...(t?.projects??[]).filter(e=>e.id!==c.sid)]})),a(c.sid),i(),window.setTimeout(n,0),t(l?`info`:`success`,l?o?o(`new.createdStarting`):`Session created and selected. Campaign is starting in the background.`:o?o(`new.createdIdle`):`Session created and selected.`),l&&l().then(()=>{r.invalidateQueries({queryKey:[`snapshot`,c.sid]}),i(),t(`success`,`Campaign started.`)}).catch(e=>{t(`error`,`Session was created, but the campaign could not start: ${xp(e)}`)}),!0}catch(e){return t(`error`,`Could not create session: ${xp(e)}`),!1}finally{l.current=!1,c(!1)}},creatingDaemon:s}}var Cp=e=>e instanceof Error?e.message:String(e||`Unknown error`);function wp({actions:e,manageActions:t,manageTargetSid:n,setManageTargetSid:r,activeSid:i,clearProjectSelection:a,continuous:o,notify:s,refetchProjects:c,selectProject:l,setDaemonManageOpen:u}){let d=e.startDaemon.isPending||e.stopDaemon.isPending||e.forceStopDaemon.isPending||t.startDaemon.isPending||t.forceStopDaemon.isPending||t.updateProject.isPending||t.deleteProject.isPending,f=(0,U.useCallback)(e=>({onSuccess:()=>s(`success`,e),onError:e=>s(`error`,Cp(e))}),[s]),p=(0,U.useCallback)(()=>e.startDaemon.mutate(void 0,f(`Daemon start requested.`)),[f,e.startDaemon]),m=(0,U.useCallback)(()=>e.forceStopDaemon.mutate(void 0,f(`Stop requested; the verified daemon process is being interrupted.`)),[f,e.forceStopDaemon]),h=(0,U.useCallback)(async()=>{try{return await t.startDaemon.mutateAsync(),s(`success`,`Daemon resumed.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[t.startDaemon,s]),g=(0,U.useCallback)(async()=>{try{return await t.forceStopDaemon.mutateAsync(),await c(),s(`success`,`Daemon stopped. This session can now be deleted.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[t.forceStopDaemon,s,c]),_=(0,U.useCallback)(async e=>{if(!n)return!1;try{return await t.updateProject.mutateAsync({sid:n,name:e}),s(`success`,`Session name updated.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[t.updateProject,n,s]),v=(0,U.useCallback)(async()=>{if(!n)return!1;try{let e=n,o=await t.deleteProject.mutateAsync();u(!1),r(null);let d=await c();if(e===i){a(`replace`);let e=Vl(d.data?.projects??[])[0];e&&l(e.id,`replace`)}return s(`success`,o.workdir_preserved?`Session moved to recoverable trash. Files remain in ${o.workdir}.`:`Session moved to recoverable trash.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[i,a,t.deleteProject,n,s,c,l,u,r]),y=(0,U.useCallback)(e=>{r(e),u(!0)},[u,r]);return{daemonBusy:d,manageDeleteProject:v,manageStopDaemon:g,manageRenameProject:_,manageStartDaemon:h,requestDispose:(0,U.useCallback)((t,n)=>e.disposeBacklog.mutate({id:t,op:n},{onSuccess:()=>s(`success`,n===`done`?`Work marked done.`:`Work removed.`),onError:e=>s(`error`,Cp(e))}),[e.disposeBacklog,s]),requestManageSession:y,requestStartDaemon:p,requestStopDaemon:m,requestStopIteration:(0,U.useCallback)(t=>e.stopBacklog.mutate(t,{onSuccess:()=>s(`success`,`Iteration stopped.`),onError:e=>s(`error`,Cp(e))}),[e.stopBacklog,s]),toggleContinuous:(0,U.useCallback)(()=>{if(!o)return;let t=!o.enabled;e.setContinuous.mutate({enabled:t,objective:o.objective},f(t?`Continuous campaign enabled.`:`Continuous campaign stopped.`))},[f,e.setContinuous,o])}}function Tp({focusComposer:e,openHelp:t,toggleKiosk:n,togglePalette:r,toggleReasoning:i,toggleSidebarCollapse:a}){(0,U.useEffect)(()=>{let o=o=>{let s=o.target,c=s?.tagName===`INPUT`||s?.tagName===`TEXTAREA`,l=o.metaKey||o.ctrlKey;l&&o.key.toLowerCase()===`k`?(o.preventDefault(),r()):l&&o.key.toLowerCase()===`t`?(o.preventDefault(),i()):l&&o.key===`.`?(o.preventDefault(),n()):l&&o.key.toLowerCase()===`b`?(o.preventDefault(),a()):l&&o.key.toLowerCase()===`j`?(o.preventDefault(),e()):!c&&o.key===`?`?(o.preventDefault(),t()):!c&&o.key===`/`&&(o.preventDefault(),e())};return window.addEventListener(`keydown`,o),()=>window.removeEventListener(`keydown`,o)},[e,t,n,r,i,a])}var Ep=e=>e instanceof Error?e.message:String(e||`Unknown error`),Dp=`argus.decision.prompted.v1`,Op=()=>{try{return window.sessionStorage.getItem(Dp)??``}catch{return``}},kp=e=>{try{window.sessionStorage.setItem(Dp,e)}catch{}};function Ap({activeSid:e,currentTaskId:t,autoOpen:n=!0,backlog:r,notify:i,pendingQuestions:a,refetchSnapshot:o}){let[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(``),p=(0,U.useRef)(!1),m=(0,U.useRef)(``),h=(0,U.useMemo)(()=>{let e=(r??[]).map(e=>({...e,operator_decision:e.operator_decision}));return kr(a??[],e,t)},[r,a,t]),g=h[0]??null,_=r!==void 0||a!==void 0,v=s!==null&&s.sid===e,y=v?{...s.card,is_current_task:t&&s.card.kind!==`domain_intake`?s.card.item_id===t:void 0}:g;return(0,U.useEffect)(()=>{if(s&&(s.sid!==e||_&&!l&&!h.some(e=>e.id===s.card.id))&&c(null),!e||!g||!n&&g.kind!==`domain_intake`||v||l)return;let t=`${e}:${g.id}`;m.current!==t&&Op()!==t&&(m.current=t,kp(t),f(``),c({sid:e,card:g}))},[e,n,h,_,g,s,v,l]),{answerPendingReply:async(t,n)=>{if(!(!e||!y||p.current)){p.current=!0,u(!0),f(``);try{let r=y.kind===`domain_intake`?await P.answerDomain(e,y.id,t,n):y.legacy?await P.answerPending(e,y.item_id,n):await P.resolveDecision(e,y.id,t,n);if(r.resolved===!1||`kind`in r&&[`error`,`cancelled`].includes(String(r.kind))){f(String(r.reply||`Could not send answer.`)),await o();return}c(e=>e===s?null:e),await o(),r.daemon&&Number(r.daemon.rc??0)!==0?i(`error`,`Answer queued, but the daemon did not start: ${r.daemon.error||`operator action required`}`):y.kind!==`domain_intake`&&i(`success`,String(r.reply||`Manager delivered your answer to the team.`))}catch(e){f(Ep(e)),i(`error`,`Could not send answer: ${Ep(e)}`),await o()}finally{p.current=!1,u(!1)}}},pendingReply:y,pendingReplyBusy:l,pendingReplyError:d,pendingReplyOpen:v,setPendingReplyOpen:t=>{f(``),t?e&&g&&c(t=>t?.sid===e?t:{sid:e,card:g}):c(null)}}}var jp=`argus.browser.project.v1`;function Mp(){try{return window.sessionStorage.getItem(jp)}catch{return null}}function Np(e){try{e?window.sessionStorage.setItem(jp,e):window.sessionStorage.removeItem(jp)}catch{}}function Pp(e,t){let n=new URL(window.location.href);e?n.searchParams.set(`project`,e):n.searchParams.delete(`project`);let r=t===`push`?`pushState`:`replaceState`;window.history[r](window.history.state,``,n.toString())}function Fp({cancelActiveMessage:e,notify:t,formatProjectMissing:n,projects:r,projectsError:i,projectsReady:a,queryClient:o,setArtifactPath:s,setSidebarOpen:c,setTaskItemId:l}){let u=(e,t)=>n?n(e,t):t?`Project “${e}” was not found. Switched to ${t}.`:`Project “${e}” was not found. Create a project to continue.`,d=new URLSearchParams(window.location.search),[f,p]=(0,U.useState)(d.get(`project`)||Mp()),m=(0,U.useRef)(f),h=(0,U.useRef)(!1);m.current=f;let g=(0,U.useCallback)(t=>{t!==m.current&&(e(),s(null),l(null)),m.current=t,p(t),Np(t)},[e,s,l]),_=(0,U.useCallback)((e,t=`push`)=>{let n=new URLSearchParams(window.location.search).get(`project`);g(e),n!==e&&Pp(e,t)},[g]),v=(0,U.useCallback)((e=`replace`)=>{let t=new URLSearchParams(window.location.search).get(`project`);g(null),t!=null&&Pp(null,e)},[g]),y=(0,U.useCallback)(e=>{o.prefetchQuery({queryKey:[`snapshot`,e],queryFn:({signal:t})=>P.prefetchSnapshot(e,t),staleTime:3e3})},[o]);return(0,U.useEffect)(()=>{if(!a)return;let e=h.current,n=Wl(r,m.current,e);if(!e&&(h.current=!0,n.id===m.current?Np(n.id):g(n.id),new URLSearchParams(window.location.search).get(`project`)!==n.id&&Pp(n.id,`replace`),n.recovered)){let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}},[g,n,t,r,a]),(0,U.useEffect)(()=>{let e=()=>{let e=new URLSearchParams(window.location.search).get(`project`);if(c(!1),!e){g(null);return}if(!a){g(e);return}let n=Ul(r,e);if(g(n.id),n.recovered){Pp(n.id,`replace`);let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[g,t,r,a,c]),{activateProject:g,activeSid:a?f&&r.some(e=>e.id===f)?f:null:i?f:null,clearProjectSelection:v,prefetchProject:y,selectProject:_,sid:f,sidRef:m}}var Ip={text:``,attachments:[],revision:0};function Lp(e){let t=(0,U.useRef)(new Map),n=(0,U.useRef)(new Map),r=(0,U.useRef)(0),i=(0,U.useRef)(!0),[,a]=(0,U.useReducer)(e=>e+1,0);(0,U.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let o=(0,U.useCallback)((e,n)=>{let o={text:n.text,attachments:[...n.attachments],revision:++r.current};return t.current.set(e,o),i.current&&a(),{sid:e,...o}},[]),s=(0,U.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??Ip;o(e,{...r,text:typeof n==`function`?n(r.text):n})},[o,e]),c=(0,U.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??Ip;o(e,{...r,attachments:typeof n==`function`?n(r.attachments):n})},[o,e]),l=(0,U.useCallback)(e=>{if(!e)return null;let n=t.current.get(e);return n||(n={...Ip,attachments:[],revision:++r.current},t.current.set(e,n)),{sid:e,...n,attachments:[...n.attachments]}},[]),u=(0,U.useCallback)(e=>i.current&&t.current.get(e.sid)?.revision===e.revision,[]),d=(0,U.useCallback)((e,t)=>u(e)?o(e.sid,{text:``,attachments:e.attachments.filter(e=>!t.includes(e))}):null,[u,o]),f=(0,U.useCallback)((e,t)=>e.sid!==t.sid||!u(e)?!1:(o(t.sid,t),!0),[u,o]),p=(0,U.useCallback)(e=>{if(!e||n.current.has(e))return null;let t={...l(e),request:++r.current};return n.current.set(e,t),a(),t},[l]),m=(0,U.useCallback)((e,t)=>{if(n.current.get(e.sid)!==e)return!1;n.current.delete(e.sid);let r=u(e);return r&&t!==void 0?o(e.sid,{...e,text:t}):i.current&&a(),r},[u,o]),h=(0,U.useCallback)(e=>{t.current.delete(e),n.current.delete(e),i.current&&a()},[]);return{draft:(e?t.current.get(e):null)??Ip,rewriting:!!(e&&n.current.has(e)),setText:s,setAttachments:c,capture:l,consume:d,restore:f,beginRewrite:p,finishRewrite:m,drop:h}}function Rp(e,t){if(!t.loadedSid||t.loadedSid!==t.sidRef.current)return null;let n=t.receipts.filter(t=>{let n=sr(t);return n?.deliveryId===e.deliveryId&&n.title===e.title&&n.summary===e.summary&&(!e.path||ql(t).some(t=>t.path===e.path))}),r=!!(t.completionId&&t.completionId===e.deliveryId);return n.length+Number(r)===1?t.loadedSid:null}function zp(e){let t=(0,U.useRef)(e);t.current=e;let n=(0,U.useRef)(null),[r,i]=(0,U.useReducer)(e=>e+1,0),a=(0,U.useCallback)(()=>{n.current?.controller.abort(),n.current=null},[]),o=(0,U.useCallback)((e,r)=>{n.current===e&&(a(),t.current.notify(`error`,`Cannot open notification: ${lt(r)}. No other session was used.`))},[a]);return(0,U.useEffect)(()=>{let e=hr(e=>{a();let r=e.sessionId??Rp(e,t.current);if(!r){t.current.notify(`info`,`This older notification cannot be automatically located. Select its session and open the result manually.`);return}if(!nr(r)){t.current.notify(`error`,`Cannot open notification: invalid session identity.`);return}let s={payload:e,target:null,phase:`resolving`,controller:new AbortController};n.current=s,t.current.queryClient.fetchQuery({queryKey:[`projects`],queryFn:P.projectIndex,staleTime:0}).then(e=>{if(n.current===s){if(!e.projects.some(e=>e.id===r))throw Error(`the target session is unavailable or no longer accessible`);s.target=r,s.phase=`loading`,t.current.selectProject(r),i()}}).catch(e=>o(s,e))});return window.addEventListener(`popstate`,a),()=>{e(),window.removeEventListener(`popstate`,a),a()}},[a,o]),(0,U.useEffect)(()=>{let e=n.current;if(!e?.target)return;let r=t.current;if(r.sidRef.current!==e.target){a();return}if(e.phase!==`loading`)return;if(r.snapshotError){o(e,r.snapshotError);return}if(r.loadedSid!==e.target)return;e.phase=`opening`;let i=e.payload.path;if(!i){n.current=null,r.noPath(),r.notify(`info`,`Notification session opened. This notification does not identify a file.`);return}P.artifact(e.target,i,e.controller.signal).then(r=>{let a=t.current;if(n.current!==e||a.sidRef.current!==e.target||a.loadedSid!==e.target)return;if(!r.exists||r.path!==i)throw Error(`the target file is unavailable`);n.current=null;let o=a.receipts.find(t=>t.delivery_id===e.payload.deliveryId&&ql(t).some(e=>e.path===i));o?a.openDelivery(o,i):a.focusPath(i)}).catch(t=>o(e,t))},[e.selectedSid,e.loadedSid,e.snapshotError,r,a,o]),a}function Bp(e,t,n){let r=n?t+8:56,i=Math.max(320,e-r-360-8);return Math.max(320,Math.min(840,i,Math.round(e*.45)))}var Vp=[`activity`,`workbench`,`map`],Hp=`argus.workspace.view.v3`;function Up(e){return Vp.includes(e)}function Wp(e,t){let n=gt(e);return n==null?t:n===`true`}function Gp(){let e=new URLSearchParams(window.location.search),[t,n]=(0,U.useState)(e.get(`kiosk`)===`1`),[r,i]=(0,U.useState)(()=>Wp(`argus.reasoning.visible.v1`,!1)),[a,o]=(0,U.useState)(()=>{let t=e.get(`view`);if(t===`mission`)return`activity`;if(Up(t))return t;let n=gt(Hp);return Up(n)?n:e.get(`kiosk`)===`1`?`map`:`activity`}),s=(0,U.useCallback)(e=>{ht(Hp,e),o(e)},[]),[c,l]=(0,U.useState)(`activity`),[u,d]=(0,U.useState)(()=>Wp(`argus.preview.expanded.v6`,!1)),[f,p]=(0,U.useState)(()=>{let e=Number(gt(`argus.sidebar.width.v2`)||256);return Number.isFinite(e)?Math.max(220,Math.min(400,e)):256}),[m,h]=(0,U.useState)(()=>{let e=Number(gt(`argus.preview.width.v2`)||440);return Number.isFinite(e)?Math.max(320,Math.min(840,e)):440}),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(()=>Wp(`argus.sidebar.expanded.v4`,!0)),{themeMode:b,themeStyle:x,cycleTheme:S}=yt(),C=(0,U.useRef)(null),w=(0,U.useRef)(null);(0,U.useEffect)(()=>{ht(`argus.sidebar.expanded.v4`,String(v)),ht(`argus.preview.expanded.v6`,String(u)),ht(`argus.sidebar.width.v2`,String(f)),ht(`argus.preview.width.v2`,String(m))},[v,f,u,m]),(0,U.useEffect)(()=>{ht(`argus.reasoning.visible.v1`,String(r))},[r]);let T=(0,U.useCallback)(()=>{d(!0),l(`preview`);let e=C.current?.clientWidth??window.innerWidth;if(e>=1024){let t=Bp(e,f,v);h(e=>Math.max(e,t))}},[v,f]),E=(0,U.useCallback)((e,t)=>{let n=C.current;if(!n)return;t.preventDefault();let r=n.getBoundingClientRect(),i=e===`left`?f:m;n.dataset.resizing=e,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let a=t=>{if(e===`left`){let e=u?m+8:0,n=Math.max(220,Math.min(400,r.width-e-360-8));i=Math.max(220,Math.min(n,t.clientX-r.left))}else{let e=v?f+8:56,n=Math.max(320,Math.min(840,r.width-e-360-8));i=Math.max(320,Math.min(n,r.right-t.clientX))}w.current??=window.requestAnimationFrame(()=>{n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),w.current=null})},o=()=>{w.current!=null&&window.cancelAnimationFrame(w.current),w.current=null,n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),e===`left`?p(i):h(i),delete n.dataset.resizing,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o,{once:!0}),window.addEventListener(`pointercancel`,o,{once:!0})},[v,f,u,m]);return(0,U.useEffect)(()=>{let e=()=>{if(window.innerWidth<1024||!C.current)return;let e=C.current.clientWidth,t=v?f:56,n=u?m:0,r=(v?8:0)+(u?8:0),i=Math.max(540,e-360-r);if(t+n<=i)return;let a=u?Math.max(320,Math.min(m,i-t)):n,o=v?Math.max(220,Math.min(f,i-a)):t;o+a>i&&u&&(a=Math.max(320,i-o)),v&&p(o),u&&h(a)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[v,f,u,m]),{cycleTheme:S,kiosk:t,leftPanelOpen:v,leftWidth:f,mobileView:c,openPreview:T,resizeSidebar:E,rightPanelOpen:u,rightWidth:m,setKiosk:n,setLeftPanelOpen:y,setLeftWidth:p,setMobileView:l,setRightPanelOpen:d,setRightWidth:h,setShowReasoning:i,setSidebarOpen:_,setWorkspaceView:s,shellRef:C,showReasoning:r,sidebarOpen:g,themeMode:b,themeStyle:x,workspaceView:a}}function Kp(e){let t=e.trim();if(!t||/\s/.test(t))return``;if(!t.includes(`?`)&&!t.includes(`://`))return t;try{return new URL(t,window.location.href).searchParams.get(`token`)?.trim()??``}catch{return``}}function qp(e){try{let t=new URL(window.location.href),n=new URL(e.trim(),t);return n.origin===t.origin&&/^\/pair\/[\w-]{32}$/.test(n.pathname)?n.toString():``}catch{return``}}function Jp({error:e,onRetry:t}){let{t:n}=F(),r=M(e),i=e instanceof E,[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``);return!r&&!i?null:(0,K.jsxs)(`div`,{role:`alert`,className:`fixed left-1/2 top-3 z-[100] flex w-[min(92vw,42rem)] -translate-x-1/2 flex-wrap items-start gap-3 rounded-xl border border-err/50 bg-panel/95 px-4 py-3 text-left text-sm text-ink shadow-xl backdrop-blur`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 font-mono font-bold text-err`,children:`!`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`strong`,{className:`block text-err`,children:n(r?`connection.pairingTitle`:`connection.unreachableTitle`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-ink-dim`,children:n(r?`connection.pairingDetail`:`connection.unreachableDetail`)})]}),r&&!a?(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`shrink-0 rounded-md border border-blue/45 bg-blue/10 px-2.5 py-1 text-xs font-medium text-blue hover:bg-blue/15`,children:n(`connection.pairAgain`)}):r?null:(0,K.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded-md border border-err/40 px-2.5 py-1 text-xs text-err hover:bg-err/10`,children:n(`common.retry`)}),r&&a?(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=qp(s);if(t){window.location.replace(t);return}let r=Kp(s);if(!r){u(n(`connection.pairingInvalid`));return}let i=new URL(window.location.href);i.searchParams.set(`token`,r),window.location.replace(i.toString())},className:`flex w-full basis-full flex-wrap gap-2 pl-7`,children:[(0,K.jsx)(`label`,{className:`sr-only`,htmlFor:`pairing-link`,children:n(`connection.pairingInput`)}),(0,K.jsx)(`input`,{id:`pairing-link`,"data-autofocus":!0,type:`password`,autoComplete:`off`,value:s,onChange:e=>{c(e.target.value),u(``)},placeholder:n(`connection.pairingPlaceholder`),className:`h-9 min-w-0 flex-1 rounded-md border border-line bg-bg px-3 text-xs text-ink outline-none focus:border-blue`}),(0,K.jsx)(`button`,{type:`submit`,className:`h-9 rounded-md border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white`,children:n(`connection.connect`)}),l?(0,K.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-err`,children:l}):null]}):null]})}function Yp(e){try{let t=JSON.parse(gt(e)||`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Xp(e,t,n,r=!0){let i=(0,U.useRef)(),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(null),l=(0,U.useCallback)(t=>{if(!e)return;let n=`argus.delivery.seen.v1:${e}`;ht(n,JSON.stringify([...new Set([...Yp(n),t])].slice(-80)))},[e]),u=(0,U.useCallback)((t,n)=>{if(!e)return;l(t.delivery_id);let r=ql(t),i=r.find(e=>e.path===n)?.path||r[0]?.path||null;o({sid:e,receipt:t,path:i}),c(null)},[e,l]);return(0,U.useEffect)(()=>{if(!e||!t)return;let a=n?.delivery_id;if(i.current?.sid!==e){i.current={sid:e,ids:new Set(a?[a]:[])},o(null),c(null);return}!a||i.current.ids.has(a)||!r||(i.current.ids.add(a),n&&ql(n).length&&!Yp(`argus.delivery.seen.v1:${e}`).includes(a)&&c({sid:e,receipt:n}))},[e,t,n,r]),{selection:a?.sid===e?a:null,open:u,fresh:s?.sid===e?s.receipt:null,dismissFresh:(0,U.useCallback)(()=>c(null),[]),close:(0,U.useCallback)(()=>o(null),[]),selectPath:(0,U.useCallback)(e=>o(t=>t&&{...t,path:e}),[])}}var Zp=e({default:()=>nm}),Qp=0,$p=(0,U.lazy)(async()=>({default:(await Se(()=>import(`./ResearchWorkbenchPanel-7s5IqqE9.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)).ResearchWorkbenchPanel})),em=(0,U.lazy)(async()=>({default:(await Se(()=>import(`./MapPanel-BvIILI52.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,15,10,16,12,17]),import.meta.url)).MapPanel}));function tm(e,t){let[n,r]=(0,U.useState)(e),i=(0,U.useRef)(e),a=(0,U.useRef)(null),o=(0,U.useRef)(0);return i.current=e,(0,U.useEffect)(()=>{if(e===n)return;let s=o.current+t-Date.now();if(s<=0){o.current=Date.now(),r(e);return}a.current||=setTimeout(()=>{a.current=null,o.current=Date.now(),r(i.current)},s)},[e,n,t]),(0,U.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),n}function nm(){let{locale:e,t}=F(),n=e=>e instanceof fe?t(`connection.pairingDetail`):lt(e),r=S(),i=he(),a=ve(),o=(0,U.useMemo)(()=>Vl(yp(i.data?.projects??[],a.data?.projects??[])),[a.data?.projects,i.data?.projects]),s=i.data?.local_cwd??``,c=[i.error,a.error].find(e=>ee(e)),[l,u]=(0,U.useState)(`none`),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(`feed`),h=(0,U.useCallback)(e=>{f(null),m(e),u(`learning`)},[]),g=(0,U.useCallback)((e,t=`recent`)=>{f(e?{kind:`skill`,item:e}:null),m(e?.scope??(t===`recent`?`feed`:t)),u(`learning`)},[]),_=(0,U.useCallback)(e=>{f(e?{kind:`knowledge`,item:e}:null),m(e?.scope===`private`?`global`:e?.scope??`feed`),u(`learning`)},[]),{cycleTheme:v,kiosk:y,leftPanelOpen:b,leftWidth:x,mobileView:C,openPreview:w,resizeSidebar:T,rightPanelOpen:E,rightWidth:D,setKiosk:O,setLeftPanelOpen:k,setLeftWidth:A,setMobileView:j,setRightPanelOpen:M,setRightWidth:N,setShowReasoning:I,setSidebarOpen:te,setWorkspaceView:L,shellRef:ne,showReasoning:re,sidebarOpen:ae,themeMode:oe,workspaceView:le}=Gp(),[de,pe]=(0,U.useState)(le===`workbench`),[_e,ye]=(0,U.useState)(0),xe=(0,U.useCallback)(()=>{u(`none`),j(`activity`),L(`workbench`),ye(e=>e+1)},[j,L]);(0,U.useEffect)(()=>{le===`workbench`&&pe(!0)},[le]);let Se=op(),[Ce,we]=(0,U.useState)(0),[Te,Ee]=(0,U.useState)(0),[De,ke]=(0,U.useState)(`auto`),[Ae,je]=(0,U.useState)(!1),[R,Me]=(0,U.useState)([]),Ne=(0,U.useRef)(null),[z,Pe]=(0,U.useState)([]),[Fe,Ie]=(0,U.useState)(null),[Le,Re]=(0,U.useState)({path:``,token:0}),[ze,Be]=(0,U.useState)(null),[Ve,He]=(0,U.useState)(!1),[Ue,Ge]=(0,U.useState)(null),[Ke,qe]=(0,U.useState)(null),Je=(0,U.useRef)(!1),Ye=(0,U.useRef)(null),Xe=(0,U.useRef)(0),Ze=(0,U.useRef)(),Qe=(0,U.useRef)({sid:``,completionId:``,view:null,artifacts:[]}),$e=(0,U.useRef)(()=>void 0),[et,B]=(0,U.useState)(null),[nt,rt]=(0,U.useReducer)(vp,_p),[it,at]=(0,U.useState)(`all`),[ot,st]=(0,U.useState)(``),ct=(0,U.useCallback)(()=>B(null),[]),V=(0,U.useCallback)((e,t)=>{B({id:++Qp,tone:e,message:t})},[]),ut=(0,U.useCallback)(()=>{let e=!!Ye.current;return Xe.current+=1,Ye.current?.controller.abort(),Ye.current=null,je(!1),Pe([]),e},[]),dt=(0,U.useCallback)(()=>{let e=Ye.current;if(!e||!ut())return;let n=Xe.current;V(`info`,t(`chat.stoppingReply`)),P.cancelMessage(e.sid,e.serverRequestId).then(e=>{Xe.current===n&&V(`info`,t(e.requested?`chat.stopReplyRequested`:`chat.replyAlreadyFinished`))}).catch(e=>{Xe.current===n&&V(`error`,t(`chat.stopReplyFailed`,{error:lt(e)}))})},[ut,V,t]),{activeSid:H,clearProjectSelection:ft,prefetchProject:mt,selectProject:ht,sid:gt,sidRef:_t}=Fp({cancelActiveMessage:ut,notify:V,formatProjectMissing:(e,n)=>n?t(`project.missingSwitched`,{requested:e??``,fallback:n}):t(`project.missingCreate`,{requested:e??``}),projects:o,projectsError:i.isError,projectsReady:i.isSuccess,queryClient:r,setArtifactPath:Ie,setSidebarOpen:te,setTaskItemId:Be}),{draft:{text:vt,attachments:yt},rewriting:bt,setText:xt,setAttachments:Et,capture:Ot,consume:kt,restore:At,beginRewrite:jt,finishRewrite:Mt,drop:Nt}=Lp(gt),Pt=(0,U.useCallback)((e,t)=>{$e.current(),ht(e,t)},[ht]),Ft=(0,U.useCallback)(e=>{$e.current(),ft(e)},[ft]);(0,U.useEffect)(()=>ke(`auto`),[H]),(0,U.useEffect)(()=>{Re(e=>e.path?{path:``,token:e.token+1}:e)},[gt]),(0,U.useEffect)(()=>()=>{Xe.current+=1,Ye.current?.controller.abort(),Ye.current=null},[]),(0,U.useEffect)(()=>_r(),[]);let It=(0,U.useCallback)(e=>{let t=(e||``).trim(),n=_t.current;if(!t||!n)return;let r=jt(n);r&&P.rewritePrompt(n,t).then(e=>{if(e.error||!e.rewritten.trim()){Mt(r)&&_t.current===n&&V(`error`,`Rewrite failed: ${e.error||`empty rewrite`} — your prompt is unchanged`);return}if(!Mt(r,e.rewritten)||_t.current!==n)return;we(e=>e+1);let t=e.questions.length?` Manager asks: ${e.questions.join(` · `)}`:``;V(`success`,`Prompt rewritten — review it, then send.${t}`)},e=>{Mt(r)&&_t.current===n&&V(`error`,`Rewrite failed: ${lt(e)} — your prompt is unchanged`)})},[jt,Mt,V,_t]),{createDaemon:Lt,creatingDaemon:Rt}=Sp({localCwd:s,notify:V,onFocusComposer:()=>we(e=>e+1),queryClient:r,refetchProjects:i.refetch,selectProject:Pt,translate:t}),zt=(0,U.useCallback)(()=>{Lt(``,``,``)},[Lt]),Bt=(0,U.useRef)(zt);Bt.current=zt,(0,U.useEffect)(()=>gr(()=>Bt.current()),[]);let Vt=ue(H),Ht=ue(Ue),W=Vt.data,G=W?.session.id===H?H:null,Ut=W?.continuous,Wt=ie(G,!0),{events:Gt,connected:Kt}=me(G,nt.reconnectKey),qt=(0,U.useMemo)(()=>ge(Gt),[Gt]),Jt=(0,U.useMemo)(()=>be(Gt),[Gt]);(0,U.useEffect)(()=>{if(!G||!qt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`artifacts`,G],exact:!0})},180);return()=>window.clearTimeout(e)},[qt,G,r]),(0,U.useEffect)(()=>{if(!G||!Jt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`snapshot`,G],exact:!0})},80);return()=>window.clearTimeout(e)},[G,r,Jt]);let Yt=(0,U.useMemo)(()=>fp(Gt),[Gt]),{query:Xt,events:Zt,status:Qt}=Dt(G,!0,Gt,R,Ne.current),$t=G&&W?.manager_requests?.filter(e=>e.status===`running`).at(-1)?.request_id||``,en=Ae||!!$t;(0,U.useEffect)(()=>{if(!G)return;let e=Ye.current;if($t){e||(Ye.current={id:++Xe.current,serverRequestId:$t,sid:G,controller:new AbortController,recovered:!0},je(!0));return}e?.recovered&&e.sid===G&&(Ye.current=null,je(!1),Pe([]),Xt.refetch())},[$t,G,Xt.refetch]);let tn=se(H,20,l===`inspector`),nn=tm((0,U.useMemo)(()=>({sid:G,events:Gt,conversation:Zt}),[G,Gt,Zt]),250),rn=nn.sid===G?nn.events:[],an=nn.sid===G?nn.conversation:[],on=(0,U.useMemo)(()=>W?bd(W,Zt,Wt.data??[]):null,[Zt,Wt.data,W]),{answerPendingReply:sn,pendingReply:cn,pendingReplyBusy:ln,pendingReplyError:un,pendingReplyOpen:dn,setPendingReplyOpen:fn}=Ap({activeSid:H,currentTaskId:on?.mission.id,autoOpen:le!==`map`,backlog:W?.backlog,notify:V,pendingQuestions:W?.pending_questions,refetchSnapshot:Vt.refetch}),pn=W?.daemon.alive&&on?.routing.vertical===`research`?on.active_role.startsWith(`reviewer`)?`reviewing`:on.active_role.startsWith(`engineer`)?`revising`:void 0:void 0,mn=Xl((0,U.useMemo)(()=>cc(Zt),[Zt]),on?.delivery??null,Zt),hn=W?.backlog.some(e=>[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))??!1,gn=Ed(on)&&!hn&&!W?.continuous?.enabled,_n=G&&gn&&on?.mission.id?`completion:${G}:${on.mission.id}`:``;Qe.current={sid:G||``,completionId:_n,view:on,artifacts:Wt.data??[]};let vn=(0,U.useCallback)(()=>{w()},[w]),yn=(0,U.useCallback)((e,t=!0)=>{let n=e.trim();if(!n){t&&L(`map`);return}if(le===`map`||!Wt.data?.some(e=>e.path===n&&e.exists)){Ie(n);return}M(!0),j(`preview`),Re(e=>({path:n,token:e.token+1}))},[Wt.data,j,M,L,le]),bn=Xp(G,!!W&&!Xt.isPending,mn,!Fe&&!Zl(W?.backlog??[],mn?.item_id)),xn=bn.open,Sn=(0,U.useMemo)(()=>{let e=new Map;for(let t of Zt){let n=t.delivery;n?.delivery_id&&Array.isArray(n.targets)&&e.set(n.delivery_id,n)}for(let t of[on?.delivery,mn])t&&e.set(t.delivery_id,t);return[...e.values()].filter(e=>ql(e).length).sort((e,t)=>t.delivered_at-e.delivered_at)},[Zt,on?.delivery,mn]);(0,U.useEffect)(()=>{G&&mn?.delivery_id&&r.invalidateQueries({queryKey:[`artifacts`,G],exact:!0})},[G,mn?.delivery_id,r]),(0,U.useEffect)(()=>{if(!G)return;let e=Ze.current;if(!e||e.sid!==G){Ze.current={sid:G,id:_n||null};return}if(!_n){Ze.current={sid:G,id:null};return}if(e.id===_n)return;let n=window.setTimeout(()=>{let e=Qe.current;if(e.sid!==G||e.completionId!==_n||!e.view)return;let n=e.view.delivery,r=jd(e.artifacts),i=or({completionId:_n,sessionId:G,title:n?.title||e.view.mission.title||t(`mission.taskCompleted`),summary:n?.summary||e.view.mission.summary,path:n?.primary_target?.path||r?.path});i&&fr(i),Ze.current={sid:G,id:_n}},500);return()=>window.clearTimeout(n)},[_n,G,t]),$e.current=zp({selectedSid:gt,loadedSid:G,sidRef:_t,snapshotError:Vt.error,queryClient:r,receipts:Xt.isPending?[]:Sn,completionId:_n,selectProject:e=>{ht(e),te(!1)},openDelivery:xn,focusPath:e=>{Wt.data?.some(t=>t.path===e&&t.exists)?yn(e):Ie(e)},noPath:()=>{j(`activity`),L(`map`)},notify:V});let Cn=(0,U.useRef)(Zt);Cn.current=Zt,(0,U.useEffect)(()=>{at(`all`),st(``),Me([]),rt({kind:`reset`})},[G]);let wn=ce(H,W?.daemon_commands?.revision),Tn=ce(Ue,Ht.data?.daemon_commands?.revision),En=(0,U.useCallback)(async e=>{qe(e);try{await P.startDaemon(e),await i.refetch(),V(`success`,t(`sidebar.resumeSuccess`))}catch(e){V(`error`,t(`sidebar.resumeFailed`,{error:lt(e)}))}finally{qe(null)}},[V,i,t]),{daemonBusy:Dn,manageDeleteProject:On,manageStopDaemon:kn,manageRenameProject:An,manageStartDaemon:jn,requestDispose:Mn,requestManageSession:Nn,requestStartDaemon:Pn,requestStopDaemon:In,requestStopIteration:Ln,toggleContinuous:Rn}=wp({actions:wn,manageActions:Tn,manageTargetSid:Ue,setManageTargetSid:Ge,activeSid:H,clearProjectSelection:Ft,continuous:Ut,notify:V,refetchProjects:i.refetch,selectProject:Pt,setDaemonManageOpen:He}),zn=(0,U.useCallback)(async e=>{if(!H)return;let t=await wn.updateProject.mutateAsync({sid:H,name:e});V(`success`,`Renamed to "${t.name}".`)},[wn.updateProject,H,V]),Bn=(0,U.useMemo)(()=>mp({activeSid:H,activityEventsRef:Cn,notify:V,onClearEvents:e=>rt({kind:`clear`,offset:e}),onDispose:Mn,onOpenConfig:()=>u(`config`),onOpenDoctor:()=>u(`doctor`),onOpenHelp:()=>u(`help`),onOpenIdentity:()=>u(`identity`),onOpenInspector:()=>u(`inspector`),onOpenNewDaemon:zt,onOpenOperations:xe,onOpenSidebar:()=>te(!0),onOpenSkills:()=>g(void 0,`global`),onReconnectEvents:()=>rt({kind:`reconnect`}),onRenameProject:zn,onRewriteDraft:It,onSelectProject:Pt,onSetArtifactPath:Ie,onSetEventFilter:at,onSetEventQuery:st,onSetTaskItemId:Be,onSetWorkspaceView:L,onShowArtifacts:vn,onStopIteration:Ln,onStopWaiting:dt,refetchSnapshot:Vt.refetch}),[H,V,vn,g,xe,zn,Mn,Ln,It,Pt,Vt.refetch,dt,L]);Tp({focusComposer:()=>we(e=>e+1),openHelp:()=>u(`help`),toggleKiosk:()=>O(e=>!e),togglePalette:()=>u(e=>e===`palette`?`none`:`palette`),toggleReasoning:()=>I(e=>!e),toggleSidebarCollapse:()=>k(e=>!e)});let Vn=async(e,n=[],i)=>{let a=H;if(!a||a!==_t.current||Je.current||Ye.current)return!1;let o=Xe.current;Je.current=!0;let s,c,l;try{if(!n.length){let t=await pp(e,Bn);if(t.kind===`handled`)return i?.({type:`settled`,outcome:`message`}),!0;if(t.kind===`error`)return V(`error`,t.message),!1}if(_t.current!==a||Xe.current!==o)return!1;s=++Xe.current,c=Oe(),l=new AbortController,Ye.current={id:s,serverRequestId:c,sid:a,controller:l}}finally{Je.current=!1}let u=()=>{let e=Ye.current;return!!(e&&e.id===s&&e.sid===a&&_t.current===a&&!l.signal.aborted)},d=()=>{Ye.current?.id===s&&(Ye.current=null,je(!1),Pe([]))};je(!0),Pe([]);let f=[];if(n.length)try{let e=await P.uploadAttachments(a,n,l.signal);if(!u())return!1;f=e.attachments.map(e=>({attachment_id:e.attachment_id}))}catch(e){return u()&&(V(`error`,t(`chat.attachmentUploadFailed`,{error:lt(e)})),d()),!1}let p=Ne.current===a;Ne.current=a,Me(t=>St([...p?t:[],wt(a,s,e)],a,s,[]));let m=(e,t=``,n=`auto`)=>{!u()||typeof e!=`string`||!e.trim()||Me(r=>Tt(r,a,s,e,t,Date.now(),n))},h=e=>{if(!u())return;let t=e.item;typeof t?.id==`string`&&i?.({type:`task`,taskId:t.id});let n=e.daemon&&typeof e.daemon==`object`?e.daemon:null,r=typeof e.reply==`string`?e.reply:null;n?.admission_required?V(`error`,r||`Task queued, but all daemon slots are busy: ${String(n.error||`operator action required`)}`):n&&Number(n.rc??0)!==0?V(`error`,r||`Task queued, but executor did not start: ${String(n.error||`unknown error`)}`):r&&!i&&V(`success`,r),Vt.refetch?.()},g=e=>{u()&&(r.invalidateQueries({queryKey:[`artifacts`,a]}),gp(e,{dispatchTask:h,notifyError:e=>V(`error`,e),refetchTranscript:()=>{Xt.refetch()}}))};return(async()=>{let t=!1,n=null,r=[];try{try{await P.messageStream(a,e,{onPhase:(e,t,n)=>{if(!u()||n.heartbeat)return;r=ro(r,{label:e,role:t,kind:n.kind,detail:n.detail,heartbeat:n.heartbeat,quietS:n.quietS,tool:n.tool,toolKind:n.toolKind,callId:n.callId,status:n.status,output:n.output}),Pe(r);let i=oo(r);i.length&&Me(e=>St(e,a,s,i,Date.now(),!0))},onDelta:(e,n,r)=>{u()&&(t=!0,m(e,n,r===`append`||r===`snapshot`?r:`auto`))},onDone:e=>{if(!u())return;e.kind!==`error`&&ke(`auto`),r=io(r),Pe(r);let t=lo(e.steps),n=t.length?t:oo(r,Date.now()/1e3,!0);Me(t=>St(t,a,s,n,Date.now(),!1,e.kind===`error`?`failed`:`completed`)),m(e.reply,``,`snapshot`),g(e);let o=e.item;(e.kind!==`task`||typeof o?.id!=`string`)&&i?.({type:`settled`,outcome:e.kind===`error`?`error`:`message`})},onError:e=>{u()&&(n=e)}},{signal:l.signal,attachments:f,routeOverride:De,requestId:c})}catch(e){u()&&(n=e)}if(!u())return;n&&(V(`error`,pt(n,t)),i?.({type:`settled`,outcome:`error`}))}finally{Me(e=>Ct(e,s,Date.now(),n&&!l.signal.aborted?`failed`:`stopped`)),l.signal.aborted&&i?.({type:`settled`,outcome:`cancelled`}),d()}})(),!0},Hn=(0,U.useRef)(Vn);Hn.current=Vn;let Un=async(e,t=[],n,r)=>{let i=Ot(_t.current);if(!i)return!1;if(r?.whileRunning){try{if(!t.length){let n=await pp(e,Bn);if(n.kind===`error`)return V(`error`,n.message),!1;if(n.kind===`handled`)return kt(i,t),!0}await P.queueFollowup(i.sid,e,De)}catch(e){return V(`error`,lt(e)),!1}return kt(i,t),!0}let a=null,o=!1,s=!t.length&&Tc(e.trim())?.cmd?.id===`rewrite`,c=await Vn(e,t,e=>{e.type===`settled`&&e.outcome===`error`&&(o=!0,a&&At(a,i)),_t.current===i.sid&&n?.(e)});return c&&!o&&!s&&(a=kt(i,t)),c},Wn=(0,U.useMemo)(()=>{let n=al(hc,e=>{Hn.current(e)},e=>{xt(e),we(e=>e+1)},e),r=[...y?[]:[{id:`new`,label:t(`palette.newDaemon`),hint:`+`,group:t(`palette.view`),run:zt}],{id:`transcript`,label:t(`palette.openTranscript`),hint:`/transcript`,group:t(`palette.view`),run:()=>u(`transcript`)},{id:`inspector`,label:t(`palette.openProject`),hint:t(`palette.projectHint`),group:t(`palette.view`),run:()=>u(`inspector`)},{id:`operations`,label:t(`palette.openOperations`),hint:t(`palette.operationsHint`),group:t(`palette.view`),run:xe},{id:`verticals`,label:t(`verticals.openStore`),hint:t(`verticals.paletteHint`),group:t(`palette.view`),run:()=>u(`verticals`)},{id:`help`,label:t(`help.title`),hint:`?`,group:t(`palette.view`),run:()=>u(`help`)},{id:`reasoning`,label:t(re?`palette.hideReasoning`:`palette.showReasoning`),hint:`⌘T`,group:t(`palette.view`),run:()=>I(e=>!e)},{id:`kiosk`,label:t(y?`palette.exitKiosk`:`palette.enterKiosk`),hint:`⌘.`,group:t(`palette.view`),run:()=>O(e=>!e)}],i=y?[]:[{id:`message`,label:t(`palette.messageArgus`),hint:`/`,group:t(`palette.action`),run:()=>we(e=>e+1)},...en?[{id:`cancel-message`,label:t(`palette.stopWaiting`),hint:`Esc`,group:t(`palette.action`),run:dt}]:[],...Ut?[{id:`continuous`,label:Ut.enabled?t(`palette.stopContinuous`):t(`palette.startContinuous`),group:t(`palette.action`),run:Rn}]:[],...W?.daemon.control_available===!1?[]:[W?.daemon.alive?{id:`stop`,label:t(`palette.stopDaemon`),group:t(`palette.action`),run:In}:{id:`start`,label:t(`palette.startDaemon`),group:t(`palette.action`),run:Pn}]],a=o.map(e=>({id:`p-${e.id}`,label:Bl(e)?(e.label||e.display_name||``).trim():e.objective.trim()||t(`sidebar.unnamedSession`),hint:e.daemon_alive?`● ${t(`common.live`)}`:`○`,keywords:`${e.id} ${e.display_name??``} ${e.objective} ${e.daemon_alive?`live running`:`stopped idle`}`,group:t(`palette.project`),run:()=>Pt(e.id)}));return[...r,...i,...n,...a]},[o,W?.daemon.alive,y,re,Ut?.enabled,en,dt,xt,e,t]);return(0,K.jsx)(id,{sid:H,readOnly:y,children:(0,K.jsxs)(We,{ref:ne,style:{"--sidebar-width":`${x}px`,"--preview-width":`${D}px`},children:[(0,K.jsx)(Jp,{error:c,onRetry:()=>{i.refetch(),a.refetch()}}),bn.fresh&&!bn.selection&&(0,K.jsxs)(`div`,{className:`delivery-toast`,role:`status`,"aria-live":`polite`,children:[(0,K.jsxs)(`span`,{children:[e===`zh-CN`?`新交付:`:`New delivery: `,bn.fresh.title]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>xn(bn.fresh),children:e===`zh-CN`?`查看`:`Open`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":e===`zh-CN`?`关闭`:`Dismiss`,onClick:bn.dismissFresh,children:`×`})]}),bn.selection&&(0,K.jsx)(bu,{sid:bn.selection.sid,path:bn.selection.path,delivery:bn.selection.receipt,deliveries:Sn,reviewActivity:bn.selection.sid===G?pn:void 0,onSelectDelivery:xn,onSelectPath:bn.selectPath,onClose:bn.close},`${bn.selection.sid}:${bn.selection.receipt.delivery_id}`),!y&&ae?(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`common.closeSessions`),onClick:()=>te(!1),className:`fixed inset-0 z-30 bg-black/40 lg:hidden`}):null,y?null:(0,K.jsx)(Bf,{projects:o,activeId:H,activeWork:G?{sessionId:G,status:Vr(W,on,Zt),connected:Kt&&!Vt.isError}:void 0,localCwd:s,onSelect:e=>{Pt(e),te(!1)},onPrefetch:mt,onManage:Nn,onResume:e=>void En(e),resumingId:Ke,onOpenPanel:e=>u(e),onOpenLearning:h,onOpenVerticals:()=>u(`verticals`),onNew:zt,loading:i.isLoading,creating:Rt,error:i.isError?lt(i.error):void 0,onRetry:()=>void i.refetch(),mobileOpen:ae,collapsed:!b,onToggleCollapse:()=>k(e=>!e),themeMode:oe,onCycleTheme:v}),!y&&b?(0,K.jsx)(ep,{label:t(`common.resizeSessions`),value:x,min:220,max:400,onPointerDown:e=>T(`left`,e),onReset:()=>A(256),onNudge:e=>A(t=>Math.max(220,Math.min(400,t+e)))}):null,(0,K.jsx)(`main`,{className:`flex min-w-0 flex-1 overflow-x-hidden`,children:W?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`${C===`activity`?`flex`:`hidden`} ${le===`map`&&!y?`mobile-scroll-region`:``} glass-panel glass-panel--main h-full min-w-0 flex-1 flex-col lg:flex`,children:[(0,K.jsx)(zl,{sid:G}),le!==`map`&&(0,K.jsx)(ri,{events:Zt,snap:W,streamOk:Kt,onStart:Pn,onStop:In,onManage:()=>H&&Nn(H),busy:Dn,snapshotStale:Vt.isError,readOnly:y,missionView:on}),(0,K.jsxs)(`nav`,{"aria-label":t(`mobile.views`),className:`hidden h-11 shrink-0 items-center gap-3 border-b border-line/60 px-5 lg:flex`,children:[(0,K.jsxs)(`div`,{className:`workspace-tabs`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>L(`map`),className:`workspace-tab`,"data-selected":le===`map`,children:t(`mobile.map`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>L(`activity`),className:`workspace-tab`,"data-selected":le===`activity`,children:t(`mobile.activity`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>L(`workbench`),className:`workspace-tab`,"data-selected":le===`workbench`,children:t(`mobile.workbench`)})]}),(0,K.jsxs)(`button`,{type:`button`,className:`ml-auto px-2 py-1 text-sm text-ink-dim hover:text-ink`,"aria-expanded":E,onClick:()=>{E?(M(!1),j(`activity`)):vn()},children:[e===`zh-CN`?`文件`:`Files`,Wt.data?.length?` · ${Wt.data.filter(e=>e.exists).length}`:``]})]}),!y&&(0,K.jsx)(Fn,{sid:H,onOpenKnowledge:()=>_(),onOpenSkills:()=>g()}),le===`map`&&(0,K.jsx)(U.Suspense,{fallback:(0,K.jsx)(`div`,{className:`m-auto text-sm text-ink-faint`,children:t(`common.loading`)}),children:(0,K.jsx)(em,{snapshot:W,events:rn,managerSteps:z,draft:vt,onDraftChange:xt,onSend:Un,attachments:yt,onAttachmentsChange:Et,pending:en,onCancel:dt,focusSignal:Ce,readOnly:y,onOpenSettings:()=>u(`config`),currentTaskId:on?.mission.id,routeOverride:De,onRouteOverrideChange:ke,conversationEvents:an,connected:Kt,artifacts:Wt.data??[],deliveryCount:Sn.length,onOpenDelivery:()=>{let e=Jl(Sn,on?.routing.vertical||``);e&&xn(e.receipt,e.path)},onOpenReceipt:xn,onOpenArtifact:Ie,onAnswer:()=>fn(!0)},W.session.id)}),(0,K.jsxs)(`div`,{className:`${le===`activity`?`flex`:`hidden`} workspace-view-surface min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(Rl,{alert:Yt}),(0,K.jsx)(`div`,{className:`flex flex-1 flex-col ${Se?`min-h-0`:`min-h-[209px] lg:min-h-0`}`,children:(0,K.jsx)(dc,{snapshot:W,missionView:on,events:Zt,connected:Kt&&!Vt.isError,showReasoning:re,onToggleReasoning:()=>I(e=>!e),historyStatus:Qt,historyRefreshing:Xt.isFetching,onRetryHistory:()=>void Xt.refetch(),embedded:!0,filter:it,query:ot,skipFirst:nt.skipFirst,artifacts:Wt.data,onOpenArtifact:yn,onOpenDelivery:xn},G)}),y?null:(0,K.jsx)(`div`,{className:`composer-dock shrink-0 px-4 pt-3`,children:(0,K.jsxs)(`div`,{className:`mx-auto w-full max-w-full lg:max-w-[61.8vw]`,children:[(0,K.jsx)(Il,{questions:W.pending_questions??[],backlog:W.backlog,currentTaskId:on?.mission.id,onAnswer:()=>fn(!0)}),(0,K.jsx)(il,{value:vt,attachments:yt,onAttachmentsChange:Et,onChange:xt,onSend:Un,onCancel:dt,disabled:!H,pending:en,focusSignal:Ce,embedded:!0,onRewrite:It,rewriting:bt,slashSelection:Te,onSlashSelectionChange:Ee,routeOverride:De,onRouteOverrideChange:ke,footer:H?(0,K.jsx)(br,{sid:W.session.id,roles:W.roles,running:W.daemon.alive||!!W.manager_requests?.length,lastCall:W.last_call,onOpenSettings:()=>u(`config`)}):void 0},H||`no-session`)]})})]}),de&&H?(0,K.jsx)(`div`,{className:`${le===`workbench`?`flex`:`hidden`} workspace-view-surface min-h-0 flex-1`,children:(0,K.jsx)(U.Suspense,{fallback:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-xs text-ink-faint`,children:t(`common.loading`)}),children:(0,K.jsx)($p,{sid:H,active:le===`workbench`,readOnly:y,runtimeRequest:_e,onRestored:async e=>{await i.refetch(),Pt(e)}})})}):null]}),E&&le!==`map`?(0,K.jsx)(ep,{label:t(`common.resizePreview`),value:D,min:320,max:840,onPointerDown:e=>T(`right`,e),onReset:()=>N(440),onNudge:e=>N(t=>Math.max(320,Math.min(840,t-e)))}):null,(E&&le!==`map`||C===`preview`)&&(0,K.jsxs)(`aside`,{"data-resizable-panel":`right`,className:`${C===`preview`?`flex`:`hidden`} relative min-w-0 flex-1 flex-col overflow-hidden border-l border-line/60 bg-panel lg:flex lg:flex-none lg:w-[var(--preview-width)]`,children:[(0,K.jsx)(`div`,{className:`lg:hidden`,children:(0,K.jsx)(ri,{events:Zt,snap:W,streamOk:Kt,onStart:Pn,onStop:In,onManage:()=>H&&Nn(H),busy:Dn,snapshotStale:Vt.isError,readOnly:y,missionView:on})}),(0,K.jsx)(Ld,{snapshot:W,connected:Kt&&!Vt.isError,sid:G,artifacts:Wt.data,error:Wt.isError,onExpand:Ie,onOpenFile:vn,className:`min-h-0 flex-1 mobile-scroll-region`,embedded:!0,onCollapse:()=>{M(!1),j(`activity`)},missionView:on,activityEvents:Zt,requestedPath:Le.path,requestedPathToken:Le.token,routeVisible:!0})]})]}):(0,K.jsx)(rp,{loading:i.isLoading||!!(H&&Vt.isLoading),hasProjects:o.length>0,error:i.isError&&o.length===0?n(i.error):Vt.isError&&!W?n(Vt.error):void 0,onRetry:()=>{i.refetch(),H&&Vt.refetch()},onNew:zt,onChoose:()=>te(!0),canCreate:!y})}),(0,K.jsx)(tt,{open:l===`learning`,onClose:()=>u(`none`),label:e===`zh-CN`?`技能库`:`Skill library`,width:`max-w-6xl`,children:l===`learning`&&(0,K.jsx)(qn,{sid:H,initialSelection:d,initialScope:p,projectNames:Object.fromEntries(o.flatMap(e=>e.display_name?[[e.id,e.display_name]]:[]))})}),(0,K.jsx)(sl,{open:l===`palette`,onClose:()=>u(`none`),items:Wn}),(0,K.jsx)(Lf,{open:l===`verticals`,onClose:()=>u(`none`)}),(0,K.jsx)(ll,{open:l===`help`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(jl,{sid:H,open:l===`doctor`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(Ml,{sid:H,open:l===`config`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(Nl,{sid:H,open:l===`identity`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(Pl,{sid:H,open:l===`transcript`,onClose:()=>u(`none`)}),H&&W?(0,K.jsx)(Xf,{open:l===`inspector`,snap:W,journal:tn.data??[],busy:wn.disposeBacklog.isPending||wn.stopBacklog.isPending,onClose:()=>u(`none`),onDispose:Mn,onStop:Ln,onInspect:Be}):null,(0,K.jsx)(bu,{sid:H,path:Fe,artifacts:Wt.data??[],reviewActivity:H===G?pn:void 0,onSelectPath:Ie,onClose:()=>Ie(null)}),(0,K.jsx)($f,{sid:H,itemId:ze,onClose:()=>Be(null),onDone:e=>Mn(e,`done`),onSkip:e=>Mn(e,`rm`),onStop:Ln,busy:wn.disposeBacklog.isPending||wn.stopBacklog.isPending,readOnly:y}),(0,K.jsx)(Ll,{reply:cn,open:dn,busy:ln,error:un,onClose:()=>fn(!1),onSubmit:sn}),Ue?(0,K.jsx)(zd,{open:Ve,sid:Ue,name:Ht.data?.session.display_name||o.find(e=>e.id===Ue)?.display_name||o.find(e=>e.id===Ue)?.label||``,alive:Ht.data?.daemon.alive??!!o.find(e=>e.id===Ue)?.daemon_alive,controlAvailable:Ht.data?.daemon.control_available!==!1,busy:Dn,onClose:()=>{He(!1),Ge(null)},onRename:An,onStart:jn,onStop:kn,onDelete:async()=>{let e=Ue,t=await On();return t&&e&&Nt(e),t}}):null,(0,K.jsx)(Rd,{notice:et,onClose:ct}),W&&!y?(0,K.jsx)(ip,{active:C===`preview`?`preview`:le,sidebarOpen:ae,onSelect:e=>{if(e===`preview`){j(`preview`);return}j(`activity`),L(e)},onOpenSessions:()=>te(!0)}):null]})})}export{No as $,Xs as A,G as At,ts as B,Hs as C,vn as Ct,qs as D,Yt as Dt,Ws as E,Zt as Et,fs as F,Ft,wo as G,Co as H,Ls as I,Mt as It,Oo as J,Uo as K,rs as L,kt as Lt,Ds as M,Ht as Mt,Rs as N,Rt as Nt,Zs as O,Gt as Ot,ls as P,It as Pt,Po as Q,es as R,dc as S,Cn as St,Ks as T,Qt as Tt,Ao as U,yo as V,Go as W,Eo as X,Lo as Y,To as Z,Hc as _,Ir as _t,Iu as a,Zi as at,Qc as b,br as bt,Nu as c,ti as ct,Yl as d,nm as default,Zr as dt,Wo as et,Il as f,Yr as ft,$c as g,Vr as gt,nl as h,Lr as ht,Lu as i,sa as it,as as j,W as jt,Js as k,Ut as kt,_u as l,Xr as lt,Cl as m,ei as mt,nd as n,ca as nt,Mu as o,ia as ot,wl as p,Qr as pt,Io as q,Zu as r,fa as rt,ju as s,Hi as st,Zp as t,qa as tt,ru as u,$r as ut,zc as v,Kr as vt,Gs as w,wn as wt,fc as x,Sn as xt,Yc as y,jr as yt,$o as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/App-BzMKY0Y_.js b/frontend/web/dist/assets/App-BzMKY0Y_.js new file mode 100644 index 000000000..caf2dfb28 --- /dev/null +++ b/frontend/web/dist/assets/App-BzMKY0Y_.js @@ -0,0 +1,53 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ResearchWorkbenchPanel-CZOLmyKI.js","./rolldown-runtime-hePW80VL.js","./icons-DRlFT_ri.js","./query-CUzIxVzm.js","./index-DbVni4qR.js","./markdown-D-35pK1E.js","./markdown-DvoRHisr.css","./index-Diz-_RXt.css","./AppearanceControls-C_eUyO2x.js","./code-xml-CTbPls4H.js","./play-DwGoGarL.js","./useWorkbenchTheme-CV-C3OBr.js","./ResearchWorkbenchPanel-BS5QOR9J.css","./MapPanel-BJMQIQc6.js","./history-MzF_RldS.js","./format-8giTdXya.js","./MapPanel-BHNQrOn8.css"])))=>i.map(i=>d[i]); +import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{C as n,D as r,E as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,w as E,x as D,y as O}from"./icons-DRlFT_ri.js";import{S as k,a as A,b as j,c as M,i as ee,n as N,r as P}from"./query-CUzIxVzm.js";import{i as F}from"./markdown-D-35pK1E.js";import{A as te,B as ne,C as re,D as ie,E as I,F as L,G as ae,J as oe,K as se,M as ce,N as le,O as ue,P as R,R as de,S as fe,T as pe,V as me,W as he,_ as ge,a as _e,b as ve,c as ye,d as be,f as xe,g as Se,h as Ce,i as we,j as Te,k as z,l as Ee,m as De,n as Oe,o as ke,p as Ae,r as je,s as Me,t as Ne,u as Pe,v as Fe,w as Ie,x as Le,y as Re,z as ze}from"./index-DbVni4qR.js";import{A as Be,C as Ve,D as He,E as B,F as Ue,I as We,L as Ge,M as Ke,N as qe,O as Je,P as Ye,R as V,S as Xe,T as Ze,_ as Qe,a as $e,b as et,c as tt,d as nt,f as rt,g as H,h as it,i as at,j as ot,k as st,l as ct,m as lt,n as ut,o as U,p as dt,r as W,s as ft,t as pt,u as mt,v as ht,w as gt,x as _t,y as vt}from"./AppearanceControls-C_eUyO2x.js";import{a as yt,c as bt,i as xt,l as St,n as Ct,o as wt,r as Tt,s as Et,t as Dt}from"./format-8giTdXya.js";import{a as Ot,i as kt,n as At,r as jt,t as Mt}from"./useWorkbenchTheme-CV-C3OBr.js";var G=t(r(),1),Nt=`local_request_id`,Pt=e=>Array.isArray(e)&&e.length>0;function Ft(e,t,n,r,i=Date.now(),a=!0,o){let s=e.findIndex(e=>e.type===`ui.argus`&&Number(e[Nt])===n);if(s<0)return!r.length&&!a?e:[...e,{type:`ui.argus`,agent_layer:`manager`,text:``,ts:i/1e3,event_id:`local-${t}-${n}-argus`,message_id:`local-${n}-argus`,fragment_mode:`snapshot`,steps:r,live:a,...o?{status:o}:{},[Nt]:n}];let c=[...e];return c[s]={...c[s],...r.length?{steps:r}:{},live:a,...o?{status:o}:{}},c}function It(e,t,n=Date.now(),r=`stopped`){return e.map(e=>{if(e.type!==`ui.argus`||Number(e[Nt])!==t||e.live!==!0)return e;let i=Array.isArray(e.steps)?e.steps.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return t.ended_ts||t.status!==`running`?e:{...t,ended_ts:n/1e3,status:r}}):e.steps;return{...e,live:!1,status:r,...i===void 0?{}:{steps:i}}})}function Lt(e,t,n,r=Date.now()){return{type:`ui.operator`,agent_layer:`operator`,text:n,ts:r/1e3,event_id:`local-${e}-${t}-operator`,message_id:`local-${t}-operator`,[Nt]:t}}function Rt(e,t,n,r,i,a=Date.now(),o=`auto`){let s=r.trim();if(!s)return e;let c=e.findIndex(e=>e.type===`ui.argus`&&Number(e[Nt])===n),l=i.endsWith(`-argus`)?`${i.slice(0,-6)}-operator`:``,u=l?e.map(e=>e.type===`ui.operator`&&Number(e[Nt])===n?{...e,message_id:l}:e):e,d=u.find(e=>e.type===`ui.operator`&&Number(e[Nt])===n),f=d?Math.max(0,a-Number(d.ts??a/1e3)*1e3):0;if(c<0)return[...u,{type:`ui.argus`,agent_layer:`manager`,text:s,ts:a/1e3,event_id:`local-${t}-${n}-argus`,message_id:i||`local-${n}-argus`,fragment_mode:o,response_latency_ms:f,[Nt]:n}];let p=u[c],m=[...u];return m[c]={...p,text:Ie(String(p.text??``),s,o),message_id:i||p.message_id,fragment_mode:o},m}function zt(e,t,n){let r=e.filter(e=>e.type!==`engineer.progress`||e.turn_step!==!0),i=new Map,a=[...r];r.forEach((e,t)=>{let n=String(e.type??``);if(n!==`ui.operator`&&n!==`ui.argus`)return;let r=`${n}\u0000${String(e.text??``)}`;i.set(r,[t,...i.get(r)??[]])});let o=t.map(e=>({type:e.role===`operator`?`ui.operator`:`ui.argus`,agent_layer:e.role===`operator`?`operator`:`manager`,text:e.text,ts:e.ts,message_id:e.message_id||`transcript-${e.ts}-${e.role}`,...e.mission_result===!0?{mission_result:!0}:{},...typeof e.item_id==`string`?{item_id:e.item_id}:{},...typeof e.success==`boolean`?{success:e.success}:{},...typeof e.summary==`string`?{summary:e.summary}:{},...typeof e.delivery_id==`string`?{delivery_id:e.delivery_id}:{},...e.delivery&&typeof e.delivery==`object`?{delivery:e.delivery}:{},...Pt(e.steps)?{steps:e.steps}:{}})),s=Array(o.length).fill(!0);for(let e=o.length-1;e>=0;--e){let n=o[e],r=`${String(n.type)}\u0000${String(n.text??``)}`,c=i.get(r)??[],l=t[e].message_id,u=e=>{let t=a[e];return n.item_id&&t.item_id&&n.item_id!==t.item_id?!1:n.mission_result!==!0&&t.mission_result!==!0||!!(l&&t.message_id===l)||!!(!l&&n.delivery_id&&n.delivery_id===t.delivery_id)},d=c.findIndex(e=>u(e)&&!!(l&&a[e].message_id===l));if(d<0&&(d=c.findIndex(u)),d>=0){s[e]=!1;let[t]=c.splice(d,1),r=a[t];if(l&&r.message_id===l){let e={};for(let t of[`mission_result`,`item_id`,`success`])(r[t]==null||r[t]===``)&&n[t]!=null&&(e[t]=n[t]);a[t]={...r,...e}}}}let c=[...o.filter((e,t)=>s[t]),...a],l=Array(c.length).fill(!0),u=new Set,d=n.map(e=>{let t=String(e.message_id??``),n=t?c.findIndex((e,n)=>!u.has(n)&&String(e.message_id??``)===t):-1,r=Number(e.ts??0);if(n<0&&(n=c.findIndex((t,n)=>{if(u.has(n)||t.type!==e.type||t.text!==e.text)return!1;let i=Number(t.ts??0);return Math.abs(i-r)<=5})),n>=0){u.add(n),l[n]=!1;let t=c[n];return{...e,...t.mission_result===!0?{mission_result:!0}:{},...typeof t.item_id==`string`?{item_id:t.item_id}:{},...typeof t.success==`boolean`?{success:t.success}:{},...typeof t.summary==`string`?{summary:t.summary}:{},...typeof t.delivery_id==`string`?{delivery_id:t.delivery_id}:{},...t.delivery&&typeof t.delivery==`object`?{delivery:t.delivery}:{},...Pt(t.steps)?{steps:t.steps,live:!1}:{}}}return e});return[...c.filter((e,t)=>l[t]),...d].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0))}function Bt(e,t,n,r,i){let a=ge(e,t,120);return{query:a,events:(0,G.useMemo)(()=>e?zt(n,a.data??[],i===e?r:[]):[],[e,n,a.data,r,i]),status:a.isError?`error`:a.isPending?`loading`:`ready`}}var Vt=V(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Ht=V(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),K=V(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),q=V(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Ut=V(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Wt=V(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Gt=V(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Kt=V(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qt=V(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Jt=V(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),Yt=V(`Diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Xt=V(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Zt=V(`FilePenLine`,[[`path`,{d:`m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2`,key:`142zxg`}],[`path`,{d:`M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`2t3380`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),Qt=V(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),$t=V(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),en=V(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),tn=V(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),nn=V(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),rn=V(`Layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),an=V(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),on=V(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),sn=V(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),cn=V(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),ln=V(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),un=V(`Paperclip`,[[`path`,{d:`M13.234 20.252 21 12.3`,key:`1cbrk9`}],[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486`,key:`1pkts6`}]]),dn=V(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),fn=V(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),pn=V(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),mn=V(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),hn=V(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),gn=V(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),_n=V(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),vn=V(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),yn=V(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),bn=V(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),xn={"global/agent-team-lead.md":{title:`多智能体团队协作`,summary:`判断何时值得并行工作,按文件与职责拆分协作,并独立审查汇总结果;不替代原有角色与授权。`,originalName:`Agent Team Lead`,source:`argus/builtin_skills/agent-team-lead.md`,sourceSha256:`b490cc96572941fa4a2fe4937bd3e86c9802c132439ae779fcf8e88241ba9521`},"global/curator/argus-curator-role.md":{title:`团队成果整理`,summary:`维护团队候选成果池和比较记录,归纳后续策略;整理者不代替执行者完成工程任务。`,originalName:`Team Curator`,source:`argus/builtin_skills/curator/argus-curator-role.md`,sourceSha256:`3dfd743254a91f88feef76e85683225dc5b510b7f417f6430ef7b975b8eb0f5b`},"global/engineer/minimal-coding-agent.md":{title:`最小且严谨的软件修改`,summary:`用足够小的改动实现、修复或重构软件与界面,保留既有行为,避免无依据的抽象和新增依赖。`,originalName:`极简而严谨的 Coding Agent`,source:`argus/builtin_skills/engineer/minimal-coding-agent.md`,sourceSha256:`aa47c79252eb5086451530ae25aac77ce87bd4315eda1e9defae2af719295cab`},"global/engineer/pdf-chat.md":{title:`分段阅读 PDF`,summary:`按页或章节阅读并核对版本、页码;图片和版式需查看实际页面,回答只依据相关证据。`,originalName:`Progressive PDF Reading`,source:`argus/builtin_skills/engineer/pdf-chat.md`,sourceSha256:`141bd41eb888191aedc391f0df2ba100ab5aee3e7970f9afc21a6f50f4deca5f`},"global/engineer/presentation-master.md":{title:`可编辑演示文稿`,summary:`使用已有 PPT Master 工具制作或修改可编辑演示文稿和原生 PPT 图,经指定解释器运行并核对导出效果;科研绘图路线由科研垂域决定。`,originalName:`Editable Presentations with PPT Master`,source:`argus/builtin_skills/engineer/presentation-master.md`,sourceSha256:`b9f5ed3935b538a18280ac79a504a3b28b432b66efb884e3e06284b4f1729ff3`},"global/engineer/skill-authoring-guide.md":{title:`编写与审阅技能和 Wiki 页面`,summary:`只在证据表明有可复用做法时写技能;先学操作者材料再忠实编辑;Wiki 更新来自一手来源;审阅者按证据真实、无冗余、不倒退、层级正确来判断一次修改。`,originalName:`Writing and Reviewing Skills and Wiki Pages`,source:`argus/builtin_skills/engineer/skill-authoring-guide.md`,sourceSha256:`cf4073da950ef34a359fa3f4b9c77c9d00ebd56bcb79a678efc3e04197ec7e79`},"global/engineer/web-primary-source-evidence.md":{title:`查证一手网络来源`,summary:`为软件、产品、接口和基准等现实信息寻找并保留一手来源,让重要结论能够追溯。`,originalName:`Web Primary-Source Evidence`,source:`argus/builtin_skills/engineer/web-primary-source-evidence.md`,sourceSha256:`632930eb13afc66ebf4742ab6c87fa586edee916c3eeacef25f50215e78f776f`},"global/manager/evidence-based-stage-decision.md":{title:`经理的职责与阶段决定`,summary:`经理是唯一改变阶段的角色;结合规划和评审证据决定继续、推进、返回或结束,部署始终需要操作者批准。`,originalName:`The Manager's role and stage decisions`,source:`argus/builtin_skills/manager/evidence-based-stage-decision.md`,sourceSha256:`d664fa7b6e92045335da59739575326b89e70d38662c1ffdc79774c599e36817`},"global/performance-profile-ground-truth.md":{title:`真实工作负载性能分析`,summary:`用指定环境和代表性输入定位瓶颈,对照未开启剖析的实测结果;不顺带执行未要求的优化。`,originalName:`Performance Profile Ground Truth`,source:`argus/builtin_skills/performance-profile-ground-truth.md`,sourceSha256:`42430420ce8bd31047780e9b08ac5eab366f849eb222805ca05492779095f4d0`},"global/planner/dependency-aware-task-decomposition.md":{title:`规划者的职责与按依赖拆解任务`,summary:`规划者只读只派、不执行,阶段只由经理改变;把目标与已有证据整理成最小、可执行、有真实依赖且能明确验收的任务集合。`,originalName:`The Planner's role and dependency-aware task decomposition`,source:`argus/builtin_skills/planner/dependency-aware-task-decomposition.md`,sourceSha256:`06d5295c6777a64c90a28a5603884e557a72ad5961b19a3f411dc1e83e331886`},"global/project-venv-package-management.md":{title:`项目环境、依赖与运行前核查`,summary:`使用项目自身的环境与锁文件,只安装任务需要的依赖,在承载论断的运行前只核查它真正用到的资源;不修改 Argus 框架自己的运行环境。`,originalName:`Project Environment and Dependencies`,source:`argus/builtin_skills/project-venv-package-management.md`,sourceSha256:`ab8728ad9fff58e8bc4672e5bc2446135f376b55b52392a6104b2eb52e9ed327`},"global/reviewer/argus-reviewer-role.md":{title:`评审者的职责与给执行者的下一步`,summary:`独立判断执行结果是否成立、需要补充或转向,把检查结果提炼成执行者需要的那一个下一步;评审有争议时以带标签的证据而非角色权威定论,不替执行者作完成声明。`,originalName:`The Reviewer's role`,source:`argus/builtin_skills/reviewer/argus-reviewer-role.md`,sourceSha256:`8457a177a4376eab0e4bef7a652e3276ce3b6f9a0ab421fd15bd96eb057cf852`},"global/reviewer/engineer-process-audit.md":{title:`核对执行过程与证据`,summary:`当成果或验证声明存在争议时检查任务相关回执和日志,区分缺少记录与确实未执行。`,originalName:`Engineer Process Audit`,source:`argus/builtin_skills/reviewer/engineer-process-audit.md`,sourceSha256:`b109fb737e747b863244c9b03e1b23ff82acf724ef420bc547ad457c1cf65ac5`},"global/reviewer/web-source-evidence-audit.md":{title:`审查网络证据是否支撑结论`,summary:`核对实际取得的来源与重要现实信息声明是否一致,不把有链接等同于已经证实。`,originalName:`Web Source-Evidence Audit`,source:`argus/builtin_skills/reviewer/web-source-evidence-audit.md`,sourceSha256:`35dbb6288199c52d4ecfd4e241a54346f5ef8af985f50bf24121e687ea9dc22e`},"global/stale-blocker-verification-probe.md":{title:`核实旧阻塞与易变的外部事实`,summary:`用最小且已授权的探针判断记录中的阻塞是否仍然存在;只在决策依赖时核实外部事实,把身份、许可与执行当作三个不同的问题。`,originalName:`Verify a Recorded Blocker or a Changing External Fact`,source:`argus/builtin_skills/stale-blocker-verification-probe.md`,sourceSha256:`3eb5f473bbf1cf482a840e7af3c84bc939a6710b60f84415ad94e6932a9122b3`},"vertical/argus_maintenance/engineer/argus-maintenance-execution.md":{title:`Argus 小范围维护`,summary:`按核心与领域职责检查和简化框架,用小而可复用的修改解决明确问题。`,originalName:`Argus Maintenance`,source:`argus/verticals/argus_maintenance/skills/engineer/argus-maintenance-execution.md`,sourceSha256:`138f9b7e2503c5ce0307e575fa0555a62e1820c559e105d60cc6e31ab9991c0f`},"vertical/argus_maintenance/reviewer/argus-maintenance-review.md":{title:`Argus 维护变更评审`,summary:`核对补丁是否真正简化、复用和解耦,并用验证结果证明行为,而不是只看代码缩短。`,originalName:`Argus Maintenance Review`,source:`argus/verticals/argus_maintenance/skills/reviewer/argus-maintenance-review.md`,sourceSha256:`d6ad0f8eb29d5ca3d5a66fbc7df34de86e42229f15e8e2e22ce601a8ae08c4f8`},"vertical/chemistry/engineer/batteries/battery-identity-and-data-normalization.md":{title:`电池对象与测试数据对齐`,summary:`在循环分析前统一电芯、电极、电解液、测试协议和时间序列身份;不用于分子计算或一般光谱分析。`,originalName:`Battery Cell Identity and Electrochemical Data Normalization`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-identity-and-data-normalization.md`,sourceSha256:`d1cfc1cb94cf4e4828fcd2b75fb0f1dc57181208f2fad1f19c343a9d169462e6`},"vertical/chemistry/engineer/batteries/battery-model-validation.md":{title:`电池模型与退化解释验证`,summary:`用防止数据泄漏的实测电芯数据验证预测和退化解释,明确模型边界;不把预测当作实测。`,originalName:`Battery Model Boundary and Degradation Validation`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-model-validation.md`,sourceSha256:`fe4ec1ec78ec21dd0d568b71276c2f85e13b6216d5a7770f5f75d09baabc6d27`},"vertical/chemistry/engineer/batteries/cycling-and-degradation-analysis.md":{title:`电池循环与退化分析`,summary:`分析循环、倍率、阻抗和退化轨迹,保留电芯与协议对照,并避免评估数据泄漏。`,originalName:`Battery Cycling and Degradation Analysis Workflow`,source:`argus/domains/chemistry/skills/engineer/batteries/cycling-and-degradation-analysis.md`,sourceSha256:`3e0870b82fbc40463f81ca8eb1e84576c9fe1ae5fe501da6d2b274535fd16d2e`},"vertical/chemistry/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md":{title:`生化结合与功能实验分析`,summary:`分析亲和力、动力学、抑制和功能证据,核对构建体、辅因子、状态与实验对照;对接结果不能单独证明活性。`,originalName:`Biochemical Binding, Kinetics, and Functional Assay Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md`,sourceSha256:`12d235a655a1b6b6022a84a5c36e3c291df6227cb40bd2dc78f19012deff62e5`},"vertical/chemistry/engineer/biochemistry/biochemistry-structural-computational-evidence.md":{title:`生化结构与模拟的证据边界`,summary:`把结构、分子对接、动力学和突变结果作为待验证假设,结合真实实验边界解释,不直接宣称亲和力成立。`,originalName:`Biochemistry Structural, Docking, and MD Evidence Boundary Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-structural-computational-evidence.md`,sourceSha256:`47283774a89fa87050fd35df791c961dce37588ec9c92c9d4e357d59a9f14d6c`},"vertical/chemistry/engineer/biochemistry/biochemistry-system-and-assay-normalization.md":{title:`生化体系与实验对象对齐`,summary:`统一序列、构建体、分子状态、配体、辅因子、突变、结构和实验身份,再开展比较。`,originalName:`Biochemistry and Chemical Biology System Identity Normalization`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-system-and-assay-normalization.md`,sourceSha256:`9b7d80ae04064e9a1b5465dc1fee60f5511491694aaa20e423ae92779ad12ee5`},"vertical/chemistry/engineer/characterization/characterization-data-and-sample-normalization.md":{title:`表征样品与原始数据对齐`,summary:`保留衍射、光谱、质谱、核磁和显微原始数据及仪器信息;不把不同测试方式统一成简单拟峰。`,originalName:`Characterization Sample, Instrument Data, and Metadata Normalization`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-data-and-sample-normalization.md`,sourceSha256:`dad27a33c24c37fdc17a7f7386478246e7847edde9cac4cc2939590ab3e07b9c`},"vertical/chemistry/engineer/characterization/characterization-validation-and-integration.md":{title:`多种表征证据交叉验证`,summary:`综合不同仪器证据时保留各自适用范围和限制,避免跨测试方式作过强推断。`,originalName:`Characterization Validation and Multimodal Evidence Integration`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-validation-and-integration.md`,sourceSha256:`9671988085d6a0127a4739300c9c851e904016f8f17c31fafb676303b7d736c1`},"vertical/chemistry/engineer/characterization/modality-specific-interpretation-workflow.md":{title:`按测试方式解释表征结果`,summary:`依据衍射、光谱、质谱、核磁或显微的具体机制选择对照和模型,不使用一套解释套用全部数据。`,originalName:`Modality-Specific Chemical Characterization Interpretation Workflow`,source:`argus/domains/chemistry/skills/engineer/characterization/modality-specific-interpretation-workflow.md`,sourceSha256:`c09d9f9710e8ee7a72ff7cfd0f04ec741ea792a61a8b8abf56c038c26b126e46`},"vertical/chemistry/engineer/chemistry-execution.md":{title:`化学研究执行指南`,summary:`按任务选择领域流程,核实实际工具能力,保留一手证据并验证科学结论;实体实验仍需明确授权。`,originalName:`Chemistry Research Execution`,source:`argus/domains/chemistry/skills/engineer/chemistry-execution.md`,sourceSha256:`d6ad8b3ae0254319e31de1ca91a7c75fd06c70795d3948b38b8d35b895e69d59`},"vertical/chemistry/engineer/chemistry-toolkit.md":{title:`化学方法与工具导航`,summary:`先选择科学问题对应的方法,再查看具体工具说明;这是导航目录,不是自动安装或执行脚本。`,originalName:`Chemistry Skill and Capability Router`,source:`argus/domains/chemistry/skills/engineer/chemistry-toolkit.md`,sourceSha256:`14840bc5603ce237373ab4832f7bf747c24e6d4ef524eb2ccd112a8bb9eaea70`},"vertical/chemistry/engineer/computational_chemistry/computational-identity-normalization.md":{title:`计算化学对象与输入对齐`,summary:`在量子化学、力场、分子动力学或自由能计算前,统一分子或周期体系的输入与状态。`,originalName:`Computational Chemistry Identity and Input Normalization`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-identity-normalization.md`,sourceSha256:`fd9bebbdc28731a9eeab536279466e3b97c289a49db515f509c713f4b3f0df7b`},"vertical/chemistry/engineer/computational_chemistry/computational-validation-and-interpretation.md":{title:`计算收敛性与结论边界`,summary:`验证数值收敛、模型敏感性和适用范围,区分计算预测与实验测量,不外推为生物活性证明。`,originalName:`Computational Chemistry Convergence and Interpretation Validation`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-validation-and-interpretation.md`,sourceSha256:`ed1bffff26a5cb22ff61c60dcbf3464cbcff0f15200b9d604436bcd6243ab3f7`},"vertical/chemistry/engineer/computational_chemistry/electronic-structure-simulation-workflow.md":{title:`可复现电子结构与分子模拟`,summary:`组织分子或周期体系计算,分别检查方法选择和数值收敛,保留可复现的输入与输出。`,originalName:`Reproducible Electronic-Structure and Molecular Simulation Workflow`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/electronic-structure-simulation-workflow.md`,sourceSha256:`13c5d42ae2f417c7f16665e33f3660fad9f76163be2a08401edd57662ab6f22c`},"vertical/chemistry/engineer/crystallography/cif-and-structure-validation.md":{title:`CIF 与晶体结构检查`,summary:`核对格式、对称性、组成、几何、占位、位移参数和精修证据;不代替从头解结构。`,originalName:`CIF and Crystal Structure Validation`,source:`argus/domains/chemistry/skills/engineer/crystallography/cif-and-structure-validation.md`,sourceSha256:`b49527c827b69b5a37543059faf997fa8d0c9c3f60ed2c0a0e6807ddf5b0e802`},"vertical/chemistry/engineer/crystallography/diffraction-and-crystal-identity.md":{title:`衍射数据与晶体对象对齐`,summary:`核对单晶或粉末衍射的波长、几何、晶胞、对称性、物相及 CIF 来源。`,originalName:`Diffraction and Crystal Structure Identity`,source:`argus/domains/chemistry/skills/engineer/crystallography/diffraction-and-crystal-identity.md`,sourceSha256:`97367c0fad622c1d2ae19868b12a8de571bbc99c282c8b5eec4c4b97ed3615ed`},"vertical/chemistry/engineer/crystallography/structure-solution-and-refinement.md":{title:`晶体结构求解与精修`,summary:`结合数据处理、对称性检验、化学约束、残差和替代解释完成结构求解及精修。`,originalName:`Crystal Structure Solution and Refinement Workflow`,source:`argus/domains/chemistry/skills/engineer/crystallography/structure-solution-and-refinement.md`,sourceSha256:`8f5d913cf3bfc6c421f2d137ece735eba96e3b6840da63d6c4d40c22bc518e08`},"vertical/chemistry/engineer/foundations/chemical-identity-and-representation.md":{title:`化学对象与表达方式核实`,summary:`先核对分子、反应、材料、晶体、样品、序列或配方身份;这是跨领域基础,不替代专门流程。`,originalName:`Chemical Identity and Representation`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-identity-and-representation.md`,sourceSha256:`b1b0f0148ae94a1ad6ad60b6383cc8f6b1596b387d885ca896148486004ac392`},"vertical/chemistry/engineer/foundations/chemical-risk-and-authorization.md":{title:`化学风险与授权边界`,summary:`识别化学、生物、热、电、压力、辐射和仪器风险;文档建议不等于允许开展实体操作。`,originalName:`Chemical Risk and Authorization Boundary`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-risk-and-authorization.md`,sourceSha256:`2d6cb4a8421bb62bbde199f7aa131f5f678019ffbeed231f0676e9095f176b5e`},"vertical/chemistry/engineer/foundations/chemistry-workflow-output-contract.md":{title:`化学任务输入与交付约定`,summary:`明确输入、决策、能力核实、证据、验证方式、输出与停止条件,用于缺少更具体流程的任务。`,originalName:`Chemistry Workflow and Output Contract`,source:`argus/domains/chemistry/skills/engineer/foundations/chemistry-workflow-output-contract.md`,sourceSha256:`1b52c242611bb39cbbe929dc2bee8072e501ab56b23907df50a51c5c0b4f15fd`},"vertical/chemistry/engineer/foundations/computational-reproducibility.md":{title:`化学计算与分析的可复现性`,summary:`保留计算、模拟、数据处理和模型训练的输入、环境、数值设置、诊断与主要输出。`,originalName:`Chemistry Computational Reproducibility`,source:`argus/domains/chemistry/skills/engineer/foundations/computational-reproducibility.md`,sourceSha256:`d92b4a7b6e65c92138ef785a04a47f1fae6ab4ef2e6c4af111264cdc081a0bd8`},"vertical/chemistry/engineer/foundations/dataset-curation-and-leakage.md":{title:`化学数据整理与泄漏控制`,summary:`核对数据来源、去重、分组、标签和划分方式,避免分子、反应或样品间的信息泄漏。`,originalName:`Chemistry Dataset Curation and Leakage Control`,source:`argus/domains/chemistry/skills/engineer/foundations/dataset-curation-and-leakage.md`,sourceSha256:`ceeaf0a929c67df26cc91651721d943749c7e2c3bad6c7978cb78fa085bf948b`},"vertical/chemistry/engineer/foundations/evidence-provenance-and-claim-levels.md":{title:`化学证据来源与结论强度`,summary:`区分检索、整理、预测、计算、模拟、测量与推断,让结论不超出证据能支持的程度。`,originalName:`Chemistry Evidence Provenance and Claim Levels`,source:`argus/domains/chemistry/skills/engineer/foundations/evidence-provenance-and-claim-levels.md`,sourceSha256:`c8b6454e673aae3298d4089c1603b9edfe63c4be7f5f3ad8fd6f24ef2b2910f5`},"vertical/chemistry/engineer/foundations/failure-diagnosis-and-negative-results.md":{title:`化学任务失败与负结果分析`,summary:`保留失败证据,区分实现缺陷、资源问题和科学假设被否定,不把负结果隐去。`,originalName:`Chemistry Failure Diagnosis and Negative Results`,source:`argus/domains/chemistry/skills/engineer/foundations/failure-diagnosis-and-negative-results.md`,sourceSha256:`068cf8400d770fb6c97edbd26d6788adb1acc0e7d6ea00e3b14949c7a9a64a40`},"vertical/chemistry/engineer/foundations/uncertainty-and-applicability-domain.md":{title:`化学结果的不确定性与适用范围`,summary:`判断模型、计算、测量或文献结论能否用于当前实际体系,并量化或说明不确定性。`,originalName:`Chemistry Uncertainty and Applicability Domain`,source:`argus/domains/chemistry/skills/engineer/foundations/uncertainty-and-applicability-domain.md`,sourceSha256:`d552b6cad9e2a942e44a1a4c98647236488186458d3f2cd4bdd395a34c23d8ae`},"vertical/chemistry/engineer/foundations/units-conditions-and-normalization.md":{title:`化学单位与条件规范化`,summary:`比较不同来源前明确单位、计量基础、环境条件、样品归一方式和报告约定。`,originalName:`Chemical Units Conditions and Normalization`,source:`argus/domains/chemistry/skills/engineer/foundations/units-conditions-and-normalization.md`,sourceSha256:`540d6c4a3389900be51e3e9a7bdcf7f16169bb72246d53cbb1fbac247b527cde`},"vertical/chemistry/engineer/materials_science/materials-discovery-and-optimization.md":{title:`材料发现与优化研究`,summary:`限定设计空间、性质目标、基线与不确定性,组织可验证的筛选或工艺优化,不替代晶体精修。`,originalName:`Materials Discovery and Optimization Workflow`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-discovery-and-optimization.md`,sourceSha256:`02d2aeacb74302eb2853345772f5096cce5b26db15ab5d229a210ccfabe04cbd`},"vertical/chemistry/engineer/materials_science/materials-identity-processing-and-property-data.md":{title:`材料组成、工艺与性能数据`,summary:`统一组成、物相、工艺历史、样品形态、微结构和测试条件,建立可比的性能记录。`,originalName:`Materials Identity Processing and Property Data`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-identity-processing-and-property-data.md`,sourceSha256:`ec0ac9c5a4b62eb9d027a97f9c78cc9ed986776e48f9f3bbf94f015a8d689521`},"vertical/chemistry/engineer/materials_science/processing-structure-property-validation.md":{title:`工艺—结构—性能关系验证`,summary:`用可比样品、对照和不确定性检验材料关系声明,保留机理解释的适用边界。`,originalName:`Materials Processing Structure Property Validation`,source:`argus/domains/chemistry/skills/engineer/materials_science/processing-structure-property-validation.md`,sourceSha256:`7c556e48b0b97de122d0f342839c92ece5e33f36c1aa3f7efbcc6fbc319ea06c`},"vertical/chemistry/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md":{title:`MOF 构筑单元与拓扑识别`,summary:`从来源结构核实节点、连接体、连通性、穿插、缺陷、客体和网络拓扑,不以普通 CIF 检查代替。`,originalName:`MOF Framework Identity Node Linker and Topology`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md`,sourceSha256:`7a6490bd8dad40deeb548f03541673b91df2bd9bddbe3e9c8cf58d73b3ee31b8`},"vertical/chemistry/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md":{title:`MOF 数据、预测与结构生成`,summary:`组织拓扑相关去重、泄漏控制、性质预测和生成结构的分阶段验证;生成不等于可合成。`,originalName:`MOF Datasets Prediction and Structure Generation`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md`,sourceSha256:`8f1d023caf19aeb5801036cc58e2531cd8d39bb398008a4b614c654b3073ab51`},"vertical/chemistry/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md":{title:`MOF 孔隙、吸附与性质分析`,summary:`关联原始等温线、活化和样品状态,检查孔隙、吸附、输运模型及不确定性。`,originalName:`MOF Porosity Adsorption and Structure Property Workflow`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md`,sourceSha256:`98088eef9fa108d0f0aa8fab9f746315414cc64edbcfab0d0da8accd4ab83b0b`},"vertical/chemistry/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md":{title:`MOF 合成与后处理证据`,summary:`整理合成、活化、溶剂交换、缺陷调节和后修饰的证据,核对样品关联与表征要求。`,originalName:`MOF Synthesis Activation and Postsynthetic Evidence`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md`,sourceSha256:`b65377f7d995a638f721e8dea34a99807e97c948ec274bbc3f9cc1d35ccf1f5a`},"vertical/chemistry/engineer/organic_synthesis/reaction-identity-and-records.md":{title:`有机反应对象与记录对齐`,summary:`核对反应物、映射、计量、立体化学、条件、后处理和收率,用于路线或数据整理。`,originalName:`Organic Reaction Identity and Records`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/reaction-identity-and-records.md`,sourceSha256:`02221beebf4e39d9bd0e5c4090de61aba6596ceb48fb3a5f29b3e54466999d87`},"vertical/chemistry/engineer/organic_synthesis/retrosynthesis-and-route-design.md":{title:`有机逆合成与路线设计`,summary:`结合目标、断键、已有先例、选择性、供应和安全设计候选路线;候选仍需证据验证。`,originalName:`Organic Retrosynthesis and Route Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/retrosynthesis-and-route-design.md`,sourceSha256:`6ee1e514bf05cc052de12ee39497c783d1dd6ca9549335cbe62e7f2106ec8de4`},"vertical/chemistry/engineer/organic_synthesis/route-validation-and-experiment-design.md":{title:`有机路线验证与实验设计`,summary:`把候选路线转化为有对照、分析读数和停止条件的验证计划;不授权自动开展实体实验。`,originalName:`Organic Route Validation and Experiment Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/route-validation-and-experiment-design.md`,sourceSha256:`9a543fdca5cc4fa3ed0cc9cef2395af55ffaa35758b3c36895a2309d1d09dc80`},"vertical/chemistry/engineer/tools/aizynthfinder.md":{title:`AiZynthFinder 逆合成候选`,summary:`在明确模型、原料库、配置和预算后使用本地搜索生成候选路线;搜索结果不是可行性证明。`,originalName:`AiZynthFinder Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/aizynthfinder.md`,sourceSha256:`fd406198b2a436d954aefb95c1062f945e08cf98806ca7ceaba5d402c006f4dc`},"vertical/chemistry/engineer/tools/askcos.md":{title:`ASKCOS 路线与反应预测`,summary:`仅使用已获授权的部署,记录接口、模型、数据库、预算与结果来源;不假定已有服务权限。`,originalName:`ASKCOS Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/askcos.md`,sourceSha256:`31689603c8f5b80f2ed94a25ef05148edf311287e64bf336fc98fea5aeeaf486`},"vertical/chemistry/engineer/tools/chembl.md":{title:`ChEMBL 生物活性资料检索`,summary:`检索分子、靶点、实验和活性记录,核对版本、单位及来源;已有记录不证明新体系的活性。`,originalName:`ChEMBL Bioactivity Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/chembl.md`,sourceSha256:`9b33111794504afb064302785f66bd7fcbccac9e855d83df0eb84297f00b4863`},"vertical/chemistry/engineer/tools/chemcrow.md":{title:`ChemCrow 工具集成参考`,summary:`研究公开工具集成方式及其依赖、安全和证据要求;架构借鉴不等于复现论文结果。`,originalName:`ChemCrow Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemcrow.md`,sourceSha256:`877388249df2ed635a78ae2edb68b1d25fa2cd5305eec4e09c289fb0f1bd1ba3`},"vertical/chemistry/engineer/tools/chemos.md":{title:`ChemOS 实验室编排参考`,summary:`仅在设备服务、设施归属、安全联锁、数据约定和恢复机制已具备时评估编排能力。`,originalName:`ChemOS Orchestration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemos.md`,sourceSha256:`2dbb97df4b7107f08f00bbdd88fef587eda0b6d3d04e5850b619550e7a9c4cc3`},"vertical/chemistry/engineer/tools/coscientist.md":{title:`Coscientist 系统集成参考`,summary:`依据确切公开实现借鉴组件和架构,保留授权边界;不宣称得到可直接运行的自主实验室。`,originalName:`Coscientist Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/coscientist.md`,sourceSha256:`8a47d850deb1d7dfb2ddeecbea4cba38ceecec129a6e2b2d8ad403e9bbff5252`},"vertical/chemistry/engineer/tools/deepchem.md":{title:`DeepChem 分子机器学习`,summary:`先明确目标、对象、分组、泄漏控制、基线和适用范围,再选择数据、特征、模型与评估工具。`,originalName:`DeepChem Molecular Machine Learning`,source:`argus/domains/chemistry/skills/engineer/tools/deepchem.md`,sourceSha256:`27a9bd06792446cfeeafb63db293fcd8305d59ca3da164810e1267c13e6dcdeb`},"vertical/chemistry/engineer/tools/guacamol.md":{title:`GuacaMol 分子设计基准`,summary:`按确定任务、评分、参考数据、预算和有效性检查评估方法;结论仅限对应基准。`,originalName:`GuacaMol Molecular Design Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/guacamol.md`,sourceSha256:`f626a4b92ec2b081620f5da146f6baebe3b5cc44df824e77fc2becd0b3e87e7e`},"vertical/chemistry/engineer/tools/olympus.md":{title:`Olympus 反应优化基准`,summary:`使用规划器和模拟曲面作有对照的优化研究,明确参数空间、噪声和预算;模拟不等于实体实验。`,originalName:`Olympus Reaction Optimization`,source:`argus/domains/chemistry/skills/engineer/tools/olympus.md`,sourceSha256:`160f357db2ec4527b7368d2b41a2ab43d2ab6b76130e8a27b2a035e0531c4be2`},"vertical/chemistry/engineer/tools/openbabel.md":{title:`Open Babel 化学格式转换`,summary:`转换结构格式并核对解析、氢原子、坐标和互操作性,保留原始身份及转换来源。`,originalName:`Open Babel Structure Conversion`,source:`argus/domains/chemistry/skills/engineer/tools/openbabel.md`,sourceSha256:`6eca4f250101ad817f624a76ca6c22193c73fd67a8d13d76a39bcf07d848fd75`},"vertical/chemistry/engineer/tools/orca.md":{title:`ORCA 量子化学计算`,summary:`在用户提供并授权的安装上计算,记录版本、分子状态、方法、基组、数值设置和主要输出。`,originalName:`ORCA Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/orca.md`,sourceSha256:`683637ad2fb781da58295e67229859794085fb01fcaaa43c10e11e13c8a91085`},"vertical/chemistry/engineer/tools/ord.md":{title:`开放反应数据库读写规范`,summary:`按数据库结构验证反应角色、数量、条件、结果与来源;结构有效不等于实验可复现。`,originalName:`Open Reaction Database I/O`,source:`argus/domains/chemistry/skills/engineer/tools/ord.md`,sourceSha256:`eb81cbde5711e04c578cc89a5b233a3de109c5b68b7322adeefd0996df21b8da`},"vertical/chemistry/engineer/tools/psi4.md":{title:`Psi4 量子化学计算`,summary:`明确分子状态、方法、基组、选项、收敛和单位,保留计算输出来源。`,originalName:`Psi4 Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/psi4.md`,sourceSha256:`2d8bf9817a90f90fe2407d8e4d71e6ffbf431f64207f61b8c2fca8acda199a69`},"vertical/chemistry/engineer/tools/pubchem.md":{title:`PubChem 公共资料检索`,summary:`通过核实的标识和带日期的查询取得公共化合物、性质及安全记录,保留原始响应与来源边界。`,originalName:`PubChem PUG REST Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/pubchem.md`,sourceSha256:`9aa66ea316f8180a29884f78b1ae927adf55f727476fa0529c01e7300161c89e`},"vertical/chemistry/engineer/tools/pyscf.md":{title:`PySCF 电子结构计算`,summary:`先确定电荷、自旋、几何、方法、基组、边界和收敛要求,再组织分子或周期体系计算。`,originalName:`PySCF Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/pyscf.md`,sourceSha256:`9ccb368195807ed7390cf2397506d004f849ccd1c0e1d51532b31e42e579dbc2`},"vertical/chemistry/engineer/tools/rdkit.md":{title:`RDKit 分子数据处理`,summary:`用于解析、规范化、立体化学、子结构、描述符、指纹与构象等处理;不直接证明化学身份或可行性。`,originalName:`RDKit Molecular Integrity`,source:`argus/domains/chemistry/skills/engineer/tools/rdkit.md`,sourceSha256:`b9330a5a8c90fb31bf3b551555d4f439cca90f9ecd45506734ce5051628ee074`},"vertical/chemistry/engineer/tools/tdc.md":{title:`TDC 药物研究数据基准`,summary:`使用明确任务、版本、许可、划分和评估器开展比较,核对污染与证据边界。`,originalName:`Therapeutics Data Commons Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/tdc.md`,sourceSha256:`a1aaed9bff60b1df25ccc8a9846ebcd30784c1f814cb20633e8a5ef57e11decb`},"vertical/chemistry/engineer/workflows/chemistry-playground.md":{title:`受限化学假设试探`,summary:`仅对明确提出的候选问题开展有边界的计算优先试探,保留问题、结果和负证据,并经过评审。`,originalName:`Chemistry Playground Bounded Hypothesis Probe`,source:`argus/domains/chemistry/skills/engineer/workflows/chemistry-playground.md`,sourceSha256:`72326a42543600e3fffedf0562c171466cc25b433cb8c05913e9fcfac3eb2d12`},"vertical/chemistry/manager/chemistry-manager.md":{title:`化学任务协调与分流`,summary:`为科学问题选择专门技能组合,保留原研究阶段、证据强度与授权边界。`,originalName:`Chemistry Manager Context`,source:`argus/domains/chemistry/skills/manager/chemistry-manager.md`,sourceSha256:`ecc7e16be351188d3c6ae75aa0e55c4b3978f1916e67c45754766cb63085f336`},"vertical/chemistry/planner/chemistry-planning.md":{title:`化学研究规划`,summary:`选择最贴合任务的流程,保持证据和安全要求;未完成时才安排具有科学判别力的后续工作。`,originalName:`Chemistry Research Planning`,source:`argus/domains/chemistry/skills/planner/chemistry-planning.md`,sourceSha256:`c9258fa062f3853d7a04950d0e0045b10be65c41c11248d6fe5c981e0ed02e02`},"vertical/chemistry/reviewer/battery-review.md":{title:`电池与电化学证据评审`,summary:`独立核对电芯身份、协议可比性、单位、循环退化证据和防泄漏模型评估。`,originalName:`Battery and Electrochemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/battery-review.md`,sourceSha256:`e0aa8763587e38281b5c2c5b6f7c92b3e07264b1cee076539751de8971d87725`},"vertical/chemistry/reviewer/biochemistry-review.md":{title:`生化与化学生物学评审`,summary:`检查构建体、结构、实验、动力学、模拟和功能声明,保留各自对照与结论边界。`,originalName:`Biochemistry and Chemical Biology Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/biochemistry-review.md`,sourceSha256:`68f2cc57f10d6c9bf30c41c249ebe7fc192b8ac4b763cb6ff40d9a41377135d0`},"vertical/chemistry/reviewer/characterization-review.md":{title:`化学表征证据评审`,summary:`独立核对原始仪器数据、校准、对照、归属和多模态证据,避免用通用解释越过测试边界。`,originalName:`Chemical Characterization Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/characterization-review.md`,sourceSha256:`3ba8858ac408729e78fa27a9338cd6eb435bd64d38da803d837aaec111ef8d67`},"vertical/chemistry/reviewer/chemistry-playground-review.md":{title:`化学试探结果评审`,summary:`检查受限问题与结果、证据和状态历史,防止未经确认的探索被当作正式科学结论。`,originalName:`Chemistry Playground Promotion Gate`,source:`argus/domains/chemistry/skills/reviewer/chemistry-playground-review.md`,sourceSha256:`309f1ff685c93c46c47239d9db1a3b85c41c6c384e986532e774ed3795e8d3c0`},"vertical/chemistry/reviewer/chemistry-review.md":{title:`化学研究综合评审`,summary:`按问题转交专门评审方法,核对对象、原始证据、对照、可复现性、不确定性和安全要求。`,originalName:`Chemistry Research Review`,source:`argus/domains/chemistry/skills/reviewer/chemistry-review.md`,sourceSha256:`bc2587f915788c94f8de55a0f2947a18e7bd368cccf1b400d1479e1681c64cf7`},"vertical/chemistry/reviewer/computational-review.md":{title:`计算化学证据评审`,summary:`审查输入身份、数值收敛、方法有效性,以及计算结果和测量结果之间的界线。`,originalName:`Computational Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/computational-review.md`,sourceSha256:`cab134d61ce5d45bf0240d2219eca03002e7b6315c4abf3738c2740229353e68`},"vertical/chemistry/reviewer/crystallography-review.md":{title:`晶体学证据评审`,summary:`独立检查衍射、对称性、精修、CIF、物相声明和结构不确定性,不替代其他领域评审。`,originalName:`Crystallography Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/crystallography-review.md`,sourceSha256:`034223d76528f09aede5febdb7fff1c848819f82564a8be7acf23ebc1a25d369`},"vertical/chemistry/reviewer/materials-science-review.md":{title:`材料科学证据评审`,summary:`核对非 MOF 材料的身份、工艺、性质和发现声明,不把结论跨用到晶体精修或电池循环。`,originalName:`Materials Science Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/materials-science-review.md`,sourceSha256:`ac639340d34bc5dae734e9f9841e91762cb31ec42c73c5a108dc69b25c2b76ba`},"vertical/chemistry/reviewer/mof-reticular-chemistry-review.md":{title:`MOF 与网状化学证据评审`,summary:`核对构筑单元、拓扑、合成活化、孔隙吸附、后修饰、数据与生成结构的证据。`,originalName:`MOF and Reticular Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/mof-reticular-chemistry-review.md`,sourceSha256:`d095ca81ab168c658696b20de0e149647cdbfcffe545cff73e3ed9ccaeb37dcf`},"vertical/chemistry/reviewer/organic-synthesis-review.md":{title:`有机合成与逆合成评审`,summary:`独立核对反应记录、路线先例、选择性、分析证据、安全和实际可行性声明。`,originalName:`Organic Synthesis and Retrosynthesis Review`,source:`argus/domains/chemistry/skills/reviewer/organic-synthesis-review.md`,sourceSha256:`0ce7fdeee239a78b9d74f7e64dbd55b38d99b9e88bf141399ec999d30f519ad0`},"vertical/chemistry/scientist/chemistry-adaptation.md":{title:`根据证据改进化学方法`,summary:`只有证据显示现有方法在对象、能力、验证或安全等机制层面存在缺口时,才调整可复用流程。`,originalName:`Chemistry Skill Adaptation`,source:`argus/domains/chemistry/skills/scientist/chemistry-adaptation.md`,sourceSha256:`d231961e4c85bee737df313c376e046dba50ed5a375460a924176db507f8ee9a`},"vertical/chemistry/scientist/chemistry-distillation.md":{title:`沉淀可复用化学流程`,summary:`在技能匹配缺失后归纳带范围、证据、验证和停止条件的方法,而不是保存目标答案或工具教程。`,originalName:`Chemistry Skill Distillation`,source:`argus/domains/chemistry/skills/scientist/chemistry-distillation.md`,sourceSha256:`1f7c9b2cddae0e19332d6e38edbac2671026d04e5ca0f3203f3d777e5e51d010`},"vertical/kernel_engineering/engineer/kernel-benchmark-measurement-integrity.md":{title:`GPU 算子工程:先算屋顶线,隔离测量`,summary:`先用屋顶线定瓶颈再改机制而非参数;一次干净的隔离运行足以筛选想法,要主张或保留的提升必须在官方条件下测量;审阅只看正确性与基准证据。`,originalName:`Kernel Engineering: Roofline First, Measure in Isolation`,source:`argus/verticals/kernel_engineering/skills/engineer/kernel-benchmark-measurement-integrity.md`,sourceSha256:`b6bbe44b147dfea2dd68810db53571a9fae5db238c2bcde24d51c79756bf1785`},"vertical/learning/learning-curation.md":{title:`学习任务的整理与审阅`,summary:`把操作者材料变成有证据锚点的项目 Skill/Wiki 修改或诚实的空操作,说明 CHANGE_PLAN.json 的约定以及审阅者如何判断修改是否忠实、无冗余、不倒退、层级正确。`,originalName:`Learning Curation`,source:`argus/verticals/learning/skills/learning-curation.md`,sourceSha256:`71490b8d95eecb97a88a18e8bc4dd0a1aa163d7c0f82a02114440aae1f5f6999`},"vertical/math/engineer/math-research-execution.md":{title:`数学研究执行`,summary:`忠实保留命题与范围,诚实区分结果类别;需要 Lean 证据时实际编译,不虚构证明。`,originalName:`Math Research Execution`,source:`argus/verticals/math/skills/engineer/math-research-execution.md`,sourceSha256:`ddcf8321ce873130c1de3e71b78d816115182813e8a6dfdd4bc89d0fe9629736`},"vertical/math/manager/math-research-manager.md":{title:`数学研究任务协调`,summary:`在通用协调流程中保持研究目标、范围、求解和评审职责,不另造一套权限体系。`,originalName:`Math Research Manager Context`,source:`argus/verticals/math/skills/manager/math-research-manager.md`,sourceSha256:`e228b24cd82e6dee678458b5e32c4e1fc6092151b06c7eee198b158bdd1a1b95`},"vertical/math/planner/math-research-planning.md":{title:`数学研究规划`,summary:`围绕范围界定、求解和评审安排动态任务,保持原有角色与生命周期规则。`,originalName:`Math Research Planning`,source:`argus/verticals/math/skills/planner/math-research-planning.md`,sourceSha256:`e3320bf8a0b986eae0251ce1004962659ab2a9505a2cc73da63c33b94d2799f4`},"vertical/math/reviewer/math-research-review.md":{title:`数学研究独立评审`,summary:`检查正确性、新意、意义、命题忠实性和真实形式化证据,不以叙述代替证明。`,originalName:`Math Research Review`,source:`argus/verticals/math/skills/reviewer/math-research-review.md`,sourceSha256:`21b7e0f172bbb695ae9950c0e9dd1cdac60ae6aa21df0962a88a1b06ba505251`},"vertical/math/scientist/math-research-adaptation.md":{title:`改进数学研究方法`,summary:`在评审确认方法失败或技能缺口后,按已有适应阶段调整可复用方法。`,originalName:`Math Research Scientist Adaptation`,source:`argus/verticals/math/skills/scientist/math-research-adaptation.md`,sourceSha256:`fd8961cb0155e3fc05428cf0b5dbd6be86ed048636dc657b3b23abbee6495933`},"vertical/math/scientist/math-research-distillation.md":{title:`沉淀数学研究方法`,summary:`在首次匹配缺失后整理可复用研究方法,不假定已经失败,也不代替当前任务的执行。`,originalName:`Math Research Skill Distillation`,source:`argus/verticals/math/skills/scientist/math-research-distillation.md`,sourceSha256:`83a7367798b1ac327861deaa94accf1d77da0e140ebc8da8137442a30a83b09a`},"vertical/research/engineer/ablation-planner.md":{title:`选择有判别力的消融实验`,summary:`只选择能区分结果解释、说明所选方法作用的必要消融,而不是机械穷举组合。`,originalName:`Choosing ablations that distinguish explanations`,source:`argus/verticals/research/skills/engineer/ablation-planner.md`,sourceSha256:`f5c9bff3d6b5bc9dc4b50316e172856fcc01d708685c08a1ff29650871369858`},"vertical/research/engineer/method-card.md":{title:`方法卡、可执行规范与审阅锚点`,summary:`在 METHOD.md 中写清方法、组件、协议和证伪条件;以钉版参考实现为底把方法写成 diff;先写 tests/spec 再跑承载论断的实验;用代码锚点让不在场的审阅者找到机制;规划者据此写实现简报。`,originalName:`Method card (METHOD.md), executable spec and review anchors`,source:`argus/verticals/research/skills/engineer/method-card.md`,sourceSha256:`2e756a2fd09bca2abe4175fea4042af6905a6166b629c940909b10090cfe6855`},"vertical/research/engineer/novelty-check.md":{title:`检验研究想法的新意`,summary:`通过当前来源对照最接近的已有工作,判断一条候选想法的差异,而非先宣称创新。`,originalName:`Testing the idea's novelty`,source:`argus/verticals/research/skills/engineer/novelty-check.md`,sourceSha256:`e20a0f4290c72b07c9b09fa77633ecc915f0f7a8b90d8efd4c627fb9d12f8c16`},"vertical/research/engineer/paper-chart-styling.md":{title:`论文数据图样式`,summary:`统一数据图的配色、尺寸、标记和字体嵌入,遵守所选期刊会议版式;不改变数据本身。`,originalName:`Styling data figures for publication`,source:`argus/verticals/research/skills/engineer/paper-chart-styling.md`,sourceSha256:`c40b9f431de9cd01f16e245d819563566fc5db02c2217505599921adcca65b75`},"vertical/research/engineer/paper-framework-figure-studio.md":{title:`论文图的路线选择与概念图编排`,summary:`按表达内容选渲染路线:数据图走 SciencePlots/Matplotlib,概念与框架图默认以图像蓝图重建为可编辑 PPT,无图像接口时直接原生绘制;生成图像只用于不承载论断的部分。`,originalName:`Composing a conceptual paper figure`,source:`argus/verticals/research/skills/engineer/paper-framework-figure-studio.md`,sourceSha256:`e01ffd101b8fcd701b86918d93994079dfc87d9df79dbcd348bdfe3508cfcd9b`},"vertical/research/engineer/references/ideation/ideation-patterns/overview.md":{title:`研究构思模式总览`,summary:`汇总各研究构思模式的定义、操作特征与适用时机,帮助为路线挑选机制视角;模式在语料中常见不代表适合当前问题,也不替代创新性与正确性验证。`,originalName:`engineer/references/ideation/ideation-patterns/overview`,source:`argus/verticals/research/skills/engineer/references/ideation/ideation-patterns/overview.md`,sourceSha256:`8b2b43b5ce63c70a1b54c0ff5fb3f1954bc8ef6c05bda95a71a011d2f5f4eb34`},"vertical/research/engineer/references/paper-writing-craft.md":{title:`论文写作方法参考`,summary:`提供论文论证和表达的写作参考,需结合真实证据与所选期刊会议要求使用。`,originalName:`engineer/references/paper-writing-craft`,source:`argus/verticals/research/skills/engineer/references/paper-writing-craft.md`,sourceSha256:`bd645d2f2f48987c988c54b6b22843b22ee3b5a9dc0ce950bff4acdc0fcf3eeb`},"vertical/research/engineer/research-grind.md":{title:`沿诊断阶梯打磨研究结果`,summary:`把首次实现当作草稿,在固定声明下沿诊断阶梯逐级排查;结果异常先怀疑设置;从原始逐种子行算数;依据证据而非尝试次数判断何时足够。`,originalName:`Working a research result into shape`,source:`argus/verticals/research/skills/engineer/research-grind.md`,sourceSha256:`e955fe1ac7aa975a9172394bdca4e8b2ed6a504355ab00573a26badf442f038a`},"vertical/research/engineer/rl-training-collapse-diagnosis.md":{title:`强化学习训练健康诊断`,summary:`检查奖励、优势、梯度、KL、截断和吞吐异常,先诊断配置与过程,再归因方法;不同训练目标不能混用规则。`,originalName:`RL Training Health Diagnosis`,source:`argus/verticals/research/skills/engineer/rl-training-collapse-diagnosis.md`,sourceSha256:`d48fd69adaac73ad45c41cd9565798a94a476de52c9354097abe2d8604db8782`},"vertical/research/engineer/sources-and-citations.md":{title:`对照来源核对论断与引用`,summary:`把稿件中的论断对回支撑它的证据,把引用对回被引的原文,并用 Semantic Scholar 核对版本;补充全局的一手来源技能,不另起一轮整篇审阅。`,originalName:`Checking claims and citations against their sources`,source:`argus/verticals/research/skills/engineer/sources-and-citations.md`,sourceSha256:`450410c4b428e31104819c07a98e19b615ced499e0d2d4df473305ca789d55ed`},"vertical/research/engineer/training-infrastructure.md":{title:`训练基础设施的选择、搭建与调参`,summary:`训练或大规模推理需要框架时,用实时来源调查候选、在隔离环境中试装并剖析一步真实更新、以官方配方为锚每次只改一个因素,并把结论写成带日期的项目决策记录;不按记忆推荐技术栈。`,originalName:`Training infrastructure: choosing, standing up and tuning it`,source:`argus/verticals/research/skills/engineer/training-infrastructure.md`,sourceSha256:`4c495369ffba7ff2b9954a2fafd72b874e63abc6065a5afab7c61ce10afb9087`},"vertical/research/engineer/venue-format-preflight.md":{title:`投稿前的编译与泄露检查`,summary:`用目标会场的官方作者模板编译完整稿件并核对结构,同时检查稿件没有泄露内部路径、角色名与运行时用语。`,originalName:`Preparing the draft for the venue`,source:`argus/verticals/research/skills/engineer/venue-format-preflight.md`,sourceSha256:`e146afba818a8436d0807aff610084d6a321277778e7ce299bd96f9f57795eb0`},"vertical/research/engineer/venue-format-research.md":{title:`选择投稿目标并核对要求`,summary:`根据研究内容选择合适期刊会议,获取当前官方作者要求,而非沿用过时模板。`,originalName:`Choosing a venue and reading its requirements`,source:`argus/verticals/research/skills/engineer/venue-format-research.md`,sourceSha256:`aad2d0ec25649231ec233f4abb5b216af313a7a1dfa699cc6f0c8b23be7cbcf2`},"vertical/research/engineer/venue-paper-drafting.md":{title:`面向投稿目标撰写论文`,summary:`先定论证形状,按所选作者模板和确认的证据写完整论文,读一次强范文校准视觉与结构标准;不把未验证探索写成既定结论。`,originalName:`Writing for the selected venue`,source:`argus/verticals/research/skills/engineer/venue-paper-drafting.md`,sourceSha256:`d7bb7d7e59f5ce6e20433fa843e3d7002575b1892b131c0d0f7f247e986281f1`},"vertical/research/research-experiment-playbook.md":{title:`通过实验发展研究想法`,summary:`忠实实现已选想法,通过适应性实验形成足以支撑论文的证据,而不是只完成首次运行。`,originalName:`Developing an idea through experiments`,source:`argus/verticals/research/skills/research-experiment-playbook.md`,sourceSha256:`df8f6a724b93f063a6e0dd2e36af1838fca72eea689f062b096d3ad0c4ad2c85`},"vertical/research/research-idea-playbook.md":{title:`寻找并选择研究想法`,summary:`从来源中发现候选可能性,经独立审查后作最终选择,不把构思直接当作实验结果。`,originalName:`Finding a research idea`,source:`argus/verticals/research/skills/research-idea-playbook.md`,sourceSha256:`91104461d9115ee280db1f5e89d3c35bc8301422bfd7d9a70c66fa559c09eed6`},"vertical/research/research-paper-playbook.md":{title:`撰写完整研究论文`,summary:`从已确认的正向证据组织论文、编译并准备投稿材料,保持证据与论述一致。`,originalName:`Writing the research paper`,source:`argus/verticals/research/skills/research-paper-playbook.md`,sourceSha256:`2efcabc2904fe55831b0f5d9c61846c544aab2a211687f0fbf51ad417e66afec`},"vertical/research/research-review-playbook.md":{title:`对论文形成独立判断`,summary:`综合科学性、图示、语言和整体论证,判断工作是否成立并提出建设性意见。`,originalName:`Reaching a judgment on the paper`,source:`argus/verticals/research/skills/research-review-playbook.md`,sourceSha256:`368d0bc3b8dba80c1e8d84257a10f95bbe2124a35d03a30e553e1d6b56ae829a`},"vertical/research/reviewer/academic-paper-peer-review-benchmark.md":{title:`按目标期刊会议评审论文`,summary:`以独立评审视角判断当前稿件,提供科学指导并更新评审记录。`,originalName:`Reading the paper as a venue reviewer`,source:`argus/verticals/research/skills/reviewer/academic-paper-peer-review-benchmark.md`,sourceSha256:`6446f17af2a751bd9570b4351e4b28d84d09cc06ed2c59174111f17f39e0cbc9`},"vertical/research/reviewer/claim-to-code-trace.md":{title:`追溯声明到实际代码`,summary:`沿配置和执行路径核对公式、比较条件与观测,判断研究声明是否对应实际产生证据的代码。`,originalName:`Claim-to-Code Trace`,source:`argus/verticals/research/skills/reviewer/claim-to-code-trace.md`,sourceSha256:`fef3ef16ce27a9c1e9ec5f095c73bb734da06aedba74fa994122e28d32c293ee`},"vertical/research/reviewer/experiment-results-review.md":{title:`判断实验真正说明了什么`,summary:`亲自读代码、配置、评测器和原始行,判断证据对固定声明的支持与缺口;低于基线的结果在阶梯未走完前是修复请求;训练类实验另核对基础设施决策记录。`,originalName:`What the experiments establish`,source:`argus/verticals/research/skills/reviewer/experiment-results-review.md`,sourceSha256:`bc158d8b51107b697d290eb6ed461f2a596aa601bc78cce7e88089743411533e`},"vertical/research/reviewer/strongest-argument-against.md":{title:`寻找最有力的科学反对意见`,summary:`在最终评审中识别论文最关键的科学弱点,不通过直接改稿掩盖它。`,originalName:`The strongest argument against the paper`,source:`argus/verticals/research/skills/reviewer/strongest-argument-against.md`,sourceSha256:`6cc3e7990dacb420a04ff945cb1f221852bd249b981a60def70dfcace2ac3418`},"vertical/research/reviewer/venue-academic-language-review.md":{title:`审查论文论证与学术表达`,summary:`对照目标期刊会议的当前惯例阅读论证与语言,指出问题,不擅自编辑论文。`,originalName:`Reading the paper's argument and language`,source:`argus/verticals/research/skills/reviewer/venue-academic-language-review.md`,sourceSha256:`a2fe9faf57ff0a09181f42de2ac2b5080158e08c430078fb48722fd6b9893f66`},"vertical/software/engineer/software-change-implementation.md":{title:`有边界的软件实现与拆解`,summary:`结合仓库结构选择合适工具,以与任务规模相称的检查完成软件修改;分阶段工作按架构边界拆解,每个任务写明兼容性风险与独立预言机。`,originalName:`Software Change Implementation`,source:`argus/verticals/software/skills/engineer/software-change-implementation.md`,sourceSha256:`34dad5e10c880fb48964573768b72d8377829ca8163ddd21987c2c05538d70a9`},"vertical/software/reviewer/software-change-review.md":{title:`软件修改独立评审`,summary:`检查真实调用路径、兼容性与验证证据,不依赖参考答案或仅凭完成声明判断。`,originalName:`Software Change Review`,source:`argus/verticals/software/skills/reviewer/software-change-review.md`,sourceSha256:`5d1a66ff65accae04ec02005724735c9767308ac63c005b8be6e269eb9acb25f`}};function Sn(e){if(!e.is_default||![`bundled`,`shared`].includes(e.source)||!(e.scope===`global`?[`global:${e.source}`]:e.scope===`vertical`?[`vertical:${e.vertical}:${e.source}`,...e.source===`bundled`?[`domain:${e.vertical}:bundled`]:[]]:[]).includes(e.library))return null;let t=e.scope===`global`?`global/${e.path}`:`vertical/${e.vertical}/${e.path}`,n=Object.hasOwn(xn,t)?xn[t]:null;return n?.originalName===e.name?n:null}function Cn(e,t){let n=t===`zh-CN`?Sn(e):null;return{title:n?.title??e.name,summary:n?.summary??e.description,guide:n}}function wn(e,t){let n=Cn(e,t);return`${e.name} ${e.description} ${e.path} ${e.vertical} ${n.title} ${n.summary}`.toLocaleLowerCase()}var Tn={research:`科研`,software:`软件开发`,math:`数学研究`,chemistry:`化学`,kernel_engineering:`GPU 算子工程`,argus_maintenance:`Argus 维护`,learning:`资料学习`};function En(e,t){return t===`zh-CN`&&Object.hasOwn(Tn,e)?Tn[e]:e}var Dn={fact:[`记录可核对的环境、对象或事实,供后续工作查证;记录本身不保证事实仍然有效。`,`Records checkable facts for later verification; a saved record is not a guarantee that it is still current.`],lesson:[`保留工作中得到的经验和问题,帮助类似任务少走弯路;不能代替当前证据或评审。`,`Keeps lessons from work to inform similar tasks; it does not replace current evidence or review.`],survey:[`整理问答或调研材料与来源,为后续查阅提供线索;结论仍需结合原文核对。`,`Organizes answers or research and their sources for later reference; check conclusions against the original evidence.`],principles:[`归纳可反复参考的建议,帮助选择方法;应检查所引用的经验与适用条件。`,`Distills recurring guidance for choosing methods; check the cited lessons and applicability.`],note:[`保存关于你的背景、偏好或计划,帮助后续任务理解上下文;不是工具使用授权。`,`Keeps personal context, preferences or plans for later work; it is not authorization to use tools.`],profile:[`汇总 Argus 对你的背景与偏好的了解,方便核对是否准确;不代表公开资料或任务完成情况。`,`Summarizes personal context and preferences for inspection; it is neither a public record nor a task-completion report.`],page:[`一般参考资料。具体用途取决于原文和来源,不能仅凭“已保存”判断内容可靠或适用。`,`General reference material. Its use depends on the original content and sources, not merely on being saved.`]};function On(e,t){return(Object.hasOwn(Dn,e)?Dn[e]:Dn.page)[t===`zh-CN`?0:1]}var kn={private:[`你的个人背景资料,与共享知识分开保存。这里不改变既有读取权限或模型的数据处理方式。`,`Personal context is stored separately from shared knowledge. This view does not change existing access or model data handling.`],global:[`跨项目参考的通用资料;不要把个人信息当作公共知识放在这里。`,`General reference across projects; personal information does not belong in shared knowledge.`],vertical:[`同一领域可复用的专门资料,使用前仍要核对当前任务的条件。`,`Domain-specific reference; verify that it applies to the current task.`],project:[`围绕当前项目保存的资料与背景;分类不是操作系统沙箱或文件权限边界。`,`Material associated with this project; the category is not an OS sandbox or file-permission boundary.`]};function An(e,t){return Object.hasOwn(kn,e)?kn[e][t===`zh-CN`?0:1]:t===`zh-CN`?`范围尚未确认,请以来源说明为准。`:`Scope not confirmed; consult the source.`}var jn={active:`label.status.inProgress`,claimed:`label.status.inProgress`,in_progress:`label.status.inProgress`,running:`label.status.inProgress`,working:`label.status.inProgress`,pending:`label.status.waiting`,queued:`label.status.waiting`,waiting:`label.status.waiting`,idle:`label.status.waiting`,accepted:`label.status.completed`,complete:`label.status.completed`,completed:`label.status.completed`,done:`label.status.completed`,success:`label.status.completed`,blocked:`label.status.blocked`,failed:`label.status.failed`,error:`label.status.failed`,rejected:`label.status.needsChanges`,continue:`label.status.needsChanges`,skipped:`label.status.skipped`,paused:`label.status.paused`,paused_cost:`label.outcome.costUnreconciled`,stopped:`label.status.paused`,cancelled:`label.status.cancelled`,aborted:`label.status.cancelled`,not_started:`label.status.waiting`,available:`label.status.available`,absent:`label.status.unavailable`,inaccessible:`label.status.inaccessible`,degraded:`label.status.limited`,healthy:`label.status.healthy`},Mn={system:`label.role.argus`,operator:`label.role.you`},Nn={completed:`label.outcome.workCompleted`,done:`label.outcome.workCompleted`,success:`label.outcome.workCompleted`,paused:`label.outcome.workPaused`,blocked:`label.outcome.workBlocked`,failed:`label.outcome.workFailed`,error:`label.outcome.workFailed`,aborted:`label.outcome.workEnded`,ended:`label.outcome.workEnded`,incomplete:`label.outcome.workIncomplete`,research_incomplete:`label.outcome.workIncomplete`,paused_no_breakthrough:`label.outcome.workIncomplete`,exhausted_current_methods:`label.outcome.workIncomplete`,stalled:`label.outcome.workStalled`,no_progress:`label.outcome.workStalled`,max_rounds:`label.outcome.workStalled`,infra_blocked:`label.outcome.workBlocked`,supervisor_error:`label.outcome.workFailed`},Pn={accepted:`label.outcome.reviewPassed`,done:`label.outcome.reviewPassed`,passed:`label.outcome.reviewPassed`,continue:`label.outcome.reviewNeedsChanges`,rejected:`label.outcome.reviewNeedsChanges`,blocked:`label.outcome.reviewBlocked`,stale:`label.outcome.reviewOutdated`,pending:`label.outcome.reviewPending`,pending_review:`label.outcome.reviewPending`},Fn={certified:`label.outcome.stageApproved`,not_certified:`label.outcome.stageNotApproved`,revoked:`label.outcome.stageRevoked`,intentionally_skipped:`label.outcome.stageNotNeeded`,deferred:`label.outcome.stagePending`},In={budget_exhausted:`label.outcome.budgetPaused`,budget_pause:`label.outcome.budgetPaused`,cost_unreconciled:`label.outcome.costUnreconciled`,operator_input_required:`label.outcome.waitingForYou`,operator_abort:`label.outcome.stoppedByYou`,operator_pause:`label.outcome.pausedByYou`,daemon_shutdown:`label.outcome.sessionPaused`,backend_unavailable:`label.outcome.serviceUnavailable`,provider_cooldown:`label.outcome.serviceCoolingDown`,provider_fence:`label.outcome.serviceUnavailable`,transient_error:`label.outcome.temporaryIssue`,permanent_error:`label.outcome.serviceError`,planner_empty_plan:`label.outcome.needsPlan`},Ln={cuda:`label.resource.nvidiaGpu`,rocm:`label.resource.amdGpu`,mps:`label.resource.appleGpu`,cpu:`label.resource.cpu`};function Rn(e,t){return t(jn[String(e??``).toLowerCase()]??`label.status.updated`)}function zn(e,t){let n=String(e??``).toLowerCase();return gt(n)?Ve(n,t):t(Mn[n]??`label.role.argus`)}function Bn(e,t){return t(`label.priority`,{priority:e})}function Vn(e,t){if(!e?.execution_status)return[];let n=[t(Nn[e.execution_status.toLowerCase()]??`label.outcome.workUpdated`)],r=Pn[String(e.review_status??``).toLowerCase()],i=Fn[String(e.stage_certification??``).toLowerCase()],a=In[String(e.interruption_kind??``).toLowerCase()];return r&&n.push(t(r)),i&&n.push(t(i)),a&&n.push(t(a)),e.resumable&&n.push(t(`label.outcome.canResume`)),n}function Hn(e,t){return t(Ln[e.toLowerCase()]??`label.resource.accelerator`)}function Un(e,t){return t(e===`strict`?`label.resource.enforced`:`label.resource.advisory`)}function Wn(e,t){return t(e===`yield`?`label.resource.released`:`label.resource.kept`)}var J=i(),Gn=e=>[`knowledge-feed`,e];function Kn(e=!0,t=50){return A({queryKey:Gn(t),queryFn:({signal:e})=>R.knowledgeFeed(t,e),enabled:e,staleTime:5e3,refetchInterval:1e4})}var qn={en:{learned:`Learned`,recalled:`Recalled`,promoted:`Promoted`,corrected:`Corrected`},zh:{learned:`学到了`,recalled:`读取了`,promoted:`提升了`,corrected:`纠正了`}},Jn={en:{private:`About you`,global:`Global`,vertical:`Vertical`,project:`Project`},zh:{private:`关于你`,global:`全局`,vertical:`垂直领域`,project:`项目`}};function Yn(e,t=60){let n=[...e].sort((e,t)=>t.ts-e.ts),r=[];for(let e of n){let n=r[r.length-1];if(e.kind===`recalled`&&n?.kind===`recalls`&&n.role===e.role&&n.ts-e.ts<=t){n.events.push(e);continue}r.push(e.kind===`recalled`?{kind:`recalls`,ts:e.ts,role:e.role,events:[e]}:{kind:`single`,event:e})}return r}function Xn(e,t,n=null){return e.path?e.scope===`project`?n&&e.source_project&&e.source_project!==n?null:t.find(t=>t.scope===`project`&&t.path===e.path)??null:t.find(t=>t.scope===e.scope&&t.vertical===e.vertical&&t.path===e.path)??null:null}var Zn={learned:`bg-blue/10 text-blue`,recalled:`bg-line/60 text-ink-dim`,promoted:`bg-ok/10 text-ok`,corrected:`bg-warn/10 text-warn`};function Qn({events:e,items:t,sid:n,projectNames:r={},query:i=``,onSelect:a,selected:o}){let{locale:s,t:c}=z(),l=s===`zh-CN`,u=qn[l?`zh`:`en`],d=Jn[l?`zh`:`en`],f=e=>wt(e,l?`zh-CN`:`en`),p=i.trim().toLocaleLowerCase(),m=Yn(p?e.filter(e=>`${e.title} ${e.path} ${e.vertical} ${e.source_project} ${e.role} ${e.note}`.toLocaleLowerCase().includes(p)):e),h=e=>[d[e.scope]??e.scope,En(e.vertical,s),e.source_project?`${l?`来自 `:`from `}${r[e.source_project]||e.source_project}`:``,l&&e.role?zn(e.role,c):e.role].filter(Boolean).join(` · `),g=e=>!!(e&&o&&e.scope===o.scope&&e.vertical===o.vertical&&e.path===o.path),_=(e,r)=>{let i=Xn(e,t,n),o=e.title||e.path;return i?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(i),"aria-pressed":g(i),"data-feed-title":!0,className:`${r} text-left hover:text-blue ${g(i)?`text-blue`:`text-ink`}`,children:o}):(0,J.jsx)(`span`,{"data-feed-title":!0,className:`${r} text-ink`,title:e.path,children:o})};return m.length===0?(0,J.jsx)(`p`,{className:`p-3 text-sm leading-relaxed text-ink-faint`,children:p?l?`没有匹配的学习动态。`:`No feed lines match the search.`:l?`还没有学习动态。Argus 在任务后反思写下教训、把已有知识读进提示、或把评审通过的页面提升到共享层时,都会在这里留下一行。`:`Nothing learned yet. A line appears here whenever Argus writes a lesson after a mission, reads existing knowledge into a prompt, or promotes a reviewed page to a shared level.`}):(0,J.jsx)(`ol`,{className:`space-y-1`,"aria-label":l?`学习动态`:`Learning feed`,children:m.map(e=>e.kind===`single`?(0,J.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":e.event.kind,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`time`,{dateTime:new Date(e.event.ts*1e3).toISOString(),children:f(e.event.ts)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${Zn[e.event.kind]??Zn.learned}`,children:u[e.event.kind]??e.event.kind})]}),_(e.event,`mt-1 block w-full break-words text-sm font-medium`),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.event)}),e.event.note&&(0,J.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-ink-dim`,children:e.event.note})]},`${e.event.ts}/${e.event.kind}/${e.event.path}`):(0,J.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":`recalls`,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`time`,{dateTime:new Date(e.ts*1e3).toISOString(),children:f(e.ts)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${Zn.recalled}`,children:u.recalled})]}),(0,J.jsx)(`span`,{className:`mt-1 block text-sm font-medium text-ink`,"data-feed-title":!0,children:e.events.length===1?e.events[0].title||e.events[0].path:l?`读取了 ${e.events.length} 条已有知识`:`Recalled ${e.events.length} existing pages`}),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.events[0])}),e.events.length>1&&(0,J.jsx)(`span`,{className:`mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-xs`,children:e.events.map(e=>(0,J.jsx)(`span`,{children:_(e,`inline text-xs text-ink-dim`)},`${e.ts}/${e.scope}/${e.vertical}/${e.path}`))})]},`${e.ts}/recalls/${e.role}`))})}function $n({guide:e,item:t}){let{t:n}=z();return(0,J.jsxs)(`section`,{"data-skill-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-4 text-sm leading-relaxed text-ink`,children:[(0,J.jsx)(`h4`,{className:`font-semibold`,children:`这项方法有什么用`}),(0,J.jsx)(`p`,{className:`mt-2`,children:e.summary}),(0,J.jsxs)(`dl`,{className:`mt-3 space-y-2 text-xs text-ink-dim`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`什么时候参考`}),(0,J.jsx)(`dd`,{children:`当前任务与上面的用途相符时,由既有任务与技能选择流程按需读取;浏览本页不会运行工具或发起模型任务。`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`目录标注的角色`}),(0,J.jsxs)(`dd`,{children:[zn(t.role,n),`;这只是说明,不调整角色职责或权限。`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`需要注意`}),(0,J.jsx)(`dd`,{children:`这是随包版本的中文导读,不是完整执行指令,也不是已经完成或验证的证据。具体步骤、前置条件、软件许可和授权限制请对照原文。`})]})]})]})}function er({item:e}){let{locale:t}=z(),n=t===`zh-CN`;return(0,J.jsxs)(`section`,{"data-knowledge-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-3 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`h4`,{className:`font-semibold text-ink`,children:n?`这类知识怎样帮助工作`:`How this kind of knowledge helps`}),(0,J.jsx)(`p`,{className:`mt-2`,children:On(e.kind,t)}),(0,J.jsx)(`p`,{className:`mt-2`,children:An(e.scope,t)}),(0,J.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n?`以上解释条目类型与范围,不是这篇正文的翻译或真实性证明。具体内容、来源和适用条件仍以原文为准。`:`This explains the kind and scope, not the page itself or its validity. Consult the original content, sources and conditions.`})]})}function tr({sid:e,channel:t,onOpenKnowledge:n,onOpenSkills:r}){let{locale:i}=z(),a=i===`zh-CN`,o=M(),s=A({queryKey:[`learning-status`,e],queryFn:({signal:t})=>R.learningStatus(e,t),enabled:!!e,refetchInterval:2e3,staleTime:1e3}),c=(0,G.useRef)(``);(0,G.useEffect)(()=>{let t=`${e}:${s.data?.revision??0}`;if(!(!s.data?.revision||t===c.current)){c.current=t;for(let e of[`skill-library`,`wiki-library`,`knowledge-feed`])o.invalidateQueries({queryKey:[e]})}},[e,s.data?.revision,o]);let l=N({mutationFn:e=>R.retryLearning(e.sid,e.id),onSuccess:(e,t)=>o.setQueryData([`learning-status`,t.sid],e)});if(!e||!s.data?.jobs.length)return null;let u=s.data.jobs,d=u.find(e=>e.status===`running`)??u.find(e=>e.status===`queued`),f=d??u[0],p=!!d||s.data.pending>0,m=!p&&f.status===`skipped`&&f.outcome.reason===`paused`;if(!p&&f.status===`skipped`&&(!m||!t))return null;let h={cost_unreconciled:[`上一次模型调用的费用尚未结算,结算前暂停新的模型调用`,`model calls are paused until an earlier call's cost is settled`],budget_exhausted:[`今日模型预算已用完`,`today's model budget is used up`],provider_cooldown:[`模型服务暂时限流`,`the model provider is briefly rate-limited`],operator_pause:[`模型调用已暂停`,`model calls are paused`]},g=h[f.outcome.detail??``]??h.operator_pause,_=m||!p&&f.status===`failed`,v=a?{knowledge:`知识库`,skills:`技能库`,preferences:`用户偏好`}:{knowledge:`Knowledge base`,skills:`Skill library`,preferences:`Preferences`},y=t?[t]:[`knowledge`,`skills`,`preferences`],b=p?y:y.filter(e=>(f.outcome.counts?.[e]??0)>0);if(!p&&!_&&!b.length)return null;let x=e=>{let t=f.outcome.counts?.[e]??0;return p?f.status===`running`?a?`${v[e]}正在更新`:`Updating ${v[e].toLowerCase()}`:a?`${v[e]}等待更新`:`${v[e]} update queued`:a?`${v[e]}已更新 · ${t} 条`:`${v[e]} updated · ${t}`},S=(f.outcome.items??[]).filter(e=>!t||e.channel===t);return(0,J.jsxs)(`div`,{className:`px-2 py-1.5 text-[11px] leading-5 text-ink-dim`,"data-learning-status":f.status,children:[(0,J.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:[p?(0,J.jsx)(an,{className:`h-3 w-3 animate-spin text-blue`}):_?(0,J.jsx)(tn,{className:`h-3 w-3 text-ink-faint`}):(0,J.jsx)(hn,{className:`h-3 w-3 text-blue`}),m&&(0,J.jsx)(`span`,{children:a?`本轮未学习:${g[0]}。回复不受影响。`:`Learning skipped: ${g[1]}. Your reply is unaffected.`}),!p&&f.status===`failed`&&(0,J.jsx)(`span`,{children:a?`本轮学习未完成,回复不受影响。`:`Learning from this turn did not finish. Your reply is unaffected.`}),!_&&b.map(e=>(0,J.jsx)(`span`,{children:x(e)},e)),s.data.pending>1&&(0,J.jsx)(`span`,{children:a?`还有 ${s.data.pending-1} 轮待学习`:`${s.data.pending-1} more queued`}),_&&f.retryable!==!1&&(0,J.jsx)(`button`,{type:`button`,disabled:l.isPending,className:`text-blue underline`,onClick:()=>l.mutate({sid:e,id:f.id}),children:a?`重试学习`:`Retry learning`})]}),p&&!t&&(0,J.jsx)(`p`,{className:`text-ink-faint`,children:a?`正在整理本轮的知识、方法和偏好,你可以继续工作。`:`Saving useful knowledge, methods and preferences. You can keep working.`}),S.length>0&&!t&&(0,J.jsxs)(`details`,{className:`mt-0.5`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-blue`,children:a?`查看本轮学到了什么`:`What this turn taught Argus`}),(0,J.jsx)(`ul`,{className:`pl-4 list-disc`,children:S.map((e,t)=>(0,J.jsx)(`li`,{children:(e.channel===`skills`?r:n)?(0,J.jsx)(`button`,{type:`button`,className:`text-left underline`,onClick:e.channel===`skills`?r:n,children:e.title}):e.title},t))})]}),(l.isError||s.isError)&&(0,J.jsx)(`p`,{role:`alert`,children:a?`暂时无法同步学习状态,请稍后重试。`:`Learning status could not be refreshed. Please retry.`})]})}var nr=e=>`${e.library}/${e.path}`,rr=e=>e.filter(e=>!e.is_default&&e.updated_at!=null).sort((e,t)=>(t.updated_at??0)-(e.updated_at??0)||nr(e).localeCompare(nr(t)));function ir(e,t=!0){return A({queryKey:[`skill-library`,e],queryFn:({signal:t})=>R.skillLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var ar={en:{fact:`Fact`,lesson:`Lesson`,survey:`Survey`,principles:`Principles`,note:`Note`,profile:`Profile`,page:`Page`},zh:{fact:`事实`,lesson:`经验教训`,survey:`调研摘要`,principles:`原则`,note:`个人记录`,profile:`个人概况`,page:`参考页面`}},or=e=>e.kind in ar.en?e.kind:`page`,sr=e=>[`wiki-library`,e];function cr(e,t=!0){return A({queryKey:sr(e),queryFn:({signal:t})=>R.wikiLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var lr=[`feed`,`global`,`vertical`,`project`],ur={feed:hn,global:en,vertical:rn,project:$t},dr={"zh-CN":{feed:`学习动态`,global:`全局项目`,vertical:`垂直领域`,project:`项目`},en:{feed:`Learning feed`,global:`Across projects`,vertical:`Vertical`,project:`Project`}};function fr(e,t,n,r){let i=r===`zh-CN`,a=e=>n===`feed`||e===n||n===`global`&&e===`private`,o=(e?.items??[]).filter(e=>a(e.scope)).map(e=>({kind:`knowledge`,item:e,id:`knowledge/${e.scope}/${e.vertical}/${e.path}`,title:e.title,description:e.description,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at,search:`${e.title} ${e.description} ${e.path}`})),s=(n===`feed`?rr(t?.items??[]):t?.items??[]).filter(e=>a(e.scope)).map(e=>{let t=Cn(e,r);return{kind:`skill`,item:e,id:`skill/${e.library}/${e.path}`,title:t.title,description:t.summary,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at??0,search:wn(e,r)}}),c=n===`feed`?[]:(e?.libraries??[]).filter(e=>a(e.scope)).flatMap(e=>[{kind:`index`,content:e.index_markdown,name:`INDEX.md`,title:i?`索引`:`Index`},{kind:`principles`,content:e.principles,name:`principles.md`,title:i?`原则`:`Principles`},{kind:`profile`,content:e.profile,name:`profile.md`,title:i?`个人概况(原私有范围)`:`Personal profile (private scope)`}].flatMap(t=>t.content?.trim()?[{kind:t.kind,content:t.content,id:`${t.kind}/${e.scope}/${e.vertical}/${e.root}`,title:t.title,description:``,path:`${e.root}/${t.name}`,scope:e.scope,vertical:e.vertical,updated:0,search:`${t.title} ${t.name}`}]:[]));return[...o,...s,...c].sort((e,t)=>t.updated-e.updated||e.id.localeCompare(t.id))}function pr({onOpen:e,compact:t=!1}){let{locale:n}=z();return(0,J.jsx)(`section`,{className:`shrink-0 ${t?`py-2`:`mx-2 py-1`}`,"data-learning-navigation":!0,children:lr.map(r=>{let i=ur[r],a=dr[n][r];return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>e(r),"aria-label":a,title:a,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-ink-dim hover:bg-bg hover:text-ink ${t?`justify-center`:``}`,children:[(0,J.jsx)(i,{size:16,"aria-hidden":`true`}),!t&&a]},r)})})}function mr({sid:e,initialScope:t=`feed`,initialSelection:n=null,projectNames:r={}}){let i=(0,G.useRef)(e);return(0,J.jsx)(hr,{sid:e,initialScope:t,initialSelection:i.current===e?n:null,projectNames:r},e??`no-project`)}function hr({sid:e,initialScope:t,initialSelection:n,projectNames:r}){let{locale:i}=z(),a=i===`zh-CN`,o=dr[i],[s,c]=(0,G.useState)(t),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(()=>n?n.kind===`skill`?`skill/${n.item.library}/${n.item.path}`:`knowledge/${n.item.scope}/${n.item.vertical}/${n.item.path}`:null),h=cr(e),g=ir(e),_=Kn(s===`feed`),v=fr(h.data,g.data,s,i),y=v.find(e=>e.id===p),b=y?.kind===`knowledge`?y.item:null,x=y?.kind===`skill`?y.item:null,S=A({queryKey:[`wiki-document`,e,b?.scope,b?.vertical,b?.path,b?.updated_at],queryFn:({signal:t})=>{if(!b)throw Error(`No knowledge document selected`);return R.wikiDocument(e,b.scope,b.vertical,b.path,t)},enabled:!!b}),C=A({queryKey:[`skill-document`,e,x?.library,x?.path,x?.updated_at],queryFn:({signal:t})=>{if(!x)throw Error(`No skill document selected`);return R.skillDocument(e,x.library,x.path,t)},enabled:!!x}),w=l.trim().toLocaleLowerCase(),T=v.filter(e=>(s!==`vertical`||!d||e.vertical===d)&&(!w||`${e.search} ${e.vertical}`.toLocaleLowerCase().includes(w))),E=[...new Set([...h.data?.verticals??[],...g.data?.verticals??[]])].sort(),D=e=>e.scope===`private`?a?`个人记录 · 原私有范围,不共享`:`Personal record · private, not shared`:`${o[e.scope]}${e.vertical?` · ${En(e.vertical,i)}`:``}`,O=e=>e.kind===`skill`?a?`技能`:`Skill`:e.kind===`knowledge`?ar[a?`zh`:`en`][or(e.item)]:e.kind===`principles`?a?`原则`:`Principles`:e.kind===`profile`?a?`个人概况`:`Profile`:a?`索引`:`Index`,k=x?C:S,j=x?Cn(x,i).guide:null,M=e=>{c(e),m(null),f(``)};return(0,J.jsxs)(`div`,{className:`flex h-[min(780px,84dvh)] min-h-0 flex-col`,"data-learning-library":!0,children:[(0,J.jsx)(lt,{title:a?`知识与技能`:`Knowledge and skills`,sub:a?`在一起查看学到的知识、可复用的方法和原始资料。`:`Explore learned knowledge, reusable methods and original sources together.`}),(0,J.jsx)(tr,{sid:e,onOpenKnowledge:()=>M(`feed`),onOpenSkills:()=>M(`feed`)}),(0,J.jsx)(`nav`,{"aria-label":a?`学习资源分类`:`Learning resource categories`,className:`flex shrink-0 overflow-x-auto border-b border-line/60 px-4`,children:lr.map(e=>(0,J.jsx)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>M(e),className:`shrink-0 border-b-2 px-3 py-2.5 text-sm ${s===e?`border-blue text-ink`:`border-transparent text-ink-faint hover:text-ink`}`,children:o[e]},e))}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,J.jsxs)(`aside`,{className:`${y?`hidden md:flex`:`flex`} min-h-0 w-full flex-col md:w-80 md:shrink-0 md:border-r md:border-line/60`,children:[(0,J.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,J.jsx)(`input`,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":a?`搜索知识与技能`:`Search knowledge and skills`,placeholder:a?`搜索知识与技能`:`Search knowledge and skills`,className:`w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink`}),s===`vertical`&&(0,J.jsxs)(`select`,{value:d,onChange:e=>{f(e.target.value),m(null)},"aria-label":a?`垂直领域`:`Vertical`,className:`w-full rounded-md border border-line bg-bg px-2 py-2 text-sm text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:a?`所有领域`:`All verticals`}),E.map(e=>(0,J.jsx)(`option`,{value:e,children:En(e,i)},e))]}),s===`feed`&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`学习记录与文件更新分开展示。文件变更不等于知识已验证。`:`Learning records and file updates are separate. An update does not prove knowledge is verified.`}),s===`global`&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`跨项目共享的知识和方法;个人记录保留原私有范围,不会被共享。`:`Shared knowledge and methods across projects. Personal records retain their private scope.`})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:[h.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`知识无法加载。`:`Knowledge could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void h.refetch(),children:a?`重试`:`Retry`})]}),g.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`技能无法加载。`:`Skills could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void g.refetch(),children:a?`重试`:`Retry`})]}),h.data?.errors.length||g.data?.errors.length?(0,J.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-err`,children:a?`部分资料无法读取;已加载的内容仍可查看。`:`Some sources could not be read; loaded material remains available.`}):null,s===`feed`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`学习记录`:`Learning records`}),_.isPending&&(0,J.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载学习记录…`:`Loading learning records…`}),_.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`学习记录无法加载。`:`Learning records could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void _.refetch(),children:a?`重试`:`Retry`})]}),_.data&&(0,J.jsx)(Qn,{events:_.data.events,items:h.data?.items??[],sid:e,projectNames:r,query:l,selected:b,onSelect:e=>{m(`knowledge/${e.scope}/${e.vertical}/${e.path}`)}}),(0,J.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`文件更新`:`File updates`})]}),(h.isPending||g.isPending)&&(0,J.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载资料…`:`Loading material…`}),!h.isPending&&!g.isPending&&!h.isError&&!g.isError&&!T.length&&(0,J.jsx)(`p`,{className:`p-3 text-sm text-ink-faint`,children:s===`project`&&!e?a?`选择一个项目以查看资料。`:`Select a project to see its material.`:a?`当前分类或筛选条件下没有资料。`:`No material matches this category or filter.`}),T.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>m(e.id),"aria-pressed":y?.id===e.id,className:`block w-full rounded-md px-3 py-3 text-left ${y?.id===e.id?`bg-blue/10`:`hover:bg-bg`}`,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,J.jsx)(`span`,{className:`shrink-0 rounded bg-line/60 px-1.5 text-[10px] text-ink-dim`,children:O(e)}),(0,J.jsx)(`span`,{className:`break-words text-sm font-medium text-ink`,children:e.title})]}),e.description&&(0,J.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs text-ink-dim`,children:e.description}),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:D(e)}),e.updated>0&&(0,J.jsx)(`time`,{className:`mt-1 block text-[11px] text-ink-faint`,dateTime:new Date(e.updated*1e3).toISOString(),children:new Date(e.updated*1e3).toLocaleString(i)})]},e.id))]})]}),(0,J.jsx)(`article`,{className:`${y?`block`:`hidden md:block`} min-w-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:y?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,className:`mb-4 text-sm text-blue md:hidden`,onClick:()=>m(null),children:a?`← 返回列表`:`← Back to the list`}),(0,J.jsx)(`h3`,{className:`break-words text-lg font-semibold text-ink`,children:y.title}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[O(y),` · `,D(y)]}),(0,J.jsx)(`p`,{className:`mt-1 break-all text-xs text-ink-faint`,children:y.path}),b&&(0,J.jsx)(er,{item:b}),x&&j&&(0,J.jsx)($n,{item:x,guide:j}),(0,J.jsx)(`div`,{className:`mt-5 border-t border-line/60 pt-5 text-sm text-ink`,children:y.kind===`knowledge`||y.kind===`skill`?(0,J.jsxs)(J.Fragment,{children:[k.isPending&&(0,J.jsx)(`p`,{children:a?`正在加载全文…`:`Loading document…`}),k.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-err`,children:[k.error.message,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void k.refetch(),children:a?`重试`:`Retry`})]}),b&&S.data?.truncated&&(0,J.jsx)(`p`,{role:`status`,className:`mb-3 text-xs text-ink-faint`,children:a?`页面过长,已截断显示。`:`Page shortened for display.`}),k.data&&(j?(0,J.jsxs)(`details`,{children:[(0,J.jsx)(`summary`,{className:`cursor-pointer py-2 text-blue`,children:a?`查看原始技能文档`:`Read the original skill`}),(0,J.jsx)(H,{children:k.data.content})]}):(0,J.jsx)(H,{children:k.data.content}))]}):(0,J.jsx)(H,{children:y.content})})]}):(0,J.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-ink-faint`,children:[(0,J.jsx)(K,{size:18,"aria-hidden":`true`}),a?`选择资料,阅读原文与使用条件。查看不会执行技能。`:`Select material to read its original and conditions. Reading does not execute a skill.`]})})]})]})}var gr=[{value:`copilot`,label:`settings.backendLabel.copilot`},{value:`codex`,label:`settings.backendLabel.codex`},{value:`claude`,label:`settings.backendLabel.claude`},{value:`cursor`,label:`settings.backendLabel.cursor`},{value:`opencode`,label:`settings.backendLabel.opencode`},{value:`pi`,label:`settings.backendLabel.pi`},{value:`grok`,label:`settings.backendLabel.grok`},{value:`qoder`,label:`settings.backendLabel.qoder`},{value:`dsh`,label:`settings.backendLabel.dsh`}],_r={copilot:`copilot`,codex:`codex`,claude:`claude`,cursor:`cursor`,opencode:`opencode`,pi:`pi`,grok:`grok`,qoder:`qoder`,dsh:`dsh`};function vr(e){return _r[e]??``}function yr(e,t){let n=vr(e);return n?t(`settings.backendLabel.${n}`):e}function br(e){return e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.value??e?.roles[0]?.backend??``}function xr(e){let t=e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.source??``;return t===`env`||t===`persisted`||t==="default"?t:``}function Sr(e){return(e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.saved??``).trim()}function Cr(e){return typeof e==`string`&&/^[\p{L}\p{N}_-][\p{L}\p{N}_.-]{0,127}$/u.test(e)}function wr(e){return e===void 0?{}:Cr(e)?{sessionId:e}:null}function Tr(e,t){return typeof e==`string`?e.trim().slice(0,t):``}function Er(e,t){return Tr(e,t*2).replace(/!?(?:\[([^\]]+)\])\([^)]+\)/g,`$1`).replace(/[*_`#]/g,``).replace(/\s+/g,` `).trim().slice(0,t)}function Dr(e){let t=Tr(e.completionId,300),n=wr(e.sessionId);if(!t||!n)return null;let r=Tr(e.path,1e3);return{...n,deliveryId:t,title:Er(e.title,240)||`已完成的任务`,summary:Er(e.summary,500),...r?{path:r}:{}}}function Or(e,t){let n=Tr(e.delivery_id,300),r=wr(t);return!n||!r?null:{...r,deliveryId:n,title:Tr(e.title,240)||`Argus`,summary:Tr(e.summary,1e3),...e.primary_target?.path?{path:Tr(e.primary_target.path,1e3)}:{}}}function kr(){return typeof window>`u`||window.parent===window?null:window.parent}function Ar(){return kr()!==null}function jr(){kr()?.postMessage({type:`argus:show-trial-setup`},`*`)}function Mr(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=Tr(t.deliveryId,300),r=wr(t.sessionId);if(!n||!r)return null;let i=Tr(t.path,1e3);return{...r,deliveryId:n,title:Tr(t.title,240)||`Argus`,summary:Tr(t.summary,1e3),...i?{path:i}:{}}}function Nr(e){let t=Mr(e),n=kr();return!t||!n?Promise.resolve(!1):(n.postMessage({type:`argus:notify-completion`,payload:t},`*`),Promise.resolve(!0))}function Pr(e){let t=kr();t&&t.postMessage({type:`argus:large-preview`,payload:e},`*`)}function Fr(e){let t=typeof window<`u`?window.location?.ancestorOrigins?.[0]:void 0;if(t&&t!==`null`)return e===t;if(typeof document<`u`&&document.referrer)try{let t=new URL(document.referrer);if(t.protocol===`http:`||t.protocol===`https:`)return e===t.origin;if(t.protocol===`tauri:`&&t.hostname===`localhost`)return e===`tauri://localhost`}catch{}return[`http://tauri.localhost`,`https://tauri.localhost`,`tauri://localhost`].includes(e)}function Ir(e){let t=kr();if(!t)return()=>void 0;let n=n=>{if(n.source!==t||!Fr(n.origin)||n.data?.type!==`argus:open-delivery`)return;let r=Mr(n.data.payload);r&&e(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function Lr(e){let t=kr();if(!t)return()=>void 0;let n=n=>{n.source===t&&n.data?.type===`argus:new-chat`&&e()};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function Rr(){if(typeof document>`u`)return()=>void 0;let e=kr();if(!e)return()=>void 0;let t=t=>{if(t.defaultPrevented||t.button!==0&&t.button!==1)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null;if(!n)return;let r;try{r=new URL(n.href,window.location.href)}catch{return}r.origin===window.location.origin||![`http:`,`https:`].includes(r.protocol)||(t.preventDefault(),e.postMessage({type:`argus:open-external`,payload:r.toString()},`*`))},n=t=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.shiftKey||!(t.ctrlKey||t.metaKey))return;let n=t.key===`,`?`argus:show-setup`:t.key.toLowerCase()===`n`?`argus:request-new-chat`:null;n&&(t.preventDefault(),e.postMessage({type:n},`*`))},r=()=>e.postMessage({type:`argus:cockpit-interaction`},`*`);return document.addEventListener(`click`,t,!0),document.addEventListener(`auxclick`,t,!0),window.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r,{passive:!0}),()=>{document.removeEventListener(`click`,t,!0),document.removeEventListener(`auxclick`,t,!0),window.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}}var zr=21600,Br=e=>!e||[`auto`,`inherit`,`default`].includes(e.toLowerCase());function Vr({sid:e,roles:t,running:n,lastCall:r,onOpenSettings:i}){let{locale:a,t:o}=z(),{data:s}=Me(e,!0),c=a===`zh-CN`,l=(n?t.find(e=>e.active):void 0)??t.find(e=>e.role===`manager`),u=s?.trial_mode===!0,d=!!r&&(n||Date.now()/1e3-(r.ts||0)e.role===f.role):void 0,_=g&&g.backend&&g.backend!==f?.backend?g.backend:``,v=g&&!Br(g.model)&&g.model!==f?.model?g.model:``,y=_||v?[yr(_||g.backend,o),v||g.model||`auto`].join(` · `):``,b=(0,J.jsxs)(J.Fragment,{children:[u?c?`试用`:`Trial`:p?yr(p,o):c?`模型信息待确认`:`Model information unavailable`,m?` · ${m}`:``,h?` · ${h}`:``,!u&&!f&&n&&l?.active?` · ${gt(l.role)?Ve(l.role,o):l.role}`:``]}),x=f?c?`最近一次模型调用实际使用的后端、模型和推理强度;点击更改`:`Backend, model and effort the latest model call actually used; click to change`:c?`当前配置的后端与模型;点击更改`:`Configured backend and model; click to change`;return(0,J.jsxs)(`div`,{className:`composer-runtime`,"aria-label":c?`当前后端与模型`:`Current backend and model`,children:[i&&!u?(0,J.jsxs)(`button`,{type:`button`,className:`composer-runtime-model`,onClick:i,title:x,"data-runtime-open-settings":!0,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}):(0,J.jsxs)(`span`,{className:`composer-runtime-model`,title:u?void 0:x,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}),(0,J.jsxs)(`details`,{className:`composer-runtime-details`,children:[(0,J.jsx)(`summary`,{children:c?`运行信息`:`Runtime details`}),(0,J.jsx)(`div`,{children:b})]}),y?(0,J.jsx)(`span`,{className:`composer-runtime-next`,"data-runtime-next":!0,children:c?`下次使用:${y}`:`next call: ${y}`}):null,u&&Ar()?(0,J.jsx)(`button`,{type:`button`,onClick:jr,children:c?`更换 Key`:`Change Key`}):null]})}function Hr({session:e}){let{locale:t}=z(),n=t===`zh-CN`,r=n?`会话目录`:`Session directory`,i=e.workdir||e.cwd||(n?`待确认`:`Pending confirmation`);return(0,J.jsxs)(`details`,{className:`session-workdir`,"data-session-workdir":!0,children:[(0,J.jsxs)(`summary`,{title:`${r}: ${i}`,"aria-label":`${r}: ${i}`,children:[(0,J.jsx)(`span`,{children:r}),(0,J.jsx)(`code`,{children:i})]}),(0,J.jsxs)(`div`,{className:`session-workdir__detail`,children:[(0,J.jsx)(`strong`,{children:r}),(0,J.jsx)(`code`,{children:i}),(0,J.jsx)(`p`,{children:n?`来自已加载会话快照的工作目录;不是每个任务的实际 cwd,也不是安全沙箱边界。`:`Working directory from the loaded session snapshot; not each task’s actual cwd or a security sandbox boundary.`})]})]})}function Ur(e){return!Number.isFinite(e)||e<=0?`$0.00`:e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(3)}`}function Wr({settledUsd:e,knownUsd:t=0,status:n=`empty`}){let r=typeof e==`number`&&Number.isFinite(e)?e:t,i=n===`partial`||n===`unpriced`;return`${Ur(Math.max(0,r||0))}${i?`+`:``}`}function Gr({settledUsd:e,knownUsd:t,status:n,calls:r=0,premiumRequests:i=0,live:a=!1,compact:o=!1}){let s=Wr({settledUsd:e,knownUsd:t,status:n}),c=[`Cumulative settled project spend`,`${r} model call${r===1?``:`s`}`,i>0?`${i.toFixed(1)} premium requests`:``,n&&n!==`empty`?`pricing: ${n}`:``].filter(Boolean).join(` · `);return(0,J.jsxs)(`span`,{title:c,"aria-label":`Project spend ${s}`,className:`inline-flex shrink-0 items-center rounded-full border border-gold/25 bg-gold/8 font-mono tabular-nums text-gold ${o?`h-6 gap-1 px-2 text-[10px]`:`h-5 gap-1 px-1.5 text-[9px]`}`,children:[a?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-gold/80`}):null,(0,J.jsx)(`span`,{children:s})]})}var Kr=e=>String(e??``).trim(),qr=/^[a-z][a-z -]+ requires an operator-owned decision before continuing\.?$/i,Jr=e=>{let t=Kr(e);return qr.test(t)?``:t},Yr=(e,t)=>{let n=/[\u3400-\u9fff]/.test(`${e}\n${t}`);return{id:`custom`,label:n?`自己输入`:`Write my own answer`,description:n?`直接告诉 Argus 你的决定。`:`Tell Argus your decision directly.`,requires_note:!0}};function Xr(e,t,n){let r=[...e,...t],i=new Map(t.map(e=>[Kr(e.id),e])),a=(e,t)=>{let n=i.get(e)??(Kr(t.id)===e?t:void 0);return{task_title:Kr(n?.title)||void 0,task_status:Kr(n?.status)||void 0}},o=[],s=new Set;for(let e of r){let t=Kr(e.id),n=e.operator_decision;if(n&&typeof n==`object`&&!Array.isArray(n)){let r=n,i=Kr(r.id);if(!i||s.has(i)||Kr(r.status)!==`pending`)continue;s.add(i);let c=Kr(r.options_source),l=r.kind===`domain_intake`,u=(c===`agent`||l&&c===`workflow`)&&Array.isArray(r.options)?r.options.filter(e=>!!Kr(e?.id)&&!!Kr(e?.label)).map(e=>({...e,requires_note:e.requires_note===!0})):[];u.some(e=>e.id===`custom`)||u.push(Yr(Kr(r.title),Kr(r.question)));let d=Kr(r.item_id)||t;o.push({id:i,...l?{kind:`domain_intake`}:{},item_id:d,revision:Number(r.revision??1),status:`pending`,title:Kr(r.title)||Kr(e.title)||`Decision required`,reason:Jr(r.reason),question:Kr(r.question)||Kr(e.pending_question),evidence:Array.isArray(r.evidence)?r.evidence.filter(e=>Kr(e?.label)!==`Acceptance check`):[],options:u,options_source:l?`workflow`:u.length?`agent`:`none`,selected_option:``,note:``,...a(d,e),...l?{task_title:Kr(r.task_title),task_status:void 0}:{},...typeof r.asked_at==`number`&&Number.isFinite(r.asked_at)&&r.asked_at>0?{asked_at:r.asked_at}:{}});continue}let r=Kr(e.pending_question??e.question??e.text);if(!t||!r)continue;let i=`legacy-${t}`;s.has(i)||(s.add(i),o.push({id:i,item_id:t,revision:1,status:`pending`,title:Kr(e.title??e.objective)||`Blocked task`,reason:``,question:r,evidence:[],options:[Yr(Kr(e.title??e.objective),r)],options_source:`none`,selected_option:``,note:``,legacy:!0,...a(t,e)}))}if(!n)return o;let c=o.map(e=>({...e,is_current_task:e.kind===`domain_intake`?void 0:e.item_id===n}));return[...c.filter(e=>e.kind===`domain_intake`),...c.filter(e=>e.is_current_task),...c.filter(e=>e.kind!==`domain_intake`&&!e.is_current_task)]}function Zr(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function Qr(e,t,n=``){let r=Zr(n,70);switch(e){case`manager`:return t?`正在整理任务进展`:`Summarizing progress`;case`planner`:return t?`正在安排接下来要做的事`:`Planning what to do next`;case`reviewer`:return r?t?`正在检查结果:${r}`:`Checking the result: ${r}`:t?`正在检查结果是否正确`:`Checking whether the result is correct`;default:return r?t?`正在处理:${r}`:`Working on: ${r}`:t?`正在处理当前任务`:`Working on the current task`}}var $r=new Set([`running`,`in_progress`,`claimed`,`active`,`working`,`grounding`,`framed`]),ei=new Set([`complete`,`completed`,`done`,`success`,`ended`]),ti=new Set([`paused`,`stopped`,`cancelled`,`aborted`,`incomplete`,`blocked`,`stalled`]),ni=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:null;function ri(e){return String(e.item_id||e.mission_id||``).split(`:attempt:`)[0]}function ii(e,t,n){let r=e?.backlog?.find(e=>e.id===n),i=Date.parse(e?.daemon.started_at_iso||``)/1e3;return Math.max(t?.mission.id===n&&t.mission.started_at||0,r?.started_ts||0,Number.isFinite(i)?i:0)}function ai(e,t=0){let n=new Map;for(let r of e){if(Number(r.ts||0)oi.has(String(e.type||``))&&ri(e)===t.id&&Number(e.ts||0)>=r);e?.type===`round.external_work_wait.started`&&(i=String(e.work_id||``)),a=e?.type===`round.external_work_wait.completed`}else return null;if(a)return null;let o=(e.background_work||[]).find(e=>i&&e.work_id===i||e.waited_by?.includes(t.id));return o?{workId:o.work_id,parts:(o.parts||[]).map(e=>({role:e.role,done:e.done,total:e.total,running:e.running})),done:o.done,total:o.total,lastProgressAt:ni(o.last_progress_ts)}:i?{workId:i,parts:[],done:0,total:0,lastProgressAt:null}:null}function ci(e,t,n=[],r=Date.now()/1e3){let i=t?.mission.id||e?.backlog?.find(e=>$r.has(e.status)||e.status===`paused_external_work`)?.id||``,a=e?.backlog?.find(e=>e.id===i),o=ii(e,t,i),s=e?.roles?.filter(e=>e.active)||[],c=(e?.backlog?.filter(e=>$r.has(e.status)).length||0)>1,l=new Map;for(let e of t?.role_work||[])i&&(e.item_id||e.mission_id)!==i||e.ts$r.has(e.status)).sort((e,t)=>t.ts-e.ts).find(e=>s.some(t=>t.role===e.role))?.role||(c?``:(s.find(e=>e.role===t?.active_role)||s[0])?.role)||(e?``:t?.roles.find(e=>e.status===`active`)?.role)||``,d=n.filter(e=>{let t=ri(e);return(!i||t===i)&&Number(e.ts||0)>=o&&!String(e.run_label||``).startsWith(`map-summary`)&&/(?:progress|round\.(?:main|review)|life\.(?:mission|phase)|work\.segment)/.test(String(e.type||``))}).map(e=>ni(e.ts));for(let e of t?.role_work||[]){let t=e.item_id||e.mission_id;(!i||t===i)&&e.ts>=o&&e.kind!==`waiting`&&![`waiting`,`idle`].includes(e.status)&&d.push(ni(e.ts))}let f=d.filter(e=>e!==null&&e<=r+5),p=f.length?Math.max(...f):null,m={state:`idle`,role:u,taskId:i,title:t?.mission.title||a?.title||t?.mission.objective||``,activityAt:p,activityAgeSeconds:p===null?null:Math.max(0,r-p),reason:``};if(!e||e.daemon.read_status===`error`)return{...m,state:`unknown`};if(e.manager_requests?.some(e=>e.status===`running`)??!1){let e=ni(ai(n)?.ts)??p;return{...m,state:`running`,role:`manager`,foreground:!0,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}if(!i){let e=[...n].reverse().find(e=>e.type===`ui.argus`&&e.mission_result===!0&&!e.item_id&&e.live!==!0);if(e){let t=ni(e.ts);return{...m,state:`step_finished`,activityAt:t,activityAgeSeconds:t===null?null:Math.max(0,r-t),reason:e.success===!1?`task_failed`:``}}}let h=si(e,a,n,o);if(h){let e=h.lastProgressAt??p;return{...m,state:`waiting`,role:``,reason:`background_work`,waitingOn:h,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}let g=String(a?.status||t?.mission.status||``).toLowerCase();if(ti.has(g)||g.startsWith(`paused_`)||g===`research_incomplete`){let t=Xr(e.pending_questions??[],e.backlog.map(e=>({...e})),i).some(e=>e.item_id===i);return{...m,state:`paused`,role:``,reason:t?`operator_input`:`not_running`}}if([`failed`,`error`].includes(g))return{...m,state:`step_finished`,role:``,reason:`task_failed`};if(ei.has(g))return e.daemon.alive&&s.some(e=>e.role===`planner`)?{...m,state:`running`,role:`planner`}:{...m,role:``,state:e.daemon.alive&&(t?.routing?.continuous||e.continuous?.enabled)?`waiting`:`step_finished`};if(!e.daemon.alive)return $r.has(g)?{...m,state:`paused`,role:``,reason:`not_running`}:{...m,role:``};let _=[...n].reverse().find(e=>e.type===`round.backend_failure.backoff`&&Number(e.ts||0)>=o&&(!i||ri(e)===i));return _&&Number(_.ts||0)+Number(_.seconds||0)>r&&Number(_.ts||0)>=(p||0)?{...m,state:`waiting`,reason:`provider_wait`}:e.daemon.health?.stalled?{...m,state:`waiting`,reason:`no_recent_progress`}:u?{...m,state:`running`}:c&&s.length>0&&i?{...m,state:`unknown`}:{...m,state:`waiting`,reason:`awaiting_next_step`}}function li(e,t){let n=t===`zh-CN`;return e===null?``:e<60?n?`刚刚`:`just now`:e<3600?n?`${Math.floor(e/60)} 分钟前`:`${Math.floor(e/60)} min ago`:n?`${Math.floor(e/3600)} 小时前`:`${Math.floor(e/3600)} hr ago`}var ui={"idea-route":[`条研究路线`,[`research route`,`research routes`]],"idea-review":[`次独立复核`,[`independent review`,`independent reviews`]],"idea-selector":[`次方案选择`,[`idea selection`,`idea selections`]]};function di(e,t){if(!e.total)return``;let[n,[r,i]]=ui[e.role]??[`项子任务`,[`subtask`,`subtasks`]],a=e.total===1?r:i;return e.done===e.total?t?`${e.total} ${n}全部完成`:`all ${e.total} ${a} done`:t?`${e.total} ${n}中 ${e.done} ${n.slice(0,1)}完成`:`${e.done} of ${e.total} ${a} done`}function fi(e,t){let n=t===`zh-CN`,r=e.waitingOn,i=(r?.parts??[]).map(e=>di(e,n)).filter(Boolean),a=i.length?i.join(n?`、`:`, `):r?.total?n?`${r.total} 项子任务中 ${r.done} 项完成`:`${r.done} of ${r.total} subtasks done`:``,o=li(e.activityAgeSeconds,t),s=o?n?o===`刚刚`?`,最近一次进展就在刚刚`:`,最近一次进展在 ${o}`:`, last progress ${o}`:``;return a?n?`正在等待后台团队:${a}${s}`:`Waiting for the background team: ${a}${s}`:n?`正在等待后台团队完成工作${s}`:`Waiting for the background team to finish${s}`}function pi(e,t,n=!0){let r=t===`zh-CN`;return n?e.reason===`operator_input`?r?`当前任务等待你的回复`:`This task is waiting for your reply`:e.reason===`task_failed`?r?`这一步执行未完成`:`Execution of this step did not finish`:e.reason===`background_work`?fi(e,t):e.state===`running`?e.foreground?r?`正在处理你的请求`:`Working on your request`:Qr(e.role,r,e.title):e.reason===`provider_wait`?r?`模型服务暂时未能完成请求,等待后会重试`:`The model service could not complete the request; waiting before retrying`:e.reason===`no_recent_progress`?r?`暂时没有收到新的进展`:`No new progress received recently`:{running:[`正在处理当前任务`,`Working on the current task`],waiting:[`等待下一步工作`,`Waiting for the next step`],paused:[`当前任务未在运行`,`The current task is not running`],step_finished:[`这一步已结束`,`This step has ended`],idle:[`可以开始新任务`,`Ready for a new task`],unknown:[`暂时无法确认任务进度`,`Unable to confirm task progress right now`]}[e.state][+!r]:r?`实时连接已断开`:`Live connection lost`}var mi=new Set([`grounding`,`task`,`decision`,`agent_message`,`assistant_message`,`command_execution`,`tool_use`,`tool_result`,`handoff`,`review`,`verdict`,`completion`,`plan`,`file_change`,`result`]),hi=/^(using a tool|running project command|inspecting project state|working|reporting progress|暂无详细记录)$/i;function gi(e){let t=pe(e).replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/gim,``).trim();return hi.test(t)||t.startsWith(`{`)?``:t}function _i(e,t,n=``){if(n){if(/^(?:rg|grep|glob|search)$/.test(n))return t?`检索项目文件`:`Searching project files`;if(/^(?:view|read|read_file)$/.test(n))return t?`读取文件`:`Reading a file`;if(/apply_patch|edit|write/.test(n))return t?`编辑文件`:`Editing a file`;if(/bash|shell|exec|terminal/.test(n))return t?`运行终端命令`:`Running a command`;if(/playwright|browser/.test(n))return t?`检查浏览器交互`:`Checking browser interactions`}return({grounding:[`理解任务与检查项目`,`Understanding the task`],task:[`安排任务`,`Task assignment`],decision:[`确定执行方案`,`Execution decision`],plan:[`制定执行计划`,`Planning the work`],agent_message:[`更新执行进度`,`Progress update`],assistant_message:[`更新执行进度`,`Progress update`],command_execution:[`运行项目命令`,`Running a project command`],tool_use:[`使用工具`,`Using a tool`],tool_result:[`工具输出`,`Tool output`],file_change:[`更新项目文件`,`Updating project files`],handoff:[`整理结果与后续工作`,`Summarizing results and next steps`],review:[`检查实现与结果`,`Checking implementation and results`],verdict:[`说明检查结果`,`Explaining the check result`],completion:[`完成任务`,`Task completed`],result:[`产出结果`,`Result`]}[e]??[`处理当前任务`,`Working on the current task`])[+!t]}function vi(e,t,n,r=0){let i=new Map;for(let a of e?.role_work??[]){if(a.role!==t||!mi.has(a.kind)||a.tst.ts-e.ts)}function yi(e,t,n,r=0){return[...e].reverse().find(e=>e.type===`engineer.progress`&&Number(e.ts||0)>=r&&[`tool_use`,`command_execution`,`file_change`].includes(String(e.kind))&&String(e.agent_layer||e.actor||e.role)===t&&(!n||String(e.item_id||e.mission_id)===n))}function bi(e,t,n,r,i){return r||[`done`,`completed`,`failed`,`aborted`,`stopped`].includes(e?.mission.status??``)||i&&e?.mission.id!==i?!1:t.length?t.some(e=>e.role===n&&e.active):e?.active_role===n&&[`working`,`grounding`,`framed`,`running`].includes(e?.mission.status??``)}function xi(e,t){let n=Math.max(0,Math.floor(e));if(n<30)return``;let[r,i,a]=n<60?[n,`秒`,`s`]:n<3600?[Math.floor(n/60),`分钟`,`m`]:n<86400?[Math.floor(n/3600),`小时`,`h`]:[Math.floor(n/86400),`天`,`d`];return t?`上次更新 ${r} ${i}前`:`last update ${r}${a} ago`}function Si(e,t,n,r,i=!0,a=0){let o=pi(e,r,i);if(!i||e.state!==`running`||e.foreground||!e.taskId||!e.role)return o;let s=Math.max(a,t?.mission.id===e.taskId&&t.mission.started_at||0),c=vi(t,e.role,e.taskId,s).find(e=>e.detail&&[`agent_message`,`assistant_message`].includes(e.kind)||[`tool_use`,`command_execution`,`file_change`].includes(e.kind)),l=yi(n,e.role,e.taskId,s);if(c?.detail&&[`agent_message`,`assistant_message`].includes(c.kind)&&(!l||Number(l.ts||0)=c.ts)){let t=_i(String(l.kind),r===`zh-CN`,String(l.tool_name||``));return e.title?`${t}${r===`zh-CN`?`:`:`: `}${Zr(e.title,70)}`:t}return c&&[`tool_use`,`command_execution`,`file_change`].includes(c.kind)?_i(c.kind,r===`zh-CN`):o}var Ci=new Set([`running`,`in_progress`,`claimed`]);function wi({snap:e,streamOk:t,onStart:n,onStop:r,onManage:i,onOpenSessions:a,mobileView:s,onToggleMobileView:c,busy:u,snapshotStale:d=!1,readOnly:f=!1,missionView:p,events:m=[]}){let{t:h,locale:g}=z(),_=ci(e,p,m),v=Si(_,p,m,g,t,ii(e,p,_.taskId)),y=[`complete`,`completed`,`done`,`success`].includes(String(p?.mission.status||``).toLowerCase()),b=_.role||`manager`,x=_.state===`running`&&t&&!d,S=e.backlog.find(e=>Ci.has(e.status)),C=_.title||S?.title||S?.objective||(y?p?.mission.summary||p?.mission.title:``)||e.session.objective||``,w=!!(e.partial||e.observability?.slo.status===`degraded`),T=typeof e.spend_usd==`number`?e.spend_usd:e.usage_summary?.known_cost_usd??0,E=e.daemon.alive&&e.daemon.control_available===!1,O=!e.daemon.alive&&[`running`,`waiting`].includes(ci(e,p,m).state),k=E?h(`topbar.externallyManaged`):e.daemon.alive?h(`topbar.pauseDaemon`):h(O?`topbar.working`:`topbar.runDaemon`),A=w?[...(e.diagnostics??[]).map(e=>`${e.section}: ${e.message}`),...e.observability?.slo.violations??[]].join(` +`)||h(`common.degraded`):h(d?`common.stale`:t?`common.live`:`common.reconnecting`);return(0,J.jsxs)(mt,{children:[a?(0,J.jsx)(`button`,{type:`button`,onClick:a,"aria-label":h(`topbar.openSessions`),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-ink-faint hover:bg-bg hover:text-ink lg:hidden`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M2.5 4h11M2.5 8h11M2.5 12h11`})})}):null,(0,J.jsxs)(`div`,{className:`topbar-heading flex min-w-0 flex-1 flex-col justify-center gap-0.5`,children:[(0,J.jsx)(`div`,{className:`topbar-title min-w-0 truncate text-sm font-semibold text-ink`,title:e.session.display_name||e.session.id,children:e.session.display_name||e.session.id}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[x?(0,J.jsx)(`span`,{"data-role-dot":b,"aria-label":h(`topbar.roleActive`,{role:zn(b,h)}),className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:B.role[b]||`rgb(var(--ink-faint))`}}):null,x||C?(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-ink-dim`,title:v,children:t?d?h(`common.stale`):v:h(`common.reconnecting`)}):null,(0,J.jsx)(Hr,{session:e.session})]})]}),(0,J.jsx)(`span`,{title:A,className:`h-2 w-2 shrink-0 rounded-full transition-shadow duration-150 ${w||d?`bg-err ring-1 ring-err/30 ring-offset-1 ring-offset-panel`:t?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,children:(0,J.jsx)(`span`,{className:`sr-only`,children:A})}),T>0?(0,J.jsx)(Gr,{settledUsd:e.spend_usd,knownUsd:e.usage_summary?.known_cost_usd,status:e.spend_status,calls:e.usage_summary?.call_count,premiumRequests:e.usage_summary?.premium_requests,live:e.daemon.alive,compact:!0}):null,c?(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":h(s===`activity`?`topbar.showPreview`:`topbar.showActivity`),title:h(s===`activity`?`topbar.showPreview`:`topbar.showActivity`),className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center lg:hidden`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:s===`activity`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`11`,rx:`1.5`}),(0,J.jsx)(`path`,{d:`M9.5 2.75v10.5`})]}):(0,J.jsx)(`path`,{d:`M3 4h10M3 8h10M3 12h7`})})}):null,f?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,disabled:u||E||O,onClick:e.daemon.alive?r:n,"aria-label":k,title:E?h(`topbar.externalDaemonHint`):k,className:`compact-control flex h-8 shrink-0 items-center gap-1 px-2 disabled:opacity-40`,children:[(0,J.jsx)(o,{icon:e.daemon.alive?l:D,className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:E?h(`common.external`):e.daemon.alive?h(`common.pause`):h(O?`common.working`:`common.run`)})]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":h(`topbar.manageSession`),title:h(`topbar.manageSession`),onClick:i,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center text-sm tracking-widest`,children:`···`})]})]})}var Ti=new Set([`running`,`in_progress`,`claimed`]);function Ei(e,t){let n;for(let r of t)r.item_id!==e.id||![`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.mission.orphaned`].includes(r.type)||(!n||r.ts>=n.ts)&&(n=r);if(n?.type===`life.mission.completed`&&!(n.ts(t.status===`done`||Ti.has(t.status))&&(t.ts??0)>e?t.ts??0:e,0)}function Oi(e,t){return e.status===`failed`&&!e.pending_question&&(e.ts??0)t.status!==`done`&&!Ti.has(t.status)&&(t.pending_question||t.status===`failed`&&!Oi(t,e))).sort((e,t)=>Number(!!t.pending_question)-Number(!!e.pending_question))}function Ai(e){return e.find(e=>Ti.has(e.status))??ki(e)[0]??e.find(e=>e.status===`pending`)??e.at(-1)}function ji(e,t){let n=new Set,r=new Set;for(let i of e.links)i.kind===`dependency`&&(i.target===t&&n.add(i.source),i.source===t&&r.add(i.target));return{upstream:e.tasks.filter(e=>n.has(e.id)),downstream:e.tasks.filter(e=>r.has(e.id))}}function Mi(e){return e.status===`cancelled`?`aborted`:e.pending_question?`question`:Ti.has(e.status)?`running`:e.outcome?.review_status===`unavailable`?`review_unavailable`:e.status===`failed`&&Ni(e)?`held`:e.status.startsWith(`paused`)||e.status===`blocked`?`paused`:[`done`,`failed`,`aborted`,`skipped`,`superseded`,`pending`,`missing`].includes(e.status)?e.status:`unknown`}function Ni(e){return e.outcome?.stage_certification===`not_certified`||!e.outcome?.execution_status&&/^manager stage hold:/i.test(e.last_error||``)}function Pi(e,t){let n=e=>t.some(t=>t.type===`life.mission.started`&&t.ts>e);return e.filter(e=>e.status===`done`&&e.outcome?.review_status===`done`&&e.outcome.stage_certification===`certified`).map(e=>({task:e,completion:Ei(e,t)})).filter(({completion:e})=>e?.overall_complete===!0&&!n(e.ts)).map(({task:e})=>e).sort((e,t)=>(t.finished_ts??t.ts??0)-(e.finished_ts??e.ts??0))[0]}function Fi(e){let t=new Set,n=[],r=new Map([...e.keys()].map(e=>[e,[]]));for(let[t,n]of e)for(let e of n)r.get(e).push(t);for(let r of e.keys()){let i=[[r,!1]];for(;i.length;){let[r,a]=i.pop();if(a)n.push(r);else if(!t.has(r)){t.add(r),i.push([r,!0]);for(let n of e.get(r))t.has(n)||i.push([n,!1])}}}let i=new Map;for(let e of n.reverse()){if(i.has(e))continue;let t=i.size,n=[e];for(;n.length;){let e=n.pop();if(!i.has(e)){i.set(e,t);for(let t of r.get(e))n.push(t)}}}return i}function Ii(e){let t=new Map(e.map(e=>[e.id,e])),n=[...t.values()].sort((e,t)=>(e.ts??0)-(t.ts??0)||e.id.localeCompare(t.id)),r=[],i=new Set;for(let e of n)for(let n of new Set(e.deps??[]))t.has(n)||i.add(n),r.push({id:JSON.stringify([`dep`,n,e.id]),source:n,target:e.id,kind:`dependency`,missing:!t.has(n)});let a=[...[...i].map(e=>({id:e,title:`未包含的依赖`,objective:`该引用不在当前数据范围内。`,status:`missing`,deps:[],role:`system`})),...n],o=new Map(a.map(e=>[e.id,0])),s=new Map(a.map(e=>[e.id,[]]));r.forEach(e=>{o.set(e.target,(o.get(e.target)??0)+1),s.get(e.source)?.push(e.target)});let c=a.filter(e=>o.get(e.id)===0).map(e=>e.id),l=0;for(let e=0;et.id!==e.id&&t.plan_id===e.superseded_by_plan_id);t.length&&r.push({id:JSON.stringify([`replacement`,e.id,e.superseded_by_plan_id]),source:e.id,target:t[0].id,kind:`replacement`,target_plan_id:e.superseded_by_plan_id,target_count:t.length})}if(u){let e=Fi(s);r.filter(t=>t.kind===`dependency`&&e.get(t.source)===e.get(t.target)).forEach(e=>{e.cycle=!0})}return{tasks:a,links:r,missing:i.size,cyclic:u}}function Li(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function Ri(e){return e?.match(/route[-_ ]?(\d+)/i)?.[1]??e?.match(/(\d+)\s*$/)?.[1]??``}function zi(e,t){if(!e)return``;if(e.kind===`review`)return e.verdict===`rejected`?t?`复核:驳回`:`Review: rejected`:e.verdict===`qualified`?t?`复核:通过`:`Review: qualified`:``;if(e.kind===`route`)return e.selected?t?`通过 · 被选中`:`Qualified · chosen`:e.verdict===`rejected`?t?`驳回`:`Rejected`:e.verdict===`qualified`?e.selected===!1?t?`通过 · 未选中`:`Qualified · not chosen`:t?`通过`:`Qualified`:``;let n=Ri(e.selected_route);return n?t?`已选研究路线 ${n}`:`Chose route ${n}`:``}function Bi(e){return e?e.kind===`selection`?e.selected_route?`chosen`:``:e.selected?`chosen`:e.verdict??``:``}function Vi(e){let t=String(e||``).split(/\r?\n/).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY|NEXT_ACTION)\s*=\s*/i,``).trim()).filter(e=>e&&!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e)).join(` `);return t.length>160?`${t.slice(0,159)}…`:t}function Hi(e){let t=new Map;for(let n of e){if(n.type!==`idea.portfolio.formed`)continue;let e=Number(n.width);if(!Number.isInteger(e)||e<=0)continue;let r=t.get(n.item_id);(!r||n.ts>=r.ts)&&t.set(n.item_id,{ts:n.ts,width:e})}return new Map([...t].map(([e,t])=>[e,t.width]))}function Ui(e,t,n,r=16){let i=new Map;for(let e of t){if(e.type!==`team.task`||!e.item_id)continue;let t=i.get(e.item_id)??new Map;t.set(e.id,e),i.set(e.item_id,t)}if(!i.size)return e;let a=new Set(e.tasks.map(e=>e.id)),o=[],s=[];for(let t of e.tasks){if(t.branch)continue;let e=[...i.get(t.id)?.values()??[]].filter(e=>!a.has(e.id)).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));if(!e.length)continue;let c=e.slice(0,r),l=new Set(c.map(e=>e.id));for(let e of c)a.add(e.id),o.push({id:e.id,title:Li(e,n),objective:Vi(e.text),excerpt:Vi(e.text),status:e.status||`unknown`,deps:[],pending_question:e.pending_question,role:`team`,team_role:e.team_role,...e.team_outcome?{team_outcome:e.team_outcome}:{},ts:e.ts,branch:!0,parent_id:t.id});let u=new Set(c.flatMap(e=>(e.deps??[]).filter(t=>l.has(t)&&t!==e.id)));for(let e of c){let n=[...new Set(e.deps??[])].filter(t=>l.has(t)&&t!==e.id);if(n.length)for(let t of n)s.push({id:JSON.stringify([`fanout`,t,e.id]),source:t,target:e.id,kind:`fanout`});else s.push({id:JSON.stringify([`fanout`,t.id,e.id]),source:t.id,target:e.id,kind:`fanout`});u.has(e.id)||s.push({id:JSON.stringify([`fanin`,e.id,t.id]),source:e.id,target:t.id,kind:`fanin`})}let d=e.length-c.length,f=`team-overflow:${t.id}`;d>0&&!a.has(f)&&(a.add(f),o.push({id:f,title:n?`还有 ${d} 条`:`+${d} more`,objective:n?`更多并行子任务收录在所属任务卡片中。`:`The remaining parallel subtasks live inside the owning card.`,status:`recorded`,deps:[],role:`team`,ts:e[r]?.ts,branch:!0,parent_id:t.id,overflow_count:d}),s.push({id:JSON.stringify([`fanout`,t.id,f]),source:t.id,target:f,kind:`fanout`},{id:JSON.stringify([`fanin`,f,t.id]),source:f,target:t.id,kind:`fanin`}))}return o.length?{...e,tasks:[...e.tasks,...o],links:[...e.links,...s]}:e}var Wi={"idea-route":[e=>`${e} 条研究路线`,e=>`${e} research route${e===1?``:`s`}`],"idea-review":[e=>`${e} 次独立复核`,e=>`${e} independent review${e===1?``:`s`}`],"idea-selector":[e=>`${e} 次方案选择`,e=>`${e} idea selection${e===1?``:`s`}`]},Gi=[e=>`${e} 个并行子任务`,e=>`${e} parallel subtask${e===1?``:`s`}`],Ki={pending:[`尚未开始`,`have not started`],running:[`正在进行`,`are under way`],done:[`已经完成`,`are complete`],failed:[`没有完成`,`did not finish`],question:[`在等待答复`,`are waiting for an answer`],paused:[`已暂停`,`are paused`],superseded:[`已被新计划替代`,`were replaced by a new plan`],aborted:[`已取消`,`were cancelled`],skipped:[`已跳过`,`were skipped`]};function qi(e,t,n){let r=e.map(({role:e,count:t})=>(Wi[e]??Gi)[+!n](t)),i=n?r.length>1?`${r.slice(0,-1).join(`、`)}与 ${r[r.length-1]}`:r[0]:r.length>1?`${r.slice(0,-1).join(`, `)} and ${r[r.length-1]}`:r[0],a=(Ki[t]??[`已记录在案`,`are on record`])[+!n];return n?`${i}${a}`:`${i} ${a}`}function Ji(e,t){let n=e.filter(e=>e.team_outcome?.kind===`route`),r=n.filter(e=>e.team_outcome?.selected).map(e=>Ri(e.title)),i=n.filter(e=>e.team_outcome?.verdict===`rejected`&&!e.team_outcome.selected).map(e=>Ri(e.title)),a=n.filter(e=>e.team_outcome?.verdict===`qualified`&&!e.team_outcome.selected).map(e=>Ri(e.title)),o=[],s=e=>[...e].sort().join(t?`、`:`, `);return r.length&&o.push(t?`路线 ${s(r)} 通过并被选中`:`route ${s(r)} qualified and chosen`),a.length&&o.push(t?`路线 ${s(a)} 通过${r.length?`但未被选中`:`,等待选择`}`:`route${a.length>1?`s`:``} ${s(a)} qualified${r.length?` but not chosen`:`, selection pending`}`),i.length&&o.push(t?`路线 ${s(i)} 被驳回`:`route${i.length>1?`s`:``} ${s(i)} rejected`),o.length?t?`:${o.join(`,`)}`:`: ${o.join(`; `)}`:``}function Yi(e,t,n,r=3){let i=new Map;for(let t of e.tasks){if(!t.branch||t.overflow_count||t.group||!t.parent_id)continue;let e=JSON.stringify([t.parent_id,Mi(t)]);(i.get(e)??i.set(e,[]).get(e)).push(t)}let a=new Set(e.tasks.map(e=>e.id)),o=new Map,s=new Map;for(let[e,c]of i){if(c.lengthe.role===t);n?n.count++:d.push({role:t,count:1})}let f=c[0],p=t.has(u);o.set(u,{id:u,title:qi(d,l,n)+Ji(c,n),objective:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,excerpt:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,status:f.status,deps:[],pending_question:f.pending_question,role:`team`,ts:f.ts,branch:!0,parent_id:i,group:{status:l,members:c.map(e=>e.id),counts:d,expanded:p}});for(let e of c)s.set(e.id,u)}if(!o.size)return e;let c=[],l=new Set;for(let n of e.tasks){let e=s.get(n.id);if(!e){c.push(n);continue}l.has(e)||(l.add(e),c.push(o.get(e))),t.has(e)&&c.push(n)}let u=[],d=new Set;for(let n of e.links){let e=s.get(n.source),r=s.get(n.target),i=n.source,a=n.target;if(e&&!t.has(e)&&(i=e),r&&!t.has(r)&&(a=r),r&&t.has(r)&&n.kind===`fanout`&&n.source===o.get(r).parent_id&&(i=r),i===a)continue;if(i===n.source&&a===n.target){u.push(n);continue}let c=JSON.stringify([n.kind,i,a]);d.has(c)||(d.add(c),u.push({...n,id:c,source:i,target:a}))}for(let[e,n]of o){if(!t.has(e))continue;let r=JSON.stringify([`fanout`,n.parent_id,e]);d.has(r)||(d.add(r),u.push({id:r,source:n.parent_id,target:e,kind:`fanout`}))}return{...e,tasks:c,links:u}}function Xi(e){return e.filter(e=>!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)).map(({source:e,target:t})=>({source:e,target:t}))}function Zi(e,t,n,r=[]){let i=(e,t)=>r.find(n=>n.source===e&&n.target===t&&n.label),a=e.links.map(e=>{if(e.kind!==`dependency`)return e;let r=t.find(t=>t.source===e.source&&t.target===e.target)??i(e.source,e.target);return r?{...e,label:r.label,stated:!0,evidence:`${n?`执行依赖`:`Execution dependency`} · ${r.label}`}:e}),o=new Map(e.tasks.map(e=>[e.id,e.id])),s=e=>{let t=o.get(e);return t===e?e:s(t)},c=(e,t)=>{o.set(s(e),s(t))};for(let e of a.filter(e=>e.kind===`dependency`))c(e.source,e.target);for(let n of t)!o.has(n.source)||!o.has(n.target)||e.tasks.findIndex(e=>e.id===n.source)>=e.tasks.findIndex(e=>e.id===n.target)||s(n.source)===s(n.target)||(a.push({source:n.source,target:n.target,label:n.label,kind:`semantic`,stated:!0,id:`semantic:${n.source}:${n.target}`}),c(n.source,n.target));for(let t=1;tQi+Math.min(500,Math.max(0,e-8)*60);function ta(e,t,n,r,i,a,o){let s=new Map(n.map(e=>[e,t[e].y+i[e].height/2]));for(let c=0;c<6;c++)for(let l of c%2?[...e].reverse():e){let e=new Set(l),c=[],u=[],d=0;l.forEach((f,p)=>{let m=s.get(f)*.8,h=.8;for(let o of a[r.get(f)]){let r=n[o.index];e.has(r)||(m+=(t[r].y+i[r].height/2)*o.weight,h+=o.weight)}c.push(d);let g=m/h-i[f].height/2-d;for(u.push({start:p,end:p,sum:g*h,weight:h});u.length>1;){let e=u[u.length-2],t=u[u.length-1];if(e.sum/e.weight<=t.sum/t.weight)break;e.end=t.end,e.sum+=t.sum,e.weight+=t.weight,u.pop()}d+=i[f].height+(p+1[e,t])),a=t.filter(e=>e.kind!==`replacement`&&e.source!==e.target).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:.4})),o=e.map(()=>[]),s=e.map(()=>[]),c=e.map(()=>[]);for(let e of a)o[e.source].push(e.target),s[e.target].push(e.source),c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let l=new Set(a.filter(e=>e.weight===1).map(e=>`${Math.min(e.source,e.target)}:${Math.max(e.source,e.target)}`)),u=(e,t)=>{let n=i.get(e),r=i.get(t);return l.has(`${Math.min(n,r)}:${Math.max(n,r)}`)?$i:$i*1.3},d=e.reduce((e,t)=>e+n[t].width*n[t].height,0),f=Math.sqrt(d/e.length),p=e.reduce((e,t)=>e+n[t].height,0)/e.length,m=Math.ceil(Math.sqrt(e.length)*1.8),h=e.map(()=>[]);for(let e of a)h[Math.max(e.source,e.target)].push(e);let g=e.map((t,n)=>{let r=0;return Array.from({length:Math.min(m,e.length-n)+1},(e,t)=>{if(t)for(let e of h[n+t-1])Math.min(e.source,e.target)1||s[e.target].length>1)&&(r+=e.weight*.9),r+=Math.max(0,Math.abs(e.target-e.source)-1)*e.weight);return r})}),_={},v=1/0,y=new Set;for(let t=1;t<=m;t++){let o=t*p+(t-1)*$i,l=Array(e.length+1).fill(1/0),m=Array(e.length+1).fill(0);l[0]=0;for(let r=1;r<=e.length;r++){let i=0;for(let a=r-1;a>=Math.max(0,r-t);a--){i+=n[e[a]].height+(a===r-1?0:$i);let t=g[a][r-a];a>0&&s[a].some(e=>s[a-1].includes(e))&&(t+=.7);let c=l[a]+.2+(i/o-1)**2+t;c0;t=m[t])h.unshift(e.slice(m[t],t));let b=JSON.stringify(h);if(y.has(b))continue;y.add(b);let x=h.map(e=>Math.max(...e.map(e=>n[e].width))),S=h.map(e=>e.reduce((e,t)=>e+n[t].height,0)+(e.length-1)*$i),C=x.reduce((e,t)=>e+t,0)+(h.length-1)*r,w=Math.max(...S),T={},E=0;h.forEach((e,t)=>{let i=(w-S[t])/2;e.forEach((r,a)=>{T[r]={x:E+(x[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1T[e].y));for(let t of e)T[t].y-=D;w=Math.max(...e.map(e=>T[e].y+n[e].height));let O=a.reduce((t,r)=>{let i=T[e[r.source]],a=T[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,a.length)/f,k=2*Math.log(C/w/2.1)**2+.08*C*w/d+.14*O+.08*l[e.length]/h.length;k[e,t])),a=e=>e.source!==e.target&&i.has(e.source)&&i.has(e.target),o=new Set,s=new Map;for(let e of t)!a(e)||e.kind!==`fanout`&&e.kind!==`fanin`||(e.kind===`fanout`?o.add(e.target):o.add(e.source),(s.get(e.source)??s.set(e.source,new Set).get(e.source)).add(e.target),(s.get(e.target)??s.set(e.target,new Set).get(e.target)).add(e.source));let c=e.map(()=>[]),l=t.filter(e=>e.kind!==`replacement`&&a(e)).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:e.kind===`fanout`||e.kind===`fanin`?.8:.4}));for(let e of l)c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let u=e.map(()=>[]);for(let e of t){if(!ra.has(e.kind)||!a(e))continue;let t=i.get(e.source),n=i.get(e.target);td[e]))+1:f+1;d.push(e),f=Math.max(f,e)}let p=[];e.forEach((e,t)=>{(p[d[t]]??=[]).push(e)});let m=p.filter(e=>e?.length),h=(e,t)=>o.has(e)&&o.has(t)?$i/2:$i,g=e=>e.reduce((t,r,i)=>t+n[r].height+(i?h(e[i-1],r):0),0),_=e.reduce((e,t)=>e+n[t].width*n[t].height,0),v=Math.sqrt(_/e.length),y=e.filter(e=>!o.has(e)),b=(y.length?y:e).reduce((e,t)=>e+n[t].height,0)/Math.max(1,y.length||e.length),x=Math.ceil(Math.sqrt(e.length)*1.8),S={},C=1/0,w=new Set;for(let t=1;t<=x;t++){let a=t*b+(t-1)*$i,u=[];for(let e of m){let t=[],n=()=>{if(!t.length)return;let e=o.has(t[0]);if(e)u.push({nodes:t,isBranch:e});else{let n=[];for(let r of t)n.length&&g([...n,r])>a&&(u.push({nodes:n,isBranch:e}),n=[]),n.push(r);n.length&&u.push({nodes:n,isBranch:e})}t=[]};for(let r of e)t.length&&o.has(t[0])!==o.has(r)&&n(),t.push(r);n()}let d=[],f=[];for(let e of u){let t=d.at(-1),n=t&&e.nodes.some(e=>t.some(t=>s.get(e)?.has(t)));!t||n||f.at(-1)!==e.isBranch||g([...t,...e.nodes])>a?(d.push([...e.nodes]),f.push(e.isBranch)):t.push(...e.nodes)}let p=JSON.stringify(d);if(w.has(p))continue;w.add(p);let y=d.map(e=>Math.max(...e.map(e=>n[e].width))),x=d.map(g),T=y.reduce((e,t)=>e+t,0)+(d.length-1)*r,E=Math.max(...x),D={},O=0;d.forEach((e,t)=>{let i=(E-x[t])/2;e.forEach((r,a)=>{D[r]={x:O+(y[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1D[e].y));for(let t of e)D[t].y-=k;E=Math.max(...e.map(e=>D[e].y+n[e].height));let A=l.reduce((t,r)=>{let i=D[e[r.source]],a=D[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,l.length)/v,j=2*Math.log(T/E/2.1)**2+.08*T*E/_+.14*A;j=e.length*.3?ia(e,t,n):na(e,t,n)}function oa(e){let t=new Map,n=new Map,r=new Map;return e.map(e=>{let i=`${e.source}\u0000${e.target}`,a=(t.get(e.source)??0)+(n.get(e.target)??0)-(r.get(i)??0);return t.set(e.source,(t.get(e.source)??0)+1),n.set(e.target,(n.get(e.target)??0)+1),r.set(i,(r.get(i)??0)+1),a})}function sa(e,t){if(e.x===t.x&&e.y===t.y)return{sourceHandle:`right`,targetHandle:`bottom`};let n=t.x+t.width/2-e.x-e.width/2,r=t.y+t.height/2-e.y-e.height/2,i=r>0?t.y-e.y-e.height:e.y-t.y-t.height,a=n>0?t.x-e.x-e.width:e.x-t.x-t.width;return i>=0&&a<0?r>=0?{sourceHandle:`bottom`,targetHandle:`top`}:{sourceHandle:`top`,targetHandle:`bottom`}:n>=0?{sourceHandle:`right`,targetHandle:`left`}:{sourceHandle:`left`,targetHandle:`right`}}function ca(e,t){return e?.type!==`life.mission.completed`||e.overall_complete!==!1&&e.campaign_continues!==!0||e.outcome?.execution_status===`completed`&&e.outcome.review_status===`done`?``:t?`当次执行已结束;当时总体目标尚未完成${e.campaign_continues===!0?`,仍需后续工作`:``}。`:`This execution ended; the overall goal was not complete at that time${e.campaign_continues===!0?` and further work remained`:``}.`}function la(e){let{total:t,qa:n=0,complete:r,ended:i=0,reviewUnavailable:a=0,held:o=0,running:s,pending:c,paused:l,hasOpenWork:u,role:d,current:f,waiting:p,zh:m}=e,h=t>0&&r===t&&i===0,g=n===t&&n>0?m?`已全部回答`:`all answered`:m?`已全部完成`:`all completed`,_=m?[t>n?`${t-n} 个任务`:``,n>0?`${n} 条问答`:``,r>0&&!h?`已完成 ${r} 个`:``,i>0?`${i} 个任务结束时目标还没完成`:``,a>0?`${a} 个结果尚未检查成功`:``,o>0?`${o} 个任务暂停,后续工作尚未安排`:``,s>1?`${s} 个任务同时进行`:``]:[t>n?`${t-n} ${t-n===1?`task`:`tasks`}`:``,n>0?`${n} Q&A`:``,r>0&&!h?`${r} done`:``,i>0?`${i} ended before their goals were complete`:``,a>0?`${a} ${a===1?`result has`:`results have`} not been checked successfully`:``,o>0?`${o} paused with no next step scheduled`:``,s>1?`${s} tasks in progress`:``],v=c?m?`正在处理你的消息`:`working on your message`:p||(l?h?g:u?m?`已暂停`:`paused`:t>0?m?`没有在进行的工作`:`nothing in progress`:m?`就绪`:`ready`:f||(d?Qr(d,m):h?g:``));return[..._,v].filter(Boolean).join(` · `)}var ua=[{match:/External interrupt|daemon (?:stop|shutdown)|stopped by its operator/i,bare:/^(?:Engineer interrupted because daemon shutdown|Argus was stopped by its operator|Reviewer backend returned no complete judgment \([^)]*External interrupt)/,kind:`interrupt`,zh:`运行被操作员停下,这一轮没有做完;这不是对工作本身的评价`,en:`Argus was stopped by its operator before this round could finish; this says nothing about the work itself`},{match:/no complete judgment|before reaching a judgment|reached a conclusion|did not reach a conclusion/i,bare:/^(?:Reviewer backend (?:returned no complete judgment|ended before reaching a judgment)|The Reviewer's session ended before it reached a conclusion|The review did not reach a conclusion)/,kind:`reviewer`,zh:`审阅者的会话在得出结论前就结束了,这一轮没有评审意见`,en:`The Reviewer's session ended before it reached a conclusion, so this round was not judged`},{bare:/^Engineer backend failed before a trustworthy completed turn/,kind:`reviewer`,zh:`模型服务在工程师做完之前断开了;Argus 会换一个新会话重试,审阅等到那时再做`,en:`The model service dropped the Engineer's session before it finished; Argus retries in a fresh session and the review waits until then`},{bare:/^Retry in a fresh (?:\w+ )?session/,zh:`Argus 会换一个新会话再试一次`,en:`Argus will try again in a fresh session`},{bare:/^Restart the daemon when ready/,zh:`重新启动后,Argus 会从项目留下的状态继续,选择下一项具体任务`,en:`Once Argus is started again it continues from the saved project state and picks the next concrete task`},{bare:/^engineer round \d+ \((?:fresh|rotated|resumed)[^)]*\)\s*$/i,kind:`round`,zh:`工程师开始了新的一轮工作`,en:`The Engineer began a new round of work`},{match:/provider[\s-]?turn/i,bare:/^(?:One Engineer call|\d+ Engineer sessions in a row each) used (?:its|their) whole per-call provider-turn allowance/,zh:`继续换了个新会话接着做,之前的进展都在`,en:`Continued in a fresh session; earlier progress is kept`},{match:/budget (limit|cap|exhausted)|blocking budget|预算上限/i,bare:/^Paused because this project reached its budget limit/,zh:`花费到了预算上限,先暂停;提高预算后可以继续`,en:`Paused at the budget limit; work resumes once the budget is raised`},{match:/quarantin/i,bare:/^The task signature is quarantined out of planner rotation/,zh:`这个方向连续失败,先搁置,不再自动重试`,en:`This direction kept failing and is set aside; it will not retry on its own`},{match:/backend[\s\S]{0,24}?(fail|unavailable|paused)|backend_failure|provider cooldown|configured model is unavailable/i,bare:/^(?:backend failure; retrying in a fresh|The backend has failed the same way \d+ times in a row)/,zh:`模型服务暂时不稳定,稍后会自动重试`,en:`The model service was briefly unavailable; it retries after a short wait`}],da=/Runner receipt:|Technical record:|技术记录[::]/i,fa=/^(?:Runner receipt|Technical record|技术记录)\s*[::]\s*/i;function pa(e){let t=String(e||``).trim(),n=t.search(da);return n<0?{prose:t,receipt:``}:{prose:t.slice(0,n).trim(),receipt:t.slice(n).trim()}}function ma(e,t){let n=String(e||``).trim(),{receipt:r}=pa(n),i=r?ua.find(e=>e.match?.test(n)):ua.find(e=>e.bare?.test(n));return i?{summary:t?i.zh:i.en,receipt:r||n,kind:i.kind}:{summary:``,receipt:r}}var ha={width:1440,height:1080},ga=[`plan`,`execution`,`review`,`revision`,`result`];function _a(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function va(e,t){let n=e.team_outcome;if(!n)return``;if(n.kind===`review`){let e=n.verdict===`rejected`?t?`复核结论:驳回`:`Verdict: rejected`:n.verdict===`qualified`?t?`复核结论:通过`:`Verdict: qualified`:``;if(!e)return``;let r=n.summary?xa(n.summary,120):``;return r?`${e}${t?`。`:`. `}${r}`:e}if(n.kind===`route`){let e=n.title?t?`「${n.title}」`:`“${n.title}”`:``;if(n.selected)return t?`${e}通过独立复核,被选为唯一方案`:`${e} passed its independent review and was chosen`;if(n.verdict===`rejected`){let r=n.rejection?xa(n.rejection,120):``;return(t?`${e}被独立复核驳回`:`${e} was rejected by its independent review`)+(r?t?`。${r}`:`. ${r}`:``)}return n.verdict===`qualified`?n.selected===!1?t?`${e}通过独立复核,但未被选中`:`${e} passed its independent review but was not chosen`:t?`${e}通过独立复核,等待选择`:`${e} passed its independent review; selection pending`:``}let r=Ri(n.selected_route);if(!r)return``;let i=n.selected_title?t?`(${n.selected_title})`:` (${n.selected_title})`:``,a=(n.rejected??[]).map(Ri).filter(Boolean);return(t?`选定研究路线 ${r}${i}`:`Chose route ${r}${i}`)+(a.length?t?`,驳回路线 ${a.join(`、`)}`:`; rejected route${a.length>1?`s`:``} ${a.join(`, `)}`:``)}function ya(e,t,n){return e.pending_question?t?`需要答复,展开查看具体问题`:`Needs your input; open to read the question`:e.status===`failed`?t?`本次执行失败,展开查看原因`:`This attempt failed; open to read the reason`:e.status===`blocked`?t?`执行受阻,展开查看原因`:`Work is blocked; open to read the reason`:va(e,t)||(e.status===`done`?e.team_role===`idea-review`?t?`独立复核已完成,展开查看记录`:`Independent review completed; open to read the record`:t?`子任务执行已完成,展开查看记录`:`Subtask execution completed; open to read the record`:e.status===`pending`?n?t?`等待前置子任务完成后开始`:`Waiting for prerequisite subtasks to finish`:t?`等待分配 Agent 执行`:`Waiting for an agent to start`:Ti.has(e.status||``)?e.team_role===`idea-route`?t?`正在开展来源研究,整理候选方案`:`Researching sources and developing a candidate idea`:e.team_role===`idea-review`?t?`正在独立核对依据、创新性和风险`:`Independently checking evidence, novelty and risks`:e.team_role===`idea-selector`?t?`正在对比研究路线及复核意见`:`Comparing research routes and independent reviews`:t?`Agent 正在执行此子任务`:`An agent is working on this subtask`:t?`展开查看子任务执行记录`:`Open to read the subtask record`)}var ba=e=>e?`这一步还没有留下记录`:`Nothing has been written down for this step yet.`;function xa(e,t=140){let n=e.replace(/\s+/g,` `).trim();if(!n)return``;let r=n.match(/^.*?[。!?!?.](?=\s|$)/),i=(r?r[0]:n).trim();return i.length>t?`${i.slice(0,t-1).trimEnd()}…`:i}function Sa(e){let t=e.replace(/\s+/g,` `).trim().split(/[。!?;;::,,\n]|\.(?=\s|$)|[!?](?=\s|$)/)[0]?.trim();return t&&t.length>=6&&t.length<=40?t:``}function Ca(e){return String(e||``).split(/\r?\n/).filter(e=>!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e.trim())&&!/^\{\s*"[\w-]+"\s*:.*\}$/.test(e.trim())).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/i,``).replace(/^\s*NEXT_ACTION\s*=\s*/i,``)).join(` +`).trim()}function wa(e,t,n){switch(e.type){case`life.planner.task_added`:return n?`规划者把这项任务列入了计划。`:`The Planner added this task to the plan.`;case`life.mission.started`:return n?`工程师接手了这项任务,开始动手。`:`The Engineer picked up this task and began working.`;case`life.phase.started`:case`round.review.started`:return e.role===`reviewer`?n?`审阅者打开了工程师的工作,开始核查。`:`The Reviewer opened the Engineer's work to check it.`:``;case`life.mission.completed`:return ca(e,n)||(t===`done`?n?`任务完成,结果已经记录在案。`:`The task was finished; its result is on record.`:t===`paused_external_work`?n?`这项任务在等待后台团队的结果;结果就绪后会自动继续。`:`This task is waiting for its background team; it continues on its own once the results are in.`:t.startsWith(`paused`)?n?`这项任务的工作暂停了。`:`Work on this task was paused.`:n?`任务到此结束。`:`The task ended here.`);case`life.mission.failed`:return n?`任务没有达到目标就结束了。`:`The task ended without reaching its goal.`;default:return``}}var Ta=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,Ea=(e,t)=>e.length>t?`${e.slice(0,t-1).trimEnd()}…`:e;function Da(e){let t=e.slice(e.indexOf(`:`)+1).trim();if(!t)return``;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of[`path`,`file`,`file_path`,`pattern`,`query`,`url`,`command`,`paths`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim();if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}let n=Object.values(t).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n.trim():``}}catch{}return/^[{[]/.test(t)?/"(?:path|file|file_path|pattern|query|url|command)"\s*:\s*"([^"]+)/.exec(t)?.[1]??``:t}function Oa(e){let t=(e.tool||e.label.replace(Ta,``).split(`:`)[0]||``).trim().toLowerCase();return e.kind===`command_execution`?`run`:e.kind===`file_change`?`edit`:/^(view|read|cat|open|read_file|str_replace_editor)$/.test(t)?`read`:/^(rg|grep|search|find_text|semantic_search|codebase_search|web_search|search_web)$/.test(t)||/^(glob|find|list|ls|list_dir|find_files)$/.test(t)?`search`:/^(web_fetch|fetch|http_get|browse)$/.test(t)?`fetch`:/^(apply_patch|edit|write|create|write_file|edit_file|replace_in_file|str_replace)$/.test(t)?`edit`:/^(bash|shell|sh|execute|terminal|run)$/.test(t)?`run`:`other`}function ka(e,t){let n=(e.tool||``).trim(),r=e.label.replace(Ta,``).trim(),i=n&&/\s/.test(n)&&n.length>8,a=Ea(Da(r),72),o=Ea(r,72),s=Oa(e),c=i?n:s===`run`?t?`运行命令 \`${o}\``:`Ran \`${o}\``:s===`read`?t?`查看 ${a||(t?`一份文件`:``)}`:`Read ${a||`a file`}`:s===`search`?t?`查找 ${a||`内容`}`:`Looked for ${a||`something`}`:s===`fetch`?t?`读取网页 ${a||``}`.trim():`Fetched ${a||`a page`}`:s===`edit`?t?`修改文件 ${a||``}`.trim():`Edited ${a||`a file`}`:Ea(/^[^:{]*:\s*[{[]/.test(r)?r.slice(0,r.indexOf(`:`)):r,80);return e.status===`failed`?`${c}${t?`(失败)`:` (failed)`}`:c}function Aa(e,t,n){let r=new Map;e.forEach(e=>r.set(Oa(e),(r.get(Oa(e))??0)+1));let i=[],a=(e,t,a,o)=>{let s=r.get(e);s&&i.push(n?`${t}${s}${e===`run`?`条命令`:e===`fetch`?`个网页`:`处`}`:`${s} ${s===1?a:o}`)};a(`read`,`查看了`,`file read`,`files read`),a(`search`,`查找了`,`search`,`searches`),a(`fetch`,`读取了`,`page fetched`,`pages fetched`),a(`edit`,`修改了`,`file edited`,`files edited`),a(`run`,`运行了`,`command run`,`commands run`);let o=r.get(`other`);return o&&i.push(n?`${o}次其他操作`:`${o} other ${o===1?`action`:`actions`}`),t>0&&i.push(n?`另有 ${t} 步未列出`:`${t} more not listed`),i.length?n?`${i.join(`,`)}。`:`${i.join(`, `)}.`:``}function ja(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.status===`running`&&n.status&&n.status!==`running`&&(e.call_id&&n.call_id?e.call_id===n.call_id:!e.call_id&&!n.call_id&&e.kind===n.kind&&e.label===n.label&&(e.tool??``)===(n.tool??``))?t[t.length-1]={...e,status:n.status,...n.call_id?{call_id:n.call_id}:{}}:t.push(n)}return t}function Ma(e,t){let n=ja(e.steps??[]),r=Ca(e.text),i=e.tool_details_recorded===!1,a=i?t?`执行日志确认发生过工具活动,但这一轮没有记录详细工具步骤。`:`Execution logs confirm tool activity, but detailed tool steps were not recorded for this turn.`:``;return Fa({id:e.id,kind:e.role===`reviewer`?`review`:`execution`,title:``,detail:``,status:e.status||`recorded`,ts:e.ts,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id],segment:!0,work:{steps:[...n],overflow:e.overflow??0,narrations:r?[r]:[],note:a,title:i?t?`已记录的执行`:`Recorded execution`:``,single:e.role===`manager`}},t)}var Na=8,Pa=(e,t)=>{let n=Math.max(0,e.steps.length-Na)+e.overflow;return[...e.steps.slice(0,Na).map(e=>`· ${ka(e,t)}`),...n>0?[t?`· 另有 ${n} 步未列出`:`· ${n} more not listed`]:[]]};function Fa(e,t){let n=e.work,r=n.narrations.join(` + +`);return e.title=n.title||Sa(n.narrations[0]??``)||(n.single?t?`Argus 动手查证`:`Argus did the work`:n.steps.length?t?`做了 ${n.steps.length} 步操作`:`${n.steps.length} steps of work`:t?`说明了接下来要做什么`:`Said what comes next`),e.summary=xa(n.narrations[0]??``)||Aa(n.steps,n.overflow,t)||void 0,e.detail=[n.note,r,Pa(n,t).join(` +`)].filter(Boolean).join(` + +`)||ba(t),e.workCount=n.steps.length+n.overflow||void 0,e}function Ia(e,t){let n=e.work;if(!n||e.segment)return e;let r=e.detail===ba(t)?``:e.detail,i=n.narrations.filter(e=>!r.includes(e.slice(0,60))),a=n.steps.length+n.overflow,o=Aa(n.steps,0,t),s=a?[t?`这一步里做的操作(${a} 步):${o}`:`What was done in this step (${a} actions): ${o}`,Pa(n,t).join(` +`)].join(` +`):``,c=n.narrations[n.narrations.length-1];return!e.closed&&c&&(e.title=Sa(c)||e.title,e.summary=xa(c)||e.summary),e.detail=[n.note,r,i.join(` + +`),s].filter(Boolean).join(` + +`)||ba(t),e.workCount=a||void 0,e}function La(e,t){switch(e){case`done`:return t?`这项任务已经完成。`:`This task was completed.`;case`failed`:return t?`这项任务没有达到目标。`:`This task did not reach its goal.`;case`cancelled`:case`aborted`:return t?`这项任务被取消了。`:`This task was cancelled.`;case`skipped`:return t?`这项任务被跳过了。`:`This task was skipped.`;case`superseded`:return t?`这项任务被一个新的计划取代了。`:`A new plan took the place of this task.`;default:return``}}function Ra(e,t,n){let r=e.kind===`turn`,i=[{id:`${e.id}:brief`,kind:`plan`,title:r?n?e.turn_kind===`qa`?`你提出的问题`:`你提出的要求`:`What you asked`:n?`任务目标`:`Task goal`,detail:e.objective||e.title,status:`recorded`,source:`task`,eventIds:[]}],a=new Set,o=0,s,c=t.filter(t=>t.item_id===e.id).sort((e,t)=>e.ts-t.ts||(e.type===`team.task`&&t.type===`team.task`?(e.team_task_id||e.id).localeCompare(t.team_task_id||t.id):0)),l=new Map(c.filter(e=>e.type===`team.task`).map(e=>[e.id,e]));for(let e of c){if(a.has(e.id))continue;if(a.add(e.id),e.type===`team.task`){let t=[...new Set(e.deps||[])],r=t.map(e=>l.has(e)?_a(l.get(e),n):n?`其他记录中的子任务`:`Task outside this view`),a=Ca(e.text);i.push({id:e.id,kind:e.team_role===`idea-review`||e.role===`reviewer`?`review`:e.team_role===`idea-selector`?`plan`:`execution`,title:_a(e,n),summary:ya(e,n,t.some(e=>l.has(e)&&l.get(e).status!==`done`)),detail:[a,e.reason&&!a.includes(e.reason)?e.reason:``,e.pending_question?`${n?`需要答复`:`Needs input`}: ${e.pending_question}`:``,r.length?`${n?`依赖`:`Depends on`}: ${r.join(` · `)}`:``].filter(Boolean).join(` + +`),status:e.pending_question?`question`:e.status||`unknown`,ts:e.ts,source:`team`,eventIds:[e.id],teamId:e.team_id,teamTaskId:e.team_task_id,teamRole:e.team_role,...e.team_outcome?{teamOutcome:e.team_outcome}:{},deps:t,updatedAt:e.updated_ts,revision:e.revision});continue}if(e.type===`work.segment`){i.push({...Ma(e,n),episode:o});continue}if(e.type===`turn.replied`){let t=Ca(e.text);i.push({id:e.id,kind:`result`,title:n?`Argus 的回答`:`What Argus answered`,summary:xa(t)||void 0,detail:t||ba(n),status:e.status||`done`,ts:e.ts,source:`event`,eventIds:[e.id]});continue}e.type===`life.mission.started`&&(o++,s=void 0),e.type===`round.review.completed`&&(s=e);let t=e.type.includes(`review`)||e.type===`life.phase.started`&&e.role===`reviewer`?`review`:e.type===`life.planner.task_added`?`plan`:e.type===`life.mission.completed`||e.type===`life.mission.failed`?`result`:e.type===`round.start`||e.type===`round.main.completed`||e.type===`life.mission.started`||e.type===`life.phase.started`?`execution`:null;if(!t)continue;let r=e.round_index,c=e.type.endsWith(`.completed`)||e.type.endsWith(`.failed`),u=t===`review`&&e.review_skipped===!0,d=e.backend_unavailable===!0||t===`result`&&s?.backend_unavailable===!0,f=d?``:ca(e,n),p=(d?`review_unavailable`:u?`skipped`:e.status===`error`?`failed`:e.status)||(e.success===!1||e.type.endsWith(`.failed`)?`failed`:e.success===!0?`done`:c||e.type===`life.planner.task_added`||e.type===`life.mission.started`?`recorded`:`started`),m=ma(e.text||``,n),h=String(e.text||``),g=m.receipt?h.lastIndexOf(m.receipt):-1,_=Ca(g>=0?h.slice(0,g):h),v=p===`done`?n?`审阅通过`:`Review passed`:p===`continue`?n?`审阅:要求再改一轮`:`Review: another pass asked for`:[`blocked`,`replan`,`replan_requested`].includes(p)?n?`审阅:建议调整方向`:`Review: a change of course asked for`:p===`failed`?n?`审阅未通过`:`Review not passed`:``,y=m.kind===`interrupt`,b=t===`execution`&&!m.summary?Sa(_):``,x=d?n?`当次审查异常`:`Review error on this attempt`:y?n?`这一轮没做完就被停下`:`Stopped before the round could finish`:u?n?`本轮未审阅`:`No review this round`:t===`review`?c?v||(n?`审阅意见`:`Review`):n?`开始审阅`:`Review started`:t===`result`?f?n?`本次执行已结束`:`This execution ended`:p===`paused_external_work`?n?`等待后台团队`:`Waiting for the background team`:n?`执行结果`:`Result of the work`:t===`plan`?n?`列入计划`:`Taken into the plan`:b||(m.kind===`round`?n?`新一轮开始`:`A new round began`:e.type===`life.mission.started`?n?`开始执行`:`Work started`:e.type===`round.main.completed`?n?`本轮执行记录`:`This round's work`:n?`一次执行尝试`:`An attempt at the work`),S=ma(e.next_action||``,n),C=_||m.summary?``:wa(e,p,n);i.push({id:e.id,kind:t,title:x,summary:d?n?`审查器未能给出判断,不是审阅否决。`:`The Reviewer could not return a judgment; this was not a rejection.`:f||m.summary||xa(_)||C||void 0,detail:[f,_||m.summary||(f?``:C||ba(n)),f&&e.stage_certification===`intentionally_skipped`?n?`本阶段认证被有意跳过;这不代表最终验收通过。`:`Stage certification was intentionally skipped; this is not final acceptance.`:``,u&&e.next_action&&!S.summary?`${n?`接下来`:`What happens next`}: ${e.next_action}`:``,m.receipt?`${n?`——技术记录:`:`— technical record: `}${m.receipt.replace(fa,``)}`:``].filter(Boolean).join(` + +`),status:f&&p===`done`?`recorded`:p,completionScope:f||void 0,closed:c,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]}),!u&&!y&&e.next_action&&[`continue`,`blocked`,`replan`,`replan_requested`].includes(e.status||``)&&i.push({id:`${e.id}:next`,kind:`revision`,title:n?`建议的修改`:`Changes asked for`,detail:S.summary||e.next_action,status:`requested`,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]})}e.turn_kind===`qa`&&!i.some(e=>e.kind===`result`)&&i.push({id:`${e.id}:answer`,kind:`result`,title:Ti.has(e.status)?n?`正在回答`:`Answering`:n?`回答状态`:`Answer status`,detail:e.summary||(e.status===`cancelled`?n?`本次回答已中断。`:`This answer was interrupted.`:``),status:e.status,source:`task`,eventIds:[]}),e.turn_kind!==`qa`&&!i.some(e=>e.kind===`execution`)&&Ti.has(e.status)&&i.push({id:`${e.id}:active`,kind:`execution`,title:n?`正在进行的工作`:`Work under way`,detail:e.summary||``,status:e.status,source:`task`,eventIds:[]}),!i.some(e=>e.kind===`result`)&&[`done`,`failed`,`aborted`,`cancelled`,`skipped`,`superseded`].includes(e.status)&&i.push({id:`${e.id}:outcome`,kind:`result`,title:n?`任务的最终状态`:`Where this task ended up`,detail:e.summary||La(e.status,n),status:e.status,source:`task`,eventIds:[]});let u=[],d=new Map,f=new Map,p=(e,t)=>{let n=e.work??={steps:[],overflow:0,narrations:[],note:``,title:``,single:!1};n.steps.push(...t.work.steps),n.overflow+=t.work.overflow,n.narrations.push(...t.work.narrations.filter(e=>!n.narrations.includes(e))),n.note||=t.work.note,e.eventIds.push(...t.eventIds),t.source===`interval`&&(e.source=`interval`)};for(let e of i){if(e.segment){let t=f.get(e.kind),r=u[u.length-1],i=t&&t.episode===e.episode?t:r?.segment&&r.kind===e.kind?r:void 0;i?(p(i,e),i.segment&&Fa(i,n)):u.push({...e,eventIds:[...e.eventIds]});continue}let t=e.round!=null&&[`execution`,`review`].includes(e.kind),r=`${e.episode}:${e.round}:${e.kind}`,i=t?d.get(r):void 0;if(i)i.title=e.title,i.summary=e.summary??i.summary,i.detail=e.detail,i.status=e.status,i.closed=i.closed||e.closed,i.eventIds.push(...e.eventIds),e.source===`interval`&&(i.source=`interval`);else{let n={...e,eventIds:[...e.eventIds]};u.push(n),t&&(d.set(r,n),f.set(n.kind,n))}}return u.map(e=>{let{work:t,segment:r,closed:i,...a}=Ia(e,n);return a})}function za(e,t,n=!0){let r=e.filter(e=>e.source===`team`),i=r.filter(e=>e.teamOutcome?.kind===`route`),a=r.find(e=>e.teamOutcome?.kind===`selection`)?.teamOutcome,o=i.find(e=>e.teamOutcome?.selected),s=[],c=e=>e.join(t?`、`:`, `);if(o||a?.selected_route){let e=Ri(o?.teamTaskId)||Ri(a?.selected_route),n=o?.teamOutcome?.title||a?.selected_title;s.push(t?`已选定研究路线 ${e}${n?`(${n})`:``}`:`route ${e} chosen${n?` (${n})`:``}`);let r=i.filter(e=>e.teamOutcome?.verdict===`rejected`&&!e.teamOutcome.selected).map(e=>Ri(e.teamTaskId)).filter(Boolean);r.length&&s.push(t?`路线 ${c(r)} 被驳回`:`route${r.length>1?`s`:``} ${c(r)} rejected`)}else if(i.some(e=>e.teamOutcome?.verdict)){let e=i.filter(e=>e.teamOutcome?.verdict===`qualified`).length,n=i.filter(e=>e.teamOutcome?.verdict===`rejected`).length;s.push(t?`复核结果:${e} 条路线通过、${n} 条驳回,等待选择`:`reviews so far: ${e} route${e===1?``:`s`} qualified, ${n} rejected; selection pending`)}let l=[...e].reverse().find(e=>e.source!==`team`&&e.kind===`review`&&[`done`,`continue`,`blocked`,`replan`,`replan_requested`,`failed`].includes(e.status));l&&s.push(l.status===`done`?t?`复核通过`:`review passed`:l.status===`continue`?t?`复核要求再改一轮`:`the review asked for another pass`:l.status===`failed`?t?`复核未通过`:`review not passed`:t?`复核建议调整方向`:`the review asked for a change of course`);let u=n?[...e].reverse().find(e=>e.source!==`team`&&e.kind===`execution`&&e.round!=null&&e.status===`started`):void 0;return u&&s.push(t?`第 ${u.round} 轮进行中`:`round ${u.round} under way`),s.length?(t?`当前结论:`:`So far: `)+s.join(t?`;`:`; `):``}var Ba=480;function Va(e,t,n,r=Ra(e,t,n),i=0,a=!1){let o=a&&r.length>0,s=o?Ba:640,c=o?r.length:1,l=1/0;for(let e=1;!o&&e<=Math.min(3,r.length);e++){let t=Math.ceil(r.length/e),n=Math.max(640,t*232+(t-1)*108+96),i=408+(e-1)*236,a=Math.abs(Math.log(n/i/1.6))+.6*(t*e-r.length)/(t*e);a{let a=t*c,o=Math.min(a+c,r.length),s=m+t*340,l=r.slice(a,o);l.forEach((e,t)=>{h[e.id]={x:s,y:f+t*236}});let d=i+a+1,p=i+o,v=d===p?n?`环节 ${d}`:`Step ${d}`:n?`环节 ${d}–${p}`:`Steps ${d}–${p}`,y=Ua(g.slice(a,o)),b=Wa(l,y,_,t===0&&i===0,t===u-1,n,v);return _=y,{id:`steps:${i+a}`,title:b,x:s,y:f-38}});return{steps:r,links:Ka(r,n),columns:v,positions:h,width:d,height:p,...o?{stacked:o}:{}}}function Ha(e){let t;return e.map(e=>{if(typeof e.round==`number`)return t=e.round;if(e.kind!==`result`&&e.kind!==`plan`)return t})}function Ua(e){return[...new Set(e.filter(e=>typeof e==`number`))].sort((e,t)=>e-t)}function Wa(e,t,n,r,i,a,o){if(!t.length)return r&&i&&e.length>1&&e[0].kind===`plan`&&e[e.length-1].kind===`result`?a?`起点 → 结果`:`Setting out → Outcome`:r&&e.some(e=>e.kind===`plan`)?a?`起点`:`Setting out`:i&&e.some(e=>e.kind===`result`)?a?`结果`:`Outcome`:o;let s=t[0],c=t[t.length-1],l=t.length===1&&n.length>0&&n[n.length-1]===s,u=s===c?a?`第 ${s} 轮`:`Round ${s}`:a?`第 ${s}–${c} 轮`:`Rounds ${s}–${c}`;return l&&(u=e[0].kind===`review`?a?`${u} · 审阅`:`${u} · review`:a?`${u} · 续`:`${u} · cont.`),r&&e[0].kind===`plan`&&(u=a?`起点 · ${u}`:`Setting out · ${u}`),i&&e[e.length-1].kind===`result`&&(u=a?`${u} · 结果`:`${u} · Outcome`),u}function Ga(e){let t=e.stacked?900/e.width:Math.max(600/e.height,Math.min(1e3/e.height,ha.width/e.width));return{width:e.width*t,height:e.height*t,scale:t}}function Ka(e,t){let n=e.filter(e=>e.source===`team`);if(n.length){let r=e.filter(e=>e.source!==`team`),i=new Map(n.map(e=>[e.id,e])),a=r.find(e=>e.source===`task`&&e.kind===`plan`),o=[];for(let e of n){for(let n of e.deps||[]){let r=i.get(n);!r||r.id===e.id||r.teamId!==e.teamId||o.push({id:`link:${r.id}:${e.id}`,source:r.id,target:e.id,relation:`dependency`,label:t?`前置任务`:`Depends on`,explanation:t?`${e.title} 的任务记录明确依赖 ${r.title}。`:`${e.title} explicitly depends on ${r.title} in its taskboard.`,contextual:!1})}a&&!e.deps?.length&&o.push({id:`link:${a.id}:${e.id}`,source:a.id,target:e.id,relation:`assignment`,label:t?`任务分支`:`Branch`,explanation:t?`该子任务属于当前主任务;此线不表示等待主任务完成。`:`This worker belongs to the current mission; the link does not require the parent to finish first.`,contextual:!0})}return[...Ka(r,t),...o]}return e.slice(1).map((n,r)=>{let i=e[r],a=i.episode===n.episode,o=a&&i.round!=null&&i.round===n.round,s=`record_order`,c=t?`接着`:`then`,l=t?`同一任务的相邻观察,未确认直接因果或执行依赖。`:`Adjacent observations of the same task; no causal dependency is asserted.`;i.kind===`plan`&&[`plan`,`execution`].includes(n.kind)?(s=`assignment`,c=t?n.kind===`plan`?`纳入计划`:`执行此任务`:n.kind===`plan`?`planned`:`carried out`,l=t?`同一任务的目标/计划与其执行记录关联。`:`The task brief or plan is linked to execution of that same task.`):i.kind===`execution`&&n.kind===`review`&&o?(s=`review`,c=t?`提交审阅`:`sent for review`,l=t?`同一个任务、同一执行段、同一轮次的执行与审查记录。`:`Execution and review belong to the same task, episode and numbered round.`):i.kind===`review`&&n.kind===`revision`&&n.eventIds.some(e=>i.eventIds.includes(e))?(s=`revision`,c=t?`提出修改`:`asked to change`,l=t?`这条修订建议来自对应的审查记录。`:`This revision was requested in the corresponding review.`):i.kind===`revision`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`修订建议之后出现了同一任务的下一轮执行;不表示建议的全部内容已被采纳。`:`A later round follows the revision request; this does not certify every requested change was applied.`):i.kind===`review`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`审阅之后出现了同一任务的下一轮执行。`:`A later round of the same task follows the review.`):i.kind===`execution`&&n.kind===`execution`&&i.round==null&&n.round!=null?(c=t?`进入第 ${n.round} 轮`:`round ${n.round} begins`,l=t?`任务开始执行后记录的一轮工作。`:`A round of work recorded after the task was taken up.`):i.kind===`result`&&n.kind===`execution`?(c=t?`再次开始`:`taken up again`,l=t?`上一次执行结束之后,这项任务又被接手。`:`The task was taken up again after an earlier execution ended.`):n.kind===`result`&&n.source===`task`?(s=`snapshot`,c=t?`最终状态`:`ended as`,l=t?`任务状态记录;部分执行过程可能缺失。`:`Links to the captured state of this task; intermediate records may be missing.`):n.kind===`result`&&[`review`,`execution`,`revision`].includes(i.kind)&&(s=`outcome`,c=t?`形成结果`:`led to`,l=t?`同一任务的后续完成/失败事件,不等同于成功认证。`:`A completion or failure event of this task, not a certification of success.`);let u=[`record_order`,`snapshot`].includes(s)||i.source===`interval`||n.source===`interval`;return(i.source===`interval`||n.source===`interval`)&&(l+=t?` 部分旧记录按唯一活动任务区间归属,因此使用虚线。`:` Some legacy observations are associated by the sole active mission window, so this link is dashed.`),{id:`link:${i.id}:${n.id}`,source:i.id,target:n.id,relation:s,label:c,explanation:l,contextual:u}})}function qa(e){let t=[],n=[];for(let r=0;r12&&(t.push(n),n=[]),n.push(...i)}return n.length&&t.push(n),t}function Ja(e,t,n,r){for(let i of[n,r]){let n={x:(i.x-t.x)/t.zoom,y:(i.y-t.y)/t.zoom},r=e.find(e=>!e.hidden&&n.x>=e.position.x&&n.x<=e.position.x+(e.width??1152)&&n.y>=e.position.y&&n.y<=e.position.y+(e.height??824));if(r)return r.id}return null}function Ya(e,t,n,r,i=Zi(e,[],n),a,o=!1){let s=[],c={},l=[],u=new Map;for(let[r,i]of e.tasks.entries()){let e=Ra(i,t,n),a=i.status===`done`?ca(Ei(i,t),n):``,d=i.kind===`turn`?``:za(e,n,Ti.has(i.status)),f=qa(e),p=f.length,m=e=>e===1?i.id:JSON.stringify([`part`,i.id,e]),h=0;for(let u=1;u<=p;u++){let g=f[u-1],_=m(u);if(s.push({id:_,task:i,ordinal:r+1,part:u,partCount:p,start:h+1,end:h+g.length,totalSteps:e.length,previousId:u>1?m(u-1):void 0,nextId:u1){let t=Ka([e[h-1],g[0]],n)[0];l.push({id:JSON.stringify([`continuation`,i.id,u]),source:m(u-1),target:_,kind:`continuation`,label:t?n?`继续`:`Continued`:n?`更多分支`:`More branches`,evidence:t?`${i.title} · ${t.label} · ${e[h-1].title} → ${g[0].title}`:`${i.title} · ${n?`同一任务的其他分支,不表示串行依赖。`:`Other branches of the same mission, without a serial dependency.`}`})}h+=g.length}u.set(i.id,m(p))}let d=s.slice(),f=new Map;if(a){s.length=0;for(let e of d){let t=a.has(e.task.id);if(f.set(e.id,t?e.id:e.task.id),!t&&e.part!==e.partCount)continue;let n=t?e.id:e.task.id;c[n]=c[e.id],s.push({...e,id:n,historyCount:e.partCount-1,historyExpanded:t})}}let p=e=>f.get(e)??e,m=Object.fromEntries(s.map(({id:e})=>[e,Ga(c[e])])),h=[...i.map(e=>({...e,source:p(u.get(e.source)),target:p(e.target)})),...l.filter(e=>p(e.source)!==p(e.target))],g=s.map(e=>e.id),_=JSON.stringify([g.map(e=>[e,m[e].width,m[e].height]),h.map(e=>[e.source,e.target,e.kind])]);return{cards:s,allCards:d,links:h,layouts:c,positions:r?.structure===_?r.positions:aa(g,h,m),frames:m,structure:_}}function Xa(e,t,n){if(e.pending_question)return e.pending_question;let r=t.filter(t=>t.item_id===e.id&&(t.status===`failed`||t.success===!1||t.type.endsWith(`.failed`))).sort((e,t)=>t.ts-e.ts)[0],i=(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``),a=r?.reason||r?.text||i,o=ma(a,n),s=o.receipt?a.lastIndexOf(o.receipt):-1,c=Ca(s>=0?a.slice(0,s):a);return o.summary||c||(n?`这项任务没有完成,记录里没有写明原因。`:`This task did not finish, and the record does not say why.`)}function Za(e){return(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``).trim()}function Qa(e,t,n,r=``){if(e.pending_question)return{reason:e.pending_question,next:n?`下一步:回答这个问题,团队才会继续。`:`Next: answer this question so the team can continue.`,detail:``,showDetail:!1};if(Ni(e)){let t=Za(e),i=r.trim();return{reason:i?n?`工作已暂停:${i}`:`Work paused: ${i}`:t?n?`工作已暂停:当前结果还没有满足要求,具体原因见下方说明。`:`Work paused: the current result does not yet meet the requirements. The reason is shown below.`:n?`工作已暂停:当前结果还没有满足要求,记录里没有说明具体原因。`:`Work paused: the current result does not yet meet the requirements. No specific reason was recorded.`,next:n?`工作不会自动继续。请看暂停原因,再在对话里告诉我接下来做什么。`:`Work will not resume on its own. Read the reason, then tell me what to do next in the conversation.`,detail:t,showDetail:!!t&&!i}}let i=Xa(e,t,n),a=Za(e);return{reason:n?`执行失败:${i}`:`Execution failed: ${i}`,next:n?`下一步:查看原因后重试,或在对话里调整任务。`:`Next: check the reason, then retry or adjust the task in the conversation.`,detail:a&&!i.includes(a)?a:``,showDetail:!1}}var $a=(e,t=80)=>e.length>t?`${e.slice(0,t)}…`:e;function eo(e,t,n,r=()=>``){let i=e.filter(e=>e.turn_kind!==`qa`&&e.kind!==`turn`),a=[...i].sort((e,t)=>(t.ts??0)-(e.ts??0)),o=a[0],s=o?$a((o.objective||o.title).trim()):n?`还没有任务`:`No task yet`,c=Pi(e,t),l=e=>{let t=Mi(e);return{held:n?`工作已暂停`:`work paused`,failed:n?`这项工作没有做完`:`this task did not finish`,review_unavailable:n?`结果检查没有完成`:`the result check did not finish`,done:n?`已完成`:`done`,running:n?`进行中`:`running`,pending:n?`待开始`:`planned`,question:n?`等你回答`:`waiting on you`,paused:n?`已暂停`:`paused`}[t]||(n?`还没有新的进展记录`:`No new progress has been recorded`)},u=c?n?`已确认:${$a(Ca(r(c)||c.summary||c.title),160)}`:`Confirmed: ${$a(Ca(r(c)||c.summary||c.title),160)}`:o?Mi(o)===`review_unavailable`?n?`这次结果检查没有完成,暂时不能确认结果。`:`The result check did not finish, so the result is not yet confirmed.`:n?`还没有经过检查确认的结果。`:`There is no checked, confirmed result yet.`:n?`还没有结果`:`No result yet`,d=i.find(e=>Ti.has(e.status)),f=a.find(e=>[`question`,`held`,`failed`,`review_unavailable`].includes(Mi(e))),p=[...i].sort((e,t)=>(e.ts??0)-(t.ts??0)).find(e=>Mi(e)===`pending`);return{goal:s,current:d?n?`正在处理:${$a(d.title,70)}`:`Working on: ${$a(d.title,70)}`:o?l(o):n?`可以开始新任务`:`Ready for a new task`,conclusion:u,next:d?p?n?`待做任务:${$a(p.title,70)}`:`Queued next: ${$a(p.title,70)}`:n?`等当前工作完成,再查看检查结果。`:`Wait for the current work to finish, then check the result.`:f&&f===o?Qa(f,t,n,r(f)).next:p?n?`下一步:${$a(p.title,60)}`:`Next: ${$a(p.title,60)}`:c?n?`可以查看结果,或继续提出要求。`:`Read the result, or tell me what to do next.`:n?`还没有后续任务,可在对话里告诉我接下来做什么。`:`Nothing else is scheduled. Tell me what to do next in the conversation.`}}function to(e,t,n){let r=e?.model_revision&&e.model_revision!==n,i={...e?.cards};for(let[n,a]of Object.entries(t.cards)){if(r&&i[n]?.model_revision===e.model_revision)continue;let t=i[n];t?.version&&(a.version??0)(t.copy_revision??0)||(a.copy_revision??0)===(t.copy_revision??0)&&(a.generated_at>t.generated_at||a.generated_at===t.generated_at&&!t.input_revision))&&(i[n]=a)}let a=(t.cache_revision??0)<(e?.cache_revision??0);return{...e,...t,cards:i,...e?.version!=null||t.version!=null?{version:Math.max(e?.version??0,t.version??0)}:{},cache_revision:Math.max(t.cache_revision??0,e?.cache_revision??0),relations:(r||a)&&e?e.relations:t.relations,available:t.available??!0,...r?{model_revision:e.model_revision,available:e.available}:{}}}function no(e,t,n,r){let i=n?.cards[e.key],a=t.tasks.find(t=>t.id===e.task_id);if(!i||!a||(i.version??0)<(n?.version??0)||n?.model_revision&&i.model_revision!==n.model_revision)return!0;let o=[a.id,a.id+`:active`,a.id+`:outcome`].includes(e.key);if(o||!i.task_content_revision||!a.content_revision){if(a.revision&&i.task_revision!==a.revision||o&&i.task_status!==a.status)return!0}else if(i.task_content_revision!==a.content_revision)return!0;let s=i.event_ids||[];return e.event_ids.some(e=>{let n=s.indexOf(e),a=r?r.get(e):t.events.find(t=>t.id===e);return n<0||i.event_revisions&&a?.revision&&i.event_revisions[n]!==a.revision})||!o&&JSON.stringify(e.event_ids)!==JSON.stringify(s)}var ro=e=>`[[Argus引用 ${JSON.stringify(e)}]]\n`;function io(e){let t=[];return{refs:t,text:e.split(` +`).filter(e=>{if(e.startsWith(`[[Argus引用 `)&&e.endsWith(`]]`))try{let n=JSON.parse(e.slice(10,-2));if(typeof n.task_id==`string`&&typeof n.source==`string`&&typeof n.task_title==`string`&&(n.part===void 0||Number.isInteger(n.part)&&n.part>0)&&(n.step_title===void 0||typeof n.step_title==`string`)&&(n.step_id===void 0||typeof n.step_id==`string`)&&(n.team_id===void 0||typeof n.team_id==`string`)&&(n.team_task_id===void 0||typeof n.team_task_id==`string`)&&(n.lang===void 0||typeof n.lang==`string`)&&Array.isArray(n.event_ids)&&n.event_ids.every(e=>typeof e==`string`))return t.push(n),!1}catch{}return!0}).join(` +`).replace(/^\n+/,``)}}function ao(e,t,n=1/0){let r=Math.max(-1/0,...e.events.filter(e=>e.item_id===t&&e.type===`life.mission.started`&&e.ts<=n).map(e=>e.ts));return e.events.filter(e=>e.item_id===t&&e.ts>=r&&e.ts<=n&&[`round.main.completed`,`round.review.completed`].includes(e.type)).slice(-2).map(e=>e.id)}function oo(e,t,n){return n.map(n=>({key:n.id,task_id:t.id,kind:n.kind,event_ids:[...new Set([...n.kind===`result`?ao(e,t.id,n.ts):[],...n.eventIds])].slice(-16)}))}function so(e,t,n){let r=e.tasks.find(e=>e.id===n),i=(r?[r,...e.tasks.filter(e=>e.id!==n)]:e.tasks).map(t=>({key:t.id,task_id:t.id,kind:`task`,event_ids:[...new Set([...ao(e,t.id),...e.events.filter(e=>e.item_id===t.id).slice(-2).map(e=>e.id)])]})),a=r?oo(e,r,t):[];return[...i.slice(0,1),...a,...i.slice(1)]}var co=new Set([`life.planner.task_added`,`life.mission.started`,`round.main.completed`,`round.review.completed`,`turn.asked`,`turn.replied`]);function lo(e,t,n=ae(),r){return he(`project`,e,t,e,n,r)}function uo(e,t){let n=t.mission.started_at??e.backlog.find(e=>e.id===t.mission.id)?.started_ts??0,r=Number.isFinite(n)&&n>=0?n:0;return{mode:`current`,since:r,eventSince:r,taskId:t.mission.id}}function fo(e,t){return[`research-brief-map`,e,t.taskId,t.since,t.eventSince]}function po(e,t,n){if(e.id!==`live:${t}`||!Array.isArray(e.tasks)||!Array.isArray(e.events))throw Error(`The task records do not match this project.`);return{...e,tasks:e.tasks.filter(e=>e.id===n),events:e.events.filter(e=>e.item_id===n)}}function mo(e,t,n=0){if(!e||!t)return[];let r=e.events.filter(e=>e.item_id===t.id&&co.has(e.type)&&Number.isFinite(e.ts)&&e.ts>=n),i=Math.max(n,...r.filter(e=>e.type===`life.mission.started`).map(e=>e.ts)),a=r.filter(e=>e.ts>=i),o=new Map;for(let e of co){let t=e.startsWith(`round.`)?2:1;for(let n of a.filter(t=>t.type===e).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id)).slice(-t))o.set(n.id,n)}return[...o.values()].sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id))}function ho(e,t){return{key:e.id,task_id:e.id,kind:`task`,event_ids:t.map(e=>e.id)}}function go(e,t){return e?JSON.stringify({task:{id:e.id,title:e.title,objective:e.objective,status:e.status,summary:e.summary,acceptance_check:e.acceptance_check,goal_contribution:e.goal_contribution,plan_hypothesis:e.plan_hypothesis,non_goals:e.non_goals,outcome:e.outcome,pending_question:e.pending_question,started_ts:e.started_ts,finished_ts:e.finished_ts,attempt:e.attempt},events:t.map(e=>[e.id,e.revision??e])}):``}function _o(e){if(!e||typeof e!=`object`)return!1;let t=e;if(![`why`,`scope`,`next`].every(e=>typeof t[e]==`string`&&t[e].trim()))return!1;if(t.concept===null)return!0;if(!t.concept||typeof t.concept!=`object`)return!1;let n=t.concept;return[`name`,`explanation`,`example`,`connection`].every(e=>typeof n[e]==`string`&&n[e].trim())}function vo(e,t,n,r){return!e||!t?!1:(r?.cards[t.id]?.version??0)<14||!_o(r?.cards[t.id]?.reader_brief)||no(ho(t,n),e,r,new Map(n.map(e=>[e.id,e])))}function yo(e){return!!e&&typeof e.version==`number`&&e.version<14}function bo(e,t,n,r){return ro({source:`live:${e}`,task_id:t.id,task_title:t.title,event_ids:n.map(e=>e.id),lang:r?`zh`:`en`})}function xo(e){try{let t=JSON.parse(e||`null`);return!t||![`full`,`current`,`off`].includes(t.mode)||t.mode===`current`&&![t.since,t.eventSince].every(e=>typeof e==`number`&&Number.isFinite(e)&&e>=0)?null:t}catch{return null}}function So(e,t){if(!e||e.id!==t.id||t.reset_history)return t;let n=new Map((!t.incremental||t.tasks_complete?[]:e.tasks).map(e=>[e.id,e]));for(let e of t.tasks)n.set(e.id,e);for(let e of t.removed_task_ids||[])n.delete(e);let r=new Map(e.events.filter(e=>t.incremental&&!t.team_events_complete||e.type!==`team.task`).map(e=>[e.id,e]));for(let e of t.events)r.set(e.id,e);for(let e of t.removed_event_ids||[])r.delete(e);return j(e,{...e,...t,tasks:[...n.values()].sort((e,t)=>(e.ts||0)-(t.ts||0)||e.id.localeCompare(t.id)),events:[...r.values()].filter(e=>n.has(e.item_id))})}function Co(e,t,n){return e?t?.history_loading?400:!wo(n)||t?.events.some(e=>e.type===`team.task`&&Ti.has(e.status||``))?15e3:!1:!1}function wo(e){return e.manager_requests?.some(e=>e.status===`running`)?!1:!e.daemon.alive||e.continuous?.enabled===!1&&/pause|stop/i.test(e.continuous.done_reason||``)?!0:e.daemon.health?.state===`stopped`}var To=0,Eo=(e,t,n=0)=>[`explanation-progress`,...e,t,n];function Do(e,t,n=0){return t?[t.id,`${t.id}:active`,`${t.id}:outcome`].includes(e??``)?typeof t.started_ts==`number`&&Number.isFinite(t.started_ts)&&t.started_ts>=0?t.started_ts:n:0:n}function Oo(e,t,n){let r=++To,i=n.map(e=>Eo(t,e.key,e.startedAt));for(let t of i)e.setQueryData(t,{requestId:r,phase:null});return{update:t=>{for(let n of i)e.setQueryData(n,e=>e?.requestId===r?{requestId:r,phase:t}:e)},finish:()=>{for(let t of i)e.setQueryData(t,e=>e?.requestId===r?null:e)}}}function ko(e,t,n=0){let r=A({queryKey:Eo(e,t??``,n),queryFn:async()=>null,initialData:null,enabled:!1,staleTime:1/0,gcTime:72e5});return{active:!!r.data,phase:r.data?.phase??void 0}}function Ao(e,t){return e?{waiting_for_source:[`等待开始整理说明`,`Waiting to prepare the explanation`],planning:[`正在梳理概念与讲解顺序`,`Organizing the concepts and explanation`],writing:[`正在撰写说明`,`Writing the explanation`],reviewing:[`正在核对说明与来源`,`Checking the explanation against its sources`]}[e][+!t]:t?`正在整理说明`:`Preparing an explanation`}var jo=(e,t)=>[`reader-foundation-choice`,e,t],Mo=(e,t)=>`argus:reader-foundation:${e}:${t}`,No=e=>[`artifacts`,e,`reader`],Po=(e,t)=>[`reader-foundation-request`,e,t],Fo=(e,t)=>`${Mo(e,t)}:request`;function Io(e,t){let n=kt(Mo(e,t));if(!n)return{id:null,choice:0};try{let e=JSON.parse(n);if((typeof e?.id==`string`||e?.id===null)&&Number.isSafeInteger(e.choice)&&e.choice>=0)return e}catch{}return{id:n,choice:0}}function Lo(e,t){try{let n=JSON.parse(kt(Fo(e,t))||`null`);return typeof n?.id==`string`&&typeof n.draft?.question==`string`&&typeof n.beforeChoice==`number`?n:null}catch{return null}}function Ro(e,t,n,r){e.setQueryData(Po(t,n),r),Ot(Fo(t,n),JSON.stringify(r))}function zo(e,t,n,r){let i=e.getQueryData(Po(t,n)),a=Lo(t,n);i?.id===r&&(!a||a.id===r)&&Ro(e,t,n,null)}function Bo(e,t){return A({queryKey:Po(e,t),queryFn:k,enabled:!1,initialData:()=>Lo(e,t),staleTime:1/0,gcTime:1/0}).data??null}function Vo(e,t,n,r){let i={id:r,choice:Ho(e,t,n).choice+1};return e.setQueryData(jo(t,n),i),Ot(Mo(t,n),JSON.stringify(i)),i}function Ho(e,t,n){let r=e.getQueryData(jo(t,n)),i=Io(t,n);return r&&r.choice>=i.choice?r:i}function Uo(e,t){return A({queryKey:jo(e,t),queryFn:k,enabled:!1,initialData:()=>Io(e,t),staleTime:1/0,gcTime:1/0}).data}function Wo(e,t=ae()===`question-foundation`){return A({queryKey:No(e),queryFn:async({signal:t})=>(await R.artifacts(e,t,!0)).filter(e=>e.source===`reader_foundation`),enabled:!!e&&t,refetchInterval:e=>e.state.data?.some(e=>e.reader_foundation?.state===`generating`)?5e3:!1,retry:!1,refetchOnWindowFocus:!1})}function Go({sid:e,snapshot:t,view:n,active:r,readOnly:i=!1,allowGeneration:a=!0,locale:o,preview:s=ae(),foundationId:c}){let l=M(),u=n.mission.id,d=uo(t,n),f=fo(e,d),p=Uo(e,o),m=s===`question-foundation`?c===void 0?p.id:c:null,h=s===`question-foundation`&&!m,g=lo(e,o,s,m),_=r&&!!e&&!!u&&t.session.id===e,v=A({queryKey:f,queryFn:async({signal:t})=>{let n=l.getQueryData(f),r=po(await R.liveMap(e,t,n?.cursor,d),e,u);return So(l.getQueryData(f),r)},enabled:_,refetchInterval:_?15e3:!1,staleTime:1e4,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),y=A({queryKey:g,queryFn:async({signal:t})=>{let n=s===`question-foundation`?await R.mapCopy(`project`,e,o,t,e,s,m):await R.mapCopy(`project`,e,o,t,e,s),r=l.getQueryData(g);return to(r,n,r?.model_revision)},enabled:_,staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),b=v.data?.tasks.find(e=>e.id===u),x=Do(u,b,d.eventSince),S=ko(g,u,x),C=(0,G.useMemo)(()=>mo(v.data,b,d.eventSince),[v.data,b,d.eventSince]),w=go(b,C),T=u?y.data?.cards[u]:void 0,E=(T?.version??0)>=14&&_o(T?.reader_brief)?T.reader_brief:void 0,D=vo(v.data,b,C,y.data),O=yo(y.data),k=_&&a&&!i&&!h&&!!b&&y.data?.available===!0&&!O&&!v.isError&&!y.isError,j=[`research-brief-generation`,e,u,o,d.eventSince,s,...s===`question-foundation`?[m]:[]],N=Math.max(14,y.data?.version??0),P=[...j,N,y.data?.model_revision??null,w],F=ee({queryKey:j}),te=l.getQueryState(P)?.status===`error`,ne=A({queryKey:P,queryFn:async()=>{if(!b)throw Error(`The current task is not recorded yet.`);let t=l.getQueryData(g)?.model_revision,n=Oo(l,g,[{key:b.id,startedAt:x}]),r;try{r=await R.generateMapCopy(`project`,e,{cards:[ho(b,C)],locale:o,...m?{foundation_id:m}:{}},void 0,e,s,n.update)}finally{n.finish()}let i=r.cards?.[b.id],a={available:(i?.version??0)>=14&&_o(i?.reader_brief)&&!r.retry_after&&r.available!==!1&&(i?.version??0)>=N&&!!v.data&&!no(ho(b,C),v.data,r,new Map(C.map(e=>[e.id,e]))),retryAfter:r.retry_after??null,inputSignature:w};return l.setQueryData(g,e=>to(e,r,t)),a},enabled:k&&D&&!te&&F===0,staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),re=ne.data?.retryAfter;return(0,G.useEffect)(()=>{if(!k||!D||ne.isFetching||ne.isError||ne.data?.available!==!1||typeof re!=`number`||!Number.isFinite(re)||re<=0)return;let e=setTimeout(()=>{ne.refetch({cancelRefetch:!1})},Math.max(0,ne.dataUpdatedAt+re*1e3-Date.now()));return()=>clearTimeout(e)},[k,D,ne.isFetching,ne.isError,ne.data?.available,ne.dataUpdatedAt,re,ne.refetch]),{foundationId:m,foundationRequired:h,questionContext:{locale:o===`zh-CN`?`zh-CN`:`en-US`,preview:s,foundationId:m},task:b,evidence:C,loadedEvents:v.data?.events,card:T,brief:E,inputSignature:w,needsUpdate:D&&ne.data?.available!==!0,legacy:O,loading:_&&(v.isPending||y.isPending),generating:S.active||ne.isFetching||F>0,generationPhase:S.phase,readError:v.error||y.error,generationError:D&&!S.active?ne.error:null,generationUnavailable:ne.data?.available===!1&&D&&!S.active,generationAvailable:y.data?.available===!0,teachingUnavailable:!!E&&T?.teaching_review?.status===`unavailable`,readingUnavailable:!!E&&T?.teaching_review?.reading_review?.status===`unavailable`,retry:async()=>{_&&(v.isError||y.isError||!y.data?.available||O||!b?await Promise.allSettled([v.refetch(),y.refetch()]):k&&await ne.refetch())}}}function Ko(e){let t=new Set;return[e.primary_target,...e.targets].filter(e=>!e?.path||t.has(e.path)?!1:(t.add(e.path),!0))}function qo(e,t){if(t===`research`)for(let t of e){let e=Ko(t).find(e=>/(?:^|\/)paper\/main\.pdf$/i.test(e.path.replace(/\\/g,`/`)));if(e)return{receipt:t,path:e.path}}let n=e[0];return n?{receipt:n,path:Ko(n)[0]?.path||null}:null}function Jo(e){return e.replace(/\s*\bRESULT\s*=\s*/g,` + +`).replace(/\s*\b(?:STATUS|REVIEW_STATUS)\s*=\s*\S+/g,``).trim()}function Yo(e,t,n){let r=n.reduce((e,t)=>t.type===`ui.operator`?Math.max(e,Number(t.ts)||0):e,0),i=t&&(e===void 0||t.delivered_at>r)?t:null;return e?i&&i.delivered_at>e.delivered_at?i:e:i}function Xo(e,t){if(!t)return!1;let n=new Set([t]),r=[t];for(let t=0;te.id!==t&&n.has(e.id)&&[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))}var Zo=new Set([`done`,`passed`,`approved`,`accepted`]);function Qo(e,t){let n=String(e.review_status||``).toLowerCase(),r=String(e.review_source||``).toLowerCase(),i=String(e.residual_risk||``).trim();return Zo.has(n)&&r===`reviewer`&&i?{independent:!0,text:t?`独立复核通过 · 有残余风险`:`Independently reviewed · residual risk`,title:t?`有一项检查在此环境中无法进行,已被接受为残余风险:${i}`:`One check was impossible here and its risk was accepted: ${i}`}:Zo.has(n)&&r===`reviewer`?{independent:!0,text:t?`独立复核通过`:`Independently reviewed`,title:t?`另一个审查角色检查过这份成果`:`A separate reviewer checked this result`}:!n||n===`not_assessed`||Zo.has(n)&&r?{independent:!1,text:t?`实现者自检 · 未独立复核`:`Self-checked · not independently reviewed`,title:t?`只有完成它的人自己检查过,没有另外的审查`:`Only the worker that produced it checked it; no separate review`}:Zo.has(n)?{independent:!1,text:t?`已完成 · 未记录是否独立复核`:`Completed · review source not recorded`,title:t?`这份较早的交付没有记录是谁检查的,不能确认经过独立复核`:`This older delivery did not record who checked it, so independent review cannot be confirmed`}:{independent:!1,text:t?`复核状态:${n}`:`Review: ${n}`,title:t?`独立复核没有通过或已过期`:`Independent review did not pass or is out of date`}}function $o(e,t,n){if(!n)return null;let r=e.snapshots?.find(e=>e.path===n&&e.stored);if(!r)return null;let i=t.filter(t=>t.delivery_id!==e.delivery_id&&t.delivered_att.delivered_at-e.delivered_at);for(let e of i){let t=e.snapshots?.find(e=>e.path===n);if(!(!t||t.sha256===r.sha256))return t.stored?{path:n,before:t.sha256,after:r.sha256}:null}return null}var es=[1,0],ts=[{id:`up`,vector:[0,1],zh:`向上 1 格`,en:`Up 1 square`},{id:`right`,vector:[2,0],zh:`向右 2 格`,en:`Right 2 squares`},{id:`fraction`,vector:[1.5,0],zh:`向右 1.5 格`,en:`Right 1.5 squares`},{id:`zero`,vector:[0,0],zh:`留在原点`,en:`Stay at the origin`}];function ns(e,t){return e[0]*t[1]-e[1]*t[0]===0?e.some(Boolean)||t.some(Boolean)?1:0:2}function rs(e){if(!e)return!1;let t=[e.name,e.explanation,e.example,e.connection].join(` `);return/独立(?:的)?方向|线性(?:无关|独立)|independent\s+directions?\b|linear\s+independence\b|linearly\s+independent\b/iu.test(t)}function is(){let{locale:e}=z(),t=e===`zh-CN`,n=(e,n)=>t?e:n,[r,i]=(0,G.useState)(ts[0]),a=(0,G.useId)(),o=r.vector,s=ns(es,o),c=e=>62+e*36,l=e=>116-e*36,u=r.id===`up`?n(`只沿 A 左右移动,走不到 B 的终点;B 补上了上下方向。`,`Moving left or right along A cannot reach B’s endpoint. B adds an up-and-down direction.`):r.id===`right`?n(`走两次 A 就能代替 B。步子更长,并没有增加独立方向。`,`Two copies of A replace B. A longer step does not add an independent direction.`):r.id===`fraction`?n(`走两次 B 和走三次 A,都向右走了 3 格。虽然两者互相都不是整数倍,仍只有一个独立方向。`,`Two copies of B and three copies of A both move 3 squares right. Neither is an integer multiple of the other, but they still provide only one independent direction.`):n(`B 没有移动,没有增加方向;A 仍提供一个独立方向。`,`B does not move, so it adds no direction. A still provides one independent direction.`),d=n(`这两支箭头提供 ${s} 个独立方向`,`These two arrows provide ${s} independent direction${s===1?``:`s`}`);return(0,J.jsxs)(`section`,{className:`my-2 rounded-lg border border-line bg-surface p-3`,"aria-label":n(`平面上的独立方向示意`,`Independent directions in a plane`),"data-testid":`direction-example`,children:[(0,J.jsx)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:n(`A 固定向右走 1 格。改变 B,看看它是否提供新的走法。允许把箭头缩放、反向,再相加。`,`A always moves 1 square right. Change B to see whether it adds a new way to move. Arrows may be scaled, reversed, and added.`)}),(0,J.jsxs)(`svg`,{viewBox:`0 0 210 180`,className:`mx-auto my-2 block w-full max-w-[260px]`,role:`img`,"aria-labelledby":`${a}-title ${a}-desc`,children:[(0,J.jsx)(`title`,{id:`${a}-title`,children:d}),(0,J.jsx)(`desc`,{id:`${a}-desc`,children:`A = (1, 0), B = (${o[0]}, ${o[1]}). ${u}`}),(0,J.jsxs)(`defs`,{children:[(0,J.jsx)(`marker`,{id:`${a}-a`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,J.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:B.accent})}),(0,J.jsx)(`marker`,{id:`${a}-b`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,J.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:B.success})})]}),(0,J.jsx)(`rect`,{x:`20`,y:`32`,width:`165`,height:`125`,rx:`4`,fill:B.accent,opacity:s===2?.07:0}),[-1,0,1,2,3].map(e=>(0,J.jsx)(`line`,{x1:c(e),x2:c(e),y1:`32`,y2:`157`,stroke:`rgb(var(--line))`},`x${e}`)),[-1,0,1,2].map(e=>(0,J.jsx)(`line`,{y1:l(e),y2:l(e),x1:`20`,x2:`185`,stroke:`rgb(var(--line))`},`y${e}`)),s===1?(0,J.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:B.accent,strokeWidth:`10`,opacity:`.09`}):null,(0,J.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:B.inkFaint}),(0,J.jsx)(`line`,{x1:c(0),x2:c(0),y1:`32`,y2:`157`,stroke:B.inkFaint}),[0,1,2,3].map(e=>(0,J.jsx)(`text`,{x:c(e)-3,y:l(0)+14,fill:B.inkFaint,fontSize:`9`,children:e},e)),r.id===`zero`?(0,J.jsx)(`circle`,{cx:c(0),cy:l(0),r:`5`,fill:`rgb(var(--surface))`,stroke:B.success,strokeWidth:`3`,"data-testid":`direction-b-zero`}):(0,J.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(o[0]),y2:l(o[1]),stroke:B.success,strokeWidth:`3`,markerEnd:`url(#${a}-b)`,"data-testid":`direction-b`}),(0,J.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(es[0]),y2:l(es[1]),stroke:B.accent,strokeWidth:`3`,markerEnd:`url(#${a}-a)`}),(0,J.jsx)(`text`,{x:c(es[0])+3,y:l(es[1])-10,fill:B.accent,fontSize:`12`,fontWeight:`600`,children:`A`}),(0,J.jsx)(`text`,{x:c(o[0])+(r.id===`zero`?-17:8),y:l(o[1])+(r.id===`up`?-3:28),fill:B.success,fontSize:`12`,fontWeight:`600`,children:`B`})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,role:`group`,"aria-label":n(`选择 B 的走法`,`Choose B’s movement`),children:ts.map(e=>(0,J.jsx)(W,{className:`text-[11px]`,variant:r.id===e.id?`primary`:`ghost`,"aria-pressed":r.id===e.id,onClick:()=>i(e),"data-choice":e.id,children:t?e.zh:e.en},e.id))}),(0,J.jsxs)(`div`,{className:`mt-3`,"aria-live":`polite`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-ink`,"data-testid":`direction-count`,children:d}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:u})]}),(0,J.jsx)(`p`,{className:`mt-3 border-t border-line pt-2 text-[11px] leading-5 text-ink-faint`,children:n(`这里只统计这两支箭头提供的方向。找到一些独立方向,不等于已经找全研究对象的所有方向;图里的数字不能用来计算曲面的 Picard 数,也不能证明研究中的条件。`,`This counts only the directions supplied by these two arrows. Finding some independent directions does not establish that they span the whole research object. These numbers cannot determine a surface’s Picard number or prove the conditions used in the research.`)})]})}function as({path:e,identity:t,artifacts:n,onOpenArtifact:r}){let{locale:i}=z(),a=i===`zh-CN`,o={artifacts:n,onOpenArtifact:r};return(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-learning-path":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`理解这个问题`:`Understand the question`}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-question":!0,children:(0,J.jsx)(H,{...o,children:e.question})}),(0,J.jsx)(`ol`,{className:`mt-4 grid list-none gap-5 p-0`,children:e.steps.map((e,n)=>(0,J.jsxs)(`li`,{className:`min-w-0 border-t border-line/50 pt-3`,"data-learning-step":n+1,children:[(0,J.jsxs)(`h4`,{className:`mb-2 text-sm font-medium text-ink`,children:[(0,J.jsxs)(`span`,{className:`mr-2 text-ink-faint`,children:[n+1,`.`]}),e.title]}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-explanation":!0,children:(0,J.jsx)(H,{...o,children:e.explanation})}),(0,J.jsxs)(`div`,{className:`mt-3 border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-learning-example":!0,children:[(0,J.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`例子`:`Example`}),(0,J.jsx)(H,{...o,children:e.example})]}),(0,J.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,"data-learning-check":!0,children:[(0,J.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`小问题`:`Try it`}),(0,J.jsx)(`div`,{"data-learning-check-question":!0,children:(0,J.jsx)(H,{...o,children:e.check.question})}),(0,J.jsx)(ft,{label:a?`点击看解答`:`Show the answer`,children:(0,J.jsx)(`div`,{"data-learning-check-answer":!0,children:(0,J.jsx)(H,{...o,children:e.check.answer})})},`${e.check.question}:${e.check.answer}`)]})]},`${t}:${n}`))})]})}function os({value:e,expandLabel:t,clamp:n=!0}){let[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),s=(0,G.useRef)(null),{locale:c}=z();return(0,G.useEffect)(()=>{let e=s.current;if(!e||!n||r)return;let t=()=>o(e.scrollHeight>e.clientHeight+1);t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,n,r]),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{ref:s,className:`text-[13px] leading-6 text-ink-dim ${!n||r?``:`line-clamp-3`}`,children:(0,J.jsx)(H,{children:e})}),n&&(a||r)?(0,J.jsxs)(`button`,{type:`button`,className:`mt-0.5 text-xs text-blue-sky hover:underline`,onClick:()=>i(!r),"aria-expanded":r,children:[r?c===`zh-CN`?`收起`:`Show less`:t,(0,J.jsx)(Ue,{size:11,className:`ml-1 inline ${r?`rotate-180`:``}`})]}):null]})}function ss({generatedAt:e,pending:t=!1,generating:n=!1,phase:r,hasExplanation:i=!1,error:a,unavailable:o=!1,retry:s,retryDisabled:c=!1}){let{locale:l}=z(),u=l===`zh-CN`,d=Tt({ts:e}),f=d?.toLocaleString(l,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,p=!!a||o;return!(i&&(f||t))&&!n&&!p?null:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,"data-testid":`research-brief-status`,children:[i&&(f||t)?(0,J.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,children:[t?`${u?`上次说明`:`Previous explanation`}${f||!p?` · `:``}`:``,f?(0,J.jsx)(`time`,{dateTime:d?.toISOString(),title:d?.toLocaleString(l),children:f}):null,t&&!p?`${f?` · `:``}${u?`待更新`:`update pending`}`:``]}):null,p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:a?u?`说明生成未完成;不会自动重复请求。`:`The explanation could not be prepared. This request will not be repeated automatically.`:u?`说明暂未更新;可以手动重试。`:`The explanation has not been updated yet. You can retry manually.`}),s?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:n||c,onClick:()=>void s(),children:[(0,J.jsx)(Ke,{size:12}),u?`重试`:`Retry`]}):null]}):n?(0,J.jsxs)(`span`,{role:`status`,"data-explanation-phase":r??`pending`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint`,children:[(0,J.jsx)(tt,{}),Ao(r,u)]}):null]})}function cs({brief:e,identity:t,detail:n,learningPath:r,foundation:i,readingUnavailable:a=!1,teachingUnavailable:o=!1,artifacts:s,onOpenArtifact:c}){let{locale:l}=z(),u=l===`zh-CN`,d=(e,t)=>u?e:t;return(0,J.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-4`,"data-reader-explanation":t,children:[i?(0,J.jsxs)(`div`,{className:`rounded border border-line/60 p-2 text-xs text-ink-dim`,"data-foundation-id":i.id,children:[(0,J.jsxs)(`p`,{children:[d(`这次进展参考的基础说明:`,`Foundations used to explain this progress: `),i.question]}),c?(0,J.jsx)(W,{className:`mt-1 text-xs`,onClick:()=>c(i.path),children:d(`阅读这份基础说明`,`Read these foundations`)}):null]}):null,a?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`阅读说明还需要核对,可以继续问这一步。`,`The reading explanation still needs checking. You can keep asking about this step.`)}):o?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`这个概念的说明还没核对清楚,可以继续问这一步。`,`The explanation of this concept has not been checked clearly yet. You can keep asking about this step.`)}):null,r?(0,J.jsx)(as,{path:r,identity:t,artifacts:s,onOpenArtifact:c},t):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-why":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`这一步为什么有用`,`Why this step helps`)}),(0,J.jsx)(os,{value:e.why,expandLabel:d(`完整说明`,`Full explanation`),clamp:!1},`why:${t}`)]}),e.concept?(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-teaching":t,children:[(0,J.jsxs)(`h3`,{className:`mb-3 text-xs font-medium text-ink`,children:[d(`认识一个概念`,`One useful concept`),` · `,e.concept.name]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 gap-3`,"data-reader-teaching-columns":t,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,"data-reader-definition":t,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`定义`,`Definition`)}),(0,J.jsx)(os,{value:e.concept.explanation,expandLabel:d(`完整定义`,`Full definition`),clamp:!1},`concept:${t}:${e.concept.name}`)]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-testid":`concept-example`,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`例子`,`Example`)}),(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:e.concept.example})]}),rs(e.concept)?(0,J.jsx)(ft,{label:d(`动手看两个方向`,`Try two directions`),children:(0,J.jsx)(is,{})}):null]}),(0,J.jsxs)(`div`,{className:`min-w-0`,"data-reader-connection":t,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`与本步的关系`,`Connection to this step`)}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:e.concept.connection})})]})]})]}):null]}),(0,J.jsxs)(`section`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`结论到哪里为止`,`What this does and does not establish`)}),(0,J.jsx)(os,{value:e.scope,expandLabel:d(`完整适用范围`,`Full scope`),clamp:!1},`scope:${t}`)]}),(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-next-interpretation":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`解说对后续的理解`,`How the explanation interprets the follow-up`)}),(0,J.jsx)(os,{value:e.next,expandLabel:d(`完整解读`,`Full interpretation`),clamp:!1},`next:${t}`)]}),n?(0,J.jsx)(ft,{className:`min-w-0`,label:d(`详细说明与条件`,`Detailed explanation and conditions`),children:(0,J.jsx)(`div`,{className:`macro-reader-markdown text-[13px] leading-6 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:n})})},`detail:${t}`):null]})}function ls({task:e,artifacts:t,onOpenArtifact:n}){let r=z().locale===`zh-CN`,i=typeof e?.pending_question==`string`?e.pending_question.trim():``;return i?(0,J.jsxs)(`section`,{className:`mt-4 min-w-0 border-t border-line/60 pt-3 text-[13px] leading-6 text-ink-dim`,"data-reader-pending-question":e.id,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:r?`这一步在等你回答`:`This step is waiting for your answer`}),(0,J.jsx)(H,{artifacts:t,onOpenArtifact:n,children:i})]}):null}function us(e){return e.kind===`markdown`||e.mime?.split(`;`,1)[0].trim().toLowerCase()===`text/markdown`||/\.(?:md|markdown)$/i.test(e.name||e.path||``)}function ds(e){return e.title?.trim()||e.question}var fs=[{label:[`从头讲清楚`,`Explain from the beginning`],question:[`请从头讲清楚这份说明。先用日常语言解释它在讨论什么、要判断什么,再按需要解释其中的对象和符号。涉及比较或公式时,请明确两边是什么、哪些条件下能比较,并用一个可复算的小例子说明。请分别说明标准背景知识、本次已有证据和仍未知的内容。`,`Explain this reading from the beginning using everyday language. Start with what it discusses and what we are trying to determine, then explain the necessary objects and symbols. For a comparison or formula, define both sides and when the comparison is valid, and work a small example I can recompute. Distinguish standard background, evidence from this run, and what remains unknown.`]},{label:[`带我算一遍`,`Work through an example`],question:[`请带我实际算一遍这份说明中的关键一步。先解释对象、输入和运算规则,再用一组明确标为教学例子的小数据展示中间步骤与结果,然后换一个输入让我能照着计算。请说明它怎样关系到正在判断的结论,以及这个例子还不能证明什么。`,`Walk me through the key operation in this reading. Explain the objects, inputs, and rules, then use a small example clearly labeled as a teaching example to show the intermediate steps and result. Change one input and work it again so I can follow the calculation. Explain how it relates to the conclusion being assessed and what the example does not prove.`]},{label:[`这说明了什么`,`What does this establish?`],question:[`这份说明究竟支持什么结论?请用我能懂的语言解释已经验证的部分、依赖的条件、未覆盖的情况,以及它和整个任务目标的关系。解释必要概念,并指出哪些只是记录中的说法、哪些有可核对的依据。`,`What conclusion does this reading support? Explain the part that has been checked, its assumptions, the cases it does not cover, and how it relates to the overall task. Explain the necessary concepts and distinguish reported claims from conclusions with verifiable supporting evidence.`]}];function ps({draft:e,onChange:t,onSubmit:n,disabled:r,children:i}){let a=z().locale===`zh-CN`,o=!!e.parentId||!!e.progressSource,s=(0,G.useRef)(null);return(0,J.jsxs)(J.Fragment,{children:[i,o&&!e.question.trim()?(0,J.jsxs)(`div`,{className:`mb-3 space-y-2`,"data-reading-question-suggestions":!0,children:[(0,J.jsx)(`p`,{className:`text-xs text-ink-dim`,children:a?`可以从这些问题开始,也可以直接输入。`:`Start with one of these questions, or write your own.`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:fs.map(n=>(0,J.jsx)(W,{type:`button`,className:`text-xs`,disabled:r,onClick:()=>{t({...e,question:n.question[+!a]}),s.current?.focus()},children:n.label[+!a]},n.label[1]))})]}):null,(0,J.jsx)(`textarea`,{ref:s,"aria-label":a?`想理解的问题`:`Question to understand`,className:`min-h-40 w-full rounded-lg border border-line bg-bg p-3 text-sm leading-6 text-ink`,maxLength:8e3,value:e.question,onChange:n=>t({...e,question:n.target.value})}),e.sourceTitle?(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[a?`从这项任务打开:`:`Opened from this task: `,e.sourceTitle]}):null,(0,J.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,J.jsx)(W,{"data-reading-submit":!0,disabled:!e.question.trim()||r,onClick:n,children:o?a?`提问`:`Ask question`:a?`生成并保存基础说明`:`Generate and save foundations`})})]})}function ms(e){if(!e||typeof e!=`object`)return!1;let t=e;return[`source_id`,`title`,`path`,`task_id`,`card_key`].every(e=>typeof t[e]==`string`&&String(t[e]).trim())&&Number.isFinite(t.generated_at)&&t.generated_at>=0&&Number.isSafeInteger(t.copy_revision)&&t.copy_revision>=0}function hs(e){let t=e.reader_foundation;return!!t&&(t.kind??`foundation`)===`foundation`&&!t.parent_id&&!t.progress_source}function gs(e,t,n=!0){let r=M(),i=Wo(e,n),a=Bo(e,t),o=[`reader-foundation-create`,e,t],s=P({filters:{mutationKey:o,status:`pending`},select:e=>e.state.variables?.id}),c=ko(o,s.at(-1)??a?.id),l=n=>({sid:n.sid??e,locale:n.locale??t}),u=N({mutationKey:o,mutationFn:async e=>{let t=l(e),n=Oo(r,[`reader-foundation-create`,t.sid,t.locale],[{key:e.id}]);try{let r={request_id:e.id,question:e.draft.question.trim(),locale:t.locale},i=e.draft.parentId?await R.askReaderFoundation(t.sid,e.draft.parentId,r,n.update):await R.generateReaderFoundation(t.sid,{...r,...e.draft.progressSource?{progress_source:{source_id:e.draft.progressSource.source_id}}:e.draft.sourceTaskId?{source_task_id:e.draft.sourceTaskId}:{}},n.update),a=i.reader_foundation;if(a?.id!==e.id||a.locale!==t.locale)throw Error(t.locale===`zh-CN`?`说明请求的结果尚未确认。`:`The result of this explanation request is unconfirmed.`);if(e.draft.parentId&&(a.kind!==`clarification`||a.parent_id!==e.draft.parentId))throw Error(t.locale===`zh-CN`?`追问与来源说明的对应关系尚未确认。`:`The question’s connection to its source is unconfirmed.`);if(e.draft.progressSource&&(a.progress_source?.source_id!==e.draft.progressSource.source_id||!e.draft.parentId&&a.kind!==`progress_answer`))throw Error(t.locale===`zh-CN`?`回答与这版进展说明的对应关系尚未确认。`:`The answer’s connection to this progress explanation is unconfirmed.`);return i}finally{n.finish(),await r.invalidateQueries({queryKey:No(t.sid)})}},onSuccess:(e,t)=>{let n=l(t);!t.draft.parentId&&!t.draft.progressSource&&hs(e)&&e.exists&&e.reader_foundation?.state===`complete`&&Ho(r,n.sid,n.locale).choice===t.beforeChoice&&Vo(r,n.sid,n.locale,e.reader_foundation.id),r.setQueryData(No(n.sid),t=>{let n=t?.find(t=>t.path===e.path);return n&&n.reader_foundation?.state!==`generating`&&e.reader_foundation?.state===`generating`?t:[...(t??[]).filter(t=>t.path!==e.path),e]}),t.draft.progressSource||r.invalidateQueries({queryKey:[`map-copy`,`project`,n.sid]})},onError:(e,t)=>{if(e instanceof se&&e.code===`reader_source_unavailable`){let e=l(t);Ro(r,e.sid,e.locale,{...t,rejected:`reader_source_unavailable`})}},retry:!1}),d=(i.data??[]).filter(e=>e.reader_foundation?.locale===t),f=d.some(e=>e.reader_foundation?.state===`generating`),p=d.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),m=u.variables&&l(u.variables),h=m?.sid===e&&m.locale===t,g=h&&u.isPending||s.length>0||c.active,_=a?.id??(h?u.variables?.id:void 0),v=d.find(e=>e.reader_foundation?.id===_),y=v?.reader_foundation?.state===`failed`,b=v?.reader_foundation?.state===`complete`,x=a?.rejected===`reader_source_unavailable`,S=!!a&&!x&&!v&&!g,C=g||f||!!a&&!x||i.isPending||i.isError;return(0,G.useEffect)(()=>{a&&(y||b)&&zo(r,e,t,a.id)},[r,e,t,a,y,b]),{client:r,list:i,notes:d,pendingRequest:a,progress:c,generation:u,waiting:f,overdue:p,creating:g,requested:v,confirmedFailure:y,confirmedComplete:b,requestRejected:x,unknownResult:S,creationBlocked:C,submit:n=>{if(!n.question.trim()||C)return null;let i=crypto.randomUUID(),a={id:i,sid:e,locale:t,draft:{...n,...n.progressSource?{progressSource:{...n.progressSource}}:{}},beforeChoice:Ho(r,e,t).choice};return Ro(r,e,t,a),u.mutate(a),i},retrySavedRequest:n=>u.mutate({...n,sid:n.sid??e,locale:n.locale??t})}}var _s=(0,G.createContext)(null);function vs({card:e,cardKey:t,taskId:n,readOnly:r=!1,context:i}){let a=(0,G.useContext)(_s),o=z().locale===`zh-CN`,[s,c]=(0,G.useState)(`idle`),[l,u]=(0,G.useState)(!1),d=(0,G.useRef)(0),f=i??a?.context,p=JSON.stringify([a?.sid,a?.readOnly,r,f,t,n,e?.copy_revision,e?.generated_at,e?.title]),m=(0,G.useRef)(p);if(m.current=p,(0,G.useEffect)(()=>(c(`idle`),()=>{d.current+=1}),[p]),!a?.sid||a.readOnly||r)return null;let h=!!e&&Number.isSafeInteger(e.copy_revision)&&!!e.title?.trim()&&!(f?.preview===`question-foundation`&&!f.foundationId),g=async()=>{if(!h||!f||s===`opening`)return;let r=++d.current;c(`opening`);try{let i=await a.source(t,n,f);if(r!==d.current||m.current!==p)return;if(i&&(i.copy_revision!==e.copy_revision||i.generated_at!==e.generated_at||i.title!==e.title))throw new se(`The selected explanation has changed.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);c(`idle`),i&&a.open(i)}catch(e){r===d.current&&m.current===p&&(u(e instanceof se&&e.code===`reader_source_unavailable`),c(`failed`))}};return(0,J.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-1`,children:[(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:!h||s===`opening`,title:h?void 0:o?`这一步的说明写好后就可以提问。`:`Questions open once this step has an explanation.`,"data-testid":`progress-question-trigger`,"data-progress-question-card":t,"data-progress-question-state":s,onClick:()=>void g(),children:[(0,J.jsx)(sn,{size:12}),o?`问这一步`:`Ask about this step`]}),s===`failed`?(0,J.jsx)(`span`,{role:`alert`,className:`text-xs text-ink-dim`,children:l?o?`这版说明暂不可用或已变化,未打开提问。请刷新页面后再试。`:`This explanation is unavailable or has changed. No question was opened. Reload this page and try again.`:o?`暂时无法读取这一步的提问材料,未打开提问。请再试一次。`:`The question material could not be loaded. No question was opened. Please try again.`}):null]})}function ys(){let e=(0,G.useContext)(_s),t=z().locale===`zh-CN`;return e?.hasHistory?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>e.open(),children:[(0,J.jsx)(K,{size:12}),t?`阅读问答`:`Reading questions`]}):null}function bs({sid:e,path:t,artifacts:n,onOpenArtifact:r}){let i=z().locale===`zh-CN`,a=A({queryKey:[`reading-question-artifact`,e,t],queryFn:async({signal:n})=>{let r=await R.artifact(e,t,n);if(r.exists&&r.path===t&&(r.truncated||typeof r.preview!=`string`)){let i=await R.artifactBlob(e,t,!1,n);return{...r,preview:await i.text(),truncated:!1}}return r},retry:!1,staleTime:1/0,refetchOnWindowFocus:!1});return a.isPending?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:i?`正在读取保存内容…`:`Loading saved reading…`}):a.isError||!a.data?.exists||a.data.path!==t?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[i?`保存内容暂时无法读取。`:`The saved reading could not be loaded.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>void a.refetch(),children:i?`重新读取`:`Reload`})]}):(0,J.jsxs)(`div`,{className:`min-w-0 max-w-full overflow-x-auto break-words`,"data-reading-artifact-path":t,children:[(0,J.jsx)(H,{artifacts:[...n,...a.data.reader_foundation?.sources??[]],onOpenArtifact:r,children:a.data.preview??``}),a.data.truncated?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`此处显示保存内容的节选。`:`This view shows an excerpt of the saved reading.`}):null]})}function xs({sid:e,readOnly:t=!1,children:n}){let r=z().locale,i=r===`zh-CN`?`zh-CN`:`en-US`,a=i===`zh-CN`,o=gs(e??``,i,!!e),s=Uo(e??``,i).id,c=(0,G.useRef)(0),l=async(t,n,r)=>{let i=++c.current,{preview:a,foundationId:o,locale:s}=r,l=await R.mapQuestionSource(e??``,{card_key:t,task_id:n,locale:s,...a?{preview:a}:{},...a===`question-foundation`&&o?{foundation_id:o}:{}});if(i!==c.current)return null;if(!ms(l)||l.card_key!==t||l.task_id!==n||!l.path.startsWith(`reader-progress/${e}/`))throw new se(`The reading source does not match this step.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);return l},[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(null);(0,G.useEffect)(()=>(d(null),p(null),h(null),_(!1),y(null),()=>{c.current+=1}),[e,i]);let b=u&&u.sid===e&&u.locale===i?u:null,x=b?.source,S=o.notes.filter(e=>ms(e.reader_foundation?.progress_source)),C=o.pendingRequest?.draft.progressSource?o.pendingRequest:null,w=new Map;for(let t of S){let n=t.reader_foundation.progress_source;n.path.startsWith(`reader-progress/${e}/`)&&w.set(n.source_id,n)}C?.draft.progressSource&&w.set(C.draft.progressSource.source_id,C.draft.progressSource),x&&w.set(x.source_id,x);let T=[...o.list.data??[],...[...w.values()].map(e=>({path:e.path}))],E=e=>{e===x?.path?(_(!0),y(null)):y(e)},D=x?S.filter(e=>e.reader_foundation.progress_source.source_id===x.source_id):[],O=D.find(e=>e.reader_foundation?.id===m),k=O?.exists&&O.reader_foundation?.state===`complete`,A=C?.draft.progressSource?.source_id===x?.source_id?C:null,j=A?D.find(e=>e.reader_foundation?.id===A.id):void 0,M=!!A&&A.rejected===`reader_source_unavailable`,ee=!!A&&!M&&!j&&!o.creating,N=n=>{c.current+=1;let r=n??C?.draft.progressSource??[...w.values()].at(-1);if(!e||!ms(r)||!r.path.startsWith(`reader-progress/${e}/`))return;d({sid:e,locale:i,source:{...r}}),_(!1),y(null);let a=S.filter(e=>e.reader_foundation?.progress_source?.source_id===r.source_id).at(-1);h(a?.reader_foundation?.id??null),p(n&&!t?{question:``,progressSource:{...r}}:null)},P=()=>{d(null),p(null),h(null),_(!1),y(null)},F=t=>{e&&(d({sid:e,locale:i,source:{...t}}),h(null),_(!1),y(null),p(e=>e?{question:e.question,progressSource:{...t}}:null))},te=()=>{if(t||!b||!f?.progressSource||f.progressSource.source_id!==b.source.source_id||f.parentId&&!D.some(e=>e.reader_foundation?.id===f.parentId&&e.exists&&e.reader_foundation?.state===`complete`))return;let e=o.submit(f);e&&(h(e),p(null))},ne=!!A&&o.creating||D.some(e=>e.reader_foundation?.state===`generating`);return(0,J.jsxs)(_s.Provider,{value:{sid:e??``,readOnly:t,hasHistory:w.size>0,open:N,source:l,context:{locale:i,preview:ae(),foundationId:s}},children:[n,(0,J.jsx)(dt,{open:!!b,onClose:P,label:a?`进展阅读问答`:`Questions about this progress`,children:b&&x?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lt,{title:a?`哪里还不明白`:`What is still unclear`,sub:x.title}),(0,J.jsxs)(`div`,{className:`space-y-4 px-6 pb-6`,"data-testid":`progress-questions`,"data-project-id":b.sid,"data-progress-source-id":x.source_id,"data-progress-source-title":x.title,"data-reader-card":x.card_key,"data-reader-task-id":x.task_id,children:[(0,J.jsxs)(`div`,{className:`rounded-lg border border-line/70 p-3 text-xs text-ink-dim`,children:[(0,J.jsxs)(`p`,{children:[a?`引用打开提问时的这版说明:`:`Using the explanation selected when this question was opened: `,x.title]}),(0,J.jsx)(`time`,{dateTime:new Date(x.generated_at*1e3).toISOString(),className:`mt-1 block text-ink-faint`,children:new Date(x.generated_at*1e3).toLocaleString(r)}),(0,J.jsx)(W,{className:`mt-2 text-xs`,"data-reading-source-path":x.path,onClick:()=>_(e=>!e),children:g?a?`收起原说明`:`Hide original explanation`:a?`阅读当时说明`:`Read the original explanation`}),g?(0,J.jsx)(`div`,{className:`mt-3 text-[13px] leading-6`,children:(0,J.jsx)(bs,{sid:b.sid,path:x.path,artifacts:T,onOpenArtifact:E})}):null]}),w.size>1?(0,J.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`查看已保存的进展问答`:`Saved progress questions`,(0,J.jsx)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:x.source_id,disabled:o.creating,onChange:e=>{let t=w.get(e.target.value);t&&F(t)},children:[...w.values()].map(e=>(0,J.jsxs)(`option`,{value:e.source_id,children:[e.title,` · `,new Date(e.generated_at*1e3).toLocaleString(r)]},e.source_id))})]}):null,D.length?(0,J.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`已保存的问题`:`Saved questions`,(0,J.jsxs)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:m??``,onChange:e=>{h(e.target.value||null),y(null)},children:[(0,J.jsx)(`option`,{value:``,children:a?`选择一个问题`:`Choose a question`}),D.map(e=>(0,J.jsx)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,children:ds(e.reader_foundation)},e.path))]})]}):null,O?(0,J.jsxs)(`section`,{className:`space-y-3 text-[13px] leading-6`,"data-reading-question-id":O.reader_foundation.id,children:[k?(0,J.jsx)(ft,{label:a?`查看这次问题`:`View this question`,children:(0,J.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-ink-dim`,children:O.reader_foundation.question})},O.reader_foundation.id):(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words font-medium`,children:O.reader_foundation.question}),k?(0,J.jsx)(bs,{sid:b.sid,path:O.path,artifacts:T,onOpenArtifact:E}):(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:O.reader_foundation.state===`generating`?a?`回答仍在整理,尚未确认结束。`:`The answer is still being prepared; completion is unconfirmed.`:a?`这次回答未完成,原问题已保留。`:`This answer did not finish; its question is retained.`}),!t&&O.exists&&O.reader_foundation.state===`complete`?(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x},parentId:O.reader_foundation.id,parentTitle:ds(O.reader_foundation)}),children:a?`继续问这份回答`:`Ask a follow-up to this answer`}):null,!t&&O.reader_foundation.state===`failed`?(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:O.reader_foundation.question,progressSource:{...x},parentId:O.reader_foundation.parent_id??void 0}),children:a?`重新编辑问题`:`Edit this question`}):null]}):null,v?(0,J.jsxs)(`section`,{className:`space-y-2 rounded-lg border border-line/70 p-3 text-[13px] leading-6`,"data-referenced-reading-path":v,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{children:a?`引用的保存内容`:`Referenced saved reading`}),(0,J.jsx)(W,{className:`text-xs`,onClick:()=>y(null),children:a?`收起引用`:`Close referenced reading`})]}),(0,J.jsx)(bs,{sid:b.sid,path:v,artifacts:T,onOpenArtifact:E})]}):null,ne?(0,J.jsx)(ss,{generating:!0,phase:A?o.progress.phase:void 0}):null,A?(0,J.jsxs)(`div`,{className:`space-y-2 text-xs text-ink-faint`,"data-pending-reading-question":A.id,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:A.draft.question}),M?(0,J.jsx)(`p`,{role:`status`,children:a?`引用的说明目前不可用,这次追问未发起。问题与原来源已保留。`:`The reading source is unavailable, so this question was not started. Its question and original source are saved.`}):ee?(0,J.jsx)(`p`,{role:`status`,children:a?`这次请求的结果尚未确认;刷新不会重新生成。`:`The result of this request is unconfirmed. Refreshing does not generate it again.`}):null,!t&&!o.creating&&!o.waiting?(0,J.jsx)(W,{className:`text-xs`,onClick:()=>{M?(p({...A.draft}),o.generation.reset()):o.retrySavedRequest(A)},children:M?a?`编辑问题与来源`:`Edit question and source`:a?`重试同一请求`:`Retry this same request`}):null]}):C&&o.creationBlocked?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`另一个阅读请求尚未结束。`:`Another reading request is still unresolved.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>N(),children:a?`查看原问题`:`View the original question`})]}):null,o.list.isError?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`保存的问答暂时读取失败。`:`Saved questions could not be loaded.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>void o.list.refetch(),children:a?`重新读取`:`Reload`})]}):null,f&&!t?(0,J.jsxs)(`section`,{className:`border-t border-line/60 pt-3`,children:[f.parentId?(0,J.jsxs)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:[a?`继续引用这份回答:`:`Following up on this answer: `,f.parentTitle||D.find(e=>e.reader_foundation?.id===f.parentId)?.reader_foundation?.question]}):null,(0,J.jsx)(ps,{draft:f,onChange:p,onSubmit:te,disabled:o.creationBlocked})]}):t?null:(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x}}),children:a?`问这版说明`:`Ask about this explanation`})]})]}):null})]})}function Ss({cardKey:e,taskId:t,card:n,task:r,originalDetail:i,selection:a,artifacts:o,onOpenArtifact:s,readOnly:c}){let{locale:l}=z(),u=l===`zh-CN`;if(r?.turn_kind===`qa`)return(0,J.jsx)(`div`,{className:`macro-reader-markdown`,"data-reader-card":e,"data-reader-task-id":t,children:(0,J.jsx)(H,{artifacts:o,onOpenArtifact:s,children:i})});let d=a?.request.key===e&&a.request.task_id===t?a:void 0,f=(n?.version??0)>=14&&_o(n?.reader_brief)?n.reader_brief:void 0;return(0,J.jsxs)(`div`,{className:`font-sans`,"data-reader-card":e,"data-reader-task-id":t,children:[(0,J.jsx)(ss,{generatedAt:n?.generated_at,pending:d?.pending,generating:d?.generating,hasExplanation:!!n,phase:d?.phase,error:d?.error,unavailable:d?.unavailable,retry:d?.retry,retryDisabled:d?.retryDisabled}),d?.foundationRequired?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:u?`先在“问题基础”里选择一份说明,再阅读本次进展的解释。`:`Choose a saved foundation to explain this progress.`}):null,f?(0,J.jsx)(cs,{brief:f,identity:e,detail:n?.detail,learningPath:n?.learning_path,foundation:n?.foundation_ref,readingUnavailable:n?.teaching_review?.reading_review?.status===`unavailable`,teachingUnavailable:n?.teaching_review?.status===`unavailable`,artifacts:o,onOpenArtifact:s}):(0,J.jsx)(`div`,{className:`macro-reader-markdown`,children:(0,J.jsx)(H,{artifacts:o,onOpenArtifact:s,children:Jo(n?.detail||i)})}),(0,J.jsx)(ls,{task:r?.id===t?r:void 0,artifacts:o,onOpenArtifact:s}),(0,J.jsx)(`div`,{className:`my-3`,children:(0,J.jsx)(vs,{card:n,cardKey:e,taskId:t,readOnly:c,context:d?.questionContext})})]})}var Cs=e=>[`research-method`,e],ws={proven:`ok`,contradicted:`warning`,partial:`caution`,untested:`muted`,unchecked:`pending`};function Ts(e){return ws[e]??`unknown`}var Es={ok:`text-ok border-ok/40 bg-ok/5`,warning:`text-warn border-warn/50 bg-warn/10 font-medium`,caution:`text-warn/80 border-warn/30`,muted:`text-ink-faint border-line/40`,pending:`text-ink-faint border-line/40 italic`,unknown:`text-ink-dim border-line/50`};function Ds(e,t){switch(e){case`proven`:return t(`已证实`,`proven`);case`contradicted`:return t(`被推翻`,`contradicted`);case`partial`:return t(`部分证实`,`partial`);case`untested`:return t(`无测试`,`untested`);case`unchecked`:return t(`未运行`,`unchecked`);default:return e||`—`}}function Os({status:e,text:t}){let n=Ts(e);return(0,J.jsx)(`span`,{className:`inline-block whitespace-nowrap rounded border px-1.5 py-0.5 text-[11px] leading-4 ${Es[n]}`,"data-method-status":e,"data-method-status-tone":n,children:Ds(e,t)})}var ks=new Set([`FAILED`,`ERROR`]);function As(e,t){if(!e.length)return{label:`—`,title:t(`没有测试带这个组件的标记`,`No test carries this component marker`),failing:0};let n=new Map;for(let t of e)n.set(t.kind||`invariant`,(n.get(t.kind||`invariant`)??0)+1);let r=[...n.entries()].map(([e,t])=>`${e} ×${t}`).join(`, `),i=e.filter(e=>ks.has((e.outcome??``).toUpperCase())).map(e=>e.id),a=t(`${e.length} 个测试`,`${e.length} ${e.length===1?`test`:`tests`}`),o=i.length?`${t(`失败`,`Failing`)}: ${i.join(` +`)}`:e.map(e=>`${e.id} — ${e.outcome??t(`未运行`,`not run`)}`).join(` +`);return{label:`${a} · ${r}`,title:o,failing:i.length}}function js({tests:e,text:t}){let n=As(e,t);return(0,J.jsx)(`span`,{className:`whitespace-nowrap text-[11px] ${n.failing?`text-warn`:`text-ink-faint`}`,title:n.title,"data-method-tests":e.length,"data-method-failing":n.failing,children:n.label})}function Ms(e){if(e==null||e===``)return null;let t=typeof e==`number`?new Date(e<0xe8d4a51000?e*1e3:e):new Date(e);return Number.isNaN(t.getTime())?null:t}var Ns=e=>e?(0,J.jsx)(H,{children:e}):(0,J.jsx)(`span`,{className:`text-ink-faint`,children:`—`});function Ps({children:e}){return(0,J.jsx)(`h3`,{className:`text-xs font-semibold text-ink`,children:e})}var Fs=`text-[11px] uppercase tracking-wide text-ink-faint`,Is=`pb-1 pr-3 font-medium`;function Ls({rows:e,text:t}){return e.length?(0,J.jsx)(`div`,{className:`mt-2 overflow-x-auto`,"data-testid":`method-components`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Fs,children:[(0,J.jsx)(`th`,{className:Is,children:t(`组件`,`Component`)}),(0,J.jsx)(`th`,{className:Is,children:t(`方法规定`,`Prescribes`)}),(0,J.jsx)(`th`,{className:Is,children:t(`备注`,`Notes`)}),(0,J.jsx)(`th`,{className:Is,children:t(`状态`,`Status`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`测试`,`Tests`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-component":e.component,children:[(0,J.jsx)(`td`,{className:`py-1 pr-3 font-medium text-ink`,children:Ns(e.component)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:Ns(e.prescribes)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:Ns(e.notes??``)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:(0,J.jsx)(Os,{status:e.status,text:t})}),(0,J.jsx)(`td`,{className:`py-1`,children:(0,J.jsx)(js,{tests:e.tests??[],text:t})})]},`${e.component}-${n}`))})]})}):null}function Rs({rows:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,"data-testid":`method-reused-code`,children:[(0,J.jsx)(Ps,{children:t(`复用代码(从 import 扫描得出)`,`Reused code (from the import scan)`)}),(0,J.jsxs)(`table`,{className:`mt-1 w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Fs,children:[(0,J.jsx)(`th`,{className:Is,children:t(`名称`,`Name`)}),(0,J.jsx)(`th`,{className:Is,children:t(`类型`,`Kind`)}),(0,J.jsx)(`th`,{className:Is,children:t(`版本 / 修订`,`Revision / version`)}),(0,J.jsx)(`th`,{className:Is,children:t(`用到的模块`,`Modules`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`引用处`,`Imported from`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-row":e.name,children:[(0,J.jsx)(`td`,{className:`py-1 pr-3 font-medium text-ink`,title:e.remote||void 0,children:e.name||`—`}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:e.kind===`third_party`?t(`第三方克隆`,`third_party clone`):t(`已安装包`,`package`)}),(0,J.jsx)(`td`,{className:`py-1 pr-3 font-mono text-[11px]`,children:e.revision_or_version||`—`}),(0,J.jsx)(`td`,{className:`py-1 pr-3 break-all font-mono text-[11px]`,children:e.modules?.length?e.modules.join(`, `):`—`}),(0,J.jsx)(`td`,{className:`py-1`,title:e.imported_from?.join(` +`)||void 0,children:t(`${e.imported_from?.length??0} 个文件`,`${e.imported_from?.length??0} ${e.imported_from?.length===1?`file`:`files`}`)})]},`${e.name}-${n}`))})]})]}):null}function zs({rows:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,"data-testid":`method-hyperparameters`,children:[(0,J.jsx)(Ps,{children:t(`超参数(从配置文件得出)`,`Hyperparameters (from the config files)`)}),(0,J.jsxs)(`table`,{className:`mt-1 w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Fs,children:[(0,J.jsx)(`th`,{className:Is,children:t(`键`,`Key`)}),(0,J.jsx)(`th`,{className:Is,children:t(`值`,`Value`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`为什么`,`Why`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-row":e.key,"data-method-changed":e.changed?`true`:void 0,children:[(0,J.jsxs)(`td`,{className:`py-1 pr-3 font-medium text-ink`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.key}),e.file?(0,J.jsx)(`span`,{className:`block text-[10px] font-normal text-ink-faint`,children:e.file}):null]}),(0,J.jsxs)(`td`,{className:`py-1 pr-3`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.value}),e.changed?(0,J.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center gap-1 whitespace-nowrap rounded border border-warn/40 px-1 text-[10px] leading-4 text-warn`,"data-testid":`method-hyperparameter-changed`,children:[t(`已改`,`changed`),e.previous!=null&&e.previous!==``?(0,J.jsx)(`span`,{className:`font-mono text-ink-faint line-through`,children:e.previous}):null]}):null]}),(0,J.jsx)(`td`,{className:`py-1`,children:e.why?Ns(e.why):(0,J.jsx)(`span`,{className:`text-ink-faint`,title:t(`值旁没有 # why: 注释`,`No # why: comment next to the value`),children:`—`})})]},`${e.file}:${e.key}-${n}`))})]})]}):null}function Bs({entries:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3`,"data-testid":`method-change-log`,children:[(0,J.jsx)(Ps,{children:t(`变更记录(来自 git)`,`Change log (from git)`)}),(0,J.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs text-ink-dim`,children:e.map((e,t)=>(0,J.jsxs)(`li`,{className:`flex gap-2`,title:e.files?.join(` +`)||void 0,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-ink-faint`,children:e.when}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.summary})]},`${e.when}-${t}`))})]}):null}function Vs({checks:e,locale:t,text:n}){if(!e)return null;let r=Object.entries(e.counts??{}).filter(([,e])=>e>0).map(([e,t])=>`${e} ${t}`).join(`, `),i=e.exit_code==null?n(`未结束`,`no exit code`):n(`退出码 ${e.exit_code}`,`exit ${e.exit_code}`),a=Ms(e.ran_at);return(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,"data-testid":`method-checks`,title:a?a.toLocaleString(t):void 0,children:[n(`最近一次检查:第 ${e.round_index} 轮 · ${i}`,`Latest checks: round ${e.round_index} · ${i}`),r?` · ${r}`:``,a?` · ${wt(a,t)}`:``]})}function Hs({sid:e,active:t,compact:n=!1,onOpenArtifact:r}){let{locale:i}=z(),a=i===`zh-CN`,o=(e,t)=>a?e:t,[s,c]=(0,G.useState)(!n),l=t&&!!e,u=A({queryKey:Cs(e),queryFn:({signal:t})=>R.researchMethod(e,t),enabled:l,refetchInterval:l?3e4:!1,staleTime:2e4,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}).data;if(!u||!u.exists)return null;let d=Ms(u.updated_at),f=u.components??[],p=u.unlisted_components??[];return(0,J.jsxs)(`section`,{className:`mx-4 flex min-h-0 flex-col overflow-hidden rounded-lg border border-line/70 bg-panel ${n?`my-2 px-3 py-2`:`my-3 px-4 py-3`}`,"aria-label":o(`方法卡`,`Method card`),"data-testid":`method-card`,"data-project-id":e,"data-compact":n,children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 text-left`,"aria-expanded":s,onClick:()=>c(e=>!e),children:[(0,J.jsx)(Qt,{size:16,className:`shrink-0 text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-ink`,children:o(`方法卡`,`Method card`)}),u.title?(0,J.jsx)(`span`,{className:`truncate text-xs text-ink-dim`,children:u.title}):null,(0,J.jsx)(Ue,{size:12,className:`shrink-0 text-ink-faint ${s?`rotate-180`:``}`})]}),(0,J.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,title:d?d.toLocaleString(i):void 0,children:[r?(0,J.jsx)(`button`,{type:`button`,className:`underline-offset-2 hover:underline`,onClick:()=>r(u.path),children:u.path}):u.path,d?(0,J.jsxs)(J.Fragment,{children:[` · `,o(`更新于`,`updated`),` `,wt(d,i)]}):null]})]}),s?(0,J.jsxs)(`div`,{className:`mt-2 min-h-0 overflow-y-auto overscroll-contain scroll-thin ${n?`max-h-[30vh]`:`max-h-[40vh]`}`,"data-testid":`method-card-body`,tabIndex:0,"aria-label":o(`方法说明`,`Method text`),children:[u.statement?(0,J.jsx)(`p`,{className:`text-[13px] leading-6 text-ink-dim`,"data-testid":`method-statement`,children:u.statement}):null,(0,J.jsx)(Ls,{rows:f,text:o}),f.length===0?(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o(`文档里没有组件表;下面是全文。`,`The document has no component table; the full text follows.`)}):null,p.length?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,"data-testid":`method-unlisted-components`,children:[o(`测试里标记了但卡片未列出的组件:`,`Components marked in tests but not named in the card: `),p.join(`, `)]}):null,(0,J.jsx)(Rs,{rows:u.reused_code??[],text:o}),(0,J.jsx)(zs,{rows:u.hyperparameters??[],text:o}),(0,J.jsx)(Bs,{entries:u.change_log??[],text:o}),(0,J.jsx)(Vs,{checks:u.checks,locale:i,text:o}),(0,J.jsx)(`div`,{className:`mt-3 border-t border-line/40 pt-2 text-[13px] leading-6 text-ink-dim`,"data-testid":`method-card-markdown`,children:(0,J.jsx)(H,{sid:e,onOpenArtifact:r,children:u.markdown})}),u.truncated?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,"data-testid":`method-card-truncated`,children:o(`只显示了前 64 KiB。`,`Showing only the first 64 KiB.`)}):null]}):null]})}function Us({selection:e,onOpenArtifact:t,readOnly:n}){let{locale:r}=z(),i=r===`zh-CN`,a=Go({...e,active:!0,readOnly:n}),o=e.view.mission.id,s=a.task||{id:o,title:e.view.mission.title,objective:e.view.mission.objective,status:e.view.mission.status},c=(a.brief?a.card?.title:void 0)||s.title;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lt,{title:i?`读懂这一步`:`Understand this step`,sub:c}),(0,J.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`research-brief-reading`,"data-project-id":e.sid,"data-task-id":o,children:[(0,J.jsx)(Ss,{cardKey:o,taskId:o,task:a.task,card:a.card,readOnly:n,onOpenArtifact:t,originalDetail:s.objective||e.snapshot.session.objective||``,selection:{request:ho(s,a.evidence),questionContext:a.questionContext,pending:a.needsUpdate,generating:a.generating,phase:a.generationPhase,error:a.generationError,foundationRequired:a.foundationRequired,retry:n?void 0:a.retry,retryDisabled:a.generating,unavailable:!a.foundationRequired&&(a.legacy||a.generationUnavailable||!a.loading&&!a.generationAvailable)}}),a.readError?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:i?`记录暂时读取失败;已显示内容仍保留。`:`Records could not be refreshed; previously loaded content is retained.`}):null]})]})}function Ws(e){let{locale:t}=z(),n=t===`zh-CN`,r=(e,t)=>n?e:t,i=e.compact===!0,[a,o]=(0,G.useState)(null),s=a?.sid===e.sid?a:null,c=(0,G.useRef)(null);(0,G.useEffect)(()=>{c.current&&(c.current.scrollTop=0)},[e.sid,e.view.mission.id]),(0,G.useEffect)(()=>o(null),[e.sid]);let l=Go({...e,allowGeneration:!1,locale:n?`zh-CN`:`en-US`}),{task:u,evidence:d,brief:f,card:p}=l,m=(f?p?.title:void 0)||u?.title||e.view.mission.title||r(`当前任务`,`Current task`),h=u?.objective||e.view.mission.objective||e.snapshot.session.objective,g=Tt({ts:p?.generated_at})?.toLocaleString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,_=!l.foundationRequired&&(l.legacy||l.generationUnavailable||!l.loading&&!l.generationAvailable),v=!!l.readError||!!l.generationError||_,y=(0,J.jsx)(ss,{generatedAt:p?.generated_at,pending:l.needsUpdate,generating:l.generating,phase:l.generationPhase,hasExplanation:!!f}),b=e=>(e||``).trim(),x=(l.readError?r(`任务记录暂时无法更新。`,`Task records could not be refreshed.`):l.generationError?r(`说明生成失败。`,`The explanation could not be prepared.`):_?r(`说明暂不可用。`,`Explanations are temporarily unavailable.`):``)||(l.loading?r(`正在读取任务记录。`,`Loading task records.`):l.generating?r(`正在根据任务记录整理说明。`,`Preparing an explanation from the task records.`):l.foundationRequired?r(`先在“问题基础”选择说明。`,`Choose a saved foundation for this explanation.`):r(`尚未生成说明。`,`No explanation has been saved yet.`)),S=!!l.readError||!l.generationAvailable||l.legacy||!u,C=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-ink-faint`,role:v?`status`:void 0,children:[(0,J.jsx)(`span`,{children:x}),v&&S&&e.active&&(!e.readOnly||l.readError)?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:l.generating||l.loading,onClick:()=>void l.retry(),children:[(0,J.jsx)(Ke,{size:12}),r(`重试`,`Retry`)]}):null]}),w=(0,J.jsxs)(J.Fragment,{children:[f?(0,J.jsx)(cs,{brief:f,identity:u?.id||e.view.mission.id,detail:p?.detail,learningPath:p?.learning_path,foundation:p?.foundation_ref,onOpenArtifact:e.onOpenArtifact,readingUnavailable:l.readingUnavailable,teachingUnavailable:l.teachingUnavailable}):(0,J.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,children:[b(h)===b(m)?null:(0,J.jsx)(os,{value:h||r(`任务目标尚未记录。`,`The task objective has not been recorded yet.`),expandLabel:r(`完整任务目标`,`Full task objective`)}),C]}),l.generating&&f?(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[r(`正在依据新记录更新;上方暂时保留之前的说明。`,`Updating from new records; the previous explanation remains visible above.`),g?` ${g}`:``]}):null,(0,J.jsx)(ls,{task:u,onOpenArtifact:e.onOpenArtifact}),f&&v?C:null]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Hs,{sid:e.sid,active:e.active,compact:i,onOpenArtifact:e.onOpenArtifact}),(0,J.jsxs)(`section`,{className:`mx-4 flex min-h-0 flex-col overflow-hidden rounded-lg border border-line/70 bg-panel ${i?`my-2 px-3 py-2`:`my-3 max-h-[50vh] px-4 py-3`}`,"aria-label":r(`读懂这一步`,`Understand this step`),"data-testid":`research-brief`,"data-project-id":e.sid,"data-task-id":e.view.mission.id,"data-compact":i,children:[i?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(K,{size:16,className:`shrink-0 text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-ink`,children:r(`读懂这一步`,`Understand this step`)})]}),y]}),(0,J.jsxs)(`div`,{ref:c,className:`min-h-0 overflow-y-auto overscroll-contain scroll-thin`,"data-testid":`research-brief-body`,tabIndex:0,"aria-label":r(`任务说明`,`Task explanation`),children:[(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-faint`,children:(0,J.jsx)(H,{children:m||e.view.mission.title})}),w]})]}),(0,J.jsxs)(`footer`,{className:i?`shrink-0`:`mt-2 shrink-0 border-t border-line/50 pt-2`,"data-testid":`research-brief-footer`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>o({sid:e.sid,snapshot:e.snapshot,view:e.view,locale:n?`zh-CN`:`en-US`,preview:ae(),foundationId:l.foundationId}),children:[(0,J.jsx)(K,{size:12}),r(`阅读说明`,`Read explanation`)]}),(0,J.jsx)(vs,{card:p,cardKey:e.view.mission.id,taskId:e.view.mission.id,readOnly:e.readOnly,context:l.questionContext}),e.onAsk&&u&&!e.readOnly?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>e.onAsk?.(bo(e.sid,u,d,n)),children:[(0,J.jsx)(sn,{size:12}),r(`引用任务`,`Reference task`)]}):null]}),i&&l.generating?(0,J.jsx)(`div`,{className:`mt-2`,children:y}):null]})]}),(0,J.jsx)(dt,{open:!!s,onClose:()=>o(null),label:r(`任务说明`,`Task explanation`),children:s?(0,J.jsx)(Us,{selection:s,onOpenArtifact:e.onOpenArtifact,readOnly:e.readOnly}):null})]})}var Gs=new Set([`done`,`success`,`completed`]),Ks=new Set([`research_incomplete`,`paused_no_breakthrough`,`exhausted_current_methods`]),qs=new Set([`no_progress`,`max_rounds`]),Js=new Set([`blocked`,`infra_blocked`]),Ys=new Set([`error`,`failed`,`supervisor_error`]),Xs={completed:{glyph:`🎉`,tone:`ok`,missionStatus:`complete`},incomplete:{glyph:`◌`,tone:`warn`,missionStatus:`incomplete`},stalled:{glyph:`⏸`,tone:`warn`,missionStatus:`stalled`},blocked:{glyph:`⛔`,tone:`err`,missionStatus:`blocked`},failed:{glyph:`💥`,tone:`err`,missionStatus:`failed`},ended:{glyph:`■`,tone:`info`,missionStatus:`ended`}},Zs={completed:`mission_completed`,incomplete:`mission_incomplete`,stalled:`mission_stalled`,blocked:`mission_blocked`,failed:`mission_failed`,ended:`mission_ended`},Qs={mission_completed:`The task was completed.`,mission_continued:`The task was completed and the project continues with the next one.`,mission_certified:`The final submission was checked and approved.`,mission_incomplete:`The task stopped with work still remaining.`,mission_stalled:`The task stopped because recent rounds made no useful progress.`,mission_blocked:`The task cannot continue until something outside it is resolved.`,mission_failed:`The task could not be completed.`,mission_paused:`The task was paused before it finished because {why}; its progress is saved and it can be resumed.`,mission_ended:`The task ended without a recorded outcome.`},$s={budget_exhausted:`the project reached its budget limit`,provider_cooldown:`the model service asked Argus to wait before calling again`,provider_fence:`the model provider is not accepting calls right now`,daemon_shutdown:`Argus was stopped`,operator_pause:`the operator paused the work`,operator_abort:`the operator cancelled the task`,backend_unavailable:`the model service was unavailable`,transient_error:`a temporary error interrupted the call`,permanent_error:`an error that will not clear on its own stopped the call`},ec={paused_budget:`budget_exhausted`,paused_provider_cooldown:`provider_cooldown`,paused_provider_fence:`provider_fence`,paused_daemon_shutdown:`daemon_shutdown`,paused_operator:`operator_pause`};function tc(e){return String(e??``).trim().toLowerCase()}function nc(e,t){if(e===`paused_external_work`)return`work outside Argus had to finish first`;let n=ec[e];return n?$s[n]:$s[t]?$s[t]:e.startsWith(`paused_`)?`the work was paused`:`the work was interrupted`}function rc(e){let t=tc(e);switch(t){case`completed`:case`incomplete`:case`stalled`:case`blocked`:case`failed`:case`ended`:return t;default:return null}}function ic(e){let t=tc(e.status);return e.success===!0||Gs.has(t)?`completed`:Ks.has(t)?`incomplete`:qs.has(t)?`stalled`:Js.has(t)?`blocked`:Ys.has(t)?`failed`:`ended`}function ac(e){let t=e.outcome;if(t&&typeof t==`object`&&!Array.isArray(t)){let n=t;return{execution_status:tc(n.execution_status)||ic(e),review_status:tc(n.review_status)||`not_assessed`,stage_certification:tc(n.stage_certification)||`not_assessed`,interruption_kind:tc(n.interruption_kind)||`none`,resumable:n.resumable===!0}}return{execution_status:ic(e),review_status:`not_assessed`,stage_certification:`not_assessed`,interruption_kind:tc(e.stop_kind)||`none`,resumable:e.resumable===!0}}function oc(e){if(e.success===!0&&e.campaign_continues===!0)return{outcomeClass:`completed`,kind:`mission_continued`,label:Qs.mission_continued,glyph:`↻`,tone:`info`,missionStatus:`continued`,technical:``};let t=rc(e.outcome_class)??ic(e),n=tc(e.status),r=Xs[t],i=Zs[t],a=Qs[i],o=``;if(t===`completed`&&e.final_submission_certified===!0)i=`mission_certified`,a=Qs.mission_certified;else if(t===`ended`&&(o=String(e.status??``).trim(),n.startsWith(`paused_`)||e.resumable===!0)){let t=e.outcome&&typeof e.outcome==`object`&&!Array.isArray(e.outcome)?e.outcome:{},r=tc(e.stop_kind)||tc(t.interruption_kind);i=`mission_paused`,a=Qs.mission_paused.replace(`{why}`,nc(n,r))}return{outcomeClass:t,kind:i,label:a,glyph:r.glyph,tone:r.tone,missionStatus:r.missionStatus,technical:o}}function sc(e,t){let n=typeof e==`string`?e.trim():``;return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function cc(e,t){let n=t===`zh-CN`,r=sc(e.route,40),i=sc(e.workflow_mode,40),a=sc(e.execution_task,160),o;o=r===`self`?n?`计划由 Manager 直接处理`:`Manager plans to handle this request`:i===`staged`?r===`team`?n?`计划由团队分阶段推进`:`The team plans to work in stages`:n?`计划分阶段推进`:`The plan is to work in stages`:i===`direct`?r===`team`?n?`计划由团队直接处理`:`The team plans to handle this task directly`:n?`计划直接处理这项工作`:`The plan is to handle this task directly`:n?`处理方案已确定`:`A plan is ready`,a&&(o+=`${n?`:`:`: `}${a}`);let s=``;e.lifetime===`standing`&&e.open_ended!==!1||!e.lifetime&&e.open_ended===!0?s=n?`持续跟进后续工作。`:`Keep following up on subsequent work.`:e.lifetime===`bounded_increment`?s=n?`本次只推进一个明确的增量。`:`Limit this run to one defined increment.`:e.lifetime===`bounded`&&(s=e.continuous===!0&&e.open_ended===!1?n?`完成这次目标后结束。`:`Finish once this objective is met.`:n?`范围限于本次目标。`:`Keep the work within this objective.`);let c=sc(e.reason,320),l=c&&!/^(?:\[manager\]|manager routed\b|\{)/i.test(c)&&c!==(sc(e.execution_task,320)||sc(e.objective,320))?c:``;return[o,[s,l].filter(Boolean).join(n?``:` `)].filter(Boolean).join(` +`)}function lc(e){let t=e;return t=t.replace(/^(\s*(?:authorization|proxy-authorization)\s*:).*$/gim,`$1 `),t=t.replace(/^(\s*(?:x-api-key|api-key|cookie|set-cookie)\s*:).*$/gim,`$1 `),t=t.replace(/gh[pousr]_[A-Za-z0-9]{20,}/g,``).replace(/xox[baprs]-[A-Za-z0-9-]{10,}/g,``).replace(/AKIA[0-9A-Z]{16}/g,``).replace(/\bbearer\s+[A-Za-z0-9._\-+/=]{16,}/gi,``).replace(/(?`).replace(/(?`).replace(/\b([a-z][a-z0-9+.\-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi,`$1@`),{text:e,sensitive:t!==e}}function uc(e){return lc(pe(e))}function Y(e,t){let n=String(e??``).replace(/```[a-z]*\n?/gi,``).replace(/\[([^\]]+)\]\([^)]+\)/g,`[$1]`).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}var dc=e=>e,X=(e,t)=>String(dc(e)[t]??``);function fc(e,t){return`${e} ${t}${e===1?``:`s`}`}function Z(e,t,n){return e.locale===`zh-CN`?n:t}function pc(e,t){let n=X(e,`error_code`),r=X(e,`failure_stage`),i=X(e,`stop_kind`),a=[`daemon_shutdown`,`operator_pause`,`operator_abort`].includes(i);if(n===`cancelled`&&r===`commit`&&X(e,`status`)===`issued`)return{text:Z(t,`Applying the adjustment was interrupted; the saved decision is waiting to be applied.`,`应用调整时被中断,已保存的决定等待继续处理。`),tone:`warn`};if(n===`timeout`&&r===`commit`)return{text:Z(t,`Manager reached a decision, but applying the adjustment timed out.`,`Manager 已作出判断,但应用调整超时。`),tone:`warn`};let o={trial_quota_exceeded:[`The remaining trial quota cannot cover this Manager check.`,`剩余试用额度不足以启动这次 Manager 检查。`],observation_incomplete:[`Manager could not fully read the required project evidence; this check has stopped.`,`Manager 未能完整读取所需的项目资料,这次检查已停止。`],timeout:[`The model did not respond before the Manager check timed out.`,`模型未在时限内返回,Manager 这次检查已结束。`],cancelled:[`This Manager check was cancelled.`,`已取消这次 Manager 检查。`],superseded:[`New input or evidence superseded this Manager check.`,`新的操作或证据已取代这次 Manager 检查。`]};if(Object.hasOwn(o,n)&&!(n===`cancelled`&&a))return{text:Z(t,...o[n]),tone:n===`cancelled`||n===`superseded`?`dim`:`warn`};let s={budget_exhausted:[`The project budget limit prevented this Manager check.`,`项目预算已达上限,Manager 暂未完成检查。`],provider_cooldown:[`The model service asked Manager to wait before calling again.`,`模型服务要求稍后再调用,Manager 暂未完成检查。`],provider_fence:[`The model service is not accepting calls; Manager could not finish this check.`,`模型服务当前不接受调用,Manager 未完成这次检查。`],backend_unavailable:[`The model service was unavailable for this Manager check.`,`模型服务不可用,Manager 未完成这次检查。`],transient_error:[`A temporary model service error interrupted this Manager check.`,`模型服务的临时错误中断了这次 Manager 检查。`],permanent_error:[`The model call failed; Manager could not finish this check.`,`模型调用失败,Manager 未完成这次检查。`],daemon_shutdown:[`Argus stopped, ending this Manager check.`,`Argus 已停止,这次 Manager 检查已结束。`],operator_pause:[`This Manager check was paused by your request.`,`已按你的要求暂停这次 Manager 检查。`],operator_abort:[`This Manager check was cancelled by your request.`,`已按你的要求取消这次 Manager 检查。`]};if(Object.hasOwn(s,i))return{text:Z(t,...s[i]),tone:a?`dim`:`warn`};let c=X(e,`status`);return c===`cancelled`||c===`superseded`?{text:Z(t,`This Manager check was cancelled.`,`这次 Manager 检查已取消。`),tone:`dim`}:{text:r===`commit`&&[`continue`,`wait`,`steer`].includes(X(e,`action`))?Z(t,`Manager reached a decision, but the team adjustment could not be applied.`,`Manager 已作出判断,但团队调整未能生效。`):r===`decision`?Z(t,`Manager returned a decision that could not be validated.`,`Manager 返回的判断或引用依据未通过核验。`):Z(t,`Manager could not finish this check.`,`Manager 未能完成这次检查。`),tone:`warn`}}function Q(e,t,n,r,i,a={}){let o=uc(r);return{visibility:a.visibility??(i===`err`||i===`warn`?`alert`:`normal`),role:e,labelKey:t,glyph:n,tone:i,segments:o.text?[{kind:`text`,text:o.text}]:[],expandable:a.expandable===!0,sensitive:o.sensitive||a.sensitive===!0,fallback:a.fallback===!0,rule:a.rule===!0,reasoning:a.reasoning===!0}}function mc(){return{visibility:`hidden`,role:`system`,labelKey:`event.hidden`,glyph:``,tone:`dim`,segments:[],expandable:!1,sensitive:!1,fallback:!1,rule:!1,reasoning:!1}}function hc(e,t){if(dc(e).operator_alert===!0){let n=Y(X(e,`text`)||X(e,`reason`)||e.type,170);return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,n,`err`,{rule:!0})}if(t.unknownEventPolicy===`hide`)return mc();let n=String(e.type||`?`),r=X(e,`text`).trim();return Q(`system`,`event.fallback`,`•`,`[${n}]${r?` ${r}`:``}`,`dim`,{fallback:!0})}function gc(e,t=`engineer`){return X(e,`agent_layer`)||(e.type.startsWith(`life.manager.`)?`manager`:e.type.startsWith(`life.planner.`)?`planner`:e.type.startsWith(`round.review.`)?`reviewer`:t)}function _c(e,t){let n=X(e,`phase`),r=X(e,`cause`)||X(e,`backend_error`),i=X(e,`error`);if(!n||!r)return`${Z(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} ${Y(i,t.density===`full`?160:140)}`;let a={backend:[`model service`,`模型服务`],parse:[`reading the answer`,`读取回答`],contract:[`answer shape:`,`回答格式:`],timeout:[`timed out`,`超时`]},o=a[n]?Z(t,a[n][0],a[n][1]):n,s=Number(dc(e).attempts||0),c=s>1?Z(t,` (attempt ${s})`,` (第${s}次尝试)`):``,l=`${Z(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} · ${o} ${r}${c}`;return i?`${l} · ${Z(t,`error text`,`原始错误`)}: ${i}`:l}function vc(e){let t=dc(e).round_index??dc(e).round;return typeof t==`string`||typeof t==`number`?t:`?`}function yc(e,t){let n=X(e,`kind`),r=gc(e),i=`role.${r}`;if(n===`reasoning`){if(!t.showReasoning)return mc();let n=Y(X(e,`text`),280);return n?Q(r,i,`∴`,n,`dim`,{expandable:t.density===`full`,reasoning:!0}):mc()}if(n===`assistant_message`||n===`agent_message`||n===`message`){if(re(dc(e)))return hc(e,t);let n=uc(X(e,`text`));return n.text?Q(r,i,`▌`,n.text,`bright`,{expandable:t.density===`full`,sensitive:n.sensitive}):mc()}if(n===`command_execution`){let n=X(e,`text`)||X(e,`command`)||X(e,`action_summary`),a=X(e,`status`)===`failed`?`err`:`dim`;return n?Q(r,i,`▸ $`,n,a,{expandable:t.density===`full`}):mc()}if(n===`tool_use`||n===`file_change`){let a=X(e,`text`)||X(e,`action_summary`);if(!a&&t.density===`full`)return mc();let o=n===`file_change`?Z(t,`(file change)`,`(文件变更)`):Z(t,`(tool)`,`(工具)`);return Q(r,i,n===`file_change`?`✎`:`⚙`,a||o,X(e,`status`)===`failed`?`err`:`dim`,{expandable:t.density===`full`})}if(t.density===`full`)return mc();let a=String(dc(e).text??dc(e).action_summary??``).split(` +`)[0]?.trim()??``;return a?Q(r,i,`▸`,Y(a,160),`dim`):mc()}function bc(e,t){let n=ie(dc(e).canonical_type??e.type);if(n&&n!==e.type)return bc({...e,type:n},t);switch(e.type){case`advisor.consultation.requested`:case`life.manager.supervision.issued`:return mc();case`advisor.consultation.completed`:{let t=X(e,`question`).trim(),n=X(e,`summary`).trim();return!t&&!n?mc():Q(`advisor`,`role.advisor`,`◇`,[t,n].filter(Boolean).join(` +`),`info`,{expandable:!0})}case`advisor.consultation.cancelled`:{let n=Y(X(e,`question`),160);return Q(`advisor`,`role.advisor`,`◇`,`${Z(t,`Consultation cancelled`,`已取消咨询`)}${n?` · ${n}`:``}`,`dim`)}case`advisor.consultation.failed`:case`advisor.consultation.timed_out`:case`advisor.consultation.model_mismatch`:{let n=e.type.endsWith(`model_mismatch`)?Z(t,`The provider returned a different model`,`接入返回的模型与所选模型不一致`):e.type.endsWith(`timed_out`)?Z(t,`The advisor did not respond in time`,`顾问未在时限内返回`):Z(t,`The consultation did not finish`,`顾问咨询未完成`),r=Y(X(e,`question`),160);return Q(`advisor`,`role.advisor`,`◇`,`${n}${r?` · ${r}`:``}`,`warn`,{expandable:!0})}case`life.manager.supervision.applied`:return Q(`manager`,`role.manager`,`🧭`,X(e,`summary`)||X(e,`reason`),`info`,{expandable:!0,rule:!0});case`life.peer.message.processed`:return Q(`manager`,`role.peer`,`↔`,X(e,`text`),`info`,{expandable:!0});case`life.manager.supervision.failed`:{let n=pc(e,t);return Q(`manager`,`role.manager`,`🧭`,n.text,n.tone,{expandable:!0})}case`engineer.progress`:return yc(e,t);case`life.manager.intent.started`:return Q(`manager`,`role.manager`,`🧭`,Z(t,`Working out how to handle your request…`,`正在安排处理方式…`),`info`);case`life.manager.intent.completed`:return Q(`manager`,`role.manager`,`🧭`,cc(dc(e),t.locale),`info`,{expandable:!0});case`life.manager.intent.failed`:return Q(`manager`,`role.manager`,`⚠`,_c(e,t),`err`,{expandable:t.density===`full`});case`life.manager.stage_decision`:{let n=X(e,`target_stage`)||X(e,`stage`)||X(e,`current_stage`);return Q(`manager`,`role.manager`,`🧭`,`${X(e,`action`)}${n?` → ${n}`:``} ${Y(X(e,`reason`),t.density===`full`?140:120)}`,`info`)}case`life.research.second_reading`:{let n=gc(e,`manager`),r=Y(X(e,`supported`),160),i=Z(t,`reread the evidence and reworked the plan`,`重读了证据并重排了计划`);return Q(n,`role.${n}`,`📖`,r?`${i} · ${r}`:i,`info`)}case`life.letter.written`:{let n=gc(e,`manager`);return Q(n,`role.${n}`,`✉`,Z(t,`wrote you a letter`,`给你写了一封信`),`accent`)}case`life.planner.start`:return Q(`planner`,`role.planner`,`📋`,`${Z(t,`planning`,`正在规划`)} ${Y(X(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.verdict`:return X(e,`status`)===`done`||dc(e).project_done===!0?Q(`planner`,`role.planner`,`🏁`,Z(t,`the project is finished`,`项目已完成`),`ok`):Q(`planner`,`role.planner`,`📋`,Z(t,`lined up ${X(e,`queued`)||X(e,`n`)||`next`} task(s) to do next`,`已排好 ${X(e,`queued`)||X(e,`n`)||`下一`} 个接下来要做的任务`),`accent`);case`life.planner.task_added`:return Q(`planner`,`role.planner`,`+`,`${Z(t,`added a task`,`新增任务`)} · ${Y(X(e,`title`)||X(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.task_skipped`:return Q(`planner`,`role.planner`,`⏭`,`${X(e,`skip_category`)===`paper_review_purchase_deferred`?Z(t,`put off another paper review`,`推迟了再买一次评审`):Z(t,`skipped a task already planned`,`跳过了已在计划中的任务`)} ${Y(X(e,`title`),t.density===`full`?140:120)}`,`dim`);case`life.planner.preview_skipped`:return Q(`planner`,`role.planner`,`⏭`,Z(t,`skipped the plan preview: the research Planner owns the campaign plan`,`跳过了计划预览:研究规划师负责整个计划`),`dim`);case`life.planner.normalized`:return Q(`planner`,`role.planner`,`≋`,`${Z(t,`tidied the plan`,`整理了计划`)} · ${Y(X(e,`diagnostic`),180)}`,`dim`);case`life.planner.waiting`:return Q(`planner`,`role.planner`,`⌛`,`${Z(t,`waiting`,`等待中`)} · ${Y(X(e,`reason`),180)}`,`info`);case`life.planner.waiting_woken`:return Q(`planner`,`role.planner`,`↻`,`${Z(t,`resumed`,`已唤醒`)} · ${Y(X(e,`wake_reason`),180)}`,`info`);case`life.planner.terminal_idle`:return Q(`planner`,`role.planner`,`Ⅱ`,`${Z(t,`nothing left to plan`,`暂时没有要规划的`)} · ${Y(X(e,`reason`),180)}`,`dim`);case`life.planner.verification_probe`:return t.showReasoning?Q(`planner`,`role.planner`,`⌕`,`${Z(t,`checking that the plan still holds`,`检查计划是否仍然成立`)} · ${Y(X(e,`reason`),180)}`,`dim`):mc();case`life.planner.error`:return Q(`planner`,`role.planner`,`⚠`,`${Z(t,`the Planner hit an error`,`规划者出错`)} ${Y(X(e,`error`)||X(e,`text`),t.density===`full`?160:140)}`,`err`);case`life.mission.started`:return Q(`engineer`,`role.engineer`,`🚀`,Y(X(e,`title`)||X(e,`objective`)||X(e,`text`)||Z(t,`started work on this task`,`开始做这项任务`),t.density===`full`?180:160),`info`,{rule:!0});case`round.start`:return Q(`engineer`,`role.engineer`,`──`,Z(t,`round ${vc(e)}`,`第 ${vc(e)} 轮`),`dim`,{rule:!0});case`life.phase.started`:{let n=X(e,`label`)||X(e,`phase`),r=gc(e);return n?Q(r,`role.${r}`,`🔄`,Z(t,`entering ${n}`,`进入 ${n}`),`info`):mc()}case`round.review.started`:return Q(`reviewer`,`role.reviewer`,`🔄`,Z(t,`the Reviewer checks round ${vc(e)}`,`审阅者检查第 ${vc(e)} 轮`),`info`);case`round.review.deferred`:return Q(`engineer`,`role.engineer`,`↪`,Z(t,`carries on into the next round without a review · ${Y(X(e,`next_step`),t.density===`full`?180:160)}`,`不经审阅直接进入下一轮 · ${Y(X(e,`next_step`),t.density===`full`?180:160)}`),`info`);case`round.main.completed`:return Q(`engineer`,`role.engineer`,`✅`,Z(t,`finished round ${vc(e)} of work`,`第 ${vc(e)} 轮工作已完成`),`info`);case`round.review.completed`:{if(e.review_skipped===!0)return Q(`reviewer`,`role.reviewer`,`↪`,`${Z(t,`no review this round`,`这一轮没有审阅`)} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,`info`);let n=X(e,`status`),r=n===`done`?Y(X(e,`residual_risk`),200):``;if(r)return Q(`reviewer`,`role.reviewer`,`⚠`,`${Z(t,`verified with residual risk`,`已验证,但有残余风险`)}: ${r} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,`warn`);let i=n===`done`?`ok`:n===`blocked`||n===`no_progress`?`err`:`warn`;return Q(`reviewer`,`role.reviewer`,n===`done`?`✅`:n===`blocked`||n===`no_progress`?`⛔`:`↻`,`${Tc(n,t)} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,i)}case`life.mission.completed`:{let n=oc(dc(e)),r=Y(X(e,`summary`),240),i=Y(X(e,`residual_risk`),200);return i&&n.tone===`ok`?Q(`engineer`,`role.engineer`,`⚠`,`${Z(t,`completed with residual risk`,`已完成,但有残余风险`)} · ${r.includes(i)?r:`${i}${r?` · ${r}`:``}`}`,`warn`,{rule:!0}):Q(`engineer`,`role.engineer`,n.glyph,r?`${n.label} · ${r}`:n.label,n.tone,{rule:!0})}case`life.mission.failed`:return Q(`engineer`,`role.engineer`,`❌`,`${Z(t,`this task failed`,`这项任务失败了`)} ${Y(X(e,`reason`)||X(e,`error`),t.density===`full`?160:140)}`,`err`,{rule:!0});case`loop.start`:return Q(`engineer`,`role.engineer`,`▶`,Y(X(e,`text`)||X(e,`objective`),t.density===`full`?16e3:160),`info`,{expandable:t.density===`full`});case`loop.done`:return Q(`engineer`,`role.engineer`,`🏁`,`${Z(t,`the run finished`,`这次运行结束`)} ${Y(X(e,`text`),t.density===`full`?140:120)}`,`dim`);case`life.inbox.queued`:return Q(`system`,`role.operator`,`📥`,`${Z(t,`you added guidance`,`你追加了指导`)} · ${Y(X(e,`text`),t.density===`full`?180:160)}`,`accent`);case`daemon.parked`:{let n=X(e,`replaced_by`),r=Z(t,`Argus set this project aside with its state saved`,`Argus 已把这个项目搁置,状态已保存`);return Q(`system`,`role.system`,`Ⅱ`,n?`${r} · ${Z(t,`continued as ${n}`,`由 ${n} 接续`)}`:r,`warn`,{rule:!0})}case`accounting.journal_repaired`:{let n=dc(e).damaged_lines,r=dc(e).liabilities,i=Array.isArray(n)?n.length:0,a=Array.isArray(r)?r.length:0,o=Y(X(e,`damaged_copy`),120),s=`the usage journal was repaired: ${i} damaged line(s) set aside${o?` in ${o}`:``}, ${a} call(s) written back as a liability`,c=`用量账本已修复:${i} 行损坏记录已另存${o?`到 ${o}`:``},${a} 次调用按负债记回`;return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Z(t,s,c),`warn`,{rule:!0})}case`provider.request.denied`:{let n=X(e,`provider`);return Q(`system`,`event.quota`,`⏸`,`${Z(t,`a request to ${n||`the model service`} was held back`,`发往${n||`模型服务`}的一次请求被暂缓`)} · ${Y(X(e,`reason`),160)}`,`warn`,{rule:!0})}case`round.reviewer_backend_failure`:{let n=Y(X(e,`text`),150),r=t.density===`full`?Z(t,`the Reviewer's model service is unreachable — waiting rather than going on unchecked`,`审阅者的模型服务连不上 — 先等待,不在无人审阅的情况下继续`):Z(t,`the Reviewer's model service is unreachable — waiting`,`审阅者的模型服务连不上 — 先等待`);return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${r} · ${n}`,`err`,{rule:!0})}case`round.stall`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||Z(t,t.density===`full`?`no progress this round — keeping a close eye on it`:`no progress this round`,`这一轮没有进展`),170),`warn`);case`round.escalated`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||Z(t,`many rounds without a finish — raising what is blocking the work`,`轮次已经很多还没做完 — 把外部阻碍提出来`),170),`warn`);case`life.planner.stall_escalation`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${Z(t,`the Planner is stuck`,`规划者卡住了`)} — ${Y(X(e,`reason`)||X(e,`text`),150)}`,`warn`);case`life.budget.pause`:return X(e,`stop_kind`)===`cost_unreconciled`||X(e,`reason`).startsWith(`unresolved provider cost`)?Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Q(`system`,`event.watch`,`⏸`,Z(t,`budget cap reached — paused · ${Y(X(e,`text`)||X(e,`reason`),140)}`,`已达到预算上限 — 已暂停 · ${Y(X(e,`text`)||X(e,`reason`),140)}`),`warn`);case`budget.reservation.denied`:return X(e,`reason`).startsWith(`unresolved provider cost`)?Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Q(`system`,`event.budget`,`$`,`${Z(t,`budget denied`,`预算申请被拒绝`)} — ${Y(X(e,`reason`)||X(e,`text`),t.density===`full`?160:150)}`,`err`,{rule:!0});case`budget.unpriced.blocked`:return Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`);case`budget.unpriced.acknowledged`:return Q(`system`,`event.budget`,`$`,Z(t,`Single-call cost risk approved; original usage remains pending`,`已批准单笔费用风险;原始费用仍待对账`),`warn`);case`life.lifecycle.block`:return Q(`system`,`event.watch`,`⛔`,`${Z(t,`blocked — needs you`,`卡住了 — 需要你来处理`)} · ${Y(X(e,`text`)||X(e,`reason`),150)}`,`err`,{rule:!0});case`life.daemon.idle_timeout`:return Q(`system`,`event.watch`,`🟦`,Y(X(e,`text`)||Z(t,`nothing to do for a while — standing by`,`一段时间没有事做 — 待命中`),150),`dim`);case`operator_alert`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||X(e,`reason`)||e.type,170),`err`,{rule:!0});case`life.supervisor.error`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`Argus hit an internal error while coordinating the work`,`Argus 在统筹工作时遇到内部错误`)} · ${Y(X(e,`error`),160)}`,`err`,{rule:!0});case`life.auth_failure`:return Q(`system`,`role.system`,`🔑`,Z(t,`the model service rejected the sign-in — refresh the credentials and Argus will carry on`,`模型服务拒绝了登录 — 更新凭据后 Argus 会继续`),`err`,{rule:!0});case`life.planner.deferred`:return Q(`planner`,`role.planner`,`⌛`,`${Z(t,`planning is on hold`,`规划暂缓`)} · ${Y(X(e,`reason`),180)}`,`dim`);case`life.post_mission.stop`:return Q(`system`,`role.system`,`■`,`${Z(t,`stopped after this task`,`这项任务之后停下`)} · ${Y(X(e,`reason`),180)}`,`info`);case`life.planner.final_submission_skipped`:return Q(`planner`,`role.planner`,`⏭`,`${Z(t,`dropped an outdated final-submission task`,`跳过了一项过时的最终提交任务`)} · ${Y(X(e,`title`),140)}`,`dim`);case`life.execution_host.blocked`:return Q(`system`,`event.watch`,`⛔`,Y(X(e,`reason`)||Z(t,`the program that runs code for Argus could not be started`,`为 Argus 运行代码的程序无法启动`),t.density===`full`?260:180),`err`,{rule:!0});case`life.mission.provider_configuration_disabled`:{let n=Number(dc(e).streak||0),r=Z(t,`the model configuration failed ${fc(n,`time`)} in a row — this task is paused until you decide`,`模型配置连续 ${n} 次失败 — 这项任务已暂停,等待你的决定`),i=Y(X(e,`text`),160);return Q(`system`,`event.watch`,`⛔`,i?`${r} · ${i}`:r,`err`,{rule:!0})}case`life.iteration.continued`:return Q(`critic`,`role.critic`,`🔁`,Z(t,`lined up the next iteration`,`排好了下一轮迭代`),`dim`);case`life.learned_vertical.promoted`:return Q(`manager`,`role.manager`,`★`,Z(t,`made the learned domain "${X(e,`vertical`)}" official`,`把新学到的领域「${X(e,`vertical`)}」正式收录`),`accent`);case`life.learned_vertical.promotion_failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not record "${X(e,`vertical`)}" as a formal domain`,`未能把「${X(e,`vertical`)}」收录为正式领域`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.review.waived`:return Q(`planner`,`role.planner`,`↪`,`${Z(t,`this task will skip the independent review`,`这项任务将不做独立审阅`)} · ${Y(X(e,`reason`),160)}`,`dim`);case`life.manager.feedback.exhausted`:{let n=Number(dc(e).attempts||0);return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`the Manager's objection went unanswered ${fc(n,`time`)} — planning pauses for a while`,`管理者的异议 ${n} 次未被回应 — 规划暂停一段时间`)} · ${Y(X(e,`reason`),140)}`,`warn`)}case`life.manager.feedback.persisted`:{let n=X(e,`stage`);return Q(`manager`,`role.manager`,`↩`,`${n?Z(t,`sent the plan back for another pass at ${n}`,`把计划退回 ${n} 阶段再改一轮`):Z(t,`sent the plan back for another pass`,`把计划退回再改一轮`)} · ${Y(X(e,`reason`),160)}`,`info`)}case`life.manager.goal_contract.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not save the agreed goal`,`未能保存商定的目标`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.manager.intent.superseded`:return Q(`manager`,`role.manager`,`↷`,Z(t,`a newer instruction replaced this request`,`更新的指令取代了这个请求`),`info`);case`life.manager.project_report.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not deliver the project report`,`未能送出项目报告`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.planner.completion_circuit_opened`:{let n=Number(dc(e).consecutive_rejections||0);return Q(`planner`,`role.planner`,`⏸`,Z(t,`the same completion requirement turned the plan back ${fc(n,`time`)} — pausing completion attempts until something changes`,`同一项完成要求已 ${n} 次打回计划 — 暂停完成尝试,直到情况变化`),`warn`)}case`life.planner.completion_rejected`:return Q(`manager`,`role.manager`,`↩`,`${Z(t,`the Manager did not accept the completion claim`,`管理者未接受完成的说法`)} · ${Y(X(e,`reason`),160)}`,`info`);case`life.planner.continuation_required`:return Q(`planner`,`role.planner`,`↻`,Z(t,`finished one increment; the standing objective continues`,`完成了一个增量;长期目标继续推进`),`dim`);case`life.planner.superseded`:return Q(`planner`,`role.planner`,`↷`,Z(t,`dropped an outdated planning pass after a newer instruction`,`收到更新的指令,放弃了过时的规划`),`dim`);case`life.planner.wait_overridden`:return Q(`planner`,`role.planner`,`+`,`${Z(t,`scheduled independent work instead of waiting`,`不再干等,安排了独立的工作`)} · ${Y(X(e,`task_title`),140)}`,`info`);case`life.daemon.degraded`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`Argus started, but the objective did not reach the Manager`,`Argus 已启动,但目标没有交到管理者手上`)} · ${Y(X(e,`error`),140)}`,`warn`);case`round.orphan_process_group`:return Q(`engineer`,`role.engineer`,`⚠`,dc(e).cleanup_succeeded===!0?Z(t,`background processes outlived the turn and were cleaned up`,`有后台进程在这一轮结束后仍在运行,已清理`):Z(t,`background processes outlived the turn and could not be cleaned up`,`有后台进程在这一轮结束后仍在运行,未能清理`),`warn`);case`round.model_configuration_error`:return Q(`engineer`,`role.engineer`,`⛔`,`${Z(t,`the model configuration is not usable`,`模型配置无法使用`)} · ${Y(X(e,`text`)||X(e,`error`),160)}`,`err`,{rule:!0});case`round.watchdog.retry`:{let n=Number(dc(e).attempt||0),r=Number(dc(e).max_attempts||0);return Q(`engineer`,`role.engineer`,`↻`,Z(t,`the model call failed — retrying in a fresh session (attempt ${n} of ${r})`,`模型调用失败 — 在新会话中重试(第 ${n} 次,共 ${r} 次)`),`warn`)}case`round.watchdog.retry_exhausted`:{let n=Number(dc(e).attempt||0),r=Y(X(e,`fatal_error`),140),i=Z(t,`the model call kept failing — giving up after ${fc(n,`attempt`)}`,`模型调用持续失败 — ${n} 次后放弃`);return Q(`engineer`,`role.engineer`,`⛔`,r?`${i} · ${r}`:i,`err`,{rule:!0})}case`round.backend_failure.backoff`:{let n=Math.round(Number(dc(e).seconds||0));return Q(`engineer`,`role.engineer`,`⏳`,Y(X(e,`text`)||Z(t,`the model service failed — waiting ${n}s before trying again`,`模型服务出错 — 等待 ${n} 秒后再试`),200),`warn`)}case`round.backend_failure.hold_interrupted`:return Q(`engineer`,`role.engineer`,`↪`,Y(X(e,`text`)||Z(t,`the wait after a model-service failure ended early`,`模型服务出错后的等待提前结束`),180),`info`);case`round.provider_turn_cap.restart`:return Q(`engineer`,`role.engineer`,`↻`,Z(t,`reached the per-call turn allowance — continuing the same task in a fresh session`,`达到单次调用的轮次上限 — 在新会话中继续同一任务`),`info`);case`round.provider_turn_cap.reviewer_restart`:return Q(`reviewer`,`role.reviewer`,`↻`,Z(t,`the review reached its turn allowance — restarting it in a fresh session`,`审阅达到轮次上限 — 在新会话中重新开始`),`info`);case`round.reviewer_backend_failure.backoff`:{let n=Math.round(Number(dc(e).seconds||0));return Q(`reviewer`,`role.reviewer`,`⏳`,Y(X(e,`text`),200)||Z(t,`the Reviewer's model service is unavailable — retrying in ${n}s`,`审阅者的模型服务不可用 — ${n} 秒后重试`),`warn`)}case`round.external_work_wait.started`:return Q(`engineer`,`role.engineer`,`⌛`,`${Z(t,`waiting for background work to report`,`等待后台工作汇报`)} · ${Y(X(e,`work_id`),80)}`,`dim`);case`round.external_work_wait.completed`:return Q(`engineer`,`role.engineer`,`↻`,Z(t,`background work reported — resuming`,`后台工作已汇报 — 继续`),`dim`);case`round.external_work_review.required`:return Q(`reviewer`,`role.reviewer`,`⌛`,`${Z(t,`background work finished — an independent review of its result is required before resuming`,`后台工作已结束 — 恢复前需要对其结果做一次独立审阅`)} · ${Y(X(e,`work_id`),80)}`,`dim`);case`round.external_work_review.completed`:return Q(`reviewer`,`role.reviewer`,`✓`,`${Z(t,`background work result reviewed`,`后台工作结果已审阅`)} · ${Y(X(e,`review_status`),40)}`,`dim`);case`plan.draft.failed`:return Q(`planner`,`role.planner`,`⚠`,`${Z(t,`could not draft the plan`,`未能起草计划`)} · ${Y(X(e,`reason`),140)}`,`err`);case`plan.draft.done`:{let n=Number(dc(e).steps||0);return Q(`planner`,`role.planner`,`📋`,Z(t,`drafted a plan with ${fc(n,`step`)}`,`起草了一份 ${n} 步的计划`),`dim`)}case`team.learning.review.started`:return Q(`manager`,`role.manager`,`📚`,Z(t,`reviewing what this task taught the team`,`整理这项任务给团队带来的经验`),`dim`);case`team.learning.review.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`the team learning review failed`,`团队经验整理失败`)} · ${Y(X(e,`error`),140)}`,`warn`);case`team.learning.review.completed`:{let n=Number(dc(e).created||0),r=Number(dc(e).updated||0);return Q(`manager`,`role.manager`,`📚`,Z(t,`kept ${n} new and ${r} updated team procedures`,`保留了 ${n} 条新的、${r} 条更新的团队做法`),`dim`)}case`team.learning.promotion.quarantined`:return Q(`manager`,`role.manager`,`⚠`,Z(t,`set aside a new procedure that would have judged its own work`,`搁置了一条会评判自己工作的新做法`),`warn`);case`self.learning.review.failed`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`the review of Argus's own conversation habits failed`,`对 Argus 自身对话习惯的复盘失败`)} · ${Y(X(e,`error`),140)}`,`warn`);case`domain.promotion`:return Q(`manager`,`role.manager`,`★`,Y(X(e,`text`),180),`dim`);case`idea.portfolio.formed`:{let n=dc(e).selection,r=n&&typeof n==`object`?String(n.route_id??``):``,i=Number(dc(e).route_count||0),a=Y(X(e,`text`),180),o=i>0?Z(t,`formed an idea portfolio of ${fc(i,`route`)}`,`组成了 ${i} 条思路的组合`):Z(t,`formed an idea portfolio`,`组成了思路组合`);return Q(`engineer`,`role.engineer`,`💡`,r?Z(t,`chose route ${r} from the idea portfolio`,`从思路组合中选定了路线 ${r}`):a||o,`accent`)}case`user.note`:{let n=Array.isArray(dc(e).tags)?dc(e).tags.map(String):[];if(n.includes(`config`))return mc();if(n.includes(`planner`))return Q(`planner`,`role.planner`,`📝`,Z(t,`updated the research plan`,`更新了研究计划`),`dim`);let r=Y(X(e,`summary`)||X(e,`text`)||X(e,`title`),180);return Q(`system`,`role.operator`,`📝`,`${Z(t,`you added a note`,`你添加了一条笔记`)}${r?` · ${r}`:``}`,`accent`)}case`ui.operator`:{let t=X(e,`text`);return t.trim()?Q(`system`,`role.operator`,`›`,t,`accent`,{rule:!0}):mc()}case`ui.argus`:{let n=X(e,`text`),r=dc(e).live===!0||Array.isArray(dc(e).steps)&&dc(e).steps.length>0;return n.trim()||r?Q(`manager`,`role.argus`,`▌`,n,`bright`,{expandable:t.density===`full`,rule:!0}):mc()}case`agent.io.start`:case`agent.io.stream`:case`agent.io.complete`:case`agent.io.error`:case`usage.recorded`:case`provider.request.started`:case`provider.request.completed`:case`codex.util.completed`:case`skill.cost.completed`:case`budget.reservation.created`:case`budget.reservation.settled`:case`budget.reservation.released`:case`round.checkpoint.recorded`:case`round.checkpoint.failed`:case`round.secret_redacted`:case`role.session.turn`:case`engineer.skill_maintenance.completed`:case`life.status`:case`life.mission.skipped`:case`life.mission.orphaned`:case`life.mission.requeued`:case`life.manager.plan_challenge.decided`:case`life.vertical.resolved`:case`life.manager.backend_resolved`:case`life.planner.backend_resolved`:case`life.planner.dependency_dropped`:case`life.planner.parallel_dropped`:case`life.engineer.backend_resolved`:case`life.reviewer.backend_resolved`:case`life.curator.backend_resolved`:case`life.runtime_failure.circuit_opened`:case`life.runtime_failure.circuit_blocked`:case`life.runtime_failure.canary_passed`:case`life.runtime.incident.detected`:case`life.runtime.incident.recovered`:case`life.runtime.incident.escalated`:case`life.plan.revision.proposed`:case`life.plan.revision.rejected`:case`life.plan.revision.committed`:case`life.plan.node.superseded`:case`life.lifecycle.transition`:case`life.inbox.drained`:case`life.operator_question.pending`:case`life.operator_question.answered`:case`project.completed`:case`project.completion_refused`:case`daemon.command.submitted`:case`daemon.command.completed`:case`daemon.command.rejected`:case`idea.search.started`:case`idea.search.completed`:case`idea.search.skipped`:case`venue.research.started`:case`venue.research.completed`:case`research.achievement.certified`:case`skill.library.available`:case`skill.created`:case`skill.updated`:case`skill.archived`:case`skill.tidied`:case`skill.history.compressed`:case`skill.evolution.completed`:case`wiki.initialized`:case`wiki.hook.warning`:case`wiki.created`:case`wiki.updated`:case`wiki.retired`:case`wiki.promotion.promoted`:case`wiki.promotion.demoted`:case`wiki.retired.compressed`:case`wiki.evolution.completed`:case`knowledge.learned`:case`knowledge.recalled`:case`life.planner.verdict.discarded`:case`life.manager.feedback.unresolved`:case`life.manager.project_report`:case`life.plan.revision.rolled_back`:case`life.planner.completion_circuit.notify_failed`:case`life.planner.completion_circuit_holding`:case`life.planner.external_poll_suppressed`:case`life.planner.waiting_contract.normalized`:case`life.daemon.ready`:case`plan.draft.start`:case`team.learning.review.skipped`:case`self.learning.review.started`:case`self.learning.review.completed`:case`manager.live_view.updated`:case`manager.live_view.rejected`:case`idea.portfolio.nested_skipped`:case`manager.turn.started`:case`manager.turn.cancelled`:case`life.config.parse_failed`:return hc(e,t);default:return hc(e,t)}}function xc(e){return e.segments.map(e=>e.text).join(``)}var Sc={"role.manager":[`Manager`,`Manager`],"role.planner":[`Planner`,`Planner`],"role.engineer":[`Engineer`,`Engineer`],"role.reviewer":[`Reviewer`,`Reviewer`],"role.advisor":[`Advisor`,`顾问`],"role.peer":[`Project exchange`,`项目交流`],"role.critic":[`Critic`,`Critic`],"role.system":[`Argus`,`Argus`],"role.argus":[`Argus`,`Argus`],"role.operator":[`You`,`你`],"event.notice":[`Notice`,`通知`],"event.watch":[`Watch`,`监控`],"event.budget":[`Budget`,`预算`],"event.quota":[`Quota`,`额度`],"event.fallback":[`Argus`,`Argus`],"event.hidden":[``,``]};function Cc(e,t){let n=Sc[e];if(n)return t===`zh-CN`?n[1]:n[0];let r=e.startsWith(`role.`)?e.slice(5):e;return r?`${r.slice(0,1).toUpperCase()}${r.slice(1)}`:``}function wc(e,t){let n=bc(e,t);if(n.visibility===`hidden`)return null;let r=xc(n);return!r&&!(e.type===`ui.argus`&&(e.live===!0||Array.isArray(e.steps)&&e.steps.length>0))?null:{role:n.role,labelKey:n.labelKey,label:Cc(n.labelKey,t.locale),glyph:n.glyph,text:r,tone:n.tone,rule:n.rule,reasoning:n.reasoning,expand:n.expandable,sensitive:n.sensitive}}function Tc(e,t){let n={done:[`the Reviewer was satisfied`,`审阅者认可了这一轮`],blocked:[`the Reviewer found the work stuck`,`审阅者认为工作卡住了`],no_progress:[`the Reviewer saw no progress`,`审阅者没有看到进展`]};if(!e)return Z(t,`the Reviewer gave no verdict`,`审阅者没有给出结论`);let r=n[e]??[`the Reviewer asked for another pass`,`审阅者要求再改一轮`];return Z(t,r[0],r[1])}function Ec(e,t){return t===`zh-CN`?e[0]:e[1]}function Dc(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``)}var Oc={grounding_started:[`正在阅读这项请求,弄清楚它要做什么`,`Reading the request to understand what it asks`],goal_framed:[`已经理解这项请求,项目目标已经确定。`,`The request is understood and the project goal is set.`],goal_not_understood:[`这项请求还没有被理解清楚。`,`The request could not be understood yet.`],request_not_routed:[`这项请求没能被安排下去。`,`The request could not be routed to the team.`],stage_advanced:[`研究进入了下一阶段。`,`The research moved to the next stage.`],stage_entered:[`研究进入「{stage}」阶段。`,`The research moved to the {stage} stage.`],stage_held:[`当前阶段暂不推进。`,`The current stage is on hold.`],stage_rolled_back:[`研究退回到了前一阶段。`,`The research went back a stage.`],stage_completed:[`当前阶段已完成。`,`The current stage is complete.`],stage_reconsidered:[`阶段安排已重新考虑。`,`The stage plan was reconsidered.`],stage_reviewed:[`阶段已复核。`,`The stage was reviewed.`],planning_started:[`正在规划下一步工作`,`Planning the next step`],task_added:[`计划中加入了一项新任务。`,`A new task was added to the plan.`],research_route_added:[`计划中加入了一条新的研究路线。`,`A new research route was added to the plan.`],planning_complete:[`下一步的计划已经排好。`,`The next step is planned.`],project_finished:[`项目已经完成。`,`The project is finished.`],task_delivered:[`成果已交付。`,`The result was delivered.`],planner_waiting:[`规划者在等待前一步完成。`,`The Planner is waiting for the previous step.`],planner_idle:[`暂时没有需要规划的工作。`,`Nothing to plan right now.`],planning_failed:[`这次规划没有成功。`,`Planning did not succeed this time.`],mission_started:[`开始处理这项任务`,`Work on the task started`],awaiting_engineer:[`等待工程师完成这一轮。`,`Waiting for the Engineer to finish the round.`],waiting_external:[`等待外部工作完成。`,`Waiting on work outside Argus.`],mission_completed:[`任务已完成。`,`The task is complete.`],mission_continued:[`任务将继续进行。`,`The task continues.`],mission_certified:[`成果已通过独立核对。`,`The result passed an independent check.`],mission_incomplete:[`任务没有完成。`,`The task was not completed.`],mission_stalled:[`任务停滞不前。`,`The task stalled.`],mission_blocked:[`任务被挡住了。`,`The task is blocked.`],mission_failed:[`任务没能完成。`,`The task could not be completed.`],mission_paused:[`任务在完成前暂停;进度已保存,可以继续。`,`The task was paused before it finished; its progress is saved and it can be resumed.`],mission_ended:[`任务已结束。`,`The task ended.`],mission_ready:[`可以开始新任务。`,`Ready for a new task.`],round_in_progress:[`这一轮正在进行。`,`The round is in progress.`],round_running:[`第 {n} 轮正在进行。`,`Round {n} is in progress.`],round_started:[`第 {n} 轮工作开始。`,`Round {n} started.`],progress_tool:[`正在使用工具`,`Using a tool`],progress_command:[`正在运行命令`,`Running a command`],progress_message:[`正在汇报进展`,`Reporting progress`],progress_file:[`正在更新项目文件`,`Updating project files`],progress_inspecting:[`正在查看项目状态`,`Looking at the project state`],engineer_round_finished:[`工程师完成了这一轮,结果已准备好供核对。`,`The Engineer finished the round; the result is ready to be checked.`],checking_started:[`正在阅读工程师的结果并核对证据`,`Reading the Engineer's result and checking the evidence`],continuing_before_check:[`先继续下一轮,核对稍后进行。`,`Continuing to the next round; the check comes later.`],check_postponed:[`这一轮的核对推迟了。`,`The check of this round was postponed.`],round_not_judged:[`这一轮没有人审阅。`,`No one reviewed this round.`],results_accepted:[`结果通过了核对。`,`The result passed the check.`],another_attempt_requested:[`审阅者要求再试一次。`,`The reviewer asked for another attempt.`],attempt_blocked:[`这次尝试被挡住了。`,`This attempt is blocked.`],replan_requested:[`审阅者要求重新规划。`,`The reviewer asked for a new plan.`],results_not_final:[`结果还不是最终的。`,`The result is not final yet.`],handed_off:[`已交给下一位。`,`Handed off to the next role.`],waiting:[`等待中`,`Waiting`],live_activity:[`正在工作`,`Working`],role_failed:[`{role} 执行失败`,`{role} failed`],capability_unlocked:[`解锁了一项新能力。`,`A new capability was unlocked.`],capability_upgraded:[`一项能力得到了升级。`,`A capability was upgraded.`],capability_promoted:[`一项能力被提升为来源。`,`A capability was promoted to a source.`],knowledge_captured:[`记下了一条新知识。`,`New knowledge was captured.`],knowledge_refined:[`一条知识得到了完善。`,`A piece of knowledge was refined.`],knowledge_promoted:[`一条知识被提升。`,`A piece of knowledge was promoted.`],knowledge_demoted:[`一条知识被降级。`,`A piece of knowledge was demoted.`],knowledge_retired:[`一条知识已退役。`,`A piece of knowledge was retired.`],"event.model_call.started":[`开始调用模型`,`Model call started`],"event.model_call.completed":[`模型调用完成`,`Model call completed`],"event.model_call.failed":[`模型调用失败`,`Model call failed`],"event.usage.recorded":[`已记录用量`,`Usage recorded`],"event.budget.reserved":[`已预留预算`,`Budget reserved`],"event.budget.settled":[`预算已结算`,`Budget settled`],"event.model_turn":[`与模型完成一次往返`,`One exchange with the model`],"event.instruction.received":[`收到你的指令`,`Your instruction was received`],"event.instruction.done":[`指令已执行`,`Instruction carried out`],"event.inbox.processed":[`已处理收件箱`,`Inbox processed`],"event.round.started":[`新的一轮开始`,`A new round started`],"event.round.finished":[`执行者完成了这一轮`,`The Engineer finished the round`],"event.review.finished":[`这一轮的审阅结束`,`Review of the round finished`],"event.retry.waiting":[`等待后重试`,`Waiting before retrying`],"event.retry.interrupted":[`等待被打断`,`The wait was interrupted`],"event.status":[`状态更新`,`Status update`],"event.planning.started":[`开始规划`,`Planning started`],"event.planning.failed":[`规划没有完成`,`Planning did not complete`],"event.planning.tidied":[`计划已整理`,`Plan tidied`],"event.planning.decided":[`规划结论`,`Planning decision`],"event.task.started":[`开始执行任务`,`Task execution started`],"event.task.ended":[`任务执行结束`,`Task execution ended`],"event.skills.ready":[`技能库已就绪`,`Skill library ready`],"event.routes.formed":[`已形成候选路线组合`,`Candidate route portfolio formed`],"event.lessons.skipped":[`本次没有总结经验`,`No lessons recorded this time`],"event.argus.reply":[`Argus 的回复`,`Reply from Argus`]},kc={daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],paused_daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],operator_pause:[`你暂停了它`,`you paused it`],paused_operator:[`你暂停了它`,`you paused it`],operator_abort:[`你停止了它`,`you stopped it`],budget_exhausted:[`预算用完了`,`the budget ran out`],budget_pause:[`预算用完了`,`the budget ran out`],paused_budget:[`预算用完了`,`the budget ran out`],provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],paused_provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],provider_fence:[`模型服务不可用`,`the model service is unavailable`],paused_provider_fence:[`模型服务不可用`,`the model service is unavailable`],backend_unavailable:[`模型服务不可用`,`the model service is unavailable`],transient_error:[`出现了暂时性的问题`,`a temporary problem came up`],permanent_error:[`遇到了无法自动恢复的错误`,`an error could not be recovered from`],operator_input_required:[`需要你的回复`,`your reply is needed`],planner_empty_plan:[`需要一份新的计划`,`a new plan is needed`]},Ac={pending:[`待开始`,`Waiting`],queued:[`待开始`,`Waiting`],not_started:[`待开始`,`Not started`],waiting:[`等待中`,`Waiting`],idle:[`空闲`,`Idle`],running:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],active:[`进行中`,`In progress`],working:[`进行中`,`In progress`],framed:[`已明确目标`,`Objective settled`],grounding:[`了解项目中`,`Getting oriented`],planned:[`已规划`,`Planned`],done:[`已完成`,`Done`],complete:[`已完成`,`Done`],completed:[`已完成`,`Done`],success:[`已完成`,`Done`],accepted:[`已完成`,`Done`],failed:[`失败`,`Failed`],error:[`出错`,`Failed`],blocked:[`受阻`,`Blocked`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],skipped:[`已跳过`,`Skipped`],ended:[`已结束`,`Ended`],incomplete:[`未完成`,`Not finished`],stalled:[`停滞`,`Stalled`],paused:[`已暂停`,`Paused`],stopped:[`已停止`,`Stopped`],cancelled:[`已停止`,`Stopped`],aborted:[`已停止`,`Stopped`],paused_external_work:[`等待外部工作完成`,`Waiting for external work`],superseded:[`已由新方案替代`,`Replaced by a newer plan`]},jc={engineer_service_dropped:[`模型服务在工程师得出可核对的结果之前中断了会话,因此没有可以审阅的内容。Argus 会换一个新会话重试。`,`The model service dropped the session before the Engineer produced a checkable result, so there was nothing to review. Argus will retry in a fresh session.`],reviewer_unreachable:[`审阅者的会话在得出结论前就结束了,Argus 会再试一次。`,`The reviewer's session ended before it reached a conclusion; Argus will try again.`],argus_stopped:[`Argus 被停止了,任务随之暂停。`,`Argus was stopped, so the task paused.`],task_cancelled:[`这项任务被取消了。`,`The task was cancelled.`],session_length_limit:[`这一轮达到了单次会话的长度上限;已做的工作保留,会在新的会话里继续。`,`The round reached the length limit of one session; the work so far is kept and continues in a fresh session.`],tools_unavailable:[`执行环境里缺少需要的工具。`,`The tools the work needs are not available in the execution environment.`],model_unavailable:[`模型服务暂时不可用。`,`The model service is unavailable for now.`],sign_in_failed:[`模型服务的登录没有成功。`,`Signing in to the model service did not succeed.`],paused:[`任务被暂停了。`,`The task was paused.`],unknown:[`原因暂时不明。`,`The reason is not known yet.`],retry_wait_cut_short:[`在等待重试时 Argus 被要求停止。`,`Argus was asked to stop while waiting to retry.`]},Mc={idea:[`选题`,`Idea`],scope:[`研究定义`,`Scope`],research:[`文献与假设`,`Literature and hypotheses`],literature:[`文献与假设`,`Literature and hypotheses`],implementation:[`方法实现`,`Implementation`],implement:[`方法实现`,`Implementation`],experiment:[`实验验证`,`Experiments`],experiments:[`实验验证`,`Experiments`],analysis:[`结果分析`,`Analysis`],writing:[`论文写作`,`Writing`],review:[`最终审核`,`Final review`],delivery:[`成果交付`,`Delivery`],optimize:[`优化`,`Optimization`],solve:[`推导与验证`,`Derivation and verification`],hold:[`已暂停`,`Paused`],paused:[`已暂停`,`Paused`]},Nc={"provider.request.started":`event.model_call.started`,"provider.request.completed":`event.model_call.completed`,"provider.request.failed":`event.model_call.failed`,"agent.io.start":`event.model_call.started`,"agent.io.complete":`event.model_call.completed`,"usage.recorded":`event.usage.recorded`,"budget.reservation.created":`event.budget.reserved`,"budget.reservation.settled":`event.budget.settled`,"role.session.turn":`event.model_turn`,"daemon.command.submitted":`event.instruction.received`,"daemon.command.completed":`event.instruction.done`,"life.inbox.drained":`event.inbox.processed`,"round.start":`event.round.started`,"round.main.completed":`event.round.finished`,"round.review.completed":`event.review.finished`,"round.backend_failure.backoff":`event.retry.waiting`,"round.backend_failure.hold_interrupted":`event.retry.interrupted`,"life.status":`event.status`,"life.planner.start":`event.planning.started`,"life.planner.error":`event.planning.failed`,"life.planner.normalized":`event.planning.tidied`,"life.planner.verdict":`event.planning.decided`,"loop.start":`event.task.started`,"loop.done":`event.task.ended`,"skill.library.available":`event.skills.ready`,"idea.portfolio.formed":`event.routes.formed`,"team.learning.review.skipped":`event.lessons.skipped`,"ui.argus":`event.argus.reply`};function Pc(e,t){let n=String(e??``).trim(),r=Mc[n.toLowerCase()];return r?Ec(r,t):n}function Fc(e,t){let n=String(e??``).trim().toLowerCase(),r=kc[n];return r?Ec(r,t):n}function Ic(e,t){let n=String(e??``).trim().toLowerCase(),r=kc[n];return r?t===`zh-CN`?`因为${r[0]},工作停了下来。`:`The work stopped because ${r[1]}.`:n}function Lc(e,t,n){if(!t)return e;let r=Fc(t,n);return n===`zh-CN`?`${e.replace(/。$/,``)}(${r})。`:`${e.replace(/\.$/,``)} — ${r}.`}function Rc(e,t,n){return t?n===`zh-CN`?`已完成 ${e} / ${t}`:`${e} of ${t} done`:Ec([`尚未规划`,`Not planned yet`],n)}var zc=[[/^Reporting progress$/i,`progress_message`],[/^(?:Running a command|running project command)$/i,`progress_command`],[/^Using a tool$/i,`progress_tool`],[/^inspecting project state$/i,`progress_inspecting`],[/^Working$/i,`live_activity`]],Bc=[...zc,[/^(?:Review not performed|No review this round)$/i,`round_not_judged`],[/^Goal framed$/i,`goal_framed`],[/^(?:Grounding project|Project grounding started)$/i,`grounding_started`],[/^Manager routing failed$/i,`request_not_routed`],[/^Stage reviewed$/i,`stage_reviewed`],[/^(?:Planning next work|Planning started)$/i,`planning_started`],[/^Planning complete$/i,`planning_complete`],[/^Planner waiting$/i,`planner_waiting`],[/^Project reviewed$/i,`project_finished`],[/^Research branch added$/i,`research_route_added`],[/^Task added$/i,`task_added`],[/^(?:Engineer handoff ready|Work ready for review)$/i,`engineer_round_finished`],[/^(?:Review started|Reviewing benchmark evidence)$/i,`checking_started`],[/^(?:Continuing before review|Continued before review)$/i,`continuing_before_check`],[/^Review deferred for one round$/i,`check_postponed`],[/^Waiting for the Engineer to finish$/i,`awaiting_engineer`],[/^Waiting on external work$/i,`waiting_external`],[/^(?:Evidence accepted|Accepted evidence)$/i,`results_accepted`],[/^(?:Attempt rejected|Requested another attempt)$/i,`another_attempt_requested`],[/^Handed off$/i,`handed_off`],[/^(?:Mission started|Starting mission)$/i,`mission_started`],[/^(?:Task completed|Mission complete)$/i,`mission_completed`],[/^Task failed$/i,`mission_failed`],[/^Awaiting Planner$/i,`planner_waiting`],[/^Ready for a new mission$/i,`mission_ready`],[/^Waiting$/i,`waiting`],[/^Capability unlocked$/i,`capability_unlocked`],[/^Capability upgraded$/i,`capability_upgraded`],[/^Capability promoted to source$/i,`capability_promoted`],[/^Knowledge captured$/i,`knowledge_captured`],[/^Knowledge refined$/i,`knowledge_refined`],[/^Knowledge promoted$/i,`knowledge_promoted`],[/^Knowledge demoted$/i,`knowledge_demoted`],[/^Knowledge retired$/i,`knowledge_retired`],[/^(?:request · started|io · start)$/i,`event.model_call.started`],[/^(?:request · completed|io · complete)$/i,`event.model_call.completed`],[/^usage · recorded$/i,`event.usage.recorded`],[/^reservation · created$/i,`event.budget.reserved`],[/^reservation · settled$/i,`event.budget.settled`],[/^Round (\d+) started$/i,(e,t)=>Dc(Ec(Oc.round_started,t),{n:e[1]})],[/^Running round (\d+)$/i,(e,t)=>Dc(Ec(Oc.round_running,t),{n:e[1]})],[/^Stage (?:·|→) (.+)$/i,(e,t)=>Dc(Ec(Oc.stage_entered,t),{stage:Pc(e[1],t)})],[/^Mission (ended|incomplete|stalled|blocked|failed)(?: · (\S+))?$/i,(e,t)=>Lc(Ec(Oc[`mission_${e[1].toLowerCase()}`],t),e[2],t)],[/^(Manager|Planner|Engineer|Reviewer) failed$/i,(e,t)=>Dc(Ec(Oc.role_failed,t),{role:e[1]})],[/^(\d+) \/ (\d+) complete$/i,(e,t)=>Rc(Number(e[1]),Number(e[2]),t)],[/^Not planned$/i,(e,t)=>Rc(0,0,t)]];function Vc(e){return e===`zh-CN`?`zh`:`en`}function Hc(e,t,n){let r=String(e??``).trim(),i=typeof n==`string`?{kind:n}:n??{};if(!i.kind||i.kind===`live_activity`){for(let[e,n]of zc)if(e.test(r))return Ec(Oc[n],t)}let a=i.kind?Oc[i.kind]:void 0;if(i.kind){let e=!!i.language&&i.language!==Vc(t);if(a&&(e||!r)&&!a[0].includes(`{`))return Ec(a,t);if(r&&!e)return r}for(let[e,n]of Bc){let i=r.match(e);if(i)return typeof n==`string`?Ec(Oc[n],t):n(i,t)}if(a){let e=Ec(a,t);if(!e.includes(`{`))return e;let n=r.match(/\d+/)?.[0];return n&&e.includes(`{n}`)?Dc(e,{n}):r}let o=Ac[r.toLowerCase()];return o?Ec(o,t):r}function Uc(e,t){let n=jc[String(e??``).trim().toLowerCase()];return n?Ec(n,t):``}function Wc(e,t){let n=String(e??``).trim().toLowerCase(),r=Ac[n];return r?Ec(r,t):n}function Gc(e,t){let n=Nc[String(e??``).trim()];return n?Ec(Oc[n],t):null}function Kc(e){return/^(?:provider\.|agent\.io\.|usage\.|budget\.|role\.session\.turn$)/.test(String(e??``))}var qc=[[/^Next action:\s*/i,[`下一步:`,`Next: `]],[/^(?:原因:|Reason:)\s*/i,[`原因:`,`Reason: `]],[/^The backend has failed the same way (\d+) times in a row \(([^)]*)\)\. Waiting ([\d.]+)s before the next attempt[^\n]*/i,(e,t)=>({text:t===`zh-CN`?`模型服务已连续 ${e[1]} 次以同样的方式失败;为了不让持续的故障白白花钱,${e[3]} 秒后再试。`:`The model service has failed the same way ${e[1]} times in a row; waiting ${e[3]} seconds before trying again so a standing failure does not keep costing money.`,technical:e[2]})],[/^review: \w+(?: \([^)]*\))? — /i,[``,``]],[/^status=(\S+) rounds=(\d+) reason=/i,(e,t)=>{let n=kc[e[1].toLowerCase()],r=n?Ec(n,t):Wc(e[1],t);return t===`zh-CN`?`任务已结束(${r}),共 ${e[2]} 轮。`:`Task ended — ${r}, after ${e[2]} rounds.`}],[/^engineer round (\d+) \((?:fresh session|new session)\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮,在新的会话里开始。`:`Round ${e[1]}, started in a fresh session.`],[/^engineer round (\d+) \([^)]*\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮开始。`:`Round ${e[1]} started.`],[/^backend failure; retrying in a fresh \w+ session after ([\d.]+)s\.?$/i,(e,t)=>t===`zh-CN`?`模型服务调用失败,${e[1]} 秒后在新的会话里重试。`:`The model service call failed; retrying in a fresh session after ${e[1]} seconds.`],[/^planner error: (.*; retry later)\.?$/i,(e,t)=>({text:t===`zh-CN`?`规划这一步没有完成,稍后会重试。`:`Planning did not complete; it will be retried later.`,technical:e[1]})],[/^mission failed\.?$/i,[`任务失败了。`,`The task failed.`]],[/^Engineer backend failed before a trustworthy completed turn; reviewer skipped\.?/i,[`这一轮模型服务没有完成调用,所以没有人审阅。`,`The model service did not complete this round, so no one reviewed it.`]],[/^Reviewer backend unavailable for (\d+) consecutive attempt\(s\); failing loud rather than settling the round without a real review\.?/i,(e,t)=>t===`zh-CN`?`审阅者的模型服务连续 ${e[1]} 次没有响应,这一轮因此没有得到审阅。`:`The reviewer's model service did not respond ${e[1]} times in a row, so this round was not reviewed.`],[/^The Reviewer's session ended before it reached a conclusion, so this round was not judged\.?/i,[`审阅者在得出结论前就中断了,这一轮没有被评判。`,`The reviewer stopped before reaching a conclusion, so this round was not judged.`]],[/^The wait after a repeated backend failure ended early: daemon stop requested\.?/i,[`在等待重试时 Argus 被要求停止,任务随之暂停。`,`Argus was asked to stop while waiting to retry, so the task paused.`]],[/^Backend call paused before a trustworthy completed turn \(stop_kind=(\w+)\); reviewer skipped\.?/i,(e,t)=>t===`zh-CN`?`这一轮在得出可信结果前被暂停(${Fc(e[1],t)}),所以没有人审阅。`:`This round was paused before it produced a trustworthy result (${Fc(e[1],t)}), so no one reviewed it.`],[/^One Engineer call used its whole per-call provider-turn allowance \([^)]*\); reviewer skipped\. The work so far is kept and the task continues in a fresh session from the checkpoint\.?/i,[`这一轮用完了单次调用的额度;已做的工作保留,会在新的会话里接着做,本轮没有审阅。`,`This round used up its per-call allowance; the work so far is kept and continues in a fresh session. No review this round.`]],[/^Execution host is unavailable; reviewer skipped\.?/i,[`执行环境暂时不可用,这一轮没有审阅。`,`The execution environment is unavailable, so this round was not reviewed.`]],[/^Copilot CLI exited with code \d+\.?/i,[`模型服务的调用没有完成。`,`The model service call did not complete.`]],[/^Grounded bounded plan completed with (\d+) step\(s\)\.?/i,(e,t)=>t===`zh-CN`?`规划完成,共 ${e[1]} 步。`:`Planning finished with ${e[1]} steps.`],[/^Retry in a fresh \w+ session; do not resume the failed thread\.(?:\s*If this repeats, pause the daemon and reduce concurrent \w+ load\.)?/i,[`接下来会在新的会话里重试这一轮。`,`The round will be retried in a fresh session.`]],[/^Restart the daemon to resume this mission from its checkpoint\.?/i,[`重新运行 Argus 即可从保存的进度继续。`,`Run Argus again to continue from the saved progress.`]],[/^Resume this mission when the operator is ready\.?/i,[`准备好后即可恢复这项任务。`,`Resume the task whenever you are ready.`]],[/^Resume from the persisted checkpoint after the blocking budget or provider condition has been cleared\.?/i,[`预算或模型服务恢复后,即可从保存的进度继续。`,`Once the budget or model service is back, the task continues from the saved progress.`]],[/^inspecting project state$/i,[`正在查看项目状态`,`Looking at the project state`]],[/^running project command$/i,[`正在运行项目命令`,`Running a project command`]],[/^using a tool$/i,[`正在使用工具`,`Using a tool`]]],Jc=/^(?:[\w.]+_(?:streak|code|error|kind)=|error=|exit=|fatal_error=|Runner receipt:|stop_kind=|backend_)/i;function Yc(e,t){let n=e.trim(),r=[],i=[],a=!1;for(;n;){let e=!1;for(let[o,s]of qc){let c=n.match(o);if(!c)continue;let l=typeof s==`function`?s(c,t):Ec(s,t);typeof l==`string`?r.push(l):(r.push(l.text),l.technical&&i.push(l.technical)),n=n.slice(c[0].length).replace(/^[\s;,]+/,``),e=!0,a=!0;break}e||(a&&Jc.test(n)?i.push(n):r.push(n),n=``)}let o=t===`zh-CN`?``:` `;return{text:r.filter(Boolean).join(o).replace(/:\s+/g,`:`),technical:i.join(` `)}}function Xc(e,t,n){let r=String(e??``).trim();if(n){let e=n.language&&n.language!==Vc(t)?Uc(n.cause,t):``;if(e)return{text:e,technical:String(n.technical??``)};if(n.technical)return{text:r,technical:String(n.technical)}}if(!r)return{text:``,technical:``};let i=r.split(/(\n[ \t]*\n|\n)/),a=[],o=[];return i.forEach((e,n)=>{if(n%2==1){a.push(e.includes(` + +`)||/\n[ \t]*\n/.test(e)?` + +`:` +`);return}let r=Yc(e,t);a.push(r.text),r.technical&&o.push(r.technical)}),{text:a.join(``).replace(/\n{3,}/g,` + +`).trim(),technical:o.join(` `)}}function Zc(e,t){let n=e.split(/(\r?\n)/),r=n.findIndex((e,t)=>t%2==0&&e.trim()!==``),i=n[r]?.trim()??``,a=i.match(/^(?:Task continued|任务已继续)(?: · (.+))?$/),o=i.match(/^Could not complete (.+)\.$/)??i.match(/^未能完成:(.+)。$/);if(!a&&!o)return null;let s=t===`zh-CN`,c=[],l=``,u=!1;return{text:n.map((e,n)=>{if(n%2==1)return e;if(n===r){if(a){let e=a[1]??``,n=e.match(/^(.*?) · review=(\S+)$/),r=n?n[1]:e;return[s?`当时记录:工作继续推进。`:`Recorded then: work continued.`,r?`${s?`任务:`:`Task: `}${r}`:``,n?`${s?`当时记录的审阅状态:`:`Review status recorded then: `}${Wc(n[2],t)}`:``].filter(Boolean).join(` +`)}let e=o[1];return/^(?:the current task|当前任务)$/.test(e)?s?`当时这项任务未能完成。`:`This task had not completed at that time.`:s?`当时未能完成:${e}。`:`Not completed at that time: ${e}.`}if(/^(?:Progress|Mission summary|本次进展|本次完成)[::]/.test(e)&&(u=!0),u)return e;let i=e.match(/^\s*(`{3,}|~{3,})/);if(i)return l?l===i[1][0]&&(l=``):l=i[1][0],e;if(l)return e;if(/^(?:Nothing is queued yet; the Planner is deciding what comes next\.|计划里暂时没有下一项,Planner 正在决定接下来做什么。)$/.test(e))return s?`当时尚未排入下一项任务,规划者还在决定接下来做什么。`:`At that time, nothing was queued and the Planner was still deciding what to do next.`;let d=e.match(/^(?:Next(?: action| up)?|下一步|接下来做)[::]\s*(.*)$/);if(d){let e=/^(?:Argus will diagnose the failure and choose a safe next step\.|Argus 会诊断原因并选择可恢复的方案。)$/.test(d[1])?s?`诊断当时的原因,再选择可恢复的方案。`:`Diagnose the cause and choose a recovery approach.`:d[1];return`${s?`当时记录的下一步:`:`Next step recorded at the time: `}${e}`}let f=e.match(/^(?:Reason:|原因:)\s*(.*)$/);if(f){let e=pa(f[1]);if(e.prose===`Argus was stopped by its operator in the middle of this round; the Engineer's work so far is kept and nothing was retried.`){let t=ma(f[1],s);return e.receipt&&c.push(e.receipt),s?`当时${t.summary}。已做的工作保留,当时没有重试。`:`At that time, ${t.summary}. Work done so far was kept, and no retry was made then.`}let n=Xc(f[1],t);if(n.text!==f[1].trim()||n.technical)return n.technical&&c.push(n.technical),`${s?`当时记录的原因:`:`Reason recorded at the time: `}${n.text}`}return fa.test(e.trim())?(c.push(e),``):e}).join(``),technical:c.join(` +`)}}var Qc=3,$c=`engineer.progress`,el=new Set([`tool_use`,`command_execution`,`file_change`]),tl=[`assistant_message`,`agent_message`,`message`],nl=e=>e,rl=(e,t)=>String(nl(e)[t]??``),il=e=>rl(e,`type`)===$c?rl(e,`kind`):``;function al(e,{locale:t,showReasoning:n,filter:r=`all`,query:i=``}){let a=[],o=new Map,s=0,c={locale:t,showReasoning:n,unknownEventPolicy:`hide`,density:`compact`};return e.forEach(e=>{let t=wc(e,c);if(!t){!n&&fe(e)&&s++;return}if(!ve(e,t,r,i))return;let l=rl(e,`message_id`),u=!!l&&rl(e,`type`)===$c&&tl.includes(rl(e,`kind`));if(u&&o.has(l)){let n=o.get(l);a[n]={...a[n],ev:{...a[n].ev,...e},r:{...a[n].r,...t,text:Ie(a[n].r.text,t.text,Le(e))}};return}let d={ev:e,r:t,key:Re(e)};u&&o.set(l,a.length),a.push(d)}),{list:a,hiddenReasoning:s}}function ol(e){let t=rl(e,`tool_name`)||rl(e,`tool`)||rl(e,`name`);if(t)return t;let n=rl(e,`text`).match(/^([A-Za-z_][\w.-]{0,40}):\s/);return n?n[1]:``}function sl(e){let t=rl(e,`status`).toLowerCase();if(t===`running`||t===`started`||t===`in_progress`||t===`pending`)return`running`;if(t===`failed`||t===`error`||t===`errored`)return`failed`;let n=nl(e).exit_code;return typeof n==`number`&&n!==0?`failed`:[`completed`,`complete`,`success`,`succeeded`,`done`,`ok`,`finished`].includes(t)?`completed`:``}function cl(e,t){let n=rl(t,`call_id`),r=rl(e.ev,`call_id`);return n&&r?n===r:il(e.ev)===il(t)&&ol(e.ev)===ol(t)&&rl(e.ev,`text`)===rl(t,`text`)}var ll=(e,t)=>({kind:`step`,key:e.key,ev:e.ev,r:e.r,latest:e.ev,repeat:1,status:t});function ul(e){let t=[],n=[],r=(e,t,r,i)=>{let[a]=n.splice(e,1);a.status=r,a.latest=t,i&&(a.result=i)};for(let i of e){let e=il(i.ev);if(el.has(e)){let e=sl(i.ev);if(e!==`running`){let t=n.length-1;for(;t>=0&&!cl(n[t],i.ev);)--t;if(t>=0){r(t,i.ev,e||`completed`);continue}}let a=ll(i,e);t.push(a),e===`running`&&n.push(a);continue}if(e===`tool_result`){let e=rl(i.ev,`call_id`),t=ol(i.ev),a=e?n.findIndex(t=>rl(t.ev,`call_id`)===e):n.findIndex(e=>!t||ol(e.ev)===t);if(a>=0){r(a,i.ev,sl(i.ev)||`completed`,i);continue}}t.push(ll(i,``))}return t}var dl=/fail|error|backoff|stall|denied|blocked|nudge|escalat/i,fl=/\b(?:fail(?:ed|ure)?|error|unavailable|unreachable|exited with code|backoff|retry(?:ing)?|stuck|skipped)\b/i;function pl(e){if(il(e.ev))return!1;let t=e.ev;return e.r.tone===`err`||e.r.tone===`warn`||dl.test(rl(t,`type`))||nl(t).backend_unavailable===!0||nl(t).review_skipped===!0||fl.test(e.r.text)}var ml=e=>e.toLowerCase().replace(/\d+(?:\.\d+)?/g,`#`).replace(/\s+/g,` `).trim();function hl(e){let t=e.ev;return ml(rl(t,`signature`)||rl(t,`cause`)||rl(t,`backend_error`)||rl(t,`error`)||rl(t,`reason`)||rl(t,`stop_kind`)||e.r.text)}function gl(e,t){return pl(e)?`fail|${e.r.role}|${rl(e.ev,`type`)}|${hl(e)}`:`text|${e.r.role}|${e.r.glyph}|${Xc(e.r.text,t).text}`}function _l(e,t){e.repeat+=t.repeat,e.latest=t.latest,e.r=t.r,t.status&&(e.status=t.status),t.result&&(e.result=t.result)}function vl(e,t){let n=[],r=[];for(let i of e){let e=gl(i,t),a=n[n.length-1];if(a&&r[r.length-1]===e){_l(a,i);continue}n.push({...i}),r.push(e)}let i=r.map((e,t)=>il(n[t].ev)?e:ml(e)),a=(e,t)=>{if(e+2*t>n.length)return!1;for(let n=0;ne.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,Cl=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,wl=e=>Cl(e.replace(/^[a-z]+:\/\/(?:www\.)?/i,``).replace(/#.*$/,``).replace(/\/$/,``),48),Tl=/\*\*\* (?:Add|Update|Delete|Move to) File:\s*(\S+)/;function El(e,t,n){for(let r of n){if(e){let t=e[r];if(typeof t==`string`&&t.trim())return t.trim();if(Array.isArray(t)&&typeof t[0]==`string`&&t[0].trim())return t[0].trim();continue}let n=t.match(RegExp(`"${r}":\\s*"((?:[^"\\\\]|\\\\.)*)"`));if(n&&n[1])return n[1].replace(/\\(.)/g,`$1`)}return``}function Dl(e){return Ol(e.ev)}function Ol(e){let t=rl(e,`text`);if(il(e)===`file_change`){let e=t.match(Tl);if(e)return Sl(e[1].trim());let n=t.match(/^(\S+\.[A-Za-z0-9]{1,8})\b/);return n?Sl(n[1]):``}let n=t.replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),r=null;if(n.startsWith(`{`))try{let e=JSON.parse(n);r=e&&typeof e==`object`&&!Array.isArray(e)?e:null}catch{r=null}let i=El(r,n,[`path`,`file_path`,`filePath`,`file`,`filename`,`target_file`,`notebook_path`,`paths`]);if(i&&!/^\.\/?$/.test(i))return Sl(i);let a=El(r,n,[`url`,`uri`]);if(a)return wl(a);let o=El(r,n,[`pattern`,`query`,`regex`,`glob`,`q`]);if(o)return Cl(o,32);let s=n.match(Tl);return s?Sl(s[1].trim()):``}function kl(e,t){let n=t===`zh-CN`,r=e.trim().replace(/\\/g,`/`).split(`/`).filter(e=>e&&e!==`**`&&e!==`.`),i=r[r.length-1]??`*`,a=r.slice(0,-1).filter(e=>!/[*?]/.test(e)),o;o=i===`*`||i===`*.*`?n?`所有文件`:`all files`:/^\*\.[\w.]+$/.test(i)?n?`${i.slice(1)} 文件`:`${i.slice(1)} files`:Cl(i,40);let s=a[a.length-1];return s?n?`${s} 里的 ${o}`:`${o} in ${s}`:o}var Al=/^(glob|find|find_?files|list_?files|file_?search)$/i;function jl(e,t){let n=t===`zh-CN`,r=ol(e),i=bl(r,il(e)),a=Ol(e);if(i===`search`){let t=El(null,rl(e,`text`).replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),[`pattern`,`query`,`regex`,`glob`,`q`]);t&&(a=Cl(t,48))}if(i===`search`&&Al.test(r)&&a)return`${n?`查找`:`Find`} ${kl(a,t)}`;let o=a.startsWith(`/`)?Sl(a):a,[s,c,l,u]={read:[`查阅`,`查阅文件`,`Read`,`Read a file`],search:[`搜索:`,`搜索`,`Search:`,`Search`],fetch:[`读取`,`读取网页`,`Open`,`Open a page`],edit:[`修改`,`修改文件`,`Edit`,`Edit a file`],tool:[`调用`,`调用工具`,`Use`,`Use a tool`]}[i],d=i===`tool`?r:o;if(!d)return n?c:u;let f=n?s:l;return f.endsWith(`:`)?`${f}${d}`:`${f} ${d}`}function Ml(e,t){let n=il(e);return n===`command_execution`?{title:t===`zh-CN`?`正在运行命令`:`Running a command`,detail:``}:[`tool_use`,`file_change`].includes(n)?{title:{read:[`查看资料`,`Reading material`],search:[`查找相关信息`,`Searching for relevant information`],fetch:[`读取资料页面`,`Reading a source page`],edit:[`更新项目文件`,`Updating project files`],tool:[`执行一个工作步骤`,`Carrying out a work step`]}[bl(ol(e),n)][t===`zh-CN`?0:1],detail:Ol(e)}:null}function Nl(e){let t=e[0],n=e[e.length-1],r=ol(t.ev)||(il(t.ev)===`file_change`?`file`:`tool`),i=bl(r,il(t.ev)),a=[],o=0;for(let t of e){let e=Dl(t);e&&(o+=1,a.includes(e)||a.push(e))}let s=e.reduce((e,t)=>e+t.repeat,0),c=i===`read`||i===`edit`||i===`fetch`;return{kind:`group`,key:`group:${t.key}`,r:{...t.r,text:``},latest:n.latest,tool:r,action:i,steps:e,targets:a,count:c&&o===e.length?a.length:s,calls:s,failed:e.filter(e=>e.status===`failed`).length}}function Pl(e){let t=[],n=[],r=null,i=()=>{n.length>=3?t.push(Nl(n)):t.push(...n),n=[],r=null};for(let a of e){let e=xl(a);if(e&&(r===null||r===e)){n.push(a),r=e;continue}i(),e?(n.push(a),r=e):t.push(a)}return i(),t}function Fl(e,t){return Pl(vl(ul(e),t))}function Il(e,t,n){let r=t(`stream.fold.${e.action}`,{count:e.count,tool:e.tool}),i=e.targets.slice(0,Qc);return`${r}${i.length?`${n===`zh-CN`?`:`:`: `}${i.join(n===`zh-CN`?`、`:`, `)}${e.targets.length>i.length?`…`:``}`:``}${e.failed?` · ${t(`stream.fold.failed`,{count:e.failed})}`:``}`}function Ll(e,t,n){return e.kind===`group`?Il(e,t,n):Xc(e.r.text,n).text}var Rl=new Set([`tool_use`,`command_execution`,`file_change`]),zl=new Set([`completed`,`failed`,`cancelled`,`canceled`,`error`,`done`,`stopped`]),Bl=()=>Date.now()/1e3;function Vl(e){return e.trim().replace(/[.…]+$/u,``).toLowerCase()}function Hl(e,t,n=Bl()){let r=(t.label??``).trim();if(!r)return e;let i=t.heartbeat===!0,a=e.slice(),o=(t.callId??``).trim(),s=(t.status??``).trim().toLowerCase(),c=(t.kind??``).trim();if(o){let e=-1;for(let t=a.length-1;t>=0;--t)if(a[t].callId===o){e=t;break}if(e>=0){let i=a[e];return a[e]={...i,label:c===`tool_result`?i.label:r,detail:(t.detail||``).trim()||i.detail,tool:(t.tool||``).trim()||i.tool,output:(t.output||``).trim()||i.output,status:s||i.status,endedTs:zl.has(s)?n:i.endedTs},a}if(c===`tool_result`)return a}let l=a[a.length-1];if(c===`tool_result`)return!l||l.endedTs||l.heartbeat||(a[a.length-1]={...l,output:(t.output||``).trim()||l.output,status:s||`completed`,endedTs:n}),a;if(l&&!l.endedTs){if(Vl(l.label)===Vl(r)||i&&l.heartbeat)return a[a.length-1]={...l,label:r,detail:t.detail||l.detail,kind:t.kind||l.kind,heartbeat:i,endedTs:0},a;l.callId||(a[a.length-1]={...l,endedTs:n})}return a.push({id:`${a.length}:${r}:${n}`,role:(t.role||`manager`).trim()||`manager`,label:r,detail:(t.detail||``).trim(),kind:c,startedTs:n,endedTs:0,heartbeat:i,...t.tool?.trim()?{tool:t.tool.trim()}:{},...t.toolKind?.trim()?{toolKind:t.toolKind.trim()}:{},...o?{callId:o}:{},...s||o?{status:s||`running`}:{},...t.output?.trim()?{output:t.output.trim()}:{}}),a}function Ul(e,t=Bl()){return e.length===0?[]:e.map(e=>e.endedTs?e:{...e,endedTs:t})}function Wl(e){if(!Number.isFinite(e)||e<1)return``;if(e<60)return`${Math.floor(e)}s`;let t=Math.floor(e/60),n=Math.floor(e%60);return n?`${t}m${n}s`:`${t}m`}function Gl(e,t=Bl(),n=!1){return e.filter(e=>!e.heartbeat&&Rl.has(e.kind)).map(e=>{let r=!e.endedTs&&(!e.status||e.status===`running`)?n?`completed`:`running`:e.status||`completed`;return{kind:e.kind,label:e.label,...e.detail?{detail:e.detail}:{},...e.tool?{tool:e.tool}:{},...e.toolKind?{tool_kind:e.toolKind}:{},...e.callId?{call_id:e.callId}:{},status:r,started_ts:e.startedTs,ended_ts:e.endedTs||(n?t:0),...e.output?{output:e.output}:{}}})}var Kl=e=>typeof e==`string`?e.trim():``,ql=e=>typeof e==`number`&&Number.isFinite(e)?e:0;function Jl(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(e=>{if(!e||typeof e!=`object`)return;let n=e,r=Kl(n.label);r&&t.push({kind:Kl(n.kind)||`tool_use`,label:r,...Kl(n.detail)?{detail:Kl(n.detail)}:{},...Kl(n.tool)?{tool:Kl(n.tool)}:{},...Kl(n.tool_kind)?{tool_kind:Kl(n.tool_kind)}:{},...Kl(n.call_id)?{call_id:Kl(n.call_id)}:{},status:Kl(n.status).toLowerCase()||`completed`,started_ts:ql(n.started_ts),ended_ts:ql(n.ended_ts),...Kl(n.output)?{output:Kl(n.output)}:{}})}),t}function Yl(e,t=Bl()){if(!e.length)return 0;let n=Math.min(...e.map(e=>e.started_ts||t)),r=Math.max(...e.map(e=>e.ended_ts||t));return Math.max(0,r-n)}var Xl={command_execution:st,tool_use:bn,file_change:Zt},Zl=new Set([`failed`,`error`]),Ql=new Set([`cancelled`,`canceled`,`stopped`]),$l=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,eu=/^⚙\s*([\w.-]+)\s*·\s*(.*)$/su;function tu(e,t=`zh-CN`){let n=(e.tool??``).trim(),r=(e.detail??``).trim(),i=e.label.match(eu);if(i){let e=i[1],a=r||i[2];return{primary:jl({type:`engineer.progress`,kind:`tool_use`,tool_name:n||e,text:`${e}: ${a}`},t),secondary:a}}let a=e.label.replace($l,``).trim();return{primary:a||n,secondary:r&&r!==a?r:``}}function nu({steps:e,live:t,startedTs:n,status:r=``}){let{t:i,locale:a}=z(),[o,s]=(0,G.useState)(!1),[,c]=(0,G.useState)(0);if((0,G.useEffect)(()=>{if(!t)return;let e=setInterval(()=>c(e=>e+1),1e3);return()=>clearInterval(e)},[t]),(0,G.useEffect)(()=>{t||s(!1)},[t]),!e.length&&!t)return null;let l=Date.now()/1e3,u=Zl.has(r)||e.some(e=>Zl.has(e.status)),d=Ql.has(r)||e.some(e=>Ql.has(e.status)),f=Wl(t&&n?Math.max(0,l-n):Yl(e,l))||`<1s`,p=[...e].reverse().find(e=>e.status===`running`),m=t?`${p?tu(p,a).primary:a===`zh-CN`?`正在准备回复`:`Preparing a reply`} · ${f}`:u?`${a===`zh-CN`?`过程出现问题,请查看详情`:`An issue occurred; see details`} · ${f}`:d?`${a===`zh-CN`?`已停止`:`Stopped`} · ${f}`:i(`chat.stepsDone`,{count:e.length,seconds:f});return(0,J.jsxs)(`div`,{className:`turn-steps mt-3 rounded-lg border border-line/50 bg-surface/50 text-xs`,"data-live":t||void 0,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,"aria-label":a===`zh-CN`?`查看工作过程`:`View work progress`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-ink-dim hover:text-ink`,children:[(0,J.jsx)(t?an:u?Gt:d?gn:We,{size:14,"aria-hidden":`true`,className:`shrink-0 ${t?`animate-spin text-manager motion-reduce:animate-none`:u?`text-err`:d?`text-ink-faint`:`text-ok`}`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:m}),(0,J.jsx)(o?Ue:Ut,{size:14,"aria-hidden":`true`,className:`shrink-0 text-ink-faint`})]}),o?(0,J.jsxs)(`ol`,{className:`space-y-1 border-t border-line/40 px-3 py-2`,children:[!e.length&&(0,J.jsx)(`li`,{className:`text-ink-faint`,children:a===`zh-CN`?`尚未记录工具操作。`:`No tool operations recorded yet.`}),e.map((e,n)=>{let{primary:r,secondary:o}=tu(e,a),s=e.status===`running`,c=Zl.has(e.status),u=Ql.has(e.status),d=e.kind===`command_execution`?Xl.command_execution:e.kind===`file_change`?Xl.file_change:Xl.tool_use,f=Wl(Math.max(0,(e.ended_ts||l)-e.started_ts));return(0,J.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(d,{size:13,"aria-hidden":`true`,className:`shrink-0 self-start mt-0.5 ${c?`text-err`:`text-ink-faint`}`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`${s&&t?`text-ink`:c?`text-err`:`text-ink-dim`}`,title:o||r,children:r}),o?(0,J.jsxs)(`details`,{className:`turn-step-raw inline`,children:[(0,J.jsx)(`summary`,{className:`ml-2 inline cursor-pointer list-none text-[11px] text-ink-faint hover:text-ink-dim`,children:i(`chat.stepRaw`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block break-all font-mono text-[11px] text-ink-faint`,children:o})]}):null,c&&e.output?(0,J.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-err/80`,children:e.output}):null]}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono tabular-nums ${s&&t?`text-manager`:`text-ink-faint`}`,children:s&&t?(0,J.jsx)(an,{size:12,className:`animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):c?i(`chat.stepFailed`):u?a===`zh-CN`?`已停止`:`Stopped`:f})]},e.call_id||`${n}:${e.started_ts}`)})]}):null]})}function ru({snapshot:e,view:t,events:n=[],connected:r,compact:i=!1}){let{locale:a}=z(),o=a===`zh-CN`,[s,c]=(0,G.useState)(()=>Date.now()/1e3);(0,G.useEffect)(()=>{let e=window.setInterval(()=>c(Date.now()/1e3),1e4);return()=>window.clearInterval(e)},[]);let l=ci(e,t,n,s),u=l.activityAgeSeconds,d=l.waitingOn?``:u===null?o?`暂无本次运行的进展记录`:`No progress recorded for this run yet`:u<60?o?`刚刚有进展`:`Progress in the last minute`:u<3600?o?`${Math.floor(u/60)} 分钟前有进展`:`Progress ${Math.floor(u/60)} min ago`:o?`${Math.floor(u/3600)} 小时前有进展`:`Progress ${Math.floor(u/3600)} hr ago`;return(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-line/60 bg-panel px-4 py-2.5 text-xs`,"data-testid":`work-status`,"data-state":l.state,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r?l.state===`running`?`bg-blue`:`bg-ink-faint`:`bg-warn`}`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:pi(l,a,r)}),d?(0,J.jsx)(`time`,{className:`text-ink-faint`,dateTime:l.activityAt?new Date(l.activityAt*1e3).toISOString():void 0,children:d}):null]}),r?!i&&l.title?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-ink-dim`,title:l.title,children:l.title}):null:(0,J.jsx)(`p`,{className:`mt-1 leading-5 text-ink-faint`,children:o?`这里保留的是已收到的记录;连接恢复后继续更新。`:`These are the records already received. Updates resume when the connection returns.`})]})}var iu=/Info: (?:Operation cancelled by user|Response was interrupted due to a server error\. Retrying\.\.\.)/gi;function au({ev:e,r:t,first:n,last:r,latest:i,repeat:a=1,status:o=``,result:s}){let{locale:c,t:l}=z(),u=B.role[t.role]??B.inkFaint,d=He(t.tone),f=e.type===`engineer.progress`&&String(e.kind||``)===`tool_use`,p=[`agent_message`,`assistant_message`,`message`].includes(String(e.kind||``))?Ca(t.text):t.text,m=f?{text:jl(e,c),technical:t.text}:Xc(p,c),h=s?Xc(s.r.text,c).text:``,g=[m.technical,h?`${l(`stream.stepResult`)}: ${h}`:``].filter(Boolean).join(` +`);return(0,J.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${r?`animate-appear`:``} ${t.reasoning?`opacity-60`:``}`,style:t.rule?{marginTop:4}:void 0,children:[(0,J.jsxs)(`div`,{className:`relative flex justify-center`,children:[n?null:(0,J.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),r?null:(0,J.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,J.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:u,boxShadow:`0 0 0 1px ${u}55`}})]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:u},title:t.label,children:t.label}),(0,J.jsx)(`span`,{className:`text-xs`,style:{color:d},children:t.glyph}),a>1?(0,J.jsxs)(`span`,{className:`rounded bg-line/60 px-1 font-mono text-[10px] tabular-nums text-ink-dim`,title:l(`stream.repeated`,{count:a}),"data-repeat":a,children:[`×`,a]}):null,o===`failed`?(0,J.jsx)(`span`,{className:`text-xs text-err`,children:l(`stream.stepFailed`)}):null,(0,J.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:Ct(i??e)})]}),(0,J.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5 ${t.reasoning?`italic`:``}`,style:{color:d},title:g||void 0,children:m.text})]})]})}function ou({group:e,first:t,last:n,open:r,onToggle:i}){let{locale:a,t:o}=z(),s=B.role[e.r.role]??B.inkFaint,c=He(e.r.tone),l=Il(e,o,a);return(0,J.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${n?`animate-appear`:``}`,"data-feed-group":e.action,"data-open":r?`true`:`false`,children:[(0,J.jsxs)(`div`,{className:`relative flex justify-center`,children:[t?null:(0,J.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),n?null:(0,J.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,J.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:s,boxShadow:`0 0 0 1px ${s}55`}})]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":r,title:o(r?`stream.fold.collapse`:`stream.fold.expand`),className:`block w-full rounded text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-blue-sky`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:s},title:e.r.label,children:e.r.label}),(0,J.jsx)(`span`,{className:`text-xs`,style:{color:c},children:e.r.glyph}),(0,J.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-ink-faint`,children:e.calls}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})}),(0,J.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:Ct(e.latest)})]}),(0,J.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5`,style:{color:c},children:l})]}),r?(0,J.jsx)(`div`,{className:`mt-1 border-l border-line/50`,children:e.steps.map((t,n)=>(0,J.jsx)(au,{ev:t.ev,r:t.r,first:n===0,last:n===e.steps.length-1,latest:t.latest,repeat:t.repeat,status:t.status,result:t.result},t.key))}):null]})]})}function su({rows:e}){let[t,n]=(0,G.useState)(()=>new Set),r=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,J.jsx)(J.Fragment,{children:e.map((n,i)=>n.kind===`group`?(0,J.jsx)(ou,{group:n,first:i===0,last:i===e.length-1,open:t.has(n.key),onToggle:()=>r(n.key)},n.key):(0,J.jsx)(au,{ev:n.ev,r:n.r,first:i===0,last:i===e.length-1,latest:n.latest,repeat:n.repeat,status:n.status,result:n.result},n.key))})}function cu({ev:e,r:t,artifacts:n,onOpenArtifact:r}){let{t:i,locale:a}=z(),o=String(e.type)===`ui.operator`,s=!o&&e.mission_result===!0,c=s&&typeof e.text==`string`?e.text:t.text,l=s?Zc(c,a):null,u=s?Tt(e):null,d=o?io(t.text):null,f=d?.refs??[],p=d&&f.length?d.text:t.text,m=o?[]:Jl(e.steps),h=Number(e.response_latency_ms??0),g=!o&&h>=100?` · ${(h/1e3).toFixed(1)}s`:``,_=(0,G.useRef)(null);return it(_,(e,t)=>{_.current&&(t||e.fromTo(_.current,{autoAlpha:0,x:o?12:0,y:o?0:8},{autoAlpha:1,x:0,y:0,duration:.28,ease:`power2.out`,clearProps:`transform,opacity,visibility`}))}),(0,J.jsx)(`article`,{ref:_,"data-task-receipt":s||void 0,"data-task-receipt-id":s?String(e.message_id||e.event_id||``):void 0,className:`conversation-row group mx-auto w-full max-w-full px-4 py-3 sm:px-6 lg:max-w-[61.8vw]`,children:o?(0,J.jsxs)(`div`,{className:`flex items-end justify-end gap-2`,children:[(0,J.jsx)(Qe,{text:t.text,label:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,J.jsx)(`time`,{className:`shrink-0 pb-1 font-mono text-[10px] tabular-nums text-ink-faint`,children:Ct(e)}),(0,J.jsxs)(`div`,{className:`max-w-[calc(100%_-_3rem)] rounded-[18px] bg-conversation-user px-4 py-2.5 text-[15px] leading-relaxed text-ink ring-1 ring-line/35 sm:max-w-[82%]`,children:[f.length?(0,J.jsx)(`div`,{className:`mb-2 space-y-2`,children:f.map((e,t)=>(0,J.jsxs)(`blockquote`,{"aria-label":a===`zh-CN`?`引用`:`Reference`,className:`border-l-2 border-blue/40 pl-3 text-sm text-ink-dim`,children:[(0,J.jsxs)(`div`,{className:`text-xs text-ink-faint`,children:[a===`zh-CN`?`引用`:`Reference`,e.part?` · ${a===`zh-CN`?`第 ${e.part} 部分`:`Part ${e.part}`}`:``]}),(0,J.jsx)(`div`,{className:`font-medium`,children:e.task_title||e.step_title||e.task_id}),e.task_title&&e.step_title&&e.step_title!==e.task_title?(0,J.jsx)(`div`,{children:e.step_title}):null]},`${e.source}:${e.task_id}:${e.step_id}:${t}`))}):null,p?(0,J.jsx)(H,{artifacts:n,onOpenArtifact:r,children:p}):null]})]}):(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center`,children:(0,J.jsx)(At,{size:26,className:`text-ink`})}),(0,J.jsxs)(`div`,{className:`relative min-w-0 flex-1 text-[15px] leading-relaxed text-ink`,children:[(0,J.jsxs)(`div`,{"data-task-receipt-header":s||void 0,className:s?`sticky -top-1.5 z-10 mb-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 bg-panel py-1`:`mb-1 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-blue`,children:te().name}),s?(0,J.jsx)(`span`,{className:`text-[11px] text-ink-dim`,children:a===`zh-CN`?`任务回报 · 当时记录`:`Task report · Recorded then`}):null,(0,J.jsx)(Qe,{text:c,label:l?a===`zh-CN`?`复制原始回报`:`Copy original report`:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`ml-auto opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,J.jsxs)(`time`,{className:`font-mono text-[10px] tabular-nums text-ink-faint ${s?`basis-full sm:basis-auto`:``}`,dateTime:u?.toISOString(),title:u?.toLocaleString(a,{dateStyle:`full`,timeStyle:`long`}),children:[u?u.toLocaleString(a,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):Ct(e),g]})]}),c?(0,J.jsx)(`div`,{"data-task-receipt-prose":s||void 0,children:(0,J.jsx)(H,{artifacts:n,onOpenArtifact:r,children:l?.text??c})}):null,m.length||e.live===!0?(0,J.jsx)(nu,{steps:m,live:e.live===!0,startedTs:Number(e.ts),status:e.success===!1?`failed`:String(e.status??``)}):null,l?(0,J.jsx)(ft,{className:`task-receipt-original`,label:a===`zh-CN`?`查看原始回报(含技术记录)`:`View original report (including technical records)`,children:(0,J.jsx)(`pre`,{"data-task-receipt-original":!0,className:`mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs text-ink-dim`,children:c})}):null]})]})})}function lu({role:e,rows:t,open:n,active:r,onToggle:i}){let{t:a,locale:o}=z(),s=B.role[e],c=(0,G.useRef)(null),l=(0,G.useRef)(!0),u=(0,G.useRef)(0),[d,f]=(0,G.useState)(!1),p=t[t.length-1]?.r.text.length??0,m=(0,G.useMemo)(()=>Fl(t,o),[t,o]),h=m.length?Ll(m[m.length-1],a,o):``;return(0,G.useEffect)(()=>{n&&!l.current&&c.current&&(c.current.scrollTop=u.current)},[n]),(0,G.useEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{l.current&&c.current&&(c.current.scrollTop=c.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[n,t.length,p]),(0,J.jsxs)(`section`,{className:`role-log-group border-b border-line/50`,"data-role":e,"data-open":n?`true`:`false`,"data-active":r?`true`:`false`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":n,className:`group flex h-11 w-full items-center gap-2 px-4 text-left transition-colors hover:bg-bg/60`,children:[(0,J.jsx)(`span`,{"data-role-dot":e,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:s}}),(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink-dim`,children:zn(e,a)}),(0,J.jsx)(`span`,{className:`font-mono text-xs text-ink-faint`,children:m.length}),h?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:h}):(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${n?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),n?(0,J.jsx)(`div`,{className:`grid grid-rows-[1fr]`,children:(0,J.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden`,children:[(0,J.jsx)(`div`,{ref:c,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollTop,l.current=t.scrollHeight-t.scrollTop-t.clientHeight<=2,f(!l.current)},className:`max-h-72 overflow-x-hidden overflow-y-auto border-t border-line/40 scroll-thin`,children:m.length>0?(0,J.jsx)(su,{rows:m}):(0,J.jsx)(`div`,{className:`px-4 py-3 text-xs text-ink-faint`,children:a(`stream.noLogs`)})}),d?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{l.current=!0,f(!1),c.current&&(c.current.scrollTop=c.current.scrollHeight)},className:`absolute bottom-2 right-3 rounded-full border border-line/60 bg-panel px-3 py-1 text-xs text-ink-dim shadow-glow hover:text-ink`,children:[`↓ `,a(`stream.jumpToLatest`)]}):null]})}):null]})}function uu(e){let t={manager:[],planner:[],engineer:[],reviewer:[]},n=[];return e.forEach(e=>{et.includes(e.r.role)?t[e.r.role].push(e):n.push(e)}),{roleRows:t,systemRows:n,lastRole:[...e].reverse().find(e=>et.includes(e.r.role))?.r.role??``}}function du({rows:e}){let{t,locale:n}=z(),[r,i]=(0,G.useState)(!1),a=(0,G.useMemo)(()=>Fl(e,n),[e,n]);return(0,J.jsxs)(`section`,{className:`border-b border-line/50`,"data-system-open":r?`true`:`false`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex h-10 w-full items-center gap-2 px-4 text-left text-xs text-ink-faint hover:bg-bg/60`,children:[(0,J.jsx)(`span`,{children:t(`stream.system`)}),(0,J.jsx)(`span`,{className:`font-mono`,children:a.length}),(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),r?(0,J.jsx)(`div`,{className:`border-t border-line/40`,children:(0,J.jsx)(su,{rows:a})}):null]})}function fu({rows:e,live:t,followLatest:n,activeRole:r,activeTaskId:i}){let{roleRows:a,systemRows:o,lastRole:s}=(0,G.useMemo)(()=>uu(e),[e]),[c,l]=(0,G.useState)(()=>new Set(n&&s?[s]:[])),u=(0,G.useRef)(!1);return(0,G.useEffect)(()=>{!n||!s||u.current||l(new Set([s]))},[s,n]),(0,J.jsxs)(`div`,{className:`bg-bg/25`,children:[et.map(e=>(0,J.jsx)(lu,{role:e,rows:a[e],open:c.has(e),active:t&&(r??s)===e&&(!i||a[e].some(e=>ri(e.ev)===i)),onToggle:()=>{u.current=!0,l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}},e)),o.length>0?(0,J.jsx)(du,{rows:o}):null]})}function pu(e){let t=e.delivery;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.delivery_id!=`string`||!n.delivery_id.trim()?null:n}function mu(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.type===`ui.operator`)return null;let r=pu(n);if(r)return r}}function hu({delivery:e,onOpen:t}){let{t:n}=z(),r=e.kind===`submission_certified`;return(0,J.jsxs)(`aside`,{className:`mx-auto my-3 flex w-full max-w-full gap-3 rounded-lg border border-ok/35 bg-ok/5 px-4 py-3 lg:max-w-[61.8vw]`,children:[(0,J.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-ok/15 font-semibold text-ok`,children:`✓`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-ok`,children:n(r?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,J.jsx)(`div`,{className:`mt-1 truncate text-sm font-semibold text-ink`,title:e.title,children:e.title}),t?(0,J.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`mt-2 rounded border border-ok/40 px-2 py-1 font-mono text-[10px] text-ok hover:border-ok hover:bg-ok/10`,children:n(e.primary_target?`mission.openResult`:`mission.viewTask`)}):null]})]})}function gu({group:e,artifacts:t,onOpenArtifact:n,onOpenDelivery:r}){let i=e=>e.ev.type===`ui.argus`&&/^(info:|operation cancelled|cancelled\b)/i.test(e.r.text.trim()),a=e.rows.filter(e=>e.ev.type===`ui.argus`).map(e=>{if(e.ev.mission_result===!0)return{reply:e,messages:[]};let t=e.r.text.match(iu)??[],n=e.r.text.replace(iu,``).trim(),r=e.ev.live===!0||Array.isArray(e.ev.steps)&&e.ev.steps.length>0;return{reply:(n||r)&&!i(e)?{...e,r:{...e.r,text:n}}:null,messages:i(e)&&t.length===0?[e.r.text]:t}}),o=a.flatMap(e=>e.reply?[e.reply]:[]),s=a.flatMap(e=>e.messages),c=(()=>{let t=new Set;return e.rows.flatMap(e=>{let n=pu(e.ev);return!n||t.has(n.delivery_id)?[]:(t.add(n.delivery_id),[n])})})();return(0,J.jsxs)(`section`,{className:`conversation-thread border-b border-line/60`,children:[(0,J.jsx)(cu,{ev:e.operator.ev,r:e.operator.r,artifacts:t,onOpenArtifact:n}),o.map(e=>(0,J.jsx)(cu,{ev:e.ev,r:e.r,artifacts:t,onOpenArtifact:n},e.key)),s.map((t,n)=>(0,J.jsx)(`div`,{className:`mx-auto w-full max-w-full px-6 py-1.5 text-center text-xs text-ink-faint lg:max-w-[61.8vw]`,children:t},`${e.key}-system-${n}`)),c.map(e=>(0,J.jsx)(hu,{delivery:e,onOpen:r},e.delivery_id))]})}function _u({events:e,connected:t,showReasoning:n,onToggleReasoning:r,embedded:i=!1,showHeader:a=!0,filter:o=`all`,query:s=``,skipFirst:c=0,artifacts:l,onOpenArtifact:u,onOpenDelivery:d,snapshot:f,missionView:p,historyStatus:m=`ready`,historyRefreshing:h=!1,onRetryHistory:g}){let{locale:_,t:v}=z(),[y,b]=(0,G.useState)(!0),x=(0,G.useRef)(!0),S=(0,G.useRef)(0),[C,w]=(0,G.useState)(()=>Date.now()),T=(0,G.useRef)(null),E=(0,G.useRef)(null),D=(0,G.useDeferredValue)(e),O=(0,G.useMemo)(()=>f?ci(f,p,D):null,[D,p,f]),k=t&&(!f||O?.state===`running`),A=(0,G.useMemo)(()=>f||!t?null:ai(D),[t,D,f]);(0,G.useEffect)(()=>{if(!A)return;w(Date.now());let e=window.setInterval(()=>w(Date.now()),1e3);return()=>window.clearInterval(e)},[A]);let j=A?Math.max(0,Math.floor((C-Number(A.ts??0)*1e3)/1e3)):0,M=(0,G.useMemo)(()=>al(c>0?D.slice(c):D,{locale:_,showReasoning:n,filter:o,query:s}),[D,n,o,s,c,_]),ee=(0,G.useMemo)(()=>{let e=[],t=[],n=[],r=null;M.list.forEach(i=>{i.ev.type===`ui.operator`?(r={key:i.key,operator:i,rows:[]},e.push(r)):i.ev.type===`ui.argus`?r?r.rows.push(i):t.push(i):n.push(i)});let i=new Set(M.list.filter(e=>e.ev.type===`ui.argus`).map(e=>pu(e.ev)?.delivery_id).filter(Boolean));return{groups:e,earlierReplies:t,projectWork:n,projectDeliveries:n.flatMap(e=>{let t=pu(e.ev);return!t||i.has(t.delivery_id)?[]:(i.add(t.delivery_id),[t])})}},[M.list]),N=(0,G.useMemo)(()=>D.filter(fe).length,[D]),P=(0,G.useMemo)(()=>M.list.slice(-20).reduce((e,t)=>e+t.r.text.length,0),[M.list]);return(0,G.useEffect)(()=>{if(!y)return;let e=window.requestAnimationFrame(()=>{x.current&&T.current&&(T.current.scrollTop=T.current.scrollHeight,S.current=T.current.scrollTop)});return()=>window.cancelAnimationFrame(e)},[M.list.length,P,y]),(0,G.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<40;x.current=t||x.current&&e.scrollTop>=S.current-1,S.current=e.scrollTop,b(x.current)};e.addEventListener(`scroll`,t,{passive:!0});let n=null,r=new ResizeObserver(()=>{x.current&&(n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,x.current&&(e.scrollTop=e.scrollHeight,S.current=e.scrollTop)}))});return r.observe(e),E.current&&r.observe(E.current),()=>{e.removeEventListener(`scroll`,t),r.disconnect(),n!==null&&window.cancelAnimationFrame(n)}},[]),(0,J.jsxs)(`section`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden bg-panel ${i?``:`rounded-lg border border-line/80`}`,children:[a&&(0,J.jsx)(U,{title:v(`panel.activity`),right:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[ee.projectWork.length>0?(0,J.jsx)(`button`,{type:`button`,onClick:()=>{x.current=!1,b(!1),T.current?.scrollTo({top:0,behavior:`auto`})},className:`rounded px-1.5 py-0.5 text-xs text-blue-sky hover:bg-bg`,children:_===`zh-CN`?`查看工作进展`:`View work progress`}):null,(0,J.jsxs)(`button`,{onClick:r,className:`rounded px-1.5 py-0.5 text-xs transition-colors ${n?`text-blue-sky`:`text-ink-faint hover:text-ink-dim`}`,title:v(`stream.toggleReasoning`),children:[v(`stream.reasoning`),N?` ·${N}`:``]}),(0,J.jsx)(`span`,{className:`text-xs ${t?`text-ok`:`text-ink-faint`}`,children:t?`● ${v(`common.live`)}`:`○ ${v(`common.reconnecting`)}`})]})}),f?(0,J.jsx)(ru,{snapshot:f,view:p,events:D,connected:t,compact:!0}):A?(0,J.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line/60 bg-blue-deep/5 px-4 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-blue-sky`}),(0,J.jsx)(`span`,{className:`truncate`,children:v(`stream.backgroundWork`)}),(0,J.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono tabular-nums text-ink-faint`,children:[j,`s`]})]}):null,m===`ready`?null:(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 px-4 py-3 text-sm text-ink-faint`,role:m===`error`?`alert`:`status`,"data-conversation-history":m,children:[(0,J.jsx)(`span`,{children:v(m===`error`?`stream.historyError`:`stream.historyLoading`)}),m===`error`&&g?(0,J.jsx)(`button`,{type:`button`,onClick:g,disabled:h,className:`shrink-0 rounded px-2 py-1 text-blue-sky hover:bg-bg disabled:opacity-50`,children:v(`stream.historyRetry`)}):null]}),(0,J.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto pb-6 pt-1.5 scroll-thin`,"aria-busy":m===`loading`,children:(0,J.jsx)(`div`,{ref:E,className:`flow-root`,"data-event-stream-content":!0,children:M.list.length===0?m===`ready`?(0,J.jsx)($e,{children:v(`stream.ready`)}):null:(0,J.jsxs)(J.Fragment,{children:[ee.projectWork.length>0?(0,J.jsxs)(`section`,{"data-project-work":!0,className:`mx-auto w-full max-w-full border-b border-line/60 lg:max-w-[61.8vw]`,children:[(0,J.jsxs)(`div`,{className:`flex h-10 items-center gap-2 border-b border-line/40 px-4 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink-faint`,children:[_===`zh-CN`?`项目工作进展`:`Project work progress`,(0,J.jsx)(`span`,{className:`font-mono font-normal tracking-normal`,children:ee.projectWork.length})]}),(0,J.jsx)(fu,{rows:ee.projectWork,live:k,followLatest:!0,activeRole:O?.role,activeTaskId:O?.taskId}),ee.projectDeliveries.map(e=>(0,J.jsx)(hu,{delivery:e,onOpen:d},e.delivery_id))]},`project-work`):null,ee.earlierReplies.map(e=>(0,J.jsx)(cu,{ev:e.ev,r:e.r,artifacts:l,onOpenArtifact:u},e.key)),ee.groups.map(e=>(0,J.jsx)(gu,{group:e,artifacts:l,onOpenArtifact:u,onOpenDelivery:d},e.key))]})})}),!y&&(0,J.jsx)(`button`,{onClick:()=>{x.current=!0,b(!0),T.current&&(T.current.scrollTo({top:T.current.scrollHeight,behavior:`auto`}),S.current=T.current.scrollTop)},"aria-label":v(`stream.jumpToLatest`),title:v(`stream.jumpToLatest`),className:`absolute bottom-4 left-1/2 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-line/60 bg-panel text-sm text-ink-dim shadow-glow transition-all duration-200 hover:border-ink-faint hover:text-ink`,children:`↓`})]})}function vu(e){return e.nativeEvent.isComposing||e.keyCode===229}var yu=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function bu(e){return yu[e%yu.length]}var xu=[{id:`status`,name:`/status`,argument:`none`,desc:`roles, queued work, journal, and health`,group:`Everyday`,kind:`panel`},{id:`roles`,name:`/roles`,argument:`none`,desc:`per-role backend / model / effort + live activity`,group:`Everyday`,kind:`panel`},{id:`journal`,name:`/journal`,arg:`[N]`,argument:`optional`,desc:`recent journal entries (default 10)`,group:`Everyday`,kind:`panel`},{id:`backlog`,name:`/backlog`,arg:`[all]`,argument:`optional`,desc:`pending tasks (all = incl. done/skipped)`,group:`Everyday`,kind:`panel`},{id:`artifacts`,name:`/artifacts`,argument:`none`,desc:`result files the Reviewer has checked (Enter previews)`,group:`Everyday`,kind:`panel`},{id:`artifact`,name:`/artifact`,arg:``,argument:`required`,desc:`preview one reviewed result file`,group:`Everyday`,kind:`panel`},{id:`events`,name:`/events`,arg:`[filter] [query]`,argument:`optional`,desc:`search feed: all / watch / milestones / messages`,group:`Everyday`,kind:`panel`},{id:`find`,name:`/find`,arg:``,argument:`required`,desc:`search the current event buffer`,group:`Everyday`,kind:`panel`},{id:`cancel`,name:`/cancel`,argument:`none`,desc:`stop waiting for the current Manager reply`,group:`Everyday`,kind:`local`},{id:`ask`,name:`/ask`,arg:``,argument:`required`,desc:`answer inline — no task queued, no Planner/Engineer/Reviewer`,aliases:[`/chat`],group:`Everyday`,kind:`action`},{id:`crystalpilot`,name:`/crystalpilot`,arg:`[status|off|use ]`,argument:`optional`,desc:`enable crystallography tools in this Argus conversation`,group:`Everyday`,kind:`action`},{id:`task`,name:`/task`,arg:``,argument:`required`,desc:`queue work directly`,aliases:[`/add`],group:`Task management`,kind:`action`},{id:`plan`,name:`/plan`,arg:``,argument:`required`,desc:`preview a Planner-authored execution plan`,group:`Task management`,kind:`action`},{id:`rewrite`,name:`/rewrite`,arg:`[text]`,argument:`optional`,desc:`let the Manager rewrite your prompt before sending`,aliases:[`/refine`],group:`Task management`,kind:`action`},{id:`nudge`,name:`/nudge`,arg:``,argument:`required`,desc:`inject guidance into the running mission`,aliases:[`/inject`,`/notify`],group:`Task management`,kind:`action`},{id:`abort`,name:`/abort`,argument:`none`,desc:`immediately stop the running mission`,group:`Task management`,kind:`action`},{id:`note`,name:`/note`,arg:``,argument:`required`,desc:`append a manual note to the timeline`,group:`Task management`,kind:`action`},{id:`done`,name:`/done`,arg:``,argument:`required`,desc:`mark a task done`,group:`Task management`,kind:`action`},{id:`skip`,name:`/skip`,arg:``,argument:`required`,desc:`skip a task`,aliases:[`/rm`],group:`Task management`,kind:`action`},{id:`stop`,name:`/stop`,arg:``,argument:`required`,desc:`stop a task's auto-iteration`,group:`Task management`,kind:`action`},{id:`item`,name:`/item`,arg:``,argument:`required`,desc:`inspect a full task contract`,group:`Task management`,kind:`panel`},{id:`run`,name:`/run`,argument:`none`,desc:`return to the always-live mission feed`,group:`Task management`,kind:`local`},{id:`new`,name:`/new`,arg:`[objective]`,argument:`optional`,desc:`review, create, and switch to a fresh conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`daemons`,name:`/daemons`,arg:`[query]`,argument:`optional`,desc:`find every session + switch or create`,group:`Sessions & diagnostics`,kind:`panel`},{id:`resume`,name:`/resume`,arg:`[list|]`,argument:`optional`,desc:`switch to another project/session`,group:`Sessions & diagnostics`,kind:`action`},{id:`attach`,name:`/attach`,arg:``,argument:`required`,desc:`follow another project (read the stream)`,group:`Sessions & diagnostics`,kind:`action`},{id:`rename`,name:`/rename`,arg:``,argument:`required`,desc:`rename the current conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`doctor`,name:`/doctor`,argument:`none`,desc:`diagnose 'why isn't anything running'`,group:`Sessions & diagnostics`,kind:`panel`},{id:`backend`,name:`/backend`,arg:`[codex|claude|copilot|cursor|opencode|pi|grok|qoder|dsh]`,argument:`optional`,desc:`view or change the shared runner backend`,group:`Configuration`,kind:`action`},{id:`config`,name:`/config`,arg:`[key=value …]`,argument:`optional`,desc:`view or change runtime settings`,group:`Configuration`,kind:`panel`},{id:`identity`,name:`/identity`,arg:`[set ]`,argument:`optional`,desc:`view or replace the operator identity card`,group:`Configuration`,kind:`panel`},{id:`reset`,name:`/reset`,argument:`none`,desc:`drop the warm Manager conversation context`,group:`Configuration`,kind:`action`},{id:`skills`,name:`/skills`,arg:`[ls|promote ]`,argument:`optional`,desc:`inspect or promote runtime skills`,group:`Configuration`,kind:`action`},{id:`clear`,name:`/clear`,argument:`none`,desc:`clear the event feed view`,group:`Other`,kind:`local`},{id:`reconnect`,name:`/reconnect`,argument:`none`,desc:`reconnect the live event stream`,group:`Other`,kind:`local`},{id:`help`,name:`/help`,argument:`none`,desc:`keys + full command reference`,aliases:[`/?`,`/commands`],group:`Other`,kind:`local`},{id:`quit`,name:`/quit`,argument:`none`,desc:`leave the cockpit (background work keeps running)`,aliases:[`/exit`,`/q`],group:`Other`,kind:`local`}];new Map(xu.map(e=>[e.id,e]));var Su=new Map;for(let e of xu)for(let t of[e.name,...e.aliases??[]])Su.set(t.toLowerCase(),e);function Cu(e){return e.argument===`required`}var wu=/^\/[A-Za-z0-9_-]+$/;function Tu(e){if(!e.startsWith(`/`))return!1;let t=e.indexOf(` `),n=t===-1?e:e.slice(0,t);return wu.test(n)}function Eu(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.slice(1).includes(`/`)}function Du(e){if(!Eu(e))return[];let t=e.toLowerCase(),n=new Set,r=[];for(let e of xu)[e.name,...e.aliases??[]].some(e=>e.toLowerCase().startsWith(t))&&!n.has(e.name)&&(n.add(e.name),r.push(e));return r.sort((e,n)=>Number(Ou(n,t))-Number(Ou(e,t)))}function Ou(e,t){return[e.name,...e.aliases??[]].some(e=>e.toLowerCase()===t)}function ku(e){return e.arg?`${e.name} `:e.name}function Au(e){let t=e.trim();if(!t)return{filter:`all`,query:``};let[n,...r]=t.split(/\s+/);return n.toLowerCase()===`watch`?{filter:`attention`,query:r.join(` `)}:Fe.includes(n.toLowerCase())?{filter:n.toLowerCase(),query:r.join(` `)}:{filter:`all`,query:t}}function ju(e){if(!Tu(e))return null;let t=e.indexOf(` `),n=(t===-1?e:e.slice(0,t)).toLowerCase(),r=t===-1?``:e.slice(t+1).trim(),i=Su.get(n)??null;return{cmd:i,name:i?i.name:n,rest:r}}function Mu(e){let t=e.toLowerCase(),n=null,r=0;for(let e of Su.keys()){let i=Nu(t,e);i>r&&(r=i,n=Su.get(e).name)}return r>=.6?n:null}function Nu(e,t){return 1-Pu(e,t)/(Math.max(e.length,t.length)||1)}function Pu(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},(e,t)=>[t,...Array(r).fill(0)]);for(let e=0;e<=r;e+=1)i[0][e]=e;for(let a=1;a<=n;a+=1)for(let n=1;n<=r;n+=1)i[a][n]=Math.min(i[a-1][n]+1,i[a][n-1]+1,i[a-1][n-1]+(e[a-1]===t[n-1]?0:1));return i[n][r]}function Fu(e,t=!1,n=!1){return(t||n)&&e.toLowerCase()===`r`}var Iu={Everyday:`常用`,"Task management":`任务管理`,"Sessions & diagnostics":`会话与诊断`,Configuration:`配置`,Other:`其他`},Lu={crystalpilot:`在当前 Argus 会话启用晶体学工具,保持原生界面`,status:`查看角色、队列、日志和健康状态`,roles:`查看各角色的后端、模型、推理强度和实时活动`,journal:`查看近期日志(默认 10 条)`,backlog:`查看待处理任务(all 包含已完成和已跳过)`,artifacts:`查看 Reviewer 批准的结果文件(按 Enter 预览)`,artifact:`预览一个已批准的结果文件`,events:`搜索动态:all / watch / milestones / messages`,find:`搜索当前事件缓冲区`,cancel:`停止等待当前 Manager 回复`,ask:`直接回答,不排任务、不走 Planner/Engineer/Reviewer`,task:`直接加入任务队列`,plan:`预览 Planner 编写的执行计划`,rewrite:`让 Manager 在发送前改写提示词`,nudge:`向正在运行的任务注入指导`,abort:`立即终止正在运行的任务`,note:`向时间线添加手动备注`,done:`将任务标记为完成`,skip:`跳过任务`,stop:`停止任务的自动迭代`,item:`查看完整任务契约`,run:`返回持续更新的任务动态`,new:`检查、创建并切换到新会话`,daemons:`查找全部会话并切换或创建`,resume:`切换到其他项目或会话`,attach:`跟随其他项目并读取其动态`,rename:`重命名当前会话`,doctor:`诊断为什么没有任务运行`,backend:`查看或更改共享 Runner 后端`,config:`查看或更改运行时设置`,identity:`查看或替换操作者身份卡`,reset:`清除 Manager 的热会话上下文`,skills:`查看或提升运行时 Skill`,clear:`清空事件动态视图`,reconnect:`重新连接实时动态`,help:`查看快捷键和完整命令参考`,quit:`离开控制台(后台工作继续运行)`};function Ru(e,t){return t===`zh-CN`?Lu[e.id]:e.id===`reconnect`?`reconnect live activity`:e.desc}function zu(e,t){return t===`zh-CN`?Iu[e.group]:e.group}function Bu(e,t){let n=new Map;for(let r of e){let e=zu(r,t),i=r.aliases?.length?` (= ${r.aliases.join(`, `)})`:``,a=`${r.name}${r.arg?` ${r.arg}`:``}${i}`;n.has(e)||n.set(e,[]),n.get(e).push({label:a,desc:Ru(r,t)})}return[...n.entries()].map(([e,t])=>({group:e,rows:t}))}var Vu=`slash-completion-listbox`;function Hu(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function Uu(e){return`slash-completion-option-${e}`}function Wu({query:e,selected:t,onSelect:n}){let{locale:r,t:i}=z(),a=Du(e);if(a.length===0)return null;let o=a.slice(0,8),s=Hu(t,o.length);return(0,J.jsx)(`div`,{id:Vu,role:`listbox`,"aria-label":i(`slash.suggestions`),className:`slash-completion-menu scroll-thin border-b border-line/40`,children:o.map((e,t)=>(0,J.jsxs)(`button`,{id:Uu(e.id),type:`button`,role:`option`,"aria-selected":t===s,onPointerDown:e=>{e.preventDefault(),n(t)},className:`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm transition-colors ${t===s?`bg-blue/10 text-ink`:`text-ink-dim hover:bg-line/20`}`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-blue`,children:e.name}),e.arg?(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-ink-faint`,children:e.arg}):null,(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:Ru(e,r)})]},e.id))})}var Gu=32e3,Ku=10485760,qu=26214400,Ju=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.pdf`,`.md`,`.markdown`,`.txt`,`.json`,`.csv`].join(`,`),Yu={".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".webp":`image/webp`,".pdf":`application/pdf`,".md":`text/markdown`,".markdown":`text/markdown`,".txt":`text/plain`,".json":`application/json`,".csv":`text/csv`};function Xu(e){let t=String(e||``).trim().toLowerCase(),n=t.lastIndexOf(`.`);return n>=0?t.slice(n):``}function Zu(e){return Yu[Xu(e.name)]||String(e.type||``).split(`;`,1)[0].trim()||`application/octet-stream`}function Qu(e){return Object.hasOwn(Yu,Xu(e.name))}function $u(e){return Zu(e).startsWith(`image/`)}function ed(e){return[e.name,String(e.size),Zu(e),String(e.lastModified??``)].join(`::`)}function td(e,t){let n=[],r=[],i=new Set(e.map(ed)),a=e.reduce((e,t)=>e+Math.max(0,t.size||0),0),o=e.length;for(let e of t){let t=ed(e);if(!i.has(t)){if(i.add(t),!Qu(e)){r.push({code:`unsupported`,fileName:e.name});continue}if(o>=5){r.push({code:`too-many`,limitCount:5});continue}if(e.size>10485760){r.push({code:`too-large`,fileName:e.name,limitBytes:Ku});continue}if(a+e.size>26214400){r.push({code:`too-large-total`,limitBytes:qu});continue}n.push(e),a+=e.size,o+=1}}return{accepted:n,issues:r}}function nd(e){return e?Array.from(e):[]}function rd(e){return nd(e?.types).map(e=>String(e)).includes(`Files`)||id(e).length>0}function id(e){let t=nd(e?.files).filter(e=>e instanceof File);if(t.length)return t;let n=[];for(let t of nd(e?.items)){if(String(t?.kind||``)!==`file`||typeof t?.getAsFile!=`function`)continue;let e=t.getAsFile();e instanceof File&&n.push(e)}return n}function ad({file:e,removeLabel:t,onRemove:n,disabled:r=!1}){let[i,a]=(0,G.useState)(``);return(0,G.useEffect)(()=>{if(!$u(e)||typeof URL>`u`||typeof URL.createObjectURL!=`function`){a(``);return}let t=URL.createObjectURL(e);return a(t),()=>URL.revokeObjectURL(t)},[e]),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-2xl border border-line/50 bg-panel/80 px-2.5 py-2 text-xs shadow-[0_10px_24px_-20px_rgb(0_0_0/0.2)]`,children:[i?(0,J.jsx)(`img`,{src:i,alt:``,className:`h-10 w-10 shrink-0 rounded-xl border border-line/40 object-cover`}):null,(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate font-medium text-ink`,title:e.name,children:e.name}),(0,J.jsxs)(`div`,{className:`truncate text-ink-faint`,children:[yt(e.size),` · `,Zu(e)]})]}),(0,J.jsx)(`button`,{type:`button`,onClick:n,disabled:r,"aria-label":t,title:t,className:`send-control h-8 w-8 shrink-0 rounded-full border-line/60 text-ink-faint hover:border-err/50 hover:bg-err/10 hover:text-err`,children:`×`})]})}function od({value:e,onChange:t,inputRef:n,fileInputRef:r,onFiles:i,inputProps:a,onSend:o,onCancel:s,pending:c,disabled:l=!1,controls:u}){let{t:d,locale:f}=z(),p=f===`zh-CN`,{refs:m,text:h}=io(e),g=e.length>Gu;return(0,G.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.getClientRects().length&&(e.style.height=`0px`,e.style.height=`${Math.min(132,Math.max(28,e.scrollHeight))}px`)};t();let r=e.clientWidth,i=new ResizeObserver(()=>{e.clientWidth!==r&&(r=e.clientWidth,t())});return i.observe(e),()=>i.disconnect()},[n,h]),(0,J.jsxs)(`div`,{className:`composer-surface`,"data-pending":c,children:[m.length>0&&(0,J.jsx)(`div`,{className:`map-reference-chips`,children:m.map((e,n)=>(0,J.jsxs)(`span`,{children:[(0,J.jsxs)(`span`,{children:[p?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":p?`移除引用`:`Remove reference`,onClick:()=>t(m.filter((e,t)=>t!==n).map(ro).join(``)+h),children:(0,J.jsx)(Je,{size:12})})]},`${e.task_id}:${e.step_id}:${n}`))}),(0,J.jsxs)(`form`,{className:`map-composer`,onSubmit:e=>{e.preventDefault(),!c&&!l&&!g&&o()},children:[(0,J.jsx)(`input`,{ref:r,type:`file`,multiple:!0,accept:Ju,hidden:!0,disabled:l||c,onChange:i}),(0,J.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":d(`chat.attach`),title:d(`chat.attach`),disabled:l||c,onClick:()=>r.current?.click(),children:(0,J.jsx)(un,{size:19,strokeWidth:1.6})}),(0,J.jsx)(`textarea`,{...a,ref:n,rows:1,value:h,disabled:l,onChange:e=>t(m.map(ro).join(``)+e.target.value),onKeyDown:e=>{if(g&&e.key===`Enter`&&!e.shiftKey&&!vu(e)){e.preventDefault();return}a.onKeyDown?.(e),!(e.defaultPrevented||vu(e))&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),!c&&!l&&o())}}),(0,J.jsx)(`button`,{type:c?`button`:`submit`,onClick:c?s:void 0,disabled:l||!c&&(!h.trim()||g),"aria-label":c?p?`停止回复`:`Stop reply`:p?`发送消息`:`Send message`,className:`map-send ${c?`is-pending`:``}`,children:c?(0,J.jsx)(gn,{size:15}):(0,J.jsx)(Ht,{size:20})})]}),g&&(0,J.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:d(`chat.messageTooLong`)}),u?(0,J.jsx)(`div`,{className:`composer-controls`,children:u}):null]})}var sd=[`auto`,`task`,`chat`];function cd({value:e,onChange:t,disabled:n=!1,tabIndex:r}){let{t:i}=z(),a={auto:i(`chat.routeAuto`),task:i(`chat.routeTask`),chat:i(`chat.routeChat`)};return(0,J.jsx)(`div`,{className:`route-seg`,role:`radiogroup`,"aria-label":i(`chat.routeLabel`),title:i(`chat.routeHint`),children:sd.map(i=>(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===i,disabled:n,tabIndex:r,onClick:()=>{i!==e&&t(i)},children:a[i]},i))})}function ld(e,t){if(!t.onRewrite||!Fu(e.key,e.ctrlKey,e.metaKey))return!1;e.preventDefault();let n=t.value.trim();return n&&!t.disabled&&!t.pending&&!t.rewriting&&t.onRewrite(n),!0}function ud({value:e,onChange:t,onSend:n,onCancel:r,disabled:i,pending:a,focusSignal:o,attachments:s,onAttachmentsChange:c,onRewrite:l,rewriting:u=!1,slashSelection:d,onSlashSelectionChange:f,routeOverride:p=`auto`,onRouteOverrideChange:m,footer:h}){let{t:g}=z(),_=(0,G.useRef)(null),v=(0,G.useRef)(null),y=(0,G.useRef)(!1),[b,x]=(0,G.useState)(0),[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(``),[E,D]=(0,G.useState)(0),[O,k]=(0,G.useState)(!1),[A,j]=(0,G.useState)(!1);(0,G.useEffect)(()=>{a||j(!1)},[a]),(0,G.useEffect)(()=>{if(!a&&!u)return;let e=setInterval(()=>x(e=>e+1),1e3);return()=>clearInterval(e)},[a,u]),(0,G.useEffect)(()=>{o&&!i&&_.current?.focus()},[o,i]);let M=Du(e).slice(0,8),ee=M.length>0&&!S,N=ee?Hu(d,M.length):0,P=ee?M[N]:void 0,F=e=>{let n=M[e];n&&(t(ku(n)),n.argument===`none`&&C(!0),f(0),_.current?.focus())},te=async()=>{if(!e.trim()||i||u||y.current)return;let t=a;if(t&&s.length){T(g(`chat.attachWhileRunning`));return}y.current=!0;try{(t?await n(e.trim(),[],void 0,{whileRunning:!0}):await n(e.trim(),s))&&(f(0),C(!1),T(``),j(t))}finally{y.current=!1}},ne=e=>{if(!e.length||i||a||y.current)return;let{accepted:t,issues:n}=td(s,e);t.length&&c([...s,...t]),T(n.map(e=>e.code===`unsupported`?g(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?g(`chat.attachTooLarge`,{name:e.fileName,size:yt(e.limitBytes)}):e.code===`too-many`?g(`chat.attachTooMany`,{count:e.limitCount}):g(`chat.attachTotalTooLarge`,{size:yt(e.limitBytes)})).join(` `))},re=(e,t)=>{rd(e.dataTransfer)&&(e.preventDefault(),D(e=>Math.max(0,e+t)))};return(0,J.jsxs)(`div`,{className:`conversation-composer flex flex-col ${E>0?`rounded-3xl ring-2 ring-manager/60`:``}`,"data-compact":!O&&!e.trim()&&!s.length&&!a&&!u&&!w&&!E,onFocusCapture:()=>k(!0),onBlurCapture:e=>k(e.currentTarget.contains(e.relatedTarget)),onDragEnter:e=>re(e,1),onDragOver:e=>re(e,0),onDragLeave:e=>re(e,-1),onDrop:e=>{rd(e.dataTransfer)&&(e.preventDefault(),D(0),ne(id(e.dataTransfer)))},children:[a?(0,J.jsx)(`div`,{className:`px-3 py-2 text-xs text-ink-faint`,role:`status`,children:g(A?`chat.queuedWhileRunning`:`chat.stopWaitingHint`)}):null,ee?(0,J.jsx)(Wu,{query:e,selected:N,onSelect:F}):null,s.length||w||E>0?(0,J.jsxs)(`div`,{className:`px-3 py-2`,children:[E>0?(0,J.jsx)(`div`,{className:`mb-2 text-xs text-manager`,children:g(`chat.attachDrop`)}):null,(0,J.jsx)(`div`,{className:`map-attachment-tray`,children:s.map((e,t)=>(0,J.jsx)(ad,{file:e,removeLabel:g(`chat.attachRemove`,{name:e.name}),onRemove:()=>{c(s.filter(t=>t!==e)),T(``)}},`${e.name}:${e.lastModified}:${t}`))}),(0,J.jsx)(`div`,{className:`text-xs ${w?`text-err`:`text-ink-faint`}`,children:w||g(`chat.attachHint`,{count:5,perFile:yt(10485760),total:yt(26214400)})})]}):null,(0,J.jsx)(od,{value:e,onChange:e=>{t(e),f(0),C(!1)},inputRef:_,fileInputRef:v,onFiles:e=>{ne(Array.from(e.target.files??[])),e.target.value=``},onSend:()=>void te(),onCancel:r,pending:a,disabled:i,inputProps:{onPaste:e=>{let t=id(e.clipboardData);t.length&&(e.preventDefault(),ne(t))},onKeyDown:t=>{vu(t)||ld(t,{value:e,disabled:i,pending:a,rewriting:u,onRewrite:l})||(ee?t.key===`ArrowDown`||t.key===`ArrowUp`?(t.preventDefault(),f(Hu(N+(t.key===`ArrowDown`?1:-1),M.length))):t.key===`Tab`||t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),F(N)):t.key===`Escape`&&(t.preventDefault(),C(!0)):t.key===`Escape`&&a?(t.preventDefault(),r()):t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),te()))},"aria-label":g(`chat.messageArgus`),"aria-keyshortcuts":`Control+R Meta+R`,"aria-controls":ee?Vu:void 0,"aria-expanded":ee,"aria-activedescendant":P?Uu(P.id):void 0,placeholder:g(i?`chat.selectSession`:`chat.placeholder`)},controls:(0,J.jsxs)(J.Fragment,{children:[m?(0,J.jsx)(cd,{value:p,onChange:m,disabled:i||a}):null,l&&e.trim()?(0,J.jsx)(`button`,{type:`button`,onClick:()=>l(e.trim()),disabled:i||a||u,title:`Ctrl/⌘+R · ${g(`chat.rewriteHint`)}`,"aria-label":g(`chat.rewriteLabel`),"aria-keyshortcuts":`Control+R Meta+R`,children:u?`${bu(b)} ${g(`chat.rewriting`)}`:g(`chat.rewrite`)}):null]})}),h]})}function dd(e,t,n,r=`en`){return e.map(e=>({id:`command-${e.id}`,label:Ru(e,r),hint:`${e.name}${e.arg?` ${e.arg}`:``}`,group:zu(e,r),keywords:[e.name,...e.aliases??[]].join(` `),run:()=>Cu(e)?n(`${e.name} `):t(e.name)}))}function fd(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=`${e.label} ${e.group} ${e.hint??``} ${e.keywords??``}`.toLowerCase();return n.every(e=>t.includes(e))}):e}function pd({open:e,onClose:t,items:n}){let{t:r}=z(),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(0),c=(0,G.useRef)(null),l=(0,G.useRef)(null);(0,G.useEffect)(()=>{e&&(a(``),s(0),setTimeout(()=>c.current?.focus(),0))},[e]);let u=(0,G.useMemo)(()=>fd(n,i),[i,n]);(0,G.useEffect)(()=>{o>=u.length&&s(Math.max(0,u.length-1))},[u.length,o]),(0,G.useEffect)(()=>{l.current?.scrollIntoView({block:`nearest`})},[e,i,o]);let d=e=>{e&&(t(),e.run())},f=e=>{vu(e)||(e.key===`ArrowDown`?(e.preventDefault(),u.length&&s(e=>Math.min(u.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),d(u[o])))},p=[];for(let e of u){let t=p.find(t=>t.name===e.group);t||(t={name:e.group,items:[]},p.push(t)),t.items.push(e)}let m=-1;return(0,J.jsxs)(dt,{open:e,onClose:t,label:r(`help.palette`),width:`max-w-xl`,align:`top`,children:[(0,J.jsx)(`div`,{className:`border-b border-line px-4 py-3`,children:(0,J.jsx)(`input`,{ref:c,value:i,onChange:e=>a(e.target.value),onKeyDown:f,placeholder:r(`palette.placeholder`),role:`combobox`,"aria-expanded":e,"aria-autocomplete":`list`,"aria-controls":`command-palette-results`,"aria-activedescendant":u[o]?`palette-${u[o].id}`:void 0,className:`w-full bg-transparent font-mono text-sm text-ink outline-none placeholder:text-ink-faint`})}),(0,J.jsxs)(`div`,{id:`command-palette-results`,role:`listbox`,className:`max-h-[52vh] overflow-y-auto scroll-thin py-1.5`,children:[u.length===0&&(0,J.jsx)(`div`,{className:`px-4 py-6 text-center text-xs text-ink-faint`,children:r(`palette.noMatches`)}),p.map(e=>(0,J.jsxs)(`div`,{className:`mb-1`,children:[(0,J.jsx)(`div`,{className:`px-4 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.name}),e.items.map(e=>{m++;let t=m===o;return(0,J.jsxs)(`button`,{id:`palette-${e.id}`,ref:t?l:void 0,role:`option`,"aria-selected":t,onMouseEnter:()=>s(u.indexOf(e)),onClick:()=>d(e),className:`flex w-full items-center justify-between px-4 py-1.5 text-left text-sm transition-colors ${t?`bg-blue-deep/20 text-ink`:`text-ink-dim hover:bg-panel/60`}`,children:[(0,J.jsx)(`span`,{children:e.label}),e.hint&&(0,J.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:e.hint})]},e.id)})]},e.name))]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-4 py-1.5 text-[10px] text-ink-faint`,children:[(0,J.jsx)(`span`,{children:r(`palette.navigate`)}),(0,J.jsx)(`span`,{children:r(`palette.run`)}),(0,J.jsx)(`span`,{children:r(`palette.close`)})]})]})}var md=[{keys:`⌘K / Ctrl+K`,desc:`help.palette`},{keys:`⌘B / Ctrl+B`,desc:`help.sessions`},{keys:`⌘J / Ctrl+J`,desc:`help.managerChat`},{keys:`⌘R / Ctrl+R`,desc:`help.rewrite`},{keys:`⌘T / Ctrl+T`,desc:`help.reasoning`},{keys:`⌘. / Ctrl+.`,desc:`help.kiosk`},{keys:`/`,desc:`help.composer`},{keys:`↵ Enter`,desc:`help.send`},{keys:`Shift+Enter`,desc:`help.newline`},{keys:`?`,desc:`help.thisHelp`},{keys:`Esc`,desc:`help.escape`}];function hd({open:e,onClose:t}){let{locale:n,t:r}=z(),i=Bu(xu,n);return(0,J.jsxs)(dt,{open:e,onClose:t,label:r(`help.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`help.title`)}),(0,J.jsxs)(`div`,{className:`max-h-[70dvh] overflow-y-auto scroll-thin`,children:[(0,J.jsx)(`div`,{className:`p-4`,children:md.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between py-1.5`,children:[(0,J.jsx)(`span`,{className:`text-sm text-ink-dim`,children:r(e.desc)}),(0,J.jsx)(`kbd`,{className:`rounded border border-line bg-surface px-2 py-0.5 font-mono text-[11px] text-ink`,children:e.keys})]},e.keys))}),(0,J.jsxs)(`div`,{className:`border-t border-line px-4 pb-4 pt-3`,children:[(0,J.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-ink-faint`,children:r(`help.commands`)}),i.map(e=>(0,J.jsxs)(`div`,{className:`mb-4`,children:[(0,J.jsx)(`p`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.group}),e.rows.map(e=>(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1`,children:[(0,J.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-ink`,children:e.label}),(0,J.jsx)(`span`,{className:`text-right text-xs text-ink-dim`,children:e.desc})]},e.label))]},e.group))]})]})]})}var gd=[[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]];function _d({sid:e,config:t,onSaved:n}){let{locale:r}=z(),i=r===`zh-CN`,a=t.roles.find(e=>e.role===`manager`),o=t.roles.find(e=>e.role===`engineer`),s=a&&a.backend!==`memory`?a:o,c=new Map(t.operator_knobs.map(e=>[e.name,e.value])),l=c.get(`ARGUS_SKILL_MAP_MODEL`)||`auto`,[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(``),m=(t.model_options??[]).map(e=>e.model);l!==`auto`&&!m.includes(l)&&m.unshift(l);let h=async(t,r)=>{if(!u){d(!0),p(``);try{await R.setConfig(e,t,r),await n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},g=i?`自动(轻量)`:`Auto (light)`,_=i?`跟随前台模型`:`Follow the front-door model`,v=[{name:`ARGUS_SKILL_MAP_REASONING_EFFORT`,label:i?`讲解生成强度`:`Explanation effort`,follow:g},{name:`ARGUS_SKILL_MAP_REVIEW_REASONING_EFFORT`,label:i?`讲解复核强度`:`Explanation review effort`,follow:i?`自动(中)`:`Auto (medium)`}];return(0,J.jsxs)(`section`,{className:`map-model-settings rounded-lg border border-line glass-card p-3`,"aria-label":i?`地图模型`:`Map model`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:i?`地图模型`:`Map model`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:i?`地图讲解与摘要用的模型;默认沿用前台(经理)的接入与账号,以低强度起草,不占用科研的推理预算。可以选一个便宜的。`:`The model that writes map explanations and summaries. By default it uses the front-door (Manager) runner and account at a light effort, not the research budget. A cheaper one is fine.`}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[s?.backend_label,` · `,s?.model||(i?`接入默认模型`:`Runner default model`)]}),t.map_model?.note&&(0,J.jsx)(`p`,{role:`status`,"data-map-model-note":!0,className:`mt-1 text-xs text-warn`,children:i?`已改用自动:所选摘要模型在当前接入(${t.map_model.backend})下不可用。`:t.map_model.note}),(0,J.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[i?`摘要模型`:`Summary model`,(0,J.jsxs)(`select`,{value:l,disabled:u,"aria-label":i?`摘要模型`:`Summary model`,onChange:e=>void h(`ARGUS_SKILL_MAP_MODEL`,e.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:_}),m.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]}),v.map(e=>(0,J.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[e.label,(0,J.jsxs)(`select`,{value:c.get(e.name)||`auto`,disabled:u,onChange:t=>void h(e.name,t.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:e.follow}),gd.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:i?t:e},e))]})]},e.name)),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`复核用于检查讲解文字,保存后对新发起的讲解生效。`:`The review checks explanation text. Changes apply to newly requested explanations.`}),f&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:f})]})}function vd({sid:e,primaryModel:t}){let{locale:n}=z(),r=n===`zh-CN`,i=(e,t)=>r?e:t,a=M(),o=A({queryKey:[`advisor-settings`,e],queryFn:({signal:t})=>R.advisorSettings(e,t),enabled:!!e,retry:!1}),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(!1),_=(0,G.useRef)(e);_.current=e,(0,G.useEffect)(()=>{c(o.data?.saved??null);let e=o.data?.saved;u(!!(e?.model&&!o.data?.model_options?.some(t=>t.backend===e.backend&&t.model===e.model)))},[e,o.data]),(0,G.useEffect)(()=>{m(``),g(!1),f(!1)},[e]);let v=e=>{c(t=>t&&{...t,...e}),g(!1)},y=o.data?.model_options??[],b=(e,t)=>JSON.stringify([e,t]),x=s&&y.some(e=>e.backend===s.backend&&e.model===s.model)?b(s.backend,s.model):``,S=async()=>{if(!s||d)return;let t=e;f(!0),m(``),g(!1);try{let{schema_version:e,...n}=s,r=await R.saveAdvisorSettings(t,{...n,model:n.model.trim()});a.setQueryData([`advisor-settings`,t],r),_.current===t&&g(!0)}catch(e){_.current===t&&m(e instanceof Error?e.message:String(e))}finally{_.current===t&&f(!1)}};return(0,J.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,"aria-label":i(`顾问模型`,`Advisor model`),children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`顾问模型`,`Advisor model`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:i(`团队遇到难题时可以向它提问。只在咨询时调用,用量计入当前项目。`,`The team can consult this model on specific questions. It runs only when asked, and usage belongs to this project.`)}),t?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[i(`当前执行模型:`,`Current execution model: `),t]}):null,o.isPending?(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-ink-faint`,children:i(`正在读取设置…`,`Loading settings…`)}):o.isError?(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-err`,role:`alert`,children:[i(`顾问设置读取失败。`,`Could not load advisor settings.`),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void o.refetch(),className:`underline`,children:i(`重试`,`Retry`)})]}):s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:s.enabled,disabled:d,onChange:e=>v({enabled:e.target.checked})}),i(`允许团队咨询顾问`,`Let the team consult the advisor`)]}),(0,J.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[y.length>0?(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim sm:col-span-2`,children:[i(`顾问使用的模型`,`Advisor model`),(0,J.jsxs)(`select`,{"aria-label":i(`选择顾问模型`,`Choose advisor model`),value:l?`custom`:x,disabled:d,onChange:e=>{if(e.target.value===`custom`){u(!0);return}let t=y.find(t=>b(t.backend,t.model)===e.target.value);t&&(u(!1),v({backend:t.backend,model:t.model}))},className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,disabled:!0,children:i(`选择模型`,`Choose a model`)}),y.map(e=>(0,J.jsx)(`option`,{value:b(e.backend,e.model),children:e.model},b(e.backend,e.model))),(0,J.jsx)(`option`,{value:`custom`,children:i(`配置其他模型…`,`Configure another model…`)})]})]}):null,l||y.length===0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`接入`,`Runner`),(0,J.jsxs)(`select`,{"aria-label":i(`顾问接入`,`Advisor runner`),value:s.backend,disabled:d,onChange:e=>v({backend:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:i(`选择接入`,`Choose a runner`)}),o.data?.supported_backends.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`顾问使用的模型`,`Advisor model ID`),(0,J.jsx)(`input`,{value:s.model,disabled:d,onChange:e=>v({model:e.target.value}),placeholder:i(`填写该接入的模型标识`,`Model ID for this runner`),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}):null,(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`思考强度`,`Reasoning effort`),(0,J.jsxs)(`select`,{"aria-label":i(`顾问思考强度`,`Advisor reasoning effort`),value:s.effort,disabled:d,onChange:e=>v({effort:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:i(`模型默认`,`Model default`)}),[[`minimal`,`最低`],[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]].map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:r?t:e},e))]})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`每次角色调用最多咨询`,`Consultations per role call`),(0,J.jsx)(`input`,{type:`number`,min:1,max:20,value:s.max_calls_per_turn,disabled:d,onChange:e=>v({max_calls_per_turn:Number(e.target.value)}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}),o.data?.overridden_fields.length?(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:[i(`运行服务另有指定设置;当前顾问:`,`The runtime overrides some saved settings. Current advisor: `),o.data.config.enabled?`${o.data.config.backend} · ${o.data.config.model}`:i(`未启用`,`disabled`)]}):null,(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void S(),disabled:d||s.enabled&&(!s.backend||!s.model.trim()),className:`rounded border border-line px-3 py-2 text-xs text-ink hover:border-blue disabled:opacity-40`,children:d?i(`保存中…`,`Saving…`):i(`保存顾问设置`,`Save advisor settings`)}),h?(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-dim`,children:i(`已保存,下次咨询生效。`,`Saved for the next consultation.`)}):null]}),p?(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:p}):null]}):null]})}var yd=[/^\[?\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[.,]\d+)?(?:Z|[+-]\d{2}:?\d{2})?\]?\s*/,/^\[?(?:INFO|WARNING|WARN|ERROR|DEBUG|CRITICAL|TRACE)\]?\s*[:\-|]?\s*/i,/^(?:\[\d+\]|[\w.]+:)\s+/];function bd(e){let t=e.trim();for(let e of yd)t=t.replace(e,``);return t.trim()}var xd=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`;function Sd(e,t=200){let n=String(e??``).split(/\r?\n/).map(bd).filter(e=>e&&!/^[-=_.\s]+$/.test(e));return n.length?xd(n[n.length-1],t):``}var Cd=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function wd(e){if(!e)return[];let t=e.provider??{},n=[],r=Cd(t.completed)??0,i=Cd(t.errors)??0;n.push({key:`calls`,value:String(r+i)}),n.push({key:`failed`,value:String(i)});let a=Cd(t.p95_duration_ms);return a&&a>0&&n.push({key:`slowest`,value:`${(a/1e3).toFixed(1)}s`}),n}var Td=[{name:`ARGUS_SKILL_MAX_ACTIVE_DAEMONS`,group:`Limits`,label:`Active daemon limit`,description:`Maximum background sessions running on this host.`},{name:`ARGUS_SKILL_SAFE_MODE`,group:`Safety`,label:`Safe mode`,description:`Enable extra-conservative runtime guardrails.`},{name:`ARGUS_SKILL_OPERATOR_AVAILABLE`,group:`Safety`,label:`Operator available`,description:`Off suppresses operator questions: Argus decides on recorded assumptions.`},{name:`ARGUS_SKILL_ENABLE_TELEGRAM`,group:`Interface`,label:`Telegram`,description:`Enable the Telegram notification bridge.`},{name:`ARGUS_SKILL_SHOW_REASONING`,group:`Interface`,label:`Show reasoning`,description:`Stream role reasoning into the cockpit activity view.`}];function Ed(e){let t=new Map(e.map(e=>[e.name,e]));return Td.flatMap(e=>{let n=t.get(e.name);return n?[{...n,group:e.group,label:e.label,doc:e.description}]:[]})}function Dd(e,t){let n=new URL(e),r=n.protocol===`https:`?`wss:`:`ws:`,i=encodeURIComponent(t);return{webApi:`${n.origin}/api`,eventStream:`${r}//${n.host}/api/projects/${i}/stream`,daemon:`local process · events.jsonl · no TCP port`}}var Od=`ARGUS_SKILL_OPERATOR_AVAILABLE`,kd=new Set([`0`,`false`,`no`,`off`,`disable`,`disabled`]);function Ad(e){let t=(e??[]).find(e=>e.name===Od);return!!(t&&kd.has(t.value.trim().toLowerCase()))}function jd(e){return e instanceof se?e.code===`trial_route_unavailable`||e.status===403||e.status===404:!1}function Md(e,t){let n=jd(e);return{text:t(n?`operations.unavailableHere`:`operations.requestFailed`),technical:e instanceof Error?e.message:String(e||``),refused:n}}var Nd={ARGUS_SKILL_MAX_ACTIVE_DAEMONS:{label:`settings.knob.activeDaemons`,doc:`settings.knob.activeDaemonsDoc`},ARGUS_SKILL_SAFE_MODE:{label:`settings.knob.safeMode`,doc:`settings.knob.safeModeDoc`},ARGUS_SKILL_OPERATOR_AVAILABLE:{label:`settings.knob.operatorAvailable`,doc:`settings.knob.operatorAvailableDoc`},ARGUS_SKILL_ENABLE_TELEGRAM:{label:`settings.knob.telegram`,doc:`settings.knob.telegramDoc`},ARGUS_SKILL_SHOW_REASONING:{label:`settings.knob.showReasoning`,doc:`settings.knob.showReasoningDoc`}},Pd={Limits:`settings.group.limits`,Safety:`settings.group.safety`,Interface:`settings.group.interface`};function Fd(e,t){let n=e.trim();return n===`not applicable for this model`?t(`settings.source.notApplicable`):n.startsWith(`capability vault`)?t(`settings.source.vaultDefault`):n.startsWith(`default`)?t(`settings.source.default`):n.startsWith(`persisted:`)||n===`persisted`?t(`settings.source.saved`):n.startsWith(`ARGUS_SKILL_`)||n===`env`?t(`settings.source.environment`):n.startsWith(`global:`)?t(`settings.source.hostConfig`):t(`settings.source.other`)}function Id(e,t){let n=e.value.trim().toLowerCase();return[`ARGUS_SKILL_SAFE_MODE`,`ARGUS_SKILL_OPERATOR_AVAILABLE`,`ARGUS_SKILL_ENABLE_TELEGRAM`,`ARGUS_SKILL_SHOW_REASONING`].includes(e.name)?t([`1`,`true`,`on`,`yes`].includes(n)?`settings.value.enabled`:`settings.value.disabled`):e.value}function Ld(e,t){let n={low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`}[e.toLowerCase()];return n?t(`settings.effort.${n}`):e}function Rd({message:e,retrying:t,onRetry:n,t:r}){return(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 px-4 py-8 text-center`,children:[(0,J.jsx)(`p`,{className:`text-sm text-err`,children:e}),(0,J.jsx)(`button`,{type:`button`,onClick:n,disabled:t,className:`rounded-md border border-err/40 px-3 py-1.5 text-xs font-medium text-err hover:bg-err/10 disabled:opacity-40`,children:r(t?`common.loading`:`common.retry`)})]})}function zd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a,isError:o,isFetching:s,refetch:c}=ye(e,t),l=!!(i&&(i.recommended||i.checks.length||i.log_tail.trim()));return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`doctor.title`),width:`max-w-3xl`,children:[(0,J.jsx)(lt,{title:r(`doctor.title`),sub:r(`doctor.subtitle`)}),(0,J.jsxs)(`div`,{className:`p-4`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!a&&o&&(0,J.jsx)(Rd,{message:r(`doctor.loadError`),retrying:s,onRetry:()=>void c(),t:r}),!a&&!o&&!l&&(0,J.jsx)($e,{children:r(`doctor.empty`)}),!a&&!o&&i?.recommended&&(0,J.jsxs)(`div`,{className:`mb-4 rounded-lg border border-gold/40 bg-gold/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-gold`,children:r(`doctor.recommended`)}),(0,J.jsx)(`div`,{className:`mt-1 text-sm text-ink`,children:i.recommended.name}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:i.recommended.detail}),i.recommended.fix&&(0,J.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap break-words rounded bg-bg p-2 font-mono text-xs text-blue-sky`,children:i.recommended.fix})]}),!a&&!o&&(0,J.jsx)(`div`,{className:`space-y-1.5`,children:(i?.checks??[]).map((e,t)=>(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-line/60 px-3 py-2`,children:[(0,J.jsx)(`span`,{className:e.ok?`text-ok`:`text-err`,children:e.ok?`✓`:`✗`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.name}),e.detail&&(0,J.jsx)(`div`,{className:`mt-0.5 text-[11px] text-ink-dim`,children:e.detail}),!e.ok&&e.fix&&(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words rounded bg-bg p-1.5 font-mono text-xs text-ink-dim`,children:e.fix})]})]},t))}),!a&&!o&&i?.log_tail?.trim()&&(0,J.jsxs)(`div`,{className:`mt-4`,children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`doctor.daemonLog`)}),(0,J.jsxs)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:[(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[r(`doctor.lastEntry`),` · `]}),Sd(i.log_tail)]}),(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:i.log_tail})})]})]})]})}function Bd({sid:e,open:t,onClose:n}){let{t:r}=z(),i=M(),{data:a,isLoading:s,isError:c,isFetching:l,refetch:u}=Me(e,t),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(!1),[b,x]=(0,G.useState)(``),[C,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)(``),[k,A]=(0,G.useState)(!1),[j,ee]=(0,G.useState)(``);(0,G.useEffect)(()=>{t||f(!1)},[t]),(0,G.useEffect)(()=>{!t||!a||(m(a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MODEL`)?.value??``),g(``))},[a,t]);let N=async()=>{await u(),await i.invalidateQueries({queryKey:[`map-copy`]})},P=br(a),F=xr(a),te=Sr(a),ne=e=>!e||(te?vr(te)===e:e===vr(P)),re=h||vr(P),ie=async t=>{if(!(_||ne(t))){v(!0),x(``),w(!1);try{await R.setConfig(e,`ARGUS_SKILL_RUNNER_BACKEND`,t),await N(),x(r(`settings.backendSwitched`,{backend:yr(t,r)}))}catch(e){w(!0),x(Md(e,r).text)}finally{v(!1)}}},I=async t=>{if(!_){v(!0),x(``),w(!1);try{await R.setConfig(e,`ARGUS_SKILL_MAP_MODEL`,t||`auto`),await N(),x(t&&t!==`auto`?r(`settings.mapModelSet`,{model:t}):r(`settings.mapModelFollows`))}catch(e){w(!0),x(Md(e,r).text)}finally{v(!1)}}},L=async()=>{if(!_){v(!0),x(``),w(!1);try{let t=p.trim()||`auto`;await R.setConfig(e,`ARGUS_SKILL_MODEL`,t,!0),await N(),x(r(`settings.modelAppliedToRoles`,{model:t}))}catch(e){w(!0),x(Md(e,r).text)}finally{v(!1)}}},ae=async t=>{if(t.preventDefault(),!(!T.trim()||!D.trim()||k)){A(!0),ee(``);try{await R.setConfig(e,T.trim(),D.trim()),await N(),ee(r(`settings.applied`))}catch(e){ee(Md(e,r).text)}finally{A(!1)}}},oe=Ed(a?.operator_knobs??[]).reduce((e,t)=>((e[t.group]??=[]).push(t),e),{}),se=Dd(window.location.origin,e),ce=!!(a&&(a.roles.length||a.operator_knobs.length));return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`common.settings`),width:`max-w-4xl`,children:[(0,J.jsx)(lt,{title:r(`common.settings`),sub:r(`settings.subtitle`)}),(0,J.jsxs)(`div`,{className:`p-4`,children:[s&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!s&&c&&(0,J.jsx)(Rd,{message:r(`settings.loadError`),retrying:l,onRetry:()=>void u(),t:r}),!s&&!c&&!ce&&(0,J.jsx)($e,{children:r(`settings.empty`)}),!s&&!c&&ce&&a&&(0,J.jsxs)(`div`,{className:`space-y-4`,children:[!a.trial_mode&&(0,J.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`settings.quickConfig`)}),(0,J.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.backend`)}),(0,J.jsxs)(`select`,{value:h||vr(P),disabled:_,onChange:e=>g(e.target.value),"aria-label":r(`settings.backend`),className:`h-8 min-w-44 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[vr(P)?null:(0,J.jsx)(`option`,{value:``,disabled:!0,children:P?r(`settings.backendUnsupported`,{backend:P}):r(`settings.backendUnavailable`)}),gr.map(e=>(0,J.jsx)(`option`,{value:e.value,children:r(e.label)},e.value))]}),(0,J.jsx)(`button`,{type:`button`,"data-apply-backend":!0,onClick:()=>{re&&ie(re)},disabled:_||ne(re),className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:r(`settings.applyModel`)}),F&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,"data-backend-source":F,children:r(`settings.backendSource.${F}`)}),!ne(re)&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-dim`,"data-backend-change":!0,children:te?r(`settings.backendWillReplace`,{saved:yr(te,r),backend:yr(re,r)}):r(`settings.backendWillSave`,{backend:yr(re,r)})})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.model`)}),(0,J.jsxs)(`select`,{value:p||`auto`,onChange:e=>m(e.target.value===`auto`?``:e.target.value),"aria-label":r(`settings.model`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:a.model_auto_resolves_to?`auto → ${a.model_auto_resolves_to}`:r(`settings.modelPlaceholder`)}),(()=>{let e=a.model_options??[],t=new Set(e.filter(e=>e.invalid).map(e=>e.model)),n=e.map(e=>e.model),i=p.trim();return i&&i!==`auto`&&!n.includes(i)&&(n.unshift(i),t.add(i)),n.map(e=>(0,J.jsx)(`option`,{value:e,children:t.has(e)?`${e} (${r(`settings.modelUnavailable`)})`:e},e))})()]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void L(),disabled:_,className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:r(`settings.applyModel`)})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.mapModel`)}),(0,J.jsxs)(`select`,{value:a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||`auto`,disabled:_,onChange:e=>void I(e.target.value),"aria-label":r(`settings.mapModel`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[(0,J.jsx)(`option`,{value:`auto`,children:r(`settings.mapModelFollows`)}),(()=>{let e=(a.model_options??[]).map(e=>e.model),t=a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||``;return t&&t!==`auto`&&!e.includes(t)&&e.unshift(t),e.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))})()]})]}),(a.model_options??[]).some(e=>e.offline)&&(0,J.jsx)(`p`,{className:`mt-1 text-[10px] text-ink-faint`,"data-model-offline":!0,children:r(`settings.modelOfflineList`)}),a.roles.some(e=>e.model&&p.trim()&&e.model!==p.trim())&&(0,J.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-ink-faint`,"data-role-models":!0,children:[r(`settings.rolesRunning`),` `,a.roles.map(e=>`${e.role} · ${e.model||`auto`}`).join(`,`),` — `,r(`settings.applyUnifies`)]}),b&&(0,J.jsx)(`div`,{role:C?`alert`:`status`,className:`mt-1.5 text-[10px] ${C?`text-err`:`text-ink-dim`}`,children:b})]}),a.trial_mode&&(0,J.jsx)(`section`,{className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,"aria-label":r(`settings.trialAccount`),children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:r(`settings.trialAccount`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:`GPT-5.5 · high`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:r(`settings.trialKeyHint`)})]}),Ar()&&(0,J.jsx)(`button`,{type:`button`,className:`compact-control px-3 py-2`,onClick:()=>{n(),jr()},children:r(`settings.changeTrialKey`)})]})}),d&&(0,J.jsx)(_d,{sid:e,config:a,onSaved:N}),d&&(0,J.jsx)(vd,{sid:e,primaryModel:a.roles.find(e=>e.role===`engineer`)?.model}),(0,J.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface/50`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":d,"aria-controls":`config-advanced-settings`,onClick:()=>f(e=>!e),className:`flex w-full items-center justify-between gap-3 px-3 py-3 text-left hover:bg-bg/30`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block text-xs font-semibold text-ink`,children:r(`settings.advanced`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-ink-faint`,children:r(`settings.advancedHint`)})]}),(0,J.jsx)(o,{icon:S,className:`text-xs text-ink-faint transition-transform ${d?`rotate-180`:``}`})]}),d&&(0,J.jsxs)(`div`,{id:`config-advanced-settings`,className:`space-y-4 border-t border-line/70 p-3`,children:[(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`settings.connection`)}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2 text-[10px] sm:grid-cols-[100px_minmax(0,1fr)]`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.webApi`)}),(0,J.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:se.webApi}),(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.eventStream`)}),(0,J.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:se.eventStream}),(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.taskDaemon`)}),(0,J.jsx)(`span`,{className:`text-ink-dim`,children:r(`settings.taskDaemonValue`)})]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>void ae(e),className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-blue`,children:r(`settings.overrideTitle`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[10px] text-ink-faint`,children:r(`settings.overrideHint`)}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,J.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:r(`settings.namePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),placeholder:r(`settings.valuePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{disabled:k||!T.trim()||!D.trim(),title:r(`settings.applyAdvanced`),"aria-label":r(`settings.applyAdvanced`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:k?`…`:(0,J.jsx)(o,{icon:y})})]}),j?(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-dim`,children:j}):null]}),a.roles.length>0&&(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(`settings.rolesTitle`)}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:a.roles.map(e=>(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:e.role===`curator`?r(`settings.role.curator`):zn(e.role,r)}),(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.backend_label})]}),(0,J.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px] text-ink-dim`,title:e.model,children:e.model}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:Fd(e.model_source,r)}),e.reasoning_effort&&(0,J.jsx)(`span`,{className:`ml-auto shrink-0`,style:{color:Ze(e.reasoning_effort)},children:Ld(e.reasoning_effort,r)})]}),(gt(e.role)||e.role===`curator`)&&(0,J.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-ink-faint`,children:gt(e.role)?Xe(e.role,r):r(`settings.role.curatorDoc`)})]},e.role))})]}),Object.keys(oe).length>0&&(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(`settings.rawConfig`)}),Object.entries(oe).map(([e,t])=>(0,J.jsxs)(`div`,{className:`mt-3 first:mt-0`,children:[(0,J.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(Pd[e])}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-line`,children:t.map((e,t)=>{let n=Nd[e.name],i=Id(e,r);return(0,J.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] ${t?`border-t border-line/60`:``}`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-dim`,children:r(n.label)}),(0,J.jsx)(`code`,{className:`mt-0.5 block break-all text-[9px] text-ink-faint`,children:e.name}),(0,J.jsx)(`div`,{className:`mt-1 text-[10px] leading-relaxed text-ink-faint`,children:r(n.doc)})]}),(0,J.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,J.jsxs)(`div`,{className:`text-[11px] text-ink`,children:[i,i!==e.value&&(0,J.jsxs)(`code`,{className:`ml-1 text-[9px] text-ink-faint`,children:[`(`,e.value,`)`]})]}),(0,J.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Fd(e.source,r)})]})]},e.name)})})]},e))]}),(0,J.jsxs)(`p`,{className:`text-[10px] text-ink-faint`,children:[r(`settings.footer`),` `,(0,J.jsx)(`code`,{children:`argus --config-help`}),`.`]})]})]})]})]})]})}function Vd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a,refetch:s}=be(e,t),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``);(0,G.useEffect)(()=>{t&&i!=null&&l(i)},[i,t]);let h=async()=>{if(!u){d(!0),m(``);try{await R.setIdentity(e,c),await s(),m(r(`identity.saved`))}catch(e){m(Md(e,r).text)}finally{d(!1)}}};return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`identity.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`identity.title`),sub:r(`identity.subtitle`)}),(0,J.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-5`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),a?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),rows:12,className:`w-full resize-y rounded-lg border border-line bg-bg p-3 font-sans text-sm leading-relaxed text-ink outline-none focus:border-blue`,placeholder:r(`identity.placeholder`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:u||c===(i??``),title:r(`identity.save`),"aria-label":r(`identity.save`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:u?`…`:(0,J.jsx)(o,{icon:f})})]})]})]})]})}function Hd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a}=ge(e,t),o=i??[];return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`transcript.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`transcript.title`),sub:r(`transcript.subtitle`)}),(0,J.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-4`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!a&&o.length===0&&(0,J.jsx)($e,{children:r(`transcript.empty`)}),o.map((e,t)=>{let n=e.role===`operator`;return(0,J.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)] border-b border-line/50 py-2.5 last:border-b-0`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`font-mono text-[10px] font-semibold uppercase tracking-wide ${n?`text-ink-faint`:`text-blue-sky`}`,children:n?r(`transcript.operator`):`argus`}),(0,J.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Dt(e.ts)})]}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink-dim`,children:e.text})]},t)})]})]})}function Ud({card:e}){let{t,locale:n}=z(),r=typeof e.asked_at==`number`&&Number.isFinite(e.asked_at)&&e.asked_at>0?new Date(e.asked_at*1e3):null,i=e.task_status?.startsWith(`paused`);return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] text-ink-faint`,"data-decision-task":e.item_id,children:[e.task_title?(0,J.jsx)(`span`,{className:`min-w-0 basis-full break-words text-xs leading-relaxed text-ink-dim`,title:e.task_title,children:t(`decision.taskName`,{title:e.task_title})}):null,e.kind!==`domain_intake`&&e.is_current_task!=null?(0,J.jsx)(`span`,{children:t(e.is_current_task?`decision.currentTask`:`decision.otherTask`)}):null,(0,J.jsx)(at,{children:t(`decision.awaitingReply`)}),e.task_status?(0,J.jsx)(`span`,{children:i?t(`label.status.paused`):Rn(e.task_status,t)}):null,r&&!Number.isNaN(r.getTime())?(0,J.jsx)(`time`,{dateTime:r.toISOString(),title:r.toLocaleString(n),children:t(`decision.askedAt`,{time:wt(r,n)})}):null]})}function Wd({questions:e,backlog:t,currentTaskId:n,onAnswer:r,onLocate:i}){let{t:a}=z(),o=Xr(e,t,n);if(!o.length)return null;let s=o[0];return(0,J.jsxs)(`div`,{className:`mb-2 flex min-h-11 items-center gap-3 rounded-md border border-gold/40 bg-gold/5 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s.title===s.task_title?null:(0,J.jsx)(`div`,{className:`truncate text-xs font-medium text-gold`,title:s.title,children:s.title}),(0,J.jsx)(Ud,{card:s}),(0,J.jsx)(`div`,{className:`truncate text-xs text-ink-dim`,title:s.reason||s.question,children:s.reason||s.question})]}),o.length>1?(0,J.jsxs)(`span`,{className:`font-mono text-xs text-ink-faint`,children:[`+`,o.length-1]}):null,i&&s.item_id?(0,J.jsx)(`button`,{onClick:()=>i(s.item_id),className:`shrink-0 text-xs text-ink-dim hover:text-gold`,children:a(`pending.showOnMap`)}):null,(0,J.jsx)(`button`,{onClick:r,className:`shrink-0 text-xs font-medium text-gold hover:text-gold-soft`,children:a(`pending.reviewRespond`)})]})}function Gd({reply:e,open:t,busy:n,onClose:r,onSubmit:i,error:a=``}){let{t:o,locale:s}=z(),c=s===`zh-CN`,l=(0,G.useMemo)(()=>e?.options[0]?.id??`custom`,[e]),[u,d]=(0,G.useState)(l),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(``);if((0,G.useEffect)(()=>{t&&(d(l),p(``),h(``))},[l,t,e?.id]),!e)return null;let g=e.options.length===0,_=e.kind===`domain_intake`,v=e.options.find(e=>e.id===u),y=g?!!f.trim():!!(v&&(!v.requires_note||f.trim())),b=()=>{if(!n){if(!y){h(o(`decision.noteRequired`));return}h(``),i(g?`custom`:u,f.trim())}};return(0,J.jsxs)(dt,{open:t,onClose:n?()=>void 0:r,label:o(`decision.operator`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:_?e.title:o(`decision.required`),sub:!_&&e.title!==e.task_title?e.title:void 0}),(0,J.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[(0,J.jsx)(Ud,{card:e}),e.reason?(0,J.jsxs)(`section`,{className:`rounded-md border border-gold/30 bg-gold/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-gold`,children:o(`decision.whyBlocked`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.reason})]}):null,e.evidence.length?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:o(`decision.evidence`)}),(0,J.jsx)(`div`,{className:`space-y-2`,children:e.evidence.map((e,t)=>(0,J.jsxs)(`div`,{className:`rounded border border-line/70 bg-bg/40 p-2.5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.label}),e.summary?(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:e.summary}):null,e.path?(0,J.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10px] text-blue-sky`,children:e.path}):null]},`${e.path}:${t}`))})]}):null,(0,J.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.question}),e.options.length?(0,J.jsx)(`div`,{className:`space-y-2`,children:e.options.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{d(e.id),h(``)},disabled:n,"aria-pressed":u===e.id,className:`w-full rounded-md border p-3 text-left ${u===e.id?`border-blue bg-blue/5`:`border-line bg-bg/30`}`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-ink`,children:e.label}),(0,J.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-ink-dim`,children:e.description})]},e.id))}):null,_||g||v?.requires_note||f?(0,J.jsx)(`textarea`,{"data-autofocus":!0,value:f,onChange:e=>{p(e.target.value),h(``)},onKeyDown:e=>{vu(e)||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},rows:3,disabled:n,"aria-label":_?c?`你的回答或补充说明`:`Your answer or additional details`:o(`decision.notePlaceholder`),placeholder:_?v?.requires_note?c?`填写你的回答…`:`Enter your answer…`:c?`补充说明(可选)`:`Additional details (optional)`:o(`decision.notePlaceholder`),className:`w-full resize-y rounded-lg border border-line bg-bg px-3 py-2 text-sm leading-relaxed text-ink outline-none focus:border-blue disabled:opacity-60`}):null,m||a?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:m||a}):null,(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:_?c?`确认后继续这次任务。`:`Confirm to continue this request.`:o(`decision.resumeHint`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md px-3 py-2 text-xs text-ink-dim hover:bg-bg`,children:o(n?`decision.closeContinue`:`decision.later`)}),(0,J.jsx)(`button`,{type:`button`,onClick:b,disabled:n,className:`rounded-md border border-blue/35 bg-blue/8 px-3 py-2 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-50`,children:o(n?`decision.applying`:g||u===`custom`?`decision.sendAnswer`:u===`stop`?`decision.stopCampaign`:`decision.useOption`)})]})]})]})]})}function Kd({alert:e}){if(!e)return null;let t=e.tone===`block`,n=e.kind===`budget`;return(0,J.jsxs)(`div`,{className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border px-3.5 py-2 text-[13px] ${t?`border-err/50 bg-err/10 text-err`:`border-warn/50 bg-warn/10 text-warn`}`,role:t?`alert`:`status`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-bold leading-none`,children:n?`$`:t?`!`:`i`}),(0,J.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold uppercase tracking-wide`,children:n?`budget alarm`:t?`action required`:`notice`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.text,children:e.text})]})}function qd({sid:e}){let{t}=z(),n=M(),{data:r}=Me(e,!0),[i,a]=(0,G.useState)(!1);if(!e||!Ad(r?.operator_knobs))return null;let o=async()=>{a(!0);try{await R.setConfig(e,Od,`1`),await n.invalidateQueries({queryKey:[`config`,e]})}finally{a(!1)}};return(0,J.jsxs)(`div`,{"data-no-operator-banner":!0,role:`status`,className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border border-warn/50 bg-warn/10 px-3.5 py-2 text-[13px] text-warn`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:t(`noOperator.banner`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:i,className:`shrink-0 rounded border border-warn/50 px-2 py-0.5 text-xs font-medium hover:bg-warn/10 disabled:opacity-40`,children:t(`noOperator.turnOff`)})]})}function Jd(e){let t=(e.label||e.display_name||``).trim();return!!(t&&t!==e.id)}function Yd(e){return[...e].sort((e,t)=>{if(e.daemon_alive!==t.daemon_alive)return e.daemon_alive?-1:1;let n=Jd(e);return n===Jd(t)?(t.last_active||0)-(e.last_active||0):n?-1:1})}function Xd(e){return Yd(e)[0]}function Zd(e,t){let n=t?.trim()||null;return n&&e.some(e=>e.id===n)?{id:n,requested:n,recovered:!1}:{id:Xd(e)?.id??null,requested:n,recovered:!!n}}function Qd(e,t,n){if(n){let e=t?.trim()||null;return{id:e,requested:e,recovered:!1}}return Zd(e,t)}function $d(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return!0;let r=e.daemon_alive?`live running`:`stopped idle`,i=[e.id,e.label,e.display_name,e.objective,r].filter(Boolean).join(` `).toLowerCase();return n.every(e=>i.includes(e))}function ef(e,t){return e.filter(e=>$d(e,t))}function tf({sid:e,change:t,zh:n}){let[r,i]=(0,G.useState)({open:!1,loading:!1,diff:``,error:``,truncated:!1});return(0,J.jsxs)(`div`,{className:`delivery-changes`,children:[(0,J.jsx)(`button`,{type:`button`,"aria-expanded":r.open,onClick:()=>{if(r.open){i(e=>({...e,open:!1}));return}i(e=>({...e,open:!0,loading:!e.diff&&!e.error})),!(r.diff||r.error)&&R.deliveryDiff(e,t).then(e=>i(t=>({...t,loading:!1,truncated:e.truncated,diff:e.available?e.diff:``,error:e.available?e.diff?``:n?`内容没有变化`:`No content changes`:n?`上一版已不再保存,无法对比`:`The previous version is no longer kept`}))).catch(e=>i(t=>({...t,loading:!1,error:e instanceof Error?e.message:String(e)})))},children:r.open?n?`收起改动`:`Hide changes`:n?`查看与上一次交付相比的改动`:`Show changes since the previous delivery`}),r.open&&(r.loading?(0,J.jsx)(`p`,{children:n?`正在读取…`:`Loading…`}):r.error?(0,J.jsx)(`p`,{children:r.error}):(0,J.jsxs)(`pre`,{"aria-label":n?`改动`:`Changes`,children:[r.diff.split(` +`).map((e,t)=>(0,J.jsxs)(`span`,{className:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:void 0,children:[e,` +`]},t)),r.truncated?n?`…(改动过长,已截断)`:`… (truncated)`:``]}))]})}var nf=({children:e})=>(0,J.jsxs)(`span`,{children:[e,` `]}),rf=(0,G.memo)(function({children:e}){return(0,J.jsx)(F,{remarkPlugins:vt,rehypePlugins:ht,components:{p:nf,h1:nf,h2:nf,h3:nf,h4:nf,h5:nf,h6:nf,ul:nf,ol:nf,blockquote:nf,pre:nf,li:({children:e})=>(0,J.jsxs)(`span`,{className:`markdown-excerpt-item`,children:[e,` `]}),table:nf,thead:nf,tbody:nf,tr:nf,th:({children:e})=>(0,J.jsxs)(`strong`,{children:[e,` · `]}),td:nf,a:({children:e})=>(0,J.jsx)(`span`,{className:`markdown-excerpt-link`,children:e}),img:({alt:e})=>(0,J.jsx)(`span`,{children:e}),input:({checked:e})=>(0,J.jsx)(`span`,{children:e?`✓ `:`○ `}),hr:()=>(0,J.jsx)(`span`,{children:` · `}),code:({children:e})=>(0,J.jsx)(`code`,{children:e})},children:Jo(e)})});function af({html:e,title:t,className:n=``,sid:r,path:i}){return r&&i?(0,J.jsx)(of,{sid:r,path:i,html:e,title:t,className:n}):(0,J.jsx)(`iframe`,{title:t,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white ${n}`})}function of({html:e,title:t,className:n,sid:r,path:i}){let{locale:a}=z(),o=a===`zh-CN`,s=A({queryKey:[`artifact-html`,r,i,e],queryFn:({signal:e})=>R.artifactPreview(r,i,e),enabled:!!(r&&i),staleTime:3e4,retry:1});if(r&&i&&s.isPending)return(0,J.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,role:`status`,children:o?`正在加载网页和配套资源…`:`Loading the website and its assets…`});if(r&&i&&s.isError)return(0,J.jsxs)(`div`,{className:`m-auto p-6 text-sm text-err`,role:`alert`,children:[o?`网页预览加载失败,请重试或下载文件。`:`Preview could not load. Retry or download the file.`,(0,J.jsx)(`button`,{type:`button`,className:`ml-3 underline`,onClick:()=>void s.refetch(),children:o?`重试`:`Retry`})]});let c=s.data?.served_page===!0;return(0,J.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col ${n}`,children:[!!s.data?.warnings.length&&(0,J.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`部分配套资源无法加载,页面可能不完整。`:`Some linked assets are unavailable; the preview may be incomplete.`}),!c&&(0,J.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`此后端尚未支持独立网页预览;当前为内嵌预览,交互脚本可能不可用。`:`This backend does not yet support standalone preview; embedded preview may not run interactive scripts.`}),(0,J.jsx)(`iframe`,{title:t,src:c?me(r,i):void 0,srcDoc:c?void 0:s.data?.html??e,sandbox:`allow-scripts allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]})}function sf(e){let t=e.trim();if(!t)return``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{try{return t.split(/\r?\n/).filter(Boolean).map(e=>JSON.parse(e)).map(e=>JSON.stringify(e,null,2)).join(` +`)}catch{return e}}}function cf(e,t){let n=[],r=[],i=``,a=!1;for(let o=0;oe.some(e=>e.length>0))}function lf({value:e}){return(0,J.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:sf(e)||`(empty data)`})}function uf({value:e,delimiter:t}){let n=cf(e,t).slice(0,200),r=n[0]??[];return(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4 scroll-thin`,children:n.length?(0,J.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:r.slice(0,40).map((e,t)=>(0,J.jsx)(`th`,{className:`border border-line/60 bg-surface px-2 py-1.5 font-semibold text-ink`,children:e},t))})}),(0,J.jsx)(`tbody`,{children:n.slice(1).map((e,t)=>(0,J.jsx)(`tr`,{children:r.slice(0,40).map((t,n)=>(0,J.jsx)(`td`,{className:`border border-line/50 px-2 py-1.5 align-top text-ink-dim`,children:e[n]??``},n))},t))})]}):(0,J.jsx)(`div`,{className:`text-sm text-ink-faint`,children:`(empty table)`})})}var df=``+new URL(`pdf.min-Bbvtrhlt.mjs`,import.meta.url).href,ff=``+new URL(`pdf.worker.min-CLrFZWeq.mjs`,import.meta.url).href,pf=null,mf=0;function hf(){pf=null,mf+=1}function gf(){if(pf)return pf;let e=new URL(df,import.meta.url),t=new URL(ff,import.meta.url);mf&&(e.searchParams.set(`retry`,String(mf)),t.searchParams.set(`retry`,String(mf)));let n=Ne(()=>import(e.href).then(e=>(e.GlobalWorkerOptions.workerSrc=t.href,e)),[],import.meta.url).catch(e=>{throw pf===n&&hf(),e});return pf=n,n}function _f(e,t,n,r){let i=Math.max(1,n-32)/Math.max(1,e),a=Math.max(1,r-32)/Math.max(1,t);return Math.min(2.5,i,a)}function vf({src:e,name:t,className:n=``,onPageOrientation:r,onRetry:i}){let{locale:a}=z(),o=a===`zh-CN`,s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(1),[m,h]=(0,G.useState)(1),[g,_]=(0,G.useState)({width:0,height:0}),[v,y]=(0,G.useState)(!0),[b,x]=(0,G.useState)(!1),[S,C]=(0,G.useState)(``),[w,T]=(0,G.useState)(0);(0,G.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>_({width:e.clientWidth,height:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,G.useEffect)(()=>{let t=!0,n=new AbortController,r=null;return d(null),p(1),h(1),l.current=null,c.current?.scrollTo(0,0),C(``),y(!0),Promise.all([fetch(e,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`PDF request failed (${e.status})`);return e.arrayBuffer()}),gf()]).then(async([e,n])=>{if(!t)return;r=n.getDocument({data:new Uint8Array(e)});let i=await r.promise;t&&(d(i),y(!1))}).catch(e=>{t&&(y(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!1,n.abort(),r?.destroy().catch(()=>{})}},[e,w]),(0,G.useEffect)(()=>{let e=s.current;if(!u||!e||g.width<=0||g.height<=0)return;let t=!1,n=null;return x(!0),C(``),u.getPage(f).then(e=>{if(t||!s.current)return;let i=e.getViewport({scale:1});r?.(i.width>i.height?`landscape`:`portrait`);let a=_f(i.width,i.height,g.width,g.height),o=e.getViewport({scale:a*m}),u=document.createElement(`canvas`),d=u.getContext(`2d`,{alpha:!1});if(!d)throw Error(`Canvas rendering is unavailable`);let f=Math.min(window.devicePixelRatio||1,2);return u.width=Math.max(1,Math.floor(o.width*f)),u.height=Math.max(1,Math.floor(o.height*f)),n=e.render({canvas:u,canvasContext:d,viewport:o,transform:f===1?void 0:[f,0,0,f,0,0]}),n.promise.then(()=>{if(t||!s.current)return;let e=s.current,n=e.getContext(`2d`,{alpha:!1});if(!n)throw Error(`Canvas rendering is unavailable`);e.width=u.width,e.height=u.height,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`,n.drawImage(u,0,0);let r=c.current,i=l.current;if(r&&i){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect();r.scrollLeft+=n.left+i.x*n.width-t.left-r.clientWidth/2,r.scrollTop+=n.top+i.y*n.height-t.top-r.clientHeight/2,l.current=null}})}).then(()=>{t||x(!1)}).catch(e=>{t||e instanceof Error&&e.name===`RenderingCancelledException`||(x(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!0,n?.cancel()}},[r,f,u,g.height,g.width,m]);let E=e=>{let t=c.current,n=s.current;if(t&&n&&n.clientWidth&&n.clientHeight){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();l.current={x:Math.max(0,Math.min(1,(e.left+t.clientWidth/2-r.left)/r.width)),y:Math.max(0,Math.min(1,(e.top+t.clientHeight/2-r.top)/r.height))}}h(t=>Math.max(.6,Math.min(2.2,Math.round((t+e)*100)/100)))},D=()=>{l.current=null,c.current?.scrollTo(0,0),h(1)},O=u?.numPages??0;return(0,J.jsxs)(`div`,{className:`pdf-viewer flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-bg ${n}`,"aria-busy":v||b,children:[(0,J.jsxs)(`div`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-2 border-b border-line/70 bg-panel px-3 py-1.5 text-[11px] text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink`,title:t,children:t}),(0,J.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[o?`第`:`Page`,` `,f,` / `,O||`…`]}),(0,J.jsx)(`button`,{type:`button`,disabled:!u||f<=1,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.max(1,e-1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`上一页`:`Previous`}),(0,J.jsx)(`button`,{type:`button`,disabled:!u||f>=O,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.min(O,e+1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`下一页`:`Next`}),(0,J.jsx)(`button`,{type:`button`,"aria-label":o?`缩小`:`Zoom out`,disabled:!u||m<=.6,onClick:()=>E(-.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`−`}),(0,J.jsxs)(`span`,{className:`w-10 text-center font-mono tabular-nums`,children:[Math.round(m*100),`%`]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":o?`放大`:`Zoom in`,disabled:!u||m>=2.2,onClick:()=>E(.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`+`}),(0,J.jsx)(`button`,{type:`button`,disabled:!u,onClick:D,className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`适合页面`:`Fit page`})]}),(0,J.jsxs)(`div`,{ref:c,className:`pdf-scroll-viewport relative min-h-0 min-w-0 flex-1 overflow-auto bg-surface/60 p-4 scroll-thin`,tabIndex:0,"aria-label":o?`PDF 页面滚动区域`:`PDF page scroll area`,children:[v?(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,J.jsx)(tt,{})}):null,S?(0,J.jsxs)(`div`,{role:`alert`,className:`m-auto max-w-sm rounded border border-err/35 bg-err/5 p-4 text-center text-sm text-err`,children:[(0,J.jsx)(`p`,{children:o?`PDF 暂时无法预览`:`PDF preview is temporarily unavailable`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>{hf(),i?i():T(e=>e+1)},className:`mt-3 rounded border border-line bg-panel px-3 py-1.5 text-ink hover:border-blue/50`,children:o?`重试预览`:`Retry preview`}),(0,J.jsxs)(`details`,{className:`mt-3 break-words text-xs text-ink-dim`,children:[(0,J.jsx)(`summary`,{children:o?`错误详情`:`Error details`}),S]})]}):null,S?null:(0,J.jsx)(`div`,{className:`pdf-page-stage flex min-h-full min-w-full w-max items-center justify-center`,children:(0,J.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`${t} · ${o?`第`:`page`} ${f}`,className:`block max-w-none shrink-0 bg-white shadow-xl`})})]})]})}function yf({sid:e,path:t,onClose:n,delivery:r,deliveries:i=[],onSelectDelivery:a,onSelectPath:o,reviewActivity:s,artifacts:c=[]}){let{t:l,locale:u}=z(),d=u===`zh-CN`,f=r?Ko(r):[],p=we(e,t),m=p.data,h=m?.source===`reader_foundation`?m.reader_foundation:void 0,g=m?.source===`progress_snapshot`,_=m?us(m):!1,[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(``),[S,C]=(0,G.useState)(0),[w,T]=(0,G.useState)(!1),[E,D]=(0,G.useState)(!1),[O,k]=(0,G.useState)(`portrait`),A=m?.kind===`pdf`||t?.toLowerCase().endsWith(`.pdf`)===!0,j=!!(t&&/(?:^|[\\/])REVIEW\.md$/i.test(t));(0,G.useEffect)(()=>{if(!(!t||!A))return Pr(!0),()=>Pr(!1)},[t,A]),(0,G.useEffect)(()=>{if(k(`portrait`),y(null),x(``),!e||!t||!m||![`image`,`pdf`,`audio`,`video`].includes(m.kind))return;let n=!0,r=``,i=new AbortController;return R.artifactBlob(e,t,!1,i.signal).then(e=>{n&&(r=URL.createObjectURL(e),y(r))},e=>n&&x(e.message)),()=>{n=!1,i.abort(),r&&URL.revokeObjectURL(r)}},[e,t,m?.kind,S]);let M=async(n=!1)=>{if(!(!e||!t||!m)){T(!0),x(``);try{let r=n?await R.artifactBundle(e,t):await R.artifactBlob(e,t,!0);ut(r,n?`${m.name.replace(/\.html?$/i,``)}-website.zip`:m.name)}catch(e){x(e.message)}finally{T(!1)}}};return(0,J.jsxs)(dt,{open:!!(t||r),onClose:n,label:r?d?`交付成果`:`Delivery`:l(`artifact.preview`),width:r?E?`max-w-none`:`max-w-6xl`:A?`max-w-none`:`max-w-5xl`,viewport:r?E:A,showClose:!1,style:r?{height:E?`100dvh`:`min(92dvh, 960px)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:A?{maxWidth:O===`portrait`?`min(96vw, 76dvh)`:`min(96vw, 145dvh)`}:void 0,children:[r&&!E&&(0,J.jsxs)(`header`,{className:`delivery-header`,children:[(0,J.jsxs)(`div`,{className:`delivery-heading`,children:[(0,J.jsx)(`span`,{className:`delivery-mark`,children:(0,J.jsx)(ln,{size:22})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`p`,{children:[`DELIVERY · `,d?`交付成果`:`Your results`]}),(0,J.jsx)(`h2`,{children:d?`成果文件`:`Result files`})]}),(0,J.jsxs)(`button`,{type:`button`,onClick:n,className:`delivery-return`,"aria-label":d?`关闭交付弹窗`:`Close delivery`,children:[d?`返回地图`:`Back to map`,` ×`]})]}),i.length>1?(0,J.jsx)(`select`,{"aria-label":d?`选择交付任务`:`Choose delivery`,className:`delivery-task-select`,value:r.delivery_id,onChange:e=>{let t=i.find(t=>t.delivery_id===e.target.value);t&&a?.(t)},children:i.map(e=>(0,J.jsx)(`option`,{value:e.delivery_id,children:e.title},e.delivery_id))}):(0,J.jsx)(`p`,{className:`delivery-task-title`,title:r.title,children:r.title}),(0,J.jsxs)(`div`,{className:`delivery-facts`,children:[(()=>{let e=Qo(r,d);return(0,J.jsxs)(`span`,{className:e.independent?`delivery-review-independent`:`delivery-review-self`,title:e.title,children:[e.independent?(0,J.jsx)(Kt,{size:13}):null,e.text]})})(),(0,J.jsxs)(`span`,{children:[f.length,` `,d?`个文件`:`files`]})]}),r.summary&&(0,J.jsxs)(`details`,{className:`delivery-summary`,children:[(0,J.jsx)(`summary`,{children:d?`查看成果说明`:`Result summary`}),(0,J.jsx)(`p`,{children:(0,J.jsx)(rf,{children:r.summary})})]})]}),!E&&!!f.length&&(0,J.jsx)(`nav`,{className:`delivery-files`,"aria-label":d?`交付文件`:`Delivery files`,children:f.map(e=>(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":t===e.path,onClick:()=>o?.(e.path),title:e.path,children:[(0,J.jsx)(`span`,{children:e.path.split(`/`).at(-1)}),r?.primary_target?.path===e.path&&(0,J.jsx)(`small`,{children:d?`主要成果`:`Main result`})]},e.path))}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-line px-4 py-3 sm:px-5 ${t?``:`hidden`}`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink ${h||g?``:`font-mono`}`,title:h?.question??m?.progress_source?.title??m?.storage_path??m?.path??t??``,children:h?ds(h):g?m?.progress_source?.title||l(`artifact.title`):m?.name??t??l(`artifact.title`)}),(0,J.jsx)(`p`,{className:`mt-0.5 truncate text-[11px] text-ink-faint`,children:h?h.kind===`clarification`||h.kind===`progress_answer`?d?`阅读问答`:`Reading question and answer`:d?`背景说明 · 不计作研究进展`:`Background explanation · separate from research progress`:g?d?`保存的进展说明 · 提问来源`:`Saved progress explanation · question source`:m?`${m.kind} · ${yt(m.size)} · ${m.mime}`:d?`正在读取文件`:`Loading file`})]}),r&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>D(e=>!e),"aria-label":E?d?`收起预览`:`Exit full screen`:d?`全屏预览`:`Full screen preview`,title:d?`切换全屏预览`:`Toggle full screen preview`,className:`shrink-0 rounded-md border border-line p-2 text-ink-dim`,children:E?(0,J.jsx)(cn,{size:16}):(0,J.jsx)(on,{size:16})}),m?.kind===`html`&&(0,J.jsx)(`button`,{type:`button`,disabled:w,onClick:()=>void M(!0),className:`shrink-0 rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-2 text-xs text-blue-sky disabled:opacity-50`,children:d?`下载完整网页`:`Download website`}),(0,J.jsx)(`button`,{type:`button`,disabled:!m||w,onClick:()=>void M(),className:`rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-1.5 text-xs text-blue-sky transition-colors hover:bg-blue-deep/20 disabled:cursor-wait disabled:opacity-50`,children:l(w?`artifact.downloading`:`artifact.download`)}),(!r||E)&&(0,J.jsx)(`button`,{type:`button`,"aria-label":l(`artifact.close`),onClick:n,className:`rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink`,children:`×`})]}),(0,J.jsxs)(`div`,{className:r?`flex min-h-0 flex-1 flex-col overflow-auto bg-bg/40 p-2 sm:p-3`:A?`flex min-h-0 flex-1 flex-col overflow-hidden bg-bg/40`:`flex min-h-64 max-h-[72vh] flex-col overflow-x-hidden overflow-y-auto bg-bg/40 p-3 scroll-thin sm:p-4`,children:[!t&&r&&(0,J.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,children:(0,J.jsx)(rf,{children:r.summary})}),r&&e&&(()=>{let n=$o(r,i,t);return n?(0,J.jsx)(tf,{sid:e,change:n,zh:d},`${n.before}:${n.after}`):null})(),p.isLoading?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,p.isError?(0,J.jsxs)(`div`,{className:`m-auto text-sm text-err`,children:[l(`artifact.unavailable`),` · `,p.error.message]}):null,m?.why&&!h&&!g&&!A&&!r?(0,J.jsxs)(`div`,{className:`mb-3 rounded-md border border-line bg-surface px-3 py-2 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`mr-1 text-ink-faint`,children:`Reviewer:`}),m.why]}):null,m?.kind===`text`&&!_?(0,J.jsxs)(`pre`,{className:`min-h-52 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-bg p-4 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:[m.preview||l(`artifact.empty`),m.truncated?`\n\n… ${l(`artifact.truncated`)}`:``]}):null,m&&_?(0,J.jsxs)(`div`,{className:`min-h-52 overflow-auto rounded-lg border border-line bg-bg p-4 text-sm text-ink-dim scroll-thin`,children:[j&&(0,J.jsxs)(`div`,{className:`mb-4 border-b border-line pb-3 text-xs leading-5 text-ink-faint`,role:`status`,children:[s===`revising`?d?`正在根据这份意见修改论文,修改后的版本尚待复审。`:`The paper is being revised against this opinion; the revised version awaits review.`:s===`reviewing`?d?`Reviewer 正在更新本轮审稿意见,内容会自动刷新。`:`The Reviewer is updating this round’s opinion. This file refreshes automatically.`:d?`这是最近保存的审稿意见,文件更新后会自动刷新。`:`This is the latest saved review. Changes to this file appear automatically.`,m.mtime!=null&&(0,J.jsxs)(`div`,{children:[d?`最近更新:`:`Last updated: `,new Date(m.mtime*1e3).toLocaleString(u)]})]}),(0,J.jsx)(H,{sid:e,basePath:t||``,artifacts:[...c,...f.map(e=>({path:e.path})),...h?.sources??[],...h?.progress_source?[{path:h.progress_source.path}]:[]],onOpenArtifact:o,children:m.preview||l(`artifact.empty`)}),m.truncated?(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 border-t border-line pt-2 text-xs text-ink-faint`,children:[l(`artifact.truncated`),` · `,l(`artifact.downloadHint`)]}):null]}):null,m?.kind===`json`?(0,J.jsx)(lf,{value:m.preview||``}):null,m?.kind===`table`?(0,J.jsx)(uf,{value:m.preview||``,delimiter:m.name.endsWith(`.tsv`)?` `:`,`}):null,m?.kind===`html`?(0,J.jsx)(`div`,{className:`flex flex-1 overflow-hidden rounded-lg border border-line ${r?`min-h-0`:`min-h-[60vh]`}`,children:(0,J.jsx)(af,{sid:e,path:t,html:m.preview||``,title:`HTML preview: ${m.name}`})}):null,m?.kind===`image`&&v?(0,J.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-bg/50`,children:(0,J.jsx)(`img`,{src:v,alt:m.why||m.name,className:`max-h-[62vh] max-w-full object-contain`})}):null,m?.kind===`pdf`&&v?(0,J.jsx)(vf,{src:v,name:m.name,className:`min-h-0 overflow-hidden`,onPageOrientation:k,onRetry:()=>C(e=>e+1)}):null,m?.kind===`audio`&&v?(0,J.jsx)(`div`,{className:`m-auto w-full max-w-xl`,children:(0,J.jsx)(`audio`,{controls:!0,preload:`metadata`,src:v,className:`w-full`})}):null,m?.kind===`video`&&v?(0,J.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-black`,children:(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:v,className:`max-h-[62vh] max-w-full`})}):null,m&&[`image`,`pdf`,`audio`,`video`].includes(m.kind)&&!v&&!b?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,m?.kind===`binary`?(0,J.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-ink-dim`,children:l(`artifact.noPreview`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:l(`artifact.downloadHint`)})]}):null,b?(0,J.jsx)(`div`,{className:`mt-3 text-center text-xs text-err`,children:b}):null]})]})}function bf({sid:e,objective:t,taskId:n,taskTitle:r,readOnly:i,onOpenArtifact:a}){let{locale:o}=z(),s=o===`zh-CN`,c=s?`zh-CN`:`en-US`,l=(e,t)=>s?e:t,u=gs(e,c),{client:d,list:f,generation:p,progress:m,creationBlocked:h}=u,g=Uo(e,c),[_,v]=(0,G.useState)(null);(0,G.useEffect)(()=>v(null),[e,c]);let y=u.pendingRequest?.draft.progressSource?null:u.pendingRequest,b=u.notes.filter(e=>!e.reader_foundation?.progress_source&&e.reader_foundation?.kind!==`progress_answer`),x=b.filter(hs),S=x.find(e=>e.reader_foundation?.id===g.id),C=S?b.filter(e=>e.reader_foundation?.kind===`clarification`&&e.reader_foundation.root_id===S.reader_foundation?.id).reverse():[],w=S?.exists&&S.reader_foundation?.state===`complete`,T=b.some(e=>e.reader_foundation?.state===`generating`),E=b.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),D=b.filter(e=>e.reader_foundation?.state===`failed`),O=b.filter(e=>e.exists&&e.reader_foundation?.state===`complete`),k=!u.pendingRequest?.draft.progressSource&&u.creating,A=!u.requested?.reader_foundation?.progress_source&&u.confirmedFailure,j=!!y&&u.requestRejected,M=!!y&&u.unknownResult,ee=()=>{!_?.question.trim()||i||h||_.parentId&&!O.some(e=>e.reader_foundation?.id===_.parentId)||u.submit(_)&&v(null)},N=e=>{i||h||!e.exists||e.reader_foundation?.state!==`complete`||v({question:``,parentId:e.reader_foundation.id,parentTitle:ds(e.reader_foundation)})};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`mx-4 mt-3 rounded-lg border border-line/70 bg-panel px-3 py-2`,"aria-label":l(`问题基础`,`Question foundations`),"data-testid":`question-foundation`,"data-project-id":e,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(K,{size:15,className:`text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:l(`问题基础`,`Question foundations`)}),(0,J.jsx)(`span`,{className:`hidden text-xs text-ink-faint sm:inline`,children:l(`一份说明,陪你读后续进展`,`A saved explanation to help you follow later progress`)}),i?null:(0,J.jsxs)(W,{className:`ml-auto inline-flex items-center gap-1 text-xs`,disabled:h,onClick:()=>v({question:t??``,sourceTaskId:n,sourceTitle:r}),children:[(0,J.jsx)(fn,{size:12}),l(`从基础理解`,`Understand the foundations`)]})]}),x.length?(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`select`,{className:`min-w-0 flex-1 rounded border border-line bg-bg px-2 py-1.5 text-xs text-ink`,"aria-label":l(`选择基础说明`,`Choose a foundation explanation`),value:g.id??``,onChange:t=>Vo(d,e,c,t.target.value||null),children:[(0,J.jsx)(`option`,{value:``,children:l(`选择你正在理解的问题`,`Choose the question you are studying`)}),x.map(e=>(0,J.jsxs)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,disabled:!e.exists||e.reader_foundation.state!==`complete`,children:[ds(e.reader_foundation),e.reader_foundation.state===`generating`?l(` · 正在整理`,` · preparing`):e.exists?``:l(` · 尚未完成`,` · not completed`)]},e.path))]}),(0,J.jsx)(W,{className:`text-xs`,disabled:!w,onClick:()=>S&&a(S.path),children:l(`阅读基础说明`,`Read foundations`)}),!i&&S?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:!w||h,onClick:()=>N(S),children:[(0,J.jsx)(sn,{size:12}),l(`问这份说明`,`Ask about these foundations`)]}):null]}):!f.isPending&&!k?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:l(`先选一个想理解的问题;保存后,后续进度会引用同一份说明。`,`Start with a question you want to understand. Later progress can refer to the same saved explanation.`)}):null,C.length?(0,J.jsxs)(`div`,{className:`mt-3 border-t border-line/60 pt-2`,"data-testid":`foundation-questions`,"data-foundation-id":S?.reader_foundation?.id,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:l(`围绕这份说明的问答`,`Questions about these foundations`)}),(0,J.jsx)(`ul`,{className:`mt-1 max-h-48 space-y-2 overflow-y-auto scroll-thin`,children:C.map(e=>(0,J.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,"data-reading-question-id":e.reader_foundation.id,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-ink-dim`,children:e.reader_foundation.question}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:e.reader_foundation.state===`generating`?l(`正在回答`,`Preparing an answer`):e.reader_foundation.state===`failed`||!e.exists?l(`这次回答未完成`,`This answer did not finish`):l(`回答已保存`,`Answer saved`)})]}),e.exists&&e.reader_foundation.state===`complete`?(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,children:[(0,J.jsx)(W,{className:`text-xs`,onClick:()=>a(e.path),children:l(`阅读回答`,`Read answer`)}),i?null:(0,J.jsx)(W,{className:`text-xs`,disabled:h,onClick:()=>N(e),children:l(`继续问`,`Ask a follow-up`)})]}):null]},e.path))})]}):null,f.isError?(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-ink-faint`,role:`status`,children:[(0,J.jsx)(`span`,{children:l(`已保存的基础说明暂时读取失败。`,`Saved explanations could not be loaded.`)}),(0,J.jsx)(W,{className:`text-xs`,disabled:f.isFetching,onClick:()=>void f.refetch(),children:l(`重新读取`,`Reload records`)})]}):null,k?(0,J.jsx)(`div`,{className:`mt-2`,children:m.active?(0,J.jsx)(ss,{generating:!0,phase:m.phase}):(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:l(`正在核对保存结果`,`Checking the saved result`)})}):T?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:E?l(`等待时间已较长,仍未收到完整说明;生成尚未确认结束。`,`The wait is taking longer. A complete explanation has not arrived, and generation has not been confirmed to have stopped.`):l(`基础说明仍在整理,保存后会出现在这里。`,`An explanation is still being prepared. It will appear here when saved.`)}):null,A?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`这次说明未完成,失败记录已保留。可以重新明确生成一份。`,`This explanation did not finish. The failed request is retained; you can explicitly generate a new one.`)}):M?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`这次请求的结果尚未确认;刷新不会重新生成。`,`The result of this request is unconfirmed. Refreshing does not generate it again.`)}):null,j?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`引用的说明目前不可用,这次追问未发起。问题已保留,可以重新选择来源。`,`The reading source is unavailable, so this question was not started. Your question is saved; you can choose another source.`)}):null,!i&&y&&!k&&!T?j?(0,J.jsx)(W,{className:`mt-2 text-xs`,onClick:()=>{v(y.draft),p.reset()},children:l(`编辑问题与来源`,`Edit question and source`)}):(0,J.jsx)(W,{className:`mt-2 text-xs`,onClick:()=>u.retrySavedRequest(y),children:l(`重试同一请求`,`Retry this same request`)}):null,!i&&D.length?(0,J.jsx)(ft,{label:l(`未完成的说明(${D.length})`,`Unfinished explanations (${D.length})`),children:(0,J.jsx)(`div`,{className:`max-h-[24vh] overflow-y-auto`,children:D.map(e=>(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-ink-faint`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.reader_foundation.question,children:[l(`未完成:`,`Not completed: `),e.reader_foundation.question]}),(0,J.jsx)(W,{className:`shrink-0 text-xs`,disabled:h,onClick:()=>v({question:e.reader_foundation.question,sourceTaskId:e.reader_foundation.source_task_id??void 0,parentId:e.reader_foundation.parent_id??void 0,parentTitle:e.reader_foundation.parent_id?ds(b.find(t=>t.reader_foundation?.id===e.reader_foundation.parent_id)?.reader_foundation??{question:l(`先前选择的说明`,`Previously selected reading`)}):void 0}),children:l(`重新编辑问题`,`Edit this question`)})]},e.path))})}):null,(0,J.jsx)(`p`,{className:`mt-1.5 text-[11px] text-ink-faint`,children:l(`说明和问答会保存下来,供你随时回看。`,`Explanations and questions are saved for later reading.`)})]}),(0,J.jsxs)(dt,{open:!!_,onClose:()=>v(null),label:_?.parentId?l(`继续理解`,`Ask about your reading`):l(`从基础理解`,`Understand the foundations`),children:[(0,J.jsx)(lt,{title:_?.parentId?l(`哪里还不明白`,`What is still unclear`):l(`你想理解什么`,`What would you like to understand`),sub:_?.parentId?l(`可以引用一句话,或者写下算不明白的那一步。`,`Quote a sentence or describe the step you could not work through.`):l(`用自己的话选定一个问题,说明会保存下来供以后阅读。`,`Choose a question in your own words. Its explanation will be saved for later reading.`)}),(0,J.jsxs)(`div`,{className:`px-6 pb-6`,children:[_?.parentId?(0,J.jsxs)(`label`,{className:`mb-3 block text-xs text-ink-dim`,children:[l(`引用的说明或回答`,`Reading source`),(0,J.jsxs)(`select`,{"aria-label":l(`引用的说明或回答`,`Reading source`),className:`mt-1 block w-full min-w-0 rounded border border-line bg-bg px-2 py-2 text-xs text-ink`,value:_.parentId,onChange:t=>{let n=O.find(e=>e.reader_foundation?.id===t.target.value);n&&(v(e=>e&&{...e,parentId:n.reader_foundation.id,parentTitle:ds(n.reader_foundation)}),Vo(d,e,c,n.reader_foundation.root_id??n.reader_foundation.id))},children:[O.some(e=>e.reader_foundation?.id===_.parentId)?null:(0,J.jsxs)(`option`,{value:_.parentId,disabled:!0,children:[_.parentTitle||l(`原来源`,`Original source`),l(` · 当前不可用`,` · unavailable`)]}),O.map(e=>(0,J.jsx)(`option`,{value:e.reader_foundation.id,children:ds(e.reader_foundation)},e.path))]})]}):null,_?(0,J.jsx)(ps,{draft:_,onChange:v,onSubmit:ee,disabled:h||i||!!_.parentId&&!O.some(e=>e.reader_foundation?.id===_.parentId)}):null]})]})]})}var xf=[`manager`,`planner`,`engineer`,`reviewer`],Sf=new Set([`planner`,`engineer`,`reviewer`]),Cf=new Set([`running`,`in_progress`,`claimed`]),$=(e,t)=>String(e[t]??``).trim(),wf=(e,t)=>{let n=Number(e[t]);return Number.isFinite(n)?n:null};function Tf(e){return JSON.parse(JSON.stringify(e))}function Ef(){return{schema_version:7,bootstrapped:!1,language:``,mission:{id:``,title:``,objective:``,summary:``,final_output:``,status:`idle`,started_at:null,completed_at:null,elapsed_seconds:0,campaign_started_at:null,campaign_elapsed_seconds:0},stage:{id:``,label:``},routing:{route:``,vertical:``,workflow_mode:``,lifetime:``,continuous:!1,open_ended:!1},round:{current:0,max:0},active_role:``,roles:xf.map(e=>({role:e,status:`waiting`,label:`Waiting`,updated_at:0})),role_work:[],dag:[],timeline:[],artifacts:[],learned_skills:[],learned_wiki_pages:[],storage:{project_skill_dir:``,global_skill_dir:``,project_skill_count:0,global_skill_count:0,skill_history_compressed:0,wiki_retired_compressed:0,skill_history_bytes_saved:0,wiki_retired_bytes_saved:0,wiki_paths:[]},achievement:null,review:{status:``,reason:``,rejected_attempts:0},frontier:{change:``,summary:``,updated_at:0},delivery:null,outcome:{},last_event_ts:0,updated_at:0}}function Df(e,t,n,r){if(n==null||n===``)return;let i=e.findIndex(e=>e[t]===n);i>=0?e[i]={...e[i],...r}:e.push(r)}function Of(e,t,n,r,i){if(!xf.includes(t))return;n===`active`&&Sf.has(t)&&e.roles.forEach(e=>{Sf.has(e.role)&&e.role!==t&&e.status===`active`&&Object.assign(e,{status:`done`,label:`Handed off`,updated_at:i})});let a={role:t,status:n,label:r,updated_at:i};Df(e.roles,`role`,t,a),n===`active`?e.active_role=t:e.active_role===t&&(e.active_role=``)}function kf(e,t,n,r,i=``,a=`neutral`){let o=Re(t);if(e.timeline.some(e=>e.id===o))return;let s={id:o,ts:Number(t.ts??Date.now()/1e3),type:ie(t.type),role:n,title:r.slice(0,180),detail:i.slice(0,500),tone:a};[`item_id`,`branch_id`].forEach(e=>{let n=$(t,e);n&&(s[e]=n)}),e.timeline=[...e.timeline,s].slice(-120)}function Af(e,t,n,r,i,a=``,o=``){if(!xf.includes(n))return;let s=$(t,`message_id`),c=s?`${n}:${s}`:Re(t),l=e.role_work.find(e=>e.id===c),u=l&&l.detail.length>a.length?l.detail:a,d={id:c,ts:Number(t.ts??Date.now()/1e3),role:n,kind:r,title:i.slice(0,240),detail:u.slice(0,4e3),status:o,item_id:$(t,`item_id`),mission_id:e.mission.id,mission_title:e.mission.title.slice(0,240),round_index:wf(t,`round_index`)},f=e.role_work.findIndex(e=>e.id===c);f>=0?e.role_work[f]=d:e.role_work.push(d);let p=new Set;xf.forEach(t=>{e.role_work.filter(e=>e.role===t).slice(-40).forEach(e=>p.add(e.id))}),e.role_work=e.role_work.filter(e=>p.has(e.id))}function jf(e){return e===`ok`?`success`:e===`err`?`error`:`info`}var Mf={agent_message:`Reporting progress`,assistant_message:`Reporting progress`,command_execution:`Running a command`,reasoning:`Reasoning`,tool_use:`Using a tool`,tool_result:`Inspecting tool output`,codex_idle:`Waiting for model output`};function Nf(e,t){let n=ie(t.type),r=Number(t.ts??Date.now()/1e3);if(e.last_event_ts=Math.max(e.last_event_ts,r),n===I.LIFE_MANAGER_INTENT_STARTED)e.mission.id=$(t,`item_id`)||$(t,`intent_id`),e.mission.title=$(t,`objective`).slice(0,240),e.mission.objective=$(t,`objective`),e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`grounding`,Of(e,`manager`,`active`,`Grounding project`,r),kf(e,t,`manager`,`Project grounding started`,$(t,`objective`)),Af(e,t,`manager`,`grounding`,`Grounding project`,$(t,`objective`),`active`);else if(n===I.LIFE_MANAGER_INTENT_COMPLETED){let n=$(t,`execution_task`)||$(t,`objective`);e.mission.id=$(t,`item_id`),e.mission.title=n.slice(0,240),e.mission.objective=n,e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`framed`,e.routing.route=$(t,`route`)||e.routing.route||`team`,e.routing.vertical=$(t,`vertical`)||e.routing.vertical,e.routing.workflow_mode=$(t,`workflow_mode`)||e.routing.workflow_mode,e.routing.lifetime=$(t,`lifetime`)||e.routing.lifetime,`continuous`in t&&(e.routing.continuous=t.continuous===!0),`open_ended`in t&&(e.routing.open_ended=t.open_ended===!0);let i=$(t,`current_stage`),a=Array.isArray(t.stages)?t.stages:[];if(i)e.stage={id:i,label:i.replaceAll(`_`,` `)};else if(!e.stage.id&&a[0]){let t=String(a[0]);e.stage={id:t,label:t.replaceAll(`_`,` `)}}Of(e,`manager`,`done`,`Goal framed`,r),kf(e,t,`manager`,`Goal framed`,$(t,`reason`),`success`),Af(e,t,`manager`,`decision`,`Goal framed`,$(t,`reason`)||$(t,`execution_task`),`done`)}else if(n===I.LIFE_MANAGER_INTENT_FAILED)e.mission.status=`failed`,Of(e,`manager`,`error`,`Manager routing failed`,r),kf(e,t,`manager`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`),Af(e,t,`manager`,`grounding`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`);else if(n===I.LIFE_MANAGER_STAGE_DECISION){let n=$(t,`target_stage`)||$(t,`stage`)||$(t,`current_stage`);n&&(e.stage={id:n,label:n.replaceAll(`_`,` `)}),Of(e,`manager`,`done`,n?`Stage · ${n}`:`Stage reviewed`,r),kf(e,t,`manager`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`)),Af(e,t,`manager`,`stage_decision`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`),$(t,`action`))}else if(n===I.LIFE_PLANNER_START)Of(e,`planner`,`active`,`Planning next work`,r),Af(e,t,`planner`,`planning`,`Planning next work`,$(t,`objective`),`active`);else if(n===I.LIFE_PLANNER_TASK_ADDED){let n=$(t,`item_id`),i={id:n,title:$(t,`title`),objective:$(t,`objective`),status:`pending`,deps:Array.isArray(t.deps)?t.deps.map(String):[],branch_id:$(t,`branch_id`)||n,parent_branch_id:$(t,`parent_branch_id`)||null};Df(e.dag,`id`,n,i);let a=e.routing.vertical===`research`?`Research branch added`:`Task added`;Of(e,`planner`,`done`,a,r),kf(e,t,`planner`,a,i.title,`info`),Af(e,t,`planner`,`task`,i.title||`Task added`,i.objective,`pending`)}else if(n===I.LIFE_PLANNER_VERDICT){let n=!!t.project_done,i=n&&t.delivery&&typeof t.delivery==`object`&&!Array.isArray(t.delivery)?JSON.parse(JSON.stringify(t.delivery)):null,a=i?`Task completed`:n?`Project reviewed`:`Planning complete`;i&&(e.delivery=i,e.mission.status=`complete`,e.mission.summary=i.summary||``,e.mission.completed_at=r),Of(e,`planner`,`done`,a,r),kf(e,t,`planner`,a,$(t,`reason`),n?`success`:`neutral`),Af(e,t,`planner`,`verdict`,a,$(t,`reason`),n?`done`:`planned`)}else if(n===I.LIFE_PLANNER_WAITING){Of(e,`planner`,`waiting`,`Waiting on external work`,r);let n=$(t,`reason`)||$(t,`waiting_reason`);kf(e,t,`planner`,`Planner waiting`,n),Af(e,t,`planner`,`waiting`,`Planner waiting`,n,`waiting`)}else if(n===I.LIFE_MISSION_STARTED)e.review={status:``,reason:``,rejected_attempts:0},e.delivery=null,e.mission.campaign_started_at??=r,e.mission={...e.mission,id:$(t,`item_id`),title:$(t,`title`),objective:$(t,`objective`),summary:``,final_output:``,status:`working`,started_at:r,completed_at:null},Of(e,`reviewer`,`waiting`,`Waiting for the Engineer to finish`,r),Of(e,`engineer`,`active`,`Starting mission`,r),kf(e,t,`engineer`,`Mission started`,$(t,`title`),`info`),Af(e,t,`engineer`,`task`,$(t,`title`)||`Mission started`,$(t,`objective`),`active`);else if(n===I.ROUND_START)e.round={current:wf(t,`round_index`)??0,max:wf(t,`round_max`)??e.round.max},Of(e,`engineer`,`active`,`Running round ${e.round.current}`,r),kf(e,t,`engineer`,`Round ${e.round.current} started`);else if(n===I.ENGINEER_PROGRESS){let n=$(t,`agent_layer`)||$(t,`actor`)||`engineer`,i=n===`main`?`engineer`:n,a=$(t,`kind`),o=Mf[a]??`Working`;Of(e,i,`active`,o,r),i===`engineer`&&[`assistant_message`,`agent_message`,`message`].includes(a)&&t.final_delivery===!0&&e.mission.started_at!=null&&e.mission.completed_at==null&&r>=e.mission.started_at&&(!t.item_id||$(t,`item_id`)===e.mission.id)&&(e.mission.final_output=pe(t.text));let s=$(t,`action_summary`)||$(t,`text`);s&&!fe(t)&&!re(t)&&Af(e,t,i,a||`progress`,o,s,`active`),[`reasoning`,`assistant_message`,`agent_message`].includes(a)||kf(e,t,i,o,$(t,`action_summary`)||$(t,`text`))}else if(n===I.ROUND_MAIN_COMPLETED)Of(e,`engineer`,`done`,`Work ready for review`,r),Af(e,t,`engineer`,`handoff`,`Work ready for review`,$(t,`text`)||$(t,`summary`),`done`);else if(n===I.ROUND_REVIEW_STARTED)e.review={status:``,reason:``,rejected_attempts:e.review.rejected_attempts},Of(e,`reviewer`,`active`,`Reviewing benchmark evidence`,r),Af(e,t,`reviewer`,`review`,`Review started`,``,`active`);else if(n===I.ROUND_REVIEW_DEFERRED){let n=$(t,`next_step`);Of(e,`engineer`,`active`,`Continuing before review`,r),Of(e,`reviewer`,`waiting`,`Review deferred for one round`,r),kf(e,t,`engineer`,`Continued before review`,n,`info`)}else if(n===I.ROUND_REVIEW_COMPLETED){let n=t.review_skipped===!0,i=n?`skipped`:$(t,`status`),a=$(t,`reason`);e.review={status:i,reason:a,rejected_attempts:e.review.rejected_attempts+ +!![`continue`,`blocked`].includes(i)};let o=$(t,`frontier_change`);o&&(e.frontier={change:o,summary:$(t,`frontier_summary`),updated_at:r});let s=n?`No review this round`:i===`done`?`Evidence accepted`:`Attempt rejected`;Of(e,`reviewer`,n?`waiting`:i===`done`?`done`:`rejected`,n?s:i===`done`?`Accepted evidence`:`Requested another attempt`,r),kf(e,t,`reviewer`,s,a,n?`info`:i===`done`?`success`:`error`);let c=$(t,`next_action`);Af(e,t,`reviewer`,n?`review`:`verdict`,s,c?`${a}\n\nNext action: ${c}`:a,i)}else if([I.SKILL_CREATED,I.SKILL_UPDATED].includes(n)){let i=$(t,`skill_id`)||$(t,`name`);i&&(Df(e.learned_skills,`id`,i,{id:i,name:$(t,`name`),version:wf(t,`version`)??1,scope:$(t,`scope`),path:$(t,`path`),status:`active`,updated_at:r,mission_id:e.mission.id,mission_title:e.mission.title}),kf(e,t,`reviewer`,n===I.SKILL_CREATED?`Capability unlocked`:`Capability upgraded`,$(t,`name`),`skill`))}else if(n===I.SKILL_EVOLUTION_COMPLETED)e.storage.project_skill_dir=$(t,`project_skill_dir`)||e.storage.project_skill_dir,e.storage.global_skill_dir=$(t,`global_skill_dir`)||e.storage.global_skill_dir,e.storage.project_skill_count=wf(t,`project_skill_count`)??e.storage.project_skill_count,e.storage.global_skill_count=wf(t,`global_skill_count`)??e.storage.global_skill_count;else if(n===I.SKILL_HISTORY_COMPRESSED)e.storage.skill_history_compressed+=wf(t,`count`)??0,e.storage.skill_history_bytes_saved+=wf(t,`bytes_saved`)??0;else if(n===I.SKILL_TIDIED){let n=$(t,`name`);if(n){let i=e.learned_skills.find(e=>e.name===n),a={source_path:$(t,`path`),source_placement:$(t,`placement`),source_vertical:$(t,`vertical`),updated_at:r};i?Object.assign(i,a):Df(e.learned_skills,`id`,n,{id:n,name:n,version:1,scope:``,path:``,status:`active`,...a}),kf(e,t,`manager`,`Capability promoted to source`,n,`skill`)}}else if([I.WIKI_INITIALIZED,I.WIKI_EVOLUTION_COMPLETED].includes(n)){let n=[...(Array.isArray(t.paths)?t.paths:[]).map(e=>String(e)),$(t,`path`)].filter(Boolean);e.storage.wiki_paths=[...new Set([...e.storage.wiki_paths,...n])]}else if(n===I.WIKI_RETIRED_COMPRESSED)e.storage.wiki_retired_compressed+=wf(t,`count`)??0,e.storage.wiki_retired_bytes_saved+=wf(t,`bytes_saved`)??0;else if([I.WIKI_CREATED,I.WIKI_UPDATED].includes(n)){let i=$(t,`page_id`);i&&(Df(e.learned_wiki_pages,`id`,i,{id:i,title:$(t,`title`)||i,card_type:$(t,`card_type`),status:$(t,`status`)||`scratch`,path:$(t,`path`),updated_at:r}),kf(e,t,`reviewer`,n===I.WIKI_CREATED?`Knowledge captured`:`Knowledge refined`,$(t,`title`)||i,`skill`))}else if(n===I.WIKI_RETIRED){let n=$(t,`page_id`);if(n){let i=e.learned_wiki_pages.find(e=>e.id===n);i?Object.assign(i,{status:`retired`,updated_at:r}):Df(e.learned_wiki_pages,`id`,n,{id:n,title:n,card_type:$(t,`card_type`),status:`retired`,path:``,updated_at:r}),kf(e,t,`reviewer`,`Knowledge retired`,n,`error`)}}else if([I.WIKI_PROMOTION_PROMOTED,I.WIKI_PROMOTION_DEMOTED].includes(n)){let i=$(t,`page_id`);if(i){let a=e.learned_wiki_pages.find(e=>e.id===i);a?Object.assign(a,{status:$(t,`to_status`),updated_at:r}):Df(e.learned_wiki_pages,`id`,i,{id:i,title:i,card_type:$(t,`card_type`),status:$(t,`to_status`),path:``,updated_at:r});let o=n===I.WIKI_PROMOTION_PROMOTED;kf(e,t,`reviewer`,o?`Knowledge promoted`:`Knowledge demoted`,`${i} → ${$(t,`to_status`)}`,o?`success`:`neutral`)}}else if(n===I.RESEARCH_ACHIEVEMENT_CERTIFIED)e.achievement={id:$(t,`achievement_id`),title:$(t,`title`),goal:$(t,`goal`),summary:$(t,`summary`),rejected_attempts:e.review.rejected_attempts,skills_learned:e.learned_skills.filter(e=>e.status===`active`).length,artifacts:e.artifacts.length,elapsed_seconds:e.mission.elapsed_seconds,evidence:Array.isArray(t.evidence)?t.evidence.map(String):[],reviewer_certified:!0,certified_at:r};else if([I.LIFE_MISSION_COMPLETED,I.LIFE_MISSION_FAILED].includes(n)){let i=n===I.LIFE_MISSION_FAILED?oc({...t,outcome_class:`failed`,status:$(t,`status`)||`failed`,success:!1}):oc(t),a=`final_output`in t?$(t,`final_output`):$(t,`item_id`)===e.mission.id&&e.mission.started_at!=null&&(e.mission.completed_at==null||e.mission.completed_at===r)&&e.mission.final_output||``;e.mission.id=$(t,`item_id`)||e.mission.id,e.mission.title=$(t,`title`)||e.mission.title,e.mission.objective=$(t,`objective`)||e.mission.objective,e.mission.summary=$(t,`summary`),e.mission.final_output=a,e.mission.status=i.missionStatus,e.mission.completed_at=r;let o=t.delivery;t.success===!0&&o&&typeof o==`object`&&!Array.isArray(o)?e.delivery=JSON.parse(JSON.stringify(o)):t.success!==!0&&(e.delivery=null),e.outcome=ac(t),Of(e,`engineer`,i.missionStatus===`complete`?`done`:i.missionStatus,i.label,r),kf(e,t,`engineer`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),jf(i.tone)),Af(e,t,`engineer`,`completion`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),i.missionStatus)}return e.updated_at=Date.now()/1e3,e}function Pf(e,t,n){let r=t.backlog.find(e=>Cf.has(e.status)),i=t.backlog.find(e=>e.status===`pending`),a=t.backlog.find(t=>t.id===e.mission.id),o=r??a,s=!!(r||i||t.continuous?.enabled||t.continuous?.done_reason||t.continuous?.done_at||e.mission.id||![``,`idle`].includes(e.mission.status));t.continuous?.enabled&&(e.routing.route=e.routing.route||`team`,e.routing.continuous=!0,e.routing.open_ended=t.continuous.open_ended===!0,e.routing.lifetime=e.routing.open_ended?`standing`:e.routing.lifetime||`bounded`);let c=o?.objective||o?.title||(t.continuous?.enabled?t.continuous.objective:``)||t.session.objective||(e.mission.id?``:i?.objective)||(e.mission.id?``:i?.title)||e.mission.objective;c&&(e.mission.objective=c,o?e.mission.title=(o.title||c.split(` +`)[0]).slice(0,240):e.mission.title||(e.mission.title=c.split(` +`)[0].slice(0,240))),r?((r.id!==e.mission.id||r.started_ts!=null&&r.started_ts!==e.mission.started_at||e.mission.completed_at!=null)&&(e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=r.started_ts??null,e.mission.completed_at=null),e.mission.id=r.id,e.mission.status=`working`,e.mission.started_at=e.mission.started_at??r.started_ts??null):a?a.status===`pending`&&(e.mission.status=`queued`):t.continuous?.done_reason||t.continuous?.done_at?e.mission.status=`complete`:i||t.continuous?.enabled?e.mission.status=`queued`:t.daemon.alive&&(e.mission.status=`idle`),t.roles.forEach(t=>{t.active?Of(e,t.role,`active`,t.label||t.status||`Working`,Date.now()/1e3-(t.age_s??0)):s||Of(e,t.role,`waiting`,`Waiting`,Date.now()/1e3);let n=e.roles.find(e=>e.role===t.role);n&&Object.assign(n,{backend:t.backend,model:t.model,effort:t.effort})});let l=t.roles.filter(e=>e.active);l.length?e.active_role=l[l.length-1].role:s||(e.active_role=``),t.backlog.forEach(t=>{let n={id:t.id,title:t.title,objective:t.objective,status:t.status,deps:t.deps??[],branch_id:t.id,parent_branch_id:t.deps?.[0]??null,acceptance_check:t.acceptance_check??``,plan_hypothesis:t.plan_hypothesis??``,goal_contribution:t.goal_contribution??``,expected_regressions:t.expected_regressions??``,decision_rule:t.decision_rule??``,non_goals:t.non_goals??[]};Df(e.dag,`id`,n.id,n)});let u=o?.outcome?.execution_status?o.outcome:e.mission.id?void 0:[...t.backlog].filter(e=>e.outcome?.execution_status).sort((e,t)=>Number(e.finished_ts??0)-Number(t.finished_ts??0)).at(-1)?.outcome;return!r&&u&&(e.outcome=ac({outcome:u,status:`done`,success:!0})),n.forEach(t=>{Df(e.artifacts,`path`,t.path,{id:t.path,path:t.path,title:t.name,kind:t.kind,why:t.why,exists:t.exists,storage_path:t.storage_path,source:t.source})}),s}function Ff(e,t,n,r){r||(t.roles.forEach(t=>{t.active||Of(e,t.role,`waiting`,`Waiting`,Date.now()/1e3)}),e.active_role=``);let i=Date.now()/1e3,a=e.mission.campaign_started_at??t.session.created??e.mission.started_at;a&&(e.mission.campaign_started_at=a,e.mission.campaign_elapsed_seconds=Math.max(0,i-a)),e.mission.started_at&&e.mission.status===`working`?e.mission.elapsed_seconds=Math.max(0,i-e.mission.started_at):e.mission.started_at&&e.mission.completed_at&&(e.mission.elapsed_seconds=Math.max(0,e.mission.completed_at-e.mission.started_at)),e.achievement?.reviewer_certified&&(e.achievement.elapsed_seconds=e.mission.elapsed_seconds,e.achievement.rejected_attempts=e.review.rejected_attempts,e.achievement.skills_learned=e.learned_skills.filter(e=>e.status===`active`).length,e.achievement.artifacts=n.filter(e=>e.exists).length)}function If(e,t=[],n=[]){let r=e.mission_view?Tf(e.mission_view):Ef();r.storage??=Ef().storage,r.storage.skill_history_compressed??=0,r.storage.wiki_retired_compressed??=0,r.storage.skill_history_bytes_saved??=0,r.storage.wiki_retired_bytes_saved??=0,r.learned_wiki_pages??=[],r.role_work??=[],r.delivery??=null,r.outcome??={};let i=r.last_event_ts,a=Pf(r,e,n),o=[...t].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0));return o.filter(e=>e.ts==null||Number(e.ts)>i).forEach(e=>Nf(r,e)),r.mission.final_output||(r.mission.final_output=Lf(o,r.mission)),Ff(r,e,n,a),r}function Lf(e,t){if(!t.id||[`working`,`queued`,`grounding`,`framed`].includes(t.status))return``;let n=e.reduce(Nf,Ef()).mission;return n.id!==t.id||n.started_at==null||n.completed_at==null||t.started_at!=null&&n.started_at!==t.started_at||t.completed_at!=null&&n.completed_at!==t.completed_at?``:n.final_output||``}function Rf(e){return String(e||``).replace(/\\([*_`~])/g,`$1`).replace(/\\\\(?=[A-Za-z])/g,`\\`)}function zf(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h ${r}m`:r?`${r}m`:`${t}s`}var Bf=`__argus_live_progress__`,Vf=new Set([`framed`,`grounding`,`queued`,`running`,`in_progress`,`working`]),Hf=new Set([`complete`,`completed`,`done`,`success`]);function Uf(e){return Hf.has(String(e?.mission.status||``).toLowerCase())}function Wf(e){return(e??[]).filter(e=>e.source===`manager_live`)}function Gf(e){return Wf(e).filter(e=>e.exists)[0]??null}function Kf(e){let t=e??[],n={markdown:0,pdf:1,html:2,text:3,table:4,json:5,image:6,video:7,audio:8,binary:9},r=t.filter(e=>e.exists&&e.source===`delivery`),i=t.filter(e=>e.exists&&e.source===`manager_live`),a=t.filter(e=>e.exists&&e.source!==`manager_live`&&e.source!==`delivery`);return a.length||r.length?[...r,...[...a].sort((e,t)=>(n[e.kind]??99)-(n[t.kind]??99)),...i]:i}function qf(e){return Kf(e).find(e=>e.exists)??null}function Jf(e){let t=Kf(e);return t.find(e=>e.source===`delivery`)??t.find(e=>e.source!==`manager_live`)??t[0]??null}function Yf(e){let t=e.path.split(`/`);return t[t.length-1]||e.path}function Xf(e,t){if(e){let n=String(e.mission.status||``).toLowerCase();if(Vf.has(n))return Bf;let r=e.delivery?.primary_target?.path;if(r)return r;if(Uf(e))return Jf(t)?.path??`__argus_live_progress__`;let i=Gf(t);return i?i.path:Bf}return qf(t)?.path??``}function Zf(e){let t=String(e.agent_layer??e.actor??``);if(t===`main`)return`engineer`;if(t)return t;let n=String(e.type??``);return n.startsWith(`round.review`)||n.startsWith(`reviewer`)?`reviewer`:n.startsWith(`life.planner`)?`planner`:n.startsWith(`life.manager`)||n.startsWith(`manager`)?`manager`:n.startsWith(`engineer`)||n.startsWith(`round.`)?`engineer`:``}function Qf(e,t=[],n,r=`en`){if(n&&ci(n,e,t).state!==`running`||Uf(e))return null;let i=String(e?.active_role??``);if(!i)return null;let a=e?.roles.find(e=>e.role===i),o=``;for(let n=t.length-1;n>=0;--n){let r=t[n];if(e?.mission.id&&ri(r)!==e.mission.id||e?.mission.started_at&&Number(r.ts||0)ue(e,{},r)):i,label:a?.label||`Working`,detail:o}}function $f({view:e,artifacts:t=[],onOpenArtifact:n,routeVisible:r,snapshot:i,connected:a}){let{locale:o,t:s}=z(),c=e.dag.filter(e=>[`done`,`completed`].includes(e.status)).length,l=[...t].filter(e=>e.exists&&e.source!==`manager_live`).sort((e,t)=>Number(t.mtime??0)-Number(e.mtime??0)).slice(0,4),u=e=>[`running`,`in_progress`,`claimed`].includes(e),d=a&&i?.daemon.alive!==!1,f=e=>e===`done`?`text-ok`:u(e)?`text-blue-sky`:[`failed`,`blocked`,`rejected`].includes(e)?`text-err`:`text-ink-faint`;return(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 text-sm text-ink-dim scroll-thin`,children:[(0,J.jsx)(`section`,{className:`rounded-lg border border-blue-deep/30 bg-blue-deep/10 p-4`,children:(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.stage`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm font-medium text-blue-sky`,children:Pc(e.stage.id,o)===e.stage.id?e.stage.label||e.stage.id||`—`:Pc(e.stage.id,o)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.totalTime`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:zf(e.mission.campaign_elapsed_seconds)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.round`)}),(0,J.jsxs)(`dd`,{className:`mt-1 text-sm text-ink`,children:[e.round.current||`—`,e.round.max?` / ${e.round.max}`:``]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.dagProgress`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:Rc(c,e.dag.length,o)})]})]})}),r&&e.dag.length?(0,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:s(`mission.researchDag`)}),(0,J.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.dag.map(e=>(0,J.jsx)(`li`,{className:`rounded-md border border-line/60 bg-panel px-3 py-2.5`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 shrink-0 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,"aria-hidden":`true`,children:e.status===`done`?`✓`:d&&u(e.status)?`●`:`○`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium leading-5 text-ink`,children:(0,J.jsx)(H,{children:e.title})}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,children:!d&&u(e.status)?a?o===`zh-CN`?`当前未在运行`:`Not currently running`:o===`zh-CN`?`断连前记录:进行中`:`Last received state: in progress`:Wc(e.status,o)})]})]})},e.id))})]}):null,l.length?(0,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:o===`zh-CN`?`已生成的文件`:`Files produced so far`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o===`zh-CN`?`文件已生成,结论是否成立仍以核验记录为准。`:`A saved file is not a verification of its conclusions.`}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:l.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),title:e.storage_path||e.path,className:`rounded border border-line/70 bg-panel px-2.5 py-1.5 font-mono text-xs text-blue-sky hover:border-blue/60`,children:[Yf(e),` ↗`]},e.path))})]}):null]})}function ep({sid:e,artifacts:t,error:n=!1,onExpand:r,onOpenFile:i,className:a=``,embedded:s=!1,onCollapse:c,missionView:l,activityEvents:u=[],requestedPath:d,requestedPathToken:f,routeVisible:p=!0,snapshot:m,connected:h=!0}){let{t:g,locale:_}=z(),y=(0,G.useMemo)(()=>Kf(t),[t]),b=(0,G.useMemo)(()=>qf(t),[t]),x=Uf(l),S=(0,G.useMemo)(()=>{if(!x)return null;let e=l?.delivery?.primary_target?.path;return y.find(t=>t.path===e&&t.exists)??Jf(t)},[t,x,l?.delivery?.primary_target?.path,y]),[C,w]=(0,G.useState)(null);(0,G.useEffect)(()=>{w(x&&S?S.path:null)},[x,S?.path,l?.mission.id,e]),(0,G.useEffect)(()=>{if(!d)return;let e=y.find(e=>e.path===d&&e.exists);e&&w(e.path)},[y,d,f]);let T=e=>{w(e),e!==`__argus_live_progress__`&&i?.()},E=C??Xf(l,t),D=E===Bf,O=D?null:y.find(e=>e.path===E)??(x?S:b),k=we(e,O?.exists?O.path:null,O?.mtime??null),A=k.data,j=A?us(A):!1,[M,ee]=(0,G.useState)(null),[N,P]=(0,G.useState)(``),[F,te]=(0,G.useState)(!1),[ne,re]=(0,G.useState)(``),ie=(0,G.useMemo)(()=>h?Qf(l,u,m,_):null,[u,l,m,h,_]);(0,G.useEffect)(()=>{if(ee(null),P(``),!e||!O||!A||![`image`,`pdf`,`audio`,`video`].includes(A.kind))return;let t=!0,n=``,r=new AbortController;return R.artifactBlob(e,O.path,!1,r.signal).then(e=>{t&&(n=URL.createObjectURL(e),ee(n))},e=>t&&P(e.message)),()=>{t=!1,r.abort(),n&&URL.revokeObjectURL(n)}},[e,O?.path,A?.kind,A?.mtime]);let I=l?.delivery??null,L=I?.primary_target?.path??``,ae=!!(x&&!D&&O&&(O.source===`delivery`||O.path===L)),oe=_===`zh-CN`?I?.kind===`submission_certified`?`交付已认证`:`已完成`:I?.kind===`submission_certified`?`Certified delivery`:`Delivered result`,se=ae?oe:D?g(`research.liveProgress`):y[0]?.group_title||g(`research.artifact`),ce=async()=>{if(!(!e||!O)){te(!0),re(``);try{let t=await R.artifactBlob(e,O.path,!0);ut(t,O.name)}catch(e){re(e.message)}finally{te(!1)}}};return(0,J.jsxs)(`section`,{className:`glass-panel glass-panel--side flex min-h-0 flex-col overflow-hidden ${s?``:`rounded-lg border`} ${a}`,"aria-label":g(`research.canvas`),children:[(0,J.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-line/50 bg-panel px-4`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 rounded-full ${ae?`bg-ok`:ie?`animate-pulse bg-blue`:`bg-ink-faint/60`}`}),(0,J.jsx)(`h2`,{className:`max-w-24 truncate text-sm font-semibold text-ink sm:max-w-48`,children:se})]}),l||y.length>0?(0,J.jsxs)(`label`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:g(`research.previewArtifact`)}),(0,J.jsxs)(`select`,{value:D?Bf:O?.path??``,onChange:e=>T(e.target.value),title:D?g(`research.liveProgress`):O?.storage_path||O?.path,className:`h-8 w-full min-w-0 max-w-64 truncate rounded-md border border-line/50 bg-bg px-2 font-mono text-xs text-ink-dim outline-none focus:border-blue/60`,children:[l?(0,J.jsx)(`option`,{value:Bf,children:g(`research.liveProgress`)}):null,y.map(e=>(0,J.jsxs)(`option`,{value:e.path,disabled:!e.exists,title:e.storage_path||e.path,children:[e.source===`delivery`?`${g(`research.optionDelivery`)} · `:``,Yf(e),e.exists?``:` · ${g(`research.optionPending`)}`]},e.path))]})]}):(0,J.jsx)(`div`,{className:`flex-1`}),(0,J.jsx)(`div`,{className:`shrink-0`,children:O?(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void ce(),disabled:F||!O.exists,title:g(`artifact.download`),"aria-label":g(`artifact.download`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink disabled:opacity-40`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M8 2.25v7.5M5.25 7.5 8 10.25 10.75 7.5M3 13.25h10`})})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(O.path),title:g(`research.openLarge`),"aria-label":g(`research.openLarge`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M6 3H3v3M10 3h3v3M6 13H3v-3M10 13h3v-3`})})})]}):null}),c?(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":g(`research.collapse`),title:g(`research.collapse`),className:`hidden h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink lg:flex`,children:(0,J.jsx)(o,{icon:v,className:`h-3.5 w-3.5`})}):null]}),m?(0,J.jsx)(ru,{snapshot:m,view:l,events:u,connected:h,compact:!0}):ie?(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-line/50 bg-blue-deep/10 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(`span`,{"data-role-dot":ie.role,className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:B.role[ie.role]??B.inkFaint},"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-semibold text-ink`,children:ie.roleLabel}),(0,J.jsx)(`span`,{className:`text-blue-sky`,children:g(`mission.active`)}),(0,J.jsxs)(`span`,{className:`truncate text-ink-faint`,children:[`· `,Hc(ie.label,_,{kind:l?.roles.find(e=>e.role===ie.role)?.kind,language:l?.language})]})]}),ie.detail?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-ink-dim`,children:ie.detail}):null]}):null,(0,J.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col bg-bg`,children:[D&&l?(0,J.jsx)($f,{view:l,artifacts:t,onOpenArtifact:T,routeVisible:p,snapshot:m,connected:h}):null,!D&&n?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-6 text-center text-sm text-warn`,children:g(`research.unavailable`)}):null,!D&&!n&&y.length===0?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,J.jsx)(`h3`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.noPreview`)})]}):null,!D&&!n&&y.length>0&&!O?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(tt,{}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.waiting`)})]}):null,O&&!O.exists?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(tt,{}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.updating`)})]}):null,O?.exists&&k.isLoading?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,O?.exists&&k.isError?(0,J.jsxs)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:[g(`artifact.unavailable`),` · `,k.error.message]}):null,A?.kind===`text`&&!j?(0,J.jsxs)(`pre`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:[A.preview||`(empty file)`,A.truncated?` + +… live preview truncated · expand to inspect the complete file`:``]}):null,A&&j?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-5 text-sm text-ink-dim scroll-thin`,children:(0,J.jsx)(H,{sid:e,basePath:A.path,artifacts:t,onOpenArtifact:T,children:A.preview||`(empty file)`})}):null,A?.kind===`json`?(0,J.jsx)(lf,{value:A.preview||``}):null,A?.kind===`table`?(0,J.jsx)(uf,{value:A.preview||``,delimiter:A.name.endsWith(`.tsv`)?` `:`,`}):null,A?.kind===`html`&&!A.truncated?(0,J.jsx)(af,{sid:e,path:A.path,html:A.preview||``,title:`Live HTML preview: ${A.name}`}):null,A?.kind===`html`&&A.truncated?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-warn`,children:g(`artifact.htmlTooLarge`)}):null,A?.kind===`image`&&M?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4`,children:(0,J.jsx)(`img`,{src:M,alt:A.why||A.name,className:`max-h-full max-w-full object-contain`})}):null,A?.kind===`pdf`&&M?(0,J.jsx)(vf,{src:M,name:A.name}):null,A?.kind===`audio`&&M?(0,J.jsx)(`div`,{className:`m-auto w-full max-w-xl px-6`,children:(0,J.jsx)(`audio`,{controls:!0,preload:`metadata`,src:M,className:`w-full`})}):null,A?.kind===`video`&&M?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-2`,children:(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:M,className:`max-h-full max-w-full`})}):null,A?.kind===`binary`?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-ink-dim`,children:g(`research.fileUnavailable`)}):null,A&&[`image`,`pdf`,`audio`,`video`].includes(A.kind)&&!M&&!N?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,N?(0,J.jsx)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:N}):null]}),!D&&A?(0,J.jsxs)(`footer`,{className:`flex h-9 items-center gap-2 border-t border-line px-4 font-mono text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:A.storage_path||A.path,children:A.path}),ne?(0,J.jsx)(`span`,{className:`ml-auto truncate text-err`,title:ne,children:g(`research.downloadFailed`)}):null,(0,J.jsx)(`span`,{className:`shrink-0`,children:yt(A.size)})]}):null]})}function tp({notice:e,onClose:t}){if((0,G.useEffect)(()=>{if(!e)return;let n=window.setTimeout(t,e.tone===`error`?8e3:4e3);return()=>window.clearTimeout(n)},[e,t]),!e)return null;let n=e.tone===`error`?`border-err/60 bg-err/10 text-err`:e.tone===`success`?`border-ok/60 bg-ok/10 text-ok`:`border-blue-deep/60 bg-panel text-blue-sky`;return(0,J.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,"aria-live":e.tone===`error`?`assertive`:`polite`,className:`fixed bottom-4 left-4 right-4 z-[70] flex items-start gap-2 rounded-md border px-3 py-2.5 shadow-glow sm:left-auto sm:max-w-md ${n}`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0`,children:e.tone===`error`?`!`:e.tone===`success`?`✓`:`i`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-xs leading-relaxed text-ink-dim`,children:e.message}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`dismiss notification`,onClick:t,className:`shrink-0 rounded px-1 text-base leading-none opacity-70 hover:bg-white/5 hover:opacity-100`,children:`×`})]})}function np({open:e,sid:t,name:n,alive:r,controlAvailable:i=!0,busy:a,onClose:o,onRename:s,onStart:c,onStop:l,onDelete:u}){let{t:d}=z(),[f,p]=(0,G.useState)(n),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(!1);(0,G.useEffect)(()=>{e&&(p(n),h(!1),_(!1))},[e,n,t]);let v=async e=>{e.preventDefault(),await s(f.trim())},y=r&&!g,b=async()=>{if(y){await l()&&_(!0);return}await c()&&_(!1)};return(0,J.jsxs)(dt,{open:e,onClose:()=>!a&&o(),label:d(`manage.daemon`),width:`max-w-lg`,children:[(0,J.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-ink`,children:d(`topbar.manageSession`)}),(0,J.jsx)(`p`,{className:`mt-0.5 font-mono text-[10px] text-ink-faint`,children:t})]}),(0,J.jsx)(`form`,{onSubmit:e=>void v(e),className:`border-b border-line p-5`,children:(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.displayName`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),maxLength:80,disabled:a,className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg/50 px-3 text-sm text-ink outline-none focus:border-blue-deep disabled:opacity-50`}),(0,J.jsx)(`button`,{type:`submit`,disabled:a||f.trim()===n,className:`rounded border border-line px-3 text-xs text-ink-dim hover:bg-surface disabled:opacity-40`,children:d(`common.save`)})]})]})}),(0,J.jsxs)(`div`,{className:`border-b border-line p-5`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.executor`)}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center justify-between rounded border border-line bg-bg/30 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm text-ink`,children:d(y?i?`manage.running`:`manage.runningExternally`:`manage.paused`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:d(y?i?`manage.stopNowHint`:`manage.externalHint`:`manage.resumeHint`)})]}),(0,J.jsx)(`button`,{type:`button`,disabled:a||!i,onClick:()=>void b(),className:`rounded border px-3 py-1.5 text-xs disabled:cursor-wait disabled:opacity-50 ${y?`border-warn/50 text-warn hover:bg-warn/10`:`border-blue-deep bg-blue-deep text-white hover:bg-blue-deep/80`}`,children:d(a?`manage.working`:i?y?`manage.stopNow`:`manage.resume`:`common.external`)})]})]}),(0,J.jsxs)(`div`,{className:`p-5`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:d(`manage.deleteSession`)}),(0,J.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-ink-faint`,children:d(`manage.deleteHint`)}),m?(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded border border-err/40 bg-err/5 p-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-dim`,children:d(`manage.confirmQuestion`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`rounded px-2 py-1 text-xs text-ink-faint hover:bg-surface`,children:d(`common.cancel`)}),(0,J.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void u(),className:`rounded bg-err px-3 py-1 text-xs font-medium text-bg disabled:opacity-50`,children:d(`manage.confirmDelete`)})]})]}):(0,J.jsx)(`button`,{type:`button`,disabled:a||y,onClick:()=>h(!0),className:`mt-3 rounded border border-err/40 px-3 py-1.5 text-xs text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-40`,children:d(`manage.delete`)})]})]})}var rp={科学环境已就绪:`Scientific environment ready`,更新科学环境校验:`Update scientific environment checks`,验证科学环境依赖和关键模块:`Validating scientific dependencies and required modules`,"科学环境 · 上次检查结果":`Scientific environment · previous check`,"下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。":`The results below predate this operation. Refer to the latest error above or check the environment again.`,"科学环境 · ⟦0⟧ 项待配置":`Scientific environment · ⟦0⟧ item(s) to configure`,科学环境:`Scientific environment`,检查环境:`Check environment`,"免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。":`Free scientific components are configured automatically; SHELX requires academic authorization from the official website before entering download credentials.`,修复依赖:`Repair dependencies`,"继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。":`Confirm the official PLATON license before continuing. The same installation or repair action will prepare the complete runtime; no separate repair button is required.`,同意并继续:`Agree and continue`,"请先确认 PLATON 使用许可,再继续安装或修复依赖。":`Confirm the PLATON license before installing or repairing dependencies.`,依赖修复完成:`Dependency repair complete`,依赖修复未完成:`Dependency repair incomplete`,环境操作未完成:`Environment operation incomplete`,"依赖修复未完成:⟦0⟧。请查看组件检查结果;不会报告修复成功。":`Dependency repair is incomplete: ⟦0⟧. Check the component results; this is not reported as a successful repair.`,"PLATON 已可用,保留当前安装。":`PLATON is already available; keeping the existing installation.`,"准备 PLATON 官方环境":`Prepare official PLATON runtime`,"下载、验证并配置":`Download, verify and configure`,"我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。":`I confirm that my use complies with the official PLATON license; for commercial use, I have obtained separate authorization.`,"PLATON 官方允许注明来源的学术、科学及非商业用途;商业用途需自行取得许可。本操作只从官方网站下载到插件私有目录,不安装系统运行库、不修改系统 PATH。":`The publisher permits acknowledged academic, scientific and non-commercial use of PLATON; commercial use requires a separate license. This downloads from official sites into the plugin's private directory, without installing system runtimes or changing the system PATH.`,"PLATON 缺少 Windows Salford 运行库(0xC0000135)。请点击“修复依赖”,确认许可后会在同一流程准备完整运行环境。":`PLATON is missing the Windows Salford runtime (0xC0000135). Click Repair dependencies and confirm the license to prepare the complete runtime in the same action.`,"正在校验 PLATON 官方程序与 Windows 配套运行环境…":`Verifying the official PLATON program and Windows runtime…`,"正在提取官方 Salford 运行库(不执行系统安装程序)…":`Extracting the official Salford runtime without executing the system installer…`,"正在实际运行 PLATON,验证 Windows 运行库和校验规则…":`Running PLATON to verify the Windows runtime and validation rules…`,"PLATON 官方 Windows 运行环境验证通过。":`The official PLATON Windows runtime passed verification.`,"PLATON 官方运行环境已可用,保留当前安装。":`The official PLATON runtime is already available; keeping the existing installation.`,"配置 SHELX":`Configure SHELX`,"SHELX 授权安装":`SHELX authorized installation`,学术授权:`Academic authorization`,前往官网申请:`Apply on official website`,"填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。":`Enter the username and password from the authorization email to download and install automatically. Credentials are used only for this official download, are not saved, and are not sent to the model.`,用户名:`Username`,"SHELX 用户名":`SHELX username`,密码:`Password`,"SHELX 密码":`SHELX password`,"查看许可 ↗":`View license ↗`,"下载并安装 SHELX":`Download and install SHELX`,取消:`Cancel`,科学软件健康检查:`Scientific software health check`,"点击“检查环境”可验证科学内核与外部程序。":`Click “Check environment” to verify the scientific kernel and external programs.`,可用:`Available`,待授权安装:`Authorization required`,待修复:`Needs repair`,查看检查详情:`View check details`,查看原因与安装方式:`View cause and installation method`,"官方安装说明 ↗":`Official installation instructions ↗`,使用已有安装:`Use existing installation`,"DIALS 环境目录":`DIALS environment directory`,"Systre JAR 路径(需要已有 Java)":`Systre JAR path (existing Java required)`,"⟦0⟧ 可执行文件路径":`⟦0⟧ executable path`,"填写运行 Argus 的电脑上的路径,验证成功后生效。":`Enter the path on the computer running Argus. It takes effect after successful verification.`,验证并使用:`Verify and use`,最近检查:`Last checked`,"· 检查不调用模型":`· Check does not call the model`,无法读取插件列表:`Unable to read plugin list`,插件操作未完成:`Plugin operation incomplete`,插件:`Plugins`,关闭插件列表:`Close plugin list`,"按需安装研究工具,沿用 Argus 的模型与执行后端。":`Install research tools as needed, using Argus's model and execution backend.`,"正在读取插件…":`Reading plugins…`,暂无可用插件:`No plugins available`,已启用:`Enabled`,已停用:`Disabled`,未安装:`Not installed`,"· 当前后端":`· Current backend`,安装:`Install`,打开工作台:`Open workbench`,启用:`Enable`,更新至:`Update to`,停用:`Disable`,卸载:`Uninstall`,"原生会话输入 ⟦0⟧ 可启用后台工具。卸载保留会话、研究数据和科学软件。":`Native session input ⟦0⟧ can enable background tools. Uninstalling preserves sessions, research data, and scientific software.`,"首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。":`First installation automatically configures standalone Python, DIALS, Systre / Java, and free academic PLATON components. SHELX can be installed later by entering authorization details.`,"暂不支持,敬请期待。当前插件支持 Codex、Copilot 和 Pi。":`Not supported yet. Stay tuned. Current plugins support Codex, Copilot, and Pi.`,"安装科学环境需要 Python 3.11–3.13。请安装 Python 后重试,或设置 ARGUS_PLUGIN_PYTHON。":`Installing the scientific environment requires Python 3.11–3.13. Install Python and try again, or set ARGUS_PLUGIN_PYTHON.`,准备安装:`Prepare installation`,获取并校验插件包:`Download and verify plugin package`,"安装独立运行环境(首次可能需要几分钟)":`Install standalone environment (may take several minutes the first time)`,"插件仍有任务运行,请等任务结束或先暂停,再进行此操作。":`This plugin still has running tasks. Wait for them to finish or pause them before continuing.`,"此插件版本尚未提供可校验的发行包。":`No verifiable release package is available for this plugin version.`,"插件包校验失败,未安装。":`Plugin package verification failed. Not installed.`,正在准备:`Preparing`,"当前系统或 Argus 插件接口版本暂不支持此插件。":`This plugin is not currently supported by the system or Argus plugin API version.`,"插件发行包尚未发布。":`The plugin release package has not been published.`,安装完成:`Installation complete`,环境检查完成:`Environment check complete`,"此插件已有安装或更新操作正在进行。":`An installation or update operation for this plugin is already in progress.`,插件尚未安装:`Plugin not installed`,"安装进程已中断;已有可用版本保持不变,可重试。":`Installation was interrupted. The existing available version is unchanged; you can retry.`,"安装未完成,已有版本保持不变":`Installation incomplete; existing version unchanged`,"此版本已安装,可启用插件。":`This version is installed. You can enable the plugin.`,请先安装插件:`Install the plugin first`,请先更新插件以使用环境管理功能:`Update the plugin first to use environment management`,"插件包超过允许大小。":`The plugin package exceeds the allowed size.`,科学计算内核:`Scientific computing kernel`,"cctbx · Gemmi · RDKit · 科学服务":`cctbx · Gemmi · RDKit · scientific services`,衍射帧处理与探测器格式支持:`Diffraction frame processing and detector format support`,周期网络与拓扑识别:`Periodic networks and topology identification`,"本地 checkCIF 结构校验 · 学术免费":`Local checkCIF structure validation · free for academic use`,"结构精修 · 需要学术授权":`Structure refinement · academic authorization required`,"结构求解 · 需要学术授权":`Structure solution · academic authorization required`,全部组件可用:`All components available`,部分组件需要配置或修复:`Some components require configuration or repair`,"PLATON 官网中间证书已更换,请更新插件安装器":`The PLATON official-site intermediate certificate has changed. Update the plugin installer.`,"PLATON Mac 发行包架构不符":`PLATON Mac release package architecture mismatch`,"请输入授权邮件中的用户名和密码。":`Enter the username and password from the authorization email.`,请选择有效的科学软件路径:`Select a valid scientific software path`,检查科学软件与运行环境:`Check scientific software and runtime environment`,"正在修复科学 Python 依赖":`Repairing scientific Python dependencies`,"(首次下载可能需要几分钟)":`(The initial download may take several minutes)`,"from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('科学内核及工作台资源可用')":`from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('Scientific kernel and workbench resources available')`,"; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · 探测器格式插件可用')":`; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · detector format plugins available')`,"Systre 19.6.0 · pcu 拓扑计算通过":`Systre 19.6.0 · pcu topology calculation passed`,"正在安装 Apple Rosetta 2 兼容组件":`Installing Apple Rosetta 2 compatibility components`,"从 SHELX 官方站点下载":`Downloading from the official SHELX site`,"SHELX 下载内容不是支持的可执行程序":`SHELX download is not a supported executable`,"已可用,保留当前安装":`Already available; keeping current installation`,正在安装:`Installing`,"尚未安装 DIALS":`DIALS is not installed`,"PLATON 编译需要 Apple 命令行工具;请运行 xcode-select --install,然后点击修复依赖。":`PLATON compilation requires Apple Command Line Tools; run xcode-select --install, then click Repair dependencies.`,"SHELX 官方 Mac 版需要 Rosetta 2,请先同意安装兼容组件。":`The official Mac version of SHELX requires Rosetta 2. Agree to install the compatibility components first.`,"暂未完成;可在健康检查中重试":`Not completed; retry from the health check`,"SHELX 下载或启动失败;请核对授权、网络及系统平台后重试。":`SHELX download or launch failed; check authorization, network, and system platform, then retry.`,"尚未安装 Systre":`Systre is not installed`,"尚未安装 Java":`Java is not installed`,"Systre 未能识别内置 pcu 网络":`Systre could not identify the built-in pcu network`,"尚未安装 PLATON":`PLATON is not installed`,"PLATON 安装配方已更新,点击修复依赖即可使用当前版本。":`The PLATON installation recipe has been updated. Click Repair dependencies to use the current version.`,"PLATON 未生成校验规则;请检查运行库":`PLATON did not generate verification rules; check the runtime`,"请输入 SHELX 授权信息以安装":`Enter SHELX authorization details to install`,"无法启动,请核对平台与运行库":`Unable to start; check the platform and runtime`,"衍射数据处理、结构求解、精修与三维晶体研究工作台":`Diffraction data processing, structure solution, refinement and a 3D crystallography workbench`,"正在准备 ⟦0⟧ 工作台,首次需要几分钟":`Preparing the ⟦0⟧ workbench; the first time takes a few minutes`,"⟦0⟧ 暂时无法使用":`⟦0⟧ is unavailable for now`,"管理 ⟦0⟧":`Manage ⟦0⟧`,"原生会话输入 ⟦0⟧ 可启用后台工具。":`Native session input ⟦0⟧ can enable background tools.`,"研究工具由服务方提供,沿用 Argus 的模型与执行后端。":`Research tools are provided by the service and use Argus's model and execution backend.`,"此插件由服务方提供并维护,无需停用或卸载。":`This plugin is provided and maintained by the service; there is nothing to disable or uninstall.`},ip=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),ap=/⟦\d+⟧/g,op=Object.entries(rp).filter(([e])=>e.includes(`⟦`)).sort((e,t)=>t[0].length-e[0].length).map(([e,t])=>({regex:RegExp(`^`+e.split(ap).map(ip).join(`([\\s\\S]*?)`)+`$`),slots:e.match(ap)??[],target:t})),sp=new RegExp(Object.keys(rp).filter(e=>e.length>1&&!e.includes(`⟦`)).sort((e,t)=>t.length-e.length).map(ip).join(`|`),`g`);function cp(e,t){if(t===`zh-CN`||!/[\u3400-\u9fff]/.test(e))return e;if(rp[e.trim()])return e.replace(e.trim(),rp[e.trim()]);for(let t of op){let n=t.regex.exec(e.trim());if(n){let e=new Map(t.slots.map((e,t)=>[e,n[t+1]]));return t.target.replace(ap,t=>e.get(t)??t)}}return e.replace(sp,e=>rp[e])}function lp(){let{locale:e}=z();return t=>typeof t==`string`?cp(t,e):t}var up=oe(),dp=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;function fp({health:e,setup:t,running:n,act:r,platform:i,machine:a}){let o=lp(),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(!1),[C,w]=(0,G.useState)(!1),T=t.windows_runtime,E=t.license?.platform_consent,D=E?.platform===i&&E?.machines.includes(a||``),O=e?.components||[],k=O.filter(e=>e.status!==`ready`),A=k.some(e=>e.license_required),j=k.some(e=>e.automatic);async function M(e){e.preventDefault();let n=await r(t.license.action,{username:d,password:p,accept_platform_license:y});m(``),n&&(u(!1),f(``),c(!0))}return(0,J.jsxs)(`div`,{className:`mt-5 border-t border-line/60 pt-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:()=>c(!s),className:`inline-flex items-center gap-2 text-sm text-ink-dim hover:text-ink`,children:[(0,J.jsx)(Be,{size:16,strokeWidth:1.5}),(0,J.jsx)(`span`,{children:o(e?.stale?o(`科学环境 · 上次检查结果`):e?.checked?e.ready?o(`科学环境已就绪`):o(`科学环境 · ${k.length} 项待配置`):o(`科学环境`))}),(0,J.jsx)(Ue,{size:13,className:`transition-transform duration-200 ${s?`rotate-180`:``}`})]}),(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint hover:text-ink disabled:opacity-45`,disabled:n,onClick:()=>{c(!0),r(`health`)},children:[(0,J.jsx)(Ke,{size:12}),o(`检查环境`)]})]}),e?.stale&&(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs leading-relaxed text-ink-dim`,children:o(`下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。`)}),o((A||j||!e?.checked)&&(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:o(` 免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。 `)})),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[o((j||!e?.checked||e.stale)&&(0,J.jsxs)(`button`,{className:dp,disabled:n,onClick:()=>{c(!0),r(`repair`)},children:[(0,J.jsx)(Ye,{size:14}),o(`修复依赖`)]})),o(t.license&&(0,J.jsxs)(`button`,{className:dp,disabled:n,onClick:()=>{u(!l),m(``),f(``)},children:[(0,J.jsx)(nn,{size:14}),o(o(A?`配置 SHELX`:`SHELX 授权安装`))]}))]}),T&&(0,J.jsxs)(`div`,{className:`mt-3`,children:[(0,J.jsxs)(`button`,{type:`button`,className:dp,disabled:n,onClick:()=>{w(!C),S(!1)},children:[(0,J.jsx)(Ye,{size:14}),o(`准备 PLATON 官方环境`)]}),C&&(0,J.jsxs)(`form`,{className:`mt-3 rounded-lg bg-bg/70 p-3`,onSubmit:async e=>{e.preventDefault(),x&&await r(T.action,{accept_software_license:!0})&&(w(!1),S(!1),c(!0))},children:[(0,J.jsxs)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:[o(T.notice),` `,(0,J.jsx)(`a`,{href:T.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)})]}),(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5`}),o(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{type:`submit`,className:dp,disabled:n||!x,children:o(`下载、验证并配置`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>{w(!1),S(!1)},children:o(`取消`)})]})]})]}),o(l&&t.license&&(0,J.jsxs)(`form`,{onSubmit:M,className:`mt-4 rounded-lg bg-bg/70 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm`,children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[o(t.license.name),o(` 学术授权`)]}),(0,J.jsxs)(`a`,{href:t.license.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-blue`,children:[o(`前往官网申请`),(0,J.jsx)(qe,{size:11})]})]}),(0,J.jsx)(`p`,{className:`mb-3 mt-1.5 text-xs leading-relaxed text-ink-faint`,children:o(`填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。`)}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`用户名`),(0,J.jsx)(`input`,{"aria-label":o(`SHELX 用户名`),value:d,onChange:e=>f(e.target.value),required:!0,maxLength:200,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`密码`),(0,J.jsx)(`input`,{"aria-label":o(`SHELX 密码`),type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,maxLength:500,autoComplete:`new-password`,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]})]}),o(D&&E&&(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-faint`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5`}),(0,J.jsxs)(`span`,{children:[o(E.text),` `,(0,J.jsx)(`a`,{href:E.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`查看许可 ↗`)})]})]})),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,J.jsxs)(`button`,{type:`submit`,className:dp,disabled:n||!d.trim()||!p.trim(),children:[(0,J.jsx)(Ye,{size:14}),o(`下载并安装 SHELX`)]}),(0,J.jsx)(`button`,{type:`button`,className:`px-2 text-xs text-ink-faint`,onClick:()=>{u(!1),f(``),m(``)},children:o(`取消`)})]})]})),s&&(0,J.jsxs)(`div`,{className:`mt-3`,"aria-label":o(`科学软件健康检查`),children:[o(!O.length&&(0,J.jsx)(`p`,{className:`py-2 text-xs text-ink-faint`,children:o(`点击“检查环境”可验证科学内核与外部程序。`)})),O.map(e=>(0,J.jsx)(`div`,{className:`border-b border-line/40 py-2.5 last:border-0`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[o(e.status===`ready`?(0,J.jsx)(We,{size:15,strokeWidth:1.7,className:`mt-0.5 shrink-0 text-blue/75`}):(0,J.jsx)(qt,{size:15,strokeWidth:1.5,className:`mt-0.5 shrink-0 text-ink-faint`})),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,J.jsx)(`span`,{children:o(e.name)}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-ink-faint`,children:o(e.status===`ready`?o(`可用`):e.license_required?o(`待授权安装`):o(`待修复`))})]}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-ink-faint`,children:o(e.description)}),(0,J.jsxs)(`details`,{className:`mt-1.5 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer hover:text-ink-dim`,children:o(e.status===`ready`?o(`查看检查详情`):o(`查看原因与安装方式`))}),(0,J.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words leading-relaxed`,children:o(e.detail)}),e.path&&(0,J.jsx)(`p`,{className:`mt-1 break-all leading-relaxed`,children:e.path}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[(0,J.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)}),o(e.id!==`python`&&t.actions.includes(`configure`)&&(0,J.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>{g(e.id),v(``)},className:`text-blue`,children:o(`使用已有安装`)}))]})]})]})]})},e.id)),o(h&&(0,J.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),await r(`configure`,{paths:{[h]:_}})&&(g(null),v(``))},className:`mt-3 rounded-lg bg-bg/70 p-3`,children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(o(h===`dials`?`DIALS 环境目录`:h===`systre`?`Systre JAR 路径(需要已有 Java)`:`${h.toUpperCase()} 可执行文件路径`)),(0,J.jsx)(`input`,{required:!0,value:_,onChange:e=>v(e.target.value),className:`mt-2 w-full rounded-md border border-line bg-panel px-2 py-2 text-sm text-ink`})]}),(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-ink-faint`,children:o(`填写运行 Argus 的电脑上的路径,验证成功后生效。`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{className:dp,disabled:n,children:o(`验证并使用`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>g(null),children:o(`取消`)})]})]})),o(e?.checked&&(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[o(`最近检查 `),o(new Date(e.checked*1e3).toLocaleString()),o(` · 检查不调用模型`)]}))]})]})}function pp(e){return e.installed&&e.enabled&&e.supported?`ready`:e.managed_by_host?!e.supported||e.operation?.status===`failed`?`unavailable`:`preparing`:`manual`}var mp=e=>`正在准备 ${e} 工作台,首次需要几分钟`,hp=e=>`${e} 暂时无法使用`,gp=e=>`flex h-9 min-w-0 flex-1 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`;function _p({plugins:e,compact:t=!1,pending:n,onLaunch:r,onManage:i}){let a=lp(),o=e.filter(e=>pp(e)!==`manual`),s=!e.length||e.some(e=>pp(e)===`manual`);return(0,J.jsxs)(J.Fragment,{children:[o.map(e=>{let o=pp(e),s=!t&&(0,J.jsx)(`button`,{type:`button`,onClick:i,"aria-label":a(`管理 ${e.name}`),title:a(`管理 ${e.name}`),className:`icon-control mr-1 shrink-0 p-1.5 text-ink-faint hover:text-ink`,children:(0,J.jsx)(Xt,{size:15})});if(o===`ready`)return(0,J.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,J.jsxs)(`button`,{type:`button`,disabled:n===e.id,onClick:()=>r(e),title:e.name,"aria-label":e.name,className:`${gp(t)} disabled:opacity-60`,children:[(0,J.jsx)(Yt,{size:17,strokeWidth:1.5,className:`shrink-0 text-blue`}),!t&&(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),!t&&(0,J.jsx)(Vt,{size:13,className:`shrink-0 text-ink-faint`})]}),s]},e.id);let c=o===`preparing`?mp(e.name):hp(e.name),l=o===`preparing`?e.operation?.progress:e.operation?.error||e.reason;return(0,J.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,J.jsxs)(`div`,{role:`status`,title:a(l||c),className:`flex min-w-0 flex-1 items-center text-sm text-ink-faint ${t?`h-9 justify-center`:`gap-2 px-3 py-1.5`}`,children:[o===`preparing`?(0,J.jsx)(an,{size:17,strokeWidth:1.5,className:`shrink-0 animate-spin`}):(0,J.jsx)(Yt,{size:17,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,J.jsxs)(`div`,{className:`min-w-0 leading-snug`,children:[(0,J.jsx)(`p`,{children:a(c)}),l&&(0,J.jsx)(`p`,{className:`mt-0.5 truncate text-xs`,children:a(l)})]})]}),s]},e.id)}),s&&(0,J.jsx)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,children:(0,J.jsxs)(`button`,{type:`button`,onClick:i,title:a(`插件`),"aria-label":a(`插件`),className:gp(t),children:[(0,J.jsx)(q,{size:16,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,J.jsx)(`span`,{children:a(`插件`)})]})})]})}function vp({compact:e=!1}){let t=lp(),{locale:n}=z(),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)([]),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(!1),_=(0,G.useRef)(null),v=a.some(e=>pp(e)===`preparing`),y=a.length>0&&a.every(e=>e.managed_by_host);async function b(e){let n=await fetch(`/api/plugins`,{headers:L(),signal:e});if(!n.ok)throw Error(t(`无法读取插件列表`));let r=await n.json();e?.aborted||o(r.plugins)}(0,G.useEffect)(()=>{r||(m(null),g(!1))},[r]),(0,G.useEffect)(()=>{let e=new AbortController,t=()=>b(e.signal).catch(t=>{!e.signal.aborted&&r&&c(t.message)});r&&(_.current?.focus(),c(``),u(!0)),t().finally(()=>{e.signal.aborted||u(!1)});let n=r||v?window.setInterval(t,r?1500:4e3):0,a=e=>{e.key===`Escape`&&i(!1)};return r&&window.addEventListener(`keydown`,a),()=>{e.abort(),n&&window.clearInterval(n),window.removeEventListener(`keydown`,a)}},[r,v]);async function x(e,n,r){let i=e.setup?.windows_runtime;if(i&&!i.accepted&&[`install`,`update`,`repair`,i.action].includes(n)&&r?.accept_software_license!==!0)return m({pluginId:e.id,action:n}),g(!1),c(``),!1;f(e.id),c(``);try{let i=await fetch(`/api/plugins/${e.id}/${n===`launch`?`launch`:`manage/${n}`}`,{method:`POST`,headers:{...L(),"Content-Type":`application/json`},body:r?JSON.stringify(r):void 0}),a=await i.json();if(!i.ok)throw Error(a.detail||t(`插件操作未完成`));return n===`launch`?window.location.assign(a.url):await b(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{f(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_p,{plugins:a,compact:e,pending:d,onLaunch:e=>void x(e,`launch`),onManage:()=>i(!0)}),r&&(0,up.createPortal)((0,J.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:()=>i(!1),children:(0,J.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`plugin-title`,onClick:e=>e.stopPropagation(),className:`max-h-[85vh] w-full max-w-xl overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`h2`,{id:`plugin-title`,className:`text-lg font-semibold`,children:t(`插件`)}),(0,J.jsx)(`button`,{ref:_,type:`button`,"aria-label":t(`关闭插件列表`),className:`icon-control p-1.5`,onClick:()=>i(!1),children:(0,J.jsx)(Je,{size:18})})]}),(0,J.jsx)(`p`,{className:`mb-6 mt-2 text-sm text-ink-faint`,children:t(t(y?`研究工具由服务方提供,沿用 Argus 的模型与执行后端。`:`按需安装研究工具,沿用 Argus 的模型与执行后端。`))}),t(s&&(0,J.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-ink-dim`,children:t(s)})),t(l&&(0,J.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`正在读取插件…`)})),t(!l&&!a.length&&(0,J.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`暂无可用插件`)})),t(a.map(e=>{let r=e.operation?.status===`running`||d===e.id,i=r||!e.supported,a=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;return(0,J.jsxs)(`article`,{className:`rounded-xl border border-line/70 p-4`,"data-testid":`plugin-${e.id}`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(Yt,{size:24,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:t(e.name)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t(e.installed_version||e.version)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:t(e.description)})]})]}),(0,J.jsxs)(`div`,{className:`mt-4 text-xs text-ink-faint`,children:[t(e.installed?e.enabled?t(`已启用`):t(`已停用`):t(`未安装`)),t(` · 当前后端 `),t(Array.from(new Set(Object.values(e.backends))).join(` / `))]}),t(!e.supported&&(0,J.jsx)(`p`,{className:`mt-3 text-sm text-ink-dim`,children:t(e.reason)})),t(e.operation?.status===`running`&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-sm text-ink-dim`,children:[(0,J.jsx)(an,{size:14,className:`animate-spin`}),t(e.operation.progress)]})),t(e.operation?.status===`failed`&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-ink-dim`,children:t(e.operation.error)})),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[t(!e.installed&&!e.managed_by_host&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`install`),children:[(0,J.jsx)(Ye,{size:14}),t(`安装`)]})),t(e.installed&&e.enabled&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`launch`),children:[t(`打开工作台`),(0,J.jsx)(Vt,{size:14})]})),t(e.installed&&!e.enabled&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`enable`),children:t(`启用`)})),t(e.update_available&&!e.managed_by_host&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`update`),children:[(0,J.jsx)(Ke,{size:14}),e.environment_update?t(`更新科学环境校验`):(0,J.jsxs)(J.Fragment,{children:[t(`更新至 `),t(e.version)]})]})),t(e.installed&&e.enabled&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`disable`),children:t(`停用`)})),t(e.installed&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`uninstall`),children:t(`卸载`)}))]}),p?.pluginId===e.id&&e.setup?.windows_runtime&&(0,J.jsxs)(`form`,{className:`mt-4 rounded-lg bg-bg/70 p-3`,onSubmit:async t=>{t.preventDefault(),!(!h||r)&&await x(e,p.action,{accept_software_license:!0})&&(m(null),g(!1))},children:[(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:t(`继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。`)}),(0,J.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:[t(e.setup.windows_runtime.notice),` `,(0,J.jsx)(`a`,{href:e.setup.windows_runtime.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:t(`官方安装说明 ↗`)})]}),(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`mt-0.5`}),t(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{type:`submit`,className:a,disabled:r||!h,children:t(`同意并继续`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,disabled:r,onClick:()=>{m(null),g(!1)},children:t(`取消`)})]})]}),(0,J.jsx)(`p`,{className:`mt-4 text-xs leading-relaxed text-ink-faint`,children:t(e.installed?t(`原生会话输入 ${e.command||``} 可启用后台工具。卸载保留会话、研究数据和科学软件。`):t(`首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。`))}),t(e.rights_notice&&(0,J.jsx)(`p`,{className:`mt-3 text-[10px] leading-relaxed text-ink-faint`,"data-testid":`plugin-rights-notice`,children:t(n===`zh-CN`&&e.rights_notice_zh||e.rights_notice)})),t(e.installed&&e.setup&&(0,J.jsx)(fp,{health:e.health,setup:e.setup,running:r,platform:e.platform,machine:e.machine,act:(t,n)=>x(e,t,n)}))]},e.id)}))]})}),document.body)]})}var yp=[`all`,`installed`,`available`,`builtin`],bp=[`install`,`update`,`enable`,`disable`,`uninstall`],xp=new Set([`install`,`update`,`uninstall`]),Sp={query:``,kind:`all`,tag:null};function Cp(e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}){return e.VITE_ARGUS_HOSTED_TRIAL===`1`}function wp(e,t){switch(t){case`all`:return!0;case`installed`:return e===`installed`||e===`package`;case`available`:return e===`available`;case`builtin`:return e===`builtin`}}function Tp(e,t){let n=t.trim().toLowerCase();return!n||[e.name,e.purpose,e.purpose_zh??``,...e.routing_path??[],...e.tags,...e.requires].join(` +`).toLowerCase().includes(n)}function Ep(e,t){return e.filter(e=>wp(e.kind,t.kind)&&(!t.tag||e.tags.includes(t.tag))&&(!t.routingPath||(e.routing_path??[]).join(`/`)===t.routingPath||(e.routing_path??[]).join(`/`).startsWith(`${t.routingPath}/`))&&Tp(e,t.query))}function Dp(e){let t=new Set;for(let n of e){let e=n.routing_path??[];for(let n=1;n<=e.length;n++)t.add(e.slice(0,n).join(`/`))}return[...t].sort()}function Op(e){let t=new Set;for(let n of e)for(let e of n.tags)e.trim()&&t.add(e.trim());return[...t].sort((e,t)=>e.localeCompare(t))}function kp(e,t){let n=t||e.managed_by_host;return e.actions.filter(e=>bp.includes(e)&&!(n&&xp.has(e)))}var Ap=e=>`verticals.action.${e}`,jp=e=>`verticals.kind.${e}`,Mp=e=>`verticals.filter.${e}`,Np=e=>`verticals.operation.${e}`;function Pp(e,t){return t===`zh-CN`&&e.purpose_zh&&e.purpose_zh.trim()?e.purpose_zh:e.purpose}function Fp(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function Ip(e){if(!e||e.status!==`running`)return null;let t=Number(e.progress);return!Number.isFinite(t)||t<=0?null:Math.max(0,Math.min(100,Math.round(t)))}var Lp=e=>e.operation?.status===`running`;function Rp(e){return e.some(Lp)}function zp(e,t){return e?t?1500:4e3:t?4e3:0}function Bp(e){if(e instanceof se){if(e.detail)return e.detail;let t=/^[A-Z]+ \S+ → \S+: ([\s\S]+)$/.exec(e.message);return t?t[1]:``}return e instanceof Error?e.message:String(e??``)}function Vp(e){return e instanceof se&&e.status===409}function Hp(e){return e instanceof se&&e.status===404}function Up(e,t){return Array.isArray(e)&&e.includes(t)}function Wp(e){return new Set(e.map(e=>e.name))}var Gp=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`,Kp=e=>`rounded-full border px-2.5 py-0.5 text-xs transition-colors ${e?`border-blue/60 bg-blue/10 text-blue`:`border-line text-ink-dim hover:border-blue/40 hover:text-ink`}`,qp=e=>`rounded px-1.5 py-0.5 text-[10px] font-semibold ${e===`ok`?`bg-ok/10 text-ok`:e===`warn`?`bg-warn/10 text-warn`:e===`blue`?`bg-blue/10 text-blue`:`bg-line text-ink-dim`}`,Jp={install:Ye,update:Ke,enable:mn,disable:pn,uninstall:vn};function Yp(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}catch{return n.toISOString()}}function Xp({compact:e=!1,onOpen:t}){let{t:n}=z();return(0,J.jsxs)(`button`,{type:`button`,onClick:t,title:n(`verticals.entry`),"aria-label":n(`verticals.entry`),"data-testid":`vertical-store-entry`,className:`mx-2 my-1 flex h-9 shrink-0 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`,children:[(0,J.jsx)(_n,{size:17,strokeWidth:1.5}),!e&&(0,J.jsx)(`span`,{children:n(`verticals.entry`)})]})}function Zp({row:e,locale:t,hosted:n,busy:r,failure:i,known:a,onAct:o,onJump:s,onTag:c}){let{t:l}=z(),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),m=Lp(e),h=r||m,g=kp(e,n),_=e.operation,v=Ip(_),y=e=>bp.includes(e)?l(Ap(e)):e,b=_&&bp.includes(_.action)?l(Np(_.action)):l(`verticals.operationRunning`),x=e.kind===`installed`?`ok`:e.kind===`available`?`neutral`:`blue`,S=async(t=!1)=>{d(!1),await o(e,`uninstall`,t?{force:!0}:void 0)};return(0,J.jsxs)(`article`,{id:`vertical-${e.name}`,"data-testid":`vertical-${e.name}`,"data-kind":e.kind,tabIndex:-1,className:`flex flex-col rounded-xl border border-line/70 p-4 outline-none focus-visible:border-blue/60`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(rn,{size:22,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:e.name}),(0,J.jsx)(`span`,{className:qp(x),"data-testid":`vertical-kind`,children:l(jp(e.kind))}),e.kind!==`available`&&(0,J.jsx)(`span`,{className:qp(e.enabled?`ok`:`neutral`),children:e.enabled?l(`verticals.enabled`):l(`verticals.disabledState`)}),e.update_available&&(0,J.jsx)(`span`,{className:qp(`warn`),"data-testid":`vertical-update`,children:l(`verticals.updateAvailable`)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:Pp(e,t)}),e.routing_path?.length?(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:e.routing_path.join(` / `)}):null]})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-ink-faint`,children:[e.installed_version&&(0,J.jsx)(`span`,{children:l(`verticals.installedVersion`,{version:e.installed_version})}),e.version&&e.version!==e.installed_version&&(0,J.jsx)(`span`,{children:l(`verticals.catalogVersion`,{version:e.version})}),e.size_bytes!=null&&(0,J.jsxs)(`span`,{children:[l(`verticals.size`),` `,Fp(e.size_bytes)]})]}),e.requires.length>0&&(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.requires`)}),e.requires.map(e=>a.has(e)&&s?(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e),"aria-label":l(`verticals.jumpTo`,{name:e}),title:l(`verticals.jumpTo`,{name:e}),className:`rounded-full border border-line px-2 py-0.5 font-mono text-ink-dim transition-colors hover:border-blue/60 hover:text-blue`,children:e},e):(0,J.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.shared.length>0&&(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.shared`)}),e.shared.map(e=>(0,J.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.tags.length>0&&(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.tags.map(e=>c?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint transition-colors hover:text-blue`,children:[`#`,e]},e):(0,J.jsxs)(`span`,{className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint`,children:[`#`,e]},e))}),e.missing_python.length>0&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-start gap-2 rounded-lg bg-warn/10 p-2.5 text-xs leading-relaxed text-warn`,"data-testid":`vertical-missing-python`,children:[(0,J.jsx)(yn,{size:14,className:`mt-0.5 shrink-0`}),(0,J.jsx)(`span`,{children:l(`verticals.missingPython`,{packages:e.missing_python.join(`, `)})})]}),!!e.runtime_issues?.length&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-runtime-issues`,children:l(`verticals.runtimeIssues`,{issues:e.runtime_issues.join(`; `)})}),!!e.install_issues?.length&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-install-issues`,children:l(`verticals.installIssues`,{issues:e.install_issues.join(`; `)})}),e.used_by.length>0&&(0,J.jsxs)(`div`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:()=>p(e=>!e),className:`inline-flex items-center gap-1 transition-colors hover:text-ink`,"data-testid":`vertical-used-by`,children:[e.used_by.length===1?l(`verticals.usedByOne`):l(`verticals.usedBy`,{count:e.used_by.length}),f?(0,J.jsx)(Wt,{size:12}):(0,J.jsx)(Ue,{size:12})]}),f&&(0,J.jsx)(`ul`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono`,children:e.used_by.map(e=>(0,J.jsx)(`li`,{className:`rounded bg-bg px-1.5 py-0.5`,children:e},e))})]}),m&&_&&(0,J.jsxs)(`div`,{className:`mt-3`,"data-testid":`vertical-progress`,children:[(0,J.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-ink-dim`,children:[(0,J.jsx)(an,{size:14,className:`animate-spin`}),(0,J.jsx)(`span`,{children:b}),v!=null&&(0,J.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-ink-faint`,children:[v,`%`]})]}),(0,J.jsx)(`div`,{role:`progressbar`,"aria-label":b,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":v??void 0,className:`mt-1.5 h-1 overflow-hidden rounded bg-line`,children:v==null?(0,J.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`}):(0,J.jsx)(`div`,{className:`h-full rounded bg-blue transition-[width] duration-500`,style:{width:`${v}%`}})}),_.message&&(0,J.jsx)(`p`,{className:`mt-1 break-words text-xs text-ink-faint`,children:_.message})]}),_?.status===`failed`&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-err`,"data-testid":`vertical-operation-failed`,children:[l(`verticals.operationFailed`,{action:y(_.action)}),_.message?` — ${_.message}`:``]}),i&&(0,J.jsxs)(`div`,{role:`alert`,className:`mt-3 rounded-lg border border-err/30 bg-err/5 p-2.5 text-sm text-ink-dim`,"data-testid":`vertical-failure`,children:[(0,J.jsx)(`p`,{className:`break-words`,children:i.text}),i.offerForce&&(0,J.jsxs)(`button`,{type:`button`,className:`${Gp} mt-2 border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(!0),children:[(0,J.jsx)(vn,{size:14}),l(`verticals.removeAnyway`)]})]}),g.length>0&&(0,J.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:g.map(t=>{let n=Jp[t];if(t===`uninstall`)return u?(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`${Gp} border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(),"data-testid":`vertical-confirm-uninstall`,children:[(0,J.jsx)(vn,{size:14}),l(`verticals.confirmUninstall`)]}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint hover:text-ink`,onClick:()=>d(!1),children:l(`common.cancel`)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:l(`verticals.confirmUninstallHint`,{name:e.name})})]},t):(0,J.jsxs)(`button`,{type:`button`,className:Gp,disabled:h,onClick:()=>d(!0),"data-action":t,children:[(0,J.jsx)(n,{size:14}),l(Ap(t))]},t);let r=t===`update`&&e.version?l(`verticals.updateTo`,{version:e.version}):l(Ap(t));return(0,J.jsxs)(`button`,{type:`button`,className:Gp,disabled:h,onClick:()=>void o(e,t),"data-action":t,children:[(0,J.jsx)(n,{size:14}),r]},t)})})]})}function Qp({payload:e,filter:t,onFilter:n,hosted:r,supported:i,loading:a,refreshing:o,error:s,pending:c,failures:l,onAct:u,onRefresh:d,onJump:f}){let{t:p,locale:m}=z(),h=e?.verticals??[],g=(0,G.useMemo)(()=>Op(h),[h]),_=(0,G.useMemo)(()=>Dp(h),[h]),v=(0,G.useMemo)(()=>Wp(h),[h]),y=(0,G.useMemo)(()=>Ep(h,t),[h,t]),b=t.query.trim()!==``||t.kind!==`all`||t.tag!==null||!!t.routingPath,x=e?.catalog;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:p(r?`verticals.hostedNote`:`verticals.intro`)}),i===!1&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-4 rounded-lg border border-line bg-bg/70 p-3 text-sm text-ink-dim`,"data-testid":`vertical-store-too-old`,children:p(`verticals.tooOld`)}),i!==!1&&(0,J.jsxs)(J.Fragment,{children:[x&&(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-faint`,"data-testid":`vertical-catalog`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,title:x.source,children:p(`verticals.catalogSource`,{source:x.source})}),x.release_tag&&(0,J.jsx)(`span`,{className:`rounded bg-bg px-1.5 py-0.5 font-mono`,children:p(`verticals.catalogRelease`,{tag:x.release_tag})}),(0,J.jsx)(`span`,{children:x.fetched_at?p(`verticals.catalogFetched`,{time:Yp(x.fetched_at,m)}):p(`verticals.catalogNever`)}),(0,J.jsxs)(`button`,{type:`button`,className:`${Gp} ml-auto`,disabled:o||a,onClick:d,"data-testid":`vertical-refresh-catalog`,children:[(0,J.jsx)(Ke,{size:14,className:o?`animate-spin`:``}),p(o?`verticals.refreshing`:`verticals.refreshCatalog`)]})]}),x?.error&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 rounded-lg border border-warn/40 bg-warn/10 p-2.5 text-sm text-warn`,"data-testid":`vertical-catalog-error`,children:p(`verticals.catalogError`,{error:x.error})}),s&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-err`,"data-testid":`vertical-store-error`,children:s}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-line bg-bg px-2.5 focus-within:border-blue/60`,children:[(0,J.jsx)(ot,{size:14,className:`shrink-0 text-ink-faint`}),(0,J.jsx)(`span`,{className:`sr-only`,children:p(`verticals.search`)}),(0,J.jsx)(`input`,{type:`search`,value:t.query,onChange:e=>n({...t,query:e.target.value}),placeholder:p(`verticals.searchPlaceholder`),className:`min-w-0 flex-1 bg-transparent text-sm text-ink outline-none placeholder:text-ink-faint`})]}),(0,J.jsx)(`div`,{role:`group`,"aria-label":p(`verticals.kindFilter`),className:`flex flex-wrap gap-1`,children:yp.map(e=>(0,J.jsx)(`button`,{type:`button`,"aria-pressed":t.kind===e,onClick:()=>n({...t,kind:e}),className:`h-8 rounded-md px-2.5 text-xs font-medium transition-colors ${t.kind===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:p(Mp(e))},e))})]}),_.length>0&&(0,J.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink-faint`,children:[p(`verticals.routingPath`),(0,J.jsxs)(`select`,{className:`rounded-md border border-line bg-bg p-1.5`,value:t.routingPath??``,onChange:e=>n({...t,routingPath:e.target.value}),children:[(0,J.jsx)(`option`,{value:``,children:p(`verticals.filter.all`)}),_.map(e=>(0,J.jsx)(`option`,{value:e,children:e.replaceAll(`/`,` / `)},e))]})]}),(g.length>0||b)&&(0,J.jsxs)(`div`,{role:`group`,"aria-label":p(`verticals.tagFilter`),className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[g.map(e=>(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":t.tag===e,className:Kp(t.tag===e),onClick:()=>n({...t,tag:t.tag===e?null:e}),children:[`#`,e]},e)),b&&(0,J.jsx)(`button`,{type:`button`,className:`ml-1 text-xs text-ink-faint hover:text-ink`,onClick:()=>n(Sp),children:p(`verticals.clearFilters`)})]}),h.length>0&&(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`verticals.count`,{shown:y.length,total:h.length})}),a&&!e&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.loading`)}),e&&h.length===0&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.none`)}),h.length>0&&y.length===0&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.noMatches`)}),y.length>0&&(0,J.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,"data-testid":`vertical-grid`,children:y.map(e=>(0,J.jsx)(Zp,{row:e,locale:m,hosted:r,busy:c===e.name,failure:l[e.name],known:v,onAct:u,onJump:f,onTag:e=>n({...t,tag:e})},e.name))})]})]})}function $p({open:e,onClose:t}){let{t:n}=z(),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)({}),[_,v]=(0,G.useState)(Sp),y=(0,G.useRef)(null),b=(0,G.useRef)(t);b.current=t;let x=(0,G.useRef)(n);x.current=n;let S=Rp(r?.verticals??[]),C=!!r?.host.managed_by_host||Cp();(0,G.useEffect)(()=>{if(!e||a!==null)return;let t=!1;return R.meta().then(e=>{t||o(Up(e.capabilities,le))},()=>{t||o(!0)}),()=>{t=!0}},[e,a]),(0,G.useEffect)(()=>{if(a!==!0||!e&&!S)return;let t=new AbortController,n=()=>R.verticals(t.signal).then(e=>{t.signal.aborted||(i(e),f(e=>e?.source===`load`?null:e))},n=>{t.signal.aborted||(Hp(n)?o(!1):e&&f({text:x.current(`verticals.loadFailed`),source:`load`}))});e&&c(!0),n().finally(()=>{t.signal.aborted||c(!1)});let r=zp(e,S),s=r?window.setInterval(n,r):0;return()=>{t.abort(),s&&window.clearInterval(s)}},[e,S,a]),(0,G.useEffect)(()=>{if(!e){g({}),f(e=>e?.source===`refresh`?null:e);return}y.current?.focus();let t=e=>{e.key===`Escape`&&b.current()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let w=(0,G.useCallback)(async()=>{try{i(await R.verticals()),f(e=>e?.source===`load`?null:e)}catch(e){Hp(e)?o(!1):f({text:x.current(`verticals.loadFailed`),source:`load`})}},[]),T=(0,G.useCallback)(async(e,t,n={})=>{m(e.name),g(t=>{let{[e.name]:n,...r}=t;return r});try{return await R.manageVertical(e.name,t,n),await w(),!0}catch(r){let i=Bp(r)||x.current(`verticals.actionFailed`),a=t===`uninstall`&&Vp(r)&&!n.force;return g(t=>({...t,[e.name]:{text:i,offerForce:a}})),!1}finally{m(null)}},[w]),E=(0,G.useCallback)(async()=>{u(!0),f(null);try{i(await R.refreshVerticalCatalog())}catch(e){f({text:Bp(e)||x.current(`verticals.loadFailed`),source:`refresh`})}finally{u(!1)}},[]),D=(0,G.useCallback)(e=>{v(Sp),!(typeof document>`u`)&&window.setTimeout(()=>{let t=document.getElementById(`vertical-${e}`);t?.scrollIntoView?.({block:`nearest`,behavior:`smooth`}),t?.focus?.()},0)},[]);return e?(0,up.createPortal)((0,J.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:t,children:(0,J.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`vertical-store-title`,onClick:e=>e.stopPropagation(),className:`flex max-h-[85vh] w-full max-w-4xl flex-col overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl scroll-thin`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`h2`,{id:`vertical-store-title`,className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,J.jsx)(_n,{size:20,strokeWidth:1.5,className:`text-blue`}),n(`verticals.title`)]}),(0,J.jsx)(`button`,{ref:y,type:`button`,"aria-label":n(`verticals.close`),className:`icon-control p-1.5`,onClick:t,children:(0,J.jsx)(Je,{size:18})})]}),(0,J.jsx)(Qp,{payload:r,filter:_,onFilter:v,hosted:C,supported:a,loading:s,refreshing:l,error:d?.text??``,pending:p,failures:h,onAct:T,onRefresh:()=>void E(),onJump:D})]})}),document.body):null}function em(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)||e}function tm(e,t,n){if(e.length===0)return`local`;let r=n.trim(),i=r?e.filter(e=>e.launch_cwd?.trim()===r):[];return i.length===0||t&&!i.some(e=>e.id===t)?`all`:`local`}function nm({projects:e,activeId:t,activeWork:n,localCwd:r,onSelect:i,onPrefetch:a,onManage:s,onResume:c,resumingId:l,onOpenPanel:u,onOpenLearning:d,onOpenVerticals:f,onNew:p,loading:m,creating:h=!1,error:g,onRetry:y,mobileOpen:x=!1,collapsed:T=!1,onToggleCollapse:E,themeMode:O,onCycleTheme:k}){let{t:A,locale:j}=z(),[M,ee]=(0,G.useState)(`local`),N=(0,G.useRef)(!1),[P,F]=(0,G.useState)(``),[te,ne]=(0,G.useState)(()=>new Set),re=T&&!x,ie=r.trim(),I=(0,G.useMemo)(()=>ie?e.filter(e=>e.launch_cwd?.trim()===ie):[],[ie,e]);(0,G.useEffect)(()=>{N.current||m||e.length===0||(N.current=!0,ee(tm(e,t,ie)))},[t,m,ie,e]);let L=M===`local`?I:e,ae=P.trim()?ef(L,P):L,oe=(0,G.useMemo)(()=>{if(M===`local`)return ae.length>0?[[ie||`Local`,ae]]:[];let e=new Map;return ae.forEach(t=>{let n=t.launch_cwd?.trim()||A(`common.unassigned`),r=e.get(n)??[];r.push(t),e.set(n,r)}),[...e.entries()]},[ie,M,ae]),se=e=>te.has(e)&&!P.trim();return(0,J.jsxs)(rt,{mobileOpen:x,collapsed:T,children:[(0,J.jsx)(`div`,{className:`chrome-seam-surface flex h-12 shrink-0 items-center border-b border-line/50 ${re?`justify-center`:`justify-between px-4`}`,children:re?(0,J.jsx)(jt,{size:22,compact:!0}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(jt,{size:24}),(0,J.jsx)(`button`,{type:`button`,onClick:E,"aria-label":A(`sidebar.collapse`),title:`${A(`sidebar.collapse`)} · Ctrl/⌘ B`,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,J.jsx)(o,{icon:C,className:`h-3.5 w-3.5`})})]})}),re?(0,J.jsx)(`div`,{className:`flex h-12 shrink-0 items-center justify-center`,children:(0,J.jsx)(`button`,{type:`button`,onClick:E,"aria-label":A(`sidebar.expand`),title:`${A(`sidebar.expand`)} · Ctrl/⌘ B`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink`,children:(0,J.jsx)(o,{icon:v,className:`h-3.5 w-3.5`})})}):null,re?(0,J.jsx)(vp,{compact:!0}):null,re&&f?(0,J.jsx)(Xp,{compact:!0,onOpen:f}):null,re&&d?(0,J.jsx)(pr,{onOpen:d,compact:!0}):null,re?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`nav`,{"aria-label":j===`zh-CN`?`工具与知识`:`Tools and knowledge`,"data-sidebar-resources":!0,className:`shrink-0 overflow-y-auto overscroll-contain border-b border-line/50 px-2 py-2 scroll-thin [&>section]:mx-2 [&>section]:border-0 [&>section]:py-0 [&>section>div>button:first-child]:px-3`,style:{maxHeight:`min(40dvh, 360px)`},children:[(0,J.jsx)(vp,{}),d&&(0,J.jsx)(pr,{onOpen:d}),(0,J.jsxs)(`details`,{className:`sidebar-tools mx-2 mt-1`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer px-2 py-2 text-xs text-ink-dim`,children:j===`zh-CN`?`更多工具与资源`:`More tools and resources`}),f?(0,J.jsx)(Xp,{onOpen:f}):null,null]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pb-1 pt-3`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:j===`zh-CN`?`项目`:`Projects`}),I.length>0&&I.lengthee(e.target.value),className:`min-w-0 bg-transparent text-xs text-ink-faint`,children:[(0,J.jsx)(`option`,{value:`local`,children:A(`common.local`)}),(0,J.jsx)(`option`,{value:`all`,children:A(`common.all`)})]}):null,(0,J.jsx)(`button`,{type:`button`,onClick:p,disabled:h,"aria-label":A(`sidebar.create`),title:A(`sidebar.create`),className:`ml-auto flex h-8 items-center justify-center rounded-md px-2 text-xs text-ink-dim hover:bg-bg disabled:opacity-40`,children:h?`…`:j===`zh-CN`?`+ 新建`:`+ New`})]}),(0,J.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,J.jsx)(`label`,{className:`sr-only`,htmlFor:`daemon-search`,children:A(`sidebar.find`)}),(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-line/60 bg-bg/60 px-2 focus-within:border-blue/60`,children:[(0,J.jsx)(`input`,{id:`daemon-search`,value:P,onChange:e=>F(e.target.value),placeholder:A(`sidebar.find`),className:`h-8 min-w-0 flex-1 bg-transparent text-xs text-ink outline-none placeholder:text-ink-faint`}),P?(0,J.jsx)(`button`,{type:`button`,"aria-label":A(`sidebar.clearSearch`),onClick:()=>F(``),className:`px-1 text-sm text-ink-faint hover:text-ink`,children:`×`}):null]})]}),(0,J.jsxs)(`div`,{className:`mobile-scroll-region min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-3 pb-3 scroll-thin`,children:[m&&e.length===0?(0,J.jsx)(`div`,{className:`px-1 py-3 text-xs text-ink-faint`,children:A(`common.loading`)}):null,g?(0,J.jsx)(`button`,{type:`button`,onClick:y,className:`mb-2 w-full rounded-md bg-err/5 px-3 py-2 text-left text-xs text-err`,children:A(`sidebar.refreshFailed`)}):null,!m&&!g&&ae.length===0?(0,J.jsxs)(`div`,{className:`px-1 py-4 text-xs text-ink-faint`,children:[(0,J.jsx)(`div`,{children:P.trim()?A(`sidebar.noMatches`,{query:P.trim()}):A(`sidebar.noSessions`)}),P.trim()?(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(``),className:`mt-2 text-xs text-ink-dim underline underline-offset-2 hover:text-ink`,children:A(`sidebar.clearSearch`)}):null]}):null,oe.map(([e,r])=>(0,J.jsxs)(`section`,{className:`mb-1 last:mb-0`,children:[r.length>1&&oe.length>1?(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":!se(e),title:e,onClick:()=>ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),className:`mb-1 flex h-7 w-full items-center gap-2 rounded-md px-1.5 text-left text-[11px] font-medium text-ink-faint hover:bg-bg/70 hover:text-ink-dim`,children:[(0,J.jsx)(o,{icon:S,className:`h-2.5 w-2.5 transition-transform ${se(e)?`-rotate-90`:``}`}),(0,J.jsx)(o,{icon:b,className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:em(e)})]}):null,r.length===1||oe.length===1||!se(e)?r.map(e=>{let r=e.id===t,u=r&&n?.sessionId===e.id?n:void 0,d=u?pi(u.status,j,u.connected):void 0,f=Jd(e),p=f?(e.label||e.display_name||``).trim():e.objective.trim()||A(`sidebar.unnamedSession`),m=e.daemon_alive&&e.daemon_protocol_compatible===!1,h=m&&e.daemon_protocol_error===`daemon release is incompatible with WebAPI release`,g=m&&!h,_=!e.daemon_alive&&e.last_active>0&&!!e.workdir?.trim();return(0,J.jsxs)(`div`,{"data-active":r?`true`:`false`,onPointerEnter:()=>{r||a?.(e.id)},className:`session-card group relative mb-0.5 h-14 w-full rounded-md transition-colors duration-150 ease-panel ${r?`text-ink`:`text-ink-dim hover:text-ink`}`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`absolute left-0 transition-colors ${r?`inset-y-1 w-px bg-blue`:`inset-y-2 w-px bg-transparent group-hover:bg-ink-faint/30`}`}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),onFocus:()=>{r||a?.(e.id)},"aria-current":r?`page`:void 0,title:`${p}${!f&&p!==e.id?` · ${e.id}`:``}${e.objective&&e.objective!==p?` — ${e.objective}`:``}`,className:`flex h-14 w-full min-w-0 flex-col justify-center px-2.5 text-left ${_?`pr-[4.75rem]`:`pr-10`}`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(ct,{ok:e.daemon_alive&&!g,title:g?A(`sidebar.updateRequired`):e.daemon_alive?A(`sidebar.daemonAlive`):A(`sidebar.stopped`)}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:p})]}),(0,J.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5 pl-3.5 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate ${g?`text-warn`:``}`,title:d,"data-session-work-state":u?.status.state,children:g?A(`sidebar.updateRequired`):d??(e.daemon_alive?A(`sidebar.runningFor`,{uptime:St(e.uptime_seconds)}):e.last_active>0?A(`sidebar.lastActive`,{time:wt(e.last_active,j)}):A(`sidebar.stopped`))}),h&&(0,J.jsx)(`span`,{title:A(`sidebar.updateAvailableHint`),className:`shrink-0 rounded border border-line px-1 text-[10px] leading-4`,children:A(`sidebar.updateAvailable`)})]})]}),_&&c?(0,J.jsx)(`button`,{type:`button`,disabled:l!=null,onClick:t=>{t.stopPropagation(),c(e.id)},"aria-label":A(`sidebar.resume`),title:A(`sidebar.resumeHint`,{workdir:e.workdir??``}),className:`absolute right-9 top-3 flex h-8 w-8 items-center justify-center rounded-md text-blue opacity-100 hover:bg-blue/10 disabled:opacity-40 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:l===e.id?`…`:(0,J.jsx)(o,{icon:D,className:`h-3 w-3`})}):null,(0,J.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),s(e.id)},"aria-label":A(`sidebar.manage`,{name:p}),title:A(`sidebar.manageHint`),className:`absolute right-1 top-3 flex h-8 w-8 items-center justify-center rounded-md text-ink-faint opacity-100 transition-opacity hover:bg-panel-raised hover:text-ink sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,J.jsx)(o,{icon:w,className:`h-4 w-4`})})]},e.id)}):null]},e))]}),(0,J.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between border-t border-line/50 px-4 py-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`config`),className:`icon-control flex h-8 w-8 items-center justify-center`,"aria-label":A(`sidebar.openSettings`),title:A(`common.settings`),children:(0,J.jsx)(o,{icon:_,className:`h-3.5 w-3.5`})}),(0,J.jsx)(pt,{themeMode:O,onCycleTheme:k})]})]})]})}var rm=new Set([`done`,`completed`,`failed`,`skipped`]);function im(e){return rm.has(e.status)}function am(e,t){return e.filter(e=>im(e)===t)}var om={in_progress:`rgb(var(--blue))`,running:`rgb(var(--blue))`,pending:`rgb(var(--ink-faint))`,queued:`rgb(var(--ink-faint))`,done:`rgb(var(--blue))`,completed:`rgb(var(--blue))`,blocked:`rgb(var(--err))`,failed:`rgb(var(--err))`};function sm({items:e,onDispose:t,onStop:n,onInspect:r,busy:i,readOnly:a=!1}){let{t:o}=z(),[s,c]=(0,G.useState)(!1),l=am(e,!1),u=am(e,!0),d=s?u:l;return(0,J.jsxs)(`section`,{className:`card flex flex-col ${d.length>0?`min-h-0 flex-1`:`shrink-0`}`,children:[(0,J.jsx)(U,{title:o(`panel.backlog`),right:(0,J.jsx)(`button`,{className:`text-[10px] text-ink-faint transition-colors hover:text-ink`,onClick:()=>c(e=>!e),children:o(s?`backlog.active`:`backlog.history`,{count:s?l.length:u.length})})}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[d.length===0&&(0,J.jsx)($e,{children:o(s?`backlog.noHistory`:`backlog.empty`)}),d.map(e=>{let s=om[e.status]??`rgb(var(--ink-faint))`,c=e.iterate;return(0,J.jsx)(`div`,{className:`group border-b border-line/60 px-3 py-2 last:border-0`,children:(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>r?.(e.id),disabled:!r,className:`block max-w-full truncate text-left text-xs font-medium text-ink enabled:hover:text-blue-sky enabled:focus-visible:outline-none enabled:focus-visible:underline`,title:r?o(`backlog.viewDetails`):void 0,children:e.title||e.objective}),(0,J.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[(0,J.jsx)(at,{color:s,children:Rn(e.status,o)}),typeof e.priority==`number`&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:Bn(e.priority,o)}),c&&(0,J.jsxs)(`span`,{className:`text-[10px] text-blue-sky`,children:[`↻ `,o(`backlog.iterating`)]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100`,children:[!a&&c&&(0,J.jsx)(W,{variant:`ghost`,onClick:()=>n(e.id),disabled:i,title:o(`backlog.stopIterating`),children:o(`backlog.stop`)}),!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(W,{variant:`ghost`,onClick:()=>t(e.id,`done`),disabled:i,title:o(`backlog.markDone`),children:`✓`}),(0,J.jsx)(W,{variant:`ghost`,onClick:()=>t(e.id,`rm`),disabled:i,title:o(`backlog.remove`),children:`✕`})]})]})]})},e.id)})]})]})}var cm={win:`rgb(var(--blue))`,milestone:`rgb(var(--blue))`,insight:`rgb(var(--ink-dim))`,decision:`rgb(var(--ink-dim))`,failure:`rgb(var(--err))`,note:`rgb(var(--ink-faint))`};function lm({entries:e}){let{t}=z(),n=[...e].reverse();return(0,J.jsxs)(`section`,{className:`card flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(U,{title:t(`panel.journal`),right:(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.length})}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[e.length===0&&(0,J.jsx)($e,{children:`no journal entries yet`}),n.map(e=>{let t=cm[e.kind]??`rgb(var(--ink-faint))`,n=String(e.extra?.pricing_status??``),r=e.extra&&Object.prototype.hasOwnProperty.call(e.extra,`cost_usd`)?e.extra.cost_usd:e.cost_usd,i=typeof r==`number`&&r>0?`${bt(r)}${n===`partial`||n===`unpriced`?`+`:``}`:n===`partial`||n===`unpriced`?n:``;return(0,J.jsxs)(`div`,{className:`border-b border-line/60 px-3 py-2 last:border-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full`,style:{background:t}}),(0,J.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide`,style:{color:t},children:e.kind}),(0,J.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:Dt(e.ts)})]}),(0,J.jsx)(`div`,{className:`mt-1 text-xs font-medium text-ink`,children:e.title}),e.summary&&(0,J.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-snug text-ink-dim`,children:e.summary}),(0,J.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(e.tags??[]).slice(0,4).map(e=>(0,J.jsx)(`span`,{className:`rounded bg-line/60 px-1 text-[9px] text-ink-faint`,children:e},e)),i?(0,J.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:i}):null]})]},e.id)})]})]})}function um(e){return e==null?``:e<3?`now`:e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h`}function dm({roles:e}){let{t}=z(),n=new Map(e.map(e=>[e.role,e])),r=et.map(e=>n.get(e)).filter(Boolean),i=e.filter(e=>!gt(e.role)),a=[...r,...i];return(0,J.jsxs)(`section`,{className:`card`,children:[(0,J.jsx)(U,{title:t(`panel.roles`)}),(0,J.jsx)(`div`,{children:a.map(e=>{let n=B.role[e.role]??B.info;return(0,J.jsxs)(`div`,{className:`grid grid-cols-[84px_minmax(0,1fr)_auto] items-center gap-2 border-b border-line/60 px-3 py-2 last:border-b-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{"data-role-dot":e.role,"aria-hidden":`true`,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{background:n}}),(0,J.jsx)(`span`,{className:`text-[11px] font-medium capitalize`,style:{color:e.active?n:B.inkDim},children:gt(e.role)?Ve(e.role,t):e.role})]}),(0,J.jsx)(`div`,{className:`min-w-0 truncate font-mono text-[10px] text-ink-faint`,title:e.model,children:e.model||`—`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 text-right`,children:[(0,J.jsx)(`span`,{className:`text-[10px]`,style:{color:e.active?B.ink:B.inkFaint},children:e.active?e.status||`active`:`idle`}),e.active&&um(e.age_s)&&(0,J.jsxs)(`span`,{className:`text-[10px] tabular-nums text-ink-faint`,children:[`· `,um(e.age_s)]}),e.effort&&(0,J.jsxs)(`span`,{className:`text-[10px]`,style:{color:Ze(e.effort)},children:[`· `,e.effort]})]})]},e.role)})})]})}function fm({open:e,snap:t,journal:n,busy:r,onClose:i,onDispose:a,onStop:o,onInspect:s}){let{t:c}=z();return(0,J.jsxs)(dt,{open:e,onClose:i,label:`Project inspector`,width:`max-w-6xl`,children:[(0,J.jsx)(lt,{title:c(`panel.project`),sub:t.session.display_name||t.session.id}),(0,J.jsxs)(`div`,{className:`h-[68vh] min-h-0 space-y-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid lg:grid-cols-[minmax(0,1.4fr)_minmax(300px,0.8fr)] lg:gap-3 lg:space-y-0 lg:overflow-hidden`,children:[(0,J.jsx)(sm,{items:t.backlog,onDispose:a,onStop:o,onInspect:s,busy:r}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,J.jsx)(dm,{roles:t.roles}),(0,J.jsx)(lm,{entries:n})]})]})]})}var pm=e=>e?new Date(e*1e3).toLocaleString():`—`;function mm({label:e,value:t}){return(0,J.jsxs)(`div`,{className:`rounded-md border border-line/70 bg-bg/40 px-3 py-2`,children:[(0,J.jsx)(`div`,{className:`text-[9px] font-semibold uppercase tracking-wider text-ink-faint`,children:e}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:t})]})}function hm({sid:e,itemId:t,onClose:n,onDone:r,onSkip:i,onStop:a,busy:o,readOnly:s=!1}){let{t:c}=z(),l=ke(e,t),u=l.data,d=u?im(u):!1,f=Vn(u?.outcome,c);return(0,J.jsxs)(dt,{open:!!t,onClose:n,label:c(`task.details`),width:`max-w-3xl`,showClose:!1,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 border-b border-line px-4 py-3 sm:flex-nowrap sm:px-5`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink`,children:u?.title||c(`task.details`)}),u?(0,J.jsx)(at,{children:Rn(u.status,c)}):null]})}),!s&&u&&!d?(0,J.jsxs)(`div`,{className:`order-3 flex w-full shrink-0 items-center justify-end gap-1 sm:order-none sm:w-auto`,children:[u.iterate?(0,J.jsx)(W,{onClick:()=>a(u.id),disabled:o,children:c(`task.stopLoop`)}):null,(0,J.jsx)(W,{onClick:()=>r(u.id),disabled:o,children:c(`task.done`)}),(0,J.jsx)(W,{variant:`danger`,onClick:()=>i(u.id),disabled:o,children:c(`task.skip`)})]}):null,(0,J.jsx)(`button`,{type:`button`,"aria-label":c(`task.close`),onClick:n,className:`order-2 rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink sm:order-none`,children:`×`})]}),(0,J.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto p-4 scroll-thin sm:p-5`,children:[l.isLoading?(0,J.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,J.jsx)(tt,{})}):null,l.isError?(0,J.jsx)(`div`,{className:`rounded-md border border-err/40 bg-err/5 p-3 text-xs text-err`,children:l.error.message}):null,u?(0,J.jsxs)(`div`,{className:`space-y-4`,children:[u.pending_question?(0,J.jsxs)(`div`,{className:`rounded-lg border border-warn/40 bg-warn/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-warn`,children:c(`task.waitingOnYou`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:u.pending_question})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.objective`)}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap rounded-lg border border-line bg-bg/50 p-3 text-sm leading-relaxed text-ink-dim`,children:u.objective||u.original_objective||c(`task.noObjective`)})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[(0,J.jsx)(mm,{label:c(`task.priority`),value:Bn(u.priority,c)}),(0,J.jsx)(mm,{label:c(`task.started`),value:pm(u.started_ts)}),(0,J.jsx)(mm,{label:c(`task.finished`),value:pm(u.finished_ts)})]}),f.length?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.outcome`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,J.jsx)(at,{children:e},e))})]}):null,u.iterate||u.iteration_cycles_done||u.iteration_cost_usd?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.iteration`)}),(0,J.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,J.jsx)(mm,{label:c(`task.mode`),value:u.iterate?c(`task.autoIterate`):c(`task.singlePass`)}),(0,J.jsx)(mm,{label:c(`task.cycles`),value:`${u.iteration_cycles_done??0}/${u.iteration_max_cycles??`—`}`}),(0,J.jsx)(mm,{label:c(`task.cost`),value:`$${(u.iteration_cost_usd??0).toFixed(2)}`})]})]}):null,u.last_error?(0,J.jsxs)(`section`,{className:`rounded-lg border border-err/30 bg-err/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:c(`task.lastError`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs leading-relaxed text-ink-dim`,children:u.last_error})]}):null,u.notes?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.notes`)}),(0,J.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-relaxed text-ink-dim`,children:u.notes})]}):null,u.tags?.length||u.deps?.length?(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(u.tags??[]).map(e=>(0,J.jsxs)(at,{children:[`#`,e]},`tag-${e}`)),u.deps?.length?(0,J.jsx)(at,{children:c(`task.dependsOnCount`,{count:u.deps.length})}):null]}):null]}):null]})]})}function gm({onPointerDown:e,onReset:t,onNudge:n,value:r,min:i=240,max:a=600,label:o=`Resize panel`}){return(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":o,"aria-valuenow":r,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:e,onDoubleClick:t,onKeyDown:e=>{e.key===`ArrowLeft`?(e.preventDefault(),n(-16)):e.key===`ArrowRight`?(e.preventDefault(),n(16)):e.key===`Home`&&(e.preventDefault(),t())},className:`group relative hidden w-2 shrink-0 cursor-col-resize items-center justify-center outline-none lg:flex`,children:(0,J.jsx)(`span`,{className:`h-full w-px bg-line/30 transition-colors duration-150 group-hover:bg-blue/70 group-focus:bg-blue/70`})})}function _m({sid:e,record:t,expanded:n=!1,zh:r}){let[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(``);(0,G.useEffect)(()=>{if(!i||!e)return;let n=new AbortController;return l(!0),d(``),R.workRecord(e,t.role,t.id,n.signal).then(e=>{n.signal.aborted||s(e.detail)}).catch(e=>{n.signal.aborted||d(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||l(!1)}),()=>n.abort()},[i,e,t.id,t.role,t.detail]);let f=o.length>=t.detail.length?o:t.detail;return(0,J.jsxs)(`details`,{open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,J.jsxs)(`summary`,{children:[(0,J.jsx)(`span`,{children:i?r?`收起详情`:`Hide details`:r?`展开完整记录`:`Read full record`}),(0,J.jsx)(Ue,{size:12})]}),(0,J.jsxs)(J.Fragment,{children:[c&&(0,J.jsx)(`small`,{role:`status`,children:r?`正在读取完整记录…`:`Loading the full record…`}),u&&(0,J.jsx)(`small`,{role:`status`,children:r?`暂未读取到完整记录,已显示保存的摘要。可收起后重试。`:`Full record unavailable; the saved preview is shown. Reopen to retry.`}),(0,J.jsx)(`div`,{className:`agent-record-actions`,children:(0,J.jsx)(Qe,{text:f,label:r?`复制完整记录`:`Copy full record`,copiedLabel:r?`已复制`:`Copied`})}),(0,J.jsx)(`div`,{className:`agent-record-detail`,children:(0,J.jsx)(H,{children:f})}),t.round_index!=null&&(0,J.jsx)(`small`,{children:r?`第 ${t.round_index} 轮`:`Round ${t.round_index}`})]})]})}function vm({sid:e,view:t,roles:n=[],events:r=[],taskId:i,paused:a=!1,selectedRole:o,onSelectRole:s,onClose:c,showTabs:l=!0}){let{locale:u,t:d}=z(),f=u===`zh-CN`,[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(24),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(``),[x,S]=(0,G.useState)(Date.now),C=o||p||n.find(e=>e.active)?.role||t?.active_role||`manager`,w=bi(t,n,C,a,i),T=vi(t,C,i).map(e=>{let t=e.detail;for(let n of r){if(n.kind===`reasoning`)continue;let r=String(n.event_id||n.id||``),i=String(n.message_id||``);if(r!==e.id&&(!i||e.id!==`${e.role}:${i}`))continue;let a=gi(String(n.text||n.reason||n.summary||``));a.length>t.length&&(t=a)}return t===e.detail?e:{...e,detail:t}});(0,G.useEffect)(()=>{g(24),b(``)},[e,C,i]);let E=i?ii(void 0,t,i):0,D=E?vi(t,C,i,E):T,O=D[0],k=D.find(e=>e.detail&&[`agent_message`,`assistant_message`,`decision`,`verdict`,`handoff`,`review`,`completion`].includes(e.kind)),A=yi(r,C,i,E),j=A&&Number(A.ts||0)>=(O?.ts??0),M=!j&&O&&[`agent_message`,`assistant_message`].includes(O.kind)&&O.detail?O.detail.split(/[。\n]/)[0].slice(0,70):_i(j?String(A.kind):O?.kind||`task`,f,j?String(A.tool_name||``):``),ee=n.find(e=>e.role===C)?.model||t?.roles.find(e=>e.role===C)?.model,N=O?Math.max(0,Math.floor(x/1e3-O.ts)):0,P=Math.max(O?.ts??0,j?Number(A?.ts||0):0),F=w&&P?xi(x/1e3-P,f):``;(0,G.useEffect)(()=>{if(!w)return;let e=setInterval(()=>S(Date.now()),1e3);return()=>clearInterval(e)},[w]);let te=e=>gt(e)?Ve(e,d):e;return(0,J.jsxs)(`section`,{className:`agent-activity`,style:{"--agent-role-color":_t(C)},"aria-label":f?`工作详情`:`Work details`,children:[(0,J.jsxs)(`header`,{className:`agent-activity-heading`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Ge,{size:15}),f?`工作详情`:`Work details`]}),c&&(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":f?`关闭工作详情`:`Close work details`,children:(0,J.jsx)(Je,{size:17})})]}),l&&(0,J.jsx)(`div`,{className:`agent-activity-tabs`,role:`group`,"aria-label":f?`筛选 Agent`:`Filter agents`,children:et.map(e=>(0,J.jsxs)(`button`,{type:`button`,"data-role":e,"aria-pressed":C===e,style:{"--agent-role-color":_t(e)},onClick:()=>{m(e),s?.(e)},children:[(0,J.jsx)(`i`,{"data-active":bi(t,n,e,a,i)}),te(e)]},e))}),(0,J.jsxs)(`div`,{className:`agent-current`,"data-active":w,children:[(0,J.jsxs)(`div`,{className:`agent-current-kicker`,children:[(0,J.jsx)(`span`,{children:w?f?`当前工作`:`Current work`:a?f?`工作已暂停`:`Work paused`:f?`最近进度`:`Latest progress`}),w?(0,J.jsxs)(`span`,{className:`agent-live-indicator`,"data-stale":F?!0:void 0,children:[(0,J.jsx)(`i`,{}),f?`处理中`:`In progress`,F&&(0,J.jsx)(`small`,{className:`agent-live-stale`,children:F})]}):(0,J.jsx)(dn,{size:12})]}),(0,J.jsx)(`h3`,{children:O||j?M:w?f?`尚无本次工作记录`:`No work recorded for this attempt yet`:f?`等待任务分配`:`Waiting for an assignment`}),k?.detail&&(0,J.jsx)(`div`,{className:`agent-current-summary`,children:(0,J.jsx)(H,{children:k.detail})}),!k&&O?.detail&&(0,J.jsx)(`p`,{className:`agent-current-summary`,children:O.detail}),O&&(0,J.jsxs)(`div`,{className:`agent-current-meta`,children:[(0,J.jsx)(Jt,{size:12}),(0,J.jsx)(`span`,{children:f?`${N<60?N+` 秒`:N<3600?Math.floor(N/60)+` 分钟`:N<86400?Math.floor(N/3600)+` 小时`:Math.floor(N/86400)+` 天`}前更新`:`Updated ${N<60?N+`s`:N<3600?Math.floor(N/60)+`m`:N<86400?Math.floor(N/3600)+`h`:Math.floor(N/86400)+`d`} ago`})]}),(0,J.jsxs)(`details`,{className:`agent-technical-details`,children:[(0,J.jsx)(`summary`,{children:f?`查看运行信息`:`Runtime details`}),(0,J.jsxs)(`p`,{children:[te(C),ee?` · ${ee}`:``,O?.round_index==null?``:f?` · 第 ${O.round_index} 轮`:` · Round ${O.round_index}`]})]})]}),(0,J.jsxs)(`div`,{className:`agent-records-heading`,children:[(0,J.jsx)(`span`,{children:f?`工作记录`:`Work log`}),(0,J.jsxs)(`span`,{children:[T.length,` `,f?`条`:`records`]})]}),(0,J.jsxs)(`div`,{className:`agent-records`,role:`log`,"aria-live":`off`,children:[T.slice(0,h).map((t,n)=>{let r=w&&t.id===O?.id,i=[`done`,`completed`].includes(t.status),a=[`failed`,`error`,`rejected`].includes(t.status),o=i?We:[`tool_use`,`command_execution`].includes(t.kind)?st:Qt;return(0,J.jsxs)(`article`,{className:`agent-record`,"data-active":r,"data-failed":a,children:[(0,J.jsx)(`span`,{className:`agent-record-icon`,children:(0,J.jsx)(o,{size:13})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`agent-record-title`,children:[(0,J.jsx)(`strong`,{children:_i(t.kind,f)}),(0,J.jsx)(`time`,{children:new Date(t.ts*1e3).toLocaleTimeString(f?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})})]}),(0,J.jsx)(`small`,{children:r?f?`进行中`:`In progress`:a?f?`未完成`:`Did not finish`:i?f?`已完成`:`Completed`:f?`已记录`:`Recorded`}),(t.detail||e)&&(0,J.jsx)(_m,{sid:e,record:t,zh:f,expanded:n===0||t.id===k?.id})]})]},t.id)}),!T.length&&(0,J.jsx)(`p`,{className:`agent-records-empty`,children:f?`${te(C)}尚未留下这个任务的工作记录。`:`No work has been recorded for this task by ${te(C)}.`})]}),(0,J.jsxs)(`div`,{className:`agent-records-footer`,children:[hg(e=>e+24),children:f?`加载更早记录(还剩 ${T.length-h} 条)`:`Load earlier records (${T.length-h} remaining)`}),e&&(0,J.jsx)(`button`,{type:`button`,disabled:_,onClick:()=>{v(!0),b(``),R.downloadWorkLog(e,C,i).catch(e=>b(e instanceof Error?e.message:String(e))).finally(()=>v(!1))},children:_?f?`正在准备完整记录…`:`Preparing full log…`:f?`下载完整工作记录(含更早历史)`:`Download full work log (including earlier history)`}),y&&(0,J.jsx)(`small`,{role:`alert`,children:y})]})]})}var ym=[`active`,`running`,`in_progress`,`claimed`],bm=[`complete`,`completed`,`done`,`success`,`incomplete`,`stalled`,`blocked`,`ended`],xm=864e5,Sm=300;function Cm(e,t){return zn(e,t)}function wm(e){let t=e.type.toLowerCase().split(/[._-]/).at(-1);return[`failed`,`failure`,`error`].includes(t??``)||e.tone===`error`&&/\bfailed\b/i.test(e.title)}function Tm(e,t,n=new Date){let r=new Date(e*1e3),i=r.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()),o=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate());if(o===a)return i;let s=+(t===`zh-CN`);return o>=a-(n.getDay()-s+7)%7*xm&&on;(0,G.useEffect)(()=>{if(n!=null||o)return;let e=a.current;if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight);t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[e,o,n]);let d=!o&&n!=null&&u?`${e.slice(0,n)}…`:e;return(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(`p`,{ref:a,title:t||void 0,className:`${n==null&&!o?`line-clamp-3`:``} whitespace-pre-wrap break-words ${r}`,children:d}),u?(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`mt-1 text-xs text-blue-sky hover:text-ink`,children:i(o?`mission.showLess`:`mission.showMore`)}):null]})}function Dm(e){let t=[...e.dag],n=[],r=new Set;for(;t.length;){let i=t.findIndex(t=>t.deps.every(t=>r.has(t)||!e.dag.some(e=>e.id===t))),[a]=t.splice(i>=0?i:0,1);n.push(a),r.add(a.id)}return n}function Om(e,t=16){let n=Dm(e);if(n.length<=t)return{nodes:n,hidden:[]};let r=new Set(n.slice(-t).map(e=>e.id)),i=n.find(e=>[`running`,`in_progress`,`claimed`].includes(e.status)),a=new Map(n.map(e=>[e.id,e])),o=i?[i]:[];for(;o.length;){let e=o.pop();r.has(e.id)||(r.add(e.id),e.deps.forEach(e=>{let t=a.get(e);t&&o.push(t)}))}return{nodes:n.filter(e=>r.has(e.id)),hidden:n.filter(e=>!r.has(e.id))}}function km({view:e}){let{t}=z(),n=e.achievement;return n?(0,J.jsxs)(`section`,{className:`border-b border-ok/35 bg-ok/5 px-5 py-4 animate-appear`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ok`,children:t(`mission.achievement`)}),(0,J.jsx)(`div`,{className:`mt-2 text-sm font-semibold text-ink`,children:n.title}),n.summary?(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:n.summary}):null,(0,J.jsxs)(`div`,{className:`mt-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[t(`mission.elapsed`),` `]}),(0,J.jsx)(`span`,{className:`font-mono text-ink`,children:zf(n.elapsed_seconds??0)})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-1 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{children:t(`mission.rejectedAttempts`,{count:n.rejected_attempts??0})}),(0,J.jsx)(`span`,{children:t(`mission.skillsLearned`,{count:n.skills_learned??0})}),(0,J.jsx)(`span`,{children:t(`mission.artifacts`,{count:n.artifacts??0})})]})]}):null}function Am({view:e,sid:t=``,snapshot:n,artifacts:r=[],onOpenArtifact:i,onOpenDelivery:a,gitDiff:o,onNotify:s,onAsk:c,connected:l=!0,events:u=[]}){let{locale:d,t:f}=z(),p=(0,G.useMemo)(()=>({...e,role_work:e.role_work.map(e=>({...e,detail:Xc(e.detail,d).text}))}),[d,e]),m=new Map(e.roles.map(e=>[e.role,e])),h=!!n?.daemon.alive||e.dag.length>0||e.roles.some(e=>![``,`idle`,`waiting`].includes(e.status)),g=e.dag.find(e=>[`running`,`in_progress`,`claimed`].includes(e.status)),_=Om(e),v=_.nodes,y=n?ci(n,e,u):null,b=y?[`running`,`waiting`].includes(y.state):!1,x=d===`zh-CN`,S=Rf(e.mission.objective||e.mission.title||(b?x?`正在处理你的请求`:`Working on your request`:e.artifacts.length?x?`已完成,成果在下方`:`Completed; results below`:f(`mission.waiting`))),[C,w]=(0,G.useState)(b);(0,G.useEffect)(()=>{b&&w(!0)},[b]);let T=e.mission.final_output?.trim()||``,E=!!(T&&T!==e.mission.summary.trim()),[D,O]=(0,G.useState)(Math.max(0,e.timeline.length-1)),[k,A]=(0,G.useState)(e.active_role||`planner`),[j,M]=(0,G.useState)(g?.id||``),[ee,N]=(0,G.useState)(!1),P=e.delivery,F=(()=>{if(!P)return!1;let t=e=>e.replace(/\s+/g,``).slice(0,80),n=t(e.mission.summary||``),r=t(P.summary||P.title||``);return!!(n&&r)&&(n.startsWith(r)||r.startsWith(n))})(),te=new Map(r.map(e=>[e.path,e])),ne=e.learned_skills.filter(e=>e.status===`active`),re=e.learned_wiki_pages.filter(e=>e.status!==`retired`),ie=!!(e.storage.project_skill_dir||e.storage.global_skill_dir||e.storage.wiki_paths.length||e.storage.skill_history_compressed||e.storage.wiki_retired_compressed),I=!!(ne.length||re.length||ie),L=e.mission.status.toLowerCase(),ae=n?ci(n,e,u):null,oe=ae?ae.state===`running`:[`working`,`grounding`,`framed`].includes(L),se=[`degraded`,`red`,`critical`].includes(e.health?.toLowerCase()??``),ce=[`failed`,`error`].includes(e.mission.status.toLowerCase()),le=e.dag.some(t=>t.status.toLowerCase()===`failed`&&(t.id===e.mission.id||!e.mission.id&&!oe&&!g)),ue=ae?.state===`paused`||[`hold`,`paused`].includes(e.stage.id.toLowerCase()),de=e.outcome.execution_status?.toLowerCase()===`failed`&&e.stage.id.toLowerCase()===`delivery`,fe=se||de||ce||le||ue,pe=se?`mission.attentionHealth`:de?`mission.deliveryFailed`:ce?`mission.attentionFailed`:le?`mission.attentionStepFailed`:`mission.attentionPaused`,me=e.role_work.filter(t=>ym.includes(t.status.toLowerCase())&&(!e.mission.id||(t.item_id||t.mission_id)===e.mission.id)).sort((e,t)=>t.ts-e.ts),he=me.find(t=>t.role===e.active_role)??me[0],ge=bm.includes(L),_e=Vn(e.outcome,f)[0]??Rn(e.mission.status,f),ve=l?ae?.state===`paused`||ae?.state===`unknown`?pi(ae,d):fe?f(pe):ge?[f(`mission.statusDone`,{outcome:_e,elapsed:zf(e.mission.elapsed_seconds)}),ae?.state===`waiting`?pi(ae,d):``].filter(Boolean).join(` `):ae?pi(ae,d):oe&&he?f(`mission.statusActive`,{role:zn(e.active_role||he.role,f),work:he.title}):f(`mission.statusWaiting`):d===`zh-CN`?`实时连接已断开,以下是已收到的记录。`:`Live connection lost; these are the records already received.`,ye=l?se||de||ce||le?`error`:ue||ae?.state===`waiting`?`waiting`:ge?`done`:oe&&he?`active`:`waiting`:`waiting`,be=String(e.outcome.execution_status||``).toLowerCase(),xe=ge&&![`completed`,`done`,`success`].includes(be),Se=ge&&!xe&&e.outcome.review_status===`done`&&e.review.status===`done`?Xc(e.review.reason,d).text.trim():``,Ce=Se||e.mission.summary,we=[...e.timeline].reverse().find(t=>t.cause&&t.detail&&(!e.mission.id||t.item_id===e.mission.id)&&(!e.mission.started_at||t.ts>=e.mission.started_at)),Te=we?Xc(we.detail,d,{cause:we.cause,technical:we.technical,language:e.language}):[`skipped`,`blocked`,`rejected`,`continue`].includes(String(e.review.status||``).toLowerCase())?Xc(e.review.reason,d):null,Ee=String(e.outcome.interruption_kind||``).toLowerCase(),De=fe||xe,Oe=De?Te?.text||(Ee&&Ee!==`none`?Ic(Ee,d):``):``,ke=ae?.reason===`operator_input`?f(`mission.nextAfterReply`):De&&e.outcome.resumable?f(n?.daemon.alive?`mission.nextResumeLive`:`mission.nextResume`):``;(0,G.useEffect)(()=>O(Math.max(0,e.timeline.length-1)),[e.timeline.length]),(0,G.useEffect)(()=>{g?.id&&M(g.id)},[g?.id]);let Ae=async()=>{if(!ee){N(!0);try{await R.setContinuous(t,!0,n?.continuous?.objective??``),s?.(`success`,f(`sidebar.resumeSuccess`))}catch(e){s?.(`error`,f(`sidebar.resumeFailed`,{error:xt(e)}))}finally{N(!1)}}},je=e.timeline.slice(0,D+1).slice(-12).reverse(),Me=e.dag.find(e=>e.id===j);if(n&&l&&n.daemon.read_status!==`error`&&!h&&!fe&&[``,`idle`,`waiting`].includes(L)&&!n.backlog.length&&!e.role_work.length&&!e.timeline.length&&!e.mission.summary&&!E&&!P&&!e.artifacts.length&&!I&&!r.some(e=>e.exists)&&!(o?.available&&(o.status||o.diff))){let e=d===`zh-CN`,t=n.session.objective?.trim();return(0,J.jsx)(`section`,{className:`min-h-0 flex-1 overflow-y-auto bg-panel px-5 py-8 scroll-thin`,"aria-label":f(`mission.control`),"data-testid":`project-ready`,children:(0,J.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold text-ink`,children:e?`还没有安排执行任务`:`No work has been assigned yet`}),t?(0,J.jsx)(`div`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:(0,J.jsx)(H,{children:t})}):null,(0,J.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`在下方告诉 Manager 你想完成什么,也可以直接询问这个项目的进展。`:`Tell the Manager what you want to accomplish below, or ask about this project’s progress.`}),c?(0,J.jsx)(`button`,{type:`button`,className:`mt-4 rounded-lg border border-line px-3 py-2 text-sm text-ink hover:border-blue`,onClick:()=>c(e?`这个项目目前做到了哪一步?有哪些结果,下一步是什么?`:`Where does this project stand? What results do we have, and what comes next?`),children:e?`问 Manager 项目现状`:`Ask the Manager about this project`}):null]})})}return(0,J.jsx)(`section`,{className:`mission-overview min-h-0 flex-1 overflow-x-hidden overflow-y-auto bg-panel scroll-thin`,"aria-label":f(`mission.control`),children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-[960px]`,children:[(0,J.jsxs)(`header`,{className:`px-5 pb-6 pt-7 sm:px-8`,children:[(0,J.jsx)(`div`,{role:`heading`,"aria-level":1,className:`mt-1 line-clamp-4 max-w-4xl text-xl font-semibold leading-snug text-ink`,title:S,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:S})}),S.length>600?(0,J.jsxs)(`details`,{className:`mt-2 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer hover:text-ink`,children:f(`mission.showObjective`)}),(0,J.jsx)(`div`,{className:`mt-2 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:S})})]}):null,(0,J.jsxs)(`div`,{className:`mission-status-line`,"data-tone":ye,role:fe?`alert`:`status`,children:[(0,J.jsxs)(`div`,{className:`mission-status-line__signal`,children:[(0,J.jsx)(`span`,{className:`mission-status-line__marker`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:ve})]}),e.frontier.change?(0,J.jsx)(`div`,{className:`mission-status-line__subtitle`,children:e.frontier.change}):null,Oe?(0,J.jsx)(`p`,{className:`mt-1.5 pl-[1.125rem] text-sm leading-relaxed text-ink-dim`,title:Te?.technical||void 0,children:Oe}):null,ke?(0,J.jsx)(`p`,{className:`mt-1 pl-[1.125rem] text-sm leading-relaxed text-ink-dim`,children:ke}):null]}),oe&&he?.detail?(0,J.jsx)(`div`,{className:`mt-4 text-sm text-ink-dim`,children:(0,J.jsx)(Em,{detail:Xc(he.detail,d).text,previewLength:Sm,textClassName:`leading-6`})}):null,Ce||E?(0,J.jsxs)(`div`,{className:`mt-5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1 text-sm font-semibold text-ink`,children:Se?d===`zh-CN`?`验收结果`:`Review result`:f(P&&F?P.kind===`submission_certified`?`mission.deliveryCertified`:`mission.taskCompleted`:xe?`mission.lastProgress`:`mission.summary`)}),P&&F&&a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(P),title:P.primary_target?te.get(P.primary_target.path)?.storage_path||P.primary_target.path:P.title,className:`shrink-0 rounded-md bg-ink px-3 py-2 text-sm font-medium text-surface hover:opacity-80`,children:f(P.primary_target?`mission.openResult`:`mission.viewTask`)}):null]}),(0,J.jsx)(`div`,{className:`mt-3 whitespace-pre-wrap text-sm leading-7 text-ink-dim`,"data-testid":`mission-result-summary`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:Ce})}),Se&&e.mission.summary&&Se!==e.mission.summary?(0,J.jsxs)(`details`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer`,children:d===`zh-CN`?`执行者记录`:`Execution note`}),(0,J.jsx)(`div`,{className:`mt-2 text-sm leading-6`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:e.mission.summary})})]}):null,E?(0,J.jsxs)(`details`,{className:`mt-2 border-t border-ok/20 pt-2 text-xs text-ink-dim`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer font-medium text-ok hover:text-ink`,children:f(`mission.showFullOutput`)}),(0,J.jsx)(`div`,{className:`mt-3 break-words text-sm leading-relaxed text-ink`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:T})})]}):null]}):null,P&&!F?(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 rounded border border-ok/30 bg-ok/5 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ok`,children:f(P.kind===`submission_certified`?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,J.jsx)(`div`,{className:`mt-1 truncate text-xs text-ink-dim`,title:P.summary||P.title,children:P.summary||P.title})]}),a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(P),title:P.primary_target?te.get(P.primary_target.path)?.storage_path||P.primary_target.path:P.title,className:`shrink-0 rounded border border-ok/40 px-2 py-1 font-mono text-xs text-ok hover:border-ok`,children:f(P.primary_target?`mission.openResult`:`mission.viewTask`)}):null]}):null]}),e.artifacts.length?(0,J.jsxs)(`section`,{className:`px-5 pb-6 sm:px-8`,"aria-label":d===`zh-CN`?`成果文件`:`Result files`,children:[(0,J.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-ink`,children:d===`zh-CN`?`成果文件`:`Result files`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.artifacts.slice(-8).map(e=>{let t=String(e.path||``),n=te.get(t);return(0,J.jsx)(`button`,{type:`button`,disabled:!t||!i||n?.exists===!1,onClick:()=>t&&i?.(t),title:n?.storage_path||t,className:`rounded-md border border-line px-3 py-2 text-sm text-ink-dim hover:border-ink-faint hover:text-ink disabled:opacity-50`,children:String(e.title||t.split(`/`).at(-1)||f(`research.artifact`))},String(e.id||t))})})]}):null,n?.continuous?.done_at&&(0,J.jsxs)(`div`,{className:`mx-5 mb-6 flex items-center gap-3 border-t border-line/60 py-3 sm:mx-8`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-ink-dim`,children:f(`mission.continuousDone`)}),(0,J.jsx)(`button`,{type:`button`,disabled:ee,onClick:()=>void Ae(),className:`compact-control shrink-0 px-3`,children:ee?`…`:f(`mission.resumeContinuous`)})]}),(0,J.jsxs)(`details`,{className:`mission-detail-records mx-5 mb-8 border-t border-line sm:mx-8`,open:C,onToggle:e=>w(e.currentTarget.open),children:[(0,J.jsxs)(`summary`,{className:`cursor-pointer py-4 text-sm text-ink-dim`,children:[d===`zh-CN`?`执行过程与记录`:`Execution details and records`,e.dag.length?` · ${e.dag.length}`:``]}),(0,J.jsx)(km,{view:e}),h?(0,J.jsxs)(`section`,{className:`border-b border-line/60 px-5 py-4`,"aria-label":f(`mission.team`),children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.team`)}),(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2 xl:grid-cols-4`,children:et.map(t=>{let n=m.get(t),r=n?.status===`active`,i=n?.status===`rejected`||n?.status===`error`,a=B.role[t]??B.inkFaint,o=n?.label?Hc(n.label,d,{kind:n.kind,language:e.language}):``;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>A(t),"aria-pressed":k===t,className:`min-w-0 rounded-r-md border-l-2 py-2 pl-3 text-left transition-colors hover:bg-bg/60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue`,style:{borderColor:k===t||r||n?.status===`done`?a:`rgb(var(--line))`,backgroundColor:k===t?`color-mix(in srgb, ${a} 8%, transparent)`:void 0},children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{"data-role-dot":t,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:a}}),(0,J.jsx)(`span`,{className:`text-xs font-semibold`,style:{color:a},children:zn(t,f)})]}),(0,J.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm leading-5 ${i?`text-err`:`text-ink-dim`}`,title:o||void 0,children:o||f(`mission.waitingShort`)})]},t)})})]}):null,h?(0,J.jsxs)(`details`,{className:`border-b border-line/60 px-5 py-4`,open:!!n?.daemon.alive,children:[(0,J.jsxs)(`summary`,{className:`flex cursor-pointer flex-wrap items-center justify-between gap-2 list-none`,children:[(0,J.jsxs)(`div`,{className:`text-xs font-medium text-ink-faint`,children:[f(`mission.roleWork`),` · `,(0,J.jsx)(`span`,{style:{color:B.role[k]??B.inkDim},children:zn(k,f)})]}),Me?(0,J.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`text-xs text-ink-faint hover:text-ink`,children:f(`mission.filteredBy`,{task:Me.title||Me.objective||f(`task.untitled`)})}):(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:f(`mission.allVisible`)})]}),(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(vm,{sid:t,view:p,roles:n?.roles,events:n?.recent_events,taskId:j||void 0,selectedRole:k,showTabs:!1,paused:n?!n.daemon.alive:!1})})]}):null,(0,J.jsxs)(`div`,{className:`grid min-h-[320px] border-b border-line/60 lg:grid-cols-[minmax(0,1.15fr)_minmax(260px,0.85fr)]`,children:[(0,J.jsxs)(`section`,{className:`min-w-0 border-b border-line/60 px-5 py-4 lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.researchDag`)}),g?(0,J.jsxs)(`span`,{className:`max-w-48 truncate text-xs text-blue-sky`,children:[f(`mission.active`),` · `,g.title]}):null]}),(0,J.jsxs)(`div`,{className:`mt-3 space-y-0`,children:[_.hidden.length?(0,J.jsx)(`div`,{className:`mb-3 rounded border border-line/60 bg-bg/50 px-3 py-2 text-xs text-ink-faint`,children:f(`mission.hiddenTasks`,{count:_.hidden.length,failed:_.hidden.filter(e=>[`failed`,`blocked`].includes(e.status)).length,skipped:_.hidden.filter(e=>e.status===`skipped`).length})}):null,v.length?v.map((e,t)=>{let n=e.id===g?.id,r=[`done`,`completed`].includes(e.status),i=[`failed`,`blocked`].includes(e.status);return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>M(e.id),className:`relative flex w-full min-w-0 gap-3 pb-3 text-left last:pb-0 ${j===e.id?`bg-white/[0.03]`:``}`,children:[t(0,J.jsx)(`li`,{children:e},e))})]}):null]}):null]}),(0,J.jsxs)(`section`,{className:`min-w-0 px-5 py-4`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.capabilities`)}),ne.length?(0,J.jsxs)(`div`,{className:`mt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-ok`,children:f(`mission.capabilitiesUnlocked`)}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:ne.slice(-8).map(e=>(0,J.jsxs)(`details`,{className:`rounded border border-ok/35 bg-ok/5 px-2 py-1.5`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-xs text-ok`,children:String(e.name||f(`mission.learnedCapability`))}),e.mission_title?(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-faint`,children:f(`mission.learnedDuring`,{mission:e.mission_title})}):null,e.content?(0,J.jsxs)(`pre`,{className:`mt-2 max-h-64 overflow-auto whitespace-pre-wrap border-t border-ok/20 pt-2 font-mono text-xs leading-5 text-ink-dim scroll-thin`,children:[e.content,e.content_truncated?`\n… ${f(`mission.contentTruncated`)}`:``]}):(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-faint`,children:f(`mission.skillUnavailable`)})]},String(e.id)))})]}):null,re.length?(0,J.jsxs)(`div`,{className:`mt-4 border-t border-line/50 pt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-blue-sky`,children:f(`mission.knowledgeRetained`)}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:re.slice(-6).map(e=>(0,J.jsx)(`span`,{className:`rounded border border-blue/35 bg-blue/5 px-2 py-1 text-xs text-blue-sky`,children:String(e.title||e.id)},String(e.id)))})]}):null,ie?(0,J.jsxs)(`div`,{className:`mt-4 border-t border-line/50 pt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-ink-faint`,children:f(`mission.selfEvolution`)}),(0,J.jsx)(`div`,{className:`mt-2 text-sm text-ink-dim`,children:f(`mission.knowledgeSaved`)})]}):null,I?null:(0,J.jsx)(`div`,{className:`py-10 text-center text-xs text-ink-faint`,children:f(`mission.noCapabilities`)})]})]}),(0,J.jsxs)(`section`,{className:`px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.replay`)}),e.timeline.length>1?(0,J.jsx)(`input`,{type:`range`,min:0,max:e.timeline.length-1,value:D,onChange:e=>O(Number(e.target.value)),"aria-label":f(`mission.replayTimeline`),className:`h-1 min-w-32 flex-1 accent-blue`}):null,je.length?(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:f(je.length===1?`mission.showingLatestEvent`:`mission.showingLastEvents`,{count:je.length})}):null]}),(0,J.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[je.map(t=>{let n=new Date(t.ts*1e3),r=B.role[t.role]??B.inkFaint,i=wm(t)&&!t.kind?f(`mission.roleFailed`,{role:Cm(t.role,f)}):Hc(t.title,d,{kind:t.kind,language:e.language}),a=Xc(t.detail.trim()===e.mission.summary.trim()?``:t.detail,d,{cause:t.cause,technical:t.technical,language:e.language});return(0,J.jsxs)(`article`,{className:`rounded border border-line/60 bg-bg/35 px-3 py-2.5 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1.5 h-2 w-2 shrink-0 rounded-full ${t.tone===`error`?`bg-err`:t.tone===`success`||t.tone===`metric`||t.tone===`skill`?`bg-ok`:`bg-blue`}`}),(0,J.jsx)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 text-xs font-medium`,style:{borderColor:r,color:r},children:Cm(t.role,f)}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 break-words font-medium leading-5 text-ink`,children:i}),(0,J.jsx)(`time`,{dateTime:n.toISOString(),title:n.toLocaleString(d,{dateStyle:`medium`,timeStyle:`short`}),className:`shrink-0 font-mono text-xs text-ink-faint`,children:Tm(t.ts,d)})]}),a.text?(0,J.jsx)(Em,{detail:a.text,technical:a.technical,previewLength:Sm,textClassName:`leading-5 text-ink-dim`}):null]},t.id)}),e.timeline.length?null:(0,J.jsx)(`div`,{className:`py-10 text-center text-xs text-ink-faint`,children:f(`mission.waitingEvents`)})]}),o?.available&&(o.status||o.diff)?(0,J.jsxs)(`div`,{className:`mt-5 border-t border-line/50 pt-4 text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-[0.14em]`,children:f(`mission.projectFilesChanged`)}),(0,J.jsxs)(`span`,{children:[` · `,f(`mission.reviewInIde`)]})]}):null]})]})]})})}function jm(e){let t=Math.ceil(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}var Mm={available:`bg-ok/10 text-ok`,absent:`bg-bg text-ink-faint`,inaccessible:`bg-warn/10 text-warn`,degraded:`bg-warn/10 text-warn`};function Nm({status:e,error:t}){let{t:n}=z();return(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:n(`resource.title`)}),e?(0,J.jsx)(`span`,{className:`rounded px-2 py-1 text-[10px] font-semibold uppercase ${e.enforcement===`strict`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:Un(e.enforcement,n)}):null]}),t?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-err`,children:t}):null,!e&&!t?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:n(`resource.loading`)}):null,e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.accelerators.map(e=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:Hn(e.kind,n)}),(0,J.jsxs)(`span`,{className:`rounded px-2 py-0.5 text-[10px] font-medium ${Mm[e.status]}`,children:[Rn(e.status,n),` · `,n(`resource.devices`,{count:e.device_count})]})]}),e.detail?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:e.detail}):null]},e.kind))}),(0,J.jsxs)(`div`,{className:`mt-4 grid gap-4 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.inUse`,{count:e.holders.length})}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.holders.length===0?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.holders.map((e,t)=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.devices`,{count:e.device_count})}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:jm(e.ttl_seconds)})})]}),(0,J.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)}),e.yield_requests.map((e,t)=>(0,J.jsxs)(`div`,{className:`mt-2 border-l-2 border-warn/50 pl-2 text-ink-faint`,children:[(0,J.jsx)(`div`,{children:n(`resource.yieldRequest`,{reason:e.reason})}),e.response?(0,J.jsxs)(`div`,{children:[Wn(e.response.decision,n),` · `,e.response.reason]}):null]},t))]},`${e.project}:${e.task_id}:${t}`))})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.queue`,{count:e.queue.length})}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.queue.length===0?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.queue.map(e=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.queuePosition`,{position:e.position})}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:jm(e.ttl_seconds)})})]}),(0,J.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)})]},e.position))})]})]})]}):null]})}async function Pm(e){let t=await e,n=t&&typeof t==`object`?t:{},r=String(n.command_status??``);if(Number(n.rc??0)!==0||r===`failed`||r===`rejected`)throw Error(String(n.error||`daemon command ${r||`failed`}`));return t}function Fm({open:e,sid:t,snap:r,onClose:i,onChanged:l,onRestored:d,onOpenSkills:f}){let{t:p,locale:h}=z(),[v,b]=(0,G.useState)(`task`),[S,C]=(0,G.useState)(``),[w,E]=(0,G.useState)(r.session.workdir??r.session.cwd??``),[D,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(null),[M,ee]=(0,G.useState)(()=>new Set),[N,P]=(0,G.useState)(null),[F,te]=(0,G.useState)(null),[ne,re]=(0,G.useState)(null),[ie,I]=(0,G.useState)(``),[L,ae]=(0,G.useState)([]),[oe,se]=(0,G.useState)(0),[ce,le]=(0,G.useState)(``),[ue,de]=(0,G.useState)(``),[fe,pe]=(0,G.useState)(`work`),me=e=>ee(t=>t.has(e)?t:new Set([...t,e])),he=e=>j(Md(e,p)),ge=!M.has(`sourceUpdate`);(0,G.useEffect)(()=>{e&&(E(r.session.workdir??r.session.cwd??``),R.metrics().then(P,e=>{jd(e)?me(`metrics`):he(e)}),R.trash().then(e=>{ae(e.entries),se(e.total)},e=>{jd(e)?me(`trash`):he(e)}))},[e,r.session.cwd,r.session.workdir]),(0,G.useEffect)(()=>{if(!e||!ge)return;let t=!1,n=e=>{t||(jd(e)?me(`sourceUpdate`):he(e))},r=async()=>{try{let e=await R.sourceUpdateStatus();t||te(e)}catch(e){n(e)}};R.sourceUpdateStatus().then(async e=>{if(!t&&(te(e),!e.running)){let e=await R.checkSourceUpdate();t||te(e)}}).catch(n);let i=window.setInterval(()=>void r(),1500);return()=>{t=!0,window.clearInterval(i)}},[e,ge]),(0,G.useEffect)(()=>{!e||fe!==`system`||(re(null),I(``),R.resources().then(re,e=>{jd(e)?me(`resources`):I(p(`operations.requestFailed`))}))},[e,fe]);let _e=async(e,t,n)=>{if(!ue){de(e),k(null),j(null);try{let e=await t();n!==null&&k(n?{text:n}:{text:p(`operations.done`),raw:JSON.stringify(e,null,2)}),l()}catch(e){he(e)}finally{de(``)}}},ve=async()=>{let e=S.trim();if(e){if(v===`plan`){await _e(`quick`,async()=>{let n=await R.previewPlan(t,e);return k({text:[...n.steps.map((e,t)=>`${t+1}. ${e.title}${e.detail?` — ${e.detail}`:``}`),...n.notes.map(e=>`Note: ${e}`),...n.error?[`Error: ${n.error}`]:[]].join(` +`)}),n},null);return}await _e(`quick`,v===`task`?()=>R.addTask(t,e):v===`nudge`?()=>R.nudge(t,e):()=>R.note(t,e),`${v} submitted.`),C(``)}},ye=async e=>{await _e(`restore:${e.trash_id}`,async()=>{let t=await R.restoreTrash(e.trash_id);return ae(t=>t.filter(t=>t.trash_id!==e.trash_id)),se(e=>Math.max(0,e-1)),await d(t.sid),t},`Restored ${e.label}.`)},be=r.daemon.alive&&r.daemon.protocol_compatible===!1,xe=r.daemon.alive&&r.daemon.control_available===!1,Se=r.daemon_admission?.running_daemons??[],Ce=v===`task`?m:v===`nudge`?O:v===`note`?T:g,we=p(`operations.action.${v}`),Te=async()=>{await _e(`trash-search`,async()=>{let e=await R.trash(ce);return ae(e.entries),se(e.total),e},null)};return(0,J.jsxs)(dt,{open:e,onClose:()=>!ue&&i(),label:p(`operations.title`),width:`max-w-5xl`,children:[(0,J.jsx)(lt,{title:p(`operations.title`),sub:r.session.display_name||t}),(0,J.jsx)(`div`,{className:`flex gap-1 overflow-x-auto border-b border-line bg-panel px-4 py-2 scroll-thin`,children:[[`work`,p(`operations.work`),m],[`runtime`,p(`operations.runtime`),_],[`system`,p(`operations.system`),c],[`recovery`,p(`operations.recovery`),n]].map(([e,t,n])=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{pe(e),k(null),j(null)},"aria-current":fe===e?`page`:void 0,className:`flex h-8 shrink-0 items-center justify-center gap-2 rounded-md px-3 text-xs font-medium ${fe===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:[(0,J.jsx)(o,{icon:n}),(0,J.jsx)(`span`,{children:t})]},e))}),(0,J.jsxs)(`div`,{className:`grid max-h-[76vh] gap-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid-cols-2`,children:[fe===`work`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.workInput`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:p(`operations.workHint`)}),(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-1 sm:grid-cols-4`,children:[[`task`,m],[`nudge`,O],[`note`,T],[`plan`,g]].map(([e,t])=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>b(e),"aria-pressed":v===e,className:`flex h-9 items-center justify-center gap-2 rounded px-2 text-xs font-medium ${v===e?`bg-blue/10 text-blue`:`bg-bg text-ink-dim hover:text-ink`}`,children:[(0,J.jsx)(o,{icon:t}),(0,J.jsx)(`span`,{children:p(`operations.action.${e}`)})]},e))}),(0,J.jsx)(`textarea`,{value:S,onChange:e=>C(e.target.value),rows:5,placeholder:v===`plan`?p(`operations.planPlaceholder`):p(`operations.actionPlaceholder`,{action:v}),className:`mt-3 w-full resize-y rounded border border-line bg-bg p-3 text-sm text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void ve(),disabled:!!ue||!S.trim(),className:`mt-2 flex h-9 items-center justify-center gap-2 rounded border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:ue===`quick`?`…`:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(o,{icon:Ce}),(0,J.jsx)(`span`,{children:v===`plan`?p(`operations.previewPlan`):p(`operations.submitAction`,{action:we})})]})})]}):null,fe===`runtime`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.runtime`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:p(`operations.runtimeHint`)}),(0,J.jsx)(`label`,{className:`mt-3 block text-[10px] uppercase tracking-wide text-ink-faint`,children:p(`operations.workdir`)}),(0,J.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[(0,J.jsx)(`input`,{value:w,onChange:e=>E(e.target.value),className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`cwd`,()=>R.setWorkdir(t,w),p(`operations.workdirUpdated`)),disabled:!!ue||!w.trim(),title:p(`operations.applyWorkdir`),"aria-label":p(`operations.applyWorkdir`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:y})})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`reset`,()=>R.resetManager(t),`Manager context reset.`),disabled:!!ue,title:p(`operations.resetManager`),"aria-label":p(`operations.resetManager`),className:`flex h-9 w-9 items-center justify-center rounded border border-line text-xs text-ink-dim disabled:opacity-40`,children:(0,J.jsx)(o,{icon:a})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`upgrade`,()=>Pm(R.upgradeDaemon(t,r.daemon_commands?.revision)),`Current-release daemon started after safely draining active work.`),disabled:!!ue||xe,title:xe?`Externally supervised daemon cannot be restarted from this Web host`:be?`Upgrade incompatible daemon`:`Restart on current release`,"aria-label":xe?`Externally supervised daemon`:be?`Upgrade incompatible daemon`:`Restart on current release`,className:`flex h-9 w-9 items-center justify-center rounded border text-xs disabled:opacity-40 ${be?`border-err/60 bg-err/10 text-err`:`border-line text-ink-dim`}`,children:(0,J.jsx)(o,{icon:x})})]}),ge?(0,J.jsxs)(`div`,{className:`mt-4 rounded-lg border border-line bg-bg p-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:p(`operations.sourceUpdate`)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold ${F?.state===`failed`?`bg-err/10 text-err`:F?.update_available?`bg-warn/10 text-warn`:F?.update_available===!1?`bg-ok/10 text-ok`:`bg-line text-ink-dim`}`,children:F?.running?p(`operations.updateRunning`):F?.update_available?p(`operations.updateAvailable`):F?.update_available===!1?p(`operations.updateCurrent`):p(`operations.updateChecking`)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:F?.error||F?.message||p(`operations.updateChecking`)}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px] text-ink-dim`,children:[(0,J.jsxs)(`span`,{children:[p(`operations.currentRevision`),`: `,F?.current_revision?.slice(0,12)||`—`]}),(0,J.jsxs)(`span`,{children:[p(`operations.latestRevision`),`: `,F?.upstream_revision?.slice(0,12)||`—`]}),F?.phase&&F.phase!==`complete`&&F.phase!==`idle`?(0,J.jsxs)(`span`,{children:[p(`operations.updatePhase`),`: `,F.phase]}):null]}),F?.running?(0,J.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded bg-line`,children:(0,J.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`})}):null]}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>void _e(`source-update`,async()=>{let e=await R.applySourceUpdate();return te(e),e},null),disabled:!!ue||!!F?.running||F?.can_update===!1,title:F?.can_update===!1?F.error||p(`operations.updateUnavailable`):p(`operations.pullLatest`),"aria-label":p(`operations.pullLatest`),className:`flex h-9 items-center gap-2 rounded border border-blue/50 px-3 text-xs font-medium text-blue disabled:opacity-40`,children:[(0,J.jsx)(o,{icon:u}),(0,J.jsx)(`span`,{children:F?.running?p(`operations.updateRunning`):p(`operations.pullLatest`)})]})]}),F?.restart_required?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-warn`,children:p(`operations.updateRestart`)}):null]}):null,r.daemon.protocol_error?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-err`,children:r.daemon.protocol_error}):null,Se.length?(0,J.jsxs)(`div`,{className:`mt-4`,children:[(0,J.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-ink-faint`,children:p(`operations.replaceSlot`)}),(0,J.jsx)(`div`,{className:`mt-2 space-y-1`,children:Se.map(e=>(0,J.jsxs)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void _e(`replace:${e.id}`,()=>Pm(R.replaceDaemon(t,e.id,!!r.continuous?.enabled,r.daemon_commands?.revision)),`Parked ${e.label||e.id} and started this session.`),title:`Replace ${e.label||e.id}`,"aria-label":`Replace ${e.label||e.id}`,className:`flex w-full items-center justify-between rounded border border-line bg-bg px-2 py-1.5 text-left text-xs text-ink-dim disabled:opacity-40`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:e.label||e.id}),(0,J.jsx)(o,{icon:x,className:`ml-2 text-warn`})]},e.id))})]}):null]}):null,fe===`system`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.skills`)}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:h===`zh-CN`?`全局技能对所有任务可用。在技能库中查看各分类与最近更新。`:`Global skills are available to every task. Browse all classes and recent updates in the skill library.`}),(0,J.jsx)(`button`,{type:`button`,onClick:f,className:`mt-3 rounded border border-line px-3 py-2 text-sm text-blue hover:bg-bg`,children:h===`zh-CN`?`打开技能库`:`Open skill library`})]}):null,fe===`system`&&!M.has(`metrics`)?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.metrics`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,J.jsx)(`span`,{className:`rounded px-2 py-1 text-xs font-semibold ${N?.slo?.status===`healthy`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:p(N?N.slo?.status===`healthy`?`operations.slo.healthy`:`operations.slo.degraded`:`operations.slo.loading`)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p(`operations.validationFailures`,{count:N?.event_validation_failures??`—`})})]}),N?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-dim`,children:wd(N).map((e,t)=>(0,J.jsxs)(`span`,{children:[t>0?(0,J.jsx)(`span`,{className:`text-ink-faint`,children:` · `}):null,(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[p(`operations.metric.${e.key}`),` `]}),(0,J.jsx)(`span`,{className:`font-mono tabular-nums text-ink`,children:e.value})]},e.key))}):null,N?(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap rounded bg-bg p-3 font-mono text-[10px] text-ink-dim scroll-thin`,children:JSON.stringify({web:N.web,provider:N.provider},null,2)})}):null]}):null,fe===`system`&&!M.has(`resources`)?(0,J.jsx)(Nm,{status:ne,error:ie}):null,fe===`recovery`&&M.has(`trash`)?(0,J.jsx)(`p`,{className:`text-sm text-ink-faint lg:col-span-2`,children:p(`operations.unavailableHere`)}):null,fe===`recovery`&&!M.has(`trash`)?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`h3`,{className:`mr-auto text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:[p(`operations.trash`),` · `,oe]}),(0,J.jsx)(`input`,{value:ce,onChange:e=>le(e.target.value),onKeyDown:e=>{!vu(e)&&e.key===`Enter`&&Te()},placeholder:p(`operations.searchTrash`),className:`h-8 min-w-52 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void Te(),title:p(`operations.searchTrash`),"aria-label":p(`operations.searchTrash`),className:`flex h-8 w-8 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:s})})]}),L.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:L.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded border border-line bg-bg p-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-xs text-ink`,children:e.label}),(0,J.jsx)(`div`,{className:`truncate font-mono text-[10px] text-ink-faint`,children:e.trash_path})]}),(0,J.jsx)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void ye(e),title:`Restore ${e.label}`,"aria-label":`Restore ${e.label}`,className:`flex h-8 w-8 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:n})})]},e.trash_id))}):(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`operations.trashEmpty`)}),oe>L.length?(0,J.jsxs)(`p`,{className:`mt-2 text-[10px] text-ink-faint`,children:[`Showing the newest `,L.length,` matches. Narrow the search to find older sessions.`]}):null]}):null,A?(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-panel p-3 text-sm text-ink-dim lg:col-span-2`,children:[(0,J.jsx)(`p`,{children:A.text}),A.technical?(0,J.jsx)(ft,{label:p(`operations.technicalDetails`),children:(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap font-mono`,children:A.technical})}):null]}):null,D?(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-panel p-3 text-sm text-ink-dim lg:col-span-2`,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:D.text}),D.raw?(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs`,children:D.raw})}):null]}):null]})]})}var Im=[`handshake.service`,`handshake.project`,`handshake.ready`];function Lm(){let{t:e}=z(),t=(0,G.useRef)(null);return it(t,(e,t)=>{if(t){e.set(`[data-handshake-line], [data-handshake-node]`,{opacity:1,scale:1,clearProps:`transform`});return}e.to(`[data-handshake-mark]`,{scale:1.055,duration:.75,ease:`sine.inOut`,repeat:-1,yoyo:!0,transformOrigin:`50% 50%`}),e.timeline({repeat:-1,repeatDelay:.25}).fromTo(`[data-handshake-line]`,{scaleX:0,opacity:.25,transformOrigin:`0% 50%`},{scaleX:1,opacity:.8,duration:.9,ease:`power2.inOut`}).fromTo(`[data-handshake-node]`,{autoAlpha:.25,scale:.72},{autoAlpha:1,scale:1,duration:.28,stagger:.16,ease:`back.out(1.8)`},.12).to(`[data-handshake-node]`,{autoAlpha:.35,duration:.3,stagger:.08},`+=0.35`)}),(0,J.jsxs)(`div`,{ref:t,role:`status`,"aria-label":e(`handshake.connecting`),className:`w-full max-w-xl px-6 text-center`,children:[(0,J.jsx)(`div`,{"data-handshake-mark":!0,className:`handshake-mark glass-card mx-auto flex h-16 w-16 items-center justify-center rounded-3xl text-blue shadow-glow sm:h-20 sm:w-20`,children:(0,J.jsx)(At,{size:48,className:`text-ink`})}),(0,J.jsxs)(`div`,{className:`relative mx-auto mt-8 h-10 max-w-sm sm:max-w-md`,children:[(0,J.jsx)(`div`,{className:`absolute left-[10%] right-[10%] top-3 h-px bg-line/80`}),(0,J.jsx)(`div`,{"data-handshake-line":!0,className:`handshake-line absolute left-[10%] right-[10%] top-3 h-px`}),(0,J.jsx)(`div`,{className:`relative flex justify-between`,children:Im.map(t=>(0,J.jsxs)(`div`,{className:`flex w-20 flex-col items-center gap-2.5`,children:[(0,J.jsx)(`span`,{"data-handshake-node":!0,className:`handshake-node h-6 w-6 rounded-full border ring-4 ring-bg`,children:(0,J.jsx)(`span`,{className:`m-auto mt-[7px] block h-2 w-2 rounded-full bg-blue`})}),(0,J.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:e(t)})]},t))})]}),(0,J.jsx)(`p`,{className:`mt-9 text-base font-medium text-ink-dim`,children:e(`handshake.title`)}),(0,J.jsx)(`p`,{className:`mt-1.5 text-sm text-ink-faint`,children:e(`handshake.detail`)})]})}function Rm({loading:e,hasProjects:t,error:n,onRetry:r,onNew:i,onChoose:a,canCreate:o}){let{t:s,locale:c}=z();return(0,J.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-4 px-6 text-center`,children:[e?(0,J.jsx)(Lm,{}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h1`,{className:`text-2xl font-semibold text-ink`,children:c===`zh-CN`?t?`继续你的项目`:`开始一个项目`:t?`Continue your work`:`Start a project`}),(0,J.jsx)(`p`,{className:`max-w-md text-sm leading-relaxed ${n?`text-err`:`text-ink-faint`}`,children:n||s(t?`landing.selectOrCreate`:`landing.noSessions`)})]}),!e&&(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[n?(0,J.jsx)(W,{onClick:r,variant:`danger`,children:s(`common.retry`)}):null,t?(0,J.jsx)(W,{onClick:a,children:s(`landing.select`)}):o?(0,J.jsx)(W,{onClick:i,variant:`primary`,children:s(`landing.new`)}):null,!t&&!n?(0,J.jsx)(`span`,{className:`lg:hidden`,children:(0,J.jsx)(W,{onClick:a,children:s(`landing.menu`)})}):null]})]})}function zm({active:e,onSelect:t,onOpenSessions:n,sidebarOpen:r=!1,onRead:i,onOpenSkills:a}){let{t:s,locale:c}=z(),l=[{id:`map`,label:s(`mobile.map`),icon:g},{id:`activity`,label:s(`mobile.activity`),icon:p},{id:`preview`,label:s(`mobile.preview`),icon:E}];return(0,J.jsxs)(`nav`,{"aria-label":s(`mobile.views`),className:`mobile-tabbar glass-panel glass-panel--raised fixed inset-x-0 bottom-0 z-40 items-stretch border-t border-line/60 lg:hidden ${r?`hidden`:`flex`}`,children:[n?(0,J.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":s(`topbar.openSessions`),className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 text-ink-faint active:bg-panel-raised`,children:[(0,J.jsx)(o,{icon:h,className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`text-[10px] leading-none`,children:s(`mobile.sessions`)})]}):null,l.map(n=>{let r=n.id===e;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-current":r?`page`:void 0,className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 active:bg-panel-raised ${r?`text-blue`:`text-ink-faint`}`,children:[(0,J.jsx)(o,{icon:n.icon,className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`text-[10px] leading-none`,children:n.label})]},n.id)}),(0,J.jsxs)(`details`,{className:`workspace-more mobile-more flex-1`,onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,J.jsxs)(`summary`,{className:`min-h-[3.25rem]`,"aria-current":e===`mission`||e===`workbench`?`page`:void 0,children:[(0,J.jsx)(o,{icon:w,className:`h-4 w-4`}),(0,J.jsx)(`span`,{children:c===`zh-CN`?`更多`:`More`})]}),(0,J.jsxs)(`div`,{className:`workspace-more-menu`,onClick:e=>{e.target.closest(`button`)&&e.currentTarget.closest(`details`)?.removeAttribute(`open`)},children:[a&&(0,J.jsx)(`button`,{type:`button`,onClick:a,children:c===`zh-CN`?`技能库`:`Skill library`}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(`mission`),children:[(0,J.jsx)(o,{icon:p}),s(`mobile.mission`)]}),i?(0,J.jsx)(`button`,{type:`button`,onClick:i,children:c===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}):null,(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(`workbench`),children:[(0,J.jsx)(o,{icon:d}),s(`mobile.workbench`)]})]})]})]})}function Bm(e,t,n){let r=n?.height??t,i=t-r-(n?.offsetTop??0);return{keyboardInset:i>24?Math.round(i):0,compact:e<1024&&r<=600}}function Vm(){let[e,t]=(0,G.useState)(()=>typeof window<`u`&&Bm(window.innerWidth,window.innerHeight,window.visualViewport).compact);return(0,G.useEffect)(()=>{let e=window.visualViewport,n=document.documentElement,r=null,i=()=>{r!=null&&window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let r=Bm(window.innerWidth,window.innerHeight,e);n.style.setProperty(`--keyboard-inset`,`${r.keyboardInset}px`),n.dataset.compactViewport=String(r.compact),t(r.compact)})};return i(),e?.addEventListener(`resize`,i),e?.addEventListener(`scroll`,i),window.addEventListener(`resize`,i),()=>{r!=null&&window.cancelAnimationFrame(r),e?.removeEventListener(`resize`,i),e?.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),n.style.removeProperty(`--keyboard-inset`),delete n.dataset.compactViewport}},[]),e}var Hm={[I.LIFE_LIFECYCLE_BLOCK]:`block`,[I.ROUND_REVIEWER_BACKEND_FAILURE]:`block`,[I.LIFE_BUDGET_PAUSE]:`warn`,[I.ROUND_STALL]:`warn`,[I.ROUND_ESCALATED]:`warn`,[I.LIFE_PLANNER_STALL_ESCALATION]:`warn`},Um=new Set([I.BUDGET_RESERVATION_DENIED,I.BUDGET_UNPRICED_BLOCKED]),Wm=new Set([I.LIFE_MISSION_STARTED,I.ROUND_MAIN_COMPLETED,I.LIFE_MISSION_COMPLETED,I.LOOP_DONE,I.ROUND_START,`ui.operator`]),Gm=new Set([I.BUDGET_RESERVATION_CREATED,I.PROVIDER_REQUEST_STARTED]);function Km(e){let t=ie(e.canonical_type??e.type);if(e.event_validation?.status===`invalid`)return t===I.ROLE_SESSION_TURN?null:{tone:`warn`,kind:`validation`,text:`invalid event ${t||`unknown`}: ${e.event_validation.errors.join(`; `)}`};if(Um.has(t))return{tone:`block`,kind:`budget`,text:`Budget exhausted or blocked — ${String(e.reason??e.text??t).trim()}`};let n=e.operator_alert===!0?`block`:Hm[t];return n?{tone:n,text:String(e.text??e.reason??t).trim()}:null}function qm(e){let t=null;for(let n of e){let e=ie(n.canonical_type??n.type),r=Km(n);r?t=r:(t?.kind===`validation`||t?.kind===`budget`&&Gm.has(e)||t&&t.kind!==`budget`&&Wm.has(e))&&(t=null)}return t}async function Jm(e,t){let n=ju(e.trim());if(!n)return{kind:`not-command`};if(!n.cmd){let e=Mu(n.name);return{kind:`error`,message:e?`Unknown command ${n.name}. Did you mean ${e}?`:`Unknown command ${n.name}. Use /help for the full list.`}}if(n.cmd.id===`ask`||n.cmd.id===`crystalpilot`)return{kind:`not-command`};if(Cu(n.cmd)&&!n.rest)return{kind:`error`,message:`Usage: ${n.cmd.name}${n.cmd.arg?` ${n.cmd.arg}`:``}`};try{await t[n.cmd.id](n.rest)}catch(e){return{kind:`error`,message:e instanceof Error?e.message:String(e??`Command failed`)}}return{kind:`handled`}}function Ym({activeSid:e,activityEventsRef:t,notify:n,onClearEvents:r,onDispose:i,onOpenConfig:a,onOpenDoctor:o,onOpenHelp:s,onOpenIdentity:c,onOpenInspector:l,onOpenNewDaemon:u,onOpenOperations:d,onOpenSidebar:f,onOpenSkills:p,onReconnectEvents:m,onRenameProject:h,onRewriteDraft:g,onSelectProject:_,onSetArtifactPath:v,onSetEventFilter:y,onSetEventQuery:b,onSetTaskItemId:x,onSetWorkspaceView:S,onShowArtifacts:C,onStopIteration:w,onStopWaiting:T,refetchSnapshot:E}){return{status:async()=>l(),roles:async()=>d(),journal:async()=>l(),backlog:async()=>S(`mission`),item:async e=>{e&&x(e)},artifacts:async()=>C(),artifact:async e=>{e&&v(e)},events:async e=>{S(`activity`);let{filter:t,query:n}=Au(e);y(t),b(n)},find:async e=>{S(`activity`),y(`all`),b(e)},run:async()=>S(`activity`),clear:async()=>{S(`activity`),y(`all`),b(``),r(t.current.length)},cancel:async()=>T(),task:async t=>{e&&(await R.addTask(e,t),E(),n(`success`,`Task queued.`))},rewrite:async e=>{let t=e.trim();if(!t){n(`info`,`Type your prompt in the composer and press Rewrite, or use /rewrite .`);return}g(t)},plan:async t=>{if(!e)return;let r=await R.previewPlan(e,t);r.error?n(`error`,r.error):n(`info`,r.steps.map(e=>e.title).join(` +`)||`Plan preview ready.`)},nudge:async t=>{e&&(await R.nudge(e,t),n(`success`,`Guidance injected.`))},abort:async t=>{e&&(await R.abortMission(e,t||`operator abort`),n(`info`,`Abort requested.`))},note:async t=>{e&&(await R.note(e,t),n(`success`,`Note appended to timeline.`))},done:async e=>{e&&i(e,`done`)},skip:async e=>{e&&i(e,`rm`)},stop:async e=>{e&&w(e)},new:async()=>u(),daemons:async()=>f(),resume:async e=>{e&&e!==`list`?_(e):f()},attach:async e=>{e&&_(e)},rename:async t=>{!e||!t||await h(t)},doctor:async()=>o(),backend:async t=>{if(!e||!t){a();return}await R.setConfig(e,`runner_backend`,t),n(`success`,`Backend set to ${t}.`)},config:async t=>{if(!e||!t){a();return}let r=t.indexOf(`=`);r>0?(await R.setConfig(e,t.slice(0,r).trim(),t.slice(r+1).trim()),n(`success`,`Config updated.`)):a()},identity:async()=>c(),reset:async()=>{e&&(await R.resetManager(e),n(`success`,`Manager context reset.`))},skills:async t=>{if([``,`ls`,`list`].includes(t.trim().toLowerCase())){p();return}e&&n(`info`,(await R.skills(e,t||`ls`)).slice(0,400))},reconnect:async()=>m(),help:async()=>s(),quit:async()=>n(`info`,`Background work continues; close this browser tab when ready.`)}}function Xm(e){return e.kind===`error`?(typeof e.reply==`string`?e.reply.trim():``)||`Manager could not handle this message.`:null}function Zm(e,t){e.kind===`task`&&t.dispatchTask(e);let n=Xm(e);n&&t.notifyError(n),t.refetchTranscript()}var Qm={skipFirst:0,reconnectKey:0};function $m(e,t){return t.kind===`clear`?{...e,skipFirst:Math.max(0,t.offset)}:t.kind===`reconnect`?{skipFirst:0,reconnectKey:e.reconnectKey+1}:{...e,skipFirst:0}}function eh(e,t){if(!t.length)return e;let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return t?{...e,spend_usd:t.spend_usd,known_cost_usd:t.known_cost_usd,spend_status:t.spend_status,usage_calls:t.usage_calls,premium_requests:t.premium_requests,cost_updated_at:t.updated_at}:e})}async function th(e,t,n,r=``){let i=await e.createDaemon(``,t,r),a=n.trim();return{created:i,startCampaign:a?()=>e.setContinuous(i.sid,!0,a):null}}var nh=e=>e instanceof Error?e.message:String(e||`Unknown error`);function rh({localCwd:e,notify:t,onFocusComposer:n,queryClient:r,refetchProjects:i,selectProject:a,translate:o}){let[s,c]=(0,G.useState)(!1),l=(0,G.useRef)(!1);return{createDaemon:async(s,u,d)=>{if(l.current)return!1;l.current=!0,c(!0);try{let{created:c,startCampaign:l}=await th(R,s,u,d),f=String(c.workdir||d||``);return r.setQueryData([`projects`],t=>({local_cwd:t?.local_cwd??e,projects:[{id:c.sid,label:s||c.sid,display_name:s,objective:``,launch_cwd:f,workdir:f,last_active:Date.now()/1e3,daemon_alive:!1,daemon_pid:null,uptime_seconds:null},...(t?.projects??[]).filter(e=>e.id!==c.sid)]})),a(c.sid),i(),window.setTimeout(n,0),t(l?`info`:`success`,l?o?o(`new.createdStarting`):`Session created and selected. Campaign is starting in the background.`:o?o(`new.createdIdle`):`Session created and selected.`),l&&l().then(()=>{r.invalidateQueries({queryKey:[`snapshot`,c.sid]}),i(),t(`success`,`Campaign started.`)}).catch(e=>{t(`error`,`Session was created, but the campaign could not start: ${nh(e)}`)}),!0}catch(e){return t(`error`,`Could not create session: ${nh(e)}`),!1}finally{l.current=!1,c(!1)}},creatingDaemon:s}}var ih=e=>e instanceof Error?e.message:String(e||`Unknown error`);function ah({actions:e,manageActions:t,manageTargetSid:n,setManageTargetSid:r,activeSid:i,clearProjectSelection:a,continuous:o,notify:s,refetchProjects:c,selectProject:l,setDaemonManageOpen:u}){let d=e.startDaemon.isPending||e.stopDaemon.isPending||e.forceStopDaemon.isPending||t.startDaemon.isPending||t.forceStopDaemon.isPending||t.updateProject.isPending||t.deleteProject.isPending,f=(0,G.useCallback)(e=>({onSuccess:()=>s(`success`,e),onError:e=>s(`error`,ih(e))}),[s]),p=(0,G.useCallback)(()=>e.startDaemon.mutate(void 0,f(`Daemon start requested.`)),[f,e.startDaemon]),m=(0,G.useCallback)(()=>e.forceStopDaemon.mutate(void 0,f(`Stop requested; the verified daemon process is being interrupted.`)),[f,e.forceStopDaemon]),h=(0,G.useCallback)(async()=>{try{return await t.startDaemon.mutateAsync(),s(`success`,`Daemon resumed.`),!0}catch(e){return s(`error`,ih(e)),!1}},[t.startDaemon,s]),g=(0,G.useCallback)(async()=>{try{return await t.forceStopDaemon.mutateAsync(),await c(),s(`success`,`Daemon stopped. This session can now be deleted.`),!0}catch(e){return s(`error`,ih(e)),!1}},[t.forceStopDaemon,s,c]),_=(0,G.useCallback)(async e=>{if(!n)return!1;try{return await t.updateProject.mutateAsync({sid:n,name:e}),s(`success`,`Session name updated.`),!0}catch(e){return s(`error`,ih(e)),!1}},[t.updateProject,n,s]),v=(0,G.useCallback)(async()=>{if(!n)return!1;try{let e=n,o=await t.deleteProject.mutateAsync();u(!1),r(null);let d=await c();if(e===i){a(`replace`);let e=Yd(d.data?.projects??[])[0];e&&l(e.id,`replace`)}return s(`success`,o.workdir_preserved?`Session moved to recoverable trash. Files remain in ${o.workdir}.`:`Session moved to recoverable trash.`),!0}catch(e){return s(`error`,ih(e)),!1}},[i,a,t.deleteProject,n,s,c,l,u,r]),y=(0,G.useCallback)(e=>{r(e),u(!0)},[u,r]);return{daemonBusy:d,manageDeleteProject:v,manageStopDaemon:g,manageRenameProject:_,manageStartDaemon:h,requestDispose:(0,G.useCallback)((t,n)=>e.disposeBacklog.mutate({id:t,op:n},{onSuccess:()=>s(`success`,n===`done`?`Work marked done.`:`Work removed.`),onError:e=>s(`error`,ih(e))}),[e.disposeBacklog,s]),requestManageSession:y,requestStartDaemon:p,requestStopDaemon:m,requestStopIteration:(0,G.useCallback)(t=>e.stopBacklog.mutate(t,{onSuccess:()=>s(`success`,`Iteration stopped.`),onError:e=>s(`error`,ih(e))}),[e.stopBacklog,s]),toggleContinuous:(0,G.useCallback)(()=>{if(!o)return;let t=!o.enabled;e.setContinuous.mutate({enabled:t,objective:o.objective},f(t?`Continuous campaign enabled.`:`Continuous campaign stopped.`))},[f,e.setContinuous,o])}}function oh({focusComposer:e,openHelp:t,toggleKiosk:n,togglePalette:r,toggleReasoning:i,toggleSidebarCollapse:a}){(0,G.useEffect)(()=>{let o=o=>{let s=o.target,c=s?.tagName===`INPUT`||s?.tagName===`TEXTAREA`,l=o.metaKey||o.ctrlKey;l&&o.key.toLowerCase()===`k`?(o.preventDefault(),r()):l&&o.key.toLowerCase()===`t`?(o.preventDefault(),i()):l&&o.key===`.`?(o.preventDefault(),n()):l&&o.key.toLowerCase()===`b`?(o.preventDefault(),a()):l&&o.key.toLowerCase()===`j`?(o.preventDefault(),e()):!c&&o.key===`?`?(o.preventDefault(),t()):!c&&o.key===`/`&&(o.preventDefault(),e())};return window.addEventListener(`keydown`,o),()=>window.removeEventListener(`keydown`,o)},[e,t,n,r,i,a])}var sh=e=>e instanceof Error?e.message:String(e||`Unknown error`),ch=`argus.decision.prompted.v1`,lh=()=>{try{return window.sessionStorage.getItem(ch)??``}catch{return``}},uh=e=>{try{window.sessionStorage.setItem(ch,e)}catch{}};function dh({activeSid:e,currentTaskId:t,autoOpen:n=!0,backlog:r,notify:i,pendingQuestions:a,refetchSnapshot:o}){let[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),p=(0,G.useRef)(!1),m=(0,G.useRef)(``),h=(0,G.useMemo)(()=>{let e=(r??[]).map(e=>({...e,operator_decision:e.operator_decision}));return Xr(a??[],e,t)},[r,a,t]),g=h[0]??null,_=r!==void 0||a!==void 0,v=s!==null&&s.sid===e,y=v?{...s.card,is_current_task:t&&s.card.kind!==`domain_intake`?s.card.item_id===t:void 0}:g;return(0,G.useEffect)(()=>{if(s&&(s.sid!==e||_&&!l&&!h.some(e=>e.id===s.card.id))&&c(null),!e||!g||!n&&g.kind!==`domain_intake`||v||l)return;let t=`${e}:${g.id}`;m.current!==t&&lh()!==t&&(m.current=t,uh(t),f(``),c({sid:e,card:g}))},[e,n,h,_,g,s,v,l]),{answerPendingReply:async(t,n)=>{if(!(!e||!y||p.current)){p.current=!0,u(!0),f(``);try{let r=y.kind===`domain_intake`?await R.answerDomain(e,y.id,t,n):y.legacy?await R.answerPending(e,y.item_id,n):await R.resolveDecision(e,y.id,t,n);if(r.resolved===!1||`kind`in r&&[`error`,`cancelled`].includes(String(r.kind))){f(String(r.reply||`Could not send answer.`)),await o();return}c(e=>e===s?null:e),await o(),r.daemon&&Number(r.daemon.rc??0)!==0?i(`error`,`Answer queued, but the daemon did not start: ${r.daemon.error||`operator action required`}`):y.kind!==`domain_intake`&&i(`success`,String(r.reply||`Manager delivered your answer to the team.`))}catch(e){f(sh(e)),i(`error`,`Could not send answer: ${sh(e)}`),await o()}finally{p.current=!1,u(!1)}}},pendingReply:y,pendingReplyBusy:l,pendingReplyError:d,pendingReplyOpen:v,setPendingReplyOpen:t=>{f(``),t?e&&g&&c(t=>t?.sid===e?t:{sid:e,card:g}):c(null)}}}var fh=`argus.browser.project.v1`;function ph(){try{return window.sessionStorage.getItem(fh)}catch{return null}}function mh(e){try{e?window.sessionStorage.setItem(fh,e):window.sessionStorage.removeItem(fh)}catch{}}function hh(e,t){let n=new URL(window.location.href);e?n.searchParams.set(`project`,e):n.searchParams.delete(`project`);let r=t===`push`?`pushState`:`replaceState`;window.history[r](window.history.state,``,n.toString())}function gh({cancelActiveMessage:e,notify:t,formatProjectMissing:n,projects:r,projectsError:i,projectsReady:a,queryClient:o,setArtifactPath:s,setSidebarOpen:c,setTaskItemId:l}){let u=(e,t)=>n?n(e,t):t?`Project “${e}” was not found. Switched to ${t}.`:`Project “${e}” was not found. Create a project to continue.`,d=new URLSearchParams(window.location.search),[f,p]=(0,G.useState)(d.get(`project`)||ph()),m=(0,G.useRef)(f),h=(0,G.useRef)(!1);m.current=f;let g=(0,G.useCallback)(t=>{t!==m.current&&(e(),s(null),l(null)),m.current=t,p(t),mh(t)},[e,s,l]),_=(0,G.useCallback)((e,t=`push`)=>{let n=new URLSearchParams(window.location.search).get(`project`);g(e),n!==e&&hh(e,t)},[g]),v=(0,G.useCallback)((e=`replace`)=>{let t=new URLSearchParams(window.location.search).get(`project`);g(null),t!=null&&hh(null,e)},[g]),y=(0,G.useCallback)(e=>{o.prefetchQuery({queryKey:[`snapshot`,e],queryFn:({signal:t})=>R.prefetchSnapshot(e,t),staleTime:3e3})},[o]);return(0,G.useEffect)(()=>{if(!a)return;let e=h.current,n=Qd(r,m.current,e);if(!e&&(h.current=!0,n.id===m.current?mh(n.id):g(n.id),new URLSearchParams(window.location.search).get(`project`)!==n.id&&hh(n.id,`replace`),n.recovered)){let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}},[g,n,t,r,a]),(0,G.useEffect)(()=>{let e=()=>{let e=new URLSearchParams(window.location.search).get(`project`);if(c(!1),!e){g(null);return}if(!a){g(e);return}let n=Zd(r,e);if(g(n.id),n.recovered){hh(n.id,`replace`);let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[g,t,r,a,c]),{activateProject:g,activeSid:a?f&&r.some(e=>e.id===f)?f:null:i?f:null,clearProjectSelection:v,prefetchProject:y,selectProject:_,sid:f,sidRef:m}}var _h={text:``,attachments:[],revision:0};function vh(e){let t=(0,G.useRef)(new Map),n=(0,G.useRef)(new Map),r=(0,G.useRef)(0),i=(0,G.useRef)(!0),[,a]=(0,G.useReducer)(e=>e+1,0);(0,G.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let o=(0,G.useCallback)((e,n)=>{let o={text:n.text,attachments:[...n.attachments],revision:++r.current};return t.current.set(e,o),i.current&&a(),{sid:e,...o}},[]),s=(0,G.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??_h;o(e,{...r,text:typeof n==`function`?n(r.text):n})},[o,e]),c=(0,G.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??_h;o(e,{...r,attachments:typeof n==`function`?n(r.attachments):n})},[o,e]),l=(0,G.useCallback)(e=>{if(!e)return null;let n=t.current.get(e);return n||(n={..._h,attachments:[],revision:++r.current},t.current.set(e,n)),{sid:e,...n,attachments:[...n.attachments]}},[]),u=(0,G.useCallback)(e=>i.current&&t.current.get(e.sid)?.revision===e.revision,[]),d=(0,G.useCallback)((e,t)=>u(e)?o(e.sid,{text:``,attachments:e.attachments.filter(e=>!t.includes(e))}):null,[u,o]),f=(0,G.useCallback)((e,t)=>e.sid!==t.sid||!u(e)?!1:(o(t.sid,t),!0),[u,o]),p=(0,G.useCallback)(e=>{if(!e||n.current.has(e))return null;let t={...l(e),request:++r.current};return n.current.set(e,t),a(),t},[l]),m=(0,G.useCallback)((e,t)=>{if(n.current.get(e.sid)!==e)return!1;n.current.delete(e.sid);let r=u(e);return r&&t!==void 0?o(e.sid,{...e,text:t}):i.current&&a(),r},[u,o]),h=(0,G.useCallback)(e=>{t.current.delete(e),n.current.delete(e),i.current&&a()},[]);return{draft:(e?t.current.get(e):null)??_h,rewriting:!!(e&&n.current.has(e)),setText:s,setAttachments:c,capture:l,consume:d,restore:f,beginRewrite:p,finishRewrite:m,drop:h}}function yh(e,t){if(!t.loadedSid||t.loadedSid!==t.sidRef.current)return null;let n=t.receipts.filter(t=>{let n=Or(t);return n?.deliveryId===e.deliveryId&&n.title===e.title&&n.summary===e.summary&&(!e.path||Ko(t).some(t=>t.path===e.path))}),r=!!(t.completionId&&t.completionId===e.deliveryId);return n.length+Number(r)===1?t.loadedSid:null}function bh(e){let t=(0,G.useRef)(e);t.current=e;let n=(0,G.useRef)(null),[r,i]=(0,G.useReducer)(e=>e+1,0),a=(0,G.useCallback)(()=>{n.current?.controller.abort(),n.current=null},[]),o=(0,G.useCallback)((e,r)=>{n.current===e&&(a(),t.current.notify(`error`,`Cannot open notification: ${xt(r)}. No other session was used.`))},[a]);return(0,G.useEffect)(()=>{let e=Ir(e=>{a();let r=e.sessionId??yh(e,t.current);if(!r){t.current.notify(`info`,`This older notification cannot be automatically located. Select its session and open the result manually.`);return}if(!Cr(r)){t.current.notify(`error`,`Cannot open notification: invalid session identity.`);return}let s={payload:e,target:null,phase:`resolving`,controller:new AbortController};n.current=s,t.current.queryClient.fetchQuery({queryKey:[`projects`],queryFn:R.projectIndex,staleTime:0}).then(e=>{if(n.current===s){if(!e.projects.some(e=>e.id===r))throw Error(`the target session is unavailable or no longer accessible`);s.target=r,s.phase=`loading`,t.current.selectProject(r),i()}}).catch(e=>o(s,e))});return window.addEventListener(`popstate`,a),()=>{e(),window.removeEventListener(`popstate`,a),a()}},[a,o]),(0,G.useEffect)(()=>{let e=n.current;if(!e?.target)return;let r=t.current;if(r.sidRef.current!==e.target){a();return}if(e.phase!==`loading`)return;if(r.snapshotError){o(e,r.snapshotError);return}if(r.loadedSid!==e.target)return;e.phase=`opening`;let i=e.payload.path;if(!i){n.current=null,r.noPath(),r.notify(`info`,`Notification session opened. This notification does not identify a file.`);return}R.artifact(e.target,i,e.controller.signal).then(r=>{let a=t.current;if(n.current!==e||a.sidRef.current!==e.target||a.loadedSid!==e.target)return;if(!r.exists||r.path!==i)throw Error(`the target file is unavailable`);n.current=null;let o=a.receipts.find(t=>t.delivery_id===e.payload.deliveryId&&Ko(t).some(e=>e.path===i));o?a.openDelivery(o,i):a.focusPath(i)}).catch(t=>o(e,t))},[e.selectedSid,e.loadedSid,e.snapshotError,r,a,o]),a}function xh(e,t,n){let r=n?t+8:56,i=Math.max(320,e-r-360-8);return Math.max(320,Math.min(840,i,Math.round(e*.45)))}var Sh=[`mission`,`activity`,`workbench`,`map`],Ch=`argus.workspace.view.v3`;function wh(e){return Sh.includes(e)}function Th(e,t){let n=kt(e);return n==null?t:n===`true`}function Eh(){let e=new URLSearchParams(window.location.search),[t,n]=(0,G.useState)(e.get(`kiosk`)===`1`),[r,i]=(0,G.useState)(()=>Th(`argus.reasoning.visible.v1`,!1)),[a,o]=(0,G.useState)(()=>{let t=e.get(`view`);if(wh(t))return t;let n=kt(Ch);return wh(n)?n:e.get(`kiosk`)===`1`?`map`:`activity`}),s=(0,G.useCallback)(e=>{Ot(Ch,e),o(e)},[]),[c,l]=(0,G.useState)(`activity`),[u,d]=(0,G.useState)(()=>Th(`argus.preview.expanded.v6`,!1)),[f,p]=(0,G.useState)(()=>{let e=Number(kt(`argus.sidebar.width.v2`)||256);return Number.isFinite(e)?Math.max(220,Math.min(400,e)):256}),[m,h]=(0,G.useState)(()=>{let e=Number(kt(`argus.preview.width.v2`)||440);return Number.isFinite(e)?Math.max(320,Math.min(840,e)):440}),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(()=>Th(`argus.sidebar.expanded.v4`,!0)),{themeMode:b,themeStyle:x,cycleTheme:S}=Mt(),C=(0,G.useRef)(null),w=(0,G.useRef)(null);(0,G.useEffect)(()=>{Ot(`argus.sidebar.expanded.v4`,String(v)),Ot(`argus.preview.expanded.v6`,String(u)),Ot(`argus.sidebar.width.v2`,String(f)),Ot(`argus.preview.width.v2`,String(m))},[v,f,u,m]),(0,G.useEffect)(()=>{Ot(`argus.reasoning.visible.v1`,String(r))},[r]);let T=(0,G.useCallback)(()=>{d(!0),l(`preview`);let e=C.current?.clientWidth??window.innerWidth;if(e>=1024){let t=xh(e,f,v);h(e=>Math.max(e,t))}},[v,f]),E=(0,G.useCallback)((e,t)=>{let n=C.current;if(!n)return;t.preventDefault();let r=n.getBoundingClientRect(),i=e===`left`?f:m;n.dataset.resizing=e,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let a=t=>{if(e===`left`){let e=u?m+8:0,n=Math.max(220,Math.min(400,r.width-e-360-8));i=Math.max(220,Math.min(n,t.clientX-r.left))}else{let e=v?f+8:56,n=Math.max(320,Math.min(840,r.width-e-360-8));i=Math.max(320,Math.min(n,r.right-t.clientX))}w.current??=window.requestAnimationFrame(()=>{n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),w.current=null})},o=()=>{w.current!=null&&window.cancelAnimationFrame(w.current),w.current=null,n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),e===`left`?p(i):h(i),delete n.dataset.resizing,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o,{once:!0}),window.addEventListener(`pointercancel`,o,{once:!0})},[v,f,u,m]);return(0,G.useEffect)(()=>{let e=()=>{if(window.innerWidth<1024||!C.current)return;let e=C.current.clientWidth,t=v?f:56,n=u?m:0,r=(v?8:0)+(u?8:0),i=Math.max(540,e-360-r);if(t+n<=i)return;let a=u?Math.max(320,Math.min(m,i-t)):n,o=v?Math.max(220,Math.min(f,i-a)):t;o+a>i&&u&&(a=Math.max(320,i-o)),v&&p(o),u&&h(a)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[v,f,u,m]),{cycleTheme:S,kiosk:t,leftPanelOpen:v,leftWidth:f,mobileView:c,openPreview:T,resizeSidebar:E,rightPanelOpen:u,rightWidth:m,setKiosk:n,setLeftPanelOpen:y,setLeftWidth:p,setMobileView:l,setRightPanelOpen:d,setRightWidth:h,setShowReasoning:i,setSidebarOpen:_,setWorkspaceView:s,shellRef:C,showReasoning:r,sidebarOpen:g,themeMode:b,themeStyle:x,workspaceView:a}}function Dh(e){let t=e.trim();if(!t||/\s/.test(t))return``;if(!t.includes(`?`)&&!t.includes(`://`))return t;try{return new URL(t,window.location.href).searchParams.get(`token`)?.trim()??``}catch{return``}}function Oh(e){try{let t=new URL(window.location.href),n=new URL(e.trim(),t);return n.origin===t.origin&&/^\/pair\/[\w-]{32}$/.test(n.pathname)?n.toString():``}catch{return``}}function kh({error:e,onRetry:t}){let{t:n}=z(),r=de(e),i=e instanceof Te,[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``);return!r&&!i?null:(0,J.jsxs)(`div`,{role:`alert`,className:`fixed left-1/2 top-3 z-[100] flex w-[min(92vw,42rem)] -translate-x-1/2 flex-wrap items-start gap-3 rounded-xl border border-err/50 bg-panel/95 px-4 py-3 text-left text-sm text-ink shadow-xl backdrop-blur`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 font-mono font-bold text-err`,children:`!`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`strong`,{className:`block text-err`,children:n(r?`connection.pairingTitle`:`connection.unreachableTitle`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-ink-dim`,children:n(r?`connection.pairingDetail`:`connection.unreachableDetail`)})]}),r&&!a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`shrink-0 rounded-md border border-blue/45 bg-blue/10 px-2.5 py-1 text-xs font-medium text-blue hover:bg-blue/15`,children:n(`connection.pairAgain`)}):r?null:(0,J.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded-md border border-err/40 px-2.5 py-1 text-xs text-err hover:bg-err/10`,children:n(`common.retry`)}),r&&a?(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=Oh(s);if(t){window.location.replace(t);return}let r=Dh(s);if(!r){u(n(`connection.pairingInvalid`));return}let i=new URL(window.location.href);i.searchParams.set(`token`,r),window.location.replace(i.toString())},className:`flex w-full basis-full flex-wrap gap-2 pl-7`,children:[(0,J.jsx)(`label`,{className:`sr-only`,htmlFor:`pairing-link`,children:n(`connection.pairingInput`)}),(0,J.jsx)(`input`,{id:`pairing-link`,"data-autofocus":!0,type:`password`,autoComplete:`off`,value:s,onChange:e=>{c(e.target.value),u(``)},placeholder:n(`connection.pairingPlaceholder`),className:`h-9 min-w-0 flex-1 rounded-md border border-line bg-bg px-3 text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`submit`,className:`h-9 rounded-md border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white`,children:n(`connection.connect`)}),l?(0,J.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-err`,children:l}):null]}):null]})}function Ah(e){try{let t=JSON.parse(kt(e)||`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function jh(e,t,n,r=!0){let i=(0,G.useRef)(),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),l=(0,G.useCallback)(t=>{if(!e)return;let n=`argus.delivery.seen.v1:${e}`;Ot(n,JSON.stringify([...new Set([...Ah(n),t])].slice(-80)))},[e]),u=(0,G.useCallback)((t,n)=>{if(!e)return;l(t.delivery_id);let r=Ko(t),i=r.find(e=>e.path===n)?.path||r[0]?.path||null;o({sid:e,receipt:t,path:i}),c(null)},[e,l]);return(0,G.useEffect)(()=>{if(!e||!t)return;let a=n?.delivery_id;if(i.current?.sid!==e){i.current={sid:e,ids:new Set(a?[a]:[])},o(null),c(null);return}!a||i.current.ids.has(a)||!r||(i.current.ids.add(a),n&&Ko(n).length&&!Ah(`argus.delivery.seen.v1:${e}`).includes(a)&&c({sid:e,receipt:n}))},[e,t,n,r]),{selection:a?.sid===e?a:null,open:u,fresh:s?.sid===e?s.receipt:null,dismissFresh:(0,G.useCallback)(()=>c(null),[]),close:(0,G.useCallback)(()=>o(null),[]),selectPath:(0,G.useCallback)(e=>o(t=>t&&{...t,path:e}),[])}}var Mh=e({default:()=>Lh}),Nh=0,Ph=(0,G.lazy)(async()=>({default:(await Ne(()=>import(`./ResearchWorkbenchPanel-CZOLmyKI.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url)).ResearchWorkbenchPanel})),Fh=(0,G.lazy)(async()=>({default:(await Ne(()=>import(`./MapPanel-BJMQIQc6.js`),__vite__mapDeps([13,1,2,3,4,5,6,7,8,14,10,15,11,16]),import.meta.url)).MapPanel}));function Ih(e,t){let[n,r]=(0,G.useState)(e),i=(0,G.useRef)(e),a=(0,G.useRef)(null),o=(0,G.useRef)(0);return i.current=e,(0,G.useEffect)(()=>{if(e===n)return;let s=o.current+t-Date.now();if(s<=0){o.current=Date.now(),r(e);return}a.current||=setTimeout(()=>{a.current=null,o.current=Date.now(),r(i.current)},s)},[e,n,t]),(0,G.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),n}function Lh(){let{locale:e,t}=z(),n=e=>e instanceof ce?t(`connection.pairingDetail`):xt(e),r=M(),i=Ce(),a=De(),o=(0,G.useMemo)(()=>Yd(eh(i.data?.projects??[],a.data?.projects??[])),[a.data?.projects,i.data?.projects]),s=i.data?.local_cwd??``,c=[i.error,a.error].find(e=>ze(e)),[l,u]=(0,G.useState)(`none`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(`feed`),h=(0,G.useCallback)(e=>{f(null),m(e),u(`learning`)},[]),g=(0,G.useCallback)((e,t=`recent`)=>{f(e?{kind:`skill`,item:e}:null),m(e?.scope??(t===`recent`?`feed`:t)),u(`learning`)},[]),_=(0,G.useCallback)(e=>{f(e?{kind:`knowledge`,item:e}:null),m(e?.scope===`private`?`global`:e?.scope??`feed`),u(`learning`)},[]),{cycleTheme:v,kiosk:y,leftPanelOpen:b,leftWidth:x,mobileView:S,openPreview:C,resizeSidebar:w,rightPanelOpen:T,rightWidth:E,setKiosk:D,setLeftPanelOpen:O,setLeftWidth:k,setMobileView:A,setRightPanelOpen:j,setRightWidth:ee,setShowReasoning:N,setSidebarOpen:P,setWorkspaceView:F,shellRef:te,showReasoning:re,sidebarOpen:ie,themeMode:I,workspaceView:L}=Eh(),[oe,se]=(0,G.useState)(()=>L===`mission`?`mission`:`activity`),[le,ue]=(0,G.useState)(L===`workbench`);(0,G.useEffect)(()=>{if(L===`workbench`){ue(!0);return}L!==`map`&&se(L)},[L]);let de=Vm(),[fe,pe]=(0,G.useState)(0),[me,he]=(0,G.useState)(0),[ge,ve]=(0,G.useState)(`auto`),[ye,be]=(0,G.useState)(!1),[we,Te]=(0,G.useState)([]),ke=(0,G.useRef)(null),[Me,Ne]=(0,G.useState)([]),[Fe,Ie]=(0,G.useState)(null),[Le,Re]=(0,G.useState)({path:``,token:0}),[Be,Ve]=(0,G.useState)(null),[He,B]=(0,G.useState)(!1),[Ue,We]=(0,G.useState)(null),[Ge,Ke]=(0,G.useState)(null),qe=(0,G.useRef)(!1),Je=(0,G.useRef)(null),Ye=(0,G.useRef)(0),V=(0,G.useRef)(),Xe=(0,G.useRef)({sid:``,completionId:``,view:null,artifacts:[]}),Ze=(0,G.useRef)(()=>void 0),[Qe,$e]=(0,G.useState)(null),[et,tt]=(0,G.useReducer)($m,Qm),[rt,H]=(0,G.useState)(`all`),[it,at]=(0,G.useState)(``),ot=(0,G.useCallback)(()=>$e(null),[]),st=(0,G.useCallback)((e,t)=>{$e({id:++Nh,tone:e,message:t})},[]),ct=(0,G.useCallback)(()=>{let e=!!Je.current;return Ye.current+=1,Je.current?.controller.abort(),Je.current=null,be(!1),Ne([]),e},[]),ut=(0,G.useCallback)(()=>{let e=Je.current;if(!e||!ct())return;let n=Ye.current;st(`info`,t(`chat.stoppingReply`)),R.cancelMessage(e.sid,e.serverRequestId).then(e=>{Ye.current===n&&st(`info`,t(e.requested?`chat.stopReplyRequested`:`chat.replyAlreadyFinished`))}).catch(e=>{Ye.current===n&&st(`error`,t(`chat.stopReplyFailed`,{error:xt(e)}))})},[ct,st,t]),{activeSid:U,clearProjectSelection:W,prefetchProject:ft,selectProject:pt,sid:mt,sidRef:ht}=gh({cancelActiveMessage:ct,notify:st,formatProjectMissing:(e,n)=>n?t(`project.missingSwitched`,{requested:e??``,fallback:n}):t(`project.missingCreate`,{requested:e??``}),projects:o,projectsError:i.isError,projectsReady:i.isSuccess,queryClient:r,setArtifactPath:Ie,setSidebarOpen:P,setTaskItemId:Ve}),{draft:{text:gt,attachments:_t},rewriting:vt,setText:yt,setAttachments:bt,capture:St,consume:Ct,restore:wt,beginRewrite:Tt,finishRewrite:Dt,drop:Ot}=vh(mt),kt=(0,G.useCallback)((e,t)=>{Ze.current(),pt(e,t)},[pt]),At=(0,G.useCallback)(e=>{Ze.current(),W(e)},[W]);(0,G.useEffect)(()=>ve(`auto`),[U]),(0,G.useEffect)(()=>{Re(e=>e.path?{path:``,token:e.token+1}:e)},[mt]),(0,G.useEffect)(()=>()=>{Ye.current+=1,Je.current?.controller.abort(),Je.current=null},[]),(0,G.useEffect)(()=>Rr(),[]);let jt=(0,G.useCallback)(e=>{let t=(e||``).trim(),n=ht.current;if(!t||!n)return;let r=Tt(n);r&&R.rewritePrompt(n,t).then(e=>{if(e.error||!e.rewritten.trim()){Dt(r)&&ht.current===n&&st(`error`,`Rewrite failed: ${e.error||`empty rewrite`} — your prompt is unchanged`);return}if(!Dt(r,e.rewritten)||ht.current!==n)return;pe(e=>e+1);let t=e.questions.length?` Manager asks: ${e.questions.join(` · `)}`:``;st(`success`,`Prompt rewritten — review it, then send.${t}`)},e=>{Dt(r)&&ht.current===n&&st(`error`,`Rewrite failed: ${xt(e)} — your prompt is unchanged`)})},[Tt,Dt,st,ht]),{createDaemon:Mt,creatingDaemon:Nt}=rh({localCwd:s,notify:st,onFocusComposer:()=>pe(e=>e+1),queryClient:r,refetchProjects:i.refetch,selectProject:kt,translate:t}),Pt=(0,G.useCallback)(()=>{Mt(``,``,``)},[Mt]),zt=(0,G.useRef)(Pt);zt.current=Pt,(0,G.useEffect)(()=>Lr(()=>zt.current()),[]);let Vt=Se(U),Ht=Se(Ue),K=Vt.data,q=K?.session.id===U?U:null,Ut=K?.continuous,Wt=_e(q,!0),Gt=Pe(q,oe===`mission`),{events:Kt,connected:qt}=Ee(q,et.reconnectKey),Jt=(0,G.useMemo)(()=>Oe(Kt),[Kt]),Yt=(0,G.useMemo)(()=>je(Kt),[Kt]);(0,G.useEffect)(()=>{if(!q||!Jt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`artifacts`,q],exact:!0})},180);return()=>window.clearTimeout(e)},[Jt,q,r]),(0,G.useEffect)(()=>{if(!q||!Yt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`snapshot`,q],exact:!0})},80);return()=>window.clearTimeout(e)},[q,r,Yt]);let Xt=(0,G.useMemo)(()=>qm(Kt),[Kt]),{query:Zt,events:Qt,status:$t}=Bt(q,oe===`activity`,Kt,we,ke.current),en=q&&K?.manager_requests?.filter(e=>e.status===`running`).at(-1)?.request_id||``,tn=ye||!!en;(0,G.useEffect)(()=>{if(!q)return;let e=Je.current;if(en){e||(Je.current={id:++Ye.current,serverRequestId:en,sid:q,controller:new AbortController,recovered:!0},be(!0));return}e?.recovered&&e.sid===q&&(Je.current=null,be(!1),Ne([]),Zt.refetch())},[en,q,Zt.refetch]);let nn=xe(U,20,l===`inspector`),rn=Ih((0,G.useMemo)(()=>({sid:q,events:Kt,conversation:Qt}),[q,Kt,Qt]),250),an=rn.sid===q?rn.events:[],on=rn.sid===q?rn.conversation:[],sn=(0,G.useMemo)(()=>K?If(K,Qt,Wt.data??[]):null,[Qt,Wt.data,K]),{answerPendingReply:cn,pendingReply:ln,pendingReplyBusy:un,pendingReplyError:dn,pendingReplyOpen:fn,setPendingReplyOpen:pn}=dh({activeSid:U,currentTaskId:sn?.mission.id,autoOpen:L!==`map`,backlog:K?.backlog,notify:st,pendingQuestions:K?.pending_questions,refetchSnapshot:Vt.refetch}),mn=K?.daemon.alive&&sn?.routing.vertical===`research`?sn.active_role.startsWith(`reviewer`)?`reviewing`:sn.active_role.startsWith(`engineer`)?`revising`:void 0:void 0,hn=Yo((0,G.useMemo)(()=>mu(Qt),[Qt]),sn?.delivery??null,Qt),gn=K?.backlog.some(e=>[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))??!1,_n=Uf(sn)&&!gn&&!K?.continuous?.enabled,vn=q&&_n&&sn?.mission.id?`completion:${q}:${sn.mission.id}`:``;Xe.current={sid:q||``,completionId:vn,view:sn,artifacts:Wt.data??[]};let yn=(0,G.useCallback)(()=>{C()},[C]),bn=(0,G.useCallback)((e,t=!0)=>{let n=e.trim();if(!n){t&&F(`map`);return}if(L===`map`||!Wt.data?.some(e=>e.path===n&&e.exists)){Ie(n);return}j(!0),A(`preview`),Re(e=>({path:n,token:e.token+1}))},[Wt.data,A,j,F,L]),xn=jh(q,!!K&&!Zt.isPending,hn,!Fe&&!Xo(K?.backlog??[],hn?.item_id)),Sn=xn.open,Cn=(0,G.useMemo)(()=>{let e=new Map;for(let t of Qt){let n=t.delivery;n?.delivery_id&&Array.isArray(n.targets)&&e.set(n.delivery_id,n)}for(let t of[sn?.delivery,hn])t&&e.set(t.delivery_id,t);return[...e.values()].filter(e=>Ko(e).length).sort((e,t)=>t.delivered_at-e.delivered_at)},[Qt,sn?.delivery,hn]);(0,G.useEffect)(()=>{q&&hn?.delivery_id&&r.invalidateQueries({queryKey:[`artifacts`,q],exact:!0})},[q,hn?.delivery_id,r]),(0,G.useEffect)(()=>{if(!q)return;let e=V.current;if(!e||e.sid!==q){V.current={sid:q,id:vn||null};return}if(!vn){V.current={sid:q,id:null};return}if(e.id===vn)return;let n=window.setTimeout(()=>{let e=Xe.current;if(e.sid!==q||e.completionId!==vn||!e.view)return;let n=e.view.delivery,r=Jf(e.artifacts),i=Dr({completionId:vn,sessionId:q,title:n?.title||e.view.mission.title||t(`mission.taskCompleted`),summary:n?.summary||e.view.mission.summary,path:n?.primary_target?.path||r?.path});i&&Nr(i),V.current={sid:q,id:vn}},500);return()=>window.clearTimeout(n)},[vn,q,t]),Ze.current=bh({selectedSid:mt,loadedSid:q,sidRef:ht,snapshotError:Vt.error,queryClient:r,receipts:Zt.isPending?[]:Cn,completionId:vn,selectProject:e=>{pt(e),P(!1)},openDelivery:Sn,focusPath:e=>{Wt.data?.some(t=>t.path===e&&t.exists)?bn(e):Ie(e)},noPath:()=>{A(`activity`),F(`map`)},notify:st});let wn=(0,G.useRef)(Qt);wn.current=Qt,(0,G.useEffect)(()=>{H(`all`),at(``),Te([]),tt({kind:`reset`})},[q]);let Tn=Ae(U,K?.daemon_commands?.revision),En=Ae(Ue,Ht.data?.daemon_commands?.revision),Dn=(0,G.useCallback)(async e=>{Ke(e);try{await R.startDaemon(e),await i.refetch(),st(`success`,t(`sidebar.resumeSuccess`))}catch(e){st(`error`,t(`sidebar.resumeFailed`,{error:xt(e)}))}finally{Ke(null)}},[st,i,t]),{daemonBusy:On,manageDeleteProject:kn,manageStopDaemon:An,manageRenameProject:jn,manageStartDaemon:Mn,requestDispose:Nn,requestManageSession:Pn,requestStartDaemon:Fn,requestStopDaemon:In,requestStopIteration:Ln,toggleContinuous:Rn}=ah({actions:Tn,manageActions:En,manageTargetSid:Ue,setManageTargetSid:We,activeSid:U,clearProjectSelection:At,continuous:Ut,notify:st,refetchProjects:i.refetch,selectProject:kt,setDaemonManageOpen:B}),zn=(0,G.useCallback)(async e=>{if(!U)return;let t=await Tn.updateProject.mutateAsync({sid:U,name:e});st(`success`,`Renamed to "${t.name}".`)},[Tn.updateProject,U,st]),Bn=(0,G.useMemo)(()=>Ym({activeSid:U,activityEventsRef:wn,notify:st,onClearEvents:e=>tt({kind:`clear`,offset:e}),onDispose:Nn,onOpenConfig:()=>u(`config`),onOpenDoctor:()=>u(`doctor`),onOpenHelp:()=>u(`help`),onOpenIdentity:()=>u(`identity`),onOpenInspector:()=>u(`inspector`),onOpenNewDaemon:Pt,onOpenOperations:()=>u(`operations`),onOpenSidebar:()=>P(!0),onOpenSkills:()=>g(void 0,`global`),onReconnectEvents:()=>tt({kind:`reconnect`}),onRenameProject:zn,onRewriteDraft:jt,onSelectProject:kt,onSetArtifactPath:Ie,onSetEventFilter:H,onSetEventQuery:at,onSetTaskItemId:Ve,onSetWorkspaceView:F,onShowArtifacts:yn,onStopIteration:Ln,onStopWaiting:ut,refetchSnapshot:Vt.refetch}),[U,st,yn,g,zn,Nn,Ln,jt,kt,Vt.refetch,ut,F]);oh({focusComposer:()=>pe(e=>e+1),openHelp:()=>u(`help`),toggleKiosk:()=>D(e=>!e),togglePalette:()=>u(e=>e===`palette`?`none`:`palette`),toggleReasoning:()=>N(e=>!e),toggleSidebarCollapse:()=>O(e=>!e)});let Vn=async(e,n=[],i)=>{let a=U;if(!a||a!==ht.current||qe.current||Je.current)return!1;let o=Ye.current;qe.current=!0;let s,c,l;try{if(!n.length){let t=await Jm(e,Bn);if(t.kind===`handled`)return i?.({type:`settled`,outcome:`message`}),!0;if(t.kind===`error`)return st(`error`,t.message),!1}if(ht.current!==a||Ye.current!==o)return!1;s=++Ye.current,c=ne(),l=new AbortController,Je.current={id:s,serverRequestId:c,sid:a,controller:l}}finally{qe.current=!1}let u=()=>{let e=Je.current;return!!(e&&e.id===s&&e.sid===a&&ht.current===a&&!l.signal.aborted)},d=()=>{Je.current?.id===s&&(Je.current=null,be(!1),Ne([]))};be(!0),Ne([]);let f=[];if(n.length)try{let e=await R.uploadAttachments(a,n,l.signal);if(!u())return!1;f=e.attachments.map(e=>({attachment_id:e.attachment_id}))}catch(e){return u()&&(st(`error`,t(`chat.attachmentUploadFailed`,{error:xt(e)})),d()),!1}let p=ke.current===a;ke.current=a,Te(t=>Ft([...p?t:[],Lt(a,s,e)],a,s,[]));let m=(e,t=``,n=`auto`)=>{!u()||typeof e!=`string`||!e.trim()||Te(r=>Rt(r,a,s,e,t,Date.now(),n))},h=e=>{if(!u())return;let t=e.item;typeof t?.id==`string`&&i?.({type:`task`,taskId:t.id});let n=e.daemon&&typeof e.daemon==`object`?e.daemon:null,r=typeof e.reply==`string`?e.reply:null;n?.admission_required?st(`error`,r||`Task queued, but all daemon slots are busy: ${String(n.error||`operator action required`)}`):n&&Number(n.rc??0)!==0?st(`error`,r||`Task queued, but executor did not start: ${String(n.error||`unknown error`)}`):r&&!i&&st(`success`,r),Vt.refetch?.()},g=e=>{u()&&(r.invalidateQueries({queryKey:[`artifacts`,a]}),Zm(e,{dispatchTask:h,notifyError:e=>st(`error`,e),refetchTranscript:()=>{Zt.refetch()}}))};return(async()=>{let t=!1,n=null,r=[];try{try{await R.messageStream(a,e,{onPhase:(e,t,n)=>{if(!u()||n.heartbeat)return;r=Hl(r,{label:e,role:t,kind:n.kind,detail:n.detail,heartbeat:n.heartbeat,quietS:n.quietS,tool:n.tool,toolKind:n.toolKind,callId:n.callId,status:n.status,output:n.output}),Ne(r);let i=Gl(r);i.length&&Te(e=>Ft(e,a,s,i,Date.now(),!0))},onDelta:(e,n,r)=>{u()&&(t=!0,m(e,n,r===`append`||r===`snapshot`?r:`auto`))},onDone:e=>{if(!u())return;e.kind!==`error`&&ve(`auto`),r=Ul(r),Ne(r);let t=Jl(e.steps),n=t.length?t:Gl(r,Date.now()/1e3,!0);Te(t=>Ft(t,a,s,n,Date.now(),!1,e.kind===`error`?`failed`:`completed`)),m(e.reply,``,`snapshot`),g(e);let o=e.item;(e.kind!==`task`||typeof o?.id!=`string`)&&i?.({type:`settled`,outcome:e.kind===`error`?`error`:`message`})},onError:e=>{u()&&(n=e)}},{signal:l.signal,attachments:f,routeOverride:ge,requestId:c})}catch(e){u()&&(n=e)}if(!u())return;n&&(st(`error`,Et(n,t)),i?.({type:`settled`,outcome:`error`}))}finally{Te(e=>It(e,s,Date.now(),n&&!l.signal.aborted?`failed`:`stopped`)),l.signal.aborted&&i?.({type:`settled`,outcome:`cancelled`}),d()}})(),!0},Hn=(0,G.useRef)(Vn);Hn.current=Vn;let Un=async(e,t=[],n,r)=>{let i=St(ht.current);if(!i)return!1;if(r?.whileRunning){try{if(!t.length){let n=await Jm(e,Bn);if(n.kind===`error`)return st(`error`,n.message),!1;if(n.kind===`handled`)return Ct(i,t),!0}await R.queueFollowup(i.sid,e,ge)}catch(e){return st(`error`,xt(e)),!1}return Ct(i,t),!0}let a=null,o=!1,s=!t.length&&ju(e.trim())?.cmd?.id===`rewrite`,c=await Vn(e,t,e=>{e.type===`settled`&&e.outcome===`error`&&(o=!0,a&&wt(a,i)),ht.current===i.sid&&n?.(e)});return c&&!o&&!s&&(a=Ct(i,t)),c},Wn=(0,G.useMemo)(()=>{let n=dd(xu,e=>{Hn.current(e)},e=>{yt(e),pe(e=>e+1)},e),r=[...y?[]:[{id:`new`,label:t(`palette.newDaemon`),hint:`+`,group:t(`palette.view`),run:Pt}],{id:`transcript`,label:t(`palette.openTranscript`),hint:`/transcript`,group:t(`palette.view`),run:()=>u(`transcript`)},{id:`inspector`,label:t(`palette.openProject`),hint:t(`palette.projectHint`),group:t(`palette.view`),run:()=>u(`inspector`)},{id:`operations`,label:t(`palette.openOperations`),hint:t(`palette.operationsHint`),group:t(`palette.view`),run:()=>u(`operations`)},{id:`verticals`,label:t(`verticals.openStore`),hint:t(`verticals.paletteHint`),group:t(`palette.view`),run:()=>u(`verticals`)},{id:`help`,label:t(`help.title`),hint:`?`,group:t(`palette.view`),run:()=>u(`help`)},{id:`reasoning`,label:t(re?`palette.hideReasoning`:`palette.showReasoning`),hint:`⌘T`,group:t(`palette.view`),run:()=>N(e=>!e)},{id:`kiosk`,label:t(y?`palette.exitKiosk`:`palette.enterKiosk`),hint:`⌘.`,group:t(`palette.view`),run:()=>D(e=>!e)}],i=y?[]:[{id:`message`,label:t(`palette.messageArgus`),hint:`/`,group:t(`palette.action`),run:()=>pe(e=>e+1)},...tn?[{id:`cancel-message`,label:t(`palette.stopWaiting`),hint:`Esc`,group:t(`palette.action`),run:ut}]:[],...Ut?[{id:`continuous`,label:Ut.enabled?t(`palette.stopContinuous`):t(`palette.startContinuous`),group:t(`palette.action`),run:Rn}]:[],...K?.daemon.control_available===!1?[]:[K?.daemon.alive?{id:`stop`,label:t(`palette.stopDaemon`),group:t(`palette.action`),run:In}:{id:`start`,label:t(`palette.startDaemon`),group:t(`palette.action`),run:Fn}]],a=o.map(e=>({id:`p-${e.id}`,label:Jd(e)?(e.label||e.display_name||``).trim():e.objective.trim()||t(`sidebar.unnamedSession`),hint:e.daemon_alive?`● ${t(`common.live`)}`:`○`,keywords:`${e.id} ${e.display_name??``} ${e.objective} ${e.daemon_alive?`live running`:`stopped idle`}`,group:t(`palette.project`),run:()=>kt(e.id)}));return[...r,...i,...n,...a]},[o,K?.daemon.alive,y,re,Ut?.enabled,tn,ut,yt,e,t]);return(0,J.jsx)(xs,{sid:U,readOnly:y,children:(0,J.jsxs)(nt,{ref:te,style:{"--sidebar-width":`${x}px`,"--preview-width":`${E}px`},children:[(0,J.jsx)(kh,{error:c,onRetry:()=>{i.refetch(),a.refetch()}}),xn.fresh&&!xn.selection&&(0,J.jsxs)(`div`,{className:`delivery-toast`,role:`status`,"aria-live":`polite`,children:[(0,J.jsxs)(`span`,{children:[e===`zh-CN`?`新交付:`:`New delivery: `,xn.fresh.title]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>Sn(xn.fresh),children:e===`zh-CN`?`查看`:`Open`}),(0,J.jsx)(`button`,{type:`button`,"aria-label":e===`zh-CN`?`关闭`:`Dismiss`,onClick:xn.dismissFresh,children:`×`})]}),xn.selection&&(0,J.jsx)(yf,{sid:xn.selection.sid,path:xn.selection.path,delivery:xn.selection.receipt,deliveries:Cn,reviewActivity:xn.selection.sid===q?mn:void 0,onSelectDelivery:Sn,onSelectPath:xn.selectPath,onClose:xn.close},`${xn.selection.sid}:${xn.selection.receipt.delivery_id}`),!y&&ie?(0,J.jsx)(`button`,{type:`button`,"aria-label":t(`common.closeSessions`),onClick:()=>P(!1),className:`fixed inset-0 z-30 bg-black/40 lg:hidden`}):null,y?null:(0,J.jsx)(nm,{projects:o,activeId:U,activeWork:q?{sessionId:q,status:ci(K,sn,Qt),connected:qt&&!Vt.isError}:void 0,localCwd:s,onSelect:e=>{kt(e),P(!1)},onPrefetch:ft,onManage:Pn,onResume:e=>void Dn(e),resumingId:Ge,onOpenPanel:e=>u(e),onOpenLearning:h,onOpenVerticals:()=>u(`verticals`),onNew:Pt,loading:i.isLoading,creating:Nt,error:i.isError?xt(i.error):void 0,onRetry:()=>void i.refetch(),mobileOpen:ie,collapsed:!b,onToggleCollapse:()=>O(e=>!e),themeMode:I,onCycleTheme:v}),!y&&b?(0,J.jsx)(gm,{label:t(`common.resizeSessions`),value:x,min:220,max:400,onPointerDown:e=>w(`left`,e),onReset:()=>k(256),onNudge:e=>k(t=>Math.max(220,Math.min(400,t+e)))}):null,(0,J.jsx)(`main`,{className:`flex min-w-0 flex-1 overflow-x-hidden`,children:K?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`${S===`activity`?`flex`:`hidden`} ${L===`map`&&!y?`mobile-scroll-region`:``} glass-panel glass-panel--main h-full min-w-0 flex-1 flex-col lg:flex`,children:[(0,J.jsx)(qd,{sid:q}),L!==`map`&&(0,J.jsx)(wi,{events:Qt,snap:K,streamOk:qt,onStart:Fn,onStop:In,onManage:()=>U&&Pn(U),busy:On,snapshotStale:Vt.isError,readOnly:y,missionView:sn}),(0,J.jsxs)(`nav`,{"aria-label":t(`mobile.views`),className:`hidden h-11 shrink-0 items-center gap-3 border-b border-line/60 px-5 lg:flex`,children:[(0,J.jsxs)(`div`,{className:`workspace-tabs`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`map`),className:`workspace-tab`,"data-selected":L===`map`,children:t(`mobile.map`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`activity`),className:`workspace-tab`,"data-selected":L===`activity`,children:t(`mobile.activity`)})]}),(0,J.jsxs)(`details`,{className:`workspace-more`,onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,J.jsx)(`summary`,{children:L===`mission`?t(`mobile.mission`):L===`workbench`?t(`mobile.workbench`):e===`zh-CN`?`更多`:`More`}),(0,J.jsxs)(`div`,{className:`workspace-more-menu`,onClick:e=>{e.target.closest(`button`)&&e.currentTarget.closest(`details`)?.removeAttribute(`open`)},children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`mission`),children:t(`mobile.mission`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`reading`),children:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`workbench`),children:t(`mobile.workbench`)}),y?null:(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`operations`),children:t(`mission.operations`)})]})]}),(0,J.jsxs)(`button`,{type:`button`,className:`ml-auto px-2 py-1 text-sm text-ink-dim hover:text-ink`,"aria-expanded":T,onClick:()=>{T?(j(!1),A(`activity`)):yn()},children:[e===`zh-CN`?`文件`:`Files`,Wt.data?.length?` · ${Wt.data.filter(e=>e.exists).length}`:``]})]}),!y&&(0,J.jsx)(tr,{sid:U,onOpenKnowledge:()=>_(),onOpenSkills:()=>g()}),L===`map`&&(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(`div`,{className:`m-auto text-sm text-ink-faint`,children:t(`common.loading`)}),children:(0,J.jsx)(Fh,{snapshot:K,events:an,managerSteps:Me,draft:gt,onDraftChange:yt,onSend:Un,attachments:_t,onAttachmentsChange:bt,pending:tn,onCancel:ut,focusSignal:fe,readOnly:y,onOpenSettings:()=>u(`config`),currentTaskId:sn?.mission.id,routeOverride:ge,onRouteOverrideChange:ve,conversationEvents:on,connected:qt,artifacts:Wt.data??[],deliveryCount:Cn.length,onOpenDelivery:()=>{let e=qo(Cn,sn?.routing.vertical||``);e&&Sn(e.receipt,e.path)},onOpenReceipt:Sn,onOpenArtifact:Ie,onAnswer:()=>pn(!0)},K.session.id)}),(0,J.jsxs)(`div`,{className:`${L===`workbench`||L===`map`?`hidden`:`flex`} min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(Kd,{alert:Xt}),oe===`mission`&&sn?(0,J.jsx)(Am,{events:Qt,connected:qt&&!Vt.isError,view:sn,sid:K.session.id,snapshot:K,gitDiff:Gt.data,artifacts:Wt.data,onOpenArtifact:bn,onOpenDelivery:Sn,onNotify:st,onAsk:y?void 0:e=>{yt(t=>t.trim()?`${t}\n\n${e}`:e),pe(e=>e+1)}}):(0,J.jsx)(`div`,{className:`flex flex-1 flex-col ${de?`min-h-0`:`min-h-[209px] lg:min-h-0`}`,children:(0,J.jsx)(_u,{snapshot:K,missionView:sn,events:Qt,connected:qt&&!Vt.isError,showReasoning:re,onToggleReasoning:()=>N(e=>!e),historyStatus:$t,historyRefreshing:Zt.isFetching,onRetryHistory:()=>void Zt.refetch(),embedded:!0,filter:rt,query:it,skipFirst:et.skipFirst,artifacts:Wt.data,onOpenArtifact:bn,onOpenDelivery:Sn},q)}),y?null:(0,J.jsx)(`div`,{className:`composer-dock shrink-0 px-4 pt-3`,children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-full lg:max-w-[61.8vw]`,children:[(0,J.jsx)(Wd,{questions:K.pending_questions??[],backlog:K.backlog,currentTaskId:sn?.mission.id,onAnswer:()=>pn(!0)}),(0,J.jsx)(ud,{value:gt,attachments:_t,onAttachmentsChange:bt,onChange:yt,onSend:Un,onCancel:ut,disabled:!U,pending:tn,focusSignal:fe,embedded:!0,onRewrite:jt,rewriting:vt,slashSelection:me,onSlashSelectionChange:he,routeOverride:ge,onRouteOverrideChange:ve,footer:U?(0,J.jsx)(Vr,{sid:K.session.id,roles:K.roles,running:K.daemon.alive||!!K.manager_requests?.length,lastCall:K.last_call,onOpenSettings:()=>u(`config`)}):void 0},U||`no-session`)]})})]}),le&&U?(0,J.jsx)(`div`,{className:`${L===`workbench`?`flex`:`hidden`} min-h-0 flex-1`,children:(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-xs text-ink-faint`,children:t(`common.loading`)}),children:(0,J.jsx)(Ph,{sid:U,active:L===`workbench`})})}):null]}),T&&L!==`map`?(0,J.jsx)(gm,{label:t(`common.resizePreview`),value:E,min:320,max:840,onPointerDown:e=>w(`right`,e),onReset:()=>ee(440),onNudge:e=>ee(t=>Math.max(320,Math.min(840,t-e)))}):null,(T&&L!==`map`||S===`preview`)&&(0,J.jsxs)(`aside`,{"data-resizable-panel":`right`,className:`${S===`preview`?`flex`:`hidden`} relative min-w-0 flex-1 flex-col overflow-hidden border-l border-line/60 bg-panel lg:flex lg:flex-none lg:w-[var(--preview-width)]`,children:[(0,J.jsx)(`div`,{className:`lg:hidden`,children:(0,J.jsx)(wi,{events:Qt,snap:K,streamOk:qt,onStart:Fn,onStop:In,onManage:()=>U&&Pn(U),busy:On,snapshotStale:Vt.isError,readOnly:y,missionView:sn})}),(0,J.jsx)(ep,{snapshot:K,connected:qt&&!Vt.isError,sid:q,artifacts:Wt.data,error:Wt.isError,onExpand:Ie,onOpenFile:yn,className:`min-h-0 flex-1 mobile-scroll-region`,embedded:!0,onCollapse:()=>{j(!1),A(`activity`)},missionView:sn,activityEvents:Qt,requestedPath:Le.path,requestedPathToken:Le.token,routeVisible:L!==`mission`})]})]}):(0,J.jsx)(Rm,{loading:i.isLoading||!!(U&&Vt.isLoading),hasProjects:o.length>0,error:i.isError&&o.length===0?n(i.error):Vt.isError&&!K?n(Vt.error):void 0,onRetry:()=>{i.refetch(),U&&Vt.refetch()},onNew:Pt,onChoose:()=>P(!0),canCreate:!y})}),(0,J.jsx)(dt,{open:l===`learning`,onClose:()=>u(`none`),label:e===`zh-CN`?`知识与技能`:`Knowledge and skills`,width:`max-w-6xl`,children:l===`learning`&&(0,J.jsx)(mr,{sid:U,initialSelection:d,initialScope:p,projectNames:Object.fromEntries(o.flatMap(e=>e.display_name?[[e.id,e.display_name]]:[]))})}),(0,J.jsxs)(dt,{open:l===`reading`,onClose:()=>u(`none`),label:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`,children:[(0,J.jsx)(lt,{title:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}),l===`reading`&&K&&sn?.mission.id&&U?(0,J.jsxs)(J.Fragment,{children:[ae()===`question-foundation`?(0,J.jsx)(bf,{sid:U,objective:K.session.objective,readOnly:y,onOpenArtifact:Ie}):null,(0,J.jsx)(Ws,{sid:U,snapshot:K,view:sn,active:!0,readOnly:y,onOpenArtifact:Ie,onAsk:e=>{yt(t=>t.trim()?`${t}\n\n${e}`:e),pe(e=>e+1),u(`none`)}},U),(0,J.jsx)(`div`,{className:`px-4 pb-4`,children:(0,J.jsx)(ys,{})})]}):(0,J.jsx)(`p`,{className:`px-6 pb-6 text-sm text-ink-dim`,children:e===`zh-CN`?`开始任务后,可以在这里查看说明和依据。`:`Task explanations and evidence appear here once work begins.`})]}),(0,J.jsx)(pd,{open:l===`palette`,onClose:()=>u(`none`),items:Wn}),(0,J.jsx)($p,{open:l===`verticals`,onClose:()=>u(`none`)}),(0,J.jsx)(hd,{open:l===`help`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(zd,{sid:U,open:l===`doctor`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Bd,{sid:U,open:l===`config`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Vd,{sid:U,open:l===`identity`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Hd,{sid:U,open:l===`transcript`,onClose:()=>u(`none`)}),U&&K?(0,J.jsx)(fm,{open:l===`inspector`,snap:K,journal:nn.data??[],busy:Tn.disposeBacklog.isPending||Tn.stopBacklog.isPending,onClose:()=>u(`none`),onDispose:Nn,onStop:Ln,onInspect:Ve}):null,U&&K?(0,J.jsx)(Fm,{open:l===`operations`,onOpenSkills:()=>g(void 0,`global`),sid:U,snap:K,onClose:()=>u(`none`),onChanged:()=>{Vt.refetch(),i.refetch()},onRestored:async e=>{await i.refetch(),kt(e)}}):null,(0,J.jsx)(yf,{sid:U,path:Fe,artifacts:Wt.data??[],reviewActivity:U===q?mn:void 0,onSelectPath:Ie,onClose:()=>Ie(null)}),(0,J.jsx)(hm,{sid:U,itemId:Be,onClose:()=>Ve(null),onDone:e=>Nn(e,`done`),onSkip:e=>Nn(e,`rm`),onStop:Ln,busy:Tn.disposeBacklog.isPending||Tn.stopBacklog.isPending,readOnly:y}),(0,J.jsx)(Gd,{reply:ln,open:fn,busy:un,error:dn,onClose:()=>pn(!1),onSubmit:cn}),Ue?(0,J.jsx)(np,{open:He,sid:Ue,name:Ht.data?.session.display_name||o.find(e=>e.id===Ue)?.display_name||o.find(e=>e.id===Ue)?.label||``,alive:Ht.data?.daemon.alive??!!o.find(e=>e.id===Ue)?.daemon_alive,controlAvailable:Ht.data?.daemon.control_available!==!1,busy:On,onClose:()=>{B(!1),We(null)},onRename:jn,onStart:Mn,onStop:An,onDelete:async()=>{let e=Ue,t=await kn();return t&&e&&Ot(e),t}}):null,(0,J.jsx)(tp,{notice:Qe,onClose:ot}),K&&!y?(0,J.jsx)(zm,{active:S===`preview`?`preview`:L,sidebarOpen:ie,onSelect:e=>{if(e===`preview`){A(`preview`);return}A(`activity`),F(e)},onOpenSessions:()=>P(!0),onRead:()=>u(`reading`),onOpenSkills:()=>g()}):null]})})}export{Ii as $,go as A,Jt as At,ga as B,Do as C,sn as Ct,So as D,$t as Dt,wo as E,rn as Et,eo as F,Ja as G,Ya as H,ro as I,oa as J,ma as K,so as L,Qa as M,Kt as Mt,to as N,Ut as Nt,xo as O,Qt as Ot,no as P,Ht as Pt,ki as Q,io as R,Oo as S,ln as St,Co as T,an as Tt,ba as U,Ra as V,Ca as W,sa as X,aa as Y,Ti as Z,Gc as _,Hr as _t,Wd as a,Ui as at,Ss as b,gn as bt,Ju as c,Bi as ct,id as d,Lh as default,Si as dt,Zi as et,vu as f,ii as ft,Xc as g,Qr as gt,Kc as h,pi as ht,rf as i,Pi as it,ho as j,qt as jt,mo as k,Xt as kt,Gu as l,zi as lt,Ml as m,ri as mt,vm as n,Yi as nt,cd as o,Mi as ot,_u as p,ci as pt,la as q,vf as r,Hi as rt,ad as s,ji as st,Mh as t,Ai as tt,td as u,Xi as ut,Pc as v,Vr as vt,ko as w,on as wt,Uo as x,dn as xt,Hc as y,yn as yt,oo as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/App-D406npOP.js b/frontend/web/dist/assets/App-D406npOP.js new file mode 100644 index 000000000..c0a7df1c2 --- /dev/null +++ b/frontend/web/dist/assets/App-D406npOP.js @@ -0,0 +1,53 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ResearchWorkbenchPanel-Bg_Dyv6Z.js","./rolldown-runtime-hePW80VL.js","./icons-DRlFT_ri.js","./query-CUzIxVzm.js","./index-Cb5-aRKO.js","./markdown-D-35pK1E.js","./markdown-DvoRHisr.css","./index-Diz-_RXt.css","./AppearanceControls-BNJdEiGG.js","./code-xml-C6UZnqwl.js","./play-CBzqX6Qi.js","./useWorkbenchTheme-Bu46ZOFm.js","./ResearchWorkbenchPanel-BS5QOR9J.css","./MapPanel-B8sBUMHd.js","./history-DuGaxgzd.js","./format-CtVQGh59.js","./MapPanel-BHNQrOn8.css"])))=>i.map(i=>d[i]); +import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{C as n,D as r,E as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,w as E,x as D,y as O}from"./icons-DRlFT_ri.js";import{S as k,a as A,b as j,c as M,i as ee,n as N,r as P}from"./query-CUzIxVzm.js";import{i as F}from"./markdown-D-35pK1E.js";import{A as te,B as ne,C as re,D as ie,E as I,F as L,G as ae,J as oe,K as se,M as ce,N as le,O as ue,P as R,R as de,S as fe,T as pe,V as me,W as he,_ as ge,a as _e,b as ve,c as ye,d as be,f as xe,g as Se,h as Ce,i as we,j as Te,k as z,l as Ee,m as De,n as Oe,o as ke,p as Ae,r as je,s as Me,t as Ne,u as Pe,v as Fe,w as Ie,x as Le,y as Re,z as ze}from"./index-Cb5-aRKO.js";import{A as Be,C as Ve,D as He,E as B,F as Ue,I as We,L as Ge,M as Ke,N as qe,O as Je,P as Ye,R as V,S as Xe,T as Ze,_ as Qe,a as $e,b as et,c as tt,d as nt,f as rt,g as H,h as it,i as at,j as ot,k as st,l as ct,m as lt,n as ut,o as U,p as dt,r as W,s as ft,t as pt,u as mt,v as ht,w as gt,x as _t,y as vt}from"./AppearanceControls-BNJdEiGG.js";import{a as yt,c as bt,i as xt,l as St,n as Ct,o as wt,r as Tt,s as Et,t as Dt}from"./format-CtVQGh59.js";import{a as Ot,i as kt,n as At,r as jt,t as Mt}from"./useWorkbenchTheme-Bu46ZOFm.js";var G=t(r(),1),Nt=`local_request_id`,Pt=e=>Array.isArray(e)&&e.length>0;function Ft(e,t,n,r,i=Date.now(),a=!0,o){let s=e.findIndex(e=>e.type===`ui.argus`&&Number(e[Nt])===n);if(s<0)return!r.length&&!a?e:[...e,{type:`ui.argus`,agent_layer:`manager`,text:``,ts:i/1e3,event_id:`local-${t}-${n}-argus`,message_id:`local-${n}-argus`,fragment_mode:`snapshot`,steps:r,live:a,...o?{status:o}:{},[Nt]:n}];let c=[...e];return c[s]={...c[s],...r.length?{steps:r}:{},live:a,...o?{status:o}:{}},c}function It(e,t,n=Date.now(),r=`stopped`){return e.map(e=>{if(e.type!==`ui.argus`||Number(e[Nt])!==t||e.live!==!0)return e;let i=Array.isArray(e.steps)?e.steps.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return t.ended_ts||t.status!==`running`?e:{...t,ended_ts:n/1e3,status:r}}):e.steps;return{...e,live:!1,status:r,...i===void 0?{}:{steps:i}}})}function Lt(e,t,n,r=Date.now()){return{type:`ui.operator`,agent_layer:`operator`,text:n,ts:r/1e3,event_id:`local-${e}-${t}-operator`,message_id:`local-${t}-operator`,[Nt]:t}}function Rt(e,t,n,r,i,a=Date.now(),o=`auto`){let s=r.trim();if(!s)return e;let c=e.findIndex(e=>e.type===`ui.argus`&&Number(e[Nt])===n),l=i.endsWith(`-argus`)?`${i.slice(0,-6)}-operator`:``,u=l?e.map(e=>e.type===`ui.operator`&&Number(e[Nt])===n?{...e,message_id:l}:e):e,d=u.find(e=>e.type===`ui.operator`&&Number(e[Nt])===n),f=d?Math.max(0,a-Number(d.ts??a/1e3)*1e3):0;if(c<0)return[...u,{type:`ui.argus`,agent_layer:`manager`,text:s,ts:a/1e3,event_id:`local-${t}-${n}-argus`,message_id:i||`local-${n}-argus`,fragment_mode:o,response_latency_ms:f,[Nt]:n}];let p=u[c],m=[...u];return m[c]={...p,text:Ie(String(p.text??``),s,o),message_id:i||p.message_id,fragment_mode:o},m}function zt(e,t,n){let r=e.filter(e=>e.type!==`engineer.progress`||e.turn_step!==!0),i=new Map,a=[...r];r.forEach((e,t)=>{let n=String(e.type??``);if(n!==`ui.operator`&&n!==`ui.argus`)return;let r=`${n}\u0000${String(e.text??``)}`;i.set(r,[t,...i.get(r)??[]])});let o=t.map(e=>({type:e.role===`operator`?`ui.operator`:`ui.argus`,agent_layer:e.role===`operator`?`operator`:`manager`,text:e.text,ts:e.ts,message_id:e.message_id||`transcript-${e.ts}-${e.role}`,...e.mission_result===!0?{mission_result:!0}:{},...typeof e.item_id==`string`?{item_id:e.item_id}:{},...typeof e.success==`boolean`?{success:e.success}:{},...typeof e.summary==`string`?{summary:e.summary}:{},...typeof e.delivery_id==`string`?{delivery_id:e.delivery_id}:{},...e.delivery&&typeof e.delivery==`object`?{delivery:e.delivery}:{},...Pt(e.steps)?{steps:e.steps}:{}})),s=Array(o.length).fill(!0);for(let e=o.length-1;e>=0;--e){let n=o[e],r=`${String(n.type)}\u0000${String(n.text??``)}`,c=i.get(r)??[],l=t[e].message_id,u=e=>{let t=a[e];return n.item_id&&t.item_id&&n.item_id!==t.item_id?!1:n.mission_result!==!0&&t.mission_result!==!0||!!(l&&t.message_id===l)||!!(!l&&n.delivery_id&&n.delivery_id===t.delivery_id)},d=c.findIndex(e=>u(e)&&!!(l&&a[e].message_id===l));if(d<0&&(d=c.findIndex(u)),d>=0){s[e]=!1;let[t]=c.splice(d,1),r=a[t];if(l&&r.message_id===l){let e={};for(let t of[`mission_result`,`item_id`,`success`])(r[t]==null||r[t]===``)&&n[t]!=null&&(e[t]=n[t]);a[t]={...r,...e}}}}let c=[...o.filter((e,t)=>s[t]),...a],l=Array(c.length).fill(!0),u=new Set,d=n.map(e=>{let t=String(e.message_id??``),n=t?c.findIndex((e,n)=>!u.has(n)&&String(e.message_id??``)===t):-1,r=Number(e.ts??0);if(n<0&&(n=c.findIndex((t,n)=>{if(u.has(n)||t.type!==e.type||t.text!==e.text)return!1;let i=Number(t.ts??0);return Math.abs(i-r)<=5})),n>=0){u.add(n),l[n]=!1;let t=c[n];return{...e,...t.mission_result===!0?{mission_result:!0}:{},...typeof t.item_id==`string`?{item_id:t.item_id}:{},...typeof t.success==`boolean`?{success:t.success}:{},...typeof t.summary==`string`?{summary:t.summary}:{},...typeof t.delivery_id==`string`?{delivery_id:t.delivery_id}:{},...t.delivery&&typeof t.delivery==`object`?{delivery:t.delivery}:{},...Pt(t.steps)?{steps:t.steps,live:!1}:{}}}return e});return[...c.filter((e,t)=>l[t]),...d].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0))}function Bt(e,t,n,r,i){let a=ge(e,t,120);return{query:a,events:(0,G.useMemo)(()=>e?zt(n,a.data??[],i===e?r:[]):[],[e,n,a.data,r,i]),status:a.isError?`error`:a.isPending?`loading`:`ready`}}var Vt=V(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Ht=V(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),K=V(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),q=V(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Ut=V(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Wt=V(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Gt=V(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Kt=V(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qt=V(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Jt=V(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),Yt=V(`Diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Xt=V(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Zt=V(`FilePenLine`,[[`path`,{d:`m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2`,key:`142zxg`}],[`path`,{d:`M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`2t3380`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),Qt=V(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),$t=V(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),en=V(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),tn=V(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),nn=V(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),rn=V(`Layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),an=V(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),on=V(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),sn=V(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),cn=V(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),ln=V(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),un=V(`Paperclip`,[[`path`,{d:`M13.234 20.252 21 12.3`,key:`1cbrk9`}],[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486`,key:`1pkts6`}]]),dn=V(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),fn=V(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),pn=V(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),mn=V(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),hn=V(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),gn=V(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),_n=V(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),vn=V(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),yn=V(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),bn=V(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),xn={"global/agent-team-lead.md":{title:`多智能体团队协作`,summary:`判断何时值得并行工作,按文件与职责拆分协作,并独立审查汇总结果;不替代原有角色与授权。`,originalName:`Agent Team Lead`,source:`argus/builtin_skills/agent-team-lead.md`,sourceSha256:`b490cc96572941fa4a2fe4937bd3e86c9802c132439ae779fcf8e88241ba9521`},"global/curator/argus-curator-role.md":{title:`团队成果整理`,summary:`维护团队候选成果池和比较记录,归纳后续策略;整理者不代替执行者完成工程任务。`,originalName:`Team Curator`,source:`argus/builtin_skills/curator/argus-curator-role.md`,sourceSha256:`3dfd743254a91f88feef76e85683225dc5b510b7f417f6430ef7b975b8eb0f5b`},"global/engineer/minimal-coding-agent.md":{title:`最小且严谨的软件修改`,summary:`用足够小的改动实现、修复或重构软件与界面,保留既有行为,避免无依据的抽象和新增依赖。`,originalName:`极简而严谨的 Coding Agent`,source:`argus/builtin_skills/engineer/minimal-coding-agent.md`,sourceSha256:`aa47c79252eb5086451530ae25aac77ce87bd4315eda1e9defae2af719295cab`},"global/engineer/pdf-chat.md":{title:`分段阅读 PDF`,summary:`按页或章节阅读并核对版本、页码;图片和版式需查看实际页面,回答只依据相关证据。`,originalName:`Progressive PDF Reading`,source:`argus/builtin_skills/engineer/pdf-chat.md`,sourceSha256:`141bd41eb888191aedc391f0df2ba100ab5aee3e7970f9afc21a6f50f4deca5f`},"global/engineer/presentation-master.md":{title:`可编辑演示文稿`,summary:`使用已有 PPT Master 工具制作或修改可编辑演示文稿和原生 PPT 图,经指定解释器运行并核对导出效果;科研绘图路线由科研垂域决定。`,originalName:`Editable Presentations with PPT Master`,source:`argus/builtin_skills/engineer/presentation-master.md`,sourceSha256:`b9f5ed3935b538a18280ac79a504a3b28b432b66efb884e3e06284b4f1729ff3`},"global/engineer/skill-authoring-guide.md":{title:`编写与审阅技能和 Wiki 页面`,summary:`只在证据表明有可复用做法时写技能;先学操作者材料再忠实编辑;Wiki 更新来自一手来源;审阅者按证据真实、无冗余、不倒退、层级正确来判断一次修改。`,originalName:`Writing and Reviewing Skills and Wiki Pages`,source:`argus/builtin_skills/engineer/skill-authoring-guide.md`,sourceSha256:`cf4073da950ef34a359fa3f4b9c77c9d00ebd56bcb79a678efc3e04197ec7e79`},"global/engineer/web-primary-source-evidence.md":{title:`查证一手网络来源`,summary:`为软件、产品、接口和基准等现实信息寻找并保留一手来源,让重要结论能够追溯。`,originalName:`Web Primary-Source Evidence`,source:`argus/builtin_skills/engineer/web-primary-source-evidence.md`,sourceSha256:`632930eb13afc66ebf4742ab6c87fa586edee916c3eeacef25f50215e78f776f`},"global/manager/evidence-based-stage-decision.md":{title:`经理的职责与阶段决定`,summary:`经理是唯一改变阶段的角色;结合规划和评审证据决定继续、推进、返回或结束,部署始终需要操作者批准。`,originalName:`The Manager's role and stage decisions`,source:`argus/builtin_skills/manager/evidence-based-stage-decision.md`,sourceSha256:`d664fa7b6e92045335da59739575326b89e70d38662c1ffdc79774c599e36817`},"global/performance-profile-ground-truth.md":{title:`真实工作负载性能分析`,summary:`用指定环境和代表性输入定位瓶颈,对照未开启剖析的实测结果;不顺带执行未要求的优化。`,originalName:`Performance Profile Ground Truth`,source:`argus/builtin_skills/performance-profile-ground-truth.md`,sourceSha256:`42430420ce8bd31047780e9b08ac5eab366f849eb222805ca05492779095f4d0`},"global/planner/dependency-aware-task-decomposition.md":{title:`规划者的职责与按依赖拆解任务`,summary:`规划者只读只派、不执行,阶段只由经理改变;把目标与已有证据整理成最小、可执行、有真实依赖且能明确验收的任务集合。`,originalName:`The Planner's role and dependency-aware task decomposition`,source:`argus/builtin_skills/planner/dependency-aware-task-decomposition.md`,sourceSha256:`06d5295c6777a64c90a28a5603884e557a72ad5961b19a3f411dc1e83e331886`},"global/project-venv-package-management.md":{title:`项目环境、依赖与运行前核查`,summary:`使用项目自身的环境与锁文件,只安装任务需要的依赖,在承载论断的运行前只核查它真正用到的资源;不修改 Argus 框架自己的运行环境。`,originalName:`Project Environment and Dependencies`,source:`argus/builtin_skills/project-venv-package-management.md`,sourceSha256:`ab8728ad9fff58e8bc4672e5bc2446135f376b55b52392a6104b2eb52e9ed327`},"global/reviewer/argus-reviewer-role.md":{title:`评审者的职责与给执行者的下一步`,summary:`独立判断执行结果是否成立、需要补充或转向,把检查结果提炼成执行者需要的那一个下一步;评审有争议时以带标签的证据而非角色权威定论,不替执行者作完成声明。`,originalName:`The Reviewer's role`,source:`argus/builtin_skills/reviewer/argus-reviewer-role.md`,sourceSha256:`8457a177a4376eab0e4bef7a652e3276ce3b6f9a0ab421fd15bd96eb057cf852`},"global/reviewer/engineer-process-audit.md":{title:`核对执行过程与证据`,summary:`当成果或验证声明存在争议时检查任务相关回执和日志,区分缺少记录与确实未执行。`,originalName:`Engineer Process Audit`,source:`argus/builtin_skills/reviewer/engineer-process-audit.md`,sourceSha256:`b109fb737e747b863244c9b03e1b23ff82acf724ef420bc547ad457c1cf65ac5`},"global/reviewer/web-source-evidence-audit.md":{title:`审查网络证据是否支撑结论`,summary:`核对实际取得的来源与重要现实信息声明是否一致,不把有链接等同于已经证实。`,originalName:`Web Source-Evidence Audit`,source:`argus/builtin_skills/reviewer/web-source-evidence-audit.md`,sourceSha256:`35dbb6288199c52d4ecfd4e241a54346f5ef8af985f50bf24121e687ea9dc22e`},"global/stale-blocker-verification-probe.md":{title:`核实旧阻塞与易变的外部事实`,summary:`用最小且已授权的探针判断记录中的阻塞是否仍然存在;只在决策依赖时核实外部事实,把身份、许可与执行当作三个不同的问题。`,originalName:`Verify a Recorded Blocker or a Changing External Fact`,source:`argus/builtin_skills/stale-blocker-verification-probe.md`,sourceSha256:`3eb5f473bbf1cf482a840e7af3c84bc939a6710b60f84415ad94e6932a9122b3`},"vertical/argus_maintenance/engineer/argus-maintenance-execution.md":{title:`Argus 小范围维护`,summary:`按核心与领域职责检查和简化框架,用小而可复用的修改解决明确问题。`,originalName:`Argus Maintenance`,source:`argus/verticals/argus_maintenance/skills/engineer/argus-maintenance-execution.md`,sourceSha256:`138f9b7e2503c5ce0307e575fa0555a62e1820c559e105d60cc6e31ab9991c0f`},"vertical/argus_maintenance/reviewer/argus-maintenance-review.md":{title:`Argus 维护变更评审`,summary:`核对补丁是否真正简化、复用和解耦,并用验证结果证明行为,而不是只看代码缩短。`,originalName:`Argus Maintenance Review`,source:`argus/verticals/argus_maintenance/skills/reviewer/argus-maintenance-review.md`,sourceSha256:`d6ad0f8eb29d5ca3d5a66fbc7df34de86e42229f15e8e2e22ce601a8ae08c4f8`},"vertical/chemistry/engineer/batteries/battery-identity-and-data-normalization.md":{title:`电池对象与测试数据对齐`,summary:`在循环分析前统一电芯、电极、电解液、测试协议和时间序列身份;不用于分子计算或一般光谱分析。`,originalName:`Battery Cell Identity and Electrochemical Data Normalization`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-identity-and-data-normalization.md`,sourceSha256:`d1cfc1cb94cf4e4828fcd2b75fb0f1dc57181208f2fad1f19c343a9d169462e6`},"vertical/chemistry/engineer/batteries/battery-model-validation.md":{title:`电池模型与退化解释验证`,summary:`用防止数据泄漏的实测电芯数据验证预测和退化解释,明确模型边界;不把预测当作实测。`,originalName:`Battery Model Boundary and Degradation Validation`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-model-validation.md`,sourceSha256:`fe4ec1ec78ec21dd0d568b71276c2f85e13b6216d5a7770f5f75d09baabc6d27`},"vertical/chemistry/engineer/batteries/cycling-and-degradation-analysis.md":{title:`电池循环与退化分析`,summary:`分析循环、倍率、阻抗和退化轨迹,保留电芯与协议对照,并避免评估数据泄漏。`,originalName:`Battery Cycling and Degradation Analysis Workflow`,source:`argus/domains/chemistry/skills/engineer/batteries/cycling-and-degradation-analysis.md`,sourceSha256:`3e0870b82fbc40463f81ca8eb1e84576c9fe1ae5fe501da6d2b274535fd16d2e`},"vertical/chemistry/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md":{title:`生化结合与功能实验分析`,summary:`分析亲和力、动力学、抑制和功能证据,核对构建体、辅因子、状态与实验对照;对接结果不能单独证明活性。`,originalName:`Biochemical Binding, Kinetics, and Functional Assay Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md`,sourceSha256:`12d235a655a1b6b6022a84a5c36e3c291df6227cb40bd2dc78f19012deff62e5`},"vertical/chemistry/engineer/biochemistry/biochemistry-structural-computational-evidence.md":{title:`生化结构与模拟的证据边界`,summary:`把结构、分子对接、动力学和突变结果作为待验证假设,结合真实实验边界解释,不直接宣称亲和力成立。`,originalName:`Biochemistry Structural, Docking, and MD Evidence Boundary Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-structural-computational-evidence.md`,sourceSha256:`47283774a89fa87050fd35df791c961dce37588ec9c92c9d4e357d59a9f14d6c`},"vertical/chemistry/engineer/biochemistry/biochemistry-system-and-assay-normalization.md":{title:`生化体系与实验对象对齐`,summary:`统一序列、构建体、分子状态、配体、辅因子、突变、结构和实验身份,再开展比较。`,originalName:`Biochemistry and Chemical Biology System Identity Normalization`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-system-and-assay-normalization.md`,sourceSha256:`9b7d80ae04064e9a1b5465dc1fee60f5511491694aaa20e423ae92779ad12ee5`},"vertical/chemistry/engineer/characterization/characterization-data-and-sample-normalization.md":{title:`表征样品与原始数据对齐`,summary:`保留衍射、光谱、质谱、核磁和显微原始数据及仪器信息;不把不同测试方式统一成简单拟峰。`,originalName:`Characterization Sample, Instrument Data, and Metadata Normalization`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-data-and-sample-normalization.md`,sourceSha256:`dad27a33c24c37fdc17a7f7386478246e7847edde9cac4cc2939590ab3e07b9c`},"vertical/chemistry/engineer/characterization/characterization-validation-and-integration.md":{title:`多种表征证据交叉验证`,summary:`综合不同仪器证据时保留各自适用范围和限制,避免跨测试方式作过强推断。`,originalName:`Characterization Validation and Multimodal Evidence Integration`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-validation-and-integration.md`,sourceSha256:`9671988085d6a0127a4739300c9c851e904016f8f17c31fafb676303b7d736c1`},"vertical/chemistry/engineer/characterization/modality-specific-interpretation-workflow.md":{title:`按测试方式解释表征结果`,summary:`依据衍射、光谱、质谱、核磁或显微的具体机制选择对照和模型,不使用一套解释套用全部数据。`,originalName:`Modality-Specific Chemical Characterization Interpretation Workflow`,source:`argus/domains/chemistry/skills/engineer/characterization/modality-specific-interpretation-workflow.md`,sourceSha256:`c09d9f9710e8ee7a72ff7cfd0f04ec741ea792a61a8b8abf56c038c26b126e46`},"vertical/chemistry/engineer/chemistry-execution.md":{title:`化学研究执行指南`,summary:`按任务选择领域流程,核实实际工具能力,保留一手证据并验证科学结论;实体实验仍需明确授权。`,originalName:`Chemistry Research Execution`,source:`argus/domains/chemistry/skills/engineer/chemistry-execution.md`,sourceSha256:`d6ad8b3ae0254319e31de1ca91a7c75fd06c70795d3948b38b8d35b895e69d59`},"vertical/chemistry/engineer/chemistry-toolkit.md":{title:`化学方法与工具导航`,summary:`先选择科学问题对应的方法,再查看具体工具说明;这是导航目录,不是自动安装或执行脚本。`,originalName:`Chemistry Skill and Capability Router`,source:`argus/domains/chemistry/skills/engineer/chemistry-toolkit.md`,sourceSha256:`14840bc5603ce237373ab4832f7bf747c24e6d4ef524eb2ccd112a8bb9eaea70`},"vertical/chemistry/engineer/computational_chemistry/computational-identity-normalization.md":{title:`计算化学对象与输入对齐`,summary:`在量子化学、力场、分子动力学或自由能计算前,统一分子或周期体系的输入与状态。`,originalName:`Computational Chemistry Identity and Input Normalization`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-identity-normalization.md`,sourceSha256:`fd9bebbdc28731a9eeab536279466e3b97c289a49db515f509c713f4b3f0df7b`},"vertical/chemistry/engineer/computational_chemistry/computational-validation-and-interpretation.md":{title:`计算收敛性与结论边界`,summary:`验证数值收敛、模型敏感性和适用范围,区分计算预测与实验测量,不外推为生物活性证明。`,originalName:`Computational Chemistry Convergence and Interpretation Validation`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-validation-and-interpretation.md`,sourceSha256:`ed1bffff26a5cb22ff61c60dcbf3464cbcff0f15200b9d604436bcd6243ab3f7`},"vertical/chemistry/engineer/computational_chemistry/electronic-structure-simulation-workflow.md":{title:`可复现电子结构与分子模拟`,summary:`组织分子或周期体系计算,分别检查方法选择和数值收敛,保留可复现的输入与输出。`,originalName:`Reproducible Electronic-Structure and Molecular Simulation Workflow`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/electronic-structure-simulation-workflow.md`,sourceSha256:`13c5d42ae2f417c7f16665e33f3660fad9f76163be2a08401edd57662ab6f22c`},"vertical/chemistry/engineer/crystallography/cif-and-structure-validation.md":{title:`CIF 与晶体结构检查`,summary:`核对格式、对称性、组成、几何、占位、位移参数和精修证据;不代替从头解结构。`,originalName:`CIF and Crystal Structure Validation`,source:`argus/domains/chemistry/skills/engineer/crystallography/cif-and-structure-validation.md`,sourceSha256:`b49527c827b69b5a37543059faf997fa8d0c9c3f60ed2c0a0e6807ddf5b0e802`},"vertical/chemistry/engineer/crystallography/diffraction-and-crystal-identity.md":{title:`衍射数据与晶体对象对齐`,summary:`核对单晶或粉末衍射的波长、几何、晶胞、对称性、物相及 CIF 来源。`,originalName:`Diffraction and Crystal Structure Identity`,source:`argus/domains/chemistry/skills/engineer/crystallography/diffraction-and-crystal-identity.md`,sourceSha256:`97367c0fad622c1d2ae19868b12a8de571bbc99c282c8b5eec4c4b97ed3615ed`},"vertical/chemistry/engineer/crystallography/structure-solution-and-refinement.md":{title:`晶体结构求解与精修`,summary:`结合数据处理、对称性检验、化学约束、残差和替代解释完成结构求解及精修。`,originalName:`Crystal Structure Solution and Refinement Workflow`,source:`argus/domains/chemistry/skills/engineer/crystallography/structure-solution-and-refinement.md`,sourceSha256:`8f5d913cf3bfc6c421f2d137ece735eba96e3b6840da63d6c4d40c22bc518e08`},"vertical/chemistry/engineer/foundations/chemical-identity-and-representation.md":{title:`化学对象与表达方式核实`,summary:`先核对分子、反应、材料、晶体、样品、序列或配方身份;这是跨领域基础,不替代专门流程。`,originalName:`Chemical Identity and Representation`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-identity-and-representation.md`,sourceSha256:`b1b0f0148ae94a1ad6ad60b6383cc8f6b1596b387d885ca896148486004ac392`},"vertical/chemistry/engineer/foundations/chemical-risk-and-authorization.md":{title:`化学风险与授权边界`,summary:`识别化学、生物、热、电、压力、辐射和仪器风险;文档建议不等于允许开展实体操作。`,originalName:`Chemical Risk and Authorization Boundary`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-risk-and-authorization.md`,sourceSha256:`2d6cb4a8421bb62bbde199f7aa131f5f678019ffbeed231f0676e9095f176b5e`},"vertical/chemistry/engineer/foundations/chemistry-workflow-output-contract.md":{title:`化学任务输入与交付约定`,summary:`明确输入、决策、能力核实、证据、验证方式、输出与停止条件,用于缺少更具体流程的任务。`,originalName:`Chemistry Workflow and Output Contract`,source:`argus/domains/chemistry/skills/engineer/foundations/chemistry-workflow-output-contract.md`,sourceSha256:`1b52c242611bb39cbbe929dc2bee8072e501ab56b23907df50a51c5c0b4f15fd`},"vertical/chemistry/engineer/foundations/computational-reproducibility.md":{title:`化学计算与分析的可复现性`,summary:`保留计算、模拟、数据处理和模型训练的输入、环境、数值设置、诊断与主要输出。`,originalName:`Chemistry Computational Reproducibility`,source:`argus/domains/chemistry/skills/engineer/foundations/computational-reproducibility.md`,sourceSha256:`d92b4a7b6e65c92138ef785a04a47f1fae6ab4ef2e6c4af111264cdc081a0bd8`},"vertical/chemistry/engineer/foundations/dataset-curation-and-leakage.md":{title:`化学数据整理与泄漏控制`,summary:`核对数据来源、去重、分组、标签和划分方式,避免分子、反应或样品间的信息泄漏。`,originalName:`Chemistry Dataset Curation and Leakage Control`,source:`argus/domains/chemistry/skills/engineer/foundations/dataset-curation-and-leakage.md`,sourceSha256:`ceeaf0a929c67df26cc91651721d943749c7e2c3bad6c7978cb78fa085bf948b`},"vertical/chemistry/engineer/foundations/evidence-provenance-and-claim-levels.md":{title:`化学证据来源与结论强度`,summary:`区分检索、整理、预测、计算、模拟、测量与推断,让结论不超出证据能支持的程度。`,originalName:`Chemistry Evidence Provenance and Claim Levels`,source:`argus/domains/chemistry/skills/engineer/foundations/evidence-provenance-and-claim-levels.md`,sourceSha256:`c8b6454e673aae3298d4089c1603b9edfe63c4be7f5f3ad8fd6f24ef2b2910f5`},"vertical/chemistry/engineer/foundations/failure-diagnosis-and-negative-results.md":{title:`化学任务失败与负结果分析`,summary:`保留失败证据,区分实现缺陷、资源问题和科学假设被否定,不把负结果隐去。`,originalName:`Chemistry Failure Diagnosis and Negative Results`,source:`argus/domains/chemistry/skills/engineer/foundations/failure-diagnosis-and-negative-results.md`,sourceSha256:`068cf8400d770fb6c97edbd26d6788adb1acc0e7d6ea00e3b14949c7a9a64a40`},"vertical/chemistry/engineer/foundations/uncertainty-and-applicability-domain.md":{title:`化学结果的不确定性与适用范围`,summary:`判断模型、计算、测量或文献结论能否用于当前实际体系,并量化或说明不确定性。`,originalName:`Chemistry Uncertainty and Applicability Domain`,source:`argus/domains/chemistry/skills/engineer/foundations/uncertainty-and-applicability-domain.md`,sourceSha256:`d552b6cad9e2a942e44a1a4c98647236488186458d3f2cd4bdd395a34c23d8ae`},"vertical/chemistry/engineer/foundations/units-conditions-and-normalization.md":{title:`化学单位与条件规范化`,summary:`比较不同来源前明确单位、计量基础、环境条件、样品归一方式和报告约定。`,originalName:`Chemical Units Conditions and Normalization`,source:`argus/domains/chemistry/skills/engineer/foundations/units-conditions-and-normalization.md`,sourceSha256:`540d6c4a3389900be51e3e9a7bdcf7f16169bb72246d53cbb1fbac247b527cde`},"vertical/chemistry/engineer/materials_science/materials-discovery-and-optimization.md":{title:`材料发现与优化研究`,summary:`限定设计空间、性质目标、基线与不确定性,组织可验证的筛选或工艺优化,不替代晶体精修。`,originalName:`Materials Discovery and Optimization Workflow`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-discovery-and-optimization.md`,sourceSha256:`02d2aeacb74302eb2853345772f5096cce5b26db15ab5d229a210ccfabe04cbd`},"vertical/chemistry/engineer/materials_science/materials-identity-processing-and-property-data.md":{title:`材料组成、工艺与性能数据`,summary:`统一组成、物相、工艺历史、样品形态、微结构和测试条件,建立可比的性能记录。`,originalName:`Materials Identity Processing and Property Data`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-identity-processing-and-property-data.md`,sourceSha256:`ec0ac9c5a4b62eb9d027a97f9c78cc9ed986776e48f9f3bbf94f015a8d689521`},"vertical/chemistry/engineer/materials_science/processing-structure-property-validation.md":{title:`工艺—结构—性能关系验证`,summary:`用可比样品、对照和不确定性检验材料关系声明,保留机理解释的适用边界。`,originalName:`Materials Processing Structure Property Validation`,source:`argus/domains/chemistry/skills/engineer/materials_science/processing-structure-property-validation.md`,sourceSha256:`7c556e48b0b97de122d0f342839c92ece5e33f36c1aa3f7efbcc6fbc319ea06c`},"vertical/chemistry/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md":{title:`MOF 构筑单元与拓扑识别`,summary:`从来源结构核实节点、连接体、连通性、穿插、缺陷、客体和网络拓扑,不以普通 CIF 检查代替。`,originalName:`MOF Framework Identity Node Linker and Topology`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md`,sourceSha256:`7a6490bd8dad40deeb548f03541673b91df2bd9bddbe3e9c8cf58d73b3ee31b8`},"vertical/chemistry/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md":{title:`MOF 数据、预测与结构生成`,summary:`组织拓扑相关去重、泄漏控制、性质预测和生成结构的分阶段验证;生成不等于可合成。`,originalName:`MOF Datasets Prediction and Structure Generation`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md`,sourceSha256:`8f1d023caf19aeb5801036cc58e2531cd8d39bb398008a4b614c654b3073ab51`},"vertical/chemistry/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md":{title:`MOF 孔隙、吸附与性质分析`,summary:`关联原始等温线、活化和样品状态,检查孔隙、吸附、输运模型及不确定性。`,originalName:`MOF Porosity Adsorption and Structure Property Workflow`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md`,sourceSha256:`98088eef9fa108d0f0aa8fab9f746315414cc64edbcfab0d0da8accd4ab83b0b`},"vertical/chemistry/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md":{title:`MOF 合成与后处理证据`,summary:`整理合成、活化、溶剂交换、缺陷调节和后修饰的证据,核对样品关联与表征要求。`,originalName:`MOF Synthesis Activation and Postsynthetic Evidence`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md`,sourceSha256:`b65377f7d995a638f721e8dea34a99807e97c948ec274bbc3f9cc1d35ccf1f5a`},"vertical/chemistry/engineer/organic_synthesis/reaction-identity-and-records.md":{title:`有机反应对象与记录对齐`,summary:`核对反应物、映射、计量、立体化学、条件、后处理和收率,用于路线或数据整理。`,originalName:`Organic Reaction Identity and Records`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/reaction-identity-and-records.md`,sourceSha256:`02221beebf4e39d9bd0e5c4090de61aba6596ceb48fb3a5f29b3e54466999d87`},"vertical/chemistry/engineer/organic_synthesis/retrosynthesis-and-route-design.md":{title:`有机逆合成与路线设计`,summary:`结合目标、断键、已有先例、选择性、供应和安全设计候选路线;候选仍需证据验证。`,originalName:`Organic Retrosynthesis and Route Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/retrosynthesis-and-route-design.md`,sourceSha256:`6ee1e514bf05cc052de12ee39497c783d1dd6ca9549335cbe62e7f2106ec8de4`},"vertical/chemistry/engineer/organic_synthesis/route-validation-and-experiment-design.md":{title:`有机路线验证与实验设计`,summary:`把候选路线转化为有对照、分析读数和停止条件的验证计划;不授权自动开展实体实验。`,originalName:`Organic Route Validation and Experiment Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/route-validation-and-experiment-design.md`,sourceSha256:`9a543fdca5cc4fa3ed0cc9cef2395af55ffaa35758b3c36895a2309d1d09dc80`},"vertical/chemistry/engineer/tools/aizynthfinder.md":{title:`AiZynthFinder 逆合成候选`,summary:`在明确模型、原料库、配置和预算后使用本地搜索生成候选路线;搜索结果不是可行性证明。`,originalName:`AiZynthFinder Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/aizynthfinder.md`,sourceSha256:`fd406198b2a436d954aefb95c1062f945e08cf98806ca7ceaba5d402c006f4dc`},"vertical/chemistry/engineer/tools/askcos.md":{title:`ASKCOS 路线与反应预测`,summary:`仅使用已获授权的部署,记录接口、模型、数据库、预算与结果来源;不假定已有服务权限。`,originalName:`ASKCOS Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/askcos.md`,sourceSha256:`31689603c8f5b80f2ed94a25ef05148edf311287e64bf336fc98fea5aeeaf486`},"vertical/chemistry/engineer/tools/chembl.md":{title:`ChEMBL 生物活性资料检索`,summary:`检索分子、靶点、实验和活性记录,核对版本、单位及来源;已有记录不证明新体系的活性。`,originalName:`ChEMBL Bioactivity Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/chembl.md`,sourceSha256:`9b33111794504afb064302785f66bd7fcbccac9e855d83df0eb84297f00b4863`},"vertical/chemistry/engineer/tools/chemcrow.md":{title:`ChemCrow 工具集成参考`,summary:`研究公开工具集成方式及其依赖、安全和证据要求;架构借鉴不等于复现论文结果。`,originalName:`ChemCrow Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemcrow.md`,sourceSha256:`877388249df2ed635a78ae2edb68b1d25fa2cd5305eec4e09c289fb0f1bd1ba3`},"vertical/chemistry/engineer/tools/chemos.md":{title:`ChemOS 实验室编排参考`,summary:`仅在设备服务、设施归属、安全联锁、数据约定和恢复机制已具备时评估编排能力。`,originalName:`ChemOS Orchestration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemos.md`,sourceSha256:`2dbb97df4b7107f08f00bbdd88fef587eda0b6d3d04e5850b619550e7a9c4cc3`},"vertical/chemistry/engineer/tools/coscientist.md":{title:`Coscientist 系统集成参考`,summary:`依据确切公开实现借鉴组件和架构,保留授权边界;不宣称得到可直接运行的自主实验室。`,originalName:`Coscientist Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/coscientist.md`,sourceSha256:`8a47d850deb1d7dfb2ddeecbea4cba38ceecec129a6e2b2d8ad403e9bbff5252`},"vertical/chemistry/engineer/tools/deepchem.md":{title:`DeepChem 分子机器学习`,summary:`先明确目标、对象、分组、泄漏控制、基线和适用范围,再选择数据、特征、模型与评估工具。`,originalName:`DeepChem Molecular Machine Learning`,source:`argus/domains/chemistry/skills/engineer/tools/deepchem.md`,sourceSha256:`27a9bd06792446cfeeafb63db293fcd8305d59ca3da164810e1267c13e6dcdeb`},"vertical/chemistry/engineer/tools/guacamol.md":{title:`GuacaMol 分子设计基准`,summary:`按确定任务、评分、参考数据、预算和有效性检查评估方法;结论仅限对应基准。`,originalName:`GuacaMol Molecular Design Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/guacamol.md`,sourceSha256:`f626a4b92ec2b081620f5da146f6baebe3b5cc44df824e77fc2becd0b3e87e7e`},"vertical/chemistry/engineer/tools/olympus.md":{title:`Olympus 反应优化基准`,summary:`使用规划器和模拟曲面作有对照的优化研究,明确参数空间、噪声和预算;模拟不等于实体实验。`,originalName:`Olympus Reaction Optimization`,source:`argus/domains/chemistry/skills/engineer/tools/olympus.md`,sourceSha256:`160f357db2ec4527b7368d2b41a2ab43d2ab6b76130e8a27b2a035e0531c4be2`},"vertical/chemistry/engineer/tools/openbabel.md":{title:`Open Babel 化学格式转换`,summary:`转换结构格式并核对解析、氢原子、坐标和互操作性,保留原始身份及转换来源。`,originalName:`Open Babel Structure Conversion`,source:`argus/domains/chemistry/skills/engineer/tools/openbabel.md`,sourceSha256:`6eca4f250101ad817f624a76ca6c22193c73fd67a8d13d76a39bcf07d848fd75`},"vertical/chemistry/engineer/tools/orca.md":{title:`ORCA 量子化学计算`,summary:`在用户提供并授权的安装上计算,记录版本、分子状态、方法、基组、数值设置和主要输出。`,originalName:`ORCA Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/orca.md`,sourceSha256:`683637ad2fb781da58295e67229859794085fb01fcaaa43c10e11e13c8a91085`},"vertical/chemistry/engineer/tools/ord.md":{title:`开放反应数据库读写规范`,summary:`按数据库结构验证反应角色、数量、条件、结果与来源;结构有效不等于实验可复现。`,originalName:`Open Reaction Database I/O`,source:`argus/domains/chemistry/skills/engineer/tools/ord.md`,sourceSha256:`eb81cbde5711e04c578cc89a5b233a3de109c5b68b7322adeefd0996df21b8da`},"vertical/chemistry/engineer/tools/psi4.md":{title:`Psi4 量子化学计算`,summary:`明确分子状态、方法、基组、选项、收敛和单位,保留计算输出来源。`,originalName:`Psi4 Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/psi4.md`,sourceSha256:`2d8bf9817a90f90fe2407d8e4d71e6ffbf431f64207f61b8c2fca8acda199a69`},"vertical/chemistry/engineer/tools/pubchem.md":{title:`PubChem 公共资料检索`,summary:`通过核实的标识和带日期的查询取得公共化合物、性质及安全记录,保留原始响应与来源边界。`,originalName:`PubChem PUG REST Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/pubchem.md`,sourceSha256:`9aa66ea316f8180a29884f78b1ae927adf55f727476fa0529c01e7300161c89e`},"vertical/chemistry/engineer/tools/pyscf.md":{title:`PySCF 电子结构计算`,summary:`先确定电荷、自旋、几何、方法、基组、边界和收敛要求,再组织分子或周期体系计算。`,originalName:`PySCF Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/pyscf.md`,sourceSha256:`9ccb368195807ed7390cf2397506d004f849ccd1c0e1d51532b31e42e579dbc2`},"vertical/chemistry/engineer/tools/rdkit.md":{title:`RDKit 分子数据处理`,summary:`用于解析、规范化、立体化学、子结构、描述符、指纹与构象等处理;不直接证明化学身份或可行性。`,originalName:`RDKit Molecular Integrity`,source:`argus/domains/chemistry/skills/engineer/tools/rdkit.md`,sourceSha256:`b9330a5a8c90fb31bf3b551555d4f439cca90f9ecd45506734ce5051628ee074`},"vertical/chemistry/engineer/tools/tdc.md":{title:`TDC 药物研究数据基准`,summary:`使用明确任务、版本、许可、划分和评估器开展比较,核对污染与证据边界。`,originalName:`Therapeutics Data Commons Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/tdc.md`,sourceSha256:`a1aaed9bff60b1df25ccc8a9846ebcd30784c1f814cb20633e8a5ef57e11decb`},"vertical/chemistry/engineer/workflows/chemistry-playground.md":{title:`受限化学假设试探`,summary:`仅对明确提出的候选问题开展有边界的计算优先试探,保留问题、结果和负证据,并经过评审。`,originalName:`Chemistry Playground Bounded Hypothesis Probe`,source:`argus/domains/chemistry/skills/engineer/workflows/chemistry-playground.md`,sourceSha256:`72326a42543600e3fffedf0562c171466cc25b433cb8c05913e9fcfac3eb2d12`},"vertical/chemistry/manager/chemistry-manager.md":{title:`化学任务协调与分流`,summary:`为科学问题选择专门技能组合,保留原研究阶段、证据强度与授权边界。`,originalName:`Chemistry Manager Context`,source:`argus/domains/chemistry/skills/manager/chemistry-manager.md`,sourceSha256:`ecc7e16be351188d3c6ae75aa0e55c4b3978f1916e67c45754766cb63085f336`},"vertical/chemistry/planner/chemistry-planning.md":{title:`化学研究规划`,summary:`选择最贴合任务的流程,保持证据和安全要求;未完成时才安排具有科学判别力的后续工作。`,originalName:`Chemistry Research Planning`,source:`argus/domains/chemistry/skills/planner/chemistry-planning.md`,sourceSha256:`c9258fa062f3853d7a04950d0e0045b10be65c41c11248d6fe5c981e0ed02e02`},"vertical/chemistry/reviewer/battery-review.md":{title:`电池与电化学证据评审`,summary:`独立核对电芯身份、协议可比性、单位、循环退化证据和防泄漏模型评估。`,originalName:`Battery and Electrochemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/battery-review.md`,sourceSha256:`e0aa8763587e38281b5c2c5b6f7c92b3e07264b1cee076539751de8971d87725`},"vertical/chemistry/reviewer/biochemistry-review.md":{title:`生化与化学生物学评审`,summary:`检查构建体、结构、实验、动力学、模拟和功能声明,保留各自对照与结论边界。`,originalName:`Biochemistry and Chemical Biology Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/biochemistry-review.md`,sourceSha256:`68f2cc57f10d6c9bf30c41c249ebe7fc192b8ac4b763cb6ff40d9a41377135d0`},"vertical/chemistry/reviewer/characterization-review.md":{title:`化学表征证据评审`,summary:`独立核对原始仪器数据、校准、对照、归属和多模态证据,避免用通用解释越过测试边界。`,originalName:`Chemical Characterization Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/characterization-review.md`,sourceSha256:`3ba8858ac408729e78fa27a9338cd6eb435bd64d38da803d837aaec111ef8d67`},"vertical/chemistry/reviewer/chemistry-playground-review.md":{title:`化学试探结果评审`,summary:`检查受限问题与结果、证据和状态历史,防止未经确认的探索被当作正式科学结论。`,originalName:`Chemistry Playground Promotion Gate`,source:`argus/domains/chemistry/skills/reviewer/chemistry-playground-review.md`,sourceSha256:`309f1ff685c93c46c47239d9db1a3b85c41c6c384e986532e774ed3795e8d3c0`},"vertical/chemistry/reviewer/chemistry-review.md":{title:`化学研究综合评审`,summary:`按问题转交专门评审方法,核对对象、原始证据、对照、可复现性、不确定性和安全要求。`,originalName:`Chemistry Research Review`,source:`argus/domains/chemistry/skills/reviewer/chemistry-review.md`,sourceSha256:`bc2587f915788c94f8de55a0f2947a18e7bd368cccf1b400d1479e1681c64cf7`},"vertical/chemistry/reviewer/computational-review.md":{title:`计算化学证据评审`,summary:`审查输入身份、数值收敛、方法有效性,以及计算结果和测量结果之间的界线。`,originalName:`Computational Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/computational-review.md`,sourceSha256:`cab134d61ce5d45bf0240d2219eca03002e7b6315c4abf3738c2740229353e68`},"vertical/chemistry/reviewer/crystallography-review.md":{title:`晶体学证据评审`,summary:`独立检查衍射、对称性、精修、CIF、物相声明和结构不确定性,不替代其他领域评审。`,originalName:`Crystallography Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/crystallography-review.md`,sourceSha256:`034223d76528f09aede5febdb7fff1c848819f82564a8be7acf23ebc1a25d369`},"vertical/chemistry/reviewer/materials-science-review.md":{title:`材料科学证据评审`,summary:`核对非 MOF 材料的身份、工艺、性质和发现声明,不把结论跨用到晶体精修或电池循环。`,originalName:`Materials Science Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/materials-science-review.md`,sourceSha256:`ac639340d34bc5dae734e9f9841e91762cb31ec42c73c5a108dc69b25c2b76ba`},"vertical/chemistry/reviewer/mof-reticular-chemistry-review.md":{title:`MOF 与网状化学证据评审`,summary:`核对构筑单元、拓扑、合成活化、孔隙吸附、后修饰、数据与生成结构的证据。`,originalName:`MOF and Reticular Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/mof-reticular-chemistry-review.md`,sourceSha256:`d095ca81ab168c658696b20de0e149647cdbfcffe545cff73e3ed9ccaeb37dcf`},"vertical/chemistry/reviewer/organic-synthesis-review.md":{title:`有机合成与逆合成评审`,summary:`独立核对反应记录、路线先例、选择性、分析证据、安全和实际可行性声明。`,originalName:`Organic Synthesis and Retrosynthesis Review`,source:`argus/domains/chemistry/skills/reviewer/organic-synthesis-review.md`,sourceSha256:`0ce7fdeee239a78b9d74f7e64dbd55b38d99b9e88bf141399ec999d30f519ad0`},"vertical/chemistry/scientist/chemistry-adaptation.md":{title:`根据证据改进化学方法`,summary:`只有证据显示现有方法在对象、能力、验证或安全等机制层面存在缺口时,才调整可复用流程。`,originalName:`Chemistry Skill Adaptation`,source:`argus/domains/chemistry/skills/scientist/chemistry-adaptation.md`,sourceSha256:`d231961e4c85bee737df313c376e046dba50ed5a375460a924176db507f8ee9a`},"vertical/chemistry/scientist/chemistry-distillation.md":{title:`沉淀可复用化学流程`,summary:`在技能匹配缺失后归纳带范围、证据、验证和停止条件的方法,而不是保存目标答案或工具教程。`,originalName:`Chemistry Skill Distillation`,source:`argus/domains/chemistry/skills/scientist/chemistry-distillation.md`,sourceSha256:`1f7c9b2cddae0e19332d6e38edbac2671026d04e5ca0f3203f3d777e5e51d010`},"vertical/kernel_engineering/engineer/kernel-benchmark-measurement-integrity.md":{title:`GPU 算子工程:先算屋顶线,隔离测量`,summary:`先用屋顶线定瓶颈再改机制而非参数;一次干净的隔离运行足以筛选想法,要主张或保留的提升必须在官方条件下测量;审阅只看正确性与基准证据。`,originalName:`Kernel Engineering: Roofline First, Measure in Isolation`,source:`argus/verticals/kernel_engineering/skills/engineer/kernel-benchmark-measurement-integrity.md`,sourceSha256:`b6bbe44b147dfea2dd68810db53571a9fae5db238c2bcde24d51c79756bf1785`},"vertical/learning/learning-curation.md":{title:`学习任务的整理与审阅`,summary:`把操作者材料变成有证据锚点的项目 Skill/Wiki 修改或诚实的空操作,说明 CHANGE_PLAN.json 的约定以及审阅者如何判断修改是否忠实、无冗余、不倒退、层级正确。`,originalName:`Learning Curation`,source:`argus/verticals/learning/skills/learning-curation.md`,sourceSha256:`71490b8d95eecb97a88a18e8bc4dd0a1aa163d7c0f82a02114440aae1f5f6999`},"vertical/math/engineer/math-research-execution.md":{title:`数学研究执行`,summary:`忠实保留命题与范围,诚实区分结果类别;需要 Lean 证据时实际编译,不虚构证明。`,originalName:`Math Research Execution`,source:`argus/verticals/math/skills/engineer/math-research-execution.md`,sourceSha256:`ddcf8321ce873130c1de3e71b78d816115182813e8a6dfdd4bc89d0fe9629736`},"vertical/math/manager/math-research-manager.md":{title:`数学研究任务协调`,summary:`在通用协调流程中保持研究目标、范围、求解和评审职责,不另造一套权限体系。`,originalName:`Math Research Manager Context`,source:`argus/verticals/math/skills/manager/math-research-manager.md`,sourceSha256:`e228b24cd82e6dee678458b5e32c4e1fc6092151b06c7eee198b158bdd1a1b95`},"vertical/math/planner/math-research-planning.md":{title:`数学研究规划`,summary:`围绕范围界定、求解和评审安排动态任务,保持原有角色与生命周期规则。`,originalName:`Math Research Planning`,source:`argus/verticals/math/skills/planner/math-research-planning.md`,sourceSha256:`e3320bf8a0b986eae0251ce1004962659ab2a9505a2cc73da63c33b94d2799f4`},"vertical/math/reviewer/math-research-review.md":{title:`数学研究独立评审`,summary:`检查正确性、新意、意义、命题忠实性和真实形式化证据,不以叙述代替证明。`,originalName:`Math Research Review`,source:`argus/verticals/math/skills/reviewer/math-research-review.md`,sourceSha256:`21b7e0f172bbb695ae9950c0e9dd1cdac60ae6aa21df0962a88a1b06ba505251`},"vertical/math/scientist/math-research-adaptation.md":{title:`改进数学研究方法`,summary:`在评审确认方法失败或技能缺口后,按已有适应阶段调整可复用方法。`,originalName:`Math Research Scientist Adaptation`,source:`argus/verticals/math/skills/scientist/math-research-adaptation.md`,sourceSha256:`fd8961cb0155e3fc05428cf0b5dbd6be86ed048636dc657b3b23abbee6495933`},"vertical/math/scientist/math-research-distillation.md":{title:`沉淀数学研究方法`,summary:`在首次匹配缺失后整理可复用研究方法,不假定已经失败,也不代替当前任务的执行。`,originalName:`Math Research Skill Distillation`,source:`argus/verticals/math/skills/scientist/math-research-distillation.md`,sourceSha256:`83a7367798b1ac327861deaa94accf1d77da0e140ebc8da8137442a30a83b09a`},"vertical/research/engineer/ablation-planner.md":{title:`选择有判别力的消融实验`,summary:`只选择能区分结果解释、说明所选方法作用的必要消融,而不是机械穷举组合。`,originalName:`Choosing ablations that distinguish explanations`,source:`argus/verticals/research/skills/engineer/ablation-planner.md`,sourceSha256:`f5c9bff3d6b5bc9dc4b50316e172856fcc01d708685c08a1ff29650871369858`},"vertical/research/engineer/method-card.md":{title:`方法卡、可执行规范与审阅锚点`,summary:`在 METHOD.md 中写清方法、组件、协议和证伪条件;以钉版参考实现为底把方法写成 diff;先写 tests/spec 再跑承载论断的实验;用代码锚点让不在场的审阅者找到机制;规划者据此写实现简报。`,originalName:`Method card (METHOD.md), executable spec and review anchors`,source:`argus/verticals/research/skills/engineer/method-card.md`,sourceSha256:`2e756a2fd09bca2abe4175fea4042af6905a6166b629c940909b10090cfe6855`},"vertical/research/engineer/novelty-check.md":{title:`检验研究想法的新意`,summary:`通过当前来源对照最接近的已有工作,判断一条候选想法的差异,而非先宣称创新。`,originalName:`Testing the idea's novelty`,source:`argus/verticals/research/skills/engineer/novelty-check.md`,sourceSha256:`e20a0f4290c72b07c9b09fa77633ecc915f0f7a8b90d8efd4c627fb9d12f8c16`},"vertical/research/engineer/paper-chart-styling.md":{title:`论文数据图样式`,summary:`统一数据图的配色、尺寸、标记和字体嵌入,遵守所选期刊会议版式;不改变数据本身。`,originalName:`Styling data figures for publication`,source:`argus/verticals/research/skills/engineer/paper-chart-styling.md`,sourceSha256:`c40b9f431de9cd01f16e245d819563566fc5db02c2217505599921adcca65b75`},"vertical/research/engineer/paper-framework-figure-studio.md":{title:`论文图的路线选择与概念图编排`,summary:`按表达内容选渲染路线:数据图走 SciencePlots/Matplotlib,概念与框架图默认以图像蓝图重建为可编辑 PPT,无图像接口时直接原生绘制;生成图像只用于不承载论断的部分。`,originalName:`Composing a conceptual paper figure`,source:`argus/verticals/research/skills/engineer/paper-framework-figure-studio.md`,sourceSha256:`e01ffd101b8fcd701b86918d93994079dfc87d9df79dbcd348bdfe3508cfcd9b`},"vertical/research/engineer/references/ideation/ideation-patterns/overview.md":{title:`研究构思模式总览`,summary:`汇总各研究构思模式的定义、操作特征与适用时机,帮助为路线挑选机制视角;模式在语料中常见不代表适合当前问题,也不替代创新性与正确性验证。`,originalName:`engineer/references/ideation/ideation-patterns/overview`,source:`argus/verticals/research/skills/engineer/references/ideation/ideation-patterns/overview.md`,sourceSha256:`8b2b43b5ce63c70a1b54c0ff5fb3f1954bc8ef6c05bda95a71a011d2f5f4eb34`},"vertical/research/engineer/references/paper-writing-craft.md":{title:`论文写作方法参考`,summary:`提供论文论证和表达的写作参考,需结合真实证据与所选期刊会议要求使用。`,originalName:`engineer/references/paper-writing-craft`,source:`argus/verticals/research/skills/engineer/references/paper-writing-craft.md`,sourceSha256:`bd645d2f2f48987c988c54b6b22843b22ee3b5a9dc0ce950bff4acdc0fcf3eeb`},"vertical/research/engineer/research-grind.md":{title:`沿诊断阶梯打磨研究结果`,summary:`把首次实现当作草稿,在固定声明下沿诊断阶梯逐级排查;结果异常先怀疑设置;从原始逐种子行算数;依据证据而非尝试次数判断何时足够。`,originalName:`Working a research result into shape`,source:`argus/verticals/research/skills/engineer/research-grind.md`,sourceSha256:`e955fe1ac7aa975a9172394bdca4e8b2ed6a504355ab00573a26badf442f038a`},"vertical/research/engineer/rl-training-collapse-diagnosis.md":{title:`强化学习训练健康诊断`,summary:`检查奖励、优势、梯度、KL、截断和吞吐异常,先诊断配置与过程,再归因方法;不同训练目标不能混用规则。`,originalName:`RL Training Health Diagnosis`,source:`argus/verticals/research/skills/engineer/rl-training-collapse-diagnosis.md`,sourceSha256:`d48fd69adaac73ad45c41cd9565798a94a476de52c9354097abe2d8604db8782`},"vertical/research/engineer/sources-and-citations.md":{title:`对照来源核对论断与引用`,summary:`把稿件中的论断对回支撑它的证据,把引用对回被引的原文,并用 Semantic Scholar 核对版本;补充全局的一手来源技能,不另起一轮整篇审阅。`,originalName:`Checking claims and citations against their sources`,source:`argus/verticals/research/skills/engineer/sources-and-citations.md`,sourceSha256:`450410c4b428e31104819c07a98e19b615ced499e0d2d4df473305ca789d55ed`},"vertical/research/engineer/training-infrastructure.md":{title:`训练基础设施的选择、搭建与调参`,summary:`训练或大规模推理需要框架时,用实时来源调查候选、在隔离环境中试装并剖析一步真实更新、以官方配方为锚每次只改一个因素,并把结论写成带日期的项目决策记录;不按记忆推荐技术栈。`,originalName:`Training infrastructure: choosing, standing up and tuning it`,source:`argus/verticals/research/skills/engineer/training-infrastructure.md`,sourceSha256:`4c495369ffba7ff2b9954a2fafd72b874e63abc6065a5afab7c61ce10afb9087`},"vertical/research/engineer/venue-format-preflight.md":{title:`投稿前的编译与泄露检查`,summary:`用目标会场的官方作者模板编译完整稿件并核对结构,同时检查稿件没有泄露内部路径、角色名与运行时用语。`,originalName:`Preparing the draft for the venue`,source:`argus/verticals/research/skills/engineer/venue-format-preflight.md`,sourceSha256:`e146afba818a8436d0807aff610084d6a321277778e7ce299bd96f9f57795eb0`},"vertical/research/engineer/venue-format-research.md":{title:`选择投稿目标并核对要求`,summary:`根据研究内容选择合适期刊会议,获取当前官方作者要求,而非沿用过时模板。`,originalName:`Choosing a venue and reading its requirements`,source:`argus/verticals/research/skills/engineer/venue-format-research.md`,sourceSha256:`aad2d0ec25649231ec233f4abb5b216af313a7a1dfa699cc6f0c8b23be7cbcf2`},"vertical/research/engineer/venue-paper-drafting.md":{title:`面向投稿目标撰写论文`,summary:`先定论证形状,按所选作者模板和确认的证据写完整论文,读一次强范文校准视觉与结构标准;不把未验证探索写成既定结论。`,originalName:`Writing for the selected venue`,source:`argus/verticals/research/skills/engineer/venue-paper-drafting.md`,sourceSha256:`d7bb7d7e59f5ce6e20433fa843e3d7002575b1892b131c0d0f7f247e986281f1`},"vertical/research/research-experiment-playbook.md":{title:`通过实验发展研究想法`,summary:`忠实实现已选想法,通过适应性实验形成足以支撑论文的证据,而不是只完成首次运行。`,originalName:`Developing an idea through experiments`,source:`argus/verticals/research/skills/research-experiment-playbook.md`,sourceSha256:`df8f6a724b93f063a6e0dd2e36af1838fca72eea689f062b096d3ad0c4ad2c85`},"vertical/research/research-idea-playbook.md":{title:`寻找并选择研究想法`,summary:`从来源中发现候选可能性,经独立审查后作最终选择,不把构思直接当作实验结果。`,originalName:`Finding a research idea`,source:`argus/verticals/research/skills/research-idea-playbook.md`,sourceSha256:`91104461d9115ee280db1f5e89d3c35bc8301422bfd7d9a70c66fa559c09eed6`},"vertical/research/research-paper-playbook.md":{title:`撰写完整研究论文`,summary:`从已确认的正向证据组织论文、编译并准备投稿材料,保持证据与论述一致。`,originalName:`Writing the research paper`,source:`argus/verticals/research/skills/research-paper-playbook.md`,sourceSha256:`2efcabc2904fe55831b0f5d9c61846c544aab2a211687f0fbf51ad417e66afec`},"vertical/research/research-review-playbook.md":{title:`对论文形成独立判断`,summary:`综合科学性、图示、语言和整体论证,判断工作是否成立并提出建设性意见。`,originalName:`Reaching a judgment on the paper`,source:`argus/verticals/research/skills/research-review-playbook.md`,sourceSha256:`368d0bc3b8dba80c1e8d84257a10f95bbe2124a35d03a30e553e1d6b56ae829a`},"vertical/research/reviewer/academic-paper-peer-review-benchmark.md":{title:`按目标期刊会议评审论文`,summary:`以独立评审视角判断当前稿件,提供科学指导并更新评审记录。`,originalName:`Reading the paper as a venue reviewer`,source:`argus/verticals/research/skills/reviewer/academic-paper-peer-review-benchmark.md`,sourceSha256:`6446f17af2a751bd9570b4351e4b28d84d09cc06ed2c59174111f17f39e0cbc9`},"vertical/research/reviewer/claim-to-code-trace.md":{title:`追溯声明到实际代码`,summary:`沿配置和执行路径核对公式、比较条件与观测,判断研究声明是否对应实际产生证据的代码。`,originalName:`Claim-to-Code Trace`,source:`argus/verticals/research/skills/reviewer/claim-to-code-trace.md`,sourceSha256:`fef3ef16ce27a9c1e9ec5f095c73bb734da06aedba74fa994122e28d32c293ee`},"vertical/research/reviewer/experiment-results-review.md":{title:`判断实验真正说明了什么`,summary:`亲自读代码、配置、评测器和原始行,判断证据对固定声明的支持与缺口;低于基线的结果在阶梯未走完前是修复请求;训练类实验另核对基础设施决策记录。`,originalName:`What the experiments establish`,source:`argus/verticals/research/skills/reviewer/experiment-results-review.md`,sourceSha256:`bc158d8b51107b697d290eb6ed461f2a596aa601bc78cce7e88089743411533e`},"vertical/research/reviewer/strongest-argument-against.md":{title:`寻找最有力的科学反对意见`,summary:`在最终评审中识别论文最关键的科学弱点,不通过直接改稿掩盖它。`,originalName:`The strongest argument against the paper`,source:`argus/verticals/research/skills/reviewer/strongest-argument-against.md`,sourceSha256:`6cc3e7990dacb420a04ff945cb1f221852bd249b981a60def70dfcace2ac3418`},"vertical/research/reviewer/venue-academic-language-review.md":{title:`审查论文论证与学术表达`,summary:`对照目标期刊会议的当前惯例阅读论证与语言,指出问题,不擅自编辑论文。`,originalName:`Reading the paper's argument and language`,source:`argus/verticals/research/skills/reviewer/venue-academic-language-review.md`,sourceSha256:`a2fe9faf57ff0a09181f42de2ac2b5080158e08c430078fb48722fd6b9893f66`},"vertical/software/engineer/software-change-implementation.md":{title:`有边界的软件实现与拆解`,summary:`结合仓库结构选择合适工具,以与任务规模相称的检查完成软件修改;分阶段工作按架构边界拆解,每个任务写明兼容性风险与独立预言机。`,originalName:`Software Change Implementation`,source:`argus/verticals/software/skills/engineer/software-change-implementation.md`,sourceSha256:`34dad5e10c880fb48964573768b72d8377829ca8163ddd21987c2c05538d70a9`},"vertical/software/reviewer/software-change-review.md":{title:`软件修改独立评审`,summary:`检查真实调用路径、兼容性与验证证据,不依赖参考答案或仅凭完成声明判断。`,originalName:`Software Change Review`,source:`argus/verticals/software/skills/reviewer/software-change-review.md`,sourceSha256:`5d1a66ff65accae04ec02005724735c9767308ac63c005b8be6e269eb9acb25f`}};function Sn(e){if(!e.is_default||![`bundled`,`shared`].includes(e.source)||!(e.scope===`global`?[`global:${e.source}`]:e.scope===`vertical`?[`vertical:${e.vertical}:${e.source}`,...e.source===`bundled`?[`domain:${e.vertical}:bundled`]:[]]:[]).includes(e.library))return null;let t=e.scope===`global`?`global/${e.path}`:`vertical/${e.vertical}/${e.path}`,n=Object.hasOwn(xn,t)?xn[t]:null;return n?.originalName===e.name?n:null}function Cn(e,t){let n=t===`zh-CN`?Sn(e):null;return{title:n?.title??e.name,summary:n?.summary??e.description,guide:n}}function wn(e,t){let n=Cn(e,t);return`${e.name} ${e.description} ${e.path} ${e.vertical} ${n.title} ${n.summary}`.toLocaleLowerCase()}var Tn={research:`科研`,software:`软件开发`,math:`数学研究`,chemistry:`化学`,kernel_engineering:`GPU 算子工程`,argus_maintenance:`Argus 维护`,learning:`资料学习`};function En(e,t){return t===`zh-CN`&&Object.hasOwn(Tn,e)?Tn[e]:e}var Dn={fact:[`记录可核对的环境、对象或事实,供后续工作查证;记录本身不保证事实仍然有效。`,`Records checkable facts for later verification; a saved record is not a guarantee that it is still current.`],lesson:[`保留工作中得到的经验和问题,帮助类似任务少走弯路;不能代替当前证据或评审。`,`Keeps lessons from work to inform similar tasks; it does not replace current evidence or review.`],survey:[`整理问答或调研材料与来源,为后续查阅提供线索;结论仍需结合原文核对。`,`Organizes answers or research and their sources for later reference; check conclusions against the original evidence.`],principles:[`归纳可反复参考的建议,帮助选择方法;应检查所引用的经验与适用条件。`,`Distills recurring guidance for choosing methods; check the cited lessons and applicability.`],note:[`保存关于你的背景、偏好或计划,帮助后续任务理解上下文;不是工具使用授权。`,`Keeps personal context, preferences or plans for later work; it is not authorization to use tools.`],profile:[`汇总 Argus 对你的背景与偏好的了解,方便核对是否准确;不代表公开资料或任务完成情况。`,`Summarizes personal context and preferences for inspection; it is neither a public record nor a task-completion report.`],page:[`一般参考资料。具体用途取决于原文和来源,不能仅凭“已保存”判断内容可靠或适用。`,`General reference material. Its use depends on the original content and sources, not merely on being saved.`]};function On(e,t){return(Object.hasOwn(Dn,e)?Dn[e]:Dn.page)[t===`zh-CN`?0:1]}var kn={private:[`你的个人背景资料,与共享知识分开保存。这里不改变既有读取权限或模型的数据处理方式。`,`Personal context is stored separately from shared knowledge. This view does not change existing access or model data handling.`],global:[`跨项目参考的通用资料;不要把个人信息当作公共知识放在这里。`,`General reference across projects; personal information does not belong in shared knowledge.`],vertical:[`同一领域可复用的专门资料,使用前仍要核对当前任务的条件。`,`Domain-specific reference; verify that it applies to the current task.`],project:[`围绕当前项目保存的资料与背景;分类不是操作系统沙箱或文件权限边界。`,`Material associated with this project; the category is not an OS sandbox or file-permission boundary.`]};function An(e,t){return Object.hasOwn(kn,e)?kn[e][t===`zh-CN`?0:1]:t===`zh-CN`?`范围尚未确认,请以来源说明为准。`:`Scope not confirmed; consult the source.`}var jn={active:`label.status.inProgress`,claimed:`label.status.inProgress`,in_progress:`label.status.inProgress`,running:`label.status.inProgress`,working:`label.status.inProgress`,pending:`label.status.waiting`,queued:`label.status.waiting`,waiting:`label.status.waiting`,idle:`label.status.waiting`,accepted:`label.status.completed`,complete:`label.status.completed`,completed:`label.status.completed`,done:`label.status.completed`,success:`label.status.completed`,blocked:`label.status.blocked`,failed:`label.status.failed`,error:`label.status.failed`,rejected:`label.status.needsChanges`,continue:`label.status.needsChanges`,skipped:`label.status.skipped`,paused:`label.status.paused`,paused_cost:`label.outcome.costUnreconciled`,stopped:`label.status.paused`,cancelled:`label.status.cancelled`,aborted:`label.status.cancelled`,not_started:`label.status.waiting`,available:`label.status.available`,absent:`label.status.unavailable`,inaccessible:`label.status.inaccessible`,degraded:`label.status.limited`,healthy:`label.status.healthy`},Mn={system:`label.role.argus`,operator:`label.role.you`},Nn={completed:`label.outcome.workCompleted`,done:`label.outcome.workCompleted`,success:`label.outcome.workCompleted`,paused:`label.outcome.workPaused`,blocked:`label.outcome.workBlocked`,failed:`label.outcome.workFailed`,error:`label.outcome.workFailed`,aborted:`label.outcome.workEnded`,ended:`label.outcome.workEnded`,incomplete:`label.outcome.workIncomplete`,research_incomplete:`label.outcome.workIncomplete`,paused_no_breakthrough:`label.outcome.workIncomplete`,exhausted_current_methods:`label.outcome.workIncomplete`,stalled:`label.outcome.workStalled`,no_progress:`label.outcome.workStalled`,max_rounds:`label.outcome.workStalled`,infra_blocked:`label.outcome.workBlocked`,supervisor_error:`label.outcome.workFailed`},Pn={accepted:`label.outcome.reviewPassed`,done:`label.outcome.reviewPassed`,passed:`label.outcome.reviewPassed`,continue:`label.outcome.reviewNeedsChanges`,rejected:`label.outcome.reviewNeedsChanges`,blocked:`label.outcome.reviewBlocked`,stale:`label.outcome.reviewOutdated`,pending:`label.outcome.reviewPending`,pending_review:`label.outcome.reviewPending`},Fn={certified:`label.outcome.stageApproved`,not_certified:`label.outcome.stageNotApproved`,revoked:`label.outcome.stageRevoked`,intentionally_skipped:`label.outcome.stageNotNeeded`,deferred:`label.outcome.stagePending`},In={budget_exhausted:`label.outcome.budgetPaused`,budget_pause:`label.outcome.budgetPaused`,cost_unreconciled:`label.outcome.costUnreconciled`,operator_input_required:`label.outcome.waitingForYou`,operator_abort:`label.outcome.stoppedByYou`,operator_pause:`label.outcome.pausedByYou`,daemon_shutdown:`label.outcome.sessionPaused`,backend_unavailable:`label.outcome.serviceUnavailable`,provider_cooldown:`label.outcome.serviceCoolingDown`,provider_fence:`label.outcome.serviceUnavailable`,transient_error:`label.outcome.temporaryIssue`,permanent_error:`label.outcome.serviceError`,planner_empty_plan:`label.outcome.needsPlan`},Ln={cuda:`label.resource.nvidiaGpu`,rocm:`label.resource.amdGpu`,mps:`label.resource.appleGpu`,cpu:`label.resource.cpu`};function Rn(e,t){return t(jn[String(e??``).toLowerCase()]??`label.status.updated`)}function zn(e,t){let n=String(e??``).toLowerCase();return gt(n)?Ve(n,t):t(Mn[n]??`label.role.argus`)}function Bn(e,t){return t(`label.priority`,{priority:e})}function Vn(e,t){if(!e?.execution_status)return[];let n=[t(Nn[e.execution_status.toLowerCase()]??`label.outcome.workUpdated`)],r=Pn[String(e.review_status??``).toLowerCase()],i=Fn[String(e.stage_certification??``).toLowerCase()],a=In[String(e.interruption_kind??``).toLowerCase()];return r&&n.push(t(r)),i&&n.push(t(i)),a&&n.push(t(a)),e.resumable&&n.push(t(`label.outcome.canResume`)),n}function Hn(e,t){return t(Ln[e.toLowerCase()]??`label.resource.accelerator`)}function Un(e,t){return t(e===`strict`?`label.resource.enforced`:`label.resource.advisory`)}function Wn(e,t){return t(e===`yield`?`label.resource.released`:`label.resource.kept`)}var J=i(),Gn=e=>[`knowledge-feed`,e];function Kn(e=!0,t=50){return A({queryKey:Gn(t),queryFn:({signal:e})=>R.knowledgeFeed(t,e),enabled:e,staleTime:5e3,refetchInterval:1e4})}var qn={en:{learned:`Learned`,recalled:`Recalled`,promoted:`Promoted`,corrected:`Corrected`},zh:{learned:`学到了`,recalled:`读取了`,promoted:`提升了`,corrected:`纠正了`}},Jn={en:{private:`About you`,global:`Global`,vertical:`Vertical`,project:`Project`},zh:{private:`关于你`,global:`全局`,vertical:`垂直领域`,project:`项目`}};function Yn(e,t=60){let n=[...e].sort((e,t)=>t.ts-e.ts),r=[];for(let e of n){let n=r[r.length-1];if(e.kind===`recalled`&&n?.kind===`recalls`&&n.role===e.role&&n.ts-e.ts<=t){n.events.push(e);continue}r.push(e.kind===`recalled`?{kind:`recalls`,ts:e.ts,role:e.role,events:[e]}:{kind:`single`,event:e})}return r}function Xn(e,t,n=null){return e.path?e.scope===`project`?n&&e.source_project&&e.source_project!==n?null:t.find(t=>t.scope===`project`&&t.path===e.path)??null:t.find(t=>t.scope===e.scope&&t.vertical===e.vertical&&t.path===e.path)??null:null}var Zn={learned:`bg-blue/10 text-blue`,recalled:`bg-line/60 text-ink-dim`,promoted:`bg-ok/10 text-ok`,corrected:`bg-warn/10 text-warn`};function Qn({events:e,items:t,sid:n,projectNames:r={},query:i=``,onSelect:a,selected:o}){let{locale:s,t:c}=z(),l=s===`zh-CN`,u=qn[l?`zh`:`en`],d=Jn[l?`zh`:`en`],f=e=>wt(e,l?`zh-CN`:`en`),p=i.trim().toLocaleLowerCase(),m=Yn(p?e.filter(e=>`${e.title} ${e.path} ${e.vertical} ${e.source_project} ${e.role} ${e.note}`.toLocaleLowerCase().includes(p)):e),h=e=>[d[e.scope]??e.scope,En(e.vertical,s),e.source_project?`${l?`来自 `:`from `}${r[e.source_project]||e.source_project}`:``,l&&e.role?zn(e.role,c):e.role].filter(Boolean).join(` · `),g=e=>!!(e&&o&&e.scope===o.scope&&e.vertical===o.vertical&&e.path===o.path),_=(e,r)=>{let i=Xn(e,t,n),o=e.title||e.path;return i?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(i),"aria-pressed":g(i),"data-feed-title":!0,className:`${r} text-left hover:text-blue ${g(i)?`text-blue`:`text-ink`}`,children:o}):(0,J.jsx)(`span`,{"data-feed-title":!0,className:`${r} text-ink`,title:e.path,children:o})};return m.length===0?(0,J.jsx)(`p`,{className:`p-3 text-sm leading-relaxed text-ink-faint`,children:p?l?`没有匹配的学习动态。`:`No feed lines match the search.`:l?`还没有学习动态。Argus 在任务后反思写下教训、把已有知识读进提示、或把评审通过的页面提升到共享层时,都会在这里留下一行。`:`Nothing learned yet. A line appears here whenever Argus writes a lesson after a mission, reads existing knowledge into a prompt, or promotes a reviewed page to a shared level.`}):(0,J.jsx)(`ol`,{className:`space-y-1`,"aria-label":l?`学习动态`:`Learning feed`,children:m.map(e=>e.kind===`single`?(0,J.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":e.event.kind,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`time`,{dateTime:new Date(e.event.ts*1e3).toISOString(),children:f(e.event.ts)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${Zn[e.event.kind]??Zn.learned}`,children:u[e.event.kind]??e.event.kind})]}),_(e.event,`mt-1 block w-full break-words text-sm font-medium`),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.event)}),e.event.note&&(0,J.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-ink-dim`,children:e.event.note})]},`${e.event.ts}/${e.event.kind}/${e.event.path}`):(0,J.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":`recalls`,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`time`,{dateTime:new Date(e.ts*1e3).toISOString(),children:f(e.ts)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${Zn.recalled}`,children:u.recalled})]}),(0,J.jsx)(`span`,{className:`mt-1 block text-sm font-medium text-ink`,"data-feed-title":!0,children:e.events.length===1?e.events[0].title||e.events[0].path:l?`读取了 ${e.events.length} 条已有知识`:`Recalled ${e.events.length} existing pages`}),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.events[0])}),e.events.length>1&&(0,J.jsx)(`span`,{className:`mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-xs`,children:e.events.map(e=>(0,J.jsx)(`span`,{children:_(e,`inline text-xs text-ink-dim`)},`${e.ts}/${e.scope}/${e.vertical}/${e.path}`))})]},`${e.ts}/recalls/${e.role}`))})}function $n({guide:e,item:t}){let{t:n}=z();return(0,J.jsxs)(`section`,{"data-skill-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-4 text-sm leading-relaxed text-ink`,children:[(0,J.jsx)(`h4`,{className:`font-semibold`,children:`这项方法有什么用`}),(0,J.jsx)(`p`,{className:`mt-2`,children:e.summary}),(0,J.jsxs)(`dl`,{className:`mt-3 space-y-2 text-xs text-ink-dim`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`什么时候参考`}),(0,J.jsx)(`dd`,{children:`当前任务与上面的用途相符时,由既有任务与技能选择流程按需读取;浏览本页不会运行工具或发起模型任务。`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`目录标注的角色`}),(0,J.jsxs)(`dd`,{children:[zn(t.role,n),`;这只是说明,不调整角色职责或权限。`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`需要注意`}),(0,J.jsx)(`dd`,{children:`这是随包版本的中文导读,不是完整执行指令,也不是已经完成或验证的证据。具体步骤、前置条件、软件许可和授权限制请对照原文。`})]})]})]})}function er({item:e}){let{locale:t}=z(),n=t===`zh-CN`;return(0,J.jsxs)(`section`,{"data-knowledge-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-3 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`h4`,{className:`font-semibold text-ink`,children:n?`这类知识怎样帮助工作`:`How this kind of knowledge helps`}),(0,J.jsx)(`p`,{className:`mt-2`,children:On(e.kind,t)}),(0,J.jsx)(`p`,{className:`mt-2`,children:An(e.scope,t)}),(0,J.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n?`以上解释条目类型与范围,不是这篇正文的翻译或真实性证明。具体内容、来源和适用条件仍以原文为准。`:`This explains the kind and scope, not the page itself or its validity. Consult the original content, sources and conditions.`})]})}function tr({sid:e,channel:t,onOpenKnowledge:n,onOpenSkills:r}){let{locale:i}=z(),a=i===`zh-CN`,o=M(),s=A({queryKey:[`learning-status`,e],queryFn:({signal:t})=>R.learningStatus(e,t),enabled:!!e,refetchInterval:2e3,staleTime:1e3}),c=(0,G.useRef)(``);(0,G.useEffect)(()=>{let t=`${e}:${s.data?.revision??0}`;if(!(!s.data?.revision||t===c.current)){c.current=t;for(let e of[`skill-library`,`wiki-library`,`knowledge-feed`])o.invalidateQueries({queryKey:[e]})}},[e,s.data?.revision,o]);let l=N({mutationFn:e=>R.retryLearning(e.sid,e.id),onSuccess:(e,t)=>o.setQueryData([`learning-status`,t.sid],e)});if(!e||!s.data?.jobs.length)return null;let u=s.data.jobs,d=u.find(e=>e.status===`running`)??u.find(e=>e.status===`queued`),f=d??u[0],p=!!d||s.data.pending>0,m=!p&&f.status===`skipped`&&f.outcome.reason===`paused`;if(!p&&f.status===`skipped`&&(!m||!t))return null;let h={cost_unreconciled:[`上一次模型调用的费用尚未结算,结算前暂停新的模型调用`,`model calls are paused until an earlier call's cost is settled`],budget_exhausted:[`今日模型预算已用完`,`today's model budget is used up`],provider_cooldown:[`模型服务暂时限流`,`the model provider is briefly rate-limited`],operator_pause:[`模型调用已暂停`,`model calls are paused`]},g=h[f.outcome.detail??``]??h.operator_pause,_=m||!p&&f.status===`failed`,v=a?{knowledge:`知识库`,skills:`技能库`,preferences:`用户偏好`}:{knowledge:`Knowledge base`,skills:`Skill library`,preferences:`Preferences`},y=t?[t]:[`knowledge`,`skills`,`preferences`],b=p?y:y.filter(e=>(f.outcome.counts?.[e]??0)>0);if(!p&&!_&&!b.length)return null;let x=e=>{let t=f.outcome.counts?.[e]??0;return p?f.status===`running`?a?`${v[e]}正在更新`:`Updating ${v[e].toLowerCase()}`:a?`${v[e]}等待更新`:`${v[e]} update queued`:a?`${v[e]}已更新 · ${t} 条`:`${v[e]} updated · ${t}`},S=(f.outcome.items??[]).filter(e=>!t||e.channel===t);return(0,J.jsxs)(`div`,{className:`px-2 py-1.5 text-[11px] leading-5 text-ink-dim`,"data-learning-status":f.status,children:[(0,J.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:[p?(0,J.jsx)(an,{className:`h-3 w-3 animate-spin text-blue`}):_?(0,J.jsx)(tn,{className:`h-3 w-3 text-ink-faint`}):(0,J.jsx)(hn,{className:`h-3 w-3 text-blue`}),m&&(0,J.jsx)(`span`,{children:a?`本轮未学习:${g[0]}。回复不受影响。`:`Learning skipped: ${g[1]}. Your reply is unaffected.`}),!p&&f.status===`failed`&&(0,J.jsx)(`span`,{children:a?`本轮学习未完成,回复不受影响。`:`Learning from this turn did not finish. Your reply is unaffected.`}),!_&&b.map(e=>(0,J.jsx)(`span`,{children:x(e)},e)),s.data.pending>1&&(0,J.jsx)(`span`,{children:a?`还有 ${s.data.pending-1} 轮待学习`:`${s.data.pending-1} more queued`}),_&&f.retryable!==!1&&(0,J.jsx)(`button`,{type:`button`,disabled:l.isPending,className:`text-blue underline`,onClick:()=>l.mutate({sid:e,id:f.id}),children:a?`重试学习`:`Retry learning`})]}),p&&!t&&(0,J.jsx)(`p`,{className:`text-ink-faint`,children:a?`正在整理本轮的知识、方法和偏好,你可以继续工作。`:`Saving useful knowledge, methods and preferences. You can keep working.`}),S.length>0&&!t&&(0,J.jsxs)(`details`,{className:`mt-0.5`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-blue`,children:a?`查看本轮学到了什么`:`What this turn taught Argus`}),(0,J.jsx)(`ul`,{className:`pl-4 list-disc`,children:S.map((e,t)=>(0,J.jsx)(`li`,{children:(e.channel===`skills`?r:n)?(0,J.jsx)(`button`,{type:`button`,className:`text-left underline`,onClick:e.channel===`skills`?r:n,children:e.title}):e.title},t))})]}),(l.isError||s.isError)&&(0,J.jsx)(`p`,{role:`alert`,children:a?`暂时无法同步学习状态,请稍后重试。`:`Learning status could not be refreshed. Please retry.`})]})}var nr=e=>`${e.library}/${e.path}`,rr=e=>e.filter(e=>!e.is_default&&e.updated_at!=null).sort((e,t)=>(t.updated_at??0)-(e.updated_at??0)||nr(e).localeCompare(nr(t)));function ir(e,t=!0){return A({queryKey:[`skill-library`,e],queryFn:({signal:t})=>R.skillLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var ar={en:{fact:`Fact`,lesson:`Lesson`,survey:`Survey`,principles:`Principles`,note:`Note`,profile:`Profile`,page:`Page`},zh:{fact:`事实`,lesson:`经验教训`,survey:`调研摘要`,principles:`原则`,note:`个人记录`,profile:`个人概况`,page:`参考页面`}},or=e=>e.kind in ar.en?e.kind:`page`,sr=e=>[`wiki-library`,e];function cr(e,t=!0){return A({queryKey:sr(e),queryFn:({signal:t})=>R.wikiLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var lr=[`feed`,`global`,`vertical`,`project`],ur={feed:hn,global:en,vertical:rn,project:$t},dr={"zh-CN":{feed:`学习动态`,global:`全局项目`,vertical:`垂直领域`,project:`项目`},en:{feed:`Learning feed`,global:`Across projects`,vertical:`Vertical`,project:`Project`}};function fr(e,t,n,r){let i=r===`zh-CN`,a=e=>n===`feed`||e===n||n===`global`&&e===`private`,o=(e?.items??[]).filter(e=>a(e.scope)).map(e=>({kind:`knowledge`,item:e,id:`knowledge/${e.scope}/${e.vertical}/${e.path}`,title:e.title,description:e.description,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at,search:`${e.title} ${e.description} ${e.path}`})),s=(n===`feed`?rr(t?.items??[]):t?.items??[]).filter(e=>a(e.scope)).map(e=>{let t=Cn(e,r);return{kind:`skill`,item:e,id:`skill/${e.library}/${e.path}`,title:t.title,description:t.summary,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at??0,search:wn(e,r)}}),c=n===`feed`?[]:(e?.libraries??[]).filter(e=>a(e.scope)).flatMap(e=>[{kind:`index`,content:e.index_markdown,name:`INDEX.md`,title:i?`索引`:`Index`},{kind:`principles`,content:e.principles,name:`principles.md`,title:i?`原则`:`Principles`},{kind:`profile`,content:e.profile,name:`profile.md`,title:i?`个人概况(原私有范围)`:`Personal profile (private scope)`}].flatMap(t=>t.content?.trim()?[{kind:t.kind,content:t.content,id:`${t.kind}/${e.scope}/${e.vertical}/${e.root}`,title:t.title,description:``,path:`${e.root}/${t.name}`,scope:e.scope,vertical:e.vertical,updated:0,search:`${t.title} ${t.name}`}]:[]));return[...o,...s,...c].sort((e,t)=>t.updated-e.updated||e.id.localeCompare(t.id))}function pr({onOpen:e,compact:t=!1}){let{locale:n}=z();return(0,J.jsx)(`section`,{className:`shrink-0 ${t?`py-2`:`mx-2 py-1`}`,"data-learning-navigation":!0,children:lr.map(r=>{let i=ur[r],a=dr[n][r];return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>e(r),"aria-label":a,title:a,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-ink-dim hover:bg-bg hover:text-ink ${t?`justify-center`:``}`,children:[(0,J.jsx)(i,{size:16,"aria-hidden":`true`}),!t&&a]},r)})})}function mr({sid:e,initialScope:t=`feed`,initialSelection:n=null,projectNames:r={}}){let i=(0,G.useRef)(e);return(0,J.jsx)(hr,{sid:e,initialScope:t,initialSelection:i.current===e?n:null,projectNames:r},e??`no-project`)}function hr({sid:e,initialScope:t,initialSelection:n,projectNames:r}){let{locale:i}=z(),a=i===`zh-CN`,o=dr[i],[s,c]=(0,G.useState)(t),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(()=>n?n.kind===`skill`?`skill/${n.item.library}/${n.item.path}`:`knowledge/${n.item.scope}/${n.item.vertical}/${n.item.path}`:null),h=cr(e),g=ir(e),_=Kn(s===`feed`),v=fr(h.data,g.data,s,i),y=v.find(e=>e.id===p),b=y?.kind===`knowledge`?y.item:null,x=y?.kind===`skill`?y.item:null,S=A({queryKey:[`wiki-document`,e,b?.scope,b?.vertical,b?.path,b?.updated_at],queryFn:({signal:t})=>{if(!b)throw Error(`No knowledge document selected`);return R.wikiDocument(e,b.scope,b.vertical,b.path,t)},enabled:!!b}),C=A({queryKey:[`skill-document`,e,x?.library,x?.path,x?.updated_at],queryFn:({signal:t})=>{if(!x)throw Error(`No skill document selected`);return R.skillDocument(e,x.library,x.path,t)},enabled:!!x}),w=l.trim().toLocaleLowerCase(),T=v.filter(e=>(s!==`vertical`||!d||e.vertical===d)&&(!w||`${e.search} ${e.vertical}`.toLocaleLowerCase().includes(w))),E=[...new Set([...h.data?.verticals??[],...g.data?.verticals??[]])].sort(),D=e=>e.scope===`private`?a?`个人记录 · 原私有范围,不共享`:`Personal record · private, not shared`:`${o[e.scope]}${e.vertical?` · ${En(e.vertical,i)}`:``}`,O=e=>e.kind===`skill`?a?`技能`:`Skill`:e.kind===`knowledge`?ar[a?`zh`:`en`][or(e.item)]:e.kind===`principles`?a?`原则`:`Principles`:e.kind===`profile`?a?`个人概况`:`Profile`:a?`索引`:`Index`,k=x?C:S,j=x?Cn(x,i).guide:null,M=e=>{c(e),m(null),f(``)};return(0,J.jsxs)(`div`,{className:`flex h-[min(780px,84dvh)] min-h-0 flex-col`,"data-learning-library":!0,children:[(0,J.jsx)(lt,{title:a?`知识与技能`:`Knowledge and skills`,sub:a?`在一起查看学到的知识、可复用的方法和原始资料。`:`Explore learned knowledge, reusable methods and original sources together.`}),(0,J.jsx)(tr,{sid:e,onOpenKnowledge:()=>M(`feed`),onOpenSkills:()=>M(`feed`)}),(0,J.jsx)(`nav`,{"aria-label":a?`学习资源分类`:`Learning resource categories`,className:`flex shrink-0 overflow-x-auto border-b border-line/60 px-4`,children:lr.map(e=>(0,J.jsx)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>M(e),className:`shrink-0 border-b-2 px-3 py-2.5 text-sm ${s===e?`border-blue text-ink`:`border-transparent text-ink-faint hover:text-ink`}`,children:o[e]},e))}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,J.jsxs)(`aside`,{className:`${y?`hidden md:flex`:`flex`} min-h-0 w-full flex-col md:w-80 md:shrink-0 md:border-r md:border-line/60`,children:[(0,J.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,J.jsx)(`input`,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":a?`搜索知识与技能`:`Search knowledge and skills`,placeholder:a?`搜索知识与技能`:`Search knowledge and skills`,className:`w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink`}),s===`vertical`&&(0,J.jsxs)(`select`,{value:d,onChange:e=>{f(e.target.value),m(null)},"aria-label":a?`垂直领域`:`Vertical`,className:`w-full rounded-md border border-line bg-bg px-2 py-2 text-sm text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:a?`所有领域`:`All verticals`}),E.map(e=>(0,J.jsx)(`option`,{value:e,children:En(e,i)},e))]}),s===`feed`&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`学习记录与文件更新分开展示。文件变更不等于知识已验证。`:`Learning records and file updates are separate. An update does not prove knowledge is verified.`}),s===`global`&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`跨项目共享的知识和方法;个人记录保留原私有范围,不会被共享。`:`Shared knowledge and methods across projects. Personal records retain their private scope.`})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:[h.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`知识无法加载。`:`Knowledge could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void h.refetch(),children:a?`重试`:`Retry`})]}),g.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`技能无法加载。`:`Skills could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void g.refetch(),children:a?`重试`:`Retry`})]}),h.data?.errors.length||g.data?.errors.length?(0,J.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-err`,children:a?`部分资料无法读取;已加载的内容仍可查看。`:`Some sources could not be read; loaded material remains available.`}):null,s===`feed`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`学习记录`:`Learning records`}),_.isPending&&(0,J.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载学习记录…`:`Loading learning records…`}),_.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`学习记录无法加载。`:`Learning records could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void _.refetch(),children:a?`重试`:`Retry`})]}),_.data&&(0,J.jsx)(Qn,{events:_.data.events,items:h.data?.items??[],sid:e,projectNames:r,query:l,selected:b,onSelect:e=>{m(`knowledge/${e.scope}/${e.vertical}/${e.path}`)}}),(0,J.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`文件更新`:`File updates`})]}),(h.isPending||g.isPending)&&(0,J.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载资料…`:`Loading material…`}),!h.isPending&&!g.isPending&&!h.isError&&!g.isError&&!T.length&&(0,J.jsx)(`p`,{className:`p-3 text-sm text-ink-faint`,children:s===`project`&&!e?a?`选择一个项目以查看资料。`:`Select a project to see its material.`:a?`当前分类或筛选条件下没有资料。`:`No material matches this category or filter.`}),T.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>m(e.id),"aria-pressed":y?.id===e.id,className:`block w-full rounded-md px-3 py-3 text-left ${y?.id===e.id?`bg-blue/10`:`hover:bg-bg`}`,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,J.jsx)(`span`,{className:`shrink-0 rounded bg-line/60 px-1.5 text-[10px] text-ink-dim`,children:O(e)}),(0,J.jsx)(`span`,{className:`break-words text-sm font-medium text-ink`,children:e.title})]}),e.description&&(0,J.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs text-ink-dim`,children:e.description}),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:D(e)}),e.updated>0&&(0,J.jsx)(`time`,{className:`mt-1 block text-[11px] text-ink-faint`,dateTime:new Date(e.updated*1e3).toISOString(),children:new Date(e.updated*1e3).toLocaleString(i)})]},e.id))]})]}),(0,J.jsx)(`article`,{className:`${y?`block`:`hidden md:block`} min-w-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:y?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,className:`mb-4 text-sm text-blue md:hidden`,onClick:()=>m(null),children:a?`← 返回列表`:`← Back to the list`}),(0,J.jsx)(`h3`,{className:`break-words text-lg font-semibold text-ink`,children:y.title}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[O(y),` · `,D(y)]}),(0,J.jsx)(`p`,{className:`mt-1 break-all text-xs text-ink-faint`,children:y.path}),b&&(0,J.jsx)(er,{item:b}),x&&j&&(0,J.jsx)($n,{item:x,guide:j}),(0,J.jsx)(`div`,{className:`mt-5 border-t border-line/60 pt-5 text-sm text-ink`,children:y.kind===`knowledge`||y.kind===`skill`?(0,J.jsxs)(J.Fragment,{children:[k.isPending&&(0,J.jsx)(`p`,{children:a?`正在加载全文…`:`Loading document…`}),k.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-err`,children:[k.error.message,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void k.refetch(),children:a?`重试`:`Retry`})]}),b&&S.data?.truncated&&(0,J.jsx)(`p`,{role:`status`,className:`mb-3 text-xs text-ink-faint`,children:a?`页面过长,已截断显示。`:`Page shortened for display.`}),k.data&&(j?(0,J.jsxs)(`details`,{children:[(0,J.jsx)(`summary`,{className:`cursor-pointer py-2 text-blue`,children:a?`查看原始技能文档`:`Read the original skill`}),(0,J.jsx)(H,{children:k.data.content})]}):(0,J.jsx)(H,{children:k.data.content}))]}):(0,J.jsx)(H,{children:y.content})})]}):(0,J.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-ink-faint`,children:[(0,J.jsx)(K,{size:18,"aria-hidden":`true`}),a?`选择资料,阅读原文与使用条件。查看不会执行技能。`:`Select material to read its original and conditions. Reading does not execute a skill.`]})})]})]})}var gr=[{value:`copilot`,label:`settings.backendLabel.copilot`},{value:`codex`,label:`settings.backendLabel.codex`},{value:`claude`,label:`settings.backendLabel.claude`},{value:`cursor`,label:`settings.backendLabel.cursor`},{value:`opencode`,label:`settings.backendLabel.opencode`},{value:`pi`,label:`settings.backendLabel.pi`},{value:`grok`,label:`settings.backendLabel.grok`},{value:`qoder`,label:`settings.backendLabel.qoder`},{value:`dsh`,label:`settings.backendLabel.dsh`}],_r={copilot:`copilot`,codex:`codex`,claude:`claude`,cursor:`cursor`,opencode:`opencode`,pi:`pi`,grok:`grok`,qoder:`qoder`,dsh:`dsh`};function vr(e){return _r[e]??``}function yr(e,t){let n=vr(e);return n?t(`settings.backendLabel.${n}`):e}function br(e){return e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.value??e?.roles[0]?.backend??``}function xr(e){let t=e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.source??``;return t===`env`||t===`persisted`||t==="default"?t:``}function Sr(e){return(e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.saved??``).trim()}function Cr(e){return typeof e==`string`&&/^[\p{L}\p{N}_-][\p{L}\p{N}_.-]{0,127}$/u.test(e)}function wr(e){return e===void 0?{}:Cr(e)?{sessionId:e}:null}function Tr(e,t){return typeof e==`string`?e.trim().slice(0,t):``}function Er(e,t){return Tr(e,t*2).replace(/!?(?:\[([^\]]+)\])\([^)]+\)/g,`$1`).replace(/[*_`#]/g,``).replace(/\s+/g,` `).trim().slice(0,t)}function Dr(e){let t=Tr(e.completionId,300),n=wr(e.sessionId);if(!t||!n)return null;let r=Tr(e.path,1e3);return{...n,deliveryId:t,title:Er(e.title,240)||`已完成的任务`,summary:Er(e.summary,500),...r?{path:r}:{}}}function Or(e,t){let n=Tr(e.delivery_id,300),r=wr(t);return!n||!r?null:{...r,deliveryId:n,title:Tr(e.title,240)||`Argus`,summary:Tr(e.summary,1e3),...e.primary_target?.path?{path:Tr(e.primary_target.path,1e3)}:{}}}function kr(){return typeof window>`u`||window.parent===window?null:window.parent}function Ar(){return kr()!==null}function jr(){kr()?.postMessage({type:`argus:show-trial-setup`},`*`)}function Mr(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=Tr(t.deliveryId,300),r=wr(t.sessionId);if(!n||!r)return null;let i=Tr(t.path,1e3);return{...r,deliveryId:n,title:Tr(t.title,240)||`Argus`,summary:Tr(t.summary,1e3),...i?{path:i}:{}}}function Nr(e){let t=Mr(e),n=kr();return!t||!n?Promise.resolve(!1):(n.postMessage({type:`argus:notify-completion`,payload:t},`*`),Promise.resolve(!0))}function Pr(e){let t=kr();t&&t.postMessage({type:`argus:large-preview`,payload:e},`*`)}function Fr(e){let t=typeof window<`u`?window.location?.ancestorOrigins?.[0]:void 0;if(t&&t!==`null`)return e===t;if(typeof document<`u`&&document.referrer)try{let t=new URL(document.referrer);if(t.protocol===`http:`||t.protocol===`https:`)return e===t.origin;if(t.protocol===`tauri:`&&t.hostname===`localhost`)return e===`tauri://localhost`}catch{}return[`http://tauri.localhost`,`https://tauri.localhost`,`tauri://localhost`].includes(e)}function Ir(e){let t=kr();if(!t)return()=>void 0;let n=n=>{if(n.source!==t||!Fr(n.origin)||n.data?.type!==`argus:open-delivery`)return;let r=Mr(n.data.payload);r&&e(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function Lr(e){let t=kr();if(!t)return()=>void 0;let n=n=>{n.source===t&&n.data?.type===`argus:new-chat`&&e()};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function Rr(){if(typeof document>`u`)return()=>void 0;let e=kr();if(!e)return()=>void 0;let t=t=>{if(t.defaultPrevented||t.button!==0&&t.button!==1)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null;if(!n)return;let r;try{r=new URL(n.href,window.location.href)}catch{return}r.origin===window.location.origin||![`http:`,`https:`].includes(r.protocol)||(t.preventDefault(),e.postMessage({type:`argus:open-external`,payload:r.toString()},`*`))},n=t=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.shiftKey||!(t.ctrlKey||t.metaKey))return;let n=t.key===`,`?`argus:show-setup`:t.key.toLowerCase()===`n`?`argus:request-new-chat`:null;n&&(t.preventDefault(),e.postMessage({type:n},`*`))},r=()=>e.postMessage({type:`argus:cockpit-interaction`},`*`);return document.addEventListener(`click`,t,!0),document.addEventListener(`auxclick`,t,!0),window.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r,{passive:!0}),()=>{document.removeEventListener(`click`,t,!0),document.removeEventListener(`auxclick`,t,!0),window.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}}var zr=21600,Br=e=>!e||[`auto`,`inherit`,`default`].includes(e.toLowerCase());function Vr({sid:e,roles:t,running:n,lastCall:r,onOpenSettings:i}){let{locale:a,t:o}=z(),{data:s}=Me(e,!0),c=a===`zh-CN`,l=(n?t.find(e=>e.active):void 0)??t.find(e=>e.role===`manager`),u=s?.trial_mode===!0,d=!!r&&(n||Date.now()/1e3-(r.ts||0)e.role===f.role):void 0,_=g&&g.backend&&g.backend!==f?.backend?g.backend:``,v=g&&!Br(g.model)&&g.model!==f?.model?g.model:``,y=_||v?[yr(_||g.backend,o),v||g.model||`auto`].join(` · `):``,b=(0,J.jsxs)(J.Fragment,{children:[u?c?`试用`:`Trial`:p?yr(p,o):c?`模型信息待确认`:`Model information unavailable`,m?` · ${m}`:``,h?` · ${h}`:``,!u&&!f&&n&&l?.active?` · ${gt(l.role)?Ve(l.role,o):l.role}`:``]}),x=f?c?`最近一次模型调用实际使用的后端、模型和推理强度;点击更改`:`Backend, model and effort the latest model call actually used; click to change`:c?`当前配置的后端与模型;点击更改`:`Configured backend and model; click to change`;return(0,J.jsxs)(`div`,{className:`composer-runtime`,"aria-label":c?`当前后端与模型`:`Current backend and model`,children:[i&&!u?(0,J.jsxs)(`button`,{type:`button`,className:`composer-runtime-model`,onClick:i,title:x,"data-runtime-open-settings":!0,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}):(0,J.jsxs)(`span`,{className:`composer-runtime-model`,title:u?void 0:x,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}),(0,J.jsxs)(`details`,{className:`composer-runtime-details`,children:[(0,J.jsx)(`summary`,{children:c?`运行信息`:`Runtime details`}),(0,J.jsx)(`div`,{children:b})]}),y?(0,J.jsx)(`span`,{className:`composer-runtime-next`,"data-runtime-next":!0,children:c?`下次使用:${y}`:`next call: ${y}`}):null,u&&Ar()?(0,J.jsx)(`button`,{type:`button`,onClick:jr,children:c?`更换 Key`:`Change Key`}):null]})}function Hr({session:e}){let{locale:t}=z(),n=t===`zh-CN`,r=n?`会话目录`:`Session directory`,i=e.workdir||e.cwd||(n?`待确认`:`Pending confirmation`);return(0,J.jsxs)(`details`,{className:`session-workdir`,"data-session-workdir":!0,children:[(0,J.jsxs)(`summary`,{title:`${r}: ${i}`,"aria-label":`${r}: ${i}`,children:[(0,J.jsx)(`span`,{children:r}),(0,J.jsx)(`code`,{children:i})]}),(0,J.jsxs)(`div`,{className:`session-workdir__detail`,children:[(0,J.jsx)(`strong`,{children:r}),(0,J.jsx)(`code`,{children:i}),(0,J.jsx)(`p`,{children:n?`来自已加载会话快照的工作目录;不是每个任务的实际 cwd,也不是安全沙箱边界。`:`Working directory from the loaded session snapshot; not each task’s actual cwd or a security sandbox boundary.`})]})]})}function Ur(e){return!Number.isFinite(e)||e<=0?`$0.00`:e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(3)}`}function Wr({settledUsd:e,knownUsd:t=0,status:n=`empty`}){let r=typeof e==`number`&&Number.isFinite(e)?e:t,i=n===`partial`||n===`unpriced`;return`${Ur(Math.max(0,r||0))}${i?`+`:``}`}function Gr({settledUsd:e,knownUsd:t,status:n,calls:r=0,premiumRequests:i=0,live:a=!1,compact:o=!1}){let s=Wr({settledUsd:e,knownUsd:t,status:n}),c=[`Cumulative settled project spend`,`${r} model call${r===1?``:`s`}`,i>0?`${i.toFixed(1)} premium requests`:``,n&&n!==`empty`?`pricing: ${n}`:``].filter(Boolean).join(` · `);return(0,J.jsxs)(`span`,{title:c,"aria-label":`Project spend ${s}`,className:`inline-flex shrink-0 items-center rounded-full border border-gold/25 bg-gold/8 font-mono tabular-nums text-gold ${o?`h-6 gap-1 px-2 text-[10px]`:`h-5 gap-1 px-1.5 text-[9px]`}`,children:[a?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-gold/80`}):null,(0,J.jsx)(`span`,{children:s})]})}var Kr=e=>String(e??``).trim(),qr=/^[a-z][a-z -]+ requires an operator-owned decision before continuing\.?$/i,Jr=e=>{let t=Kr(e);return qr.test(t)?``:t},Yr=(e,t)=>{let n=/[\u3400-\u9fff]/.test(`${e}\n${t}`);return{id:`custom`,label:n?`自己输入`:`Write my own answer`,description:n?`直接告诉 Argus 你的决定。`:`Tell Argus your decision directly.`,requires_note:!0}};function Xr(e,t,n){let r=[...e,...t],i=new Map(t.map(e=>[Kr(e.id),e])),a=(e,t)=>{let n=i.get(e)??(Kr(t.id)===e?t:void 0);return{task_title:Kr(n?.title)||void 0,task_status:Kr(n?.status)||void 0}},o=[],s=new Set;for(let e of r){let t=Kr(e.id),n=e.operator_decision;if(n&&typeof n==`object`&&!Array.isArray(n)){let r=n,i=Kr(r.id);if(!i||s.has(i)||Kr(r.status)!==`pending`)continue;s.add(i);let c=Kr(r.options_source),l=r.kind===`domain_intake`,u=(c===`agent`||l&&c===`workflow`)&&Array.isArray(r.options)?r.options.filter(e=>!!Kr(e?.id)&&!!Kr(e?.label)).map(e=>({...e,requires_note:e.requires_note===!0})):[];u.some(e=>e.id===`custom`)||u.push(Yr(Kr(r.title),Kr(r.question)));let d=Kr(r.item_id)||t;o.push({id:i,...l?{kind:`domain_intake`}:{},item_id:d,revision:Number(r.revision??1),status:`pending`,title:Kr(r.title)||Kr(e.title)||`Decision required`,reason:Jr(r.reason),question:Kr(r.question)||Kr(e.pending_question),evidence:Array.isArray(r.evidence)?r.evidence.filter(e=>Kr(e?.label)!==`Acceptance check`):[],options:u,options_source:l?`workflow`:u.length?`agent`:`none`,selected_option:``,note:``,...a(d,e),...l?{task_title:Kr(r.task_title),task_status:void 0}:{},...typeof r.asked_at==`number`&&Number.isFinite(r.asked_at)&&r.asked_at>0?{asked_at:r.asked_at}:{}});continue}let r=Kr(e.pending_question??e.question??e.text);if(!t||!r)continue;let i=`legacy-${t}`;s.has(i)||(s.add(i),o.push({id:i,item_id:t,revision:1,status:`pending`,title:Kr(e.title??e.objective)||`Blocked task`,reason:``,question:r,evidence:[],options:[Yr(Kr(e.title??e.objective),r)],options_source:`none`,selected_option:``,note:``,legacy:!0,...a(t,e)}))}if(!n)return o;let c=o.map(e=>({...e,is_current_task:e.kind===`domain_intake`?void 0:e.item_id===n}));return[...c.filter(e=>e.kind===`domain_intake`),...c.filter(e=>e.is_current_task),...c.filter(e=>e.kind!==`domain_intake`&&!e.is_current_task)]}function Zr(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function Qr(e,t,n=``){let r=Zr(n,70);switch(e){case`manager`:return t?`正在整理任务进展`:`Summarizing progress`;case`planner`:return t?`正在安排接下来要做的事`:`Planning what to do next`;case`reviewer`:return r?t?`正在检查结果:${r}`:`Checking the result: ${r}`:t?`正在检查结果是否正确`:`Checking whether the result is correct`;default:return r?t?`正在处理:${r}`:`Working on: ${r}`:t?`正在处理当前任务`:`Working on the current task`}}var $r=new Set([`running`,`in_progress`,`claimed`,`active`,`working`,`grounding`,`framed`]),ei=new Set([`complete`,`completed`,`done`,`success`,`ended`]),ti=new Set([`paused`,`stopped`,`cancelled`,`aborted`,`incomplete`,`blocked`,`stalled`]),ni=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:null;function ri(e){return String(e.item_id||e.mission_id||``).split(`:attempt:`)[0]}function ii(e,t,n){let r=e?.backlog?.find(e=>e.id===n),i=Date.parse(e?.daemon.started_at_iso||``)/1e3;return Math.max(t?.mission.id===n&&t.mission.started_at||0,r?.started_ts||0,Number.isFinite(i)?i:0)}function ai(e,t=0){let n=new Map;for(let r of e){if(Number(r.ts||0)oi.has(String(e.type||``))&&ri(e)===t.id&&Number(e.ts||0)>=r);e?.type===`round.external_work_wait.started`&&(i=String(e.work_id||``)),a=e?.type===`round.external_work_wait.completed`}else return null;if(a)return null;let o=(e.background_work||[]).find(e=>i&&e.work_id===i||e.waited_by?.includes(t.id));return o?{workId:o.work_id,parts:(o.parts||[]).map(e=>({role:e.role,done:e.done,total:e.total,running:e.running})),done:o.done,total:o.total,lastProgressAt:ni(o.last_progress_ts)}:i?{workId:i,parts:[],done:0,total:0,lastProgressAt:null}:null}function ci(e,t,n=[],r=Date.now()/1e3){let i=t?.mission.id||e?.backlog?.find(e=>$r.has(e.status)||e.status===`paused_external_work`)?.id||``,a=e?.backlog?.find(e=>e.id===i),o=ii(e,t,i),s=e?.roles?.filter(e=>e.active)||[],c=(e?.backlog?.filter(e=>$r.has(e.status)).length||0)>1,l=new Map;for(let e of t?.role_work||[])i&&(e.item_id||e.mission_id)!==i||e.ts$r.has(e.status)).sort((e,t)=>t.ts-e.ts).find(e=>s.some(t=>t.role===e.role))?.role||(c?``:(s.find(e=>e.role===t?.active_role)||s[0])?.role)||(e?``:t?.roles.find(e=>e.status===`active`)?.role)||``,d=n.filter(e=>{let t=ri(e);return(!i||t===i)&&Number(e.ts||0)>=o&&!String(e.run_label||``).startsWith(`map-summary`)&&/(?:progress|round\.(?:main|review)|life\.(?:mission|phase)|work\.segment)/.test(String(e.type||``))}).map(e=>ni(e.ts));for(let e of t?.role_work||[]){let t=e.item_id||e.mission_id;(!i||t===i)&&e.ts>=o&&e.kind!==`waiting`&&![`waiting`,`idle`].includes(e.status)&&d.push(ni(e.ts))}let f=d.filter(e=>e!==null&&e<=r+5),p=f.length?Math.max(...f):null,m={state:`idle`,role:u,taskId:i,title:t?.mission.title||a?.title||t?.mission.objective||``,activityAt:p,activityAgeSeconds:p===null?null:Math.max(0,r-p),reason:``};if(!e||e.daemon.read_status===`error`)return{...m,state:`unknown`};if(e.manager_requests?.some(e=>e.status===`running`)??!1){let e=ni(ai(n)?.ts)??p;return{...m,state:`running`,role:`manager`,foreground:!0,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}if(!i){let e=[...n].reverse().find(e=>e.type===`ui.argus`&&e.mission_result===!0&&!e.item_id&&e.live!==!0);if(e){let t=ni(e.ts);return{...m,state:`step_finished`,activityAt:t,activityAgeSeconds:t===null?null:Math.max(0,r-t),reason:e.success===!1?`task_failed`:``}}}let h=si(e,a,n,o);if(h){let e=h.lastProgressAt??p;return{...m,state:`waiting`,role:``,reason:`background_work`,waitingOn:h,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}let g=String(a?.status||t?.mission.status||``).toLowerCase();if(ti.has(g)||g.startsWith(`paused_`)||g===`research_incomplete`){let t=Xr(e.pending_questions??[],e.backlog.map(e=>({...e})),i).some(e=>e.item_id===i);return{...m,state:`paused`,role:``,reason:t?`operator_input`:`not_running`}}if([`failed`,`error`].includes(g))return{...m,state:`step_finished`,role:``,reason:`task_failed`};if(ei.has(g))return e.daemon.alive&&s.some(e=>e.role===`planner`)?{...m,state:`running`,role:`planner`}:{...m,role:``,state:e.daemon.alive&&(t?.routing?.continuous||e.continuous?.enabled)?`waiting`:`step_finished`};if(!e.daemon.alive)return $r.has(g)?{...m,state:`paused`,role:``,reason:`not_running`}:{...m,role:``};let _=[...n].reverse().find(e=>e.type===`round.backend_failure.backoff`&&Number(e.ts||0)>=o&&(!i||ri(e)===i));return _&&Number(_.ts||0)+Number(_.seconds||0)>r&&Number(_.ts||0)>=(p||0)?{...m,state:`waiting`,reason:`provider_wait`}:e.daemon.health?.stalled?{...m,state:`waiting`,reason:`no_recent_progress`}:u?{...m,state:`running`}:c&&s.length>0&&i?{...m,state:`unknown`}:{...m,state:`waiting`,reason:`awaiting_next_step`}}function li(e,t){let n=t===`zh-CN`;return e===null?``:e<60?n?`刚刚`:`just now`:e<3600?n?`${Math.floor(e/60)} 分钟前`:`${Math.floor(e/60)} min ago`:n?`${Math.floor(e/3600)} 小时前`:`${Math.floor(e/3600)} hr ago`}var ui={"idea-route":[`条研究路线`,[`research route`,`research routes`]],"idea-review":[`次独立复核`,[`independent review`,`independent reviews`]],"idea-selector":[`次方案选择`,[`idea selection`,`idea selections`]]};function di(e,t){if(!e.total)return``;let[n,[r,i]]=ui[e.role]??[`项子任务`,[`subtask`,`subtasks`]],a=e.total===1?r:i;return e.done===e.total?t?`${e.total} ${n}全部完成`:`all ${e.total} ${a} done`:t?`${e.total} ${n}中 ${e.done} ${n.slice(0,1)}完成`:`${e.done} of ${e.total} ${a} done`}function fi(e,t){let n=t===`zh-CN`,r=e.waitingOn,i=(r?.parts??[]).map(e=>di(e,n)).filter(Boolean),a=i.length?i.join(n?`、`:`, `):r?.total?n?`${r.total} 项子任务中 ${r.done} 项完成`:`${r.done} of ${r.total} subtasks done`:``,o=li(e.activityAgeSeconds,t),s=o?n?o===`刚刚`?`,最近一次进展就在刚刚`:`,最近一次进展在 ${o}`:`, last progress ${o}`:``;return a?n?`正在等待后台团队:${a}${s}`:`Waiting for the background team: ${a}${s}`:n?`正在等待后台团队完成工作${s}`:`Waiting for the background team to finish${s}`}function pi(e,t,n=!0){let r=t===`zh-CN`;return n?e.reason===`operator_input`?r?`当前任务等待你的回复`:`This task is waiting for your reply`:e.reason===`task_failed`?r?`这一步执行未完成`:`Execution of this step did not finish`:e.reason===`background_work`?fi(e,t):e.state===`running`?e.foreground?r?`正在处理你的请求`:`Working on your request`:Qr(e.role,r,e.title):e.reason===`provider_wait`?r?`模型服务暂时未能完成请求,等待后会重试`:`The model service could not complete the request; waiting before retrying`:e.reason===`no_recent_progress`?r?`暂时没有收到新的进展`:`No new progress received recently`:{running:[`正在处理当前任务`,`Working on the current task`],waiting:[`等待下一步工作`,`Waiting for the next step`],paused:[`当前任务未在运行`,`The current task is not running`],step_finished:[`这一步已结束`,`This step has ended`],idle:[`可以开始新任务`,`Ready for a new task`],unknown:[`暂时无法确认任务进度`,`Unable to confirm task progress right now`]}[e.state][+!r]:r?`实时连接已断开`:`Live connection lost`}var mi=new Set([`grounding`,`task`,`decision`,`agent_message`,`assistant_message`,`command_execution`,`tool_use`,`tool_result`,`handoff`,`review`,`verdict`,`completion`,`plan`,`file_change`,`result`]),hi=/^(using a tool|running project command|inspecting project state|working|reporting progress|暂无详细记录)$/i;function gi(e){let t=pe(e).replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/gim,``).trim();return hi.test(t)||t.startsWith(`{`)?``:t}function _i(e,t,n=``){if(n){if(/^(?:rg|grep|glob|search)$/.test(n))return t?`检索项目文件`:`Searching project files`;if(/^(?:view|read|read_file)$/.test(n))return t?`读取文件`:`Reading a file`;if(/apply_patch|edit|write/.test(n))return t?`编辑文件`:`Editing a file`;if(/bash|shell|exec|terminal/.test(n))return t?`运行终端命令`:`Running a command`;if(/playwright|browser/.test(n))return t?`检查浏览器交互`:`Checking browser interactions`}return({grounding:[`理解任务与检查项目`,`Understanding the task`],task:[`安排任务`,`Task assignment`],decision:[`确定执行方案`,`Execution decision`],plan:[`制定执行计划`,`Planning the work`],agent_message:[`更新执行进度`,`Progress update`],assistant_message:[`更新执行进度`,`Progress update`],command_execution:[`运行项目命令`,`Running a project command`],tool_use:[`使用工具`,`Using a tool`],tool_result:[`工具输出`,`Tool output`],file_change:[`更新项目文件`,`Updating project files`],handoff:[`整理结果与后续工作`,`Summarizing results and next steps`],review:[`检查实现与结果`,`Checking implementation and results`],verdict:[`说明检查结果`,`Explaining the check result`],completion:[`完成任务`,`Task completed`],result:[`产出结果`,`Result`]}[e]??[`处理当前任务`,`Working on the current task`])[+!t]}function vi(e,t,n,r=0){let i=new Map;for(let a of e?.role_work??[]){if(a.role!==t||!mi.has(a.kind)||a.tst.ts-e.ts)}function yi(e,t,n,r=0){return[...e].reverse().find(e=>e.type===`engineer.progress`&&Number(e.ts||0)>=r&&[`tool_use`,`command_execution`,`file_change`].includes(String(e.kind))&&String(e.agent_layer||e.actor||e.role)===t&&(!n||String(e.item_id||e.mission_id)===n))}function bi(e,t,n,r,i){return r||[`done`,`completed`,`failed`,`aborted`,`stopped`].includes(e?.mission.status??``)||i&&e?.mission.id!==i?!1:t.length?t.some(e=>e.role===n&&e.active):e?.active_role===n&&[`working`,`grounding`,`framed`,`running`].includes(e?.mission.status??``)}function xi(e,t){let n=Math.max(0,Math.floor(e));if(n<30)return``;let[r,i,a]=n<60?[n,`秒`,`s`]:n<3600?[Math.floor(n/60),`分钟`,`m`]:n<86400?[Math.floor(n/3600),`小时`,`h`]:[Math.floor(n/86400),`天`,`d`];return t?`上次更新 ${r} ${i}前`:`last update ${r}${a} ago`}function Si(e,t,n,r,i=!0,a=0){let o=pi(e,r,i);if(!i||e.state!==`running`||e.foreground||!e.taskId||!e.role)return o;let s=Math.max(a,t?.mission.id===e.taskId&&t.mission.started_at||0),c=vi(t,e.role,e.taskId,s).find(e=>e.detail&&[`agent_message`,`assistant_message`].includes(e.kind)||[`tool_use`,`command_execution`,`file_change`].includes(e.kind)),l=yi(n,e.role,e.taskId,s);if(c?.detail&&[`agent_message`,`assistant_message`].includes(c.kind)&&(!l||Number(l.ts||0)=c.ts)){let t=_i(String(l.kind),r===`zh-CN`,String(l.tool_name||``));return e.title?`${t}${r===`zh-CN`?`:`:`: `}${Zr(e.title,70)}`:t}return c&&[`tool_use`,`command_execution`,`file_change`].includes(c.kind)?_i(c.kind,r===`zh-CN`):o}var Ci=new Set([`running`,`in_progress`,`claimed`]);function wi({snap:e,streamOk:t,onStart:n,onStop:r,onManage:i,onOpenSessions:a,mobileView:s,onToggleMobileView:c,busy:u,snapshotStale:d=!1,readOnly:f=!1,missionView:p,events:m=[]}){let{t:h,locale:g}=z(),_=ci(e,p,m),v=Si(_,p,m,g,t,ii(e,p,_.taskId)),y=[`complete`,`completed`,`done`,`success`].includes(String(p?.mission.status||``).toLowerCase()),b=_.role||`manager`,x=_.state===`running`&&t&&!d,S=e.backlog.find(e=>Ci.has(e.status)),C=_.title||S?.title||S?.objective||(y?p?.mission.summary||p?.mission.title:``)||e.session.objective||``,w=!!(e.partial||e.observability?.slo.status===`degraded`),T=typeof e.spend_usd==`number`?e.spend_usd:e.usage_summary?.known_cost_usd??0,E=e.daemon.alive&&e.daemon.control_available===!1,O=!e.daemon.alive&&[`running`,`waiting`].includes(ci(e,p,m).state),k=E?h(`topbar.externallyManaged`):e.daemon.alive?h(`topbar.pauseDaemon`):h(O?`topbar.working`:`topbar.runDaemon`),A=w?[...(e.diagnostics??[]).map(e=>`${e.section}: ${e.message}`),...e.observability?.slo.violations??[]].join(` +`)||h(`common.degraded`):h(d?`common.stale`:t?`common.live`:`common.reconnecting`);return(0,J.jsxs)(mt,{children:[a?(0,J.jsx)(`button`,{type:`button`,onClick:a,"aria-label":h(`topbar.openSessions`),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-ink-faint hover:bg-bg hover:text-ink lg:hidden`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M2.5 4h11M2.5 8h11M2.5 12h11`})})}):null,(0,J.jsxs)(`div`,{className:`topbar-heading flex min-w-0 flex-1 flex-col justify-center gap-0.5`,children:[(0,J.jsx)(`div`,{className:`topbar-title min-w-0 truncate text-sm font-semibold text-ink`,title:e.session.display_name||e.session.id,children:e.session.display_name||e.session.id}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[x?(0,J.jsx)(`span`,{"data-role-dot":b,"aria-label":h(`topbar.roleActive`,{role:zn(b,h)}),className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:B.role[b]||`rgb(var(--ink-faint))`}}):null,x||C?(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-ink-dim`,title:v,children:t?d?h(`common.stale`):v:h(`common.reconnecting`)}):null,(0,J.jsx)(Hr,{session:e.session})]})]}),(0,J.jsx)(`span`,{title:A,className:`h-2 w-2 shrink-0 rounded-full transition-shadow duration-150 ${w||d?`bg-err ring-1 ring-err/30 ring-offset-1 ring-offset-panel`:t?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,children:(0,J.jsx)(`span`,{className:`sr-only`,children:A})}),T>0?(0,J.jsx)(Gr,{settledUsd:e.spend_usd,knownUsd:e.usage_summary?.known_cost_usd,status:e.spend_status,calls:e.usage_summary?.call_count,premiumRequests:e.usage_summary?.premium_requests,live:e.daemon.alive,compact:!0}):null,c?(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":h(s===`activity`?`topbar.showPreview`:`topbar.showActivity`),title:h(s===`activity`?`topbar.showPreview`:`topbar.showActivity`),className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center lg:hidden`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:s===`activity`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`11`,rx:`1.5`}),(0,J.jsx)(`path`,{d:`M9.5 2.75v10.5`})]}):(0,J.jsx)(`path`,{d:`M3 4h10M3 8h10M3 12h7`})})}):null,f?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,disabled:u||E||O,onClick:e.daemon.alive?r:n,"aria-label":k,title:E?h(`topbar.externalDaemonHint`):k,className:`compact-control flex h-8 shrink-0 items-center gap-1 px-2 disabled:opacity-40`,children:[(0,J.jsx)(o,{icon:e.daemon.alive?l:D,className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:E?h(`common.external`):e.daemon.alive?h(`common.pause`):h(O?`common.working`:`common.run`)})]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":h(`topbar.manageSession`),title:h(`topbar.manageSession`),onClick:i,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center text-sm tracking-widest`,children:`···`})]})]})}var Ti=new Set([`running`,`in_progress`,`claimed`]);function Ei(e,t){let n;for(let r of t)r.item_id!==e.id||![`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.mission.orphaned`].includes(r.type)||(!n||r.ts>=n.ts)&&(n=r);if(n?.type===`life.mission.completed`&&!(n.ts(t.status===`done`||Ti.has(t.status))&&(t.ts??0)>e?t.ts??0:e,0)}function Oi(e,t){return e.status===`failed`&&!e.pending_question&&(e.ts??0)t.status!==`done`&&!Ti.has(t.status)&&(t.pending_question||t.status===`failed`&&!Oi(t,e))).sort((e,t)=>Number(!!t.pending_question)-Number(!!e.pending_question))}function Ai(e){return e.find(e=>Ti.has(e.status))??ki(e)[0]??e.find(e=>e.status===`pending`)??e.at(-1)}function ji(e,t){let n=new Set,r=new Set;for(let i of e.links)i.kind===`dependency`&&(i.target===t&&n.add(i.source),i.source===t&&r.add(i.target));return{upstream:e.tasks.filter(e=>n.has(e.id)),downstream:e.tasks.filter(e=>r.has(e.id))}}function Mi(e){return e.status===`cancelled`?`aborted`:e.pending_question?`question`:Ti.has(e.status)?`running`:e.outcome?.review_status===`unavailable`?`review_unavailable`:e.status===`failed`&&Ni(e)?`held`:e.status.startsWith(`paused`)||e.status===`blocked`?`paused`:[`done`,`failed`,`aborted`,`skipped`,`superseded`,`pending`,`missing`].includes(e.status)?e.status:`unknown`}function Ni(e){return e.outcome?.stage_certification===`not_certified`||!e.outcome?.execution_status&&/^manager stage hold:/i.test(e.last_error||``)}function Pi(e,t){let n=e=>t.some(t=>t.type===`life.mission.started`&&t.ts>e);return e.filter(e=>e.status===`done`&&e.outcome?.review_status===`done`&&e.outcome.stage_certification===`certified`).map(e=>({task:e,completion:Ei(e,t)})).filter(({completion:e})=>e?.overall_complete===!0&&!n(e.ts)).map(({task:e})=>e).sort((e,t)=>(t.finished_ts??t.ts??0)-(e.finished_ts??e.ts??0))[0]}function Fi(e){let t=new Set,n=[],r=new Map([...e.keys()].map(e=>[e,[]]));for(let[t,n]of e)for(let e of n)r.get(e).push(t);for(let r of e.keys()){let i=[[r,!1]];for(;i.length;){let[r,a]=i.pop();if(a)n.push(r);else if(!t.has(r)){t.add(r),i.push([r,!0]);for(let n of e.get(r))t.has(n)||i.push([n,!1])}}}let i=new Map;for(let e of n.reverse()){if(i.has(e))continue;let t=i.size,n=[e];for(;n.length;){let e=n.pop();if(!i.has(e)){i.set(e,t);for(let t of r.get(e))n.push(t)}}}return i}function Ii(e){let t=new Map(e.map(e=>[e.id,e])),n=[...t.values()].sort((e,t)=>(e.ts??0)-(t.ts??0)||e.id.localeCompare(t.id)),r=[],i=new Set;for(let e of n)for(let n of new Set(e.deps??[]))t.has(n)||i.add(n),r.push({id:JSON.stringify([`dep`,n,e.id]),source:n,target:e.id,kind:`dependency`,missing:!t.has(n)});let a=[...[...i].map(e=>({id:e,title:`未包含的依赖`,objective:`该引用不在当前数据范围内。`,status:`missing`,deps:[],role:`system`})),...n],o=new Map(a.map(e=>[e.id,0])),s=new Map(a.map(e=>[e.id,[]]));r.forEach(e=>{o.set(e.target,(o.get(e.target)??0)+1),s.get(e.source)?.push(e.target)});let c=a.filter(e=>o.get(e.id)===0).map(e=>e.id),l=0;for(let e=0;et.id!==e.id&&t.plan_id===e.superseded_by_plan_id);t.length&&r.push({id:JSON.stringify([`replacement`,e.id,e.superseded_by_plan_id]),source:e.id,target:t[0].id,kind:`replacement`,target_plan_id:e.superseded_by_plan_id,target_count:t.length})}if(u){let e=Fi(s);r.filter(t=>t.kind===`dependency`&&e.get(t.source)===e.get(t.target)).forEach(e=>{e.cycle=!0})}return{tasks:a,links:r,missing:i.size,cyclic:u}}function Li(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function Ri(e){return e?.match(/route[-_ ]?(\d+)/i)?.[1]??e?.match(/(\d+)\s*$/)?.[1]??``}function zi(e,t){if(!e)return``;if(e.kind===`review`)return e.verdict===`rejected`?t?`复核:驳回`:`Review: rejected`:e.verdict===`qualified`?t?`复核:通过`:`Review: qualified`:``;if(e.kind===`route`)return e.selected?t?`通过 · 被选中`:`Qualified · chosen`:e.verdict===`rejected`?t?`驳回`:`Rejected`:e.verdict===`qualified`?e.selected===!1?t?`通过 · 未选中`:`Qualified · not chosen`:t?`通过`:`Qualified`:``;let n=Ri(e.selected_route);return n?t?`已选研究路线 ${n}`:`Chose route ${n}`:``}function Bi(e){return e?e.kind===`selection`?e.selected_route?`chosen`:``:e.selected?`chosen`:e.verdict??``:``}function Vi(e){let t=String(e||``).split(/\r?\n/).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY|NEXT_ACTION)\s*=\s*/i,``).trim()).filter(e=>e&&!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e)).join(` `);return t.length>160?`${t.slice(0,159)}…`:t}function Hi(e){let t=new Map;for(let n of e){if(n.type!==`idea.portfolio.formed`)continue;let e=Number(n.width);if(!Number.isInteger(e)||e<=0)continue;let r=t.get(n.item_id);(!r||n.ts>=r.ts)&&t.set(n.item_id,{ts:n.ts,width:e})}return new Map([...t].map(([e,t])=>[e,t.width]))}function Ui(e,t,n,r=16){let i=new Map;for(let e of t){if(e.type!==`team.task`||!e.item_id)continue;let t=i.get(e.item_id)??new Map;t.set(e.id,e),i.set(e.item_id,t)}if(!i.size)return e;let a=new Set(e.tasks.map(e=>e.id)),o=[],s=[];for(let t of e.tasks){if(t.branch)continue;let e=[...i.get(t.id)?.values()??[]].filter(e=>!a.has(e.id)).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));if(!e.length)continue;let c=e.slice(0,r),l=new Set(c.map(e=>e.id));for(let e of c)a.add(e.id),o.push({id:e.id,title:Li(e,n),objective:Vi(e.text),excerpt:Vi(e.text),status:e.status||`unknown`,deps:[],pending_question:e.pending_question,role:`team`,team_role:e.team_role,...e.team_outcome?{team_outcome:e.team_outcome}:{},ts:e.ts,branch:!0,parent_id:t.id});let u=new Set(c.flatMap(e=>(e.deps??[]).filter(t=>l.has(t)&&t!==e.id)));for(let e of c){let n=[...new Set(e.deps??[])].filter(t=>l.has(t)&&t!==e.id);if(n.length)for(let t of n)s.push({id:JSON.stringify([`fanout`,t,e.id]),source:t,target:e.id,kind:`fanout`});else s.push({id:JSON.stringify([`fanout`,t.id,e.id]),source:t.id,target:e.id,kind:`fanout`});u.has(e.id)||s.push({id:JSON.stringify([`fanin`,e.id,t.id]),source:e.id,target:t.id,kind:`fanin`})}let d=e.length-c.length,f=`team-overflow:${t.id}`;d>0&&!a.has(f)&&(a.add(f),o.push({id:f,title:n?`还有 ${d} 条`:`+${d} more`,objective:n?`更多并行子任务收录在所属任务卡片中。`:`The remaining parallel subtasks live inside the owning card.`,status:`recorded`,deps:[],role:`team`,ts:e[r]?.ts,branch:!0,parent_id:t.id,overflow_count:d}),s.push({id:JSON.stringify([`fanout`,t.id,f]),source:t.id,target:f,kind:`fanout`},{id:JSON.stringify([`fanin`,f,t.id]),source:f,target:t.id,kind:`fanin`}))}return o.length?{...e,tasks:[...e.tasks,...o],links:[...e.links,...s]}:e}var Wi={"idea-route":[e=>`${e} 条研究路线`,e=>`${e} research route${e===1?``:`s`}`],"idea-review":[e=>`${e} 次独立复核`,e=>`${e} independent review${e===1?``:`s`}`],"idea-selector":[e=>`${e} 次方案选择`,e=>`${e} idea selection${e===1?``:`s`}`]},Gi=[e=>`${e} 个并行子任务`,e=>`${e} parallel subtask${e===1?``:`s`}`],Ki={pending:[`尚未开始`,`have not started`],running:[`正在进行`,`are under way`],done:[`已经完成`,`are complete`],failed:[`没有完成`,`did not finish`],question:[`在等待答复`,`are waiting for an answer`],paused:[`已暂停`,`are paused`],superseded:[`已被新计划替代`,`were replaced by a new plan`],aborted:[`已取消`,`were cancelled`],skipped:[`已跳过`,`were skipped`]};function qi(e,t,n){let r=e.map(({role:e,count:t})=>(Wi[e]??Gi)[+!n](t)),i=n?r.length>1?`${r.slice(0,-1).join(`、`)}与 ${r[r.length-1]}`:r[0]:r.length>1?`${r.slice(0,-1).join(`, `)} and ${r[r.length-1]}`:r[0],a=(Ki[t]??[`已记录在案`,`are on record`])[+!n];return n?`${i}${a}`:`${i} ${a}`}function Ji(e,t){let n=e.filter(e=>e.team_outcome?.kind===`route`),r=n.filter(e=>e.team_outcome?.selected).map(e=>Ri(e.title)),i=n.filter(e=>e.team_outcome?.verdict===`rejected`&&!e.team_outcome.selected).map(e=>Ri(e.title)),a=n.filter(e=>e.team_outcome?.verdict===`qualified`&&!e.team_outcome.selected).map(e=>Ri(e.title)),o=[],s=e=>[...e].sort().join(t?`、`:`, `);return r.length&&o.push(t?`路线 ${s(r)} 通过并被选中`:`route ${s(r)} qualified and chosen`),a.length&&o.push(t?`路线 ${s(a)} 通过${r.length?`但未被选中`:`,等待选择`}`:`route${a.length>1?`s`:``} ${s(a)} qualified${r.length?` but not chosen`:`, selection pending`}`),i.length&&o.push(t?`路线 ${s(i)} 被驳回`:`route${i.length>1?`s`:``} ${s(i)} rejected`),o.length?t?`:${o.join(`,`)}`:`: ${o.join(`; `)}`:``}function Yi(e,t,n,r=3){let i=new Map;for(let t of e.tasks){if(!t.branch||t.overflow_count||t.group||!t.parent_id)continue;let e=JSON.stringify([t.parent_id,Mi(t)]);(i.get(e)??i.set(e,[]).get(e)).push(t)}let a=new Set(e.tasks.map(e=>e.id)),o=new Map,s=new Map;for(let[e,c]of i){if(c.lengthe.role===t);n?n.count++:d.push({role:t,count:1})}let f=c[0],p=t.has(u);o.set(u,{id:u,title:qi(d,l,n)+Ji(c,n),objective:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,excerpt:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,status:f.status,deps:[],pending_question:f.pending_question,role:`team`,ts:f.ts,branch:!0,parent_id:i,group:{status:l,members:c.map(e=>e.id),counts:d,expanded:p}});for(let e of c)s.set(e.id,u)}if(!o.size)return e;let c=[],l=new Set;for(let n of e.tasks){let e=s.get(n.id);if(!e){c.push(n);continue}l.has(e)||(l.add(e),c.push(o.get(e))),t.has(e)&&c.push(n)}let u=[],d=new Set;for(let n of e.links){let e=s.get(n.source),r=s.get(n.target),i=n.source,a=n.target;if(e&&!t.has(e)&&(i=e),r&&!t.has(r)&&(a=r),r&&t.has(r)&&n.kind===`fanout`&&n.source===o.get(r).parent_id&&(i=r),i===a)continue;if(i===n.source&&a===n.target){u.push(n);continue}let c=JSON.stringify([n.kind,i,a]);d.has(c)||(d.add(c),u.push({...n,id:c,source:i,target:a}))}for(let[e,n]of o){if(!t.has(e))continue;let r=JSON.stringify([`fanout`,n.parent_id,e]);d.has(r)||(d.add(r),u.push({id:r,source:n.parent_id,target:e,kind:`fanout`}))}return{...e,tasks:c,links:u}}function Xi(e){return e.filter(e=>!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)).map(({source:e,target:t})=>({source:e,target:t}))}function Zi(e,t,n,r=[]){let i=(e,t)=>r.find(n=>n.source===e&&n.target===t&&n.label),a=e.links.map(e=>{if(e.kind!==`dependency`)return e;let r=t.find(t=>t.source===e.source&&t.target===e.target)??i(e.source,e.target);return r?{...e,label:r.label,stated:!0,evidence:`${n?`执行依赖`:`Execution dependency`} · ${r.label}`}:e}),o=new Map(e.tasks.map(e=>[e.id,e.id])),s=e=>{let t=o.get(e);return t===e?e:s(t)},c=(e,t)=>{o.set(s(e),s(t))};for(let e of a.filter(e=>e.kind===`dependency`))c(e.source,e.target);for(let n of t)!o.has(n.source)||!o.has(n.target)||e.tasks.findIndex(e=>e.id===n.source)>=e.tasks.findIndex(e=>e.id===n.target)||s(n.source)===s(n.target)||(a.push({source:n.source,target:n.target,label:n.label,kind:`semantic`,stated:!0,id:`semantic:${n.source}:${n.target}`}),c(n.source,n.target));for(let t=1;tQi+Math.min(500,Math.max(0,e-8)*60);function ta(e,t,n,r,i,a,o){let s=new Map(n.map(e=>[e,t[e].y+i[e].height/2]));for(let c=0;c<6;c++)for(let l of c%2?[...e].reverse():e){let e=new Set(l),c=[],u=[],d=0;l.forEach((f,p)=>{let m=s.get(f)*.8,h=.8;for(let o of a[r.get(f)]){let r=n[o.index];e.has(r)||(m+=(t[r].y+i[r].height/2)*o.weight,h+=o.weight)}c.push(d);let g=m/h-i[f].height/2-d;for(u.push({start:p,end:p,sum:g*h,weight:h});u.length>1;){let e=u[u.length-2],t=u[u.length-1];if(e.sum/e.weight<=t.sum/t.weight)break;e.end=t.end,e.sum+=t.sum,e.weight+=t.weight,u.pop()}d+=i[f].height+(p+1[e,t])),a=t.filter(e=>e.kind!==`replacement`&&e.source!==e.target).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:.4})),o=e.map(()=>[]),s=e.map(()=>[]),c=e.map(()=>[]);for(let e of a)o[e.source].push(e.target),s[e.target].push(e.source),c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let l=new Set(a.filter(e=>e.weight===1).map(e=>`${Math.min(e.source,e.target)}:${Math.max(e.source,e.target)}`)),u=(e,t)=>{let n=i.get(e),r=i.get(t);return l.has(`${Math.min(n,r)}:${Math.max(n,r)}`)?$i:$i*1.3},d=e.reduce((e,t)=>e+n[t].width*n[t].height,0),f=Math.sqrt(d/e.length),p=e.reduce((e,t)=>e+n[t].height,0)/e.length,m=Math.ceil(Math.sqrt(e.length)*1.8),h=e.map(()=>[]);for(let e of a)h[Math.max(e.source,e.target)].push(e);let g=e.map((t,n)=>{let r=0;return Array.from({length:Math.min(m,e.length-n)+1},(e,t)=>{if(t)for(let e of h[n+t-1])Math.min(e.source,e.target)1||s[e.target].length>1)&&(r+=e.weight*.9),r+=Math.max(0,Math.abs(e.target-e.source)-1)*e.weight);return r})}),_={},v=1/0,y=new Set;for(let t=1;t<=m;t++){let o=t*p+(t-1)*$i,l=Array(e.length+1).fill(1/0),m=Array(e.length+1).fill(0);l[0]=0;for(let r=1;r<=e.length;r++){let i=0;for(let a=r-1;a>=Math.max(0,r-t);a--){i+=n[e[a]].height+(a===r-1?0:$i);let t=g[a][r-a];a>0&&s[a].some(e=>s[a-1].includes(e))&&(t+=.7);let c=l[a]+.2+(i/o-1)**2+t;c0;t=m[t])h.unshift(e.slice(m[t],t));let b=JSON.stringify(h);if(y.has(b))continue;y.add(b);let x=h.map(e=>Math.max(...e.map(e=>n[e].width))),S=h.map(e=>e.reduce((e,t)=>e+n[t].height,0)+(e.length-1)*$i),C=x.reduce((e,t)=>e+t,0)+(h.length-1)*r,w=Math.max(...S),T={},E=0;h.forEach((e,t)=>{let i=(w-S[t])/2;e.forEach((r,a)=>{T[r]={x:E+(x[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1T[e].y));for(let t of e)T[t].y-=D;w=Math.max(...e.map(e=>T[e].y+n[e].height));let O=a.reduce((t,r)=>{let i=T[e[r.source]],a=T[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,a.length)/f,k=2*Math.log(C/w/2.1)**2+.08*C*w/d+.14*O+.08*l[e.length]/h.length;k[e,t])),a=e=>e.source!==e.target&&i.has(e.source)&&i.has(e.target),o=new Set,s=new Map;for(let e of t)!a(e)||e.kind!==`fanout`&&e.kind!==`fanin`||(e.kind===`fanout`?o.add(e.target):o.add(e.source),(s.get(e.source)??s.set(e.source,new Set).get(e.source)).add(e.target),(s.get(e.target)??s.set(e.target,new Set).get(e.target)).add(e.source));let c=e.map(()=>[]),l=t.filter(e=>e.kind!==`replacement`&&a(e)).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:e.kind===`fanout`||e.kind===`fanin`?.8:.4}));for(let e of l)c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let u=e.map(()=>[]);for(let e of t){if(!ra.has(e.kind)||!a(e))continue;let t=i.get(e.source),n=i.get(e.target);td[e]))+1:f+1;d.push(e),f=Math.max(f,e)}let p=[];e.forEach((e,t)=>{(p[d[t]]??=[]).push(e)});let m=p.filter(e=>e?.length),h=(e,t)=>o.has(e)&&o.has(t)?$i/2:$i,g=e=>e.reduce((t,r,i)=>t+n[r].height+(i?h(e[i-1],r):0),0),_=e.reduce((e,t)=>e+n[t].width*n[t].height,0),v=Math.sqrt(_/e.length),y=e.filter(e=>!o.has(e)),b=(y.length?y:e).reduce((e,t)=>e+n[t].height,0)/Math.max(1,y.length||e.length),x=Math.ceil(Math.sqrt(e.length)*1.8),S={},C=1/0,w=new Set;for(let t=1;t<=x;t++){let a=t*b+(t-1)*$i,u=[];for(let e of m){let t=[],n=()=>{if(!t.length)return;let e=o.has(t[0]);if(e)u.push({nodes:t,isBranch:e});else{let n=[];for(let r of t)n.length&&g([...n,r])>a&&(u.push({nodes:n,isBranch:e}),n=[]),n.push(r);n.length&&u.push({nodes:n,isBranch:e})}t=[]};for(let r of e)t.length&&o.has(t[0])!==o.has(r)&&n(),t.push(r);n()}let d=[],f=[];for(let e of u){let t=d.at(-1),n=t&&e.nodes.some(e=>t.some(t=>s.get(e)?.has(t)));!t||n||f.at(-1)!==e.isBranch||g([...t,...e.nodes])>a?(d.push([...e.nodes]),f.push(e.isBranch)):t.push(...e.nodes)}let p=JSON.stringify(d);if(w.has(p))continue;w.add(p);let y=d.map(e=>Math.max(...e.map(e=>n[e].width))),x=d.map(g),T=y.reduce((e,t)=>e+t,0)+(d.length-1)*r,E=Math.max(...x),D={},O=0;d.forEach((e,t)=>{let i=(E-x[t])/2;e.forEach((r,a)=>{D[r]={x:O+(y[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1D[e].y));for(let t of e)D[t].y-=k;E=Math.max(...e.map(e=>D[e].y+n[e].height));let A=l.reduce((t,r)=>{let i=D[e[r.source]],a=D[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,l.length)/v,j=2*Math.log(T/E/2.1)**2+.08*T*E/_+.14*A;j=e.length*.3?ia(e,t,n):na(e,t,n)}function oa(e){let t=new Map,n=new Map,r=new Map;return e.map(e=>{let i=`${e.source}\u0000${e.target}`,a=(t.get(e.source)??0)+(n.get(e.target)??0)-(r.get(i)??0);return t.set(e.source,(t.get(e.source)??0)+1),n.set(e.target,(n.get(e.target)??0)+1),r.set(i,(r.get(i)??0)+1),a})}function sa(e,t){if(e.x===t.x&&e.y===t.y)return{sourceHandle:`right`,targetHandle:`bottom`};let n=t.x+t.width/2-e.x-e.width/2,r=t.y+t.height/2-e.y-e.height/2,i=r>0?t.y-e.y-e.height:e.y-t.y-t.height,a=n>0?t.x-e.x-e.width:e.x-t.x-t.width;return i>=0&&a<0?r>=0?{sourceHandle:`bottom`,targetHandle:`top`}:{sourceHandle:`top`,targetHandle:`bottom`}:n>=0?{sourceHandle:`right`,targetHandle:`left`}:{sourceHandle:`left`,targetHandle:`right`}}function ca(e,t){return e?.type!==`life.mission.completed`||e.overall_complete!==!1&&e.campaign_continues!==!0||e.outcome?.execution_status===`completed`&&e.outcome.review_status===`done`?``:t?`当次执行已结束;当时总体目标尚未完成${e.campaign_continues===!0?`,仍需后续工作`:``}。`:`This execution ended; the overall goal was not complete at that time${e.campaign_continues===!0?` and further work remained`:``}.`}function la(e){let{total:t,qa:n=0,complete:r,ended:i=0,reviewUnavailable:a=0,held:o=0,running:s,pending:c,paused:l,hasOpenWork:u,role:d,current:f,waiting:p,zh:m}=e,h=t>0&&r===t&&i===0,g=n===t&&n>0?m?`已全部回答`:`all answered`:m?`已全部完成`:`all completed`,_=m?[t>n?`${t-n} 个任务`:``,n>0?`${n} 条问答`:``,r>0&&!h?`已完成 ${r} 个`:``,i>0?`${i} 个任务结束时目标还没完成`:``,a>0?`${a} 个结果尚未检查成功`:``,o>0?`${o} 个任务暂停,后续工作尚未安排`:``,s>1?`${s} 个任务同时进行`:``]:[t>n?`${t-n} ${t-n===1?`task`:`tasks`}`:``,n>0?`${n} Q&A`:``,r>0&&!h?`${r} done`:``,i>0?`${i} ended before their goals were complete`:``,a>0?`${a} ${a===1?`result has`:`results have`} not been checked successfully`:``,o>0?`${o} paused with no next step scheduled`:``,s>1?`${s} tasks in progress`:``],v=c?m?`正在处理你的消息`:`working on your message`:p||(l?h?g:u?m?`已暂停`:`paused`:t>0?m?`没有在进行的工作`:`nothing in progress`:m?`就绪`:`ready`:f||(d?Qr(d,m):h?g:``));return[..._,v].filter(Boolean).join(` · `)}var ua=[{match:/External interrupt|daemon (?:stop|shutdown)|stopped by its operator/i,bare:/^(?:Engineer interrupted because daemon shutdown|Argus was stopped by its operator|Reviewer backend returned no complete judgment \([^)]*External interrupt)/,kind:`interrupt`,zh:`运行被操作员停下,这一轮没有做完;这不是对工作本身的评价`,en:`Argus was stopped by its operator before this round could finish; this says nothing about the work itself`},{match:/no complete judgment|before reaching a judgment|reached a conclusion|did not reach a conclusion/i,bare:/^(?:Reviewer backend (?:returned no complete judgment|ended before reaching a judgment)|The Reviewer's session ended before it reached a conclusion|The review did not reach a conclusion)/,kind:`reviewer`,zh:`审阅者的会话在得出结论前就结束了,这一轮没有评审意见`,en:`The Reviewer's session ended before it reached a conclusion, so this round was not judged`},{bare:/^Engineer backend failed before a trustworthy completed turn/,kind:`reviewer`,zh:`模型服务在工程师做完之前断开了;Argus 会换一个新会话重试,审阅等到那时再做`,en:`The model service dropped the Engineer's session before it finished; Argus retries in a fresh session and the review waits until then`},{bare:/^Retry in a fresh (?:\w+ )?session/,zh:`Argus 会换一个新会话再试一次`,en:`Argus will try again in a fresh session`},{bare:/^Restart the daemon when ready/,zh:`重新启动后,Argus 会从项目留下的状态继续,选择下一项具体任务`,en:`Once Argus is started again it continues from the saved project state and picks the next concrete task`},{bare:/^engineer round \d+ \((?:fresh|rotated|resumed)[^)]*\)\s*$/i,kind:`round`,zh:`工程师开始了新的一轮工作`,en:`The Engineer began a new round of work`},{match:/provider[\s-]?turn/i,bare:/^(?:One Engineer call|\d+ Engineer sessions in a row each) used (?:its|their) whole per-call provider-turn allowance/,zh:`继续换了个新会话接着做,之前的进展都在`,en:`Continued in a fresh session; earlier progress is kept`},{match:/budget (limit|cap|exhausted)|blocking budget|预算上限/i,bare:/^Paused because this project reached its budget limit/,zh:`花费到了预算上限,先暂停;提高预算后可以继续`,en:`Paused at the budget limit; work resumes once the budget is raised`},{match:/quarantin/i,bare:/^The task signature is quarantined out of planner rotation/,zh:`这个方向连续失败,先搁置,不再自动重试`,en:`This direction kept failing and is set aside; it will not retry on its own`},{match:/backend[\s\S]{0,24}?(fail|unavailable|paused)|backend_failure|provider cooldown|configured model is unavailable/i,bare:/^(?:backend failure; retrying in a fresh|The backend has failed the same way \d+ times in a row)/,zh:`模型服务暂时不稳定,稍后会自动重试`,en:`The model service was briefly unavailable; it retries after a short wait`}],da=/Runner receipt:|Technical record:|技术记录[::]/i,fa=/^(?:Runner receipt|Technical record|技术记录)\s*[::]\s*/i;function pa(e){let t=String(e||``).trim(),n=t.search(da);return n<0?{prose:t,receipt:``}:{prose:t.slice(0,n).trim(),receipt:t.slice(n).trim()}}function ma(e,t){let n=String(e||``).trim(),{receipt:r}=pa(n),i=r?ua.find(e=>e.match?.test(n)):ua.find(e=>e.bare?.test(n));return i?{summary:t?i.zh:i.en,receipt:r||n,kind:i.kind}:{summary:``,receipt:r}}var ha={width:1440,height:1080},ga=[`plan`,`execution`,`review`,`revision`,`result`];function _a(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function va(e,t){let n=e.team_outcome;if(!n)return``;if(n.kind===`review`){let e=n.verdict===`rejected`?t?`复核结论:驳回`:`Verdict: rejected`:n.verdict===`qualified`?t?`复核结论:通过`:`Verdict: qualified`:``;if(!e)return``;let r=n.summary?xa(n.summary,120):``;return r?`${e}${t?`。`:`. `}${r}`:e}if(n.kind===`route`){let e=n.title?t?`「${n.title}」`:`“${n.title}”`:``;if(n.selected)return t?`${e}通过独立复核,被选为唯一方案`:`${e} passed its independent review and was chosen`;if(n.verdict===`rejected`){let r=n.rejection?xa(n.rejection,120):``;return(t?`${e}被独立复核驳回`:`${e} was rejected by its independent review`)+(r?t?`。${r}`:`. ${r}`:``)}return n.verdict===`qualified`?n.selected===!1?t?`${e}通过独立复核,但未被选中`:`${e} passed its independent review but was not chosen`:t?`${e}通过独立复核,等待选择`:`${e} passed its independent review; selection pending`:``}let r=Ri(n.selected_route);if(!r)return``;let i=n.selected_title?t?`(${n.selected_title})`:` (${n.selected_title})`:``,a=(n.rejected??[]).map(Ri).filter(Boolean);return(t?`选定研究路线 ${r}${i}`:`Chose route ${r}${i}`)+(a.length?t?`,驳回路线 ${a.join(`、`)}`:`; rejected route${a.length>1?`s`:``} ${a.join(`, `)}`:``)}function ya(e,t,n){return e.pending_question?t?`需要答复,展开查看具体问题`:`Needs your input; open to read the question`:e.status===`failed`?t?`本次执行失败,展开查看原因`:`This attempt failed; open to read the reason`:e.status===`blocked`?t?`执行受阻,展开查看原因`:`Work is blocked; open to read the reason`:va(e,t)||(e.status===`done`?e.team_role===`idea-review`?t?`独立复核已完成,展开查看记录`:`Independent review completed; open to read the record`:t?`子任务执行已完成,展开查看记录`:`Subtask execution completed; open to read the record`:e.status===`pending`?n?t?`等待前置子任务完成后开始`:`Waiting for prerequisite subtasks to finish`:t?`等待分配 Agent 执行`:`Waiting for an agent to start`:Ti.has(e.status||``)?e.team_role===`idea-route`?t?`正在开展来源研究,整理候选方案`:`Researching sources and developing a candidate idea`:e.team_role===`idea-review`?t?`正在独立核对依据、创新性和风险`:`Independently checking evidence, novelty and risks`:e.team_role===`idea-selector`?t?`正在对比研究路线及复核意见`:`Comparing research routes and independent reviews`:t?`Agent 正在执行此子任务`:`An agent is working on this subtask`:t?`展开查看子任务执行记录`:`Open to read the subtask record`)}var ba=e=>e?`这一步还没有留下记录`:`Nothing has been written down for this step yet.`;function xa(e,t=140){let n=e.replace(/\s+/g,` `).trim();if(!n)return``;let r=n.match(/^.*?[。!?!?.](?=\s|$)/),i=(r?r[0]:n).trim();return i.length>t?`${i.slice(0,t-1).trimEnd()}…`:i}function Sa(e){let t=e.replace(/\s+/g,` `).trim().split(/[。!?;;::,,\n]|\.(?=\s|$)|[!?](?=\s|$)/)[0]?.trim();return t&&t.length>=6&&t.length<=40?t:``}function Ca(e){return String(e||``).split(/\r?\n/).filter(e=>!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e.trim())&&!/^\{\s*"[\w-]+"\s*:.*\}$/.test(e.trim())).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/i,``).replace(/^\s*NEXT_ACTION\s*=\s*/i,``)).join(` +`).trim()}function wa(e,t,n){switch(e.type){case`life.planner.task_added`:return n?`规划者把这项任务列入了计划。`:`The Planner added this task to the plan.`;case`life.mission.started`:return n?`工程师接手了这项任务,开始动手。`:`The Engineer picked up this task and began working.`;case`life.phase.started`:case`round.review.started`:return e.role===`reviewer`?n?`审阅者打开了工程师的工作,开始核查。`:`The Reviewer opened the Engineer's work to check it.`:``;case`life.mission.completed`:return ca(e,n)||(t===`done`?n?`任务完成,结果已经记录在案。`:`The task was finished; its result is on record.`:t===`paused_external_work`?n?`这项任务在等待后台团队的结果;结果就绪后会自动继续。`:`This task is waiting for its background team; it continues on its own once the results are in.`:t.startsWith(`paused`)?n?`这项任务的工作暂停了。`:`Work on this task was paused.`:n?`任务到此结束。`:`The task ended here.`);case`life.mission.failed`:return n?`任务没有达到目标就结束了。`:`The task ended without reaching its goal.`;default:return``}}var Ta=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,Ea=(e,t)=>e.length>t?`${e.slice(0,t-1).trimEnd()}…`:e;function Da(e){let t=e.slice(e.indexOf(`:`)+1).trim();if(!t)return``;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of[`path`,`file`,`file_path`,`pattern`,`query`,`url`,`command`,`paths`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim();if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}let n=Object.values(t).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n.trim():``}}catch{}return/^[{[]/.test(t)?/"(?:path|file|file_path|pattern|query|url|command)"\s*:\s*"([^"]+)/.exec(t)?.[1]??``:t}function Oa(e){let t=(e.tool||e.label.replace(Ta,``).split(`:`)[0]||``).trim().toLowerCase();return e.kind===`command_execution`?`run`:e.kind===`file_change`?`edit`:/^(view|read|cat|open|read_file|str_replace_editor)$/.test(t)?`read`:/^(rg|grep|search|find_text|semantic_search|codebase_search|web_search|search_web)$/.test(t)||/^(glob|find|list|ls|list_dir|find_files)$/.test(t)?`search`:/^(web_fetch|fetch|http_get|browse)$/.test(t)?`fetch`:/^(apply_patch|edit|write|create|write_file|edit_file|replace_in_file|str_replace)$/.test(t)?`edit`:/^(bash|shell|sh|execute|terminal|run)$/.test(t)?`run`:`other`}function ka(e,t){let n=(e.tool||``).trim(),r=e.label.replace(Ta,``).trim(),i=n&&/\s/.test(n)&&n.length>8,a=Ea(Da(r),72),o=Ea(r,72),s=Oa(e),c=i?n:s===`run`?t?`运行命令 \`${o}\``:`Ran \`${o}\``:s===`read`?t?`查看 ${a||(t?`一份文件`:``)}`:`Read ${a||`a file`}`:s===`search`?t?`查找 ${a||`内容`}`:`Looked for ${a||`something`}`:s===`fetch`?t?`读取网页 ${a||``}`.trim():`Fetched ${a||`a page`}`:s===`edit`?t?`修改文件 ${a||``}`.trim():`Edited ${a||`a file`}`:Ea(/^[^:{]*:\s*[{[]/.test(r)?r.slice(0,r.indexOf(`:`)):r,80);return e.status===`failed`?`${c}${t?`(失败)`:` (failed)`}`:c}function Aa(e,t,n){let r=new Map;e.forEach(e=>r.set(Oa(e),(r.get(Oa(e))??0)+1));let i=[],a=(e,t,a,o)=>{let s=r.get(e);s&&i.push(n?`${t}${s}${e===`run`?`条命令`:e===`fetch`?`个网页`:`处`}`:`${s} ${s===1?a:o}`)};a(`read`,`查看了`,`file read`,`files read`),a(`search`,`查找了`,`search`,`searches`),a(`fetch`,`读取了`,`page fetched`,`pages fetched`),a(`edit`,`修改了`,`file edited`,`files edited`),a(`run`,`运行了`,`command run`,`commands run`);let o=r.get(`other`);return o&&i.push(n?`${o}次其他操作`:`${o} other ${o===1?`action`:`actions`}`),t>0&&i.push(n?`另有 ${t} 步未列出`:`${t} more not listed`),i.length?n?`${i.join(`,`)}。`:`${i.join(`, `)}.`:``}function ja(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.status===`running`&&n.status&&n.status!==`running`&&(e.call_id&&n.call_id?e.call_id===n.call_id:!e.call_id&&!n.call_id&&e.kind===n.kind&&e.label===n.label&&(e.tool??``)===(n.tool??``))?t[t.length-1]={...e,status:n.status,...n.call_id?{call_id:n.call_id}:{}}:t.push(n)}return t}function Ma(e,t){let n=ja(e.steps??[]),r=Ca(e.text),i=e.tool_details_recorded===!1,a=i?t?`执行日志确认发生过工具活动,但这一轮没有记录详细工具步骤。`:`Execution logs confirm tool activity, but detailed tool steps were not recorded for this turn.`:``;return Fa({id:e.id,kind:e.role===`reviewer`?`review`:`execution`,title:``,detail:``,status:e.status||`recorded`,ts:e.ts,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id],segment:!0,work:{steps:[...n],overflow:e.overflow??0,narrations:r?[r]:[],note:a,title:i?t?`已记录的执行`:`Recorded execution`:``,single:e.role===`manager`}},t)}var Na=8,Pa=(e,t)=>{let n=Math.max(0,e.steps.length-Na)+e.overflow;return[...e.steps.slice(0,Na).map(e=>`· ${ka(e,t)}`),...n>0?[t?`· 另有 ${n} 步未列出`:`· ${n} more not listed`]:[]]};function Fa(e,t){let n=e.work,r=n.narrations.join(` + +`);return e.title=n.title||Sa(n.narrations[0]??``)||(n.single?t?`Argus 动手查证`:`Argus did the work`:n.steps.length?t?`做了 ${n.steps.length} 步操作`:`${n.steps.length} steps of work`:t?`说明了接下来要做什么`:`Said what comes next`),e.summary=xa(n.narrations[0]??``)||Aa(n.steps,n.overflow,t)||void 0,e.detail=[n.note,r,Pa(n,t).join(` +`)].filter(Boolean).join(` + +`)||ba(t),e.workCount=n.steps.length+n.overflow||void 0,e}function Ia(e,t){let n=e.work;if(!n||e.segment)return e;let r=e.detail===ba(t)?``:e.detail,i=n.narrations.filter(e=>!r.includes(e.slice(0,60))),a=n.steps.length+n.overflow,o=Aa(n.steps,0,t),s=a?[t?`这一步里做的操作(${a} 步):${o}`:`What was done in this step (${a} actions): ${o}`,Pa(n,t).join(` +`)].join(` +`):``,c=n.narrations[n.narrations.length-1];return!e.closed&&c&&(e.title=Sa(c)||e.title,e.summary=xa(c)||e.summary),e.detail=[n.note,r,i.join(` + +`),s].filter(Boolean).join(` + +`)||ba(t),e.workCount=a||void 0,e}function La(e,t){switch(e){case`done`:return t?`这项任务已经完成。`:`This task was completed.`;case`failed`:return t?`这项任务没有达到目标。`:`This task did not reach its goal.`;case`cancelled`:case`aborted`:return t?`这项任务被取消了。`:`This task was cancelled.`;case`skipped`:return t?`这项任务被跳过了。`:`This task was skipped.`;case`superseded`:return t?`这项任务被一个新的计划取代了。`:`A new plan took the place of this task.`;default:return``}}function Ra(e,t,n){let r=e.kind===`turn`,i=[{id:`${e.id}:brief`,kind:`plan`,title:r?n?e.turn_kind===`qa`?`你提出的问题`:`你提出的要求`:`What you asked`:n?`任务目标`:`Task goal`,detail:e.objective||e.title,status:`recorded`,source:`task`,eventIds:[]}],a=new Set,o=0,s,c=t.filter(t=>t.item_id===e.id).sort((e,t)=>e.ts-t.ts||(e.type===`team.task`&&t.type===`team.task`?(e.team_task_id||e.id).localeCompare(t.team_task_id||t.id):0)),l=new Map(c.filter(e=>e.type===`team.task`).map(e=>[e.id,e]));for(let e of c){if(a.has(e.id))continue;if(a.add(e.id),e.type===`team.task`){let t=[...new Set(e.deps||[])],r=t.map(e=>l.has(e)?_a(l.get(e),n):n?`其他记录中的子任务`:`Task outside this view`),a=Ca(e.text);i.push({id:e.id,kind:e.team_role===`idea-review`||e.role===`reviewer`?`review`:e.team_role===`idea-selector`?`plan`:`execution`,title:_a(e,n),summary:ya(e,n,t.some(e=>l.has(e)&&l.get(e).status!==`done`)),detail:[a,e.reason&&!a.includes(e.reason)?e.reason:``,e.pending_question?`${n?`需要答复`:`Needs input`}: ${e.pending_question}`:``,r.length?`${n?`依赖`:`Depends on`}: ${r.join(` · `)}`:``].filter(Boolean).join(` + +`),status:e.pending_question?`question`:e.status||`unknown`,ts:e.ts,source:`team`,eventIds:[e.id],teamId:e.team_id,teamTaskId:e.team_task_id,teamRole:e.team_role,...e.team_outcome?{teamOutcome:e.team_outcome}:{},deps:t,updatedAt:e.updated_ts,revision:e.revision});continue}if(e.type===`work.segment`){i.push({...Ma(e,n),episode:o});continue}if(e.type===`turn.replied`){let t=Ca(e.text);i.push({id:e.id,kind:`result`,title:n?`Argus 的回答`:`What Argus answered`,summary:xa(t)||void 0,detail:t||ba(n),status:e.status||`done`,ts:e.ts,source:`event`,eventIds:[e.id]});continue}e.type===`life.mission.started`&&(o++,s=void 0),e.type===`round.review.completed`&&(s=e);let t=e.type.includes(`review`)||e.type===`life.phase.started`&&e.role===`reviewer`?`review`:e.type===`life.planner.task_added`?`plan`:e.type===`life.mission.completed`||e.type===`life.mission.failed`?`result`:e.type===`round.start`||e.type===`round.main.completed`||e.type===`life.mission.started`||e.type===`life.phase.started`?`execution`:null;if(!t)continue;let r=e.round_index,c=e.type.endsWith(`.completed`)||e.type.endsWith(`.failed`),u=t===`review`&&e.review_skipped===!0,d=e.backend_unavailable===!0||t===`result`&&s?.backend_unavailable===!0,f=d?``:ca(e,n),p=(d?`review_unavailable`:u?`skipped`:e.status===`error`?`failed`:e.status)||(e.success===!1||e.type.endsWith(`.failed`)?`failed`:e.success===!0?`done`:c||e.type===`life.planner.task_added`||e.type===`life.mission.started`?`recorded`:`started`),m=ma(e.text||``,n),h=String(e.text||``),g=m.receipt?h.lastIndexOf(m.receipt):-1,_=Ca(g>=0?h.slice(0,g):h),v=p===`done`?n?`审阅通过`:`Review passed`:p===`continue`?n?`审阅:要求再改一轮`:`Review: another pass asked for`:[`blocked`,`replan`,`replan_requested`].includes(p)?n?`审阅:建议调整方向`:`Review: a change of course asked for`:p===`failed`?n?`审阅未通过`:`Review not passed`:``,y=m.kind===`interrupt`,b=t===`execution`&&!m.summary?Sa(_):``,x=d?n?`当次审查异常`:`Review error on this attempt`:y?n?`这一轮没做完就被停下`:`Stopped before the round could finish`:u?n?`本轮未审阅`:`No review this round`:t===`review`?c?v||(n?`审阅意见`:`Review`):n?`开始审阅`:`Review started`:t===`result`?f?n?`本次执行已结束`:`This execution ended`:p===`paused_external_work`?n?`等待后台团队`:`Waiting for the background team`:n?`执行结果`:`Result of the work`:t===`plan`?n?`列入计划`:`Taken into the plan`:b||(m.kind===`round`?n?`新一轮开始`:`A new round began`:e.type===`life.mission.started`?n?`开始执行`:`Work started`:e.type===`round.main.completed`?n?`本轮执行记录`:`This round's work`:n?`一次执行尝试`:`An attempt at the work`),S=ma(e.next_action||``,n),C=_||m.summary?``:wa(e,p,n);i.push({id:e.id,kind:t,title:x,summary:d?n?`审查器未能给出判断,不是审阅否决。`:`The Reviewer could not return a judgment; this was not a rejection.`:f||m.summary||xa(_)||C||void 0,detail:[f,_||m.summary||(f?``:C||ba(n)),f&&e.stage_certification===`intentionally_skipped`?n?`本阶段认证被有意跳过;这不代表最终验收通过。`:`Stage certification was intentionally skipped; this is not final acceptance.`:``,u&&e.next_action&&!S.summary?`${n?`接下来`:`What happens next`}: ${e.next_action}`:``,m.receipt?`${n?`——技术记录:`:`— technical record: `}${m.receipt.replace(fa,``)}`:``].filter(Boolean).join(` + +`),status:f&&p===`done`?`recorded`:p,completionScope:f||void 0,closed:c,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]}),!u&&!y&&e.next_action&&[`continue`,`blocked`,`replan`,`replan_requested`].includes(e.status||``)&&i.push({id:`${e.id}:next`,kind:`revision`,title:n?`建议的修改`:`Changes asked for`,detail:S.summary||e.next_action,status:`requested`,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]})}e.turn_kind===`qa`&&!i.some(e=>e.kind===`result`)&&i.push({id:`${e.id}:answer`,kind:`result`,title:Ti.has(e.status)?n?`正在回答`:`Answering`:n?`回答状态`:`Answer status`,detail:e.summary||(e.status===`cancelled`?n?`本次回答已中断。`:`This answer was interrupted.`:``),status:e.status,source:`task`,eventIds:[]}),e.turn_kind!==`qa`&&!i.some(e=>e.kind===`execution`)&&Ti.has(e.status)&&i.push({id:`${e.id}:active`,kind:`execution`,title:n?`正在进行的工作`:`Work under way`,detail:e.summary||``,status:e.status,source:`task`,eventIds:[]}),!i.some(e=>e.kind===`result`)&&[`done`,`failed`,`aborted`,`cancelled`,`skipped`,`superseded`].includes(e.status)&&i.push({id:`${e.id}:outcome`,kind:`result`,title:n?`任务的最终状态`:`Where this task ended up`,detail:e.summary||La(e.status,n),status:e.status,source:`task`,eventIds:[]});let u=[],d=new Map,f=new Map,p=(e,t)=>{let n=e.work??={steps:[],overflow:0,narrations:[],note:``,title:``,single:!1};n.steps.push(...t.work.steps),n.overflow+=t.work.overflow,n.narrations.push(...t.work.narrations.filter(e=>!n.narrations.includes(e))),n.note||=t.work.note,e.eventIds.push(...t.eventIds),t.source===`interval`&&(e.source=`interval`)};for(let e of i){if(e.segment){let t=f.get(e.kind),r=u[u.length-1],i=t&&t.episode===e.episode?t:r?.segment&&r.kind===e.kind?r:void 0;i?(p(i,e),i.segment&&Fa(i,n)):u.push({...e,eventIds:[...e.eventIds]});continue}let t=e.round!=null&&[`execution`,`review`].includes(e.kind),r=`${e.episode}:${e.round}:${e.kind}`,i=t?d.get(r):void 0;if(i)i.title=e.title,i.summary=e.summary??i.summary,i.detail=e.detail,i.status=e.status,i.closed=i.closed||e.closed,i.eventIds.push(...e.eventIds),e.source===`interval`&&(i.source=`interval`);else{let n={...e,eventIds:[...e.eventIds]};u.push(n),t&&(d.set(r,n),f.set(n.kind,n))}}return u.map(e=>{let{work:t,segment:r,closed:i,...a}=Ia(e,n);return a})}function za(e,t,n=!0){let r=e.filter(e=>e.source===`team`),i=r.filter(e=>e.teamOutcome?.kind===`route`),a=r.find(e=>e.teamOutcome?.kind===`selection`)?.teamOutcome,o=i.find(e=>e.teamOutcome?.selected),s=[],c=e=>e.join(t?`、`:`, `);if(o||a?.selected_route){let e=Ri(o?.teamTaskId)||Ri(a?.selected_route),n=o?.teamOutcome?.title||a?.selected_title;s.push(t?`已选定研究路线 ${e}${n?`(${n})`:``}`:`route ${e} chosen${n?` (${n})`:``}`);let r=i.filter(e=>e.teamOutcome?.verdict===`rejected`&&!e.teamOutcome.selected).map(e=>Ri(e.teamTaskId)).filter(Boolean);r.length&&s.push(t?`路线 ${c(r)} 被驳回`:`route${r.length>1?`s`:``} ${c(r)} rejected`)}else if(i.some(e=>e.teamOutcome?.verdict)){let e=i.filter(e=>e.teamOutcome?.verdict===`qualified`).length,n=i.filter(e=>e.teamOutcome?.verdict===`rejected`).length;s.push(t?`复核结果:${e} 条路线通过、${n} 条驳回,等待选择`:`reviews so far: ${e} route${e===1?``:`s`} qualified, ${n} rejected; selection pending`)}let l=[...e].reverse().find(e=>e.source!==`team`&&e.kind===`review`&&[`done`,`continue`,`blocked`,`replan`,`replan_requested`,`failed`].includes(e.status));l&&s.push(l.status===`done`?t?`复核通过`:`review passed`:l.status===`continue`?t?`复核要求再改一轮`:`the review asked for another pass`:l.status===`failed`?t?`复核未通过`:`review not passed`:t?`复核建议调整方向`:`the review asked for a change of course`);let u=n?[...e].reverse().find(e=>e.source!==`team`&&e.kind===`execution`&&e.round!=null&&e.status===`started`):void 0;return u&&s.push(t?`第 ${u.round} 轮进行中`:`round ${u.round} under way`),s.length?(t?`当前结论:`:`So far: `)+s.join(t?`;`:`; `):``}var Ba=480;function Va(e,t,n,r=Ra(e,t,n),i=0,a=!1){let o=a&&r.length>0,s=o?Ba:640,c=o?r.length:1,l=1/0;for(let e=1;!o&&e<=Math.min(3,r.length);e++){let t=Math.ceil(r.length/e),n=Math.max(640,t*232+(t-1)*108+96),i=408+(e-1)*236,a=Math.abs(Math.log(n/i/1.6))+.6*(t*e-r.length)/(t*e);a{let a=t*c,o=Math.min(a+c,r.length),s=m+t*340,l=r.slice(a,o);l.forEach((e,t)=>{h[e.id]={x:s,y:f+t*236}});let d=i+a+1,p=i+o,v=d===p?n?`环节 ${d}`:`Step ${d}`:n?`环节 ${d}–${p}`:`Steps ${d}–${p}`,y=Ua(g.slice(a,o)),b=Wa(l,y,_,t===0&&i===0,t===u-1,n,v);return _=y,{id:`steps:${i+a}`,title:b,x:s,y:f-38}});return{steps:r,links:Ka(r,n),columns:v,positions:h,width:d,height:p,...o?{stacked:o}:{}}}function Ha(e){let t;return e.map(e=>{if(typeof e.round==`number`)return t=e.round;if(e.kind!==`result`&&e.kind!==`plan`)return t})}function Ua(e){return[...new Set(e.filter(e=>typeof e==`number`))].sort((e,t)=>e-t)}function Wa(e,t,n,r,i,a,o){if(!t.length)return r&&i&&e.length>1&&e[0].kind===`plan`&&e[e.length-1].kind===`result`?a?`起点 → 结果`:`Setting out → Outcome`:r&&e.some(e=>e.kind===`plan`)?a?`起点`:`Setting out`:i&&e.some(e=>e.kind===`result`)?a?`结果`:`Outcome`:o;let s=t[0],c=t[t.length-1],l=t.length===1&&n.length>0&&n[n.length-1]===s,u=s===c?a?`第 ${s} 轮`:`Round ${s}`:a?`第 ${s}–${c} 轮`:`Rounds ${s}–${c}`;return l&&(u=e[0].kind===`review`?a?`${u} · 审阅`:`${u} · review`:a?`${u} · 续`:`${u} · cont.`),r&&e[0].kind===`plan`&&(u=a?`起点 · ${u}`:`Setting out · ${u}`),i&&e[e.length-1].kind===`result`&&(u=a?`${u} · 结果`:`${u} · Outcome`),u}function Ga(e){let t=e.stacked?900/e.width:Math.max(600/e.height,Math.min(1e3/e.height,ha.width/e.width));return{width:e.width*t,height:e.height*t,scale:t}}function Ka(e,t){let n=e.filter(e=>e.source===`team`);if(n.length){let r=e.filter(e=>e.source!==`team`),i=new Map(n.map(e=>[e.id,e])),a=r.find(e=>e.source===`task`&&e.kind===`plan`),o=[];for(let e of n){for(let n of e.deps||[]){let r=i.get(n);!r||r.id===e.id||r.teamId!==e.teamId||o.push({id:`link:${r.id}:${e.id}`,source:r.id,target:e.id,relation:`dependency`,label:t?`前置任务`:`Depends on`,explanation:t?`${e.title} 的任务记录明确依赖 ${r.title}。`:`${e.title} explicitly depends on ${r.title} in its taskboard.`,contextual:!1})}a&&!e.deps?.length&&o.push({id:`link:${a.id}:${e.id}`,source:a.id,target:e.id,relation:`assignment`,label:t?`任务分支`:`Branch`,explanation:t?`该子任务属于当前主任务;此线不表示等待主任务完成。`:`This worker belongs to the current mission; the link does not require the parent to finish first.`,contextual:!0})}return[...Ka(r,t),...o]}return e.slice(1).map((n,r)=>{let i=e[r],a=i.episode===n.episode,o=a&&i.round!=null&&i.round===n.round,s=`record_order`,c=t?`接着`:`then`,l=t?`同一任务的相邻观察,未确认直接因果或执行依赖。`:`Adjacent observations of the same task; no causal dependency is asserted.`;i.kind===`plan`&&[`plan`,`execution`].includes(n.kind)?(s=`assignment`,c=t?n.kind===`plan`?`纳入计划`:`执行此任务`:n.kind===`plan`?`planned`:`carried out`,l=t?`同一任务的目标/计划与其执行记录关联。`:`The task brief or plan is linked to execution of that same task.`):i.kind===`execution`&&n.kind===`review`&&o?(s=`review`,c=t?`提交审阅`:`sent for review`,l=t?`同一个任务、同一执行段、同一轮次的执行与审查记录。`:`Execution and review belong to the same task, episode and numbered round.`):i.kind===`review`&&n.kind===`revision`&&n.eventIds.some(e=>i.eventIds.includes(e))?(s=`revision`,c=t?`提出修改`:`asked to change`,l=t?`这条修订建议来自对应的审查记录。`:`This revision was requested in the corresponding review.`):i.kind===`revision`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`修订建议之后出现了同一任务的下一轮执行;不表示建议的全部内容已被采纳。`:`A later round follows the revision request; this does not certify every requested change was applied.`):i.kind===`review`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`审阅之后出现了同一任务的下一轮执行。`:`A later round of the same task follows the review.`):i.kind===`execution`&&n.kind===`execution`&&i.round==null&&n.round!=null?(c=t?`进入第 ${n.round} 轮`:`round ${n.round} begins`,l=t?`任务开始执行后记录的一轮工作。`:`A round of work recorded after the task was taken up.`):i.kind===`result`&&n.kind===`execution`?(c=t?`再次开始`:`taken up again`,l=t?`上一次执行结束之后,这项任务又被接手。`:`The task was taken up again after an earlier execution ended.`):n.kind===`result`&&n.source===`task`?(s=`snapshot`,c=t?`最终状态`:`ended as`,l=t?`任务状态记录;部分执行过程可能缺失。`:`Links to the captured state of this task; intermediate records may be missing.`):n.kind===`result`&&[`review`,`execution`,`revision`].includes(i.kind)&&(s=`outcome`,c=t?`形成结果`:`led to`,l=t?`同一任务的后续完成/失败事件,不等同于成功认证。`:`A completion or failure event of this task, not a certification of success.`);let u=[`record_order`,`snapshot`].includes(s)||i.source===`interval`||n.source===`interval`;return(i.source===`interval`||n.source===`interval`)&&(l+=t?` 部分旧记录按唯一活动任务区间归属,因此使用虚线。`:` Some legacy observations are associated by the sole active mission window, so this link is dashed.`),{id:`link:${i.id}:${n.id}`,source:i.id,target:n.id,relation:s,label:c,explanation:l,contextual:u}})}function qa(e){let t=[],n=[];for(let r=0;r12&&(t.push(n),n=[]),n.push(...i)}return n.length&&t.push(n),t}function Ja(e,t,n,r){for(let i of[n,r]){let n={x:(i.x-t.x)/t.zoom,y:(i.y-t.y)/t.zoom},r=e.find(e=>!e.hidden&&n.x>=e.position.x&&n.x<=e.position.x+(e.width??1152)&&n.y>=e.position.y&&n.y<=e.position.y+(e.height??824));if(r)return r.id}return null}function Ya(e,t,n,r,i=Zi(e,[],n),a,o=!1){let s=[],c={},l=[],u=new Map;for(let[r,i]of e.tasks.entries()){let e=Ra(i,t,n),a=i.status===`done`?ca(Ei(i,t),n):``,d=i.kind===`turn`?``:za(e,n,Ti.has(i.status)),f=qa(e),p=f.length,m=e=>e===1?i.id:JSON.stringify([`part`,i.id,e]),h=0;for(let u=1;u<=p;u++){let g=f[u-1],_=m(u);if(s.push({id:_,task:i,ordinal:r+1,part:u,partCount:p,start:h+1,end:h+g.length,totalSteps:e.length,previousId:u>1?m(u-1):void 0,nextId:u1){let t=Ka([e[h-1],g[0]],n)[0];l.push({id:JSON.stringify([`continuation`,i.id,u]),source:m(u-1),target:_,kind:`continuation`,label:t?n?`继续`:`Continued`:n?`更多分支`:`More branches`,evidence:t?`${i.title} · ${t.label} · ${e[h-1].title} → ${g[0].title}`:`${i.title} · ${n?`同一任务的其他分支,不表示串行依赖。`:`Other branches of the same mission, without a serial dependency.`}`})}h+=g.length}u.set(i.id,m(p))}let d=s.slice(),f=new Map;if(a){s.length=0;for(let e of d){let t=a.has(e.task.id);if(f.set(e.id,t?e.id:e.task.id),!t&&e.part!==e.partCount)continue;let n=t?e.id:e.task.id;c[n]=c[e.id],s.push({...e,id:n,historyCount:e.partCount-1,historyExpanded:t})}}let p=e=>f.get(e)??e,m=Object.fromEntries(s.map(({id:e})=>[e,Ga(c[e])])),h=[...i.map(e=>({...e,source:p(u.get(e.source)),target:p(e.target)})),...l.filter(e=>p(e.source)!==p(e.target))],g=s.map(e=>e.id),_=JSON.stringify([g.map(e=>[e,m[e].width,m[e].height]),h.map(e=>[e.source,e.target,e.kind])]);return{cards:s,allCards:d,links:h,layouts:c,positions:r?.structure===_?r.positions:aa(g,h,m),frames:m,structure:_}}function Xa(e,t,n){if(e.pending_question)return e.pending_question;let r=t.filter(t=>t.item_id===e.id&&(t.status===`failed`||t.success===!1||t.type.endsWith(`.failed`))).sort((e,t)=>t.ts-e.ts)[0],i=(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``),a=r?.reason||r?.text||i,o=ma(a,n),s=o.receipt?a.lastIndexOf(o.receipt):-1,c=Ca(s>=0?a.slice(0,s):a);return o.summary||c||(n?`这项任务没有完成,记录里没有写明原因。`:`This task did not finish, and the record does not say why.`)}function Za(e){return(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``).trim()}function Qa(e,t,n,r=``){if(e.pending_question)return{reason:e.pending_question,next:n?`下一步:回答这个问题,团队才会继续。`:`Next: answer this question so the team can continue.`,detail:``,showDetail:!1};if(Ni(e)){let t=Za(e),i=r.trim();return{reason:i?n?`工作已暂停:${i}`:`Work paused: ${i}`:t?n?`工作已暂停:当前结果还没有满足要求,具体原因见下方说明。`:`Work paused: the current result does not yet meet the requirements. The reason is shown below.`:n?`工作已暂停:当前结果还没有满足要求,记录里没有说明具体原因。`:`Work paused: the current result does not yet meet the requirements. No specific reason was recorded.`,next:n?`工作不会自动继续。请看暂停原因,再在对话里告诉我接下来做什么。`:`Work will not resume on its own. Read the reason, then tell me what to do next in the conversation.`,detail:t,showDetail:!!t&&!i}}let i=Xa(e,t,n),a=Za(e);return{reason:n?`执行失败:${i}`:`Execution failed: ${i}`,next:n?`下一步:查看原因后重试,或在对话里调整任务。`:`Next: check the reason, then retry or adjust the task in the conversation.`,detail:a&&!i.includes(a)?a:``,showDetail:!1}}var $a=(e,t=80)=>e.length>t?`${e.slice(0,t)}…`:e;function eo(e,t,n,r=()=>``){let i=e.filter(e=>e.turn_kind!==`qa`&&e.kind!==`turn`),a=[...i].sort((e,t)=>(t.ts??0)-(e.ts??0)),o=a[0],s=o?$a((o.objective||o.title).trim()):n?`还没有任务`:`No task yet`,c=Pi(e,t),l=e=>{let t=Mi(e);return{held:n?`工作已暂停`:`work paused`,failed:n?`这项工作没有做完`:`this task did not finish`,review_unavailable:n?`结果检查没有完成`:`the result check did not finish`,done:n?`已完成`:`done`,running:n?`进行中`:`running`,pending:n?`待开始`:`planned`,question:n?`等你回答`:`waiting on you`,paused:n?`已暂停`:`paused`}[t]||(n?`还没有新的进展记录`:`No new progress has been recorded`)},u=c?n?`已确认:${$a(Ca(r(c)||c.summary||c.title),160)}`:`Confirmed: ${$a(Ca(r(c)||c.summary||c.title),160)}`:o?Mi(o)===`review_unavailable`?n?`这次结果检查没有完成,暂时不能确认结果。`:`The result check did not finish, so the result is not yet confirmed.`:n?`还没有经过检查确认的结果。`:`There is no checked, confirmed result yet.`:n?`还没有结果`:`No result yet`,d=i.find(e=>Ti.has(e.status)),f=a.find(e=>[`question`,`held`,`failed`,`review_unavailable`].includes(Mi(e))),p=[...i].sort((e,t)=>(e.ts??0)-(t.ts??0)).find(e=>Mi(e)===`pending`);return{goal:s,current:d?n?`正在处理:${$a(d.title,70)}`:`Working on: ${$a(d.title,70)}`:o?l(o):n?`可以开始新任务`:`Ready for a new task`,conclusion:u,next:d?p?n?`待做任务:${$a(p.title,70)}`:`Queued next: ${$a(p.title,70)}`:n?`等当前工作完成,再查看检查结果。`:`Wait for the current work to finish, then check the result.`:f&&f===o?Qa(f,t,n,r(f)).next:p?n?`下一步:${$a(p.title,60)}`:`Next: ${$a(p.title,60)}`:c?n?`可以查看结果,或继续提出要求。`:`Read the result, or tell me what to do next.`:n?`还没有后续任务,可在对话里告诉我接下来做什么。`:`Nothing else is scheduled. Tell me what to do next in the conversation.`}}function to(e,t,n){let r=e?.model_revision&&e.model_revision!==n,i={...e?.cards};for(let[n,a]of Object.entries(t.cards)){if(r&&i[n]?.model_revision===e.model_revision)continue;let t=i[n];t?.version&&(a.version??0)(t.copy_revision??0)||(a.copy_revision??0)===(t.copy_revision??0)&&(a.generated_at>t.generated_at||a.generated_at===t.generated_at&&!t.input_revision))&&(i[n]=a)}let a=(t.cache_revision??0)<(e?.cache_revision??0);return{...e,...t,cards:i,...e?.version!=null||t.version!=null?{version:Math.max(e?.version??0,t.version??0)}:{},cache_revision:Math.max(t.cache_revision??0,e?.cache_revision??0),relations:(r||a)&&e?e.relations:t.relations,available:t.available??!0,...r?{model_revision:e.model_revision,available:e.available}:{}}}function no(e,t,n,r){let i=n?.cards[e.key],a=t.tasks.find(t=>t.id===e.task_id);if(!i||!a||(i.version??0)<(n?.version??0)||n?.model_revision&&i.model_revision!==n.model_revision)return!0;let o=[a.id,a.id+`:active`,a.id+`:outcome`].includes(e.key);if(o||!i.task_content_revision||!a.content_revision){if(a.revision&&i.task_revision!==a.revision||o&&i.task_status!==a.status)return!0}else if(i.task_content_revision!==a.content_revision)return!0;let s=i.event_ids||[];return e.event_ids.some(e=>{let n=s.indexOf(e),a=r?r.get(e):t.events.find(t=>t.id===e);return n<0||i.event_revisions&&a?.revision&&i.event_revisions[n]!==a.revision})||!o&&JSON.stringify(e.event_ids)!==JSON.stringify(s)}var ro=e=>`[[Argus引用 ${JSON.stringify(e)}]]\n`;function io(e){let t=[];return{refs:t,text:e.split(` +`).filter(e=>{if(e.startsWith(`[[Argus引用 `)&&e.endsWith(`]]`))try{let n=JSON.parse(e.slice(10,-2));if(typeof n.task_id==`string`&&typeof n.source==`string`&&typeof n.task_title==`string`&&(n.part===void 0||Number.isInteger(n.part)&&n.part>0)&&(n.step_title===void 0||typeof n.step_title==`string`)&&(n.step_id===void 0||typeof n.step_id==`string`)&&(n.team_id===void 0||typeof n.team_id==`string`)&&(n.team_task_id===void 0||typeof n.team_task_id==`string`)&&(n.lang===void 0||typeof n.lang==`string`)&&Array.isArray(n.event_ids)&&n.event_ids.every(e=>typeof e==`string`))return t.push(n),!1}catch{}return!0}).join(` +`).replace(/^\n+/,``)}}function ao(e,t,n=1/0){let r=Math.max(-1/0,...e.events.filter(e=>e.item_id===t&&e.type===`life.mission.started`&&e.ts<=n).map(e=>e.ts));return e.events.filter(e=>e.item_id===t&&e.ts>=r&&e.ts<=n&&[`round.main.completed`,`round.review.completed`].includes(e.type)).slice(-2).map(e=>e.id)}function oo(e,t,n){return n.map(n=>({key:n.id,task_id:t.id,kind:n.kind,event_ids:[...new Set([...n.kind===`result`?ao(e,t.id,n.ts):[],...n.eventIds])].slice(-16)}))}function so(e,t,n){let r=e.tasks.find(e=>e.id===n),i=(r?[r,...e.tasks.filter(e=>e.id!==n)]:e.tasks).map(t=>({key:t.id,task_id:t.id,kind:`task`,event_ids:[...new Set([...ao(e,t.id),...e.events.filter(e=>e.item_id===t.id).slice(-2).map(e=>e.id)])]})),a=r?oo(e,r,t):[];return[...i.slice(0,1),...a,...i.slice(1)]}var co=new Set([`life.planner.task_added`,`life.mission.started`,`round.main.completed`,`round.review.completed`,`turn.asked`,`turn.replied`]);function lo(e,t,n=ae(),r){return he(`project`,e,t,e,n,r)}function uo(e,t){let n=t.mission.started_at??e.backlog.find(e=>e.id===t.mission.id)?.started_ts??0,r=Number.isFinite(n)&&n>=0?n:0;return{mode:`current`,since:r,eventSince:r,taskId:t.mission.id}}function fo(e,t){return[`research-brief-map`,e,t.taskId,t.since,t.eventSince]}function po(e,t,n){if(e.id!==`live:${t}`||!Array.isArray(e.tasks)||!Array.isArray(e.events))throw Error(`The task records do not match this project.`);return{...e,tasks:e.tasks.filter(e=>e.id===n),events:e.events.filter(e=>e.item_id===n)}}function mo(e,t,n=0){if(!e||!t)return[];let r=e.events.filter(e=>e.item_id===t.id&&co.has(e.type)&&Number.isFinite(e.ts)&&e.ts>=n),i=Math.max(n,...r.filter(e=>e.type===`life.mission.started`).map(e=>e.ts)),a=r.filter(e=>e.ts>=i),o=new Map;for(let e of co){let t=e.startsWith(`round.`)?2:1;for(let n of a.filter(t=>t.type===e).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id)).slice(-t))o.set(n.id,n)}return[...o.values()].sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id))}function ho(e,t){return{key:e.id,task_id:e.id,kind:`task`,event_ids:t.map(e=>e.id)}}function go(e,t){return e?JSON.stringify({task:{id:e.id,title:e.title,objective:e.objective,status:e.status,summary:e.summary,acceptance_check:e.acceptance_check,goal_contribution:e.goal_contribution,plan_hypothesis:e.plan_hypothesis,non_goals:e.non_goals,outcome:e.outcome,pending_question:e.pending_question,started_ts:e.started_ts,finished_ts:e.finished_ts,attempt:e.attempt},events:t.map(e=>[e.id,e.revision??e])}):``}function _o(e){if(!e||typeof e!=`object`)return!1;let t=e;if(![`why`,`scope`,`next`].every(e=>typeof t[e]==`string`&&t[e].trim()))return!1;if(t.concept===null)return!0;if(!t.concept||typeof t.concept!=`object`)return!1;let n=t.concept;return[`name`,`explanation`,`example`,`connection`].every(e=>typeof n[e]==`string`&&n[e].trim())}function vo(e,t,n,r){return!e||!t?!1:(r?.cards[t.id]?.version??0)<14||!_o(r?.cards[t.id]?.reader_brief)||no(ho(t,n),e,r,new Map(n.map(e=>[e.id,e])))}function yo(e){return!!e&&typeof e.version==`number`&&e.version<14}function bo(e,t,n,r){return ro({source:`live:${e}`,task_id:t.id,task_title:t.title,event_ids:n.map(e=>e.id),lang:r?`zh`:`en`})}function xo(e){try{let t=JSON.parse(e||`null`);return!t||![`full`,`current`,`off`].includes(t.mode)||t.mode===`current`&&![t.since,t.eventSince].every(e=>typeof e==`number`&&Number.isFinite(e)&&e>=0)?null:t}catch{return null}}function So(e,t){if(!e||e.id!==t.id||t.reset_history)return t;let n=new Map((!t.incremental||t.tasks_complete?[]:e.tasks).map(e=>[e.id,e]));for(let e of t.tasks)n.set(e.id,e);for(let e of t.removed_task_ids||[])n.delete(e);let r=new Map(e.events.filter(e=>t.incremental&&!t.team_events_complete||e.type!==`team.task`).map(e=>[e.id,e]));for(let e of t.events)r.set(e.id,e);for(let e of t.removed_event_ids||[])r.delete(e);return j(e,{...e,...t,tasks:[...n.values()].sort((e,t)=>(e.ts||0)-(t.ts||0)||e.id.localeCompare(t.id)),events:[...r.values()].filter(e=>n.has(e.item_id))})}function Co(e,t,n){return e?t?.history_loading?400:!wo(n)||t?.events.some(e=>e.type===`team.task`&&Ti.has(e.status||``))?15e3:!1:!1}function wo(e){return e.manager_requests?.some(e=>e.status===`running`)?!1:!e.daemon.alive||e.continuous?.enabled===!1&&/pause|stop/i.test(e.continuous.done_reason||``)?!0:e.daemon.health?.state===`stopped`}var To=0,Eo=(e,t,n=0)=>[`explanation-progress`,...e,t,n];function Do(e,t,n=0){return t?[t.id,`${t.id}:active`,`${t.id}:outcome`].includes(e??``)?typeof t.started_ts==`number`&&Number.isFinite(t.started_ts)&&t.started_ts>=0?t.started_ts:n:0:n}function Oo(e,t,n){let r=++To,i=n.map(e=>Eo(t,e.key,e.startedAt));for(let t of i)e.setQueryData(t,{requestId:r,phase:null});return{update:t=>{for(let n of i)e.setQueryData(n,e=>e?.requestId===r?{requestId:r,phase:t}:e)},finish:()=>{for(let t of i)e.setQueryData(t,e=>e?.requestId===r?null:e)}}}function ko(e,t,n=0){let r=A({queryKey:Eo(e,t??``,n),queryFn:async()=>null,initialData:null,enabled:!1,staleTime:1/0,gcTime:72e5});return{active:!!r.data,phase:r.data?.phase??void 0}}function Ao(e,t){return e?{waiting_for_source:[`等待开始整理说明`,`Waiting to prepare the explanation`],planning:[`正在梳理概念与讲解顺序`,`Organizing the concepts and explanation`],writing:[`正在撰写说明`,`Writing the explanation`],reviewing:[`正在核对说明与来源`,`Checking the explanation against its sources`]}[e][+!t]:t?`正在整理说明`:`Preparing an explanation`}var jo=(e,t)=>[`reader-foundation-choice`,e,t],Mo=(e,t)=>`argus:reader-foundation:${e}:${t}`,No=e=>[`artifacts`,e,`reader`],Po=(e,t)=>[`reader-foundation-request`,e,t],Fo=(e,t)=>`${Mo(e,t)}:request`;function Io(e,t){let n=kt(Mo(e,t));if(!n)return{id:null,choice:0};try{let e=JSON.parse(n);if((typeof e?.id==`string`||e?.id===null)&&Number.isSafeInteger(e.choice)&&e.choice>=0)return e}catch{}return{id:n,choice:0}}function Lo(e,t){try{let n=JSON.parse(kt(Fo(e,t))||`null`);return typeof n?.id==`string`&&typeof n.draft?.question==`string`&&typeof n.beforeChoice==`number`?n:null}catch{return null}}function Ro(e,t,n,r){e.setQueryData(Po(t,n),r),Ot(Fo(t,n),JSON.stringify(r))}function zo(e,t,n,r){let i=e.getQueryData(Po(t,n)),a=Lo(t,n);i?.id===r&&(!a||a.id===r)&&Ro(e,t,n,null)}function Bo(e,t){return A({queryKey:Po(e,t),queryFn:k,enabled:!1,initialData:()=>Lo(e,t),staleTime:1/0,gcTime:1/0}).data??null}function Vo(e,t,n,r){let i={id:r,choice:Ho(e,t,n).choice+1};return e.setQueryData(jo(t,n),i),Ot(Mo(t,n),JSON.stringify(i)),i}function Ho(e,t,n){let r=e.getQueryData(jo(t,n)),i=Io(t,n);return r&&r.choice>=i.choice?r:i}function Uo(e,t){return A({queryKey:jo(e,t),queryFn:k,enabled:!1,initialData:()=>Io(e,t),staleTime:1/0,gcTime:1/0}).data}function Wo(e,t=ae()===`question-foundation`){return A({queryKey:No(e),queryFn:async({signal:t})=>(await R.artifacts(e,t,!0)).filter(e=>e.source===`reader_foundation`),enabled:!!e&&t,refetchInterval:e=>e.state.data?.some(e=>e.reader_foundation?.state===`generating`)?5e3:!1,retry:!1,refetchOnWindowFocus:!1})}function Go({sid:e,snapshot:t,view:n,active:r,readOnly:i=!1,allowGeneration:a=!0,locale:o,preview:s=ae(),foundationId:c}){let l=M(),u=n.mission.id,d=uo(t,n),f=fo(e,d),p=Uo(e,o),m=s===`question-foundation`?c===void 0?p.id:c:null,h=s===`question-foundation`&&!m,g=lo(e,o,s,m),_=r&&!!e&&!!u&&t.session.id===e,v=A({queryKey:f,queryFn:async({signal:t})=>{let n=l.getQueryData(f),r=po(await R.liveMap(e,t,n?.cursor,d),e,u);return So(l.getQueryData(f),r)},enabled:_,refetchInterval:_?15e3:!1,staleTime:1e4,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),y=A({queryKey:g,queryFn:async({signal:t})=>{let n=s===`question-foundation`?await R.mapCopy(`project`,e,o,t,e,s,m):await R.mapCopy(`project`,e,o,t,e,s),r=l.getQueryData(g);return to(r,n,r?.model_revision)},enabled:_,staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),b=v.data?.tasks.find(e=>e.id===u),x=Do(u,b,d.eventSince),S=ko(g,u,x),C=(0,G.useMemo)(()=>mo(v.data,b,d.eventSince),[v.data,b,d.eventSince]),w=go(b,C),T=u?y.data?.cards[u]:void 0,E=(T?.version??0)>=14&&_o(T?.reader_brief)?T.reader_brief:void 0,D=vo(v.data,b,C,y.data),O=yo(y.data),k=_&&a&&!i&&!h&&!!b&&y.data?.available===!0&&!O&&!v.isError&&!y.isError,j=[`research-brief-generation`,e,u,o,d.eventSince,s,...s===`question-foundation`?[m]:[]],N=Math.max(14,y.data?.version??0),P=[...j,N,y.data?.model_revision??null,w],F=ee({queryKey:j}),te=l.getQueryState(P)?.status===`error`,ne=A({queryKey:P,queryFn:async()=>{if(!b)throw Error(`The current task is not recorded yet.`);let t=l.getQueryData(g)?.model_revision,n=Oo(l,g,[{key:b.id,startedAt:x}]),r;try{r=await R.generateMapCopy(`project`,e,{cards:[ho(b,C)],locale:o,...m?{foundation_id:m}:{}},void 0,e,s,n.update)}finally{n.finish()}let i=r.cards?.[b.id],a={available:(i?.version??0)>=14&&_o(i?.reader_brief)&&!r.retry_after&&r.available!==!1&&(i?.version??0)>=N&&!!v.data&&!no(ho(b,C),v.data,r,new Map(C.map(e=>[e.id,e]))),retryAfter:r.retry_after??null,inputSignature:w};return l.setQueryData(g,e=>to(e,r,t)),a},enabled:k&&D&&!te&&F===0,staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),re=ne.data?.retryAfter;return(0,G.useEffect)(()=>{if(!k||!D||ne.isFetching||ne.isError||ne.data?.available!==!1||typeof re!=`number`||!Number.isFinite(re)||re<=0)return;let e=setTimeout(()=>{ne.refetch({cancelRefetch:!1})},Math.max(0,ne.dataUpdatedAt+re*1e3-Date.now()));return()=>clearTimeout(e)},[k,D,ne.isFetching,ne.isError,ne.data?.available,ne.dataUpdatedAt,re,ne.refetch]),{foundationId:m,foundationRequired:h,questionContext:{locale:o===`zh-CN`?`zh-CN`:`en-US`,preview:s,foundationId:m},task:b,evidence:C,loadedEvents:v.data?.events,card:T,brief:E,inputSignature:w,needsUpdate:D&&ne.data?.available!==!0,legacy:O,loading:_&&(v.isPending||y.isPending),generating:S.active||ne.isFetching||F>0,generationPhase:S.phase,readError:v.error||y.error,generationError:D&&!S.active?ne.error:null,generationUnavailable:ne.data?.available===!1&&D&&!S.active,generationAvailable:y.data?.available===!0,teachingUnavailable:!!E&&T?.teaching_review?.status===`unavailable`,readingUnavailable:!!E&&T?.teaching_review?.reading_review?.status===`unavailable`,retry:async()=>{_&&(v.isError||y.isError||!y.data?.available||O||!b?await Promise.allSettled([v.refetch(),y.refetch()]):k&&await ne.refetch())}}}function Ko(e){let t=new Set;return[e.primary_target,...e.targets].filter(e=>!e?.path||t.has(e.path)?!1:(t.add(e.path),!0))}function qo(e,t){if(t===`research`)for(let t of e){let e=Ko(t).find(e=>/(?:^|\/)paper\/main\.pdf$/i.test(e.path.replace(/\\/g,`/`)));if(e)return{receipt:t,path:e.path}}let n=e[0];return n?{receipt:n,path:Ko(n)[0]?.path||null}:null}function Jo(e){return e.replace(/\s*\bRESULT\s*=\s*/g,` + +`).replace(/\s*\b(?:STATUS|REVIEW_STATUS)\s*=\s*\S+/g,``).trim()}function Yo(e,t,n){let r=n.reduce((e,t)=>t.type===`ui.operator`?Math.max(e,Number(t.ts)||0):e,0),i=t&&(e===void 0||t.delivered_at>r)?t:null;return e?i&&i.delivered_at>e.delivered_at?i:e:i}function Xo(e,t){if(!t)return!1;let n=new Set([t]),r=[t];for(let t=0;te.id!==t&&n.has(e.id)&&[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))}var Zo=new Set([`done`,`passed`,`approved`,`accepted`]);function Qo(e,t){let n=String(e.review_status||``).toLowerCase(),r=String(e.review_source||``).toLowerCase(),i=String(e.residual_risk||``).trim();return Zo.has(n)&&r===`reviewer`&&i?{independent:!0,text:t?`独立复核通过 · 有残余风险`:`Independently reviewed · residual risk`,title:t?`有一项检查在此环境中无法进行,已被接受为残余风险:${i}`:`One check was impossible here and its risk was accepted: ${i}`}:Zo.has(n)&&r===`reviewer`?{independent:!0,text:t?`独立复核通过`:`Independently reviewed`,title:t?`另一个审查角色检查过这份成果`:`A separate reviewer checked this result`}:!n||n===`not_assessed`||Zo.has(n)&&r?{independent:!1,text:t?`实现者自检 · 未独立复核`:`Self-checked · not independently reviewed`,title:t?`只有完成它的人自己检查过,没有另外的审查`:`Only the worker that produced it checked it; no separate review`}:Zo.has(n)?{independent:!1,text:t?`已完成 · 未记录是否独立复核`:`Completed · review source not recorded`,title:t?`这份较早的交付没有记录是谁检查的,不能确认经过独立复核`:`This older delivery did not record who checked it, so independent review cannot be confirmed`}:{independent:!1,text:t?`复核状态:${n}`:`Review: ${n}`,title:t?`独立复核没有通过或已过期`:`Independent review did not pass or is out of date`}}function $o(e,t,n){if(!n)return null;let r=e.snapshots?.find(e=>e.path===n&&e.stored);if(!r)return null;let i=t.filter(t=>t.delivery_id!==e.delivery_id&&t.delivered_att.delivered_at-e.delivered_at);for(let e of i){let t=e.snapshots?.find(e=>e.path===n);if(!(!t||t.sha256===r.sha256))return t.stored?{path:n,before:t.sha256,after:r.sha256}:null}return null}var es=[1,0],ts=[{id:`up`,vector:[0,1],zh:`向上 1 格`,en:`Up 1 square`},{id:`right`,vector:[2,0],zh:`向右 2 格`,en:`Right 2 squares`},{id:`fraction`,vector:[1.5,0],zh:`向右 1.5 格`,en:`Right 1.5 squares`},{id:`zero`,vector:[0,0],zh:`留在原点`,en:`Stay at the origin`}];function ns(e,t){return e[0]*t[1]-e[1]*t[0]===0?e.some(Boolean)||t.some(Boolean)?1:0:2}function rs(e){if(!e)return!1;let t=[e.name,e.explanation,e.example,e.connection].join(` `);return/独立(?:的)?方向|线性(?:无关|独立)|independent\s+directions?\b|linear\s+independence\b|linearly\s+independent\b/iu.test(t)}function is(){let{locale:e}=z(),t=e===`zh-CN`,n=(e,n)=>t?e:n,[r,i]=(0,G.useState)(ts[0]),a=(0,G.useId)(),o=r.vector,s=ns(es,o),c=e=>62+e*36,l=e=>116-e*36,u=r.id===`up`?n(`只沿 A 左右移动,走不到 B 的终点;B 补上了上下方向。`,`Moving left or right along A cannot reach B’s endpoint. B adds an up-and-down direction.`):r.id===`right`?n(`走两次 A 就能代替 B。步子更长,并没有增加独立方向。`,`Two copies of A replace B. A longer step does not add an independent direction.`):r.id===`fraction`?n(`走两次 B 和走三次 A,都向右走了 3 格。虽然两者互相都不是整数倍,仍只有一个独立方向。`,`Two copies of B and three copies of A both move 3 squares right. Neither is an integer multiple of the other, but they still provide only one independent direction.`):n(`B 没有移动,没有增加方向;A 仍提供一个独立方向。`,`B does not move, so it adds no direction. A still provides one independent direction.`),d=n(`这两支箭头提供 ${s} 个独立方向`,`These two arrows provide ${s} independent direction${s===1?``:`s`}`);return(0,J.jsxs)(`section`,{className:`my-2 rounded-lg border border-line bg-surface p-3`,"aria-label":n(`平面上的独立方向示意`,`Independent directions in a plane`),"data-testid":`direction-example`,children:[(0,J.jsx)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:n(`A 固定向右走 1 格。改变 B,看看它是否提供新的走法。允许把箭头缩放、反向,再相加。`,`A always moves 1 square right. Change B to see whether it adds a new way to move. Arrows may be scaled, reversed, and added.`)}),(0,J.jsxs)(`svg`,{viewBox:`0 0 210 180`,className:`mx-auto my-2 block w-full max-w-[260px]`,role:`img`,"aria-labelledby":`${a}-title ${a}-desc`,children:[(0,J.jsx)(`title`,{id:`${a}-title`,children:d}),(0,J.jsx)(`desc`,{id:`${a}-desc`,children:`A = (1, 0), B = (${o[0]}, ${o[1]}). ${u}`}),(0,J.jsxs)(`defs`,{children:[(0,J.jsx)(`marker`,{id:`${a}-a`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,J.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:B.accent})}),(0,J.jsx)(`marker`,{id:`${a}-b`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,J.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:B.success})})]}),(0,J.jsx)(`rect`,{x:`20`,y:`32`,width:`165`,height:`125`,rx:`4`,fill:B.accent,opacity:s===2?.07:0}),[-1,0,1,2,3].map(e=>(0,J.jsx)(`line`,{x1:c(e),x2:c(e),y1:`32`,y2:`157`,stroke:`rgb(var(--line))`},`x${e}`)),[-1,0,1,2].map(e=>(0,J.jsx)(`line`,{y1:l(e),y2:l(e),x1:`20`,x2:`185`,stroke:`rgb(var(--line))`},`y${e}`)),s===1?(0,J.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:B.accent,strokeWidth:`10`,opacity:`.09`}):null,(0,J.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:B.inkFaint}),(0,J.jsx)(`line`,{x1:c(0),x2:c(0),y1:`32`,y2:`157`,stroke:B.inkFaint}),[0,1,2,3].map(e=>(0,J.jsx)(`text`,{x:c(e)-3,y:l(0)+14,fill:B.inkFaint,fontSize:`9`,children:e},e)),r.id===`zero`?(0,J.jsx)(`circle`,{cx:c(0),cy:l(0),r:`5`,fill:`rgb(var(--surface))`,stroke:B.success,strokeWidth:`3`,"data-testid":`direction-b-zero`}):(0,J.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(o[0]),y2:l(o[1]),stroke:B.success,strokeWidth:`3`,markerEnd:`url(#${a}-b)`,"data-testid":`direction-b`}),(0,J.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(es[0]),y2:l(es[1]),stroke:B.accent,strokeWidth:`3`,markerEnd:`url(#${a}-a)`}),(0,J.jsx)(`text`,{x:c(es[0])+3,y:l(es[1])-10,fill:B.accent,fontSize:`12`,fontWeight:`600`,children:`A`}),(0,J.jsx)(`text`,{x:c(o[0])+(r.id===`zero`?-17:8),y:l(o[1])+(r.id===`up`?-3:28),fill:B.success,fontSize:`12`,fontWeight:`600`,children:`B`})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,role:`group`,"aria-label":n(`选择 B 的走法`,`Choose B’s movement`),children:ts.map(e=>(0,J.jsx)(W,{className:`text-[11px]`,variant:r.id===e.id?`primary`:`ghost`,"aria-pressed":r.id===e.id,onClick:()=>i(e),"data-choice":e.id,children:t?e.zh:e.en},e.id))}),(0,J.jsxs)(`div`,{className:`mt-3`,"aria-live":`polite`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-ink`,"data-testid":`direction-count`,children:d}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:u})]}),(0,J.jsx)(`p`,{className:`mt-3 border-t border-line pt-2 text-[11px] leading-5 text-ink-faint`,children:n(`这里只统计这两支箭头提供的方向。找到一些独立方向,不等于已经找全研究对象的所有方向;图里的数字不能用来计算曲面的 Picard 数,也不能证明研究中的条件。`,`This counts only the directions supplied by these two arrows. Finding some independent directions does not establish that they span the whole research object. These numbers cannot determine a surface’s Picard number or prove the conditions used in the research.`)})]})}function as({path:e,identity:t,artifacts:n,onOpenArtifact:r}){let{locale:i}=z(),a=i===`zh-CN`,o={artifacts:n,onOpenArtifact:r};return(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-learning-path":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`理解这个问题`:`Understand the question`}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-question":!0,children:(0,J.jsx)(H,{...o,children:e.question})}),(0,J.jsx)(`ol`,{className:`mt-4 grid list-none gap-5 p-0`,children:e.steps.map((e,n)=>(0,J.jsxs)(`li`,{className:`min-w-0 border-t border-line/50 pt-3`,"data-learning-step":n+1,children:[(0,J.jsxs)(`h4`,{className:`mb-2 text-sm font-medium text-ink`,children:[(0,J.jsxs)(`span`,{className:`mr-2 text-ink-faint`,children:[n+1,`.`]}),e.title]}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-explanation":!0,children:(0,J.jsx)(H,{...o,children:e.explanation})}),(0,J.jsxs)(`div`,{className:`mt-3 border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-learning-example":!0,children:[(0,J.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`例子`:`Example`}),(0,J.jsx)(H,{...o,children:e.example})]}),(0,J.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,"data-learning-check":!0,children:[(0,J.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`小问题`:`Try it`}),(0,J.jsx)(`div`,{"data-learning-check-question":!0,children:(0,J.jsx)(H,{...o,children:e.check.question})}),(0,J.jsx)(ft,{label:a?`点击看解答`:`Show the answer`,children:(0,J.jsx)(`div`,{"data-learning-check-answer":!0,children:(0,J.jsx)(H,{...o,children:e.check.answer})})},`${e.check.question}:${e.check.answer}`)]})]},`${t}:${n}`))})]})}function os({value:e,expandLabel:t,clamp:n=!0}){let[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),s=(0,G.useRef)(null),{locale:c}=z();return(0,G.useEffect)(()=>{let e=s.current;if(!e||!n||r)return;let t=()=>o(e.scrollHeight>e.clientHeight+1);t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,n,r]),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{ref:s,className:`text-[13px] leading-6 text-ink-dim ${!n||r?``:`line-clamp-3`}`,children:(0,J.jsx)(H,{children:e})}),n&&(a||r)?(0,J.jsxs)(`button`,{type:`button`,className:`mt-0.5 text-xs text-blue-sky hover:underline`,onClick:()=>i(!r),"aria-expanded":r,children:[r?c===`zh-CN`?`收起`:`Show less`:t,(0,J.jsx)(Ue,{size:11,className:`ml-1 inline ${r?`rotate-180`:``}`})]}):null]})}function ss({generatedAt:e,pending:t=!1,generating:n=!1,phase:r,hasExplanation:i=!1,error:a,unavailable:o=!1,retry:s,retryDisabled:c=!1}){let{locale:l}=z(),u=l===`zh-CN`,d=Tt({ts:e}),f=d?.toLocaleString(l,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,p=!!a||o;return!(i&&(f||t))&&!n&&!p?null:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,"data-testid":`research-brief-status`,children:[i&&(f||t)?(0,J.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,children:[t?`${u?`上次说明`:`Previous explanation`}${f||!p?` · `:``}`:``,f?(0,J.jsx)(`time`,{dateTime:d?.toISOString(),title:d?.toLocaleString(l),children:f}):null,t&&!p?`${f?` · `:``}${u?`待更新`:`update pending`}`:``]}):null,p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:a?u?`说明生成未完成;不会自动重复请求。`:`The explanation could not be prepared. This request will not be repeated automatically.`:u?`说明暂未更新;可以手动重试。`:`The explanation has not been updated yet. You can retry manually.`}),s?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:n||c,onClick:()=>void s(),children:[(0,J.jsx)(Ke,{size:12}),u?`重试`:`Retry`]}):null]}):n?(0,J.jsxs)(`span`,{role:`status`,"data-explanation-phase":r??`pending`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint`,children:[(0,J.jsx)(tt,{}),Ao(r,u)]}):null]})}function cs({brief:e,identity:t,detail:n,learningPath:r,foundation:i,readingUnavailable:a=!1,teachingUnavailable:o=!1,artifacts:s,onOpenArtifact:c}){let{locale:l}=z(),u=l===`zh-CN`,d=(e,t)=>u?e:t;return(0,J.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-4`,"data-reader-explanation":t,children:[i?(0,J.jsxs)(`div`,{className:`rounded border border-line/60 p-2 text-xs text-ink-dim`,"data-foundation-id":i.id,children:[(0,J.jsxs)(`p`,{children:[d(`这次进展参考的基础说明:`,`Foundations used to explain this progress: `),i.question]}),c?(0,J.jsx)(W,{className:`mt-1 text-xs`,onClick:()=>c(i.path),children:d(`阅读这份基础说明`,`Read these foundations`)}):null]}):null,a?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`阅读说明还需要核对,可以继续问这一步。`,`The reading explanation still needs checking. You can keep asking about this step.`)}):o?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`这个概念的说明还没核对清楚,可以继续问这一步。`,`The explanation of this concept has not been checked clearly yet. You can keep asking about this step.`)}):null,r?(0,J.jsx)(as,{path:r,identity:t,artifacts:s,onOpenArtifact:c},t):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-why":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`这一步为什么有用`,`Why this step helps`)}),(0,J.jsx)(os,{value:e.why,expandLabel:d(`完整说明`,`Full explanation`),clamp:!1},`why:${t}`)]}),e.concept?(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-teaching":t,children:[(0,J.jsxs)(`h3`,{className:`mb-3 text-xs font-medium text-ink`,children:[d(`认识一个概念`,`One useful concept`),` · `,e.concept.name]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 gap-3`,"data-reader-teaching-columns":t,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,"data-reader-definition":t,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`定义`,`Definition`)}),(0,J.jsx)(os,{value:e.concept.explanation,expandLabel:d(`完整定义`,`Full definition`),clamp:!1},`concept:${t}:${e.concept.name}`)]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-testid":`concept-example`,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`例子`,`Example`)}),(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:e.concept.example})]}),rs(e.concept)?(0,J.jsx)(ft,{label:d(`动手看两个方向`,`Try two directions`),children:(0,J.jsx)(is,{})}):null]}),(0,J.jsxs)(`div`,{className:`min-w-0`,"data-reader-connection":t,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`与本步的关系`,`Connection to this step`)}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:e.concept.connection})})]})]})]}):null]}),(0,J.jsxs)(`section`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`结论到哪里为止`,`What this does and does not establish`)}),(0,J.jsx)(os,{value:e.scope,expandLabel:d(`完整适用范围`,`Full scope`),clamp:!1},`scope:${t}`)]}),(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-next-interpretation":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`解说对后续的理解`,`How the explanation interprets the follow-up`)}),(0,J.jsx)(os,{value:e.next,expandLabel:d(`完整解读`,`Full interpretation`),clamp:!1},`next:${t}`)]}),n?(0,J.jsx)(ft,{className:`min-w-0`,label:d(`详细说明与条件`,`Detailed explanation and conditions`),children:(0,J.jsx)(`div`,{className:`macro-reader-markdown text-[13px] leading-6 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:n})})},`detail:${t}`):null]})}function ls({task:e,artifacts:t,onOpenArtifact:n}){let r=z().locale===`zh-CN`,i=typeof e?.pending_question==`string`?e.pending_question.trim():``;return i?(0,J.jsxs)(`section`,{className:`mt-4 min-w-0 border-t border-line/60 pt-3 text-[13px] leading-6 text-ink-dim`,"data-reader-pending-question":e.id,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:r?`这一步在等你回答`:`This step is waiting for your answer`}),(0,J.jsx)(H,{artifacts:t,onOpenArtifact:n,children:i})]}):null}function us(e){return e.kind===`markdown`||e.mime?.split(`;`,1)[0].trim().toLowerCase()===`text/markdown`||/\.(?:md|markdown)$/i.test(e.name||e.path||``)}function ds(e){return e.title?.trim()||e.question}var fs=[{label:[`从头讲清楚`,`Explain from the beginning`],question:[`请从头讲清楚这份说明。先用日常语言解释它在讨论什么、要判断什么,再按需要解释其中的对象和符号。涉及比较或公式时,请明确两边是什么、哪些条件下能比较,并用一个可复算的小例子说明。请分别说明标准背景知识、本次已有证据和仍未知的内容。`,`Explain this reading from the beginning using everyday language. Start with what it discusses and what we are trying to determine, then explain the necessary objects and symbols. For a comparison or formula, define both sides and when the comparison is valid, and work a small example I can recompute. Distinguish standard background, evidence from this run, and what remains unknown.`]},{label:[`带我算一遍`,`Work through an example`],question:[`请带我实际算一遍这份说明中的关键一步。先解释对象、输入和运算规则,再用一组明确标为教学例子的小数据展示中间步骤与结果,然后换一个输入让我能照着计算。请说明它怎样关系到正在判断的结论,以及这个例子还不能证明什么。`,`Walk me through the key operation in this reading. Explain the objects, inputs, and rules, then use a small example clearly labeled as a teaching example to show the intermediate steps and result. Change one input and work it again so I can follow the calculation. Explain how it relates to the conclusion being assessed and what the example does not prove.`]},{label:[`这说明了什么`,`What does this establish?`],question:[`这份说明究竟支持什么结论?请用我能懂的语言解释已经验证的部分、依赖的条件、未覆盖的情况,以及它和整个任务目标的关系。解释必要概念,并指出哪些只是记录中的说法、哪些有可核对的依据。`,`What conclusion does this reading support? Explain the part that has been checked, its assumptions, the cases it does not cover, and how it relates to the overall task. Explain the necessary concepts and distinguish reported claims from conclusions with verifiable supporting evidence.`]}];function ps({draft:e,onChange:t,onSubmit:n,disabled:r,children:i}){let a=z().locale===`zh-CN`,o=!!e.parentId||!!e.progressSource,s=(0,G.useRef)(null);return(0,J.jsxs)(J.Fragment,{children:[i,o&&!e.question.trim()?(0,J.jsxs)(`div`,{className:`mb-3 space-y-2`,"data-reading-question-suggestions":!0,children:[(0,J.jsx)(`p`,{className:`text-xs text-ink-dim`,children:a?`可以从这些问题开始,也可以直接输入。`:`Start with one of these questions, or write your own.`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:fs.map(n=>(0,J.jsx)(W,{type:`button`,className:`text-xs`,disabled:r,onClick:()=>{t({...e,question:n.question[+!a]}),s.current?.focus()},children:n.label[+!a]},n.label[1]))})]}):null,(0,J.jsx)(`textarea`,{ref:s,"aria-label":a?`想理解的问题`:`Question to understand`,className:`min-h-40 w-full rounded-lg border border-line bg-bg p-3 text-sm leading-6 text-ink`,maxLength:8e3,value:e.question,onChange:n=>t({...e,question:n.target.value})}),e.sourceTitle?(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[a?`从这项任务打开:`:`Opened from this task: `,e.sourceTitle]}):null,(0,J.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,J.jsx)(W,{"data-reading-submit":!0,disabled:!e.question.trim()||r,onClick:n,children:o?a?`提问`:`Ask question`:a?`生成并保存基础说明`:`Generate and save foundations`})})]})}function ms(e){if(!e||typeof e!=`object`)return!1;let t=e;return[`source_id`,`title`,`path`,`task_id`,`card_key`].every(e=>typeof t[e]==`string`&&String(t[e]).trim())&&Number.isFinite(t.generated_at)&&t.generated_at>=0&&Number.isSafeInteger(t.copy_revision)&&t.copy_revision>=0}function hs(e){let t=e.reader_foundation;return!!t&&(t.kind??`foundation`)===`foundation`&&!t.parent_id&&!t.progress_source}function gs(e,t,n=!0){let r=M(),i=Wo(e,n),a=Bo(e,t),o=[`reader-foundation-create`,e,t],s=P({filters:{mutationKey:o,status:`pending`},select:e=>e.state.variables?.id}),c=ko(o,s.at(-1)??a?.id),l=n=>({sid:n.sid??e,locale:n.locale??t}),u=N({mutationKey:o,mutationFn:async e=>{let t=l(e),n=Oo(r,[`reader-foundation-create`,t.sid,t.locale],[{key:e.id}]);try{let r={request_id:e.id,question:e.draft.question.trim(),locale:t.locale},i=e.draft.parentId?await R.askReaderFoundation(t.sid,e.draft.parentId,r,n.update):await R.generateReaderFoundation(t.sid,{...r,...e.draft.progressSource?{progress_source:{source_id:e.draft.progressSource.source_id}}:e.draft.sourceTaskId?{source_task_id:e.draft.sourceTaskId}:{}},n.update),a=i.reader_foundation;if(a?.id!==e.id||a.locale!==t.locale)throw Error(t.locale===`zh-CN`?`说明请求的结果尚未确认。`:`The result of this explanation request is unconfirmed.`);if(e.draft.parentId&&(a.kind!==`clarification`||a.parent_id!==e.draft.parentId))throw Error(t.locale===`zh-CN`?`追问与来源说明的对应关系尚未确认。`:`The question’s connection to its source is unconfirmed.`);if(e.draft.progressSource&&(a.progress_source?.source_id!==e.draft.progressSource.source_id||!e.draft.parentId&&a.kind!==`progress_answer`))throw Error(t.locale===`zh-CN`?`回答与这版进展说明的对应关系尚未确认。`:`The answer’s connection to this progress explanation is unconfirmed.`);return i}finally{n.finish(),await r.invalidateQueries({queryKey:No(t.sid)})}},onSuccess:(e,t)=>{let n=l(t);!t.draft.parentId&&!t.draft.progressSource&&hs(e)&&e.exists&&e.reader_foundation?.state===`complete`&&Ho(r,n.sid,n.locale).choice===t.beforeChoice&&Vo(r,n.sid,n.locale,e.reader_foundation.id),r.setQueryData(No(n.sid),t=>{let n=t?.find(t=>t.path===e.path);return n&&n.reader_foundation?.state!==`generating`&&e.reader_foundation?.state===`generating`?t:[...(t??[]).filter(t=>t.path!==e.path),e]}),t.draft.progressSource||r.invalidateQueries({queryKey:[`map-copy`,`project`,n.sid]})},onError:(e,t)=>{if(e instanceof se&&e.code===`reader_source_unavailable`){let e=l(t);Ro(r,e.sid,e.locale,{...t,rejected:`reader_source_unavailable`})}},retry:!1}),d=(i.data??[]).filter(e=>e.reader_foundation?.locale===t),f=d.some(e=>e.reader_foundation?.state===`generating`),p=d.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),m=u.variables&&l(u.variables),h=m?.sid===e&&m.locale===t,g=h&&u.isPending||s.length>0||c.active,_=a?.id??(h?u.variables?.id:void 0),v=d.find(e=>e.reader_foundation?.id===_),y=v?.reader_foundation?.state===`failed`,b=v?.reader_foundation?.state===`complete`,x=a?.rejected===`reader_source_unavailable`,S=!!a&&!x&&!v&&!g,C=g||f||!!a&&!x||i.isPending||i.isError;return(0,G.useEffect)(()=>{a&&(y||b)&&zo(r,e,t,a.id)},[r,e,t,a,y,b]),{client:r,list:i,notes:d,pendingRequest:a,progress:c,generation:u,waiting:f,overdue:p,creating:g,requested:v,confirmedFailure:y,confirmedComplete:b,requestRejected:x,unknownResult:S,creationBlocked:C,submit:n=>{if(!n.question.trim()||C)return null;let i=crypto.randomUUID(),a={id:i,sid:e,locale:t,draft:{...n,...n.progressSource?{progressSource:{...n.progressSource}}:{}},beforeChoice:Ho(r,e,t).choice};return Ro(r,e,t,a),u.mutate(a),i},retrySavedRequest:n=>u.mutate({...n,sid:n.sid??e,locale:n.locale??t})}}var _s=(0,G.createContext)(null);function vs({card:e,cardKey:t,taskId:n,readOnly:r=!1,context:i}){let a=(0,G.useContext)(_s),o=z().locale===`zh-CN`,[s,c]=(0,G.useState)(`idle`),[l,u]=(0,G.useState)(!1),d=(0,G.useRef)(0),f=i??a?.context,p=JSON.stringify([a?.sid,a?.readOnly,r,f,t,n,e?.copy_revision,e?.generated_at,e?.title]),m=(0,G.useRef)(p);if(m.current=p,(0,G.useEffect)(()=>(c(`idle`),()=>{d.current+=1}),[p]),!a?.sid||a.readOnly||r)return null;let h=!!e&&Number.isSafeInteger(e.copy_revision)&&!!e.title?.trim()&&!(f?.preview===`question-foundation`&&!f.foundationId),g=async()=>{if(!h||!f||s===`opening`)return;let r=++d.current;c(`opening`);try{let i=await a.source(t,n,f);if(r!==d.current||m.current!==p)return;if(i&&(i.copy_revision!==e.copy_revision||i.generated_at!==e.generated_at||i.title!==e.title))throw new se(`The selected explanation has changed.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);c(`idle`),i&&a.open(i)}catch(e){r===d.current&&m.current===p&&(u(e instanceof se&&e.code===`reader_source_unavailable`),c(`failed`))}};return(0,J.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-1`,children:[(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:!h||s===`opening`,title:h?void 0:o?`这一步的说明写好后就可以提问。`:`Questions open once this step has an explanation.`,"data-testid":`progress-question-trigger`,"data-progress-question-card":t,"data-progress-question-state":s,onClick:()=>void g(),children:[(0,J.jsx)(sn,{size:12}),o?`问这一步`:`Ask about this step`]}),s===`failed`?(0,J.jsx)(`span`,{role:`alert`,className:`text-xs text-ink-dim`,children:l?o?`这版说明暂不可用或已变化,未打开提问。请刷新页面后再试。`:`This explanation is unavailable or has changed. No question was opened. Reload this page and try again.`:o?`暂时无法读取这一步的提问材料,未打开提问。请再试一次。`:`The question material could not be loaded. No question was opened. Please try again.`}):null]})}function ys(){let e=(0,G.useContext)(_s),t=z().locale===`zh-CN`;return e?.hasHistory?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>e.open(),children:[(0,J.jsx)(K,{size:12}),t?`阅读问答`:`Reading questions`]}):null}function bs({sid:e,path:t,artifacts:n,onOpenArtifact:r}){let i=z().locale===`zh-CN`,a=A({queryKey:[`reading-question-artifact`,e,t],queryFn:async({signal:n})=>{let r=await R.artifact(e,t,n);if(r.exists&&r.path===t&&(r.truncated||typeof r.preview!=`string`)){let i=await R.artifactBlob(e,t,!1,n);return{...r,preview:await i.text(),truncated:!1}}return r},retry:!1,staleTime:1/0,refetchOnWindowFocus:!1});return a.isPending?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:i?`正在读取保存内容…`:`Loading saved reading…`}):a.isError||!a.data?.exists||a.data.path!==t?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[i?`保存内容暂时无法读取。`:`The saved reading could not be loaded.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>void a.refetch(),children:i?`重新读取`:`Reload`})]}):(0,J.jsxs)(`div`,{className:`min-w-0 max-w-full overflow-x-auto break-words`,"data-reading-artifact-path":t,children:[(0,J.jsx)(H,{artifacts:[...n,...a.data.reader_foundation?.sources??[]],onOpenArtifact:r,children:a.data.preview??``}),a.data.truncated?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`此处显示保存内容的节选。`:`This view shows an excerpt of the saved reading.`}):null]})}function xs({sid:e,readOnly:t=!1,children:n}){let r=z().locale,i=r===`zh-CN`?`zh-CN`:`en-US`,a=i===`zh-CN`,o=gs(e??``,i,!!e),s=Uo(e??``,i).id,c=(0,G.useRef)(0),l=async(t,n,r)=>{let i=++c.current,{preview:a,foundationId:o,locale:s}=r,l=await R.mapQuestionSource(e??``,{card_key:t,task_id:n,locale:s,...a?{preview:a}:{},...a===`question-foundation`&&o?{foundation_id:o}:{}});if(i!==c.current)return null;if(!ms(l)||l.card_key!==t||l.task_id!==n||!l.path.startsWith(`reader-progress/${e}/`))throw new se(`The reading source does not match this step.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);return l},[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(null);(0,G.useEffect)(()=>(d(null),p(null),h(null),_(!1),y(null),()=>{c.current+=1}),[e,i]);let b=u&&u.sid===e&&u.locale===i?u:null,x=b?.source,S=o.notes.filter(e=>ms(e.reader_foundation?.progress_source)),C=o.pendingRequest?.draft.progressSource?o.pendingRequest:null,w=new Map;for(let t of S){let n=t.reader_foundation.progress_source;n.path.startsWith(`reader-progress/${e}/`)&&w.set(n.source_id,n)}C?.draft.progressSource&&w.set(C.draft.progressSource.source_id,C.draft.progressSource),x&&w.set(x.source_id,x);let T=[...o.list.data??[],...[...w.values()].map(e=>({path:e.path}))],E=e=>{e===x?.path?(_(!0),y(null)):y(e)},D=x?S.filter(e=>e.reader_foundation.progress_source.source_id===x.source_id):[],O=D.find(e=>e.reader_foundation?.id===m),k=O?.exists&&O.reader_foundation?.state===`complete`,A=C?.draft.progressSource?.source_id===x?.source_id?C:null,j=A?D.find(e=>e.reader_foundation?.id===A.id):void 0,M=!!A&&A.rejected===`reader_source_unavailable`,ee=!!A&&!M&&!j&&!o.creating,N=n=>{c.current+=1;let r=n??C?.draft.progressSource??[...w.values()].at(-1);if(!e||!ms(r)||!r.path.startsWith(`reader-progress/${e}/`))return;d({sid:e,locale:i,source:{...r}}),_(!1),y(null);let a=S.filter(e=>e.reader_foundation?.progress_source?.source_id===r.source_id).at(-1);h(a?.reader_foundation?.id??null),p(n&&!t?{question:``,progressSource:{...r}}:null)},P=()=>{d(null),p(null),h(null),_(!1),y(null)},F=t=>{e&&(d({sid:e,locale:i,source:{...t}}),h(null),_(!1),y(null),p(e=>e?{question:e.question,progressSource:{...t}}:null))},te=()=>{if(t||!b||!f?.progressSource||f.progressSource.source_id!==b.source.source_id||f.parentId&&!D.some(e=>e.reader_foundation?.id===f.parentId&&e.exists&&e.reader_foundation?.state===`complete`))return;let e=o.submit(f);e&&(h(e),p(null))},ne=!!A&&o.creating||D.some(e=>e.reader_foundation?.state===`generating`);return(0,J.jsxs)(_s.Provider,{value:{sid:e??``,readOnly:t,hasHistory:w.size>0,open:N,source:l,context:{locale:i,preview:ae(),foundationId:s}},children:[n,(0,J.jsx)(dt,{open:!!b,onClose:P,label:a?`进展阅读问答`:`Questions about this progress`,children:b&&x?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lt,{title:a?`哪里还不明白`:`What is still unclear`,sub:x.title}),(0,J.jsxs)(`div`,{className:`space-y-4 px-6 pb-6`,"data-testid":`progress-questions`,"data-project-id":b.sid,"data-progress-source-id":x.source_id,"data-progress-source-title":x.title,"data-reader-card":x.card_key,"data-reader-task-id":x.task_id,children:[(0,J.jsxs)(`div`,{className:`rounded-lg border border-line/70 p-3 text-xs text-ink-dim`,children:[(0,J.jsxs)(`p`,{children:[a?`引用打开提问时的这版说明:`:`Using the explanation selected when this question was opened: `,x.title]}),(0,J.jsx)(`time`,{dateTime:new Date(x.generated_at*1e3).toISOString(),className:`mt-1 block text-ink-faint`,children:new Date(x.generated_at*1e3).toLocaleString(r)}),(0,J.jsx)(W,{className:`mt-2 text-xs`,"data-reading-source-path":x.path,onClick:()=>_(e=>!e),children:g?a?`收起原说明`:`Hide original explanation`:a?`阅读当时说明`:`Read the original explanation`}),g?(0,J.jsx)(`div`,{className:`mt-3 text-[13px] leading-6`,children:(0,J.jsx)(bs,{sid:b.sid,path:x.path,artifacts:T,onOpenArtifact:E})}):null]}),w.size>1?(0,J.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`查看已保存的进展问答`:`Saved progress questions`,(0,J.jsx)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:x.source_id,disabled:o.creating,onChange:e=>{let t=w.get(e.target.value);t&&F(t)},children:[...w.values()].map(e=>(0,J.jsxs)(`option`,{value:e.source_id,children:[e.title,` · `,new Date(e.generated_at*1e3).toLocaleString(r)]},e.source_id))})]}):null,D.length?(0,J.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`已保存的问题`:`Saved questions`,(0,J.jsxs)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:m??``,onChange:e=>{h(e.target.value||null),y(null)},children:[(0,J.jsx)(`option`,{value:``,children:a?`选择一个问题`:`Choose a question`}),D.map(e=>(0,J.jsx)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,children:ds(e.reader_foundation)},e.path))]})]}):null,O?(0,J.jsxs)(`section`,{className:`space-y-3 text-[13px] leading-6`,"data-reading-question-id":O.reader_foundation.id,children:[k?(0,J.jsx)(ft,{label:a?`查看这次问题`:`View this question`,children:(0,J.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-ink-dim`,children:O.reader_foundation.question})},O.reader_foundation.id):(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words font-medium`,children:O.reader_foundation.question}),k?(0,J.jsx)(bs,{sid:b.sid,path:O.path,artifacts:T,onOpenArtifact:E}):(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:O.reader_foundation.state===`generating`?a?`回答仍在整理,尚未确认结束。`:`The answer is still being prepared; completion is unconfirmed.`:a?`这次回答未完成,原问题已保留。`:`This answer did not finish; its question is retained.`}),!t&&O.exists&&O.reader_foundation.state===`complete`?(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x},parentId:O.reader_foundation.id,parentTitle:ds(O.reader_foundation)}),children:a?`继续问这份回答`:`Ask a follow-up to this answer`}):null,!t&&O.reader_foundation.state===`failed`?(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:O.reader_foundation.question,progressSource:{...x},parentId:O.reader_foundation.parent_id??void 0}),children:a?`重新编辑问题`:`Edit this question`}):null]}):null,v?(0,J.jsxs)(`section`,{className:`space-y-2 rounded-lg border border-line/70 p-3 text-[13px] leading-6`,"data-referenced-reading-path":v,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{children:a?`引用的保存内容`:`Referenced saved reading`}),(0,J.jsx)(W,{className:`text-xs`,onClick:()=>y(null),children:a?`收起引用`:`Close referenced reading`})]}),(0,J.jsx)(bs,{sid:b.sid,path:v,artifacts:T,onOpenArtifact:E})]}):null,ne?(0,J.jsx)(ss,{generating:!0,phase:A?o.progress.phase:void 0}):null,A?(0,J.jsxs)(`div`,{className:`space-y-2 text-xs text-ink-faint`,"data-pending-reading-question":A.id,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:A.draft.question}),M?(0,J.jsx)(`p`,{role:`status`,children:a?`引用的说明目前不可用,这次追问未发起。问题与原来源已保留。`:`The reading source is unavailable, so this question was not started. Its question and original source are saved.`}):ee?(0,J.jsx)(`p`,{role:`status`,children:a?`这次请求的结果尚未确认;刷新不会重新生成。`:`The result of this request is unconfirmed. Refreshing does not generate it again.`}):null,!t&&!o.creating&&!o.waiting?(0,J.jsx)(W,{className:`text-xs`,onClick:()=>{M?(p({...A.draft}),o.generation.reset()):o.retrySavedRequest(A)},children:M?a?`编辑问题与来源`:`Edit question and source`:a?`重试同一请求`:`Retry this same request`}):null]}):C&&o.creationBlocked?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`另一个阅读请求尚未结束。`:`Another reading request is still unresolved.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>N(),children:a?`查看原问题`:`View the original question`})]}):null,o.list.isError?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`保存的问答暂时读取失败。`:`Saved questions could not be loaded.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>void o.list.refetch(),children:a?`重新读取`:`Reload`})]}):null,f&&!t?(0,J.jsxs)(`section`,{className:`border-t border-line/60 pt-3`,children:[f.parentId?(0,J.jsxs)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:[a?`继续引用这份回答:`:`Following up on this answer: `,f.parentTitle||D.find(e=>e.reader_foundation?.id===f.parentId)?.reader_foundation?.question]}):null,(0,J.jsx)(ps,{draft:f,onChange:p,onSubmit:te,disabled:o.creationBlocked})]}):t?null:(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x}}),children:a?`问这版说明`:`Ask about this explanation`})]})]}):null})]})}function Ss({cardKey:e,taskId:t,card:n,task:r,originalDetail:i,selection:a,artifacts:o,onOpenArtifact:s,readOnly:c}){let{locale:l}=z(),u=l===`zh-CN`;if(r?.turn_kind===`qa`)return(0,J.jsx)(`div`,{className:`macro-reader-markdown`,"data-reader-card":e,"data-reader-task-id":t,children:(0,J.jsx)(H,{artifacts:o,onOpenArtifact:s,children:i})});let d=a?.request.key===e&&a.request.task_id===t?a:void 0,f=(n?.version??0)>=14&&_o(n?.reader_brief)?n.reader_brief:void 0;return(0,J.jsxs)(`div`,{className:`font-sans`,"data-reader-card":e,"data-reader-task-id":t,children:[(0,J.jsx)(ss,{generatedAt:n?.generated_at,pending:d?.pending,generating:d?.generating,hasExplanation:!!n,phase:d?.phase,error:d?.error,unavailable:d?.unavailable,retry:d?.retry,retryDisabled:d?.retryDisabled}),d?.foundationRequired?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:u?`先在“问题基础”里选择一份说明,再阅读本次进展的解释。`:`Choose a saved foundation to explain this progress.`}):null,f?(0,J.jsx)(cs,{brief:f,identity:e,detail:n?.detail,learningPath:n?.learning_path,foundation:n?.foundation_ref,readingUnavailable:n?.teaching_review?.reading_review?.status===`unavailable`,teachingUnavailable:n?.teaching_review?.status===`unavailable`,artifacts:o,onOpenArtifact:s}):(0,J.jsx)(`div`,{className:`macro-reader-markdown`,children:(0,J.jsx)(H,{artifacts:o,onOpenArtifact:s,children:Jo(n?.detail||i)})}),(0,J.jsx)(ls,{task:r?.id===t?r:void 0,artifacts:o,onOpenArtifact:s}),(0,J.jsx)(`div`,{className:`my-3`,children:(0,J.jsx)(vs,{card:n,cardKey:e,taskId:t,readOnly:c,context:d?.questionContext})})]})}var Cs=e=>[`research-method`,e],ws={proven:`ok`,contradicted:`warning`,partial:`caution`,untested:`muted`,unchecked:`pending`};function Ts(e){return ws[e]??`unknown`}var Es={ok:`text-ok border-ok/40 bg-ok/5`,warning:`text-warn border-warn/50 bg-warn/10 font-medium`,caution:`text-warn/80 border-warn/30`,muted:`text-ink-faint border-line/40`,pending:`text-ink-faint border-line/40 italic`,unknown:`text-ink-dim border-line/50`};function Ds(e,t){switch(e){case`proven`:return t(`已证实`,`proven`);case`contradicted`:return t(`被推翻`,`contradicted`);case`partial`:return t(`部分证实`,`partial`);case`untested`:return t(`无测试`,`untested`);case`unchecked`:return t(`未运行`,`unchecked`);default:return e||`—`}}function Os({status:e,text:t}){let n=Ts(e);return(0,J.jsx)(`span`,{className:`inline-block whitespace-nowrap rounded border px-1.5 py-0.5 text-[11px] leading-4 ${Es[n]}`,"data-method-status":e,"data-method-status-tone":n,children:Ds(e,t)})}var ks=new Set([`FAILED`,`ERROR`]);function As(e,t){if(!e.length)return{label:`—`,title:t(`没有测试带这个组件的标记`,`No test carries this component marker`),failing:0};let n=new Map;for(let t of e)n.set(t.kind||`invariant`,(n.get(t.kind||`invariant`)??0)+1);let r=[...n.entries()].map(([e,t])=>`${e} ×${t}`).join(`, `),i=e.filter(e=>ks.has((e.outcome??``).toUpperCase())).map(e=>e.id),a=t(`${e.length} 个测试`,`${e.length} ${e.length===1?`test`:`tests`}`),o=i.length?`${t(`失败`,`Failing`)}: ${i.join(` +`)}`:e.map(e=>`${e.id} — ${e.outcome??t(`未运行`,`not run`)}`).join(` +`);return{label:`${a} · ${r}`,title:o,failing:i.length}}function js({tests:e,text:t}){let n=As(e,t);return(0,J.jsx)(`span`,{className:`whitespace-nowrap text-[11px] ${n.failing?`text-warn`:`text-ink-faint`}`,title:n.title,"data-method-tests":e.length,"data-method-failing":n.failing,children:n.label})}function Ms(e){if(e==null||e===``)return null;let t=typeof e==`number`?new Date(e<0xe8d4a51000?e*1e3:e):new Date(e);return Number.isNaN(t.getTime())?null:t}var Ns=e=>e?(0,J.jsx)(H,{children:e}):(0,J.jsx)(`span`,{className:`text-ink-faint`,children:`—`});function Ps({children:e}){return(0,J.jsx)(`h3`,{className:`text-xs font-semibold text-ink`,children:e})}var Fs=`text-[11px] uppercase tracking-wide text-ink-faint`,Is=`pb-1 pr-3 font-medium`;function Ls({rows:e,text:t}){return e.length?(0,J.jsx)(`div`,{className:`mt-2 overflow-x-auto`,"data-testid":`method-components`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Fs,children:[(0,J.jsx)(`th`,{className:Is,children:t(`组件`,`Component`)}),(0,J.jsx)(`th`,{className:Is,children:t(`方法规定`,`Prescribes`)}),(0,J.jsx)(`th`,{className:Is,children:t(`备注`,`Notes`)}),(0,J.jsx)(`th`,{className:Is,children:t(`状态`,`Status`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`测试`,`Tests`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-component":e.component,children:[(0,J.jsx)(`td`,{className:`py-1 pr-3 font-medium text-ink`,children:Ns(e.component)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:Ns(e.prescribes)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:Ns(e.notes??``)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:(0,J.jsx)(Os,{status:e.status,text:t})}),(0,J.jsx)(`td`,{className:`py-1`,children:(0,J.jsx)(js,{tests:e.tests??[],text:t})})]},`${e.component}-${n}`))})]})}):null}function Rs({rows:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,"data-testid":`method-reused-code`,children:[(0,J.jsx)(Ps,{children:t(`复用代码(从 import 扫描得出)`,`Reused code (from the import scan)`)}),(0,J.jsxs)(`table`,{className:`mt-1 w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Fs,children:[(0,J.jsx)(`th`,{className:Is,children:t(`名称`,`Name`)}),(0,J.jsx)(`th`,{className:Is,children:t(`类型`,`Kind`)}),(0,J.jsx)(`th`,{className:Is,children:t(`版本 / 修订`,`Revision / version`)}),(0,J.jsx)(`th`,{className:Is,children:t(`用到的模块`,`Modules`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`引用处`,`Imported from`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-row":e.name,children:[(0,J.jsx)(`td`,{className:`py-1 pr-3 font-medium text-ink`,title:e.remote||void 0,children:e.name||`—`}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:e.kind===`third_party`?t(`第三方克隆`,`third_party clone`):t(`已安装包`,`package`)}),(0,J.jsx)(`td`,{className:`py-1 pr-3 font-mono text-[11px]`,children:e.revision_or_version||`—`}),(0,J.jsx)(`td`,{className:`py-1 pr-3 break-all font-mono text-[11px]`,children:e.modules?.length?e.modules.join(`, `):`—`}),(0,J.jsx)(`td`,{className:`py-1`,title:e.imported_from?.join(` +`)||void 0,children:t(`${e.imported_from?.length??0} 个文件`,`${e.imported_from?.length??0} ${e.imported_from?.length===1?`file`:`files`}`)})]},`${e.name}-${n}`))})]})]}):null}function zs({rows:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,"data-testid":`method-hyperparameters`,children:[(0,J.jsx)(Ps,{children:t(`超参数(从配置文件得出)`,`Hyperparameters (from the config files)`)}),(0,J.jsxs)(`table`,{className:`mt-1 w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Fs,children:[(0,J.jsx)(`th`,{className:Is,children:t(`键`,`Key`)}),(0,J.jsx)(`th`,{className:Is,children:t(`值`,`Value`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`为什么`,`Why`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-row":e.key,"data-method-changed":e.changed?`true`:void 0,children:[(0,J.jsxs)(`td`,{className:`py-1 pr-3 font-medium text-ink`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.key}),e.file?(0,J.jsx)(`span`,{className:`block text-[10px] font-normal text-ink-faint`,children:e.file}):null]}),(0,J.jsxs)(`td`,{className:`py-1 pr-3`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.value}),e.changed?(0,J.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center gap-1 whitespace-nowrap rounded border border-warn/40 px-1 text-[10px] leading-4 text-warn`,"data-testid":`method-hyperparameter-changed`,children:[t(`已改`,`changed`),e.previous!=null&&e.previous!==``?(0,J.jsx)(`span`,{className:`font-mono text-ink-faint line-through`,children:e.previous}):null]}):null]}),(0,J.jsx)(`td`,{className:`py-1`,children:e.why?Ns(e.why):(0,J.jsx)(`span`,{className:`text-ink-faint`,title:t(`值旁没有 # why: 注释`,`No # why: comment next to the value`),children:`—`})})]},`${e.file}:${e.key}-${n}`))})]})]}):null}function Bs({entries:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3`,"data-testid":`method-change-log`,children:[(0,J.jsx)(Ps,{children:t(`变更记录(来自 git)`,`Change log (from git)`)}),(0,J.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs text-ink-dim`,children:e.map((e,t)=>(0,J.jsxs)(`li`,{className:`flex gap-2`,title:e.files?.join(` +`)||void 0,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-ink-faint`,children:e.when}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.summary})]},`${e.when}-${t}`))})]}):null}function Vs({checks:e,locale:t,text:n}){if(!e)return null;let r=Object.entries(e.counts??{}).filter(([,e])=>e>0).map(([e,t])=>`${e} ${t}`).join(`, `),i=e.exit_code==null?n(`未结束`,`no exit code`):n(`退出码 ${e.exit_code}`,`exit ${e.exit_code}`),a=Ms(e.ran_at);return(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,"data-testid":`method-checks`,title:a?a.toLocaleString(t):void 0,children:[n(`最近一次检查:第 ${e.round_index} 轮 · ${i}`,`Latest checks: round ${e.round_index} · ${i}`),r?` · ${r}`:``,a?` · ${wt(a,t)}`:``]})}function Hs({sid:e,active:t,compact:n=!1,onOpenArtifact:r}){let{locale:i}=z(),a=i===`zh-CN`,o=(e,t)=>a?e:t,[s,c]=(0,G.useState)(!n),l=t&&!!e,u=A({queryKey:Cs(e),queryFn:({signal:t})=>R.researchMethod(e,t),enabled:l,refetchInterval:l?3e4:!1,staleTime:2e4,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}).data;if(!u||!u.exists)return null;let d=Ms(u.updated_at),f=u.components??[],p=u.unlisted_components??[];return(0,J.jsxs)(`section`,{className:`mx-4 flex min-h-0 flex-col overflow-hidden rounded-lg border border-line/70 bg-panel ${n?`my-2 px-3 py-2`:`my-3 px-4 py-3`}`,"aria-label":o(`方法卡`,`Method card`),"data-testid":`method-card`,"data-project-id":e,"data-compact":n,children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 text-left`,"aria-expanded":s,onClick:()=>c(e=>!e),children:[(0,J.jsx)(Qt,{size:16,className:`shrink-0 text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-ink`,children:o(`方法卡`,`Method card`)}),u.title?(0,J.jsx)(`span`,{className:`truncate text-xs text-ink-dim`,children:u.title}):null,(0,J.jsx)(Ue,{size:12,className:`shrink-0 text-ink-faint ${s?`rotate-180`:``}`})]}),(0,J.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,title:d?d.toLocaleString(i):void 0,children:[r?(0,J.jsx)(`button`,{type:`button`,className:`underline-offset-2 hover:underline`,onClick:()=>r(u.path),children:u.path}):u.path,d?(0,J.jsxs)(J.Fragment,{children:[` · `,o(`更新于`,`updated`),` `,wt(d,i)]}):null]})]}),s?(0,J.jsxs)(`div`,{className:`mt-2 min-h-0 overflow-y-auto overscroll-contain scroll-thin ${n?`max-h-[30vh]`:`max-h-[40vh]`}`,"data-testid":`method-card-body`,tabIndex:0,"aria-label":o(`方法说明`,`Method text`),children:[u.statement?(0,J.jsx)(`p`,{className:`text-[13px] leading-6 text-ink-dim`,"data-testid":`method-statement`,children:u.statement}):null,(0,J.jsx)(Ls,{rows:f,text:o}),f.length===0?(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o(`文档里没有组件表;下面是全文。`,`The document has no component table; the full text follows.`)}):null,p.length?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,"data-testid":`method-unlisted-components`,children:[o(`测试里标记了但卡片未列出的组件:`,`Components marked in tests but not named in the card: `),p.join(`, `)]}):null,(0,J.jsx)(Rs,{rows:u.reused_code??[],text:o}),(0,J.jsx)(zs,{rows:u.hyperparameters??[],text:o}),(0,J.jsx)(Bs,{entries:u.change_log??[],text:o}),(0,J.jsx)(Vs,{checks:u.checks,locale:i,text:o}),(0,J.jsx)(`div`,{className:`mt-3 border-t border-line/40 pt-2 text-[13px] leading-6 text-ink-dim`,"data-testid":`method-card-markdown`,children:(0,J.jsx)(H,{sid:e,onOpenArtifact:r,children:u.markdown})}),u.truncated?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,"data-testid":`method-card-truncated`,children:o(`只显示了前 64 KiB。`,`Showing only the first 64 KiB.`)}):null]}):null]})}function Us({selection:e,onOpenArtifact:t,readOnly:n}){let{locale:r}=z(),i=r===`zh-CN`,a=Go({...e,active:!0,readOnly:n}),o=e.view.mission.id,s=a.task||{id:o,title:e.view.mission.title,objective:e.view.mission.objective,status:e.view.mission.status},c=(a.brief?a.card?.title:void 0)||s.title;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lt,{title:i?`读懂这一步`:`Understand this step`,sub:c}),(0,J.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`research-brief-reading`,"data-project-id":e.sid,"data-task-id":o,children:[(0,J.jsx)(Ss,{cardKey:o,taskId:o,task:a.task,card:a.card,readOnly:n,onOpenArtifact:t,originalDetail:s.objective||e.snapshot.session.objective||``,selection:{request:ho(s,a.evidence),questionContext:a.questionContext,pending:a.needsUpdate,generating:a.generating,phase:a.generationPhase,error:a.generationError,foundationRequired:a.foundationRequired,retry:n?void 0:a.retry,retryDisabled:a.generating,unavailable:!a.foundationRequired&&(a.legacy||a.generationUnavailable||!a.loading&&!a.generationAvailable)}}),a.readError?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:i?`记录暂时读取失败;已显示内容仍保留。`:`Records could not be refreshed; previously loaded content is retained.`}):null]})]})}function Ws(e){let{locale:t}=z(),n=t===`zh-CN`,r=(e,t)=>n?e:t,i=e.compact===!0,[a,o]=(0,G.useState)(null),s=a?.sid===e.sid?a:null,c=(0,G.useRef)(null);(0,G.useEffect)(()=>{c.current&&(c.current.scrollTop=0)},[e.sid,e.view.mission.id]),(0,G.useEffect)(()=>o(null),[e.sid]);let l=Go({...e,allowGeneration:!1,locale:n?`zh-CN`:`en-US`}),{task:u,evidence:d,brief:f,card:p}=l,m=(f?p?.title:void 0)||u?.title||e.view.mission.title||r(`当前任务`,`Current task`),h=u?.objective||e.view.mission.objective||e.snapshot.session.objective,g=Tt({ts:p?.generated_at})?.toLocaleString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,_=!l.foundationRequired&&(l.legacy||l.generationUnavailable||!l.loading&&!l.generationAvailable),v=!!l.readError||!!l.generationError||_,y=(0,J.jsx)(ss,{generatedAt:p?.generated_at,pending:l.needsUpdate,generating:l.generating,phase:l.generationPhase,hasExplanation:!!f}),b=e=>(e||``).trim(),x=(l.readError?r(`任务记录暂时无法更新。`,`Task records could not be refreshed.`):l.generationError?r(`说明生成失败。`,`The explanation could not be prepared.`):_?r(`说明暂不可用。`,`Explanations are temporarily unavailable.`):``)||(l.loading?r(`正在读取任务记录。`,`Loading task records.`):l.generating?r(`正在根据任务记录整理说明。`,`Preparing an explanation from the task records.`):l.foundationRequired?r(`先在“问题基础”选择说明。`,`Choose a saved foundation for this explanation.`):r(`尚未生成说明。`,`No explanation has been saved yet.`)),S=!!l.readError||!l.generationAvailable||l.legacy||!u,C=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-ink-faint`,role:v?`status`:void 0,children:[(0,J.jsx)(`span`,{children:x}),v&&S&&e.active&&(!e.readOnly||l.readError)?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:l.generating||l.loading,onClick:()=>void l.retry(),children:[(0,J.jsx)(Ke,{size:12}),r(`重试`,`Retry`)]}):null]}),w=(0,J.jsxs)(J.Fragment,{children:[f?(0,J.jsx)(cs,{brief:f,identity:u?.id||e.view.mission.id,detail:p?.detail,learningPath:p?.learning_path,foundation:p?.foundation_ref,onOpenArtifact:e.onOpenArtifact,readingUnavailable:l.readingUnavailable,teachingUnavailable:l.teachingUnavailable}):(0,J.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,children:[b(h)===b(m)?null:(0,J.jsx)(os,{value:h||r(`任务目标尚未记录。`,`The task objective has not been recorded yet.`),expandLabel:r(`完整任务目标`,`Full task objective`)}),C]}),l.generating&&f?(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[r(`正在依据新记录更新;上方暂时保留之前的说明。`,`Updating from new records; the previous explanation remains visible above.`),g?` ${g}`:``]}):null,(0,J.jsx)(ls,{task:u,onOpenArtifact:e.onOpenArtifact}),f&&v?C:null]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Hs,{sid:e.sid,active:e.active,compact:i,onOpenArtifact:e.onOpenArtifact}),(0,J.jsxs)(`section`,{className:`mx-4 flex min-h-0 flex-col overflow-hidden rounded-lg border border-line/70 bg-panel ${i?`my-2 px-3 py-2`:`my-3 max-h-[50vh] px-4 py-3`}`,"aria-label":r(`读懂这一步`,`Understand this step`),"data-testid":`research-brief`,"data-project-id":e.sid,"data-task-id":e.view.mission.id,"data-compact":i,children:[i?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(K,{size:16,className:`shrink-0 text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-ink`,children:r(`读懂这一步`,`Understand this step`)})]}),y]}),(0,J.jsxs)(`div`,{ref:c,className:`min-h-0 overflow-y-auto overscroll-contain scroll-thin`,"data-testid":`research-brief-body`,tabIndex:0,"aria-label":r(`任务说明`,`Task explanation`),children:[(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-faint`,children:(0,J.jsx)(H,{children:m||e.view.mission.title})}),w]})]}),(0,J.jsxs)(`footer`,{className:i?`shrink-0`:`mt-2 shrink-0 border-t border-line/50 pt-2`,"data-testid":`research-brief-footer`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>o({sid:e.sid,snapshot:e.snapshot,view:e.view,locale:n?`zh-CN`:`en-US`,preview:ae(),foundationId:l.foundationId}),children:[(0,J.jsx)(K,{size:12}),r(`阅读说明`,`Read explanation`)]}),(0,J.jsx)(vs,{card:p,cardKey:e.view.mission.id,taskId:e.view.mission.id,readOnly:e.readOnly,context:l.questionContext}),e.onAsk&&u&&!e.readOnly?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>e.onAsk?.(bo(e.sid,u,d,n)),children:[(0,J.jsx)(sn,{size:12}),r(`引用任务`,`Reference task`)]}):null]}),i&&l.generating?(0,J.jsx)(`div`,{className:`mt-2`,children:y}):null]})]}),(0,J.jsx)(dt,{open:!!s,onClose:()=>o(null),label:r(`任务说明`,`Task explanation`),children:s?(0,J.jsx)(Us,{selection:s,onOpenArtifact:e.onOpenArtifact,readOnly:e.readOnly}):null})]})}var Gs=new Set([`done`,`success`,`completed`]),Ks=new Set([`research_incomplete`,`paused_no_breakthrough`,`exhausted_current_methods`]),qs=new Set([`no_progress`,`max_rounds`]),Js=new Set([`blocked`,`infra_blocked`]),Ys=new Set([`error`,`failed`,`supervisor_error`]),Xs={completed:{glyph:`🎉`,tone:`ok`,missionStatus:`complete`},incomplete:{glyph:`◌`,tone:`warn`,missionStatus:`incomplete`},stalled:{glyph:`⏸`,tone:`warn`,missionStatus:`stalled`},blocked:{glyph:`⛔`,tone:`err`,missionStatus:`blocked`},failed:{glyph:`💥`,tone:`err`,missionStatus:`failed`},ended:{glyph:`■`,tone:`info`,missionStatus:`ended`}},Zs={completed:`mission_completed`,incomplete:`mission_incomplete`,stalled:`mission_stalled`,blocked:`mission_blocked`,failed:`mission_failed`,ended:`mission_ended`},Qs={mission_completed:`The task was completed.`,mission_continued:`The task was completed and the project continues with the next one.`,mission_certified:`The final submission was checked and approved.`,mission_incomplete:`The task stopped with work still remaining.`,mission_stalled:`The task stopped because recent rounds made no useful progress.`,mission_blocked:`The task cannot continue until something outside it is resolved.`,mission_failed:`The task could not be completed.`,mission_paused:`The task was paused before it finished because {why}; its progress is saved and it can be resumed.`,mission_ended:`The task ended without a recorded outcome.`},$s={budget_exhausted:`the project reached its budget limit`,provider_cooldown:`the model service asked Argus to wait before calling again`,provider_fence:`the model provider is not accepting calls right now`,daemon_shutdown:`Argus was stopped`,operator_pause:`the operator paused the work`,operator_abort:`the operator cancelled the task`,backend_unavailable:`the model service was unavailable`,transient_error:`a temporary error interrupted the call`,permanent_error:`an error that will not clear on its own stopped the call`},ec={paused_budget:`budget_exhausted`,paused_provider_cooldown:`provider_cooldown`,paused_provider_fence:`provider_fence`,paused_daemon_shutdown:`daemon_shutdown`,paused_operator:`operator_pause`};function tc(e){return String(e??``).trim().toLowerCase()}function nc(e,t){if(e===`paused_external_work`)return`work outside Argus had to finish first`;let n=ec[e];return n?$s[n]:$s[t]?$s[t]:e.startsWith(`paused_`)?`the work was paused`:`the work was interrupted`}function rc(e){let t=tc(e);switch(t){case`completed`:case`incomplete`:case`stalled`:case`blocked`:case`failed`:case`ended`:return t;default:return null}}function ic(e){let t=tc(e.status);return e.success===!0||Gs.has(t)?`completed`:Ks.has(t)?`incomplete`:qs.has(t)?`stalled`:Js.has(t)?`blocked`:Ys.has(t)?`failed`:`ended`}function ac(e){let t=e.outcome;if(t&&typeof t==`object`&&!Array.isArray(t)){let n=t;return{execution_status:tc(n.execution_status)||ic(e),review_status:tc(n.review_status)||`not_assessed`,stage_certification:tc(n.stage_certification)||`not_assessed`,interruption_kind:tc(n.interruption_kind)||`none`,resumable:n.resumable===!0}}return{execution_status:ic(e),review_status:`not_assessed`,stage_certification:`not_assessed`,interruption_kind:tc(e.stop_kind)||`none`,resumable:e.resumable===!0}}function oc(e){if(e.success===!0&&e.campaign_continues===!0)return{outcomeClass:`completed`,kind:`mission_continued`,label:Qs.mission_continued,glyph:`↻`,tone:`info`,missionStatus:`continued`,technical:``};let t=rc(e.outcome_class)??ic(e),n=tc(e.status),r=Xs[t],i=Zs[t],a=Qs[i],o=``;if(t===`completed`&&e.final_submission_certified===!0)i=`mission_certified`,a=Qs.mission_certified;else if(t===`ended`&&(o=String(e.status??``).trim(),n.startsWith(`paused_`)||e.resumable===!0)){let t=e.outcome&&typeof e.outcome==`object`&&!Array.isArray(e.outcome)?e.outcome:{},r=tc(e.stop_kind)||tc(t.interruption_kind);i=`mission_paused`,a=Qs.mission_paused.replace(`{why}`,nc(n,r))}return{outcomeClass:t,kind:i,label:a,glyph:r.glyph,tone:r.tone,missionStatus:r.missionStatus,technical:o}}function sc(e,t){let n=typeof e==`string`?e.trim():``;return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function cc(e,t){let n=t===`zh-CN`,r=sc(e.route,40),i=sc(e.workflow_mode,40),a=sc(e.execution_task,160),o;o=r===`self`?n?`计划由 Manager 直接处理`:`Manager plans to handle this request`:i===`staged`?r===`team`?n?`计划由团队分阶段推进`:`The team plans to work in stages`:n?`计划分阶段推进`:`The plan is to work in stages`:i===`direct`?r===`team`?n?`计划由团队直接处理`:`The team plans to handle this task directly`:n?`计划直接处理这项工作`:`The plan is to handle this task directly`:n?`处理方案已确定`:`A plan is ready`,a&&(o+=`${n?`:`:`: `}${a}`);let s=``;e.lifetime===`standing`&&e.open_ended!==!1||!e.lifetime&&e.open_ended===!0?s=n?`持续跟进后续工作。`:`Keep following up on subsequent work.`:e.lifetime===`bounded_increment`?s=n?`本次只推进一个明确的增量。`:`Limit this run to one defined increment.`:e.lifetime===`bounded`&&(s=e.continuous===!0&&e.open_ended===!1?n?`完成这次目标后结束。`:`Finish once this objective is met.`:n?`范围限于本次目标。`:`Keep the work within this objective.`);let c=sc(e.reason,320),l=c&&!/^(?:\[manager\]|manager routed\b|\{)/i.test(c)&&c!==(sc(e.execution_task,320)||sc(e.objective,320))?c:``;return[o,[s,l].filter(Boolean).join(n?``:` `)].filter(Boolean).join(` +`)}function lc(e){let t=e;return t=t.replace(/^(\s*(?:authorization|proxy-authorization)\s*:).*$/gim,`$1 `),t=t.replace(/^(\s*(?:x-api-key|api-key|cookie|set-cookie)\s*:).*$/gim,`$1 `),t=t.replace(/gh[pousr]_[A-Za-z0-9]{20,}/g,``).replace(/xox[baprs]-[A-Za-z0-9-]{10,}/g,``).replace(/AKIA[0-9A-Z]{16}/g,``).replace(/\bbearer\s+[A-Za-z0-9._\-+/=]{16,}/gi,``).replace(/(?`).replace(/(?`).replace(/\b([a-z][a-z0-9+.\-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi,`$1@`),{text:e,sensitive:t!==e}}function uc(e){return lc(pe(e))}function Y(e,t){let n=String(e??``).replace(/```[a-z]*\n?/gi,``).replace(/\[([^\]]+)\]\([^)]+\)/g,`[$1]`).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}var dc=e=>e,X=(e,t)=>String(dc(e)[t]??``);function fc(e,t){return`${e} ${t}${e===1?``:`s`}`}function Z(e,t,n){return e.locale===`zh-CN`?n:t}function pc(e,t){let n=X(e,`error_code`),r=X(e,`failure_stage`),i=X(e,`stop_kind`),a=[`daemon_shutdown`,`operator_pause`,`operator_abort`].includes(i);if(n===`cancelled`&&r===`commit`&&X(e,`status`)===`issued`)return{text:Z(t,`Applying the adjustment was interrupted; the saved decision is waiting to be applied.`,`应用调整时被中断,已保存的决定等待继续处理。`),tone:`warn`};if(n===`timeout`&&r===`commit`)return{text:Z(t,`Manager reached a decision, but applying the adjustment timed out.`,`Manager 已作出判断,但应用调整超时。`),tone:`warn`};let o={trial_quota_exceeded:[`The remaining trial quota cannot cover this Manager check.`,`剩余试用额度不足以启动这次 Manager 检查。`],observation_incomplete:[`Manager could not fully read the required project evidence; this check has stopped.`,`Manager 未能完整读取所需的项目资料,这次检查已停止。`],timeout:[`The model did not respond before the Manager check timed out.`,`模型未在时限内返回,Manager 这次检查已结束。`],cancelled:[`This Manager check was cancelled.`,`已取消这次 Manager 检查。`],superseded:[`New input or evidence superseded this Manager check.`,`新的操作或证据已取代这次 Manager 检查。`]};if(Object.hasOwn(o,n)&&!(n===`cancelled`&&a))return{text:Z(t,...o[n]),tone:n===`cancelled`||n===`superseded`?`dim`:`warn`};let s={budget_exhausted:[`The project budget limit prevented this Manager check.`,`项目预算已达上限,Manager 暂未完成检查。`],provider_cooldown:[`The model service asked Manager to wait before calling again.`,`模型服务要求稍后再调用,Manager 暂未完成检查。`],provider_fence:[`The model service is not accepting calls; Manager could not finish this check.`,`模型服务当前不接受调用,Manager 未完成这次检查。`],backend_unavailable:[`The model service was unavailable for this Manager check.`,`模型服务不可用,Manager 未完成这次检查。`],transient_error:[`A temporary model service error interrupted this Manager check.`,`模型服务的临时错误中断了这次 Manager 检查。`],permanent_error:[`The model call failed; Manager could not finish this check.`,`模型调用失败,Manager 未完成这次检查。`],daemon_shutdown:[`Argus stopped, ending this Manager check.`,`Argus 已停止,这次 Manager 检查已结束。`],operator_pause:[`This Manager check was paused by your request.`,`已按你的要求暂停这次 Manager 检查。`],operator_abort:[`This Manager check was cancelled by your request.`,`已按你的要求取消这次 Manager 检查。`]};if(Object.hasOwn(s,i))return{text:Z(t,...s[i]),tone:a?`dim`:`warn`};let c=X(e,`status`);return c===`cancelled`||c===`superseded`?{text:Z(t,`This Manager check was cancelled.`,`这次 Manager 检查已取消。`),tone:`dim`}:{text:r===`commit`&&[`continue`,`wait`,`steer`].includes(X(e,`action`))?Z(t,`Manager reached a decision, but the team adjustment could not be applied.`,`Manager 已作出判断,但团队调整未能生效。`):r===`decision`?Z(t,`Manager returned a decision that could not be validated.`,`Manager 返回的判断或引用依据未通过核验。`):Z(t,`Manager could not finish this check.`,`Manager 未能完成这次检查。`),tone:`warn`}}function Q(e,t,n,r,i,a={}){let o=uc(r);return{visibility:a.visibility??(i===`err`||i===`warn`?`alert`:`normal`),role:e,labelKey:t,glyph:n,tone:i,segments:o.text?[{kind:`text`,text:o.text}]:[],expandable:a.expandable===!0,sensitive:o.sensitive||a.sensitive===!0,fallback:a.fallback===!0,rule:a.rule===!0,reasoning:a.reasoning===!0}}function mc(){return{visibility:`hidden`,role:`system`,labelKey:`event.hidden`,glyph:``,tone:`dim`,segments:[],expandable:!1,sensitive:!1,fallback:!1,rule:!1,reasoning:!1}}function hc(e,t){if(dc(e).operator_alert===!0){let n=Y(X(e,`text`)||X(e,`reason`)||e.type,170);return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,n,`err`,{rule:!0})}if(t.unknownEventPolicy===`hide`)return mc();let n=String(e.type||`?`),r=X(e,`text`).trim();return Q(`system`,`event.fallback`,`•`,`[${n}]${r?` ${r}`:``}`,`dim`,{fallback:!0})}function gc(e,t=`engineer`){return X(e,`agent_layer`)||(e.type.startsWith(`life.manager.`)?`manager`:e.type.startsWith(`life.planner.`)?`planner`:e.type.startsWith(`round.review.`)?`reviewer`:t)}function _c(e,t){let n=X(e,`phase`),r=X(e,`cause`)||X(e,`backend_error`),i=X(e,`error`);if(!n||!r)return`${Z(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} ${Y(i,t.density===`full`?160:140)}`;let a={backend:[`model service`,`模型服务`],parse:[`reading the answer`,`读取回答`],contract:[`answer shape:`,`回答格式:`],timeout:[`timed out`,`超时`]},o=a[n]?Z(t,a[n][0],a[n][1]):n,s=Number(dc(e).attempts||0),c=s>1?Z(t,` (attempt ${s})`,` (第${s}次尝试)`):``,l=`${Z(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} · ${o} ${r}${c}`;return i?`${l} · ${Z(t,`error text`,`原始错误`)}: ${i}`:l}function vc(e){let t=dc(e).round_index??dc(e).round;return typeof t==`string`||typeof t==`number`?t:`?`}function yc(e,t){let n=X(e,`kind`),r=gc(e),i=`role.${r}`;if(n===`reasoning`){if(!t.showReasoning)return mc();let n=Y(X(e,`text`),280);return n?Q(r,i,`∴`,n,`dim`,{expandable:t.density===`full`,reasoning:!0}):mc()}if(n===`assistant_message`||n===`agent_message`||n===`message`){if(re(dc(e)))return hc(e,t);let n=uc(X(e,`text`));return n.text?Q(r,i,`▌`,n.text,`bright`,{expandable:t.density===`full`,sensitive:n.sensitive}):mc()}if(n===`command_execution`){let n=X(e,`text`)||X(e,`command`)||X(e,`action_summary`),a=X(e,`status`)===`failed`?`err`:`dim`;return n?Q(r,i,`▸ $`,n,a,{expandable:t.density===`full`}):mc()}if(n===`tool_use`||n===`file_change`){let a=X(e,`text`)||X(e,`action_summary`);if(!a&&t.density===`full`)return mc();let o=n===`file_change`?Z(t,`(file change)`,`(文件变更)`):Z(t,`(tool)`,`(工具)`);return Q(r,i,n===`file_change`?`✎`:`⚙`,a||o,X(e,`status`)===`failed`?`err`:`dim`,{expandable:t.density===`full`})}if(t.density===`full`)return mc();let a=String(dc(e).text??dc(e).action_summary??``).split(` +`)[0]?.trim()??``;return a?Q(r,i,`▸`,Y(a,160),`dim`):mc()}function bc(e,t){let n=ie(dc(e).canonical_type??e.type);if(n&&n!==e.type)return bc({...e,type:n},t);switch(e.type){case`advisor.consultation.requested`:case`life.manager.supervision.issued`:return mc();case`advisor.consultation.completed`:{let t=X(e,`question`).trim(),n=X(e,`summary`).trim();return!t&&!n?mc():Q(`advisor`,`role.advisor`,`◇`,[t,n].filter(Boolean).join(` +`),`info`,{expandable:!0})}case`advisor.consultation.cancelled`:{let n=Y(X(e,`question`),160);return Q(`advisor`,`role.advisor`,`◇`,`${Z(t,`Consultation cancelled`,`已取消咨询`)}${n?` · ${n}`:``}`,`dim`)}case`advisor.consultation.failed`:case`advisor.consultation.timed_out`:case`advisor.consultation.model_mismatch`:{let n=e.type.endsWith(`model_mismatch`)?Z(t,`The provider returned a different model`,`接入返回的模型与所选模型不一致`):e.type.endsWith(`timed_out`)?Z(t,`The advisor did not respond in time`,`顾问未在时限内返回`):Z(t,`The consultation did not finish`,`顾问咨询未完成`),r=Y(X(e,`question`),160);return Q(`advisor`,`role.advisor`,`◇`,`${n}${r?` · ${r}`:``}`,`warn`,{expandable:!0})}case`life.manager.supervision.applied`:return Q(`manager`,`role.manager`,`🧭`,X(e,`summary`)||X(e,`reason`),`info`,{expandable:!0,rule:!0});case`life.peer.message.processed`:return Q(`manager`,`role.peer`,`↔`,X(e,`text`),`info`,{expandable:!0});case`life.manager.supervision.failed`:{let n=pc(e,t);return Q(`manager`,`role.manager`,`🧭`,n.text,n.tone,{expandable:!0})}case`engineer.progress`:return yc(e,t);case`life.manager.intent.started`:return Q(`manager`,`role.manager`,`🧭`,Z(t,`Working out how to handle your request…`,`正在安排处理方式…`),`info`);case`life.manager.intent.completed`:return Q(`manager`,`role.manager`,`🧭`,cc(dc(e),t.locale),`info`,{expandable:!0});case`life.manager.intent.failed`:return Q(`manager`,`role.manager`,`⚠`,_c(e,t),`err`,{expandable:t.density===`full`});case`life.manager.stage_decision`:{let n=X(e,`target_stage`)||X(e,`stage`)||X(e,`current_stage`);return Q(`manager`,`role.manager`,`🧭`,`${X(e,`action`)}${n?` → ${n}`:``} ${Y(X(e,`reason`),t.density===`full`?140:120)}`,`info`)}case`life.research.second_reading`:{let n=gc(e,`manager`),r=Y(X(e,`supported`),160),i=Z(t,`reread the evidence and reworked the plan`,`重读了证据并重排了计划`);return Q(n,`role.${n}`,`📖`,r?`${i} · ${r}`:i,`info`)}case`life.letter.written`:{let n=gc(e,`manager`);return Q(n,`role.${n}`,`✉`,Z(t,`wrote you a letter`,`给你写了一封信`),`accent`)}case`life.planner.start`:return Q(`planner`,`role.planner`,`📋`,`${Z(t,`planning`,`正在规划`)} ${Y(X(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.verdict`:return X(e,`status`)===`done`||dc(e).project_done===!0?Q(`planner`,`role.planner`,`🏁`,Z(t,`the project is finished`,`项目已完成`),`ok`):Q(`planner`,`role.planner`,`📋`,Z(t,`lined up ${X(e,`queued`)||X(e,`n`)||`next`} task(s) to do next`,`已排好 ${X(e,`queued`)||X(e,`n`)||`下一`} 个接下来要做的任务`),`accent`);case`life.planner.task_added`:return Q(`planner`,`role.planner`,`+`,`${Z(t,`added a task`,`新增任务`)} · ${Y(X(e,`title`)||X(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.task_skipped`:return Q(`planner`,`role.planner`,`⏭`,`${X(e,`skip_category`)===`paper_review_purchase_deferred`?Z(t,`put off another paper review`,`推迟了再买一次评审`):Z(t,`skipped a task already planned`,`跳过了已在计划中的任务`)} ${Y(X(e,`title`),t.density===`full`?140:120)}`,`dim`);case`life.planner.preview_skipped`:return Q(`planner`,`role.planner`,`⏭`,Z(t,`skipped the plan preview: the research Planner owns the campaign plan`,`跳过了计划预览:研究规划师负责整个计划`),`dim`);case`life.planner.normalized`:return Q(`planner`,`role.planner`,`≋`,`${Z(t,`tidied the plan`,`整理了计划`)} · ${Y(X(e,`diagnostic`),180)}`,`dim`);case`life.planner.waiting`:return Q(`planner`,`role.planner`,`⌛`,`${Z(t,`waiting`,`等待中`)} · ${Y(X(e,`reason`),180)}`,`info`);case`life.planner.waiting_woken`:return Q(`planner`,`role.planner`,`↻`,`${Z(t,`resumed`,`已唤醒`)} · ${Y(X(e,`wake_reason`),180)}`,`info`);case`life.planner.terminal_idle`:return Q(`planner`,`role.planner`,`Ⅱ`,`${Z(t,`nothing left to plan`,`暂时没有要规划的`)} · ${Y(X(e,`reason`),180)}`,`dim`);case`life.planner.verification_probe`:return t.showReasoning?Q(`planner`,`role.planner`,`⌕`,`${Z(t,`checking that the plan still holds`,`检查计划是否仍然成立`)} · ${Y(X(e,`reason`),180)}`,`dim`):mc();case`life.planner.error`:return Q(`planner`,`role.planner`,`⚠`,`${Z(t,`the Planner hit an error`,`规划者出错`)} ${Y(X(e,`error`)||X(e,`text`),t.density===`full`?160:140)}`,`err`);case`life.mission.started`:return Q(`engineer`,`role.engineer`,`🚀`,Y(X(e,`title`)||X(e,`objective`)||X(e,`text`)||Z(t,`started work on this task`,`开始做这项任务`),t.density===`full`?180:160),`info`,{rule:!0});case`round.start`:return Q(`engineer`,`role.engineer`,`──`,Z(t,`round ${vc(e)}`,`第 ${vc(e)} 轮`),`dim`,{rule:!0});case`life.phase.started`:{let n=X(e,`label`)||X(e,`phase`),r=gc(e);return n?Q(r,`role.${r}`,`🔄`,Z(t,`entering ${n}`,`进入 ${n}`),`info`):mc()}case`round.review.started`:return Q(`reviewer`,`role.reviewer`,`🔄`,Z(t,`the Reviewer checks round ${vc(e)}`,`审阅者检查第 ${vc(e)} 轮`),`info`);case`round.review.deferred`:return Q(`engineer`,`role.engineer`,`↪`,Z(t,`carries on into the next round without a review · ${Y(X(e,`next_step`),t.density===`full`?180:160)}`,`不经审阅直接进入下一轮 · ${Y(X(e,`next_step`),t.density===`full`?180:160)}`),`info`);case`round.main.completed`:return Q(`engineer`,`role.engineer`,`✅`,Z(t,`finished round ${vc(e)} of work`,`第 ${vc(e)} 轮工作已完成`),`info`);case`round.review.completed`:{if(e.review_skipped===!0)return Q(`reviewer`,`role.reviewer`,`↪`,`${Z(t,`no review this round`,`这一轮没有审阅`)} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,`info`);let n=X(e,`status`),r=n===`done`?Y(X(e,`residual_risk`),200):``;if(r)return Q(`reviewer`,`role.reviewer`,`⚠`,`${Z(t,`verified with residual risk`,`已验证,但有残余风险`)}: ${r} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,`warn`);let i=n===`done`?`ok`:n===`blocked`||n===`no_progress`?`err`:`warn`;return Q(`reviewer`,`role.reviewer`,n===`done`?`✅`:n===`blocked`||n===`no_progress`?`⛔`:`↻`,`${Tc(n,t)} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,i)}case`life.mission.completed`:{let n=oc(dc(e)),r=Y(X(e,`summary`),240),i=Y(X(e,`residual_risk`),200);return i&&n.tone===`ok`?Q(`engineer`,`role.engineer`,`⚠`,`${Z(t,`completed with residual risk`,`已完成,但有残余风险`)} · ${r.includes(i)?r:`${i}${r?` · ${r}`:``}`}`,`warn`,{rule:!0}):Q(`engineer`,`role.engineer`,n.glyph,r?`${n.label} · ${r}`:n.label,n.tone,{rule:!0})}case`life.mission.failed`:return Q(`engineer`,`role.engineer`,`❌`,`${Z(t,`this task failed`,`这项任务失败了`)} ${Y(X(e,`reason`)||X(e,`error`),t.density===`full`?160:140)}`,`err`,{rule:!0});case`loop.start`:return Q(`engineer`,`role.engineer`,`▶`,Y(X(e,`text`)||X(e,`objective`),t.density===`full`?16e3:160),`info`,{expandable:t.density===`full`});case`loop.done`:return Q(`engineer`,`role.engineer`,`🏁`,`${Z(t,`the run finished`,`这次运行结束`)} ${Y(X(e,`text`),t.density===`full`?140:120)}`,`dim`);case`life.inbox.queued`:return Q(`system`,`role.operator`,`📥`,`${Z(t,`you added guidance`,`你追加了指导`)} · ${Y(X(e,`text`),t.density===`full`?180:160)}`,`accent`);case`daemon.parked`:{let n=X(e,`replaced_by`),r=Z(t,`Argus set this project aside with its state saved`,`Argus 已把这个项目搁置,状态已保存`);return Q(`system`,`role.system`,`Ⅱ`,n?`${r} · ${Z(t,`continued as ${n}`,`由 ${n} 接续`)}`:r,`warn`,{rule:!0})}case`accounting.journal_repaired`:{let n=dc(e).damaged_lines,r=dc(e).liabilities,i=Array.isArray(n)?n.length:0,a=Array.isArray(r)?r.length:0,o=Y(X(e,`damaged_copy`),120),s=`the usage journal was repaired: ${i} damaged line(s) set aside${o?` in ${o}`:``}, ${a} call(s) written back as a liability`,c=`用量账本已修复:${i} 行损坏记录已另存${o?`到 ${o}`:``},${a} 次调用按负债记回`;return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Z(t,s,c),`warn`,{rule:!0})}case`provider.request.denied`:{let n=X(e,`provider`);return Q(`system`,`event.quota`,`⏸`,`${Z(t,`a request to ${n||`the model service`} was held back`,`发往${n||`模型服务`}的一次请求被暂缓`)} · ${Y(X(e,`reason`),160)}`,`warn`,{rule:!0})}case`round.reviewer_backend_failure`:{let n=Y(X(e,`text`),150),r=t.density===`full`?Z(t,`the Reviewer's model service is unreachable — waiting rather than going on unchecked`,`审阅者的模型服务连不上 — 先等待,不在无人审阅的情况下继续`):Z(t,`the Reviewer's model service is unreachable — waiting`,`审阅者的模型服务连不上 — 先等待`);return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${r} · ${n}`,`err`,{rule:!0})}case`round.stall`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||Z(t,t.density===`full`?`no progress this round — keeping a close eye on it`:`no progress this round`,`这一轮没有进展`),170),`warn`);case`round.escalated`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||Z(t,`many rounds without a finish — raising what is blocking the work`,`轮次已经很多还没做完 — 把外部阻碍提出来`),170),`warn`);case`life.planner.stall_escalation`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${Z(t,`the Planner is stuck`,`规划者卡住了`)} — ${Y(X(e,`reason`)||X(e,`text`),150)}`,`warn`);case`life.budget.pause`:return X(e,`stop_kind`)===`cost_unreconciled`||X(e,`reason`).startsWith(`unresolved provider cost`)?Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Q(`system`,`event.watch`,`⏸`,Z(t,`budget cap reached — paused · ${Y(X(e,`text`)||X(e,`reason`),140)}`,`已达到预算上限 — 已暂停 · ${Y(X(e,`text`)||X(e,`reason`),140)}`),`warn`);case`budget.reservation.denied`:return X(e,`reason`).startsWith(`unresolved provider cost`)?Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Q(`system`,`event.budget`,`$`,`${Z(t,`budget denied`,`预算申请被拒绝`)} — ${Y(X(e,`reason`)||X(e,`text`),t.density===`full`?160:150)}`,`err`,{rule:!0});case`budget.unpriced.blocked`:return Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`);case`budget.unpriced.acknowledged`:return Q(`system`,`event.budget`,`$`,Z(t,`Single-call cost risk approved; original usage remains pending`,`已批准单笔费用风险;原始费用仍待对账`),`warn`);case`life.lifecycle.block`:return Q(`system`,`event.watch`,`⛔`,`${Z(t,`blocked — needs you`,`卡住了 — 需要你来处理`)} · ${Y(X(e,`text`)||X(e,`reason`),150)}`,`err`,{rule:!0});case`life.daemon.idle_timeout`:return Q(`system`,`event.watch`,`🟦`,Y(X(e,`text`)||Z(t,`nothing to do for a while — standing by`,`一段时间没有事做 — 待命中`),150),`dim`);case`operator_alert`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||X(e,`reason`)||e.type,170),`err`,{rule:!0});case`life.supervisor.error`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`Argus hit an internal error while coordinating the work`,`Argus 在统筹工作时遇到内部错误`)} · ${Y(X(e,`error`),160)}`,`err`,{rule:!0});case`life.auth_failure`:return Q(`system`,`role.system`,`🔑`,Z(t,`the model service rejected the sign-in — refresh the credentials and Argus will carry on`,`模型服务拒绝了登录 — 更新凭据后 Argus 会继续`),`err`,{rule:!0});case`life.planner.deferred`:return Q(`planner`,`role.planner`,`⌛`,`${Z(t,`planning is on hold`,`规划暂缓`)} · ${Y(X(e,`reason`),180)}`,`dim`);case`life.post_mission.stop`:return Q(`system`,`role.system`,`■`,`${Z(t,`stopped after this task`,`这项任务之后停下`)} · ${Y(X(e,`reason`),180)}`,`info`);case`life.planner.final_submission_skipped`:return Q(`planner`,`role.planner`,`⏭`,`${Z(t,`dropped an outdated final-submission task`,`跳过了一项过时的最终提交任务`)} · ${Y(X(e,`title`),140)}`,`dim`);case`life.execution_host.blocked`:return Q(`system`,`event.watch`,`⛔`,Y(X(e,`reason`)||Z(t,`the program that runs code for Argus could not be started`,`为 Argus 运行代码的程序无法启动`),t.density===`full`?260:180),`err`,{rule:!0});case`life.mission.provider_configuration_disabled`:{let n=Number(dc(e).streak||0),r=Z(t,`the model configuration failed ${fc(n,`time`)} in a row — this task is paused until you decide`,`模型配置连续 ${n} 次失败 — 这项任务已暂停,等待你的决定`),i=Y(X(e,`text`),160);return Q(`system`,`event.watch`,`⛔`,i?`${r} · ${i}`:r,`err`,{rule:!0})}case`life.iteration.continued`:return Q(`critic`,`role.critic`,`🔁`,Z(t,`lined up the next iteration`,`排好了下一轮迭代`),`dim`);case`life.learned_vertical.promoted`:return Q(`manager`,`role.manager`,`★`,Z(t,`made the learned domain "${X(e,`vertical`)}" official`,`把新学到的领域「${X(e,`vertical`)}」正式收录`),`accent`);case`life.learned_vertical.promotion_failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not record "${X(e,`vertical`)}" as a formal domain`,`未能把「${X(e,`vertical`)}」收录为正式领域`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.review.waived`:return Q(`planner`,`role.planner`,`↪`,`${Z(t,`this task will skip the independent review`,`这项任务将不做独立审阅`)} · ${Y(X(e,`reason`),160)}`,`dim`);case`life.manager.feedback.exhausted`:{let n=Number(dc(e).attempts||0);return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`the Manager's objection went unanswered ${fc(n,`time`)} — planning pauses for a while`,`管理者的异议 ${n} 次未被回应 — 规划暂停一段时间`)} · ${Y(X(e,`reason`),140)}`,`warn`)}case`life.manager.feedback.persisted`:{let n=X(e,`stage`);return Q(`manager`,`role.manager`,`↩`,`${n?Z(t,`sent the plan back for another pass at ${n}`,`把计划退回 ${n} 阶段再改一轮`):Z(t,`sent the plan back for another pass`,`把计划退回再改一轮`)} · ${Y(X(e,`reason`),160)}`,`info`)}case`life.manager.goal_contract.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not save the agreed goal`,`未能保存商定的目标`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.manager.intent.superseded`:return Q(`manager`,`role.manager`,`↷`,Z(t,`a newer instruction replaced this request`,`更新的指令取代了这个请求`),`info`);case`life.manager.project_report.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not deliver the project report`,`未能送出项目报告`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.planner.completion_circuit_opened`:{let n=Number(dc(e).consecutive_rejections||0);return Q(`planner`,`role.planner`,`⏸`,Z(t,`the same completion requirement turned the plan back ${fc(n,`time`)} — pausing completion attempts until something changes`,`同一项完成要求已 ${n} 次打回计划 — 暂停完成尝试,直到情况变化`),`warn`)}case`life.planner.completion_rejected`:return Q(`manager`,`role.manager`,`↩`,`${Z(t,`the Manager did not accept the completion claim`,`管理者未接受完成的说法`)} · ${Y(X(e,`reason`),160)}`,`info`);case`life.planner.continuation_required`:return Q(`planner`,`role.planner`,`↻`,Z(t,`finished one increment; the standing objective continues`,`完成了一个增量;长期目标继续推进`),`dim`);case`life.planner.superseded`:return Q(`planner`,`role.planner`,`↷`,Z(t,`dropped an outdated planning pass after a newer instruction`,`收到更新的指令,放弃了过时的规划`),`dim`);case`life.planner.wait_overridden`:return Q(`planner`,`role.planner`,`+`,`${Z(t,`scheduled independent work instead of waiting`,`不再干等,安排了独立的工作`)} · ${Y(X(e,`task_title`),140)}`,`info`);case`life.daemon.degraded`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`Argus started, but the objective did not reach the Manager`,`Argus 已启动,但目标没有交到管理者手上`)} · ${Y(X(e,`error`),140)}`,`warn`);case`round.orphan_process_group`:return Q(`engineer`,`role.engineer`,`⚠`,dc(e).cleanup_succeeded===!0?Z(t,`background processes outlived the turn and were cleaned up`,`有后台进程在这一轮结束后仍在运行,已清理`):Z(t,`background processes outlived the turn and could not be cleaned up`,`有后台进程在这一轮结束后仍在运行,未能清理`),`warn`);case`round.model_configuration_error`:return Q(`engineer`,`role.engineer`,`⛔`,`${Z(t,`the model configuration is not usable`,`模型配置无法使用`)} · ${Y(X(e,`text`)||X(e,`error`),160)}`,`err`,{rule:!0});case`round.watchdog.retry`:{let n=Number(dc(e).attempt||0),r=Number(dc(e).max_attempts||0);return Q(`engineer`,`role.engineer`,`↻`,Z(t,`the model call failed — retrying in a fresh session (attempt ${n} of ${r})`,`模型调用失败 — 在新会话中重试(第 ${n} 次,共 ${r} 次)`),`warn`)}case`round.watchdog.retry_exhausted`:{let n=Number(dc(e).attempt||0),r=Y(X(e,`fatal_error`),140),i=Z(t,`the model call kept failing — giving up after ${fc(n,`attempt`)}`,`模型调用持续失败 — ${n} 次后放弃`);return Q(`engineer`,`role.engineer`,`⛔`,r?`${i} · ${r}`:i,`err`,{rule:!0})}case`round.backend_failure.backoff`:{let n=Math.round(Number(dc(e).seconds||0));return Q(`engineer`,`role.engineer`,`⏳`,Y(X(e,`text`)||Z(t,`the model service failed — waiting ${n}s before trying again`,`模型服务出错 — 等待 ${n} 秒后再试`),200),`warn`)}case`round.backend_failure.hold_interrupted`:return Q(`engineer`,`role.engineer`,`↪`,Y(X(e,`text`)||Z(t,`the wait after a model-service failure ended early`,`模型服务出错后的等待提前结束`),180),`info`);case`round.provider_turn_cap.restart`:return Q(`engineer`,`role.engineer`,`↻`,Z(t,`reached the per-call turn allowance — continuing the same task in a fresh session`,`达到单次调用的轮次上限 — 在新会话中继续同一任务`),`info`);case`round.provider_turn_cap.reviewer_restart`:return Q(`reviewer`,`role.reviewer`,`↻`,Z(t,`the review reached its turn allowance — restarting it in a fresh session`,`审阅达到轮次上限 — 在新会话中重新开始`),`info`);case`round.reviewer_backend_failure.backoff`:{let n=Math.round(Number(dc(e).seconds||0));return Q(`reviewer`,`role.reviewer`,`⏳`,Y(X(e,`text`),200)||Z(t,`the Reviewer's model service is unavailable — retrying in ${n}s`,`审阅者的模型服务不可用 — ${n} 秒后重试`),`warn`)}case`round.external_work_wait.started`:return Q(`engineer`,`role.engineer`,`⌛`,`${Z(t,`waiting for background work to report`,`等待后台工作汇报`)} · ${Y(X(e,`work_id`),80)}`,`dim`);case`round.external_work_wait.completed`:return Q(`engineer`,`role.engineer`,`↻`,Z(t,`background work reported — resuming`,`后台工作已汇报 — 继续`),`dim`);case`round.external_work_review.required`:return Q(`reviewer`,`role.reviewer`,`⌛`,`${Z(t,`background work finished — an independent review of its result is required before resuming`,`后台工作已结束 — 恢复前需要对其结果做一次独立审阅`)} · ${Y(X(e,`work_id`),80)}`,`dim`);case`round.external_work_review.completed`:return Q(`reviewer`,`role.reviewer`,`✓`,`${Z(t,`background work result reviewed`,`后台工作结果已审阅`)} · ${Y(X(e,`review_status`),40)}`,`dim`);case`plan.draft.failed`:return Q(`planner`,`role.planner`,`⚠`,`${Z(t,`could not draft the plan`,`未能起草计划`)} · ${Y(X(e,`reason`),140)}`,`err`);case`plan.draft.done`:{let n=Number(dc(e).steps||0);return Q(`planner`,`role.planner`,`📋`,Z(t,`drafted a plan with ${fc(n,`step`)}`,`起草了一份 ${n} 步的计划`),`dim`)}case`team.learning.review.started`:return Q(`manager`,`role.manager`,`📚`,Z(t,`reviewing what this task taught the team`,`整理这项任务给团队带来的经验`),`dim`);case`team.learning.review.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`the team learning review failed`,`团队经验整理失败`)} · ${Y(X(e,`error`),140)}`,`warn`);case`team.learning.review.completed`:{let n=Number(dc(e).created||0),r=Number(dc(e).updated||0);return Q(`manager`,`role.manager`,`📚`,Z(t,`kept ${n} new and ${r} updated team procedures`,`保留了 ${n} 条新的、${r} 条更新的团队做法`),`dim`)}case`team.learning.promotion.quarantined`:return Q(`manager`,`role.manager`,`⚠`,Z(t,`set aside a new procedure that would have judged its own work`,`搁置了一条会评判自己工作的新做法`),`warn`);case`self.learning.review.failed`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`the review of Argus's own conversation habits failed`,`对 Argus 自身对话习惯的复盘失败`)} · ${Y(X(e,`error`),140)}`,`warn`);case`domain.promotion`:return Q(`manager`,`role.manager`,`★`,Y(X(e,`text`),180),`dim`);case`idea.portfolio.formed`:{let n=dc(e).selection,r=n&&typeof n==`object`?String(n.route_id??``):``,i=Number(dc(e).route_count||0),a=Y(X(e,`text`),180),o=i>0?Z(t,`formed an idea portfolio of ${fc(i,`route`)}`,`组成了 ${i} 条思路的组合`):Z(t,`formed an idea portfolio`,`组成了思路组合`);return Q(`engineer`,`role.engineer`,`💡`,r?Z(t,`chose route ${r} from the idea portfolio`,`从思路组合中选定了路线 ${r}`):a||o,`accent`)}case`user.note`:{let n=Array.isArray(dc(e).tags)?dc(e).tags.map(String):[];if(n.includes(`config`))return mc();if(n.includes(`planner`))return Q(`planner`,`role.planner`,`📝`,Z(t,`updated the research plan`,`更新了研究计划`),`dim`);let r=Y(X(e,`summary`)||X(e,`text`)||X(e,`title`),180);return Q(`system`,`role.operator`,`📝`,`${Z(t,`you added a note`,`你添加了一条笔记`)}${r?` · ${r}`:``}`,`accent`)}case`ui.operator`:{let t=X(e,`text`);return t.trim()?Q(`system`,`role.operator`,`›`,t,`accent`,{rule:!0}):mc()}case`ui.argus`:{let n=X(e,`text`),r=dc(e).live===!0||Array.isArray(dc(e).steps)&&dc(e).steps.length>0;return n.trim()||r?Q(`manager`,`role.argus`,`▌`,n,`bright`,{expandable:t.density===`full`,rule:!0}):mc()}case`agent.io.start`:case`agent.io.stream`:case`agent.io.complete`:case`agent.io.error`:case`usage.recorded`:case`provider.request.started`:case`provider.request.completed`:case`codex.util.completed`:case`skill.cost.completed`:case`budget.reservation.created`:case`budget.reservation.settled`:case`budget.reservation.released`:case`round.checkpoint.recorded`:case`round.checkpoint.failed`:case`round.secret_redacted`:case`role.session.turn`:case`engineer.skill_maintenance.completed`:case`life.status`:case`life.mission.skipped`:case`life.mission.orphaned`:case`life.mission.requeued`:case`life.manager.plan_challenge.decided`:case`life.vertical.resolved`:case`life.manager.backend_resolved`:case`life.planner.backend_resolved`:case`life.planner.dependency_dropped`:case`life.planner.parallel_dropped`:case`life.engineer.backend_resolved`:case`life.reviewer.backend_resolved`:case`life.curator.backend_resolved`:case`life.runtime_failure.circuit_opened`:case`life.runtime_failure.circuit_blocked`:case`life.runtime_failure.canary_passed`:case`life.runtime.incident.detected`:case`life.runtime.incident.recovered`:case`life.runtime.incident.escalated`:case`life.plan.revision.proposed`:case`life.plan.revision.rejected`:case`life.plan.revision.committed`:case`life.plan.node.superseded`:case`life.lifecycle.transition`:case`life.inbox.drained`:case`life.operator_question.pending`:case`life.operator_question.answered`:case`project.completed`:case`project.completion_refused`:case`daemon.command.submitted`:case`daemon.command.completed`:case`daemon.command.rejected`:case`idea.search.started`:case`idea.search.completed`:case`idea.search.skipped`:case`venue.research.started`:case`venue.research.completed`:case`research.achievement.certified`:case`skill.library.available`:case`skill.created`:case`skill.updated`:case`skill.archived`:case`skill.tidied`:case`skill.history.compressed`:case`skill.evolution.completed`:case`wiki.initialized`:case`wiki.hook.warning`:case`wiki.created`:case`wiki.updated`:case`wiki.retired`:case`wiki.promotion.promoted`:case`wiki.promotion.demoted`:case`wiki.retired.compressed`:case`wiki.evolution.completed`:case`knowledge.learned`:case`knowledge.recalled`:case`life.planner.verdict.discarded`:case`life.manager.feedback.unresolved`:case`life.manager.project_report`:case`life.plan.revision.rolled_back`:case`life.planner.completion_circuit.notify_failed`:case`life.planner.completion_circuit_holding`:case`life.planner.external_poll_suppressed`:case`life.planner.waiting_contract.normalized`:case`life.daemon.ready`:case`plan.draft.start`:case`team.learning.review.skipped`:case`self.learning.review.started`:case`self.learning.review.completed`:case`manager.live_view.updated`:case`manager.live_view.rejected`:case`idea.portfolio.nested_skipped`:case`manager.turn.started`:case`manager.turn.cancelled`:case`life.config.parse_failed`:return hc(e,t);default:return hc(e,t)}}function xc(e){return e.segments.map(e=>e.text).join(``)}var Sc={"role.manager":[`Manager`,`Manager`],"role.planner":[`Planner`,`Planner`],"role.engineer":[`Engineer`,`Engineer`],"role.reviewer":[`Reviewer`,`Reviewer`],"role.advisor":[`Advisor`,`顾问`],"role.peer":[`Project exchange`,`项目交流`],"role.critic":[`Critic`,`Critic`],"role.system":[`Argus`,`Argus`],"role.argus":[`Argus`,`Argus`],"role.operator":[`You`,`你`],"event.notice":[`Notice`,`通知`],"event.watch":[`Watch`,`监控`],"event.budget":[`Budget`,`预算`],"event.quota":[`Quota`,`额度`],"event.fallback":[`Argus`,`Argus`],"event.hidden":[``,``]};function Cc(e,t){let n=Sc[e];if(n)return t===`zh-CN`?n[1]:n[0];let r=e.startsWith(`role.`)?e.slice(5):e;return r?`${r.slice(0,1).toUpperCase()}${r.slice(1)}`:``}function wc(e,t){let n=bc(e,t);if(n.visibility===`hidden`)return null;let r=xc(n);return!r&&!(e.type===`ui.argus`&&(e.live===!0||Array.isArray(e.steps)&&e.steps.length>0))?null:{role:n.role,labelKey:n.labelKey,label:Cc(n.labelKey,t.locale),glyph:n.glyph,text:r,tone:n.tone,rule:n.rule,reasoning:n.reasoning,expand:n.expandable,sensitive:n.sensitive}}function Tc(e,t){let n={done:[`the Reviewer was satisfied`,`审阅者认可了这一轮`],blocked:[`the Reviewer found the work stuck`,`审阅者认为工作卡住了`],no_progress:[`the Reviewer saw no progress`,`审阅者没有看到进展`]};if(!e)return Z(t,`the Reviewer gave no verdict`,`审阅者没有给出结论`);let r=n[e]??[`the Reviewer asked for another pass`,`审阅者要求再改一轮`];return Z(t,r[0],r[1])}function Ec(e,t){return t===`zh-CN`?e[0]:e[1]}function Dc(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``)}var Oc={grounding_started:[`正在阅读这项请求,弄清楚它要做什么`,`Reading the request to understand what it asks`],goal_framed:[`已经理解这项请求,项目目标已经确定。`,`The request is understood and the project goal is set.`],goal_not_understood:[`这项请求还没有被理解清楚。`,`The request could not be understood yet.`],request_not_routed:[`这项请求没能被安排下去。`,`The request could not be routed to the team.`],stage_advanced:[`研究进入了下一阶段。`,`The research moved to the next stage.`],stage_entered:[`研究进入「{stage}」阶段。`,`The research moved to the {stage} stage.`],stage_held:[`当前阶段暂不推进。`,`The current stage is on hold.`],stage_rolled_back:[`研究退回到了前一阶段。`,`The research went back a stage.`],stage_completed:[`当前阶段已完成。`,`The current stage is complete.`],stage_reconsidered:[`阶段安排已重新考虑。`,`The stage plan was reconsidered.`],stage_reviewed:[`阶段已复核。`,`The stage was reviewed.`],planning_started:[`正在规划下一步工作`,`Planning the next step`],task_added:[`计划中加入了一项新任务。`,`A new task was added to the plan.`],research_route_added:[`计划中加入了一条新的研究路线。`,`A new research route was added to the plan.`],planning_complete:[`下一步的计划已经排好。`,`The next step is planned.`],project_finished:[`项目已经完成。`,`The project is finished.`],task_delivered:[`成果已交付。`,`The result was delivered.`],planner_waiting:[`规划者在等待前一步完成。`,`The Planner is waiting for the previous step.`],planner_idle:[`暂时没有需要规划的工作。`,`Nothing to plan right now.`],planning_failed:[`这次规划没有成功。`,`Planning did not succeed this time.`],mission_started:[`开始处理这项任务`,`Work on the task started`],awaiting_engineer:[`等待工程师完成这一轮。`,`Waiting for the Engineer to finish the round.`],waiting_external:[`等待外部工作完成。`,`Waiting on work outside Argus.`],mission_completed:[`任务已完成。`,`The task is complete.`],mission_continued:[`任务将继续进行。`,`The task continues.`],mission_certified:[`成果已通过独立核对。`,`The result passed an independent check.`],mission_incomplete:[`任务没有完成。`,`The task was not completed.`],mission_stalled:[`任务停滞不前。`,`The task stalled.`],mission_blocked:[`任务被挡住了。`,`The task is blocked.`],mission_failed:[`任务没能完成。`,`The task could not be completed.`],mission_paused:[`任务在完成前暂停;进度已保存,可以继续。`,`The task was paused before it finished; its progress is saved and it can be resumed.`],mission_ended:[`任务已结束。`,`The task ended.`],mission_ready:[`可以开始新任务。`,`Ready for a new task.`],round_in_progress:[`这一轮正在进行。`,`The round is in progress.`],round_running:[`第 {n} 轮正在进行。`,`Round {n} is in progress.`],round_started:[`第 {n} 轮工作开始。`,`Round {n} started.`],progress_tool:[`正在使用工具`,`Using a tool`],progress_command:[`正在运行命令`,`Running a command`],progress_message:[`正在汇报进展`,`Reporting progress`],progress_file:[`正在更新项目文件`,`Updating project files`],progress_inspecting:[`正在查看项目状态`,`Looking at the project state`],engineer_round_finished:[`工程师完成了这一轮,结果已准备好供核对。`,`The Engineer finished the round; the result is ready to be checked.`],checking_started:[`正在阅读工程师的结果并核对证据`,`Reading the Engineer's result and checking the evidence`],continuing_before_check:[`先继续下一轮,核对稍后进行。`,`Continuing to the next round; the check comes later.`],check_postponed:[`这一轮的核对推迟了。`,`The check of this round was postponed.`],round_not_judged:[`这一轮没有人审阅。`,`No one reviewed this round.`],results_accepted:[`结果通过了核对。`,`The result passed the check.`],another_attempt_requested:[`审阅者要求再试一次。`,`The reviewer asked for another attempt.`],attempt_blocked:[`这次尝试被挡住了。`,`This attempt is blocked.`],replan_requested:[`审阅者要求重新规划。`,`The reviewer asked for a new plan.`],results_not_final:[`结果还不是最终的。`,`The result is not final yet.`],handed_off:[`已交给下一位。`,`Handed off to the next role.`],waiting:[`等待中`,`Waiting`],live_activity:[`正在工作`,`Working`],role_failed:[`{role} 执行失败`,`{role} failed`],capability_unlocked:[`解锁了一项新能力。`,`A new capability was unlocked.`],capability_upgraded:[`一项能力得到了升级。`,`A capability was upgraded.`],capability_promoted:[`一项能力被提升为来源。`,`A capability was promoted to a source.`],knowledge_captured:[`记下了一条新知识。`,`New knowledge was captured.`],knowledge_refined:[`一条知识得到了完善。`,`A piece of knowledge was refined.`],knowledge_promoted:[`一条知识被提升。`,`A piece of knowledge was promoted.`],knowledge_demoted:[`一条知识被降级。`,`A piece of knowledge was demoted.`],knowledge_retired:[`一条知识已退役。`,`A piece of knowledge was retired.`],"event.model_call.started":[`开始调用模型`,`Model call started`],"event.model_call.completed":[`模型调用完成`,`Model call completed`],"event.model_call.failed":[`模型调用失败`,`Model call failed`],"event.usage.recorded":[`已记录用量`,`Usage recorded`],"event.budget.reserved":[`已预留预算`,`Budget reserved`],"event.budget.settled":[`预算已结算`,`Budget settled`],"event.model_turn":[`与模型完成一次往返`,`One exchange with the model`],"event.instruction.received":[`收到你的指令`,`Your instruction was received`],"event.instruction.done":[`指令已执行`,`Instruction carried out`],"event.inbox.processed":[`已处理收件箱`,`Inbox processed`],"event.round.started":[`新的一轮开始`,`A new round started`],"event.round.finished":[`执行者完成了这一轮`,`The Engineer finished the round`],"event.review.finished":[`这一轮的审阅结束`,`Review of the round finished`],"event.retry.waiting":[`等待后重试`,`Waiting before retrying`],"event.retry.interrupted":[`等待被打断`,`The wait was interrupted`],"event.status":[`状态更新`,`Status update`],"event.planning.started":[`开始规划`,`Planning started`],"event.planning.failed":[`规划没有完成`,`Planning did not complete`],"event.planning.tidied":[`计划已整理`,`Plan tidied`],"event.planning.decided":[`规划结论`,`Planning decision`],"event.task.started":[`开始执行任务`,`Task execution started`],"event.task.ended":[`任务执行结束`,`Task execution ended`],"event.skills.ready":[`技能库已就绪`,`Skill library ready`],"event.routes.formed":[`已形成候选路线组合`,`Candidate route portfolio formed`],"event.lessons.skipped":[`本次没有总结经验`,`No lessons recorded this time`],"event.argus.reply":[`Argus 的回复`,`Reply from Argus`]},kc={daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],paused_daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],operator_pause:[`你暂停了它`,`you paused it`],paused_operator:[`你暂停了它`,`you paused it`],operator_abort:[`你停止了它`,`you stopped it`],budget_exhausted:[`预算用完了`,`the budget ran out`],budget_pause:[`预算用完了`,`the budget ran out`],paused_budget:[`预算用完了`,`the budget ran out`],provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],paused_provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],provider_fence:[`模型服务不可用`,`the model service is unavailable`],paused_provider_fence:[`模型服务不可用`,`the model service is unavailable`],backend_unavailable:[`模型服务不可用`,`the model service is unavailable`],transient_error:[`出现了暂时性的问题`,`a temporary problem came up`],permanent_error:[`遇到了无法自动恢复的错误`,`an error could not be recovered from`],operator_input_required:[`需要你的回复`,`your reply is needed`],planner_empty_plan:[`需要一份新的计划`,`a new plan is needed`]},Ac={pending:[`待开始`,`Waiting`],queued:[`待开始`,`Waiting`],not_started:[`待开始`,`Not started`],waiting:[`等待中`,`Waiting`],idle:[`空闲`,`Idle`],running:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],active:[`进行中`,`In progress`],working:[`进行中`,`In progress`],framed:[`已明确目标`,`Objective settled`],grounding:[`了解项目中`,`Getting oriented`],planned:[`已规划`,`Planned`],done:[`已完成`,`Done`],complete:[`已完成`,`Done`],completed:[`已完成`,`Done`],success:[`已完成`,`Done`],accepted:[`已完成`,`Done`],failed:[`失败`,`Failed`],error:[`出错`,`Failed`],blocked:[`受阻`,`Blocked`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],skipped:[`已跳过`,`Skipped`],ended:[`已结束`,`Ended`],incomplete:[`未完成`,`Not finished`],stalled:[`停滞`,`Stalled`],paused:[`已暂停`,`Paused`],stopped:[`已停止`,`Stopped`],cancelled:[`已停止`,`Stopped`],aborted:[`已停止`,`Stopped`],paused_external_work:[`等待外部工作完成`,`Waiting for external work`],superseded:[`已由新方案替代`,`Replaced by a newer plan`]},jc={engineer_service_dropped:[`模型服务在工程师得出可核对的结果之前中断了会话,因此没有可以审阅的内容。Argus 会换一个新会话重试。`,`The model service dropped the session before the Engineer produced a checkable result, so there was nothing to review. Argus will retry in a fresh session.`],reviewer_unreachable:[`审阅者的会话在得出结论前就结束了,Argus 会再试一次。`,`The reviewer's session ended before it reached a conclusion; Argus will try again.`],argus_stopped:[`Argus 被停止了,任务随之暂停。`,`Argus was stopped, so the task paused.`],task_cancelled:[`这项任务被取消了。`,`The task was cancelled.`],session_length_limit:[`这一轮达到了单次会话的长度上限;已做的工作保留,会在新的会话里继续。`,`The round reached the length limit of one session; the work so far is kept and continues in a fresh session.`],tools_unavailable:[`执行环境里缺少需要的工具。`,`The tools the work needs are not available in the execution environment.`],model_unavailable:[`模型服务暂时不可用。`,`The model service is unavailable for now.`],sign_in_failed:[`模型服务的登录没有成功。`,`Signing in to the model service did not succeed.`],paused:[`任务被暂停了。`,`The task was paused.`],unknown:[`原因暂时不明。`,`The reason is not known yet.`],retry_wait_cut_short:[`在等待重试时 Argus 被要求停止。`,`Argus was asked to stop while waiting to retry.`]},Mc={idea:[`选题`,`Idea`],scope:[`研究定义`,`Scope`],research:[`文献与假设`,`Literature and hypotheses`],literature:[`文献与假设`,`Literature and hypotheses`],implementation:[`方法实现`,`Implementation`],implement:[`方法实现`,`Implementation`],experiment:[`实验验证`,`Experiments`],experiments:[`实验验证`,`Experiments`],analysis:[`结果分析`,`Analysis`],writing:[`论文写作`,`Writing`],review:[`最终审核`,`Final review`],delivery:[`成果交付`,`Delivery`],optimize:[`优化`,`Optimization`],solve:[`推导与验证`,`Derivation and verification`],hold:[`已暂停`,`Paused`],paused:[`已暂停`,`Paused`]},Nc={"provider.request.started":`event.model_call.started`,"provider.request.completed":`event.model_call.completed`,"provider.request.failed":`event.model_call.failed`,"agent.io.start":`event.model_call.started`,"agent.io.complete":`event.model_call.completed`,"usage.recorded":`event.usage.recorded`,"budget.reservation.created":`event.budget.reserved`,"budget.reservation.settled":`event.budget.settled`,"role.session.turn":`event.model_turn`,"daemon.command.submitted":`event.instruction.received`,"daemon.command.completed":`event.instruction.done`,"life.inbox.drained":`event.inbox.processed`,"round.start":`event.round.started`,"round.main.completed":`event.round.finished`,"round.review.completed":`event.review.finished`,"round.backend_failure.backoff":`event.retry.waiting`,"round.backend_failure.hold_interrupted":`event.retry.interrupted`,"life.status":`event.status`,"life.planner.start":`event.planning.started`,"life.planner.error":`event.planning.failed`,"life.planner.normalized":`event.planning.tidied`,"life.planner.verdict":`event.planning.decided`,"loop.start":`event.task.started`,"loop.done":`event.task.ended`,"skill.library.available":`event.skills.ready`,"idea.portfolio.formed":`event.routes.formed`,"team.learning.review.skipped":`event.lessons.skipped`,"ui.argus":`event.argus.reply`};function Pc(e,t){let n=String(e??``).trim(),r=Mc[n.toLowerCase()];return r?Ec(r,t):n}function Fc(e,t){let n=String(e??``).trim().toLowerCase(),r=kc[n];return r?Ec(r,t):n}function Ic(e,t){let n=String(e??``).trim().toLowerCase(),r=kc[n];return r?t===`zh-CN`?`因为${r[0]},工作停了下来。`:`The work stopped because ${r[1]}.`:n}function Lc(e,t,n){if(!t)return e;let r=Fc(t,n);return n===`zh-CN`?`${e.replace(/。$/,``)}(${r})。`:`${e.replace(/\.$/,``)} — ${r}.`}function Rc(e,t,n){return t?n===`zh-CN`?`已完成 ${e} / ${t}`:`${e} of ${t} done`:Ec([`尚未规划`,`Not planned yet`],n)}var zc=[[/^Reporting progress$/i,`progress_message`],[/^(?:Running a command|running project command)$/i,`progress_command`],[/^Using a tool$/i,`progress_tool`],[/^inspecting project state$/i,`progress_inspecting`],[/^Working$/i,`live_activity`]],Bc=[...zc,[/^(?:Review not performed|No review this round)$/i,`round_not_judged`],[/^Goal framed$/i,`goal_framed`],[/^(?:Grounding project|Project grounding started)$/i,`grounding_started`],[/^Manager routing failed$/i,`request_not_routed`],[/^Stage reviewed$/i,`stage_reviewed`],[/^(?:Planning next work|Planning started)$/i,`planning_started`],[/^Planning complete$/i,`planning_complete`],[/^Planner waiting$/i,`planner_waiting`],[/^Project reviewed$/i,`project_finished`],[/^Research branch added$/i,`research_route_added`],[/^Task added$/i,`task_added`],[/^(?:Engineer handoff ready|Work ready for review)$/i,`engineer_round_finished`],[/^(?:Review started|Reviewing benchmark evidence)$/i,`checking_started`],[/^(?:Continuing before review|Continued before review)$/i,`continuing_before_check`],[/^Review deferred for one round$/i,`check_postponed`],[/^Waiting for the Engineer to finish$/i,`awaiting_engineer`],[/^Waiting on external work$/i,`waiting_external`],[/^(?:Evidence accepted|Accepted evidence)$/i,`results_accepted`],[/^(?:Attempt rejected|Requested another attempt)$/i,`another_attempt_requested`],[/^Handed off$/i,`handed_off`],[/^(?:Mission started|Starting mission)$/i,`mission_started`],[/^(?:Task completed|Mission complete)$/i,`mission_completed`],[/^Task failed$/i,`mission_failed`],[/^Awaiting Planner$/i,`planner_waiting`],[/^Ready for a new mission$/i,`mission_ready`],[/^Waiting$/i,`waiting`],[/^Capability unlocked$/i,`capability_unlocked`],[/^Capability upgraded$/i,`capability_upgraded`],[/^Capability promoted to source$/i,`capability_promoted`],[/^Knowledge captured$/i,`knowledge_captured`],[/^Knowledge refined$/i,`knowledge_refined`],[/^Knowledge promoted$/i,`knowledge_promoted`],[/^Knowledge demoted$/i,`knowledge_demoted`],[/^Knowledge retired$/i,`knowledge_retired`],[/^(?:request · started|io · start)$/i,`event.model_call.started`],[/^(?:request · completed|io · complete)$/i,`event.model_call.completed`],[/^usage · recorded$/i,`event.usage.recorded`],[/^reservation · created$/i,`event.budget.reserved`],[/^reservation · settled$/i,`event.budget.settled`],[/^Round (\d+) started$/i,(e,t)=>Dc(Ec(Oc.round_started,t),{n:e[1]})],[/^Running round (\d+)$/i,(e,t)=>Dc(Ec(Oc.round_running,t),{n:e[1]})],[/^Stage (?:·|→) (.+)$/i,(e,t)=>Dc(Ec(Oc.stage_entered,t),{stage:Pc(e[1],t)})],[/^Mission (ended|incomplete|stalled|blocked|failed)(?: · (\S+))?$/i,(e,t)=>Lc(Ec(Oc[`mission_${e[1].toLowerCase()}`],t),e[2],t)],[/^(Manager|Planner|Engineer|Reviewer) failed$/i,(e,t)=>Dc(Ec(Oc.role_failed,t),{role:e[1]})],[/^(\d+) \/ (\d+) complete$/i,(e,t)=>Rc(Number(e[1]),Number(e[2]),t)],[/^Not planned$/i,(e,t)=>Rc(0,0,t)]];function Vc(e){return e===`zh-CN`?`zh`:`en`}function Hc(e,t,n){let r=String(e??``).trim(),i=typeof n==`string`?{kind:n}:n??{};if(!i.kind||i.kind===`live_activity`){for(let[e,n]of zc)if(e.test(r))return Ec(Oc[n],t)}let a=i.kind?Oc[i.kind]:void 0;if(i.kind){let e=!!i.language&&i.language!==Vc(t);if(a&&(e||!r)&&!a[0].includes(`{`))return Ec(a,t);if(r&&!e)return r}for(let[e,n]of Bc){let i=r.match(e);if(i)return typeof n==`string`?Ec(Oc[n],t):n(i,t)}if(a){let e=Ec(a,t);if(!e.includes(`{`))return e;let n=r.match(/\d+/)?.[0];return n&&e.includes(`{n}`)?Dc(e,{n}):r}let o=Ac[r.toLowerCase()];return o?Ec(o,t):r}function Uc(e,t){let n=jc[String(e??``).trim().toLowerCase()];return n?Ec(n,t):``}function Wc(e,t){let n=String(e??``).trim().toLowerCase(),r=Ac[n];return r?Ec(r,t):n}function Gc(e,t){let n=Nc[String(e??``).trim()];return n?Ec(Oc[n],t):null}function Kc(e){return/^(?:provider\.|agent\.io\.|usage\.|budget\.|role\.session\.turn$)/.test(String(e??``))}var qc=[[/^Next action:\s*/i,[`下一步:`,`Next: `]],[/^(?:原因:|Reason:)\s*/i,[`原因:`,`Reason: `]],[/^The backend has failed the same way (\d+) times in a row \(([^)]*)\)\. Waiting ([\d.]+)s before the next attempt[^\n]*/i,(e,t)=>({text:t===`zh-CN`?`模型服务已连续 ${e[1]} 次以同样的方式失败;为了不让持续的故障白白花钱,${e[3]} 秒后再试。`:`The model service has failed the same way ${e[1]} times in a row; waiting ${e[3]} seconds before trying again so a standing failure does not keep costing money.`,technical:e[2]})],[/^review: \w+(?: \([^)]*\))? — /i,[``,``]],[/^status=(\S+) rounds=(\d+) reason=/i,(e,t)=>{let n=kc[e[1].toLowerCase()],r=n?Ec(n,t):Wc(e[1],t);return t===`zh-CN`?`任务已结束(${r}),共 ${e[2]} 轮。`:`Task ended — ${r}, after ${e[2]} rounds.`}],[/^engineer round (\d+) \((?:fresh session|new session)\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮,在新的会话里开始。`:`Round ${e[1]}, started in a fresh session.`],[/^engineer round (\d+) \([^)]*\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮开始。`:`Round ${e[1]} started.`],[/^backend failure; retrying in a fresh \w+ session after ([\d.]+)s\.?$/i,(e,t)=>t===`zh-CN`?`模型服务调用失败,${e[1]} 秒后在新的会话里重试。`:`The model service call failed; retrying in a fresh session after ${e[1]} seconds.`],[/^planner error: (.*; retry later)\.?$/i,(e,t)=>({text:t===`zh-CN`?`规划这一步没有完成,稍后会重试。`:`Planning did not complete; it will be retried later.`,technical:e[1]})],[/^mission failed\.?$/i,[`任务失败了。`,`The task failed.`]],[/^Engineer backend failed before a trustworthy completed turn; reviewer skipped\.?/i,[`这一轮模型服务没有完成调用,所以没有人审阅。`,`The model service did not complete this round, so no one reviewed it.`]],[/^Reviewer backend unavailable for (\d+) consecutive attempt\(s\); failing loud rather than settling the round without a real review\.?/i,(e,t)=>t===`zh-CN`?`审阅者的模型服务连续 ${e[1]} 次没有响应,这一轮因此没有得到审阅。`:`The reviewer's model service did not respond ${e[1]} times in a row, so this round was not reviewed.`],[/^The Reviewer's session ended before it reached a conclusion, so this round was not judged\.?/i,[`审阅者在得出结论前就中断了,这一轮没有被评判。`,`The reviewer stopped before reaching a conclusion, so this round was not judged.`]],[/^The wait after a repeated backend failure ended early: daemon stop requested\.?/i,[`在等待重试时 Argus 被要求停止,任务随之暂停。`,`Argus was asked to stop while waiting to retry, so the task paused.`]],[/^Backend call paused before a trustworthy completed turn \(stop_kind=(\w+)\); reviewer skipped\.?/i,(e,t)=>t===`zh-CN`?`这一轮在得出可信结果前被暂停(${Fc(e[1],t)}),所以没有人审阅。`:`This round was paused before it produced a trustworthy result (${Fc(e[1],t)}), so no one reviewed it.`],[/^One Engineer call used its whole per-call provider-turn allowance \([^)]*\); reviewer skipped\. The work so far is kept and the task continues in a fresh session from the checkpoint\.?/i,[`这一轮用完了单次调用的额度;已做的工作保留,会在新的会话里接着做,本轮没有审阅。`,`This round used up its per-call allowance; the work so far is kept and continues in a fresh session. No review this round.`]],[/^Execution host is unavailable; reviewer skipped\.?/i,[`执行环境暂时不可用,这一轮没有审阅。`,`The execution environment is unavailable, so this round was not reviewed.`]],[/^Copilot CLI exited with code \d+\.?/i,[`模型服务的调用没有完成。`,`The model service call did not complete.`]],[/^Grounded bounded plan completed with (\d+) step\(s\)\.?/i,(e,t)=>t===`zh-CN`?`规划完成,共 ${e[1]} 步。`:`Planning finished with ${e[1]} steps.`],[/^Retry in a fresh \w+ session; do not resume the failed thread\.(?:\s*If this repeats, pause the daemon and reduce concurrent \w+ load\.)?/i,[`接下来会在新的会话里重试这一轮。`,`The round will be retried in a fresh session.`]],[/^Restart the daemon to resume this mission from its checkpoint\.?/i,[`重新运行 Argus 即可从保存的进度继续。`,`Run Argus again to continue from the saved progress.`]],[/^Resume this mission when the operator is ready\.?/i,[`准备好后即可恢复这项任务。`,`Resume the task whenever you are ready.`]],[/^Resume from the persisted checkpoint after the blocking budget or provider condition has been cleared\.?/i,[`预算或模型服务恢复后,即可从保存的进度继续。`,`Once the budget or model service is back, the task continues from the saved progress.`]],[/^inspecting project state$/i,[`正在查看项目状态`,`Looking at the project state`]],[/^running project command$/i,[`正在运行项目命令`,`Running a project command`]],[/^using a tool$/i,[`正在使用工具`,`Using a tool`]]],Jc=/^(?:[\w.]+_(?:streak|code|error|kind)=|error=|exit=|fatal_error=|Runner receipt:|stop_kind=|backend_)/i;function Yc(e,t){let n=e.trim(),r=[],i=[],a=!1;for(;n;){let e=!1;for(let[o,s]of qc){let c=n.match(o);if(!c)continue;let l=typeof s==`function`?s(c,t):Ec(s,t);typeof l==`string`?r.push(l):(r.push(l.text),l.technical&&i.push(l.technical)),n=n.slice(c[0].length).replace(/^[\s;,]+/,``),e=!0,a=!0;break}e||(a&&Jc.test(n)?i.push(n):r.push(n),n=``)}let o=t===`zh-CN`?``:` `;return{text:r.filter(Boolean).join(o).replace(/:\s+/g,`:`),technical:i.join(` `)}}function Xc(e,t,n){let r=String(e??``).trim();if(n){let e=n.language&&n.language!==Vc(t)?Uc(n.cause,t):``;if(e)return{text:e,technical:String(n.technical??``)};if(n.technical)return{text:r,technical:String(n.technical)}}if(!r)return{text:``,technical:``};let i=r.split(/(\n[ \t]*\n|\n)/),a=[],o=[];return i.forEach((e,n)=>{if(n%2==1){a.push(e.includes(` + +`)||/\n[ \t]*\n/.test(e)?` + +`:` +`);return}let r=Yc(e,t);a.push(r.text),r.technical&&o.push(r.technical)}),{text:a.join(``).replace(/\n{3,}/g,` + +`).trim(),technical:o.join(` `)}}function Zc(e,t){let n=e.split(/(\r?\n)/),r=n.findIndex((e,t)=>t%2==0&&e.trim()!==``),i=n[r]?.trim()??``,a=i.match(/^(?:Task continued|任务已继续)(?: · (.+))?$/),o=i.match(/^Could not complete (.+)\.$/)??i.match(/^未能完成:(.+)。$/);if(!a&&!o)return null;let s=t===`zh-CN`,c=[],l=``,u=!1;return{text:n.map((e,n)=>{if(n%2==1)return e;if(n===r){if(a){let e=a[1]??``,n=e.match(/^(.*?) · review=(\S+)$/),r=n?n[1]:e;return[s?`当时记录:工作继续推进。`:`Recorded then: work continued.`,r?`${s?`任务:`:`Task: `}${r}`:``,n?`${s?`当时记录的审阅状态:`:`Review status recorded then: `}${Wc(n[2],t)}`:``].filter(Boolean).join(` +`)}let e=o[1];return/^(?:the current task|当前任务)$/.test(e)?s?`当时这项任务未能完成。`:`This task had not completed at that time.`:s?`当时未能完成:${e}。`:`Not completed at that time: ${e}.`}if(/^(?:Progress|Mission summary|本次进展|本次完成)[::]/.test(e)&&(u=!0),u)return e;let i=e.match(/^\s*(`{3,}|~{3,})/);if(i)return l?l===i[1][0]&&(l=``):l=i[1][0],e;if(l)return e;if(/^(?:Nothing is queued yet; the Planner is deciding what comes next\.|计划里暂时没有下一项,Planner 正在决定接下来做什么。)$/.test(e))return s?`当时尚未排入下一项任务,规划者还在决定接下来做什么。`:`At that time, nothing was queued and the Planner was still deciding what to do next.`;let d=e.match(/^(?:Next(?: action| up)?|下一步|接下来做)[::]\s*(.*)$/);if(d){let e=/^(?:Argus will diagnose the failure and choose a safe next step\.|Argus 会诊断原因并选择可恢复的方案。)$/.test(d[1])?s?`诊断当时的原因,再选择可恢复的方案。`:`Diagnose the cause and choose a recovery approach.`:d[1];return`${s?`当时记录的下一步:`:`Next step recorded at the time: `}${e}`}let f=e.match(/^(?:Reason:|原因:)\s*(.*)$/);if(f){let e=pa(f[1]);if(e.prose===`Argus was stopped by its operator in the middle of this round; the Engineer's work so far is kept and nothing was retried.`){let t=ma(f[1],s);return e.receipt&&c.push(e.receipt),s?`当时${t.summary}。已做的工作保留,当时没有重试。`:`At that time, ${t.summary}. Work done so far was kept, and no retry was made then.`}let n=Xc(f[1],t);if(n.text!==f[1].trim()||n.technical)return n.technical&&c.push(n.technical),`${s?`当时记录的原因:`:`Reason recorded at the time: `}${n.text}`}return fa.test(e.trim())?(c.push(e),``):e}).join(``),technical:c.join(` +`)}}var Qc=3,$c=`engineer.progress`,el=new Set([`tool_use`,`command_execution`,`file_change`]),tl=[`assistant_message`,`agent_message`,`message`],nl=e=>e,rl=(e,t)=>String(nl(e)[t]??``),il=e=>rl(e,`type`)===$c?rl(e,`kind`):``;function al(e,{locale:t,showReasoning:n,filter:r=`all`,query:i=``}){let a=[],o=new Map,s=0,c={locale:t,showReasoning:n,unknownEventPolicy:`hide`,density:`compact`};return e.forEach(e=>{let t=wc(e,c);if(!t){!n&&fe(e)&&s++;return}if(!ve(e,t,r,i))return;let l=rl(e,`message_id`),u=!!l&&rl(e,`type`)===$c&&tl.includes(rl(e,`kind`));if(u&&o.has(l)){let n=o.get(l);a[n]={...a[n],ev:{...a[n].ev,...e},r:{...a[n].r,...t,text:Ie(a[n].r.text,t.text,Le(e))}};return}let d={ev:e,r:t,key:Re(e)};u&&o.set(l,a.length),a.push(d)}),{list:a,hiddenReasoning:s}}function ol(e){let t=rl(e,`tool_name`)||rl(e,`tool`)||rl(e,`name`);if(t)return t;let n=rl(e,`text`).match(/^([A-Za-z_][\w.-]{0,40}):\s/);return n?n[1]:``}function sl(e){let t=rl(e,`status`).toLowerCase();if(t===`running`||t===`started`||t===`in_progress`||t===`pending`)return`running`;if(t===`failed`||t===`error`||t===`errored`)return`failed`;let n=nl(e).exit_code;return typeof n==`number`&&n!==0?`failed`:[`completed`,`complete`,`success`,`succeeded`,`done`,`ok`,`finished`].includes(t)?`completed`:``}function cl(e,t){let n=rl(t,`call_id`),r=rl(e.ev,`call_id`);return n&&r?n===r:il(e.ev)===il(t)&&ol(e.ev)===ol(t)&&rl(e.ev,`text`)===rl(t,`text`)}var ll=(e,t)=>({kind:`step`,key:e.key,ev:e.ev,r:e.r,latest:e.ev,repeat:1,status:t});function ul(e){let t=[],n=[],r=(e,t,r,i)=>{let[a]=n.splice(e,1);a.status=r,a.latest=t,i&&(a.result=i)};for(let i of e){let e=il(i.ev);if(el.has(e)){let e=sl(i.ev);if(e!==`running`){let t=n.length-1;for(;t>=0&&!cl(n[t],i.ev);)--t;if(t>=0){r(t,i.ev,e||`completed`);continue}}let a=ll(i,e);t.push(a),e===`running`&&n.push(a);continue}if(e===`tool_result`){let e=rl(i.ev,`call_id`),t=ol(i.ev),a=e?n.findIndex(t=>rl(t.ev,`call_id`)===e):n.findIndex(e=>!t||ol(e.ev)===t);if(a>=0){r(a,i.ev,sl(i.ev)||`completed`,i);continue}}t.push(ll(i,``))}return t}var dl=/fail|error|backoff|stall|denied|blocked|nudge|escalat/i,fl=/\b(?:fail(?:ed|ure)?|error|unavailable|unreachable|exited with code|backoff|retry(?:ing)?|stuck|skipped)\b/i;function pl(e){if(il(e.ev))return!1;let t=e.ev;return e.r.tone===`err`||e.r.tone===`warn`||dl.test(rl(t,`type`))||nl(t).backend_unavailable===!0||nl(t).review_skipped===!0||fl.test(e.r.text)}var ml=e=>e.toLowerCase().replace(/\d+(?:\.\d+)?/g,`#`).replace(/\s+/g,` `).trim();function hl(e){let t=e.ev;return ml(rl(t,`signature`)||rl(t,`cause`)||rl(t,`backend_error`)||rl(t,`error`)||rl(t,`reason`)||rl(t,`stop_kind`)||e.r.text)}function gl(e,t){return pl(e)?`fail|${e.r.role}|${rl(e.ev,`type`)}|${hl(e)}`:`text|${e.r.role}|${e.r.glyph}|${Xc(e.r.text,t).text}`}function _l(e,t){e.repeat+=t.repeat,e.latest=t.latest,e.r=t.r,t.status&&(e.status=t.status),t.result&&(e.result=t.result)}function vl(e,t){let n=[],r=[];for(let i of e){let e=gl(i,t),a=n[n.length-1];if(a&&r[r.length-1]===e){_l(a,i);continue}n.push({...i}),r.push(e)}let i=r.map((e,t)=>il(n[t].ev)?e:ml(e)),a=(e,t)=>{if(e+2*t>n.length)return!1;for(let n=0;ne.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,Cl=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,wl=e=>Cl(e.replace(/^[a-z]+:\/\/(?:www\.)?/i,``).replace(/#.*$/,``).replace(/\/$/,``),48),Tl=/\*\*\* (?:Add|Update|Delete|Move to) File:\s*(\S+)/;function El(e,t,n){for(let r of n){if(e){let t=e[r];if(typeof t==`string`&&t.trim())return t.trim();if(Array.isArray(t)&&typeof t[0]==`string`&&t[0].trim())return t[0].trim();continue}let n=t.match(RegExp(`"${r}":\\s*"((?:[^"\\\\]|\\\\.)*)"`));if(n&&n[1])return n[1].replace(/\\(.)/g,`$1`)}return``}function Dl(e){return Ol(e.ev)}function Ol(e){let t=rl(e,`text`);if(il(e)===`file_change`){let e=t.match(Tl);if(e)return Sl(e[1].trim());let n=t.match(/^(\S+\.[A-Za-z0-9]{1,8})\b/);return n?Sl(n[1]):``}let n=t.replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),r=null;if(n.startsWith(`{`))try{let e=JSON.parse(n);r=e&&typeof e==`object`&&!Array.isArray(e)?e:null}catch{r=null}let i=El(r,n,[`path`,`file_path`,`filePath`,`file`,`filename`,`target_file`,`notebook_path`,`paths`]);if(i&&!/^\.\/?$/.test(i))return Sl(i);let a=El(r,n,[`url`,`uri`]);if(a)return wl(a);let o=El(r,n,[`pattern`,`query`,`regex`,`glob`,`q`]);if(o)return Cl(o,32);let s=n.match(Tl);return s?Sl(s[1].trim()):``}function kl(e,t){let n=t===`zh-CN`,r=e.trim().replace(/\\/g,`/`).split(`/`).filter(e=>e&&e!==`**`&&e!==`.`),i=r[r.length-1]??`*`,a=r.slice(0,-1).filter(e=>!/[*?]/.test(e)),o;o=i===`*`||i===`*.*`?n?`所有文件`:`all files`:/^\*\.[\w.]+$/.test(i)?n?`${i.slice(1)} 文件`:`${i.slice(1)} files`:Cl(i,40);let s=a[a.length-1];return s?n?`${s} 里的 ${o}`:`${o} in ${s}`:o}var Al=/^(glob|find|find_?files|list_?files|file_?search)$/i;function jl(e,t){let n=t===`zh-CN`,r=ol(e),i=bl(r,il(e)),a=Ol(e);if(i===`search`){let t=El(null,rl(e,`text`).replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),[`pattern`,`query`,`regex`,`glob`,`q`]);t&&(a=Cl(t,48))}if(i===`search`&&Al.test(r)&&a)return`${n?`查找`:`Find`} ${kl(a,t)}`;let o=a.startsWith(`/`)?Sl(a):a,[s,c,l,u]={read:[`查阅`,`查阅文件`,`Read`,`Read a file`],search:[`搜索:`,`搜索`,`Search:`,`Search`],fetch:[`读取`,`读取网页`,`Open`,`Open a page`],edit:[`修改`,`修改文件`,`Edit`,`Edit a file`],tool:[`调用`,`调用工具`,`Use`,`Use a tool`]}[i],d=i===`tool`?r:o;if(!d)return n?c:u;let f=n?s:l;return f.endsWith(`:`)?`${f}${d}`:`${f} ${d}`}function Ml(e,t){let n=il(e);return n===`command_execution`?{title:t===`zh-CN`?`正在运行命令`:`Running a command`,detail:``}:[`tool_use`,`file_change`].includes(n)?{title:{read:[`查看资料`,`Reading material`],search:[`查找相关信息`,`Searching for relevant information`],fetch:[`读取资料页面`,`Reading a source page`],edit:[`更新项目文件`,`Updating project files`],tool:[`执行一个工作步骤`,`Carrying out a work step`]}[bl(ol(e),n)][t===`zh-CN`?0:1],detail:Ol(e)}:null}function Nl(e){let t=e[0],n=e[e.length-1],r=ol(t.ev)||(il(t.ev)===`file_change`?`file`:`tool`),i=bl(r,il(t.ev)),a=[],o=0;for(let t of e){let e=Dl(t);e&&(o+=1,a.includes(e)||a.push(e))}let s=e.reduce((e,t)=>e+t.repeat,0),c=i===`read`||i===`edit`||i===`fetch`;return{kind:`group`,key:`group:${t.key}`,r:{...t.r,text:``},latest:n.latest,tool:r,action:i,steps:e,targets:a,count:c&&o===e.length?a.length:s,calls:s,failed:e.filter(e=>e.status===`failed`).length}}function Pl(e){let t=[],n=[],r=null,i=()=>{n.length>=3?t.push(Nl(n)):t.push(...n),n=[],r=null};for(let a of e){let e=xl(a);if(e&&(r===null||r===e)){n.push(a),r=e;continue}i(),e?(n.push(a),r=e):t.push(a)}return i(),t}function Fl(e,t){return Pl(vl(ul(e),t))}function Il(e,t,n){let r=t(`stream.fold.${e.action}`,{count:e.count,tool:e.tool}),i=e.targets.slice(0,Qc);return`${r}${i.length?`${n===`zh-CN`?`:`:`: `}${i.join(n===`zh-CN`?`、`:`, `)}${e.targets.length>i.length?`…`:``}`:``}${e.failed?` · ${t(`stream.fold.failed`,{count:e.failed})}`:``}`}function Ll(e,t,n){return e.kind===`group`?Il(e,t,n):Xc(e.r.text,n).text}var Rl=new Set([`tool_use`,`command_execution`,`file_change`]),zl=new Set([`completed`,`failed`,`cancelled`,`canceled`,`error`,`done`,`stopped`]),Bl=()=>Date.now()/1e3;function Vl(e){return e.trim().replace(/[.…]+$/u,``).toLowerCase()}function Hl(e,t,n=Bl()){let r=(t.label??``).trim();if(!r)return e;let i=t.heartbeat===!0,a=e.slice(),o=(t.callId??``).trim(),s=(t.status??``).trim().toLowerCase(),c=(t.kind??``).trim();if(o){let e=-1;for(let t=a.length-1;t>=0;--t)if(a[t].callId===o){e=t;break}if(e>=0){let i=a[e];return a[e]={...i,label:c===`tool_result`?i.label:r,detail:(t.detail||``).trim()||i.detail,tool:(t.tool||``).trim()||i.tool,output:(t.output||``).trim()||i.output,status:s||i.status,endedTs:zl.has(s)?n:i.endedTs},a}if(c===`tool_result`)return a}let l=a[a.length-1];if(c===`tool_result`)return!l||l.endedTs||l.heartbeat||(a[a.length-1]={...l,output:(t.output||``).trim()||l.output,status:s||`completed`,endedTs:n}),a;if(l&&!l.endedTs){if(Vl(l.label)===Vl(r)||i&&l.heartbeat)return a[a.length-1]={...l,label:r,detail:t.detail||l.detail,kind:t.kind||l.kind,heartbeat:i,endedTs:0},a;l.callId||(a[a.length-1]={...l,endedTs:n})}return a.push({id:`${a.length}:${r}:${n}`,role:(t.role||`manager`).trim()||`manager`,label:r,detail:(t.detail||``).trim(),kind:c,startedTs:n,endedTs:0,heartbeat:i,...t.tool?.trim()?{tool:t.tool.trim()}:{},...t.toolKind?.trim()?{toolKind:t.toolKind.trim()}:{},...o?{callId:o}:{},...s||o?{status:s||`running`}:{},...t.output?.trim()?{output:t.output.trim()}:{}}),a}function Ul(e,t=Bl()){return e.length===0?[]:e.map(e=>e.endedTs?e:{...e,endedTs:t})}function Wl(e){if(!Number.isFinite(e)||e<1)return``;if(e<60)return`${Math.floor(e)}s`;let t=Math.floor(e/60),n=Math.floor(e%60);return n?`${t}m${n}s`:`${t}m`}function Gl(e,t=Bl(),n=!1){return e.filter(e=>!e.heartbeat&&Rl.has(e.kind)).map(e=>{let r=!e.endedTs&&(!e.status||e.status===`running`)?n?`completed`:`running`:e.status||`completed`;return{kind:e.kind,label:e.label,...e.detail?{detail:e.detail}:{},...e.tool?{tool:e.tool}:{},...e.toolKind?{tool_kind:e.toolKind}:{},...e.callId?{call_id:e.callId}:{},status:r,started_ts:e.startedTs,ended_ts:e.endedTs||(n?t:0),...e.output?{output:e.output}:{}}})}var Kl=e=>typeof e==`string`?e.trim():``,ql=e=>typeof e==`number`&&Number.isFinite(e)?e:0;function Jl(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(e=>{if(!e||typeof e!=`object`)return;let n=e,r=Kl(n.label);r&&t.push({kind:Kl(n.kind)||`tool_use`,label:r,...Kl(n.detail)?{detail:Kl(n.detail)}:{},...Kl(n.tool)?{tool:Kl(n.tool)}:{},...Kl(n.tool_kind)?{tool_kind:Kl(n.tool_kind)}:{},...Kl(n.call_id)?{call_id:Kl(n.call_id)}:{},status:Kl(n.status).toLowerCase()||`completed`,started_ts:ql(n.started_ts),ended_ts:ql(n.ended_ts),...Kl(n.output)?{output:Kl(n.output)}:{}})}),t}function Yl(e,t=Bl()){if(!e.length)return 0;let n=Math.min(...e.map(e=>e.started_ts||t)),r=Math.max(...e.map(e=>e.ended_ts||t));return Math.max(0,r-n)}var Xl={command_execution:st,tool_use:bn,file_change:Zt},Zl=new Set([`failed`,`error`]),Ql=new Set([`cancelled`,`canceled`,`stopped`]),$l=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,eu=/^⚙\s*([\w.-]+)\s*·\s*(.*)$/su;function tu(e,t=`zh-CN`){let n=(e.tool??``).trim(),r=(e.detail??``).trim(),i=e.label.match(eu);if(i){let e=i[1],a=r||i[2];return{primary:jl({type:`engineer.progress`,kind:`tool_use`,tool_name:n||e,text:`${e}: ${a}`},t),secondary:a}}let a=e.label.replace($l,``).trim();return{primary:a||n,secondary:r&&r!==a?r:``}}function nu({steps:e,live:t,startedTs:n,status:r=``}){let{t:i,locale:a}=z(),[o,s]=(0,G.useState)(!1),[,c]=(0,G.useState)(0);if((0,G.useEffect)(()=>{if(!t)return;let e=setInterval(()=>c(e=>e+1),1e3);return()=>clearInterval(e)},[t]),(0,G.useEffect)(()=>{t||s(!1)},[t]),!e.length&&!t)return null;let l=Date.now()/1e3,u=Zl.has(r)||e.some(e=>Zl.has(e.status)),d=Ql.has(r)||e.some(e=>Ql.has(e.status)),f=Wl(t&&n?Math.max(0,l-n):Yl(e,l))||`<1s`,p=[...e].reverse().find(e=>e.status===`running`),m=t?`${p?tu(p,a).primary:a===`zh-CN`?`正在准备回复`:`Preparing a reply`} · ${f}`:u?`${a===`zh-CN`?`过程出现问题,请查看详情`:`An issue occurred; see details`} · ${f}`:d?`${a===`zh-CN`?`已停止`:`Stopped`} · ${f}`:i(`chat.stepsDone`,{count:e.length,seconds:f});return(0,J.jsxs)(`div`,{className:`turn-steps mt-3 rounded-lg border border-line/50 bg-surface/50 text-xs`,"data-live":t||void 0,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,"aria-label":a===`zh-CN`?`查看工作过程`:`View work progress`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-ink-dim hover:text-ink`,children:[(0,J.jsx)(t?an:u?Gt:d?gn:We,{size:14,"aria-hidden":`true`,className:`shrink-0 ${t?`animate-spin text-manager motion-reduce:animate-none`:u?`text-err`:d?`text-ink-faint`:`text-ok`}`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:m}),(0,J.jsx)(o?Ue:Ut,{size:14,"aria-hidden":`true`,className:`shrink-0 text-ink-faint`})]}),o?(0,J.jsxs)(`ol`,{className:`space-y-1 border-t border-line/40 px-3 py-2`,children:[!e.length&&(0,J.jsx)(`li`,{className:`text-ink-faint`,children:a===`zh-CN`?`尚未记录工具操作。`:`No tool operations recorded yet.`}),e.map((e,n)=>{let{primary:r,secondary:o}=tu(e,a),s=e.status===`running`,c=Zl.has(e.status),u=Ql.has(e.status),d=e.kind===`command_execution`?Xl.command_execution:e.kind===`file_change`?Xl.file_change:Xl.tool_use,f=Wl(Math.max(0,(e.ended_ts||l)-e.started_ts));return(0,J.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(d,{size:13,"aria-hidden":`true`,className:`shrink-0 self-start mt-0.5 ${c?`text-err`:`text-ink-faint`}`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`${s&&t?`text-ink`:c?`text-err`:`text-ink-dim`}`,title:o||r,children:r}),o?(0,J.jsxs)(`details`,{className:`turn-step-raw inline`,children:[(0,J.jsx)(`summary`,{className:`ml-2 inline cursor-pointer list-none text-[11px] text-ink-faint hover:text-ink-dim`,children:i(`chat.stepRaw`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block break-all font-mono text-[11px] text-ink-faint`,children:o})]}):null,c&&e.output?(0,J.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-err/80`,children:e.output}):null]}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono tabular-nums ${s&&t?`text-manager`:`text-ink-faint`}`,children:s&&t?(0,J.jsx)(an,{size:12,className:`animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):c?i(`chat.stepFailed`):u?a===`zh-CN`?`已停止`:`Stopped`:f})]},e.call_id||`${n}:${e.started_ts}`)})]}):null]})}function ru({snapshot:e,view:t,events:n=[],connected:r,compact:i=!1}){let{locale:a}=z(),o=a===`zh-CN`,[s,c]=(0,G.useState)(()=>Date.now()/1e3);(0,G.useEffect)(()=>{let e=window.setInterval(()=>c(Date.now()/1e3),1e4);return()=>window.clearInterval(e)},[]);let l=ci(e,t,n,s),u=l.activityAgeSeconds,d=l.waitingOn?``:u===null?o?`暂无本次运行的进展记录`:`No progress recorded for this run yet`:u<60?o?`刚刚有进展`:`Progress in the last minute`:u<3600?o?`${Math.floor(u/60)} 分钟前有进展`:`Progress ${Math.floor(u/60)} min ago`:o?`${Math.floor(u/3600)} 小时前有进展`:`Progress ${Math.floor(u/3600)} hr ago`;return(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-line/60 bg-panel px-4 py-2.5 text-xs`,"data-testid":`work-status`,"data-state":l.state,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r?l.state===`running`?`bg-blue`:`bg-ink-faint`:`bg-warn`}`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:pi(l,a,r)}),d?(0,J.jsx)(`time`,{className:`text-ink-faint`,dateTime:l.activityAt?new Date(l.activityAt*1e3).toISOString():void 0,children:d}):null]}),r?!i&&l.title?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-ink-dim`,title:l.title,children:l.title}):null:(0,J.jsx)(`p`,{className:`mt-1 leading-5 text-ink-faint`,children:o?`这里保留的是已收到的记录;连接恢复后继续更新。`:`These are the records already received. Updates resume when the connection returns.`})]})}var iu=/Info: (?:Operation cancelled by user|Response was interrupted due to a server error\. Retrying\.\.\.)/gi;function au({ev:e,r:t,first:n,last:r,latest:i,repeat:a=1,status:o=``,result:s}){let{locale:c,t:l}=z(),u=B.role[t.role]??B.inkFaint,d=He(t.tone),f=e.type===`engineer.progress`&&String(e.kind||``)===`tool_use`,p=[`agent_message`,`assistant_message`,`message`].includes(String(e.kind||``))?Ca(t.text):t.text,m=f?{text:jl(e,c),technical:t.text}:Xc(p,c),h=s?Xc(s.r.text,c).text:``,g=[m.technical,h?`${l(`stream.stepResult`)}: ${h}`:``].filter(Boolean).join(` +`);return(0,J.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${r?`animate-appear`:``} ${t.reasoning?`opacity-60`:``}`,style:t.rule?{marginTop:4}:void 0,children:[(0,J.jsxs)(`div`,{className:`relative flex justify-center`,children:[n?null:(0,J.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),r?null:(0,J.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,J.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:u,boxShadow:`0 0 0 1px ${u}55`}})]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:u},title:t.label,children:t.label}),(0,J.jsx)(`span`,{className:`text-xs`,style:{color:d},children:t.glyph}),a>1?(0,J.jsxs)(`span`,{className:`rounded bg-line/60 px-1 font-mono text-[10px] tabular-nums text-ink-dim`,title:l(`stream.repeated`,{count:a}),"data-repeat":a,children:[`×`,a]}):null,o===`failed`?(0,J.jsx)(`span`,{className:`text-xs text-err`,children:l(`stream.stepFailed`)}):null,(0,J.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:Ct(i??e)})]}),(0,J.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5 ${t.reasoning?`italic`:``}`,style:{color:d},title:g||void 0,children:m.text})]})]})}function ou({group:e,first:t,last:n,open:r,onToggle:i}){let{locale:a,t:o}=z(),s=B.role[e.r.role]??B.inkFaint,c=He(e.r.tone),l=Il(e,o,a);return(0,J.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${n?`animate-appear`:``}`,"data-feed-group":e.action,"data-open":r?`true`:`false`,children:[(0,J.jsxs)(`div`,{className:`relative flex justify-center`,children:[t?null:(0,J.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),n?null:(0,J.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,J.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:s,boxShadow:`0 0 0 1px ${s}55`}})]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":r,title:o(r?`stream.fold.collapse`:`stream.fold.expand`),className:`block w-full rounded text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-blue-sky`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:s},title:e.r.label,children:e.r.label}),(0,J.jsx)(`span`,{className:`text-xs`,style:{color:c},children:e.r.glyph}),(0,J.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-ink-faint`,children:e.calls}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})}),(0,J.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:Ct(e.latest)})]}),(0,J.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5`,style:{color:c},children:l})]}),r?(0,J.jsx)(`div`,{className:`mt-1 border-l border-line/50`,children:e.steps.map((t,n)=>(0,J.jsx)(au,{ev:t.ev,r:t.r,first:n===0,last:n===e.steps.length-1,latest:t.latest,repeat:t.repeat,status:t.status,result:t.result},t.key))}):null]})]})}function su({rows:e}){let[t,n]=(0,G.useState)(()=>new Set),r=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,J.jsx)(J.Fragment,{children:e.map((n,i)=>n.kind===`group`?(0,J.jsx)(ou,{group:n,first:i===0,last:i===e.length-1,open:t.has(n.key),onToggle:()=>r(n.key)},n.key):(0,J.jsx)(au,{ev:n.ev,r:n.r,first:i===0,last:i===e.length-1,latest:n.latest,repeat:n.repeat,status:n.status,result:n.result},n.key))})}function cu({ev:e,r:t,artifacts:n,onOpenArtifact:r}){let{t:i,locale:a}=z(),o=String(e.type)===`ui.operator`,s=!o&&e.mission_result===!0,c=s&&typeof e.text==`string`?e.text:t.text,l=s?Zc(c,a):null,u=s?Tt(e):null,d=o?io(t.text):null,f=d?.refs??[],p=d&&f.length?d.text:t.text,m=o?[]:Jl(e.steps),h=Number(e.response_latency_ms??0),g=!o&&h>=100?` · ${(h/1e3).toFixed(1)}s`:``,_=(0,G.useRef)(null);return it(_,(e,t)=>{_.current&&(t||e.fromTo(_.current,{autoAlpha:0,x:o?12:0,y:o?0:8},{autoAlpha:1,x:0,y:0,duration:.28,ease:`power2.out`,clearProps:`transform,opacity,visibility`}))}),(0,J.jsx)(`article`,{ref:_,"data-task-receipt":s||void 0,"data-task-receipt-id":s?String(e.message_id||e.event_id||``):void 0,className:`conversation-row group mx-auto w-full max-w-full px-4 py-3 sm:px-6 lg:max-w-[61.8vw]`,children:o?(0,J.jsxs)(`div`,{className:`flex items-end justify-end gap-2`,children:[(0,J.jsx)(Qe,{text:t.text,label:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,J.jsx)(`time`,{className:`shrink-0 pb-1 font-mono text-[10px] tabular-nums text-ink-faint`,children:Ct(e)}),(0,J.jsxs)(`div`,{className:`max-w-[calc(100%_-_3rem)] rounded-[18px] bg-conversation-user px-4 py-2.5 text-[15px] leading-relaxed text-ink ring-1 ring-line/35 sm:max-w-[82%]`,children:[f.length?(0,J.jsx)(`div`,{className:`mb-2 space-y-2`,children:f.map((e,t)=>(0,J.jsxs)(`blockquote`,{"aria-label":a===`zh-CN`?`引用`:`Reference`,className:`border-l-2 border-blue/40 pl-3 text-sm text-ink-dim`,children:[(0,J.jsxs)(`div`,{className:`text-xs text-ink-faint`,children:[a===`zh-CN`?`引用`:`Reference`,e.part?` · ${a===`zh-CN`?`第 ${e.part} 部分`:`Part ${e.part}`}`:``]}),(0,J.jsx)(`div`,{className:`font-medium`,children:e.task_title||e.step_title||e.task_id}),e.task_title&&e.step_title&&e.step_title!==e.task_title?(0,J.jsx)(`div`,{children:e.step_title}):null]},`${e.source}:${e.task_id}:${e.step_id}:${t}`))}):null,p?(0,J.jsx)(H,{artifacts:n,onOpenArtifact:r,children:p}):null]})]}):(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center`,children:(0,J.jsx)(At,{size:26,className:`text-ink`})}),(0,J.jsxs)(`div`,{className:`relative min-w-0 flex-1 text-[15px] leading-relaxed text-ink`,children:[(0,J.jsxs)(`div`,{"data-task-receipt-header":s||void 0,className:s?`sticky -top-1.5 z-10 mb-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 bg-panel py-1`:`mb-1 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-blue`,children:te().name}),s?(0,J.jsx)(`span`,{className:`text-[11px] text-ink-dim`,children:a===`zh-CN`?`任务回报 · 当时记录`:`Task report · Recorded then`}):null,(0,J.jsx)(Qe,{text:c,label:l?a===`zh-CN`?`复制原始回报`:`Copy original report`:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`ml-auto opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,J.jsxs)(`time`,{className:`font-mono text-[10px] tabular-nums text-ink-faint ${s?`basis-full sm:basis-auto`:``}`,dateTime:u?.toISOString(),title:u?.toLocaleString(a,{dateStyle:`full`,timeStyle:`long`}),children:[u?u.toLocaleString(a,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):Ct(e),g]})]}),c?(0,J.jsx)(`div`,{"data-task-receipt-prose":s||void 0,children:(0,J.jsx)(H,{artifacts:n,onOpenArtifact:r,children:l?.text??c})}):null,m.length||e.live===!0?(0,J.jsx)(nu,{steps:m,live:e.live===!0,startedTs:Number(e.ts),status:e.success===!1?`failed`:String(e.status??``)}):null,l?(0,J.jsx)(ft,{className:`task-receipt-original`,label:a===`zh-CN`?`查看原始回报(含技术记录)`:`View original report (including technical records)`,children:(0,J.jsx)(`pre`,{"data-task-receipt-original":!0,className:`mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs text-ink-dim`,children:c})}):null]})]})})}function lu({role:e,rows:t,open:n,active:r,onToggle:i}){let{t:a,locale:o}=z(),s=B.role[e],c=(0,G.useRef)(null),l=(0,G.useRef)(!0),u=(0,G.useRef)(0),[d,f]=(0,G.useState)(!1),p=t[t.length-1]?.r.text.length??0,m=(0,G.useMemo)(()=>Fl(t,o),[t,o]),h=m.length?Ll(m[m.length-1],a,o):``;return(0,G.useEffect)(()=>{n&&!l.current&&c.current&&(c.current.scrollTop=u.current)},[n]),(0,G.useEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{l.current&&c.current&&(c.current.scrollTop=c.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[n,t.length,p]),(0,J.jsxs)(`section`,{className:`role-log-group border-b border-line/50`,"data-role":e,"data-open":n?`true`:`false`,"data-active":r?`true`:`false`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":n,className:`group flex h-11 w-full items-center gap-2 px-4 text-left transition-colors hover:bg-bg/60`,children:[(0,J.jsx)(`span`,{"data-role-dot":e,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:s}}),(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink-dim`,children:zn(e,a)}),(0,J.jsx)(`span`,{className:`font-mono text-xs text-ink-faint`,children:m.length}),h?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:h}):(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${n?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),n?(0,J.jsx)(`div`,{className:`grid grid-rows-[1fr]`,children:(0,J.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden`,children:[(0,J.jsx)(`div`,{ref:c,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollTop,l.current=t.scrollHeight-t.scrollTop-t.clientHeight<=2,f(!l.current)},className:`max-h-72 overflow-x-hidden overflow-y-auto border-t border-line/40 scroll-thin`,children:m.length>0?(0,J.jsx)(su,{rows:m}):(0,J.jsx)(`div`,{className:`px-4 py-3 text-xs text-ink-faint`,children:a(`stream.noLogs`)})}),d?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{l.current=!0,f(!1),c.current&&(c.current.scrollTop=c.current.scrollHeight)},className:`absolute bottom-2 right-3 rounded-full border border-line/60 bg-panel px-3 py-1 text-xs text-ink-dim shadow-glow hover:text-ink`,children:[`↓ `,a(`stream.jumpToLatest`)]}):null]})}):null]})}function uu(e){let t={manager:[],planner:[],engineer:[],reviewer:[]},n=[];return e.forEach(e=>{et.includes(e.r.role)?t[e.r.role].push(e):n.push(e)}),{roleRows:t,systemRows:n,lastRole:[...e].reverse().find(e=>et.includes(e.r.role))?.r.role??``}}function du({rows:e}){let{t,locale:n}=z(),[r,i]=(0,G.useState)(!1),a=(0,G.useMemo)(()=>Fl(e,n),[e,n]);return(0,J.jsxs)(`section`,{className:`border-b border-line/50`,"data-system-open":r?`true`:`false`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex h-10 w-full items-center gap-2 px-4 text-left text-xs text-ink-faint hover:bg-bg/60`,children:[(0,J.jsx)(`span`,{children:t(`stream.system`)}),(0,J.jsx)(`span`,{className:`font-mono`,children:a.length}),(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),r?(0,J.jsx)(`div`,{className:`border-t border-line/40`,children:(0,J.jsx)(su,{rows:a})}):null]})}function fu({rows:e,live:t,followLatest:n,activeRole:r,activeTaskId:i}){let{roleRows:a,systemRows:o,lastRole:s}=(0,G.useMemo)(()=>uu(e),[e]),[c,l]=(0,G.useState)(()=>new Set(n&&s?[s]:[])),u=(0,G.useRef)(!1);return(0,G.useEffect)(()=>{!n||!s||u.current||l(new Set([s]))},[s,n]),(0,J.jsxs)(`div`,{className:`bg-bg/25`,children:[et.map(e=>(0,J.jsx)(lu,{role:e,rows:a[e],open:c.has(e),active:t&&(r??s)===e&&(!i||a[e].some(e=>ri(e.ev)===i)),onToggle:()=>{u.current=!0,l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}},e)),o.length>0?(0,J.jsx)(du,{rows:o}):null]})}function pu(e){let t=e.delivery;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.delivery_id!=`string`||!n.delivery_id.trim()?null:n}function mu(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.type===`ui.operator`)return null;let r=pu(n);if(r)return r}}function hu({delivery:e,onOpen:t}){let{t:n}=z(),r=e.kind===`submission_certified`;return(0,J.jsxs)(`aside`,{className:`mx-auto my-3 flex w-full max-w-full gap-3 rounded-lg border border-ok/35 bg-ok/5 px-4 py-3 lg:max-w-[61.8vw]`,children:[(0,J.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-ok/15 font-semibold text-ok`,children:`✓`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-ok`,children:n(r?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,J.jsx)(`div`,{className:`mt-1 truncate text-sm font-semibold text-ink`,title:e.title,children:e.title}),t?(0,J.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`mt-2 rounded border border-ok/40 px-2 py-1 font-mono text-[10px] text-ok hover:border-ok hover:bg-ok/10`,children:n(e.primary_target?`mission.openResult`:`mission.viewTask`)}):null]})]})}function gu({group:e,artifacts:t,onOpenArtifact:n,onOpenDelivery:r}){let i=e=>e.ev.type===`ui.argus`&&/^(info:|operation cancelled|cancelled\b)/i.test(e.r.text.trim()),a=e.rows.filter(e=>e.ev.type===`ui.argus`).map(e=>{if(e.ev.mission_result===!0)return{reply:e,messages:[]};let t=e.r.text.match(iu)??[],n=e.r.text.replace(iu,``).trim(),r=Array.isArray(e.ev.steps)&&e.ev.steps.length>0;return{reply:(n||r)&&!i(e)?{...e,r:{...e.r,text:n}}:null,messages:i(e)&&t.length===0?[e.r.text]:t}}),o=a.flatMap(e=>e.reply?[e.reply]:[]),s=a.flatMap(e=>e.messages),c=(()=>{let t=new Set;return e.rows.flatMap(e=>{let n=pu(e.ev);return!n||t.has(n.delivery_id)?[]:(t.add(n.delivery_id),[n])})})();return(0,J.jsxs)(`section`,{className:`conversation-thread border-b border-line/60`,children:[(0,J.jsx)(cu,{ev:e.operator.ev,r:e.operator.r,artifacts:t,onOpenArtifact:n}),o.map(e=>(0,J.jsx)(cu,{ev:e.ev,r:e.r,artifacts:t,onOpenArtifact:n},e.key)),s.map((t,n)=>(0,J.jsx)(`div`,{className:`mx-auto w-full max-w-full px-6 py-1.5 text-center text-xs text-ink-faint lg:max-w-[61.8vw]`,children:t},`${e.key}-system-${n}`)),c.map(e=>(0,J.jsx)(hu,{delivery:e,onOpen:r},e.delivery_id))]})}function _u({events:e,connected:t,showReasoning:n,onToggleReasoning:r,embedded:i=!1,showHeader:a=!0,filter:o=`all`,query:s=``,skipFirst:c=0,artifacts:l,onOpenArtifact:u,onOpenDelivery:d,snapshot:f,missionView:p,historyStatus:m=`ready`,historyRefreshing:h=!1,onRetryHistory:g}){let{locale:_,t:v}=z(),[y,b]=(0,G.useState)(!0),x=(0,G.useRef)(!0),S=(0,G.useRef)(0),[C,w]=(0,G.useState)(()=>Date.now()),T=(0,G.useRef)(null),E=(0,G.useRef)(null),D=(0,G.useDeferredValue)(e),O=(0,G.useMemo)(()=>f?ci(f,p,D):null,[D,p,f]),k=t&&(!f||O?.state===`running`),A=(0,G.useMemo)(()=>f||!t?null:ai(D),[t,D,f]);(0,G.useEffect)(()=>{if(!A)return;w(Date.now());let e=window.setInterval(()=>w(Date.now()),1e3);return()=>window.clearInterval(e)},[A]);let j=A?Math.max(0,Math.floor((C-Number(A.ts??0)*1e3)/1e3)):0,M=(0,G.useMemo)(()=>al(c>0?D.slice(c):D,{locale:_,showReasoning:n,filter:o,query:s}),[D,n,o,s,c,_]),ee=(0,G.useMemo)(()=>{let e=[],t=[],n=[],r=null;M.list.forEach(i=>{i.ev.type===`ui.operator`?(r={key:i.key,operator:i,rows:[]},e.push(r)):i.ev.type===`ui.argus`?r?r.rows.push(i):t.push(i):n.push(i)});let i=new Set(M.list.filter(e=>e.ev.type===`ui.argus`).map(e=>pu(e.ev)?.delivery_id).filter(Boolean));return{groups:e,earlierReplies:t,projectWork:n,projectDeliveries:n.flatMap(e=>{let t=pu(e.ev);return!t||i.has(t.delivery_id)?[]:(i.add(t.delivery_id),[t])})}},[M.list]),N=(0,G.useMemo)(()=>D.filter(fe).length,[D]),P=(0,G.useMemo)(()=>M.list.slice(-20).reduce((e,t)=>e+t.r.text.length,0),[M.list]);return(0,G.useEffect)(()=>{if(!y)return;let e=window.requestAnimationFrame(()=>{x.current&&T.current&&(T.current.scrollTop=T.current.scrollHeight,S.current=T.current.scrollTop)});return()=>window.cancelAnimationFrame(e)},[M.list.length,P,y]),(0,G.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<40;x.current=t||x.current&&e.scrollTop>=S.current-1,S.current=e.scrollTop,b(x.current)};e.addEventListener(`scroll`,t,{passive:!0});let n=null,r=new ResizeObserver(()=>{x.current&&(n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,x.current&&(e.scrollTop=e.scrollHeight,S.current=e.scrollTop)}))});return r.observe(e),E.current&&r.observe(E.current),()=>{e.removeEventListener(`scroll`,t),r.disconnect(),n!==null&&window.cancelAnimationFrame(n)}},[]),(0,J.jsxs)(`section`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden bg-panel ${i?``:`rounded-lg border border-line/80`}`,children:[a&&(0,J.jsx)(U,{title:v(`panel.activity`),right:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[ee.projectWork.length>0?(0,J.jsx)(`button`,{type:`button`,onClick:()=>{x.current=!1,b(!1),T.current?.scrollTo({top:0,behavior:`auto`})},className:`rounded px-1.5 py-0.5 text-xs text-blue-sky hover:bg-bg`,children:_===`zh-CN`?`查看工作进展`:`View work progress`}):null,(0,J.jsxs)(`button`,{onClick:r,className:`rounded px-1.5 py-0.5 text-xs transition-colors ${n?`text-blue-sky`:`text-ink-faint hover:text-ink-dim`}`,title:v(`stream.toggleReasoning`),children:[v(`stream.reasoning`),N?` ·${N}`:``]}),(0,J.jsx)(`span`,{className:`text-xs ${t?`text-ok`:`text-ink-faint`}`,children:t?`● ${v(`common.live`)}`:`○ ${v(`common.reconnecting`)}`})]})}),f?(0,J.jsx)(ru,{snapshot:f,view:p,events:D,connected:t,compact:!0}):A?(0,J.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line/60 bg-blue-deep/5 px-4 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-blue-sky`}),(0,J.jsx)(`span`,{className:`truncate`,children:v(`stream.backgroundWork`)}),(0,J.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono tabular-nums text-ink-faint`,children:[j,`s`]})]}):null,m===`ready`?null:(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 px-4 py-3 text-sm text-ink-faint`,role:m===`error`?`alert`:`status`,"data-conversation-history":m,children:[(0,J.jsx)(`span`,{children:v(m===`error`?`stream.historyError`:`stream.historyLoading`)}),m===`error`&&g?(0,J.jsx)(`button`,{type:`button`,onClick:g,disabled:h,className:`shrink-0 rounded px-2 py-1 text-blue-sky hover:bg-bg disabled:opacity-50`,children:v(`stream.historyRetry`)}):null]}),(0,J.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto pb-6 pt-1.5 scroll-thin`,"aria-busy":m===`loading`,children:(0,J.jsx)(`div`,{ref:E,className:`flow-root`,"data-event-stream-content":!0,children:M.list.length===0?m===`ready`?(0,J.jsx)($e,{children:v(`stream.ready`)}):null:(0,J.jsxs)(J.Fragment,{children:[ee.projectWork.length>0?(0,J.jsxs)(`section`,{"data-project-work":!0,className:`mx-auto w-full max-w-full border-b border-line/60 lg:max-w-[61.8vw]`,children:[(0,J.jsxs)(`div`,{className:`flex h-10 items-center gap-2 border-b border-line/40 px-4 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink-faint`,children:[_===`zh-CN`?`项目工作进展`:`Project work progress`,(0,J.jsx)(`span`,{className:`font-mono font-normal tracking-normal`,children:ee.projectWork.length})]}),(0,J.jsx)(fu,{rows:ee.projectWork,live:k,followLatest:!0,activeRole:O?.role,activeTaskId:O?.taskId}),ee.projectDeliveries.map(e=>(0,J.jsx)(hu,{delivery:e,onOpen:d},e.delivery_id))]},`project-work`):null,ee.earlierReplies.map(e=>(0,J.jsx)(cu,{ev:e.ev,r:e.r,artifacts:l,onOpenArtifact:u},e.key)),ee.groups.map(e=>(0,J.jsx)(gu,{group:e,artifacts:l,onOpenArtifact:u,onOpenDelivery:d},e.key))]})})}),!y&&(0,J.jsx)(`button`,{onClick:()=>{x.current=!0,b(!0),T.current&&(T.current.scrollTo({top:T.current.scrollHeight,behavior:`auto`}),S.current=T.current.scrollTop)},"aria-label":v(`stream.jumpToLatest`),title:v(`stream.jumpToLatest`),className:`absolute bottom-4 left-1/2 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-line/60 bg-panel text-sm text-ink-dim shadow-glow transition-all duration-200 hover:border-ink-faint hover:text-ink`,children:`↓`})]})}function vu(e){return e.nativeEvent.isComposing||e.keyCode===229}var yu=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function bu(e){return yu[e%yu.length]}var xu=[{id:`status`,name:`/status`,argument:`none`,desc:`roles, queued work, journal, and health`,group:`Everyday`,kind:`panel`},{id:`roles`,name:`/roles`,argument:`none`,desc:`per-role backend / model / effort + live activity`,group:`Everyday`,kind:`panel`},{id:`journal`,name:`/journal`,arg:`[N]`,argument:`optional`,desc:`recent journal entries (default 10)`,group:`Everyday`,kind:`panel`},{id:`backlog`,name:`/backlog`,arg:`[all]`,argument:`optional`,desc:`pending tasks (all = incl. done/skipped)`,group:`Everyday`,kind:`panel`},{id:`artifacts`,name:`/artifacts`,argument:`none`,desc:`result files the Reviewer has checked (Enter previews)`,group:`Everyday`,kind:`panel`},{id:`artifact`,name:`/artifact`,arg:``,argument:`required`,desc:`preview one reviewed result file`,group:`Everyday`,kind:`panel`},{id:`events`,name:`/events`,arg:`[filter] [query]`,argument:`optional`,desc:`search feed: all / watch / milestones / messages`,group:`Everyday`,kind:`panel`},{id:`find`,name:`/find`,arg:``,argument:`required`,desc:`search the current event buffer`,group:`Everyday`,kind:`panel`},{id:`cancel`,name:`/cancel`,argument:`none`,desc:`stop waiting for the current Manager reply`,group:`Everyday`,kind:`local`},{id:`ask`,name:`/ask`,arg:``,argument:`required`,desc:`answer inline — no task queued, no Planner/Engineer/Reviewer`,aliases:[`/chat`],group:`Everyday`,kind:`action`},{id:`crystalpilot`,name:`/crystalpilot`,arg:`[status|off|use ]`,argument:`optional`,desc:`enable crystallography tools in this Argus conversation`,group:`Everyday`,kind:`action`},{id:`task`,name:`/task`,arg:``,argument:`required`,desc:`queue work directly`,aliases:[`/add`],group:`Task management`,kind:`action`},{id:`plan`,name:`/plan`,arg:``,argument:`required`,desc:`preview a Planner-authored execution plan`,group:`Task management`,kind:`action`},{id:`rewrite`,name:`/rewrite`,arg:`[text]`,argument:`optional`,desc:`let the Manager rewrite your prompt before sending`,aliases:[`/refine`],group:`Task management`,kind:`action`},{id:`nudge`,name:`/nudge`,arg:``,argument:`required`,desc:`inject guidance into the running mission`,aliases:[`/inject`,`/notify`],group:`Task management`,kind:`action`},{id:`abort`,name:`/abort`,argument:`none`,desc:`immediately stop the running mission`,group:`Task management`,kind:`action`},{id:`note`,name:`/note`,arg:``,argument:`required`,desc:`append a manual note to the timeline`,group:`Task management`,kind:`action`},{id:`done`,name:`/done`,arg:``,argument:`required`,desc:`mark a task done`,group:`Task management`,kind:`action`},{id:`skip`,name:`/skip`,arg:``,argument:`required`,desc:`skip a task`,aliases:[`/rm`],group:`Task management`,kind:`action`},{id:`stop`,name:`/stop`,arg:``,argument:`required`,desc:`stop a task's auto-iteration`,group:`Task management`,kind:`action`},{id:`item`,name:`/item`,arg:``,argument:`required`,desc:`inspect a full task contract`,group:`Task management`,kind:`panel`},{id:`run`,name:`/run`,argument:`none`,desc:`return to the always-live mission feed`,group:`Task management`,kind:`local`},{id:`new`,name:`/new`,arg:`[objective]`,argument:`optional`,desc:`review, create, and switch to a fresh conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`daemons`,name:`/daemons`,arg:`[query]`,argument:`optional`,desc:`find every session + switch or create`,group:`Sessions & diagnostics`,kind:`panel`},{id:`resume`,name:`/resume`,arg:`[list|]`,argument:`optional`,desc:`switch to another project/session`,group:`Sessions & diagnostics`,kind:`action`},{id:`attach`,name:`/attach`,arg:``,argument:`required`,desc:`follow another project (read the stream)`,group:`Sessions & diagnostics`,kind:`action`},{id:`rename`,name:`/rename`,arg:``,argument:`required`,desc:`rename the current conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`doctor`,name:`/doctor`,argument:`none`,desc:`diagnose 'why isn't anything running'`,group:`Sessions & diagnostics`,kind:`panel`},{id:`backend`,name:`/backend`,arg:`[codex|claude|copilot|cursor|opencode|pi|grok|qoder|dsh]`,argument:`optional`,desc:`view or change the shared runner backend`,group:`Configuration`,kind:`action`},{id:`config`,name:`/config`,arg:`[key=value …]`,argument:`optional`,desc:`view or change runtime settings`,group:`Configuration`,kind:`panel`},{id:`identity`,name:`/identity`,arg:`[set ]`,argument:`optional`,desc:`view or replace the operator identity card`,group:`Configuration`,kind:`panel`},{id:`reset`,name:`/reset`,argument:`none`,desc:`drop the warm Manager conversation context`,group:`Configuration`,kind:`action`},{id:`skills`,name:`/skills`,arg:`[ls|promote ]`,argument:`optional`,desc:`inspect or promote runtime skills`,group:`Configuration`,kind:`action`},{id:`clear`,name:`/clear`,argument:`none`,desc:`clear the event feed view`,group:`Other`,kind:`local`},{id:`reconnect`,name:`/reconnect`,argument:`none`,desc:`reconnect the live event stream`,group:`Other`,kind:`local`},{id:`help`,name:`/help`,argument:`none`,desc:`keys + full command reference`,aliases:[`/?`,`/commands`],group:`Other`,kind:`local`},{id:`quit`,name:`/quit`,argument:`none`,desc:`leave the cockpit (background work keeps running)`,aliases:[`/exit`,`/q`],group:`Other`,kind:`local`}];new Map(xu.map(e=>[e.id,e]));var Su=new Map;for(let e of xu)for(let t of[e.name,...e.aliases??[]])Su.set(t.toLowerCase(),e);function Cu(e){return e.argument===`required`}var wu=/^\/[A-Za-z0-9_-]+$/;function Tu(e){if(!e.startsWith(`/`))return!1;let t=e.indexOf(` `),n=t===-1?e:e.slice(0,t);return wu.test(n)}function Eu(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.slice(1).includes(`/`)}function Du(e){if(!Eu(e))return[];let t=e.toLowerCase(),n=new Set,r=[];for(let e of xu)[e.name,...e.aliases??[]].some(e=>e.toLowerCase().startsWith(t))&&!n.has(e.name)&&(n.add(e.name),r.push(e));return r.sort((e,n)=>Number(Ou(n,t))-Number(Ou(e,t)))}function Ou(e,t){return[e.name,...e.aliases??[]].some(e=>e.toLowerCase()===t)}function ku(e){return e.arg?`${e.name} `:e.name}function Au(e){let t=e.trim();if(!t)return{filter:`all`,query:``};let[n,...r]=t.split(/\s+/);return n.toLowerCase()===`watch`?{filter:`attention`,query:r.join(` `)}:Fe.includes(n.toLowerCase())?{filter:n.toLowerCase(),query:r.join(` `)}:{filter:`all`,query:t}}function ju(e){if(!Tu(e))return null;let t=e.indexOf(` `),n=(t===-1?e:e.slice(0,t)).toLowerCase(),r=t===-1?``:e.slice(t+1).trim(),i=Su.get(n)??null;return{cmd:i,name:i?i.name:n,rest:r}}function Mu(e){let t=e.toLowerCase(),n=null,r=0;for(let e of Su.keys()){let i=Nu(t,e);i>r&&(r=i,n=Su.get(e).name)}return r>=.6?n:null}function Nu(e,t){return 1-Pu(e,t)/(Math.max(e.length,t.length)||1)}function Pu(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},(e,t)=>[t,...Array(r).fill(0)]);for(let e=0;e<=r;e+=1)i[0][e]=e;for(let a=1;a<=n;a+=1)for(let n=1;n<=r;n+=1)i[a][n]=Math.min(i[a-1][n]+1,i[a][n-1]+1,i[a-1][n-1]+(e[a-1]===t[n-1]?0:1));return i[n][r]}function Fu(e,t=!1,n=!1){return(t||n)&&e.toLowerCase()===`r`}var Iu={Everyday:`常用`,"Task management":`任务管理`,"Sessions & diagnostics":`会话与诊断`,Configuration:`配置`,Other:`其他`},Lu={crystalpilot:`在当前 Argus 会话启用晶体学工具,保持原生界面`,status:`查看角色、队列、日志和健康状态`,roles:`查看各角色的后端、模型、推理强度和实时活动`,journal:`查看近期日志(默认 10 条)`,backlog:`查看待处理任务(all 包含已完成和已跳过)`,artifacts:`查看 Reviewer 批准的结果文件(按 Enter 预览)`,artifact:`预览一个已批准的结果文件`,events:`搜索动态:all / watch / milestones / messages`,find:`搜索当前事件缓冲区`,cancel:`停止等待当前 Manager 回复`,ask:`直接回答,不排任务、不走 Planner/Engineer/Reviewer`,task:`直接加入任务队列`,plan:`预览 Planner 编写的执行计划`,rewrite:`让 Manager 在发送前改写提示词`,nudge:`向正在运行的任务注入指导`,abort:`立即终止正在运行的任务`,note:`向时间线添加手动备注`,done:`将任务标记为完成`,skip:`跳过任务`,stop:`停止任务的自动迭代`,item:`查看完整任务契约`,run:`返回持续更新的任务动态`,new:`检查、创建并切换到新会话`,daemons:`查找全部会话并切换或创建`,resume:`切换到其他项目或会话`,attach:`跟随其他项目并读取其动态`,rename:`重命名当前会话`,doctor:`诊断为什么没有任务运行`,backend:`查看或更改共享 Runner 后端`,config:`查看或更改运行时设置`,identity:`查看或替换操作者身份卡`,reset:`清除 Manager 的热会话上下文`,skills:`查看或提升运行时 Skill`,clear:`清空事件动态视图`,reconnect:`重新连接实时动态`,help:`查看快捷键和完整命令参考`,quit:`离开控制台(后台工作继续运行)`};function Ru(e,t){return t===`zh-CN`?Lu[e.id]:e.id===`reconnect`?`reconnect live activity`:e.desc}function zu(e,t){return t===`zh-CN`?Iu[e.group]:e.group}function Bu(e,t){let n=new Map;for(let r of e){let e=zu(r,t),i=r.aliases?.length?` (= ${r.aliases.join(`, `)})`:``,a=`${r.name}${r.arg?` ${r.arg}`:``}${i}`;n.has(e)||n.set(e,[]),n.get(e).push({label:a,desc:Ru(r,t)})}return[...n.entries()].map(([e,t])=>({group:e,rows:t}))}var Vu=`slash-completion-listbox`;function Hu(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function Uu(e){return`slash-completion-option-${e}`}function Wu({query:e,selected:t,onSelect:n}){let{locale:r,t:i}=z(),a=Du(e);if(a.length===0)return null;let o=a.slice(0,8),s=Hu(t,o.length);return(0,J.jsx)(`div`,{id:Vu,role:`listbox`,"aria-label":i(`slash.suggestions`),className:`slash-completion-menu scroll-thin border-b border-line/40`,children:o.map((e,t)=>(0,J.jsxs)(`button`,{id:Uu(e.id),type:`button`,role:`option`,"aria-selected":t===s,onPointerDown:e=>{e.preventDefault(),n(t)},className:`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm transition-colors ${t===s?`bg-blue/10 text-ink`:`text-ink-dim hover:bg-line/20`}`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-blue`,children:e.name}),e.arg?(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-ink-faint`,children:e.arg}):null,(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:Ru(e,r)})]},e.id))})}var Gu=32e3,Ku=10485760,qu=26214400,Ju=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.pdf`,`.md`,`.markdown`,`.txt`,`.json`,`.csv`].join(`,`),Yu={".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".webp":`image/webp`,".pdf":`application/pdf`,".md":`text/markdown`,".markdown":`text/markdown`,".txt":`text/plain`,".json":`application/json`,".csv":`text/csv`};function Xu(e){let t=String(e||``).trim().toLowerCase(),n=t.lastIndexOf(`.`);return n>=0?t.slice(n):``}function Zu(e){return Yu[Xu(e.name)]||String(e.type||``).split(`;`,1)[0].trim()||`application/octet-stream`}function Qu(e){return Object.hasOwn(Yu,Xu(e.name))}function $u(e){return Zu(e).startsWith(`image/`)}function ed(e){return[e.name,String(e.size),Zu(e),String(e.lastModified??``)].join(`::`)}function td(e,t){let n=[],r=[],i=new Set(e.map(ed)),a=e.reduce((e,t)=>e+Math.max(0,t.size||0),0),o=e.length;for(let e of t){let t=ed(e);if(!i.has(t)){if(i.add(t),!Qu(e)){r.push({code:`unsupported`,fileName:e.name});continue}if(o>=5){r.push({code:`too-many`,limitCount:5});continue}if(e.size>10485760){r.push({code:`too-large`,fileName:e.name,limitBytes:Ku});continue}if(a+e.size>26214400){r.push({code:`too-large-total`,limitBytes:qu});continue}n.push(e),a+=e.size,o+=1}}return{accepted:n,issues:r}}function nd(e){return e?Array.from(e):[]}function rd(e){return nd(e?.types).map(e=>String(e)).includes(`Files`)||id(e).length>0}function id(e){let t=nd(e?.files).filter(e=>e instanceof File);if(t.length)return t;let n=[];for(let t of nd(e?.items)){if(String(t?.kind||``)!==`file`||typeof t?.getAsFile!=`function`)continue;let e=t.getAsFile();e instanceof File&&n.push(e)}return n}function ad({file:e,removeLabel:t,onRemove:n,disabled:r=!1}){let[i,a]=(0,G.useState)(``);return(0,G.useEffect)(()=>{if(!$u(e)||typeof URL>`u`||typeof URL.createObjectURL!=`function`){a(``);return}let t=URL.createObjectURL(e);return a(t),()=>URL.revokeObjectURL(t)},[e]),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-2xl border border-line/50 bg-panel/80 px-2.5 py-2 text-xs shadow-[0_10px_24px_-20px_rgb(0_0_0/0.2)]`,children:[i?(0,J.jsx)(`img`,{src:i,alt:``,className:`h-10 w-10 shrink-0 rounded-xl border border-line/40 object-cover`}):null,(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate font-medium text-ink`,title:e.name,children:e.name}),(0,J.jsxs)(`div`,{className:`truncate text-ink-faint`,children:[yt(e.size),` · `,Zu(e)]})]}),(0,J.jsx)(`button`,{type:`button`,onClick:n,disabled:r,"aria-label":t,title:t,className:`send-control h-8 w-8 shrink-0 rounded-full border-line/60 text-ink-faint hover:border-err/50 hover:bg-err/10 hover:text-err`,children:`×`})]})}function od({value:e,onChange:t,inputRef:n,fileInputRef:r,onFiles:i,inputProps:a,onSend:o,onCancel:s,pending:c,disabled:l=!1,controls:u}){let{t:d,locale:f}=z(),p=f===`zh-CN`,{refs:m,text:h}=io(e),g=e.length>Gu;return(0,G.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.getClientRects().length&&(e.style.height=`0px`,e.style.height=`${Math.min(132,Math.max(28,e.scrollHeight))}px`)};t();let r=e.clientWidth,i=new ResizeObserver(()=>{e.clientWidth!==r&&(r=e.clientWidth,t())});return i.observe(e),()=>i.disconnect()},[n,h]),(0,J.jsxs)(`div`,{className:`composer-surface`,"data-pending":c,children:[m.length>0&&(0,J.jsx)(`div`,{className:`map-reference-chips`,children:m.map((e,n)=>(0,J.jsxs)(`span`,{children:[(0,J.jsxs)(`span`,{children:[p?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":p?`移除引用`:`Remove reference`,onClick:()=>t(m.filter((e,t)=>t!==n).map(ro).join(``)+h),children:(0,J.jsx)(Je,{size:12})})]},`${e.task_id}:${e.step_id}:${n}`))}),(0,J.jsxs)(`form`,{className:`map-composer`,onSubmit:e=>{e.preventDefault(),!c&&!l&&!g&&o()},children:[(0,J.jsx)(`input`,{ref:r,type:`file`,multiple:!0,accept:Ju,hidden:!0,disabled:l||c,onChange:i}),(0,J.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":d(`chat.attach`),title:d(`chat.attach`),disabled:l||c,onClick:()=>r.current?.click(),children:(0,J.jsx)(un,{size:19,strokeWidth:1.6})}),(0,J.jsx)(`textarea`,{...a,ref:n,rows:1,value:h,disabled:l,onChange:e=>t(m.map(ro).join(``)+e.target.value),onKeyDown:e=>{if(g&&e.key===`Enter`&&!e.shiftKey&&!vu(e)){e.preventDefault();return}a.onKeyDown?.(e),!(e.defaultPrevented||vu(e))&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),!c&&!l&&o())}}),(0,J.jsx)(`button`,{type:c?`button`:`submit`,onClick:c?s:void 0,disabled:l||!c&&(!h.trim()||g),"aria-label":c?p?`停止回复`:`Stop reply`:p?`发送消息`:`Send message`,className:`map-send ${c?`is-pending`:``}`,children:c?(0,J.jsx)(gn,{size:15}):(0,J.jsx)(Ht,{size:20})})]}),g&&(0,J.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:d(`chat.messageTooLong`)}),u?(0,J.jsx)(`div`,{className:`composer-controls`,children:u}):null]})}var sd=[`auto`,`task`,`chat`];function cd({value:e,onChange:t,disabled:n=!1,tabIndex:r}){let{t:i}=z(),a={auto:i(`chat.routeAuto`),task:i(`chat.routeTask`),chat:i(`chat.routeChat`)};return(0,J.jsx)(`div`,{className:`route-seg`,role:`radiogroup`,"aria-label":i(`chat.routeLabel`),title:i(`chat.routeHint`),children:sd.map(i=>(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===i,disabled:n,tabIndex:r,onClick:()=>{i!==e&&t(i)},children:a[i]},i))})}function ld(e,t){if(!t.onRewrite||!Fu(e.key,e.ctrlKey,e.metaKey))return!1;e.preventDefault();let n=t.value.trim();return n&&!t.disabled&&!t.pending&&!t.rewriting&&t.onRewrite(n),!0}function ud({value:e,onChange:t,onSend:n,onCancel:r,disabled:i,pending:a,focusSignal:o,attachments:s,onAttachmentsChange:c,onRewrite:l,rewriting:u=!1,slashSelection:d,onSlashSelectionChange:f,routeOverride:p=`auto`,onRouteOverrideChange:m,footer:h}){let{t:g}=z(),_=(0,G.useRef)(null),v=(0,G.useRef)(null),y=(0,G.useRef)(!1),[b,x]=(0,G.useState)(0),[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(``),[E,D]=(0,G.useState)(0),[O,k]=(0,G.useState)(!1),[A,j]=(0,G.useState)(!1);(0,G.useEffect)(()=>{a||j(!1)},[a]),(0,G.useEffect)(()=>{if(!a&&!u)return;let e=setInterval(()=>x(e=>e+1),1e3);return()=>clearInterval(e)},[a,u]),(0,G.useEffect)(()=>{o&&!i&&_.current?.focus()},[o,i]);let M=Du(e).slice(0,8),ee=M.length>0&&!S,N=ee?Hu(d,M.length):0,P=ee?M[N]:void 0,F=e=>{let n=M[e];n&&(t(ku(n)),n.argument===`none`&&C(!0),f(0),_.current?.focus())},te=async()=>{if(!e.trim()||i||u||y.current)return;let t=a;if(t&&s.length){T(g(`chat.attachWhileRunning`));return}y.current=!0;try{(t?await n(e.trim(),[],void 0,{whileRunning:!0}):await n(e.trim(),s))&&(f(0),C(!1),T(``),j(t))}finally{y.current=!1}},ne=e=>{if(!e.length||i||a||y.current)return;let{accepted:t,issues:n}=td(s,e);t.length&&c([...s,...t]),T(n.map(e=>e.code===`unsupported`?g(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?g(`chat.attachTooLarge`,{name:e.fileName,size:yt(e.limitBytes)}):e.code===`too-many`?g(`chat.attachTooMany`,{count:e.limitCount}):g(`chat.attachTotalTooLarge`,{size:yt(e.limitBytes)})).join(` `))},re=(e,t)=>{rd(e.dataTransfer)&&(e.preventDefault(),D(e=>Math.max(0,e+t)))};return(0,J.jsxs)(`div`,{className:`conversation-composer flex flex-col ${E>0?`rounded-3xl ring-2 ring-manager/60`:``}`,"data-compact":!O&&!e.trim()&&!s.length&&!a&&!u&&!w&&!E,onFocusCapture:()=>k(!0),onBlurCapture:e=>k(e.currentTarget.contains(e.relatedTarget)),onDragEnter:e=>re(e,1),onDragOver:e=>re(e,0),onDragLeave:e=>re(e,-1),onDrop:e=>{rd(e.dataTransfer)&&(e.preventDefault(),D(0),ne(id(e.dataTransfer)))},children:[a?(0,J.jsx)(`div`,{className:`px-3 py-2 text-xs text-ink-faint`,role:`status`,children:g(A?`chat.queuedWhileRunning`:`chat.stopWaitingHint`)}):null,ee?(0,J.jsx)(Wu,{query:e,selected:N,onSelect:F}):null,s.length||w||E>0?(0,J.jsxs)(`div`,{className:`px-3 py-2`,children:[E>0?(0,J.jsx)(`div`,{className:`mb-2 text-xs text-manager`,children:g(`chat.attachDrop`)}):null,(0,J.jsx)(`div`,{className:`map-attachment-tray`,children:s.map((e,t)=>(0,J.jsx)(ad,{file:e,removeLabel:g(`chat.attachRemove`,{name:e.name}),onRemove:()=>{c(s.filter(t=>t!==e)),T(``)}},`${e.name}:${e.lastModified}:${t}`))}),(0,J.jsx)(`div`,{className:`text-xs ${w?`text-err`:`text-ink-faint`}`,children:w||g(`chat.attachHint`,{count:5,perFile:yt(10485760),total:yt(26214400)})})]}):null,(0,J.jsx)(od,{value:e,onChange:e=>{t(e),f(0),C(!1)},inputRef:_,fileInputRef:v,onFiles:e=>{ne(Array.from(e.target.files??[])),e.target.value=``},onSend:()=>void te(),onCancel:r,pending:a,disabled:i,inputProps:{onPaste:e=>{let t=id(e.clipboardData);t.length&&(e.preventDefault(),ne(t))},onKeyDown:t=>{vu(t)||ld(t,{value:e,disabled:i,pending:a,rewriting:u,onRewrite:l})||(ee?t.key===`ArrowDown`||t.key===`ArrowUp`?(t.preventDefault(),f(Hu(N+(t.key===`ArrowDown`?1:-1),M.length))):t.key===`Tab`||t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),F(N)):t.key===`Escape`&&(t.preventDefault(),C(!0)):t.key===`Escape`&&a?(t.preventDefault(),r()):t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),te()))},"aria-label":g(`chat.messageArgus`),"aria-keyshortcuts":`Control+R Meta+R`,"aria-controls":ee?Vu:void 0,"aria-expanded":ee,"aria-activedescendant":P?Uu(P.id):void 0,placeholder:g(i?`chat.selectSession`:`chat.placeholder`)},controls:(0,J.jsxs)(J.Fragment,{children:[m?(0,J.jsx)(cd,{value:p,onChange:m,disabled:i||a}):null,l&&e.trim()?(0,J.jsx)(`button`,{type:`button`,onClick:()=>l(e.trim()),disabled:i||a||u,title:`Ctrl/⌘+R · ${g(`chat.rewriteHint`)}`,"aria-label":g(`chat.rewriteLabel`),"aria-keyshortcuts":`Control+R Meta+R`,children:u?`${bu(b)} ${g(`chat.rewriting`)}`:g(`chat.rewrite`)}):null]})}),h]})}function dd(e,t,n,r=`en`){return e.map(e=>({id:`command-${e.id}`,label:Ru(e,r),hint:`${e.name}${e.arg?` ${e.arg}`:``}`,group:zu(e,r),keywords:[e.name,...e.aliases??[]].join(` `),run:()=>Cu(e)?n(`${e.name} `):t(e.name)}))}function fd(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=`${e.label} ${e.group} ${e.hint??``} ${e.keywords??``}`.toLowerCase();return n.every(e=>t.includes(e))}):e}function pd({open:e,onClose:t,items:n}){let{t:r}=z(),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(0),c=(0,G.useRef)(null),l=(0,G.useRef)(null);(0,G.useEffect)(()=>{e&&(a(``),s(0),setTimeout(()=>c.current?.focus(),0))},[e]);let u=(0,G.useMemo)(()=>fd(n,i),[i,n]);(0,G.useEffect)(()=>{o>=u.length&&s(Math.max(0,u.length-1))},[u.length,o]),(0,G.useEffect)(()=>{l.current?.scrollIntoView({block:`nearest`})},[e,i,o]);let d=e=>{e&&(t(),e.run())},f=e=>{vu(e)||(e.key===`ArrowDown`?(e.preventDefault(),u.length&&s(e=>Math.min(u.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),d(u[o])))},p=[];for(let e of u){let t=p.find(t=>t.name===e.group);t||(t={name:e.group,items:[]},p.push(t)),t.items.push(e)}let m=-1;return(0,J.jsxs)(dt,{open:e,onClose:t,label:r(`help.palette`),width:`max-w-xl`,align:`top`,children:[(0,J.jsx)(`div`,{className:`border-b border-line px-4 py-3`,children:(0,J.jsx)(`input`,{ref:c,value:i,onChange:e=>a(e.target.value),onKeyDown:f,placeholder:r(`palette.placeholder`),role:`combobox`,"aria-expanded":e,"aria-autocomplete":`list`,"aria-controls":`command-palette-results`,"aria-activedescendant":u[o]?`palette-${u[o].id}`:void 0,className:`w-full bg-transparent font-mono text-sm text-ink outline-none placeholder:text-ink-faint`})}),(0,J.jsxs)(`div`,{id:`command-palette-results`,role:`listbox`,className:`max-h-[52vh] overflow-y-auto scroll-thin py-1.5`,children:[u.length===0&&(0,J.jsx)(`div`,{className:`px-4 py-6 text-center text-xs text-ink-faint`,children:r(`palette.noMatches`)}),p.map(e=>(0,J.jsxs)(`div`,{className:`mb-1`,children:[(0,J.jsx)(`div`,{className:`px-4 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.name}),e.items.map(e=>{m++;let t=m===o;return(0,J.jsxs)(`button`,{id:`palette-${e.id}`,ref:t?l:void 0,role:`option`,"aria-selected":t,onMouseEnter:()=>s(u.indexOf(e)),onClick:()=>d(e),className:`flex w-full items-center justify-between px-4 py-1.5 text-left text-sm transition-colors ${t?`bg-blue-deep/20 text-ink`:`text-ink-dim hover:bg-panel/60`}`,children:[(0,J.jsx)(`span`,{children:e.label}),e.hint&&(0,J.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:e.hint})]},e.id)})]},e.name))]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-4 py-1.5 text-[10px] text-ink-faint`,children:[(0,J.jsx)(`span`,{children:r(`palette.navigate`)}),(0,J.jsx)(`span`,{children:r(`palette.run`)}),(0,J.jsx)(`span`,{children:r(`palette.close`)})]})]})}var md=[{keys:`⌘K / Ctrl+K`,desc:`help.palette`},{keys:`⌘B / Ctrl+B`,desc:`help.sessions`},{keys:`⌘J / Ctrl+J`,desc:`help.managerChat`},{keys:`⌘R / Ctrl+R`,desc:`help.rewrite`},{keys:`⌘T / Ctrl+T`,desc:`help.reasoning`},{keys:`⌘. / Ctrl+.`,desc:`help.kiosk`},{keys:`/`,desc:`help.composer`},{keys:`↵ Enter`,desc:`help.send`},{keys:`Shift+Enter`,desc:`help.newline`},{keys:`?`,desc:`help.thisHelp`},{keys:`Esc`,desc:`help.escape`}];function hd({open:e,onClose:t}){let{locale:n,t:r}=z(),i=Bu(xu,n);return(0,J.jsxs)(dt,{open:e,onClose:t,label:r(`help.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`help.title`)}),(0,J.jsxs)(`div`,{className:`max-h-[70dvh] overflow-y-auto scroll-thin`,children:[(0,J.jsx)(`div`,{className:`p-4`,children:md.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between py-1.5`,children:[(0,J.jsx)(`span`,{className:`text-sm text-ink-dim`,children:r(e.desc)}),(0,J.jsx)(`kbd`,{className:`rounded border border-line bg-surface px-2 py-0.5 font-mono text-[11px] text-ink`,children:e.keys})]},e.keys))}),(0,J.jsxs)(`div`,{className:`border-t border-line px-4 pb-4 pt-3`,children:[(0,J.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-ink-faint`,children:r(`help.commands`)}),i.map(e=>(0,J.jsxs)(`div`,{className:`mb-4`,children:[(0,J.jsx)(`p`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.group}),e.rows.map(e=>(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1`,children:[(0,J.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-ink`,children:e.label}),(0,J.jsx)(`span`,{className:`text-right text-xs text-ink-dim`,children:e.desc})]},e.label))]},e.group))]})]})]})}var gd=[[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]];function _d({sid:e,config:t,onSaved:n}){let{locale:r}=z(),i=r===`zh-CN`,a=t.roles.find(e=>e.role===`manager`),o=t.roles.find(e=>e.role===`engineer`),s=a&&a.backend!==`memory`?a:o,c=new Map(t.operator_knobs.map(e=>[e.name,e.value])),l=c.get(`ARGUS_SKILL_MAP_MODEL`)||`auto`,[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(``),m=(t.model_options??[]).map(e=>e.model);l!==`auto`&&!m.includes(l)&&m.unshift(l);let h=async(t,r)=>{if(!u){d(!0),p(``);try{await R.setConfig(e,t,r),await n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},g=i?`自动(轻量)`:`Auto (light)`,_=i?`跟随前台模型`:`Follow the front-door model`,v=[{name:`ARGUS_SKILL_MAP_REASONING_EFFORT`,label:i?`讲解生成强度`:`Explanation effort`,follow:g},{name:`ARGUS_SKILL_MAP_REVIEW_REASONING_EFFORT`,label:i?`讲解复核强度`:`Explanation review effort`,follow:i?`自动(中)`:`Auto (medium)`}];return(0,J.jsxs)(`section`,{className:`map-model-settings rounded-lg border border-line glass-card p-3`,"aria-label":i?`地图模型`:`Map model`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:i?`地图模型`:`Map model`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:i?`地图讲解与摘要用的模型;默认沿用前台(经理)的接入与账号,以低强度起草,不占用科研的推理预算。可以选一个便宜的。`:`The model that writes map explanations and summaries. By default it uses the front-door (Manager) runner and account at a light effort, not the research budget. A cheaper one is fine.`}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[s?.backend_label,` · `,s?.model||(i?`接入默认模型`:`Runner default model`)]}),t.map_model?.note&&(0,J.jsx)(`p`,{role:`status`,"data-map-model-note":!0,className:`mt-1 text-xs text-warn`,children:i?`已改用自动:所选摘要模型在当前接入(${t.map_model.backend})下不可用。`:t.map_model.note}),(0,J.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[i?`摘要模型`:`Summary model`,(0,J.jsxs)(`select`,{value:l,disabled:u,"aria-label":i?`摘要模型`:`Summary model`,onChange:e=>void h(`ARGUS_SKILL_MAP_MODEL`,e.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:_}),m.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]}),v.map(e=>(0,J.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[e.label,(0,J.jsxs)(`select`,{value:c.get(e.name)||`auto`,disabled:u,onChange:t=>void h(e.name,t.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:e.follow}),gd.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:i?t:e},e))]})]},e.name)),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`复核用于检查讲解文字,保存后对新发起的讲解生效。`:`The review checks explanation text. Changes apply to newly requested explanations.`}),f&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:f})]})}function vd({sid:e,primaryModel:t}){let{locale:n}=z(),r=n===`zh-CN`,i=(e,t)=>r?e:t,a=M(),o=A({queryKey:[`advisor-settings`,e],queryFn:({signal:t})=>R.advisorSettings(e,t),enabled:!!e,retry:!1}),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(!1),_=(0,G.useRef)(e);_.current=e,(0,G.useEffect)(()=>{c(o.data?.saved??null);let e=o.data?.saved;u(!!(e?.model&&!o.data?.model_options?.some(t=>t.backend===e.backend&&t.model===e.model)))},[e,o.data]),(0,G.useEffect)(()=>{m(``),g(!1),f(!1)},[e]);let v=e=>{c(t=>t&&{...t,...e}),g(!1)},y=o.data?.model_options??[],b=(e,t)=>JSON.stringify([e,t]),x=s&&y.some(e=>e.backend===s.backend&&e.model===s.model)?b(s.backend,s.model):``,S=async()=>{if(!s||d)return;let t=e;f(!0),m(``),g(!1);try{let{schema_version:e,...n}=s,r=await R.saveAdvisorSettings(t,{...n,model:n.model.trim()});a.setQueryData([`advisor-settings`,t],r),_.current===t&&g(!0)}catch(e){_.current===t&&m(e instanceof Error?e.message:String(e))}finally{_.current===t&&f(!1)}};return(0,J.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,"aria-label":i(`顾问模型`,`Advisor model`),children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`顾问模型`,`Advisor model`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:i(`团队遇到难题时可以向它提问。只在咨询时调用,用量计入当前项目。`,`The team can consult this model on specific questions. It runs only when asked, and usage belongs to this project.`)}),t?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[i(`当前执行模型:`,`Current execution model: `),t]}):null,o.isPending?(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-ink-faint`,children:i(`正在读取设置…`,`Loading settings…`)}):o.isError?(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-err`,role:`alert`,children:[i(`顾问设置读取失败。`,`Could not load advisor settings.`),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void o.refetch(),className:`underline`,children:i(`重试`,`Retry`)})]}):s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:s.enabled,disabled:d,onChange:e=>v({enabled:e.target.checked})}),i(`允许团队咨询顾问`,`Let the team consult the advisor`)]}),(0,J.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[y.length>0?(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim sm:col-span-2`,children:[i(`顾问使用的模型`,`Advisor model`),(0,J.jsxs)(`select`,{"aria-label":i(`选择顾问模型`,`Choose advisor model`),value:l?`custom`:x,disabled:d,onChange:e=>{if(e.target.value===`custom`){u(!0);return}let t=y.find(t=>b(t.backend,t.model)===e.target.value);t&&(u(!1),v({backend:t.backend,model:t.model}))},className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,disabled:!0,children:i(`选择模型`,`Choose a model`)}),y.map(e=>(0,J.jsx)(`option`,{value:b(e.backend,e.model),children:e.model},b(e.backend,e.model))),(0,J.jsx)(`option`,{value:`custom`,children:i(`配置其他模型…`,`Configure another model…`)})]})]}):null,l||y.length===0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`接入`,`Runner`),(0,J.jsxs)(`select`,{"aria-label":i(`顾问接入`,`Advisor runner`),value:s.backend,disabled:d,onChange:e=>v({backend:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:i(`选择接入`,`Choose a runner`)}),o.data?.supported_backends.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`顾问使用的模型`,`Advisor model ID`),(0,J.jsx)(`input`,{value:s.model,disabled:d,onChange:e=>v({model:e.target.value}),placeholder:i(`填写该接入的模型标识`,`Model ID for this runner`),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}):null,(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`思考强度`,`Reasoning effort`),(0,J.jsxs)(`select`,{"aria-label":i(`顾问思考强度`,`Advisor reasoning effort`),value:s.effort,disabled:d,onChange:e=>v({effort:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:i(`模型默认`,`Model default`)}),[[`minimal`,`最低`],[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]].map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:r?t:e},e))]})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`每次角色调用最多咨询`,`Consultations per role call`),(0,J.jsx)(`input`,{type:`number`,min:1,max:20,value:s.max_calls_per_turn,disabled:d,onChange:e=>v({max_calls_per_turn:Number(e.target.value)}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}),o.data?.overridden_fields.length?(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:[i(`运行服务另有指定设置;当前顾问:`,`The runtime overrides some saved settings. Current advisor: `),o.data.config.enabled?`${o.data.config.backend} · ${o.data.config.model}`:i(`未启用`,`disabled`)]}):null,(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void S(),disabled:d||s.enabled&&(!s.backend||!s.model.trim()),className:`rounded border border-line px-3 py-2 text-xs text-ink hover:border-blue disabled:opacity-40`,children:d?i(`保存中…`,`Saving…`):i(`保存顾问设置`,`Save advisor settings`)}),h?(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-dim`,children:i(`已保存,下次咨询生效。`,`Saved for the next consultation.`)}):null]}),p?(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:p}):null]}):null]})}var yd=[/^\[?\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[.,]\d+)?(?:Z|[+-]\d{2}:?\d{2})?\]?\s*/,/^\[?(?:INFO|WARNING|WARN|ERROR|DEBUG|CRITICAL|TRACE)\]?\s*[:\-|]?\s*/i,/^(?:\[\d+\]|[\w.]+:)\s+/];function bd(e){let t=e.trim();for(let e of yd)t=t.replace(e,``);return t.trim()}var xd=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`;function Sd(e,t=200){let n=String(e??``).split(/\r?\n/).map(bd).filter(e=>e&&!/^[-=_.\s]+$/.test(e));return n.length?xd(n[n.length-1],t):``}var Cd=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function wd(e){if(!e)return[];let t=e.provider??{},n=[],r=Cd(t.completed)??0,i=Cd(t.errors)??0;n.push({key:`calls`,value:String(r+i)}),n.push({key:`failed`,value:String(i)});let a=Cd(t.p95_duration_ms);return a&&a>0&&n.push({key:`slowest`,value:`${(a/1e3).toFixed(1)}s`}),n}var Td=[{name:`ARGUS_SKILL_MAX_ACTIVE_DAEMONS`,group:`Limits`,label:`Active daemon limit`,description:`Maximum background sessions running on this host.`},{name:`ARGUS_SKILL_SAFE_MODE`,group:`Safety`,label:`Safe mode`,description:`Enable extra-conservative runtime guardrails.`},{name:`ARGUS_SKILL_OPERATOR_AVAILABLE`,group:`Safety`,label:`Operator available`,description:`Off suppresses operator questions: Argus decides on recorded assumptions.`},{name:`ARGUS_SKILL_ENABLE_TELEGRAM`,group:`Interface`,label:`Telegram`,description:`Enable the Telegram notification bridge.`},{name:`ARGUS_SKILL_SHOW_REASONING`,group:`Interface`,label:`Show reasoning`,description:`Stream role reasoning into the cockpit activity view.`}];function Ed(e){let t=new Map(e.map(e=>[e.name,e]));return Td.flatMap(e=>{let n=t.get(e.name);return n?[{...n,group:e.group,label:e.label,doc:e.description}]:[]})}function Dd(e,t){let n=new URL(e),r=n.protocol===`https:`?`wss:`:`ws:`,i=encodeURIComponent(t);return{webApi:`${n.origin}/api`,eventStream:`${r}//${n.host}/api/projects/${i}/stream`,daemon:`local process · events.jsonl · no TCP port`}}var Od=`ARGUS_SKILL_OPERATOR_AVAILABLE`,kd=new Set([`0`,`false`,`no`,`off`,`disable`,`disabled`]);function Ad(e){let t=(e??[]).find(e=>e.name===Od);return!!(t&&kd.has(t.value.trim().toLowerCase()))}function jd(e){return e instanceof se?e.code===`trial_route_unavailable`||e.status===403||e.status===404:!1}function Md(e,t){let n=jd(e);return{text:t(n?`operations.unavailableHere`:`operations.requestFailed`),technical:e instanceof Error?e.message:String(e||``),refused:n}}var Nd={ARGUS_SKILL_MAX_ACTIVE_DAEMONS:{label:`settings.knob.activeDaemons`,doc:`settings.knob.activeDaemonsDoc`},ARGUS_SKILL_SAFE_MODE:{label:`settings.knob.safeMode`,doc:`settings.knob.safeModeDoc`},ARGUS_SKILL_OPERATOR_AVAILABLE:{label:`settings.knob.operatorAvailable`,doc:`settings.knob.operatorAvailableDoc`},ARGUS_SKILL_ENABLE_TELEGRAM:{label:`settings.knob.telegram`,doc:`settings.knob.telegramDoc`},ARGUS_SKILL_SHOW_REASONING:{label:`settings.knob.showReasoning`,doc:`settings.knob.showReasoningDoc`}},Pd={Limits:`settings.group.limits`,Safety:`settings.group.safety`,Interface:`settings.group.interface`};function Fd(e,t){let n=e.trim();return n===`not applicable for this model`?t(`settings.source.notApplicable`):n.startsWith(`capability vault`)?t(`settings.source.vaultDefault`):n.startsWith(`default`)?t(`settings.source.default`):n.startsWith(`persisted:`)||n===`persisted`?t(`settings.source.saved`):n.startsWith(`ARGUS_SKILL_`)||n===`env`?t(`settings.source.environment`):n.startsWith(`global:`)?t(`settings.source.hostConfig`):t(`settings.source.other`)}function Id(e,t){let n=e.value.trim().toLowerCase();return[`ARGUS_SKILL_SAFE_MODE`,`ARGUS_SKILL_OPERATOR_AVAILABLE`,`ARGUS_SKILL_ENABLE_TELEGRAM`,`ARGUS_SKILL_SHOW_REASONING`].includes(e.name)?t([`1`,`true`,`on`,`yes`].includes(n)?`settings.value.enabled`:`settings.value.disabled`):e.value}function Ld(e,t){let n={low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`}[e.toLowerCase()];return n?t(`settings.effort.${n}`):e}function Rd({message:e,retrying:t,onRetry:n,t:r}){return(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 px-4 py-8 text-center`,children:[(0,J.jsx)(`p`,{className:`text-sm text-err`,children:e}),(0,J.jsx)(`button`,{type:`button`,onClick:n,disabled:t,className:`rounded-md border border-err/40 px-3 py-1.5 text-xs font-medium text-err hover:bg-err/10 disabled:opacity-40`,children:r(t?`common.loading`:`common.retry`)})]})}function zd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a,isError:o,isFetching:s,refetch:c}=ye(e,t),l=!!(i&&(i.recommended||i.checks.length||i.log_tail.trim()));return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`doctor.title`),width:`max-w-3xl`,children:[(0,J.jsx)(lt,{title:r(`doctor.title`),sub:r(`doctor.subtitle`)}),(0,J.jsxs)(`div`,{className:`p-4`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!a&&o&&(0,J.jsx)(Rd,{message:r(`doctor.loadError`),retrying:s,onRetry:()=>void c(),t:r}),!a&&!o&&!l&&(0,J.jsx)($e,{children:r(`doctor.empty`)}),!a&&!o&&i?.recommended&&(0,J.jsxs)(`div`,{className:`mb-4 rounded-lg border border-gold/40 bg-gold/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-gold`,children:r(`doctor.recommended`)}),(0,J.jsx)(`div`,{className:`mt-1 text-sm text-ink`,children:i.recommended.name}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:i.recommended.detail}),i.recommended.fix&&(0,J.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap break-words rounded bg-bg p-2 font-mono text-xs text-blue-sky`,children:i.recommended.fix})]}),!a&&!o&&(0,J.jsx)(`div`,{className:`space-y-1.5`,children:(i?.checks??[]).map((e,t)=>(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-line/60 px-3 py-2`,children:[(0,J.jsx)(`span`,{className:e.ok?`text-ok`:`text-err`,children:e.ok?`✓`:`✗`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.name}),e.detail&&(0,J.jsx)(`div`,{className:`mt-0.5 text-[11px] text-ink-dim`,children:e.detail}),!e.ok&&e.fix&&(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words rounded bg-bg p-1.5 font-mono text-xs text-ink-dim`,children:e.fix})]})]},t))}),!a&&!o&&i?.log_tail?.trim()&&(0,J.jsxs)(`div`,{className:`mt-4`,children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`doctor.daemonLog`)}),(0,J.jsxs)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:[(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[r(`doctor.lastEntry`),` · `]}),Sd(i.log_tail)]}),(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:i.log_tail})})]})]})]})}function Bd({sid:e,open:t,onClose:n}){let{t:r}=z(),i=M(),{data:a,isLoading:s,isError:c,isFetching:l,refetch:u}=Me(e,t),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(!1),[b,x]=(0,G.useState)(``),[C,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)(``),[k,A]=(0,G.useState)(!1),[j,ee]=(0,G.useState)(``);(0,G.useEffect)(()=>{t||f(!1)},[t]),(0,G.useEffect)(()=>{!t||!a||(m(a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MODEL`)?.value??``),g(``))},[a,t]);let N=async()=>{await u(),await i.invalidateQueries({queryKey:[`map-copy`]})},P=br(a),F=xr(a),te=Sr(a),ne=e=>!e||(te?vr(te)===e:e===vr(P)),re=h||vr(P),ie=async t=>{if(!(_||ne(t))){v(!0),x(``),w(!1);try{await R.setConfig(e,`ARGUS_SKILL_RUNNER_BACKEND`,t),await N(),x(r(`settings.backendSwitched`,{backend:yr(t,r)}))}catch(e){w(!0),x(Md(e,r).text)}finally{v(!1)}}},I=async t=>{if(!_){v(!0),x(``),w(!1);try{await R.setConfig(e,`ARGUS_SKILL_MAP_MODEL`,t||`auto`),await N(),x(t&&t!==`auto`?r(`settings.mapModelSet`,{model:t}):r(`settings.mapModelFollows`))}catch(e){w(!0),x(Md(e,r).text)}finally{v(!1)}}},L=async()=>{if(!_){v(!0),x(``),w(!1);try{let t=p.trim()||`auto`;await R.setConfig(e,`ARGUS_SKILL_MODEL`,t,!0),await N(),x(r(`settings.modelAppliedToRoles`,{model:t}))}catch(e){w(!0),x(Md(e,r).text)}finally{v(!1)}}},ae=async t=>{if(t.preventDefault(),!(!T.trim()||!D.trim()||k)){A(!0),ee(``);try{await R.setConfig(e,T.trim(),D.trim()),await N(),ee(r(`settings.applied`))}catch(e){ee(Md(e,r).text)}finally{A(!1)}}},oe=Ed(a?.operator_knobs??[]).reduce((e,t)=>((e[t.group]??=[]).push(t),e),{}),se=Dd(window.location.origin,e),ce=!!(a&&(a.roles.length||a.operator_knobs.length));return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`common.settings`),width:`max-w-4xl`,children:[(0,J.jsx)(lt,{title:r(`common.settings`),sub:r(`settings.subtitle`)}),(0,J.jsxs)(`div`,{className:`p-4`,children:[s&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!s&&c&&(0,J.jsx)(Rd,{message:r(`settings.loadError`),retrying:l,onRetry:()=>void u(),t:r}),!s&&!c&&!ce&&(0,J.jsx)($e,{children:r(`settings.empty`)}),!s&&!c&&ce&&a&&(0,J.jsxs)(`div`,{className:`space-y-4`,children:[!a.trial_mode&&(0,J.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`settings.quickConfig`)}),(0,J.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.backend`)}),(0,J.jsxs)(`select`,{value:h||vr(P),disabled:_,onChange:e=>g(e.target.value),"aria-label":r(`settings.backend`),className:`h-8 min-w-44 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[vr(P)?null:(0,J.jsx)(`option`,{value:``,disabled:!0,children:P?r(`settings.backendUnsupported`,{backend:P}):r(`settings.backendUnavailable`)}),gr.map(e=>(0,J.jsx)(`option`,{value:e.value,children:r(e.label)},e.value))]}),(0,J.jsx)(`button`,{type:`button`,"data-apply-backend":!0,onClick:()=>{re&&ie(re)},disabled:_||ne(re),className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:r(`settings.applyModel`)}),F&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,"data-backend-source":F,children:r(`settings.backendSource.${F}`)}),!ne(re)&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-dim`,"data-backend-change":!0,children:te?r(`settings.backendWillReplace`,{saved:yr(te,r),backend:yr(re,r)}):r(`settings.backendWillSave`,{backend:yr(re,r)})})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.model`)}),(0,J.jsxs)(`select`,{value:p||`auto`,onChange:e=>m(e.target.value===`auto`?``:e.target.value),"aria-label":r(`settings.model`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:a.model_auto_resolves_to?`auto → ${a.model_auto_resolves_to}`:r(`settings.modelPlaceholder`)}),(()=>{let e=a.model_options??[],t=new Set(e.filter(e=>e.invalid).map(e=>e.model)),n=e.map(e=>e.model),i=p.trim();return i&&i!==`auto`&&!n.includes(i)&&(n.unshift(i),t.add(i)),n.map(e=>(0,J.jsx)(`option`,{value:e,children:t.has(e)?`${e} (${r(`settings.modelUnavailable`)})`:e},e))})()]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void L(),disabled:_,className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:r(`settings.applyModel`)})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.mapModel`)}),(0,J.jsxs)(`select`,{value:a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||`auto`,disabled:_,onChange:e=>void I(e.target.value),"aria-label":r(`settings.mapModel`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[(0,J.jsx)(`option`,{value:`auto`,children:r(`settings.mapModelFollows`)}),(()=>{let e=(a.model_options??[]).map(e=>e.model),t=a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||``;return t&&t!==`auto`&&!e.includes(t)&&e.unshift(t),e.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))})()]})]}),(a.model_options??[]).some(e=>e.offline)&&(0,J.jsx)(`p`,{className:`mt-1 text-[10px] text-ink-faint`,"data-model-offline":!0,children:r(`settings.modelOfflineList`)}),a.roles.some(e=>e.model&&p.trim()&&e.model!==p.trim())&&(0,J.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-ink-faint`,"data-role-models":!0,children:[r(`settings.rolesRunning`),` `,a.roles.map(e=>`${e.role} · ${e.model||`auto`}`).join(`,`),` — `,r(`settings.applyUnifies`)]}),b&&(0,J.jsx)(`div`,{role:C?`alert`:`status`,className:`mt-1.5 text-[10px] ${C?`text-err`:`text-ink-dim`}`,children:b})]}),a.trial_mode&&(0,J.jsx)(`section`,{className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,"aria-label":r(`settings.trialAccount`),children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:r(`settings.trialAccount`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:`GPT-5.5 · high`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:r(`settings.trialKeyHint`)})]}),Ar()&&(0,J.jsx)(`button`,{type:`button`,className:`compact-control px-3 py-2`,onClick:()=>{n(),jr()},children:r(`settings.changeTrialKey`)})]})}),d&&(0,J.jsx)(_d,{sid:e,config:a,onSaved:N}),d&&(0,J.jsx)(vd,{sid:e,primaryModel:a.roles.find(e=>e.role===`engineer`)?.model}),(0,J.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface/50`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":d,"aria-controls":`config-advanced-settings`,onClick:()=>f(e=>!e),className:`flex w-full items-center justify-between gap-3 px-3 py-3 text-left hover:bg-bg/30`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block text-xs font-semibold text-ink`,children:r(`settings.advanced`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-ink-faint`,children:r(`settings.advancedHint`)})]}),(0,J.jsx)(o,{icon:S,className:`text-xs text-ink-faint transition-transform ${d?`rotate-180`:``}`})]}),d&&(0,J.jsxs)(`div`,{id:`config-advanced-settings`,className:`space-y-4 border-t border-line/70 p-3`,children:[(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`settings.connection`)}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2 text-[10px] sm:grid-cols-[100px_minmax(0,1fr)]`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.webApi`)}),(0,J.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:se.webApi}),(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.eventStream`)}),(0,J.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:se.eventStream}),(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.taskDaemon`)}),(0,J.jsx)(`span`,{className:`text-ink-dim`,children:r(`settings.taskDaemonValue`)})]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>void ae(e),className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-blue`,children:r(`settings.overrideTitle`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[10px] text-ink-faint`,children:r(`settings.overrideHint`)}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,J.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:r(`settings.namePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),placeholder:r(`settings.valuePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{disabled:k||!T.trim()||!D.trim(),title:r(`settings.applyAdvanced`),"aria-label":r(`settings.applyAdvanced`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:k?`…`:(0,J.jsx)(o,{icon:y})})]}),j?(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-dim`,children:j}):null]}),a.roles.length>0&&(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(`settings.rolesTitle`)}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:a.roles.map(e=>(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:e.role===`curator`?r(`settings.role.curator`):zn(e.role,r)}),(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.backend_label})]}),(0,J.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px] text-ink-dim`,title:e.model,children:e.model}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:Fd(e.model_source,r)}),e.reasoning_effort&&(0,J.jsx)(`span`,{className:`ml-auto shrink-0`,style:{color:Ze(e.reasoning_effort)},children:Ld(e.reasoning_effort,r)})]}),(gt(e.role)||e.role===`curator`)&&(0,J.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-ink-faint`,children:gt(e.role)?Xe(e.role,r):r(`settings.role.curatorDoc`)})]},e.role))})]}),Object.keys(oe).length>0&&(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(`settings.rawConfig`)}),Object.entries(oe).map(([e,t])=>(0,J.jsxs)(`div`,{className:`mt-3 first:mt-0`,children:[(0,J.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(Pd[e])}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-line`,children:t.map((e,t)=>{let n=Nd[e.name],i=Id(e,r);return(0,J.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] ${t?`border-t border-line/60`:``}`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-dim`,children:r(n.label)}),(0,J.jsx)(`code`,{className:`mt-0.5 block break-all text-[9px] text-ink-faint`,children:e.name}),(0,J.jsx)(`div`,{className:`mt-1 text-[10px] leading-relaxed text-ink-faint`,children:r(n.doc)})]}),(0,J.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,J.jsxs)(`div`,{className:`text-[11px] text-ink`,children:[i,i!==e.value&&(0,J.jsxs)(`code`,{className:`ml-1 text-[9px] text-ink-faint`,children:[`(`,e.value,`)`]})]}),(0,J.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Fd(e.source,r)})]})]},e.name)})})]},e))]}),(0,J.jsxs)(`p`,{className:`text-[10px] text-ink-faint`,children:[r(`settings.footer`),` `,(0,J.jsx)(`code`,{children:`argus --config-help`}),`.`]})]})]})]})]})]})}function Vd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a,refetch:s}=be(e,t),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``);(0,G.useEffect)(()=>{t&&i!=null&&l(i)},[i,t]);let h=async()=>{if(!u){d(!0),m(``);try{await R.setIdentity(e,c),await s(),m(r(`identity.saved`))}catch(e){m(Md(e,r).text)}finally{d(!1)}}};return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`identity.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`identity.title`),sub:r(`identity.subtitle`)}),(0,J.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-5`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),a?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),rows:12,className:`w-full resize-y rounded-lg border border-line bg-bg p-3 font-sans text-sm leading-relaxed text-ink outline-none focus:border-blue`,placeholder:r(`identity.placeholder`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:u||c===(i??``),title:r(`identity.save`),"aria-label":r(`identity.save`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:u?`…`:(0,J.jsx)(o,{icon:f})})]})]})]})]})}function Hd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a}=ge(e,t),o=i??[];return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`transcript.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`transcript.title`),sub:r(`transcript.subtitle`)}),(0,J.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-4`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!a&&o.length===0&&(0,J.jsx)($e,{children:r(`transcript.empty`)}),o.map((e,t)=>{let n=e.role===`operator`;return(0,J.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)] border-b border-line/50 py-2.5 last:border-b-0`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`font-mono text-[10px] font-semibold uppercase tracking-wide ${n?`text-ink-faint`:`text-blue-sky`}`,children:n?r(`transcript.operator`):`argus`}),(0,J.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Dt(e.ts)})]}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink-dim`,children:e.text})]},t)})]})]})}function Ud({card:e}){let{t,locale:n}=z(),r=typeof e.asked_at==`number`&&Number.isFinite(e.asked_at)&&e.asked_at>0?new Date(e.asked_at*1e3):null,i=e.task_status?.startsWith(`paused`);return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] text-ink-faint`,"data-decision-task":e.item_id,children:[e.task_title?(0,J.jsx)(`span`,{className:`min-w-0 basis-full break-words text-xs leading-relaxed text-ink-dim`,title:e.task_title,children:t(`decision.taskName`,{title:e.task_title})}):null,e.kind!==`domain_intake`&&e.is_current_task!=null?(0,J.jsx)(`span`,{children:t(e.is_current_task?`decision.currentTask`:`decision.otherTask`)}):null,(0,J.jsx)(at,{children:t(`decision.awaitingReply`)}),e.task_status?(0,J.jsx)(`span`,{children:i?t(`label.status.paused`):Rn(e.task_status,t)}):null,r&&!Number.isNaN(r.getTime())?(0,J.jsx)(`time`,{dateTime:r.toISOString(),title:r.toLocaleString(n),children:t(`decision.askedAt`,{time:wt(r,n)})}):null]})}function Wd({questions:e,backlog:t,currentTaskId:n,onAnswer:r,onLocate:i}){let{t:a}=z(),o=Xr(e,t,n);if(!o.length)return null;let s=o[0];return(0,J.jsxs)(`div`,{className:`mb-2 flex min-h-11 items-center gap-3 rounded-md border border-gold/40 bg-gold/5 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s.title===s.task_title?null:(0,J.jsx)(`div`,{className:`truncate text-xs font-medium text-gold`,title:s.title,children:s.title}),(0,J.jsx)(Ud,{card:s}),(0,J.jsx)(`div`,{className:`truncate text-xs text-ink-dim`,title:s.reason||s.question,children:s.reason||s.question})]}),o.length>1?(0,J.jsxs)(`span`,{className:`font-mono text-xs text-ink-faint`,children:[`+`,o.length-1]}):null,i&&s.item_id?(0,J.jsx)(`button`,{onClick:()=>i(s.item_id),className:`shrink-0 text-xs text-ink-dim hover:text-gold`,children:a(`pending.showOnMap`)}):null,(0,J.jsx)(`button`,{onClick:r,className:`shrink-0 text-xs font-medium text-gold hover:text-gold-soft`,children:a(`pending.reviewRespond`)})]})}function Gd({reply:e,open:t,busy:n,onClose:r,onSubmit:i,error:a=``}){let{t:o,locale:s}=z(),c=s===`zh-CN`,l=(0,G.useMemo)(()=>e?.options[0]?.id??`custom`,[e]),[u,d]=(0,G.useState)(l),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(``);if((0,G.useEffect)(()=>{t&&(d(l),p(``),h(``))},[l,t,e?.id]),!e)return null;let g=e.options.length===0,_=e.kind===`domain_intake`,v=e.options.find(e=>e.id===u),y=g?!!f.trim():!!(v&&(!v.requires_note||f.trim())),b=()=>{if(!n){if(!y){h(o(`decision.noteRequired`));return}h(``),i(g?`custom`:u,f.trim())}};return(0,J.jsxs)(dt,{open:t,onClose:n?()=>void 0:r,label:o(`decision.operator`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:_?e.title:o(`decision.required`),sub:!_&&e.title!==e.task_title?e.title:void 0}),(0,J.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[(0,J.jsx)(Ud,{card:e}),e.reason?(0,J.jsxs)(`section`,{className:`rounded-md border border-gold/30 bg-gold/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-gold`,children:o(`decision.whyBlocked`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.reason})]}):null,e.evidence.length?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:o(`decision.evidence`)}),(0,J.jsx)(`div`,{className:`space-y-2`,children:e.evidence.map((e,t)=>(0,J.jsxs)(`div`,{className:`rounded border border-line/70 bg-bg/40 p-2.5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.label}),e.summary?(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:e.summary}):null,e.path?(0,J.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10px] text-blue-sky`,children:e.path}):null]},`${e.path}:${t}`))})]}):null,(0,J.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.question}),e.options.length?(0,J.jsx)(`div`,{className:`space-y-2`,children:e.options.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{d(e.id),h(``)},disabled:n,"aria-pressed":u===e.id,className:`w-full rounded-md border p-3 text-left ${u===e.id?`border-blue bg-blue/5`:`border-line bg-bg/30`}`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-ink`,children:e.label}),(0,J.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-ink-dim`,children:e.description})]},e.id))}):null,_||g||v?.requires_note||f?(0,J.jsx)(`textarea`,{"data-autofocus":!0,value:f,onChange:e=>{p(e.target.value),h(``)},onKeyDown:e=>{vu(e)||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},rows:3,disabled:n,"aria-label":_?c?`你的回答或补充说明`:`Your answer or additional details`:o(`decision.notePlaceholder`),placeholder:_?v?.requires_note?c?`填写你的回答…`:`Enter your answer…`:c?`补充说明(可选)`:`Additional details (optional)`:o(`decision.notePlaceholder`),className:`w-full resize-y rounded-lg border border-line bg-bg px-3 py-2 text-sm leading-relaxed text-ink outline-none focus:border-blue disabled:opacity-60`}):null,m||a?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:m||a}):null,(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:_?c?`确认后继续这次任务。`:`Confirm to continue this request.`:o(`decision.resumeHint`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md px-3 py-2 text-xs text-ink-dim hover:bg-bg`,children:o(n?`decision.closeContinue`:`decision.later`)}),(0,J.jsx)(`button`,{type:`button`,onClick:b,disabled:n,className:`rounded-md border border-blue/35 bg-blue/8 px-3 py-2 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-50`,children:o(n?`decision.applying`:g||u===`custom`?`decision.sendAnswer`:u===`stop`?`decision.stopCampaign`:`decision.useOption`)})]})]})]})]})}function Kd({alert:e}){if(!e)return null;let t=e.tone===`block`,n=e.kind===`budget`;return(0,J.jsxs)(`div`,{className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border px-3.5 py-2 text-[13px] ${t?`border-err/50 bg-err/10 text-err`:`border-warn/50 bg-warn/10 text-warn`}`,role:t?`alert`:`status`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-bold leading-none`,children:n?`$`:t?`!`:`i`}),(0,J.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold uppercase tracking-wide`,children:n?`budget alarm`:t?`action required`:`notice`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.text,children:e.text})]})}function qd({sid:e}){let{t}=z(),n=M(),{data:r}=Me(e,!0),[i,a]=(0,G.useState)(!1);if(!e||!Ad(r?.operator_knobs))return null;let o=async()=>{a(!0);try{await R.setConfig(e,Od,`1`),await n.invalidateQueries({queryKey:[`config`,e]})}finally{a(!1)}};return(0,J.jsxs)(`div`,{"data-no-operator-banner":!0,role:`status`,className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border border-warn/50 bg-warn/10 px-3.5 py-2 text-[13px] text-warn`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:t(`noOperator.banner`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:i,className:`shrink-0 rounded border border-warn/50 px-2 py-0.5 text-xs font-medium hover:bg-warn/10 disabled:opacity-40`,children:t(`noOperator.turnOff`)})]})}function Jd(e){let t=(e.label||e.display_name||``).trim();return!!(t&&t!==e.id)}function Yd(e){return[...e].sort((e,t)=>{if(e.daemon_alive!==t.daemon_alive)return e.daemon_alive?-1:1;let n=Jd(e);return n===Jd(t)?(t.last_active||0)-(e.last_active||0):n?-1:1})}function Xd(e){return Yd(e)[0]}function Zd(e,t){let n=t?.trim()||null;return n&&e.some(e=>e.id===n)?{id:n,requested:n,recovered:!1}:{id:Xd(e)?.id??null,requested:n,recovered:!!n}}function Qd(e,t,n){if(n){let e=t?.trim()||null;return{id:e,requested:e,recovered:!1}}return Zd(e,t)}function $d(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return!0;let r=e.daemon_alive?`live running`:`stopped idle`,i=[e.id,e.label,e.display_name,e.objective,r].filter(Boolean).join(` `).toLowerCase();return n.every(e=>i.includes(e))}function ef(e,t){return e.filter(e=>$d(e,t))}function tf({sid:e,change:t,zh:n}){let[r,i]=(0,G.useState)({open:!1,loading:!1,diff:``,error:``,truncated:!1});return(0,J.jsxs)(`div`,{className:`delivery-changes`,children:[(0,J.jsx)(`button`,{type:`button`,"aria-expanded":r.open,onClick:()=>{if(r.open){i(e=>({...e,open:!1}));return}i(e=>({...e,open:!0,loading:!e.diff&&!e.error})),!(r.diff||r.error)&&R.deliveryDiff(e,t).then(e=>i(t=>({...t,loading:!1,truncated:e.truncated,diff:e.available?e.diff:``,error:e.available?e.diff?``:n?`内容没有变化`:`No content changes`:n?`上一版已不再保存,无法对比`:`The previous version is no longer kept`}))).catch(e=>i(t=>({...t,loading:!1,error:e instanceof Error?e.message:String(e)})))},children:r.open?n?`收起改动`:`Hide changes`:n?`查看与上一次交付相比的改动`:`Show changes since the previous delivery`}),r.open&&(r.loading?(0,J.jsx)(`p`,{children:n?`正在读取…`:`Loading…`}):r.error?(0,J.jsx)(`p`,{children:r.error}):(0,J.jsxs)(`pre`,{"aria-label":n?`改动`:`Changes`,children:[r.diff.split(` +`).map((e,t)=>(0,J.jsxs)(`span`,{className:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:void 0,children:[e,` +`]},t)),r.truncated?n?`…(改动过长,已截断)`:`… (truncated)`:``]}))]})}var nf=({children:e})=>(0,J.jsxs)(`span`,{children:[e,` `]}),rf=(0,G.memo)(function({children:e}){return(0,J.jsx)(F,{remarkPlugins:vt,rehypePlugins:ht,components:{p:nf,h1:nf,h2:nf,h3:nf,h4:nf,h5:nf,h6:nf,ul:nf,ol:nf,blockquote:nf,pre:nf,li:({children:e})=>(0,J.jsxs)(`span`,{className:`markdown-excerpt-item`,children:[e,` `]}),table:nf,thead:nf,tbody:nf,tr:nf,th:({children:e})=>(0,J.jsxs)(`strong`,{children:[e,` · `]}),td:nf,a:({children:e})=>(0,J.jsx)(`span`,{className:`markdown-excerpt-link`,children:e}),img:({alt:e})=>(0,J.jsx)(`span`,{children:e}),input:({checked:e})=>(0,J.jsx)(`span`,{children:e?`✓ `:`○ `}),hr:()=>(0,J.jsx)(`span`,{children:` · `}),code:({children:e})=>(0,J.jsx)(`code`,{children:e})},children:Jo(e)})});function af({html:e,title:t,className:n=``,sid:r,path:i}){return r&&i?(0,J.jsx)(of,{sid:r,path:i,html:e,title:t,className:n}):(0,J.jsx)(`iframe`,{title:t,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white ${n}`})}function of({html:e,title:t,className:n,sid:r,path:i}){let{locale:a}=z(),o=a===`zh-CN`,s=A({queryKey:[`artifact-html`,r,i,e],queryFn:({signal:e})=>R.artifactPreview(r,i,e),enabled:!!(r&&i),staleTime:3e4,retry:1});if(r&&i&&s.isPending)return(0,J.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,role:`status`,children:o?`正在加载网页和配套资源…`:`Loading the website and its assets…`});if(r&&i&&s.isError)return(0,J.jsxs)(`div`,{className:`m-auto p-6 text-sm text-err`,role:`alert`,children:[o?`网页预览加载失败,请重试或下载文件。`:`Preview could not load. Retry or download the file.`,(0,J.jsx)(`button`,{type:`button`,className:`ml-3 underline`,onClick:()=>void s.refetch(),children:o?`重试`:`Retry`})]});let c=s.data?.served_page===!0;return(0,J.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col ${n}`,children:[!!s.data?.warnings.length&&(0,J.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`部分配套资源无法加载,页面可能不完整。`:`Some linked assets are unavailable; the preview may be incomplete.`}),!c&&(0,J.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`此后端尚未支持独立网页预览;当前为内嵌预览,交互脚本可能不可用。`:`This backend does not yet support standalone preview; embedded preview may not run interactive scripts.`}),(0,J.jsx)(`iframe`,{title:t,src:c?me(r,i):void 0,srcDoc:c?void 0:s.data?.html??e,sandbox:`allow-scripts allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]})}function sf(e){let t=e.trim();if(!t)return``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{try{return t.split(/\r?\n/).filter(Boolean).map(e=>JSON.parse(e)).map(e=>JSON.stringify(e,null,2)).join(` +`)}catch{return e}}}function cf(e,t){let n=[],r=[],i=``,a=!1;for(let o=0;oe.some(e=>e.length>0))}function lf({value:e}){return(0,J.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:sf(e)||`(empty data)`})}function uf({value:e,delimiter:t}){let n=cf(e,t).slice(0,200),r=n[0]??[];return(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4 scroll-thin`,children:n.length?(0,J.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:r.slice(0,40).map((e,t)=>(0,J.jsx)(`th`,{className:`border border-line/60 bg-surface px-2 py-1.5 font-semibold text-ink`,children:e},t))})}),(0,J.jsx)(`tbody`,{children:n.slice(1).map((e,t)=>(0,J.jsx)(`tr`,{children:r.slice(0,40).map((t,n)=>(0,J.jsx)(`td`,{className:`border border-line/50 px-2 py-1.5 align-top text-ink-dim`,children:e[n]??``},n))},t))})]}):(0,J.jsx)(`div`,{className:`text-sm text-ink-faint`,children:`(empty table)`})})}var df=``+new URL(`pdf.min-Bbvtrhlt.mjs`,import.meta.url).href,ff=``+new URL(`pdf.worker.min-CLrFZWeq.mjs`,import.meta.url).href,pf=null,mf=0;function hf(){pf=null,mf+=1}function gf(){if(pf)return pf;let e=new URL(df,import.meta.url),t=new URL(ff,import.meta.url);mf&&(e.searchParams.set(`retry`,String(mf)),t.searchParams.set(`retry`,String(mf)));let n=Ne(()=>import(e.href).then(e=>(e.GlobalWorkerOptions.workerSrc=t.href,e)),[],import.meta.url).catch(e=>{throw pf===n&&hf(),e});return pf=n,n}function _f(e,t,n,r){let i=Math.max(1,n-32)/Math.max(1,e),a=Math.max(1,r-32)/Math.max(1,t);return Math.min(2.5,i,a)}function vf({src:e,name:t,className:n=``,onPageOrientation:r,onRetry:i}){let{locale:a}=z(),o=a===`zh-CN`,s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(1),[m,h]=(0,G.useState)(1),[g,_]=(0,G.useState)({width:0,height:0}),[v,y]=(0,G.useState)(!0),[b,x]=(0,G.useState)(!1),[S,C]=(0,G.useState)(``),[w,T]=(0,G.useState)(0);(0,G.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>_({width:e.clientWidth,height:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,G.useEffect)(()=>{let t=!0,n=new AbortController,r=null;return d(null),p(1),h(1),l.current=null,c.current?.scrollTo(0,0),C(``),y(!0),Promise.all([fetch(e,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`PDF request failed (${e.status})`);return e.arrayBuffer()}),gf()]).then(async([e,n])=>{if(!t)return;r=n.getDocument({data:new Uint8Array(e)});let i=await r.promise;t&&(d(i),y(!1))}).catch(e=>{t&&(y(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!1,n.abort(),r?.destroy().catch(()=>{})}},[e,w]),(0,G.useEffect)(()=>{let e=s.current;if(!u||!e||g.width<=0||g.height<=0)return;let t=!1,n=null;return x(!0),C(``),u.getPage(f).then(e=>{if(t||!s.current)return;let i=e.getViewport({scale:1});r?.(i.width>i.height?`landscape`:`portrait`);let a=_f(i.width,i.height,g.width,g.height),o=e.getViewport({scale:a*m}),u=document.createElement(`canvas`),d=u.getContext(`2d`,{alpha:!1});if(!d)throw Error(`Canvas rendering is unavailable`);let f=Math.min(window.devicePixelRatio||1,2);return u.width=Math.max(1,Math.floor(o.width*f)),u.height=Math.max(1,Math.floor(o.height*f)),n=e.render({canvas:u,canvasContext:d,viewport:o,transform:f===1?void 0:[f,0,0,f,0,0]}),n.promise.then(()=>{if(t||!s.current)return;let e=s.current,n=e.getContext(`2d`,{alpha:!1});if(!n)throw Error(`Canvas rendering is unavailable`);e.width=u.width,e.height=u.height,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`,n.drawImage(u,0,0);let r=c.current,i=l.current;if(r&&i){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect();r.scrollLeft+=n.left+i.x*n.width-t.left-r.clientWidth/2,r.scrollTop+=n.top+i.y*n.height-t.top-r.clientHeight/2,l.current=null}})}).then(()=>{t||x(!1)}).catch(e=>{t||e instanceof Error&&e.name===`RenderingCancelledException`||(x(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!0,n?.cancel()}},[r,f,u,g.height,g.width,m]);let E=e=>{let t=c.current,n=s.current;if(t&&n&&n.clientWidth&&n.clientHeight){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();l.current={x:Math.max(0,Math.min(1,(e.left+t.clientWidth/2-r.left)/r.width)),y:Math.max(0,Math.min(1,(e.top+t.clientHeight/2-r.top)/r.height))}}h(t=>Math.max(.6,Math.min(2.2,Math.round((t+e)*100)/100)))},D=()=>{l.current=null,c.current?.scrollTo(0,0),h(1)},O=u?.numPages??0;return(0,J.jsxs)(`div`,{className:`pdf-viewer flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-bg ${n}`,"aria-busy":v||b,children:[(0,J.jsxs)(`div`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-2 border-b border-line/70 bg-panel px-3 py-1.5 text-[11px] text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink`,title:t,children:t}),(0,J.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[o?`第`:`Page`,` `,f,` / `,O||`…`]}),(0,J.jsx)(`button`,{type:`button`,disabled:!u||f<=1,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.max(1,e-1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`上一页`:`Previous`}),(0,J.jsx)(`button`,{type:`button`,disabled:!u||f>=O,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.min(O,e+1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`下一页`:`Next`}),(0,J.jsx)(`button`,{type:`button`,"aria-label":o?`缩小`:`Zoom out`,disabled:!u||m<=.6,onClick:()=>E(-.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`−`}),(0,J.jsxs)(`span`,{className:`w-10 text-center font-mono tabular-nums`,children:[Math.round(m*100),`%`]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":o?`放大`:`Zoom in`,disabled:!u||m>=2.2,onClick:()=>E(.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`+`}),(0,J.jsx)(`button`,{type:`button`,disabled:!u,onClick:D,className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`适合页面`:`Fit page`})]}),(0,J.jsxs)(`div`,{ref:c,className:`pdf-scroll-viewport relative min-h-0 min-w-0 flex-1 overflow-auto bg-surface/60 p-4 scroll-thin`,tabIndex:0,"aria-label":o?`PDF 页面滚动区域`:`PDF page scroll area`,children:[v?(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,J.jsx)(tt,{})}):null,S?(0,J.jsxs)(`div`,{role:`alert`,className:`m-auto max-w-sm rounded border border-err/35 bg-err/5 p-4 text-center text-sm text-err`,children:[(0,J.jsx)(`p`,{children:o?`PDF 暂时无法预览`:`PDF preview is temporarily unavailable`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>{hf(),i?i():T(e=>e+1)},className:`mt-3 rounded border border-line bg-panel px-3 py-1.5 text-ink hover:border-blue/50`,children:o?`重试预览`:`Retry preview`}),(0,J.jsxs)(`details`,{className:`mt-3 break-words text-xs text-ink-dim`,children:[(0,J.jsx)(`summary`,{children:o?`错误详情`:`Error details`}),S]})]}):null,S?null:(0,J.jsx)(`div`,{className:`pdf-page-stage flex min-h-full min-w-full w-max items-center justify-center`,children:(0,J.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`${t} · ${o?`第`:`page`} ${f}`,className:`block max-w-none shrink-0 bg-white shadow-xl`})})]})]})}function yf({sid:e,path:t,onClose:n,delivery:r,deliveries:i=[],onSelectDelivery:a,onSelectPath:o,reviewActivity:s,artifacts:c=[]}){let{t:l,locale:u}=z(),d=u===`zh-CN`,f=r?Ko(r):[],p=we(e,t),m=p.data,h=m?.source===`reader_foundation`?m.reader_foundation:void 0,g=m?.source===`progress_snapshot`,_=m?us(m):!1,[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(``),[S,C]=(0,G.useState)(0),[w,T]=(0,G.useState)(!1),[E,D]=(0,G.useState)(!1),[O,k]=(0,G.useState)(`portrait`),A=m?.kind===`pdf`||t?.toLowerCase().endsWith(`.pdf`)===!0,j=!!(t&&/(?:^|[\\/])REVIEW\.md$/i.test(t));(0,G.useEffect)(()=>{if(!(!t||!A))return Pr(!0),()=>Pr(!1)},[t,A]),(0,G.useEffect)(()=>{if(k(`portrait`),y(null),x(``),!e||!t||!m||![`image`,`pdf`,`audio`,`video`].includes(m.kind))return;let n=!0,r=``,i=new AbortController;return R.artifactBlob(e,t,!1,i.signal).then(e=>{n&&(r=URL.createObjectURL(e),y(r))},e=>n&&x(e.message)),()=>{n=!1,i.abort(),r&&URL.revokeObjectURL(r)}},[e,t,m?.kind,S]);let M=async(n=!1)=>{if(!(!e||!t||!m)){T(!0),x(``);try{let r=n?await R.artifactBundle(e,t):await R.artifactBlob(e,t,!0);ut(r,n?`${m.name.replace(/\.html?$/i,``)}-website.zip`:m.name)}catch(e){x(e.message)}finally{T(!1)}}};return(0,J.jsxs)(dt,{open:!!(t||r),onClose:n,label:r?d?`交付成果`:`Delivery`:l(`artifact.preview`),width:r?E?`max-w-none`:`max-w-6xl`:A?`max-w-none`:`max-w-5xl`,viewport:r?E:A,showClose:!1,style:r?{height:E?`100dvh`:`min(92dvh, 960px)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:A?{maxWidth:O===`portrait`?`min(96vw, 76dvh)`:`min(96vw, 145dvh)`}:void 0,children:[r&&!E&&(0,J.jsxs)(`header`,{className:`delivery-header`,children:[(0,J.jsxs)(`div`,{className:`delivery-heading`,children:[(0,J.jsx)(`span`,{className:`delivery-mark`,children:(0,J.jsx)(ln,{size:22})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`p`,{children:[`DELIVERY · `,d?`交付成果`:`Your results`]}),(0,J.jsx)(`h2`,{children:d?`成果文件`:`Result files`})]}),(0,J.jsxs)(`button`,{type:`button`,onClick:n,className:`delivery-return`,"aria-label":d?`关闭交付弹窗`:`Close delivery`,children:[d?`返回地图`:`Back to map`,` ×`]})]}),i.length>1?(0,J.jsx)(`select`,{"aria-label":d?`选择交付任务`:`Choose delivery`,className:`delivery-task-select`,value:r.delivery_id,onChange:e=>{let t=i.find(t=>t.delivery_id===e.target.value);t&&a?.(t)},children:i.map(e=>(0,J.jsx)(`option`,{value:e.delivery_id,children:e.title},e.delivery_id))}):(0,J.jsx)(`p`,{className:`delivery-task-title`,title:r.title,children:r.title}),(0,J.jsxs)(`div`,{className:`delivery-facts`,children:[(()=>{let e=Qo(r,d);return(0,J.jsxs)(`span`,{className:e.independent?`delivery-review-independent`:`delivery-review-self`,title:e.title,children:[e.independent?(0,J.jsx)(Kt,{size:13}):null,e.text]})})(),(0,J.jsxs)(`span`,{children:[f.length,` `,d?`个文件`:`files`]})]}),r.summary&&(0,J.jsxs)(`details`,{className:`delivery-summary`,children:[(0,J.jsx)(`summary`,{children:d?`查看成果说明`:`Result summary`}),(0,J.jsx)(`p`,{children:(0,J.jsx)(rf,{children:r.summary})})]})]}),!E&&!!f.length&&(0,J.jsx)(`nav`,{className:`delivery-files`,"aria-label":d?`交付文件`:`Delivery files`,children:f.map(e=>(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":t===e.path,onClick:()=>o?.(e.path),title:e.path,children:[(0,J.jsx)(`span`,{children:e.path.split(`/`).at(-1)}),r?.primary_target?.path===e.path&&(0,J.jsx)(`small`,{children:d?`主要成果`:`Main result`})]},e.path))}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-line px-4 py-3 sm:px-5 ${t?``:`hidden`}`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink ${h||g?``:`font-mono`}`,title:h?.question??m?.progress_source?.title??m?.storage_path??m?.path??t??``,children:h?ds(h):g?m?.progress_source?.title||l(`artifact.title`):m?.name??t??l(`artifact.title`)}),(0,J.jsx)(`p`,{className:`mt-0.5 truncate text-[11px] text-ink-faint`,children:h?h.kind===`clarification`||h.kind===`progress_answer`?d?`阅读问答`:`Reading question and answer`:d?`背景说明 · 不计作研究进展`:`Background explanation · separate from research progress`:g?d?`保存的进展说明 · 提问来源`:`Saved progress explanation · question source`:m?`${m.kind} · ${yt(m.size)} · ${m.mime}`:d?`正在读取文件`:`Loading file`})]}),r&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>D(e=>!e),"aria-label":E?d?`收起预览`:`Exit full screen`:d?`全屏预览`:`Full screen preview`,title:d?`切换全屏预览`:`Toggle full screen preview`,className:`shrink-0 rounded-md border border-line p-2 text-ink-dim`,children:E?(0,J.jsx)(cn,{size:16}):(0,J.jsx)(on,{size:16})}),m?.kind===`html`&&(0,J.jsx)(`button`,{type:`button`,disabled:w,onClick:()=>void M(!0),className:`shrink-0 rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-2 text-xs text-blue-sky disabled:opacity-50`,children:d?`下载完整网页`:`Download website`}),(0,J.jsx)(`button`,{type:`button`,disabled:!m||w,onClick:()=>void M(),className:`rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-1.5 text-xs text-blue-sky transition-colors hover:bg-blue-deep/20 disabled:cursor-wait disabled:opacity-50`,children:l(w?`artifact.downloading`:`artifact.download`)}),(!r||E)&&(0,J.jsx)(`button`,{type:`button`,"aria-label":l(`artifact.close`),onClick:n,className:`rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink`,children:`×`})]}),(0,J.jsxs)(`div`,{className:r?`flex min-h-0 flex-1 flex-col overflow-auto bg-bg/40 p-2 sm:p-3`:A?`flex min-h-0 flex-1 flex-col overflow-hidden bg-bg/40`:`flex min-h-64 max-h-[72vh] flex-col overflow-x-hidden overflow-y-auto bg-bg/40 p-3 scroll-thin sm:p-4`,children:[!t&&r&&(0,J.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,children:(0,J.jsx)(rf,{children:r.summary})}),r&&e&&(()=>{let n=$o(r,i,t);return n?(0,J.jsx)(tf,{sid:e,change:n,zh:d},`${n.before}:${n.after}`):null})(),p.isLoading?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,p.isError?(0,J.jsxs)(`div`,{className:`m-auto text-sm text-err`,children:[l(`artifact.unavailable`),` · `,p.error.message]}):null,m?.why&&!h&&!g&&!A&&!r?(0,J.jsxs)(`div`,{className:`mb-3 rounded-md border border-line bg-surface px-3 py-2 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`mr-1 text-ink-faint`,children:`Reviewer:`}),m.why]}):null,m?.kind===`text`&&!_?(0,J.jsxs)(`pre`,{className:`min-h-52 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-bg p-4 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:[m.preview||l(`artifact.empty`),m.truncated?`\n\n… ${l(`artifact.truncated`)}`:``]}):null,m&&_?(0,J.jsxs)(`div`,{className:`min-h-52 overflow-auto rounded-lg border border-line bg-bg p-4 text-sm text-ink-dim scroll-thin`,children:[j&&(0,J.jsxs)(`div`,{className:`mb-4 border-b border-line pb-3 text-xs leading-5 text-ink-faint`,role:`status`,children:[s===`revising`?d?`正在根据这份意见修改论文,修改后的版本尚待复审。`:`The paper is being revised against this opinion; the revised version awaits review.`:s===`reviewing`?d?`Reviewer 正在更新本轮审稿意见,内容会自动刷新。`:`The Reviewer is updating this round’s opinion. This file refreshes automatically.`:d?`这是最近保存的审稿意见,文件更新后会自动刷新。`:`This is the latest saved review. Changes to this file appear automatically.`,m.mtime!=null&&(0,J.jsxs)(`div`,{children:[d?`最近更新:`:`Last updated: `,new Date(m.mtime*1e3).toLocaleString(u)]})]}),(0,J.jsx)(H,{sid:e,basePath:t||``,artifacts:[...c,...f.map(e=>({path:e.path})),...h?.sources??[],...h?.progress_source?[{path:h.progress_source.path}]:[]],onOpenArtifact:o,children:m.preview||l(`artifact.empty`)}),m.truncated?(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 border-t border-line pt-2 text-xs text-ink-faint`,children:[l(`artifact.truncated`),` · `,l(`artifact.downloadHint`)]}):null]}):null,m?.kind===`json`?(0,J.jsx)(lf,{value:m.preview||``}):null,m?.kind===`table`?(0,J.jsx)(uf,{value:m.preview||``,delimiter:m.name.endsWith(`.tsv`)?` `:`,`}):null,m?.kind===`html`?(0,J.jsx)(`div`,{className:`flex flex-1 overflow-hidden rounded-lg border border-line ${r?`min-h-0`:`min-h-[60vh]`}`,children:(0,J.jsx)(af,{sid:e,path:t,html:m.preview||``,title:`HTML preview: ${m.name}`})}):null,m?.kind===`image`&&v?(0,J.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-bg/50`,children:(0,J.jsx)(`img`,{src:v,alt:m.why||m.name,className:`max-h-[62vh] max-w-full object-contain`})}):null,m?.kind===`pdf`&&v?(0,J.jsx)(vf,{src:v,name:m.name,className:`min-h-0 overflow-hidden`,onPageOrientation:k,onRetry:()=>C(e=>e+1)}):null,m?.kind===`audio`&&v?(0,J.jsx)(`div`,{className:`m-auto w-full max-w-xl`,children:(0,J.jsx)(`audio`,{controls:!0,preload:`metadata`,src:v,className:`w-full`})}):null,m?.kind===`video`&&v?(0,J.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-black`,children:(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:v,className:`max-h-[62vh] max-w-full`})}):null,m&&[`image`,`pdf`,`audio`,`video`].includes(m.kind)&&!v&&!b?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,m?.kind===`binary`?(0,J.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-ink-dim`,children:l(`artifact.noPreview`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:l(`artifact.downloadHint`)})]}):null,b?(0,J.jsx)(`div`,{className:`mt-3 text-center text-xs text-err`,children:b}):null]})]})}function bf({sid:e,objective:t,taskId:n,taskTitle:r,readOnly:i,onOpenArtifact:a}){let{locale:o}=z(),s=o===`zh-CN`,c=s?`zh-CN`:`en-US`,l=(e,t)=>s?e:t,u=gs(e,c),{client:d,list:f,generation:p,progress:m,creationBlocked:h}=u,g=Uo(e,c),[_,v]=(0,G.useState)(null);(0,G.useEffect)(()=>v(null),[e,c]);let y=u.pendingRequest?.draft.progressSource?null:u.pendingRequest,b=u.notes.filter(e=>!e.reader_foundation?.progress_source&&e.reader_foundation?.kind!==`progress_answer`),x=b.filter(hs),S=x.find(e=>e.reader_foundation?.id===g.id),C=S?b.filter(e=>e.reader_foundation?.kind===`clarification`&&e.reader_foundation.root_id===S.reader_foundation?.id).reverse():[],w=S?.exists&&S.reader_foundation?.state===`complete`,T=b.some(e=>e.reader_foundation?.state===`generating`),E=b.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),D=b.filter(e=>e.reader_foundation?.state===`failed`),O=b.filter(e=>e.exists&&e.reader_foundation?.state===`complete`),k=!u.pendingRequest?.draft.progressSource&&u.creating,A=!u.requested?.reader_foundation?.progress_source&&u.confirmedFailure,j=!!y&&u.requestRejected,M=!!y&&u.unknownResult,ee=()=>{!_?.question.trim()||i||h||_.parentId&&!O.some(e=>e.reader_foundation?.id===_.parentId)||u.submit(_)&&v(null)},N=e=>{i||h||!e.exists||e.reader_foundation?.state!==`complete`||v({question:``,parentId:e.reader_foundation.id,parentTitle:ds(e.reader_foundation)})};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`mx-4 mt-3 rounded-lg border border-line/70 bg-panel px-3 py-2`,"aria-label":l(`问题基础`,`Question foundations`),"data-testid":`question-foundation`,"data-project-id":e,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(K,{size:15,className:`text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:l(`问题基础`,`Question foundations`)}),(0,J.jsx)(`span`,{className:`hidden text-xs text-ink-faint sm:inline`,children:l(`一份说明,陪你读后续进展`,`A saved explanation to help you follow later progress`)}),i?null:(0,J.jsxs)(W,{className:`ml-auto inline-flex items-center gap-1 text-xs`,disabled:h,onClick:()=>v({question:t??``,sourceTaskId:n,sourceTitle:r}),children:[(0,J.jsx)(fn,{size:12}),l(`从基础理解`,`Understand the foundations`)]})]}),x.length?(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`select`,{className:`min-w-0 flex-1 rounded border border-line bg-bg px-2 py-1.5 text-xs text-ink`,"aria-label":l(`选择基础说明`,`Choose a foundation explanation`),value:g.id??``,onChange:t=>Vo(d,e,c,t.target.value||null),children:[(0,J.jsx)(`option`,{value:``,children:l(`选择你正在理解的问题`,`Choose the question you are studying`)}),x.map(e=>(0,J.jsxs)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,disabled:!e.exists||e.reader_foundation.state!==`complete`,children:[ds(e.reader_foundation),e.reader_foundation.state===`generating`?l(` · 正在整理`,` · preparing`):e.exists?``:l(` · 尚未完成`,` · not completed`)]},e.path))]}),(0,J.jsx)(W,{className:`text-xs`,disabled:!w,onClick:()=>S&&a(S.path),children:l(`阅读基础说明`,`Read foundations`)}),!i&&S?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:!w||h,onClick:()=>N(S),children:[(0,J.jsx)(sn,{size:12}),l(`问这份说明`,`Ask about these foundations`)]}):null]}):!f.isPending&&!k?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:l(`先选一个想理解的问题;保存后,后续进度会引用同一份说明。`,`Start with a question you want to understand. Later progress can refer to the same saved explanation.`)}):null,C.length?(0,J.jsxs)(`div`,{className:`mt-3 border-t border-line/60 pt-2`,"data-testid":`foundation-questions`,"data-foundation-id":S?.reader_foundation?.id,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:l(`围绕这份说明的问答`,`Questions about these foundations`)}),(0,J.jsx)(`ul`,{className:`mt-1 max-h-48 space-y-2 overflow-y-auto scroll-thin`,children:C.map(e=>(0,J.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,"data-reading-question-id":e.reader_foundation.id,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-ink-dim`,children:e.reader_foundation.question}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:e.reader_foundation.state===`generating`?l(`正在回答`,`Preparing an answer`):e.reader_foundation.state===`failed`||!e.exists?l(`这次回答未完成`,`This answer did not finish`):l(`回答已保存`,`Answer saved`)})]}),e.exists&&e.reader_foundation.state===`complete`?(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,children:[(0,J.jsx)(W,{className:`text-xs`,onClick:()=>a(e.path),children:l(`阅读回答`,`Read answer`)}),i?null:(0,J.jsx)(W,{className:`text-xs`,disabled:h,onClick:()=>N(e),children:l(`继续问`,`Ask a follow-up`)})]}):null]},e.path))})]}):null,f.isError?(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-ink-faint`,role:`status`,children:[(0,J.jsx)(`span`,{children:l(`已保存的基础说明暂时读取失败。`,`Saved explanations could not be loaded.`)}),(0,J.jsx)(W,{className:`text-xs`,disabled:f.isFetching,onClick:()=>void f.refetch(),children:l(`重新读取`,`Reload records`)})]}):null,k?(0,J.jsx)(`div`,{className:`mt-2`,children:m.active?(0,J.jsx)(ss,{generating:!0,phase:m.phase}):(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:l(`正在核对保存结果`,`Checking the saved result`)})}):T?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:E?l(`等待时间已较长,仍未收到完整说明;生成尚未确认结束。`,`The wait is taking longer. A complete explanation has not arrived, and generation has not been confirmed to have stopped.`):l(`基础说明仍在整理,保存后会出现在这里。`,`An explanation is still being prepared. It will appear here when saved.`)}):null,A?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`这次说明未完成,失败记录已保留。可以重新明确生成一份。`,`This explanation did not finish. The failed request is retained; you can explicitly generate a new one.`)}):M?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`这次请求的结果尚未确认;刷新不会重新生成。`,`The result of this request is unconfirmed. Refreshing does not generate it again.`)}):null,j?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`引用的说明目前不可用,这次追问未发起。问题已保留,可以重新选择来源。`,`The reading source is unavailable, so this question was not started. Your question is saved; you can choose another source.`)}):null,!i&&y&&!k&&!T?j?(0,J.jsx)(W,{className:`mt-2 text-xs`,onClick:()=>{v(y.draft),p.reset()},children:l(`编辑问题与来源`,`Edit question and source`)}):(0,J.jsx)(W,{className:`mt-2 text-xs`,onClick:()=>u.retrySavedRequest(y),children:l(`重试同一请求`,`Retry this same request`)}):null,!i&&D.length?(0,J.jsx)(ft,{label:l(`未完成的说明(${D.length})`,`Unfinished explanations (${D.length})`),children:(0,J.jsx)(`div`,{className:`max-h-[24vh] overflow-y-auto`,children:D.map(e=>(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-ink-faint`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.reader_foundation.question,children:[l(`未完成:`,`Not completed: `),e.reader_foundation.question]}),(0,J.jsx)(W,{className:`shrink-0 text-xs`,disabled:h,onClick:()=>v({question:e.reader_foundation.question,sourceTaskId:e.reader_foundation.source_task_id??void 0,parentId:e.reader_foundation.parent_id??void 0,parentTitle:e.reader_foundation.parent_id?ds(b.find(t=>t.reader_foundation?.id===e.reader_foundation.parent_id)?.reader_foundation??{question:l(`先前选择的说明`,`Previously selected reading`)}):void 0}),children:l(`重新编辑问题`,`Edit this question`)})]},e.path))})}):null,(0,J.jsx)(`p`,{className:`mt-1.5 text-[11px] text-ink-faint`,children:l(`说明和问答会保存下来,供你随时回看。`,`Explanations and questions are saved for later reading.`)})]}),(0,J.jsxs)(dt,{open:!!_,onClose:()=>v(null),label:_?.parentId?l(`继续理解`,`Ask about your reading`):l(`从基础理解`,`Understand the foundations`),children:[(0,J.jsx)(lt,{title:_?.parentId?l(`哪里还不明白`,`What is still unclear`):l(`你想理解什么`,`What would you like to understand`),sub:_?.parentId?l(`可以引用一句话,或者写下算不明白的那一步。`,`Quote a sentence or describe the step you could not work through.`):l(`用自己的话选定一个问题,说明会保存下来供以后阅读。`,`Choose a question in your own words. Its explanation will be saved for later reading.`)}),(0,J.jsxs)(`div`,{className:`px-6 pb-6`,children:[_?.parentId?(0,J.jsxs)(`label`,{className:`mb-3 block text-xs text-ink-dim`,children:[l(`引用的说明或回答`,`Reading source`),(0,J.jsxs)(`select`,{"aria-label":l(`引用的说明或回答`,`Reading source`),className:`mt-1 block w-full min-w-0 rounded border border-line bg-bg px-2 py-2 text-xs text-ink`,value:_.parentId,onChange:t=>{let n=O.find(e=>e.reader_foundation?.id===t.target.value);n&&(v(e=>e&&{...e,parentId:n.reader_foundation.id,parentTitle:ds(n.reader_foundation)}),Vo(d,e,c,n.reader_foundation.root_id??n.reader_foundation.id))},children:[O.some(e=>e.reader_foundation?.id===_.parentId)?null:(0,J.jsxs)(`option`,{value:_.parentId,disabled:!0,children:[_.parentTitle||l(`原来源`,`Original source`),l(` · 当前不可用`,` · unavailable`)]}),O.map(e=>(0,J.jsx)(`option`,{value:e.reader_foundation.id,children:ds(e.reader_foundation)},e.path))]})]}):null,_?(0,J.jsx)(ps,{draft:_,onChange:v,onSubmit:ee,disabled:h||i||!!_.parentId&&!O.some(e=>e.reader_foundation?.id===_.parentId)}):null]})]})]})}var xf=[`manager`,`planner`,`engineer`,`reviewer`],Sf=new Set([`planner`,`engineer`,`reviewer`]),Cf=new Set([`running`,`in_progress`,`claimed`]),$=(e,t)=>String(e[t]??``).trim(),wf=(e,t)=>{let n=Number(e[t]);return Number.isFinite(n)?n:null};function Tf(e){return JSON.parse(JSON.stringify(e))}function Ef(){return{schema_version:7,bootstrapped:!1,language:``,mission:{id:``,title:``,objective:``,summary:``,final_output:``,status:`idle`,started_at:null,completed_at:null,elapsed_seconds:0,campaign_started_at:null,campaign_elapsed_seconds:0},stage:{id:``,label:``},routing:{route:``,vertical:``,workflow_mode:``,lifetime:``,continuous:!1,open_ended:!1},round:{current:0,max:0},active_role:``,roles:xf.map(e=>({role:e,status:`waiting`,label:`Waiting`,updated_at:0})),role_work:[],dag:[],timeline:[],artifacts:[],learned_skills:[],learned_wiki_pages:[],storage:{project_skill_dir:``,global_skill_dir:``,project_skill_count:0,global_skill_count:0,skill_history_compressed:0,wiki_retired_compressed:0,skill_history_bytes_saved:0,wiki_retired_bytes_saved:0,wiki_paths:[]},achievement:null,review:{status:``,reason:``,rejected_attempts:0},frontier:{change:``,summary:``,updated_at:0},delivery:null,outcome:{},last_event_ts:0,updated_at:0}}function Df(e,t,n,r){if(n==null||n===``)return;let i=e.findIndex(e=>e[t]===n);i>=0?e[i]={...e[i],...r}:e.push(r)}function Of(e,t,n,r,i){if(!xf.includes(t))return;n===`active`&&Sf.has(t)&&e.roles.forEach(e=>{Sf.has(e.role)&&e.role!==t&&e.status===`active`&&Object.assign(e,{status:`done`,label:`Handed off`,updated_at:i})});let a={role:t,status:n,label:r,updated_at:i};Df(e.roles,`role`,t,a),n===`active`?e.active_role=t:e.active_role===t&&(e.active_role=``)}function kf(e,t,n,r,i=``,a=`neutral`){let o=Re(t);if(e.timeline.some(e=>e.id===o))return;let s={id:o,ts:Number(t.ts??Date.now()/1e3),type:ie(t.type),role:n,title:r.slice(0,180),detail:i.slice(0,500),tone:a};[`item_id`,`branch_id`].forEach(e=>{let n=$(t,e);n&&(s[e]=n)}),e.timeline=[...e.timeline,s].slice(-120)}function Af(e,t,n,r,i,a=``,o=``){if(!xf.includes(n))return;let s=$(t,`message_id`),c=s?`${n}:${s}`:Re(t),l=e.role_work.find(e=>e.id===c),u=l&&l.detail.length>a.length?l.detail:a,d={id:c,ts:Number(t.ts??Date.now()/1e3),role:n,kind:r,title:i.slice(0,240),detail:u.slice(0,4e3),status:o,item_id:$(t,`item_id`),mission_id:e.mission.id,mission_title:e.mission.title.slice(0,240),round_index:wf(t,`round_index`)},f=e.role_work.findIndex(e=>e.id===c);f>=0?e.role_work[f]=d:e.role_work.push(d);let p=new Set;xf.forEach(t=>{e.role_work.filter(e=>e.role===t).slice(-40).forEach(e=>p.add(e.id))}),e.role_work=e.role_work.filter(e=>p.has(e.id))}function jf(e){return e===`ok`?`success`:e===`err`?`error`:`info`}var Mf={agent_message:`Reporting progress`,assistant_message:`Reporting progress`,command_execution:`Running a command`,reasoning:`Reasoning`,tool_use:`Using a tool`,tool_result:`Inspecting tool output`,codex_idle:`Waiting for model output`};function Nf(e,t){let n=ie(t.type),r=Number(t.ts??Date.now()/1e3);if(e.last_event_ts=Math.max(e.last_event_ts,r),n===I.LIFE_MANAGER_INTENT_STARTED)e.mission.id=$(t,`item_id`)||$(t,`intent_id`),e.mission.title=$(t,`objective`).slice(0,240),e.mission.objective=$(t,`objective`),e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`grounding`,Of(e,`manager`,`active`,`Grounding project`,r),kf(e,t,`manager`,`Project grounding started`,$(t,`objective`)),Af(e,t,`manager`,`grounding`,`Grounding project`,$(t,`objective`),`active`);else if(n===I.LIFE_MANAGER_INTENT_COMPLETED){let n=$(t,`execution_task`)||$(t,`objective`);e.mission.id=$(t,`item_id`),e.mission.title=n.slice(0,240),e.mission.objective=n,e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`framed`,e.routing.route=$(t,`route`)||e.routing.route||`team`,e.routing.vertical=$(t,`vertical`)||e.routing.vertical,e.routing.workflow_mode=$(t,`workflow_mode`)||e.routing.workflow_mode,e.routing.lifetime=$(t,`lifetime`)||e.routing.lifetime,`continuous`in t&&(e.routing.continuous=t.continuous===!0),`open_ended`in t&&(e.routing.open_ended=t.open_ended===!0);let i=$(t,`current_stage`),a=Array.isArray(t.stages)?t.stages:[];if(i)e.stage={id:i,label:i.replaceAll(`_`,` `)};else if(!e.stage.id&&a[0]){let t=String(a[0]);e.stage={id:t,label:t.replaceAll(`_`,` `)}}Of(e,`manager`,`done`,`Goal framed`,r),kf(e,t,`manager`,`Goal framed`,$(t,`reason`),`success`),Af(e,t,`manager`,`decision`,`Goal framed`,$(t,`reason`)||$(t,`execution_task`),`done`)}else if(n===I.LIFE_MANAGER_INTENT_FAILED)e.mission.status=`failed`,Of(e,`manager`,`error`,`Manager routing failed`,r),kf(e,t,`manager`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`),Af(e,t,`manager`,`grounding`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`);else if(n===I.LIFE_MANAGER_STAGE_DECISION){let n=$(t,`target_stage`)||$(t,`stage`)||$(t,`current_stage`);n&&(e.stage={id:n,label:n.replaceAll(`_`,` `)}),Of(e,`manager`,`done`,n?`Stage · ${n}`:`Stage reviewed`,r),kf(e,t,`manager`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`)),Af(e,t,`manager`,`stage_decision`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`),$(t,`action`))}else if(n===I.LIFE_PLANNER_START)Of(e,`planner`,`active`,`Planning next work`,r),Af(e,t,`planner`,`planning`,`Planning next work`,$(t,`objective`),`active`);else if(n===I.LIFE_PLANNER_TASK_ADDED){let n=$(t,`item_id`),i={id:n,title:$(t,`title`),objective:$(t,`objective`),status:`pending`,deps:Array.isArray(t.deps)?t.deps.map(String):[],branch_id:$(t,`branch_id`)||n,parent_branch_id:$(t,`parent_branch_id`)||null};Df(e.dag,`id`,n,i);let a=e.routing.vertical===`research`?`Research branch added`:`Task added`;Of(e,`planner`,`done`,a,r),kf(e,t,`planner`,a,i.title,`info`),Af(e,t,`planner`,`task`,i.title||`Task added`,i.objective,`pending`)}else if(n===I.LIFE_PLANNER_VERDICT){let n=!!t.project_done,i=n&&t.delivery&&typeof t.delivery==`object`&&!Array.isArray(t.delivery)?JSON.parse(JSON.stringify(t.delivery)):null,a=i?`Task completed`:n?`Project reviewed`:`Planning complete`;i&&(e.delivery=i,e.mission.status=`complete`,e.mission.summary=i.summary||``,e.mission.completed_at=r),Of(e,`planner`,`done`,a,r),kf(e,t,`planner`,a,$(t,`reason`),n?`success`:`neutral`),Af(e,t,`planner`,`verdict`,a,$(t,`reason`),n?`done`:`planned`)}else if(n===I.LIFE_PLANNER_WAITING){Of(e,`planner`,`waiting`,`Waiting on external work`,r);let n=$(t,`reason`)||$(t,`waiting_reason`);kf(e,t,`planner`,`Planner waiting`,n),Af(e,t,`planner`,`waiting`,`Planner waiting`,n,`waiting`)}else if(n===I.LIFE_MISSION_STARTED)e.review={status:``,reason:``,rejected_attempts:0},e.delivery=null,e.mission.campaign_started_at??=r,e.mission={...e.mission,id:$(t,`item_id`),title:$(t,`title`),objective:$(t,`objective`),summary:``,final_output:``,status:`working`,started_at:r,completed_at:null},Of(e,`reviewer`,`waiting`,`Waiting for the Engineer to finish`,r),Of(e,`engineer`,`active`,`Starting mission`,r),kf(e,t,`engineer`,`Mission started`,$(t,`title`),`info`),Af(e,t,`engineer`,`task`,$(t,`title`)||`Mission started`,$(t,`objective`),`active`);else if(n===I.ROUND_START)e.round={current:wf(t,`round_index`)??0,max:wf(t,`round_max`)??e.round.max},Of(e,`engineer`,`active`,`Running round ${e.round.current}`,r),kf(e,t,`engineer`,`Round ${e.round.current} started`);else if(n===I.ENGINEER_PROGRESS){let n=$(t,`agent_layer`)||$(t,`actor`)||`engineer`,i=n===`main`?`engineer`:n,a=$(t,`kind`),o=Mf[a]??`Working`;Of(e,i,`active`,o,r),i===`engineer`&&[`assistant_message`,`agent_message`,`message`].includes(a)&&t.final_delivery===!0&&e.mission.started_at!=null&&e.mission.completed_at==null&&r>=e.mission.started_at&&(!t.item_id||$(t,`item_id`)===e.mission.id)&&(e.mission.final_output=pe(t.text));let s=$(t,`action_summary`)||$(t,`text`);s&&!fe(t)&&!re(t)&&Af(e,t,i,a||`progress`,o,s,`active`),[`reasoning`,`assistant_message`,`agent_message`].includes(a)||kf(e,t,i,o,$(t,`action_summary`)||$(t,`text`))}else if(n===I.ROUND_MAIN_COMPLETED)Of(e,`engineer`,`done`,`Work ready for review`,r),Af(e,t,`engineer`,`handoff`,`Work ready for review`,$(t,`text`)||$(t,`summary`),`done`);else if(n===I.ROUND_REVIEW_STARTED)e.review={status:``,reason:``,rejected_attempts:e.review.rejected_attempts},Of(e,`reviewer`,`active`,`Reviewing benchmark evidence`,r),Af(e,t,`reviewer`,`review`,`Review started`,``,`active`);else if(n===I.ROUND_REVIEW_DEFERRED){let n=$(t,`next_step`);Of(e,`engineer`,`active`,`Continuing before review`,r),Of(e,`reviewer`,`waiting`,`Review deferred for one round`,r),kf(e,t,`engineer`,`Continued before review`,n,`info`)}else if(n===I.ROUND_REVIEW_COMPLETED){let n=t.review_skipped===!0,i=n?`skipped`:$(t,`status`),a=$(t,`reason`);e.review={status:i,reason:a,rejected_attempts:e.review.rejected_attempts+ +!![`continue`,`blocked`].includes(i)};let o=$(t,`frontier_change`);o&&(e.frontier={change:o,summary:$(t,`frontier_summary`),updated_at:r});let s=n?`No review this round`:i===`done`?`Evidence accepted`:`Attempt rejected`;Of(e,`reviewer`,n?`waiting`:i===`done`?`done`:`rejected`,n?s:i===`done`?`Accepted evidence`:`Requested another attempt`,r),kf(e,t,`reviewer`,s,a,n?`info`:i===`done`?`success`:`error`);let c=$(t,`next_action`);Af(e,t,`reviewer`,n?`review`:`verdict`,s,c?`${a}\n\nNext action: ${c}`:a,i)}else if([I.SKILL_CREATED,I.SKILL_UPDATED].includes(n)){let i=$(t,`skill_id`)||$(t,`name`);i&&(Df(e.learned_skills,`id`,i,{id:i,name:$(t,`name`),version:wf(t,`version`)??1,scope:$(t,`scope`),path:$(t,`path`),status:`active`,updated_at:r,mission_id:e.mission.id,mission_title:e.mission.title}),kf(e,t,`reviewer`,n===I.SKILL_CREATED?`Capability unlocked`:`Capability upgraded`,$(t,`name`),`skill`))}else if(n===I.SKILL_EVOLUTION_COMPLETED)e.storage.project_skill_dir=$(t,`project_skill_dir`)||e.storage.project_skill_dir,e.storage.global_skill_dir=$(t,`global_skill_dir`)||e.storage.global_skill_dir,e.storage.project_skill_count=wf(t,`project_skill_count`)??e.storage.project_skill_count,e.storage.global_skill_count=wf(t,`global_skill_count`)??e.storage.global_skill_count;else if(n===I.SKILL_HISTORY_COMPRESSED)e.storage.skill_history_compressed+=wf(t,`count`)??0,e.storage.skill_history_bytes_saved+=wf(t,`bytes_saved`)??0;else if(n===I.SKILL_TIDIED){let n=$(t,`name`);if(n){let i=e.learned_skills.find(e=>e.name===n),a={source_path:$(t,`path`),source_placement:$(t,`placement`),source_vertical:$(t,`vertical`),updated_at:r};i?Object.assign(i,a):Df(e.learned_skills,`id`,n,{id:n,name:n,version:1,scope:``,path:``,status:`active`,...a}),kf(e,t,`manager`,`Capability promoted to source`,n,`skill`)}}else if([I.WIKI_INITIALIZED,I.WIKI_EVOLUTION_COMPLETED].includes(n)){let n=[...(Array.isArray(t.paths)?t.paths:[]).map(e=>String(e)),$(t,`path`)].filter(Boolean);e.storage.wiki_paths=[...new Set([...e.storage.wiki_paths,...n])]}else if(n===I.WIKI_RETIRED_COMPRESSED)e.storage.wiki_retired_compressed+=wf(t,`count`)??0,e.storage.wiki_retired_bytes_saved+=wf(t,`bytes_saved`)??0;else if([I.WIKI_CREATED,I.WIKI_UPDATED].includes(n)){let i=$(t,`page_id`);i&&(Df(e.learned_wiki_pages,`id`,i,{id:i,title:$(t,`title`)||i,card_type:$(t,`card_type`),status:$(t,`status`)||`scratch`,path:$(t,`path`),updated_at:r}),kf(e,t,`reviewer`,n===I.WIKI_CREATED?`Knowledge captured`:`Knowledge refined`,$(t,`title`)||i,`skill`))}else if(n===I.WIKI_RETIRED){let n=$(t,`page_id`);if(n){let i=e.learned_wiki_pages.find(e=>e.id===n);i?Object.assign(i,{status:`retired`,updated_at:r}):Df(e.learned_wiki_pages,`id`,n,{id:n,title:n,card_type:$(t,`card_type`),status:`retired`,path:``,updated_at:r}),kf(e,t,`reviewer`,`Knowledge retired`,n,`error`)}}else if([I.WIKI_PROMOTION_PROMOTED,I.WIKI_PROMOTION_DEMOTED].includes(n)){let i=$(t,`page_id`);if(i){let a=e.learned_wiki_pages.find(e=>e.id===i);a?Object.assign(a,{status:$(t,`to_status`),updated_at:r}):Df(e.learned_wiki_pages,`id`,i,{id:i,title:i,card_type:$(t,`card_type`),status:$(t,`to_status`),path:``,updated_at:r});let o=n===I.WIKI_PROMOTION_PROMOTED;kf(e,t,`reviewer`,o?`Knowledge promoted`:`Knowledge demoted`,`${i} → ${$(t,`to_status`)}`,o?`success`:`neutral`)}}else if(n===I.RESEARCH_ACHIEVEMENT_CERTIFIED)e.achievement={id:$(t,`achievement_id`),title:$(t,`title`),goal:$(t,`goal`),summary:$(t,`summary`),rejected_attempts:e.review.rejected_attempts,skills_learned:e.learned_skills.filter(e=>e.status===`active`).length,artifacts:e.artifacts.length,elapsed_seconds:e.mission.elapsed_seconds,evidence:Array.isArray(t.evidence)?t.evidence.map(String):[],reviewer_certified:!0,certified_at:r};else if([I.LIFE_MISSION_COMPLETED,I.LIFE_MISSION_FAILED].includes(n)){let i=n===I.LIFE_MISSION_FAILED?oc({...t,outcome_class:`failed`,status:$(t,`status`)||`failed`,success:!1}):oc(t),a=`final_output`in t?$(t,`final_output`):$(t,`item_id`)===e.mission.id&&e.mission.started_at!=null&&(e.mission.completed_at==null||e.mission.completed_at===r)&&e.mission.final_output||``;e.mission.id=$(t,`item_id`)||e.mission.id,e.mission.title=$(t,`title`)||e.mission.title,e.mission.objective=$(t,`objective`)||e.mission.objective,e.mission.summary=$(t,`summary`),e.mission.final_output=a,e.mission.status=i.missionStatus,e.mission.completed_at=r;let o=t.delivery;t.success===!0&&o&&typeof o==`object`&&!Array.isArray(o)?e.delivery=JSON.parse(JSON.stringify(o)):t.success!==!0&&(e.delivery=null),e.outcome=ac(t),Of(e,`engineer`,i.missionStatus===`complete`?`done`:i.missionStatus,i.label,r),kf(e,t,`engineer`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),jf(i.tone)),Af(e,t,`engineer`,`completion`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),i.missionStatus)}return e.updated_at=Date.now()/1e3,e}function Pf(e,t,n){let r=t.backlog.find(e=>Cf.has(e.status)),i=t.backlog.find(e=>e.status===`pending`),a=t.backlog.find(t=>t.id===e.mission.id),o=r??a,s=!!(r||i||t.continuous?.enabled||t.continuous?.done_reason||t.continuous?.done_at||e.mission.id||![``,`idle`].includes(e.mission.status));t.continuous?.enabled&&(e.routing.route=e.routing.route||`team`,e.routing.continuous=!0,e.routing.open_ended=t.continuous.open_ended===!0,e.routing.lifetime=e.routing.open_ended?`standing`:e.routing.lifetime||`bounded`);let c=o?.objective||o?.title||(t.continuous?.enabled?t.continuous.objective:``)||t.session.objective||(e.mission.id?``:i?.objective)||(e.mission.id?``:i?.title)||e.mission.objective;c&&(e.mission.objective=c,o?e.mission.title=(o.title||c.split(` +`)[0]).slice(0,240):e.mission.title||(e.mission.title=c.split(` +`)[0].slice(0,240))),r?((r.id!==e.mission.id||r.started_ts!=null&&r.started_ts!==e.mission.started_at||e.mission.completed_at!=null)&&(e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=r.started_ts??null,e.mission.completed_at=null),e.mission.id=r.id,e.mission.status=`working`,e.mission.started_at=e.mission.started_at??r.started_ts??null):a?a.status===`pending`&&(e.mission.status=`queued`):t.continuous?.done_reason||t.continuous?.done_at?e.mission.status=`complete`:i||t.continuous?.enabled?e.mission.status=`queued`:t.daemon.alive&&(e.mission.status=`idle`),t.roles.forEach(t=>{t.active?Of(e,t.role,`active`,t.label||t.status||`Working`,Date.now()/1e3-(t.age_s??0)):s||Of(e,t.role,`waiting`,`Waiting`,Date.now()/1e3);let n=e.roles.find(e=>e.role===t.role);n&&Object.assign(n,{backend:t.backend,model:t.model,effort:t.effort})});let l=t.roles.filter(e=>e.active);l.length?e.active_role=l[l.length-1].role:s||(e.active_role=``),t.backlog.forEach(t=>{let n={id:t.id,title:t.title,objective:t.objective,status:t.status,deps:t.deps??[],branch_id:t.id,parent_branch_id:t.deps?.[0]??null,acceptance_check:t.acceptance_check??``,plan_hypothesis:t.plan_hypothesis??``,goal_contribution:t.goal_contribution??``,expected_regressions:t.expected_regressions??``,decision_rule:t.decision_rule??``,non_goals:t.non_goals??[]};Df(e.dag,`id`,n.id,n)});let u=o?.outcome?.execution_status?o.outcome:e.mission.id?void 0:[...t.backlog].filter(e=>e.outcome?.execution_status).sort((e,t)=>Number(e.finished_ts??0)-Number(t.finished_ts??0)).at(-1)?.outcome;return!r&&u&&(e.outcome=ac({outcome:u,status:`done`,success:!0})),n.forEach(t=>{Df(e.artifacts,`path`,t.path,{id:t.path,path:t.path,title:t.name,kind:t.kind,why:t.why,exists:t.exists,storage_path:t.storage_path,source:t.source})}),s}function Ff(e,t,n,r){r||(t.roles.forEach(t=>{t.active||Of(e,t.role,`waiting`,`Waiting`,Date.now()/1e3)}),e.active_role=``);let i=Date.now()/1e3,a=e.mission.campaign_started_at??t.session.created??e.mission.started_at;a&&(e.mission.campaign_started_at=a,e.mission.campaign_elapsed_seconds=Math.max(0,i-a)),e.mission.started_at&&e.mission.status===`working`?e.mission.elapsed_seconds=Math.max(0,i-e.mission.started_at):e.mission.started_at&&e.mission.completed_at&&(e.mission.elapsed_seconds=Math.max(0,e.mission.completed_at-e.mission.started_at)),e.achievement?.reviewer_certified&&(e.achievement.elapsed_seconds=e.mission.elapsed_seconds,e.achievement.rejected_attempts=e.review.rejected_attempts,e.achievement.skills_learned=e.learned_skills.filter(e=>e.status===`active`).length,e.achievement.artifacts=n.filter(e=>e.exists).length)}function If(e,t=[],n=[]){let r=e.mission_view?Tf(e.mission_view):Ef();r.storage??=Ef().storage,r.storage.skill_history_compressed??=0,r.storage.wiki_retired_compressed??=0,r.storage.skill_history_bytes_saved??=0,r.storage.wiki_retired_bytes_saved??=0,r.learned_wiki_pages??=[],r.role_work??=[],r.delivery??=null,r.outcome??={};let i=r.last_event_ts,a=Pf(r,e,n),o=[...t].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0));return o.filter(e=>e.ts==null||Number(e.ts)>i).forEach(e=>Nf(r,e)),r.mission.final_output||(r.mission.final_output=Lf(o,r.mission)),Ff(r,e,n,a),r}function Lf(e,t){if(!t.id||[`working`,`queued`,`grounding`,`framed`].includes(t.status))return``;let n=e.reduce(Nf,Ef()).mission;return n.id!==t.id||n.started_at==null||n.completed_at==null||t.started_at!=null&&n.started_at!==t.started_at||t.completed_at!=null&&n.completed_at!==t.completed_at?``:n.final_output||``}function Rf(e){return String(e||``).replace(/\\([*_`~])/g,`$1`).replace(/\\\\(?=[A-Za-z])/g,`\\`)}function zf(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h ${r}m`:r?`${r}m`:`${t}s`}var Bf=`__argus_live_progress__`,Vf=new Set([`framed`,`grounding`,`queued`,`running`,`in_progress`,`working`]),Hf=new Set([`complete`,`completed`,`done`,`success`]);function Uf(e){return Hf.has(String(e?.mission.status||``).toLowerCase())}function Wf(e){return(e??[]).filter(e=>e.source===`manager_live`)}function Gf(e){return Wf(e).filter(e=>e.exists)[0]??null}function Kf(e){let t=e??[],n={markdown:0,pdf:1,html:2,text:3,table:4,json:5,image:6,video:7,audio:8,binary:9},r=t.filter(e=>e.exists&&e.source===`delivery`),i=t.filter(e=>e.exists&&e.source===`manager_live`),a=t.filter(e=>e.exists&&e.source!==`manager_live`&&e.source!==`delivery`);return a.length||r.length?[...r,...[...a].sort((e,t)=>(n[e.kind]??99)-(n[t.kind]??99)),...i]:i}function qf(e){return Kf(e).find(e=>e.exists)??null}function Jf(e){let t=Kf(e);return t.find(e=>e.source===`delivery`)??t.find(e=>e.source!==`manager_live`)??t[0]??null}function Yf(e){let t=e.path.split(`/`);return t[t.length-1]||e.path}function Xf(e,t){if(e){let n=String(e.mission.status||``).toLowerCase();if(Vf.has(n))return Bf;let r=e.delivery?.primary_target?.path;if(r)return r;if(Uf(e))return Jf(t)?.path??`__argus_live_progress__`;let i=Gf(t);return i?i.path:Bf}return qf(t)?.path??``}function Zf(e){let t=String(e.agent_layer??e.actor??``);if(t===`main`)return`engineer`;if(t)return t;let n=String(e.type??``);return n.startsWith(`round.review`)||n.startsWith(`reviewer`)?`reviewer`:n.startsWith(`life.planner`)?`planner`:n.startsWith(`life.manager`)||n.startsWith(`manager`)?`manager`:n.startsWith(`engineer`)||n.startsWith(`round.`)?`engineer`:``}function Qf(e,t=[],n,r=`en`){if(n&&ci(n,e,t).state!==`running`||Uf(e))return null;let i=String(e?.active_role??``);if(!i)return null;let a=e?.roles.find(e=>e.role===i),o=``;for(let n=t.length-1;n>=0;--n){let r=t[n];if(e?.mission.id&&ri(r)!==e.mission.id||e?.mission.started_at&&Number(r.ts||0)ue(e,{},r)):i,label:a?.label||`Working`,detail:o}}function $f({view:e,artifacts:t=[],onOpenArtifact:n,routeVisible:r,snapshot:i,connected:a}){let{locale:o,t:s}=z(),c=e.dag.filter(e=>[`done`,`completed`].includes(e.status)).length,l=[...t].filter(e=>e.exists&&e.source!==`manager_live`).sort((e,t)=>Number(t.mtime??0)-Number(e.mtime??0)).slice(0,4),u=e=>[`running`,`in_progress`,`claimed`].includes(e),d=a&&i?.daemon.alive!==!1,f=e=>e===`done`?`text-ok`:u(e)?`text-blue-sky`:[`failed`,`blocked`,`rejected`].includes(e)?`text-err`:`text-ink-faint`;return(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 text-sm text-ink-dim scroll-thin`,children:[(0,J.jsx)(`section`,{className:`rounded-lg border border-blue-deep/30 bg-blue-deep/10 p-4`,children:(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.stage`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm font-medium text-blue-sky`,children:Pc(e.stage.id,o)===e.stage.id?e.stage.label||e.stage.id||`—`:Pc(e.stage.id,o)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.totalTime`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:zf(e.mission.campaign_elapsed_seconds)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.round`)}),(0,J.jsxs)(`dd`,{className:`mt-1 text-sm text-ink`,children:[e.round.current||`—`,e.round.max?` / ${e.round.max}`:``]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.dagProgress`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:Rc(c,e.dag.length,o)})]})]})}),r&&e.dag.length?(0,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:s(`mission.researchDag`)}),(0,J.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.dag.map(e=>(0,J.jsx)(`li`,{className:`rounded-md border border-line/60 bg-panel px-3 py-2.5`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 shrink-0 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,"aria-hidden":`true`,children:e.status===`done`?`✓`:d&&u(e.status)?`●`:`○`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium leading-5 text-ink`,children:(0,J.jsx)(H,{children:e.title})}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,children:!d&&u(e.status)?a?o===`zh-CN`?`当前未在运行`:`Not currently running`:o===`zh-CN`?`断连前记录:进行中`:`Last received state: in progress`:Wc(e.status,o)})]})]})},e.id))})]}):null,l.length?(0,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:o===`zh-CN`?`已生成的文件`:`Files produced so far`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o===`zh-CN`?`文件已生成,结论是否成立仍以核验记录为准。`:`A saved file is not a verification of its conclusions.`}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:l.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),title:e.storage_path||e.path,className:`rounded border border-line/70 bg-panel px-2.5 py-1.5 font-mono text-xs text-blue-sky hover:border-blue/60`,children:[Yf(e),` ↗`]},e.path))})]}):null]})}function ep({sid:e,artifacts:t,error:n=!1,onExpand:r,onOpenFile:i,className:a=``,embedded:s=!1,onCollapse:c,missionView:l,activityEvents:u=[],requestedPath:d,requestedPathToken:f,routeVisible:p=!0,snapshot:m,connected:h=!0}){let{t:g,locale:_}=z(),y=(0,G.useMemo)(()=>Kf(t),[t]),b=(0,G.useMemo)(()=>qf(t),[t]),x=Uf(l),S=(0,G.useMemo)(()=>{if(!x)return null;let e=l?.delivery?.primary_target?.path;return y.find(t=>t.path===e&&t.exists)??Jf(t)},[t,x,l?.delivery?.primary_target?.path,y]),[C,w]=(0,G.useState)(null);(0,G.useEffect)(()=>{w(x&&S?S.path:null)},[x,S?.path,l?.mission.id,e]),(0,G.useEffect)(()=>{if(!d)return;let e=y.find(e=>e.path===d&&e.exists);e&&w(e.path)},[y,d,f]);let T=e=>{w(e),e!==`__argus_live_progress__`&&i?.()},E=C??Xf(l,t),D=E===Bf,O=D?null:y.find(e=>e.path===E)??(x?S:b),k=we(e,O?.exists?O.path:null,O?.mtime??null),A=k.data,j=A?us(A):!1,[M,ee]=(0,G.useState)(null),[N,P]=(0,G.useState)(``),[F,te]=(0,G.useState)(!1),[ne,re]=(0,G.useState)(``),ie=(0,G.useMemo)(()=>h?Qf(l,u,m,_):null,[u,l,m,h,_]);(0,G.useEffect)(()=>{if(ee(null),P(``),!e||!O||!A||![`image`,`pdf`,`audio`,`video`].includes(A.kind))return;let t=!0,n=``,r=new AbortController;return R.artifactBlob(e,O.path,!1,r.signal).then(e=>{t&&(n=URL.createObjectURL(e),ee(n))},e=>t&&P(e.message)),()=>{t=!1,r.abort(),n&&URL.revokeObjectURL(n)}},[e,O?.path,A?.kind,A?.mtime]);let I=l?.delivery??null,L=I?.primary_target?.path??``,ae=!!(x&&!D&&O&&(O.source===`delivery`||O.path===L)),oe=_===`zh-CN`?I?.kind===`submission_certified`?`交付已认证`:`已完成`:I?.kind===`submission_certified`?`Certified delivery`:`Delivered result`,se=ae?oe:D?g(`research.liveProgress`):y[0]?.group_title||g(`research.artifact`),ce=async()=>{if(!(!e||!O)){te(!0),re(``);try{let t=await R.artifactBlob(e,O.path,!0);ut(t,O.name)}catch(e){re(e.message)}finally{te(!1)}}};return(0,J.jsxs)(`section`,{className:`glass-panel glass-panel--side flex min-h-0 flex-col overflow-hidden ${s?``:`rounded-lg border`} ${a}`,"aria-label":g(`research.canvas`),children:[(0,J.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-line/50 bg-panel px-4`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 rounded-full ${ae?`bg-ok`:ie?`animate-pulse bg-blue`:`bg-ink-faint/60`}`}),(0,J.jsx)(`h2`,{className:`max-w-24 truncate text-sm font-semibold text-ink sm:max-w-48`,children:se})]}),l||y.length>0?(0,J.jsxs)(`label`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:g(`research.previewArtifact`)}),(0,J.jsxs)(`select`,{value:D?Bf:O?.path??``,onChange:e=>T(e.target.value),title:D?g(`research.liveProgress`):O?.storage_path||O?.path,className:`h-8 w-full min-w-0 max-w-64 truncate rounded-md border border-line/50 bg-bg px-2 font-mono text-xs text-ink-dim outline-none focus:border-blue/60`,children:[l?(0,J.jsx)(`option`,{value:Bf,children:g(`research.liveProgress`)}):null,y.map(e=>(0,J.jsxs)(`option`,{value:e.path,disabled:!e.exists,title:e.storage_path||e.path,children:[e.source===`delivery`?`${g(`research.optionDelivery`)} · `:``,Yf(e),e.exists?``:` · ${g(`research.optionPending`)}`]},e.path))]})]}):(0,J.jsx)(`div`,{className:`flex-1`}),(0,J.jsx)(`div`,{className:`shrink-0`,children:O?(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void ce(),disabled:F||!O.exists,title:g(`artifact.download`),"aria-label":g(`artifact.download`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink disabled:opacity-40`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M8 2.25v7.5M5.25 7.5 8 10.25 10.75 7.5M3 13.25h10`})})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(O.path),title:g(`research.openLarge`),"aria-label":g(`research.openLarge`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M6 3H3v3M10 3h3v3M6 13H3v-3M10 13h3v-3`})})})]}):null}),c?(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":g(`research.collapse`),title:g(`research.collapse`),className:`hidden h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink lg:flex`,children:(0,J.jsx)(o,{icon:v,className:`h-3.5 w-3.5`})}):null]}),m?(0,J.jsx)(ru,{snapshot:m,view:l,events:u,connected:h,compact:!0}):ie?(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-line/50 bg-blue-deep/10 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(`span`,{"data-role-dot":ie.role,className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:B.role[ie.role]??B.inkFaint},"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-semibold text-ink`,children:ie.roleLabel}),(0,J.jsx)(`span`,{className:`text-blue-sky`,children:g(`mission.active`)}),(0,J.jsxs)(`span`,{className:`truncate text-ink-faint`,children:[`· `,Hc(ie.label,_,{kind:l?.roles.find(e=>e.role===ie.role)?.kind,language:l?.language})]})]}),ie.detail?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-ink-dim`,children:ie.detail}):null]}):null,(0,J.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col bg-bg`,children:[D&&l?(0,J.jsx)($f,{view:l,artifacts:t,onOpenArtifact:T,routeVisible:p,snapshot:m,connected:h}):null,!D&&n?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-6 text-center text-sm text-warn`,children:g(`research.unavailable`)}):null,!D&&!n&&y.length===0?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,J.jsx)(`h3`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.noPreview`)})]}):null,!D&&!n&&y.length>0&&!O?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(tt,{}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.waiting`)})]}):null,O&&!O.exists?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(tt,{}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.updating`)})]}):null,O?.exists&&k.isLoading?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,O?.exists&&k.isError?(0,J.jsxs)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:[g(`artifact.unavailable`),` · `,k.error.message]}):null,A?.kind===`text`&&!j?(0,J.jsxs)(`pre`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:[A.preview||`(empty file)`,A.truncated?` + +… live preview truncated · expand to inspect the complete file`:``]}):null,A&&j?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-5 text-sm text-ink-dim scroll-thin`,children:(0,J.jsx)(H,{sid:e,basePath:A.path,artifacts:t,onOpenArtifact:T,children:A.preview||`(empty file)`})}):null,A?.kind===`json`?(0,J.jsx)(lf,{value:A.preview||``}):null,A?.kind===`table`?(0,J.jsx)(uf,{value:A.preview||``,delimiter:A.name.endsWith(`.tsv`)?` `:`,`}):null,A?.kind===`html`&&!A.truncated?(0,J.jsx)(af,{sid:e,path:A.path,html:A.preview||``,title:`Live HTML preview: ${A.name}`}):null,A?.kind===`html`&&A.truncated?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-warn`,children:g(`artifact.htmlTooLarge`)}):null,A?.kind===`image`&&M?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4`,children:(0,J.jsx)(`img`,{src:M,alt:A.why||A.name,className:`max-h-full max-w-full object-contain`})}):null,A?.kind===`pdf`&&M?(0,J.jsx)(vf,{src:M,name:A.name}):null,A?.kind===`audio`&&M?(0,J.jsx)(`div`,{className:`m-auto w-full max-w-xl px-6`,children:(0,J.jsx)(`audio`,{controls:!0,preload:`metadata`,src:M,className:`w-full`})}):null,A?.kind===`video`&&M?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-2`,children:(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:M,className:`max-h-full max-w-full`})}):null,A?.kind===`binary`?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-ink-dim`,children:g(`research.fileUnavailable`)}):null,A&&[`image`,`pdf`,`audio`,`video`].includes(A.kind)&&!M&&!N?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,N?(0,J.jsx)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:N}):null]}),!D&&A?(0,J.jsxs)(`footer`,{className:`flex h-9 items-center gap-2 border-t border-line px-4 font-mono text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:A.storage_path||A.path,children:A.path}),ne?(0,J.jsx)(`span`,{className:`ml-auto truncate text-err`,title:ne,children:g(`research.downloadFailed`)}):null,(0,J.jsx)(`span`,{className:`shrink-0`,children:yt(A.size)})]}):null]})}function tp({notice:e,onClose:t}){if((0,G.useEffect)(()=>{if(!e)return;let n=window.setTimeout(t,e.tone===`error`?8e3:4e3);return()=>window.clearTimeout(n)},[e,t]),!e)return null;let n=e.tone===`error`?`border-err/60 bg-err/10 text-err`:e.tone===`success`?`border-ok/60 bg-ok/10 text-ok`:`border-blue-deep/60 bg-panel text-blue-sky`;return(0,J.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,"aria-live":e.tone===`error`?`assertive`:`polite`,className:`fixed bottom-4 left-4 right-4 z-[70] flex items-start gap-2 rounded-md border px-3 py-2.5 shadow-glow sm:left-auto sm:max-w-md ${n}`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0`,children:e.tone===`error`?`!`:e.tone===`success`?`✓`:`i`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-xs leading-relaxed text-ink-dim`,children:e.message}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`dismiss notification`,onClick:t,className:`shrink-0 rounded px-1 text-base leading-none opacity-70 hover:bg-white/5 hover:opacity-100`,children:`×`})]})}function np({open:e,sid:t,name:n,alive:r,controlAvailable:i=!0,busy:a,onClose:o,onRename:s,onStart:c,onStop:l,onDelete:u}){let{t:d}=z(),[f,p]=(0,G.useState)(n),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(!1);(0,G.useEffect)(()=>{e&&(p(n),h(!1),_(!1))},[e,n,t]);let v=async e=>{e.preventDefault(),await s(f.trim())},y=r&&!g,b=async()=>{if(y){await l()&&_(!0);return}await c()&&_(!1)};return(0,J.jsxs)(dt,{open:e,onClose:()=>!a&&o(),label:d(`manage.daemon`),width:`max-w-lg`,children:[(0,J.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-ink`,children:d(`topbar.manageSession`)}),(0,J.jsx)(`p`,{className:`mt-0.5 font-mono text-[10px] text-ink-faint`,children:t})]}),(0,J.jsx)(`form`,{onSubmit:e=>void v(e),className:`border-b border-line p-5`,children:(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.displayName`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),maxLength:80,disabled:a,className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg/50 px-3 text-sm text-ink outline-none focus:border-blue-deep disabled:opacity-50`}),(0,J.jsx)(`button`,{type:`submit`,disabled:a||f.trim()===n,className:`rounded border border-line px-3 text-xs text-ink-dim hover:bg-surface disabled:opacity-40`,children:d(`common.save`)})]})]})}),(0,J.jsxs)(`div`,{className:`border-b border-line p-5`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.executor`)}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center justify-between rounded border border-line bg-bg/30 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm text-ink`,children:d(y?i?`manage.running`:`manage.runningExternally`:`manage.paused`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:d(y?i?`manage.stopNowHint`:`manage.externalHint`:`manage.resumeHint`)})]}),(0,J.jsx)(`button`,{type:`button`,disabled:a||!i,onClick:()=>void b(),className:`rounded border px-3 py-1.5 text-xs disabled:cursor-wait disabled:opacity-50 ${y?`border-warn/50 text-warn hover:bg-warn/10`:`border-blue-deep bg-blue-deep text-white hover:bg-blue-deep/80`}`,children:d(a?`manage.working`:i?y?`manage.stopNow`:`manage.resume`:`common.external`)})]})]}),(0,J.jsxs)(`div`,{className:`p-5`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:d(`manage.deleteSession`)}),(0,J.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-ink-faint`,children:d(`manage.deleteHint`)}),m?(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded border border-err/40 bg-err/5 p-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-dim`,children:d(`manage.confirmQuestion`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`rounded px-2 py-1 text-xs text-ink-faint hover:bg-surface`,children:d(`common.cancel`)}),(0,J.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void u(),className:`rounded bg-err px-3 py-1 text-xs font-medium text-bg disabled:opacity-50`,children:d(`manage.confirmDelete`)})]})]}):(0,J.jsx)(`button`,{type:`button`,disabled:a||y,onClick:()=>h(!0),className:`mt-3 rounded border border-err/40 px-3 py-1.5 text-xs text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-40`,children:d(`manage.delete`)})]})]})}var rp={科学环境已就绪:`Scientific environment ready`,更新科学环境校验:`Update scientific environment checks`,验证科学环境依赖和关键模块:`Validating scientific dependencies and required modules`,"科学环境 · 上次检查结果":`Scientific environment · previous check`,"下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。":`The results below predate this operation. Refer to the latest error above or check the environment again.`,"科学环境 · ⟦0⟧ 项待配置":`Scientific environment · ⟦0⟧ item(s) to configure`,科学环境:`Scientific environment`,检查环境:`Check environment`,"免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。":`Free scientific components are configured automatically; SHELX requires academic authorization from the official website before entering download credentials.`,修复依赖:`Repair dependencies`,"继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。":`Confirm the official PLATON license before continuing. The same installation or repair action will prepare the complete runtime; no separate repair button is required.`,同意并继续:`Agree and continue`,"请先确认 PLATON 使用许可,再继续安装或修复依赖。":`Confirm the PLATON license before installing or repairing dependencies.`,依赖修复完成:`Dependency repair complete`,依赖修复未完成:`Dependency repair incomplete`,环境操作未完成:`Environment operation incomplete`,"依赖修复未完成:⟦0⟧。请查看组件检查结果;不会报告修复成功。":`Dependency repair is incomplete: ⟦0⟧. Check the component results; this is not reported as a successful repair.`,"PLATON 已可用,保留当前安装。":`PLATON is already available; keeping the existing installation.`,"准备 PLATON 官方环境":`Prepare official PLATON runtime`,"下载、验证并配置":`Download, verify and configure`,"我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。":`I confirm that my use complies with the official PLATON license; for commercial use, I have obtained separate authorization.`,"PLATON 官方允许注明来源的学术、科学及非商业用途;商业用途需自行取得许可。本操作只从官方网站下载到插件私有目录,不安装系统运行库、不修改系统 PATH。":`The publisher permits acknowledged academic, scientific and non-commercial use of PLATON; commercial use requires a separate license. This downloads from official sites into the plugin's private directory, without installing system runtimes or changing the system PATH.`,"PLATON 缺少 Windows Salford 运行库(0xC0000135)。请点击“修复依赖”,确认许可后会在同一流程准备完整运行环境。":`PLATON is missing the Windows Salford runtime (0xC0000135). Click Repair dependencies and confirm the license to prepare the complete runtime in the same action.`,"正在校验 PLATON 官方程序与 Windows 配套运行环境…":`Verifying the official PLATON program and Windows runtime…`,"正在提取官方 Salford 运行库(不执行系统安装程序)…":`Extracting the official Salford runtime without executing the system installer…`,"正在实际运行 PLATON,验证 Windows 运行库和校验规则…":`Running PLATON to verify the Windows runtime and validation rules…`,"PLATON 官方 Windows 运行环境验证通过。":`The official PLATON Windows runtime passed verification.`,"PLATON 官方运行环境已可用,保留当前安装。":`The official PLATON runtime is already available; keeping the existing installation.`,"配置 SHELX":`Configure SHELX`,"SHELX 授权安装":`SHELX authorized installation`,学术授权:`Academic authorization`,前往官网申请:`Apply on official website`,"填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。":`Enter the username and password from the authorization email to download and install automatically. Credentials are used only for this official download, are not saved, and are not sent to the model.`,用户名:`Username`,"SHELX 用户名":`SHELX username`,密码:`Password`,"SHELX 密码":`SHELX password`,"查看许可 ↗":`View license ↗`,"下载并安装 SHELX":`Download and install SHELX`,取消:`Cancel`,科学软件健康检查:`Scientific software health check`,"点击“检查环境”可验证科学内核与外部程序。":`Click “Check environment” to verify the scientific kernel and external programs.`,可用:`Available`,待授权安装:`Authorization required`,待修复:`Needs repair`,查看检查详情:`View check details`,查看原因与安装方式:`View cause and installation method`,"官方安装说明 ↗":`Official installation instructions ↗`,使用已有安装:`Use existing installation`,"DIALS 环境目录":`DIALS environment directory`,"Systre JAR 路径(需要已有 Java)":`Systre JAR path (existing Java required)`,"⟦0⟧ 可执行文件路径":`⟦0⟧ executable path`,"填写运行 Argus 的电脑上的路径,验证成功后生效。":`Enter the path on the computer running Argus. It takes effect after successful verification.`,验证并使用:`Verify and use`,最近检查:`Last checked`,"· 检查不调用模型":`· Check does not call the model`,无法读取插件列表:`Unable to read plugin list`,插件操作未完成:`Plugin operation incomplete`,插件:`Plugins`,关闭插件列表:`Close plugin list`,"按需安装研究工具,沿用 Argus 的模型与执行后端。":`Install research tools as needed, using Argus's model and execution backend.`,"正在读取插件…":`Reading plugins…`,暂无可用插件:`No plugins available`,已启用:`Enabled`,已停用:`Disabled`,未安装:`Not installed`,"· 当前后端":`· Current backend`,安装:`Install`,打开工作台:`Open workbench`,启用:`Enable`,更新至:`Update to`,停用:`Disable`,卸载:`Uninstall`,"原生会话输入 ⟦0⟧ 可启用后台工具。卸载保留会话、研究数据和科学软件。":`Native session input ⟦0⟧ can enable background tools. Uninstalling preserves sessions, research data, and scientific software.`,"首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。":`First installation automatically configures standalone Python, DIALS, Systre / Java, and free academic PLATON components. SHELX can be installed later by entering authorization details.`,"暂不支持,敬请期待。当前插件支持 Codex、Copilot 和 Pi。":`Not supported yet. Stay tuned. Current plugins support Codex, Copilot, and Pi.`,"安装科学环境需要 Python 3.11–3.13。请安装 Python 后重试,或设置 ARGUS_PLUGIN_PYTHON。":`Installing the scientific environment requires Python 3.11–3.13. Install Python and try again, or set ARGUS_PLUGIN_PYTHON.`,准备安装:`Prepare installation`,获取并校验插件包:`Download and verify plugin package`,"安装独立运行环境(首次可能需要几分钟)":`Install standalone environment (may take several minutes the first time)`,"插件仍有任务运行,请等任务结束或先暂停,再进行此操作。":`This plugin still has running tasks. Wait for them to finish or pause them before continuing.`,"此插件版本尚未提供可校验的发行包。":`No verifiable release package is available for this plugin version.`,"插件包校验失败,未安装。":`Plugin package verification failed. Not installed.`,正在准备:`Preparing`,"当前系统或 Argus 插件接口版本暂不支持此插件。":`This plugin is not currently supported by the system or Argus plugin API version.`,"插件发行包尚未发布。":`The plugin release package has not been published.`,安装完成:`Installation complete`,环境检查完成:`Environment check complete`,"此插件已有安装或更新操作正在进行。":`An installation or update operation for this plugin is already in progress.`,插件尚未安装:`Plugin not installed`,"安装进程已中断;已有可用版本保持不变,可重试。":`Installation was interrupted. The existing available version is unchanged; you can retry.`,"安装未完成,已有版本保持不变":`Installation incomplete; existing version unchanged`,"此版本已安装,可启用插件。":`This version is installed. You can enable the plugin.`,请先安装插件:`Install the plugin first`,请先更新插件以使用环境管理功能:`Update the plugin first to use environment management`,"插件包超过允许大小。":`The plugin package exceeds the allowed size.`,科学计算内核:`Scientific computing kernel`,"cctbx · Gemmi · RDKit · 科学服务":`cctbx · Gemmi · RDKit · scientific services`,衍射帧处理与探测器格式支持:`Diffraction frame processing and detector format support`,周期网络与拓扑识别:`Periodic networks and topology identification`,"本地 checkCIF 结构校验 · 学术免费":`Local checkCIF structure validation · free for academic use`,"结构精修 · 需要学术授权":`Structure refinement · academic authorization required`,"结构求解 · 需要学术授权":`Structure solution · academic authorization required`,全部组件可用:`All components available`,部分组件需要配置或修复:`Some components require configuration or repair`,"PLATON 官网中间证书已更换,请更新插件安装器":`The PLATON official-site intermediate certificate has changed. Update the plugin installer.`,"PLATON Mac 发行包架构不符":`PLATON Mac release package architecture mismatch`,"请输入授权邮件中的用户名和密码。":`Enter the username and password from the authorization email.`,请选择有效的科学软件路径:`Select a valid scientific software path`,检查科学软件与运行环境:`Check scientific software and runtime environment`,"正在修复科学 Python 依赖":`Repairing scientific Python dependencies`,"(首次下载可能需要几分钟)":`(The initial download may take several minutes)`,"from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('科学内核及工作台资源可用')":`from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('Scientific kernel and workbench resources available')`,"; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · 探测器格式插件可用')":`; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · detector format plugins available')`,"Systre 19.6.0 · pcu 拓扑计算通过":`Systre 19.6.0 · pcu topology calculation passed`,"正在安装 Apple Rosetta 2 兼容组件":`Installing Apple Rosetta 2 compatibility components`,"从 SHELX 官方站点下载":`Downloading from the official SHELX site`,"SHELX 下载内容不是支持的可执行程序":`SHELX download is not a supported executable`,"已可用,保留当前安装":`Already available; keeping current installation`,正在安装:`Installing`,"尚未安装 DIALS":`DIALS is not installed`,"PLATON 编译需要 Apple 命令行工具;请运行 xcode-select --install,然后点击修复依赖。":`PLATON compilation requires Apple Command Line Tools; run xcode-select --install, then click Repair dependencies.`,"SHELX 官方 Mac 版需要 Rosetta 2,请先同意安装兼容组件。":`The official Mac version of SHELX requires Rosetta 2. Agree to install the compatibility components first.`,"暂未完成;可在健康检查中重试":`Not completed; retry from the health check`,"SHELX 下载或启动失败;请核对授权、网络及系统平台后重试。":`SHELX download or launch failed; check authorization, network, and system platform, then retry.`,"尚未安装 Systre":`Systre is not installed`,"尚未安装 Java":`Java is not installed`,"Systre 未能识别内置 pcu 网络":`Systre could not identify the built-in pcu network`,"尚未安装 PLATON":`PLATON is not installed`,"PLATON 安装配方已更新,点击修复依赖即可使用当前版本。":`The PLATON installation recipe has been updated. Click Repair dependencies to use the current version.`,"PLATON 未生成校验规则;请检查运行库":`PLATON did not generate verification rules; check the runtime`,"请输入 SHELX 授权信息以安装":`Enter SHELX authorization details to install`,"无法启动,请核对平台与运行库":`Unable to start; check the platform and runtime`,"衍射数据处理、结构求解、精修与三维晶体研究工作台":`Diffraction data processing, structure solution, refinement and a 3D crystallography workbench`,"正在准备 ⟦0⟧ 工作台,首次需要几分钟":`Preparing the ⟦0⟧ workbench; the first time takes a few minutes`,"⟦0⟧ 暂时无法使用":`⟦0⟧ is unavailable for now`,"管理 ⟦0⟧":`Manage ⟦0⟧`,"原生会话输入 ⟦0⟧ 可启用后台工具。":`Native session input ⟦0⟧ can enable background tools.`,"研究工具由服务方提供,沿用 Argus 的模型与执行后端。":`Research tools are provided by the service and use Argus's model and execution backend.`,"此插件由服务方提供并维护,无需停用或卸载。":`This plugin is provided and maintained by the service; there is nothing to disable or uninstall.`},ip=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),ap=/⟦\d+⟧/g,op=Object.entries(rp).filter(([e])=>e.includes(`⟦`)).sort((e,t)=>t[0].length-e[0].length).map(([e,t])=>({regex:RegExp(`^`+e.split(ap).map(ip).join(`([\\s\\S]*?)`)+`$`),slots:e.match(ap)??[],target:t})),sp=new RegExp(Object.keys(rp).filter(e=>e.length>1&&!e.includes(`⟦`)).sort((e,t)=>t.length-e.length).map(ip).join(`|`),`g`);function cp(e,t){if(t===`zh-CN`||!/[\u3400-\u9fff]/.test(e))return e;if(rp[e.trim()])return e.replace(e.trim(),rp[e.trim()]);for(let t of op){let n=t.regex.exec(e.trim());if(n){let e=new Map(t.slots.map((e,t)=>[e,n[t+1]]));return t.target.replace(ap,t=>e.get(t)??t)}}return e.replace(sp,e=>rp[e])}function lp(){let{locale:e}=z();return t=>typeof t==`string`?cp(t,e):t}var up=oe(),dp=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;function fp({health:e,setup:t,running:n,act:r,platform:i,machine:a}){let o=lp(),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(!1),[C,w]=(0,G.useState)(!1),T=t.windows_runtime,E=t.license?.platform_consent,D=E?.platform===i&&E?.machines.includes(a||``),O=e?.components||[],k=O.filter(e=>e.status!==`ready`),A=k.some(e=>e.license_required),j=k.some(e=>e.automatic);async function M(e){e.preventDefault();let n=await r(t.license.action,{username:d,password:p,accept_platform_license:y});m(``),n&&(u(!1),f(``),c(!0))}return(0,J.jsxs)(`div`,{className:`mt-5 border-t border-line/60 pt-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:()=>c(!s),className:`inline-flex items-center gap-2 text-sm text-ink-dim hover:text-ink`,children:[(0,J.jsx)(Be,{size:16,strokeWidth:1.5}),(0,J.jsx)(`span`,{children:o(e?.stale?o(`科学环境 · 上次检查结果`):e?.checked?e.ready?o(`科学环境已就绪`):o(`科学环境 · ${k.length} 项待配置`):o(`科学环境`))}),(0,J.jsx)(Ue,{size:13,className:`transition-transform duration-200 ${s?`rotate-180`:``}`})]}),(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint hover:text-ink disabled:opacity-45`,disabled:n,onClick:()=>{c(!0),r(`health`)},children:[(0,J.jsx)(Ke,{size:12}),o(`检查环境`)]})]}),e?.stale&&(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs leading-relaxed text-ink-dim`,children:o(`下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。`)}),o((A||j||!e?.checked)&&(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:o(` 免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。 `)})),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[o((j||!e?.checked||e.stale)&&(0,J.jsxs)(`button`,{className:dp,disabled:n,onClick:()=>{c(!0),r(`repair`)},children:[(0,J.jsx)(Ye,{size:14}),o(`修复依赖`)]})),o(t.license&&(0,J.jsxs)(`button`,{className:dp,disabled:n,onClick:()=>{u(!l),m(``),f(``)},children:[(0,J.jsx)(nn,{size:14}),o(o(A?`配置 SHELX`:`SHELX 授权安装`))]}))]}),T&&(0,J.jsxs)(`div`,{className:`mt-3`,children:[(0,J.jsxs)(`button`,{type:`button`,className:dp,disabled:n,onClick:()=>{w(!C),S(!1)},children:[(0,J.jsx)(Ye,{size:14}),o(`准备 PLATON 官方环境`)]}),C&&(0,J.jsxs)(`form`,{className:`mt-3 rounded-lg bg-bg/70 p-3`,onSubmit:async e=>{e.preventDefault(),x&&await r(T.action,{accept_software_license:!0})&&(w(!1),S(!1),c(!0))},children:[(0,J.jsxs)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:[o(T.notice),` `,(0,J.jsx)(`a`,{href:T.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)})]}),(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5`}),o(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{type:`submit`,className:dp,disabled:n||!x,children:o(`下载、验证并配置`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>{w(!1),S(!1)},children:o(`取消`)})]})]})]}),o(l&&t.license&&(0,J.jsxs)(`form`,{onSubmit:M,className:`mt-4 rounded-lg bg-bg/70 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm`,children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[o(t.license.name),o(` 学术授权`)]}),(0,J.jsxs)(`a`,{href:t.license.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-blue`,children:[o(`前往官网申请`),(0,J.jsx)(qe,{size:11})]})]}),(0,J.jsx)(`p`,{className:`mb-3 mt-1.5 text-xs leading-relaxed text-ink-faint`,children:o(`填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。`)}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`用户名`),(0,J.jsx)(`input`,{"aria-label":o(`SHELX 用户名`),value:d,onChange:e=>f(e.target.value),required:!0,maxLength:200,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`密码`),(0,J.jsx)(`input`,{"aria-label":o(`SHELX 密码`),type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,maxLength:500,autoComplete:`new-password`,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]})]}),o(D&&E&&(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-faint`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5`}),(0,J.jsxs)(`span`,{children:[o(E.text),` `,(0,J.jsx)(`a`,{href:E.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`查看许可 ↗`)})]})]})),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,J.jsxs)(`button`,{type:`submit`,className:dp,disabled:n||!d.trim()||!p.trim(),children:[(0,J.jsx)(Ye,{size:14}),o(`下载并安装 SHELX`)]}),(0,J.jsx)(`button`,{type:`button`,className:`px-2 text-xs text-ink-faint`,onClick:()=>{u(!1),f(``),m(``)},children:o(`取消`)})]})]})),s&&(0,J.jsxs)(`div`,{className:`mt-3`,"aria-label":o(`科学软件健康检查`),children:[o(!O.length&&(0,J.jsx)(`p`,{className:`py-2 text-xs text-ink-faint`,children:o(`点击“检查环境”可验证科学内核与外部程序。`)})),O.map(e=>(0,J.jsx)(`div`,{className:`border-b border-line/40 py-2.5 last:border-0`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[o(e.status===`ready`?(0,J.jsx)(We,{size:15,strokeWidth:1.7,className:`mt-0.5 shrink-0 text-blue/75`}):(0,J.jsx)(qt,{size:15,strokeWidth:1.5,className:`mt-0.5 shrink-0 text-ink-faint`})),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,J.jsx)(`span`,{children:o(e.name)}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-ink-faint`,children:o(e.status===`ready`?o(`可用`):e.license_required?o(`待授权安装`):o(`待修复`))})]}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-ink-faint`,children:o(e.description)}),(0,J.jsxs)(`details`,{className:`mt-1.5 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer hover:text-ink-dim`,children:o(e.status===`ready`?o(`查看检查详情`):o(`查看原因与安装方式`))}),(0,J.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words leading-relaxed`,children:o(e.detail)}),e.path&&(0,J.jsx)(`p`,{className:`mt-1 break-all leading-relaxed`,children:e.path}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[(0,J.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)}),o(e.id!==`python`&&t.actions.includes(`configure`)&&(0,J.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>{g(e.id),v(``)},className:`text-blue`,children:o(`使用已有安装`)}))]})]})]})]})},e.id)),o(h&&(0,J.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),await r(`configure`,{paths:{[h]:_}})&&(g(null),v(``))},className:`mt-3 rounded-lg bg-bg/70 p-3`,children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(o(h===`dials`?`DIALS 环境目录`:h===`systre`?`Systre JAR 路径(需要已有 Java)`:`${h.toUpperCase()} 可执行文件路径`)),(0,J.jsx)(`input`,{required:!0,value:_,onChange:e=>v(e.target.value),className:`mt-2 w-full rounded-md border border-line bg-panel px-2 py-2 text-sm text-ink`})]}),(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-ink-faint`,children:o(`填写运行 Argus 的电脑上的路径,验证成功后生效。`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{className:dp,disabled:n,children:o(`验证并使用`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>g(null),children:o(`取消`)})]})]})),o(e?.checked&&(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[o(`最近检查 `),o(new Date(e.checked*1e3).toLocaleString()),o(` · 检查不调用模型`)]}))]})]})}function pp(e){return e.installed&&e.enabled&&e.supported?`ready`:e.managed_by_host?!e.supported||e.operation?.status===`failed`?`unavailable`:`preparing`:`manual`}var mp=e=>`正在准备 ${e} 工作台,首次需要几分钟`,hp=e=>`${e} 暂时无法使用`,gp=e=>`flex h-9 min-w-0 flex-1 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`;function _p({plugins:e,compact:t=!1,pending:n,onLaunch:r,onManage:i}){let a=lp(),o=e.filter(e=>pp(e)!==`manual`),s=!e.length||e.some(e=>pp(e)===`manual`);return(0,J.jsxs)(J.Fragment,{children:[o.map(e=>{let o=pp(e),s=!t&&(0,J.jsx)(`button`,{type:`button`,onClick:i,"aria-label":a(`管理 ${e.name}`),title:a(`管理 ${e.name}`),className:`icon-control mr-1 shrink-0 p-1.5 text-ink-faint hover:text-ink`,children:(0,J.jsx)(Xt,{size:15})});if(o===`ready`)return(0,J.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,J.jsxs)(`button`,{type:`button`,disabled:n===e.id,onClick:()=>r(e),title:e.name,"aria-label":e.name,className:`${gp(t)} disabled:opacity-60`,children:[(0,J.jsx)(Yt,{size:17,strokeWidth:1.5,className:`shrink-0 text-blue`}),!t&&(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),!t&&(0,J.jsx)(Vt,{size:13,className:`shrink-0 text-ink-faint`})]}),s]},e.id);let c=o===`preparing`?mp(e.name):hp(e.name),l=o===`preparing`?e.operation?.progress:e.operation?.error||e.reason;return(0,J.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,J.jsxs)(`div`,{role:`status`,title:a(l||c),className:`flex min-w-0 flex-1 items-center text-sm text-ink-faint ${t?`h-9 justify-center`:`gap-2 px-3 py-1.5`}`,children:[o===`preparing`?(0,J.jsx)(an,{size:17,strokeWidth:1.5,className:`shrink-0 animate-spin`}):(0,J.jsx)(Yt,{size:17,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,J.jsxs)(`div`,{className:`min-w-0 leading-snug`,children:[(0,J.jsx)(`p`,{children:a(c)}),l&&(0,J.jsx)(`p`,{className:`mt-0.5 truncate text-xs`,children:a(l)})]})]}),s]},e.id)}),s&&(0,J.jsx)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,children:(0,J.jsxs)(`button`,{type:`button`,onClick:i,title:a(`插件`),"aria-label":a(`插件`),className:gp(t),children:[(0,J.jsx)(q,{size:16,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,J.jsx)(`span`,{children:a(`插件`)})]})})]})}function vp({compact:e=!1}){let t=lp(),{locale:n}=z(),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)([]),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(!1),_=(0,G.useRef)(null),v=a.some(e=>pp(e)===`preparing`),y=a.length>0&&a.every(e=>e.managed_by_host);async function b(e){let n=await fetch(`/api/plugins`,{headers:L(),signal:e});if(!n.ok)throw Error(t(`无法读取插件列表`));let r=await n.json();e?.aborted||o(r.plugins)}(0,G.useEffect)(()=>{r||(m(null),g(!1))},[r]),(0,G.useEffect)(()=>{let e=new AbortController,t=()=>b(e.signal).catch(t=>{!e.signal.aborted&&r&&c(t.message)});r&&(_.current?.focus(),c(``),u(!0)),t().finally(()=>{e.signal.aborted||u(!1)});let n=r||v?window.setInterval(t,r?1500:4e3):0,a=e=>{e.key===`Escape`&&i(!1)};return r&&window.addEventListener(`keydown`,a),()=>{e.abort(),n&&window.clearInterval(n),window.removeEventListener(`keydown`,a)}},[r,v]);async function x(e,n,r){let i=e.setup?.windows_runtime;if(i&&!i.accepted&&[`install`,`update`,`repair`,i.action].includes(n)&&r?.accept_software_license!==!0)return m({pluginId:e.id,action:n}),g(!1),c(``),!1;f(e.id),c(``);try{let i=await fetch(`/api/plugins/${e.id}/${n===`launch`?`launch`:`manage/${n}`}`,{method:`POST`,headers:{...L(),"Content-Type":`application/json`},body:r?JSON.stringify(r):void 0}),a=await i.json();if(!i.ok)throw Error(a.detail||t(`插件操作未完成`));return n===`launch`?window.location.assign(a.url):await b(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{f(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_p,{plugins:a,compact:e,pending:d,onLaunch:e=>void x(e,`launch`),onManage:()=>i(!0)}),r&&(0,up.createPortal)((0,J.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:()=>i(!1),children:(0,J.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`plugin-title`,onClick:e=>e.stopPropagation(),className:`max-h-[85vh] w-full max-w-xl overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`h2`,{id:`plugin-title`,className:`text-lg font-semibold`,children:t(`插件`)}),(0,J.jsx)(`button`,{ref:_,type:`button`,"aria-label":t(`关闭插件列表`),className:`icon-control p-1.5`,onClick:()=>i(!1),children:(0,J.jsx)(Je,{size:18})})]}),(0,J.jsx)(`p`,{className:`mb-6 mt-2 text-sm text-ink-faint`,children:t(t(y?`研究工具由服务方提供,沿用 Argus 的模型与执行后端。`:`按需安装研究工具,沿用 Argus 的模型与执行后端。`))}),t(s&&(0,J.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-ink-dim`,children:t(s)})),t(l&&(0,J.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`正在读取插件…`)})),t(!l&&!a.length&&(0,J.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`暂无可用插件`)})),t(a.map(e=>{let r=e.operation?.status===`running`||d===e.id,i=r||!e.supported,a=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;return(0,J.jsxs)(`article`,{className:`rounded-xl border border-line/70 p-4`,"data-testid":`plugin-${e.id}`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(Yt,{size:24,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:t(e.name)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t(e.installed_version||e.version)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:t(e.description)})]})]}),(0,J.jsxs)(`div`,{className:`mt-4 text-xs text-ink-faint`,children:[t(e.installed?e.enabled?t(`已启用`):t(`已停用`):t(`未安装`)),t(` · 当前后端 `),t(Array.from(new Set(Object.values(e.backends))).join(` / `))]}),t(!e.supported&&(0,J.jsx)(`p`,{className:`mt-3 text-sm text-ink-dim`,children:t(e.reason)})),t(e.operation?.status===`running`&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-sm text-ink-dim`,children:[(0,J.jsx)(an,{size:14,className:`animate-spin`}),t(e.operation.progress)]})),t(e.operation?.status===`failed`&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-ink-dim`,children:t(e.operation.error)})),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[t(!e.installed&&!e.managed_by_host&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`install`),children:[(0,J.jsx)(Ye,{size:14}),t(`安装`)]})),t(e.installed&&e.enabled&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`launch`),children:[t(`打开工作台`),(0,J.jsx)(Vt,{size:14})]})),t(e.installed&&!e.enabled&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`enable`),children:t(`启用`)})),t(e.update_available&&!e.managed_by_host&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`update`),children:[(0,J.jsx)(Ke,{size:14}),e.environment_update?t(`更新科学环境校验`):(0,J.jsxs)(J.Fragment,{children:[t(`更新至 `),t(e.version)]})]})),t(e.installed&&e.enabled&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`disable`),children:t(`停用`)})),t(e.installed&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`uninstall`),children:t(`卸载`)}))]}),p?.pluginId===e.id&&e.setup?.windows_runtime&&(0,J.jsxs)(`form`,{className:`mt-4 rounded-lg bg-bg/70 p-3`,onSubmit:async t=>{t.preventDefault(),!(!h||r)&&await x(e,p.action,{accept_software_license:!0})&&(m(null),g(!1))},children:[(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:t(`继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。`)}),(0,J.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:[t(e.setup.windows_runtime.notice),` `,(0,J.jsx)(`a`,{href:e.setup.windows_runtime.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:t(`官方安装说明 ↗`)})]}),(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`mt-0.5`}),t(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{type:`submit`,className:a,disabled:r||!h,children:t(`同意并继续`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,disabled:r,onClick:()=>{m(null),g(!1)},children:t(`取消`)})]})]}),(0,J.jsx)(`p`,{className:`mt-4 text-xs leading-relaxed text-ink-faint`,children:t(e.installed?t(`原生会话输入 ${e.command||``} 可启用后台工具。卸载保留会话、研究数据和科学软件。`):t(`首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。`))}),t(e.rights_notice&&(0,J.jsx)(`p`,{className:`mt-3 text-[10px] leading-relaxed text-ink-faint`,"data-testid":`plugin-rights-notice`,children:t(n===`zh-CN`&&e.rights_notice_zh||e.rights_notice)})),t(e.installed&&e.setup&&(0,J.jsx)(fp,{health:e.health,setup:e.setup,running:r,platform:e.platform,machine:e.machine,act:(t,n)=>x(e,t,n)}))]},e.id)}))]})}),document.body)]})}var yp=[`all`,`installed`,`available`,`builtin`],bp=[`install`,`update`,`enable`,`disable`,`uninstall`],xp=new Set([`install`,`update`,`uninstall`]),Sp={query:``,kind:`all`,tag:null};function Cp(e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}){return e.VITE_ARGUS_HOSTED_TRIAL===`1`}function wp(e,t){switch(t){case`all`:return!0;case`installed`:return e===`installed`||e===`package`;case`available`:return e===`available`;case`builtin`:return e===`builtin`}}function Tp(e,t){let n=t.trim().toLowerCase();return!n||[e.name,e.purpose,e.purpose_zh??``,...e.routing_path??[],...e.tags,...e.requires].join(` +`).toLowerCase().includes(n)}function Ep(e,t){return e.filter(e=>wp(e.kind,t.kind)&&(!t.tag||e.tags.includes(t.tag))&&(!t.routingPath||(e.routing_path??[]).join(`/`)===t.routingPath||(e.routing_path??[]).join(`/`).startsWith(`${t.routingPath}/`))&&Tp(e,t.query))}function Dp(e){let t=new Set;for(let n of e){let e=n.routing_path??[];for(let n=1;n<=e.length;n++)t.add(e.slice(0,n).join(`/`))}return[...t].sort()}function Op(e){let t=new Set;for(let n of e)for(let e of n.tags)e.trim()&&t.add(e.trim());return[...t].sort((e,t)=>e.localeCompare(t))}function kp(e,t){let n=t||e.managed_by_host;return e.actions.filter(e=>bp.includes(e)&&!(n&&xp.has(e)))}var Ap=e=>`verticals.action.${e}`,jp=e=>`verticals.kind.${e}`,Mp=e=>`verticals.filter.${e}`,Np=e=>`verticals.operation.${e}`;function Pp(e,t){return t===`zh-CN`&&e.purpose_zh&&e.purpose_zh.trim()?e.purpose_zh:e.purpose}function Fp(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function Ip(e){if(!e||e.status!==`running`)return null;let t=Number(e.progress);return!Number.isFinite(t)||t<=0?null:Math.max(0,Math.min(100,Math.round(t)))}var Lp=e=>e.operation?.status===`running`;function Rp(e){return e.some(Lp)}function zp(e,t){return e?t?1500:4e3:t?4e3:0}function Bp(e){if(e instanceof se){if(e.detail)return e.detail;let t=/^[A-Z]+ \S+ → \S+: ([\s\S]+)$/.exec(e.message);return t?t[1]:``}return e instanceof Error?e.message:String(e??``)}function Vp(e){return e instanceof se&&e.status===409}function Hp(e){return e instanceof se&&e.status===404}function Up(e,t){return Array.isArray(e)&&e.includes(t)}function Wp(e){return new Set(e.map(e=>e.name))}var Gp=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`,Kp=e=>`rounded-full border px-2.5 py-0.5 text-xs transition-colors ${e?`border-blue/60 bg-blue/10 text-blue`:`border-line text-ink-dim hover:border-blue/40 hover:text-ink`}`,qp=e=>`rounded px-1.5 py-0.5 text-[10px] font-semibold ${e===`ok`?`bg-ok/10 text-ok`:e===`warn`?`bg-warn/10 text-warn`:e===`blue`?`bg-blue/10 text-blue`:`bg-line text-ink-dim`}`,Jp={install:Ye,update:Ke,enable:mn,disable:pn,uninstall:vn};function Yp(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}catch{return n.toISOString()}}function Xp({compact:e=!1,onOpen:t}){let{t:n}=z();return(0,J.jsxs)(`button`,{type:`button`,onClick:t,title:n(`verticals.entry`),"aria-label":n(`verticals.entry`),"data-testid":`vertical-store-entry`,className:`mx-2 my-1 flex h-9 shrink-0 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`,children:[(0,J.jsx)(_n,{size:17,strokeWidth:1.5}),!e&&(0,J.jsx)(`span`,{children:n(`verticals.entry`)})]})}function Zp({row:e,locale:t,hosted:n,busy:r,failure:i,known:a,onAct:o,onJump:s,onTag:c}){let{t:l}=z(),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),m=Lp(e),h=r||m,g=kp(e,n),_=e.operation,v=Ip(_),y=e=>bp.includes(e)?l(Ap(e)):e,b=_&&bp.includes(_.action)?l(Np(_.action)):l(`verticals.operationRunning`),x=e.kind===`installed`?`ok`:e.kind===`available`?`neutral`:`blue`,S=async(t=!1)=>{d(!1),await o(e,`uninstall`,t?{force:!0}:void 0)};return(0,J.jsxs)(`article`,{id:`vertical-${e.name}`,"data-testid":`vertical-${e.name}`,"data-kind":e.kind,tabIndex:-1,className:`flex flex-col rounded-xl border border-line/70 p-4 outline-none focus-visible:border-blue/60`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(rn,{size:22,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:e.name}),(0,J.jsx)(`span`,{className:qp(x),"data-testid":`vertical-kind`,children:l(jp(e.kind))}),e.kind!==`available`&&(0,J.jsx)(`span`,{className:qp(e.enabled?`ok`:`neutral`),children:e.enabled?l(`verticals.enabled`):l(`verticals.disabledState`)}),e.update_available&&(0,J.jsx)(`span`,{className:qp(`warn`),"data-testid":`vertical-update`,children:l(`verticals.updateAvailable`)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:Pp(e,t)}),e.routing_path?.length?(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:e.routing_path.join(` / `)}):null]})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-ink-faint`,children:[e.installed_version&&(0,J.jsx)(`span`,{children:l(`verticals.installedVersion`,{version:e.installed_version})}),e.version&&e.version!==e.installed_version&&(0,J.jsx)(`span`,{children:l(`verticals.catalogVersion`,{version:e.version})}),e.size_bytes!=null&&(0,J.jsxs)(`span`,{children:[l(`verticals.size`),` `,Fp(e.size_bytes)]})]}),e.requires.length>0&&(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.requires`)}),e.requires.map(e=>a.has(e)&&s?(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e),"aria-label":l(`verticals.jumpTo`,{name:e}),title:l(`verticals.jumpTo`,{name:e}),className:`rounded-full border border-line px-2 py-0.5 font-mono text-ink-dim transition-colors hover:border-blue/60 hover:text-blue`,children:e},e):(0,J.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.shared.length>0&&(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.shared`)}),e.shared.map(e=>(0,J.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.tags.length>0&&(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.tags.map(e=>c?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint transition-colors hover:text-blue`,children:[`#`,e]},e):(0,J.jsxs)(`span`,{className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint`,children:[`#`,e]},e))}),e.missing_python.length>0&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-start gap-2 rounded-lg bg-warn/10 p-2.5 text-xs leading-relaxed text-warn`,"data-testid":`vertical-missing-python`,children:[(0,J.jsx)(yn,{size:14,className:`mt-0.5 shrink-0`}),(0,J.jsx)(`span`,{children:l(`verticals.missingPython`,{packages:e.missing_python.join(`, `)})})]}),!!e.runtime_issues?.length&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-runtime-issues`,children:l(`verticals.runtimeIssues`,{issues:e.runtime_issues.join(`; `)})}),!!e.install_issues?.length&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-install-issues`,children:l(`verticals.installIssues`,{issues:e.install_issues.join(`; `)})}),e.used_by.length>0&&(0,J.jsxs)(`div`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:()=>p(e=>!e),className:`inline-flex items-center gap-1 transition-colors hover:text-ink`,"data-testid":`vertical-used-by`,children:[e.used_by.length===1?l(`verticals.usedByOne`):l(`verticals.usedBy`,{count:e.used_by.length}),f?(0,J.jsx)(Wt,{size:12}):(0,J.jsx)(Ue,{size:12})]}),f&&(0,J.jsx)(`ul`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono`,children:e.used_by.map(e=>(0,J.jsx)(`li`,{className:`rounded bg-bg px-1.5 py-0.5`,children:e},e))})]}),m&&_&&(0,J.jsxs)(`div`,{className:`mt-3`,"data-testid":`vertical-progress`,children:[(0,J.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-ink-dim`,children:[(0,J.jsx)(an,{size:14,className:`animate-spin`}),(0,J.jsx)(`span`,{children:b}),v!=null&&(0,J.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-ink-faint`,children:[v,`%`]})]}),(0,J.jsx)(`div`,{role:`progressbar`,"aria-label":b,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":v??void 0,className:`mt-1.5 h-1 overflow-hidden rounded bg-line`,children:v==null?(0,J.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`}):(0,J.jsx)(`div`,{className:`h-full rounded bg-blue transition-[width] duration-500`,style:{width:`${v}%`}})}),_.message&&(0,J.jsx)(`p`,{className:`mt-1 break-words text-xs text-ink-faint`,children:_.message})]}),_?.status===`failed`&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-err`,"data-testid":`vertical-operation-failed`,children:[l(`verticals.operationFailed`,{action:y(_.action)}),_.message?` — ${_.message}`:``]}),i&&(0,J.jsxs)(`div`,{role:`alert`,className:`mt-3 rounded-lg border border-err/30 bg-err/5 p-2.5 text-sm text-ink-dim`,"data-testid":`vertical-failure`,children:[(0,J.jsx)(`p`,{className:`break-words`,children:i.text}),i.offerForce&&(0,J.jsxs)(`button`,{type:`button`,className:`${Gp} mt-2 border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(!0),children:[(0,J.jsx)(vn,{size:14}),l(`verticals.removeAnyway`)]})]}),g.length>0&&(0,J.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:g.map(t=>{let n=Jp[t];if(t===`uninstall`)return u?(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`${Gp} border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(),"data-testid":`vertical-confirm-uninstall`,children:[(0,J.jsx)(vn,{size:14}),l(`verticals.confirmUninstall`)]}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint hover:text-ink`,onClick:()=>d(!1),children:l(`common.cancel`)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:l(`verticals.confirmUninstallHint`,{name:e.name})})]},t):(0,J.jsxs)(`button`,{type:`button`,className:Gp,disabled:h,onClick:()=>d(!0),"data-action":t,children:[(0,J.jsx)(n,{size:14}),l(Ap(t))]},t);let r=t===`update`&&e.version?l(`verticals.updateTo`,{version:e.version}):l(Ap(t));return(0,J.jsxs)(`button`,{type:`button`,className:Gp,disabled:h,onClick:()=>void o(e,t),"data-action":t,children:[(0,J.jsx)(n,{size:14}),r]},t)})})]})}function Qp({payload:e,filter:t,onFilter:n,hosted:r,supported:i,loading:a,refreshing:o,error:s,pending:c,failures:l,onAct:u,onRefresh:d,onJump:f}){let{t:p,locale:m}=z(),h=e?.verticals??[],g=(0,G.useMemo)(()=>Op(h),[h]),_=(0,G.useMemo)(()=>Dp(h),[h]),v=(0,G.useMemo)(()=>Wp(h),[h]),y=(0,G.useMemo)(()=>Ep(h,t),[h,t]),b=t.query.trim()!==``||t.kind!==`all`||t.tag!==null||!!t.routingPath,x=e?.catalog;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:p(r?`verticals.hostedNote`:`verticals.intro`)}),i===!1&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-4 rounded-lg border border-line bg-bg/70 p-3 text-sm text-ink-dim`,"data-testid":`vertical-store-too-old`,children:p(`verticals.tooOld`)}),i!==!1&&(0,J.jsxs)(J.Fragment,{children:[x&&(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-faint`,"data-testid":`vertical-catalog`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,title:x.source,children:p(`verticals.catalogSource`,{source:x.source})}),x.release_tag&&(0,J.jsx)(`span`,{className:`rounded bg-bg px-1.5 py-0.5 font-mono`,children:p(`verticals.catalogRelease`,{tag:x.release_tag})}),(0,J.jsx)(`span`,{children:x.fetched_at?p(`verticals.catalogFetched`,{time:Yp(x.fetched_at,m)}):p(`verticals.catalogNever`)}),(0,J.jsxs)(`button`,{type:`button`,className:`${Gp} ml-auto`,disabled:o||a,onClick:d,"data-testid":`vertical-refresh-catalog`,children:[(0,J.jsx)(Ke,{size:14,className:o?`animate-spin`:``}),p(o?`verticals.refreshing`:`verticals.refreshCatalog`)]})]}),x?.error&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 rounded-lg border border-warn/40 bg-warn/10 p-2.5 text-sm text-warn`,"data-testid":`vertical-catalog-error`,children:p(`verticals.catalogError`,{error:x.error})}),s&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-err`,"data-testid":`vertical-store-error`,children:s}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-line bg-bg px-2.5 focus-within:border-blue/60`,children:[(0,J.jsx)(ot,{size:14,className:`shrink-0 text-ink-faint`}),(0,J.jsx)(`span`,{className:`sr-only`,children:p(`verticals.search`)}),(0,J.jsx)(`input`,{type:`search`,value:t.query,onChange:e=>n({...t,query:e.target.value}),placeholder:p(`verticals.searchPlaceholder`),className:`min-w-0 flex-1 bg-transparent text-sm text-ink outline-none placeholder:text-ink-faint`})]}),(0,J.jsx)(`div`,{role:`group`,"aria-label":p(`verticals.kindFilter`),className:`flex flex-wrap gap-1`,children:yp.map(e=>(0,J.jsx)(`button`,{type:`button`,"aria-pressed":t.kind===e,onClick:()=>n({...t,kind:e}),className:`h-8 rounded-md px-2.5 text-xs font-medium transition-colors ${t.kind===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:p(Mp(e))},e))})]}),_.length>0&&(0,J.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink-faint`,children:[p(`verticals.routingPath`),(0,J.jsxs)(`select`,{className:`rounded-md border border-line bg-bg p-1.5`,value:t.routingPath??``,onChange:e=>n({...t,routingPath:e.target.value}),children:[(0,J.jsx)(`option`,{value:``,children:p(`verticals.filter.all`)}),_.map(e=>(0,J.jsx)(`option`,{value:e,children:e.replaceAll(`/`,` / `)},e))]})]}),(g.length>0||b)&&(0,J.jsxs)(`div`,{role:`group`,"aria-label":p(`verticals.tagFilter`),className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[g.map(e=>(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":t.tag===e,className:Kp(t.tag===e),onClick:()=>n({...t,tag:t.tag===e?null:e}),children:[`#`,e]},e)),b&&(0,J.jsx)(`button`,{type:`button`,className:`ml-1 text-xs text-ink-faint hover:text-ink`,onClick:()=>n(Sp),children:p(`verticals.clearFilters`)})]}),h.length>0&&(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`verticals.count`,{shown:y.length,total:h.length})}),a&&!e&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.loading`)}),e&&h.length===0&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.none`)}),h.length>0&&y.length===0&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.noMatches`)}),y.length>0&&(0,J.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,"data-testid":`vertical-grid`,children:y.map(e=>(0,J.jsx)(Zp,{row:e,locale:m,hosted:r,busy:c===e.name,failure:l[e.name],known:v,onAct:u,onJump:f,onTag:e=>n({...t,tag:e})},e.name))})]})]})}function $p({open:e,onClose:t}){let{t:n}=z(),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)({}),[_,v]=(0,G.useState)(Sp),y=(0,G.useRef)(null),b=(0,G.useRef)(t);b.current=t;let x=(0,G.useRef)(n);x.current=n;let S=Rp(r?.verticals??[]),C=!!r?.host.managed_by_host||Cp();(0,G.useEffect)(()=>{if(!e||a!==null)return;let t=!1;return R.meta().then(e=>{t||o(Up(e.capabilities,le))},()=>{t||o(!0)}),()=>{t=!0}},[e,a]),(0,G.useEffect)(()=>{if(a!==!0||!e&&!S)return;let t=new AbortController,n=()=>R.verticals(t.signal).then(e=>{t.signal.aborted||(i(e),f(e=>e?.source===`load`?null:e))},n=>{t.signal.aborted||(Hp(n)?o(!1):e&&f({text:x.current(`verticals.loadFailed`),source:`load`}))});e&&c(!0),n().finally(()=>{t.signal.aborted||c(!1)});let r=zp(e,S),s=r?window.setInterval(n,r):0;return()=>{t.abort(),s&&window.clearInterval(s)}},[e,S,a]),(0,G.useEffect)(()=>{if(!e){g({}),f(e=>e?.source===`refresh`?null:e);return}y.current?.focus();let t=e=>{e.key===`Escape`&&b.current()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let w=(0,G.useCallback)(async()=>{try{i(await R.verticals()),f(e=>e?.source===`load`?null:e)}catch(e){Hp(e)?o(!1):f({text:x.current(`verticals.loadFailed`),source:`load`})}},[]),T=(0,G.useCallback)(async(e,t,n={})=>{m(e.name),g(t=>{let{[e.name]:n,...r}=t;return r});try{return await R.manageVertical(e.name,t,n),await w(),!0}catch(r){let i=Bp(r)||x.current(`verticals.actionFailed`),a=t===`uninstall`&&Vp(r)&&!n.force;return g(t=>({...t,[e.name]:{text:i,offerForce:a}})),!1}finally{m(null)}},[w]),E=(0,G.useCallback)(async()=>{u(!0),f(null);try{i(await R.refreshVerticalCatalog())}catch(e){f({text:Bp(e)||x.current(`verticals.loadFailed`),source:`refresh`})}finally{u(!1)}},[]),D=(0,G.useCallback)(e=>{v(Sp),!(typeof document>`u`)&&window.setTimeout(()=>{let t=document.getElementById(`vertical-${e}`);t?.scrollIntoView?.({block:`nearest`,behavior:`smooth`}),t?.focus?.()},0)},[]);return e?(0,up.createPortal)((0,J.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:t,children:(0,J.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`vertical-store-title`,onClick:e=>e.stopPropagation(),className:`flex max-h-[85vh] w-full max-w-4xl flex-col overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl scroll-thin`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`h2`,{id:`vertical-store-title`,className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,J.jsx)(_n,{size:20,strokeWidth:1.5,className:`text-blue`}),n(`verticals.title`)]}),(0,J.jsx)(`button`,{ref:y,type:`button`,"aria-label":n(`verticals.close`),className:`icon-control p-1.5`,onClick:t,children:(0,J.jsx)(Je,{size:18})})]}),(0,J.jsx)(Qp,{payload:r,filter:_,onFilter:v,hosted:C,supported:a,loading:s,refreshing:l,error:d?.text??``,pending:p,failures:h,onAct:T,onRefresh:()=>void E(),onJump:D})]})}),document.body):null}function em(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)||e}function tm(e,t,n){if(e.length===0)return`local`;let r=n.trim(),i=r?e.filter(e=>e.launch_cwd?.trim()===r):[];return i.length===0||t&&!i.some(e=>e.id===t)?`all`:`local`}function nm({projects:e,activeId:t,activeWork:n,localCwd:r,onSelect:i,onPrefetch:a,onManage:s,onResume:c,resumingId:l,onOpenPanel:u,onOpenLearning:d,onOpenVerticals:f,onNew:p,loading:m,creating:h=!1,error:g,onRetry:y,mobileOpen:x=!1,collapsed:T=!1,onToggleCollapse:E,themeMode:O,onCycleTheme:k}){let{t:A,locale:j}=z(),[M,ee]=(0,G.useState)(`local`),N=(0,G.useRef)(!1),[P,F]=(0,G.useState)(``),[te,ne]=(0,G.useState)(()=>new Set),re=T&&!x,ie=r.trim(),I=(0,G.useMemo)(()=>ie?e.filter(e=>e.launch_cwd?.trim()===ie):[],[ie,e]);(0,G.useEffect)(()=>{N.current||m||e.length===0||(N.current=!0,ee(tm(e,t,ie)))},[t,m,ie,e]);let L=M===`local`?I:e,ae=P.trim()?ef(L,P):L,oe=(0,G.useMemo)(()=>{if(M===`local`)return ae.length>0?[[ie||`Local`,ae]]:[];let e=new Map;return ae.forEach(t=>{let n=t.launch_cwd?.trim()||A(`common.unassigned`),r=e.get(n)??[];r.push(t),e.set(n,r)}),[...e.entries()]},[ie,M,ae]),se=e=>te.has(e)&&!P.trim();return(0,J.jsxs)(rt,{mobileOpen:x,collapsed:T,children:[(0,J.jsx)(`div`,{className:`chrome-seam-surface flex h-12 shrink-0 items-center border-b border-line/50 ${re?`justify-center`:`justify-between px-4`}`,children:re?(0,J.jsx)(jt,{size:22,compact:!0}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(jt,{size:24}),(0,J.jsx)(`button`,{type:`button`,onClick:E,"aria-label":A(`sidebar.collapse`),title:`${A(`sidebar.collapse`)} · Ctrl/⌘ B`,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,J.jsx)(o,{icon:C,className:`h-3.5 w-3.5`})})]})}),re?(0,J.jsx)(`div`,{className:`flex h-12 shrink-0 items-center justify-center`,children:(0,J.jsx)(`button`,{type:`button`,onClick:E,"aria-label":A(`sidebar.expand`),title:`${A(`sidebar.expand`)} · Ctrl/⌘ B`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink`,children:(0,J.jsx)(o,{icon:v,className:`h-3.5 w-3.5`})})}):null,re?(0,J.jsx)(vp,{compact:!0}):null,re&&f?(0,J.jsx)(Xp,{compact:!0,onOpen:f}):null,re&&d?(0,J.jsx)(pr,{onOpen:d,compact:!0}):null,re?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`nav`,{"aria-label":j===`zh-CN`?`工具与知识`:`Tools and knowledge`,"data-sidebar-resources":!0,className:`shrink-0 overflow-y-auto overscroll-contain border-b border-line/50 px-2 py-2 scroll-thin [&>section]:mx-2 [&>section]:border-0 [&>section]:py-0 [&>section>div>button:first-child]:px-3`,style:{maxHeight:`min(40dvh, 360px)`},children:[(0,J.jsx)(vp,{}),d&&(0,J.jsx)(pr,{onOpen:d}),(0,J.jsxs)(`details`,{className:`sidebar-tools mx-2 mt-1`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer px-2 py-2 text-xs text-ink-dim`,children:j===`zh-CN`?`更多工具与资源`:`More tools and resources`}),f?(0,J.jsx)(Xp,{onOpen:f}):null,null]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pb-1 pt-3`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:j===`zh-CN`?`项目`:`Projects`}),I.length>0&&I.lengthee(e.target.value),className:`min-w-0 bg-transparent text-xs text-ink-faint`,children:[(0,J.jsx)(`option`,{value:`local`,children:A(`common.local`)}),(0,J.jsx)(`option`,{value:`all`,children:A(`common.all`)})]}):null,(0,J.jsx)(`button`,{type:`button`,onClick:p,disabled:h,"aria-label":A(`sidebar.create`),title:A(`sidebar.create`),className:`ml-auto flex h-8 items-center justify-center rounded-md px-2 text-xs text-ink-dim hover:bg-bg disabled:opacity-40`,children:h?`…`:j===`zh-CN`?`+ 新建`:`+ New`})]}),(0,J.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,J.jsx)(`label`,{className:`sr-only`,htmlFor:`daemon-search`,children:A(`sidebar.find`)}),(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-line/60 bg-bg/60 px-2 focus-within:border-blue/60`,children:[(0,J.jsx)(`input`,{id:`daemon-search`,value:P,onChange:e=>F(e.target.value),placeholder:A(`sidebar.find`),className:`h-8 min-w-0 flex-1 bg-transparent text-xs text-ink outline-none placeholder:text-ink-faint`}),P?(0,J.jsx)(`button`,{type:`button`,"aria-label":A(`sidebar.clearSearch`),onClick:()=>F(``),className:`px-1 text-sm text-ink-faint hover:text-ink`,children:`×`}):null]})]}),(0,J.jsxs)(`div`,{className:`mobile-scroll-region min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-3 pb-3 scroll-thin`,children:[m&&e.length===0?(0,J.jsx)(`div`,{className:`px-1 py-3 text-xs text-ink-faint`,children:A(`common.loading`)}):null,g?(0,J.jsx)(`button`,{type:`button`,onClick:y,className:`mb-2 w-full rounded-md bg-err/5 px-3 py-2 text-left text-xs text-err`,children:A(`sidebar.refreshFailed`)}):null,!m&&!g&&ae.length===0?(0,J.jsxs)(`div`,{className:`px-1 py-4 text-xs text-ink-faint`,children:[(0,J.jsx)(`div`,{children:P.trim()?A(`sidebar.noMatches`,{query:P.trim()}):A(`sidebar.noSessions`)}),P.trim()?(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(``),className:`mt-2 text-xs text-ink-dim underline underline-offset-2 hover:text-ink`,children:A(`sidebar.clearSearch`)}):null]}):null,oe.map(([e,r])=>(0,J.jsxs)(`section`,{className:`mb-1 last:mb-0`,children:[r.length>1&&oe.length>1?(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":!se(e),title:e,onClick:()=>ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),className:`mb-1 flex h-7 w-full items-center gap-2 rounded-md px-1.5 text-left text-[11px] font-medium text-ink-faint hover:bg-bg/70 hover:text-ink-dim`,children:[(0,J.jsx)(o,{icon:S,className:`h-2.5 w-2.5 transition-transform ${se(e)?`-rotate-90`:``}`}),(0,J.jsx)(o,{icon:b,className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:em(e)})]}):null,r.length===1||oe.length===1||!se(e)?r.map(e=>{let r=e.id===t,u=r&&n?.sessionId===e.id?n:void 0,d=u?pi(u.status,j,u.connected):void 0,f=Jd(e),p=f?(e.label||e.display_name||``).trim():e.objective.trim()||A(`sidebar.unnamedSession`),m=e.daemon_alive&&e.daemon_protocol_compatible===!1,h=m&&e.daemon_protocol_error===`daemon release is incompatible with WebAPI release`,g=m&&!h,_=!e.daemon_alive&&e.last_active>0&&!!e.workdir?.trim();return(0,J.jsxs)(`div`,{"data-active":r?`true`:`false`,onPointerEnter:()=>{r||a?.(e.id)},className:`session-card group relative mb-0.5 h-14 w-full rounded-md transition-colors duration-150 ease-panel ${r?`text-ink`:`text-ink-dim hover:text-ink`}`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`absolute left-0 transition-colors ${r?`inset-y-1 w-px bg-blue`:`inset-y-2 w-px bg-transparent group-hover:bg-ink-faint/30`}`}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),onFocus:()=>{r||a?.(e.id)},"aria-current":r?`page`:void 0,title:`${p}${!f&&p!==e.id?` · ${e.id}`:``}${e.objective&&e.objective!==p?` — ${e.objective}`:``}`,className:`flex h-14 w-full min-w-0 flex-col justify-center px-2.5 text-left ${_?`pr-[4.75rem]`:`pr-10`}`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(ct,{ok:e.daemon_alive&&!g,title:g?A(`sidebar.updateRequired`):e.daemon_alive?A(`sidebar.daemonAlive`):A(`sidebar.stopped`)}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:p})]}),(0,J.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5 pl-3.5 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate ${g?`text-warn`:``}`,title:d,"data-session-work-state":u?.status.state,children:g?A(`sidebar.updateRequired`):d??(e.daemon_alive?A(`sidebar.runningFor`,{uptime:St(e.uptime_seconds)}):e.last_active>0?A(`sidebar.lastActive`,{time:wt(e.last_active,j)}):A(`sidebar.stopped`))}),h&&(0,J.jsx)(`span`,{title:A(`sidebar.updateAvailableHint`),className:`shrink-0 rounded border border-line px-1 text-[10px] leading-4`,children:A(`sidebar.updateAvailable`)})]})]}),_&&c?(0,J.jsx)(`button`,{type:`button`,disabled:l!=null,onClick:t=>{t.stopPropagation(),c(e.id)},"aria-label":A(`sidebar.resume`),title:A(`sidebar.resumeHint`,{workdir:e.workdir??``}),className:`absolute right-9 top-3 flex h-8 w-8 items-center justify-center rounded-md text-blue opacity-100 hover:bg-blue/10 disabled:opacity-40 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:l===e.id?`…`:(0,J.jsx)(o,{icon:D,className:`h-3 w-3`})}):null,(0,J.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),s(e.id)},"aria-label":A(`sidebar.manage`,{name:p}),title:A(`sidebar.manageHint`),className:`absolute right-1 top-3 flex h-8 w-8 items-center justify-center rounded-md text-ink-faint opacity-100 transition-opacity hover:bg-panel-raised hover:text-ink sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,J.jsx)(o,{icon:w,className:`h-4 w-4`})})]},e.id)}):null]},e))]}),(0,J.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between border-t border-line/50 px-4 py-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`config`),className:`icon-control flex h-8 w-8 items-center justify-center`,"aria-label":A(`sidebar.openSettings`),title:A(`common.settings`),children:(0,J.jsx)(o,{icon:_,className:`h-3.5 w-3.5`})}),(0,J.jsx)(pt,{themeMode:O,onCycleTheme:k})]})]})]})}var rm=new Set([`done`,`completed`,`failed`,`skipped`]);function im(e){return rm.has(e.status)}function am(e,t){return e.filter(e=>im(e)===t)}var om={in_progress:`rgb(var(--blue))`,running:`rgb(var(--blue))`,pending:`rgb(var(--ink-faint))`,queued:`rgb(var(--ink-faint))`,done:`rgb(var(--blue))`,completed:`rgb(var(--blue))`,blocked:`rgb(var(--err))`,failed:`rgb(var(--err))`};function sm({items:e,onDispose:t,onStop:n,onInspect:r,busy:i,readOnly:a=!1}){let{t:o}=z(),[s,c]=(0,G.useState)(!1),l=am(e,!1),u=am(e,!0),d=s?u:l;return(0,J.jsxs)(`section`,{className:`card flex flex-col ${d.length>0?`min-h-0 flex-1`:`shrink-0`}`,children:[(0,J.jsx)(U,{title:o(`panel.backlog`),right:(0,J.jsx)(`button`,{className:`text-[10px] text-ink-faint transition-colors hover:text-ink`,onClick:()=>c(e=>!e),children:o(s?`backlog.active`:`backlog.history`,{count:s?l.length:u.length})})}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[d.length===0&&(0,J.jsx)($e,{children:o(s?`backlog.noHistory`:`backlog.empty`)}),d.map(e=>{let s=om[e.status]??`rgb(var(--ink-faint))`,c=e.iterate;return(0,J.jsx)(`div`,{className:`group border-b border-line/60 px-3 py-2 last:border-0`,children:(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>r?.(e.id),disabled:!r,className:`block max-w-full truncate text-left text-xs font-medium text-ink enabled:hover:text-blue-sky enabled:focus-visible:outline-none enabled:focus-visible:underline`,title:r?o(`backlog.viewDetails`):void 0,children:e.title||e.objective}),(0,J.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[(0,J.jsx)(at,{color:s,children:Rn(e.status,o)}),typeof e.priority==`number`&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:Bn(e.priority,o)}),c&&(0,J.jsxs)(`span`,{className:`text-[10px] text-blue-sky`,children:[`↻ `,o(`backlog.iterating`)]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100`,children:[!a&&c&&(0,J.jsx)(W,{variant:`ghost`,onClick:()=>n(e.id),disabled:i,title:o(`backlog.stopIterating`),children:o(`backlog.stop`)}),!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(W,{variant:`ghost`,onClick:()=>t(e.id,`done`),disabled:i,title:o(`backlog.markDone`),children:`✓`}),(0,J.jsx)(W,{variant:`ghost`,onClick:()=>t(e.id,`rm`),disabled:i,title:o(`backlog.remove`),children:`✕`})]})]})]})},e.id)})]})]})}var cm={win:`rgb(var(--blue))`,milestone:`rgb(var(--blue))`,insight:`rgb(var(--ink-dim))`,decision:`rgb(var(--ink-dim))`,failure:`rgb(var(--err))`,note:`rgb(var(--ink-faint))`};function lm({entries:e}){let{t}=z(),n=[...e].reverse();return(0,J.jsxs)(`section`,{className:`card flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(U,{title:t(`panel.journal`),right:(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.length})}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[e.length===0&&(0,J.jsx)($e,{children:`no journal entries yet`}),n.map(e=>{let t=cm[e.kind]??`rgb(var(--ink-faint))`,n=String(e.extra?.pricing_status??``),r=e.extra&&Object.prototype.hasOwnProperty.call(e.extra,`cost_usd`)?e.extra.cost_usd:e.cost_usd,i=typeof r==`number`&&r>0?`${bt(r)}${n===`partial`||n===`unpriced`?`+`:``}`:n===`partial`||n===`unpriced`?n:``;return(0,J.jsxs)(`div`,{className:`border-b border-line/60 px-3 py-2 last:border-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full`,style:{background:t}}),(0,J.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide`,style:{color:t},children:e.kind}),(0,J.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:Dt(e.ts)})]}),(0,J.jsx)(`div`,{className:`mt-1 text-xs font-medium text-ink`,children:e.title}),e.summary&&(0,J.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-snug text-ink-dim`,children:e.summary}),(0,J.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(e.tags??[]).slice(0,4).map(e=>(0,J.jsx)(`span`,{className:`rounded bg-line/60 px-1 text-[9px] text-ink-faint`,children:e},e)),i?(0,J.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:i}):null]})]},e.id)})]})]})}function um(e){return e==null?``:e<3?`now`:e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h`}function dm({roles:e}){let{t}=z(),n=new Map(e.map(e=>[e.role,e])),r=et.map(e=>n.get(e)).filter(Boolean),i=e.filter(e=>!gt(e.role)),a=[...r,...i];return(0,J.jsxs)(`section`,{className:`card`,children:[(0,J.jsx)(U,{title:t(`panel.roles`)}),(0,J.jsx)(`div`,{children:a.map(e=>{let n=B.role[e.role]??B.info;return(0,J.jsxs)(`div`,{className:`grid grid-cols-[84px_minmax(0,1fr)_auto] items-center gap-2 border-b border-line/60 px-3 py-2 last:border-b-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{"data-role-dot":e.role,"aria-hidden":`true`,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{background:n}}),(0,J.jsx)(`span`,{className:`text-[11px] font-medium capitalize`,style:{color:e.active?n:B.inkDim},children:gt(e.role)?Ve(e.role,t):e.role})]}),(0,J.jsx)(`div`,{className:`min-w-0 truncate font-mono text-[10px] text-ink-faint`,title:e.model,children:e.model||`—`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 text-right`,children:[(0,J.jsx)(`span`,{className:`text-[10px]`,style:{color:e.active?B.ink:B.inkFaint},children:e.active?e.status||`active`:`idle`}),e.active&&um(e.age_s)&&(0,J.jsxs)(`span`,{className:`text-[10px] tabular-nums text-ink-faint`,children:[`· `,um(e.age_s)]}),e.effort&&(0,J.jsxs)(`span`,{className:`text-[10px]`,style:{color:Ze(e.effort)},children:[`· `,e.effort]})]})]},e.role)})})]})}function fm({open:e,snap:t,journal:n,busy:r,onClose:i,onDispose:a,onStop:o,onInspect:s}){let{t:c}=z();return(0,J.jsxs)(dt,{open:e,onClose:i,label:`Project inspector`,width:`max-w-6xl`,children:[(0,J.jsx)(lt,{title:c(`panel.project`),sub:t.session.display_name||t.session.id}),(0,J.jsxs)(`div`,{className:`h-[68vh] min-h-0 space-y-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid lg:grid-cols-[minmax(0,1.4fr)_minmax(300px,0.8fr)] lg:gap-3 lg:space-y-0 lg:overflow-hidden`,children:[(0,J.jsx)(sm,{items:t.backlog,onDispose:a,onStop:o,onInspect:s,busy:r}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,J.jsx)(dm,{roles:t.roles}),(0,J.jsx)(lm,{entries:n})]})]})]})}var pm=e=>e?new Date(e*1e3).toLocaleString():`—`;function mm({label:e,value:t}){return(0,J.jsxs)(`div`,{className:`rounded-md border border-line/70 bg-bg/40 px-3 py-2`,children:[(0,J.jsx)(`div`,{className:`text-[9px] font-semibold uppercase tracking-wider text-ink-faint`,children:e}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:t})]})}function hm({sid:e,itemId:t,onClose:n,onDone:r,onSkip:i,onStop:a,busy:o,readOnly:s=!1}){let{t:c}=z(),l=ke(e,t),u=l.data,d=u?im(u):!1,f=Vn(u?.outcome,c);return(0,J.jsxs)(dt,{open:!!t,onClose:n,label:c(`task.details`),width:`max-w-3xl`,showClose:!1,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 border-b border-line px-4 py-3 sm:flex-nowrap sm:px-5`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink`,children:u?.title||c(`task.details`)}),u?(0,J.jsx)(at,{children:Rn(u.status,c)}):null]})}),!s&&u&&!d?(0,J.jsxs)(`div`,{className:`order-3 flex w-full shrink-0 items-center justify-end gap-1 sm:order-none sm:w-auto`,children:[u.iterate?(0,J.jsx)(W,{onClick:()=>a(u.id),disabled:o,children:c(`task.stopLoop`)}):null,(0,J.jsx)(W,{onClick:()=>r(u.id),disabled:o,children:c(`task.done`)}),(0,J.jsx)(W,{variant:`danger`,onClick:()=>i(u.id),disabled:o,children:c(`task.skip`)})]}):null,(0,J.jsx)(`button`,{type:`button`,"aria-label":c(`task.close`),onClick:n,className:`order-2 rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink sm:order-none`,children:`×`})]}),(0,J.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto p-4 scroll-thin sm:p-5`,children:[l.isLoading?(0,J.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,J.jsx)(tt,{})}):null,l.isError?(0,J.jsx)(`div`,{className:`rounded-md border border-err/40 bg-err/5 p-3 text-xs text-err`,children:l.error.message}):null,u?(0,J.jsxs)(`div`,{className:`space-y-4`,children:[u.pending_question?(0,J.jsxs)(`div`,{className:`rounded-lg border border-warn/40 bg-warn/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-warn`,children:c(`task.waitingOnYou`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:u.pending_question})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.objective`)}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap rounded-lg border border-line bg-bg/50 p-3 text-sm leading-relaxed text-ink-dim`,children:u.objective||u.original_objective||c(`task.noObjective`)})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[(0,J.jsx)(mm,{label:c(`task.priority`),value:Bn(u.priority,c)}),(0,J.jsx)(mm,{label:c(`task.started`),value:pm(u.started_ts)}),(0,J.jsx)(mm,{label:c(`task.finished`),value:pm(u.finished_ts)})]}),f.length?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.outcome`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,J.jsx)(at,{children:e},e))})]}):null,u.iterate||u.iteration_cycles_done||u.iteration_cost_usd?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.iteration`)}),(0,J.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,J.jsx)(mm,{label:c(`task.mode`),value:u.iterate?c(`task.autoIterate`):c(`task.singlePass`)}),(0,J.jsx)(mm,{label:c(`task.cycles`),value:`${u.iteration_cycles_done??0}/${u.iteration_max_cycles??`—`}`}),(0,J.jsx)(mm,{label:c(`task.cost`),value:`$${(u.iteration_cost_usd??0).toFixed(2)}`})]})]}):null,u.last_error?(0,J.jsxs)(`section`,{className:`rounded-lg border border-err/30 bg-err/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:c(`task.lastError`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs leading-relaxed text-ink-dim`,children:u.last_error})]}):null,u.notes?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.notes`)}),(0,J.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-relaxed text-ink-dim`,children:u.notes})]}):null,u.tags?.length||u.deps?.length?(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(u.tags??[]).map(e=>(0,J.jsxs)(at,{children:[`#`,e]},`tag-${e}`)),u.deps?.length?(0,J.jsx)(at,{children:c(`task.dependsOnCount`,{count:u.deps.length})}):null]}):null]}):null]})]})}function gm({onPointerDown:e,onReset:t,onNudge:n,value:r,min:i=240,max:a=600,label:o=`Resize panel`}){return(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":o,"aria-valuenow":r,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:e,onDoubleClick:t,onKeyDown:e=>{e.key===`ArrowLeft`?(e.preventDefault(),n(-16)):e.key===`ArrowRight`?(e.preventDefault(),n(16)):e.key===`Home`&&(e.preventDefault(),t())},className:`group relative hidden w-2 shrink-0 cursor-col-resize items-center justify-center outline-none lg:flex`,children:(0,J.jsx)(`span`,{className:`h-full w-px bg-line/30 transition-colors duration-150 group-hover:bg-blue/70 group-focus:bg-blue/70`})})}function _m({sid:e,record:t,expanded:n=!1,zh:r}){let[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(``);(0,G.useEffect)(()=>{if(!i||!e)return;let n=new AbortController;return l(!0),d(``),R.workRecord(e,t.role,t.id,n.signal).then(e=>{n.signal.aborted||s(e.detail)}).catch(e=>{n.signal.aborted||d(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||l(!1)}),()=>n.abort()},[i,e,t.id,t.role,t.detail]);let f=o.length>=t.detail.length?o:t.detail;return(0,J.jsxs)(`details`,{open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,J.jsxs)(`summary`,{children:[(0,J.jsx)(`span`,{children:i?r?`收起详情`:`Hide details`:r?`展开完整记录`:`Read full record`}),(0,J.jsx)(Ue,{size:12})]}),(0,J.jsxs)(J.Fragment,{children:[c&&(0,J.jsx)(`small`,{role:`status`,children:r?`正在读取完整记录…`:`Loading the full record…`}),u&&(0,J.jsx)(`small`,{role:`status`,children:r?`暂未读取到完整记录,已显示保存的摘要。可收起后重试。`:`Full record unavailable; the saved preview is shown. Reopen to retry.`}),(0,J.jsx)(`div`,{className:`agent-record-actions`,children:(0,J.jsx)(Qe,{text:f,label:r?`复制完整记录`:`Copy full record`,copiedLabel:r?`已复制`:`Copied`})}),(0,J.jsx)(`div`,{className:`agent-record-detail`,children:(0,J.jsx)(H,{children:f})}),t.round_index!=null&&(0,J.jsx)(`small`,{children:r?`第 ${t.round_index} 轮`:`Round ${t.round_index}`})]})]})}function vm({sid:e,view:t,roles:n=[],events:r=[],taskId:i,paused:a=!1,selectedRole:o,onSelectRole:s,onClose:c,showTabs:l=!0}){let{locale:u,t:d}=z(),f=u===`zh-CN`,[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(24),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(``),[x,S]=(0,G.useState)(Date.now),C=o||p||n.find(e=>e.active)?.role||t?.active_role||`manager`,w=bi(t,n,C,a,i),T=vi(t,C,i).map(e=>{let t=e.detail;for(let n of r){if(n.kind===`reasoning`)continue;let r=String(n.event_id||n.id||``),i=String(n.message_id||``);if(r!==e.id&&(!i||e.id!==`${e.role}:${i}`))continue;let a=gi(String(n.text||n.reason||n.summary||``));a.length>t.length&&(t=a)}return t===e.detail?e:{...e,detail:t}});(0,G.useEffect)(()=>{g(24),b(``)},[e,C,i]);let E=i?ii(void 0,t,i):0,D=E?vi(t,C,i,E):T,O=D[0],k=D.find(e=>e.detail&&[`agent_message`,`assistant_message`,`decision`,`verdict`,`handoff`,`review`,`completion`].includes(e.kind)),A=yi(r,C,i,E),j=A&&Number(A.ts||0)>=(O?.ts??0),M=!j&&O&&[`agent_message`,`assistant_message`].includes(O.kind)&&O.detail?O.detail.split(/[。\n]/)[0].slice(0,70):_i(j?String(A.kind):O?.kind||`task`,f,j?String(A.tool_name||``):``),ee=n.find(e=>e.role===C)?.model||t?.roles.find(e=>e.role===C)?.model,N=O?Math.max(0,Math.floor(x/1e3-O.ts)):0,P=Math.max(O?.ts??0,j?Number(A?.ts||0):0),F=w&&P?xi(x/1e3-P,f):``;(0,G.useEffect)(()=>{if(!w)return;let e=setInterval(()=>S(Date.now()),1e3);return()=>clearInterval(e)},[w]);let te=e=>gt(e)?Ve(e,d):e;return(0,J.jsxs)(`section`,{className:`agent-activity`,style:{"--agent-role-color":_t(C)},"aria-label":f?`工作详情`:`Work details`,children:[(0,J.jsxs)(`header`,{className:`agent-activity-heading`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Ge,{size:15}),f?`工作详情`:`Work details`]}),c&&(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":f?`关闭工作详情`:`Close work details`,children:(0,J.jsx)(Je,{size:17})})]}),l&&(0,J.jsx)(`div`,{className:`agent-activity-tabs`,role:`group`,"aria-label":f?`筛选 Agent`:`Filter agents`,children:et.map(e=>(0,J.jsxs)(`button`,{type:`button`,"data-role":e,"aria-pressed":C===e,style:{"--agent-role-color":_t(e)},onClick:()=>{m(e),s?.(e)},children:[(0,J.jsx)(`i`,{"data-active":bi(t,n,e,a,i)}),te(e)]},e))}),(0,J.jsxs)(`div`,{className:`agent-current`,"data-active":w,children:[(0,J.jsxs)(`div`,{className:`agent-current-kicker`,children:[(0,J.jsx)(`span`,{children:w?f?`当前工作`:`Current work`:a?f?`工作已暂停`:`Work paused`:f?`最近进度`:`Latest progress`}),w?(0,J.jsxs)(`span`,{className:`agent-live-indicator`,"data-stale":F?!0:void 0,children:[(0,J.jsx)(`i`,{}),f?`处理中`:`In progress`,F&&(0,J.jsx)(`small`,{className:`agent-live-stale`,children:F})]}):(0,J.jsx)(dn,{size:12})]}),(0,J.jsx)(`h3`,{children:O||j?M:w?f?`尚无本次工作记录`:`No work recorded for this attempt yet`:f?`等待任务分配`:`Waiting for an assignment`}),k?.detail&&(0,J.jsx)(`div`,{className:`agent-current-summary`,children:(0,J.jsx)(H,{children:k.detail})}),!k&&O?.detail&&(0,J.jsx)(`p`,{className:`agent-current-summary`,children:O.detail}),O&&(0,J.jsxs)(`div`,{className:`agent-current-meta`,children:[(0,J.jsx)(Jt,{size:12}),(0,J.jsx)(`span`,{children:f?`${N<60?N+` 秒`:N<3600?Math.floor(N/60)+` 分钟`:N<86400?Math.floor(N/3600)+` 小时`:Math.floor(N/86400)+` 天`}前更新`:`Updated ${N<60?N+`s`:N<3600?Math.floor(N/60)+`m`:N<86400?Math.floor(N/3600)+`h`:Math.floor(N/86400)+`d`} ago`})]}),(0,J.jsxs)(`details`,{className:`agent-technical-details`,children:[(0,J.jsx)(`summary`,{children:f?`查看运行信息`:`Runtime details`}),(0,J.jsxs)(`p`,{children:[te(C),ee?` · ${ee}`:``,O?.round_index==null?``:f?` · 第 ${O.round_index} 轮`:` · Round ${O.round_index}`]})]})]}),(0,J.jsxs)(`div`,{className:`agent-records-heading`,children:[(0,J.jsx)(`span`,{children:f?`工作记录`:`Work log`}),(0,J.jsxs)(`span`,{children:[T.length,` `,f?`条`:`records`]})]}),(0,J.jsxs)(`div`,{className:`agent-records`,role:`log`,"aria-live":`off`,children:[T.slice(0,h).map((t,n)=>{let r=w&&t.id===O?.id,i=[`done`,`completed`].includes(t.status),a=[`failed`,`error`,`rejected`].includes(t.status),o=i?We:[`tool_use`,`command_execution`].includes(t.kind)?st:Qt;return(0,J.jsxs)(`article`,{className:`agent-record`,"data-active":r,"data-failed":a,children:[(0,J.jsx)(`span`,{className:`agent-record-icon`,children:(0,J.jsx)(o,{size:13})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`agent-record-title`,children:[(0,J.jsx)(`strong`,{children:_i(t.kind,f)}),(0,J.jsx)(`time`,{children:new Date(t.ts*1e3).toLocaleTimeString(f?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})})]}),(0,J.jsx)(`small`,{children:r?f?`进行中`:`In progress`:a?f?`未完成`:`Did not finish`:i?f?`已完成`:`Completed`:f?`已记录`:`Recorded`}),(t.detail||e)&&(0,J.jsx)(_m,{sid:e,record:t,zh:f,expanded:n===0||t.id===k?.id})]})]},t.id)}),!T.length&&(0,J.jsx)(`p`,{className:`agent-records-empty`,children:f?`${te(C)}尚未留下这个任务的工作记录。`:`No work has been recorded for this task by ${te(C)}.`})]}),(0,J.jsxs)(`div`,{className:`agent-records-footer`,children:[hg(e=>e+24),children:f?`加载更早记录(还剩 ${T.length-h} 条)`:`Load earlier records (${T.length-h} remaining)`}),e&&(0,J.jsx)(`button`,{type:`button`,disabled:_,onClick:()=>{v(!0),b(``),R.downloadWorkLog(e,C,i).catch(e=>b(e instanceof Error?e.message:String(e))).finally(()=>v(!1))},children:_?f?`正在准备完整记录…`:`Preparing full log…`:f?`下载完整工作记录(含更早历史)`:`Download full work log (including earlier history)`}),y&&(0,J.jsx)(`small`,{role:`alert`,children:y})]})]})}var ym=[`active`,`running`,`in_progress`,`claimed`],bm=[`complete`,`completed`,`done`,`success`,`incomplete`,`stalled`,`blocked`,`ended`],xm=864e5,Sm=300;function Cm(e,t){return zn(e,t)}function wm(e){let t=e.type.toLowerCase().split(/[._-]/).at(-1);return[`failed`,`failure`,`error`].includes(t??``)||e.tone===`error`&&/\bfailed\b/i.test(e.title)}function Tm(e,t,n=new Date){let r=new Date(e*1e3),i=r.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()),o=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate());if(o===a)return i;let s=+(t===`zh-CN`);return o>=a-(n.getDay()-s+7)%7*xm&&on;(0,G.useEffect)(()=>{if(n!=null||o)return;let e=a.current;if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight);t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[e,o,n]);let d=!o&&n!=null&&u?`${e.slice(0,n)}…`:e;return(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(`p`,{ref:a,title:t||void 0,className:`${n==null&&!o?`line-clamp-3`:``} whitespace-pre-wrap break-words ${r}`,children:d}),u?(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`mt-1 text-xs text-blue-sky hover:text-ink`,children:i(o?`mission.showLess`:`mission.showMore`)}):null]})}function Dm(e){let t=[...e.dag],n=[],r=new Set;for(;t.length;){let i=t.findIndex(t=>t.deps.every(t=>r.has(t)||!e.dag.some(e=>e.id===t))),[a]=t.splice(i>=0?i:0,1);n.push(a),r.add(a.id)}return n}function Om(e,t=16){let n=Dm(e);if(n.length<=t)return{nodes:n,hidden:[]};let r=new Set(n.slice(-t).map(e=>e.id)),i=n.find(e=>[`running`,`in_progress`,`claimed`].includes(e.status)),a=new Map(n.map(e=>[e.id,e])),o=i?[i]:[];for(;o.length;){let e=o.pop();r.has(e.id)||(r.add(e.id),e.deps.forEach(e=>{let t=a.get(e);t&&o.push(t)}))}return{nodes:n.filter(e=>r.has(e.id)),hidden:n.filter(e=>!r.has(e.id))}}function km({view:e}){let{t}=z(),n=e.achievement;return n?(0,J.jsxs)(`section`,{className:`border-b border-ok/35 bg-ok/5 px-5 py-4 animate-appear`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ok`,children:t(`mission.achievement`)}),(0,J.jsx)(`div`,{className:`mt-2 text-sm font-semibold text-ink`,children:n.title}),n.summary?(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:n.summary}):null,(0,J.jsxs)(`div`,{className:`mt-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[t(`mission.elapsed`),` `]}),(0,J.jsx)(`span`,{className:`font-mono text-ink`,children:zf(n.elapsed_seconds??0)})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-1 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{children:t(`mission.rejectedAttempts`,{count:n.rejected_attempts??0})}),(0,J.jsx)(`span`,{children:t(`mission.skillsLearned`,{count:n.skills_learned??0})}),(0,J.jsx)(`span`,{children:t(`mission.artifacts`,{count:n.artifacts??0})})]})]}):null}function Am({view:e,sid:t=``,snapshot:n,artifacts:r=[],onOpenArtifact:i,onOpenDelivery:a,gitDiff:o,onNotify:s,onAsk:c,connected:l=!0,events:u=[]}){let{locale:d,t:f}=z(),p=(0,G.useMemo)(()=>({...e,role_work:e.role_work.map(e=>({...e,detail:Xc(e.detail,d).text}))}),[d,e]),m=new Map(e.roles.map(e=>[e.role,e])),h=!!n?.daemon.alive||e.dag.length>0||e.roles.some(e=>![``,`idle`,`waiting`].includes(e.status)),g=e.dag.find(e=>[`running`,`in_progress`,`claimed`].includes(e.status)),_=Om(e),v=_.nodes,y=n?ci(n,e,u):null,b=y?[`running`,`waiting`].includes(y.state):!1,x=d===`zh-CN`,S=Rf(e.mission.objective||e.mission.title||(b?x?`正在处理你的请求`:`Working on your request`:e.artifacts.length?x?`已完成,成果在下方`:`Completed; results below`:f(`mission.waiting`))),[C,w]=(0,G.useState)(b);(0,G.useEffect)(()=>{b&&w(!0)},[b]);let T=e.mission.final_output?.trim()||``,E=!!(T&&T!==e.mission.summary.trim()),[D,O]=(0,G.useState)(Math.max(0,e.timeline.length-1)),[k,A]=(0,G.useState)(e.active_role||`planner`),[j,M]=(0,G.useState)(g?.id||``),[ee,N]=(0,G.useState)(!1),P=e.delivery,F=(()=>{if(!P)return!1;let t=e=>e.replace(/\s+/g,``).slice(0,80),n=t(e.mission.summary||``),r=t(P.summary||P.title||``);return!!(n&&r)&&(n.startsWith(r)||r.startsWith(n))})(),te=new Map(r.map(e=>[e.path,e])),ne=e.learned_skills.filter(e=>e.status===`active`),re=e.learned_wiki_pages.filter(e=>e.status!==`retired`),ie=!!(e.storage.project_skill_dir||e.storage.global_skill_dir||e.storage.wiki_paths.length||e.storage.skill_history_compressed||e.storage.wiki_retired_compressed),I=!!(ne.length||re.length||ie),L=e.mission.status.toLowerCase(),ae=n?ci(n,e,u):null,oe=ae?ae.state===`running`:[`working`,`grounding`,`framed`].includes(L),se=[`degraded`,`red`,`critical`].includes(e.health?.toLowerCase()??``),ce=[`failed`,`error`].includes(e.mission.status.toLowerCase()),le=e.dag.some(t=>t.status.toLowerCase()===`failed`&&(t.id===e.mission.id||!e.mission.id&&!oe&&!g)),ue=ae?.state===`paused`||[`hold`,`paused`].includes(e.stage.id.toLowerCase()),de=e.outcome.execution_status?.toLowerCase()===`failed`&&e.stage.id.toLowerCase()===`delivery`,fe=se||de||ce||le||ue,pe=se?`mission.attentionHealth`:de?`mission.deliveryFailed`:ce?`mission.attentionFailed`:le?`mission.attentionStepFailed`:`mission.attentionPaused`,me=e.role_work.filter(t=>ym.includes(t.status.toLowerCase())&&(!e.mission.id||(t.item_id||t.mission_id)===e.mission.id)).sort((e,t)=>t.ts-e.ts),he=me.find(t=>t.role===e.active_role)??me[0],ge=bm.includes(L),_e=Vn(e.outcome,f)[0]??Rn(e.mission.status,f),ve=l?ae?.state===`paused`||ae?.state===`unknown`?pi(ae,d):fe?f(pe):ge?[f(`mission.statusDone`,{outcome:_e,elapsed:zf(e.mission.elapsed_seconds)}),ae?.state===`waiting`?pi(ae,d):``].filter(Boolean).join(` `):ae?pi(ae,d):oe&&he?f(`mission.statusActive`,{role:zn(e.active_role||he.role,f),work:he.title}):f(`mission.statusWaiting`):d===`zh-CN`?`实时连接已断开,以下是已收到的记录。`:`Live connection lost; these are the records already received.`,ye=l?se||de||ce||le?`error`:ue||ae?.state===`waiting`?`waiting`:ge?`done`:oe&&he?`active`:`waiting`:`waiting`,be=String(e.outcome.execution_status||``).toLowerCase(),xe=ge&&![`completed`,`done`,`success`].includes(be),Se=ge&&!xe&&e.outcome.review_status===`done`&&e.review.status===`done`?Xc(e.review.reason,d).text.trim():``,Ce=Se||e.mission.summary,we=[...e.timeline].reverse().find(t=>t.cause&&t.detail&&(!e.mission.id||t.item_id===e.mission.id)&&(!e.mission.started_at||t.ts>=e.mission.started_at)),Te=we?Xc(we.detail,d,{cause:we.cause,technical:we.technical,language:e.language}):[`skipped`,`blocked`,`rejected`,`continue`].includes(String(e.review.status||``).toLowerCase())?Xc(e.review.reason,d):null,Ee=String(e.outcome.interruption_kind||``).toLowerCase(),De=fe||xe,Oe=De?Te?.text||(Ee&&Ee!==`none`?Ic(Ee,d):``):``,ke=ae?.reason===`operator_input`?f(`mission.nextAfterReply`):De&&e.outcome.resumable?f(n?.daemon.alive?`mission.nextResumeLive`:`mission.nextResume`):``;(0,G.useEffect)(()=>O(Math.max(0,e.timeline.length-1)),[e.timeline.length]),(0,G.useEffect)(()=>{g?.id&&M(g.id)},[g?.id]);let Ae=async()=>{if(!ee){N(!0);try{await R.setContinuous(t,!0,n?.continuous?.objective??``),s?.(`success`,f(`sidebar.resumeSuccess`))}catch(e){s?.(`error`,f(`sidebar.resumeFailed`,{error:xt(e)}))}finally{N(!1)}}},je=e.timeline.slice(0,D+1).slice(-12).reverse(),Me=e.dag.find(e=>e.id===j);if(n&&l&&n.daemon.read_status!==`error`&&!h&&!fe&&[``,`idle`,`waiting`].includes(L)&&!n.backlog.length&&!e.role_work.length&&!e.timeline.length&&!e.mission.summary&&!E&&!P&&!e.artifacts.length&&!I&&!r.some(e=>e.exists)&&!(o?.available&&(o.status||o.diff))){let e=d===`zh-CN`,t=n.session.objective?.trim();return(0,J.jsx)(`section`,{className:`min-h-0 flex-1 overflow-y-auto bg-panel px-5 py-8 scroll-thin`,"aria-label":f(`mission.control`),"data-testid":`project-ready`,children:(0,J.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold text-ink`,children:e?`还没有安排执行任务`:`No work has been assigned yet`}),t?(0,J.jsx)(`div`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:(0,J.jsx)(H,{children:t})}):null,(0,J.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`在下方告诉 Manager 你想完成什么,也可以直接询问这个项目的进展。`:`Tell the Manager what you want to accomplish below, or ask about this project’s progress.`}),c?(0,J.jsx)(`button`,{type:`button`,className:`mt-4 rounded-lg border border-line px-3 py-2 text-sm text-ink hover:border-blue`,onClick:()=>c(e?`这个项目目前做到了哪一步?有哪些结果,下一步是什么?`:`Where does this project stand? What results do we have, and what comes next?`),children:e?`问 Manager 项目现状`:`Ask the Manager about this project`}):null]})})}return(0,J.jsx)(`section`,{className:`mission-overview min-h-0 flex-1 overflow-x-hidden overflow-y-auto bg-panel scroll-thin`,"aria-label":f(`mission.control`),children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-[960px]`,children:[(0,J.jsxs)(`header`,{className:`px-5 pb-6 pt-7 sm:px-8`,children:[(0,J.jsx)(`div`,{role:`heading`,"aria-level":1,className:`mt-1 line-clamp-4 max-w-4xl text-xl font-semibold leading-snug text-ink`,title:S,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:S})}),S.length>600?(0,J.jsxs)(`details`,{className:`mt-2 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer hover:text-ink`,children:f(`mission.showObjective`)}),(0,J.jsx)(`div`,{className:`mt-2 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:S})})]}):null,(0,J.jsxs)(`div`,{className:`mission-status-line`,"data-tone":ye,role:fe?`alert`:`status`,children:[(0,J.jsxs)(`div`,{className:`mission-status-line__signal`,children:[(0,J.jsx)(`span`,{className:`mission-status-line__marker`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:ve})]}),e.frontier.change?(0,J.jsx)(`div`,{className:`mission-status-line__subtitle`,children:e.frontier.change}):null,Oe?(0,J.jsx)(`p`,{className:`mt-1.5 pl-[1.125rem] text-sm leading-relaxed text-ink-dim`,title:Te?.technical||void 0,children:Oe}):null,ke?(0,J.jsx)(`p`,{className:`mt-1 pl-[1.125rem] text-sm leading-relaxed text-ink-dim`,children:ke}):null]}),oe&&he?.detail?(0,J.jsx)(`div`,{className:`mt-4 text-sm text-ink-dim`,children:(0,J.jsx)(Em,{detail:Xc(he.detail,d).text,previewLength:Sm,textClassName:`leading-6`})}):null,Ce||E?(0,J.jsxs)(`div`,{className:`mt-5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1 text-sm font-semibold text-ink`,children:Se?d===`zh-CN`?`验收结果`:`Review result`:f(P&&F?P.kind===`submission_certified`?`mission.deliveryCertified`:`mission.taskCompleted`:xe?`mission.lastProgress`:`mission.summary`)}),P&&F&&a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(P),title:P.primary_target?te.get(P.primary_target.path)?.storage_path||P.primary_target.path:P.title,className:`shrink-0 rounded-md bg-ink px-3 py-2 text-sm font-medium text-surface hover:opacity-80`,children:f(P.primary_target?`mission.openResult`:`mission.viewTask`)}):null]}),(0,J.jsx)(`div`,{className:`mt-3 whitespace-pre-wrap text-sm leading-7 text-ink-dim`,"data-testid":`mission-result-summary`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:Ce})}),Se&&e.mission.summary&&Se!==e.mission.summary?(0,J.jsxs)(`details`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer`,children:d===`zh-CN`?`执行者记录`:`Execution note`}),(0,J.jsx)(`div`,{className:`mt-2 text-sm leading-6`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:e.mission.summary})})]}):null,E?(0,J.jsxs)(`details`,{className:`mt-2 border-t border-ok/20 pt-2 text-xs text-ink-dim`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer font-medium text-ok hover:text-ink`,children:f(`mission.showFullOutput`)}),(0,J.jsx)(`div`,{className:`mt-3 break-words text-sm leading-relaxed text-ink`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:T})})]}):null]}):null,P&&!F?(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 rounded border border-ok/30 bg-ok/5 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ok`,children:f(P.kind===`submission_certified`?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,J.jsx)(`div`,{className:`mt-1 truncate text-xs text-ink-dim`,title:P.summary||P.title,children:P.summary||P.title})]}),a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(P),title:P.primary_target?te.get(P.primary_target.path)?.storage_path||P.primary_target.path:P.title,className:`shrink-0 rounded border border-ok/40 px-2 py-1 font-mono text-xs text-ok hover:border-ok`,children:f(P.primary_target?`mission.openResult`:`mission.viewTask`)}):null]}):null]}),e.artifacts.length?(0,J.jsxs)(`section`,{className:`px-5 pb-6 sm:px-8`,"aria-label":d===`zh-CN`?`成果文件`:`Result files`,children:[(0,J.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-ink`,children:d===`zh-CN`?`成果文件`:`Result files`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.artifacts.slice(-8).map(e=>{let t=String(e.path||``),n=te.get(t);return(0,J.jsx)(`button`,{type:`button`,disabled:!t||!i||n?.exists===!1,onClick:()=>t&&i?.(t),title:n?.storage_path||t,className:`rounded-md border border-line px-3 py-2 text-sm text-ink-dim hover:border-ink-faint hover:text-ink disabled:opacity-50`,children:String(e.title||t.split(`/`).at(-1)||f(`research.artifact`))},String(e.id||t))})})]}):null,n?.continuous?.done_at&&(0,J.jsxs)(`div`,{className:`mx-5 mb-6 flex items-center gap-3 border-t border-line/60 py-3 sm:mx-8`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-ink-dim`,children:f(`mission.continuousDone`)}),(0,J.jsx)(`button`,{type:`button`,disabled:ee,onClick:()=>void Ae(),className:`compact-control shrink-0 px-3`,children:ee?`…`:f(`mission.resumeContinuous`)})]}),(0,J.jsxs)(`details`,{className:`mission-detail-records mx-5 mb-8 border-t border-line sm:mx-8`,open:C,onToggle:e=>w(e.currentTarget.open),children:[(0,J.jsxs)(`summary`,{className:`cursor-pointer py-4 text-sm text-ink-dim`,children:[d===`zh-CN`?`执行过程与记录`:`Execution details and records`,e.dag.length?` · ${e.dag.length}`:``]}),(0,J.jsx)(km,{view:e}),h?(0,J.jsxs)(`section`,{className:`border-b border-line/60 px-5 py-4`,"aria-label":f(`mission.team`),children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.team`)}),(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2 xl:grid-cols-4`,children:et.map(t=>{let n=m.get(t),r=n?.status===`active`,i=n?.status===`rejected`||n?.status===`error`,a=B.role[t]??B.inkFaint,o=n?.label?Hc(n.label,d,{kind:n.kind,language:e.language}):``;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>A(t),"aria-pressed":k===t,className:`min-w-0 rounded-r-md border-l-2 py-2 pl-3 text-left transition-colors hover:bg-bg/60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue`,style:{borderColor:k===t||r||n?.status===`done`?a:`rgb(var(--line))`,backgroundColor:k===t?`color-mix(in srgb, ${a} 8%, transparent)`:void 0},children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{"data-role-dot":t,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:a}}),(0,J.jsx)(`span`,{className:`text-xs font-semibold`,style:{color:a},children:zn(t,f)})]}),(0,J.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm leading-5 ${i?`text-err`:`text-ink-dim`}`,title:o||void 0,children:o||f(`mission.waitingShort`)})]},t)})})]}):null,h?(0,J.jsxs)(`details`,{className:`border-b border-line/60 px-5 py-4`,open:!!n?.daemon.alive,children:[(0,J.jsxs)(`summary`,{className:`flex cursor-pointer flex-wrap items-center justify-between gap-2 list-none`,children:[(0,J.jsxs)(`div`,{className:`text-xs font-medium text-ink-faint`,children:[f(`mission.roleWork`),` · `,(0,J.jsx)(`span`,{style:{color:B.role[k]??B.inkDim},children:zn(k,f)})]}),Me?(0,J.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`text-xs text-ink-faint hover:text-ink`,children:f(`mission.filteredBy`,{task:Me.title||Me.objective||f(`task.untitled`)})}):(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:f(`mission.allVisible`)})]}),(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(vm,{sid:t,view:p,roles:n?.roles,events:n?.recent_events,taskId:j||void 0,selectedRole:k,showTabs:!1,paused:n?!n.daemon.alive:!1})})]}):null,(0,J.jsxs)(`div`,{className:`grid min-h-[320px] border-b border-line/60 lg:grid-cols-[minmax(0,1.15fr)_minmax(260px,0.85fr)]`,children:[(0,J.jsxs)(`section`,{className:`min-w-0 border-b border-line/60 px-5 py-4 lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.researchDag`)}),g?(0,J.jsxs)(`span`,{className:`max-w-48 truncate text-xs text-blue-sky`,children:[f(`mission.active`),` · `,g.title]}):null]}),(0,J.jsxs)(`div`,{className:`mt-3 space-y-0`,children:[_.hidden.length?(0,J.jsx)(`div`,{className:`mb-3 rounded border border-line/60 bg-bg/50 px-3 py-2 text-xs text-ink-faint`,children:f(`mission.hiddenTasks`,{count:_.hidden.length,failed:_.hidden.filter(e=>[`failed`,`blocked`].includes(e.status)).length,skipped:_.hidden.filter(e=>e.status===`skipped`).length})}):null,v.length?v.map((e,t)=>{let n=e.id===g?.id,r=[`done`,`completed`].includes(e.status),i=[`failed`,`blocked`].includes(e.status);return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>M(e.id),className:`relative flex w-full min-w-0 gap-3 pb-3 text-left last:pb-0 ${j===e.id?`bg-white/[0.03]`:``}`,children:[t(0,J.jsx)(`li`,{children:e},e))})]}):null]}):null]}),(0,J.jsxs)(`section`,{className:`min-w-0 px-5 py-4`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.capabilities`)}),ne.length?(0,J.jsxs)(`div`,{className:`mt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-ok`,children:f(`mission.capabilitiesUnlocked`)}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:ne.slice(-8).map(e=>(0,J.jsxs)(`details`,{className:`rounded border border-ok/35 bg-ok/5 px-2 py-1.5`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-xs text-ok`,children:String(e.name||f(`mission.learnedCapability`))}),e.mission_title?(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-faint`,children:f(`mission.learnedDuring`,{mission:e.mission_title})}):null,e.content?(0,J.jsxs)(`pre`,{className:`mt-2 max-h-64 overflow-auto whitespace-pre-wrap border-t border-ok/20 pt-2 font-mono text-xs leading-5 text-ink-dim scroll-thin`,children:[e.content,e.content_truncated?`\n… ${f(`mission.contentTruncated`)}`:``]}):(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-faint`,children:f(`mission.skillUnavailable`)})]},String(e.id)))})]}):null,re.length?(0,J.jsxs)(`div`,{className:`mt-4 border-t border-line/50 pt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-blue-sky`,children:f(`mission.knowledgeRetained`)}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:re.slice(-6).map(e=>(0,J.jsx)(`span`,{className:`rounded border border-blue/35 bg-blue/5 px-2 py-1 text-xs text-blue-sky`,children:String(e.title||e.id)},String(e.id)))})]}):null,ie?(0,J.jsxs)(`div`,{className:`mt-4 border-t border-line/50 pt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-ink-faint`,children:f(`mission.selfEvolution`)}),(0,J.jsx)(`div`,{className:`mt-2 text-sm text-ink-dim`,children:f(`mission.knowledgeSaved`)})]}):null,I?null:(0,J.jsx)(`div`,{className:`py-10 text-center text-xs text-ink-faint`,children:f(`mission.noCapabilities`)})]})]}),(0,J.jsxs)(`section`,{className:`px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.replay`)}),e.timeline.length>1?(0,J.jsx)(`input`,{type:`range`,min:0,max:e.timeline.length-1,value:D,onChange:e=>O(Number(e.target.value)),"aria-label":f(`mission.replayTimeline`),className:`h-1 min-w-32 flex-1 accent-blue`}):null,je.length?(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:f(je.length===1?`mission.showingLatestEvent`:`mission.showingLastEvents`,{count:je.length})}):null]}),(0,J.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[je.map(t=>{let n=new Date(t.ts*1e3),r=B.role[t.role]??B.inkFaint,i=wm(t)&&!t.kind?f(`mission.roleFailed`,{role:Cm(t.role,f)}):Hc(t.title,d,{kind:t.kind,language:e.language}),a=Xc(t.detail.trim()===e.mission.summary.trim()?``:t.detail,d,{cause:t.cause,technical:t.technical,language:e.language});return(0,J.jsxs)(`article`,{className:`rounded border border-line/60 bg-bg/35 px-3 py-2.5 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1.5 h-2 w-2 shrink-0 rounded-full ${t.tone===`error`?`bg-err`:t.tone===`success`||t.tone===`metric`||t.tone===`skill`?`bg-ok`:`bg-blue`}`}),(0,J.jsx)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 text-xs font-medium`,style:{borderColor:r,color:r},children:Cm(t.role,f)}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 break-words font-medium leading-5 text-ink`,children:i}),(0,J.jsx)(`time`,{dateTime:n.toISOString(),title:n.toLocaleString(d,{dateStyle:`medium`,timeStyle:`short`}),className:`shrink-0 font-mono text-xs text-ink-faint`,children:Tm(t.ts,d)})]}),a.text?(0,J.jsx)(Em,{detail:a.text,technical:a.technical,previewLength:Sm,textClassName:`leading-5 text-ink-dim`}):null]},t.id)}),e.timeline.length?null:(0,J.jsx)(`div`,{className:`py-10 text-center text-xs text-ink-faint`,children:f(`mission.waitingEvents`)})]}),o?.available&&(o.status||o.diff)?(0,J.jsxs)(`div`,{className:`mt-5 border-t border-line/50 pt-4 text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-[0.14em]`,children:f(`mission.projectFilesChanged`)}),(0,J.jsxs)(`span`,{children:[` · `,f(`mission.reviewInIde`)]})]}):null]})]})]})})}function jm(e){let t=Math.ceil(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}var Mm={available:`bg-ok/10 text-ok`,absent:`bg-bg text-ink-faint`,inaccessible:`bg-warn/10 text-warn`,degraded:`bg-warn/10 text-warn`};function Nm({status:e,error:t}){let{t:n}=z();return(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:n(`resource.title`)}),e?(0,J.jsx)(`span`,{className:`rounded px-2 py-1 text-[10px] font-semibold uppercase ${e.enforcement===`strict`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:Un(e.enforcement,n)}):null]}),t?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-err`,children:t}):null,!e&&!t?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:n(`resource.loading`)}):null,e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.accelerators.map(e=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:Hn(e.kind,n)}),(0,J.jsxs)(`span`,{className:`rounded px-2 py-0.5 text-[10px] font-medium ${Mm[e.status]}`,children:[Rn(e.status,n),` · `,n(`resource.devices`,{count:e.device_count})]})]}),e.detail?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:e.detail}):null]},e.kind))}),(0,J.jsxs)(`div`,{className:`mt-4 grid gap-4 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.inUse`,{count:e.holders.length})}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.holders.length===0?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.holders.map((e,t)=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.devices`,{count:e.device_count})}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:jm(e.ttl_seconds)})})]}),(0,J.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)}),e.yield_requests.map((e,t)=>(0,J.jsxs)(`div`,{className:`mt-2 border-l-2 border-warn/50 pl-2 text-ink-faint`,children:[(0,J.jsx)(`div`,{children:n(`resource.yieldRequest`,{reason:e.reason})}),e.response?(0,J.jsxs)(`div`,{children:[Wn(e.response.decision,n),` · `,e.response.reason]}):null]},t))]},`${e.project}:${e.task_id}:${t}`))})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.queue`,{count:e.queue.length})}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.queue.length===0?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.queue.map(e=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.queuePosition`,{position:e.position})}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:jm(e.ttl_seconds)})})]}),(0,J.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)})]},e.position))})]})]})]}):null]})}async function Pm(e){let t=await e,n=t&&typeof t==`object`?t:{},r=String(n.command_status??``);if(Number(n.rc??0)!==0||r===`failed`||r===`rejected`)throw Error(String(n.error||`daemon command ${r||`failed`}`));return t}function Fm({open:e,sid:t,snap:r,onClose:i,onChanged:l,onRestored:d,onOpenSkills:f}){let{t:p,locale:h}=z(),[v,b]=(0,G.useState)(`task`),[S,C]=(0,G.useState)(``),[w,E]=(0,G.useState)(r.session.workdir??r.session.cwd??``),[D,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(null),[M,ee]=(0,G.useState)(()=>new Set),[N,P]=(0,G.useState)(null),[F,te]=(0,G.useState)(null),[ne,re]=(0,G.useState)(null),[ie,I]=(0,G.useState)(``),[L,ae]=(0,G.useState)([]),[oe,se]=(0,G.useState)(0),[ce,le]=(0,G.useState)(``),[ue,de]=(0,G.useState)(``),[fe,pe]=(0,G.useState)(`work`),me=e=>ee(t=>t.has(e)?t:new Set([...t,e])),he=e=>j(Md(e,p)),ge=!M.has(`sourceUpdate`);(0,G.useEffect)(()=>{e&&(E(r.session.workdir??r.session.cwd??``),R.metrics().then(P,e=>{jd(e)?me(`metrics`):he(e)}),R.trash().then(e=>{ae(e.entries),se(e.total)},e=>{jd(e)?me(`trash`):he(e)}))},[e,r.session.cwd,r.session.workdir]),(0,G.useEffect)(()=>{if(!e||!ge)return;let t=!1,n=e=>{t||(jd(e)?me(`sourceUpdate`):he(e))},r=async()=>{try{let e=await R.sourceUpdateStatus();t||te(e)}catch(e){n(e)}};R.sourceUpdateStatus().then(async e=>{if(!t&&(te(e),!e.running)){let e=await R.checkSourceUpdate();t||te(e)}}).catch(n);let i=window.setInterval(()=>void r(),1500);return()=>{t=!0,window.clearInterval(i)}},[e,ge]),(0,G.useEffect)(()=>{!e||fe!==`system`||(re(null),I(``),R.resources().then(re,e=>{jd(e)?me(`resources`):I(p(`operations.requestFailed`))}))},[e,fe]);let _e=async(e,t,n)=>{if(!ue){de(e),k(null),j(null);try{let e=await t();n!==null&&k(n?{text:n}:{text:p(`operations.done`),raw:JSON.stringify(e,null,2)}),l()}catch(e){he(e)}finally{de(``)}}},ve=async()=>{let e=S.trim();if(e){if(v===`plan`){await _e(`quick`,async()=>{let n=await R.previewPlan(t,e);return k({text:[...n.steps.map((e,t)=>`${t+1}. ${e.title}${e.detail?` — ${e.detail}`:``}`),...n.notes.map(e=>`Note: ${e}`),...n.error?[`Error: ${n.error}`]:[]].join(` +`)}),n},null);return}await _e(`quick`,v===`task`?()=>R.addTask(t,e):v===`nudge`?()=>R.nudge(t,e):()=>R.note(t,e),`${v} submitted.`),C(``)}},ye=async e=>{await _e(`restore:${e.trash_id}`,async()=>{let t=await R.restoreTrash(e.trash_id);return ae(t=>t.filter(t=>t.trash_id!==e.trash_id)),se(e=>Math.max(0,e-1)),await d(t.sid),t},`Restored ${e.label}.`)},be=r.daemon.alive&&r.daemon.protocol_compatible===!1,xe=r.daemon.alive&&r.daemon.control_available===!1,Se=r.daemon_admission?.running_daemons??[],Ce=v===`task`?m:v===`nudge`?O:v===`note`?T:g,we=p(`operations.action.${v}`),Te=async()=>{await _e(`trash-search`,async()=>{let e=await R.trash(ce);return ae(e.entries),se(e.total),e},null)};return(0,J.jsxs)(dt,{open:e,onClose:()=>!ue&&i(),label:p(`operations.title`),width:`max-w-5xl`,children:[(0,J.jsx)(lt,{title:p(`operations.title`),sub:r.session.display_name||t}),(0,J.jsx)(`div`,{className:`flex gap-1 overflow-x-auto border-b border-line bg-panel px-4 py-2 scroll-thin`,children:[[`work`,p(`operations.work`),m],[`runtime`,p(`operations.runtime`),_],[`system`,p(`operations.system`),c],[`recovery`,p(`operations.recovery`),n]].map(([e,t,n])=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{pe(e),k(null),j(null)},"aria-current":fe===e?`page`:void 0,className:`flex h-8 shrink-0 items-center justify-center gap-2 rounded-md px-3 text-xs font-medium ${fe===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:[(0,J.jsx)(o,{icon:n}),(0,J.jsx)(`span`,{children:t})]},e))}),(0,J.jsxs)(`div`,{className:`grid max-h-[76vh] gap-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid-cols-2`,children:[fe===`work`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.workInput`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:p(`operations.workHint`)}),(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-1 sm:grid-cols-4`,children:[[`task`,m],[`nudge`,O],[`note`,T],[`plan`,g]].map(([e,t])=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>b(e),"aria-pressed":v===e,className:`flex h-9 items-center justify-center gap-2 rounded px-2 text-xs font-medium ${v===e?`bg-blue/10 text-blue`:`bg-bg text-ink-dim hover:text-ink`}`,children:[(0,J.jsx)(o,{icon:t}),(0,J.jsx)(`span`,{children:p(`operations.action.${e}`)})]},e))}),(0,J.jsx)(`textarea`,{value:S,onChange:e=>C(e.target.value),rows:5,placeholder:v===`plan`?p(`operations.planPlaceholder`):p(`operations.actionPlaceholder`,{action:v}),className:`mt-3 w-full resize-y rounded border border-line bg-bg p-3 text-sm text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void ve(),disabled:!!ue||!S.trim(),className:`mt-2 flex h-9 items-center justify-center gap-2 rounded border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:ue===`quick`?`…`:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(o,{icon:Ce}),(0,J.jsx)(`span`,{children:v===`plan`?p(`operations.previewPlan`):p(`operations.submitAction`,{action:we})})]})})]}):null,fe===`runtime`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.runtime`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:p(`operations.runtimeHint`)}),(0,J.jsx)(`label`,{className:`mt-3 block text-[10px] uppercase tracking-wide text-ink-faint`,children:p(`operations.workdir`)}),(0,J.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[(0,J.jsx)(`input`,{value:w,onChange:e=>E(e.target.value),className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`cwd`,()=>R.setWorkdir(t,w),p(`operations.workdirUpdated`)),disabled:!!ue||!w.trim(),title:p(`operations.applyWorkdir`),"aria-label":p(`operations.applyWorkdir`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:y})})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`reset`,()=>R.resetManager(t),`Manager context reset.`),disabled:!!ue,title:p(`operations.resetManager`),"aria-label":p(`operations.resetManager`),className:`flex h-9 w-9 items-center justify-center rounded border border-line text-xs text-ink-dim disabled:opacity-40`,children:(0,J.jsx)(o,{icon:a})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`upgrade`,()=>Pm(R.upgradeDaemon(t,r.daemon_commands?.revision)),`Current-release daemon started after safely draining active work.`),disabled:!!ue||xe,title:xe?`Externally supervised daemon cannot be restarted from this Web host`:be?`Upgrade incompatible daemon`:`Restart on current release`,"aria-label":xe?`Externally supervised daemon`:be?`Upgrade incompatible daemon`:`Restart on current release`,className:`flex h-9 w-9 items-center justify-center rounded border text-xs disabled:opacity-40 ${be?`border-err/60 bg-err/10 text-err`:`border-line text-ink-dim`}`,children:(0,J.jsx)(o,{icon:x})})]}),ge?(0,J.jsxs)(`div`,{className:`mt-4 rounded-lg border border-line bg-bg p-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:p(`operations.sourceUpdate`)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold ${F?.state===`failed`?`bg-err/10 text-err`:F?.update_available?`bg-warn/10 text-warn`:F?.update_available===!1?`bg-ok/10 text-ok`:`bg-line text-ink-dim`}`,children:F?.running?p(`operations.updateRunning`):F?.update_available?p(`operations.updateAvailable`):F?.update_available===!1?p(`operations.updateCurrent`):p(`operations.updateChecking`)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:F?.error||F?.message||p(`operations.updateChecking`)}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px] text-ink-dim`,children:[(0,J.jsxs)(`span`,{children:[p(`operations.currentRevision`),`: `,F?.current_revision?.slice(0,12)||`—`]}),(0,J.jsxs)(`span`,{children:[p(`operations.latestRevision`),`: `,F?.upstream_revision?.slice(0,12)||`—`]}),F?.phase&&F.phase!==`complete`&&F.phase!==`idle`?(0,J.jsxs)(`span`,{children:[p(`operations.updatePhase`),`: `,F.phase]}):null]}),F?.running?(0,J.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded bg-line`,children:(0,J.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`})}):null]}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>void _e(`source-update`,async()=>{let e=await R.applySourceUpdate();return te(e),e},null),disabled:!!ue||!!F?.running||F?.can_update===!1,title:F?.can_update===!1?F.error||p(`operations.updateUnavailable`):p(`operations.pullLatest`),"aria-label":p(`operations.pullLatest`),className:`flex h-9 items-center gap-2 rounded border border-blue/50 px-3 text-xs font-medium text-blue disabled:opacity-40`,children:[(0,J.jsx)(o,{icon:u}),(0,J.jsx)(`span`,{children:F?.running?p(`operations.updateRunning`):p(`operations.pullLatest`)})]})]}),F?.restart_required?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-warn`,children:p(`operations.updateRestart`)}):null]}):null,r.daemon.protocol_error?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-err`,children:r.daemon.protocol_error}):null,Se.length?(0,J.jsxs)(`div`,{className:`mt-4`,children:[(0,J.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-ink-faint`,children:p(`operations.replaceSlot`)}),(0,J.jsx)(`div`,{className:`mt-2 space-y-1`,children:Se.map(e=>(0,J.jsxs)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void _e(`replace:${e.id}`,()=>Pm(R.replaceDaemon(t,e.id,!!r.continuous?.enabled,r.daemon_commands?.revision)),`Parked ${e.label||e.id} and started this session.`),title:`Replace ${e.label||e.id}`,"aria-label":`Replace ${e.label||e.id}`,className:`flex w-full items-center justify-between rounded border border-line bg-bg px-2 py-1.5 text-left text-xs text-ink-dim disabled:opacity-40`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:e.label||e.id}),(0,J.jsx)(o,{icon:x,className:`ml-2 text-warn`})]},e.id))})]}):null]}):null,fe===`system`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.skills`)}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:h===`zh-CN`?`全局技能对所有任务可用。在技能库中查看各分类与最近更新。`:`Global skills are available to every task. Browse all classes and recent updates in the skill library.`}),(0,J.jsx)(`button`,{type:`button`,onClick:f,className:`mt-3 rounded border border-line px-3 py-2 text-sm text-blue hover:bg-bg`,children:h===`zh-CN`?`打开技能库`:`Open skill library`})]}):null,fe===`system`&&!M.has(`metrics`)?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.metrics`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,J.jsx)(`span`,{className:`rounded px-2 py-1 text-xs font-semibold ${N?.slo?.status===`healthy`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:p(N?N.slo?.status===`healthy`?`operations.slo.healthy`:`operations.slo.degraded`:`operations.slo.loading`)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p(`operations.validationFailures`,{count:N?.event_validation_failures??`—`})})]}),N?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-dim`,children:wd(N).map((e,t)=>(0,J.jsxs)(`span`,{children:[t>0?(0,J.jsx)(`span`,{className:`text-ink-faint`,children:` · `}):null,(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[p(`operations.metric.${e.key}`),` `]}),(0,J.jsx)(`span`,{className:`font-mono tabular-nums text-ink`,children:e.value})]},e.key))}):null,N?(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap rounded bg-bg p-3 font-mono text-[10px] text-ink-dim scroll-thin`,children:JSON.stringify({web:N.web,provider:N.provider},null,2)})}):null]}):null,fe===`system`&&!M.has(`resources`)?(0,J.jsx)(Nm,{status:ne,error:ie}):null,fe===`recovery`&&M.has(`trash`)?(0,J.jsx)(`p`,{className:`text-sm text-ink-faint lg:col-span-2`,children:p(`operations.unavailableHere`)}):null,fe===`recovery`&&!M.has(`trash`)?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`h3`,{className:`mr-auto text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:[p(`operations.trash`),` · `,oe]}),(0,J.jsx)(`input`,{value:ce,onChange:e=>le(e.target.value),onKeyDown:e=>{!vu(e)&&e.key===`Enter`&&Te()},placeholder:p(`operations.searchTrash`),className:`h-8 min-w-52 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void Te(),title:p(`operations.searchTrash`),"aria-label":p(`operations.searchTrash`),className:`flex h-8 w-8 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:s})})]}),L.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:L.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded border border-line bg-bg p-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-xs text-ink`,children:e.label}),(0,J.jsx)(`div`,{className:`truncate font-mono text-[10px] text-ink-faint`,children:e.trash_path})]}),(0,J.jsx)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void ye(e),title:`Restore ${e.label}`,"aria-label":`Restore ${e.label}`,className:`flex h-8 w-8 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:n})})]},e.trash_id))}):(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`operations.trashEmpty`)}),oe>L.length?(0,J.jsxs)(`p`,{className:`mt-2 text-[10px] text-ink-faint`,children:[`Showing the newest `,L.length,` matches. Narrow the search to find older sessions.`]}):null]}):null,A?(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-panel p-3 text-sm text-ink-dim lg:col-span-2`,children:[(0,J.jsx)(`p`,{children:A.text}),A.technical?(0,J.jsx)(ft,{label:p(`operations.technicalDetails`),children:(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap font-mono`,children:A.technical})}):null]}):null,D?(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-panel p-3 text-sm text-ink-dim lg:col-span-2`,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:D.text}),D.raw?(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs`,children:D.raw})}):null]}):null]})]})}var Im=[`handshake.service`,`handshake.project`,`handshake.ready`];function Lm(){let{t:e}=z(),t=(0,G.useRef)(null);return it(t,(e,t)=>{if(t){e.set(`[data-handshake-line], [data-handshake-node]`,{opacity:1,scale:1,clearProps:`transform`});return}e.to(`[data-handshake-mark]`,{scale:1.055,duration:.75,ease:`sine.inOut`,repeat:-1,yoyo:!0,transformOrigin:`50% 50%`}),e.timeline({repeat:-1,repeatDelay:.25}).fromTo(`[data-handshake-line]`,{scaleX:0,opacity:.25,transformOrigin:`0% 50%`},{scaleX:1,opacity:.8,duration:.9,ease:`power2.inOut`}).fromTo(`[data-handshake-node]`,{autoAlpha:.25,scale:.72},{autoAlpha:1,scale:1,duration:.28,stagger:.16,ease:`back.out(1.8)`},.12).to(`[data-handshake-node]`,{autoAlpha:.35,duration:.3,stagger:.08},`+=0.35`)}),(0,J.jsxs)(`div`,{ref:t,role:`status`,"aria-label":e(`handshake.connecting`),className:`w-full max-w-xl px-6 text-center`,children:[(0,J.jsx)(`div`,{"data-handshake-mark":!0,className:`handshake-mark glass-card mx-auto flex h-16 w-16 items-center justify-center rounded-3xl text-blue shadow-glow sm:h-20 sm:w-20`,children:(0,J.jsx)(At,{size:48,className:`text-ink`})}),(0,J.jsxs)(`div`,{className:`relative mx-auto mt-8 h-10 max-w-sm sm:max-w-md`,children:[(0,J.jsx)(`div`,{className:`absolute left-[10%] right-[10%] top-3 h-px bg-line/80`}),(0,J.jsx)(`div`,{"data-handshake-line":!0,className:`handshake-line absolute left-[10%] right-[10%] top-3 h-px`}),(0,J.jsx)(`div`,{className:`relative flex justify-between`,children:Im.map(t=>(0,J.jsxs)(`div`,{className:`flex w-20 flex-col items-center gap-2.5`,children:[(0,J.jsx)(`span`,{"data-handshake-node":!0,className:`handshake-node h-6 w-6 rounded-full border ring-4 ring-bg`,children:(0,J.jsx)(`span`,{className:`m-auto mt-[7px] block h-2 w-2 rounded-full bg-blue`})}),(0,J.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:e(t)})]},t))})]}),(0,J.jsx)(`p`,{className:`mt-9 text-base font-medium text-ink-dim`,children:e(`handshake.title`)}),(0,J.jsx)(`p`,{className:`mt-1.5 text-sm text-ink-faint`,children:e(`handshake.detail`)})]})}function Rm({loading:e,hasProjects:t,error:n,onRetry:r,onNew:i,onChoose:a,canCreate:o}){let{t:s,locale:c}=z();return(0,J.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-4 px-6 text-center`,children:[e?(0,J.jsx)(Lm,{}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h1`,{className:`text-2xl font-semibold text-ink`,children:c===`zh-CN`?t?`继续你的项目`:`开始一个项目`:t?`Continue your work`:`Start a project`}),(0,J.jsx)(`p`,{className:`max-w-md text-sm leading-relaxed ${n?`text-err`:`text-ink-faint`}`,children:n||s(t?`landing.selectOrCreate`:`landing.noSessions`)})]}),!e&&(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[n?(0,J.jsx)(W,{onClick:r,variant:`danger`,children:s(`common.retry`)}):null,t?(0,J.jsx)(W,{onClick:a,children:s(`landing.select`)}):o?(0,J.jsx)(W,{onClick:i,variant:`primary`,children:s(`landing.new`)}):null,!t&&!n?(0,J.jsx)(`span`,{className:`lg:hidden`,children:(0,J.jsx)(W,{onClick:a,children:s(`landing.menu`)})}):null]})]})}function zm({active:e,onSelect:t,onOpenSessions:n,sidebarOpen:r=!1,onRead:i,onOpenSkills:a}){let{t:s,locale:c}=z(),l=[{id:`map`,label:s(`mobile.map`),icon:g},{id:`activity`,label:s(`mobile.activity`),icon:p},{id:`preview`,label:s(`mobile.preview`),icon:E}];return(0,J.jsxs)(`nav`,{"aria-label":s(`mobile.views`),className:`mobile-tabbar glass-panel glass-panel--raised fixed inset-x-0 bottom-0 z-40 items-stretch border-t border-line/60 lg:hidden ${r?`hidden`:`flex`}`,children:[n?(0,J.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":s(`topbar.openSessions`),className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 text-ink-faint active:bg-panel-raised`,children:[(0,J.jsx)(o,{icon:h,className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`text-[10px] leading-none`,children:s(`mobile.sessions`)})]}):null,l.map(n=>{let r=n.id===e;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-current":r?`page`:void 0,className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 active:bg-panel-raised ${r?`text-blue`:`text-ink-faint`}`,children:[(0,J.jsx)(o,{icon:n.icon,className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`text-[10px] leading-none`,children:n.label})]},n.id)}),(0,J.jsxs)(`details`,{className:`workspace-more mobile-more flex-1`,onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,J.jsxs)(`summary`,{className:`min-h-[3.25rem]`,"aria-current":e===`mission`||e===`workbench`?`page`:void 0,children:[(0,J.jsx)(o,{icon:w,className:`h-4 w-4`}),(0,J.jsx)(`span`,{children:c===`zh-CN`?`更多`:`More`})]}),(0,J.jsxs)(`div`,{className:`workspace-more-menu`,onClick:e=>{e.target.closest(`button`)&&e.currentTarget.closest(`details`)?.removeAttribute(`open`)},children:[a&&(0,J.jsx)(`button`,{type:`button`,onClick:a,children:c===`zh-CN`?`技能库`:`Skill library`}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(`mission`),children:[(0,J.jsx)(o,{icon:p}),s(`mobile.mission`)]}),i?(0,J.jsx)(`button`,{type:`button`,onClick:i,children:c===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}):null,(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(`workbench`),children:[(0,J.jsx)(o,{icon:d}),s(`mobile.workbench`)]})]})]})]})}function Bm(e,t,n){let r=n?.height??t,i=t-r-(n?.offsetTop??0);return{keyboardInset:i>24?Math.round(i):0,compact:e<1024&&r<=600}}function Vm(){let[e,t]=(0,G.useState)(()=>typeof window<`u`&&Bm(window.innerWidth,window.innerHeight,window.visualViewport).compact);return(0,G.useEffect)(()=>{let e=window.visualViewport,n=document.documentElement,r=null,i=()=>{r!=null&&window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let r=Bm(window.innerWidth,window.innerHeight,e);n.style.setProperty(`--keyboard-inset`,`${r.keyboardInset}px`),n.dataset.compactViewport=String(r.compact),t(r.compact)})};return i(),e?.addEventListener(`resize`,i),e?.addEventListener(`scroll`,i),window.addEventListener(`resize`,i),()=>{r!=null&&window.cancelAnimationFrame(r),e?.removeEventListener(`resize`,i),e?.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),n.style.removeProperty(`--keyboard-inset`),delete n.dataset.compactViewport}},[]),e}var Hm={[I.LIFE_LIFECYCLE_BLOCK]:`block`,[I.ROUND_REVIEWER_BACKEND_FAILURE]:`block`,[I.LIFE_BUDGET_PAUSE]:`warn`,[I.ROUND_STALL]:`warn`,[I.ROUND_ESCALATED]:`warn`,[I.LIFE_PLANNER_STALL_ESCALATION]:`warn`},Um=new Set([I.BUDGET_RESERVATION_DENIED,I.BUDGET_UNPRICED_BLOCKED]),Wm=new Set([I.LIFE_MISSION_STARTED,I.ROUND_MAIN_COMPLETED,I.LIFE_MISSION_COMPLETED,I.LOOP_DONE,I.ROUND_START,`ui.operator`]),Gm=new Set([I.BUDGET_RESERVATION_CREATED,I.PROVIDER_REQUEST_STARTED]);function Km(e){let t=ie(e.canonical_type??e.type);if(e.event_validation?.status===`invalid`)return t===I.ROLE_SESSION_TURN?null:{tone:`warn`,kind:`validation`,text:`invalid event ${t||`unknown`}: ${e.event_validation.errors.join(`; `)}`};if(Um.has(t))return{tone:`block`,kind:`budget`,text:`Budget exhausted or blocked — ${String(e.reason??e.text??t).trim()}`};let n=e.operator_alert===!0?`block`:Hm[t];return n?{tone:n,text:String(e.text??e.reason??t).trim()}:null}function qm(e){let t=null;for(let n of e){let e=ie(n.canonical_type??n.type),r=Km(n);r?t=r:(t?.kind===`validation`||t?.kind===`budget`&&Gm.has(e)||t&&t.kind!==`budget`&&Wm.has(e))&&(t=null)}return t}async function Jm(e,t){let n=ju(e.trim());if(!n)return{kind:`not-command`};if(!n.cmd){let e=Mu(n.name);return{kind:`error`,message:e?`Unknown command ${n.name}. Did you mean ${e}?`:`Unknown command ${n.name}. Use /help for the full list.`}}if(n.cmd.id===`ask`||n.cmd.id===`crystalpilot`)return{kind:`not-command`};if(Cu(n.cmd)&&!n.rest)return{kind:`error`,message:`Usage: ${n.cmd.name}${n.cmd.arg?` ${n.cmd.arg}`:``}`};try{await t[n.cmd.id](n.rest)}catch(e){return{kind:`error`,message:e instanceof Error?e.message:String(e??`Command failed`)}}return{kind:`handled`}}function Ym({activeSid:e,activityEventsRef:t,notify:n,onClearEvents:r,onDispose:i,onOpenConfig:a,onOpenDoctor:o,onOpenHelp:s,onOpenIdentity:c,onOpenInspector:l,onOpenNewDaemon:u,onOpenOperations:d,onOpenSidebar:f,onOpenSkills:p,onReconnectEvents:m,onRenameProject:h,onRewriteDraft:g,onSelectProject:_,onSetArtifactPath:v,onSetEventFilter:y,onSetEventQuery:b,onSetTaskItemId:x,onSetWorkspaceView:S,onShowArtifacts:C,onStopIteration:w,onStopWaiting:T,refetchSnapshot:E}){return{status:async()=>l(),roles:async()=>d(),journal:async()=>l(),backlog:async()=>S(`mission`),item:async e=>{e&&x(e)},artifacts:async()=>C(),artifact:async e=>{e&&v(e)},events:async e=>{S(`activity`);let{filter:t,query:n}=Au(e);y(t),b(n)},find:async e=>{S(`activity`),y(`all`),b(e)},run:async()=>S(`activity`),clear:async()=>{S(`activity`),y(`all`),b(``),r(t.current.length)},cancel:async()=>T(),task:async t=>{e&&(await R.addTask(e,t),E(),n(`success`,`Task queued.`))},rewrite:async e=>{let t=e.trim();if(!t){n(`info`,`Type your prompt in the composer and press Rewrite, or use /rewrite .`);return}g(t)},plan:async t=>{if(!e)return;let r=await R.previewPlan(e,t);r.error?n(`error`,r.error):n(`info`,r.steps.map(e=>e.title).join(` +`)||`Plan preview ready.`)},nudge:async t=>{e&&(await R.nudge(e,t),n(`success`,`Guidance injected.`))},abort:async t=>{e&&(await R.abortMission(e,t||`operator abort`),n(`info`,`Abort requested.`))},note:async t=>{e&&(await R.note(e,t),n(`success`,`Note appended to timeline.`))},done:async e=>{e&&i(e,`done`)},skip:async e=>{e&&i(e,`rm`)},stop:async e=>{e&&w(e)},new:async()=>u(),daemons:async()=>f(),resume:async e=>{e&&e!==`list`?_(e):f()},attach:async e=>{e&&_(e)},rename:async t=>{!e||!t||await h(t)},doctor:async()=>o(),backend:async t=>{if(!e||!t){a();return}await R.setConfig(e,`runner_backend`,t),n(`success`,`Backend set to ${t}.`)},config:async t=>{if(!e||!t){a();return}let r=t.indexOf(`=`);r>0?(await R.setConfig(e,t.slice(0,r).trim(),t.slice(r+1).trim()),n(`success`,`Config updated.`)):a()},identity:async()=>c(),reset:async()=>{e&&(await R.resetManager(e),n(`success`,`Manager context reset.`))},skills:async t=>{if([``,`ls`,`list`].includes(t.trim().toLowerCase())){p();return}e&&n(`info`,(await R.skills(e,t||`ls`)).slice(0,400))},reconnect:async()=>m(),help:async()=>s(),quit:async()=>n(`info`,`Background work continues; close this browser tab when ready.`)}}function Xm(e){return e.kind===`error`?(typeof e.reply==`string`?e.reply.trim():``)||`Manager could not handle this message.`:null}function Zm(e,t){e.kind===`task`&&t.dispatchTask(e);let n=Xm(e);n&&t.notifyError(n),t.refetchTranscript()}var Qm={skipFirst:0,reconnectKey:0};function $m(e,t){return t.kind===`clear`?{...e,skipFirst:Math.max(0,t.offset)}:t.kind===`reconnect`?{skipFirst:0,reconnectKey:e.reconnectKey+1}:{...e,skipFirst:0}}function eh(e,t){if(!t.length)return e;let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return t?{...e,spend_usd:t.spend_usd,known_cost_usd:t.known_cost_usd,spend_status:t.spend_status,usage_calls:t.usage_calls,premium_requests:t.premium_requests,cost_updated_at:t.updated_at}:e})}async function th(e,t,n,r=``){let i=await e.createDaemon(``,t,r),a=n.trim();return{created:i,startCampaign:a?()=>e.setContinuous(i.sid,!0,a):null}}var nh=e=>e instanceof Error?e.message:String(e||`Unknown error`);function rh({localCwd:e,notify:t,onFocusComposer:n,queryClient:r,refetchProjects:i,selectProject:a,translate:o}){let[s,c]=(0,G.useState)(!1),l=(0,G.useRef)(!1);return{createDaemon:async(s,u,d)=>{if(l.current)return!1;l.current=!0,c(!0);try{let{created:c,startCampaign:l}=await th(R,s,u,d),f=String(c.workdir||d||``);return r.setQueryData([`projects`],t=>({local_cwd:t?.local_cwd??e,projects:[{id:c.sid,label:s||c.sid,display_name:s,objective:``,launch_cwd:f,workdir:f,last_active:Date.now()/1e3,daemon_alive:!1,daemon_pid:null,uptime_seconds:null},...(t?.projects??[]).filter(e=>e.id!==c.sid)]})),a(c.sid),i(),window.setTimeout(n,0),t(l?`info`:`success`,l?o?o(`new.createdStarting`):`Session created and selected. Campaign is starting in the background.`:o?o(`new.createdIdle`):`Session created and selected.`),l&&l().then(()=>{r.invalidateQueries({queryKey:[`snapshot`,c.sid]}),i(),t(`success`,`Campaign started.`)}).catch(e=>{t(`error`,`Session was created, but the campaign could not start: ${nh(e)}`)}),!0}catch(e){return t(`error`,`Could not create session: ${nh(e)}`),!1}finally{l.current=!1,c(!1)}},creatingDaemon:s}}var ih=e=>e instanceof Error?e.message:String(e||`Unknown error`);function ah({actions:e,manageActions:t,manageTargetSid:n,setManageTargetSid:r,activeSid:i,clearProjectSelection:a,continuous:o,notify:s,refetchProjects:c,selectProject:l,setDaemonManageOpen:u}){let d=e.startDaemon.isPending||e.stopDaemon.isPending||e.forceStopDaemon.isPending||t.startDaemon.isPending||t.forceStopDaemon.isPending||t.updateProject.isPending||t.deleteProject.isPending,f=(0,G.useCallback)(e=>({onSuccess:()=>s(`success`,e),onError:e=>s(`error`,ih(e))}),[s]),p=(0,G.useCallback)(()=>e.startDaemon.mutate(void 0,f(`Daemon start requested.`)),[f,e.startDaemon]),m=(0,G.useCallback)(()=>e.forceStopDaemon.mutate(void 0,f(`Stop requested; the verified daemon process is being interrupted.`)),[f,e.forceStopDaemon]),h=(0,G.useCallback)(async()=>{try{return await t.startDaemon.mutateAsync(),s(`success`,`Daemon resumed.`),!0}catch(e){return s(`error`,ih(e)),!1}},[t.startDaemon,s]),g=(0,G.useCallback)(async()=>{try{return await t.forceStopDaemon.mutateAsync(),await c(),s(`success`,`Daemon stopped. This session can now be deleted.`),!0}catch(e){return s(`error`,ih(e)),!1}},[t.forceStopDaemon,s,c]),_=(0,G.useCallback)(async e=>{if(!n)return!1;try{return await t.updateProject.mutateAsync({sid:n,name:e}),s(`success`,`Session name updated.`),!0}catch(e){return s(`error`,ih(e)),!1}},[t.updateProject,n,s]),v=(0,G.useCallback)(async()=>{if(!n)return!1;try{let e=n,o=await t.deleteProject.mutateAsync();u(!1),r(null);let d=await c();if(e===i){a(`replace`);let e=Yd(d.data?.projects??[])[0];e&&l(e.id,`replace`)}return s(`success`,o.workdir_preserved?`Session moved to recoverable trash. Files remain in ${o.workdir}.`:`Session moved to recoverable trash.`),!0}catch(e){return s(`error`,ih(e)),!1}},[i,a,t.deleteProject,n,s,c,l,u,r]),y=(0,G.useCallback)(e=>{r(e),u(!0)},[u,r]);return{daemonBusy:d,manageDeleteProject:v,manageStopDaemon:g,manageRenameProject:_,manageStartDaemon:h,requestDispose:(0,G.useCallback)((t,n)=>e.disposeBacklog.mutate({id:t,op:n},{onSuccess:()=>s(`success`,n===`done`?`Work marked done.`:`Work removed.`),onError:e=>s(`error`,ih(e))}),[e.disposeBacklog,s]),requestManageSession:y,requestStartDaemon:p,requestStopDaemon:m,requestStopIteration:(0,G.useCallback)(t=>e.stopBacklog.mutate(t,{onSuccess:()=>s(`success`,`Iteration stopped.`),onError:e=>s(`error`,ih(e))}),[e.stopBacklog,s]),toggleContinuous:(0,G.useCallback)(()=>{if(!o)return;let t=!o.enabled;e.setContinuous.mutate({enabled:t,objective:o.objective},f(t?`Continuous campaign enabled.`:`Continuous campaign stopped.`))},[f,e.setContinuous,o])}}function oh({focusComposer:e,openHelp:t,toggleKiosk:n,togglePalette:r,toggleReasoning:i,toggleSidebarCollapse:a}){(0,G.useEffect)(()=>{let o=o=>{let s=o.target,c=s?.tagName===`INPUT`||s?.tagName===`TEXTAREA`,l=o.metaKey||o.ctrlKey;l&&o.key.toLowerCase()===`k`?(o.preventDefault(),r()):l&&o.key.toLowerCase()===`t`?(o.preventDefault(),i()):l&&o.key===`.`?(o.preventDefault(),n()):l&&o.key.toLowerCase()===`b`?(o.preventDefault(),a()):l&&o.key.toLowerCase()===`j`?(o.preventDefault(),e()):!c&&o.key===`?`?(o.preventDefault(),t()):!c&&o.key===`/`&&(o.preventDefault(),e())};return window.addEventListener(`keydown`,o),()=>window.removeEventListener(`keydown`,o)},[e,t,n,r,i,a])}var sh=e=>e instanceof Error?e.message:String(e||`Unknown error`),ch=`argus.decision.prompted.v1`,lh=()=>{try{return window.sessionStorage.getItem(ch)??``}catch{return``}},uh=e=>{try{window.sessionStorage.setItem(ch,e)}catch{}};function dh({activeSid:e,currentTaskId:t,autoOpen:n=!0,backlog:r,notify:i,pendingQuestions:a,refetchSnapshot:o}){let[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),p=(0,G.useRef)(!1),m=(0,G.useRef)(``),h=(0,G.useMemo)(()=>{let e=(r??[]).map(e=>({...e,operator_decision:e.operator_decision}));return Xr(a??[],e,t)},[r,a,t]),g=h[0]??null,_=r!==void 0||a!==void 0,v=s!==null&&s.sid===e,y=v?{...s.card,is_current_task:t&&s.card.kind!==`domain_intake`?s.card.item_id===t:void 0}:g;return(0,G.useEffect)(()=>{if(s&&(s.sid!==e||_&&!l&&!h.some(e=>e.id===s.card.id))&&c(null),!e||!g||!n&&g.kind!==`domain_intake`||v||l)return;let t=`${e}:${g.id}`;m.current!==t&&lh()!==t&&(m.current=t,uh(t),f(``),c({sid:e,card:g}))},[e,n,h,_,g,s,v,l]),{answerPendingReply:async(t,n)=>{if(!(!e||!y||p.current)){p.current=!0,u(!0),f(``);try{let r=y.kind===`domain_intake`?await R.answerDomain(e,y.id,t,n):y.legacy?await R.answerPending(e,y.item_id,n):await R.resolveDecision(e,y.id,t,n);if(r.resolved===!1||`kind`in r&&[`error`,`cancelled`].includes(String(r.kind))){f(String(r.reply||`Could not send answer.`)),await o();return}c(e=>e===s?null:e),await o(),r.daemon&&Number(r.daemon.rc??0)!==0?i(`error`,`Answer queued, but the daemon did not start: ${r.daemon.error||`operator action required`}`):y.kind!==`domain_intake`&&i(`success`,String(r.reply||`Manager delivered your answer to the team.`))}catch(e){f(sh(e)),i(`error`,`Could not send answer: ${sh(e)}`),await o()}finally{p.current=!1,u(!1)}}},pendingReply:y,pendingReplyBusy:l,pendingReplyError:d,pendingReplyOpen:v,setPendingReplyOpen:t=>{f(``),t?e&&g&&c(t=>t?.sid===e?t:{sid:e,card:g}):c(null)}}}var fh=`argus.browser.project.v1`;function ph(){try{return window.sessionStorage.getItem(fh)}catch{return null}}function mh(e){try{e?window.sessionStorage.setItem(fh,e):window.sessionStorage.removeItem(fh)}catch{}}function hh(e,t){let n=new URL(window.location.href);e?n.searchParams.set(`project`,e):n.searchParams.delete(`project`);let r=t===`push`?`pushState`:`replaceState`;window.history[r](window.history.state,``,n.toString())}function gh({cancelActiveMessage:e,notify:t,formatProjectMissing:n,projects:r,projectsError:i,projectsReady:a,queryClient:o,setArtifactPath:s,setSidebarOpen:c,setTaskItemId:l}){let u=(e,t)=>n?n(e,t):t?`Project “${e}” was not found. Switched to ${t}.`:`Project “${e}” was not found. Create a project to continue.`,d=new URLSearchParams(window.location.search),[f,p]=(0,G.useState)(d.get(`project`)||ph()),m=(0,G.useRef)(f),h=(0,G.useRef)(!1);m.current=f;let g=(0,G.useCallback)(t=>{t!==m.current&&(e(),s(null),l(null)),m.current=t,p(t),mh(t)},[e,s,l]),_=(0,G.useCallback)((e,t=`push`)=>{let n=new URLSearchParams(window.location.search).get(`project`);g(e),n!==e&&hh(e,t)},[g]),v=(0,G.useCallback)((e=`replace`)=>{let t=new URLSearchParams(window.location.search).get(`project`);g(null),t!=null&&hh(null,e)},[g]),y=(0,G.useCallback)(e=>{o.prefetchQuery({queryKey:[`snapshot`,e],queryFn:({signal:t})=>R.prefetchSnapshot(e,t),staleTime:3e3})},[o]);return(0,G.useEffect)(()=>{if(!a)return;let e=h.current,n=Qd(r,m.current,e);if(!e&&(h.current=!0,n.id===m.current?mh(n.id):g(n.id),new URLSearchParams(window.location.search).get(`project`)!==n.id&&hh(n.id,`replace`),n.recovered)){let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}},[g,n,t,r,a]),(0,G.useEffect)(()=>{let e=()=>{let e=new URLSearchParams(window.location.search).get(`project`);if(c(!1),!e){g(null);return}if(!a){g(e);return}let n=Zd(r,e);if(g(n.id),n.recovered){hh(n.id,`replace`);let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[g,t,r,a,c]),{activateProject:g,activeSid:a?f&&r.some(e=>e.id===f)?f:null:i?f:null,clearProjectSelection:v,prefetchProject:y,selectProject:_,sid:f,sidRef:m}}var _h={text:``,attachments:[],revision:0};function vh(e){let t=(0,G.useRef)(new Map),n=(0,G.useRef)(new Map),r=(0,G.useRef)(0),i=(0,G.useRef)(!0),[,a]=(0,G.useReducer)(e=>e+1,0);(0,G.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let o=(0,G.useCallback)((e,n)=>{let o={text:n.text,attachments:[...n.attachments],revision:++r.current};return t.current.set(e,o),i.current&&a(),{sid:e,...o}},[]),s=(0,G.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??_h;o(e,{...r,text:typeof n==`function`?n(r.text):n})},[o,e]),c=(0,G.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??_h;o(e,{...r,attachments:typeof n==`function`?n(r.attachments):n})},[o,e]),l=(0,G.useCallback)(e=>{if(!e)return null;let n=t.current.get(e);return n||(n={..._h,attachments:[],revision:++r.current},t.current.set(e,n)),{sid:e,...n,attachments:[...n.attachments]}},[]),u=(0,G.useCallback)(e=>i.current&&t.current.get(e.sid)?.revision===e.revision,[]),d=(0,G.useCallback)((e,t)=>u(e)?o(e.sid,{text:``,attachments:e.attachments.filter(e=>!t.includes(e))}):null,[u,o]),f=(0,G.useCallback)((e,t)=>e.sid!==t.sid||!u(e)?!1:(o(t.sid,t),!0),[u,o]),p=(0,G.useCallback)(e=>{if(!e||n.current.has(e))return null;let t={...l(e),request:++r.current};return n.current.set(e,t),a(),t},[l]),m=(0,G.useCallback)((e,t)=>{if(n.current.get(e.sid)!==e)return!1;n.current.delete(e.sid);let r=u(e);return r&&t!==void 0?o(e.sid,{...e,text:t}):i.current&&a(),r},[u,o]),h=(0,G.useCallback)(e=>{t.current.delete(e),n.current.delete(e),i.current&&a()},[]);return{draft:(e?t.current.get(e):null)??_h,rewriting:!!(e&&n.current.has(e)),setText:s,setAttachments:c,capture:l,consume:d,restore:f,beginRewrite:p,finishRewrite:m,drop:h}}function yh(e,t){if(!t.loadedSid||t.loadedSid!==t.sidRef.current)return null;let n=t.receipts.filter(t=>{let n=Or(t);return n?.deliveryId===e.deliveryId&&n.title===e.title&&n.summary===e.summary&&(!e.path||Ko(t).some(t=>t.path===e.path))}),r=!!(t.completionId&&t.completionId===e.deliveryId);return n.length+Number(r)===1?t.loadedSid:null}function bh(e){let t=(0,G.useRef)(e);t.current=e;let n=(0,G.useRef)(null),[r,i]=(0,G.useReducer)(e=>e+1,0),a=(0,G.useCallback)(()=>{n.current?.controller.abort(),n.current=null},[]),o=(0,G.useCallback)((e,r)=>{n.current===e&&(a(),t.current.notify(`error`,`Cannot open notification: ${xt(r)}. No other session was used.`))},[a]);return(0,G.useEffect)(()=>{let e=Ir(e=>{a();let r=e.sessionId??yh(e,t.current);if(!r){t.current.notify(`info`,`This older notification cannot be automatically located. Select its session and open the result manually.`);return}if(!Cr(r)){t.current.notify(`error`,`Cannot open notification: invalid session identity.`);return}let s={payload:e,target:null,phase:`resolving`,controller:new AbortController};n.current=s,t.current.queryClient.fetchQuery({queryKey:[`projects`],queryFn:R.projectIndex,staleTime:0}).then(e=>{if(n.current===s){if(!e.projects.some(e=>e.id===r))throw Error(`the target session is unavailable or no longer accessible`);s.target=r,s.phase=`loading`,t.current.selectProject(r),i()}}).catch(e=>o(s,e))});return window.addEventListener(`popstate`,a),()=>{e(),window.removeEventListener(`popstate`,a),a()}},[a,o]),(0,G.useEffect)(()=>{let e=n.current;if(!e?.target)return;let r=t.current;if(r.sidRef.current!==e.target){a();return}if(e.phase!==`loading`)return;if(r.snapshotError){o(e,r.snapshotError);return}if(r.loadedSid!==e.target)return;e.phase=`opening`;let i=e.payload.path;if(!i){n.current=null,r.noPath(),r.notify(`info`,`Notification session opened. This notification does not identify a file.`);return}R.artifact(e.target,i,e.controller.signal).then(r=>{let a=t.current;if(n.current!==e||a.sidRef.current!==e.target||a.loadedSid!==e.target)return;if(!r.exists||r.path!==i)throw Error(`the target file is unavailable`);n.current=null;let o=a.receipts.find(t=>t.delivery_id===e.payload.deliveryId&&Ko(t).some(e=>e.path===i));o?a.openDelivery(o,i):a.focusPath(i)}).catch(t=>o(e,t))},[e.selectedSid,e.loadedSid,e.snapshotError,r,a,o]),a}function xh(e,t,n){let r=n?t+8:56,i=Math.max(320,e-r-360-8);return Math.max(320,Math.min(840,i,Math.round(e*.45)))}var Sh=[`mission`,`activity`,`workbench`,`map`],Ch=`argus.workspace.view.v3`;function wh(e){return Sh.includes(e)}function Th(e,t){let n=kt(e);return n==null?t:n===`true`}function Eh(){let e=new URLSearchParams(window.location.search),[t,n]=(0,G.useState)(e.get(`kiosk`)===`1`),[r,i]=(0,G.useState)(()=>Th(`argus.reasoning.visible.v1`,!1)),[a,o]=(0,G.useState)(()=>{let t=e.get(`view`);if(wh(t))return t;let n=kt(Ch);return wh(n)?n:e.get(`kiosk`)===`1`?`map`:`activity`}),s=(0,G.useCallback)(e=>{Ot(Ch,e),o(e)},[]),[c,l]=(0,G.useState)(`activity`),[u,d]=(0,G.useState)(()=>Th(`argus.preview.expanded.v6`,!1)),[f,p]=(0,G.useState)(()=>{let e=Number(kt(`argus.sidebar.width.v2`)||256);return Number.isFinite(e)?Math.max(220,Math.min(400,e)):256}),[m,h]=(0,G.useState)(()=>{let e=Number(kt(`argus.preview.width.v2`)||440);return Number.isFinite(e)?Math.max(320,Math.min(840,e)):440}),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(()=>Th(`argus.sidebar.expanded.v4`,!0)),{themeMode:b,themeStyle:x,cycleTheme:S}=Mt(),C=(0,G.useRef)(null),w=(0,G.useRef)(null);(0,G.useEffect)(()=>{Ot(`argus.sidebar.expanded.v4`,String(v)),Ot(`argus.preview.expanded.v6`,String(u)),Ot(`argus.sidebar.width.v2`,String(f)),Ot(`argus.preview.width.v2`,String(m))},[v,f,u,m]),(0,G.useEffect)(()=>{Ot(`argus.reasoning.visible.v1`,String(r))},[r]);let T=(0,G.useCallback)(()=>{d(!0),l(`preview`);let e=C.current?.clientWidth??window.innerWidth;if(e>=1024){let t=xh(e,f,v);h(e=>Math.max(e,t))}},[v,f]),E=(0,G.useCallback)((e,t)=>{let n=C.current;if(!n)return;t.preventDefault();let r=n.getBoundingClientRect(),i=e===`left`?f:m;n.dataset.resizing=e,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let a=t=>{if(e===`left`){let e=u?m+8:0,n=Math.max(220,Math.min(400,r.width-e-360-8));i=Math.max(220,Math.min(n,t.clientX-r.left))}else{let e=v?f+8:56,n=Math.max(320,Math.min(840,r.width-e-360-8));i=Math.max(320,Math.min(n,r.right-t.clientX))}w.current??=window.requestAnimationFrame(()=>{n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),w.current=null})},o=()=>{w.current!=null&&window.cancelAnimationFrame(w.current),w.current=null,n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),e===`left`?p(i):h(i),delete n.dataset.resizing,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o,{once:!0}),window.addEventListener(`pointercancel`,o,{once:!0})},[v,f,u,m]);return(0,G.useEffect)(()=>{let e=()=>{if(window.innerWidth<1024||!C.current)return;let e=C.current.clientWidth,t=v?f:56,n=u?m:0,r=(v?8:0)+(u?8:0),i=Math.max(540,e-360-r);if(t+n<=i)return;let a=u?Math.max(320,Math.min(m,i-t)):n,o=v?Math.max(220,Math.min(f,i-a)):t;o+a>i&&u&&(a=Math.max(320,i-o)),v&&p(o),u&&h(a)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[v,f,u,m]),{cycleTheme:S,kiosk:t,leftPanelOpen:v,leftWidth:f,mobileView:c,openPreview:T,resizeSidebar:E,rightPanelOpen:u,rightWidth:m,setKiosk:n,setLeftPanelOpen:y,setLeftWidth:p,setMobileView:l,setRightPanelOpen:d,setRightWidth:h,setShowReasoning:i,setSidebarOpen:_,setWorkspaceView:s,shellRef:C,showReasoning:r,sidebarOpen:g,themeMode:b,themeStyle:x,workspaceView:a}}function Dh(e){let t=e.trim();if(!t||/\s/.test(t))return``;if(!t.includes(`?`)&&!t.includes(`://`))return t;try{return new URL(t,window.location.href).searchParams.get(`token`)?.trim()??``}catch{return``}}function Oh(e){try{let t=new URL(window.location.href),n=new URL(e.trim(),t);return n.origin===t.origin&&/^\/pair\/[\w-]{32}$/.test(n.pathname)?n.toString():``}catch{return``}}function kh({error:e,onRetry:t}){let{t:n}=z(),r=de(e),i=e instanceof Te,[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``);return!r&&!i?null:(0,J.jsxs)(`div`,{role:`alert`,className:`fixed left-1/2 top-3 z-[100] flex w-[min(92vw,42rem)] -translate-x-1/2 flex-wrap items-start gap-3 rounded-xl border border-err/50 bg-panel/95 px-4 py-3 text-left text-sm text-ink shadow-xl backdrop-blur`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 font-mono font-bold text-err`,children:`!`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`strong`,{className:`block text-err`,children:n(r?`connection.pairingTitle`:`connection.unreachableTitle`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-ink-dim`,children:n(r?`connection.pairingDetail`:`connection.unreachableDetail`)})]}),r&&!a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`shrink-0 rounded-md border border-blue/45 bg-blue/10 px-2.5 py-1 text-xs font-medium text-blue hover:bg-blue/15`,children:n(`connection.pairAgain`)}):r?null:(0,J.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded-md border border-err/40 px-2.5 py-1 text-xs text-err hover:bg-err/10`,children:n(`common.retry`)}),r&&a?(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=Oh(s);if(t){window.location.replace(t);return}let r=Dh(s);if(!r){u(n(`connection.pairingInvalid`));return}let i=new URL(window.location.href);i.searchParams.set(`token`,r),window.location.replace(i.toString())},className:`flex w-full basis-full flex-wrap gap-2 pl-7`,children:[(0,J.jsx)(`label`,{className:`sr-only`,htmlFor:`pairing-link`,children:n(`connection.pairingInput`)}),(0,J.jsx)(`input`,{id:`pairing-link`,"data-autofocus":!0,type:`password`,autoComplete:`off`,value:s,onChange:e=>{c(e.target.value),u(``)},placeholder:n(`connection.pairingPlaceholder`),className:`h-9 min-w-0 flex-1 rounded-md border border-line bg-bg px-3 text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`submit`,className:`h-9 rounded-md border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white`,children:n(`connection.connect`)}),l?(0,J.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-err`,children:l}):null]}):null]})}function Ah(e){try{let t=JSON.parse(kt(e)||`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function jh(e,t,n,r=!0){let i=(0,G.useRef)(),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),l=(0,G.useCallback)(t=>{if(!e)return;let n=`argus.delivery.seen.v1:${e}`;Ot(n,JSON.stringify([...new Set([...Ah(n),t])].slice(-80)))},[e]),u=(0,G.useCallback)((t,n)=>{if(!e)return;l(t.delivery_id);let r=Ko(t),i=r.find(e=>e.path===n)?.path||r[0]?.path||null;o({sid:e,receipt:t,path:i}),c(null)},[e,l]);return(0,G.useEffect)(()=>{if(!e||!t)return;let a=n?.delivery_id;if(i.current?.sid!==e){i.current={sid:e,ids:new Set(a?[a]:[])},o(null),c(null);return}!a||i.current.ids.has(a)||!r||(i.current.ids.add(a),n&&Ko(n).length&&!Ah(`argus.delivery.seen.v1:${e}`).includes(a)&&c({sid:e,receipt:n}))},[e,t,n,r]),{selection:a?.sid===e?a:null,open:u,fresh:s?.sid===e?s.receipt:null,dismissFresh:(0,G.useCallback)(()=>c(null),[]),close:(0,G.useCallback)(()=>o(null),[]),selectPath:(0,G.useCallback)(e=>o(t=>t&&{...t,path:e}),[])}}var Mh=e({default:()=>Lh}),Nh=0,Ph=(0,G.lazy)(async()=>({default:(await Ne(()=>import(`./ResearchWorkbenchPanel-Bg_Dyv6Z.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url)).ResearchWorkbenchPanel})),Fh=(0,G.lazy)(async()=>({default:(await Ne(()=>import(`./MapPanel-B8sBUMHd.js`),__vite__mapDeps([13,1,2,3,4,5,6,7,8,14,10,15,11,16]),import.meta.url)).MapPanel}));function Ih(e,t){let[n,r]=(0,G.useState)(e),i=(0,G.useRef)(e),a=(0,G.useRef)(null),o=(0,G.useRef)(0);return i.current=e,(0,G.useEffect)(()=>{if(e===n)return;let s=o.current+t-Date.now();if(s<=0){o.current=Date.now(),r(e);return}a.current||=setTimeout(()=>{a.current=null,o.current=Date.now(),r(i.current)},s)},[e,n,t]),(0,G.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),n}function Lh(){let{locale:e,t}=z(),n=e=>e instanceof ce?t(`connection.pairingDetail`):xt(e),r=M(),i=Ce(),a=De(),o=(0,G.useMemo)(()=>Yd(eh(i.data?.projects??[],a.data?.projects??[])),[a.data?.projects,i.data?.projects]),s=i.data?.local_cwd??``,c=[i.error,a.error].find(e=>ze(e)),[l,u]=(0,G.useState)(`none`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(`feed`),h=(0,G.useCallback)(e=>{f(null),m(e),u(`learning`)},[]),g=(0,G.useCallback)((e,t=`recent`)=>{f(e?{kind:`skill`,item:e}:null),m(e?.scope??(t===`recent`?`feed`:t)),u(`learning`)},[]),_=(0,G.useCallback)(e=>{f(e?{kind:`knowledge`,item:e}:null),m(e?.scope===`private`?`global`:e?.scope??`feed`),u(`learning`)},[]),{cycleTheme:v,kiosk:y,leftPanelOpen:b,leftWidth:x,mobileView:S,openPreview:C,resizeSidebar:w,rightPanelOpen:T,rightWidth:E,setKiosk:D,setLeftPanelOpen:O,setLeftWidth:k,setMobileView:A,setRightPanelOpen:j,setRightWidth:ee,setShowReasoning:N,setSidebarOpen:P,setWorkspaceView:F,shellRef:te,showReasoning:re,sidebarOpen:ie,themeMode:I,workspaceView:L}=Eh(),[oe,se]=(0,G.useState)(()=>L===`mission`?`mission`:`activity`),[le,ue]=(0,G.useState)(L===`workbench`);(0,G.useEffect)(()=>{if(L===`workbench`){ue(!0);return}L!==`map`&&se(L)},[L]);let de=Vm(),[fe,pe]=(0,G.useState)(0),[me,he]=(0,G.useState)(0),[ge,ve]=(0,G.useState)(`auto`),[ye,be]=(0,G.useState)(!1),[we,Te]=(0,G.useState)([]),ke=(0,G.useRef)(null),[Me,Ne]=(0,G.useState)([]),[Fe,Ie]=(0,G.useState)(null),[Le,Re]=(0,G.useState)({path:``,token:0}),[Be,Ve]=(0,G.useState)(null),[He,B]=(0,G.useState)(!1),[Ue,We]=(0,G.useState)(null),[Ge,Ke]=(0,G.useState)(null),qe=(0,G.useRef)(!1),Je=(0,G.useRef)(null),Ye=(0,G.useRef)(0),V=(0,G.useRef)(),Xe=(0,G.useRef)({sid:``,completionId:``,view:null,artifacts:[]}),Ze=(0,G.useRef)(()=>void 0),[Qe,$e]=(0,G.useState)(null),[et,tt]=(0,G.useReducer)($m,Qm),[rt,H]=(0,G.useState)(`all`),[it,at]=(0,G.useState)(``),ot=(0,G.useCallback)(()=>$e(null),[]),st=(0,G.useCallback)((e,t)=>{$e({id:++Nh,tone:e,message:t})},[]),ct=(0,G.useCallback)(()=>{let e=!!Je.current;return Ye.current+=1,Je.current?.controller.abort(),Je.current=null,be(!1),Ne([]),e},[]),ut=(0,G.useCallback)(()=>{let e=Je.current;if(!e||!ct())return;let n=Ye.current;st(`info`,t(`chat.stoppingReply`)),R.cancelMessage(e.sid,e.serverRequestId).then(e=>{Ye.current===n&&st(`info`,t(e.requested?`chat.stopReplyRequested`:`chat.replyAlreadyFinished`))}).catch(e=>{Ye.current===n&&st(`error`,t(`chat.stopReplyFailed`,{error:xt(e)}))})},[ct,st,t]),{activeSid:U,clearProjectSelection:W,prefetchProject:ft,selectProject:pt,sid:mt,sidRef:ht}=gh({cancelActiveMessage:ct,notify:st,formatProjectMissing:(e,n)=>n?t(`project.missingSwitched`,{requested:e??``,fallback:n}):t(`project.missingCreate`,{requested:e??``}),projects:o,projectsError:i.isError,projectsReady:i.isSuccess,queryClient:r,setArtifactPath:Ie,setSidebarOpen:P,setTaskItemId:Ve}),{draft:{text:gt,attachments:_t},rewriting:vt,setText:yt,setAttachments:bt,capture:St,consume:Ct,restore:wt,beginRewrite:Tt,finishRewrite:Dt,drop:Ot}=vh(mt),kt=(0,G.useCallback)((e,t)=>{Ze.current(),pt(e,t)},[pt]),At=(0,G.useCallback)(e=>{Ze.current(),W(e)},[W]);(0,G.useEffect)(()=>ve(`auto`),[U]),(0,G.useEffect)(()=>{Re(e=>e.path?{path:``,token:e.token+1}:e)},[mt]),(0,G.useEffect)(()=>()=>{Ye.current+=1,Je.current?.controller.abort(),Je.current=null},[]),(0,G.useEffect)(()=>Rr(),[]);let jt=(0,G.useCallback)(e=>{let t=(e||``).trim(),n=ht.current;if(!t||!n)return;let r=Tt(n);r&&R.rewritePrompt(n,t).then(e=>{if(e.error||!e.rewritten.trim()){Dt(r)&&ht.current===n&&st(`error`,`Rewrite failed: ${e.error||`empty rewrite`} — your prompt is unchanged`);return}if(!Dt(r,e.rewritten)||ht.current!==n)return;pe(e=>e+1);let t=e.questions.length?` Manager asks: ${e.questions.join(` · `)}`:``;st(`success`,`Prompt rewritten — review it, then send.${t}`)},e=>{Dt(r)&&ht.current===n&&st(`error`,`Rewrite failed: ${xt(e)} — your prompt is unchanged`)})},[Tt,Dt,st,ht]),{createDaemon:Mt,creatingDaemon:Nt}=rh({localCwd:s,notify:st,onFocusComposer:()=>pe(e=>e+1),queryClient:r,refetchProjects:i.refetch,selectProject:kt,translate:t}),Pt=(0,G.useCallback)(()=>{Mt(``,``,``)},[Mt]),zt=(0,G.useRef)(Pt);zt.current=Pt,(0,G.useEffect)(()=>Lr(()=>zt.current()),[]);let Vt=Se(U),Ht=Se(Ue),K=Vt.data,q=K?.session.id===U?U:null,Ut=K?.continuous,Wt=_e(q,!0),Gt=Pe(q,oe===`mission`),{events:Kt,connected:qt}=Ee(q,et.reconnectKey),Jt=(0,G.useMemo)(()=>Oe(Kt),[Kt]),Yt=(0,G.useMemo)(()=>je(Kt),[Kt]);(0,G.useEffect)(()=>{if(!q||!Jt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`artifacts`,q],exact:!0})},180);return()=>window.clearTimeout(e)},[Jt,q,r]),(0,G.useEffect)(()=>{if(!q||!Yt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`snapshot`,q],exact:!0})},80);return()=>window.clearTimeout(e)},[q,r,Yt]);let Xt=(0,G.useMemo)(()=>qm(Kt),[Kt]),{query:Zt,events:Qt,status:$t}=Bt(q,oe===`activity`,Kt,we,ke.current),en=q&&K?.manager_requests?.filter(e=>e.status===`running`).at(-1)?.request_id||``,tn=ye||!!en;(0,G.useEffect)(()=>{if(!q)return;let e=Je.current;if(en){e||(Je.current={id:++Ye.current,serverRequestId:en,sid:q,controller:new AbortController,recovered:!0},be(!0));return}e?.recovered&&e.sid===q&&(Je.current=null,be(!1),Ne([]),Zt.refetch())},[en,q,Zt.refetch]);let nn=xe(U,20,l===`inspector`),rn=Ih((0,G.useMemo)(()=>({sid:q,events:Kt,conversation:Qt}),[q,Kt,Qt]),250),an=rn.sid===q?rn.events:[],on=rn.sid===q?rn.conversation:[],sn=(0,G.useMemo)(()=>K?If(K,Qt,Wt.data??[]):null,[Qt,Wt.data,K]),{answerPendingReply:cn,pendingReply:ln,pendingReplyBusy:un,pendingReplyError:dn,pendingReplyOpen:fn,setPendingReplyOpen:pn}=dh({activeSid:U,currentTaskId:sn?.mission.id,autoOpen:L!==`map`,backlog:K?.backlog,notify:st,pendingQuestions:K?.pending_questions,refetchSnapshot:Vt.refetch}),mn=K?.daemon.alive&&sn?.routing.vertical===`research`?sn.active_role.startsWith(`reviewer`)?`reviewing`:sn.active_role.startsWith(`engineer`)?`revising`:void 0:void 0,hn=Yo((0,G.useMemo)(()=>mu(Qt),[Qt]),sn?.delivery??null,Qt),gn=K?.backlog.some(e=>[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))??!1,_n=Uf(sn)&&!gn&&!K?.continuous?.enabled,vn=q&&_n&&sn?.mission.id?`completion:${q}:${sn.mission.id}`:``;Xe.current={sid:q||``,completionId:vn,view:sn,artifacts:Wt.data??[]};let yn=(0,G.useCallback)(()=>{C()},[C]),bn=(0,G.useCallback)((e,t=!0)=>{let n=e.trim();if(!n){t&&F(`map`);return}if(L===`map`){Ie(n);return}j(!0),A(`preview`),Re(e=>({path:n,token:e.token+1}))},[A,j,F,L]),xn=jh(q,!!K&&!Zt.isPending,hn,!Fe&&!Xo(K?.backlog??[],hn?.item_id)),Sn=xn.open,Cn=(0,G.useMemo)(()=>{let e=new Map;for(let t of Qt){let n=t.delivery;n?.delivery_id&&Array.isArray(n.targets)&&e.set(n.delivery_id,n)}for(let t of[sn?.delivery,hn])t&&e.set(t.delivery_id,t);return[...e.values()].filter(e=>Ko(e).length).sort((e,t)=>t.delivered_at-e.delivered_at)},[Qt,sn?.delivery,hn]);(0,G.useEffect)(()=>{q&&hn?.delivery_id&&r.invalidateQueries({queryKey:[`artifacts`,q],exact:!0})},[q,hn?.delivery_id,r]),(0,G.useEffect)(()=>{if(!q)return;let e=V.current;if(!e||e.sid!==q){V.current={sid:q,id:vn||null};return}if(!vn){V.current={sid:q,id:null};return}if(e.id===vn)return;let n=window.setTimeout(()=>{let e=Xe.current;if(e.sid!==q||e.completionId!==vn||!e.view)return;let n=e.view.delivery,r=Jf(e.artifacts),i=Dr({completionId:vn,sessionId:q,title:n?.title||e.view.mission.title||t(`mission.taskCompleted`),summary:n?.summary||e.view.mission.summary,path:n?.primary_target?.path||r?.path});i&&Nr(i),V.current={sid:q,id:vn}},500);return()=>window.clearTimeout(n)},[vn,q,t]),Ze.current=bh({selectedSid:mt,loadedSid:q,sidRef:ht,snapshotError:Vt.error,queryClient:r,receipts:Zt.isPending?[]:Cn,completionId:vn,selectProject:e=>{pt(e),P(!1)},openDelivery:Sn,focusPath:e=>{Wt.data?.some(t=>t.path===e&&t.exists)?bn(e):Ie(e)},noPath:()=>{A(`activity`),F(`map`)},notify:st});let wn=(0,G.useRef)(Qt);wn.current=Qt,(0,G.useEffect)(()=>{H(`all`),at(``),Te([]),tt({kind:`reset`})},[q]);let Tn=Ae(U,K?.daemon_commands?.revision),En=Ae(Ue,Ht.data?.daemon_commands?.revision),Dn=(0,G.useCallback)(async e=>{Ke(e);try{await R.startDaemon(e),await i.refetch(),st(`success`,t(`sidebar.resumeSuccess`))}catch(e){st(`error`,t(`sidebar.resumeFailed`,{error:xt(e)}))}finally{Ke(null)}},[st,i,t]),{daemonBusy:On,manageDeleteProject:kn,manageStopDaemon:An,manageRenameProject:jn,manageStartDaemon:Mn,requestDispose:Nn,requestManageSession:Pn,requestStartDaemon:Fn,requestStopDaemon:In,requestStopIteration:Ln,toggleContinuous:Rn}=ah({actions:Tn,manageActions:En,manageTargetSid:Ue,setManageTargetSid:We,activeSid:U,clearProjectSelection:At,continuous:Ut,notify:st,refetchProjects:i.refetch,selectProject:kt,setDaemonManageOpen:B}),zn=(0,G.useCallback)(async e=>{if(!U)return;let t=await Tn.updateProject.mutateAsync({sid:U,name:e});st(`success`,`Renamed to "${t.name}".`)},[Tn.updateProject,U,st]),Bn=(0,G.useMemo)(()=>Ym({activeSid:U,activityEventsRef:wn,notify:st,onClearEvents:e=>tt({kind:`clear`,offset:e}),onDispose:Nn,onOpenConfig:()=>u(`config`),onOpenDoctor:()=>u(`doctor`),onOpenHelp:()=>u(`help`),onOpenIdentity:()=>u(`identity`),onOpenInspector:()=>u(`inspector`),onOpenNewDaemon:Pt,onOpenOperations:()=>u(`operations`),onOpenSidebar:()=>P(!0),onOpenSkills:()=>g(void 0,`global`),onReconnectEvents:()=>tt({kind:`reconnect`}),onRenameProject:zn,onRewriteDraft:jt,onSelectProject:kt,onSetArtifactPath:Ie,onSetEventFilter:H,onSetEventQuery:at,onSetTaskItemId:Ve,onSetWorkspaceView:F,onShowArtifacts:yn,onStopIteration:Ln,onStopWaiting:ut,refetchSnapshot:Vt.refetch}),[U,st,yn,g,zn,Nn,Ln,jt,kt,Vt.refetch,ut,F]);oh({focusComposer:()=>pe(e=>e+1),openHelp:()=>u(`help`),toggleKiosk:()=>D(e=>!e),togglePalette:()=>u(e=>e===`palette`?`none`:`palette`),toggleReasoning:()=>N(e=>!e),toggleSidebarCollapse:()=>O(e=>!e)});let Vn=async(e,n=[],i)=>{let a=U;if(!a||a!==ht.current||qe.current||Je.current)return!1;let o=Ye.current;qe.current=!0;let s,c,l;try{if(!n.length){let t=await Jm(e,Bn);if(t.kind===`handled`)return i?.({type:`settled`,outcome:`message`}),!0;if(t.kind===`error`)return st(`error`,t.message),!1}if(ht.current!==a||Ye.current!==o)return!1;s=++Ye.current,c=ne(),l=new AbortController,Je.current={id:s,serverRequestId:c,sid:a,controller:l}}finally{qe.current=!1}let u=()=>{let e=Je.current;return!!(e&&e.id===s&&e.sid===a&&ht.current===a&&!l.signal.aborted)},d=()=>{Je.current?.id===s&&(Je.current=null,be(!1),Ne([]))};be(!0),Ne([]);let f=[];if(n.length)try{let e=await R.uploadAttachments(a,n,l.signal);if(!u())return!1;f=e.attachments.map(e=>({attachment_id:e.attachment_id}))}catch(e){return u()&&(st(`error`,t(`chat.attachmentUploadFailed`,{error:xt(e)})),d()),!1}let p=ke.current===a;ke.current=a,Te(t=>Ft([...p?t:[],Lt(a,s,e)],a,s,[]));let m=(e,t=``,n=`auto`)=>{!u()||typeof e!=`string`||!e.trim()||Te(r=>Rt(r,a,s,e,t,Date.now(),n))},h=e=>{if(!u())return;let t=e.item;typeof t?.id==`string`&&i?.({type:`task`,taskId:t.id});let n=e.daemon&&typeof e.daemon==`object`?e.daemon:null,r=typeof e.reply==`string`?e.reply:null;n?.admission_required?st(`error`,r||`Task queued, but all daemon slots are busy: ${String(n.error||`operator action required`)}`):n&&Number(n.rc??0)!==0?st(`error`,r||`Task queued, but executor did not start: ${String(n.error||`unknown error`)}`):r&&!i&&st(`success`,r),Vt.refetch?.()},g=e=>{u()&&(r.invalidateQueries({queryKey:[`artifacts`,a]}),Zm(e,{dispatchTask:h,notifyError:e=>st(`error`,e),refetchTranscript:()=>{Zt.refetch()}}))};return(async()=>{let t=!1,n=null,r=[];try{try{await R.messageStream(a,e,{onPhase:(e,t,n)=>{if(!u()||n.heartbeat)return;r=Hl(r,{label:e,role:t,kind:n.kind,detail:n.detail,heartbeat:n.heartbeat,quietS:n.quietS,tool:n.tool,toolKind:n.toolKind,callId:n.callId,status:n.status,output:n.output}),Ne(r);let i=Gl(r);i.length&&Te(e=>Ft(e,a,s,i,Date.now(),!0))},onDelta:(e,n,r)=>{u()&&(t=!0,m(e,n,r===`append`||r===`snapshot`?r:`auto`))},onDone:e=>{if(!u())return;e.kind!==`error`&&ve(`auto`),r=Ul(r),Ne(r);let t=Jl(e.steps),n=t.length?t:Gl(r,Date.now()/1e3,!0);Te(t=>Ft(t,a,s,n,Date.now(),!1,e.kind===`error`?`failed`:`completed`)),m(e.reply,``,`snapshot`),g(e);let o=e.item;(e.kind!==`task`||typeof o?.id!=`string`)&&i?.({type:`settled`,outcome:e.kind===`error`?`error`:`message`})},onError:e=>{u()&&(n=e)}},{signal:l.signal,attachments:f,routeOverride:ge,requestId:c})}catch(e){u()&&(n=e)}if(!u())return;n&&(st(`error`,Et(n,t)),i?.({type:`settled`,outcome:`error`}))}finally{Te(e=>It(e,s,Date.now(),n&&!l.signal.aborted?`failed`:`stopped`)),l.signal.aborted&&i?.({type:`settled`,outcome:`cancelled`}),d()}})(),!0},Hn=(0,G.useRef)(Vn);Hn.current=Vn;let Un=async(e,t=[],n,r)=>{let i=St(ht.current);if(!i)return!1;if(r?.whileRunning){try{if(!t.length){let n=await Jm(e,Bn);if(n.kind===`error`)return st(`error`,n.message),!1;if(n.kind===`handled`)return Ct(i,t),!0}await R.queueFollowup(i.sid,e,ge)}catch(e){return st(`error`,xt(e)),!1}return Ct(i,t),!0}let a=null,o=!1,s=!t.length&&ju(e.trim())?.cmd?.id===`rewrite`,c=await Vn(e,t,e=>{e.type===`settled`&&e.outcome===`error`&&(o=!0,a&&wt(a,i)),ht.current===i.sid&&n?.(e)});return c&&!o&&!s&&(a=Ct(i,t)),c},Wn=(0,G.useMemo)(()=>{let n=dd(xu,e=>{Hn.current(e)},e=>{yt(e),pe(e=>e+1)},e),r=[...y?[]:[{id:`new`,label:t(`palette.newDaemon`),hint:`+`,group:t(`palette.view`),run:Pt}],{id:`transcript`,label:t(`palette.openTranscript`),hint:`/transcript`,group:t(`palette.view`),run:()=>u(`transcript`)},{id:`inspector`,label:t(`palette.openProject`),hint:t(`palette.projectHint`),group:t(`palette.view`),run:()=>u(`inspector`)},{id:`operations`,label:t(`palette.openOperations`),hint:t(`palette.operationsHint`),group:t(`palette.view`),run:()=>u(`operations`)},{id:`verticals`,label:t(`verticals.openStore`),hint:t(`verticals.paletteHint`),group:t(`palette.view`),run:()=>u(`verticals`)},{id:`help`,label:t(`help.title`),hint:`?`,group:t(`palette.view`),run:()=>u(`help`)},{id:`reasoning`,label:t(re?`palette.hideReasoning`:`palette.showReasoning`),hint:`⌘T`,group:t(`palette.view`),run:()=>N(e=>!e)},{id:`kiosk`,label:t(y?`palette.exitKiosk`:`palette.enterKiosk`),hint:`⌘.`,group:t(`palette.view`),run:()=>D(e=>!e)}],i=y?[]:[{id:`message`,label:t(`palette.messageArgus`),hint:`/`,group:t(`palette.action`),run:()=>pe(e=>e+1)},...tn?[{id:`cancel-message`,label:t(`palette.stopWaiting`),hint:`Esc`,group:t(`palette.action`),run:ut}]:[],...Ut?[{id:`continuous`,label:Ut.enabled?t(`palette.stopContinuous`):t(`palette.startContinuous`),group:t(`palette.action`),run:Rn}]:[],...K?.daemon.control_available===!1?[]:[K?.daemon.alive?{id:`stop`,label:t(`palette.stopDaemon`),group:t(`palette.action`),run:In}:{id:`start`,label:t(`palette.startDaemon`),group:t(`palette.action`),run:Fn}]],a=o.map(e=>({id:`p-${e.id}`,label:Jd(e)?(e.label||e.display_name||``).trim():e.objective.trim()||t(`sidebar.unnamedSession`),hint:e.daemon_alive?`● ${t(`common.live`)}`:`○`,keywords:`${e.id} ${e.display_name??``} ${e.objective} ${e.daemon_alive?`live running`:`stopped idle`}`,group:t(`palette.project`),run:()=>kt(e.id)}));return[...r,...i,...n,...a]},[o,K?.daemon.alive,y,re,Ut?.enabled,tn,ut,yt,e,t]);return(0,J.jsx)(xs,{sid:U,readOnly:y,children:(0,J.jsxs)(nt,{ref:te,style:{"--sidebar-width":`${x}px`,"--preview-width":`${E}px`},children:[(0,J.jsx)(kh,{error:c,onRetry:()=>{i.refetch(),a.refetch()}}),xn.fresh&&!xn.selection&&(0,J.jsxs)(`div`,{className:`delivery-toast`,role:`status`,"aria-live":`polite`,children:[(0,J.jsxs)(`span`,{children:[e===`zh-CN`?`新交付:`:`New delivery: `,xn.fresh.title]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>Sn(xn.fresh),children:e===`zh-CN`?`查看`:`Open`}),(0,J.jsx)(`button`,{type:`button`,"aria-label":e===`zh-CN`?`关闭`:`Dismiss`,onClick:xn.dismissFresh,children:`×`})]}),xn.selection&&(0,J.jsx)(yf,{sid:xn.selection.sid,path:xn.selection.path,delivery:xn.selection.receipt,deliveries:Cn,reviewActivity:xn.selection.sid===q?mn:void 0,onSelectDelivery:Sn,onSelectPath:xn.selectPath,onClose:xn.close},`${xn.selection.sid}:${xn.selection.receipt.delivery_id}`),!y&&ie?(0,J.jsx)(`button`,{type:`button`,"aria-label":t(`common.closeSessions`),onClick:()=>P(!1),className:`fixed inset-0 z-30 bg-black/40 lg:hidden`}):null,y?null:(0,J.jsx)(nm,{projects:o,activeId:U,activeWork:q?{sessionId:q,status:ci(K,sn,Qt),connected:qt&&!Vt.isError}:void 0,localCwd:s,onSelect:e=>{kt(e),P(!1)},onPrefetch:ft,onManage:Pn,onResume:e=>void Dn(e),resumingId:Ge,onOpenPanel:e=>u(e),onOpenLearning:h,onOpenVerticals:()=>u(`verticals`),onNew:Pt,loading:i.isLoading,creating:Nt,error:i.isError?xt(i.error):void 0,onRetry:()=>void i.refetch(),mobileOpen:ie,collapsed:!b,onToggleCollapse:()=>O(e=>!e),themeMode:I,onCycleTheme:v}),!y&&b?(0,J.jsx)(gm,{label:t(`common.resizeSessions`),value:x,min:220,max:400,onPointerDown:e=>w(`left`,e),onReset:()=>k(256),onNudge:e=>k(t=>Math.max(220,Math.min(400,t+e)))}):null,(0,J.jsx)(`main`,{className:`flex min-w-0 flex-1 overflow-x-hidden`,children:K?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`${S===`activity`?`flex`:`hidden`} ${L===`map`&&!y?`mobile-scroll-region`:``} glass-panel glass-panel--main h-full min-w-0 flex-1 flex-col lg:flex`,children:[(0,J.jsx)(qd,{sid:q}),L!==`map`&&(0,J.jsx)(wi,{events:Qt,snap:K,streamOk:qt,onStart:Fn,onStop:In,onManage:()=>U&&Pn(U),busy:On,snapshotStale:Vt.isError,readOnly:y,missionView:sn}),(0,J.jsxs)(`nav`,{"aria-label":t(`mobile.views`),className:`hidden h-11 shrink-0 items-center gap-3 border-b border-line/60 px-5 lg:flex`,children:[(0,J.jsxs)(`div`,{className:`workspace-tabs`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`map`),className:`workspace-tab`,"data-selected":L===`map`,children:t(`mobile.map`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`activity`),className:`workspace-tab`,"data-selected":L===`activity`,children:t(`mobile.activity`)})]}),(0,J.jsxs)(`details`,{className:`workspace-more`,onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,J.jsx)(`summary`,{children:L===`mission`?t(`mobile.mission`):L===`workbench`?t(`mobile.workbench`):e===`zh-CN`?`更多`:`More`}),(0,J.jsxs)(`div`,{className:`workspace-more-menu`,onClick:e=>{e.target.closest(`button`)&&e.currentTarget.closest(`details`)?.removeAttribute(`open`)},children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`mission`),children:t(`mobile.mission`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`reading`),children:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`workbench`),children:t(`mobile.workbench`)}),y?null:(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`operations`),children:t(`mission.operations`)})]})]}),(0,J.jsxs)(`button`,{type:`button`,className:`ml-auto px-2 py-1 text-sm text-ink-dim hover:text-ink`,"aria-expanded":T,onClick:()=>{T?(j(!1),A(`activity`)):yn()},children:[e===`zh-CN`?`文件`:`Files`,Wt.data?.length?` · ${Wt.data.filter(e=>e.exists).length}`:``]})]}),!y&&(0,J.jsx)(tr,{sid:U,onOpenKnowledge:()=>_(),onOpenSkills:()=>g()}),L===`map`&&(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(`div`,{className:`m-auto text-sm text-ink-faint`,children:t(`common.loading`)}),children:(0,J.jsx)(Fh,{snapshot:K,events:an,managerSteps:Me,draft:gt,onDraftChange:yt,onSend:Un,attachments:_t,onAttachmentsChange:bt,pending:tn,onCancel:ut,focusSignal:fe,readOnly:y,onOpenSettings:()=>u(`config`),currentTaskId:sn?.mission.id,routeOverride:ge,onRouteOverrideChange:ve,conversationEvents:on,connected:qt,artifacts:Wt.data??[],deliveryCount:Cn.length,onOpenDelivery:()=>{let e=qo(Cn,sn?.routing.vertical||``);e&&Sn(e.receipt,e.path)},onOpenReceipt:Sn,onOpenArtifact:Ie,onAnswer:()=>pn(!0)},K.session.id)}),(0,J.jsxs)(`div`,{className:`${L===`workbench`||L===`map`?`hidden`:`flex`} min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(Kd,{alert:Xt}),oe===`mission`&&sn?(0,J.jsx)(Am,{events:Qt,connected:qt&&!Vt.isError,view:sn,sid:K.session.id,snapshot:K,gitDiff:Gt.data,artifacts:Wt.data,onOpenArtifact:bn,onOpenDelivery:Sn,onNotify:st,onAsk:y?void 0:e=>{yt(t=>t.trim()?`${t}\n\n${e}`:e),pe(e=>e+1)}}):(0,J.jsx)(`div`,{className:`flex flex-1 flex-col ${de?`min-h-0`:`min-h-[209px] lg:min-h-0`}`,children:(0,J.jsx)(_u,{snapshot:K,missionView:sn,events:Qt,connected:qt&&!Vt.isError,showReasoning:re,onToggleReasoning:()=>N(e=>!e),historyStatus:$t,historyRefreshing:Zt.isFetching,onRetryHistory:()=>void Zt.refetch(),embedded:!0,filter:rt,query:it,skipFirst:et.skipFirst,artifacts:Wt.data,onOpenArtifact:bn,onOpenDelivery:Sn},q)}),y?null:(0,J.jsx)(`div`,{className:`composer-dock shrink-0 px-4 pt-3`,children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-full lg:max-w-[61.8vw]`,children:[(0,J.jsx)(Wd,{questions:K.pending_questions??[],backlog:K.backlog,currentTaskId:sn?.mission.id,onAnswer:()=>pn(!0)}),(0,J.jsx)(ud,{value:gt,attachments:_t,onAttachmentsChange:bt,onChange:yt,onSend:Un,onCancel:ut,disabled:!U,pending:tn,focusSignal:fe,embedded:!0,onRewrite:jt,rewriting:vt,slashSelection:me,onSlashSelectionChange:he,routeOverride:ge,onRouteOverrideChange:ve,footer:U?(0,J.jsx)(Vr,{sid:K.session.id,roles:K.roles,running:K.daemon.alive||!!K.manager_requests?.length,lastCall:K.last_call,onOpenSettings:()=>u(`config`)}):void 0},U||`no-session`)]})})]}),le&&U?(0,J.jsx)(`div`,{className:`${L===`workbench`?`flex`:`hidden`} min-h-0 flex-1`,children:(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-xs text-ink-faint`,children:t(`common.loading`)}),children:(0,J.jsx)(Ph,{sid:U,active:L===`workbench`})})}):null]}),T&&L!==`map`?(0,J.jsx)(gm,{label:t(`common.resizePreview`),value:E,min:320,max:840,onPointerDown:e=>w(`right`,e),onReset:()=>ee(440),onNudge:e=>ee(t=>Math.max(320,Math.min(840,t-e)))}):null,(T&&L!==`map`||S===`preview`)&&(0,J.jsxs)(`aside`,{"data-resizable-panel":`right`,className:`${S===`preview`?`flex`:`hidden`} relative min-w-0 flex-1 flex-col overflow-hidden border-l border-line/60 bg-panel lg:flex lg:flex-none lg:w-[var(--preview-width)]`,children:[(0,J.jsx)(`div`,{className:`lg:hidden`,children:(0,J.jsx)(wi,{events:Qt,snap:K,streamOk:qt,onStart:Fn,onStop:In,onManage:()=>U&&Pn(U),busy:On,snapshotStale:Vt.isError,readOnly:y,missionView:sn})}),(0,J.jsx)(ep,{snapshot:K,connected:qt&&!Vt.isError,sid:q,artifacts:Wt.data,error:Wt.isError,onExpand:Ie,onOpenFile:yn,className:`min-h-0 flex-1 mobile-scroll-region`,embedded:!0,onCollapse:()=>{j(!1),A(`activity`)},missionView:sn,activityEvents:Qt,requestedPath:Le.path,requestedPathToken:Le.token,routeVisible:L!==`mission`})]})]}):(0,J.jsx)(Rm,{loading:i.isLoading||!!(U&&Vt.isLoading),hasProjects:o.length>0,error:i.isError&&o.length===0?n(i.error):Vt.isError&&!K?n(Vt.error):void 0,onRetry:()=>{i.refetch(),U&&Vt.refetch()},onNew:Pt,onChoose:()=>P(!0),canCreate:!y})}),(0,J.jsx)(dt,{open:l===`learning`,onClose:()=>u(`none`),label:e===`zh-CN`?`知识与技能`:`Knowledge and skills`,width:`max-w-6xl`,children:l===`learning`&&(0,J.jsx)(mr,{sid:U,initialSelection:d,initialScope:p,projectNames:Object.fromEntries(o.flatMap(e=>e.display_name?[[e.id,e.display_name]]:[]))})}),(0,J.jsxs)(dt,{open:l===`reading`,onClose:()=>u(`none`),label:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`,children:[(0,J.jsx)(lt,{title:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}),l===`reading`&&K&&sn?.mission.id&&U?(0,J.jsxs)(J.Fragment,{children:[ae()===`question-foundation`?(0,J.jsx)(bf,{sid:U,objective:K.session.objective,readOnly:y,onOpenArtifact:Ie}):null,(0,J.jsx)(Ws,{sid:U,snapshot:K,view:sn,active:!0,readOnly:y,onOpenArtifact:Ie,onAsk:e=>{yt(t=>t.trim()?`${t}\n\n${e}`:e),pe(e=>e+1),u(`none`)}},U),(0,J.jsx)(`div`,{className:`px-4 pb-4`,children:(0,J.jsx)(ys,{})})]}):(0,J.jsx)(`p`,{className:`px-6 pb-6 text-sm text-ink-dim`,children:e===`zh-CN`?`开始任务后,可以在这里查看说明和依据。`:`Task explanations and evidence appear here once work begins.`})]}),(0,J.jsx)(pd,{open:l===`palette`,onClose:()=>u(`none`),items:Wn}),(0,J.jsx)($p,{open:l===`verticals`,onClose:()=>u(`none`)}),(0,J.jsx)(hd,{open:l===`help`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(zd,{sid:U,open:l===`doctor`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Bd,{sid:U,open:l===`config`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Vd,{sid:U,open:l===`identity`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Hd,{sid:U,open:l===`transcript`,onClose:()=>u(`none`)}),U&&K?(0,J.jsx)(fm,{open:l===`inspector`,snap:K,journal:nn.data??[],busy:Tn.disposeBacklog.isPending||Tn.stopBacklog.isPending,onClose:()=>u(`none`),onDispose:Nn,onStop:Ln,onInspect:Ve}):null,U&&K?(0,J.jsx)(Fm,{open:l===`operations`,onOpenSkills:()=>g(void 0,`global`),sid:U,snap:K,onClose:()=>u(`none`),onChanged:()=>{Vt.refetch(),i.refetch()},onRestored:async e=>{await i.refetch(),kt(e)}}):null,(0,J.jsx)(yf,{sid:U,path:Fe,artifacts:Wt.data??[],reviewActivity:U===q?mn:void 0,onSelectPath:Ie,onClose:()=>Ie(null)}),(0,J.jsx)(hm,{sid:U,itemId:Be,onClose:()=>Ve(null),onDone:e=>Nn(e,`done`),onSkip:e=>Nn(e,`rm`),onStop:Ln,busy:Tn.disposeBacklog.isPending||Tn.stopBacklog.isPending,readOnly:y}),(0,J.jsx)(Gd,{reply:ln,open:fn,busy:un,error:dn,onClose:()=>pn(!1),onSubmit:cn}),Ue?(0,J.jsx)(np,{open:He,sid:Ue,name:Ht.data?.session.display_name||o.find(e=>e.id===Ue)?.display_name||o.find(e=>e.id===Ue)?.label||``,alive:Ht.data?.daemon.alive??!!o.find(e=>e.id===Ue)?.daemon_alive,controlAvailable:Ht.data?.daemon.control_available!==!1,busy:On,onClose:()=>{B(!1),We(null)},onRename:jn,onStart:Mn,onStop:An,onDelete:async()=>{let e=Ue,t=await kn();return t&&e&&Ot(e),t}}):null,(0,J.jsx)(tp,{notice:Qe,onClose:ot}),K&&!y?(0,J.jsx)(zm,{active:S===`preview`?`preview`:L,sidebarOpen:ie,onSelect:e=>{if(e===`preview`){A(`preview`);return}A(`activity`),F(e)},onOpenSessions:()=>P(!0),onRead:()=>u(`reading`),onOpenSkills:()=>g()}):null]})})}export{Ii as $,go as A,Jt as At,ga as B,Do as C,sn as Ct,So as D,$t as Dt,wo as E,rn as Et,eo as F,Ja as G,Ya as H,ro as I,oa as J,ma as K,so as L,Qa as M,Kt as Mt,to as N,Ut as Nt,xo as O,Qt as Ot,no as P,Ht as Pt,ki as Q,io as R,Oo as S,ln as St,Co as T,an as Tt,ba as U,Ra as V,Ca as W,sa as X,aa as Y,Ti as Z,Gc as _,Hr as _t,Wd as a,Ui as at,Ss as b,gn as bt,Ju as c,Bi as ct,id as d,Lh as default,Si as dt,Zi as et,vu as f,ii as ft,Xc as g,Qr as gt,Kc as h,pi as ht,rf as i,Pi as it,ho as j,qt as jt,mo as k,Xt as kt,Gu as l,zi as lt,Ml as m,ri as mt,vm as n,Yi as nt,cd as o,Mi as ot,_u as p,ci as pt,la as q,vf as r,Hi as rt,ad as s,ji as st,Mh as t,Ai as tt,td as u,Xi as ut,Pc as v,Vr as vt,ko as w,on as wt,Uo as x,dn as xt,Hc as y,yn as yt,oo as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/App-DCNDn7WF.css b/frontend/web/dist/assets/App-DCNDn7WF.css new file mode 100644 index 000000000..72af71c97 --- /dev/null +++ b/frontend/web/dist/assets/App-DCNDn7WF.css @@ -0,0 +1 @@ +.session-workdir{min-width:0;max-width:100%;color:rgb(var(--ink-dim));flex:1;font-size:10px;line-height:1.4;position:relative}.session-workdir>summary{cursor:pointer;align-items:center;gap:6px;min-width:0;list-style:none;display:flex}.session-workdir>summary::-webkit-details-marker{display:none}.session-workdir>summary>span{flex-shrink:0}.session-workdir>summary>code{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.session-workdir>summary:focus-visible{outline:2px solid rgb(var(--blue));outline-offset:2px}.session-workdir__detail{z-index:40;border:1px solid rgb(var(--line));background:rgb(var(--panel));width:min(420px,100vw - 32px);max-height:min(300px,60vh);color:rgb(var(--ink));box-shadow:0 8px 24px rgb(var(--ink) / .12);border-radius:8px;padding:12px;font-size:12px;position:absolute;top:calc(100% + 6px);left:0;overflow:auto}.session-workdir__detail>code{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:6px;display:block}.session-workdir .session-workdir__detail>p{color:rgb(var(--ink-dim));margin:8px 0 0;font-size:11px;line-height:1.5;display:block;overflow:visible}.conversation-composer{width:100%;max-width:896px;margin:0 auto}.composer-surface{min-width:0}.map-composer{border:1px solid rgb(var(--line));background:rgb(var(--surface));border-radius:10px;align-items:center;gap:15px;padding:10px 12px;transition:border-color .18s cubic-bezier(.32,.72,0,1),background-color .18s,box-shadow .18s;display:flex}.map-composer:focus-within{border-color:rgb(var(--blue) / .65)}.map-composer-brand{color:rgb(var(--ink));flex-shrink:0}.map-attach{border-radius:50%;place-items:center;width:34px;height:34px;transition:background-color .16s,transform .16s cubic-bezier(.32,.72,0,1);display:grid}.map-attach:hover,.map-attach:focus-visible{background:rgb(var(--line) / .6);outline:2px solid rgb(var(--blue) / .4);outline-offset:2px}.map-attach:disabled{opacity:.55;cursor:default}.map-attach:not(:disabled):active,.map-send:not(:disabled):active{transform:scale(.94)}.map-composer textarea{resize:none;min-width:0;color:rgb(var(--ink));background:0 0;border:0;outline:none;flex:1;max-height:132px;font-size:15px;line-height:28px}.map-composer textarea::placeholder{color:rgb(var(--ink-faint))}.map-send{background:rgb(var(--blue-deep));color:#fff;border-radius:50%;flex-shrink:0;place-items:center;width:33px;height:33px;transition:transform .16s cubic-bezier(.32,.72,0,1),opacity .16s,background-color .16s;display:grid}.map-send:disabled{background:rgb(var(--line) / .7);color:rgb(var(--ink-faint));cursor:default}.map-send:not(:disabled):hover{background:rgb(var(--blue))}.composer-controls{min-height:30px;color:rgb(var(--ink-faint));flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:10px;padding:5px 12px 0;font-size:11px;display:flex}.composer-controls :is(button,select){background:0 0;border-radius:8px;min-height:28px;padding:4px 8px}.composer-controls :is(button,select):hover{background:rgb(var(--panel));color:rgb(var(--ink))}.map-attachment-tray{overscroll-behavior:contain;flex-wrap:wrap;gap:8px;max-height:140px;padding:0 8px 9px;display:flex;overflow-y:auto}.map-attachment-tray>div{flex:200px;max-width:100%;animation:.22s cubic-bezier(.32,.72,0,1) composer-attachment-enter}@keyframes composer-attachment-enter{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}.map-attachment-notice{background:rgb(var(--surface));color:rgb(var(--err));border-radius:10px;max-height:72px;margin-bottom:6px;padding:7px 12px;font-size:12px;overflow-y:auto}.map-composer-caption{white-space:nowrap;text-overflow:ellipsis;text-align:center;color:rgb(var(--ink-faint));min-height:15px;padding-top:5px;font-size:10px;display:block;overflow:hidden}.map-reference-chips{flex-wrap:wrap;gap:6px;padding:0 16px 7px;display:flex}.map-reference-chips>span{border:1px solid rgb(var(--blue) / .25);background:rgb(var(--surface));max-width:100%;color:rgb(var(--blue));border-radius:9px;align-items:center;gap:9px;padding:5px 9px;font-size:11px;display:flex}.map-reference-chips>span>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@media (width<=640px){.map-composer{gap:8px;padding:10px}.map-composer textarea{font-size:16px}}@media (prefers-reduced-motion:reduce){.conversation-composer,.map-composer,.map-send,.map-attach{transition:none;transform:none!important}.map-attachment-tray>div,.composer-surface .argus-mark-eye{animation:none!important}}.route-seg{border:1px solid rgb(var(--line));background:rgb(var(--bg));border-radius:999px;flex-shrink:0;align-items:center;gap:2px;padding:2px;display:inline-flex}.route-seg button,.composer-controls .route-seg button{min-height:0;color:rgb(var(--ink-faint));background:0 0;border:0;border-radius:999px;padding:3px 10px;font-size:12px;line-height:16px;transition:background-color .12s,color .12s}.route-seg button:hover,.composer-controls .route-seg button:hover{color:rgb(var(--ink));background:rgb(var(--line) / .45)}.route-seg button[aria-checked=true],.composer-controls .route-seg button[aria-checked=true]{background:rgb(var(--surface));color:rgb(var(--ink));font-weight:500;box-shadow:0 1px 2px #00000014}.route-seg button:disabled{opacity:.55;cursor:default}.route-seg button:focus-visible{outline:2px solid rgb(var(--blue) / .45);outline-offset:1px}.composer-controls .route-seg,.map-island-dock .route-seg{margin-right:auto}.composer-runtime-details{color:rgb(var(--ink-dim));font-size:11px;position:relative}.composer-runtime-details summary{cursor:pointer}.composer-runtime-details>div{z-index:20;white-space:normal;border:1px solid rgb(var(--line));background:rgb(var(--panel));border-radius:10px;min-width:220px;max-width:min(380px,75vw);padding:10px 12px;line-height:1.6;position:absolute;bottom:calc(100% + 8px);left:0;box-shadow:0 8px 24px #0001}.delivery-header{background:linear-gradient(115deg, rgb(var(--ok) / .08), transparent 70%);flex-shrink:0;padding:20px 24px 12px}.delivery-heading{align-items:center;gap:12px;display:flex}.delivery-mark{width:44px;height:44px;color:rgb(var(--ok));background:rgb(var(--ok) / .12);border-radius:14px;place-items:center;display:grid}.delivery-heading p{letter-spacing:.14em;color:rgb(var(--ink-dim));font-size:10px}.delivery-heading h2{margin-top:2px;font-size:20px;font-weight:650}.delivery-return{border:1px solid rgb(var(--line));white-space:nowrap;border-radius:10px;align-self:flex-start;margin-left:auto;padding:10px 12px;font-size:12px}.delivery-return:hover{background:rgb(var(--surface))}.delivery-task-title{text-overflow:ellipsis;white-space:nowrap;margin-top:12px;font-size:13px;overflow:hidden}.delivery-task-select{background:rgb(var(--panel));border-radius:8px;max-width:100%;margin-top:12px;padding:5px;font-size:13px}.delivery-facts{color:rgb(var(--ink-dim));gap:16px;margin-top:8px;font-size:11px;display:flex}.delivery-facts span{align-items:center;gap:5px;display:flex}.delivery-facts span:first-child{color:rgb(var(--ok))}.delivery-facts span.delivery-review-self{color:rgb(var(--warn))}.delivery-changes{color:rgb(var(--ink-dim));margin:0 0 10px;font-size:12px}.delivery-changes>button{color:rgb(var(--blue));text-underline-offset:3px;text-decoration:underline}.delivery-changes pre{border:1px solid rgb(var(--line));background:rgb(var(--bg));white-space:pre-wrap;word-break:break-word;border-radius:8px;max-height:40vh;margin-top:6px;padding:10px;font:11px/1.5 ui-monospace,monospace;overflow:auto}.delivery-changes pre .add{color:#16803d;background:#16803d14}.delivery-changes pre .del{color:#be123c;background:#be123c14}.delivery-summary{color:rgb(var(--ink-dim));margin-top:8px;font-size:12px}.delivery-summary summary{cursor:pointer;width:fit-content;padding:3px 0}.delivery-summary p{white-space:pre-wrap;max-height:16dvh;margin-top:6px;line-height:1.7;overflow-y:auto}.delivery-files{border-bottom:1px solid rgb(var(--line));flex-shrink:0;gap:8px;padding:8px 24px 12px;display:flex;overflow-x:auto}.delivery-files button{border:1px solid rgb(var(--line));white-space:nowrap;border-radius:10px;align-items:center;gap:8px;padding:10px 12px;font-size:12px;display:flex}.delivery-files button span{text-overflow:ellipsis;max-width:240px;overflow:hidden}.delivery-files button[aria-pressed=true]{border-color:rgb(var(--blue) / .5);background:rgb(var(--blue) / .08);color:rgb(var(--blue))}.delivery-files small{opacity:.8;font-size:10px}@media (width<=640px){.delivery-header{padding:14px 14px 8px}.delivery-heading{gap:9px}.delivery-heading h2{font-size:18px}.delivery-return{padding:10px;font-size:11px}.delivery-files{padding:8px 14px}.delivery-files button{padding:9px 11px}} diff --git a/frontend/web/dist/assets/App-DHmEWeHX.js b/frontend/web/dist/assets/App-DHmEWeHX.js new file mode 100644 index 000000000..b58391574 --- /dev/null +++ b/frontend/web/dist/assets/App-DHmEWeHX.js @@ -0,0 +1,48 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ResearchWorkbenchPanel-BPQjY3tf.js","./rolldown-runtime-hePW80VL.js","./icons-DHjcpj5P.js","./query-dCPZk0Xc.js","./index-Dkv2HM-n.js","./markdown-BGG43fCg.js","./markdown-DvoRHisr.css","./index-CNuZH30Y.css","./AppearanceControls-DpaE5wy6.js","./activity-BmXzrCrJ.js","./sliders-horizontal-BiyUR49M.js","./code-xml-xZvprTy7.js","./useWorkbenchTheme-DMn1yhZa.js","./ResearchWorkbenchPanel-Cc5mx_fm.css","./MapPanel-pOMl9sI3.js","./history-BylQ-TOW.js","./format-CB65te2P.js","./MapPanel-H65d2ArA.css"])))=>i.map(i=>d[i]); +import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y}from"./icons-DHjcpj5P.js";import{S as b,a as x,c as S,n as C,r as w}from"./query-dCPZk0Xc.js";import{i as T}from"./markdown-BGG43fCg.js";import{A as E,B as D,C as O,D as k,E as A,G as j,L as M,M as N,N as P,O as F,P as I,R as ee,S as te,T as L,W as ne,_ as re,a as ie,b as ae,c as oe,d as se,f as ce,g as le,h as ue,i as de,j as fe,k as pe,l as me,m as he,n as ge,o as _e,p as ve,q as ye,r as be,s as xe,t as Se,u as Ce,v as we,w as Te,x as Ee,y as De,z as Oe}from"./index-Dkv2HM-n.js";import{A as ke,C as Ae,D as je,E as R,F as Me,I as Ne,L as z,M as Pe,N as Fe,O as Ie,P as Le,S as Re,T as ze,_ as Be,a as Ve,b as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,j as Ye,k as Xe,l as Ze,m as Qe,n as $e,o as et,p as tt,r as B,s as nt,t as rt,u as it,v as at,w as ot,y as st}from"./AppearanceControls-DpaE5wy6.js";import{a as ct,c as V,i as lt,l as ut,n as dt,o as H,r as ft,s as pt,t as mt}from"./format-CB65te2P.js";import{a as ht,i as gt,n as _t,r as vt,t as yt}from"./useWorkbenchTheme-DMn1yhZa.js";var U=t(y(),1),bt=`local_request_id`,xt=e=>Array.isArray(e)&&e.length>0;function St(e,t,n,r,i=Date.now(),a=!0,o){let s=e.findIndex(e=>e.type===`ui.argus`&&Number(e[bt])===n);if(s<0)return!r.length&&!a?e:[...e,{type:`ui.argus`,agent_layer:`manager`,text:``,ts:i/1e3,event_id:`local-${t}-${n}-argus`,message_id:`local-${n}-argus`,fragment_mode:`snapshot`,steps:r,live:a,...o?{status:o}:{},[bt]:n}];let c=[...e];return c[s]={...c[s],...r.length?{steps:r}:{},live:a,...o?{status:o}:{}},c}function Ct(e,t,n=Date.now(),r=`stopped`){return e.map(e=>{if(e.type!==`ui.argus`||Number(e[bt])!==t||e.live!==!0)return e;let i=Array.isArray(e.steps)?e.steps.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return t.ended_ts||t.status!==`running`?e:{...t,ended_ts:n/1e3,status:r}}):e.steps;return{...e,live:!1,status:r,...i===void 0?{}:{steps:i}}})}function wt(e,t,n,r=Date.now()){return{type:`ui.operator`,agent_layer:`operator`,text:n,ts:r/1e3,event_id:`local-${e}-${t}-operator`,message_id:`local-${t}-operator`,[bt]:t}}function Tt(e,t,n,r,i,a=Date.now(),o=`auto`){let s=r.trim();if(!s)return e;let c=e.findIndex(e=>e.type===`ui.argus`&&Number(e[bt])===n),l=i.endsWith(`-argus`)?`${i.slice(0,-6)}-operator`:``,u=l?e.map(e=>e.type===`ui.operator`&&Number(e[bt])===n?{...e,message_id:l}:e):e,d=u.find(e=>e.type===`ui.operator`&&Number(e[bt])===n),f=d?Math.max(0,a-Number(d.ts??a/1e3)*1e3):0;if(c<0)return[...u,{type:`ui.argus`,agent_layer:`manager`,text:s,ts:a/1e3,event_id:`local-${t}-${n}-argus`,message_id:i||`local-${n}-argus`,fragment_mode:o,response_latency_ms:f,[bt]:n}];let p=u[c],m=[...u];return m[c]={...p,text:O(String(p.text??``),s,o),message_id:i||p.message_id,fragment_mode:o},m}function Et(e,t,n){let r=e.filter(e=>e.type!==`engineer.progress`||e.turn_step!==!0),i=new Map,a=[...r];r.forEach((e,t)=>{let n=String(e.type??``);if(n!==`ui.operator`&&n!==`ui.argus`)return;let r=`${n}\u0000${String(e.text??``)}`;i.set(r,[t,...i.get(r)??[]])});let o=t.map(e=>({type:e.role===`operator`?`ui.operator`:`ui.argus`,agent_layer:e.role===`operator`?`operator`:`manager`,text:e.text,ts:e.ts,message_id:e.message_id||`transcript-${e.ts}-${e.role}`,...e.mission_result===!0?{mission_result:!0}:{},...typeof e.item_id==`string`?{item_id:e.item_id}:{},...typeof e.success==`boolean`?{success:e.success}:{},...typeof e.summary==`string`?{summary:e.summary}:{},...typeof e.delivery_id==`string`?{delivery_id:e.delivery_id}:{},...e.delivery&&typeof e.delivery==`object`?{delivery:e.delivery}:{},...xt(e.steps)?{steps:e.steps}:{}})),s=Array(o.length).fill(!0);for(let e=o.length-1;e>=0;--e){let n=o[e],r=`${String(n.type)}\u0000${String(n.text??``)}`,c=i.get(r)??[],l=t[e].message_id,u=e=>{let t=a[e];return n.item_id&&t.item_id&&n.item_id!==t.item_id?!1:n.mission_result!==!0&&t.mission_result!==!0||!!(l&&t.message_id===l)||!!(!l&&n.delivery_id&&n.delivery_id===t.delivery_id)},d=c.findIndex(e=>u(e)&&!!(l&&a[e].message_id===l));if(d<0&&(d=c.findIndex(u)),d>=0){s[e]=!1;let[t]=c.splice(d,1),r=a[t];if(l&&r.message_id===l){let e={};for(let t of[`mission_result`,`item_id`,`success`])(r[t]==null||r[t]===``)&&n[t]!=null&&(e[t]=n[t]);a[t]={...r,...e}}}}let c=[...o.filter((e,t)=>s[t]),...a],l=Array(c.length).fill(!0),u=new Set,d=n.map(e=>{let t=String(e.message_id??``),n=t?c.findIndex((e,n)=>!u.has(n)&&String(e.message_id??``)===t):-1,r=Number(e.ts??0);if(n<0&&(n=c.findIndex((t,n)=>{if(u.has(n)||t.type!==e.type||t.text!==e.text)return!1;let i=Number(t.ts??0);return Math.abs(i-r)<=5})),n>=0){u.add(n),l[n]=!1;let t=c[n];return{...e,...t.mission_result===!0?{mission_result:!0}:{},...typeof t.item_id==`string`?{item_id:t.item_id}:{},...typeof t.success==`boolean`?{success:t.success}:{},...typeof t.summary==`string`?{summary:t.summary}:{},...typeof t.delivery_id==`string`?{delivery_id:t.delivery_id}:{},...t.delivery&&typeof t.delivery==`object`?{delivery:t.delivery}:{},...xt(t.steps)?{steps:t.steps,live:!1}:{}}}return e});return[...c.filter((e,t)=>l[t]),...d].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0))}function Dt(e,t,n,r,i){let a=le(e,t,120);return{query:a,events:(0,U.useMemo)(()=>e?Et(n,a.data??[],i===e?r:[]):[],[e,n,a.data,r,i]),status:a.isError?`error`:a.isPending?`loading`:`ready`}}var Ot=z(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),kt=z(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),At=z(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),jt=z(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Mt=z(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Nt=z(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Pt=z(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ft=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),It=z(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Lt=z(`Diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Rt=z(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),zt=z(`FilePenLine`,[[`path`,{d:`m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2`,key:`142zxg`}],[`path`,{d:`M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`2t3380`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),Bt=z(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Vt=z(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ht=z(`Layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),W=z(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),G=z(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Ut=z(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),Wt=z(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Gt=z(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),Kt=z(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),qt=z(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Jt=z(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),Yt=z(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Xt=z(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),Zt=z(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),Qt=z(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),$t=z(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),en={"global/agent-team-lead.md":{title:`多智能体团队协作`,summary:`判断何时值得并行工作,按文件与职责拆分协作,并独立审查汇总结果;不替代原有角色与授权。`,originalName:`Agent Team Lead`,source:`argus/builtin_skills/agent-team-lead.md`,sourceSha256:`b490cc96572941fa4a2fe4937bd3e86c9802c132439ae779fcf8e88241ba9521`},"global/curator/argus-curator-role.md":{title:`团队成果整理`,summary:`维护团队候选成果池和比较记录,归纳后续策略;整理者不代替执行者完成工程任务。`,originalName:`Team Curator`,source:`argus/builtin_skills/curator/argus-curator-role.md`,sourceSha256:`3dfd743254a91f88feef76e85683225dc5b510b7f417f6430ef7b975b8eb0f5b`},"global/engineer/minimal-coding-agent.md":{title:`最小且严谨的软件修改`,summary:`用足够小的改动实现、修复或重构软件与界面,保留既有行为,避免无依据的抽象和新增依赖。`,originalName:`极简而严谨的 Coding Agent`,source:`argus/builtin_skills/engineer/minimal-coding-agent.md`,sourceSha256:`aa47c79252eb5086451530ae25aac77ce87bd4315eda1e9defae2af719295cab`},"global/engineer/pdf-chat.md":{title:`分段阅读 PDF`,summary:`按页或章节阅读并核对版本、页码;图片和版式需查看实际页面,回答只依据相关证据。`,originalName:`Progressive PDF Reading`,source:`argus/builtin_skills/engineer/pdf-chat.md`,sourceSha256:`141bd41eb888191aedc391f0df2ba100ab5aee3e7970f9afc21a6f50f4deca5f`},"global/engineer/presentation-master.md":{title:`可编辑演示文稿`,summary:`使用已有 PPT Master 工具制作或修改可编辑演示文稿和原生 PPT 图,经指定解释器运行并核对导出效果;科研绘图路线由科研垂域决定。`,originalName:`Editable Presentations with PPT Master`,source:`argus/builtin_skills/engineer/presentation-master.md`,sourceSha256:`b9f5ed3935b538a18280ac79a504a3b28b432b66efb884e3e06284b4f1729ff3`},"global/engineer/skill-authoring-guide.md":{title:`编写与审阅技能和 Wiki 页面`,summary:`只在证据表明有可复用做法时写技能;先学操作者材料再忠实编辑;Wiki 更新来自一手来源;审阅者按证据真实、无冗余、不倒退、层级正确来判断一次修改。`,originalName:`Writing and Reviewing Skills and Wiki Pages`,source:`argus/builtin_skills/engineer/skill-authoring-guide.md`,sourceSha256:`cf4073da950ef34a359fa3f4b9c77c9d00ebd56bcb79a678efc3e04197ec7e79`},"global/engineer/web-primary-source-evidence.md":{title:`查证一手网络来源`,summary:`为软件、产品、接口和基准等现实信息寻找并保留一手来源,让重要结论能够追溯。`,originalName:`Web Primary-Source Evidence`,source:`argus/builtin_skills/engineer/web-primary-source-evidence.md`,sourceSha256:`632930eb13afc66ebf4742ab6c87fa586edee916c3eeacef25f50215e78f776f`},"global/manager/evidence-based-stage-decision.md":{title:`经理的职责与阶段决定`,summary:`经理是唯一改变阶段的角色;结合规划和评审证据决定继续、推进、返回或结束,部署始终需要操作者批准。`,originalName:`The Manager's role and stage decisions`,source:`argus/builtin_skills/manager/evidence-based-stage-decision.md`,sourceSha256:`d664fa7b6e92045335da59739575326b89e70d38662c1ffdc79774c599e36817`},"global/performance-profile-ground-truth.md":{title:`真实工作负载性能分析`,summary:`用指定环境和代表性输入定位瓶颈,对照未开启剖析的实测结果;不顺带执行未要求的优化。`,originalName:`Performance Profile Ground Truth`,source:`argus/builtin_skills/performance-profile-ground-truth.md`,sourceSha256:`42430420ce8bd31047780e9b08ac5eab366f849eb222805ca05492779095f4d0`},"global/planner/dependency-aware-task-decomposition.md":{title:`规划者的职责与按依赖拆解任务`,summary:`规划者只读只派、不执行,阶段只由经理改变;把目标与已有证据整理成最小、可执行、有真实依赖且能明确验收的任务集合。`,originalName:`The Planner's role and dependency-aware task decomposition`,source:`argus/builtin_skills/planner/dependency-aware-task-decomposition.md`,sourceSha256:`06d5295c6777a64c90a28a5603884e557a72ad5961b19a3f411dc1e83e331886`},"global/project-venv-package-management.md":{title:`项目环境、依赖与运行前核查`,summary:`使用项目自身的环境与锁文件,只安装任务需要的依赖,在承载论断的运行前只核查它真正用到的资源;不修改 Argus 框架自己的运行环境。`,originalName:`Project Environment and Dependencies`,source:`argus/builtin_skills/project-venv-package-management.md`,sourceSha256:`ab8728ad9fff58e8bc4672e5bc2446135f376b55b52392a6104b2eb52e9ed327`},"global/reviewer/argus-reviewer-role.md":{title:`评审者的职责与给执行者的下一步`,summary:`独立判断执行结果是否成立、需要补充或转向,把检查结果提炼成执行者需要的那一个下一步;评审有争议时以带标签的证据而非角色权威定论,不替执行者作完成声明。`,originalName:`The Reviewer's role`,source:`argus/builtin_skills/reviewer/argus-reviewer-role.md`,sourceSha256:`8457a177a4376eab0e4bef7a652e3276ce3b6f9a0ab421fd15bd96eb057cf852`},"global/reviewer/engineer-process-audit.md":{title:`核对执行过程与证据`,summary:`当成果或验证声明存在争议时检查任务相关回执和日志,区分缺少记录与确实未执行。`,originalName:`Engineer Process Audit`,source:`argus/builtin_skills/reviewer/engineer-process-audit.md`,sourceSha256:`b109fb737e747b863244c9b03e1b23ff82acf724ef420bc547ad457c1cf65ac5`},"global/reviewer/web-source-evidence-audit.md":{title:`审查网络证据是否支撑结论`,summary:`核对实际取得的来源与重要现实信息声明是否一致,不把有链接等同于已经证实。`,originalName:`Web Source-Evidence Audit`,source:`argus/builtin_skills/reviewer/web-source-evidence-audit.md`,sourceSha256:`35dbb6288199c52d4ecfd4e241a54346f5ef8af985f50bf24121e687ea9dc22e`},"global/stale-blocker-verification-probe.md":{title:`核实旧阻塞与易变的外部事实`,summary:`用最小且已授权的探针判断记录中的阻塞是否仍然存在;只在决策依赖时核实外部事实,把身份、许可与执行当作三个不同的问题。`,originalName:`Verify a Recorded Blocker or a Changing External Fact`,source:`argus/builtin_skills/stale-blocker-verification-probe.md`,sourceSha256:`3eb5f473bbf1cf482a840e7af3c84bc939a6710b60f84415ad94e6932a9122b3`},"vertical/argus_maintenance/engineer/argus-maintenance-execution.md":{title:`Argus 小范围维护`,summary:`按核心与领域职责检查和简化框架,用小而可复用的修改解决明确问题。`,originalName:`Argus Maintenance`,source:`argus/verticals/argus_maintenance/skills/engineer/argus-maintenance-execution.md`,sourceSha256:`138f9b7e2503c5ce0307e575fa0555a62e1820c559e105d60cc6e31ab9991c0f`},"vertical/argus_maintenance/reviewer/argus-maintenance-review.md":{title:`Argus 维护变更评审`,summary:`核对补丁是否真正简化、复用和解耦,并用验证结果证明行为,而不是只看代码缩短。`,originalName:`Argus Maintenance Review`,source:`argus/verticals/argus_maintenance/skills/reviewer/argus-maintenance-review.md`,sourceSha256:`d6ad0f8eb29d5ca3d5a66fbc7df34de86e42229f15e8e2e22ce601a8ae08c4f8`},"vertical/chemistry/engineer/batteries/battery-identity-and-data-normalization.md":{title:`电池对象与测试数据对齐`,summary:`在循环分析前统一电芯、电极、电解液、测试协议和时间序列身份;不用于分子计算或一般光谱分析。`,originalName:`Battery Cell Identity and Electrochemical Data Normalization`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-identity-and-data-normalization.md`,sourceSha256:`d1cfc1cb94cf4e4828fcd2b75fb0f1dc57181208f2fad1f19c343a9d169462e6`},"vertical/chemistry/engineer/batteries/battery-model-validation.md":{title:`电池模型与退化解释验证`,summary:`用防止数据泄漏的实测电芯数据验证预测和退化解释,明确模型边界;不把预测当作实测。`,originalName:`Battery Model Boundary and Degradation Validation`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-model-validation.md`,sourceSha256:`fe4ec1ec78ec21dd0d568b71276c2f85e13b6216d5a7770f5f75d09baabc6d27`},"vertical/chemistry/engineer/batteries/cycling-and-degradation-analysis.md":{title:`电池循环与退化分析`,summary:`分析循环、倍率、阻抗和退化轨迹,保留电芯与协议对照,并避免评估数据泄漏。`,originalName:`Battery Cycling and Degradation Analysis Workflow`,source:`argus/domains/chemistry/skills/engineer/batteries/cycling-and-degradation-analysis.md`,sourceSha256:`3e0870b82fbc40463f81ca8eb1e84576c9fe1ae5fe501da6d2b274535fd16d2e`},"vertical/chemistry/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md":{title:`生化结合与功能实验分析`,summary:`分析亲和力、动力学、抑制和功能证据,核对构建体、辅因子、状态与实验对照;对接结果不能单独证明活性。`,originalName:`Biochemical Binding, Kinetics, and Functional Assay Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md`,sourceSha256:`12d235a655a1b6b6022a84a5c36e3c291df6227cb40bd2dc78f19012deff62e5`},"vertical/chemistry/engineer/biochemistry/biochemistry-structural-computational-evidence.md":{title:`生化结构与模拟的证据边界`,summary:`把结构、分子对接、动力学和突变结果作为待验证假设,结合真实实验边界解释,不直接宣称亲和力成立。`,originalName:`Biochemistry Structural, Docking, and MD Evidence Boundary Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-structural-computational-evidence.md`,sourceSha256:`47283774a89fa87050fd35df791c961dce37588ec9c92c9d4e357d59a9f14d6c`},"vertical/chemistry/engineer/biochemistry/biochemistry-system-and-assay-normalization.md":{title:`生化体系与实验对象对齐`,summary:`统一序列、构建体、分子状态、配体、辅因子、突变、结构和实验身份,再开展比较。`,originalName:`Biochemistry and Chemical Biology System Identity Normalization`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-system-and-assay-normalization.md`,sourceSha256:`9b7d80ae04064e9a1b5465dc1fee60f5511491694aaa20e423ae92779ad12ee5`},"vertical/chemistry/engineer/characterization/characterization-data-and-sample-normalization.md":{title:`表征样品与原始数据对齐`,summary:`保留衍射、光谱、质谱、核磁和显微原始数据及仪器信息;不把不同测试方式统一成简单拟峰。`,originalName:`Characterization Sample, Instrument Data, and Metadata Normalization`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-data-and-sample-normalization.md`,sourceSha256:`dad27a33c24c37fdc17a7f7386478246e7847edde9cac4cc2939590ab3e07b9c`},"vertical/chemistry/engineer/characterization/characterization-validation-and-integration.md":{title:`多种表征证据交叉验证`,summary:`综合不同仪器证据时保留各自适用范围和限制,避免跨测试方式作过强推断。`,originalName:`Characterization Validation and Multimodal Evidence Integration`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-validation-and-integration.md`,sourceSha256:`9671988085d6a0127a4739300c9c851e904016f8f17c31fafb676303b7d736c1`},"vertical/chemistry/engineer/characterization/modality-specific-interpretation-workflow.md":{title:`按测试方式解释表征结果`,summary:`依据衍射、光谱、质谱、核磁或显微的具体机制选择对照和模型,不使用一套解释套用全部数据。`,originalName:`Modality-Specific Chemical Characterization Interpretation Workflow`,source:`argus/domains/chemistry/skills/engineer/characterization/modality-specific-interpretation-workflow.md`,sourceSha256:`c09d9f9710e8ee7a72ff7cfd0f04ec741ea792a61a8b8abf56c038c26b126e46`},"vertical/chemistry/engineer/chemistry-execution.md":{title:`化学研究执行指南`,summary:`按任务选择领域流程,核实实际工具能力,保留一手证据并验证科学结论;实体实验仍需明确授权。`,originalName:`Chemistry Research Execution`,source:`argus/domains/chemistry/skills/engineer/chemistry-execution.md`,sourceSha256:`d6ad8b3ae0254319e31de1ca91a7c75fd06c70795d3948b38b8d35b895e69d59`},"vertical/chemistry/engineer/chemistry-toolkit.md":{title:`化学方法与工具导航`,summary:`先选择科学问题对应的方法,再查看具体工具说明;这是导航目录,不是自动安装或执行脚本。`,originalName:`Chemistry Skill and Capability Router`,source:`argus/domains/chemistry/skills/engineer/chemistry-toolkit.md`,sourceSha256:`14840bc5603ce237373ab4832f7bf747c24e6d4ef524eb2ccd112a8bb9eaea70`},"vertical/chemistry/engineer/computational_chemistry/computational-identity-normalization.md":{title:`计算化学对象与输入对齐`,summary:`在量子化学、力场、分子动力学或自由能计算前,统一分子或周期体系的输入与状态。`,originalName:`Computational Chemistry Identity and Input Normalization`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-identity-normalization.md`,sourceSha256:`fd9bebbdc28731a9eeab536279466e3b97c289a49db515f509c713f4b3f0df7b`},"vertical/chemistry/engineer/computational_chemistry/computational-validation-and-interpretation.md":{title:`计算收敛性与结论边界`,summary:`验证数值收敛、模型敏感性和适用范围,区分计算预测与实验测量,不外推为生物活性证明。`,originalName:`Computational Chemistry Convergence and Interpretation Validation`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-validation-and-interpretation.md`,sourceSha256:`ed1bffff26a5cb22ff61c60dcbf3464cbcff0f15200b9d604436bcd6243ab3f7`},"vertical/chemistry/engineer/computational_chemistry/electronic-structure-simulation-workflow.md":{title:`可复现电子结构与分子模拟`,summary:`组织分子或周期体系计算,分别检查方法选择和数值收敛,保留可复现的输入与输出。`,originalName:`Reproducible Electronic-Structure and Molecular Simulation Workflow`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/electronic-structure-simulation-workflow.md`,sourceSha256:`13c5d42ae2f417c7f16665e33f3660fad9f76163be2a08401edd57662ab6f22c`},"vertical/chemistry/engineer/crystallography/cif-and-structure-validation.md":{title:`CIF 与晶体结构检查`,summary:`核对格式、对称性、组成、几何、占位、位移参数和精修证据;不代替从头解结构。`,originalName:`CIF and Crystal Structure Validation`,source:`argus/domains/chemistry/skills/engineer/crystallography/cif-and-structure-validation.md`,sourceSha256:`b49527c827b69b5a37543059faf997fa8d0c9c3f60ed2c0a0e6807ddf5b0e802`},"vertical/chemistry/engineer/crystallography/diffraction-and-crystal-identity.md":{title:`衍射数据与晶体对象对齐`,summary:`核对单晶或粉末衍射的波长、几何、晶胞、对称性、物相及 CIF 来源。`,originalName:`Diffraction and Crystal Structure Identity`,source:`argus/domains/chemistry/skills/engineer/crystallography/diffraction-and-crystal-identity.md`,sourceSha256:`97367c0fad622c1d2ae19868b12a8de571bbc99c282c8b5eec4c4b97ed3615ed`},"vertical/chemistry/engineer/crystallography/structure-solution-and-refinement.md":{title:`晶体结构求解与精修`,summary:`结合数据处理、对称性检验、化学约束、残差和替代解释完成结构求解及精修。`,originalName:`Crystal Structure Solution and Refinement Workflow`,source:`argus/domains/chemistry/skills/engineer/crystallography/structure-solution-and-refinement.md`,sourceSha256:`8f5d913cf3bfc6c421f2d137ece735eba96e3b6840da63d6c4d40c22bc518e08`},"vertical/chemistry/engineer/foundations/chemical-identity-and-representation.md":{title:`化学对象与表达方式核实`,summary:`先核对分子、反应、材料、晶体、样品、序列或配方身份;这是跨领域基础,不替代专门流程。`,originalName:`Chemical Identity and Representation`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-identity-and-representation.md`,sourceSha256:`b1b0f0148ae94a1ad6ad60b6383cc8f6b1596b387d885ca896148486004ac392`},"vertical/chemistry/engineer/foundations/chemical-risk-and-authorization.md":{title:`化学风险与授权边界`,summary:`识别化学、生物、热、电、压力、辐射和仪器风险;文档建议不等于允许开展实体操作。`,originalName:`Chemical Risk and Authorization Boundary`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-risk-and-authorization.md`,sourceSha256:`2d6cb4a8421bb62bbde199f7aa131f5f678019ffbeed231f0676e9095f176b5e`},"vertical/chemistry/engineer/foundations/chemistry-workflow-output-contract.md":{title:`化学任务输入与交付约定`,summary:`明确输入、决策、能力核实、证据、验证方式、输出与停止条件,用于缺少更具体流程的任务。`,originalName:`Chemistry Workflow and Output Contract`,source:`argus/domains/chemistry/skills/engineer/foundations/chemistry-workflow-output-contract.md`,sourceSha256:`1b52c242611bb39cbbe929dc2bee8072e501ab56b23907df50a51c5c0b4f15fd`},"vertical/chemistry/engineer/foundations/computational-reproducibility.md":{title:`化学计算与分析的可复现性`,summary:`保留计算、模拟、数据处理和模型训练的输入、环境、数值设置、诊断与主要输出。`,originalName:`Chemistry Computational Reproducibility`,source:`argus/domains/chemistry/skills/engineer/foundations/computational-reproducibility.md`,sourceSha256:`d92b4a7b6e65c92138ef785a04a47f1fae6ab4ef2e6c4af111264cdc081a0bd8`},"vertical/chemistry/engineer/foundations/dataset-curation-and-leakage.md":{title:`化学数据整理与泄漏控制`,summary:`核对数据来源、去重、分组、标签和划分方式,避免分子、反应或样品间的信息泄漏。`,originalName:`Chemistry Dataset Curation and Leakage Control`,source:`argus/domains/chemistry/skills/engineer/foundations/dataset-curation-and-leakage.md`,sourceSha256:`ceeaf0a929c67df26cc91651721d943749c7e2c3bad6c7978cb78fa085bf948b`},"vertical/chemistry/engineer/foundations/evidence-provenance-and-claim-levels.md":{title:`化学证据来源与结论强度`,summary:`区分检索、整理、预测、计算、模拟、测量与推断,让结论不超出证据能支持的程度。`,originalName:`Chemistry Evidence Provenance and Claim Levels`,source:`argus/domains/chemistry/skills/engineer/foundations/evidence-provenance-and-claim-levels.md`,sourceSha256:`c8b6454e673aae3298d4089c1603b9edfe63c4be7f5f3ad8fd6f24ef2b2910f5`},"vertical/chemistry/engineer/foundations/failure-diagnosis-and-negative-results.md":{title:`化学任务失败与负结果分析`,summary:`保留失败证据,区分实现缺陷、资源问题和科学假设被否定,不把负结果隐去。`,originalName:`Chemistry Failure Diagnosis and Negative Results`,source:`argus/domains/chemistry/skills/engineer/foundations/failure-diagnosis-and-negative-results.md`,sourceSha256:`068cf8400d770fb6c97edbd26d6788adb1acc0e7d6ea00e3b14949c7a9a64a40`},"vertical/chemistry/engineer/foundations/uncertainty-and-applicability-domain.md":{title:`化学结果的不确定性与适用范围`,summary:`判断模型、计算、测量或文献结论能否用于当前实际体系,并量化或说明不确定性。`,originalName:`Chemistry Uncertainty and Applicability Domain`,source:`argus/domains/chemistry/skills/engineer/foundations/uncertainty-and-applicability-domain.md`,sourceSha256:`d552b6cad9e2a942e44a1a4c98647236488186458d3f2cd4bdd395a34c23d8ae`},"vertical/chemistry/engineer/foundations/units-conditions-and-normalization.md":{title:`化学单位与条件规范化`,summary:`比较不同来源前明确单位、计量基础、环境条件、样品归一方式和报告约定。`,originalName:`Chemical Units Conditions and Normalization`,source:`argus/domains/chemistry/skills/engineer/foundations/units-conditions-and-normalization.md`,sourceSha256:`540d6c4a3389900be51e3e9a7bdcf7f16169bb72246d53cbb1fbac247b527cde`},"vertical/chemistry/engineer/materials_science/materials-discovery-and-optimization.md":{title:`材料发现与优化研究`,summary:`限定设计空间、性质目标、基线与不确定性,组织可验证的筛选或工艺优化,不替代晶体精修。`,originalName:`Materials Discovery and Optimization Workflow`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-discovery-and-optimization.md`,sourceSha256:`02d2aeacb74302eb2853345772f5096cce5b26db15ab5d229a210ccfabe04cbd`},"vertical/chemistry/engineer/materials_science/materials-identity-processing-and-property-data.md":{title:`材料组成、工艺与性能数据`,summary:`统一组成、物相、工艺历史、样品形态、微结构和测试条件,建立可比的性能记录。`,originalName:`Materials Identity Processing and Property Data`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-identity-processing-and-property-data.md`,sourceSha256:`ec0ac9c5a4b62eb9d027a97f9c78cc9ed986776e48f9f3bbf94f015a8d689521`},"vertical/chemistry/engineer/materials_science/processing-structure-property-validation.md":{title:`工艺—结构—性能关系验证`,summary:`用可比样品、对照和不确定性检验材料关系声明,保留机理解释的适用边界。`,originalName:`Materials Processing Structure Property Validation`,source:`argus/domains/chemistry/skills/engineer/materials_science/processing-structure-property-validation.md`,sourceSha256:`7c556e48b0b97de122d0f342839c92ece5e33f36c1aa3f7efbcc6fbc319ea06c`},"vertical/chemistry/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md":{title:`MOF 构筑单元与拓扑识别`,summary:`从来源结构核实节点、连接体、连通性、穿插、缺陷、客体和网络拓扑,不以普通 CIF 检查代替。`,originalName:`MOF Framework Identity Node Linker and Topology`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md`,sourceSha256:`7a6490bd8dad40deeb548f03541673b91df2bd9bddbe3e9c8cf58d73b3ee31b8`},"vertical/chemistry/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md":{title:`MOF 数据、预测与结构生成`,summary:`组织拓扑相关去重、泄漏控制、性质预测和生成结构的分阶段验证;生成不等于可合成。`,originalName:`MOF Datasets Prediction and Structure Generation`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md`,sourceSha256:`8f1d023caf19aeb5801036cc58e2531cd8d39bb398008a4b614c654b3073ab51`},"vertical/chemistry/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md":{title:`MOF 孔隙、吸附与性质分析`,summary:`关联原始等温线、活化和样品状态,检查孔隙、吸附、输运模型及不确定性。`,originalName:`MOF Porosity Adsorption and Structure Property Workflow`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md`,sourceSha256:`98088eef9fa108d0f0aa8fab9f746315414cc64edbcfab0d0da8accd4ab83b0b`},"vertical/chemistry/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md":{title:`MOF 合成与后处理证据`,summary:`整理合成、活化、溶剂交换、缺陷调节和后修饰的证据,核对样品关联与表征要求。`,originalName:`MOF Synthesis Activation and Postsynthetic Evidence`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md`,sourceSha256:`b65377f7d995a638f721e8dea34a99807e97c948ec274bbc3f9cc1d35ccf1f5a`},"vertical/chemistry/engineer/organic_synthesis/reaction-identity-and-records.md":{title:`有机反应对象与记录对齐`,summary:`核对反应物、映射、计量、立体化学、条件、后处理和收率,用于路线或数据整理。`,originalName:`Organic Reaction Identity and Records`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/reaction-identity-and-records.md`,sourceSha256:`02221beebf4e39d9bd0e5c4090de61aba6596ceb48fb3a5f29b3e54466999d87`},"vertical/chemistry/engineer/organic_synthesis/retrosynthesis-and-route-design.md":{title:`有机逆合成与路线设计`,summary:`结合目标、断键、已有先例、选择性、供应和安全设计候选路线;候选仍需证据验证。`,originalName:`Organic Retrosynthesis and Route Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/retrosynthesis-and-route-design.md`,sourceSha256:`6ee1e514bf05cc052de12ee39497c783d1dd6ca9549335cbe62e7f2106ec8de4`},"vertical/chemistry/engineer/organic_synthesis/route-validation-and-experiment-design.md":{title:`有机路线验证与实验设计`,summary:`把候选路线转化为有对照、分析读数和停止条件的验证计划;不授权自动开展实体实验。`,originalName:`Organic Route Validation and Experiment Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/route-validation-and-experiment-design.md`,sourceSha256:`9a543fdca5cc4fa3ed0cc9cef2395af55ffaa35758b3c36895a2309d1d09dc80`},"vertical/chemistry/engineer/tools/aizynthfinder.md":{title:`AiZynthFinder 逆合成候选`,summary:`在明确模型、原料库、配置和预算后使用本地搜索生成候选路线;搜索结果不是可行性证明。`,originalName:`AiZynthFinder Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/aizynthfinder.md`,sourceSha256:`fd406198b2a436d954aefb95c1062f945e08cf98806ca7ceaba5d402c006f4dc`},"vertical/chemistry/engineer/tools/askcos.md":{title:`ASKCOS 路线与反应预测`,summary:`仅使用已获授权的部署,记录接口、模型、数据库、预算与结果来源;不假定已有服务权限。`,originalName:`ASKCOS Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/askcos.md`,sourceSha256:`31689603c8f5b80f2ed94a25ef05148edf311287e64bf336fc98fea5aeeaf486`},"vertical/chemistry/engineer/tools/chembl.md":{title:`ChEMBL 生物活性资料检索`,summary:`检索分子、靶点、实验和活性记录,核对版本、单位及来源;已有记录不证明新体系的活性。`,originalName:`ChEMBL Bioactivity Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/chembl.md`,sourceSha256:`9b33111794504afb064302785f66bd7fcbccac9e855d83df0eb84297f00b4863`},"vertical/chemistry/engineer/tools/chemcrow.md":{title:`ChemCrow 工具集成参考`,summary:`研究公开工具集成方式及其依赖、安全和证据要求;架构借鉴不等于复现论文结果。`,originalName:`ChemCrow Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemcrow.md`,sourceSha256:`877388249df2ed635a78ae2edb68b1d25fa2cd5305eec4e09c289fb0f1bd1ba3`},"vertical/chemistry/engineer/tools/chemos.md":{title:`ChemOS 实验室编排参考`,summary:`仅在设备服务、设施归属、安全联锁、数据约定和恢复机制已具备时评估编排能力。`,originalName:`ChemOS Orchestration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemos.md`,sourceSha256:`2dbb97df4b7107f08f00bbdd88fef587eda0b6d3d04e5850b619550e7a9c4cc3`},"vertical/chemistry/engineer/tools/coscientist.md":{title:`Coscientist 系统集成参考`,summary:`依据确切公开实现借鉴组件和架构,保留授权边界;不宣称得到可直接运行的自主实验室。`,originalName:`Coscientist Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/coscientist.md`,sourceSha256:`8a47d850deb1d7dfb2ddeecbea4cba38ceecec129a6e2b2d8ad403e9bbff5252`},"vertical/chemistry/engineer/tools/deepchem.md":{title:`DeepChem 分子机器学习`,summary:`先明确目标、对象、分组、泄漏控制、基线和适用范围,再选择数据、特征、模型与评估工具。`,originalName:`DeepChem Molecular Machine Learning`,source:`argus/domains/chemistry/skills/engineer/tools/deepchem.md`,sourceSha256:`27a9bd06792446cfeeafb63db293fcd8305d59ca3da164810e1267c13e6dcdeb`},"vertical/chemistry/engineer/tools/guacamol.md":{title:`GuacaMol 分子设计基准`,summary:`按确定任务、评分、参考数据、预算和有效性检查评估方法;结论仅限对应基准。`,originalName:`GuacaMol Molecular Design Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/guacamol.md`,sourceSha256:`f626a4b92ec2b081620f5da146f6baebe3b5cc44df824e77fc2becd0b3e87e7e`},"vertical/chemistry/engineer/tools/olympus.md":{title:`Olympus 反应优化基准`,summary:`使用规划器和模拟曲面作有对照的优化研究,明确参数空间、噪声和预算;模拟不等于实体实验。`,originalName:`Olympus Reaction Optimization`,source:`argus/domains/chemistry/skills/engineer/tools/olympus.md`,sourceSha256:`160f357db2ec4527b7368d2b41a2ab43d2ab6b76130e8a27b2a035e0531c4be2`},"vertical/chemistry/engineer/tools/openbabel.md":{title:`Open Babel 化学格式转换`,summary:`转换结构格式并核对解析、氢原子、坐标和互操作性,保留原始身份及转换来源。`,originalName:`Open Babel Structure Conversion`,source:`argus/domains/chemistry/skills/engineer/tools/openbabel.md`,sourceSha256:`6eca4f250101ad817f624a76ca6c22193c73fd67a8d13d76a39bcf07d848fd75`},"vertical/chemistry/engineer/tools/orca.md":{title:`ORCA 量子化学计算`,summary:`在用户提供并授权的安装上计算,记录版本、分子状态、方法、基组、数值设置和主要输出。`,originalName:`ORCA Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/orca.md`,sourceSha256:`683637ad2fb781da58295e67229859794085fb01fcaaa43c10e11e13c8a91085`},"vertical/chemistry/engineer/tools/ord.md":{title:`开放反应数据库读写规范`,summary:`按数据库结构验证反应角色、数量、条件、结果与来源;结构有效不等于实验可复现。`,originalName:`Open Reaction Database I/O`,source:`argus/domains/chemistry/skills/engineer/tools/ord.md`,sourceSha256:`eb81cbde5711e04c578cc89a5b233a3de109c5b68b7322adeefd0996df21b8da`},"vertical/chemistry/engineer/tools/psi4.md":{title:`Psi4 量子化学计算`,summary:`明确分子状态、方法、基组、选项、收敛和单位,保留计算输出来源。`,originalName:`Psi4 Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/psi4.md`,sourceSha256:`2d8bf9817a90f90fe2407d8e4d71e6ffbf431f64207f61b8c2fca8acda199a69`},"vertical/chemistry/engineer/tools/pubchem.md":{title:`PubChem 公共资料检索`,summary:`通过核实的标识和带日期的查询取得公共化合物、性质及安全记录,保留原始响应与来源边界。`,originalName:`PubChem PUG REST Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/pubchem.md`,sourceSha256:`9aa66ea316f8180a29884f78b1ae927adf55f727476fa0529c01e7300161c89e`},"vertical/chemistry/engineer/tools/pyscf.md":{title:`PySCF 电子结构计算`,summary:`先确定电荷、自旋、几何、方法、基组、边界和收敛要求,再组织分子或周期体系计算。`,originalName:`PySCF Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/pyscf.md`,sourceSha256:`9ccb368195807ed7390cf2397506d004f849ccd1c0e1d51532b31e42e579dbc2`},"vertical/chemistry/engineer/tools/rdkit.md":{title:`RDKit 分子数据处理`,summary:`用于解析、规范化、立体化学、子结构、描述符、指纹与构象等处理;不直接证明化学身份或可行性。`,originalName:`RDKit Molecular Integrity`,source:`argus/domains/chemistry/skills/engineer/tools/rdkit.md`,sourceSha256:`b9330a5a8c90fb31bf3b551555d4f439cca90f9ecd45506734ce5051628ee074`},"vertical/chemistry/engineer/tools/tdc.md":{title:`TDC 药物研究数据基准`,summary:`使用明确任务、版本、许可、划分和评估器开展比较,核对污染与证据边界。`,originalName:`Therapeutics Data Commons Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/tdc.md`,sourceSha256:`a1aaed9bff60b1df25ccc8a9846ebcd30784c1f814cb20633e8a5ef57e11decb`},"vertical/chemistry/engineer/workflows/chemistry-playground.md":{title:`受限化学假设试探`,summary:`仅对明确提出的候选问题开展有边界的计算优先试探,保留问题、结果和负证据,并经过评审。`,originalName:`Chemistry Playground Bounded Hypothesis Probe`,source:`argus/domains/chemistry/skills/engineer/workflows/chemistry-playground.md`,sourceSha256:`72326a42543600e3fffedf0562c171466cc25b433cb8c05913e9fcfac3eb2d12`},"vertical/chemistry/manager/chemistry-manager.md":{title:`化学任务协调与分流`,summary:`为科学问题选择专门技能组合,保留原研究阶段、证据强度与授权边界。`,originalName:`Chemistry Manager Context`,source:`argus/domains/chemistry/skills/manager/chemistry-manager.md`,sourceSha256:`ecc7e16be351188d3c6ae75aa0e55c4b3978f1916e67c45754766cb63085f336`},"vertical/chemistry/planner/chemistry-planning.md":{title:`化学研究规划`,summary:`选择最贴合任务的流程,保持证据和安全要求;未完成时才安排具有科学判别力的后续工作。`,originalName:`Chemistry Research Planning`,source:`argus/domains/chemistry/skills/planner/chemistry-planning.md`,sourceSha256:`c9258fa062f3853d7a04950d0e0045b10be65c41c11248d6fe5c981e0ed02e02`},"vertical/chemistry/reviewer/battery-review.md":{title:`电池与电化学证据评审`,summary:`独立核对电芯身份、协议可比性、单位、循环退化证据和防泄漏模型评估。`,originalName:`Battery and Electrochemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/battery-review.md`,sourceSha256:`e0aa8763587e38281b5c2c5b6f7c92b3e07264b1cee076539751de8971d87725`},"vertical/chemistry/reviewer/biochemistry-review.md":{title:`生化与化学生物学评审`,summary:`检查构建体、结构、实验、动力学、模拟和功能声明,保留各自对照与结论边界。`,originalName:`Biochemistry and Chemical Biology Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/biochemistry-review.md`,sourceSha256:`68f2cc57f10d6c9bf30c41c249ebe7fc192b8ac4b763cb6ff40d9a41377135d0`},"vertical/chemistry/reviewer/characterization-review.md":{title:`化学表征证据评审`,summary:`独立核对原始仪器数据、校准、对照、归属和多模态证据,避免用通用解释越过测试边界。`,originalName:`Chemical Characterization Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/characterization-review.md`,sourceSha256:`3ba8858ac408729e78fa27a9338cd6eb435bd64d38da803d837aaec111ef8d67`},"vertical/chemistry/reviewer/chemistry-playground-review.md":{title:`化学试探结果评审`,summary:`检查受限问题与结果、证据和状态历史,防止未经确认的探索被当作正式科学结论。`,originalName:`Chemistry Playground Promotion Gate`,source:`argus/domains/chemistry/skills/reviewer/chemistry-playground-review.md`,sourceSha256:`309f1ff685c93c46c47239d9db1a3b85c41c6c384e986532e774ed3795e8d3c0`},"vertical/chemistry/reviewer/chemistry-review.md":{title:`化学研究综合评审`,summary:`按问题转交专门评审方法,核对对象、原始证据、对照、可复现性、不确定性和安全要求。`,originalName:`Chemistry Research Review`,source:`argus/domains/chemistry/skills/reviewer/chemistry-review.md`,sourceSha256:`bc2587f915788c94f8de55a0f2947a18e7bd368cccf1b400d1479e1681c64cf7`},"vertical/chemistry/reviewer/computational-review.md":{title:`计算化学证据评审`,summary:`审查输入身份、数值收敛、方法有效性,以及计算结果和测量结果之间的界线。`,originalName:`Computational Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/computational-review.md`,sourceSha256:`cab134d61ce5d45bf0240d2219eca03002e7b6315c4abf3738c2740229353e68`},"vertical/chemistry/reviewer/crystallography-review.md":{title:`晶体学证据评审`,summary:`独立检查衍射、对称性、精修、CIF、物相声明和结构不确定性,不替代其他领域评审。`,originalName:`Crystallography Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/crystallography-review.md`,sourceSha256:`034223d76528f09aede5febdb7fff1c848819f82564a8be7acf23ebc1a25d369`},"vertical/chemistry/reviewer/materials-science-review.md":{title:`材料科学证据评审`,summary:`核对非 MOF 材料的身份、工艺、性质和发现声明,不把结论跨用到晶体精修或电池循环。`,originalName:`Materials Science Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/materials-science-review.md`,sourceSha256:`ac639340d34bc5dae734e9f9841e91762cb31ec42c73c5a108dc69b25c2b76ba`},"vertical/chemistry/reviewer/mof-reticular-chemistry-review.md":{title:`MOF 与网状化学证据评审`,summary:`核对构筑单元、拓扑、合成活化、孔隙吸附、后修饰、数据与生成结构的证据。`,originalName:`MOF and Reticular Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/mof-reticular-chemistry-review.md`,sourceSha256:`d095ca81ab168c658696b20de0e149647cdbfcffe545cff73e3ed9ccaeb37dcf`},"vertical/chemistry/reviewer/organic-synthesis-review.md":{title:`有机合成与逆合成评审`,summary:`独立核对反应记录、路线先例、选择性、分析证据、安全和实际可行性声明。`,originalName:`Organic Synthesis and Retrosynthesis Review`,source:`argus/domains/chemistry/skills/reviewer/organic-synthesis-review.md`,sourceSha256:`0ce7fdeee239a78b9d74f7e64dbd55b38d99b9e88bf141399ec999d30f519ad0`},"vertical/chemistry/scientist/chemistry-adaptation.md":{title:`根据证据改进化学方法`,summary:`只有证据显示现有方法在对象、能力、验证或安全等机制层面存在缺口时,才调整可复用流程。`,originalName:`Chemistry Skill Adaptation`,source:`argus/domains/chemistry/skills/scientist/chemistry-adaptation.md`,sourceSha256:`d231961e4c85bee737df313c376e046dba50ed5a375460a924176db507f8ee9a`},"vertical/chemistry/scientist/chemistry-distillation.md":{title:`沉淀可复用化学流程`,summary:`在技能匹配缺失后归纳带范围、证据、验证和停止条件的方法,而不是保存目标答案或工具教程。`,originalName:`Chemistry Skill Distillation`,source:`argus/domains/chemistry/skills/scientist/chemistry-distillation.md`,sourceSha256:`1f7c9b2cddae0e19332d6e38edbac2671026d04e5ca0f3203f3d777e5e51d010`},"vertical/kernel_engineering/engineer/kernel-benchmark-measurement-integrity.md":{title:`GPU 算子工程:先算屋顶线,隔离测量`,summary:`先用屋顶线定瓶颈再改机制而非参数;一次干净的隔离运行足以筛选想法,要主张或保留的提升必须在官方条件下测量;审阅只看正确性与基准证据。`,originalName:`Kernel Engineering: Roofline First, Measure in Isolation`,source:`argus/verticals/kernel_engineering/skills/engineer/kernel-benchmark-measurement-integrity.md`,sourceSha256:`b6bbe44b147dfea2dd68810db53571a9fae5db238c2bcde24d51c79756bf1785`},"vertical/learning/learning-curation.md":{title:`学习任务的整理与审阅`,summary:`把操作者材料变成有证据锚点的项目 Skill/Wiki 修改或诚实的空操作,说明 CHANGE_PLAN.json 的约定以及审阅者如何判断修改是否忠实、无冗余、不倒退、层级正确。`,originalName:`Learning Curation`,source:`argus/verticals/learning/skills/learning-curation.md`,sourceSha256:`71490b8d95eecb97a88a18e8bc4dd0a1aa163d7c0f82a02114440aae1f5f6999`},"vertical/math/engineer/math-research-execution.md":{title:`数学研究执行`,summary:`忠实保留命题与范围,诚实区分结果类别;需要 Lean 证据时实际编译,不虚构证明。`,originalName:`Math Research Execution`,source:`argus/verticals/math/skills/engineer/math-research-execution.md`,sourceSha256:`ddcf8321ce873130c1de3e71b78d816115182813e8a6dfdd4bc89d0fe9629736`},"vertical/math/manager/math-research-manager.md":{title:`数学研究任务协调`,summary:`在通用协调流程中保持研究目标、范围、求解和评审职责,不另造一套权限体系。`,originalName:`Math Research Manager Context`,source:`argus/verticals/math/skills/manager/math-research-manager.md`,sourceSha256:`e228b24cd82e6dee678458b5e32c4e1fc6092151b06c7eee198b158bdd1a1b95`},"vertical/math/planner/math-research-planning.md":{title:`数学研究规划`,summary:`围绕范围界定、求解和评审安排动态任务,保持原有角色与生命周期规则。`,originalName:`Math Research Planning`,source:`argus/verticals/math/skills/planner/math-research-planning.md`,sourceSha256:`e3320bf8a0b986eae0251ce1004962659ab2a9505a2cc73da63c33b94d2799f4`},"vertical/math/reviewer/math-research-review.md":{title:`数学研究独立评审`,summary:`检查正确性、新意、意义、命题忠实性和真实形式化证据,不以叙述代替证明。`,originalName:`Math Research Review`,source:`argus/verticals/math/skills/reviewer/math-research-review.md`,sourceSha256:`21b7e0f172bbb695ae9950c0e9dd1cdac60ae6aa21df0962a88a1b06ba505251`},"vertical/math/scientist/math-research-adaptation.md":{title:`改进数学研究方法`,summary:`在评审确认方法失败或技能缺口后,按已有适应阶段调整可复用方法。`,originalName:`Math Research Scientist Adaptation`,source:`argus/verticals/math/skills/scientist/math-research-adaptation.md`,sourceSha256:`fd8961cb0155e3fc05428cf0b5dbd6be86ed048636dc657b3b23abbee6495933`},"vertical/math/scientist/math-research-distillation.md":{title:`沉淀数学研究方法`,summary:`在首次匹配缺失后整理可复用研究方法,不假定已经失败,也不代替当前任务的执行。`,originalName:`Math Research Skill Distillation`,source:`argus/verticals/math/skills/scientist/math-research-distillation.md`,sourceSha256:`83a7367798b1ac327861deaa94accf1d77da0e140ebc8da8137442a30a83b09a`},"vertical/research/engineer/ablation-planner.md":{title:`选择有判别力的消融实验`,summary:`只选择能区分结果解释、说明所选方法作用的必要消融,而不是机械穷举组合。`,originalName:`Choosing ablations that distinguish explanations`,source:`argus/verticals/research/skills/engineer/ablation-planner.md`,sourceSha256:`f5c9bff3d6b5bc9dc4b50316e172856fcc01d708685c08a1ff29650871369858`},"vertical/research/engineer/method-card.md":{title:`方法卡、可执行规范与审阅锚点`,summary:`在 METHOD.md 中写清方法、组件、协议和证伪条件;以钉版参考实现为底把方法写成 diff;先写 tests/spec 再跑承载论断的实验;用代码锚点让不在场的审阅者找到机制;规划者据此写实现简报。`,originalName:`Method card (METHOD.md), executable spec and review anchors`,source:`argus/verticals/research/skills/engineer/method-card.md`,sourceSha256:`2e756a2fd09bca2abe4175fea4042af6905a6166b629c940909b10090cfe6855`},"vertical/research/engineer/novelty-check.md":{title:`检验研究想法的新意`,summary:`通过当前来源对照最接近的已有工作,判断一条候选想法的差异,而非先宣称创新。`,originalName:`Testing the idea's novelty`,source:`argus/verticals/research/skills/engineer/novelty-check.md`,sourceSha256:`e20a0f4290c72b07c9b09fa77633ecc915f0f7a8b90d8efd4c627fb9d12f8c16`},"vertical/research/engineer/paper-chart-styling.md":{title:`论文数据图样式`,summary:`统一数据图的配色、尺寸、标记和字体嵌入,遵守所选期刊会议版式;不改变数据本身。`,originalName:`Styling data figures for publication`,source:`argus/verticals/research/skills/engineer/paper-chart-styling.md`,sourceSha256:`c40b9f431de9cd01f16e245d819563566fc5db02c2217505599921adcca65b75`},"vertical/research/engineer/paper-framework-figure-studio.md":{title:`论文图的路线选择与概念图编排`,summary:`按表达内容选渲染路线:数据图走 SciencePlots/Matplotlib,概念与框架图默认以图像蓝图重建为可编辑 PPT,无图像接口时直接原生绘制;生成图像只用于不承载论断的部分。`,originalName:`Composing a conceptual paper figure`,source:`argus/verticals/research/skills/engineer/paper-framework-figure-studio.md`,sourceSha256:`e01ffd101b8fcd701b86918d93994079dfc87d9df79dbcd348bdfe3508cfcd9b`},"vertical/research/engineer/references/ideation/ideation-patterns/overview.md":{title:`研究构思模式总览`,summary:`汇总各研究构思模式的定义、操作特征与适用时机,帮助为路线挑选机制视角;模式在语料中常见不代表适合当前问题,也不替代创新性与正确性验证。`,originalName:`engineer/references/ideation/ideation-patterns/overview`,source:`argus/verticals/research/skills/engineer/references/ideation/ideation-patterns/overview.md`,sourceSha256:`8b2b43b5ce63c70a1b54c0ff5fb3f1954bc8ef6c05bda95a71a011d2f5f4eb34`},"vertical/research/engineer/references/paper-writing-craft.md":{title:`论文写作方法参考`,summary:`提供论文论证和表达的写作参考,需结合真实证据与所选期刊会议要求使用。`,originalName:`engineer/references/paper-writing-craft`,source:`argus/verticals/research/skills/engineer/references/paper-writing-craft.md`,sourceSha256:`bd645d2f2f48987c988c54b6b22843b22ee3b5a9dc0ce950bff4acdc0fcf3eeb`},"vertical/research/engineer/research-grind.md":{title:`沿诊断阶梯打磨研究结果`,summary:`把首次实现当作草稿,在固定声明下沿诊断阶梯逐级排查;结果异常先怀疑设置;从原始逐种子行算数;依据证据而非尝试次数判断何时足够。`,originalName:`Working a research result into shape`,source:`argus/verticals/research/skills/engineer/research-grind.md`,sourceSha256:`e955fe1ac7aa975a9172394bdca4e8b2ed6a504355ab00573a26badf442f038a`},"vertical/research/engineer/rl-training-collapse-diagnosis.md":{title:`强化学习训练健康诊断`,summary:`检查奖励、优势、梯度、KL、截断和吞吐异常,先诊断配置与过程,再归因方法;不同训练目标不能混用规则。`,originalName:`RL Training Health Diagnosis`,source:`argus/verticals/research/skills/engineer/rl-training-collapse-diagnosis.md`,sourceSha256:`d48fd69adaac73ad45c41cd9565798a94a476de52c9354097abe2d8604db8782`},"vertical/research/engineer/sources-and-citations.md":{title:`对照来源核对论断与引用`,summary:`把稿件中的论断对回支撑它的证据,把引用对回被引的原文,并用 Semantic Scholar 核对版本;补充全局的一手来源技能,不另起一轮整篇审阅。`,originalName:`Checking claims and citations against their sources`,source:`argus/verticals/research/skills/engineer/sources-and-citations.md`,sourceSha256:`450410c4b428e31104819c07a98e19b615ced499e0d2d4df473305ca789d55ed`},"vertical/research/engineer/training-infrastructure.md":{title:`训练基础设施的选择、搭建与调参`,summary:`训练或大规模推理需要框架时,用实时来源调查候选、在隔离环境中试装并剖析一步真实更新、以官方配方为锚每次只改一个因素,并把结论写成带日期的项目决策记录;不按记忆推荐技术栈。`,originalName:`Training infrastructure: choosing, standing up and tuning it`,source:`argus/verticals/research/skills/engineer/training-infrastructure.md`,sourceSha256:`4c495369ffba7ff2b9954a2fafd72b874e63abc6065a5afab7c61ce10afb9087`},"vertical/research/engineer/venue-format-preflight.md":{title:`投稿前的编译与泄露检查`,summary:`用目标会场的官方作者模板编译完整稿件并核对结构,同时检查稿件没有泄露内部路径、角色名与运行时用语。`,originalName:`Preparing the draft for the venue`,source:`argus/verticals/research/skills/engineer/venue-format-preflight.md`,sourceSha256:`e146afba818a8436d0807aff610084d6a321277778e7ce299bd96f9f57795eb0`},"vertical/research/engineer/venue-format-research.md":{title:`选择投稿目标并核对要求`,summary:`根据研究内容选择合适期刊会议,获取当前官方作者要求,而非沿用过时模板。`,originalName:`Choosing a venue and reading its requirements`,source:`argus/verticals/research/skills/engineer/venue-format-research.md`,sourceSha256:`aad2d0ec25649231ec233f4abb5b216af313a7a1dfa699cc6f0c8b23be7cbcf2`},"vertical/research/engineer/venue-paper-drafting.md":{title:`面向投稿目标撰写论文`,summary:`先定论证形状,按所选作者模板和确认的证据写完整论文,读一次强范文校准视觉与结构标准;不把未验证探索写成既定结论。`,originalName:`Writing for the selected venue`,source:`argus/verticals/research/skills/engineer/venue-paper-drafting.md`,sourceSha256:`d7bb7d7e59f5ce6e20433fa843e3d7002575b1892b131c0d0f7f247e986281f1`},"vertical/research/research-experiment-playbook.md":{title:`通过实验发展研究想法`,summary:`忠实实现已选想法,通过适应性实验形成足以支撑论文的证据,而不是只完成首次运行。`,originalName:`Developing an idea through experiments`,source:`argus/verticals/research/skills/research-experiment-playbook.md`,sourceSha256:`df8f6a724b93f063a6e0dd2e36af1838fca72eea689f062b096d3ad0c4ad2c85`},"vertical/research/research-idea-playbook.md":{title:`寻找并选择研究想法`,summary:`从来源中发现候选可能性,经独立审查后作最终选择,不把构思直接当作实验结果。`,originalName:`Finding a research idea`,source:`argus/verticals/research/skills/research-idea-playbook.md`,sourceSha256:`91104461d9115ee280db1f5e89d3c35bc8301422bfd7d9a70c66fa559c09eed6`},"vertical/research/research-paper-playbook.md":{title:`撰写完整研究论文`,summary:`从已确认的正向证据组织论文、编译并准备投稿材料,保持证据与论述一致。`,originalName:`Writing the research paper`,source:`argus/verticals/research/skills/research-paper-playbook.md`,sourceSha256:`2efcabc2904fe55831b0f5d9c61846c544aab2a211687f0fbf51ad417e66afec`},"vertical/research/research-review-playbook.md":{title:`对论文形成独立判断`,summary:`综合科学性、图示、语言和整体论证,判断工作是否成立并提出建设性意见。`,originalName:`Reaching a judgment on the paper`,source:`argus/verticals/research/skills/research-review-playbook.md`,sourceSha256:`368d0bc3b8dba80c1e8d84257a10f95bbe2124a35d03a30e553e1d6b56ae829a`},"vertical/research/reviewer/academic-paper-peer-review-benchmark.md":{title:`按目标期刊会议评审论文`,summary:`以独立评审视角判断当前稿件,提供科学指导并更新评审记录。`,originalName:`Reading the paper as a venue reviewer`,source:`argus/verticals/research/skills/reviewer/academic-paper-peer-review-benchmark.md`,sourceSha256:`6446f17af2a751bd9570b4351e4b28d84d09cc06ed2c59174111f17f39e0cbc9`},"vertical/research/reviewer/claim-to-code-trace.md":{title:`追溯声明到实际代码`,summary:`沿配置和执行路径核对公式、比较条件与观测,判断研究声明是否对应实际产生证据的代码。`,originalName:`Claim-to-Code Trace`,source:`argus/verticals/research/skills/reviewer/claim-to-code-trace.md`,sourceSha256:`fef3ef16ce27a9c1e9ec5f095c73bb734da06aedba74fa994122e28d32c293ee`},"vertical/research/reviewer/experiment-results-review.md":{title:`判断实验真正说明了什么`,summary:`亲自读代码、配置、评测器和原始行,判断证据对固定声明的支持与缺口;低于基线的结果在阶梯未走完前是修复请求;训练类实验另核对基础设施决策记录。`,originalName:`What the experiments establish`,source:`argus/verticals/research/skills/reviewer/experiment-results-review.md`,sourceSha256:`bc158d8b51107b697d290eb6ed461f2a596aa601bc78cce7e88089743411533e`},"vertical/research/reviewer/strongest-argument-against.md":{title:`寻找最有力的科学反对意见`,summary:`在最终评审中识别论文最关键的科学弱点,不通过直接改稿掩盖它。`,originalName:`The strongest argument against the paper`,source:`argus/verticals/research/skills/reviewer/strongest-argument-against.md`,sourceSha256:`6cc3e7990dacb420a04ff945cb1f221852bd249b981a60def70dfcace2ac3418`},"vertical/research/reviewer/venue-academic-language-review.md":{title:`审查论文论证与学术表达`,summary:`对照目标期刊会议的当前惯例阅读论证与语言,指出问题,不擅自编辑论文。`,originalName:`Reading the paper's argument and language`,source:`argus/verticals/research/skills/reviewer/venue-academic-language-review.md`,sourceSha256:`a2fe9faf57ff0a09181f42de2ac2b5080158e08c430078fb48722fd6b9893f66`},"vertical/software/engineer/software-change-implementation.md":{title:`有边界的软件实现与拆解`,summary:`结合仓库结构选择合适工具,以与任务规模相称的检查完成软件修改;分阶段工作按架构边界拆解,每个任务写明兼容性风险与独立预言机。`,originalName:`Software Change Implementation`,source:`argus/verticals/software/skills/engineer/software-change-implementation.md`,sourceSha256:`34dad5e10c880fb48964573768b72d8377829ca8163ddd21987c2c05538d70a9`},"vertical/software/reviewer/software-change-review.md":{title:`软件修改独立评审`,summary:`检查真实调用路径、兼容性与验证证据,不依赖参考答案或仅凭完成声明判断。`,originalName:`Software Change Review`,source:`argus/verticals/software/skills/reviewer/software-change-review.md`,sourceSha256:`5d1a66ff65accae04ec02005724735c9767308ac63c005b8be6e269eb9acb25f`}};function tn(e){if(!e.is_default||![`bundled`,`shared`].includes(e.source)||!(e.scope===`global`?[`global:${e.source}`]:e.scope===`vertical`?[`vertical:${e.vertical}:${e.source}`,...e.source===`bundled`?[`domain:${e.vertical}:bundled`]:[]]:[]).includes(e.library))return null;let t=e.scope===`global`?`global/${e.path}`:`vertical/${e.vertical}/${e.path}`,n=Object.hasOwn(en,t)?en[t]:null;return n?.originalName===e.name?n:null}function nn(e,t){let n=t===`zh-CN`?tn(e):null;return{title:n?.title??e.name,summary:n?.summary??e.description,guide:n}}function rn(e,t){let n=nn(e,t);return`${e.name} ${e.description} ${e.path} ${e.vertical} ${n.title} ${n.summary}`.toLocaleLowerCase()}var an={research:`科研`,software:`软件开发`,math:`数学研究`,chemistry:`化学`,kernel_engineering:`GPU 算子工程`,argus_maintenance:`Argus 维护`,learning:`资料学习`};function on(e,t){return t===`zh-CN`&&Object.hasOwn(an,e)?an[e]:e}var sn={fact:[`记录可核对的环境、对象或事实,供后续工作查证;记录本身不保证事实仍然有效。`,`Records checkable facts for later verification; a saved record is not a guarantee that it is still current.`],lesson:[`保留工作中得到的经验和问题,帮助类似任务少走弯路;不能代替当前证据或评审。`,`Keeps lessons from work to inform similar tasks; it does not replace current evidence or review.`],survey:[`整理问答或调研材料与来源,为后续查阅提供线索;结论仍需结合原文核对。`,`Organizes answers or research and their sources for later reference; check conclusions against the original evidence.`],principles:[`归纳可反复参考的建议,帮助选择方法;应检查所引用的经验与适用条件。`,`Distills recurring guidance for choosing methods; check the cited lessons and applicability.`],note:[`保存关于你的背景、偏好或计划,帮助后续任务理解上下文;不是工具使用授权。`,`Keeps personal context, preferences or plans for later work; it is not authorization to use tools.`],profile:[`汇总 Argus 对你的背景与偏好的了解,方便核对是否准确;不代表公开资料或任务完成情况。`,`Summarizes personal context and preferences for inspection; it is neither a public record nor a task-completion report.`],page:[`一般参考资料。具体用途取决于原文和来源,不能仅凭“已保存”判断内容可靠或适用。`,`General reference material. Its use depends on the original content and sources, not merely on being saved.`]};function cn(e,t){return(Object.hasOwn(sn,e)?sn[e]:sn.page)[t===`zh-CN`?0:1]}var ln={private:[`你的个人背景资料,与共享知识分开保存。这里不改变既有读取权限或模型的数据处理方式。`,`Personal context is stored separately from shared knowledge. This view does not change existing access or model data handling.`],global:[`跨项目参考的通用资料;不要把个人信息当作公共知识放在这里。`,`General reference across projects; personal information does not belong in shared knowledge.`],vertical:[`同一领域可复用的专门资料,使用前仍要核对当前任务的条件。`,`Domain-specific reference; verify that it applies to the current task.`],project:[`围绕当前项目保存的资料与背景;分类不是操作系统沙箱或文件权限边界。`,`Material associated with this project; the category is not an OS sandbox or file-permission boundary.`]};function un(e,t){return Object.hasOwn(ln,e)?ln[e][t===`zh-CN`?0:1]:t===`zh-CN`?`范围尚未确认,请以来源说明为准。`:`Scope not confirmed; consult the source.`}var dn={active:`label.status.inProgress`,claimed:`label.status.inProgress`,in_progress:`label.status.inProgress`,running:`label.status.inProgress`,working:`label.status.inProgress`,pending:`label.status.waiting`,queued:`label.status.waiting`,waiting:`label.status.waiting`,idle:`label.status.waiting`,accepted:`label.status.completed`,complete:`label.status.completed`,completed:`label.status.completed`,done:`label.status.completed`,success:`label.status.completed`,blocked:`label.status.blocked`,failed:`label.status.failed`,error:`label.status.failed`,rejected:`label.status.needsChanges`,continue:`label.status.needsChanges`,skipped:`label.status.skipped`,paused:`label.status.paused`,paused_cost:`label.outcome.costUnreconciled`,stopped:`label.status.paused`,cancelled:`label.status.cancelled`,aborted:`label.status.cancelled`,not_started:`label.status.waiting`,available:`label.status.available`,absent:`label.status.unavailable`,inaccessible:`label.status.inaccessible`,degraded:`label.status.limited`,healthy:`label.status.healthy`},fn={system:`label.role.argus`,operator:`label.role.you`},pn={completed:`label.outcome.workCompleted`,done:`label.outcome.workCompleted`,success:`label.outcome.workCompleted`,paused:`label.outcome.workPaused`,blocked:`label.outcome.workBlocked`,failed:`label.outcome.workFailed`,error:`label.outcome.workFailed`,aborted:`label.outcome.workEnded`,ended:`label.outcome.workEnded`,incomplete:`label.outcome.workIncomplete`,research_incomplete:`label.outcome.workIncomplete`,paused_no_breakthrough:`label.outcome.workIncomplete`,exhausted_current_methods:`label.outcome.workIncomplete`,stalled:`label.outcome.workStalled`,no_progress:`label.outcome.workStalled`,max_rounds:`label.outcome.workStalled`,infra_blocked:`label.outcome.workBlocked`,supervisor_error:`label.outcome.workFailed`},mn={accepted:`label.outcome.reviewPassed`,done:`label.outcome.reviewPassed`,passed:`label.outcome.reviewPassed`,continue:`label.outcome.reviewNeedsChanges`,rejected:`label.outcome.reviewNeedsChanges`,blocked:`label.outcome.reviewBlocked`,stale:`label.outcome.reviewOutdated`,pending:`label.outcome.reviewPending`,pending_review:`label.outcome.reviewPending`},hn={certified:`label.outcome.stageApproved`,not_certified:`label.outcome.stageNotApproved`,revoked:`label.outcome.stageRevoked`,intentionally_skipped:`label.outcome.stageNotNeeded`,deferred:`label.outcome.stagePending`},gn={budget_exhausted:`label.outcome.budgetPaused`,budget_pause:`label.outcome.budgetPaused`,cost_unreconciled:`label.outcome.costUnreconciled`,operator_input_required:`label.outcome.waitingForYou`,operator_abort:`label.outcome.stoppedByYou`,operator_pause:`label.outcome.pausedByYou`,daemon_shutdown:`label.outcome.sessionPaused`,backend_unavailable:`label.outcome.serviceUnavailable`,provider_cooldown:`label.outcome.serviceCoolingDown`,provider_fence:`label.outcome.serviceUnavailable`,transient_error:`label.outcome.temporaryIssue`,permanent_error:`label.outcome.serviceError`,planner_empty_plan:`label.outcome.needsPlan`},_n={cuda:`label.resource.nvidiaGpu`,rocm:`label.resource.amdGpu`,mps:`label.resource.appleGpu`,cpu:`label.resource.cpu`};function vn(e,t){return t(dn[String(e??``).toLowerCase()]??`label.status.updated`)}function yn(e,t){let n=String(e??``).toLowerCase();return ot(n)?Ae(n,t):t(fn[n]??`label.role.argus`)}function bn(e,t){return t(`label.priority`,{priority:e})}function xn(e,t){if(!e?.execution_status)return[];let n=[t(pn[e.execution_status.toLowerCase()]??`label.outcome.workUpdated`)],r=mn[String(e.review_status??``).toLowerCase()],i=hn[String(e.stage_certification??``).toLowerCase()],a=gn[String(e.interruption_kind??``).toLowerCase()];return r&&n.push(t(r)),i&&n.push(t(i)),a&&n.push(t(a)),e.resumable&&n.push(t(`label.outcome.canResume`)),n}function Sn(e,t){return t(_n[e.toLowerCase()]??`label.resource.accelerator`)}function Cn(e,t){return t(e===`strict`?`label.resource.enforced`:`label.resource.advisory`)}function wn(e,t){return t(e===`yield`?`label.resource.released`:`label.resource.kept`)}var K=n(),Tn=e=>[`knowledge-feed`,e];function En(e=!0,t=50){return x({queryKey:Tn(t),queryFn:({signal:e})=>P.knowledgeFeed(t,e),enabled:e,staleTime:5e3,refetchInterval:1e4})}var Dn={en:{learned:`Learned`,recalled:`Recalled`,promoted:`Promoted`,corrected:`Corrected`},zh:{learned:`学到了`,recalled:`读取了`,promoted:`提升了`,corrected:`纠正了`}},On={en:{private:`About you`,global:`Global`,vertical:`Vertical`,project:`Project`},zh:{private:`关于你`,global:`全局`,vertical:`垂直领域`,project:`项目`}};function kn(e,t=60){let n=[...e].sort((e,t)=>t.ts-e.ts),r=[];for(let e of n){let n=r[r.length-1];if(e.kind===`recalled`&&n?.kind===`recalls`&&n.role===e.role&&n.ts-e.ts<=t){n.events.push(e);continue}r.push(e.kind===`recalled`?{kind:`recalls`,ts:e.ts,role:e.role,events:[e]}:{kind:`single`,event:e})}return r}function An(e,t,n=null){return e.path?e.scope===`project`?n&&e.source_project&&e.source_project!==n?null:t.find(t=>t.scope===`project`&&t.path===e.path)??null:t.find(t=>t.scope===e.scope&&t.vertical===e.vertical&&t.path===e.path)??null:null}var jn={learned:`bg-blue/10 text-blue`,recalled:`bg-line/60 text-ink-dim`,promoted:`bg-ok/10 text-ok`,corrected:`bg-warn/10 text-warn`};function Mn({events:e,items:t,sid:n,projectNames:r={},query:i=``,onSelect:a,selected:o}){let{locale:s,t:c}=F(),l=s===`zh-CN`,u=Dn[l?`zh`:`en`],d=On[l?`zh`:`en`],f=e=>H(e,l?`zh-CN`:`en`),p=i.trim().toLocaleLowerCase(),m=kn(p?e.filter(e=>`${e.title} ${e.path} ${e.vertical} ${e.source_project} ${e.role} ${e.note}`.toLocaleLowerCase().includes(p)):e),h=e=>[d[e.scope]??e.scope,on(e.vertical,s),e.source_project?`${l?`来自 `:`from `}${r[e.source_project]||e.source_project}`:``,l&&e.role?yn(e.role,c):e.role].filter(Boolean).join(` · `),g=e=>!!(e&&o&&e.scope===o.scope&&e.vertical===o.vertical&&e.path===o.path),_=(e,r)=>{let i=An(e,t,n),o=e.title||e.path;return i?(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(i),"aria-pressed":g(i),"data-feed-title":!0,className:`${r} text-left hover:text-blue ${g(i)?`text-blue`:`text-ink`}`,children:o}):(0,K.jsx)(`span`,{"data-feed-title":!0,className:`${r} text-ink`,title:e.path,children:o})};return m.length===0?(0,K.jsx)(`p`,{className:`p-3 text-sm leading-relaxed text-ink-faint`,children:p?l?`没有匹配的学习动态。`:`No feed lines match the search.`:l?`还没有学习动态。Argus 在任务后反思写下教训、把已有知识读进提示、或把评审通过的页面提升到共享层时,都会在这里留下一行。`:`Nothing learned yet. A line appears here whenever Argus writes a lesson after a mission, reads existing knowledge into a prompt, or promotes a reviewed page to a shared level.`}):(0,K.jsx)(`ol`,{className:`space-y-1`,"aria-label":l?`学习动态`:`Learning feed`,children:m.map(e=>e.kind===`single`?(0,K.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":e.event.kind,children:[(0,K.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,K.jsx)(`time`,{dateTime:new Date(e.event.ts*1e3).toISOString(),children:f(e.event.ts)}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${jn[e.event.kind]??jn.learned}`,children:u[e.event.kind]??e.event.kind})]}),_(e.event,`mt-1 block w-full break-words text-sm font-medium`),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.event)}),e.event.note&&(0,K.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-ink-dim`,children:e.event.note})]},`${e.event.ts}/${e.event.kind}/${e.event.path}`):(0,K.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":`recalls`,children:[(0,K.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,K.jsx)(`time`,{dateTime:new Date(e.ts*1e3).toISOString(),children:f(e.ts)}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${jn.recalled}`,children:u.recalled})]}),(0,K.jsx)(`span`,{className:`mt-1 block text-sm font-medium text-ink`,"data-feed-title":!0,children:e.events.length===1?e.events[0].title||e.events[0].path:l?`读取了 ${e.events.length} 条已有知识`:`Recalled ${e.events.length} existing pages`}),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.events[0])}),e.events.length>1&&(0,K.jsx)(`span`,{className:`mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-xs`,children:e.events.map(e=>(0,K.jsx)(`span`,{children:_(e,`inline text-xs text-ink-dim`)},`${e.ts}/${e.scope}/${e.vertical}/${e.path}`))})]},`${e.ts}/recalls/${e.role}`))})}function Nn({guide:e,item:t}){let{t:n}=F();return(0,K.jsxs)(`section`,{"data-skill-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-4 text-sm leading-relaxed text-ink`,children:[(0,K.jsx)(`h4`,{className:`font-semibold`,children:`这项方法有什么用`}),(0,K.jsx)(`p`,{className:`mt-2`,children:e.summary}),(0,K.jsxs)(`dl`,{className:`mt-3 space-y-2 text-xs text-ink-dim`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`font-medium`,children:`什么时候参考`}),(0,K.jsx)(`dd`,{children:`当前任务与上面的用途相符时,由既有任务与技能选择流程按需读取;浏览本页不会运行工具或发起模型任务。`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`font-medium`,children:`目录标注的角色`}),(0,K.jsxs)(`dd`,{children:[yn(t.role,n),`;这只是说明,不调整角色职责或权限。`]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`font-medium`,children:`需要注意`}),(0,K.jsx)(`dd`,{children:`这是随包版本的中文导读,不是完整执行指令,也不是已经完成或验证的证据。具体步骤、前置条件、软件许可和授权限制请对照原文。`})]})]})]})}function Pn({item:e}){let{locale:t}=F(),n=t===`zh-CN`;return(0,K.jsxs)(`section`,{"data-knowledge-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-3 text-xs leading-relaxed text-ink-dim`,children:[(0,K.jsx)(`h4`,{className:`font-semibold text-ink`,children:n?`这类知识怎样帮助工作`:`How this kind of knowledge helps`}),(0,K.jsx)(`p`,{className:`mt-2`,children:cn(e.kind,t)}),(0,K.jsx)(`p`,{className:`mt-2`,children:un(e.scope,t)}),(0,K.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n?`以上解释条目类型与范围,不是这篇正文的翻译或真实性证明。具体内容、来源和适用条件仍以原文为准。`:`This explains the kind and scope, not the page itself or its validity. Consult the original content, sources and conditions.`})]})}function Fn({sid:e,channel:t,onOpenKnowledge:n,onOpenSkills:r}){let{locale:i}=F(),a=i===`zh-CN`,o=S(),s=x({queryKey:[`learning-status`,e],queryFn:({signal:t})=>P.learningStatus(e,t),enabled:!!e,refetchInterval:2e3,staleTime:1e3}),c=(0,U.useRef)(``);(0,U.useEffect)(()=>{let t=`${e}:${s.data?.revision??0}`;if(!(!s.data?.revision||t===c.current)){c.current=t;for(let e of[`skill-library`,`wiki-library`,`knowledge-feed`])o.invalidateQueries({queryKey:[e]})}},[e,s.data?.revision,o]);let l=C({mutationFn:e=>P.retryLearning(e.sid,e.id),onSuccess:(e,t)=>o.setQueryData([`learning-status`,t.sid],e)});if(!e||!s.data?.jobs.length)return null;let u=s.data.jobs,d=u.find(e=>e.status===`running`)??u.find(e=>e.status===`queued`),f=d??u[0],p=!!d||s.data.pending>0,m=!p&&f.status===`skipped`&&f.outcome.reason===`paused`;if(!p&&f.status===`skipped`&&(!m||!t))return null;let h={cost_unreconciled:[`上一次模型调用的费用尚未结算,结算前暂停新的模型调用`,`model calls are paused until an earlier call's cost is settled`],budget_exhausted:[`今日模型预算已用完`,`today's model budget is used up`],provider_cooldown:[`模型服务暂时限流`,`the model provider is briefly rate-limited`],operator_pause:[`模型调用已暂停`,`model calls are paused`]},g=h[f.outcome.detail??``]??h.operator_pause,_=m||!p&&f.status===`failed`,v=a?{knowledge:`知识库`,skills:`技能库`,preferences:`用户偏好`}:{knowledge:`Knowledge base`,skills:`Skill library`,preferences:`Preferences`},y=t?[t]:[`knowledge`,`skills`,`preferences`],b=p?y:y.filter(e=>(f.outcome.counts?.[e]??0)>0);if(!p&&!_&&!b.length)return null;let w=e=>{let t=f.outcome.counts?.[e]??0;return p?f.status===`running`?a?`${v[e]}正在更新`:`Updating ${v[e].toLowerCase()}`:a?`${v[e]}等待更新`:`${v[e]} update queued`:a?`${v[e]}已更新 · ${t} 条`:`${v[e]} updated · ${t}`},T=(f.outcome.items??[]).filter(e=>!t||e.channel===t);return(0,K.jsxs)(`div`,{className:`px-2 py-1.5 text-[11px] leading-5 text-ink-dim`,"data-learning-status":f.status,children:[(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:[p?(0,K.jsx)(W,{className:`h-3 w-3 animate-spin text-blue`}):_?(0,K.jsx)(Bt,{className:`h-3 w-3 text-ink-faint`}):(0,K.jsx)(Jt,{className:`h-3 w-3 text-blue`}),m&&(0,K.jsx)(`span`,{children:a?`本轮未学习:${g[0]}。回复不受影响。`:`Learning skipped: ${g[1]}. Your reply is unaffected.`}),!p&&f.status===`failed`&&(0,K.jsx)(`span`,{children:a?`本轮学习未完成,回复不受影响。`:`Learning from this turn did not finish. Your reply is unaffected.`}),!_&&b.map(e=>(0,K.jsx)(`span`,{children:w(e)},e)),s.data.pending>1&&(0,K.jsx)(`span`,{children:a?`还有 ${s.data.pending-1} 轮待学习`:`${s.data.pending-1} more queued`}),_&&f.retryable!==!1&&(0,K.jsx)(`button`,{type:`button`,disabled:l.isPending,className:`text-blue underline`,onClick:()=>l.mutate({sid:e,id:f.id}),children:a?`重试学习`:`Retry learning`})]}),p&&!t&&(0,K.jsx)(`p`,{className:`text-ink-faint`,children:a?`正在整理本轮的知识、方法和偏好,你可以继续工作。`:`Saving useful knowledge, methods and preferences. You can keep working.`}),T.length>0&&!t&&(0,K.jsxs)(`details`,{className:`mt-0.5`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-blue`,children:a?`查看本轮学到了什么`:`What this turn taught Argus`}),(0,K.jsx)(`ul`,{className:`pl-4 list-disc`,children:T.map((e,t)=>(0,K.jsx)(`li`,{children:(e.channel===`skills`?r:n)?(0,K.jsx)(`button`,{type:`button`,className:`text-left underline`,onClick:e.channel===`skills`?r:n,children:e.title}):e.title},t))})]}),(l.isError||s.isError)&&(0,K.jsx)(`p`,{role:`alert`,children:a?`暂时无法同步学习状态,请稍后重试。`:`Learning status could not be refreshed. Please retry.`})]})}var In=e=>`${e.library}/${e.path}`,Ln=e=>e.filter(e=>!e.is_default&&e.updated_at!=null).sort((e,t)=>(t.updated_at??0)-(e.updated_at??0)||In(e).localeCompare(In(t)));function Rn(e,t=!0){return x({queryKey:[`skill-library`,e],queryFn:({signal:t})=>P.skillLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var zn={en:{fact:`Fact`,lesson:`Lesson`,survey:`Survey`,principles:`Principles`,note:`Note`,profile:`Profile`,page:`Page`},zh:{fact:`事实`,lesson:`经验教训`,survey:`调研摘要`,principles:`原则`,note:`个人记录`,profile:`个人概况`,page:`参考页面`}},Bn=e=>e.kind in zn.en?e.kind:`page`,Vn=e=>[`wiki-library`,e];function Hn(e,t=!0){return x({queryKey:Vn(e),queryFn:({signal:t})=>P.wikiLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var Un=[`feed`,`global`,`vertical`,`project`],Wn={"zh-CN":{feed:`学习动态`,global:`全局项目`,vertical:`垂直领域`,project:`项目`},en:{feed:`Learning feed`,global:`Across projects`,vertical:`Vertical`,project:`Project`}};function Gn(e,t,n,r){let i=r===`zh-CN`,a=e=>n===`feed`||e===n||n===`global`&&e===`private`,o=(e?.items??[]).filter(e=>a(e.scope)).map(e=>({kind:`knowledge`,item:e,id:`knowledge/${e.scope}/${e.vertical}/${e.path}`,title:e.title,description:e.description,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at,search:`${e.title} ${e.description} ${e.path}`})),s=(n===`feed`?Ln(t?.items??[]):t?.items??[]).filter(e=>a(e.scope)).map(e=>{let t=nn(e,r);return{kind:`skill`,item:e,id:`skill/${e.library}/${e.path}`,title:t.title,description:t.summary,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at??0,search:rn(e,r)}}),c=n===`feed`?[]:(e?.libraries??[]).filter(e=>a(e.scope)).flatMap(e=>[{kind:`index`,content:e.index_markdown,name:`INDEX.md`,title:i?`索引`:`Index`},{kind:`principles`,content:e.principles,name:`principles.md`,title:i?`原则`:`Principles`},{kind:`profile`,content:e.profile,name:`profile.md`,title:i?`个人概况(原私有范围)`:`Personal profile (private scope)`}].flatMap(t=>t.content?.trim()?[{kind:t.kind,content:t.content,id:`${t.kind}/${e.scope}/${e.vertical}/${e.root}`,title:t.title,description:``,path:`${e.root}/${t.name}`,scope:e.scope,vertical:e.vertical,updated:0,search:`${t.title} ${t.name}`}]:[]));return[...o,...s,...c].sort((e,t)=>t.updated-e.updated||e.id.localeCompare(t.id))}function Kn({onOpen:e,compact:t=!1}){let{locale:n}=F(),r=n===`zh-CN`?`技能库`:`Skill library`;return(0,K.jsx)(`section`,{className:`shrink-0 ${t?`py-2`:`mx-2 py-1`}`,"data-learning-navigation":!0,children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>e(`feed`),"aria-label":r,title:r,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-ink-dim hover:bg-bg hover:text-ink ${t?`justify-center`:``}`,children:[(0,K.jsx)(At,{size:16,"aria-hidden":`true`}),!t&&r]})})}function qn({sid:e,initialScope:t=`feed`,initialSelection:n=null,projectNames:r={}}){let i=(0,U.useRef)(e);return(0,K.jsx)(Jn,{sid:e,initialScope:t,initialSelection:i.current===e?n:null,projectNames:r},e??`no-project`)}function Jn({sid:e,initialScope:t,initialSelection:n,projectNames:r}){let{locale:i}=F(),a=i===`zh-CN`,o=Wn[i],[s,c]=(0,U.useState)(t),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(``),[p,m]=(0,U.useState)(()=>n?n.kind===`skill`?`skill/${n.item.library}/${n.item.path}`:`knowledge/${n.item.scope}/${n.item.vertical}/${n.item.path}`:null),h=Hn(e),g=Rn(e),_=En(s===`feed`),v=Gn(h.data,g.data,s,i),y=v.find(e=>e.id===p),b=y?.kind===`knowledge`?y.item:null,S=y?.kind===`skill`?y.item:null,C=x({queryKey:[`wiki-document`,e,b?.scope,b?.vertical,b?.path,b?.updated_at],queryFn:({signal:t})=>{if(!b)throw Error(`No knowledge document selected`);return P.wikiDocument(e,b.scope,b.vertical,b.path,t)},enabled:!!b}),w=x({queryKey:[`skill-document`,e,S?.library,S?.path,S?.updated_at],queryFn:({signal:t})=>{if(!S)throw Error(`No skill document selected`);return P.skillDocument(e,S.library,S.path,t)},enabled:!!S}),T=l.trim().toLocaleLowerCase(),E=v.filter(e=>(s!==`vertical`||!d||e.vertical===d)&&(!T||`${e.search} ${e.vertical}`.toLocaleLowerCase().includes(T))),D=[...new Set([...h.data?.verticals??[],...g.data?.verticals??[]])].sort(),O=e=>e.scope===`private`?a?`个人记录 · 原私有范围,不共享`:`Personal record · private, not shared`:`${o[e.scope]}${e.vertical?` · ${on(e.vertical,i)}`:``}`,k=e=>e.kind===`skill`?a?`技能`:`Skill`:e.kind===`knowledge`?zn[a?`zh`:`en`][Bn(e.item)]:e.kind===`principles`?a?`原则`:`Principles`:e.kind===`profile`?a?`个人概况`:`Profile`:a?`索引`:`Index`,A=S?w:C,j=S?nn(S,i).guide:null,M=e=>{c(e),m(null),f(``)};return(0,K.jsxs)(`div`,{className:`flex h-[min(780px,84dvh)] min-h-0 flex-col`,"data-learning-library":!0,children:[(0,K.jsx)(Qe,{title:a?`技能库`:`Skill library`,sub:a?`在一起查看学到的知识、可复用的方法和原始资料。`:`Explore learned knowledge, reusable methods and original sources together.`}),(0,K.jsx)(Fn,{sid:e,onOpenKnowledge:()=>M(`feed`),onOpenSkills:()=>M(`feed`)}),(0,K.jsx)(`nav`,{"aria-label":a?`学习资源分类`:`Learning resource categories`,className:`flex shrink-0 overflow-x-auto border-b border-line/60 px-4`,children:Un.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>M(e),className:`shrink-0 border-b-2 px-3 py-2.5 text-sm ${s===e?`border-blue text-ink`:`border-transparent text-ink-faint hover:text-ink`}`,children:o[e]},e))}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,K.jsxs)(`aside`,{className:`${y?`hidden md:flex`:`flex`} min-h-0 w-full flex-col md:w-80 md:shrink-0 md:border-r md:border-line/60`,children:[(0,K.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,K.jsx)(`input`,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":a?`搜索知识与技能`:`Search knowledge and skills`,placeholder:a?`搜索知识与技能`:`Search knowledge and skills`,className:`w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink`}),s===`vertical`&&(0,K.jsxs)(`select`,{value:d,onChange:e=>{f(e.target.value),m(null)},"aria-label":a?`垂直领域`:`Vertical`,className:`w-full rounded-md border border-line bg-bg px-2 py-2 text-sm text-ink`,children:[(0,K.jsx)(`option`,{value:``,children:a?`所有领域`:`All verticals`}),D.map(e=>(0,K.jsx)(`option`,{value:e,children:on(e,i)},e))]}),s===`feed`&&(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`学习记录与文件更新分开展示。文件变更不等于知识已验证。`:`Learning records and file updates are separate. An update does not prove knowledge is verified.`}),s===`global`&&(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`跨项目共享的知识和方法;个人记录保留原私有范围,不会被共享。`:`Shared knowledge and methods across projects. Personal records retain their private scope.`})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:[h.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`知识无法加载。`:`Knowledge could not load.`,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void h.refetch(),children:a?`重试`:`Retry`})]}),g.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`技能无法加载。`:`Skills could not load.`,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void g.refetch(),children:a?`重试`:`Retry`})]}),h.data?.errors.length||g.data?.errors.length?(0,K.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-err`,children:a?`部分资料无法读取;已加载的内容仍可查看。`:`Some sources could not be read; loaded material remains available.`}):null,s===`feed`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`学习记录`:`Learning records`}),_.isPending&&(0,K.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载学习记录…`:`Loading learning records…`}),_.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`学习记录无法加载。`:`Learning records could not load.`,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void _.refetch(),children:a?`重试`:`Retry`})]}),_.data&&(0,K.jsx)(Mn,{events:_.data.events,items:h.data?.items??[],sid:e,projectNames:r,query:l,selected:b,onSelect:e=>{m(`knowledge/${e.scope}/${e.vertical}/${e.path}`)}}),(0,K.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`文件更新`:`File updates`})]}),(h.isPending||g.isPending)&&(0,K.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载资料…`:`Loading material…`}),!h.isPending&&!g.isPending&&!h.isError&&!g.isError&&!E.length&&(0,K.jsx)(`p`,{className:`p-3 text-sm text-ink-faint`,children:s===`project`&&!e?a?`选择一个项目以查看资料。`:`Select a project to see its material.`:a?`当前分类或筛选条件下没有资料。`:`No material matches this category or filter.`}),E.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>m(e.id),"aria-pressed":y?.id===e.id,className:`block w-full rounded-md px-3 py-3 text-left ${y?.id===e.id?`bg-blue/10`:`hover:bg-bg`}`,children:[(0,K.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-line/60 px-1.5 text-[10px] text-ink-dim`,children:k(e)}),(0,K.jsx)(`span`,{className:`break-words text-sm font-medium text-ink`,children:e.title})]}),e.description&&(0,K.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs text-ink-dim`,children:e.description}),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:O(e)}),e.updated>0&&(0,K.jsx)(`time`,{className:`mt-1 block text-[11px] text-ink-faint`,dateTime:new Date(e.updated*1e3).toISOString(),children:new Date(e.updated*1e3).toLocaleString(i)})]},e.id))]})]}),(0,K.jsx)(`article`,{className:`${y?`block`:`hidden md:block`} min-w-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:y?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`mb-4 text-sm text-blue md:hidden`,onClick:()=>m(null),children:a?`← 返回列表`:`← Back to the list`}),(0,K.jsx)(`h3`,{className:`break-words text-lg font-semibold text-ink`,children:y.title}),(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[k(y),` · `,O(y)]}),(0,K.jsx)(`p`,{className:`mt-1 break-all text-xs text-ink-faint`,children:y.path}),b&&(0,K.jsx)(Pn,{item:b}),S&&j&&(0,K.jsx)(Nn,{item:S,guide:j}),(0,K.jsx)(`div`,{className:`mt-5 border-t border-line/60 pt-5 text-sm text-ink`,children:y.kind===`knowledge`||y.kind===`skill`?(0,K.jsxs)(K.Fragment,{children:[A.isPending&&(0,K.jsx)(`p`,{children:a?`正在加载全文…`:`Loading document…`}),A.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`text-err`,children:[A.error.message,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void A.refetch(),children:a?`重试`:`Retry`})]}),b&&C.data?.truncated&&(0,K.jsx)(`p`,{role:`status`,className:`mb-3 text-xs text-ink-faint`,children:a?`页面过长,已截断显示。`:`Page shortened for display.`}),A.data&&(j?(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2 text-blue`,children:a?`查看原始技能文档`:`Read the original skill`}),(0,K.jsx)(Ke,{children:A.data.content})]}):(0,K.jsx)(Ke,{children:A.data.content}))]}):(0,K.jsx)(Ke,{children:y.content})})]}):(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-ink-faint`,children:[(0,K.jsx)(At,{size:18,"aria-hidden":`true`}),a?`选择资料,阅读原文与使用条件。查看不会执行技能。`:`Select material to read its original and conditions. Reading does not execute a skill.`]})})]})]})}var Yn=[{value:`copilot`,label:`settings.backendLabel.copilot`},{value:`codex`,label:`settings.backendLabel.codex`},{value:`claude`,label:`settings.backendLabel.claude`},{value:`cursor`,label:`settings.backendLabel.cursor`},{value:`opencode`,label:`settings.backendLabel.opencode`},{value:`pi`,label:`settings.backendLabel.pi`},{value:`grok`,label:`settings.backendLabel.grok`},{value:`qoder`,label:`settings.backendLabel.qoder`},{value:`dsh`,label:`settings.backendLabel.dsh`}],Xn={copilot:`copilot`,codex:`codex`,claude:`claude`,cursor:`cursor`,opencode:`opencode`,pi:`pi`,grok:`grok`,qoder:`qoder`,dsh:`dsh`};function Zn(e){return Xn[e]??``}function Qn(e,t){let n=Zn(e);return n?t(`settings.backendLabel.${n}`):e}function $n(e){return e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.value??e?.roles[0]?.backend??``}function er(e){let t=e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.source??``;return t===`env`||t===`persisted`||t==="default"?t:``}function tr(e){return(e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.saved??``).trim()}function nr(e){return typeof e==`string`&&/^[\p{L}\p{N}_-][\p{L}\p{N}_.-]{0,127}$/u.test(e)}function rr(e){return e===void 0?{}:nr(e)?{sessionId:e}:null}function ir(e,t){return typeof e==`string`?e.trim().slice(0,t):``}function ar(e,t){return ir(e,t*2).replace(/!?(?:\[([^\]]+)\])\([^)]+\)/g,`$1`).replace(/[*_`#]/g,``).replace(/\s+/g,` `).trim().slice(0,t)}function or(e){let t=ir(e.completionId,300),n=rr(e.sessionId);if(!t||!n)return null;let r=ir(e.path,1e3);return{...n,deliveryId:t,title:ar(e.title,240)||`已完成的任务`,summary:ar(e.summary,500),...r?{path:r}:{}}}function sr(e,t){let n=ir(e.delivery_id,300),r=rr(t);return!n||!r?null:{...r,deliveryId:n,title:ir(e.title,240)||`Argus`,summary:ir(e.summary,1e3),...e.primary_target?.path?{path:ir(e.primary_target.path,1e3)}:{}}}function cr(){return typeof window>`u`||window.parent===window?null:window.parent}function lr(){return cr()!==null}function ur(){cr()?.postMessage({type:`argus:show-trial-setup`},`*`)}function dr(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=ir(t.deliveryId,300),r=rr(t.sessionId);if(!n||!r)return null;let i=ir(t.path,1e3);return{...r,deliveryId:n,title:ir(t.title,240)||`Argus`,summary:ir(t.summary,1e3),...i?{path:i}:{}}}function fr(e){let t=dr(e),n=cr();return!t||!n?Promise.resolve(!1):(n.postMessage({type:`argus:notify-completion`,payload:t},`*`),Promise.resolve(!0))}function pr(e){let t=cr();t&&t.postMessage({type:`argus:large-preview`,payload:e},`*`)}function mr(e){let t=typeof window<`u`?window.location?.ancestorOrigins?.[0]:void 0;if(t&&t!==`null`)return e===t;if(typeof document<`u`&&document.referrer)try{let t=new URL(document.referrer);if(t.protocol===`http:`||t.protocol===`https:`)return e===t.origin;if(t.protocol===`tauri:`&&t.hostname===`localhost`)return e===`tauri://localhost`}catch{}return[`http://tauri.localhost`,`https://tauri.localhost`,`tauri://localhost`].includes(e)}function hr(e){let t=cr();if(!t)return()=>void 0;let n=n=>{if(n.source!==t||!mr(n.origin)||n.data?.type!==`argus:open-delivery`)return;let r=dr(n.data.payload);r&&e(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function gr(e){let t=cr();if(!t)return()=>void 0;let n=n=>{n.source===t&&n.data?.type===`argus:new-chat`&&e()};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function _r(){if(typeof document>`u`)return()=>void 0;let e=cr();if(!e)return()=>void 0;let t=t=>{if(t.defaultPrevented||t.button!==0&&t.button!==1)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null;if(!n)return;let r;try{r=new URL(n.href,window.location.href)}catch{return}r.origin===window.location.origin||![`http:`,`https:`].includes(r.protocol)||(t.preventDefault(),e.postMessage({type:`argus:open-external`,payload:r.toString()},`*`))},n=t=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.shiftKey||!(t.ctrlKey||t.metaKey))return;let n=t.key===`,`?`argus:show-setup`:t.key.toLowerCase()===`n`?`argus:request-new-chat`:null;n&&(t.preventDefault(),e.postMessage({type:n},`*`))},r=()=>e.postMessage({type:`argus:cockpit-interaction`},`*`);return document.addEventListener(`click`,t,!0),document.addEventListener(`auxclick`,t,!0),window.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r,{passive:!0}),()=>{document.removeEventListener(`click`,t,!0),document.removeEventListener(`auxclick`,t,!0),window.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}}var vr=21600,yr=e=>!e||[`auto`,`inherit`,`default`].includes(e.toLowerCase());function br({sid:e,roles:t,running:n,lastCall:r,onOpenSettings:i}){let{locale:a,t:o}=F(),{data:s}=xe(e,!0),c=a===`zh-CN`,l=(n?t.find(e=>e.active):void 0)??t.find(e=>e.role===`manager`),u=s?.trial_mode===!0,d=!!r&&(n||Date.now()/1e3-(r.ts||0)e.role===f.role):void 0,_=g&&g.backend&&g.backend!==f?.backend?g.backend:``,v=g&&!yr(g.model)&&g.model!==f?.model?g.model:``,y=_||v?[Qn(_||g.backend,o),v||g.model||`auto`].join(` · `):``,b=(0,K.jsxs)(K.Fragment,{children:[u?c?`试用`:`Trial`:p?Qn(p,o):c?`模型信息待确认`:`Model information unavailable`,m?` · ${m}`:``,h?` · ${h}`:``,!u&&!f&&n&&l?.active?` · ${ot(l.role)?Ae(l.role,o):l.role}`:``]}),x=f?c?`最近一次模型调用实际使用的后端、模型和推理强度;点击更改`:`Backend, model and effort the latest model call actually used; click to change`:c?`当前配置的后端与模型;点击更改`:`Configured backend and model; click to change`;return(0,K.jsxs)(`div`,{className:`composer-runtime`,"aria-label":c?`当前后端与模型`:`Current backend and model`,children:[i&&!u?(0,K.jsxs)(`button`,{type:`button`,className:`composer-runtime-model`,onClick:i,title:x,"data-runtime-open-settings":!0,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}):(0,K.jsxs)(`span`,{className:`composer-runtime-model`,title:u?void 0:x,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}),(0,K.jsxs)(`details`,{className:`composer-runtime-details`,children:[(0,K.jsx)(`summary`,{children:c?`运行信息`:`Runtime details`}),(0,K.jsx)(`div`,{children:b})]}),y?(0,K.jsx)(`span`,{className:`composer-runtime-next`,"data-runtime-next":!0,children:c?`下次使用:${y}`:`next call: ${y}`}):null,u&&lr()?(0,K.jsx)(`button`,{type:`button`,onClick:ur,children:c?`更换 Key`:`Change Key`}):null]})}function xr({session:e}){let{locale:t}=F(),n=t===`zh-CN`,r=n?`会话目录`:`Session directory`,i=e.workdir||e.cwd||(n?`待确认`:`Pending confirmation`);return(0,K.jsxs)(`details`,{className:`session-workdir`,"data-session-workdir":!0,children:[(0,K.jsxs)(`summary`,{title:`${r}: ${i}`,"aria-label":`${r}: ${i}`,children:[(0,K.jsx)(`span`,{children:r}),(0,K.jsx)(`code`,{children:i})]}),(0,K.jsxs)(`div`,{className:`session-workdir__detail`,children:[(0,K.jsx)(`strong`,{children:r}),(0,K.jsx)(`code`,{children:i}),(0,K.jsx)(`p`,{children:n?`来自已加载会话快照的工作目录;不是每个任务的实际 cwd,也不是安全沙箱边界。`:`Working directory from the loaded session snapshot; not each task’s actual cwd or a security sandbox boundary.`})]})]})}function Sr(e){return!Number.isFinite(e)||e<=0?`$0.00`:e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(3)}`}function Cr({settledUsd:e,knownUsd:t=0,status:n=`empty`}){let r=typeof e==`number`&&Number.isFinite(e)?e:t,i=n===`partial`||n===`unpriced`;return`${Sr(Math.max(0,r||0))}${i?`+`:``}`}function wr({settledUsd:e,knownUsd:t,status:n,calls:r=0,premiumRequests:i=0,live:a=!1,compact:o=!1}){let s=Cr({settledUsd:e,knownUsd:t,status:n}),c=[`Cumulative settled project spend`,`${r} model call${r===1?``:`s`}`,i>0?`${i.toFixed(1)} premium requests`:``,n&&n!==`empty`?`pricing: ${n}`:``].filter(Boolean).join(` · `);return(0,K.jsxs)(`span`,{title:c,"aria-label":`Project spend ${s}`,className:`inline-flex shrink-0 items-center rounded-full border border-gold/25 bg-gold/8 font-mono tabular-nums text-gold ${o?`h-6 gap-1 px-2 text-[10px]`:`h-5 gap-1 px-1.5 text-[9px]`}`,children:[a?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-gold/80`}):null,(0,K.jsx)(`span`,{children:s})]})}var Tr=e=>String(e??``).trim(),Er=/^[a-z][a-z -]+ requires an operator-owned decision before continuing\.?$/i,Dr=e=>{let t=Tr(e);return Er.test(t)?``:t},Or=(e,t)=>{let n=/[\u3400-\u9fff]/.test(`${e}\n${t}`);return{id:`custom`,label:n?`自己输入`:`Write my own answer`,description:n?`直接告诉 Argus 你的决定。`:`Tell Argus your decision directly.`,requires_note:!0}};function kr(e,t,n){let r=[...e,...t],i=new Map(t.map(e=>[Tr(e.id),e])),a=(e,t)=>{let n=i.get(e)??(Tr(t.id)===e?t:void 0);return{task_title:Tr(n?.title)||void 0,task_status:Tr(n?.status)||void 0}},o=[],s=new Set;for(let e of r){let t=Tr(e.id),n=e.operator_decision;if(n&&typeof n==`object`&&!Array.isArray(n)){let r=n,i=Tr(r.id);if(!i||s.has(i)||Tr(r.status)!==`pending`)continue;s.add(i);let c=Tr(r.options_source),l=r.kind===`domain_intake`,u=(c===`agent`||l&&c===`workflow`)&&Array.isArray(r.options)?r.options.filter(e=>!!Tr(e?.id)&&!!Tr(e?.label)).map(e=>({...e,requires_note:e.requires_note===!0})):[];u.some(e=>e.id===`custom`)||u.push(Or(Tr(r.title),Tr(r.question)));let d=Tr(r.item_id)||t;o.push({id:i,...l?{kind:`domain_intake`}:{},item_id:d,revision:Number(r.revision??1),status:`pending`,title:Tr(r.title)||Tr(e.title)||`Decision required`,reason:Dr(r.reason),question:Tr(r.question)||Tr(e.pending_question),evidence:Array.isArray(r.evidence)?r.evidence.filter(e=>Tr(e?.label)!==`Acceptance check`):[],options:u,options_source:l?`workflow`:u.length?`agent`:`none`,selected_option:``,note:``,...a(d,e),...l?{task_title:Tr(r.task_title),task_status:void 0}:{},...typeof r.asked_at==`number`&&Number.isFinite(r.asked_at)&&r.asked_at>0?{asked_at:r.asked_at}:{}});continue}let r=Tr(e.pending_question??e.question??e.text);if(!t||!r)continue;let i=`legacy-${t}`;s.has(i)||(s.add(i),o.push({id:i,item_id:t,revision:1,status:`pending`,title:Tr(e.title??e.objective)||`Blocked task`,reason:``,question:r,evidence:[],options:[Or(Tr(e.title??e.objective),r)],options_source:`none`,selected_option:``,note:``,legacy:!0,...a(t,e)}))}if(!n)return o;let c=o.map(e=>({...e,is_current_task:e.kind===`domain_intake`?void 0:e.item_id===n}));return[...c.filter(e=>e.kind===`domain_intake`),...c.filter(e=>e.is_current_task),...c.filter(e=>e.kind!==`domain_intake`&&!e.is_current_task)]}function Ar(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function jr(e,t,n=``){let r=Ar(n,70);switch(e){case`manager`:return t?`正在整理任务进展`:`Summarizing progress`;case`planner`:return t?`正在安排接下来要做的事`:`Planning what to do next`;case`reviewer`:return r?t?`正在检查结果:${r}`:`Checking the result: ${r}`:t?`正在检查结果是否正确`:`Checking whether the result is correct`;default:return r?t?`正在处理:${r}`:`Working on: ${r}`:t?`正在处理当前任务`:`Working on the current task`}}var Mr=new Set([`running`,`in_progress`,`claimed`,`active`,`working`,`grounding`,`framed`]),Nr=new Set([`complete`,`completed`,`done`,`success`,`ended`]),Pr=new Set([`paused`,`stopped`,`cancelled`,`aborted`,`incomplete`,`blocked`,`stalled`]),Fr=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:null;function Ir(e){return String(e.item_id||e.mission_id||``).split(`:attempt:`)[0]}function Lr(e,t,n){let r=e?.backlog?.find(e=>e.id===n),i=Date.parse(e?.daemon.started_at_iso||``)/1e3;return Math.max(t?.mission.id===n&&t.mission.started_at||0,r?.started_ts||0,Number.isFinite(i)?i:0)}function Rr(e,t=0){let n=new Map;for(let r of e){if(Number(r.ts||0)zr.has(String(e.type||``))&&Ir(e)===t.id&&Number(e.ts||0)>=r);e?.type===`round.external_work_wait.started`&&(i=String(e.work_id||``)),a=e?.type===`round.external_work_wait.completed`}else return null;if(a)return null;let o=(e.background_work||[]).find(e=>i&&e.work_id===i||e.waited_by?.includes(t.id));return o?{workId:o.work_id,parts:(o.parts||[]).map(e=>({role:e.role,done:e.done,total:e.total,running:e.running})),done:o.done,total:o.total,lastProgressAt:Fr(o.last_progress_ts)}:i?{workId:i,parts:[],done:0,total:0,lastProgressAt:null}:null}function Vr(e,t,n=[],r=Date.now()/1e3){let i=t?.mission.id||e?.backlog?.find(e=>Mr.has(e.status)||e.status===`paused_external_work`)?.id||``,a=e?.backlog?.find(e=>e.id===i),o=Lr(e,t,i),s=e?.roles?.filter(e=>e.active)||[],c=(e?.backlog?.filter(e=>Mr.has(e.status)).length||0)>1,l=new Map;for(let e of t?.role_work||[])i&&(e.item_id||e.mission_id)!==i||e.tsMr.has(e.status)).sort((e,t)=>t.ts-e.ts).find(e=>s.some(t=>t.role===e.role))?.role||(c?``:(s.find(e=>e.role===t?.active_role)||s[0])?.role)||(e?``:t?.roles.find(e=>e.status===`active`)?.role)||``,d=n.filter(e=>{let t=Ir(e);return(!i||t===i)&&Number(e.ts||0)>=o&&!String(e.run_label||``).startsWith(`map-summary`)&&/(?:progress|round\.(?:main|review)|life\.(?:mission|phase)|work\.segment)/.test(String(e.type||``))}).map(e=>Fr(e.ts));for(let e of t?.role_work||[]){let t=e.item_id||e.mission_id;(!i||t===i)&&e.ts>=o&&e.kind!==`waiting`&&![`waiting`,`idle`].includes(e.status)&&d.push(Fr(e.ts))}let f=d.filter(e=>e!==null&&e<=r+5),p=f.length?Math.max(...f):null,m={state:`idle`,role:u,taskId:i,title:t?.mission.title||a?.title||t?.mission.objective||``,activityAt:p,activityAgeSeconds:p===null?null:Math.max(0,r-p),reason:``};if(!e||e.daemon.read_status===`error`)return{...m,state:`unknown`};if(e.manager_requests?.some(e=>e.status===`running`)??!1){let e=Fr(Rr(n)?.ts)??p;return{...m,state:`running`,role:`manager`,foreground:!0,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}if(!i){let e=[...n].reverse().find(e=>e.type===`ui.argus`&&e.mission_result===!0&&!e.item_id&&e.live!==!0);if(e){let t=Fr(e.ts);return{...m,state:`step_finished`,activityAt:t,activityAgeSeconds:t===null?null:Math.max(0,r-t),reason:e.success===!1?`task_failed`:``}}}let h=Br(e,a,n,o);if(h){let e=h.lastProgressAt??p;return{...m,state:`waiting`,role:``,reason:`background_work`,waitingOn:h,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}let g=String(a?.status||t?.mission.status||``).toLowerCase();if(Pr.has(g)||g.startsWith(`paused_`)||g===`research_incomplete`){let t=kr(e.pending_questions??[],e.backlog.map(e=>({...e})),i).some(e=>e.item_id===i);return{...m,state:`paused`,role:``,reason:t?`operator_input`:`not_running`}}if([`failed`,`error`].includes(g))return{...m,state:`step_finished`,role:``,reason:`task_failed`};if(Nr.has(g))return e.daemon.alive&&s.some(e=>e.role===`planner`)?{...m,state:`running`,role:`planner`}:{...m,role:``,state:e.daemon.alive&&(t?.routing?.continuous||e.continuous?.enabled)?`waiting`:`step_finished`};if(!e.daemon.alive)return Mr.has(g)?{...m,state:`paused`,role:``,reason:`not_running`}:{...m,role:``};let _=[...n].reverse().find(e=>e.type===`round.backend_failure.backoff`&&Number(e.ts||0)>=o&&(!i||Ir(e)===i));return _&&Number(_.ts||0)+Number(_.seconds||0)>r&&Number(_.ts||0)>=(p||0)?{...m,state:`waiting`,reason:`provider_wait`}:e.daemon.health?.stalled?{...m,state:`waiting`,reason:`no_recent_progress`}:u?{...m,state:`running`}:c&&s.length>0&&i?{...m,state:`unknown`}:{...m,state:`waiting`,reason:`awaiting_next_step`}}function Hr(e,t){let n=t===`zh-CN`;return e===null?``:e<60?n?`刚刚`:`just now`:e<3600?n?`${Math.floor(e/60)} 分钟前`:`${Math.floor(e/60)} min ago`:n?`${Math.floor(e/3600)} 小时前`:`${Math.floor(e/3600)} hr ago`}var Ur={"idea-route":[`条研究路线`,[`research route`,`research routes`]],"idea-review":[`次独立复核`,[`independent review`,`independent reviews`]],"idea-selector":[`次方案选择`,[`idea selection`,`idea selections`]]};function Wr(e,t){if(!e.total)return``;let[n,[r,i]]=Ur[e.role]??[`项子任务`,[`subtask`,`subtasks`]],a=e.total===1?r:i;return e.done===e.total?t?`${e.total} ${n}全部完成`:`all ${e.total} ${a} done`:t?`${e.total} ${n}中 ${e.done} ${n.slice(0,1)}完成`:`${e.done} of ${e.total} ${a} done`}function Gr(e,t){let n=t===`zh-CN`,r=e.waitingOn,i=(r?.parts??[]).map(e=>Wr(e,n)).filter(Boolean),a=i.length?i.join(n?`、`:`, `):r?.total?n?`${r.total} 项子任务中 ${r.done} 项完成`:`${r.done} of ${r.total} subtasks done`:``,o=Hr(e.activityAgeSeconds,t),s=o?n?o===`刚刚`?`,最近一次进展就在刚刚`:`,最近一次进展在 ${o}`:`, last progress ${o}`:``;return a?n?`正在等待后台团队:${a}${s}`:`Waiting for the background team: ${a}${s}`:n?`正在等待后台团队完成工作${s}`:`Waiting for the background team to finish${s}`}function Kr(e,t,n=!0){let r=t===`zh-CN`;return n?e.reason===`operator_input`?r?`当前任务等待你的回复`:`This task is waiting for your reply`:e.reason===`task_failed`?r?`这一步执行未完成`:`Execution of this step did not finish`:e.reason===`background_work`?Gr(e,t):e.state===`running`?e.foreground?r?`正在处理你的请求`:`Working on your request`:jr(e.role,r,e.title):e.reason===`provider_wait`?r?`模型服务暂时未能完成请求,等待后会重试`:`The model service could not complete the request; waiting before retrying`:e.reason===`no_recent_progress`?r?`暂时没有收到新的进展`:`No new progress received recently`:{running:[`正在处理当前任务`,`Working on the current task`],waiting:[`等待下一步工作`,`Waiting for the next step`],paused:[`当前任务未在运行`,`The current task is not running`],step_finished:[`这一步已结束`,`This step has ended`],idle:[`可以开始新任务`,`Ready for a new task`],unknown:[`暂时无法确认任务进度`,`Unable to confirm task progress right now`]}[e.state][+!r]:r?`实时连接已断开`:`Live connection lost`}var qr=new Set([`grounding`,`task`,`decision`,`agent_message`,`assistant_message`,`command_execution`,`tool_use`,`tool_result`,`handoff`,`review`,`verdict`,`completion`,`plan`,`file_change`,`result`]),Jr=/^(using a tool|running project command|inspecting project state|working|reporting progress|暂无详细记录)$/i;function Yr(e){let t=Te(e).replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/gim,``).trim();return Jr.test(t)||t.startsWith(`{`)?``:t}function Xr(e,t,n=``){if(n){if(/^(?:rg|grep|glob|search)$/.test(n))return t?`检索项目文件`:`Searching project files`;if(/^(?:view|read|read_file)$/.test(n))return t?`读取文件`:`Reading a file`;if(/apply_patch|edit|write/.test(n))return t?`编辑文件`:`Editing a file`;if(/bash|shell|exec|terminal/.test(n))return t?`运行终端命令`:`Running a command`;if(/playwright|browser/.test(n))return t?`检查浏览器交互`:`Checking browser interactions`}return({grounding:[`理解任务与检查项目`,`Understanding the task`],task:[`安排任务`,`Task assignment`],decision:[`确定执行方案`,`Execution decision`],plan:[`制定执行计划`,`Planning the work`],agent_message:[`更新执行进度`,`Progress update`],assistant_message:[`更新执行进度`,`Progress update`],command_execution:[`运行项目命令`,`Running a project command`],tool_use:[`使用工具`,`Using a tool`],tool_result:[`工具输出`,`Tool output`],file_change:[`更新项目文件`,`Updating project files`],handoff:[`整理结果与后续工作`,`Summarizing results and next steps`],review:[`检查实现与结果`,`Checking implementation and results`],verdict:[`说明检查结果`,`Explaining the check result`],completion:[`完成任务`,`Task completed`],result:[`产出结果`,`Result`]}[e]??[`处理当前任务`,`Working on the current task`])[+!t]}function Zr(e,t,n,r=0){let i=new Map;for(let a of e?.role_work??[]){if(a.role!==t||!qr.has(a.kind)||a.tst.ts-e.ts)}function Qr(e,t,n,r=0){return[...e].reverse().find(e=>e.type===`engineer.progress`&&Number(e.ts||0)>=r&&[`tool_use`,`command_execution`,`file_change`].includes(String(e.kind))&&String(e.agent_layer||e.actor||e.role)===t&&(!n||String(e.item_id||e.mission_id)===n))}function $r(e,t,n,r,i){return r||[`done`,`completed`,`failed`,`aborted`,`stopped`].includes(e?.mission.status??``)||i&&e?.mission.id!==i?!1:t.length?t.some(e=>e.role===n&&e.active):e?.active_role===n&&[`working`,`grounding`,`framed`,`running`].includes(e?.mission.status??``)}function ei(e,t){let n=Math.max(0,Math.floor(e));if(n<30)return``;let[r,i,a]=n<60?[n,`秒`,`s`]:n<3600?[Math.floor(n/60),`分钟`,`m`]:n<86400?[Math.floor(n/3600),`小时`,`h`]:[Math.floor(n/86400),`天`,`d`];return t?`上次更新 ${r} ${i}前`:`last update ${r}${a} ago`}function ti(e,t,n,r,i=!0,a=0){let o=Kr(e,r,i);if(!i||e.state!==`running`||e.foreground||!e.taskId||!e.role)return o;let s=Math.max(a,t?.mission.id===e.taskId&&t.mission.started_at||0),c=Zr(t,e.role,e.taskId,s).find(e=>e.detail&&[`agent_message`,`assistant_message`].includes(e.kind)||[`tool_use`,`command_execution`,`file_change`].includes(e.kind)),l=Qr(n,e.role,e.taskId,s);if(c?.detail&&[`agent_message`,`assistant_message`].includes(c.kind)&&(!l||Number(l.ts||0)=c.ts)){let t=Xr(String(l.kind),r===`zh-CN`,String(l.tool_name||``));return e.title?`${t}${r===`zh-CN`?`:`:`: `}${Ar(e.title,70)}`:t}return c&&[`tool_use`,`command_execution`,`file_change`].includes(c.kind)?Xr(c.kind,r===`zh-CN`):o}var ni=new Set([`running`,`in_progress`,`claimed`]);function ri({snap:e,streamOk:t,onStart:n,onStop:r,onManage:i,onOpenSessions:a,mobileView:o,onToggleMobileView:c,busy:l,snapshotStale:u=!1,readOnly:f=!1,missionView:p,events:h=[]}){let{t:g,locale:_}=F(),v=Vr(e,p,h),y=ti(v,p,h,_,t,Lr(e,p,v.taskId)),b=[`complete`,`completed`,`done`,`success`].includes(String(p?.mission.status||``).toLowerCase()),x=v.role||`manager`,S=v.state===`running`&&t&&!u,C=e.backlog.find(e=>ni.has(e.status)),w=v.title||C?.title||C?.objective||(b?p?.mission.summary||p?.mission.title:``)||e.session.objective||``,T=!!(e.partial||e.observability?.slo.status===`degraded`),E=typeof e.spend_usd==`number`?e.spend_usd:e.usage_summary?.known_cost_usd??0,D=e.daemon.alive&&e.daemon.control_available===!1,O=!e.daemon.alive&&[`running`,`waiting`].includes(Vr(e,p,h).state),k=D?g(`topbar.externallyManaged`):e.daemon.alive?g(`topbar.pauseDaemon`):g(O?`topbar.working`:`topbar.runDaemon`),A=T?[...(e.diagnostics??[]).map(e=>`${e.section}: ${e.message}`),...e.observability?.slo.violations??[]].join(` +`)||g(`common.degraded`):g(u?`common.stale`:t?`common.live`:`common.reconnecting`);return(0,K.jsxs)(it,{children:[a?(0,K.jsx)(`button`,{type:`button`,onClick:a,"aria-label":g(`topbar.openSessions`),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-ink-faint hover:bg-bg hover:text-ink lg:hidden`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,K.jsx)(`path`,{d:`M2.5 4h11M2.5 8h11M2.5 12h11`})})}):null,(0,K.jsxs)(`div`,{className:`topbar-heading flex min-w-0 flex-1 flex-col justify-center gap-0.5`,children:[(0,K.jsx)(`div`,{className:`topbar-title min-w-0 truncate text-sm font-semibold text-ink`,title:e.session.display_name||e.session.id,children:e.session.display_name||e.session.id}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[S?(0,K.jsx)(`span`,{"data-role-dot":x,"aria-label":g(`topbar.roleActive`,{role:yn(x,g)}),className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:R.role[x]||`rgb(var(--ink-faint))`}}):null,S||w?(0,K.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-ink-dim`,title:y,children:t?u?g(`common.stale`):y:g(`common.reconnecting`)}):null,(0,K.jsx)(xr,{session:e.session})]})]}),(0,K.jsx)(`span`,{title:A,className:`h-2 w-2 shrink-0 rounded-full transition-shadow duration-150 ${T||u?`bg-err ring-1 ring-err/30 ring-offset-1 ring-offset-panel`:t?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,children:(0,K.jsx)(`span`,{className:`sr-only`,children:A})}),E>0?(0,K.jsx)(wr,{settledUsd:e.spend_usd,knownUsd:e.usage_summary?.known_cost_usd,status:e.spend_status,calls:e.usage_summary?.call_count,premiumRequests:e.usage_summary?.premium_requests,live:e.daemon.alive,compact:!0}):null,c?(0,K.jsx)(`button`,{type:`button`,onClick:c,"aria-label":g(o===`activity`?`topbar.showPreview`:`topbar.showActivity`),title:g(o===`activity`?`topbar.showPreview`:`topbar.showActivity`),className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center lg:hidden`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:o===`activity`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`11`,rx:`1.5`}),(0,K.jsx)(`path`,{d:`M9.5 2.75v10.5`})]}):(0,K.jsx)(`path`,{d:`M3 4h10M3 8h10M3 12h7`})})}):null,f?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,disabled:l||D||O,onClick:e.daemon.alive?r:n,"aria-label":k,title:D?g(`topbar.externalDaemonHint`):k,className:`compact-control flex h-8 shrink-0 items-center gap-1 px-2 disabled:opacity-40`,children:[(0,K.jsx)(s,{icon:e.daemon.alive?m:d,className:`h-3 w-3`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:D?g(`common.external`):e.daemon.alive?g(`common.pause`):g(O?`common.working`:`common.run`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":g(`topbar.manageSession`),title:g(`topbar.manageSession`),onClick:i,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center text-sm tracking-widest`,children:`···`})]})]})}var ii=new Set([`done`,`success`,`completed`]),ai=new Set([`research_incomplete`,`paused_no_breakthrough`,`exhausted_current_methods`]),oi=new Set([`no_progress`,`max_rounds`]),si=new Set([`blocked`,`infra_blocked`]),ci=new Set([`error`,`failed`,`supervisor_error`]),li={completed:{glyph:`🎉`,tone:`ok`,missionStatus:`complete`},incomplete:{glyph:`◌`,tone:`warn`,missionStatus:`incomplete`},stalled:{glyph:`⏸`,tone:`warn`,missionStatus:`stalled`},blocked:{glyph:`⛔`,tone:`err`,missionStatus:`blocked`},failed:{glyph:`💥`,tone:`err`,missionStatus:`failed`},ended:{glyph:`■`,tone:`info`,missionStatus:`ended`}},ui={completed:`mission_completed`,incomplete:`mission_incomplete`,stalled:`mission_stalled`,blocked:`mission_blocked`,failed:`mission_failed`,ended:`mission_ended`},di={mission_completed:`The task was completed.`,mission_continued:`The task was completed and the project continues with the next one.`,mission_certified:`The final submission was checked and approved.`,mission_incomplete:`The task stopped with work still remaining.`,mission_stalled:`The task stopped because recent rounds made no useful progress.`,mission_blocked:`The task cannot continue until something outside it is resolved.`,mission_failed:`The task could not be completed.`,mission_paused:`The task was paused before it finished because {why}; its progress is saved and it can be resumed.`,mission_ended:`The task ended without a recorded outcome.`},fi={budget_exhausted:`the project reached its budget limit`,provider_cooldown:`the model service asked Argus to wait before calling again`,provider_fence:`the model provider is not accepting calls right now`,daemon_shutdown:`Argus was stopped`,operator_pause:`the operator paused the work`,operator_abort:`the operator cancelled the task`,backend_unavailable:`the model service was unavailable`,transient_error:`a temporary error interrupted the call`,permanent_error:`an error that will not clear on its own stopped the call`},pi={paused_budget:`budget_exhausted`,paused_provider_cooldown:`provider_cooldown`,paused_provider_fence:`provider_fence`,paused_daemon_shutdown:`daemon_shutdown`,paused_operator:`operator_pause`};function mi(e){return String(e??``).trim().toLowerCase()}function hi(e,t){if(e===`paused_external_work`)return`work outside Argus had to finish first`;let n=pi[e];return n?fi[n]:fi[t]?fi[t]:e.startsWith(`paused_`)?`the work was paused`:`the work was interrupted`}function gi(e){let t=mi(e);switch(t){case`completed`:case`incomplete`:case`stalled`:case`blocked`:case`failed`:case`ended`:return t;default:return null}}function _i(e){let t=mi(e.status);return e.success===!0||ii.has(t)?`completed`:ai.has(t)?`incomplete`:oi.has(t)?`stalled`:si.has(t)?`blocked`:ci.has(t)?`failed`:`ended`}function vi(e){let t=e.outcome;if(t&&typeof t==`object`&&!Array.isArray(t)){let n=t;return{execution_status:mi(n.execution_status)||_i(e),review_status:mi(n.review_status)||`not_assessed`,stage_certification:mi(n.stage_certification)||`not_assessed`,interruption_kind:mi(n.interruption_kind)||`none`,resumable:n.resumable===!0}}return{execution_status:_i(e),review_status:`not_assessed`,stage_certification:`not_assessed`,interruption_kind:mi(e.stop_kind)||`none`,resumable:e.resumable===!0}}function yi(e){if(e.success===!0&&e.campaign_continues===!0)return{outcomeClass:`completed`,kind:`mission_continued`,label:di.mission_continued,glyph:`↻`,tone:`info`,missionStatus:`continued`,technical:``};let t=gi(e.outcome_class)??_i(e),n=mi(e.status),r=li[t],i=ui[t],a=di[i],o=``;if(t===`completed`&&e.final_submission_certified===!0)i=`mission_certified`,a=di.mission_certified;else if(t===`ended`&&(o=String(e.status??``).trim(),n.startsWith(`paused_`)||e.resumable===!0)){let t=e.outcome&&typeof e.outcome==`object`&&!Array.isArray(e.outcome)?e.outcome:{},r=mi(e.stop_kind)||mi(t.interruption_kind);i=`mission_paused`,a=di.mission_paused.replace(`{why}`,hi(n,r))}return{outcomeClass:t,kind:i,label:a,glyph:r.glyph,tone:r.tone,missionStatus:r.missionStatus,technical:o}}function bi(e,t){let n=typeof e==`string`?e.trim():``;return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function xi(e,t){let n=t===`zh-CN`,r=bi(e.route,40),i=bi(e.workflow_mode,40),a=bi(e.execution_task,160),o;o=r===`self`?n?`计划由 Manager 直接处理`:`Manager plans to handle this request`:i===`staged`?r===`team`?n?`计划由团队分阶段推进`:`The team plans to work in stages`:n?`计划分阶段推进`:`The plan is to work in stages`:i===`direct`?r===`team`?n?`计划由团队直接处理`:`The team plans to handle this task directly`:n?`计划直接处理这项工作`:`The plan is to handle this task directly`:n?`处理方案已确定`:`A plan is ready`,a&&(o+=`${n?`:`:`: `}${a}`);let s=``;e.lifetime===`standing`&&e.open_ended!==!1||!e.lifetime&&e.open_ended===!0?s=n?`持续跟进后续工作。`:`Keep following up on subsequent work.`:e.lifetime===`bounded_increment`?s=n?`本次只推进一个明确的增量。`:`Limit this run to one defined increment.`:e.lifetime===`bounded`&&(s=e.continuous===!0&&e.open_ended===!1?n?`完成这次目标后结束。`:`Finish once this objective is met.`:n?`范围限于本次目标。`:`Keep the work within this objective.`);let c=bi(e.reason,320),l=c&&!/^(?:\[manager\]|manager routed\b|\{)/i.test(c)&&c!==(bi(e.execution_task,320)||bi(e.objective,320))?c:``;return[o,[s,l].filter(Boolean).join(n?``:` `)].filter(Boolean).join(` +`)}function Si(e){let t=e;return t=t.replace(/^(\s*(?:authorization|proxy-authorization)\s*:).*$/gim,`$1 `),t=t.replace(/^(\s*(?:x-api-key|api-key|cookie|set-cookie)\s*:).*$/gim,`$1 `),t=t.replace(/gh[pousr]_[A-Za-z0-9]{20,}/g,``).replace(/xox[baprs]-[A-Za-z0-9-]{10,}/g,``).replace(/AKIA[0-9A-Z]{16}/g,``).replace(/\bbearer\s+[A-Za-z0-9._\-+/=]{16,}/gi,``).replace(/(?`).replace(/(?`).replace(/\b([a-z][a-z0-9+.\-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi,`$1@`),{text:e,sensitive:t!==e}}function Ci(e){return Si(Te(e))}function q(e,t){let n=String(e??``).replace(/```[a-z]*\n?/gi,``).replace(/\[([^\]]+)\]\([^)]+\)/g,`[$1]`).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}var J=e=>e,Y=(e,t)=>String(J(e)[t]??``);function wi(e,t){return`${e} ${t}${e===1?``:`s`}`}function X(e,t,n){return e.locale===`zh-CN`?n:t}function Ti(e,t){let n=Y(e,`error_code`),r=Y(e,`failure_stage`),i=Y(e,`stop_kind`),a=[`daemon_shutdown`,`operator_pause`,`operator_abort`].includes(i);if(n===`cancelled`&&r===`commit`&&Y(e,`status`)===`issued`)return{text:X(t,`Applying the adjustment was interrupted; the saved decision is waiting to be applied.`,`应用调整时被中断,已保存的决定等待继续处理。`),tone:`warn`};if(n===`timeout`&&r===`commit`)return{text:X(t,`Manager reached a decision, but applying the adjustment timed out.`,`Manager 已作出判断,但应用调整超时。`),tone:`warn`};let o={trial_quota_exceeded:[`The remaining trial quota cannot cover this Manager check.`,`剩余试用额度不足以启动这次 Manager 检查。`],observation_incomplete:[`Manager could not fully read the required project evidence; this check has stopped.`,`Manager 未能完整读取所需的项目资料,这次检查已停止。`],timeout:[`The model did not respond before the Manager check timed out.`,`模型未在时限内返回,Manager 这次检查已结束。`],cancelled:[`This Manager check was cancelled.`,`已取消这次 Manager 检查。`],superseded:[`New input or evidence superseded this Manager check.`,`新的操作或证据已取代这次 Manager 检查。`]};if(Object.hasOwn(o,n)&&!(n===`cancelled`&&a))return{text:X(t,...o[n]),tone:n===`cancelled`||n===`superseded`?`dim`:`warn`};let s={budget_exhausted:[`The project budget limit prevented this Manager check.`,`项目预算已达上限,Manager 暂未完成检查。`],provider_cooldown:[`The model service asked Manager to wait before calling again.`,`模型服务要求稍后再调用,Manager 暂未完成检查。`],provider_fence:[`The model service is not accepting calls; Manager could not finish this check.`,`模型服务当前不接受调用,Manager 未完成这次检查。`],backend_unavailable:[`The model service was unavailable for this Manager check.`,`模型服务不可用,Manager 未完成这次检查。`],transient_error:[`A temporary model service error interrupted this Manager check.`,`模型服务的临时错误中断了这次 Manager 检查。`],permanent_error:[`The model call failed; Manager could not finish this check.`,`模型调用失败,Manager 未完成这次检查。`],daemon_shutdown:[`Argus stopped, ending this Manager check.`,`Argus 已停止,这次 Manager 检查已结束。`],operator_pause:[`This Manager check was paused by your request.`,`已按你的要求暂停这次 Manager 检查。`],operator_abort:[`This Manager check was cancelled by your request.`,`已按你的要求取消这次 Manager 检查。`]};if(Object.hasOwn(s,i))return{text:X(t,...s[i]),tone:a?`dim`:`warn`};let c=Y(e,`status`);return c===`cancelled`||c===`superseded`?{text:X(t,`This Manager check was cancelled.`,`这次 Manager 检查已取消。`),tone:`dim`}:{text:r===`commit`&&[`continue`,`wait`,`steer`].includes(Y(e,`action`))?X(t,`Manager reached a decision, but the team adjustment could not be applied.`,`Manager 已作出判断,但团队调整未能生效。`):r===`decision`?X(t,`Manager returned a decision that could not be validated.`,`Manager 返回的判断或引用依据未通过核验。`):X(t,`Manager could not finish this check.`,`Manager 未能完成这次检查。`),tone:`warn`}}function Z(e,t,n,r,i,a={}){let o=Ci(r);return{visibility:a.visibility??(i===`err`||i===`warn`?`alert`:`normal`),role:e,labelKey:t,glyph:n,tone:i,segments:o.text?[{kind:`text`,text:o.text}]:[],expandable:a.expandable===!0,sensitive:o.sensitive||a.sensitive===!0,fallback:a.fallback===!0,rule:a.rule===!0,reasoning:a.reasoning===!0}}function Ei(){return{visibility:`hidden`,role:`system`,labelKey:`event.hidden`,glyph:``,tone:`dim`,segments:[],expandable:!1,sensitive:!1,fallback:!1,rule:!1,reasoning:!1}}function Di(e,t){if(J(e).operator_alert===!0){let n=q(Y(e,`text`)||Y(e,`reason`)||e.type,170);return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,n,`err`,{rule:!0})}if(t.unknownEventPolicy===`hide`)return Ei();let n=String(e.type||`?`),r=Y(e,`text`).trim();return Z(`system`,`event.fallback`,`•`,`[${n}]${r?` ${r}`:``}`,`dim`,{fallback:!0})}function Oi(e,t=`engineer`){return Y(e,`agent_layer`)||(e.type.startsWith(`life.manager.`)?`manager`:e.type.startsWith(`life.planner.`)?`planner`:e.type.startsWith(`round.review.`)?`reviewer`:t)}function ki(e,t){let n=Y(e,`phase`),r=Y(e,`cause`)||Y(e,`backend_error`),i=Y(e,`error`);if(!n||!r)return`${X(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} ${q(i,t.density===`full`?160:140)}`;let a={backend:[`model service`,`模型服务`],parse:[`reading the answer`,`读取回答`],contract:[`answer shape:`,`回答格式:`],timeout:[`timed out`,`超时`]},o=a[n]?X(t,a[n][0],a[n][1]):n,s=Number(J(e).attempts||0),c=s>1?X(t,` (attempt ${s})`,` (第${s}次尝试)`):``,l=`${X(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} · ${o} ${r}${c}`;return i?`${l} · ${X(t,`error text`,`原始错误`)}: ${i}`:l}function Ai(e){let t=J(e).round_index??J(e).round;return typeof t==`string`||typeof t==`number`?t:`?`}function ji(e,t){let n=Y(e,`kind`),r=Oi(e),i=`role.${r}`;if(n===`reasoning`){if(!t.showReasoning)return Ei();let n=q(Y(e,`text`),280);return n?Z(r,i,`∴`,n,`dim`,{expandable:t.density===`full`,reasoning:!0}):Ei()}if(n===`assistant_message`||n===`agent_message`||n===`message`){if(te(J(e)))return Di(e,t);let n=Ci(Y(e,`text`));return n.text?Z(r,i,`▌`,n.text,`bright`,{expandable:t.density===`full`,sensitive:n.sensitive}):Ei()}if(n===`command_execution`){let n=Y(e,`text`)||Y(e,`command`)||Y(e,`action_summary`),a=Y(e,`status`)===`failed`?`err`:`dim`;return n?Z(r,i,`▸ $`,n,a,{expandable:t.density===`full`}):Ei()}if(n===`tool_use`||n===`file_change`){let a=Y(e,`text`)||Y(e,`action_summary`);if(!a&&t.density===`full`)return Ei();let o=n===`file_change`?X(t,`(file change)`,`(文件变更)`):X(t,`(tool)`,`(工具)`);return Z(r,i,n===`file_change`?`✎`:`⚙`,a||o,Y(e,`status`)===`failed`?`err`:`dim`,{expandable:t.density===`full`})}if(t.density===`full`)return Ei();let a=String(J(e).text??J(e).action_summary??``).split(` +`)[0]?.trim()??``;return a?Z(r,i,`▸`,q(a,160),`dim`):Ei()}function Mi(e,t){let n=A(J(e).canonical_type??e.type);if(n&&n!==e.type)return Mi({...e,type:n},t);switch(e.type){case`advisor.consultation.requested`:case`life.manager.supervision.issued`:return Ei();case`advisor.consultation.completed`:{let t=Y(e,`question`).trim(),n=Y(e,`summary`).trim();return!t&&!n?Ei():Z(`advisor`,`role.advisor`,`◇`,[t,n].filter(Boolean).join(` +`),`info`,{expandable:!0})}case`advisor.consultation.cancelled`:{let n=q(Y(e,`question`),160);return Z(`advisor`,`role.advisor`,`◇`,`${X(t,`Consultation cancelled`,`已取消咨询`)}${n?` · ${n}`:``}`,`dim`)}case`advisor.consultation.failed`:case`advisor.consultation.timed_out`:case`advisor.consultation.model_mismatch`:{let n=e.type.endsWith(`model_mismatch`)?X(t,`The provider returned a different model`,`接入返回的模型与所选模型不一致`):e.type.endsWith(`timed_out`)?X(t,`The advisor did not respond in time`,`顾问未在时限内返回`):X(t,`The consultation did not finish`,`顾问咨询未完成`),r=q(Y(e,`question`),160);return Z(`advisor`,`role.advisor`,`◇`,`${n}${r?` · ${r}`:``}`,`warn`,{expandable:!0})}case`life.manager.supervision.applied`:return Z(`manager`,`role.manager`,`🧭`,Y(e,`summary`)||Y(e,`reason`),`info`,{expandable:!0,rule:!0});case`life.peer.message.processed`:return Z(`manager`,`role.peer`,`↔`,Y(e,`text`),`info`,{expandable:!0});case`life.manager.supervision.failed`:{let n=Ti(e,t);return Z(`manager`,`role.manager`,`🧭`,n.text,n.tone,{expandable:!0})}case`engineer.progress`:return ji(e,t);case`life.manager.intent.started`:return Z(`manager`,`role.manager`,`🧭`,X(t,`Working out how to handle your request…`,`正在安排处理方式…`),`info`);case`life.manager.intent.completed`:return Z(`manager`,`role.manager`,`🧭`,xi(J(e),t.locale),`info`,{expandable:!0});case`life.manager.intent.failed`:return Z(`manager`,`role.manager`,`⚠`,ki(e,t),`err`,{expandable:t.density===`full`});case`life.manager.stage_decision`:{let n=Y(e,`target_stage`)||Y(e,`stage`)||Y(e,`current_stage`);return Z(`manager`,`role.manager`,`🧭`,`${Y(e,`action`)}${n?` → ${n}`:``} ${q(Y(e,`reason`),t.density===`full`?140:120)}`,`info`)}case`life.research.second_reading`:{let n=Oi(e,`manager`),r=q(Y(e,`supported`),160),i=X(t,`reread the evidence and reworked the plan`,`重读了证据并重排了计划`);return Z(n,`role.${n}`,`📖`,r?`${i} · ${r}`:i,`info`)}case`life.letter.written`:{let n=Oi(e,`manager`);return Z(n,`role.${n}`,`✉`,X(t,`wrote you a letter`,`给你写了一封信`),`accent`)}case`life.planner.start`:return Z(`planner`,`role.planner`,`📋`,`${X(t,`planning`,`正在规划`)} ${q(Y(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.verdict`:return Y(e,`status`)===`done`||J(e).project_done===!0?Z(`planner`,`role.planner`,`🏁`,X(t,`the project is finished`,`项目已完成`),`ok`):Z(`planner`,`role.planner`,`📋`,X(t,`lined up ${Y(e,`queued`)||Y(e,`n`)||`next`} task(s) to do next`,`已排好 ${Y(e,`queued`)||Y(e,`n`)||`下一`} 个接下来要做的任务`),`accent`);case`life.planner.task_added`:return Z(`planner`,`role.planner`,`+`,`${X(t,`added a task`,`新增任务`)} · ${q(Y(e,`title`)||Y(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.task_skipped`:return Z(`planner`,`role.planner`,`⏭`,`${Y(e,`skip_category`)===`paper_review_purchase_deferred`?X(t,`put off another paper review`,`推迟了再买一次评审`):X(t,`skipped a task already planned`,`跳过了已在计划中的任务`)} ${q(Y(e,`title`),t.density===`full`?140:120)}`,`dim`);case`life.planner.preview_skipped`:return Z(`planner`,`role.planner`,`⏭`,X(t,`skipped the plan preview: the research Planner owns the campaign plan`,`跳过了计划预览:研究规划师负责整个计划`),`dim`);case`life.planner.normalized`:return Z(`planner`,`role.planner`,`≋`,`${X(t,`tidied the plan`,`整理了计划`)} · ${q(Y(e,`diagnostic`),180)}`,`dim`);case`life.planner.waiting`:return Z(`planner`,`role.planner`,`⌛`,`${X(t,`waiting`,`等待中`)} · ${q(Y(e,`reason`),180)}`,`info`);case`life.planner.waiting_woken`:return Z(`planner`,`role.planner`,`↻`,`${X(t,`resumed`,`已唤醒`)} · ${q(Y(e,`wake_reason`),180)}`,`info`);case`life.planner.terminal_idle`:return Z(`planner`,`role.planner`,`Ⅱ`,`${X(t,`nothing left to plan`,`暂时没有要规划的`)} · ${q(Y(e,`reason`),180)}`,`dim`);case`life.planner.verification_probe`:return t.showReasoning?Z(`planner`,`role.planner`,`⌕`,`${X(t,`checking that the plan still holds`,`检查计划是否仍然成立`)} · ${q(Y(e,`reason`),180)}`,`dim`):Ei();case`life.planner.error`:return Z(`planner`,`role.planner`,`⚠`,`${X(t,`the Planner hit an error`,`规划者出错`)} ${q(Y(e,`error`)||Y(e,`text`),t.density===`full`?160:140)}`,`err`);case`life.mission.started`:return Z(`engineer`,`role.engineer`,`🚀`,q(Y(e,`title`)||Y(e,`objective`)||Y(e,`text`)||X(t,`started work on this task`,`开始做这项任务`),t.density===`full`?180:160),`info`,{rule:!0});case`round.start`:return Z(`engineer`,`role.engineer`,`──`,X(t,`round ${Ai(e)}`,`第 ${Ai(e)} 轮`),`dim`,{rule:!0});case`life.phase.started`:{let n=Y(e,`label`)||Y(e,`phase`),r=Oi(e);return n?Z(r,`role.${r}`,`🔄`,X(t,`entering ${n}`,`进入 ${n}`),`info`):Ei()}case`round.review.started`:return Z(`reviewer`,`role.reviewer`,`🔄`,X(t,`the Reviewer checks round ${Ai(e)}`,`审阅者检查第 ${Ai(e)} 轮`),`info`);case`round.review.deferred`:return Z(`engineer`,`role.engineer`,`↪`,X(t,`carries on into the next round without a review · ${q(Y(e,`next_step`),t.density===`full`?180:160)}`,`不经审阅直接进入下一轮 · ${q(Y(e,`next_step`),t.density===`full`?180:160)}`),`info`);case`round.main.completed`:return Z(`engineer`,`role.engineer`,`✅`,X(t,`finished round ${Ai(e)} of work`,`第 ${Ai(e)} 轮工作已完成`),`info`);case`round.review.completed`:{if(e.review_skipped===!0)return Z(`reviewer`,`role.reviewer`,`↪`,`${X(t,`no review this round`,`这一轮没有审阅`)} · ${q(Y(e,`reason`),t.density===`full`?200:160)}`,`info`);let n=Y(e,`status`),r=n===`done`?q(Y(e,`residual_risk`),200):``;if(r)return Z(`reviewer`,`role.reviewer`,`⚠`,`${X(t,`verified with residual risk`,`已验证,但有残余风险`)}: ${r} · ${q(Y(e,`reason`),t.density===`full`?200:160)}`,`warn`);let i=n===`done`?`ok`:n===`blocked`||n===`no_progress`?`err`:`warn`;return Z(`reviewer`,`role.reviewer`,n===`done`?`✅`:n===`blocked`||n===`no_progress`?`⛔`:`↻`,`${Li(n,t)} · ${q(Y(e,`reason`),t.density===`full`?200:160)}`,i)}case`life.mission.completed`:{let n=yi(J(e)),r=q(Y(e,`summary`),240),i=q(Y(e,`residual_risk`),200);return i&&n.tone===`ok`?Z(`engineer`,`role.engineer`,`⚠`,`${X(t,`completed with residual risk`,`已完成,但有残余风险`)} · ${r.includes(i)?r:`${i}${r?` · ${r}`:``}`}`,`warn`,{rule:!0}):Z(`engineer`,`role.engineer`,n.glyph,r?`${n.label} · ${r}`:n.label,n.tone,{rule:!0})}case`life.mission.failed`:return Z(`engineer`,`role.engineer`,`❌`,`${X(t,`this task failed`,`这项任务失败了`)} ${q(Y(e,`reason`)||Y(e,`error`),t.density===`full`?160:140)}`,`err`,{rule:!0});case`loop.start`:return Z(`engineer`,`role.engineer`,`▶`,q(Y(e,`text`)||Y(e,`objective`),t.density===`full`?16e3:160),`info`,{expandable:t.density===`full`});case`loop.done`:return Z(`engineer`,`role.engineer`,`🏁`,`${X(t,`the run finished`,`这次运行结束`)} ${q(Y(e,`text`),t.density===`full`?140:120)}`,`dim`);case`life.inbox.queued`:return Z(`system`,`role.operator`,`📥`,`${X(t,`you added guidance`,`你追加了指导`)} · ${q(Y(e,`text`),t.density===`full`?180:160)}`,`accent`);case`daemon.parked`:{let n=Y(e,`replaced_by`),r=X(t,`Argus set this project aside with its state saved`,`Argus 已把这个项目搁置,状态已保存`);return Z(`system`,`role.system`,`Ⅱ`,n?`${r} · ${X(t,`continued as ${n}`,`由 ${n} 接续`)}`:r,`warn`,{rule:!0})}case`accounting.journal_repaired`:{let n=J(e).damaged_lines,r=J(e).liabilities,i=Array.isArray(n)?n.length:0,a=Array.isArray(r)?r.length:0,o=q(Y(e,`damaged_copy`),120),s=`the usage journal was repaired: ${i} damaged line(s) set aside${o?` in ${o}`:``}, ${a} call(s) written back as a liability`,c=`用量账本已修复:${i} 行损坏记录已另存${o?`到 ${o}`:``},${a} 次调用按负债记回`;return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,X(t,s,c),`warn`,{rule:!0})}case`provider.request.denied`:{let n=Y(e,`provider`);return Z(`system`,`event.quota`,`⏸`,`${X(t,`a request to ${n||`the model service`} was held back`,`发往${n||`模型服务`}的一次请求被暂缓`)} · ${q(Y(e,`reason`),160)}`,`warn`,{rule:!0})}case`round.reviewer_backend_failure`:{let n=q(Y(e,`text`),150),r=t.density===`full`?X(t,`the Reviewer's model service is unreachable — waiting rather than going on unchecked`,`审阅者的模型服务连不上 — 先等待,不在无人审阅的情况下继续`):X(t,`the Reviewer's model service is unreachable — waiting`,`审阅者的模型服务连不上 — 先等待`);return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${r} · ${n}`,`err`,{rule:!0})}case`round.stall`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,q(Y(e,`text`)||X(t,t.density===`full`?`no progress this round — keeping a close eye on it`:`no progress this round`,`这一轮没有进展`),170),`warn`);case`round.escalated`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,q(Y(e,`text`)||X(t,`many rounds without a finish — raising what is blocking the work`,`轮次已经很多还没做完 — 把外部阻碍提出来`),170),`warn`);case`life.planner.stall_escalation`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${X(t,`the Planner is stuck`,`规划者卡住了`)} — ${q(Y(e,`reason`)||Y(e,`text`),150)}`,`warn`);case`life.budget.pause`:return Y(e,`stop_kind`)===`cost_unreconciled`||Y(e,`reason`).startsWith(`unresolved provider cost`)?Z(`system`,`event.budget`,`$`,X(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Z(`system`,`event.watch`,`⏸`,X(t,`budget cap reached — paused · ${q(Y(e,`text`)||Y(e,`reason`),140)}`,`已达到预算上限 — 已暂停 · ${q(Y(e,`text`)||Y(e,`reason`),140)}`),`warn`);case`budget.reservation.denied`:return Y(e,`reason`).startsWith(`unresolved provider cost`)?Z(`system`,`event.budget`,`$`,X(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Z(`system`,`event.budget`,`$`,`${X(t,`budget denied`,`预算申请被拒绝`)} — ${q(Y(e,`reason`)||Y(e,`text`),t.density===`full`?160:150)}`,`err`,{rule:!0});case`budget.unpriced.blocked`:return Z(`system`,`event.budget`,`$`,X(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`);case`budget.unpriced.acknowledged`:return Z(`system`,`event.budget`,`$`,X(t,`Single-call cost risk approved; original usage remains pending`,`已批准单笔费用风险;原始费用仍待对账`),`warn`);case`life.lifecycle.block`:return Z(`system`,`event.watch`,`⛔`,`${X(t,`blocked — needs you`,`卡住了 — 需要你来处理`)} · ${q(Y(e,`text`)||Y(e,`reason`),150)}`,`err`,{rule:!0});case`life.daemon.idle_timeout`:return Z(`system`,`event.watch`,`🟦`,q(Y(e,`text`)||X(t,`nothing to do for a while — standing by`,`一段时间没有事做 — 待命中`),150),`dim`);case`operator_alert`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,q(Y(e,`text`)||Y(e,`reason`)||e.type,170),`err`,{rule:!0});case`life.supervisor.error`:return Z(`system`,`role.system`,`⚠`,`${X(t,`Argus hit an internal error while coordinating the work`,`Argus 在统筹工作时遇到内部错误`)} · ${q(Y(e,`error`),160)}`,`err`,{rule:!0});case`life.auth_failure`:return Z(`system`,`role.system`,`🔑`,X(t,`the model service rejected the sign-in — refresh the credentials and Argus will carry on`,`模型服务拒绝了登录 — 更新凭据后 Argus 会继续`),`err`,{rule:!0});case`life.planner.deferred`:return Z(`planner`,`role.planner`,`⌛`,`${X(t,`planning is on hold`,`规划暂缓`)} · ${q(Y(e,`reason`),180)}`,`dim`);case`life.post_mission.stop`:return Z(`system`,`role.system`,`■`,`${X(t,`stopped after this task`,`这项任务之后停下`)} · ${q(Y(e,`reason`),180)}`,`info`);case`life.planner.final_submission_skipped`:return Z(`planner`,`role.planner`,`⏭`,`${X(t,`dropped an outdated final-submission task`,`跳过了一项过时的最终提交任务`)} · ${q(Y(e,`title`),140)}`,`dim`);case`life.execution_host.blocked`:return Z(`system`,`event.watch`,`⛔`,q(Y(e,`reason`)||X(t,`the program that runs code for Argus could not be started`,`为 Argus 运行代码的程序无法启动`),t.density===`full`?260:180),`err`,{rule:!0});case`life.mission.provider_configuration_disabled`:{let n=Number(J(e).streak||0),r=X(t,`the model configuration failed ${wi(n,`time`)} in a row — this task is paused until you decide`,`模型配置连续 ${n} 次失败 — 这项任务已暂停,等待你的决定`),i=q(Y(e,`text`),160);return Z(`system`,`event.watch`,`⛔`,i?`${r} · ${i}`:r,`err`,{rule:!0})}case`life.iteration.continued`:return Z(`critic`,`role.critic`,`🔁`,X(t,`lined up the next iteration`,`排好了下一轮迭代`),`dim`);case`life.learned_vertical.promoted`:return Z(`manager`,`role.manager`,`★`,X(t,`made the learned domain "${Y(e,`vertical`)}" official`,`把新学到的领域「${Y(e,`vertical`)}」正式收录`),`accent`);case`life.learned_vertical.promotion_failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`could not record "${Y(e,`vertical`)}" as a formal domain`,`未能把「${Y(e,`vertical`)}」收录为正式领域`)} · ${q(Y(e,`error`),140)}`,`warn`);case`life.review.waived`:return Z(`planner`,`role.planner`,`↪`,`${X(t,`this task will skip the independent review`,`这项任务将不做独立审阅`)} · ${q(Y(e,`reason`),160)}`,`dim`);case`life.manager.feedback.exhausted`:{let n=Number(J(e).attempts||0);return Z(`manager`,`role.manager`,`⚠`,`${X(t,`the Manager's objection went unanswered ${wi(n,`time`)} — planning pauses for a while`,`管理者的异议 ${n} 次未被回应 — 规划暂停一段时间`)} · ${q(Y(e,`reason`),140)}`,`warn`)}case`life.manager.feedback.persisted`:{let n=Y(e,`stage`);return Z(`manager`,`role.manager`,`↩`,`${n?X(t,`sent the plan back for another pass at ${n}`,`把计划退回 ${n} 阶段再改一轮`):X(t,`sent the plan back for another pass`,`把计划退回再改一轮`)} · ${q(Y(e,`reason`),160)}`,`info`)}case`life.manager.goal_contract.failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`could not save the agreed goal`,`未能保存商定的目标`)} · ${q(Y(e,`error`),140)}`,`warn`);case`life.manager.intent.superseded`:return Z(`manager`,`role.manager`,`↷`,X(t,`a newer instruction replaced this request`,`更新的指令取代了这个请求`),`info`);case`life.manager.project_report.failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`could not deliver the project report`,`未能送出项目报告`)} · ${q(Y(e,`error`),140)}`,`warn`);case`life.planner.completion_circuit_opened`:{let n=Number(J(e).consecutive_rejections||0);return Z(`planner`,`role.planner`,`⏸`,X(t,`the same completion requirement turned the plan back ${wi(n,`time`)} — pausing completion attempts until something changes`,`同一项完成要求已 ${n} 次打回计划 — 暂停完成尝试,直到情况变化`),`warn`)}case`life.planner.completion_rejected`:return Z(`manager`,`role.manager`,`↩`,`${X(t,`the Manager did not accept the completion claim`,`管理者未接受完成的说法`)} · ${q(Y(e,`reason`),160)}`,`info`);case`life.planner.continuation_required`:return Z(`planner`,`role.planner`,`↻`,X(t,`finished one increment; the standing objective continues`,`完成了一个增量;长期目标继续推进`),`dim`);case`life.planner.superseded`:return Z(`planner`,`role.planner`,`↷`,X(t,`dropped an outdated planning pass after a newer instruction`,`收到更新的指令,放弃了过时的规划`),`dim`);case`life.planner.wait_overridden`:return Z(`planner`,`role.planner`,`+`,`${X(t,`scheduled independent work instead of waiting`,`不再干等,安排了独立的工作`)} · ${q(Y(e,`task_title`),140)}`,`info`);case`life.daemon.degraded`:return Z(`system`,`role.system`,`⚠`,`${X(t,`Argus started, but the objective did not reach the Manager`,`Argus 已启动,但目标没有交到管理者手上`)} · ${q(Y(e,`error`),140)}`,`warn`);case`round.orphan_process_group`:return Z(`engineer`,`role.engineer`,`⚠`,J(e).cleanup_succeeded===!0?X(t,`background processes outlived the turn and were cleaned up`,`有后台进程在这一轮结束后仍在运行,已清理`):X(t,`background processes outlived the turn and could not be cleaned up`,`有后台进程在这一轮结束后仍在运行,未能清理`),`warn`);case`round.model_configuration_error`:return Z(`engineer`,`role.engineer`,`⛔`,`${X(t,`the model configuration is not usable`,`模型配置无法使用`)} · ${q(Y(e,`text`)||Y(e,`error`),160)}`,`err`,{rule:!0});case`round.watchdog.retry`:{let n=Number(J(e).attempt||0),r=Number(J(e).max_attempts||0);return Z(`engineer`,`role.engineer`,`↻`,X(t,`the model call failed — retrying in a fresh session (attempt ${n} of ${r})`,`模型调用失败 — 在新会话中重试(第 ${n} 次,共 ${r} 次)`),`warn`)}case`round.watchdog.retry_exhausted`:{let n=Number(J(e).attempt||0),r=q(Y(e,`fatal_error`),140),i=X(t,`the model call kept failing — giving up after ${wi(n,`attempt`)}`,`模型调用持续失败 — ${n} 次后放弃`);return Z(`engineer`,`role.engineer`,`⛔`,r?`${i} · ${r}`:i,`err`,{rule:!0})}case`round.backend_failure.backoff`:{let n=Math.round(Number(J(e).seconds||0));return Z(`engineer`,`role.engineer`,`⏳`,q(Y(e,`text`)||X(t,`the model service failed — waiting ${n}s before trying again`,`模型服务出错 — 等待 ${n} 秒后再试`),200),`warn`)}case`round.backend_failure.hold_interrupted`:return Z(`engineer`,`role.engineer`,`↪`,q(Y(e,`text`)||X(t,`the wait after a model-service failure ended early`,`模型服务出错后的等待提前结束`),180),`info`);case`round.provider_turn_cap.restart`:return Z(`engineer`,`role.engineer`,`↻`,X(t,`reached the per-call turn allowance — continuing the same task in a fresh session`,`达到单次调用的轮次上限 — 在新会话中继续同一任务`),`info`);case`round.provider_turn_cap.reviewer_restart`:return Z(`reviewer`,`role.reviewer`,`↻`,X(t,`the review reached its turn allowance — restarting it in a fresh session`,`审阅达到轮次上限 — 在新会话中重新开始`),`info`);case`round.reviewer_backend_failure.backoff`:{let n=Math.round(Number(J(e).seconds||0));return Z(`reviewer`,`role.reviewer`,`⏳`,q(Y(e,`text`),200)||X(t,`the Reviewer's model service is unavailable — retrying in ${n}s`,`审阅者的模型服务不可用 — ${n} 秒后重试`),`warn`)}case`round.external_work_wait.started`:return Z(`engineer`,`role.engineer`,`⌛`,`${X(t,`waiting for background work to report`,`等待后台工作汇报`)} · ${q(Y(e,`work_id`),80)}`,`dim`);case`round.external_work_wait.completed`:return Z(`engineer`,`role.engineer`,`↻`,X(t,`background work reported — resuming`,`后台工作已汇报 — 继续`),`dim`);case`round.external_work_review.required`:return Z(`reviewer`,`role.reviewer`,`⌛`,`${X(t,`background work finished — an independent review of its result is required before resuming`,`后台工作已结束 — 恢复前需要对其结果做一次独立审阅`)} · ${q(Y(e,`work_id`),80)}`,`dim`);case`round.external_work_review.completed`:return Z(`reviewer`,`role.reviewer`,`✓`,`${X(t,`background work result reviewed`,`后台工作结果已审阅`)} · ${q(Y(e,`review_status`),40)}`,`dim`);case`plan.draft.failed`:return Z(`planner`,`role.planner`,`⚠`,`${X(t,`could not draft the plan`,`未能起草计划`)} · ${q(Y(e,`reason`),140)}`,`err`);case`plan.draft.done`:{let n=Number(J(e).steps||0);return Z(`planner`,`role.planner`,`📋`,X(t,`drafted a plan with ${wi(n,`step`)}`,`起草了一份 ${n} 步的计划`),`dim`)}case`team.learning.review.started`:return Z(`manager`,`role.manager`,`📚`,X(t,`reviewing what this task taught the team`,`整理这项任务给团队带来的经验`),`dim`);case`team.learning.review.failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`the team learning review failed`,`团队经验整理失败`)} · ${q(Y(e,`error`),140)}`,`warn`);case`team.learning.review.completed`:{let n=Number(J(e).created||0),r=Number(J(e).updated||0);return Z(`manager`,`role.manager`,`📚`,X(t,`kept ${n} new and ${r} updated team procedures`,`保留了 ${n} 条新的、${r} 条更新的团队做法`),`dim`)}case`team.learning.promotion.quarantined`:return Z(`manager`,`role.manager`,`⚠`,X(t,`set aside a new procedure that would have judged its own work`,`搁置了一条会评判自己工作的新做法`),`warn`);case`self.learning.review.failed`:return Z(`system`,`role.system`,`⚠`,`${X(t,`the review of Argus's own conversation habits failed`,`对 Argus 自身对话习惯的复盘失败`)} · ${q(Y(e,`error`),140)}`,`warn`);case`domain.promotion`:return Z(`manager`,`role.manager`,`★`,q(Y(e,`text`),180),`dim`);case`idea.portfolio.formed`:{let n=J(e).selection,r=n&&typeof n==`object`?String(n.route_id??``):``,i=Number(J(e).route_count||0),a=q(Y(e,`text`),180),o=i>0?X(t,`formed an idea portfolio of ${wi(i,`route`)}`,`组成了 ${i} 条思路的组合`):X(t,`formed an idea portfolio`,`组成了思路组合`);return Z(`engineer`,`role.engineer`,`💡`,r?X(t,`chose route ${r} from the idea portfolio`,`从思路组合中选定了路线 ${r}`):a||o,`accent`)}case`user.note`:{let n=Array.isArray(J(e).tags)?J(e).tags.map(String):[];if(n.includes(`config`))return Ei();if(n.includes(`planner`))return Z(`planner`,`role.planner`,`📝`,X(t,`updated the research plan`,`更新了研究计划`),`dim`);let r=q(Y(e,`summary`)||Y(e,`text`)||Y(e,`title`),180);return Z(`system`,`role.operator`,`📝`,`${X(t,`you added a note`,`你添加了一条笔记`)}${r?` · ${r}`:``}`,`accent`)}case`ui.operator`:{let t=Y(e,`text`);return t.trim()?Z(`system`,`role.operator`,`›`,t,`accent`,{rule:!0}):Ei()}case`ui.argus`:{let n=Y(e,`text`),r=J(e).live===!0||Array.isArray(J(e).steps)&&J(e).steps.length>0;return n.trim()||r?Z(`manager`,`role.argus`,`▌`,n,`bright`,{expandable:t.density===`full`,rule:!0}):Ei()}case`agent.io.start`:case`agent.io.stream`:case`agent.io.complete`:case`agent.io.error`:case`usage.recorded`:case`provider.request.started`:case`provider.request.completed`:case`codex.util.completed`:case`skill.cost.completed`:case`budget.reservation.created`:case`budget.reservation.settled`:case`budget.reservation.released`:case`round.checkpoint.recorded`:case`round.checkpoint.failed`:case`round.secret_redacted`:case`role.session.turn`:case`engineer.skill_maintenance.completed`:case`life.status`:case`life.mission.skipped`:case`life.mission.orphaned`:case`life.mission.requeued`:case`life.manager.plan_challenge.decided`:case`life.vertical.resolved`:case`life.manager.backend_resolved`:case`life.planner.backend_resolved`:case`life.planner.dependency_dropped`:case`life.planner.parallel_dropped`:case`life.engineer.backend_resolved`:case`life.reviewer.backend_resolved`:case`life.curator.backend_resolved`:case`life.runtime_failure.circuit_opened`:case`life.runtime_failure.circuit_blocked`:case`life.runtime_failure.canary_passed`:case`life.runtime.incident.detected`:case`life.runtime.incident.recovered`:case`life.runtime.incident.escalated`:case`life.plan.revision.proposed`:case`life.plan.revision.rejected`:case`life.plan.revision.committed`:case`life.plan.node.superseded`:case`life.lifecycle.transition`:case`life.inbox.drained`:case`life.operator_question.pending`:case`life.operator_question.answered`:case`project.completed`:case`project.completion_refused`:case`daemon.command.submitted`:case`daemon.command.completed`:case`daemon.command.rejected`:case`idea.search.started`:case`idea.search.completed`:case`idea.search.skipped`:case`venue.research.started`:case`venue.research.completed`:case`research.achievement.certified`:case`skill.library.available`:case`skill.created`:case`skill.updated`:case`skill.archived`:case`skill.tidied`:case`skill.history.compressed`:case`skill.evolution.completed`:case`wiki.initialized`:case`wiki.hook.warning`:case`wiki.created`:case`wiki.updated`:case`wiki.retired`:case`wiki.promotion.promoted`:case`wiki.promotion.demoted`:case`wiki.retired.compressed`:case`wiki.evolution.completed`:case`knowledge.learned`:case`knowledge.recalled`:case`life.planner.verdict.discarded`:case`life.manager.feedback.unresolved`:case`life.manager.project_report`:case`life.plan.revision.rolled_back`:case`life.planner.completion_circuit.notify_failed`:case`life.planner.completion_circuit_holding`:case`life.planner.external_poll_suppressed`:case`life.planner.waiting_contract.normalized`:case`life.daemon.ready`:case`plan.draft.start`:case`team.learning.review.skipped`:case`self.learning.review.started`:case`self.learning.review.completed`:case`manager.live_view.updated`:case`manager.live_view.rejected`:case`idea.portfolio.nested_skipped`:case`manager.turn.started`:case`manager.turn.cancelled`:case`life.config.parse_failed`:return Di(e,t);default:return Di(e,t)}}function Ni(e){return e.segments.map(e=>e.text).join(``)}var Pi={"role.manager":[`Manager`,`Manager`],"role.planner":[`Planner`,`Planner`],"role.engineer":[`Engineer`,`Engineer`],"role.reviewer":[`Reviewer`,`Reviewer`],"role.advisor":[`Advisor`,`顾问`],"role.peer":[`Project exchange`,`项目交流`],"role.critic":[`Critic`,`Critic`],"role.system":[`Argus`,`Argus`],"role.argus":[`Argus`,`Argus`],"role.operator":[`You`,`你`],"event.notice":[`Notice`,`通知`],"event.watch":[`Watch`,`监控`],"event.budget":[`Budget`,`预算`],"event.quota":[`Quota`,`额度`],"event.fallback":[`Argus`,`Argus`],"event.hidden":[``,``]};function Fi(e,t){let n=Pi[e];if(n)return t===`zh-CN`?n[1]:n[0];let r=e.startsWith(`role.`)?e.slice(5):e;return r?`${r.slice(0,1).toUpperCase()}${r.slice(1)}`:``}function Ii(e,t){let n=Mi(e,t);if(n.visibility===`hidden`)return null;let r=Ni(n);return!r&&!(e.type===`ui.argus`&&(e.live===!0||Array.isArray(e.steps)&&e.steps.length>0))?null:{role:n.role,labelKey:n.labelKey,label:Fi(n.labelKey,t.locale),glyph:n.glyph,text:r,tone:n.tone,rule:n.rule,reasoning:n.reasoning,expand:n.expandable,sensitive:n.sensitive}}function Li(e,t){let n={done:[`the Reviewer was satisfied`,`审阅者认可了这一轮`],blocked:[`the Reviewer found the work stuck`,`审阅者认为工作卡住了`],no_progress:[`the Reviewer saw no progress`,`审阅者没有看到进展`]};if(!e)return X(t,`the Reviewer gave no verdict`,`审阅者没有给出结论`);let r=n[e]??[`the Reviewer asked for another pass`,`审阅者要求再改一轮`];return X(t,r[0],r[1])}var Ri=[{match:/External interrupt|daemon (?:stop|shutdown)|stopped by its operator/i,bare:/^(?:Engineer interrupted because daemon shutdown|Argus was stopped by its operator|Reviewer backend returned no complete judgment \([^)]*External interrupt)/,kind:`interrupt`,zh:`运行被操作员停下,这一轮没有做完;这不是对工作本身的评价`,en:`Argus was stopped by its operator before this round could finish; this says nothing about the work itself`},{match:/no complete judgment|before reaching a judgment|reached a conclusion|did not reach a conclusion/i,bare:/^(?:Reviewer backend (?:returned no complete judgment|ended before reaching a judgment)|The Reviewer's session ended before it reached a conclusion|The review did not reach a conclusion)/,kind:`reviewer`,zh:`审阅者的会话在得出结论前就结束了,这一轮没有评审意见`,en:`The Reviewer's session ended before it reached a conclusion, so this round was not judged`},{bare:/^Engineer backend failed before a trustworthy completed turn/,kind:`reviewer`,zh:`模型服务在工程师做完之前断开了;Argus 会换一个新会话重试,审阅等到那时再做`,en:`The model service dropped the Engineer's session before it finished; Argus retries in a fresh session and the review waits until then`},{bare:/^Retry in a fresh (?:\w+ )?session/,zh:`Argus 会换一个新会话再试一次`,en:`Argus will try again in a fresh session`},{bare:/^Restart the daemon when ready/,zh:`重新启动后,Argus 会从项目留下的状态继续,选择下一项具体任务`,en:`Once Argus is started again it continues from the saved project state and picks the next concrete task`},{bare:/^engineer round \d+ \((?:fresh|rotated|resumed)[^)]*\)\s*$/i,kind:`round`,zh:`工程师开始了新的一轮工作`,en:`The Engineer began a new round of work`},{match:/provider[\s-]?turn/i,bare:/^(?:One Engineer call|\d+ Engineer sessions in a row each) used (?:its|their) whole per-call provider-turn allowance/,zh:`继续换了个新会话接着做,之前的进展都在`,en:`Continued in a fresh session; earlier progress is kept`},{match:/budget (limit|cap|exhausted)|blocking budget|预算上限/i,bare:/^Paused because this project reached its budget limit/,zh:`花费到了预算上限,先暂停;提高预算后可以继续`,en:`Paused at the budget limit; work resumes once the budget is raised`},{match:/quarantin/i,bare:/^The task signature is quarantined out of planner rotation/,zh:`这个方向连续失败,先搁置,不再自动重试`,en:`This direction kept failing and is set aside; it will not retry on its own`},{match:/backend[\s\S]{0,24}?(fail|unavailable|paused)|backend_failure|provider cooldown|configured model is unavailable/i,bare:/^(?:backend failure; retrying in a fresh|The backend has failed the same way \d+ times in a row)/,zh:`模型服务暂时不稳定,稍后会自动重试`,en:`The model service was briefly unavailable; it retries after a short wait`}],zi=/Runner receipt:|Technical record:|技术记录[::]/i,Bi=/^(?:Runner receipt|Technical record|技术记录)\s*[::]\s*/i;function Vi(e){let t=String(e||``).trim(),n=t.search(zi);return n<0?{prose:t,receipt:``}:{prose:t.slice(0,n).trim(),receipt:t.slice(n).trim()}}function Hi(e,t){let n=String(e||``).trim(),{receipt:r}=Vi(n),i=r?Ri.find(e=>e.match?.test(n)):Ri.find(e=>e.bare?.test(n));return i?{summary:t?i.zh:i.en,receipt:r||n,kind:i.kind}:{summary:``,receipt:r}}function Ui(e,t){return t===`zh-CN`?e[0]:e[1]}function Wi(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``)}var Gi={grounding_started:[`正在阅读这项请求,弄清楚它要做什么`,`Reading the request to understand what it asks`],goal_framed:[`已经理解这项请求,项目目标已经确定。`,`The request is understood and the project goal is set.`],goal_not_understood:[`这项请求还没有被理解清楚。`,`The request could not be understood yet.`],request_not_routed:[`这项请求没能被安排下去。`,`The request could not be routed to the team.`],stage_advanced:[`研究进入了下一阶段。`,`The research moved to the next stage.`],stage_entered:[`研究进入「{stage}」阶段。`,`The research moved to the {stage} stage.`],stage_held:[`当前阶段暂不推进。`,`The current stage is on hold.`],stage_rolled_back:[`研究退回到了前一阶段。`,`The research went back a stage.`],stage_completed:[`当前阶段已完成。`,`The current stage is complete.`],stage_reconsidered:[`阶段安排已重新考虑。`,`The stage plan was reconsidered.`],stage_reviewed:[`阶段已复核。`,`The stage was reviewed.`],planning_started:[`正在规划下一步工作`,`Planning the next step`],task_added:[`计划中加入了一项新任务。`,`A new task was added to the plan.`],research_route_added:[`计划中加入了一条新的研究路线。`,`A new research route was added to the plan.`],planning_complete:[`下一步的计划已经排好。`,`The next step is planned.`],project_finished:[`项目已经完成。`,`The project is finished.`],task_delivered:[`成果已交付。`,`The result was delivered.`],planner_waiting:[`规划者在等待前一步完成。`,`The Planner is waiting for the previous step.`],planner_idle:[`暂时没有需要规划的工作。`,`Nothing to plan right now.`],planning_failed:[`这次规划没有成功。`,`Planning did not succeed this time.`],mission_started:[`开始处理这项任务`,`Work on the task started`],awaiting_engineer:[`等待工程师完成这一轮。`,`Waiting for the Engineer to finish the round.`],waiting_external:[`等待外部工作完成。`,`Waiting on work outside Argus.`],mission_completed:[`任务已完成。`,`The task is complete.`],mission_continued:[`任务将继续进行。`,`The task continues.`],mission_certified:[`成果已通过独立核对。`,`The result passed an independent check.`],mission_incomplete:[`任务没有完成。`,`The task was not completed.`],mission_stalled:[`任务停滞不前。`,`The task stalled.`],mission_blocked:[`任务被挡住了。`,`The task is blocked.`],mission_failed:[`任务没能完成。`,`The task could not be completed.`],mission_paused:[`任务在完成前暂停;进度已保存,可以继续。`,`The task was paused before it finished; its progress is saved and it can be resumed.`],mission_ended:[`任务已结束。`,`The task ended.`],mission_ready:[`可以开始新任务。`,`Ready for a new task.`],round_in_progress:[`这一轮正在进行。`,`The round is in progress.`],round_running:[`第 {n} 轮正在进行。`,`Round {n} is in progress.`],round_started:[`第 {n} 轮工作开始。`,`Round {n} started.`],progress_tool:[`正在使用工具`,`Using a tool`],progress_command:[`正在运行命令`,`Running a command`],progress_message:[`正在汇报进展`,`Reporting progress`],progress_file:[`正在更新项目文件`,`Updating project files`],progress_inspecting:[`正在查看项目状态`,`Looking at the project state`],engineer_round_finished:[`工程师完成了这一轮,结果已准备好供核对。`,`The Engineer finished the round; the result is ready to be checked.`],checking_started:[`正在阅读工程师的结果并核对证据`,`Reading the Engineer's result and checking the evidence`],continuing_before_check:[`先继续下一轮,核对稍后进行。`,`Continuing to the next round; the check comes later.`],check_postponed:[`这一轮的核对推迟了。`,`The check of this round was postponed.`],round_not_judged:[`这一轮没有人审阅。`,`No one reviewed this round.`],results_accepted:[`结果通过了核对。`,`The result passed the check.`],another_attempt_requested:[`审阅者要求再试一次。`,`The reviewer asked for another attempt.`],attempt_blocked:[`这次尝试被挡住了。`,`This attempt is blocked.`],replan_requested:[`审阅者要求重新规划。`,`The reviewer asked for a new plan.`],results_not_final:[`结果还不是最终的。`,`The result is not final yet.`],handed_off:[`已交给下一位。`,`Handed off to the next role.`],waiting:[`等待中`,`Waiting`],live_activity:[`正在工作`,`Working`],role_failed:[`{role} 执行失败`,`{role} failed`],capability_unlocked:[`解锁了一项新能力。`,`A new capability was unlocked.`],capability_upgraded:[`一项能力得到了升级。`,`A capability was upgraded.`],capability_promoted:[`一项能力被提升为来源。`,`A capability was promoted to a source.`],knowledge_captured:[`记下了一条新知识。`,`New knowledge was captured.`],knowledge_refined:[`一条知识得到了完善。`,`A piece of knowledge was refined.`],knowledge_promoted:[`一条知识被提升。`,`A piece of knowledge was promoted.`],knowledge_demoted:[`一条知识被降级。`,`A piece of knowledge was demoted.`],knowledge_retired:[`一条知识已退役。`,`A piece of knowledge was retired.`],"event.model_call.started":[`开始调用模型`,`Model call started`],"event.model_call.completed":[`模型调用完成`,`Model call completed`],"event.model_call.failed":[`模型调用失败`,`Model call failed`],"event.usage.recorded":[`已记录用量`,`Usage recorded`],"event.budget.reserved":[`已预留预算`,`Budget reserved`],"event.budget.settled":[`预算已结算`,`Budget settled`],"event.model_turn":[`与模型完成一次往返`,`One exchange with the model`],"event.instruction.received":[`收到你的指令`,`Your instruction was received`],"event.instruction.done":[`指令已执行`,`Instruction carried out`],"event.inbox.processed":[`已处理收件箱`,`Inbox processed`],"event.round.started":[`新的一轮开始`,`A new round started`],"event.round.finished":[`执行者完成了这一轮`,`The Engineer finished the round`],"event.review.finished":[`这一轮的审阅结束`,`Review of the round finished`],"event.retry.waiting":[`等待后重试`,`Waiting before retrying`],"event.retry.interrupted":[`等待被打断`,`The wait was interrupted`],"event.status":[`状态更新`,`Status update`],"event.planning.started":[`开始规划`,`Planning started`],"event.planning.failed":[`规划没有完成`,`Planning did not complete`],"event.planning.tidied":[`计划已整理`,`Plan tidied`],"event.planning.decided":[`规划结论`,`Planning decision`],"event.task.started":[`开始执行任务`,`Task execution started`],"event.task.ended":[`任务执行结束`,`Task execution ended`],"event.skills.ready":[`技能库已就绪`,`Skill library ready`],"event.routes.formed":[`已形成候选路线组合`,`Candidate route portfolio formed`],"event.lessons.skipped":[`本次没有总结经验`,`No lessons recorded this time`],"event.argus.reply":[`Argus 的回复`,`Reply from Argus`]},Ki={daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],paused_daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],operator_pause:[`你暂停了它`,`you paused it`],paused_operator:[`你暂停了它`,`you paused it`],operator_abort:[`你停止了它`,`you stopped it`],budget_exhausted:[`预算用完了`,`the budget ran out`],budget_pause:[`预算用完了`,`the budget ran out`],paused_budget:[`预算用完了`,`the budget ran out`],provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],paused_provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],provider_fence:[`模型服务不可用`,`the model service is unavailable`],paused_provider_fence:[`模型服务不可用`,`the model service is unavailable`],backend_unavailable:[`模型服务不可用`,`the model service is unavailable`],transient_error:[`出现了暂时性的问题`,`a temporary problem came up`],permanent_error:[`遇到了无法自动恢复的错误`,`an error could not be recovered from`],operator_input_required:[`需要你的回复`,`your reply is needed`],planner_empty_plan:[`需要一份新的计划`,`a new plan is needed`]},qi={pending:[`待开始`,`Waiting`],queued:[`待开始`,`Waiting`],not_started:[`待开始`,`Not started`],waiting:[`等待中`,`Waiting`],idle:[`空闲`,`Idle`],running:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],active:[`进行中`,`In progress`],working:[`进行中`,`In progress`],framed:[`已明确目标`,`Objective settled`],grounding:[`了解项目中`,`Getting oriented`],planned:[`已规划`,`Planned`],done:[`已完成`,`Done`],complete:[`已完成`,`Done`],completed:[`已完成`,`Done`],success:[`已完成`,`Done`],accepted:[`已完成`,`Done`],failed:[`失败`,`Failed`],error:[`出错`,`Failed`],blocked:[`受阻`,`Blocked`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],skipped:[`已跳过`,`Skipped`],ended:[`已结束`,`Ended`],incomplete:[`未完成`,`Not finished`],stalled:[`停滞`,`Stalled`],paused:[`已暂停`,`Paused`],stopped:[`已停止`,`Stopped`],cancelled:[`已停止`,`Stopped`],aborted:[`已停止`,`Stopped`],paused_external_work:[`等待外部工作完成`,`Waiting for external work`],superseded:[`已由新方案替代`,`Replaced by a newer plan`]},Ji={engineer_service_dropped:[`模型服务在工程师得出可核对的结果之前中断了会话,因此没有可以审阅的内容。Argus 会换一个新会话重试。`,`The model service dropped the session before the Engineer produced a checkable result, so there was nothing to review. Argus will retry in a fresh session.`],reviewer_unreachable:[`审阅者的会话在得出结论前就结束了,Argus 会再试一次。`,`The reviewer's session ended before it reached a conclusion; Argus will try again.`],argus_stopped:[`Argus 被停止了,任务随之暂停。`,`Argus was stopped, so the task paused.`],task_cancelled:[`这项任务被取消了。`,`The task was cancelled.`],session_length_limit:[`这一轮达到了单次会话的长度上限;已做的工作保留,会在新的会话里继续。`,`The round reached the length limit of one session; the work so far is kept and continues in a fresh session.`],tools_unavailable:[`执行环境里缺少需要的工具。`,`The tools the work needs are not available in the execution environment.`],model_unavailable:[`模型服务暂时不可用。`,`The model service is unavailable for now.`],sign_in_failed:[`模型服务的登录没有成功。`,`Signing in to the model service did not succeed.`],paused:[`任务被暂停了。`,`The task was paused.`],unknown:[`原因暂时不明。`,`The reason is not known yet.`],retry_wait_cut_short:[`在等待重试时 Argus 被要求停止。`,`Argus was asked to stop while waiting to retry.`]},Yi={idea:[`选题`,`Idea`],scope:[`研究定义`,`Scope`],research:[`文献与假设`,`Literature and hypotheses`],literature:[`文献与假设`,`Literature and hypotheses`],implementation:[`方法实现`,`Implementation`],implement:[`方法实现`,`Implementation`],experiment:[`实验验证`,`Experiments`],experiments:[`实验验证`,`Experiments`],analysis:[`结果分析`,`Analysis`],writing:[`论文写作`,`Writing`],review:[`最终审核`,`Final review`],delivery:[`成果交付`,`Delivery`],optimize:[`优化`,`Optimization`],solve:[`推导与验证`,`Derivation and verification`],hold:[`已暂停`,`Paused`],paused:[`已暂停`,`Paused`]},Xi={"provider.request.started":`event.model_call.started`,"provider.request.completed":`event.model_call.completed`,"provider.request.failed":`event.model_call.failed`,"agent.io.start":`event.model_call.started`,"agent.io.complete":`event.model_call.completed`,"usage.recorded":`event.usage.recorded`,"budget.reservation.created":`event.budget.reserved`,"budget.reservation.settled":`event.budget.settled`,"role.session.turn":`event.model_turn`,"daemon.command.submitted":`event.instruction.received`,"daemon.command.completed":`event.instruction.done`,"life.inbox.drained":`event.inbox.processed`,"round.start":`event.round.started`,"round.main.completed":`event.round.finished`,"round.review.completed":`event.review.finished`,"round.backend_failure.backoff":`event.retry.waiting`,"round.backend_failure.hold_interrupted":`event.retry.interrupted`,"life.status":`event.status`,"life.planner.start":`event.planning.started`,"life.planner.error":`event.planning.failed`,"life.planner.normalized":`event.planning.tidied`,"life.planner.verdict":`event.planning.decided`,"loop.start":`event.task.started`,"loop.done":`event.task.ended`,"skill.library.available":`event.skills.ready`,"idea.portfolio.formed":`event.routes.formed`,"team.learning.review.skipped":`event.lessons.skipped`,"ui.argus":`event.argus.reply`};function Zi(e,t){let n=String(e??``).trim(),r=Yi[n.toLowerCase()];return r?Ui(r,t):n}function Qi(e,t){let n=String(e??``).trim().toLowerCase(),r=Ki[n];return r?Ui(r,t):n}function $i(e,t,n){if(!t)return e;let r=Qi(t,n);return n===`zh-CN`?`${e.replace(/。$/,``)}(${r})。`:`${e.replace(/\.$/,``)} — ${r}.`}function ea(e,t,n){return t?n===`zh-CN`?`已完成 ${e} / ${t}`:`${e} of ${t} done`:Ui([`尚未规划`,`Not planned yet`],n)}var ta=[[/^Reporting progress$/i,`progress_message`],[/^(?:Running a command|running project command)$/i,`progress_command`],[/^Using a tool$/i,`progress_tool`],[/^inspecting project state$/i,`progress_inspecting`],[/^Working$/i,`live_activity`]],na=[...ta,[/^(?:Review not performed|No review this round)$/i,`round_not_judged`],[/^Goal framed$/i,`goal_framed`],[/^(?:Grounding project|Project grounding started)$/i,`grounding_started`],[/^Manager routing failed$/i,`request_not_routed`],[/^Stage reviewed$/i,`stage_reviewed`],[/^(?:Planning next work|Planning started)$/i,`planning_started`],[/^Planning complete$/i,`planning_complete`],[/^Planner waiting$/i,`planner_waiting`],[/^Project reviewed$/i,`project_finished`],[/^Research branch added$/i,`research_route_added`],[/^Task added$/i,`task_added`],[/^(?:Engineer handoff ready|Work ready for review)$/i,`engineer_round_finished`],[/^(?:Review started|Reviewing benchmark evidence)$/i,`checking_started`],[/^(?:Continuing before review|Continued before review)$/i,`continuing_before_check`],[/^Review deferred for one round$/i,`check_postponed`],[/^Waiting for the Engineer to finish$/i,`awaiting_engineer`],[/^Waiting on external work$/i,`waiting_external`],[/^(?:Evidence accepted|Accepted evidence)$/i,`results_accepted`],[/^(?:Attempt rejected|Requested another attempt)$/i,`another_attempt_requested`],[/^Handed off$/i,`handed_off`],[/^(?:Mission started|Starting mission)$/i,`mission_started`],[/^(?:Task completed|Mission complete)$/i,`mission_completed`],[/^Task failed$/i,`mission_failed`],[/^Awaiting Planner$/i,`planner_waiting`],[/^Ready for a new mission$/i,`mission_ready`],[/^Waiting$/i,`waiting`],[/^Capability unlocked$/i,`capability_unlocked`],[/^Capability upgraded$/i,`capability_upgraded`],[/^Capability promoted to source$/i,`capability_promoted`],[/^Knowledge captured$/i,`knowledge_captured`],[/^Knowledge refined$/i,`knowledge_refined`],[/^Knowledge promoted$/i,`knowledge_promoted`],[/^Knowledge demoted$/i,`knowledge_demoted`],[/^Knowledge retired$/i,`knowledge_retired`],[/^(?:request · started|io · start)$/i,`event.model_call.started`],[/^(?:request · completed|io · complete)$/i,`event.model_call.completed`],[/^usage · recorded$/i,`event.usage.recorded`],[/^reservation · created$/i,`event.budget.reserved`],[/^reservation · settled$/i,`event.budget.settled`],[/^Round (\d+) started$/i,(e,t)=>Wi(Ui(Gi.round_started,t),{n:e[1]})],[/^Running round (\d+)$/i,(e,t)=>Wi(Ui(Gi.round_running,t),{n:e[1]})],[/^Stage (?:·|→) (.+)$/i,(e,t)=>Wi(Ui(Gi.stage_entered,t),{stage:Zi(e[1],t)})],[/^Mission (ended|incomplete|stalled|blocked|failed)(?: · (\S+))?$/i,(e,t)=>$i(Ui(Gi[`mission_${e[1].toLowerCase()}`],t),e[2],t)],[/^(Manager|Planner|Engineer|Reviewer) failed$/i,(e,t)=>Wi(Ui(Gi.role_failed,t),{role:e[1]})],[/^(\d+) \/ (\d+) complete$/i,(e,t)=>ea(Number(e[1]),Number(e[2]),t)],[/^Not planned$/i,(e,t)=>ea(0,0,t)]];function ra(e){return e===`zh-CN`?`zh`:`en`}function ia(e,t,n){let r=String(e??``).trim(),i=typeof n==`string`?{kind:n}:n??{};if(!i.kind||i.kind===`live_activity`){for(let[e,n]of ta)if(e.test(r))return Ui(Gi[n],t)}let a=i.kind?Gi[i.kind]:void 0;if(i.kind){let e=!!i.language&&i.language!==ra(t);if(a&&(e||!r)&&!a[0].includes(`{`))return Ui(a,t);if(r&&!e)return r}for(let[e,n]of na){let i=r.match(e);if(i)return typeof n==`string`?Ui(Gi[n],t):n(i,t)}if(a){let e=Ui(a,t);if(!e.includes(`{`))return e;let n=r.match(/\d+/)?.[0];return n&&e.includes(`{n}`)?Wi(e,{n}):r}let o=qi[r.toLowerCase()];return o?Ui(o,t):r}function aa(e,t){let n=Ji[String(e??``).trim().toLowerCase()];return n?Ui(n,t):``}function oa(e,t){let n=String(e??``).trim().toLowerCase(),r=qi[n];return r?Ui(r,t):n}function sa(e,t){let n=Xi[String(e??``).trim()];return n?Ui(Gi[n],t):null}function ca(e){return/^(?:provider\.|agent\.io\.|usage\.|budget\.|role\.session\.turn$)/.test(String(e??``))}var la=[[/^Next action:\s*/i,[`下一步:`,`Next: `]],[/^(?:原因:|Reason:)\s*/i,[`原因:`,`Reason: `]],[/^The backend has failed the same way (\d+) times in a row \(([^)]*)\)\. Waiting ([\d.]+)s before the next attempt[^\n]*/i,(e,t)=>({text:t===`zh-CN`?`模型服务已连续 ${e[1]} 次以同样的方式失败;为了不让持续的故障白白花钱,${e[3]} 秒后再试。`:`The model service has failed the same way ${e[1]} times in a row; waiting ${e[3]} seconds before trying again so a standing failure does not keep costing money.`,technical:e[2]})],[/^review: \w+(?: \([^)]*\))? — /i,[``,``]],[/^status=(\S+) rounds=(\d+) reason=/i,(e,t)=>{let n=Ki[e[1].toLowerCase()],r=n?Ui(n,t):oa(e[1],t);return t===`zh-CN`?`任务已结束(${r}),共 ${e[2]} 轮。`:`Task ended — ${r}, after ${e[2]} rounds.`}],[/^engineer round (\d+) \((?:fresh session|new session)\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮,在新的会话里开始。`:`Round ${e[1]}, started in a fresh session.`],[/^engineer round (\d+) \([^)]*\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮开始。`:`Round ${e[1]} started.`],[/^backend failure; retrying in a fresh \w+ session after ([\d.]+)s\.?$/i,(e,t)=>t===`zh-CN`?`模型服务调用失败,${e[1]} 秒后在新的会话里重试。`:`The model service call failed; retrying in a fresh session after ${e[1]} seconds.`],[/^planner error: (.*; retry later)\.?$/i,(e,t)=>({text:t===`zh-CN`?`规划这一步没有完成,稍后会重试。`:`Planning did not complete; it will be retried later.`,technical:e[1]})],[/^mission failed\.?$/i,[`任务失败了。`,`The task failed.`]],[/^Engineer backend failed before a trustworthy completed turn; reviewer skipped\.?/i,[`这一轮模型服务没有完成调用,所以没有人审阅。`,`The model service did not complete this round, so no one reviewed it.`]],[/^Reviewer backend unavailable for (\d+) consecutive attempt\(s\); failing loud rather than settling the round without a real review\.?/i,(e,t)=>t===`zh-CN`?`审阅者的模型服务连续 ${e[1]} 次没有响应,这一轮因此没有得到审阅。`:`The reviewer's model service did not respond ${e[1]} times in a row, so this round was not reviewed.`],[/^The Reviewer's session ended before it reached a conclusion, so this round was not judged\.?/i,[`审阅者在得出结论前就中断了,这一轮没有被评判。`,`The reviewer stopped before reaching a conclusion, so this round was not judged.`]],[/^The wait after a repeated backend failure ended early: daemon stop requested\.?/i,[`在等待重试时 Argus 被要求停止,任务随之暂停。`,`Argus was asked to stop while waiting to retry, so the task paused.`]],[/^Backend call paused before a trustworthy completed turn \(stop_kind=(\w+)\); reviewer skipped\.?/i,(e,t)=>t===`zh-CN`?`这一轮在得出可信结果前被暂停(${Qi(e[1],t)}),所以没有人审阅。`:`This round was paused before it produced a trustworthy result (${Qi(e[1],t)}), so no one reviewed it.`],[/^One Engineer call used its whole per-call provider-turn allowance \([^)]*\); reviewer skipped\. The work so far is kept and the task continues in a fresh session from the checkpoint\.?/i,[`这一轮用完了单次调用的额度;已做的工作保留,会在新的会话里接着做,本轮没有审阅。`,`This round used up its per-call allowance; the work so far is kept and continues in a fresh session. No review this round.`]],[/^Execution host is unavailable; reviewer skipped\.?/i,[`执行环境暂时不可用,这一轮没有审阅。`,`The execution environment is unavailable, so this round was not reviewed.`]],[/^Copilot CLI exited with code \d+\.?/i,[`模型服务的调用没有完成。`,`The model service call did not complete.`]],[/^Grounded bounded plan completed with (\d+) step\(s\)\.?/i,(e,t)=>t===`zh-CN`?`规划完成,共 ${e[1]} 步。`:`Planning finished with ${e[1]} steps.`],[/^Retry in a fresh \w+ session; do not resume the failed thread\.(?:\s*If this repeats, pause the daemon and reduce concurrent \w+ load\.)?/i,[`接下来会在新的会话里重试这一轮。`,`The round will be retried in a fresh session.`]],[/^Restart the daemon to resume this mission from its checkpoint\.?/i,[`重新运行 Argus 即可从保存的进度继续。`,`Run Argus again to continue from the saved progress.`]],[/^Resume this mission when the operator is ready\.?/i,[`准备好后即可恢复这项任务。`,`Resume the task whenever you are ready.`]],[/^Resume from the persisted checkpoint after the blocking budget or provider condition has been cleared\.?/i,[`预算或模型服务恢复后,即可从保存的进度继续。`,`Once the budget or model service is back, the task continues from the saved progress.`]],[/^inspecting project state$/i,[`正在查看项目状态`,`Looking at the project state`]],[/^running project command$/i,[`正在运行项目命令`,`Running a project command`]],[/^using a tool$/i,[`正在使用工具`,`Using a tool`]]],ua=/^(?:[\w.]+_(?:streak|code|error|kind)=|error=|exit=|fatal_error=|Runner receipt:|stop_kind=|backend_)/i;function da(e,t){let n=e.trim(),r=[],i=[],a=!1;for(;n;){let e=!1;for(let[o,s]of la){let c=n.match(o);if(!c)continue;let l=typeof s==`function`?s(c,t):Ui(s,t);typeof l==`string`?r.push(l):(r.push(l.text),l.technical&&i.push(l.technical)),n=n.slice(c[0].length).replace(/^[\s;,]+/,``),e=!0,a=!0;break}e||(a&&ua.test(n)?i.push(n):r.push(n),n=``)}let o=t===`zh-CN`?``:` `;return{text:r.filter(Boolean).join(o).replace(/:\s+/g,`:`),technical:i.join(` `)}}function fa(e,t,n){let r=String(e??``).trim();if(n){let e=n.language&&n.language!==ra(t)?aa(n.cause,t):``;if(e)return{text:e,technical:String(n.technical??``)};if(n.technical)return{text:r,technical:String(n.technical)}}if(!r)return{text:``,technical:``};let i=r.split(/(\n[ \t]*\n|\n)/),a=[],o=[];return i.forEach((e,n)=>{if(n%2==1){a.push(e.includes(` + +`)||/\n[ \t]*\n/.test(e)?` + +`:` +`);return}let r=da(e,t);a.push(r.text),r.technical&&o.push(r.technical)}),{text:a.join(``).replace(/\n{3,}/g,` + +`).trim(),technical:o.join(` `)}}function pa(e,t){let n=e.split(/(\r?\n)/),r=n.findIndex((e,t)=>t%2==0&&e.trim()!==``),i=n[r]?.trim()??``,a=i.match(/^(?:Task continued|任务已继续)(?: · (.+))?$/),o=i.match(/^Could not complete (.+)\.$/)??i.match(/^未能完成:(.+)。$/);if(!a&&!o)return null;let s=t===`zh-CN`,c=[],l=``,u=!1;return{text:n.map((e,n)=>{if(n%2==1)return e;if(n===r){if(a){let e=a[1]??``,n=e.match(/^(.*?) · review=(\S+)$/),r=n?n[1]:e;return[s?`当时记录:工作继续推进。`:`Recorded then: work continued.`,r?`${s?`任务:`:`Task: `}${r}`:``,n?`${s?`当时记录的审阅状态:`:`Review status recorded then: `}${oa(n[2],t)}`:``].filter(Boolean).join(` +`)}let e=o[1];return/^(?:the current task|当前任务)$/.test(e)?s?`当时这项任务未能完成。`:`This task had not completed at that time.`:s?`当时未能完成:${e}。`:`Not completed at that time: ${e}.`}if(/^(?:Progress|Mission summary|本次进展|本次完成)[::]/.test(e)&&(u=!0),u)return e;let i=e.match(/^\s*(`{3,}|~{3,})/);if(i)return l?l===i[1][0]&&(l=``):l=i[1][0],e;if(l)return e;if(/^(?:Nothing is queued yet; the Planner is deciding what comes next\.|计划里暂时没有下一项,Planner 正在决定接下来做什么。)$/.test(e))return s?`当时尚未排入下一项任务,规划者还在决定接下来做什么。`:`At that time, nothing was queued and the Planner was still deciding what to do next.`;let d=e.match(/^(?:Next(?: action| up)?|下一步|接下来做)[::]\s*(.*)$/);if(d){let e=/^(?:Argus will diagnose the failure and choose a safe next step\.|Argus 会诊断原因并选择可恢复的方案。)$/.test(d[1])?s?`诊断当时的原因,再选择可恢复的方案。`:`Diagnose the cause and choose a recovery approach.`:d[1];return`${s?`当时记录的下一步:`:`Next step recorded at the time: `}${e}`}let f=e.match(/^(?:Reason:|原因:)\s*(.*)$/);if(f){let e=Vi(f[1]);if(e.prose===`Argus was stopped by its operator in the middle of this round; the Engineer's work so far is kept and nothing was retried.`){let t=Hi(f[1],s);return e.receipt&&c.push(e.receipt),s?`当时${t.summary}。已做的工作保留,当时没有重试。`:`At that time, ${t.summary}. Work done so far was kept, and no retry was made then.`}let n=fa(f[1],t);if(n.text!==f[1].trim()||n.technical)return n.technical&&c.push(n.technical),`${s?`当时记录的原因:`:`Reason recorded at the time: `}${n.text}`}return Bi.test(e.trim())?(c.push(e),``):e}).join(``),technical:c.join(` +`)}}var ma=3,ha=`engineer.progress`,ga=new Set([`tool_use`,`command_execution`,`file_change`]),_a=[`assistant_message`,`agent_message`,`message`],va=e=>e,Q=(e,t)=>String(va(e)[t]??``),ya=e=>Q(e,`type`)===ha?Q(e,`kind`):``;function ba(e,{locale:t,showReasoning:n,filter:r=`all`,query:i=``}){let a=[],o=new Map,s=0,c={locale:t,showReasoning:n,unknownEventPolicy:`hide`,density:`compact`};return e.forEach(e=>{let t=Ii(e,c);if(!t){!n&&Ee(e)&&s++;return}if(!De(e,t,r,i))return;let l=Q(e,`message_id`),u=!!l&&Q(e,`type`)===ha&&_a.includes(Q(e,`kind`));if(u&&o.has(l)){let n=o.get(l);a[n]={...a[n],ev:{...a[n].ev,...e},r:{...a[n].r,...t,text:O(a[n].r.text,t.text,ae(e))}};return}let d={ev:e,r:t,key:we(e)};u&&o.set(l,a.length),a.push(d)}),{list:a,hiddenReasoning:s}}function xa(e){let t=Q(e,`tool_name`)||Q(e,`tool`)||Q(e,`name`);if(t)return t;let n=Q(e,`text`).match(/^([A-Za-z_][\w.-]{0,40}):\s/);return n?n[1]:``}function Sa(e){let t=Q(e,`status`).toLowerCase();if(t===`running`||t===`started`||t===`in_progress`||t===`pending`)return`running`;if(t===`failed`||t===`error`||t===`errored`)return`failed`;let n=va(e).exit_code;return typeof n==`number`&&n!==0?`failed`:[`completed`,`complete`,`success`,`succeeded`,`done`,`ok`,`finished`].includes(t)?`completed`:``}function Ca(e,t){let n=Q(t,`call_id`),r=Q(e.ev,`call_id`);return n&&r?n===r:ya(e.ev)===ya(t)&&xa(e.ev)===xa(t)&&Q(e.ev,`text`)===Q(t,`text`)}var wa=(e,t)=>({kind:`step`,key:e.key,ev:e.ev,r:e.r,latest:e.ev,repeat:1,status:t});function Ta(e){let t=[],n=[],r=(e,t,r,i)=>{let[a]=n.splice(e,1);a.status=r,a.latest=t,i&&(a.result=i)};for(let i of e){let e=ya(i.ev);if(ga.has(e)){let e=Sa(i.ev);if(e!==`running`){let t=n.length-1;for(;t>=0&&!Ca(n[t],i.ev);)--t;if(t>=0){r(t,i.ev,e||`completed`);continue}}let a=wa(i,e);t.push(a),e===`running`&&n.push(a);continue}if(e===`tool_result`){let e=Q(i.ev,`call_id`),t=xa(i.ev),a=e?n.findIndex(t=>Q(t.ev,`call_id`)===e):n.findIndex(e=>!t||xa(e.ev)===t);if(a>=0){r(a,i.ev,Sa(i.ev)||`completed`,i);continue}}t.push(wa(i,``))}return t}var Ea=/fail|error|backoff|stall|denied|blocked|nudge|escalat/i,Da=/\b(?:fail(?:ed|ure)?|error|unavailable|unreachable|exited with code|backoff|retry(?:ing)?|stuck|skipped)\b/i;function Oa(e){if(ya(e.ev))return!1;let t=e.ev;return e.r.tone===`err`||e.r.tone===`warn`||Ea.test(Q(t,`type`))||va(t).backend_unavailable===!0||va(t).review_skipped===!0||Da.test(e.r.text)}var ka=e=>e.toLowerCase().replace(/\d+(?:\.\d+)?/g,`#`).replace(/\s+/g,` `).trim();function Aa(e){let t=e.ev;return ka(Q(t,`signature`)||Q(t,`cause`)||Q(t,`backend_error`)||Q(t,`error`)||Q(t,`reason`)||Q(t,`stop_kind`)||e.r.text)}function ja(e,t){return Oa(e)?`fail|${e.r.role}|${Q(e.ev,`type`)}|${Aa(e)}`:`text|${e.r.role}|${e.r.glyph}|${fa(e.r.text,t).text}`}function Ma(e,t){e.repeat+=t.repeat,e.latest=t.latest,e.r=t.r,t.status&&(e.status=t.status),t.result&&(e.result=t.result)}function Na(e,t){let n=[],r=[];for(let i of e){let e=ja(i,t),a=n[n.length-1];if(a&&r[r.length-1]===e){Ma(a,i);continue}n.push({...i}),r.push(e)}let i=r.map((e,t)=>ya(n[t].ev)?e:ka(e)),a=(e,t)=>{if(e+2*t>n.length)return!1;for(let n=0;ne.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,Ra=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,za=e=>Ra(e.replace(/^[a-z]+:\/\/(?:www\.)?/i,``).replace(/#.*$/,``).replace(/\/$/,``),48),Ba=/\*\*\* (?:Add|Update|Delete|Move to) File:\s*(\S+)/;function Va(e,t,n){for(let r of n){if(e){let t=e[r];if(typeof t==`string`&&t.trim())return t.trim();if(Array.isArray(t)&&typeof t[0]==`string`&&t[0].trim())return t[0].trim();continue}let n=t.match(RegExp(`"${r}":\\s*"((?:[^"\\\\]|\\\\.)*)"`));if(n&&n[1])return n[1].replace(/\\(.)/g,`$1`)}return``}function Ha(e){return Ua(e.ev)}function Ua(e){let t=Q(e,`text`);if(ya(e)===`file_change`){let e=t.match(Ba);if(e)return La(e[1].trim());let n=t.match(/^(\S+\.[A-Za-z0-9]{1,8})\b/);return n?La(n[1]):``}let n=t.replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),r=null;if(n.startsWith(`{`))try{let e=JSON.parse(n);r=e&&typeof e==`object`&&!Array.isArray(e)?e:null}catch{r=null}let i=Va(r,n,[`path`,`file_path`,`filePath`,`file`,`filename`,`target_file`,`notebook_path`,`paths`]);if(i&&!/^\.\/?$/.test(i))return La(i);let a=Va(r,n,[`url`,`uri`]);if(a)return za(a);let o=Va(r,n,[`pattern`,`query`,`regex`,`glob`,`q`]);if(o)return Ra(o,32);let s=n.match(Ba);return s?La(s[1].trim()):``}function Wa(e,t){let n=t===`zh-CN`,r=e.trim().replace(/\\/g,`/`).split(`/`).filter(e=>e&&e!==`**`&&e!==`.`),i=r[r.length-1]??`*`,a=r.slice(0,-1).filter(e=>!/[*?]/.test(e)),o;o=i===`*`||i===`*.*`?n?`所有文件`:`all files`:/^\*\.[\w.]+$/.test(i)?n?`${i.slice(1)} 文件`:`${i.slice(1)} files`:Ra(i,40);let s=a[a.length-1];return s?n?`${s} 里的 ${o}`:`${o} in ${s}`:o}var Ga=/^(glob|find|find_?files|list_?files|file_?search)$/i;function Ka(e,t){let n=t===`zh-CN`,r=xa(e),i=Fa(r,ya(e)),a=Ua(e);if(i===`search`){let t=Va(null,Q(e,`text`).replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),[`pattern`,`query`,`regex`,`glob`,`q`]);t&&(a=Ra(t,48))}if(i===`search`&&Ga.test(r)&&a)return`${n?`查找`:`Find`} ${Wa(a,t)}`;let o=a.startsWith(`/`)?La(a):a,[s,c,l,u]={read:[`查阅`,`查阅文件`,`Read`,`Read a file`],search:[`搜索:`,`搜索`,`Search:`,`Search`],fetch:[`读取`,`读取网页`,`Open`,`Open a page`],edit:[`修改`,`修改文件`,`Edit`,`Edit a file`],tool:[`调用`,`调用工具`,`Use`,`Use a tool`]}[i],d=i===`tool`?r:o;if(!d)return n?c:u;let f=n?s:l;return f.endsWith(`:`)?`${f}${d}`:`${f} ${d}`}function qa(e,t){let n=ya(e);return n===`command_execution`?{title:t===`zh-CN`?`正在运行命令`:`Running a command`,detail:``}:[`tool_use`,`file_change`].includes(n)?{title:{read:[`查看资料`,`Reading material`],search:[`查找相关信息`,`Searching for relevant information`],fetch:[`读取资料页面`,`Reading a source page`],edit:[`更新项目文件`,`Updating project files`],tool:[`执行一个工作步骤`,`Carrying out a work step`]}[Fa(xa(e),n)][t===`zh-CN`?0:1],detail:Ua(e)}:null}function Ja(e){let t=e[0],n=e[e.length-1],r=xa(t.ev)||(ya(t.ev)===`file_change`?`file`:`tool`),i=Fa(r,ya(t.ev)),a=[],o=0;for(let t of e){let e=Ha(t);e&&(o+=1,a.includes(e)||a.push(e))}let s=e.reduce((e,t)=>e+t.repeat,0),c=i===`read`||i===`edit`||i===`fetch`;return{kind:`group`,key:`group:${t.key}`,r:{...t.r,text:``},latest:n.latest,tool:r,action:i,steps:e,targets:a,count:c&&o===e.length?a.length:s,calls:s,failed:e.filter(e=>e.status===`failed`).length}}function Ya(e){let t=[],n=[],r=null,i=()=>{n.length>=3?t.push(Ja(n)):t.push(...n),n=[],r=null};for(let a of e){let e=Ia(a);if(e&&(r===null||r===e)){n.push(a),r=e;continue}i(),e?(n.push(a),r=e):t.push(a)}return i(),t}function Xa(e,t){return Ya(Na(Ta(e),t))}function Za(e,t,n){let r=t(`stream.fold.${e.action}`,{count:e.count,tool:e.tool}),i=e.targets.slice(0,ma);return`${r}${i.length?`${n===`zh-CN`?`:`:`: `}${i.join(n===`zh-CN`?`、`:`, `)}${e.targets.length>i.length?`…`:``}`:``}${e.failed?` · ${t(`stream.fold.failed`,{count:e.failed})}`:``}`}function Qa(e,t,n){return e.kind===`group`?Za(e,t,n):fa(e.r.text,n).text}var $a=new Set([`tool_use`,`command_execution`,`file_change`]),eo=new Set([`completed`,`failed`,`cancelled`,`canceled`,`error`,`done`,`stopped`]),to=()=>Date.now()/1e3;function no(e){return e.trim().replace(/[.…]+$/u,``).toLowerCase()}function ro(e,t,n=to()){let r=(t.label??``).trim();if(!r)return e;let i=t.heartbeat===!0,a=e.slice(),o=(t.callId??``).trim(),s=(t.status??``).trim().toLowerCase(),c=(t.kind??``).trim();if(o){let e=-1;for(let t=a.length-1;t>=0;--t)if(a[t].callId===o){e=t;break}if(e>=0){let i=a[e];return a[e]={...i,label:c===`tool_result`?i.label:r,detail:(t.detail||``).trim()||i.detail,tool:(t.tool||``).trim()||i.tool,output:(t.output||``).trim()||i.output,status:s||i.status,endedTs:eo.has(s)?n:i.endedTs},a}if(c===`tool_result`)return a}let l=a[a.length-1];if(c===`tool_result`)return!l||l.endedTs||l.heartbeat||(a[a.length-1]={...l,output:(t.output||``).trim()||l.output,status:s||`completed`,endedTs:n}),a;if(l&&!l.endedTs){if(no(l.label)===no(r)||i&&l.heartbeat)return a[a.length-1]={...l,label:r,detail:t.detail||l.detail,kind:t.kind||l.kind,heartbeat:i,endedTs:0},a;l.callId||(a[a.length-1]={...l,endedTs:n})}return a.push({id:`${a.length}:${r}:${n}`,role:(t.role||`manager`).trim()||`manager`,label:r,detail:(t.detail||``).trim(),kind:c,startedTs:n,endedTs:0,heartbeat:i,...t.tool?.trim()?{tool:t.tool.trim()}:{},...t.toolKind?.trim()?{toolKind:t.toolKind.trim()}:{},...o?{callId:o}:{},...s||o?{status:s||`running`}:{},...t.output?.trim()?{output:t.output.trim()}:{}}),a}function io(e,t=to()){return e.length===0?[]:e.map(e=>e.endedTs?e:{...e,endedTs:t})}function ao(e){if(!Number.isFinite(e)||e<1)return``;if(e<60)return`${Math.floor(e)}s`;let t=Math.floor(e/60),n=Math.floor(e%60);return n?`${t}m${n}s`:`${t}m`}function oo(e,t=to(),n=!1){return e.filter(e=>!e.heartbeat&&$a.has(e.kind)).map(e=>{let r=!e.endedTs&&(!e.status||e.status===`running`)?n?`completed`:`running`:e.status||`completed`;return{kind:e.kind,label:e.label,...e.detail?{detail:e.detail}:{},...e.tool?{tool:e.tool}:{},...e.toolKind?{tool_kind:e.toolKind}:{},...e.callId?{call_id:e.callId}:{},status:r,started_ts:e.startedTs,ended_ts:e.endedTs||(n?t:0),...e.output?{output:e.output}:{}}})}var so=e=>typeof e==`string`?e.trim():``,co=e=>typeof e==`number`&&Number.isFinite(e)?e:0;function lo(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(e=>{if(!e||typeof e!=`object`)return;let n=e,r=so(n.label);r&&t.push({kind:so(n.kind)||`tool_use`,label:r,...so(n.detail)?{detail:so(n.detail)}:{},...so(n.tool)?{tool:so(n.tool)}:{},...so(n.tool_kind)?{tool_kind:so(n.tool_kind)}:{},...so(n.call_id)?{call_id:so(n.call_id)}:{},status:so(n.status).toLowerCase()||`completed`,started_ts:co(n.started_ts),ended_ts:co(n.ended_ts),...so(n.output)?{output:so(n.output)}:{}})}),t}function uo(e,t=to()){if(!e.length)return 0;let n=Math.min(...e.map(e=>e.started_ts||t)),r=Math.max(...e.map(e=>e.ended_ts||t));return Math.max(0,r-n)}var fo={command_execution:Xe,tool_use:$t,file_change:zt},po=new Set([`failed`,`error`]),mo=new Set([`cancelled`,`canceled`,`stopped`]),ho=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,go=/^⚙\s*([\w.-]+)\s*·\s*(.*)$/su;function _o(e,t=`zh-CN`){let n=(e.tool??``).trim(),r=(e.detail??``).trim(),i=e.label.match(go);if(i){let e=i[1],a=r||i[2];return{primary:Ka({type:`engineer.progress`,kind:`tool_use`,tool_name:n||e,text:`${e}: ${a}`},t),secondary:a}}let a=e.label.replace(ho,``).trim();return{primary:a||n,secondary:r&&r!==a?r:``}}function vo({steps:e,live:t,startedTs:n,status:r=``}){let{t:i,locale:a}=F(),[o,s]=(0,U.useState)(!1),[,c]=(0,U.useState)(0);if((0,U.useEffect)(()=>{if(!t)return;let e=setInterval(()=>c(e=>e+1),1e3);return()=>clearInterval(e)},[t]),(0,U.useEffect)(()=>{t||s(!1)},[t]),!e.length&&!t)return null;let l=Date.now()/1e3,u=po.has(r)||e.some(e=>po.has(e.status)),d=mo.has(r)||e.some(e=>mo.has(e.status)),f=ao(t&&n?Math.max(0,l-n):uo(e,l))||`<1s`,p=[...e].reverse().find(e=>e.status===`running`),m=t?`${p?_o(p,a).primary:a===`zh-CN`?`正在准备回复`:`Preparing a reply`} · ${f}`:u?`${a===`zh-CN`?`过程出现问题,请查看详情`:`An issue occurred; see details`} · ${f}`:d?`${a===`zh-CN`?`已停止`:`Stopped`} · ${f}`:i(`chat.stepsDone`,{count:e.length,seconds:f});return(0,K.jsxs)(`div`,{className:`turn-steps mt-3 rounded-lg border border-line/50 bg-surface/50 text-xs`,"data-live":t||void 0,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,"aria-label":a===`zh-CN`?`查看工作过程`:`View work progress`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-ink-dim hover:text-ink`,children:[(0,K.jsx)(t?W:u?Pt:d?Yt:Ne,{size:14,"aria-hidden":`true`,className:`shrink-0 ${t?`animate-spin text-manager motion-reduce:animate-none`:u?`text-err`:d?`text-ink-faint`:`text-ok`}`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:m}),(0,K.jsx)(o?Me:Mt,{size:14,"aria-hidden":`true`,className:`shrink-0 text-ink-faint`})]}),o?(0,K.jsxs)(`ol`,{className:`space-y-1 border-t border-line/40 px-3 py-2`,children:[!e.length&&(0,K.jsx)(`li`,{className:`text-ink-faint`,children:a===`zh-CN`?`尚未记录工具操作。`:`No tool operations recorded yet.`}),e.map((e,n)=>{let{primary:r,secondary:o}=_o(e,a),s=e.status===`running`,c=po.has(e.status),u=mo.has(e.status),d=e.kind===`command_execution`?fo.command_execution:e.kind===`file_change`?fo.file_change:fo.tool_use,f=ao(Math.max(0,(e.ended_ts||l)-e.started_ts));return(0,K.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,K.jsx)(d,{size:13,"aria-hidden":`true`,className:`shrink-0 self-start mt-0.5 ${c?`text-err`:`text-ink-faint`}`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`${s&&t?`text-ink`:c?`text-err`:`text-ink-dim`}`,title:o||r,children:r}),o?(0,K.jsxs)(`details`,{className:`turn-step-raw inline`,children:[(0,K.jsx)(`summary`,{className:`ml-2 inline cursor-pointer list-none text-[11px] text-ink-faint hover:text-ink-dim`,children:i(`chat.stepRaw`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block break-all font-mono text-[11px] text-ink-faint`,children:o})]}):null,c&&e.output?(0,K.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-err/80`,children:e.output}):null]}),(0,K.jsx)(`span`,{className:`shrink-0 font-mono tabular-nums ${s&&t?`text-manager`:`text-ink-faint`}`,children:s&&t?(0,K.jsx)(W,{size:12,className:`animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):c?i(`chat.stepFailed`):u?a===`zh-CN`?`已停止`:`Stopped`:f})]},e.call_id||`${n}:${e.started_ts}`)})]}):null]})}var yo=new Set([`running`,`in_progress`,`claimed`]);function bo(e,t){let n;for(let r of t)r.item_id!==e.id||![`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.mission.orphaned`].includes(r.type)||(!n||r.ts>=n.ts)&&(n=r);if(n?.type===`life.mission.completed`&&!(n.ts(t.status===`done`||yo.has(t.status))&&(t.ts??0)>e?t.ts??0:e,0)}function So(e,t){return e.status===`failed`&&!e.pending_question&&(e.ts??0)t.status!==`done`&&!yo.has(t.status)&&(t.pending_question||t.status===`failed`&&!So(t,e))).sort((e,t)=>Number(!!t.pending_question)-Number(!!e.pending_question))}function wo(e){return e.find(e=>yo.has(e.status))??Co(e)[0]??e.find(e=>e.status===`pending`)??e.at(-1)}function To(e,t){let n=new Set,r=new Set;for(let i of e.links)i.kind===`dependency`&&(i.target===t&&n.add(i.source),i.source===t&&r.add(i.target));return{upstream:e.tasks.filter(e=>n.has(e.id)),downstream:e.tasks.filter(e=>r.has(e.id))}}function Eo(e){return e.status===`cancelled`?`aborted`:e.pending_question?`question`:yo.has(e.status)?`running`:e.outcome?.review_status===`unavailable`?`review_unavailable`:e.status===`failed`&&Do(e)?`held`:e.status.startsWith(`paused`)||e.status===`blocked`?`paused`:[`done`,`failed`,`aborted`,`skipped`,`superseded`,`pending`,`missing`].includes(e.status)?e.status:`unknown`}function Do(e){return e.outcome?.stage_certification===`not_certified`||!e.outcome?.execution_status&&/^manager stage hold:/i.test(e.last_error||``)}function Oo(e,t){let n=e=>t.some(t=>t.type===`life.mission.started`&&t.ts>e);return e.filter(e=>e.status===`done`&&e.outcome?.review_status===`done`&&e.outcome.stage_certification===`certified`).map(e=>({task:e,completion:bo(e,t)})).filter(({completion:e})=>e?.overall_complete===!0&&!n(e.ts)).map(({task:e})=>e).sort((e,t)=>(t.finished_ts??t.ts??0)-(e.finished_ts??e.ts??0))[0]}function ko(e){let t=new Set,n=[],r=new Map([...e.keys()].map(e=>[e,[]]));for(let[t,n]of e)for(let e of n)r.get(e).push(t);for(let r of e.keys()){let i=[[r,!1]];for(;i.length;){let[r,a]=i.pop();if(a)n.push(r);else if(!t.has(r)){t.add(r),i.push([r,!0]);for(let n of e.get(r))t.has(n)||i.push([n,!1])}}}let i=new Map;for(let e of n.reverse()){if(i.has(e))continue;let t=i.size,n=[e];for(;n.length;){let e=n.pop();if(!i.has(e)){i.set(e,t);for(let t of r.get(e))n.push(t)}}}return i}function Ao(e){let t=new Map(e.map(e=>[e.id,e])),n=[...t.values()].sort((e,t)=>(e.ts??0)-(t.ts??0)||e.id.localeCompare(t.id)),r=[],i=new Set;for(let e of n)for(let n of new Set(e.deps??[]))t.has(n)||i.add(n),r.push({id:JSON.stringify([`dep`,n,e.id]),source:n,target:e.id,kind:`dependency`,missing:!t.has(n)});let a=[...[...i].map(e=>({id:e,title:`未包含的依赖`,objective:`该引用不在当前数据范围内。`,status:`missing`,deps:[],role:`system`})),...n],o=new Map(a.map(e=>[e.id,0])),s=new Map(a.map(e=>[e.id,[]]));r.forEach(e=>{o.set(e.target,(o.get(e.target)??0)+1),s.get(e.source)?.push(e.target)});let c=a.filter(e=>o.get(e.id)===0).map(e=>e.id),l=0;for(let e=0;et.id!==e.id&&t.plan_id===e.superseded_by_plan_id);t.length&&r.push({id:JSON.stringify([`replacement`,e.id,e.superseded_by_plan_id]),source:e.id,target:t[0].id,kind:`replacement`,target_plan_id:e.superseded_by_plan_id,target_count:t.length})}if(u){let e=ko(s);r.filter(t=>t.kind===`dependency`&&e.get(t.source)===e.get(t.target)).forEach(e=>{e.cycle=!0})}return{tasks:a,links:r,missing:i.size,cyclic:u}}function jo(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function Mo(e){return e?.match(/route[-_ ]?(\d+)/i)?.[1]??e?.match(/(\d+)\s*$/)?.[1]??``}function No(e,t){if(!e)return``;if(e.kind===`review`)return e.verdict===`rejected`?t?`复核:驳回`:`Review: rejected`:e.verdict===`qualified`?t?`复核:通过`:`Review: qualified`:``;if(e.kind===`route`)return e.selected?t?`通过 · 被选中`:`Qualified · chosen`:e.verdict===`rejected`?t?`驳回`:`Rejected`:e.verdict===`qualified`?e.selected===!1?t?`通过 · 未选中`:`Qualified · not chosen`:t?`通过`:`Qualified`:``;let n=Mo(e.selected_route);return n?t?`已选研究路线 ${n}`:`Chose route ${n}`:``}function Po(e){return e?e.kind===`selection`?e.selected_route?`chosen`:``:e.selected?`chosen`:e.verdict??``:``}function Fo(e){let t=String(e||``).split(/\r?\n/).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY|NEXT_ACTION)\s*=\s*/i,``).trim()).filter(e=>e&&!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e)).join(` `);return t.length>160?`${t.slice(0,159)}…`:t}function Io(e){let t=new Map;for(let n of e){if(n.type!==`idea.portfolio.formed`)continue;let e=Number(n.width);if(!Number.isInteger(e)||e<=0)continue;let r=t.get(n.item_id);(!r||n.ts>=r.ts)&&t.set(n.item_id,{ts:n.ts,width:e})}return new Map([...t].map(([e,t])=>[e,t.width]))}function Lo(e,t,n,r=16){let i=new Map;for(let e of t){if(e.type!==`team.task`||!e.item_id)continue;let t=i.get(e.item_id)??new Map;t.set(e.id,e),i.set(e.item_id,t)}if(!i.size)return e;let a=new Set(e.tasks.map(e=>e.id)),o=[],s=[];for(let t of e.tasks){if(t.branch)continue;let e=[...i.get(t.id)?.values()??[]].filter(e=>!a.has(e.id)).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));if(!e.length)continue;let c=e.slice(0,r),l=new Set(c.map(e=>e.id));for(let e of c)a.add(e.id),o.push({id:e.id,title:jo(e,n),objective:Fo(e.text),excerpt:Fo(e.text),status:e.status||`unknown`,deps:[],pending_question:e.pending_question,role:`team`,team_role:e.team_role,...e.team_outcome?{team_outcome:e.team_outcome}:{},ts:e.ts,branch:!0,parent_id:t.id});let u=new Set(c.flatMap(e=>(e.deps??[]).filter(t=>l.has(t)&&t!==e.id)));for(let e of c){let n=[...new Set(e.deps??[])].filter(t=>l.has(t)&&t!==e.id);if(n.length)for(let t of n)s.push({id:JSON.stringify([`fanout`,t,e.id]),source:t,target:e.id,kind:`fanout`});else s.push({id:JSON.stringify([`fanout`,t.id,e.id]),source:t.id,target:e.id,kind:`fanout`});u.has(e.id)||s.push({id:JSON.stringify([`fanin`,e.id,t.id]),source:e.id,target:t.id,kind:`fanin`})}let d=e.length-c.length,f=`team-overflow:${t.id}`;d>0&&!a.has(f)&&(a.add(f),o.push({id:f,title:n?`还有 ${d} 条`:`+${d} more`,objective:n?`更多并行子任务收录在所属任务卡片中。`:`The remaining parallel subtasks live inside the owning card.`,status:`recorded`,deps:[],role:`team`,ts:e[r]?.ts,branch:!0,parent_id:t.id,overflow_count:d}),s.push({id:JSON.stringify([`fanout`,t.id,f]),source:t.id,target:f,kind:`fanout`},{id:JSON.stringify([`fanin`,f,t.id]),source:f,target:t.id,kind:`fanin`}))}return o.length?{...e,tasks:[...e.tasks,...o],links:[...e.links,...s]}:e}var Ro={"idea-route":[e=>`${e} 条研究路线`,e=>`${e} research route${e===1?``:`s`}`],"idea-review":[e=>`${e} 次独立复核`,e=>`${e} independent review${e===1?``:`s`}`],"idea-selector":[e=>`${e} 次方案选择`,e=>`${e} idea selection${e===1?``:`s`}`]},zo=[e=>`${e} 个并行子任务`,e=>`${e} parallel subtask${e===1?``:`s`}`],Bo={pending:[`尚未开始`,`have not started`],running:[`正在进行`,`are under way`],done:[`已经完成`,`are complete`],failed:[`没有完成`,`did not finish`],question:[`在等待答复`,`are waiting for an answer`],paused:[`已暂停`,`are paused`],superseded:[`已被新计划替代`,`were replaced by a new plan`],aborted:[`已取消`,`were cancelled`],skipped:[`已跳过`,`were skipped`]};function Vo(e,t,n){let r=e.map(({role:e,count:t})=>(Ro[e]??zo)[+!n](t)),i=n?r.length>1?`${r.slice(0,-1).join(`、`)}与 ${r[r.length-1]}`:r[0]:r.length>1?`${r.slice(0,-1).join(`, `)} and ${r[r.length-1]}`:r[0],a=(Bo[t]??[`已记录在案`,`are on record`])[+!n];return n?`${i}${a}`:`${i} ${a}`}function Ho(e,t){let n=e.filter(e=>e.team_outcome?.kind===`route`),r=n.filter(e=>e.team_outcome?.selected).map(e=>Mo(e.title)),i=n.filter(e=>e.team_outcome?.verdict===`rejected`&&!e.team_outcome.selected).map(e=>Mo(e.title)),a=n.filter(e=>e.team_outcome?.verdict===`qualified`&&!e.team_outcome.selected).map(e=>Mo(e.title)),o=[],s=e=>[...e].sort().join(t?`、`:`, `);return r.length&&o.push(t?`路线 ${s(r)} 通过并被选中`:`route ${s(r)} qualified and chosen`),a.length&&o.push(t?`路线 ${s(a)} 通过${r.length?`但未被选中`:`,等待选择`}`:`route${a.length>1?`s`:``} ${s(a)} qualified${r.length?` but not chosen`:`, selection pending`}`),i.length&&o.push(t?`路线 ${s(i)} 被驳回`:`route${i.length>1?`s`:``} ${s(i)} rejected`),o.length?t?`:${o.join(`,`)}`:`: ${o.join(`; `)}`:``}function Uo(e,t,n,r=3){let i=new Map;for(let t of e.tasks){if(!t.branch||t.overflow_count||t.group||!t.parent_id)continue;let e=JSON.stringify([t.parent_id,Eo(t)]);(i.get(e)??i.set(e,[]).get(e)).push(t)}let a=new Set(e.tasks.map(e=>e.id)),o=new Map,s=new Map;for(let[e,c]of i){if(c.lengthe.role===t);n?n.count++:d.push({role:t,count:1})}let f=c[0],p=t.has(u);o.set(u,{id:u,title:Vo(d,l,n)+Ho(c,n),objective:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,excerpt:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,status:f.status,deps:[],pending_question:f.pending_question,role:`team`,ts:f.ts,branch:!0,parent_id:i,group:{status:l,members:c.map(e=>e.id),counts:d,expanded:p}});for(let e of c)s.set(e.id,u)}if(!o.size)return e;let c=[],l=new Set;for(let n of e.tasks){let e=s.get(n.id);if(!e){c.push(n);continue}l.has(e)||(l.add(e),c.push(o.get(e))),t.has(e)&&c.push(n)}let u=[],d=new Set;for(let n of e.links){let e=s.get(n.source),r=s.get(n.target),i=n.source,a=n.target;if(e&&!t.has(e)&&(i=e),r&&!t.has(r)&&(a=r),r&&t.has(r)&&n.kind===`fanout`&&n.source===o.get(r).parent_id&&(i=r),i===a)continue;if(i===n.source&&a===n.target){u.push(n);continue}let c=JSON.stringify([n.kind,i,a]);d.has(c)||(d.add(c),u.push({...n,id:c,source:i,target:a}))}for(let[e,n]of o){if(!t.has(e))continue;let r=JSON.stringify([`fanout`,n.parent_id,e]);d.has(r)||(d.add(r),u.push({id:r,source:n.parent_id,target:e,kind:`fanout`}))}return{...e,tasks:c,links:u}}function Wo(e){return e.filter(e=>!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)).map(({source:e,target:t})=>({source:e,target:t}))}function Go(e,t,n,r=[]){let i=(e,t)=>r.find(n=>n.source===e&&n.target===t&&n.label),a=e.links.map(e=>{if(e.kind!==`dependency`)return e;let r=t.find(t=>t.source===e.source&&t.target===e.target)??i(e.source,e.target);return r?{...e,label:r.label,stated:!0,evidence:`${n?`执行依赖`:`Execution dependency`} · ${r.label}`}:e}),o=new Map(e.tasks.map(e=>[e.id,e.id])),s=e=>{let t=o.get(e);return t===e?e:s(t)},c=(e,t)=>{o.set(s(e),s(t))};for(let e of a.filter(e=>e.kind===`dependency`))c(e.source,e.target);for(let n of t)!o.has(n.source)||!o.has(n.target)||e.tasks.findIndex(e=>e.id===n.source)>=e.tasks.findIndex(e=>e.id===n.target)||s(n.source)===s(n.target)||(a.push({source:n.source,target:n.target,label:n.label,kind:`semantic`,stated:!0,id:`semantic:${n.source}:${n.target}`}),c(n.source,n.target));for(let t=1;tKo+Math.min(500,Math.max(0,e-8)*60);function Yo(e,t,n,r,i,a,o){let s=new Map(n.map(e=>[e,t[e].y+i[e].height/2]));for(let c=0;c<6;c++)for(let l of c%2?[...e].reverse():e){let e=new Set(l),c=[],u=[],d=0;l.forEach((f,p)=>{let m=s.get(f)*.8,h=.8;for(let o of a[r.get(f)]){let r=n[o.index];e.has(r)||(m+=(t[r].y+i[r].height/2)*o.weight,h+=o.weight)}c.push(d);let g=m/h-i[f].height/2-d;for(u.push({start:p,end:p,sum:g*h,weight:h});u.length>1;){let e=u[u.length-2],t=u[u.length-1];if(e.sum/e.weight<=t.sum/t.weight)break;e.end=t.end,e.sum+=t.sum,e.weight+=t.weight,u.pop()}d+=i[f].height+(p+1[e,t])),a=t.filter(e=>e.kind!==`replacement`&&e.source!==e.target).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:.4})),o=e.map(()=>[]),s=e.map(()=>[]),c=e.map(()=>[]);for(let e of a)o[e.source].push(e.target),s[e.target].push(e.source),c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let l=new Set(a.filter(e=>e.weight===1).map(e=>`${Math.min(e.source,e.target)}:${Math.max(e.source,e.target)}`)),u=(e,t)=>{let n=i.get(e),r=i.get(t);return l.has(`${Math.min(n,r)}:${Math.max(n,r)}`)?qo:qo*1.3},d=e.reduce((e,t)=>e+n[t].width*n[t].height,0),f=Math.sqrt(d/e.length),p=e.reduce((e,t)=>e+n[t].height,0)/e.length,m=Math.ceil(Math.sqrt(e.length)*1.8),h=e.map(()=>[]);for(let e of a)h[Math.max(e.source,e.target)].push(e);let g=e.map((t,n)=>{let r=0;return Array.from({length:Math.min(m,e.length-n)+1},(e,t)=>{if(t)for(let e of h[n+t-1])Math.min(e.source,e.target)1||s[e.target].length>1)&&(r+=e.weight*.9),r+=Math.max(0,Math.abs(e.target-e.source)-1)*e.weight);return r})}),_={},v=1/0,y=new Set;for(let t=1;t<=m;t++){let o=t*p+(t-1)*qo,l=Array(e.length+1).fill(1/0),m=Array(e.length+1).fill(0);l[0]=0;for(let r=1;r<=e.length;r++){let i=0;for(let a=r-1;a>=Math.max(0,r-t);a--){i+=n[e[a]].height+(a===r-1?0:qo);let t=g[a][r-a];a>0&&s[a].some(e=>s[a-1].includes(e))&&(t+=.7);let c=l[a]+.2+(i/o-1)**2+t;c0;t=m[t])h.unshift(e.slice(m[t],t));let b=JSON.stringify(h);if(y.has(b))continue;y.add(b);let x=h.map(e=>Math.max(...e.map(e=>n[e].width))),S=h.map(e=>e.reduce((e,t)=>e+n[t].height,0)+(e.length-1)*qo),C=x.reduce((e,t)=>e+t,0)+(h.length-1)*r,w=Math.max(...S),T={},E=0;h.forEach((e,t)=>{let i=(w-S[t])/2;e.forEach((r,a)=>{T[r]={x:E+(x[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1T[e].y));for(let t of e)T[t].y-=D;w=Math.max(...e.map(e=>T[e].y+n[e].height));let O=a.reduce((t,r)=>{let i=T[e[r.source]],a=T[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,a.length)/f,k=2*Math.log(C/w/2.1)**2+.08*C*w/d+.14*O+.08*l[e.length]/h.length;k[e,t])),a=e=>e.source!==e.target&&i.has(e.source)&&i.has(e.target),o=new Set,s=new Map;for(let e of t)!a(e)||e.kind!==`fanout`&&e.kind!==`fanin`||(e.kind===`fanout`?o.add(e.target):o.add(e.source),(s.get(e.source)??s.set(e.source,new Set).get(e.source)).add(e.target),(s.get(e.target)??s.set(e.target,new Set).get(e.target)).add(e.source));let c=e.map(()=>[]),l=t.filter(e=>e.kind!==`replacement`&&a(e)).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:e.kind===`fanout`||e.kind===`fanin`?.8:.4}));for(let e of l)c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let u=e.map(()=>[]);for(let e of t){if(!Zo.has(e.kind)||!a(e))continue;let t=i.get(e.source),n=i.get(e.target);td[e]))+1:f+1;d.push(e),f=Math.max(f,e)}let p=[];e.forEach((e,t)=>{(p[d[t]]??=[]).push(e)});let m=p.filter(e=>e?.length),h=(e,t)=>o.has(e)&&o.has(t)?qo/2:qo,g=e=>e.reduce((t,r,i)=>t+n[r].height+(i?h(e[i-1],r):0),0),_=e.reduce((e,t)=>e+n[t].width*n[t].height,0),v=Math.sqrt(_/e.length),y=e.filter(e=>!o.has(e)),b=(y.length?y:e).reduce((e,t)=>e+n[t].height,0)/Math.max(1,y.length||e.length),x=Math.ceil(Math.sqrt(e.length)*1.8),S={},C=1/0,w=new Set;for(let t=1;t<=x;t++){let a=t*b+(t-1)*qo,u=[];for(let e of m){let t=[],n=()=>{if(!t.length)return;let e=o.has(t[0]);if(e)u.push({nodes:t,isBranch:e});else{let n=[];for(let r of t)n.length&&g([...n,r])>a&&(u.push({nodes:n,isBranch:e}),n=[]),n.push(r);n.length&&u.push({nodes:n,isBranch:e})}t=[]};for(let r of e)t.length&&o.has(t[0])!==o.has(r)&&n(),t.push(r);n()}let d=[],f=[];for(let e of u){let t=d.at(-1),n=t&&e.nodes.some(e=>t.some(t=>s.get(e)?.has(t)));!t||n||f.at(-1)!==e.isBranch||g([...t,...e.nodes])>a?(d.push([...e.nodes]),f.push(e.isBranch)):t.push(...e.nodes)}let p=JSON.stringify(d);if(w.has(p))continue;w.add(p);let y=d.map(e=>Math.max(...e.map(e=>n[e].width))),x=d.map(g),T=y.reduce((e,t)=>e+t,0)+(d.length-1)*r,E=Math.max(...x),D={},O=0;d.forEach((e,t)=>{let i=(E-x[t])/2;e.forEach((r,a)=>{D[r]={x:O+(y[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1D[e].y));for(let t of e)D[t].y-=k;E=Math.max(...e.map(e=>D[e].y+n[e].height));let A=l.reduce((t,r)=>{let i=D[e[r.source]],a=D[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,l.length)/v,j=2*Math.log(T/E/2.1)**2+.08*T*E/_+.14*A;j=e.length*.3?Qo(e,t,n):Xo(e,t,n)}function es(e){let t=new Map,n=new Map,r=new Map;return e.map(e=>{let i=`${e.source}\u0000${e.target}`,a=(t.get(e.source)??0)+(n.get(e.target)??0)-(r.get(i)??0);return t.set(e.source,(t.get(e.source)??0)+1),n.set(e.target,(n.get(e.target)??0)+1),r.set(i,(r.get(i)??0)+1),a})}function ts(e,t){if(e.x===t.x&&e.y===t.y)return{sourceHandle:`right`,targetHandle:`bottom`};let n=t.x+t.width/2-e.x-e.width/2,r=t.y+t.height/2-e.y-e.height/2,i=r>0?t.y-e.y-e.height:e.y-t.y-t.height,a=n>0?t.x-e.x-e.width:e.x-t.x-t.width;return i>=0&&a<0?r>=0?{sourceHandle:`bottom`,targetHandle:`top`}:{sourceHandle:`top`,targetHandle:`bottom`}:n>=0?{sourceHandle:`right`,targetHandle:`left`}:{sourceHandle:`left`,targetHandle:`right`}}function ns(e,t){return e?.type!==`life.mission.completed`||e.overall_complete!==!1&&e.campaign_continues!==!0||e.outcome?.execution_status===`completed`&&e.outcome.review_status===`done`?``:t?`当次执行已结束;当时总体目标尚未完成${e.campaign_continues===!0?`,仍需后续工作`:``}。`:`This execution ended; the overall goal was not complete at that time${e.campaign_continues===!0?` and further work remained`:``}.`}function rs(e){let{total:t,qa:n=0,complete:r,ended:i=0,reviewUnavailable:a=0,held:o=0,running:s,pending:c,paused:l,hasOpenWork:u,role:d,current:f,waiting:p,zh:m}=e,h=t>0&&r===t&&i===0,g=n===t&&n>0?m?`已全部回答`:`all answered`:m?`已全部完成`:`all completed`,_=m?[t>n?`${t-n} 个任务`:``,n>0?`${n} 条问答`:``,r>0&&!h?`已完成 ${r} 个`:``,i>0?`${i} 个任务结束时目标还没完成`:``,a>0?`${a} 个结果尚未检查成功`:``,o>0?`${o} 个任务暂停,后续工作尚未安排`:``,s>1?`${s} 个任务同时进行`:``]:[t>n?`${t-n} ${t-n===1?`task`:`tasks`}`:``,n>0?`${n} Q&A`:``,r>0&&!h?`${r} done`:``,i>0?`${i} ended before their goals were complete`:``,a>0?`${a} ${a===1?`result has`:`results have`} not been checked successfully`:``,o>0?`${o} paused with no next step scheduled`:``,s>1?`${s} tasks in progress`:``],v=c?m?`正在处理你的消息`:`working on your message`:p||(l?h?g:u?m?`已暂停`:`paused`:t>0?m?`没有在进行的工作`:`nothing in progress`:m?`就绪`:`ready`:f||(d?jr(d,m):h?g:``));return[..._,v].filter(Boolean).join(` · `)}var is={width:1440,height:1080},as=[`plan`,`execution`,`review`,`revision`,`result`];function os(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function ss(e,t){let n=e.team_outcome;if(!n)return``;if(n.kind===`review`){let e=n.verdict===`rejected`?t?`复核结论:驳回`:`Verdict: rejected`:n.verdict===`qualified`?t?`复核结论:通过`:`Verdict: qualified`:``;if(!e)return``;let r=n.summary?us(n.summary,120):``;return r?`${e}${t?`。`:`. `}${r}`:e}if(n.kind===`route`){let e=n.title?t?`「${n.title}」`:`“${n.title}”`:``;if(n.selected)return t?`${e}通过独立复核,被选为唯一方案`:`${e} passed its independent review and was chosen`;if(n.verdict===`rejected`){let r=n.rejection?us(n.rejection,120):``;return(t?`${e}被独立复核驳回`:`${e} was rejected by its independent review`)+(r?t?`。${r}`:`. ${r}`:``)}return n.verdict===`qualified`?n.selected===!1?t?`${e}通过独立复核,但未被选中`:`${e} passed its independent review but was not chosen`:t?`${e}通过独立复核,等待选择`:`${e} passed its independent review; selection pending`:``}let r=Mo(n.selected_route);if(!r)return``;let i=n.selected_title?t?`(${n.selected_title})`:` (${n.selected_title})`:``,a=(n.rejected??[]).map(Mo).filter(Boolean);return(t?`选定研究路线 ${r}${i}`:`Chose route ${r}${i}`)+(a.length?t?`,驳回路线 ${a.join(`、`)}`:`; rejected route${a.length>1?`s`:``} ${a.join(`, `)}`:``)}function cs(e,t,n){return e.pending_question?t?`需要答复,展开查看具体问题`:`Needs your input; open to read the question`:e.status===`failed`?t?`本次执行失败,展开查看原因`:`This attempt failed; open to read the reason`:e.status===`blocked`?t?`执行受阻,展开查看原因`:`Work is blocked; open to read the reason`:ss(e,t)||(e.status===`done`?e.team_role===`idea-review`?t?`独立复核已完成,展开查看记录`:`Independent review completed; open to read the record`:t?`子任务执行已完成,展开查看记录`:`Subtask execution completed; open to read the record`:e.status===`pending`?n?t?`等待前置子任务完成后开始`:`Waiting for prerequisite subtasks to finish`:t?`等待分配 Agent 执行`:`Waiting for an agent to start`:yo.has(e.status||``)?e.team_role===`idea-route`?t?`正在开展来源研究,整理候选方案`:`Researching sources and developing a candidate idea`:e.team_role===`idea-review`?t?`正在独立核对依据、创新性和风险`:`Independently checking evidence, novelty and risks`:e.team_role===`idea-selector`?t?`正在对比研究路线及复核意见`:`Comparing research routes and independent reviews`:t?`Agent 正在执行此子任务`:`An agent is working on this subtask`:t?`展开查看子任务执行记录`:`Open to read the subtask record`)}var ls=e=>e?`这一步还没有留下记录`:`Nothing has been written down for this step yet.`;function us(e,t=140){let n=e.replace(/\s+/g,` `).trim();if(!n)return``;let r=n.match(/^.*?[。!?!?.](?=\s|$)/),i=(r?r[0]:n).trim();return i.length>t?`${i.slice(0,t-1).trimEnd()}…`:i}function ds(e){let t=e.replace(/\s+/g,` `).trim().split(/[。!?;;::,,\n]|\.(?=\s|$)|[!?](?=\s|$)/)[0]?.trim();return t&&t.length>=6&&t.length<=40?t:``}function fs(e){return String(e||``).split(/\r?\n/).filter(e=>!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e.trim())&&!/^\{\s*"[\w-]+"\s*:.*\}$/.test(e.trim())).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/i,``).replace(/^\s*NEXT_ACTION\s*=\s*/i,``)).join(` +`).trim()}function ps(e,t,n){switch(e.type){case`life.planner.task_added`:return n?`规划者把这项任务列入了计划。`:`The Planner added this task to the plan.`;case`life.mission.started`:return n?`工程师接手了这项任务,开始动手。`:`The Engineer picked up this task and began working.`;case`life.phase.started`:case`round.review.started`:return e.role===`reviewer`?n?`审阅者打开了工程师的工作,开始核查。`:`The Reviewer opened the Engineer's work to check it.`:``;case`life.mission.completed`:return ns(e,n)||(t===`done`?n?`任务完成,结果已经记录在案。`:`The task was finished; its result is on record.`:t===`paused_external_work`?n?`这项任务在等待后台团队的结果;结果就绪后会自动继续。`:`This task is waiting for its background team; it continues on its own once the results are in.`:t.startsWith(`paused`)?n?`这项任务的工作暂停了。`:`Work on this task was paused.`:n?`任务到此结束。`:`The task ended here.`);case`life.mission.failed`:return n?`任务没有达到目标就结束了。`:`The task ended without reaching its goal.`;default:return``}}var ms=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,hs=(e,t)=>e.length>t?`${e.slice(0,t-1).trimEnd()}…`:e;function gs(e){let t=e.slice(e.indexOf(`:`)+1).trim();if(!t)return``;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of[`path`,`file`,`file_path`,`pattern`,`query`,`url`,`command`,`paths`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim();if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}let n=Object.values(t).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n.trim():``}}catch{}return/^[{[]/.test(t)?/"(?:path|file|file_path|pattern|query|url|command)"\s*:\s*"([^"]+)/.exec(t)?.[1]??``:t}function _s(e){let t=(e.tool||e.label.replace(ms,``).split(`:`)[0]||``).trim().toLowerCase();return e.kind===`command_execution`?`run`:e.kind===`file_change`?`edit`:/^(view|read|cat|open|read_file|str_replace_editor)$/.test(t)?`read`:/^(rg|grep|search|find_text|semantic_search|codebase_search|web_search|search_web)$/.test(t)||/^(glob|find|list|ls|list_dir|find_files)$/.test(t)?`search`:/^(web_fetch|fetch|http_get|browse)$/.test(t)?`fetch`:/^(apply_patch|edit|write|create|write_file|edit_file|replace_in_file|str_replace)$/.test(t)?`edit`:/^(bash|shell|sh|execute|terminal|run)$/.test(t)?`run`:`other`}function vs(e,t){let n=(e.tool||``).trim(),r=e.label.replace(ms,``).trim(),i=n&&/\s/.test(n)&&n.length>8,a=hs(gs(r),72),o=hs(r,72),s=_s(e),c=i?n:s===`run`?t?`运行命令 \`${o}\``:`Ran \`${o}\``:s===`read`?t?`查看 ${a||(t?`一份文件`:``)}`:`Read ${a||`a file`}`:s===`search`?t?`查找 ${a||`内容`}`:`Looked for ${a||`something`}`:s===`fetch`?t?`读取网页 ${a||``}`.trim():`Fetched ${a||`a page`}`:s===`edit`?t?`修改文件 ${a||``}`.trim():`Edited ${a||`a file`}`:hs(/^[^:{]*:\s*[{[]/.test(r)?r.slice(0,r.indexOf(`:`)):r,80);return e.status===`failed`?`${c}${t?`(失败)`:` (failed)`}`:c}function ys(e,t,n){let r=new Map;e.forEach(e=>r.set(_s(e),(r.get(_s(e))??0)+1));let i=[],a=(e,t,a,o)=>{let s=r.get(e);s&&i.push(n?`${t}${s}${e===`run`?`条命令`:e===`fetch`?`个网页`:`处`}`:`${s} ${s===1?a:o}`)};a(`read`,`查看了`,`file read`,`files read`),a(`search`,`查找了`,`search`,`searches`),a(`fetch`,`读取了`,`page fetched`,`pages fetched`),a(`edit`,`修改了`,`file edited`,`files edited`),a(`run`,`运行了`,`command run`,`commands run`);let o=r.get(`other`);return o&&i.push(n?`${o}次其他操作`:`${o} other ${o===1?`action`:`actions`}`),t>0&&i.push(n?`另有 ${t} 步未列出`:`${t} more not listed`),i.length?n?`${i.join(`,`)}。`:`${i.join(`, `)}.`:``}function bs(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.status===`running`&&n.status&&n.status!==`running`&&(e.call_id&&n.call_id?e.call_id===n.call_id:!e.call_id&&!n.call_id&&e.kind===n.kind&&e.label===n.label&&(e.tool??``)===(n.tool??``))?t[t.length-1]={...e,status:n.status,...n.call_id?{call_id:n.call_id}:{}}:t.push(n)}return t}function xs(e,t){let n=bs(e.steps??[]),r=fs(e.text),i=e.tool_details_recorded===!1,a=i?t?`执行日志确认发生过工具活动,但这一轮没有记录详细工具步骤。`:`Execution logs confirm tool activity, but detailed tool steps were not recorded for this turn.`:``;return ws({id:e.id,kind:e.role===`reviewer`?`review`:`execution`,title:``,detail:``,status:e.status||`recorded`,ts:e.ts,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id],segment:!0,work:{steps:[...n],overflow:e.overflow??0,narrations:r?[r]:[],note:a,title:i?t?`已记录的执行`:`Recorded execution`:``,single:e.role===`manager`}},t)}var Ss=8,Cs=(e,t)=>{let n=Math.max(0,e.steps.length-Ss)+e.overflow;return[...e.steps.slice(0,Ss).map(e=>`· ${vs(e,t)}`),...n>0?[t?`· 另有 ${n} 步未列出`:`· ${n} more not listed`]:[]]};function ws(e,t){let n=e.work,r=n.narrations.join(` + +`);return e.title=n.title||ds(n.narrations[0]??``)||(n.single?t?`Argus 动手查证`:`Argus did the work`:n.steps.length?t?`做了 ${n.steps.length} 步操作`:`${n.steps.length} steps of work`:t?`说明了接下来要做什么`:`Said what comes next`),e.summary=us(n.narrations[0]??``)||ys(n.steps,n.overflow,t)||void 0,e.detail=[n.note,r,Cs(n,t).join(` +`)].filter(Boolean).join(` + +`)||ls(t),e.workCount=n.steps.length+n.overflow||void 0,e}function Ts(e,t){let n=e.work;if(!n||e.segment)return e;let r=e.detail===ls(t)?``:e.detail,i=n.narrations.filter(e=>!r.includes(e.slice(0,60))),a=n.steps.length+n.overflow,o=ys(n.steps,0,t),s=a?[t?`这一步里做的操作(${a} 步):${o}`:`What was done in this step (${a} actions): ${o}`,Cs(n,t).join(` +`)].join(` +`):``,c=n.narrations[n.narrations.length-1];return!e.closed&&c&&(e.title=ds(c)||e.title,e.summary=us(c)||e.summary),e.detail=[n.note,r,i.join(` + +`),s].filter(Boolean).join(` + +`)||ls(t),e.workCount=a||void 0,e}function Es(e,t){switch(e){case`done`:return t?`这项任务已经完成。`:`This task was completed.`;case`failed`:return t?`这项任务没有达到目标。`:`This task did not reach its goal.`;case`cancelled`:case`aborted`:return t?`这项任务被取消了。`:`This task was cancelled.`;case`skipped`:return t?`这项任务被跳过了。`:`This task was skipped.`;case`superseded`:return t?`这项任务被一个新的计划取代了。`:`A new plan took the place of this task.`;default:return``}}function Ds(e,t,n){let r=e.kind===`turn`,i=[{id:`${e.id}:brief`,kind:`plan`,title:r?n?e.turn_kind===`qa`?`你提出的问题`:`你提出的要求`:`What you asked`:n?`任务目标`:`Task goal`,detail:e.objective||e.title,status:`recorded`,source:`task`,eventIds:[]}],a=new Set,o=0,s,c=t.filter(t=>t.item_id===e.id).sort((e,t)=>e.ts-t.ts||(e.type===`team.task`&&t.type===`team.task`?(e.team_task_id||e.id).localeCompare(t.team_task_id||t.id):0)),l=new Map(c.filter(e=>e.type===`team.task`).map(e=>[e.id,e]));for(let e of c){if(a.has(e.id))continue;if(a.add(e.id),e.type===`team.task`){let t=[...new Set(e.deps||[])],r=t.map(e=>l.has(e)?os(l.get(e),n):n?`其他记录中的子任务`:`Task outside this view`),a=fs(e.text);i.push({id:e.id,kind:e.team_role===`idea-review`||e.role===`reviewer`?`review`:e.team_role===`idea-selector`?`plan`:`execution`,title:os(e,n),summary:cs(e,n,t.some(e=>l.has(e)&&l.get(e).status!==`done`)),detail:[a,e.reason&&!a.includes(e.reason)?e.reason:``,e.pending_question?`${n?`需要答复`:`Needs input`}: ${e.pending_question}`:``,r.length?`${n?`依赖`:`Depends on`}: ${r.join(` · `)}`:``].filter(Boolean).join(` + +`),status:e.pending_question?`question`:e.status||`unknown`,ts:e.ts,source:`team`,eventIds:[e.id],teamId:e.team_id,teamTaskId:e.team_task_id,teamRole:e.team_role,...e.team_outcome?{teamOutcome:e.team_outcome}:{},deps:t,updatedAt:e.updated_ts,revision:e.revision});continue}if(e.type===`work.segment`){i.push({...xs(e,n),episode:o});continue}if(e.type===`turn.replied`){let t=fs(e.text);i.push({id:e.id,kind:`result`,title:n?`Argus 的回答`:`What Argus answered`,summary:us(t)||void 0,detail:t||ls(n),status:e.status||`done`,ts:e.ts,source:`event`,eventIds:[e.id]});continue}e.type===`life.mission.started`&&(o++,s=void 0),e.type===`round.review.completed`&&(s=e);let t=e.type.includes(`review`)||e.type===`life.phase.started`&&e.role===`reviewer`?`review`:e.type===`life.planner.task_added`?`plan`:e.type===`life.mission.completed`||e.type===`life.mission.failed`?`result`:e.type===`round.start`||e.type===`round.main.completed`||e.type===`life.mission.started`||e.type===`life.phase.started`?`execution`:null;if(!t)continue;let r=e.round_index,c=e.type.endsWith(`.completed`)||e.type.endsWith(`.failed`),u=t===`review`&&e.review_skipped===!0,d=e.backend_unavailable===!0||t===`result`&&s?.backend_unavailable===!0,f=d?``:ns(e,n),p=(d?`review_unavailable`:u?`skipped`:e.status===`error`?`failed`:e.status)||(e.success===!1||e.type.endsWith(`.failed`)?`failed`:e.success===!0?`done`:c||e.type===`life.planner.task_added`||e.type===`life.mission.started`?`recorded`:`started`),m=Hi(e.text||``,n),h=String(e.text||``),g=m.receipt?h.lastIndexOf(m.receipt):-1,_=fs(g>=0?h.slice(0,g):h),v=p===`done`?n?`审阅通过`:`Review passed`:p===`continue`?n?`审阅:要求再改一轮`:`Review: another pass asked for`:[`blocked`,`replan`,`replan_requested`].includes(p)?n?`审阅:建议调整方向`:`Review: a change of course asked for`:p===`failed`?n?`审阅未通过`:`Review not passed`:``,y=m.kind===`interrupt`,b=t===`execution`&&!m.summary?ds(_):``,x=d?n?`当次审查异常`:`Review error on this attempt`:y?n?`这一轮没做完就被停下`:`Stopped before the round could finish`:u?n?`本轮未审阅`:`No review this round`:t===`review`?c?v||(n?`审阅意见`:`Review`):n?`开始审阅`:`Review started`:t===`result`?f?n?`本次执行已结束`:`This execution ended`:p===`paused_external_work`?n?`等待后台团队`:`Waiting for the background team`:n?`执行结果`:`Result of the work`:t===`plan`?n?`列入计划`:`Taken into the plan`:b||(m.kind===`round`?n?`新一轮开始`:`A new round began`:e.type===`life.mission.started`?n?`开始执行`:`Work started`:e.type===`round.main.completed`?n?`本轮执行记录`:`This round's work`:n?`一次执行尝试`:`An attempt at the work`),S=Hi(e.next_action||``,n),C=_||m.summary?``:ps(e,p,n);i.push({id:e.id,kind:t,title:x,summary:d?n?`审查器未能给出判断,不是审阅否决。`:`The Reviewer could not return a judgment; this was not a rejection.`:f||m.summary||us(_)||C||void 0,detail:[f,_||m.summary||(f?``:C||ls(n)),f&&e.stage_certification===`intentionally_skipped`?n?`本阶段认证被有意跳过;这不代表最终验收通过。`:`Stage certification was intentionally skipped; this is not final acceptance.`:``,u&&e.next_action&&!S.summary?`${n?`接下来`:`What happens next`}: ${e.next_action}`:``,m.receipt?`${n?`——技术记录:`:`— technical record: `}${m.receipt.replace(Bi,``)}`:``].filter(Boolean).join(` + +`),status:f&&p===`done`?`recorded`:p,completionScope:f||void 0,closed:c,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]}),!u&&!y&&e.next_action&&[`continue`,`blocked`,`replan`,`replan_requested`].includes(e.status||``)&&i.push({id:`${e.id}:next`,kind:`revision`,title:n?`建议的修改`:`Changes asked for`,detail:S.summary||e.next_action,status:`requested`,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]})}e.turn_kind===`qa`&&!i.some(e=>e.kind===`result`)&&i.push({id:`${e.id}:answer`,kind:`result`,title:yo.has(e.status)?n?`正在回答`:`Answering`:n?`回答状态`:`Answer status`,detail:e.summary||(e.status===`cancelled`?n?`本次回答已中断。`:`This answer was interrupted.`:``),status:e.status,source:`task`,eventIds:[]}),e.turn_kind!==`qa`&&!i.some(e=>e.kind===`execution`)&&yo.has(e.status)&&i.push({id:`${e.id}:active`,kind:`execution`,title:n?`正在进行的工作`:`Work under way`,detail:e.summary||``,status:e.status,source:`task`,eventIds:[]}),!i.some(e=>e.kind===`result`)&&[`done`,`failed`,`aborted`,`cancelled`,`skipped`,`superseded`].includes(e.status)&&i.push({id:`${e.id}:outcome`,kind:`result`,title:n?`任务的最终状态`:`Where this task ended up`,detail:e.summary||Es(e.status,n),status:e.status,source:`task`,eventIds:[]});let u=[],d=new Map,f=new Map,p=(e,t)=>{let n=e.work??={steps:[],overflow:0,narrations:[],note:``,title:``,single:!1};n.steps.push(...t.work.steps),n.overflow+=t.work.overflow,n.narrations.push(...t.work.narrations.filter(e=>!n.narrations.includes(e))),n.note||=t.work.note,e.eventIds.push(...t.eventIds),t.source===`interval`&&(e.source=`interval`)};for(let e of i){if(e.segment){let t=f.get(e.kind),r=u[u.length-1],i=t&&t.episode===e.episode?t:r?.segment&&r.kind===e.kind?r:void 0;i?(p(i,e),i.segment&&ws(i,n)):u.push({...e,eventIds:[...e.eventIds]});continue}let t=e.round!=null&&[`execution`,`review`].includes(e.kind),r=`${e.episode}:${e.round}:${e.kind}`,i=t?d.get(r):void 0;if(i)i.title=e.title,i.summary=e.summary??i.summary,i.detail=e.detail,i.status=e.status,i.closed=i.closed||e.closed,i.eventIds.push(...e.eventIds),e.source===`interval`&&(i.source=`interval`);else{let n={...e,eventIds:[...e.eventIds]};u.push(n),t&&(d.set(r,n),f.set(n.kind,n))}}return u.map(e=>{let{work:t,segment:r,closed:i,...a}=Ts(e,n);return a})}function Os(e,t,n=!0){let r=e.filter(e=>e.source===`team`),i=r.filter(e=>e.teamOutcome?.kind===`route`),a=r.find(e=>e.teamOutcome?.kind===`selection`)?.teamOutcome,o=i.find(e=>e.teamOutcome?.selected),s=[],c=e=>e.join(t?`、`:`, `);if(o||a?.selected_route){let e=Mo(o?.teamTaskId)||Mo(a?.selected_route),n=o?.teamOutcome?.title||a?.selected_title;s.push(t?`已选定研究路线 ${e}${n?`(${n})`:``}`:`route ${e} chosen${n?` (${n})`:``}`);let r=i.filter(e=>e.teamOutcome?.verdict===`rejected`&&!e.teamOutcome.selected).map(e=>Mo(e.teamTaskId)).filter(Boolean);r.length&&s.push(t?`路线 ${c(r)} 被驳回`:`route${r.length>1?`s`:``} ${c(r)} rejected`)}else if(i.some(e=>e.teamOutcome?.verdict)){let e=i.filter(e=>e.teamOutcome?.verdict===`qualified`).length,n=i.filter(e=>e.teamOutcome?.verdict===`rejected`).length;s.push(t?`复核结果:${e} 条路线通过、${n} 条驳回,等待选择`:`reviews so far: ${e} route${e===1?``:`s`} qualified, ${n} rejected; selection pending`)}let l=[...e].reverse().find(e=>e.source!==`team`&&e.kind===`review`&&[`done`,`continue`,`blocked`,`replan`,`replan_requested`,`failed`].includes(e.status));l&&s.push(l.status===`done`?t?`复核通过`:`review passed`:l.status===`continue`?t?`复核要求再改一轮`:`the review asked for another pass`:l.status===`failed`?t?`复核未通过`:`review not passed`:t?`复核建议调整方向`:`the review asked for a change of course`);let u=n?[...e].reverse().find(e=>e.source!==`team`&&e.kind===`execution`&&e.round!=null&&e.status===`started`):void 0;return u&&s.push(t?`第 ${u.round} 轮进行中`:`round ${u.round} under way`),s.length?(t?`当前结论:`:`So far: `)+s.join(t?`;`:`; `):``}var ks=480;function As(e,t,n,r=Ds(e,t,n),i=0,a=!1){let o=a&&r.length>0,s=o?ks:640,c=o?r.length:1,l=1/0;for(let e=1;!o&&e<=Math.min(3,r.length);e++){let t=Math.ceil(r.length/e),n=Math.max(640,t*232+(t-1)*108+96),i=408+(e-1)*236,a=Math.abs(Math.log(n/i/1.6))+.6*(t*e-r.length)/(t*e);a{let a=t*c,o=Math.min(a+c,r.length),s=m+t*340,l=r.slice(a,o);l.forEach((e,t)=>{h[e.id]={x:s,y:f+t*236}});let d=i+a+1,p=i+o,v=d===p?n?`环节 ${d}`:`Step ${d}`:n?`环节 ${d}–${p}`:`Steps ${d}–${p}`,y=Ms(g.slice(a,o)),b=Ns(l,y,_,t===0&&i===0,t===u-1,n,v);return _=y,{id:`steps:${i+a}`,title:b,x:s,y:f-38}});return{steps:r,links:Fs(r,n),columns:v,positions:h,width:d,height:p,...o?{stacked:o}:{}}}function js(e){let t;return e.map(e=>{if(typeof e.round==`number`)return t=e.round;if(e.kind!==`result`&&e.kind!==`plan`)return t})}function Ms(e){return[...new Set(e.filter(e=>typeof e==`number`))].sort((e,t)=>e-t)}function Ns(e,t,n,r,i,a,o){if(!t.length)return r&&i&&e.length>1&&e[0].kind===`plan`&&e[e.length-1].kind===`result`?a?`起点 → 结果`:`Setting out → Outcome`:r&&e.some(e=>e.kind===`plan`)?a?`起点`:`Setting out`:i&&e.some(e=>e.kind===`result`)?a?`结果`:`Outcome`:o;let s=t[0],c=t[t.length-1],l=t.length===1&&n.length>0&&n[n.length-1]===s,u=s===c?a?`第 ${s} 轮`:`Round ${s}`:a?`第 ${s}–${c} 轮`:`Rounds ${s}–${c}`;return l&&(u=e[0].kind===`review`?a?`${u} · 审阅`:`${u} · review`:a?`${u} · 续`:`${u} · cont.`),r&&e[0].kind===`plan`&&(u=a?`起点 · ${u}`:`Setting out · ${u}`),i&&e[e.length-1].kind===`result`&&(u=a?`${u} · 结果`:`${u} · Outcome`),u}function Ps(e){let t=e.stacked?900/e.width:Math.max(600/e.height,Math.min(1e3/e.height,is.width/e.width));return{width:e.width*t,height:e.height*t,scale:t}}function Fs(e,t){let n=e.filter(e=>e.source===`team`);if(n.length){let r=e.filter(e=>e.source!==`team`),i=new Map(n.map(e=>[e.id,e])),a=r.find(e=>e.source===`task`&&e.kind===`plan`),o=[];for(let e of n){for(let n of e.deps||[]){let r=i.get(n);!r||r.id===e.id||r.teamId!==e.teamId||o.push({id:`link:${r.id}:${e.id}`,source:r.id,target:e.id,relation:`dependency`,label:t?`前置任务`:`Depends on`,explanation:t?`${e.title} 的任务记录明确依赖 ${r.title}。`:`${e.title} explicitly depends on ${r.title} in its taskboard.`,contextual:!1})}a&&!e.deps?.length&&o.push({id:`link:${a.id}:${e.id}`,source:a.id,target:e.id,relation:`assignment`,label:t?`任务分支`:`Branch`,explanation:t?`该子任务属于当前主任务;此线不表示等待主任务完成。`:`This worker belongs to the current mission; the link does not require the parent to finish first.`,contextual:!0})}return[...Fs(r,t),...o]}return e.slice(1).map((n,r)=>{let i=e[r],a=i.episode===n.episode,o=a&&i.round!=null&&i.round===n.round,s=`record_order`,c=t?`接着`:`then`,l=t?`同一任务的相邻观察,未确认直接因果或执行依赖。`:`Adjacent observations of the same task; no causal dependency is asserted.`;i.kind===`plan`&&[`plan`,`execution`].includes(n.kind)?(s=`assignment`,c=t?n.kind===`plan`?`纳入计划`:`执行此任务`:n.kind===`plan`?`planned`:`carried out`,l=t?`同一任务的目标/计划与其执行记录关联。`:`The task brief or plan is linked to execution of that same task.`):i.kind===`execution`&&n.kind===`review`&&o?(s=`review`,c=t?`提交审阅`:`sent for review`,l=t?`同一个任务、同一执行段、同一轮次的执行与审查记录。`:`Execution and review belong to the same task, episode and numbered round.`):i.kind===`review`&&n.kind===`revision`&&n.eventIds.some(e=>i.eventIds.includes(e))?(s=`revision`,c=t?`提出修改`:`asked to change`,l=t?`这条修订建议来自对应的审查记录。`:`This revision was requested in the corresponding review.`):i.kind===`revision`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`修订建议之后出现了同一任务的下一轮执行;不表示建议的全部内容已被采纳。`:`A later round follows the revision request; this does not certify every requested change was applied.`):i.kind===`review`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`审阅之后出现了同一任务的下一轮执行。`:`A later round of the same task follows the review.`):i.kind===`execution`&&n.kind===`execution`&&i.round==null&&n.round!=null?(c=t?`进入第 ${n.round} 轮`:`round ${n.round} begins`,l=t?`任务开始执行后记录的一轮工作。`:`A round of work recorded after the task was taken up.`):i.kind===`result`&&n.kind===`execution`?(c=t?`再次开始`:`taken up again`,l=t?`上一次执行结束之后,这项任务又被接手。`:`The task was taken up again after an earlier execution ended.`):n.kind===`result`&&n.source===`task`?(s=`snapshot`,c=t?`最终状态`:`ended as`,l=t?`任务状态记录;部分执行过程可能缺失。`:`Links to the captured state of this task; intermediate records may be missing.`):n.kind===`result`&&[`review`,`execution`,`revision`].includes(i.kind)&&(s=`outcome`,c=t?`形成结果`:`led to`,l=t?`同一任务的后续完成/失败事件,不等同于成功认证。`:`A completion or failure event of this task, not a certification of success.`);let u=[`record_order`,`snapshot`].includes(s)||i.source===`interval`||n.source===`interval`;return(i.source===`interval`||n.source===`interval`)&&(l+=t?` 部分旧记录按唯一活动任务区间归属,因此使用虚线。`:` Some legacy observations are associated by the sole active mission window, so this link is dashed.`),{id:`link:${i.id}:${n.id}`,source:i.id,target:n.id,relation:s,label:c,explanation:l,contextual:u}})}function Is(e){let t=[],n=[];for(let r=0;r12&&(t.push(n),n=[]),n.push(...i)}return n.length&&t.push(n),t}function Ls(e,t,n,r){for(let i of[n,r]){let n={x:(i.x-t.x)/t.zoom,y:(i.y-t.y)/t.zoom},r=e.find(e=>!e.hidden&&n.x>=e.position.x&&n.x<=e.position.x+(e.width??1152)&&n.y>=e.position.y&&n.y<=e.position.y+(e.height??824));if(r)return r.id}return null}function Rs(e,t,n,r,i=Go(e,[],n),a,o=!1){let s=[],c={},l=[],u=new Map;for(let[r,i]of e.tasks.entries()){let e=Ds(i,t,n),a=i.status===`done`?ns(bo(i,t),n):``,d=i.kind===`turn`?``:Os(e,n,yo.has(i.status)),f=Is(e),p=f.length,m=e=>e===1?i.id:JSON.stringify([`part`,i.id,e]),h=0;for(let u=1;u<=p;u++){let g=f[u-1],_=m(u);if(s.push({id:_,task:i,ordinal:r+1,part:u,partCount:p,start:h+1,end:h+g.length,totalSteps:e.length,previousId:u>1?m(u-1):void 0,nextId:u1){let t=Fs([e[h-1],g[0]],n)[0];l.push({id:JSON.stringify([`continuation`,i.id,u]),source:m(u-1),target:_,kind:`continuation`,label:t?n?`继续`:`Continued`:n?`更多分支`:`More branches`,evidence:t?`${i.title} · ${t.label} · ${e[h-1].title} → ${g[0].title}`:`${i.title} · ${n?`同一任务的其他分支,不表示串行依赖。`:`Other branches of the same mission, without a serial dependency.`}`})}h+=g.length}u.set(i.id,m(p))}let d=s.slice(),f=new Map;if(a){s.length=0;for(let e of d){let t=a.has(e.task.id);if(f.set(e.id,t?e.id:e.task.id),!t&&e.part!==e.partCount)continue;let n=t?e.id:e.task.id;c[n]=c[e.id],s.push({...e,id:n,historyCount:e.partCount-1,historyExpanded:t})}}let p=e=>f.get(e)??e,m=Object.fromEntries(s.map(({id:e})=>[e,Ps(c[e])])),h=[...i.map(e=>({...e,source:p(u.get(e.source)),target:p(e.target)})),...l.filter(e=>p(e.source)!==p(e.target))],g=s.map(e=>e.id),_=JSON.stringify([g.map(e=>[e,m[e].width,m[e].height]),h.map(e=>[e.source,e.target,e.kind])]);return{cards:s,allCards:d,links:h,layouts:c,positions:r?.structure===_?r.positions:$o(g,h,m),frames:m,structure:_}}function zs({snapshot:e,view:t,events:n=[],connected:r,compact:i=!1}){let{locale:a}=F(),o=a===`zh-CN`,[s,c]=(0,U.useState)(()=>Date.now()/1e3);(0,U.useEffect)(()=>{let e=window.setInterval(()=>c(Date.now()/1e3),1e4);return()=>window.clearInterval(e)},[]);let l=Vr(e,t,n,s),u=l.activityAgeSeconds,d=l.waitingOn?``:u===null?o?`暂无本次运行的进展记录`:`No progress recorded for this run yet`:u<60?o?`刚刚有进展`:`Progress in the last minute`:u<3600?o?`${Math.floor(u/60)} 分钟前有进展`:`Progress ${Math.floor(u/60)} min ago`:o?`${Math.floor(u/3600)} 小时前有进展`:`Progress ${Math.floor(u/3600)} hr ago`;return(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-line/60 bg-panel px-4 py-2.5 text-xs`,"data-testid":`work-status`,"data-state":l.state,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r?l.state===`running`?`bg-blue`:`bg-ink-faint`:`bg-warn`}`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`font-medium text-ink`,children:Kr(l,a,r)}),d?(0,K.jsx)(`time`,{className:`text-ink-faint`,dateTime:l.activityAt?new Date(l.activityAt*1e3).toISOString():void 0,children:d}):null]}),r?!i&&l.title?(0,K.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-ink-dim`,title:l.title,children:l.title}):null:(0,K.jsx)(`p`,{className:`mt-1 leading-5 text-ink-faint`,children:o?`这里保留的是已收到的记录;连接恢复后继续更新。`:`These are the records already received. Updates resume when the connection returns.`})]})}function Bs(e,t,n){if(e.pending_question)return e.pending_question;let r=t.filter(t=>t.item_id===e.id&&(t.status===`failed`||t.success===!1||t.type.endsWith(`.failed`))).sort((e,t)=>t.ts-e.ts)[0],i=(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``),a=r?.reason||r?.text||i,o=Hi(a,n),s=o.receipt?a.lastIndexOf(o.receipt):-1,c=fs(s>=0?a.slice(0,s):a);return o.summary||c||(n?`这项任务没有完成,记录里没有写明原因。`:`This task did not finish, and the record does not say why.`)}function Vs(e){return(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``).trim()}function Hs(e,t,n,r=``){if(e.pending_question)return{reason:e.pending_question,next:n?`下一步:回答这个问题,团队才会继续。`:`Next: answer this question so the team can continue.`,detail:``,showDetail:!1};if(Do(e)){let t=Vs(e),i=r.trim();return{reason:i?n?`工作已暂停:${i}`:`Work paused: ${i}`:t?n?`工作已暂停:当前结果还没有满足要求,具体原因见下方说明。`:`Work paused: the current result does not yet meet the requirements. The reason is shown below.`:n?`工作已暂停:当前结果还没有满足要求,记录里没有说明具体原因。`:`Work paused: the current result does not yet meet the requirements. No specific reason was recorded.`,next:n?`工作不会自动继续。请看暂停原因,再在对话里告诉我接下来做什么。`:`Work will not resume on its own. Read the reason, then tell me what to do next in the conversation.`,detail:t,showDetail:!!t&&!i}}let i=Bs(e,t,n),a=Vs(e);return{reason:n?`执行失败:${i}`:`Execution failed: ${i}`,next:n?`下一步:查看原因后重试,或在对话里调整任务。`:`Next: check the reason, then retry or adjust the task in the conversation.`,detail:a&&!i.includes(a)?a:``,showDetail:!1}}var Us=(e,t=80)=>e.length>t?`${e.slice(0,t)}…`:e;function Ws(e,t,n,r=()=>``){let i=e.filter(e=>e.turn_kind!==`qa`&&e.kind!==`turn`),a=[...i].sort((e,t)=>(t.ts??0)-(e.ts??0)),o=a[0],s=o?Us((o.objective||o.title).trim()):n?`还没有任务`:`No task yet`,c=Oo(e,t),l=e=>{let t=Eo(e);return{held:n?`工作已暂停`:`work paused`,failed:n?`这项工作没有做完`:`this task did not finish`,review_unavailable:n?`结果检查没有完成`:`the result check did not finish`,done:n?`已完成`:`done`,running:n?`进行中`:`running`,pending:n?`待开始`:`planned`,question:n?`等你回答`:`waiting on you`,paused:n?`已暂停`:`paused`}[t]||(n?`还没有新的进展记录`:`No new progress has been recorded`)},u=c?n?`已确认:${Us(fs(r(c)||c.summary||c.title),160)}`:`Confirmed: ${Us(fs(r(c)||c.summary||c.title),160)}`:o?Eo(o)===`review_unavailable`?n?`这次结果检查没有完成,暂时不能确认结果。`:`The result check did not finish, so the result is not yet confirmed.`:n?`还没有经过检查确认的结果。`:`There is no checked, confirmed result yet.`:n?`还没有结果`:`No result yet`,d=i.find(e=>yo.has(e.status)),f=a.find(e=>[`question`,`held`,`failed`,`review_unavailable`].includes(Eo(e))),p=[...i].sort((e,t)=>(e.ts??0)-(t.ts??0)).find(e=>Eo(e)===`pending`);return{goal:s,current:d?n?`正在处理:${Us(d.title,70)}`:`Working on: ${Us(d.title,70)}`:o?l(o):n?`可以开始新任务`:`Ready for a new task`,conclusion:u,next:d?p?n?`待做任务:${Us(p.title,70)}`:`Queued next: ${Us(p.title,70)}`:n?`等当前工作完成,再查看检查结果。`:`Wait for the current work to finish, then check the result.`:f&&f===o?Hs(f,t,n,r(f)).next:p?n?`下一步:${Us(p.title,60)}`:`Next: ${Us(p.title,60)}`:c?n?`可以查看结果,或继续提出要求。`:`Read the result, or tell me what to do next.`:n?`还没有后续任务,可在对话里告诉我接下来做什么。`:`Nothing else is scheduled. Tell me what to do next in the conversation.`}}function Gs(e,t,n){let r=e?.model_revision&&e.model_revision!==n,i={...e?.cards};for(let[n,a]of Object.entries(t.cards)){if(r&&i[n]?.model_revision===e.model_revision)continue;let t=i[n];t?.version&&(a.version??0)(t.copy_revision??0)||(a.copy_revision??0)===(t.copy_revision??0)&&(a.generated_at>t.generated_at||a.generated_at===t.generated_at&&!t.input_revision))&&(i[n]=a)}let a=(t.cache_revision??0)<(e?.cache_revision??0);return{...e,...t,cards:i,...e?.version!=null||t.version!=null?{version:Math.max(e?.version??0,t.version??0)}:{},cache_revision:Math.max(t.cache_revision??0,e?.cache_revision??0),relations:(r||a)&&e?e.relations:t.relations,available:t.available??!0,...r?{model_revision:e.model_revision,available:e.available}:{}}}function Ks(e,t,n,r){let i=n?.cards[e.key],a=t.tasks.find(t=>t.id===e.task_id);if(!i||!a||(i.version??0)<(n?.version??0)||n?.model_revision&&i.model_revision!==n.model_revision)return!0;let o=[a.id,a.id+`:active`,a.id+`:outcome`].includes(e.key);if(o||!i.task_content_revision||!a.content_revision){if(a.revision&&i.task_revision!==a.revision||o&&i.task_status!==a.status)return!0}else if(i.task_content_revision!==a.content_revision)return!0;let s=i.event_ids||[];return e.event_ids.some(e=>{let n=s.indexOf(e),a=r?r.get(e):t.events.find(t=>t.id===e);return n<0||i.event_revisions&&a?.revision&&i.event_revisions[n]!==a.revision})||!o&&JSON.stringify(e.event_ids)!==JSON.stringify(s)}var qs=e=>`[[Argus引用 ${JSON.stringify(e)}]]\n`;function Js(e){let t=[];return{refs:t,text:e.split(` +`).filter(e=>{if(e.startsWith(`[[Argus引用 `)&&e.endsWith(`]]`))try{let n=JSON.parse(e.slice(10,-2));if(typeof n.task_id==`string`&&typeof n.source==`string`&&typeof n.task_title==`string`&&(n.part===void 0||Number.isInteger(n.part)&&n.part>0)&&(n.step_title===void 0||typeof n.step_title==`string`)&&(n.step_id===void 0||typeof n.step_id==`string`)&&(n.team_id===void 0||typeof n.team_id==`string`)&&(n.team_task_id===void 0||typeof n.team_task_id==`string`)&&(n.lang===void 0||typeof n.lang==`string`)&&Array.isArray(n.event_ids)&&n.event_ids.every(e=>typeof e==`string`))return t.push(n),!1}catch{}return!0}).join(` +`).replace(/^\n+/,``)}}function Ys(e,t,n=1/0){let r=Math.max(-1/0,...e.events.filter(e=>e.item_id===t&&e.type===`life.mission.started`&&e.ts<=n).map(e=>e.ts));return e.events.filter(e=>e.item_id===t&&e.ts>=r&&e.ts<=n&&[`round.main.completed`,`round.review.completed`].includes(e.type)).slice(-2).map(e=>e.id)}function Xs(e,t,n){return n.map(n=>({key:n.id,task_id:t.id,kind:n.kind,event_ids:[...new Set([...n.kind===`result`?Ys(e,t.id,n.ts):[],...n.eventIds])].slice(-16)}))}function Zs(e,t,n){let r=e.tasks.find(e=>e.id===n),i=(r?[r,...e.tasks.filter(e=>e.id!==n)]:e.tasks).map(t=>({key:t.id,task_id:t.id,kind:`task`,event_ids:[...new Set([...Ys(e,t.id),...e.events.filter(e=>e.item_id===t.id).slice(-2).map(e=>e.id)])]})),a=r?Xs(e,r,t):[];return[...i.slice(0,1),...a,...i.slice(1)]}var Qs=/Info: (?:Operation cancelled by user|Response was interrupted due to a server error\. Retrying\.\.\.)/gi;function $s({ev:e,r:t,first:n,last:r,latest:i,repeat:a=1,status:o=``,result:s}){let{locale:c,t:l}=F(),u=R.role[t.role]??R.inkFaint,d=je(t.tone),f=e.type===`engineer.progress`&&String(e.kind||``)===`tool_use`,p=[`agent_message`,`assistant_message`,`message`].includes(String(e.kind||``))?fs(t.text):t.text,m=f?{text:Ka(e,c),technical:t.text}:fa(p,c),h=s?fa(s.r.text,c).text:``,g=[m.technical,h?`${l(`stream.stepResult`)}: ${h}`:``].filter(Boolean).join(` +`);return(0,K.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${r?`animate-appear`:``} ${t.reasoning?`opacity-60`:``}`,style:t.rule?{marginTop:4}:void 0,children:[(0,K.jsxs)(`div`,{className:`relative flex justify-center`,children:[n?null:(0,K.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),r?null:(0,K.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,K.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:u,boxShadow:`0 0 0 1px ${u}55`}})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:u},title:t.label,children:t.label}),(0,K.jsx)(`span`,{className:`text-xs`,style:{color:d},children:t.glyph}),a>1?(0,K.jsxs)(`span`,{className:`rounded bg-line/60 px-1 font-mono text-[10px] tabular-nums text-ink-dim`,title:l(`stream.repeated`,{count:a}),"data-repeat":a,children:[`×`,a]}):null,o===`failed`?(0,K.jsx)(`span`,{className:`text-xs text-err`,children:l(`stream.stepFailed`)}):null,(0,K.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:dt(i??e)})]}),(0,K.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5 ${t.reasoning?`italic`:``}`,style:{color:d},title:g||void 0,children:m.text})]})]})}function ec({group:e,first:t,last:n,open:r,onToggle:i}){let{locale:a,t:o}=F(),s=R.role[e.r.role]??R.inkFaint,c=je(e.r.tone),l=Za(e,o,a);return(0,K.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${n?`animate-appear`:``}`,"data-feed-group":e.action,"data-open":r?`true`:`false`,children:[(0,K.jsxs)(`div`,{className:`relative flex justify-center`,children:[t?null:(0,K.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),n?null:(0,K.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,K.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:s,boxShadow:`0 0 0 1px ${s}55`}})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":r,title:o(r?`stream.fold.collapse`:`stream.fold.expand`),className:`block w-full rounded text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-blue-sky`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:s},title:e.r.label,children:e.r.label}),(0,K.jsx)(`span`,{className:`text-xs`,style:{color:c},children:e.r.glyph}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-ink-faint`,children:e.calls}),(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,K.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})}),(0,K.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:dt(e.latest)})]}),(0,K.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5`,style:{color:c},children:l})]}),r?(0,K.jsx)(`div`,{className:`mt-1 border-l border-line/50`,children:e.steps.map((t,n)=>(0,K.jsx)($s,{ev:t.ev,r:t.r,first:n===0,last:n===e.steps.length-1,latest:t.latest,repeat:t.repeat,status:t.status,result:t.result},t.key))}):null]})]})}function tc({rows:e}){let[t,n]=(0,U.useState)(()=>new Set),r=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,K.jsx)(K.Fragment,{children:e.map((n,i)=>n.kind===`group`?(0,K.jsx)(ec,{group:n,first:i===0,last:i===e.length-1,open:t.has(n.key),onToggle:()=>r(n.key)},n.key):(0,K.jsx)($s,{ev:n.ev,r:n.r,first:i===0,last:i===e.length-1,latest:n.latest,repeat:n.repeat,status:n.status,result:n.result},n.key))})}function nc({ev:e,r:t,artifacts:n,onOpenArtifact:r}){let{t:i,locale:a}=F(),o=String(e.type)===`ui.operator`,s=!o&&e.mission_result===!0,c=s&&typeof e.text==`string`?e.text:t.text,l=s?pa(c,a):null,u=s?ft(e):null,d=o?Js(t.text):null,f=d?.refs??[],p=d&&f.length?d.text:t.text,m=o?[]:lo(e.steps),h=Number(e.response_latency_ms??0),g=!o&&h>=100?` · ${(h/1e3).toFixed(1)}s`:``,_=(0,U.useRef)(null);return qe(_,(e,t)=>{_.current&&(t||e.fromTo(_.current,{autoAlpha:0,x:o?12:0,y:o?0:8},{autoAlpha:1,x:0,y:0,duration:.28,ease:`power2.out`,clearProps:`transform,opacity,visibility`}))}),(0,K.jsx)(`article`,{ref:_,"data-task-receipt":s||void 0,"data-task-receipt-id":s?String(e.message_id||e.event_id||``):void 0,className:`conversation-row group mx-auto w-full max-w-full px-4 py-3 sm:px-6 lg:max-w-[61.8vw]`,children:o?(0,K.jsxs)(`div`,{className:`flex items-end justify-end gap-2`,children:[(0,K.jsx)(Be,{text:t.text,label:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,K.jsx)(`time`,{className:`shrink-0 pb-1 font-mono text-[10px] tabular-nums text-ink-faint`,children:dt(e)}),(0,K.jsxs)(`div`,{className:`max-w-[calc(100%_-_3rem)] rounded-[18px] bg-conversation-user px-4 py-2.5 text-[15px] leading-relaxed text-ink ring-1 ring-line/35 sm:max-w-[82%]`,children:[f.length?(0,K.jsx)(`div`,{className:`mb-2 space-y-2`,children:f.map((e,t)=>(0,K.jsxs)(`blockquote`,{"aria-label":a===`zh-CN`?`引用`:`Reference`,className:`border-l-2 border-blue/40 pl-3 text-sm text-ink-dim`,children:[(0,K.jsxs)(`div`,{className:`text-xs text-ink-faint`,children:[a===`zh-CN`?`引用`:`Reference`,e.part?` · ${a===`zh-CN`?`第 ${e.part} 部分`:`Part ${e.part}`}`:``]}),(0,K.jsx)(`div`,{className:`font-medium`,children:e.task_title||e.step_title||e.task_id}),e.task_title&&e.step_title&&e.step_title!==e.task_title?(0,K.jsx)(`div`,{children:e.step_title}):null]},`${e.source}:${e.task_id}:${e.step_id}:${t}`))}):null,p?(0,K.jsx)(Ke,{artifacts:n,onOpenArtifact:r,children:p}):null]})]}):(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center`,children:(0,K.jsx)(_t,{size:26,className:`text-ink`})}),(0,K.jsxs)(`div`,{className:`relative min-w-0 flex-1 text-[15px] leading-relaxed text-ink`,children:[(0,K.jsxs)(`div`,{"data-task-receipt-header":s||void 0,className:s?`sticky -top-1.5 z-10 mb-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 bg-panel py-1`:`mb-1 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-xs font-semibold text-blue`,children:pe().name}),s?(0,K.jsx)(`span`,{className:`text-[11px] text-ink-dim`,children:a===`zh-CN`?`任务回报 · 当时记录`:`Task report · Recorded then`}):null,(0,K.jsx)(Be,{text:c,label:l?a===`zh-CN`?`复制原始回报`:`Copy original report`:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`ml-auto opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,K.jsxs)(`time`,{className:`font-mono text-[10px] tabular-nums text-ink-faint ${s?`basis-full sm:basis-auto`:``}`,dateTime:u?.toISOString(),title:u?.toLocaleString(a,{dateStyle:`full`,timeStyle:`long`}),children:[u?u.toLocaleString(a,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):dt(e),g]})]}),c?(0,K.jsx)(`div`,{"data-task-receipt-prose":s||void 0,children:(0,K.jsx)(Ke,{artifacts:n,onOpenArtifact:r,children:l?.text??c})}):null,m.length||e.live===!0?(0,K.jsx)(vo,{steps:m,live:e.live===!0,startedTs:Number(e.ts),status:e.success===!1?`failed`:String(e.status??``)}):null,l?(0,K.jsx)(nt,{className:`task-receipt-original`,label:a===`zh-CN`?`查看原始回报(含技术记录)`:`View original report (including technical records)`,children:(0,K.jsx)(`pre`,{"data-task-receipt-original":!0,className:`mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs text-ink-dim`,children:c})}):null]})]})})}function rc({role:e,rows:t,open:n,active:r,onToggle:i}){let{t:a,locale:o}=F(),s=R.role[e],c=(0,U.useRef)(null),l=(0,U.useRef)(!0),u=(0,U.useRef)(0),[d,f]=(0,U.useState)(!1),p=t[t.length-1]?.r.text.length??0,m=(0,U.useMemo)(()=>Xa(t,o),[t,o]),h=m.length?Qa(m[m.length-1],a,o):``;return(0,U.useEffect)(()=>{n&&!l.current&&c.current&&(c.current.scrollTop=u.current)},[n]),(0,U.useEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{l.current&&c.current&&(c.current.scrollTop=c.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[n,t.length,p]),(0,K.jsxs)(`section`,{className:`role-log-group border-b border-line/50`,"data-role":e,"data-open":n?`true`:`false`,"data-active":r?`true`:`false`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":n,className:`group flex h-11 w-full items-center gap-2 px-4 text-left transition-colors hover:bg-bg/60`,children:[(0,K.jsx)(`span`,{"data-role-dot":e,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:s}}),(0,K.jsx)(`span`,{className:`text-xs font-semibold text-ink-dim`,children:yn(e,a)}),(0,K.jsx)(`span`,{className:`font-mono text-xs text-ink-faint`,children:m.length}),h?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:h}):(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${n?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,K.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),n?(0,K.jsx)(`div`,{className:`grid grid-rows-[1fr]`,children:(0,K.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden`,children:[(0,K.jsx)(`div`,{ref:c,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollTop,l.current=t.scrollHeight-t.scrollTop-t.clientHeight<=2,f(!l.current)},className:`max-h-72 overflow-x-hidden overflow-y-auto border-t border-line/40 scroll-thin`,children:m.length>0?(0,K.jsx)(tc,{rows:m}):(0,K.jsx)(`div`,{className:`px-4 py-3 text-xs text-ink-faint`,children:a(`stream.noLogs`)})}),d?(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{l.current=!0,f(!1),c.current&&(c.current.scrollTop=c.current.scrollHeight)},className:`absolute bottom-2 right-3 rounded-full border border-line/60 bg-panel px-3 py-1 text-xs text-ink-dim shadow-glow hover:text-ink`,children:[`↓ `,a(`stream.jumpToLatest`)]}):null]})}):null]})}function ic(e){let t={manager:[],planner:[],engineer:[],reviewer:[]},n=[];return e.forEach(e=>{He.includes(e.r.role)?t[e.r.role].push(e):n.push(e)}),{roleRows:t,systemRows:n,lastRole:[...e].reverse().find(e=>He.includes(e.r.role))?.r.role??``}}function ac({rows:e}){let{t,locale:n}=F(),[r,i]=(0,U.useState)(!1),a=(0,U.useMemo)(()=>Xa(e,n),[e,n]);return(0,K.jsxs)(`section`,{className:`border-b border-line/50`,"data-system-open":r?`true`:`false`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex h-10 w-full items-center gap-2 px-4 text-left text-xs text-ink-faint hover:bg-bg/60`,children:[(0,K.jsx)(`span`,{children:t(`stream.system`)}),(0,K.jsx)(`span`,{className:`font-mono`,children:a.length}),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,K.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),r?(0,K.jsx)(`div`,{className:`border-t border-line/40`,children:(0,K.jsx)(tc,{rows:a})}):null]})}function oc({rows:e,live:t,followLatest:n,activeRole:r,activeTaskId:i}){let{roleRows:a,systemRows:o,lastRole:s}=(0,U.useMemo)(()=>ic(e),[e]),[c,l]=(0,U.useState)(()=>new Set(n&&s?[s]:[])),u=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{!n||!s||u.current||l(new Set([s]))},[s,n]),(0,K.jsxs)(`div`,{className:`bg-bg/25`,children:[He.map(e=>(0,K.jsx)(rc,{role:e,rows:a[e],open:c.has(e),active:t&&(r??s)===e&&(!i||a[e].some(e=>Ir(e.ev)===i)),onToggle:()=>{u.current=!0,l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}},e)),o.length>0?(0,K.jsx)(ac,{rows:o}):null]})}function sc(e){let t=e.delivery;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.delivery_id!=`string`||!n.delivery_id.trim()?null:n}function cc(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.type===`ui.operator`)return null;let r=sc(n);if(r)return r}}function lc({delivery:e,onOpen:t}){let{t:n}=F(),r=e.kind===`submission_certified`;return(0,K.jsxs)(`aside`,{className:`mx-auto my-3 flex w-full max-w-full gap-3 rounded-lg border border-ok/35 bg-ok/5 px-4 py-3 lg:max-w-[61.8vw]`,children:[(0,K.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-ok/15 font-semibold text-ok`,children:`✓`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-ok`,children:n(r?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,K.jsx)(`div`,{className:`mt-1 truncate text-sm font-semibold text-ink`,title:e.title,children:e.title}),t?(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`mt-2 rounded border border-ok/40 px-2 py-1 font-mono text-[10px] text-ok hover:border-ok hover:bg-ok/10`,children:n(e.primary_target?`mission.openResult`:`mission.viewTask`)}):null]})]})}function uc({group:e,artifacts:t,onOpenArtifact:n,onOpenDelivery:r}){let i=e=>e.ev.type===`ui.argus`&&/^(info:|operation cancelled|cancelled\b)/i.test(e.r.text.trim()),a=e.rows.filter(e=>e.ev.type===`ui.argus`).map(e=>{if(e.ev.mission_result===!0)return{reply:e,messages:[]};let t=e.r.text.match(Qs)??[],n=e.r.text.replace(Qs,``).trim(),r=e.ev.live===!0||Array.isArray(e.ev.steps)&&e.ev.steps.length>0;return{reply:(n||r)&&!i(e)?{...e,r:{...e.r,text:n}}:null,messages:i(e)&&t.length===0?[e.r.text]:t}}),o=a.flatMap(e=>e.reply?[e.reply]:[]),s=a.flatMap(e=>e.messages),c=(()=>{let t=new Set;return e.rows.flatMap(e=>{let n=sc(e.ev);return!n||t.has(n.delivery_id)?[]:(t.add(n.delivery_id),[n])})})();return(0,K.jsxs)(`section`,{className:`conversation-thread border-b border-line/60`,children:[(0,K.jsx)(nc,{ev:e.operator.ev,r:e.operator.r,artifacts:t,onOpenArtifact:n}),o.map(e=>(0,K.jsx)(nc,{ev:e.ev,r:e.r,artifacts:t,onOpenArtifact:n},e.key)),s.map((t,n)=>(0,K.jsx)(`div`,{className:`mx-auto w-full max-w-full px-6 py-1.5 text-center text-xs text-ink-faint lg:max-w-[61.8vw]`,children:t},`${e.key}-system-${n}`)),c.map(e=>(0,K.jsx)(lc,{delivery:e,onOpen:r},e.delivery_id))]})}function dc({events:e,connected:t,showReasoning:n,onToggleReasoning:r,embedded:i=!1,showHeader:a=!0,filter:o=`all`,query:s=``,skipFirst:c=0,artifacts:l,onOpenArtifact:u,onOpenDelivery:d,snapshot:f,missionView:p,historyStatus:m=`ready`,historyRefreshing:h=!1,onRetryHistory:g}){let{locale:_,t:v}=F(),[y,b]=(0,U.useState)(!0),x=(0,U.useRef)(!0),S=(0,U.useRef)(0),[C,w]=(0,U.useState)(()=>Date.now()),T=(0,U.useRef)(null),E=(0,U.useRef)(null),D=(0,U.useDeferredValue)(e),O=(0,U.useMemo)(()=>f?Vr(f,p,D):null,[D,p,f]),k=t&&(!f||O?.state===`running`),A=(0,U.useMemo)(()=>f||!t?null:Rr(D),[t,D,f]);(0,U.useEffect)(()=>{if(!A)return;w(Date.now());let e=window.setInterval(()=>w(Date.now()),1e3);return()=>window.clearInterval(e)},[A]);let j=A?Math.max(0,Math.floor((C-Number(A.ts??0)*1e3)/1e3)):0,M=(0,U.useMemo)(()=>ba(c>0?D.slice(c):D,{locale:_,showReasoning:n,filter:o,query:s}),[D,n,o,s,c,_]),N=(0,U.useMemo)(()=>{let e=[],t=[],n=[],r=null;M.list.forEach(i=>{i.ev.type===`ui.operator`?(r={key:i.key,operator:i,rows:[]},e.push(r)):i.ev.type===`ui.argus`?r?r.rows.push(i):t.push(i):n.push(i)});let i=new Set(M.list.filter(e=>e.ev.type===`ui.argus`).map(e=>sc(e.ev)?.delivery_id).filter(Boolean));return{groups:e,earlierReplies:t,projectWork:n,projectDeliveries:n.flatMap(e=>{let t=sc(e.ev);return!t||i.has(t.delivery_id)?[]:(i.add(t.delivery_id),[t])})}},[M.list]),P=(0,U.useMemo)(()=>D.filter(Ee).length,[D]),I=(0,U.useMemo)(()=>M.list.slice(-20).reduce((e,t)=>e+t.r.text.length,0),[M.list]);return(0,U.useEffect)(()=>{if(!y)return;let e=window.requestAnimationFrame(()=>{x.current&&T.current&&(T.current.scrollTop=T.current.scrollHeight,S.current=T.current.scrollTop)});return()=>window.cancelAnimationFrame(e)},[M.list.length,I,y]),(0,U.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<40;x.current=t||x.current&&e.scrollTop>=S.current-1,S.current=e.scrollTop,b(x.current)};e.addEventListener(`scroll`,t,{passive:!0});let n=null,r=new ResizeObserver(()=>{x.current&&(n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,x.current&&(e.scrollTop=e.scrollHeight,S.current=e.scrollTop)}))});return r.observe(e),E.current&&r.observe(E.current),()=>{e.removeEventListener(`scroll`,t),r.disconnect(),n!==null&&window.cancelAnimationFrame(n)}},[]),(0,K.jsxs)(`section`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden bg-panel ${i?``:`rounded-lg border border-line/80`}`,children:[a&&(0,K.jsx)(et,{title:v(`panel.activity`),right:(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[N.projectWork.length>0?(0,K.jsx)(`button`,{type:`button`,onClick:()=>{x.current=!1,b(!1),T.current?.scrollTo({top:0,behavior:`auto`})},className:`rounded px-1.5 py-0.5 text-xs text-blue-sky hover:bg-bg`,children:_===`zh-CN`?`查看工作进展`:`View work progress`}):null,(0,K.jsxs)(`button`,{onClick:r,className:`rounded px-1.5 py-0.5 text-xs transition-colors ${n?`text-blue-sky`:`text-ink-faint hover:text-ink-dim`}`,title:v(`stream.toggleReasoning`),children:[v(`stream.reasoning`),P?` ·${P}`:``]}),(0,K.jsx)(`span`,{className:`text-xs ${t?`text-ok`:`text-ink-faint`}`,children:t?`● ${v(`common.live`)}`:`○ ${v(`common.reconnecting`)}`})]})}),f?(0,K.jsx)(zs,{snapshot:f,view:p,events:D,connected:t,compact:!0}):A?(0,K.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line/60 bg-blue-deep/5 px-4 text-xs text-ink-dim`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-blue-sky`}),(0,K.jsx)(`span`,{className:`truncate`,children:v(`stream.backgroundWork`)}),(0,K.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono tabular-nums text-ink-faint`,children:[j,`s`]})]}):null,m===`ready`?null:(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 px-4 py-3 text-sm text-ink-faint`,role:m===`error`?`alert`:`status`,"data-conversation-history":m,children:[(0,K.jsx)(`span`,{children:v(m===`error`?`stream.historyError`:`stream.historyLoading`)}),m===`error`&&g?(0,K.jsx)(`button`,{type:`button`,onClick:g,disabled:h,className:`shrink-0 rounded px-2 py-1 text-blue-sky hover:bg-bg disabled:opacity-50`,children:v(`stream.historyRetry`)}):null]}),(0,K.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto pb-6 pt-1.5 scroll-thin`,"aria-busy":m===`loading`,children:(0,K.jsx)(`div`,{ref:E,className:`flow-root`,"data-event-stream-content":!0,children:M.list.length===0?m===`ready`?(0,K.jsx)(Ve,{children:v(`stream.ready`)}):null:(0,K.jsxs)(K.Fragment,{children:[N.projectWork.length>0?(0,K.jsxs)(`section`,{"data-project-work":!0,className:`mx-auto w-full max-w-full border-b border-line/60 lg:max-w-[61.8vw]`,children:[(0,K.jsxs)(`div`,{className:`flex h-10 items-center gap-2 border-b border-line/40 px-4 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink-faint`,children:[_===`zh-CN`?`项目工作进展`:`Project work progress`,(0,K.jsx)(`span`,{className:`font-mono font-normal tracking-normal`,children:N.projectWork.length})]}),(0,K.jsx)(oc,{rows:N.projectWork,live:k,followLatest:!0,activeRole:O?.role,activeTaskId:O?.taskId}),N.projectDeliveries.map(e=>(0,K.jsx)(lc,{delivery:e,onOpen:d},e.delivery_id))]},`project-work`):null,N.earlierReplies.map(e=>(0,K.jsx)(nc,{ev:e.ev,r:e.r,artifacts:l,onOpenArtifact:u},e.key)),N.groups.map(e=>(0,K.jsx)(uc,{group:e,artifacts:l,onOpenArtifact:u,onOpenDelivery:d},e.key))]})})}),!y&&(0,K.jsx)(`button`,{onClick:()=>{x.current=!0,b(!0),T.current&&(T.current.scrollTo({top:T.current.scrollHeight,behavior:`auto`}),S.current=T.current.scrollTop)},"aria-label":v(`stream.jumpToLatest`),title:v(`stream.jumpToLatest`),className:`absolute bottom-4 left-1/2 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-line/60 bg-panel text-sm text-ink-dim shadow-glow transition-all duration-200 hover:border-ink-faint hover:text-ink`,children:`↓`})]})}function fc(e){return e.nativeEvent.isComposing||e.keyCode===229}var pc=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function mc(e){return pc[e%pc.length]}var hc=[{id:`status`,name:`/status`,argument:`none`,desc:`roles, queued work, journal, and health`,group:`Everyday`,kind:`panel`},{id:`roles`,name:`/roles`,argument:`none`,desc:`per-role backend / model / effort + live activity`,group:`Everyday`,kind:`panel`},{id:`journal`,name:`/journal`,arg:`[N]`,argument:`optional`,desc:`recent journal entries (default 10)`,group:`Everyday`,kind:`panel`},{id:`backlog`,name:`/backlog`,arg:`[all]`,argument:`optional`,desc:`pending tasks (all = incl. done/skipped)`,group:`Everyday`,kind:`panel`},{id:`artifacts`,name:`/artifacts`,argument:`none`,desc:`result files the Reviewer has checked (Enter previews)`,group:`Everyday`,kind:`panel`},{id:`artifact`,name:`/artifact`,arg:``,argument:`required`,desc:`preview one reviewed result file`,group:`Everyday`,kind:`panel`},{id:`events`,name:`/events`,arg:`[filter] [query]`,argument:`optional`,desc:`search feed: all / watch / milestones / messages`,group:`Everyday`,kind:`panel`},{id:`find`,name:`/find`,arg:``,argument:`required`,desc:`search the current event buffer`,group:`Everyday`,kind:`panel`},{id:`cancel`,name:`/cancel`,argument:`none`,desc:`stop waiting for the current Manager reply`,group:`Everyday`,kind:`local`},{id:`ask`,name:`/ask`,arg:``,argument:`required`,desc:`answer inline — no task queued, no Planner/Engineer/Reviewer`,aliases:[`/chat`],group:`Everyday`,kind:`action`},{id:`crystalpilot`,name:`/crystalpilot`,arg:`[status|off|use ]`,argument:`optional`,desc:`enable crystallography tools in this Argus conversation`,group:`Everyday`,kind:`action`},{id:`task`,name:`/task`,arg:``,argument:`required`,desc:`queue work directly`,aliases:[`/add`],group:`Task management`,kind:`action`},{id:`plan`,name:`/plan`,arg:``,argument:`required`,desc:`preview a Planner-authored execution plan`,group:`Task management`,kind:`action`},{id:`rewrite`,name:`/rewrite`,arg:`[text]`,argument:`optional`,desc:`let the Manager rewrite your prompt before sending`,aliases:[`/refine`],group:`Task management`,kind:`action`},{id:`nudge`,name:`/nudge`,arg:``,argument:`required`,desc:`inject guidance into the running mission`,aliases:[`/inject`,`/notify`],group:`Task management`,kind:`action`},{id:`abort`,name:`/abort`,argument:`none`,desc:`immediately stop the running mission`,group:`Task management`,kind:`action`},{id:`note`,name:`/note`,arg:``,argument:`required`,desc:`append a manual note to the timeline`,group:`Task management`,kind:`action`},{id:`done`,name:`/done`,arg:``,argument:`required`,desc:`mark a task done`,group:`Task management`,kind:`action`},{id:`skip`,name:`/skip`,arg:``,argument:`required`,desc:`skip a task`,aliases:[`/rm`],group:`Task management`,kind:`action`},{id:`stop`,name:`/stop`,arg:``,argument:`required`,desc:`stop a task's auto-iteration`,group:`Task management`,kind:`action`},{id:`item`,name:`/item`,arg:``,argument:`required`,desc:`inspect a full task contract`,group:`Task management`,kind:`panel`},{id:`run`,name:`/run`,argument:`none`,desc:`return to the always-live mission feed`,group:`Task management`,kind:`local`},{id:`new`,name:`/new`,arg:`[objective]`,argument:`optional`,desc:`review, create, and switch to a fresh conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`daemons`,name:`/daemons`,arg:`[query]`,argument:`optional`,desc:`find every session + switch or create`,group:`Sessions & diagnostics`,kind:`panel`},{id:`resume`,name:`/resume`,arg:`[list|]`,argument:`optional`,desc:`switch to another project/session`,group:`Sessions & diagnostics`,kind:`action`},{id:`attach`,name:`/attach`,arg:``,argument:`required`,desc:`follow another project (read the stream)`,group:`Sessions & diagnostics`,kind:`action`},{id:`rename`,name:`/rename`,arg:``,argument:`required`,desc:`rename the current conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`doctor`,name:`/doctor`,argument:`none`,desc:`diagnose 'why isn't anything running'`,group:`Sessions & diagnostics`,kind:`panel`},{id:`backend`,name:`/backend`,arg:`[codex|claude|copilot|cursor|opencode|pi|grok|qoder|dsh]`,argument:`optional`,desc:`view or change the shared runner backend`,group:`Configuration`,kind:`action`},{id:`config`,name:`/config`,arg:`[key=value …]`,argument:`optional`,desc:`view or change runtime settings`,group:`Configuration`,kind:`panel`},{id:`identity`,name:`/identity`,arg:`[set ]`,argument:`optional`,desc:`view or replace the operator identity card`,group:`Configuration`,kind:`panel`},{id:`reset`,name:`/reset`,argument:`none`,desc:`drop the warm Manager conversation context`,group:`Configuration`,kind:`action`},{id:`skills`,name:`/skills`,arg:`[ls|promote ]`,argument:`optional`,desc:`inspect or promote runtime skills`,group:`Configuration`,kind:`action`},{id:`clear`,name:`/clear`,argument:`none`,desc:`clear the event feed view`,group:`Other`,kind:`local`},{id:`reconnect`,name:`/reconnect`,argument:`none`,desc:`reconnect the live event stream`,group:`Other`,kind:`local`},{id:`help`,name:`/help`,argument:`none`,desc:`keys + full command reference`,aliases:[`/?`,`/commands`],group:`Other`,kind:`local`},{id:`quit`,name:`/quit`,argument:`none`,desc:`leave the cockpit (background work keeps running)`,aliases:[`/exit`,`/q`],group:`Other`,kind:`local`}];new Map(hc.map(e=>[e.id,e]));var gc=new Map;for(let e of hc)for(let t of[e.name,...e.aliases??[]])gc.set(t.toLowerCase(),e);function _c(e){return e.argument===`required`}var vc=/^\/[A-Za-z0-9_-]+$/;function yc(e){if(!e.startsWith(`/`))return!1;let t=e.indexOf(` `),n=t===-1?e:e.slice(0,t);return vc.test(n)}function bc(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.slice(1).includes(`/`)}function xc(e){if(!bc(e))return[];let t=e.toLowerCase(),n=new Set,r=[];for(let e of hc)[e.name,...e.aliases??[]].some(e=>e.toLowerCase().startsWith(t))&&!n.has(e.name)&&(n.add(e.name),r.push(e));return r.sort((e,n)=>Number(Sc(n,t))-Number(Sc(e,t)))}function Sc(e,t){return[e.name,...e.aliases??[]].some(e=>e.toLowerCase()===t)}function Cc(e){return e.arg?`${e.name} `:e.name}function wc(e){let t=e.trim();if(!t)return{filter:`all`,query:``};let[n,...r]=t.split(/\s+/);return n.toLowerCase()===`watch`?{filter:`attention`,query:r.join(` `)}:re.includes(n.toLowerCase())?{filter:n.toLowerCase(),query:r.join(` `)}:{filter:`all`,query:t}}function Tc(e){if(!yc(e))return null;let t=e.indexOf(` `),n=(t===-1?e:e.slice(0,t)).toLowerCase(),r=t===-1?``:e.slice(t+1).trim(),i=gc.get(n)??null;return{cmd:i,name:i?i.name:n,rest:r}}function Ec(e){let t=e.toLowerCase(),n=null,r=0;for(let e of gc.keys()){let i=Dc(t,e);i>r&&(r=i,n=gc.get(e).name)}return r>=.6?n:null}function Dc(e,t){return 1-Oc(e,t)/(Math.max(e.length,t.length)||1)}function Oc(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},(e,t)=>[t,...Array(r).fill(0)]);for(let e=0;e<=r;e+=1)i[0][e]=e;for(let a=1;a<=n;a+=1)for(let n=1;n<=r;n+=1)i[a][n]=Math.min(i[a-1][n]+1,i[a][n-1]+1,i[a-1][n-1]+(e[a-1]===t[n-1]?0:1));return i[n][r]}function kc(e,t=!1,n=!1){return(t||n)&&e.toLowerCase()===`r`}var Ac={Everyday:`常用`,"Task management":`任务管理`,"Sessions & diagnostics":`会话与诊断`,Configuration:`配置`,Other:`其他`},jc={crystalpilot:`在当前 Argus 会话启用晶体学工具,保持原生界面`,status:`查看角色、队列、日志和健康状态`,roles:`查看各角色的后端、模型、推理强度和实时活动`,journal:`查看近期日志(默认 10 条)`,backlog:`查看待处理任务(all 包含已完成和已跳过)`,artifacts:`查看 Reviewer 批准的结果文件(按 Enter 预览)`,artifact:`预览一个已批准的结果文件`,events:`搜索动态:all / watch / milestones / messages`,find:`搜索当前事件缓冲区`,cancel:`停止等待当前 Manager 回复`,ask:`直接回答,不排任务、不走 Planner/Engineer/Reviewer`,task:`直接加入任务队列`,plan:`预览 Planner 编写的执行计划`,rewrite:`让 Manager 在发送前改写提示词`,nudge:`向正在运行的任务注入指导`,abort:`立即终止正在运行的任务`,note:`向时间线添加手动备注`,done:`将任务标记为完成`,skip:`跳过任务`,stop:`停止任务的自动迭代`,item:`查看完整任务契约`,run:`返回持续更新的任务动态`,new:`检查、创建并切换到新会话`,daemons:`查找全部会话并切换或创建`,resume:`切换到其他项目或会话`,attach:`跟随其他项目并读取其动态`,rename:`重命名当前会话`,doctor:`诊断为什么没有任务运行`,backend:`查看或更改共享 Runner 后端`,config:`查看或更改运行时设置`,identity:`查看或替换操作者身份卡`,reset:`清除 Manager 的热会话上下文`,skills:`查看或提升运行时 Skill`,clear:`清空事件动态视图`,reconnect:`重新连接实时动态`,help:`查看快捷键和完整命令参考`,quit:`离开控制台(后台工作继续运行)`};function Mc(e,t){return t===`zh-CN`?jc[e.id]:e.id===`reconnect`?`reconnect live activity`:e.desc}function Nc(e,t){return t===`zh-CN`?Ac[e.group]:e.group}function Pc(e,t){let n=new Map;for(let r of e){let e=Nc(r,t),i=r.aliases?.length?` (= ${r.aliases.join(`, `)})`:``,a=`${r.name}${r.arg?` ${r.arg}`:``}${i}`;n.has(e)||n.set(e,[]),n.get(e).push({label:a,desc:Mc(r,t)})}return[...n.entries()].map(([e,t])=>({group:e,rows:t}))}var Fc=`slash-completion-listbox`;function Ic(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function Lc(e){return`slash-completion-option-${e}`}function Rc({query:e,selected:t,onSelect:n}){let{locale:r,t:i}=F(),a=xc(e);if(a.length===0)return null;let o=a.slice(0,8),s=Ic(t,o.length);return(0,K.jsx)(`div`,{id:Fc,role:`listbox`,"aria-label":i(`slash.suggestions`),className:`slash-completion-menu scroll-thin border-b border-line/40`,children:o.map((e,t)=>(0,K.jsxs)(`button`,{id:Lc(e.id),type:`button`,role:`option`,"aria-selected":t===s,onPointerDown:e=>{e.preventDefault(),n(t)},className:`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm transition-colors ${t===s?`bg-blue/10 text-ink`:`text-ink-dim hover:bg-line/20`}`,children:[(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-blue`,children:e.name}),e.arg?(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-ink-faint`,children:e.arg}):null,(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:Mc(e,r)})]},e.id))})}var zc=32e3,Bc=10485760,Vc=26214400,Hc=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.pdf`,`.md`,`.markdown`,`.txt`,`.json`,`.csv`].join(`,`),Uc={".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".webp":`image/webp`,".pdf":`application/pdf`,".md":`text/markdown`,".markdown":`text/markdown`,".txt":`text/plain`,".json":`application/json`,".csv":`text/csv`};function Wc(e){let t=String(e||``).trim().toLowerCase(),n=t.lastIndexOf(`.`);return n>=0?t.slice(n):``}function Gc(e){return Uc[Wc(e.name)]||String(e.type||``).split(`;`,1)[0].trim()||`application/octet-stream`}function Kc(e){return Object.hasOwn(Uc,Wc(e.name))}function qc(e){return Gc(e).startsWith(`image/`)}function Jc(e){return[e.name,String(e.size),Gc(e),String(e.lastModified??``)].join(`::`)}function Yc(e,t){let n=[],r=[],i=new Set(e.map(Jc)),a=e.reduce((e,t)=>e+Math.max(0,t.size||0),0),o=e.length;for(let e of t){let t=Jc(e);if(!i.has(t)){if(i.add(t),!Kc(e)){r.push({code:`unsupported`,fileName:e.name});continue}if(o>=5){r.push({code:`too-many`,limitCount:5});continue}if(e.size>10485760){r.push({code:`too-large`,fileName:e.name,limitBytes:Bc});continue}if(a+e.size>26214400){r.push({code:`too-large-total`,limitBytes:Vc});continue}n.push(e),a+=e.size,o+=1}}return{accepted:n,issues:r}}function Xc(e){return e?Array.from(e):[]}function Zc(e){return Xc(e?.types).map(e=>String(e)).includes(`Files`)||Qc(e).length>0}function Qc(e){let t=Xc(e?.files).filter(e=>e instanceof File);if(t.length)return t;let n=[];for(let t of Xc(e?.items)){if(String(t?.kind||``)!==`file`||typeof t?.getAsFile!=`function`)continue;let e=t.getAsFile();e instanceof File&&n.push(e)}return n}function $c({file:e,removeLabel:t,onRemove:n,disabled:r=!1}){let[i,a]=(0,U.useState)(``);return(0,U.useEffect)(()=>{if(!qc(e)||typeof URL>`u`||typeof URL.createObjectURL!=`function`){a(``);return}let t=URL.createObjectURL(e);return a(t),()=>URL.revokeObjectURL(t)},[e]),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-2xl border border-line/50 bg-panel/80 px-2.5 py-2 text-xs shadow-[0_10px_24px_-20px_rgb(0_0_0/0.2)]`,children:[i?(0,K.jsx)(`img`,{src:i,alt:``,className:`h-10 w-10 shrink-0 rounded-xl border border-line/40 object-cover`}):null,(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate font-medium text-ink`,title:e.name,children:e.name}),(0,K.jsxs)(`div`,{className:`truncate text-ink-faint`,children:[ct(e.size),` · `,Gc(e)]})]}),(0,K.jsx)(`button`,{type:`button`,onClick:n,disabled:r,"aria-label":t,title:t,className:`send-control h-8 w-8 shrink-0 rounded-full border-line/60 text-ink-faint hover:border-err/50 hover:bg-err/10 hover:text-err`,children:`×`})]})}function el({value:e,onChange:t,inputRef:n,fileInputRef:r,onFiles:i,inputProps:a,onSend:o,onCancel:s,pending:c,disabled:l=!1,controls:u}){let{t:d,locale:f}=F(),p=f===`zh-CN`,{refs:m,text:h}=Js(e),g=e.length>zc;return(0,U.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.getClientRects().length&&(e.style.height=`0px`,e.style.height=`${Math.min(132,Math.max(28,e.scrollHeight))}px`)};t();let r=e.clientWidth,i=new ResizeObserver(()=>{e.clientWidth!==r&&(r=e.clientWidth,t())});return i.observe(e),()=>i.disconnect()},[n,h]),(0,K.jsxs)(`div`,{className:`composer-surface`,"data-pending":c,children:[m.length>0&&(0,K.jsx)(`div`,{className:`map-reference-chips`,children:m.map((e,n)=>(0,K.jsxs)(`span`,{children:[(0,K.jsxs)(`span`,{children:[p?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":p?`移除引用`:`Remove reference`,onClick:()=>t(m.filter((e,t)=>t!==n).map(qs).join(``)+h),children:(0,K.jsx)(Ie,{size:12})})]},`${e.task_id}:${e.step_id}:${n}`))}),(0,K.jsxs)(`form`,{className:`map-composer`,onSubmit:e=>{e.preventDefault(),!c&&!l&&!g&&o()},children:[(0,K.jsx)(`input`,{ref:r,type:`file`,multiple:!0,accept:Hc,hidden:!0,disabled:l||c,onChange:i}),(0,K.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":d(`chat.attach`),title:d(`chat.attach`),disabled:l||c,onClick:()=>r.current?.click(),children:(0,K.jsx)(`span`,{"aria-hidden":`true`,children:(0,K.jsx)(_t,{size:28})})}),(0,K.jsx)(`textarea`,{...a,ref:n,rows:1,value:h,disabled:l,onChange:e=>t(m.map(qs).join(``)+e.target.value),onKeyDown:e=>{if(g&&e.key===`Enter`&&!e.shiftKey&&!fc(e)){e.preventDefault();return}a.onKeyDown?.(e),!(e.defaultPrevented||fc(e))&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),!c&&!l&&o())}}),(0,K.jsx)(`button`,{type:c?`button`:`submit`,onClick:c?s:void 0,disabled:l||!c&&(!h.trim()||g),"aria-label":c?p?`停止回复`:`Stop reply`:p?`发送消息`:`Send message`,className:`map-send ${c?`is-pending`:``}`,children:c?(0,K.jsx)(Yt,{size:15}):(0,K.jsx)(kt,{size:20})})]}),g&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:d(`chat.messageTooLong`)}),u?(0,K.jsx)(`div`,{className:`composer-controls`,children:u}):null]})}var tl=[`auto`,`task`,`chat`];function nl({value:e,onChange:t,disabled:n=!1,tabIndex:r}){let{t:i}=F(),a={auto:i(`chat.routeAuto`),task:i(`chat.routeTask`),chat:i(`chat.routeChat`)};return(0,K.jsx)(`div`,{className:`route-seg`,role:`radiogroup`,"aria-label":i(`chat.routeLabel`),title:i(`chat.routeHint`),children:tl.map(i=>(0,K.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===i,disabled:n,tabIndex:r,onClick:()=>{i!==e&&t(i)},children:a[i]},i))})}function rl(e,t){if(!t.onRewrite||!kc(e.key,e.ctrlKey,e.metaKey))return!1;e.preventDefault();let n=t.value.trim();return n&&!t.disabled&&!t.pending&&!t.rewriting&&t.onRewrite(n),!0}function il({value:e,onChange:t,onSend:n,onCancel:r,disabled:i,pending:a,focusSignal:o,attachments:s,onAttachmentsChange:c,onRewrite:l,rewriting:u=!1,slashSelection:d,onSlashSelectionChange:f,routeOverride:p=`auto`,onRouteOverrideChange:m,footer:h}){let{t:g}=F(),_=(0,U.useRef)(null),v=(0,U.useRef)(null),y=(0,U.useRef)(!1),[b,x]=(0,U.useState)(0),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(``),[E,D]=(0,U.useState)(0),[O,k]=(0,U.useState)(!1),[A,j]=(0,U.useState)(!1);(0,U.useEffect)(()=>{a||j(!1)},[a]),(0,U.useEffect)(()=>{if(!a&&!u)return;let e=setInterval(()=>x(e=>e+1),1e3);return()=>clearInterval(e)},[a,u]),(0,U.useEffect)(()=>{o&&!i&&_.current?.focus()},[o,i]);let M=xc(e).slice(0,8),N=M.length>0&&!S,P=N?Ic(d,M.length):0,I=N?M[P]:void 0,ee=e=>{let n=M[e];n&&(t(Cc(n)),n.argument===`none`&&C(!0),f(0),_.current?.focus())},te=async()=>{if(!e.trim()||i||u||y.current)return;let t=a;if(t&&s.length){T(g(`chat.attachWhileRunning`));return}y.current=!0;try{(t?await n(e.trim(),[],void 0,{whileRunning:!0}):await n(e.trim(),s))&&(f(0),C(!1),T(``),j(t))}finally{y.current=!1}},L=e=>{if(!e.length||i||a||y.current)return;let{accepted:t,issues:n}=Yc(s,e);t.length&&c([...s,...t]),T(n.map(e=>e.code===`unsupported`?g(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?g(`chat.attachTooLarge`,{name:e.fileName,size:ct(e.limitBytes)}):e.code===`too-many`?g(`chat.attachTooMany`,{count:e.limitCount}):g(`chat.attachTotalTooLarge`,{size:ct(e.limitBytes)})).join(` `))},ne=(e,t)=>{Zc(e.dataTransfer)&&(e.preventDefault(),D(e=>Math.max(0,e+t)))};return(0,K.jsxs)(`div`,{className:`conversation-composer flex flex-col ${E>0?`rounded-3xl ring-2 ring-manager/60`:``}`,"data-compact":!O&&!e.trim()&&!s.length&&!a&&!u&&!w&&!E,onFocusCapture:()=>k(!0),onBlurCapture:e=>k(e.currentTarget.contains(e.relatedTarget)),onDragEnter:e=>ne(e,1),onDragOver:e=>ne(e,0),onDragLeave:e=>ne(e,-1),onDrop:e=>{Zc(e.dataTransfer)&&(e.preventDefault(),D(0),L(Qc(e.dataTransfer)))},children:[a?(0,K.jsx)(`div`,{className:`px-3 py-2 text-xs text-ink-faint`,role:`status`,children:g(A?`chat.queuedWhileRunning`:`chat.stopWaitingHint`)}):null,N?(0,K.jsx)(Rc,{query:e,selected:P,onSelect:ee}):null,s.length||w||E>0?(0,K.jsxs)(`div`,{className:`px-3 py-2`,children:[E>0?(0,K.jsx)(`div`,{className:`mb-2 text-xs text-manager`,children:g(`chat.attachDrop`)}):null,(0,K.jsx)(`div`,{className:`map-attachment-tray`,children:s.map((e,t)=>(0,K.jsx)($c,{file:e,removeLabel:g(`chat.attachRemove`,{name:e.name}),onRemove:()=>{c(s.filter(t=>t!==e)),T(``)}},`${e.name}:${e.lastModified}:${t}`))}),(0,K.jsx)(`div`,{className:`text-xs ${w?`text-err`:`text-ink-faint`}`,children:w||g(`chat.attachHint`,{count:5,perFile:ct(10485760),total:ct(26214400)})})]}):null,(0,K.jsx)(el,{value:e,onChange:e=>{t(e),f(0),C(!1)},inputRef:_,fileInputRef:v,onFiles:e=>{L(Array.from(e.target.files??[])),e.target.value=``},onSend:()=>void te(),onCancel:r,pending:a,disabled:i,inputProps:{onPaste:e=>{let t=Qc(e.clipboardData);t.length&&(e.preventDefault(),L(t))},onKeyDown:t=>{fc(t)||rl(t,{value:e,disabled:i,pending:a,rewriting:u,onRewrite:l})||(N?t.key===`ArrowDown`||t.key===`ArrowUp`?(t.preventDefault(),f(Ic(P+(t.key===`ArrowDown`?1:-1),M.length))):t.key===`Tab`||t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),ee(P)):t.key===`Escape`&&(t.preventDefault(),C(!0)):t.key===`Escape`&&a?(t.preventDefault(),r()):t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),te()))},"aria-label":g(`chat.messageArgus`),"aria-keyshortcuts":`Control+R Meta+R`,"aria-controls":N?Fc:void 0,"aria-expanded":N,"aria-activedescendant":I?Lc(I.id):void 0,placeholder:g(i?`chat.selectSession`:`chat.placeholder`)},controls:(0,K.jsxs)(K.Fragment,{children:[m?(0,K.jsx)(nl,{value:p,onChange:m,disabled:i||a}):null,l&&e.trim()?(0,K.jsx)(`button`,{type:`button`,onClick:()=>l(e.trim()),disabled:i||a||u,title:`Ctrl/⌘+R · ${g(`chat.rewriteHint`)}`,"aria-label":g(`chat.rewriteLabel`),"aria-keyshortcuts":`Control+R Meta+R`,children:u?`${mc(b)} ${g(`chat.rewriting`)}`:g(`chat.rewrite`)}):null]})}),h]})}function al(e,t,n,r=`en`){return e.map(e=>({id:`command-${e.id}`,label:Mc(e,r),hint:`${e.name}${e.arg?` ${e.arg}`:``}`,group:Nc(e,r),keywords:[e.name,...e.aliases??[]].join(` `),run:()=>_c(e)?n(`${e.name} `):t(e.name)}))}function ol(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=`${e.label} ${e.group} ${e.hint??``} ${e.keywords??``}`.toLowerCase();return n.every(e=>t.includes(e))}):e}function sl({open:e,onClose:t,items:n}){let{t:r}=F(),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(0),c=(0,U.useRef)(null),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{e&&(a(``),s(0),setTimeout(()=>c.current?.focus(),0))},[e]);let u=(0,U.useMemo)(()=>ol(n,i),[i,n]);(0,U.useEffect)(()=>{o>=u.length&&s(Math.max(0,u.length-1))},[u.length,o]),(0,U.useEffect)(()=>{l.current?.scrollIntoView({block:`nearest`})},[e,i,o]);let d=e=>{e&&(t(),e.run())},f=e=>{fc(e)||(e.key===`ArrowDown`?(e.preventDefault(),u.length&&s(e=>Math.min(u.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),d(u[o])))},p=[];for(let e of u){let t=p.find(t=>t.name===e.group);t||(t={name:e.group,items:[]},p.push(t)),t.items.push(e)}let m=-1;return(0,K.jsxs)(tt,{open:e,onClose:t,label:r(`help.palette`),width:`max-w-xl`,align:`top`,children:[(0,K.jsx)(`div`,{className:`border-b border-line px-4 py-3`,children:(0,K.jsx)(`input`,{ref:c,value:i,onChange:e=>a(e.target.value),onKeyDown:f,placeholder:r(`palette.placeholder`),role:`combobox`,"aria-expanded":e,"aria-autocomplete":`list`,"aria-controls":`command-palette-results`,"aria-activedescendant":u[o]?`palette-${u[o].id}`:void 0,className:`w-full bg-transparent font-mono text-sm text-ink outline-none placeholder:text-ink-faint`})}),(0,K.jsxs)(`div`,{id:`command-palette-results`,role:`listbox`,className:`max-h-[52vh] overflow-y-auto scroll-thin py-1.5`,children:[u.length===0&&(0,K.jsx)(`div`,{className:`px-4 py-6 text-center text-xs text-ink-faint`,children:r(`palette.noMatches`)}),p.map(e=>(0,K.jsxs)(`div`,{className:`mb-1`,children:[(0,K.jsx)(`div`,{className:`px-4 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.name}),e.items.map(e=>{m++;let t=m===o;return(0,K.jsxs)(`button`,{id:`palette-${e.id}`,ref:t?l:void 0,role:`option`,"aria-selected":t,onMouseEnter:()=>s(u.indexOf(e)),onClick:()=>d(e),className:`flex w-full items-center justify-between px-4 py-1.5 text-left text-sm transition-colors ${t?`bg-blue-deep/20 text-ink`:`text-ink-dim hover:bg-panel/60`}`,children:[(0,K.jsx)(`span`,{children:e.label}),e.hint&&(0,K.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:e.hint})]},e.id)})]},e.name))]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-4 py-1.5 text-[10px] text-ink-faint`,children:[(0,K.jsx)(`span`,{children:r(`palette.navigate`)}),(0,K.jsx)(`span`,{children:r(`palette.run`)}),(0,K.jsx)(`span`,{children:r(`palette.close`)})]})]})}var cl=[{keys:`⌘K / Ctrl+K`,desc:`help.palette`},{keys:`⌘B / Ctrl+B`,desc:`help.sessions`},{keys:`⌘J / Ctrl+J`,desc:`help.managerChat`},{keys:`⌘R / Ctrl+R`,desc:`help.rewrite`},{keys:`⌘T / Ctrl+T`,desc:`help.reasoning`},{keys:`⌘. / Ctrl+.`,desc:`help.kiosk`},{keys:`/`,desc:`help.composer`},{keys:`↵ Enter`,desc:`help.send`},{keys:`Shift+Enter`,desc:`help.newline`},{keys:`?`,desc:`help.thisHelp`},{keys:`Esc`,desc:`help.escape`}];function ll({open:e,onClose:t}){let{locale:n,t:r}=F(),i=Pc(hc,n);return(0,K.jsxs)(tt,{open:e,onClose:t,label:r(`help.title`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:r(`help.title`)}),(0,K.jsxs)(`div`,{className:`max-h-[70dvh] overflow-y-auto scroll-thin`,children:[(0,K.jsx)(`div`,{className:`p-4`,children:cl.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center justify-between py-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm text-ink-dim`,children:r(e.desc)}),(0,K.jsx)(`kbd`,{className:`rounded border border-line bg-surface px-2 py-0.5 font-mono text-[11px] text-ink`,children:e.keys})]},e.keys))}),(0,K.jsxs)(`div`,{className:`border-t border-line px-4 pb-4 pt-3`,children:[(0,K.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-ink-faint`,children:r(`help.commands`)}),i.map(e=>(0,K.jsxs)(`div`,{className:`mb-4`,children:[(0,K.jsx)(`p`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.group}),e.rows.map(e=>(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1`,children:[(0,K.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-ink`,children:e.label}),(0,K.jsx)(`span`,{className:`text-right text-xs text-ink-dim`,children:e.desc})]},e.label))]},e.group))]})]})]})}var ul=[[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]];function dl({sid:e,config:t,onSaved:n}){let{locale:r}=F(),i=r===`zh-CN`,a=t.roles.find(e=>e.role===`manager`),o=t.roles.find(e=>e.role===`engineer`),s=a&&a.backend!==`memory`?a:o,c=new Map(t.operator_knobs.map(e=>[e.name,e.value])),l=c.get(`ARGUS_SKILL_MAP_MODEL`)||`auto`,[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(``),m=(t.model_options??[]).map(e=>e.model);l!==`auto`&&!m.includes(l)&&m.unshift(l);let h=async(t,r)=>{if(!u){d(!0),p(``);try{await P.setConfig(e,t,r),await n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},g=i?`自动(轻量)`:`Auto (light)`,_=i?`跟随前台模型`:`Follow the front-door model`,v=[{name:`ARGUS_SKILL_MAP_REASONING_EFFORT`,label:i?`讲解生成强度`:`Explanation effort`,follow:g},{name:`ARGUS_SKILL_MAP_REVIEW_REASONING_EFFORT`,label:i?`讲解复核强度`:`Explanation review effort`,follow:i?`自动(中)`:`Auto (medium)`}];return(0,K.jsxs)(`section`,{className:`map-model-settings rounded-lg border border-line glass-card p-3`,"aria-label":i?`地图模型`:`Map model`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:i?`地图模型`:`Map model`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:i?`地图讲解与摘要用的模型;默认沿用前台(经理)的接入与账号,以低强度起草,不占用科研的推理预算。可以选一个便宜的。`:`The model that writes map explanations and summaries. By default it uses the front-door (Manager) runner and account at a light effort, not the research budget. A cheaper one is fine.`}),(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[s?.backend_label,` · `,s?.model||(i?`接入默认模型`:`Runner default model`)]}),t.map_model?.note&&(0,K.jsx)(`p`,{role:`status`,"data-map-model-note":!0,className:`mt-1 text-xs text-warn`,children:i?`已改用自动:所选摘要模型在当前接入(${t.map_model.backend})下不可用。`:t.map_model.note}),(0,K.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[i?`摘要模型`:`Summary model`,(0,K.jsxs)(`select`,{value:l,disabled:u,"aria-label":i?`摘要模型`:`Summary model`,onChange:e=>void h(`ARGUS_SKILL_MAP_MODEL`,e.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,K.jsx)(`option`,{value:`auto`,children:_}),m.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]}),v.map(e=>(0,K.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[e.label,(0,K.jsxs)(`select`,{value:c.get(e.name)||`auto`,disabled:u,onChange:t=>void h(e.name,t.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`,children:[(0,K.jsx)(`option`,{value:`auto`,children:e.follow}),ul.map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:i?t:e},e))]})]},e.name)),(0,K.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`复核用于检查讲解文字,保存后对新发起的讲解生效。`:`The review checks explanation text. Changes apply to newly requested explanations.`}),f&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:f})]})}function fl({sid:e,primaryModel:t}){let{locale:n}=F(),r=n===`zh-CN`,i=(e,t)=>r?e:t,a=S(),o=x({queryKey:[`advisor-settings`,e],queryFn:({signal:t})=>P.advisorSettings(e,t),enabled:!!e,retry:!1}),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(``),[h,g]=(0,U.useState)(!1),_=(0,U.useRef)(e);_.current=e,(0,U.useEffect)(()=>{c(o.data?.saved??null);let e=o.data?.saved;u(!!(e?.model&&!o.data?.model_options?.some(t=>t.backend===e.backend&&t.model===e.model)))},[e,o.data]),(0,U.useEffect)(()=>{m(``),g(!1),f(!1)},[e]);let v=e=>{c(t=>t&&{...t,...e}),g(!1)},y=o.data?.model_options??[],b=(e,t)=>JSON.stringify([e,t]),C=s&&y.some(e=>e.backend===s.backend&&e.model===s.model)?b(s.backend,s.model):``,w=async()=>{if(!s||d)return;let t=e;f(!0),m(``),g(!1);try{let{schema_version:e,...n}=s,r=await P.saveAdvisorSettings(t,{...n,model:n.model.trim()});a.setQueryData([`advisor-settings`,t],r),_.current===t&&g(!0)}catch(e){_.current===t&&m(e instanceof Error?e.message:String(e))}finally{_.current===t&&f(!1)}};return(0,K.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,"aria-label":i(`顾问模型`,`Advisor model`),children:[(0,K.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`顾问模型`,`Advisor model`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:i(`团队遇到难题时可以向它提问。只在咨询时调用,用量计入当前项目。`,`The team can consult this model on specific questions. It runs only when asked, and usage belongs to this project.`)}),t?(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[i(`当前执行模型:`,`Current execution model: `),t]}):null,o.isPending?(0,K.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-ink-faint`,children:i(`正在读取设置…`,`Loading settings…`)}):o.isError?(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-err`,role:`alert`,children:[i(`顾问设置读取失败。`,`Could not load advisor settings.`),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void o.refetch(),className:`underline`,children:i(`重试`,`Retry`)})]}):s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:s.enabled,disabled:d,onChange:e=>v({enabled:e.target.checked})}),i(`允许团队咨询顾问`,`Let the team consult the advisor`)]}),(0,K.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[y.length>0?(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim sm:col-span-2`,children:[i(`顾问使用的模型`,`Advisor model`),(0,K.jsxs)(`select`,{"aria-label":i(`选择顾问模型`,`Choose advisor model`),value:l?`custom`:C,disabled:d,onChange:e=>{if(e.target.value===`custom`){u(!0);return}let t=y.find(t=>b(t.backend,t.model)===e.target.value);t&&(u(!1),v({backend:t.backend,model:t.model}))},className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,K.jsx)(`option`,{value:``,disabled:!0,children:i(`选择模型`,`Choose a model`)}),y.map(e=>(0,K.jsx)(`option`,{value:b(e.backend,e.model),children:e.model},b(e.backend,e.model))),(0,K.jsx)(`option`,{value:`custom`,children:i(`配置其他模型…`,`Configure another model…`)})]})]}):null,l||y.length===0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`接入`,`Runner`),(0,K.jsxs)(`select`,{"aria-label":i(`顾问接入`,`Advisor runner`),value:s.backend,disabled:d,onChange:e=>v({backend:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,K.jsx)(`option`,{value:``,children:i(`选择接入`,`Choose a runner`)}),o.data?.supported_backends.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]}),(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`顾问使用的模型`,`Advisor model ID`),(0,K.jsx)(`input`,{value:s.model,disabled:d,onChange:e=>v({model:e.target.value}),placeholder:i(`填写该接入的模型标识`,`Model ID for this runner`),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}):null,(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`思考强度`,`Reasoning effort`),(0,K.jsxs)(`select`,{"aria-label":i(`顾问思考强度`,`Advisor reasoning effort`),value:s.effort,disabled:d,onChange:e=>v({effort:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,K.jsx)(`option`,{value:``,children:i(`模型默认`,`Model default`)}),[[`minimal`,`最低`],[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]].map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:r?t:e},e))]})]}),(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`每次角色调用最多咨询`,`Consultations per role call`),(0,K.jsx)(`input`,{type:`number`,min:1,max:20,value:s.max_calls_per_turn,disabled:d,onChange:e=>v({max_calls_per_turn:Number(e.target.value)}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}),o.data?.overridden_fields.length?(0,K.jsxs)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:[i(`运行服务另有指定设置;当前顾问:`,`The runtime overrides some saved settings. Current advisor: `),o.data.config.enabled?`${o.data.config.backend} · ${o.data.config.model}`:i(`未启用`,`disabled`)]}):null,(0,K.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:d||s.enabled&&(!s.backend||!s.model.trim()),className:`rounded border border-line px-3 py-2 text-xs text-ink hover:border-blue disabled:opacity-40`,children:d?i(`保存中…`,`Saving…`):i(`保存顾问设置`,`Save advisor settings`)}),h?(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-ink-dim`,children:i(`已保存,下次咨询生效。`,`Saved for the next consultation.`)}):null]}),p?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:p}):null]}):null]})}var pl=[/^\[?\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[.,]\d+)?(?:Z|[+-]\d{2}:?\d{2})?\]?\s*/,/^\[?(?:INFO|WARNING|WARN|ERROR|DEBUG|CRITICAL|TRACE)\]?\s*[:\-|]?\s*/i,/^(?:\[\d+\]|[\w.]+:)\s+/];function ml(e){let t=e.trim();for(let e of pl)t=t.replace(e,``);return t.trim()}var hl=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`;function gl(e,t=200){let n=String(e??``).split(/\r?\n/).map(ml).filter(e=>e&&!/^[-=_.\s]+$/.test(e));return n.length?hl(n[n.length-1],t):``}var _l=[{name:`ARGUS_SKILL_MAX_ACTIVE_DAEMONS`,group:`Limits`,label:`Active daemon limit`,description:`Maximum background sessions running on this host.`},{name:`ARGUS_SKILL_SAFE_MODE`,group:`Safety`,label:`Safe mode`,description:`Enable extra-conservative runtime guardrails.`},{name:`ARGUS_SKILL_OPERATOR_AVAILABLE`,group:`Safety`,label:`Operator available`,description:`Off suppresses operator questions: Argus decides on recorded assumptions.`},{name:`ARGUS_SKILL_ENABLE_TELEGRAM`,group:`Interface`,label:`Telegram`,description:`Enable the Telegram notification bridge.`},{name:`ARGUS_SKILL_SHOW_REASONING`,group:`Interface`,label:`Show reasoning`,description:`Stream role reasoning into the cockpit activity view.`}];function vl(e){let t=new Map(e.map(e=>[e.name,e]));return _l.flatMap(e=>{let n=t.get(e.name);return n?[{...n,group:e.group,label:e.label,doc:e.description}]:[]})}function yl(e,t){let n=new URL(e),r=n.protocol===`https:`?`wss:`:`ws:`,i=encodeURIComponent(t);return{webApi:`${n.origin}/api`,eventStream:`${r}//${n.host}/api/projects/${i}/stream`,daemon:`local process · events.jsonl · no TCP port`}}var bl=`ARGUS_SKILL_OPERATOR_AVAILABLE`,xl=new Set([`0`,`false`,`no`,`off`,`disable`,`disabled`]);function Sl(e){let t=(e??[]).find(e=>e.name===bl);return!!(t&&xl.has(t.value.trim().toLowerCase()))}function Cl(e){return e instanceof j?e.code===`trial_route_unavailable`||e.status===403||e.status===404:!1}function wl(e,t){let n=Cl(e);return{text:t(n?`operations.unavailableHere`:`operations.requestFailed`),technical:e instanceof Error?e.message:String(e||``),refused:n}}var Tl={ARGUS_SKILL_MAX_ACTIVE_DAEMONS:{label:`settings.knob.activeDaemons`,doc:`settings.knob.activeDaemonsDoc`},ARGUS_SKILL_SAFE_MODE:{label:`settings.knob.safeMode`,doc:`settings.knob.safeModeDoc`},ARGUS_SKILL_OPERATOR_AVAILABLE:{label:`settings.knob.operatorAvailable`,doc:`settings.knob.operatorAvailableDoc`},ARGUS_SKILL_ENABLE_TELEGRAM:{label:`settings.knob.telegram`,doc:`settings.knob.telegramDoc`},ARGUS_SKILL_SHOW_REASONING:{label:`settings.knob.showReasoning`,doc:`settings.knob.showReasoningDoc`}},El={Limits:`settings.group.limits`,Safety:`settings.group.safety`,Interface:`settings.group.interface`};function Dl(e,t){let n=e.trim();return n===`not applicable for this model`?t(`settings.source.notApplicable`):n.startsWith(`capability vault`)?t(`settings.source.vaultDefault`):n.startsWith(`default`)?t(`settings.source.default`):n.startsWith(`persisted:`)||n===`persisted`?t(`settings.source.saved`):n.startsWith(`ARGUS_SKILL_`)||n===`env`?t(`settings.source.environment`):n.startsWith(`global:`)?t(`settings.source.hostConfig`):t(`settings.source.other`)}function Ol(e,t){let n=e.value.trim().toLowerCase();return[`ARGUS_SKILL_SAFE_MODE`,`ARGUS_SKILL_OPERATOR_AVAILABLE`,`ARGUS_SKILL_ENABLE_TELEGRAM`,`ARGUS_SKILL_SHOW_REASONING`].includes(e.name)?t([`1`,`true`,`on`,`yes`].includes(n)?`settings.value.enabled`:`settings.value.disabled`):e.value}function kl(e,t){let n={low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`}[e.toLowerCase()];return n?t(`settings.effort.${n}`):e}function Al({message:e,retrying:t,onRetry:n,t:r}){return(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 px-4 py-8 text-center`,children:[(0,K.jsx)(`p`,{className:`text-sm text-err`,children:e}),(0,K.jsx)(`button`,{type:`button`,onClick:n,disabled:t,className:`rounded-md border border-err/40 px-3 py-1.5 text-xs font-medium text-err hover:bg-err/10 disabled:opacity-40`,children:r(t?`common.loading`:`common.retry`)})]})}function jl({sid:e,open:t,onClose:n}){let{t:r}=F(),{data:i,isLoading:a,isError:o,isFetching:s,refetch:c}=oe(e,t),l=!!(i&&(i.recommended||i.checks.length||i.log_tail.trim()));return(0,K.jsxs)(tt,{open:t,onClose:n,label:r(`doctor.title`),width:`max-w-3xl`,children:[(0,K.jsx)(Qe,{title:r(`doctor.title`),sub:r(`doctor.subtitle`)}),(0,K.jsxs)(`div`,{className:`p-4`,children:[a&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),!a&&o&&(0,K.jsx)(Al,{message:r(`doctor.loadError`),retrying:s,onRetry:()=>void c(),t:r}),!a&&!o&&!l&&(0,K.jsx)(Ve,{children:r(`doctor.empty`)}),!a&&!o&&i?.recommended&&(0,K.jsxs)(`div`,{className:`mb-4 rounded-lg border border-gold/40 bg-gold/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-gold`,children:r(`doctor.recommended`)}),(0,K.jsx)(`div`,{className:`mt-1 text-sm text-ink`,children:i.recommended.name}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:i.recommended.detail}),i.recommended.fix&&(0,K.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap break-words rounded bg-bg p-2 font-mono text-xs text-blue-sky`,children:i.recommended.fix})]}),!a&&!o&&(0,K.jsx)(`div`,{className:`space-y-1.5`,children:(i?.checks??[]).map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-line/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:e.ok?`text-ok`:`text-err`,children:e.ok?`✓`:`✗`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.name}),e.detail&&(0,K.jsx)(`div`,{className:`mt-0.5 text-[11px] text-ink-dim`,children:e.detail}),!e.ok&&e.fix&&(0,K.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words rounded bg-bg p-1.5 font-mono text-xs text-ink-dim`,children:e.fix})]})]},t))}),!a&&!o&&i?.log_tail?.trim()&&(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`doctor.daemonLog`)}),(0,K.jsxs)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:[(0,K.jsxs)(`span`,{className:`text-ink-faint`,children:[r(`doctor.lastEntry`),` · `]}),gl(i.log_tail)]}),(0,K.jsx)(nt,{children:(0,K.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:i.log_tail})})]})]})]})}function Ml({sid:e,open:t,onClose:n}){let{t:i}=F(),a=S(),{data:o,isLoading:c,isError:u,isFetching:d,refetch:f}=xe(e,t),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(``),[y,b]=(0,U.useState)(!1),[x,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(``),[O,k]=(0,U.useState)(``),[A,j]=(0,U.useState)(!1),[M,N]=(0,U.useState)(``);(0,U.useEffect)(()=>{t||m(!1)},[t]),(0,U.useEffect)(()=>{!t||!o||(g(o.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MODEL`)?.value??``),v(``))},[o,t]);let I=async()=>{await f(),await a.invalidateQueries({queryKey:[`map-copy`]})},ee=$n(o),te=er(o),L=tr(o),ne=e=>!e||(L?Zn(L)===e:e===Zn(ee)),re=_||Zn(ee),ie=async t=>{if(!(y||ne(t))){b(!0),C(``),T(!1);try{await P.setConfig(e,`ARGUS_SKILL_RUNNER_BACKEND`,t),await I(),C(i(`settings.backendSwitched`,{backend:Qn(t,i)}))}catch(e){T(!0),C(wl(e,i).text)}finally{b(!1)}}},ae=async t=>{if(!y){b(!0),C(``),T(!1);try{await P.setConfig(e,`ARGUS_SKILL_MAP_MODEL`,t||`auto`),await I(),C(t&&t!==`auto`?i(`settings.mapModelSet`,{model:t}):i(`settings.mapModelFollows`))}catch(e){T(!0),C(wl(e,i).text)}finally{b(!1)}}},oe=async()=>{if(!y){b(!0),C(``),T(!1);try{let t=h.trim()||`auto`;await P.setConfig(e,`ARGUS_SKILL_MODEL`,t,!0),await I(),C(i(`settings.modelAppliedToRoles`,{model:t}))}catch(e){T(!0),C(wl(e,i).text)}finally{b(!1)}}},se=async t=>{if(t.preventDefault(),!(!E.trim()||!O.trim()||A)){j(!0),N(``);try{await P.setConfig(e,E.trim(),O.trim()),await I(),N(i(`settings.applied`))}catch(e){N(wl(e,i).text)}finally{j(!1)}}},ce=vl(o?.operator_knobs??[]).reduce((e,t)=>((e[t.group]??=[]).push(t),e),{}),le=yl(window.location.origin,e),ue=!!(o&&(o.roles.length||o.operator_knobs.length));return(0,K.jsxs)(tt,{open:t,onClose:n,label:i(`common.settings`),width:`max-w-4xl`,children:[(0,K.jsx)(Qe,{title:i(`common.settings`),sub:i(`settings.subtitle`)}),(0,K.jsxs)(`div`,{className:`p-4`,children:[c&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),!c&&u&&(0,K.jsx)(Al,{message:i(`settings.loadError`),retrying:d,onRetry:()=>void f(),t:i}),!c&&!u&&!ue&&(0,K.jsx)(Ve,{children:i(`settings.empty`)}),!c&&!u&&ue&&o&&(0,K.jsxs)(`div`,{className:`space-y-4`,children:[!o.trial_mode&&(0,K.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:i(`settings.quickConfig`)}),(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:i(`settings.backend`)}),(0,K.jsxs)(`select`,{value:_||Zn(ee),disabled:y,onChange:e=>v(e.target.value),"aria-label":i(`settings.backend`),className:`h-8 min-w-44 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[Zn(ee)?null:(0,K.jsx)(`option`,{value:``,disabled:!0,children:ee?i(`settings.backendUnsupported`,{backend:ee}):i(`settings.backendUnavailable`)}),Yn.map(e=>(0,K.jsx)(`option`,{value:e.value,children:i(e.label)},e.value))]}),(0,K.jsx)(`button`,{type:`button`,"data-apply-backend":!0,onClick:()=>{re&&ie(re)},disabled:y||ne(re),className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:i(`settings.applyModel`)}),te&&(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,"data-backend-source":te,children:i(`settings.backendSource.${te}`)}),!ne(re)&&(0,K.jsx)(`span`,{className:`text-[10px] text-ink-dim`,"data-backend-change":!0,children:L?i(`settings.backendWillReplace`,{saved:Qn(L,i),backend:Qn(re,i)}):i(`settings.backendWillSave`,{backend:Qn(re,i)})})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:i(`settings.model`)}),(0,K.jsxs)(`select`,{value:h||`auto`,onChange:e=>g(e.target.value===`auto`?``:e.target.value),"aria-label":i(`settings.model`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,K.jsx)(`option`,{value:`auto`,children:o.model_auto_resolves_to?`auto → ${o.model_auto_resolves_to}`:i(`settings.modelPlaceholder`)}),(()=>{let e=o.model_options??[],t=new Set(e.filter(e=>e.invalid).map(e=>e.model)),n=e.map(e=>e.model),r=h.trim();return r&&r!==`auto`&&!n.includes(r)&&(n.unshift(r),t.add(r)),n.map(e=>(0,K.jsx)(`option`,{value:e,children:t.has(e)?`${e} (${i(`settings.modelUnavailable`)})`:e},e))})()]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void oe(),disabled:y,className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:i(`settings.applyModel`)})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:i(`settings.mapModel`)}),(0,K.jsxs)(`select`,{value:o.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||`auto`,disabled:y,onChange:e=>void ae(e.target.value),"aria-label":i(`settings.mapModel`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[(0,K.jsx)(`option`,{value:`auto`,children:i(`settings.mapModelFollows`)}),(()=>{let e=(o.model_options??[]).map(e=>e.model),t=o.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||``;return t&&t!==`auto`&&!e.includes(t)&&e.unshift(t),e.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})()]})]}),(o.model_options??[]).some(e=>e.offline)&&(0,K.jsx)(`p`,{className:`mt-1 text-[10px] text-ink-faint`,"data-model-offline":!0,children:i(`settings.modelOfflineList`)}),o.roles.some(e=>e.model&&h.trim()&&e.model!==h.trim())&&(0,K.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-ink-faint`,"data-role-models":!0,children:[i(`settings.rolesRunning`),` `,o.roles.map(e=>`${e.role} · ${e.model||`auto`}`).join(`,`),` — `,i(`settings.applyUnifies`)]}),x&&(0,K.jsx)(`div`,{role:w?`alert`:`status`,className:`mt-1.5 text-[10px] ${w?`text-err`:`text-ink-dim`}`,children:x})]}),o.trial_mode&&(0,K.jsx)(`section`,{className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,"aria-label":i(`settings.trialAccount`),children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`settings.trialAccount`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:`GPT-5.5 · high`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:i(`settings.trialKeyHint`)})]}),lr()&&(0,K.jsx)(`button`,{type:`button`,className:`compact-control px-3 py-2`,onClick:()=>{n(),ur()},children:i(`settings.changeTrialKey`)})]})}),p&&(0,K.jsx)(dl,{sid:e,config:o,onSaved:I}),p&&(0,K.jsx)(fl,{sid:e,primaryModel:o.roles.find(e=>e.role===`engineer`)?.model}),(0,K.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface/50`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":p,"aria-controls":`config-advanced-settings`,onClick:()=>m(e=>!e),className:`flex w-full items-center justify-between gap-3 px-3 py-3 text-left hover:bg-bg/30`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`block text-xs font-semibold text-ink`,children:i(`settings.advanced`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-ink-faint`,children:i(`settings.advancedHint`)})]}),(0,K.jsx)(s,{icon:r,className:`text-xs text-ink-faint transition-transform ${p?`rotate-180`:``}`})]}),p&&(0,K.jsxs)(`div`,{id:`config-advanced-settings`,className:`space-y-4 border-t border-line/70 p-3`,children:[(0,K.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:i(`settings.connection`)}),(0,K.jsxs)(`div`,{className:`mt-2 grid gap-2 text-[10px] sm:grid-cols-[100px_minmax(0,1fr)]`,children:[(0,K.jsx)(`span`,{className:`text-ink-faint`,children:i(`settings.webApi`)}),(0,K.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:le.webApi}),(0,K.jsx)(`span`,{className:`text-ink-faint`,children:i(`settings.eventStream`)}),(0,K.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:le.eventStream}),(0,K.jsx)(`span`,{className:`text-ink-faint`,children:i(`settings.taskDaemon`)}),(0,K.jsx)(`span`,{className:`text-ink-dim`,children:i(`settings.taskDaemonValue`)})]})]}),(0,K.jsxs)(`form`,{onSubmit:e=>void se(e),className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-blue`,children:i(`settings.overrideTitle`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-[10px] text-ink-faint`,children:i(`settings.overrideHint`)}),(0,K.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,K.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),placeholder:i(`settings.namePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,K.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:i(`settings.valuePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,K.jsx)(`button`,{disabled:A||!E.trim()||!O.trim(),title:i(`settings.applyAdvanced`),"aria-label":i(`settings.applyAdvanced`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:A?`…`:(0,K.jsx)(s,{icon:l})})]}),M?(0,K.jsx)(`div`,{className:`mt-2 text-xs text-ink-dim`,children:M}):null]}),o.roles.length>0&&(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:i(`settings.rolesTitle`)}),(0,K.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:o.roles.map(e=>(0,K.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:e.role===`curator`?i(`settings.role.curator`):yn(e.role,i)}),(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.backend_label})]}),(0,K.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px] text-ink-dim`,title:e.model,children:e.model}),(0,K.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-ink-faint`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:Dl(e.model_source,i)}),e.reasoning_effort&&(0,K.jsx)(`span`,{className:`ml-auto shrink-0`,style:{color:ze(e.reasoning_effort)},children:kl(e.reasoning_effort,i)})]}),(ot(e.role)||e.role===`curator`)&&(0,K.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-ink-faint`,children:ot(e.role)?Re(e.role,i):i(`settings.role.curatorDoc`)})]},e.role))})]}),Object.keys(ce).length>0&&(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:i(`settings.rawConfig`)}),Object.entries(ce).map(([e,t])=>(0,K.jsxs)(`div`,{className:`mt-3 first:mt-0`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:i(El[e])}),(0,K.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-line`,children:t.map((e,t)=>{let n=Tl[e.name],r=Ol(e,i);return(0,K.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] ${t?`border-t border-line/60`:``}`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-ink-dim`,children:i(n.label)}),(0,K.jsx)(`code`,{className:`mt-0.5 block break-all text-[9px] text-ink-faint`,children:e.name}),(0,K.jsx)(`div`,{className:`mt-1 text-[10px] leading-relaxed text-ink-faint`,children:i(n.doc)})]}),(0,K.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,K.jsxs)(`div`,{className:`text-[11px] text-ink`,children:[r,r!==e.value&&(0,K.jsxs)(`code`,{className:`ml-1 text-[9px] text-ink-faint`,children:[`(`,e.value,`)`]})]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Dl(e.source,i)})]})]},e.name)})})]},e))]}),(0,K.jsxs)(`p`,{className:`text-[10px] text-ink-faint`,children:[i(`settings.footer`),` `,(0,K.jsx)(`code`,{children:`argus --config-help`}),`.`]})]})]})]})]})]})}function Nl({sid:e,open:t,onClose:n}){let{t:r}=F(),{data:i,isLoading:a,refetch:o}=Ce(e,t),[c,l]=(0,U.useState)(``),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(``);(0,U.useEffect)(()=>{t&&i!=null&&l(i)},[i,t]);let h=async()=>{if(!d){f(!0),m(``);try{await P.setIdentity(e,c),await o(),m(r(`identity.saved`))}catch(e){m(wl(e,r).text)}finally{f(!1)}}};return(0,K.jsxs)(tt,{open:t,onClose:n,label:r(`identity.title`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:r(`identity.title`),sub:r(`identity.subtitle`)}),(0,K.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-5`,children:[a&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),a?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),rows:12,className:`w-full resize-y rounded-lg border border-line bg-bg p-3 font-sans text-sm leading-relaxed text-ink outline-none focus:border-blue`,placeholder:r(`identity.placeholder`)}),(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:d||c===(i??``),title:r(`identity.save`),"aria-label":r(`identity.save`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:d?`…`:(0,K.jsx)(s,{icon:u})})]})]})]})]})}function Pl({sid:e,open:t,onClose:n}){let{t:r}=F(),{data:i,isLoading:a}=le(e,t),o=i??[];return(0,K.jsxs)(tt,{open:t,onClose:n,label:r(`transcript.title`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:r(`transcript.title`),sub:r(`transcript.subtitle`)}),(0,K.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-4`,children:[a&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),!a&&o.length===0&&(0,K.jsx)(Ve,{children:r(`transcript.empty`)}),o.map((e,t)=>{let n=e.role===`operator`;return(0,K.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)] border-b border-line/50 py-2.5 last:border-b-0`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`font-mono text-[10px] font-semibold uppercase tracking-wide ${n?`text-ink-faint`:`text-blue-sky`}`,children:n?r(`transcript.operator`):`argus`}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:mt(e.ts)})]}),(0,K.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink-dim`,children:e.text})]},t)})]})]})}function Fl({card:e}){let{t,locale:n}=F(),r=typeof e.asked_at==`number`&&Number.isFinite(e.asked_at)&&e.asked_at>0?new Date(e.asked_at*1e3):null,i=e.task_status?.startsWith(`paused`);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] text-ink-faint`,"data-decision-task":e.item_id,children:[e.task_title?(0,K.jsx)(`span`,{className:`min-w-0 basis-full break-words text-xs leading-relaxed text-ink-dim`,title:e.task_title,children:t(`decision.taskName`,{title:e.task_title})}):null,e.kind!==`domain_intake`&&e.is_current_task!=null?(0,K.jsx)(`span`,{children:t(e.is_current_task?`decision.currentTask`:`decision.otherTask`)}):null,(0,K.jsx)(Je,{children:t(`decision.awaitingReply`)}),e.task_status?(0,K.jsx)(`span`,{children:i?t(`label.status.paused`):vn(e.task_status,t)}):null,r&&!Number.isNaN(r.getTime())?(0,K.jsx)(`time`,{dateTime:r.toISOString(),title:r.toLocaleString(n),children:t(`decision.askedAt`,{time:H(r,n)})}):null]})}function Il({questions:e,backlog:t,currentTaskId:n,onAnswer:r,onLocate:i}){let{t:a}=F(),o=kr(e,t,n);if(!o.length)return null;let s=o[0];return(0,K.jsxs)(`div`,{className:`mb-2 flex min-h-11 items-center gap-3 rounded-md border border-gold/40 bg-gold/5 px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s.title===s.task_title?null:(0,K.jsx)(`div`,{className:`truncate text-xs font-medium text-gold`,title:s.title,children:s.title}),(0,K.jsx)(Fl,{card:s}),(0,K.jsx)(`div`,{className:`truncate text-xs text-ink-dim`,title:s.reason||s.question,children:s.reason||s.question})]}),o.length>1?(0,K.jsxs)(`span`,{className:`font-mono text-xs text-ink-faint`,children:[`+`,o.length-1]}):null,i&&s.item_id?(0,K.jsx)(`button`,{onClick:()=>i(s.item_id),className:`shrink-0 text-xs text-ink-dim hover:text-gold`,children:a(`pending.showOnMap`)}):null,(0,K.jsx)(`button`,{onClick:r,className:`shrink-0 text-xs font-medium text-gold hover:text-gold-soft`,children:a(`pending.reviewRespond`)})]})}function Ll({reply:e,open:t,busy:n,onClose:r,onSubmit:i,error:a=``}){let{t:o,locale:s}=F(),c=s===`zh-CN`,l=(0,U.useMemo)(()=>e?.options[0]?.id??`custom`,[e]),[u,d]=(0,U.useState)(l),[f,p]=(0,U.useState)(``),[m,h]=(0,U.useState)(``);if((0,U.useEffect)(()=>{t&&(d(l),p(``),h(``))},[l,t,e?.id]),!e)return null;let g=e.options.length===0,_=e.kind===`domain_intake`,v=e.options.find(e=>e.id===u),y=g?!!f.trim():!!(v&&(!v.requires_note||f.trim())),b=()=>{if(!n){if(!y){h(o(`decision.noteRequired`));return}h(``),i(g?`custom`:u,f.trim())}};return(0,K.jsxs)(tt,{open:t,onClose:n?()=>void 0:r,label:o(`decision.operator`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:_?e.title:o(`decision.required`),sub:!_&&e.title!==e.task_title?e.title:void 0}),(0,K.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[(0,K.jsx)(Fl,{card:e}),e.reason?(0,K.jsxs)(`section`,{className:`rounded-md border border-gold/30 bg-gold/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-gold`,children:o(`decision.whyBlocked`)}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.reason})]}):null,e.evidence.length?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:o(`decision.evidence`)}),(0,K.jsx)(`div`,{className:`space-y-2`,children:e.evidence.map((e,t)=>(0,K.jsxs)(`div`,{className:`rounded border border-line/70 bg-bg/40 p-2.5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.label}),e.summary?(0,K.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:e.summary}):null,e.path?(0,K.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10px] text-blue-sky`,children:e.path}):null]},`${e.path}:${t}`))})]}):null,(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.question}),e.options.length?(0,K.jsx)(`div`,{className:`space-y-2`,children:e.options.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{d(e.id),h(``)},disabled:n,"aria-pressed":u===e.id,className:`w-full rounded-md border p-3 text-left ${u===e.id?`border-blue bg-blue/5`:`border-line bg-bg/30`}`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-ink`,children:e.label}),(0,K.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-ink-dim`,children:e.description})]},e.id))}):null,_||g||v?.requires_note||f?(0,K.jsx)(`textarea`,{"data-autofocus":!0,value:f,onChange:e=>{p(e.target.value),h(``)},onKeyDown:e=>{fc(e)||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},rows:3,disabled:n,"aria-label":_?c?`你的回答或补充说明`:`Your answer or additional details`:o(`decision.notePlaceholder`),placeholder:_?v?.requires_note?c?`填写你的回答…`:`Enter your answer…`:c?`补充说明(可选)`:`Additional details (optional)`:o(`decision.notePlaceholder`),className:`w-full resize-y rounded-lg border border-line bg-bg px-3 py-2 text-sm leading-relaxed text-ink outline-none focus:border-blue disabled:opacity-60`}):null,m||a?(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:m||a}):null,(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:_?c?`确认后继续这次任务。`:`Confirm to continue this request.`:o(`decision.resumeHint`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md px-3 py-2 text-xs text-ink-dim hover:bg-bg`,children:o(n?`decision.closeContinue`:`decision.later`)}),(0,K.jsx)(`button`,{type:`button`,onClick:b,disabled:n,className:`rounded-md border border-blue/35 bg-blue/8 px-3 py-2 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-50`,children:o(n?`decision.applying`:g||u===`custom`?`decision.sendAnswer`:u===`stop`?`decision.stopCampaign`:`decision.useOption`)})]})]})]})]})}function Rl({alert:e}){if(!e)return null;let t=e.tone===`block`,n=e.kind===`budget`;return(0,K.jsxs)(`div`,{className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border px-3.5 py-2 text-[13px] ${t?`border-err/50 bg-err/10 text-err`:`border-warn/50 bg-warn/10 text-warn`}`,role:t?`alert`:`status`,children:[(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-bold leading-none`,children:n?`$`:t?`!`:`i`}),(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold uppercase tracking-wide`,children:n?`budget alarm`:t?`action required`:`notice`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.text,children:e.text})]})}function zl({sid:e}){let{t}=F(),n=S(),{data:r}=xe(e,!0),[i,a]=(0,U.useState)(!1);if(!e||!Sl(r?.operator_knobs))return null;let o=async()=>{a(!0);try{await P.setConfig(e,bl,`1`),await n.invalidateQueries({queryKey:[`config`,e]})}finally{a(!1)}};return(0,K.jsxs)(`div`,{"data-no-operator-banner":!0,role:`status`,className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border border-warn/50 bg-warn/10 px-3.5 py-2 text-[13px] text-warn`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:t(`noOperator.banner`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:i,className:`shrink-0 rounded border border-warn/50 px-2 py-0.5 text-xs font-medium hover:bg-warn/10 disabled:opacity-40`,children:t(`noOperator.turnOff`)})]})}function Bl(e){let t=(e.label||e.display_name||``).trim();return!!(t&&t!==e.id)}function Vl(e){return[...e].sort((e,t)=>{if(e.daemon_alive!==t.daemon_alive)return e.daemon_alive?-1:1;let n=Bl(e);return n===Bl(t)?(t.last_active||0)-(e.last_active||0):n?-1:1})}function Hl(e){return Vl(e)[0]}function Ul(e,t){let n=t?.trim()||null;return n&&e.some(e=>e.id===n)?{id:n,requested:n,recovered:!1}:{id:Hl(e)?.id??null,requested:n,recovered:!!n}}function Wl(e,t,n){if(n){let e=t?.trim()||null;return{id:e,requested:e,recovered:!1}}return Ul(e,t)}function Gl(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return!0;let r=e.daemon_alive?`live running`:`stopped idle`,i=[e.id,e.label,e.display_name,e.objective,r].filter(Boolean).join(` `).toLowerCase();return n.every(e=>i.includes(e))}function Kl(e,t){return e.filter(e=>Gl(e,t))}function ql(e){let t=new Set;return[e.primary_target,...e.targets].filter(e=>!e?.path||t.has(e.path)?!1:(t.add(e.path),!0))}function Jl(e,t){if(t===`research`)for(let t of e){let e=ql(t).find(e=>/(?:^|\/)paper\/main\.pdf$/i.test(e.path.replace(/\\/g,`/`)));if(e)return{receipt:t,path:e.path}}let n=e[0];return n?{receipt:n,path:ql(n)[0]?.path||null}:null}function Yl(e){return e.replace(/\s*\bRESULT\s*=\s*/g,` + +`).replace(/\s*\b(?:STATUS|REVIEW_STATUS)\s*=\s*\S+/g,``).trim()}function Xl(e,t,n){let r=n.reduce((e,t)=>t.type===`ui.operator`?Math.max(e,Number(t.ts)||0):e,0),i=t&&(e===void 0||t.delivered_at>r)?t:null;return e?i&&i.delivered_at>e.delivered_at?i:e:i}function Zl(e,t){if(!t)return!1;let n=new Set([t]),r=[t];for(let t=0;te.id!==t&&n.has(e.id)&&[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))}var Ql=new Set([`done`,`passed`,`approved`,`accepted`]);function $l(e,t){let n=String(e.review_status||``).toLowerCase(),r=String(e.review_source||``).toLowerCase(),i=String(e.residual_risk||``).trim();return Ql.has(n)&&r===`reviewer`&&i?{independent:!0,text:t?`独立复核通过 · 有残余风险`:`Independently reviewed · residual risk`,title:t?`有一项检查在此环境中无法进行,已被接受为残余风险:${i}`:`One check was impossible here and its risk was accepted: ${i}`}:Ql.has(n)&&r===`reviewer`?{independent:!0,text:t?`独立复核通过`:`Independently reviewed`,title:t?`另一个审查角色检查过这份成果`:`A separate reviewer checked this result`}:!n||n===`not_assessed`||Ql.has(n)&&r?{independent:!1,text:t?`实现者自检 · 未独立复核`:`Self-checked · not independently reviewed`,title:t?`只有完成它的人自己检查过,没有另外的审查`:`Only the worker that produced it checked it; no separate review`}:Ql.has(n)?{independent:!1,text:t?`已完成 · 未记录是否独立复核`:`Completed · review source not recorded`,title:t?`这份较早的交付没有记录是谁检查的,不能确认经过独立复核`:`This older delivery did not record who checked it, so independent review cannot be confirmed`}:{independent:!1,text:t?`复核状态:${n}`:`Review: ${n}`,title:t?`独立复核没有通过或已过期`:`Independent review did not pass or is out of date`}}function eu(e,t,n){if(!n)return null;let r=e.snapshots?.find(e=>e.path===n&&e.stored);if(!r)return null;let i=t.filter(t=>t.delivery_id!==e.delivery_id&&t.delivered_att.delivered_at-e.delivered_at);for(let e of i){let t=e.snapshots?.find(e=>e.path===n);if(!(!t||t.sha256===r.sha256))return t.stored?{path:n,before:t.sha256,after:r.sha256}:null}return null}function tu({sid:e,change:t,zh:n}){let[r,i]=(0,U.useState)({open:!1,loading:!1,diff:``,error:``,truncated:!1});return(0,K.jsxs)(`div`,{className:`delivery-changes`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-expanded":r.open,onClick:()=>{if(r.open){i(e=>({...e,open:!1}));return}i(e=>({...e,open:!0,loading:!e.diff&&!e.error})),!(r.diff||r.error)&&P.deliveryDiff(e,t).then(e=>i(t=>({...t,loading:!1,truncated:e.truncated,diff:e.available?e.diff:``,error:e.available?e.diff?``:n?`内容没有变化`:`No content changes`:n?`上一版已不再保存,无法对比`:`The previous version is no longer kept`}))).catch(e=>i(t=>({...t,loading:!1,error:e instanceof Error?e.message:String(e)})))},children:r.open?n?`收起改动`:`Hide changes`:n?`查看与上一次交付相比的改动`:`Show changes since the previous delivery`}),r.open&&(r.loading?(0,K.jsx)(`p`,{children:n?`正在读取…`:`Loading…`}):r.error?(0,K.jsx)(`p`,{children:r.error}):(0,K.jsxs)(`pre`,{"aria-label":n?`改动`:`Changes`,children:[r.diff.split(` +`).map((e,t)=>(0,K.jsxs)(`span`,{className:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:void 0,children:[e,` +`]},t)),r.truncated?n?`…(改动过长,已截断)`:`… (truncated)`:``]}))]})}var nu=({children:e})=>(0,K.jsxs)(`span`,{children:[e,` `]}),ru=(0,U.memo)(function({children:e}){return(0,K.jsx)(T,{remarkPlugins:st,rehypePlugins:at,components:{p:nu,h1:nu,h2:nu,h3:nu,h4:nu,h5:nu,h6:nu,ul:nu,ol:nu,blockquote:nu,pre:nu,li:({children:e})=>(0,K.jsxs)(`span`,{className:`markdown-excerpt-item`,children:[e,` `]}),table:nu,thead:nu,tbody:nu,tr:nu,th:({children:e})=>(0,K.jsxs)(`strong`,{children:[e,` · `]}),td:nu,a:({children:e})=>(0,K.jsx)(`span`,{className:`markdown-excerpt-link`,children:e}),img:({alt:e})=>(0,K.jsx)(`span`,{children:e}),input:({checked:e})=>(0,K.jsx)(`span`,{children:e?`✓ `:`○ `}),hr:()=>(0,K.jsx)(`span`,{children:` · `}),code:({children:e})=>(0,K.jsx)(`code`,{children:e})},children:Yl(e)})});function iu({html:e,title:t,className:n=``,sid:r,path:i}){return r&&i?(0,K.jsx)(au,{sid:r,path:i,html:e,title:t,className:n}):(0,K.jsx)(`iframe`,{title:t,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white ${n}`})}function au({html:e,title:t,className:n,sid:r,path:i}){let{locale:a}=F(),o=a===`zh-CN`,s=x({queryKey:[`artifact-html`,r,i,e],queryFn:({signal:e})=>P.artifactPreview(r,i,e),enabled:!!(r&&i),staleTime:3e4,retry:1});if(r&&i&&s.isPending)return(0,K.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,role:`status`,children:o?`正在加载网页和配套资源…`:`Loading the website and its assets…`});if(r&&i&&s.isError)return(0,K.jsxs)(`div`,{className:`m-auto p-6 text-sm text-err`,role:`alert`,children:[o?`网页预览加载失败,请重试或下载文件。`:`Preview could not load. Retry or download the file.`,(0,K.jsx)(`button`,{type:`button`,className:`ml-3 underline`,onClick:()=>void s.refetch(),children:o?`重试`:`Retry`})]});let c=s.data?.served_page===!0;return(0,K.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col ${n}`,children:[!!s.data?.warnings.length&&(0,K.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`部分配套资源无法加载,页面可能不完整。`:`Some linked assets are unavailable; the preview may be incomplete.`}),!c&&(0,K.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`此后端尚未支持独立网页预览;当前为内嵌预览,交互脚本可能不可用。`:`This backend does not yet support standalone preview; embedded preview may not run interactive scripts.`}),(0,K.jsx)(`iframe`,{title:t,src:c?D(r,i):void 0,srcDoc:c?void 0:s.data?.html??e,sandbox:`allow-scripts allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]})}function ou(e){let t=e.trim();if(!t)return``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{try{return t.split(/\r?\n/).filter(Boolean).map(e=>JSON.parse(e)).map(e=>JSON.stringify(e,null,2)).join(` +`)}catch{return e}}}function su(e,t){let n=[],r=[],i=``,a=!1;for(let o=0;oe.some(e=>e.length>0))}function cu({value:e}){return(0,K.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:ou(e)||`(empty data)`})}function lu({value:e,delimiter:t}){let n=su(e,t).slice(0,200),r=n[0]??[];return(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4 scroll-thin`,children:n.length?(0,K.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsx)(`tr`,{children:r.slice(0,40).map((e,t)=>(0,K.jsx)(`th`,{className:`border border-line/60 bg-surface px-2 py-1.5 font-semibold text-ink`,children:e},t))})}),(0,K.jsx)(`tbody`,{children:n.slice(1).map((e,t)=>(0,K.jsx)(`tr`,{children:r.slice(0,40).map((t,n)=>(0,K.jsx)(`td`,{className:`border border-line/50 px-2 py-1.5 align-top text-ink-dim`,children:e[n]??``},n))},t))})]}):(0,K.jsx)(`div`,{className:`text-sm text-ink-faint`,children:`(empty table)`})})}var uu=``+new URL(`pdf.min-Bbvtrhlt.mjs`,import.meta.url).href,du=``+new URL(`pdf.worker.min-CLrFZWeq.mjs`,import.meta.url).href,fu=null,pu=0;function mu(){fu=null,pu+=1}function hu(){if(fu)return fu;let e=new URL(uu,import.meta.url),t=new URL(du,import.meta.url);pu&&(e.searchParams.set(`retry`,String(pu)),t.searchParams.set(`retry`,String(pu)));let n=Se(()=>import(e.href).then(e=>(e.GlobalWorkerOptions.workerSrc=t.href,e)),[],import.meta.url).catch(e=>{throw fu===n&&mu(),e});return fu=n,n}function gu(e,t,n,r){let i=Math.max(1,n-32)/Math.max(1,e),a=Math.max(1,r-32)/Math.max(1,t);return Math.min(2.5,i,a)}function _u({src:e,name:t,className:n=``,onPageOrientation:r,onRetry:i}){let{locale:a}=F(),o=a===`zh-CN`,s=(0,U.useRef)(null),c=(0,U.useRef)(null),l=(0,U.useRef)(null),[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(1),[m,h]=(0,U.useState)(1),[g,_]=(0,U.useState)({width:0,height:0}),[v,y]=(0,U.useState)(!0),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(0);(0,U.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>_({width:e.clientWidth,height:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,U.useEffect)(()=>{let t=!0,n=new AbortController,r=null;return d(null),p(1),h(1),l.current=null,c.current?.scrollTo(0,0),C(``),y(!0),Promise.all([fetch(e,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`PDF request failed (${e.status})`);return e.arrayBuffer()}),hu()]).then(async([e,n])=>{if(!t)return;r=n.getDocument({data:new Uint8Array(e)});let i=await r.promise;t&&(d(i),y(!1))}).catch(e=>{t&&(y(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!1,n.abort(),r?.destroy().catch(()=>{})}},[e,w]),(0,U.useEffect)(()=>{let e=s.current;if(!u||!e||g.width<=0||g.height<=0)return;let t=!1,n=null;return x(!0),C(``),u.getPage(f).then(e=>{if(t||!s.current)return;let i=e.getViewport({scale:1});r?.(i.width>i.height?`landscape`:`portrait`);let a=gu(i.width,i.height,g.width,g.height),o=e.getViewport({scale:a*m}),u=document.createElement(`canvas`),d=u.getContext(`2d`,{alpha:!1});if(!d)throw Error(`Canvas rendering is unavailable`);let f=Math.min(window.devicePixelRatio||1,2);return u.width=Math.max(1,Math.floor(o.width*f)),u.height=Math.max(1,Math.floor(o.height*f)),n=e.render({canvas:u,canvasContext:d,viewport:o,transform:f===1?void 0:[f,0,0,f,0,0]}),n.promise.then(()=>{if(t||!s.current)return;let e=s.current,n=e.getContext(`2d`,{alpha:!1});if(!n)throw Error(`Canvas rendering is unavailable`);e.width=u.width,e.height=u.height,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`,n.drawImage(u,0,0);let r=c.current,i=l.current;if(r&&i){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect();r.scrollLeft+=n.left+i.x*n.width-t.left-r.clientWidth/2,r.scrollTop+=n.top+i.y*n.height-t.top-r.clientHeight/2,l.current=null}})}).then(()=>{t||x(!1)}).catch(e=>{t||e instanceof Error&&e.name===`RenderingCancelledException`||(x(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!0,n?.cancel()}},[r,f,u,g.height,g.width,m]);let E=e=>{let t=c.current,n=s.current;if(t&&n&&n.clientWidth&&n.clientHeight){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();l.current={x:Math.max(0,Math.min(1,(e.left+t.clientWidth/2-r.left)/r.width)),y:Math.max(0,Math.min(1,(e.top+t.clientHeight/2-r.top)/r.height))}}h(t=>Math.max(.6,Math.min(2.2,Math.round((t+e)*100)/100)))},D=()=>{l.current=null,c.current?.scrollTo(0,0),h(1)},O=u?.numPages??0;return(0,K.jsxs)(`div`,{className:`pdf-viewer flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-bg ${n}`,"aria-busy":v||b,children:[(0,K.jsxs)(`div`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-2 border-b border-line/70 bg-panel px-3 py-1.5 text-[11px] text-ink-dim`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink`,title:t,children:t}),(0,K.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[o?`第`:`Page`,` `,f,` / `,O||`…`]}),(0,K.jsx)(`button`,{type:`button`,disabled:!u||f<=1,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.max(1,e-1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`上一页`:`Previous`}),(0,K.jsx)(`button`,{type:`button`,disabled:!u||f>=O,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.min(O,e+1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`下一页`:`Next`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o?`缩小`:`Zoom out`,disabled:!u||m<=.6,onClick:()=>E(-.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`−`}),(0,K.jsxs)(`span`,{className:`w-10 text-center font-mono tabular-nums`,children:[Math.round(m*100),`%`]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o?`放大`:`Zoom in`,disabled:!u||m>=2.2,onClick:()=>E(.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`+`}),(0,K.jsx)(`button`,{type:`button`,disabled:!u,onClick:D,className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`适合页面`:`Fit page`})]}),(0,K.jsxs)(`div`,{ref:c,className:`pdf-scroll-viewport relative min-h-0 min-w-0 flex-1 overflow-auto bg-surface/60 p-4 scroll-thin`,tabIndex:0,"aria-label":o?`PDF 页面滚动区域`:`PDF page scroll area`,children:[v?(0,K.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,K.jsx)(Ue,{})}):null,S?(0,K.jsxs)(`div`,{role:`alert`,className:`m-auto max-w-sm rounded border border-err/35 bg-err/5 p-4 text-center text-sm text-err`,children:[(0,K.jsx)(`p`,{children:o?`PDF 暂时无法预览`:`PDF preview is temporarily unavailable`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{mu(),i?i():T(e=>e+1)},className:`mt-3 rounded border border-line bg-panel px-3 py-1.5 text-ink hover:border-blue/50`,children:o?`重试预览`:`Retry preview`}),(0,K.jsxs)(`details`,{className:`mt-3 break-words text-xs text-ink-dim`,children:[(0,K.jsx)(`summary`,{children:o?`错误详情`:`Error details`}),S]})]}):null,S?null:(0,K.jsx)(`div`,{className:`pdf-page-stage flex min-h-full min-w-full w-max items-center justify-center`,children:(0,K.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`${t} · ${o?`第`:`page`} ${f}`,className:`block max-w-none shrink-0 bg-white shadow-xl`})})]})]})}function vu(e){return e.kind===`markdown`||e.mime?.split(`;`,1)[0].trim().toLowerCase()===`text/markdown`||/\.(?:md|markdown)$/i.test(e.name||e.path||``)}function yu(e){return e.title?.trim()||e.question}function bu({sid:e,path:t,onClose:n,delivery:r,deliveries:i=[],onSelectDelivery:a,onSelectPath:o,reviewActivity:s,artifacts:c=[]}){let{t:l,locale:u}=F(),d=u===`zh-CN`,f=r?ql(r):[],p=de(e,t),m=p.data,h=m?.source===`reader_foundation`?m.reader_foundation:void 0,g=m?.source===`progress_snapshot`,_=m?vu(m):!1,[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(0),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(!1),[O,k]=(0,U.useState)(`portrait`),A=m?.kind===`pdf`||t?.toLowerCase().endsWith(`.pdf`)===!0,j=!!(t&&/(?:^|[\\/])REVIEW\.md$/i.test(t));(0,U.useEffect)(()=>{if(!(!t||!A))return pr(!0),()=>pr(!1)},[t,A]),(0,U.useEffect)(()=>{if(k(`portrait`),y(null),x(``),!e||!t||!m||![`image`,`pdf`,`audio`,`video`].includes(m.kind))return;let n=!0,r=``,i=new AbortController;return P.artifactBlob(e,t,!1,i.signal).then(e=>{n&&(r=URL.createObjectURL(e),y(r))},e=>n&&x(e.message)),()=>{n=!1,i.abort(),r&&URL.revokeObjectURL(r)}},[e,t,m?.kind,S]);let M=async(n=!1)=>{if(!(!e||!t||!m)){T(!0),x(``);try{let r=n?await P.artifactBundle(e,t):await P.artifactBlob(e,t,!0);$e(r,n?`${m.name.replace(/\.html?$/i,``)}-website.zip`:m.name)}catch(e){x(e.message)}finally{T(!1)}}};return(0,K.jsxs)(tt,{open:!!(t||r),onClose:n,label:r?d?`交付成果`:`Delivery`:l(`artifact.preview`),width:r?E?`max-w-none`:`max-w-6xl`:A?`max-w-none`:`max-w-5xl`,viewport:r?E:A,showClose:!1,style:r?{height:E?`100dvh`:`min(92dvh, 960px)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:A?{maxWidth:O===`portrait`?`min(96vw, 76dvh)`:`min(96vw, 145dvh)`}:void 0,children:[r&&!E&&(0,K.jsxs)(`header`,{className:`delivery-header`,children:[(0,K.jsxs)(`div`,{className:`delivery-heading`,children:[(0,K.jsx)(`span`,{className:`delivery-mark`,children:(0,K.jsx)(Gt,{size:22})}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{children:[`DELIVERY · `,d?`交付成果`:`Your results`]}),(0,K.jsx)(`h2`,{children:d?`成果文件`:`Result files`})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:n,className:`delivery-return`,"aria-label":d?`关闭交付弹窗`:`Close delivery`,children:[d?`返回地图`:`Back to map`,` ×`]})]}),i.length>1?(0,K.jsx)(`select`,{"aria-label":d?`选择交付任务`:`Choose delivery`,className:`delivery-task-select`,value:r.delivery_id,onChange:e=>{let t=i.find(t=>t.delivery_id===e.target.value);t&&a?.(t)},children:i.map(e=>(0,K.jsx)(`option`,{value:e.delivery_id,children:e.title},e.delivery_id))}):(0,K.jsx)(`p`,{className:`delivery-task-title`,title:r.title,children:r.title}),(0,K.jsxs)(`div`,{className:`delivery-facts`,children:[(()=>{let e=$l(r,d);return(0,K.jsxs)(`span`,{className:e.independent?`delivery-review-independent`:`delivery-review-self`,title:e.title,children:[e.independent?(0,K.jsx)(Ft,{size:13}):null,e.text]})})(),(0,K.jsxs)(`span`,{children:[f.length,` `,d?`个文件`:`files`]})]}),r.summary&&(0,K.jsxs)(`details`,{className:`delivery-summary`,children:[(0,K.jsx)(`summary`,{children:d?`查看成果说明`:`Result summary`}),(0,K.jsx)(`p`,{children:(0,K.jsx)(ru,{children:r.summary})})]})]}),!E&&!!f.length&&(0,K.jsx)(`nav`,{className:`delivery-files`,"aria-label":d?`交付文件`:`Delivery files`,children:f.map(e=>(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":t===e.path,onClick:()=>o?.(e.path),title:e.path,children:[(0,K.jsx)(`span`,{children:e.path.split(`/`).at(-1)}),r?.primary_target?.path===e.path&&(0,K.jsx)(`small`,{children:d?`主要成果`:`Main result`})]},e.path))}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-line px-4 py-3 sm:px-5 ${t?``:`hidden`}`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink ${h||g?``:`font-mono`}`,title:h?.question??m?.progress_source?.title??m?.storage_path??m?.path??t??``,children:h?yu(h):g?m?.progress_source?.title||l(`artifact.title`):m?.name??t??l(`artifact.title`)}),(0,K.jsx)(`p`,{className:`mt-0.5 truncate text-[11px] text-ink-faint`,children:h?h.kind===`clarification`||h.kind===`progress_answer`?d?`阅读问答`:`Reading question and answer`:d?`背景说明 · 不计作研究进展`:`Background explanation · separate from research progress`:g?d?`保存的进展说明 · 提问来源`:`Saved progress explanation · question source`:m?`${m.kind} · ${ct(m.size)} · ${m.mime}`:d?`正在读取文件`:`Loading file`})]}),r&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>D(e=>!e),"aria-label":E?d?`收起预览`:`Exit full screen`:d?`全屏预览`:`Full screen preview`,title:d?`切换全屏预览`:`Toggle full screen preview`,className:`shrink-0 rounded-md border border-line p-2 text-ink-dim`,children:E?(0,K.jsx)(Wt,{size:16}):(0,K.jsx)(G,{size:16})}),m?.kind===`html`&&(0,K.jsx)(`button`,{type:`button`,disabled:w,onClick:()=>void M(!0),className:`shrink-0 rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-2 text-xs text-blue-sky disabled:opacity-50`,children:d?`下载完整网页`:`Download website`}),(0,K.jsx)(`button`,{type:`button`,disabled:!m||w,onClick:()=>void M(),className:`rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-1.5 text-xs text-blue-sky transition-colors hover:bg-blue-deep/20 disabled:cursor-wait disabled:opacity-50`,children:l(w?`artifact.downloading`:`artifact.download`)}),(!r||E)&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(`artifact.close`),onClick:n,className:`rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink`,children:`×`})]}),(0,K.jsxs)(`div`,{className:r?`flex min-h-0 flex-1 flex-col overflow-auto bg-bg/40 p-2 sm:p-3`:A?`flex min-h-0 flex-1 flex-col overflow-hidden bg-bg/40`:`flex min-h-64 max-h-[72vh] flex-col overflow-x-hidden overflow-y-auto bg-bg/40 p-3 scroll-thin sm:p-4`,children:[!t&&r&&(0,K.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,children:(0,K.jsx)(ru,{children:r.summary})}),r&&e&&(()=>{let n=eu(r,i,t);return n?(0,K.jsx)(tu,{sid:e,change:n,zh:d},`${n.before}:${n.after}`):null})(),p.isLoading?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,p.isError?(0,K.jsxs)(`div`,{className:`m-auto text-sm text-err`,children:[l(`artifact.unavailable`),` · `,p.error.message]}):null,m?.why&&!h&&!g&&!A&&!r?(0,K.jsxs)(`div`,{className:`mb-3 rounded-md border border-line bg-surface px-3 py-2 text-xs text-ink-dim`,children:[(0,K.jsx)(`span`,{className:`mr-1 text-ink-faint`,children:`Reviewer:`}),m.why]}):null,m?.kind===`text`&&!_?(0,K.jsxs)(`pre`,{className:`min-h-52 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-bg p-4 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:[m.preview||l(`artifact.empty`),m.truncated?`\n\n… ${l(`artifact.truncated`)}`:``]}):null,m&&_?(0,K.jsxs)(`div`,{className:`min-h-52 overflow-auto rounded-lg border border-line bg-bg p-4 text-sm text-ink-dim scroll-thin`,children:[j&&(0,K.jsxs)(`div`,{className:`mb-4 border-b border-line pb-3 text-xs leading-5 text-ink-faint`,role:`status`,children:[s===`revising`?d?`正在根据这份意见修改论文,修改后的版本尚待复审。`:`The paper is being revised against this opinion; the revised version awaits review.`:s===`reviewing`?d?`Reviewer 正在更新本轮审稿意见,内容会自动刷新。`:`The Reviewer is updating this round’s opinion. This file refreshes automatically.`:d?`这是最近保存的审稿意见,文件更新后会自动刷新。`:`This is the latest saved review. Changes to this file appear automatically.`,m.mtime!=null&&(0,K.jsxs)(`div`,{children:[d?`最近更新:`:`Last updated: `,new Date(m.mtime*1e3).toLocaleString(u)]})]}),(0,K.jsx)(Ke,{sid:e,basePath:t||``,artifacts:[...c,...f.map(e=>({path:e.path})),...h?.sources??[],...h?.progress_source?[{path:h.progress_source.path}]:[]],onOpenArtifact:o,children:m.preview||l(`artifact.empty`)}),m.truncated?(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 border-t border-line pt-2 text-xs text-ink-faint`,children:[l(`artifact.truncated`),` · `,l(`artifact.downloadHint`)]}):null]}):null,m?.kind===`json`?(0,K.jsx)(cu,{value:m.preview||``}):null,m?.kind===`table`?(0,K.jsx)(lu,{value:m.preview||``,delimiter:m.name.endsWith(`.tsv`)?` `:`,`}):null,m?.kind===`html`?(0,K.jsx)(`div`,{className:`flex flex-1 overflow-hidden rounded-lg border border-line ${r?`min-h-0`:`min-h-[60vh]`}`,children:(0,K.jsx)(iu,{sid:e,path:t,html:m.preview||``,title:`HTML preview: ${m.name}`})}):null,m?.kind===`image`&&v?(0,K.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-bg/50`,children:(0,K.jsx)(`img`,{src:v,alt:m.why||m.name,className:`max-h-[62vh] max-w-full object-contain`})}):null,m?.kind===`pdf`&&v?(0,K.jsx)(_u,{src:v,name:m.name,className:`min-h-0 overflow-hidden`,onPageOrientation:k,onRetry:()=>C(e=>e+1)}):null,m?.kind===`audio`&&v?(0,K.jsx)(`div`,{className:`m-auto w-full max-w-xl`,children:(0,K.jsx)(`audio`,{controls:!0,preload:`metadata`,src:v,className:`w-full`})}):null,m?.kind===`video`&&v?(0,K.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-black`,children:(0,K.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:v,className:`max-h-[62vh] max-w-full`})}):null,m&&[`image`,`pdf`,`audio`,`video`].includes(m.kind)&&!v&&!b?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,m?.kind===`binary`?(0,K.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,K.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-ink-dim`,children:l(`artifact.noPreview`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:l(`artifact.downloadHint`)})]}):null,b?(0,K.jsx)(`div`,{className:`mt-3 text-center text-xs text-err`,children:b}):null]})]})}var xu=[{label:[`从头讲清楚`,`Explain from the beginning`],question:[`请从头讲清楚这份说明。先用日常语言解释它在讨论什么、要判断什么,再按需要解释其中的对象和符号。涉及比较或公式时,请明确两边是什么、哪些条件下能比较,并用一个可复算的小例子说明。请分别说明标准背景知识、本次已有证据和仍未知的内容。`,`Explain this reading from the beginning using everyday language. Start with what it discusses and what we are trying to determine, then explain the necessary objects and symbols. For a comparison or formula, define both sides and when the comparison is valid, and work a small example I can recompute. Distinguish standard background, evidence from this run, and what remains unknown.`]},{label:[`带我算一遍`,`Work through an example`],question:[`请带我实际算一遍这份说明中的关键一步。先解释对象、输入和运算规则,再用一组明确标为教学例子的小数据展示中间步骤与结果,然后换一个输入让我能照着计算。请说明它怎样关系到正在判断的结论,以及这个例子还不能证明什么。`,`Walk me through the key operation in this reading. Explain the objects, inputs, and rules, then use a small example clearly labeled as a teaching example to show the intermediate steps and result. Change one input and work it again so I can follow the calculation. Explain how it relates to the conclusion being assessed and what the example does not prove.`]},{label:[`这说明了什么`,`What does this establish?`],question:[`这份说明究竟支持什么结论?请用我能懂的语言解释已经验证的部分、依赖的条件、未覆盖的情况,以及它和整个任务目标的关系。解释必要概念,并指出哪些只是记录中的说法、哪些有可核对的依据。`,`What conclusion does this reading support? Explain the part that has been checked, its assumptions, the cases it does not cover, and how it relates to the overall task. Explain the necessary concepts and distinguish reported claims from conclusions with verifiable supporting evidence.`]}];function Su({draft:e,onChange:t,onSubmit:n,disabled:r,children:i}){let a=F().locale===`zh-CN`,o=!!e.parentId||!!e.progressSource,s=(0,U.useRef)(null);return(0,K.jsxs)(K.Fragment,{children:[i,o&&!e.question.trim()?(0,K.jsxs)(`div`,{className:`mb-3 space-y-2`,"data-reading-question-suggestions":!0,children:[(0,K.jsx)(`p`,{className:`text-xs text-ink-dim`,children:a?`可以从这些问题开始,也可以直接输入。`:`Start with one of these questions, or write your own.`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:xu.map(n=>(0,K.jsx)(B,{type:`button`,className:`text-xs`,disabled:r,onClick:()=>{t({...e,question:n.question[+!a]}),s.current?.focus()},children:n.label[+!a]},n.label[1]))})]}):null,(0,K.jsx)(`textarea`,{ref:s,"aria-label":a?`想理解的问题`:`Question to understand`,className:`min-h-40 w-full rounded-lg border border-line bg-bg p-3 text-sm leading-6 text-ink`,maxLength:8e3,value:e.question,onChange:n=>t({...e,question:n.target.value})}),e.sourceTitle?(0,K.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[a?`从这项任务打开:`:`Opened from this task: `,e.sourceTitle]}):null,(0,K.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,K.jsx)(B,{"data-reading-submit":!0,disabled:!e.question.trim()||r,onClick:n,children:o?a?`提问`:`Ask question`:a?`生成并保存基础说明`:`Generate and save foundations`})})]})}var Cu=[1,0],wu=[{id:`up`,vector:[0,1],zh:`向上 1 格`,en:`Up 1 square`},{id:`right`,vector:[2,0],zh:`向右 2 格`,en:`Right 2 squares`},{id:`fraction`,vector:[1.5,0],zh:`向右 1.5 格`,en:`Right 1.5 squares`},{id:`zero`,vector:[0,0],zh:`留在原点`,en:`Stay at the origin`}];function Tu(e,t){return e[0]*t[1]-e[1]*t[0]===0?e.some(Boolean)||t.some(Boolean)?1:0:2}function Eu(e){if(!e)return!1;let t=[e.name,e.explanation,e.example,e.connection].join(` `);return/独立(?:的)?方向|线性(?:无关|独立)|independent\s+directions?\b|linear\s+independence\b|linearly\s+independent\b/iu.test(t)}function Du(){let{locale:e}=F(),t=e===`zh-CN`,n=(e,n)=>t?e:n,[r,i]=(0,U.useState)(wu[0]),a=(0,U.useId)(),o=r.vector,s=Tu(Cu,o),c=e=>62+e*36,l=e=>116-e*36,u=r.id===`up`?n(`只沿 A 左右移动,走不到 B 的终点;B 补上了上下方向。`,`Moving left or right along A cannot reach B’s endpoint. B adds an up-and-down direction.`):r.id===`right`?n(`走两次 A 就能代替 B。步子更长,并没有增加独立方向。`,`Two copies of A replace B. A longer step does not add an independent direction.`):r.id===`fraction`?n(`走两次 B 和走三次 A,都向右走了 3 格。虽然两者互相都不是整数倍,仍只有一个独立方向。`,`Two copies of B and three copies of A both move 3 squares right. Neither is an integer multiple of the other, but they still provide only one independent direction.`):n(`B 没有移动,没有增加方向;A 仍提供一个独立方向。`,`B does not move, so it adds no direction. A still provides one independent direction.`),d=n(`这两支箭头提供 ${s} 个独立方向`,`These two arrows provide ${s} independent direction${s===1?``:`s`}`);return(0,K.jsxs)(`section`,{className:`my-2 rounded-lg border border-line bg-surface p-3`,"aria-label":n(`平面上的独立方向示意`,`Independent directions in a plane`),"data-testid":`direction-example`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:n(`A 固定向右走 1 格。改变 B,看看它是否提供新的走法。允许把箭头缩放、反向,再相加。`,`A always moves 1 square right. Change B to see whether it adds a new way to move. Arrows may be scaled, reversed, and added.`)}),(0,K.jsxs)(`svg`,{viewBox:`0 0 210 180`,className:`mx-auto my-2 block w-full max-w-[260px]`,role:`img`,"aria-labelledby":`${a}-title ${a}-desc`,children:[(0,K.jsx)(`title`,{id:`${a}-title`,children:d}),(0,K.jsx)(`desc`,{id:`${a}-desc`,children:`A = (1, 0), B = (${o[0]}, ${o[1]}). ${u}`}),(0,K.jsxs)(`defs`,{children:[(0,K.jsx)(`marker`,{id:`${a}-a`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,K.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:R.accent})}),(0,K.jsx)(`marker`,{id:`${a}-b`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,K.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:R.success})})]}),(0,K.jsx)(`rect`,{x:`20`,y:`32`,width:`165`,height:`125`,rx:`4`,fill:R.accent,opacity:s===2?.07:0}),[-1,0,1,2,3].map(e=>(0,K.jsx)(`line`,{x1:c(e),x2:c(e),y1:`32`,y2:`157`,stroke:`rgb(var(--line))`},`x${e}`)),[-1,0,1,2].map(e=>(0,K.jsx)(`line`,{y1:l(e),y2:l(e),x1:`20`,x2:`185`,stroke:`rgb(var(--line))`},`y${e}`)),s===1?(0,K.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:R.accent,strokeWidth:`10`,opacity:`.09`}):null,(0,K.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:R.inkFaint}),(0,K.jsx)(`line`,{x1:c(0),x2:c(0),y1:`32`,y2:`157`,stroke:R.inkFaint}),[0,1,2,3].map(e=>(0,K.jsx)(`text`,{x:c(e)-3,y:l(0)+14,fill:R.inkFaint,fontSize:`9`,children:e},e)),r.id===`zero`?(0,K.jsx)(`circle`,{cx:c(0),cy:l(0),r:`5`,fill:`rgb(var(--surface))`,stroke:R.success,strokeWidth:`3`,"data-testid":`direction-b-zero`}):(0,K.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(o[0]),y2:l(o[1]),stroke:R.success,strokeWidth:`3`,markerEnd:`url(#${a}-b)`,"data-testid":`direction-b`}),(0,K.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(Cu[0]),y2:l(Cu[1]),stroke:R.accent,strokeWidth:`3`,markerEnd:`url(#${a}-a)`}),(0,K.jsx)(`text`,{x:c(Cu[0])+3,y:l(Cu[1])-10,fill:R.accent,fontSize:`12`,fontWeight:`600`,children:`A`}),(0,K.jsx)(`text`,{x:c(o[0])+(r.id===`zero`?-17:8),y:l(o[1])+(r.id===`up`?-3:28),fill:R.success,fontSize:`12`,fontWeight:`600`,children:`B`})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,role:`group`,"aria-label":n(`选择 B 的走法`,`Choose B’s movement`),children:wu.map(e=>(0,K.jsx)(B,{className:`text-[11px]`,variant:r.id===e.id?`primary`:`ghost`,"aria-pressed":r.id===e.id,onClick:()=>i(e),"data-choice":e.id,children:t?e.zh:e.en},e.id))}),(0,K.jsxs)(`div`,{className:`mt-3`,"aria-live":`polite`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium text-ink`,"data-testid":`direction-count`,children:d}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:u})]}),(0,K.jsx)(`p`,{className:`mt-3 border-t border-line pt-2 text-[11px] leading-5 text-ink-faint`,children:n(`这里只统计这两支箭头提供的方向。找到一些独立方向,不等于已经找全研究对象的所有方向;图里的数字不能用来计算曲面的 Picard 数,也不能证明研究中的条件。`,`This counts only the directions supplied by these two arrows. Finding some independent directions does not establish that they span the whole research object. These numbers cannot determine a surface’s Picard number or prove the conditions used in the research.`)})]})}function Ou({path:e,identity:t,artifacts:n,onOpenArtifact:r}){let{locale:i}=F(),a=i===`zh-CN`,o={artifacts:n,onOpenArtifact:r};return(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-learning-path":t,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`理解这个问题`:`Understand the question`}),(0,K.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-question":!0,children:(0,K.jsx)(Ke,{...o,children:e.question})}),(0,K.jsx)(`ol`,{className:`mt-4 grid list-none gap-5 p-0`,children:e.steps.map((e,n)=>(0,K.jsxs)(`li`,{className:`min-w-0 border-t border-line/50 pt-3`,"data-learning-step":n+1,children:[(0,K.jsxs)(`h4`,{className:`mb-2 text-sm font-medium text-ink`,children:[(0,K.jsxs)(`span`,{className:`mr-2 text-ink-faint`,children:[n+1,`.`]}),e.title]}),(0,K.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-explanation":!0,children:(0,K.jsx)(Ke,{...o,children:e.explanation})}),(0,K.jsxs)(`div`,{className:`mt-3 border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-learning-example":!0,children:[(0,K.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`例子`:`Example`}),(0,K.jsx)(Ke,{...o,children:e.example})]}),(0,K.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,"data-learning-check":!0,children:[(0,K.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`小问题`:`Try it`}),(0,K.jsx)(`div`,{"data-learning-check-question":!0,children:(0,K.jsx)(Ke,{...o,children:e.check.question})}),(0,K.jsx)(nt,{label:a?`点击看解答`:`Show the answer`,children:(0,K.jsx)(`div`,{"data-learning-check-answer":!0,children:(0,K.jsx)(Ke,{...o,children:e.check.answer})})},`${e.check.question}:${e.check.answer}`)]})]},`${t}:${n}`))})]})}var ku=0,Au=(e,t,n=0)=>[`explanation-progress`,...e,t,n];function ju(e,t,n=0){return t?[t.id,`${t.id}:active`,`${t.id}:outcome`].includes(e??``)?typeof t.started_ts==`number`&&Number.isFinite(t.started_ts)&&t.started_ts>=0?t.started_ts:n:0:n}function Mu(e,t,n){let r=++ku,i=n.map(e=>Au(t,e.key,e.startedAt));for(let t of i)e.setQueryData(t,{requestId:r,phase:null});return{update:t=>{for(let n of i)e.setQueryData(n,e=>e?.requestId===r?{requestId:r,phase:t}:e)},finish:()=>{for(let t of i)e.setQueryData(t,e=>e?.requestId===r?null:e)}}}function Nu(e,t,n=0){let r=x({queryKey:Au(e,t??``,n),queryFn:async()=>null,initialData:null,enabled:!1,staleTime:1/0,gcTime:72e5});return{active:!!r.data,phase:r.data?.phase??void 0}}function Pu(e,t){return e?{waiting_for_source:[`等待开始整理说明`,`Waiting to prepare the explanation`],planning:[`正在梳理概念与讲解顺序`,`Organizing the concepts and explanation`],writing:[`正在撰写说明`,`Writing the explanation`],reviewing:[`正在核对说明与来源`,`Checking the explanation against its sources`]}[e][+!t]:t?`正在整理说明`:`Preparing an explanation`}function Fu({value:e,expandLabel:t,clamp:n=!0}){let[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(null),{locale:c}=F();return(0,U.useEffect)(()=>{let e=s.current;if(!e||!n||r)return;let t=()=>o(e.scrollHeight>e.clientHeight+1);t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,n,r]),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{ref:s,className:`text-[13px] leading-6 text-ink-dim ${!n||r?``:`line-clamp-3`}`,children:(0,K.jsx)(Ke,{children:e})}),n&&(a||r)?(0,K.jsxs)(`button`,{type:`button`,className:`mt-0.5 text-xs text-blue-sky hover:underline`,onClick:()=>i(!r),"aria-expanded":r,children:[r?c===`zh-CN`?`收起`:`Show less`:t,(0,K.jsx)(Me,{size:11,className:`ml-1 inline ${r?`rotate-180`:``}`})]}):null]})}function Iu({generatedAt:e,pending:t=!1,generating:n=!1,phase:r,hasExplanation:i=!1,error:a,unavailable:o=!1,retry:s,retryDisabled:c=!1}){let{locale:l}=F(),u=l===`zh-CN`,d=ft({ts:e}),f=d?.toLocaleString(l,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,p=!!a||o;return!(i&&(f||t))&&!n&&!p?null:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,"data-testid":`research-brief-status`,children:[i&&(f||t)?(0,K.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,children:[t?`${u?`上次说明`:`Previous explanation`}${f||!p?` · `:``}`:``,f?(0,K.jsx)(`time`,{dateTime:d?.toISOString(),title:d?.toLocaleString(l),children:f}):null,t&&!p?`${f?` · `:``}${u?`待更新`:`update pending`}`:``]}):null,p?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:a?u?`说明生成未完成;不会自动重复请求。`:`The explanation could not be prepared. This request will not be repeated automatically.`:u?`说明暂未更新;可以手动重试。`:`The explanation has not been updated yet. You can retry manually.`}),s?(0,K.jsxs)(B,{className:`inline-flex items-center gap-1 text-xs`,disabled:n||c,onClick:()=>void s(),children:[(0,K.jsx)(Pe,{size:12}),u?`重试`:`Retry`]}):null]}):n?(0,K.jsxs)(`span`,{role:`status`,"data-explanation-phase":r??`pending`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint`,children:[(0,K.jsx)(Ue,{}),Pu(r,u)]}):null]})}function Lu({brief:e,identity:t,detail:n,learningPath:r,foundation:i,readingUnavailable:a=!1,teachingUnavailable:o=!1,artifacts:s,onOpenArtifact:c}){let{locale:l}=F(),u=l===`zh-CN`,d=(e,t)=>u?e:t;return(0,K.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-4`,"data-reader-explanation":t,children:[i?(0,K.jsxs)(`div`,{className:`rounded border border-line/60 p-2 text-xs text-ink-dim`,"data-foundation-id":i.id,children:[(0,K.jsxs)(`p`,{children:[d(`这次进展参考的基础说明:`,`Foundations used to explain this progress: `),i.question]}),c?(0,K.jsx)(B,{className:`mt-1 text-xs`,onClick:()=>c(i.path),children:d(`阅读这份基础说明`,`Read these foundations`)}):null]}):null,a?(0,K.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`阅读说明还需要核对,可以继续问这一步。`,`The reading explanation still needs checking. You can keep asking about this step.`)}):o?(0,K.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`这个概念的说明还没核对清楚,可以继续问这一步。`,`The explanation of this concept has not been checked clearly yet. You can keep asking about this step.`)}):null,r?(0,K.jsx)(Ou,{path:r,identity:t,artifacts:s,onOpenArtifact:c},t):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-why":t,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`这一步为什么有用`,`Why this step helps`)}),(0,K.jsx)(Fu,{value:e.why,expandLabel:d(`完整说明`,`Full explanation`),clamp:!1},`why:${t}`)]}),e.concept?(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-teaching":t,children:[(0,K.jsxs)(`h3`,{className:`mb-3 text-xs font-medium text-ink`,children:[d(`认识一个概念`,`One useful concept`),` · `,e.concept.name]}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3`,"data-reader-teaching-columns":t,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,"data-reader-definition":t,children:[(0,K.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`定义`,`Definition`)}),(0,K.jsx)(Fu,{value:e.concept.explanation,expandLabel:d(`完整定义`,`Full definition`),clamp:!1},`concept:${t}:${e.concept.name}`)]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-testid":`concept-example`,children:[(0,K.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`例子`,`Example`)}),(0,K.jsx)(Ke,{artifacts:s,onOpenArtifact:c,children:e.concept.example})]}),Eu(e.concept)?(0,K.jsx)(nt,{label:d(`动手看两个方向`,`Try two directions`),children:(0,K.jsx)(Du,{})}):null]}),(0,K.jsxs)(`div`,{className:`min-w-0`,"data-reader-connection":t,children:[(0,K.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`与本步的关系`,`Connection to this step`)}),(0,K.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,children:(0,K.jsx)(Ke,{artifacts:s,onOpenArtifact:c,children:e.concept.connection})})]})]})]}):null]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`结论到哪里为止`,`What this does and does not establish`)}),(0,K.jsx)(Fu,{value:e.scope,expandLabel:d(`完整适用范围`,`Full scope`),clamp:!1},`scope:${t}`)]}),(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-next-interpretation":t,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`解说对后续的理解`,`How the explanation interprets the follow-up`)}),(0,K.jsx)(Fu,{value:e.next,expandLabel:d(`完整解读`,`Full interpretation`),clamp:!1},`next:${t}`)]}),n?(0,K.jsx)(nt,{className:`min-w-0`,label:d(`详细说明与条件`,`Detailed explanation and conditions`),children:(0,K.jsx)(`div`,{className:`macro-reader-markdown text-[13px] leading-6 text-ink-dim`,children:(0,K.jsx)(Ke,{artifacts:s,onOpenArtifact:c,children:n})})},`detail:${t}`):null]})}function Ru(e){if(!e||typeof e!=`object`)return!1;let t=e;return[`source_id`,`title`,`path`,`task_id`,`card_key`].every(e=>typeof t[e]==`string`&&String(t[e]).trim())&&Number.isFinite(t.generated_at)&&t.generated_at>=0&&Number.isSafeInteger(t.copy_revision)&&t.copy_revision>=0}var zu=(e,t)=>[`reader-foundation-choice`,e,t],Bu=(e,t)=>`argus:reader-foundation:${e}:${t}`,Vu=e=>[`artifacts`,e,`reader`],Hu=(e,t)=>[`reader-foundation-request`,e,t],Uu=(e,t)=>`${Bu(e,t)}:request`;function Wu(e,t){let n=gt(Bu(e,t));if(!n)return{id:null,choice:0};try{let e=JSON.parse(n);if((typeof e?.id==`string`||e?.id===null)&&Number.isSafeInteger(e.choice)&&e.choice>=0)return e}catch{}return{id:n,choice:0}}function Gu(e,t){try{let n=JSON.parse(gt(Uu(e,t))||`null`);return typeof n?.id==`string`&&typeof n.draft?.question==`string`&&typeof n.beforeChoice==`number`?n:null}catch{return null}}function Ku(e,t,n,r){e.setQueryData(Hu(t,n),r),ht(Uu(t,n),JSON.stringify(r))}function qu(e,t,n,r){let i=e.getQueryData(Hu(t,n)),a=Gu(t,n);i?.id===r&&(!a||a.id===r)&&Ku(e,t,n,null)}function Ju(e,t){return x({queryKey:Hu(e,t),queryFn:b,enabled:!1,initialData:()=>Gu(e,t),staleTime:1/0,gcTime:1/0}).data??null}function Yu(e,t,n,r){let i={id:r,choice:Xu(e,t,n).choice+1};return e.setQueryData(zu(t,n),i),ht(Bu(t,n),JSON.stringify(i)),i}function Xu(e,t,n){let r=e.getQueryData(zu(t,n)),i=Wu(t,n);return r&&r.choice>=i.choice?r:i}function Zu(e,t){return x({queryKey:zu(e,t),queryFn:b,enabled:!1,initialData:()=>Wu(e,t),staleTime:1/0,gcTime:1/0}).data}function Qu(e,t=ne()===`question-foundation`){return x({queryKey:Vu(e),queryFn:async({signal:t})=>(await P.artifacts(e,t,!0)).filter(e=>e.source===`reader_foundation`),enabled:!!e&&t,refetchInterval:e=>e.state.data?.some(e=>e.reader_foundation?.state===`generating`)?5e3:!1,retry:!1,refetchOnWindowFocus:!1})}function $u(e){let t=e.reader_foundation;return!!t&&(t.kind??`foundation`)===`foundation`&&!t.parent_id&&!t.progress_source}function ed(e,t,n=!0){let r=S(),i=Qu(e,n),a=Ju(e,t),o=[`reader-foundation-create`,e,t],s=w({filters:{mutationKey:o,status:`pending`},select:e=>e.state.variables?.id}),c=Nu(o,s.at(-1)??a?.id),l=n=>({sid:n.sid??e,locale:n.locale??t}),u=C({mutationKey:o,mutationFn:async e=>{let t=l(e),n=Mu(r,[`reader-foundation-create`,t.sid,t.locale],[{key:e.id}]);try{let r={request_id:e.id,question:e.draft.question.trim(),locale:t.locale},i=e.draft.parentId?await P.askReaderFoundation(t.sid,e.draft.parentId,r,n.update):await P.generateReaderFoundation(t.sid,{...r,...e.draft.progressSource?{progress_source:{source_id:e.draft.progressSource.source_id}}:e.draft.sourceTaskId?{source_task_id:e.draft.sourceTaskId}:{}},n.update),a=i.reader_foundation;if(a?.id!==e.id||a.locale!==t.locale)throw Error(t.locale===`zh-CN`?`说明请求的结果尚未确认。`:`The result of this explanation request is unconfirmed.`);if(e.draft.parentId&&(a.kind!==`clarification`||a.parent_id!==e.draft.parentId))throw Error(t.locale===`zh-CN`?`追问与来源说明的对应关系尚未确认。`:`The question’s connection to its source is unconfirmed.`);if(e.draft.progressSource&&(a.progress_source?.source_id!==e.draft.progressSource.source_id||!e.draft.parentId&&a.kind!==`progress_answer`))throw Error(t.locale===`zh-CN`?`回答与这版进展说明的对应关系尚未确认。`:`The answer’s connection to this progress explanation is unconfirmed.`);return i}finally{n.finish(),await r.invalidateQueries({queryKey:Vu(t.sid)})}},onSuccess:(e,t)=>{let n=l(t);!t.draft.parentId&&!t.draft.progressSource&&$u(e)&&e.exists&&e.reader_foundation?.state===`complete`&&Xu(r,n.sid,n.locale).choice===t.beforeChoice&&Yu(r,n.sid,n.locale,e.reader_foundation.id),r.setQueryData(Vu(n.sid),t=>{let n=t?.find(t=>t.path===e.path);return n&&n.reader_foundation?.state!==`generating`&&e.reader_foundation?.state===`generating`?t:[...(t??[]).filter(t=>t.path!==e.path),e]}),t.draft.progressSource||r.invalidateQueries({queryKey:[`map-copy`,`project`,n.sid]})},onError:(e,t)=>{if(e instanceof j&&e.code===`reader_source_unavailable`){let e=l(t);Ku(r,e.sid,e.locale,{...t,rejected:`reader_source_unavailable`})}},retry:!1}),d=(i.data??[]).filter(e=>e.reader_foundation?.locale===t),f=d.some(e=>e.reader_foundation?.state===`generating`),p=d.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),m=u.variables&&l(u.variables),h=m?.sid===e&&m.locale===t,g=h&&u.isPending||s.length>0||c.active,_=a?.id??(h?u.variables?.id:void 0),v=d.find(e=>e.reader_foundation?.id===_),y=v?.reader_foundation?.state===`failed`,b=v?.reader_foundation?.state===`complete`,x=a?.rejected===`reader_source_unavailable`,T=!!a&&!x&&!v&&!g,E=g||f||!!a&&!x||i.isPending||i.isError;return(0,U.useEffect)(()=>{a&&(y||b)&&qu(r,e,t,a.id)},[r,e,t,a,y,b]),{client:r,list:i,notes:d,pendingRequest:a,progress:c,generation:u,waiting:f,overdue:p,creating:g,requested:v,confirmedFailure:y,confirmedComplete:b,requestRejected:x,unknownResult:T,creationBlocked:E,submit:n=>{if(!n.question.trim()||E)return null;let i=crypto.randomUUID(),a={id:i,sid:e,locale:t,draft:{...n,...n.progressSource?{progressSource:{...n.progressSource}}:{}},beforeChoice:Xu(r,e,t).choice};return Ku(r,e,t,a),u.mutate(a),i},retrySavedRequest:n=>u.mutate({...n,sid:n.sid??e,locale:n.locale??t})}}var td=(0,U.createContext)(null);function nd({card:e,cardKey:t,taskId:n,readOnly:r=!1,context:i}){let a=(0,U.useContext)(td),o=F().locale===`zh-CN`,[s,c]=(0,U.useState)(`idle`),[l,u]=(0,U.useState)(!1),d=(0,U.useRef)(0),f=i??a?.context,p=JSON.stringify([a?.sid,a?.readOnly,r,f,t,n,e?.copy_revision,e?.generated_at,e?.title]),m=(0,U.useRef)(p);if(m.current=p,(0,U.useEffect)(()=>(c(`idle`),()=>{d.current+=1}),[p]),!a?.sid||a.readOnly||r)return null;let h=!!e&&Number.isSafeInteger(e.copy_revision)&&!!e.title?.trim()&&!(f?.preview===`question-foundation`&&!f.foundationId),g=async()=>{if(!h||!f||s===`opening`)return;let r=++d.current;c(`opening`);try{let i=await a.source(t,n,f);if(r!==d.current||m.current!==p)return;if(i&&(i.copy_revision!==e.copy_revision||i.generated_at!==e.generated_at||i.title!==e.title))throw new j(`The selected explanation has changed.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);c(`idle`),i&&a.open(i)}catch(e){r===d.current&&m.current===p&&(u(e instanceof j&&e.code===`reader_source_unavailable`),c(`failed`))}};return(0,K.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-1`,children:[(0,K.jsxs)(B,{className:`inline-flex items-center gap-1 text-xs`,disabled:!h||s===`opening`,title:h?void 0:o?`这一步的说明写好后就可以提问。`:`Questions open once this step has an explanation.`,"data-testid":`progress-question-trigger`,"data-progress-question-card":t,"data-progress-question-state":s,onClick:()=>void g(),children:[(0,K.jsx)(Ut,{size:12}),o?`问这一步`:`Ask about this step`]}),s===`failed`?(0,K.jsx)(`span`,{role:`alert`,className:`text-xs text-ink-dim`,children:l?o?`这版说明暂不可用或已变化,未打开提问。请刷新页面后再试。`:`This explanation is unavailable or has changed. No question was opened. Reload this page and try again.`:o?`暂时无法读取这一步的提问材料,未打开提问。请再试一次。`:`The question material could not be loaded. No question was opened. Please try again.`}):null]})}function rd({sid:e,path:t,artifacts:n,onOpenArtifact:r}){let i=F().locale===`zh-CN`,a=x({queryKey:[`reading-question-artifact`,e,t],queryFn:async({signal:n})=>{let r=await P.artifact(e,t,n);if(r.exists&&r.path===t&&(r.truncated||typeof r.preview!=`string`)){let i=await P.artifactBlob(e,t,!1,n);return{...r,preview:await i.text(),truncated:!1}}return r},retry:!1,staleTime:1/0,refetchOnWindowFocus:!1});return a.isPending?(0,K.jsx)(`p`,{className:`text-xs text-ink-faint`,children:i?`正在读取保存内容…`:`Loading saved reading…`}):a.isError||!a.data?.exists||a.data.path!==t?(0,K.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[i?`保存内容暂时无法读取。`:`The saved reading could not be loaded.`,(0,K.jsx)(B,{className:`ml-2 text-xs`,onClick:()=>void a.refetch(),children:i?`重新读取`:`Reload`})]}):(0,K.jsxs)(`div`,{className:`min-w-0 max-w-full overflow-x-auto break-words`,"data-reading-artifact-path":t,children:[(0,K.jsx)(Ke,{artifacts:[...n,...a.data.reader_foundation?.sources??[]],onOpenArtifact:r,children:a.data.preview??``}),a.data.truncated?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`此处显示保存内容的节选。`:`This view shows an excerpt of the saved reading.`}):null]})}function id({sid:e,readOnly:t=!1,children:n}){let r=F().locale,i=r===`zh-CN`?`zh-CN`:`en-US`,a=i===`zh-CN`,o=ed(e??``,i,!!e),s=Zu(e??``,i).id,c=(0,U.useRef)(0),l=async(t,n,r)=>{let i=++c.current,{preview:a,foundationId:o,locale:s}=r,l=await P.mapQuestionSource(e??``,{card_key:t,task_id:n,locale:s,...a?{preview:a}:{},...a===`question-foundation`&&o?{foundation_id:o}:{}});if(i!==c.current)return null;if(!Ru(l)||l.card_key!==t||l.task_id!==n||!l.path.startsWith(`reader-progress/${e}/`))throw new j(`The reading source does not match this step.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);return l},[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(null);(0,U.useEffect)(()=>(d(null),p(null),h(null),_(!1),y(null),()=>{c.current+=1}),[e,i]);let b=u&&u.sid===e&&u.locale===i?u:null,x=b?.source,S=o.notes.filter(e=>Ru(e.reader_foundation?.progress_source)),C=o.pendingRequest?.draft.progressSource?o.pendingRequest:null,w=new Map;for(let t of S){let n=t.reader_foundation.progress_source;n.path.startsWith(`reader-progress/${e}/`)&&w.set(n.source_id,n)}C?.draft.progressSource&&w.set(C.draft.progressSource.source_id,C.draft.progressSource),x&&w.set(x.source_id,x);let T=[...o.list.data??[],...[...w.values()].map(e=>({path:e.path}))],E=e=>{e===x?.path?(_(!0),y(null)):y(e)},D=x?S.filter(e=>e.reader_foundation.progress_source.source_id===x.source_id):[],O=D.find(e=>e.reader_foundation?.id===m),k=O?.exists&&O.reader_foundation?.state===`complete`,A=C?.draft.progressSource?.source_id===x?.source_id?C:null,M=A?D.find(e=>e.reader_foundation?.id===A.id):void 0,N=!!A&&A.rejected===`reader_source_unavailable`,I=!!A&&!N&&!M&&!o.creating,ee=n=>{c.current+=1;let r=n??C?.draft.progressSource??[...w.values()].at(-1);if(!e||!Ru(r)||!r.path.startsWith(`reader-progress/${e}/`))return;d({sid:e,locale:i,source:{...r}}),_(!1),y(null);let a=S.filter(e=>e.reader_foundation?.progress_source?.source_id===r.source_id).at(-1);h(a?.reader_foundation?.id??null),p(n&&!t?{question:``,progressSource:{...r}}:null)},te=()=>{d(null),p(null),h(null),_(!1),y(null)},L=t=>{e&&(d({sid:e,locale:i,source:{...t}}),h(null),_(!1),y(null),p(e=>e?{question:e.question,progressSource:{...t}}:null))},re=()=>{if(t||!b||!f?.progressSource||f.progressSource.source_id!==b.source.source_id||f.parentId&&!D.some(e=>e.reader_foundation?.id===f.parentId&&e.exists&&e.reader_foundation?.state===`complete`))return;let e=o.submit(f);e&&(h(e),p(null))},ie=!!A&&o.creating||D.some(e=>e.reader_foundation?.state===`generating`);return(0,K.jsxs)(td.Provider,{value:{sid:e??``,readOnly:t,hasHistory:w.size>0,open:ee,source:l,context:{locale:i,preview:ne(),foundationId:s}},children:[n,(0,K.jsx)(tt,{open:!!b,onClose:te,label:a?`进展阅读问答`:`Questions about this progress`,children:b&&x?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Qe,{title:a?`哪里还不明白`:`What is still unclear`,sub:x.title}),(0,K.jsxs)(`div`,{className:`space-y-4 px-6 pb-6`,"data-testid":`progress-questions`,"data-project-id":b.sid,"data-progress-source-id":x.source_id,"data-progress-source-title":x.title,"data-reader-card":x.card_key,"data-reader-task-id":x.task_id,children:[(0,K.jsxs)(`div`,{className:`rounded-lg border border-line/70 p-3 text-xs text-ink-dim`,children:[(0,K.jsxs)(`p`,{children:[a?`引用打开提问时的这版说明:`:`Using the explanation selected when this question was opened: `,x.title]}),(0,K.jsx)(`time`,{dateTime:new Date(x.generated_at*1e3).toISOString(),className:`mt-1 block text-ink-faint`,children:new Date(x.generated_at*1e3).toLocaleString(r)}),(0,K.jsx)(B,{className:`mt-2 text-xs`,"data-reading-source-path":x.path,onClick:()=>_(e=>!e),children:g?a?`收起原说明`:`Hide original explanation`:a?`阅读当时说明`:`Read the original explanation`}),g?(0,K.jsx)(`div`,{className:`mt-3 text-[13px] leading-6`,children:(0,K.jsx)(rd,{sid:b.sid,path:x.path,artifacts:T,onOpenArtifact:E})}):null]}),w.size>1?(0,K.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`查看已保存的进展问答`:`Saved progress questions`,(0,K.jsx)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:x.source_id,disabled:o.creating,onChange:e=>{let t=w.get(e.target.value);t&&L(t)},children:[...w.values()].map(e=>(0,K.jsxs)(`option`,{value:e.source_id,children:[e.title,` · `,new Date(e.generated_at*1e3).toLocaleString(r)]},e.source_id))})]}):null,D.length?(0,K.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`已保存的问题`:`Saved questions`,(0,K.jsxs)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:m??``,onChange:e=>{h(e.target.value||null),y(null)},children:[(0,K.jsx)(`option`,{value:``,children:a?`选择一个问题`:`Choose a question`}),D.map(e=>(0,K.jsx)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,children:yu(e.reader_foundation)},e.path))]})]}):null,O?(0,K.jsxs)(`section`,{className:`space-y-3 text-[13px] leading-6`,"data-reading-question-id":O.reader_foundation.id,children:[k?(0,K.jsx)(nt,{label:a?`查看这次问题`:`View this question`,children:(0,K.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-ink-dim`,children:O.reader_foundation.question})},O.reader_foundation.id):(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words font-medium`,children:O.reader_foundation.question}),k?(0,K.jsx)(rd,{sid:b.sid,path:O.path,artifacts:T,onOpenArtifact:E}):(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:O.reader_foundation.state===`generating`?a?`回答仍在整理,尚未确认结束。`:`The answer is still being prepared; completion is unconfirmed.`:a?`这次回答未完成,原问题已保留。`:`This answer did not finish; its question is retained.`}),!t&&O.exists&&O.reader_foundation.state===`complete`?(0,K.jsx)(B,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x},parentId:O.reader_foundation.id,parentTitle:yu(O.reader_foundation)}),children:a?`继续问这份回答`:`Ask a follow-up to this answer`}):null,!t&&O.reader_foundation.state===`failed`?(0,K.jsx)(B,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:O.reader_foundation.question,progressSource:{...x},parentId:O.reader_foundation.parent_id??void 0}),children:a?`重新编辑问题`:`Edit this question`}):null]}):null,v?(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border border-line/70 p-3 text-[13px] leading-6`,"data-referenced-reading-path":v,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-ink-faint`,children:[(0,K.jsx)(`span`,{children:a?`引用的保存内容`:`Referenced saved reading`}),(0,K.jsx)(B,{className:`text-xs`,onClick:()=>y(null),children:a?`收起引用`:`Close referenced reading`})]}),(0,K.jsx)(rd,{sid:b.sid,path:v,artifacts:T,onOpenArtifact:E})]}):null,ie?(0,K.jsx)(Iu,{generating:!0,phase:A?o.progress.phase:void 0}):null,A?(0,K.jsxs)(`div`,{className:`space-y-2 text-xs text-ink-faint`,"data-pending-reading-question":A.id,children:[(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:A.draft.question}),N?(0,K.jsx)(`p`,{role:`status`,children:a?`引用的说明目前不可用,这次追问未发起。问题与原来源已保留。`:`The reading source is unavailable, so this question was not started. Its question and original source are saved.`}):I?(0,K.jsx)(`p`,{role:`status`,children:a?`这次请求的结果尚未确认;刷新不会重新生成。`:`The result of this request is unconfirmed. Refreshing does not generate it again.`}):null,!t&&!o.creating&&!o.waiting?(0,K.jsx)(B,{className:`text-xs`,onClick:()=>{N?(p({...A.draft}),o.generation.reset()):o.retrySavedRequest(A)},children:N?a?`编辑问题与来源`:`Edit question and source`:a?`重试同一请求`:`Retry this same request`}):null]}):C&&o.creationBlocked?(0,K.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`另一个阅读请求尚未结束。`:`Another reading request is still unresolved.`,(0,K.jsx)(B,{className:`ml-2 text-xs`,onClick:()=>ee(),children:a?`查看原问题`:`View the original question`})]}):null,o.list.isError?(0,K.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`保存的问答暂时读取失败。`:`Saved questions could not be loaded.`,(0,K.jsx)(B,{className:`ml-2 text-xs`,onClick:()=>void o.list.refetch(),children:a?`重新读取`:`Reload`})]}):null,f&&!t?(0,K.jsxs)(`section`,{className:`border-t border-line/60 pt-3`,children:[f.parentId?(0,K.jsxs)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:[a?`继续引用这份回答:`:`Following up on this answer: `,f.parentTitle||D.find(e=>e.reader_foundation?.id===f.parentId)?.reader_foundation?.question]}):null,(0,K.jsx)(Su,{draft:f,onChange:p,onSubmit:re,disabled:o.creationBlocked})]}):t?null:(0,K.jsx)(B,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x}}),children:a?`问这版说明`:`Ask about this explanation`})]})]}):null})]})}var ad=[`manager`,`planner`,`engineer`,`reviewer`],od=new Set([`planner`,`engineer`,`reviewer`]),sd=new Set([`running`,`in_progress`,`claimed`]),$=(e,t)=>String(e[t]??``).trim(),cd=(e,t)=>{let n=Number(e[t]);return Number.isFinite(n)?n:null};function ld(e){return JSON.parse(JSON.stringify(e))}function ud(){return{schema_version:7,bootstrapped:!1,language:``,mission:{id:``,title:``,objective:``,summary:``,final_output:``,status:`idle`,started_at:null,completed_at:null,elapsed_seconds:0,campaign_started_at:null,campaign_elapsed_seconds:0},stage:{id:``,label:``},routing:{route:``,vertical:``,workflow_mode:``,lifetime:``,continuous:!1,open_ended:!1},round:{current:0,max:0},active_role:``,roles:ad.map(e=>({role:e,status:`waiting`,label:`Waiting`,updated_at:0})),role_work:[],dag:[],timeline:[],artifacts:[],learned_skills:[],learned_wiki_pages:[],storage:{project_skill_dir:``,global_skill_dir:``,project_skill_count:0,global_skill_count:0,skill_history_compressed:0,wiki_retired_compressed:0,skill_history_bytes_saved:0,wiki_retired_bytes_saved:0,wiki_paths:[]},achievement:null,review:{status:``,reason:``,rejected_attempts:0},frontier:{change:``,summary:``,updated_at:0},delivery:null,outcome:{},last_event_ts:0,updated_at:0}}function dd(e,t,n,r){if(n==null||n===``)return;let i=e.findIndex(e=>e[t]===n);i>=0?e[i]={...e[i],...r}:e.push(r)}function fd(e,t,n,r,i){if(!ad.includes(t))return;n===`active`&&od.has(t)&&e.roles.forEach(e=>{od.has(e.role)&&e.role!==t&&e.status===`active`&&Object.assign(e,{status:`done`,label:`Handed off`,updated_at:i})});let a={role:t,status:n,label:r,updated_at:i};dd(e.roles,`role`,t,a),n===`active`?e.active_role=t:e.active_role===t&&(e.active_role=``)}function pd(e,t,n,r,i=``,a=`neutral`){let o=we(t);if(e.timeline.some(e=>e.id===o))return;let s={id:o,ts:Number(t.ts??Date.now()/1e3),type:A(t.type),role:n,title:r.slice(0,180),detail:i.slice(0,500),tone:a};[`item_id`,`branch_id`].forEach(e=>{let n=$(t,e);n&&(s[e]=n)}),e.timeline=[...e.timeline,s].slice(-120)}function md(e,t,n,r,i,a=``,o=``){if(!ad.includes(n))return;let s=$(t,`message_id`),c=s?`${n}:${s}`:we(t),l=e.role_work.find(e=>e.id===c),u=l&&l.detail.length>a.length?l.detail:a,d={id:c,ts:Number(t.ts??Date.now()/1e3),role:n,kind:r,title:i.slice(0,240),detail:u.slice(0,4e3),status:o,item_id:$(t,`item_id`),mission_id:e.mission.id,mission_title:e.mission.title.slice(0,240),round_index:cd(t,`round_index`)},f=e.role_work.findIndex(e=>e.id===c);f>=0?e.role_work[f]=d:e.role_work.push(d);let p=new Set;ad.forEach(t=>{e.role_work.filter(e=>e.role===t).slice(-40).forEach(e=>p.add(e.id))}),e.role_work=e.role_work.filter(e=>p.has(e.id))}function hd(e){return e===`ok`?`success`:e===`err`?`error`:`info`}var gd={agent_message:`Reporting progress`,assistant_message:`Reporting progress`,command_execution:`Running a command`,reasoning:`Reasoning`,tool_use:`Using a tool`,tool_result:`Inspecting tool output`,codex_idle:`Waiting for model output`};function _d(e,t){let n=A(t.type),r=Number(t.ts??Date.now()/1e3);if(e.last_event_ts=Math.max(e.last_event_ts,r),n===L.LIFE_MANAGER_INTENT_STARTED)e.mission.id=$(t,`item_id`)||$(t,`intent_id`),e.mission.title=$(t,`objective`).slice(0,240),e.mission.objective=$(t,`objective`),e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`grounding`,fd(e,`manager`,`active`,`Grounding project`,r),pd(e,t,`manager`,`Project grounding started`,$(t,`objective`)),md(e,t,`manager`,`grounding`,`Grounding project`,$(t,`objective`),`active`);else if(n===L.LIFE_MANAGER_INTENT_COMPLETED){let n=$(t,`execution_task`)||$(t,`objective`);e.mission.id=$(t,`item_id`),e.mission.title=n.slice(0,240),e.mission.objective=n,e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`framed`,e.routing.route=$(t,`route`)||e.routing.route||`team`,e.routing.vertical=$(t,`vertical`)||e.routing.vertical,e.routing.workflow_mode=$(t,`workflow_mode`)||e.routing.workflow_mode,e.routing.lifetime=$(t,`lifetime`)||e.routing.lifetime,`continuous`in t&&(e.routing.continuous=t.continuous===!0),`open_ended`in t&&(e.routing.open_ended=t.open_ended===!0);let i=$(t,`current_stage`),a=Array.isArray(t.stages)?t.stages:[];if(i)e.stage={id:i,label:i.replaceAll(`_`,` `)};else if(!e.stage.id&&a[0]){let t=String(a[0]);e.stage={id:t,label:t.replaceAll(`_`,` `)}}fd(e,`manager`,`done`,`Goal framed`,r),pd(e,t,`manager`,`Goal framed`,$(t,`reason`),`success`),md(e,t,`manager`,`decision`,`Goal framed`,$(t,`reason`)||$(t,`execution_task`),`done`)}else if(n===L.LIFE_MANAGER_INTENT_FAILED)e.mission.status=`failed`,fd(e,`manager`,`error`,`Manager routing failed`,r),pd(e,t,`manager`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`),md(e,t,`manager`,`grounding`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`);else if(n===L.LIFE_MANAGER_STAGE_DECISION){let n=$(t,`target_stage`)||$(t,`stage`)||$(t,`current_stage`);n&&(e.stage={id:n,label:n.replaceAll(`_`,` `)}),fd(e,`manager`,`done`,n?`Stage · ${n}`:`Stage reviewed`,r),pd(e,t,`manager`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`)),md(e,t,`manager`,`stage_decision`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`),$(t,`action`))}else if(n===L.LIFE_PLANNER_START)fd(e,`planner`,`active`,`Planning next work`,r),md(e,t,`planner`,`planning`,`Planning next work`,$(t,`objective`),`active`);else if(n===L.LIFE_PLANNER_TASK_ADDED){let n=$(t,`item_id`),i={id:n,title:$(t,`title`),objective:$(t,`objective`),status:`pending`,deps:Array.isArray(t.deps)?t.deps.map(String):[],branch_id:$(t,`branch_id`)||n,parent_branch_id:$(t,`parent_branch_id`)||null};dd(e.dag,`id`,n,i);let a=e.routing.vertical===`research`?`Research branch added`:`Task added`;fd(e,`planner`,`done`,a,r),pd(e,t,`planner`,a,i.title,`info`),md(e,t,`planner`,`task`,i.title||`Task added`,i.objective,`pending`)}else if(n===L.LIFE_PLANNER_VERDICT){let n=!!t.project_done,i=n&&t.delivery&&typeof t.delivery==`object`&&!Array.isArray(t.delivery)?JSON.parse(JSON.stringify(t.delivery)):null,a=i?`Task completed`:n?`Project reviewed`:`Planning complete`;i&&(e.delivery=i,e.mission.status=`complete`,e.mission.summary=i.summary||``,e.mission.completed_at=r),fd(e,`planner`,`done`,a,r),pd(e,t,`planner`,a,$(t,`reason`),n?`success`:`neutral`),md(e,t,`planner`,`verdict`,a,$(t,`reason`),n?`done`:`planned`)}else if(n===L.LIFE_PLANNER_WAITING){fd(e,`planner`,`waiting`,`Waiting on external work`,r);let n=$(t,`reason`)||$(t,`waiting_reason`);pd(e,t,`planner`,`Planner waiting`,n),md(e,t,`planner`,`waiting`,`Planner waiting`,n,`waiting`)}else if(n===L.LIFE_MISSION_STARTED)e.review={status:``,reason:``,rejected_attempts:0},e.delivery=null,e.mission.campaign_started_at??=r,e.mission={...e.mission,id:$(t,`item_id`),title:$(t,`title`),objective:$(t,`objective`),summary:``,final_output:``,status:`working`,started_at:r,completed_at:null},fd(e,`reviewer`,`waiting`,`Waiting for the Engineer to finish`,r),fd(e,`engineer`,`active`,`Starting mission`,r),pd(e,t,`engineer`,`Mission started`,$(t,`title`),`info`),md(e,t,`engineer`,`task`,$(t,`title`)||`Mission started`,$(t,`objective`),`active`);else if(n===L.ROUND_START)e.round={current:cd(t,`round_index`)??0,max:cd(t,`round_max`)??e.round.max},fd(e,`engineer`,`active`,`Running round ${e.round.current}`,r),pd(e,t,`engineer`,`Round ${e.round.current} started`);else if(n===L.ENGINEER_PROGRESS){let n=$(t,`agent_layer`)||$(t,`actor`)||`engineer`,i=n===`main`?`engineer`:n,a=$(t,`kind`),o=gd[a]??`Working`;fd(e,i,`active`,o,r),i===`engineer`&&[`assistant_message`,`agent_message`,`message`].includes(a)&&t.final_delivery===!0&&e.mission.started_at!=null&&e.mission.completed_at==null&&r>=e.mission.started_at&&(!t.item_id||$(t,`item_id`)===e.mission.id)&&(e.mission.final_output=Te(t.text));let s=$(t,`action_summary`)||$(t,`text`);s&&!Ee(t)&&!te(t)&&md(e,t,i,a||`progress`,o,s,`active`),[`reasoning`,`assistant_message`,`agent_message`].includes(a)||pd(e,t,i,o,$(t,`action_summary`)||$(t,`text`))}else if(n===L.ROUND_MAIN_COMPLETED)fd(e,`engineer`,`done`,`Work ready for review`,r),md(e,t,`engineer`,`handoff`,`Work ready for review`,$(t,`text`)||$(t,`summary`),`done`);else if(n===L.ROUND_REVIEW_STARTED)e.review={status:``,reason:``,rejected_attempts:e.review.rejected_attempts},fd(e,`reviewer`,`active`,`Reviewing benchmark evidence`,r),md(e,t,`reviewer`,`review`,`Review started`,``,`active`);else if(n===L.ROUND_REVIEW_DEFERRED){let n=$(t,`next_step`);fd(e,`engineer`,`active`,`Continuing before review`,r),fd(e,`reviewer`,`waiting`,`Review deferred for one round`,r),pd(e,t,`engineer`,`Continued before review`,n,`info`)}else if(n===L.ROUND_REVIEW_COMPLETED){let n=t.review_skipped===!0,i=n?`skipped`:$(t,`status`),a=$(t,`reason`);e.review={status:i,reason:a,rejected_attempts:e.review.rejected_attempts+ +!![`continue`,`blocked`].includes(i)};let o=$(t,`frontier_change`);o&&(e.frontier={change:o,summary:$(t,`frontier_summary`),updated_at:r});let s=n?`No review this round`:i===`done`?`Evidence accepted`:`Attempt rejected`;fd(e,`reviewer`,n?`waiting`:i===`done`?`done`:`rejected`,n?s:i===`done`?`Accepted evidence`:`Requested another attempt`,r),pd(e,t,`reviewer`,s,a,n?`info`:i===`done`?`success`:`error`);let c=$(t,`next_action`);md(e,t,`reviewer`,n?`review`:`verdict`,s,c?`${a}\n\nNext action: ${c}`:a,i)}else if([L.SKILL_CREATED,L.SKILL_UPDATED].includes(n)){let i=$(t,`skill_id`)||$(t,`name`);i&&(dd(e.learned_skills,`id`,i,{id:i,name:$(t,`name`),version:cd(t,`version`)??1,scope:$(t,`scope`),path:$(t,`path`),status:`active`,updated_at:r,mission_id:e.mission.id,mission_title:e.mission.title}),pd(e,t,`reviewer`,n===L.SKILL_CREATED?`Capability unlocked`:`Capability upgraded`,$(t,`name`),`skill`))}else if(n===L.SKILL_EVOLUTION_COMPLETED)e.storage.project_skill_dir=$(t,`project_skill_dir`)||e.storage.project_skill_dir,e.storage.global_skill_dir=$(t,`global_skill_dir`)||e.storage.global_skill_dir,e.storage.project_skill_count=cd(t,`project_skill_count`)??e.storage.project_skill_count,e.storage.global_skill_count=cd(t,`global_skill_count`)??e.storage.global_skill_count;else if(n===L.SKILL_HISTORY_COMPRESSED)e.storage.skill_history_compressed+=cd(t,`count`)??0,e.storage.skill_history_bytes_saved+=cd(t,`bytes_saved`)??0;else if(n===L.SKILL_TIDIED){let n=$(t,`name`);if(n){let i=e.learned_skills.find(e=>e.name===n),a={source_path:$(t,`path`),source_placement:$(t,`placement`),source_vertical:$(t,`vertical`),updated_at:r};i?Object.assign(i,a):dd(e.learned_skills,`id`,n,{id:n,name:n,version:1,scope:``,path:``,status:`active`,...a}),pd(e,t,`manager`,`Capability promoted to source`,n,`skill`)}}else if([L.WIKI_INITIALIZED,L.WIKI_EVOLUTION_COMPLETED].includes(n)){let n=[...(Array.isArray(t.paths)?t.paths:[]).map(e=>String(e)),$(t,`path`)].filter(Boolean);e.storage.wiki_paths=[...new Set([...e.storage.wiki_paths,...n])]}else if(n===L.WIKI_RETIRED_COMPRESSED)e.storage.wiki_retired_compressed+=cd(t,`count`)??0,e.storage.wiki_retired_bytes_saved+=cd(t,`bytes_saved`)??0;else if([L.WIKI_CREATED,L.WIKI_UPDATED].includes(n)){let i=$(t,`page_id`);i&&(dd(e.learned_wiki_pages,`id`,i,{id:i,title:$(t,`title`)||i,card_type:$(t,`card_type`),status:$(t,`status`)||`scratch`,path:$(t,`path`),updated_at:r}),pd(e,t,`reviewer`,n===L.WIKI_CREATED?`Knowledge captured`:`Knowledge refined`,$(t,`title`)||i,`skill`))}else if(n===L.WIKI_RETIRED){let n=$(t,`page_id`);if(n){let i=e.learned_wiki_pages.find(e=>e.id===n);i?Object.assign(i,{status:`retired`,updated_at:r}):dd(e.learned_wiki_pages,`id`,n,{id:n,title:n,card_type:$(t,`card_type`),status:`retired`,path:``,updated_at:r}),pd(e,t,`reviewer`,`Knowledge retired`,n,`error`)}}else if([L.WIKI_PROMOTION_PROMOTED,L.WIKI_PROMOTION_DEMOTED].includes(n)){let i=$(t,`page_id`);if(i){let a=e.learned_wiki_pages.find(e=>e.id===i);a?Object.assign(a,{status:$(t,`to_status`),updated_at:r}):dd(e.learned_wiki_pages,`id`,i,{id:i,title:i,card_type:$(t,`card_type`),status:$(t,`to_status`),path:``,updated_at:r});let o=n===L.WIKI_PROMOTION_PROMOTED;pd(e,t,`reviewer`,o?`Knowledge promoted`:`Knowledge demoted`,`${i} → ${$(t,`to_status`)}`,o?`success`:`neutral`)}}else if(n===L.RESEARCH_ACHIEVEMENT_CERTIFIED)e.achievement={id:$(t,`achievement_id`),title:$(t,`title`),goal:$(t,`goal`),summary:$(t,`summary`),rejected_attempts:e.review.rejected_attempts,skills_learned:e.learned_skills.filter(e=>e.status===`active`).length,artifacts:e.artifacts.length,elapsed_seconds:e.mission.elapsed_seconds,evidence:Array.isArray(t.evidence)?t.evidence.map(String):[],reviewer_certified:!0,certified_at:r};else if([L.LIFE_MISSION_COMPLETED,L.LIFE_MISSION_FAILED].includes(n)){let i=n===L.LIFE_MISSION_FAILED?yi({...t,outcome_class:`failed`,status:$(t,`status`)||`failed`,success:!1}):yi(t),a=`final_output`in t?$(t,`final_output`):$(t,`item_id`)===e.mission.id&&e.mission.started_at!=null&&(e.mission.completed_at==null||e.mission.completed_at===r)&&e.mission.final_output||``;e.mission.id=$(t,`item_id`)||e.mission.id,e.mission.title=$(t,`title`)||e.mission.title,e.mission.objective=$(t,`objective`)||e.mission.objective,e.mission.summary=$(t,`summary`),e.mission.final_output=a,e.mission.status=i.missionStatus,e.mission.completed_at=r;let o=t.delivery;t.success===!0&&o&&typeof o==`object`&&!Array.isArray(o)?e.delivery=JSON.parse(JSON.stringify(o)):t.success!==!0&&(e.delivery=null),e.outcome=vi(t),fd(e,`engineer`,i.missionStatus===`complete`?`done`:i.missionStatus,i.label,r),pd(e,t,`engineer`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),hd(i.tone)),md(e,t,`engineer`,`completion`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),i.missionStatus)}return e.updated_at=Date.now()/1e3,e}function vd(e,t,n){let r=t.backlog.find(e=>sd.has(e.status)),i=t.backlog.find(e=>e.status===`pending`),a=t.backlog.find(t=>t.id===e.mission.id),o=r??a,s=!!(r||i||t.continuous?.enabled||t.continuous?.done_reason||t.continuous?.done_at||e.mission.id||![``,`idle`].includes(e.mission.status));t.continuous?.enabled&&(e.routing.route=e.routing.route||`team`,e.routing.continuous=!0,e.routing.open_ended=t.continuous.open_ended===!0,e.routing.lifetime=e.routing.open_ended?`standing`:e.routing.lifetime||`bounded`);let c=o?.objective||o?.title||(t.continuous?.enabled?t.continuous.objective:``)||t.session.objective||(e.mission.id?``:i?.objective)||(e.mission.id?``:i?.title)||e.mission.objective;c&&(e.mission.objective=c,o?e.mission.title=(o.title||c.split(` +`)[0]).slice(0,240):e.mission.title||(e.mission.title=c.split(` +`)[0].slice(0,240))),r?((r.id!==e.mission.id||r.started_ts!=null&&r.started_ts!==e.mission.started_at||e.mission.completed_at!=null)&&(e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=r.started_ts??null,e.mission.completed_at=null),e.mission.id=r.id,e.mission.status=`working`,e.mission.started_at=e.mission.started_at??r.started_ts??null):a?a.status===`pending`&&(e.mission.status=`queued`):t.continuous?.done_reason||t.continuous?.done_at?e.mission.status=`complete`:i||t.continuous?.enabled?e.mission.status=`queued`:t.daemon.alive&&(e.mission.status=`idle`),t.roles.forEach(t=>{t.active?fd(e,t.role,`active`,t.label||t.status||`Working`,Date.now()/1e3-(t.age_s??0)):s||fd(e,t.role,`waiting`,`Waiting`,Date.now()/1e3);let n=e.roles.find(e=>e.role===t.role);n&&Object.assign(n,{backend:t.backend,model:t.model,effort:t.effort})});let l=t.roles.filter(e=>e.active);l.length?e.active_role=l[l.length-1].role:s||(e.active_role=``),t.backlog.forEach(t=>{let n={id:t.id,title:t.title,objective:t.objective,status:t.status,deps:t.deps??[],branch_id:t.id,parent_branch_id:t.deps?.[0]??null,acceptance_check:t.acceptance_check??``,plan_hypothesis:t.plan_hypothesis??``,goal_contribution:t.goal_contribution??``,expected_regressions:t.expected_regressions??``,decision_rule:t.decision_rule??``,non_goals:t.non_goals??[]};dd(e.dag,`id`,n.id,n)});let u=o?.outcome?.execution_status?o.outcome:e.mission.id?void 0:[...t.backlog].filter(e=>e.outcome?.execution_status).sort((e,t)=>Number(e.finished_ts??0)-Number(t.finished_ts??0)).at(-1)?.outcome;return!r&&u&&(e.outcome=vi({outcome:u,status:`done`,success:!0})),n.forEach(t=>{dd(e.artifacts,`path`,t.path,{id:t.path,path:t.path,title:t.name,kind:t.kind,why:t.why,exists:t.exists,storage_path:t.storage_path,source:t.source})}),s}function yd(e,t,n,r){r||(t.roles.forEach(t=>{t.active||fd(e,t.role,`waiting`,`Waiting`,Date.now()/1e3)}),e.active_role=``);let i=Date.now()/1e3,a=e.mission.campaign_started_at??t.session.created??e.mission.started_at;a&&(e.mission.campaign_started_at=a,e.mission.campaign_elapsed_seconds=Math.max(0,i-a)),e.mission.started_at&&e.mission.status===`working`?e.mission.elapsed_seconds=Math.max(0,i-e.mission.started_at):e.mission.started_at&&e.mission.completed_at&&(e.mission.elapsed_seconds=Math.max(0,e.mission.completed_at-e.mission.started_at)),e.achievement?.reviewer_certified&&(e.achievement.elapsed_seconds=e.mission.elapsed_seconds,e.achievement.rejected_attempts=e.review.rejected_attempts,e.achievement.skills_learned=e.learned_skills.filter(e=>e.status===`active`).length,e.achievement.artifacts=n.filter(e=>e.exists).length)}function bd(e,t=[],n=[]){let r=e.mission_view?ld(e.mission_view):ud();r.storage??=ud().storage,r.storage.skill_history_compressed??=0,r.storage.wiki_retired_compressed??=0,r.storage.skill_history_bytes_saved??=0,r.storage.wiki_retired_bytes_saved??=0,r.learned_wiki_pages??=[],r.role_work??=[],r.delivery??=null,r.outcome??={};let i=r.last_event_ts,a=vd(r,e,n),o=[...t].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0));return o.filter(e=>e.ts==null||Number(e.ts)>i).forEach(e=>_d(r,e)),r.mission.final_output||(r.mission.final_output=xd(o,r.mission)),yd(r,e,n,a),r}function xd(e,t){if(!t.id||[`working`,`queued`,`grounding`,`framed`].includes(t.status))return``;let n=e.reduce(_d,ud()).mission;return n.id!==t.id||n.started_at==null||n.completed_at==null||t.started_at!=null&&n.started_at!==t.started_at||t.completed_at!=null&&n.completed_at!==t.completed_at?``:n.final_output||``}function Sd(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h ${r}m`:r?`${r}m`:`${t}s`}var Cd=`__argus_live_progress__`,wd=new Set([`framed`,`grounding`,`queued`,`running`,`in_progress`,`working`]),Td=new Set([`complete`,`completed`,`done`,`success`]);function Ed(e){return Td.has(String(e?.mission.status||``).toLowerCase())}function Dd(e){return(e??[]).filter(e=>e.source===`manager_live`)}function Od(e){return Dd(e).filter(e=>e.exists)[0]??null}function kd(e){let t=e??[],n={markdown:0,pdf:1,html:2,text:3,table:4,json:5,image:6,video:7,audio:8,binary:9},r=t.filter(e=>e.exists&&e.source===`delivery`),i=t.filter(e=>e.exists&&e.source===`manager_live`),a=t.filter(e=>e.exists&&e.source!==`manager_live`&&e.source!==`delivery`);return a.length||r.length?[...r,...[...a].sort((e,t)=>(n[e.kind]??99)-(n[t.kind]??99)),...i]:i}function Ad(e){return kd(e).find(e=>e.exists)??null}function jd(e){let t=kd(e);return t.find(e=>e.source===`delivery`)??t.find(e=>e.source!==`manager_live`)??t[0]??null}function Md(e){let t=e.path.split(`/`);return t[t.length-1]||e.path}function Nd(e,t){if(e){let n=String(e.mission.status||``).toLowerCase();if(wd.has(n))return Cd;let r=e.delivery?.primary_target?.path;if(r)return r;if(Ed(e))return jd(t)?.path??`__argus_live_progress__`;let i=Od(t);return i?i.path:Cd}return Ad(t)?.path??``}function Pd(e){let t=String(e.agent_layer??e.actor??``);if(t===`main`)return`engineer`;if(t)return t;let n=String(e.type??``);return n.startsWith(`round.review`)||n.startsWith(`reviewer`)?`reviewer`:n.startsWith(`life.planner`)?`planner`:n.startsWith(`life.manager`)||n.startsWith(`manager`)?`manager`:n.startsWith(`engineer`)||n.startsWith(`round.`)?`engineer`:``}function Fd(e,t=[],n,r=`en`){if(n&&Vr(n,e,t).state!==`running`||Ed(e))return null;let i=String(e?.active_role??``);if(!i)return null;let a=e?.roles.find(e=>e.role===i),o=``;for(let n=t.length-1;n>=0;--n){let r=t[n];if(e?.mission.id&&Ir(r)!==e.mission.id||e?.mission.started_at&&Number(r.ts||0)k(e,{},r)):i,label:a?.label||`Working`,detail:o}}function Id({view:e,artifacts:t=[],onOpenArtifact:n,routeVisible:r,snapshot:i,connected:a}){let{locale:o,t:s}=F(),c=e.dag.filter(e=>[`done`,`completed`].includes(e.status)).length,l=[...t].filter(e=>e.exists&&e.source!==`manager_live`).sort((e,t)=>Number(t.mtime??0)-Number(e.mtime??0)).slice(0,4),u=e=>[`running`,`in_progress`,`claimed`].includes(e),d=a&&i?.daemon.alive!==!1,f=e=>e===`done`?`text-ok`:u(e)?`text-blue-sky`:[`failed`,`blocked`,`rejected`].includes(e)?`text-err`:`text-ink-faint`;return(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 text-sm text-ink-dim scroll-thin`,children:[(0,K.jsx)(`section`,{className:`rounded-lg border border-blue-deep/30 bg-blue-deep/10 p-4`,children:(0,K.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.stage`)}),(0,K.jsx)(`dd`,{className:`mt-1 text-sm font-medium text-blue-sky`,children:Zi(e.stage.id,o)===e.stage.id?e.stage.label||e.stage.id||`—`:Zi(e.stage.id,o)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.totalTime`)}),(0,K.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:Sd(e.mission.campaign_elapsed_seconds)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.round`)}),(0,K.jsxs)(`dd`,{className:`mt-1 text-sm text-ink`,children:[e.round.current||`—`,e.round.max?` / ${e.round.max}`:``]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.dagProgress`)}),(0,K.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:ea(c,e.dag.length,o)})]})]})}),r&&e.dag.length?(0,K.jsxs)(`section`,{className:`mt-5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:s(`mission.researchDag`)}),(0,K.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.dag.map(e=>(0,K.jsx)(`li`,{className:`rounded-md border border-line/60 bg-panel px-3 py-2.5`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,"aria-hidden":`true`,children:e.status===`done`?`✓`:d&&u(e.status)?`●`:`○`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium leading-5 text-ink`,children:(0,K.jsx)(Ke,{children:e.title})}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,children:!d&&u(e.status)?a?o===`zh-CN`?`当前未在运行`:`Not currently running`:o===`zh-CN`?`断连前记录:进行中`:`Last received state: in progress`:oa(e.status,o)})]})]})},e.id))})]}):null,l.length?(0,K.jsxs)(`section`,{className:`mt-5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:o===`zh-CN`?`已生成的文件`:`Files produced so far`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o===`zh-CN`?`文件已生成,结论是否成立仍以核验记录为准。`:`A saved file is not a verification of its conclusions.`}),(0,K.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:l.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),title:e.storage_path||e.path,className:`rounded border border-line/70 bg-panel px-2.5 py-1.5 font-mono text-xs text-blue-sky hover:border-blue/60`,children:[Md(e),` ↗`]},e.path))})]}):null]})}function Ld({sid:e,artifacts:t,error:n=!1,onExpand:r,onOpenFile:i,className:a=``,embedded:o=!1,onCollapse:c,missionView:l,activityEvents:u=[],requestedPath:d,requestedPathToken:p,routeVisible:m=!0,snapshot:h,connected:g=!0}){let{t:_,locale:v}=F(),y=(0,U.useMemo)(()=>kd(t),[t]),b=(0,U.useMemo)(()=>Ad(t),[t]),x=Ed(l),S=(0,U.useMemo)(()=>{if(!x)return null;let e=l?.delivery?.primary_target?.path;return y.find(t=>t.path===e&&t.exists)??jd(t)},[t,x,l?.delivery?.primary_target?.path,y]),[C,w]=(0,U.useState)(null);(0,U.useEffect)(()=>{w(x&&S?S.path:null)},[x,S?.path,l?.mission.id,e]),(0,U.useEffect)(()=>{if(!d)return;let e=y.find(e=>e.path===d&&e.exists);e&&w(e.path)},[y,d,p]);let T=e=>{w(e),e!==`__argus_live_progress__`&&i?.()},E=C??Nd(l,t),D=E===Cd,O=D?null:y.find(e=>e.path===E)??(x?S:b),k=de(e,O?.exists?O.path:null,O?.mtime??null),A=k.data,j=A?vu(A):!1,[M,N]=(0,U.useState)(null),[I,ee]=(0,U.useState)(``),[te,L]=(0,U.useState)(!1),[ne,re]=(0,U.useState)(``),ie=(0,U.useMemo)(()=>g?Fd(l,u,h,v):null,[u,l,h,g,v]);(0,U.useEffect)(()=>{if(N(null),ee(``),!e||!O||!A||![`image`,`pdf`,`audio`,`video`].includes(A.kind))return;let t=!0,n=``,r=new AbortController;return P.artifactBlob(e,O.path,!1,r.signal).then(e=>{t&&(n=URL.createObjectURL(e),N(n))},e=>t&&ee(e.message)),()=>{t=!1,r.abort(),n&&URL.revokeObjectURL(n)}},[e,O?.path,A?.kind,A?.mtime]);let ae=l?.delivery??null,oe=ae?.primary_target?.path??``,se=!!(x&&!D&&O&&(O.source===`delivery`||O.path===oe)),ce=v===`zh-CN`?ae?.kind===`submission_certified`?`交付已认证`:`已完成`:ae?.kind===`submission_certified`?`Certified delivery`:`Delivered result`,le=se?ce:D?_(`research.liveProgress`):y[0]?.group_title||_(`research.artifact`),ue=async()=>{if(!(!e||!O)){L(!0),re(``);try{let t=await P.artifactBlob(e,O.path,!0);$e(t,O.name)}catch(e){re(e.message)}finally{L(!1)}}};return(0,K.jsxs)(`section`,{className:`glass-panel glass-panel--side flex min-h-0 flex-col overflow-hidden ${o?``:`rounded-lg border`} ${a}`,"aria-label":_(`research.canvas`),children:[(0,K.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-line/50 bg-panel px-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full ${se?`bg-ok`:ie?`animate-pulse bg-blue`:`bg-ink-faint/60`}`}),(0,K.jsx)(`h2`,{className:`max-w-24 truncate text-sm font-semibold text-ink sm:max-w-48`,children:le})]}),l||y.length>0?(0,K.jsxs)(`label`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:_(`research.previewArtifact`)}),(0,K.jsxs)(`select`,{value:D?Cd:O?.path??``,onChange:e=>T(e.target.value),title:D?_(`research.liveProgress`):O?.storage_path||O?.path,className:`h-8 w-full min-w-0 max-w-64 truncate rounded-md border border-line/50 bg-bg px-2 font-mono text-xs text-ink-dim outline-none focus:border-blue/60`,children:[l?(0,K.jsx)(`option`,{value:Cd,children:_(`research.liveProgress`)}):null,y.map(e=>(0,K.jsxs)(`option`,{value:e.path,disabled:!e.exists,title:e.storage_path||e.path,children:[e.source===`delivery`?`${_(`research.optionDelivery`)} · `:``,Md(e),e.exists?``:` · ${_(`research.optionPending`)}`]},e.path))]})]}):(0,K.jsx)(`div`,{className:`flex-1`}),(0,K.jsx)(`div`,{className:`shrink-0`,children:O?(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>void ue(),disabled:te||!O.exists,title:_(`artifact.download`),"aria-label":_(`artifact.download`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink disabled:opacity-40`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,K.jsx)(`path`,{d:`M8 2.25v7.5M5.25 7.5 8 10.25 10.75 7.5M3 13.25h10`})})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(O.path),title:_(`research.openLarge`),"aria-label":_(`research.openLarge`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,K.jsx)(`path`,{d:`M6 3H3v3M10 3h3v3M6 13H3v-3M10 13h3v-3`})})})]}):null}),c?(0,K.jsx)(`button`,{type:`button`,onClick:c,"aria-label":_(`research.collapse`),title:_(`research.collapse`),className:`hidden h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink lg:flex`,children:(0,K.jsx)(s,{icon:f,className:`h-3.5 w-3.5`})}):null]}),h?(0,K.jsx)(zs,{snapshot:h,view:l,events:u,connected:g,compact:!0}):ie?(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-line/50 bg-blue-deep/10 px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(`span`,{"data-role-dot":ie.role,className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:R.role[ie.role]??R.inkFaint},"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`font-semibold text-ink`,children:ie.roleLabel}),(0,K.jsx)(`span`,{className:`text-blue-sky`,children:_(`mission.active`)}),(0,K.jsxs)(`span`,{className:`truncate text-ink-faint`,children:[`· `,ia(ie.label,v,{kind:l?.roles.find(e=>e.role===ie.role)?.kind,language:l?.language})]})]}),ie.detail?(0,K.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-ink-dim`,children:ie.detail}):null]}):null,(0,K.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col bg-bg`,children:[D&&l?(0,K.jsx)(Id,{view:l,artifacts:t,onOpenArtifact:T,routeVisible:m,snapshot:h,connected:g}):null,!D&&n?(0,K.jsx)(`div`,{className:`m-auto max-w-sm px-6 text-center text-sm text-warn`,children:_(`research.unavailable`)}):null,!D&&!n&&y.length===0?(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,K.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,K.jsx)(`h3`,{className:`mt-3 text-xs text-ink-faint`,children:_(`research.noPreview`)})]}):null,!D&&!n&&y.length>0&&!O?(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,K.jsx)(Ue,{}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:_(`research.waiting`)})]}):null,O&&!O.exists?(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,K.jsx)(Ue,{}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:_(`research.updating`)})]}):null,O?.exists&&k.isLoading?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,O?.exists&&k.isError?(0,K.jsxs)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:[_(`artifact.unavailable`),` · `,k.error.message]}):null,A?.kind===`text`&&!j?(0,K.jsxs)(`pre`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:[A.preview||`(empty file)`,A.truncated?` + +… live preview truncated · expand to inspect the complete file`:``]}):null,A&&j?(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-5 text-sm text-ink-dim scroll-thin`,children:(0,K.jsx)(Ke,{sid:e,basePath:A.path,artifacts:t,onOpenArtifact:T,children:A.preview||`(empty file)`})}):null,A?.kind===`json`?(0,K.jsx)(cu,{value:A.preview||``}):null,A?.kind===`table`?(0,K.jsx)(lu,{value:A.preview||``,delimiter:A.name.endsWith(`.tsv`)?` `:`,`}):null,A?.kind===`html`&&!A.truncated?(0,K.jsx)(iu,{sid:e,path:A.path,html:A.preview||``,title:`Live HTML preview: ${A.name}`}):null,A?.kind===`html`&&A.truncated?(0,K.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-warn`,children:_(`artifact.htmlTooLarge`)}):null,A?.kind===`image`&&M?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4`,children:(0,K.jsx)(`img`,{src:M,alt:A.why||A.name,className:`max-h-full max-w-full object-contain`})}):null,A?.kind===`pdf`&&M?(0,K.jsx)(_u,{src:M,name:A.name}):null,A?.kind===`audio`&&M?(0,K.jsx)(`div`,{className:`m-auto w-full max-w-xl px-6`,children:(0,K.jsx)(`audio`,{controls:!0,preload:`metadata`,src:M,className:`w-full`})}):null,A?.kind===`video`&&M?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-2`,children:(0,K.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:M,className:`max-h-full max-w-full`})}):null,A?.kind===`binary`?(0,K.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-ink-dim`,children:_(`research.fileUnavailable`)}):null,A&&[`image`,`pdf`,`audio`,`video`].includes(A.kind)&&!M&&!I?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,I?(0,K.jsx)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:I}):null]}),!D&&A?(0,K.jsxs)(`footer`,{className:`flex h-9 items-center gap-2 border-t border-line px-4 font-mono text-xs text-ink-faint`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:A.storage_path||A.path,children:A.path}),ne?(0,K.jsx)(`span`,{className:`ml-auto truncate text-err`,title:ne,children:_(`research.downloadFailed`)}):null,(0,K.jsx)(`span`,{className:`shrink-0`,children:ct(A.size)})]}):null]})}function Rd({notice:e,onClose:t}){if((0,U.useEffect)(()=>{if(!e)return;let n=window.setTimeout(t,e.tone===`error`?8e3:4e3);return()=>window.clearTimeout(n)},[e,t]),!e)return null;let n=e.tone===`error`?`border-err/60 bg-err/10 text-err`:e.tone===`success`?`border-ok/60 bg-ok/10 text-ok`:`border-blue-deep/60 bg-panel text-blue-sky`;return(0,K.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,"aria-live":e.tone===`error`?`assertive`:`polite`,className:`fixed bottom-4 left-4 right-4 z-[70] flex items-start gap-2 rounded-md border px-3 py-2.5 shadow-glow sm:left-auto sm:max-w-md ${n}`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0`,children:e.tone===`error`?`!`:e.tone===`success`?`✓`:`i`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-xs leading-relaxed text-ink-dim`,children:e.message}),(0,K.jsx)(`button`,{type:`button`,"aria-label":`dismiss notification`,onClick:t,className:`shrink-0 rounded px-1 text-base leading-none opacity-70 hover:bg-white/5 hover:opacity-100`,children:`×`})]})}function zd({open:e,sid:t,name:n,alive:r,controlAvailable:i=!0,busy:a,onClose:o,onRename:s,onStart:c,onStop:l,onDelete:u}){let{t:d}=F(),[f,p]=(0,U.useState)(n),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1);(0,U.useEffect)(()=>{e&&(p(n),h(!1),_(!1))},[e,n,t]);let v=async e=>{e.preventDefault(),await s(f.trim())},y=r&&!g,b=async()=>{if(y){await l()&&_(!0);return}await c()&&_(!1)};return(0,K.jsxs)(tt,{open:e,onClose:()=>!a&&o(),label:d(`manage.daemon`),width:`max-w-lg`,children:[(0,K.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-ink`,children:d(`topbar.manageSession`)}),(0,K.jsx)(`p`,{className:`mt-0.5 font-mono text-[10px] text-ink-faint`,children:t})]}),(0,K.jsx)(`form`,{onSubmit:e=>void v(e),className:`border-b border-line p-5`,children:(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.displayName`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),maxLength:80,disabled:a,className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg/50 px-3 text-sm text-ink outline-none focus:border-blue-deep disabled:opacity-50`}),(0,K.jsx)(`button`,{type:`submit`,disabled:a||f.trim()===n,className:`rounded border border-line px-3 text-xs text-ink-dim hover:bg-surface disabled:opacity-40`,children:d(`common.save`)})]})]})}),(0,K.jsxs)(`div`,{className:`border-b border-line p-5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.executor`)}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center justify-between rounded border border-line bg-bg/30 p-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm text-ink`,children:d(y?i?`manage.running`:`manage.runningExternally`:`manage.paused`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:d(y?i?`manage.stopNowHint`:`manage.externalHint`:`manage.resumeHint`)})]}),(0,K.jsx)(`button`,{type:`button`,disabled:a||!i,onClick:()=>void b(),className:`rounded border px-3 py-1.5 text-xs disabled:cursor-wait disabled:opacity-50 ${y?`border-warn/50 text-warn hover:bg-warn/10`:`border-blue-deep bg-blue-deep text-white hover:bg-blue-deep/80`}`,children:d(a?`manage.working`:i?y?`manage.stopNow`:`manage.resume`:`common.external`)})]})]}),(0,K.jsxs)(`div`,{className:`p-5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:d(`manage.deleteSession`)}),(0,K.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-ink-faint`,children:d(`manage.deleteHint`)}),m?(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded border border-err/40 bg-err/5 p-3`,children:[(0,K.jsx)(`span`,{className:`text-xs text-ink-dim`,children:d(`manage.confirmQuestion`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`rounded px-2 py-1 text-xs text-ink-faint hover:bg-surface`,children:d(`common.cancel`)}),(0,K.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void u(),className:`rounded bg-err px-3 py-1 text-xs font-medium text-bg disabled:opacity-50`,children:d(`manage.confirmDelete`)})]})]}):(0,K.jsx)(`button`,{type:`button`,disabled:a||y,onClick:()=>h(!0),className:`mt-3 rounded border border-err/40 px-3 py-1.5 text-xs text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-40`,children:d(`manage.delete`)})]})]})}var Bd={科学环境已就绪:`Scientific environment ready`,更新科学环境校验:`Update scientific environment checks`,验证科学环境依赖和关键模块:`Validating scientific dependencies and required modules`,"科学环境 · 上次检查结果":`Scientific environment · previous check`,"下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。":`The results below predate this operation. Refer to the latest error above or check the environment again.`,"科学环境 · ⟦0⟧ 项待配置":`Scientific environment · ⟦0⟧ item(s) to configure`,科学环境:`Scientific environment`,检查环境:`Check environment`,"免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。":`Free scientific components are configured automatically; SHELX requires academic authorization from the official website before entering download credentials.`,修复依赖:`Repair dependencies`,"继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。":`Confirm the official PLATON license before continuing. The same installation or repair action will prepare the complete runtime; no separate repair button is required.`,同意并继续:`Agree and continue`,"请先确认 PLATON 使用许可,再继续安装或修复依赖。":`Confirm the PLATON license before installing or repairing dependencies.`,依赖修复完成:`Dependency repair complete`,依赖修复未完成:`Dependency repair incomplete`,环境操作未完成:`Environment operation incomplete`,"依赖修复未完成:⟦0⟧。请查看组件检查结果;不会报告修复成功。":`Dependency repair is incomplete: ⟦0⟧. Check the component results; this is not reported as a successful repair.`,"PLATON 已可用,保留当前安装。":`PLATON is already available; keeping the existing installation.`,"准备 PLATON 官方环境":`Prepare official PLATON runtime`,"下载、验证并配置":`Download, verify and configure`,"我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。":`I confirm that my use complies with the official PLATON license; for commercial use, I have obtained separate authorization.`,"PLATON 官方允许注明来源的学术、科学及非商业用途;商业用途需自行取得许可。本操作只从官方网站下载到插件私有目录,不安装系统运行库、不修改系统 PATH。":`The publisher permits acknowledged academic, scientific and non-commercial use of PLATON; commercial use requires a separate license. This downloads from official sites into the plugin's private directory, without installing system runtimes or changing the system PATH.`,"PLATON 缺少 Windows Salford 运行库(0xC0000135)。请点击“修复依赖”,确认许可后会在同一流程准备完整运行环境。":`PLATON is missing the Windows Salford runtime (0xC0000135). Click Repair dependencies and confirm the license to prepare the complete runtime in the same action.`,"正在校验 PLATON 官方程序与 Windows 配套运行环境…":`Verifying the official PLATON program and Windows runtime…`,"正在提取官方 Salford 运行库(不执行系统安装程序)…":`Extracting the official Salford runtime without executing the system installer…`,"正在实际运行 PLATON,验证 Windows 运行库和校验规则…":`Running PLATON to verify the Windows runtime and validation rules…`,"PLATON 官方 Windows 运行环境验证通过。":`The official PLATON Windows runtime passed verification.`,"PLATON 官方运行环境已可用,保留当前安装。":`The official PLATON runtime is already available; keeping the existing installation.`,"配置 SHELX":`Configure SHELX`,"SHELX 授权安装":`SHELX authorized installation`,学术授权:`Academic authorization`,前往官网申请:`Apply on official website`,"填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。":`Enter the username and password from the authorization email to download and install automatically. Credentials are used only for this official download, are not saved, and are not sent to the model.`,用户名:`Username`,"SHELX 用户名":`SHELX username`,密码:`Password`,"SHELX 密码":`SHELX password`,"查看许可 ↗":`View license ↗`,"下载并安装 SHELX":`Download and install SHELX`,取消:`Cancel`,科学软件健康检查:`Scientific software health check`,"点击“检查环境”可验证科学内核与外部程序。":`Click “Check environment” to verify the scientific kernel and external programs.`,可用:`Available`,待授权安装:`Authorization required`,待修复:`Needs repair`,查看检查详情:`View check details`,查看原因与安装方式:`View cause and installation method`,"官方安装说明 ↗":`Official installation instructions ↗`,使用已有安装:`Use existing installation`,"DIALS 环境目录":`DIALS environment directory`,"Systre JAR 路径(需要已有 Java)":`Systre JAR path (existing Java required)`,"⟦0⟧ 可执行文件路径":`⟦0⟧ executable path`,"填写运行 Argus 的电脑上的路径,验证成功后生效。":`Enter the path on the computer running Argus. It takes effect after successful verification.`,验证并使用:`Verify and use`,最近检查:`Last checked`,"· 检查不调用模型":`· Check does not call the model`,无法读取插件列表:`Unable to read plugin list`,插件操作未完成:`Plugin operation incomplete`,插件:`Plugins`,关闭插件列表:`Close plugin list`,"按需安装研究工具,沿用 Argus 的模型与执行后端。":`Install research tools as needed, using Argus's model and execution backend.`,"正在读取插件…":`Reading plugins…`,暂无可用插件:`No plugins available`,已启用:`Enabled`,已停用:`Disabled`,未安装:`Not installed`,"· 当前后端":`· Current backend`,安装:`Install`,打开工作台:`Open workbench`,启用:`Enable`,更新至:`Update to`,停用:`Disable`,卸载:`Uninstall`,"原生会话输入 ⟦0⟧ 可启用后台工具。卸载保留会话、研究数据和科学软件。":`Native session input ⟦0⟧ can enable background tools. Uninstalling preserves sessions, research data, and scientific software.`,"首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。":`First installation automatically configures standalone Python, DIALS, Systre / Java, and free academic PLATON components. SHELX can be installed later by entering authorization details.`,"暂不支持,敬请期待。当前插件支持 Codex、Copilot 和 Pi。":`Not supported yet. Stay tuned. Current plugins support Codex, Copilot, and Pi.`,"安装科学环境需要 Python 3.11–3.13。请安装 Python 后重试,或设置 ARGUS_PLUGIN_PYTHON。":`Installing the scientific environment requires Python 3.11–3.13. Install Python and try again, or set ARGUS_PLUGIN_PYTHON.`,准备安装:`Prepare installation`,获取并校验插件包:`Download and verify plugin package`,"安装独立运行环境(首次可能需要几分钟)":`Install standalone environment (may take several minutes the first time)`,"插件仍有任务运行,请等任务结束或先暂停,再进行此操作。":`This plugin still has running tasks. Wait for them to finish or pause them before continuing.`,"此插件版本尚未提供可校验的发行包。":`No verifiable release package is available for this plugin version.`,"插件包校验失败,未安装。":`Plugin package verification failed. Not installed.`,正在准备:`Preparing`,"当前系统或 Argus 插件接口版本暂不支持此插件。":`This plugin is not currently supported by the system or Argus plugin API version.`,"插件发行包尚未发布。":`The plugin release package has not been published.`,安装完成:`Installation complete`,环境检查完成:`Environment check complete`,"此插件已有安装或更新操作正在进行。":`An installation or update operation for this plugin is already in progress.`,插件尚未安装:`Plugin not installed`,"安装进程已中断;已有可用版本保持不变,可重试。":`Installation was interrupted. The existing available version is unchanged; you can retry.`,"安装未完成,已有版本保持不变":`Installation incomplete; existing version unchanged`,"此版本已安装,可启用插件。":`This version is installed. You can enable the plugin.`,请先安装插件:`Install the plugin first`,请先更新插件以使用环境管理功能:`Update the plugin first to use environment management`,"插件包超过允许大小。":`The plugin package exceeds the allowed size.`,科学计算内核:`Scientific computing kernel`,"cctbx · Gemmi · RDKit · 科学服务":`cctbx · Gemmi · RDKit · scientific services`,衍射帧处理与探测器格式支持:`Diffraction frame processing and detector format support`,周期网络与拓扑识别:`Periodic networks and topology identification`,"本地 checkCIF 结构校验 · 学术免费":`Local checkCIF structure validation · free for academic use`,"结构精修 · 需要学术授权":`Structure refinement · academic authorization required`,"结构求解 · 需要学术授权":`Structure solution · academic authorization required`,全部组件可用:`All components available`,部分组件需要配置或修复:`Some components require configuration or repair`,"PLATON 官网中间证书已更换,请更新插件安装器":`The PLATON official-site intermediate certificate has changed. Update the plugin installer.`,"PLATON Mac 发行包架构不符":`PLATON Mac release package architecture mismatch`,"请输入授权邮件中的用户名和密码。":`Enter the username and password from the authorization email.`,请选择有效的科学软件路径:`Select a valid scientific software path`,检查科学软件与运行环境:`Check scientific software and runtime environment`,"正在修复科学 Python 依赖":`Repairing scientific Python dependencies`,"(首次下载可能需要几分钟)":`(The initial download may take several minutes)`,"from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('科学内核及工作台资源可用')":`from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('Scientific kernel and workbench resources available')`,"; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · 探测器格式插件可用')":`; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · detector format plugins available')`,"Systre 19.6.0 · pcu 拓扑计算通过":`Systre 19.6.0 · pcu topology calculation passed`,"正在安装 Apple Rosetta 2 兼容组件":`Installing Apple Rosetta 2 compatibility components`,"从 SHELX 官方站点下载":`Downloading from the official SHELX site`,"SHELX 下载内容不是支持的可执行程序":`SHELX download is not a supported executable`,"已可用,保留当前安装":`Already available; keeping current installation`,正在安装:`Installing`,"尚未安装 DIALS":`DIALS is not installed`,"PLATON 编译需要 Apple 命令行工具;请运行 xcode-select --install,然后点击修复依赖。":`PLATON compilation requires Apple Command Line Tools; run xcode-select --install, then click Repair dependencies.`,"SHELX 官方 Mac 版需要 Rosetta 2,请先同意安装兼容组件。":`The official Mac version of SHELX requires Rosetta 2. Agree to install the compatibility components first.`,"暂未完成;可在健康检查中重试":`Not completed; retry from the health check`,"SHELX 下载或启动失败;请核对授权、网络及系统平台后重试。":`SHELX download or launch failed; check authorization, network, and system platform, then retry.`,"尚未安装 Systre":`Systre is not installed`,"尚未安装 Java":`Java is not installed`,"Systre 未能识别内置 pcu 网络":`Systre could not identify the built-in pcu network`,"尚未安装 PLATON":`PLATON is not installed`,"PLATON 安装配方已更新,点击修复依赖即可使用当前版本。":`The PLATON installation recipe has been updated. Click Repair dependencies to use the current version.`,"PLATON 未生成校验规则;请检查运行库":`PLATON did not generate verification rules; check the runtime`,"请输入 SHELX 授权信息以安装":`Enter SHELX authorization details to install`,"无法启动,请核对平台与运行库":`Unable to start; check the platform and runtime`,"衍射数据处理、结构求解、精修与三维晶体研究工作台":`Diffraction data processing, structure solution, refinement and a 3D crystallography workbench`,"正在准备 ⟦0⟧ 工作台,首次需要几分钟":`Preparing the ⟦0⟧ workbench; the first time takes a few minutes`,"⟦0⟧ 暂时无法使用":`⟦0⟧ is unavailable for now`,"管理 ⟦0⟧":`Manage ⟦0⟧`,"原生会话输入 ⟦0⟧ 可启用后台工具。":`Native session input ⟦0⟧ can enable background tools.`,"研究工具由服务方提供,沿用 Argus 的模型与执行后端。":`Research tools are provided by the service and use Argus's model and execution backend.`,"此插件由服务方提供并维护,无需停用或卸载。":`This plugin is provided and maintained by the service; there is nothing to disable or uninstall.`},Vd=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Hd=/⟦\d+⟧/g,Ud=Object.entries(Bd).filter(([e])=>e.includes(`⟦`)).sort((e,t)=>t[0].length-e[0].length).map(([e,t])=>({regex:RegExp(`^`+e.split(Hd).map(Vd).join(`([\\s\\S]*?)`)+`$`),slots:e.match(Hd)??[],target:t})),Wd=new RegExp(Object.keys(Bd).filter(e=>e.length>1&&!e.includes(`⟦`)).sort((e,t)=>t.length-e.length).map(Vd).join(`|`),`g`);function Gd(e,t){if(t===`zh-CN`||!/[\u3400-\u9fff]/.test(e))return e;if(Bd[e.trim()])return e.replace(e.trim(),Bd[e.trim()]);for(let t of Ud){let n=t.regex.exec(e.trim());if(n){let e=new Map(t.slots.map((e,t)=>[e,n[t+1]]));return t.target.replace(Hd,t=>e.get(t)??t)}}return e.replace(Wd,e=>Bd[e])}function Kd(){let{locale:e}=F();return t=>typeof t==`string`?Gd(t,e):t}var qd=ye(),Jd=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;function Yd({health:e,setup:t,running:n,act:r,platform:i,machine:a}){let o=Kd(),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(``),[p,m]=(0,U.useState)(``),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(``),[y,b]=(0,U.useState)(!1),[x,S]=(0,U.useState)(!1),[C,w]=(0,U.useState)(!1),T=t.windows_runtime,E=t.license?.platform_consent,D=E?.platform===i&&E?.machines.includes(a||``),O=e?.components||[],k=O.filter(e=>e.status!==`ready`),A=k.some(e=>e.license_required),j=k.some(e=>e.automatic);async function M(e){e.preventDefault();let n=await r(t.license.action,{username:d,password:p,accept_platform_license:y});m(``),n&&(u(!1),f(``),c(!0))}return(0,K.jsxs)(`div`,{className:`mt-5 border-t border-line/60 pt-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:()=>c(!s),className:`inline-flex items-center gap-2 text-sm text-ink-dim hover:text-ink`,children:[(0,K.jsx)(ke,{size:16,strokeWidth:1.5}),(0,K.jsx)(`span`,{children:o(e?.stale?o(`科学环境 · 上次检查结果`):e?.checked?e.ready?o(`科学环境已就绪`):o(`科学环境 · ${k.length} 项待配置`):o(`科学环境`))}),(0,K.jsx)(Me,{size:13,className:`transition-transform duration-200 ${s?`rotate-180`:``}`})]}),(0,K.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint hover:text-ink disabled:opacity-45`,disabled:n,onClick:()=>{c(!0),r(`health`)},children:[(0,K.jsx)(Pe,{size:12}),o(`检查环境`)]})]}),e?.stale&&(0,K.jsx)(`p`,{role:`status`,className:`mt-2 text-xs leading-relaxed text-ink-dim`,children:o(`下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。`)}),o((A||j||!e?.checked)&&(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:o(` 免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。 `)})),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[o((j||!e?.checked||e.stale)&&(0,K.jsxs)(`button`,{className:Jd,disabled:n,onClick:()=>{c(!0),r(`repair`)},children:[(0,K.jsx)(Le,{size:14}),o(`修复依赖`)]})),o(t.license&&(0,K.jsxs)(`button`,{className:Jd,disabled:n,onClick:()=>{u(!l),m(``),f(``)},children:[(0,K.jsx)(Vt,{size:14}),o(o(A?`配置 SHELX`:`SHELX 授权安装`))]}))]}),T&&(0,K.jsxs)(`div`,{className:`mt-3`,children:[(0,K.jsxs)(`button`,{type:`button`,className:Jd,disabled:n,onClick:()=>{w(!C),S(!1)},children:[(0,K.jsx)(Le,{size:14}),o(`准备 PLATON 官方环境`)]}),C&&(0,K.jsxs)(`form`,{className:`mt-3 rounded-lg bg-bg/70 p-3`,onSubmit:async e=>{e.preventDefault(),x&&await r(T.action,{accept_software_license:!0})&&(w(!1),S(!1),c(!0))},children:[(0,K.jsxs)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:[o(T.notice),` `,(0,K.jsx)(`a`,{href:T.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)})]}),(0,K.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5`}),o(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,K.jsx)(`button`,{type:`submit`,className:Jd,disabled:n||!x,children:o(`下载、验证并配置`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>{w(!1),S(!1)},children:o(`取消`)})]})]})]}),o(l&&t.license&&(0,K.jsxs)(`form`,{onSubmit:M,className:`mt-4 rounded-lg bg-bg/70 p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm`,children:[(0,K.jsxs)(`span`,{className:`font-medium`,children:[o(t.license.name),o(` 学术授权`)]}),(0,K.jsxs)(`a`,{href:t.license.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-blue`,children:[o(`前往官网申请`),(0,K.jsx)(Fe,{size:11})]})]}),(0,K.jsx)(`p`,{className:`mb-3 mt-1.5 text-xs leading-relaxed text-ink-faint`,children:o(`填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。`)}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`用户名`),(0,K.jsx)(`input`,{"aria-label":o(`SHELX 用户名`),value:d,onChange:e=>f(e.target.value),required:!0,maxLength:200,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]}),(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`密码`),(0,K.jsx)(`input`,{"aria-label":o(`SHELX 密码`),type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,maxLength:500,autoComplete:`new-password`,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]})]}),o(D&&E&&(0,K.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-faint`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5`}),(0,K.jsxs)(`span`,{children:[o(E.text),` `,(0,K.jsx)(`a`,{href:E.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`查看许可 ↗`)})]})]})),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`submit`,className:Jd,disabled:n||!d.trim()||!p.trim(),children:[(0,K.jsx)(Le,{size:14}),o(`下载并安装 SHELX`)]}),(0,K.jsx)(`button`,{type:`button`,className:`px-2 text-xs text-ink-faint`,onClick:()=>{u(!1),f(``),m(``)},children:o(`取消`)})]})]})),s&&(0,K.jsxs)(`div`,{className:`mt-3`,"aria-label":o(`科学软件健康检查`),children:[o(!O.length&&(0,K.jsx)(`p`,{className:`py-2 text-xs text-ink-faint`,children:o(`点击“检查环境”可验证科学内核与外部程序。`)})),O.map(e=>(0,K.jsx)(`div`,{className:`border-b border-line/40 py-2.5 last:border-0`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[o(e.status===`ready`?(0,K.jsx)(Ne,{size:15,strokeWidth:1.7,className:`mt-0.5 shrink-0 text-blue/75`}):(0,K.jsx)(It,{size:15,strokeWidth:1.5,className:`mt-0.5 shrink-0 text-ink-faint`})),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,K.jsx)(`span`,{children:o(e.name)}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-ink-faint`,children:o(e.status===`ready`?o(`可用`):e.license_required?o(`待授权安装`):o(`待修复`))})]}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-ink-faint`,children:o(e.description)}),(0,K.jsxs)(`details`,{className:`mt-1.5 text-xs text-ink-faint`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer hover:text-ink-dim`,children:o(e.status===`ready`?o(`查看检查详情`):o(`查看原因与安装方式`))}),(0,K.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words leading-relaxed`,children:o(e.detail)}),e.path&&(0,K.jsx)(`p`,{className:`mt-1 break-all leading-relaxed`,children:e.path}),(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)}),o(e.id!==`python`&&t.actions.includes(`configure`)&&(0,K.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>{g(e.id),v(``)},className:`text-blue`,children:o(`使用已有安装`)}))]})]})]})]})},e.id)),o(h&&(0,K.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),await r(`configure`,{paths:{[h]:_}})&&(g(null),v(``))},className:`mt-3 rounded-lg bg-bg/70 p-3`,children:[(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(o(h===`dials`?`DIALS 环境目录`:h===`systre`?`Systre JAR 路径(需要已有 Java)`:`${h.toUpperCase()} 可执行文件路径`)),(0,K.jsx)(`input`,{required:!0,value:_,onChange:e=>v(e.target.value),className:`mt-2 w-full rounded-md border border-line bg-panel px-2 py-2 text-sm text-ink`})]}),(0,K.jsx)(`p`,{className:`mt-1.5 text-xs text-ink-faint`,children:o(`填写运行 Argus 的电脑上的路径,验证成功后生效。`)}),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,K.jsx)(`button`,{className:Jd,disabled:n,children:o(`验证并使用`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>g(null),children:o(`取消`)})]})]})),o(e?.checked&&(0,K.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[o(`最近检查 `),o(new Date(e.checked*1e3).toLocaleString()),o(` · 检查不调用模型`)]}))]})]})}function Xd(e){return e.installed&&e.enabled&&e.supported?`ready`:e.managed_by_host?!e.supported||e.operation?.status===`failed`?`unavailable`:`preparing`:`manual`}var Zd=e=>`正在准备 ${e} 工作台,首次需要几分钟`,Qd=e=>`${e} 暂时无法使用`,$d=e=>`flex h-9 min-w-0 flex-1 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`;function ef({plugins:e,compact:t=!1,pending:n,onLaunch:r,onManage:i}){let a=Kd(),o=e.filter(e=>Xd(e)!==`manual`),s=!e.length||e.some(e=>Xd(e)===`manual`);return(0,K.jsxs)(K.Fragment,{children:[o.map(e=>{let o=Xd(e),s=!t&&(0,K.jsx)(`button`,{type:`button`,onClick:i,"aria-label":a(`管理 ${e.name}`),title:a(`管理 ${e.name}`),className:`icon-control mr-1 shrink-0 p-1.5 text-ink-faint hover:text-ink`,children:(0,K.jsx)(Rt,{size:15})});if(o===`ready`)return(0,K.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:n===e.id,onClick:()=>r(e),title:e.name,"aria-label":e.name,className:`${$d(t)} disabled:opacity-60`,children:[(0,K.jsx)(Lt,{size:17,strokeWidth:1.5,className:`shrink-0 text-blue`}),!t&&(0,K.jsx)(`span`,{className:`truncate`,children:e.name}),!t&&(0,K.jsx)(Ot,{size:13,className:`shrink-0 text-ink-faint`})]}),s]},e.id);let c=o===`preparing`?Zd(e.name):Qd(e.name),l=o===`preparing`?e.operation?.progress:e.operation?.error||e.reason;return(0,K.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,K.jsxs)(`div`,{role:`status`,title:a(l||c),className:`flex min-w-0 flex-1 items-center text-sm text-ink-faint ${t?`h-9 justify-center`:`gap-2 px-3 py-1.5`}`,children:[o===`preparing`?(0,K.jsx)(W,{size:17,strokeWidth:1.5,className:`shrink-0 animate-spin`}):(0,K.jsx)(Lt,{size:17,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,K.jsxs)(`div`,{className:`min-w-0 leading-snug`,children:[(0,K.jsx)(`p`,{children:a(c)}),l&&(0,K.jsx)(`p`,{className:`mt-0.5 truncate text-xs`,children:a(l)})]})]}),s]},e.id)}),s&&(0,K.jsx)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,children:(0,K.jsxs)(`button`,{type:`button`,onClick:i,title:a(`插件`),"aria-label":a(`插件`),className:$d(t),children:[(0,K.jsx)(jt,{size:16,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,K.jsx)(`span`,{children:a(`插件`)})]})})]})}function tf({compact:e=!1}){let t=Kd(),{locale:n}=F(),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)([]),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(!1),_=(0,U.useRef)(null),v=a.some(e=>Xd(e)===`preparing`),y=a.length>0&&a.every(e=>e.managed_by_host);async function b(e){let n=await fetch(`/api/plugins`,{headers:I(),signal:e});if(!n.ok)throw Error(t(`无法读取插件列表`));let r=await n.json();e?.aborted||o(r.plugins)}(0,U.useEffect)(()=>{r||(m(null),g(!1))},[r]),(0,U.useEffect)(()=>{let e=new AbortController,t=()=>b(e.signal).catch(t=>{!e.signal.aborted&&r&&c(t.message)});r&&(_.current?.focus(),c(``),u(!0)),t().finally(()=>{e.signal.aborted||u(!1)});let n=r||v?window.setInterval(t,r?1500:4e3):0,a=e=>{e.key===`Escape`&&i(!1)};return r&&window.addEventListener(`keydown`,a),()=>{e.abort(),n&&window.clearInterval(n),window.removeEventListener(`keydown`,a)}},[r,v]);async function x(e,n,r){let i=e.setup?.windows_runtime;if(i&&!i.accepted&&[`install`,`update`,`repair`,i.action].includes(n)&&r?.accept_software_license!==!0)return m({pluginId:e.id,action:n}),g(!1),c(``),!1;f(e.id),c(``);try{let i=await fetch(`/api/plugins/${e.id}/${n===`launch`?`launch`:`manage/${n}`}`,{method:`POST`,headers:{...I(),"Content-Type":`application/json`},body:r?JSON.stringify(r):void 0}),a=await i.json();if(!i.ok)throw Error(a.detail||t(`插件操作未完成`));return n===`launch`?window.location.assign(a.url):await b(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{f(null)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ef,{plugins:a,compact:e,pending:d,onLaunch:e=>void x(e,`launch`),onManage:()=>i(!0)}),r&&(0,qd.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:()=>i(!1),children:(0,K.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`plugin-title`,onClick:e=>e.stopPropagation(),className:`max-h-[85vh] w-full max-w-xl overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h2`,{id:`plugin-title`,className:`text-lg font-semibold`,children:t(`插件`)}),(0,K.jsx)(`button`,{ref:_,type:`button`,"aria-label":t(`关闭插件列表`),className:`icon-control p-1.5`,onClick:()=>i(!1),children:(0,K.jsx)(Ie,{size:18})})]}),(0,K.jsx)(`p`,{className:`mb-6 mt-2 text-sm text-ink-faint`,children:t(t(y?`研究工具由服务方提供,沿用 Argus 的模型与执行后端。`:`按需安装研究工具,沿用 Argus 的模型与执行后端。`))}),t(s&&(0,K.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-ink-dim`,children:t(s)})),t(l&&(0,K.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`正在读取插件…`)})),t(!l&&!a.length&&(0,K.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`暂无可用插件`)})),t(a.map(e=>{let r=e.operation?.status===`running`||d===e.id,i=r||!e.supported,a=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;return(0,K.jsxs)(`article`,{className:`rounded-xl border border-line/70 p-4`,"data-testid":`plugin-${e.id}`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(Lt,{size:24,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-medium`,children:t(e.name)}),(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t(e.installed_version||e.version)})]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:t(e.description)})]})]}),(0,K.jsxs)(`div`,{className:`mt-4 text-xs text-ink-faint`,children:[t(e.installed?e.enabled?t(`已启用`):t(`已停用`):t(`未安装`)),t(` · 当前后端 `),t(Array.from(new Set(Object.values(e.backends))).join(` / `))]}),t(!e.supported&&(0,K.jsx)(`p`,{className:`mt-3 text-sm text-ink-dim`,children:t(e.reason)})),t(e.operation?.status===`running`&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-sm text-ink-dim`,children:[(0,K.jsx)(W,{size:14,className:`animate-spin`}),t(e.operation.progress)]})),t(e.operation?.status===`failed`&&(0,K.jsx)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-ink-dim`,children:t(e.operation.error)})),(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[t(!e.installed&&!e.managed_by_host&&(0,K.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`install`),children:[(0,K.jsx)(Le,{size:14}),t(`安装`)]})),t(e.installed&&e.enabled&&(0,K.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`launch`),children:[t(`打开工作台`),(0,K.jsx)(Ot,{size:14})]})),t(e.installed&&!e.enabled&&!e.managed_by_host&&(0,K.jsx)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`enable`),children:t(`启用`)})),t(e.update_available&&!e.managed_by_host&&(0,K.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`update`),children:[(0,K.jsx)(Pe,{size:14}),e.environment_update?t(`更新科学环境校验`):(0,K.jsxs)(K.Fragment,{children:[t(`更新至 `),t(e.version)]})]})),t(e.installed&&e.enabled&&!e.managed_by_host&&(0,K.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`disable`),children:t(`停用`)})),t(e.installed&&!e.managed_by_host&&(0,K.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`uninstall`),children:t(`卸载`)}))]}),p?.pluginId===e.id&&e.setup?.windows_runtime&&(0,K.jsxs)(`form`,{className:`mt-4 rounded-lg bg-bg/70 p-3`,onSubmit:async t=>{t.preventDefault(),!(!h||r)&&await x(e,p.action,{accept_software_license:!0})&&(m(null),g(!1))},children:[(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:t(`继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。`)}),(0,K.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:[t(e.setup.windows_runtime.notice),` `,(0,K.jsx)(`a`,{href:e.setup.windows_runtime.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:t(`官方安装说明 ↗`)})]}),(0,K.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`mt-0.5`}),t(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,K.jsx)(`button`,{type:`submit`,className:a,disabled:r||!h,children:t(`同意并继续`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,disabled:r,onClick:()=>{m(null),g(!1)},children:t(`取消`)})]})]}),(0,K.jsx)(`p`,{className:`mt-4 text-xs leading-relaxed text-ink-faint`,children:t(e.installed?t(`原生会话输入 ${e.command||``} 可启用后台工具。卸载保留会话、研究数据和科学软件。`):t(`首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。`))}),t(e.rights_notice&&(0,K.jsx)(`p`,{className:`mt-3 text-[10px] leading-relaxed text-ink-faint`,"data-testid":`plugin-rights-notice`,children:t(n===`zh-CN`&&e.rights_notice_zh||e.rights_notice)})),t(e.installed&&e.setup&&(0,K.jsx)(Yd,{health:e.health,setup:e.setup,running:r,platform:e.platform,machine:e.machine,act:(t,n)=>x(e,t,n)}))]},e.id)}))]})}),document.body)]})}var nf=[`all`,`installed`,`available`,`builtin`],rf=[`install`,`update`,`enable`,`disable`,`uninstall`],af=new Set([`install`,`update`,`uninstall`]),of={query:``,kind:`all`,tag:null};function sf(e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}){return e.VITE_ARGUS_HOSTED_TRIAL===`1`}function cf(e,t){switch(t){case`all`:return!0;case`installed`:return e===`installed`||e===`package`;case`available`:return e===`available`;case`builtin`:return e===`builtin`}}function lf(e,t){let n=t.trim().toLowerCase();return!n||[e.name,e.purpose,e.purpose_zh??``,...e.routing_path??[],...e.tags,...e.requires].join(` +`).toLowerCase().includes(n)}function uf(e,t){return e.filter(e=>cf(e.kind,t.kind)&&(!t.tag||e.tags.includes(t.tag))&&(!t.routingPath||(e.routing_path??[]).join(`/`)===t.routingPath||(e.routing_path??[]).join(`/`).startsWith(`${t.routingPath}/`))&&lf(e,t.query))}function df(e){let t=new Set;for(let n of e){let e=n.routing_path??[];for(let n=1;n<=e.length;n++)t.add(e.slice(0,n).join(`/`))}return[...t].sort()}function ff(e){let t=new Set;for(let n of e)for(let e of n.tags)e.trim()&&t.add(e.trim());return[...t].sort((e,t)=>e.localeCompare(t))}function pf(e,t){let n=t||e.managed_by_host;return e.actions.filter(e=>rf.includes(e)&&!(n&&af.has(e)))}var mf=e=>`verticals.action.${e}`,hf=e=>`verticals.kind.${e}`,gf=e=>`verticals.filter.${e}`,_f=e=>`verticals.operation.${e}`;function vf(e,t){return t===`zh-CN`&&e.purpose_zh&&e.purpose_zh.trim()?e.purpose_zh:e.purpose}function yf(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function bf(e){if(!e||e.status!==`running`)return null;let t=Number(e.progress);return!Number.isFinite(t)||t<=0?null:Math.max(0,Math.min(100,Math.round(t)))}var xf=e=>e.operation?.status===`running`;function Sf(e){return e.some(xf)}function Cf(e,t){return e?t?1500:4e3:t?4e3:0}function wf(e){if(e instanceof j){if(e.detail)return e.detail;let t=/^[A-Z]+ \S+ → \S+: ([\s\S]+)$/.exec(e.message);return t?t[1]:``}return e instanceof Error?e.message:String(e??``)}function Tf(e){return e instanceof j&&e.status===409}function Ef(e){return e instanceof j&&e.status===404}function Df(e,t){return Array.isArray(e)&&e.includes(t)}function Of(e){return new Set(e.map(e=>e.name))}var kf=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`,Af=e=>`rounded-full border px-2.5 py-0.5 text-xs transition-colors ${e?`border-blue/60 bg-blue/10 text-blue`:`border-line text-ink-dim hover:border-blue/40 hover:text-ink`}`,jf=e=>`rounded px-1.5 py-0.5 text-[10px] font-semibold ${e===`ok`?`bg-ok/10 text-ok`:e===`warn`?`bg-warn/10 text-warn`:e===`blue`?`bg-blue/10 text-blue`:`bg-line text-ink-dim`}`,Mf={install:Le,update:Pe,enable:qt,disable:Kt,uninstall:Zt};function Nf(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}catch{return n.toISOString()}}function Pf({compact:e=!1,onOpen:t}){let{t:n}=F();return(0,K.jsxs)(`button`,{type:`button`,onClick:t,title:n(`verticals.entry`),"aria-label":n(`verticals.entry`),"data-testid":`vertical-store-entry`,className:`mx-2 my-1 flex h-9 shrink-0 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`,children:[(0,K.jsx)(Xt,{size:17,strokeWidth:1.5}),!e&&(0,K.jsx)(`span`,{children:n(`verticals.entry`)})]})}function Ff({row:e,locale:t,hosted:n,busy:r,failure:i,known:a,onAct:o,onJump:s,onTag:c}){let{t:l}=F(),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),m=xf(e),h=r||m,g=pf(e,n),_=e.operation,v=bf(_),y=e=>rf.includes(e)?l(mf(e)):e,b=_&&rf.includes(_.action)?l(_f(_.action)):l(`verticals.operationRunning`),x=e.kind===`installed`?`ok`:e.kind===`available`?`neutral`:`blue`,S=async(t=!1)=>{d(!1),await o(e,`uninstall`,t?{force:!0}:void 0)};return(0,K.jsxs)(`article`,{id:`vertical-${e.name}`,"data-testid":`vertical-${e.name}`,"data-kind":e.kind,tabIndex:-1,className:`flex flex-col rounded-xl border border-line/70 p-4 outline-none focus-visible:border-blue/60`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(Ht,{size:22,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:jf(x),"data-testid":`vertical-kind`,children:l(hf(e.kind))}),e.kind!==`available`&&(0,K.jsx)(`span`,{className:jf(e.enabled?`ok`:`neutral`),children:e.enabled?l(`verticals.enabled`):l(`verticals.disabledState`)}),e.update_available&&(0,K.jsx)(`span`,{className:jf(`warn`),"data-testid":`vertical-update`,children:l(`verticals.updateAvailable`)})]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:vf(e,t)}),e.routing_path?.length?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:e.routing_path.join(` / `)}):null]})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-ink-faint`,children:[e.installed_version&&(0,K.jsx)(`span`,{children:l(`verticals.installedVersion`,{version:e.installed_version})}),e.version&&e.version!==e.installed_version&&(0,K.jsx)(`span`,{children:l(`verticals.catalogVersion`,{version:e.version})}),e.size_bytes!=null&&(0,K.jsxs)(`span`,{children:[l(`verticals.size`),` `,yf(e.size_bytes)]})]}),e.requires.length>0&&(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.requires`)}),e.requires.map(e=>a.has(e)&&s?(0,K.jsx)(`button`,{type:`button`,onClick:()=>s(e),"aria-label":l(`verticals.jumpTo`,{name:e}),title:l(`verticals.jumpTo`,{name:e}),className:`rounded-full border border-line px-2 py-0.5 font-mono text-ink-dim transition-colors hover:border-blue/60 hover:text-blue`,children:e},e):(0,K.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.shared.length>0&&(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.shared`)}),e.shared.map(e=>(0,K.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.tags.length>0&&(0,K.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.tags.map(e=>c?(0,K.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint transition-colors hover:text-blue`,children:[`#`,e]},e):(0,K.jsxs)(`span`,{className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint`,children:[`#`,e]},e))}),e.missing_python.length>0&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-start gap-2 rounded-lg bg-warn/10 p-2.5 text-xs leading-relaxed text-warn`,"data-testid":`vertical-missing-python`,children:[(0,K.jsx)(Qt,{size:14,className:`mt-0.5 shrink-0`}),(0,K.jsx)(`span`,{children:l(`verticals.missingPython`,{packages:e.missing_python.join(`, `)})})]}),!!e.runtime_issues?.length&&(0,K.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-runtime-issues`,children:l(`verticals.runtimeIssues`,{issues:e.runtime_issues.join(`; `)})}),!!e.install_issues?.length&&(0,K.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-install-issues`,children:l(`verticals.installIssues`,{issues:e.install_issues.join(`; `)})}),e.used_by.length>0&&(0,K.jsxs)(`div`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:()=>p(e=>!e),className:`inline-flex items-center gap-1 transition-colors hover:text-ink`,"data-testid":`vertical-used-by`,children:[e.used_by.length===1?l(`verticals.usedByOne`):l(`verticals.usedBy`,{count:e.used_by.length}),f?(0,K.jsx)(Nt,{size:12}):(0,K.jsx)(Me,{size:12})]}),f&&(0,K.jsx)(`ul`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono`,children:e.used_by.map(e=>(0,K.jsx)(`li`,{className:`rounded bg-bg px-1.5 py-0.5`,children:e},e))})]}),m&&_&&(0,K.jsxs)(`div`,{className:`mt-3`,"data-testid":`vertical-progress`,children:[(0,K.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-ink-dim`,children:[(0,K.jsx)(W,{size:14,className:`animate-spin`}),(0,K.jsx)(`span`,{children:b}),v!=null&&(0,K.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-ink-faint`,children:[v,`%`]})]}),(0,K.jsx)(`div`,{role:`progressbar`,"aria-label":b,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":v??void 0,className:`mt-1.5 h-1 overflow-hidden rounded bg-line`,children:v==null?(0,K.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`}):(0,K.jsx)(`div`,{className:`h-full rounded bg-blue transition-[width] duration-500`,style:{width:`${v}%`}})}),_.message&&(0,K.jsx)(`p`,{className:`mt-1 break-words text-xs text-ink-faint`,children:_.message})]}),_?.status===`failed`&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-err`,"data-testid":`vertical-operation-failed`,children:[l(`verticals.operationFailed`,{action:y(_.action)}),_.message?` — ${_.message}`:``]}),i&&(0,K.jsxs)(`div`,{role:`alert`,className:`mt-3 rounded-lg border border-err/30 bg-err/5 p-2.5 text-sm text-ink-dim`,"data-testid":`vertical-failure`,children:[(0,K.jsx)(`p`,{className:`break-words`,children:i.text}),i.offerForce&&(0,K.jsxs)(`button`,{type:`button`,className:`${kf} mt-2 border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(!0),children:[(0,K.jsx)(Zt,{size:14}),l(`verticals.removeAnyway`)]})]}),g.length>0&&(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:g.map(t=>{let n=Mf[t];if(t===`uninstall`)return u?(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`${kf} border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(),"data-testid":`vertical-confirm-uninstall`,children:[(0,K.jsx)(Zt,{size:14}),l(`verticals.confirmUninstall`)]}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint hover:text-ink`,onClick:()=>d(!1),children:l(`common.cancel`)}),(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:l(`verticals.confirmUninstallHint`,{name:e.name})})]},t):(0,K.jsxs)(`button`,{type:`button`,className:kf,disabled:h,onClick:()=>d(!0),"data-action":t,children:[(0,K.jsx)(n,{size:14}),l(mf(t))]},t);let r=t===`update`&&e.version?l(`verticals.updateTo`,{version:e.version}):l(mf(t));return(0,K.jsxs)(`button`,{type:`button`,className:kf,disabled:h,onClick:()=>void o(e,t),"data-action":t,children:[(0,K.jsx)(n,{size:14}),r]},t)})})]})}function If({payload:e,filter:t,onFilter:n,hosted:r,supported:i,loading:a,refreshing:o,error:s,pending:c,failures:l,onAct:u,onRefresh:d,onJump:f}){let{t:p,locale:m}=F(),h=e?.verticals??[],g=(0,U.useMemo)(()=>ff(h),[h]),_=(0,U.useMemo)(()=>df(h),[h]),v=(0,U.useMemo)(()=>Of(h),[h]),y=(0,U.useMemo)(()=>uf(h,t),[h,t]),b=t.query.trim()!==``||t.kind!==`all`||t.tag!==null||!!t.routingPath,x=e?.catalog;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:p(r?`verticals.hostedNote`:`verticals.intro`)}),i===!1&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 rounded-lg border border-line bg-bg/70 p-3 text-sm text-ink-dim`,"data-testid":`vertical-store-too-old`,children:p(`verticals.tooOld`)}),i!==!1&&(0,K.jsxs)(K.Fragment,{children:[x&&(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-faint`,"data-testid":`vertical-catalog`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,title:x.source,children:p(`verticals.catalogSource`,{source:x.source})}),x.release_tag&&(0,K.jsx)(`span`,{className:`rounded bg-bg px-1.5 py-0.5 font-mono`,children:p(`verticals.catalogRelease`,{tag:x.release_tag})}),(0,K.jsx)(`span`,{children:x.fetched_at?p(`verticals.catalogFetched`,{time:Nf(x.fetched_at,m)}):p(`verticals.catalogNever`)}),(0,K.jsxs)(`button`,{type:`button`,className:`${kf} ml-auto`,disabled:o||a,onClick:d,"data-testid":`vertical-refresh-catalog`,children:[(0,K.jsx)(Pe,{size:14,className:o?`animate-spin`:``}),p(o?`verticals.refreshing`:`verticals.refreshCatalog`)]})]}),x?.error&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-3 rounded-lg border border-warn/40 bg-warn/10 p-2.5 text-sm text-warn`,"data-testid":`vertical-catalog-error`,children:p(`verticals.catalogError`,{error:x.error})}),s&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-err`,"data-testid":`vertical-store-error`,children:s}),(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-line bg-bg px-2.5 focus-within:border-blue/60`,children:[(0,K.jsx)(Ye,{size:14,className:`shrink-0 text-ink-faint`}),(0,K.jsx)(`span`,{className:`sr-only`,children:p(`verticals.search`)}),(0,K.jsx)(`input`,{type:`search`,value:t.query,onChange:e=>n({...t,query:e.target.value}),placeholder:p(`verticals.searchPlaceholder`),className:`min-w-0 flex-1 bg-transparent text-sm text-ink outline-none placeholder:text-ink-faint`})]}),(0,K.jsx)(`div`,{role:`group`,"aria-label":p(`verticals.kindFilter`),className:`flex flex-wrap gap-1`,children:nf.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":t.kind===e,onClick:()=>n({...t,kind:e}),className:`h-8 rounded-md px-2.5 text-xs font-medium transition-colors ${t.kind===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:p(gf(e))},e))})]}),_.length>0&&(0,K.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink-faint`,children:[p(`verticals.routingPath`),(0,K.jsxs)(`select`,{className:`rounded-md border border-line bg-bg p-1.5`,value:t.routingPath??``,onChange:e=>n({...t,routingPath:e.target.value}),children:[(0,K.jsx)(`option`,{value:``,children:p(`verticals.filter.all`)}),_.map(e=>(0,K.jsx)(`option`,{value:e,children:e.replaceAll(`/`,` / `)},e))]})]}),(g.length>0||b)&&(0,K.jsxs)(`div`,{role:`group`,"aria-label":p(`verticals.tagFilter`),className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[g.map(e=>(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":t.tag===e,className:Af(t.tag===e),onClick:()=>n({...t,tag:t.tag===e?null:e}),children:[`#`,e]},e)),b&&(0,K.jsx)(`button`,{type:`button`,className:`ml-1 text-xs text-ink-faint hover:text-ink`,onClick:()=>n(of),children:p(`verticals.clearFilters`)})]}),h.length>0&&(0,K.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`verticals.count`,{shown:y.length,total:h.length})}),a&&!e&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.loading`)}),e&&h.length===0&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.none`)}),h.length>0&&y.length===0&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.noMatches`)}),y.length>0&&(0,K.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,"data-testid":`vertical-grid`,children:y.map(e=>(0,K.jsx)(Ff,{row:e,locale:m,hosted:r,busy:c===e.name,failure:l[e.name],known:v,onAct:u,onJump:f,onTag:e=>n({...t,tag:e})},e.name))})]})]})}function Lf({open:e,onClose:t}){let{t:n}=F(),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)({}),[_,v]=(0,U.useState)(of),y=(0,U.useRef)(null),b=(0,U.useRef)(t);b.current=t;let x=(0,U.useRef)(n);x.current=n;let S=Sf(r?.verticals??[]),C=!!r?.host.managed_by_host||sf();(0,U.useEffect)(()=>{if(!e||a!==null)return;let t=!1;return P.meta().then(e=>{t||o(Df(e.capabilities,N))},()=>{t||o(!0)}),()=>{t=!0}},[e,a]),(0,U.useEffect)(()=>{if(a!==!0||!e&&!S)return;let t=new AbortController,n=()=>P.verticals(t.signal).then(e=>{t.signal.aborted||(i(e),f(e=>e?.source===`load`?null:e))},n=>{t.signal.aborted||(Ef(n)?o(!1):e&&f({text:x.current(`verticals.loadFailed`),source:`load`}))});e&&c(!0),n().finally(()=>{t.signal.aborted||c(!1)});let r=Cf(e,S),s=r?window.setInterval(n,r):0;return()=>{t.abort(),s&&window.clearInterval(s)}},[e,S,a]),(0,U.useEffect)(()=>{if(!e){g({}),f(e=>e?.source===`refresh`?null:e);return}y.current?.focus();let t=e=>{e.key===`Escape`&&b.current()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let w=(0,U.useCallback)(async()=>{try{i(await P.verticals()),f(e=>e?.source===`load`?null:e)}catch(e){Ef(e)?o(!1):f({text:x.current(`verticals.loadFailed`),source:`load`})}},[]),T=(0,U.useCallback)(async(e,t,n={})=>{m(e.name),g(t=>{let{[e.name]:n,...r}=t;return r});try{return await P.manageVertical(e.name,t,n),await w(),!0}catch(r){let i=wf(r)||x.current(`verticals.actionFailed`),a=t===`uninstall`&&Tf(r)&&!n.force;return g(t=>({...t,[e.name]:{text:i,offerForce:a}})),!1}finally{m(null)}},[w]),E=(0,U.useCallback)(async()=>{u(!0),f(null);try{i(await P.refreshVerticalCatalog())}catch(e){f({text:wf(e)||x.current(`verticals.loadFailed`),source:`refresh`})}finally{u(!1)}},[]),D=(0,U.useCallback)(e=>{v(of),!(typeof document>`u`)&&window.setTimeout(()=>{let t=document.getElementById(`vertical-${e}`);t?.scrollIntoView?.({block:`nearest`,behavior:`smooth`}),t?.focus?.()},0)},[]);return e?(0,qd.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:t,children:(0,K.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`vertical-store-title`,onClick:e=>e.stopPropagation(),className:`flex max-h-[85vh] w-full max-w-4xl flex-col overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl scroll-thin`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`h2`,{id:`vertical-store-title`,className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Xt,{size:20,strokeWidth:1.5,className:`text-blue`}),n(`verticals.title`)]}),(0,K.jsx)(`button`,{ref:y,type:`button`,"aria-label":n(`verticals.close`),className:`icon-control p-1.5`,onClick:t,children:(0,K.jsx)(Ie,{size:18})})]}),(0,K.jsx)(If,{payload:r,filter:_,onFilter:v,hosted:C,supported:a,loading:s,refreshing:l,error:d?.text??``,pending:p,failures:h,onAct:T,onRefresh:()=>void E(),onJump:D})]})}),document.body):null}function Rf(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)||e}function zf(e,t,n){if(e.length===0)return`local`;let r=n.trim(),i=r?e.filter(e=>e.launch_cwd?.trim()===r):[];return i.length===0||t&&!i.some(e=>e.id===t)?`all`:`local`}function Bf({projects:e,activeId:t,activeWork:n,localCwd:i,onSelect:o,onPrefetch:c,onManage:l,onResume:u,resumingId:p,onOpenPanel:m,onOpenLearning:h,onOpenVerticals:y,onNew:b,loading:x,creating:S=!1,error:C,onRetry:w,mobileOpen:T=!1,collapsed:E=!1,onToggleCollapse:D,themeMode:O,onCycleTheme:k}){let{t:A,locale:j}=F(),[M,N]=(0,U.useState)(`local`),P=(0,U.useRef)(!1),[I,ee]=(0,U.useState)(``),[te,L]=(0,U.useState)(()=>new Set),ne=E&&!T,re=i.trim(),ie=(0,U.useMemo)(()=>re?e.filter(e=>e.launch_cwd?.trim()===re):[],[re,e]);(0,U.useEffect)(()=>{P.current||x||e.length===0||(P.current=!0,N(zf(e,t,re)))},[t,x,re,e]);let ae=M===`local`?ie:e,oe=I.trim()?Kl(ae,I):ae,se=(0,U.useMemo)(()=>{if(M===`local`)return oe.length>0?[[re||`Local`,oe]]:[];let e=new Map;return oe.forEach(t=>{let n=t.launch_cwd?.trim()||A(`common.unassigned`),r=e.get(n)??[];r.push(t),e.set(n,r)}),[...e.entries()]},[re,M,oe]),ce=e=>te.has(e)&&!I.trim();return(0,K.jsxs)(Ge,{mobileOpen:T,collapsed:E,children:[(0,K.jsx)(`div`,{className:`chrome-seam-surface flex h-12 shrink-0 items-center border-b border-line/50 ${ne?`justify-center`:`justify-between px-4`}`,children:ne?(0,K.jsx)(vt,{size:22,compact:!0}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(vt,{size:24}),(0,K.jsx)(`button`,{type:`button`,onClick:D,"aria-label":A(`sidebar.collapse`),title:`${A(`sidebar.collapse`)} · Ctrl/⌘ B`,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,K.jsx)(s,{icon:_,className:`h-3.5 w-3.5`})})]})}),ne?(0,K.jsx)(`div`,{className:`flex h-12 shrink-0 items-center justify-center`,children:(0,K.jsx)(`button`,{type:`button`,onClick:D,"aria-label":A(`sidebar.expand`),title:`${A(`sidebar.expand`)} · Ctrl/⌘ B`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink`,children:(0,K.jsx)(s,{icon:f,className:`h-3.5 w-3.5`})})}):null,ne?(0,K.jsx)(tf,{compact:!0}):null,ne&&h?(0,K.jsx)(Kn,{onOpen:h,compact:!0}):null,ne&&y?(0,K.jsx)(Pf,{compact:!0,onOpen:y}):null,ne?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`nav`,{"aria-label":j===`zh-CN`?`工具与知识`:`Tools and knowledge`,"data-sidebar-resources":!0,className:`shrink-0 overflow-y-auto overscroll-contain border-b border-line/50 px-2 py-2 scroll-thin [&>section]:mx-2 [&>section]:border-0 [&>section]:py-0 [&>section>div>button:first-child]:px-3`,style:{maxHeight:`min(40dvh, 360px)`},children:[(0,K.jsx)(tf,{}),h&&(0,K.jsx)(Kn,{onOpen:h}),y?(0,K.jsx)(Pf,{onOpen:y}):null]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pb-1 pt-3`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:j===`zh-CN`?`项目`:`Projects`}),ie.length>0&&ie.lengthN(e.target.value),className:`min-w-0 bg-transparent text-xs text-ink-faint`,children:[(0,K.jsx)(`option`,{value:`local`,children:A(`common.local`)}),(0,K.jsx)(`option`,{value:`all`,children:A(`common.all`)})]}):null,(0,K.jsx)(`button`,{type:`button`,onClick:b,disabled:S,"aria-label":A(`sidebar.create`),title:A(`sidebar.create`),className:`ml-auto flex h-8 items-center justify-center rounded-md px-2 text-xs text-ink-dim hover:bg-bg disabled:opacity-40`,children:S?`…`:j===`zh-CN`?`+ 新建`:`+ New`})]}),(0,K.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,K.jsx)(`label`,{className:`sr-only`,htmlFor:`daemon-search`,children:A(`sidebar.find`)}),(0,K.jsxs)(`div`,{className:`flex items-center rounded-md border border-line/60 bg-bg/60 px-2 focus-within:border-blue/60`,children:[(0,K.jsx)(`input`,{id:`daemon-search`,value:I,onChange:e=>ee(e.target.value),placeholder:A(`sidebar.find`),className:`h-8 min-w-0 flex-1 bg-transparent text-xs text-ink outline-none placeholder:text-ink-faint`}),I?(0,K.jsx)(`button`,{type:`button`,"aria-label":A(`sidebar.clearSearch`),onClick:()=>ee(``),className:`px-1 text-sm text-ink-faint hover:text-ink`,children:`×`}):null]})]}),(0,K.jsxs)(`div`,{className:`mobile-scroll-region min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-3 pb-3 scroll-thin`,children:[x&&e.length===0?(0,K.jsx)(`div`,{className:`px-1 py-3 text-xs text-ink-faint`,children:A(`common.loading`)}):null,C?(0,K.jsx)(`button`,{type:`button`,onClick:w,className:`mb-2 w-full rounded-md bg-err/5 px-3 py-2 text-left text-xs text-err`,children:A(`sidebar.refreshFailed`)}):null,!x&&!C&&oe.length===0?(0,K.jsxs)(`div`,{className:`px-1 py-4 text-xs text-ink-faint`,children:[(0,K.jsx)(`div`,{children:I.trim()?A(`sidebar.noMatches`,{query:I.trim()}):A(`sidebar.noSessions`)}),I.trim()?(0,K.jsx)(`button`,{type:`button`,onClick:()=>ee(``),className:`mt-2 text-xs text-ink-dim underline underline-offset-2 hover:text-ink`,children:A(`sidebar.clearSearch`)}):null]}):null,se.map(([e,i])=>(0,K.jsxs)(`section`,{className:`mb-1 last:mb-0`,children:[i.length>1&&se.length>1?(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":!ce(e),title:e,onClick:()=>L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),className:`mb-1 flex h-7 w-full items-center gap-2 rounded-md px-1.5 text-left text-[11px] font-medium text-ink-faint hover:bg-bg/70 hover:text-ink-dim`,children:[(0,K.jsx)(s,{icon:r,className:`h-2.5 w-2.5 transition-transform ${ce(e)?`-rotate-90`:``}`}),(0,K.jsx)(s,{icon:v,className:`h-3 w-3`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Rf(e)})]}):null,i.length===1||se.length===1||!ce(e)?i.map(e=>{let r=e.id===t,i=r&&n?.sessionId===e.id?n:void 0,a=i?Kr(i.status,j,i.connected):void 0,f=Bl(e),m=f?(e.label||e.display_name||``).trim():e.objective.trim()||A(`sidebar.unnamedSession`),h=e.daemon_alive&&e.daemon_protocol_compatible===!1,_=h&&e.daemon_protocol_error===`daemon release is incompatible with WebAPI release`,v=h&&!_,y=!e.daemon_alive&&e.last_active>0&&!!e.workdir?.trim();return(0,K.jsxs)(`div`,{"data-active":r?`true`:`false`,onPointerEnter:()=>{r||c?.(e.id)},className:`session-card group relative mb-0.5 h-14 w-full rounded-md transition-colors duration-150 ease-panel ${r?`text-ink`:`text-ink-dim hover:text-ink`}`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`absolute left-0 transition-colors ${r?`inset-y-1 w-px bg-blue`:`inset-y-2 w-px bg-transparent group-hover:bg-ink-faint/30`}`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>o(e.id),onFocus:()=>{r||c?.(e.id)},"aria-current":r?`page`:void 0,title:`${m}${!f&&m!==e.id?` · ${e.id}`:``}${e.objective&&e.objective!==m?` — ${e.objective}`:``}`,className:`flex h-14 w-full min-w-0 flex-col justify-center px-2.5 text-left ${y?`pr-[4.75rem]`:`pr-10`}`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(Ze,{ok:e.daemon_alive&&!v,title:v?A(`sidebar.updateRequired`):e.daemon_alive?A(`sidebar.daemonAlive`):A(`sidebar.stopped`)}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:m})]}),(0,K.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5 pl-3.5 text-[11px] text-ink-faint`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate ${v?`text-warn`:``}`,title:a,"data-session-work-state":i?.status.state,children:v?A(`sidebar.updateRequired`):a??(e.daemon_alive?A(`sidebar.runningFor`,{uptime:ut(e.uptime_seconds)}):e.last_active>0?A(`sidebar.lastActive`,{time:H(e.last_active,j)}):A(`sidebar.stopped`))}),_&&(0,K.jsx)(`span`,{title:A(`sidebar.updateAvailableHint`),className:`shrink-0 rounded border border-line px-1 text-[10px] leading-4`,children:A(`sidebar.updateAvailable`)})]})]}),y&&u?(0,K.jsx)(`button`,{type:`button`,disabled:p!=null,onClick:t=>{t.stopPropagation(),u(e.id)},"aria-label":A(`sidebar.resume`),title:A(`sidebar.resumeHint`,{workdir:e.workdir??``}),className:`absolute right-9 top-3 flex h-8 w-8 items-center justify-center rounded-md text-blue opacity-100 hover:bg-blue/10 disabled:opacity-40 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:p===e.id?`…`:(0,K.jsx)(s,{icon:d,className:`h-3 w-3`})}):null,(0,K.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),l(e.id)},"aria-label":A(`sidebar.manage`,{name:m}),title:A(`sidebar.manageHint`),className:`absolute right-1 top-3 flex h-8 w-8 items-center justify-center rounded-md text-ink-faint opacity-100 transition-opacity hover:bg-panel-raised hover:text-ink sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,K.jsx)(s,{icon:g,className:`h-4 w-4`})})]},e.id)}):null]},e))]}),(0,K.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between border-t border-line/50 px-4 py-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>m(`config`),className:`icon-control flex h-8 w-8 items-center justify-center`,"aria-label":A(`sidebar.openSettings`),title:A(`common.settings`),children:(0,K.jsx)(s,{icon:a,className:`h-3.5 w-3.5`})}),null,(0,K.jsx)(rt,{themeMode:O,onCycleTheme:k})]})]})]})}var Vf=new Set([`done`,`completed`,`failed`,`skipped`]);function Hf(e){return Vf.has(e.status)}function Uf(e,t){return e.filter(e=>Hf(e)===t)}var Wf={in_progress:`rgb(var(--blue))`,running:`rgb(var(--blue))`,pending:`rgb(var(--ink-faint))`,queued:`rgb(var(--ink-faint))`,done:`rgb(var(--blue))`,completed:`rgb(var(--blue))`,blocked:`rgb(var(--err))`,failed:`rgb(var(--err))`};function Gf({items:e,onDispose:t,onStop:n,onInspect:r,busy:i,readOnly:a=!1}){let{t:o}=F(),[s,c]=(0,U.useState)(!1),l=Uf(e,!1),u=Uf(e,!0),d=s?u:l;return(0,K.jsxs)(`section`,{className:`card flex flex-col ${d.length>0?`min-h-0 flex-1`:`shrink-0`}`,children:[(0,K.jsx)(et,{title:o(`panel.backlog`),right:(0,K.jsx)(`button`,{className:`text-[10px] text-ink-faint transition-colors hover:text-ink`,onClick:()=>c(e=>!e),children:o(s?`backlog.active`:`backlog.history`,{count:s?l.length:u.length})})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[d.length===0&&(0,K.jsx)(Ve,{children:o(s?`backlog.noHistory`:`backlog.empty`)}),d.map(e=>{let s=Wf[e.status]??`rgb(var(--ink-faint))`,c=e.iterate;return(0,K.jsx)(`div`,{className:`group border-b border-line/60 px-3 py-2 last:border-0`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>r?.(e.id),disabled:!r,className:`block max-w-full truncate text-left text-xs font-medium text-ink enabled:hover:text-blue-sky enabled:focus-visible:outline-none enabled:focus-visible:underline`,title:r?o(`backlog.viewDetails`):void 0,children:e.title||e.objective}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[(0,K.jsx)(Je,{color:s,children:vn(e.status,o)}),typeof e.priority==`number`&&(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:bn(e.priority,o)}),c&&(0,K.jsxs)(`span`,{className:`text-[10px] text-blue-sky`,children:[`↻ `,o(`backlog.iterating`)]})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100`,children:[!a&&c&&(0,K.jsx)(B,{variant:`ghost`,onClick:()=>n(e.id),disabled:i,title:o(`backlog.stopIterating`),children:o(`backlog.stop`)}),!a&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{variant:`ghost`,onClick:()=>t(e.id,`done`),disabled:i,title:o(`backlog.markDone`),children:`✓`}),(0,K.jsx)(B,{variant:`ghost`,onClick:()=>t(e.id,`rm`),disabled:i,title:o(`backlog.remove`),children:`✕`})]})]})]})},e.id)})]})]})}var Kf={win:`rgb(var(--blue))`,milestone:`rgb(var(--blue))`,insight:`rgb(var(--ink-dim))`,decision:`rgb(var(--ink-dim))`,failure:`rgb(var(--err))`,note:`rgb(var(--ink-faint))`};function qf({entries:e}){let{t}=F(),n=[...e].reverse();return(0,K.jsxs)(`section`,{className:`card flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(et,{title:t(`panel.journal`),right:(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.length})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[e.length===0&&(0,K.jsx)(Ve,{children:`no journal entries yet`}),n.map(e=>{let t=Kf[e.kind]??`rgb(var(--ink-faint))`,n=String(e.extra?.pricing_status??``),r=e.extra&&Object.prototype.hasOwnProperty.call(e.extra,`cost_usd`)?e.extra.cost_usd:e.cost_usd,i=typeof r==`number`&&r>0?`${V(r)}${n===`partial`||n===`unpriced`?`+`:``}`:n===`partial`||n===`unpriced`?n:``;return(0,K.jsxs)(`div`,{className:`border-b border-line/60 px-3 py-2 last:border-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full`,style:{background:t}}),(0,K.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide`,style:{color:t},children:e.kind}),(0,K.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:mt(e.ts)})]}),(0,K.jsx)(`div`,{className:`mt-1 text-xs font-medium text-ink`,children:e.title}),e.summary&&(0,K.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-snug text-ink-dim`,children:e.summary}),(0,K.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(e.tags??[]).slice(0,4).map(e=>(0,K.jsx)(`span`,{className:`rounded bg-line/60 px-1 text-[9px] text-ink-faint`,children:e},e)),i?(0,K.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:i}):null]})]},e.id)})]})]})}function Jf(e){return e==null?``:e<3?`now`:e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h`}function Yf({roles:e}){let{t}=F(),n=new Map(e.map(e=>[e.role,e])),r=He.map(e=>n.get(e)).filter(Boolean),i=e.filter(e=>!ot(e.role)),a=[...r,...i];return(0,K.jsxs)(`section`,{className:`card`,children:[(0,K.jsx)(et,{title:t(`panel.roles`)}),(0,K.jsx)(`div`,{children:a.map(e=>{let n=R.role[e.role]??R.info;return(0,K.jsxs)(`div`,{className:`grid grid-cols-[84px_minmax(0,1fr)_auto] items-center gap-2 border-b border-line/60 px-3 py-2 last:border-b-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{"data-role-dot":e.role,"aria-hidden":`true`,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{background:n}}),(0,K.jsx)(`span`,{className:`text-[11px] font-medium capitalize`,style:{color:e.active?n:R.inkDim},children:ot(e.role)?Ae(e.role,t):e.role})]}),(0,K.jsx)(`div`,{className:`min-w-0 truncate font-mono text-[10px] text-ink-faint`,title:e.model,children:e.model||`—`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-right`,children:[(0,K.jsx)(`span`,{className:`text-[10px]`,style:{color:e.active?R.ink:R.inkFaint},children:e.active?e.status||`active`:`idle`}),e.active&&Jf(e.age_s)&&(0,K.jsxs)(`span`,{className:`text-[10px] tabular-nums text-ink-faint`,children:[`· `,Jf(e.age_s)]}),e.effort&&(0,K.jsxs)(`span`,{className:`text-[10px]`,style:{color:ze(e.effort)},children:[`· `,e.effort]})]})]},e.role)})})]})}function Xf({open:e,snap:t,journal:n,busy:r,onClose:i,onDispose:a,onStop:o,onInspect:s}){let{t:c}=F();return(0,K.jsxs)(tt,{open:e,onClose:i,label:`Project inspector`,width:`max-w-6xl`,children:[(0,K.jsx)(Qe,{title:c(`panel.project`),sub:t.session.display_name||t.session.id}),(0,K.jsxs)(`div`,{className:`h-[68vh] min-h-0 space-y-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid lg:grid-cols-[minmax(0,1.4fr)_minmax(300px,0.8fr)] lg:gap-3 lg:space-y-0 lg:overflow-hidden`,children:[(0,K.jsx)(Gf,{items:t.backlog,onDispose:a,onStop:o,onInspect:s,busy:r}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,K.jsx)(Yf,{roles:t.roles}),(0,K.jsx)(qf,{entries:n})]})]})]})}var Zf=e=>e?new Date(e*1e3).toLocaleString():`—`;function Qf({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`rounded-md border border-line/70 bg-bg/40 px-3 py-2`,children:[(0,K.jsx)(`div`,{className:`text-[9px] font-semibold uppercase tracking-wider text-ink-faint`,children:e}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:t})]})}function $f({sid:e,itemId:t,onClose:n,onDone:r,onSkip:i,onStop:a,busy:o,readOnly:s=!1}){let{t:c}=F(),l=_e(e,t),u=l.data,d=u?Hf(u):!1,f=xn(u?.outcome,c);return(0,K.jsxs)(tt,{open:!!t,onClose:n,label:c(`task.details`),width:`max-w-3xl`,showClose:!1,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 border-b border-line px-4 py-3 sm:flex-nowrap sm:px-5`,children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink`,children:u?.title||c(`task.details`)}),u?(0,K.jsx)(Je,{children:vn(u.status,c)}):null]})}),!s&&u&&!d?(0,K.jsxs)(`div`,{className:`order-3 flex w-full shrink-0 items-center justify-end gap-1 sm:order-none sm:w-auto`,children:[u.iterate?(0,K.jsx)(B,{onClick:()=>a(u.id),disabled:o,children:c(`task.stopLoop`)}):null,(0,K.jsx)(B,{onClick:()=>r(u.id),disabled:o,children:c(`task.done`)}),(0,K.jsx)(B,{variant:`danger`,onClick:()=>i(u.id),disabled:o,children:c(`task.skip`)})]}):null,(0,K.jsx)(`button`,{type:`button`,"aria-label":c(`task.close`),onClick:n,className:`order-2 rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink sm:order-none`,children:`×`})]}),(0,K.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto p-4 scroll-thin sm:p-5`,children:[l.isLoading?(0,K.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,K.jsx)(Ue,{})}):null,l.isError?(0,K.jsx)(`div`,{className:`rounded-md border border-err/40 bg-err/5 p-3 text-xs text-err`,children:l.error.message}):null,u?(0,K.jsxs)(`div`,{className:`space-y-4`,children:[u.pending_question?(0,K.jsxs)(`div`,{className:`rounded-lg border border-warn/40 bg-warn/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-warn`,children:c(`task.waitingOnYou`)}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:u.pending_question})]}):null,(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.objective`)}),(0,K.jsx)(`div`,{className:`whitespace-pre-wrap rounded-lg border border-line bg-bg/50 p-3 text-sm leading-relaxed text-ink-dim`,children:u.objective||u.original_objective||c(`task.noObjective`)})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[(0,K.jsx)(Qf,{label:c(`task.priority`),value:bn(u.priority,c)}),(0,K.jsx)(Qf,{label:c(`task.started`),value:Zf(u.started_ts)}),(0,K.jsx)(Qf,{label:c(`task.finished`),value:Zf(u.finished_ts)})]}),f.length?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.outcome`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,K.jsx)(Je,{children:e},e))})]}):null,u.iterate||u.iteration_cycles_done||u.iteration_cost_usd?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.iteration`)}),(0,K.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,K.jsx)(Qf,{label:c(`task.mode`),value:u.iterate?c(`task.autoIterate`):c(`task.singlePass`)}),(0,K.jsx)(Qf,{label:c(`task.cycles`),value:`${u.iteration_cycles_done??0}/${u.iteration_max_cycles??`—`}`}),(0,K.jsx)(Qf,{label:c(`task.cost`),value:`$${(u.iteration_cost_usd??0).toFixed(2)}`})]})]}):null,u.last_error?(0,K.jsxs)(`section`,{className:`rounded-lg border border-err/30 bg-err/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:c(`task.lastError`)}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs leading-relaxed text-ink-dim`,children:u.last_error})]}):null,u.notes?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.notes`)}),(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-relaxed text-ink-dim`,children:u.notes})]}):null,u.tags?.length||u.deps?.length?(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(u.tags??[]).map(e=>(0,K.jsxs)(Je,{children:[`#`,e]},`tag-${e}`)),u.deps?.length?(0,K.jsx)(Je,{children:c(`task.dependsOnCount`,{count:u.deps.length})}):null]}):null]}):null]})]})}function ep({onPointerDown:e,onReset:t,onNudge:n,value:r,min:i=240,max:a=600,label:o=`Resize panel`}){return(0,K.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":o,"aria-valuenow":r,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:e,onDoubleClick:t,onKeyDown:e=>{e.key===`ArrowLeft`?(e.preventDefault(),n(-16)):e.key===`ArrowRight`?(e.preventDefault(),n(16)):e.key===`Home`&&(e.preventDefault(),t())},className:`group relative hidden w-2 shrink-0 cursor-col-resize items-center justify-center outline-none lg:flex`,children:(0,K.jsx)(`span`,{className:`h-full w-px bg-line/30 transition-colors duration-150 group-hover:bg-blue/70 group-focus:bg-blue/70`})})}var tp=[`handshake.service`,`handshake.project`,`handshake.ready`];function np(){let{t:e}=F(),t=(0,U.useRef)(null);return qe(t,(e,t)=>{if(t){e.set(`[data-handshake-line], [data-handshake-node]`,{opacity:1,scale:1,clearProps:`transform`});return}e.to(`[data-handshake-mark]`,{scale:1.055,duration:.75,ease:`sine.inOut`,repeat:-1,yoyo:!0,transformOrigin:`50% 50%`}),e.timeline({repeat:-1,repeatDelay:.25}).fromTo(`[data-handshake-line]`,{scaleX:0,opacity:.25,transformOrigin:`0% 50%`},{scaleX:1,opacity:.8,duration:.9,ease:`power2.inOut`}).fromTo(`[data-handshake-node]`,{autoAlpha:.25,scale:.72},{autoAlpha:1,scale:1,duration:.28,stagger:.16,ease:`back.out(1.8)`},.12).to(`[data-handshake-node]`,{autoAlpha:.35,duration:.3,stagger:.08},`+=0.35`)}),(0,K.jsxs)(`div`,{ref:t,role:`status`,"aria-label":e(`handshake.connecting`),className:`w-full max-w-xl px-6 text-center`,children:[(0,K.jsx)(`div`,{"data-handshake-mark":!0,className:`handshake-mark glass-card mx-auto flex h-16 w-16 items-center justify-center rounded-3xl text-blue shadow-glow sm:h-20 sm:w-20`,children:(0,K.jsx)(_t,{size:48,className:`text-ink`})}),(0,K.jsxs)(`div`,{className:`relative mx-auto mt-8 h-10 max-w-sm sm:max-w-md`,children:[(0,K.jsx)(`div`,{className:`absolute left-[10%] right-[10%] top-3 h-px bg-line/80`}),(0,K.jsx)(`div`,{"data-handshake-line":!0,className:`handshake-line absolute left-[10%] right-[10%] top-3 h-px`}),(0,K.jsx)(`div`,{className:`relative flex justify-between`,children:tp.map(t=>(0,K.jsxs)(`div`,{className:`flex w-20 flex-col items-center gap-2.5`,children:[(0,K.jsx)(`span`,{"data-handshake-node":!0,className:`handshake-node h-6 w-6 rounded-full border ring-4 ring-bg`,children:(0,K.jsx)(`span`,{className:`m-auto mt-[7px] block h-2 w-2 rounded-full bg-blue`})}),(0,K.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:e(t)})]},t))})]}),(0,K.jsx)(`p`,{className:`mt-9 text-base font-medium text-ink-dim`,children:e(`handshake.title`)}),(0,K.jsx)(`p`,{className:`mt-1.5 text-sm text-ink-faint`,children:e(`handshake.detail`)})]})}function rp({loading:e,hasProjects:t,error:n,onRetry:r,onNew:i,onChoose:a,canCreate:o}){let{t:s,locale:c}=F();return(0,K.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-4 px-6 text-center`,children:[e?(0,K.jsx)(np,{}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h1`,{className:`text-2xl font-semibold text-ink`,children:c===`zh-CN`?t?`继续你的项目`:`开始一个项目`:t?`Continue your work`:`Start a project`}),(0,K.jsx)(`p`,{className:`max-w-md text-sm leading-relaxed ${n?`text-err`:`text-ink-faint`}`,children:n||s(t?`landing.selectOrCreate`:`landing.noSessions`)})]}),!e&&(0,K.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[n?(0,K.jsx)(B,{onClick:r,variant:`danger`,children:s(`common.retry`)}):null,t?(0,K.jsx)(B,{onClick:a,children:s(`landing.select`)}):o?(0,K.jsx)(B,{onClick:i,variant:`primary`,children:s(`landing.new`)}):null,!t&&!n?(0,K.jsx)(`span`,{className:`lg:hidden`,children:(0,K.jsx)(B,{onClick:a,children:s(`landing.menu`)})}):null]})]})}function ip({active:e,onSelect:t,onOpenSessions:n,sidebarOpen:r=!1}){let{t:a}=F(),l=[{id:`map`,label:a(`mobile.map`),icon:p},{id:`activity`,label:a(`mobile.activity`),icon:o},{id:`workbench`,label:a(`mobile.workbench`),icon:i},{id:`preview`,label:a(`mobile.preview`),icon:c}];return(0,K.jsxs)(`nav`,{"aria-label":a(`mobile.views`),className:`mobile-tabbar glass-panel glass-panel--raised fixed inset-x-0 bottom-0 z-40 items-stretch border-t border-line/60 lg:hidden ${r?`hidden`:`flex`}`,children:[n?(0,K.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":a(`topbar.openSessions`),className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 text-ink-faint active:bg-panel-raised`,children:[(0,K.jsx)(s,{icon:h,className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-[10px] leading-none`,children:a(`mobile.sessions`)})]}):null,l.map(n=>{let r=n.id===e;return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-current":r?`page`:void 0,className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 active:bg-panel-raised ${r?`text-blue`:`text-ink-faint`}`,children:[(0,K.jsx)(s,{icon:n.icon,className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-[10px] leading-none`,children:n.label})]},n.id)})]})}function ap(e,t,n){let r=n?.height??t,i=t-r-(n?.offsetTop??0);return{keyboardInset:i>24?Math.round(i):0,compact:e<1024&&r<=600}}function op(){let[e,t]=(0,U.useState)(()=>typeof window<`u`&&ap(window.innerWidth,window.innerHeight,window.visualViewport).compact);return(0,U.useEffect)(()=>{let e=window.visualViewport,n=document.documentElement,r=null,i=()=>{r!=null&&window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let r=ap(window.innerWidth,window.innerHeight,e);n.style.setProperty(`--keyboard-inset`,`${r.keyboardInset}px`),n.dataset.compactViewport=String(r.compact),t(r.compact)})};return i(),e?.addEventListener(`resize`,i),e?.addEventListener(`scroll`,i),window.addEventListener(`resize`,i),()=>{r!=null&&window.cancelAnimationFrame(r),e?.removeEventListener(`resize`,i),e?.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),n.style.removeProperty(`--keyboard-inset`),delete n.dataset.compactViewport}},[]),e}var sp={[L.LIFE_LIFECYCLE_BLOCK]:`block`,[L.ROUND_REVIEWER_BACKEND_FAILURE]:`block`,[L.LIFE_BUDGET_PAUSE]:`warn`,[L.ROUND_STALL]:`warn`,[L.ROUND_ESCALATED]:`warn`,[L.LIFE_PLANNER_STALL_ESCALATION]:`warn`},cp=new Set([L.BUDGET_RESERVATION_DENIED,L.BUDGET_UNPRICED_BLOCKED]),lp=new Set([L.LIFE_MISSION_STARTED,L.ROUND_MAIN_COMPLETED,L.LIFE_MISSION_COMPLETED,L.LOOP_DONE,L.ROUND_START,`ui.operator`]),up=new Set([L.BUDGET_RESERVATION_CREATED,L.PROVIDER_REQUEST_STARTED]);function dp(e){let t=A(e.canonical_type??e.type);if(e.event_validation?.status===`invalid`)return t===L.ROLE_SESSION_TURN?null:{tone:`warn`,kind:`validation`,text:`invalid event ${t||`unknown`}: ${e.event_validation.errors.join(`; `)}`};if(cp.has(t))return{tone:`block`,kind:`budget`,text:`Budget exhausted or blocked — ${String(e.reason??e.text??t).trim()}`};let n=e.operator_alert===!0?`block`:sp[t];return n?{tone:n,text:String(e.text??e.reason??t).trim()}:null}function fp(e){let t=null;for(let n of e){let e=A(n.canonical_type??n.type),r=dp(n);r?t=r:(t?.kind===`validation`||t?.kind===`budget`&&up.has(e)||t&&t.kind!==`budget`&&lp.has(e))&&(t=null)}return t}async function pp(e,t){let n=Tc(e.trim());if(!n)return{kind:`not-command`};if(!n.cmd){let e=Ec(n.name);return{kind:`error`,message:e?`Unknown command ${n.name}. Did you mean ${e}?`:`Unknown command ${n.name}. Use /help for the full list.`}}if(n.cmd.id===`ask`||n.cmd.id===`crystalpilot`)return{kind:`not-command`};if(_c(n.cmd)&&!n.rest)return{kind:`error`,message:`Usage: ${n.cmd.name}${n.cmd.arg?` ${n.cmd.arg}`:``}`};try{await t[n.cmd.id](n.rest)}catch(e){return{kind:`error`,message:e instanceof Error?e.message:String(e??`Command failed`)}}return{kind:`handled`}}function mp({activeSid:e,activityEventsRef:t,notify:n,onClearEvents:r,onDispose:i,onOpenConfig:a,onOpenDoctor:o,onOpenHelp:s,onOpenIdentity:c,onOpenInspector:l,onOpenNewDaemon:u,onOpenOperations:d,onOpenSidebar:f,onOpenSkills:p,onReconnectEvents:m,onRenameProject:h,onRewriteDraft:g,onSelectProject:_,onSetArtifactPath:v,onSetEventFilter:y,onSetEventQuery:b,onSetTaskItemId:x,onSetWorkspaceView:S,onShowArtifacts:C,onStopIteration:w,onStopWaiting:T,refetchSnapshot:E}){return{status:async()=>l(),roles:async()=>d(),journal:async()=>l(),backlog:async()=>l(),item:async e=>{e&&x(e)},artifacts:async()=>C(),artifact:async e=>{e&&v(e)},events:async e=>{S(`activity`);let{filter:t,query:n}=wc(e);y(t),b(n)},find:async e=>{S(`activity`),y(`all`),b(e)},run:async()=>S(`activity`),clear:async()=>{S(`activity`),y(`all`),b(``),r(t.current.length)},cancel:async()=>T(),task:async t=>{e&&(await P.addTask(e,t),E(),n(`success`,`Task queued.`))},rewrite:async e=>{let t=e.trim();if(!t){n(`info`,`Type your prompt in the composer and press Rewrite, or use /rewrite .`);return}g(t)},plan:async t=>{if(!e)return;let r=await P.previewPlan(e,t);r.error?n(`error`,r.error):n(`info`,r.steps.map(e=>e.title).join(` +`)||`Plan preview ready.`)},nudge:async t=>{e&&(await P.nudge(e,t),n(`success`,`Guidance injected.`))},abort:async t=>{e&&(await P.abortMission(e,t||`operator abort`),n(`info`,`Abort requested.`))},note:async t=>{e&&(await P.note(e,t),n(`success`,`Note appended to timeline.`))},done:async e=>{e&&i(e,`done`)},skip:async e=>{e&&i(e,`rm`)},stop:async e=>{e&&w(e)},new:async()=>u(),daemons:async()=>f(),resume:async e=>{e&&e!==`list`?_(e):f()},attach:async e=>{e&&_(e)},rename:async t=>{!e||!t||await h(t)},doctor:async()=>o(),backend:async t=>{if(!e||!t){a();return}await P.setConfig(e,`runner_backend`,t),n(`success`,`Backend set to ${t}.`)},config:async t=>{if(!e||!t){a();return}let r=t.indexOf(`=`);r>0?(await P.setConfig(e,t.slice(0,r).trim(),t.slice(r+1).trim()),n(`success`,`Config updated.`)):a()},identity:async()=>c(),reset:async()=>{e&&(await P.resetManager(e),n(`success`,`Manager context reset.`))},skills:async t=>{if([``,`ls`,`list`].includes(t.trim().toLowerCase())){p();return}e&&n(`info`,(await P.skills(e,t||`ls`)).slice(0,400))},reconnect:async()=>m(),help:async()=>s(),quit:async()=>n(`info`,`Background work continues; close this browser tab when ready.`)}}function hp(e){return e.kind===`error`?(typeof e.reply==`string`?e.reply.trim():``)||`Manager could not handle this message.`:null}function gp(e,t){e.kind===`task`&&t.dispatchTask(e);let n=hp(e);n&&t.notifyError(n),t.refetchTranscript()}var _p={skipFirst:0,reconnectKey:0};function vp(e,t){return t.kind===`clear`?{...e,skipFirst:Math.max(0,t.offset)}:t.kind===`reconnect`?{skipFirst:0,reconnectKey:e.reconnectKey+1}:{...e,skipFirst:0}}function yp(e,t){if(!t.length)return e;let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return t?{...e,spend_usd:t.spend_usd,known_cost_usd:t.known_cost_usd,spend_status:t.spend_status,usage_calls:t.usage_calls,premium_requests:t.premium_requests,cost_updated_at:t.updated_at}:e})}async function bp(e,t,n,r=``){let i=await e.createDaemon(``,t,r),a=n.trim();return{created:i,startCampaign:a?()=>e.setContinuous(i.sid,!0,a):null}}var xp=e=>e instanceof Error?e.message:String(e||`Unknown error`);function Sp({localCwd:e,notify:t,onFocusComposer:n,queryClient:r,refetchProjects:i,selectProject:a,translate:o}){let[s,c]=(0,U.useState)(!1),l=(0,U.useRef)(!1);return{createDaemon:async(s,u,d)=>{if(l.current)return!1;l.current=!0,c(!0);try{let{created:c,startCampaign:l}=await bp(P,s,u,d),f=String(c.workdir||d||``);return r.setQueryData([`projects`],t=>({local_cwd:t?.local_cwd??e,projects:[{id:c.sid,label:s||c.sid,display_name:s,objective:``,launch_cwd:f,workdir:f,last_active:Date.now()/1e3,daemon_alive:!1,daemon_pid:null,uptime_seconds:null},...(t?.projects??[]).filter(e=>e.id!==c.sid)]})),a(c.sid),i(),window.setTimeout(n,0),t(l?`info`:`success`,l?o?o(`new.createdStarting`):`Session created and selected. Campaign is starting in the background.`:o?o(`new.createdIdle`):`Session created and selected.`),l&&l().then(()=>{r.invalidateQueries({queryKey:[`snapshot`,c.sid]}),i(),t(`success`,`Campaign started.`)}).catch(e=>{t(`error`,`Session was created, but the campaign could not start: ${xp(e)}`)}),!0}catch(e){return t(`error`,`Could not create session: ${xp(e)}`),!1}finally{l.current=!1,c(!1)}},creatingDaemon:s}}var Cp=e=>e instanceof Error?e.message:String(e||`Unknown error`);function wp({actions:e,manageActions:t,manageTargetSid:n,setManageTargetSid:r,activeSid:i,clearProjectSelection:a,continuous:o,notify:s,refetchProjects:c,selectProject:l,setDaemonManageOpen:u}){let d=e.startDaemon.isPending||e.stopDaemon.isPending||e.forceStopDaemon.isPending||t.startDaemon.isPending||t.forceStopDaemon.isPending||t.updateProject.isPending||t.deleteProject.isPending,f=(0,U.useCallback)(e=>({onSuccess:()=>s(`success`,e),onError:e=>s(`error`,Cp(e))}),[s]),p=(0,U.useCallback)(()=>e.startDaemon.mutate(void 0,f(`Daemon start requested.`)),[f,e.startDaemon]),m=(0,U.useCallback)(()=>e.forceStopDaemon.mutate(void 0,f(`Stop requested; the verified daemon process is being interrupted.`)),[f,e.forceStopDaemon]),h=(0,U.useCallback)(async()=>{try{return await t.startDaemon.mutateAsync(),s(`success`,`Daemon resumed.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[t.startDaemon,s]),g=(0,U.useCallback)(async()=>{try{return await t.forceStopDaemon.mutateAsync(),await c(),s(`success`,`Daemon stopped. This session can now be deleted.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[t.forceStopDaemon,s,c]),_=(0,U.useCallback)(async e=>{if(!n)return!1;try{return await t.updateProject.mutateAsync({sid:n,name:e}),s(`success`,`Session name updated.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[t.updateProject,n,s]),v=(0,U.useCallback)(async()=>{if(!n)return!1;try{let e=n,o=await t.deleteProject.mutateAsync();u(!1),r(null);let d=await c();if(e===i){a(`replace`);let e=Vl(d.data?.projects??[])[0];e&&l(e.id,`replace`)}return s(`success`,o.workdir_preserved?`Session moved to recoverable trash. Files remain in ${o.workdir}.`:`Session moved to recoverable trash.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[i,a,t.deleteProject,n,s,c,l,u,r]),y=(0,U.useCallback)(e=>{r(e),u(!0)},[u,r]);return{daemonBusy:d,manageDeleteProject:v,manageStopDaemon:g,manageRenameProject:_,manageStartDaemon:h,requestDispose:(0,U.useCallback)((t,n)=>e.disposeBacklog.mutate({id:t,op:n},{onSuccess:()=>s(`success`,n===`done`?`Work marked done.`:`Work removed.`),onError:e=>s(`error`,Cp(e))}),[e.disposeBacklog,s]),requestManageSession:y,requestStartDaemon:p,requestStopDaemon:m,requestStopIteration:(0,U.useCallback)(t=>e.stopBacklog.mutate(t,{onSuccess:()=>s(`success`,`Iteration stopped.`),onError:e=>s(`error`,Cp(e))}),[e.stopBacklog,s]),toggleContinuous:(0,U.useCallback)(()=>{if(!o)return;let t=!o.enabled;e.setContinuous.mutate({enabled:t,objective:o.objective},f(t?`Continuous campaign enabled.`:`Continuous campaign stopped.`))},[f,e.setContinuous,o])}}function Tp({focusComposer:e,openHelp:t,toggleKiosk:n,togglePalette:r,toggleReasoning:i,toggleSidebarCollapse:a}){(0,U.useEffect)(()=>{let o=o=>{let s=o.target,c=s?.tagName===`INPUT`||s?.tagName===`TEXTAREA`,l=o.metaKey||o.ctrlKey;l&&o.key.toLowerCase()===`k`?(o.preventDefault(),r()):l&&o.key.toLowerCase()===`t`?(o.preventDefault(),i()):l&&o.key===`.`?(o.preventDefault(),n()):l&&o.key.toLowerCase()===`b`?(o.preventDefault(),a()):l&&o.key.toLowerCase()===`j`?(o.preventDefault(),e()):!c&&o.key===`?`?(o.preventDefault(),t()):!c&&o.key===`/`&&(o.preventDefault(),e())};return window.addEventListener(`keydown`,o),()=>window.removeEventListener(`keydown`,o)},[e,t,n,r,i,a])}var Ep=e=>e instanceof Error?e.message:String(e||`Unknown error`),Dp=`argus.decision.prompted.v1`,Op=()=>{try{return window.sessionStorage.getItem(Dp)??``}catch{return``}},kp=e=>{try{window.sessionStorage.setItem(Dp,e)}catch{}};function Ap({activeSid:e,currentTaskId:t,autoOpen:n=!0,backlog:r,notify:i,pendingQuestions:a,refetchSnapshot:o}){let[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(``),p=(0,U.useRef)(!1),m=(0,U.useRef)(``),h=(0,U.useMemo)(()=>{let e=(r??[]).map(e=>({...e,operator_decision:e.operator_decision}));return kr(a??[],e,t)},[r,a,t]),g=h[0]??null,_=r!==void 0||a!==void 0,v=s!==null&&s.sid===e,y=v?{...s.card,is_current_task:t&&s.card.kind!==`domain_intake`?s.card.item_id===t:void 0}:g;return(0,U.useEffect)(()=>{if(s&&(s.sid!==e||_&&!l&&!h.some(e=>e.id===s.card.id))&&c(null),!e||!g||!n&&g.kind!==`domain_intake`||v||l)return;let t=`${e}:${g.id}`;m.current!==t&&Op()!==t&&(m.current=t,kp(t),f(``),c({sid:e,card:g}))},[e,n,h,_,g,s,v,l]),{answerPendingReply:async(t,n)=>{if(!(!e||!y||p.current)){p.current=!0,u(!0),f(``);try{let r=y.kind===`domain_intake`?await P.answerDomain(e,y.id,t,n):y.legacy?await P.answerPending(e,y.item_id,n):await P.resolveDecision(e,y.id,t,n);if(r.resolved===!1||`kind`in r&&[`error`,`cancelled`].includes(String(r.kind))){f(String(r.reply||`Could not send answer.`)),await o();return}c(e=>e===s?null:e),await o(),r.daemon&&Number(r.daemon.rc??0)!==0?i(`error`,`Answer queued, but the daemon did not start: ${r.daemon.error||`operator action required`}`):y.kind!==`domain_intake`&&i(`success`,String(r.reply||`Manager delivered your answer to the team.`))}catch(e){f(Ep(e)),i(`error`,`Could not send answer: ${Ep(e)}`),await o()}finally{p.current=!1,u(!1)}}},pendingReply:y,pendingReplyBusy:l,pendingReplyError:d,pendingReplyOpen:v,setPendingReplyOpen:t=>{f(``),t?e&&g&&c(t=>t?.sid===e?t:{sid:e,card:g}):c(null)}}}var jp=`argus.browser.project.v1`;function Mp(){try{return window.sessionStorage.getItem(jp)}catch{return null}}function Np(e){try{e?window.sessionStorage.setItem(jp,e):window.sessionStorage.removeItem(jp)}catch{}}function Pp(e,t){let n=new URL(window.location.href);e?n.searchParams.set(`project`,e):n.searchParams.delete(`project`);let r=t===`push`?`pushState`:`replaceState`;window.history[r](window.history.state,``,n.toString())}function Fp({cancelActiveMessage:e,notify:t,formatProjectMissing:n,projects:r,projectsError:i,projectsReady:a,queryClient:o,setArtifactPath:s,setSidebarOpen:c,setTaskItemId:l}){let u=(e,t)=>n?n(e,t):t?`Project “${e}” was not found. Switched to ${t}.`:`Project “${e}” was not found. Create a project to continue.`,d=new URLSearchParams(window.location.search),[f,p]=(0,U.useState)(d.get(`project`)||Mp()),m=(0,U.useRef)(f),h=(0,U.useRef)(!1);m.current=f;let g=(0,U.useCallback)(t=>{t!==m.current&&(e(),s(null),l(null)),m.current=t,p(t),Np(t)},[e,s,l]),_=(0,U.useCallback)((e,t=`push`)=>{let n=new URLSearchParams(window.location.search).get(`project`);g(e),n!==e&&Pp(e,t)},[g]),v=(0,U.useCallback)((e=`replace`)=>{let t=new URLSearchParams(window.location.search).get(`project`);g(null),t!=null&&Pp(null,e)},[g]),y=(0,U.useCallback)(e=>{o.prefetchQuery({queryKey:[`snapshot`,e],queryFn:({signal:t})=>P.prefetchSnapshot(e,t),staleTime:3e3})},[o]);return(0,U.useEffect)(()=>{if(!a)return;let e=h.current,n=Wl(r,m.current,e);if(!e&&(h.current=!0,n.id===m.current?Np(n.id):g(n.id),new URLSearchParams(window.location.search).get(`project`)!==n.id&&Pp(n.id,`replace`),n.recovered)){let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}},[g,n,t,r,a]),(0,U.useEffect)(()=>{let e=()=>{let e=new URLSearchParams(window.location.search).get(`project`);if(c(!1),!e){g(null);return}if(!a){g(e);return}let n=Ul(r,e);if(g(n.id),n.recovered){Pp(n.id,`replace`);let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[g,t,r,a,c]),{activateProject:g,activeSid:a?f&&r.some(e=>e.id===f)?f:null:i?f:null,clearProjectSelection:v,prefetchProject:y,selectProject:_,sid:f,sidRef:m}}var Ip={text:``,attachments:[],revision:0};function Lp(e){let t=(0,U.useRef)(new Map),n=(0,U.useRef)(new Map),r=(0,U.useRef)(0),i=(0,U.useRef)(!0),[,a]=(0,U.useReducer)(e=>e+1,0);(0,U.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let o=(0,U.useCallback)((e,n)=>{let o={text:n.text,attachments:[...n.attachments],revision:++r.current};return t.current.set(e,o),i.current&&a(),{sid:e,...o}},[]),s=(0,U.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??Ip;o(e,{...r,text:typeof n==`function`?n(r.text):n})},[o,e]),c=(0,U.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??Ip;o(e,{...r,attachments:typeof n==`function`?n(r.attachments):n})},[o,e]),l=(0,U.useCallback)(e=>{if(!e)return null;let n=t.current.get(e);return n||(n={...Ip,attachments:[],revision:++r.current},t.current.set(e,n)),{sid:e,...n,attachments:[...n.attachments]}},[]),u=(0,U.useCallback)(e=>i.current&&t.current.get(e.sid)?.revision===e.revision,[]),d=(0,U.useCallback)((e,t)=>u(e)?o(e.sid,{text:``,attachments:e.attachments.filter(e=>!t.includes(e))}):null,[u,o]),f=(0,U.useCallback)((e,t)=>e.sid!==t.sid||!u(e)?!1:(o(t.sid,t),!0),[u,o]),p=(0,U.useCallback)(e=>{if(!e||n.current.has(e))return null;let t={...l(e),request:++r.current};return n.current.set(e,t),a(),t},[l]),m=(0,U.useCallback)((e,t)=>{if(n.current.get(e.sid)!==e)return!1;n.current.delete(e.sid);let r=u(e);return r&&t!==void 0?o(e.sid,{...e,text:t}):i.current&&a(),r},[u,o]),h=(0,U.useCallback)(e=>{t.current.delete(e),n.current.delete(e),i.current&&a()},[]);return{draft:(e?t.current.get(e):null)??Ip,rewriting:!!(e&&n.current.has(e)),setText:s,setAttachments:c,capture:l,consume:d,restore:f,beginRewrite:p,finishRewrite:m,drop:h}}function Rp(e,t){if(!t.loadedSid||t.loadedSid!==t.sidRef.current)return null;let n=t.receipts.filter(t=>{let n=sr(t);return n?.deliveryId===e.deliveryId&&n.title===e.title&&n.summary===e.summary&&(!e.path||ql(t).some(t=>t.path===e.path))}),r=!!(t.completionId&&t.completionId===e.deliveryId);return n.length+Number(r)===1?t.loadedSid:null}function zp(e){let t=(0,U.useRef)(e);t.current=e;let n=(0,U.useRef)(null),[r,i]=(0,U.useReducer)(e=>e+1,0),a=(0,U.useCallback)(()=>{n.current?.controller.abort(),n.current=null},[]),o=(0,U.useCallback)((e,r)=>{n.current===e&&(a(),t.current.notify(`error`,`Cannot open notification: ${lt(r)}. No other session was used.`))},[a]);return(0,U.useEffect)(()=>{let e=hr(e=>{a();let r=e.sessionId??Rp(e,t.current);if(!r){t.current.notify(`info`,`This older notification cannot be automatically located. Select its session and open the result manually.`);return}if(!nr(r)){t.current.notify(`error`,`Cannot open notification: invalid session identity.`);return}let s={payload:e,target:null,phase:`resolving`,controller:new AbortController};n.current=s,t.current.queryClient.fetchQuery({queryKey:[`projects`],queryFn:P.projectIndex,staleTime:0}).then(e=>{if(n.current===s){if(!e.projects.some(e=>e.id===r))throw Error(`the target session is unavailable or no longer accessible`);s.target=r,s.phase=`loading`,t.current.selectProject(r),i()}}).catch(e=>o(s,e))});return window.addEventListener(`popstate`,a),()=>{e(),window.removeEventListener(`popstate`,a),a()}},[a,o]),(0,U.useEffect)(()=>{let e=n.current;if(!e?.target)return;let r=t.current;if(r.sidRef.current!==e.target){a();return}if(e.phase!==`loading`)return;if(r.snapshotError){o(e,r.snapshotError);return}if(r.loadedSid!==e.target)return;e.phase=`opening`;let i=e.payload.path;if(!i){n.current=null,r.noPath(),r.notify(`info`,`Notification session opened. This notification does not identify a file.`);return}P.artifact(e.target,i,e.controller.signal).then(r=>{let a=t.current;if(n.current!==e||a.sidRef.current!==e.target||a.loadedSid!==e.target)return;if(!r.exists||r.path!==i)throw Error(`the target file is unavailable`);n.current=null;let o=a.receipts.find(t=>t.delivery_id===e.payload.deliveryId&&ql(t).some(e=>e.path===i));o?a.openDelivery(o,i):a.focusPath(i)}).catch(t=>o(e,t))},[e.selectedSid,e.loadedSid,e.snapshotError,r,a,o]),a}function Bp(e,t,n){let r=n?t+8:56,i=Math.max(320,e-r-360-8);return Math.max(320,Math.min(840,i,Math.round(e*.45)))}var Vp=[`activity`,`workbench`,`map`],Hp=`argus.workspace.view.v3`;function Up(e){return Vp.includes(e)}function Wp(e,t){let n=gt(e);return n==null?t:n===`true`}function Gp(){let e=new URLSearchParams(window.location.search),[t,n]=(0,U.useState)(e.get(`kiosk`)===`1`),[r,i]=(0,U.useState)(()=>Wp(`argus.reasoning.visible.v1`,!1)),[a,o]=(0,U.useState)(()=>{let t=e.get(`view`);if(t===`mission`)return`activity`;if(Up(t))return t;let n=gt(Hp);return Up(n)?n:e.get(`kiosk`)===`1`?`map`:`activity`}),s=(0,U.useCallback)(e=>{ht(Hp,e),o(e)},[]),[c,l]=(0,U.useState)(`activity`),[u,d]=(0,U.useState)(()=>Wp(`argus.preview.expanded.v6`,!1)),[f,p]=(0,U.useState)(()=>{let e=Number(gt(`argus.sidebar.width.v2`)||256);return Number.isFinite(e)?Math.max(220,Math.min(400,e)):256}),[m,h]=(0,U.useState)(()=>{let e=Number(gt(`argus.preview.width.v2`)||440);return Number.isFinite(e)?Math.max(320,Math.min(840,e)):440}),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(()=>Wp(`argus.sidebar.expanded.v4`,!0)),{themeMode:b,themeStyle:x,cycleTheme:S}=yt(),C=(0,U.useRef)(null),w=(0,U.useRef)(null);(0,U.useEffect)(()=>{ht(`argus.sidebar.expanded.v4`,String(v)),ht(`argus.preview.expanded.v6`,String(u)),ht(`argus.sidebar.width.v2`,String(f)),ht(`argus.preview.width.v2`,String(m))},[v,f,u,m]),(0,U.useEffect)(()=>{ht(`argus.reasoning.visible.v1`,String(r))},[r]);let T=(0,U.useCallback)(()=>{d(!0),l(`preview`);let e=C.current?.clientWidth??window.innerWidth;if(e>=1024){let t=Bp(e,f,v);h(e=>Math.max(e,t))}},[v,f]),E=(0,U.useCallback)((e,t)=>{let n=C.current;if(!n)return;t.preventDefault();let r=n.getBoundingClientRect(),i=e===`left`?f:m;n.dataset.resizing=e,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let a=t=>{if(e===`left`){let e=u?m+8:0,n=Math.max(220,Math.min(400,r.width-e-360-8));i=Math.max(220,Math.min(n,t.clientX-r.left))}else{let e=v?f+8:56,n=Math.max(320,Math.min(840,r.width-e-360-8));i=Math.max(320,Math.min(n,r.right-t.clientX))}w.current??=window.requestAnimationFrame(()=>{n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),w.current=null})},o=()=>{w.current!=null&&window.cancelAnimationFrame(w.current),w.current=null,n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),e===`left`?p(i):h(i),delete n.dataset.resizing,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o,{once:!0}),window.addEventListener(`pointercancel`,o,{once:!0})},[v,f,u,m]);return(0,U.useEffect)(()=>{let e=()=>{if(window.innerWidth<1024||!C.current)return;let e=C.current.clientWidth,t=v?f:56,n=u?m:0,r=(v?8:0)+(u?8:0),i=Math.max(540,e-360-r);if(t+n<=i)return;let a=u?Math.max(320,Math.min(m,i-t)):n,o=v?Math.max(220,Math.min(f,i-a)):t;o+a>i&&u&&(a=Math.max(320,i-o)),v&&p(o),u&&h(a)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[v,f,u,m]),{cycleTheme:S,kiosk:t,leftPanelOpen:v,leftWidth:f,mobileView:c,openPreview:T,resizeSidebar:E,rightPanelOpen:u,rightWidth:m,setKiosk:n,setLeftPanelOpen:y,setLeftWidth:p,setMobileView:l,setRightPanelOpen:d,setRightWidth:h,setShowReasoning:i,setSidebarOpen:_,setWorkspaceView:s,shellRef:C,showReasoning:r,sidebarOpen:g,themeMode:b,themeStyle:x,workspaceView:a}}function Kp(e){let t=e.trim();if(!t||/\s/.test(t))return``;if(!t.includes(`?`)&&!t.includes(`://`))return t;try{return new URL(t,window.location.href).searchParams.get(`token`)?.trim()??``}catch{return``}}function qp(e){try{let t=new URL(window.location.href),n=new URL(e.trim(),t);return n.origin===t.origin&&/^\/pair\/[\w-]{32}$/.test(n.pathname)?n.toString():``}catch{return``}}function Jp({error:e,onRetry:t}){let{t:n}=F(),r=M(e),i=e instanceof E,[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``);return!r&&!i?null:(0,K.jsxs)(`div`,{role:`alert`,className:`fixed left-1/2 top-3 z-[100] flex w-[min(92vw,42rem)] -translate-x-1/2 flex-wrap items-start gap-3 rounded-xl border border-err/50 bg-panel/95 px-4 py-3 text-left text-sm text-ink shadow-xl backdrop-blur`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 font-mono font-bold text-err`,children:`!`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`strong`,{className:`block text-err`,children:n(r?`connection.pairingTitle`:`connection.unreachableTitle`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-ink-dim`,children:n(r?`connection.pairingDetail`:`connection.unreachableDetail`)})]}),r&&!a?(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`shrink-0 rounded-md border border-blue/45 bg-blue/10 px-2.5 py-1 text-xs font-medium text-blue hover:bg-blue/15`,children:n(`connection.pairAgain`)}):r?null:(0,K.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded-md border border-err/40 px-2.5 py-1 text-xs text-err hover:bg-err/10`,children:n(`common.retry`)}),r&&a?(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=qp(s);if(t){window.location.replace(t);return}let r=Kp(s);if(!r){u(n(`connection.pairingInvalid`));return}let i=new URL(window.location.href);i.searchParams.set(`token`,r),window.location.replace(i.toString())},className:`flex w-full basis-full flex-wrap gap-2 pl-7`,children:[(0,K.jsx)(`label`,{className:`sr-only`,htmlFor:`pairing-link`,children:n(`connection.pairingInput`)}),(0,K.jsx)(`input`,{id:`pairing-link`,"data-autofocus":!0,type:`password`,autoComplete:`off`,value:s,onChange:e=>{c(e.target.value),u(``)},placeholder:n(`connection.pairingPlaceholder`),className:`h-9 min-w-0 flex-1 rounded-md border border-line bg-bg px-3 text-xs text-ink outline-none focus:border-blue`}),(0,K.jsx)(`button`,{type:`submit`,className:`h-9 rounded-md border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white`,children:n(`connection.connect`)}),l?(0,K.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-err`,children:l}):null]}):null]})}function Yp(e){try{let t=JSON.parse(gt(e)||`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Xp(e,t,n,r=!0){let i=(0,U.useRef)(),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(null),l=(0,U.useCallback)(t=>{if(!e)return;let n=`argus.delivery.seen.v1:${e}`;ht(n,JSON.stringify([...new Set([...Yp(n),t])].slice(-80)))},[e]),u=(0,U.useCallback)((t,n)=>{if(!e)return;l(t.delivery_id);let r=ql(t),i=r.find(e=>e.path===n)?.path||r[0]?.path||null;o({sid:e,receipt:t,path:i}),c(null)},[e,l]);return(0,U.useEffect)(()=>{if(!e||!t)return;let a=n?.delivery_id;if(i.current?.sid!==e){i.current={sid:e,ids:new Set(a?[a]:[])},o(null),c(null);return}!a||i.current.ids.has(a)||!r||(i.current.ids.add(a),n&&ql(n).length&&!Yp(`argus.delivery.seen.v1:${e}`).includes(a)&&c({sid:e,receipt:n}))},[e,t,n,r]),{selection:a?.sid===e?a:null,open:u,fresh:s?.sid===e?s.receipt:null,dismissFresh:(0,U.useCallback)(()=>c(null),[]),close:(0,U.useCallback)(()=>o(null),[]),selectPath:(0,U.useCallback)(e=>o(t=>t&&{...t,path:e}),[])}}var Zp=e({default:()=>nm}),Qp=0,$p=(0,U.lazy)(async()=>({default:(await Se(()=>import(`./ResearchWorkbenchPanel-BPQjY3tf.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)).ResearchWorkbenchPanel})),em=(0,U.lazy)(async()=>({default:(await Se(()=>import(`./MapPanel-pOMl9sI3.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,15,10,16,12,17]),import.meta.url)).MapPanel}));function tm(e,t){let[n,r]=(0,U.useState)(e),i=(0,U.useRef)(e),a=(0,U.useRef)(null),o=(0,U.useRef)(0);return i.current=e,(0,U.useEffect)(()=>{if(e===n)return;let s=o.current+t-Date.now();if(s<=0){o.current=Date.now(),r(e);return}a.current||=setTimeout(()=>{a.current=null,o.current=Date.now(),r(i.current)},s)},[e,n,t]),(0,U.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),n}function nm(){let{locale:e,t}=F(),n=e=>e instanceof fe?t(`connection.pairingDetail`):lt(e),r=S(),i=he(),a=ve(),o=(0,U.useMemo)(()=>Vl(yp(i.data?.projects??[],a.data?.projects??[])),[a.data?.projects,i.data?.projects]),s=i.data?.local_cwd??``,c=[i.error,a.error].find(e=>ee(e)),[l,u]=(0,U.useState)(`none`),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(`feed`),h=(0,U.useCallback)(e=>{f(null),m(e),u(`learning`)},[]),g=(0,U.useCallback)((e,t=`recent`)=>{f(e?{kind:`skill`,item:e}:null),m(e?.scope??(t===`recent`?`feed`:t)),u(`learning`)},[]),_=(0,U.useCallback)(e=>{f(e?{kind:`knowledge`,item:e}:null),m(e?.scope===`private`?`global`:e?.scope??`feed`),u(`learning`)},[]),{cycleTheme:v,kiosk:y,leftPanelOpen:b,leftWidth:x,mobileView:C,openPreview:w,resizeSidebar:T,rightPanelOpen:E,rightWidth:D,setKiosk:O,setLeftPanelOpen:k,setLeftWidth:A,setMobileView:j,setRightPanelOpen:M,setRightWidth:N,setShowReasoning:I,setSidebarOpen:te,setWorkspaceView:L,shellRef:ne,showReasoning:re,sidebarOpen:ae,themeMode:oe,workspaceView:le}=Gp(),[de,pe]=(0,U.useState)(le===`workbench`),[_e,ye]=(0,U.useState)(0),xe=(0,U.useCallback)(()=>{u(`none`),j(`activity`),L(`workbench`),ye(e=>e+1)},[j,L]);(0,U.useEffect)(()=>{le===`workbench`&&pe(!0)},[le]);let Se=op(),[Ce,we]=(0,U.useState)(0),[Te,Ee]=(0,U.useState)(0),[De,ke]=(0,U.useState)(`auto`),[Ae,je]=(0,U.useState)(!1),[R,Me]=(0,U.useState)([]),Ne=(0,U.useRef)(null),[z,Pe]=(0,U.useState)([]),[Fe,Ie]=(0,U.useState)(null),[Le,Re]=(0,U.useState)({path:``,token:0}),[ze,Be]=(0,U.useState)(null),[Ve,He]=(0,U.useState)(!1),[Ue,Ge]=(0,U.useState)(null),[Ke,qe]=(0,U.useState)(null),Je=(0,U.useRef)(!1),Ye=(0,U.useRef)(null),Xe=(0,U.useRef)(0),Ze=(0,U.useRef)(),Qe=(0,U.useRef)({sid:``,completionId:``,view:null,artifacts:[]}),$e=(0,U.useRef)(()=>void 0),[et,B]=(0,U.useState)(null),[nt,rt]=(0,U.useReducer)(vp,_p),[it,at]=(0,U.useState)(`all`),[ot,st]=(0,U.useState)(``),ct=(0,U.useCallback)(()=>B(null),[]),V=(0,U.useCallback)((e,t)=>{B({id:++Qp,tone:e,message:t})},[]),ut=(0,U.useCallback)(()=>{let e=!!Ye.current;return Xe.current+=1,Ye.current?.controller.abort(),Ye.current=null,je(!1),Pe([]),e},[]),dt=(0,U.useCallback)(()=>{let e=Ye.current;if(!e||!ut())return;let n=Xe.current;V(`info`,t(`chat.stoppingReply`)),P.cancelMessage(e.sid,e.serverRequestId).then(e=>{Xe.current===n&&V(`info`,t(e.requested?`chat.stopReplyRequested`:`chat.replyAlreadyFinished`))}).catch(e=>{Xe.current===n&&V(`error`,t(`chat.stopReplyFailed`,{error:lt(e)}))})},[ut,V,t]),{activeSid:H,clearProjectSelection:ft,prefetchProject:mt,selectProject:ht,sid:gt,sidRef:_t}=Fp({cancelActiveMessage:ut,notify:V,formatProjectMissing:(e,n)=>n?t(`project.missingSwitched`,{requested:e??``,fallback:n}):t(`project.missingCreate`,{requested:e??``}),projects:o,projectsError:i.isError,projectsReady:i.isSuccess,queryClient:r,setArtifactPath:Ie,setSidebarOpen:te,setTaskItemId:Be}),{draft:{text:vt,attachments:yt},rewriting:bt,setText:xt,setAttachments:Et,capture:Ot,consume:kt,restore:At,beginRewrite:jt,finishRewrite:Mt,drop:Nt}=Lp(gt),Pt=(0,U.useCallback)((e,t)=>{$e.current(),ht(e,t)},[ht]),Ft=(0,U.useCallback)(e=>{$e.current(),ft(e)},[ft]);(0,U.useEffect)(()=>ke(`auto`),[H]),(0,U.useEffect)(()=>{Re(e=>e.path?{path:``,token:e.token+1}:e)},[gt]),(0,U.useEffect)(()=>()=>{Xe.current+=1,Ye.current?.controller.abort(),Ye.current=null},[]),(0,U.useEffect)(()=>_r(),[]);let It=(0,U.useCallback)(e=>{let t=(e||``).trim(),n=_t.current;if(!t||!n)return;let r=jt(n);r&&P.rewritePrompt(n,t).then(e=>{if(e.error||!e.rewritten.trim()){Mt(r)&&_t.current===n&&V(`error`,`Rewrite failed: ${e.error||`empty rewrite`} — your prompt is unchanged`);return}if(!Mt(r,e.rewritten)||_t.current!==n)return;we(e=>e+1);let t=e.questions.length?` Manager asks: ${e.questions.join(` · `)}`:``;V(`success`,`Prompt rewritten — review it, then send.${t}`)},e=>{Mt(r)&&_t.current===n&&V(`error`,`Rewrite failed: ${lt(e)} — your prompt is unchanged`)})},[jt,Mt,V,_t]),{createDaemon:Lt,creatingDaemon:Rt}=Sp({localCwd:s,notify:V,onFocusComposer:()=>we(e=>e+1),queryClient:r,refetchProjects:i.refetch,selectProject:Pt,translate:t}),zt=(0,U.useCallback)(()=>{Lt(``,``,``)},[Lt]),Bt=(0,U.useRef)(zt);Bt.current=zt,(0,U.useEffect)(()=>gr(()=>Bt.current()),[]);let Vt=ue(H),Ht=ue(Ue),W=Vt.data,G=W?.session.id===H?H:null,Ut=W?.continuous,Wt=ie(G,!0),{events:Gt,connected:Kt}=me(G,nt.reconnectKey),qt=(0,U.useMemo)(()=>ge(Gt),[Gt]),Jt=(0,U.useMemo)(()=>be(Gt),[Gt]);(0,U.useEffect)(()=>{if(!G||!qt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`artifacts`,G],exact:!0})},180);return()=>window.clearTimeout(e)},[qt,G,r]),(0,U.useEffect)(()=>{if(!G||!Jt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`snapshot`,G],exact:!0})},80);return()=>window.clearTimeout(e)},[G,r,Jt]);let Yt=(0,U.useMemo)(()=>fp(Gt),[Gt]),{query:Xt,events:Zt,status:Qt}=Dt(G,!0,Gt,R,Ne.current),$t=G&&W?.manager_requests?.filter(e=>e.status===`running`).at(-1)?.request_id||``,en=Ae||!!$t;(0,U.useEffect)(()=>{if(!G)return;let e=Ye.current;if($t){e||(Ye.current={id:++Xe.current,serverRequestId:$t,sid:G,controller:new AbortController,recovered:!0},je(!0));return}e?.recovered&&e.sid===G&&(Ye.current=null,je(!1),Pe([]),Xt.refetch())},[$t,G,Xt.refetch]);let tn=se(H,20,l===`inspector`),nn=tm((0,U.useMemo)(()=>({sid:G,events:Gt,conversation:Zt}),[G,Gt,Zt]),250),rn=nn.sid===G?nn.events:[],an=nn.sid===G?nn.conversation:[],on=(0,U.useMemo)(()=>W?bd(W,Zt,Wt.data??[]):null,[Zt,Wt.data,W]),{answerPendingReply:sn,pendingReply:cn,pendingReplyBusy:ln,pendingReplyError:un,pendingReplyOpen:dn,setPendingReplyOpen:fn}=Ap({activeSid:H,currentTaskId:on?.mission.id,autoOpen:le!==`map`,backlog:W?.backlog,notify:V,pendingQuestions:W?.pending_questions,refetchSnapshot:Vt.refetch}),pn=W?.daemon.alive&&on?.routing.vertical===`research`?on.active_role.startsWith(`reviewer`)?`reviewing`:on.active_role.startsWith(`engineer`)?`revising`:void 0:void 0,mn=Xl((0,U.useMemo)(()=>cc(Zt),[Zt]),on?.delivery??null,Zt),hn=W?.backlog.some(e=>[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))??!1,gn=Ed(on)&&!hn&&!W?.continuous?.enabled,_n=G&&gn&&on?.mission.id?`completion:${G}:${on.mission.id}`:``;Qe.current={sid:G||``,completionId:_n,view:on,artifacts:Wt.data??[]};let vn=(0,U.useCallback)(()=>{w()},[w]),yn=(0,U.useCallback)((e,t=!0)=>{let n=e.trim();if(!n){t&&L(`map`);return}if(le===`map`||!Wt.data?.some(e=>e.path===n&&e.exists)){Ie(n);return}M(!0),j(`preview`),Re(e=>({path:n,token:e.token+1}))},[Wt.data,j,M,L,le]),bn=Xp(G,!!W&&!Xt.isPending,mn,!Fe&&!Zl(W?.backlog??[],mn?.item_id)),xn=bn.open,Sn=(0,U.useMemo)(()=>{let e=new Map;for(let t of Zt){let n=t.delivery;n?.delivery_id&&Array.isArray(n.targets)&&e.set(n.delivery_id,n)}for(let t of[on?.delivery,mn])t&&e.set(t.delivery_id,t);return[...e.values()].filter(e=>ql(e).length).sort((e,t)=>t.delivered_at-e.delivered_at)},[Zt,on?.delivery,mn]);(0,U.useEffect)(()=>{G&&mn?.delivery_id&&r.invalidateQueries({queryKey:[`artifacts`,G],exact:!0})},[G,mn?.delivery_id,r]),(0,U.useEffect)(()=>{if(!G)return;let e=Ze.current;if(!e||e.sid!==G){Ze.current={sid:G,id:_n||null};return}if(!_n){Ze.current={sid:G,id:null};return}if(e.id===_n)return;let n=window.setTimeout(()=>{let e=Qe.current;if(e.sid!==G||e.completionId!==_n||!e.view)return;let n=e.view.delivery,r=jd(e.artifacts),i=or({completionId:_n,sessionId:G,title:n?.title||e.view.mission.title||t(`mission.taskCompleted`),summary:n?.summary||e.view.mission.summary,path:n?.primary_target?.path||r?.path});i&&fr(i),Ze.current={sid:G,id:_n}},500);return()=>window.clearTimeout(n)},[_n,G,t]),$e.current=zp({selectedSid:gt,loadedSid:G,sidRef:_t,snapshotError:Vt.error,queryClient:r,receipts:Xt.isPending?[]:Sn,completionId:_n,selectProject:e=>{ht(e),te(!1)},openDelivery:xn,focusPath:e=>{Wt.data?.some(t=>t.path===e&&t.exists)?yn(e):Ie(e)},noPath:()=>{j(`activity`),L(`map`)},notify:V});let Cn=(0,U.useRef)(Zt);Cn.current=Zt,(0,U.useEffect)(()=>{at(`all`),st(``),Me([]),rt({kind:`reset`})},[G]);let wn=ce(H,W?.daemon_commands?.revision),Tn=ce(Ue,Ht.data?.daemon_commands?.revision),En=(0,U.useCallback)(async e=>{qe(e);try{await P.startDaemon(e),await i.refetch(),V(`success`,t(`sidebar.resumeSuccess`))}catch(e){V(`error`,t(`sidebar.resumeFailed`,{error:lt(e)}))}finally{qe(null)}},[V,i,t]),{daemonBusy:Dn,manageDeleteProject:On,manageStopDaemon:kn,manageRenameProject:An,manageStartDaemon:jn,requestDispose:Mn,requestManageSession:Nn,requestStartDaemon:Pn,requestStopDaemon:In,requestStopIteration:Ln,toggleContinuous:Rn}=wp({actions:wn,manageActions:Tn,manageTargetSid:Ue,setManageTargetSid:Ge,activeSid:H,clearProjectSelection:Ft,continuous:Ut,notify:V,refetchProjects:i.refetch,selectProject:Pt,setDaemonManageOpen:He}),zn=(0,U.useCallback)(async e=>{if(!H)return;let t=await wn.updateProject.mutateAsync({sid:H,name:e});V(`success`,`Renamed to "${t.name}".`)},[wn.updateProject,H,V]),Bn=(0,U.useMemo)(()=>mp({activeSid:H,activityEventsRef:Cn,notify:V,onClearEvents:e=>rt({kind:`clear`,offset:e}),onDispose:Mn,onOpenConfig:()=>u(`config`),onOpenDoctor:()=>u(`doctor`),onOpenHelp:()=>u(`help`),onOpenIdentity:()=>u(`identity`),onOpenInspector:()=>u(`inspector`),onOpenNewDaemon:zt,onOpenOperations:xe,onOpenSidebar:()=>te(!0),onOpenSkills:()=>g(void 0,`global`),onReconnectEvents:()=>rt({kind:`reconnect`}),onRenameProject:zn,onRewriteDraft:It,onSelectProject:Pt,onSetArtifactPath:Ie,onSetEventFilter:at,onSetEventQuery:st,onSetTaskItemId:Be,onSetWorkspaceView:L,onShowArtifacts:vn,onStopIteration:Ln,onStopWaiting:dt,refetchSnapshot:Vt.refetch}),[H,V,vn,g,xe,zn,Mn,Ln,It,Pt,Vt.refetch,dt,L]);Tp({focusComposer:()=>we(e=>e+1),openHelp:()=>u(`help`),toggleKiosk:()=>O(e=>!e),togglePalette:()=>u(e=>e===`palette`?`none`:`palette`),toggleReasoning:()=>I(e=>!e),toggleSidebarCollapse:()=>k(e=>!e)});let Vn=async(e,n=[],i)=>{let a=H;if(!a||a!==_t.current||Je.current||Ye.current)return!1;let o=Xe.current;Je.current=!0;let s,c,l;try{if(!n.length){let t=await pp(e,Bn);if(t.kind===`handled`)return i?.({type:`settled`,outcome:`message`}),!0;if(t.kind===`error`)return V(`error`,t.message),!1}if(_t.current!==a||Xe.current!==o)return!1;s=++Xe.current,c=Oe(),l=new AbortController,Ye.current={id:s,serverRequestId:c,sid:a,controller:l}}finally{Je.current=!1}let u=()=>{let e=Ye.current;return!!(e&&e.id===s&&e.sid===a&&_t.current===a&&!l.signal.aborted)},d=()=>{Ye.current?.id===s&&(Ye.current=null,je(!1),Pe([]))};je(!0),Pe([]);let f=[];if(n.length)try{let e=await P.uploadAttachments(a,n,l.signal);if(!u())return!1;f=e.attachments.map(e=>({attachment_id:e.attachment_id}))}catch(e){return u()&&(V(`error`,t(`chat.attachmentUploadFailed`,{error:lt(e)})),d()),!1}let p=Ne.current===a;Ne.current=a,Me(t=>St([...p?t:[],wt(a,s,e)],a,s,[]));let m=(e,t=``,n=`auto`)=>{!u()||typeof e!=`string`||!e.trim()||Me(r=>Tt(r,a,s,e,t,Date.now(),n))},h=e=>{if(!u())return;let t=e.item;typeof t?.id==`string`&&i?.({type:`task`,taskId:t.id});let n=e.daemon&&typeof e.daemon==`object`?e.daemon:null,r=typeof e.reply==`string`?e.reply:null;n?.admission_required?V(`error`,r||`Task queued, but all daemon slots are busy: ${String(n.error||`operator action required`)}`):n&&Number(n.rc??0)!==0?V(`error`,r||`Task queued, but executor did not start: ${String(n.error||`unknown error`)}`):r&&!i&&V(`success`,r),Vt.refetch?.()},g=e=>{u()&&(r.invalidateQueries({queryKey:[`artifacts`,a]}),gp(e,{dispatchTask:h,notifyError:e=>V(`error`,e),refetchTranscript:()=>{Xt.refetch()}}))};return(async()=>{let t=!1,n=null,r=[];try{try{await P.messageStream(a,e,{onPhase:(e,t,n)=>{if(!u()||n.heartbeat)return;r=ro(r,{label:e,role:t,kind:n.kind,detail:n.detail,heartbeat:n.heartbeat,quietS:n.quietS,tool:n.tool,toolKind:n.toolKind,callId:n.callId,status:n.status,output:n.output}),Pe(r);let i=oo(r);i.length&&Me(e=>St(e,a,s,i,Date.now(),!0))},onDelta:(e,n,r)=>{u()&&(t=!0,m(e,n,r===`append`||r===`snapshot`?r:`auto`))},onDone:e=>{if(!u())return;e.kind!==`error`&&ke(`auto`),r=io(r),Pe(r);let t=lo(e.steps),n=t.length?t:oo(r,Date.now()/1e3,!0);Me(t=>St(t,a,s,n,Date.now(),!1,e.kind===`error`?`failed`:`completed`)),m(e.reply,``,`snapshot`),g(e);let o=e.item;(e.kind!==`task`||typeof o?.id!=`string`)&&i?.({type:`settled`,outcome:e.kind===`error`?`error`:`message`})},onError:e=>{u()&&(n=e)}},{signal:l.signal,attachments:f,routeOverride:De,requestId:c})}catch(e){u()&&(n=e)}if(!u())return;n&&(V(`error`,pt(n,t)),i?.({type:`settled`,outcome:`error`}))}finally{Me(e=>Ct(e,s,Date.now(),n&&!l.signal.aborted?`failed`:`stopped`)),l.signal.aborted&&i?.({type:`settled`,outcome:`cancelled`}),d()}})(),!0},Hn=(0,U.useRef)(Vn);Hn.current=Vn;let Un=async(e,t=[],n,r)=>{let i=Ot(_t.current);if(!i)return!1;if(r?.whileRunning){try{if(!t.length){let n=await pp(e,Bn);if(n.kind===`error`)return V(`error`,n.message),!1;if(n.kind===`handled`)return kt(i,t),!0}await P.queueFollowup(i.sid,e,De)}catch(e){return V(`error`,lt(e)),!1}return kt(i,t),!0}let a=null,o=!1,s=!t.length&&Tc(e.trim())?.cmd?.id===`rewrite`,c=await Vn(e,t,e=>{e.type===`settled`&&e.outcome===`error`&&(o=!0,a&&At(a,i)),_t.current===i.sid&&n?.(e)});return c&&!o&&!s&&(a=kt(i,t)),c},Wn=(0,U.useMemo)(()=>{let n=al(hc,e=>{Hn.current(e)},e=>{xt(e),we(e=>e+1)},e),r=[...y?[]:[{id:`new`,label:t(`palette.newDaemon`),hint:`+`,group:t(`palette.view`),run:zt}],{id:`transcript`,label:t(`palette.openTranscript`),hint:`/transcript`,group:t(`palette.view`),run:()=>u(`transcript`)},{id:`inspector`,label:t(`palette.openProject`),hint:t(`palette.projectHint`),group:t(`palette.view`),run:()=>u(`inspector`)},{id:`operations`,label:t(`palette.openOperations`),hint:t(`palette.operationsHint`),group:t(`palette.view`),run:xe},{id:`verticals`,label:t(`verticals.openStore`),hint:t(`verticals.paletteHint`),group:t(`palette.view`),run:()=>u(`verticals`)},{id:`help`,label:t(`help.title`),hint:`?`,group:t(`palette.view`),run:()=>u(`help`)},{id:`reasoning`,label:t(re?`palette.hideReasoning`:`palette.showReasoning`),hint:`⌘T`,group:t(`palette.view`),run:()=>I(e=>!e)},{id:`kiosk`,label:t(y?`palette.exitKiosk`:`palette.enterKiosk`),hint:`⌘.`,group:t(`palette.view`),run:()=>O(e=>!e)}],i=y?[]:[{id:`message`,label:t(`palette.messageArgus`),hint:`/`,group:t(`palette.action`),run:()=>we(e=>e+1)},...en?[{id:`cancel-message`,label:t(`palette.stopWaiting`),hint:`Esc`,group:t(`palette.action`),run:dt}]:[],...Ut?[{id:`continuous`,label:Ut.enabled?t(`palette.stopContinuous`):t(`palette.startContinuous`),group:t(`palette.action`),run:Rn}]:[],...W?.daemon.control_available===!1?[]:[W?.daemon.alive?{id:`stop`,label:t(`palette.stopDaemon`),group:t(`palette.action`),run:In}:{id:`start`,label:t(`palette.startDaemon`),group:t(`palette.action`),run:Pn}]],a=o.map(e=>({id:`p-${e.id}`,label:Bl(e)?(e.label||e.display_name||``).trim():e.objective.trim()||t(`sidebar.unnamedSession`),hint:e.daemon_alive?`● ${t(`common.live`)}`:`○`,keywords:`${e.id} ${e.display_name??``} ${e.objective} ${e.daemon_alive?`live running`:`stopped idle`}`,group:t(`palette.project`),run:()=>Pt(e.id)}));return[...r,...i,...n,...a]},[o,W?.daemon.alive,y,re,Ut?.enabled,en,dt,xt,e,t]);return(0,K.jsx)(id,{sid:H,readOnly:y,children:(0,K.jsxs)(We,{ref:ne,style:{"--sidebar-width":`${x}px`,"--preview-width":`${D}px`},children:[(0,K.jsx)(Jp,{error:c,onRetry:()=>{i.refetch(),a.refetch()}}),bn.fresh&&!bn.selection&&(0,K.jsxs)(`div`,{className:`delivery-toast`,role:`status`,"aria-live":`polite`,children:[(0,K.jsxs)(`span`,{children:[e===`zh-CN`?`新交付:`:`New delivery: `,bn.fresh.title]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>xn(bn.fresh),children:e===`zh-CN`?`查看`:`Open`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":e===`zh-CN`?`关闭`:`Dismiss`,onClick:bn.dismissFresh,children:`×`})]}),bn.selection&&(0,K.jsx)(bu,{sid:bn.selection.sid,path:bn.selection.path,delivery:bn.selection.receipt,deliveries:Sn,reviewActivity:bn.selection.sid===G?pn:void 0,onSelectDelivery:xn,onSelectPath:bn.selectPath,onClose:bn.close},`${bn.selection.sid}:${bn.selection.receipt.delivery_id}`),!y&&ae?(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`common.closeSessions`),onClick:()=>te(!1),className:`fixed inset-0 z-30 bg-black/40 lg:hidden`}):null,y?null:(0,K.jsx)(Bf,{projects:o,activeId:H,activeWork:G?{sessionId:G,status:Vr(W,on,Zt),connected:Kt&&!Vt.isError}:void 0,localCwd:s,onSelect:e=>{Pt(e),te(!1)},onPrefetch:mt,onManage:Nn,onResume:e=>void En(e),resumingId:Ke,onOpenPanel:e=>u(e),onOpenLearning:h,onOpenVerticals:()=>u(`verticals`),onNew:zt,loading:i.isLoading,creating:Rt,error:i.isError?lt(i.error):void 0,onRetry:()=>void i.refetch(),mobileOpen:ae,collapsed:!b,onToggleCollapse:()=>k(e=>!e),themeMode:oe,onCycleTheme:v}),!y&&b?(0,K.jsx)(ep,{label:t(`common.resizeSessions`),value:x,min:220,max:400,onPointerDown:e=>T(`left`,e),onReset:()=>A(256),onNudge:e=>A(t=>Math.max(220,Math.min(400,t+e)))}):null,(0,K.jsx)(`main`,{className:`flex min-w-0 flex-1 overflow-x-hidden`,children:W?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`${C===`activity`?`flex`:`hidden`} ${le===`map`&&!y?`mobile-scroll-region`:``} glass-panel glass-panel--main h-full min-w-0 flex-1 flex-col lg:flex`,children:[(0,K.jsx)(zl,{sid:G}),le!==`map`&&(0,K.jsx)(ri,{events:Zt,snap:W,streamOk:Kt,onStart:Pn,onStop:In,onManage:()=>H&&Nn(H),busy:Dn,snapshotStale:Vt.isError,readOnly:y,missionView:on}),(0,K.jsxs)(`nav`,{"aria-label":t(`mobile.views`),className:`hidden h-11 shrink-0 items-center gap-3 border-b border-line/60 px-5 lg:flex`,children:[(0,K.jsxs)(`div`,{className:`workspace-tabs`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>L(`map`),className:`workspace-tab`,"data-selected":le===`map`,children:t(`mobile.map`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>L(`activity`),className:`workspace-tab`,"data-selected":le===`activity`,children:t(`mobile.activity`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>L(`workbench`),className:`workspace-tab`,"data-selected":le===`workbench`,children:t(`mobile.workbench`)})]}),(0,K.jsxs)(`button`,{type:`button`,className:`ml-auto px-2 py-1 text-sm text-ink-dim hover:text-ink`,"aria-expanded":E,onClick:()=>{E?(M(!1),j(`activity`)):vn()},children:[e===`zh-CN`?`文件`:`Files`,Wt.data?.length?` · ${Wt.data.filter(e=>e.exists).length}`:``]})]}),!y&&(0,K.jsx)(Fn,{sid:H,onOpenKnowledge:()=>_(),onOpenSkills:()=>g()}),le===`map`&&(0,K.jsx)(U.Suspense,{fallback:(0,K.jsx)(`div`,{className:`m-auto text-sm text-ink-faint`,children:t(`common.loading`)}),children:(0,K.jsx)(em,{snapshot:W,events:rn,managerSteps:z,draft:vt,onDraftChange:xt,onSend:Un,attachments:yt,onAttachmentsChange:Et,pending:en,onCancel:dt,focusSignal:Ce,readOnly:y,onOpenSettings:()=>u(`config`),currentTaskId:on?.mission.id,routeOverride:De,onRouteOverrideChange:ke,conversationEvents:an,connected:Kt,artifacts:Wt.data??[],deliveryCount:Sn.length,onOpenDelivery:()=>{let e=Jl(Sn,on?.routing.vertical||``);e&&xn(e.receipt,e.path)},onOpenReceipt:xn,onOpenArtifact:Ie,onAnswer:()=>fn(!0)},W.session.id)}),(0,K.jsxs)(`div`,{className:`${le===`activity`?`flex`:`hidden`} workspace-view-surface min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(Rl,{alert:Yt}),(0,K.jsx)(`div`,{className:`flex flex-1 flex-col ${Se?`min-h-0`:`min-h-[209px] lg:min-h-0`}`,children:(0,K.jsx)(dc,{snapshot:W,missionView:on,events:Zt,connected:Kt&&!Vt.isError,showReasoning:re,onToggleReasoning:()=>I(e=>!e),historyStatus:Qt,historyRefreshing:Xt.isFetching,onRetryHistory:()=>void Xt.refetch(),embedded:!0,filter:it,query:ot,skipFirst:nt.skipFirst,artifacts:Wt.data,onOpenArtifact:yn,onOpenDelivery:xn},G)}),y?null:(0,K.jsx)(`div`,{className:`composer-dock shrink-0 px-4 pt-3`,children:(0,K.jsxs)(`div`,{className:`mx-auto w-full max-w-full lg:max-w-[61.8vw]`,children:[(0,K.jsx)(Il,{questions:W.pending_questions??[],backlog:W.backlog,currentTaskId:on?.mission.id,onAnswer:()=>fn(!0)}),(0,K.jsx)(il,{value:vt,attachments:yt,onAttachmentsChange:Et,onChange:xt,onSend:Un,onCancel:dt,disabled:!H,pending:en,focusSignal:Ce,embedded:!0,onRewrite:It,rewriting:bt,slashSelection:Te,onSlashSelectionChange:Ee,routeOverride:De,onRouteOverrideChange:ke,footer:H?(0,K.jsx)(br,{sid:W.session.id,roles:W.roles,running:W.daemon.alive||!!W.manager_requests?.length,lastCall:W.last_call,onOpenSettings:()=>u(`config`)}):void 0},H||`no-session`)]})})]}),de&&H?(0,K.jsx)(`div`,{className:`${le===`workbench`?`flex`:`hidden`} workspace-view-surface min-h-0 flex-1`,children:(0,K.jsx)(U.Suspense,{fallback:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-xs text-ink-faint`,children:t(`common.loading`)}),children:(0,K.jsx)($p,{sid:H,active:le===`workbench`,readOnly:y,runtimeRequest:_e,onRestored:async e=>{await i.refetch(),Pt(e)}})})}):null]}),E&&le!==`map`?(0,K.jsx)(ep,{label:t(`common.resizePreview`),value:D,min:320,max:840,onPointerDown:e=>T(`right`,e),onReset:()=>N(440),onNudge:e=>N(t=>Math.max(320,Math.min(840,t-e)))}):null,(E&&le!==`map`||C===`preview`)&&(0,K.jsxs)(`aside`,{"data-resizable-panel":`right`,className:`${C===`preview`?`flex`:`hidden`} relative min-w-0 flex-1 flex-col overflow-hidden border-l border-line/60 bg-panel lg:flex lg:flex-none lg:w-[var(--preview-width)]`,children:[(0,K.jsx)(`div`,{className:`lg:hidden`,children:(0,K.jsx)(ri,{events:Zt,snap:W,streamOk:Kt,onStart:Pn,onStop:In,onManage:()=>H&&Nn(H),busy:Dn,snapshotStale:Vt.isError,readOnly:y,missionView:on})}),(0,K.jsx)(Ld,{snapshot:W,connected:Kt&&!Vt.isError,sid:G,artifacts:Wt.data,error:Wt.isError,onExpand:Ie,onOpenFile:vn,className:`min-h-0 flex-1 mobile-scroll-region`,embedded:!0,onCollapse:()=>{M(!1),j(`activity`)},missionView:on,activityEvents:Zt,requestedPath:Le.path,requestedPathToken:Le.token,routeVisible:!0})]})]}):(0,K.jsx)(rp,{loading:i.isLoading||!!(H&&Vt.isLoading),hasProjects:o.length>0,error:i.isError&&o.length===0?n(i.error):Vt.isError&&!W?n(Vt.error):void 0,onRetry:()=>{i.refetch(),H&&Vt.refetch()},onNew:zt,onChoose:()=>te(!0),canCreate:!y})}),(0,K.jsx)(tt,{open:l===`learning`,onClose:()=>u(`none`),label:e===`zh-CN`?`技能库`:`Skill library`,width:`max-w-6xl`,children:l===`learning`&&(0,K.jsx)(qn,{sid:H,initialSelection:d,initialScope:p,projectNames:Object.fromEntries(o.flatMap(e=>e.display_name?[[e.id,e.display_name]]:[]))})}),(0,K.jsx)(sl,{open:l===`palette`,onClose:()=>u(`none`),items:Wn}),(0,K.jsx)(Lf,{open:l===`verticals`,onClose:()=>u(`none`)}),(0,K.jsx)(ll,{open:l===`help`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(jl,{sid:H,open:l===`doctor`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(Ml,{sid:H,open:l===`config`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(Nl,{sid:H,open:l===`identity`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(Pl,{sid:H,open:l===`transcript`,onClose:()=>u(`none`)}),H&&W?(0,K.jsx)(Xf,{open:l===`inspector`,snap:W,journal:tn.data??[],busy:wn.disposeBacklog.isPending||wn.stopBacklog.isPending,onClose:()=>u(`none`),onDispose:Mn,onStop:Ln,onInspect:Be}):null,(0,K.jsx)(bu,{sid:H,path:Fe,artifacts:Wt.data??[],reviewActivity:H===G?pn:void 0,onSelectPath:Ie,onClose:()=>Ie(null)}),(0,K.jsx)($f,{sid:H,itemId:ze,onClose:()=>Be(null),onDone:e=>Mn(e,`done`),onSkip:e=>Mn(e,`rm`),onStop:Ln,busy:wn.disposeBacklog.isPending||wn.stopBacklog.isPending,readOnly:y}),(0,K.jsx)(Ll,{reply:cn,open:dn,busy:ln,error:un,onClose:()=>fn(!1),onSubmit:sn}),Ue?(0,K.jsx)(zd,{open:Ve,sid:Ue,name:Ht.data?.session.display_name||o.find(e=>e.id===Ue)?.display_name||o.find(e=>e.id===Ue)?.label||``,alive:Ht.data?.daemon.alive??!!o.find(e=>e.id===Ue)?.daemon_alive,controlAvailable:Ht.data?.daemon.control_available!==!1,busy:Dn,onClose:()=>{He(!1),Ge(null)},onRename:An,onStart:jn,onStop:kn,onDelete:async()=>{let e=Ue,t=await On();return t&&e&&Nt(e),t}}):null,(0,K.jsx)(Rd,{notice:et,onClose:ct}),W&&!y?(0,K.jsx)(ip,{active:C===`preview`?`preview`:le,sidebarOpen:ae,onSelect:e=>{if(e===`preview`){j(`preview`);return}j(`activity`),L(e)},onOpenSessions:()=>te(!0)}):null]})})}export{No as $,Xs as A,G as At,ts as B,Hs as C,vn as Ct,qs as D,Yt as Dt,Ws as E,Zt as Et,fs as F,Ft,wo as G,Co as H,Ls as I,Mt as It,Oo as J,Uo as K,rs as L,kt as Lt,Ds as M,Ht as Mt,Rs as N,Rt as Nt,Zs as O,Gt as Ot,ls as P,It as Pt,Po as Q,es as R,dc as S,Cn as St,Ks as T,Qt as Tt,Ao as U,yo as V,Go as W,Eo as X,Lo as Y,To as Z,Hc as _,Ir as _t,Iu as a,Zi as at,Qc as b,br as bt,Nu as c,ti as ct,Yl as d,nm as default,Zr as dt,Wo as et,Il as f,Yr as ft,$c as g,Vr as gt,nl as h,Lr as ht,Lu as i,sa as it,as as j,W as jt,Js as k,Ut as kt,_u as l,Xr as lt,Cl as m,ei as mt,nd as n,ca as nt,Mu as o,ia as ot,wl as p,Qr as pt,Io as q,Zu as r,fa as rt,ju as s,Hi as st,Zp as t,qa as tt,ru as u,$r as ut,zc as v,Kr as vt,Gs as w,wn as wt,fc as x,Sn as xt,Yc as y,jr as yt,$o as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/App-DaQfrTdA.js b/frontend/web/dist/assets/App-DaQfrTdA.js new file mode 100644 index 000000000..968816990 --- /dev/null +++ b/frontend/web/dist/assets/App-DaQfrTdA.js @@ -0,0 +1,53 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ResearchWorkbenchPanel-JZm5wBvl.js","./rolldown-runtime-hePW80VL.js","./icons-DRlFT_ri.js","./query-CUzIxVzm.js","./index-W1lBlVkr.js","./markdown-D-35pK1E.js","./markdown-DvoRHisr.css","./index-Diz-_RXt.css","./AppearanceControls-BFWF0z-J.js","./code-xml-DwzUAooI.js","./play-CwpVgDoP.js","./useWorkbenchTheme-D7cPkLzc.js","./ResearchWorkbenchPanel-BS5QOR9J.css","./MapPanel-RwxFeqjp.js","./history-BtuT-8i3.js","./format-1SN2SmDZ.js","./MapPanel-BHNQrOn8.css"])))=>i.map(i=>d[i]); +import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{C as n,D as r,E as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,w as E,x as D,y as O}from"./icons-DRlFT_ri.js";import{S as k,a as A,b as j,c as M,i as ee,n as N,r as P}from"./query-CUzIxVzm.js";import{i as F}from"./markdown-D-35pK1E.js";import{A as te,B as ne,C as re,D as ie,E as I,F as L,G as ae,J as oe,K as se,M as ce,N as le,O as ue,P as R,R as de,S as fe,T as pe,V as me,W as he,_ as ge,a as _e,b as ve,c as ye,d as be,f as xe,g as Se,h as Ce,i as we,j as Te,k as z,l as Ee,m as De,n as Oe,o as ke,p as Ae,r as je,s as Me,t as Ne,u as Pe,v as Fe,w as Ie,x as Le,y as Re,z as ze}from"./index-W1lBlVkr.js";import{A as Be,C as Ve,D as He,E as B,F as Ue,I as We,L as Ge,M as Ke,N as qe,O as Je,P as Ye,R as V,S as Xe,T as Ze,_ as Qe,a as $e,b as et,c as tt,d as nt,f as rt,g as H,h as it,i as at,j as ot,k as st,l as ct,m as lt,n as ut,o as U,p as dt,r as W,s as ft,t as pt,u as mt,v as ht,w as gt,x as _t,y as vt}from"./AppearanceControls-BFWF0z-J.js";import{a as yt,c as bt,i as xt,l as St,n as Ct,o as wt,r as Tt,s as Et,t as Dt}from"./format-1SN2SmDZ.js";import{a as Ot,i as kt,n as At,r as jt,t as Mt}from"./useWorkbenchTheme-D7cPkLzc.js";var G=t(r(),1),Nt=`local_request_id`,Pt=e=>Array.isArray(e)&&e.length>0;function Ft(e,t,n,r,i=Date.now(),a=!0,o){let s=e.findIndex(e=>e.type===`ui.argus`&&Number(e[Nt])===n);if(s<0)return!r.length&&!a?e:[...e,{type:`ui.argus`,agent_layer:`manager`,text:``,ts:i/1e3,event_id:`local-${t}-${n}-argus`,message_id:`local-${n}-argus`,fragment_mode:`snapshot`,steps:r,live:a,...o?{status:o}:{},[Nt]:n}];let c=[...e];return c[s]={...c[s],...r.length?{steps:r}:{},live:a,...o?{status:o}:{}},c}function It(e,t,n=Date.now(),r=`stopped`){return e.map(e=>{if(e.type!==`ui.argus`||Number(e[Nt])!==t||e.live!==!0)return e;let i=Array.isArray(e.steps)?e.steps.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return t.ended_ts||t.status!==`running`?e:{...t,ended_ts:n/1e3,status:r}}):e.steps;return{...e,live:!1,status:r,...i===void 0?{}:{steps:i}}})}function Lt(e,t,n,r=Date.now()){return{type:`ui.operator`,agent_layer:`operator`,text:n,ts:r/1e3,event_id:`local-${e}-${t}-operator`,message_id:`local-${t}-operator`,[Nt]:t}}function Rt(e,t,n,r,i,a=Date.now(),o=`auto`){let s=r.trim();if(!s)return e;let c=e.findIndex(e=>e.type===`ui.argus`&&Number(e[Nt])===n),l=i.endsWith(`-argus`)?`${i.slice(0,-6)}-operator`:``,u=l?e.map(e=>e.type===`ui.operator`&&Number(e[Nt])===n?{...e,message_id:l}:e):e,d=u.find(e=>e.type===`ui.operator`&&Number(e[Nt])===n),f=d?Math.max(0,a-Number(d.ts??a/1e3)*1e3):0;if(c<0)return[...u,{type:`ui.argus`,agent_layer:`manager`,text:s,ts:a/1e3,event_id:`local-${t}-${n}-argus`,message_id:i||`local-${n}-argus`,fragment_mode:o,response_latency_ms:f,[Nt]:n}];let p=u[c],m=[...u];return m[c]={...p,text:Ie(String(p.text??``),s,o),message_id:i||p.message_id,fragment_mode:o},m}function zt(e,t,n){let r=e.filter(e=>e.type!==`engineer.progress`||e.turn_step!==!0),i=new Map,a=[...r];r.forEach((e,t)=>{let n=String(e.type??``);if(n!==`ui.operator`&&n!==`ui.argus`)return;let r=`${n}\u0000${String(e.text??``)}`;i.set(r,[t,...i.get(r)??[]])});let o=t.map(e=>({type:e.role===`operator`?`ui.operator`:`ui.argus`,agent_layer:e.role===`operator`?`operator`:`manager`,text:e.text,ts:e.ts,message_id:e.message_id||`transcript-${e.ts}-${e.role}`,...e.mission_result===!0?{mission_result:!0}:{},...typeof e.item_id==`string`?{item_id:e.item_id}:{},...typeof e.success==`boolean`?{success:e.success}:{},...typeof e.summary==`string`?{summary:e.summary}:{},...typeof e.delivery_id==`string`?{delivery_id:e.delivery_id}:{},...e.delivery&&typeof e.delivery==`object`?{delivery:e.delivery}:{},...Pt(e.steps)?{steps:e.steps}:{}})),s=Array(o.length).fill(!0);for(let e=o.length-1;e>=0;--e){let n=o[e],r=`${String(n.type)}\u0000${String(n.text??``)}`,c=i.get(r)??[],l=t[e].message_id,u=e=>{let t=a[e];return n.item_id&&t.item_id&&n.item_id!==t.item_id?!1:n.mission_result!==!0&&t.mission_result!==!0||!!(l&&t.message_id===l)||!!(!l&&n.delivery_id&&n.delivery_id===t.delivery_id)},d=c.findIndex(e=>u(e)&&!!(l&&a[e].message_id===l));if(d<0&&(d=c.findIndex(u)),d>=0){s[e]=!1;let[t]=c.splice(d,1),r=a[t];if(l&&r.message_id===l){let e={};for(let t of[`mission_result`,`item_id`,`success`])(r[t]==null||r[t]===``)&&n[t]!=null&&(e[t]=n[t]);a[t]={...r,...e}}}}let c=[...o.filter((e,t)=>s[t]),...a],l=Array(c.length).fill(!0),u=new Set,d=n.map(e=>{let t=String(e.message_id??``),n=t?c.findIndex((e,n)=>!u.has(n)&&String(e.message_id??``)===t):-1,r=Number(e.ts??0);if(n<0&&(n=c.findIndex((t,n)=>{if(u.has(n)||t.type!==e.type||t.text!==e.text)return!1;let i=Number(t.ts??0);return Math.abs(i-r)<=5})),n>=0){u.add(n),l[n]=!1;let t=c[n];return{...e,...t.mission_result===!0?{mission_result:!0}:{},...typeof t.item_id==`string`?{item_id:t.item_id}:{},...typeof t.success==`boolean`?{success:t.success}:{},...typeof t.summary==`string`?{summary:t.summary}:{},...typeof t.delivery_id==`string`?{delivery_id:t.delivery_id}:{},...t.delivery&&typeof t.delivery==`object`?{delivery:t.delivery}:{},...Pt(t.steps)?{steps:t.steps,live:!1}:{}}}return e});return[...c.filter((e,t)=>l[t]),...d].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0))}function Bt(e,t,n,r,i){let a=ge(e,t,120);return{query:a,events:(0,G.useMemo)(()=>e?zt(n,a.data??[],i===e?r:[]):[],[e,n,a.data,r,i]),status:a.isError?`error`:a.isPending?`loading`:`ready`}}var Vt=V(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Ht=V(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),K=V(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),q=V(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Ut=V(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Wt=V(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Gt=V(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Kt=V(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qt=V(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Jt=V(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),Yt=V(`Diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Xt=V(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Zt=V(`FilePenLine`,[[`path`,{d:`m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2`,key:`142zxg`}],[`path`,{d:`M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`2t3380`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),Qt=V(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),$t=V(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),en=V(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),tn=V(`Layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),nn=V(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),rn=V(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),an=V(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),on=V(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),sn=V(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),cn=V(`Paperclip`,[[`path`,{d:`M13.234 20.252 21 12.3`,key:`1cbrk9`}],[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486`,key:`1pkts6`}]]),ln=V(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),un=V(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),dn=V(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),fn=V(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),pn=V(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),mn=V(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),hn=V(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),gn=V(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),_n=V(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),vn=V(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),yn={"global/agent-team-lead.md":{title:`多智能体团队协作`,summary:`判断何时值得并行工作,按文件与职责拆分协作,并独立审查汇总结果;不替代原有角色与授权。`,originalName:`Agent Team Lead`,source:`argus/builtin_skills/agent-team-lead.md`,sourceSha256:`b490cc96572941fa4a2fe4937bd3e86c9802c132439ae779fcf8e88241ba9521`},"global/curator/argus-curator-role.md":{title:`团队成果整理`,summary:`维护团队候选成果池和比较记录,归纳后续策略;整理者不代替执行者完成工程任务。`,originalName:`Team Curator`,source:`argus/builtin_skills/curator/argus-curator-role.md`,sourceSha256:`3dfd743254a91f88feef76e85683225dc5b510b7f417f6430ef7b975b8eb0f5b`},"global/engineer/minimal-coding-agent.md":{title:`最小且严谨的软件修改`,summary:`用足够小的改动实现、修复或重构软件与界面,保留既有行为,避免无依据的抽象和新增依赖。`,originalName:`极简而严谨的 Coding Agent`,source:`argus/builtin_skills/engineer/minimal-coding-agent.md`,sourceSha256:`aa47c79252eb5086451530ae25aac77ce87bd4315eda1e9defae2af719295cab`},"global/engineer/pdf-chat.md":{title:`分段阅读 PDF`,summary:`按页或章节阅读并核对版本、页码;图片和版式需查看实际页面,回答只依据相关证据。`,originalName:`Progressive PDF Reading`,source:`argus/builtin_skills/engineer/pdf-chat.md`,sourceSha256:`141bd41eb888191aedc391f0df2ba100ab5aee3e7970f9afc21a6f50f4deca5f`},"global/engineer/presentation-master.md":{title:`可编辑演示文稿`,summary:`使用已有 PPT Master 工具制作或修改可编辑演示文稿和原生 PPT 图,经指定解释器运行并核对导出效果;科研绘图路线由科研垂域决定。`,originalName:`Editable Presentations with PPT Master`,source:`argus/builtin_skills/engineer/presentation-master.md`,sourceSha256:`b9f5ed3935b538a18280ac79a504a3b28b432b66efb884e3e06284b4f1729ff3`},"global/engineer/skill-authoring-guide.md":{title:`编写与审阅技能和 Wiki 页面`,summary:`只在证据表明有可复用做法时写技能;先学操作者材料再忠实编辑;Wiki 更新来自一手来源;审阅者按证据真实、无冗余、不倒退、层级正确来判断一次修改。`,originalName:`Writing and Reviewing Skills and Wiki Pages`,source:`argus/builtin_skills/engineer/skill-authoring-guide.md`,sourceSha256:`cf4073da950ef34a359fa3f4b9c77c9d00ebd56bcb79a678efc3e04197ec7e79`},"global/engineer/web-primary-source-evidence.md":{title:`查证一手网络来源`,summary:`为软件、产品、接口和基准等现实信息寻找并保留一手来源,让重要结论能够追溯。`,originalName:`Web Primary-Source Evidence`,source:`argus/builtin_skills/engineer/web-primary-source-evidence.md`,sourceSha256:`632930eb13afc66ebf4742ab6c87fa586edee916c3eeacef25f50215e78f776f`},"global/manager/evidence-based-stage-decision.md":{title:`经理的职责与阶段决定`,summary:`经理是唯一改变阶段的角色;结合规划和评审证据决定继续、推进、返回或结束,部署始终需要操作者批准。`,originalName:`The Manager's role and stage decisions`,source:`argus/builtin_skills/manager/evidence-based-stage-decision.md`,sourceSha256:`d664fa7b6e92045335da59739575326b89e70d38662c1ffdc79774c599e36817`},"global/performance-profile-ground-truth.md":{title:`真实工作负载性能分析`,summary:`用指定环境和代表性输入定位瓶颈,对照未开启剖析的实测结果;不顺带执行未要求的优化。`,originalName:`Performance Profile Ground Truth`,source:`argus/builtin_skills/performance-profile-ground-truth.md`,sourceSha256:`42430420ce8bd31047780e9b08ac5eab366f849eb222805ca05492779095f4d0`},"global/planner/dependency-aware-task-decomposition.md":{title:`规划者的职责与按依赖拆解任务`,summary:`规划者只读只派、不执行,阶段只由经理改变;把目标与已有证据整理成最小、可执行、有真实依赖且能明确验收的任务集合。`,originalName:`The Planner's role and dependency-aware task decomposition`,source:`argus/builtin_skills/planner/dependency-aware-task-decomposition.md`,sourceSha256:`06d5295c6777a64c90a28a5603884e557a72ad5961b19a3f411dc1e83e331886`},"global/project-venv-package-management.md":{title:`项目环境、依赖与运行前核查`,summary:`使用项目自身的环境与锁文件,只安装任务需要的依赖,在承载论断的运行前只核查它真正用到的资源;不修改 Argus 框架自己的运行环境。`,originalName:`Project Environment and Dependencies`,source:`argus/builtin_skills/project-venv-package-management.md`,sourceSha256:`ab8728ad9fff58e8bc4672e5bc2446135f376b55b52392a6104b2eb52e9ed327`},"global/reviewer/argus-reviewer-role.md":{title:`评审者的职责与给执行者的下一步`,summary:`独立判断执行结果是否成立、需要补充或转向,把检查结果提炼成执行者需要的那一个下一步;评审有争议时以带标签的证据而非角色权威定论,不替执行者作完成声明。`,originalName:`The Reviewer's role`,source:`argus/builtin_skills/reviewer/argus-reviewer-role.md`,sourceSha256:`8457a177a4376eab0e4bef7a652e3276ce3b6f9a0ab421fd15bd96eb057cf852`},"global/reviewer/engineer-process-audit.md":{title:`核对执行过程与证据`,summary:`当成果或验证声明存在争议时检查任务相关回执和日志,区分缺少记录与确实未执行。`,originalName:`Engineer Process Audit`,source:`argus/builtin_skills/reviewer/engineer-process-audit.md`,sourceSha256:`b109fb737e747b863244c9b03e1b23ff82acf724ef420bc547ad457c1cf65ac5`},"global/reviewer/web-source-evidence-audit.md":{title:`审查网络证据是否支撑结论`,summary:`核对实际取得的来源与重要现实信息声明是否一致,不把有链接等同于已经证实。`,originalName:`Web Source-Evidence Audit`,source:`argus/builtin_skills/reviewer/web-source-evidence-audit.md`,sourceSha256:`35dbb6288199c52d4ecfd4e241a54346f5ef8af985f50bf24121e687ea9dc22e`},"global/stale-blocker-verification-probe.md":{title:`核实旧阻塞与易变的外部事实`,summary:`用最小且已授权的探针判断记录中的阻塞是否仍然存在;只在决策依赖时核实外部事实,把身份、许可与执行当作三个不同的问题。`,originalName:`Verify a Recorded Blocker or a Changing External Fact`,source:`argus/builtin_skills/stale-blocker-verification-probe.md`,sourceSha256:`3eb5f473bbf1cf482a840e7af3c84bc939a6710b60f84415ad94e6932a9122b3`},"vertical/argus_maintenance/engineer/argus-maintenance-execution.md":{title:`Argus 小范围维护`,summary:`按核心与领域职责检查和简化框架,用小而可复用的修改解决明确问题。`,originalName:`Argus Maintenance`,source:`argus/verticals/argus_maintenance/skills/engineer/argus-maintenance-execution.md`,sourceSha256:`138f9b7e2503c5ce0307e575fa0555a62e1820c559e105d60cc6e31ab9991c0f`},"vertical/argus_maintenance/reviewer/argus-maintenance-review.md":{title:`Argus 维护变更评审`,summary:`核对补丁是否真正简化、复用和解耦,并用验证结果证明行为,而不是只看代码缩短。`,originalName:`Argus Maintenance Review`,source:`argus/verticals/argus_maintenance/skills/reviewer/argus-maintenance-review.md`,sourceSha256:`d6ad0f8eb29d5ca3d5a66fbc7df34de86e42229f15e8e2e22ce601a8ae08c4f8`},"vertical/chemistry/engineer/batteries/battery-identity-and-data-normalization.md":{title:`电池对象与测试数据对齐`,summary:`在循环分析前统一电芯、电极、电解液、测试协议和时间序列身份;不用于分子计算或一般光谱分析。`,originalName:`Battery Cell Identity and Electrochemical Data Normalization`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-identity-and-data-normalization.md`,sourceSha256:`d1cfc1cb94cf4e4828fcd2b75fb0f1dc57181208f2fad1f19c343a9d169462e6`},"vertical/chemistry/engineer/batteries/battery-model-validation.md":{title:`电池模型与退化解释验证`,summary:`用防止数据泄漏的实测电芯数据验证预测和退化解释,明确模型边界;不把预测当作实测。`,originalName:`Battery Model Boundary and Degradation Validation`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-model-validation.md`,sourceSha256:`fe4ec1ec78ec21dd0d568b71276c2f85e13b6216d5a7770f5f75d09baabc6d27`},"vertical/chemistry/engineer/batteries/cycling-and-degradation-analysis.md":{title:`电池循环与退化分析`,summary:`分析循环、倍率、阻抗和退化轨迹,保留电芯与协议对照,并避免评估数据泄漏。`,originalName:`Battery Cycling and Degradation Analysis Workflow`,source:`argus/domains/chemistry/skills/engineer/batteries/cycling-and-degradation-analysis.md`,sourceSha256:`3e0870b82fbc40463f81ca8eb1e84576c9fe1ae5fe501da6d2b274535fd16d2e`},"vertical/chemistry/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md":{title:`生化结合与功能实验分析`,summary:`分析亲和力、动力学、抑制和功能证据,核对构建体、辅因子、状态与实验对照;对接结果不能单独证明活性。`,originalName:`Biochemical Binding, Kinetics, and Functional Assay Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md`,sourceSha256:`12d235a655a1b6b6022a84a5c36e3c291df6227cb40bd2dc78f19012deff62e5`},"vertical/chemistry/engineer/biochemistry/biochemistry-structural-computational-evidence.md":{title:`生化结构与模拟的证据边界`,summary:`把结构、分子对接、动力学和突变结果作为待验证假设,结合真实实验边界解释,不直接宣称亲和力成立。`,originalName:`Biochemistry Structural, Docking, and MD Evidence Boundary Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-structural-computational-evidence.md`,sourceSha256:`47283774a89fa87050fd35df791c961dce37588ec9c92c9d4e357d59a9f14d6c`},"vertical/chemistry/engineer/biochemistry/biochemistry-system-and-assay-normalization.md":{title:`生化体系与实验对象对齐`,summary:`统一序列、构建体、分子状态、配体、辅因子、突变、结构和实验身份,再开展比较。`,originalName:`Biochemistry and Chemical Biology System Identity Normalization`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-system-and-assay-normalization.md`,sourceSha256:`9b7d80ae04064e9a1b5465dc1fee60f5511491694aaa20e423ae92779ad12ee5`},"vertical/chemistry/engineer/characterization/characterization-data-and-sample-normalization.md":{title:`表征样品与原始数据对齐`,summary:`保留衍射、光谱、质谱、核磁和显微原始数据及仪器信息;不把不同测试方式统一成简单拟峰。`,originalName:`Characterization Sample, Instrument Data, and Metadata Normalization`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-data-and-sample-normalization.md`,sourceSha256:`dad27a33c24c37fdc17a7f7386478246e7847edde9cac4cc2939590ab3e07b9c`},"vertical/chemistry/engineer/characterization/characterization-validation-and-integration.md":{title:`多种表征证据交叉验证`,summary:`综合不同仪器证据时保留各自适用范围和限制,避免跨测试方式作过强推断。`,originalName:`Characterization Validation and Multimodal Evidence Integration`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-validation-and-integration.md`,sourceSha256:`9671988085d6a0127a4739300c9c851e904016f8f17c31fafb676303b7d736c1`},"vertical/chemistry/engineer/characterization/modality-specific-interpretation-workflow.md":{title:`按测试方式解释表征结果`,summary:`依据衍射、光谱、质谱、核磁或显微的具体机制选择对照和模型,不使用一套解释套用全部数据。`,originalName:`Modality-Specific Chemical Characterization Interpretation Workflow`,source:`argus/domains/chemistry/skills/engineer/characterization/modality-specific-interpretation-workflow.md`,sourceSha256:`c09d9f9710e8ee7a72ff7cfd0f04ec741ea792a61a8b8abf56c038c26b126e46`},"vertical/chemistry/engineer/chemistry-execution.md":{title:`化学研究执行指南`,summary:`按任务选择领域流程,核实实际工具能力,保留一手证据并验证科学结论;实体实验仍需明确授权。`,originalName:`Chemistry Research Execution`,source:`argus/domains/chemistry/skills/engineer/chemistry-execution.md`,sourceSha256:`d6ad8b3ae0254319e31de1ca91a7c75fd06c70795d3948b38b8d35b895e69d59`},"vertical/chemistry/engineer/chemistry-toolkit.md":{title:`化学方法与工具导航`,summary:`先选择科学问题对应的方法,再查看具体工具说明;这是导航目录,不是自动安装或执行脚本。`,originalName:`Chemistry Skill and Capability Router`,source:`argus/domains/chemistry/skills/engineer/chemistry-toolkit.md`,sourceSha256:`14840bc5603ce237373ab4832f7bf747c24e6d4ef524eb2ccd112a8bb9eaea70`},"vertical/chemistry/engineer/computational_chemistry/computational-identity-normalization.md":{title:`计算化学对象与输入对齐`,summary:`在量子化学、力场、分子动力学或自由能计算前,统一分子或周期体系的输入与状态。`,originalName:`Computational Chemistry Identity and Input Normalization`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-identity-normalization.md`,sourceSha256:`fd9bebbdc28731a9eeab536279466e3b97c289a49db515f509c713f4b3f0df7b`},"vertical/chemistry/engineer/computational_chemistry/computational-validation-and-interpretation.md":{title:`计算收敛性与结论边界`,summary:`验证数值收敛、模型敏感性和适用范围,区分计算预测与实验测量,不外推为生物活性证明。`,originalName:`Computational Chemistry Convergence and Interpretation Validation`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-validation-and-interpretation.md`,sourceSha256:`ed1bffff26a5cb22ff61c60dcbf3464cbcff0f15200b9d604436bcd6243ab3f7`},"vertical/chemistry/engineer/computational_chemistry/electronic-structure-simulation-workflow.md":{title:`可复现电子结构与分子模拟`,summary:`组织分子或周期体系计算,分别检查方法选择和数值收敛,保留可复现的输入与输出。`,originalName:`Reproducible Electronic-Structure and Molecular Simulation Workflow`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/electronic-structure-simulation-workflow.md`,sourceSha256:`13c5d42ae2f417c7f16665e33f3660fad9f76163be2a08401edd57662ab6f22c`},"vertical/chemistry/engineer/crystallography/cif-and-structure-validation.md":{title:`CIF 与晶体结构检查`,summary:`核对格式、对称性、组成、几何、占位、位移参数和精修证据;不代替从头解结构。`,originalName:`CIF and Crystal Structure Validation`,source:`argus/domains/chemistry/skills/engineer/crystallography/cif-and-structure-validation.md`,sourceSha256:`b49527c827b69b5a37543059faf997fa8d0c9c3f60ed2c0a0e6807ddf5b0e802`},"vertical/chemistry/engineer/crystallography/diffraction-and-crystal-identity.md":{title:`衍射数据与晶体对象对齐`,summary:`核对单晶或粉末衍射的波长、几何、晶胞、对称性、物相及 CIF 来源。`,originalName:`Diffraction and Crystal Structure Identity`,source:`argus/domains/chemistry/skills/engineer/crystallography/diffraction-and-crystal-identity.md`,sourceSha256:`97367c0fad622c1d2ae19868b12a8de571bbc99c282c8b5eec4c4b97ed3615ed`},"vertical/chemistry/engineer/crystallography/structure-solution-and-refinement.md":{title:`晶体结构求解与精修`,summary:`结合数据处理、对称性检验、化学约束、残差和替代解释完成结构求解及精修。`,originalName:`Crystal Structure Solution and Refinement Workflow`,source:`argus/domains/chemistry/skills/engineer/crystallography/structure-solution-and-refinement.md`,sourceSha256:`8f5d913cf3bfc6c421f2d137ece735eba96e3b6840da63d6c4d40c22bc518e08`},"vertical/chemistry/engineer/foundations/chemical-identity-and-representation.md":{title:`化学对象与表达方式核实`,summary:`先核对分子、反应、材料、晶体、样品、序列或配方身份;这是跨领域基础,不替代专门流程。`,originalName:`Chemical Identity and Representation`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-identity-and-representation.md`,sourceSha256:`b1b0f0148ae94a1ad6ad60b6383cc8f6b1596b387d885ca896148486004ac392`},"vertical/chemistry/engineer/foundations/chemical-risk-and-authorization.md":{title:`化学风险与授权边界`,summary:`识别化学、生物、热、电、压力、辐射和仪器风险;文档建议不等于允许开展实体操作。`,originalName:`Chemical Risk and Authorization Boundary`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-risk-and-authorization.md`,sourceSha256:`2d6cb4a8421bb62bbde199f7aa131f5f678019ffbeed231f0676e9095f176b5e`},"vertical/chemistry/engineer/foundations/chemistry-workflow-output-contract.md":{title:`化学任务输入与交付约定`,summary:`明确输入、决策、能力核实、证据、验证方式、输出与停止条件,用于缺少更具体流程的任务。`,originalName:`Chemistry Workflow and Output Contract`,source:`argus/domains/chemistry/skills/engineer/foundations/chemistry-workflow-output-contract.md`,sourceSha256:`1b52c242611bb39cbbe929dc2bee8072e501ab56b23907df50a51c5c0b4f15fd`},"vertical/chemistry/engineer/foundations/computational-reproducibility.md":{title:`化学计算与分析的可复现性`,summary:`保留计算、模拟、数据处理和模型训练的输入、环境、数值设置、诊断与主要输出。`,originalName:`Chemistry Computational Reproducibility`,source:`argus/domains/chemistry/skills/engineer/foundations/computational-reproducibility.md`,sourceSha256:`d92b4a7b6e65c92138ef785a04a47f1fae6ab4ef2e6c4af111264cdc081a0bd8`},"vertical/chemistry/engineer/foundations/dataset-curation-and-leakage.md":{title:`化学数据整理与泄漏控制`,summary:`核对数据来源、去重、分组、标签和划分方式,避免分子、反应或样品间的信息泄漏。`,originalName:`Chemistry Dataset Curation and Leakage Control`,source:`argus/domains/chemistry/skills/engineer/foundations/dataset-curation-and-leakage.md`,sourceSha256:`ceeaf0a929c67df26cc91651721d943749c7e2c3bad6c7978cb78fa085bf948b`},"vertical/chemistry/engineer/foundations/evidence-provenance-and-claim-levels.md":{title:`化学证据来源与结论强度`,summary:`区分检索、整理、预测、计算、模拟、测量与推断,让结论不超出证据能支持的程度。`,originalName:`Chemistry Evidence Provenance and Claim Levels`,source:`argus/domains/chemistry/skills/engineer/foundations/evidence-provenance-and-claim-levels.md`,sourceSha256:`c8b6454e673aae3298d4089c1603b9edfe63c4be7f5f3ad8fd6f24ef2b2910f5`},"vertical/chemistry/engineer/foundations/failure-diagnosis-and-negative-results.md":{title:`化学任务失败与负结果分析`,summary:`保留失败证据,区分实现缺陷、资源问题和科学假设被否定,不把负结果隐去。`,originalName:`Chemistry Failure Diagnosis and Negative Results`,source:`argus/domains/chemistry/skills/engineer/foundations/failure-diagnosis-and-negative-results.md`,sourceSha256:`068cf8400d770fb6c97edbd26d6788adb1acc0e7d6ea00e3b14949c7a9a64a40`},"vertical/chemistry/engineer/foundations/uncertainty-and-applicability-domain.md":{title:`化学结果的不确定性与适用范围`,summary:`判断模型、计算、测量或文献结论能否用于当前实际体系,并量化或说明不确定性。`,originalName:`Chemistry Uncertainty and Applicability Domain`,source:`argus/domains/chemistry/skills/engineer/foundations/uncertainty-and-applicability-domain.md`,sourceSha256:`d552b6cad9e2a942e44a1a4c98647236488186458d3f2cd4bdd395a34c23d8ae`},"vertical/chemistry/engineer/foundations/units-conditions-and-normalization.md":{title:`化学单位与条件规范化`,summary:`比较不同来源前明确单位、计量基础、环境条件、样品归一方式和报告约定。`,originalName:`Chemical Units Conditions and Normalization`,source:`argus/domains/chemistry/skills/engineer/foundations/units-conditions-and-normalization.md`,sourceSha256:`540d6c4a3389900be51e3e9a7bdcf7f16169bb72246d53cbb1fbac247b527cde`},"vertical/chemistry/engineer/materials_science/materials-discovery-and-optimization.md":{title:`材料发现与优化研究`,summary:`限定设计空间、性质目标、基线与不确定性,组织可验证的筛选或工艺优化,不替代晶体精修。`,originalName:`Materials Discovery and Optimization Workflow`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-discovery-and-optimization.md`,sourceSha256:`02d2aeacb74302eb2853345772f5096cce5b26db15ab5d229a210ccfabe04cbd`},"vertical/chemistry/engineer/materials_science/materials-identity-processing-and-property-data.md":{title:`材料组成、工艺与性能数据`,summary:`统一组成、物相、工艺历史、样品形态、微结构和测试条件,建立可比的性能记录。`,originalName:`Materials Identity Processing and Property Data`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-identity-processing-and-property-data.md`,sourceSha256:`ec0ac9c5a4b62eb9d027a97f9c78cc9ed986776e48f9f3bbf94f015a8d689521`},"vertical/chemistry/engineer/materials_science/processing-structure-property-validation.md":{title:`工艺—结构—性能关系验证`,summary:`用可比样品、对照和不确定性检验材料关系声明,保留机理解释的适用边界。`,originalName:`Materials Processing Structure Property Validation`,source:`argus/domains/chemistry/skills/engineer/materials_science/processing-structure-property-validation.md`,sourceSha256:`7c556e48b0b97de122d0f342839c92ece5e33f36c1aa3f7efbcc6fbc319ea06c`},"vertical/chemistry/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md":{title:`MOF 构筑单元与拓扑识别`,summary:`从来源结构核实节点、连接体、连通性、穿插、缺陷、客体和网络拓扑,不以普通 CIF 检查代替。`,originalName:`MOF Framework Identity Node Linker and Topology`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md`,sourceSha256:`7a6490bd8dad40deeb548f03541673b91df2bd9bddbe3e9c8cf58d73b3ee31b8`},"vertical/chemistry/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md":{title:`MOF 数据、预测与结构生成`,summary:`组织拓扑相关去重、泄漏控制、性质预测和生成结构的分阶段验证;生成不等于可合成。`,originalName:`MOF Datasets Prediction and Structure Generation`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md`,sourceSha256:`8f1d023caf19aeb5801036cc58e2531cd8d39bb398008a4b614c654b3073ab51`},"vertical/chemistry/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md":{title:`MOF 孔隙、吸附与性质分析`,summary:`关联原始等温线、活化和样品状态,检查孔隙、吸附、输运模型及不确定性。`,originalName:`MOF Porosity Adsorption and Structure Property Workflow`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md`,sourceSha256:`98088eef9fa108d0f0aa8fab9f746315414cc64edbcfab0d0da8accd4ab83b0b`},"vertical/chemistry/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md":{title:`MOF 合成与后处理证据`,summary:`整理合成、活化、溶剂交换、缺陷调节和后修饰的证据,核对样品关联与表征要求。`,originalName:`MOF Synthesis Activation and Postsynthetic Evidence`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md`,sourceSha256:`b65377f7d995a638f721e8dea34a99807e97c948ec274bbc3f9cc1d35ccf1f5a`},"vertical/chemistry/engineer/organic_synthesis/reaction-identity-and-records.md":{title:`有机反应对象与记录对齐`,summary:`核对反应物、映射、计量、立体化学、条件、后处理和收率,用于路线或数据整理。`,originalName:`Organic Reaction Identity and Records`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/reaction-identity-and-records.md`,sourceSha256:`02221beebf4e39d9bd0e5c4090de61aba6596ceb48fb3a5f29b3e54466999d87`},"vertical/chemistry/engineer/organic_synthesis/retrosynthesis-and-route-design.md":{title:`有机逆合成与路线设计`,summary:`结合目标、断键、已有先例、选择性、供应和安全设计候选路线;候选仍需证据验证。`,originalName:`Organic Retrosynthesis and Route Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/retrosynthesis-and-route-design.md`,sourceSha256:`6ee1e514bf05cc052de12ee39497c783d1dd6ca9549335cbe62e7f2106ec8de4`},"vertical/chemistry/engineer/organic_synthesis/route-validation-and-experiment-design.md":{title:`有机路线验证与实验设计`,summary:`把候选路线转化为有对照、分析读数和停止条件的验证计划;不授权自动开展实体实验。`,originalName:`Organic Route Validation and Experiment Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/route-validation-and-experiment-design.md`,sourceSha256:`9a543fdca5cc4fa3ed0cc9cef2395af55ffaa35758b3c36895a2309d1d09dc80`},"vertical/chemistry/engineer/tools/aizynthfinder.md":{title:`AiZynthFinder 逆合成候选`,summary:`在明确模型、原料库、配置和预算后使用本地搜索生成候选路线;搜索结果不是可行性证明。`,originalName:`AiZynthFinder Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/aizynthfinder.md`,sourceSha256:`fd406198b2a436d954aefb95c1062f945e08cf98806ca7ceaba5d402c006f4dc`},"vertical/chemistry/engineer/tools/askcos.md":{title:`ASKCOS 路线与反应预测`,summary:`仅使用已获授权的部署,记录接口、模型、数据库、预算与结果来源;不假定已有服务权限。`,originalName:`ASKCOS Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/askcos.md`,sourceSha256:`31689603c8f5b80f2ed94a25ef05148edf311287e64bf336fc98fea5aeeaf486`},"vertical/chemistry/engineer/tools/chembl.md":{title:`ChEMBL 生物活性资料检索`,summary:`检索分子、靶点、实验和活性记录,核对版本、单位及来源;已有记录不证明新体系的活性。`,originalName:`ChEMBL Bioactivity Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/chembl.md`,sourceSha256:`9b33111794504afb064302785f66bd7fcbccac9e855d83df0eb84297f00b4863`},"vertical/chemistry/engineer/tools/chemcrow.md":{title:`ChemCrow 工具集成参考`,summary:`研究公开工具集成方式及其依赖、安全和证据要求;架构借鉴不等于复现论文结果。`,originalName:`ChemCrow Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemcrow.md`,sourceSha256:`877388249df2ed635a78ae2edb68b1d25fa2cd5305eec4e09c289fb0f1bd1ba3`},"vertical/chemistry/engineer/tools/chemos.md":{title:`ChemOS 实验室编排参考`,summary:`仅在设备服务、设施归属、安全联锁、数据约定和恢复机制已具备时评估编排能力。`,originalName:`ChemOS Orchestration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemos.md`,sourceSha256:`2dbb97df4b7107f08f00bbdd88fef587eda0b6d3d04e5850b619550e7a9c4cc3`},"vertical/chemistry/engineer/tools/coscientist.md":{title:`Coscientist 系统集成参考`,summary:`依据确切公开实现借鉴组件和架构,保留授权边界;不宣称得到可直接运行的自主实验室。`,originalName:`Coscientist Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/coscientist.md`,sourceSha256:`8a47d850deb1d7dfb2ddeecbea4cba38ceecec129a6e2b2d8ad403e9bbff5252`},"vertical/chemistry/engineer/tools/deepchem.md":{title:`DeepChem 分子机器学习`,summary:`先明确目标、对象、分组、泄漏控制、基线和适用范围,再选择数据、特征、模型与评估工具。`,originalName:`DeepChem Molecular Machine Learning`,source:`argus/domains/chemistry/skills/engineer/tools/deepchem.md`,sourceSha256:`27a9bd06792446cfeeafb63db293fcd8305d59ca3da164810e1267c13e6dcdeb`},"vertical/chemistry/engineer/tools/guacamol.md":{title:`GuacaMol 分子设计基准`,summary:`按确定任务、评分、参考数据、预算和有效性检查评估方法;结论仅限对应基准。`,originalName:`GuacaMol Molecular Design Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/guacamol.md`,sourceSha256:`f626a4b92ec2b081620f5da146f6baebe3b5cc44df824e77fc2becd0b3e87e7e`},"vertical/chemistry/engineer/tools/olympus.md":{title:`Olympus 反应优化基准`,summary:`使用规划器和模拟曲面作有对照的优化研究,明确参数空间、噪声和预算;模拟不等于实体实验。`,originalName:`Olympus Reaction Optimization`,source:`argus/domains/chemistry/skills/engineer/tools/olympus.md`,sourceSha256:`160f357db2ec4527b7368d2b41a2ab43d2ab6b76130e8a27b2a035e0531c4be2`},"vertical/chemistry/engineer/tools/openbabel.md":{title:`Open Babel 化学格式转换`,summary:`转换结构格式并核对解析、氢原子、坐标和互操作性,保留原始身份及转换来源。`,originalName:`Open Babel Structure Conversion`,source:`argus/domains/chemistry/skills/engineer/tools/openbabel.md`,sourceSha256:`6eca4f250101ad817f624a76ca6c22193c73fd67a8d13d76a39bcf07d848fd75`},"vertical/chemistry/engineer/tools/orca.md":{title:`ORCA 量子化学计算`,summary:`在用户提供并授权的安装上计算,记录版本、分子状态、方法、基组、数值设置和主要输出。`,originalName:`ORCA Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/orca.md`,sourceSha256:`683637ad2fb781da58295e67229859794085fb01fcaaa43c10e11e13c8a91085`},"vertical/chemistry/engineer/tools/ord.md":{title:`开放反应数据库读写规范`,summary:`按数据库结构验证反应角色、数量、条件、结果与来源;结构有效不等于实验可复现。`,originalName:`Open Reaction Database I/O`,source:`argus/domains/chemistry/skills/engineer/tools/ord.md`,sourceSha256:`eb81cbde5711e04c578cc89a5b233a3de109c5b68b7322adeefd0996df21b8da`},"vertical/chemistry/engineer/tools/psi4.md":{title:`Psi4 量子化学计算`,summary:`明确分子状态、方法、基组、选项、收敛和单位,保留计算输出来源。`,originalName:`Psi4 Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/psi4.md`,sourceSha256:`2d8bf9817a90f90fe2407d8e4d71e6ffbf431f64207f61b8c2fca8acda199a69`},"vertical/chemistry/engineer/tools/pubchem.md":{title:`PubChem 公共资料检索`,summary:`通过核实的标识和带日期的查询取得公共化合物、性质及安全记录,保留原始响应与来源边界。`,originalName:`PubChem PUG REST Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/pubchem.md`,sourceSha256:`9aa66ea316f8180a29884f78b1ae927adf55f727476fa0529c01e7300161c89e`},"vertical/chemistry/engineer/tools/pyscf.md":{title:`PySCF 电子结构计算`,summary:`先确定电荷、自旋、几何、方法、基组、边界和收敛要求,再组织分子或周期体系计算。`,originalName:`PySCF Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/pyscf.md`,sourceSha256:`9ccb368195807ed7390cf2397506d004f849ccd1c0e1d51532b31e42e579dbc2`},"vertical/chemistry/engineer/tools/rdkit.md":{title:`RDKit 分子数据处理`,summary:`用于解析、规范化、立体化学、子结构、描述符、指纹与构象等处理;不直接证明化学身份或可行性。`,originalName:`RDKit Molecular Integrity`,source:`argus/domains/chemistry/skills/engineer/tools/rdkit.md`,sourceSha256:`b9330a5a8c90fb31bf3b551555d4f439cca90f9ecd45506734ce5051628ee074`},"vertical/chemistry/engineer/tools/tdc.md":{title:`TDC 药物研究数据基准`,summary:`使用明确任务、版本、许可、划分和评估器开展比较,核对污染与证据边界。`,originalName:`Therapeutics Data Commons Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/tdc.md`,sourceSha256:`a1aaed9bff60b1df25ccc8a9846ebcd30784c1f814cb20633e8a5ef57e11decb`},"vertical/chemistry/engineer/workflows/chemistry-playground.md":{title:`受限化学假设试探`,summary:`仅对明确提出的候选问题开展有边界的计算优先试探,保留问题、结果和负证据,并经过评审。`,originalName:`Chemistry Playground Bounded Hypothesis Probe`,source:`argus/domains/chemistry/skills/engineer/workflows/chemistry-playground.md`,sourceSha256:`72326a42543600e3fffedf0562c171466cc25b433cb8c05913e9fcfac3eb2d12`},"vertical/chemistry/manager/chemistry-manager.md":{title:`化学任务协调与分流`,summary:`为科学问题选择专门技能组合,保留原研究阶段、证据强度与授权边界。`,originalName:`Chemistry Manager Context`,source:`argus/domains/chemistry/skills/manager/chemistry-manager.md`,sourceSha256:`ecc7e16be351188d3c6ae75aa0e55c4b3978f1916e67c45754766cb63085f336`},"vertical/chemistry/planner/chemistry-planning.md":{title:`化学研究规划`,summary:`选择最贴合任务的流程,保持证据和安全要求;未完成时才安排具有科学判别力的后续工作。`,originalName:`Chemistry Research Planning`,source:`argus/domains/chemistry/skills/planner/chemistry-planning.md`,sourceSha256:`c9258fa062f3853d7a04950d0e0045b10be65c41c11248d6fe5c981e0ed02e02`},"vertical/chemistry/reviewer/battery-review.md":{title:`电池与电化学证据评审`,summary:`独立核对电芯身份、协议可比性、单位、循环退化证据和防泄漏模型评估。`,originalName:`Battery and Electrochemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/battery-review.md`,sourceSha256:`e0aa8763587e38281b5c2c5b6f7c92b3e07264b1cee076539751de8971d87725`},"vertical/chemistry/reviewer/biochemistry-review.md":{title:`生化与化学生物学评审`,summary:`检查构建体、结构、实验、动力学、模拟和功能声明,保留各自对照与结论边界。`,originalName:`Biochemistry and Chemical Biology Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/biochemistry-review.md`,sourceSha256:`68f2cc57f10d6c9bf30c41c249ebe7fc192b8ac4b763cb6ff40d9a41377135d0`},"vertical/chemistry/reviewer/characterization-review.md":{title:`化学表征证据评审`,summary:`独立核对原始仪器数据、校准、对照、归属和多模态证据,避免用通用解释越过测试边界。`,originalName:`Chemical Characterization Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/characterization-review.md`,sourceSha256:`3ba8858ac408729e78fa27a9338cd6eb435bd64d38da803d837aaec111ef8d67`},"vertical/chemistry/reviewer/chemistry-playground-review.md":{title:`化学试探结果评审`,summary:`检查受限问题与结果、证据和状态历史,防止未经确认的探索被当作正式科学结论。`,originalName:`Chemistry Playground Promotion Gate`,source:`argus/domains/chemistry/skills/reviewer/chemistry-playground-review.md`,sourceSha256:`309f1ff685c93c46c47239d9db1a3b85c41c6c384e986532e774ed3795e8d3c0`},"vertical/chemistry/reviewer/chemistry-review.md":{title:`化学研究综合评审`,summary:`按问题转交专门评审方法,核对对象、原始证据、对照、可复现性、不确定性和安全要求。`,originalName:`Chemistry Research Review`,source:`argus/domains/chemistry/skills/reviewer/chemistry-review.md`,sourceSha256:`bc2587f915788c94f8de55a0f2947a18e7bd368cccf1b400d1479e1681c64cf7`},"vertical/chemistry/reviewer/computational-review.md":{title:`计算化学证据评审`,summary:`审查输入身份、数值收敛、方法有效性,以及计算结果和测量结果之间的界线。`,originalName:`Computational Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/computational-review.md`,sourceSha256:`cab134d61ce5d45bf0240d2219eca03002e7b6315c4abf3738c2740229353e68`},"vertical/chemistry/reviewer/crystallography-review.md":{title:`晶体学证据评审`,summary:`独立检查衍射、对称性、精修、CIF、物相声明和结构不确定性,不替代其他领域评审。`,originalName:`Crystallography Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/crystallography-review.md`,sourceSha256:`034223d76528f09aede5febdb7fff1c848819f82564a8be7acf23ebc1a25d369`},"vertical/chemistry/reviewer/materials-science-review.md":{title:`材料科学证据评审`,summary:`核对非 MOF 材料的身份、工艺、性质和发现声明,不把结论跨用到晶体精修或电池循环。`,originalName:`Materials Science Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/materials-science-review.md`,sourceSha256:`ac639340d34bc5dae734e9f9841e91762cb31ec42c73c5a108dc69b25c2b76ba`},"vertical/chemistry/reviewer/mof-reticular-chemistry-review.md":{title:`MOF 与网状化学证据评审`,summary:`核对构筑单元、拓扑、合成活化、孔隙吸附、后修饰、数据与生成结构的证据。`,originalName:`MOF and Reticular Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/mof-reticular-chemistry-review.md`,sourceSha256:`d095ca81ab168c658696b20de0e149647cdbfcffe545cff73e3ed9ccaeb37dcf`},"vertical/chemistry/reviewer/organic-synthesis-review.md":{title:`有机合成与逆合成评审`,summary:`独立核对反应记录、路线先例、选择性、分析证据、安全和实际可行性声明。`,originalName:`Organic Synthesis and Retrosynthesis Review`,source:`argus/domains/chemistry/skills/reviewer/organic-synthesis-review.md`,sourceSha256:`0ce7fdeee239a78b9d74f7e64dbd55b38d99b9e88bf141399ec999d30f519ad0`},"vertical/chemistry/scientist/chemistry-adaptation.md":{title:`根据证据改进化学方法`,summary:`只有证据显示现有方法在对象、能力、验证或安全等机制层面存在缺口时,才调整可复用流程。`,originalName:`Chemistry Skill Adaptation`,source:`argus/domains/chemistry/skills/scientist/chemistry-adaptation.md`,sourceSha256:`d231961e4c85bee737df313c376e046dba50ed5a375460a924176db507f8ee9a`},"vertical/chemistry/scientist/chemistry-distillation.md":{title:`沉淀可复用化学流程`,summary:`在技能匹配缺失后归纳带范围、证据、验证和停止条件的方法,而不是保存目标答案或工具教程。`,originalName:`Chemistry Skill Distillation`,source:`argus/domains/chemistry/skills/scientist/chemistry-distillation.md`,sourceSha256:`1f7c9b2cddae0e19332d6e38edbac2671026d04e5ca0f3203f3d777e5e51d010`},"vertical/kernel_engineering/engineer/kernel-benchmark-measurement-integrity.md":{title:`GPU 算子工程:先算屋顶线,隔离测量`,summary:`先用屋顶线定瓶颈再改机制而非参数;一次干净的隔离运行足以筛选想法,要主张或保留的提升必须在官方条件下测量;审阅只看正确性与基准证据。`,originalName:`Kernel Engineering: Roofline First, Measure in Isolation`,source:`argus/verticals/kernel_engineering/skills/engineer/kernel-benchmark-measurement-integrity.md`,sourceSha256:`b6bbe44b147dfea2dd68810db53571a9fae5db238c2bcde24d51c79756bf1785`},"vertical/learning/learning-curation.md":{title:`学习任务的整理与审阅`,summary:`把操作者材料变成有证据锚点的项目 Skill/Wiki 修改或诚实的空操作,说明 CHANGE_PLAN.json 的约定以及审阅者如何判断修改是否忠实、无冗余、不倒退、层级正确。`,originalName:`Learning Curation`,source:`argus/verticals/learning/skills/learning-curation.md`,sourceSha256:`71490b8d95eecb97a88a18e8bc4dd0a1aa163d7c0f82a02114440aae1f5f6999`},"vertical/math/engineer/math-research-execution.md":{title:`数学研究执行`,summary:`忠实保留命题与范围,诚实区分结果类别;需要 Lean 证据时实际编译,不虚构证明。`,originalName:`Math Research Execution`,source:`argus/verticals/math/skills/engineer/math-research-execution.md`,sourceSha256:`ddcf8321ce873130c1de3e71b78d816115182813e8a6dfdd4bc89d0fe9629736`},"vertical/math/manager/math-research-manager.md":{title:`数学研究任务协调`,summary:`在通用协调流程中保持研究目标、范围、求解和评审职责,不另造一套权限体系。`,originalName:`Math Research Manager Context`,source:`argus/verticals/math/skills/manager/math-research-manager.md`,sourceSha256:`e228b24cd82e6dee678458b5e32c4e1fc6092151b06c7eee198b158bdd1a1b95`},"vertical/math/planner/math-research-planning.md":{title:`数学研究规划`,summary:`围绕范围界定、求解和评审安排动态任务,保持原有角色与生命周期规则。`,originalName:`Math Research Planning`,source:`argus/verticals/math/skills/planner/math-research-planning.md`,sourceSha256:`e3320bf8a0b986eae0251ce1004962659ab2a9505a2cc73da63c33b94d2799f4`},"vertical/math/reviewer/math-research-review.md":{title:`数学研究独立评审`,summary:`检查正确性、新意、意义、命题忠实性和真实形式化证据,不以叙述代替证明。`,originalName:`Math Research Review`,source:`argus/verticals/math/skills/reviewer/math-research-review.md`,sourceSha256:`21b7e0f172bbb695ae9950c0e9dd1cdac60ae6aa21df0962a88a1b06ba505251`},"vertical/math/scientist/math-research-adaptation.md":{title:`改进数学研究方法`,summary:`在评审确认方法失败或技能缺口后,按已有适应阶段调整可复用方法。`,originalName:`Math Research Scientist Adaptation`,source:`argus/verticals/math/skills/scientist/math-research-adaptation.md`,sourceSha256:`fd8961cb0155e3fc05428cf0b5dbd6be86ed048636dc657b3b23abbee6495933`},"vertical/math/scientist/math-research-distillation.md":{title:`沉淀数学研究方法`,summary:`在首次匹配缺失后整理可复用研究方法,不假定已经失败,也不代替当前任务的执行。`,originalName:`Math Research Skill Distillation`,source:`argus/verticals/math/skills/scientist/math-research-distillation.md`,sourceSha256:`83a7367798b1ac327861deaa94accf1d77da0e140ebc8da8137442a30a83b09a`},"vertical/research/engineer/ablation-planner.md":{title:`选择有判别力的消融实验`,summary:`只选择能区分结果解释、说明所选方法作用的必要消融,而不是机械穷举组合。`,originalName:`Choosing ablations that distinguish explanations`,source:`argus/verticals/research/skills/engineer/ablation-planner.md`,sourceSha256:`f5c9bff3d6b5bc9dc4b50316e172856fcc01d708685c08a1ff29650871369858`},"vertical/research/engineer/method-card.md":{title:`方法卡、可执行规范与审阅锚点`,summary:`在 METHOD.md 中写清方法、组件、协议和证伪条件;以钉版参考实现为底把方法写成 diff;先写 tests/spec 再跑承载论断的实验;用代码锚点让不在场的审阅者找到机制;规划者据此写实现简报。`,originalName:`Method card (METHOD.md), executable spec and review anchors`,source:`argus/verticals/research/skills/engineer/method-card.md`,sourceSha256:`2e756a2fd09bca2abe4175fea4042af6905a6166b629c940909b10090cfe6855`},"vertical/research/engineer/novelty-check.md":{title:`检验研究想法的新意`,summary:`通过当前来源对照最接近的已有工作,判断一条候选想法的差异,而非先宣称创新。`,originalName:`Testing the idea's novelty`,source:`argus/verticals/research/skills/engineer/novelty-check.md`,sourceSha256:`e20a0f4290c72b07c9b09fa77633ecc915f0f7a8b90d8efd4c627fb9d12f8c16`},"vertical/research/engineer/paper-chart-styling.md":{title:`论文数据图样式`,summary:`统一数据图的配色、尺寸、标记和字体嵌入,遵守所选期刊会议版式;不改变数据本身。`,originalName:`Styling data figures for publication`,source:`argus/verticals/research/skills/engineer/paper-chart-styling.md`,sourceSha256:`c40b9f431de9cd01f16e245d819563566fc5db02c2217505599921adcca65b75`},"vertical/research/engineer/paper-framework-figure-studio.md":{title:`论文图的路线选择与概念图编排`,summary:`按表达内容选渲染路线:数据图走 SciencePlots/Matplotlib,概念与框架图默认以图像蓝图重建为可编辑 PPT,无图像接口时直接原生绘制;生成图像只用于不承载论断的部分。`,originalName:`Composing a conceptual paper figure`,source:`argus/verticals/research/skills/engineer/paper-framework-figure-studio.md`,sourceSha256:`e01ffd101b8fcd701b86918d93994079dfc87d9df79dbcd348bdfe3508cfcd9b`},"vertical/research/engineer/references/ideation/ideation-patterns/overview.md":{title:`研究构思模式总览`,summary:`汇总各研究构思模式的定义、操作特征与适用时机,帮助为路线挑选机制视角;模式在语料中常见不代表适合当前问题,也不替代创新性与正确性验证。`,originalName:`engineer/references/ideation/ideation-patterns/overview`,source:`argus/verticals/research/skills/engineer/references/ideation/ideation-patterns/overview.md`,sourceSha256:`8b2b43b5ce63c70a1b54c0ff5fb3f1954bc8ef6c05bda95a71a011d2f5f4eb34`},"vertical/research/engineer/references/paper-writing-craft.md":{title:`论文写作方法参考`,summary:`提供论文论证和表达的写作参考,需结合真实证据与所选期刊会议要求使用。`,originalName:`engineer/references/paper-writing-craft`,source:`argus/verticals/research/skills/engineer/references/paper-writing-craft.md`,sourceSha256:`bd645d2f2f48987c988c54b6b22843b22ee3b5a9dc0ce950bff4acdc0fcf3eeb`},"vertical/research/engineer/research-grind.md":{title:`沿诊断阶梯打磨研究结果`,summary:`把首次实现当作草稿,在固定声明下沿诊断阶梯逐级排查;结果异常先怀疑设置;从原始逐种子行算数;依据证据而非尝试次数判断何时足够。`,originalName:`Working a research result into shape`,source:`argus/verticals/research/skills/engineer/research-grind.md`,sourceSha256:`e955fe1ac7aa975a9172394bdca4e8b2ed6a504355ab00573a26badf442f038a`},"vertical/research/engineer/rl-training-collapse-diagnosis.md":{title:`强化学习训练健康诊断`,summary:`检查奖励、优势、梯度、KL、截断和吞吐异常,先诊断配置与过程,再归因方法;不同训练目标不能混用规则。`,originalName:`RL Training Health Diagnosis`,source:`argus/verticals/research/skills/engineer/rl-training-collapse-diagnosis.md`,sourceSha256:`d48fd69adaac73ad45c41cd9565798a94a476de52c9354097abe2d8604db8782`},"vertical/research/engineer/sources-and-citations.md":{title:`对照来源核对论断与引用`,summary:`把稿件中的论断对回支撑它的证据,把引用对回被引的原文,并用 Semantic Scholar 核对版本;补充全局的一手来源技能,不另起一轮整篇审阅。`,originalName:`Checking claims and citations against their sources`,source:`argus/verticals/research/skills/engineer/sources-and-citations.md`,sourceSha256:`450410c4b428e31104819c07a98e19b615ced499e0d2d4df473305ca789d55ed`},"vertical/research/engineer/training-infrastructure.md":{title:`训练基础设施的选择、搭建与调参`,summary:`训练或大规模推理需要框架时,用实时来源调查候选、在隔离环境中试装并剖析一步真实更新、以官方配方为锚每次只改一个因素,并把结论写成带日期的项目决策记录;不按记忆推荐技术栈。`,originalName:`Training infrastructure: choosing, standing up and tuning it`,source:`argus/verticals/research/skills/engineer/training-infrastructure.md`,sourceSha256:`4c495369ffba7ff2b9954a2fafd72b874e63abc6065a5afab7c61ce10afb9087`},"vertical/research/engineer/venue-format-preflight.md":{title:`投稿前的编译与泄露检查`,summary:`用目标会场的官方作者模板编译完整稿件并核对结构,同时检查稿件没有泄露内部路径、角色名与运行时用语。`,originalName:`Preparing the draft for the venue`,source:`argus/verticals/research/skills/engineer/venue-format-preflight.md`,sourceSha256:`e146afba818a8436d0807aff610084d6a321277778e7ce299bd96f9f57795eb0`},"vertical/research/engineer/venue-format-research.md":{title:`选择投稿目标并核对要求`,summary:`根据研究内容选择合适期刊会议,获取当前官方作者要求,而非沿用过时模板。`,originalName:`Choosing a venue and reading its requirements`,source:`argus/verticals/research/skills/engineer/venue-format-research.md`,sourceSha256:`aad2d0ec25649231ec233f4abb5b216af313a7a1dfa699cc6f0c8b23be7cbcf2`},"vertical/research/engineer/venue-paper-drafting.md":{title:`面向投稿目标撰写论文`,summary:`先定论证形状,按所选作者模板和确认的证据写完整论文,读一次强范文校准视觉与结构标准;不把未验证探索写成既定结论。`,originalName:`Writing for the selected venue`,source:`argus/verticals/research/skills/engineer/venue-paper-drafting.md`,sourceSha256:`d7bb7d7e59f5ce6e20433fa843e3d7002575b1892b131c0d0f7f247e986281f1`},"vertical/research/research-experiment-playbook.md":{title:`通过实验发展研究想法`,summary:`忠实实现已选想法,通过适应性实验形成足以支撑论文的证据,而不是只完成首次运行。`,originalName:`Developing an idea through experiments`,source:`argus/verticals/research/skills/research-experiment-playbook.md`,sourceSha256:`df8f6a724b93f063a6e0dd2e36af1838fca72eea689f062b096d3ad0c4ad2c85`},"vertical/research/research-idea-playbook.md":{title:`寻找并选择研究想法`,summary:`从来源中发现候选可能性,经独立审查后作最终选择,不把构思直接当作实验结果。`,originalName:`Finding a research idea`,source:`argus/verticals/research/skills/research-idea-playbook.md`,sourceSha256:`91104461d9115ee280db1f5e89d3c35bc8301422bfd7d9a70c66fa559c09eed6`},"vertical/research/research-paper-playbook.md":{title:`撰写完整研究论文`,summary:`从已确认的正向证据组织论文、编译并准备投稿材料,保持证据与论述一致。`,originalName:`Writing the research paper`,source:`argus/verticals/research/skills/research-paper-playbook.md`,sourceSha256:`2efcabc2904fe55831b0f5d9c61846c544aab2a211687f0fbf51ad417e66afec`},"vertical/research/research-review-playbook.md":{title:`对论文形成独立判断`,summary:`综合科学性、图示、语言和整体论证,判断工作是否成立并提出建设性意见。`,originalName:`Reaching a judgment on the paper`,source:`argus/verticals/research/skills/research-review-playbook.md`,sourceSha256:`368d0bc3b8dba80c1e8d84257a10f95bbe2124a35d03a30e553e1d6b56ae829a`},"vertical/research/reviewer/academic-paper-peer-review-benchmark.md":{title:`按目标期刊会议评审论文`,summary:`以独立评审视角判断当前稿件,提供科学指导并更新评审记录。`,originalName:`Reading the paper as a venue reviewer`,source:`argus/verticals/research/skills/reviewer/academic-paper-peer-review-benchmark.md`,sourceSha256:`6446f17af2a751bd9570b4351e4b28d84d09cc06ed2c59174111f17f39e0cbc9`},"vertical/research/reviewer/claim-to-code-trace.md":{title:`追溯声明到实际代码`,summary:`沿配置和执行路径核对公式、比较条件与观测,判断研究声明是否对应实际产生证据的代码。`,originalName:`Claim-to-Code Trace`,source:`argus/verticals/research/skills/reviewer/claim-to-code-trace.md`,sourceSha256:`fef3ef16ce27a9c1e9ec5f095c73bb734da06aedba74fa994122e28d32c293ee`},"vertical/research/reviewer/experiment-results-review.md":{title:`判断实验真正说明了什么`,summary:`亲自读代码、配置、评测器和原始行,判断证据对固定声明的支持与缺口;低于基线的结果在阶梯未走完前是修复请求;训练类实验另核对基础设施决策记录。`,originalName:`What the experiments establish`,source:`argus/verticals/research/skills/reviewer/experiment-results-review.md`,sourceSha256:`bc158d8b51107b697d290eb6ed461f2a596aa601bc78cce7e88089743411533e`},"vertical/research/reviewer/strongest-argument-against.md":{title:`寻找最有力的科学反对意见`,summary:`在最终评审中识别论文最关键的科学弱点,不通过直接改稿掩盖它。`,originalName:`The strongest argument against the paper`,source:`argus/verticals/research/skills/reviewer/strongest-argument-against.md`,sourceSha256:`6cc3e7990dacb420a04ff945cb1f221852bd249b981a60def70dfcace2ac3418`},"vertical/research/reviewer/venue-academic-language-review.md":{title:`审查论文论证与学术表达`,summary:`对照目标期刊会议的当前惯例阅读论证与语言,指出问题,不擅自编辑论文。`,originalName:`Reading the paper's argument and language`,source:`argus/verticals/research/skills/reviewer/venue-academic-language-review.md`,sourceSha256:`a2fe9faf57ff0a09181f42de2ac2b5080158e08c430078fb48722fd6b9893f66`},"vertical/software/engineer/software-change-implementation.md":{title:`有边界的软件实现与拆解`,summary:`结合仓库结构选择合适工具,以与任务规模相称的检查完成软件修改;分阶段工作按架构边界拆解,每个任务写明兼容性风险与独立预言机。`,originalName:`Software Change Implementation`,source:`argus/verticals/software/skills/engineer/software-change-implementation.md`,sourceSha256:`34dad5e10c880fb48964573768b72d8377829ca8163ddd21987c2c05538d70a9`},"vertical/software/reviewer/software-change-review.md":{title:`软件修改独立评审`,summary:`检查真实调用路径、兼容性与验证证据,不依赖参考答案或仅凭完成声明判断。`,originalName:`Software Change Review`,source:`argus/verticals/software/skills/reviewer/software-change-review.md`,sourceSha256:`5d1a66ff65accae04ec02005724735c9767308ac63c005b8be6e269eb9acb25f`}};function bn(e){if(!e.is_default||![`bundled`,`shared`].includes(e.source)||!(e.scope===`global`?[`global:${e.source}`]:e.scope===`vertical`?[`vertical:${e.vertical}:${e.source}`,...e.source===`bundled`?[`domain:${e.vertical}:bundled`]:[]]:[]).includes(e.library))return null;let t=e.scope===`global`?`global/${e.path}`:`vertical/${e.vertical}/${e.path}`,n=Object.hasOwn(yn,t)?yn[t]:null;return n?.originalName===e.name?n:null}function xn(e,t){let n=t===`zh-CN`?bn(e):null;return{title:n?.title??e.name,summary:n?.summary??e.description,guide:n}}function Sn(e,t){let n=xn(e,t);return`${e.name} ${e.description} ${e.path} ${e.vertical} ${n.title} ${n.summary}`.toLocaleLowerCase()}var Cn={research:`科研`,software:`软件开发`,math:`数学研究`,chemistry:`化学`,kernel_engineering:`GPU 算子工程`,argus_maintenance:`Argus 维护`,learning:`资料学习`};function wn(e,t){return t===`zh-CN`&&Object.hasOwn(Cn,e)?Cn[e]:e}var Tn={fact:[`记录可核对的环境、对象或事实,供后续工作查证;记录本身不保证事实仍然有效。`,`Records checkable facts for later verification; a saved record is not a guarantee that it is still current.`],lesson:[`保留工作中得到的经验和问题,帮助类似任务少走弯路;不能代替当前证据或评审。`,`Keeps lessons from work to inform similar tasks; it does not replace current evidence or review.`],survey:[`整理问答或调研材料与来源,为后续查阅提供线索;结论仍需结合原文核对。`,`Organizes answers or research and their sources for later reference; check conclusions against the original evidence.`],principles:[`归纳可反复参考的建议,帮助选择方法;应检查所引用的经验与适用条件。`,`Distills recurring guidance for choosing methods; check the cited lessons and applicability.`],note:[`保存关于你的背景、偏好或计划,帮助后续任务理解上下文;不是工具使用授权。`,`Keeps personal context, preferences or plans for later work; it is not authorization to use tools.`],profile:[`汇总 Argus 对你的背景与偏好的了解,方便核对是否准确;不代表公开资料或任务完成情况。`,`Summarizes personal context and preferences for inspection; it is neither a public record nor a task-completion report.`],page:[`一般参考资料。具体用途取决于原文和来源,不能仅凭“已保存”判断内容可靠或适用。`,`General reference material. Its use depends on the original content and sources, not merely on being saved.`]};function En(e,t){return(Object.hasOwn(Tn,e)?Tn[e]:Tn.page)[t===`zh-CN`?0:1]}var Dn={private:[`你的个人背景资料,与共享知识分开保存。这里不改变既有读取权限或模型的数据处理方式。`,`Personal context is stored separately from shared knowledge. This view does not change existing access or model data handling.`],global:[`跨项目参考的通用资料;不要把个人信息当作公共知识放在这里。`,`General reference across projects; personal information does not belong in shared knowledge.`],vertical:[`同一领域可复用的专门资料,使用前仍要核对当前任务的条件。`,`Domain-specific reference; verify that it applies to the current task.`],project:[`围绕当前项目保存的资料与背景;分类不是操作系统沙箱或文件权限边界。`,`Material associated with this project; the category is not an OS sandbox or file-permission boundary.`]};function On(e,t){return Object.hasOwn(Dn,e)?Dn[e][t===`zh-CN`?0:1]:t===`zh-CN`?`范围尚未确认,请以来源说明为准。`:`Scope not confirmed; consult the source.`}var kn={active:`label.status.inProgress`,claimed:`label.status.inProgress`,in_progress:`label.status.inProgress`,running:`label.status.inProgress`,working:`label.status.inProgress`,pending:`label.status.waiting`,queued:`label.status.waiting`,waiting:`label.status.waiting`,idle:`label.status.waiting`,accepted:`label.status.completed`,complete:`label.status.completed`,completed:`label.status.completed`,done:`label.status.completed`,success:`label.status.completed`,blocked:`label.status.blocked`,failed:`label.status.failed`,error:`label.status.failed`,rejected:`label.status.needsChanges`,continue:`label.status.needsChanges`,skipped:`label.status.skipped`,paused:`label.status.paused`,paused_cost:`label.outcome.costUnreconciled`,stopped:`label.status.paused`,cancelled:`label.status.cancelled`,aborted:`label.status.cancelled`,not_started:`label.status.waiting`,available:`label.status.available`,absent:`label.status.unavailable`,inaccessible:`label.status.inaccessible`,degraded:`label.status.limited`,healthy:`label.status.healthy`},An={system:`label.role.argus`,operator:`label.role.you`},jn={completed:`label.outcome.workCompleted`,done:`label.outcome.workCompleted`,success:`label.outcome.workCompleted`,paused:`label.outcome.workPaused`,blocked:`label.outcome.workBlocked`,failed:`label.outcome.workFailed`,error:`label.outcome.workFailed`,aborted:`label.outcome.workEnded`,ended:`label.outcome.workEnded`,incomplete:`label.outcome.workIncomplete`,research_incomplete:`label.outcome.workIncomplete`,paused_no_breakthrough:`label.outcome.workIncomplete`,exhausted_current_methods:`label.outcome.workIncomplete`,stalled:`label.outcome.workStalled`,no_progress:`label.outcome.workStalled`,max_rounds:`label.outcome.workStalled`,infra_blocked:`label.outcome.workBlocked`,supervisor_error:`label.outcome.workFailed`},Mn={accepted:`label.outcome.reviewPassed`,done:`label.outcome.reviewPassed`,passed:`label.outcome.reviewPassed`,continue:`label.outcome.reviewNeedsChanges`,rejected:`label.outcome.reviewNeedsChanges`,blocked:`label.outcome.reviewBlocked`,stale:`label.outcome.reviewOutdated`,pending:`label.outcome.reviewPending`,pending_review:`label.outcome.reviewPending`},Nn={certified:`label.outcome.stageApproved`,not_certified:`label.outcome.stageNotApproved`,revoked:`label.outcome.stageRevoked`,intentionally_skipped:`label.outcome.stageNotNeeded`,deferred:`label.outcome.stagePending`},Pn={budget_exhausted:`label.outcome.budgetPaused`,budget_pause:`label.outcome.budgetPaused`,cost_unreconciled:`label.outcome.costUnreconciled`,operator_input_required:`label.outcome.waitingForYou`,operator_abort:`label.outcome.stoppedByYou`,operator_pause:`label.outcome.pausedByYou`,daemon_shutdown:`label.outcome.sessionPaused`,backend_unavailable:`label.outcome.serviceUnavailable`,provider_cooldown:`label.outcome.serviceCoolingDown`,provider_fence:`label.outcome.serviceUnavailable`,transient_error:`label.outcome.temporaryIssue`,permanent_error:`label.outcome.serviceError`,planner_empty_plan:`label.outcome.needsPlan`},Fn={cuda:`label.resource.nvidiaGpu`,rocm:`label.resource.amdGpu`,mps:`label.resource.appleGpu`,cpu:`label.resource.cpu`};function In(e,t){return t(kn[String(e??``).toLowerCase()]??`label.status.updated`)}function Ln(e,t){let n=String(e??``).toLowerCase();return gt(n)?Ve(n,t):t(An[n]??`label.role.argus`)}function Rn(e,t){return t(`label.priority`,{priority:e})}function zn(e,t){if(!e?.execution_status)return[];let n=[t(jn[e.execution_status.toLowerCase()]??`label.outcome.workUpdated`)],r=Mn[String(e.review_status??``).toLowerCase()],i=Nn[String(e.stage_certification??``).toLowerCase()],a=Pn[String(e.interruption_kind??``).toLowerCase()];return r&&n.push(t(r)),i&&n.push(t(i)),a&&n.push(t(a)),e.resumable&&n.push(t(`label.outcome.canResume`)),n}function Bn(e,t){return t(Fn[e.toLowerCase()]??`label.resource.accelerator`)}function Vn(e,t){return t(e===`strict`?`label.resource.enforced`:`label.resource.advisory`)}function Hn(e,t){return t(e===`yield`?`label.resource.released`:`label.resource.kept`)}var J=i(),Un=e=>[`knowledge-feed`,e];function Wn(e=!0,t=50){return A({queryKey:Un(t),queryFn:({signal:e})=>R.knowledgeFeed(t,e),enabled:e,staleTime:5e3,refetchInterval:1e4})}var Gn={en:{learned:`Learned`,recalled:`Recalled`,promoted:`Promoted`,corrected:`Corrected`},zh:{learned:`学到了`,recalled:`读取了`,promoted:`提升了`,corrected:`纠正了`}},Kn={en:{private:`About you`,global:`Global`,vertical:`Vertical`,project:`Project`},zh:{private:`关于你`,global:`全局`,vertical:`垂直领域`,project:`项目`}};function qn(e,t=60){let n=[...e].sort((e,t)=>t.ts-e.ts),r=[];for(let e of n){let n=r[r.length-1];if(e.kind===`recalled`&&n?.kind===`recalls`&&n.role===e.role&&n.ts-e.ts<=t){n.events.push(e);continue}r.push(e.kind===`recalled`?{kind:`recalls`,ts:e.ts,role:e.role,events:[e]}:{kind:`single`,event:e})}return r}function Jn(e,t,n=null){return e.path?e.scope===`project`?n&&e.source_project&&e.source_project!==n?null:t.find(t=>t.scope===`project`&&t.path===e.path)??null:t.find(t=>t.scope===e.scope&&t.vertical===e.vertical&&t.path===e.path)??null:null}var Yn={learned:`bg-blue/10 text-blue`,recalled:`bg-line/60 text-ink-dim`,promoted:`bg-ok/10 text-ok`,corrected:`bg-warn/10 text-warn`};function Xn({events:e,items:t,sid:n,projectNames:r={},query:i=``,onSelect:a,selected:o}){let{locale:s,t:c}=z(),l=s===`zh-CN`,u=Gn[l?`zh`:`en`],d=Kn[l?`zh`:`en`],f=e=>wt(e,l?`zh-CN`:`en`),p=i.trim().toLocaleLowerCase(),m=qn(p?e.filter(e=>`${e.title} ${e.path} ${e.vertical} ${e.source_project} ${e.role} ${e.note}`.toLocaleLowerCase().includes(p)):e),h=e=>[d[e.scope]??e.scope,wn(e.vertical,s),e.source_project?`${l?`来自 `:`from `}${r[e.source_project]||e.source_project}`:``,l&&e.role?Ln(e.role,c):e.role].filter(Boolean).join(` · `),g=e=>!!(e&&o&&e.scope===o.scope&&e.vertical===o.vertical&&e.path===o.path),_=(e,r)=>{let i=Jn(e,t,n),o=e.title||e.path;return i?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(i),"aria-pressed":g(i),"data-feed-title":!0,className:`${r} text-left hover:text-blue ${g(i)?`text-blue`:`text-ink`}`,children:o}):(0,J.jsx)(`span`,{"data-feed-title":!0,className:`${r} text-ink`,title:e.path,children:o})};return m.length===0?(0,J.jsx)(`p`,{className:`p-3 text-sm leading-relaxed text-ink-faint`,children:p?l?`没有匹配的学习动态。`:`No feed lines match the search.`:l?`还没有学习动态。Argus 在任务后反思写下教训、把已有知识读进提示、或把评审通过的页面提升到共享层时,都会在这里留下一行。`:`Nothing learned yet. A line appears here whenever Argus writes a lesson after a mission, reads existing knowledge into a prompt, or promotes a reviewed page to a shared level.`}):(0,J.jsx)(`ol`,{className:`space-y-1`,"aria-label":l?`学习动态`:`Learning feed`,children:m.map(e=>e.kind===`single`?(0,J.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":e.event.kind,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`time`,{dateTime:new Date(e.event.ts*1e3).toISOString(),children:f(e.event.ts)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${Yn[e.event.kind]??Yn.learned}`,children:u[e.event.kind]??e.event.kind})]}),_(e.event,`mt-1 block w-full break-words text-sm font-medium`),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.event)}),e.event.note&&(0,J.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-ink-dim`,children:e.event.note})]},`${e.event.ts}/${e.event.kind}/${e.event.path}`):(0,J.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":`recalls`,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`time`,{dateTime:new Date(e.ts*1e3).toISOString(),children:f(e.ts)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${Yn.recalled}`,children:u.recalled})]}),(0,J.jsx)(`span`,{className:`mt-1 block text-sm font-medium text-ink`,"data-feed-title":!0,children:e.events.length===1?e.events[0].title||e.events[0].path:l?`读取了 ${e.events.length} 条已有知识`:`Recalled ${e.events.length} existing pages`}),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.events[0])}),e.events.length>1&&(0,J.jsx)(`span`,{className:`mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-xs`,children:e.events.map(e=>(0,J.jsx)(`span`,{children:_(e,`inline text-xs text-ink-dim`)},`${e.ts}/${e.scope}/${e.vertical}/${e.path}`))})]},`${e.ts}/recalls/${e.role}`))})}function Zn({guide:e,item:t}){let{t:n}=z();return(0,J.jsxs)(`section`,{"data-skill-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-4 text-sm leading-relaxed text-ink`,children:[(0,J.jsx)(`h4`,{className:`font-semibold`,children:`这项方法有什么用`}),(0,J.jsx)(`p`,{className:`mt-2`,children:e.summary}),(0,J.jsxs)(`dl`,{className:`mt-3 space-y-2 text-xs text-ink-dim`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`什么时候参考`}),(0,J.jsx)(`dd`,{children:`当前任务与上面的用途相符时,由既有任务与技能选择流程按需读取;浏览本页不会运行工具或发起模型任务。`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`目录标注的角色`}),(0,J.jsxs)(`dd`,{children:[Ln(t.role,n),`;这只是说明,不调整角色职责或权限。`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`需要注意`}),(0,J.jsx)(`dd`,{children:`这是随包版本的中文导读,不是完整执行指令,也不是已经完成或验证的证据。具体步骤、前置条件、软件许可和授权限制请对照原文。`})]})]})]})}function Qn({item:e}){let{locale:t}=z(),n=t===`zh-CN`;return(0,J.jsxs)(`section`,{"data-knowledge-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-3 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`h4`,{className:`font-semibold text-ink`,children:n?`这类知识怎样帮助工作`:`How this kind of knowledge helps`}),(0,J.jsx)(`p`,{className:`mt-2`,children:En(e.kind,t)}),(0,J.jsx)(`p`,{className:`mt-2`,children:On(e.scope,t)}),(0,J.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n?`以上解释条目类型与范围,不是这篇正文的翻译或真实性证明。具体内容、来源和适用条件仍以原文为准。`:`This explains the kind and scope, not the page itself or its validity. Consult the original content, sources and conditions.`})]})}function $n({sid:e,channel:t,onOpenKnowledge:n,onOpenSkills:r}){let{locale:i}=z(),a=i===`zh-CN`,o=M(),s=A({queryKey:[`learning-status`,e],queryFn:({signal:t})=>R.learningStatus(e,t),enabled:!!e,refetchInterval:2e3,staleTime:1e3}),c=(0,G.useRef)(``);(0,G.useEffect)(()=>{let t=`${e}:${s.data?.revision??0}`;if(!(!s.data?.revision||t===c.current)){c.current=t;for(let e of[`skill-library`,`wiki-library`,`knowledge-feed`])o.invalidateQueries({queryKey:[e]})}},[e,s.data?.revision,o]);let l=N({mutationFn:e=>R.retryLearning(e.sid,e.id),onSuccess:(e,t)=>o.setQueryData([`learning-status`,t.sid],e)});if(!e||!s.data?.jobs.length)return null;let u=s.data.jobs,d=u.find(e=>e.status===`running`)??u.find(e=>e.status===`queued`),f=d??u[0],p=!!d||s.data.pending>0,m=!p&&f.status===`skipped`&&f.outcome.reason===`paused`;if(!p&&f.status===`skipped`&&(!m||!t))return null;let h={cost_unreconciled:[`上一次模型调用的费用尚未结算,结算前暂停新的模型调用`,`model calls are paused until an earlier call's cost is settled`],budget_exhausted:[`今日模型预算已用完`,`today's model budget is used up`],provider_cooldown:[`模型服务暂时限流`,`the model provider is briefly rate-limited`],operator_pause:[`模型调用已暂停`,`model calls are paused`]},g=h[f.outcome.detail??``]??h.operator_pause,_=m||!p&&f.status===`failed`,v=a?{knowledge:`知识库`,skills:`技能库`,preferences:`用户偏好`}:{knowledge:`Knowledge base`,skills:`Skill library`,preferences:`Preferences`},y=t?[t]:[`knowledge`,`skills`,`preferences`],b=p?y:y.filter(e=>(f.outcome.counts?.[e]??0)>0);if(!p&&!_&&!b.length)return null;let x=e=>{let t=f.outcome.counts?.[e]??0;return p?f.status===`running`?a?`${v[e]}正在更新`:`Updating ${v[e].toLowerCase()}`:a?`${v[e]}等待更新`:`${v[e]} update queued`:a?`${v[e]}已更新 · ${t} 条`:`${v[e]} updated · ${t}`},S=(f.outcome.items??[]).filter(e=>!t||e.channel===t);return(0,J.jsxs)(`div`,{className:`px-2 py-1.5 text-[11px] leading-5 text-ink-dim`,"data-learning-status":f.status,children:[(0,J.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:[p?(0,J.jsx)(nn,{className:`h-3 w-3 animate-spin text-blue`}):_?(0,J.jsx)($t,{className:`h-3 w-3 text-ink-faint`}):(0,J.jsx)(pn,{className:`h-3 w-3 text-blue`}),m&&(0,J.jsx)(`span`,{children:a?`本轮未学习:${g[0]}。回复不受影响。`:`Learning skipped: ${g[1]}. Your reply is unaffected.`}),!p&&f.status===`failed`&&(0,J.jsx)(`span`,{children:a?`本轮学习未完成,回复不受影响。`:`Learning from this turn did not finish. Your reply is unaffected.`}),!_&&b.map(e=>(0,J.jsx)(`span`,{children:x(e)},e)),s.data.pending>1&&(0,J.jsx)(`span`,{children:a?`还有 ${s.data.pending-1} 轮待学习`:`${s.data.pending-1} more queued`}),_&&f.retryable!==!1&&(0,J.jsx)(`button`,{type:`button`,disabled:l.isPending,className:`text-blue underline`,onClick:()=>l.mutate({sid:e,id:f.id}),children:a?`重试学习`:`Retry learning`})]}),p&&!t&&(0,J.jsx)(`p`,{className:`text-ink-faint`,children:a?`正在整理本轮的知识、方法和偏好,你可以继续工作。`:`Saving useful knowledge, methods and preferences. You can keep working.`}),S.length>0&&!t&&(0,J.jsxs)(`details`,{className:`mt-0.5`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-blue`,children:a?`查看本轮学到了什么`:`What this turn taught Argus`}),(0,J.jsx)(`ul`,{className:`pl-4 list-disc`,children:S.map((e,t)=>(0,J.jsx)(`li`,{children:(e.channel===`skills`?r:n)?(0,J.jsx)(`button`,{type:`button`,className:`text-left underline`,onClick:e.channel===`skills`?r:n,children:e.title}):e.title},t))})]}),(l.isError||s.isError)&&(0,J.jsx)(`p`,{role:`alert`,children:a?`暂时无法同步学习状态,请稍后重试。`:`Learning status could not be refreshed. Please retry.`})]})}var er=e=>`${e.library}/${e.path}`,tr=e=>e.filter(e=>!e.is_default&&e.updated_at!=null).sort((e,t)=>(t.updated_at??0)-(e.updated_at??0)||er(e).localeCompare(er(t)));function nr(e,t=!0){return A({queryKey:[`skill-library`,e],queryFn:({signal:t})=>R.skillLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var rr={en:{fact:`Fact`,lesson:`Lesson`,survey:`Survey`,principles:`Principles`,note:`Note`,profile:`Profile`,page:`Page`},zh:{fact:`事实`,lesson:`经验教训`,survey:`调研摘要`,principles:`原则`,note:`个人记录`,profile:`个人概况`,page:`参考页面`}},ir=e=>e.kind in rr.en?e.kind:`page`,ar=e=>[`wiki-library`,e];function or(e,t=!0){return A({queryKey:ar(e),queryFn:({signal:t})=>R.wikiLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var sr=[`feed`,`global`,`vertical`,`project`],cr={"zh-CN":{feed:`学习动态`,global:`全局项目`,vertical:`垂直领域`,project:`项目`},en:{feed:`Learning feed`,global:`Across projects`,vertical:`Vertical`,project:`Project`}};function lr(e,t,n,r){let i=r===`zh-CN`,a=e=>n===`feed`||e===n||n===`global`&&e===`private`,o=(e?.items??[]).filter(e=>a(e.scope)).map(e=>({kind:`knowledge`,item:e,id:`knowledge/${e.scope}/${e.vertical}/${e.path}`,title:e.title,description:e.description,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at,search:`${e.title} ${e.description} ${e.path}`})),s=(n===`feed`?tr(t?.items??[]):t?.items??[]).filter(e=>a(e.scope)).map(e=>{let t=xn(e,r);return{kind:`skill`,item:e,id:`skill/${e.library}/${e.path}`,title:t.title,description:t.summary,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at??0,search:Sn(e,r)}}),c=n===`feed`?[]:(e?.libraries??[]).filter(e=>a(e.scope)).flatMap(e=>[{kind:`index`,content:e.index_markdown,name:`INDEX.md`,title:i?`索引`:`Index`},{kind:`principles`,content:e.principles,name:`principles.md`,title:i?`原则`:`Principles`},{kind:`profile`,content:e.profile,name:`profile.md`,title:i?`个人概况(原私有范围)`:`Personal profile (private scope)`}].flatMap(t=>t.content?.trim()?[{kind:t.kind,content:t.content,id:`${t.kind}/${e.scope}/${e.vertical}/${e.root}`,title:t.title,description:``,path:`${e.root}/${t.name}`,scope:e.scope,vertical:e.vertical,updated:0,search:`${t.title} ${t.name}`}]:[]));return[...o,...s,...c].sort((e,t)=>t.updated-e.updated||e.id.localeCompare(t.id))}function ur({onOpen:e,compact:t=!1}){let{locale:n}=z(),r=n===`zh-CN`?`技能库`:`Skill library`;return(0,J.jsx)(`section`,{className:`shrink-0 ${t?`py-2`:`mx-2 py-1`}`,"data-learning-navigation":!0,children:(0,J.jsxs)(`button`,{type:`button`,onClick:()=>e(`feed`),"aria-label":r,title:r,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-ink-dim hover:bg-bg hover:text-ink ${t?`justify-center`:``}`,children:[(0,J.jsx)(K,{size:16,"aria-hidden":`true`}),!t&&r]})})}function dr({sid:e,initialScope:t=`feed`,initialSelection:n=null,projectNames:r={}}){let i=(0,G.useRef)(e);return(0,J.jsx)(fr,{sid:e,initialScope:t,initialSelection:i.current===e?n:null,projectNames:r},e??`no-project`)}function fr({sid:e,initialScope:t,initialSelection:n,projectNames:r}){let{locale:i}=z(),a=i===`zh-CN`,o=cr[i],[s,c]=(0,G.useState)(t),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(()=>n?n.kind===`skill`?`skill/${n.item.library}/${n.item.path}`:`knowledge/${n.item.scope}/${n.item.vertical}/${n.item.path}`:null),h=or(e),g=nr(e),_=Wn(s===`feed`),v=lr(h.data,g.data,s,i),y=v.find(e=>e.id===p),b=y?.kind===`knowledge`?y.item:null,x=y?.kind===`skill`?y.item:null,S=A({queryKey:[`wiki-document`,e,b?.scope,b?.vertical,b?.path,b?.updated_at],queryFn:({signal:t})=>{if(!b)throw Error(`No knowledge document selected`);return R.wikiDocument(e,b.scope,b.vertical,b.path,t)},enabled:!!b}),C=A({queryKey:[`skill-document`,e,x?.library,x?.path,x?.updated_at],queryFn:({signal:t})=>{if(!x)throw Error(`No skill document selected`);return R.skillDocument(e,x.library,x.path,t)},enabled:!!x}),w=l.trim().toLocaleLowerCase(),T=v.filter(e=>(s!==`vertical`||!d||e.vertical===d)&&(!w||`${e.search} ${e.vertical}`.toLocaleLowerCase().includes(w))),E=[...new Set([...h.data?.verticals??[],...g.data?.verticals??[]])].sort(),D=e=>e.scope===`private`?a?`个人记录 · 原私有范围,不共享`:`Personal record · private, not shared`:`${o[e.scope]}${e.vertical?` · ${wn(e.vertical,i)}`:``}`,O=e=>e.kind===`skill`?a?`技能`:`Skill`:e.kind===`knowledge`?rr[a?`zh`:`en`][ir(e.item)]:e.kind===`principles`?a?`原则`:`Principles`:e.kind===`profile`?a?`个人概况`:`Profile`:a?`索引`:`Index`,k=x?C:S,j=x?xn(x,i).guide:null,M=e=>{c(e),m(null),f(``)};return(0,J.jsxs)(`div`,{className:`flex h-[min(780px,84dvh)] min-h-0 flex-col`,"data-learning-library":!0,children:[(0,J.jsx)(lt,{title:a?`技能库`:`Skill library`,sub:a?`在一起查看学到的知识、可复用的方法和原始资料。`:`Explore learned knowledge, reusable methods and original sources together.`}),(0,J.jsx)($n,{sid:e,onOpenKnowledge:()=>M(`feed`),onOpenSkills:()=>M(`feed`)}),(0,J.jsx)(`nav`,{"aria-label":a?`学习资源分类`:`Learning resource categories`,className:`flex shrink-0 overflow-x-auto border-b border-line/60 px-4`,children:sr.map(e=>(0,J.jsx)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>M(e),className:`shrink-0 border-b-2 px-3 py-2.5 text-sm ${s===e?`border-blue text-ink`:`border-transparent text-ink-faint hover:text-ink`}`,children:o[e]},e))}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,J.jsxs)(`aside`,{className:`${y?`hidden md:flex`:`flex`} min-h-0 w-full flex-col md:w-80 md:shrink-0 md:border-r md:border-line/60`,children:[(0,J.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,J.jsx)(`input`,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":a?`搜索知识与技能`:`Search knowledge and skills`,placeholder:a?`搜索知识与技能`:`Search knowledge and skills`,className:`w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink`}),s===`vertical`&&(0,J.jsxs)(`select`,{value:d,onChange:e=>{f(e.target.value),m(null)},"aria-label":a?`垂直领域`:`Vertical`,className:`w-full rounded-md border border-line bg-bg px-2 py-2 text-sm text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:a?`所有领域`:`All verticals`}),E.map(e=>(0,J.jsx)(`option`,{value:e,children:wn(e,i)},e))]}),s===`feed`&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`学习记录与文件更新分开展示。文件变更不等于知识已验证。`:`Learning records and file updates are separate. An update does not prove knowledge is verified.`}),s===`global`&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`跨项目共享的知识和方法;个人记录保留原私有范围,不会被共享。`:`Shared knowledge and methods across projects. Personal records retain their private scope.`})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:[h.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`知识无法加载。`:`Knowledge could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void h.refetch(),children:a?`重试`:`Retry`})]}),g.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`技能无法加载。`:`Skills could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void g.refetch(),children:a?`重试`:`Retry`})]}),h.data?.errors.length||g.data?.errors.length?(0,J.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-err`,children:a?`部分资料无法读取;已加载的内容仍可查看。`:`Some sources could not be read; loaded material remains available.`}):null,s===`feed`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`学习记录`:`Learning records`}),_.isPending&&(0,J.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载学习记录…`:`Loading learning records…`}),_.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`学习记录无法加载。`:`Learning records could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void _.refetch(),children:a?`重试`:`Retry`})]}),_.data&&(0,J.jsx)(Xn,{events:_.data.events,items:h.data?.items??[],sid:e,projectNames:r,query:l,selected:b,onSelect:e=>{m(`knowledge/${e.scope}/${e.vertical}/${e.path}`)}}),(0,J.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`文件更新`:`File updates`})]}),(h.isPending||g.isPending)&&(0,J.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载资料…`:`Loading material…`}),!h.isPending&&!g.isPending&&!h.isError&&!g.isError&&!T.length&&(0,J.jsx)(`p`,{className:`p-3 text-sm text-ink-faint`,children:s===`project`&&!e?a?`选择一个项目以查看资料。`:`Select a project to see its material.`:a?`当前分类或筛选条件下没有资料。`:`No material matches this category or filter.`}),T.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>m(e.id),"aria-pressed":y?.id===e.id,className:`block w-full rounded-md px-3 py-3 text-left ${y?.id===e.id?`bg-blue/10`:`hover:bg-bg`}`,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,J.jsx)(`span`,{className:`shrink-0 rounded bg-line/60 px-1.5 text-[10px] text-ink-dim`,children:O(e)}),(0,J.jsx)(`span`,{className:`break-words text-sm font-medium text-ink`,children:e.title})]}),e.description&&(0,J.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs text-ink-dim`,children:e.description}),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:D(e)}),e.updated>0&&(0,J.jsx)(`time`,{className:`mt-1 block text-[11px] text-ink-faint`,dateTime:new Date(e.updated*1e3).toISOString(),children:new Date(e.updated*1e3).toLocaleString(i)})]},e.id))]})]}),(0,J.jsx)(`article`,{className:`${y?`block`:`hidden md:block`} min-w-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:y?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,className:`mb-4 text-sm text-blue md:hidden`,onClick:()=>m(null),children:a?`← 返回列表`:`← Back to the list`}),(0,J.jsx)(`h3`,{className:`break-words text-lg font-semibold text-ink`,children:y.title}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[O(y),` · `,D(y)]}),(0,J.jsx)(`p`,{className:`mt-1 break-all text-xs text-ink-faint`,children:y.path}),b&&(0,J.jsx)(Qn,{item:b}),x&&j&&(0,J.jsx)(Zn,{item:x,guide:j}),(0,J.jsx)(`div`,{className:`mt-5 border-t border-line/60 pt-5 text-sm text-ink`,children:y.kind===`knowledge`||y.kind===`skill`?(0,J.jsxs)(J.Fragment,{children:[k.isPending&&(0,J.jsx)(`p`,{children:a?`正在加载全文…`:`Loading document…`}),k.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-err`,children:[k.error.message,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void k.refetch(),children:a?`重试`:`Retry`})]}),b&&S.data?.truncated&&(0,J.jsx)(`p`,{role:`status`,className:`mb-3 text-xs text-ink-faint`,children:a?`页面过长,已截断显示。`:`Page shortened for display.`}),k.data&&(j?(0,J.jsxs)(`details`,{children:[(0,J.jsx)(`summary`,{className:`cursor-pointer py-2 text-blue`,children:a?`查看原始技能文档`:`Read the original skill`}),(0,J.jsx)(H,{children:k.data.content})]}):(0,J.jsx)(H,{children:k.data.content}))]}):(0,J.jsx)(H,{children:y.content})})]}):(0,J.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-ink-faint`,children:[(0,J.jsx)(K,{size:18,"aria-hidden":`true`}),a?`选择资料,阅读原文与使用条件。查看不会执行技能。`:`Select material to read its original and conditions. Reading does not execute a skill.`]})})]})]})}var pr=[{value:`copilot`,label:`settings.backendLabel.copilot`},{value:`codex`,label:`settings.backendLabel.codex`},{value:`claude`,label:`settings.backendLabel.claude`},{value:`cursor`,label:`settings.backendLabel.cursor`},{value:`opencode`,label:`settings.backendLabel.opencode`},{value:`pi`,label:`settings.backendLabel.pi`},{value:`grok`,label:`settings.backendLabel.grok`},{value:`qoder`,label:`settings.backendLabel.qoder`},{value:`dsh`,label:`settings.backendLabel.dsh`}],mr={copilot:`copilot`,codex:`codex`,claude:`claude`,cursor:`cursor`,opencode:`opencode`,pi:`pi`,grok:`grok`,qoder:`qoder`,dsh:`dsh`};function hr(e){return mr[e]??``}function gr(e,t){let n=hr(e);return n?t(`settings.backendLabel.${n}`):e}function _r(e){return e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.value??e?.roles[0]?.backend??``}function vr(e){let t=e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.source??``;return t===`env`||t===`persisted`||t==="default"?t:``}function yr(e){return(e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.saved??``).trim()}function br(e){return typeof e==`string`&&/^[\p{L}\p{N}_-][\p{L}\p{N}_.-]{0,127}$/u.test(e)}function xr(e){return e===void 0?{}:br(e)?{sessionId:e}:null}function Sr(e,t){return typeof e==`string`?e.trim().slice(0,t):``}function Cr(e,t){return Sr(e,t*2).replace(/!?(?:\[([^\]]+)\])\([^)]+\)/g,`$1`).replace(/[*_`#]/g,``).replace(/\s+/g,` `).trim().slice(0,t)}function wr(e){let t=Sr(e.completionId,300),n=xr(e.sessionId);if(!t||!n)return null;let r=Sr(e.path,1e3);return{...n,deliveryId:t,title:Cr(e.title,240)||`已完成的任务`,summary:Cr(e.summary,500),...r?{path:r}:{}}}function Tr(e,t){let n=Sr(e.delivery_id,300),r=xr(t);return!n||!r?null:{...r,deliveryId:n,title:Sr(e.title,240)||`Argus`,summary:Sr(e.summary,1e3),...e.primary_target?.path?{path:Sr(e.primary_target.path,1e3)}:{}}}function Er(){return typeof window>`u`||window.parent===window?null:window.parent}function Dr(){return Er()!==null}function Or(){Er()?.postMessage({type:`argus:show-trial-setup`},`*`)}function kr(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=Sr(t.deliveryId,300),r=xr(t.sessionId);if(!n||!r)return null;let i=Sr(t.path,1e3);return{...r,deliveryId:n,title:Sr(t.title,240)||`Argus`,summary:Sr(t.summary,1e3),...i?{path:i}:{}}}function Ar(e){let t=kr(e),n=Er();return!t||!n?Promise.resolve(!1):(n.postMessage({type:`argus:notify-completion`,payload:t},`*`),Promise.resolve(!0))}function jr(e){let t=Er();t&&t.postMessage({type:`argus:large-preview`,payload:e},`*`)}function Mr(e){let t=typeof window<`u`?window.location?.ancestorOrigins?.[0]:void 0;if(t&&t!==`null`)return e===t;if(typeof document<`u`&&document.referrer)try{let t=new URL(document.referrer);if(t.protocol===`http:`||t.protocol===`https:`)return e===t.origin;if(t.protocol===`tauri:`&&t.hostname===`localhost`)return e===`tauri://localhost`}catch{}return[`http://tauri.localhost`,`https://tauri.localhost`,`tauri://localhost`].includes(e)}function Nr(e){let t=Er();if(!t)return()=>void 0;let n=n=>{if(n.source!==t||!Mr(n.origin)||n.data?.type!==`argus:open-delivery`)return;let r=kr(n.data.payload);r&&e(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function Pr(e){let t=Er();if(!t)return()=>void 0;let n=n=>{n.source===t&&n.data?.type===`argus:new-chat`&&e()};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function Fr(){if(typeof document>`u`)return()=>void 0;let e=Er();if(!e)return()=>void 0;let t=t=>{if(t.defaultPrevented||t.button!==0&&t.button!==1)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null;if(!n)return;let r;try{r=new URL(n.href,window.location.href)}catch{return}r.origin===window.location.origin||![`http:`,`https:`].includes(r.protocol)||(t.preventDefault(),e.postMessage({type:`argus:open-external`,payload:r.toString()},`*`))},n=t=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.shiftKey||!(t.ctrlKey||t.metaKey))return;let n=t.key===`,`?`argus:show-setup`:t.key.toLowerCase()===`n`?`argus:request-new-chat`:null;n&&(t.preventDefault(),e.postMessage({type:n},`*`))},r=()=>e.postMessage({type:`argus:cockpit-interaction`},`*`);return document.addEventListener(`click`,t,!0),document.addEventListener(`auxclick`,t,!0),window.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r,{passive:!0}),()=>{document.removeEventListener(`click`,t,!0),document.removeEventListener(`auxclick`,t,!0),window.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}}var Ir=21600,Lr=e=>!e||[`auto`,`inherit`,`default`].includes(e.toLowerCase());function Rr({sid:e,roles:t,running:n,lastCall:r,onOpenSettings:i}){let{locale:a,t:o}=z(),{data:s}=Me(e,!0),c=a===`zh-CN`,l=(n?t.find(e=>e.active):void 0)??t.find(e=>e.role===`manager`),u=s?.trial_mode===!0,d=!!r&&(n||Date.now()/1e3-(r.ts||0)e.role===f.role):void 0,_=g&&g.backend&&g.backend!==f?.backend?g.backend:``,v=g&&!Lr(g.model)&&g.model!==f?.model?g.model:``,y=_||v?[gr(_||g.backend,o),v||g.model||`auto`].join(` · `):``,b=(0,J.jsxs)(J.Fragment,{children:[u?c?`试用`:`Trial`:p?gr(p,o):c?`模型信息待确认`:`Model information unavailable`,m?` · ${m}`:``,h?` · ${h}`:``,!u&&!f&&n&&l?.active?` · ${gt(l.role)?Ve(l.role,o):l.role}`:``]}),x=f?c?`最近一次模型调用实际使用的后端、模型和推理强度;点击更改`:`Backend, model and effort the latest model call actually used; click to change`:c?`当前配置的后端与模型;点击更改`:`Configured backend and model; click to change`;return(0,J.jsxs)(`div`,{className:`composer-runtime`,"aria-label":c?`当前后端与模型`:`Current backend and model`,children:[i&&!u?(0,J.jsxs)(`button`,{type:`button`,className:`composer-runtime-model`,onClick:i,title:x,"data-runtime-open-settings":!0,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}):(0,J.jsxs)(`span`,{className:`composer-runtime-model`,title:u?void 0:x,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}),(0,J.jsxs)(`details`,{className:`composer-runtime-details`,children:[(0,J.jsx)(`summary`,{children:c?`运行信息`:`Runtime details`}),(0,J.jsx)(`div`,{children:b})]}),y?(0,J.jsx)(`span`,{className:`composer-runtime-next`,"data-runtime-next":!0,children:c?`下次使用:${y}`:`next call: ${y}`}):null,u&&Dr()?(0,J.jsx)(`button`,{type:`button`,onClick:Or,children:c?`更换 Key`:`Change Key`}):null]})}function zr({session:e}){let{locale:t}=z(),n=t===`zh-CN`,r=n?`会话目录`:`Session directory`,i=e.workdir||e.cwd||(n?`待确认`:`Pending confirmation`);return(0,J.jsxs)(`details`,{className:`session-workdir`,"data-session-workdir":!0,children:[(0,J.jsxs)(`summary`,{title:`${r}: ${i}`,"aria-label":`${r}: ${i}`,children:[(0,J.jsx)(`span`,{children:r}),(0,J.jsx)(`code`,{children:i})]}),(0,J.jsxs)(`div`,{className:`session-workdir__detail`,children:[(0,J.jsx)(`strong`,{children:r}),(0,J.jsx)(`code`,{children:i}),(0,J.jsx)(`p`,{children:n?`来自已加载会话快照的工作目录;不是每个任务的实际 cwd,也不是安全沙箱边界。`:`Working directory from the loaded session snapshot; not each task’s actual cwd or a security sandbox boundary.`})]})]})}function Br(e){return!Number.isFinite(e)||e<=0?`$0.00`:e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(3)}`}function Vr({settledUsd:e,knownUsd:t=0,status:n=`empty`}){let r=typeof e==`number`&&Number.isFinite(e)?e:t,i=n===`partial`||n===`unpriced`;return`${Br(Math.max(0,r||0))}${i?`+`:``}`}function Hr({settledUsd:e,knownUsd:t,status:n,calls:r=0,premiumRequests:i=0,live:a=!1,compact:o=!1}){let s=Vr({settledUsd:e,knownUsd:t,status:n}),c=[`Cumulative settled project spend`,`${r} model call${r===1?``:`s`}`,i>0?`${i.toFixed(1)} premium requests`:``,n&&n!==`empty`?`pricing: ${n}`:``].filter(Boolean).join(` · `);return(0,J.jsxs)(`span`,{title:c,"aria-label":`Project spend ${s}`,className:`inline-flex shrink-0 items-center rounded-full border border-gold/25 bg-gold/8 font-mono tabular-nums text-gold ${o?`h-6 gap-1 px-2 text-[10px]`:`h-5 gap-1 px-1.5 text-[9px]`}`,children:[a?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-gold/80`}):null,(0,J.jsx)(`span`,{children:s})]})}var Ur=e=>String(e??``).trim(),Wr=/^[a-z][a-z -]+ requires an operator-owned decision before continuing\.?$/i,Gr=e=>{let t=Ur(e);return Wr.test(t)?``:t},Kr=(e,t)=>{let n=/[\u3400-\u9fff]/.test(`${e}\n${t}`);return{id:`custom`,label:n?`自己输入`:`Write my own answer`,description:n?`直接告诉 Argus 你的决定。`:`Tell Argus your decision directly.`,requires_note:!0}};function qr(e,t,n){let r=[...e,...t],i=new Map(t.map(e=>[Ur(e.id),e])),a=(e,t)=>{let n=i.get(e)??(Ur(t.id)===e?t:void 0);return{task_title:Ur(n?.title)||void 0,task_status:Ur(n?.status)||void 0}},o=[],s=new Set;for(let e of r){let t=Ur(e.id),n=e.operator_decision;if(n&&typeof n==`object`&&!Array.isArray(n)){let r=n,i=Ur(r.id);if(!i||s.has(i)||Ur(r.status)!==`pending`)continue;s.add(i);let c=Ur(r.options_source),l=r.kind===`domain_intake`,u=(c===`agent`||l&&c===`workflow`)&&Array.isArray(r.options)?r.options.filter(e=>!!Ur(e?.id)&&!!Ur(e?.label)).map(e=>({...e,requires_note:e.requires_note===!0})):[];u.some(e=>e.id===`custom`)||u.push(Kr(Ur(r.title),Ur(r.question)));let d=Ur(r.item_id)||t;o.push({id:i,...l?{kind:`domain_intake`}:{},item_id:d,revision:Number(r.revision??1),status:`pending`,title:Ur(r.title)||Ur(e.title)||`Decision required`,reason:Gr(r.reason),question:Ur(r.question)||Ur(e.pending_question),evidence:Array.isArray(r.evidence)?r.evidence.filter(e=>Ur(e?.label)!==`Acceptance check`):[],options:u,options_source:l?`workflow`:u.length?`agent`:`none`,selected_option:``,note:``,...a(d,e),...l?{task_title:Ur(r.task_title),task_status:void 0}:{},...typeof r.asked_at==`number`&&Number.isFinite(r.asked_at)&&r.asked_at>0?{asked_at:r.asked_at}:{}});continue}let r=Ur(e.pending_question??e.question??e.text);if(!t||!r)continue;let i=`legacy-${t}`;s.has(i)||(s.add(i),o.push({id:i,item_id:t,revision:1,status:`pending`,title:Ur(e.title??e.objective)||`Blocked task`,reason:``,question:r,evidence:[],options:[Kr(Ur(e.title??e.objective),r)],options_source:`none`,selected_option:``,note:``,legacy:!0,...a(t,e)}))}if(!n)return o;let c=o.map(e=>({...e,is_current_task:e.kind===`domain_intake`?void 0:e.item_id===n}));return[...c.filter(e=>e.kind===`domain_intake`),...c.filter(e=>e.is_current_task),...c.filter(e=>e.kind!==`domain_intake`&&!e.is_current_task)]}function Jr(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function Yr(e,t,n=``){let r=Jr(n,70);switch(e){case`manager`:return t?`正在整理任务进展`:`Summarizing progress`;case`planner`:return t?`正在安排接下来要做的事`:`Planning what to do next`;case`reviewer`:return r?t?`正在检查结果:${r}`:`Checking the result: ${r}`:t?`正在检查结果是否正确`:`Checking whether the result is correct`;default:return r?t?`正在处理:${r}`:`Working on: ${r}`:t?`正在处理当前任务`:`Working on the current task`}}var Xr=new Set([`running`,`in_progress`,`claimed`,`active`,`working`,`grounding`,`framed`]),Zr=new Set([`complete`,`completed`,`done`,`success`,`ended`]),Qr=new Set([`paused`,`stopped`,`cancelled`,`aborted`,`incomplete`,`blocked`,`stalled`]),$r=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:null;function ei(e){return String(e.item_id||e.mission_id||``).split(`:attempt:`)[0]}function ti(e,t,n){let r=e?.backlog?.find(e=>e.id===n),i=Date.parse(e?.daemon.started_at_iso||``)/1e3;return Math.max(t?.mission.id===n&&t.mission.started_at||0,r?.started_ts||0,Number.isFinite(i)?i:0)}function ni(e,t=0){let n=new Map;for(let r of e){if(Number(r.ts||0)ri.has(String(e.type||``))&&ei(e)===t.id&&Number(e.ts||0)>=r);e?.type===`round.external_work_wait.started`&&(i=String(e.work_id||``)),a=e?.type===`round.external_work_wait.completed`}else return null;if(a)return null;let o=(e.background_work||[]).find(e=>i&&e.work_id===i||e.waited_by?.includes(t.id));return o?{workId:o.work_id,parts:(o.parts||[]).map(e=>({role:e.role,done:e.done,total:e.total,running:e.running})),done:o.done,total:o.total,lastProgressAt:$r(o.last_progress_ts)}:i?{workId:i,parts:[],done:0,total:0,lastProgressAt:null}:null}function ai(e,t,n=[],r=Date.now()/1e3){let i=t?.mission.id||e?.backlog?.find(e=>Xr.has(e.status)||e.status===`paused_external_work`)?.id||``,a=e?.backlog?.find(e=>e.id===i),o=ti(e,t,i),s=e?.roles?.filter(e=>e.active)||[],c=(e?.backlog?.filter(e=>Xr.has(e.status)).length||0)>1,l=new Map;for(let e of t?.role_work||[])i&&(e.item_id||e.mission_id)!==i||e.tsXr.has(e.status)).sort((e,t)=>t.ts-e.ts).find(e=>s.some(t=>t.role===e.role))?.role||(c?``:(s.find(e=>e.role===t?.active_role)||s[0])?.role)||(e?``:t?.roles.find(e=>e.status===`active`)?.role)||``,d=n.filter(e=>{let t=ei(e);return(!i||t===i)&&Number(e.ts||0)>=o&&!String(e.run_label||``).startsWith(`map-summary`)&&/(?:progress|round\.(?:main|review)|life\.(?:mission|phase)|work\.segment)/.test(String(e.type||``))}).map(e=>$r(e.ts));for(let e of t?.role_work||[]){let t=e.item_id||e.mission_id;(!i||t===i)&&e.ts>=o&&e.kind!==`waiting`&&![`waiting`,`idle`].includes(e.status)&&d.push($r(e.ts))}let f=d.filter(e=>e!==null&&e<=r+5),p=f.length?Math.max(...f):null,m={state:`idle`,role:u,taskId:i,title:t?.mission.title||a?.title||t?.mission.objective||``,activityAt:p,activityAgeSeconds:p===null?null:Math.max(0,r-p),reason:``};if(!e||e.daemon.read_status===`error`)return{...m,state:`unknown`};if(e.manager_requests?.some(e=>e.status===`running`)??!1){let e=$r(ni(n)?.ts)??p;return{...m,state:`running`,role:`manager`,foreground:!0,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}if(!i){let e=[...n].reverse().find(e=>e.type===`ui.argus`&&e.mission_result===!0&&!e.item_id&&e.live!==!0);if(e){let t=$r(e.ts);return{...m,state:`step_finished`,activityAt:t,activityAgeSeconds:t===null?null:Math.max(0,r-t),reason:e.success===!1?`task_failed`:``}}}let h=ii(e,a,n,o);if(h){let e=h.lastProgressAt??p;return{...m,state:`waiting`,role:``,reason:`background_work`,waitingOn:h,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}let g=String(a?.status||t?.mission.status||``).toLowerCase();if(Qr.has(g)||g.startsWith(`paused_`)||g===`research_incomplete`){let t=qr(e.pending_questions??[],e.backlog.map(e=>({...e})),i).some(e=>e.item_id===i);return{...m,state:`paused`,role:``,reason:t?`operator_input`:`not_running`}}if([`failed`,`error`].includes(g))return{...m,state:`step_finished`,role:``,reason:`task_failed`};if(Zr.has(g))return e.daemon.alive&&s.some(e=>e.role===`planner`)?{...m,state:`running`,role:`planner`}:{...m,role:``,state:e.daemon.alive&&(t?.routing?.continuous||e.continuous?.enabled)?`waiting`:`step_finished`};if(!e.daemon.alive)return Xr.has(g)?{...m,state:`paused`,role:``,reason:`not_running`}:{...m,role:``};let _=[...n].reverse().find(e=>e.type===`round.backend_failure.backoff`&&Number(e.ts||0)>=o&&(!i||ei(e)===i));return _&&Number(_.ts||0)+Number(_.seconds||0)>r&&Number(_.ts||0)>=(p||0)?{...m,state:`waiting`,reason:`provider_wait`}:e.daemon.health?.stalled?{...m,state:`waiting`,reason:`no_recent_progress`}:u?{...m,state:`running`}:c&&s.length>0&&i?{...m,state:`unknown`}:{...m,state:`waiting`,reason:`awaiting_next_step`}}function oi(e,t){let n=t===`zh-CN`;return e===null?``:e<60?n?`刚刚`:`just now`:e<3600?n?`${Math.floor(e/60)} 分钟前`:`${Math.floor(e/60)} min ago`:n?`${Math.floor(e/3600)} 小时前`:`${Math.floor(e/3600)} hr ago`}var si={"idea-route":[`条研究路线`,[`research route`,`research routes`]],"idea-review":[`次独立复核`,[`independent review`,`independent reviews`]],"idea-selector":[`次方案选择`,[`idea selection`,`idea selections`]]};function ci(e,t){if(!e.total)return``;let[n,[r,i]]=si[e.role]??[`项子任务`,[`subtask`,`subtasks`]],a=e.total===1?r:i;return e.done===e.total?t?`${e.total} ${n}全部完成`:`all ${e.total} ${a} done`:t?`${e.total} ${n}中 ${e.done} ${n.slice(0,1)}完成`:`${e.done} of ${e.total} ${a} done`}function li(e,t){let n=t===`zh-CN`,r=e.waitingOn,i=(r?.parts??[]).map(e=>ci(e,n)).filter(Boolean),a=i.length?i.join(n?`、`:`, `):r?.total?n?`${r.total} 项子任务中 ${r.done} 项完成`:`${r.done} of ${r.total} subtasks done`:``,o=oi(e.activityAgeSeconds,t),s=o?n?o===`刚刚`?`,最近一次进展就在刚刚`:`,最近一次进展在 ${o}`:`, last progress ${o}`:``;return a?n?`正在等待后台团队:${a}${s}`:`Waiting for the background team: ${a}${s}`:n?`正在等待后台团队完成工作${s}`:`Waiting for the background team to finish${s}`}function ui(e,t,n=!0){let r=t===`zh-CN`;return n?e.reason===`operator_input`?r?`当前任务等待你的回复`:`This task is waiting for your reply`:e.reason===`task_failed`?r?`这一步执行未完成`:`Execution of this step did not finish`:e.reason===`background_work`?li(e,t):e.state===`running`?e.foreground?r?`正在处理你的请求`:`Working on your request`:Yr(e.role,r,e.title):e.reason===`provider_wait`?r?`模型服务暂时未能完成请求,等待后会重试`:`The model service could not complete the request; waiting before retrying`:e.reason===`no_recent_progress`?r?`暂时没有收到新的进展`:`No new progress received recently`:{running:[`正在处理当前任务`,`Working on the current task`],waiting:[`等待下一步工作`,`Waiting for the next step`],paused:[`当前任务未在运行`,`The current task is not running`],step_finished:[`这一步已结束`,`This step has ended`],idle:[`可以开始新任务`,`Ready for a new task`],unknown:[`暂时无法确认任务进度`,`Unable to confirm task progress right now`]}[e.state][+!r]:r?`实时连接已断开`:`Live connection lost`}var di=new Set([`grounding`,`task`,`decision`,`agent_message`,`assistant_message`,`command_execution`,`tool_use`,`tool_result`,`handoff`,`review`,`verdict`,`completion`,`plan`,`file_change`,`result`]),fi=/^(using a tool|running project command|inspecting project state|working|reporting progress|暂无详细记录)$/i;function pi(e){let t=pe(e).replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/gim,``).trim();return fi.test(t)||t.startsWith(`{`)?``:t}function mi(e,t,n=``){if(n){if(/^(?:rg|grep|glob|search)$/.test(n))return t?`检索项目文件`:`Searching project files`;if(/^(?:view|read|read_file)$/.test(n))return t?`读取文件`:`Reading a file`;if(/apply_patch|edit|write/.test(n))return t?`编辑文件`:`Editing a file`;if(/bash|shell|exec|terminal/.test(n))return t?`运行终端命令`:`Running a command`;if(/playwright|browser/.test(n))return t?`检查浏览器交互`:`Checking browser interactions`}return({grounding:[`理解任务与检查项目`,`Understanding the task`],task:[`安排任务`,`Task assignment`],decision:[`确定执行方案`,`Execution decision`],plan:[`制定执行计划`,`Planning the work`],agent_message:[`更新执行进度`,`Progress update`],assistant_message:[`更新执行进度`,`Progress update`],command_execution:[`运行项目命令`,`Running a project command`],tool_use:[`使用工具`,`Using a tool`],tool_result:[`工具输出`,`Tool output`],file_change:[`更新项目文件`,`Updating project files`],handoff:[`整理结果与后续工作`,`Summarizing results and next steps`],review:[`检查实现与结果`,`Checking implementation and results`],verdict:[`说明检查结果`,`Explaining the check result`],completion:[`完成任务`,`Task completed`],result:[`产出结果`,`Result`]}[e]??[`处理当前任务`,`Working on the current task`])[+!t]}function hi(e,t,n,r=0){let i=new Map;for(let a of e?.role_work??[]){if(a.role!==t||!di.has(a.kind)||a.tst.ts-e.ts)}function gi(e,t,n,r=0){return[...e].reverse().find(e=>e.type===`engineer.progress`&&Number(e.ts||0)>=r&&[`tool_use`,`command_execution`,`file_change`].includes(String(e.kind))&&String(e.agent_layer||e.actor||e.role)===t&&(!n||String(e.item_id||e.mission_id)===n))}function _i(e,t,n,r,i){return r||[`done`,`completed`,`failed`,`aborted`,`stopped`].includes(e?.mission.status??``)||i&&e?.mission.id!==i?!1:t.length?t.some(e=>e.role===n&&e.active):e?.active_role===n&&[`working`,`grounding`,`framed`,`running`].includes(e?.mission.status??``)}function vi(e,t){let n=Math.max(0,Math.floor(e));if(n<30)return``;let[r,i,a]=n<60?[n,`秒`,`s`]:n<3600?[Math.floor(n/60),`分钟`,`m`]:n<86400?[Math.floor(n/3600),`小时`,`h`]:[Math.floor(n/86400),`天`,`d`];return t?`上次更新 ${r} ${i}前`:`last update ${r}${a} ago`}function yi(e,t,n,r,i=!0,a=0){let o=ui(e,r,i);if(!i||e.state!==`running`||e.foreground||!e.taskId||!e.role)return o;let s=Math.max(a,t?.mission.id===e.taskId&&t.mission.started_at||0),c=hi(t,e.role,e.taskId,s).find(e=>e.detail&&[`agent_message`,`assistant_message`].includes(e.kind)||[`tool_use`,`command_execution`,`file_change`].includes(e.kind)),l=gi(n,e.role,e.taskId,s);if(c?.detail&&[`agent_message`,`assistant_message`].includes(c.kind)&&(!l||Number(l.ts||0)=c.ts)){let t=mi(String(l.kind),r===`zh-CN`,String(l.tool_name||``));return e.title?`${t}${r===`zh-CN`?`:`:`: `}${Jr(e.title,70)}`:t}return c&&[`tool_use`,`command_execution`,`file_change`].includes(c.kind)?mi(c.kind,r===`zh-CN`):o}var bi=new Set([`running`,`in_progress`,`claimed`]);function xi({snap:e,streamOk:t,onStart:n,onStop:r,onManage:i,onOpenSessions:a,mobileView:s,onToggleMobileView:c,busy:u,snapshotStale:d=!1,readOnly:f=!1,missionView:p,events:m=[]}){let{t:h,locale:g}=z(),_=ai(e,p,m),v=yi(_,p,m,g,t,ti(e,p,_.taskId)),y=[`complete`,`completed`,`done`,`success`].includes(String(p?.mission.status||``).toLowerCase()),b=_.role||`manager`,x=_.state===`running`&&t&&!d,S=e.backlog.find(e=>bi.has(e.status)),C=_.title||S?.title||S?.objective||(y?p?.mission.summary||p?.mission.title:``)||e.session.objective||``,w=!!(e.partial||e.observability?.slo.status===`degraded`),T=typeof e.spend_usd==`number`?e.spend_usd:e.usage_summary?.known_cost_usd??0,E=e.daemon.alive&&e.daemon.control_available===!1,O=!e.daemon.alive&&[`running`,`waiting`].includes(ai(e,p,m).state),k=E?h(`topbar.externallyManaged`):e.daemon.alive?h(`topbar.pauseDaemon`):h(O?`topbar.working`:`topbar.runDaemon`),A=w?[...(e.diagnostics??[]).map(e=>`${e.section}: ${e.message}`),...e.observability?.slo.violations??[]].join(` +`)||h(`common.degraded`):h(d?`common.stale`:t?`common.live`:`common.reconnecting`);return(0,J.jsxs)(mt,{children:[a?(0,J.jsx)(`button`,{type:`button`,onClick:a,"aria-label":h(`topbar.openSessions`),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-ink-faint hover:bg-bg hover:text-ink lg:hidden`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M2.5 4h11M2.5 8h11M2.5 12h11`})})}):null,(0,J.jsxs)(`div`,{className:`topbar-heading flex min-w-0 flex-1 flex-col justify-center gap-0.5`,children:[(0,J.jsx)(`div`,{className:`topbar-title min-w-0 truncate text-sm font-semibold text-ink`,title:e.session.display_name||e.session.id,children:e.session.display_name||e.session.id}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[x?(0,J.jsx)(`span`,{"data-role-dot":b,"aria-label":h(`topbar.roleActive`,{role:Ln(b,h)}),className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:B.role[b]||`rgb(var(--ink-faint))`}}):null,x||C?(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-ink-dim`,title:v,children:t?d?h(`common.stale`):v:h(`common.reconnecting`)}):null,(0,J.jsx)(zr,{session:e.session})]})]}),(0,J.jsx)(`span`,{title:A,className:`h-2 w-2 shrink-0 rounded-full transition-shadow duration-150 ${w||d?`bg-err ring-1 ring-err/30 ring-offset-1 ring-offset-panel`:t?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,children:(0,J.jsx)(`span`,{className:`sr-only`,children:A})}),T>0?(0,J.jsx)(Hr,{settledUsd:e.spend_usd,knownUsd:e.usage_summary?.known_cost_usd,status:e.spend_status,calls:e.usage_summary?.call_count,premiumRequests:e.usage_summary?.premium_requests,live:e.daemon.alive,compact:!0}):null,c?(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":h(s===`activity`?`topbar.showPreview`:`topbar.showActivity`),title:h(s===`activity`?`topbar.showPreview`:`topbar.showActivity`),className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center lg:hidden`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:s===`activity`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`11`,rx:`1.5`}),(0,J.jsx)(`path`,{d:`M9.5 2.75v10.5`})]}):(0,J.jsx)(`path`,{d:`M3 4h10M3 8h10M3 12h7`})})}):null,f?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,disabled:u||E||O,onClick:e.daemon.alive?r:n,"aria-label":k,title:E?h(`topbar.externalDaemonHint`):k,className:`compact-control flex h-8 shrink-0 items-center gap-1 px-2 disabled:opacity-40`,children:[(0,J.jsx)(o,{icon:e.daemon.alive?l:D,className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:E?h(`common.external`):e.daemon.alive?h(`common.pause`):h(O?`common.working`:`common.run`)})]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":h(`topbar.manageSession`),title:h(`topbar.manageSession`),onClick:i,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center text-sm tracking-widest`,children:`···`})]})]})}var Si=new Set([`running`,`in_progress`,`claimed`]);function Ci(e,t){let n;for(let r of t)r.item_id!==e.id||![`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.mission.orphaned`].includes(r.type)||(!n||r.ts>=n.ts)&&(n=r);if(n?.type===`life.mission.completed`&&!(n.ts(t.status===`done`||Si.has(t.status))&&(t.ts??0)>e?t.ts??0:e,0)}function Ti(e,t){return e.status===`failed`&&!e.pending_question&&(e.ts??0)t.status!==`done`&&!Si.has(t.status)&&(t.pending_question||t.status===`failed`&&!Ti(t,e))).sort((e,t)=>Number(!!t.pending_question)-Number(!!e.pending_question))}function Di(e){return e.find(e=>Si.has(e.status))??Ei(e)[0]??e.find(e=>e.status===`pending`)??e.at(-1)}function Oi(e,t){let n=new Set,r=new Set;for(let i of e.links)i.kind===`dependency`&&(i.target===t&&n.add(i.source),i.source===t&&r.add(i.target));return{upstream:e.tasks.filter(e=>n.has(e.id)),downstream:e.tasks.filter(e=>r.has(e.id))}}function ki(e){return e.status===`cancelled`?`aborted`:e.pending_question?`question`:Si.has(e.status)?`running`:e.outcome?.review_status===`unavailable`?`review_unavailable`:e.status===`failed`&&Ai(e)?`held`:e.status.startsWith(`paused`)||e.status===`blocked`?`paused`:[`done`,`failed`,`aborted`,`skipped`,`superseded`,`pending`,`missing`].includes(e.status)?e.status:`unknown`}function Ai(e){return e.outcome?.stage_certification===`not_certified`||!e.outcome?.execution_status&&/^manager stage hold:/i.test(e.last_error||``)}function ji(e,t){let n=e=>t.some(t=>t.type===`life.mission.started`&&t.ts>e);return e.filter(e=>e.status===`done`&&e.outcome?.review_status===`done`&&e.outcome.stage_certification===`certified`).map(e=>({task:e,completion:Ci(e,t)})).filter(({completion:e})=>e?.overall_complete===!0&&!n(e.ts)).map(({task:e})=>e).sort((e,t)=>(t.finished_ts??t.ts??0)-(e.finished_ts??e.ts??0))[0]}function Mi(e){let t=new Set,n=[],r=new Map([...e.keys()].map(e=>[e,[]]));for(let[t,n]of e)for(let e of n)r.get(e).push(t);for(let r of e.keys()){let i=[[r,!1]];for(;i.length;){let[r,a]=i.pop();if(a)n.push(r);else if(!t.has(r)){t.add(r),i.push([r,!0]);for(let n of e.get(r))t.has(n)||i.push([n,!1])}}}let i=new Map;for(let e of n.reverse()){if(i.has(e))continue;let t=i.size,n=[e];for(;n.length;){let e=n.pop();if(!i.has(e)){i.set(e,t);for(let t of r.get(e))n.push(t)}}}return i}function Ni(e){let t=new Map(e.map(e=>[e.id,e])),n=[...t.values()].sort((e,t)=>(e.ts??0)-(t.ts??0)||e.id.localeCompare(t.id)),r=[],i=new Set;for(let e of n)for(let n of new Set(e.deps??[]))t.has(n)||i.add(n),r.push({id:JSON.stringify([`dep`,n,e.id]),source:n,target:e.id,kind:`dependency`,missing:!t.has(n)});let a=[...[...i].map(e=>({id:e,title:`未包含的依赖`,objective:`该引用不在当前数据范围内。`,status:`missing`,deps:[],role:`system`})),...n],o=new Map(a.map(e=>[e.id,0])),s=new Map(a.map(e=>[e.id,[]]));r.forEach(e=>{o.set(e.target,(o.get(e.target)??0)+1),s.get(e.source)?.push(e.target)});let c=a.filter(e=>o.get(e.id)===0).map(e=>e.id),l=0;for(let e=0;et.id!==e.id&&t.plan_id===e.superseded_by_plan_id);t.length&&r.push({id:JSON.stringify([`replacement`,e.id,e.superseded_by_plan_id]),source:e.id,target:t[0].id,kind:`replacement`,target_plan_id:e.superseded_by_plan_id,target_count:t.length})}if(u){let e=Mi(s);r.filter(t=>t.kind===`dependency`&&e.get(t.source)===e.get(t.target)).forEach(e=>{e.cycle=!0})}return{tasks:a,links:r,missing:i.size,cyclic:u}}function Pi(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function Fi(e){return e?.match(/route[-_ ]?(\d+)/i)?.[1]??e?.match(/(\d+)\s*$/)?.[1]??``}function Ii(e,t){if(!e)return``;if(e.kind===`review`)return e.verdict===`rejected`?t?`复核:驳回`:`Review: rejected`:e.verdict===`qualified`?t?`复核:通过`:`Review: qualified`:``;if(e.kind===`route`)return e.selected?t?`通过 · 被选中`:`Qualified · chosen`:e.verdict===`rejected`?t?`驳回`:`Rejected`:e.verdict===`qualified`?e.selected===!1?t?`通过 · 未选中`:`Qualified · not chosen`:t?`通过`:`Qualified`:``;let n=Fi(e.selected_route);return n?t?`已选研究路线 ${n}`:`Chose route ${n}`:``}function Li(e){return e?e.kind===`selection`?e.selected_route?`chosen`:``:e.selected?`chosen`:e.verdict??``:``}function Ri(e){let t=String(e||``).split(/\r?\n/).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY|NEXT_ACTION)\s*=\s*/i,``).trim()).filter(e=>e&&!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e)).join(` `);return t.length>160?`${t.slice(0,159)}…`:t}function zi(e){let t=new Map;for(let n of e){if(n.type!==`idea.portfolio.formed`)continue;let e=Number(n.width);if(!Number.isInteger(e)||e<=0)continue;let r=t.get(n.item_id);(!r||n.ts>=r.ts)&&t.set(n.item_id,{ts:n.ts,width:e})}return new Map([...t].map(([e,t])=>[e,t.width]))}function Bi(e,t,n,r=16){let i=new Map;for(let e of t){if(e.type!==`team.task`||!e.item_id)continue;let t=i.get(e.item_id)??new Map;t.set(e.id,e),i.set(e.item_id,t)}if(!i.size)return e;let a=new Set(e.tasks.map(e=>e.id)),o=[],s=[];for(let t of e.tasks){if(t.branch)continue;let e=[...i.get(t.id)?.values()??[]].filter(e=>!a.has(e.id)).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));if(!e.length)continue;let c=e.slice(0,r),l=new Set(c.map(e=>e.id));for(let e of c)a.add(e.id),o.push({id:e.id,title:Pi(e,n),objective:Ri(e.text),excerpt:Ri(e.text),status:e.status||`unknown`,deps:[],pending_question:e.pending_question,role:`team`,team_role:e.team_role,...e.team_outcome?{team_outcome:e.team_outcome}:{},ts:e.ts,branch:!0,parent_id:t.id});let u=new Set(c.flatMap(e=>(e.deps??[]).filter(t=>l.has(t)&&t!==e.id)));for(let e of c){let n=[...new Set(e.deps??[])].filter(t=>l.has(t)&&t!==e.id);if(n.length)for(let t of n)s.push({id:JSON.stringify([`fanout`,t,e.id]),source:t,target:e.id,kind:`fanout`});else s.push({id:JSON.stringify([`fanout`,t.id,e.id]),source:t.id,target:e.id,kind:`fanout`});u.has(e.id)||s.push({id:JSON.stringify([`fanin`,e.id,t.id]),source:e.id,target:t.id,kind:`fanin`})}let d=e.length-c.length,f=`team-overflow:${t.id}`;d>0&&!a.has(f)&&(a.add(f),o.push({id:f,title:n?`还有 ${d} 条`:`+${d} more`,objective:n?`更多并行子任务收录在所属任务卡片中。`:`The remaining parallel subtasks live inside the owning card.`,status:`recorded`,deps:[],role:`team`,ts:e[r]?.ts,branch:!0,parent_id:t.id,overflow_count:d}),s.push({id:JSON.stringify([`fanout`,t.id,f]),source:t.id,target:f,kind:`fanout`},{id:JSON.stringify([`fanin`,f,t.id]),source:f,target:t.id,kind:`fanin`}))}return o.length?{...e,tasks:[...e.tasks,...o],links:[...e.links,...s]}:e}var Vi={"idea-route":[e=>`${e} 条研究路线`,e=>`${e} research route${e===1?``:`s`}`],"idea-review":[e=>`${e} 次独立复核`,e=>`${e} independent review${e===1?``:`s`}`],"idea-selector":[e=>`${e} 次方案选择`,e=>`${e} idea selection${e===1?``:`s`}`]},Hi=[e=>`${e} 个并行子任务`,e=>`${e} parallel subtask${e===1?``:`s`}`],Ui={pending:[`尚未开始`,`have not started`],running:[`正在进行`,`are under way`],done:[`已经完成`,`are complete`],failed:[`没有完成`,`did not finish`],question:[`在等待答复`,`are waiting for an answer`],paused:[`已暂停`,`are paused`],superseded:[`已被新计划替代`,`were replaced by a new plan`],aborted:[`已取消`,`were cancelled`],skipped:[`已跳过`,`were skipped`]};function Wi(e,t,n){let r=e.map(({role:e,count:t})=>(Vi[e]??Hi)[+!n](t)),i=n?r.length>1?`${r.slice(0,-1).join(`、`)}与 ${r[r.length-1]}`:r[0]:r.length>1?`${r.slice(0,-1).join(`, `)} and ${r[r.length-1]}`:r[0],a=(Ui[t]??[`已记录在案`,`are on record`])[+!n];return n?`${i}${a}`:`${i} ${a}`}function Gi(e,t){let n=e.filter(e=>e.team_outcome?.kind===`route`),r=n.filter(e=>e.team_outcome?.selected).map(e=>Fi(e.title)),i=n.filter(e=>e.team_outcome?.verdict===`rejected`&&!e.team_outcome.selected).map(e=>Fi(e.title)),a=n.filter(e=>e.team_outcome?.verdict===`qualified`&&!e.team_outcome.selected).map(e=>Fi(e.title)),o=[],s=e=>[...e].sort().join(t?`、`:`, `);return r.length&&o.push(t?`路线 ${s(r)} 通过并被选中`:`route ${s(r)} qualified and chosen`),a.length&&o.push(t?`路线 ${s(a)} 通过${r.length?`但未被选中`:`,等待选择`}`:`route${a.length>1?`s`:``} ${s(a)} qualified${r.length?` but not chosen`:`, selection pending`}`),i.length&&o.push(t?`路线 ${s(i)} 被驳回`:`route${i.length>1?`s`:``} ${s(i)} rejected`),o.length?t?`:${o.join(`,`)}`:`: ${o.join(`; `)}`:``}function Ki(e,t,n,r=3){let i=new Map;for(let t of e.tasks){if(!t.branch||t.overflow_count||t.group||!t.parent_id)continue;let e=JSON.stringify([t.parent_id,ki(t)]);(i.get(e)??i.set(e,[]).get(e)).push(t)}let a=new Set(e.tasks.map(e=>e.id)),o=new Map,s=new Map;for(let[e,c]of i){if(c.lengthe.role===t);n?n.count++:d.push({role:t,count:1})}let f=c[0],p=t.has(u);o.set(u,{id:u,title:Wi(d,l,n)+Gi(c,n),objective:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,excerpt:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,status:f.status,deps:[],pending_question:f.pending_question,role:`team`,ts:f.ts,branch:!0,parent_id:i,group:{status:l,members:c.map(e=>e.id),counts:d,expanded:p}});for(let e of c)s.set(e.id,u)}if(!o.size)return e;let c=[],l=new Set;for(let n of e.tasks){let e=s.get(n.id);if(!e){c.push(n);continue}l.has(e)||(l.add(e),c.push(o.get(e))),t.has(e)&&c.push(n)}let u=[],d=new Set;for(let n of e.links){let e=s.get(n.source),r=s.get(n.target),i=n.source,a=n.target;if(e&&!t.has(e)&&(i=e),r&&!t.has(r)&&(a=r),r&&t.has(r)&&n.kind===`fanout`&&n.source===o.get(r).parent_id&&(i=r),i===a)continue;if(i===n.source&&a===n.target){u.push(n);continue}let c=JSON.stringify([n.kind,i,a]);d.has(c)||(d.add(c),u.push({...n,id:c,source:i,target:a}))}for(let[e,n]of o){if(!t.has(e))continue;let r=JSON.stringify([`fanout`,n.parent_id,e]);d.has(r)||(d.add(r),u.push({id:r,source:n.parent_id,target:e,kind:`fanout`}))}return{...e,tasks:c,links:u}}function qi(e){return e.filter(e=>!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)).map(({source:e,target:t})=>({source:e,target:t}))}function Ji(e,t,n,r=[]){let i=(e,t)=>r.find(n=>n.source===e&&n.target===t&&n.label),a=e.links.map(e=>{if(e.kind!==`dependency`)return e;let r=t.find(t=>t.source===e.source&&t.target===e.target)??i(e.source,e.target);return r?{...e,label:r.label,stated:!0,evidence:`${n?`执行依赖`:`Execution dependency`} · ${r.label}`}:e}),o=new Map(e.tasks.map(e=>[e.id,e.id])),s=e=>{let t=o.get(e);return t===e?e:s(t)},c=(e,t)=>{o.set(s(e),s(t))};for(let e of a.filter(e=>e.kind===`dependency`))c(e.source,e.target);for(let n of t)!o.has(n.source)||!o.has(n.target)||e.tasks.findIndex(e=>e.id===n.source)>=e.tasks.findIndex(e=>e.id===n.target)||s(n.source)===s(n.target)||(a.push({source:n.source,target:n.target,label:n.label,kind:`semantic`,stated:!0,id:`semantic:${n.source}:${n.target}`}),c(n.source,n.target));for(let t=1;tYi+Math.min(500,Math.max(0,e-8)*60);function Qi(e,t,n,r,i,a,o){let s=new Map(n.map(e=>[e,t[e].y+i[e].height/2]));for(let c=0;c<6;c++)for(let l of c%2?[...e].reverse():e){let e=new Set(l),c=[],u=[],d=0;l.forEach((f,p)=>{let m=s.get(f)*.8,h=.8;for(let o of a[r.get(f)]){let r=n[o.index];e.has(r)||(m+=(t[r].y+i[r].height/2)*o.weight,h+=o.weight)}c.push(d);let g=m/h-i[f].height/2-d;for(u.push({start:p,end:p,sum:g*h,weight:h});u.length>1;){let e=u[u.length-2],t=u[u.length-1];if(e.sum/e.weight<=t.sum/t.weight)break;e.end=t.end,e.sum+=t.sum,e.weight+=t.weight,u.pop()}d+=i[f].height+(p+1[e,t])),a=t.filter(e=>e.kind!==`replacement`&&e.source!==e.target).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:.4})),o=e.map(()=>[]),s=e.map(()=>[]),c=e.map(()=>[]);for(let e of a)o[e.source].push(e.target),s[e.target].push(e.source),c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let l=new Set(a.filter(e=>e.weight===1).map(e=>`${Math.min(e.source,e.target)}:${Math.max(e.source,e.target)}`)),u=(e,t)=>{let n=i.get(e),r=i.get(t);return l.has(`${Math.min(n,r)}:${Math.max(n,r)}`)?Xi:Xi*1.3},d=e.reduce((e,t)=>e+n[t].width*n[t].height,0),f=Math.sqrt(d/e.length),p=e.reduce((e,t)=>e+n[t].height,0)/e.length,m=Math.ceil(Math.sqrt(e.length)*1.8),h=e.map(()=>[]);for(let e of a)h[Math.max(e.source,e.target)].push(e);let g=e.map((t,n)=>{let r=0;return Array.from({length:Math.min(m,e.length-n)+1},(e,t)=>{if(t)for(let e of h[n+t-1])Math.min(e.source,e.target)1||s[e.target].length>1)&&(r+=e.weight*.9),r+=Math.max(0,Math.abs(e.target-e.source)-1)*e.weight);return r})}),_={},v=1/0,y=new Set;for(let t=1;t<=m;t++){let o=t*p+(t-1)*Xi,l=Array(e.length+1).fill(1/0),m=Array(e.length+1).fill(0);l[0]=0;for(let r=1;r<=e.length;r++){let i=0;for(let a=r-1;a>=Math.max(0,r-t);a--){i+=n[e[a]].height+(a===r-1?0:Xi);let t=g[a][r-a];a>0&&s[a].some(e=>s[a-1].includes(e))&&(t+=.7);let c=l[a]+.2+(i/o-1)**2+t;c0;t=m[t])h.unshift(e.slice(m[t],t));let b=JSON.stringify(h);if(y.has(b))continue;y.add(b);let x=h.map(e=>Math.max(...e.map(e=>n[e].width))),S=h.map(e=>e.reduce((e,t)=>e+n[t].height,0)+(e.length-1)*Xi),C=x.reduce((e,t)=>e+t,0)+(h.length-1)*r,w=Math.max(...S),T={},E=0;h.forEach((e,t)=>{let i=(w-S[t])/2;e.forEach((r,a)=>{T[r]={x:E+(x[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1T[e].y));for(let t of e)T[t].y-=D;w=Math.max(...e.map(e=>T[e].y+n[e].height));let O=a.reduce((t,r)=>{let i=T[e[r.source]],a=T[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,a.length)/f,k=2*Math.log(C/w/2.1)**2+.08*C*w/d+.14*O+.08*l[e.length]/h.length;k[e,t])),a=e=>e.source!==e.target&&i.has(e.source)&&i.has(e.target),o=new Set,s=new Map;for(let e of t)!a(e)||e.kind!==`fanout`&&e.kind!==`fanin`||(e.kind===`fanout`?o.add(e.target):o.add(e.source),(s.get(e.source)??s.set(e.source,new Set).get(e.source)).add(e.target),(s.get(e.target)??s.set(e.target,new Set).get(e.target)).add(e.source));let c=e.map(()=>[]),l=t.filter(e=>e.kind!==`replacement`&&a(e)).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:e.kind===`fanout`||e.kind===`fanin`?.8:.4}));for(let e of l)c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let u=e.map(()=>[]);for(let e of t){if(!ea.has(e.kind)||!a(e))continue;let t=i.get(e.source),n=i.get(e.target);td[e]))+1:f+1;d.push(e),f=Math.max(f,e)}let p=[];e.forEach((e,t)=>{(p[d[t]]??=[]).push(e)});let m=p.filter(e=>e?.length),h=(e,t)=>o.has(e)&&o.has(t)?Xi/2:Xi,g=e=>e.reduce((t,r,i)=>t+n[r].height+(i?h(e[i-1],r):0),0),_=e.reduce((e,t)=>e+n[t].width*n[t].height,0),v=Math.sqrt(_/e.length),y=e.filter(e=>!o.has(e)),b=(y.length?y:e).reduce((e,t)=>e+n[t].height,0)/Math.max(1,y.length||e.length),x=Math.ceil(Math.sqrt(e.length)*1.8),S={},C=1/0,w=new Set;for(let t=1;t<=x;t++){let a=t*b+(t-1)*Xi,u=[];for(let e of m){let t=[],n=()=>{if(!t.length)return;let e=o.has(t[0]);if(e)u.push({nodes:t,isBranch:e});else{let n=[];for(let r of t)n.length&&g([...n,r])>a&&(u.push({nodes:n,isBranch:e}),n=[]),n.push(r);n.length&&u.push({nodes:n,isBranch:e})}t=[]};for(let r of e)t.length&&o.has(t[0])!==o.has(r)&&n(),t.push(r);n()}let d=[],f=[];for(let e of u){let t=d.at(-1),n=t&&e.nodes.some(e=>t.some(t=>s.get(e)?.has(t)));!t||n||f.at(-1)!==e.isBranch||g([...t,...e.nodes])>a?(d.push([...e.nodes]),f.push(e.isBranch)):t.push(...e.nodes)}let p=JSON.stringify(d);if(w.has(p))continue;w.add(p);let y=d.map(e=>Math.max(...e.map(e=>n[e].width))),x=d.map(g),T=y.reduce((e,t)=>e+t,0)+(d.length-1)*r,E=Math.max(...x),D={},O=0;d.forEach((e,t)=>{let i=(E-x[t])/2;e.forEach((r,a)=>{D[r]={x:O+(y[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1D[e].y));for(let t of e)D[t].y-=k;E=Math.max(...e.map(e=>D[e].y+n[e].height));let A=l.reduce((t,r)=>{let i=D[e[r.source]],a=D[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,l.length)/v,j=2*Math.log(T/E/2.1)**2+.08*T*E/_+.14*A;j=e.length*.3?ta(e,t,n):$i(e,t,n)}function ra(e){let t=new Map,n=new Map,r=new Map;return e.map(e=>{let i=`${e.source}\u0000${e.target}`,a=(t.get(e.source)??0)+(n.get(e.target)??0)-(r.get(i)??0);return t.set(e.source,(t.get(e.source)??0)+1),n.set(e.target,(n.get(e.target)??0)+1),r.set(i,(r.get(i)??0)+1),a})}function ia(e,t){if(e.x===t.x&&e.y===t.y)return{sourceHandle:`right`,targetHandle:`bottom`};let n=t.x+t.width/2-e.x-e.width/2,r=t.y+t.height/2-e.y-e.height/2,i=r>0?t.y-e.y-e.height:e.y-t.y-t.height,a=n>0?t.x-e.x-e.width:e.x-t.x-t.width;return i>=0&&a<0?r>=0?{sourceHandle:`bottom`,targetHandle:`top`}:{sourceHandle:`top`,targetHandle:`bottom`}:n>=0?{sourceHandle:`right`,targetHandle:`left`}:{sourceHandle:`left`,targetHandle:`right`}}function aa(e,t){return e?.type!==`life.mission.completed`||e.overall_complete!==!1&&e.campaign_continues!==!0||e.outcome?.execution_status===`completed`&&e.outcome.review_status===`done`?``:t?`当次执行已结束;当时总体目标尚未完成${e.campaign_continues===!0?`,仍需后续工作`:``}。`:`This execution ended; the overall goal was not complete at that time${e.campaign_continues===!0?` and further work remained`:``}.`}function oa(e){let{total:t,qa:n=0,complete:r,ended:i=0,reviewUnavailable:a=0,held:o=0,running:s,pending:c,paused:l,hasOpenWork:u,role:d,current:f,waiting:p,zh:m}=e,h=t>0&&r===t&&i===0,g=n===t&&n>0?m?`已全部回答`:`all answered`:m?`已全部完成`:`all completed`,_=m?[t>n?`${t-n} 个任务`:``,n>0?`${n} 条问答`:``,r>0&&!h?`已完成 ${r} 个`:``,i>0?`${i} 个任务结束时目标还没完成`:``,a>0?`${a} 个结果尚未检查成功`:``,o>0?`${o} 个任务暂停,后续工作尚未安排`:``,s>1?`${s} 个任务同时进行`:``]:[t>n?`${t-n} ${t-n===1?`task`:`tasks`}`:``,n>0?`${n} Q&A`:``,r>0&&!h?`${r} done`:``,i>0?`${i} ended before their goals were complete`:``,a>0?`${a} ${a===1?`result has`:`results have`} not been checked successfully`:``,o>0?`${o} paused with no next step scheduled`:``,s>1?`${s} tasks in progress`:``],v=c?m?`正在处理你的消息`:`working on your message`:p||(l?h?g:u?m?`已暂停`:`paused`:t>0?m?`没有在进行的工作`:`nothing in progress`:m?`就绪`:`ready`:f||(d?Yr(d,m):h?g:``));return[..._,v].filter(Boolean).join(` · `)}var sa=[{match:/External interrupt|daemon (?:stop|shutdown)|stopped by its operator/i,bare:/^(?:Engineer interrupted because daemon shutdown|Argus was stopped by its operator|Reviewer backend returned no complete judgment \([^)]*External interrupt)/,kind:`interrupt`,zh:`运行被操作员停下,这一轮没有做完;这不是对工作本身的评价`,en:`Argus was stopped by its operator before this round could finish; this says nothing about the work itself`},{match:/no complete judgment|before reaching a judgment|reached a conclusion|did not reach a conclusion/i,bare:/^(?:Reviewer backend (?:returned no complete judgment|ended before reaching a judgment)|The Reviewer's session ended before it reached a conclusion|The review did not reach a conclusion)/,kind:`reviewer`,zh:`审阅者的会话在得出结论前就结束了,这一轮没有评审意见`,en:`The Reviewer's session ended before it reached a conclusion, so this round was not judged`},{bare:/^Engineer backend failed before a trustworthy completed turn/,kind:`reviewer`,zh:`模型服务在工程师做完之前断开了;Argus 会换一个新会话重试,审阅等到那时再做`,en:`The model service dropped the Engineer's session before it finished; Argus retries in a fresh session and the review waits until then`},{bare:/^Retry in a fresh (?:\w+ )?session/,zh:`Argus 会换一个新会话再试一次`,en:`Argus will try again in a fresh session`},{bare:/^Restart the daemon when ready/,zh:`重新启动后,Argus 会从项目留下的状态继续,选择下一项具体任务`,en:`Once Argus is started again it continues from the saved project state and picks the next concrete task`},{bare:/^engineer round \d+ \((?:fresh|rotated|resumed)[^)]*\)\s*$/i,kind:`round`,zh:`工程师开始了新的一轮工作`,en:`The Engineer began a new round of work`},{match:/provider[\s-]?turn/i,bare:/^(?:One Engineer call|\d+ Engineer sessions in a row each) used (?:its|their) whole per-call provider-turn allowance/,zh:`继续换了个新会话接着做,之前的进展都在`,en:`Continued in a fresh session; earlier progress is kept`},{match:/budget (limit|cap|exhausted)|blocking budget|预算上限/i,bare:/^Paused because this project reached its budget limit/,zh:`花费到了预算上限,先暂停;提高预算后可以继续`,en:`Paused at the budget limit; work resumes once the budget is raised`},{match:/quarantin/i,bare:/^The task signature is quarantined out of planner rotation/,zh:`这个方向连续失败,先搁置,不再自动重试`,en:`This direction kept failing and is set aside; it will not retry on its own`},{match:/backend[\s\S]{0,24}?(fail|unavailable|paused)|backend_failure|provider cooldown|configured model is unavailable/i,bare:/^(?:backend failure; retrying in a fresh|The backend has failed the same way \d+ times in a row)/,zh:`模型服务暂时不稳定,稍后会自动重试`,en:`The model service was briefly unavailable; it retries after a short wait`}],ca=/Runner receipt:|Technical record:|技术记录[::]/i,la=/^(?:Runner receipt|Technical record|技术记录)\s*[::]\s*/i;function ua(e){let t=String(e||``).trim(),n=t.search(ca);return n<0?{prose:t,receipt:``}:{prose:t.slice(0,n).trim(),receipt:t.slice(n).trim()}}function da(e,t){let n=String(e||``).trim(),{receipt:r}=ua(n),i=r?sa.find(e=>e.match?.test(n)):sa.find(e=>e.bare?.test(n));return i?{summary:t?i.zh:i.en,receipt:r||n,kind:i.kind}:{summary:``,receipt:r}}var fa={width:1440,height:1080},pa=[`plan`,`execution`,`review`,`revision`,`result`];function ma(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function ha(e,t){let n=e.team_outcome;if(!n)return``;if(n.kind===`review`){let e=n.verdict===`rejected`?t?`复核结论:驳回`:`Verdict: rejected`:n.verdict===`qualified`?t?`复核结论:通过`:`Verdict: qualified`:``;if(!e)return``;let r=n.summary?va(n.summary,120):``;return r?`${e}${t?`。`:`. `}${r}`:e}if(n.kind===`route`){let e=n.title?t?`「${n.title}」`:`“${n.title}”`:``;if(n.selected)return t?`${e}通过独立复核,被选为唯一方案`:`${e} passed its independent review and was chosen`;if(n.verdict===`rejected`){let r=n.rejection?va(n.rejection,120):``;return(t?`${e}被独立复核驳回`:`${e} was rejected by its independent review`)+(r?t?`。${r}`:`. ${r}`:``)}return n.verdict===`qualified`?n.selected===!1?t?`${e}通过独立复核,但未被选中`:`${e} passed its independent review but was not chosen`:t?`${e}通过独立复核,等待选择`:`${e} passed its independent review; selection pending`:``}let r=Fi(n.selected_route);if(!r)return``;let i=n.selected_title?t?`(${n.selected_title})`:` (${n.selected_title})`:``,a=(n.rejected??[]).map(Fi).filter(Boolean);return(t?`选定研究路线 ${r}${i}`:`Chose route ${r}${i}`)+(a.length?t?`,驳回路线 ${a.join(`、`)}`:`; rejected route${a.length>1?`s`:``} ${a.join(`, `)}`:``)}function ga(e,t,n){return e.pending_question?t?`需要答复,展开查看具体问题`:`Needs your input; open to read the question`:e.status===`failed`?t?`本次执行失败,展开查看原因`:`This attempt failed; open to read the reason`:e.status===`blocked`?t?`执行受阻,展开查看原因`:`Work is blocked; open to read the reason`:ha(e,t)||(e.status===`done`?e.team_role===`idea-review`?t?`独立复核已完成,展开查看记录`:`Independent review completed; open to read the record`:t?`子任务执行已完成,展开查看记录`:`Subtask execution completed; open to read the record`:e.status===`pending`?n?t?`等待前置子任务完成后开始`:`Waiting for prerequisite subtasks to finish`:t?`等待分配 Agent 执行`:`Waiting for an agent to start`:Si.has(e.status||``)?e.team_role===`idea-route`?t?`正在开展来源研究,整理候选方案`:`Researching sources and developing a candidate idea`:e.team_role===`idea-review`?t?`正在独立核对依据、创新性和风险`:`Independently checking evidence, novelty and risks`:e.team_role===`idea-selector`?t?`正在对比研究路线及复核意见`:`Comparing research routes and independent reviews`:t?`Agent 正在执行此子任务`:`An agent is working on this subtask`:t?`展开查看子任务执行记录`:`Open to read the subtask record`)}var _a=e=>e?`这一步还没有留下记录`:`Nothing has been written down for this step yet.`;function va(e,t=140){let n=e.replace(/\s+/g,` `).trim();if(!n)return``;let r=n.match(/^.*?[。!?!?.](?=\s|$)/),i=(r?r[0]:n).trim();return i.length>t?`${i.slice(0,t-1).trimEnd()}…`:i}function ya(e){let t=e.replace(/\s+/g,` `).trim().split(/[。!?;;::,,\n]|\.(?=\s|$)|[!?](?=\s|$)/)[0]?.trim();return t&&t.length>=6&&t.length<=40?t:``}function ba(e){return String(e||``).split(/\r?\n/).filter(e=>!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e.trim())&&!/^\{\s*"[\w-]+"\s*:.*\}$/.test(e.trim())).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/i,``).replace(/^\s*NEXT_ACTION\s*=\s*/i,``)).join(` +`).trim()}function xa(e,t,n){switch(e.type){case`life.planner.task_added`:return n?`规划者把这项任务列入了计划。`:`The Planner added this task to the plan.`;case`life.mission.started`:return n?`工程师接手了这项任务,开始动手。`:`The Engineer picked up this task and began working.`;case`life.phase.started`:case`round.review.started`:return e.role===`reviewer`?n?`审阅者打开了工程师的工作,开始核查。`:`The Reviewer opened the Engineer's work to check it.`:``;case`life.mission.completed`:return aa(e,n)||(t===`done`?n?`任务完成,结果已经记录在案。`:`The task was finished; its result is on record.`:t===`paused_external_work`?n?`这项任务在等待后台团队的结果;结果就绪后会自动继续。`:`This task is waiting for its background team; it continues on its own once the results are in.`:t.startsWith(`paused`)?n?`这项任务的工作暂停了。`:`Work on this task was paused.`:n?`任务到此结束。`:`The task ended here.`);case`life.mission.failed`:return n?`任务没有达到目标就结束了。`:`The task ended without reaching its goal.`;default:return``}}var Sa=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,Ca=(e,t)=>e.length>t?`${e.slice(0,t-1).trimEnd()}…`:e;function wa(e){let t=e.slice(e.indexOf(`:`)+1).trim();if(!t)return``;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of[`path`,`file`,`file_path`,`pattern`,`query`,`url`,`command`,`paths`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim();if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}let n=Object.values(t).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n.trim():``}}catch{}return/^[{[]/.test(t)?/"(?:path|file|file_path|pattern|query|url|command)"\s*:\s*"([^"]+)/.exec(t)?.[1]??``:t}function Ta(e){let t=(e.tool||e.label.replace(Sa,``).split(`:`)[0]||``).trim().toLowerCase();return e.kind===`command_execution`?`run`:e.kind===`file_change`?`edit`:/^(view|read|cat|open|read_file|str_replace_editor)$/.test(t)?`read`:/^(rg|grep|search|find_text|semantic_search|codebase_search|web_search|search_web)$/.test(t)||/^(glob|find|list|ls|list_dir|find_files)$/.test(t)?`search`:/^(web_fetch|fetch|http_get|browse)$/.test(t)?`fetch`:/^(apply_patch|edit|write|create|write_file|edit_file|replace_in_file|str_replace)$/.test(t)?`edit`:/^(bash|shell|sh|execute|terminal|run)$/.test(t)?`run`:`other`}function Ea(e,t){let n=(e.tool||``).trim(),r=e.label.replace(Sa,``).trim(),i=n&&/\s/.test(n)&&n.length>8,a=Ca(wa(r),72),o=Ca(r,72),s=Ta(e),c=i?n:s===`run`?t?`运行命令 \`${o}\``:`Ran \`${o}\``:s===`read`?t?`查看 ${a||(t?`一份文件`:``)}`:`Read ${a||`a file`}`:s===`search`?t?`查找 ${a||`内容`}`:`Looked for ${a||`something`}`:s===`fetch`?t?`读取网页 ${a||``}`.trim():`Fetched ${a||`a page`}`:s===`edit`?t?`修改文件 ${a||``}`.trim():`Edited ${a||`a file`}`:Ca(/^[^:{]*:\s*[{[]/.test(r)?r.slice(0,r.indexOf(`:`)):r,80);return e.status===`failed`?`${c}${t?`(失败)`:` (failed)`}`:c}function Da(e,t,n){let r=new Map;e.forEach(e=>r.set(Ta(e),(r.get(Ta(e))??0)+1));let i=[],a=(e,t,a,o)=>{let s=r.get(e);s&&i.push(n?`${t}${s}${e===`run`?`条命令`:e===`fetch`?`个网页`:`处`}`:`${s} ${s===1?a:o}`)};a(`read`,`查看了`,`file read`,`files read`),a(`search`,`查找了`,`search`,`searches`),a(`fetch`,`读取了`,`page fetched`,`pages fetched`),a(`edit`,`修改了`,`file edited`,`files edited`),a(`run`,`运行了`,`command run`,`commands run`);let o=r.get(`other`);return o&&i.push(n?`${o}次其他操作`:`${o} other ${o===1?`action`:`actions`}`),t>0&&i.push(n?`另有 ${t} 步未列出`:`${t} more not listed`),i.length?n?`${i.join(`,`)}。`:`${i.join(`, `)}.`:``}function Oa(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.status===`running`&&n.status&&n.status!==`running`&&(e.call_id&&n.call_id?e.call_id===n.call_id:!e.call_id&&!n.call_id&&e.kind===n.kind&&e.label===n.label&&(e.tool??``)===(n.tool??``))?t[t.length-1]={...e,status:n.status,...n.call_id?{call_id:n.call_id}:{}}:t.push(n)}return t}function ka(e,t){let n=Oa(e.steps??[]),r=ba(e.text),i=e.tool_details_recorded===!1,a=i?t?`执行日志确认发生过工具活动,但这一轮没有记录详细工具步骤。`:`Execution logs confirm tool activity, but detailed tool steps were not recorded for this turn.`:``;return Ma({id:e.id,kind:e.role===`reviewer`?`review`:`execution`,title:``,detail:``,status:e.status||`recorded`,ts:e.ts,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id],segment:!0,work:{steps:[...n],overflow:e.overflow??0,narrations:r?[r]:[],note:a,title:i?t?`已记录的执行`:`Recorded execution`:``,single:e.role===`manager`}},t)}var Aa=8,ja=(e,t)=>{let n=Math.max(0,e.steps.length-Aa)+e.overflow;return[...e.steps.slice(0,Aa).map(e=>`· ${Ea(e,t)}`),...n>0?[t?`· 另有 ${n} 步未列出`:`· ${n} more not listed`]:[]]};function Ma(e,t){let n=e.work,r=n.narrations.join(` + +`);return e.title=n.title||ya(n.narrations[0]??``)||(n.single?t?`Argus 动手查证`:`Argus did the work`:n.steps.length?t?`做了 ${n.steps.length} 步操作`:`${n.steps.length} steps of work`:t?`说明了接下来要做什么`:`Said what comes next`),e.summary=va(n.narrations[0]??``)||Da(n.steps,n.overflow,t)||void 0,e.detail=[n.note,r,ja(n,t).join(` +`)].filter(Boolean).join(` + +`)||_a(t),e.workCount=n.steps.length+n.overflow||void 0,e}function Na(e,t){let n=e.work;if(!n||e.segment)return e;let r=e.detail===_a(t)?``:e.detail,i=n.narrations.filter(e=>!r.includes(e.slice(0,60))),a=n.steps.length+n.overflow,o=Da(n.steps,0,t),s=a?[t?`这一步里做的操作(${a} 步):${o}`:`What was done in this step (${a} actions): ${o}`,ja(n,t).join(` +`)].join(` +`):``,c=n.narrations[n.narrations.length-1];return!e.closed&&c&&(e.title=ya(c)||e.title,e.summary=va(c)||e.summary),e.detail=[n.note,r,i.join(` + +`),s].filter(Boolean).join(` + +`)||_a(t),e.workCount=a||void 0,e}function Pa(e,t){switch(e){case`done`:return t?`这项任务已经完成。`:`This task was completed.`;case`failed`:return t?`这项任务没有达到目标。`:`This task did not reach its goal.`;case`cancelled`:case`aborted`:return t?`这项任务被取消了。`:`This task was cancelled.`;case`skipped`:return t?`这项任务被跳过了。`:`This task was skipped.`;case`superseded`:return t?`这项任务被一个新的计划取代了。`:`A new plan took the place of this task.`;default:return``}}function Fa(e,t,n){let r=e.kind===`turn`,i=[{id:`${e.id}:brief`,kind:`plan`,title:r?n?e.turn_kind===`qa`?`你提出的问题`:`你提出的要求`:`What you asked`:n?`任务目标`:`Task goal`,detail:e.objective||e.title,status:`recorded`,source:`task`,eventIds:[]}],a=new Set,o=0,s,c=t.filter(t=>t.item_id===e.id).sort((e,t)=>e.ts-t.ts||(e.type===`team.task`&&t.type===`team.task`?(e.team_task_id||e.id).localeCompare(t.team_task_id||t.id):0)),l=new Map(c.filter(e=>e.type===`team.task`).map(e=>[e.id,e]));for(let e of c){if(a.has(e.id))continue;if(a.add(e.id),e.type===`team.task`){let t=[...new Set(e.deps||[])],r=t.map(e=>l.has(e)?ma(l.get(e),n):n?`其他记录中的子任务`:`Task outside this view`),a=ba(e.text);i.push({id:e.id,kind:e.team_role===`idea-review`||e.role===`reviewer`?`review`:e.team_role===`idea-selector`?`plan`:`execution`,title:ma(e,n),summary:ga(e,n,t.some(e=>l.has(e)&&l.get(e).status!==`done`)),detail:[a,e.reason&&!a.includes(e.reason)?e.reason:``,e.pending_question?`${n?`需要答复`:`Needs input`}: ${e.pending_question}`:``,r.length?`${n?`依赖`:`Depends on`}: ${r.join(` · `)}`:``].filter(Boolean).join(` + +`),status:e.pending_question?`question`:e.status||`unknown`,ts:e.ts,source:`team`,eventIds:[e.id],teamId:e.team_id,teamTaskId:e.team_task_id,teamRole:e.team_role,...e.team_outcome?{teamOutcome:e.team_outcome}:{},deps:t,updatedAt:e.updated_ts,revision:e.revision});continue}if(e.type===`work.segment`){i.push({...ka(e,n),episode:o});continue}if(e.type===`turn.replied`){let t=ba(e.text);i.push({id:e.id,kind:`result`,title:n?`Argus 的回答`:`What Argus answered`,summary:va(t)||void 0,detail:t||_a(n),status:e.status||`done`,ts:e.ts,source:`event`,eventIds:[e.id]});continue}e.type===`life.mission.started`&&(o++,s=void 0),e.type===`round.review.completed`&&(s=e);let t=e.type.includes(`review`)||e.type===`life.phase.started`&&e.role===`reviewer`?`review`:e.type===`life.planner.task_added`?`plan`:e.type===`life.mission.completed`||e.type===`life.mission.failed`?`result`:e.type===`round.start`||e.type===`round.main.completed`||e.type===`life.mission.started`||e.type===`life.phase.started`?`execution`:null;if(!t)continue;let r=e.round_index,c=e.type.endsWith(`.completed`)||e.type.endsWith(`.failed`),u=t===`review`&&e.review_skipped===!0,d=e.backend_unavailable===!0||t===`result`&&s?.backend_unavailable===!0,f=d?``:aa(e,n),p=(d?`review_unavailable`:u?`skipped`:e.status===`error`?`failed`:e.status)||(e.success===!1||e.type.endsWith(`.failed`)?`failed`:e.success===!0?`done`:c||e.type===`life.planner.task_added`||e.type===`life.mission.started`?`recorded`:`started`),m=da(e.text||``,n),h=String(e.text||``),g=m.receipt?h.lastIndexOf(m.receipt):-1,_=ba(g>=0?h.slice(0,g):h),v=p===`done`?n?`审阅通过`:`Review passed`:p===`continue`?n?`审阅:要求再改一轮`:`Review: another pass asked for`:[`blocked`,`replan`,`replan_requested`].includes(p)?n?`审阅:建议调整方向`:`Review: a change of course asked for`:p===`failed`?n?`审阅未通过`:`Review not passed`:``,y=m.kind===`interrupt`,b=t===`execution`&&!m.summary?ya(_):``,x=d?n?`当次审查异常`:`Review error on this attempt`:y?n?`这一轮没做完就被停下`:`Stopped before the round could finish`:u?n?`本轮未审阅`:`No review this round`:t===`review`?c?v||(n?`审阅意见`:`Review`):n?`开始审阅`:`Review started`:t===`result`?f?n?`本次执行已结束`:`This execution ended`:p===`paused_external_work`?n?`等待后台团队`:`Waiting for the background team`:n?`执行结果`:`Result of the work`:t===`plan`?n?`列入计划`:`Taken into the plan`:b||(m.kind===`round`?n?`新一轮开始`:`A new round began`:e.type===`life.mission.started`?n?`开始执行`:`Work started`:e.type===`round.main.completed`?n?`本轮执行记录`:`This round's work`:n?`一次执行尝试`:`An attempt at the work`),S=da(e.next_action||``,n),C=_||m.summary?``:xa(e,p,n);i.push({id:e.id,kind:t,title:x,summary:d?n?`审查器未能给出判断,不是审阅否决。`:`The Reviewer could not return a judgment; this was not a rejection.`:f||m.summary||va(_)||C||void 0,detail:[f,_||m.summary||(f?``:C||_a(n)),f&&e.stage_certification===`intentionally_skipped`?n?`本阶段认证被有意跳过;这不代表最终验收通过。`:`Stage certification was intentionally skipped; this is not final acceptance.`:``,u&&e.next_action&&!S.summary?`${n?`接下来`:`What happens next`}: ${e.next_action}`:``,m.receipt?`${n?`——技术记录:`:`— technical record: `}${m.receipt.replace(la,``)}`:``].filter(Boolean).join(` + +`),status:f&&p===`done`?`recorded`:p,completionScope:f||void 0,closed:c,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]}),!u&&!y&&e.next_action&&[`continue`,`blocked`,`replan`,`replan_requested`].includes(e.status||``)&&i.push({id:`${e.id}:next`,kind:`revision`,title:n?`建议的修改`:`Changes asked for`,detail:S.summary||e.next_action,status:`requested`,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]})}e.turn_kind===`qa`&&!i.some(e=>e.kind===`result`)&&i.push({id:`${e.id}:answer`,kind:`result`,title:Si.has(e.status)?n?`正在回答`:`Answering`:n?`回答状态`:`Answer status`,detail:e.summary||(e.status===`cancelled`?n?`本次回答已中断。`:`This answer was interrupted.`:``),status:e.status,source:`task`,eventIds:[]}),e.turn_kind!==`qa`&&!i.some(e=>e.kind===`execution`)&&Si.has(e.status)&&i.push({id:`${e.id}:active`,kind:`execution`,title:n?`正在进行的工作`:`Work under way`,detail:e.summary||``,status:e.status,source:`task`,eventIds:[]}),!i.some(e=>e.kind===`result`)&&[`done`,`failed`,`aborted`,`cancelled`,`skipped`,`superseded`].includes(e.status)&&i.push({id:`${e.id}:outcome`,kind:`result`,title:n?`任务的最终状态`:`Where this task ended up`,detail:e.summary||Pa(e.status,n),status:e.status,source:`task`,eventIds:[]});let u=[],d=new Map,f=new Map,p=(e,t)=>{let n=e.work??={steps:[],overflow:0,narrations:[],note:``,title:``,single:!1};n.steps.push(...t.work.steps),n.overflow+=t.work.overflow,n.narrations.push(...t.work.narrations.filter(e=>!n.narrations.includes(e))),n.note||=t.work.note,e.eventIds.push(...t.eventIds),t.source===`interval`&&(e.source=`interval`)};for(let e of i){if(e.segment){let t=f.get(e.kind),r=u[u.length-1],i=t&&t.episode===e.episode?t:r?.segment&&r.kind===e.kind?r:void 0;i?(p(i,e),i.segment&&Ma(i,n)):u.push({...e,eventIds:[...e.eventIds]});continue}let t=e.round!=null&&[`execution`,`review`].includes(e.kind),r=`${e.episode}:${e.round}:${e.kind}`,i=t?d.get(r):void 0;if(i)i.title=e.title,i.summary=e.summary??i.summary,i.detail=e.detail,i.status=e.status,i.closed=i.closed||e.closed,i.eventIds.push(...e.eventIds),e.source===`interval`&&(i.source=`interval`);else{let n={...e,eventIds:[...e.eventIds]};u.push(n),t&&(d.set(r,n),f.set(n.kind,n))}}return u.map(e=>{let{work:t,segment:r,closed:i,...a}=Na(e,n);return a})}function Ia(e,t,n=!0){let r=e.filter(e=>e.source===`team`),i=r.filter(e=>e.teamOutcome?.kind===`route`),a=r.find(e=>e.teamOutcome?.kind===`selection`)?.teamOutcome,o=i.find(e=>e.teamOutcome?.selected),s=[],c=e=>e.join(t?`、`:`, `);if(o||a?.selected_route){let e=Fi(o?.teamTaskId)||Fi(a?.selected_route),n=o?.teamOutcome?.title||a?.selected_title;s.push(t?`已选定研究路线 ${e}${n?`(${n})`:``}`:`route ${e} chosen${n?` (${n})`:``}`);let r=i.filter(e=>e.teamOutcome?.verdict===`rejected`&&!e.teamOutcome.selected).map(e=>Fi(e.teamTaskId)).filter(Boolean);r.length&&s.push(t?`路线 ${c(r)} 被驳回`:`route${r.length>1?`s`:``} ${c(r)} rejected`)}else if(i.some(e=>e.teamOutcome?.verdict)){let e=i.filter(e=>e.teamOutcome?.verdict===`qualified`).length,n=i.filter(e=>e.teamOutcome?.verdict===`rejected`).length;s.push(t?`复核结果:${e} 条路线通过、${n} 条驳回,等待选择`:`reviews so far: ${e} route${e===1?``:`s`} qualified, ${n} rejected; selection pending`)}let l=[...e].reverse().find(e=>e.source!==`team`&&e.kind===`review`&&[`done`,`continue`,`blocked`,`replan`,`replan_requested`,`failed`].includes(e.status));l&&s.push(l.status===`done`?t?`复核通过`:`review passed`:l.status===`continue`?t?`复核要求再改一轮`:`the review asked for another pass`:l.status===`failed`?t?`复核未通过`:`review not passed`:t?`复核建议调整方向`:`the review asked for a change of course`);let u=n?[...e].reverse().find(e=>e.source!==`team`&&e.kind===`execution`&&e.round!=null&&e.status===`started`):void 0;return u&&s.push(t?`第 ${u.round} 轮进行中`:`round ${u.round} under way`),s.length?(t?`当前结论:`:`So far: `)+s.join(t?`;`:`; `):``}var La=480;function Ra(e,t,n,r=Fa(e,t,n),i=0,a=!1){let o=a&&r.length>0,s=o?La:640,c=o?r.length:1,l=1/0;for(let e=1;!o&&e<=Math.min(3,r.length);e++){let t=Math.ceil(r.length/e),n=Math.max(640,t*232+(t-1)*108+96),i=408+(e-1)*236,a=Math.abs(Math.log(n/i/1.6))+.6*(t*e-r.length)/(t*e);a{let a=t*c,o=Math.min(a+c,r.length),s=m+t*340,l=r.slice(a,o);l.forEach((e,t)=>{h[e.id]={x:s,y:f+t*236}});let d=i+a+1,p=i+o,v=d===p?n?`环节 ${d}`:`Step ${d}`:n?`环节 ${d}–${p}`:`Steps ${d}–${p}`,y=Ba(g.slice(a,o)),b=Va(l,y,_,t===0&&i===0,t===u-1,n,v);return _=y,{id:`steps:${i+a}`,title:b,x:s,y:f-38}});return{steps:r,links:Ua(r,n),columns:v,positions:h,width:d,height:p,...o?{stacked:o}:{}}}function za(e){let t;return e.map(e=>{if(typeof e.round==`number`)return t=e.round;if(e.kind!==`result`&&e.kind!==`plan`)return t})}function Ba(e){return[...new Set(e.filter(e=>typeof e==`number`))].sort((e,t)=>e-t)}function Va(e,t,n,r,i,a,o){if(!t.length)return r&&i&&e.length>1&&e[0].kind===`plan`&&e[e.length-1].kind===`result`?a?`起点 → 结果`:`Setting out → Outcome`:r&&e.some(e=>e.kind===`plan`)?a?`起点`:`Setting out`:i&&e.some(e=>e.kind===`result`)?a?`结果`:`Outcome`:o;let s=t[0],c=t[t.length-1],l=t.length===1&&n.length>0&&n[n.length-1]===s,u=s===c?a?`第 ${s} 轮`:`Round ${s}`:a?`第 ${s}–${c} 轮`:`Rounds ${s}–${c}`;return l&&(u=e[0].kind===`review`?a?`${u} · 审阅`:`${u} · review`:a?`${u} · 续`:`${u} · cont.`),r&&e[0].kind===`plan`&&(u=a?`起点 · ${u}`:`Setting out · ${u}`),i&&e[e.length-1].kind===`result`&&(u=a?`${u} · 结果`:`${u} · Outcome`),u}function Ha(e){let t=e.stacked?900/e.width:Math.max(600/e.height,Math.min(1e3/e.height,fa.width/e.width));return{width:e.width*t,height:e.height*t,scale:t}}function Ua(e,t){let n=e.filter(e=>e.source===`team`);if(n.length){let r=e.filter(e=>e.source!==`team`),i=new Map(n.map(e=>[e.id,e])),a=r.find(e=>e.source===`task`&&e.kind===`plan`),o=[];for(let e of n){for(let n of e.deps||[]){let r=i.get(n);!r||r.id===e.id||r.teamId!==e.teamId||o.push({id:`link:${r.id}:${e.id}`,source:r.id,target:e.id,relation:`dependency`,label:t?`前置任务`:`Depends on`,explanation:t?`${e.title} 的任务记录明确依赖 ${r.title}。`:`${e.title} explicitly depends on ${r.title} in its taskboard.`,contextual:!1})}a&&!e.deps?.length&&o.push({id:`link:${a.id}:${e.id}`,source:a.id,target:e.id,relation:`assignment`,label:t?`任务分支`:`Branch`,explanation:t?`该子任务属于当前主任务;此线不表示等待主任务完成。`:`This worker belongs to the current mission; the link does not require the parent to finish first.`,contextual:!0})}return[...Ua(r,t),...o]}return e.slice(1).map((n,r)=>{let i=e[r],a=i.episode===n.episode,o=a&&i.round!=null&&i.round===n.round,s=`record_order`,c=t?`接着`:`then`,l=t?`同一任务的相邻观察,未确认直接因果或执行依赖。`:`Adjacent observations of the same task; no causal dependency is asserted.`;i.kind===`plan`&&[`plan`,`execution`].includes(n.kind)?(s=`assignment`,c=t?n.kind===`plan`?`纳入计划`:`执行此任务`:n.kind===`plan`?`planned`:`carried out`,l=t?`同一任务的目标/计划与其执行记录关联。`:`The task brief or plan is linked to execution of that same task.`):i.kind===`execution`&&n.kind===`review`&&o?(s=`review`,c=t?`提交审阅`:`sent for review`,l=t?`同一个任务、同一执行段、同一轮次的执行与审查记录。`:`Execution and review belong to the same task, episode and numbered round.`):i.kind===`review`&&n.kind===`revision`&&n.eventIds.some(e=>i.eventIds.includes(e))?(s=`revision`,c=t?`提出修改`:`asked to change`,l=t?`这条修订建议来自对应的审查记录。`:`This revision was requested in the corresponding review.`):i.kind===`revision`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`修订建议之后出现了同一任务的下一轮执行;不表示建议的全部内容已被采纳。`:`A later round follows the revision request; this does not certify every requested change was applied.`):i.kind===`review`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`审阅之后出现了同一任务的下一轮执行。`:`A later round of the same task follows the review.`):i.kind===`execution`&&n.kind===`execution`&&i.round==null&&n.round!=null?(c=t?`进入第 ${n.round} 轮`:`round ${n.round} begins`,l=t?`任务开始执行后记录的一轮工作。`:`A round of work recorded after the task was taken up.`):i.kind===`result`&&n.kind===`execution`?(c=t?`再次开始`:`taken up again`,l=t?`上一次执行结束之后,这项任务又被接手。`:`The task was taken up again after an earlier execution ended.`):n.kind===`result`&&n.source===`task`?(s=`snapshot`,c=t?`最终状态`:`ended as`,l=t?`任务状态记录;部分执行过程可能缺失。`:`Links to the captured state of this task; intermediate records may be missing.`):n.kind===`result`&&[`review`,`execution`,`revision`].includes(i.kind)&&(s=`outcome`,c=t?`形成结果`:`led to`,l=t?`同一任务的后续完成/失败事件,不等同于成功认证。`:`A completion or failure event of this task, not a certification of success.`);let u=[`record_order`,`snapshot`].includes(s)||i.source===`interval`||n.source===`interval`;return(i.source===`interval`||n.source===`interval`)&&(l+=t?` 部分旧记录按唯一活动任务区间归属,因此使用虚线。`:` Some legacy observations are associated by the sole active mission window, so this link is dashed.`),{id:`link:${i.id}:${n.id}`,source:i.id,target:n.id,relation:s,label:c,explanation:l,contextual:u}})}function Wa(e){let t=[],n=[];for(let r=0;r12&&(t.push(n),n=[]),n.push(...i)}return n.length&&t.push(n),t}function Ga(e,t,n,r){for(let i of[n,r]){let n={x:(i.x-t.x)/t.zoom,y:(i.y-t.y)/t.zoom},r=e.find(e=>!e.hidden&&n.x>=e.position.x&&n.x<=e.position.x+(e.width??1152)&&n.y>=e.position.y&&n.y<=e.position.y+(e.height??824));if(r)return r.id}return null}function Ka(e,t,n,r,i=Ji(e,[],n),a,o=!1){let s=[],c={},l=[],u=new Map;for(let[r,i]of e.tasks.entries()){let e=Fa(i,t,n),a=i.status===`done`?aa(Ci(i,t),n):``,d=i.kind===`turn`?``:Ia(e,n,Si.has(i.status)),f=Wa(e),p=f.length,m=e=>e===1?i.id:JSON.stringify([`part`,i.id,e]),h=0;for(let u=1;u<=p;u++){let g=f[u-1],_=m(u);if(s.push({id:_,task:i,ordinal:r+1,part:u,partCount:p,start:h+1,end:h+g.length,totalSteps:e.length,previousId:u>1?m(u-1):void 0,nextId:u1){let t=Ua([e[h-1],g[0]],n)[0];l.push({id:JSON.stringify([`continuation`,i.id,u]),source:m(u-1),target:_,kind:`continuation`,label:t?n?`继续`:`Continued`:n?`更多分支`:`More branches`,evidence:t?`${i.title} · ${t.label} · ${e[h-1].title} → ${g[0].title}`:`${i.title} · ${n?`同一任务的其他分支,不表示串行依赖。`:`Other branches of the same mission, without a serial dependency.`}`})}h+=g.length}u.set(i.id,m(p))}let d=s.slice(),f=new Map;if(a){s.length=0;for(let e of d){let t=a.has(e.task.id);if(f.set(e.id,t?e.id:e.task.id),!t&&e.part!==e.partCount)continue;let n=t?e.id:e.task.id;c[n]=c[e.id],s.push({...e,id:n,historyCount:e.partCount-1,historyExpanded:t})}}let p=e=>f.get(e)??e,m=Object.fromEntries(s.map(({id:e})=>[e,Ha(c[e])])),h=[...i.map(e=>({...e,source:p(u.get(e.source)),target:p(e.target)})),...l.filter(e=>p(e.source)!==p(e.target))],g=s.map(e=>e.id),_=JSON.stringify([g.map(e=>[e,m[e].width,m[e].height]),h.map(e=>[e.source,e.target,e.kind])]);return{cards:s,allCards:d,links:h,layouts:c,positions:r?.structure===_?r.positions:na(g,h,m),frames:m,structure:_}}function qa(e,t,n){if(e.pending_question)return e.pending_question;let r=t.filter(t=>t.item_id===e.id&&(t.status===`failed`||t.success===!1||t.type.endsWith(`.failed`))).sort((e,t)=>t.ts-e.ts)[0],i=(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``),a=r?.reason||r?.text||i,o=da(a,n),s=o.receipt?a.lastIndexOf(o.receipt):-1,c=ba(s>=0?a.slice(0,s):a);return o.summary||c||(n?`这项任务没有完成,记录里没有写明原因。`:`This task did not finish, and the record does not say why.`)}function Ja(e){return(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``).trim()}function Ya(e,t,n,r=``){if(e.pending_question)return{reason:e.pending_question,next:n?`下一步:回答这个问题,团队才会继续。`:`Next: answer this question so the team can continue.`,detail:``,showDetail:!1};if(Ai(e)){let t=Ja(e),i=r.trim();return{reason:i?n?`工作已暂停:${i}`:`Work paused: ${i}`:t?n?`工作已暂停:当前结果还没有满足要求,具体原因见下方说明。`:`Work paused: the current result does not yet meet the requirements. The reason is shown below.`:n?`工作已暂停:当前结果还没有满足要求,记录里没有说明具体原因。`:`Work paused: the current result does not yet meet the requirements. No specific reason was recorded.`,next:n?`工作不会自动继续。请看暂停原因,再在对话里告诉我接下来做什么。`:`Work will not resume on its own. Read the reason, then tell me what to do next in the conversation.`,detail:t,showDetail:!!t&&!i}}let i=qa(e,t,n),a=Ja(e);return{reason:n?`执行失败:${i}`:`Execution failed: ${i}`,next:n?`下一步:查看原因后重试,或在对话里调整任务。`:`Next: check the reason, then retry or adjust the task in the conversation.`,detail:a&&!i.includes(a)?a:``,showDetail:!1}}var Xa=(e,t=80)=>e.length>t?`${e.slice(0,t)}…`:e;function Za(e,t,n,r=()=>``){let i=e.filter(e=>e.turn_kind!==`qa`&&e.kind!==`turn`),a=[...i].sort((e,t)=>(t.ts??0)-(e.ts??0)),o=a[0],s=o?Xa((o.objective||o.title).trim()):n?`还没有任务`:`No task yet`,c=ji(e,t),l=e=>{let t=ki(e);return{held:n?`工作已暂停`:`work paused`,failed:n?`这项工作没有做完`:`this task did not finish`,review_unavailable:n?`结果检查没有完成`:`the result check did not finish`,done:n?`已完成`:`done`,running:n?`进行中`:`running`,pending:n?`待开始`:`planned`,question:n?`等你回答`:`waiting on you`,paused:n?`已暂停`:`paused`}[t]||(n?`还没有新的进展记录`:`No new progress has been recorded`)},u=c?n?`已确认:${Xa(ba(r(c)||c.summary||c.title),160)}`:`Confirmed: ${Xa(ba(r(c)||c.summary||c.title),160)}`:o?ki(o)===`review_unavailable`?n?`这次结果检查没有完成,暂时不能确认结果。`:`The result check did not finish, so the result is not yet confirmed.`:n?`还没有经过检查确认的结果。`:`There is no checked, confirmed result yet.`:n?`还没有结果`:`No result yet`,d=i.find(e=>Si.has(e.status)),f=a.find(e=>[`question`,`held`,`failed`,`review_unavailable`].includes(ki(e))),p=[...i].sort((e,t)=>(e.ts??0)-(t.ts??0)).find(e=>ki(e)===`pending`);return{goal:s,current:d?n?`正在处理:${Xa(d.title,70)}`:`Working on: ${Xa(d.title,70)}`:o?l(o):n?`可以开始新任务`:`Ready for a new task`,conclusion:u,next:d?p?n?`待做任务:${Xa(p.title,70)}`:`Queued next: ${Xa(p.title,70)}`:n?`等当前工作完成,再查看检查结果。`:`Wait for the current work to finish, then check the result.`:f&&f===o?Ya(f,t,n,r(f)).next:p?n?`下一步:${Xa(p.title,60)}`:`Next: ${Xa(p.title,60)}`:c?n?`可以查看结果,或继续提出要求。`:`Read the result, or tell me what to do next.`:n?`还没有后续任务,可在对话里告诉我接下来做什么。`:`Nothing else is scheduled. Tell me what to do next in the conversation.`}}function Qa(e,t,n){let r=e?.model_revision&&e.model_revision!==n,i={...e?.cards};for(let[n,a]of Object.entries(t.cards)){if(r&&i[n]?.model_revision===e.model_revision)continue;let t=i[n];t?.version&&(a.version??0)(t.copy_revision??0)||(a.copy_revision??0)===(t.copy_revision??0)&&(a.generated_at>t.generated_at||a.generated_at===t.generated_at&&!t.input_revision))&&(i[n]=a)}let a=(t.cache_revision??0)<(e?.cache_revision??0);return{...e,...t,cards:i,...e?.version!=null||t.version!=null?{version:Math.max(e?.version??0,t.version??0)}:{},cache_revision:Math.max(t.cache_revision??0,e?.cache_revision??0),relations:(r||a)&&e?e.relations:t.relations,available:t.available??!0,...r?{model_revision:e.model_revision,available:e.available}:{}}}function $a(e,t,n,r){let i=n?.cards[e.key],a=t.tasks.find(t=>t.id===e.task_id);if(!i||!a||(i.version??0)<(n?.version??0)||n?.model_revision&&i.model_revision!==n.model_revision)return!0;let o=[a.id,a.id+`:active`,a.id+`:outcome`].includes(e.key);if(o||!i.task_content_revision||!a.content_revision){if(a.revision&&i.task_revision!==a.revision||o&&i.task_status!==a.status)return!0}else if(i.task_content_revision!==a.content_revision)return!0;let s=i.event_ids||[];return e.event_ids.some(e=>{let n=s.indexOf(e),a=r?r.get(e):t.events.find(t=>t.id===e);return n<0||i.event_revisions&&a?.revision&&i.event_revisions[n]!==a.revision})||!o&&JSON.stringify(e.event_ids)!==JSON.stringify(s)}var eo=e=>`[[Argus引用 ${JSON.stringify(e)}]]\n`;function to(e){let t=[];return{refs:t,text:e.split(` +`).filter(e=>{if(e.startsWith(`[[Argus引用 `)&&e.endsWith(`]]`))try{let n=JSON.parse(e.slice(10,-2));if(typeof n.task_id==`string`&&typeof n.source==`string`&&typeof n.task_title==`string`&&(n.part===void 0||Number.isInteger(n.part)&&n.part>0)&&(n.step_title===void 0||typeof n.step_title==`string`)&&(n.step_id===void 0||typeof n.step_id==`string`)&&(n.team_id===void 0||typeof n.team_id==`string`)&&(n.team_task_id===void 0||typeof n.team_task_id==`string`)&&(n.lang===void 0||typeof n.lang==`string`)&&Array.isArray(n.event_ids)&&n.event_ids.every(e=>typeof e==`string`))return t.push(n),!1}catch{}return!0}).join(` +`).replace(/^\n+/,``)}}function no(e,t,n=1/0){let r=Math.max(-1/0,...e.events.filter(e=>e.item_id===t&&e.type===`life.mission.started`&&e.ts<=n).map(e=>e.ts));return e.events.filter(e=>e.item_id===t&&e.ts>=r&&e.ts<=n&&[`round.main.completed`,`round.review.completed`].includes(e.type)).slice(-2).map(e=>e.id)}function ro(e,t,n){return n.map(n=>({key:n.id,task_id:t.id,kind:n.kind,event_ids:[...new Set([...n.kind===`result`?no(e,t.id,n.ts):[],...n.eventIds])].slice(-16)}))}function io(e,t,n){let r=e.tasks.find(e=>e.id===n),i=(r?[r,...e.tasks.filter(e=>e.id!==n)]:e.tasks).map(t=>({key:t.id,task_id:t.id,kind:`task`,event_ids:[...new Set([...no(e,t.id),...e.events.filter(e=>e.item_id===t.id).slice(-2).map(e=>e.id)])]})),a=r?ro(e,r,t):[];return[...i.slice(0,1),...a,...i.slice(1)]}var ao=new Set([`life.planner.task_added`,`life.mission.started`,`round.main.completed`,`round.review.completed`,`turn.asked`,`turn.replied`]);function oo(e,t,n=ae(),r){return he(`project`,e,t,e,n,r)}function so(e,t){let n=t.mission.started_at??e.backlog.find(e=>e.id===t.mission.id)?.started_ts??0,r=Number.isFinite(n)&&n>=0?n:0;return{mode:`current`,since:r,eventSince:r,taskId:t.mission.id}}function co(e,t){return[`research-brief-map`,e,t.taskId,t.since,t.eventSince]}function lo(e,t,n){if(e.id!==`live:${t}`||!Array.isArray(e.tasks)||!Array.isArray(e.events))throw Error(`The task records do not match this project.`);return{...e,tasks:e.tasks.filter(e=>e.id===n),events:e.events.filter(e=>e.item_id===n)}}function uo(e,t,n=0){if(!e||!t)return[];let r=e.events.filter(e=>e.item_id===t.id&&ao.has(e.type)&&Number.isFinite(e.ts)&&e.ts>=n),i=Math.max(n,...r.filter(e=>e.type===`life.mission.started`).map(e=>e.ts)),a=r.filter(e=>e.ts>=i),o=new Map;for(let e of ao){let t=e.startsWith(`round.`)?2:1;for(let n of a.filter(t=>t.type===e).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id)).slice(-t))o.set(n.id,n)}return[...o.values()].sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id))}function fo(e,t){return{key:e.id,task_id:e.id,kind:`task`,event_ids:t.map(e=>e.id)}}function po(e,t){return e?JSON.stringify({task:{id:e.id,title:e.title,objective:e.objective,status:e.status,summary:e.summary,acceptance_check:e.acceptance_check,goal_contribution:e.goal_contribution,plan_hypothesis:e.plan_hypothesis,non_goals:e.non_goals,outcome:e.outcome,pending_question:e.pending_question,started_ts:e.started_ts,finished_ts:e.finished_ts,attempt:e.attempt},events:t.map(e=>[e.id,e.revision??e])}):``}function mo(e){if(!e||typeof e!=`object`)return!1;let t=e;if(![`why`,`scope`,`next`].every(e=>typeof t[e]==`string`&&t[e].trim()))return!1;if(t.concept===null)return!0;if(!t.concept||typeof t.concept!=`object`)return!1;let n=t.concept;return[`name`,`explanation`,`example`,`connection`].every(e=>typeof n[e]==`string`&&n[e].trim())}function ho(e,t,n,r){return!e||!t?!1:(r?.cards[t.id]?.version??0)<14||!mo(r?.cards[t.id]?.reader_brief)||$a(fo(t,n),e,r,new Map(n.map(e=>[e.id,e])))}function go(e){return!!e&&typeof e.version==`number`&&e.version<14}function _o(e,t,n,r){return eo({source:`live:${e}`,task_id:t.id,task_title:t.title,event_ids:n.map(e=>e.id),lang:r?`zh`:`en`})}function vo(e){try{let t=JSON.parse(e||`null`);return!t||![`full`,`current`,`off`].includes(t.mode)||t.mode===`current`&&![t.since,t.eventSince].every(e=>typeof e==`number`&&Number.isFinite(e)&&e>=0)?null:t}catch{return null}}function yo(e,t){if(!e||e.id!==t.id||t.reset_history)return t;let n=new Map((!t.incremental||t.tasks_complete?[]:e.tasks).map(e=>[e.id,e]));for(let e of t.tasks)n.set(e.id,e);for(let e of t.removed_task_ids||[])n.delete(e);let r=new Map(e.events.filter(e=>t.incremental&&!t.team_events_complete||e.type!==`team.task`).map(e=>[e.id,e]));for(let e of t.events)r.set(e.id,e);for(let e of t.removed_event_ids||[])r.delete(e);return j(e,{...e,...t,tasks:[...n.values()].sort((e,t)=>(e.ts||0)-(t.ts||0)||e.id.localeCompare(t.id)),events:[...r.values()].filter(e=>n.has(e.item_id))})}function bo(e,t,n){return e?t?.history_loading?400:!xo(n)||t?.events.some(e=>e.type===`team.task`&&Si.has(e.status||``))?15e3:!1:!1}function xo(e){return e.manager_requests?.some(e=>e.status===`running`)?!1:!e.daemon.alive||e.continuous?.enabled===!1&&/pause|stop/i.test(e.continuous.done_reason||``)?!0:e.daemon.health?.state===`stopped`}var So=0,Co=(e,t,n=0)=>[`explanation-progress`,...e,t,n];function wo(e,t,n=0){return t?[t.id,`${t.id}:active`,`${t.id}:outcome`].includes(e??``)?typeof t.started_ts==`number`&&Number.isFinite(t.started_ts)&&t.started_ts>=0?t.started_ts:n:0:n}function To(e,t,n){let r=++So,i=n.map(e=>Co(t,e.key,e.startedAt));for(let t of i)e.setQueryData(t,{requestId:r,phase:null});return{update:t=>{for(let n of i)e.setQueryData(n,e=>e?.requestId===r?{requestId:r,phase:t}:e)},finish:()=>{for(let t of i)e.setQueryData(t,e=>e?.requestId===r?null:e)}}}function Eo(e,t,n=0){let r=A({queryKey:Co(e,t??``,n),queryFn:async()=>null,initialData:null,enabled:!1,staleTime:1/0,gcTime:72e5});return{active:!!r.data,phase:r.data?.phase??void 0}}function Do(e,t){return e?{waiting_for_source:[`等待开始整理说明`,`Waiting to prepare the explanation`],planning:[`正在梳理概念与讲解顺序`,`Organizing the concepts and explanation`],writing:[`正在撰写说明`,`Writing the explanation`],reviewing:[`正在核对说明与来源`,`Checking the explanation against its sources`]}[e][+!t]:t?`正在整理说明`:`Preparing an explanation`}var Oo=(e,t)=>[`reader-foundation-choice`,e,t],ko=(e,t)=>`argus:reader-foundation:${e}:${t}`,Ao=e=>[`artifacts`,e,`reader`],jo=(e,t)=>[`reader-foundation-request`,e,t],Mo=(e,t)=>`${ko(e,t)}:request`;function No(e,t){let n=kt(ko(e,t));if(!n)return{id:null,choice:0};try{let e=JSON.parse(n);if((typeof e?.id==`string`||e?.id===null)&&Number.isSafeInteger(e.choice)&&e.choice>=0)return e}catch{}return{id:n,choice:0}}function Po(e,t){try{let n=JSON.parse(kt(Mo(e,t))||`null`);return typeof n?.id==`string`&&typeof n.draft?.question==`string`&&typeof n.beforeChoice==`number`?n:null}catch{return null}}function Fo(e,t,n,r){e.setQueryData(jo(t,n),r),Ot(Mo(t,n),JSON.stringify(r))}function Io(e,t,n,r){let i=e.getQueryData(jo(t,n)),a=Po(t,n);i?.id===r&&(!a||a.id===r)&&Fo(e,t,n,null)}function Lo(e,t){return A({queryKey:jo(e,t),queryFn:k,enabled:!1,initialData:()=>Po(e,t),staleTime:1/0,gcTime:1/0}).data??null}function Ro(e,t,n,r){let i={id:r,choice:zo(e,t,n).choice+1};return e.setQueryData(Oo(t,n),i),Ot(ko(t,n),JSON.stringify(i)),i}function zo(e,t,n){let r=e.getQueryData(Oo(t,n)),i=No(t,n);return r&&r.choice>=i.choice?r:i}function Bo(e,t){return A({queryKey:Oo(e,t),queryFn:k,enabled:!1,initialData:()=>No(e,t),staleTime:1/0,gcTime:1/0}).data}function Vo(e,t=ae()===`question-foundation`){return A({queryKey:Ao(e),queryFn:async({signal:t})=>(await R.artifacts(e,t,!0)).filter(e=>e.source===`reader_foundation`),enabled:!!e&&t,refetchInterval:e=>e.state.data?.some(e=>e.reader_foundation?.state===`generating`)?5e3:!1,retry:!1,refetchOnWindowFocus:!1})}function Ho({sid:e,snapshot:t,view:n,active:r,readOnly:i=!1,allowGeneration:a=!0,locale:o,preview:s=ae(),foundationId:c}){let l=M(),u=n.mission.id,d=so(t,n),f=co(e,d),p=Bo(e,o),m=s===`question-foundation`?c===void 0?p.id:c:null,h=s===`question-foundation`&&!m,g=oo(e,o,s,m),_=r&&!!e&&!!u&&t.session.id===e,v=A({queryKey:f,queryFn:async({signal:t})=>{let n=l.getQueryData(f),r=lo(await R.liveMap(e,t,n?.cursor,d),e,u);return yo(l.getQueryData(f),r)},enabled:_,refetchInterval:_?15e3:!1,staleTime:1e4,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),y=A({queryKey:g,queryFn:async({signal:t})=>{let n=s===`question-foundation`?await R.mapCopy(`project`,e,o,t,e,s,m):await R.mapCopy(`project`,e,o,t,e,s),r=l.getQueryData(g);return Qa(r,n,r?.model_revision)},enabled:_,staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),b=v.data?.tasks.find(e=>e.id===u),x=wo(u,b,d.eventSince),S=Eo(g,u,x),C=(0,G.useMemo)(()=>uo(v.data,b,d.eventSince),[v.data,b,d.eventSince]),w=po(b,C),T=u?y.data?.cards[u]:void 0,E=(T?.version??0)>=14&&mo(T?.reader_brief)?T.reader_brief:void 0,D=ho(v.data,b,C,y.data),O=go(y.data),k=_&&a&&!i&&!h&&!!b&&y.data?.available===!0&&!O&&!v.isError&&!y.isError,j=[`research-brief-generation`,e,u,o,d.eventSince,s,...s===`question-foundation`?[m]:[]],N=Math.max(14,y.data?.version??0),P=[...j,N,y.data?.model_revision??null,w],F=ee({queryKey:j}),te=l.getQueryState(P)?.status===`error`,ne=A({queryKey:P,queryFn:async()=>{if(!b)throw Error(`The current task is not recorded yet.`);let t=l.getQueryData(g)?.model_revision,n=To(l,g,[{key:b.id,startedAt:x}]),r;try{r=await R.generateMapCopy(`project`,e,{cards:[fo(b,C)],locale:o,...m?{foundation_id:m}:{}},void 0,e,s,n.update)}finally{n.finish()}let i=r.cards?.[b.id],a={available:(i?.version??0)>=14&&mo(i?.reader_brief)&&!r.retry_after&&r.available!==!1&&(i?.version??0)>=N&&!!v.data&&!$a(fo(b,C),v.data,r,new Map(C.map(e=>[e.id,e]))),retryAfter:r.retry_after??null,inputSignature:w};return l.setQueryData(g,e=>Qa(e,r,t)),a},enabled:k&&D&&!te&&F===0,staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),re=ne.data?.retryAfter;return(0,G.useEffect)(()=>{if(!k||!D||ne.isFetching||ne.isError||ne.data?.available!==!1||typeof re!=`number`||!Number.isFinite(re)||re<=0)return;let e=setTimeout(()=>{ne.refetch({cancelRefetch:!1})},Math.max(0,ne.dataUpdatedAt+re*1e3-Date.now()));return()=>clearTimeout(e)},[k,D,ne.isFetching,ne.isError,ne.data?.available,ne.dataUpdatedAt,re,ne.refetch]),{foundationId:m,foundationRequired:h,questionContext:{locale:o===`zh-CN`?`zh-CN`:`en-US`,preview:s,foundationId:m},task:b,evidence:C,loadedEvents:v.data?.events,card:T,brief:E,inputSignature:w,needsUpdate:D&&ne.data?.available!==!0,legacy:O,loading:_&&(v.isPending||y.isPending),generating:S.active||ne.isFetching||F>0,generationPhase:S.phase,readError:v.error||y.error,generationError:D&&!S.active?ne.error:null,generationUnavailable:ne.data?.available===!1&&D&&!S.active,generationAvailable:y.data?.available===!0,teachingUnavailable:!!E&&T?.teaching_review?.status===`unavailable`,readingUnavailable:!!E&&T?.teaching_review?.reading_review?.status===`unavailable`,retry:async()=>{_&&(v.isError||y.isError||!y.data?.available||O||!b?await Promise.allSettled([v.refetch(),y.refetch()]):k&&await ne.refetch())}}}function Uo(e){let t=new Set;return[e.primary_target,...e.targets].filter(e=>!e?.path||t.has(e.path)?!1:(t.add(e.path),!0))}function Wo(e,t){if(t===`research`)for(let t of e){let e=Uo(t).find(e=>/(?:^|\/)paper\/main\.pdf$/i.test(e.path.replace(/\\/g,`/`)));if(e)return{receipt:t,path:e.path}}let n=e[0];return n?{receipt:n,path:Uo(n)[0]?.path||null}:null}function Go(e){return e.replace(/\s*\bRESULT\s*=\s*/g,` + +`).replace(/\s*\b(?:STATUS|REVIEW_STATUS)\s*=\s*\S+/g,``).trim()}function Ko(e,t,n){let r=n.reduce((e,t)=>t.type===`ui.operator`?Math.max(e,Number(t.ts)||0):e,0),i=t&&(e===void 0||t.delivered_at>r)?t:null;return e?i&&i.delivered_at>e.delivered_at?i:e:i}function qo(e,t){if(!t)return!1;let n=new Set([t]),r=[t];for(let t=0;te.id!==t&&n.has(e.id)&&[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))}var Jo=new Set([`done`,`passed`,`approved`,`accepted`]);function Yo(e,t){let n=String(e.review_status||``).toLowerCase(),r=String(e.review_source||``).toLowerCase(),i=String(e.residual_risk||``).trim();return Jo.has(n)&&r===`reviewer`&&i?{independent:!0,text:t?`独立复核通过 · 有残余风险`:`Independently reviewed · residual risk`,title:t?`有一项检查在此环境中无法进行,已被接受为残余风险:${i}`:`One check was impossible here and its risk was accepted: ${i}`}:Jo.has(n)&&r===`reviewer`?{independent:!0,text:t?`独立复核通过`:`Independently reviewed`,title:t?`另一个审查角色检查过这份成果`:`A separate reviewer checked this result`}:!n||n===`not_assessed`||Jo.has(n)&&r?{independent:!1,text:t?`实现者自检 · 未独立复核`:`Self-checked · not independently reviewed`,title:t?`只有完成它的人自己检查过,没有另外的审查`:`Only the worker that produced it checked it; no separate review`}:Jo.has(n)?{independent:!1,text:t?`已完成 · 未记录是否独立复核`:`Completed · review source not recorded`,title:t?`这份较早的交付没有记录是谁检查的,不能确认经过独立复核`:`This older delivery did not record who checked it, so independent review cannot be confirmed`}:{independent:!1,text:t?`复核状态:${n}`:`Review: ${n}`,title:t?`独立复核没有通过或已过期`:`Independent review did not pass or is out of date`}}function Xo(e,t,n){if(!n)return null;let r=e.snapshots?.find(e=>e.path===n&&e.stored);if(!r)return null;let i=t.filter(t=>t.delivery_id!==e.delivery_id&&t.delivered_att.delivered_at-e.delivered_at);for(let e of i){let t=e.snapshots?.find(e=>e.path===n);if(!(!t||t.sha256===r.sha256))return t.stored?{path:n,before:t.sha256,after:r.sha256}:null}return null}var Zo=[1,0],Qo=[{id:`up`,vector:[0,1],zh:`向上 1 格`,en:`Up 1 square`},{id:`right`,vector:[2,0],zh:`向右 2 格`,en:`Right 2 squares`},{id:`fraction`,vector:[1.5,0],zh:`向右 1.5 格`,en:`Right 1.5 squares`},{id:`zero`,vector:[0,0],zh:`留在原点`,en:`Stay at the origin`}];function $o(e,t){return e[0]*t[1]-e[1]*t[0]===0?e.some(Boolean)||t.some(Boolean)?1:0:2}function es(e){if(!e)return!1;let t=[e.name,e.explanation,e.example,e.connection].join(` `);return/独立(?:的)?方向|线性(?:无关|独立)|independent\s+directions?\b|linear\s+independence\b|linearly\s+independent\b/iu.test(t)}function ts(){let{locale:e}=z(),t=e===`zh-CN`,n=(e,n)=>t?e:n,[r,i]=(0,G.useState)(Qo[0]),a=(0,G.useId)(),o=r.vector,s=$o(Zo,o),c=e=>62+e*36,l=e=>116-e*36,u=r.id===`up`?n(`只沿 A 左右移动,走不到 B 的终点;B 补上了上下方向。`,`Moving left or right along A cannot reach B’s endpoint. B adds an up-and-down direction.`):r.id===`right`?n(`走两次 A 就能代替 B。步子更长,并没有增加独立方向。`,`Two copies of A replace B. A longer step does not add an independent direction.`):r.id===`fraction`?n(`走两次 B 和走三次 A,都向右走了 3 格。虽然两者互相都不是整数倍,仍只有一个独立方向。`,`Two copies of B and three copies of A both move 3 squares right. Neither is an integer multiple of the other, but they still provide only one independent direction.`):n(`B 没有移动,没有增加方向;A 仍提供一个独立方向。`,`B does not move, so it adds no direction. A still provides one independent direction.`),d=n(`这两支箭头提供 ${s} 个独立方向`,`These two arrows provide ${s} independent direction${s===1?``:`s`}`);return(0,J.jsxs)(`section`,{className:`my-2 rounded-lg border border-line bg-surface p-3`,"aria-label":n(`平面上的独立方向示意`,`Independent directions in a plane`),"data-testid":`direction-example`,children:[(0,J.jsx)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:n(`A 固定向右走 1 格。改变 B,看看它是否提供新的走法。允许把箭头缩放、反向,再相加。`,`A always moves 1 square right. Change B to see whether it adds a new way to move. Arrows may be scaled, reversed, and added.`)}),(0,J.jsxs)(`svg`,{viewBox:`0 0 210 180`,className:`mx-auto my-2 block w-full max-w-[260px]`,role:`img`,"aria-labelledby":`${a}-title ${a}-desc`,children:[(0,J.jsx)(`title`,{id:`${a}-title`,children:d}),(0,J.jsx)(`desc`,{id:`${a}-desc`,children:`A = (1, 0), B = (${o[0]}, ${o[1]}). ${u}`}),(0,J.jsxs)(`defs`,{children:[(0,J.jsx)(`marker`,{id:`${a}-a`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,J.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:B.accent})}),(0,J.jsx)(`marker`,{id:`${a}-b`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,J.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:B.success})})]}),(0,J.jsx)(`rect`,{x:`20`,y:`32`,width:`165`,height:`125`,rx:`4`,fill:B.accent,opacity:s===2?.07:0}),[-1,0,1,2,3].map(e=>(0,J.jsx)(`line`,{x1:c(e),x2:c(e),y1:`32`,y2:`157`,stroke:`rgb(var(--line))`},`x${e}`)),[-1,0,1,2].map(e=>(0,J.jsx)(`line`,{y1:l(e),y2:l(e),x1:`20`,x2:`185`,stroke:`rgb(var(--line))`},`y${e}`)),s===1?(0,J.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:B.accent,strokeWidth:`10`,opacity:`.09`}):null,(0,J.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:B.inkFaint}),(0,J.jsx)(`line`,{x1:c(0),x2:c(0),y1:`32`,y2:`157`,stroke:B.inkFaint}),[0,1,2,3].map(e=>(0,J.jsx)(`text`,{x:c(e)-3,y:l(0)+14,fill:B.inkFaint,fontSize:`9`,children:e},e)),r.id===`zero`?(0,J.jsx)(`circle`,{cx:c(0),cy:l(0),r:`5`,fill:`rgb(var(--surface))`,stroke:B.success,strokeWidth:`3`,"data-testid":`direction-b-zero`}):(0,J.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(o[0]),y2:l(o[1]),stroke:B.success,strokeWidth:`3`,markerEnd:`url(#${a}-b)`,"data-testid":`direction-b`}),(0,J.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(Zo[0]),y2:l(Zo[1]),stroke:B.accent,strokeWidth:`3`,markerEnd:`url(#${a}-a)`}),(0,J.jsx)(`text`,{x:c(Zo[0])+3,y:l(Zo[1])-10,fill:B.accent,fontSize:`12`,fontWeight:`600`,children:`A`}),(0,J.jsx)(`text`,{x:c(o[0])+(r.id===`zero`?-17:8),y:l(o[1])+(r.id===`up`?-3:28),fill:B.success,fontSize:`12`,fontWeight:`600`,children:`B`})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,role:`group`,"aria-label":n(`选择 B 的走法`,`Choose B’s movement`),children:Qo.map(e=>(0,J.jsx)(W,{className:`text-[11px]`,variant:r.id===e.id?`primary`:`ghost`,"aria-pressed":r.id===e.id,onClick:()=>i(e),"data-choice":e.id,children:t?e.zh:e.en},e.id))}),(0,J.jsxs)(`div`,{className:`mt-3`,"aria-live":`polite`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-ink`,"data-testid":`direction-count`,children:d}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:u})]}),(0,J.jsx)(`p`,{className:`mt-3 border-t border-line pt-2 text-[11px] leading-5 text-ink-faint`,children:n(`这里只统计这两支箭头提供的方向。找到一些独立方向,不等于已经找全研究对象的所有方向;图里的数字不能用来计算曲面的 Picard 数,也不能证明研究中的条件。`,`This counts only the directions supplied by these two arrows. Finding some independent directions does not establish that they span the whole research object. These numbers cannot determine a surface’s Picard number or prove the conditions used in the research.`)})]})}function ns({path:e,identity:t,artifacts:n,onOpenArtifact:r}){let{locale:i}=z(),a=i===`zh-CN`,o={artifacts:n,onOpenArtifact:r};return(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-learning-path":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`理解这个问题`:`Understand the question`}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-question":!0,children:(0,J.jsx)(H,{...o,children:e.question})}),(0,J.jsx)(`ol`,{className:`mt-4 grid list-none gap-5 p-0`,children:e.steps.map((e,n)=>(0,J.jsxs)(`li`,{className:`min-w-0 border-t border-line/50 pt-3`,"data-learning-step":n+1,children:[(0,J.jsxs)(`h4`,{className:`mb-2 text-sm font-medium text-ink`,children:[(0,J.jsxs)(`span`,{className:`mr-2 text-ink-faint`,children:[n+1,`.`]}),e.title]}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-explanation":!0,children:(0,J.jsx)(H,{...o,children:e.explanation})}),(0,J.jsxs)(`div`,{className:`mt-3 border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-learning-example":!0,children:[(0,J.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`例子`:`Example`}),(0,J.jsx)(H,{...o,children:e.example})]}),(0,J.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,"data-learning-check":!0,children:[(0,J.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`小问题`:`Try it`}),(0,J.jsx)(`div`,{"data-learning-check-question":!0,children:(0,J.jsx)(H,{...o,children:e.check.question})}),(0,J.jsx)(ft,{label:a?`点击看解答`:`Show the answer`,children:(0,J.jsx)(`div`,{"data-learning-check-answer":!0,children:(0,J.jsx)(H,{...o,children:e.check.answer})})},`${e.check.question}:${e.check.answer}`)]})]},`${t}:${n}`))})]})}function rs({value:e,expandLabel:t,clamp:n=!0}){let[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),s=(0,G.useRef)(null),{locale:c}=z();return(0,G.useEffect)(()=>{let e=s.current;if(!e||!n||r)return;let t=()=>o(e.scrollHeight>e.clientHeight+1);t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,n,r]),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{ref:s,className:`text-[13px] leading-6 text-ink-dim ${!n||r?``:`line-clamp-3`}`,children:(0,J.jsx)(H,{children:e})}),n&&(a||r)?(0,J.jsxs)(`button`,{type:`button`,className:`mt-0.5 text-xs text-blue-sky hover:underline`,onClick:()=>i(!r),"aria-expanded":r,children:[r?c===`zh-CN`?`收起`:`Show less`:t,(0,J.jsx)(Ue,{size:11,className:`ml-1 inline ${r?`rotate-180`:``}`})]}):null]})}function is({generatedAt:e,pending:t=!1,generating:n=!1,phase:r,hasExplanation:i=!1,error:a,unavailable:o=!1,retry:s,retryDisabled:c=!1}){let{locale:l}=z(),u=l===`zh-CN`,d=Tt({ts:e}),f=d?.toLocaleString(l,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,p=!!a||o;return!(i&&(f||t))&&!n&&!p?null:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,"data-testid":`research-brief-status`,children:[i&&(f||t)?(0,J.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,children:[t?`${u?`上次说明`:`Previous explanation`}${f||!p?` · `:``}`:``,f?(0,J.jsx)(`time`,{dateTime:d?.toISOString(),title:d?.toLocaleString(l),children:f}):null,t&&!p?`${f?` · `:``}${u?`待更新`:`update pending`}`:``]}):null,p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:a?u?`说明生成未完成;不会自动重复请求。`:`The explanation could not be prepared. This request will not be repeated automatically.`:u?`说明暂未更新;可以手动重试。`:`The explanation has not been updated yet. You can retry manually.`}),s?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:n||c,onClick:()=>void s(),children:[(0,J.jsx)(Ke,{size:12}),u?`重试`:`Retry`]}):null]}):n?(0,J.jsxs)(`span`,{role:`status`,"data-explanation-phase":r??`pending`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint`,children:[(0,J.jsx)(tt,{}),Do(r,u)]}):null]})}function as({brief:e,identity:t,detail:n,learningPath:r,foundation:i,readingUnavailable:a=!1,teachingUnavailable:o=!1,artifacts:s,onOpenArtifact:c}){let{locale:l}=z(),u=l===`zh-CN`,d=(e,t)=>u?e:t;return(0,J.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-4`,"data-reader-explanation":t,children:[i?(0,J.jsxs)(`div`,{className:`rounded border border-line/60 p-2 text-xs text-ink-dim`,"data-foundation-id":i.id,children:[(0,J.jsxs)(`p`,{children:[d(`这次进展参考的基础说明:`,`Foundations used to explain this progress: `),i.question]}),c?(0,J.jsx)(W,{className:`mt-1 text-xs`,onClick:()=>c(i.path),children:d(`阅读这份基础说明`,`Read these foundations`)}):null]}):null,a?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`阅读说明还需要核对,可以继续问这一步。`,`The reading explanation still needs checking. You can keep asking about this step.`)}):o?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`这个概念的说明还没核对清楚,可以继续问这一步。`,`The explanation of this concept has not been checked clearly yet. You can keep asking about this step.`)}):null,r?(0,J.jsx)(ns,{path:r,identity:t,artifacts:s,onOpenArtifact:c},t):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-why":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`这一步为什么有用`,`Why this step helps`)}),(0,J.jsx)(rs,{value:e.why,expandLabel:d(`完整说明`,`Full explanation`),clamp:!1},`why:${t}`)]}),e.concept?(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-teaching":t,children:[(0,J.jsxs)(`h3`,{className:`mb-3 text-xs font-medium text-ink`,children:[d(`认识一个概念`,`One useful concept`),` · `,e.concept.name]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 gap-3`,"data-reader-teaching-columns":t,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,"data-reader-definition":t,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`定义`,`Definition`)}),(0,J.jsx)(rs,{value:e.concept.explanation,expandLabel:d(`完整定义`,`Full definition`),clamp:!1},`concept:${t}:${e.concept.name}`)]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-testid":`concept-example`,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`例子`,`Example`)}),(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:e.concept.example})]}),es(e.concept)?(0,J.jsx)(ft,{label:d(`动手看两个方向`,`Try two directions`),children:(0,J.jsx)(ts,{})}):null]}),(0,J.jsxs)(`div`,{className:`min-w-0`,"data-reader-connection":t,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`与本步的关系`,`Connection to this step`)}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:e.concept.connection})})]})]})]}):null]}),(0,J.jsxs)(`section`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`结论到哪里为止`,`What this does and does not establish`)}),(0,J.jsx)(rs,{value:e.scope,expandLabel:d(`完整适用范围`,`Full scope`),clamp:!1},`scope:${t}`)]}),(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-next-interpretation":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`解说对后续的理解`,`How the explanation interprets the follow-up`)}),(0,J.jsx)(rs,{value:e.next,expandLabel:d(`完整解读`,`Full interpretation`),clamp:!1},`next:${t}`)]}),n?(0,J.jsx)(ft,{className:`min-w-0`,label:d(`详细说明与条件`,`Detailed explanation and conditions`),children:(0,J.jsx)(`div`,{className:`macro-reader-markdown text-[13px] leading-6 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:n})})},`detail:${t}`):null]})}function os({task:e,artifacts:t,onOpenArtifact:n}){let r=z().locale===`zh-CN`,i=typeof e?.pending_question==`string`?e.pending_question.trim():``;return i?(0,J.jsxs)(`section`,{className:`mt-4 min-w-0 border-t border-line/60 pt-3 text-[13px] leading-6 text-ink-dim`,"data-reader-pending-question":e.id,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:r?`这一步在等你回答`:`This step is waiting for your answer`}),(0,J.jsx)(H,{artifacts:t,onOpenArtifact:n,children:i})]}):null}function ss(e){return e.kind===`markdown`||e.mime?.split(`;`,1)[0].trim().toLowerCase()===`text/markdown`||/\.(?:md|markdown)$/i.test(e.name||e.path||``)}function cs(e){return e.title?.trim()||e.question}var ls=[{label:[`从头讲清楚`,`Explain from the beginning`],question:[`请从头讲清楚这份说明。先用日常语言解释它在讨论什么、要判断什么,再按需要解释其中的对象和符号。涉及比较或公式时,请明确两边是什么、哪些条件下能比较,并用一个可复算的小例子说明。请分别说明标准背景知识、本次已有证据和仍未知的内容。`,`Explain this reading from the beginning using everyday language. Start with what it discusses and what we are trying to determine, then explain the necessary objects and symbols. For a comparison or formula, define both sides and when the comparison is valid, and work a small example I can recompute. Distinguish standard background, evidence from this run, and what remains unknown.`]},{label:[`带我算一遍`,`Work through an example`],question:[`请带我实际算一遍这份说明中的关键一步。先解释对象、输入和运算规则,再用一组明确标为教学例子的小数据展示中间步骤与结果,然后换一个输入让我能照着计算。请说明它怎样关系到正在判断的结论,以及这个例子还不能证明什么。`,`Walk me through the key operation in this reading. Explain the objects, inputs, and rules, then use a small example clearly labeled as a teaching example to show the intermediate steps and result. Change one input and work it again so I can follow the calculation. Explain how it relates to the conclusion being assessed and what the example does not prove.`]},{label:[`这说明了什么`,`What does this establish?`],question:[`这份说明究竟支持什么结论?请用我能懂的语言解释已经验证的部分、依赖的条件、未覆盖的情况,以及它和整个任务目标的关系。解释必要概念,并指出哪些只是记录中的说法、哪些有可核对的依据。`,`What conclusion does this reading support? Explain the part that has been checked, its assumptions, the cases it does not cover, and how it relates to the overall task. Explain the necessary concepts and distinguish reported claims from conclusions with verifiable supporting evidence.`]}];function us({draft:e,onChange:t,onSubmit:n,disabled:r,children:i}){let a=z().locale===`zh-CN`,o=!!e.parentId||!!e.progressSource,s=(0,G.useRef)(null);return(0,J.jsxs)(J.Fragment,{children:[i,o&&!e.question.trim()?(0,J.jsxs)(`div`,{className:`mb-3 space-y-2`,"data-reading-question-suggestions":!0,children:[(0,J.jsx)(`p`,{className:`text-xs text-ink-dim`,children:a?`可以从这些问题开始,也可以直接输入。`:`Start with one of these questions, or write your own.`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ls.map(n=>(0,J.jsx)(W,{type:`button`,className:`text-xs`,disabled:r,onClick:()=>{t({...e,question:n.question[+!a]}),s.current?.focus()},children:n.label[+!a]},n.label[1]))})]}):null,(0,J.jsx)(`textarea`,{ref:s,"aria-label":a?`想理解的问题`:`Question to understand`,className:`min-h-40 w-full rounded-lg border border-line bg-bg p-3 text-sm leading-6 text-ink`,maxLength:8e3,value:e.question,onChange:n=>t({...e,question:n.target.value})}),e.sourceTitle?(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[a?`从这项任务打开:`:`Opened from this task: `,e.sourceTitle]}):null,(0,J.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,J.jsx)(W,{"data-reading-submit":!0,disabled:!e.question.trim()||r,onClick:n,children:o?a?`提问`:`Ask question`:a?`生成并保存基础说明`:`Generate and save foundations`})})]})}function ds(e){if(!e||typeof e!=`object`)return!1;let t=e;return[`source_id`,`title`,`path`,`task_id`,`card_key`].every(e=>typeof t[e]==`string`&&String(t[e]).trim())&&Number.isFinite(t.generated_at)&&t.generated_at>=0&&Number.isSafeInteger(t.copy_revision)&&t.copy_revision>=0}function fs(e){let t=e.reader_foundation;return!!t&&(t.kind??`foundation`)===`foundation`&&!t.parent_id&&!t.progress_source}function ps(e,t,n=!0){let r=M(),i=Vo(e,n),a=Lo(e,t),o=[`reader-foundation-create`,e,t],s=P({filters:{mutationKey:o,status:`pending`},select:e=>e.state.variables?.id}),c=Eo(o,s.at(-1)??a?.id),l=n=>({sid:n.sid??e,locale:n.locale??t}),u=N({mutationKey:o,mutationFn:async e=>{let t=l(e),n=To(r,[`reader-foundation-create`,t.sid,t.locale],[{key:e.id}]);try{let r={request_id:e.id,question:e.draft.question.trim(),locale:t.locale},i=e.draft.parentId?await R.askReaderFoundation(t.sid,e.draft.parentId,r,n.update):await R.generateReaderFoundation(t.sid,{...r,...e.draft.progressSource?{progress_source:{source_id:e.draft.progressSource.source_id}}:e.draft.sourceTaskId?{source_task_id:e.draft.sourceTaskId}:{}},n.update),a=i.reader_foundation;if(a?.id!==e.id||a.locale!==t.locale)throw Error(t.locale===`zh-CN`?`说明请求的结果尚未确认。`:`The result of this explanation request is unconfirmed.`);if(e.draft.parentId&&(a.kind!==`clarification`||a.parent_id!==e.draft.parentId))throw Error(t.locale===`zh-CN`?`追问与来源说明的对应关系尚未确认。`:`The question’s connection to its source is unconfirmed.`);if(e.draft.progressSource&&(a.progress_source?.source_id!==e.draft.progressSource.source_id||!e.draft.parentId&&a.kind!==`progress_answer`))throw Error(t.locale===`zh-CN`?`回答与这版进展说明的对应关系尚未确认。`:`The answer’s connection to this progress explanation is unconfirmed.`);return i}finally{n.finish(),await r.invalidateQueries({queryKey:Ao(t.sid)})}},onSuccess:(e,t)=>{let n=l(t);!t.draft.parentId&&!t.draft.progressSource&&fs(e)&&e.exists&&e.reader_foundation?.state===`complete`&&zo(r,n.sid,n.locale).choice===t.beforeChoice&&Ro(r,n.sid,n.locale,e.reader_foundation.id),r.setQueryData(Ao(n.sid),t=>{let n=t?.find(t=>t.path===e.path);return n&&n.reader_foundation?.state!==`generating`&&e.reader_foundation?.state===`generating`?t:[...(t??[]).filter(t=>t.path!==e.path),e]}),t.draft.progressSource||r.invalidateQueries({queryKey:[`map-copy`,`project`,n.sid]})},onError:(e,t)=>{if(e instanceof se&&e.code===`reader_source_unavailable`){let e=l(t);Fo(r,e.sid,e.locale,{...t,rejected:`reader_source_unavailable`})}},retry:!1}),d=(i.data??[]).filter(e=>e.reader_foundation?.locale===t),f=d.some(e=>e.reader_foundation?.state===`generating`),p=d.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),m=u.variables&&l(u.variables),h=m?.sid===e&&m.locale===t,g=h&&u.isPending||s.length>0||c.active,_=a?.id??(h?u.variables?.id:void 0),v=d.find(e=>e.reader_foundation?.id===_),y=v?.reader_foundation?.state===`failed`,b=v?.reader_foundation?.state===`complete`,x=a?.rejected===`reader_source_unavailable`,S=!!a&&!x&&!v&&!g,C=g||f||!!a&&!x||i.isPending||i.isError;return(0,G.useEffect)(()=>{a&&(y||b)&&Io(r,e,t,a.id)},[r,e,t,a,y,b]),{client:r,list:i,notes:d,pendingRequest:a,progress:c,generation:u,waiting:f,overdue:p,creating:g,requested:v,confirmedFailure:y,confirmedComplete:b,requestRejected:x,unknownResult:S,creationBlocked:C,submit:n=>{if(!n.question.trim()||C)return null;let i=crypto.randomUUID(),a={id:i,sid:e,locale:t,draft:{...n,...n.progressSource?{progressSource:{...n.progressSource}}:{}},beforeChoice:zo(r,e,t).choice};return Fo(r,e,t,a),u.mutate(a),i},retrySavedRequest:n=>u.mutate({...n,sid:n.sid??e,locale:n.locale??t})}}var ms=(0,G.createContext)(null);function hs({card:e,cardKey:t,taskId:n,readOnly:r=!1,context:i}){let a=(0,G.useContext)(ms),o=z().locale===`zh-CN`,[s,c]=(0,G.useState)(`idle`),[l,u]=(0,G.useState)(!1),d=(0,G.useRef)(0),f=i??a?.context,p=JSON.stringify([a?.sid,a?.readOnly,r,f,t,n,e?.copy_revision,e?.generated_at,e?.title]),m=(0,G.useRef)(p);if(m.current=p,(0,G.useEffect)(()=>(c(`idle`),()=>{d.current+=1}),[p]),!a?.sid||a.readOnly||r)return null;let h=!!e&&Number.isSafeInteger(e.copy_revision)&&!!e.title?.trim()&&!(f?.preview===`question-foundation`&&!f.foundationId),g=async()=>{if(!h||!f||s===`opening`)return;let r=++d.current;c(`opening`);try{let i=await a.source(t,n,f);if(r!==d.current||m.current!==p)return;if(i&&(i.copy_revision!==e.copy_revision||i.generated_at!==e.generated_at||i.title!==e.title))throw new se(`The selected explanation has changed.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);c(`idle`),i&&a.open(i)}catch(e){r===d.current&&m.current===p&&(u(e instanceof se&&e.code===`reader_source_unavailable`),c(`failed`))}};return(0,J.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-1`,children:[(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:!h||s===`opening`,title:h?void 0:o?`这一步的说明写好后就可以提问。`:`Questions open once this step has an explanation.`,"data-testid":`progress-question-trigger`,"data-progress-question-card":t,"data-progress-question-state":s,onClick:()=>void g(),children:[(0,J.jsx)(an,{size:12}),o?`问这一步`:`Ask about this step`]}),s===`failed`?(0,J.jsx)(`span`,{role:`alert`,className:`text-xs text-ink-dim`,children:l?o?`这版说明暂不可用或已变化,未打开提问。请刷新页面后再试。`:`This explanation is unavailable or has changed. No question was opened. Reload this page and try again.`:o?`暂时无法读取这一步的提问材料,未打开提问。请再试一次。`:`The question material could not be loaded. No question was opened. Please try again.`}):null]})}function gs(){let e=(0,G.useContext)(ms),t=z().locale===`zh-CN`;return e?.hasHistory?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>e.open(),children:[(0,J.jsx)(K,{size:12}),t?`阅读问答`:`Reading questions`]}):null}function _s({sid:e,path:t,artifacts:n,onOpenArtifact:r}){let i=z().locale===`zh-CN`,a=A({queryKey:[`reading-question-artifact`,e,t],queryFn:async({signal:n})=>{let r=await R.artifact(e,t,n);if(r.exists&&r.path===t&&(r.truncated||typeof r.preview!=`string`)){let i=await R.artifactBlob(e,t,!1,n);return{...r,preview:await i.text(),truncated:!1}}return r},retry:!1,staleTime:1/0,refetchOnWindowFocus:!1});return a.isPending?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:i?`正在读取保存内容…`:`Loading saved reading…`}):a.isError||!a.data?.exists||a.data.path!==t?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[i?`保存内容暂时无法读取。`:`The saved reading could not be loaded.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>void a.refetch(),children:i?`重新读取`:`Reload`})]}):(0,J.jsxs)(`div`,{className:`min-w-0 max-w-full overflow-x-auto break-words`,"data-reading-artifact-path":t,children:[(0,J.jsx)(H,{artifacts:[...n,...a.data.reader_foundation?.sources??[]],onOpenArtifact:r,children:a.data.preview??``}),a.data.truncated?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`此处显示保存内容的节选。`:`This view shows an excerpt of the saved reading.`}):null]})}function vs({sid:e,readOnly:t=!1,children:n}){let r=z().locale,i=r===`zh-CN`?`zh-CN`:`en-US`,a=i===`zh-CN`,o=ps(e??``,i,!!e),s=Bo(e??``,i).id,c=(0,G.useRef)(0),l=async(t,n,r)=>{let i=++c.current,{preview:a,foundationId:o,locale:s}=r,l=await R.mapQuestionSource(e??``,{card_key:t,task_id:n,locale:s,...a?{preview:a}:{},...a===`question-foundation`&&o?{foundation_id:o}:{}});if(i!==c.current)return null;if(!ds(l)||l.card_key!==t||l.task_id!==n||!l.path.startsWith(`reader-progress/${e}/`))throw new se(`The reading source does not match this step.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);return l},[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(null);(0,G.useEffect)(()=>(d(null),p(null),h(null),_(!1),y(null),()=>{c.current+=1}),[e,i]);let b=u&&u.sid===e&&u.locale===i?u:null,x=b?.source,S=o.notes.filter(e=>ds(e.reader_foundation?.progress_source)),C=o.pendingRequest?.draft.progressSource?o.pendingRequest:null,w=new Map;for(let t of S){let n=t.reader_foundation.progress_source;n.path.startsWith(`reader-progress/${e}/`)&&w.set(n.source_id,n)}C?.draft.progressSource&&w.set(C.draft.progressSource.source_id,C.draft.progressSource),x&&w.set(x.source_id,x);let T=[...o.list.data??[],...[...w.values()].map(e=>({path:e.path}))],E=e=>{e===x?.path?(_(!0),y(null)):y(e)},D=x?S.filter(e=>e.reader_foundation.progress_source.source_id===x.source_id):[],O=D.find(e=>e.reader_foundation?.id===m),k=O?.exists&&O.reader_foundation?.state===`complete`,A=C?.draft.progressSource?.source_id===x?.source_id?C:null,j=A?D.find(e=>e.reader_foundation?.id===A.id):void 0,M=!!A&&A.rejected===`reader_source_unavailable`,ee=!!A&&!M&&!j&&!o.creating,N=n=>{c.current+=1;let r=n??C?.draft.progressSource??[...w.values()].at(-1);if(!e||!ds(r)||!r.path.startsWith(`reader-progress/${e}/`))return;d({sid:e,locale:i,source:{...r}}),_(!1),y(null);let a=S.filter(e=>e.reader_foundation?.progress_source?.source_id===r.source_id).at(-1);h(a?.reader_foundation?.id??null),p(n&&!t?{question:``,progressSource:{...r}}:null)},P=()=>{d(null),p(null),h(null),_(!1),y(null)},F=t=>{e&&(d({sid:e,locale:i,source:{...t}}),h(null),_(!1),y(null),p(e=>e?{question:e.question,progressSource:{...t}}:null))},te=()=>{if(t||!b||!f?.progressSource||f.progressSource.source_id!==b.source.source_id||f.parentId&&!D.some(e=>e.reader_foundation?.id===f.parentId&&e.exists&&e.reader_foundation?.state===`complete`))return;let e=o.submit(f);e&&(h(e),p(null))},ne=!!A&&o.creating||D.some(e=>e.reader_foundation?.state===`generating`);return(0,J.jsxs)(ms.Provider,{value:{sid:e??``,readOnly:t,hasHistory:w.size>0,open:N,source:l,context:{locale:i,preview:ae(),foundationId:s}},children:[n,(0,J.jsx)(dt,{open:!!b,onClose:P,label:a?`进展阅读问答`:`Questions about this progress`,children:b&&x?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lt,{title:a?`哪里还不明白`:`What is still unclear`,sub:x.title}),(0,J.jsxs)(`div`,{className:`space-y-4 px-6 pb-6`,"data-testid":`progress-questions`,"data-project-id":b.sid,"data-progress-source-id":x.source_id,"data-progress-source-title":x.title,"data-reader-card":x.card_key,"data-reader-task-id":x.task_id,children:[(0,J.jsxs)(`div`,{className:`rounded-lg border border-line/70 p-3 text-xs text-ink-dim`,children:[(0,J.jsxs)(`p`,{children:[a?`引用打开提问时的这版说明:`:`Using the explanation selected when this question was opened: `,x.title]}),(0,J.jsx)(`time`,{dateTime:new Date(x.generated_at*1e3).toISOString(),className:`mt-1 block text-ink-faint`,children:new Date(x.generated_at*1e3).toLocaleString(r)}),(0,J.jsx)(W,{className:`mt-2 text-xs`,"data-reading-source-path":x.path,onClick:()=>_(e=>!e),children:g?a?`收起原说明`:`Hide original explanation`:a?`阅读当时说明`:`Read the original explanation`}),g?(0,J.jsx)(`div`,{className:`mt-3 text-[13px] leading-6`,children:(0,J.jsx)(_s,{sid:b.sid,path:x.path,artifacts:T,onOpenArtifact:E})}):null]}),w.size>1?(0,J.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`查看已保存的进展问答`:`Saved progress questions`,(0,J.jsx)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:x.source_id,disabled:o.creating,onChange:e=>{let t=w.get(e.target.value);t&&F(t)},children:[...w.values()].map(e=>(0,J.jsxs)(`option`,{value:e.source_id,children:[e.title,` · `,new Date(e.generated_at*1e3).toLocaleString(r)]},e.source_id))})]}):null,D.length?(0,J.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`已保存的问题`:`Saved questions`,(0,J.jsxs)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:m??``,onChange:e=>{h(e.target.value||null),y(null)},children:[(0,J.jsx)(`option`,{value:``,children:a?`选择一个问题`:`Choose a question`}),D.map(e=>(0,J.jsx)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,children:cs(e.reader_foundation)},e.path))]})]}):null,O?(0,J.jsxs)(`section`,{className:`space-y-3 text-[13px] leading-6`,"data-reading-question-id":O.reader_foundation.id,children:[k?(0,J.jsx)(ft,{label:a?`查看这次问题`:`View this question`,children:(0,J.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-ink-dim`,children:O.reader_foundation.question})},O.reader_foundation.id):(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words font-medium`,children:O.reader_foundation.question}),k?(0,J.jsx)(_s,{sid:b.sid,path:O.path,artifacts:T,onOpenArtifact:E}):(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:O.reader_foundation.state===`generating`?a?`回答仍在整理,尚未确认结束。`:`The answer is still being prepared; completion is unconfirmed.`:a?`这次回答未完成,原问题已保留。`:`This answer did not finish; its question is retained.`}),!t&&O.exists&&O.reader_foundation.state===`complete`?(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x},parentId:O.reader_foundation.id,parentTitle:cs(O.reader_foundation)}),children:a?`继续问这份回答`:`Ask a follow-up to this answer`}):null,!t&&O.reader_foundation.state===`failed`?(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:O.reader_foundation.question,progressSource:{...x},parentId:O.reader_foundation.parent_id??void 0}),children:a?`重新编辑问题`:`Edit this question`}):null]}):null,v?(0,J.jsxs)(`section`,{className:`space-y-2 rounded-lg border border-line/70 p-3 text-[13px] leading-6`,"data-referenced-reading-path":v,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{children:a?`引用的保存内容`:`Referenced saved reading`}),(0,J.jsx)(W,{className:`text-xs`,onClick:()=>y(null),children:a?`收起引用`:`Close referenced reading`})]}),(0,J.jsx)(_s,{sid:b.sid,path:v,artifacts:T,onOpenArtifact:E})]}):null,ne?(0,J.jsx)(is,{generating:!0,phase:A?o.progress.phase:void 0}):null,A?(0,J.jsxs)(`div`,{className:`space-y-2 text-xs text-ink-faint`,"data-pending-reading-question":A.id,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:A.draft.question}),M?(0,J.jsx)(`p`,{role:`status`,children:a?`引用的说明目前不可用,这次追问未发起。问题与原来源已保留。`:`The reading source is unavailable, so this question was not started. Its question and original source are saved.`}):ee?(0,J.jsx)(`p`,{role:`status`,children:a?`这次请求的结果尚未确认;刷新不会重新生成。`:`The result of this request is unconfirmed. Refreshing does not generate it again.`}):null,!t&&!o.creating&&!o.waiting?(0,J.jsx)(W,{className:`text-xs`,onClick:()=>{M?(p({...A.draft}),o.generation.reset()):o.retrySavedRequest(A)},children:M?a?`编辑问题与来源`:`Edit question and source`:a?`重试同一请求`:`Retry this same request`}):null]}):C&&o.creationBlocked?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`另一个阅读请求尚未结束。`:`Another reading request is still unresolved.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>N(),children:a?`查看原问题`:`View the original question`})]}):null,o.list.isError?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`保存的问答暂时读取失败。`:`Saved questions could not be loaded.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>void o.list.refetch(),children:a?`重新读取`:`Reload`})]}):null,f&&!t?(0,J.jsxs)(`section`,{className:`border-t border-line/60 pt-3`,children:[f.parentId?(0,J.jsxs)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:[a?`继续引用这份回答:`:`Following up on this answer: `,f.parentTitle||D.find(e=>e.reader_foundation?.id===f.parentId)?.reader_foundation?.question]}):null,(0,J.jsx)(us,{draft:f,onChange:p,onSubmit:te,disabled:o.creationBlocked})]}):t?null:(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x}}),children:a?`问这版说明`:`Ask about this explanation`})]})]}):null})]})}function ys({cardKey:e,taskId:t,card:n,task:r,originalDetail:i,selection:a,artifacts:o,onOpenArtifact:s,readOnly:c}){let{locale:l}=z(),u=l===`zh-CN`;if(r?.turn_kind===`qa`)return(0,J.jsx)(`div`,{className:`macro-reader-markdown`,"data-reader-card":e,"data-reader-task-id":t,children:(0,J.jsx)(H,{artifacts:o,onOpenArtifact:s,children:i})});let d=a?.request.key===e&&a.request.task_id===t?a:void 0,f=(n?.version??0)>=14&&mo(n?.reader_brief)?n.reader_brief:void 0;return(0,J.jsxs)(`div`,{className:`font-sans`,"data-reader-card":e,"data-reader-task-id":t,children:[(0,J.jsx)(is,{generatedAt:n?.generated_at,pending:d?.pending,generating:d?.generating,hasExplanation:!!n,phase:d?.phase,error:d?.error,unavailable:d?.unavailable,retry:d?.retry,retryDisabled:d?.retryDisabled}),d?.foundationRequired?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:u?`先在“问题基础”里选择一份说明,再阅读本次进展的解释。`:`Choose a saved foundation to explain this progress.`}):null,f?(0,J.jsx)(as,{brief:f,identity:e,detail:n?.detail,learningPath:n?.learning_path,foundation:n?.foundation_ref,readingUnavailable:n?.teaching_review?.reading_review?.status===`unavailable`,teachingUnavailable:n?.teaching_review?.status===`unavailable`,artifacts:o,onOpenArtifact:s}):(0,J.jsx)(`div`,{className:`macro-reader-markdown`,children:(0,J.jsx)(H,{artifacts:o,onOpenArtifact:s,children:Go(n?.detail||i)})}),(0,J.jsx)(os,{task:r?.id===t?r:void 0,artifacts:o,onOpenArtifact:s}),(0,J.jsx)(`div`,{className:`my-3`,children:(0,J.jsx)(hs,{card:n,cardKey:e,taskId:t,readOnly:c,context:d?.questionContext})})]})}var bs=e=>[`research-method`,e],xs={proven:`ok`,contradicted:`warning`,partial:`caution`,untested:`muted`,unchecked:`pending`};function Ss(e){return xs[e]??`unknown`}var Cs={ok:`text-ok border-ok/40 bg-ok/5`,warning:`text-warn border-warn/50 bg-warn/10 font-medium`,caution:`text-warn/80 border-warn/30`,muted:`text-ink-faint border-line/40`,pending:`text-ink-faint border-line/40 italic`,unknown:`text-ink-dim border-line/50`};function ws(e,t){switch(e){case`proven`:return t(`已证实`,`proven`);case`contradicted`:return t(`被推翻`,`contradicted`);case`partial`:return t(`部分证实`,`partial`);case`untested`:return t(`无测试`,`untested`);case`unchecked`:return t(`未运行`,`unchecked`);default:return e||`—`}}function Ts({status:e,text:t}){let n=Ss(e);return(0,J.jsx)(`span`,{className:`inline-block whitespace-nowrap rounded border px-1.5 py-0.5 text-[11px] leading-4 ${Cs[n]}`,"data-method-status":e,"data-method-status-tone":n,children:ws(e,t)})}var Es=new Set([`FAILED`,`ERROR`]);function Ds(e,t){if(!e.length)return{label:`—`,title:t(`没有测试带这个组件的标记`,`No test carries this component marker`),failing:0};let n=new Map;for(let t of e)n.set(t.kind||`invariant`,(n.get(t.kind||`invariant`)??0)+1);let r=[...n.entries()].map(([e,t])=>`${e} ×${t}`).join(`, `),i=e.filter(e=>Es.has((e.outcome??``).toUpperCase())).map(e=>e.id),a=t(`${e.length} 个测试`,`${e.length} ${e.length===1?`test`:`tests`}`),o=i.length?`${t(`失败`,`Failing`)}: ${i.join(` +`)}`:e.map(e=>`${e.id} — ${e.outcome??t(`未运行`,`not run`)}`).join(` +`);return{label:`${a} · ${r}`,title:o,failing:i.length}}function Os({tests:e,text:t}){let n=Ds(e,t);return(0,J.jsx)(`span`,{className:`whitespace-nowrap text-[11px] ${n.failing?`text-warn`:`text-ink-faint`}`,title:n.title,"data-method-tests":e.length,"data-method-failing":n.failing,children:n.label})}function ks(e){if(e==null||e===``)return null;let t=typeof e==`number`?new Date(e<0xe8d4a51000?e*1e3:e):new Date(e);return Number.isNaN(t.getTime())?null:t}var As=e=>e?(0,J.jsx)(H,{children:e}):(0,J.jsx)(`span`,{className:`text-ink-faint`,children:`—`});function js({children:e}){return(0,J.jsx)(`h3`,{className:`text-xs font-semibold text-ink`,children:e})}var Ms=`text-[11px] uppercase tracking-wide text-ink-faint`,Ns=`pb-1 pr-3 font-medium`;function Ps({rows:e,text:t}){return e.length?(0,J.jsx)(`div`,{className:`mt-2 overflow-x-auto`,"data-testid":`method-components`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Ms,children:[(0,J.jsx)(`th`,{className:Ns,children:t(`组件`,`Component`)}),(0,J.jsx)(`th`,{className:Ns,children:t(`方法规定`,`Prescribes`)}),(0,J.jsx)(`th`,{className:Ns,children:t(`备注`,`Notes`)}),(0,J.jsx)(`th`,{className:Ns,children:t(`状态`,`Status`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`测试`,`Tests`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-component":e.component,children:[(0,J.jsx)(`td`,{className:`py-1 pr-3 font-medium text-ink`,children:As(e.component)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:As(e.prescribes)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:As(e.notes??``)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:(0,J.jsx)(Ts,{status:e.status,text:t})}),(0,J.jsx)(`td`,{className:`py-1`,children:(0,J.jsx)(Os,{tests:e.tests??[],text:t})})]},`${e.component}-${n}`))})]})}):null}function Fs({rows:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,"data-testid":`method-reused-code`,children:[(0,J.jsx)(js,{children:t(`复用代码(从 import 扫描得出)`,`Reused code (from the import scan)`)}),(0,J.jsxs)(`table`,{className:`mt-1 w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Ms,children:[(0,J.jsx)(`th`,{className:Ns,children:t(`名称`,`Name`)}),(0,J.jsx)(`th`,{className:Ns,children:t(`类型`,`Kind`)}),(0,J.jsx)(`th`,{className:Ns,children:t(`版本 / 修订`,`Revision / version`)}),(0,J.jsx)(`th`,{className:Ns,children:t(`用到的模块`,`Modules`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`引用处`,`Imported from`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-row":e.name,children:[(0,J.jsx)(`td`,{className:`py-1 pr-3 font-medium text-ink`,title:e.remote||void 0,children:e.name||`—`}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:e.kind===`third_party`?t(`第三方克隆`,`third_party clone`):t(`已安装包`,`package`)}),(0,J.jsx)(`td`,{className:`py-1 pr-3 font-mono text-[11px]`,children:e.revision_or_version||`—`}),(0,J.jsx)(`td`,{className:`py-1 pr-3 break-all font-mono text-[11px]`,children:e.modules?.length?e.modules.join(`, `):`—`}),(0,J.jsx)(`td`,{className:`py-1`,title:e.imported_from?.join(` +`)||void 0,children:t(`${e.imported_from?.length??0} 个文件`,`${e.imported_from?.length??0} ${e.imported_from?.length===1?`file`:`files`}`)})]},`${e.name}-${n}`))})]})]}):null}function Is({rows:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,"data-testid":`method-hyperparameters`,children:[(0,J.jsx)(js,{children:t(`超参数(从配置文件得出)`,`Hyperparameters (from the config files)`)}),(0,J.jsxs)(`table`,{className:`mt-1 w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Ms,children:[(0,J.jsx)(`th`,{className:Ns,children:t(`键`,`Key`)}),(0,J.jsx)(`th`,{className:Ns,children:t(`值`,`Value`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`为什么`,`Why`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-row":e.key,"data-method-changed":e.changed?`true`:void 0,children:[(0,J.jsxs)(`td`,{className:`py-1 pr-3 font-medium text-ink`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.key}),e.file?(0,J.jsx)(`span`,{className:`block text-[10px] font-normal text-ink-faint`,children:e.file}):null]}),(0,J.jsxs)(`td`,{className:`py-1 pr-3`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.value}),e.changed?(0,J.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center gap-1 whitespace-nowrap rounded border border-warn/40 px-1 text-[10px] leading-4 text-warn`,"data-testid":`method-hyperparameter-changed`,children:[t(`已改`,`changed`),e.previous!=null&&e.previous!==``?(0,J.jsx)(`span`,{className:`font-mono text-ink-faint line-through`,children:e.previous}):null]}):null]}),(0,J.jsx)(`td`,{className:`py-1`,children:e.why?As(e.why):(0,J.jsx)(`span`,{className:`text-ink-faint`,title:t(`值旁没有 # why: 注释`,`No # why: comment next to the value`),children:`—`})})]},`${e.file}:${e.key}-${n}`))})]})]}):null}function Ls({entries:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3`,"data-testid":`method-change-log`,children:[(0,J.jsx)(js,{children:t(`变更记录(来自 git)`,`Change log (from git)`)}),(0,J.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs text-ink-dim`,children:e.map((e,t)=>(0,J.jsxs)(`li`,{className:`flex gap-2`,title:e.files?.join(` +`)||void 0,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-ink-faint`,children:e.when}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.summary})]},`${e.when}-${t}`))})]}):null}function Rs({checks:e,locale:t,text:n}){if(!e)return null;let r=Object.entries(e.counts??{}).filter(([,e])=>e>0).map(([e,t])=>`${e} ${t}`).join(`, `),i=e.exit_code==null?n(`未结束`,`no exit code`):n(`退出码 ${e.exit_code}`,`exit ${e.exit_code}`),a=ks(e.ran_at);return(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,"data-testid":`method-checks`,title:a?a.toLocaleString(t):void 0,children:[n(`最近一次检查:第 ${e.round_index} 轮 · ${i}`,`Latest checks: round ${e.round_index} · ${i}`),r?` · ${r}`:``,a?` · ${wt(a,t)}`:``]})}function zs({sid:e,active:t,compact:n=!1,onOpenArtifact:r}){let{locale:i}=z(),a=i===`zh-CN`,o=(e,t)=>a?e:t,[s,c]=(0,G.useState)(!n),l=t&&!!e,u=A({queryKey:bs(e),queryFn:({signal:t})=>R.researchMethod(e,t),enabled:l,refetchInterval:l?3e4:!1,staleTime:2e4,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}).data;if(!u||!u.exists)return null;let d=ks(u.updated_at),f=u.components??[],p=u.unlisted_components??[];return(0,J.jsxs)(`section`,{className:`mx-4 flex min-h-0 flex-col overflow-hidden rounded-lg border border-line/70 bg-panel ${n?`my-2 px-3 py-2`:`my-3 px-4 py-3`}`,"aria-label":o(`方法卡`,`Method card`),"data-testid":`method-card`,"data-project-id":e,"data-compact":n,children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 text-left`,"aria-expanded":s,onClick:()=>c(e=>!e),children:[(0,J.jsx)(Qt,{size:16,className:`shrink-0 text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-ink`,children:o(`方法卡`,`Method card`)}),u.title?(0,J.jsx)(`span`,{className:`truncate text-xs text-ink-dim`,children:u.title}):null,(0,J.jsx)(Ue,{size:12,className:`shrink-0 text-ink-faint ${s?`rotate-180`:``}`})]}),(0,J.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,title:d?d.toLocaleString(i):void 0,children:[r?(0,J.jsx)(`button`,{type:`button`,className:`underline-offset-2 hover:underline`,onClick:()=>r(u.path),children:u.path}):u.path,d?(0,J.jsxs)(J.Fragment,{children:[` · `,o(`更新于`,`updated`),` `,wt(d,i)]}):null]})]}),s?(0,J.jsxs)(`div`,{className:`mt-2 min-h-0 overflow-y-auto overscroll-contain scroll-thin ${n?`max-h-[30vh]`:`max-h-[40vh]`}`,"data-testid":`method-card-body`,tabIndex:0,"aria-label":o(`方法说明`,`Method text`),children:[u.statement?(0,J.jsx)(`p`,{className:`text-[13px] leading-6 text-ink-dim`,"data-testid":`method-statement`,children:u.statement}):null,(0,J.jsx)(Ps,{rows:f,text:o}),f.length===0?(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o(`文档里没有组件表;下面是全文。`,`The document has no component table; the full text follows.`)}):null,p.length?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,"data-testid":`method-unlisted-components`,children:[o(`测试里标记了但卡片未列出的组件:`,`Components marked in tests but not named in the card: `),p.join(`, `)]}):null,(0,J.jsx)(Fs,{rows:u.reused_code??[],text:o}),(0,J.jsx)(Is,{rows:u.hyperparameters??[],text:o}),(0,J.jsx)(Ls,{entries:u.change_log??[],text:o}),(0,J.jsx)(Rs,{checks:u.checks,locale:i,text:o}),(0,J.jsx)(`div`,{className:`mt-3 border-t border-line/40 pt-2 text-[13px] leading-6 text-ink-dim`,"data-testid":`method-card-markdown`,children:(0,J.jsx)(H,{sid:e,onOpenArtifact:r,children:u.markdown})}),u.truncated?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,"data-testid":`method-card-truncated`,children:o(`只显示了前 64 KiB。`,`Showing only the first 64 KiB.`)}):null]}):null]})}function Bs({selection:e,onOpenArtifact:t,readOnly:n}){let{locale:r}=z(),i=r===`zh-CN`,a=Ho({...e,active:!0,readOnly:n}),o=e.view.mission.id,s=a.task||{id:o,title:e.view.mission.title,objective:e.view.mission.objective,status:e.view.mission.status},c=(a.brief?a.card?.title:void 0)||s.title;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lt,{title:i?`读懂这一步`:`Understand this step`,sub:c}),(0,J.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`research-brief-reading`,"data-project-id":e.sid,"data-task-id":o,children:[(0,J.jsx)(ys,{cardKey:o,taskId:o,task:a.task,card:a.card,readOnly:n,onOpenArtifact:t,originalDetail:s.objective||e.snapshot.session.objective||``,selection:{request:fo(s,a.evidence),questionContext:a.questionContext,pending:a.needsUpdate,generating:a.generating,phase:a.generationPhase,error:a.generationError,foundationRequired:a.foundationRequired,retry:n?void 0:a.retry,retryDisabled:a.generating,unavailable:!a.foundationRequired&&(a.legacy||a.generationUnavailable||!a.loading&&!a.generationAvailable)}}),a.readError?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:i?`记录暂时读取失败;已显示内容仍保留。`:`Records could not be refreshed; previously loaded content is retained.`}):null]})]})}function Vs(e){let{locale:t}=z(),n=t===`zh-CN`,r=(e,t)=>n?e:t,i=e.compact===!0,[a,o]=(0,G.useState)(null),s=a?.sid===e.sid?a:null,c=(0,G.useRef)(null);(0,G.useEffect)(()=>{c.current&&(c.current.scrollTop=0)},[e.sid,e.view.mission.id]),(0,G.useEffect)(()=>o(null),[e.sid]);let l=Ho({...e,allowGeneration:!1,locale:n?`zh-CN`:`en-US`}),{task:u,evidence:d,brief:f,card:p}=l,m=(f?p?.title:void 0)||u?.title||e.view.mission.title||r(`当前任务`,`Current task`),h=u?.objective||e.view.mission.objective||e.snapshot.session.objective,g=Tt({ts:p?.generated_at})?.toLocaleString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,_=!l.foundationRequired&&(l.legacy||l.generationUnavailable||!l.loading&&!l.generationAvailable),v=!!l.readError||!!l.generationError||_,y=(0,J.jsx)(is,{generatedAt:p?.generated_at,pending:l.needsUpdate,generating:l.generating,phase:l.generationPhase,hasExplanation:!!f}),b=e=>(e||``).trim(),x=(l.readError?r(`任务记录暂时无法更新。`,`Task records could not be refreshed.`):l.generationError?r(`说明生成失败。`,`The explanation could not be prepared.`):_?r(`说明暂不可用。`,`Explanations are temporarily unavailable.`):``)||(l.loading?r(`正在读取任务记录。`,`Loading task records.`):l.generating?r(`正在根据任务记录整理说明。`,`Preparing an explanation from the task records.`):l.foundationRequired?r(`先在“问题基础”选择说明。`,`Choose a saved foundation for this explanation.`):r(`尚未生成说明。`,`No explanation has been saved yet.`)),S=!!l.readError||!l.generationAvailable||l.legacy||!u,C=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-ink-faint`,role:v?`status`:void 0,children:[(0,J.jsx)(`span`,{children:x}),v&&S&&e.active&&(!e.readOnly||l.readError)?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:l.generating||l.loading,onClick:()=>void l.retry(),children:[(0,J.jsx)(Ke,{size:12}),r(`重试`,`Retry`)]}):null]}),w=(0,J.jsxs)(J.Fragment,{children:[f?(0,J.jsx)(as,{brief:f,identity:u?.id||e.view.mission.id,detail:p?.detail,learningPath:p?.learning_path,foundation:p?.foundation_ref,onOpenArtifact:e.onOpenArtifact,readingUnavailable:l.readingUnavailable,teachingUnavailable:l.teachingUnavailable}):(0,J.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,children:[b(h)===b(m)?null:(0,J.jsx)(rs,{value:h||r(`任务目标尚未记录。`,`The task objective has not been recorded yet.`),expandLabel:r(`完整任务目标`,`Full task objective`)}),C]}),l.generating&&f?(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[r(`正在依据新记录更新;上方暂时保留之前的说明。`,`Updating from new records; the previous explanation remains visible above.`),g?` ${g}`:``]}):null,(0,J.jsx)(os,{task:u,onOpenArtifact:e.onOpenArtifact}),f&&v?C:null]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(zs,{sid:e.sid,active:e.active,compact:i,onOpenArtifact:e.onOpenArtifact}),(0,J.jsxs)(`section`,{className:`mx-4 flex min-h-0 flex-col overflow-hidden rounded-lg border border-line/70 bg-panel ${i?`my-2 px-3 py-2`:`my-3 max-h-[50vh] px-4 py-3`}`,"aria-label":r(`读懂这一步`,`Understand this step`),"data-testid":`research-brief`,"data-project-id":e.sid,"data-task-id":e.view.mission.id,"data-compact":i,children:[i?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(K,{size:16,className:`shrink-0 text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-ink`,children:r(`读懂这一步`,`Understand this step`)})]}),y]}),(0,J.jsxs)(`div`,{ref:c,className:`min-h-0 overflow-y-auto overscroll-contain scroll-thin`,"data-testid":`research-brief-body`,tabIndex:0,"aria-label":r(`任务说明`,`Task explanation`),children:[(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-faint`,children:(0,J.jsx)(H,{children:m||e.view.mission.title})}),w]})]}),(0,J.jsxs)(`footer`,{className:i?`shrink-0`:`mt-2 shrink-0 border-t border-line/50 pt-2`,"data-testid":`research-brief-footer`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>o({sid:e.sid,snapshot:e.snapshot,view:e.view,locale:n?`zh-CN`:`en-US`,preview:ae(),foundationId:l.foundationId}),children:[(0,J.jsx)(K,{size:12}),r(`阅读说明`,`Read explanation`)]}),(0,J.jsx)(hs,{card:p,cardKey:e.view.mission.id,taskId:e.view.mission.id,readOnly:e.readOnly,context:l.questionContext}),e.onAsk&&u&&!e.readOnly?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>e.onAsk?.(_o(e.sid,u,d,n)),children:[(0,J.jsx)(an,{size:12}),r(`引用任务`,`Reference task`)]}):null]}),i&&l.generating?(0,J.jsx)(`div`,{className:`mt-2`,children:y}):null]})]}),(0,J.jsx)(dt,{open:!!s,onClose:()=>o(null),label:r(`任务说明`,`Task explanation`),children:s?(0,J.jsx)(Bs,{selection:s,onOpenArtifact:e.onOpenArtifact,readOnly:e.readOnly}):null})]})}var Hs=new Set([`done`,`success`,`completed`]),Us=new Set([`research_incomplete`,`paused_no_breakthrough`,`exhausted_current_methods`]),Ws=new Set([`no_progress`,`max_rounds`]),Gs=new Set([`blocked`,`infra_blocked`]),Ks=new Set([`error`,`failed`,`supervisor_error`]),qs={completed:{glyph:`🎉`,tone:`ok`,missionStatus:`complete`},incomplete:{glyph:`◌`,tone:`warn`,missionStatus:`incomplete`},stalled:{glyph:`⏸`,tone:`warn`,missionStatus:`stalled`},blocked:{glyph:`⛔`,tone:`err`,missionStatus:`blocked`},failed:{glyph:`💥`,tone:`err`,missionStatus:`failed`},ended:{glyph:`■`,tone:`info`,missionStatus:`ended`}},Js={completed:`mission_completed`,incomplete:`mission_incomplete`,stalled:`mission_stalled`,blocked:`mission_blocked`,failed:`mission_failed`,ended:`mission_ended`},Ys={mission_completed:`The task was completed.`,mission_continued:`The task was completed and the project continues with the next one.`,mission_certified:`The final submission was checked and approved.`,mission_incomplete:`The task stopped with work still remaining.`,mission_stalled:`The task stopped because recent rounds made no useful progress.`,mission_blocked:`The task cannot continue until something outside it is resolved.`,mission_failed:`The task could not be completed.`,mission_paused:`The task was paused before it finished because {why}; its progress is saved and it can be resumed.`,mission_ended:`The task ended without a recorded outcome.`},Xs={budget_exhausted:`the project reached its budget limit`,provider_cooldown:`the model service asked Argus to wait before calling again`,provider_fence:`the model provider is not accepting calls right now`,daemon_shutdown:`Argus was stopped`,operator_pause:`the operator paused the work`,operator_abort:`the operator cancelled the task`,backend_unavailable:`the model service was unavailable`,transient_error:`a temporary error interrupted the call`,permanent_error:`an error that will not clear on its own stopped the call`},Zs={paused_budget:`budget_exhausted`,paused_provider_cooldown:`provider_cooldown`,paused_provider_fence:`provider_fence`,paused_daemon_shutdown:`daemon_shutdown`,paused_operator:`operator_pause`};function Qs(e){return String(e??``).trim().toLowerCase()}function $s(e,t){if(e===`paused_external_work`)return`work outside Argus had to finish first`;let n=Zs[e];return n?Xs[n]:Xs[t]?Xs[t]:e.startsWith(`paused_`)?`the work was paused`:`the work was interrupted`}function ec(e){let t=Qs(e);switch(t){case`completed`:case`incomplete`:case`stalled`:case`blocked`:case`failed`:case`ended`:return t;default:return null}}function tc(e){let t=Qs(e.status);return e.success===!0||Hs.has(t)?`completed`:Us.has(t)?`incomplete`:Ws.has(t)?`stalled`:Gs.has(t)?`blocked`:Ks.has(t)?`failed`:`ended`}function nc(e){let t=e.outcome;if(t&&typeof t==`object`&&!Array.isArray(t)){let n=t;return{execution_status:Qs(n.execution_status)||tc(e),review_status:Qs(n.review_status)||`not_assessed`,stage_certification:Qs(n.stage_certification)||`not_assessed`,interruption_kind:Qs(n.interruption_kind)||`none`,resumable:n.resumable===!0}}return{execution_status:tc(e),review_status:`not_assessed`,stage_certification:`not_assessed`,interruption_kind:Qs(e.stop_kind)||`none`,resumable:e.resumable===!0}}function rc(e){if(e.success===!0&&e.campaign_continues===!0)return{outcomeClass:`completed`,kind:`mission_continued`,label:Ys.mission_continued,glyph:`↻`,tone:`info`,missionStatus:`continued`,technical:``};let t=ec(e.outcome_class)??tc(e),n=Qs(e.status),r=qs[t],i=Js[t],a=Ys[i],o=``;if(t===`completed`&&e.final_submission_certified===!0)i=`mission_certified`,a=Ys.mission_certified;else if(t===`ended`&&(o=String(e.status??``).trim(),n.startsWith(`paused_`)||e.resumable===!0)){let t=e.outcome&&typeof e.outcome==`object`&&!Array.isArray(e.outcome)?e.outcome:{},r=Qs(e.stop_kind)||Qs(t.interruption_kind);i=`mission_paused`,a=Ys.mission_paused.replace(`{why}`,$s(n,r))}return{outcomeClass:t,kind:i,label:a,glyph:r.glyph,tone:r.tone,missionStatus:r.missionStatus,technical:o}}function ic(e,t){let n=typeof e==`string`?e.trim():``;return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function ac(e,t){let n=t===`zh-CN`,r=ic(e.route,40),i=ic(e.workflow_mode,40),a=ic(e.execution_task,160),o;o=r===`self`?n?`计划由 Manager 直接处理`:`Manager plans to handle this request`:i===`staged`?r===`team`?n?`计划由团队分阶段推进`:`The team plans to work in stages`:n?`计划分阶段推进`:`The plan is to work in stages`:i===`direct`?r===`team`?n?`计划由团队直接处理`:`The team plans to handle this task directly`:n?`计划直接处理这项工作`:`The plan is to handle this task directly`:n?`处理方案已确定`:`A plan is ready`,a&&(o+=`${n?`:`:`: `}${a}`);let s=``;e.lifetime===`standing`&&e.open_ended!==!1||!e.lifetime&&e.open_ended===!0?s=n?`持续跟进后续工作。`:`Keep following up on subsequent work.`:e.lifetime===`bounded_increment`?s=n?`本次只推进一个明确的增量。`:`Limit this run to one defined increment.`:e.lifetime===`bounded`&&(s=e.continuous===!0&&e.open_ended===!1?n?`完成这次目标后结束。`:`Finish once this objective is met.`:n?`范围限于本次目标。`:`Keep the work within this objective.`);let c=ic(e.reason,320),l=c&&!/^(?:\[manager\]|manager routed\b|\{)/i.test(c)&&c!==(ic(e.execution_task,320)||ic(e.objective,320))?c:``;return[o,[s,l].filter(Boolean).join(n?``:` `)].filter(Boolean).join(` +`)}function oc(e){let t=e;return t=t.replace(/^(\s*(?:authorization|proxy-authorization)\s*:).*$/gim,`$1 `),t=t.replace(/^(\s*(?:x-api-key|api-key|cookie|set-cookie)\s*:).*$/gim,`$1 `),t=t.replace(/gh[pousr]_[A-Za-z0-9]{20,}/g,``).replace(/xox[baprs]-[A-Za-z0-9-]{10,}/g,``).replace(/AKIA[0-9A-Z]{16}/g,``).replace(/\bbearer\s+[A-Za-z0-9._\-+/=]{16,}/gi,``).replace(/(?`).replace(/(?`).replace(/\b([a-z][a-z0-9+.\-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi,`$1@`),{text:e,sensitive:t!==e}}function sc(e){return oc(pe(e))}function Y(e,t){let n=String(e??``).replace(/```[a-z]*\n?/gi,``).replace(/\[([^\]]+)\]\([^)]+\)/g,`[$1]`).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}var cc=e=>e,X=(e,t)=>String(cc(e)[t]??``);function lc(e,t){return`${e} ${t}${e===1?``:`s`}`}function Z(e,t,n){return e.locale===`zh-CN`?n:t}function uc(e,t){let n=X(e,`error_code`),r=X(e,`failure_stage`),i=X(e,`stop_kind`),a=[`daemon_shutdown`,`operator_pause`,`operator_abort`].includes(i);if(n===`cancelled`&&r===`commit`&&X(e,`status`)===`issued`)return{text:Z(t,`Applying the adjustment was interrupted; the saved decision is waiting to be applied.`,`应用调整时被中断,已保存的决定等待继续处理。`),tone:`warn`};if(n===`timeout`&&r===`commit`)return{text:Z(t,`Manager reached a decision, but applying the adjustment timed out.`,`Manager 已作出判断,但应用调整超时。`),tone:`warn`};let o={trial_quota_exceeded:[`The remaining trial quota cannot cover this Manager check.`,`剩余试用额度不足以启动这次 Manager 检查。`],observation_incomplete:[`Manager could not fully read the required project evidence; this check has stopped.`,`Manager 未能完整读取所需的项目资料,这次检查已停止。`],timeout:[`The model did not respond before the Manager check timed out.`,`模型未在时限内返回,Manager 这次检查已结束。`],cancelled:[`This Manager check was cancelled.`,`已取消这次 Manager 检查。`],superseded:[`New input or evidence superseded this Manager check.`,`新的操作或证据已取代这次 Manager 检查。`]};if(Object.hasOwn(o,n)&&!(n===`cancelled`&&a))return{text:Z(t,...o[n]),tone:n===`cancelled`||n===`superseded`?`dim`:`warn`};let s={budget_exhausted:[`The project budget limit prevented this Manager check.`,`项目预算已达上限,Manager 暂未完成检查。`],provider_cooldown:[`The model service asked Manager to wait before calling again.`,`模型服务要求稍后再调用,Manager 暂未完成检查。`],provider_fence:[`The model service is not accepting calls; Manager could not finish this check.`,`模型服务当前不接受调用,Manager 未完成这次检查。`],backend_unavailable:[`The model service was unavailable for this Manager check.`,`模型服务不可用,Manager 未完成这次检查。`],transient_error:[`A temporary model service error interrupted this Manager check.`,`模型服务的临时错误中断了这次 Manager 检查。`],permanent_error:[`The model call failed; Manager could not finish this check.`,`模型调用失败,Manager 未完成这次检查。`],daemon_shutdown:[`Argus stopped, ending this Manager check.`,`Argus 已停止,这次 Manager 检查已结束。`],operator_pause:[`This Manager check was paused by your request.`,`已按你的要求暂停这次 Manager 检查。`],operator_abort:[`This Manager check was cancelled by your request.`,`已按你的要求取消这次 Manager 检查。`]};if(Object.hasOwn(s,i))return{text:Z(t,...s[i]),tone:a?`dim`:`warn`};let c=X(e,`status`);return c===`cancelled`||c===`superseded`?{text:Z(t,`This Manager check was cancelled.`,`这次 Manager 检查已取消。`),tone:`dim`}:{text:r===`commit`&&[`continue`,`wait`,`steer`].includes(X(e,`action`))?Z(t,`Manager reached a decision, but the team adjustment could not be applied.`,`Manager 已作出判断,但团队调整未能生效。`):r===`decision`?Z(t,`Manager returned a decision that could not be validated.`,`Manager 返回的判断或引用依据未通过核验。`):Z(t,`Manager could not finish this check.`,`Manager 未能完成这次检查。`),tone:`warn`}}function Q(e,t,n,r,i,a={}){let o=sc(r);return{visibility:a.visibility??(i===`err`||i===`warn`?`alert`:`normal`),role:e,labelKey:t,glyph:n,tone:i,segments:o.text?[{kind:`text`,text:o.text}]:[],expandable:a.expandable===!0,sensitive:o.sensitive||a.sensitive===!0,fallback:a.fallback===!0,rule:a.rule===!0,reasoning:a.reasoning===!0}}function dc(){return{visibility:`hidden`,role:`system`,labelKey:`event.hidden`,glyph:``,tone:`dim`,segments:[],expandable:!1,sensitive:!1,fallback:!1,rule:!1,reasoning:!1}}function fc(e,t){if(cc(e).operator_alert===!0){let n=Y(X(e,`text`)||X(e,`reason`)||e.type,170);return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,n,`err`,{rule:!0})}if(t.unknownEventPolicy===`hide`)return dc();let n=String(e.type||`?`),r=X(e,`text`).trim();return Q(`system`,`event.fallback`,`•`,`[${n}]${r?` ${r}`:``}`,`dim`,{fallback:!0})}function pc(e,t=`engineer`){return X(e,`agent_layer`)||(e.type.startsWith(`life.manager.`)?`manager`:e.type.startsWith(`life.planner.`)?`planner`:e.type.startsWith(`round.review.`)?`reviewer`:t)}function mc(e,t){let n=X(e,`phase`),r=X(e,`cause`)||X(e,`backend_error`),i=X(e,`error`);if(!n||!r)return`${Z(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} ${Y(i,t.density===`full`?160:140)}`;let a={backend:[`model service`,`模型服务`],parse:[`reading the answer`,`读取回答`],contract:[`answer shape:`,`回答格式:`],timeout:[`timed out`,`超时`]},o=a[n]?Z(t,a[n][0],a[n][1]):n,s=Number(cc(e).attempts||0),c=s>1?Z(t,` (attempt ${s})`,` (第${s}次尝试)`):``,l=`${Z(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} · ${o} ${r}${c}`;return i?`${l} · ${Z(t,`error text`,`原始错误`)}: ${i}`:l}function hc(e){let t=cc(e).round_index??cc(e).round;return typeof t==`string`||typeof t==`number`?t:`?`}function gc(e,t){let n=X(e,`kind`),r=pc(e),i=`role.${r}`;if(n===`reasoning`){if(!t.showReasoning)return dc();let n=Y(X(e,`text`),280);return n?Q(r,i,`∴`,n,`dim`,{expandable:t.density===`full`,reasoning:!0}):dc()}if(n===`assistant_message`||n===`agent_message`||n===`message`){if(re(cc(e)))return fc(e,t);let n=sc(X(e,`text`));return n.text?Q(r,i,`▌`,n.text,`bright`,{expandable:t.density===`full`,sensitive:n.sensitive}):dc()}if(n===`command_execution`){let n=X(e,`text`)||X(e,`command`)||X(e,`action_summary`),a=X(e,`status`)===`failed`?`err`:`dim`;return n?Q(r,i,`▸ $`,n,a,{expandable:t.density===`full`}):dc()}if(n===`tool_use`||n===`file_change`){let a=X(e,`text`)||X(e,`action_summary`);if(!a&&t.density===`full`)return dc();let o=n===`file_change`?Z(t,`(file change)`,`(文件变更)`):Z(t,`(tool)`,`(工具)`);return Q(r,i,n===`file_change`?`✎`:`⚙`,a||o,X(e,`status`)===`failed`?`err`:`dim`,{expandable:t.density===`full`})}if(t.density===`full`)return dc();let a=String(cc(e).text??cc(e).action_summary??``).split(` +`)[0]?.trim()??``;return a?Q(r,i,`▸`,Y(a,160),`dim`):dc()}function _c(e,t){let n=ie(cc(e).canonical_type??e.type);if(n&&n!==e.type)return _c({...e,type:n},t);switch(e.type){case`advisor.consultation.requested`:case`life.manager.supervision.issued`:return dc();case`advisor.consultation.completed`:{let t=X(e,`question`).trim(),n=X(e,`summary`).trim();return!t&&!n?dc():Q(`advisor`,`role.advisor`,`◇`,[t,n].filter(Boolean).join(` +`),`info`,{expandable:!0})}case`advisor.consultation.cancelled`:{let n=Y(X(e,`question`),160);return Q(`advisor`,`role.advisor`,`◇`,`${Z(t,`Consultation cancelled`,`已取消咨询`)}${n?` · ${n}`:``}`,`dim`)}case`advisor.consultation.failed`:case`advisor.consultation.timed_out`:case`advisor.consultation.model_mismatch`:{let n=e.type.endsWith(`model_mismatch`)?Z(t,`The provider returned a different model`,`接入返回的模型与所选模型不一致`):e.type.endsWith(`timed_out`)?Z(t,`The advisor did not respond in time`,`顾问未在时限内返回`):Z(t,`The consultation did not finish`,`顾问咨询未完成`),r=Y(X(e,`question`),160);return Q(`advisor`,`role.advisor`,`◇`,`${n}${r?` · ${r}`:``}`,`warn`,{expandable:!0})}case`life.manager.supervision.applied`:return Q(`manager`,`role.manager`,`🧭`,X(e,`summary`)||X(e,`reason`),`info`,{expandable:!0,rule:!0});case`life.peer.message.processed`:return Q(`manager`,`role.peer`,`↔`,X(e,`text`),`info`,{expandable:!0});case`life.manager.supervision.failed`:{let n=uc(e,t);return Q(`manager`,`role.manager`,`🧭`,n.text,n.tone,{expandable:!0})}case`engineer.progress`:return gc(e,t);case`life.manager.intent.started`:return Q(`manager`,`role.manager`,`🧭`,Z(t,`Working out how to handle your request…`,`正在安排处理方式…`),`info`);case`life.manager.intent.completed`:return Q(`manager`,`role.manager`,`🧭`,ac(cc(e),t.locale),`info`,{expandable:!0});case`life.manager.intent.failed`:return Q(`manager`,`role.manager`,`⚠`,mc(e,t),`err`,{expandable:t.density===`full`});case`life.manager.stage_decision`:{let n=X(e,`target_stage`)||X(e,`stage`)||X(e,`current_stage`);return Q(`manager`,`role.manager`,`🧭`,`${X(e,`action`)}${n?` → ${n}`:``} ${Y(X(e,`reason`),t.density===`full`?140:120)}`,`info`)}case`life.research.second_reading`:{let n=pc(e,`manager`),r=Y(X(e,`supported`),160),i=Z(t,`reread the evidence and reworked the plan`,`重读了证据并重排了计划`);return Q(n,`role.${n}`,`📖`,r?`${i} · ${r}`:i,`info`)}case`life.letter.written`:{let n=pc(e,`manager`);return Q(n,`role.${n}`,`✉`,Z(t,`wrote you a letter`,`给你写了一封信`),`accent`)}case`life.planner.start`:return Q(`planner`,`role.planner`,`📋`,`${Z(t,`planning`,`正在规划`)} ${Y(X(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.verdict`:return X(e,`status`)===`done`||cc(e).project_done===!0?Q(`planner`,`role.planner`,`🏁`,Z(t,`the project is finished`,`项目已完成`),`ok`):Q(`planner`,`role.planner`,`📋`,Z(t,`lined up ${X(e,`queued`)||X(e,`n`)||`next`} task(s) to do next`,`已排好 ${X(e,`queued`)||X(e,`n`)||`下一`} 个接下来要做的任务`),`accent`);case`life.planner.task_added`:return Q(`planner`,`role.planner`,`+`,`${Z(t,`added a task`,`新增任务`)} · ${Y(X(e,`title`)||X(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.task_skipped`:return Q(`planner`,`role.planner`,`⏭`,`${X(e,`skip_category`)===`paper_review_purchase_deferred`?Z(t,`put off another paper review`,`推迟了再买一次评审`):Z(t,`skipped a task already planned`,`跳过了已在计划中的任务`)} ${Y(X(e,`title`),t.density===`full`?140:120)}`,`dim`);case`life.planner.preview_skipped`:return Q(`planner`,`role.planner`,`⏭`,Z(t,`skipped the plan preview: the research Planner owns the campaign plan`,`跳过了计划预览:研究规划师负责整个计划`),`dim`);case`life.planner.normalized`:return Q(`planner`,`role.planner`,`≋`,`${Z(t,`tidied the plan`,`整理了计划`)} · ${Y(X(e,`diagnostic`),180)}`,`dim`);case`life.planner.waiting`:return Q(`planner`,`role.planner`,`⌛`,`${Z(t,`waiting`,`等待中`)} · ${Y(X(e,`reason`),180)}`,`info`);case`life.planner.waiting_woken`:return Q(`planner`,`role.planner`,`↻`,`${Z(t,`resumed`,`已唤醒`)} · ${Y(X(e,`wake_reason`),180)}`,`info`);case`life.planner.terminal_idle`:return Q(`planner`,`role.planner`,`Ⅱ`,`${Z(t,`nothing left to plan`,`暂时没有要规划的`)} · ${Y(X(e,`reason`),180)}`,`dim`);case`life.planner.verification_probe`:return t.showReasoning?Q(`planner`,`role.planner`,`⌕`,`${Z(t,`checking that the plan still holds`,`检查计划是否仍然成立`)} · ${Y(X(e,`reason`),180)}`,`dim`):dc();case`life.planner.error`:return Q(`planner`,`role.planner`,`⚠`,`${Z(t,`the Planner hit an error`,`规划者出错`)} ${Y(X(e,`error`)||X(e,`text`),t.density===`full`?160:140)}`,`err`);case`life.mission.started`:return Q(`engineer`,`role.engineer`,`🚀`,Y(X(e,`title`)||X(e,`objective`)||X(e,`text`)||Z(t,`started work on this task`,`开始做这项任务`),t.density===`full`?180:160),`info`,{rule:!0});case`round.start`:return Q(`engineer`,`role.engineer`,`──`,Z(t,`round ${hc(e)}`,`第 ${hc(e)} 轮`),`dim`,{rule:!0});case`life.phase.started`:{let n=X(e,`label`)||X(e,`phase`),r=pc(e);return n?Q(r,`role.${r}`,`🔄`,Z(t,`entering ${n}`,`进入 ${n}`),`info`):dc()}case`round.review.started`:return Q(`reviewer`,`role.reviewer`,`🔄`,Z(t,`the Reviewer checks round ${hc(e)}`,`审阅者检查第 ${hc(e)} 轮`),`info`);case`round.review.deferred`:return Q(`engineer`,`role.engineer`,`↪`,Z(t,`carries on into the next round without a review · ${Y(X(e,`next_step`),t.density===`full`?180:160)}`,`不经审阅直接进入下一轮 · ${Y(X(e,`next_step`),t.density===`full`?180:160)}`),`info`);case`round.main.completed`:return Q(`engineer`,`role.engineer`,`✅`,Z(t,`finished round ${hc(e)} of work`,`第 ${hc(e)} 轮工作已完成`),`info`);case`round.review.completed`:{if(e.review_skipped===!0)return Q(`reviewer`,`role.reviewer`,`↪`,`${Z(t,`no review this round`,`这一轮没有审阅`)} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,`info`);let n=X(e,`status`),r=n===`done`?Y(X(e,`residual_risk`),200):``;if(r)return Q(`reviewer`,`role.reviewer`,`⚠`,`${Z(t,`verified with residual risk`,`已验证,但有残余风险`)}: ${r} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,`warn`);let i=n===`done`?`ok`:n===`blocked`||n===`no_progress`?`err`:`warn`;return Q(`reviewer`,`role.reviewer`,n===`done`?`✅`:n===`blocked`||n===`no_progress`?`⛔`:`↻`,`${Sc(n,t)} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,i)}case`life.mission.completed`:{let n=rc(cc(e)),r=Y(X(e,`summary`),240),i=Y(X(e,`residual_risk`),200);return i&&n.tone===`ok`?Q(`engineer`,`role.engineer`,`⚠`,`${Z(t,`completed with residual risk`,`已完成,但有残余风险`)} · ${r.includes(i)?r:`${i}${r?` · ${r}`:``}`}`,`warn`,{rule:!0}):Q(`engineer`,`role.engineer`,n.glyph,r?`${n.label} · ${r}`:n.label,n.tone,{rule:!0})}case`life.mission.failed`:return Q(`engineer`,`role.engineer`,`❌`,`${Z(t,`this task failed`,`这项任务失败了`)} ${Y(X(e,`reason`)||X(e,`error`),t.density===`full`?160:140)}`,`err`,{rule:!0});case`loop.start`:return Q(`engineer`,`role.engineer`,`▶`,Y(X(e,`text`)||X(e,`objective`),t.density===`full`?16e3:160),`info`,{expandable:t.density===`full`});case`loop.done`:return Q(`engineer`,`role.engineer`,`🏁`,`${Z(t,`the run finished`,`这次运行结束`)} ${Y(X(e,`text`),t.density===`full`?140:120)}`,`dim`);case`life.inbox.queued`:return Q(`system`,`role.operator`,`📥`,`${Z(t,`you added guidance`,`你追加了指导`)} · ${Y(X(e,`text`),t.density===`full`?180:160)}`,`accent`);case`daemon.parked`:{let n=X(e,`replaced_by`),r=Z(t,`Argus set this project aside with its state saved`,`Argus 已把这个项目搁置,状态已保存`);return Q(`system`,`role.system`,`Ⅱ`,n?`${r} · ${Z(t,`continued as ${n}`,`由 ${n} 接续`)}`:r,`warn`,{rule:!0})}case`accounting.journal_repaired`:{let n=cc(e).damaged_lines,r=cc(e).liabilities,i=Array.isArray(n)?n.length:0,a=Array.isArray(r)?r.length:0,o=Y(X(e,`damaged_copy`),120),s=`the usage journal was repaired: ${i} damaged line(s) set aside${o?` in ${o}`:``}, ${a} call(s) written back as a liability`,c=`用量账本已修复:${i} 行损坏记录已另存${o?`到 ${o}`:``},${a} 次调用按负债记回`;return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Z(t,s,c),`warn`,{rule:!0})}case`provider.request.denied`:{let n=X(e,`provider`);return Q(`system`,`event.quota`,`⏸`,`${Z(t,`a request to ${n||`the model service`} was held back`,`发往${n||`模型服务`}的一次请求被暂缓`)} · ${Y(X(e,`reason`),160)}`,`warn`,{rule:!0})}case`round.reviewer_backend_failure`:{let n=Y(X(e,`text`),150),r=t.density===`full`?Z(t,`the Reviewer's model service is unreachable — waiting rather than going on unchecked`,`审阅者的模型服务连不上 — 先等待,不在无人审阅的情况下继续`):Z(t,`the Reviewer's model service is unreachable — waiting`,`审阅者的模型服务连不上 — 先等待`);return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${r} · ${n}`,`err`,{rule:!0})}case`round.stall`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||Z(t,t.density===`full`?`no progress this round — keeping a close eye on it`:`no progress this round`,`这一轮没有进展`),170),`warn`);case`round.escalated`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||Z(t,`many rounds without a finish — raising what is blocking the work`,`轮次已经很多还没做完 — 把外部阻碍提出来`),170),`warn`);case`life.planner.stall_escalation`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${Z(t,`the Planner is stuck`,`规划者卡住了`)} — ${Y(X(e,`reason`)||X(e,`text`),150)}`,`warn`);case`life.budget.pause`:return X(e,`stop_kind`)===`cost_unreconciled`||X(e,`reason`).startsWith(`unresolved provider cost`)?Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Q(`system`,`event.watch`,`⏸`,Z(t,`budget cap reached — paused · ${Y(X(e,`text`)||X(e,`reason`),140)}`,`已达到预算上限 — 已暂停 · ${Y(X(e,`text`)||X(e,`reason`),140)}`),`warn`);case`budget.reservation.denied`:return X(e,`reason`).startsWith(`unresolved provider cost`)?Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Q(`system`,`event.budget`,`$`,`${Z(t,`budget denied`,`预算申请被拒绝`)} — ${Y(X(e,`reason`)||X(e,`text`),t.density===`full`?160:150)}`,`err`,{rule:!0});case`budget.unpriced.blocked`:return Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`);case`budget.unpriced.acknowledged`:return Q(`system`,`event.budget`,`$`,Z(t,`Single-call cost risk approved; original usage remains pending`,`已批准单笔费用风险;原始费用仍待对账`),`warn`);case`life.lifecycle.block`:return Q(`system`,`event.watch`,`⛔`,`${Z(t,`blocked — needs you`,`卡住了 — 需要你来处理`)} · ${Y(X(e,`text`)||X(e,`reason`),150)}`,`err`,{rule:!0});case`life.daemon.idle_timeout`:return Q(`system`,`event.watch`,`🟦`,Y(X(e,`text`)||Z(t,`nothing to do for a while — standing by`,`一段时间没有事做 — 待命中`),150),`dim`);case`operator_alert`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||X(e,`reason`)||e.type,170),`err`,{rule:!0});case`life.supervisor.error`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`Argus hit an internal error while coordinating the work`,`Argus 在统筹工作时遇到内部错误`)} · ${Y(X(e,`error`),160)}`,`err`,{rule:!0});case`life.auth_failure`:return Q(`system`,`role.system`,`🔑`,Z(t,`the model service rejected the sign-in — refresh the credentials and Argus will carry on`,`模型服务拒绝了登录 — 更新凭据后 Argus 会继续`),`err`,{rule:!0});case`life.planner.deferred`:return Q(`planner`,`role.planner`,`⌛`,`${Z(t,`planning is on hold`,`规划暂缓`)} · ${Y(X(e,`reason`),180)}`,`dim`);case`life.post_mission.stop`:return Q(`system`,`role.system`,`■`,`${Z(t,`stopped after this task`,`这项任务之后停下`)} · ${Y(X(e,`reason`),180)}`,`info`);case`life.planner.final_submission_skipped`:return Q(`planner`,`role.planner`,`⏭`,`${Z(t,`dropped an outdated final-submission task`,`跳过了一项过时的最终提交任务`)} · ${Y(X(e,`title`),140)}`,`dim`);case`life.execution_host.blocked`:return Q(`system`,`event.watch`,`⛔`,Y(X(e,`reason`)||Z(t,`the program that runs code for Argus could not be started`,`为 Argus 运行代码的程序无法启动`),t.density===`full`?260:180),`err`,{rule:!0});case`life.mission.provider_configuration_disabled`:{let n=Number(cc(e).streak||0),r=Z(t,`the model configuration failed ${lc(n,`time`)} in a row — this task is paused until you decide`,`模型配置连续 ${n} 次失败 — 这项任务已暂停,等待你的决定`),i=Y(X(e,`text`),160);return Q(`system`,`event.watch`,`⛔`,i?`${r} · ${i}`:r,`err`,{rule:!0})}case`life.iteration.continued`:return Q(`critic`,`role.critic`,`🔁`,Z(t,`lined up the next iteration`,`排好了下一轮迭代`),`dim`);case`life.learned_vertical.promoted`:return Q(`manager`,`role.manager`,`★`,Z(t,`made the learned domain "${X(e,`vertical`)}" official`,`把新学到的领域「${X(e,`vertical`)}」正式收录`),`accent`);case`life.learned_vertical.promotion_failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not record "${X(e,`vertical`)}" as a formal domain`,`未能把「${X(e,`vertical`)}」收录为正式领域`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.review.waived`:return Q(`planner`,`role.planner`,`↪`,`${Z(t,`this task will skip the independent review`,`这项任务将不做独立审阅`)} · ${Y(X(e,`reason`),160)}`,`dim`);case`life.manager.feedback.exhausted`:{let n=Number(cc(e).attempts||0);return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`the Manager's objection went unanswered ${lc(n,`time`)} — planning pauses for a while`,`管理者的异议 ${n} 次未被回应 — 规划暂停一段时间`)} · ${Y(X(e,`reason`),140)}`,`warn`)}case`life.manager.feedback.persisted`:{let n=X(e,`stage`);return Q(`manager`,`role.manager`,`↩`,`${n?Z(t,`sent the plan back for another pass at ${n}`,`把计划退回 ${n} 阶段再改一轮`):Z(t,`sent the plan back for another pass`,`把计划退回再改一轮`)} · ${Y(X(e,`reason`),160)}`,`info`)}case`life.manager.goal_contract.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not save the agreed goal`,`未能保存商定的目标`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.manager.intent.superseded`:return Q(`manager`,`role.manager`,`↷`,Z(t,`a newer instruction replaced this request`,`更新的指令取代了这个请求`),`info`);case`life.manager.project_report.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not deliver the project report`,`未能送出项目报告`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.planner.completion_circuit_opened`:{let n=Number(cc(e).consecutive_rejections||0);return Q(`planner`,`role.planner`,`⏸`,Z(t,`the same completion requirement turned the plan back ${lc(n,`time`)} — pausing completion attempts until something changes`,`同一项完成要求已 ${n} 次打回计划 — 暂停完成尝试,直到情况变化`),`warn`)}case`life.planner.completion_rejected`:return Q(`manager`,`role.manager`,`↩`,`${Z(t,`the Manager did not accept the completion claim`,`管理者未接受完成的说法`)} · ${Y(X(e,`reason`),160)}`,`info`);case`life.planner.continuation_required`:return Q(`planner`,`role.planner`,`↻`,Z(t,`finished one increment; the standing objective continues`,`完成了一个增量;长期目标继续推进`),`dim`);case`life.planner.superseded`:return Q(`planner`,`role.planner`,`↷`,Z(t,`dropped an outdated planning pass after a newer instruction`,`收到更新的指令,放弃了过时的规划`),`dim`);case`life.planner.wait_overridden`:return Q(`planner`,`role.planner`,`+`,`${Z(t,`scheduled independent work instead of waiting`,`不再干等,安排了独立的工作`)} · ${Y(X(e,`task_title`),140)}`,`info`);case`life.daemon.degraded`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`Argus started, but the objective did not reach the Manager`,`Argus 已启动,但目标没有交到管理者手上`)} · ${Y(X(e,`error`),140)}`,`warn`);case`round.orphan_process_group`:return Q(`engineer`,`role.engineer`,`⚠`,cc(e).cleanup_succeeded===!0?Z(t,`background processes outlived the turn and were cleaned up`,`有后台进程在这一轮结束后仍在运行,已清理`):Z(t,`background processes outlived the turn and could not be cleaned up`,`有后台进程在这一轮结束后仍在运行,未能清理`),`warn`);case`round.model_configuration_error`:return Q(`engineer`,`role.engineer`,`⛔`,`${Z(t,`the model configuration is not usable`,`模型配置无法使用`)} · ${Y(X(e,`text`)||X(e,`error`),160)}`,`err`,{rule:!0});case`round.watchdog.retry`:{let n=Number(cc(e).attempt||0),r=Number(cc(e).max_attempts||0);return Q(`engineer`,`role.engineer`,`↻`,Z(t,`the model call failed — retrying in a fresh session (attempt ${n} of ${r})`,`模型调用失败 — 在新会话中重试(第 ${n} 次,共 ${r} 次)`),`warn`)}case`round.watchdog.retry_exhausted`:{let n=Number(cc(e).attempt||0),r=Y(X(e,`fatal_error`),140),i=Z(t,`the model call kept failing — giving up after ${lc(n,`attempt`)}`,`模型调用持续失败 — ${n} 次后放弃`);return Q(`engineer`,`role.engineer`,`⛔`,r?`${i} · ${r}`:i,`err`,{rule:!0})}case`round.backend_failure.backoff`:{let n=Math.round(Number(cc(e).seconds||0));return Q(`engineer`,`role.engineer`,`⏳`,Y(X(e,`text`)||Z(t,`the model service failed — waiting ${n}s before trying again`,`模型服务出错 — 等待 ${n} 秒后再试`),200),`warn`)}case`round.backend_failure.hold_interrupted`:return Q(`engineer`,`role.engineer`,`↪`,Y(X(e,`text`)||Z(t,`the wait after a model-service failure ended early`,`模型服务出错后的等待提前结束`),180),`info`);case`round.provider_turn_cap.restart`:return Q(`engineer`,`role.engineer`,`↻`,Z(t,`reached the per-call turn allowance — continuing the same task in a fresh session`,`达到单次调用的轮次上限 — 在新会话中继续同一任务`),`info`);case`round.provider_turn_cap.reviewer_restart`:return Q(`reviewer`,`role.reviewer`,`↻`,Z(t,`the review reached its turn allowance — restarting it in a fresh session`,`审阅达到轮次上限 — 在新会话中重新开始`),`info`);case`round.reviewer_backend_failure.backoff`:{let n=Math.round(Number(cc(e).seconds||0));return Q(`reviewer`,`role.reviewer`,`⏳`,Y(X(e,`text`),200)||Z(t,`the Reviewer's model service is unavailable — retrying in ${n}s`,`审阅者的模型服务不可用 — ${n} 秒后重试`),`warn`)}case`round.external_work_wait.started`:return Q(`engineer`,`role.engineer`,`⌛`,`${Z(t,`waiting for background work to report`,`等待后台工作汇报`)} · ${Y(X(e,`work_id`),80)}`,`dim`);case`round.external_work_wait.completed`:return Q(`engineer`,`role.engineer`,`↻`,Z(t,`background work reported — resuming`,`后台工作已汇报 — 继续`),`dim`);case`round.external_work_review.required`:return Q(`reviewer`,`role.reviewer`,`⌛`,`${Z(t,`background work finished — an independent review of its result is required before resuming`,`后台工作已结束 — 恢复前需要对其结果做一次独立审阅`)} · ${Y(X(e,`work_id`),80)}`,`dim`);case`round.external_work_review.completed`:return Q(`reviewer`,`role.reviewer`,`✓`,`${Z(t,`background work result reviewed`,`后台工作结果已审阅`)} · ${Y(X(e,`review_status`),40)}`,`dim`);case`plan.draft.failed`:return Q(`planner`,`role.planner`,`⚠`,`${Z(t,`could not draft the plan`,`未能起草计划`)} · ${Y(X(e,`reason`),140)}`,`err`);case`plan.draft.done`:{let n=Number(cc(e).steps||0);return Q(`planner`,`role.planner`,`📋`,Z(t,`drafted a plan with ${lc(n,`step`)}`,`起草了一份 ${n} 步的计划`),`dim`)}case`team.learning.review.started`:return Q(`manager`,`role.manager`,`📚`,Z(t,`reviewing what this task taught the team`,`整理这项任务给团队带来的经验`),`dim`);case`team.learning.review.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`the team learning review failed`,`团队经验整理失败`)} · ${Y(X(e,`error`),140)}`,`warn`);case`team.learning.review.completed`:{let n=Number(cc(e).created||0),r=Number(cc(e).updated||0);return Q(`manager`,`role.manager`,`📚`,Z(t,`kept ${n} new and ${r} updated team procedures`,`保留了 ${n} 条新的、${r} 条更新的团队做法`),`dim`)}case`team.learning.promotion.quarantined`:return Q(`manager`,`role.manager`,`⚠`,Z(t,`set aside a new procedure that would have judged its own work`,`搁置了一条会评判自己工作的新做法`),`warn`);case`self.learning.review.failed`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`the review of Argus's own conversation habits failed`,`对 Argus 自身对话习惯的复盘失败`)} · ${Y(X(e,`error`),140)}`,`warn`);case`domain.promotion`:return Q(`manager`,`role.manager`,`★`,Y(X(e,`text`),180),`dim`);case`idea.portfolio.formed`:{let n=cc(e).selection,r=n&&typeof n==`object`?String(n.route_id??``):``,i=Number(cc(e).route_count||0),a=Y(X(e,`text`),180),o=i>0?Z(t,`formed an idea portfolio of ${lc(i,`route`)}`,`组成了 ${i} 条思路的组合`):Z(t,`formed an idea portfolio`,`组成了思路组合`);return Q(`engineer`,`role.engineer`,`💡`,r?Z(t,`chose route ${r} from the idea portfolio`,`从思路组合中选定了路线 ${r}`):a||o,`accent`)}case`user.note`:{let n=Array.isArray(cc(e).tags)?cc(e).tags.map(String):[];if(n.includes(`config`))return dc();if(n.includes(`planner`))return Q(`planner`,`role.planner`,`📝`,Z(t,`updated the research plan`,`更新了研究计划`),`dim`);let r=Y(X(e,`summary`)||X(e,`text`)||X(e,`title`),180);return Q(`system`,`role.operator`,`📝`,`${Z(t,`you added a note`,`你添加了一条笔记`)}${r?` · ${r}`:``}`,`accent`)}case`ui.operator`:{let t=X(e,`text`);return t.trim()?Q(`system`,`role.operator`,`›`,t,`accent`,{rule:!0}):dc()}case`ui.argus`:{let n=X(e,`text`),r=cc(e).live===!0||Array.isArray(cc(e).steps)&&cc(e).steps.length>0;return n.trim()||r?Q(`manager`,`role.argus`,`▌`,n,`bright`,{expandable:t.density===`full`,rule:!0}):dc()}case`agent.io.start`:case`agent.io.stream`:case`agent.io.complete`:case`agent.io.error`:case`usage.recorded`:case`provider.request.started`:case`provider.request.completed`:case`codex.util.completed`:case`skill.cost.completed`:case`budget.reservation.created`:case`budget.reservation.settled`:case`budget.reservation.released`:case`round.checkpoint.recorded`:case`round.checkpoint.failed`:case`round.secret_redacted`:case`role.session.turn`:case`engineer.skill_maintenance.completed`:case`life.status`:case`life.mission.skipped`:case`life.mission.orphaned`:case`life.mission.requeued`:case`life.manager.plan_challenge.decided`:case`life.vertical.resolved`:case`life.manager.backend_resolved`:case`life.planner.backend_resolved`:case`life.planner.dependency_dropped`:case`life.planner.parallel_dropped`:case`life.engineer.backend_resolved`:case`life.reviewer.backend_resolved`:case`life.curator.backend_resolved`:case`life.runtime_failure.circuit_opened`:case`life.runtime_failure.circuit_blocked`:case`life.runtime_failure.canary_passed`:case`life.runtime.incident.detected`:case`life.runtime.incident.recovered`:case`life.runtime.incident.escalated`:case`life.plan.revision.proposed`:case`life.plan.revision.rejected`:case`life.plan.revision.committed`:case`life.plan.node.superseded`:case`life.lifecycle.transition`:case`life.inbox.drained`:case`life.operator_question.pending`:case`life.operator_question.answered`:case`project.completed`:case`project.completion_refused`:case`daemon.command.submitted`:case`daemon.command.completed`:case`daemon.command.rejected`:case`idea.search.started`:case`idea.search.completed`:case`idea.search.skipped`:case`venue.research.started`:case`venue.research.completed`:case`research.achievement.certified`:case`skill.library.available`:case`skill.created`:case`skill.updated`:case`skill.archived`:case`skill.tidied`:case`skill.history.compressed`:case`skill.evolution.completed`:case`wiki.initialized`:case`wiki.hook.warning`:case`wiki.created`:case`wiki.updated`:case`wiki.retired`:case`wiki.promotion.promoted`:case`wiki.promotion.demoted`:case`wiki.retired.compressed`:case`wiki.evolution.completed`:case`knowledge.learned`:case`knowledge.recalled`:case`life.planner.verdict.discarded`:case`life.manager.feedback.unresolved`:case`life.manager.project_report`:case`life.plan.revision.rolled_back`:case`life.planner.completion_circuit.notify_failed`:case`life.planner.completion_circuit_holding`:case`life.planner.external_poll_suppressed`:case`life.planner.waiting_contract.normalized`:case`life.daemon.ready`:case`plan.draft.start`:case`team.learning.review.skipped`:case`self.learning.review.started`:case`self.learning.review.completed`:case`manager.live_view.updated`:case`manager.live_view.rejected`:case`idea.portfolio.nested_skipped`:case`manager.turn.started`:case`manager.turn.cancelled`:case`life.config.parse_failed`:return fc(e,t);default:return fc(e,t)}}function vc(e){return e.segments.map(e=>e.text).join(``)}var yc={"role.manager":[`Manager`,`Manager`],"role.planner":[`Planner`,`Planner`],"role.engineer":[`Engineer`,`Engineer`],"role.reviewer":[`Reviewer`,`Reviewer`],"role.advisor":[`Advisor`,`顾问`],"role.peer":[`Project exchange`,`项目交流`],"role.critic":[`Critic`,`Critic`],"role.system":[`Argus`,`Argus`],"role.argus":[`Argus`,`Argus`],"role.operator":[`You`,`你`],"event.notice":[`Notice`,`通知`],"event.watch":[`Watch`,`监控`],"event.budget":[`Budget`,`预算`],"event.quota":[`Quota`,`额度`],"event.fallback":[`Argus`,`Argus`],"event.hidden":[``,``]};function bc(e,t){let n=yc[e];if(n)return t===`zh-CN`?n[1]:n[0];let r=e.startsWith(`role.`)?e.slice(5):e;return r?`${r.slice(0,1).toUpperCase()}${r.slice(1)}`:``}function xc(e,t){let n=_c(e,t);if(n.visibility===`hidden`)return null;let r=vc(n);return!r&&!(e.type===`ui.argus`&&(e.live===!0||Array.isArray(e.steps)&&e.steps.length>0))?null:{role:n.role,labelKey:n.labelKey,label:bc(n.labelKey,t.locale),glyph:n.glyph,text:r,tone:n.tone,rule:n.rule,reasoning:n.reasoning,expand:n.expandable,sensitive:n.sensitive}}function Sc(e,t){let n={done:[`the Reviewer was satisfied`,`审阅者认可了这一轮`],blocked:[`the Reviewer found the work stuck`,`审阅者认为工作卡住了`],no_progress:[`the Reviewer saw no progress`,`审阅者没有看到进展`]};if(!e)return Z(t,`the Reviewer gave no verdict`,`审阅者没有给出结论`);let r=n[e]??[`the Reviewer asked for another pass`,`审阅者要求再改一轮`];return Z(t,r[0],r[1])}function Cc(e,t){return t===`zh-CN`?e[0]:e[1]}function wc(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``)}var Tc={grounding_started:[`正在阅读这项请求,弄清楚它要做什么`,`Reading the request to understand what it asks`],goal_framed:[`已经理解这项请求,项目目标已经确定。`,`The request is understood and the project goal is set.`],goal_not_understood:[`这项请求还没有被理解清楚。`,`The request could not be understood yet.`],request_not_routed:[`这项请求没能被安排下去。`,`The request could not be routed to the team.`],stage_advanced:[`研究进入了下一阶段。`,`The research moved to the next stage.`],stage_entered:[`研究进入「{stage}」阶段。`,`The research moved to the {stage} stage.`],stage_held:[`当前阶段暂不推进。`,`The current stage is on hold.`],stage_rolled_back:[`研究退回到了前一阶段。`,`The research went back a stage.`],stage_completed:[`当前阶段已完成。`,`The current stage is complete.`],stage_reconsidered:[`阶段安排已重新考虑。`,`The stage plan was reconsidered.`],stage_reviewed:[`阶段已复核。`,`The stage was reviewed.`],planning_started:[`正在规划下一步工作`,`Planning the next step`],task_added:[`计划中加入了一项新任务。`,`A new task was added to the plan.`],research_route_added:[`计划中加入了一条新的研究路线。`,`A new research route was added to the plan.`],planning_complete:[`下一步的计划已经排好。`,`The next step is planned.`],project_finished:[`项目已经完成。`,`The project is finished.`],task_delivered:[`成果已交付。`,`The result was delivered.`],planner_waiting:[`规划者在等待前一步完成。`,`The Planner is waiting for the previous step.`],planner_idle:[`暂时没有需要规划的工作。`,`Nothing to plan right now.`],planning_failed:[`这次规划没有成功。`,`Planning did not succeed this time.`],mission_started:[`开始处理这项任务`,`Work on the task started`],awaiting_engineer:[`等待工程师完成这一轮。`,`Waiting for the Engineer to finish the round.`],waiting_external:[`等待外部工作完成。`,`Waiting on work outside Argus.`],mission_completed:[`任务已完成。`,`The task is complete.`],mission_continued:[`任务将继续进行。`,`The task continues.`],mission_certified:[`成果已通过独立核对。`,`The result passed an independent check.`],mission_incomplete:[`任务没有完成。`,`The task was not completed.`],mission_stalled:[`任务停滞不前。`,`The task stalled.`],mission_blocked:[`任务被挡住了。`,`The task is blocked.`],mission_failed:[`任务没能完成。`,`The task could not be completed.`],mission_paused:[`任务在完成前暂停;进度已保存,可以继续。`,`The task was paused before it finished; its progress is saved and it can be resumed.`],mission_ended:[`任务已结束。`,`The task ended.`],mission_ready:[`可以开始新任务。`,`Ready for a new task.`],round_in_progress:[`这一轮正在进行。`,`The round is in progress.`],round_running:[`第 {n} 轮正在进行。`,`Round {n} is in progress.`],round_started:[`第 {n} 轮工作开始。`,`Round {n} started.`],progress_tool:[`正在使用工具`,`Using a tool`],progress_command:[`正在运行命令`,`Running a command`],progress_message:[`正在汇报进展`,`Reporting progress`],progress_file:[`正在更新项目文件`,`Updating project files`],progress_inspecting:[`正在查看项目状态`,`Looking at the project state`],engineer_round_finished:[`工程师完成了这一轮,结果已准备好供核对。`,`The Engineer finished the round; the result is ready to be checked.`],checking_started:[`正在阅读工程师的结果并核对证据`,`Reading the Engineer's result and checking the evidence`],continuing_before_check:[`先继续下一轮,核对稍后进行。`,`Continuing to the next round; the check comes later.`],check_postponed:[`这一轮的核对推迟了。`,`The check of this round was postponed.`],round_not_judged:[`这一轮没有人审阅。`,`No one reviewed this round.`],results_accepted:[`结果通过了核对。`,`The result passed the check.`],another_attempt_requested:[`审阅者要求再试一次。`,`The reviewer asked for another attempt.`],attempt_blocked:[`这次尝试被挡住了。`,`This attempt is blocked.`],replan_requested:[`审阅者要求重新规划。`,`The reviewer asked for a new plan.`],results_not_final:[`结果还不是最终的。`,`The result is not final yet.`],handed_off:[`已交给下一位。`,`Handed off to the next role.`],waiting:[`等待中`,`Waiting`],live_activity:[`正在工作`,`Working`],role_failed:[`{role} 执行失败`,`{role} failed`],capability_unlocked:[`解锁了一项新能力。`,`A new capability was unlocked.`],capability_upgraded:[`一项能力得到了升级。`,`A capability was upgraded.`],capability_promoted:[`一项能力被提升为来源。`,`A capability was promoted to a source.`],knowledge_captured:[`记下了一条新知识。`,`New knowledge was captured.`],knowledge_refined:[`一条知识得到了完善。`,`A piece of knowledge was refined.`],knowledge_promoted:[`一条知识被提升。`,`A piece of knowledge was promoted.`],knowledge_demoted:[`一条知识被降级。`,`A piece of knowledge was demoted.`],knowledge_retired:[`一条知识已退役。`,`A piece of knowledge was retired.`],"event.model_call.started":[`开始调用模型`,`Model call started`],"event.model_call.completed":[`模型调用完成`,`Model call completed`],"event.model_call.failed":[`模型调用失败`,`Model call failed`],"event.usage.recorded":[`已记录用量`,`Usage recorded`],"event.budget.reserved":[`已预留预算`,`Budget reserved`],"event.budget.settled":[`预算已结算`,`Budget settled`],"event.model_turn":[`与模型完成一次往返`,`One exchange with the model`],"event.instruction.received":[`收到你的指令`,`Your instruction was received`],"event.instruction.done":[`指令已执行`,`Instruction carried out`],"event.inbox.processed":[`已处理收件箱`,`Inbox processed`],"event.round.started":[`新的一轮开始`,`A new round started`],"event.round.finished":[`执行者完成了这一轮`,`The Engineer finished the round`],"event.review.finished":[`这一轮的审阅结束`,`Review of the round finished`],"event.retry.waiting":[`等待后重试`,`Waiting before retrying`],"event.retry.interrupted":[`等待被打断`,`The wait was interrupted`],"event.status":[`状态更新`,`Status update`],"event.planning.started":[`开始规划`,`Planning started`],"event.planning.failed":[`规划没有完成`,`Planning did not complete`],"event.planning.tidied":[`计划已整理`,`Plan tidied`],"event.planning.decided":[`规划结论`,`Planning decision`],"event.task.started":[`开始执行任务`,`Task execution started`],"event.task.ended":[`任务执行结束`,`Task execution ended`],"event.skills.ready":[`技能库已就绪`,`Skill library ready`],"event.routes.formed":[`已形成候选路线组合`,`Candidate route portfolio formed`],"event.lessons.skipped":[`本次没有总结经验`,`No lessons recorded this time`],"event.argus.reply":[`Argus 的回复`,`Reply from Argus`]},Ec={daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],paused_daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],operator_pause:[`你暂停了它`,`you paused it`],paused_operator:[`你暂停了它`,`you paused it`],operator_abort:[`你停止了它`,`you stopped it`],budget_exhausted:[`预算用完了`,`the budget ran out`],budget_pause:[`预算用完了`,`the budget ran out`],paused_budget:[`预算用完了`,`the budget ran out`],provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],paused_provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],provider_fence:[`模型服务不可用`,`the model service is unavailable`],paused_provider_fence:[`模型服务不可用`,`the model service is unavailable`],backend_unavailable:[`模型服务不可用`,`the model service is unavailable`],transient_error:[`出现了暂时性的问题`,`a temporary problem came up`],permanent_error:[`遇到了无法自动恢复的错误`,`an error could not be recovered from`],operator_input_required:[`需要你的回复`,`your reply is needed`],planner_empty_plan:[`需要一份新的计划`,`a new plan is needed`]},Dc={pending:[`待开始`,`Waiting`],queued:[`待开始`,`Waiting`],not_started:[`待开始`,`Not started`],waiting:[`等待中`,`Waiting`],idle:[`空闲`,`Idle`],running:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],active:[`进行中`,`In progress`],working:[`进行中`,`In progress`],framed:[`已明确目标`,`Objective settled`],grounding:[`了解项目中`,`Getting oriented`],planned:[`已规划`,`Planned`],done:[`已完成`,`Done`],complete:[`已完成`,`Done`],completed:[`已完成`,`Done`],success:[`已完成`,`Done`],accepted:[`已完成`,`Done`],failed:[`失败`,`Failed`],error:[`出错`,`Failed`],blocked:[`受阻`,`Blocked`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],skipped:[`已跳过`,`Skipped`],ended:[`已结束`,`Ended`],incomplete:[`未完成`,`Not finished`],stalled:[`停滞`,`Stalled`],paused:[`已暂停`,`Paused`],stopped:[`已停止`,`Stopped`],cancelled:[`已停止`,`Stopped`],aborted:[`已停止`,`Stopped`],paused_external_work:[`等待外部工作完成`,`Waiting for external work`],superseded:[`已由新方案替代`,`Replaced by a newer plan`]},Oc={engineer_service_dropped:[`模型服务在工程师得出可核对的结果之前中断了会话,因此没有可以审阅的内容。Argus 会换一个新会话重试。`,`The model service dropped the session before the Engineer produced a checkable result, so there was nothing to review. Argus will retry in a fresh session.`],reviewer_unreachable:[`审阅者的会话在得出结论前就结束了,Argus 会再试一次。`,`The reviewer's session ended before it reached a conclusion; Argus will try again.`],argus_stopped:[`Argus 被停止了,任务随之暂停。`,`Argus was stopped, so the task paused.`],task_cancelled:[`这项任务被取消了。`,`The task was cancelled.`],session_length_limit:[`这一轮达到了单次会话的长度上限;已做的工作保留,会在新的会话里继续。`,`The round reached the length limit of one session; the work so far is kept and continues in a fresh session.`],tools_unavailable:[`执行环境里缺少需要的工具。`,`The tools the work needs are not available in the execution environment.`],model_unavailable:[`模型服务暂时不可用。`,`The model service is unavailable for now.`],sign_in_failed:[`模型服务的登录没有成功。`,`Signing in to the model service did not succeed.`],paused:[`任务被暂停了。`,`The task was paused.`],unknown:[`原因暂时不明。`,`The reason is not known yet.`],retry_wait_cut_short:[`在等待重试时 Argus 被要求停止。`,`Argus was asked to stop while waiting to retry.`]},kc={idea:[`选题`,`Idea`],scope:[`研究定义`,`Scope`],research:[`文献与假设`,`Literature and hypotheses`],literature:[`文献与假设`,`Literature and hypotheses`],implementation:[`方法实现`,`Implementation`],implement:[`方法实现`,`Implementation`],experiment:[`实验验证`,`Experiments`],experiments:[`实验验证`,`Experiments`],analysis:[`结果分析`,`Analysis`],writing:[`论文写作`,`Writing`],review:[`最终审核`,`Final review`],delivery:[`成果交付`,`Delivery`],optimize:[`优化`,`Optimization`],solve:[`推导与验证`,`Derivation and verification`],hold:[`已暂停`,`Paused`],paused:[`已暂停`,`Paused`]},Ac={"provider.request.started":`event.model_call.started`,"provider.request.completed":`event.model_call.completed`,"provider.request.failed":`event.model_call.failed`,"agent.io.start":`event.model_call.started`,"agent.io.complete":`event.model_call.completed`,"usage.recorded":`event.usage.recorded`,"budget.reservation.created":`event.budget.reserved`,"budget.reservation.settled":`event.budget.settled`,"role.session.turn":`event.model_turn`,"daemon.command.submitted":`event.instruction.received`,"daemon.command.completed":`event.instruction.done`,"life.inbox.drained":`event.inbox.processed`,"round.start":`event.round.started`,"round.main.completed":`event.round.finished`,"round.review.completed":`event.review.finished`,"round.backend_failure.backoff":`event.retry.waiting`,"round.backend_failure.hold_interrupted":`event.retry.interrupted`,"life.status":`event.status`,"life.planner.start":`event.planning.started`,"life.planner.error":`event.planning.failed`,"life.planner.normalized":`event.planning.tidied`,"life.planner.verdict":`event.planning.decided`,"loop.start":`event.task.started`,"loop.done":`event.task.ended`,"skill.library.available":`event.skills.ready`,"idea.portfolio.formed":`event.routes.formed`,"team.learning.review.skipped":`event.lessons.skipped`,"ui.argus":`event.argus.reply`};function jc(e,t){let n=String(e??``).trim(),r=kc[n.toLowerCase()];return r?Cc(r,t):n}function Mc(e,t){let n=String(e??``).trim().toLowerCase(),r=Ec[n];return r?Cc(r,t):n}function Nc(e,t){let n=String(e??``).trim().toLowerCase(),r=Ec[n];return r?t===`zh-CN`?`因为${r[0]},工作停了下来。`:`The work stopped because ${r[1]}.`:n}function Pc(e,t,n){if(!t)return e;let r=Mc(t,n);return n===`zh-CN`?`${e.replace(/。$/,``)}(${r})。`:`${e.replace(/\.$/,``)} — ${r}.`}function Fc(e,t,n){return t?n===`zh-CN`?`已完成 ${e} / ${t}`:`${e} of ${t} done`:Cc([`尚未规划`,`Not planned yet`],n)}var Ic=[[/^Reporting progress$/i,`progress_message`],[/^(?:Running a command|running project command)$/i,`progress_command`],[/^Using a tool$/i,`progress_tool`],[/^inspecting project state$/i,`progress_inspecting`],[/^Working$/i,`live_activity`]],Lc=[...Ic,[/^(?:Review not performed|No review this round)$/i,`round_not_judged`],[/^Goal framed$/i,`goal_framed`],[/^(?:Grounding project|Project grounding started)$/i,`grounding_started`],[/^Manager routing failed$/i,`request_not_routed`],[/^Stage reviewed$/i,`stage_reviewed`],[/^(?:Planning next work|Planning started)$/i,`planning_started`],[/^Planning complete$/i,`planning_complete`],[/^Planner waiting$/i,`planner_waiting`],[/^Project reviewed$/i,`project_finished`],[/^Research branch added$/i,`research_route_added`],[/^Task added$/i,`task_added`],[/^(?:Engineer handoff ready|Work ready for review)$/i,`engineer_round_finished`],[/^(?:Review started|Reviewing benchmark evidence)$/i,`checking_started`],[/^(?:Continuing before review|Continued before review)$/i,`continuing_before_check`],[/^Review deferred for one round$/i,`check_postponed`],[/^Waiting for the Engineer to finish$/i,`awaiting_engineer`],[/^Waiting on external work$/i,`waiting_external`],[/^(?:Evidence accepted|Accepted evidence)$/i,`results_accepted`],[/^(?:Attempt rejected|Requested another attempt)$/i,`another_attempt_requested`],[/^Handed off$/i,`handed_off`],[/^(?:Mission started|Starting mission)$/i,`mission_started`],[/^(?:Task completed|Mission complete)$/i,`mission_completed`],[/^Task failed$/i,`mission_failed`],[/^Awaiting Planner$/i,`planner_waiting`],[/^Ready for a new mission$/i,`mission_ready`],[/^Waiting$/i,`waiting`],[/^Capability unlocked$/i,`capability_unlocked`],[/^Capability upgraded$/i,`capability_upgraded`],[/^Capability promoted to source$/i,`capability_promoted`],[/^Knowledge captured$/i,`knowledge_captured`],[/^Knowledge refined$/i,`knowledge_refined`],[/^Knowledge promoted$/i,`knowledge_promoted`],[/^Knowledge demoted$/i,`knowledge_demoted`],[/^Knowledge retired$/i,`knowledge_retired`],[/^(?:request · started|io · start)$/i,`event.model_call.started`],[/^(?:request · completed|io · complete)$/i,`event.model_call.completed`],[/^usage · recorded$/i,`event.usage.recorded`],[/^reservation · created$/i,`event.budget.reserved`],[/^reservation · settled$/i,`event.budget.settled`],[/^Round (\d+) started$/i,(e,t)=>wc(Cc(Tc.round_started,t),{n:e[1]})],[/^Running round (\d+)$/i,(e,t)=>wc(Cc(Tc.round_running,t),{n:e[1]})],[/^Stage (?:·|→) (.+)$/i,(e,t)=>wc(Cc(Tc.stage_entered,t),{stage:jc(e[1],t)})],[/^Mission (ended|incomplete|stalled|blocked|failed)(?: · (\S+))?$/i,(e,t)=>Pc(Cc(Tc[`mission_${e[1].toLowerCase()}`],t),e[2],t)],[/^(Manager|Planner|Engineer|Reviewer) failed$/i,(e,t)=>wc(Cc(Tc.role_failed,t),{role:e[1]})],[/^(\d+) \/ (\d+) complete$/i,(e,t)=>Fc(Number(e[1]),Number(e[2]),t)],[/^Not planned$/i,(e,t)=>Fc(0,0,t)]];function Rc(e){return e===`zh-CN`?`zh`:`en`}function zc(e,t,n){let r=String(e??``).trim(),i=typeof n==`string`?{kind:n}:n??{};if(!i.kind||i.kind===`live_activity`){for(let[e,n]of Ic)if(e.test(r))return Cc(Tc[n],t)}let a=i.kind?Tc[i.kind]:void 0;if(i.kind){let e=!!i.language&&i.language!==Rc(t);if(a&&(e||!r)&&!a[0].includes(`{`))return Cc(a,t);if(r&&!e)return r}for(let[e,n]of Lc){let i=r.match(e);if(i)return typeof n==`string`?Cc(Tc[n],t):n(i,t)}if(a){let e=Cc(a,t);if(!e.includes(`{`))return e;let n=r.match(/\d+/)?.[0];return n&&e.includes(`{n}`)?wc(e,{n}):r}let o=Dc[r.toLowerCase()];return o?Cc(o,t):r}function Bc(e,t){let n=Oc[String(e??``).trim().toLowerCase()];return n?Cc(n,t):``}function Vc(e,t){let n=String(e??``).trim().toLowerCase(),r=Dc[n];return r?Cc(r,t):n}function Hc(e,t){let n=Ac[String(e??``).trim()];return n?Cc(Tc[n],t):null}function Uc(e){return/^(?:provider\.|agent\.io\.|usage\.|budget\.|role\.session\.turn$)/.test(String(e??``))}var Wc=[[/^Next action:\s*/i,[`下一步:`,`Next: `]],[/^(?:原因:|Reason:)\s*/i,[`原因:`,`Reason: `]],[/^The backend has failed the same way (\d+) times in a row \(([^)]*)\)\. Waiting ([\d.]+)s before the next attempt[^\n]*/i,(e,t)=>({text:t===`zh-CN`?`模型服务已连续 ${e[1]} 次以同样的方式失败;为了不让持续的故障白白花钱,${e[3]} 秒后再试。`:`The model service has failed the same way ${e[1]} times in a row; waiting ${e[3]} seconds before trying again so a standing failure does not keep costing money.`,technical:e[2]})],[/^review: \w+(?: \([^)]*\))? — /i,[``,``]],[/^status=(\S+) rounds=(\d+) reason=/i,(e,t)=>{let n=Ec[e[1].toLowerCase()],r=n?Cc(n,t):Vc(e[1],t);return t===`zh-CN`?`任务已结束(${r}),共 ${e[2]} 轮。`:`Task ended — ${r}, after ${e[2]} rounds.`}],[/^engineer round (\d+) \((?:fresh session|new session)\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮,在新的会话里开始。`:`Round ${e[1]}, started in a fresh session.`],[/^engineer round (\d+) \([^)]*\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮开始。`:`Round ${e[1]} started.`],[/^backend failure; retrying in a fresh \w+ session after ([\d.]+)s\.?$/i,(e,t)=>t===`zh-CN`?`模型服务调用失败,${e[1]} 秒后在新的会话里重试。`:`The model service call failed; retrying in a fresh session after ${e[1]} seconds.`],[/^planner error: (.*; retry later)\.?$/i,(e,t)=>({text:t===`zh-CN`?`规划这一步没有完成,稍后会重试。`:`Planning did not complete; it will be retried later.`,technical:e[1]})],[/^mission failed\.?$/i,[`任务失败了。`,`The task failed.`]],[/^Engineer backend failed before a trustworthy completed turn; reviewer skipped\.?/i,[`这一轮模型服务没有完成调用,所以没有人审阅。`,`The model service did not complete this round, so no one reviewed it.`]],[/^Reviewer backend unavailable for (\d+) consecutive attempt\(s\); failing loud rather than settling the round without a real review\.?/i,(e,t)=>t===`zh-CN`?`审阅者的模型服务连续 ${e[1]} 次没有响应,这一轮因此没有得到审阅。`:`The reviewer's model service did not respond ${e[1]} times in a row, so this round was not reviewed.`],[/^The Reviewer's session ended before it reached a conclusion, so this round was not judged\.?/i,[`审阅者在得出结论前就中断了,这一轮没有被评判。`,`The reviewer stopped before reaching a conclusion, so this round was not judged.`]],[/^The wait after a repeated backend failure ended early: daemon stop requested\.?/i,[`在等待重试时 Argus 被要求停止,任务随之暂停。`,`Argus was asked to stop while waiting to retry, so the task paused.`]],[/^Backend call paused before a trustworthy completed turn \(stop_kind=(\w+)\); reviewer skipped\.?/i,(e,t)=>t===`zh-CN`?`这一轮在得出可信结果前被暂停(${Mc(e[1],t)}),所以没有人审阅。`:`This round was paused before it produced a trustworthy result (${Mc(e[1],t)}), so no one reviewed it.`],[/^One Engineer call used its whole per-call provider-turn allowance \([^)]*\); reviewer skipped\. The work so far is kept and the task continues in a fresh session from the checkpoint\.?/i,[`这一轮用完了单次调用的额度;已做的工作保留,会在新的会话里接着做,本轮没有审阅。`,`This round used up its per-call allowance; the work so far is kept and continues in a fresh session. No review this round.`]],[/^Execution host is unavailable; reviewer skipped\.?/i,[`执行环境暂时不可用,这一轮没有审阅。`,`The execution environment is unavailable, so this round was not reviewed.`]],[/^Copilot CLI exited with code \d+\.?/i,[`模型服务的调用没有完成。`,`The model service call did not complete.`]],[/^Grounded bounded plan completed with (\d+) step\(s\)\.?/i,(e,t)=>t===`zh-CN`?`规划完成,共 ${e[1]} 步。`:`Planning finished with ${e[1]} steps.`],[/^Retry in a fresh \w+ session; do not resume the failed thread\.(?:\s*If this repeats, pause the daemon and reduce concurrent \w+ load\.)?/i,[`接下来会在新的会话里重试这一轮。`,`The round will be retried in a fresh session.`]],[/^Restart the daemon to resume this mission from its checkpoint\.?/i,[`重新运行 Argus 即可从保存的进度继续。`,`Run Argus again to continue from the saved progress.`]],[/^Resume this mission when the operator is ready\.?/i,[`准备好后即可恢复这项任务。`,`Resume the task whenever you are ready.`]],[/^Resume from the persisted checkpoint after the blocking budget or provider condition has been cleared\.?/i,[`预算或模型服务恢复后,即可从保存的进度继续。`,`Once the budget or model service is back, the task continues from the saved progress.`]],[/^inspecting project state$/i,[`正在查看项目状态`,`Looking at the project state`]],[/^running project command$/i,[`正在运行项目命令`,`Running a project command`]],[/^using a tool$/i,[`正在使用工具`,`Using a tool`]]],Gc=/^(?:[\w.]+_(?:streak|code|error|kind)=|error=|exit=|fatal_error=|Runner receipt:|stop_kind=|backend_)/i;function Kc(e,t){let n=e.trim(),r=[],i=[],a=!1;for(;n;){let e=!1;for(let[o,s]of Wc){let c=n.match(o);if(!c)continue;let l=typeof s==`function`?s(c,t):Cc(s,t);typeof l==`string`?r.push(l):(r.push(l.text),l.technical&&i.push(l.technical)),n=n.slice(c[0].length).replace(/^[\s;,]+/,``),e=!0,a=!0;break}e||(a&&Gc.test(n)?i.push(n):r.push(n),n=``)}let o=t===`zh-CN`?``:` `;return{text:r.filter(Boolean).join(o).replace(/:\s+/g,`:`),technical:i.join(` `)}}function qc(e,t,n){let r=String(e??``).trim();if(n){let e=n.language&&n.language!==Rc(t)?Bc(n.cause,t):``;if(e)return{text:e,technical:String(n.technical??``)};if(n.technical)return{text:r,technical:String(n.technical)}}if(!r)return{text:``,technical:``};let i=r.split(/(\n[ \t]*\n|\n)/),a=[],o=[];return i.forEach((e,n)=>{if(n%2==1){a.push(e.includes(` + +`)||/\n[ \t]*\n/.test(e)?` + +`:` +`);return}let r=Kc(e,t);a.push(r.text),r.technical&&o.push(r.technical)}),{text:a.join(``).replace(/\n{3,}/g,` + +`).trim(),technical:o.join(` `)}}function Jc(e,t){let n=e.split(/(\r?\n)/),r=n.findIndex((e,t)=>t%2==0&&e.trim()!==``),i=n[r]?.trim()??``,a=i.match(/^(?:Task continued|任务已继续)(?: · (.+))?$/),o=i.match(/^Could not complete (.+)\.$/)??i.match(/^未能完成:(.+)。$/);if(!a&&!o)return null;let s=t===`zh-CN`,c=[],l=``,u=!1;return{text:n.map((e,n)=>{if(n%2==1)return e;if(n===r){if(a){let e=a[1]??``,n=e.match(/^(.*?) · review=(\S+)$/),r=n?n[1]:e;return[s?`当时记录:工作继续推进。`:`Recorded then: work continued.`,r?`${s?`任务:`:`Task: `}${r}`:``,n?`${s?`当时记录的审阅状态:`:`Review status recorded then: `}${Vc(n[2],t)}`:``].filter(Boolean).join(` +`)}let e=o[1];return/^(?:the current task|当前任务)$/.test(e)?s?`当时这项任务未能完成。`:`This task had not completed at that time.`:s?`当时未能完成:${e}。`:`Not completed at that time: ${e}.`}if(/^(?:Progress|Mission summary|本次进展|本次完成)[::]/.test(e)&&(u=!0),u)return e;let i=e.match(/^\s*(`{3,}|~{3,})/);if(i)return l?l===i[1][0]&&(l=``):l=i[1][0],e;if(l)return e;if(/^(?:Nothing is queued yet; the Planner is deciding what comes next\.|计划里暂时没有下一项,Planner 正在决定接下来做什么。)$/.test(e))return s?`当时尚未排入下一项任务,规划者还在决定接下来做什么。`:`At that time, nothing was queued and the Planner was still deciding what to do next.`;let d=e.match(/^(?:Next(?: action| up)?|下一步|接下来做)[::]\s*(.*)$/);if(d){let e=/^(?:Argus will diagnose the failure and choose a safe next step\.|Argus 会诊断原因并选择可恢复的方案。)$/.test(d[1])?s?`诊断当时的原因,再选择可恢复的方案。`:`Diagnose the cause and choose a recovery approach.`:d[1];return`${s?`当时记录的下一步:`:`Next step recorded at the time: `}${e}`}let f=e.match(/^(?:Reason:|原因:)\s*(.*)$/);if(f){let e=ua(f[1]);if(e.prose===`Argus was stopped by its operator in the middle of this round; the Engineer's work so far is kept and nothing was retried.`){let t=da(f[1],s);return e.receipt&&c.push(e.receipt),s?`当时${t.summary}。已做的工作保留,当时没有重试。`:`At that time, ${t.summary}. Work done so far was kept, and no retry was made then.`}let n=qc(f[1],t);if(n.text!==f[1].trim()||n.technical)return n.technical&&c.push(n.technical),`${s?`当时记录的原因:`:`Reason recorded at the time: `}${n.text}`}return la.test(e.trim())?(c.push(e),``):e}).join(``),technical:c.join(` +`)}}var Yc=3,Xc=`engineer.progress`,Zc=new Set([`tool_use`,`command_execution`,`file_change`]),Qc=[`assistant_message`,`agent_message`,`message`],$c=e=>e,el=(e,t)=>String($c(e)[t]??``),tl=e=>el(e,`type`)===Xc?el(e,`kind`):``;function nl(e,{locale:t,showReasoning:n,filter:r=`all`,query:i=``}){let a=[],o=new Map,s=0,c={locale:t,showReasoning:n,unknownEventPolicy:`hide`,density:`compact`};return e.forEach(e=>{let t=xc(e,c);if(!t){!n&&fe(e)&&s++;return}if(!ve(e,t,r,i))return;let l=el(e,`message_id`),u=!!l&&el(e,`type`)===Xc&&Qc.includes(el(e,`kind`));if(u&&o.has(l)){let n=o.get(l);a[n]={...a[n],ev:{...a[n].ev,...e},r:{...a[n].r,...t,text:Ie(a[n].r.text,t.text,Le(e))}};return}let d={ev:e,r:t,key:Re(e)};u&&o.set(l,a.length),a.push(d)}),{list:a,hiddenReasoning:s}}function rl(e){let t=el(e,`tool_name`)||el(e,`tool`)||el(e,`name`);if(t)return t;let n=el(e,`text`).match(/^([A-Za-z_][\w.-]{0,40}):\s/);return n?n[1]:``}function il(e){let t=el(e,`status`).toLowerCase();if(t===`running`||t===`started`||t===`in_progress`||t===`pending`)return`running`;if(t===`failed`||t===`error`||t===`errored`)return`failed`;let n=$c(e).exit_code;return typeof n==`number`&&n!==0?`failed`:[`completed`,`complete`,`success`,`succeeded`,`done`,`ok`,`finished`].includes(t)?`completed`:``}function al(e,t){let n=el(t,`call_id`),r=el(e.ev,`call_id`);return n&&r?n===r:tl(e.ev)===tl(t)&&rl(e.ev)===rl(t)&&el(e.ev,`text`)===el(t,`text`)}var ol=(e,t)=>({kind:`step`,key:e.key,ev:e.ev,r:e.r,latest:e.ev,repeat:1,status:t});function sl(e){let t=[],n=[],r=(e,t,r,i)=>{let[a]=n.splice(e,1);a.status=r,a.latest=t,i&&(a.result=i)};for(let i of e){let e=tl(i.ev);if(Zc.has(e)){let e=il(i.ev);if(e!==`running`){let t=n.length-1;for(;t>=0&&!al(n[t],i.ev);)--t;if(t>=0){r(t,i.ev,e||`completed`);continue}}let a=ol(i,e);t.push(a),e===`running`&&n.push(a);continue}if(e===`tool_result`){let e=el(i.ev,`call_id`),t=rl(i.ev),a=e?n.findIndex(t=>el(t.ev,`call_id`)===e):n.findIndex(e=>!t||rl(e.ev)===t);if(a>=0){r(a,i.ev,il(i.ev)||`completed`,i);continue}}t.push(ol(i,``))}return t}var cl=/fail|error|backoff|stall|denied|blocked|nudge|escalat/i,ll=/\b(?:fail(?:ed|ure)?|error|unavailable|unreachable|exited with code|backoff|retry(?:ing)?|stuck|skipped)\b/i;function ul(e){if(tl(e.ev))return!1;let t=e.ev;return e.r.tone===`err`||e.r.tone===`warn`||cl.test(el(t,`type`))||$c(t).backend_unavailable===!0||$c(t).review_skipped===!0||ll.test(e.r.text)}var dl=e=>e.toLowerCase().replace(/\d+(?:\.\d+)?/g,`#`).replace(/\s+/g,` `).trim();function fl(e){let t=e.ev;return dl(el(t,`signature`)||el(t,`cause`)||el(t,`backend_error`)||el(t,`error`)||el(t,`reason`)||el(t,`stop_kind`)||e.r.text)}function pl(e,t){return ul(e)?`fail|${e.r.role}|${el(e.ev,`type`)}|${fl(e)}`:`text|${e.r.role}|${e.r.glyph}|${qc(e.r.text,t).text}`}function ml(e,t){e.repeat+=t.repeat,e.latest=t.latest,e.r=t.r,t.status&&(e.status=t.status),t.result&&(e.result=t.result)}function hl(e,t){let n=[],r=[];for(let i of e){let e=pl(i,t),a=n[n.length-1];if(a&&r[r.length-1]===e){ml(a,i);continue}n.push({...i}),r.push(e)}let i=r.map((e,t)=>tl(n[t].ev)?e:dl(e)),a=(e,t)=>{if(e+2*t>n.length)return!1;for(let n=0;ne.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,bl=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,xl=e=>bl(e.replace(/^[a-z]+:\/\/(?:www\.)?/i,``).replace(/#.*$/,``).replace(/\/$/,``),48),Sl=/\*\*\* (?:Add|Update|Delete|Move to) File:\s*(\S+)/;function Cl(e,t,n){for(let r of n){if(e){let t=e[r];if(typeof t==`string`&&t.trim())return t.trim();if(Array.isArray(t)&&typeof t[0]==`string`&&t[0].trim())return t[0].trim();continue}let n=t.match(RegExp(`"${r}":\\s*"((?:[^"\\\\]|\\\\.)*)"`));if(n&&n[1])return n[1].replace(/\\(.)/g,`$1`)}return``}function wl(e){return Tl(e.ev)}function Tl(e){let t=el(e,`text`);if(tl(e)===`file_change`){let e=t.match(Sl);if(e)return yl(e[1].trim());let n=t.match(/^(\S+\.[A-Za-z0-9]{1,8})\b/);return n?yl(n[1]):``}let n=t.replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),r=null;if(n.startsWith(`{`))try{let e=JSON.parse(n);r=e&&typeof e==`object`&&!Array.isArray(e)?e:null}catch{r=null}let i=Cl(r,n,[`path`,`file_path`,`filePath`,`file`,`filename`,`target_file`,`notebook_path`,`paths`]);if(i&&!/^\.\/?$/.test(i))return yl(i);let a=Cl(r,n,[`url`,`uri`]);if(a)return xl(a);let o=Cl(r,n,[`pattern`,`query`,`regex`,`glob`,`q`]);if(o)return bl(o,32);let s=n.match(Sl);return s?yl(s[1].trim()):``}function El(e,t){let n=t===`zh-CN`,r=e.trim().replace(/\\/g,`/`).split(`/`).filter(e=>e&&e!==`**`&&e!==`.`),i=r[r.length-1]??`*`,a=r.slice(0,-1).filter(e=>!/[*?]/.test(e)),o;o=i===`*`||i===`*.*`?n?`所有文件`:`all files`:/^\*\.[\w.]+$/.test(i)?n?`${i.slice(1)} 文件`:`${i.slice(1)} files`:bl(i,40);let s=a[a.length-1];return s?n?`${s} 里的 ${o}`:`${o} in ${s}`:o}var Dl=/^(glob|find|find_?files|list_?files|file_?search)$/i;function Ol(e,t){let n=t===`zh-CN`,r=rl(e),i=_l(r,tl(e)),a=Tl(e);if(i===`search`){let t=Cl(null,el(e,`text`).replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),[`pattern`,`query`,`regex`,`glob`,`q`]);t&&(a=bl(t,48))}if(i===`search`&&Dl.test(r)&&a)return`${n?`查找`:`Find`} ${El(a,t)}`;let o=a.startsWith(`/`)?yl(a):a,[s,c,l,u]={read:[`查阅`,`查阅文件`,`Read`,`Read a file`],search:[`搜索:`,`搜索`,`Search:`,`Search`],fetch:[`读取`,`读取网页`,`Open`,`Open a page`],edit:[`修改`,`修改文件`,`Edit`,`Edit a file`],tool:[`调用`,`调用工具`,`Use`,`Use a tool`]}[i],d=i===`tool`?r:o;if(!d)return n?c:u;let f=n?s:l;return f.endsWith(`:`)?`${f}${d}`:`${f} ${d}`}function kl(e,t){let n=tl(e);return n===`command_execution`?{title:t===`zh-CN`?`正在运行命令`:`Running a command`,detail:``}:[`tool_use`,`file_change`].includes(n)?{title:{read:[`查看资料`,`Reading material`],search:[`查找相关信息`,`Searching for relevant information`],fetch:[`读取资料页面`,`Reading a source page`],edit:[`更新项目文件`,`Updating project files`],tool:[`执行一个工作步骤`,`Carrying out a work step`]}[_l(rl(e),n)][t===`zh-CN`?0:1],detail:Tl(e)}:null}function Al(e){let t=e[0],n=e[e.length-1],r=rl(t.ev)||(tl(t.ev)===`file_change`?`file`:`tool`),i=_l(r,tl(t.ev)),a=[],o=0;for(let t of e){let e=wl(t);e&&(o+=1,a.includes(e)||a.push(e))}let s=e.reduce((e,t)=>e+t.repeat,0),c=i===`read`||i===`edit`||i===`fetch`;return{kind:`group`,key:`group:${t.key}`,r:{...t.r,text:``},latest:n.latest,tool:r,action:i,steps:e,targets:a,count:c&&o===e.length?a.length:s,calls:s,failed:e.filter(e=>e.status===`failed`).length}}function jl(e){let t=[],n=[],r=null,i=()=>{n.length>=3?t.push(Al(n)):t.push(...n),n=[],r=null};for(let a of e){let e=vl(a);if(e&&(r===null||r===e)){n.push(a),r=e;continue}i(),e?(n.push(a),r=e):t.push(a)}return i(),t}function Ml(e,t){return jl(hl(sl(e),t))}function Nl(e,t,n){let r=t(`stream.fold.${e.action}`,{count:e.count,tool:e.tool}),i=e.targets.slice(0,Yc);return`${r}${i.length?`${n===`zh-CN`?`:`:`: `}${i.join(n===`zh-CN`?`、`:`, `)}${e.targets.length>i.length?`…`:``}`:``}${e.failed?` · ${t(`stream.fold.failed`,{count:e.failed})}`:``}`}function Pl(e,t,n){return e.kind===`group`?Nl(e,t,n):qc(e.r.text,n).text}var Fl=new Set([`tool_use`,`command_execution`,`file_change`]),Il=new Set([`completed`,`failed`,`cancelled`,`canceled`,`error`,`done`,`stopped`]),Ll=()=>Date.now()/1e3;function Rl(e){return e.trim().replace(/[.…]+$/u,``).toLowerCase()}function zl(e,t,n=Ll()){let r=(t.label??``).trim();if(!r)return e;let i=t.heartbeat===!0,a=e.slice(),o=(t.callId??``).trim(),s=(t.status??``).trim().toLowerCase(),c=(t.kind??``).trim();if(o){let e=-1;for(let t=a.length-1;t>=0;--t)if(a[t].callId===o){e=t;break}if(e>=0){let i=a[e];return a[e]={...i,label:c===`tool_result`?i.label:r,detail:(t.detail||``).trim()||i.detail,tool:(t.tool||``).trim()||i.tool,output:(t.output||``).trim()||i.output,status:s||i.status,endedTs:Il.has(s)?n:i.endedTs},a}if(c===`tool_result`)return a}let l=a[a.length-1];if(c===`tool_result`)return!l||l.endedTs||l.heartbeat||(a[a.length-1]={...l,output:(t.output||``).trim()||l.output,status:s||`completed`,endedTs:n}),a;if(l&&!l.endedTs){if(Rl(l.label)===Rl(r)||i&&l.heartbeat)return a[a.length-1]={...l,label:r,detail:t.detail||l.detail,kind:t.kind||l.kind,heartbeat:i,endedTs:0},a;l.callId||(a[a.length-1]={...l,endedTs:n})}return a.push({id:`${a.length}:${r}:${n}`,role:(t.role||`manager`).trim()||`manager`,label:r,detail:(t.detail||``).trim(),kind:c,startedTs:n,endedTs:0,heartbeat:i,...t.tool?.trim()?{tool:t.tool.trim()}:{},...t.toolKind?.trim()?{toolKind:t.toolKind.trim()}:{},...o?{callId:o}:{},...s||o?{status:s||`running`}:{},...t.output?.trim()?{output:t.output.trim()}:{}}),a}function Bl(e,t=Ll()){return e.length===0?[]:e.map(e=>e.endedTs?e:{...e,endedTs:t})}function Vl(e){if(!Number.isFinite(e)||e<1)return``;if(e<60)return`${Math.floor(e)}s`;let t=Math.floor(e/60),n=Math.floor(e%60);return n?`${t}m${n}s`:`${t}m`}function Hl(e,t=Ll(),n=!1){return e.filter(e=>!e.heartbeat&&Fl.has(e.kind)).map(e=>{let r=!e.endedTs&&(!e.status||e.status===`running`)?n?`completed`:`running`:e.status||`completed`;return{kind:e.kind,label:e.label,...e.detail?{detail:e.detail}:{},...e.tool?{tool:e.tool}:{},...e.toolKind?{tool_kind:e.toolKind}:{},...e.callId?{call_id:e.callId}:{},status:r,started_ts:e.startedTs,ended_ts:e.endedTs||(n?t:0),...e.output?{output:e.output}:{}}})}var Ul=e=>typeof e==`string`?e.trim():``,Wl=e=>typeof e==`number`&&Number.isFinite(e)?e:0;function Gl(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(e=>{if(!e||typeof e!=`object`)return;let n=e,r=Ul(n.label);r&&t.push({kind:Ul(n.kind)||`tool_use`,label:r,...Ul(n.detail)?{detail:Ul(n.detail)}:{},...Ul(n.tool)?{tool:Ul(n.tool)}:{},...Ul(n.tool_kind)?{tool_kind:Ul(n.tool_kind)}:{},...Ul(n.call_id)?{call_id:Ul(n.call_id)}:{},status:Ul(n.status).toLowerCase()||`completed`,started_ts:Wl(n.started_ts),ended_ts:Wl(n.ended_ts),...Ul(n.output)?{output:Ul(n.output)}:{}})}),t}function Kl(e,t=Ll()){if(!e.length)return 0;let n=Math.min(...e.map(e=>e.started_ts||t)),r=Math.max(...e.map(e=>e.ended_ts||t));return Math.max(0,r-n)}var ql={command_execution:st,tool_use:vn,file_change:Zt},Jl=new Set([`failed`,`error`]),Yl=new Set([`cancelled`,`canceled`,`stopped`]),Xl=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,Zl=/^⚙\s*([\w.-]+)\s*·\s*(.*)$/su;function Ql(e,t=`zh-CN`){let n=(e.tool??``).trim(),r=(e.detail??``).trim(),i=e.label.match(Zl);if(i){let e=i[1],a=r||i[2];return{primary:Ol({type:`engineer.progress`,kind:`tool_use`,tool_name:n||e,text:`${e}: ${a}`},t),secondary:a}}let a=e.label.replace(Xl,``).trim();return{primary:a||n,secondary:r&&r!==a?r:``}}function $l({steps:e,live:t,startedTs:n,status:r=``}){let{t:i,locale:a}=z(),[o,s]=(0,G.useState)(!1),[,c]=(0,G.useState)(0);if((0,G.useEffect)(()=>{if(!t)return;let e=setInterval(()=>c(e=>e+1),1e3);return()=>clearInterval(e)},[t]),(0,G.useEffect)(()=>{t||s(!1)},[t]),!e.length&&!t)return null;let l=Date.now()/1e3,u=Jl.has(r)||e.some(e=>Jl.has(e.status)),d=Yl.has(r)||e.some(e=>Yl.has(e.status)),f=Vl(t&&n?Math.max(0,l-n):Kl(e,l))||`<1s`,p=[...e].reverse().find(e=>e.status===`running`),m=t?`${p?Ql(p,a).primary:a===`zh-CN`?`正在准备回复`:`Preparing a reply`} · ${f}`:u?`${a===`zh-CN`?`过程出现问题,请查看详情`:`An issue occurred; see details`} · ${f}`:d?`${a===`zh-CN`?`已停止`:`Stopped`} · ${f}`:i(`chat.stepsDone`,{count:e.length,seconds:f});return(0,J.jsxs)(`div`,{className:`turn-steps mt-3 rounded-lg border border-line/50 bg-surface/50 text-xs`,"data-live":t||void 0,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,"aria-label":a===`zh-CN`?`查看工作过程`:`View work progress`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-ink-dim hover:text-ink`,children:[(0,J.jsx)(t?nn:u?Gt:d?mn:We,{size:14,"aria-hidden":`true`,className:`shrink-0 ${t?`animate-spin text-manager motion-reduce:animate-none`:u?`text-err`:d?`text-ink-faint`:`text-ok`}`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:m}),(0,J.jsx)(o?Ue:Ut,{size:14,"aria-hidden":`true`,className:`shrink-0 text-ink-faint`})]}),o?(0,J.jsxs)(`ol`,{className:`space-y-1 border-t border-line/40 px-3 py-2`,children:[!e.length&&(0,J.jsx)(`li`,{className:`text-ink-faint`,children:a===`zh-CN`?`尚未记录工具操作。`:`No tool operations recorded yet.`}),e.map((e,n)=>{let{primary:r,secondary:o}=Ql(e,a),s=e.status===`running`,c=Jl.has(e.status),u=Yl.has(e.status),d=e.kind===`command_execution`?ql.command_execution:e.kind===`file_change`?ql.file_change:ql.tool_use,f=Vl(Math.max(0,(e.ended_ts||l)-e.started_ts));return(0,J.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(d,{size:13,"aria-hidden":`true`,className:`shrink-0 self-start mt-0.5 ${c?`text-err`:`text-ink-faint`}`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`${s&&t?`text-ink`:c?`text-err`:`text-ink-dim`}`,title:o||r,children:r}),o?(0,J.jsxs)(`details`,{className:`turn-step-raw inline`,children:[(0,J.jsx)(`summary`,{className:`ml-2 inline cursor-pointer list-none text-[11px] text-ink-faint hover:text-ink-dim`,children:i(`chat.stepRaw`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block break-all font-mono text-[11px] text-ink-faint`,children:o})]}):null,c&&e.output?(0,J.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-err/80`,children:e.output}):null]}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono tabular-nums ${s&&t?`text-manager`:`text-ink-faint`}`,children:s&&t?(0,J.jsx)(nn,{size:12,className:`animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):c?i(`chat.stepFailed`):u?a===`zh-CN`?`已停止`:`Stopped`:f})]},e.call_id||`${n}:${e.started_ts}`)})]}):null]})}function eu({snapshot:e,view:t,events:n=[],connected:r,compact:i=!1}){let{locale:a}=z(),o=a===`zh-CN`,[s,c]=(0,G.useState)(()=>Date.now()/1e3);(0,G.useEffect)(()=>{let e=window.setInterval(()=>c(Date.now()/1e3),1e4);return()=>window.clearInterval(e)},[]);let l=ai(e,t,n,s),u=l.activityAgeSeconds,d=l.waitingOn?``:u===null?o?`暂无本次运行的进展记录`:`No progress recorded for this run yet`:u<60?o?`刚刚有进展`:`Progress in the last minute`:u<3600?o?`${Math.floor(u/60)} 分钟前有进展`:`Progress ${Math.floor(u/60)} min ago`:o?`${Math.floor(u/3600)} 小时前有进展`:`Progress ${Math.floor(u/3600)} hr ago`;return(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-line/60 bg-panel px-4 py-2.5 text-xs`,"data-testid":`work-status`,"data-state":l.state,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r?l.state===`running`?`bg-blue`:`bg-ink-faint`:`bg-warn`}`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:ui(l,a,r)}),d?(0,J.jsx)(`time`,{className:`text-ink-faint`,dateTime:l.activityAt?new Date(l.activityAt*1e3).toISOString():void 0,children:d}):null]}),r?!i&&l.title?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-ink-dim`,title:l.title,children:l.title}):null:(0,J.jsx)(`p`,{className:`mt-1 leading-5 text-ink-faint`,children:o?`这里保留的是已收到的记录;连接恢复后继续更新。`:`These are the records already received. Updates resume when the connection returns.`})]})}var tu=/Info: (?:Operation cancelled by user|Response was interrupted due to a server error\. Retrying\.\.\.)/gi;function nu({ev:e,r:t,first:n,last:r,latest:i,repeat:a=1,status:o=``,result:s}){let{locale:c,t:l}=z(),u=B.role[t.role]??B.inkFaint,d=He(t.tone),f=e.type===`engineer.progress`&&String(e.kind||``)===`tool_use`,p=[`agent_message`,`assistant_message`,`message`].includes(String(e.kind||``))?ba(t.text):t.text,m=f?{text:Ol(e,c),technical:t.text}:qc(p,c),h=s?qc(s.r.text,c).text:``,g=[m.technical,h?`${l(`stream.stepResult`)}: ${h}`:``].filter(Boolean).join(` +`);return(0,J.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${r?`animate-appear`:``} ${t.reasoning?`opacity-60`:``}`,style:t.rule?{marginTop:4}:void 0,children:[(0,J.jsxs)(`div`,{className:`relative flex justify-center`,children:[n?null:(0,J.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),r?null:(0,J.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,J.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:u,boxShadow:`0 0 0 1px ${u}55`}})]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:u},title:t.label,children:t.label}),(0,J.jsx)(`span`,{className:`text-xs`,style:{color:d},children:t.glyph}),a>1?(0,J.jsxs)(`span`,{className:`rounded bg-line/60 px-1 font-mono text-[10px] tabular-nums text-ink-dim`,title:l(`stream.repeated`,{count:a}),"data-repeat":a,children:[`×`,a]}):null,o===`failed`?(0,J.jsx)(`span`,{className:`text-xs text-err`,children:l(`stream.stepFailed`)}):null,(0,J.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:Ct(i??e)})]}),(0,J.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5 ${t.reasoning?`italic`:``}`,style:{color:d},title:g||void 0,children:m.text})]})]})}function ru({group:e,first:t,last:n,open:r,onToggle:i}){let{locale:a,t:o}=z(),s=B.role[e.r.role]??B.inkFaint,c=He(e.r.tone),l=Nl(e,o,a);return(0,J.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${n?`animate-appear`:``}`,"data-feed-group":e.action,"data-open":r?`true`:`false`,children:[(0,J.jsxs)(`div`,{className:`relative flex justify-center`,children:[t?null:(0,J.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),n?null:(0,J.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,J.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:s,boxShadow:`0 0 0 1px ${s}55`}})]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":r,title:o(r?`stream.fold.collapse`:`stream.fold.expand`),className:`block w-full rounded text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-blue-sky`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:s},title:e.r.label,children:e.r.label}),(0,J.jsx)(`span`,{className:`text-xs`,style:{color:c},children:e.r.glyph}),(0,J.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-ink-faint`,children:e.calls}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})}),(0,J.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:Ct(e.latest)})]}),(0,J.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5`,style:{color:c},children:l})]}),r?(0,J.jsx)(`div`,{className:`mt-1 border-l border-line/50`,children:e.steps.map((t,n)=>(0,J.jsx)(nu,{ev:t.ev,r:t.r,first:n===0,last:n===e.steps.length-1,latest:t.latest,repeat:t.repeat,status:t.status,result:t.result},t.key))}):null]})]})}function iu({rows:e}){let[t,n]=(0,G.useState)(()=>new Set),r=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,J.jsx)(J.Fragment,{children:e.map((n,i)=>n.kind===`group`?(0,J.jsx)(ru,{group:n,first:i===0,last:i===e.length-1,open:t.has(n.key),onToggle:()=>r(n.key)},n.key):(0,J.jsx)(nu,{ev:n.ev,r:n.r,first:i===0,last:i===e.length-1,latest:n.latest,repeat:n.repeat,status:n.status,result:n.result},n.key))})}function au({ev:e,r:t,artifacts:n,onOpenArtifact:r}){let{t:i,locale:a}=z(),o=String(e.type)===`ui.operator`,s=!o&&e.mission_result===!0,c=s&&typeof e.text==`string`?e.text:t.text,l=s?Jc(c,a):null,u=s?Tt(e):null,d=o?to(t.text):null,f=d?.refs??[],p=d&&f.length?d.text:t.text,m=o?[]:Gl(e.steps),h=Number(e.response_latency_ms??0),g=!o&&h>=100?` · ${(h/1e3).toFixed(1)}s`:``,_=(0,G.useRef)(null);return it(_,(e,t)=>{_.current&&(t||e.fromTo(_.current,{autoAlpha:0,x:o?12:0,y:o?0:8},{autoAlpha:1,x:0,y:0,duration:.28,ease:`power2.out`,clearProps:`transform,opacity,visibility`}))}),(0,J.jsx)(`article`,{ref:_,"data-task-receipt":s||void 0,"data-task-receipt-id":s?String(e.message_id||e.event_id||``):void 0,className:`conversation-row group mx-auto w-full max-w-full px-4 py-3 sm:px-6 lg:max-w-[61.8vw]`,children:o?(0,J.jsxs)(`div`,{className:`flex items-end justify-end gap-2`,children:[(0,J.jsx)(Qe,{text:t.text,label:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,J.jsx)(`time`,{className:`shrink-0 pb-1 font-mono text-[10px] tabular-nums text-ink-faint`,children:Ct(e)}),(0,J.jsxs)(`div`,{className:`max-w-[calc(100%_-_3rem)] rounded-[18px] bg-conversation-user px-4 py-2.5 text-[15px] leading-relaxed text-ink ring-1 ring-line/35 sm:max-w-[82%]`,children:[f.length?(0,J.jsx)(`div`,{className:`mb-2 space-y-2`,children:f.map((e,t)=>(0,J.jsxs)(`blockquote`,{"aria-label":a===`zh-CN`?`引用`:`Reference`,className:`border-l-2 border-blue/40 pl-3 text-sm text-ink-dim`,children:[(0,J.jsxs)(`div`,{className:`text-xs text-ink-faint`,children:[a===`zh-CN`?`引用`:`Reference`,e.part?` · ${a===`zh-CN`?`第 ${e.part} 部分`:`Part ${e.part}`}`:``]}),(0,J.jsx)(`div`,{className:`font-medium`,children:e.task_title||e.step_title||e.task_id}),e.task_title&&e.step_title&&e.step_title!==e.task_title?(0,J.jsx)(`div`,{children:e.step_title}):null]},`${e.source}:${e.task_id}:${e.step_id}:${t}`))}):null,p?(0,J.jsx)(H,{artifacts:n,onOpenArtifact:r,children:p}):null]})]}):(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center`,children:(0,J.jsx)(At,{size:26,className:`text-ink`})}),(0,J.jsxs)(`div`,{className:`relative min-w-0 flex-1 text-[15px] leading-relaxed text-ink`,children:[(0,J.jsxs)(`div`,{"data-task-receipt-header":s||void 0,className:s?`sticky -top-1.5 z-10 mb-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 bg-panel py-1`:`mb-1 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-blue`,children:te().name}),s?(0,J.jsx)(`span`,{className:`text-[11px] text-ink-dim`,children:a===`zh-CN`?`任务回报 · 当时记录`:`Task report · Recorded then`}):null,(0,J.jsx)(Qe,{text:c,label:l?a===`zh-CN`?`复制原始回报`:`Copy original report`:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`ml-auto opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,J.jsxs)(`time`,{className:`font-mono text-[10px] tabular-nums text-ink-faint ${s?`basis-full sm:basis-auto`:``}`,dateTime:u?.toISOString(),title:u?.toLocaleString(a,{dateStyle:`full`,timeStyle:`long`}),children:[u?u.toLocaleString(a,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):Ct(e),g]})]}),c?(0,J.jsx)(`div`,{"data-task-receipt-prose":s||void 0,children:(0,J.jsx)(H,{artifacts:n,onOpenArtifact:r,children:l?.text??c})}):null,m.length||e.live===!0?(0,J.jsx)($l,{steps:m,live:e.live===!0,startedTs:Number(e.ts),status:e.success===!1?`failed`:String(e.status??``)}):null,l?(0,J.jsx)(ft,{className:`task-receipt-original`,label:a===`zh-CN`?`查看原始回报(含技术记录)`:`View original report (including technical records)`,children:(0,J.jsx)(`pre`,{"data-task-receipt-original":!0,className:`mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs text-ink-dim`,children:c})}):null]})]})})}function ou({role:e,rows:t,open:n,active:r,onToggle:i}){let{t:a,locale:o}=z(),s=B.role[e],c=(0,G.useRef)(null),l=(0,G.useRef)(!0),u=(0,G.useRef)(0),[d,f]=(0,G.useState)(!1),p=t[t.length-1]?.r.text.length??0,m=(0,G.useMemo)(()=>Ml(t,o),[t,o]),h=m.length?Pl(m[m.length-1],a,o):``;return(0,G.useEffect)(()=>{n&&!l.current&&c.current&&(c.current.scrollTop=u.current)},[n]),(0,G.useEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{l.current&&c.current&&(c.current.scrollTop=c.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[n,t.length,p]),(0,J.jsxs)(`section`,{className:`role-log-group border-b border-line/50`,"data-role":e,"data-open":n?`true`:`false`,"data-active":r?`true`:`false`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":n,className:`group flex h-11 w-full items-center gap-2 px-4 text-left transition-colors hover:bg-bg/60`,children:[(0,J.jsx)(`span`,{"data-role-dot":e,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:s}}),(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink-dim`,children:Ln(e,a)}),(0,J.jsx)(`span`,{className:`font-mono text-xs text-ink-faint`,children:m.length}),h?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:h}):(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${n?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),n?(0,J.jsx)(`div`,{className:`grid grid-rows-[1fr]`,children:(0,J.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden`,children:[(0,J.jsx)(`div`,{ref:c,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollTop,l.current=t.scrollHeight-t.scrollTop-t.clientHeight<=2,f(!l.current)},className:`max-h-72 overflow-x-hidden overflow-y-auto border-t border-line/40 scroll-thin`,children:m.length>0?(0,J.jsx)(iu,{rows:m}):(0,J.jsx)(`div`,{className:`px-4 py-3 text-xs text-ink-faint`,children:a(`stream.noLogs`)})}),d?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{l.current=!0,f(!1),c.current&&(c.current.scrollTop=c.current.scrollHeight)},className:`absolute bottom-2 right-3 rounded-full border border-line/60 bg-panel px-3 py-1 text-xs text-ink-dim shadow-glow hover:text-ink`,children:[`↓ `,a(`stream.jumpToLatest`)]}):null]})}):null]})}function su(e){let t={manager:[],planner:[],engineer:[],reviewer:[]},n=[];return e.forEach(e=>{et.includes(e.r.role)?t[e.r.role].push(e):n.push(e)}),{roleRows:t,systemRows:n,lastRole:[...e].reverse().find(e=>et.includes(e.r.role))?.r.role??``}}function cu({rows:e}){let{t,locale:n}=z(),[r,i]=(0,G.useState)(!1),a=(0,G.useMemo)(()=>Ml(e,n),[e,n]);return(0,J.jsxs)(`section`,{className:`border-b border-line/50`,"data-system-open":r?`true`:`false`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex h-10 w-full items-center gap-2 px-4 text-left text-xs text-ink-faint hover:bg-bg/60`,children:[(0,J.jsx)(`span`,{children:t(`stream.system`)}),(0,J.jsx)(`span`,{className:`font-mono`,children:a.length}),(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),r?(0,J.jsx)(`div`,{className:`border-t border-line/40`,children:(0,J.jsx)(iu,{rows:a})}):null]})}function lu({rows:e,live:t,followLatest:n,activeRole:r,activeTaskId:i}){let{roleRows:a,systemRows:o,lastRole:s}=(0,G.useMemo)(()=>su(e),[e]),[c,l]=(0,G.useState)(()=>new Set(n&&s?[s]:[])),u=(0,G.useRef)(!1);return(0,G.useEffect)(()=>{!n||!s||u.current||l(new Set([s]))},[s,n]),(0,J.jsxs)(`div`,{className:`bg-bg/25`,children:[et.map(e=>(0,J.jsx)(ou,{role:e,rows:a[e],open:c.has(e),active:t&&(r??s)===e&&(!i||a[e].some(e=>ei(e.ev)===i)),onToggle:()=>{u.current=!0,l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}},e)),o.length>0?(0,J.jsx)(cu,{rows:o}):null]})}function uu(e){let t=e.delivery;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.delivery_id!=`string`||!n.delivery_id.trim()?null:n}function du(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.type===`ui.operator`)return null;let r=uu(n);if(r)return r}}function fu({delivery:e,onOpen:t}){let{t:n}=z(),r=e.kind===`submission_certified`;return(0,J.jsxs)(`aside`,{className:`mx-auto my-3 flex w-full max-w-full gap-3 rounded-lg border border-ok/35 bg-ok/5 px-4 py-3 lg:max-w-[61.8vw]`,children:[(0,J.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-ok/15 font-semibold text-ok`,children:`✓`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-ok`,children:n(r?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,J.jsx)(`div`,{className:`mt-1 truncate text-sm font-semibold text-ink`,title:e.title,children:e.title}),t?(0,J.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`mt-2 rounded border border-ok/40 px-2 py-1 font-mono text-[10px] text-ok hover:border-ok hover:bg-ok/10`,children:n(e.primary_target?`mission.openResult`:`mission.viewTask`)}):null]})]})}function pu({group:e,artifacts:t,onOpenArtifact:n,onOpenDelivery:r}){let i=e=>e.ev.type===`ui.argus`&&/^(info:|operation cancelled|cancelled\b)/i.test(e.r.text.trim()),a=e.rows.filter(e=>e.ev.type===`ui.argus`).map(e=>{if(e.ev.mission_result===!0)return{reply:e,messages:[]};let t=e.r.text.match(tu)??[],n=e.r.text.replace(tu,``).trim(),r=e.ev.live===!0||Array.isArray(e.ev.steps)&&e.ev.steps.length>0;return{reply:(n||r)&&!i(e)?{...e,r:{...e.r,text:n}}:null,messages:i(e)&&t.length===0?[e.r.text]:t}}),o=a.flatMap(e=>e.reply?[e.reply]:[]),s=a.flatMap(e=>e.messages),c=(()=>{let t=new Set;return e.rows.flatMap(e=>{let n=uu(e.ev);return!n||t.has(n.delivery_id)?[]:(t.add(n.delivery_id),[n])})})();return(0,J.jsxs)(`section`,{className:`conversation-thread border-b border-line/60`,children:[(0,J.jsx)(au,{ev:e.operator.ev,r:e.operator.r,artifacts:t,onOpenArtifact:n}),o.map(e=>(0,J.jsx)(au,{ev:e.ev,r:e.r,artifacts:t,onOpenArtifact:n},e.key)),s.map((t,n)=>(0,J.jsx)(`div`,{className:`mx-auto w-full max-w-full px-6 py-1.5 text-center text-xs text-ink-faint lg:max-w-[61.8vw]`,children:t},`${e.key}-system-${n}`)),c.map(e=>(0,J.jsx)(fu,{delivery:e,onOpen:r},e.delivery_id))]})}function mu({events:e,connected:t,showReasoning:n,onToggleReasoning:r,embedded:i=!1,showHeader:a=!0,filter:o=`all`,query:s=``,skipFirst:c=0,artifacts:l,onOpenArtifact:u,onOpenDelivery:d,snapshot:f,missionView:p,historyStatus:m=`ready`,historyRefreshing:h=!1,onRetryHistory:g}){let{locale:_,t:v}=z(),[y,b]=(0,G.useState)(!0),x=(0,G.useRef)(!0),S=(0,G.useRef)(0),[C,w]=(0,G.useState)(()=>Date.now()),T=(0,G.useRef)(null),E=(0,G.useRef)(null),D=(0,G.useDeferredValue)(e),O=(0,G.useMemo)(()=>f?ai(f,p,D):null,[D,p,f]),k=t&&(!f||O?.state===`running`),A=(0,G.useMemo)(()=>f||!t?null:ni(D),[t,D,f]);(0,G.useEffect)(()=>{if(!A)return;w(Date.now());let e=window.setInterval(()=>w(Date.now()),1e3);return()=>window.clearInterval(e)},[A]);let j=A?Math.max(0,Math.floor((C-Number(A.ts??0)*1e3)/1e3)):0,M=(0,G.useMemo)(()=>nl(c>0?D.slice(c):D,{locale:_,showReasoning:n,filter:o,query:s}),[D,n,o,s,c,_]),ee=(0,G.useMemo)(()=>{let e=[],t=[],n=[],r=null;M.list.forEach(i=>{i.ev.type===`ui.operator`?(r={key:i.key,operator:i,rows:[]},e.push(r)):i.ev.type===`ui.argus`?r?r.rows.push(i):t.push(i):n.push(i)});let i=new Set(M.list.filter(e=>e.ev.type===`ui.argus`).map(e=>uu(e.ev)?.delivery_id).filter(Boolean));return{groups:e,earlierReplies:t,projectWork:n,projectDeliveries:n.flatMap(e=>{let t=uu(e.ev);return!t||i.has(t.delivery_id)?[]:(i.add(t.delivery_id),[t])})}},[M.list]),N=(0,G.useMemo)(()=>D.filter(fe).length,[D]),P=(0,G.useMemo)(()=>M.list.slice(-20).reduce((e,t)=>e+t.r.text.length,0),[M.list]);return(0,G.useEffect)(()=>{if(!y)return;let e=window.requestAnimationFrame(()=>{x.current&&T.current&&(T.current.scrollTop=T.current.scrollHeight,S.current=T.current.scrollTop)});return()=>window.cancelAnimationFrame(e)},[M.list.length,P,y]),(0,G.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<40;x.current=t||x.current&&e.scrollTop>=S.current-1,S.current=e.scrollTop,b(x.current)};e.addEventListener(`scroll`,t,{passive:!0});let n=null,r=new ResizeObserver(()=>{x.current&&(n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,x.current&&(e.scrollTop=e.scrollHeight,S.current=e.scrollTop)}))});return r.observe(e),E.current&&r.observe(E.current),()=>{e.removeEventListener(`scroll`,t),r.disconnect(),n!==null&&window.cancelAnimationFrame(n)}},[]),(0,J.jsxs)(`section`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden bg-panel ${i?``:`rounded-lg border border-line/80`}`,children:[a&&(0,J.jsx)(U,{title:v(`panel.activity`),right:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[ee.projectWork.length>0?(0,J.jsx)(`button`,{type:`button`,onClick:()=>{x.current=!1,b(!1),T.current?.scrollTo({top:0,behavior:`auto`})},className:`rounded px-1.5 py-0.5 text-xs text-blue-sky hover:bg-bg`,children:_===`zh-CN`?`查看工作进展`:`View work progress`}):null,(0,J.jsxs)(`button`,{onClick:r,className:`rounded px-1.5 py-0.5 text-xs transition-colors ${n?`text-blue-sky`:`text-ink-faint hover:text-ink-dim`}`,title:v(`stream.toggleReasoning`),children:[v(`stream.reasoning`),N?` ·${N}`:``]}),(0,J.jsx)(`span`,{className:`text-xs ${t?`text-ok`:`text-ink-faint`}`,children:t?`● ${v(`common.live`)}`:`○ ${v(`common.reconnecting`)}`})]})}),f?(0,J.jsx)(eu,{snapshot:f,view:p,events:D,connected:t,compact:!0}):A?(0,J.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line/60 bg-blue-deep/5 px-4 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-blue-sky`}),(0,J.jsx)(`span`,{className:`truncate`,children:v(`stream.backgroundWork`)}),(0,J.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono tabular-nums text-ink-faint`,children:[j,`s`]})]}):null,m===`ready`?null:(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 px-4 py-3 text-sm text-ink-faint`,role:m===`error`?`alert`:`status`,"data-conversation-history":m,children:[(0,J.jsx)(`span`,{children:v(m===`error`?`stream.historyError`:`stream.historyLoading`)}),m===`error`&&g?(0,J.jsx)(`button`,{type:`button`,onClick:g,disabled:h,className:`shrink-0 rounded px-2 py-1 text-blue-sky hover:bg-bg disabled:opacity-50`,children:v(`stream.historyRetry`)}):null]}),(0,J.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto pb-6 pt-1.5 scroll-thin`,"aria-busy":m===`loading`,children:(0,J.jsx)(`div`,{ref:E,className:`flow-root`,"data-event-stream-content":!0,children:M.list.length===0?m===`ready`?(0,J.jsx)($e,{children:v(`stream.ready`)}):null:(0,J.jsxs)(J.Fragment,{children:[ee.projectWork.length>0?(0,J.jsxs)(`section`,{"data-project-work":!0,className:`mx-auto w-full max-w-full border-b border-line/60 lg:max-w-[61.8vw]`,children:[(0,J.jsxs)(`div`,{className:`flex h-10 items-center gap-2 border-b border-line/40 px-4 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink-faint`,children:[_===`zh-CN`?`项目工作进展`:`Project work progress`,(0,J.jsx)(`span`,{className:`font-mono font-normal tracking-normal`,children:ee.projectWork.length})]}),(0,J.jsx)(lu,{rows:ee.projectWork,live:k,followLatest:!0,activeRole:O?.role,activeTaskId:O?.taskId}),ee.projectDeliveries.map(e=>(0,J.jsx)(fu,{delivery:e,onOpen:d},e.delivery_id))]},`project-work`):null,ee.earlierReplies.map(e=>(0,J.jsx)(au,{ev:e.ev,r:e.r,artifacts:l,onOpenArtifact:u},e.key)),ee.groups.map(e=>(0,J.jsx)(pu,{group:e,artifacts:l,onOpenArtifact:u,onOpenDelivery:d},e.key))]})})}),!y&&(0,J.jsx)(`button`,{onClick:()=>{x.current=!0,b(!0),T.current&&(T.current.scrollTo({top:T.current.scrollHeight,behavior:`auto`}),S.current=T.current.scrollTop)},"aria-label":v(`stream.jumpToLatest`),title:v(`stream.jumpToLatest`),className:`absolute bottom-4 left-1/2 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-line/60 bg-panel text-sm text-ink-dim shadow-glow transition-all duration-200 hover:border-ink-faint hover:text-ink`,children:`↓`})]})}function hu(e){return e.nativeEvent.isComposing||e.keyCode===229}var gu=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function _u(e){return gu[e%gu.length]}var vu=[{id:`status`,name:`/status`,argument:`none`,desc:`roles, queued work, journal, and health`,group:`Everyday`,kind:`panel`},{id:`roles`,name:`/roles`,argument:`none`,desc:`per-role backend / model / effort + live activity`,group:`Everyday`,kind:`panel`},{id:`journal`,name:`/journal`,arg:`[N]`,argument:`optional`,desc:`recent journal entries (default 10)`,group:`Everyday`,kind:`panel`},{id:`backlog`,name:`/backlog`,arg:`[all]`,argument:`optional`,desc:`pending tasks (all = incl. done/skipped)`,group:`Everyday`,kind:`panel`},{id:`artifacts`,name:`/artifacts`,argument:`none`,desc:`result files the Reviewer has checked (Enter previews)`,group:`Everyday`,kind:`panel`},{id:`artifact`,name:`/artifact`,arg:``,argument:`required`,desc:`preview one reviewed result file`,group:`Everyday`,kind:`panel`},{id:`events`,name:`/events`,arg:`[filter] [query]`,argument:`optional`,desc:`search feed: all / watch / milestones / messages`,group:`Everyday`,kind:`panel`},{id:`find`,name:`/find`,arg:``,argument:`required`,desc:`search the current event buffer`,group:`Everyday`,kind:`panel`},{id:`cancel`,name:`/cancel`,argument:`none`,desc:`stop waiting for the current Manager reply`,group:`Everyday`,kind:`local`},{id:`ask`,name:`/ask`,arg:``,argument:`required`,desc:`answer inline — no task queued, no Planner/Engineer/Reviewer`,aliases:[`/chat`],group:`Everyday`,kind:`action`},{id:`crystalpilot`,name:`/crystalpilot`,arg:`[status|off|use ]`,argument:`optional`,desc:`enable crystallography tools in this Argus conversation`,group:`Everyday`,kind:`action`},{id:`task`,name:`/task`,arg:``,argument:`required`,desc:`queue work directly`,aliases:[`/add`],group:`Task management`,kind:`action`},{id:`plan`,name:`/plan`,arg:``,argument:`required`,desc:`preview a Planner-authored execution plan`,group:`Task management`,kind:`action`},{id:`rewrite`,name:`/rewrite`,arg:`[text]`,argument:`optional`,desc:`let the Manager rewrite your prompt before sending`,aliases:[`/refine`],group:`Task management`,kind:`action`},{id:`nudge`,name:`/nudge`,arg:``,argument:`required`,desc:`inject guidance into the running mission`,aliases:[`/inject`,`/notify`],group:`Task management`,kind:`action`},{id:`abort`,name:`/abort`,argument:`none`,desc:`immediately stop the running mission`,group:`Task management`,kind:`action`},{id:`note`,name:`/note`,arg:``,argument:`required`,desc:`append a manual note to the timeline`,group:`Task management`,kind:`action`},{id:`done`,name:`/done`,arg:``,argument:`required`,desc:`mark a task done`,group:`Task management`,kind:`action`},{id:`skip`,name:`/skip`,arg:``,argument:`required`,desc:`skip a task`,aliases:[`/rm`],group:`Task management`,kind:`action`},{id:`stop`,name:`/stop`,arg:``,argument:`required`,desc:`stop a task's auto-iteration`,group:`Task management`,kind:`action`},{id:`item`,name:`/item`,arg:``,argument:`required`,desc:`inspect a full task contract`,group:`Task management`,kind:`panel`},{id:`run`,name:`/run`,argument:`none`,desc:`return to the always-live mission feed`,group:`Task management`,kind:`local`},{id:`new`,name:`/new`,arg:`[objective]`,argument:`optional`,desc:`review, create, and switch to a fresh conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`daemons`,name:`/daemons`,arg:`[query]`,argument:`optional`,desc:`find every session + switch or create`,group:`Sessions & diagnostics`,kind:`panel`},{id:`resume`,name:`/resume`,arg:`[list|]`,argument:`optional`,desc:`switch to another project/session`,group:`Sessions & diagnostics`,kind:`action`},{id:`attach`,name:`/attach`,arg:``,argument:`required`,desc:`follow another project (read the stream)`,group:`Sessions & diagnostics`,kind:`action`},{id:`rename`,name:`/rename`,arg:``,argument:`required`,desc:`rename the current conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`doctor`,name:`/doctor`,argument:`none`,desc:`diagnose 'why isn't anything running'`,group:`Sessions & diagnostics`,kind:`panel`},{id:`backend`,name:`/backend`,arg:`[codex|claude|copilot|cursor|opencode|pi|grok|qoder|dsh]`,argument:`optional`,desc:`view or change the shared runner backend`,group:`Configuration`,kind:`action`},{id:`config`,name:`/config`,arg:`[key=value …]`,argument:`optional`,desc:`view or change runtime settings`,group:`Configuration`,kind:`panel`},{id:`identity`,name:`/identity`,arg:`[set ]`,argument:`optional`,desc:`view or replace the operator identity card`,group:`Configuration`,kind:`panel`},{id:`reset`,name:`/reset`,argument:`none`,desc:`drop the warm Manager conversation context`,group:`Configuration`,kind:`action`},{id:`skills`,name:`/skills`,arg:`[ls|promote ]`,argument:`optional`,desc:`inspect or promote runtime skills`,group:`Configuration`,kind:`action`},{id:`clear`,name:`/clear`,argument:`none`,desc:`clear the event feed view`,group:`Other`,kind:`local`},{id:`reconnect`,name:`/reconnect`,argument:`none`,desc:`reconnect the live event stream`,group:`Other`,kind:`local`},{id:`help`,name:`/help`,argument:`none`,desc:`keys + full command reference`,aliases:[`/?`,`/commands`],group:`Other`,kind:`local`},{id:`quit`,name:`/quit`,argument:`none`,desc:`leave the cockpit (background work keeps running)`,aliases:[`/exit`,`/q`],group:`Other`,kind:`local`}];new Map(vu.map(e=>[e.id,e]));var yu=new Map;for(let e of vu)for(let t of[e.name,...e.aliases??[]])yu.set(t.toLowerCase(),e);function bu(e){return e.argument===`required`}var xu=/^\/[A-Za-z0-9_-]+$/;function Su(e){if(!e.startsWith(`/`))return!1;let t=e.indexOf(` `),n=t===-1?e:e.slice(0,t);return xu.test(n)}function Cu(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.slice(1).includes(`/`)}function wu(e){if(!Cu(e))return[];let t=e.toLowerCase(),n=new Set,r=[];for(let e of vu)[e.name,...e.aliases??[]].some(e=>e.toLowerCase().startsWith(t))&&!n.has(e.name)&&(n.add(e.name),r.push(e));return r.sort((e,n)=>Number(Tu(n,t))-Number(Tu(e,t)))}function Tu(e,t){return[e.name,...e.aliases??[]].some(e=>e.toLowerCase()===t)}function Eu(e){return e.arg?`${e.name} `:e.name}function Du(e){let t=e.trim();if(!t)return{filter:`all`,query:``};let[n,...r]=t.split(/\s+/);return n.toLowerCase()===`watch`?{filter:`attention`,query:r.join(` `)}:Fe.includes(n.toLowerCase())?{filter:n.toLowerCase(),query:r.join(` `)}:{filter:`all`,query:t}}function Ou(e){if(!Su(e))return null;let t=e.indexOf(` `),n=(t===-1?e:e.slice(0,t)).toLowerCase(),r=t===-1?``:e.slice(t+1).trim(),i=yu.get(n)??null;return{cmd:i,name:i?i.name:n,rest:r}}function ku(e){let t=e.toLowerCase(),n=null,r=0;for(let e of yu.keys()){let i=Au(t,e);i>r&&(r=i,n=yu.get(e).name)}return r>=.6?n:null}function Au(e,t){return 1-ju(e,t)/(Math.max(e.length,t.length)||1)}function ju(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},(e,t)=>[t,...Array(r).fill(0)]);for(let e=0;e<=r;e+=1)i[0][e]=e;for(let a=1;a<=n;a+=1)for(let n=1;n<=r;n+=1)i[a][n]=Math.min(i[a-1][n]+1,i[a][n-1]+1,i[a-1][n-1]+(e[a-1]===t[n-1]?0:1));return i[n][r]}function Mu(e,t=!1,n=!1){return(t||n)&&e.toLowerCase()===`r`}var Nu={Everyday:`常用`,"Task management":`任务管理`,"Sessions & diagnostics":`会话与诊断`,Configuration:`配置`,Other:`其他`},Pu={crystalpilot:`在当前 Argus 会话启用晶体学工具,保持原生界面`,status:`查看角色、队列、日志和健康状态`,roles:`查看各角色的后端、模型、推理强度和实时活动`,journal:`查看近期日志(默认 10 条)`,backlog:`查看待处理任务(all 包含已完成和已跳过)`,artifacts:`查看 Reviewer 批准的结果文件(按 Enter 预览)`,artifact:`预览一个已批准的结果文件`,events:`搜索动态:all / watch / milestones / messages`,find:`搜索当前事件缓冲区`,cancel:`停止等待当前 Manager 回复`,ask:`直接回答,不排任务、不走 Planner/Engineer/Reviewer`,task:`直接加入任务队列`,plan:`预览 Planner 编写的执行计划`,rewrite:`让 Manager 在发送前改写提示词`,nudge:`向正在运行的任务注入指导`,abort:`立即终止正在运行的任务`,note:`向时间线添加手动备注`,done:`将任务标记为完成`,skip:`跳过任务`,stop:`停止任务的自动迭代`,item:`查看完整任务契约`,run:`返回持续更新的任务动态`,new:`检查、创建并切换到新会话`,daemons:`查找全部会话并切换或创建`,resume:`切换到其他项目或会话`,attach:`跟随其他项目并读取其动态`,rename:`重命名当前会话`,doctor:`诊断为什么没有任务运行`,backend:`查看或更改共享 Runner 后端`,config:`查看或更改运行时设置`,identity:`查看或替换操作者身份卡`,reset:`清除 Manager 的热会话上下文`,skills:`查看或提升运行时 Skill`,clear:`清空事件动态视图`,reconnect:`重新连接实时动态`,help:`查看快捷键和完整命令参考`,quit:`离开控制台(后台工作继续运行)`};function Fu(e,t){return t===`zh-CN`?Pu[e.id]:e.id===`reconnect`?`reconnect live activity`:e.desc}function Iu(e,t){return t===`zh-CN`?Nu[e.group]:e.group}function Lu(e,t){let n=new Map;for(let r of e){let e=Iu(r,t),i=r.aliases?.length?` (= ${r.aliases.join(`, `)})`:``,a=`${r.name}${r.arg?` ${r.arg}`:``}${i}`;n.has(e)||n.set(e,[]),n.get(e).push({label:a,desc:Fu(r,t)})}return[...n.entries()].map(([e,t])=>({group:e,rows:t}))}var Ru=`slash-completion-listbox`;function zu(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function Bu(e){return`slash-completion-option-${e}`}function Vu({query:e,selected:t,onSelect:n}){let{locale:r,t:i}=z(),a=wu(e);if(a.length===0)return null;let o=a.slice(0,8),s=zu(t,o.length);return(0,J.jsx)(`div`,{id:Ru,role:`listbox`,"aria-label":i(`slash.suggestions`),className:`slash-completion-menu scroll-thin border-b border-line/40`,children:o.map((e,t)=>(0,J.jsxs)(`button`,{id:Bu(e.id),type:`button`,role:`option`,"aria-selected":t===s,onPointerDown:e=>{e.preventDefault(),n(t)},className:`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm transition-colors ${t===s?`bg-blue/10 text-ink`:`text-ink-dim hover:bg-line/20`}`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-blue`,children:e.name}),e.arg?(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-ink-faint`,children:e.arg}):null,(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:Fu(e,r)})]},e.id))})}var Hu=32e3,Uu=10485760,Wu=26214400,Gu=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.pdf`,`.md`,`.markdown`,`.txt`,`.json`,`.csv`].join(`,`),Ku={".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".webp":`image/webp`,".pdf":`application/pdf`,".md":`text/markdown`,".markdown":`text/markdown`,".txt":`text/plain`,".json":`application/json`,".csv":`text/csv`};function qu(e){let t=String(e||``).trim().toLowerCase(),n=t.lastIndexOf(`.`);return n>=0?t.slice(n):``}function Ju(e){return Ku[qu(e.name)]||String(e.type||``).split(`;`,1)[0].trim()||`application/octet-stream`}function Yu(e){return Object.hasOwn(Ku,qu(e.name))}function Xu(e){return Ju(e).startsWith(`image/`)}function Zu(e){return[e.name,String(e.size),Ju(e),String(e.lastModified??``)].join(`::`)}function Qu(e,t){let n=[],r=[],i=new Set(e.map(Zu)),a=e.reduce((e,t)=>e+Math.max(0,t.size||0),0),o=e.length;for(let e of t){let t=Zu(e);if(!i.has(t)){if(i.add(t),!Yu(e)){r.push({code:`unsupported`,fileName:e.name});continue}if(o>=5){r.push({code:`too-many`,limitCount:5});continue}if(e.size>10485760){r.push({code:`too-large`,fileName:e.name,limitBytes:Uu});continue}if(a+e.size>26214400){r.push({code:`too-large-total`,limitBytes:Wu});continue}n.push(e),a+=e.size,o+=1}}return{accepted:n,issues:r}}function $u(e){return e?Array.from(e):[]}function ed(e){return $u(e?.types).map(e=>String(e)).includes(`Files`)||td(e).length>0}function td(e){let t=$u(e?.files).filter(e=>e instanceof File);if(t.length)return t;let n=[];for(let t of $u(e?.items)){if(String(t?.kind||``)!==`file`||typeof t?.getAsFile!=`function`)continue;let e=t.getAsFile();e instanceof File&&n.push(e)}return n}function nd({file:e,removeLabel:t,onRemove:n,disabled:r=!1}){let[i,a]=(0,G.useState)(``);return(0,G.useEffect)(()=>{if(!Xu(e)||typeof URL>`u`||typeof URL.createObjectURL!=`function`){a(``);return}let t=URL.createObjectURL(e);return a(t),()=>URL.revokeObjectURL(t)},[e]),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-2xl border border-line/50 bg-panel/80 px-2.5 py-2 text-xs shadow-[0_10px_24px_-20px_rgb(0_0_0/0.2)]`,children:[i?(0,J.jsx)(`img`,{src:i,alt:``,className:`h-10 w-10 shrink-0 rounded-xl border border-line/40 object-cover`}):null,(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate font-medium text-ink`,title:e.name,children:e.name}),(0,J.jsxs)(`div`,{className:`truncate text-ink-faint`,children:[yt(e.size),` · `,Ju(e)]})]}),(0,J.jsx)(`button`,{type:`button`,onClick:n,disabled:r,"aria-label":t,title:t,className:`send-control h-8 w-8 shrink-0 rounded-full border-line/60 text-ink-faint hover:border-err/50 hover:bg-err/10 hover:text-err`,children:`×`})]})}function rd({value:e,onChange:t,inputRef:n,fileInputRef:r,onFiles:i,inputProps:a,onSend:o,onCancel:s,pending:c,disabled:l=!1,controls:u}){let{t:d,locale:f}=z(),p=f===`zh-CN`,{refs:m,text:h}=to(e),g=e.length>Hu;return(0,G.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.getClientRects().length&&(e.style.height=`0px`,e.style.height=`${Math.min(132,Math.max(28,e.scrollHeight))}px`)};t();let r=e.clientWidth,i=new ResizeObserver(()=>{e.clientWidth!==r&&(r=e.clientWidth,t())});return i.observe(e),()=>i.disconnect()},[n,h]),(0,J.jsxs)(`div`,{className:`composer-surface`,"data-pending":c,children:[m.length>0&&(0,J.jsx)(`div`,{className:`map-reference-chips`,children:m.map((e,n)=>(0,J.jsxs)(`span`,{children:[(0,J.jsxs)(`span`,{children:[p?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":p?`移除引用`:`Remove reference`,onClick:()=>t(m.filter((e,t)=>t!==n).map(eo).join(``)+h),children:(0,J.jsx)(Je,{size:12})})]},`${e.task_id}:${e.step_id}:${n}`))}),(0,J.jsxs)(`form`,{className:`map-composer`,onSubmit:e=>{e.preventDefault(),!c&&!l&&!g&&o()},children:[(0,J.jsx)(`input`,{ref:r,type:`file`,multiple:!0,accept:Gu,hidden:!0,disabled:l||c,onChange:i}),(0,J.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":d(`chat.attach`),title:d(`chat.attach`),disabled:l||c,onClick:()=>r.current?.click(),children:(0,J.jsx)(cn,{size:19,strokeWidth:1.6})}),(0,J.jsx)(`textarea`,{...a,ref:n,rows:1,value:h,disabled:l,onChange:e=>t(m.map(eo).join(``)+e.target.value),onKeyDown:e=>{if(g&&e.key===`Enter`&&!e.shiftKey&&!hu(e)){e.preventDefault();return}a.onKeyDown?.(e),!(e.defaultPrevented||hu(e))&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),!c&&!l&&o())}}),(0,J.jsx)(`button`,{type:c?`button`:`submit`,onClick:c?s:void 0,disabled:l||!c&&(!h.trim()||g),"aria-label":c?p?`停止回复`:`Stop reply`:p?`发送消息`:`Send message`,className:`map-send ${c?`is-pending`:``}`,children:c?(0,J.jsx)(mn,{size:15}):(0,J.jsx)(Ht,{size:20})})]}),g&&(0,J.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:d(`chat.messageTooLong`)}),u?(0,J.jsx)(`div`,{className:`composer-controls`,children:u}):null]})}var id=[`auto`,`task`,`chat`];function ad({value:e,onChange:t,disabled:n=!1,tabIndex:r}){let{t:i}=z(),a={auto:i(`chat.routeAuto`),task:i(`chat.routeTask`),chat:i(`chat.routeChat`)};return(0,J.jsx)(`div`,{className:`route-seg`,role:`radiogroup`,"aria-label":i(`chat.routeLabel`),title:i(`chat.routeHint`),children:id.map(i=>(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===i,disabled:n,tabIndex:r,onClick:()=>{i!==e&&t(i)},children:a[i]},i))})}function od(e,t){if(!t.onRewrite||!Mu(e.key,e.ctrlKey,e.metaKey))return!1;e.preventDefault();let n=t.value.trim();return n&&!t.disabled&&!t.pending&&!t.rewriting&&t.onRewrite(n),!0}function sd({value:e,onChange:t,onSend:n,onCancel:r,disabled:i,pending:a,focusSignal:o,attachments:s,onAttachmentsChange:c,onRewrite:l,rewriting:u=!1,slashSelection:d,onSlashSelectionChange:f,routeOverride:p=`auto`,onRouteOverrideChange:m,footer:h}){let{t:g}=z(),_=(0,G.useRef)(null),v=(0,G.useRef)(null),y=(0,G.useRef)(!1),[b,x]=(0,G.useState)(0),[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(``),[E,D]=(0,G.useState)(0),[O,k]=(0,G.useState)(!1),[A,j]=(0,G.useState)(!1);(0,G.useEffect)(()=>{a||j(!1)},[a]),(0,G.useEffect)(()=>{if(!a&&!u)return;let e=setInterval(()=>x(e=>e+1),1e3);return()=>clearInterval(e)},[a,u]),(0,G.useEffect)(()=>{o&&!i&&_.current?.focus()},[o,i]);let M=wu(e).slice(0,8),ee=M.length>0&&!S,N=ee?zu(d,M.length):0,P=ee?M[N]:void 0,F=e=>{let n=M[e];n&&(t(Eu(n)),n.argument===`none`&&C(!0),f(0),_.current?.focus())},te=async()=>{if(!e.trim()||i||u||y.current)return;let t=a;if(t&&s.length){T(g(`chat.attachWhileRunning`));return}y.current=!0;try{(t?await n(e.trim(),[],void 0,{whileRunning:!0}):await n(e.trim(),s))&&(f(0),C(!1),T(``),j(t))}finally{y.current=!1}},ne=e=>{if(!e.length||i||a||y.current)return;let{accepted:t,issues:n}=Qu(s,e);t.length&&c([...s,...t]),T(n.map(e=>e.code===`unsupported`?g(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?g(`chat.attachTooLarge`,{name:e.fileName,size:yt(e.limitBytes)}):e.code===`too-many`?g(`chat.attachTooMany`,{count:e.limitCount}):g(`chat.attachTotalTooLarge`,{size:yt(e.limitBytes)})).join(` `))},re=(e,t)=>{ed(e.dataTransfer)&&(e.preventDefault(),D(e=>Math.max(0,e+t)))};return(0,J.jsxs)(`div`,{className:`conversation-composer flex flex-col ${E>0?`rounded-3xl ring-2 ring-manager/60`:``}`,"data-compact":!O&&!e.trim()&&!s.length&&!a&&!u&&!w&&!E,onFocusCapture:()=>k(!0),onBlurCapture:e=>k(e.currentTarget.contains(e.relatedTarget)),onDragEnter:e=>re(e,1),onDragOver:e=>re(e,0),onDragLeave:e=>re(e,-1),onDrop:e=>{ed(e.dataTransfer)&&(e.preventDefault(),D(0),ne(td(e.dataTransfer)))},children:[a?(0,J.jsx)(`div`,{className:`px-3 py-2 text-xs text-ink-faint`,role:`status`,children:g(A?`chat.queuedWhileRunning`:`chat.stopWaitingHint`)}):null,ee?(0,J.jsx)(Vu,{query:e,selected:N,onSelect:F}):null,s.length||w||E>0?(0,J.jsxs)(`div`,{className:`px-3 py-2`,children:[E>0?(0,J.jsx)(`div`,{className:`mb-2 text-xs text-manager`,children:g(`chat.attachDrop`)}):null,(0,J.jsx)(`div`,{className:`map-attachment-tray`,children:s.map((e,t)=>(0,J.jsx)(nd,{file:e,removeLabel:g(`chat.attachRemove`,{name:e.name}),onRemove:()=>{c(s.filter(t=>t!==e)),T(``)}},`${e.name}:${e.lastModified}:${t}`))}),(0,J.jsx)(`div`,{className:`text-xs ${w?`text-err`:`text-ink-faint`}`,children:w||g(`chat.attachHint`,{count:5,perFile:yt(10485760),total:yt(26214400)})})]}):null,(0,J.jsx)(rd,{value:e,onChange:e=>{t(e),f(0),C(!1)},inputRef:_,fileInputRef:v,onFiles:e=>{ne(Array.from(e.target.files??[])),e.target.value=``},onSend:()=>void te(),onCancel:r,pending:a,disabled:i,inputProps:{onPaste:e=>{let t=td(e.clipboardData);t.length&&(e.preventDefault(),ne(t))},onKeyDown:t=>{hu(t)||od(t,{value:e,disabled:i,pending:a,rewriting:u,onRewrite:l})||(ee?t.key===`ArrowDown`||t.key===`ArrowUp`?(t.preventDefault(),f(zu(N+(t.key===`ArrowDown`?1:-1),M.length))):t.key===`Tab`||t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),F(N)):t.key===`Escape`&&(t.preventDefault(),C(!0)):t.key===`Escape`&&a?(t.preventDefault(),r()):t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),te()))},"aria-label":g(`chat.messageArgus`),"aria-keyshortcuts":`Control+R Meta+R`,"aria-controls":ee?Ru:void 0,"aria-expanded":ee,"aria-activedescendant":P?Bu(P.id):void 0,placeholder:g(i?`chat.selectSession`:`chat.placeholder`)},controls:(0,J.jsxs)(J.Fragment,{children:[m?(0,J.jsx)(ad,{value:p,onChange:m,disabled:i||a}):null,l&&e.trim()?(0,J.jsx)(`button`,{type:`button`,onClick:()=>l(e.trim()),disabled:i||a||u,title:`Ctrl/⌘+R · ${g(`chat.rewriteHint`)}`,"aria-label":g(`chat.rewriteLabel`),"aria-keyshortcuts":`Control+R Meta+R`,children:u?`${_u(b)} ${g(`chat.rewriting`)}`:g(`chat.rewrite`)}):null]})}),h]})}function cd(e,t,n,r=`en`){return e.map(e=>({id:`command-${e.id}`,label:Fu(e,r),hint:`${e.name}${e.arg?` ${e.arg}`:``}`,group:Iu(e,r),keywords:[e.name,...e.aliases??[]].join(` `),run:()=>bu(e)?n(`${e.name} `):t(e.name)}))}function ld(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=`${e.label} ${e.group} ${e.hint??``} ${e.keywords??``}`.toLowerCase();return n.every(e=>t.includes(e))}):e}function ud({open:e,onClose:t,items:n}){let{t:r}=z(),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(0),c=(0,G.useRef)(null),l=(0,G.useRef)(null);(0,G.useEffect)(()=>{e&&(a(``),s(0),setTimeout(()=>c.current?.focus(),0))},[e]);let u=(0,G.useMemo)(()=>ld(n,i),[i,n]);(0,G.useEffect)(()=>{o>=u.length&&s(Math.max(0,u.length-1))},[u.length,o]),(0,G.useEffect)(()=>{l.current?.scrollIntoView({block:`nearest`})},[e,i,o]);let d=e=>{e&&(t(),e.run())},f=e=>{hu(e)||(e.key===`ArrowDown`?(e.preventDefault(),u.length&&s(e=>Math.min(u.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),d(u[o])))},p=[];for(let e of u){let t=p.find(t=>t.name===e.group);t||(t={name:e.group,items:[]},p.push(t)),t.items.push(e)}let m=-1;return(0,J.jsxs)(dt,{open:e,onClose:t,label:r(`help.palette`),width:`max-w-xl`,align:`top`,children:[(0,J.jsx)(`div`,{className:`border-b border-line px-4 py-3`,children:(0,J.jsx)(`input`,{ref:c,value:i,onChange:e=>a(e.target.value),onKeyDown:f,placeholder:r(`palette.placeholder`),role:`combobox`,"aria-expanded":e,"aria-autocomplete":`list`,"aria-controls":`command-palette-results`,"aria-activedescendant":u[o]?`palette-${u[o].id}`:void 0,className:`w-full bg-transparent font-mono text-sm text-ink outline-none placeholder:text-ink-faint`})}),(0,J.jsxs)(`div`,{id:`command-palette-results`,role:`listbox`,className:`max-h-[52vh] overflow-y-auto scroll-thin py-1.5`,children:[u.length===0&&(0,J.jsx)(`div`,{className:`px-4 py-6 text-center text-xs text-ink-faint`,children:r(`palette.noMatches`)}),p.map(e=>(0,J.jsxs)(`div`,{className:`mb-1`,children:[(0,J.jsx)(`div`,{className:`px-4 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.name}),e.items.map(e=>{m++;let t=m===o;return(0,J.jsxs)(`button`,{id:`palette-${e.id}`,ref:t?l:void 0,role:`option`,"aria-selected":t,onMouseEnter:()=>s(u.indexOf(e)),onClick:()=>d(e),className:`flex w-full items-center justify-between px-4 py-1.5 text-left text-sm transition-colors ${t?`bg-blue-deep/20 text-ink`:`text-ink-dim hover:bg-panel/60`}`,children:[(0,J.jsx)(`span`,{children:e.label}),e.hint&&(0,J.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:e.hint})]},e.id)})]},e.name))]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-4 py-1.5 text-[10px] text-ink-faint`,children:[(0,J.jsx)(`span`,{children:r(`palette.navigate`)}),(0,J.jsx)(`span`,{children:r(`palette.run`)}),(0,J.jsx)(`span`,{children:r(`palette.close`)})]})]})}var dd=[{keys:`⌘K / Ctrl+K`,desc:`help.palette`},{keys:`⌘B / Ctrl+B`,desc:`help.sessions`},{keys:`⌘J / Ctrl+J`,desc:`help.managerChat`},{keys:`⌘R / Ctrl+R`,desc:`help.rewrite`},{keys:`⌘T / Ctrl+T`,desc:`help.reasoning`},{keys:`⌘. / Ctrl+.`,desc:`help.kiosk`},{keys:`/`,desc:`help.composer`},{keys:`↵ Enter`,desc:`help.send`},{keys:`Shift+Enter`,desc:`help.newline`},{keys:`?`,desc:`help.thisHelp`},{keys:`Esc`,desc:`help.escape`}];function fd({open:e,onClose:t}){let{locale:n,t:r}=z(),i=Lu(vu,n);return(0,J.jsxs)(dt,{open:e,onClose:t,label:r(`help.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`help.title`)}),(0,J.jsxs)(`div`,{className:`max-h-[70dvh] overflow-y-auto scroll-thin`,children:[(0,J.jsx)(`div`,{className:`p-4`,children:dd.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between py-1.5`,children:[(0,J.jsx)(`span`,{className:`text-sm text-ink-dim`,children:r(e.desc)}),(0,J.jsx)(`kbd`,{className:`rounded border border-line bg-surface px-2 py-0.5 font-mono text-[11px] text-ink`,children:e.keys})]},e.keys))}),(0,J.jsxs)(`div`,{className:`border-t border-line px-4 pb-4 pt-3`,children:[(0,J.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-ink-faint`,children:r(`help.commands`)}),i.map(e=>(0,J.jsxs)(`div`,{className:`mb-4`,children:[(0,J.jsx)(`p`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.group}),e.rows.map(e=>(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1`,children:[(0,J.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-ink`,children:e.label}),(0,J.jsx)(`span`,{className:`text-right text-xs text-ink-dim`,children:e.desc})]},e.label))]},e.group))]})]})]})}var pd=[[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]];function md({sid:e,config:t,onSaved:n}){let{locale:r}=z(),i=r===`zh-CN`,a=t.roles.find(e=>e.role===`manager`),o=t.roles.find(e=>e.role===`engineer`),s=a&&a.backend!==`memory`?a:o,c=new Map(t.operator_knobs.map(e=>[e.name,e.value])),l=c.get(`ARGUS_SKILL_MAP_MODEL`)||`auto`,[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(``),m=(t.model_options??[]).map(e=>e.model);l!==`auto`&&!m.includes(l)&&m.unshift(l);let h=async(t,r)=>{if(!u){d(!0),p(``);try{await R.setConfig(e,t,r),await n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},g=i?`自动(轻量)`:`Auto (light)`,_=i?`跟随前台模型`:`Follow the front-door model`,v=[{name:`ARGUS_SKILL_MAP_REASONING_EFFORT`,label:i?`讲解生成强度`:`Explanation effort`,follow:g},{name:`ARGUS_SKILL_MAP_REVIEW_REASONING_EFFORT`,label:i?`讲解复核强度`:`Explanation review effort`,follow:i?`自动(中)`:`Auto (medium)`}];return(0,J.jsxs)(`section`,{className:`map-model-settings rounded-lg border border-line glass-card p-3`,"aria-label":i?`地图模型`:`Map model`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:i?`地图模型`:`Map model`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:i?`地图讲解与摘要用的模型;默认沿用前台(经理)的接入与账号,以低强度起草,不占用科研的推理预算。可以选一个便宜的。`:`The model that writes map explanations and summaries. By default it uses the front-door (Manager) runner and account at a light effort, not the research budget. A cheaper one is fine.`}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[s?.backend_label,` · `,s?.model||(i?`接入默认模型`:`Runner default model`)]}),t.map_model?.note&&(0,J.jsx)(`p`,{role:`status`,"data-map-model-note":!0,className:`mt-1 text-xs text-warn`,children:i?`已改用自动:所选摘要模型在当前接入(${t.map_model.backend})下不可用。`:t.map_model.note}),(0,J.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[i?`摘要模型`:`Summary model`,(0,J.jsxs)(`select`,{value:l,disabled:u,"aria-label":i?`摘要模型`:`Summary model`,onChange:e=>void h(`ARGUS_SKILL_MAP_MODEL`,e.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:_}),m.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]}),v.map(e=>(0,J.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[e.label,(0,J.jsxs)(`select`,{value:c.get(e.name)||`auto`,disabled:u,onChange:t=>void h(e.name,t.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:e.follow}),pd.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:i?t:e},e))]})]},e.name)),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`复核用于检查讲解文字,保存后对新发起的讲解生效。`:`The review checks explanation text. Changes apply to newly requested explanations.`}),f&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:f})]})}function hd({sid:e,primaryModel:t}){let{locale:n}=z(),r=n===`zh-CN`,i=(e,t)=>r?e:t,a=M(),o=A({queryKey:[`advisor-settings`,e],queryFn:({signal:t})=>R.advisorSettings(e,t),enabled:!!e,retry:!1}),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(!1),_=(0,G.useRef)(e);_.current=e,(0,G.useEffect)(()=>{c(o.data?.saved??null);let e=o.data?.saved;u(!!(e?.model&&!o.data?.model_options?.some(t=>t.backend===e.backend&&t.model===e.model)))},[e,o.data]),(0,G.useEffect)(()=>{m(``),g(!1),f(!1)},[e]);let v=e=>{c(t=>t&&{...t,...e}),g(!1)},y=o.data?.model_options??[],b=(e,t)=>JSON.stringify([e,t]),x=s&&y.some(e=>e.backend===s.backend&&e.model===s.model)?b(s.backend,s.model):``,S=async()=>{if(!s||d)return;let t=e;f(!0),m(``),g(!1);try{let{schema_version:e,...n}=s,r=await R.saveAdvisorSettings(t,{...n,model:n.model.trim()});a.setQueryData([`advisor-settings`,t],r),_.current===t&&g(!0)}catch(e){_.current===t&&m(e instanceof Error?e.message:String(e))}finally{_.current===t&&f(!1)}};return(0,J.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,"aria-label":i(`顾问模型`,`Advisor model`),children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`顾问模型`,`Advisor model`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:i(`团队遇到难题时可以向它提问。只在咨询时调用,用量计入当前项目。`,`The team can consult this model on specific questions. It runs only when asked, and usage belongs to this project.`)}),t?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[i(`当前执行模型:`,`Current execution model: `),t]}):null,o.isPending?(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-ink-faint`,children:i(`正在读取设置…`,`Loading settings…`)}):o.isError?(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-err`,role:`alert`,children:[i(`顾问设置读取失败。`,`Could not load advisor settings.`),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void o.refetch(),className:`underline`,children:i(`重试`,`Retry`)})]}):s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:s.enabled,disabled:d,onChange:e=>v({enabled:e.target.checked})}),i(`允许团队咨询顾问`,`Let the team consult the advisor`)]}),(0,J.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[y.length>0?(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim sm:col-span-2`,children:[i(`顾问使用的模型`,`Advisor model`),(0,J.jsxs)(`select`,{"aria-label":i(`选择顾问模型`,`Choose advisor model`),value:l?`custom`:x,disabled:d,onChange:e=>{if(e.target.value===`custom`){u(!0);return}let t=y.find(t=>b(t.backend,t.model)===e.target.value);t&&(u(!1),v({backend:t.backend,model:t.model}))},className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,disabled:!0,children:i(`选择模型`,`Choose a model`)}),y.map(e=>(0,J.jsx)(`option`,{value:b(e.backend,e.model),children:e.model},b(e.backend,e.model))),(0,J.jsx)(`option`,{value:`custom`,children:i(`配置其他模型…`,`Configure another model…`)})]})]}):null,l||y.length===0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`接入`,`Runner`),(0,J.jsxs)(`select`,{"aria-label":i(`顾问接入`,`Advisor runner`),value:s.backend,disabled:d,onChange:e=>v({backend:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:i(`选择接入`,`Choose a runner`)}),o.data?.supported_backends.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`顾问使用的模型`,`Advisor model ID`),(0,J.jsx)(`input`,{value:s.model,disabled:d,onChange:e=>v({model:e.target.value}),placeholder:i(`填写该接入的模型标识`,`Model ID for this runner`),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}):null,(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`思考强度`,`Reasoning effort`),(0,J.jsxs)(`select`,{"aria-label":i(`顾问思考强度`,`Advisor reasoning effort`),value:s.effort,disabled:d,onChange:e=>v({effort:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:i(`模型默认`,`Model default`)}),[[`minimal`,`最低`],[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]].map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:r?t:e},e))]})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`每次角色调用最多咨询`,`Consultations per role call`),(0,J.jsx)(`input`,{type:`number`,min:1,max:20,value:s.max_calls_per_turn,disabled:d,onChange:e=>v({max_calls_per_turn:Number(e.target.value)}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}),o.data?.overridden_fields.length?(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:[i(`运行服务另有指定设置;当前顾问:`,`The runtime overrides some saved settings. Current advisor: `),o.data.config.enabled?`${o.data.config.backend} · ${o.data.config.model}`:i(`未启用`,`disabled`)]}):null,(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void S(),disabled:d||s.enabled&&(!s.backend||!s.model.trim()),className:`rounded border border-line px-3 py-2 text-xs text-ink hover:border-blue disabled:opacity-40`,children:d?i(`保存中…`,`Saving…`):i(`保存顾问设置`,`Save advisor settings`)}),h?(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-dim`,children:i(`已保存,下次咨询生效。`,`Saved for the next consultation.`)}):null]}),p?(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:p}):null]}):null]})}var gd=[/^\[?\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[.,]\d+)?(?:Z|[+-]\d{2}:?\d{2})?\]?\s*/,/^\[?(?:INFO|WARNING|WARN|ERROR|DEBUG|CRITICAL|TRACE)\]?\s*[:\-|]?\s*/i,/^(?:\[\d+\]|[\w.]+:)\s+/];function _d(e){let t=e.trim();for(let e of gd)t=t.replace(e,``);return t.trim()}var vd=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`;function yd(e,t=200){let n=String(e??``).split(/\r?\n/).map(_d).filter(e=>e&&!/^[-=_.\s]+$/.test(e));return n.length?vd(n[n.length-1],t):``}var bd=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function xd(e){if(!e)return[];let t=e.provider??{},n=[],r=bd(t.completed)??0,i=bd(t.errors)??0;n.push({key:`calls`,value:String(r+i)}),n.push({key:`failed`,value:String(i)});let a=bd(t.p95_duration_ms);return a&&a>0&&n.push({key:`slowest`,value:`${(a/1e3).toFixed(1)}s`}),n}var Sd=[{name:`ARGUS_SKILL_MAX_ACTIVE_DAEMONS`,group:`Limits`,label:`Active daemon limit`,description:`Maximum background sessions running on this host.`},{name:`ARGUS_SKILL_SAFE_MODE`,group:`Safety`,label:`Safe mode`,description:`Enable extra-conservative runtime guardrails.`},{name:`ARGUS_SKILL_OPERATOR_AVAILABLE`,group:`Safety`,label:`Operator available`,description:`Off suppresses operator questions: Argus decides on recorded assumptions.`},{name:`ARGUS_SKILL_ENABLE_TELEGRAM`,group:`Interface`,label:`Telegram`,description:`Enable the Telegram notification bridge.`},{name:`ARGUS_SKILL_SHOW_REASONING`,group:`Interface`,label:`Show reasoning`,description:`Stream role reasoning into the cockpit activity view.`}];function Cd(e){let t=new Map(e.map(e=>[e.name,e]));return Sd.flatMap(e=>{let n=t.get(e.name);return n?[{...n,group:e.group,label:e.label,doc:e.description}]:[]})}function wd(e,t){let n=new URL(e),r=n.protocol===`https:`?`wss:`:`ws:`,i=encodeURIComponent(t);return{webApi:`${n.origin}/api`,eventStream:`${r}//${n.host}/api/projects/${i}/stream`,daemon:`local process · events.jsonl · no TCP port`}}var Td=`ARGUS_SKILL_OPERATOR_AVAILABLE`,Ed=new Set([`0`,`false`,`no`,`off`,`disable`,`disabled`]);function Dd(e){let t=(e??[]).find(e=>e.name===Td);return!!(t&&Ed.has(t.value.trim().toLowerCase()))}function Od(e){return e instanceof se?e.code===`trial_route_unavailable`||e.status===403||e.status===404:!1}function kd(e,t){let n=Od(e);return{text:t(n?`operations.unavailableHere`:`operations.requestFailed`),technical:e instanceof Error?e.message:String(e||``),refused:n}}var Ad={ARGUS_SKILL_MAX_ACTIVE_DAEMONS:{label:`settings.knob.activeDaemons`,doc:`settings.knob.activeDaemonsDoc`},ARGUS_SKILL_SAFE_MODE:{label:`settings.knob.safeMode`,doc:`settings.knob.safeModeDoc`},ARGUS_SKILL_OPERATOR_AVAILABLE:{label:`settings.knob.operatorAvailable`,doc:`settings.knob.operatorAvailableDoc`},ARGUS_SKILL_ENABLE_TELEGRAM:{label:`settings.knob.telegram`,doc:`settings.knob.telegramDoc`},ARGUS_SKILL_SHOW_REASONING:{label:`settings.knob.showReasoning`,doc:`settings.knob.showReasoningDoc`}},jd={Limits:`settings.group.limits`,Safety:`settings.group.safety`,Interface:`settings.group.interface`};function Md(e,t){let n=e.trim();return n===`not applicable for this model`?t(`settings.source.notApplicable`):n.startsWith(`capability vault`)?t(`settings.source.vaultDefault`):n.startsWith(`default`)?t(`settings.source.default`):n.startsWith(`persisted:`)||n===`persisted`?t(`settings.source.saved`):n.startsWith(`ARGUS_SKILL_`)||n===`env`?t(`settings.source.environment`):n.startsWith(`global:`)?t(`settings.source.hostConfig`):t(`settings.source.other`)}function Nd(e,t){let n=e.value.trim().toLowerCase();return[`ARGUS_SKILL_SAFE_MODE`,`ARGUS_SKILL_OPERATOR_AVAILABLE`,`ARGUS_SKILL_ENABLE_TELEGRAM`,`ARGUS_SKILL_SHOW_REASONING`].includes(e.name)?t([`1`,`true`,`on`,`yes`].includes(n)?`settings.value.enabled`:`settings.value.disabled`):e.value}function Pd(e,t){let n={low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`}[e.toLowerCase()];return n?t(`settings.effort.${n}`):e}function Fd({message:e,retrying:t,onRetry:n,t:r}){return(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 px-4 py-8 text-center`,children:[(0,J.jsx)(`p`,{className:`text-sm text-err`,children:e}),(0,J.jsx)(`button`,{type:`button`,onClick:n,disabled:t,className:`rounded-md border border-err/40 px-3 py-1.5 text-xs font-medium text-err hover:bg-err/10 disabled:opacity-40`,children:r(t?`common.loading`:`common.retry`)})]})}function Id({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a,isError:o,isFetching:s,refetch:c}=ye(e,t),l=!!(i&&(i.recommended||i.checks.length||i.log_tail.trim()));return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`doctor.title`),width:`max-w-3xl`,children:[(0,J.jsx)(lt,{title:r(`doctor.title`),sub:r(`doctor.subtitle`)}),(0,J.jsxs)(`div`,{className:`p-4`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!a&&o&&(0,J.jsx)(Fd,{message:r(`doctor.loadError`),retrying:s,onRetry:()=>void c(),t:r}),!a&&!o&&!l&&(0,J.jsx)($e,{children:r(`doctor.empty`)}),!a&&!o&&i?.recommended&&(0,J.jsxs)(`div`,{className:`mb-4 rounded-lg border border-gold/40 bg-gold/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-gold`,children:r(`doctor.recommended`)}),(0,J.jsx)(`div`,{className:`mt-1 text-sm text-ink`,children:i.recommended.name}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:i.recommended.detail}),i.recommended.fix&&(0,J.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap break-words rounded bg-bg p-2 font-mono text-xs text-blue-sky`,children:i.recommended.fix})]}),!a&&!o&&(0,J.jsx)(`div`,{className:`space-y-1.5`,children:(i?.checks??[]).map((e,t)=>(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-line/60 px-3 py-2`,children:[(0,J.jsx)(`span`,{className:e.ok?`text-ok`:`text-err`,children:e.ok?`✓`:`✗`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.name}),e.detail&&(0,J.jsx)(`div`,{className:`mt-0.5 text-[11px] text-ink-dim`,children:e.detail}),!e.ok&&e.fix&&(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words rounded bg-bg p-1.5 font-mono text-xs text-ink-dim`,children:e.fix})]})]},t))}),!a&&!o&&i?.log_tail?.trim()&&(0,J.jsxs)(`div`,{className:`mt-4`,children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`doctor.daemonLog`)}),(0,J.jsxs)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:[(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[r(`doctor.lastEntry`),` · `]}),yd(i.log_tail)]}),(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:i.log_tail})})]})]})]})}function Ld({sid:e,open:t,onClose:n}){let{t:r}=z(),i=M(),{data:a,isLoading:s,isError:c,isFetching:l,refetch:u}=Me(e,t),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(!1),[b,x]=(0,G.useState)(``),[C,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)(``),[k,A]=(0,G.useState)(!1),[j,ee]=(0,G.useState)(``);(0,G.useEffect)(()=>{t||f(!1)},[t]),(0,G.useEffect)(()=>{!t||!a||(m(a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MODEL`)?.value??``),g(``))},[a,t]);let N=async()=>{await u(),await i.invalidateQueries({queryKey:[`map-copy`]})},P=_r(a),F=vr(a),te=yr(a),ne=e=>!e||(te?hr(te)===e:e===hr(P)),re=h||hr(P),ie=async t=>{if(!(_||ne(t))){v(!0),x(``),w(!1);try{await R.setConfig(e,`ARGUS_SKILL_RUNNER_BACKEND`,t),await N(),x(r(`settings.backendSwitched`,{backend:gr(t,r)}))}catch(e){w(!0),x(kd(e,r).text)}finally{v(!1)}}},I=async t=>{if(!_){v(!0),x(``),w(!1);try{await R.setConfig(e,`ARGUS_SKILL_MAP_MODEL`,t||`auto`),await N(),x(t&&t!==`auto`?r(`settings.mapModelSet`,{model:t}):r(`settings.mapModelFollows`))}catch(e){w(!0),x(kd(e,r).text)}finally{v(!1)}}},L=async()=>{if(!_){v(!0),x(``),w(!1);try{let t=p.trim()||`auto`;await R.setConfig(e,`ARGUS_SKILL_MODEL`,t,!0),await N(),x(r(`settings.modelAppliedToRoles`,{model:t}))}catch(e){w(!0),x(kd(e,r).text)}finally{v(!1)}}},ae=async t=>{if(t.preventDefault(),!(!T.trim()||!D.trim()||k)){A(!0),ee(``);try{await R.setConfig(e,T.trim(),D.trim()),await N(),ee(r(`settings.applied`))}catch(e){ee(kd(e,r).text)}finally{A(!1)}}},oe=Cd(a?.operator_knobs??[]).reduce((e,t)=>((e[t.group]??=[]).push(t),e),{}),se=wd(window.location.origin,e),ce=!!(a&&(a.roles.length||a.operator_knobs.length));return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`common.settings`),width:`max-w-4xl`,children:[(0,J.jsx)(lt,{title:r(`common.settings`),sub:r(`settings.subtitle`)}),(0,J.jsxs)(`div`,{className:`p-4`,children:[s&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!s&&c&&(0,J.jsx)(Fd,{message:r(`settings.loadError`),retrying:l,onRetry:()=>void u(),t:r}),!s&&!c&&!ce&&(0,J.jsx)($e,{children:r(`settings.empty`)}),!s&&!c&&ce&&a&&(0,J.jsxs)(`div`,{className:`space-y-4`,children:[!a.trial_mode&&(0,J.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`settings.quickConfig`)}),(0,J.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.backend`)}),(0,J.jsxs)(`select`,{value:h||hr(P),disabled:_,onChange:e=>g(e.target.value),"aria-label":r(`settings.backend`),className:`h-8 min-w-44 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[hr(P)?null:(0,J.jsx)(`option`,{value:``,disabled:!0,children:P?r(`settings.backendUnsupported`,{backend:P}):r(`settings.backendUnavailable`)}),pr.map(e=>(0,J.jsx)(`option`,{value:e.value,children:r(e.label)},e.value))]}),(0,J.jsx)(`button`,{type:`button`,"data-apply-backend":!0,onClick:()=>{re&&ie(re)},disabled:_||ne(re),className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:r(`settings.applyModel`)}),F&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,"data-backend-source":F,children:r(`settings.backendSource.${F}`)}),!ne(re)&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-dim`,"data-backend-change":!0,children:te?r(`settings.backendWillReplace`,{saved:gr(te,r),backend:gr(re,r)}):r(`settings.backendWillSave`,{backend:gr(re,r)})})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.model`)}),(0,J.jsxs)(`select`,{value:p||`auto`,onChange:e=>m(e.target.value===`auto`?``:e.target.value),"aria-label":r(`settings.model`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:a.model_auto_resolves_to?`auto → ${a.model_auto_resolves_to}`:r(`settings.modelPlaceholder`)}),(()=>{let e=a.model_options??[],t=new Set(e.filter(e=>e.invalid).map(e=>e.model)),n=e.map(e=>e.model),i=p.trim();return i&&i!==`auto`&&!n.includes(i)&&(n.unshift(i),t.add(i)),n.map(e=>(0,J.jsx)(`option`,{value:e,children:t.has(e)?`${e} (${r(`settings.modelUnavailable`)})`:e},e))})()]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void L(),disabled:_,className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:r(`settings.applyModel`)})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.mapModel`)}),(0,J.jsxs)(`select`,{value:a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||`auto`,disabled:_,onChange:e=>void I(e.target.value),"aria-label":r(`settings.mapModel`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[(0,J.jsx)(`option`,{value:`auto`,children:r(`settings.mapModelFollows`)}),(()=>{let e=(a.model_options??[]).map(e=>e.model),t=a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||``;return t&&t!==`auto`&&!e.includes(t)&&e.unshift(t),e.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))})()]})]}),(a.model_options??[]).some(e=>e.offline)&&(0,J.jsx)(`p`,{className:`mt-1 text-[10px] text-ink-faint`,"data-model-offline":!0,children:r(`settings.modelOfflineList`)}),a.roles.some(e=>e.model&&p.trim()&&e.model!==p.trim())&&(0,J.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-ink-faint`,"data-role-models":!0,children:[r(`settings.rolesRunning`),` `,a.roles.map(e=>`${e.role} · ${e.model||`auto`}`).join(`,`),` — `,r(`settings.applyUnifies`)]}),b&&(0,J.jsx)(`div`,{role:C?`alert`:`status`,className:`mt-1.5 text-[10px] ${C?`text-err`:`text-ink-dim`}`,children:b})]}),a.trial_mode&&(0,J.jsx)(`section`,{className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,"aria-label":r(`settings.trialAccount`),children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:r(`settings.trialAccount`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:`GPT-5.5 · high`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:r(`settings.trialKeyHint`)})]}),Dr()&&(0,J.jsx)(`button`,{type:`button`,className:`compact-control px-3 py-2`,onClick:()=>{n(),Or()},children:r(`settings.changeTrialKey`)})]})}),d&&(0,J.jsx)(md,{sid:e,config:a,onSaved:N}),d&&(0,J.jsx)(hd,{sid:e,primaryModel:a.roles.find(e=>e.role===`engineer`)?.model}),(0,J.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface/50`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":d,"aria-controls":`config-advanced-settings`,onClick:()=>f(e=>!e),className:`flex w-full items-center justify-between gap-3 px-3 py-3 text-left hover:bg-bg/30`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block text-xs font-semibold text-ink`,children:r(`settings.advanced`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-ink-faint`,children:r(`settings.advancedHint`)})]}),(0,J.jsx)(o,{icon:S,className:`text-xs text-ink-faint transition-transform ${d?`rotate-180`:``}`})]}),d&&(0,J.jsxs)(`div`,{id:`config-advanced-settings`,className:`space-y-4 border-t border-line/70 p-3`,children:[(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`settings.connection`)}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2 text-[10px] sm:grid-cols-[100px_minmax(0,1fr)]`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.webApi`)}),(0,J.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:se.webApi}),(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.eventStream`)}),(0,J.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:se.eventStream}),(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.taskDaemon`)}),(0,J.jsx)(`span`,{className:`text-ink-dim`,children:r(`settings.taskDaemonValue`)})]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>void ae(e),className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-blue`,children:r(`settings.overrideTitle`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[10px] text-ink-faint`,children:r(`settings.overrideHint`)}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,J.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:r(`settings.namePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),placeholder:r(`settings.valuePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{disabled:k||!T.trim()||!D.trim(),title:r(`settings.applyAdvanced`),"aria-label":r(`settings.applyAdvanced`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:k?`…`:(0,J.jsx)(o,{icon:y})})]}),j?(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-dim`,children:j}):null]}),a.roles.length>0&&(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(`settings.rolesTitle`)}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:a.roles.map(e=>(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:e.role===`curator`?r(`settings.role.curator`):Ln(e.role,r)}),(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.backend_label})]}),(0,J.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px] text-ink-dim`,title:e.model,children:e.model}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:Md(e.model_source,r)}),e.reasoning_effort&&(0,J.jsx)(`span`,{className:`ml-auto shrink-0`,style:{color:Ze(e.reasoning_effort)},children:Pd(e.reasoning_effort,r)})]}),(gt(e.role)||e.role===`curator`)&&(0,J.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-ink-faint`,children:gt(e.role)?Xe(e.role,r):r(`settings.role.curatorDoc`)})]},e.role))})]}),Object.keys(oe).length>0&&(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(`settings.rawConfig`)}),Object.entries(oe).map(([e,t])=>(0,J.jsxs)(`div`,{className:`mt-3 first:mt-0`,children:[(0,J.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(jd[e])}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-line`,children:t.map((e,t)=>{let n=Ad[e.name],i=Nd(e,r);return(0,J.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] ${t?`border-t border-line/60`:``}`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-dim`,children:r(n.label)}),(0,J.jsx)(`code`,{className:`mt-0.5 block break-all text-[9px] text-ink-faint`,children:e.name}),(0,J.jsx)(`div`,{className:`mt-1 text-[10px] leading-relaxed text-ink-faint`,children:r(n.doc)})]}),(0,J.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,J.jsxs)(`div`,{className:`text-[11px] text-ink`,children:[i,i!==e.value&&(0,J.jsxs)(`code`,{className:`ml-1 text-[9px] text-ink-faint`,children:[`(`,e.value,`)`]})]}),(0,J.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Md(e.source,r)})]})]},e.name)})})]},e))]}),(0,J.jsxs)(`p`,{className:`text-[10px] text-ink-faint`,children:[r(`settings.footer`),` `,(0,J.jsx)(`code`,{children:`argus --config-help`}),`.`]})]})]})]})]})]})}function Rd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a,refetch:s}=be(e,t),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``);(0,G.useEffect)(()=>{t&&i!=null&&l(i)},[i,t]);let h=async()=>{if(!u){d(!0),m(``);try{await R.setIdentity(e,c),await s(),m(r(`identity.saved`))}catch(e){m(kd(e,r).text)}finally{d(!1)}}};return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`identity.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`identity.title`),sub:r(`identity.subtitle`)}),(0,J.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-5`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),a?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),rows:12,className:`w-full resize-y rounded-lg border border-line bg-bg p-3 font-sans text-sm leading-relaxed text-ink outline-none focus:border-blue`,placeholder:r(`identity.placeholder`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:u||c===(i??``),title:r(`identity.save`),"aria-label":r(`identity.save`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:u?`…`:(0,J.jsx)(o,{icon:f})})]})]})]})]})}function zd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a}=ge(e,t),o=i??[];return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`transcript.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`transcript.title`),sub:r(`transcript.subtitle`)}),(0,J.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-4`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!a&&o.length===0&&(0,J.jsx)($e,{children:r(`transcript.empty`)}),o.map((e,t)=>{let n=e.role===`operator`;return(0,J.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)] border-b border-line/50 py-2.5 last:border-b-0`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`font-mono text-[10px] font-semibold uppercase tracking-wide ${n?`text-ink-faint`:`text-blue-sky`}`,children:n?r(`transcript.operator`):`argus`}),(0,J.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Dt(e.ts)})]}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink-dim`,children:e.text})]},t)})]})]})}function Bd({card:e}){let{t,locale:n}=z(),r=typeof e.asked_at==`number`&&Number.isFinite(e.asked_at)&&e.asked_at>0?new Date(e.asked_at*1e3):null,i=e.task_status?.startsWith(`paused`);return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] text-ink-faint`,"data-decision-task":e.item_id,children:[e.task_title?(0,J.jsx)(`span`,{className:`min-w-0 basis-full break-words text-xs leading-relaxed text-ink-dim`,title:e.task_title,children:t(`decision.taskName`,{title:e.task_title})}):null,e.kind!==`domain_intake`&&e.is_current_task!=null?(0,J.jsx)(`span`,{children:t(e.is_current_task?`decision.currentTask`:`decision.otherTask`)}):null,(0,J.jsx)(at,{children:t(`decision.awaitingReply`)}),e.task_status?(0,J.jsx)(`span`,{children:i?t(`label.status.paused`):In(e.task_status,t)}):null,r&&!Number.isNaN(r.getTime())?(0,J.jsx)(`time`,{dateTime:r.toISOString(),title:r.toLocaleString(n),children:t(`decision.askedAt`,{time:wt(r,n)})}):null]})}function Vd({questions:e,backlog:t,currentTaskId:n,onAnswer:r,onLocate:i}){let{t:a}=z(),o=qr(e,t,n);if(!o.length)return null;let s=o[0];return(0,J.jsxs)(`div`,{className:`mb-2 flex min-h-11 items-center gap-3 rounded-md border border-gold/40 bg-gold/5 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s.title===s.task_title?null:(0,J.jsx)(`div`,{className:`truncate text-xs font-medium text-gold`,title:s.title,children:s.title}),(0,J.jsx)(Bd,{card:s}),(0,J.jsx)(`div`,{className:`truncate text-xs text-ink-dim`,title:s.reason||s.question,children:s.reason||s.question})]}),o.length>1?(0,J.jsxs)(`span`,{className:`font-mono text-xs text-ink-faint`,children:[`+`,o.length-1]}):null,i&&s.item_id?(0,J.jsx)(`button`,{onClick:()=>i(s.item_id),className:`shrink-0 text-xs text-ink-dim hover:text-gold`,children:a(`pending.showOnMap`)}):null,(0,J.jsx)(`button`,{onClick:r,className:`shrink-0 text-xs font-medium text-gold hover:text-gold-soft`,children:a(`pending.reviewRespond`)})]})}function Hd({reply:e,open:t,busy:n,onClose:r,onSubmit:i,error:a=``}){let{t:o,locale:s}=z(),c=s===`zh-CN`,l=(0,G.useMemo)(()=>e?.options[0]?.id??`custom`,[e]),[u,d]=(0,G.useState)(l),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(``);if((0,G.useEffect)(()=>{t&&(d(l),p(``),h(``))},[l,t,e?.id]),!e)return null;let g=e.options.length===0,_=e.kind===`domain_intake`,v=e.options.find(e=>e.id===u),y=g?!!f.trim():!!(v&&(!v.requires_note||f.trim())),b=()=>{if(!n){if(!y){h(o(`decision.noteRequired`));return}h(``),i(g?`custom`:u,f.trim())}};return(0,J.jsxs)(dt,{open:t,onClose:n?()=>void 0:r,label:o(`decision.operator`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:_?e.title:o(`decision.required`),sub:!_&&e.title!==e.task_title?e.title:void 0}),(0,J.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[(0,J.jsx)(Bd,{card:e}),e.reason?(0,J.jsxs)(`section`,{className:`rounded-md border border-gold/30 bg-gold/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-gold`,children:o(`decision.whyBlocked`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.reason})]}):null,e.evidence.length?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:o(`decision.evidence`)}),(0,J.jsx)(`div`,{className:`space-y-2`,children:e.evidence.map((e,t)=>(0,J.jsxs)(`div`,{className:`rounded border border-line/70 bg-bg/40 p-2.5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.label}),e.summary?(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:e.summary}):null,e.path?(0,J.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10px] text-blue-sky`,children:e.path}):null]},`${e.path}:${t}`))})]}):null,(0,J.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.question}),e.options.length?(0,J.jsx)(`div`,{className:`space-y-2`,children:e.options.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{d(e.id),h(``)},disabled:n,"aria-pressed":u===e.id,className:`w-full rounded-md border p-3 text-left ${u===e.id?`border-blue bg-blue/5`:`border-line bg-bg/30`}`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-ink`,children:e.label}),(0,J.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-ink-dim`,children:e.description})]},e.id))}):null,_||g||v?.requires_note||f?(0,J.jsx)(`textarea`,{"data-autofocus":!0,value:f,onChange:e=>{p(e.target.value),h(``)},onKeyDown:e=>{hu(e)||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},rows:3,disabled:n,"aria-label":_?c?`你的回答或补充说明`:`Your answer or additional details`:o(`decision.notePlaceholder`),placeholder:_?v?.requires_note?c?`填写你的回答…`:`Enter your answer…`:c?`补充说明(可选)`:`Additional details (optional)`:o(`decision.notePlaceholder`),className:`w-full resize-y rounded-lg border border-line bg-bg px-3 py-2 text-sm leading-relaxed text-ink outline-none focus:border-blue disabled:opacity-60`}):null,m||a?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:m||a}):null,(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:_?c?`确认后继续这次任务。`:`Confirm to continue this request.`:o(`decision.resumeHint`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md px-3 py-2 text-xs text-ink-dim hover:bg-bg`,children:o(n?`decision.closeContinue`:`decision.later`)}),(0,J.jsx)(`button`,{type:`button`,onClick:b,disabled:n,className:`rounded-md border border-blue/35 bg-blue/8 px-3 py-2 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-50`,children:o(n?`decision.applying`:g||u===`custom`?`decision.sendAnswer`:u===`stop`?`decision.stopCampaign`:`decision.useOption`)})]})]})]})]})}function Ud({alert:e}){if(!e)return null;let t=e.tone===`block`,n=e.kind===`budget`;return(0,J.jsxs)(`div`,{className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border px-3.5 py-2 text-[13px] ${t?`border-err/50 bg-err/10 text-err`:`border-warn/50 bg-warn/10 text-warn`}`,role:t?`alert`:`status`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-bold leading-none`,children:n?`$`:t?`!`:`i`}),(0,J.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold uppercase tracking-wide`,children:n?`budget alarm`:t?`action required`:`notice`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.text,children:e.text})]})}function Wd({sid:e}){let{t}=z(),n=M(),{data:r}=Me(e,!0),[i,a]=(0,G.useState)(!1);if(!e||!Dd(r?.operator_knobs))return null;let o=async()=>{a(!0);try{await R.setConfig(e,Td,`1`),await n.invalidateQueries({queryKey:[`config`,e]})}finally{a(!1)}};return(0,J.jsxs)(`div`,{"data-no-operator-banner":!0,role:`status`,className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border border-warn/50 bg-warn/10 px-3.5 py-2 text-[13px] text-warn`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:t(`noOperator.banner`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:i,className:`shrink-0 rounded border border-warn/50 px-2 py-0.5 text-xs font-medium hover:bg-warn/10 disabled:opacity-40`,children:t(`noOperator.turnOff`)})]})}function Gd(e){let t=(e.label||e.display_name||``).trim();return!!(t&&t!==e.id)}function Kd(e){return[...e].sort((e,t)=>{if(e.daemon_alive!==t.daemon_alive)return e.daemon_alive?-1:1;let n=Gd(e);return n===Gd(t)?(t.last_active||0)-(e.last_active||0):n?-1:1})}function qd(e){return Kd(e)[0]}function Jd(e,t){let n=t?.trim()||null;return n&&e.some(e=>e.id===n)?{id:n,requested:n,recovered:!1}:{id:qd(e)?.id??null,requested:n,recovered:!!n}}function Yd(e,t,n){if(n){let e=t?.trim()||null;return{id:e,requested:e,recovered:!1}}return Jd(e,t)}function Xd(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return!0;let r=e.daemon_alive?`live running`:`stopped idle`,i=[e.id,e.label,e.display_name,e.objective,r].filter(Boolean).join(` `).toLowerCase();return n.every(e=>i.includes(e))}function Zd(e,t){return e.filter(e=>Xd(e,t))}function Qd({sid:e,change:t,zh:n}){let[r,i]=(0,G.useState)({open:!1,loading:!1,diff:``,error:``,truncated:!1});return(0,J.jsxs)(`div`,{className:`delivery-changes`,children:[(0,J.jsx)(`button`,{type:`button`,"aria-expanded":r.open,onClick:()=>{if(r.open){i(e=>({...e,open:!1}));return}i(e=>({...e,open:!0,loading:!e.diff&&!e.error})),!(r.diff||r.error)&&R.deliveryDiff(e,t).then(e=>i(t=>({...t,loading:!1,truncated:e.truncated,diff:e.available?e.diff:``,error:e.available?e.diff?``:n?`内容没有变化`:`No content changes`:n?`上一版已不再保存,无法对比`:`The previous version is no longer kept`}))).catch(e=>i(t=>({...t,loading:!1,error:e instanceof Error?e.message:String(e)})))},children:r.open?n?`收起改动`:`Hide changes`:n?`查看与上一次交付相比的改动`:`Show changes since the previous delivery`}),r.open&&(r.loading?(0,J.jsx)(`p`,{children:n?`正在读取…`:`Loading…`}):r.error?(0,J.jsx)(`p`,{children:r.error}):(0,J.jsxs)(`pre`,{"aria-label":n?`改动`:`Changes`,children:[r.diff.split(` +`).map((e,t)=>(0,J.jsxs)(`span`,{className:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:void 0,children:[e,` +`]},t)),r.truncated?n?`…(改动过长,已截断)`:`… (truncated)`:``]}))]})}var $d=({children:e})=>(0,J.jsxs)(`span`,{children:[e,` `]}),ef=(0,G.memo)(function({children:e}){return(0,J.jsx)(F,{remarkPlugins:vt,rehypePlugins:ht,components:{p:$d,h1:$d,h2:$d,h3:$d,h4:$d,h5:$d,h6:$d,ul:$d,ol:$d,blockquote:$d,pre:$d,li:({children:e})=>(0,J.jsxs)(`span`,{className:`markdown-excerpt-item`,children:[e,` `]}),table:$d,thead:$d,tbody:$d,tr:$d,th:({children:e})=>(0,J.jsxs)(`strong`,{children:[e,` · `]}),td:$d,a:({children:e})=>(0,J.jsx)(`span`,{className:`markdown-excerpt-link`,children:e}),img:({alt:e})=>(0,J.jsx)(`span`,{children:e}),input:({checked:e})=>(0,J.jsx)(`span`,{children:e?`✓ `:`○ `}),hr:()=>(0,J.jsx)(`span`,{children:` · `}),code:({children:e})=>(0,J.jsx)(`code`,{children:e})},children:Go(e)})});function tf({html:e,title:t,className:n=``,sid:r,path:i}){return r&&i?(0,J.jsx)(nf,{sid:r,path:i,html:e,title:t,className:n}):(0,J.jsx)(`iframe`,{title:t,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white ${n}`})}function nf({html:e,title:t,className:n,sid:r,path:i}){let{locale:a}=z(),o=a===`zh-CN`,s=A({queryKey:[`artifact-html`,r,i,e],queryFn:({signal:e})=>R.artifactPreview(r,i,e),enabled:!!(r&&i),staleTime:3e4,retry:1});if(r&&i&&s.isPending)return(0,J.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,role:`status`,children:o?`正在加载网页和配套资源…`:`Loading the website and its assets…`});if(r&&i&&s.isError)return(0,J.jsxs)(`div`,{className:`m-auto p-6 text-sm text-err`,role:`alert`,children:[o?`网页预览加载失败,请重试或下载文件。`:`Preview could not load. Retry or download the file.`,(0,J.jsx)(`button`,{type:`button`,className:`ml-3 underline`,onClick:()=>void s.refetch(),children:o?`重试`:`Retry`})]});let c=s.data?.served_page===!0;return(0,J.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col ${n}`,children:[!!s.data?.warnings.length&&(0,J.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`部分配套资源无法加载,页面可能不完整。`:`Some linked assets are unavailable; the preview may be incomplete.`}),!c&&(0,J.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`此后端尚未支持独立网页预览;当前为内嵌预览,交互脚本可能不可用。`:`This backend does not yet support standalone preview; embedded preview may not run interactive scripts.`}),(0,J.jsx)(`iframe`,{title:t,src:c?me(r,i):void 0,srcDoc:c?void 0:s.data?.html??e,sandbox:`allow-scripts allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]})}function rf(e){let t=e.trim();if(!t)return``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{try{return t.split(/\r?\n/).filter(Boolean).map(e=>JSON.parse(e)).map(e=>JSON.stringify(e,null,2)).join(` +`)}catch{return e}}}function af(e,t){let n=[],r=[],i=``,a=!1;for(let o=0;oe.some(e=>e.length>0))}function of({value:e}){return(0,J.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:rf(e)||`(empty data)`})}function sf({value:e,delimiter:t}){let n=af(e,t).slice(0,200),r=n[0]??[];return(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4 scroll-thin`,children:n.length?(0,J.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:r.slice(0,40).map((e,t)=>(0,J.jsx)(`th`,{className:`border border-line/60 bg-surface px-2 py-1.5 font-semibold text-ink`,children:e},t))})}),(0,J.jsx)(`tbody`,{children:n.slice(1).map((e,t)=>(0,J.jsx)(`tr`,{children:r.slice(0,40).map((t,n)=>(0,J.jsx)(`td`,{className:`border border-line/50 px-2 py-1.5 align-top text-ink-dim`,children:e[n]??``},n))},t))})]}):(0,J.jsx)(`div`,{className:`text-sm text-ink-faint`,children:`(empty table)`})})}var cf=``+new URL(`pdf.min-Bbvtrhlt.mjs`,import.meta.url).href,lf=``+new URL(`pdf.worker.min-CLrFZWeq.mjs`,import.meta.url).href,uf=null,df=0;function ff(){uf=null,df+=1}function pf(){if(uf)return uf;let e=new URL(cf,import.meta.url),t=new URL(lf,import.meta.url);df&&(e.searchParams.set(`retry`,String(df)),t.searchParams.set(`retry`,String(df)));let n=Ne(()=>import(e.href).then(e=>(e.GlobalWorkerOptions.workerSrc=t.href,e)),[],import.meta.url).catch(e=>{throw uf===n&&ff(),e});return uf=n,n}function mf(e,t,n,r){let i=Math.max(1,n-32)/Math.max(1,e),a=Math.max(1,r-32)/Math.max(1,t);return Math.min(2.5,i,a)}function hf({src:e,name:t,className:n=``,onPageOrientation:r,onRetry:i}){let{locale:a}=z(),o=a===`zh-CN`,s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(1),[m,h]=(0,G.useState)(1),[g,_]=(0,G.useState)({width:0,height:0}),[v,y]=(0,G.useState)(!0),[b,x]=(0,G.useState)(!1),[S,C]=(0,G.useState)(``),[w,T]=(0,G.useState)(0);(0,G.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>_({width:e.clientWidth,height:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,G.useEffect)(()=>{let t=!0,n=new AbortController,r=null;return d(null),p(1),h(1),l.current=null,c.current?.scrollTo(0,0),C(``),y(!0),Promise.all([fetch(e,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`PDF request failed (${e.status})`);return e.arrayBuffer()}),pf()]).then(async([e,n])=>{if(!t)return;r=n.getDocument({data:new Uint8Array(e)});let i=await r.promise;t&&(d(i),y(!1))}).catch(e=>{t&&(y(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!1,n.abort(),r?.destroy().catch(()=>{})}},[e,w]),(0,G.useEffect)(()=>{let e=s.current;if(!u||!e||g.width<=0||g.height<=0)return;let t=!1,n=null;return x(!0),C(``),u.getPage(f).then(e=>{if(t||!s.current)return;let i=e.getViewport({scale:1});r?.(i.width>i.height?`landscape`:`portrait`);let a=mf(i.width,i.height,g.width,g.height),o=e.getViewport({scale:a*m}),u=document.createElement(`canvas`),d=u.getContext(`2d`,{alpha:!1});if(!d)throw Error(`Canvas rendering is unavailable`);let f=Math.min(window.devicePixelRatio||1,2);return u.width=Math.max(1,Math.floor(o.width*f)),u.height=Math.max(1,Math.floor(o.height*f)),n=e.render({canvas:u,canvasContext:d,viewport:o,transform:f===1?void 0:[f,0,0,f,0,0]}),n.promise.then(()=>{if(t||!s.current)return;let e=s.current,n=e.getContext(`2d`,{alpha:!1});if(!n)throw Error(`Canvas rendering is unavailable`);e.width=u.width,e.height=u.height,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`,n.drawImage(u,0,0);let r=c.current,i=l.current;if(r&&i){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect();r.scrollLeft+=n.left+i.x*n.width-t.left-r.clientWidth/2,r.scrollTop+=n.top+i.y*n.height-t.top-r.clientHeight/2,l.current=null}})}).then(()=>{t||x(!1)}).catch(e=>{t||e instanceof Error&&e.name===`RenderingCancelledException`||(x(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!0,n?.cancel()}},[r,f,u,g.height,g.width,m]);let E=e=>{let t=c.current,n=s.current;if(t&&n&&n.clientWidth&&n.clientHeight){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();l.current={x:Math.max(0,Math.min(1,(e.left+t.clientWidth/2-r.left)/r.width)),y:Math.max(0,Math.min(1,(e.top+t.clientHeight/2-r.top)/r.height))}}h(t=>Math.max(.6,Math.min(2.2,Math.round((t+e)*100)/100)))},D=()=>{l.current=null,c.current?.scrollTo(0,0),h(1)},O=u?.numPages??0;return(0,J.jsxs)(`div`,{className:`pdf-viewer flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-bg ${n}`,"aria-busy":v||b,children:[(0,J.jsxs)(`div`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-2 border-b border-line/70 bg-panel px-3 py-1.5 text-[11px] text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink`,title:t,children:t}),(0,J.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[o?`第`:`Page`,` `,f,` / `,O||`…`]}),(0,J.jsx)(`button`,{type:`button`,disabled:!u||f<=1,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.max(1,e-1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`上一页`:`Previous`}),(0,J.jsx)(`button`,{type:`button`,disabled:!u||f>=O,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.min(O,e+1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`下一页`:`Next`}),(0,J.jsx)(`button`,{type:`button`,"aria-label":o?`缩小`:`Zoom out`,disabled:!u||m<=.6,onClick:()=>E(-.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`−`}),(0,J.jsxs)(`span`,{className:`w-10 text-center font-mono tabular-nums`,children:[Math.round(m*100),`%`]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":o?`放大`:`Zoom in`,disabled:!u||m>=2.2,onClick:()=>E(.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`+`}),(0,J.jsx)(`button`,{type:`button`,disabled:!u,onClick:D,className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`适合页面`:`Fit page`})]}),(0,J.jsxs)(`div`,{ref:c,className:`pdf-scroll-viewport relative min-h-0 min-w-0 flex-1 overflow-auto bg-surface/60 p-4 scroll-thin`,tabIndex:0,"aria-label":o?`PDF 页面滚动区域`:`PDF page scroll area`,children:[v?(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,J.jsx)(tt,{})}):null,S?(0,J.jsxs)(`div`,{role:`alert`,className:`m-auto max-w-sm rounded border border-err/35 bg-err/5 p-4 text-center text-sm text-err`,children:[(0,J.jsx)(`p`,{children:o?`PDF 暂时无法预览`:`PDF preview is temporarily unavailable`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>{ff(),i?i():T(e=>e+1)},className:`mt-3 rounded border border-line bg-panel px-3 py-1.5 text-ink hover:border-blue/50`,children:o?`重试预览`:`Retry preview`}),(0,J.jsxs)(`details`,{className:`mt-3 break-words text-xs text-ink-dim`,children:[(0,J.jsx)(`summary`,{children:o?`错误详情`:`Error details`}),S]})]}):null,S?null:(0,J.jsx)(`div`,{className:`pdf-page-stage flex min-h-full min-w-full w-max items-center justify-center`,children:(0,J.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`${t} · ${o?`第`:`page`} ${f}`,className:`block max-w-none shrink-0 bg-white shadow-xl`})})]})]})}function gf({sid:e,path:t,onClose:n,delivery:r,deliveries:i=[],onSelectDelivery:a,onSelectPath:o,reviewActivity:s,artifacts:c=[]}){let{t:l,locale:u}=z(),d=u===`zh-CN`,f=r?Uo(r):[],p=we(e,t),m=p.data,h=m?.source===`reader_foundation`?m.reader_foundation:void 0,g=m?.source===`progress_snapshot`,_=m?ss(m):!1,[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(``),[S,C]=(0,G.useState)(0),[w,T]=(0,G.useState)(!1),[E,D]=(0,G.useState)(!1),[O,k]=(0,G.useState)(`portrait`),A=m?.kind===`pdf`||t?.toLowerCase().endsWith(`.pdf`)===!0,j=!!(t&&/(?:^|[\\/])REVIEW\.md$/i.test(t));(0,G.useEffect)(()=>{if(!(!t||!A))return jr(!0),()=>jr(!1)},[t,A]),(0,G.useEffect)(()=>{if(k(`portrait`),y(null),x(``),!e||!t||!m||![`image`,`pdf`,`audio`,`video`].includes(m.kind))return;let n=!0,r=``,i=new AbortController;return R.artifactBlob(e,t,!1,i.signal).then(e=>{n&&(r=URL.createObjectURL(e),y(r))},e=>n&&x(e.message)),()=>{n=!1,i.abort(),r&&URL.revokeObjectURL(r)}},[e,t,m?.kind,S]);let M=async(n=!1)=>{if(!(!e||!t||!m)){T(!0),x(``);try{let r=n?await R.artifactBundle(e,t):await R.artifactBlob(e,t,!0);ut(r,n?`${m.name.replace(/\.html?$/i,``)}-website.zip`:m.name)}catch(e){x(e.message)}finally{T(!1)}}};return(0,J.jsxs)(dt,{open:!!(t||r),onClose:n,label:r?d?`交付成果`:`Delivery`:l(`artifact.preview`),width:r?E?`max-w-none`:`max-w-6xl`:A?`max-w-none`:`max-w-5xl`,viewport:r?E:A,showClose:!1,style:r?{height:E?`100dvh`:`min(92dvh, 960px)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:A?{maxWidth:O===`portrait`?`min(96vw, 76dvh)`:`min(96vw, 145dvh)`}:void 0,children:[r&&!E&&(0,J.jsxs)(`header`,{className:`delivery-header`,children:[(0,J.jsxs)(`div`,{className:`delivery-heading`,children:[(0,J.jsx)(`span`,{className:`delivery-mark`,children:(0,J.jsx)(sn,{size:22})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`p`,{children:[`DELIVERY · `,d?`交付成果`:`Your results`]}),(0,J.jsx)(`h2`,{children:d?`成果文件`:`Result files`})]}),(0,J.jsxs)(`button`,{type:`button`,onClick:n,className:`delivery-return`,"aria-label":d?`关闭交付弹窗`:`Close delivery`,children:[d?`返回地图`:`Back to map`,` ×`]})]}),i.length>1?(0,J.jsx)(`select`,{"aria-label":d?`选择交付任务`:`Choose delivery`,className:`delivery-task-select`,value:r.delivery_id,onChange:e=>{let t=i.find(t=>t.delivery_id===e.target.value);t&&a?.(t)},children:i.map(e=>(0,J.jsx)(`option`,{value:e.delivery_id,children:e.title},e.delivery_id))}):(0,J.jsx)(`p`,{className:`delivery-task-title`,title:r.title,children:r.title}),(0,J.jsxs)(`div`,{className:`delivery-facts`,children:[(()=>{let e=Yo(r,d);return(0,J.jsxs)(`span`,{className:e.independent?`delivery-review-independent`:`delivery-review-self`,title:e.title,children:[e.independent?(0,J.jsx)(Kt,{size:13}):null,e.text]})})(),(0,J.jsxs)(`span`,{children:[f.length,` `,d?`个文件`:`files`]})]}),r.summary&&(0,J.jsxs)(`details`,{className:`delivery-summary`,children:[(0,J.jsx)(`summary`,{children:d?`查看成果说明`:`Result summary`}),(0,J.jsx)(`p`,{children:(0,J.jsx)(ef,{children:r.summary})})]})]}),!E&&!!f.length&&(0,J.jsx)(`nav`,{className:`delivery-files`,"aria-label":d?`交付文件`:`Delivery files`,children:f.map(e=>(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":t===e.path,onClick:()=>o?.(e.path),title:e.path,children:[(0,J.jsx)(`span`,{children:e.path.split(`/`).at(-1)}),r?.primary_target?.path===e.path&&(0,J.jsx)(`small`,{children:d?`主要成果`:`Main result`})]},e.path))}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-line px-4 py-3 sm:px-5 ${t?``:`hidden`}`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink ${h||g?``:`font-mono`}`,title:h?.question??m?.progress_source?.title??m?.storage_path??m?.path??t??``,children:h?cs(h):g?m?.progress_source?.title||l(`artifact.title`):m?.name??t??l(`artifact.title`)}),(0,J.jsx)(`p`,{className:`mt-0.5 truncate text-[11px] text-ink-faint`,children:h?h.kind===`clarification`||h.kind===`progress_answer`?d?`阅读问答`:`Reading question and answer`:d?`背景说明 · 不计作研究进展`:`Background explanation · separate from research progress`:g?d?`保存的进展说明 · 提问来源`:`Saved progress explanation · question source`:m?`${m.kind} · ${yt(m.size)} · ${m.mime}`:d?`正在读取文件`:`Loading file`})]}),r&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>D(e=>!e),"aria-label":E?d?`收起预览`:`Exit full screen`:d?`全屏预览`:`Full screen preview`,title:d?`切换全屏预览`:`Toggle full screen preview`,className:`shrink-0 rounded-md border border-line p-2 text-ink-dim`,children:E?(0,J.jsx)(on,{size:16}):(0,J.jsx)(rn,{size:16})}),m?.kind===`html`&&(0,J.jsx)(`button`,{type:`button`,disabled:w,onClick:()=>void M(!0),className:`shrink-0 rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-2 text-xs text-blue-sky disabled:opacity-50`,children:d?`下载完整网页`:`Download website`}),(0,J.jsx)(`button`,{type:`button`,disabled:!m||w,onClick:()=>void M(),className:`rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-1.5 text-xs text-blue-sky transition-colors hover:bg-blue-deep/20 disabled:cursor-wait disabled:opacity-50`,children:l(w?`artifact.downloading`:`artifact.download`)}),(!r||E)&&(0,J.jsx)(`button`,{type:`button`,"aria-label":l(`artifact.close`),onClick:n,className:`rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink`,children:`×`})]}),(0,J.jsxs)(`div`,{className:r?`flex min-h-0 flex-1 flex-col overflow-auto bg-bg/40 p-2 sm:p-3`:A?`flex min-h-0 flex-1 flex-col overflow-hidden bg-bg/40`:`flex min-h-64 max-h-[72vh] flex-col overflow-x-hidden overflow-y-auto bg-bg/40 p-3 scroll-thin sm:p-4`,children:[!t&&r&&(0,J.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,children:(0,J.jsx)(ef,{children:r.summary})}),r&&e&&(()=>{let n=Xo(r,i,t);return n?(0,J.jsx)(Qd,{sid:e,change:n,zh:d},`${n.before}:${n.after}`):null})(),p.isLoading?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,p.isError?(0,J.jsxs)(`div`,{className:`m-auto text-sm text-err`,children:[l(`artifact.unavailable`),` · `,p.error.message]}):null,m?.why&&!h&&!g&&!A&&!r?(0,J.jsxs)(`div`,{className:`mb-3 rounded-md border border-line bg-surface px-3 py-2 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`mr-1 text-ink-faint`,children:`Reviewer:`}),m.why]}):null,m?.kind===`text`&&!_?(0,J.jsxs)(`pre`,{className:`min-h-52 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-bg p-4 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:[m.preview||l(`artifact.empty`),m.truncated?`\n\n… ${l(`artifact.truncated`)}`:``]}):null,m&&_?(0,J.jsxs)(`div`,{className:`min-h-52 overflow-auto rounded-lg border border-line bg-bg p-4 text-sm text-ink-dim scroll-thin`,children:[j&&(0,J.jsxs)(`div`,{className:`mb-4 border-b border-line pb-3 text-xs leading-5 text-ink-faint`,role:`status`,children:[s===`revising`?d?`正在根据这份意见修改论文,修改后的版本尚待复审。`:`The paper is being revised against this opinion; the revised version awaits review.`:s===`reviewing`?d?`Reviewer 正在更新本轮审稿意见,内容会自动刷新。`:`The Reviewer is updating this round’s opinion. This file refreshes automatically.`:d?`这是最近保存的审稿意见,文件更新后会自动刷新。`:`This is the latest saved review. Changes to this file appear automatically.`,m.mtime!=null&&(0,J.jsxs)(`div`,{children:[d?`最近更新:`:`Last updated: `,new Date(m.mtime*1e3).toLocaleString(u)]})]}),(0,J.jsx)(H,{sid:e,basePath:t||``,artifacts:[...c,...f.map(e=>({path:e.path})),...h?.sources??[],...h?.progress_source?[{path:h.progress_source.path}]:[]],onOpenArtifact:o,children:m.preview||l(`artifact.empty`)}),m.truncated?(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 border-t border-line pt-2 text-xs text-ink-faint`,children:[l(`artifact.truncated`),` · `,l(`artifact.downloadHint`)]}):null]}):null,m?.kind===`json`?(0,J.jsx)(of,{value:m.preview||``}):null,m?.kind===`table`?(0,J.jsx)(sf,{value:m.preview||``,delimiter:m.name.endsWith(`.tsv`)?` `:`,`}):null,m?.kind===`html`?(0,J.jsx)(`div`,{className:`flex flex-1 overflow-hidden rounded-lg border border-line ${r?`min-h-0`:`min-h-[60vh]`}`,children:(0,J.jsx)(tf,{sid:e,path:t,html:m.preview||``,title:`HTML preview: ${m.name}`})}):null,m?.kind===`image`&&v?(0,J.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-bg/50`,children:(0,J.jsx)(`img`,{src:v,alt:m.why||m.name,className:`max-h-[62vh] max-w-full object-contain`})}):null,m?.kind===`pdf`&&v?(0,J.jsx)(hf,{src:v,name:m.name,className:`min-h-0 overflow-hidden`,onPageOrientation:k,onRetry:()=>C(e=>e+1)}):null,m?.kind===`audio`&&v?(0,J.jsx)(`div`,{className:`m-auto w-full max-w-xl`,children:(0,J.jsx)(`audio`,{controls:!0,preload:`metadata`,src:v,className:`w-full`})}):null,m?.kind===`video`&&v?(0,J.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-black`,children:(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:v,className:`max-h-[62vh] max-w-full`})}):null,m&&[`image`,`pdf`,`audio`,`video`].includes(m.kind)&&!v&&!b?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,m?.kind===`binary`?(0,J.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-ink-dim`,children:l(`artifact.noPreview`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:l(`artifact.downloadHint`)})]}):null,b?(0,J.jsx)(`div`,{className:`mt-3 text-center text-xs text-err`,children:b}):null]})]})}function _f({sid:e,objective:t,taskId:n,taskTitle:r,readOnly:i,onOpenArtifact:a}){let{locale:o}=z(),s=o===`zh-CN`,c=s?`zh-CN`:`en-US`,l=(e,t)=>s?e:t,u=ps(e,c),{client:d,list:f,generation:p,progress:m,creationBlocked:h}=u,g=Bo(e,c),[_,v]=(0,G.useState)(null);(0,G.useEffect)(()=>v(null),[e,c]);let y=u.pendingRequest?.draft.progressSource?null:u.pendingRequest,b=u.notes.filter(e=>!e.reader_foundation?.progress_source&&e.reader_foundation?.kind!==`progress_answer`),x=b.filter(fs),S=x.find(e=>e.reader_foundation?.id===g.id),C=S?b.filter(e=>e.reader_foundation?.kind===`clarification`&&e.reader_foundation.root_id===S.reader_foundation?.id).reverse():[],w=S?.exists&&S.reader_foundation?.state===`complete`,T=b.some(e=>e.reader_foundation?.state===`generating`),E=b.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),D=b.filter(e=>e.reader_foundation?.state===`failed`),O=b.filter(e=>e.exists&&e.reader_foundation?.state===`complete`),k=!u.pendingRequest?.draft.progressSource&&u.creating,A=!u.requested?.reader_foundation?.progress_source&&u.confirmedFailure,j=!!y&&u.requestRejected,M=!!y&&u.unknownResult,ee=()=>{!_?.question.trim()||i||h||_.parentId&&!O.some(e=>e.reader_foundation?.id===_.parentId)||u.submit(_)&&v(null)},N=e=>{i||h||!e.exists||e.reader_foundation?.state!==`complete`||v({question:``,parentId:e.reader_foundation.id,parentTitle:cs(e.reader_foundation)})};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`mx-4 mt-3 rounded-lg border border-line/70 bg-panel px-3 py-2`,"aria-label":l(`问题基础`,`Question foundations`),"data-testid":`question-foundation`,"data-project-id":e,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(K,{size:15,className:`text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:l(`问题基础`,`Question foundations`)}),(0,J.jsx)(`span`,{className:`hidden text-xs text-ink-faint sm:inline`,children:l(`一份说明,陪你读后续进展`,`A saved explanation to help you follow later progress`)}),i?null:(0,J.jsxs)(W,{className:`ml-auto inline-flex items-center gap-1 text-xs`,disabled:h,onClick:()=>v({question:t??``,sourceTaskId:n,sourceTitle:r}),children:[(0,J.jsx)(un,{size:12}),l(`从基础理解`,`Understand the foundations`)]})]}),x.length?(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`select`,{className:`min-w-0 flex-1 rounded border border-line bg-bg px-2 py-1.5 text-xs text-ink`,"aria-label":l(`选择基础说明`,`Choose a foundation explanation`),value:g.id??``,onChange:t=>Ro(d,e,c,t.target.value||null),children:[(0,J.jsx)(`option`,{value:``,children:l(`选择你正在理解的问题`,`Choose the question you are studying`)}),x.map(e=>(0,J.jsxs)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,disabled:!e.exists||e.reader_foundation.state!==`complete`,children:[cs(e.reader_foundation),e.reader_foundation.state===`generating`?l(` · 正在整理`,` · preparing`):e.exists?``:l(` · 尚未完成`,` · not completed`)]},e.path))]}),(0,J.jsx)(W,{className:`text-xs`,disabled:!w,onClick:()=>S&&a(S.path),children:l(`阅读基础说明`,`Read foundations`)}),!i&&S?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:!w||h,onClick:()=>N(S),children:[(0,J.jsx)(an,{size:12}),l(`问这份说明`,`Ask about these foundations`)]}):null]}):!f.isPending&&!k?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:l(`先选一个想理解的问题;保存后,后续进度会引用同一份说明。`,`Start with a question you want to understand. Later progress can refer to the same saved explanation.`)}):null,C.length?(0,J.jsxs)(`div`,{className:`mt-3 border-t border-line/60 pt-2`,"data-testid":`foundation-questions`,"data-foundation-id":S?.reader_foundation?.id,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:l(`围绕这份说明的问答`,`Questions about these foundations`)}),(0,J.jsx)(`ul`,{className:`mt-1 max-h-48 space-y-2 overflow-y-auto scroll-thin`,children:C.map(e=>(0,J.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,"data-reading-question-id":e.reader_foundation.id,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-ink-dim`,children:e.reader_foundation.question}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:e.reader_foundation.state===`generating`?l(`正在回答`,`Preparing an answer`):e.reader_foundation.state===`failed`||!e.exists?l(`这次回答未完成`,`This answer did not finish`):l(`回答已保存`,`Answer saved`)})]}),e.exists&&e.reader_foundation.state===`complete`?(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,children:[(0,J.jsx)(W,{className:`text-xs`,onClick:()=>a(e.path),children:l(`阅读回答`,`Read answer`)}),i?null:(0,J.jsx)(W,{className:`text-xs`,disabled:h,onClick:()=>N(e),children:l(`继续问`,`Ask a follow-up`)})]}):null]},e.path))})]}):null,f.isError?(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-ink-faint`,role:`status`,children:[(0,J.jsx)(`span`,{children:l(`已保存的基础说明暂时读取失败。`,`Saved explanations could not be loaded.`)}),(0,J.jsx)(W,{className:`text-xs`,disabled:f.isFetching,onClick:()=>void f.refetch(),children:l(`重新读取`,`Reload records`)})]}):null,k?(0,J.jsx)(`div`,{className:`mt-2`,children:m.active?(0,J.jsx)(is,{generating:!0,phase:m.phase}):(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:l(`正在核对保存结果`,`Checking the saved result`)})}):T?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:E?l(`等待时间已较长,仍未收到完整说明;生成尚未确认结束。`,`The wait is taking longer. A complete explanation has not arrived, and generation has not been confirmed to have stopped.`):l(`基础说明仍在整理,保存后会出现在这里。`,`An explanation is still being prepared. It will appear here when saved.`)}):null,A?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`这次说明未完成,失败记录已保留。可以重新明确生成一份。`,`This explanation did not finish. The failed request is retained; you can explicitly generate a new one.`)}):M?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`这次请求的结果尚未确认;刷新不会重新生成。`,`The result of this request is unconfirmed. Refreshing does not generate it again.`)}):null,j?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`引用的说明目前不可用,这次追问未发起。问题已保留,可以重新选择来源。`,`The reading source is unavailable, so this question was not started. Your question is saved; you can choose another source.`)}):null,!i&&y&&!k&&!T?j?(0,J.jsx)(W,{className:`mt-2 text-xs`,onClick:()=>{v(y.draft),p.reset()},children:l(`编辑问题与来源`,`Edit question and source`)}):(0,J.jsx)(W,{className:`mt-2 text-xs`,onClick:()=>u.retrySavedRequest(y),children:l(`重试同一请求`,`Retry this same request`)}):null,!i&&D.length?(0,J.jsx)(ft,{label:l(`未完成的说明(${D.length})`,`Unfinished explanations (${D.length})`),children:(0,J.jsx)(`div`,{className:`max-h-[24vh] overflow-y-auto`,children:D.map(e=>(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-ink-faint`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.reader_foundation.question,children:[l(`未完成:`,`Not completed: `),e.reader_foundation.question]}),(0,J.jsx)(W,{className:`shrink-0 text-xs`,disabled:h,onClick:()=>v({question:e.reader_foundation.question,sourceTaskId:e.reader_foundation.source_task_id??void 0,parentId:e.reader_foundation.parent_id??void 0,parentTitle:e.reader_foundation.parent_id?cs(b.find(t=>t.reader_foundation?.id===e.reader_foundation.parent_id)?.reader_foundation??{question:l(`先前选择的说明`,`Previously selected reading`)}):void 0}),children:l(`重新编辑问题`,`Edit this question`)})]},e.path))})}):null,(0,J.jsx)(`p`,{className:`mt-1.5 text-[11px] text-ink-faint`,children:l(`说明和问答会保存下来,供你随时回看。`,`Explanations and questions are saved for later reading.`)})]}),(0,J.jsxs)(dt,{open:!!_,onClose:()=>v(null),label:_?.parentId?l(`继续理解`,`Ask about your reading`):l(`从基础理解`,`Understand the foundations`),children:[(0,J.jsx)(lt,{title:_?.parentId?l(`哪里还不明白`,`What is still unclear`):l(`你想理解什么`,`What would you like to understand`),sub:_?.parentId?l(`可以引用一句话,或者写下算不明白的那一步。`,`Quote a sentence or describe the step you could not work through.`):l(`用自己的话选定一个问题,说明会保存下来供以后阅读。`,`Choose a question in your own words. Its explanation will be saved for later reading.`)}),(0,J.jsxs)(`div`,{className:`px-6 pb-6`,children:[_?.parentId?(0,J.jsxs)(`label`,{className:`mb-3 block text-xs text-ink-dim`,children:[l(`引用的说明或回答`,`Reading source`),(0,J.jsxs)(`select`,{"aria-label":l(`引用的说明或回答`,`Reading source`),className:`mt-1 block w-full min-w-0 rounded border border-line bg-bg px-2 py-2 text-xs text-ink`,value:_.parentId,onChange:t=>{let n=O.find(e=>e.reader_foundation?.id===t.target.value);n&&(v(e=>e&&{...e,parentId:n.reader_foundation.id,parentTitle:cs(n.reader_foundation)}),Ro(d,e,c,n.reader_foundation.root_id??n.reader_foundation.id))},children:[O.some(e=>e.reader_foundation?.id===_.parentId)?null:(0,J.jsxs)(`option`,{value:_.parentId,disabled:!0,children:[_.parentTitle||l(`原来源`,`Original source`),l(` · 当前不可用`,` · unavailable`)]}),O.map(e=>(0,J.jsx)(`option`,{value:e.reader_foundation.id,children:cs(e.reader_foundation)},e.path))]})]}):null,_?(0,J.jsx)(us,{draft:_,onChange:v,onSubmit:ee,disabled:h||i||!!_.parentId&&!O.some(e=>e.reader_foundation?.id===_.parentId)}):null]})]})]})}var vf=[`manager`,`planner`,`engineer`,`reviewer`],yf=new Set([`planner`,`engineer`,`reviewer`]),bf=new Set([`running`,`in_progress`,`claimed`]),$=(e,t)=>String(e[t]??``).trim(),xf=(e,t)=>{let n=Number(e[t]);return Number.isFinite(n)?n:null};function Sf(e){return JSON.parse(JSON.stringify(e))}function Cf(){return{schema_version:7,bootstrapped:!1,language:``,mission:{id:``,title:``,objective:``,summary:``,final_output:``,status:`idle`,started_at:null,completed_at:null,elapsed_seconds:0,campaign_started_at:null,campaign_elapsed_seconds:0},stage:{id:``,label:``},routing:{route:``,vertical:``,workflow_mode:``,lifetime:``,continuous:!1,open_ended:!1},round:{current:0,max:0},active_role:``,roles:vf.map(e=>({role:e,status:`waiting`,label:`Waiting`,updated_at:0})),role_work:[],dag:[],timeline:[],artifacts:[],learned_skills:[],learned_wiki_pages:[],storage:{project_skill_dir:``,global_skill_dir:``,project_skill_count:0,global_skill_count:0,skill_history_compressed:0,wiki_retired_compressed:0,skill_history_bytes_saved:0,wiki_retired_bytes_saved:0,wiki_paths:[]},achievement:null,review:{status:``,reason:``,rejected_attempts:0},frontier:{change:``,summary:``,updated_at:0},delivery:null,outcome:{},last_event_ts:0,updated_at:0}}function wf(e,t,n,r){if(n==null||n===``)return;let i=e.findIndex(e=>e[t]===n);i>=0?e[i]={...e[i],...r}:e.push(r)}function Tf(e,t,n,r,i){if(!vf.includes(t))return;n===`active`&&yf.has(t)&&e.roles.forEach(e=>{yf.has(e.role)&&e.role!==t&&e.status===`active`&&Object.assign(e,{status:`done`,label:`Handed off`,updated_at:i})});let a={role:t,status:n,label:r,updated_at:i};wf(e.roles,`role`,t,a),n===`active`?e.active_role=t:e.active_role===t&&(e.active_role=``)}function Ef(e,t,n,r,i=``,a=`neutral`){let o=Re(t);if(e.timeline.some(e=>e.id===o))return;let s={id:o,ts:Number(t.ts??Date.now()/1e3),type:ie(t.type),role:n,title:r.slice(0,180),detail:i.slice(0,500),tone:a};[`item_id`,`branch_id`].forEach(e=>{let n=$(t,e);n&&(s[e]=n)}),e.timeline=[...e.timeline,s].slice(-120)}function Df(e,t,n,r,i,a=``,o=``){if(!vf.includes(n))return;let s=$(t,`message_id`),c=s?`${n}:${s}`:Re(t),l=e.role_work.find(e=>e.id===c),u=l&&l.detail.length>a.length?l.detail:a,d={id:c,ts:Number(t.ts??Date.now()/1e3),role:n,kind:r,title:i.slice(0,240),detail:u.slice(0,4e3),status:o,item_id:$(t,`item_id`),mission_id:e.mission.id,mission_title:e.mission.title.slice(0,240),round_index:xf(t,`round_index`)},f=e.role_work.findIndex(e=>e.id===c);f>=0?e.role_work[f]=d:e.role_work.push(d);let p=new Set;vf.forEach(t=>{e.role_work.filter(e=>e.role===t).slice(-40).forEach(e=>p.add(e.id))}),e.role_work=e.role_work.filter(e=>p.has(e.id))}function Of(e){return e===`ok`?`success`:e===`err`?`error`:`info`}var kf={agent_message:`Reporting progress`,assistant_message:`Reporting progress`,command_execution:`Running a command`,reasoning:`Reasoning`,tool_use:`Using a tool`,tool_result:`Inspecting tool output`,codex_idle:`Waiting for model output`};function Af(e,t){let n=ie(t.type),r=Number(t.ts??Date.now()/1e3);if(e.last_event_ts=Math.max(e.last_event_ts,r),n===I.LIFE_MANAGER_INTENT_STARTED)e.mission.id=$(t,`item_id`)||$(t,`intent_id`),e.mission.title=$(t,`objective`).slice(0,240),e.mission.objective=$(t,`objective`),e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`grounding`,Tf(e,`manager`,`active`,`Grounding project`,r),Ef(e,t,`manager`,`Project grounding started`,$(t,`objective`)),Df(e,t,`manager`,`grounding`,`Grounding project`,$(t,`objective`),`active`);else if(n===I.LIFE_MANAGER_INTENT_COMPLETED){let n=$(t,`execution_task`)||$(t,`objective`);e.mission.id=$(t,`item_id`),e.mission.title=n.slice(0,240),e.mission.objective=n,e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`framed`,e.routing.route=$(t,`route`)||e.routing.route||`team`,e.routing.vertical=$(t,`vertical`)||e.routing.vertical,e.routing.workflow_mode=$(t,`workflow_mode`)||e.routing.workflow_mode,e.routing.lifetime=$(t,`lifetime`)||e.routing.lifetime,`continuous`in t&&(e.routing.continuous=t.continuous===!0),`open_ended`in t&&(e.routing.open_ended=t.open_ended===!0);let i=$(t,`current_stage`),a=Array.isArray(t.stages)?t.stages:[];if(i)e.stage={id:i,label:i.replaceAll(`_`,` `)};else if(!e.stage.id&&a[0]){let t=String(a[0]);e.stage={id:t,label:t.replaceAll(`_`,` `)}}Tf(e,`manager`,`done`,`Goal framed`,r),Ef(e,t,`manager`,`Goal framed`,$(t,`reason`),`success`),Df(e,t,`manager`,`decision`,`Goal framed`,$(t,`reason`)||$(t,`execution_task`),`done`)}else if(n===I.LIFE_MANAGER_INTENT_FAILED)e.mission.status=`failed`,Tf(e,`manager`,`error`,`Manager routing failed`,r),Ef(e,t,`manager`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`),Df(e,t,`manager`,`grounding`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`);else if(n===I.LIFE_MANAGER_STAGE_DECISION){let n=$(t,`target_stage`)||$(t,`stage`)||$(t,`current_stage`);n&&(e.stage={id:n,label:n.replaceAll(`_`,` `)}),Tf(e,`manager`,`done`,n?`Stage · ${n}`:`Stage reviewed`,r),Ef(e,t,`manager`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`)),Df(e,t,`manager`,`stage_decision`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`),$(t,`action`))}else if(n===I.LIFE_PLANNER_START)Tf(e,`planner`,`active`,`Planning next work`,r),Df(e,t,`planner`,`planning`,`Planning next work`,$(t,`objective`),`active`);else if(n===I.LIFE_PLANNER_TASK_ADDED){let n=$(t,`item_id`),i={id:n,title:$(t,`title`),objective:$(t,`objective`),status:`pending`,deps:Array.isArray(t.deps)?t.deps.map(String):[],branch_id:$(t,`branch_id`)||n,parent_branch_id:$(t,`parent_branch_id`)||null};wf(e.dag,`id`,n,i);let a=e.routing.vertical===`research`?`Research branch added`:`Task added`;Tf(e,`planner`,`done`,a,r),Ef(e,t,`planner`,a,i.title,`info`),Df(e,t,`planner`,`task`,i.title||`Task added`,i.objective,`pending`)}else if(n===I.LIFE_PLANNER_VERDICT){let n=!!t.project_done,i=n&&t.delivery&&typeof t.delivery==`object`&&!Array.isArray(t.delivery)?JSON.parse(JSON.stringify(t.delivery)):null,a=i?`Task completed`:n?`Project reviewed`:`Planning complete`;i&&(e.delivery=i,e.mission.status=`complete`,e.mission.summary=i.summary||``,e.mission.completed_at=r),Tf(e,`planner`,`done`,a,r),Ef(e,t,`planner`,a,$(t,`reason`),n?`success`:`neutral`),Df(e,t,`planner`,`verdict`,a,$(t,`reason`),n?`done`:`planned`)}else if(n===I.LIFE_PLANNER_WAITING){Tf(e,`planner`,`waiting`,`Waiting on external work`,r);let n=$(t,`reason`)||$(t,`waiting_reason`);Ef(e,t,`planner`,`Planner waiting`,n),Df(e,t,`planner`,`waiting`,`Planner waiting`,n,`waiting`)}else if(n===I.LIFE_MISSION_STARTED)e.review={status:``,reason:``,rejected_attempts:0},e.delivery=null,e.mission.campaign_started_at??=r,e.mission={...e.mission,id:$(t,`item_id`),title:$(t,`title`),objective:$(t,`objective`),summary:``,final_output:``,status:`working`,started_at:r,completed_at:null},Tf(e,`reviewer`,`waiting`,`Waiting for the Engineer to finish`,r),Tf(e,`engineer`,`active`,`Starting mission`,r),Ef(e,t,`engineer`,`Mission started`,$(t,`title`),`info`),Df(e,t,`engineer`,`task`,$(t,`title`)||`Mission started`,$(t,`objective`),`active`);else if(n===I.ROUND_START)e.round={current:xf(t,`round_index`)??0,max:xf(t,`round_max`)??e.round.max},Tf(e,`engineer`,`active`,`Running round ${e.round.current}`,r),Ef(e,t,`engineer`,`Round ${e.round.current} started`);else if(n===I.ENGINEER_PROGRESS){let n=$(t,`agent_layer`)||$(t,`actor`)||`engineer`,i=n===`main`?`engineer`:n,a=$(t,`kind`),o=kf[a]??`Working`;Tf(e,i,`active`,o,r),i===`engineer`&&[`assistant_message`,`agent_message`,`message`].includes(a)&&t.final_delivery===!0&&e.mission.started_at!=null&&e.mission.completed_at==null&&r>=e.mission.started_at&&(!t.item_id||$(t,`item_id`)===e.mission.id)&&(e.mission.final_output=pe(t.text));let s=$(t,`action_summary`)||$(t,`text`);s&&!fe(t)&&!re(t)&&Df(e,t,i,a||`progress`,o,s,`active`),[`reasoning`,`assistant_message`,`agent_message`].includes(a)||Ef(e,t,i,o,$(t,`action_summary`)||$(t,`text`))}else if(n===I.ROUND_MAIN_COMPLETED)Tf(e,`engineer`,`done`,`Work ready for review`,r),Df(e,t,`engineer`,`handoff`,`Work ready for review`,$(t,`text`)||$(t,`summary`),`done`);else if(n===I.ROUND_REVIEW_STARTED)e.review={status:``,reason:``,rejected_attempts:e.review.rejected_attempts},Tf(e,`reviewer`,`active`,`Reviewing benchmark evidence`,r),Df(e,t,`reviewer`,`review`,`Review started`,``,`active`);else if(n===I.ROUND_REVIEW_DEFERRED){let n=$(t,`next_step`);Tf(e,`engineer`,`active`,`Continuing before review`,r),Tf(e,`reviewer`,`waiting`,`Review deferred for one round`,r),Ef(e,t,`engineer`,`Continued before review`,n,`info`)}else if(n===I.ROUND_REVIEW_COMPLETED){let n=t.review_skipped===!0,i=n?`skipped`:$(t,`status`),a=$(t,`reason`);e.review={status:i,reason:a,rejected_attempts:e.review.rejected_attempts+ +!![`continue`,`blocked`].includes(i)};let o=$(t,`frontier_change`);o&&(e.frontier={change:o,summary:$(t,`frontier_summary`),updated_at:r});let s=n?`No review this round`:i===`done`?`Evidence accepted`:`Attempt rejected`;Tf(e,`reviewer`,n?`waiting`:i===`done`?`done`:`rejected`,n?s:i===`done`?`Accepted evidence`:`Requested another attempt`,r),Ef(e,t,`reviewer`,s,a,n?`info`:i===`done`?`success`:`error`);let c=$(t,`next_action`);Df(e,t,`reviewer`,n?`review`:`verdict`,s,c?`${a}\n\nNext action: ${c}`:a,i)}else if([I.SKILL_CREATED,I.SKILL_UPDATED].includes(n)){let i=$(t,`skill_id`)||$(t,`name`);i&&(wf(e.learned_skills,`id`,i,{id:i,name:$(t,`name`),version:xf(t,`version`)??1,scope:$(t,`scope`),path:$(t,`path`),status:`active`,updated_at:r,mission_id:e.mission.id,mission_title:e.mission.title}),Ef(e,t,`reviewer`,n===I.SKILL_CREATED?`Capability unlocked`:`Capability upgraded`,$(t,`name`),`skill`))}else if(n===I.SKILL_EVOLUTION_COMPLETED)e.storage.project_skill_dir=$(t,`project_skill_dir`)||e.storage.project_skill_dir,e.storage.global_skill_dir=$(t,`global_skill_dir`)||e.storage.global_skill_dir,e.storage.project_skill_count=xf(t,`project_skill_count`)??e.storage.project_skill_count,e.storage.global_skill_count=xf(t,`global_skill_count`)??e.storage.global_skill_count;else if(n===I.SKILL_HISTORY_COMPRESSED)e.storage.skill_history_compressed+=xf(t,`count`)??0,e.storage.skill_history_bytes_saved+=xf(t,`bytes_saved`)??0;else if(n===I.SKILL_TIDIED){let n=$(t,`name`);if(n){let i=e.learned_skills.find(e=>e.name===n),a={source_path:$(t,`path`),source_placement:$(t,`placement`),source_vertical:$(t,`vertical`),updated_at:r};i?Object.assign(i,a):wf(e.learned_skills,`id`,n,{id:n,name:n,version:1,scope:``,path:``,status:`active`,...a}),Ef(e,t,`manager`,`Capability promoted to source`,n,`skill`)}}else if([I.WIKI_INITIALIZED,I.WIKI_EVOLUTION_COMPLETED].includes(n)){let n=[...(Array.isArray(t.paths)?t.paths:[]).map(e=>String(e)),$(t,`path`)].filter(Boolean);e.storage.wiki_paths=[...new Set([...e.storage.wiki_paths,...n])]}else if(n===I.WIKI_RETIRED_COMPRESSED)e.storage.wiki_retired_compressed+=xf(t,`count`)??0,e.storage.wiki_retired_bytes_saved+=xf(t,`bytes_saved`)??0;else if([I.WIKI_CREATED,I.WIKI_UPDATED].includes(n)){let i=$(t,`page_id`);i&&(wf(e.learned_wiki_pages,`id`,i,{id:i,title:$(t,`title`)||i,card_type:$(t,`card_type`),status:$(t,`status`)||`scratch`,path:$(t,`path`),updated_at:r}),Ef(e,t,`reviewer`,n===I.WIKI_CREATED?`Knowledge captured`:`Knowledge refined`,$(t,`title`)||i,`skill`))}else if(n===I.WIKI_RETIRED){let n=$(t,`page_id`);if(n){let i=e.learned_wiki_pages.find(e=>e.id===n);i?Object.assign(i,{status:`retired`,updated_at:r}):wf(e.learned_wiki_pages,`id`,n,{id:n,title:n,card_type:$(t,`card_type`),status:`retired`,path:``,updated_at:r}),Ef(e,t,`reviewer`,`Knowledge retired`,n,`error`)}}else if([I.WIKI_PROMOTION_PROMOTED,I.WIKI_PROMOTION_DEMOTED].includes(n)){let i=$(t,`page_id`);if(i){let a=e.learned_wiki_pages.find(e=>e.id===i);a?Object.assign(a,{status:$(t,`to_status`),updated_at:r}):wf(e.learned_wiki_pages,`id`,i,{id:i,title:i,card_type:$(t,`card_type`),status:$(t,`to_status`),path:``,updated_at:r});let o=n===I.WIKI_PROMOTION_PROMOTED;Ef(e,t,`reviewer`,o?`Knowledge promoted`:`Knowledge demoted`,`${i} → ${$(t,`to_status`)}`,o?`success`:`neutral`)}}else if(n===I.RESEARCH_ACHIEVEMENT_CERTIFIED)e.achievement={id:$(t,`achievement_id`),title:$(t,`title`),goal:$(t,`goal`),summary:$(t,`summary`),rejected_attempts:e.review.rejected_attempts,skills_learned:e.learned_skills.filter(e=>e.status===`active`).length,artifacts:e.artifacts.length,elapsed_seconds:e.mission.elapsed_seconds,evidence:Array.isArray(t.evidence)?t.evidence.map(String):[],reviewer_certified:!0,certified_at:r};else if([I.LIFE_MISSION_COMPLETED,I.LIFE_MISSION_FAILED].includes(n)){let i=n===I.LIFE_MISSION_FAILED?rc({...t,outcome_class:`failed`,status:$(t,`status`)||`failed`,success:!1}):rc(t),a=`final_output`in t?$(t,`final_output`):$(t,`item_id`)===e.mission.id&&e.mission.started_at!=null&&(e.mission.completed_at==null||e.mission.completed_at===r)&&e.mission.final_output||``;e.mission.id=$(t,`item_id`)||e.mission.id,e.mission.title=$(t,`title`)||e.mission.title,e.mission.objective=$(t,`objective`)||e.mission.objective,e.mission.summary=$(t,`summary`),e.mission.final_output=a,e.mission.status=i.missionStatus,e.mission.completed_at=r;let o=t.delivery;t.success===!0&&o&&typeof o==`object`&&!Array.isArray(o)?e.delivery=JSON.parse(JSON.stringify(o)):t.success!==!0&&(e.delivery=null),e.outcome=nc(t),Tf(e,`engineer`,i.missionStatus===`complete`?`done`:i.missionStatus,i.label,r),Ef(e,t,`engineer`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),Of(i.tone)),Df(e,t,`engineer`,`completion`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),i.missionStatus)}return e.updated_at=Date.now()/1e3,e}function jf(e,t,n){let r=t.backlog.find(e=>bf.has(e.status)),i=t.backlog.find(e=>e.status===`pending`),a=t.backlog.find(t=>t.id===e.mission.id),o=r??a,s=!!(r||i||t.continuous?.enabled||t.continuous?.done_reason||t.continuous?.done_at||e.mission.id||![``,`idle`].includes(e.mission.status));t.continuous?.enabled&&(e.routing.route=e.routing.route||`team`,e.routing.continuous=!0,e.routing.open_ended=t.continuous.open_ended===!0,e.routing.lifetime=e.routing.open_ended?`standing`:e.routing.lifetime||`bounded`);let c=o?.objective||o?.title||(t.continuous?.enabled?t.continuous.objective:``)||t.session.objective||(e.mission.id?``:i?.objective)||(e.mission.id?``:i?.title)||e.mission.objective;c&&(e.mission.objective=c,o?e.mission.title=(o.title||c.split(` +`)[0]).slice(0,240):e.mission.title||(e.mission.title=c.split(` +`)[0].slice(0,240))),r?((r.id!==e.mission.id||r.started_ts!=null&&r.started_ts!==e.mission.started_at||e.mission.completed_at!=null)&&(e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=r.started_ts??null,e.mission.completed_at=null),e.mission.id=r.id,e.mission.status=`working`,e.mission.started_at=e.mission.started_at??r.started_ts??null):a?a.status===`pending`&&(e.mission.status=`queued`):t.continuous?.done_reason||t.continuous?.done_at?e.mission.status=`complete`:i||t.continuous?.enabled?e.mission.status=`queued`:t.daemon.alive&&(e.mission.status=`idle`),t.roles.forEach(t=>{t.active?Tf(e,t.role,`active`,t.label||t.status||`Working`,Date.now()/1e3-(t.age_s??0)):s||Tf(e,t.role,`waiting`,`Waiting`,Date.now()/1e3);let n=e.roles.find(e=>e.role===t.role);n&&Object.assign(n,{backend:t.backend,model:t.model,effort:t.effort})});let l=t.roles.filter(e=>e.active);l.length?e.active_role=l[l.length-1].role:s||(e.active_role=``),t.backlog.forEach(t=>{let n={id:t.id,title:t.title,objective:t.objective,status:t.status,deps:t.deps??[],branch_id:t.id,parent_branch_id:t.deps?.[0]??null,acceptance_check:t.acceptance_check??``,plan_hypothesis:t.plan_hypothesis??``,goal_contribution:t.goal_contribution??``,expected_regressions:t.expected_regressions??``,decision_rule:t.decision_rule??``,non_goals:t.non_goals??[]};wf(e.dag,`id`,n.id,n)});let u=o?.outcome?.execution_status?o.outcome:e.mission.id?void 0:[...t.backlog].filter(e=>e.outcome?.execution_status).sort((e,t)=>Number(e.finished_ts??0)-Number(t.finished_ts??0)).at(-1)?.outcome;return!r&&u&&(e.outcome=nc({outcome:u,status:`done`,success:!0})),n.forEach(t=>{wf(e.artifacts,`path`,t.path,{id:t.path,path:t.path,title:t.name,kind:t.kind,why:t.why,exists:t.exists,storage_path:t.storage_path,source:t.source})}),s}function Mf(e,t,n,r){r||(t.roles.forEach(t=>{t.active||Tf(e,t.role,`waiting`,`Waiting`,Date.now()/1e3)}),e.active_role=``);let i=Date.now()/1e3,a=e.mission.campaign_started_at??t.session.created??e.mission.started_at;a&&(e.mission.campaign_started_at=a,e.mission.campaign_elapsed_seconds=Math.max(0,i-a)),e.mission.started_at&&e.mission.status===`working`?e.mission.elapsed_seconds=Math.max(0,i-e.mission.started_at):e.mission.started_at&&e.mission.completed_at&&(e.mission.elapsed_seconds=Math.max(0,e.mission.completed_at-e.mission.started_at)),e.achievement?.reviewer_certified&&(e.achievement.elapsed_seconds=e.mission.elapsed_seconds,e.achievement.rejected_attempts=e.review.rejected_attempts,e.achievement.skills_learned=e.learned_skills.filter(e=>e.status===`active`).length,e.achievement.artifacts=n.filter(e=>e.exists).length)}function Nf(e,t=[],n=[]){let r=e.mission_view?Sf(e.mission_view):Cf();r.storage??=Cf().storage,r.storage.skill_history_compressed??=0,r.storage.wiki_retired_compressed??=0,r.storage.skill_history_bytes_saved??=0,r.storage.wiki_retired_bytes_saved??=0,r.learned_wiki_pages??=[],r.role_work??=[],r.delivery??=null,r.outcome??={};let i=r.last_event_ts,a=jf(r,e,n),o=[...t].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0));return o.filter(e=>e.ts==null||Number(e.ts)>i).forEach(e=>Af(r,e)),r.mission.final_output||(r.mission.final_output=Pf(o,r.mission)),Mf(r,e,n,a),r}function Pf(e,t){if(!t.id||[`working`,`queued`,`grounding`,`framed`].includes(t.status))return``;let n=e.reduce(Af,Cf()).mission;return n.id!==t.id||n.started_at==null||n.completed_at==null||t.started_at!=null&&n.started_at!==t.started_at||t.completed_at!=null&&n.completed_at!==t.completed_at?``:n.final_output||``}function Ff(e){return String(e||``).replace(/\\([*_`~])/g,`$1`).replace(/\\\\(?=[A-Za-z])/g,`\\`)}function If(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h ${r}m`:r?`${r}m`:`${t}s`}var Lf=`__argus_live_progress__`,Rf=new Set([`framed`,`grounding`,`queued`,`running`,`in_progress`,`working`]),zf=new Set([`complete`,`completed`,`done`,`success`]);function Bf(e){return zf.has(String(e?.mission.status||``).toLowerCase())}function Vf(e){return(e??[]).filter(e=>e.source===`manager_live`)}function Hf(e){return Vf(e).filter(e=>e.exists)[0]??null}function Uf(e){let t=e??[],n={markdown:0,pdf:1,html:2,text:3,table:4,json:5,image:6,video:7,audio:8,binary:9},r=t.filter(e=>e.exists&&e.source===`delivery`),i=t.filter(e=>e.exists&&e.source===`manager_live`),a=t.filter(e=>e.exists&&e.source!==`manager_live`&&e.source!==`delivery`);return a.length||r.length?[...r,...[...a].sort((e,t)=>(n[e.kind]??99)-(n[t.kind]??99)),...i]:i}function Wf(e){return Uf(e).find(e=>e.exists)??null}function Gf(e){let t=Uf(e);return t.find(e=>e.source===`delivery`)??t.find(e=>e.source!==`manager_live`)??t[0]??null}function Kf(e){let t=e.path.split(`/`);return t[t.length-1]||e.path}function qf(e,t){if(e){let n=String(e.mission.status||``).toLowerCase();if(Rf.has(n))return Lf;let r=e.delivery?.primary_target?.path;if(r)return r;if(Bf(e))return Gf(t)?.path??`__argus_live_progress__`;let i=Hf(t);return i?i.path:Lf}return Wf(t)?.path??``}function Jf(e){let t=String(e.agent_layer??e.actor??``);if(t===`main`)return`engineer`;if(t)return t;let n=String(e.type??``);return n.startsWith(`round.review`)||n.startsWith(`reviewer`)?`reviewer`:n.startsWith(`life.planner`)?`planner`:n.startsWith(`life.manager`)||n.startsWith(`manager`)?`manager`:n.startsWith(`engineer`)||n.startsWith(`round.`)?`engineer`:``}function Yf(e,t=[],n,r=`en`){if(n&&ai(n,e,t).state!==`running`||Bf(e))return null;let i=String(e?.active_role??``);if(!i)return null;let a=e?.roles.find(e=>e.role===i),o=``;for(let n=t.length-1;n>=0;--n){let r=t[n];if(e?.mission.id&&ei(r)!==e.mission.id||e?.mission.started_at&&Number(r.ts||0)ue(e,{},r)):i,label:a?.label||`Working`,detail:o}}function Xf({view:e,artifacts:t=[],onOpenArtifact:n,routeVisible:r,snapshot:i,connected:a}){let{locale:o,t:s}=z(),c=e.dag.filter(e=>[`done`,`completed`].includes(e.status)).length,l=[...t].filter(e=>e.exists&&e.source!==`manager_live`).sort((e,t)=>Number(t.mtime??0)-Number(e.mtime??0)).slice(0,4),u=e=>[`running`,`in_progress`,`claimed`].includes(e),d=a&&i?.daemon.alive!==!1,f=e=>e===`done`?`text-ok`:u(e)?`text-blue-sky`:[`failed`,`blocked`,`rejected`].includes(e)?`text-err`:`text-ink-faint`;return(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 text-sm text-ink-dim scroll-thin`,children:[(0,J.jsx)(`section`,{className:`rounded-lg border border-blue-deep/30 bg-blue-deep/10 p-4`,children:(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.stage`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm font-medium text-blue-sky`,children:jc(e.stage.id,o)===e.stage.id?e.stage.label||e.stage.id||`—`:jc(e.stage.id,o)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.totalTime`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:If(e.mission.campaign_elapsed_seconds)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.round`)}),(0,J.jsxs)(`dd`,{className:`mt-1 text-sm text-ink`,children:[e.round.current||`—`,e.round.max?` / ${e.round.max}`:``]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.dagProgress`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:Fc(c,e.dag.length,o)})]})]})}),r&&e.dag.length?(0,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:s(`mission.researchDag`)}),(0,J.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.dag.map(e=>(0,J.jsx)(`li`,{className:`rounded-md border border-line/60 bg-panel px-3 py-2.5`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 shrink-0 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,"aria-hidden":`true`,children:e.status===`done`?`✓`:d&&u(e.status)?`●`:`○`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium leading-5 text-ink`,children:(0,J.jsx)(H,{children:e.title})}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,children:!d&&u(e.status)?a?o===`zh-CN`?`当前未在运行`:`Not currently running`:o===`zh-CN`?`断连前记录:进行中`:`Last received state: in progress`:Vc(e.status,o)})]})]})},e.id))})]}):null,l.length?(0,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:o===`zh-CN`?`已生成的文件`:`Files produced so far`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o===`zh-CN`?`文件已生成,结论是否成立仍以核验记录为准。`:`A saved file is not a verification of its conclusions.`}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:l.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),title:e.storage_path||e.path,className:`rounded border border-line/70 bg-panel px-2.5 py-1.5 font-mono text-xs text-blue-sky hover:border-blue/60`,children:[Kf(e),` ↗`]},e.path))})]}):null]})}function Zf({sid:e,artifacts:t,error:n=!1,onExpand:r,onOpenFile:i,className:a=``,embedded:s=!1,onCollapse:c,missionView:l,activityEvents:u=[],requestedPath:d,requestedPathToken:f,routeVisible:p=!0,snapshot:m,connected:h=!0}){let{t:g,locale:_}=z(),y=(0,G.useMemo)(()=>Uf(t),[t]),b=(0,G.useMemo)(()=>Wf(t),[t]),x=Bf(l),S=(0,G.useMemo)(()=>{if(!x)return null;let e=l?.delivery?.primary_target?.path;return y.find(t=>t.path===e&&t.exists)??Gf(t)},[t,x,l?.delivery?.primary_target?.path,y]),[C,w]=(0,G.useState)(null);(0,G.useEffect)(()=>{w(x&&S?S.path:null)},[x,S?.path,l?.mission.id,e]),(0,G.useEffect)(()=>{if(!d)return;let e=y.find(e=>e.path===d&&e.exists);e&&w(e.path)},[y,d,f]);let T=e=>{w(e),e!==`__argus_live_progress__`&&i?.()},E=C??qf(l,t),D=E===Lf,O=D?null:y.find(e=>e.path===E)??(x?S:b),k=we(e,O?.exists?O.path:null,O?.mtime??null),A=k.data,j=A?ss(A):!1,[M,ee]=(0,G.useState)(null),[N,P]=(0,G.useState)(``),[F,te]=(0,G.useState)(!1),[ne,re]=(0,G.useState)(``),ie=(0,G.useMemo)(()=>h?Yf(l,u,m,_):null,[u,l,m,h,_]);(0,G.useEffect)(()=>{if(ee(null),P(``),!e||!O||!A||![`image`,`pdf`,`audio`,`video`].includes(A.kind))return;let t=!0,n=``,r=new AbortController;return R.artifactBlob(e,O.path,!1,r.signal).then(e=>{t&&(n=URL.createObjectURL(e),ee(n))},e=>t&&P(e.message)),()=>{t=!1,r.abort(),n&&URL.revokeObjectURL(n)}},[e,O?.path,A?.kind,A?.mtime]);let I=l?.delivery??null,L=I?.primary_target?.path??``,ae=!!(x&&!D&&O&&(O.source===`delivery`||O.path===L)),oe=_===`zh-CN`?I?.kind===`submission_certified`?`交付已认证`:`已完成`:I?.kind===`submission_certified`?`Certified delivery`:`Delivered result`,se=ae?oe:D?g(`research.liveProgress`):y[0]?.group_title||g(`research.artifact`),ce=async()=>{if(!(!e||!O)){te(!0),re(``);try{let t=await R.artifactBlob(e,O.path,!0);ut(t,O.name)}catch(e){re(e.message)}finally{te(!1)}}};return(0,J.jsxs)(`section`,{className:`glass-panel glass-panel--side flex min-h-0 flex-col overflow-hidden ${s?``:`rounded-lg border`} ${a}`,"aria-label":g(`research.canvas`),children:[(0,J.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-line/50 bg-panel px-4`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 rounded-full ${ae?`bg-ok`:ie?`animate-pulse bg-blue`:`bg-ink-faint/60`}`}),(0,J.jsx)(`h2`,{className:`max-w-24 truncate text-sm font-semibold text-ink sm:max-w-48`,children:se})]}),l||y.length>0?(0,J.jsxs)(`label`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:g(`research.previewArtifact`)}),(0,J.jsxs)(`select`,{value:D?Lf:O?.path??``,onChange:e=>T(e.target.value),title:D?g(`research.liveProgress`):O?.storage_path||O?.path,className:`h-8 w-full min-w-0 max-w-64 truncate rounded-md border border-line/50 bg-bg px-2 font-mono text-xs text-ink-dim outline-none focus:border-blue/60`,children:[l?(0,J.jsx)(`option`,{value:Lf,children:g(`research.liveProgress`)}):null,y.map(e=>(0,J.jsxs)(`option`,{value:e.path,disabled:!e.exists,title:e.storage_path||e.path,children:[e.source===`delivery`?`${g(`research.optionDelivery`)} · `:``,Kf(e),e.exists?``:` · ${g(`research.optionPending`)}`]},e.path))]})]}):(0,J.jsx)(`div`,{className:`flex-1`}),(0,J.jsx)(`div`,{className:`shrink-0`,children:O?(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void ce(),disabled:F||!O.exists,title:g(`artifact.download`),"aria-label":g(`artifact.download`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink disabled:opacity-40`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M8 2.25v7.5M5.25 7.5 8 10.25 10.75 7.5M3 13.25h10`})})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(O.path),title:g(`research.openLarge`),"aria-label":g(`research.openLarge`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M6 3H3v3M10 3h3v3M6 13H3v-3M10 13h3v-3`})})})]}):null}),c?(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":g(`research.collapse`),title:g(`research.collapse`),className:`hidden h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink lg:flex`,children:(0,J.jsx)(o,{icon:v,className:`h-3.5 w-3.5`})}):null]}),m?(0,J.jsx)(eu,{snapshot:m,view:l,events:u,connected:h,compact:!0}):ie?(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-line/50 bg-blue-deep/10 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(`span`,{"data-role-dot":ie.role,className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:B.role[ie.role]??B.inkFaint},"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-semibold text-ink`,children:ie.roleLabel}),(0,J.jsx)(`span`,{className:`text-blue-sky`,children:g(`mission.active`)}),(0,J.jsxs)(`span`,{className:`truncate text-ink-faint`,children:[`· `,zc(ie.label,_,{kind:l?.roles.find(e=>e.role===ie.role)?.kind,language:l?.language})]})]}),ie.detail?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-ink-dim`,children:ie.detail}):null]}):null,(0,J.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col bg-bg`,children:[D&&l?(0,J.jsx)(Xf,{view:l,artifacts:t,onOpenArtifact:T,routeVisible:p,snapshot:m,connected:h}):null,!D&&n?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-6 text-center text-sm text-warn`,children:g(`research.unavailable`)}):null,!D&&!n&&y.length===0?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,J.jsx)(`h3`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.noPreview`)})]}):null,!D&&!n&&y.length>0&&!O?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(tt,{}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.waiting`)})]}):null,O&&!O.exists?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(tt,{}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.updating`)})]}):null,O?.exists&&k.isLoading?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,O?.exists&&k.isError?(0,J.jsxs)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:[g(`artifact.unavailable`),` · `,k.error.message]}):null,A?.kind===`text`&&!j?(0,J.jsxs)(`pre`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:[A.preview||`(empty file)`,A.truncated?` + +… live preview truncated · expand to inspect the complete file`:``]}):null,A&&j?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-5 text-sm text-ink-dim scroll-thin`,children:(0,J.jsx)(H,{sid:e,basePath:A.path,artifacts:t,onOpenArtifact:T,children:A.preview||`(empty file)`})}):null,A?.kind===`json`?(0,J.jsx)(of,{value:A.preview||``}):null,A?.kind===`table`?(0,J.jsx)(sf,{value:A.preview||``,delimiter:A.name.endsWith(`.tsv`)?` `:`,`}):null,A?.kind===`html`&&!A.truncated?(0,J.jsx)(tf,{sid:e,path:A.path,html:A.preview||``,title:`Live HTML preview: ${A.name}`}):null,A?.kind===`html`&&A.truncated?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-warn`,children:g(`artifact.htmlTooLarge`)}):null,A?.kind===`image`&&M?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4`,children:(0,J.jsx)(`img`,{src:M,alt:A.why||A.name,className:`max-h-full max-w-full object-contain`})}):null,A?.kind===`pdf`&&M?(0,J.jsx)(hf,{src:M,name:A.name}):null,A?.kind===`audio`&&M?(0,J.jsx)(`div`,{className:`m-auto w-full max-w-xl px-6`,children:(0,J.jsx)(`audio`,{controls:!0,preload:`metadata`,src:M,className:`w-full`})}):null,A?.kind===`video`&&M?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-2`,children:(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:M,className:`max-h-full max-w-full`})}):null,A?.kind===`binary`?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-ink-dim`,children:g(`research.fileUnavailable`)}):null,A&&[`image`,`pdf`,`audio`,`video`].includes(A.kind)&&!M&&!N?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,N?(0,J.jsx)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:N}):null]}),!D&&A?(0,J.jsxs)(`footer`,{className:`flex h-9 items-center gap-2 border-t border-line px-4 font-mono text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:A.storage_path||A.path,children:A.path}),ne?(0,J.jsx)(`span`,{className:`ml-auto truncate text-err`,title:ne,children:g(`research.downloadFailed`)}):null,(0,J.jsx)(`span`,{className:`shrink-0`,children:yt(A.size)})]}):null]})}function Qf({notice:e,onClose:t}){if((0,G.useEffect)(()=>{if(!e)return;let n=window.setTimeout(t,e.tone===`error`?8e3:4e3);return()=>window.clearTimeout(n)},[e,t]),!e)return null;let n=e.tone===`error`?`border-err/60 bg-err/10 text-err`:e.tone===`success`?`border-ok/60 bg-ok/10 text-ok`:`border-blue-deep/60 bg-panel text-blue-sky`;return(0,J.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,"aria-live":e.tone===`error`?`assertive`:`polite`,className:`fixed bottom-4 left-4 right-4 z-[70] flex items-start gap-2 rounded-md border px-3 py-2.5 shadow-glow sm:left-auto sm:max-w-md ${n}`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0`,children:e.tone===`error`?`!`:e.tone===`success`?`✓`:`i`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-xs leading-relaxed text-ink-dim`,children:e.message}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`dismiss notification`,onClick:t,className:`shrink-0 rounded px-1 text-base leading-none opacity-70 hover:bg-white/5 hover:opacity-100`,children:`×`})]})}function $f({open:e,sid:t,name:n,alive:r,controlAvailable:i=!0,busy:a,onClose:o,onRename:s,onStart:c,onStop:l,onDelete:u}){let{t:d}=z(),[f,p]=(0,G.useState)(n),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(!1);(0,G.useEffect)(()=>{e&&(p(n),h(!1),_(!1))},[e,n,t]);let v=async e=>{e.preventDefault(),await s(f.trim())},y=r&&!g,b=async()=>{if(y){await l()&&_(!0);return}await c()&&_(!1)};return(0,J.jsxs)(dt,{open:e,onClose:()=>!a&&o(),label:d(`manage.daemon`),width:`max-w-lg`,children:[(0,J.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-ink`,children:d(`topbar.manageSession`)}),(0,J.jsx)(`p`,{className:`mt-0.5 font-mono text-[10px] text-ink-faint`,children:t})]}),(0,J.jsx)(`form`,{onSubmit:e=>void v(e),className:`border-b border-line p-5`,children:(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.displayName`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),maxLength:80,disabled:a,className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg/50 px-3 text-sm text-ink outline-none focus:border-blue-deep disabled:opacity-50`}),(0,J.jsx)(`button`,{type:`submit`,disabled:a||f.trim()===n,className:`rounded border border-line px-3 text-xs text-ink-dim hover:bg-surface disabled:opacity-40`,children:d(`common.save`)})]})]})}),(0,J.jsxs)(`div`,{className:`border-b border-line p-5`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.executor`)}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center justify-between rounded border border-line bg-bg/30 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm text-ink`,children:d(y?i?`manage.running`:`manage.runningExternally`:`manage.paused`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:d(y?i?`manage.stopNowHint`:`manage.externalHint`:`manage.resumeHint`)})]}),(0,J.jsx)(`button`,{type:`button`,disabled:a||!i,onClick:()=>void b(),className:`rounded border px-3 py-1.5 text-xs disabled:cursor-wait disabled:opacity-50 ${y?`border-warn/50 text-warn hover:bg-warn/10`:`border-blue-deep bg-blue-deep text-white hover:bg-blue-deep/80`}`,children:d(a?`manage.working`:i?y?`manage.stopNow`:`manage.resume`:`common.external`)})]})]}),(0,J.jsxs)(`div`,{className:`p-5`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:d(`manage.deleteSession`)}),(0,J.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-ink-faint`,children:d(`manage.deleteHint`)}),m?(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded border border-err/40 bg-err/5 p-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-dim`,children:d(`manage.confirmQuestion`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`rounded px-2 py-1 text-xs text-ink-faint hover:bg-surface`,children:d(`common.cancel`)}),(0,J.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void u(),className:`rounded bg-err px-3 py-1 text-xs font-medium text-bg disabled:opacity-50`,children:d(`manage.confirmDelete`)})]})]}):(0,J.jsx)(`button`,{type:`button`,disabled:a||y,onClick:()=>h(!0),className:`mt-3 rounded border border-err/40 px-3 py-1.5 text-xs text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-40`,children:d(`manage.delete`)})]})]})}var ep={科学环境已就绪:`Scientific environment ready`,更新科学环境校验:`Update scientific environment checks`,验证科学环境依赖和关键模块:`Validating scientific dependencies and required modules`,"科学环境 · 上次检查结果":`Scientific environment · previous check`,"下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。":`The results below predate this operation. Refer to the latest error above or check the environment again.`,"科学环境 · ⟦0⟧ 项待配置":`Scientific environment · ⟦0⟧ item(s) to configure`,科学环境:`Scientific environment`,检查环境:`Check environment`,"免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。":`Free scientific components are configured automatically; SHELX requires academic authorization from the official website before entering download credentials.`,修复依赖:`Repair dependencies`,"继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。":`Confirm the official PLATON license before continuing. The same installation or repair action will prepare the complete runtime; no separate repair button is required.`,同意并继续:`Agree and continue`,"请先确认 PLATON 使用许可,再继续安装或修复依赖。":`Confirm the PLATON license before installing or repairing dependencies.`,依赖修复完成:`Dependency repair complete`,依赖修复未完成:`Dependency repair incomplete`,环境操作未完成:`Environment operation incomplete`,"依赖修复未完成:⟦0⟧。请查看组件检查结果;不会报告修复成功。":`Dependency repair is incomplete: ⟦0⟧. Check the component results; this is not reported as a successful repair.`,"PLATON 已可用,保留当前安装。":`PLATON is already available; keeping the existing installation.`,"准备 PLATON 官方环境":`Prepare official PLATON runtime`,"下载、验证并配置":`Download, verify and configure`,"我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。":`I confirm that my use complies with the official PLATON license; for commercial use, I have obtained separate authorization.`,"PLATON 官方允许注明来源的学术、科学及非商业用途;商业用途需自行取得许可。本操作只从官方网站下载到插件私有目录,不安装系统运行库、不修改系统 PATH。":`The publisher permits acknowledged academic, scientific and non-commercial use of PLATON; commercial use requires a separate license. This downloads from official sites into the plugin's private directory, without installing system runtimes or changing the system PATH.`,"PLATON 缺少 Windows Salford 运行库(0xC0000135)。请点击“修复依赖”,确认许可后会在同一流程准备完整运行环境。":`PLATON is missing the Windows Salford runtime (0xC0000135). Click Repair dependencies and confirm the license to prepare the complete runtime in the same action.`,"正在校验 PLATON 官方程序与 Windows 配套运行环境…":`Verifying the official PLATON program and Windows runtime…`,"正在提取官方 Salford 运行库(不执行系统安装程序)…":`Extracting the official Salford runtime without executing the system installer…`,"正在实际运行 PLATON,验证 Windows 运行库和校验规则…":`Running PLATON to verify the Windows runtime and validation rules…`,"PLATON 官方 Windows 运行环境验证通过。":`The official PLATON Windows runtime passed verification.`,"PLATON 官方运行环境已可用,保留当前安装。":`The official PLATON runtime is already available; keeping the existing installation.`,"配置 SHELX":`Configure SHELX`,"SHELX 授权安装":`SHELX authorized installation`,学术授权:`Academic authorization`,前往官网申请:`Apply on official website`,"填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。":`Enter the username and password from the authorization email to download and install automatically. Credentials are used only for this official download, are not saved, and are not sent to the model.`,用户名:`Username`,"SHELX 用户名":`SHELX username`,密码:`Password`,"SHELX 密码":`SHELX password`,"查看许可 ↗":`View license ↗`,"下载并安装 SHELX":`Download and install SHELX`,取消:`Cancel`,科学软件健康检查:`Scientific software health check`,"点击“检查环境”可验证科学内核与外部程序。":`Click “Check environment” to verify the scientific kernel and external programs.`,可用:`Available`,待授权安装:`Authorization required`,待修复:`Needs repair`,查看检查详情:`View check details`,查看原因与安装方式:`View cause and installation method`,"官方安装说明 ↗":`Official installation instructions ↗`,使用已有安装:`Use existing installation`,"DIALS 环境目录":`DIALS environment directory`,"Systre JAR 路径(需要已有 Java)":`Systre JAR path (existing Java required)`,"⟦0⟧ 可执行文件路径":`⟦0⟧ executable path`,"填写运行 Argus 的电脑上的路径,验证成功后生效。":`Enter the path on the computer running Argus. It takes effect after successful verification.`,验证并使用:`Verify and use`,最近检查:`Last checked`,"· 检查不调用模型":`· Check does not call the model`,无法读取插件列表:`Unable to read plugin list`,插件操作未完成:`Plugin operation incomplete`,插件:`Plugins`,关闭插件列表:`Close plugin list`,"按需安装研究工具,沿用 Argus 的模型与执行后端。":`Install research tools as needed, using Argus's model and execution backend.`,"正在读取插件…":`Reading plugins…`,暂无可用插件:`No plugins available`,已启用:`Enabled`,已停用:`Disabled`,未安装:`Not installed`,"· 当前后端":`· Current backend`,安装:`Install`,打开工作台:`Open workbench`,启用:`Enable`,更新至:`Update to`,停用:`Disable`,卸载:`Uninstall`,"原生会话输入 ⟦0⟧ 可启用后台工具。卸载保留会话、研究数据和科学软件。":`Native session input ⟦0⟧ can enable background tools. Uninstalling preserves sessions, research data, and scientific software.`,"首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。":`First installation automatically configures standalone Python, DIALS, Systre / Java, and free academic PLATON components. SHELX can be installed later by entering authorization details.`,"暂不支持,敬请期待。当前插件支持 Codex、Copilot 和 Pi。":`Not supported yet. Stay tuned. Current plugins support Codex, Copilot, and Pi.`,"安装科学环境需要 Python 3.11–3.13。请安装 Python 后重试,或设置 ARGUS_PLUGIN_PYTHON。":`Installing the scientific environment requires Python 3.11–3.13. Install Python and try again, or set ARGUS_PLUGIN_PYTHON.`,准备安装:`Prepare installation`,获取并校验插件包:`Download and verify plugin package`,"安装独立运行环境(首次可能需要几分钟)":`Install standalone environment (may take several minutes the first time)`,"插件仍有任务运行,请等任务结束或先暂停,再进行此操作。":`This plugin still has running tasks. Wait for them to finish or pause them before continuing.`,"此插件版本尚未提供可校验的发行包。":`No verifiable release package is available for this plugin version.`,"插件包校验失败,未安装。":`Plugin package verification failed. Not installed.`,正在准备:`Preparing`,"当前系统或 Argus 插件接口版本暂不支持此插件。":`This plugin is not currently supported by the system or Argus plugin API version.`,"插件发行包尚未发布。":`The plugin release package has not been published.`,安装完成:`Installation complete`,环境检查完成:`Environment check complete`,"此插件已有安装或更新操作正在进行。":`An installation or update operation for this plugin is already in progress.`,插件尚未安装:`Plugin not installed`,"安装进程已中断;已有可用版本保持不变,可重试。":`Installation was interrupted. The existing available version is unchanged; you can retry.`,"安装未完成,已有版本保持不变":`Installation incomplete; existing version unchanged`,"此版本已安装,可启用插件。":`This version is installed. You can enable the plugin.`,请先安装插件:`Install the plugin first`,请先更新插件以使用环境管理功能:`Update the plugin first to use environment management`,"插件包超过允许大小。":`The plugin package exceeds the allowed size.`,科学计算内核:`Scientific computing kernel`,"cctbx · Gemmi · RDKit · 科学服务":`cctbx · Gemmi · RDKit · scientific services`,衍射帧处理与探测器格式支持:`Diffraction frame processing and detector format support`,周期网络与拓扑识别:`Periodic networks and topology identification`,"本地 checkCIF 结构校验 · 学术免费":`Local checkCIF structure validation · free for academic use`,"结构精修 · 需要学术授权":`Structure refinement · academic authorization required`,"结构求解 · 需要学术授权":`Structure solution · academic authorization required`,全部组件可用:`All components available`,部分组件需要配置或修复:`Some components require configuration or repair`,"PLATON 官网中间证书已更换,请更新插件安装器":`The PLATON official-site intermediate certificate has changed. Update the plugin installer.`,"PLATON Mac 发行包架构不符":`PLATON Mac release package architecture mismatch`,"请输入授权邮件中的用户名和密码。":`Enter the username and password from the authorization email.`,请选择有效的科学软件路径:`Select a valid scientific software path`,检查科学软件与运行环境:`Check scientific software and runtime environment`,"正在修复科学 Python 依赖":`Repairing scientific Python dependencies`,"(首次下载可能需要几分钟)":`(The initial download may take several minutes)`,"from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('科学内核及工作台资源可用')":`from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('Scientific kernel and workbench resources available')`,"; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · 探测器格式插件可用')":`; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · detector format plugins available')`,"Systre 19.6.0 · pcu 拓扑计算通过":`Systre 19.6.0 · pcu topology calculation passed`,"正在安装 Apple Rosetta 2 兼容组件":`Installing Apple Rosetta 2 compatibility components`,"从 SHELX 官方站点下载":`Downloading from the official SHELX site`,"SHELX 下载内容不是支持的可执行程序":`SHELX download is not a supported executable`,"已可用,保留当前安装":`Already available; keeping current installation`,正在安装:`Installing`,"尚未安装 DIALS":`DIALS is not installed`,"PLATON 编译需要 Apple 命令行工具;请运行 xcode-select --install,然后点击修复依赖。":`PLATON compilation requires Apple Command Line Tools; run xcode-select --install, then click Repair dependencies.`,"SHELX 官方 Mac 版需要 Rosetta 2,请先同意安装兼容组件。":`The official Mac version of SHELX requires Rosetta 2. Agree to install the compatibility components first.`,"暂未完成;可在健康检查中重试":`Not completed; retry from the health check`,"SHELX 下载或启动失败;请核对授权、网络及系统平台后重试。":`SHELX download or launch failed; check authorization, network, and system platform, then retry.`,"尚未安装 Systre":`Systre is not installed`,"尚未安装 Java":`Java is not installed`,"Systre 未能识别内置 pcu 网络":`Systre could not identify the built-in pcu network`,"尚未安装 PLATON":`PLATON is not installed`,"PLATON 安装配方已更新,点击修复依赖即可使用当前版本。":`The PLATON installation recipe has been updated. Click Repair dependencies to use the current version.`,"PLATON 未生成校验规则;请检查运行库":`PLATON did not generate verification rules; check the runtime`,"请输入 SHELX 授权信息以安装":`Enter SHELX authorization details to install`,"无法启动,请核对平台与运行库":`Unable to start; check the platform and runtime`,"衍射数据处理、结构求解、精修与三维晶体研究工作台":`Diffraction data processing, structure solution, refinement and a 3D crystallography workbench`,"正在准备 ⟦0⟧ 工作台,首次需要几分钟":`Preparing the ⟦0⟧ workbench; the first time takes a few minutes`,"⟦0⟧ 暂时无法使用":`⟦0⟧ is unavailable for now`,"管理 ⟦0⟧":`Manage ⟦0⟧`,"原生会话输入 ⟦0⟧ 可启用后台工具。":`Native session input ⟦0⟧ can enable background tools.`,"研究工具由服务方提供,沿用 Argus 的模型与执行后端。":`Research tools are provided by the service and use Argus's model and execution backend.`,"此插件由服务方提供并维护,无需停用或卸载。":`This plugin is provided and maintained by the service; there is nothing to disable or uninstall.`},tp=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),np=/⟦\d+⟧/g,rp=Object.entries(ep).filter(([e])=>e.includes(`⟦`)).sort((e,t)=>t[0].length-e[0].length).map(([e,t])=>({regex:RegExp(`^`+e.split(np).map(tp).join(`([\\s\\S]*?)`)+`$`),slots:e.match(np)??[],target:t})),ip=new RegExp(Object.keys(ep).filter(e=>e.length>1&&!e.includes(`⟦`)).sort((e,t)=>t.length-e.length).map(tp).join(`|`),`g`);function ap(e,t){if(t===`zh-CN`||!/[\u3400-\u9fff]/.test(e))return e;if(ep[e.trim()])return e.replace(e.trim(),ep[e.trim()]);for(let t of rp){let n=t.regex.exec(e.trim());if(n){let e=new Map(t.slots.map((e,t)=>[e,n[t+1]]));return t.target.replace(np,t=>e.get(t)??t)}}return e.replace(ip,e=>ep[e])}function op(){let{locale:e}=z();return t=>typeof t==`string`?ap(t,e):t}var sp=oe(),cp=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;function lp({health:e,setup:t,running:n,act:r,platform:i,machine:a}){let o=op(),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(!1),[C,w]=(0,G.useState)(!1),T=t.windows_runtime,E=t.license?.platform_consent,D=E?.platform===i&&E?.machines.includes(a||``),O=e?.components||[],k=O.filter(e=>e.status!==`ready`),A=k.some(e=>e.license_required),j=k.some(e=>e.automatic);async function M(e){e.preventDefault();let n=await r(t.license.action,{username:d,password:p,accept_platform_license:y});m(``),n&&(u(!1),f(``),c(!0))}return(0,J.jsxs)(`div`,{className:`mt-5 border-t border-line/60 pt-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:()=>c(!s),className:`inline-flex items-center gap-2 text-sm text-ink-dim hover:text-ink`,children:[(0,J.jsx)(Be,{size:16,strokeWidth:1.5}),(0,J.jsx)(`span`,{children:o(e?.stale?o(`科学环境 · 上次检查结果`):e?.checked?e.ready?o(`科学环境已就绪`):o(`科学环境 · ${k.length} 项待配置`):o(`科学环境`))}),(0,J.jsx)(Ue,{size:13,className:`transition-transform duration-200 ${s?`rotate-180`:``}`})]}),(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint hover:text-ink disabled:opacity-45`,disabled:n,onClick:()=>{c(!0),r(`health`)},children:[(0,J.jsx)(Ke,{size:12}),o(`检查环境`)]})]}),e?.stale&&(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs leading-relaxed text-ink-dim`,children:o(`下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。`)}),o((A||j||!e?.checked)&&(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:o(` 免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。 `)})),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[o((j||!e?.checked||e.stale)&&(0,J.jsxs)(`button`,{className:cp,disabled:n,onClick:()=>{c(!0),r(`repair`)},children:[(0,J.jsx)(Ye,{size:14}),o(`修复依赖`)]})),o(t.license&&(0,J.jsxs)(`button`,{className:cp,disabled:n,onClick:()=>{u(!l),m(``),f(``)},children:[(0,J.jsx)(en,{size:14}),o(o(A?`配置 SHELX`:`SHELX 授权安装`))]}))]}),T&&(0,J.jsxs)(`div`,{className:`mt-3`,children:[(0,J.jsxs)(`button`,{type:`button`,className:cp,disabled:n,onClick:()=>{w(!C),S(!1)},children:[(0,J.jsx)(Ye,{size:14}),o(`准备 PLATON 官方环境`)]}),C&&(0,J.jsxs)(`form`,{className:`mt-3 rounded-lg bg-bg/70 p-3`,onSubmit:async e=>{e.preventDefault(),x&&await r(T.action,{accept_software_license:!0})&&(w(!1),S(!1),c(!0))},children:[(0,J.jsxs)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:[o(T.notice),` `,(0,J.jsx)(`a`,{href:T.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)})]}),(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5`}),o(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{type:`submit`,className:cp,disabled:n||!x,children:o(`下载、验证并配置`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>{w(!1),S(!1)},children:o(`取消`)})]})]})]}),o(l&&t.license&&(0,J.jsxs)(`form`,{onSubmit:M,className:`mt-4 rounded-lg bg-bg/70 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm`,children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[o(t.license.name),o(` 学术授权`)]}),(0,J.jsxs)(`a`,{href:t.license.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-blue`,children:[o(`前往官网申请`),(0,J.jsx)(qe,{size:11})]})]}),(0,J.jsx)(`p`,{className:`mb-3 mt-1.5 text-xs leading-relaxed text-ink-faint`,children:o(`填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。`)}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`用户名`),(0,J.jsx)(`input`,{"aria-label":o(`SHELX 用户名`),value:d,onChange:e=>f(e.target.value),required:!0,maxLength:200,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`密码`),(0,J.jsx)(`input`,{"aria-label":o(`SHELX 密码`),type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,maxLength:500,autoComplete:`new-password`,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]})]}),o(D&&E&&(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-faint`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5`}),(0,J.jsxs)(`span`,{children:[o(E.text),` `,(0,J.jsx)(`a`,{href:E.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`查看许可 ↗`)})]})]})),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,J.jsxs)(`button`,{type:`submit`,className:cp,disabled:n||!d.trim()||!p.trim(),children:[(0,J.jsx)(Ye,{size:14}),o(`下载并安装 SHELX`)]}),(0,J.jsx)(`button`,{type:`button`,className:`px-2 text-xs text-ink-faint`,onClick:()=>{u(!1),f(``),m(``)},children:o(`取消`)})]})]})),s&&(0,J.jsxs)(`div`,{className:`mt-3`,"aria-label":o(`科学软件健康检查`),children:[o(!O.length&&(0,J.jsx)(`p`,{className:`py-2 text-xs text-ink-faint`,children:o(`点击“检查环境”可验证科学内核与外部程序。`)})),O.map(e=>(0,J.jsx)(`div`,{className:`border-b border-line/40 py-2.5 last:border-0`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[o(e.status===`ready`?(0,J.jsx)(We,{size:15,strokeWidth:1.7,className:`mt-0.5 shrink-0 text-blue/75`}):(0,J.jsx)(qt,{size:15,strokeWidth:1.5,className:`mt-0.5 shrink-0 text-ink-faint`})),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,J.jsx)(`span`,{children:o(e.name)}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-ink-faint`,children:o(e.status===`ready`?o(`可用`):e.license_required?o(`待授权安装`):o(`待修复`))})]}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-ink-faint`,children:o(e.description)}),(0,J.jsxs)(`details`,{className:`mt-1.5 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer hover:text-ink-dim`,children:o(e.status===`ready`?o(`查看检查详情`):o(`查看原因与安装方式`))}),(0,J.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words leading-relaxed`,children:o(e.detail)}),e.path&&(0,J.jsx)(`p`,{className:`mt-1 break-all leading-relaxed`,children:e.path}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[(0,J.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)}),o(e.id!==`python`&&t.actions.includes(`configure`)&&(0,J.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>{g(e.id),v(``)},className:`text-blue`,children:o(`使用已有安装`)}))]})]})]})]})},e.id)),o(h&&(0,J.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),await r(`configure`,{paths:{[h]:_}})&&(g(null),v(``))},className:`mt-3 rounded-lg bg-bg/70 p-3`,children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(o(h===`dials`?`DIALS 环境目录`:h===`systre`?`Systre JAR 路径(需要已有 Java)`:`${h.toUpperCase()} 可执行文件路径`)),(0,J.jsx)(`input`,{required:!0,value:_,onChange:e=>v(e.target.value),className:`mt-2 w-full rounded-md border border-line bg-panel px-2 py-2 text-sm text-ink`})]}),(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-ink-faint`,children:o(`填写运行 Argus 的电脑上的路径,验证成功后生效。`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{className:cp,disabled:n,children:o(`验证并使用`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>g(null),children:o(`取消`)})]})]})),o(e?.checked&&(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[o(`最近检查 `),o(new Date(e.checked*1e3).toLocaleString()),o(` · 检查不调用模型`)]}))]})]})}function up(e){return e.installed&&e.enabled&&e.supported?`ready`:e.managed_by_host?!e.supported||e.operation?.status===`failed`?`unavailable`:`preparing`:`manual`}var dp=e=>`正在准备 ${e} 工作台,首次需要几分钟`,fp=e=>`${e} 暂时无法使用`,pp=e=>`flex h-9 min-w-0 flex-1 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`;function mp({plugins:e,compact:t=!1,pending:n,onLaunch:r,onManage:i}){let a=op(),o=e.filter(e=>up(e)!==`manual`),s=!e.length||e.some(e=>up(e)===`manual`);return(0,J.jsxs)(J.Fragment,{children:[o.map(e=>{let o=up(e),s=!t&&(0,J.jsx)(`button`,{type:`button`,onClick:i,"aria-label":a(`管理 ${e.name}`),title:a(`管理 ${e.name}`),className:`icon-control mr-1 shrink-0 p-1.5 text-ink-faint hover:text-ink`,children:(0,J.jsx)(Xt,{size:15})});if(o===`ready`)return(0,J.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,J.jsxs)(`button`,{type:`button`,disabled:n===e.id,onClick:()=>r(e),title:e.name,"aria-label":e.name,className:`${pp(t)} disabled:opacity-60`,children:[(0,J.jsx)(Yt,{size:17,strokeWidth:1.5,className:`shrink-0 text-blue`}),!t&&(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),!t&&(0,J.jsx)(Vt,{size:13,className:`shrink-0 text-ink-faint`})]}),s]},e.id);let c=o===`preparing`?dp(e.name):fp(e.name),l=o===`preparing`?e.operation?.progress:e.operation?.error||e.reason;return(0,J.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,J.jsxs)(`div`,{role:`status`,title:a(l||c),className:`flex min-w-0 flex-1 items-center text-sm text-ink-faint ${t?`h-9 justify-center`:`gap-2 px-3 py-1.5`}`,children:[o===`preparing`?(0,J.jsx)(nn,{size:17,strokeWidth:1.5,className:`shrink-0 animate-spin`}):(0,J.jsx)(Yt,{size:17,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,J.jsxs)(`div`,{className:`min-w-0 leading-snug`,children:[(0,J.jsx)(`p`,{children:a(c)}),l&&(0,J.jsx)(`p`,{className:`mt-0.5 truncate text-xs`,children:a(l)})]})]}),s]},e.id)}),s&&(0,J.jsx)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,children:(0,J.jsxs)(`button`,{type:`button`,onClick:i,title:a(`插件`),"aria-label":a(`插件`),className:pp(t),children:[(0,J.jsx)(q,{size:16,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,J.jsx)(`span`,{children:a(`插件`)})]})})]})}function hp({compact:e=!1}){let t=op(),{locale:n}=z(),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)([]),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(!1),_=(0,G.useRef)(null),v=a.some(e=>up(e)===`preparing`),y=a.length>0&&a.every(e=>e.managed_by_host);async function b(e){let n=await fetch(`/api/plugins`,{headers:L(),signal:e});if(!n.ok)throw Error(t(`无法读取插件列表`));let r=await n.json();e?.aborted||o(r.plugins)}(0,G.useEffect)(()=>{r||(m(null),g(!1))},[r]),(0,G.useEffect)(()=>{let e=new AbortController,t=()=>b(e.signal).catch(t=>{!e.signal.aborted&&r&&c(t.message)});r&&(_.current?.focus(),c(``),u(!0)),t().finally(()=>{e.signal.aborted||u(!1)});let n=r||v?window.setInterval(t,r?1500:4e3):0,a=e=>{e.key===`Escape`&&i(!1)};return r&&window.addEventListener(`keydown`,a),()=>{e.abort(),n&&window.clearInterval(n),window.removeEventListener(`keydown`,a)}},[r,v]);async function x(e,n,r){let i=e.setup?.windows_runtime;if(i&&!i.accepted&&[`install`,`update`,`repair`,i.action].includes(n)&&r?.accept_software_license!==!0)return m({pluginId:e.id,action:n}),g(!1),c(``),!1;f(e.id),c(``);try{let i=await fetch(`/api/plugins/${e.id}/${n===`launch`?`launch`:`manage/${n}`}`,{method:`POST`,headers:{...L(),"Content-Type":`application/json`},body:r?JSON.stringify(r):void 0}),a=await i.json();if(!i.ok)throw Error(a.detail||t(`插件操作未完成`));return n===`launch`?window.location.assign(a.url):await b(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{f(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(mp,{plugins:a,compact:e,pending:d,onLaunch:e=>void x(e,`launch`),onManage:()=>i(!0)}),r&&(0,sp.createPortal)((0,J.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:()=>i(!1),children:(0,J.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`plugin-title`,onClick:e=>e.stopPropagation(),className:`max-h-[85vh] w-full max-w-xl overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`h2`,{id:`plugin-title`,className:`text-lg font-semibold`,children:t(`插件`)}),(0,J.jsx)(`button`,{ref:_,type:`button`,"aria-label":t(`关闭插件列表`),className:`icon-control p-1.5`,onClick:()=>i(!1),children:(0,J.jsx)(Je,{size:18})})]}),(0,J.jsx)(`p`,{className:`mb-6 mt-2 text-sm text-ink-faint`,children:t(t(y?`研究工具由服务方提供,沿用 Argus 的模型与执行后端。`:`按需安装研究工具,沿用 Argus 的模型与执行后端。`))}),t(s&&(0,J.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-ink-dim`,children:t(s)})),t(l&&(0,J.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`正在读取插件…`)})),t(!l&&!a.length&&(0,J.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`暂无可用插件`)})),t(a.map(e=>{let r=e.operation?.status===`running`||d===e.id,i=r||!e.supported,a=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;return(0,J.jsxs)(`article`,{className:`rounded-xl border border-line/70 p-4`,"data-testid":`plugin-${e.id}`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(Yt,{size:24,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:t(e.name)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t(e.installed_version||e.version)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:t(e.description)})]})]}),(0,J.jsxs)(`div`,{className:`mt-4 text-xs text-ink-faint`,children:[t(e.installed?e.enabled?t(`已启用`):t(`已停用`):t(`未安装`)),t(` · 当前后端 `),t(Array.from(new Set(Object.values(e.backends))).join(` / `))]}),t(!e.supported&&(0,J.jsx)(`p`,{className:`mt-3 text-sm text-ink-dim`,children:t(e.reason)})),t(e.operation?.status===`running`&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-sm text-ink-dim`,children:[(0,J.jsx)(nn,{size:14,className:`animate-spin`}),t(e.operation.progress)]})),t(e.operation?.status===`failed`&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-ink-dim`,children:t(e.operation.error)})),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[t(!e.installed&&!e.managed_by_host&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`install`),children:[(0,J.jsx)(Ye,{size:14}),t(`安装`)]})),t(e.installed&&e.enabled&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`launch`),children:[t(`打开工作台`),(0,J.jsx)(Vt,{size:14})]})),t(e.installed&&!e.enabled&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`enable`),children:t(`启用`)})),t(e.update_available&&!e.managed_by_host&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`update`),children:[(0,J.jsx)(Ke,{size:14}),e.environment_update?t(`更新科学环境校验`):(0,J.jsxs)(J.Fragment,{children:[t(`更新至 `),t(e.version)]})]})),t(e.installed&&e.enabled&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`disable`),children:t(`停用`)})),t(e.installed&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`uninstall`),children:t(`卸载`)}))]}),p?.pluginId===e.id&&e.setup?.windows_runtime&&(0,J.jsxs)(`form`,{className:`mt-4 rounded-lg bg-bg/70 p-3`,onSubmit:async t=>{t.preventDefault(),!(!h||r)&&await x(e,p.action,{accept_software_license:!0})&&(m(null),g(!1))},children:[(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:t(`继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。`)}),(0,J.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:[t(e.setup.windows_runtime.notice),` `,(0,J.jsx)(`a`,{href:e.setup.windows_runtime.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:t(`官方安装说明 ↗`)})]}),(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`mt-0.5`}),t(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{type:`submit`,className:a,disabled:r||!h,children:t(`同意并继续`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,disabled:r,onClick:()=>{m(null),g(!1)},children:t(`取消`)})]})]}),(0,J.jsx)(`p`,{className:`mt-4 text-xs leading-relaxed text-ink-faint`,children:t(e.installed?t(`原生会话输入 ${e.command||``} 可启用后台工具。卸载保留会话、研究数据和科学软件。`):t(`首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。`))}),t(e.rights_notice&&(0,J.jsx)(`p`,{className:`mt-3 text-[10px] leading-relaxed text-ink-faint`,"data-testid":`plugin-rights-notice`,children:t(n===`zh-CN`&&e.rights_notice_zh||e.rights_notice)})),t(e.installed&&e.setup&&(0,J.jsx)(lp,{health:e.health,setup:e.setup,running:r,platform:e.platform,machine:e.machine,act:(t,n)=>x(e,t,n)}))]},e.id)}))]})}),document.body)]})}var gp=[`all`,`installed`,`available`,`builtin`],_p=[`install`,`update`,`enable`,`disable`,`uninstall`],vp=new Set([`install`,`update`,`uninstall`]),yp={query:``,kind:`all`,tag:null};function bp(e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}){return e.VITE_ARGUS_HOSTED_TRIAL===`1`}function xp(e,t){switch(t){case`all`:return!0;case`installed`:return e===`installed`||e===`package`;case`available`:return e===`available`;case`builtin`:return e===`builtin`}}function Sp(e,t){let n=t.trim().toLowerCase();return!n||[e.name,e.purpose,e.purpose_zh??``,...e.routing_path??[],...e.tags,...e.requires].join(` +`).toLowerCase().includes(n)}function Cp(e,t){return e.filter(e=>xp(e.kind,t.kind)&&(!t.tag||e.tags.includes(t.tag))&&(!t.routingPath||(e.routing_path??[]).join(`/`)===t.routingPath||(e.routing_path??[]).join(`/`).startsWith(`${t.routingPath}/`))&&Sp(e,t.query))}function wp(e){let t=new Set;for(let n of e){let e=n.routing_path??[];for(let n=1;n<=e.length;n++)t.add(e.slice(0,n).join(`/`))}return[...t].sort()}function Tp(e){let t=new Set;for(let n of e)for(let e of n.tags)e.trim()&&t.add(e.trim());return[...t].sort((e,t)=>e.localeCompare(t))}function Ep(e,t){let n=t||e.managed_by_host;return e.actions.filter(e=>_p.includes(e)&&!(n&&vp.has(e)))}var Dp=e=>`verticals.action.${e}`,Op=e=>`verticals.kind.${e}`,kp=e=>`verticals.filter.${e}`,Ap=e=>`verticals.operation.${e}`;function jp(e,t){return t===`zh-CN`&&e.purpose_zh&&e.purpose_zh.trim()?e.purpose_zh:e.purpose}function Mp(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function Np(e){if(!e||e.status!==`running`)return null;let t=Number(e.progress);return!Number.isFinite(t)||t<=0?null:Math.max(0,Math.min(100,Math.round(t)))}var Pp=e=>e.operation?.status===`running`;function Fp(e){return e.some(Pp)}function Ip(e,t){return e?t?1500:4e3:t?4e3:0}function Lp(e){if(e instanceof se){if(e.detail)return e.detail;let t=/^[A-Z]+ \S+ → \S+: ([\s\S]+)$/.exec(e.message);return t?t[1]:``}return e instanceof Error?e.message:String(e??``)}function Rp(e){return e instanceof se&&e.status===409}function zp(e){return e instanceof se&&e.status===404}function Bp(e,t){return Array.isArray(e)&&e.includes(t)}function Vp(e){return new Set(e.map(e=>e.name))}var Hp=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`,Up=e=>`rounded-full border px-2.5 py-0.5 text-xs transition-colors ${e?`border-blue/60 bg-blue/10 text-blue`:`border-line text-ink-dim hover:border-blue/40 hover:text-ink`}`,Wp=e=>`rounded px-1.5 py-0.5 text-[10px] font-semibold ${e===`ok`?`bg-ok/10 text-ok`:e===`warn`?`bg-warn/10 text-warn`:e===`blue`?`bg-blue/10 text-blue`:`bg-line text-ink-dim`}`,Gp={install:Ye,update:Ke,enable:fn,disable:dn,uninstall:gn};function Kp(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}catch{return n.toISOString()}}function qp({compact:e=!1,onOpen:t}){let{t:n}=z();return(0,J.jsxs)(`button`,{type:`button`,onClick:t,title:n(`verticals.entry`),"aria-label":n(`verticals.entry`),"data-testid":`vertical-store-entry`,className:`mx-2 my-1 flex h-9 shrink-0 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`,children:[(0,J.jsx)(hn,{size:17,strokeWidth:1.5}),!e&&(0,J.jsx)(`span`,{children:n(`verticals.entry`)})]})}function Jp({row:e,locale:t,hosted:n,busy:r,failure:i,known:a,onAct:o,onJump:s,onTag:c}){let{t:l}=z(),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),m=Pp(e),h=r||m,g=Ep(e,n),_=e.operation,v=Np(_),y=e=>_p.includes(e)?l(Dp(e)):e,b=_&&_p.includes(_.action)?l(Ap(_.action)):l(`verticals.operationRunning`),x=e.kind===`installed`?`ok`:e.kind===`available`?`neutral`:`blue`,S=async(t=!1)=>{d(!1),await o(e,`uninstall`,t?{force:!0}:void 0)};return(0,J.jsxs)(`article`,{id:`vertical-${e.name}`,"data-testid":`vertical-${e.name}`,"data-kind":e.kind,tabIndex:-1,className:`flex flex-col rounded-xl border border-line/70 p-4 outline-none focus-visible:border-blue/60`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(tn,{size:22,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:e.name}),(0,J.jsx)(`span`,{className:Wp(x),"data-testid":`vertical-kind`,children:l(Op(e.kind))}),e.kind!==`available`&&(0,J.jsx)(`span`,{className:Wp(e.enabled?`ok`:`neutral`),children:e.enabled?l(`verticals.enabled`):l(`verticals.disabledState`)}),e.update_available&&(0,J.jsx)(`span`,{className:Wp(`warn`),"data-testid":`vertical-update`,children:l(`verticals.updateAvailable`)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:jp(e,t)}),e.routing_path?.length?(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:e.routing_path.join(` / `)}):null]})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-ink-faint`,children:[e.installed_version&&(0,J.jsx)(`span`,{children:l(`verticals.installedVersion`,{version:e.installed_version})}),e.version&&e.version!==e.installed_version&&(0,J.jsx)(`span`,{children:l(`verticals.catalogVersion`,{version:e.version})}),e.size_bytes!=null&&(0,J.jsxs)(`span`,{children:[l(`verticals.size`),` `,Mp(e.size_bytes)]})]}),e.requires.length>0&&(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.requires`)}),e.requires.map(e=>a.has(e)&&s?(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e),"aria-label":l(`verticals.jumpTo`,{name:e}),title:l(`verticals.jumpTo`,{name:e}),className:`rounded-full border border-line px-2 py-0.5 font-mono text-ink-dim transition-colors hover:border-blue/60 hover:text-blue`,children:e},e):(0,J.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.shared.length>0&&(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.shared`)}),e.shared.map(e=>(0,J.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.tags.length>0&&(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.tags.map(e=>c?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint transition-colors hover:text-blue`,children:[`#`,e]},e):(0,J.jsxs)(`span`,{className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint`,children:[`#`,e]},e))}),e.missing_python.length>0&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-start gap-2 rounded-lg bg-warn/10 p-2.5 text-xs leading-relaxed text-warn`,"data-testid":`vertical-missing-python`,children:[(0,J.jsx)(_n,{size:14,className:`mt-0.5 shrink-0`}),(0,J.jsx)(`span`,{children:l(`verticals.missingPython`,{packages:e.missing_python.join(`, `)})})]}),!!e.runtime_issues?.length&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-runtime-issues`,children:l(`verticals.runtimeIssues`,{issues:e.runtime_issues.join(`; `)})}),!!e.install_issues?.length&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-install-issues`,children:l(`verticals.installIssues`,{issues:e.install_issues.join(`; `)})}),e.used_by.length>0&&(0,J.jsxs)(`div`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:()=>p(e=>!e),className:`inline-flex items-center gap-1 transition-colors hover:text-ink`,"data-testid":`vertical-used-by`,children:[e.used_by.length===1?l(`verticals.usedByOne`):l(`verticals.usedBy`,{count:e.used_by.length}),f?(0,J.jsx)(Wt,{size:12}):(0,J.jsx)(Ue,{size:12})]}),f&&(0,J.jsx)(`ul`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono`,children:e.used_by.map(e=>(0,J.jsx)(`li`,{className:`rounded bg-bg px-1.5 py-0.5`,children:e},e))})]}),m&&_&&(0,J.jsxs)(`div`,{className:`mt-3`,"data-testid":`vertical-progress`,children:[(0,J.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-ink-dim`,children:[(0,J.jsx)(nn,{size:14,className:`animate-spin`}),(0,J.jsx)(`span`,{children:b}),v!=null&&(0,J.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-ink-faint`,children:[v,`%`]})]}),(0,J.jsx)(`div`,{role:`progressbar`,"aria-label":b,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":v??void 0,className:`mt-1.5 h-1 overflow-hidden rounded bg-line`,children:v==null?(0,J.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`}):(0,J.jsx)(`div`,{className:`h-full rounded bg-blue transition-[width] duration-500`,style:{width:`${v}%`}})}),_.message&&(0,J.jsx)(`p`,{className:`mt-1 break-words text-xs text-ink-faint`,children:_.message})]}),_?.status===`failed`&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-err`,"data-testid":`vertical-operation-failed`,children:[l(`verticals.operationFailed`,{action:y(_.action)}),_.message?` — ${_.message}`:``]}),i&&(0,J.jsxs)(`div`,{role:`alert`,className:`mt-3 rounded-lg border border-err/30 bg-err/5 p-2.5 text-sm text-ink-dim`,"data-testid":`vertical-failure`,children:[(0,J.jsx)(`p`,{className:`break-words`,children:i.text}),i.offerForce&&(0,J.jsxs)(`button`,{type:`button`,className:`${Hp} mt-2 border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(!0),children:[(0,J.jsx)(gn,{size:14}),l(`verticals.removeAnyway`)]})]}),g.length>0&&(0,J.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:g.map(t=>{let n=Gp[t];if(t===`uninstall`)return u?(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`${Hp} border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(),"data-testid":`vertical-confirm-uninstall`,children:[(0,J.jsx)(gn,{size:14}),l(`verticals.confirmUninstall`)]}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint hover:text-ink`,onClick:()=>d(!1),children:l(`common.cancel`)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:l(`verticals.confirmUninstallHint`,{name:e.name})})]},t):(0,J.jsxs)(`button`,{type:`button`,className:Hp,disabled:h,onClick:()=>d(!0),"data-action":t,children:[(0,J.jsx)(n,{size:14}),l(Dp(t))]},t);let r=t===`update`&&e.version?l(`verticals.updateTo`,{version:e.version}):l(Dp(t));return(0,J.jsxs)(`button`,{type:`button`,className:Hp,disabled:h,onClick:()=>void o(e,t),"data-action":t,children:[(0,J.jsx)(n,{size:14}),r]},t)})})]})}function Yp({payload:e,filter:t,onFilter:n,hosted:r,supported:i,loading:a,refreshing:o,error:s,pending:c,failures:l,onAct:u,onRefresh:d,onJump:f}){let{t:p,locale:m}=z(),h=e?.verticals??[],g=(0,G.useMemo)(()=>Tp(h),[h]),_=(0,G.useMemo)(()=>wp(h),[h]),v=(0,G.useMemo)(()=>Vp(h),[h]),y=(0,G.useMemo)(()=>Cp(h,t),[h,t]),b=t.query.trim()!==``||t.kind!==`all`||t.tag!==null||!!t.routingPath,x=e?.catalog;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:p(r?`verticals.hostedNote`:`verticals.intro`)}),i===!1&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-4 rounded-lg border border-line bg-bg/70 p-3 text-sm text-ink-dim`,"data-testid":`vertical-store-too-old`,children:p(`verticals.tooOld`)}),i!==!1&&(0,J.jsxs)(J.Fragment,{children:[x&&(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-faint`,"data-testid":`vertical-catalog`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,title:x.source,children:p(`verticals.catalogSource`,{source:x.source})}),x.release_tag&&(0,J.jsx)(`span`,{className:`rounded bg-bg px-1.5 py-0.5 font-mono`,children:p(`verticals.catalogRelease`,{tag:x.release_tag})}),(0,J.jsx)(`span`,{children:x.fetched_at?p(`verticals.catalogFetched`,{time:Kp(x.fetched_at,m)}):p(`verticals.catalogNever`)}),(0,J.jsxs)(`button`,{type:`button`,className:`${Hp} ml-auto`,disabled:o||a,onClick:d,"data-testid":`vertical-refresh-catalog`,children:[(0,J.jsx)(Ke,{size:14,className:o?`animate-spin`:``}),p(o?`verticals.refreshing`:`verticals.refreshCatalog`)]})]}),x?.error&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 rounded-lg border border-warn/40 bg-warn/10 p-2.5 text-sm text-warn`,"data-testid":`vertical-catalog-error`,children:p(`verticals.catalogError`,{error:x.error})}),s&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-err`,"data-testid":`vertical-store-error`,children:s}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-line bg-bg px-2.5 focus-within:border-blue/60`,children:[(0,J.jsx)(ot,{size:14,className:`shrink-0 text-ink-faint`}),(0,J.jsx)(`span`,{className:`sr-only`,children:p(`verticals.search`)}),(0,J.jsx)(`input`,{type:`search`,value:t.query,onChange:e=>n({...t,query:e.target.value}),placeholder:p(`verticals.searchPlaceholder`),className:`min-w-0 flex-1 bg-transparent text-sm text-ink outline-none placeholder:text-ink-faint`})]}),(0,J.jsx)(`div`,{role:`group`,"aria-label":p(`verticals.kindFilter`),className:`flex flex-wrap gap-1`,children:gp.map(e=>(0,J.jsx)(`button`,{type:`button`,"aria-pressed":t.kind===e,onClick:()=>n({...t,kind:e}),className:`h-8 rounded-md px-2.5 text-xs font-medium transition-colors ${t.kind===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:p(kp(e))},e))})]}),_.length>0&&(0,J.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink-faint`,children:[p(`verticals.routingPath`),(0,J.jsxs)(`select`,{className:`rounded-md border border-line bg-bg p-1.5`,value:t.routingPath??``,onChange:e=>n({...t,routingPath:e.target.value}),children:[(0,J.jsx)(`option`,{value:``,children:p(`verticals.filter.all`)}),_.map(e=>(0,J.jsx)(`option`,{value:e,children:e.replaceAll(`/`,` / `)},e))]})]}),(g.length>0||b)&&(0,J.jsxs)(`div`,{role:`group`,"aria-label":p(`verticals.tagFilter`),className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[g.map(e=>(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":t.tag===e,className:Up(t.tag===e),onClick:()=>n({...t,tag:t.tag===e?null:e}),children:[`#`,e]},e)),b&&(0,J.jsx)(`button`,{type:`button`,className:`ml-1 text-xs text-ink-faint hover:text-ink`,onClick:()=>n(yp),children:p(`verticals.clearFilters`)})]}),h.length>0&&(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`verticals.count`,{shown:y.length,total:h.length})}),a&&!e&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.loading`)}),e&&h.length===0&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.none`)}),h.length>0&&y.length===0&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.noMatches`)}),y.length>0&&(0,J.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,"data-testid":`vertical-grid`,children:y.map(e=>(0,J.jsx)(Jp,{row:e,locale:m,hosted:r,busy:c===e.name,failure:l[e.name],known:v,onAct:u,onJump:f,onTag:e=>n({...t,tag:e})},e.name))})]})]})}function Xp({open:e,onClose:t}){let{t:n}=z(),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)({}),[_,v]=(0,G.useState)(yp),y=(0,G.useRef)(null),b=(0,G.useRef)(t);b.current=t;let x=(0,G.useRef)(n);x.current=n;let S=Fp(r?.verticals??[]),C=!!r?.host.managed_by_host||bp();(0,G.useEffect)(()=>{if(!e||a!==null)return;let t=!1;return R.meta().then(e=>{t||o(Bp(e.capabilities,le))},()=>{t||o(!0)}),()=>{t=!0}},[e,a]),(0,G.useEffect)(()=>{if(a!==!0||!e&&!S)return;let t=new AbortController,n=()=>R.verticals(t.signal).then(e=>{t.signal.aborted||(i(e),f(e=>e?.source===`load`?null:e))},n=>{t.signal.aborted||(zp(n)?o(!1):e&&f({text:x.current(`verticals.loadFailed`),source:`load`}))});e&&c(!0),n().finally(()=>{t.signal.aborted||c(!1)});let r=Ip(e,S),s=r?window.setInterval(n,r):0;return()=>{t.abort(),s&&window.clearInterval(s)}},[e,S,a]),(0,G.useEffect)(()=>{if(!e){g({}),f(e=>e?.source===`refresh`?null:e);return}y.current?.focus();let t=e=>{e.key===`Escape`&&b.current()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let w=(0,G.useCallback)(async()=>{try{i(await R.verticals()),f(e=>e?.source===`load`?null:e)}catch(e){zp(e)?o(!1):f({text:x.current(`verticals.loadFailed`),source:`load`})}},[]),T=(0,G.useCallback)(async(e,t,n={})=>{m(e.name),g(t=>{let{[e.name]:n,...r}=t;return r});try{return await R.manageVertical(e.name,t,n),await w(),!0}catch(r){let i=Lp(r)||x.current(`verticals.actionFailed`),a=t===`uninstall`&&Rp(r)&&!n.force;return g(t=>({...t,[e.name]:{text:i,offerForce:a}})),!1}finally{m(null)}},[w]),E=(0,G.useCallback)(async()=>{u(!0),f(null);try{i(await R.refreshVerticalCatalog())}catch(e){f({text:Lp(e)||x.current(`verticals.loadFailed`),source:`refresh`})}finally{u(!1)}},[]),D=(0,G.useCallback)(e=>{v(yp),!(typeof document>`u`)&&window.setTimeout(()=>{let t=document.getElementById(`vertical-${e}`);t?.scrollIntoView?.({block:`nearest`,behavior:`smooth`}),t?.focus?.()},0)},[]);return e?(0,sp.createPortal)((0,J.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:t,children:(0,J.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`vertical-store-title`,onClick:e=>e.stopPropagation(),className:`flex max-h-[85vh] w-full max-w-4xl flex-col overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl scroll-thin`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`h2`,{id:`vertical-store-title`,className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,J.jsx)(hn,{size:20,strokeWidth:1.5,className:`text-blue`}),n(`verticals.title`)]}),(0,J.jsx)(`button`,{ref:y,type:`button`,"aria-label":n(`verticals.close`),className:`icon-control p-1.5`,onClick:t,children:(0,J.jsx)(Je,{size:18})})]}),(0,J.jsx)(Yp,{payload:r,filter:_,onFilter:v,hosted:C,supported:a,loading:s,refreshing:l,error:d?.text??``,pending:p,failures:h,onAct:T,onRefresh:()=>void E(),onJump:D})]})}),document.body):null}function Zp(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)||e}function Qp(e,t,n){if(e.length===0)return`local`;let r=n.trim(),i=r?e.filter(e=>e.launch_cwd?.trim()===r):[];return i.length===0||t&&!i.some(e=>e.id===t)?`all`:`local`}function $p({projects:e,activeId:t,activeWork:n,localCwd:r,onSelect:i,onPrefetch:a,onManage:s,onResume:c,resumingId:l,onOpenPanel:u,onOpenLearning:d,onOpenVerticals:f,onNew:p,loading:m,creating:h=!1,error:g,onRetry:y,mobileOpen:x=!1,collapsed:T=!1,onToggleCollapse:E,themeMode:O,onCycleTheme:k}){let{t:A,locale:j}=z(),[M,ee]=(0,G.useState)(`local`),N=(0,G.useRef)(!1),[P,F]=(0,G.useState)(``),[te,ne]=(0,G.useState)(()=>new Set),re=T&&!x,ie=r.trim(),I=(0,G.useMemo)(()=>ie?e.filter(e=>e.launch_cwd?.trim()===ie):[],[ie,e]);(0,G.useEffect)(()=>{N.current||m||e.length===0||(N.current=!0,ee(Qp(e,t,ie)))},[t,m,ie,e]);let L=M===`local`?I:e,ae=P.trim()?Zd(L,P):L,oe=(0,G.useMemo)(()=>{if(M===`local`)return ae.length>0?[[ie||`Local`,ae]]:[];let e=new Map;return ae.forEach(t=>{let n=t.launch_cwd?.trim()||A(`common.unassigned`),r=e.get(n)??[];r.push(t),e.set(n,r)}),[...e.entries()]},[ie,M,ae]),se=e=>te.has(e)&&!P.trim();return(0,J.jsxs)(rt,{mobileOpen:x,collapsed:T,children:[(0,J.jsx)(`div`,{className:`chrome-seam-surface flex h-12 shrink-0 items-center border-b border-line/50 ${re?`justify-center`:`justify-between px-4`}`,children:re?(0,J.jsx)(jt,{size:22,compact:!0}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(jt,{size:24}),(0,J.jsx)(`button`,{type:`button`,onClick:E,"aria-label":A(`sidebar.collapse`),title:`${A(`sidebar.collapse`)} · Ctrl/⌘ B`,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,J.jsx)(o,{icon:C,className:`h-3.5 w-3.5`})})]})}),re?(0,J.jsx)(`div`,{className:`flex h-12 shrink-0 items-center justify-center`,children:(0,J.jsx)(`button`,{type:`button`,onClick:E,"aria-label":A(`sidebar.expand`),title:`${A(`sidebar.expand`)} · Ctrl/⌘ B`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink`,children:(0,J.jsx)(o,{icon:v,className:`h-3.5 w-3.5`})})}):null,re?(0,J.jsx)(hp,{compact:!0}):null,re&&d?(0,J.jsx)(ur,{onOpen:d,compact:!0}):null,re&&f?(0,J.jsx)(qp,{compact:!0,onOpen:f}):null,re?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`nav`,{"aria-label":j===`zh-CN`?`工具与知识`:`Tools and knowledge`,"data-sidebar-resources":!0,className:`shrink-0 overflow-y-auto overscroll-contain border-b border-line/50 px-2 py-2 scroll-thin [&>section]:mx-2 [&>section]:border-0 [&>section]:py-0 [&>section>div>button:first-child]:px-3`,style:{maxHeight:`min(40dvh, 360px)`},children:[(0,J.jsx)(hp,{}),d&&(0,J.jsx)(ur,{onOpen:d}),f?(0,J.jsx)(qp,{onOpen:f}):null]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pb-1 pt-3`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:j===`zh-CN`?`项目`:`Projects`}),I.length>0&&I.lengthee(e.target.value),className:`min-w-0 bg-transparent text-xs text-ink-faint`,children:[(0,J.jsx)(`option`,{value:`local`,children:A(`common.local`)}),(0,J.jsx)(`option`,{value:`all`,children:A(`common.all`)})]}):null,(0,J.jsx)(`button`,{type:`button`,onClick:p,disabled:h,"aria-label":A(`sidebar.create`),title:A(`sidebar.create`),className:`ml-auto flex h-8 items-center justify-center rounded-md px-2 text-xs text-ink-dim hover:bg-bg disabled:opacity-40`,children:h?`…`:j===`zh-CN`?`+ 新建`:`+ New`})]}),(0,J.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,J.jsx)(`label`,{className:`sr-only`,htmlFor:`daemon-search`,children:A(`sidebar.find`)}),(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-line/60 bg-bg/60 px-2 focus-within:border-blue/60`,children:[(0,J.jsx)(`input`,{id:`daemon-search`,value:P,onChange:e=>F(e.target.value),placeholder:A(`sidebar.find`),className:`h-8 min-w-0 flex-1 bg-transparent text-xs text-ink outline-none placeholder:text-ink-faint`}),P?(0,J.jsx)(`button`,{type:`button`,"aria-label":A(`sidebar.clearSearch`),onClick:()=>F(``),className:`px-1 text-sm text-ink-faint hover:text-ink`,children:`×`}):null]})]}),(0,J.jsxs)(`div`,{className:`mobile-scroll-region min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-3 pb-3 scroll-thin`,children:[m&&e.length===0?(0,J.jsx)(`div`,{className:`px-1 py-3 text-xs text-ink-faint`,children:A(`common.loading`)}):null,g?(0,J.jsx)(`button`,{type:`button`,onClick:y,className:`mb-2 w-full rounded-md bg-err/5 px-3 py-2 text-left text-xs text-err`,children:A(`sidebar.refreshFailed`)}):null,!m&&!g&&ae.length===0?(0,J.jsxs)(`div`,{className:`px-1 py-4 text-xs text-ink-faint`,children:[(0,J.jsx)(`div`,{children:P.trim()?A(`sidebar.noMatches`,{query:P.trim()}):A(`sidebar.noSessions`)}),P.trim()?(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(``),className:`mt-2 text-xs text-ink-dim underline underline-offset-2 hover:text-ink`,children:A(`sidebar.clearSearch`)}):null]}):null,oe.map(([e,r])=>(0,J.jsxs)(`section`,{className:`mb-1 last:mb-0`,children:[r.length>1&&oe.length>1?(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":!se(e),title:e,onClick:()=>ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),className:`mb-1 flex h-7 w-full items-center gap-2 rounded-md px-1.5 text-left text-[11px] font-medium text-ink-faint hover:bg-bg/70 hover:text-ink-dim`,children:[(0,J.jsx)(o,{icon:S,className:`h-2.5 w-2.5 transition-transform ${se(e)?`-rotate-90`:``}`}),(0,J.jsx)(o,{icon:b,className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Zp(e)})]}):null,r.length===1||oe.length===1||!se(e)?r.map(e=>{let r=e.id===t,u=r&&n?.sessionId===e.id?n:void 0,d=u?ui(u.status,j,u.connected):void 0,f=Gd(e),p=f?(e.label||e.display_name||``).trim():e.objective.trim()||A(`sidebar.unnamedSession`),m=e.daemon_alive&&e.daemon_protocol_compatible===!1,h=m&&e.daemon_protocol_error===`daemon release is incompatible with WebAPI release`,g=m&&!h,_=!e.daemon_alive&&e.last_active>0&&!!e.workdir?.trim();return(0,J.jsxs)(`div`,{"data-active":r?`true`:`false`,onPointerEnter:()=>{r||a?.(e.id)},className:`session-card group relative mb-0.5 h-14 w-full rounded-md transition-colors duration-150 ease-panel ${r?`text-ink`:`text-ink-dim hover:text-ink`}`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`absolute left-0 transition-colors ${r?`inset-y-1 w-px bg-blue`:`inset-y-2 w-px bg-transparent group-hover:bg-ink-faint/30`}`}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),onFocus:()=>{r||a?.(e.id)},"aria-current":r?`page`:void 0,title:`${p}${!f&&p!==e.id?` · ${e.id}`:``}${e.objective&&e.objective!==p?` — ${e.objective}`:``}`,className:`flex h-14 w-full min-w-0 flex-col justify-center px-2.5 text-left ${_?`pr-[4.75rem]`:`pr-10`}`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(ct,{ok:e.daemon_alive&&!g,title:g?A(`sidebar.updateRequired`):e.daemon_alive?A(`sidebar.daemonAlive`):A(`sidebar.stopped`)}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:p})]}),(0,J.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5 pl-3.5 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate ${g?`text-warn`:``}`,title:d,"data-session-work-state":u?.status.state,children:g?A(`sidebar.updateRequired`):d??(e.daemon_alive?A(`sidebar.runningFor`,{uptime:St(e.uptime_seconds)}):e.last_active>0?A(`sidebar.lastActive`,{time:wt(e.last_active,j)}):A(`sidebar.stopped`))}),h&&(0,J.jsx)(`span`,{title:A(`sidebar.updateAvailableHint`),className:`shrink-0 rounded border border-line px-1 text-[10px] leading-4`,children:A(`sidebar.updateAvailable`)})]})]}),_&&c?(0,J.jsx)(`button`,{type:`button`,disabled:l!=null,onClick:t=>{t.stopPropagation(),c(e.id)},"aria-label":A(`sidebar.resume`),title:A(`sidebar.resumeHint`,{workdir:e.workdir??``}),className:`absolute right-9 top-3 flex h-8 w-8 items-center justify-center rounded-md text-blue opacity-100 hover:bg-blue/10 disabled:opacity-40 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:l===e.id?`…`:(0,J.jsx)(o,{icon:D,className:`h-3 w-3`})}):null,(0,J.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),s(e.id)},"aria-label":A(`sidebar.manage`,{name:p}),title:A(`sidebar.manageHint`),className:`absolute right-1 top-3 flex h-8 w-8 items-center justify-center rounded-md text-ink-faint opacity-100 transition-opacity hover:bg-panel-raised hover:text-ink sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,J.jsx)(o,{icon:w,className:`h-4 w-4`})})]},e.id)}):null]},e))]}),(0,J.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between border-t border-line/50 px-4 py-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`config`),className:`icon-control flex h-8 w-8 items-center justify-center`,"aria-label":A(`sidebar.openSettings`),title:A(`common.settings`),children:(0,J.jsx)(o,{icon:_,className:`h-3.5 w-3.5`})}),null,(0,J.jsx)(pt,{themeMode:O,onCycleTheme:k})]})]})]})}var em=new Set([`done`,`completed`,`failed`,`skipped`]);function tm(e){return em.has(e.status)}function nm(e,t){return e.filter(e=>tm(e)===t)}var rm={in_progress:`rgb(var(--blue))`,running:`rgb(var(--blue))`,pending:`rgb(var(--ink-faint))`,queued:`rgb(var(--ink-faint))`,done:`rgb(var(--blue))`,completed:`rgb(var(--blue))`,blocked:`rgb(var(--err))`,failed:`rgb(var(--err))`};function im({items:e,onDispose:t,onStop:n,onInspect:r,busy:i,readOnly:a=!1}){let{t:o}=z(),[s,c]=(0,G.useState)(!1),l=nm(e,!1),u=nm(e,!0),d=s?u:l;return(0,J.jsxs)(`section`,{className:`card flex flex-col ${d.length>0?`min-h-0 flex-1`:`shrink-0`}`,children:[(0,J.jsx)(U,{title:o(`panel.backlog`),right:(0,J.jsx)(`button`,{className:`text-[10px] text-ink-faint transition-colors hover:text-ink`,onClick:()=>c(e=>!e),children:o(s?`backlog.active`:`backlog.history`,{count:s?l.length:u.length})})}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[d.length===0&&(0,J.jsx)($e,{children:o(s?`backlog.noHistory`:`backlog.empty`)}),d.map(e=>{let s=rm[e.status]??`rgb(var(--ink-faint))`,c=e.iterate;return(0,J.jsx)(`div`,{className:`group border-b border-line/60 px-3 py-2 last:border-0`,children:(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>r?.(e.id),disabled:!r,className:`block max-w-full truncate text-left text-xs font-medium text-ink enabled:hover:text-blue-sky enabled:focus-visible:outline-none enabled:focus-visible:underline`,title:r?o(`backlog.viewDetails`):void 0,children:e.title||e.objective}),(0,J.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[(0,J.jsx)(at,{color:s,children:In(e.status,o)}),typeof e.priority==`number`&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:Rn(e.priority,o)}),c&&(0,J.jsxs)(`span`,{className:`text-[10px] text-blue-sky`,children:[`↻ `,o(`backlog.iterating`)]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100`,children:[!a&&c&&(0,J.jsx)(W,{variant:`ghost`,onClick:()=>n(e.id),disabled:i,title:o(`backlog.stopIterating`),children:o(`backlog.stop`)}),!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(W,{variant:`ghost`,onClick:()=>t(e.id,`done`),disabled:i,title:o(`backlog.markDone`),children:`✓`}),(0,J.jsx)(W,{variant:`ghost`,onClick:()=>t(e.id,`rm`),disabled:i,title:o(`backlog.remove`),children:`✕`})]})]})]})},e.id)})]})]})}var am={win:`rgb(var(--blue))`,milestone:`rgb(var(--blue))`,insight:`rgb(var(--ink-dim))`,decision:`rgb(var(--ink-dim))`,failure:`rgb(var(--err))`,note:`rgb(var(--ink-faint))`};function om({entries:e}){let{t}=z(),n=[...e].reverse();return(0,J.jsxs)(`section`,{className:`card flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(U,{title:t(`panel.journal`),right:(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.length})}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[e.length===0&&(0,J.jsx)($e,{children:`no journal entries yet`}),n.map(e=>{let t=am[e.kind]??`rgb(var(--ink-faint))`,n=String(e.extra?.pricing_status??``),r=e.extra&&Object.prototype.hasOwnProperty.call(e.extra,`cost_usd`)?e.extra.cost_usd:e.cost_usd,i=typeof r==`number`&&r>0?`${bt(r)}${n===`partial`||n===`unpriced`?`+`:``}`:n===`partial`||n===`unpriced`?n:``;return(0,J.jsxs)(`div`,{className:`border-b border-line/60 px-3 py-2 last:border-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full`,style:{background:t}}),(0,J.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide`,style:{color:t},children:e.kind}),(0,J.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:Dt(e.ts)})]}),(0,J.jsx)(`div`,{className:`mt-1 text-xs font-medium text-ink`,children:e.title}),e.summary&&(0,J.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-snug text-ink-dim`,children:e.summary}),(0,J.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(e.tags??[]).slice(0,4).map(e=>(0,J.jsx)(`span`,{className:`rounded bg-line/60 px-1 text-[9px] text-ink-faint`,children:e},e)),i?(0,J.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:i}):null]})]},e.id)})]})]})}function sm(e){return e==null?``:e<3?`now`:e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h`}function cm({roles:e}){let{t}=z(),n=new Map(e.map(e=>[e.role,e])),r=et.map(e=>n.get(e)).filter(Boolean),i=e.filter(e=>!gt(e.role)),a=[...r,...i];return(0,J.jsxs)(`section`,{className:`card`,children:[(0,J.jsx)(U,{title:t(`panel.roles`)}),(0,J.jsx)(`div`,{children:a.map(e=>{let n=B.role[e.role]??B.info;return(0,J.jsxs)(`div`,{className:`grid grid-cols-[84px_minmax(0,1fr)_auto] items-center gap-2 border-b border-line/60 px-3 py-2 last:border-b-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{"data-role-dot":e.role,"aria-hidden":`true`,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{background:n}}),(0,J.jsx)(`span`,{className:`text-[11px] font-medium capitalize`,style:{color:e.active?n:B.inkDim},children:gt(e.role)?Ve(e.role,t):e.role})]}),(0,J.jsx)(`div`,{className:`min-w-0 truncate font-mono text-[10px] text-ink-faint`,title:e.model,children:e.model||`—`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 text-right`,children:[(0,J.jsx)(`span`,{className:`text-[10px]`,style:{color:e.active?B.ink:B.inkFaint},children:e.active?e.status||`active`:`idle`}),e.active&&sm(e.age_s)&&(0,J.jsxs)(`span`,{className:`text-[10px] tabular-nums text-ink-faint`,children:[`· `,sm(e.age_s)]}),e.effort&&(0,J.jsxs)(`span`,{className:`text-[10px]`,style:{color:Ze(e.effort)},children:[`· `,e.effort]})]})]},e.role)})})]})}function lm({open:e,snap:t,journal:n,busy:r,onClose:i,onDispose:a,onStop:o,onInspect:s}){let{t:c}=z();return(0,J.jsxs)(dt,{open:e,onClose:i,label:`Project inspector`,width:`max-w-6xl`,children:[(0,J.jsx)(lt,{title:c(`panel.project`),sub:t.session.display_name||t.session.id}),(0,J.jsxs)(`div`,{className:`h-[68vh] min-h-0 space-y-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid lg:grid-cols-[minmax(0,1.4fr)_minmax(300px,0.8fr)] lg:gap-3 lg:space-y-0 lg:overflow-hidden`,children:[(0,J.jsx)(im,{items:t.backlog,onDispose:a,onStop:o,onInspect:s,busy:r}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,J.jsx)(cm,{roles:t.roles}),(0,J.jsx)(om,{entries:n})]})]})]})}var um=e=>e?new Date(e*1e3).toLocaleString():`—`;function dm({label:e,value:t}){return(0,J.jsxs)(`div`,{className:`rounded-md border border-line/70 bg-bg/40 px-3 py-2`,children:[(0,J.jsx)(`div`,{className:`text-[9px] font-semibold uppercase tracking-wider text-ink-faint`,children:e}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:t})]})}function fm({sid:e,itemId:t,onClose:n,onDone:r,onSkip:i,onStop:a,busy:o,readOnly:s=!1}){let{t:c}=z(),l=ke(e,t),u=l.data,d=u?tm(u):!1,f=zn(u?.outcome,c);return(0,J.jsxs)(dt,{open:!!t,onClose:n,label:c(`task.details`),width:`max-w-3xl`,showClose:!1,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 border-b border-line px-4 py-3 sm:flex-nowrap sm:px-5`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink`,children:u?.title||c(`task.details`)}),u?(0,J.jsx)(at,{children:In(u.status,c)}):null]})}),!s&&u&&!d?(0,J.jsxs)(`div`,{className:`order-3 flex w-full shrink-0 items-center justify-end gap-1 sm:order-none sm:w-auto`,children:[u.iterate?(0,J.jsx)(W,{onClick:()=>a(u.id),disabled:o,children:c(`task.stopLoop`)}):null,(0,J.jsx)(W,{onClick:()=>r(u.id),disabled:o,children:c(`task.done`)}),(0,J.jsx)(W,{variant:`danger`,onClick:()=>i(u.id),disabled:o,children:c(`task.skip`)})]}):null,(0,J.jsx)(`button`,{type:`button`,"aria-label":c(`task.close`),onClick:n,className:`order-2 rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink sm:order-none`,children:`×`})]}),(0,J.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto p-4 scroll-thin sm:p-5`,children:[l.isLoading?(0,J.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,J.jsx)(tt,{})}):null,l.isError?(0,J.jsx)(`div`,{className:`rounded-md border border-err/40 bg-err/5 p-3 text-xs text-err`,children:l.error.message}):null,u?(0,J.jsxs)(`div`,{className:`space-y-4`,children:[u.pending_question?(0,J.jsxs)(`div`,{className:`rounded-lg border border-warn/40 bg-warn/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-warn`,children:c(`task.waitingOnYou`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:u.pending_question})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.objective`)}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap rounded-lg border border-line bg-bg/50 p-3 text-sm leading-relaxed text-ink-dim`,children:u.objective||u.original_objective||c(`task.noObjective`)})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[(0,J.jsx)(dm,{label:c(`task.priority`),value:Rn(u.priority,c)}),(0,J.jsx)(dm,{label:c(`task.started`),value:um(u.started_ts)}),(0,J.jsx)(dm,{label:c(`task.finished`),value:um(u.finished_ts)})]}),f.length?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.outcome`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,J.jsx)(at,{children:e},e))})]}):null,u.iterate||u.iteration_cycles_done||u.iteration_cost_usd?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.iteration`)}),(0,J.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,J.jsx)(dm,{label:c(`task.mode`),value:u.iterate?c(`task.autoIterate`):c(`task.singlePass`)}),(0,J.jsx)(dm,{label:c(`task.cycles`),value:`${u.iteration_cycles_done??0}/${u.iteration_max_cycles??`—`}`}),(0,J.jsx)(dm,{label:c(`task.cost`),value:`$${(u.iteration_cost_usd??0).toFixed(2)}`})]})]}):null,u.last_error?(0,J.jsxs)(`section`,{className:`rounded-lg border border-err/30 bg-err/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:c(`task.lastError`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs leading-relaxed text-ink-dim`,children:u.last_error})]}):null,u.notes?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.notes`)}),(0,J.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-relaxed text-ink-dim`,children:u.notes})]}):null,u.tags?.length||u.deps?.length?(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(u.tags??[]).map(e=>(0,J.jsxs)(at,{children:[`#`,e]},`tag-${e}`)),u.deps?.length?(0,J.jsx)(at,{children:c(`task.dependsOnCount`,{count:u.deps.length})}):null]}):null]}):null]})]})}function pm({onPointerDown:e,onReset:t,onNudge:n,value:r,min:i=240,max:a=600,label:o=`Resize panel`}){return(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":o,"aria-valuenow":r,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:e,onDoubleClick:t,onKeyDown:e=>{e.key===`ArrowLeft`?(e.preventDefault(),n(-16)):e.key===`ArrowRight`?(e.preventDefault(),n(16)):e.key===`Home`&&(e.preventDefault(),t())},className:`group relative hidden w-2 shrink-0 cursor-col-resize items-center justify-center outline-none lg:flex`,children:(0,J.jsx)(`span`,{className:`h-full w-px bg-line/30 transition-colors duration-150 group-hover:bg-blue/70 group-focus:bg-blue/70`})})}function mm({sid:e,record:t,expanded:n=!1,zh:r}){let[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(``);(0,G.useEffect)(()=>{if(!i||!e)return;let n=new AbortController;return l(!0),d(``),R.workRecord(e,t.role,t.id,n.signal).then(e=>{n.signal.aborted||s(e.detail)}).catch(e=>{n.signal.aborted||d(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||l(!1)}),()=>n.abort()},[i,e,t.id,t.role,t.detail]);let f=o.length>=t.detail.length?o:t.detail;return(0,J.jsxs)(`details`,{open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,J.jsxs)(`summary`,{children:[(0,J.jsx)(`span`,{children:i?r?`收起详情`:`Hide details`:r?`展开完整记录`:`Read full record`}),(0,J.jsx)(Ue,{size:12})]}),(0,J.jsxs)(J.Fragment,{children:[c&&(0,J.jsx)(`small`,{role:`status`,children:r?`正在读取完整记录…`:`Loading the full record…`}),u&&(0,J.jsx)(`small`,{role:`status`,children:r?`暂未读取到完整记录,已显示保存的摘要。可收起后重试。`:`Full record unavailable; the saved preview is shown. Reopen to retry.`}),(0,J.jsx)(`div`,{className:`agent-record-actions`,children:(0,J.jsx)(Qe,{text:f,label:r?`复制完整记录`:`Copy full record`,copiedLabel:r?`已复制`:`Copied`})}),(0,J.jsx)(`div`,{className:`agent-record-detail`,children:(0,J.jsx)(H,{children:f})}),t.round_index!=null&&(0,J.jsx)(`small`,{children:r?`第 ${t.round_index} 轮`:`Round ${t.round_index}`})]})]})}function hm({sid:e,view:t,roles:n=[],events:r=[],taskId:i,paused:a=!1,selectedRole:o,onSelectRole:s,onClose:c,showTabs:l=!0}){let{locale:u,t:d}=z(),f=u===`zh-CN`,[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(24),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(``),[x,S]=(0,G.useState)(Date.now),C=o||p||n.find(e=>e.active)?.role||t?.active_role||`manager`,w=_i(t,n,C,a,i),T=hi(t,C,i).map(e=>{let t=e.detail;for(let n of r){if(n.kind===`reasoning`)continue;let r=String(n.event_id||n.id||``),i=String(n.message_id||``);if(r!==e.id&&(!i||e.id!==`${e.role}:${i}`))continue;let a=pi(String(n.text||n.reason||n.summary||``));a.length>t.length&&(t=a)}return t===e.detail?e:{...e,detail:t}});(0,G.useEffect)(()=>{g(24),b(``)},[e,C,i]);let E=i?ti(void 0,t,i):0,D=E?hi(t,C,i,E):T,O=D[0],k=D.find(e=>e.detail&&[`agent_message`,`assistant_message`,`decision`,`verdict`,`handoff`,`review`,`completion`].includes(e.kind)),A=gi(r,C,i,E),j=A&&Number(A.ts||0)>=(O?.ts??0),M=!j&&O&&[`agent_message`,`assistant_message`].includes(O.kind)&&O.detail?O.detail.split(/[。\n]/)[0].slice(0,70):mi(j?String(A.kind):O?.kind||`task`,f,j?String(A.tool_name||``):``),ee=n.find(e=>e.role===C)?.model||t?.roles.find(e=>e.role===C)?.model,N=O?Math.max(0,Math.floor(x/1e3-O.ts)):0,P=Math.max(O?.ts??0,j?Number(A?.ts||0):0),F=w&&P?vi(x/1e3-P,f):``;(0,G.useEffect)(()=>{if(!w)return;let e=setInterval(()=>S(Date.now()),1e3);return()=>clearInterval(e)},[w]);let te=e=>gt(e)?Ve(e,d):e;return(0,J.jsxs)(`section`,{className:`agent-activity`,style:{"--agent-role-color":_t(C)},"aria-label":f?`工作详情`:`Work details`,children:[(0,J.jsxs)(`header`,{className:`agent-activity-heading`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Ge,{size:15}),f?`工作详情`:`Work details`]}),c&&(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":f?`关闭工作详情`:`Close work details`,children:(0,J.jsx)(Je,{size:17})})]}),l&&(0,J.jsx)(`div`,{className:`agent-activity-tabs`,role:`group`,"aria-label":f?`筛选 Agent`:`Filter agents`,children:et.map(e=>(0,J.jsxs)(`button`,{type:`button`,"data-role":e,"aria-pressed":C===e,style:{"--agent-role-color":_t(e)},onClick:()=>{m(e),s?.(e)},children:[(0,J.jsx)(`i`,{"data-active":_i(t,n,e,a,i)}),te(e)]},e))}),(0,J.jsxs)(`div`,{className:`agent-current`,"data-active":w,children:[(0,J.jsxs)(`div`,{className:`agent-current-kicker`,children:[(0,J.jsx)(`span`,{children:w?f?`当前工作`:`Current work`:a?f?`工作已暂停`:`Work paused`:f?`最近进度`:`Latest progress`}),w?(0,J.jsxs)(`span`,{className:`agent-live-indicator`,"data-stale":F?!0:void 0,children:[(0,J.jsx)(`i`,{}),f?`处理中`:`In progress`,F&&(0,J.jsx)(`small`,{className:`agent-live-stale`,children:F})]}):(0,J.jsx)(ln,{size:12})]}),(0,J.jsx)(`h3`,{children:O||j?M:w?f?`尚无本次工作记录`:`No work recorded for this attempt yet`:f?`等待任务分配`:`Waiting for an assignment`}),k?.detail&&(0,J.jsx)(`div`,{className:`agent-current-summary`,children:(0,J.jsx)(H,{children:k.detail})}),!k&&O?.detail&&(0,J.jsx)(`p`,{className:`agent-current-summary`,children:O.detail}),O&&(0,J.jsxs)(`div`,{className:`agent-current-meta`,children:[(0,J.jsx)(Jt,{size:12}),(0,J.jsx)(`span`,{children:f?`${N<60?N+` 秒`:N<3600?Math.floor(N/60)+` 分钟`:N<86400?Math.floor(N/3600)+` 小时`:Math.floor(N/86400)+` 天`}前更新`:`Updated ${N<60?N+`s`:N<3600?Math.floor(N/60)+`m`:N<86400?Math.floor(N/3600)+`h`:Math.floor(N/86400)+`d`} ago`})]}),(0,J.jsxs)(`details`,{className:`agent-technical-details`,children:[(0,J.jsx)(`summary`,{children:f?`查看运行信息`:`Runtime details`}),(0,J.jsxs)(`p`,{children:[te(C),ee?` · ${ee}`:``,O?.round_index==null?``:f?` · 第 ${O.round_index} 轮`:` · Round ${O.round_index}`]})]})]}),(0,J.jsxs)(`div`,{className:`agent-records-heading`,children:[(0,J.jsx)(`span`,{children:f?`工作记录`:`Work log`}),(0,J.jsxs)(`span`,{children:[T.length,` `,f?`条`:`records`]})]}),(0,J.jsxs)(`div`,{className:`agent-records`,role:`log`,"aria-live":`off`,children:[T.slice(0,h).map((t,n)=>{let r=w&&t.id===O?.id,i=[`done`,`completed`].includes(t.status),a=[`failed`,`error`,`rejected`].includes(t.status),o=i?We:[`tool_use`,`command_execution`].includes(t.kind)?st:Qt;return(0,J.jsxs)(`article`,{className:`agent-record`,"data-active":r,"data-failed":a,children:[(0,J.jsx)(`span`,{className:`agent-record-icon`,children:(0,J.jsx)(o,{size:13})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`agent-record-title`,children:[(0,J.jsx)(`strong`,{children:mi(t.kind,f)}),(0,J.jsx)(`time`,{children:new Date(t.ts*1e3).toLocaleTimeString(f?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})})]}),(0,J.jsx)(`small`,{children:r?f?`进行中`:`In progress`:a?f?`未完成`:`Did not finish`:i?f?`已完成`:`Completed`:f?`已记录`:`Recorded`}),(t.detail||e)&&(0,J.jsx)(mm,{sid:e,record:t,zh:f,expanded:n===0||t.id===k?.id})]})]},t.id)}),!T.length&&(0,J.jsx)(`p`,{className:`agent-records-empty`,children:f?`${te(C)}尚未留下这个任务的工作记录。`:`No work has been recorded for this task by ${te(C)}.`})]}),(0,J.jsxs)(`div`,{className:`agent-records-footer`,children:[hg(e=>e+24),children:f?`加载更早记录(还剩 ${T.length-h} 条)`:`Load earlier records (${T.length-h} remaining)`}),e&&(0,J.jsx)(`button`,{type:`button`,disabled:_,onClick:()=>{v(!0),b(``),R.downloadWorkLog(e,C,i).catch(e=>b(e instanceof Error?e.message:String(e))).finally(()=>v(!1))},children:_?f?`正在准备完整记录…`:`Preparing full log…`:f?`下载完整工作记录(含更早历史)`:`Download full work log (including earlier history)`}),y&&(0,J.jsx)(`small`,{role:`alert`,children:y})]})]})}var gm=[`active`,`running`,`in_progress`,`claimed`],_m=[`complete`,`completed`,`done`,`success`,`incomplete`,`stalled`,`blocked`,`ended`],vm=864e5,ym=300;function bm(e,t){return Ln(e,t)}function xm(e){let t=e.type.toLowerCase().split(/[._-]/).at(-1);return[`failed`,`failure`,`error`].includes(t??``)||e.tone===`error`&&/\bfailed\b/i.test(e.title)}function Sm(e,t,n=new Date){let r=new Date(e*1e3),i=r.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()),o=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate());if(o===a)return i;let s=+(t===`zh-CN`);return o>=a-(n.getDay()-s+7)%7*vm&&on;(0,G.useEffect)(()=>{if(n!=null||o)return;let e=a.current;if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight);t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[e,o,n]);let d=!o&&n!=null&&u?`${e.slice(0,n)}…`:e;return(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(`p`,{ref:a,title:t||void 0,className:`${n==null&&!o?`line-clamp-3`:``} whitespace-pre-wrap break-words ${r}`,children:d}),u?(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`mt-1 text-xs text-blue-sky hover:text-ink`,children:i(o?`mission.showLess`:`mission.showMore`)}):null]})}function wm(e){let t=[...e.dag],n=[],r=new Set;for(;t.length;){let i=t.findIndex(t=>t.deps.every(t=>r.has(t)||!e.dag.some(e=>e.id===t))),[a]=t.splice(i>=0?i:0,1);n.push(a),r.add(a.id)}return n}function Tm(e,t=16){let n=wm(e);if(n.length<=t)return{nodes:n,hidden:[]};let r=new Set(n.slice(-t).map(e=>e.id)),i=n.find(e=>[`running`,`in_progress`,`claimed`].includes(e.status)),a=new Map(n.map(e=>[e.id,e])),o=i?[i]:[];for(;o.length;){let e=o.pop();r.has(e.id)||(r.add(e.id),e.deps.forEach(e=>{let t=a.get(e);t&&o.push(t)}))}return{nodes:n.filter(e=>r.has(e.id)),hidden:n.filter(e=>!r.has(e.id))}}function Em({view:e}){let{t}=z(),n=e.achievement;return n?(0,J.jsxs)(`section`,{className:`border-b border-ok/35 bg-ok/5 px-5 py-4 animate-appear`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ok`,children:t(`mission.achievement`)}),(0,J.jsx)(`div`,{className:`mt-2 text-sm font-semibold text-ink`,children:n.title}),n.summary?(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:n.summary}):null,(0,J.jsxs)(`div`,{className:`mt-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[t(`mission.elapsed`),` `]}),(0,J.jsx)(`span`,{className:`font-mono text-ink`,children:If(n.elapsed_seconds??0)})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-1 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{children:t(`mission.rejectedAttempts`,{count:n.rejected_attempts??0})}),(0,J.jsx)(`span`,{children:t(`mission.skillsLearned`,{count:n.skills_learned??0})}),(0,J.jsx)(`span`,{children:t(`mission.artifacts`,{count:n.artifacts??0})})]})]}):null}function Dm({view:e,sid:t=``,snapshot:n,artifacts:r=[],onOpenArtifact:i,onOpenDelivery:a,gitDiff:o,onNotify:s,onAsk:c,connected:l=!0,events:u=[]}){let{locale:d,t:f}=z(),p=(0,G.useMemo)(()=>({...e,role_work:e.role_work.map(e=>({...e,detail:qc(e.detail,d).text}))}),[d,e]),m=new Map(e.roles.map(e=>[e.role,e])),h=!!n?.daemon.alive||e.dag.length>0||e.roles.some(e=>![``,`idle`,`waiting`].includes(e.status)),g=e.dag.find(e=>[`running`,`in_progress`,`claimed`].includes(e.status)),_=Tm(e),v=_.nodes,y=n?ai(n,e,u):null,b=y?[`running`,`waiting`].includes(y.state):!1,x=d===`zh-CN`,S=Ff(e.mission.objective||e.mission.title||(b?x?`正在处理你的请求`:`Working on your request`:e.artifacts.length?x?`已完成,成果在下方`:`Completed; results below`:f(`mission.waiting`))),[C,w]=(0,G.useState)(b);(0,G.useEffect)(()=>{b&&w(!0)},[b]);let T=e.mission.final_output?.trim()||``,E=!!(T&&T!==e.mission.summary.trim()),[D,O]=(0,G.useState)(Math.max(0,e.timeline.length-1)),[k,A]=(0,G.useState)(e.active_role||`planner`),[j,M]=(0,G.useState)(g?.id||``),[ee,N]=(0,G.useState)(!1),P=e.delivery,F=(()=>{if(!P)return!1;let t=e=>e.replace(/\s+/g,``).slice(0,80),n=t(e.mission.summary||``),r=t(P.summary||P.title||``);return!!(n&&r)&&(n.startsWith(r)||r.startsWith(n))})(),te=new Map(r.map(e=>[e.path,e])),ne=e.learned_skills.filter(e=>e.status===`active`),re=e.learned_wiki_pages.filter(e=>e.status!==`retired`),ie=!!(e.storage.project_skill_dir||e.storage.global_skill_dir||e.storage.wiki_paths.length||e.storage.skill_history_compressed||e.storage.wiki_retired_compressed),I=!!(ne.length||re.length||ie),L=e.mission.status.toLowerCase(),ae=n?ai(n,e,u):null,oe=ae?ae.state===`running`:[`working`,`grounding`,`framed`].includes(L),se=[`degraded`,`red`,`critical`].includes(e.health?.toLowerCase()??``),ce=[`failed`,`error`].includes(e.mission.status.toLowerCase()),le=e.dag.some(t=>t.status.toLowerCase()===`failed`&&(t.id===e.mission.id||!e.mission.id&&!oe&&!g)),ue=ae?.state===`paused`||[`hold`,`paused`].includes(e.stage.id.toLowerCase()),de=e.outcome.execution_status?.toLowerCase()===`failed`&&e.stage.id.toLowerCase()===`delivery`,fe=se||de||ce||le||ue,pe=se?`mission.attentionHealth`:de?`mission.deliveryFailed`:ce?`mission.attentionFailed`:le?`mission.attentionStepFailed`:`mission.attentionPaused`,me=e.role_work.filter(t=>gm.includes(t.status.toLowerCase())&&(!e.mission.id||(t.item_id||t.mission_id)===e.mission.id)).sort((e,t)=>t.ts-e.ts),he=me.find(t=>t.role===e.active_role)??me[0],ge=_m.includes(L),_e=zn(e.outcome,f)[0]??In(e.mission.status,f),ve=l?ae?.state===`paused`||ae?.state===`unknown`?ui(ae,d):fe?f(pe):ge?[f(`mission.statusDone`,{outcome:_e,elapsed:If(e.mission.elapsed_seconds)}),ae?.state===`waiting`?ui(ae,d):``].filter(Boolean).join(` `):ae?ui(ae,d):oe&&he?f(`mission.statusActive`,{role:Ln(e.active_role||he.role,f),work:he.title}):f(`mission.statusWaiting`):d===`zh-CN`?`实时连接已断开,以下是已收到的记录。`:`Live connection lost; these are the records already received.`,ye=l?se||de||ce||le?`error`:ue||ae?.state===`waiting`?`waiting`:ge?`done`:oe&&he?`active`:`waiting`:`waiting`,be=String(e.outcome.execution_status||``).toLowerCase(),xe=ge&&![`completed`,`done`,`success`].includes(be),Se=ge&&!xe&&e.outcome.review_status===`done`&&e.review.status===`done`?qc(e.review.reason,d).text.trim():``,Ce=Se||e.mission.summary,we=[...e.timeline].reverse().find(t=>t.cause&&t.detail&&(!e.mission.id||t.item_id===e.mission.id)&&(!e.mission.started_at||t.ts>=e.mission.started_at)),Te=we?qc(we.detail,d,{cause:we.cause,technical:we.technical,language:e.language}):[`skipped`,`blocked`,`rejected`,`continue`].includes(String(e.review.status||``).toLowerCase())?qc(e.review.reason,d):null,Ee=String(e.outcome.interruption_kind||``).toLowerCase(),De=fe||xe,Oe=De?Te?.text||(Ee&&Ee!==`none`?Nc(Ee,d):``):``,ke=ae?.reason===`operator_input`?f(`mission.nextAfterReply`):De&&e.outcome.resumable?f(n?.daemon.alive?`mission.nextResumeLive`:`mission.nextResume`):``;(0,G.useEffect)(()=>O(Math.max(0,e.timeline.length-1)),[e.timeline.length]),(0,G.useEffect)(()=>{g?.id&&M(g.id)},[g?.id]);let Ae=async()=>{if(!ee){N(!0);try{await R.setContinuous(t,!0,n?.continuous?.objective??``),s?.(`success`,f(`sidebar.resumeSuccess`))}catch(e){s?.(`error`,f(`sidebar.resumeFailed`,{error:xt(e)}))}finally{N(!1)}}},je=e.timeline.slice(0,D+1).slice(-12).reverse(),Me=e.dag.find(e=>e.id===j);if(n&&l&&n.daemon.read_status!==`error`&&!h&&!fe&&[``,`idle`,`waiting`].includes(L)&&!n.backlog.length&&!e.role_work.length&&!e.timeline.length&&!e.mission.summary&&!E&&!P&&!e.artifacts.length&&!I&&!r.some(e=>e.exists)&&!(o?.available&&(o.status||o.diff))){let e=d===`zh-CN`,t=n.session.objective?.trim();return(0,J.jsx)(`section`,{className:`min-h-0 flex-1 overflow-y-auto bg-panel px-5 py-8 scroll-thin`,"aria-label":f(`mission.control`),"data-testid":`project-ready`,children:(0,J.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold text-ink`,children:e?`还没有安排执行任务`:`No work has been assigned yet`}),t?(0,J.jsx)(`div`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:(0,J.jsx)(H,{children:t})}):null,(0,J.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`在下方告诉 Manager 你想完成什么,也可以直接询问这个项目的进展。`:`Tell the Manager what you want to accomplish below, or ask about this project’s progress.`}),c?(0,J.jsx)(`button`,{type:`button`,className:`mt-4 rounded-lg border border-line px-3 py-2 text-sm text-ink hover:border-blue`,onClick:()=>c(e?`这个项目目前做到了哪一步?有哪些结果,下一步是什么?`:`Where does this project stand? What results do we have, and what comes next?`),children:e?`问 Manager 项目现状`:`Ask the Manager about this project`}):null]})})}return(0,J.jsx)(`section`,{className:`mission-overview min-h-0 flex-1 overflow-x-hidden overflow-y-auto bg-panel scroll-thin`,"aria-label":f(`mission.control`),children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-[960px]`,children:[(0,J.jsxs)(`header`,{className:`px-5 pb-6 pt-7 sm:px-8`,children:[(0,J.jsx)(`div`,{role:`heading`,"aria-level":1,className:`mt-1 line-clamp-4 max-w-4xl text-xl font-semibold leading-snug text-ink`,title:S,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:S})}),S.length>600?(0,J.jsxs)(`details`,{className:`mt-2 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer hover:text-ink`,children:f(`mission.showObjective`)}),(0,J.jsx)(`div`,{className:`mt-2 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:S})})]}):null,(0,J.jsxs)(`div`,{className:`mission-status-line`,"data-tone":ye,role:fe?`alert`:`status`,children:[(0,J.jsxs)(`div`,{className:`mission-status-line__signal`,children:[(0,J.jsx)(`span`,{className:`mission-status-line__marker`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:ve})]}),e.frontier.change?(0,J.jsx)(`div`,{className:`mission-status-line__subtitle`,children:e.frontier.change}):null,Oe?(0,J.jsx)(`p`,{className:`mt-1.5 pl-[1.125rem] text-sm leading-relaxed text-ink-dim`,title:Te?.technical||void 0,children:Oe}):null,ke?(0,J.jsx)(`p`,{className:`mt-1 pl-[1.125rem] text-sm leading-relaxed text-ink-dim`,children:ke}):null]}),oe&&he?.detail?(0,J.jsx)(`div`,{className:`mt-4 text-sm text-ink-dim`,children:(0,J.jsx)(Cm,{detail:qc(he.detail,d).text,previewLength:ym,textClassName:`leading-6`})}):null,Ce||E?(0,J.jsxs)(`div`,{className:`mt-5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1 text-sm font-semibold text-ink`,children:Se?d===`zh-CN`?`验收结果`:`Review result`:f(P&&F?P.kind===`submission_certified`?`mission.deliveryCertified`:`mission.taskCompleted`:xe?`mission.lastProgress`:`mission.summary`)}),P&&F&&a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(P),title:P.primary_target?te.get(P.primary_target.path)?.storage_path||P.primary_target.path:P.title,className:`shrink-0 rounded-md bg-ink px-3 py-2 text-sm font-medium text-surface hover:opacity-80`,children:f(P.primary_target?`mission.openResult`:`mission.viewTask`)}):null]}),(0,J.jsx)(`div`,{className:`mt-3 whitespace-pre-wrap text-sm leading-7 text-ink-dim`,"data-testid":`mission-result-summary`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:Ce})}),Se&&e.mission.summary&&Se!==e.mission.summary?(0,J.jsxs)(`details`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer`,children:d===`zh-CN`?`执行者记录`:`Execution note`}),(0,J.jsx)(`div`,{className:`mt-2 text-sm leading-6`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:e.mission.summary})})]}):null,E?(0,J.jsxs)(`details`,{className:`mt-2 border-t border-ok/20 pt-2 text-xs text-ink-dim`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer font-medium text-ok hover:text-ink`,children:f(`mission.showFullOutput`)}),(0,J.jsx)(`div`,{className:`mt-3 break-words text-sm leading-relaxed text-ink`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:T})})]}):null]}):null,P&&!F?(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 rounded border border-ok/30 bg-ok/5 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ok`,children:f(P.kind===`submission_certified`?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,J.jsx)(`div`,{className:`mt-1 truncate text-xs text-ink-dim`,title:P.summary||P.title,children:P.summary||P.title})]}),a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(P),title:P.primary_target?te.get(P.primary_target.path)?.storage_path||P.primary_target.path:P.title,className:`shrink-0 rounded border border-ok/40 px-2 py-1 font-mono text-xs text-ok hover:border-ok`,children:f(P.primary_target?`mission.openResult`:`mission.viewTask`)}):null]}):null]}),e.artifacts.length?(0,J.jsxs)(`section`,{className:`px-5 pb-6 sm:px-8`,"aria-label":d===`zh-CN`?`成果文件`:`Result files`,children:[(0,J.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-ink`,children:d===`zh-CN`?`成果文件`:`Result files`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.artifacts.slice(-8).map(e=>{let t=String(e.path||``),n=te.get(t);return(0,J.jsx)(`button`,{type:`button`,disabled:!t||!i||n?.exists===!1,onClick:()=>t&&i?.(t),title:n?.storage_path||t,className:`rounded-md border border-line px-3 py-2 text-sm text-ink-dim hover:border-ink-faint hover:text-ink disabled:opacity-50`,children:String(e.title||t.split(`/`).at(-1)||f(`research.artifact`))},String(e.id||t))})})]}):null,n?.continuous?.done_at&&(0,J.jsxs)(`div`,{className:`mx-5 mb-6 flex items-center gap-3 border-t border-line/60 py-3 sm:mx-8`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-ink-dim`,children:f(`mission.continuousDone`)}),(0,J.jsx)(`button`,{type:`button`,disabled:ee,onClick:()=>void Ae(),className:`compact-control shrink-0 px-3`,children:ee?`…`:f(`mission.resumeContinuous`)})]}),(0,J.jsxs)(`details`,{className:`mission-detail-records mx-5 mb-8 border-t border-line sm:mx-8`,open:C,onToggle:e=>w(e.currentTarget.open),children:[(0,J.jsxs)(`summary`,{className:`cursor-pointer py-4 text-sm text-ink-dim`,children:[d===`zh-CN`?`执行过程与记录`:`Execution details and records`,e.dag.length?` · ${e.dag.length}`:``]}),(0,J.jsx)(Em,{view:e}),h?(0,J.jsxs)(`section`,{className:`border-b border-line/60 px-5 py-4`,"aria-label":f(`mission.team`),children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.team`)}),(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2 xl:grid-cols-4`,children:et.map(t=>{let n=m.get(t),r=n?.status===`active`,i=n?.status===`rejected`||n?.status===`error`,a=B.role[t]??B.inkFaint,o=n?.label?zc(n.label,d,{kind:n.kind,language:e.language}):``;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>A(t),"aria-pressed":k===t,className:`min-w-0 rounded-r-md border-l-2 py-2 pl-3 text-left transition-colors hover:bg-bg/60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue`,style:{borderColor:k===t||r||n?.status===`done`?a:`rgb(var(--line))`,backgroundColor:k===t?`color-mix(in srgb, ${a} 8%, transparent)`:void 0},children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{"data-role-dot":t,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:a}}),(0,J.jsx)(`span`,{className:`text-xs font-semibold`,style:{color:a},children:Ln(t,f)})]}),(0,J.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm leading-5 ${i?`text-err`:`text-ink-dim`}`,title:o||void 0,children:o||f(`mission.waitingShort`)})]},t)})})]}):null,h?(0,J.jsxs)(`details`,{className:`border-b border-line/60 px-5 py-4`,open:!!n?.daemon.alive,children:[(0,J.jsxs)(`summary`,{className:`flex cursor-pointer flex-wrap items-center justify-between gap-2 list-none`,children:[(0,J.jsxs)(`div`,{className:`text-xs font-medium text-ink-faint`,children:[f(`mission.roleWork`),` · `,(0,J.jsx)(`span`,{style:{color:B.role[k]??B.inkDim},children:Ln(k,f)})]}),Me?(0,J.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`text-xs text-ink-faint hover:text-ink`,children:f(`mission.filteredBy`,{task:Me.title||Me.objective||f(`task.untitled`)})}):(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:f(`mission.allVisible`)})]}),(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(hm,{sid:t,view:p,roles:n?.roles,events:n?.recent_events,taskId:j||void 0,selectedRole:k,showTabs:!1,paused:n?!n.daemon.alive:!1})})]}):null,(0,J.jsxs)(`div`,{className:`grid min-h-[320px] border-b border-line/60 lg:grid-cols-[minmax(0,1.15fr)_minmax(260px,0.85fr)]`,children:[(0,J.jsxs)(`section`,{className:`min-w-0 border-b border-line/60 px-5 py-4 lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.researchDag`)}),g?(0,J.jsxs)(`span`,{className:`max-w-48 truncate text-xs text-blue-sky`,children:[f(`mission.active`),` · `,g.title]}):null]}),(0,J.jsxs)(`div`,{className:`mt-3 space-y-0`,children:[_.hidden.length?(0,J.jsx)(`div`,{className:`mb-3 rounded border border-line/60 bg-bg/50 px-3 py-2 text-xs text-ink-faint`,children:f(`mission.hiddenTasks`,{count:_.hidden.length,failed:_.hidden.filter(e=>[`failed`,`blocked`].includes(e.status)).length,skipped:_.hidden.filter(e=>e.status===`skipped`).length})}):null,v.length?v.map((e,t)=>{let n=e.id===g?.id,r=[`done`,`completed`].includes(e.status),i=[`failed`,`blocked`].includes(e.status);return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>M(e.id),className:`relative flex w-full min-w-0 gap-3 pb-3 text-left last:pb-0 ${j===e.id?`bg-white/[0.03]`:``}`,children:[t(0,J.jsx)(`li`,{children:e},e))})]}):null]}):null]}),(0,J.jsxs)(`section`,{className:`min-w-0 px-5 py-4`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.capabilities`)}),ne.length?(0,J.jsxs)(`div`,{className:`mt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-ok`,children:f(`mission.capabilitiesUnlocked`)}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:ne.slice(-8).map(e=>(0,J.jsxs)(`details`,{className:`rounded border border-ok/35 bg-ok/5 px-2 py-1.5`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-xs text-ok`,children:String(e.name||f(`mission.learnedCapability`))}),e.mission_title?(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-faint`,children:f(`mission.learnedDuring`,{mission:e.mission_title})}):null,e.content?(0,J.jsxs)(`pre`,{className:`mt-2 max-h-64 overflow-auto whitespace-pre-wrap border-t border-ok/20 pt-2 font-mono text-xs leading-5 text-ink-dim scroll-thin`,children:[e.content,e.content_truncated?`\n… ${f(`mission.contentTruncated`)}`:``]}):(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-faint`,children:f(`mission.skillUnavailable`)})]},String(e.id)))})]}):null,re.length?(0,J.jsxs)(`div`,{className:`mt-4 border-t border-line/50 pt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-blue-sky`,children:f(`mission.knowledgeRetained`)}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:re.slice(-6).map(e=>(0,J.jsx)(`span`,{className:`rounded border border-blue/35 bg-blue/5 px-2 py-1 text-xs text-blue-sky`,children:String(e.title||e.id)},String(e.id)))})]}):null,ie?(0,J.jsxs)(`div`,{className:`mt-4 border-t border-line/50 pt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-ink-faint`,children:f(`mission.selfEvolution`)}),(0,J.jsx)(`div`,{className:`mt-2 text-sm text-ink-dim`,children:f(`mission.knowledgeSaved`)})]}):null,I?null:(0,J.jsx)(`div`,{className:`py-10 text-center text-xs text-ink-faint`,children:f(`mission.noCapabilities`)})]})]}),(0,J.jsxs)(`section`,{className:`px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.replay`)}),e.timeline.length>1?(0,J.jsx)(`input`,{type:`range`,min:0,max:e.timeline.length-1,value:D,onChange:e=>O(Number(e.target.value)),"aria-label":f(`mission.replayTimeline`),className:`h-1 min-w-32 flex-1 accent-blue`}):null,je.length?(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:f(je.length===1?`mission.showingLatestEvent`:`mission.showingLastEvents`,{count:je.length})}):null]}),(0,J.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[je.map(t=>{let n=new Date(t.ts*1e3),r=B.role[t.role]??B.inkFaint,i=xm(t)&&!t.kind?f(`mission.roleFailed`,{role:bm(t.role,f)}):zc(t.title,d,{kind:t.kind,language:e.language}),a=qc(t.detail.trim()===e.mission.summary.trim()?``:t.detail,d,{cause:t.cause,technical:t.technical,language:e.language});return(0,J.jsxs)(`article`,{className:`rounded border border-line/60 bg-bg/35 px-3 py-2.5 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1.5 h-2 w-2 shrink-0 rounded-full ${t.tone===`error`?`bg-err`:t.tone===`success`||t.tone===`metric`||t.tone===`skill`?`bg-ok`:`bg-blue`}`}),(0,J.jsx)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 text-xs font-medium`,style:{borderColor:r,color:r},children:bm(t.role,f)}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 break-words font-medium leading-5 text-ink`,children:i}),(0,J.jsx)(`time`,{dateTime:n.toISOString(),title:n.toLocaleString(d,{dateStyle:`medium`,timeStyle:`short`}),className:`shrink-0 font-mono text-xs text-ink-faint`,children:Sm(t.ts,d)})]}),a.text?(0,J.jsx)(Cm,{detail:a.text,technical:a.technical,previewLength:ym,textClassName:`leading-5 text-ink-dim`}):null]},t.id)}),e.timeline.length?null:(0,J.jsx)(`div`,{className:`py-10 text-center text-xs text-ink-faint`,children:f(`mission.waitingEvents`)})]}),o?.available&&(o.status||o.diff)?(0,J.jsxs)(`div`,{className:`mt-5 border-t border-line/50 pt-4 text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-[0.14em]`,children:f(`mission.projectFilesChanged`)}),(0,J.jsxs)(`span`,{children:[` · `,f(`mission.reviewInIde`)]})]}):null]})]})]})})}function Om(e){let t=Math.ceil(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}var km={available:`bg-ok/10 text-ok`,absent:`bg-bg text-ink-faint`,inaccessible:`bg-warn/10 text-warn`,degraded:`bg-warn/10 text-warn`};function Am({status:e,error:t}){let{t:n}=z();return(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:n(`resource.title`)}),e?(0,J.jsx)(`span`,{className:`rounded px-2 py-1 text-[10px] font-semibold uppercase ${e.enforcement===`strict`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:Vn(e.enforcement,n)}):null]}),t?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-err`,children:t}):null,!e&&!t?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:n(`resource.loading`)}):null,e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.accelerators.map(e=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:Bn(e.kind,n)}),(0,J.jsxs)(`span`,{className:`rounded px-2 py-0.5 text-[10px] font-medium ${km[e.status]}`,children:[In(e.status,n),` · `,n(`resource.devices`,{count:e.device_count})]})]}),e.detail?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:e.detail}):null]},e.kind))}),(0,J.jsxs)(`div`,{className:`mt-4 grid gap-4 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.inUse`,{count:e.holders.length})}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.holders.length===0?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.holders.map((e,t)=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.devices`,{count:e.device_count})}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:Om(e.ttl_seconds)})})]}),(0,J.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)}),e.yield_requests.map((e,t)=>(0,J.jsxs)(`div`,{className:`mt-2 border-l-2 border-warn/50 pl-2 text-ink-faint`,children:[(0,J.jsx)(`div`,{children:n(`resource.yieldRequest`,{reason:e.reason})}),e.response?(0,J.jsxs)(`div`,{children:[Hn(e.response.decision,n),` · `,e.response.reason]}):null]},t))]},`${e.project}:${e.task_id}:${t}`))})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.queue`,{count:e.queue.length})}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.queue.length===0?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.queue.map(e=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.queuePosition`,{position:e.position})}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:Om(e.ttl_seconds)})})]}),(0,J.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)})]},e.position))})]})]})]}):null]})}async function jm(e){let t=await e,n=t&&typeof t==`object`?t:{},r=String(n.command_status??``);if(Number(n.rc??0)!==0||r===`failed`||r===`rejected`)throw Error(String(n.error||`daemon command ${r||`failed`}`));return t}function Mm({open:e,sid:t,snap:r,onClose:i,onChanged:l,onRestored:d,onOpenSkills:f}){let{t:p,locale:h}=z(),[v,b]=(0,G.useState)(`task`),[S,C]=(0,G.useState)(``),[w,E]=(0,G.useState)(r.session.workdir??r.session.cwd??``),[D,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(null),[M,ee]=(0,G.useState)(()=>new Set),[N,P]=(0,G.useState)(null),[F,te]=(0,G.useState)(null),[ne,re]=(0,G.useState)(null),[ie,I]=(0,G.useState)(``),[L,ae]=(0,G.useState)([]),[oe,se]=(0,G.useState)(0),[ce,le]=(0,G.useState)(``),[ue,de]=(0,G.useState)(``),[fe,pe]=(0,G.useState)(`work`),me=e=>ee(t=>t.has(e)?t:new Set([...t,e])),he=e=>j(kd(e,p)),ge=!M.has(`sourceUpdate`);(0,G.useEffect)(()=>{e&&(E(r.session.workdir??r.session.cwd??``),R.metrics().then(P,e=>{Od(e)?me(`metrics`):he(e)}),R.trash().then(e=>{ae(e.entries),se(e.total)},e=>{Od(e)?me(`trash`):he(e)}))},[e,r.session.cwd,r.session.workdir]),(0,G.useEffect)(()=>{if(!e||!ge)return;let t=!1,n=e=>{t||(Od(e)?me(`sourceUpdate`):he(e))},r=async()=>{try{let e=await R.sourceUpdateStatus();t||te(e)}catch(e){n(e)}};R.sourceUpdateStatus().then(async e=>{if(!t&&(te(e),!e.running)){let e=await R.checkSourceUpdate();t||te(e)}}).catch(n);let i=window.setInterval(()=>void r(),1500);return()=>{t=!0,window.clearInterval(i)}},[e,ge]),(0,G.useEffect)(()=>{!e||fe!==`system`||(re(null),I(``),R.resources().then(re,e=>{Od(e)?me(`resources`):I(p(`operations.requestFailed`))}))},[e,fe]);let _e=async(e,t,n)=>{if(!ue){de(e),k(null),j(null);try{let e=await t();n!==null&&k(n?{text:n}:{text:p(`operations.done`),raw:JSON.stringify(e,null,2)}),l()}catch(e){he(e)}finally{de(``)}}},ve=async()=>{let e=S.trim();if(e){if(v===`plan`){await _e(`quick`,async()=>{let n=await R.previewPlan(t,e);return k({text:[...n.steps.map((e,t)=>`${t+1}. ${e.title}${e.detail?` — ${e.detail}`:``}`),...n.notes.map(e=>`Note: ${e}`),...n.error?[`Error: ${n.error}`]:[]].join(` +`)}),n},null);return}await _e(`quick`,v===`task`?()=>R.addTask(t,e):v===`nudge`?()=>R.nudge(t,e):()=>R.note(t,e),`${v} submitted.`),C(``)}},ye=async e=>{await _e(`restore:${e.trash_id}`,async()=>{let t=await R.restoreTrash(e.trash_id);return ae(t=>t.filter(t=>t.trash_id!==e.trash_id)),se(e=>Math.max(0,e-1)),await d(t.sid),t},`Restored ${e.label}.`)},be=r.daemon.alive&&r.daemon.protocol_compatible===!1,xe=r.daemon.alive&&r.daemon.control_available===!1,Se=r.daemon_admission?.running_daemons??[],Ce=v===`task`?m:v===`nudge`?O:v===`note`?T:g,we=p(`operations.action.${v}`),Te=async()=>{await _e(`trash-search`,async()=>{let e=await R.trash(ce);return ae(e.entries),se(e.total),e},null)};return(0,J.jsxs)(dt,{open:e,onClose:()=>!ue&&i(),label:p(`operations.title`),width:`max-w-5xl`,children:[(0,J.jsx)(lt,{title:p(`operations.title`),sub:r.session.display_name||t}),(0,J.jsx)(`div`,{className:`flex gap-1 overflow-x-auto border-b border-line bg-panel px-4 py-2 scroll-thin`,children:[[`work`,p(`operations.work`),m],[`runtime`,p(`operations.runtime`),_],[`system`,p(`operations.system`),c],[`recovery`,p(`operations.recovery`),n]].map(([e,t,n])=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{pe(e),k(null),j(null)},"aria-current":fe===e?`page`:void 0,className:`flex h-8 shrink-0 items-center justify-center gap-2 rounded-md px-3 text-xs font-medium ${fe===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:[(0,J.jsx)(o,{icon:n}),(0,J.jsx)(`span`,{children:t})]},e))}),(0,J.jsxs)(`div`,{className:`grid max-h-[76vh] gap-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid-cols-2`,children:[fe===`work`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.workInput`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:p(`operations.workHint`)}),(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-1 sm:grid-cols-4`,children:[[`task`,m],[`nudge`,O],[`note`,T],[`plan`,g]].map(([e,t])=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>b(e),"aria-pressed":v===e,className:`flex h-9 items-center justify-center gap-2 rounded px-2 text-xs font-medium ${v===e?`bg-blue/10 text-blue`:`bg-bg text-ink-dim hover:text-ink`}`,children:[(0,J.jsx)(o,{icon:t}),(0,J.jsx)(`span`,{children:p(`operations.action.${e}`)})]},e))}),(0,J.jsx)(`textarea`,{value:S,onChange:e=>C(e.target.value),rows:5,placeholder:v===`plan`?p(`operations.planPlaceholder`):p(`operations.actionPlaceholder`,{action:v}),className:`mt-3 w-full resize-y rounded border border-line bg-bg p-3 text-sm text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void ve(),disabled:!!ue||!S.trim(),className:`mt-2 flex h-9 items-center justify-center gap-2 rounded border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:ue===`quick`?`…`:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(o,{icon:Ce}),(0,J.jsx)(`span`,{children:v===`plan`?p(`operations.previewPlan`):p(`operations.submitAction`,{action:we})})]})})]}):null,fe===`runtime`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.runtime`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:p(`operations.runtimeHint`)}),(0,J.jsx)(`label`,{className:`mt-3 block text-[10px] uppercase tracking-wide text-ink-faint`,children:p(`operations.workdir`)}),(0,J.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[(0,J.jsx)(`input`,{value:w,onChange:e=>E(e.target.value),className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`cwd`,()=>R.setWorkdir(t,w),p(`operations.workdirUpdated`)),disabled:!!ue||!w.trim(),title:p(`operations.applyWorkdir`),"aria-label":p(`operations.applyWorkdir`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:y})})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`reset`,()=>R.resetManager(t),`Manager context reset.`),disabled:!!ue,title:p(`operations.resetManager`),"aria-label":p(`operations.resetManager`),className:`flex h-9 w-9 items-center justify-center rounded border border-line text-xs text-ink-dim disabled:opacity-40`,children:(0,J.jsx)(o,{icon:a})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`upgrade`,()=>jm(R.upgradeDaemon(t,r.daemon_commands?.revision)),`Current-release daemon started after safely draining active work.`),disabled:!!ue||xe,title:xe?`Externally supervised daemon cannot be restarted from this Web host`:be?`Upgrade incompatible daemon`:`Restart on current release`,"aria-label":xe?`Externally supervised daemon`:be?`Upgrade incompatible daemon`:`Restart on current release`,className:`flex h-9 w-9 items-center justify-center rounded border text-xs disabled:opacity-40 ${be?`border-err/60 bg-err/10 text-err`:`border-line text-ink-dim`}`,children:(0,J.jsx)(o,{icon:x})})]}),ge?(0,J.jsxs)(`div`,{className:`mt-4 rounded-lg border border-line bg-bg p-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:p(`operations.sourceUpdate`)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold ${F?.state===`failed`?`bg-err/10 text-err`:F?.update_available?`bg-warn/10 text-warn`:F?.update_available===!1?`bg-ok/10 text-ok`:`bg-line text-ink-dim`}`,children:F?.running?p(`operations.updateRunning`):F?.update_available?p(`operations.updateAvailable`):F?.update_available===!1?p(`operations.updateCurrent`):p(`operations.updateChecking`)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:F?.error||F?.message||p(`operations.updateChecking`)}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px] text-ink-dim`,children:[(0,J.jsxs)(`span`,{children:[p(`operations.currentRevision`),`: `,F?.current_revision?.slice(0,12)||`—`]}),(0,J.jsxs)(`span`,{children:[p(`operations.latestRevision`),`: `,F?.upstream_revision?.slice(0,12)||`—`]}),F?.phase&&F.phase!==`complete`&&F.phase!==`idle`?(0,J.jsxs)(`span`,{children:[p(`operations.updatePhase`),`: `,F.phase]}):null]}),F?.running?(0,J.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded bg-line`,children:(0,J.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`})}):null]}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>void _e(`source-update`,async()=>{let e=await R.applySourceUpdate();return te(e),e},null),disabled:!!ue||!!F?.running||F?.can_update===!1,title:F?.can_update===!1?F.error||p(`operations.updateUnavailable`):p(`operations.pullLatest`),"aria-label":p(`operations.pullLatest`),className:`flex h-9 items-center gap-2 rounded border border-blue/50 px-3 text-xs font-medium text-blue disabled:opacity-40`,children:[(0,J.jsx)(o,{icon:u}),(0,J.jsx)(`span`,{children:F?.running?p(`operations.updateRunning`):p(`operations.pullLatest`)})]})]}),F?.restart_required?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-warn`,children:p(`operations.updateRestart`)}):null]}):null,r.daemon.protocol_error?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-err`,children:r.daemon.protocol_error}):null,Se.length?(0,J.jsxs)(`div`,{className:`mt-4`,children:[(0,J.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-ink-faint`,children:p(`operations.replaceSlot`)}),(0,J.jsx)(`div`,{className:`mt-2 space-y-1`,children:Se.map(e=>(0,J.jsxs)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void _e(`replace:${e.id}`,()=>jm(R.replaceDaemon(t,e.id,!!r.continuous?.enabled,r.daemon_commands?.revision)),`Parked ${e.label||e.id} and started this session.`),title:`Replace ${e.label||e.id}`,"aria-label":`Replace ${e.label||e.id}`,className:`flex w-full items-center justify-between rounded border border-line bg-bg px-2 py-1.5 text-left text-xs text-ink-dim disabled:opacity-40`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:e.label||e.id}),(0,J.jsx)(o,{icon:x,className:`ml-2 text-warn`})]},e.id))})]}):null]}):null,fe===`system`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.skills`)}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:h===`zh-CN`?`全局技能对所有任务可用。在技能库中查看各分类与最近更新。`:`Global skills are available to every task. Browse all classes and recent updates in the skill library.`}),(0,J.jsx)(`button`,{type:`button`,onClick:f,className:`mt-3 rounded border border-line px-3 py-2 text-sm text-blue hover:bg-bg`,children:h===`zh-CN`?`打开技能库`:`Open skill library`})]}):null,fe===`system`&&!M.has(`metrics`)?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.metrics`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,J.jsx)(`span`,{className:`rounded px-2 py-1 text-xs font-semibold ${N?.slo?.status===`healthy`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:p(N?N.slo?.status===`healthy`?`operations.slo.healthy`:`operations.slo.degraded`:`operations.slo.loading`)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p(`operations.validationFailures`,{count:N?.event_validation_failures??`—`})})]}),N?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-dim`,children:xd(N).map((e,t)=>(0,J.jsxs)(`span`,{children:[t>0?(0,J.jsx)(`span`,{className:`text-ink-faint`,children:` · `}):null,(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[p(`operations.metric.${e.key}`),` `]}),(0,J.jsx)(`span`,{className:`font-mono tabular-nums text-ink`,children:e.value})]},e.key))}):null,N?(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap rounded bg-bg p-3 font-mono text-[10px] text-ink-dim scroll-thin`,children:JSON.stringify({web:N.web,provider:N.provider},null,2)})}):null]}):null,fe===`system`&&!M.has(`resources`)?(0,J.jsx)(Am,{status:ne,error:ie}):null,fe===`recovery`&&M.has(`trash`)?(0,J.jsx)(`p`,{className:`text-sm text-ink-faint lg:col-span-2`,children:p(`operations.unavailableHere`)}):null,fe===`recovery`&&!M.has(`trash`)?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`h3`,{className:`mr-auto text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:[p(`operations.trash`),` · `,oe]}),(0,J.jsx)(`input`,{value:ce,onChange:e=>le(e.target.value),onKeyDown:e=>{!hu(e)&&e.key===`Enter`&&Te()},placeholder:p(`operations.searchTrash`),className:`h-8 min-w-52 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void Te(),title:p(`operations.searchTrash`),"aria-label":p(`operations.searchTrash`),className:`flex h-8 w-8 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:s})})]}),L.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:L.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded border border-line bg-bg p-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-xs text-ink`,children:e.label}),(0,J.jsx)(`div`,{className:`truncate font-mono text-[10px] text-ink-faint`,children:e.trash_path})]}),(0,J.jsx)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void ye(e),title:`Restore ${e.label}`,"aria-label":`Restore ${e.label}`,className:`flex h-8 w-8 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:n})})]},e.trash_id))}):(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`operations.trashEmpty`)}),oe>L.length?(0,J.jsxs)(`p`,{className:`mt-2 text-[10px] text-ink-faint`,children:[`Showing the newest `,L.length,` matches. Narrow the search to find older sessions.`]}):null]}):null,A?(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-panel p-3 text-sm text-ink-dim lg:col-span-2`,children:[(0,J.jsx)(`p`,{children:A.text}),A.technical?(0,J.jsx)(ft,{label:p(`operations.technicalDetails`),children:(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap font-mono`,children:A.technical})}):null]}):null,D?(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-panel p-3 text-sm text-ink-dim lg:col-span-2`,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:D.text}),D.raw?(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs`,children:D.raw})}):null]}):null]})]})}var Nm=[`handshake.service`,`handshake.project`,`handshake.ready`];function Pm(){let{t:e}=z(),t=(0,G.useRef)(null);return it(t,(e,t)=>{if(t){e.set(`[data-handshake-line], [data-handshake-node]`,{opacity:1,scale:1,clearProps:`transform`});return}e.to(`[data-handshake-mark]`,{scale:1.055,duration:.75,ease:`sine.inOut`,repeat:-1,yoyo:!0,transformOrigin:`50% 50%`}),e.timeline({repeat:-1,repeatDelay:.25}).fromTo(`[data-handshake-line]`,{scaleX:0,opacity:.25,transformOrigin:`0% 50%`},{scaleX:1,opacity:.8,duration:.9,ease:`power2.inOut`}).fromTo(`[data-handshake-node]`,{autoAlpha:.25,scale:.72},{autoAlpha:1,scale:1,duration:.28,stagger:.16,ease:`back.out(1.8)`},.12).to(`[data-handshake-node]`,{autoAlpha:.35,duration:.3,stagger:.08},`+=0.35`)}),(0,J.jsxs)(`div`,{ref:t,role:`status`,"aria-label":e(`handshake.connecting`),className:`w-full max-w-xl px-6 text-center`,children:[(0,J.jsx)(`div`,{"data-handshake-mark":!0,className:`handshake-mark glass-card mx-auto flex h-16 w-16 items-center justify-center rounded-3xl text-blue shadow-glow sm:h-20 sm:w-20`,children:(0,J.jsx)(At,{size:48,className:`text-ink`})}),(0,J.jsxs)(`div`,{className:`relative mx-auto mt-8 h-10 max-w-sm sm:max-w-md`,children:[(0,J.jsx)(`div`,{className:`absolute left-[10%] right-[10%] top-3 h-px bg-line/80`}),(0,J.jsx)(`div`,{"data-handshake-line":!0,className:`handshake-line absolute left-[10%] right-[10%] top-3 h-px`}),(0,J.jsx)(`div`,{className:`relative flex justify-between`,children:Nm.map(t=>(0,J.jsxs)(`div`,{className:`flex w-20 flex-col items-center gap-2.5`,children:[(0,J.jsx)(`span`,{"data-handshake-node":!0,className:`handshake-node h-6 w-6 rounded-full border ring-4 ring-bg`,children:(0,J.jsx)(`span`,{className:`m-auto mt-[7px] block h-2 w-2 rounded-full bg-blue`})}),(0,J.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:e(t)})]},t))})]}),(0,J.jsx)(`p`,{className:`mt-9 text-base font-medium text-ink-dim`,children:e(`handshake.title`)}),(0,J.jsx)(`p`,{className:`mt-1.5 text-sm text-ink-faint`,children:e(`handshake.detail`)})]})}function Fm({loading:e,hasProjects:t,error:n,onRetry:r,onNew:i,onChoose:a,canCreate:o}){let{t:s,locale:c}=z();return(0,J.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-4 px-6 text-center`,children:[e?(0,J.jsx)(Pm,{}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h1`,{className:`text-2xl font-semibold text-ink`,children:c===`zh-CN`?t?`继续你的项目`:`开始一个项目`:t?`Continue your work`:`Start a project`}),(0,J.jsx)(`p`,{className:`max-w-md text-sm leading-relaxed ${n?`text-err`:`text-ink-faint`}`,children:n||s(t?`landing.selectOrCreate`:`landing.noSessions`)})]}),!e&&(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[n?(0,J.jsx)(W,{onClick:r,variant:`danger`,children:s(`common.retry`)}):null,t?(0,J.jsx)(W,{onClick:a,children:s(`landing.select`)}):o?(0,J.jsx)(W,{onClick:i,variant:`primary`,children:s(`landing.new`)}):null,!t&&!n?(0,J.jsx)(`span`,{className:`lg:hidden`,children:(0,J.jsx)(W,{onClick:a,children:s(`landing.menu`)})}):null]})]})}function Im({active:e,onSelect:t,onOpenSessions:n,sidebarOpen:r=!1,onRead:i,onOpenSkills:a}){let{t:s,locale:c}=z(),l=[{id:`map`,label:s(`mobile.map`),icon:g},{id:`activity`,label:s(`mobile.activity`),icon:p},{id:`preview`,label:s(`mobile.preview`),icon:E}];return(0,J.jsxs)(`nav`,{"aria-label":s(`mobile.views`),className:`mobile-tabbar glass-panel glass-panel--raised fixed inset-x-0 bottom-0 z-40 items-stretch border-t border-line/60 lg:hidden ${r?`hidden`:`flex`}`,children:[n?(0,J.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":s(`topbar.openSessions`),className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 text-ink-faint active:bg-panel-raised`,children:[(0,J.jsx)(o,{icon:h,className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`text-[10px] leading-none`,children:s(`mobile.sessions`)})]}):null,l.map(n=>{let r=n.id===e;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-current":r?`page`:void 0,className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 active:bg-panel-raised ${r?`text-blue`:`text-ink-faint`}`,children:[(0,J.jsx)(o,{icon:n.icon,className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`text-[10px] leading-none`,children:n.label})]},n.id)}),(0,J.jsxs)(`details`,{className:`workspace-more mobile-more flex-1`,onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,J.jsxs)(`summary`,{className:`min-h-[3.25rem]`,"aria-current":e===`mission`||e===`workbench`?`page`:void 0,children:[(0,J.jsx)(o,{icon:w,className:`h-4 w-4`}),(0,J.jsx)(`span`,{children:c===`zh-CN`?`更多`:`More`})]}),(0,J.jsxs)(`div`,{className:`workspace-more-menu`,onClick:e=>{e.target.closest(`button`)&&e.currentTarget.closest(`details`)?.removeAttribute(`open`)},children:[a&&(0,J.jsx)(`button`,{type:`button`,onClick:a,children:c===`zh-CN`?`技能库`:`Skill library`}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(`mission`),children:[(0,J.jsx)(o,{icon:p}),s(`mobile.mission`)]}),i?(0,J.jsx)(`button`,{type:`button`,onClick:i,children:c===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}):null,(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(`workbench`),children:[(0,J.jsx)(o,{icon:d}),s(`mobile.workbench`)]})]})]})]})}function Lm(e,t,n){let r=n?.height??t,i=t-r-(n?.offsetTop??0);return{keyboardInset:i>24?Math.round(i):0,compact:e<1024&&r<=600}}function Rm(){let[e,t]=(0,G.useState)(()=>typeof window<`u`&&Lm(window.innerWidth,window.innerHeight,window.visualViewport).compact);return(0,G.useEffect)(()=>{let e=window.visualViewport,n=document.documentElement,r=null,i=()=>{r!=null&&window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let r=Lm(window.innerWidth,window.innerHeight,e);n.style.setProperty(`--keyboard-inset`,`${r.keyboardInset}px`),n.dataset.compactViewport=String(r.compact),t(r.compact)})};return i(),e?.addEventListener(`resize`,i),e?.addEventListener(`scroll`,i),window.addEventListener(`resize`,i),()=>{r!=null&&window.cancelAnimationFrame(r),e?.removeEventListener(`resize`,i),e?.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),n.style.removeProperty(`--keyboard-inset`),delete n.dataset.compactViewport}},[]),e}var zm={[I.LIFE_LIFECYCLE_BLOCK]:`block`,[I.ROUND_REVIEWER_BACKEND_FAILURE]:`block`,[I.LIFE_BUDGET_PAUSE]:`warn`,[I.ROUND_STALL]:`warn`,[I.ROUND_ESCALATED]:`warn`,[I.LIFE_PLANNER_STALL_ESCALATION]:`warn`},Bm=new Set([I.BUDGET_RESERVATION_DENIED,I.BUDGET_UNPRICED_BLOCKED]),Vm=new Set([I.LIFE_MISSION_STARTED,I.ROUND_MAIN_COMPLETED,I.LIFE_MISSION_COMPLETED,I.LOOP_DONE,I.ROUND_START,`ui.operator`]),Hm=new Set([I.BUDGET_RESERVATION_CREATED,I.PROVIDER_REQUEST_STARTED]);function Um(e){let t=ie(e.canonical_type??e.type);if(e.event_validation?.status===`invalid`)return t===I.ROLE_SESSION_TURN?null:{tone:`warn`,kind:`validation`,text:`invalid event ${t||`unknown`}: ${e.event_validation.errors.join(`; `)}`};if(Bm.has(t))return{tone:`block`,kind:`budget`,text:`Budget exhausted or blocked — ${String(e.reason??e.text??t).trim()}`};let n=e.operator_alert===!0?`block`:zm[t];return n?{tone:n,text:String(e.text??e.reason??t).trim()}:null}function Wm(e){let t=null;for(let n of e){let e=ie(n.canonical_type??n.type),r=Um(n);r?t=r:(t?.kind===`validation`||t?.kind===`budget`&&Hm.has(e)||t&&t.kind!==`budget`&&Vm.has(e))&&(t=null)}return t}async function Gm(e,t){let n=Ou(e.trim());if(!n)return{kind:`not-command`};if(!n.cmd){let e=ku(n.name);return{kind:`error`,message:e?`Unknown command ${n.name}. Did you mean ${e}?`:`Unknown command ${n.name}. Use /help for the full list.`}}if(n.cmd.id===`ask`||n.cmd.id===`crystalpilot`)return{kind:`not-command`};if(bu(n.cmd)&&!n.rest)return{kind:`error`,message:`Usage: ${n.cmd.name}${n.cmd.arg?` ${n.cmd.arg}`:``}`};try{await t[n.cmd.id](n.rest)}catch(e){return{kind:`error`,message:e instanceof Error?e.message:String(e??`Command failed`)}}return{kind:`handled`}}function Km({activeSid:e,activityEventsRef:t,notify:n,onClearEvents:r,onDispose:i,onOpenConfig:a,onOpenDoctor:o,onOpenHelp:s,onOpenIdentity:c,onOpenInspector:l,onOpenNewDaemon:u,onOpenOperations:d,onOpenSidebar:f,onOpenSkills:p,onReconnectEvents:m,onRenameProject:h,onRewriteDraft:g,onSelectProject:_,onSetArtifactPath:v,onSetEventFilter:y,onSetEventQuery:b,onSetTaskItemId:x,onSetWorkspaceView:S,onShowArtifacts:C,onStopIteration:w,onStopWaiting:T,refetchSnapshot:E}){return{status:async()=>l(),roles:async()=>d(),journal:async()=>l(),backlog:async()=>S(`mission`),item:async e=>{e&&x(e)},artifacts:async()=>C(),artifact:async e=>{e&&v(e)},events:async e=>{S(`activity`);let{filter:t,query:n}=Du(e);y(t),b(n)},find:async e=>{S(`activity`),y(`all`),b(e)},run:async()=>S(`activity`),clear:async()=>{S(`activity`),y(`all`),b(``),r(t.current.length)},cancel:async()=>T(),task:async t=>{e&&(await R.addTask(e,t),E(),n(`success`,`Task queued.`))},rewrite:async e=>{let t=e.trim();if(!t){n(`info`,`Type your prompt in the composer and press Rewrite, or use /rewrite .`);return}g(t)},plan:async t=>{if(!e)return;let r=await R.previewPlan(e,t);r.error?n(`error`,r.error):n(`info`,r.steps.map(e=>e.title).join(` +`)||`Plan preview ready.`)},nudge:async t=>{e&&(await R.nudge(e,t),n(`success`,`Guidance injected.`))},abort:async t=>{e&&(await R.abortMission(e,t||`operator abort`),n(`info`,`Abort requested.`))},note:async t=>{e&&(await R.note(e,t),n(`success`,`Note appended to timeline.`))},done:async e=>{e&&i(e,`done`)},skip:async e=>{e&&i(e,`rm`)},stop:async e=>{e&&w(e)},new:async()=>u(),daemons:async()=>f(),resume:async e=>{e&&e!==`list`?_(e):f()},attach:async e=>{e&&_(e)},rename:async t=>{!e||!t||await h(t)},doctor:async()=>o(),backend:async t=>{if(!e||!t){a();return}await R.setConfig(e,`runner_backend`,t),n(`success`,`Backend set to ${t}.`)},config:async t=>{if(!e||!t){a();return}let r=t.indexOf(`=`);r>0?(await R.setConfig(e,t.slice(0,r).trim(),t.slice(r+1).trim()),n(`success`,`Config updated.`)):a()},identity:async()=>c(),reset:async()=>{e&&(await R.resetManager(e),n(`success`,`Manager context reset.`))},skills:async t=>{if([``,`ls`,`list`].includes(t.trim().toLowerCase())){p();return}e&&n(`info`,(await R.skills(e,t||`ls`)).slice(0,400))},reconnect:async()=>m(),help:async()=>s(),quit:async()=>n(`info`,`Background work continues; close this browser tab when ready.`)}}function qm(e){return e.kind===`error`?(typeof e.reply==`string`?e.reply.trim():``)||`Manager could not handle this message.`:null}function Jm(e,t){e.kind===`task`&&t.dispatchTask(e);let n=qm(e);n&&t.notifyError(n),t.refetchTranscript()}var Ym={skipFirst:0,reconnectKey:0};function Xm(e,t){return t.kind===`clear`?{...e,skipFirst:Math.max(0,t.offset)}:t.kind===`reconnect`?{skipFirst:0,reconnectKey:e.reconnectKey+1}:{...e,skipFirst:0}}function Zm(e,t){if(!t.length)return e;let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return t?{...e,spend_usd:t.spend_usd,known_cost_usd:t.known_cost_usd,spend_status:t.spend_status,usage_calls:t.usage_calls,premium_requests:t.premium_requests,cost_updated_at:t.updated_at}:e})}async function Qm(e,t,n,r=``){let i=await e.createDaemon(``,t,r),a=n.trim();return{created:i,startCampaign:a?()=>e.setContinuous(i.sid,!0,a):null}}var $m=e=>e instanceof Error?e.message:String(e||`Unknown error`);function eh({localCwd:e,notify:t,onFocusComposer:n,queryClient:r,refetchProjects:i,selectProject:a,translate:o}){let[s,c]=(0,G.useState)(!1),l=(0,G.useRef)(!1);return{createDaemon:async(s,u,d)=>{if(l.current)return!1;l.current=!0,c(!0);try{let{created:c,startCampaign:l}=await Qm(R,s,u,d),f=String(c.workdir||d||``);return r.setQueryData([`projects`],t=>({local_cwd:t?.local_cwd??e,projects:[{id:c.sid,label:s||c.sid,display_name:s,objective:``,launch_cwd:f,workdir:f,last_active:Date.now()/1e3,daemon_alive:!1,daemon_pid:null,uptime_seconds:null},...(t?.projects??[]).filter(e=>e.id!==c.sid)]})),a(c.sid),i(),window.setTimeout(n,0),t(l?`info`:`success`,l?o?o(`new.createdStarting`):`Session created and selected. Campaign is starting in the background.`:o?o(`new.createdIdle`):`Session created and selected.`),l&&l().then(()=>{r.invalidateQueries({queryKey:[`snapshot`,c.sid]}),i(),t(`success`,`Campaign started.`)}).catch(e=>{t(`error`,`Session was created, but the campaign could not start: ${$m(e)}`)}),!0}catch(e){return t(`error`,`Could not create session: ${$m(e)}`),!1}finally{l.current=!1,c(!1)}},creatingDaemon:s}}var th=e=>e instanceof Error?e.message:String(e||`Unknown error`);function nh({actions:e,manageActions:t,manageTargetSid:n,setManageTargetSid:r,activeSid:i,clearProjectSelection:a,continuous:o,notify:s,refetchProjects:c,selectProject:l,setDaemonManageOpen:u}){let d=e.startDaemon.isPending||e.stopDaemon.isPending||e.forceStopDaemon.isPending||t.startDaemon.isPending||t.forceStopDaemon.isPending||t.updateProject.isPending||t.deleteProject.isPending,f=(0,G.useCallback)(e=>({onSuccess:()=>s(`success`,e),onError:e=>s(`error`,th(e))}),[s]),p=(0,G.useCallback)(()=>e.startDaemon.mutate(void 0,f(`Daemon start requested.`)),[f,e.startDaemon]),m=(0,G.useCallback)(()=>e.forceStopDaemon.mutate(void 0,f(`Stop requested; the verified daemon process is being interrupted.`)),[f,e.forceStopDaemon]),h=(0,G.useCallback)(async()=>{try{return await t.startDaemon.mutateAsync(),s(`success`,`Daemon resumed.`),!0}catch(e){return s(`error`,th(e)),!1}},[t.startDaemon,s]),g=(0,G.useCallback)(async()=>{try{return await t.forceStopDaemon.mutateAsync(),await c(),s(`success`,`Daemon stopped. This session can now be deleted.`),!0}catch(e){return s(`error`,th(e)),!1}},[t.forceStopDaemon,s,c]),_=(0,G.useCallback)(async e=>{if(!n)return!1;try{return await t.updateProject.mutateAsync({sid:n,name:e}),s(`success`,`Session name updated.`),!0}catch(e){return s(`error`,th(e)),!1}},[t.updateProject,n,s]),v=(0,G.useCallback)(async()=>{if(!n)return!1;try{let e=n,o=await t.deleteProject.mutateAsync();u(!1),r(null);let d=await c();if(e===i){a(`replace`);let e=Kd(d.data?.projects??[])[0];e&&l(e.id,`replace`)}return s(`success`,o.workdir_preserved?`Session moved to recoverable trash. Files remain in ${o.workdir}.`:`Session moved to recoverable trash.`),!0}catch(e){return s(`error`,th(e)),!1}},[i,a,t.deleteProject,n,s,c,l,u,r]),y=(0,G.useCallback)(e=>{r(e),u(!0)},[u,r]);return{daemonBusy:d,manageDeleteProject:v,manageStopDaemon:g,manageRenameProject:_,manageStartDaemon:h,requestDispose:(0,G.useCallback)((t,n)=>e.disposeBacklog.mutate({id:t,op:n},{onSuccess:()=>s(`success`,n===`done`?`Work marked done.`:`Work removed.`),onError:e=>s(`error`,th(e))}),[e.disposeBacklog,s]),requestManageSession:y,requestStartDaemon:p,requestStopDaemon:m,requestStopIteration:(0,G.useCallback)(t=>e.stopBacklog.mutate(t,{onSuccess:()=>s(`success`,`Iteration stopped.`),onError:e=>s(`error`,th(e))}),[e.stopBacklog,s]),toggleContinuous:(0,G.useCallback)(()=>{if(!o)return;let t=!o.enabled;e.setContinuous.mutate({enabled:t,objective:o.objective},f(t?`Continuous campaign enabled.`:`Continuous campaign stopped.`))},[f,e.setContinuous,o])}}function rh({focusComposer:e,openHelp:t,toggleKiosk:n,togglePalette:r,toggleReasoning:i,toggleSidebarCollapse:a}){(0,G.useEffect)(()=>{let o=o=>{let s=o.target,c=s?.tagName===`INPUT`||s?.tagName===`TEXTAREA`,l=o.metaKey||o.ctrlKey;l&&o.key.toLowerCase()===`k`?(o.preventDefault(),r()):l&&o.key.toLowerCase()===`t`?(o.preventDefault(),i()):l&&o.key===`.`?(o.preventDefault(),n()):l&&o.key.toLowerCase()===`b`?(o.preventDefault(),a()):l&&o.key.toLowerCase()===`j`?(o.preventDefault(),e()):!c&&o.key===`?`?(o.preventDefault(),t()):!c&&o.key===`/`&&(o.preventDefault(),e())};return window.addEventListener(`keydown`,o),()=>window.removeEventListener(`keydown`,o)},[e,t,n,r,i,a])}var ih=e=>e instanceof Error?e.message:String(e||`Unknown error`),ah=`argus.decision.prompted.v1`,oh=()=>{try{return window.sessionStorage.getItem(ah)??``}catch{return``}},sh=e=>{try{window.sessionStorage.setItem(ah,e)}catch{}};function ch({activeSid:e,currentTaskId:t,autoOpen:n=!0,backlog:r,notify:i,pendingQuestions:a,refetchSnapshot:o}){let[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),p=(0,G.useRef)(!1),m=(0,G.useRef)(``),h=(0,G.useMemo)(()=>{let e=(r??[]).map(e=>({...e,operator_decision:e.operator_decision}));return qr(a??[],e,t)},[r,a,t]),g=h[0]??null,_=r!==void 0||a!==void 0,v=s!==null&&s.sid===e,y=v?{...s.card,is_current_task:t&&s.card.kind!==`domain_intake`?s.card.item_id===t:void 0}:g;return(0,G.useEffect)(()=>{if(s&&(s.sid!==e||_&&!l&&!h.some(e=>e.id===s.card.id))&&c(null),!e||!g||!n&&g.kind!==`domain_intake`||v||l)return;let t=`${e}:${g.id}`;m.current!==t&&oh()!==t&&(m.current=t,sh(t),f(``),c({sid:e,card:g}))},[e,n,h,_,g,s,v,l]),{answerPendingReply:async(t,n)=>{if(!(!e||!y||p.current)){p.current=!0,u(!0),f(``);try{let r=y.kind===`domain_intake`?await R.answerDomain(e,y.id,t,n):y.legacy?await R.answerPending(e,y.item_id,n):await R.resolveDecision(e,y.id,t,n);if(r.resolved===!1||`kind`in r&&[`error`,`cancelled`].includes(String(r.kind))){f(String(r.reply||`Could not send answer.`)),await o();return}c(e=>e===s?null:e),await o(),r.daemon&&Number(r.daemon.rc??0)!==0?i(`error`,`Answer queued, but the daemon did not start: ${r.daemon.error||`operator action required`}`):y.kind!==`domain_intake`&&i(`success`,String(r.reply||`Manager delivered your answer to the team.`))}catch(e){f(ih(e)),i(`error`,`Could not send answer: ${ih(e)}`),await o()}finally{p.current=!1,u(!1)}}},pendingReply:y,pendingReplyBusy:l,pendingReplyError:d,pendingReplyOpen:v,setPendingReplyOpen:t=>{f(``),t?e&&g&&c(t=>t?.sid===e?t:{sid:e,card:g}):c(null)}}}var lh=`argus.browser.project.v1`;function uh(){try{return window.sessionStorage.getItem(lh)}catch{return null}}function dh(e){try{e?window.sessionStorage.setItem(lh,e):window.sessionStorage.removeItem(lh)}catch{}}function fh(e,t){let n=new URL(window.location.href);e?n.searchParams.set(`project`,e):n.searchParams.delete(`project`);let r=t===`push`?`pushState`:`replaceState`;window.history[r](window.history.state,``,n.toString())}function ph({cancelActiveMessage:e,notify:t,formatProjectMissing:n,projects:r,projectsError:i,projectsReady:a,queryClient:o,setArtifactPath:s,setSidebarOpen:c,setTaskItemId:l}){let u=(e,t)=>n?n(e,t):t?`Project “${e}” was not found. Switched to ${t}.`:`Project “${e}” was not found. Create a project to continue.`,d=new URLSearchParams(window.location.search),[f,p]=(0,G.useState)(d.get(`project`)||uh()),m=(0,G.useRef)(f),h=(0,G.useRef)(!1);m.current=f;let g=(0,G.useCallback)(t=>{t!==m.current&&(e(),s(null),l(null)),m.current=t,p(t),dh(t)},[e,s,l]),_=(0,G.useCallback)((e,t=`push`)=>{let n=new URLSearchParams(window.location.search).get(`project`);g(e),n!==e&&fh(e,t)},[g]),v=(0,G.useCallback)((e=`replace`)=>{let t=new URLSearchParams(window.location.search).get(`project`);g(null),t!=null&&fh(null,e)},[g]),y=(0,G.useCallback)(e=>{o.prefetchQuery({queryKey:[`snapshot`,e],queryFn:({signal:t})=>R.prefetchSnapshot(e,t),staleTime:3e3})},[o]);return(0,G.useEffect)(()=>{if(!a)return;let e=h.current,n=Yd(r,m.current,e);if(!e&&(h.current=!0,n.id===m.current?dh(n.id):g(n.id),new URLSearchParams(window.location.search).get(`project`)!==n.id&&fh(n.id,`replace`),n.recovered)){let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}},[g,n,t,r,a]),(0,G.useEffect)(()=>{let e=()=>{let e=new URLSearchParams(window.location.search).get(`project`);if(c(!1),!e){g(null);return}if(!a){g(e);return}let n=Jd(r,e);if(g(n.id),n.recovered){fh(n.id,`replace`);let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[g,t,r,a,c]),{activateProject:g,activeSid:a?f&&r.some(e=>e.id===f)?f:null:i?f:null,clearProjectSelection:v,prefetchProject:y,selectProject:_,sid:f,sidRef:m}}var mh={text:``,attachments:[],revision:0};function hh(e){let t=(0,G.useRef)(new Map),n=(0,G.useRef)(new Map),r=(0,G.useRef)(0),i=(0,G.useRef)(!0),[,a]=(0,G.useReducer)(e=>e+1,0);(0,G.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let o=(0,G.useCallback)((e,n)=>{let o={text:n.text,attachments:[...n.attachments],revision:++r.current};return t.current.set(e,o),i.current&&a(),{sid:e,...o}},[]),s=(0,G.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??mh;o(e,{...r,text:typeof n==`function`?n(r.text):n})},[o,e]),c=(0,G.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??mh;o(e,{...r,attachments:typeof n==`function`?n(r.attachments):n})},[o,e]),l=(0,G.useCallback)(e=>{if(!e)return null;let n=t.current.get(e);return n||(n={...mh,attachments:[],revision:++r.current},t.current.set(e,n)),{sid:e,...n,attachments:[...n.attachments]}},[]),u=(0,G.useCallback)(e=>i.current&&t.current.get(e.sid)?.revision===e.revision,[]),d=(0,G.useCallback)((e,t)=>u(e)?o(e.sid,{text:``,attachments:e.attachments.filter(e=>!t.includes(e))}):null,[u,o]),f=(0,G.useCallback)((e,t)=>e.sid!==t.sid||!u(e)?!1:(o(t.sid,t),!0),[u,o]),p=(0,G.useCallback)(e=>{if(!e||n.current.has(e))return null;let t={...l(e),request:++r.current};return n.current.set(e,t),a(),t},[l]),m=(0,G.useCallback)((e,t)=>{if(n.current.get(e.sid)!==e)return!1;n.current.delete(e.sid);let r=u(e);return r&&t!==void 0?o(e.sid,{...e,text:t}):i.current&&a(),r},[u,o]),h=(0,G.useCallback)(e=>{t.current.delete(e),n.current.delete(e),i.current&&a()},[]);return{draft:(e?t.current.get(e):null)??mh,rewriting:!!(e&&n.current.has(e)),setText:s,setAttachments:c,capture:l,consume:d,restore:f,beginRewrite:p,finishRewrite:m,drop:h}}function gh(e,t){if(!t.loadedSid||t.loadedSid!==t.sidRef.current)return null;let n=t.receipts.filter(t=>{let n=Tr(t);return n?.deliveryId===e.deliveryId&&n.title===e.title&&n.summary===e.summary&&(!e.path||Uo(t).some(t=>t.path===e.path))}),r=!!(t.completionId&&t.completionId===e.deliveryId);return n.length+Number(r)===1?t.loadedSid:null}function _h(e){let t=(0,G.useRef)(e);t.current=e;let n=(0,G.useRef)(null),[r,i]=(0,G.useReducer)(e=>e+1,0),a=(0,G.useCallback)(()=>{n.current?.controller.abort(),n.current=null},[]),o=(0,G.useCallback)((e,r)=>{n.current===e&&(a(),t.current.notify(`error`,`Cannot open notification: ${xt(r)}. No other session was used.`))},[a]);return(0,G.useEffect)(()=>{let e=Nr(e=>{a();let r=e.sessionId??gh(e,t.current);if(!r){t.current.notify(`info`,`This older notification cannot be automatically located. Select its session and open the result manually.`);return}if(!br(r)){t.current.notify(`error`,`Cannot open notification: invalid session identity.`);return}let s={payload:e,target:null,phase:`resolving`,controller:new AbortController};n.current=s,t.current.queryClient.fetchQuery({queryKey:[`projects`],queryFn:R.projectIndex,staleTime:0}).then(e=>{if(n.current===s){if(!e.projects.some(e=>e.id===r))throw Error(`the target session is unavailable or no longer accessible`);s.target=r,s.phase=`loading`,t.current.selectProject(r),i()}}).catch(e=>o(s,e))});return window.addEventListener(`popstate`,a),()=>{e(),window.removeEventListener(`popstate`,a),a()}},[a,o]),(0,G.useEffect)(()=>{let e=n.current;if(!e?.target)return;let r=t.current;if(r.sidRef.current!==e.target){a();return}if(e.phase!==`loading`)return;if(r.snapshotError){o(e,r.snapshotError);return}if(r.loadedSid!==e.target)return;e.phase=`opening`;let i=e.payload.path;if(!i){n.current=null,r.noPath(),r.notify(`info`,`Notification session opened. This notification does not identify a file.`);return}R.artifact(e.target,i,e.controller.signal).then(r=>{let a=t.current;if(n.current!==e||a.sidRef.current!==e.target||a.loadedSid!==e.target)return;if(!r.exists||r.path!==i)throw Error(`the target file is unavailable`);n.current=null;let o=a.receipts.find(t=>t.delivery_id===e.payload.deliveryId&&Uo(t).some(e=>e.path===i));o?a.openDelivery(o,i):a.focusPath(i)}).catch(t=>o(e,t))},[e.selectedSid,e.loadedSid,e.snapshotError,r,a,o]),a}function vh(e,t,n){let r=n?t+8:56,i=Math.max(320,e-r-360-8);return Math.max(320,Math.min(840,i,Math.round(e*.45)))}var yh=[`mission`,`activity`,`workbench`,`map`],bh=`argus.workspace.view.v3`;function xh(e){return yh.includes(e)}function Sh(e,t){let n=kt(e);return n==null?t:n===`true`}function Ch(){let e=new URLSearchParams(window.location.search),[t,n]=(0,G.useState)(e.get(`kiosk`)===`1`),[r,i]=(0,G.useState)(()=>Sh(`argus.reasoning.visible.v1`,!1)),[a,o]=(0,G.useState)(()=>{let t=e.get(`view`);if(xh(t))return t;let n=kt(bh);return xh(n)?n:e.get(`kiosk`)===`1`?`map`:`activity`}),s=(0,G.useCallback)(e=>{Ot(bh,e),o(e)},[]),[c,l]=(0,G.useState)(`activity`),[u,d]=(0,G.useState)(()=>Sh(`argus.preview.expanded.v6`,!1)),[f,p]=(0,G.useState)(()=>{let e=Number(kt(`argus.sidebar.width.v2`)||256);return Number.isFinite(e)?Math.max(220,Math.min(400,e)):256}),[m,h]=(0,G.useState)(()=>{let e=Number(kt(`argus.preview.width.v2`)||440);return Number.isFinite(e)?Math.max(320,Math.min(840,e)):440}),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(()=>Sh(`argus.sidebar.expanded.v4`,!0)),{themeMode:b,themeStyle:x,cycleTheme:S}=Mt(),C=(0,G.useRef)(null),w=(0,G.useRef)(null);(0,G.useEffect)(()=>{Ot(`argus.sidebar.expanded.v4`,String(v)),Ot(`argus.preview.expanded.v6`,String(u)),Ot(`argus.sidebar.width.v2`,String(f)),Ot(`argus.preview.width.v2`,String(m))},[v,f,u,m]),(0,G.useEffect)(()=>{Ot(`argus.reasoning.visible.v1`,String(r))},[r]);let T=(0,G.useCallback)(()=>{d(!0),l(`preview`);let e=C.current?.clientWidth??window.innerWidth;if(e>=1024){let t=vh(e,f,v);h(e=>Math.max(e,t))}},[v,f]),E=(0,G.useCallback)((e,t)=>{let n=C.current;if(!n)return;t.preventDefault();let r=n.getBoundingClientRect(),i=e===`left`?f:m;n.dataset.resizing=e,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let a=t=>{if(e===`left`){let e=u?m+8:0,n=Math.max(220,Math.min(400,r.width-e-360-8));i=Math.max(220,Math.min(n,t.clientX-r.left))}else{let e=v?f+8:56,n=Math.max(320,Math.min(840,r.width-e-360-8));i=Math.max(320,Math.min(n,r.right-t.clientX))}w.current??=window.requestAnimationFrame(()=>{n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),w.current=null})},o=()=>{w.current!=null&&window.cancelAnimationFrame(w.current),w.current=null,n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),e===`left`?p(i):h(i),delete n.dataset.resizing,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o,{once:!0}),window.addEventListener(`pointercancel`,o,{once:!0})},[v,f,u,m]);return(0,G.useEffect)(()=>{let e=()=>{if(window.innerWidth<1024||!C.current)return;let e=C.current.clientWidth,t=v?f:56,n=u?m:0,r=(v?8:0)+(u?8:0),i=Math.max(540,e-360-r);if(t+n<=i)return;let a=u?Math.max(320,Math.min(m,i-t)):n,o=v?Math.max(220,Math.min(f,i-a)):t;o+a>i&&u&&(a=Math.max(320,i-o)),v&&p(o),u&&h(a)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[v,f,u,m]),{cycleTheme:S,kiosk:t,leftPanelOpen:v,leftWidth:f,mobileView:c,openPreview:T,resizeSidebar:E,rightPanelOpen:u,rightWidth:m,setKiosk:n,setLeftPanelOpen:y,setLeftWidth:p,setMobileView:l,setRightPanelOpen:d,setRightWidth:h,setShowReasoning:i,setSidebarOpen:_,setWorkspaceView:s,shellRef:C,showReasoning:r,sidebarOpen:g,themeMode:b,themeStyle:x,workspaceView:a}}function wh(e){let t=e.trim();if(!t||/\s/.test(t))return``;if(!t.includes(`?`)&&!t.includes(`://`))return t;try{return new URL(t,window.location.href).searchParams.get(`token`)?.trim()??``}catch{return``}}function Th(e){try{let t=new URL(window.location.href),n=new URL(e.trim(),t);return n.origin===t.origin&&/^\/pair\/[\w-]{32}$/.test(n.pathname)?n.toString():``}catch{return``}}function Eh({error:e,onRetry:t}){let{t:n}=z(),r=de(e),i=e instanceof Te,[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``);return!r&&!i?null:(0,J.jsxs)(`div`,{role:`alert`,className:`fixed left-1/2 top-3 z-[100] flex w-[min(92vw,42rem)] -translate-x-1/2 flex-wrap items-start gap-3 rounded-xl border border-err/50 bg-panel/95 px-4 py-3 text-left text-sm text-ink shadow-xl backdrop-blur`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 font-mono font-bold text-err`,children:`!`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`strong`,{className:`block text-err`,children:n(r?`connection.pairingTitle`:`connection.unreachableTitle`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-ink-dim`,children:n(r?`connection.pairingDetail`:`connection.unreachableDetail`)})]}),r&&!a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`shrink-0 rounded-md border border-blue/45 bg-blue/10 px-2.5 py-1 text-xs font-medium text-blue hover:bg-blue/15`,children:n(`connection.pairAgain`)}):r?null:(0,J.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded-md border border-err/40 px-2.5 py-1 text-xs text-err hover:bg-err/10`,children:n(`common.retry`)}),r&&a?(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=Th(s);if(t){window.location.replace(t);return}let r=wh(s);if(!r){u(n(`connection.pairingInvalid`));return}let i=new URL(window.location.href);i.searchParams.set(`token`,r),window.location.replace(i.toString())},className:`flex w-full basis-full flex-wrap gap-2 pl-7`,children:[(0,J.jsx)(`label`,{className:`sr-only`,htmlFor:`pairing-link`,children:n(`connection.pairingInput`)}),(0,J.jsx)(`input`,{id:`pairing-link`,"data-autofocus":!0,type:`password`,autoComplete:`off`,value:s,onChange:e=>{c(e.target.value),u(``)},placeholder:n(`connection.pairingPlaceholder`),className:`h-9 min-w-0 flex-1 rounded-md border border-line bg-bg px-3 text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`submit`,className:`h-9 rounded-md border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white`,children:n(`connection.connect`)}),l?(0,J.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-err`,children:l}):null]}):null]})}function Dh(e){try{let t=JSON.parse(kt(e)||`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Oh(e,t,n,r=!0){let i=(0,G.useRef)(),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),l=(0,G.useCallback)(t=>{if(!e)return;let n=`argus.delivery.seen.v1:${e}`;Ot(n,JSON.stringify([...new Set([...Dh(n),t])].slice(-80)))},[e]),u=(0,G.useCallback)((t,n)=>{if(!e)return;l(t.delivery_id);let r=Uo(t),i=r.find(e=>e.path===n)?.path||r[0]?.path||null;o({sid:e,receipt:t,path:i}),c(null)},[e,l]);return(0,G.useEffect)(()=>{if(!e||!t)return;let a=n?.delivery_id;if(i.current?.sid!==e){i.current={sid:e,ids:new Set(a?[a]:[])},o(null),c(null);return}!a||i.current.ids.has(a)||!r||(i.current.ids.add(a),n&&Uo(n).length&&!Dh(`argus.delivery.seen.v1:${e}`).includes(a)&&c({sid:e,receipt:n}))},[e,t,n,r]),{selection:a?.sid===e?a:null,open:u,fresh:s?.sid===e?s.receipt:null,dismissFresh:(0,G.useCallback)(()=>c(null),[]),close:(0,G.useCallback)(()=>o(null),[]),selectPath:(0,G.useCallback)(e=>o(t=>t&&{...t,path:e}),[])}}var kh=e({default:()=>Ph}),Ah=0,jh=(0,G.lazy)(async()=>({default:(await Ne(()=>import(`./ResearchWorkbenchPanel-JZm5wBvl.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url)).ResearchWorkbenchPanel})),Mh=(0,G.lazy)(async()=>({default:(await Ne(()=>import(`./MapPanel-RwxFeqjp.js`),__vite__mapDeps([13,1,2,3,4,5,6,7,8,14,10,15,11,16]),import.meta.url)).MapPanel}));function Nh(e,t){let[n,r]=(0,G.useState)(e),i=(0,G.useRef)(e),a=(0,G.useRef)(null),o=(0,G.useRef)(0);return i.current=e,(0,G.useEffect)(()=>{if(e===n)return;let s=o.current+t-Date.now();if(s<=0){o.current=Date.now(),r(e);return}a.current||=setTimeout(()=>{a.current=null,o.current=Date.now(),r(i.current)},s)},[e,n,t]),(0,G.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),n}function Ph(){let{locale:e,t}=z(),n=e=>e instanceof ce?t(`connection.pairingDetail`):xt(e),r=M(),i=Ce(),a=De(),o=(0,G.useMemo)(()=>Kd(Zm(i.data?.projects??[],a.data?.projects??[])),[a.data?.projects,i.data?.projects]),s=i.data?.local_cwd??``,c=[i.error,a.error].find(e=>ze(e)),[l,u]=(0,G.useState)(`none`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(`feed`),h=(0,G.useCallback)(e=>{f(null),m(e),u(`learning`)},[]),g=(0,G.useCallback)((e,t=`recent`)=>{f(e?{kind:`skill`,item:e}:null),m(e?.scope??(t===`recent`?`feed`:t)),u(`learning`)},[]),_=(0,G.useCallback)(e=>{f(e?{kind:`knowledge`,item:e}:null),m(e?.scope===`private`?`global`:e?.scope??`feed`),u(`learning`)},[]),{cycleTheme:v,kiosk:y,leftPanelOpen:b,leftWidth:x,mobileView:S,openPreview:C,resizeSidebar:w,rightPanelOpen:T,rightWidth:E,setKiosk:D,setLeftPanelOpen:O,setLeftWidth:k,setMobileView:A,setRightPanelOpen:j,setRightWidth:ee,setShowReasoning:N,setSidebarOpen:P,setWorkspaceView:F,shellRef:te,showReasoning:re,sidebarOpen:ie,themeMode:I,workspaceView:L}=Ch(),[oe,se]=(0,G.useState)(()=>L===`mission`?`mission`:`activity`),[le,ue]=(0,G.useState)(L===`workbench`);(0,G.useEffect)(()=>{if(L===`workbench`){ue(!0);return}L!==`map`&&se(L)},[L]);let de=Rm(),[fe,pe]=(0,G.useState)(0),[me,he]=(0,G.useState)(0),[ge,ve]=(0,G.useState)(`auto`),[ye,be]=(0,G.useState)(!1),[we,Te]=(0,G.useState)([]),ke=(0,G.useRef)(null),[Me,Ne]=(0,G.useState)([]),[Fe,Ie]=(0,G.useState)(null),[Le,Re]=(0,G.useState)({path:``,token:0}),[Be,Ve]=(0,G.useState)(null),[He,B]=(0,G.useState)(!1),[Ue,We]=(0,G.useState)(null),[Ge,Ke]=(0,G.useState)(null),qe=(0,G.useRef)(!1),Je=(0,G.useRef)(null),Ye=(0,G.useRef)(0),V=(0,G.useRef)(),Xe=(0,G.useRef)({sid:``,completionId:``,view:null,artifacts:[]}),Ze=(0,G.useRef)(()=>void 0),[Qe,$e]=(0,G.useState)(null),[et,tt]=(0,G.useReducer)(Xm,Ym),[rt,H]=(0,G.useState)(`all`),[it,at]=(0,G.useState)(``),ot=(0,G.useCallback)(()=>$e(null),[]),st=(0,G.useCallback)((e,t)=>{$e({id:++Ah,tone:e,message:t})},[]),ct=(0,G.useCallback)(()=>{let e=!!Je.current;return Ye.current+=1,Je.current?.controller.abort(),Je.current=null,be(!1),Ne([]),e},[]),ut=(0,G.useCallback)(()=>{let e=Je.current;if(!e||!ct())return;let n=Ye.current;st(`info`,t(`chat.stoppingReply`)),R.cancelMessage(e.sid,e.serverRequestId).then(e=>{Ye.current===n&&st(`info`,t(e.requested?`chat.stopReplyRequested`:`chat.replyAlreadyFinished`))}).catch(e=>{Ye.current===n&&st(`error`,t(`chat.stopReplyFailed`,{error:xt(e)}))})},[ct,st,t]),{activeSid:U,clearProjectSelection:W,prefetchProject:ft,selectProject:pt,sid:mt,sidRef:ht}=ph({cancelActiveMessage:ct,notify:st,formatProjectMissing:(e,n)=>n?t(`project.missingSwitched`,{requested:e??``,fallback:n}):t(`project.missingCreate`,{requested:e??``}),projects:o,projectsError:i.isError,projectsReady:i.isSuccess,queryClient:r,setArtifactPath:Ie,setSidebarOpen:P,setTaskItemId:Ve}),{draft:{text:gt,attachments:_t},rewriting:vt,setText:yt,setAttachments:bt,capture:St,consume:Ct,restore:wt,beginRewrite:Tt,finishRewrite:Dt,drop:Ot}=hh(mt),kt=(0,G.useCallback)((e,t)=>{Ze.current(),pt(e,t)},[pt]),At=(0,G.useCallback)(e=>{Ze.current(),W(e)},[W]);(0,G.useEffect)(()=>ve(`auto`),[U]),(0,G.useEffect)(()=>{Re(e=>e.path?{path:``,token:e.token+1}:e)},[mt]),(0,G.useEffect)(()=>()=>{Ye.current+=1,Je.current?.controller.abort(),Je.current=null},[]),(0,G.useEffect)(()=>Fr(),[]);let jt=(0,G.useCallback)(e=>{let t=(e||``).trim(),n=ht.current;if(!t||!n)return;let r=Tt(n);r&&R.rewritePrompt(n,t).then(e=>{if(e.error||!e.rewritten.trim()){Dt(r)&&ht.current===n&&st(`error`,`Rewrite failed: ${e.error||`empty rewrite`} — your prompt is unchanged`);return}if(!Dt(r,e.rewritten)||ht.current!==n)return;pe(e=>e+1);let t=e.questions.length?` Manager asks: ${e.questions.join(` · `)}`:``;st(`success`,`Prompt rewritten — review it, then send.${t}`)},e=>{Dt(r)&&ht.current===n&&st(`error`,`Rewrite failed: ${xt(e)} — your prompt is unchanged`)})},[Tt,Dt,st,ht]),{createDaemon:Mt,creatingDaemon:Nt}=eh({localCwd:s,notify:st,onFocusComposer:()=>pe(e=>e+1),queryClient:r,refetchProjects:i.refetch,selectProject:kt,translate:t}),Pt=(0,G.useCallback)(()=>{Mt(``,``,``)},[Mt]),zt=(0,G.useRef)(Pt);zt.current=Pt,(0,G.useEffect)(()=>Pr(()=>zt.current()),[]);let Vt=Se(U),Ht=Se(Ue),K=Vt.data,q=K?.session.id===U?U:null,Ut=K?.continuous,Wt=_e(q,!0),Gt=Pe(q,oe===`mission`),{events:Kt,connected:qt}=Ee(q,et.reconnectKey),Jt=(0,G.useMemo)(()=>Oe(Kt),[Kt]),Yt=(0,G.useMemo)(()=>je(Kt),[Kt]);(0,G.useEffect)(()=>{if(!q||!Jt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`artifacts`,q],exact:!0})},180);return()=>window.clearTimeout(e)},[Jt,q,r]),(0,G.useEffect)(()=>{if(!q||!Yt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`snapshot`,q],exact:!0})},80);return()=>window.clearTimeout(e)},[q,r,Yt]);let Xt=(0,G.useMemo)(()=>Wm(Kt),[Kt]),{query:Zt,events:Qt,status:$t}=Bt(q,oe===`activity`,Kt,we,ke.current),en=q&&K?.manager_requests?.filter(e=>e.status===`running`).at(-1)?.request_id||``,tn=ye||!!en;(0,G.useEffect)(()=>{if(!q)return;let e=Je.current;if(en){e||(Je.current={id:++Ye.current,serverRequestId:en,sid:q,controller:new AbortController,recovered:!0},be(!0));return}e?.recovered&&e.sid===q&&(Je.current=null,be(!1),Ne([]),Zt.refetch())},[en,q,Zt.refetch]);let nn=xe(U,20,l===`inspector`),rn=Nh((0,G.useMemo)(()=>({sid:q,events:Kt,conversation:Qt}),[q,Kt,Qt]),250),an=rn.sid===q?rn.events:[],on=rn.sid===q?rn.conversation:[],sn=(0,G.useMemo)(()=>K?Nf(K,Qt,Wt.data??[]):null,[Qt,Wt.data,K]),{answerPendingReply:cn,pendingReply:ln,pendingReplyBusy:un,pendingReplyError:dn,pendingReplyOpen:fn,setPendingReplyOpen:pn}=ch({activeSid:U,currentTaskId:sn?.mission.id,autoOpen:L!==`map`,backlog:K?.backlog,notify:st,pendingQuestions:K?.pending_questions,refetchSnapshot:Vt.refetch}),mn=K?.daemon.alive&&sn?.routing.vertical===`research`?sn.active_role.startsWith(`reviewer`)?`reviewing`:sn.active_role.startsWith(`engineer`)?`revising`:void 0:void 0,hn=Ko((0,G.useMemo)(()=>du(Qt),[Qt]),sn?.delivery??null,Qt),gn=K?.backlog.some(e=>[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))??!1,_n=Bf(sn)&&!gn&&!K?.continuous?.enabled,vn=q&&_n&&sn?.mission.id?`completion:${q}:${sn.mission.id}`:``;Xe.current={sid:q||``,completionId:vn,view:sn,artifacts:Wt.data??[]};let yn=(0,G.useCallback)(()=>{C()},[C]),bn=(0,G.useCallback)((e,t=!0)=>{let n=e.trim();if(!n){t&&F(`map`);return}if(L===`map`||!Wt.data?.some(e=>e.path===n&&e.exists)){Ie(n);return}j(!0),A(`preview`),Re(e=>({path:n,token:e.token+1}))},[Wt.data,A,j,F,L]),xn=Oh(q,!!K&&!Zt.isPending,hn,!Fe&&!qo(K?.backlog??[],hn?.item_id)),Sn=xn.open,Cn=(0,G.useMemo)(()=>{let e=new Map;for(let t of Qt){let n=t.delivery;n?.delivery_id&&Array.isArray(n.targets)&&e.set(n.delivery_id,n)}for(let t of[sn?.delivery,hn])t&&e.set(t.delivery_id,t);return[...e.values()].filter(e=>Uo(e).length).sort((e,t)=>t.delivered_at-e.delivered_at)},[Qt,sn?.delivery,hn]);(0,G.useEffect)(()=>{q&&hn?.delivery_id&&r.invalidateQueries({queryKey:[`artifacts`,q],exact:!0})},[q,hn?.delivery_id,r]),(0,G.useEffect)(()=>{if(!q)return;let e=V.current;if(!e||e.sid!==q){V.current={sid:q,id:vn||null};return}if(!vn){V.current={sid:q,id:null};return}if(e.id===vn)return;let n=window.setTimeout(()=>{let e=Xe.current;if(e.sid!==q||e.completionId!==vn||!e.view)return;let n=e.view.delivery,r=Gf(e.artifacts),i=wr({completionId:vn,sessionId:q,title:n?.title||e.view.mission.title||t(`mission.taskCompleted`),summary:n?.summary||e.view.mission.summary,path:n?.primary_target?.path||r?.path});i&&Ar(i),V.current={sid:q,id:vn}},500);return()=>window.clearTimeout(n)},[vn,q,t]),Ze.current=_h({selectedSid:mt,loadedSid:q,sidRef:ht,snapshotError:Vt.error,queryClient:r,receipts:Zt.isPending?[]:Cn,completionId:vn,selectProject:e=>{pt(e),P(!1)},openDelivery:Sn,focusPath:e=>{Wt.data?.some(t=>t.path===e&&t.exists)?bn(e):Ie(e)},noPath:()=>{A(`activity`),F(`map`)},notify:st});let wn=(0,G.useRef)(Qt);wn.current=Qt,(0,G.useEffect)(()=>{H(`all`),at(``),Te([]),tt({kind:`reset`})},[q]);let Tn=Ae(U,K?.daemon_commands?.revision),En=Ae(Ue,Ht.data?.daemon_commands?.revision),Dn=(0,G.useCallback)(async e=>{Ke(e);try{await R.startDaemon(e),await i.refetch(),st(`success`,t(`sidebar.resumeSuccess`))}catch(e){st(`error`,t(`sidebar.resumeFailed`,{error:xt(e)}))}finally{Ke(null)}},[st,i,t]),{daemonBusy:On,manageDeleteProject:kn,manageStopDaemon:An,manageRenameProject:jn,manageStartDaemon:Mn,requestDispose:Nn,requestManageSession:Pn,requestStartDaemon:Fn,requestStopDaemon:In,requestStopIteration:Ln,toggleContinuous:Rn}=nh({actions:Tn,manageActions:En,manageTargetSid:Ue,setManageTargetSid:We,activeSid:U,clearProjectSelection:At,continuous:Ut,notify:st,refetchProjects:i.refetch,selectProject:kt,setDaemonManageOpen:B}),zn=(0,G.useCallback)(async e=>{if(!U)return;let t=await Tn.updateProject.mutateAsync({sid:U,name:e});st(`success`,`Renamed to "${t.name}".`)},[Tn.updateProject,U,st]),Bn=(0,G.useMemo)(()=>Km({activeSid:U,activityEventsRef:wn,notify:st,onClearEvents:e=>tt({kind:`clear`,offset:e}),onDispose:Nn,onOpenConfig:()=>u(`config`),onOpenDoctor:()=>u(`doctor`),onOpenHelp:()=>u(`help`),onOpenIdentity:()=>u(`identity`),onOpenInspector:()=>u(`inspector`),onOpenNewDaemon:Pt,onOpenOperations:()=>u(`operations`),onOpenSidebar:()=>P(!0),onOpenSkills:()=>g(void 0,`global`),onReconnectEvents:()=>tt({kind:`reconnect`}),onRenameProject:zn,onRewriteDraft:jt,onSelectProject:kt,onSetArtifactPath:Ie,onSetEventFilter:H,onSetEventQuery:at,onSetTaskItemId:Ve,onSetWorkspaceView:F,onShowArtifacts:yn,onStopIteration:Ln,onStopWaiting:ut,refetchSnapshot:Vt.refetch}),[U,st,yn,g,zn,Nn,Ln,jt,kt,Vt.refetch,ut,F]);rh({focusComposer:()=>pe(e=>e+1),openHelp:()=>u(`help`),toggleKiosk:()=>D(e=>!e),togglePalette:()=>u(e=>e===`palette`?`none`:`palette`),toggleReasoning:()=>N(e=>!e),toggleSidebarCollapse:()=>O(e=>!e)});let Vn=async(e,n=[],i)=>{let a=U;if(!a||a!==ht.current||qe.current||Je.current)return!1;let o=Ye.current;qe.current=!0;let s,c,l;try{if(!n.length){let t=await Gm(e,Bn);if(t.kind===`handled`)return i?.({type:`settled`,outcome:`message`}),!0;if(t.kind===`error`)return st(`error`,t.message),!1}if(ht.current!==a||Ye.current!==o)return!1;s=++Ye.current,c=ne(),l=new AbortController,Je.current={id:s,serverRequestId:c,sid:a,controller:l}}finally{qe.current=!1}let u=()=>{let e=Je.current;return!!(e&&e.id===s&&e.sid===a&&ht.current===a&&!l.signal.aborted)},d=()=>{Je.current?.id===s&&(Je.current=null,be(!1),Ne([]))};be(!0),Ne([]);let f=[];if(n.length)try{let e=await R.uploadAttachments(a,n,l.signal);if(!u())return!1;f=e.attachments.map(e=>({attachment_id:e.attachment_id}))}catch(e){return u()&&(st(`error`,t(`chat.attachmentUploadFailed`,{error:xt(e)})),d()),!1}let p=ke.current===a;ke.current=a,Te(t=>Ft([...p?t:[],Lt(a,s,e)],a,s,[]));let m=(e,t=``,n=`auto`)=>{!u()||typeof e!=`string`||!e.trim()||Te(r=>Rt(r,a,s,e,t,Date.now(),n))},h=e=>{if(!u())return;let t=e.item;typeof t?.id==`string`&&i?.({type:`task`,taskId:t.id});let n=e.daemon&&typeof e.daemon==`object`?e.daemon:null,r=typeof e.reply==`string`?e.reply:null;n?.admission_required?st(`error`,r||`Task queued, but all daemon slots are busy: ${String(n.error||`operator action required`)}`):n&&Number(n.rc??0)!==0?st(`error`,r||`Task queued, but executor did not start: ${String(n.error||`unknown error`)}`):r&&!i&&st(`success`,r),Vt.refetch?.()},g=e=>{u()&&(r.invalidateQueries({queryKey:[`artifacts`,a]}),Jm(e,{dispatchTask:h,notifyError:e=>st(`error`,e),refetchTranscript:()=>{Zt.refetch()}}))};return(async()=>{let t=!1,n=null,r=[];try{try{await R.messageStream(a,e,{onPhase:(e,t,n)=>{if(!u()||n.heartbeat)return;r=zl(r,{label:e,role:t,kind:n.kind,detail:n.detail,heartbeat:n.heartbeat,quietS:n.quietS,tool:n.tool,toolKind:n.toolKind,callId:n.callId,status:n.status,output:n.output}),Ne(r);let i=Hl(r);i.length&&Te(e=>Ft(e,a,s,i,Date.now(),!0))},onDelta:(e,n,r)=>{u()&&(t=!0,m(e,n,r===`append`||r===`snapshot`?r:`auto`))},onDone:e=>{if(!u())return;e.kind!==`error`&&ve(`auto`),r=Bl(r),Ne(r);let t=Gl(e.steps),n=t.length?t:Hl(r,Date.now()/1e3,!0);Te(t=>Ft(t,a,s,n,Date.now(),!1,e.kind===`error`?`failed`:`completed`)),m(e.reply,``,`snapshot`),g(e);let o=e.item;(e.kind!==`task`||typeof o?.id!=`string`)&&i?.({type:`settled`,outcome:e.kind===`error`?`error`:`message`})},onError:e=>{u()&&(n=e)}},{signal:l.signal,attachments:f,routeOverride:ge,requestId:c})}catch(e){u()&&(n=e)}if(!u())return;n&&(st(`error`,Et(n,t)),i?.({type:`settled`,outcome:`error`}))}finally{Te(e=>It(e,s,Date.now(),n&&!l.signal.aborted?`failed`:`stopped`)),l.signal.aborted&&i?.({type:`settled`,outcome:`cancelled`}),d()}})(),!0},Hn=(0,G.useRef)(Vn);Hn.current=Vn;let Un=async(e,t=[],n,r)=>{let i=St(ht.current);if(!i)return!1;if(r?.whileRunning){try{if(!t.length){let n=await Gm(e,Bn);if(n.kind===`error`)return st(`error`,n.message),!1;if(n.kind===`handled`)return Ct(i,t),!0}await R.queueFollowup(i.sid,e,ge)}catch(e){return st(`error`,xt(e)),!1}return Ct(i,t),!0}let a=null,o=!1,s=!t.length&&Ou(e.trim())?.cmd?.id===`rewrite`,c=await Vn(e,t,e=>{e.type===`settled`&&e.outcome===`error`&&(o=!0,a&&wt(a,i)),ht.current===i.sid&&n?.(e)});return c&&!o&&!s&&(a=Ct(i,t)),c},Wn=(0,G.useMemo)(()=>{let n=cd(vu,e=>{Hn.current(e)},e=>{yt(e),pe(e=>e+1)},e),r=[...y?[]:[{id:`new`,label:t(`palette.newDaemon`),hint:`+`,group:t(`palette.view`),run:Pt}],{id:`transcript`,label:t(`palette.openTranscript`),hint:`/transcript`,group:t(`palette.view`),run:()=>u(`transcript`)},{id:`inspector`,label:t(`palette.openProject`),hint:t(`palette.projectHint`),group:t(`palette.view`),run:()=>u(`inspector`)},{id:`operations`,label:t(`palette.openOperations`),hint:t(`palette.operationsHint`),group:t(`palette.view`),run:()=>u(`operations`)},{id:`verticals`,label:t(`verticals.openStore`),hint:t(`verticals.paletteHint`),group:t(`palette.view`),run:()=>u(`verticals`)},{id:`help`,label:t(`help.title`),hint:`?`,group:t(`palette.view`),run:()=>u(`help`)},{id:`reasoning`,label:t(re?`palette.hideReasoning`:`palette.showReasoning`),hint:`⌘T`,group:t(`palette.view`),run:()=>N(e=>!e)},{id:`kiosk`,label:t(y?`palette.exitKiosk`:`palette.enterKiosk`),hint:`⌘.`,group:t(`palette.view`),run:()=>D(e=>!e)}],i=y?[]:[{id:`message`,label:t(`palette.messageArgus`),hint:`/`,group:t(`palette.action`),run:()=>pe(e=>e+1)},...tn?[{id:`cancel-message`,label:t(`palette.stopWaiting`),hint:`Esc`,group:t(`palette.action`),run:ut}]:[],...Ut?[{id:`continuous`,label:Ut.enabled?t(`palette.stopContinuous`):t(`palette.startContinuous`),group:t(`palette.action`),run:Rn}]:[],...K?.daemon.control_available===!1?[]:[K?.daemon.alive?{id:`stop`,label:t(`palette.stopDaemon`),group:t(`palette.action`),run:In}:{id:`start`,label:t(`palette.startDaemon`),group:t(`palette.action`),run:Fn}]],a=o.map(e=>({id:`p-${e.id}`,label:Gd(e)?(e.label||e.display_name||``).trim():e.objective.trim()||t(`sidebar.unnamedSession`),hint:e.daemon_alive?`● ${t(`common.live`)}`:`○`,keywords:`${e.id} ${e.display_name??``} ${e.objective} ${e.daemon_alive?`live running`:`stopped idle`}`,group:t(`palette.project`),run:()=>kt(e.id)}));return[...r,...i,...n,...a]},[o,K?.daemon.alive,y,re,Ut?.enabled,tn,ut,yt,e,t]);return(0,J.jsx)(vs,{sid:U,readOnly:y,children:(0,J.jsxs)(nt,{ref:te,style:{"--sidebar-width":`${x}px`,"--preview-width":`${E}px`},children:[(0,J.jsx)(Eh,{error:c,onRetry:()=>{i.refetch(),a.refetch()}}),xn.fresh&&!xn.selection&&(0,J.jsxs)(`div`,{className:`delivery-toast`,role:`status`,"aria-live":`polite`,children:[(0,J.jsxs)(`span`,{children:[e===`zh-CN`?`新交付:`:`New delivery: `,xn.fresh.title]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>Sn(xn.fresh),children:e===`zh-CN`?`查看`:`Open`}),(0,J.jsx)(`button`,{type:`button`,"aria-label":e===`zh-CN`?`关闭`:`Dismiss`,onClick:xn.dismissFresh,children:`×`})]}),xn.selection&&(0,J.jsx)(gf,{sid:xn.selection.sid,path:xn.selection.path,delivery:xn.selection.receipt,deliveries:Cn,reviewActivity:xn.selection.sid===q?mn:void 0,onSelectDelivery:Sn,onSelectPath:xn.selectPath,onClose:xn.close},`${xn.selection.sid}:${xn.selection.receipt.delivery_id}`),!y&&ie?(0,J.jsx)(`button`,{type:`button`,"aria-label":t(`common.closeSessions`),onClick:()=>P(!1),className:`fixed inset-0 z-30 bg-black/40 lg:hidden`}):null,y?null:(0,J.jsx)($p,{projects:o,activeId:U,activeWork:q?{sessionId:q,status:ai(K,sn,Qt),connected:qt&&!Vt.isError}:void 0,localCwd:s,onSelect:e=>{kt(e),P(!1)},onPrefetch:ft,onManage:Pn,onResume:e=>void Dn(e),resumingId:Ge,onOpenPanel:e=>u(e),onOpenLearning:h,onOpenVerticals:()=>u(`verticals`),onNew:Pt,loading:i.isLoading,creating:Nt,error:i.isError?xt(i.error):void 0,onRetry:()=>void i.refetch(),mobileOpen:ie,collapsed:!b,onToggleCollapse:()=>O(e=>!e),themeMode:I,onCycleTheme:v}),!y&&b?(0,J.jsx)(pm,{label:t(`common.resizeSessions`),value:x,min:220,max:400,onPointerDown:e=>w(`left`,e),onReset:()=>k(256),onNudge:e=>k(t=>Math.max(220,Math.min(400,t+e)))}):null,(0,J.jsx)(`main`,{className:`flex min-w-0 flex-1 overflow-x-hidden`,children:K?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`${S===`activity`?`flex`:`hidden`} ${L===`map`&&!y?`mobile-scroll-region`:``} glass-panel glass-panel--main h-full min-w-0 flex-1 flex-col lg:flex`,children:[(0,J.jsx)(Wd,{sid:q}),L!==`map`&&(0,J.jsx)(xi,{events:Qt,snap:K,streamOk:qt,onStart:Fn,onStop:In,onManage:()=>U&&Pn(U),busy:On,snapshotStale:Vt.isError,readOnly:y,missionView:sn}),(0,J.jsxs)(`nav`,{"aria-label":t(`mobile.views`),className:`hidden h-11 shrink-0 items-center gap-3 border-b border-line/60 px-5 lg:flex`,children:[(0,J.jsxs)(`div`,{className:`workspace-tabs`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`map`),className:`workspace-tab`,"data-selected":L===`map`,children:t(`mobile.map`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`activity`),className:`workspace-tab`,"data-selected":L===`activity`,children:t(`mobile.activity`)})]}),(0,J.jsxs)(`details`,{className:`workspace-more`,onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,J.jsx)(`summary`,{children:L===`mission`?t(`mobile.mission`):L===`workbench`?t(`mobile.workbench`):e===`zh-CN`?`更多`:`More`}),(0,J.jsxs)(`div`,{className:`workspace-more-menu`,onClick:e=>{e.target.closest(`button`)&&e.currentTarget.closest(`details`)?.removeAttribute(`open`)},children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`mission`),children:t(`mobile.mission`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`reading`),children:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`workbench`),children:t(`mobile.workbench`)}),y?null:(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`operations`),children:t(`mission.operations`)})]})]}),(0,J.jsxs)(`button`,{type:`button`,className:`ml-auto px-2 py-1 text-sm text-ink-dim hover:text-ink`,"aria-expanded":T,onClick:()=>{T?(j(!1),A(`activity`)):yn()},children:[e===`zh-CN`?`文件`:`Files`,Wt.data?.length?` · ${Wt.data.filter(e=>e.exists).length}`:``]})]}),!y&&(0,J.jsx)($n,{sid:U,onOpenKnowledge:()=>_(),onOpenSkills:()=>g()}),L===`map`&&(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(`div`,{className:`m-auto text-sm text-ink-faint`,children:t(`common.loading`)}),children:(0,J.jsx)(Mh,{snapshot:K,events:an,managerSteps:Me,draft:gt,onDraftChange:yt,onSend:Un,attachments:_t,onAttachmentsChange:bt,pending:tn,onCancel:ut,focusSignal:fe,readOnly:y,onOpenSettings:()=>u(`config`),currentTaskId:sn?.mission.id,routeOverride:ge,onRouteOverrideChange:ve,conversationEvents:on,connected:qt,artifacts:Wt.data??[],deliveryCount:Cn.length,onOpenDelivery:()=>{let e=Wo(Cn,sn?.routing.vertical||``);e&&Sn(e.receipt,e.path)},onOpenReceipt:Sn,onOpenArtifact:Ie,onAnswer:()=>pn(!0)},K.session.id)}),(0,J.jsxs)(`div`,{className:`${L===`workbench`||L===`map`?`hidden`:`flex`} min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(Ud,{alert:Xt}),oe===`mission`&&sn?(0,J.jsx)(Dm,{events:Qt,connected:qt&&!Vt.isError,view:sn,sid:K.session.id,snapshot:K,gitDiff:Gt.data,artifacts:Wt.data,onOpenArtifact:bn,onOpenDelivery:Sn,onNotify:st,onAsk:y?void 0:e=>{yt(t=>t.trim()?`${t}\n\n${e}`:e),pe(e=>e+1)}}):(0,J.jsx)(`div`,{className:`flex flex-1 flex-col ${de?`min-h-0`:`min-h-[209px] lg:min-h-0`}`,children:(0,J.jsx)(mu,{snapshot:K,missionView:sn,events:Qt,connected:qt&&!Vt.isError,showReasoning:re,onToggleReasoning:()=>N(e=>!e),historyStatus:$t,historyRefreshing:Zt.isFetching,onRetryHistory:()=>void Zt.refetch(),embedded:!0,filter:rt,query:it,skipFirst:et.skipFirst,artifacts:Wt.data,onOpenArtifact:bn,onOpenDelivery:Sn},q)}),y?null:(0,J.jsx)(`div`,{className:`composer-dock shrink-0 px-4 pt-3`,children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-full lg:max-w-[61.8vw]`,children:[(0,J.jsx)(Vd,{questions:K.pending_questions??[],backlog:K.backlog,currentTaskId:sn?.mission.id,onAnswer:()=>pn(!0)}),(0,J.jsx)(sd,{value:gt,attachments:_t,onAttachmentsChange:bt,onChange:yt,onSend:Un,onCancel:ut,disabled:!U,pending:tn,focusSignal:fe,embedded:!0,onRewrite:jt,rewriting:vt,slashSelection:me,onSlashSelectionChange:he,routeOverride:ge,onRouteOverrideChange:ve,footer:U?(0,J.jsx)(Rr,{sid:K.session.id,roles:K.roles,running:K.daemon.alive||!!K.manager_requests?.length,lastCall:K.last_call,onOpenSettings:()=>u(`config`)}):void 0},U||`no-session`)]})})]}),le&&U?(0,J.jsx)(`div`,{className:`${L===`workbench`?`flex`:`hidden`} min-h-0 flex-1`,children:(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-xs text-ink-faint`,children:t(`common.loading`)}),children:(0,J.jsx)(jh,{sid:U,active:L===`workbench`})})}):null]}),T&&L!==`map`?(0,J.jsx)(pm,{label:t(`common.resizePreview`),value:E,min:320,max:840,onPointerDown:e=>w(`right`,e),onReset:()=>ee(440),onNudge:e=>ee(t=>Math.max(320,Math.min(840,t-e)))}):null,(T&&L!==`map`||S===`preview`)&&(0,J.jsxs)(`aside`,{"data-resizable-panel":`right`,className:`${S===`preview`?`flex`:`hidden`} relative min-w-0 flex-1 flex-col overflow-hidden border-l border-line/60 bg-panel lg:flex lg:flex-none lg:w-[var(--preview-width)]`,children:[(0,J.jsx)(`div`,{className:`lg:hidden`,children:(0,J.jsx)(xi,{events:Qt,snap:K,streamOk:qt,onStart:Fn,onStop:In,onManage:()=>U&&Pn(U),busy:On,snapshotStale:Vt.isError,readOnly:y,missionView:sn})}),(0,J.jsx)(Zf,{snapshot:K,connected:qt&&!Vt.isError,sid:q,artifacts:Wt.data,error:Wt.isError,onExpand:Ie,onOpenFile:yn,className:`min-h-0 flex-1 mobile-scroll-region`,embedded:!0,onCollapse:()=>{j(!1),A(`activity`)},missionView:sn,activityEvents:Qt,requestedPath:Le.path,requestedPathToken:Le.token,routeVisible:L!==`mission`})]})]}):(0,J.jsx)(Fm,{loading:i.isLoading||!!(U&&Vt.isLoading),hasProjects:o.length>0,error:i.isError&&o.length===0?n(i.error):Vt.isError&&!K?n(Vt.error):void 0,onRetry:()=>{i.refetch(),U&&Vt.refetch()},onNew:Pt,onChoose:()=>P(!0),canCreate:!y})}),(0,J.jsx)(dt,{open:l===`learning`,onClose:()=>u(`none`),label:e===`zh-CN`?`技能库`:`Skill library`,width:`max-w-6xl`,children:l===`learning`&&(0,J.jsx)(dr,{sid:U,initialSelection:d,initialScope:p,projectNames:Object.fromEntries(o.flatMap(e=>e.display_name?[[e.id,e.display_name]]:[]))})}),(0,J.jsxs)(dt,{open:l===`reading`,onClose:()=>u(`none`),label:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`,children:[(0,J.jsx)(lt,{title:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}),l===`reading`&&K&&sn?.mission.id&&U?(0,J.jsxs)(J.Fragment,{children:[ae()===`question-foundation`?(0,J.jsx)(_f,{sid:U,objective:K.session.objective,readOnly:y,onOpenArtifact:Ie}):null,(0,J.jsx)(Vs,{sid:U,snapshot:K,view:sn,active:!0,readOnly:y,onOpenArtifact:Ie,onAsk:e=>{yt(t=>t.trim()?`${t}\n\n${e}`:e),pe(e=>e+1),u(`none`)}},U),(0,J.jsx)(`div`,{className:`px-4 pb-4`,children:(0,J.jsx)(gs,{})})]}):(0,J.jsx)(`p`,{className:`px-6 pb-6 text-sm text-ink-dim`,children:e===`zh-CN`?`开始任务后,可以在这里查看说明和依据。`:`Task explanations and evidence appear here once work begins.`})]}),(0,J.jsx)(ud,{open:l===`palette`,onClose:()=>u(`none`),items:Wn}),(0,J.jsx)(Xp,{open:l===`verticals`,onClose:()=>u(`none`)}),(0,J.jsx)(fd,{open:l===`help`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Id,{sid:U,open:l===`doctor`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Ld,{sid:U,open:l===`config`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Rd,{sid:U,open:l===`identity`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(zd,{sid:U,open:l===`transcript`,onClose:()=>u(`none`)}),U&&K?(0,J.jsx)(lm,{open:l===`inspector`,snap:K,journal:nn.data??[],busy:Tn.disposeBacklog.isPending||Tn.stopBacklog.isPending,onClose:()=>u(`none`),onDispose:Nn,onStop:Ln,onInspect:Ve}):null,U&&K?(0,J.jsx)(Mm,{open:l===`operations`,onOpenSkills:()=>g(void 0,`global`),sid:U,snap:K,onClose:()=>u(`none`),onChanged:()=>{Vt.refetch(),i.refetch()},onRestored:async e=>{await i.refetch(),kt(e)}}):null,(0,J.jsx)(gf,{sid:U,path:Fe,artifacts:Wt.data??[],reviewActivity:U===q?mn:void 0,onSelectPath:Ie,onClose:()=>Ie(null)}),(0,J.jsx)(fm,{sid:U,itemId:Be,onClose:()=>Ve(null),onDone:e=>Nn(e,`done`),onSkip:e=>Nn(e,`rm`),onStop:Ln,busy:Tn.disposeBacklog.isPending||Tn.stopBacklog.isPending,readOnly:y}),(0,J.jsx)(Hd,{reply:ln,open:fn,busy:un,error:dn,onClose:()=>pn(!1),onSubmit:cn}),Ue?(0,J.jsx)($f,{open:He,sid:Ue,name:Ht.data?.session.display_name||o.find(e=>e.id===Ue)?.display_name||o.find(e=>e.id===Ue)?.label||``,alive:Ht.data?.daemon.alive??!!o.find(e=>e.id===Ue)?.daemon_alive,controlAvailable:Ht.data?.daemon.control_available!==!1,busy:On,onClose:()=>{B(!1),We(null)},onRename:jn,onStart:Mn,onStop:An,onDelete:async()=>{let e=Ue,t=await kn();return t&&e&&Ot(e),t}}):null,(0,J.jsx)(Qf,{notice:Qe,onClose:ot}),K&&!y?(0,J.jsx)(Im,{active:S===`preview`?`preview`:L,sidebarOpen:ie,onSelect:e=>{if(e===`preview`){A(`preview`);return}A(`activity`),F(e)},onOpenSessions:()=>P(!0),onRead:()=>u(`reading`),onOpenSkills:()=>g()}):null]})})}export{Ni as $,po as A,qt as At,pa as B,wo as C,an as Ct,yo as D,Qt as Dt,xo as E,tn as Et,Za as F,Ga as G,Ka as H,eo as I,ra as J,da as K,io as L,Ya as M,Ut as Mt,Qa as N,Ht as Nt,vo as O,Xt as Ot,$a as P,Ei as Q,to as R,To as S,sn as St,bo as T,nn as Tt,_a as U,Fa as V,ba as W,ia as X,na as Y,Si as Z,Hc as _,zr as _t,Vd as a,Bi as at,ys as b,mn as bt,Gu as c,Li as ct,td as d,Ph as default,yi as dt,Ji as et,hu as f,ti as ft,qc as g,Yr as gt,Uc as h,ui as ht,ef as i,ji as it,fo as j,Kt as jt,uo as k,Jt as kt,Hu as l,Ii as lt,kl as m,ei as mt,hm as n,Ki as nt,ad as o,ki as ot,mu as p,ai as pt,oa as q,hf as r,zi as rt,nd as s,Oi as st,kh as t,Di as tt,Qu as u,qi as ut,jc as v,Rr as vt,Eo as w,rn as wt,Bo as x,ln as xt,zc as y,_n as yt,ro as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/App-d69nDaHg.js b/frontend/web/dist/assets/App-d69nDaHg.js new file mode 100644 index 000000000..44b196fea --- /dev/null +++ b/frontend/web/dist/assets/App-d69nDaHg.js @@ -0,0 +1,53 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ResearchWorkbenchPanel-Cf8TK3Lj.js","./rolldown-runtime-hePW80VL.js","./icons-DRlFT_ri.js","./query-CUzIxVzm.js","./index-DbdG0NfU.js","./markdown-D-35pK1E.js","./markdown-DvoRHisr.css","./index-Diz-_RXt.css","./AppearanceControls-vjVM_spw.js","./code-xml-DMjjpBic.js","./play-utjdE9zp.js","./useWorkbenchTheme-CXN9ftdE.js","./ResearchWorkbenchPanel-BS5QOR9J.css","./MapPanel-Bdo6K37E.js","./history-CBChoFHN.js","./format-DsyV_JEZ.js","./MapPanel-BHNQrOn8.css"])))=>i.map(i=>d[i]); +import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{C as n,D as r,E as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w,v as T,w as E,x as D,y as O}from"./icons-DRlFT_ri.js";import{S as k,a as A,b as j,c as M,i as ee,n as N,r as P}from"./query-CUzIxVzm.js";import{i as F}from"./markdown-D-35pK1E.js";import{A as te,B as ne,C as re,D as ie,E as I,F as L,G as ae,J as oe,K as se,M as ce,N as le,O as ue,P as R,R as de,S as fe,T as pe,V as me,W as he,_ as ge,a as _e,b as ve,c as ye,d as be,f as xe,g as Se,h as Ce,i as we,j as Te,k as z,l as Ee,m as De,n as Oe,o as ke,p as Ae,r as je,s as Me,t as Ne,u as Pe,v as Fe,w as Ie,x as Le,y as Re,z as ze}from"./index-DbdG0NfU.js";import{A as Be,C as Ve,D as He,E as B,F as Ue,I as We,L as Ge,M as Ke,N as qe,O as Je,P as Ye,R as V,S as Xe,T as Ze,_ as Qe,a as $e,b as et,c as tt,d as nt,f as rt,g as H,h as it,i as at,j as ot,k as st,l as ct,m as lt,n as ut,o as U,p as dt,r as W,s as ft,t as pt,u as mt,v as ht,w as gt,x as _t,y as vt}from"./AppearanceControls-vjVM_spw.js";import{a as yt,c as bt,i as xt,l as St,n as Ct,o as wt,r as Tt,s as Et,t as Dt}from"./format-DsyV_JEZ.js";import{a as Ot,i as kt,n as At,r as jt,t as Mt}from"./useWorkbenchTheme-CXN9ftdE.js";var G=t(r(),1),Nt=`local_request_id`,Pt=e=>Array.isArray(e)&&e.length>0;function Ft(e,t,n,r,i=Date.now(),a=!0,o){let s=e.findIndex(e=>e.type===`ui.argus`&&Number(e[Nt])===n);if(s<0)return!r.length&&!a?e:[...e,{type:`ui.argus`,agent_layer:`manager`,text:``,ts:i/1e3,event_id:`local-${t}-${n}-argus`,message_id:`local-${n}-argus`,fragment_mode:`snapshot`,steps:r,live:a,...o?{status:o}:{},[Nt]:n}];let c=[...e];return c[s]={...c[s],...r.length?{steps:r}:{},live:a,...o?{status:o}:{}},c}function It(e,t,n=Date.now(),r=`stopped`){return e.map(e=>{if(e.type!==`ui.argus`||Number(e[Nt])!==t||e.live!==!0)return e;let i=Array.isArray(e.steps)?e.steps.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return t.ended_ts||t.status!==`running`?e:{...t,ended_ts:n/1e3,status:r}}):e.steps;return{...e,live:!1,status:r,...i===void 0?{}:{steps:i}}})}function Lt(e,t,n,r=Date.now()){return{type:`ui.operator`,agent_layer:`operator`,text:n,ts:r/1e3,event_id:`local-${e}-${t}-operator`,message_id:`local-${t}-operator`,[Nt]:t}}function Rt(e,t,n,r,i,a=Date.now(),o=`auto`){let s=r.trim();if(!s)return e;let c=e.findIndex(e=>e.type===`ui.argus`&&Number(e[Nt])===n),l=i.endsWith(`-argus`)?`${i.slice(0,-6)}-operator`:``,u=l?e.map(e=>e.type===`ui.operator`&&Number(e[Nt])===n?{...e,message_id:l}:e):e,d=u.find(e=>e.type===`ui.operator`&&Number(e[Nt])===n),f=d?Math.max(0,a-Number(d.ts??a/1e3)*1e3):0;if(c<0)return[...u,{type:`ui.argus`,agent_layer:`manager`,text:s,ts:a/1e3,event_id:`local-${t}-${n}-argus`,message_id:i||`local-${n}-argus`,fragment_mode:o,response_latency_ms:f,[Nt]:n}];let p=u[c],m=[...u];return m[c]={...p,text:Ie(String(p.text??``),s,o),message_id:i||p.message_id,fragment_mode:o},m}function zt(e,t,n){let r=e.filter(e=>e.type!==`engineer.progress`||e.turn_step!==!0),i=new Map,a=[...r];r.forEach((e,t)=>{let n=String(e.type??``);if(n!==`ui.operator`&&n!==`ui.argus`)return;let r=`${n}\u0000${String(e.text??``)}`;i.set(r,[t,...i.get(r)??[]])});let o=t.map(e=>({type:e.role===`operator`?`ui.operator`:`ui.argus`,agent_layer:e.role===`operator`?`operator`:`manager`,text:e.text,ts:e.ts,message_id:e.message_id||`transcript-${e.ts}-${e.role}`,...e.mission_result===!0?{mission_result:!0}:{},...typeof e.item_id==`string`?{item_id:e.item_id}:{},...typeof e.success==`boolean`?{success:e.success}:{},...typeof e.summary==`string`?{summary:e.summary}:{},...typeof e.delivery_id==`string`?{delivery_id:e.delivery_id}:{},...e.delivery&&typeof e.delivery==`object`?{delivery:e.delivery}:{},...Pt(e.steps)?{steps:e.steps}:{}})),s=Array(o.length).fill(!0);for(let e=o.length-1;e>=0;--e){let n=o[e],r=`${String(n.type)}\u0000${String(n.text??``)}`,c=i.get(r)??[],l=t[e].message_id,u=e=>{let t=a[e];return n.item_id&&t.item_id&&n.item_id!==t.item_id?!1:n.mission_result!==!0&&t.mission_result!==!0||!!(l&&t.message_id===l)||!!(!l&&n.delivery_id&&n.delivery_id===t.delivery_id)},d=c.findIndex(e=>u(e)&&!!(l&&a[e].message_id===l));if(d<0&&(d=c.findIndex(u)),d>=0){s[e]=!1;let[t]=c.splice(d,1),r=a[t];if(l&&r.message_id===l){let e={};for(let t of[`mission_result`,`item_id`,`success`])(r[t]==null||r[t]===``)&&n[t]!=null&&(e[t]=n[t]);a[t]={...r,...e}}}}let c=[...o.filter((e,t)=>s[t]),...a],l=Array(c.length).fill(!0),u=new Set,d=n.map(e=>{let t=String(e.message_id??``),n=t?c.findIndex((e,n)=>!u.has(n)&&String(e.message_id??``)===t):-1,r=Number(e.ts??0);if(n<0&&(n=c.findIndex((t,n)=>{if(u.has(n)||t.type!==e.type||t.text!==e.text)return!1;let i=Number(t.ts??0);return Math.abs(i-r)<=5})),n>=0){u.add(n),l[n]=!1;let t=c[n];return{...e,...t.mission_result===!0?{mission_result:!0}:{},...typeof t.item_id==`string`?{item_id:t.item_id}:{},...typeof t.success==`boolean`?{success:t.success}:{},...typeof t.summary==`string`?{summary:t.summary}:{},...typeof t.delivery_id==`string`?{delivery_id:t.delivery_id}:{},...t.delivery&&typeof t.delivery==`object`?{delivery:t.delivery}:{},...Pt(t.steps)?{steps:t.steps,live:!1}:{}}}return e});return[...c.filter((e,t)=>l[t]),...d].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0))}function Bt(e,t,n,r,i){let a=ge(e,t,120);return{query:a,events:(0,G.useMemo)(()=>e?zt(n,a.data??[],i===e?r:[]):[],[e,n,a.data,r,i]),status:a.isError?`error`:a.isPending?`loading`:`ready`}}var Vt=V(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Ht=V(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),K=V(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),q=V(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Ut=V(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Wt=V(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Gt=V(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Kt=V(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qt=V(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Jt=V(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),Yt=V(`Diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Xt=V(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Zt=V(`FilePenLine`,[[`path`,{d:`m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2`,key:`142zxg`}],[`path`,{d:`M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`2t3380`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),Qt=V(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),$t=V(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),en=V(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),tn=V(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),nn=V(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),rn=V(`Layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),an=V(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),on=V(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),sn=V(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),cn=V(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),ln=V(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),un=V(`Paperclip`,[[`path`,{d:`M13.234 20.252 21 12.3`,key:`1cbrk9`}],[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486`,key:`1pkts6`}]]),dn=V(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),fn=V(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),pn=V(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),mn=V(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),hn=V(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),gn=V(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),_n=V(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),vn=V(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),yn=V(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),bn=V(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),xn={"global/agent-team-lead.md":{title:`多智能体团队协作`,summary:`判断何时值得并行工作,按文件与职责拆分协作,并独立审查汇总结果;不替代原有角色与授权。`,originalName:`Agent Team Lead`,source:`argus/builtin_skills/agent-team-lead.md`,sourceSha256:`b490cc96572941fa4a2fe4937bd3e86c9802c132439ae779fcf8e88241ba9521`},"global/curator/argus-curator-role.md":{title:`团队成果整理`,summary:`维护团队候选成果池和比较记录,归纳后续策略;整理者不代替执行者完成工程任务。`,originalName:`Team Curator`,source:`argus/builtin_skills/curator/argus-curator-role.md`,sourceSha256:`3dfd743254a91f88feef76e85683225dc5b510b7f417f6430ef7b975b8eb0f5b`},"global/engineer/minimal-coding-agent.md":{title:`最小且严谨的软件修改`,summary:`用足够小的改动实现、修复或重构软件与界面,保留既有行为,避免无依据的抽象和新增依赖。`,originalName:`极简而严谨的 Coding Agent`,source:`argus/builtin_skills/engineer/minimal-coding-agent.md`,sourceSha256:`aa47c79252eb5086451530ae25aac77ce87bd4315eda1e9defae2af719295cab`},"global/engineer/pdf-chat.md":{title:`分段阅读 PDF`,summary:`按页或章节阅读并核对版本、页码;图片和版式需查看实际页面,回答只依据相关证据。`,originalName:`Progressive PDF Reading`,source:`argus/builtin_skills/engineer/pdf-chat.md`,sourceSha256:`141bd41eb888191aedc391f0df2ba100ab5aee3e7970f9afc21a6f50f4deca5f`},"global/engineer/presentation-master.md":{title:`可编辑演示文稿`,summary:`使用已有 PPT Master 工具制作或修改可编辑演示文稿和原生 PPT 图,经指定解释器运行并核对导出效果;科研绘图路线由科研垂域决定。`,originalName:`Editable Presentations with PPT Master`,source:`argus/builtin_skills/engineer/presentation-master.md`,sourceSha256:`b9f5ed3935b538a18280ac79a504a3b28b432b66efb884e3e06284b4f1729ff3`},"global/engineer/skill-authoring-guide.md":{title:`编写与审阅技能和 Wiki 页面`,summary:`只在证据表明有可复用做法时写技能;先学操作者材料再忠实编辑;Wiki 更新来自一手来源;审阅者按证据真实、无冗余、不倒退、层级正确来判断一次修改。`,originalName:`Writing and Reviewing Skills and Wiki Pages`,source:`argus/builtin_skills/engineer/skill-authoring-guide.md`,sourceSha256:`cf4073da950ef34a359fa3f4b9c77c9d00ebd56bcb79a678efc3e04197ec7e79`},"global/engineer/web-primary-source-evidence.md":{title:`查证一手网络来源`,summary:`为软件、产品、接口和基准等现实信息寻找并保留一手来源,让重要结论能够追溯。`,originalName:`Web Primary-Source Evidence`,source:`argus/builtin_skills/engineer/web-primary-source-evidence.md`,sourceSha256:`632930eb13afc66ebf4742ab6c87fa586edee916c3eeacef25f50215e78f776f`},"global/manager/evidence-based-stage-decision.md":{title:`经理的职责与阶段决定`,summary:`经理是唯一改变阶段的角色;结合规划和评审证据决定继续、推进、返回或结束,部署始终需要操作者批准。`,originalName:`The Manager's role and stage decisions`,source:`argus/builtin_skills/manager/evidence-based-stage-decision.md`,sourceSha256:`d664fa7b6e92045335da59739575326b89e70d38662c1ffdc79774c599e36817`},"global/performance-profile-ground-truth.md":{title:`真实工作负载性能分析`,summary:`用指定环境和代表性输入定位瓶颈,对照未开启剖析的实测结果;不顺带执行未要求的优化。`,originalName:`Performance Profile Ground Truth`,source:`argus/builtin_skills/performance-profile-ground-truth.md`,sourceSha256:`42430420ce8bd31047780e9b08ac5eab366f849eb222805ca05492779095f4d0`},"global/planner/dependency-aware-task-decomposition.md":{title:`规划者的职责与按依赖拆解任务`,summary:`规划者只读只派、不执行,阶段只由经理改变;把目标与已有证据整理成最小、可执行、有真实依赖且能明确验收的任务集合。`,originalName:`The Planner's role and dependency-aware task decomposition`,source:`argus/builtin_skills/planner/dependency-aware-task-decomposition.md`,sourceSha256:`06d5295c6777a64c90a28a5603884e557a72ad5961b19a3f411dc1e83e331886`},"global/project-venv-package-management.md":{title:`项目环境、依赖与运行前核查`,summary:`使用项目自身的环境与锁文件,只安装任务需要的依赖,在承载论断的运行前只核查它真正用到的资源;不修改 Argus 框架自己的运行环境。`,originalName:`Project Environment and Dependencies`,source:`argus/builtin_skills/project-venv-package-management.md`,sourceSha256:`ab8728ad9fff58e8bc4672e5bc2446135f376b55b52392a6104b2eb52e9ed327`},"global/reviewer/argus-reviewer-role.md":{title:`评审者的职责与给执行者的下一步`,summary:`独立判断执行结果是否成立、需要补充或转向,把检查结果提炼成执行者需要的那一个下一步;评审有争议时以带标签的证据而非角色权威定论,不替执行者作完成声明。`,originalName:`The Reviewer's role`,source:`argus/builtin_skills/reviewer/argus-reviewer-role.md`,sourceSha256:`8457a177a4376eab0e4bef7a652e3276ce3b6f9a0ab421fd15bd96eb057cf852`},"global/reviewer/engineer-process-audit.md":{title:`核对执行过程与证据`,summary:`当成果或验证声明存在争议时检查任务相关回执和日志,区分缺少记录与确实未执行。`,originalName:`Engineer Process Audit`,source:`argus/builtin_skills/reviewer/engineer-process-audit.md`,sourceSha256:`b109fb737e747b863244c9b03e1b23ff82acf724ef420bc547ad457c1cf65ac5`},"global/reviewer/web-source-evidence-audit.md":{title:`审查网络证据是否支撑结论`,summary:`核对实际取得的来源与重要现实信息声明是否一致,不把有链接等同于已经证实。`,originalName:`Web Source-Evidence Audit`,source:`argus/builtin_skills/reviewer/web-source-evidence-audit.md`,sourceSha256:`35dbb6288199c52d4ecfd4e241a54346f5ef8af985f50bf24121e687ea9dc22e`},"global/stale-blocker-verification-probe.md":{title:`核实旧阻塞与易变的外部事实`,summary:`用最小且已授权的探针判断记录中的阻塞是否仍然存在;只在决策依赖时核实外部事实,把身份、许可与执行当作三个不同的问题。`,originalName:`Verify a Recorded Blocker or a Changing External Fact`,source:`argus/builtin_skills/stale-blocker-verification-probe.md`,sourceSha256:`3eb5f473bbf1cf482a840e7af3c84bc939a6710b60f84415ad94e6932a9122b3`},"vertical/argus_maintenance/engineer/argus-maintenance-execution.md":{title:`Argus 小范围维护`,summary:`按核心与领域职责检查和简化框架,用小而可复用的修改解决明确问题。`,originalName:`Argus Maintenance`,source:`argus/verticals/argus_maintenance/skills/engineer/argus-maintenance-execution.md`,sourceSha256:`138f9b7e2503c5ce0307e575fa0555a62e1820c559e105d60cc6e31ab9991c0f`},"vertical/argus_maintenance/reviewer/argus-maintenance-review.md":{title:`Argus 维护变更评审`,summary:`核对补丁是否真正简化、复用和解耦,并用验证结果证明行为,而不是只看代码缩短。`,originalName:`Argus Maintenance Review`,source:`argus/verticals/argus_maintenance/skills/reviewer/argus-maintenance-review.md`,sourceSha256:`d6ad0f8eb29d5ca3d5a66fbc7df34de86e42229f15e8e2e22ce601a8ae08c4f8`},"vertical/chemistry/engineer/batteries/battery-identity-and-data-normalization.md":{title:`电池对象与测试数据对齐`,summary:`在循环分析前统一电芯、电极、电解液、测试协议和时间序列身份;不用于分子计算或一般光谱分析。`,originalName:`Battery Cell Identity and Electrochemical Data Normalization`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-identity-and-data-normalization.md`,sourceSha256:`d1cfc1cb94cf4e4828fcd2b75fb0f1dc57181208f2fad1f19c343a9d169462e6`},"vertical/chemistry/engineer/batteries/battery-model-validation.md":{title:`电池模型与退化解释验证`,summary:`用防止数据泄漏的实测电芯数据验证预测和退化解释,明确模型边界;不把预测当作实测。`,originalName:`Battery Model Boundary and Degradation Validation`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-model-validation.md`,sourceSha256:`fe4ec1ec78ec21dd0d568b71276c2f85e13b6216d5a7770f5f75d09baabc6d27`},"vertical/chemistry/engineer/batteries/cycling-and-degradation-analysis.md":{title:`电池循环与退化分析`,summary:`分析循环、倍率、阻抗和退化轨迹,保留电芯与协议对照,并避免评估数据泄漏。`,originalName:`Battery Cycling and Degradation Analysis Workflow`,source:`argus/domains/chemistry/skills/engineer/batteries/cycling-and-degradation-analysis.md`,sourceSha256:`3e0870b82fbc40463f81ca8eb1e84576c9fe1ae5fe501da6d2b274535fd16d2e`},"vertical/chemistry/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md":{title:`生化结合与功能实验分析`,summary:`分析亲和力、动力学、抑制和功能证据,核对构建体、辅因子、状态与实验对照;对接结果不能单独证明活性。`,originalName:`Biochemical Binding, Kinetics, and Functional Assay Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md`,sourceSha256:`12d235a655a1b6b6022a84a5c36e3c291df6227cb40bd2dc78f19012deff62e5`},"vertical/chemistry/engineer/biochemistry/biochemistry-structural-computational-evidence.md":{title:`生化结构与模拟的证据边界`,summary:`把结构、分子对接、动力学和突变结果作为待验证假设,结合真实实验边界解释,不直接宣称亲和力成立。`,originalName:`Biochemistry Structural, Docking, and MD Evidence Boundary Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-structural-computational-evidence.md`,sourceSha256:`47283774a89fa87050fd35df791c961dce37588ec9c92c9d4e357d59a9f14d6c`},"vertical/chemistry/engineer/biochemistry/biochemistry-system-and-assay-normalization.md":{title:`生化体系与实验对象对齐`,summary:`统一序列、构建体、分子状态、配体、辅因子、突变、结构和实验身份,再开展比较。`,originalName:`Biochemistry and Chemical Biology System Identity Normalization`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-system-and-assay-normalization.md`,sourceSha256:`9b7d80ae04064e9a1b5465dc1fee60f5511491694aaa20e423ae92779ad12ee5`},"vertical/chemistry/engineer/characterization/characterization-data-and-sample-normalization.md":{title:`表征样品与原始数据对齐`,summary:`保留衍射、光谱、质谱、核磁和显微原始数据及仪器信息;不把不同测试方式统一成简单拟峰。`,originalName:`Characterization Sample, Instrument Data, and Metadata Normalization`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-data-and-sample-normalization.md`,sourceSha256:`dad27a33c24c37fdc17a7f7386478246e7847edde9cac4cc2939590ab3e07b9c`},"vertical/chemistry/engineer/characterization/characterization-validation-and-integration.md":{title:`多种表征证据交叉验证`,summary:`综合不同仪器证据时保留各自适用范围和限制,避免跨测试方式作过强推断。`,originalName:`Characterization Validation and Multimodal Evidence Integration`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-validation-and-integration.md`,sourceSha256:`9671988085d6a0127a4739300c9c851e904016f8f17c31fafb676303b7d736c1`},"vertical/chemistry/engineer/characterization/modality-specific-interpretation-workflow.md":{title:`按测试方式解释表征结果`,summary:`依据衍射、光谱、质谱、核磁或显微的具体机制选择对照和模型,不使用一套解释套用全部数据。`,originalName:`Modality-Specific Chemical Characterization Interpretation Workflow`,source:`argus/domains/chemistry/skills/engineer/characterization/modality-specific-interpretation-workflow.md`,sourceSha256:`c09d9f9710e8ee7a72ff7cfd0f04ec741ea792a61a8b8abf56c038c26b126e46`},"vertical/chemistry/engineer/chemistry-execution.md":{title:`化学研究执行指南`,summary:`按任务选择领域流程,核实实际工具能力,保留一手证据并验证科学结论;实体实验仍需明确授权。`,originalName:`Chemistry Research Execution`,source:`argus/domains/chemistry/skills/engineer/chemistry-execution.md`,sourceSha256:`d6ad8b3ae0254319e31de1ca91a7c75fd06c70795d3948b38b8d35b895e69d59`},"vertical/chemistry/engineer/chemistry-toolkit.md":{title:`化学方法与工具导航`,summary:`先选择科学问题对应的方法,再查看具体工具说明;这是导航目录,不是自动安装或执行脚本。`,originalName:`Chemistry Skill and Capability Router`,source:`argus/domains/chemistry/skills/engineer/chemistry-toolkit.md`,sourceSha256:`14840bc5603ce237373ab4832f7bf747c24e6d4ef524eb2ccd112a8bb9eaea70`},"vertical/chemistry/engineer/computational_chemistry/computational-identity-normalization.md":{title:`计算化学对象与输入对齐`,summary:`在量子化学、力场、分子动力学或自由能计算前,统一分子或周期体系的输入与状态。`,originalName:`Computational Chemistry Identity and Input Normalization`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-identity-normalization.md`,sourceSha256:`fd9bebbdc28731a9eeab536279466e3b97c289a49db515f509c713f4b3f0df7b`},"vertical/chemistry/engineer/computational_chemistry/computational-validation-and-interpretation.md":{title:`计算收敛性与结论边界`,summary:`验证数值收敛、模型敏感性和适用范围,区分计算预测与实验测量,不外推为生物活性证明。`,originalName:`Computational Chemistry Convergence and Interpretation Validation`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-validation-and-interpretation.md`,sourceSha256:`ed1bffff26a5cb22ff61c60dcbf3464cbcff0f15200b9d604436bcd6243ab3f7`},"vertical/chemistry/engineer/computational_chemistry/electronic-structure-simulation-workflow.md":{title:`可复现电子结构与分子模拟`,summary:`组织分子或周期体系计算,分别检查方法选择和数值收敛,保留可复现的输入与输出。`,originalName:`Reproducible Electronic-Structure and Molecular Simulation Workflow`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/electronic-structure-simulation-workflow.md`,sourceSha256:`13c5d42ae2f417c7f16665e33f3660fad9f76163be2a08401edd57662ab6f22c`},"vertical/chemistry/engineer/crystallography/cif-and-structure-validation.md":{title:`CIF 与晶体结构检查`,summary:`核对格式、对称性、组成、几何、占位、位移参数和精修证据;不代替从头解结构。`,originalName:`CIF and Crystal Structure Validation`,source:`argus/domains/chemistry/skills/engineer/crystallography/cif-and-structure-validation.md`,sourceSha256:`b49527c827b69b5a37543059faf997fa8d0c9c3f60ed2c0a0e6807ddf5b0e802`},"vertical/chemistry/engineer/crystallography/diffraction-and-crystal-identity.md":{title:`衍射数据与晶体对象对齐`,summary:`核对单晶或粉末衍射的波长、几何、晶胞、对称性、物相及 CIF 来源。`,originalName:`Diffraction and Crystal Structure Identity`,source:`argus/domains/chemistry/skills/engineer/crystallography/diffraction-and-crystal-identity.md`,sourceSha256:`97367c0fad622c1d2ae19868b12a8de571bbc99c282c8b5eec4c4b97ed3615ed`},"vertical/chemistry/engineer/crystallography/structure-solution-and-refinement.md":{title:`晶体结构求解与精修`,summary:`结合数据处理、对称性检验、化学约束、残差和替代解释完成结构求解及精修。`,originalName:`Crystal Structure Solution and Refinement Workflow`,source:`argus/domains/chemistry/skills/engineer/crystallography/structure-solution-and-refinement.md`,sourceSha256:`8f5d913cf3bfc6c421f2d137ece735eba96e3b6840da63d6c4d40c22bc518e08`},"vertical/chemistry/engineer/foundations/chemical-identity-and-representation.md":{title:`化学对象与表达方式核实`,summary:`先核对分子、反应、材料、晶体、样品、序列或配方身份;这是跨领域基础,不替代专门流程。`,originalName:`Chemical Identity and Representation`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-identity-and-representation.md`,sourceSha256:`b1b0f0148ae94a1ad6ad60b6383cc8f6b1596b387d885ca896148486004ac392`},"vertical/chemistry/engineer/foundations/chemical-risk-and-authorization.md":{title:`化学风险与授权边界`,summary:`识别化学、生物、热、电、压力、辐射和仪器风险;文档建议不等于允许开展实体操作。`,originalName:`Chemical Risk and Authorization Boundary`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-risk-and-authorization.md`,sourceSha256:`2d6cb4a8421bb62bbde199f7aa131f5f678019ffbeed231f0676e9095f176b5e`},"vertical/chemistry/engineer/foundations/chemistry-workflow-output-contract.md":{title:`化学任务输入与交付约定`,summary:`明确输入、决策、能力核实、证据、验证方式、输出与停止条件,用于缺少更具体流程的任务。`,originalName:`Chemistry Workflow and Output Contract`,source:`argus/domains/chemistry/skills/engineer/foundations/chemistry-workflow-output-contract.md`,sourceSha256:`1b52c242611bb39cbbe929dc2bee8072e501ab56b23907df50a51c5c0b4f15fd`},"vertical/chemistry/engineer/foundations/computational-reproducibility.md":{title:`化学计算与分析的可复现性`,summary:`保留计算、模拟、数据处理和模型训练的输入、环境、数值设置、诊断与主要输出。`,originalName:`Chemistry Computational Reproducibility`,source:`argus/domains/chemistry/skills/engineer/foundations/computational-reproducibility.md`,sourceSha256:`d92b4a7b6e65c92138ef785a04a47f1fae6ab4ef2e6c4af111264cdc081a0bd8`},"vertical/chemistry/engineer/foundations/dataset-curation-and-leakage.md":{title:`化学数据整理与泄漏控制`,summary:`核对数据来源、去重、分组、标签和划分方式,避免分子、反应或样品间的信息泄漏。`,originalName:`Chemistry Dataset Curation and Leakage Control`,source:`argus/domains/chemistry/skills/engineer/foundations/dataset-curation-and-leakage.md`,sourceSha256:`ceeaf0a929c67df26cc91651721d943749c7e2c3bad6c7978cb78fa085bf948b`},"vertical/chemistry/engineer/foundations/evidence-provenance-and-claim-levels.md":{title:`化学证据来源与结论强度`,summary:`区分检索、整理、预测、计算、模拟、测量与推断,让结论不超出证据能支持的程度。`,originalName:`Chemistry Evidence Provenance and Claim Levels`,source:`argus/domains/chemistry/skills/engineer/foundations/evidence-provenance-and-claim-levels.md`,sourceSha256:`c8b6454e673aae3298d4089c1603b9edfe63c4be7f5f3ad8fd6f24ef2b2910f5`},"vertical/chemistry/engineer/foundations/failure-diagnosis-and-negative-results.md":{title:`化学任务失败与负结果分析`,summary:`保留失败证据,区分实现缺陷、资源问题和科学假设被否定,不把负结果隐去。`,originalName:`Chemistry Failure Diagnosis and Negative Results`,source:`argus/domains/chemistry/skills/engineer/foundations/failure-diagnosis-and-negative-results.md`,sourceSha256:`068cf8400d770fb6c97edbd26d6788adb1acc0e7d6ea00e3b14949c7a9a64a40`},"vertical/chemistry/engineer/foundations/uncertainty-and-applicability-domain.md":{title:`化学结果的不确定性与适用范围`,summary:`判断模型、计算、测量或文献结论能否用于当前实际体系,并量化或说明不确定性。`,originalName:`Chemistry Uncertainty and Applicability Domain`,source:`argus/domains/chemistry/skills/engineer/foundations/uncertainty-and-applicability-domain.md`,sourceSha256:`d552b6cad9e2a942e44a1a4c98647236488186458d3f2cd4bdd395a34c23d8ae`},"vertical/chemistry/engineer/foundations/units-conditions-and-normalization.md":{title:`化学单位与条件规范化`,summary:`比较不同来源前明确单位、计量基础、环境条件、样品归一方式和报告约定。`,originalName:`Chemical Units Conditions and Normalization`,source:`argus/domains/chemistry/skills/engineer/foundations/units-conditions-and-normalization.md`,sourceSha256:`540d6c4a3389900be51e3e9a7bdcf7f16169bb72246d53cbb1fbac247b527cde`},"vertical/chemistry/engineer/materials_science/materials-discovery-and-optimization.md":{title:`材料发现与优化研究`,summary:`限定设计空间、性质目标、基线与不确定性,组织可验证的筛选或工艺优化,不替代晶体精修。`,originalName:`Materials Discovery and Optimization Workflow`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-discovery-and-optimization.md`,sourceSha256:`02d2aeacb74302eb2853345772f5096cce5b26db15ab5d229a210ccfabe04cbd`},"vertical/chemistry/engineer/materials_science/materials-identity-processing-and-property-data.md":{title:`材料组成、工艺与性能数据`,summary:`统一组成、物相、工艺历史、样品形态、微结构和测试条件,建立可比的性能记录。`,originalName:`Materials Identity Processing and Property Data`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-identity-processing-and-property-data.md`,sourceSha256:`ec0ac9c5a4b62eb9d027a97f9c78cc9ed986776e48f9f3bbf94f015a8d689521`},"vertical/chemistry/engineer/materials_science/processing-structure-property-validation.md":{title:`工艺—结构—性能关系验证`,summary:`用可比样品、对照和不确定性检验材料关系声明,保留机理解释的适用边界。`,originalName:`Materials Processing Structure Property Validation`,source:`argus/domains/chemistry/skills/engineer/materials_science/processing-structure-property-validation.md`,sourceSha256:`7c556e48b0b97de122d0f342839c92ece5e33f36c1aa3f7efbcc6fbc319ea06c`},"vertical/chemistry/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md":{title:`MOF 构筑单元与拓扑识别`,summary:`从来源结构核实节点、连接体、连通性、穿插、缺陷、客体和网络拓扑,不以普通 CIF 检查代替。`,originalName:`MOF Framework Identity Node Linker and Topology`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md`,sourceSha256:`7a6490bd8dad40deeb548f03541673b91df2bd9bddbe3e9c8cf58d73b3ee31b8`},"vertical/chemistry/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md":{title:`MOF 数据、预测与结构生成`,summary:`组织拓扑相关去重、泄漏控制、性质预测和生成结构的分阶段验证;生成不等于可合成。`,originalName:`MOF Datasets Prediction and Structure Generation`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md`,sourceSha256:`8f1d023caf19aeb5801036cc58e2531cd8d39bb398008a4b614c654b3073ab51`},"vertical/chemistry/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md":{title:`MOF 孔隙、吸附与性质分析`,summary:`关联原始等温线、活化和样品状态,检查孔隙、吸附、输运模型及不确定性。`,originalName:`MOF Porosity Adsorption and Structure Property Workflow`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md`,sourceSha256:`98088eef9fa108d0f0aa8fab9f746315414cc64edbcfab0d0da8accd4ab83b0b`},"vertical/chemistry/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md":{title:`MOF 合成与后处理证据`,summary:`整理合成、活化、溶剂交换、缺陷调节和后修饰的证据,核对样品关联与表征要求。`,originalName:`MOF Synthesis Activation and Postsynthetic Evidence`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md`,sourceSha256:`b65377f7d995a638f721e8dea34a99807e97c948ec274bbc3f9cc1d35ccf1f5a`},"vertical/chemistry/engineer/organic_synthesis/reaction-identity-and-records.md":{title:`有机反应对象与记录对齐`,summary:`核对反应物、映射、计量、立体化学、条件、后处理和收率,用于路线或数据整理。`,originalName:`Organic Reaction Identity and Records`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/reaction-identity-and-records.md`,sourceSha256:`02221beebf4e39d9bd0e5c4090de61aba6596ceb48fb3a5f29b3e54466999d87`},"vertical/chemistry/engineer/organic_synthesis/retrosynthesis-and-route-design.md":{title:`有机逆合成与路线设计`,summary:`结合目标、断键、已有先例、选择性、供应和安全设计候选路线;候选仍需证据验证。`,originalName:`Organic Retrosynthesis and Route Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/retrosynthesis-and-route-design.md`,sourceSha256:`6ee1e514bf05cc052de12ee39497c783d1dd6ca9549335cbe62e7f2106ec8de4`},"vertical/chemistry/engineer/organic_synthesis/route-validation-and-experiment-design.md":{title:`有机路线验证与实验设计`,summary:`把候选路线转化为有对照、分析读数和停止条件的验证计划;不授权自动开展实体实验。`,originalName:`Organic Route Validation and Experiment Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/route-validation-and-experiment-design.md`,sourceSha256:`9a543fdca5cc4fa3ed0cc9cef2395af55ffaa35758b3c36895a2309d1d09dc80`},"vertical/chemistry/engineer/tools/aizynthfinder.md":{title:`AiZynthFinder 逆合成候选`,summary:`在明确模型、原料库、配置和预算后使用本地搜索生成候选路线;搜索结果不是可行性证明。`,originalName:`AiZynthFinder Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/aizynthfinder.md`,sourceSha256:`fd406198b2a436d954aefb95c1062f945e08cf98806ca7ceaba5d402c006f4dc`},"vertical/chemistry/engineer/tools/askcos.md":{title:`ASKCOS 路线与反应预测`,summary:`仅使用已获授权的部署,记录接口、模型、数据库、预算与结果来源;不假定已有服务权限。`,originalName:`ASKCOS Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/askcos.md`,sourceSha256:`31689603c8f5b80f2ed94a25ef05148edf311287e64bf336fc98fea5aeeaf486`},"vertical/chemistry/engineer/tools/chembl.md":{title:`ChEMBL 生物活性资料检索`,summary:`检索分子、靶点、实验和活性记录,核对版本、单位及来源;已有记录不证明新体系的活性。`,originalName:`ChEMBL Bioactivity Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/chembl.md`,sourceSha256:`9b33111794504afb064302785f66bd7fcbccac9e855d83df0eb84297f00b4863`},"vertical/chemistry/engineer/tools/chemcrow.md":{title:`ChemCrow 工具集成参考`,summary:`研究公开工具集成方式及其依赖、安全和证据要求;架构借鉴不等于复现论文结果。`,originalName:`ChemCrow Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemcrow.md`,sourceSha256:`877388249df2ed635a78ae2edb68b1d25fa2cd5305eec4e09c289fb0f1bd1ba3`},"vertical/chemistry/engineer/tools/chemos.md":{title:`ChemOS 实验室编排参考`,summary:`仅在设备服务、设施归属、安全联锁、数据约定和恢复机制已具备时评估编排能力。`,originalName:`ChemOS Orchestration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemos.md`,sourceSha256:`2dbb97df4b7107f08f00bbdd88fef587eda0b6d3d04e5850b619550e7a9c4cc3`},"vertical/chemistry/engineer/tools/coscientist.md":{title:`Coscientist 系统集成参考`,summary:`依据确切公开实现借鉴组件和架构,保留授权边界;不宣称得到可直接运行的自主实验室。`,originalName:`Coscientist Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/coscientist.md`,sourceSha256:`8a47d850deb1d7dfb2ddeecbea4cba38ceecec129a6e2b2d8ad403e9bbff5252`},"vertical/chemistry/engineer/tools/deepchem.md":{title:`DeepChem 分子机器学习`,summary:`先明确目标、对象、分组、泄漏控制、基线和适用范围,再选择数据、特征、模型与评估工具。`,originalName:`DeepChem Molecular Machine Learning`,source:`argus/domains/chemistry/skills/engineer/tools/deepchem.md`,sourceSha256:`27a9bd06792446cfeeafb63db293fcd8305d59ca3da164810e1267c13e6dcdeb`},"vertical/chemistry/engineer/tools/guacamol.md":{title:`GuacaMol 分子设计基准`,summary:`按确定任务、评分、参考数据、预算和有效性检查评估方法;结论仅限对应基准。`,originalName:`GuacaMol Molecular Design Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/guacamol.md`,sourceSha256:`f626a4b92ec2b081620f5da146f6baebe3b5cc44df824e77fc2becd0b3e87e7e`},"vertical/chemistry/engineer/tools/olympus.md":{title:`Olympus 反应优化基准`,summary:`使用规划器和模拟曲面作有对照的优化研究,明确参数空间、噪声和预算;模拟不等于实体实验。`,originalName:`Olympus Reaction Optimization`,source:`argus/domains/chemistry/skills/engineer/tools/olympus.md`,sourceSha256:`160f357db2ec4527b7368d2b41a2ab43d2ab6b76130e8a27b2a035e0531c4be2`},"vertical/chemistry/engineer/tools/openbabel.md":{title:`Open Babel 化学格式转换`,summary:`转换结构格式并核对解析、氢原子、坐标和互操作性,保留原始身份及转换来源。`,originalName:`Open Babel Structure Conversion`,source:`argus/domains/chemistry/skills/engineer/tools/openbabel.md`,sourceSha256:`6eca4f250101ad817f624a76ca6c22193c73fd67a8d13d76a39bcf07d848fd75`},"vertical/chemistry/engineer/tools/orca.md":{title:`ORCA 量子化学计算`,summary:`在用户提供并授权的安装上计算,记录版本、分子状态、方法、基组、数值设置和主要输出。`,originalName:`ORCA Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/orca.md`,sourceSha256:`683637ad2fb781da58295e67229859794085fb01fcaaa43c10e11e13c8a91085`},"vertical/chemistry/engineer/tools/ord.md":{title:`开放反应数据库读写规范`,summary:`按数据库结构验证反应角色、数量、条件、结果与来源;结构有效不等于实验可复现。`,originalName:`Open Reaction Database I/O`,source:`argus/domains/chemistry/skills/engineer/tools/ord.md`,sourceSha256:`eb81cbde5711e04c578cc89a5b233a3de109c5b68b7322adeefd0996df21b8da`},"vertical/chemistry/engineer/tools/psi4.md":{title:`Psi4 量子化学计算`,summary:`明确分子状态、方法、基组、选项、收敛和单位,保留计算输出来源。`,originalName:`Psi4 Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/psi4.md`,sourceSha256:`2d8bf9817a90f90fe2407d8e4d71e6ffbf431f64207f61b8c2fca8acda199a69`},"vertical/chemistry/engineer/tools/pubchem.md":{title:`PubChem 公共资料检索`,summary:`通过核实的标识和带日期的查询取得公共化合物、性质及安全记录,保留原始响应与来源边界。`,originalName:`PubChem PUG REST Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/pubchem.md`,sourceSha256:`9aa66ea316f8180a29884f78b1ae927adf55f727476fa0529c01e7300161c89e`},"vertical/chemistry/engineer/tools/pyscf.md":{title:`PySCF 电子结构计算`,summary:`先确定电荷、自旋、几何、方法、基组、边界和收敛要求,再组织分子或周期体系计算。`,originalName:`PySCF Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/pyscf.md`,sourceSha256:`9ccb368195807ed7390cf2397506d004f849ccd1c0e1d51532b31e42e579dbc2`},"vertical/chemistry/engineer/tools/rdkit.md":{title:`RDKit 分子数据处理`,summary:`用于解析、规范化、立体化学、子结构、描述符、指纹与构象等处理;不直接证明化学身份或可行性。`,originalName:`RDKit Molecular Integrity`,source:`argus/domains/chemistry/skills/engineer/tools/rdkit.md`,sourceSha256:`b9330a5a8c90fb31bf3b551555d4f439cca90f9ecd45506734ce5051628ee074`},"vertical/chemistry/engineer/tools/tdc.md":{title:`TDC 药物研究数据基准`,summary:`使用明确任务、版本、许可、划分和评估器开展比较,核对污染与证据边界。`,originalName:`Therapeutics Data Commons Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/tdc.md`,sourceSha256:`a1aaed9bff60b1df25ccc8a9846ebcd30784c1f814cb20633e8a5ef57e11decb`},"vertical/chemistry/engineer/workflows/chemistry-playground.md":{title:`受限化学假设试探`,summary:`仅对明确提出的候选问题开展有边界的计算优先试探,保留问题、结果和负证据,并经过评审。`,originalName:`Chemistry Playground Bounded Hypothesis Probe`,source:`argus/domains/chemistry/skills/engineer/workflows/chemistry-playground.md`,sourceSha256:`72326a42543600e3fffedf0562c171466cc25b433cb8c05913e9fcfac3eb2d12`},"vertical/chemistry/manager/chemistry-manager.md":{title:`化学任务协调与分流`,summary:`为科学问题选择专门技能组合,保留原研究阶段、证据强度与授权边界。`,originalName:`Chemistry Manager Context`,source:`argus/domains/chemistry/skills/manager/chemistry-manager.md`,sourceSha256:`ecc7e16be351188d3c6ae75aa0e55c4b3978f1916e67c45754766cb63085f336`},"vertical/chemistry/planner/chemistry-planning.md":{title:`化学研究规划`,summary:`选择最贴合任务的流程,保持证据和安全要求;未完成时才安排具有科学判别力的后续工作。`,originalName:`Chemistry Research Planning`,source:`argus/domains/chemistry/skills/planner/chemistry-planning.md`,sourceSha256:`c9258fa062f3853d7a04950d0e0045b10be65c41c11248d6fe5c981e0ed02e02`},"vertical/chemistry/reviewer/battery-review.md":{title:`电池与电化学证据评审`,summary:`独立核对电芯身份、协议可比性、单位、循环退化证据和防泄漏模型评估。`,originalName:`Battery and Electrochemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/battery-review.md`,sourceSha256:`e0aa8763587e38281b5c2c5b6f7c92b3e07264b1cee076539751de8971d87725`},"vertical/chemistry/reviewer/biochemistry-review.md":{title:`生化与化学生物学评审`,summary:`检查构建体、结构、实验、动力学、模拟和功能声明,保留各自对照与结论边界。`,originalName:`Biochemistry and Chemical Biology Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/biochemistry-review.md`,sourceSha256:`68f2cc57f10d6c9bf30c41c249ebe7fc192b8ac4b763cb6ff40d9a41377135d0`},"vertical/chemistry/reviewer/characterization-review.md":{title:`化学表征证据评审`,summary:`独立核对原始仪器数据、校准、对照、归属和多模态证据,避免用通用解释越过测试边界。`,originalName:`Chemical Characterization Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/characterization-review.md`,sourceSha256:`3ba8858ac408729e78fa27a9338cd6eb435bd64d38da803d837aaec111ef8d67`},"vertical/chemistry/reviewer/chemistry-playground-review.md":{title:`化学试探结果评审`,summary:`检查受限问题与结果、证据和状态历史,防止未经确认的探索被当作正式科学结论。`,originalName:`Chemistry Playground Promotion Gate`,source:`argus/domains/chemistry/skills/reviewer/chemistry-playground-review.md`,sourceSha256:`309f1ff685c93c46c47239d9db1a3b85c41c6c384e986532e774ed3795e8d3c0`},"vertical/chemistry/reviewer/chemistry-review.md":{title:`化学研究综合评审`,summary:`按问题转交专门评审方法,核对对象、原始证据、对照、可复现性、不确定性和安全要求。`,originalName:`Chemistry Research Review`,source:`argus/domains/chemistry/skills/reviewer/chemistry-review.md`,sourceSha256:`bc2587f915788c94f8de55a0f2947a18e7bd368cccf1b400d1479e1681c64cf7`},"vertical/chemistry/reviewer/computational-review.md":{title:`计算化学证据评审`,summary:`审查输入身份、数值收敛、方法有效性,以及计算结果和测量结果之间的界线。`,originalName:`Computational Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/computational-review.md`,sourceSha256:`cab134d61ce5d45bf0240d2219eca03002e7b6315c4abf3738c2740229353e68`},"vertical/chemistry/reviewer/crystallography-review.md":{title:`晶体学证据评审`,summary:`独立检查衍射、对称性、精修、CIF、物相声明和结构不确定性,不替代其他领域评审。`,originalName:`Crystallography Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/crystallography-review.md`,sourceSha256:`034223d76528f09aede5febdb7fff1c848819f82564a8be7acf23ebc1a25d369`},"vertical/chemistry/reviewer/materials-science-review.md":{title:`材料科学证据评审`,summary:`核对非 MOF 材料的身份、工艺、性质和发现声明,不把结论跨用到晶体精修或电池循环。`,originalName:`Materials Science Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/materials-science-review.md`,sourceSha256:`ac639340d34bc5dae734e9f9841e91762cb31ec42c73c5a108dc69b25c2b76ba`},"vertical/chemistry/reviewer/mof-reticular-chemistry-review.md":{title:`MOF 与网状化学证据评审`,summary:`核对构筑单元、拓扑、合成活化、孔隙吸附、后修饰、数据与生成结构的证据。`,originalName:`MOF and Reticular Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/mof-reticular-chemistry-review.md`,sourceSha256:`d095ca81ab168c658696b20de0e149647cdbfcffe545cff73e3ed9ccaeb37dcf`},"vertical/chemistry/reviewer/organic-synthesis-review.md":{title:`有机合成与逆合成评审`,summary:`独立核对反应记录、路线先例、选择性、分析证据、安全和实际可行性声明。`,originalName:`Organic Synthesis and Retrosynthesis Review`,source:`argus/domains/chemistry/skills/reviewer/organic-synthesis-review.md`,sourceSha256:`0ce7fdeee239a78b9d74f7e64dbd55b38d99b9e88bf141399ec999d30f519ad0`},"vertical/chemistry/scientist/chemistry-adaptation.md":{title:`根据证据改进化学方法`,summary:`只有证据显示现有方法在对象、能力、验证或安全等机制层面存在缺口时,才调整可复用流程。`,originalName:`Chemistry Skill Adaptation`,source:`argus/domains/chemistry/skills/scientist/chemistry-adaptation.md`,sourceSha256:`d231961e4c85bee737df313c376e046dba50ed5a375460a924176db507f8ee9a`},"vertical/chemistry/scientist/chemistry-distillation.md":{title:`沉淀可复用化学流程`,summary:`在技能匹配缺失后归纳带范围、证据、验证和停止条件的方法,而不是保存目标答案或工具教程。`,originalName:`Chemistry Skill Distillation`,source:`argus/domains/chemistry/skills/scientist/chemistry-distillation.md`,sourceSha256:`1f7c9b2cddae0e19332d6e38edbac2671026d04e5ca0f3203f3d777e5e51d010`},"vertical/kernel_engineering/engineer/kernel-benchmark-measurement-integrity.md":{title:`GPU 算子工程:先算屋顶线,隔离测量`,summary:`先用屋顶线定瓶颈再改机制而非参数;一次干净的隔离运行足以筛选想法,要主张或保留的提升必须在官方条件下测量;审阅只看正确性与基准证据。`,originalName:`Kernel Engineering: Roofline First, Measure in Isolation`,source:`argus/verticals/kernel_engineering/skills/engineer/kernel-benchmark-measurement-integrity.md`,sourceSha256:`b6bbe44b147dfea2dd68810db53571a9fae5db238c2bcde24d51c79756bf1785`},"vertical/learning/learning-curation.md":{title:`学习任务的整理与审阅`,summary:`把操作者材料变成有证据锚点的项目 Skill/Wiki 修改或诚实的空操作,说明 CHANGE_PLAN.json 的约定以及审阅者如何判断修改是否忠实、无冗余、不倒退、层级正确。`,originalName:`Learning Curation`,source:`argus/verticals/learning/skills/learning-curation.md`,sourceSha256:`71490b8d95eecb97a88a18e8bc4dd0a1aa163d7c0f82a02114440aae1f5f6999`},"vertical/math/engineer/math-research-execution.md":{title:`数学研究执行`,summary:`忠实保留命题与范围,诚实区分结果类别;需要 Lean 证据时实际编译,不虚构证明。`,originalName:`Math Research Execution`,source:`argus/verticals/math/skills/engineer/math-research-execution.md`,sourceSha256:`ddcf8321ce873130c1de3e71b78d816115182813e8a6dfdd4bc89d0fe9629736`},"vertical/math/manager/math-research-manager.md":{title:`数学研究任务协调`,summary:`在通用协调流程中保持研究目标、范围、求解和评审职责,不另造一套权限体系。`,originalName:`Math Research Manager Context`,source:`argus/verticals/math/skills/manager/math-research-manager.md`,sourceSha256:`e228b24cd82e6dee678458b5e32c4e1fc6092151b06c7eee198b158bdd1a1b95`},"vertical/math/planner/math-research-planning.md":{title:`数学研究规划`,summary:`围绕范围界定、求解和评审安排动态任务,保持原有角色与生命周期规则。`,originalName:`Math Research Planning`,source:`argus/verticals/math/skills/planner/math-research-planning.md`,sourceSha256:`e3320bf8a0b986eae0251ce1004962659ab2a9505a2cc73da63c33b94d2799f4`},"vertical/math/reviewer/math-research-review.md":{title:`数学研究独立评审`,summary:`检查正确性、新意、意义、命题忠实性和真实形式化证据,不以叙述代替证明。`,originalName:`Math Research Review`,source:`argus/verticals/math/skills/reviewer/math-research-review.md`,sourceSha256:`21b7e0f172bbb695ae9950c0e9dd1cdac60ae6aa21df0962a88a1b06ba505251`},"vertical/math/scientist/math-research-adaptation.md":{title:`改进数学研究方法`,summary:`在评审确认方法失败或技能缺口后,按已有适应阶段调整可复用方法。`,originalName:`Math Research Scientist Adaptation`,source:`argus/verticals/math/skills/scientist/math-research-adaptation.md`,sourceSha256:`fd8961cb0155e3fc05428cf0b5dbd6be86ed048636dc657b3b23abbee6495933`},"vertical/math/scientist/math-research-distillation.md":{title:`沉淀数学研究方法`,summary:`在首次匹配缺失后整理可复用研究方法,不假定已经失败,也不代替当前任务的执行。`,originalName:`Math Research Skill Distillation`,source:`argus/verticals/math/skills/scientist/math-research-distillation.md`,sourceSha256:`83a7367798b1ac327861deaa94accf1d77da0e140ebc8da8137442a30a83b09a`},"vertical/research/engineer/ablation-planner.md":{title:`选择有判别力的消融实验`,summary:`只选择能区分结果解释、说明所选方法作用的必要消融,而不是机械穷举组合。`,originalName:`Choosing ablations that distinguish explanations`,source:`argus/verticals/research/skills/engineer/ablation-planner.md`,sourceSha256:`f5c9bff3d6b5bc9dc4b50316e172856fcc01d708685c08a1ff29650871369858`},"vertical/research/engineer/method-card.md":{title:`方法卡、可执行规范与审阅锚点`,summary:`在 METHOD.md 中写清方法、组件、协议和证伪条件;以钉版参考实现为底把方法写成 diff;先写 tests/spec 再跑承载论断的实验;用代码锚点让不在场的审阅者找到机制;规划者据此写实现简报。`,originalName:`Method card (METHOD.md), executable spec and review anchors`,source:`argus/verticals/research/skills/engineer/method-card.md`,sourceSha256:`2e756a2fd09bca2abe4175fea4042af6905a6166b629c940909b10090cfe6855`},"vertical/research/engineer/novelty-check.md":{title:`检验研究想法的新意`,summary:`通过当前来源对照最接近的已有工作,判断一条候选想法的差异,而非先宣称创新。`,originalName:`Testing the idea's novelty`,source:`argus/verticals/research/skills/engineer/novelty-check.md`,sourceSha256:`e20a0f4290c72b07c9b09fa77633ecc915f0f7a8b90d8efd4c627fb9d12f8c16`},"vertical/research/engineer/paper-chart-styling.md":{title:`论文数据图样式`,summary:`统一数据图的配色、尺寸、标记和字体嵌入,遵守所选期刊会议版式;不改变数据本身。`,originalName:`Styling data figures for publication`,source:`argus/verticals/research/skills/engineer/paper-chart-styling.md`,sourceSha256:`c40b9f431de9cd01f16e245d819563566fc5db02c2217505599921adcca65b75`},"vertical/research/engineer/paper-framework-figure-studio.md":{title:`论文图的路线选择与概念图编排`,summary:`按表达内容选渲染路线:数据图走 SciencePlots/Matplotlib,概念与框架图默认以图像蓝图重建为可编辑 PPT,无图像接口时直接原生绘制;生成图像只用于不承载论断的部分。`,originalName:`Composing a conceptual paper figure`,source:`argus/verticals/research/skills/engineer/paper-framework-figure-studio.md`,sourceSha256:`e01ffd101b8fcd701b86918d93994079dfc87d9df79dbcd348bdfe3508cfcd9b`},"vertical/research/engineer/references/ideation/ideation-patterns/overview.md":{title:`研究构思模式总览`,summary:`汇总各研究构思模式的定义、操作特征与适用时机,帮助为路线挑选机制视角;模式在语料中常见不代表适合当前问题,也不替代创新性与正确性验证。`,originalName:`engineer/references/ideation/ideation-patterns/overview`,source:`argus/verticals/research/skills/engineer/references/ideation/ideation-patterns/overview.md`,sourceSha256:`8b2b43b5ce63c70a1b54c0ff5fb3f1954bc8ef6c05bda95a71a011d2f5f4eb34`},"vertical/research/engineer/references/paper-writing-craft.md":{title:`论文写作方法参考`,summary:`提供论文论证和表达的写作参考,需结合真实证据与所选期刊会议要求使用。`,originalName:`engineer/references/paper-writing-craft`,source:`argus/verticals/research/skills/engineer/references/paper-writing-craft.md`,sourceSha256:`bd645d2f2f48987c988c54b6b22843b22ee3b5a9dc0ce950bff4acdc0fcf3eeb`},"vertical/research/engineer/research-grind.md":{title:`沿诊断阶梯打磨研究结果`,summary:`把首次实现当作草稿,在固定声明下沿诊断阶梯逐级排查;结果异常先怀疑设置;从原始逐种子行算数;依据证据而非尝试次数判断何时足够。`,originalName:`Working a research result into shape`,source:`argus/verticals/research/skills/engineer/research-grind.md`,sourceSha256:`e955fe1ac7aa975a9172394bdca4e8b2ed6a504355ab00573a26badf442f038a`},"vertical/research/engineer/rl-training-collapse-diagnosis.md":{title:`强化学习训练健康诊断`,summary:`检查奖励、优势、梯度、KL、截断和吞吐异常,先诊断配置与过程,再归因方法;不同训练目标不能混用规则。`,originalName:`RL Training Health Diagnosis`,source:`argus/verticals/research/skills/engineer/rl-training-collapse-diagnosis.md`,sourceSha256:`d48fd69adaac73ad45c41cd9565798a94a476de52c9354097abe2d8604db8782`},"vertical/research/engineer/sources-and-citations.md":{title:`对照来源核对论断与引用`,summary:`把稿件中的论断对回支撑它的证据,把引用对回被引的原文,并用 Semantic Scholar 核对版本;补充全局的一手来源技能,不另起一轮整篇审阅。`,originalName:`Checking claims and citations against their sources`,source:`argus/verticals/research/skills/engineer/sources-and-citations.md`,sourceSha256:`450410c4b428e31104819c07a98e19b615ced499e0d2d4df473305ca789d55ed`},"vertical/research/engineer/training-infrastructure.md":{title:`训练基础设施的选择、搭建与调参`,summary:`训练或大规模推理需要框架时,用实时来源调查候选、在隔离环境中试装并剖析一步真实更新、以官方配方为锚每次只改一个因素,并把结论写成带日期的项目决策记录;不按记忆推荐技术栈。`,originalName:`Training infrastructure: choosing, standing up and tuning it`,source:`argus/verticals/research/skills/engineer/training-infrastructure.md`,sourceSha256:`4c495369ffba7ff2b9954a2fafd72b874e63abc6065a5afab7c61ce10afb9087`},"vertical/research/engineer/venue-format-preflight.md":{title:`投稿前的编译与泄露检查`,summary:`用目标会场的官方作者模板编译完整稿件并核对结构,同时检查稿件没有泄露内部路径、角色名与运行时用语。`,originalName:`Preparing the draft for the venue`,source:`argus/verticals/research/skills/engineer/venue-format-preflight.md`,sourceSha256:`e146afba818a8436d0807aff610084d6a321277778e7ce299bd96f9f57795eb0`},"vertical/research/engineer/venue-format-research.md":{title:`选择投稿目标并核对要求`,summary:`根据研究内容选择合适期刊会议,获取当前官方作者要求,而非沿用过时模板。`,originalName:`Choosing a venue and reading its requirements`,source:`argus/verticals/research/skills/engineer/venue-format-research.md`,sourceSha256:`aad2d0ec25649231ec233f4abb5b216af313a7a1dfa699cc6f0c8b23be7cbcf2`},"vertical/research/engineer/venue-paper-drafting.md":{title:`面向投稿目标撰写论文`,summary:`先定论证形状,按所选作者模板和确认的证据写完整论文,读一次强范文校准视觉与结构标准;不把未验证探索写成既定结论。`,originalName:`Writing for the selected venue`,source:`argus/verticals/research/skills/engineer/venue-paper-drafting.md`,sourceSha256:`d7bb7d7e59f5ce6e20433fa843e3d7002575b1892b131c0d0f7f247e986281f1`},"vertical/research/research-experiment-playbook.md":{title:`通过实验发展研究想法`,summary:`忠实实现已选想法,通过适应性实验形成足以支撑论文的证据,而不是只完成首次运行。`,originalName:`Developing an idea through experiments`,source:`argus/verticals/research/skills/research-experiment-playbook.md`,sourceSha256:`df8f6a724b93f063a6e0dd2e36af1838fca72eea689f062b096d3ad0c4ad2c85`},"vertical/research/research-idea-playbook.md":{title:`寻找并选择研究想法`,summary:`从来源中发现候选可能性,经独立审查后作最终选择,不把构思直接当作实验结果。`,originalName:`Finding a research idea`,source:`argus/verticals/research/skills/research-idea-playbook.md`,sourceSha256:`91104461d9115ee280db1f5e89d3c35bc8301422bfd7d9a70c66fa559c09eed6`},"vertical/research/research-paper-playbook.md":{title:`撰写完整研究论文`,summary:`从已确认的正向证据组织论文、编译并准备投稿材料,保持证据与论述一致。`,originalName:`Writing the research paper`,source:`argus/verticals/research/skills/research-paper-playbook.md`,sourceSha256:`2efcabc2904fe55831b0f5d9c61846c544aab2a211687f0fbf51ad417e66afec`},"vertical/research/research-review-playbook.md":{title:`对论文形成独立判断`,summary:`综合科学性、图示、语言和整体论证,判断工作是否成立并提出建设性意见。`,originalName:`Reaching a judgment on the paper`,source:`argus/verticals/research/skills/research-review-playbook.md`,sourceSha256:`368d0bc3b8dba80c1e8d84257a10f95bbe2124a35d03a30e553e1d6b56ae829a`},"vertical/research/reviewer/academic-paper-peer-review-benchmark.md":{title:`按目标期刊会议评审论文`,summary:`以独立评审视角判断当前稿件,提供科学指导并更新评审记录。`,originalName:`Reading the paper as a venue reviewer`,source:`argus/verticals/research/skills/reviewer/academic-paper-peer-review-benchmark.md`,sourceSha256:`6446f17af2a751bd9570b4351e4b28d84d09cc06ed2c59174111f17f39e0cbc9`},"vertical/research/reviewer/claim-to-code-trace.md":{title:`追溯声明到实际代码`,summary:`沿配置和执行路径核对公式、比较条件与观测,判断研究声明是否对应实际产生证据的代码。`,originalName:`Claim-to-Code Trace`,source:`argus/verticals/research/skills/reviewer/claim-to-code-trace.md`,sourceSha256:`fef3ef16ce27a9c1e9ec5f095c73bb734da06aedba74fa994122e28d32c293ee`},"vertical/research/reviewer/experiment-results-review.md":{title:`判断实验真正说明了什么`,summary:`亲自读代码、配置、评测器和原始行,判断证据对固定声明的支持与缺口;低于基线的结果在阶梯未走完前是修复请求;训练类实验另核对基础设施决策记录。`,originalName:`What the experiments establish`,source:`argus/verticals/research/skills/reviewer/experiment-results-review.md`,sourceSha256:`bc158d8b51107b697d290eb6ed461f2a596aa601bc78cce7e88089743411533e`},"vertical/research/reviewer/strongest-argument-against.md":{title:`寻找最有力的科学反对意见`,summary:`在最终评审中识别论文最关键的科学弱点,不通过直接改稿掩盖它。`,originalName:`The strongest argument against the paper`,source:`argus/verticals/research/skills/reviewer/strongest-argument-against.md`,sourceSha256:`6cc3e7990dacb420a04ff945cb1f221852bd249b981a60def70dfcace2ac3418`},"vertical/research/reviewer/venue-academic-language-review.md":{title:`审查论文论证与学术表达`,summary:`对照目标期刊会议的当前惯例阅读论证与语言,指出问题,不擅自编辑论文。`,originalName:`Reading the paper's argument and language`,source:`argus/verticals/research/skills/reviewer/venue-academic-language-review.md`,sourceSha256:`a2fe9faf57ff0a09181f42de2ac2b5080158e08c430078fb48722fd6b9893f66`},"vertical/software/engineer/software-change-implementation.md":{title:`有边界的软件实现与拆解`,summary:`结合仓库结构选择合适工具,以与任务规模相称的检查完成软件修改;分阶段工作按架构边界拆解,每个任务写明兼容性风险与独立预言机。`,originalName:`Software Change Implementation`,source:`argus/verticals/software/skills/engineer/software-change-implementation.md`,sourceSha256:`34dad5e10c880fb48964573768b72d8377829ca8163ddd21987c2c05538d70a9`},"vertical/software/reviewer/software-change-review.md":{title:`软件修改独立评审`,summary:`检查真实调用路径、兼容性与验证证据,不依赖参考答案或仅凭完成声明判断。`,originalName:`Software Change Review`,source:`argus/verticals/software/skills/reviewer/software-change-review.md`,sourceSha256:`5d1a66ff65accae04ec02005724735c9767308ac63c005b8be6e269eb9acb25f`}};function Sn(e){if(!e.is_default||![`bundled`,`shared`].includes(e.source)||!(e.scope===`global`?[`global:${e.source}`]:e.scope===`vertical`?[`vertical:${e.vertical}:${e.source}`,...e.source===`bundled`?[`domain:${e.vertical}:bundled`]:[]]:[]).includes(e.library))return null;let t=e.scope===`global`?`global/${e.path}`:`vertical/${e.vertical}/${e.path}`,n=Object.hasOwn(xn,t)?xn[t]:null;return n?.originalName===e.name?n:null}function Cn(e,t){let n=t===`zh-CN`?Sn(e):null;return{title:n?.title??e.name,summary:n?.summary??e.description,guide:n}}function wn(e,t){let n=Cn(e,t);return`${e.name} ${e.description} ${e.path} ${e.vertical} ${n.title} ${n.summary}`.toLocaleLowerCase()}var Tn={research:`科研`,software:`软件开发`,math:`数学研究`,chemistry:`化学`,kernel_engineering:`GPU 算子工程`,argus_maintenance:`Argus 维护`,learning:`资料学习`};function En(e,t){return t===`zh-CN`&&Object.hasOwn(Tn,e)?Tn[e]:e}var Dn={fact:[`记录可核对的环境、对象或事实,供后续工作查证;记录本身不保证事实仍然有效。`,`Records checkable facts for later verification; a saved record is not a guarantee that it is still current.`],lesson:[`保留工作中得到的经验和问题,帮助类似任务少走弯路;不能代替当前证据或评审。`,`Keeps lessons from work to inform similar tasks; it does not replace current evidence or review.`],survey:[`整理问答或调研材料与来源,为后续查阅提供线索;结论仍需结合原文核对。`,`Organizes answers or research and their sources for later reference; check conclusions against the original evidence.`],principles:[`归纳可反复参考的建议,帮助选择方法;应检查所引用的经验与适用条件。`,`Distills recurring guidance for choosing methods; check the cited lessons and applicability.`],note:[`保存关于你的背景、偏好或计划,帮助后续任务理解上下文;不是工具使用授权。`,`Keeps personal context, preferences or plans for later work; it is not authorization to use tools.`],profile:[`汇总 Argus 对你的背景与偏好的了解,方便核对是否准确;不代表公开资料或任务完成情况。`,`Summarizes personal context and preferences for inspection; it is neither a public record nor a task-completion report.`],page:[`一般参考资料。具体用途取决于原文和来源,不能仅凭“已保存”判断内容可靠或适用。`,`General reference material. Its use depends on the original content and sources, not merely on being saved.`]};function On(e,t){return(Object.hasOwn(Dn,e)?Dn[e]:Dn.page)[t===`zh-CN`?0:1]}var kn={private:[`你的个人背景资料,与共享知识分开保存。这里不改变既有读取权限或模型的数据处理方式。`,`Personal context is stored separately from shared knowledge. This view does not change existing access or model data handling.`],global:[`跨项目参考的通用资料;不要把个人信息当作公共知识放在这里。`,`General reference across projects; personal information does not belong in shared knowledge.`],vertical:[`同一领域可复用的专门资料,使用前仍要核对当前任务的条件。`,`Domain-specific reference; verify that it applies to the current task.`],project:[`围绕当前项目保存的资料与背景;分类不是操作系统沙箱或文件权限边界。`,`Material associated with this project; the category is not an OS sandbox or file-permission boundary.`]};function An(e,t){return Object.hasOwn(kn,e)?kn[e][t===`zh-CN`?0:1]:t===`zh-CN`?`范围尚未确认,请以来源说明为准。`:`Scope not confirmed; consult the source.`}var jn={active:`label.status.inProgress`,claimed:`label.status.inProgress`,in_progress:`label.status.inProgress`,running:`label.status.inProgress`,working:`label.status.inProgress`,pending:`label.status.waiting`,queued:`label.status.waiting`,waiting:`label.status.waiting`,idle:`label.status.waiting`,accepted:`label.status.completed`,complete:`label.status.completed`,completed:`label.status.completed`,done:`label.status.completed`,success:`label.status.completed`,blocked:`label.status.blocked`,failed:`label.status.failed`,error:`label.status.failed`,rejected:`label.status.needsChanges`,continue:`label.status.needsChanges`,skipped:`label.status.skipped`,paused:`label.status.paused`,paused_cost:`label.outcome.costUnreconciled`,stopped:`label.status.paused`,cancelled:`label.status.cancelled`,aborted:`label.status.cancelled`,not_started:`label.status.waiting`,available:`label.status.available`,absent:`label.status.unavailable`,inaccessible:`label.status.inaccessible`,degraded:`label.status.limited`,healthy:`label.status.healthy`},Mn={system:`label.role.argus`,operator:`label.role.you`},Nn={completed:`label.outcome.workCompleted`,done:`label.outcome.workCompleted`,success:`label.outcome.workCompleted`,paused:`label.outcome.workPaused`,blocked:`label.outcome.workBlocked`,failed:`label.outcome.workFailed`,error:`label.outcome.workFailed`,aborted:`label.outcome.workEnded`,ended:`label.outcome.workEnded`,incomplete:`label.outcome.workIncomplete`,research_incomplete:`label.outcome.workIncomplete`,paused_no_breakthrough:`label.outcome.workIncomplete`,exhausted_current_methods:`label.outcome.workIncomplete`,stalled:`label.outcome.workStalled`,no_progress:`label.outcome.workStalled`,max_rounds:`label.outcome.workStalled`,infra_blocked:`label.outcome.workBlocked`,supervisor_error:`label.outcome.workFailed`},Pn={accepted:`label.outcome.reviewPassed`,done:`label.outcome.reviewPassed`,passed:`label.outcome.reviewPassed`,continue:`label.outcome.reviewNeedsChanges`,rejected:`label.outcome.reviewNeedsChanges`,blocked:`label.outcome.reviewBlocked`,stale:`label.outcome.reviewOutdated`,pending:`label.outcome.reviewPending`,pending_review:`label.outcome.reviewPending`},Fn={certified:`label.outcome.stageApproved`,not_certified:`label.outcome.stageNotApproved`,revoked:`label.outcome.stageRevoked`,intentionally_skipped:`label.outcome.stageNotNeeded`,deferred:`label.outcome.stagePending`},In={budget_exhausted:`label.outcome.budgetPaused`,budget_pause:`label.outcome.budgetPaused`,cost_unreconciled:`label.outcome.costUnreconciled`,operator_input_required:`label.outcome.waitingForYou`,operator_abort:`label.outcome.stoppedByYou`,operator_pause:`label.outcome.pausedByYou`,daemon_shutdown:`label.outcome.sessionPaused`,backend_unavailable:`label.outcome.serviceUnavailable`,provider_cooldown:`label.outcome.serviceCoolingDown`,provider_fence:`label.outcome.serviceUnavailable`,transient_error:`label.outcome.temporaryIssue`,permanent_error:`label.outcome.serviceError`,planner_empty_plan:`label.outcome.needsPlan`},Ln={cuda:`label.resource.nvidiaGpu`,rocm:`label.resource.amdGpu`,mps:`label.resource.appleGpu`,cpu:`label.resource.cpu`};function Rn(e,t){return t(jn[String(e??``).toLowerCase()]??`label.status.updated`)}function zn(e,t){let n=String(e??``).toLowerCase();return gt(n)?Ve(n,t):t(Mn[n]??`label.role.argus`)}function Bn(e,t){return t(`label.priority`,{priority:e})}function Vn(e,t){if(!e?.execution_status)return[];let n=[t(Nn[e.execution_status.toLowerCase()]??`label.outcome.workUpdated`)],r=Pn[String(e.review_status??``).toLowerCase()],i=Fn[String(e.stage_certification??``).toLowerCase()],a=In[String(e.interruption_kind??``).toLowerCase()];return r&&n.push(t(r)),i&&n.push(t(i)),a&&n.push(t(a)),e.resumable&&n.push(t(`label.outcome.canResume`)),n}function Hn(e,t){return t(Ln[e.toLowerCase()]??`label.resource.accelerator`)}function Un(e,t){return t(e===`strict`?`label.resource.enforced`:`label.resource.advisory`)}function Wn(e,t){return t(e===`yield`?`label.resource.released`:`label.resource.kept`)}var J=i(),Gn=e=>[`knowledge-feed`,e];function Kn(e=!0,t=50){return A({queryKey:Gn(t),queryFn:({signal:e})=>R.knowledgeFeed(t,e),enabled:e,staleTime:5e3,refetchInterval:1e4})}var qn={en:{learned:`Learned`,recalled:`Recalled`,promoted:`Promoted`,corrected:`Corrected`},zh:{learned:`学到了`,recalled:`读取了`,promoted:`提升了`,corrected:`纠正了`}},Jn={en:{private:`About you`,global:`Global`,vertical:`Vertical`,project:`Project`},zh:{private:`关于你`,global:`全局`,vertical:`垂直领域`,project:`项目`}};function Yn(e,t=60){let n=[...e].sort((e,t)=>t.ts-e.ts),r=[];for(let e of n){let n=r[r.length-1];if(e.kind===`recalled`&&n?.kind===`recalls`&&n.role===e.role&&n.ts-e.ts<=t){n.events.push(e);continue}r.push(e.kind===`recalled`?{kind:`recalls`,ts:e.ts,role:e.role,events:[e]}:{kind:`single`,event:e})}return r}function Xn(e,t,n=null){return e.path?e.scope===`project`?n&&e.source_project&&e.source_project!==n?null:t.find(t=>t.scope===`project`&&t.path===e.path)??null:t.find(t=>t.scope===e.scope&&t.vertical===e.vertical&&t.path===e.path)??null:null}var Zn={learned:`bg-blue/10 text-blue`,recalled:`bg-line/60 text-ink-dim`,promoted:`bg-ok/10 text-ok`,corrected:`bg-warn/10 text-warn`};function Qn({events:e,items:t,sid:n,projectNames:r={},query:i=``,onSelect:a,selected:o}){let{locale:s,t:c}=z(),l=s===`zh-CN`,u=qn[l?`zh`:`en`],d=Jn[l?`zh`:`en`],f=e=>wt(e,l?`zh-CN`:`en`),p=i.trim().toLocaleLowerCase(),m=Yn(p?e.filter(e=>`${e.title} ${e.path} ${e.vertical} ${e.source_project} ${e.role} ${e.note}`.toLocaleLowerCase().includes(p)):e),h=e=>[d[e.scope]??e.scope,En(e.vertical,s),e.source_project?`${l?`来自 `:`from `}${r[e.source_project]||e.source_project}`:``,l&&e.role?zn(e.role,c):e.role].filter(Boolean).join(` · `),g=e=>!!(e&&o&&e.scope===o.scope&&e.vertical===o.vertical&&e.path===o.path),_=(e,r)=>{let i=Xn(e,t,n),o=e.title||e.path;return i?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(i),"aria-pressed":g(i),"data-feed-title":!0,className:`${r} text-left hover:text-blue ${g(i)?`text-blue`:`text-ink`}`,children:o}):(0,J.jsx)(`span`,{"data-feed-title":!0,className:`${r} text-ink`,title:e.path,children:o})};return m.length===0?(0,J.jsx)(`p`,{className:`p-3 text-sm leading-relaxed text-ink-faint`,children:p?l?`没有匹配的学习动态。`:`No feed lines match the search.`:l?`还没有学习动态。Argus 在任务后反思写下教训、把已有知识读进提示、或把评审通过的页面提升到共享层时,都会在这里留下一行。`:`Nothing learned yet. A line appears here whenever Argus writes a lesson after a mission, reads existing knowledge into a prompt, or promotes a reviewed page to a shared level.`}):(0,J.jsx)(`ol`,{className:`space-y-1`,"aria-label":l?`学习动态`:`Learning feed`,children:m.map(e=>e.kind===`single`?(0,J.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":e.event.kind,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`time`,{dateTime:new Date(e.event.ts*1e3).toISOString(),children:f(e.event.ts)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${Zn[e.event.kind]??Zn.learned}`,children:u[e.event.kind]??e.event.kind})]}),_(e.event,`mt-1 block w-full break-words text-sm font-medium`),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.event)}),e.event.note&&(0,J.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-ink-dim`,children:e.event.note})]},`${e.event.ts}/${e.event.kind}/${e.event.path}`):(0,J.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":`recalls`,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`time`,{dateTime:new Date(e.ts*1e3).toISOString(),children:f(e.ts)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${Zn.recalled}`,children:u.recalled})]}),(0,J.jsx)(`span`,{className:`mt-1 block text-sm font-medium text-ink`,"data-feed-title":!0,children:e.events.length===1?e.events[0].title||e.events[0].path:l?`读取了 ${e.events.length} 条已有知识`:`Recalled ${e.events.length} existing pages`}),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.events[0])}),e.events.length>1&&(0,J.jsx)(`span`,{className:`mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-xs`,children:e.events.map(e=>(0,J.jsx)(`span`,{children:_(e,`inline text-xs text-ink-dim`)},`${e.ts}/${e.scope}/${e.vertical}/${e.path}`))})]},`${e.ts}/recalls/${e.role}`))})}function $n({guide:e,item:t}){let{t:n}=z();return(0,J.jsxs)(`section`,{"data-skill-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-4 text-sm leading-relaxed text-ink`,children:[(0,J.jsx)(`h4`,{className:`font-semibold`,children:`这项方法有什么用`}),(0,J.jsx)(`p`,{className:`mt-2`,children:e.summary}),(0,J.jsxs)(`dl`,{className:`mt-3 space-y-2 text-xs text-ink-dim`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`什么时候参考`}),(0,J.jsx)(`dd`,{children:`当前任务与上面的用途相符时,由既有任务与技能选择流程按需读取;浏览本页不会运行工具或发起模型任务。`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`目录标注的角色`}),(0,J.jsxs)(`dd`,{children:[zn(t.role,n),`;这只是说明,不调整角色职责或权限。`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`font-medium`,children:`需要注意`}),(0,J.jsx)(`dd`,{children:`这是随包版本的中文导读,不是完整执行指令,也不是已经完成或验证的证据。具体步骤、前置条件、软件许可和授权限制请对照原文。`})]})]})]})}function er({item:e}){let{locale:t}=z(),n=t===`zh-CN`;return(0,J.jsxs)(`section`,{"data-knowledge-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-3 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`h4`,{className:`font-semibold text-ink`,children:n?`这类知识怎样帮助工作`:`How this kind of knowledge helps`}),(0,J.jsx)(`p`,{className:`mt-2`,children:On(e.kind,t)}),(0,J.jsx)(`p`,{className:`mt-2`,children:An(e.scope,t)}),(0,J.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n?`以上解释条目类型与范围,不是这篇正文的翻译或真实性证明。具体内容、来源和适用条件仍以原文为准。`:`This explains the kind and scope, not the page itself or its validity. Consult the original content, sources and conditions.`})]})}function tr({sid:e,channel:t,onOpenKnowledge:n,onOpenSkills:r}){let{locale:i}=z(),a=i===`zh-CN`,o=M(),s=A({queryKey:[`learning-status`,e],queryFn:({signal:t})=>R.learningStatus(e,t),enabled:!!e,refetchInterval:2e3,staleTime:1e3}),c=(0,G.useRef)(``);(0,G.useEffect)(()=>{let t=`${e}:${s.data?.revision??0}`;if(!(!s.data?.revision||t===c.current)){c.current=t;for(let e of[`skill-library`,`wiki-library`,`knowledge-feed`])o.invalidateQueries({queryKey:[e]})}},[e,s.data?.revision,o]);let l=N({mutationFn:e=>R.retryLearning(e.sid,e.id),onSuccess:(e,t)=>o.setQueryData([`learning-status`,t.sid],e)});if(!e||!s.data?.jobs.length)return null;let u=s.data.jobs,d=u.find(e=>e.status===`running`)??u.find(e=>e.status===`queued`),f=d??u[0],p=!!d||s.data.pending>0,m=!p&&f.status===`skipped`&&f.outcome.reason===`paused`;if(!p&&f.status===`skipped`&&(!m||!t))return null;let h={cost_unreconciled:[`上一次模型调用的费用尚未结算,结算前暂停新的模型调用`,`model calls are paused until an earlier call's cost is settled`],budget_exhausted:[`今日模型预算已用完`,`today's model budget is used up`],provider_cooldown:[`模型服务暂时限流`,`the model provider is briefly rate-limited`],operator_pause:[`模型调用已暂停`,`model calls are paused`]},g=h[f.outcome.detail??``]??h.operator_pause,_=m||!p&&f.status===`failed`,v=a?{knowledge:`知识库`,skills:`技能库`,preferences:`用户偏好`}:{knowledge:`Knowledge base`,skills:`Skill library`,preferences:`Preferences`},y=t?[t]:[`knowledge`,`skills`,`preferences`],b=p?y:y.filter(e=>(f.outcome.counts?.[e]??0)>0);if(!p&&!_&&!b.length)return null;let x=e=>{let t=f.outcome.counts?.[e]??0;return p?f.status===`running`?a?`${v[e]}正在更新`:`Updating ${v[e].toLowerCase()}`:a?`${v[e]}等待更新`:`${v[e]} update queued`:a?`${v[e]}已更新 · ${t} 条`:`${v[e]} updated · ${t}`},S=(f.outcome.items??[]).filter(e=>!t||e.channel===t);return(0,J.jsxs)(`div`,{className:`px-2 py-1.5 text-[11px] leading-5 text-ink-dim`,"data-learning-status":f.status,children:[(0,J.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:[p?(0,J.jsx)(an,{className:`h-3 w-3 animate-spin text-blue`}):_?(0,J.jsx)(tn,{className:`h-3 w-3 text-ink-faint`}):(0,J.jsx)(hn,{className:`h-3 w-3 text-blue`}),m&&(0,J.jsx)(`span`,{children:a?`本轮未学习:${g[0]}。回复不受影响。`:`Learning skipped: ${g[1]}. Your reply is unaffected.`}),!p&&f.status===`failed`&&(0,J.jsx)(`span`,{children:a?`本轮学习未完成,回复不受影响。`:`Learning from this turn did not finish. Your reply is unaffected.`}),!_&&b.map(e=>(0,J.jsx)(`span`,{children:x(e)},e)),s.data.pending>1&&(0,J.jsx)(`span`,{children:a?`还有 ${s.data.pending-1} 轮待学习`:`${s.data.pending-1} more queued`}),_&&f.retryable!==!1&&(0,J.jsx)(`button`,{type:`button`,disabled:l.isPending,className:`text-blue underline`,onClick:()=>l.mutate({sid:e,id:f.id}),children:a?`重试学习`:`Retry learning`})]}),p&&!t&&(0,J.jsx)(`p`,{className:`text-ink-faint`,children:a?`正在整理本轮的知识、方法和偏好,你可以继续工作。`:`Saving useful knowledge, methods and preferences. You can keep working.`}),S.length>0&&!t&&(0,J.jsxs)(`details`,{className:`mt-0.5`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-blue`,children:a?`查看本轮学到了什么`:`What this turn taught Argus`}),(0,J.jsx)(`ul`,{className:`pl-4 list-disc`,children:S.map((e,t)=>(0,J.jsx)(`li`,{children:(e.channel===`skills`?r:n)?(0,J.jsx)(`button`,{type:`button`,className:`text-left underline`,onClick:e.channel===`skills`?r:n,children:e.title}):e.title},t))})]}),(l.isError||s.isError)&&(0,J.jsx)(`p`,{role:`alert`,children:a?`暂时无法同步学习状态,请稍后重试。`:`Learning status could not be refreshed. Please retry.`})]})}var nr=e=>`${e.library}/${e.path}`,rr=e=>e.filter(e=>!e.is_default&&e.updated_at!=null).sort((e,t)=>(t.updated_at??0)-(e.updated_at??0)||nr(e).localeCompare(nr(t)));function ir(e,t=!0){return A({queryKey:[`skill-library`,e],queryFn:({signal:t})=>R.skillLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var ar={en:{fact:`Fact`,lesson:`Lesson`,survey:`Survey`,principles:`Principles`,note:`Note`,profile:`Profile`,page:`Page`},zh:{fact:`事实`,lesson:`经验教训`,survey:`调研摘要`,principles:`原则`,note:`个人记录`,profile:`个人概况`,page:`参考页面`}},or=e=>e.kind in ar.en?e.kind:`page`,sr=e=>[`wiki-library`,e];function cr(e,t=!0){return A({queryKey:sr(e),queryFn:({signal:t})=>R.wikiLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var lr=[`feed`,`global`,`vertical`,`project`],ur={feed:hn,global:en,vertical:rn,project:$t},dr={"zh-CN":{feed:`学习动态`,global:`全局项目`,vertical:`垂直领域`,project:`项目`},en:{feed:`Learning feed`,global:`Across projects`,vertical:`Vertical`,project:`Project`}};function fr(e,t,n,r){let i=r===`zh-CN`,a=e=>n===`feed`||e===n||n===`global`&&e===`private`,o=(e?.items??[]).filter(e=>a(e.scope)).map(e=>({kind:`knowledge`,item:e,id:`knowledge/${e.scope}/${e.vertical}/${e.path}`,title:e.title,description:e.description,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at,search:`${e.title} ${e.description} ${e.path}`})),s=(n===`feed`?rr(t?.items??[]):t?.items??[]).filter(e=>a(e.scope)).map(e=>{let t=Cn(e,r);return{kind:`skill`,item:e,id:`skill/${e.library}/${e.path}`,title:t.title,description:t.summary,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at??0,search:wn(e,r)}}),c=n===`feed`?[]:(e?.libraries??[]).filter(e=>a(e.scope)).flatMap(e=>[{kind:`index`,content:e.index_markdown,name:`INDEX.md`,title:i?`索引`:`Index`},{kind:`principles`,content:e.principles,name:`principles.md`,title:i?`原则`:`Principles`},{kind:`profile`,content:e.profile,name:`profile.md`,title:i?`个人概况(原私有范围)`:`Personal profile (private scope)`}].flatMap(t=>t.content?.trim()?[{kind:t.kind,content:t.content,id:`${t.kind}/${e.scope}/${e.vertical}/${e.root}`,title:t.title,description:``,path:`${e.root}/${t.name}`,scope:e.scope,vertical:e.vertical,updated:0,search:`${t.title} ${t.name}`}]:[]));return[...o,...s,...c].sort((e,t)=>t.updated-e.updated||e.id.localeCompare(t.id))}function pr({onOpen:e,compact:t=!1}){let{locale:n}=z();return(0,J.jsx)(`section`,{className:`shrink-0 ${t?`py-2`:`mx-2 py-1`}`,"data-learning-navigation":!0,children:lr.map(r=>{let i=ur[r],a=dr[n][r];return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>e(r),"aria-label":a,title:a,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-ink-dim hover:bg-bg hover:text-ink ${t?`justify-center`:``}`,children:[(0,J.jsx)(i,{size:16,"aria-hidden":`true`}),!t&&a]},r)})})}function mr({sid:e,initialScope:t=`feed`,initialSelection:n=null,projectNames:r={}}){let i=(0,G.useRef)(e);return(0,J.jsx)(hr,{sid:e,initialScope:t,initialSelection:i.current===e?n:null,projectNames:r},e??`no-project`)}function hr({sid:e,initialScope:t,initialSelection:n,projectNames:r}){let{locale:i}=z(),a=i===`zh-CN`,o=dr[i],[s,c]=(0,G.useState)(t),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(()=>n?n.kind===`skill`?`skill/${n.item.library}/${n.item.path}`:`knowledge/${n.item.scope}/${n.item.vertical}/${n.item.path}`:null),h=cr(e),g=ir(e),_=Kn(s===`feed`),v=fr(h.data,g.data,s,i),y=v.find(e=>e.id===p),b=y?.kind===`knowledge`?y.item:null,x=y?.kind===`skill`?y.item:null,S=A({queryKey:[`wiki-document`,e,b?.scope,b?.vertical,b?.path,b?.updated_at],queryFn:({signal:t})=>{if(!b)throw Error(`No knowledge document selected`);return R.wikiDocument(e,b.scope,b.vertical,b.path,t)},enabled:!!b}),C=A({queryKey:[`skill-document`,e,x?.library,x?.path,x?.updated_at],queryFn:({signal:t})=>{if(!x)throw Error(`No skill document selected`);return R.skillDocument(e,x.library,x.path,t)},enabled:!!x}),w=l.trim().toLocaleLowerCase(),T=v.filter(e=>(s!==`vertical`||!d||e.vertical===d)&&(!w||`${e.search} ${e.vertical}`.toLocaleLowerCase().includes(w))),E=[...new Set([...h.data?.verticals??[],...g.data?.verticals??[]])].sort(),D=e=>e.scope===`private`?a?`个人记录 · 原私有范围,不共享`:`Personal record · private, not shared`:`${o[e.scope]}${e.vertical?` · ${En(e.vertical,i)}`:``}`,O=e=>e.kind===`skill`?a?`技能`:`Skill`:e.kind===`knowledge`?ar[a?`zh`:`en`][or(e.item)]:e.kind===`principles`?a?`原则`:`Principles`:e.kind===`profile`?a?`个人概况`:`Profile`:a?`索引`:`Index`,k=x?C:S,j=x?Cn(x,i).guide:null,M=e=>{c(e),m(null),f(``)};return(0,J.jsxs)(`div`,{className:`flex h-[min(780px,84dvh)] min-h-0 flex-col`,"data-learning-library":!0,children:[(0,J.jsx)(lt,{title:a?`知识与技能`:`Knowledge and skills`,sub:a?`在一起查看学到的知识、可复用的方法和原始资料。`:`Explore learned knowledge, reusable methods and original sources together.`}),(0,J.jsx)(tr,{sid:e,onOpenKnowledge:()=>M(`feed`),onOpenSkills:()=>M(`feed`)}),(0,J.jsx)(`nav`,{"aria-label":a?`学习资源分类`:`Learning resource categories`,className:`flex shrink-0 overflow-x-auto border-b border-line/60 px-4`,children:lr.map(e=>(0,J.jsx)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>M(e),className:`shrink-0 border-b-2 px-3 py-2.5 text-sm ${s===e?`border-blue text-ink`:`border-transparent text-ink-faint hover:text-ink`}`,children:o[e]},e))}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,J.jsxs)(`aside`,{className:`${y?`hidden md:flex`:`flex`} min-h-0 w-full flex-col md:w-80 md:shrink-0 md:border-r md:border-line/60`,children:[(0,J.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,J.jsx)(`input`,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":a?`搜索知识与技能`:`Search knowledge and skills`,placeholder:a?`搜索知识与技能`:`Search knowledge and skills`,className:`w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink`}),s===`vertical`&&(0,J.jsxs)(`select`,{value:d,onChange:e=>{f(e.target.value),m(null)},"aria-label":a?`垂直领域`:`Vertical`,className:`w-full rounded-md border border-line bg-bg px-2 py-2 text-sm text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:a?`所有领域`:`All verticals`}),E.map(e=>(0,J.jsx)(`option`,{value:e,children:En(e,i)},e))]}),s===`feed`&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`学习记录与文件更新分开展示。文件变更不等于知识已验证。`:`Learning records and file updates are separate. An update does not prove knowledge is verified.`}),s===`global`&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`跨项目共享的知识和方法;个人记录保留原私有范围,不会被共享。`:`Shared knowledge and methods across projects. Personal records retain their private scope.`})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:[h.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`知识无法加载。`:`Knowledge could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void h.refetch(),children:a?`重试`:`Retry`})]}),g.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`技能无法加载。`:`Skills could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void g.refetch(),children:a?`重试`:`Retry`})]}),h.data?.errors.length||g.data?.errors.length?(0,J.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-err`,children:a?`部分资料无法读取;已加载的内容仍可查看。`:`Some sources could not be read; loaded material remains available.`}):null,s===`feed`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`学习记录`:`Learning records`}),_.isPending&&(0,J.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载学习记录…`:`Loading learning records…`}),_.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`学习记录无法加载。`:`Learning records could not load.`,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void _.refetch(),children:a?`重试`:`Retry`})]}),_.data&&(0,J.jsx)(Qn,{events:_.data.events,items:h.data?.items??[],sid:e,projectNames:r,query:l,selected:b,onSelect:e=>{m(`knowledge/${e.scope}/${e.vertical}/${e.path}`)}}),(0,J.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`文件更新`:`File updates`})]}),(h.isPending||g.isPending)&&(0,J.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载资料…`:`Loading material…`}),!h.isPending&&!g.isPending&&!h.isError&&!g.isError&&!T.length&&(0,J.jsx)(`p`,{className:`p-3 text-sm text-ink-faint`,children:s===`project`&&!e?a?`选择一个项目以查看资料。`:`Select a project to see its material.`:a?`当前分类或筛选条件下没有资料。`:`No material matches this category or filter.`}),T.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>m(e.id),"aria-pressed":y?.id===e.id,className:`block w-full rounded-md px-3 py-3 text-left ${y?.id===e.id?`bg-blue/10`:`hover:bg-bg`}`,children:[(0,J.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,J.jsx)(`span`,{className:`shrink-0 rounded bg-line/60 px-1.5 text-[10px] text-ink-dim`,children:O(e)}),(0,J.jsx)(`span`,{className:`break-words text-sm font-medium text-ink`,children:e.title})]}),e.description&&(0,J.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs text-ink-dim`,children:e.description}),(0,J.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:D(e)}),e.updated>0&&(0,J.jsx)(`time`,{className:`mt-1 block text-[11px] text-ink-faint`,dateTime:new Date(e.updated*1e3).toISOString(),children:new Date(e.updated*1e3).toLocaleString(i)})]},e.id))]})]}),(0,J.jsx)(`article`,{className:`${y?`block`:`hidden md:block`} min-w-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:y?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,className:`mb-4 text-sm text-blue md:hidden`,onClick:()=>m(null),children:a?`← 返回列表`:`← Back to the list`}),(0,J.jsx)(`h3`,{className:`break-words text-lg font-semibold text-ink`,children:y.title}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[O(y),` · `,D(y)]}),(0,J.jsx)(`p`,{className:`mt-1 break-all text-xs text-ink-faint`,children:y.path}),b&&(0,J.jsx)(er,{item:b}),x&&j&&(0,J.jsx)($n,{item:x,guide:j}),(0,J.jsx)(`div`,{className:`mt-5 border-t border-line/60 pt-5 text-sm text-ink`,children:y.kind===`knowledge`||y.kind===`skill`?(0,J.jsxs)(J.Fragment,{children:[k.isPending&&(0,J.jsx)(`p`,{children:a?`正在加载全文…`:`Loading document…`}),k.isError&&(0,J.jsxs)(`p`,{role:`alert`,className:`text-err`,children:[k.error.message,` `,(0,J.jsx)(`button`,{className:`underline`,onClick:()=>void k.refetch(),children:a?`重试`:`Retry`})]}),b&&S.data?.truncated&&(0,J.jsx)(`p`,{role:`status`,className:`mb-3 text-xs text-ink-faint`,children:a?`页面过长,已截断显示。`:`Page shortened for display.`}),k.data&&(j?(0,J.jsxs)(`details`,{children:[(0,J.jsx)(`summary`,{className:`cursor-pointer py-2 text-blue`,children:a?`查看原始技能文档`:`Read the original skill`}),(0,J.jsx)(H,{children:k.data.content})]}):(0,J.jsx)(H,{children:k.data.content}))]}):(0,J.jsx)(H,{children:y.content})})]}):(0,J.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-ink-faint`,children:[(0,J.jsx)(K,{size:18,"aria-hidden":`true`}),a?`选择资料,阅读原文与使用条件。查看不会执行技能。`:`Select material to read its original and conditions. Reading does not execute a skill.`]})})]})]})}var gr=[{value:`copilot`,label:`settings.backendLabel.copilot`},{value:`codex`,label:`settings.backendLabel.codex`},{value:`claude`,label:`settings.backendLabel.claude`},{value:`cursor`,label:`settings.backendLabel.cursor`},{value:`opencode`,label:`settings.backendLabel.opencode`},{value:`pi`,label:`settings.backendLabel.pi`},{value:`grok`,label:`settings.backendLabel.grok`},{value:`qoder`,label:`settings.backendLabel.qoder`},{value:`dsh`,label:`settings.backendLabel.dsh`}],_r={copilot:`copilot`,codex:`codex`,claude:`claude`,cursor:`cursor`,opencode:`opencode`,pi:`pi`,grok:`grok`,qoder:`qoder`,dsh:`dsh`};function vr(e){return _r[e]??``}function yr(e,t){let n=vr(e);return n?t(`settings.backendLabel.${n}`):e}function br(e){return e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.value??e?.roles[0]?.backend??``}function xr(e){let t=e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.source??``;return t===`env`||t===`persisted`||t==="default"?t:``}function Sr(e){return(e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.saved??``).trim()}function Cr(e){return typeof e==`string`&&/^[\p{L}\p{N}_-][\p{L}\p{N}_.-]{0,127}$/u.test(e)}function wr(e){return e===void 0?{}:Cr(e)?{sessionId:e}:null}function Tr(e,t){return typeof e==`string`?e.trim().slice(0,t):``}function Er(e,t){return Tr(e,t*2).replace(/!?(?:\[([^\]]+)\])\([^)]+\)/g,`$1`).replace(/[*_`#]/g,``).replace(/\s+/g,` `).trim().slice(0,t)}function Dr(e){let t=Tr(e.completionId,300),n=wr(e.sessionId);if(!t||!n)return null;let r=Tr(e.path,1e3);return{...n,deliveryId:t,title:Er(e.title,240)||`已完成的任务`,summary:Er(e.summary,500),...r?{path:r}:{}}}function Or(e,t){let n=Tr(e.delivery_id,300),r=wr(t);return!n||!r?null:{...r,deliveryId:n,title:Tr(e.title,240)||`Argus`,summary:Tr(e.summary,1e3),...e.primary_target?.path?{path:Tr(e.primary_target.path,1e3)}:{}}}function kr(){return typeof window>`u`||window.parent===window?null:window.parent}function Ar(){return kr()!==null}function jr(){kr()?.postMessage({type:`argus:show-trial-setup`},`*`)}function Mr(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=Tr(t.deliveryId,300),r=wr(t.sessionId);if(!n||!r)return null;let i=Tr(t.path,1e3);return{...r,deliveryId:n,title:Tr(t.title,240)||`Argus`,summary:Tr(t.summary,1e3),...i?{path:i}:{}}}function Nr(e){let t=Mr(e),n=kr();return!t||!n?Promise.resolve(!1):(n.postMessage({type:`argus:notify-completion`,payload:t},`*`),Promise.resolve(!0))}function Pr(e){let t=kr();t&&t.postMessage({type:`argus:large-preview`,payload:e},`*`)}function Fr(e){let t=typeof window<`u`?window.location?.ancestorOrigins?.[0]:void 0;if(t&&t!==`null`)return e===t;if(typeof document<`u`&&document.referrer)try{let t=new URL(document.referrer);if(t.protocol===`http:`||t.protocol===`https:`)return e===t.origin;if(t.protocol===`tauri:`&&t.hostname===`localhost`)return e===`tauri://localhost`}catch{}return[`http://tauri.localhost`,`https://tauri.localhost`,`tauri://localhost`].includes(e)}function Ir(e){let t=kr();if(!t)return()=>void 0;let n=n=>{if(n.source!==t||!Fr(n.origin)||n.data?.type!==`argus:open-delivery`)return;let r=Mr(n.data.payload);r&&e(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function Lr(e){let t=kr();if(!t)return()=>void 0;let n=n=>{n.source===t&&n.data?.type===`argus:new-chat`&&e()};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function Rr(){if(typeof document>`u`)return()=>void 0;let e=kr();if(!e)return()=>void 0;let t=t=>{if(t.defaultPrevented||t.button!==0&&t.button!==1)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null;if(!n)return;let r;try{r=new URL(n.href,window.location.href)}catch{return}r.origin===window.location.origin||![`http:`,`https:`].includes(r.protocol)||(t.preventDefault(),e.postMessage({type:`argus:open-external`,payload:r.toString()},`*`))},n=t=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.shiftKey||!(t.ctrlKey||t.metaKey))return;let n=t.key===`,`?`argus:show-setup`:t.key.toLowerCase()===`n`?`argus:request-new-chat`:null;n&&(t.preventDefault(),e.postMessage({type:n},`*`))},r=()=>e.postMessage({type:`argus:cockpit-interaction`},`*`);return document.addEventListener(`click`,t,!0),document.addEventListener(`auxclick`,t,!0),window.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r,{passive:!0}),()=>{document.removeEventListener(`click`,t,!0),document.removeEventListener(`auxclick`,t,!0),window.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}}var zr=21600,Br=e=>!e||[`auto`,`inherit`,`default`].includes(e.toLowerCase());function Vr({sid:e,roles:t,running:n,lastCall:r,onOpenSettings:i}){let{locale:a,t:o}=z(),{data:s}=Me(e,!0),c=a===`zh-CN`,l=(n?t.find(e=>e.active):void 0)??t.find(e=>e.role===`manager`),u=s?.trial_mode===!0,d=!!r&&(n||Date.now()/1e3-(r.ts||0)e.role===f.role):void 0,_=g&&g.backend&&g.backend!==f?.backend?g.backend:``,v=g&&!Br(g.model)&&g.model!==f?.model?g.model:``,y=_||v?[yr(_||g.backend,o),v||g.model||`auto`].join(` · `):``,b=(0,J.jsxs)(J.Fragment,{children:[u?c?`试用`:`Trial`:p?yr(p,o):c?`模型信息待确认`:`Model information unavailable`,m?` · ${m}`:``,h?` · ${h}`:``,!u&&!f&&n&&l?.active?` · ${gt(l.role)?Ve(l.role,o):l.role}`:``]}),x=f?c?`最近一次模型调用实际使用的后端、模型和推理强度;点击更改`:`Backend, model and effort the latest model call actually used; click to change`:c?`当前配置的后端与模型;点击更改`:`Configured backend and model; click to change`;return(0,J.jsxs)(`div`,{className:`composer-runtime`,"aria-label":c?`当前后端与模型`:`Current backend and model`,children:[i&&!u?(0,J.jsxs)(`button`,{type:`button`,className:`composer-runtime-model`,onClick:i,title:x,"data-runtime-open-settings":!0,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}):(0,J.jsxs)(`span`,{className:`composer-runtime-model`,title:u?void 0:x,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}),(0,J.jsxs)(`details`,{className:`composer-runtime-details`,children:[(0,J.jsx)(`summary`,{children:c?`运行信息`:`Runtime details`}),(0,J.jsx)(`div`,{children:b})]}),y?(0,J.jsx)(`span`,{className:`composer-runtime-next`,"data-runtime-next":!0,children:c?`下次使用:${y}`:`next call: ${y}`}):null,u&&Ar()?(0,J.jsx)(`button`,{type:`button`,onClick:jr,children:c?`更换 Key`:`Change Key`}):null]})}function Hr({session:e}){let{locale:t}=z(),n=t===`zh-CN`,r=n?`会话目录`:`Session directory`,i=e.workdir||e.cwd||(n?`待确认`:`Pending confirmation`);return(0,J.jsxs)(`details`,{className:`session-workdir`,"data-session-workdir":!0,children:[(0,J.jsxs)(`summary`,{title:`${r}: ${i}`,"aria-label":`${r}: ${i}`,children:[(0,J.jsx)(`span`,{children:r}),(0,J.jsx)(`code`,{children:i})]}),(0,J.jsxs)(`div`,{className:`session-workdir__detail`,children:[(0,J.jsx)(`strong`,{children:r}),(0,J.jsx)(`code`,{children:i}),(0,J.jsx)(`p`,{children:n?`来自已加载会话快照的工作目录;不是每个任务的实际 cwd,也不是安全沙箱边界。`:`Working directory from the loaded session snapshot; not each task’s actual cwd or a security sandbox boundary.`})]})]})}function Ur(e){return!Number.isFinite(e)||e<=0?`$0.00`:e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(3)}`}function Wr({settledUsd:e,knownUsd:t=0,status:n=`empty`}){let r=typeof e==`number`&&Number.isFinite(e)?e:t,i=n===`partial`||n===`unpriced`;return`${Ur(Math.max(0,r||0))}${i?`+`:``}`}function Gr({settledUsd:e,knownUsd:t,status:n,calls:r=0,premiumRequests:i=0,live:a=!1,compact:o=!1}){let s=Wr({settledUsd:e,knownUsd:t,status:n}),c=[`Cumulative settled project spend`,`${r} model call${r===1?``:`s`}`,i>0?`${i.toFixed(1)} premium requests`:``,n&&n!==`empty`?`pricing: ${n}`:``].filter(Boolean).join(` · `);return(0,J.jsxs)(`span`,{title:c,"aria-label":`Project spend ${s}`,className:`inline-flex shrink-0 items-center rounded-full border border-gold/25 bg-gold/8 font-mono tabular-nums text-gold ${o?`h-6 gap-1 px-2 text-[10px]`:`h-5 gap-1 px-1.5 text-[9px]`}`,children:[a?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-gold/80`}):null,(0,J.jsx)(`span`,{children:s})]})}var Kr=e=>String(e??``).trim(),qr=/^[a-z][a-z -]+ requires an operator-owned decision before continuing\.?$/i,Jr=e=>{let t=Kr(e);return qr.test(t)?``:t},Yr=(e,t)=>{let n=/[\u3400-\u9fff]/.test(`${e}\n${t}`);return{id:`custom`,label:n?`自己输入`:`Write my own answer`,description:n?`直接告诉 Argus 你的决定。`:`Tell Argus your decision directly.`,requires_note:!0}};function Xr(e,t,n){let r=[...e,...t],i=new Map(t.map(e=>[Kr(e.id),e])),a=(e,t)=>{let n=i.get(e)??(Kr(t.id)===e?t:void 0);return{task_title:Kr(n?.title)||void 0,task_status:Kr(n?.status)||void 0}},o=[],s=new Set;for(let e of r){let t=Kr(e.id),n=e.operator_decision;if(n&&typeof n==`object`&&!Array.isArray(n)){let r=n,i=Kr(r.id);if(!i||s.has(i)||Kr(r.status)!==`pending`)continue;s.add(i);let c=Kr(r.options_source),l=r.kind===`domain_intake`,u=(c===`agent`||l&&c===`workflow`)&&Array.isArray(r.options)?r.options.filter(e=>!!Kr(e?.id)&&!!Kr(e?.label)).map(e=>({...e,requires_note:e.requires_note===!0})):[];u.some(e=>e.id===`custom`)||u.push(Yr(Kr(r.title),Kr(r.question)));let d=Kr(r.item_id)||t;o.push({id:i,...l?{kind:`domain_intake`}:{},item_id:d,revision:Number(r.revision??1),status:`pending`,title:Kr(r.title)||Kr(e.title)||`Decision required`,reason:Jr(r.reason),question:Kr(r.question)||Kr(e.pending_question),evidence:Array.isArray(r.evidence)?r.evidence.filter(e=>Kr(e?.label)!==`Acceptance check`):[],options:u,options_source:l?`workflow`:u.length?`agent`:`none`,selected_option:``,note:``,...a(d,e),...l?{task_title:Kr(r.task_title),task_status:void 0}:{},...typeof r.asked_at==`number`&&Number.isFinite(r.asked_at)&&r.asked_at>0?{asked_at:r.asked_at}:{}});continue}let r=Kr(e.pending_question??e.question??e.text);if(!t||!r)continue;let i=`legacy-${t}`;s.has(i)||(s.add(i),o.push({id:i,item_id:t,revision:1,status:`pending`,title:Kr(e.title??e.objective)||`Blocked task`,reason:``,question:r,evidence:[],options:[Yr(Kr(e.title??e.objective),r)],options_source:`none`,selected_option:``,note:``,legacy:!0,...a(t,e)}))}if(!n)return o;let c=o.map(e=>({...e,is_current_task:e.kind===`domain_intake`?void 0:e.item_id===n}));return[...c.filter(e=>e.kind===`domain_intake`),...c.filter(e=>e.is_current_task),...c.filter(e=>e.kind!==`domain_intake`&&!e.is_current_task)]}function Zr(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function Qr(e,t,n=``){let r=Zr(n,70);switch(e){case`manager`:return t?`正在整理任务进展`:`Summarizing progress`;case`planner`:return t?`正在安排接下来要做的事`:`Planning what to do next`;case`reviewer`:return r?t?`正在检查结果:${r}`:`Checking the result: ${r}`:t?`正在检查结果是否正确`:`Checking whether the result is correct`;default:return r?t?`正在处理:${r}`:`Working on: ${r}`:t?`正在处理当前任务`:`Working on the current task`}}var $r=new Set([`running`,`in_progress`,`claimed`,`active`,`working`,`grounding`,`framed`]),ei=new Set([`complete`,`completed`,`done`,`success`,`ended`]),ti=new Set([`paused`,`stopped`,`cancelled`,`aborted`,`incomplete`,`blocked`,`stalled`]),ni=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:null;function ri(e){return String(e.item_id||e.mission_id||``).split(`:attempt:`)[0]}function ii(e,t,n){let r=e?.backlog?.find(e=>e.id===n),i=Date.parse(e?.daemon.started_at_iso||``)/1e3;return Math.max(t?.mission.id===n&&t.mission.started_at||0,r?.started_ts||0,Number.isFinite(i)?i:0)}function ai(e,t=0){let n=new Map;for(let r of e){if(Number(r.ts||0)oi.has(String(e.type||``))&&ri(e)===t.id&&Number(e.ts||0)>=r);e?.type===`round.external_work_wait.started`&&(i=String(e.work_id||``)),a=e?.type===`round.external_work_wait.completed`}else return null;if(a)return null;let o=(e.background_work||[]).find(e=>i&&e.work_id===i||e.waited_by?.includes(t.id));return o?{workId:o.work_id,parts:(o.parts||[]).map(e=>({role:e.role,done:e.done,total:e.total,running:e.running})),done:o.done,total:o.total,lastProgressAt:ni(o.last_progress_ts)}:i?{workId:i,parts:[],done:0,total:0,lastProgressAt:null}:null}function ci(e,t,n=[],r=Date.now()/1e3){let i=t?.mission.id||e?.backlog?.find(e=>$r.has(e.status)||e.status===`paused_external_work`)?.id||``,a=e?.backlog?.find(e=>e.id===i),o=ii(e,t,i),s=e?.roles?.filter(e=>e.active)||[],c=(e?.backlog?.filter(e=>$r.has(e.status)).length||0)>1,l=new Map;for(let e of t?.role_work||[])i&&(e.item_id||e.mission_id)!==i||e.ts$r.has(e.status)).sort((e,t)=>t.ts-e.ts).find(e=>s.some(t=>t.role===e.role))?.role||(c?``:(s.find(e=>e.role===t?.active_role)||s[0])?.role)||(e?``:t?.roles.find(e=>e.status===`active`)?.role)||``,d=n.filter(e=>{let t=ri(e);return(!i||t===i)&&Number(e.ts||0)>=o&&!String(e.run_label||``).startsWith(`map-summary`)&&/(?:progress|round\.(?:main|review)|life\.(?:mission|phase)|work\.segment)/.test(String(e.type||``))}).map(e=>ni(e.ts));for(let e of t?.role_work||[]){let t=e.item_id||e.mission_id;(!i||t===i)&&e.ts>=o&&e.kind!==`waiting`&&![`waiting`,`idle`].includes(e.status)&&d.push(ni(e.ts))}let f=d.filter(e=>e!==null&&e<=r+5),p=f.length?Math.max(...f):null,m={state:`idle`,role:u,taskId:i,title:t?.mission.title||a?.title||t?.mission.objective||``,activityAt:p,activityAgeSeconds:p===null?null:Math.max(0,r-p),reason:``};if(!e||e.daemon.read_status===`error`)return{...m,state:`unknown`};if(e.manager_requests?.some(e=>e.status===`running`)??!1){let e=ni(ai(n)?.ts)??p;return{...m,state:`running`,role:`manager`,foreground:!0,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}if(!i){let e=[...n].reverse().find(e=>e.type===`ui.argus`&&e.mission_result===!0&&!e.item_id&&e.live!==!0);if(e){let t=ni(e.ts);return{...m,state:`step_finished`,activityAt:t,activityAgeSeconds:t===null?null:Math.max(0,r-t),reason:e.success===!1?`task_failed`:``}}}let h=si(e,a,n,o);if(h){let e=h.lastProgressAt??p;return{...m,state:`waiting`,role:``,reason:`background_work`,waitingOn:h,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}let g=String(a?.status||t?.mission.status||``).toLowerCase();if(ti.has(g)||g.startsWith(`paused_`)||g===`research_incomplete`){let t=Xr(e.pending_questions??[],e.backlog.map(e=>({...e})),i).some(e=>e.item_id===i);return{...m,state:`paused`,role:``,reason:t?`operator_input`:`not_running`}}if([`failed`,`error`].includes(g))return{...m,state:`step_finished`,role:``,reason:`task_failed`};if(ei.has(g))return e.daemon.alive&&s.some(e=>e.role===`planner`)?{...m,state:`running`,role:`planner`}:{...m,role:``,state:e.daemon.alive&&(t?.routing?.continuous||e.continuous?.enabled)?`waiting`:`step_finished`};if(!e.daemon.alive)return $r.has(g)?{...m,state:`paused`,role:``,reason:`not_running`}:{...m,role:``};let _=[...n].reverse().find(e=>e.type===`round.backend_failure.backoff`&&Number(e.ts||0)>=o&&(!i||ri(e)===i));return _&&Number(_.ts||0)+Number(_.seconds||0)>r&&Number(_.ts||0)>=(p||0)?{...m,state:`waiting`,reason:`provider_wait`}:e.daemon.health?.stalled?{...m,state:`waiting`,reason:`no_recent_progress`}:u?{...m,state:`running`}:c&&s.length>0&&i?{...m,state:`unknown`}:{...m,state:`waiting`,reason:`awaiting_next_step`}}function li(e,t){let n=t===`zh-CN`;return e===null?``:e<60?n?`刚刚`:`just now`:e<3600?n?`${Math.floor(e/60)} 分钟前`:`${Math.floor(e/60)} min ago`:n?`${Math.floor(e/3600)} 小时前`:`${Math.floor(e/3600)} hr ago`}var ui={"idea-route":[`条研究路线`,[`research route`,`research routes`]],"idea-review":[`次独立复核`,[`independent review`,`independent reviews`]],"idea-selector":[`次方案选择`,[`idea selection`,`idea selections`]]};function di(e,t){if(!e.total)return``;let[n,[r,i]]=ui[e.role]??[`项子任务`,[`subtask`,`subtasks`]],a=e.total===1?r:i;return e.done===e.total?t?`${e.total} ${n}全部完成`:`all ${e.total} ${a} done`:t?`${e.total} ${n}中 ${e.done} ${n.slice(0,1)}完成`:`${e.done} of ${e.total} ${a} done`}function fi(e,t){let n=t===`zh-CN`,r=e.waitingOn,i=(r?.parts??[]).map(e=>di(e,n)).filter(Boolean),a=i.length?i.join(n?`、`:`, `):r?.total?n?`${r.total} 项子任务中 ${r.done} 项完成`:`${r.done} of ${r.total} subtasks done`:``,o=li(e.activityAgeSeconds,t),s=o?n?o===`刚刚`?`,最近一次进展就在刚刚`:`,最近一次进展在 ${o}`:`, last progress ${o}`:``;return a?n?`正在等待后台团队:${a}${s}`:`Waiting for the background team: ${a}${s}`:n?`正在等待后台团队完成工作${s}`:`Waiting for the background team to finish${s}`}function pi(e,t,n=!0){let r=t===`zh-CN`;return n?e.reason===`operator_input`?r?`当前任务等待你的回复`:`This task is waiting for your reply`:e.reason===`task_failed`?r?`这一步执行未完成`:`Execution of this step did not finish`:e.reason===`background_work`?fi(e,t):e.state===`running`?e.foreground?r?`正在处理你的请求`:`Working on your request`:Qr(e.role,r,e.title):e.reason===`provider_wait`?r?`模型服务暂时未能完成请求,等待后会重试`:`The model service could not complete the request; waiting before retrying`:e.reason===`no_recent_progress`?r?`暂时没有收到新的进展`:`No new progress received recently`:{running:[`正在处理当前任务`,`Working on the current task`],waiting:[`等待下一步工作`,`Waiting for the next step`],paused:[`当前任务未在运行`,`The current task is not running`],step_finished:[`这一步已结束`,`This step has ended`],idle:[`可以开始新任务`,`Ready for a new task`],unknown:[`暂时无法确认任务进度`,`Unable to confirm task progress right now`]}[e.state][+!r]:r?`实时连接已断开`:`Live connection lost`}var mi=new Set([`grounding`,`task`,`decision`,`agent_message`,`assistant_message`,`command_execution`,`tool_use`,`tool_result`,`handoff`,`review`,`verdict`,`completion`,`plan`,`file_change`,`result`]),hi=/^(using a tool|running project command|inspecting project state|working|reporting progress|暂无详细记录)$/i;function gi(e){let t=pe(e).replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/gim,``).trim();return hi.test(t)||t.startsWith(`{`)?``:t}function _i(e,t,n=``){if(n){if(/^(?:rg|grep|glob|search)$/.test(n))return t?`检索项目文件`:`Searching project files`;if(/^(?:view|read|read_file)$/.test(n))return t?`读取文件`:`Reading a file`;if(/apply_patch|edit|write/.test(n))return t?`编辑文件`:`Editing a file`;if(/bash|shell|exec|terminal/.test(n))return t?`运行终端命令`:`Running a command`;if(/playwright|browser/.test(n))return t?`检查浏览器交互`:`Checking browser interactions`}return({grounding:[`理解任务与检查项目`,`Understanding the task`],task:[`安排任务`,`Task assignment`],decision:[`确定执行方案`,`Execution decision`],plan:[`制定执行计划`,`Planning the work`],agent_message:[`更新执行进度`,`Progress update`],assistant_message:[`更新执行进度`,`Progress update`],command_execution:[`运行项目命令`,`Running a project command`],tool_use:[`使用工具`,`Using a tool`],tool_result:[`工具输出`,`Tool output`],file_change:[`更新项目文件`,`Updating project files`],handoff:[`整理结果与后续工作`,`Summarizing results and next steps`],review:[`检查实现与结果`,`Checking implementation and results`],verdict:[`说明检查结果`,`Explaining the check result`],completion:[`完成任务`,`Task completed`],result:[`产出结果`,`Result`]}[e]??[`处理当前任务`,`Working on the current task`])[+!t]}function vi(e,t,n,r=0){let i=new Map;for(let a of e?.role_work??[]){if(a.role!==t||!mi.has(a.kind)||a.tst.ts-e.ts)}function yi(e,t,n,r=0){return[...e].reverse().find(e=>e.type===`engineer.progress`&&Number(e.ts||0)>=r&&[`tool_use`,`command_execution`,`file_change`].includes(String(e.kind))&&String(e.agent_layer||e.actor||e.role)===t&&(!n||String(e.item_id||e.mission_id)===n))}function bi(e,t,n,r,i){return r||[`done`,`completed`,`failed`,`aborted`,`stopped`].includes(e?.mission.status??``)||i&&e?.mission.id!==i?!1:t.length?t.some(e=>e.role===n&&e.active):e?.active_role===n&&[`working`,`grounding`,`framed`,`running`].includes(e?.mission.status??``)}function xi(e,t){let n=Math.max(0,Math.floor(e));if(n<30)return``;let[r,i,a]=n<60?[n,`秒`,`s`]:n<3600?[Math.floor(n/60),`分钟`,`m`]:n<86400?[Math.floor(n/3600),`小时`,`h`]:[Math.floor(n/86400),`天`,`d`];return t?`上次更新 ${r} ${i}前`:`last update ${r}${a} ago`}function Si(e,t,n,r,i=!0,a=0){let o=pi(e,r,i);if(!i||e.state!==`running`||e.foreground||!e.taskId||!e.role)return o;let s=Math.max(a,t?.mission.id===e.taskId&&t.mission.started_at||0),c=vi(t,e.role,e.taskId,s).find(e=>e.detail&&[`agent_message`,`assistant_message`].includes(e.kind)||[`tool_use`,`command_execution`,`file_change`].includes(e.kind)),l=yi(n,e.role,e.taskId,s);if(c?.detail&&[`agent_message`,`assistant_message`].includes(c.kind)&&(!l||Number(l.ts||0)=c.ts)){let t=_i(String(l.kind),r===`zh-CN`,String(l.tool_name||``));return e.title?`${t}${r===`zh-CN`?`:`:`: `}${Zr(e.title,70)}`:t}return c&&[`tool_use`,`command_execution`,`file_change`].includes(c.kind)?_i(c.kind,r===`zh-CN`):o}var Ci=new Set([`running`,`in_progress`,`claimed`]);function wi({snap:e,streamOk:t,onStart:n,onStop:r,onManage:i,onOpenSessions:a,mobileView:s,onToggleMobileView:c,busy:u,snapshotStale:d=!1,readOnly:f=!1,missionView:p,events:m=[]}){let{t:h,locale:g}=z(),_=ci(e,p,m),v=Si(_,p,m,g,t,ii(e,p,_.taskId)),y=[`complete`,`completed`,`done`,`success`].includes(String(p?.mission.status||``).toLowerCase()),b=_.role||`manager`,x=_.state===`running`&&t&&!d,S=e.backlog.find(e=>Ci.has(e.status)),C=_.title||S?.title||S?.objective||(y?p?.mission.summary||p?.mission.title:``)||e.session.objective||``,w=!!(e.partial||e.observability?.slo.status===`degraded`),T=typeof e.spend_usd==`number`?e.spend_usd:e.usage_summary?.known_cost_usd??0,E=e.daemon.alive&&e.daemon.control_available===!1,O=!e.daemon.alive&&[`running`,`waiting`].includes(ci(e,p,m).state),k=E?h(`topbar.externallyManaged`):e.daemon.alive?h(`topbar.pauseDaemon`):h(O?`topbar.working`:`topbar.runDaemon`),A=w?[...(e.diagnostics??[]).map(e=>`${e.section}: ${e.message}`),...e.observability?.slo.violations??[]].join(` +`)||h(`common.degraded`):h(d?`common.stale`:t?`common.live`:`common.reconnecting`);return(0,J.jsxs)(mt,{children:[a?(0,J.jsx)(`button`,{type:`button`,onClick:a,"aria-label":h(`topbar.openSessions`),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-ink-faint hover:bg-bg hover:text-ink lg:hidden`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M2.5 4h11M2.5 8h11M2.5 12h11`})})}):null,(0,J.jsxs)(`div`,{className:`topbar-heading flex min-w-0 flex-1 flex-col justify-center gap-0.5`,children:[(0,J.jsx)(`div`,{className:`topbar-title min-w-0 truncate text-sm font-semibold text-ink`,title:e.session.display_name||e.session.id,children:e.session.display_name||e.session.id}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[x?(0,J.jsx)(`span`,{"data-role-dot":b,"aria-label":h(`topbar.roleActive`,{role:zn(b,h)}),className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:B.role[b]||`rgb(var(--ink-faint))`}}):null,x||C?(0,J.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-ink-dim`,title:v,children:t?d?h(`common.stale`):v:h(`common.reconnecting`)}):null,(0,J.jsx)(Hr,{session:e.session})]})]}),(0,J.jsx)(`span`,{title:A,className:`h-2 w-2 shrink-0 rounded-full transition-shadow duration-150 ${w||d?`bg-err ring-1 ring-err/30 ring-offset-1 ring-offset-panel`:t?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,children:(0,J.jsx)(`span`,{className:`sr-only`,children:A})}),T>0?(0,J.jsx)(Gr,{settledUsd:e.spend_usd,knownUsd:e.usage_summary?.known_cost_usd,status:e.spend_status,calls:e.usage_summary?.call_count,premiumRequests:e.usage_summary?.premium_requests,live:e.daemon.alive,compact:!0}):null,c?(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":h(s===`activity`?`topbar.showPreview`:`topbar.showActivity`),title:h(s===`activity`?`topbar.showPreview`:`topbar.showActivity`),className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center lg:hidden`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:s===`activity`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`11`,rx:`1.5`}),(0,J.jsx)(`path`,{d:`M9.5 2.75v10.5`})]}):(0,J.jsx)(`path`,{d:`M3 4h10M3 8h10M3 12h7`})})}):null,f?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,disabled:u||E||O,onClick:e.daemon.alive?r:n,"aria-label":k,title:E?h(`topbar.externalDaemonHint`):k,className:`compact-control flex h-8 shrink-0 items-center gap-1 px-2 disabled:opacity-40`,children:[(0,J.jsx)(o,{icon:e.daemon.alive?l:D,className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:E?h(`common.external`):e.daemon.alive?h(`common.pause`):h(O?`common.working`:`common.run`)})]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":h(`topbar.manageSession`),title:h(`topbar.manageSession`),onClick:i,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center text-sm tracking-widest`,children:`···`})]})]})}var Ti=new Set([`running`,`in_progress`,`claimed`]);function Ei(e,t){let n;for(let r of t)r.item_id!==e.id||![`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.mission.orphaned`].includes(r.type)||(!n||r.ts>=n.ts)&&(n=r);if(n?.type===`life.mission.completed`&&!(n.ts(t.status===`done`||Ti.has(t.status))&&(t.ts??0)>e?t.ts??0:e,0)}function Oi(e,t){return e.status===`failed`&&!e.pending_question&&(e.ts??0)t.status!==`done`&&!Ti.has(t.status)&&(t.pending_question||t.status===`failed`&&!Oi(t,e))).sort((e,t)=>Number(!!t.pending_question)-Number(!!e.pending_question))}function Ai(e){return e.find(e=>Ti.has(e.status))??ki(e)[0]??e.find(e=>e.status===`pending`)??e.at(-1)}function ji(e,t){let n=new Set,r=new Set;for(let i of e.links)i.kind===`dependency`&&(i.target===t&&n.add(i.source),i.source===t&&r.add(i.target));return{upstream:e.tasks.filter(e=>n.has(e.id)),downstream:e.tasks.filter(e=>r.has(e.id))}}function Mi(e){return e.status===`cancelled`?`aborted`:e.pending_question?`question`:Ti.has(e.status)?`running`:e.outcome?.review_status===`unavailable`?`review_unavailable`:e.status===`failed`&&Ni(e)?`held`:e.status.startsWith(`paused`)||e.status===`blocked`?`paused`:[`done`,`failed`,`aborted`,`skipped`,`superseded`,`pending`,`missing`].includes(e.status)?e.status:`unknown`}function Ni(e){return e.outcome?.stage_certification===`not_certified`||!e.outcome?.execution_status&&/^manager stage hold:/i.test(e.last_error||``)}function Pi(e,t){let n=e=>t.some(t=>t.type===`life.mission.started`&&t.ts>e);return e.filter(e=>e.status===`done`&&e.outcome?.review_status===`done`&&e.outcome.stage_certification===`certified`).map(e=>({task:e,completion:Ei(e,t)})).filter(({completion:e})=>e?.overall_complete===!0&&!n(e.ts)).map(({task:e})=>e).sort((e,t)=>(t.finished_ts??t.ts??0)-(e.finished_ts??e.ts??0))[0]}function Fi(e){let t=new Set,n=[],r=new Map([...e.keys()].map(e=>[e,[]]));for(let[t,n]of e)for(let e of n)r.get(e).push(t);for(let r of e.keys()){let i=[[r,!1]];for(;i.length;){let[r,a]=i.pop();if(a)n.push(r);else if(!t.has(r)){t.add(r),i.push([r,!0]);for(let n of e.get(r))t.has(n)||i.push([n,!1])}}}let i=new Map;for(let e of n.reverse()){if(i.has(e))continue;let t=i.size,n=[e];for(;n.length;){let e=n.pop();if(!i.has(e)){i.set(e,t);for(let t of r.get(e))n.push(t)}}}return i}function Ii(e){let t=new Map(e.map(e=>[e.id,e])),n=[...t.values()].sort((e,t)=>(e.ts??0)-(t.ts??0)||e.id.localeCompare(t.id)),r=[],i=new Set;for(let e of n)for(let n of new Set(e.deps??[]))t.has(n)||i.add(n),r.push({id:JSON.stringify([`dep`,n,e.id]),source:n,target:e.id,kind:`dependency`,missing:!t.has(n)});let a=[...[...i].map(e=>({id:e,title:`未包含的依赖`,objective:`该引用不在当前数据范围内。`,status:`missing`,deps:[],role:`system`})),...n],o=new Map(a.map(e=>[e.id,0])),s=new Map(a.map(e=>[e.id,[]]));r.forEach(e=>{o.set(e.target,(o.get(e.target)??0)+1),s.get(e.source)?.push(e.target)});let c=a.filter(e=>o.get(e.id)===0).map(e=>e.id),l=0;for(let e=0;et.id!==e.id&&t.plan_id===e.superseded_by_plan_id);t.length&&r.push({id:JSON.stringify([`replacement`,e.id,e.superseded_by_plan_id]),source:e.id,target:t[0].id,kind:`replacement`,target_plan_id:e.superseded_by_plan_id,target_count:t.length})}if(u){let e=Fi(s);r.filter(t=>t.kind===`dependency`&&e.get(t.source)===e.get(t.target)).forEach(e=>{e.cycle=!0})}return{tasks:a,links:r,missing:i.size,cyclic:u}}function Li(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function Ri(e){return e?.match(/route[-_ ]?(\d+)/i)?.[1]??e?.match(/(\d+)\s*$/)?.[1]??``}function zi(e,t){if(!e)return``;if(e.kind===`review`)return e.verdict===`rejected`?t?`复核:驳回`:`Review: rejected`:e.verdict===`qualified`?t?`复核:通过`:`Review: qualified`:``;if(e.kind===`route`)return e.selected?t?`通过 · 被选中`:`Qualified · chosen`:e.verdict===`rejected`?t?`驳回`:`Rejected`:e.verdict===`qualified`?e.selected===!1?t?`通过 · 未选中`:`Qualified · not chosen`:t?`通过`:`Qualified`:``;let n=Ri(e.selected_route);return n?t?`已选研究路线 ${n}`:`Chose route ${n}`:``}function Bi(e){return e?e.kind===`selection`?e.selected_route?`chosen`:``:e.selected?`chosen`:e.verdict??``:``}function Vi(e){let t=String(e||``).split(/\r?\n/).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY|NEXT_ACTION)\s*=\s*/i,``).trim()).filter(e=>e&&!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e)).join(` `);return t.length>160?`${t.slice(0,159)}…`:t}function Hi(e){let t=new Map;for(let n of e){if(n.type!==`idea.portfolio.formed`)continue;let e=Number(n.width);if(!Number.isInteger(e)||e<=0)continue;let r=t.get(n.item_id);(!r||n.ts>=r.ts)&&t.set(n.item_id,{ts:n.ts,width:e})}return new Map([...t].map(([e,t])=>[e,t.width]))}function Ui(e,t,n,r=16){let i=new Map;for(let e of t){if(e.type!==`team.task`||!e.item_id)continue;let t=i.get(e.item_id)??new Map;t.set(e.id,e),i.set(e.item_id,t)}if(!i.size)return e;let a=new Set(e.tasks.map(e=>e.id)),o=[],s=[];for(let t of e.tasks){if(t.branch)continue;let e=[...i.get(t.id)?.values()??[]].filter(e=>!a.has(e.id)).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));if(!e.length)continue;let c=e.slice(0,r),l=new Set(c.map(e=>e.id));for(let e of c)a.add(e.id),o.push({id:e.id,title:Li(e,n),objective:Vi(e.text),excerpt:Vi(e.text),status:e.status||`unknown`,deps:[],pending_question:e.pending_question,role:`team`,team_role:e.team_role,...e.team_outcome?{team_outcome:e.team_outcome}:{},ts:e.ts,branch:!0,parent_id:t.id});let u=new Set(c.flatMap(e=>(e.deps??[]).filter(t=>l.has(t)&&t!==e.id)));for(let e of c){let n=[...new Set(e.deps??[])].filter(t=>l.has(t)&&t!==e.id);if(n.length)for(let t of n)s.push({id:JSON.stringify([`fanout`,t,e.id]),source:t,target:e.id,kind:`fanout`});else s.push({id:JSON.stringify([`fanout`,t.id,e.id]),source:t.id,target:e.id,kind:`fanout`});u.has(e.id)||s.push({id:JSON.stringify([`fanin`,e.id,t.id]),source:e.id,target:t.id,kind:`fanin`})}let d=e.length-c.length,f=`team-overflow:${t.id}`;d>0&&!a.has(f)&&(a.add(f),o.push({id:f,title:n?`还有 ${d} 条`:`+${d} more`,objective:n?`更多并行子任务收录在所属任务卡片中。`:`The remaining parallel subtasks live inside the owning card.`,status:`recorded`,deps:[],role:`team`,ts:e[r]?.ts,branch:!0,parent_id:t.id,overflow_count:d}),s.push({id:JSON.stringify([`fanout`,t.id,f]),source:t.id,target:f,kind:`fanout`},{id:JSON.stringify([`fanin`,f,t.id]),source:f,target:t.id,kind:`fanin`}))}return o.length?{...e,tasks:[...e.tasks,...o],links:[...e.links,...s]}:e}var Wi={"idea-route":[e=>`${e} 条研究路线`,e=>`${e} research route${e===1?``:`s`}`],"idea-review":[e=>`${e} 次独立复核`,e=>`${e} independent review${e===1?``:`s`}`],"idea-selector":[e=>`${e} 次方案选择`,e=>`${e} idea selection${e===1?``:`s`}`]},Gi=[e=>`${e} 个并行子任务`,e=>`${e} parallel subtask${e===1?``:`s`}`],Ki={pending:[`尚未开始`,`have not started`],running:[`正在进行`,`are under way`],done:[`已经完成`,`are complete`],failed:[`没有完成`,`did not finish`],question:[`在等待答复`,`are waiting for an answer`],paused:[`已暂停`,`are paused`],superseded:[`已被新计划替代`,`were replaced by a new plan`],aborted:[`已取消`,`were cancelled`],skipped:[`已跳过`,`were skipped`]};function qi(e,t,n){let r=e.map(({role:e,count:t})=>(Wi[e]??Gi)[+!n](t)),i=n?r.length>1?`${r.slice(0,-1).join(`、`)}与 ${r[r.length-1]}`:r[0]:r.length>1?`${r.slice(0,-1).join(`, `)} and ${r[r.length-1]}`:r[0],a=(Ki[t]??[`已记录在案`,`are on record`])[+!n];return n?`${i}${a}`:`${i} ${a}`}function Ji(e,t){let n=e.filter(e=>e.team_outcome?.kind===`route`),r=n.filter(e=>e.team_outcome?.selected).map(e=>Ri(e.title)),i=n.filter(e=>e.team_outcome?.verdict===`rejected`&&!e.team_outcome.selected).map(e=>Ri(e.title)),a=n.filter(e=>e.team_outcome?.verdict===`qualified`&&!e.team_outcome.selected).map(e=>Ri(e.title)),o=[],s=e=>[...e].sort().join(t?`、`:`, `);return r.length&&o.push(t?`路线 ${s(r)} 通过并被选中`:`route ${s(r)} qualified and chosen`),a.length&&o.push(t?`路线 ${s(a)} 通过${r.length?`但未被选中`:`,等待选择`}`:`route${a.length>1?`s`:``} ${s(a)} qualified${r.length?` but not chosen`:`, selection pending`}`),i.length&&o.push(t?`路线 ${s(i)} 被驳回`:`route${i.length>1?`s`:``} ${s(i)} rejected`),o.length?t?`:${o.join(`,`)}`:`: ${o.join(`; `)}`:``}function Yi(e,t,n,r=3){let i=new Map;for(let t of e.tasks){if(!t.branch||t.overflow_count||t.group||!t.parent_id)continue;let e=JSON.stringify([t.parent_id,Mi(t)]);(i.get(e)??i.set(e,[]).get(e)).push(t)}let a=new Set(e.tasks.map(e=>e.id)),o=new Map,s=new Map;for(let[e,c]of i){if(c.lengthe.role===t);n?n.count++:d.push({role:t,count:1})}let f=c[0],p=t.has(u);o.set(u,{id:u,title:qi(d,l,n)+Ji(c,n),objective:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,excerpt:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,status:f.status,deps:[],pending_question:f.pending_question,role:`team`,ts:f.ts,branch:!0,parent_id:i,group:{status:l,members:c.map(e=>e.id),counts:d,expanded:p}});for(let e of c)s.set(e.id,u)}if(!o.size)return e;let c=[],l=new Set;for(let n of e.tasks){let e=s.get(n.id);if(!e){c.push(n);continue}l.has(e)||(l.add(e),c.push(o.get(e))),t.has(e)&&c.push(n)}let u=[],d=new Set;for(let n of e.links){let e=s.get(n.source),r=s.get(n.target),i=n.source,a=n.target;if(e&&!t.has(e)&&(i=e),r&&!t.has(r)&&(a=r),r&&t.has(r)&&n.kind===`fanout`&&n.source===o.get(r).parent_id&&(i=r),i===a)continue;if(i===n.source&&a===n.target){u.push(n);continue}let c=JSON.stringify([n.kind,i,a]);d.has(c)||(d.add(c),u.push({...n,id:c,source:i,target:a}))}for(let[e,n]of o){if(!t.has(e))continue;let r=JSON.stringify([`fanout`,n.parent_id,e]);d.has(r)||(d.add(r),u.push({id:r,source:n.parent_id,target:e,kind:`fanout`}))}return{...e,tasks:c,links:u}}function Xi(e){return e.filter(e=>!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)).map(({source:e,target:t})=>({source:e,target:t}))}function Zi(e,t,n,r=[]){let i=(e,t)=>r.find(n=>n.source===e&&n.target===t&&n.label),a=e.links.map(e=>{if(e.kind!==`dependency`)return e;let r=t.find(t=>t.source===e.source&&t.target===e.target)??i(e.source,e.target);return r?{...e,label:r.label,stated:!0,evidence:`${n?`执行依赖`:`Execution dependency`} · ${r.label}`}:e}),o=new Map(e.tasks.map(e=>[e.id,e.id])),s=e=>{let t=o.get(e);return t===e?e:s(t)},c=(e,t)=>{o.set(s(e),s(t))};for(let e of a.filter(e=>e.kind===`dependency`))c(e.source,e.target);for(let n of t)!o.has(n.source)||!o.has(n.target)||e.tasks.findIndex(e=>e.id===n.source)>=e.tasks.findIndex(e=>e.id===n.target)||s(n.source)===s(n.target)||(a.push({source:n.source,target:n.target,label:n.label,kind:`semantic`,stated:!0,id:`semantic:${n.source}:${n.target}`}),c(n.source,n.target));for(let t=1;tQi+Math.min(500,Math.max(0,e-8)*60);function ta(e,t,n,r,i,a,o){let s=new Map(n.map(e=>[e,t[e].y+i[e].height/2]));for(let c=0;c<6;c++)for(let l of c%2?[...e].reverse():e){let e=new Set(l),c=[],u=[],d=0;l.forEach((f,p)=>{let m=s.get(f)*.8,h=.8;for(let o of a[r.get(f)]){let r=n[o.index];e.has(r)||(m+=(t[r].y+i[r].height/2)*o.weight,h+=o.weight)}c.push(d);let g=m/h-i[f].height/2-d;for(u.push({start:p,end:p,sum:g*h,weight:h});u.length>1;){let e=u[u.length-2],t=u[u.length-1];if(e.sum/e.weight<=t.sum/t.weight)break;e.end=t.end,e.sum+=t.sum,e.weight+=t.weight,u.pop()}d+=i[f].height+(p+1[e,t])),a=t.filter(e=>e.kind!==`replacement`&&e.source!==e.target).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:.4})),o=e.map(()=>[]),s=e.map(()=>[]),c=e.map(()=>[]);for(let e of a)o[e.source].push(e.target),s[e.target].push(e.source),c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let l=new Set(a.filter(e=>e.weight===1).map(e=>`${Math.min(e.source,e.target)}:${Math.max(e.source,e.target)}`)),u=(e,t)=>{let n=i.get(e),r=i.get(t);return l.has(`${Math.min(n,r)}:${Math.max(n,r)}`)?$i:$i*1.3},d=e.reduce((e,t)=>e+n[t].width*n[t].height,0),f=Math.sqrt(d/e.length),p=e.reduce((e,t)=>e+n[t].height,0)/e.length,m=Math.ceil(Math.sqrt(e.length)*1.8),h=e.map(()=>[]);for(let e of a)h[Math.max(e.source,e.target)].push(e);let g=e.map((t,n)=>{let r=0;return Array.from({length:Math.min(m,e.length-n)+1},(e,t)=>{if(t)for(let e of h[n+t-1])Math.min(e.source,e.target)1||s[e.target].length>1)&&(r+=e.weight*.9),r+=Math.max(0,Math.abs(e.target-e.source)-1)*e.weight);return r})}),_={},v=1/0,y=new Set;for(let t=1;t<=m;t++){let o=t*p+(t-1)*$i,l=Array(e.length+1).fill(1/0),m=Array(e.length+1).fill(0);l[0]=0;for(let r=1;r<=e.length;r++){let i=0;for(let a=r-1;a>=Math.max(0,r-t);a--){i+=n[e[a]].height+(a===r-1?0:$i);let t=g[a][r-a];a>0&&s[a].some(e=>s[a-1].includes(e))&&(t+=.7);let c=l[a]+.2+(i/o-1)**2+t;c0;t=m[t])h.unshift(e.slice(m[t],t));let b=JSON.stringify(h);if(y.has(b))continue;y.add(b);let x=h.map(e=>Math.max(...e.map(e=>n[e].width))),S=h.map(e=>e.reduce((e,t)=>e+n[t].height,0)+(e.length-1)*$i),C=x.reduce((e,t)=>e+t,0)+(h.length-1)*r,w=Math.max(...S),T={},E=0;h.forEach((e,t)=>{let i=(w-S[t])/2;e.forEach((r,a)=>{T[r]={x:E+(x[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1T[e].y));for(let t of e)T[t].y-=D;w=Math.max(...e.map(e=>T[e].y+n[e].height));let O=a.reduce((t,r)=>{let i=T[e[r.source]],a=T[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,a.length)/f,k=2*Math.log(C/w/2.1)**2+.08*C*w/d+.14*O+.08*l[e.length]/h.length;k[e,t])),a=e=>e.source!==e.target&&i.has(e.source)&&i.has(e.target),o=new Set,s=new Map;for(let e of t)!a(e)||e.kind!==`fanout`&&e.kind!==`fanin`||(e.kind===`fanout`?o.add(e.target):o.add(e.source),(s.get(e.source)??s.set(e.source,new Set).get(e.source)).add(e.target),(s.get(e.target)??s.set(e.target,new Set).get(e.target)).add(e.source));let c=e.map(()=>[]),l=t.filter(e=>e.kind!==`replacement`&&a(e)).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:e.kind===`fanout`||e.kind===`fanin`?.8:.4}));for(let e of l)c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let u=e.map(()=>[]);for(let e of t){if(!ra.has(e.kind)||!a(e))continue;let t=i.get(e.source),n=i.get(e.target);td[e]))+1:f+1;d.push(e),f=Math.max(f,e)}let p=[];e.forEach((e,t)=>{(p[d[t]]??=[]).push(e)});let m=p.filter(e=>e?.length),h=(e,t)=>o.has(e)&&o.has(t)?$i/2:$i,g=e=>e.reduce((t,r,i)=>t+n[r].height+(i?h(e[i-1],r):0),0),_=e.reduce((e,t)=>e+n[t].width*n[t].height,0),v=Math.sqrt(_/e.length),y=e.filter(e=>!o.has(e)),b=(y.length?y:e).reduce((e,t)=>e+n[t].height,0)/Math.max(1,y.length||e.length),x=Math.ceil(Math.sqrt(e.length)*1.8),S={},C=1/0,w=new Set;for(let t=1;t<=x;t++){let a=t*b+(t-1)*$i,u=[];for(let e of m){let t=[],n=()=>{if(!t.length)return;let e=o.has(t[0]);if(e)u.push({nodes:t,isBranch:e});else{let n=[];for(let r of t)n.length&&g([...n,r])>a&&(u.push({nodes:n,isBranch:e}),n=[]),n.push(r);n.length&&u.push({nodes:n,isBranch:e})}t=[]};for(let r of e)t.length&&o.has(t[0])!==o.has(r)&&n(),t.push(r);n()}let d=[],f=[];for(let e of u){let t=d.at(-1),n=t&&e.nodes.some(e=>t.some(t=>s.get(e)?.has(t)));!t||n||f.at(-1)!==e.isBranch||g([...t,...e.nodes])>a?(d.push([...e.nodes]),f.push(e.isBranch)):t.push(...e.nodes)}let p=JSON.stringify(d);if(w.has(p))continue;w.add(p);let y=d.map(e=>Math.max(...e.map(e=>n[e].width))),x=d.map(g),T=y.reduce((e,t)=>e+t,0)+(d.length-1)*r,E=Math.max(...x),D={},O=0;d.forEach((e,t)=>{let i=(E-x[t])/2;e.forEach((r,a)=>{D[r]={x:O+(y[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1D[e].y));for(let t of e)D[t].y-=k;E=Math.max(...e.map(e=>D[e].y+n[e].height));let A=l.reduce((t,r)=>{let i=D[e[r.source]],a=D[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,l.length)/v,j=2*Math.log(T/E/2.1)**2+.08*T*E/_+.14*A;j=e.length*.3?ia(e,t,n):na(e,t,n)}function oa(e){let t=new Map,n=new Map,r=new Map;return e.map(e=>{let i=`${e.source}\u0000${e.target}`,a=(t.get(e.source)??0)+(n.get(e.target)??0)-(r.get(i)??0);return t.set(e.source,(t.get(e.source)??0)+1),n.set(e.target,(n.get(e.target)??0)+1),r.set(i,(r.get(i)??0)+1),a})}function sa(e,t){if(e.x===t.x&&e.y===t.y)return{sourceHandle:`right`,targetHandle:`bottom`};let n=t.x+t.width/2-e.x-e.width/2,r=t.y+t.height/2-e.y-e.height/2,i=r>0?t.y-e.y-e.height:e.y-t.y-t.height,a=n>0?t.x-e.x-e.width:e.x-t.x-t.width;return i>=0&&a<0?r>=0?{sourceHandle:`bottom`,targetHandle:`top`}:{sourceHandle:`top`,targetHandle:`bottom`}:n>=0?{sourceHandle:`right`,targetHandle:`left`}:{sourceHandle:`left`,targetHandle:`right`}}function ca(e,t){return e?.type!==`life.mission.completed`||e.overall_complete!==!1&&e.campaign_continues!==!0||e.outcome?.execution_status===`completed`&&e.outcome.review_status===`done`?``:t?`当次执行已结束;当时总体目标尚未完成${e.campaign_continues===!0?`,仍需后续工作`:``}。`:`This execution ended; the overall goal was not complete at that time${e.campaign_continues===!0?` and further work remained`:``}.`}function la(e){let{total:t,qa:n=0,complete:r,ended:i=0,reviewUnavailable:a=0,held:o=0,running:s,pending:c,paused:l,hasOpenWork:u,role:d,current:f,waiting:p,zh:m}=e,h=t>0&&r===t&&i===0,g=n===t&&n>0?m?`已全部回答`:`all answered`:m?`已全部完成`:`all completed`,_=m?[t>n?`${t-n} 个任务`:``,n>0?`${n} 条问答`:``,r>0&&!h?`已完成 ${r} 个`:``,i>0?`${i} 个任务结束时目标还没完成`:``,a>0?`${a} 个结果尚未检查成功`:``,o>0?`${o} 个任务暂停,后续工作尚未安排`:``,s>1?`${s} 个任务同时进行`:``]:[t>n?`${t-n} ${t-n===1?`task`:`tasks`}`:``,n>0?`${n} Q&A`:``,r>0&&!h?`${r} done`:``,i>0?`${i} ended before their goals were complete`:``,a>0?`${a} ${a===1?`result has`:`results have`} not been checked successfully`:``,o>0?`${o} paused with no next step scheduled`:``,s>1?`${s} tasks in progress`:``],v=c?m?`正在处理你的消息`:`working on your message`:p||(l?h?g:u?m?`已暂停`:`paused`:t>0?m?`没有在进行的工作`:`nothing in progress`:m?`就绪`:`ready`:f||(d?Qr(d,m):h?g:``));return[..._,v].filter(Boolean).join(` · `)}var ua=[{match:/External interrupt|daemon (?:stop|shutdown)|stopped by its operator/i,bare:/^(?:Engineer interrupted because daemon shutdown|Argus was stopped by its operator|Reviewer backend returned no complete judgment \([^)]*External interrupt)/,kind:`interrupt`,zh:`运行被操作员停下,这一轮没有做完;这不是对工作本身的评价`,en:`Argus was stopped by its operator before this round could finish; this says nothing about the work itself`},{match:/no complete judgment|before reaching a judgment|reached a conclusion|did not reach a conclusion/i,bare:/^(?:Reviewer backend (?:returned no complete judgment|ended before reaching a judgment)|The Reviewer's session ended before it reached a conclusion|The review did not reach a conclusion)/,kind:`reviewer`,zh:`审阅者的会话在得出结论前就结束了,这一轮没有评审意见`,en:`The Reviewer's session ended before it reached a conclusion, so this round was not judged`},{bare:/^Engineer backend failed before a trustworthy completed turn/,kind:`reviewer`,zh:`模型服务在工程师做完之前断开了;Argus 会换一个新会话重试,审阅等到那时再做`,en:`The model service dropped the Engineer's session before it finished; Argus retries in a fresh session and the review waits until then`},{bare:/^Retry in a fresh (?:\w+ )?session/,zh:`Argus 会换一个新会话再试一次`,en:`Argus will try again in a fresh session`},{bare:/^Restart the daemon when ready/,zh:`重新启动后,Argus 会从项目留下的状态继续,选择下一项具体任务`,en:`Once Argus is started again it continues from the saved project state and picks the next concrete task`},{bare:/^engineer round \d+ \((?:fresh|rotated|resumed)[^)]*\)\s*$/i,kind:`round`,zh:`工程师开始了新的一轮工作`,en:`The Engineer began a new round of work`},{match:/provider[\s-]?turn/i,bare:/^(?:One Engineer call|\d+ Engineer sessions in a row each) used (?:its|their) whole per-call provider-turn allowance/,zh:`继续换了个新会话接着做,之前的进展都在`,en:`Continued in a fresh session; earlier progress is kept`},{match:/budget (limit|cap|exhausted)|blocking budget|预算上限/i,bare:/^Paused because this project reached its budget limit/,zh:`花费到了预算上限,先暂停;提高预算后可以继续`,en:`Paused at the budget limit; work resumes once the budget is raised`},{match:/quarantin/i,bare:/^The task signature is quarantined out of planner rotation/,zh:`这个方向连续失败,先搁置,不再自动重试`,en:`This direction kept failing and is set aside; it will not retry on its own`},{match:/backend[\s\S]{0,24}?(fail|unavailable|paused)|backend_failure|provider cooldown|configured model is unavailable/i,bare:/^(?:backend failure; retrying in a fresh|The backend has failed the same way \d+ times in a row)/,zh:`模型服务暂时不稳定,稍后会自动重试`,en:`The model service was briefly unavailable; it retries after a short wait`}],da=/Runner receipt:|Technical record:|技术记录[::]/i,fa=/^(?:Runner receipt|Technical record|技术记录)\s*[::]\s*/i;function pa(e){let t=String(e||``).trim(),n=t.search(da);return n<0?{prose:t,receipt:``}:{prose:t.slice(0,n).trim(),receipt:t.slice(n).trim()}}function ma(e,t){let n=String(e||``).trim(),{receipt:r}=pa(n),i=r?ua.find(e=>e.match?.test(n)):ua.find(e=>e.bare?.test(n));return i?{summary:t?i.zh:i.en,receipt:r||n,kind:i.kind}:{summary:``,receipt:r}}var ha={width:1440,height:1080},ga=[`plan`,`execution`,`review`,`revision`,`result`];function _a(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function va(e,t){let n=e.team_outcome;if(!n)return``;if(n.kind===`review`){let e=n.verdict===`rejected`?t?`复核结论:驳回`:`Verdict: rejected`:n.verdict===`qualified`?t?`复核结论:通过`:`Verdict: qualified`:``;if(!e)return``;let r=n.summary?xa(n.summary,120):``;return r?`${e}${t?`。`:`. `}${r}`:e}if(n.kind===`route`){let e=n.title?t?`「${n.title}」`:`“${n.title}”`:``;if(n.selected)return t?`${e}通过独立复核,被选为唯一方案`:`${e} passed its independent review and was chosen`;if(n.verdict===`rejected`){let r=n.rejection?xa(n.rejection,120):``;return(t?`${e}被独立复核驳回`:`${e} was rejected by its independent review`)+(r?t?`。${r}`:`. ${r}`:``)}return n.verdict===`qualified`?n.selected===!1?t?`${e}通过独立复核,但未被选中`:`${e} passed its independent review but was not chosen`:t?`${e}通过独立复核,等待选择`:`${e} passed its independent review; selection pending`:``}let r=Ri(n.selected_route);if(!r)return``;let i=n.selected_title?t?`(${n.selected_title})`:` (${n.selected_title})`:``,a=(n.rejected??[]).map(Ri).filter(Boolean);return(t?`选定研究路线 ${r}${i}`:`Chose route ${r}${i}`)+(a.length?t?`,驳回路线 ${a.join(`、`)}`:`; rejected route${a.length>1?`s`:``} ${a.join(`, `)}`:``)}function ya(e,t,n){return e.pending_question?t?`需要答复,展开查看具体问题`:`Needs your input; open to read the question`:e.status===`failed`?t?`本次执行失败,展开查看原因`:`This attempt failed; open to read the reason`:e.status===`blocked`?t?`执行受阻,展开查看原因`:`Work is blocked; open to read the reason`:va(e,t)||(e.status===`done`?e.team_role===`idea-review`?t?`独立复核已完成,展开查看记录`:`Independent review completed; open to read the record`:t?`子任务执行已完成,展开查看记录`:`Subtask execution completed; open to read the record`:e.status===`pending`?n?t?`等待前置子任务完成后开始`:`Waiting for prerequisite subtasks to finish`:t?`等待分配 Agent 执行`:`Waiting for an agent to start`:Ti.has(e.status||``)?e.team_role===`idea-route`?t?`正在开展来源研究,整理候选方案`:`Researching sources and developing a candidate idea`:e.team_role===`idea-review`?t?`正在独立核对依据、创新性和风险`:`Independently checking evidence, novelty and risks`:e.team_role===`idea-selector`?t?`正在对比研究路线及复核意见`:`Comparing research routes and independent reviews`:t?`Agent 正在执行此子任务`:`An agent is working on this subtask`:t?`展开查看子任务执行记录`:`Open to read the subtask record`)}var ba=e=>e?`这一步还没有留下记录`:`Nothing has been written down for this step yet.`;function xa(e,t=140){let n=e.replace(/\s+/g,` `).trim();if(!n)return``;let r=n.match(/^.*?[。!?!?.](?=\s|$)/),i=(r?r[0]:n).trim();return i.length>t?`${i.slice(0,t-1).trimEnd()}…`:i}function Sa(e){let t=e.replace(/\s+/g,` `).trim().split(/[。!?;;::,,\n]|\.(?=\s|$)|[!?](?=\s|$)/)[0]?.trim();return t&&t.length>=6&&t.length<=40?t:``}function Ca(e){return String(e||``).split(/\r?\n/).filter(e=>!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e.trim())&&!/^\{\s*"[\w-]+"\s*:.*\}$/.test(e.trim())).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/i,``).replace(/^\s*NEXT_ACTION\s*=\s*/i,``)).join(` +`).trim()}function wa(e,t,n){switch(e.type){case`life.planner.task_added`:return n?`规划者把这项任务列入了计划。`:`The Planner added this task to the plan.`;case`life.mission.started`:return n?`工程师接手了这项任务,开始动手。`:`The Engineer picked up this task and began working.`;case`life.phase.started`:case`round.review.started`:return e.role===`reviewer`?n?`审阅者打开了工程师的工作,开始核查。`:`The Reviewer opened the Engineer's work to check it.`:``;case`life.mission.completed`:return ca(e,n)||(t===`done`?n?`任务完成,结果已经记录在案。`:`The task was finished; its result is on record.`:t===`paused_external_work`?n?`这项任务在等待后台团队的结果;结果就绪后会自动继续。`:`This task is waiting for its background team; it continues on its own once the results are in.`:t.startsWith(`paused`)?n?`这项任务的工作暂停了。`:`Work on this task was paused.`:n?`任务到此结束。`:`The task ended here.`);case`life.mission.failed`:return n?`任务没有达到目标就结束了。`:`The task ended without reaching its goal.`;default:return``}}var Ta=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,Ea=(e,t)=>e.length>t?`${e.slice(0,t-1).trimEnd()}…`:e;function Da(e){let t=e.slice(e.indexOf(`:`)+1).trim();if(!t)return``;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of[`path`,`file`,`file_path`,`pattern`,`query`,`url`,`command`,`paths`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim();if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}let n=Object.values(t).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n.trim():``}}catch{}return/^[{[]/.test(t)?/"(?:path|file|file_path|pattern|query|url|command)"\s*:\s*"([^"]+)/.exec(t)?.[1]??``:t}function Oa(e){let t=(e.tool||e.label.replace(Ta,``).split(`:`)[0]||``).trim().toLowerCase();return e.kind===`command_execution`?`run`:e.kind===`file_change`?`edit`:/^(view|read|cat|open|read_file|str_replace_editor)$/.test(t)?`read`:/^(rg|grep|search|find_text|semantic_search|codebase_search|web_search|search_web)$/.test(t)||/^(glob|find|list|ls|list_dir|find_files)$/.test(t)?`search`:/^(web_fetch|fetch|http_get|browse)$/.test(t)?`fetch`:/^(apply_patch|edit|write|create|write_file|edit_file|replace_in_file|str_replace)$/.test(t)?`edit`:/^(bash|shell|sh|execute|terminal|run)$/.test(t)?`run`:`other`}function ka(e,t){let n=(e.tool||``).trim(),r=e.label.replace(Ta,``).trim(),i=n&&/\s/.test(n)&&n.length>8,a=Ea(Da(r),72),o=Ea(r,72),s=Oa(e),c=i?n:s===`run`?t?`运行命令 \`${o}\``:`Ran \`${o}\``:s===`read`?t?`查看 ${a||(t?`一份文件`:``)}`:`Read ${a||`a file`}`:s===`search`?t?`查找 ${a||`内容`}`:`Looked for ${a||`something`}`:s===`fetch`?t?`读取网页 ${a||``}`.trim():`Fetched ${a||`a page`}`:s===`edit`?t?`修改文件 ${a||``}`.trim():`Edited ${a||`a file`}`:Ea(/^[^:{]*:\s*[{[]/.test(r)?r.slice(0,r.indexOf(`:`)):r,80);return e.status===`failed`?`${c}${t?`(失败)`:` (failed)`}`:c}function Aa(e,t,n){let r=new Map;e.forEach(e=>r.set(Oa(e),(r.get(Oa(e))??0)+1));let i=[],a=(e,t,a,o)=>{let s=r.get(e);s&&i.push(n?`${t}${s}${e===`run`?`条命令`:e===`fetch`?`个网页`:`处`}`:`${s} ${s===1?a:o}`)};a(`read`,`查看了`,`file read`,`files read`),a(`search`,`查找了`,`search`,`searches`),a(`fetch`,`读取了`,`page fetched`,`pages fetched`),a(`edit`,`修改了`,`file edited`,`files edited`),a(`run`,`运行了`,`command run`,`commands run`);let o=r.get(`other`);return o&&i.push(n?`${o}次其他操作`:`${o} other ${o===1?`action`:`actions`}`),t>0&&i.push(n?`另有 ${t} 步未列出`:`${t} more not listed`),i.length?n?`${i.join(`,`)}。`:`${i.join(`, `)}.`:``}function ja(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.status===`running`&&n.status&&n.status!==`running`&&(e.call_id&&n.call_id?e.call_id===n.call_id:!e.call_id&&!n.call_id&&e.kind===n.kind&&e.label===n.label&&(e.tool??``)===(n.tool??``))?t[t.length-1]={...e,status:n.status,...n.call_id?{call_id:n.call_id}:{}}:t.push(n)}return t}function Ma(e,t){let n=ja(e.steps??[]),r=Ca(e.text),i=e.tool_details_recorded===!1,a=i?t?`执行日志确认发生过工具活动,但这一轮没有记录详细工具步骤。`:`Execution logs confirm tool activity, but detailed tool steps were not recorded for this turn.`:``;return Fa({id:e.id,kind:e.role===`reviewer`?`review`:`execution`,title:``,detail:``,status:e.status||`recorded`,ts:e.ts,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id],segment:!0,work:{steps:[...n],overflow:e.overflow??0,narrations:r?[r]:[],note:a,title:i?t?`已记录的执行`:`Recorded execution`:``,single:e.role===`manager`}},t)}var Na=8,Pa=(e,t)=>{let n=Math.max(0,e.steps.length-Na)+e.overflow;return[...e.steps.slice(0,Na).map(e=>`· ${ka(e,t)}`),...n>0?[t?`· 另有 ${n} 步未列出`:`· ${n} more not listed`]:[]]};function Fa(e,t){let n=e.work,r=n.narrations.join(` + +`);return e.title=n.title||Sa(n.narrations[0]??``)||(n.single?t?`Argus 动手查证`:`Argus did the work`:n.steps.length?t?`做了 ${n.steps.length} 步操作`:`${n.steps.length} steps of work`:t?`说明了接下来要做什么`:`Said what comes next`),e.summary=xa(n.narrations[0]??``)||Aa(n.steps,n.overflow,t)||void 0,e.detail=[n.note,r,Pa(n,t).join(` +`)].filter(Boolean).join(` + +`)||ba(t),e.workCount=n.steps.length+n.overflow||void 0,e}function Ia(e,t){let n=e.work;if(!n||e.segment)return e;let r=e.detail===ba(t)?``:e.detail,i=n.narrations.filter(e=>!r.includes(e.slice(0,60))),a=n.steps.length+n.overflow,o=Aa(n.steps,0,t),s=a?[t?`这一步里做的操作(${a} 步):${o}`:`What was done in this step (${a} actions): ${o}`,Pa(n,t).join(` +`)].join(` +`):``,c=n.narrations[n.narrations.length-1];return!e.closed&&c&&(e.title=Sa(c)||e.title,e.summary=xa(c)||e.summary),e.detail=[n.note,r,i.join(` + +`),s].filter(Boolean).join(` + +`)||ba(t),e.workCount=a||void 0,e}function La(e,t){switch(e){case`done`:return t?`这项任务已经完成。`:`This task was completed.`;case`failed`:return t?`这项任务没有达到目标。`:`This task did not reach its goal.`;case`cancelled`:case`aborted`:return t?`这项任务被取消了。`:`This task was cancelled.`;case`skipped`:return t?`这项任务被跳过了。`:`This task was skipped.`;case`superseded`:return t?`这项任务被一个新的计划取代了。`:`A new plan took the place of this task.`;default:return``}}function Ra(e,t,n){let r=e.kind===`turn`,i=[{id:`${e.id}:brief`,kind:`plan`,title:r?n?e.turn_kind===`qa`?`你提出的问题`:`你提出的要求`:`What you asked`:n?`任务目标`:`Task goal`,detail:e.objective||e.title,status:`recorded`,source:`task`,eventIds:[]}],a=new Set,o=0,s,c=t.filter(t=>t.item_id===e.id).sort((e,t)=>e.ts-t.ts||(e.type===`team.task`&&t.type===`team.task`?(e.team_task_id||e.id).localeCompare(t.team_task_id||t.id):0)),l=new Map(c.filter(e=>e.type===`team.task`).map(e=>[e.id,e]));for(let e of c){if(a.has(e.id))continue;if(a.add(e.id),e.type===`team.task`){let t=[...new Set(e.deps||[])],r=t.map(e=>l.has(e)?_a(l.get(e),n):n?`其他记录中的子任务`:`Task outside this view`),a=Ca(e.text);i.push({id:e.id,kind:e.team_role===`idea-review`||e.role===`reviewer`?`review`:e.team_role===`idea-selector`?`plan`:`execution`,title:_a(e,n),summary:ya(e,n,t.some(e=>l.has(e)&&l.get(e).status!==`done`)),detail:[a,e.reason&&!a.includes(e.reason)?e.reason:``,e.pending_question?`${n?`需要答复`:`Needs input`}: ${e.pending_question}`:``,r.length?`${n?`依赖`:`Depends on`}: ${r.join(` · `)}`:``].filter(Boolean).join(` + +`),status:e.pending_question?`question`:e.status||`unknown`,ts:e.ts,source:`team`,eventIds:[e.id],teamId:e.team_id,teamTaskId:e.team_task_id,teamRole:e.team_role,...e.team_outcome?{teamOutcome:e.team_outcome}:{},deps:t,updatedAt:e.updated_ts,revision:e.revision});continue}if(e.type===`work.segment`){i.push({...Ma(e,n),episode:o});continue}if(e.type===`turn.replied`){let t=Ca(e.text);i.push({id:e.id,kind:`result`,title:n?`Argus 的回答`:`What Argus answered`,summary:xa(t)||void 0,detail:t||ba(n),status:e.status||`done`,ts:e.ts,source:`event`,eventIds:[e.id]});continue}e.type===`life.mission.started`&&(o++,s=void 0),e.type===`round.review.completed`&&(s=e);let t=e.type.includes(`review`)||e.type===`life.phase.started`&&e.role===`reviewer`?`review`:e.type===`life.planner.task_added`?`plan`:e.type===`life.mission.completed`||e.type===`life.mission.failed`?`result`:e.type===`round.start`||e.type===`round.main.completed`||e.type===`life.mission.started`||e.type===`life.phase.started`?`execution`:null;if(!t)continue;let r=e.round_index,c=e.type.endsWith(`.completed`)||e.type.endsWith(`.failed`),u=t===`review`&&e.review_skipped===!0,d=e.backend_unavailable===!0||t===`result`&&s?.backend_unavailable===!0,f=d?``:ca(e,n),p=(d?`review_unavailable`:u?`skipped`:e.status===`error`?`failed`:e.status)||(e.success===!1||e.type.endsWith(`.failed`)?`failed`:e.success===!0?`done`:c||e.type===`life.planner.task_added`||e.type===`life.mission.started`?`recorded`:`started`),m=ma(e.text||``,n),h=String(e.text||``),g=m.receipt?h.lastIndexOf(m.receipt):-1,_=Ca(g>=0?h.slice(0,g):h),v=p===`done`?n?`审阅通过`:`Review passed`:p===`continue`?n?`审阅:要求再改一轮`:`Review: another pass asked for`:[`blocked`,`replan`,`replan_requested`].includes(p)?n?`审阅:建议调整方向`:`Review: a change of course asked for`:p===`failed`?n?`审阅未通过`:`Review not passed`:``,y=m.kind===`interrupt`,b=t===`execution`&&!m.summary?Sa(_):``,x=d?n?`当次审查异常`:`Review error on this attempt`:y?n?`这一轮没做完就被停下`:`Stopped before the round could finish`:u?n?`本轮未审阅`:`No review this round`:t===`review`?c?v||(n?`审阅意见`:`Review`):n?`开始审阅`:`Review started`:t===`result`?f?n?`本次执行已结束`:`This execution ended`:p===`paused_external_work`?n?`等待后台团队`:`Waiting for the background team`:n?`执行结果`:`Result of the work`:t===`plan`?n?`列入计划`:`Taken into the plan`:b||(m.kind===`round`?n?`新一轮开始`:`A new round began`:e.type===`life.mission.started`?n?`开始执行`:`Work started`:e.type===`round.main.completed`?n?`本轮执行记录`:`This round's work`:n?`一次执行尝试`:`An attempt at the work`),S=ma(e.next_action||``,n),C=_||m.summary?``:wa(e,p,n);i.push({id:e.id,kind:t,title:x,summary:d?n?`审查器未能给出判断,不是审阅否决。`:`The Reviewer could not return a judgment; this was not a rejection.`:f||m.summary||xa(_)||C||void 0,detail:[f,_||m.summary||(f?``:C||ba(n)),f&&e.stage_certification===`intentionally_skipped`?n?`本阶段认证被有意跳过;这不代表最终验收通过。`:`Stage certification was intentionally skipped; this is not final acceptance.`:``,u&&e.next_action&&!S.summary?`${n?`接下来`:`What happens next`}: ${e.next_action}`:``,m.receipt?`${n?`——技术记录:`:`— technical record: `}${m.receipt.replace(fa,``)}`:``].filter(Boolean).join(` + +`),status:f&&p===`done`?`recorded`:p,completionScope:f||void 0,closed:c,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]}),!u&&!y&&e.next_action&&[`continue`,`blocked`,`replan`,`replan_requested`].includes(e.status||``)&&i.push({id:`${e.id}:next`,kind:`revision`,title:n?`建议的修改`:`Changes asked for`,detail:S.summary||e.next_action,status:`requested`,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]})}e.turn_kind===`qa`&&!i.some(e=>e.kind===`result`)&&i.push({id:`${e.id}:answer`,kind:`result`,title:Ti.has(e.status)?n?`正在回答`:`Answering`:n?`回答状态`:`Answer status`,detail:e.summary||(e.status===`cancelled`?n?`本次回答已中断。`:`This answer was interrupted.`:``),status:e.status,source:`task`,eventIds:[]}),e.turn_kind!==`qa`&&!i.some(e=>e.kind===`execution`)&&Ti.has(e.status)&&i.push({id:`${e.id}:active`,kind:`execution`,title:n?`正在进行的工作`:`Work under way`,detail:e.summary||``,status:e.status,source:`task`,eventIds:[]}),!i.some(e=>e.kind===`result`)&&[`done`,`failed`,`aborted`,`cancelled`,`skipped`,`superseded`].includes(e.status)&&i.push({id:`${e.id}:outcome`,kind:`result`,title:n?`任务的最终状态`:`Where this task ended up`,detail:e.summary||La(e.status,n),status:e.status,source:`task`,eventIds:[]});let u=[],d=new Map,f=new Map,p=(e,t)=>{let n=e.work??={steps:[],overflow:0,narrations:[],note:``,title:``,single:!1};n.steps.push(...t.work.steps),n.overflow+=t.work.overflow,n.narrations.push(...t.work.narrations.filter(e=>!n.narrations.includes(e))),n.note||=t.work.note,e.eventIds.push(...t.eventIds),t.source===`interval`&&(e.source=`interval`)};for(let e of i){if(e.segment){let t=f.get(e.kind),r=u[u.length-1],i=t&&t.episode===e.episode?t:r?.segment&&r.kind===e.kind?r:void 0;i?(p(i,e),i.segment&&Fa(i,n)):u.push({...e,eventIds:[...e.eventIds]});continue}let t=e.round!=null&&[`execution`,`review`].includes(e.kind),r=`${e.episode}:${e.round}:${e.kind}`,i=t?d.get(r):void 0;if(i)i.title=e.title,i.summary=e.summary??i.summary,i.detail=e.detail,i.status=e.status,i.closed=i.closed||e.closed,i.eventIds.push(...e.eventIds),e.source===`interval`&&(i.source=`interval`);else{let n={...e,eventIds:[...e.eventIds]};u.push(n),t&&(d.set(r,n),f.set(n.kind,n))}}return u.map(e=>{let{work:t,segment:r,closed:i,...a}=Ia(e,n);return a})}function za(e,t,n=!0){let r=e.filter(e=>e.source===`team`),i=r.filter(e=>e.teamOutcome?.kind===`route`),a=r.find(e=>e.teamOutcome?.kind===`selection`)?.teamOutcome,o=i.find(e=>e.teamOutcome?.selected),s=[],c=e=>e.join(t?`、`:`, `);if(o||a?.selected_route){let e=Ri(o?.teamTaskId)||Ri(a?.selected_route),n=o?.teamOutcome?.title||a?.selected_title;s.push(t?`已选定研究路线 ${e}${n?`(${n})`:``}`:`route ${e} chosen${n?` (${n})`:``}`);let r=i.filter(e=>e.teamOutcome?.verdict===`rejected`&&!e.teamOutcome.selected).map(e=>Ri(e.teamTaskId)).filter(Boolean);r.length&&s.push(t?`路线 ${c(r)} 被驳回`:`route${r.length>1?`s`:``} ${c(r)} rejected`)}else if(i.some(e=>e.teamOutcome?.verdict)){let e=i.filter(e=>e.teamOutcome?.verdict===`qualified`).length,n=i.filter(e=>e.teamOutcome?.verdict===`rejected`).length;s.push(t?`复核结果:${e} 条路线通过、${n} 条驳回,等待选择`:`reviews so far: ${e} route${e===1?``:`s`} qualified, ${n} rejected; selection pending`)}let l=[...e].reverse().find(e=>e.source!==`team`&&e.kind===`review`&&[`done`,`continue`,`blocked`,`replan`,`replan_requested`,`failed`].includes(e.status));l&&s.push(l.status===`done`?t?`复核通过`:`review passed`:l.status===`continue`?t?`复核要求再改一轮`:`the review asked for another pass`:l.status===`failed`?t?`复核未通过`:`review not passed`:t?`复核建议调整方向`:`the review asked for a change of course`);let u=n?[...e].reverse().find(e=>e.source!==`team`&&e.kind===`execution`&&e.round!=null&&e.status===`started`):void 0;return u&&s.push(t?`第 ${u.round} 轮进行中`:`round ${u.round} under way`),s.length?(t?`当前结论:`:`So far: `)+s.join(t?`;`:`; `):``}var Ba=480;function Va(e,t,n,r=Ra(e,t,n),i=0,a=!1){let o=a&&r.length>0,s=o?Ba:640,c=o?r.length:1,l=1/0;for(let e=1;!o&&e<=Math.min(3,r.length);e++){let t=Math.ceil(r.length/e),n=Math.max(640,t*232+(t-1)*108+96),i=408+(e-1)*236,a=Math.abs(Math.log(n/i/1.6))+.6*(t*e-r.length)/(t*e);a{let a=t*c,o=Math.min(a+c,r.length),s=m+t*340,l=r.slice(a,o);l.forEach((e,t)=>{h[e.id]={x:s,y:f+t*236}});let d=i+a+1,p=i+o,v=d===p?n?`环节 ${d}`:`Step ${d}`:n?`环节 ${d}–${p}`:`Steps ${d}–${p}`,y=Ua(g.slice(a,o)),b=Wa(l,y,_,t===0&&i===0,t===u-1,n,v);return _=y,{id:`steps:${i+a}`,title:b,x:s,y:f-38}});return{steps:r,links:Ka(r,n),columns:v,positions:h,width:d,height:p,...o?{stacked:o}:{}}}function Ha(e){let t;return e.map(e=>{if(typeof e.round==`number`)return t=e.round;if(e.kind!==`result`&&e.kind!==`plan`)return t})}function Ua(e){return[...new Set(e.filter(e=>typeof e==`number`))].sort((e,t)=>e-t)}function Wa(e,t,n,r,i,a,o){if(!t.length)return r&&i&&e.length>1&&e[0].kind===`plan`&&e[e.length-1].kind===`result`?a?`起点 → 结果`:`Setting out → Outcome`:r&&e.some(e=>e.kind===`plan`)?a?`起点`:`Setting out`:i&&e.some(e=>e.kind===`result`)?a?`结果`:`Outcome`:o;let s=t[0],c=t[t.length-1],l=t.length===1&&n.length>0&&n[n.length-1]===s,u=s===c?a?`第 ${s} 轮`:`Round ${s}`:a?`第 ${s}–${c} 轮`:`Rounds ${s}–${c}`;return l&&(u=e[0].kind===`review`?a?`${u} · 审阅`:`${u} · review`:a?`${u} · 续`:`${u} · cont.`),r&&e[0].kind===`plan`&&(u=a?`起点 · ${u}`:`Setting out · ${u}`),i&&e[e.length-1].kind===`result`&&(u=a?`${u} · 结果`:`${u} · Outcome`),u}function Ga(e){let t=e.stacked?900/e.width:Math.max(600/e.height,Math.min(1e3/e.height,ha.width/e.width));return{width:e.width*t,height:e.height*t,scale:t}}function Ka(e,t){let n=e.filter(e=>e.source===`team`);if(n.length){let r=e.filter(e=>e.source!==`team`),i=new Map(n.map(e=>[e.id,e])),a=r.find(e=>e.source===`task`&&e.kind===`plan`),o=[];for(let e of n){for(let n of e.deps||[]){let r=i.get(n);!r||r.id===e.id||r.teamId!==e.teamId||o.push({id:`link:${r.id}:${e.id}`,source:r.id,target:e.id,relation:`dependency`,label:t?`前置任务`:`Depends on`,explanation:t?`${e.title} 的任务记录明确依赖 ${r.title}。`:`${e.title} explicitly depends on ${r.title} in its taskboard.`,contextual:!1})}a&&!e.deps?.length&&o.push({id:`link:${a.id}:${e.id}`,source:a.id,target:e.id,relation:`assignment`,label:t?`任务分支`:`Branch`,explanation:t?`该子任务属于当前主任务;此线不表示等待主任务完成。`:`This worker belongs to the current mission; the link does not require the parent to finish first.`,contextual:!0})}return[...Ka(r,t),...o]}return e.slice(1).map((n,r)=>{let i=e[r],a=i.episode===n.episode,o=a&&i.round!=null&&i.round===n.round,s=`record_order`,c=t?`接着`:`then`,l=t?`同一任务的相邻观察,未确认直接因果或执行依赖。`:`Adjacent observations of the same task; no causal dependency is asserted.`;i.kind===`plan`&&[`plan`,`execution`].includes(n.kind)?(s=`assignment`,c=t?n.kind===`plan`?`纳入计划`:`执行此任务`:n.kind===`plan`?`planned`:`carried out`,l=t?`同一任务的目标/计划与其执行记录关联。`:`The task brief or plan is linked to execution of that same task.`):i.kind===`execution`&&n.kind===`review`&&o?(s=`review`,c=t?`提交审阅`:`sent for review`,l=t?`同一个任务、同一执行段、同一轮次的执行与审查记录。`:`Execution and review belong to the same task, episode and numbered round.`):i.kind===`review`&&n.kind===`revision`&&n.eventIds.some(e=>i.eventIds.includes(e))?(s=`revision`,c=t?`提出修改`:`asked to change`,l=t?`这条修订建议来自对应的审查记录。`:`This revision was requested in the corresponding review.`):i.kind===`revision`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`修订建议之后出现了同一任务的下一轮执行;不表示建议的全部内容已被采纳。`:`A later round follows the revision request; this does not certify every requested change was applied.`):i.kind===`review`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`审阅之后出现了同一任务的下一轮执行。`:`A later round of the same task follows the review.`):i.kind===`execution`&&n.kind===`execution`&&i.round==null&&n.round!=null?(c=t?`进入第 ${n.round} 轮`:`round ${n.round} begins`,l=t?`任务开始执行后记录的一轮工作。`:`A round of work recorded after the task was taken up.`):i.kind===`result`&&n.kind===`execution`?(c=t?`再次开始`:`taken up again`,l=t?`上一次执行结束之后,这项任务又被接手。`:`The task was taken up again after an earlier execution ended.`):n.kind===`result`&&n.source===`task`?(s=`snapshot`,c=t?`最终状态`:`ended as`,l=t?`任务状态记录;部分执行过程可能缺失。`:`Links to the captured state of this task; intermediate records may be missing.`):n.kind===`result`&&[`review`,`execution`,`revision`].includes(i.kind)&&(s=`outcome`,c=t?`形成结果`:`led to`,l=t?`同一任务的后续完成/失败事件,不等同于成功认证。`:`A completion or failure event of this task, not a certification of success.`);let u=[`record_order`,`snapshot`].includes(s)||i.source===`interval`||n.source===`interval`;return(i.source===`interval`||n.source===`interval`)&&(l+=t?` 部分旧记录按唯一活动任务区间归属,因此使用虚线。`:` Some legacy observations are associated by the sole active mission window, so this link is dashed.`),{id:`link:${i.id}:${n.id}`,source:i.id,target:n.id,relation:s,label:c,explanation:l,contextual:u}})}function qa(e){let t=[],n=[];for(let r=0;r12&&(t.push(n),n=[]),n.push(...i)}return n.length&&t.push(n),t}function Ja(e,t,n,r){for(let i of[n,r]){let n={x:(i.x-t.x)/t.zoom,y:(i.y-t.y)/t.zoom},r=e.find(e=>!e.hidden&&n.x>=e.position.x&&n.x<=e.position.x+(e.width??1152)&&n.y>=e.position.y&&n.y<=e.position.y+(e.height??824));if(r)return r.id}return null}function Ya(e,t,n,r,i=Zi(e,[],n),a,o=!1){let s=[],c={},l=[],u=new Map;for(let[r,i]of e.tasks.entries()){let e=Ra(i,t,n),a=i.status===`done`?ca(Ei(i,t),n):``,d=i.kind===`turn`?``:za(e,n,Ti.has(i.status)),f=qa(e),p=f.length,m=e=>e===1?i.id:JSON.stringify([`part`,i.id,e]),h=0;for(let u=1;u<=p;u++){let g=f[u-1],_=m(u);if(s.push({id:_,task:i,ordinal:r+1,part:u,partCount:p,start:h+1,end:h+g.length,totalSteps:e.length,previousId:u>1?m(u-1):void 0,nextId:u1){let t=Ka([e[h-1],g[0]],n)[0];l.push({id:JSON.stringify([`continuation`,i.id,u]),source:m(u-1),target:_,kind:`continuation`,label:t?n?`继续`:`Continued`:n?`更多分支`:`More branches`,evidence:t?`${i.title} · ${t.label} · ${e[h-1].title} → ${g[0].title}`:`${i.title} · ${n?`同一任务的其他分支,不表示串行依赖。`:`Other branches of the same mission, without a serial dependency.`}`})}h+=g.length}u.set(i.id,m(p))}let d=s.slice(),f=new Map;if(a){s.length=0;for(let e of d){let t=a.has(e.task.id);if(f.set(e.id,t?e.id:e.task.id),!t&&e.part!==e.partCount)continue;let n=t?e.id:e.task.id;c[n]=c[e.id],s.push({...e,id:n,historyCount:e.partCount-1,historyExpanded:t})}}let p=e=>f.get(e)??e,m=Object.fromEntries(s.map(({id:e})=>[e,Ga(c[e])])),h=[...i.map(e=>({...e,source:p(u.get(e.source)),target:p(e.target)})),...l.filter(e=>p(e.source)!==p(e.target))],g=s.map(e=>e.id),_=JSON.stringify([g.map(e=>[e,m[e].width,m[e].height]),h.map(e=>[e.source,e.target,e.kind])]);return{cards:s,allCards:d,links:h,layouts:c,positions:r?.structure===_?r.positions:aa(g,h,m),frames:m,structure:_}}function Xa(e,t,n){if(e.pending_question)return e.pending_question;let r=t.filter(t=>t.item_id===e.id&&(t.status===`failed`||t.success===!1||t.type.endsWith(`.failed`))).sort((e,t)=>t.ts-e.ts)[0],i=(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``),a=r?.reason||r?.text||i,o=ma(a,n),s=o.receipt?a.lastIndexOf(o.receipt):-1,c=Ca(s>=0?a.slice(0,s):a);return o.summary||c||(n?`这项任务没有完成,记录里没有写明原因。`:`This task did not finish, and the record does not say why.`)}function Za(e){return(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``).trim()}function Qa(e,t,n,r=``){if(e.pending_question)return{reason:e.pending_question,next:n?`下一步:回答这个问题,团队才会继续。`:`Next: answer this question so the team can continue.`,detail:``,showDetail:!1};if(Ni(e)){let t=Za(e),i=r.trim();return{reason:i?n?`工作已暂停:${i}`:`Work paused: ${i}`:t?n?`工作已暂停:当前结果还没有满足要求,具体原因见下方说明。`:`Work paused: the current result does not yet meet the requirements. The reason is shown below.`:n?`工作已暂停:当前结果还没有满足要求,记录里没有说明具体原因。`:`Work paused: the current result does not yet meet the requirements. No specific reason was recorded.`,next:n?`工作不会自动继续。请看暂停原因,再在对话里告诉我接下来做什么。`:`Work will not resume on its own. Read the reason, then tell me what to do next in the conversation.`,detail:t,showDetail:!!t&&!i}}let i=Xa(e,t,n),a=Za(e);return{reason:n?`执行失败:${i}`:`Execution failed: ${i}`,next:n?`下一步:查看原因后重试,或在对话里调整任务。`:`Next: check the reason, then retry or adjust the task in the conversation.`,detail:a&&!i.includes(a)?a:``,showDetail:!1}}var $a=(e,t=80)=>e.length>t?`${e.slice(0,t)}…`:e;function eo(e,t,n,r=()=>``){let i=e.filter(e=>e.turn_kind!==`qa`&&e.kind!==`turn`),a=[...i].sort((e,t)=>(t.ts??0)-(e.ts??0)),o=a[0],s=o?$a((o.objective||o.title).trim()):n?`还没有任务`:`No task yet`,c=Pi(e,t),l=e=>{let t=Mi(e);return{held:n?`工作已暂停`:`work paused`,failed:n?`这项工作没有做完`:`this task did not finish`,review_unavailable:n?`结果检查没有完成`:`the result check did not finish`,done:n?`已完成`:`done`,running:n?`进行中`:`running`,pending:n?`待开始`:`planned`,question:n?`等你回答`:`waiting on you`,paused:n?`已暂停`:`paused`}[t]||(n?`还没有新的进展记录`:`No new progress has been recorded`)},u=c?n?`已确认:${$a(Ca(r(c)||c.summary||c.title),160)}`:`Confirmed: ${$a(Ca(r(c)||c.summary||c.title),160)}`:o?Mi(o)===`review_unavailable`?n?`这次结果检查没有完成,暂时不能确认结果。`:`The result check did not finish, so the result is not yet confirmed.`:n?`还没有经过检查确认的结果。`:`There is no checked, confirmed result yet.`:n?`还没有结果`:`No result yet`,d=i.find(e=>Ti.has(e.status)),f=a.find(e=>[`question`,`held`,`failed`,`review_unavailable`].includes(Mi(e))),p=[...i].sort((e,t)=>(e.ts??0)-(t.ts??0)).find(e=>Mi(e)===`pending`);return{goal:s,current:d?n?`正在处理:${$a(d.title,70)}`:`Working on: ${$a(d.title,70)}`:o?l(o):n?`可以开始新任务`:`Ready for a new task`,conclusion:u,next:d?p?n?`待做任务:${$a(p.title,70)}`:`Queued next: ${$a(p.title,70)}`:n?`等当前工作完成,再查看检查结果。`:`Wait for the current work to finish, then check the result.`:f&&f===o?Qa(f,t,n,r(f)).next:p?n?`下一步:${$a(p.title,60)}`:`Next: ${$a(p.title,60)}`:c?n?`可以查看结果,或继续提出要求。`:`Read the result, or tell me what to do next.`:n?`还没有后续任务,可在对话里告诉我接下来做什么。`:`Nothing else is scheduled. Tell me what to do next in the conversation.`}}function to(e,t,n){let r=e?.model_revision&&e.model_revision!==n,i={...e?.cards};for(let[n,a]of Object.entries(t.cards)){if(r&&i[n]?.model_revision===e.model_revision)continue;let t=i[n];t?.version&&(a.version??0)(t.copy_revision??0)||(a.copy_revision??0)===(t.copy_revision??0)&&(a.generated_at>t.generated_at||a.generated_at===t.generated_at&&!t.input_revision))&&(i[n]=a)}let a=(t.cache_revision??0)<(e?.cache_revision??0);return{...e,...t,cards:i,...e?.version!=null||t.version!=null?{version:Math.max(e?.version??0,t.version??0)}:{},cache_revision:Math.max(t.cache_revision??0,e?.cache_revision??0),relations:(r||a)&&e?e.relations:t.relations,available:t.available??!0,...r?{model_revision:e.model_revision,available:e.available}:{}}}function no(e,t,n,r){let i=n?.cards[e.key],a=t.tasks.find(t=>t.id===e.task_id);if(!i||!a||(i.version??0)<(n?.version??0)||n?.model_revision&&i.model_revision!==n.model_revision)return!0;let o=[a.id,a.id+`:active`,a.id+`:outcome`].includes(e.key);if(o||!i.task_content_revision||!a.content_revision){if(a.revision&&i.task_revision!==a.revision||o&&i.task_status!==a.status)return!0}else if(i.task_content_revision!==a.content_revision)return!0;let s=i.event_ids||[];return e.event_ids.some(e=>{let n=s.indexOf(e),a=r?r.get(e):t.events.find(t=>t.id===e);return n<0||i.event_revisions&&a?.revision&&i.event_revisions[n]!==a.revision})||!o&&JSON.stringify(e.event_ids)!==JSON.stringify(s)}var ro=e=>`[[Argus引用 ${JSON.stringify(e)}]]\n`;function io(e){let t=[];return{refs:t,text:e.split(` +`).filter(e=>{if(e.startsWith(`[[Argus引用 `)&&e.endsWith(`]]`))try{let n=JSON.parse(e.slice(10,-2));if(typeof n.task_id==`string`&&typeof n.source==`string`&&typeof n.task_title==`string`&&(n.part===void 0||Number.isInteger(n.part)&&n.part>0)&&(n.step_title===void 0||typeof n.step_title==`string`)&&(n.step_id===void 0||typeof n.step_id==`string`)&&(n.team_id===void 0||typeof n.team_id==`string`)&&(n.team_task_id===void 0||typeof n.team_task_id==`string`)&&(n.lang===void 0||typeof n.lang==`string`)&&Array.isArray(n.event_ids)&&n.event_ids.every(e=>typeof e==`string`))return t.push(n),!1}catch{}return!0}).join(` +`).replace(/^\n+/,``)}}function ao(e,t,n=1/0){let r=Math.max(-1/0,...e.events.filter(e=>e.item_id===t&&e.type===`life.mission.started`&&e.ts<=n).map(e=>e.ts));return e.events.filter(e=>e.item_id===t&&e.ts>=r&&e.ts<=n&&[`round.main.completed`,`round.review.completed`].includes(e.type)).slice(-2).map(e=>e.id)}function oo(e,t,n){return n.map(n=>({key:n.id,task_id:t.id,kind:n.kind,event_ids:[...new Set([...n.kind===`result`?ao(e,t.id,n.ts):[],...n.eventIds])].slice(-16)}))}function so(e,t,n){let r=e.tasks.find(e=>e.id===n),i=(r?[r,...e.tasks.filter(e=>e.id!==n)]:e.tasks).map(t=>({key:t.id,task_id:t.id,kind:`task`,event_ids:[...new Set([...ao(e,t.id),...e.events.filter(e=>e.item_id===t.id).slice(-2).map(e=>e.id)])]})),a=r?oo(e,r,t):[];return[...i.slice(0,1),...a,...i.slice(1)]}var co=new Set([`life.planner.task_added`,`life.mission.started`,`round.main.completed`,`round.review.completed`,`turn.asked`,`turn.replied`]);function lo(e,t,n=ae(),r){return he(`project`,e,t,e,n,r)}function uo(e,t){let n=t.mission.started_at??e.backlog.find(e=>e.id===t.mission.id)?.started_ts??0,r=Number.isFinite(n)&&n>=0?n:0;return{mode:`current`,since:r,eventSince:r,taskId:t.mission.id}}function fo(e,t){return[`research-brief-map`,e,t.taskId,t.since,t.eventSince]}function po(e,t,n){if(e.id!==`live:${t}`||!Array.isArray(e.tasks)||!Array.isArray(e.events))throw Error(`The task records do not match this project.`);return{...e,tasks:e.tasks.filter(e=>e.id===n),events:e.events.filter(e=>e.item_id===n)}}function mo(e,t,n=0){if(!e||!t)return[];let r=e.events.filter(e=>e.item_id===t.id&&co.has(e.type)&&Number.isFinite(e.ts)&&e.ts>=n),i=Math.max(n,...r.filter(e=>e.type===`life.mission.started`).map(e=>e.ts)),a=r.filter(e=>e.ts>=i),o=new Map;for(let e of co){let t=e.startsWith(`round.`)?2:1;for(let n of a.filter(t=>t.type===e).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id)).slice(-t))o.set(n.id,n)}return[...o.values()].sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id))}function ho(e,t){return{key:e.id,task_id:e.id,kind:`task`,event_ids:t.map(e=>e.id)}}function go(e,t){return e?JSON.stringify({task:{id:e.id,title:e.title,objective:e.objective,status:e.status,summary:e.summary,acceptance_check:e.acceptance_check,goal_contribution:e.goal_contribution,plan_hypothesis:e.plan_hypothesis,non_goals:e.non_goals,outcome:e.outcome,pending_question:e.pending_question,started_ts:e.started_ts,finished_ts:e.finished_ts,attempt:e.attempt},events:t.map(e=>[e.id,e.revision??e])}):``}function _o(e){if(!e||typeof e!=`object`)return!1;let t=e;if(![`why`,`scope`,`next`].every(e=>typeof t[e]==`string`&&t[e].trim()))return!1;if(t.concept===null)return!0;if(!t.concept||typeof t.concept!=`object`)return!1;let n=t.concept;return[`name`,`explanation`,`example`,`connection`].every(e=>typeof n[e]==`string`&&n[e].trim())}function vo(e,t,n,r){return!e||!t?!1:(r?.cards[t.id]?.version??0)<14||!_o(r?.cards[t.id]?.reader_brief)||no(ho(t,n),e,r,new Map(n.map(e=>[e.id,e])))}function yo(e){return!!e&&typeof e.version==`number`&&e.version<14}function bo(e,t,n,r){return ro({source:`live:${e}`,task_id:t.id,task_title:t.title,event_ids:n.map(e=>e.id),lang:r?`zh`:`en`})}function xo(e){try{let t=JSON.parse(e||`null`);return!t||![`full`,`current`,`off`].includes(t.mode)||t.mode===`current`&&![t.since,t.eventSince].every(e=>typeof e==`number`&&Number.isFinite(e)&&e>=0)?null:t}catch{return null}}function So(e,t){if(!e||e.id!==t.id||t.reset_history)return t;let n=new Map((!t.incremental||t.tasks_complete?[]:e.tasks).map(e=>[e.id,e]));for(let e of t.tasks)n.set(e.id,e);for(let e of t.removed_task_ids||[])n.delete(e);let r=new Map(e.events.filter(e=>t.incremental&&!t.team_events_complete||e.type!==`team.task`).map(e=>[e.id,e]));for(let e of t.events)r.set(e.id,e);for(let e of t.removed_event_ids||[])r.delete(e);return j(e,{...e,...t,tasks:[...n.values()].sort((e,t)=>(e.ts||0)-(t.ts||0)||e.id.localeCompare(t.id)),events:[...r.values()].filter(e=>n.has(e.item_id))})}function Co(e,t,n){return e?t?.history_loading?400:!wo(n)||t?.events.some(e=>e.type===`team.task`&&Ti.has(e.status||``))?15e3:!1:!1}function wo(e){return e.manager_requests?.some(e=>e.status===`running`)?!1:!e.daemon.alive||e.continuous?.enabled===!1&&/pause|stop/i.test(e.continuous.done_reason||``)?!0:e.daemon.health?.state===`stopped`}var To=0,Eo=(e,t,n=0)=>[`explanation-progress`,...e,t,n];function Do(e,t,n=0){return t?[t.id,`${t.id}:active`,`${t.id}:outcome`].includes(e??``)?typeof t.started_ts==`number`&&Number.isFinite(t.started_ts)&&t.started_ts>=0?t.started_ts:n:0:n}function Oo(e,t,n){let r=++To,i=n.map(e=>Eo(t,e.key,e.startedAt));for(let t of i)e.setQueryData(t,{requestId:r,phase:null});return{update:t=>{for(let n of i)e.setQueryData(n,e=>e?.requestId===r?{requestId:r,phase:t}:e)},finish:()=>{for(let t of i)e.setQueryData(t,e=>e?.requestId===r?null:e)}}}function ko(e,t,n=0){let r=A({queryKey:Eo(e,t??``,n),queryFn:async()=>null,initialData:null,enabled:!1,staleTime:1/0,gcTime:72e5});return{active:!!r.data,phase:r.data?.phase??void 0}}function Ao(e,t){return e?{waiting_for_source:[`等待开始整理说明`,`Waiting to prepare the explanation`],planning:[`正在梳理概念与讲解顺序`,`Organizing the concepts and explanation`],writing:[`正在撰写说明`,`Writing the explanation`],reviewing:[`正在核对说明与来源`,`Checking the explanation against its sources`]}[e][+!t]:t?`正在整理说明`:`Preparing an explanation`}var jo=(e,t)=>[`reader-foundation-choice`,e,t],Mo=(e,t)=>`argus:reader-foundation:${e}:${t}`,No=e=>[`artifacts`,e,`reader`],Po=(e,t)=>[`reader-foundation-request`,e,t],Fo=(e,t)=>`${Mo(e,t)}:request`;function Io(e,t){let n=kt(Mo(e,t));if(!n)return{id:null,choice:0};try{let e=JSON.parse(n);if((typeof e?.id==`string`||e?.id===null)&&Number.isSafeInteger(e.choice)&&e.choice>=0)return e}catch{}return{id:n,choice:0}}function Lo(e,t){try{let n=JSON.parse(kt(Fo(e,t))||`null`);return typeof n?.id==`string`&&typeof n.draft?.question==`string`&&typeof n.beforeChoice==`number`?n:null}catch{return null}}function Ro(e,t,n,r){e.setQueryData(Po(t,n),r),Ot(Fo(t,n),JSON.stringify(r))}function zo(e,t,n,r){let i=e.getQueryData(Po(t,n)),a=Lo(t,n);i?.id===r&&(!a||a.id===r)&&Ro(e,t,n,null)}function Bo(e,t){return A({queryKey:Po(e,t),queryFn:k,enabled:!1,initialData:()=>Lo(e,t),staleTime:1/0,gcTime:1/0}).data??null}function Vo(e,t,n,r){let i={id:r,choice:Ho(e,t,n).choice+1};return e.setQueryData(jo(t,n),i),Ot(Mo(t,n),JSON.stringify(i)),i}function Ho(e,t,n){let r=e.getQueryData(jo(t,n)),i=Io(t,n);return r&&r.choice>=i.choice?r:i}function Uo(e,t){return A({queryKey:jo(e,t),queryFn:k,enabled:!1,initialData:()=>Io(e,t),staleTime:1/0,gcTime:1/0}).data}function Wo(e,t=ae()===`question-foundation`){return A({queryKey:No(e),queryFn:async({signal:t})=>(await R.artifacts(e,t,!0)).filter(e=>e.source===`reader_foundation`),enabled:!!e&&t,refetchInterval:e=>e.state.data?.some(e=>e.reader_foundation?.state===`generating`)?5e3:!1,retry:!1,refetchOnWindowFocus:!1})}function Go({sid:e,snapshot:t,view:n,active:r,readOnly:i=!1,allowGeneration:a=!0,locale:o,preview:s=ae(),foundationId:c}){let l=M(),u=n.mission.id,d=uo(t,n),f=fo(e,d),p=Uo(e,o),m=s===`question-foundation`?c===void 0?p.id:c:null,h=s===`question-foundation`&&!m,g=lo(e,o,s,m),_=r&&!!e&&!!u&&t.session.id===e,v=A({queryKey:f,queryFn:async({signal:t})=>{let n=l.getQueryData(f),r=po(await R.liveMap(e,t,n?.cursor,d),e,u);return So(l.getQueryData(f),r)},enabled:_,refetchInterval:_?15e3:!1,staleTime:1e4,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),y=A({queryKey:g,queryFn:async({signal:t})=>{let n=s===`question-foundation`?await R.mapCopy(`project`,e,o,t,e,s,m):await R.mapCopy(`project`,e,o,t,e,s),r=l.getQueryData(g);return to(r,n,r?.model_revision)},enabled:_,staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),b=v.data?.tasks.find(e=>e.id===u),x=Do(u,b,d.eventSince),S=ko(g,u,x),C=(0,G.useMemo)(()=>mo(v.data,b,d.eventSince),[v.data,b,d.eventSince]),w=go(b,C),T=u?y.data?.cards[u]:void 0,E=(T?.version??0)>=14&&_o(T?.reader_brief)?T.reader_brief:void 0,D=vo(v.data,b,C,y.data),O=yo(y.data),k=_&&a&&!i&&!h&&!!b&&y.data?.available===!0&&!O&&!v.isError&&!y.isError,j=[`research-brief-generation`,e,u,o,d.eventSince,s,...s===`question-foundation`?[m]:[]],N=Math.max(14,y.data?.version??0),P=[...j,N,y.data?.model_revision??null,w],F=ee({queryKey:j}),te=l.getQueryState(P)?.status===`error`,ne=A({queryKey:P,queryFn:async()=>{if(!b)throw Error(`The current task is not recorded yet.`);let t=l.getQueryData(g)?.model_revision,n=Oo(l,g,[{key:b.id,startedAt:x}]),r;try{r=await R.generateMapCopy(`project`,e,{cards:[ho(b,C)],locale:o,...m?{foundation_id:m}:{}},void 0,e,s,n.update)}finally{n.finish()}let i=r.cards?.[b.id],a={available:(i?.version??0)>=14&&_o(i?.reader_brief)&&!r.retry_after&&r.available!==!1&&(i?.version??0)>=N&&!!v.data&&!no(ho(b,C),v.data,r,new Map(C.map(e=>[e.id,e]))),retryAfter:r.retry_after??null,inputSignature:w};return l.setQueryData(g,e=>to(e,r,t)),a},enabled:k&&D&&!te&&F===0,staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),re=ne.data?.retryAfter;return(0,G.useEffect)(()=>{if(!k||!D||ne.isFetching||ne.isError||ne.data?.available!==!1||typeof re!=`number`||!Number.isFinite(re)||re<=0)return;let e=setTimeout(()=>{ne.refetch({cancelRefetch:!1})},Math.max(0,ne.dataUpdatedAt+re*1e3-Date.now()));return()=>clearTimeout(e)},[k,D,ne.isFetching,ne.isError,ne.data?.available,ne.dataUpdatedAt,re,ne.refetch]),{foundationId:m,foundationRequired:h,questionContext:{locale:o===`zh-CN`?`zh-CN`:`en-US`,preview:s,foundationId:m},task:b,evidence:C,loadedEvents:v.data?.events,card:T,brief:E,inputSignature:w,needsUpdate:D&&ne.data?.available!==!0,legacy:O,loading:_&&(v.isPending||y.isPending),generating:S.active||ne.isFetching||F>0,generationPhase:S.phase,readError:v.error||y.error,generationError:D&&!S.active?ne.error:null,generationUnavailable:ne.data?.available===!1&&D&&!S.active,generationAvailable:y.data?.available===!0,teachingUnavailable:!!E&&T?.teaching_review?.status===`unavailable`,readingUnavailable:!!E&&T?.teaching_review?.reading_review?.status===`unavailable`,retry:async()=>{_&&(v.isError||y.isError||!y.data?.available||O||!b?await Promise.allSettled([v.refetch(),y.refetch()]):k&&await ne.refetch())}}}function Ko(e){let t=new Set;return[e.primary_target,...e.targets].filter(e=>!e?.path||t.has(e.path)?!1:(t.add(e.path),!0))}function qo(e,t){if(t===`research`)for(let t of e){let e=Ko(t).find(e=>/(?:^|\/)paper\/main\.pdf$/i.test(e.path.replace(/\\/g,`/`)));if(e)return{receipt:t,path:e.path}}let n=e[0];return n?{receipt:n,path:Ko(n)[0]?.path||null}:null}function Jo(e){return e.replace(/\s*\bRESULT\s*=\s*/g,` + +`).replace(/\s*\b(?:STATUS|REVIEW_STATUS)\s*=\s*\S+/g,``).trim()}function Yo(e,t,n){let r=n.reduce((e,t)=>t.type===`ui.operator`?Math.max(e,Number(t.ts)||0):e,0),i=t&&(e===void 0||t.delivered_at>r)?t:null;return e?i&&i.delivered_at>e.delivered_at?i:e:i}function Xo(e,t){if(!t)return!1;let n=new Set([t]),r=[t];for(let t=0;te.id!==t&&n.has(e.id)&&[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))}var Zo=new Set([`done`,`passed`,`approved`,`accepted`]);function Qo(e,t){let n=String(e.review_status||``).toLowerCase(),r=String(e.review_source||``).toLowerCase(),i=String(e.residual_risk||``).trim();return Zo.has(n)&&r===`reviewer`&&i?{independent:!0,text:t?`独立复核通过 · 有残余风险`:`Independently reviewed · residual risk`,title:t?`有一项检查在此环境中无法进行,已被接受为残余风险:${i}`:`One check was impossible here and its risk was accepted: ${i}`}:Zo.has(n)&&r===`reviewer`?{independent:!0,text:t?`独立复核通过`:`Independently reviewed`,title:t?`另一个审查角色检查过这份成果`:`A separate reviewer checked this result`}:!n||n===`not_assessed`||Zo.has(n)&&r?{independent:!1,text:t?`实现者自检 · 未独立复核`:`Self-checked · not independently reviewed`,title:t?`只有完成它的人自己检查过,没有另外的审查`:`Only the worker that produced it checked it; no separate review`}:Zo.has(n)?{independent:!1,text:t?`已完成 · 未记录是否独立复核`:`Completed · review source not recorded`,title:t?`这份较早的交付没有记录是谁检查的,不能确认经过独立复核`:`This older delivery did not record who checked it, so independent review cannot be confirmed`}:{independent:!1,text:t?`复核状态:${n}`:`Review: ${n}`,title:t?`独立复核没有通过或已过期`:`Independent review did not pass or is out of date`}}function $o(e,t,n){if(!n)return null;let r=e.snapshots?.find(e=>e.path===n&&e.stored);if(!r)return null;let i=t.filter(t=>t.delivery_id!==e.delivery_id&&t.delivered_att.delivered_at-e.delivered_at);for(let e of i){let t=e.snapshots?.find(e=>e.path===n);if(!(!t||t.sha256===r.sha256))return t.stored?{path:n,before:t.sha256,after:r.sha256}:null}return null}var es=[1,0],ts=[{id:`up`,vector:[0,1],zh:`向上 1 格`,en:`Up 1 square`},{id:`right`,vector:[2,0],zh:`向右 2 格`,en:`Right 2 squares`},{id:`fraction`,vector:[1.5,0],zh:`向右 1.5 格`,en:`Right 1.5 squares`},{id:`zero`,vector:[0,0],zh:`留在原点`,en:`Stay at the origin`}];function ns(e,t){return e[0]*t[1]-e[1]*t[0]===0?e.some(Boolean)||t.some(Boolean)?1:0:2}function rs(e){if(!e)return!1;let t=[e.name,e.explanation,e.example,e.connection].join(` `);return/独立(?:的)?方向|线性(?:无关|独立)|independent\s+directions?\b|linear\s+independence\b|linearly\s+independent\b/iu.test(t)}function is(){let{locale:e}=z(),t=e===`zh-CN`,n=(e,n)=>t?e:n,[r,i]=(0,G.useState)(ts[0]),a=(0,G.useId)(),o=r.vector,s=ns(es,o),c=e=>62+e*36,l=e=>116-e*36,u=r.id===`up`?n(`只沿 A 左右移动,走不到 B 的终点;B 补上了上下方向。`,`Moving left or right along A cannot reach B’s endpoint. B adds an up-and-down direction.`):r.id===`right`?n(`走两次 A 就能代替 B。步子更长,并没有增加独立方向。`,`Two copies of A replace B. A longer step does not add an independent direction.`):r.id===`fraction`?n(`走两次 B 和走三次 A,都向右走了 3 格。虽然两者互相都不是整数倍,仍只有一个独立方向。`,`Two copies of B and three copies of A both move 3 squares right. Neither is an integer multiple of the other, but they still provide only one independent direction.`):n(`B 没有移动,没有增加方向;A 仍提供一个独立方向。`,`B does not move, so it adds no direction. A still provides one independent direction.`),d=n(`这两支箭头提供 ${s} 个独立方向`,`These two arrows provide ${s} independent direction${s===1?``:`s`}`);return(0,J.jsxs)(`section`,{className:`my-2 rounded-lg border border-line bg-surface p-3`,"aria-label":n(`平面上的独立方向示意`,`Independent directions in a plane`),"data-testid":`direction-example`,children:[(0,J.jsx)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:n(`A 固定向右走 1 格。改变 B,看看它是否提供新的走法。允许把箭头缩放、反向,再相加。`,`A always moves 1 square right. Change B to see whether it adds a new way to move. Arrows may be scaled, reversed, and added.`)}),(0,J.jsxs)(`svg`,{viewBox:`0 0 210 180`,className:`mx-auto my-2 block w-full max-w-[260px]`,role:`img`,"aria-labelledby":`${a}-title ${a}-desc`,children:[(0,J.jsx)(`title`,{id:`${a}-title`,children:d}),(0,J.jsx)(`desc`,{id:`${a}-desc`,children:`A = (1, 0), B = (${o[0]}, ${o[1]}). ${u}`}),(0,J.jsxs)(`defs`,{children:[(0,J.jsx)(`marker`,{id:`${a}-a`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,J.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:B.accent})}),(0,J.jsx)(`marker`,{id:`${a}-b`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,J.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:B.success})})]}),(0,J.jsx)(`rect`,{x:`20`,y:`32`,width:`165`,height:`125`,rx:`4`,fill:B.accent,opacity:s===2?.07:0}),[-1,0,1,2,3].map(e=>(0,J.jsx)(`line`,{x1:c(e),x2:c(e),y1:`32`,y2:`157`,stroke:`rgb(var(--line))`},`x${e}`)),[-1,0,1,2].map(e=>(0,J.jsx)(`line`,{y1:l(e),y2:l(e),x1:`20`,x2:`185`,stroke:`rgb(var(--line))`},`y${e}`)),s===1?(0,J.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:B.accent,strokeWidth:`10`,opacity:`.09`}):null,(0,J.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:B.inkFaint}),(0,J.jsx)(`line`,{x1:c(0),x2:c(0),y1:`32`,y2:`157`,stroke:B.inkFaint}),[0,1,2,3].map(e=>(0,J.jsx)(`text`,{x:c(e)-3,y:l(0)+14,fill:B.inkFaint,fontSize:`9`,children:e},e)),r.id===`zero`?(0,J.jsx)(`circle`,{cx:c(0),cy:l(0),r:`5`,fill:`rgb(var(--surface))`,stroke:B.success,strokeWidth:`3`,"data-testid":`direction-b-zero`}):(0,J.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(o[0]),y2:l(o[1]),stroke:B.success,strokeWidth:`3`,markerEnd:`url(#${a}-b)`,"data-testid":`direction-b`}),(0,J.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(es[0]),y2:l(es[1]),stroke:B.accent,strokeWidth:`3`,markerEnd:`url(#${a}-a)`}),(0,J.jsx)(`text`,{x:c(es[0])+3,y:l(es[1])-10,fill:B.accent,fontSize:`12`,fontWeight:`600`,children:`A`}),(0,J.jsx)(`text`,{x:c(o[0])+(r.id===`zero`?-17:8),y:l(o[1])+(r.id===`up`?-3:28),fill:B.success,fontSize:`12`,fontWeight:`600`,children:`B`})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,role:`group`,"aria-label":n(`选择 B 的走法`,`Choose B’s movement`),children:ts.map(e=>(0,J.jsx)(W,{className:`text-[11px]`,variant:r.id===e.id?`primary`:`ghost`,"aria-pressed":r.id===e.id,onClick:()=>i(e),"data-choice":e.id,children:t?e.zh:e.en},e.id))}),(0,J.jsxs)(`div`,{className:`mt-3`,"aria-live":`polite`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-ink`,"data-testid":`direction-count`,children:d}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:u})]}),(0,J.jsx)(`p`,{className:`mt-3 border-t border-line pt-2 text-[11px] leading-5 text-ink-faint`,children:n(`这里只统计这两支箭头提供的方向。找到一些独立方向,不等于已经找全研究对象的所有方向;图里的数字不能用来计算曲面的 Picard 数,也不能证明研究中的条件。`,`This counts only the directions supplied by these two arrows. Finding some independent directions does not establish that they span the whole research object. These numbers cannot determine a surface’s Picard number or prove the conditions used in the research.`)})]})}function as({path:e,identity:t,artifacts:n,onOpenArtifact:r}){let{locale:i}=z(),a=i===`zh-CN`,o={artifacts:n,onOpenArtifact:r};return(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-learning-path":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`理解这个问题`:`Understand the question`}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-question":!0,children:(0,J.jsx)(H,{...o,children:e.question})}),(0,J.jsx)(`ol`,{className:`mt-4 grid list-none gap-5 p-0`,children:e.steps.map((e,n)=>(0,J.jsxs)(`li`,{className:`min-w-0 border-t border-line/50 pt-3`,"data-learning-step":n+1,children:[(0,J.jsxs)(`h4`,{className:`mb-2 text-sm font-medium text-ink`,children:[(0,J.jsxs)(`span`,{className:`mr-2 text-ink-faint`,children:[n+1,`.`]}),e.title]}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-explanation":!0,children:(0,J.jsx)(H,{...o,children:e.explanation})}),(0,J.jsxs)(`div`,{className:`mt-3 border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-learning-example":!0,children:[(0,J.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`例子`:`Example`}),(0,J.jsx)(H,{...o,children:e.example})]}),(0,J.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,"data-learning-check":!0,children:[(0,J.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`小问题`:`Try it`}),(0,J.jsx)(`div`,{"data-learning-check-question":!0,children:(0,J.jsx)(H,{...o,children:e.check.question})}),(0,J.jsx)(ft,{label:a?`点击看解答`:`Show the answer`,children:(0,J.jsx)(`div`,{"data-learning-check-answer":!0,children:(0,J.jsx)(H,{...o,children:e.check.answer})})},`${e.check.question}:${e.check.answer}`)]})]},`${t}:${n}`))})]})}function os({value:e,expandLabel:t,clamp:n=!0}){let[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),s=(0,G.useRef)(null),{locale:c}=z();return(0,G.useEffect)(()=>{let e=s.current;if(!e||!n||r)return;let t=()=>o(e.scrollHeight>e.clientHeight+1);t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,n,r]),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{ref:s,className:`text-[13px] leading-6 text-ink-dim ${!n||r?``:`line-clamp-3`}`,children:(0,J.jsx)(H,{children:e})}),n&&(a||r)?(0,J.jsxs)(`button`,{type:`button`,className:`mt-0.5 text-xs text-blue-sky hover:underline`,onClick:()=>i(!r),"aria-expanded":r,children:[r?c===`zh-CN`?`收起`:`Show less`:t,(0,J.jsx)(Ue,{size:11,className:`ml-1 inline ${r?`rotate-180`:``}`})]}):null]})}function ss({generatedAt:e,pending:t=!1,generating:n=!1,phase:r,hasExplanation:i=!1,error:a,unavailable:o=!1,retry:s,retryDisabled:c=!1}){let{locale:l}=z(),u=l===`zh-CN`,d=Tt({ts:e}),f=d?.toLocaleString(l,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,p=!!a||o;return!(i&&(f||t))&&!n&&!p?null:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,"data-testid":`research-brief-status`,children:[i&&(f||t)?(0,J.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,children:[t?`${u?`上次说明`:`Previous explanation`}${f||!p?` · `:``}`:``,f?(0,J.jsx)(`time`,{dateTime:d?.toISOString(),title:d?.toLocaleString(l),children:f}):null,t&&!p?`${f?` · `:``}${u?`待更新`:`update pending`}`:``]}):null,p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:a?u?`说明生成未完成;不会自动重复请求。`:`The explanation could not be prepared. This request will not be repeated automatically.`:u?`说明暂未更新;可以手动重试。`:`The explanation has not been updated yet. You can retry manually.`}),s?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:n||c,onClick:()=>void s(),children:[(0,J.jsx)(Ke,{size:12}),u?`重试`:`Retry`]}):null]}):n?(0,J.jsxs)(`span`,{role:`status`,"data-explanation-phase":r??`pending`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint`,children:[(0,J.jsx)(tt,{}),Ao(r,u)]}):null]})}function cs({brief:e,identity:t,detail:n,learningPath:r,foundation:i,readingUnavailable:a=!1,teachingUnavailable:o=!1,artifacts:s,onOpenArtifact:c}){let{locale:l}=z(),u=l===`zh-CN`,d=(e,t)=>u?e:t;return(0,J.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-4`,"data-reader-explanation":t,children:[i?(0,J.jsxs)(`div`,{className:`rounded border border-line/60 p-2 text-xs text-ink-dim`,"data-foundation-id":i.id,children:[(0,J.jsxs)(`p`,{children:[d(`这次进展参考的基础说明:`,`Foundations used to explain this progress: `),i.question]}),c?(0,J.jsx)(W,{className:`mt-1 text-xs`,onClick:()=>c(i.path),children:d(`阅读这份基础说明`,`Read these foundations`)}):null]}):null,a?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`阅读说明还需要核对,可以继续问这一步。`,`The reading explanation still needs checking. You can keep asking about this step.`)}):o?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`这个概念的说明还没核对清楚,可以继续问这一步。`,`The explanation of this concept has not been checked clearly yet. You can keep asking about this step.`)}):null,r?(0,J.jsx)(as,{path:r,identity:t,artifacts:s,onOpenArtifact:c},t):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-why":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`这一步为什么有用`,`Why this step helps`)}),(0,J.jsx)(os,{value:e.why,expandLabel:d(`完整说明`,`Full explanation`),clamp:!1},`why:${t}`)]}),e.concept?(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-teaching":t,children:[(0,J.jsxs)(`h3`,{className:`mb-3 text-xs font-medium text-ink`,children:[d(`认识一个概念`,`One useful concept`),` · `,e.concept.name]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 gap-3`,"data-reader-teaching-columns":t,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,"data-reader-definition":t,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`定义`,`Definition`)}),(0,J.jsx)(os,{value:e.concept.explanation,expandLabel:d(`完整定义`,`Full definition`),clamp:!1},`concept:${t}:${e.concept.name}`)]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-testid":`concept-example`,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`例子`,`Example`)}),(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:e.concept.example})]}),rs(e.concept)?(0,J.jsx)(ft,{label:d(`动手看两个方向`,`Try two directions`),children:(0,J.jsx)(is,{})}):null]}),(0,J.jsxs)(`div`,{className:`min-w-0`,"data-reader-connection":t,children:[(0,J.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`与本步的关系`,`Connection to this step`)}),(0,J.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:e.concept.connection})})]})]})]}):null]}),(0,J.jsxs)(`section`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`结论到哪里为止`,`What this does and does not establish`)}),(0,J.jsx)(os,{value:e.scope,expandLabel:d(`完整适用范围`,`Full scope`),clamp:!1},`scope:${t}`)]}),(0,J.jsxs)(`section`,{className:`min-w-0`,"data-reader-next-interpretation":t,children:[(0,J.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`解说对后续的理解`,`How the explanation interprets the follow-up`)}),(0,J.jsx)(os,{value:e.next,expandLabel:d(`完整解读`,`Full interpretation`),clamp:!1},`next:${t}`)]}),n?(0,J.jsx)(ft,{className:`min-w-0`,label:d(`详细说明与条件`,`Detailed explanation and conditions`),children:(0,J.jsx)(`div`,{className:`macro-reader-markdown text-[13px] leading-6 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:s,onOpenArtifact:c,children:n})})},`detail:${t}`):null]})}function ls({task:e,artifacts:t,onOpenArtifact:n}){let r=z().locale===`zh-CN`,i=typeof e?.pending_question==`string`?e.pending_question.trim():``;return i?(0,J.jsxs)(`section`,{className:`mt-4 min-w-0 border-t border-line/60 pt-3 text-[13px] leading-6 text-ink-dim`,"data-reader-pending-question":e.id,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:r?`这一步在等你回答`:`This step is waiting for your answer`}),(0,J.jsx)(H,{artifacts:t,onOpenArtifact:n,children:i})]}):null}function us(e){return e.kind===`markdown`||e.mime?.split(`;`,1)[0].trim().toLowerCase()===`text/markdown`||/\.(?:md|markdown)$/i.test(e.name||e.path||``)}function ds(e){return e.title?.trim()||e.question}var fs=[{label:[`从头讲清楚`,`Explain from the beginning`],question:[`请从头讲清楚这份说明。先用日常语言解释它在讨论什么、要判断什么,再按需要解释其中的对象和符号。涉及比较或公式时,请明确两边是什么、哪些条件下能比较,并用一个可复算的小例子说明。请分别说明标准背景知识、本次已有证据和仍未知的内容。`,`Explain this reading from the beginning using everyday language. Start with what it discusses and what we are trying to determine, then explain the necessary objects and symbols. For a comparison or formula, define both sides and when the comparison is valid, and work a small example I can recompute. Distinguish standard background, evidence from this run, and what remains unknown.`]},{label:[`带我算一遍`,`Work through an example`],question:[`请带我实际算一遍这份说明中的关键一步。先解释对象、输入和运算规则,再用一组明确标为教学例子的小数据展示中间步骤与结果,然后换一个输入让我能照着计算。请说明它怎样关系到正在判断的结论,以及这个例子还不能证明什么。`,`Walk me through the key operation in this reading. Explain the objects, inputs, and rules, then use a small example clearly labeled as a teaching example to show the intermediate steps and result. Change one input and work it again so I can follow the calculation. Explain how it relates to the conclusion being assessed and what the example does not prove.`]},{label:[`这说明了什么`,`What does this establish?`],question:[`这份说明究竟支持什么结论?请用我能懂的语言解释已经验证的部分、依赖的条件、未覆盖的情况,以及它和整个任务目标的关系。解释必要概念,并指出哪些只是记录中的说法、哪些有可核对的依据。`,`What conclusion does this reading support? Explain the part that has been checked, its assumptions, the cases it does not cover, and how it relates to the overall task. Explain the necessary concepts and distinguish reported claims from conclusions with verifiable supporting evidence.`]}];function ps({draft:e,onChange:t,onSubmit:n,disabled:r,children:i}){let a=z().locale===`zh-CN`,o=!!e.parentId||!!e.progressSource,s=(0,G.useRef)(null);return(0,J.jsxs)(J.Fragment,{children:[i,o&&!e.question.trim()?(0,J.jsxs)(`div`,{className:`mb-3 space-y-2`,"data-reading-question-suggestions":!0,children:[(0,J.jsx)(`p`,{className:`text-xs text-ink-dim`,children:a?`可以从这些问题开始,也可以直接输入。`:`Start with one of these questions, or write your own.`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:fs.map(n=>(0,J.jsx)(W,{type:`button`,className:`text-xs`,disabled:r,onClick:()=>{t({...e,question:n.question[+!a]}),s.current?.focus()},children:n.label[+!a]},n.label[1]))})]}):null,(0,J.jsx)(`textarea`,{ref:s,"aria-label":a?`想理解的问题`:`Question to understand`,className:`min-h-40 w-full rounded-lg border border-line bg-bg p-3 text-sm leading-6 text-ink`,maxLength:8e3,value:e.question,onChange:n=>t({...e,question:n.target.value})}),e.sourceTitle?(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[a?`从这项任务打开:`:`Opened from this task: `,e.sourceTitle]}):null,(0,J.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,J.jsx)(W,{"data-reading-submit":!0,disabled:!e.question.trim()||r,onClick:n,children:o?a?`提问`:`Ask question`:a?`生成并保存基础说明`:`Generate and save foundations`})})]})}function ms(e){if(!e||typeof e!=`object`)return!1;let t=e;return[`source_id`,`title`,`path`,`task_id`,`card_key`].every(e=>typeof t[e]==`string`&&String(t[e]).trim())&&Number.isFinite(t.generated_at)&&t.generated_at>=0&&Number.isSafeInteger(t.copy_revision)&&t.copy_revision>=0}function hs(e){let t=e.reader_foundation;return!!t&&(t.kind??`foundation`)===`foundation`&&!t.parent_id&&!t.progress_source}function gs(e,t,n=!0){let r=M(),i=Wo(e,n),a=Bo(e,t),o=[`reader-foundation-create`,e,t],s=P({filters:{mutationKey:o,status:`pending`},select:e=>e.state.variables?.id}),c=ko(o,s.at(-1)??a?.id),l=n=>({sid:n.sid??e,locale:n.locale??t}),u=N({mutationKey:o,mutationFn:async e=>{let t=l(e),n=Oo(r,[`reader-foundation-create`,t.sid,t.locale],[{key:e.id}]);try{let r={request_id:e.id,question:e.draft.question.trim(),locale:t.locale},i=e.draft.parentId?await R.askReaderFoundation(t.sid,e.draft.parentId,r,n.update):await R.generateReaderFoundation(t.sid,{...r,...e.draft.progressSource?{progress_source:{source_id:e.draft.progressSource.source_id}}:e.draft.sourceTaskId?{source_task_id:e.draft.sourceTaskId}:{}},n.update),a=i.reader_foundation;if(a?.id!==e.id||a.locale!==t.locale)throw Error(t.locale===`zh-CN`?`说明请求的结果尚未确认。`:`The result of this explanation request is unconfirmed.`);if(e.draft.parentId&&(a.kind!==`clarification`||a.parent_id!==e.draft.parentId))throw Error(t.locale===`zh-CN`?`追问与来源说明的对应关系尚未确认。`:`The question’s connection to its source is unconfirmed.`);if(e.draft.progressSource&&(a.progress_source?.source_id!==e.draft.progressSource.source_id||!e.draft.parentId&&a.kind!==`progress_answer`))throw Error(t.locale===`zh-CN`?`回答与这版进展说明的对应关系尚未确认。`:`The answer’s connection to this progress explanation is unconfirmed.`);return i}finally{n.finish(),await r.invalidateQueries({queryKey:No(t.sid)})}},onSuccess:(e,t)=>{let n=l(t);!t.draft.parentId&&!t.draft.progressSource&&hs(e)&&e.exists&&e.reader_foundation?.state===`complete`&&Ho(r,n.sid,n.locale).choice===t.beforeChoice&&Vo(r,n.sid,n.locale,e.reader_foundation.id),r.setQueryData(No(n.sid),t=>{let n=t?.find(t=>t.path===e.path);return n&&n.reader_foundation?.state!==`generating`&&e.reader_foundation?.state===`generating`?t:[...(t??[]).filter(t=>t.path!==e.path),e]}),t.draft.progressSource||r.invalidateQueries({queryKey:[`map-copy`,`project`,n.sid]})},onError:(e,t)=>{if(e instanceof se&&e.code===`reader_source_unavailable`){let e=l(t);Ro(r,e.sid,e.locale,{...t,rejected:`reader_source_unavailable`})}},retry:!1}),d=(i.data??[]).filter(e=>e.reader_foundation?.locale===t),f=d.some(e=>e.reader_foundation?.state===`generating`),p=d.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),m=u.variables&&l(u.variables),h=m?.sid===e&&m.locale===t,g=h&&u.isPending||s.length>0||c.active,_=a?.id??(h?u.variables?.id:void 0),v=d.find(e=>e.reader_foundation?.id===_),y=v?.reader_foundation?.state===`failed`,b=v?.reader_foundation?.state===`complete`,x=a?.rejected===`reader_source_unavailable`,S=!!a&&!x&&!v&&!g,C=g||f||!!a&&!x||i.isPending||i.isError;return(0,G.useEffect)(()=>{a&&(y||b)&&zo(r,e,t,a.id)},[r,e,t,a,y,b]),{client:r,list:i,notes:d,pendingRequest:a,progress:c,generation:u,waiting:f,overdue:p,creating:g,requested:v,confirmedFailure:y,confirmedComplete:b,requestRejected:x,unknownResult:S,creationBlocked:C,submit:n=>{if(!n.question.trim()||C)return null;let i=crypto.randomUUID(),a={id:i,sid:e,locale:t,draft:{...n,...n.progressSource?{progressSource:{...n.progressSource}}:{}},beforeChoice:Ho(r,e,t).choice};return Ro(r,e,t,a),u.mutate(a),i},retrySavedRequest:n=>u.mutate({...n,sid:n.sid??e,locale:n.locale??t})}}var _s=(0,G.createContext)(null);function vs({card:e,cardKey:t,taskId:n,readOnly:r=!1,context:i}){let a=(0,G.useContext)(_s),o=z().locale===`zh-CN`,[s,c]=(0,G.useState)(`idle`),[l,u]=(0,G.useState)(!1),d=(0,G.useRef)(0),f=i??a?.context,p=JSON.stringify([a?.sid,a?.readOnly,r,f,t,n,e?.copy_revision,e?.generated_at,e?.title]),m=(0,G.useRef)(p);if(m.current=p,(0,G.useEffect)(()=>(c(`idle`),()=>{d.current+=1}),[p]),!a?.sid||a.readOnly||r)return null;let h=!!e&&Number.isSafeInteger(e.copy_revision)&&!!e.title?.trim()&&!(f?.preview===`question-foundation`&&!f.foundationId),g=async()=>{if(!h||!f||s===`opening`)return;let r=++d.current;c(`opening`);try{let i=await a.source(t,n,f);if(r!==d.current||m.current!==p)return;if(i&&(i.copy_revision!==e.copy_revision||i.generated_at!==e.generated_at||i.title!==e.title))throw new se(`The selected explanation has changed.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);c(`idle`),i&&a.open(i)}catch(e){r===d.current&&m.current===p&&(u(e instanceof se&&e.code===`reader_source_unavailable`),c(`failed`))}};return(0,J.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-1`,children:[(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:!h||s===`opening`,title:h?void 0:o?`这一步的说明写好后就可以提问。`:`Questions open once this step has an explanation.`,"data-testid":`progress-question-trigger`,"data-progress-question-card":t,"data-progress-question-state":s,onClick:()=>void g(),children:[(0,J.jsx)(sn,{size:12}),o?`问这一步`:`Ask about this step`]}),s===`failed`?(0,J.jsx)(`span`,{role:`alert`,className:`text-xs text-ink-dim`,children:l?o?`这版说明暂不可用或已变化,未打开提问。请刷新页面后再试。`:`This explanation is unavailable or has changed. No question was opened. Reload this page and try again.`:o?`暂时无法读取这一步的提问材料,未打开提问。请再试一次。`:`The question material could not be loaded. No question was opened. Please try again.`}):null]})}function ys(){let e=(0,G.useContext)(_s),t=z().locale===`zh-CN`;return e?.hasHistory?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>e.open(),children:[(0,J.jsx)(K,{size:12}),t?`阅读问答`:`Reading questions`]}):null}function bs({sid:e,path:t,artifacts:n,onOpenArtifact:r}){let i=z().locale===`zh-CN`,a=A({queryKey:[`reading-question-artifact`,e,t],queryFn:async({signal:n})=>{let r=await R.artifact(e,t,n);if(r.exists&&r.path===t&&(r.truncated||typeof r.preview!=`string`)){let i=await R.artifactBlob(e,t,!1,n);return{...r,preview:await i.text(),truncated:!1}}return r},retry:!1,staleTime:1/0,refetchOnWindowFocus:!1});return a.isPending?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:i?`正在读取保存内容…`:`Loading saved reading…`}):a.isError||!a.data?.exists||a.data.path!==t?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[i?`保存内容暂时无法读取。`:`The saved reading could not be loaded.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>void a.refetch(),children:i?`重新读取`:`Reload`})]}):(0,J.jsxs)(`div`,{className:`min-w-0 max-w-full overflow-x-auto break-words`,"data-reading-artifact-path":t,children:[(0,J.jsx)(H,{artifacts:[...n,...a.data.reader_foundation?.sources??[]],onOpenArtifact:r,children:a.data.preview??``}),a.data.truncated?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`此处显示保存内容的节选。`:`This view shows an excerpt of the saved reading.`}):null]})}function xs({sid:e,readOnly:t=!1,children:n}){let r=z().locale,i=r===`zh-CN`?`zh-CN`:`en-US`,a=i===`zh-CN`,o=gs(e??``,i,!!e),s=Uo(e??``,i).id,c=(0,G.useRef)(0),l=async(t,n,r)=>{let i=++c.current,{preview:a,foundationId:o,locale:s}=r,l=await R.mapQuestionSource(e??``,{card_key:t,task_id:n,locale:s,...a?{preview:a}:{},...a===`question-foundation`&&o?{foundation_id:o}:{}});if(i!==c.current)return null;if(!ms(l)||l.card_key!==t||l.task_id!==n||!l.path.startsWith(`reader-progress/${e}/`))throw new se(`The reading source does not match this step.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);return l},[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(null);(0,G.useEffect)(()=>(d(null),p(null),h(null),_(!1),y(null),()=>{c.current+=1}),[e,i]);let b=u&&u.sid===e&&u.locale===i?u:null,x=b?.source,S=o.notes.filter(e=>ms(e.reader_foundation?.progress_source)),C=o.pendingRequest?.draft.progressSource?o.pendingRequest:null,w=new Map;for(let t of S){let n=t.reader_foundation.progress_source;n.path.startsWith(`reader-progress/${e}/`)&&w.set(n.source_id,n)}C?.draft.progressSource&&w.set(C.draft.progressSource.source_id,C.draft.progressSource),x&&w.set(x.source_id,x);let T=[...o.list.data??[],...[...w.values()].map(e=>({path:e.path}))],E=e=>{e===x?.path?(_(!0),y(null)):y(e)},D=x?S.filter(e=>e.reader_foundation.progress_source.source_id===x.source_id):[],O=D.find(e=>e.reader_foundation?.id===m),k=O?.exists&&O.reader_foundation?.state===`complete`,A=C?.draft.progressSource?.source_id===x?.source_id?C:null,j=A?D.find(e=>e.reader_foundation?.id===A.id):void 0,M=!!A&&A.rejected===`reader_source_unavailable`,ee=!!A&&!M&&!j&&!o.creating,N=n=>{c.current+=1;let r=n??C?.draft.progressSource??[...w.values()].at(-1);if(!e||!ms(r)||!r.path.startsWith(`reader-progress/${e}/`))return;d({sid:e,locale:i,source:{...r}}),_(!1),y(null);let a=S.filter(e=>e.reader_foundation?.progress_source?.source_id===r.source_id).at(-1);h(a?.reader_foundation?.id??null),p(n&&!t?{question:``,progressSource:{...r}}:null)},P=()=>{d(null),p(null),h(null),_(!1),y(null)},F=t=>{e&&(d({sid:e,locale:i,source:{...t}}),h(null),_(!1),y(null),p(e=>e?{question:e.question,progressSource:{...t}}:null))},te=()=>{if(t||!b||!f?.progressSource||f.progressSource.source_id!==b.source.source_id||f.parentId&&!D.some(e=>e.reader_foundation?.id===f.parentId&&e.exists&&e.reader_foundation?.state===`complete`))return;let e=o.submit(f);e&&(h(e),p(null))},ne=!!A&&o.creating||D.some(e=>e.reader_foundation?.state===`generating`);return(0,J.jsxs)(_s.Provider,{value:{sid:e??``,readOnly:t,hasHistory:w.size>0,open:N,source:l,context:{locale:i,preview:ae(),foundationId:s}},children:[n,(0,J.jsx)(dt,{open:!!b,onClose:P,label:a?`进展阅读问答`:`Questions about this progress`,children:b&&x?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lt,{title:a?`哪里还不明白`:`What is still unclear`,sub:x.title}),(0,J.jsxs)(`div`,{className:`space-y-4 px-6 pb-6`,"data-testid":`progress-questions`,"data-project-id":b.sid,"data-progress-source-id":x.source_id,"data-progress-source-title":x.title,"data-reader-card":x.card_key,"data-reader-task-id":x.task_id,children:[(0,J.jsxs)(`div`,{className:`rounded-lg border border-line/70 p-3 text-xs text-ink-dim`,children:[(0,J.jsxs)(`p`,{children:[a?`引用打开提问时的这版说明:`:`Using the explanation selected when this question was opened: `,x.title]}),(0,J.jsx)(`time`,{dateTime:new Date(x.generated_at*1e3).toISOString(),className:`mt-1 block text-ink-faint`,children:new Date(x.generated_at*1e3).toLocaleString(r)}),(0,J.jsx)(W,{className:`mt-2 text-xs`,"data-reading-source-path":x.path,onClick:()=>_(e=>!e),children:g?a?`收起原说明`:`Hide original explanation`:a?`阅读当时说明`:`Read the original explanation`}),g?(0,J.jsx)(`div`,{className:`mt-3 text-[13px] leading-6`,children:(0,J.jsx)(bs,{sid:b.sid,path:x.path,artifacts:T,onOpenArtifact:E})}):null]}),w.size>1?(0,J.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`查看已保存的进展问答`:`Saved progress questions`,(0,J.jsx)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:x.source_id,disabled:o.creating,onChange:e=>{let t=w.get(e.target.value);t&&F(t)},children:[...w.values()].map(e=>(0,J.jsxs)(`option`,{value:e.source_id,children:[e.title,` · `,new Date(e.generated_at*1e3).toLocaleString(r)]},e.source_id))})]}):null,D.length?(0,J.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`已保存的问题`:`Saved questions`,(0,J.jsxs)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:m??``,onChange:e=>{h(e.target.value||null),y(null)},children:[(0,J.jsx)(`option`,{value:``,children:a?`选择一个问题`:`Choose a question`}),D.map(e=>(0,J.jsx)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,children:ds(e.reader_foundation)},e.path))]})]}):null,O?(0,J.jsxs)(`section`,{className:`space-y-3 text-[13px] leading-6`,"data-reading-question-id":O.reader_foundation.id,children:[k?(0,J.jsx)(ft,{label:a?`查看这次问题`:`View this question`,children:(0,J.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-ink-dim`,children:O.reader_foundation.question})},O.reader_foundation.id):(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words font-medium`,children:O.reader_foundation.question}),k?(0,J.jsx)(bs,{sid:b.sid,path:O.path,artifacts:T,onOpenArtifact:E}):(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:O.reader_foundation.state===`generating`?a?`回答仍在整理,尚未确认结束。`:`The answer is still being prepared; completion is unconfirmed.`:a?`这次回答未完成,原问题已保留。`:`This answer did not finish; its question is retained.`}),!t&&O.exists&&O.reader_foundation.state===`complete`?(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x},parentId:O.reader_foundation.id,parentTitle:ds(O.reader_foundation)}),children:a?`继续问这份回答`:`Ask a follow-up to this answer`}):null,!t&&O.reader_foundation.state===`failed`?(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:O.reader_foundation.question,progressSource:{...x},parentId:O.reader_foundation.parent_id??void 0}),children:a?`重新编辑问题`:`Edit this question`}):null]}):null,v?(0,J.jsxs)(`section`,{className:`space-y-2 rounded-lg border border-line/70 p-3 text-[13px] leading-6`,"data-referenced-reading-path":v,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{children:a?`引用的保存内容`:`Referenced saved reading`}),(0,J.jsx)(W,{className:`text-xs`,onClick:()=>y(null),children:a?`收起引用`:`Close referenced reading`})]}),(0,J.jsx)(bs,{sid:b.sid,path:v,artifacts:T,onOpenArtifact:E})]}):null,ne?(0,J.jsx)(ss,{generating:!0,phase:A?o.progress.phase:void 0}):null,A?(0,J.jsxs)(`div`,{className:`space-y-2 text-xs text-ink-faint`,"data-pending-reading-question":A.id,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:A.draft.question}),M?(0,J.jsx)(`p`,{role:`status`,children:a?`引用的说明目前不可用,这次追问未发起。问题与原来源已保留。`:`The reading source is unavailable, so this question was not started. Its question and original source are saved.`}):ee?(0,J.jsx)(`p`,{role:`status`,children:a?`这次请求的结果尚未确认;刷新不会重新生成。`:`The result of this request is unconfirmed. Refreshing does not generate it again.`}):null,!t&&!o.creating&&!o.waiting?(0,J.jsx)(W,{className:`text-xs`,onClick:()=>{M?(p({...A.draft}),o.generation.reset()):o.retrySavedRequest(A)},children:M?a?`编辑问题与来源`:`Edit question and source`:a?`重试同一请求`:`Retry this same request`}):null]}):C&&o.creationBlocked?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`另一个阅读请求尚未结束。`:`Another reading request is still unresolved.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>N(),children:a?`查看原问题`:`View the original question`})]}):null,o.list.isError?(0,J.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`保存的问答暂时读取失败。`:`Saved questions could not be loaded.`,(0,J.jsx)(W,{className:`ml-2 text-xs`,onClick:()=>void o.list.refetch(),children:a?`重新读取`:`Reload`})]}):null,f&&!t?(0,J.jsxs)(`section`,{className:`border-t border-line/60 pt-3`,children:[f.parentId?(0,J.jsxs)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:[a?`继续引用这份回答:`:`Following up on this answer: `,f.parentTitle||D.find(e=>e.reader_foundation?.id===f.parentId)?.reader_foundation?.question]}):null,(0,J.jsx)(ps,{draft:f,onChange:p,onSubmit:te,disabled:o.creationBlocked})]}):t?null:(0,J.jsx)(W,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x}}),children:a?`问这版说明`:`Ask about this explanation`})]})]}):null})]})}function Ss({cardKey:e,taskId:t,card:n,task:r,originalDetail:i,selection:a,artifacts:o,onOpenArtifact:s,readOnly:c}){let{locale:l}=z(),u=l===`zh-CN`;if(r?.turn_kind===`qa`)return(0,J.jsx)(`div`,{className:`macro-reader-markdown`,"data-reader-card":e,"data-reader-task-id":t,children:(0,J.jsx)(H,{artifacts:o,onOpenArtifact:s,children:i})});let d=a?.request.key===e&&a.request.task_id===t?a:void 0,f=(n?.version??0)>=14&&_o(n?.reader_brief)?n.reader_brief:void 0;return(0,J.jsxs)(`div`,{className:`font-sans`,"data-reader-card":e,"data-reader-task-id":t,children:[(0,J.jsx)(ss,{generatedAt:n?.generated_at,pending:d?.pending,generating:d?.generating,hasExplanation:!!n,phase:d?.phase,error:d?.error,unavailable:d?.unavailable,retry:d?.retry,retryDisabled:d?.retryDisabled}),d?.foundationRequired?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:u?`先在“问题基础”里选择一份说明,再阅读本次进展的解释。`:`Choose a saved foundation to explain this progress.`}):null,f?(0,J.jsx)(cs,{brief:f,identity:e,detail:n?.detail,learningPath:n?.learning_path,foundation:n?.foundation_ref,readingUnavailable:n?.teaching_review?.reading_review?.status===`unavailable`,teachingUnavailable:n?.teaching_review?.status===`unavailable`,artifacts:o,onOpenArtifact:s}):(0,J.jsx)(`div`,{className:`macro-reader-markdown`,children:(0,J.jsx)(H,{artifacts:o,onOpenArtifact:s,children:Jo(n?.detail||i)})}),(0,J.jsx)(ls,{task:r?.id===t?r:void 0,artifacts:o,onOpenArtifact:s}),(0,J.jsx)(`div`,{className:`my-3`,children:(0,J.jsx)(vs,{card:n,cardKey:e,taskId:t,readOnly:c,context:d?.questionContext})})]})}var Cs=e=>[`research-method`,e],ws={proven:`ok`,contradicted:`warning`,partial:`caution`,untested:`muted`,unchecked:`pending`};function Ts(e){return ws[e]??`unknown`}var Es={ok:`text-ok border-ok/40 bg-ok/5`,warning:`text-warn border-warn/50 bg-warn/10 font-medium`,caution:`text-warn/80 border-warn/30`,muted:`text-ink-faint border-line/40`,pending:`text-ink-faint border-line/40 italic`,unknown:`text-ink-dim border-line/50`};function Ds(e,t){switch(e){case`proven`:return t(`已证实`,`proven`);case`contradicted`:return t(`被推翻`,`contradicted`);case`partial`:return t(`部分证实`,`partial`);case`untested`:return t(`无测试`,`untested`);case`unchecked`:return t(`未运行`,`unchecked`);default:return e||`—`}}function Os({status:e,text:t}){let n=Ts(e);return(0,J.jsx)(`span`,{className:`inline-block whitespace-nowrap rounded border px-1.5 py-0.5 text-[11px] leading-4 ${Es[n]}`,"data-method-status":e,"data-method-status-tone":n,children:Ds(e,t)})}var ks=new Set([`FAILED`,`ERROR`]);function As(e,t){if(!e.length)return{label:`—`,title:t(`没有测试带这个组件的标记`,`No test carries this component marker`),failing:0};let n=new Map;for(let t of e)n.set(t.kind||`invariant`,(n.get(t.kind||`invariant`)??0)+1);let r=[...n.entries()].map(([e,t])=>`${e} ×${t}`).join(`, `),i=e.filter(e=>ks.has((e.outcome??``).toUpperCase())).map(e=>e.id),a=t(`${e.length} 个测试`,`${e.length} ${e.length===1?`test`:`tests`}`),o=i.length?`${t(`失败`,`Failing`)}: ${i.join(` +`)}`:e.map(e=>`${e.id} — ${e.outcome??t(`未运行`,`not run`)}`).join(` +`);return{label:`${a} · ${r}`,title:o,failing:i.length}}function js({tests:e,text:t}){let n=As(e,t);return(0,J.jsx)(`span`,{className:`whitespace-nowrap text-[11px] ${n.failing?`text-warn`:`text-ink-faint`}`,title:n.title,"data-method-tests":e.length,"data-method-failing":n.failing,children:n.label})}function Ms(e){if(e==null||e===``)return null;let t=typeof e==`number`?new Date(e<0xe8d4a51000?e*1e3:e):new Date(e);return Number.isNaN(t.getTime())?null:t}var Ns=e=>e?(0,J.jsx)(H,{children:e}):(0,J.jsx)(`span`,{className:`text-ink-faint`,children:`—`});function Ps({children:e}){return(0,J.jsx)(`h3`,{className:`text-xs font-semibold text-ink`,children:e})}var Fs=`text-[11px] uppercase tracking-wide text-ink-faint`,Is=`pb-1 pr-3 font-medium`;function Ls({rows:e,text:t}){return e.length?(0,J.jsx)(`div`,{className:`mt-2 overflow-x-auto`,"data-testid":`method-components`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Fs,children:[(0,J.jsx)(`th`,{className:Is,children:t(`组件`,`Component`)}),(0,J.jsx)(`th`,{className:Is,children:t(`方法规定`,`Prescribes`)}),(0,J.jsx)(`th`,{className:Is,children:t(`备注`,`Notes`)}),(0,J.jsx)(`th`,{className:Is,children:t(`状态`,`Status`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`测试`,`Tests`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-component":e.component,children:[(0,J.jsx)(`td`,{className:`py-1 pr-3 font-medium text-ink`,children:Ns(e.component)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:Ns(e.prescribes)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:Ns(e.notes??``)}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:(0,J.jsx)(Os,{status:e.status,text:t})}),(0,J.jsx)(`td`,{className:`py-1`,children:(0,J.jsx)(js,{tests:e.tests??[],text:t})})]},`${e.component}-${n}`))})]})}):null}function Rs({rows:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,"data-testid":`method-reused-code`,children:[(0,J.jsx)(Ps,{children:t(`复用代码(从 import 扫描得出)`,`Reused code (from the import scan)`)}),(0,J.jsxs)(`table`,{className:`mt-1 w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Fs,children:[(0,J.jsx)(`th`,{className:Is,children:t(`名称`,`Name`)}),(0,J.jsx)(`th`,{className:Is,children:t(`类型`,`Kind`)}),(0,J.jsx)(`th`,{className:Is,children:t(`版本 / 修订`,`Revision / version`)}),(0,J.jsx)(`th`,{className:Is,children:t(`用到的模块`,`Modules`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`引用处`,`Imported from`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-row":e.name,children:[(0,J.jsx)(`td`,{className:`py-1 pr-3 font-medium text-ink`,title:e.remote||void 0,children:e.name||`—`}),(0,J.jsx)(`td`,{className:`py-1 pr-3`,children:e.kind===`third_party`?t(`第三方克隆`,`third_party clone`):t(`已安装包`,`package`)}),(0,J.jsx)(`td`,{className:`py-1 pr-3 font-mono text-[11px]`,children:e.revision_or_version||`—`}),(0,J.jsx)(`td`,{className:`py-1 pr-3 break-all font-mono text-[11px]`,children:e.modules?.length?e.modules.join(`, `):`—`}),(0,J.jsx)(`td`,{className:`py-1`,title:e.imported_from?.join(` +`)||void 0,children:t(`${e.imported_from?.length??0} 个文件`,`${e.imported_from?.length??0} ${e.imported_from?.length===1?`file`:`files`}`)})]},`${e.name}-${n}`))})]})]}):null}function zs({rows:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,"data-testid":`method-hyperparameters`,children:[(0,J.jsx)(Ps,{children:t(`超参数(从配置文件得出)`,`Hyperparameters (from the config files)`)}),(0,J.jsxs)(`table`,{className:`mt-1 w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:Fs,children:[(0,J.jsx)(`th`,{className:Is,children:t(`键`,`Key`)}),(0,J.jsx)(`th`,{className:Is,children:t(`值`,`Value`)}),(0,J.jsx)(`th`,{className:`pb-1 font-medium`,children:t(`为什么`,`Why`)})]})}),(0,J.jsx)(`tbody`,{className:`align-top text-ink-dim`,children:e.map((e,n)=>(0,J.jsxs)(`tr`,{className:`border-t border-line/40`,"data-method-row":e.key,"data-method-changed":e.changed?`true`:void 0,children:[(0,J.jsxs)(`td`,{className:`py-1 pr-3 font-medium text-ink`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.key}),e.file?(0,J.jsx)(`span`,{className:`block text-[10px] font-normal text-ink-faint`,children:e.file}):null]}),(0,J.jsxs)(`td`,{className:`py-1 pr-3`,children:[(0,J.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.value}),e.changed?(0,J.jsxs)(`span`,{className:`ml-1.5 inline-flex items-center gap-1 whitespace-nowrap rounded border border-warn/40 px-1 text-[10px] leading-4 text-warn`,"data-testid":`method-hyperparameter-changed`,children:[t(`已改`,`changed`),e.previous!=null&&e.previous!==``?(0,J.jsx)(`span`,{className:`font-mono text-ink-faint line-through`,children:e.previous}):null]}):null]}),(0,J.jsx)(`td`,{className:`py-1`,children:e.why?Ns(e.why):(0,J.jsx)(`span`,{className:`text-ink-faint`,title:t(`值旁没有 # why: 注释`,`No # why: comment next to the value`),children:`—`})})]},`${e.file}:${e.key}-${n}`))})]})]}):null}function Bs({entries:e,text:t}){return e.length?(0,J.jsxs)(`div`,{className:`mt-3`,"data-testid":`method-change-log`,children:[(0,J.jsx)(Ps,{children:t(`变更记录(来自 git)`,`Change log (from git)`)}),(0,J.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs text-ink-dim`,children:e.map((e,t)=>(0,J.jsxs)(`li`,{className:`flex gap-2`,title:e.files?.join(` +`)||void 0,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-ink-faint`,children:e.when}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.summary})]},`${e.when}-${t}`))})]}):null}function Vs({checks:e,locale:t,text:n}){if(!e)return null;let r=Object.entries(e.counts??{}).filter(([,e])=>e>0).map(([e,t])=>`${e} ${t}`).join(`, `),i=e.exit_code==null?n(`未结束`,`no exit code`):n(`退出码 ${e.exit_code}`,`exit ${e.exit_code}`),a=Ms(e.ran_at);return(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,"data-testid":`method-checks`,title:a?a.toLocaleString(t):void 0,children:[n(`最近一次检查:第 ${e.round_index} 轮 · ${i}`,`Latest checks: round ${e.round_index} · ${i}`),r?` · ${r}`:``,a?` · ${wt(a,t)}`:``]})}function Hs({sid:e,active:t,compact:n=!1,onOpenArtifact:r}){let{locale:i}=z(),a=i===`zh-CN`,o=(e,t)=>a?e:t,[s,c]=(0,G.useState)(!n),l=t&&!!e,u=A({queryKey:Cs(e),queryFn:({signal:t})=>R.researchMethod(e,t),enabled:l,refetchInterval:l?3e4:!1,staleTime:2e4,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}).data;if(!u||!u.exists)return null;let d=Ms(u.updated_at),f=u.components??[],p=u.unlisted_components??[];return(0,J.jsxs)(`section`,{className:`mx-4 flex min-h-0 flex-col overflow-hidden rounded-lg border border-line/70 bg-panel ${n?`my-2 px-3 py-2`:`my-3 px-4 py-3`}`,"aria-label":o(`方法卡`,`Method card`),"data-testid":`method-card`,"data-project-id":e,"data-compact":n,children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 text-left`,"aria-expanded":s,onClick:()=>c(e=>!e),children:[(0,J.jsx)(Qt,{size:16,className:`shrink-0 text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-ink`,children:o(`方法卡`,`Method card`)}),u.title?(0,J.jsx)(`span`,{className:`truncate text-xs text-ink-dim`,children:u.title}):null,(0,J.jsx)(Ue,{size:12,className:`shrink-0 text-ink-faint ${s?`rotate-180`:``}`})]}),(0,J.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,title:d?d.toLocaleString(i):void 0,children:[r?(0,J.jsx)(`button`,{type:`button`,className:`underline-offset-2 hover:underline`,onClick:()=>r(u.path),children:u.path}):u.path,d?(0,J.jsxs)(J.Fragment,{children:[` · `,o(`更新于`,`updated`),` `,wt(d,i)]}):null]})]}),s?(0,J.jsxs)(`div`,{className:`mt-2 min-h-0 overflow-y-auto overscroll-contain scroll-thin ${n?`max-h-[30vh]`:`max-h-[40vh]`}`,"data-testid":`method-card-body`,tabIndex:0,"aria-label":o(`方法说明`,`Method text`),children:[u.statement?(0,J.jsx)(`p`,{className:`text-[13px] leading-6 text-ink-dim`,"data-testid":`method-statement`,children:u.statement}):null,(0,J.jsx)(Ls,{rows:f,text:o}),f.length===0?(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o(`文档里没有组件表;下面是全文。`,`The document has no component table; the full text follows.`)}):null,p.length?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,"data-testid":`method-unlisted-components`,children:[o(`测试里标记了但卡片未列出的组件:`,`Components marked in tests but not named in the card: `),p.join(`, `)]}):null,(0,J.jsx)(Rs,{rows:u.reused_code??[],text:o}),(0,J.jsx)(zs,{rows:u.hyperparameters??[],text:o}),(0,J.jsx)(Bs,{entries:u.change_log??[],text:o}),(0,J.jsx)(Vs,{checks:u.checks,locale:i,text:o}),(0,J.jsx)(`div`,{className:`mt-3 border-t border-line/40 pt-2 text-[13px] leading-6 text-ink-dim`,"data-testid":`method-card-markdown`,children:(0,J.jsx)(H,{sid:e,onOpenArtifact:r,children:u.markdown})}),u.truncated?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,"data-testid":`method-card-truncated`,children:o(`只显示了前 64 KiB。`,`Showing only the first 64 KiB.`)}):null]}):null]})}function Us({selection:e,onOpenArtifact:t,readOnly:n}){let{locale:r}=z(),i=r===`zh-CN`,a=Go({...e,active:!0,readOnly:n}),o=e.view.mission.id,s=a.task||{id:o,title:e.view.mission.title,objective:e.view.mission.objective,status:e.view.mission.status},c=(a.brief?a.card?.title:void 0)||s.title;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lt,{title:i?`读懂这一步`:`Understand this step`,sub:c}),(0,J.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`research-brief-reading`,"data-project-id":e.sid,"data-task-id":o,children:[(0,J.jsx)(Ss,{cardKey:o,taskId:o,task:a.task,card:a.card,readOnly:n,onOpenArtifact:t,originalDetail:s.objective||e.snapshot.session.objective||``,selection:{request:ho(s,a.evidence),questionContext:a.questionContext,pending:a.needsUpdate,generating:a.generating,phase:a.generationPhase,error:a.generationError,foundationRequired:a.foundationRequired,retry:n?void 0:a.retry,retryDisabled:a.generating,unavailable:!a.foundationRequired&&(a.legacy||a.generationUnavailable||!a.loading&&!a.generationAvailable)}}),a.readError?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:i?`记录暂时读取失败;已显示内容仍保留。`:`Records could not be refreshed; previously loaded content is retained.`}):null]})]})}function Ws(e){let{locale:t}=z(),n=t===`zh-CN`,r=(e,t)=>n?e:t,i=e.compact===!0,[a,o]=(0,G.useState)(null),s=a?.sid===e.sid?a:null,c=(0,G.useRef)(null);(0,G.useEffect)(()=>{c.current&&(c.current.scrollTop=0)},[e.sid,e.view.mission.id]),(0,G.useEffect)(()=>o(null),[e.sid]);let l=Go({...e,allowGeneration:!1,locale:n?`zh-CN`:`en-US`}),{task:u,evidence:d,brief:f,card:p}=l,m=(f?p?.title:void 0)||u?.title||e.view.mission.title||r(`当前任务`,`Current task`),h=u?.objective||e.view.mission.objective||e.snapshot.session.objective,g=Tt({ts:p?.generated_at})?.toLocaleString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,_=!l.foundationRequired&&(l.legacy||l.generationUnavailable||!l.loading&&!l.generationAvailable),v=!!l.readError||!!l.generationError||_,y=(0,J.jsx)(ss,{generatedAt:p?.generated_at,pending:l.needsUpdate,generating:l.generating,phase:l.generationPhase,hasExplanation:!!f}),b=e=>(e||``).trim(),x=(l.readError?r(`任务记录暂时无法更新。`,`Task records could not be refreshed.`):l.generationError?r(`说明生成失败。`,`The explanation could not be prepared.`):_?r(`说明暂不可用。`,`Explanations are temporarily unavailable.`):``)||(l.loading?r(`正在读取任务记录。`,`Loading task records.`):l.generating?r(`正在根据任务记录整理说明。`,`Preparing an explanation from the task records.`):l.foundationRequired?r(`先在“问题基础”选择说明。`,`Choose a saved foundation for this explanation.`):r(`尚未生成说明。`,`No explanation has been saved yet.`)),S=!!l.readError||!l.generationAvailable||l.legacy||!u,C=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-ink-faint`,role:v?`status`:void 0,children:[(0,J.jsx)(`span`,{children:x}),v&&S&&e.active&&(!e.readOnly||l.readError)?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:l.generating||l.loading,onClick:()=>void l.retry(),children:[(0,J.jsx)(Ke,{size:12}),r(`重试`,`Retry`)]}):null]}),w=(0,J.jsxs)(J.Fragment,{children:[f?(0,J.jsx)(cs,{brief:f,identity:u?.id||e.view.mission.id,detail:p?.detail,learningPath:p?.learning_path,foundation:p?.foundation_ref,onOpenArtifact:e.onOpenArtifact,readingUnavailable:l.readingUnavailable,teachingUnavailable:l.teachingUnavailable}):(0,J.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,children:[b(h)===b(m)?null:(0,J.jsx)(os,{value:h||r(`任务目标尚未记录。`,`The task objective has not been recorded yet.`),expandLabel:r(`完整任务目标`,`Full task objective`)}),C]}),l.generating&&f?(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[r(`正在依据新记录更新;上方暂时保留之前的说明。`,`Updating from new records; the previous explanation remains visible above.`),g?` ${g}`:``]}):null,(0,J.jsx)(ls,{task:u,onOpenArtifact:e.onOpenArtifact}),f&&v?C:null]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Hs,{sid:e.sid,active:e.active,compact:i,onOpenArtifact:e.onOpenArtifact}),(0,J.jsxs)(`section`,{className:`mx-4 flex min-h-0 flex-col overflow-hidden rounded-lg border border-line/70 bg-panel ${i?`my-2 px-3 py-2`:`my-3 max-h-[50vh] px-4 py-3`}`,"aria-label":r(`读懂这一步`,`Understand this step`),"data-testid":`research-brief`,"data-project-id":e.sid,"data-task-id":e.view.mission.id,"data-compact":i,children:[i?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(K,{size:16,className:`shrink-0 text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-ink`,children:r(`读懂这一步`,`Understand this step`)})]}),y]}),(0,J.jsxs)(`div`,{ref:c,className:`min-h-0 overflow-y-auto overscroll-contain scroll-thin`,"data-testid":`research-brief-body`,tabIndex:0,"aria-label":r(`任务说明`,`Task explanation`),children:[(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-faint`,children:(0,J.jsx)(H,{children:m||e.view.mission.title})}),w]})]}),(0,J.jsxs)(`footer`,{className:i?`shrink-0`:`mt-2 shrink-0 border-t border-line/50 pt-2`,"data-testid":`research-brief-footer`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>o({sid:e.sid,snapshot:e.snapshot,view:e.view,locale:n?`zh-CN`:`en-US`,preview:ae(),foundationId:l.foundationId}),children:[(0,J.jsx)(K,{size:12}),r(`阅读说明`,`Read explanation`)]}),(0,J.jsx)(vs,{card:p,cardKey:e.view.mission.id,taskId:e.view.mission.id,readOnly:e.readOnly,context:l.questionContext}),e.onAsk&&u&&!e.readOnly?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,onClick:()=>e.onAsk?.(bo(e.sid,u,d,n)),children:[(0,J.jsx)(sn,{size:12}),r(`引用任务`,`Reference task`)]}):null]}),i&&l.generating?(0,J.jsx)(`div`,{className:`mt-2`,children:y}):null]})]}),(0,J.jsx)(dt,{open:!!s,onClose:()=>o(null),label:r(`任务说明`,`Task explanation`),children:s?(0,J.jsx)(Us,{selection:s,onOpenArtifact:e.onOpenArtifact,readOnly:e.readOnly}):null})]})}var Gs=new Set([`done`,`success`,`completed`]),Ks=new Set([`research_incomplete`,`paused_no_breakthrough`,`exhausted_current_methods`]),qs=new Set([`no_progress`,`max_rounds`]),Js=new Set([`blocked`,`infra_blocked`]),Ys=new Set([`error`,`failed`,`supervisor_error`]),Xs={completed:{glyph:`🎉`,tone:`ok`,missionStatus:`complete`},incomplete:{glyph:`◌`,tone:`warn`,missionStatus:`incomplete`},stalled:{glyph:`⏸`,tone:`warn`,missionStatus:`stalled`},blocked:{glyph:`⛔`,tone:`err`,missionStatus:`blocked`},failed:{glyph:`💥`,tone:`err`,missionStatus:`failed`},ended:{glyph:`■`,tone:`info`,missionStatus:`ended`}},Zs={completed:`mission_completed`,incomplete:`mission_incomplete`,stalled:`mission_stalled`,blocked:`mission_blocked`,failed:`mission_failed`,ended:`mission_ended`},Qs={mission_completed:`The task was completed.`,mission_continued:`The task was completed and the project continues with the next one.`,mission_certified:`The final submission was checked and approved.`,mission_incomplete:`The task stopped with work still remaining.`,mission_stalled:`The task stopped because recent rounds made no useful progress.`,mission_blocked:`The task cannot continue until something outside it is resolved.`,mission_failed:`The task could not be completed.`,mission_paused:`The task was paused before it finished because {why}; its progress is saved and it can be resumed.`,mission_ended:`The task ended without a recorded outcome.`},$s={budget_exhausted:`the project reached its budget limit`,provider_cooldown:`the model service asked Argus to wait before calling again`,provider_fence:`the model provider is not accepting calls right now`,daemon_shutdown:`Argus was stopped`,operator_pause:`the operator paused the work`,operator_abort:`the operator cancelled the task`,backend_unavailable:`the model service was unavailable`,transient_error:`a temporary error interrupted the call`,permanent_error:`an error that will not clear on its own stopped the call`},ec={paused_budget:`budget_exhausted`,paused_provider_cooldown:`provider_cooldown`,paused_provider_fence:`provider_fence`,paused_daemon_shutdown:`daemon_shutdown`,paused_operator:`operator_pause`};function tc(e){return String(e??``).trim().toLowerCase()}function nc(e,t){if(e===`paused_external_work`)return`work outside Argus had to finish first`;let n=ec[e];return n?$s[n]:$s[t]?$s[t]:e.startsWith(`paused_`)?`the work was paused`:`the work was interrupted`}function rc(e){let t=tc(e);switch(t){case`completed`:case`incomplete`:case`stalled`:case`blocked`:case`failed`:case`ended`:return t;default:return null}}function ic(e){let t=tc(e.status);return e.success===!0||Gs.has(t)?`completed`:Ks.has(t)?`incomplete`:qs.has(t)?`stalled`:Js.has(t)?`blocked`:Ys.has(t)?`failed`:`ended`}function ac(e){let t=e.outcome;if(t&&typeof t==`object`&&!Array.isArray(t)){let n=t;return{execution_status:tc(n.execution_status)||ic(e),review_status:tc(n.review_status)||`not_assessed`,stage_certification:tc(n.stage_certification)||`not_assessed`,interruption_kind:tc(n.interruption_kind)||`none`,resumable:n.resumable===!0}}return{execution_status:ic(e),review_status:`not_assessed`,stage_certification:`not_assessed`,interruption_kind:tc(e.stop_kind)||`none`,resumable:e.resumable===!0}}function oc(e){if(e.success===!0&&e.campaign_continues===!0)return{outcomeClass:`completed`,kind:`mission_continued`,label:Qs.mission_continued,glyph:`↻`,tone:`info`,missionStatus:`continued`,technical:``};let t=rc(e.outcome_class)??ic(e),n=tc(e.status),r=Xs[t],i=Zs[t],a=Qs[i],o=``;if(t===`completed`&&e.final_submission_certified===!0)i=`mission_certified`,a=Qs.mission_certified;else if(t===`ended`&&(o=String(e.status??``).trim(),n.startsWith(`paused_`)||e.resumable===!0)){let t=e.outcome&&typeof e.outcome==`object`&&!Array.isArray(e.outcome)?e.outcome:{},r=tc(e.stop_kind)||tc(t.interruption_kind);i=`mission_paused`,a=Qs.mission_paused.replace(`{why}`,nc(n,r))}return{outcomeClass:t,kind:i,label:a,glyph:r.glyph,tone:r.tone,missionStatus:r.missionStatus,technical:o}}function sc(e,t){let n=typeof e==`string`?e.trim():``;return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function cc(e,t){let n=t===`zh-CN`,r=sc(e.route,40),i=sc(e.workflow_mode,40),a=sc(e.execution_task,160),o;o=r===`self`?n?`计划由 Manager 直接处理`:`Manager plans to handle this request`:i===`staged`?r===`team`?n?`计划由团队分阶段推进`:`The team plans to work in stages`:n?`计划分阶段推进`:`The plan is to work in stages`:i===`direct`?r===`team`?n?`计划由团队直接处理`:`The team plans to handle this task directly`:n?`计划直接处理这项工作`:`The plan is to handle this task directly`:n?`处理方案已确定`:`A plan is ready`,a&&(o+=`${n?`:`:`: `}${a}`);let s=``;e.lifetime===`standing`&&e.open_ended!==!1||!e.lifetime&&e.open_ended===!0?s=n?`持续跟进后续工作。`:`Keep following up on subsequent work.`:e.lifetime===`bounded_increment`?s=n?`本次只推进一个明确的增量。`:`Limit this run to one defined increment.`:e.lifetime===`bounded`&&(s=e.continuous===!0&&e.open_ended===!1?n?`完成这次目标后结束。`:`Finish once this objective is met.`:n?`范围限于本次目标。`:`Keep the work within this objective.`);let c=sc(e.reason,320),l=c&&!/^(?:\[manager\]|manager routed\b|\{)/i.test(c)&&c!==(sc(e.execution_task,320)||sc(e.objective,320))?c:``;return[o,[s,l].filter(Boolean).join(n?``:` `)].filter(Boolean).join(` +`)}function lc(e){let t=e;return t=t.replace(/^(\s*(?:authorization|proxy-authorization)\s*:).*$/gim,`$1 `),t=t.replace(/^(\s*(?:x-api-key|api-key|cookie|set-cookie)\s*:).*$/gim,`$1 `),t=t.replace(/gh[pousr]_[A-Za-z0-9]{20,}/g,``).replace(/xox[baprs]-[A-Za-z0-9-]{10,}/g,``).replace(/AKIA[0-9A-Z]{16}/g,``).replace(/\bbearer\s+[A-Za-z0-9._\-+/=]{16,}/gi,``).replace(/(?`).replace(/(?`).replace(/\b([a-z][a-z0-9+.\-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi,`$1@`),{text:e,sensitive:t!==e}}function uc(e){return lc(pe(e))}function Y(e,t){let n=String(e??``).replace(/```[a-z]*\n?/gi,``).replace(/\[([^\]]+)\]\([^)]+\)/g,`[$1]`).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}var dc=e=>e,X=(e,t)=>String(dc(e)[t]??``);function fc(e,t){return`${e} ${t}${e===1?``:`s`}`}function Z(e,t,n){return e.locale===`zh-CN`?n:t}function pc(e,t){let n=X(e,`error_code`),r=X(e,`failure_stage`),i=X(e,`stop_kind`),a=[`daemon_shutdown`,`operator_pause`,`operator_abort`].includes(i);if(n===`cancelled`&&r===`commit`&&X(e,`status`)===`issued`)return{text:Z(t,`Applying the adjustment was interrupted; the saved decision is waiting to be applied.`,`应用调整时被中断,已保存的决定等待继续处理。`),tone:`warn`};if(n===`timeout`&&r===`commit`)return{text:Z(t,`Manager reached a decision, but applying the adjustment timed out.`,`Manager 已作出判断,但应用调整超时。`),tone:`warn`};let o={trial_quota_exceeded:[`The remaining trial quota cannot cover this Manager check.`,`剩余试用额度不足以启动这次 Manager 检查。`],observation_incomplete:[`Manager could not fully read the required project evidence; this check has stopped.`,`Manager 未能完整读取所需的项目资料,这次检查已停止。`],timeout:[`The model did not respond before the Manager check timed out.`,`模型未在时限内返回,Manager 这次检查已结束。`],cancelled:[`This Manager check was cancelled.`,`已取消这次 Manager 检查。`],superseded:[`New input or evidence superseded this Manager check.`,`新的操作或证据已取代这次 Manager 检查。`]};if(Object.hasOwn(o,n)&&!(n===`cancelled`&&a))return{text:Z(t,...o[n]),tone:n===`cancelled`||n===`superseded`?`dim`:`warn`};let s={budget_exhausted:[`The project budget limit prevented this Manager check.`,`项目预算已达上限,Manager 暂未完成检查。`],provider_cooldown:[`The model service asked Manager to wait before calling again.`,`模型服务要求稍后再调用,Manager 暂未完成检查。`],provider_fence:[`The model service is not accepting calls; Manager could not finish this check.`,`模型服务当前不接受调用,Manager 未完成这次检查。`],backend_unavailable:[`The model service was unavailable for this Manager check.`,`模型服务不可用,Manager 未完成这次检查。`],transient_error:[`A temporary model service error interrupted this Manager check.`,`模型服务的临时错误中断了这次 Manager 检查。`],permanent_error:[`The model call failed; Manager could not finish this check.`,`模型调用失败,Manager 未完成这次检查。`],daemon_shutdown:[`Argus stopped, ending this Manager check.`,`Argus 已停止,这次 Manager 检查已结束。`],operator_pause:[`This Manager check was paused by your request.`,`已按你的要求暂停这次 Manager 检查。`],operator_abort:[`This Manager check was cancelled by your request.`,`已按你的要求取消这次 Manager 检查。`]};if(Object.hasOwn(s,i))return{text:Z(t,...s[i]),tone:a?`dim`:`warn`};let c=X(e,`status`);return c===`cancelled`||c===`superseded`?{text:Z(t,`This Manager check was cancelled.`,`这次 Manager 检查已取消。`),tone:`dim`}:{text:r===`commit`&&[`continue`,`wait`,`steer`].includes(X(e,`action`))?Z(t,`Manager reached a decision, but the team adjustment could not be applied.`,`Manager 已作出判断,但团队调整未能生效。`):r===`decision`?Z(t,`Manager returned a decision that could not be validated.`,`Manager 返回的判断或引用依据未通过核验。`):Z(t,`Manager could not finish this check.`,`Manager 未能完成这次检查。`),tone:`warn`}}function Q(e,t,n,r,i,a={}){let o=uc(r);return{visibility:a.visibility??(i===`err`||i===`warn`?`alert`:`normal`),role:e,labelKey:t,glyph:n,tone:i,segments:o.text?[{kind:`text`,text:o.text}]:[],expandable:a.expandable===!0,sensitive:o.sensitive||a.sensitive===!0,fallback:a.fallback===!0,rule:a.rule===!0,reasoning:a.reasoning===!0}}function mc(){return{visibility:`hidden`,role:`system`,labelKey:`event.hidden`,glyph:``,tone:`dim`,segments:[],expandable:!1,sensitive:!1,fallback:!1,rule:!1,reasoning:!1}}function hc(e,t){if(dc(e).operator_alert===!0){let n=Y(X(e,`text`)||X(e,`reason`)||e.type,170);return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,n,`err`,{rule:!0})}if(t.unknownEventPolicy===`hide`)return mc();let n=String(e.type||`?`),r=X(e,`text`).trim();return Q(`system`,`event.fallback`,`•`,`[${n}]${r?` ${r}`:``}`,`dim`,{fallback:!0})}function gc(e,t=`engineer`){return X(e,`agent_layer`)||(e.type.startsWith(`life.manager.`)?`manager`:e.type.startsWith(`life.planner.`)?`planner`:e.type.startsWith(`round.review.`)?`reviewer`:t)}function _c(e,t){let n=X(e,`phase`),r=X(e,`cause`)||X(e,`backend_error`),i=X(e,`error`);if(!n||!r)return`${Z(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} ${Y(i,t.density===`full`?160:140)}`;let a={backend:[`model service`,`模型服务`],parse:[`reading the answer`,`读取回答`],contract:[`answer shape:`,`回答格式:`],timeout:[`timed out`,`超时`]},o=a[n]?Z(t,a[n][0],a[n][1]):n,s=Number(dc(e).attempts||0),c=s>1?Z(t,` (attempt ${s})`,` (第${s}次尝试)`):``,l=`${Z(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} · ${o} ${r}${c}`;return i?`${l} · ${Z(t,`error text`,`原始错误`)}: ${i}`:l}function vc(e){let t=dc(e).round_index??dc(e).round;return typeof t==`string`||typeof t==`number`?t:`?`}function yc(e,t){let n=X(e,`kind`),r=gc(e),i=`role.${r}`;if(n===`reasoning`){if(!t.showReasoning)return mc();let n=Y(X(e,`text`),280);return n?Q(r,i,`∴`,n,`dim`,{expandable:t.density===`full`,reasoning:!0}):mc()}if(n===`assistant_message`||n===`agent_message`||n===`message`){if(re(dc(e)))return hc(e,t);let n=uc(X(e,`text`));return n.text?Q(r,i,`▌`,n.text,`bright`,{expandable:t.density===`full`,sensitive:n.sensitive}):mc()}if(n===`command_execution`){let n=X(e,`text`)||X(e,`command`)||X(e,`action_summary`),a=X(e,`status`)===`failed`?`err`:`dim`;return n?Q(r,i,`▸ $`,n,a,{expandable:t.density===`full`}):mc()}if(n===`tool_use`||n===`file_change`){let a=X(e,`text`)||X(e,`action_summary`);if(!a&&t.density===`full`)return mc();let o=n===`file_change`?Z(t,`(file change)`,`(文件变更)`):Z(t,`(tool)`,`(工具)`);return Q(r,i,n===`file_change`?`✎`:`⚙`,a||o,X(e,`status`)===`failed`?`err`:`dim`,{expandable:t.density===`full`})}if(t.density===`full`)return mc();let a=String(dc(e).text??dc(e).action_summary??``).split(` +`)[0]?.trim()??``;return a?Q(r,i,`▸`,Y(a,160),`dim`):mc()}function bc(e,t){let n=ie(dc(e).canonical_type??e.type);if(n&&n!==e.type)return bc({...e,type:n},t);switch(e.type){case`advisor.consultation.requested`:case`life.manager.supervision.issued`:return mc();case`advisor.consultation.completed`:{let t=X(e,`question`).trim(),n=X(e,`summary`).trim();return!t&&!n?mc():Q(`advisor`,`role.advisor`,`◇`,[t,n].filter(Boolean).join(` +`),`info`,{expandable:!0})}case`advisor.consultation.cancelled`:{let n=Y(X(e,`question`),160);return Q(`advisor`,`role.advisor`,`◇`,`${Z(t,`Consultation cancelled`,`已取消咨询`)}${n?` · ${n}`:``}`,`dim`)}case`advisor.consultation.failed`:case`advisor.consultation.timed_out`:case`advisor.consultation.model_mismatch`:{let n=e.type.endsWith(`model_mismatch`)?Z(t,`The provider returned a different model`,`接入返回的模型与所选模型不一致`):e.type.endsWith(`timed_out`)?Z(t,`The advisor did not respond in time`,`顾问未在时限内返回`):Z(t,`The consultation did not finish`,`顾问咨询未完成`),r=Y(X(e,`question`),160);return Q(`advisor`,`role.advisor`,`◇`,`${n}${r?` · ${r}`:``}`,`warn`,{expandable:!0})}case`life.manager.supervision.applied`:return Q(`manager`,`role.manager`,`🧭`,X(e,`summary`)||X(e,`reason`),`info`,{expandable:!0,rule:!0});case`life.peer.message.processed`:return Q(`manager`,`role.peer`,`↔`,X(e,`text`),`info`,{expandable:!0});case`life.manager.supervision.failed`:{let n=pc(e,t);return Q(`manager`,`role.manager`,`🧭`,n.text,n.tone,{expandable:!0})}case`engineer.progress`:return yc(e,t);case`life.manager.intent.started`:return Q(`manager`,`role.manager`,`🧭`,Z(t,`Working out how to handle your request…`,`正在安排处理方式…`),`info`);case`life.manager.intent.completed`:return Q(`manager`,`role.manager`,`🧭`,cc(dc(e),t.locale),`info`,{expandable:!0});case`life.manager.intent.failed`:return Q(`manager`,`role.manager`,`⚠`,_c(e,t),`err`,{expandable:t.density===`full`});case`life.manager.stage_decision`:{let n=X(e,`target_stage`)||X(e,`stage`)||X(e,`current_stage`);return Q(`manager`,`role.manager`,`🧭`,`${X(e,`action`)}${n?` → ${n}`:``} ${Y(X(e,`reason`),t.density===`full`?140:120)}`,`info`)}case`life.research.second_reading`:{let n=gc(e,`manager`),r=Y(X(e,`supported`),160),i=Z(t,`reread the evidence and reworked the plan`,`重读了证据并重排了计划`);return Q(n,`role.${n}`,`📖`,r?`${i} · ${r}`:i,`info`)}case`life.letter.written`:{let n=gc(e,`manager`);return Q(n,`role.${n}`,`✉`,Z(t,`wrote you a letter`,`给你写了一封信`),`accent`)}case`life.planner.start`:return Q(`planner`,`role.planner`,`📋`,`${Z(t,`planning`,`正在规划`)} ${Y(X(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.verdict`:return X(e,`status`)===`done`||dc(e).project_done===!0?Q(`planner`,`role.planner`,`🏁`,Z(t,`the project is finished`,`项目已完成`),`ok`):Q(`planner`,`role.planner`,`📋`,Z(t,`lined up ${X(e,`queued`)||X(e,`n`)||`next`} task(s) to do next`,`已排好 ${X(e,`queued`)||X(e,`n`)||`下一`} 个接下来要做的任务`),`accent`);case`life.planner.task_added`:return Q(`planner`,`role.planner`,`+`,`${Z(t,`added a task`,`新增任务`)} · ${Y(X(e,`title`)||X(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.task_skipped`:return Q(`planner`,`role.planner`,`⏭`,`${X(e,`skip_category`)===`paper_review_purchase_deferred`?Z(t,`put off another paper review`,`推迟了再买一次评审`):Z(t,`skipped a task already planned`,`跳过了已在计划中的任务`)} ${Y(X(e,`title`),t.density===`full`?140:120)}`,`dim`);case`life.planner.preview_skipped`:return Q(`planner`,`role.planner`,`⏭`,Z(t,`skipped the plan preview: the research Planner owns the campaign plan`,`跳过了计划预览:研究规划师负责整个计划`),`dim`);case`life.planner.normalized`:return Q(`planner`,`role.planner`,`≋`,`${Z(t,`tidied the plan`,`整理了计划`)} · ${Y(X(e,`diagnostic`),180)}`,`dim`);case`life.planner.waiting`:return Q(`planner`,`role.planner`,`⌛`,`${Z(t,`waiting`,`等待中`)} · ${Y(X(e,`reason`),180)}`,`info`);case`life.planner.waiting_woken`:return Q(`planner`,`role.planner`,`↻`,`${Z(t,`resumed`,`已唤醒`)} · ${Y(X(e,`wake_reason`),180)}`,`info`);case`life.planner.terminal_idle`:return Q(`planner`,`role.planner`,`Ⅱ`,`${Z(t,`nothing left to plan`,`暂时没有要规划的`)} · ${Y(X(e,`reason`),180)}`,`dim`);case`life.planner.verification_probe`:return t.showReasoning?Q(`planner`,`role.planner`,`⌕`,`${Z(t,`checking that the plan still holds`,`检查计划是否仍然成立`)} · ${Y(X(e,`reason`),180)}`,`dim`):mc();case`life.planner.error`:return Q(`planner`,`role.planner`,`⚠`,`${Z(t,`the Planner hit an error`,`规划者出错`)} ${Y(X(e,`error`)||X(e,`text`),t.density===`full`?160:140)}`,`err`);case`life.mission.started`:return Q(`engineer`,`role.engineer`,`🚀`,Y(X(e,`title`)||X(e,`objective`)||X(e,`text`)||Z(t,`started work on this task`,`开始做这项任务`),t.density===`full`?180:160),`info`,{rule:!0});case`round.start`:return Q(`engineer`,`role.engineer`,`──`,Z(t,`round ${vc(e)}`,`第 ${vc(e)} 轮`),`dim`,{rule:!0});case`life.phase.started`:{let n=X(e,`label`)||X(e,`phase`),r=gc(e);return n?Q(r,`role.${r}`,`🔄`,Z(t,`entering ${n}`,`进入 ${n}`),`info`):mc()}case`round.review.started`:return Q(`reviewer`,`role.reviewer`,`🔄`,Z(t,`the Reviewer checks round ${vc(e)}`,`审阅者检查第 ${vc(e)} 轮`),`info`);case`round.review.deferred`:return Q(`engineer`,`role.engineer`,`↪`,Z(t,`carries on into the next round without a review · ${Y(X(e,`next_step`),t.density===`full`?180:160)}`,`不经审阅直接进入下一轮 · ${Y(X(e,`next_step`),t.density===`full`?180:160)}`),`info`);case`round.main.completed`:return Q(`engineer`,`role.engineer`,`✅`,Z(t,`finished round ${vc(e)} of work`,`第 ${vc(e)} 轮工作已完成`),`info`);case`round.review.completed`:{if(e.review_skipped===!0)return Q(`reviewer`,`role.reviewer`,`↪`,`${Z(t,`no review this round`,`这一轮没有审阅`)} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,`info`);let n=X(e,`status`),r=n===`done`?Y(X(e,`residual_risk`),200):``;if(r)return Q(`reviewer`,`role.reviewer`,`⚠`,`${Z(t,`verified with residual risk`,`已验证,但有残余风险`)}: ${r} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,`warn`);let i=n===`done`?`ok`:n===`blocked`||n===`no_progress`?`err`:`warn`;return Q(`reviewer`,`role.reviewer`,n===`done`?`✅`:n===`blocked`||n===`no_progress`?`⛔`:`↻`,`${Tc(n,t)} · ${Y(X(e,`reason`),t.density===`full`?200:160)}`,i)}case`life.mission.completed`:{let n=oc(dc(e)),r=Y(X(e,`summary`),240),i=Y(X(e,`residual_risk`),200);return i&&n.tone===`ok`?Q(`engineer`,`role.engineer`,`⚠`,`${Z(t,`completed with residual risk`,`已完成,但有残余风险`)} · ${r.includes(i)?r:`${i}${r?` · ${r}`:``}`}`,`warn`,{rule:!0}):Q(`engineer`,`role.engineer`,n.glyph,r?`${n.label} · ${r}`:n.label,n.tone,{rule:!0})}case`life.mission.failed`:return Q(`engineer`,`role.engineer`,`❌`,`${Z(t,`this task failed`,`这项任务失败了`)} ${Y(X(e,`reason`)||X(e,`error`),t.density===`full`?160:140)}`,`err`,{rule:!0});case`loop.start`:return Q(`engineer`,`role.engineer`,`▶`,Y(X(e,`text`)||X(e,`objective`),t.density===`full`?16e3:160),`info`,{expandable:t.density===`full`});case`loop.done`:return Q(`engineer`,`role.engineer`,`🏁`,`${Z(t,`the run finished`,`这次运行结束`)} ${Y(X(e,`text`),t.density===`full`?140:120)}`,`dim`);case`life.inbox.queued`:return Q(`system`,`role.operator`,`📥`,`${Z(t,`you added guidance`,`你追加了指导`)} · ${Y(X(e,`text`),t.density===`full`?180:160)}`,`accent`);case`daemon.parked`:{let n=X(e,`replaced_by`),r=Z(t,`Argus set this project aside with its state saved`,`Argus 已把这个项目搁置,状态已保存`);return Q(`system`,`role.system`,`Ⅱ`,n?`${r} · ${Z(t,`continued as ${n}`,`由 ${n} 接续`)}`:r,`warn`,{rule:!0})}case`accounting.journal_repaired`:{let n=dc(e).damaged_lines,r=dc(e).liabilities,i=Array.isArray(n)?n.length:0,a=Array.isArray(r)?r.length:0,o=Y(X(e,`damaged_copy`),120),s=`the usage journal was repaired: ${i} damaged line(s) set aside${o?` in ${o}`:``}, ${a} call(s) written back as a liability`,c=`用量账本已修复:${i} 行损坏记录已另存${o?`到 ${o}`:``},${a} 次调用按负债记回`;return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Z(t,s,c),`warn`,{rule:!0})}case`provider.request.denied`:{let n=X(e,`provider`);return Q(`system`,`event.quota`,`⏸`,`${Z(t,`a request to ${n||`the model service`} was held back`,`发往${n||`模型服务`}的一次请求被暂缓`)} · ${Y(X(e,`reason`),160)}`,`warn`,{rule:!0})}case`round.reviewer_backend_failure`:{let n=Y(X(e,`text`),150),r=t.density===`full`?Z(t,`the Reviewer's model service is unreachable — waiting rather than going on unchecked`,`审阅者的模型服务连不上 — 先等待,不在无人审阅的情况下继续`):Z(t,`the Reviewer's model service is unreachable — waiting`,`审阅者的模型服务连不上 — 先等待`);return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${r} · ${n}`,`err`,{rule:!0})}case`round.stall`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||Z(t,t.density===`full`?`no progress this round — keeping a close eye on it`:`no progress this round`,`这一轮没有进展`),170),`warn`);case`round.escalated`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||Z(t,`many rounds without a finish — raising what is blocking the work`,`轮次已经很多还没做完 — 把外部阻碍提出来`),170),`warn`);case`life.planner.stall_escalation`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${Z(t,`the Planner is stuck`,`规划者卡住了`)} — ${Y(X(e,`reason`)||X(e,`text`),150)}`,`warn`);case`life.budget.pause`:return X(e,`stop_kind`)===`cost_unreconciled`||X(e,`reason`).startsWith(`unresolved provider cost`)?Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Q(`system`,`event.watch`,`⏸`,Z(t,`budget cap reached — paused · ${Y(X(e,`text`)||X(e,`reason`),140)}`,`已达到预算上限 — 已暂停 · ${Y(X(e,`text`)||X(e,`reason`),140)}`),`warn`);case`budget.reservation.denied`:return X(e,`reason`).startsWith(`unresolved provider cost`)?Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Q(`system`,`event.budget`,`$`,`${Z(t,`budget denied`,`预算申请被拒绝`)} — ${Y(X(e,`reason`)||X(e,`text`),t.density===`full`?160:150)}`,`err`,{rule:!0});case`budget.unpriced.blocked`:return Q(`system`,`event.budget`,`$`,Z(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`);case`budget.unpriced.acknowledged`:return Q(`system`,`event.budget`,`$`,Z(t,`Single-call cost risk approved; original usage remains pending`,`已批准单笔费用风险;原始费用仍待对账`),`warn`);case`life.lifecycle.block`:return Q(`system`,`event.watch`,`⛔`,`${Z(t,`blocked — needs you`,`卡住了 — 需要你来处理`)} · ${Y(X(e,`text`)||X(e,`reason`),150)}`,`err`,{rule:!0});case`life.daemon.idle_timeout`:return Q(`system`,`event.watch`,`🟦`,Y(X(e,`text`)||Z(t,`nothing to do for a while — standing by`,`一段时间没有事做 — 待命中`),150),`dim`);case`operator_alert`:return Q(`system`,`event.notice`,t.density===`full`?`👁`:`!`,Y(X(e,`text`)||X(e,`reason`)||e.type,170),`err`,{rule:!0});case`life.supervisor.error`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`Argus hit an internal error while coordinating the work`,`Argus 在统筹工作时遇到内部错误`)} · ${Y(X(e,`error`),160)}`,`err`,{rule:!0});case`life.auth_failure`:return Q(`system`,`role.system`,`🔑`,Z(t,`the model service rejected the sign-in — refresh the credentials and Argus will carry on`,`模型服务拒绝了登录 — 更新凭据后 Argus 会继续`),`err`,{rule:!0});case`life.planner.deferred`:return Q(`planner`,`role.planner`,`⌛`,`${Z(t,`planning is on hold`,`规划暂缓`)} · ${Y(X(e,`reason`),180)}`,`dim`);case`life.post_mission.stop`:return Q(`system`,`role.system`,`■`,`${Z(t,`stopped after this task`,`这项任务之后停下`)} · ${Y(X(e,`reason`),180)}`,`info`);case`life.planner.final_submission_skipped`:return Q(`planner`,`role.planner`,`⏭`,`${Z(t,`dropped an outdated final-submission task`,`跳过了一项过时的最终提交任务`)} · ${Y(X(e,`title`),140)}`,`dim`);case`life.execution_host.blocked`:return Q(`system`,`event.watch`,`⛔`,Y(X(e,`reason`)||Z(t,`the program that runs code for Argus could not be started`,`为 Argus 运行代码的程序无法启动`),t.density===`full`?260:180),`err`,{rule:!0});case`life.mission.provider_configuration_disabled`:{let n=Number(dc(e).streak||0),r=Z(t,`the model configuration failed ${fc(n,`time`)} in a row — this task is paused until you decide`,`模型配置连续 ${n} 次失败 — 这项任务已暂停,等待你的决定`),i=Y(X(e,`text`),160);return Q(`system`,`event.watch`,`⛔`,i?`${r} · ${i}`:r,`err`,{rule:!0})}case`life.iteration.continued`:return Q(`critic`,`role.critic`,`🔁`,Z(t,`lined up the next iteration`,`排好了下一轮迭代`),`dim`);case`life.learned_vertical.promoted`:return Q(`manager`,`role.manager`,`★`,Z(t,`made the learned domain "${X(e,`vertical`)}" official`,`把新学到的领域「${X(e,`vertical`)}」正式收录`),`accent`);case`life.learned_vertical.promotion_failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not record "${X(e,`vertical`)}" as a formal domain`,`未能把「${X(e,`vertical`)}」收录为正式领域`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.review.waived`:return Q(`planner`,`role.planner`,`↪`,`${Z(t,`this task will skip the independent review`,`这项任务将不做独立审阅`)} · ${Y(X(e,`reason`),160)}`,`dim`);case`life.manager.feedback.exhausted`:{let n=Number(dc(e).attempts||0);return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`the Manager's objection went unanswered ${fc(n,`time`)} — planning pauses for a while`,`管理者的异议 ${n} 次未被回应 — 规划暂停一段时间`)} · ${Y(X(e,`reason`),140)}`,`warn`)}case`life.manager.feedback.persisted`:{let n=X(e,`stage`);return Q(`manager`,`role.manager`,`↩`,`${n?Z(t,`sent the plan back for another pass at ${n}`,`把计划退回 ${n} 阶段再改一轮`):Z(t,`sent the plan back for another pass`,`把计划退回再改一轮`)} · ${Y(X(e,`reason`),160)}`,`info`)}case`life.manager.goal_contract.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not save the agreed goal`,`未能保存商定的目标`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.manager.intent.superseded`:return Q(`manager`,`role.manager`,`↷`,Z(t,`a newer instruction replaced this request`,`更新的指令取代了这个请求`),`info`);case`life.manager.project_report.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`could not deliver the project report`,`未能送出项目报告`)} · ${Y(X(e,`error`),140)}`,`warn`);case`life.planner.completion_circuit_opened`:{let n=Number(dc(e).consecutive_rejections||0);return Q(`planner`,`role.planner`,`⏸`,Z(t,`the same completion requirement turned the plan back ${fc(n,`time`)} — pausing completion attempts until something changes`,`同一项完成要求已 ${n} 次打回计划 — 暂停完成尝试,直到情况变化`),`warn`)}case`life.planner.completion_rejected`:return Q(`manager`,`role.manager`,`↩`,`${Z(t,`the Manager did not accept the completion claim`,`管理者未接受完成的说法`)} · ${Y(X(e,`reason`),160)}`,`info`);case`life.planner.continuation_required`:return Q(`planner`,`role.planner`,`↻`,Z(t,`finished one increment; the standing objective continues`,`完成了一个增量;长期目标继续推进`),`dim`);case`life.planner.superseded`:return Q(`planner`,`role.planner`,`↷`,Z(t,`dropped an outdated planning pass after a newer instruction`,`收到更新的指令,放弃了过时的规划`),`dim`);case`life.planner.wait_overridden`:return Q(`planner`,`role.planner`,`+`,`${Z(t,`scheduled independent work instead of waiting`,`不再干等,安排了独立的工作`)} · ${Y(X(e,`task_title`),140)}`,`info`);case`life.daemon.degraded`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`Argus started, but the objective did not reach the Manager`,`Argus 已启动,但目标没有交到管理者手上`)} · ${Y(X(e,`error`),140)}`,`warn`);case`round.orphan_process_group`:return Q(`engineer`,`role.engineer`,`⚠`,dc(e).cleanup_succeeded===!0?Z(t,`background processes outlived the turn and were cleaned up`,`有后台进程在这一轮结束后仍在运行,已清理`):Z(t,`background processes outlived the turn and could not be cleaned up`,`有后台进程在这一轮结束后仍在运行,未能清理`),`warn`);case`round.model_configuration_error`:return Q(`engineer`,`role.engineer`,`⛔`,`${Z(t,`the model configuration is not usable`,`模型配置无法使用`)} · ${Y(X(e,`text`)||X(e,`error`),160)}`,`err`,{rule:!0});case`round.watchdog.retry`:{let n=Number(dc(e).attempt||0),r=Number(dc(e).max_attempts||0);return Q(`engineer`,`role.engineer`,`↻`,Z(t,`the model call failed — retrying in a fresh session (attempt ${n} of ${r})`,`模型调用失败 — 在新会话中重试(第 ${n} 次,共 ${r} 次)`),`warn`)}case`round.watchdog.retry_exhausted`:{let n=Number(dc(e).attempt||0),r=Y(X(e,`fatal_error`),140),i=Z(t,`the model call kept failing — giving up after ${fc(n,`attempt`)}`,`模型调用持续失败 — ${n} 次后放弃`);return Q(`engineer`,`role.engineer`,`⛔`,r?`${i} · ${r}`:i,`err`,{rule:!0})}case`round.backend_failure.backoff`:{let n=Math.round(Number(dc(e).seconds||0));return Q(`engineer`,`role.engineer`,`⏳`,Y(X(e,`text`)||Z(t,`the model service failed — waiting ${n}s before trying again`,`模型服务出错 — 等待 ${n} 秒后再试`),200),`warn`)}case`round.backend_failure.hold_interrupted`:return Q(`engineer`,`role.engineer`,`↪`,Y(X(e,`text`)||Z(t,`the wait after a model-service failure ended early`,`模型服务出错后的等待提前结束`),180),`info`);case`round.provider_turn_cap.restart`:return Q(`engineer`,`role.engineer`,`↻`,Z(t,`reached the per-call turn allowance — continuing the same task in a fresh session`,`达到单次调用的轮次上限 — 在新会话中继续同一任务`),`info`);case`round.provider_turn_cap.reviewer_restart`:return Q(`reviewer`,`role.reviewer`,`↻`,Z(t,`the review reached its turn allowance — restarting it in a fresh session`,`审阅达到轮次上限 — 在新会话中重新开始`),`info`);case`round.reviewer_backend_failure.backoff`:{let n=Math.round(Number(dc(e).seconds||0));return Q(`reviewer`,`role.reviewer`,`⏳`,Y(X(e,`text`),200)||Z(t,`the Reviewer's model service is unavailable — retrying in ${n}s`,`审阅者的模型服务不可用 — ${n} 秒后重试`),`warn`)}case`round.external_work_wait.started`:return Q(`engineer`,`role.engineer`,`⌛`,`${Z(t,`waiting for background work to report`,`等待后台工作汇报`)} · ${Y(X(e,`work_id`),80)}`,`dim`);case`round.external_work_wait.completed`:return Q(`engineer`,`role.engineer`,`↻`,Z(t,`background work reported — resuming`,`后台工作已汇报 — 继续`),`dim`);case`round.external_work_review.required`:return Q(`reviewer`,`role.reviewer`,`⌛`,`${Z(t,`background work finished — an independent review of its result is required before resuming`,`后台工作已结束 — 恢复前需要对其结果做一次独立审阅`)} · ${Y(X(e,`work_id`),80)}`,`dim`);case`round.external_work_review.completed`:return Q(`reviewer`,`role.reviewer`,`✓`,`${Z(t,`background work result reviewed`,`后台工作结果已审阅`)} · ${Y(X(e,`review_status`),40)}`,`dim`);case`plan.draft.failed`:return Q(`planner`,`role.planner`,`⚠`,`${Z(t,`could not draft the plan`,`未能起草计划`)} · ${Y(X(e,`reason`),140)}`,`err`);case`plan.draft.done`:{let n=Number(dc(e).steps||0);return Q(`planner`,`role.planner`,`📋`,Z(t,`drafted a plan with ${fc(n,`step`)}`,`起草了一份 ${n} 步的计划`),`dim`)}case`team.learning.review.started`:return Q(`manager`,`role.manager`,`📚`,Z(t,`reviewing what this task taught the team`,`整理这项任务给团队带来的经验`),`dim`);case`team.learning.review.failed`:return Q(`manager`,`role.manager`,`⚠`,`${Z(t,`the team learning review failed`,`团队经验整理失败`)} · ${Y(X(e,`error`),140)}`,`warn`);case`team.learning.review.completed`:{let n=Number(dc(e).created||0),r=Number(dc(e).updated||0);return Q(`manager`,`role.manager`,`📚`,Z(t,`kept ${n} new and ${r} updated team procedures`,`保留了 ${n} 条新的、${r} 条更新的团队做法`),`dim`)}case`team.learning.promotion.quarantined`:return Q(`manager`,`role.manager`,`⚠`,Z(t,`set aside a new procedure that would have judged its own work`,`搁置了一条会评判自己工作的新做法`),`warn`);case`self.learning.review.failed`:return Q(`system`,`role.system`,`⚠`,`${Z(t,`the review of Argus's own conversation habits failed`,`对 Argus 自身对话习惯的复盘失败`)} · ${Y(X(e,`error`),140)}`,`warn`);case`domain.promotion`:return Q(`manager`,`role.manager`,`★`,Y(X(e,`text`),180),`dim`);case`idea.portfolio.formed`:{let n=dc(e).selection,r=n&&typeof n==`object`?String(n.route_id??``):``,i=Number(dc(e).route_count||0),a=Y(X(e,`text`),180),o=i>0?Z(t,`formed an idea portfolio of ${fc(i,`route`)}`,`组成了 ${i} 条思路的组合`):Z(t,`formed an idea portfolio`,`组成了思路组合`);return Q(`engineer`,`role.engineer`,`💡`,r?Z(t,`chose route ${r} from the idea portfolio`,`从思路组合中选定了路线 ${r}`):a||o,`accent`)}case`user.note`:{let n=Array.isArray(dc(e).tags)?dc(e).tags.map(String):[];if(n.includes(`config`))return mc();if(n.includes(`planner`))return Q(`planner`,`role.planner`,`📝`,Z(t,`updated the research plan`,`更新了研究计划`),`dim`);let r=Y(X(e,`summary`)||X(e,`text`)||X(e,`title`),180);return Q(`system`,`role.operator`,`📝`,`${Z(t,`you added a note`,`你添加了一条笔记`)}${r?` · ${r}`:``}`,`accent`)}case`ui.operator`:{let t=X(e,`text`);return t.trim()?Q(`system`,`role.operator`,`›`,t,`accent`,{rule:!0}):mc()}case`ui.argus`:{let n=X(e,`text`),r=dc(e).live===!0||Array.isArray(dc(e).steps)&&dc(e).steps.length>0;return n.trim()||r?Q(`manager`,`role.argus`,`▌`,n,`bright`,{expandable:t.density===`full`,rule:!0}):mc()}case`agent.io.start`:case`agent.io.stream`:case`agent.io.complete`:case`agent.io.error`:case`usage.recorded`:case`provider.request.started`:case`provider.request.completed`:case`codex.util.completed`:case`skill.cost.completed`:case`budget.reservation.created`:case`budget.reservation.settled`:case`budget.reservation.released`:case`round.checkpoint.recorded`:case`round.checkpoint.failed`:case`round.secret_redacted`:case`role.session.turn`:case`engineer.skill_maintenance.completed`:case`life.status`:case`life.mission.skipped`:case`life.mission.orphaned`:case`life.mission.requeued`:case`life.manager.plan_challenge.decided`:case`life.vertical.resolved`:case`life.manager.backend_resolved`:case`life.planner.backend_resolved`:case`life.planner.dependency_dropped`:case`life.planner.parallel_dropped`:case`life.engineer.backend_resolved`:case`life.reviewer.backend_resolved`:case`life.curator.backend_resolved`:case`life.runtime_failure.circuit_opened`:case`life.runtime_failure.circuit_blocked`:case`life.runtime_failure.canary_passed`:case`life.runtime.incident.detected`:case`life.runtime.incident.recovered`:case`life.runtime.incident.escalated`:case`life.plan.revision.proposed`:case`life.plan.revision.rejected`:case`life.plan.revision.committed`:case`life.plan.node.superseded`:case`life.lifecycle.transition`:case`life.inbox.drained`:case`life.operator_question.pending`:case`life.operator_question.answered`:case`project.completed`:case`project.completion_refused`:case`daemon.command.submitted`:case`daemon.command.completed`:case`daemon.command.rejected`:case`idea.search.started`:case`idea.search.completed`:case`idea.search.skipped`:case`venue.research.started`:case`venue.research.completed`:case`research.achievement.certified`:case`skill.library.available`:case`skill.created`:case`skill.updated`:case`skill.archived`:case`skill.tidied`:case`skill.history.compressed`:case`skill.evolution.completed`:case`wiki.initialized`:case`wiki.hook.warning`:case`wiki.created`:case`wiki.updated`:case`wiki.retired`:case`wiki.promotion.promoted`:case`wiki.promotion.demoted`:case`wiki.retired.compressed`:case`wiki.evolution.completed`:case`knowledge.learned`:case`knowledge.recalled`:case`life.planner.verdict.discarded`:case`life.manager.feedback.unresolved`:case`life.manager.project_report`:case`life.plan.revision.rolled_back`:case`life.planner.completion_circuit.notify_failed`:case`life.planner.completion_circuit_holding`:case`life.planner.external_poll_suppressed`:case`life.planner.waiting_contract.normalized`:case`life.daemon.ready`:case`plan.draft.start`:case`team.learning.review.skipped`:case`self.learning.review.started`:case`self.learning.review.completed`:case`manager.live_view.updated`:case`manager.live_view.rejected`:case`idea.portfolio.nested_skipped`:case`manager.turn.started`:case`manager.turn.cancelled`:case`life.config.parse_failed`:return hc(e,t);default:return hc(e,t)}}function xc(e){return e.segments.map(e=>e.text).join(``)}var Sc={"role.manager":[`Manager`,`Manager`],"role.planner":[`Planner`,`Planner`],"role.engineer":[`Engineer`,`Engineer`],"role.reviewer":[`Reviewer`,`Reviewer`],"role.advisor":[`Advisor`,`顾问`],"role.peer":[`Project exchange`,`项目交流`],"role.critic":[`Critic`,`Critic`],"role.system":[`Argus`,`Argus`],"role.argus":[`Argus`,`Argus`],"role.operator":[`You`,`你`],"event.notice":[`Notice`,`通知`],"event.watch":[`Watch`,`监控`],"event.budget":[`Budget`,`预算`],"event.quota":[`Quota`,`额度`],"event.fallback":[`Argus`,`Argus`],"event.hidden":[``,``]};function Cc(e,t){let n=Sc[e];if(n)return t===`zh-CN`?n[1]:n[0];let r=e.startsWith(`role.`)?e.slice(5):e;return r?`${r.slice(0,1).toUpperCase()}${r.slice(1)}`:``}function wc(e,t){let n=bc(e,t);if(n.visibility===`hidden`)return null;let r=xc(n);return!r&&!(e.type===`ui.argus`&&(e.live===!0||Array.isArray(e.steps)&&e.steps.length>0))?null:{role:n.role,labelKey:n.labelKey,label:Cc(n.labelKey,t.locale),glyph:n.glyph,text:r,tone:n.tone,rule:n.rule,reasoning:n.reasoning,expand:n.expandable,sensitive:n.sensitive}}function Tc(e,t){let n={done:[`the Reviewer was satisfied`,`审阅者认可了这一轮`],blocked:[`the Reviewer found the work stuck`,`审阅者认为工作卡住了`],no_progress:[`the Reviewer saw no progress`,`审阅者没有看到进展`]};if(!e)return Z(t,`the Reviewer gave no verdict`,`审阅者没有给出结论`);let r=n[e]??[`the Reviewer asked for another pass`,`审阅者要求再改一轮`];return Z(t,r[0],r[1])}function Ec(e,t){return t===`zh-CN`?e[0]:e[1]}function Dc(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``)}var Oc={grounding_started:[`正在阅读这项请求,弄清楚它要做什么`,`Reading the request to understand what it asks`],goal_framed:[`已经理解这项请求,项目目标已经确定。`,`The request is understood and the project goal is set.`],goal_not_understood:[`这项请求还没有被理解清楚。`,`The request could not be understood yet.`],request_not_routed:[`这项请求没能被安排下去。`,`The request could not be routed to the team.`],stage_advanced:[`研究进入了下一阶段。`,`The research moved to the next stage.`],stage_entered:[`研究进入「{stage}」阶段。`,`The research moved to the {stage} stage.`],stage_held:[`当前阶段暂不推进。`,`The current stage is on hold.`],stage_rolled_back:[`研究退回到了前一阶段。`,`The research went back a stage.`],stage_completed:[`当前阶段已完成。`,`The current stage is complete.`],stage_reconsidered:[`阶段安排已重新考虑。`,`The stage plan was reconsidered.`],stage_reviewed:[`阶段已复核。`,`The stage was reviewed.`],planning_started:[`正在规划下一步工作`,`Planning the next step`],task_added:[`计划中加入了一项新任务。`,`A new task was added to the plan.`],research_route_added:[`计划中加入了一条新的研究路线。`,`A new research route was added to the plan.`],planning_complete:[`下一步的计划已经排好。`,`The next step is planned.`],project_finished:[`项目已经完成。`,`The project is finished.`],task_delivered:[`成果已交付。`,`The result was delivered.`],planner_waiting:[`规划者在等待前一步完成。`,`The Planner is waiting for the previous step.`],planner_idle:[`暂时没有需要规划的工作。`,`Nothing to plan right now.`],planning_failed:[`这次规划没有成功。`,`Planning did not succeed this time.`],mission_started:[`开始处理这项任务`,`Work on the task started`],awaiting_engineer:[`等待工程师完成这一轮。`,`Waiting for the Engineer to finish the round.`],waiting_external:[`等待外部工作完成。`,`Waiting on work outside Argus.`],mission_completed:[`任务已完成。`,`The task is complete.`],mission_continued:[`任务将继续进行。`,`The task continues.`],mission_certified:[`成果已通过独立核对。`,`The result passed an independent check.`],mission_incomplete:[`任务没有完成。`,`The task was not completed.`],mission_stalled:[`任务停滞不前。`,`The task stalled.`],mission_blocked:[`任务被挡住了。`,`The task is blocked.`],mission_failed:[`任务没能完成。`,`The task could not be completed.`],mission_paused:[`任务在完成前暂停;进度已保存,可以继续。`,`The task was paused before it finished; its progress is saved and it can be resumed.`],mission_ended:[`任务已结束。`,`The task ended.`],mission_ready:[`可以开始新任务。`,`Ready for a new task.`],round_in_progress:[`这一轮正在进行。`,`The round is in progress.`],round_running:[`第 {n} 轮正在进行。`,`Round {n} is in progress.`],round_started:[`第 {n} 轮工作开始。`,`Round {n} started.`],progress_tool:[`正在使用工具`,`Using a tool`],progress_command:[`正在运行命令`,`Running a command`],progress_message:[`正在汇报进展`,`Reporting progress`],progress_file:[`正在更新项目文件`,`Updating project files`],progress_inspecting:[`正在查看项目状态`,`Looking at the project state`],engineer_round_finished:[`工程师完成了这一轮,结果已准备好供核对。`,`The Engineer finished the round; the result is ready to be checked.`],checking_started:[`正在阅读工程师的结果并核对证据`,`Reading the Engineer's result and checking the evidence`],continuing_before_check:[`先继续下一轮,核对稍后进行。`,`Continuing to the next round; the check comes later.`],check_postponed:[`这一轮的核对推迟了。`,`The check of this round was postponed.`],round_not_judged:[`这一轮没有人审阅。`,`No one reviewed this round.`],results_accepted:[`结果通过了核对。`,`The result passed the check.`],another_attempt_requested:[`审阅者要求再试一次。`,`The reviewer asked for another attempt.`],attempt_blocked:[`这次尝试被挡住了。`,`This attempt is blocked.`],replan_requested:[`审阅者要求重新规划。`,`The reviewer asked for a new plan.`],results_not_final:[`结果还不是最终的。`,`The result is not final yet.`],handed_off:[`已交给下一位。`,`Handed off to the next role.`],waiting:[`等待中`,`Waiting`],live_activity:[`正在工作`,`Working`],role_failed:[`{role} 执行失败`,`{role} failed`],capability_unlocked:[`解锁了一项新能力。`,`A new capability was unlocked.`],capability_upgraded:[`一项能力得到了升级。`,`A capability was upgraded.`],capability_promoted:[`一项能力被提升为来源。`,`A capability was promoted to a source.`],knowledge_captured:[`记下了一条新知识。`,`New knowledge was captured.`],knowledge_refined:[`一条知识得到了完善。`,`A piece of knowledge was refined.`],knowledge_promoted:[`一条知识被提升。`,`A piece of knowledge was promoted.`],knowledge_demoted:[`一条知识被降级。`,`A piece of knowledge was demoted.`],knowledge_retired:[`一条知识已退役。`,`A piece of knowledge was retired.`],"event.model_call.started":[`开始调用模型`,`Model call started`],"event.model_call.completed":[`模型调用完成`,`Model call completed`],"event.model_call.failed":[`模型调用失败`,`Model call failed`],"event.usage.recorded":[`已记录用量`,`Usage recorded`],"event.budget.reserved":[`已预留预算`,`Budget reserved`],"event.budget.settled":[`预算已结算`,`Budget settled`],"event.model_turn":[`与模型完成一次往返`,`One exchange with the model`],"event.instruction.received":[`收到你的指令`,`Your instruction was received`],"event.instruction.done":[`指令已执行`,`Instruction carried out`],"event.inbox.processed":[`已处理收件箱`,`Inbox processed`],"event.round.started":[`新的一轮开始`,`A new round started`],"event.round.finished":[`执行者完成了这一轮`,`The Engineer finished the round`],"event.review.finished":[`这一轮的审阅结束`,`Review of the round finished`],"event.retry.waiting":[`等待后重试`,`Waiting before retrying`],"event.retry.interrupted":[`等待被打断`,`The wait was interrupted`],"event.status":[`状态更新`,`Status update`],"event.planning.started":[`开始规划`,`Planning started`],"event.planning.failed":[`规划没有完成`,`Planning did not complete`],"event.planning.tidied":[`计划已整理`,`Plan tidied`],"event.planning.decided":[`规划结论`,`Planning decision`],"event.task.started":[`开始执行任务`,`Task execution started`],"event.task.ended":[`任务执行结束`,`Task execution ended`],"event.skills.ready":[`技能库已就绪`,`Skill library ready`],"event.routes.formed":[`已形成候选路线组合`,`Candidate route portfolio formed`],"event.lessons.skipped":[`本次没有总结经验`,`No lessons recorded this time`],"event.argus.reply":[`Argus 的回复`,`Reply from Argus`]},kc={daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],paused_daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],operator_pause:[`你暂停了它`,`you paused it`],paused_operator:[`你暂停了它`,`you paused it`],operator_abort:[`你停止了它`,`you stopped it`],budget_exhausted:[`预算用完了`,`the budget ran out`],budget_pause:[`预算用完了`,`the budget ran out`],paused_budget:[`预算用完了`,`the budget ran out`],provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],paused_provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],provider_fence:[`模型服务不可用`,`the model service is unavailable`],paused_provider_fence:[`模型服务不可用`,`the model service is unavailable`],backend_unavailable:[`模型服务不可用`,`the model service is unavailable`],transient_error:[`出现了暂时性的问题`,`a temporary problem came up`],permanent_error:[`遇到了无法自动恢复的错误`,`an error could not be recovered from`],operator_input_required:[`需要你的回复`,`your reply is needed`],planner_empty_plan:[`需要一份新的计划`,`a new plan is needed`]},Ac={pending:[`待开始`,`Waiting`],queued:[`待开始`,`Waiting`],not_started:[`待开始`,`Not started`],waiting:[`等待中`,`Waiting`],idle:[`空闲`,`Idle`],running:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],active:[`进行中`,`In progress`],working:[`进行中`,`In progress`],framed:[`已明确目标`,`Objective settled`],grounding:[`了解项目中`,`Getting oriented`],planned:[`已规划`,`Planned`],done:[`已完成`,`Done`],complete:[`已完成`,`Done`],completed:[`已完成`,`Done`],success:[`已完成`,`Done`],accepted:[`已完成`,`Done`],failed:[`失败`,`Failed`],error:[`出错`,`Failed`],blocked:[`受阻`,`Blocked`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],skipped:[`已跳过`,`Skipped`],ended:[`已结束`,`Ended`],incomplete:[`未完成`,`Not finished`],stalled:[`停滞`,`Stalled`],paused:[`已暂停`,`Paused`],stopped:[`已停止`,`Stopped`],cancelled:[`已停止`,`Stopped`],aborted:[`已停止`,`Stopped`],paused_external_work:[`等待外部工作完成`,`Waiting for external work`],superseded:[`已由新方案替代`,`Replaced by a newer plan`]},jc={engineer_service_dropped:[`模型服务在工程师得出可核对的结果之前中断了会话,因此没有可以审阅的内容。Argus 会换一个新会话重试。`,`The model service dropped the session before the Engineer produced a checkable result, so there was nothing to review. Argus will retry in a fresh session.`],reviewer_unreachable:[`审阅者的会话在得出结论前就结束了,Argus 会再试一次。`,`The reviewer's session ended before it reached a conclusion; Argus will try again.`],argus_stopped:[`Argus 被停止了,任务随之暂停。`,`Argus was stopped, so the task paused.`],task_cancelled:[`这项任务被取消了。`,`The task was cancelled.`],session_length_limit:[`这一轮达到了单次会话的长度上限;已做的工作保留,会在新的会话里继续。`,`The round reached the length limit of one session; the work so far is kept and continues in a fresh session.`],tools_unavailable:[`执行环境里缺少需要的工具。`,`The tools the work needs are not available in the execution environment.`],model_unavailable:[`模型服务暂时不可用。`,`The model service is unavailable for now.`],sign_in_failed:[`模型服务的登录没有成功。`,`Signing in to the model service did not succeed.`],paused:[`任务被暂停了。`,`The task was paused.`],unknown:[`原因暂时不明。`,`The reason is not known yet.`],retry_wait_cut_short:[`在等待重试时 Argus 被要求停止。`,`Argus was asked to stop while waiting to retry.`]},Mc={idea:[`选题`,`Idea`],scope:[`研究定义`,`Scope`],research:[`文献与假设`,`Literature and hypotheses`],literature:[`文献与假设`,`Literature and hypotheses`],implementation:[`方法实现`,`Implementation`],implement:[`方法实现`,`Implementation`],experiment:[`实验验证`,`Experiments`],experiments:[`实验验证`,`Experiments`],analysis:[`结果分析`,`Analysis`],writing:[`论文写作`,`Writing`],review:[`最终审核`,`Final review`],delivery:[`成果交付`,`Delivery`],optimize:[`优化`,`Optimization`],solve:[`推导与验证`,`Derivation and verification`],hold:[`已暂停`,`Paused`],paused:[`已暂停`,`Paused`]},Nc={"provider.request.started":`event.model_call.started`,"provider.request.completed":`event.model_call.completed`,"provider.request.failed":`event.model_call.failed`,"agent.io.start":`event.model_call.started`,"agent.io.complete":`event.model_call.completed`,"usage.recorded":`event.usage.recorded`,"budget.reservation.created":`event.budget.reserved`,"budget.reservation.settled":`event.budget.settled`,"role.session.turn":`event.model_turn`,"daemon.command.submitted":`event.instruction.received`,"daemon.command.completed":`event.instruction.done`,"life.inbox.drained":`event.inbox.processed`,"round.start":`event.round.started`,"round.main.completed":`event.round.finished`,"round.review.completed":`event.review.finished`,"round.backend_failure.backoff":`event.retry.waiting`,"round.backend_failure.hold_interrupted":`event.retry.interrupted`,"life.status":`event.status`,"life.planner.start":`event.planning.started`,"life.planner.error":`event.planning.failed`,"life.planner.normalized":`event.planning.tidied`,"life.planner.verdict":`event.planning.decided`,"loop.start":`event.task.started`,"loop.done":`event.task.ended`,"skill.library.available":`event.skills.ready`,"idea.portfolio.formed":`event.routes.formed`,"team.learning.review.skipped":`event.lessons.skipped`,"ui.argus":`event.argus.reply`};function Pc(e,t){let n=String(e??``).trim(),r=Mc[n.toLowerCase()];return r?Ec(r,t):n}function Fc(e,t){let n=String(e??``).trim().toLowerCase(),r=kc[n];return r?Ec(r,t):n}function Ic(e,t){let n=String(e??``).trim().toLowerCase(),r=kc[n];return r?t===`zh-CN`?`因为${r[0]},工作停了下来。`:`The work stopped because ${r[1]}.`:n}function Lc(e,t,n){if(!t)return e;let r=Fc(t,n);return n===`zh-CN`?`${e.replace(/。$/,``)}(${r})。`:`${e.replace(/\.$/,``)} — ${r}.`}function Rc(e,t,n){return t?n===`zh-CN`?`已完成 ${e} / ${t}`:`${e} of ${t} done`:Ec([`尚未规划`,`Not planned yet`],n)}var zc=[[/^Reporting progress$/i,`progress_message`],[/^(?:Running a command|running project command)$/i,`progress_command`],[/^Using a tool$/i,`progress_tool`],[/^inspecting project state$/i,`progress_inspecting`],[/^Working$/i,`live_activity`]],Bc=[...zc,[/^(?:Review not performed|No review this round)$/i,`round_not_judged`],[/^Goal framed$/i,`goal_framed`],[/^(?:Grounding project|Project grounding started)$/i,`grounding_started`],[/^Manager routing failed$/i,`request_not_routed`],[/^Stage reviewed$/i,`stage_reviewed`],[/^(?:Planning next work|Planning started)$/i,`planning_started`],[/^Planning complete$/i,`planning_complete`],[/^Planner waiting$/i,`planner_waiting`],[/^Project reviewed$/i,`project_finished`],[/^Research branch added$/i,`research_route_added`],[/^Task added$/i,`task_added`],[/^(?:Engineer handoff ready|Work ready for review)$/i,`engineer_round_finished`],[/^(?:Review started|Reviewing benchmark evidence)$/i,`checking_started`],[/^(?:Continuing before review|Continued before review)$/i,`continuing_before_check`],[/^Review deferred for one round$/i,`check_postponed`],[/^Waiting for the Engineer to finish$/i,`awaiting_engineer`],[/^Waiting on external work$/i,`waiting_external`],[/^(?:Evidence accepted|Accepted evidence)$/i,`results_accepted`],[/^(?:Attempt rejected|Requested another attempt)$/i,`another_attempt_requested`],[/^Handed off$/i,`handed_off`],[/^(?:Mission started|Starting mission)$/i,`mission_started`],[/^(?:Task completed|Mission complete)$/i,`mission_completed`],[/^Task failed$/i,`mission_failed`],[/^Awaiting Planner$/i,`planner_waiting`],[/^Ready for a new mission$/i,`mission_ready`],[/^Waiting$/i,`waiting`],[/^Capability unlocked$/i,`capability_unlocked`],[/^Capability upgraded$/i,`capability_upgraded`],[/^Capability promoted to source$/i,`capability_promoted`],[/^Knowledge captured$/i,`knowledge_captured`],[/^Knowledge refined$/i,`knowledge_refined`],[/^Knowledge promoted$/i,`knowledge_promoted`],[/^Knowledge demoted$/i,`knowledge_demoted`],[/^Knowledge retired$/i,`knowledge_retired`],[/^(?:request · started|io · start)$/i,`event.model_call.started`],[/^(?:request · completed|io · complete)$/i,`event.model_call.completed`],[/^usage · recorded$/i,`event.usage.recorded`],[/^reservation · created$/i,`event.budget.reserved`],[/^reservation · settled$/i,`event.budget.settled`],[/^Round (\d+) started$/i,(e,t)=>Dc(Ec(Oc.round_started,t),{n:e[1]})],[/^Running round (\d+)$/i,(e,t)=>Dc(Ec(Oc.round_running,t),{n:e[1]})],[/^Stage (?:·|→) (.+)$/i,(e,t)=>Dc(Ec(Oc.stage_entered,t),{stage:Pc(e[1],t)})],[/^Mission (ended|incomplete|stalled|blocked|failed)(?: · (\S+))?$/i,(e,t)=>Lc(Ec(Oc[`mission_${e[1].toLowerCase()}`],t),e[2],t)],[/^(Manager|Planner|Engineer|Reviewer) failed$/i,(e,t)=>Dc(Ec(Oc.role_failed,t),{role:e[1]})],[/^(\d+) \/ (\d+) complete$/i,(e,t)=>Rc(Number(e[1]),Number(e[2]),t)],[/^Not planned$/i,(e,t)=>Rc(0,0,t)]];function Vc(e){return e===`zh-CN`?`zh`:`en`}function Hc(e,t,n){let r=String(e??``).trim(),i=typeof n==`string`?{kind:n}:n??{};if(!i.kind||i.kind===`live_activity`){for(let[e,n]of zc)if(e.test(r))return Ec(Oc[n],t)}let a=i.kind?Oc[i.kind]:void 0;if(i.kind){let e=!!i.language&&i.language!==Vc(t);if(a&&(e||!r)&&!a[0].includes(`{`))return Ec(a,t);if(r&&!e)return r}for(let[e,n]of Bc){let i=r.match(e);if(i)return typeof n==`string`?Ec(Oc[n],t):n(i,t)}if(a){let e=Ec(a,t);if(!e.includes(`{`))return e;let n=r.match(/\d+/)?.[0];return n&&e.includes(`{n}`)?Dc(e,{n}):r}let o=Ac[r.toLowerCase()];return o?Ec(o,t):r}function Uc(e,t){let n=jc[String(e??``).trim().toLowerCase()];return n?Ec(n,t):``}function Wc(e,t){let n=String(e??``).trim().toLowerCase(),r=Ac[n];return r?Ec(r,t):n}function Gc(e,t){let n=Nc[String(e??``).trim()];return n?Ec(Oc[n],t):null}function Kc(e){return/^(?:provider\.|agent\.io\.|usage\.|budget\.|role\.session\.turn$)/.test(String(e??``))}var qc=[[/^Next action:\s*/i,[`下一步:`,`Next: `]],[/^(?:原因:|Reason:)\s*/i,[`原因:`,`Reason: `]],[/^The backend has failed the same way (\d+) times in a row \(([^)]*)\)\. Waiting ([\d.]+)s before the next attempt[^\n]*/i,(e,t)=>({text:t===`zh-CN`?`模型服务已连续 ${e[1]} 次以同样的方式失败;为了不让持续的故障白白花钱,${e[3]} 秒后再试。`:`The model service has failed the same way ${e[1]} times in a row; waiting ${e[3]} seconds before trying again so a standing failure does not keep costing money.`,technical:e[2]})],[/^review: \w+(?: \([^)]*\))? — /i,[``,``]],[/^status=(\S+) rounds=(\d+) reason=/i,(e,t)=>{let n=kc[e[1].toLowerCase()],r=n?Ec(n,t):Wc(e[1],t);return t===`zh-CN`?`任务已结束(${r}),共 ${e[2]} 轮。`:`Task ended — ${r}, after ${e[2]} rounds.`}],[/^engineer round (\d+) \((?:fresh session|new session)\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮,在新的会话里开始。`:`Round ${e[1]}, started in a fresh session.`],[/^engineer round (\d+) \([^)]*\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮开始。`:`Round ${e[1]} started.`],[/^backend failure; retrying in a fresh \w+ session after ([\d.]+)s\.?$/i,(e,t)=>t===`zh-CN`?`模型服务调用失败,${e[1]} 秒后在新的会话里重试。`:`The model service call failed; retrying in a fresh session after ${e[1]} seconds.`],[/^planner error: (.*; retry later)\.?$/i,(e,t)=>({text:t===`zh-CN`?`规划这一步没有完成,稍后会重试。`:`Planning did not complete; it will be retried later.`,technical:e[1]})],[/^mission failed\.?$/i,[`任务失败了。`,`The task failed.`]],[/^Engineer backend failed before a trustworthy completed turn; reviewer skipped\.?/i,[`这一轮模型服务没有完成调用,所以没有人审阅。`,`The model service did not complete this round, so no one reviewed it.`]],[/^Reviewer backend unavailable for (\d+) consecutive attempt\(s\); failing loud rather than settling the round without a real review\.?/i,(e,t)=>t===`zh-CN`?`审阅者的模型服务连续 ${e[1]} 次没有响应,这一轮因此没有得到审阅。`:`The reviewer's model service did not respond ${e[1]} times in a row, so this round was not reviewed.`],[/^The Reviewer's session ended before it reached a conclusion, so this round was not judged\.?/i,[`审阅者在得出结论前就中断了,这一轮没有被评判。`,`The reviewer stopped before reaching a conclusion, so this round was not judged.`]],[/^The wait after a repeated backend failure ended early: daemon stop requested\.?/i,[`在等待重试时 Argus 被要求停止,任务随之暂停。`,`Argus was asked to stop while waiting to retry, so the task paused.`]],[/^Backend call paused before a trustworthy completed turn \(stop_kind=(\w+)\); reviewer skipped\.?/i,(e,t)=>t===`zh-CN`?`这一轮在得出可信结果前被暂停(${Fc(e[1],t)}),所以没有人审阅。`:`This round was paused before it produced a trustworthy result (${Fc(e[1],t)}), so no one reviewed it.`],[/^One Engineer call used its whole per-call provider-turn allowance \([^)]*\); reviewer skipped\. The work so far is kept and the task continues in a fresh session from the checkpoint\.?/i,[`这一轮用完了单次调用的额度;已做的工作保留,会在新的会话里接着做,本轮没有审阅。`,`This round used up its per-call allowance; the work so far is kept and continues in a fresh session. No review this round.`]],[/^Execution host is unavailable; reviewer skipped\.?/i,[`执行环境暂时不可用,这一轮没有审阅。`,`The execution environment is unavailable, so this round was not reviewed.`]],[/^Copilot CLI exited with code \d+\.?/i,[`模型服务的调用没有完成。`,`The model service call did not complete.`]],[/^Grounded bounded plan completed with (\d+) step\(s\)\.?/i,(e,t)=>t===`zh-CN`?`规划完成,共 ${e[1]} 步。`:`Planning finished with ${e[1]} steps.`],[/^Retry in a fresh \w+ session; do not resume the failed thread\.(?:\s*If this repeats, pause the daemon and reduce concurrent \w+ load\.)?/i,[`接下来会在新的会话里重试这一轮。`,`The round will be retried in a fresh session.`]],[/^Restart the daemon to resume this mission from its checkpoint\.?/i,[`重新运行 Argus 即可从保存的进度继续。`,`Run Argus again to continue from the saved progress.`]],[/^Resume this mission when the operator is ready\.?/i,[`准备好后即可恢复这项任务。`,`Resume the task whenever you are ready.`]],[/^Resume from the persisted checkpoint after the blocking budget or provider condition has been cleared\.?/i,[`预算或模型服务恢复后,即可从保存的进度继续。`,`Once the budget or model service is back, the task continues from the saved progress.`]],[/^inspecting project state$/i,[`正在查看项目状态`,`Looking at the project state`]],[/^running project command$/i,[`正在运行项目命令`,`Running a project command`]],[/^using a tool$/i,[`正在使用工具`,`Using a tool`]]],Jc=/^(?:[\w.]+_(?:streak|code|error|kind)=|error=|exit=|fatal_error=|Runner receipt:|stop_kind=|backend_)/i;function Yc(e,t){let n=e.trim(),r=[],i=[],a=!1;for(;n;){let e=!1;for(let[o,s]of qc){let c=n.match(o);if(!c)continue;let l=typeof s==`function`?s(c,t):Ec(s,t);typeof l==`string`?r.push(l):(r.push(l.text),l.technical&&i.push(l.technical)),n=n.slice(c[0].length).replace(/^[\s;,]+/,``),e=!0,a=!0;break}e||(a&&Jc.test(n)?i.push(n):r.push(n),n=``)}let o=t===`zh-CN`?``:` `;return{text:r.filter(Boolean).join(o).replace(/:\s+/g,`:`),technical:i.join(` `)}}function Xc(e,t,n){let r=String(e??``).trim();if(n){let e=n.language&&n.language!==Vc(t)?Uc(n.cause,t):``;if(e)return{text:e,technical:String(n.technical??``)};if(n.technical)return{text:r,technical:String(n.technical)}}if(!r)return{text:``,technical:``};let i=r.split(/(\n[ \t]*\n|\n)/),a=[],o=[];return i.forEach((e,n)=>{if(n%2==1){a.push(e.includes(` + +`)||/\n[ \t]*\n/.test(e)?` + +`:` +`);return}let r=Yc(e,t);a.push(r.text),r.technical&&o.push(r.technical)}),{text:a.join(``).replace(/\n{3,}/g,` + +`).trim(),technical:o.join(` `)}}function Zc(e,t){let n=e.split(/(\r?\n)/),r=n.findIndex((e,t)=>t%2==0&&e.trim()!==``),i=n[r]?.trim()??``,a=i.match(/^(?:Task continued|任务已继续)(?: · (.+))?$/),o=i.match(/^Could not complete (.+)\.$/)??i.match(/^未能完成:(.+)。$/);if(!a&&!o)return null;let s=t===`zh-CN`,c=[],l=``,u=!1;return{text:n.map((e,n)=>{if(n%2==1)return e;if(n===r){if(a){let e=a[1]??``,n=e.match(/^(.*?) · review=(\S+)$/),r=n?n[1]:e;return[s?`当时记录:工作继续推进。`:`Recorded then: work continued.`,r?`${s?`任务:`:`Task: `}${r}`:``,n?`${s?`当时记录的审阅状态:`:`Review status recorded then: `}${Wc(n[2],t)}`:``].filter(Boolean).join(` +`)}let e=o[1];return/^(?:the current task|当前任务)$/.test(e)?s?`当时这项任务未能完成。`:`This task had not completed at that time.`:s?`当时未能完成:${e}。`:`Not completed at that time: ${e}.`}if(/^(?:Progress|Mission summary|本次进展|本次完成)[::]/.test(e)&&(u=!0),u)return e;let i=e.match(/^\s*(`{3,}|~{3,})/);if(i)return l?l===i[1][0]&&(l=``):l=i[1][0],e;if(l)return e;if(/^(?:Nothing is queued yet; the Planner is deciding what comes next\.|计划里暂时没有下一项,Planner 正在决定接下来做什么。)$/.test(e))return s?`当时尚未排入下一项任务,规划者还在决定接下来做什么。`:`At that time, nothing was queued and the Planner was still deciding what to do next.`;let d=e.match(/^(?:Next(?: action| up)?|下一步|接下来做)[::]\s*(.*)$/);if(d){let e=/^(?:Argus will diagnose the failure and choose a safe next step\.|Argus 会诊断原因并选择可恢复的方案。)$/.test(d[1])?s?`诊断当时的原因,再选择可恢复的方案。`:`Diagnose the cause and choose a recovery approach.`:d[1];return`${s?`当时记录的下一步:`:`Next step recorded at the time: `}${e}`}let f=e.match(/^(?:Reason:|原因:)\s*(.*)$/);if(f){let e=pa(f[1]);if(e.prose===`Argus was stopped by its operator in the middle of this round; the Engineer's work so far is kept and nothing was retried.`){let t=ma(f[1],s);return e.receipt&&c.push(e.receipt),s?`当时${t.summary}。已做的工作保留,当时没有重试。`:`At that time, ${t.summary}. Work done so far was kept, and no retry was made then.`}let n=Xc(f[1],t);if(n.text!==f[1].trim()||n.technical)return n.technical&&c.push(n.technical),`${s?`当时记录的原因:`:`Reason recorded at the time: `}${n.text}`}return fa.test(e.trim())?(c.push(e),``):e}).join(``),technical:c.join(` +`)}}var Qc=3,$c=`engineer.progress`,el=new Set([`tool_use`,`command_execution`,`file_change`]),tl=[`assistant_message`,`agent_message`,`message`],nl=e=>e,rl=(e,t)=>String(nl(e)[t]??``),il=e=>rl(e,`type`)===$c?rl(e,`kind`):``;function al(e,{locale:t,showReasoning:n,filter:r=`all`,query:i=``}){let a=[],o=new Map,s=0,c={locale:t,showReasoning:n,unknownEventPolicy:`hide`,density:`compact`};return e.forEach(e=>{let t=wc(e,c);if(!t){!n&&fe(e)&&s++;return}if(!ve(e,t,r,i))return;let l=rl(e,`message_id`),u=!!l&&rl(e,`type`)===$c&&tl.includes(rl(e,`kind`));if(u&&o.has(l)){let n=o.get(l);a[n]={...a[n],ev:{...a[n].ev,...e},r:{...a[n].r,...t,text:Ie(a[n].r.text,t.text,Le(e))}};return}let d={ev:e,r:t,key:Re(e)};u&&o.set(l,a.length),a.push(d)}),{list:a,hiddenReasoning:s}}function ol(e){let t=rl(e,`tool_name`)||rl(e,`tool`)||rl(e,`name`);if(t)return t;let n=rl(e,`text`).match(/^([A-Za-z_][\w.-]{0,40}):\s/);return n?n[1]:``}function sl(e){let t=rl(e,`status`).toLowerCase();if(t===`running`||t===`started`||t===`in_progress`||t===`pending`)return`running`;if(t===`failed`||t===`error`||t===`errored`)return`failed`;let n=nl(e).exit_code;return typeof n==`number`&&n!==0?`failed`:[`completed`,`complete`,`success`,`succeeded`,`done`,`ok`,`finished`].includes(t)?`completed`:``}function cl(e,t){let n=rl(t,`call_id`),r=rl(e.ev,`call_id`);return n&&r?n===r:il(e.ev)===il(t)&&ol(e.ev)===ol(t)&&rl(e.ev,`text`)===rl(t,`text`)}var ll=(e,t)=>({kind:`step`,key:e.key,ev:e.ev,r:e.r,latest:e.ev,repeat:1,status:t});function ul(e){let t=[],n=[],r=(e,t,r,i)=>{let[a]=n.splice(e,1);a.status=r,a.latest=t,i&&(a.result=i)};for(let i of e){let e=il(i.ev);if(el.has(e)){let e=sl(i.ev);if(e!==`running`){let t=n.length-1;for(;t>=0&&!cl(n[t],i.ev);)--t;if(t>=0){r(t,i.ev,e||`completed`);continue}}let a=ll(i,e);t.push(a),e===`running`&&n.push(a);continue}if(e===`tool_result`){let e=rl(i.ev,`call_id`),t=ol(i.ev),a=e?n.findIndex(t=>rl(t.ev,`call_id`)===e):n.findIndex(e=>!t||ol(e.ev)===t);if(a>=0){r(a,i.ev,sl(i.ev)||`completed`,i);continue}}t.push(ll(i,``))}return t}var dl=/fail|error|backoff|stall|denied|blocked|nudge|escalat/i,fl=/\b(?:fail(?:ed|ure)?|error|unavailable|unreachable|exited with code|backoff|retry(?:ing)?|stuck|skipped)\b/i;function pl(e){if(il(e.ev))return!1;let t=e.ev;return e.r.tone===`err`||e.r.tone===`warn`||dl.test(rl(t,`type`))||nl(t).backend_unavailable===!0||nl(t).review_skipped===!0||fl.test(e.r.text)}var ml=e=>e.toLowerCase().replace(/\d+(?:\.\d+)?/g,`#`).replace(/\s+/g,` `).trim();function hl(e){let t=e.ev;return ml(rl(t,`signature`)||rl(t,`cause`)||rl(t,`backend_error`)||rl(t,`error`)||rl(t,`reason`)||rl(t,`stop_kind`)||e.r.text)}function gl(e,t){return pl(e)?`fail|${e.r.role}|${rl(e.ev,`type`)}|${hl(e)}`:`text|${e.r.role}|${e.r.glyph}|${Xc(e.r.text,t).text}`}function _l(e,t){e.repeat+=t.repeat,e.latest=t.latest,e.r=t.r,t.status&&(e.status=t.status),t.result&&(e.result=t.result)}function vl(e,t){let n=[],r=[];for(let i of e){let e=gl(i,t),a=n[n.length-1];if(a&&r[r.length-1]===e){_l(a,i);continue}n.push({...i}),r.push(e)}let i=r.map((e,t)=>il(n[t].ev)?e:ml(e)),a=(e,t)=>{if(e+2*t>n.length)return!1;for(let n=0;ne.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,Cl=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,wl=e=>Cl(e.replace(/^[a-z]+:\/\/(?:www\.)?/i,``).replace(/#.*$/,``).replace(/\/$/,``),48),Tl=/\*\*\* (?:Add|Update|Delete|Move to) File:\s*(\S+)/;function El(e,t,n){for(let r of n){if(e){let t=e[r];if(typeof t==`string`&&t.trim())return t.trim();if(Array.isArray(t)&&typeof t[0]==`string`&&t[0].trim())return t[0].trim();continue}let n=t.match(RegExp(`"${r}":\\s*"((?:[^"\\\\]|\\\\.)*)"`));if(n&&n[1])return n[1].replace(/\\(.)/g,`$1`)}return``}function Dl(e){return Ol(e.ev)}function Ol(e){let t=rl(e,`text`);if(il(e)===`file_change`){let e=t.match(Tl);if(e)return Sl(e[1].trim());let n=t.match(/^(\S+\.[A-Za-z0-9]{1,8})\b/);return n?Sl(n[1]):``}let n=t.replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),r=null;if(n.startsWith(`{`))try{let e=JSON.parse(n);r=e&&typeof e==`object`&&!Array.isArray(e)?e:null}catch{r=null}let i=El(r,n,[`path`,`file_path`,`filePath`,`file`,`filename`,`target_file`,`notebook_path`,`paths`]);if(i&&!/^\.\/?$/.test(i))return Sl(i);let a=El(r,n,[`url`,`uri`]);if(a)return wl(a);let o=El(r,n,[`pattern`,`query`,`regex`,`glob`,`q`]);if(o)return Cl(o,32);let s=n.match(Tl);return s?Sl(s[1].trim()):``}function kl(e,t){let n=t===`zh-CN`,r=e.trim().replace(/\\/g,`/`).split(`/`).filter(e=>e&&e!==`**`&&e!==`.`),i=r[r.length-1]??`*`,a=r.slice(0,-1).filter(e=>!/[*?]/.test(e)),o;o=i===`*`||i===`*.*`?n?`所有文件`:`all files`:/^\*\.[\w.]+$/.test(i)?n?`${i.slice(1)} 文件`:`${i.slice(1)} files`:Cl(i,40);let s=a[a.length-1];return s?n?`${s} 里的 ${o}`:`${o} in ${s}`:o}var Al=/^(glob|find|find_?files|list_?files|file_?search)$/i;function jl(e,t){let n=t===`zh-CN`,r=ol(e),i=bl(r,il(e)),a=Ol(e);if(i===`search`){let t=El(null,rl(e,`text`).replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),[`pattern`,`query`,`regex`,`glob`,`q`]);t&&(a=Cl(t,48))}if(i===`search`&&Al.test(r)&&a)return`${n?`查找`:`Find`} ${kl(a,t)}`;let o=a.startsWith(`/`)?Sl(a):a,[s,c,l,u]={read:[`查阅`,`查阅文件`,`Read`,`Read a file`],search:[`搜索:`,`搜索`,`Search:`,`Search`],fetch:[`读取`,`读取网页`,`Open`,`Open a page`],edit:[`修改`,`修改文件`,`Edit`,`Edit a file`],tool:[`调用`,`调用工具`,`Use`,`Use a tool`]}[i],d=i===`tool`?r:o;if(!d)return n?c:u;let f=n?s:l;return f.endsWith(`:`)?`${f}${d}`:`${f} ${d}`}function Ml(e,t){let n=il(e);return n===`command_execution`?{title:t===`zh-CN`?`正在运行命令`:`Running a command`,detail:``}:[`tool_use`,`file_change`].includes(n)?{title:{read:[`查看资料`,`Reading material`],search:[`查找相关信息`,`Searching for relevant information`],fetch:[`读取资料页面`,`Reading a source page`],edit:[`更新项目文件`,`Updating project files`],tool:[`执行一个工作步骤`,`Carrying out a work step`]}[bl(ol(e),n)][t===`zh-CN`?0:1],detail:Ol(e)}:null}function Nl(e){let t=e[0],n=e[e.length-1],r=ol(t.ev)||(il(t.ev)===`file_change`?`file`:`tool`),i=bl(r,il(t.ev)),a=[],o=0;for(let t of e){let e=Dl(t);e&&(o+=1,a.includes(e)||a.push(e))}let s=e.reduce((e,t)=>e+t.repeat,0),c=i===`read`||i===`edit`||i===`fetch`;return{kind:`group`,key:`group:${t.key}`,r:{...t.r,text:``},latest:n.latest,tool:r,action:i,steps:e,targets:a,count:c&&o===e.length?a.length:s,calls:s,failed:e.filter(e=>e.status===`failed`).length}}function Pl(e){let t=[],n=[],r=null,i=()=>{n.length>=3?t.push(Nl(n)):t.push(...n),n=[],r=null};for(let a of e){let e=xl(a);if(e&&(r===null||r===e)){n.push(a),r=e;continue}i(),e?(n.push(a),r=e):t.push(a)}return i(),t}function Fl(e,t){return Pl(vl(ul(e),t))}function Il(e,t,n){let r=t(`stream.fold.${e.action}`,{count:e.count,tool:e.tool}),i=e.targets.slice(0,Qc);return`${r}${i.length?`${n===`zh-CN`?`:`:`: `}${i.join(n===`zh-CN`?`、`:`, `)}${e.targets.length>i.length?`…`:``}`:``}${e.failed?` · ${t(`stream.fold.failed`,{count:e.failed})}`:``}`}function Ll(e,t,n){return e.kind===`group`?Il(e,t,n):Xc(e.r.text,n).text}var Rl=new Set([`tool_use`,`command_execution`,`file_change`]),zl=new Set([`completed`,`failed`,`cancelled`,`canceled`,`error`,`done`,`stopped`]),Bl=()=>Date.now()/1e3;function Vl(e){return e.trim().replace(/[.…]+$/u,``).toLowerCase()}function Hl(e,t,n=Bl()){let r=(t.label??``).trim();if(!r)return e;let i=t.heartbeat===!0,a=e.slice(),o=(t.callId??``).trim(),s=(t.status??``).trim().toLowerCase(),c=(t.kind??``).trim();if(o){let e=-1;for(let t=a.length-1;t>=0;--t)if(a[t].callId===o){e=t;break}if(e>=0){let i=a[e];return a[e]={...i,label:c===`tool_result`?i.label:r,detail:(t.detail||``).trim()||i.detail,tool:(t.tool||``).trim()||i.tool,output:(t.output||``).trim()||i.output,status:s||i.status,endedTs:zl.has(s)?n:i.endedTs},a}if(c===`tool_result`)return a}let l=a[a.length-1];if(c===`tool_result`)return!l||l.endedTs||l.heartbeat||(a[a.length-1]={...l,output:(t.output||``).trim()||l.output,status:s||`completed`,endedTs:n}),a;if(l&&!l.endedTs){if(Vl(l.label)===Vl(r)||i&&l.heartbeat)return a[a.length-1]={...l,label:r,detail:t.detail||l.detail,kind:t.kind||l.kind,heartbeat:i,endedTs:0},a;l.callId||(a[a.length-1]={...l,endedTs:n})}return a.push({id:`${a.length}:${r}:${n}`,role:(t.role||`manager`).trim()||`manager`,label:r,detail:(t.detail||``).trim(),kind:c,startedTs:n,endedTs:0,heartbeat:i,...t.tool?.trim()?{tool:t.tool.trim()}:{},...t.toolKind?.trim()?{toolKind:t.toolKind.trim()}:{},...o?{callId:o}:{},...s||o?{status:s||`running`}:{},...t.output?.trim()?{output:t.output.trim()}:{}}),a}function Ul(e,t=Bl()){return e.length===0?[]:e.map(e=>e.endedTs?e:{...e,endedTs:t})}function Wl(e){if(!Number.isFinite(e)||e<1)return``;if(e<60)return`${Math.floor(e)}s`;let t=Math.floor(e/60),n=Math.floor(e%60);return n?`${t}m${n}s`:`${t}m`}function Gl(e,t=Bl(),n=!1){return e.filter(e=>!e.heartbeat&&Rl.has(e.kind)).map(e=>{let r=!e.endedTs&&(!e.status||e.status===`running`)?n?`completed`:`running`:e.status||`completed`;return{kind:e.kind,label:e.label,...e.detail?{detail:e.detail}:{},...e.tool?{tool:e.tool}:{},...e.toolKind?{tool_kind:e.toolKind}:{},...e.callId?{call_id:e.callId}:{},status:r,started_ts:e.startedTs,ended_ts:e.endedTs||(n?t:0),...e.output?{output:e.output}:{}}})}var Kl=e=>typeof e==`string`?e.trim():``,ql=e=>typeof e==`number`&&Number.isFinite(e)?e:0;function Jl(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(e=>{if(!e||typeof e!=`object`)return;let n=e,r=Kl(n.label);r&&t.push({kind:Kl(n.kind)||`tool_use`,label:r,...Kl(n.detail)?{detail:Kl(n.detail)}:{},...Kl(n.tool)?{tool:Kl(n.tool)}:{},...Kl(n.tool_kind)?{tool_kind:Kl(n.tool_kind)}:{},...Kl(n.call_id)?{call_id:Kl(n.call_id)}:{},status:Kl(n.status).toLowerCase()||`completed`,started_ts:ql(n.started_ts),ended_ts:ql(n.ended_ts),...Kl(n.output)?{output:Kl(n.output)}:{}})}),t}function Yl(e,t=Bl()){if(!e.length)return 0;let n=Math.min(...e.map(e=>e.started_ts||t)),r=Math.max(...e.map(e=>e.ended_ts||t));return Math.max(0,r-n)}var Xl={command_execution:st,tool_use:bn,file_change:Zt},Zl=new Set([`failed`,`error`]),Ql=new Set([`cancelled`,`canceled`,`stopped`]),$l=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,eu=/^⚙\s*([\w.-]+)\s*·\s*(.*)$/su;function tu(e,t=`zh-CN`){let n=(e.tool??``).trim(),r=(e.detail??``).trim(),i=e.label.match(eu);if(i){let e=i[1],a=r||i[2];return{primary:jl({type:`engineer.progress`,kind:`tool_use`,tool_name:n||e,text:`${e}: ${a}`},t),secondary:a}}let a=e.label.replace($l,``).trim();return{primary:a||n,secondary:r&&r!==a?r:``}}function nu({steps:e,live:t,startedTs:n,status:r=``}){let{t:i,locale:a}=z(),[o,s]=(0,G.useState)(!1),[,c]=(0,G.useState)(0);if((0,G.useEffect)(()=>{if(!t)return;let e=setInterval(()=>c(e=>e+1),1e3);return()=>clearInterval(e)},[t]),(0,G.useEffect)(()=>{t||s(!1)},[t]),!e.length&&!t)return null;let l=Date.now()/1e3,u=Zl.has(r)||e.some(e=>Zl.has(e.status)),d=Ql.has(r)||e.some(e=>Ql.has(e.status)),f=Wl(t&&n?Math.max(0,l-n):Yl(e,l))||`<1s`,p=[...e].reverse().find(e=>e.status===`running`),m=t?`${p?tu(p,a).primary:a===`zh-CN`?`正在准备回复`:`Preparing a reply`} · ${f}`:u?`${a===`zh-CN`?`过程出现问题,请查看详情`:`An issue occurred; see details`} · ${f}`:d?`${a===`zh-CN`?`已停止`:`Stopped`} · ${f}`:i(`chat.stepsDone`,{count:e.length,seconds:f});return(0,J.jsxs)(`div`,{className:`turn-steps mt-3 rounded-lg border border-line/50 bg-surface/50 text-xs`,"data-live":t||void 0,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,"aria-label":a===`zh-CN`?`查看工作过程`:`View work progress`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-ink-dim hover:text-ink`,children:[(0,J.jsx)(t?an:u?Gt:d?gn:We,{size:14,"aria-hidden":`true`,className:`shrink-0 ${t?`animate-spin text-manager motion-reduce:animate-none`:u?`text-err`:d?`text-ink-faint`:`text-ok`}`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:m}),(0,J.jsx)(o?Ue:Ut,{size:14,"aria-hidden":`true`,className:`shrink-0 text-ink-faint`})]}),o?(0,J.jsxs)(`ol`,{className:`space-y-1 border-t border-line/40 px-3 py-2`,children:[!e.length&&(0,J.jsx)(`li`,{className:`text-ink-faint`,children:a===`zh-CN`?`尚未记录工具操作。`:`No tool operations recorded yet.`}),e.map((e,n)=>{let{primary:r,secondary:o}=tu(e,a),s=e.status===`running`,c=Zl.has(e.status),u=Ql.has(e.status),d=e.kind===`command_execution`?Xl.command_execution:e.kind===`file_change`?Xl.file_change:Xl.tool_use,f=Wl(Math.max(0,(e.ended_ts||l)-e.started_ts));return(0,J.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(d,{size:13,"aria-hidden":`true`,className:`shrink-0 self-start mt-0.5 ${c?`text-err`:`text-ink-faint`}`}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`${s&&t?`text-ink`:c?`text-err`:`text-ink-dim`}`,title:o||r,children:r}),o?(0,J.jsxs)(`details`,{className:`turn-step-raw inline`,children:[(0,J.jsx)(`summary`,{className:`ml-2 inline cursor-pointer list-none text-[11px] text-ink-faint hover:text-ink-dim`,children:i(`chat.stepRaw`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block break-all font-mono text-[11px] text-ink-faint`,children:o})]}):null,c&&e.output?(0,J.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-err/80`,children:e.output}):null]}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono tabular-nums ${s&&t?`text-manager`:`text-ink-faint`}`,children:s&&t?(0,J.jsx)(an,{size:12,className:`animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):c?i(`chat.stepFailed`):u?a===`zh-CN`?`已停止`:`Stopped`:f})]},e.call_id||`${n}:${e.started_ts}`)})]}):null]})}function ru({snapshot:e,view:t,events:n=[],connected:r,compact:i=!1}){let{locale:a}=z(),o=a===`zh-CN`,[s,c]=(0,G.useState)(()=>Date.now()/1e3);(0,G.useEffect)(()=>{let e=window.setInterval(()=>c(Date.now()/1e3),1e4);return()=>window.clearInterval(e)},[]);let l=ci(e,t,n,s),u=l.activityAgeSeconds,d=l.waitingOn?``:u===null?o?`暂无本次运行的进展记录`:`No progress recorded for this run yet`:u<60?o?`刚刚有进展`:`Progress in the last minute`:u<3600?o?`${Math.floor(u/60)} 分钟前有进展`:`Progress ${Math.floor(u/60)} min ago`:o?`${Math.floor(u/3600)} 小时前有进展`:`Progress ${Math.floor(u/3600)} hr ago`;return(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-line/60 bg-panel px-4 py-2.5 text-xs`,"data-testid":`work-status`,"data-state":l.state,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,J.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r?l.state===`running`?`bg-blue`:`bg-ink-faint`:`bg-warn`}`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:pi(l,a,r)}),d?(0,J.jsx)(`time`,{className:`text-ink-faint`,dateTime:l.activityAt?new Date(l.activityAt*1e3).toISOString():void 0,children:d}):null]}),r?!i&&l.title?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-ink-dim`,title:l.title,children:l.title}):null:(0,J.jsx)(`p`,{className:`mt-1 leading-5 text-ink-faint`,children:o?`这里保留的是已收到的记录;连接恢复后继续更新。`:`These are the records already received. Updates resume when the connection returns.`})]})}var iu=/Info: (?:Operation cancelled by user|Response was interrupted due to a server error\. Retrying\.\.\.)/gi;function au({ev:e,r:t,first:n,last:r,latest:i,repeat:a=1,status:o=``,result:s}){let{locale:c,t:l}=z(),u=B.role[t.role]??B.inkFaint,d=He(t.tone),f=e.type===`engineer.progress`&&String(e.kind||``)===`tool_use`,p=[`agent_message`,`assistant_message`,`message`].includes(String(e.kind||``))?Ca(t.text):t.text,m=f?{text:jl(e,c),technical:t.text}:Xc(p,c),h=s?Xc(s.r.text,c).text:``,g=[m.technical,h?`${l(`stream.stepResult`)}: ${h}`:``].filter(Boolean).join(` +`);return(0,J.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${r?`animate-appear`:``} ${t.reasoning?`opacity-60`:``}`,style:t.rule?{marginTop:4}:void 0,children:[(0,J.jsxs)(`div`,{className:`relative flex justify-center`,children:[n?null:(0,J.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),r?null:(0,J.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,J.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:u,boxShadow:`0 0 0 1px ${u}55`}})]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:u},title:t.label,children:t.label}),(0,J.jsx)(`span`,{className:`text-xs`,style:{color:d},children:t.glyph}),a>1?(0,J.jsxs)(`span`,{className:`rounded bg-line/60 px-1 font-mono text-[10px] tabular-nums text-ink-dim`,title:l(`stream.repeated`,{count:a}),"data-repeat":a,children:[`×`,a]}):null,o===`failed`?(0,J.jsx)(`span`,{className:`text-xs text-err`,children:l(`stream.stepFailed`)}):null,(0,J.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:Ct(i??e)})]}),(0,J.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5 ${t.reasoning?`italic`:``}`,style:{color:d},title:g||void 0,children:m.text})]})]})}function ou({group:e,first:t,last:n,open:r,onToggle:i}){let{locale:a,t:o}=z(),s=B.role[e.r.role]??B.inkFaint,c=He(e.r.tone),l=Il(e,o,a);return(0,J.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${n?`animate-appear`:``}`,"data-feed-group":e.action,"data-open":r?`true`:`false`,children:[(0,J.jsxs)(`div`,{className:`relative flex justify-center`,children:[t?null:(0,J.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),n?null:(0,J.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,J.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:s,boxShadow:`0 0 0 1px ${s}55`}})]}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":r,title:o(r?`stream.fold.collapse`:`stream.fold.expand`),className:`block w-full rounded text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-blue-sky`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:s},title:e.r.label,children:e.r.label}),(0,J.jsx)(`span`,{className:`text-xs`,style:{color:c},children:e.r.glyph}),(0,J.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-ink-faint`,children:e.calls}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})}),(0,J.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:Ct(e.latest)})]}),(0,J.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5`,style:{color:c},children:l})]}),r?(0,J.jsx)(`div`,{className:`mt-1 border-l border-line/50`,children:e.steps.map((t,n)=>(0,J.jsx)(au,{ev:t.ev,r:t.r,first:n===0,last:n===e.steps.length-1,latest:t.latest,repeat:t.repeat,status:t.status,result:t.result},t.key))}):null]})]})}function su({rows:e}){let[t,n]=(0,G.useState)(()=>new Set),r=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,J.jsx)(J.Fragment,{children:e.map((n,i)=>n.kind===`group`?(0,J.jsx)(ou,{group:n,first:i===0,last:i===e.length-1,open:t.has(n.key),onToggle:()=>r(n.key)},n.key):(0,J.jsx)(au,{ev:n.ev,r:n.r,first:i===0,last:i===e.length-1,latest:n.latest,repeat:n.repeat,status:n.status,result:n.result},n.key))})}function cu({ev:e,r:t,artifacts:n,onOpenArtifact:r}){let{t:i,locale:a}=z(),o=String(e.type)===`ui.operator`,s=!o&&e.mission_result===!0,c=s&&typeof e.text==`string`?e.text:t.text,l=s?Zc(c,a):null,u=s?Tt(e):null,d=o?io(t.text):null,f=d?.refs??[],p=d&&f.length?d.text:t.text,m=o?[]:Jl(e.steps),h=Number(e.response_latency_ms??0),g=!o&&h>=100?` · ${(h/1e3).toFixed(1)}s`:``,_=(0,G.useRef)(null);return it(_,(e,t)=>{_.current&&(t||e.fromTo(_.current,{autoAlpha:0,x:o?12:0,y:o?0:8},{autoAlpha:1,x:0,y:0,duration:.28,ease:`power2.out`,clearProps:`transform,opacity,visibility`}))}),(0,J.jsx)(`article`,{ref:_,"data-task-receipt":s||void 0,"data-task-receipt-id":s?String(e.message_id||e.event_id||``):void 0,className:`conversation-row group mx-auto w-full max-w-full px-4 py-3 sm:px-6 lg:max-w-[61.8vw]`,children:o?(0,J.jsxs)(`div`,{className:`flex items-end justify-end gap-2`,children:[(0,J.jsx)(Qe,{text:t.text,label:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,J.jsx)(`time`,{className:`shrink-0 pb-1 font-mono text-[10px] tabular-nums text-ink-faint`,children:Ct(e)}),(0,J.jsxs)(`div`,{className:`max-w-[calc(100%_-_3rem)] rounded-[18px] bg-conversation-user px-4 py-2.5 text-[15px] leading-relaxed text-ink ring-1 ring-line/35 sm:max-w-[82%]`,children:[f.length?(0,J.jsx)(`div`,{className:`mb-2 space-y-2`,children:f.map((e,t)=>(0,J.jsxs)(`blockquote`,{"aria-label":a===`zh-CN`?`引用`:`Reference`,className:`border-l-2 border-blue/40 pl-3 text-sm text-ink-dim`,children:[(0,J.jsxs)(`div`,{className:`text-xs text-ink-faint`,children:[a===`zh-CN`?`引用`:`Reference`,e.part?` · ${a===`zh-CN`?`第 ${e.part} 部分`:`Part ${e.part}`}`:``]}),(0,J.jsx)(`div`,{className:`font-medium`,children:e.task_title||e.step_title||e.task_id}),e.task_title&&e.step_title&&e.step_title!==e.task_title?(0,J.jsx)(`div`,{children:e.step_title}):null]},`${e.source}:${e.task_id}:${e.step_id}:${t}`))}):null,p?(0,J.jsx)(H,{artifacts:n,onOpenArtifact:r,children:p}):null]})]}):(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center`,children:(0,J.jsx)(At,{size:26,className:`text-ink`})}),(0,J.jsxs)(`div`,{className:`relative min-w-0 flex-1 text-[15px] leading-relaxed text-ink`,children:[(0,J.jsxs)(`div`,{"data-task-receipt-header":s||void 0,className:s?`sticky -top-1.5 z-10 mb-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 bg-panel py-1`:`mb-1 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-blue`,children:te().name}),s?(0,J.jsx)(`span`,{className:`text-[11px] text-ink-dim`,children:a===`zh-CN`?`任务回报 · 当时记录`:`Task report · Recorded then`}):null,(0,J.jsx)(Qe,{text:c,label:l?a===`zh-CN`?`复制原始回报`:`Copy original report`:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`ml-auto opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,J.jsxs)(`time`,{className:`font-mono text-[10px] tabular-nums text-ink-faint ${s?`basis-full sm:basis-auto`:``}`,dateTime:u?.toISOString(),title:u?.toLocaleString(a,{dateStyle:`full`,timeStyle:`long`}),children:[u?u.toLocaleString(a,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):Ct(e),g]})]}),c?(0,J.jsx)(`div`,{"data-task-receipt-prose":s||void 0,children:(0,J.jsx)(H,{artifacts:n,onOpenArtifact:r,children:l?.text??c})}):null,m.length||e.live===!0?(0,J.jsx)(nu,{steps:m,live:e.live===!0,startedTs:Number(e.ts),status:e.success===!1?`failed`:String(e.status??``)}):null,l?(0,J.jsx)(ft,{className:`task-receipt-original`,label:a===`zh-CN`?`查看原始回报(含技术记录)`:`View original report (including technical records)`,children:(0,J.jsx)(`pre`,{"data-task-receipt-original":!0,className:`mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs text-ink-dim`,children:c})}):null]})]})})}function lu({role:e,rows:t,open:n,active:r,onToggle:i}){let{t:a,locale:o}=z(),s=B.role[e],c=(0,G.useRef)(null),l=(0,G.useRef)(!0),u=(0,G.useRef)(0),[d,f]=(0,G.useState)(!1),p=t[t.length-1]?.r.text.length??0,m=(0,G.useMemo)(()=>Fl(t,o),[t,o]),h=m.length?Ll(m[m.length-1],a,o):``;return(0,G.useEffect)(()=>{n&&!l.current&&c.current&&(c.current.scrollTop=u.current)},[n]),(0,G.useEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{l.current&&c.current&&(c.current.scrollTop=c.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[n,t.length,p]),(0,J.jsxs)(`section`,{className:`role-log-group border-b border-line/50`,"data-role":e,"data-open":n?`true`:`false`,"data-active":r?`true`:`false`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":n,className:`group flex h-11 w-full items-center gap-2 px-4 text-left transition-colors hover:bg-bg/60`,children:[(0,J.jsx)(`span`,{"data-role-dot":e,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:s}}),(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink-dim`,children:zn(e,a)}),(0,J.jsx)(`span`,{className:`font-mono text-xs text-ink-faint`,children:m.length}),h?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:h}):(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${n?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),n?(0,J.jsx)(`div`,{className:`grid grid-rows-[1fr]`,children:(0,J.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden`,children:[(0,J.jsx)(`div`,{ref:c,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollTop,l.current=t.scrollHeight-t.scrollTop-t.clientHeight<=2,f(!l.current)},className:`max-h-72 overflow-x-hidden overflow-y-auto border-t border-line/40 scroll-thin`,children:m.length>0?(0,J.jsx)(su,{rows:m}):(0,J.jsx)(`div`,{className:`px-4 py-3 text-xs text-ink-faint`,children:a(`stream.noLogs`)})}),d?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{l.current=!0,f(!1),c.current&&(c.current.scrollTop=c.current.scrollHeight)},className:`absolute bottom-2 right-3 rounded-full border border-line/60 bg-panel px-3 py-1 text-xs text-ink-dim shadow-glow hover:text-ink`,children:[`↓ `,a(`stream.jumpToLatest`)]}):null]})}):null]})}function uu(e){let t={manager:[],planner:[],engineer:[],reviewer:[]},n=[];return e.forEach(e=>{et.includes(e.r.role)?t[e.r.role].push(e):n.push(e)}),{roleRows:t,systemRows:n,lastRole:[...e].reverse().find(e=>et.includes(e.r.role))?.r.role??``}}function du({rows:e}){let{t,locale:n}=z(),[r,i]=(0,G.useState)(!1),a=(0,G.useMemo)(()=>Fl(e,n),[e,n]);return(0,J.jsxs)(`section`,{className:`border-b border-line/50`,"data-system-open":r?`true`:`false`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex h-10 w-full items-center gap-2 px-4 text-left text-xs text-ink-faint hover:bg-bg/60`,children:[(0,J.jsx)(`span`,{children:t(`stream.system`)}),(0,J.jsx)(`span`,{className:`font-mono`,children:a.length}),(0,J.jsx)(`span`,{className:`flex-1`}),(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,J.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),r?(0,J.jsx)(`div`,{className:`border-t border-line/40`,children:(0,J.jsx)(su,{rows:a})}):null]})}function fu({rows:e,live:t,followLatest:n,activeRole:r,activeTaskId:i}){let{roleRows:a,systemRows:o,lastRole:s}=(0,G.useMemo)(()=>uu(e),[e]),[c,l]=(0,G.useState)(()=>new Set(n&&s?[s]:[])),u=(0,G.useRef)(!1);return(0,G.useEffect)(()=>{!n||!s||u.current||l(new Set([s]))},[s,n]),(0,J.jsxs)(`div`,{className:`bg-bg/25`,children:[et.map(e=>(0,J.jsx)(lu,{role:e,rows:a[e],open:c.has(e),active:t&&(r??s)===e&&(!i||a[e].some(e=>ri(e.ev)===i)),onToggle:()=>{u.current=!0,l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}},e)),o.length>0?(0,J.jsx)(du,{rows:o}):null]})}function pu(e){let t=e.delivery;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.delivery_id!=`string`||!n.delivery_id.trim()?null:n}function mu(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.type===`ui.operator`)return null;let r=pu(n);if(r)return r}}function hu({delivery:e,onOpen:t}){let{t:n}=z(),r=e.kind===`submission_certified`;return(0,J.jsxs)(`aside`,{className:`mx-auto my-3 flex w-full max-w-full gap-3 rounded-lg border border-ok/35 bg-ok/5 px-4 py-3 lg:max-w-[61.8vw]`,children:[(0,J.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-ok/15 font-semibold text-ok`,children:`✓`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-ok`,children:n(r?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,J.jsx)(`div`,{className:`mt-1 truncate text-sm font-semibold text-ink`,title:e.title,children:e.title}),t?(0,J.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`mt-2 rounded border border-ok/40 px-2 py-1 font-mono text-[10px] text-ok hover:border-ok hover:bg-ok/10`,children:n(e.primary_target?`mission.openResult`:`mission.viewTask`)}):null]})]})}function gu({group:e,artifacts:t,onOpenArtifact:n,onOpenDelivery:r}){let i=e=>e.ev.type===`ui.argus`&&/^(info:|operation cancelled|cancelled\b)/i.test(e.r.text.trim()),a=e.rows.filter(e=>e.ev.type===`ui.argus`).map(e=>{if(e.ev.mission_result===!0)return{reply:e,messages:[]};let t=e.r.text.match(iu)??[],n=e.r.text.replace(iu,``).trim(),r=e.ev.live===!0||Array.isArray(e.ev.steps)&&e.ev.steps.length>0;return{reply:(n||r)&&!i(e)?{...e,r:{...e.r,text:n}}:null,messages:i(e)&&t.length===0?[e.r.text]:t}}),o=a.flatMap(e=>e.reply?[e.reply]:[]),s=a.flatMap(e=>e.messages),c=(()=>{let t=new Set;return e.rows.flatMap(e=>{let n=pu(e.ev);return!n||t.has(n.delivery_id)?[]:(t.add(n.delivery_id),[n])})})();return(0,J.jsxs)(`section`,{className:`conversation-thread border-b border-line/60`,children:[(0,J.jsx)(cu,{ev:e.operator.ev,r:e.operator.r,artifacts:t,onOpenArtifact:n}),o.map(e=>(0,J.jsx)(cu,{ev:e.ev,r:e.r,artifacts:t,onOpenArtifact:n},e.key)),s.map((t,n)=>(0,J.jsx)(`div`,{className:`mx-auto w-full max-w-full px-6 py-1.5 text-center text-xs text-ink-faint lg:max-w-[61.8vw]`,children:t},`${e.key}-system-${n}`)),c.map(e=>(0,J.jsx)(hu,{delivery:e,onOpen:r},e.delivery_id))]})}function _u({events:e,connected:t,showReasoning:n,onToggleReasoning:r,embedded:i=!1,showHeader:a=!0,filter:o=`all`,query:s=``,skipFirst:c=0,artifacts:l,onOpenArtifact:u,onOpenDelivery:d,snapshot:f,missionView:p,historyStatus:m=`ready`,historyRefreshing:h=!1,onRetryHistory:g}){let{locale:_,t:v}=z(),[y,b]=(0,G.useState)(!0),x=(0,G.useRef)(!0),S=(0,G.useRef)(0),[C,w]=(0,G.useState)(()=>Date.now()),T=(0,G.useRef)(null),E=(0,G.useRef)(null),D=(0,G.useDeferredValue)(e),O=(0,G.useMemo)(()=>f?ci(f,p,D):null,[D,p,f]),k=t&&(!f||O?.state===`running`),A=(0,G.useMemo)(()=>f||!t?null:ai(D),[t,D,f]);(0,G.useEffect)(()=>{if(!A)return;w(Date.now());let e=window.setInterval(()=>w(Date.now()),1e3);return()=>window.clearInterval(e)},[A]);let j=A?Math.max(0,Math.floor((C-Number(A.ts??0)*1e3)/1e3)):0,M=(0,G.useMemo)(()=>al(c>0?D.slice(c):D,{locale:_,showReasoning:n,filter:o,query:s}),[D,n,o,s,c,_]),ee=(0,G.useMemo)(()=>{let e=[],t=[],n=[],r=null;M.list.forEach(i=>{i.ev.type===`ui.operator`?(r={key:i.key,operator:i,rows:[]},e.push(r)):i.ev.type===`ui.argus`?r?r.rows.push(i):t.push(i):n.push(i)});let i=new Set(M.list.filter(e=>e.ev.type===`ui.argus`).map(e=>pu(e.ev)?.delivery_id).filter(Boolean));return{groups:e,earlierReplies:t,projectWork:n,projectDeliveries:n.flatMap(e=>{let t=pu(e.ev);return!t||i.has(t.delivery_id)?[]:(i.add(t.delivery_id),[t])})}},[M.list]),N=(0,G.useMemo)(()=>D.filter(fe).length,[D]),P=(0,G.useMemo)(()=>M.list.slice(-20).reduce((e,t)=>e+t.r.text.length,0),[M.list]);return(0,G.useEffect)(()=>{if(!y)return;let e=window.requestAnimationFrame(()=>{x.current&&T.current&&(T.current.scrollTop=T.current.scrollHeight,S.current=T.current.scrollTop)});return()=>window.cancelAnimationFrame(e)},[M.list.length,P,y]),(0,G.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<40;x.current=t||x.current&&e.scrollTop>=S.current-1,S.current=e.scrollTop,b(x.current)};e.addEventListener(`scroll`,t,{passive:!0});let n=null,r=new ResizeObserver(()=>{x.current&&(n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,x.current&&(e.scrollTop=e.scrollHeight,S.current=e.scrollTop)}))});return r.observe(e),E.current&&r.observe(E.current),()=>{e.removeEventListener(`scroll`,t),r.disconnect(),n!==null&&window.cancelAnimationFrame(n)}},[]),(0,J.jsxs)(`section`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden bg-panel ${i?``:`rounded-lg border border-line/80`}`,children:[a&&(0,J.jsx)(U,{title:v(`panel.activity`),right:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[ee.projectWork.length>0?(0,J.jsx)(`button`,{type:`button`,onClick:()=>{x.current=!1,b(!1),T.current?.scrollTo({top:0,behavior:`auto`})},className:`rounded px-1.5 py-0.5 text-xs text-blue-sky hover:bg-bg`,children:_===`zh-CN`?`查看工作进展`:`View work progress`}):null,(0,J.jsxs)(`button`,{onClick:r,className:`rounded px-1.5 py-0.5 text-xs transition-colors ${n?`text-blue-sky`:`text-ink-faint hover:text-ink-dim`}`,title:v(`stream.toggleReasoning`),children:[v(`stream.reasoning`),N?` ·${N}`:``]}),(0,J.jsx)(`span`,{className:`text-xs ${t?`text-ok`:`text-ink-faint`}`,children:t?`● ${v(`common.live`)}`:`○ ${v(`common.reconnecting`)}`})]})}),f?(0,J.jsx)(ru,{snapshot:f,view:p,events:D,connected:t,compact:!0}):A?(0,J.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line/60 bg-blue-deep/5 px-4 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-blue-sky`}),(0,J.jsx)(`span`,{className:`truncate`,children:v(`stream.backgroundWork`)}),(0,J.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono tabular-nums text-ink-faint`,children:[j,`s`]})]}):null,m===`ready`?null:(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 px-4 py-3 text-sm text-ink-faint`,role:m===`error`?`alert`:`status`,"data-conversation-history":m,children:[(0,J.jsx)(`span`,{children:v(m===`error`?`stream.historyError`:`stream.historyLoading`)}),m===`error`&&g?(0,J.jsx)(`button`,{type:`button`,onClick:g,disabled:h,className:`shrink-0 rounded px-2 py-1 text-blue-sky hover:bg-bg disabled:opacity-50`,children:v(`stream.historyRetry`)}):null]}),(0,J.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto pb-6 pt-1.5 scroll-thin`,"aria-busy":m===`loading`,children:(0,J.jsx)(`div`,{ref:E,className:`flow-root`,"data-event-stream-content":!0,children:M.list.length===0?m===`ready`?(0,J.jsx)($e,{children:v(`stream.ready`)}):null:(0,J.jsxs)(J.Fragment,{children:[ee.projectWork.length>0?(0,J.jsxs)(`section`,{"data-project-work":!0,className:`mx-auto w-full max-w-full border-b border-line/60 lg:max-w-[61.8vw]`,children:[(0,J.jsxs)(`div`,{className:`flex h-10 items-center gap-2 border-b border-line/40 px-4 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink-faint`,children:[_===`zh-CN`?`项目工作进展`:`Project work progress`,(0,J.jsx)(`span`,{className:`font-mono font-normal tracking-normal`,children:ee.projectWork.length})]}),(0,J.jsx)(fu,{rows:ee.projectWork,live:k,followLatest:!0,activeRole:O?.role,activeTaskId:O?.taskId}),ee.projectDeliveries.map(e=>(0,J.jsx)(hu,{delivery:e,onOpen:d},e.delivery_id))]},`project-work`):null,ee.earlierReplies.map(e=>(0,J.jsx)(cu,{ev:e.ev,r:e.r,artifacts:l,onOpenArtifact:u},e.key)),ee.groups.map(e=>(0,J.jsx)(gu,{group:e,artifacts:l,onOpenArtifact:u,onOpenDelivery:d},e.key))]})})}),!y&&(0,J.jsx)(`button`,{onClick:()=>{x.current=!0,b(!0),T.current&&(T.current.scrollTo({top:T.current.scrollHeight,behavior:`auto`}),S.current=T.current.scrollTop)},"aria-label":v(`stream.jumpToLatest`),title:v(`stream.jumpToLatest`),className:`absolute bottom-4 left-1/2 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-line/60 bg-panel text-sm text-ink-dim shadow-glow transition-all duration-200 hover:border-ink-faint hover:text-ink`,children:`↓`})]})}function vu(e){return e.nativeEvent.isComposing||e.keyCode===229}var yu=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function bu(e){return yu[e%yu.length]}var xu=[{id:`status`,name:`/status`,argument:`none`,desc:`roles, queued work, journal, and health`,group:`Everyday`,kind:`panel`},{id:`roles`,name:`/roles`,argument:`none`,desc:`per-role backend / model / effort + live activity`,group:`Everyday`,kind:`panel`},{id:`journal`,name:`/journal`,arg:`[N]`,argument:`optional`,desc:`recent journal entries (default 10)`,group:`Everyday`,kind:`panel`},{id:`backlog`,name:`/backlog`,arg:`[all]`,argument:`optional`,desc:`pending tasks (all = incl. done/skipped)`,group:`Everyday`,kind:`panel`},{id:`artifacts`,name:`/artifacts`,argument:`none`,desc:`result files the Reviewer has checked (Enter previews)`,group:`Everyday`,kind:`panel`},{id:`artifact`,name:`/artifact`,arg:``,argument:`required`,desc:`preview one reviewed result file`,group:`Everyday`,kind:`panel`},{id:`events`,name:`/events`,arg:`[filter] [query]`,argument:`optional`,desc:`search feed: all / watch / milestones / messages`,group:`Everyday`,kind:`panel`},{id:`find`,name:`/find`,arg:``,argument:`required`,desc:`search the current event buffer`,group:`Everyday`,kind:`panel`},{id:`cancel`,name:`/cancel`,argument:`none`,desc:`stop waiting for the current Manager reply`,group:`Everyday`,kind:`local`},{id:`ask`,name:`/ask`,arg:``,argument:`required`,desc:`answer inline — no task queued, no Planner/Engineer/Reviewer`,aliases:[`/chat`],group:`Everyday`,kind:`action`},{id:`crystalpilot`,name:`/crystalpilot`,arg:`[status|off|use ]`,argument:`optional`,desc:`enable crystallography tools in this Argus conversation`,group:`Everyday`,kind:`action`},{id:`task`,name:`/task`,arg:``,argument:`required`,desc:`queue work directly`,aliases:[`/add`],group:`Task management`,kind:`action`},{id:`plan`,name:`/plan`,arg:``,argument:`required`,desc:`preview a Planner-authored execution plan`,group:`Task management`,kind:`action`},{id:`rewrite`,name:`/rewrite`,arg:`[text]`,argument:`optional`,desc:`let the Manager rewrite your prompt before sending`,aliases:[`/refine`],group:`Task management`,kind:`action`},{id:`nudge`,name:`/nudge`,arg:``,argument:`required`,desc:`inject guidance into the running mission`,aliases:[`/inject`,`/notify`],group:`Task management`,kind:`action`},{id:`abort`,name:`/abort`,argument:`none`,desc:`immediately stop the running mission`,group:`Task management`,kind:`action`},{id:`note`,name:`/note`,arg:``,argument:`required`,desc:`append a manual note to the timeline`,group:`Task management`,kind:`action`},{id:`done`,name:`/done`,arg:``,argument:`required`,desc:`mark a task done`,group:`Task management`,kind:`action`},{id:`skip`,name:`/skip`,arg:``,argument:`required`,desc:`skip a task`,aliases:[`/rm`],group:`Task management`,kind:`action`},{id:`stop`,name:`/stop`,arg:``,argument:`required`,desc:`stop a task's auto-iteration`,group:`Task management`,kind:`action`},{id:`item`,name:`/item`,arg:``,argument:`required`,desc:`inspect a full task contract`,group:`Task management`,kind:`panel`},{id:`run`,name:`/run`,argument:`none`,desc:`return to the always-live mission feed`,group:`Task management`,kind:`local`},{id:`new`,name:`/new`,arg:`[objective]`,argument:`optional`,desc:`review, create, and switch to a fresh conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`daemons`,name:`/daemons`,arg:`[query]`,argument:`optional`,desc:`find every session + switch or create`,group:`Sessions & diagnostics`,kind:`panel`},{id:`resume`,name:`/resume`,arg:`[list|]`,argument:`optional`,desc:`switch to another project/session`,group:`Sessions & diagnostics`,kind:`action`},{id:`attach`,name:`/attach`,arg:``,argument:`required`,desc:`follow another project (read the stream)`,group:`Sessions & diagnostics`,kind:`action`},{id:`rename`,name:`/rename`,arg:``,argument:`required`,desc:`rename the current conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`doctor`,name:`/doctor`,argument:`none`,desc:`diagnose 'why isn't anything running'`,group:`Sessions & diagnostics`,kind:`panel`},{id:`backend`,name:`/backend`,arg:`[codex|claude|copilot|cursor|opencode|pi|grok|qoder|dsh]`,argument:`optional`,desc:`view or change the shared runner backend`,group:`Configuration`,kind:`action`},{id:`config`,name:`/config`,arg:`[key=value …]`,argument:`optional`,desc:`view or change runtime settings`,group:`Configuration`,kind:`panel`},{id:`identity`,name:`/identity`,arg:`[set ]`,argument:`optional`,desc:`view or replace the operator identity card`,group:`Configuration`,kind:`panel`},{id:`reset`,name:`/reset`,argument:`none`,desc:`drop the warm Manager conversation context`,group:`Configuration`,kind:`action`},{id:`skills`,name:`/skills`,arg:`[ls|promote ]`,argument:`optional`,desc:`inspect or promote runtime skills`,group:`Configuration`,kind:`action`},{id:`clear`,name:`/clear`,argument:`none`,desc:`clear the event feed view`,group:`Other`,kind:`local`},{id:`reconnect`,name:`/reconnect`,argument:`none`,desc:`reconnect the live event stream`,group:`Other`,kind:`local`},{id:`help`,name:`/help`,argument:`none`,desc:`keys + full command reference`,aliases:[`/?`,`/commands`],group:`Other`,kind:`local`},{id:`quit`,name:`/quit`,argument:`none`,desc:`leave the cockpit (background work keeps running)`,aliases:[`/exit`,`/q`],group:`Other`,kind:`local`}];new Map(xu.map(e=>[e.id,e]));var Su=new Map;for(let e of xu)for(let t of[e.name,...e.aliases??[]])Su.set(t.toLowerCase(),e);function Cu(e){return e.argument===`required`}var wu=/^\/[A-Za-z0-9_-]+$/;function Tu(e){if(!e.startsWith(`/`))return!1;let t=e.indexOf(` `),n=t===-1?e:e.slice(0,t);return wu.test(n)}function Eu(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.slice(1).includes(`/`)}function Du(e){if(!Eu(e))return[];let t=e.toLowerCase(),n=new Set,r=[];for(let e of xu)[e.name,...e.aliases??[]].some(e=>e.toLowerCase().startsWith(t))&&!n.has(e.name)&&(n.add(e.name),r.push(e));return r.sort((e,n)=>Number(Ou(n,t))-Number(Ou(e,t)))}function Ou(e,t){return[e.name,...e.aliases??[]].some(e=>e.toLowerCase()===t)}function ku(e){return e.arg?`${e.name} `:e.name}function Au(e){let t=e.trim();if(!t)return{filter:`all`,query:``};let[n,...r]=t.split(/\s+/);return n.toLowerCase()===`watch`?{filter:`attention`,query:r.join(` `)}:Fe.includes(n.toLowerCase())?{filter:n.toLowerCase(),query:r.join(` `)}:{filter:`all`,query:t}}function ju(e){if(!Tu(e))return null;let t=e.indexOf(` `),n=(t===-1?e:e.slice(0,t)).toLowerCase(),r=t===-1?``:e.slice(t+1).trim(),i=Su.get(n)??null;return{cmd:i,name:i?i.name:n,rest:r}}function Mu(e){let t=e.toLowerCase(),n=null,r=0;for(let e of Su.keys()){let i=Nu(t,e);i>r&&(r=i,n=Su.get(e).name)}return r>=.6?n:null}function Nu(e,t){return 1-Pu(e,t)/(Math.max(e.length,t.length)||1)}function Pu(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},(e,t)=>[t,...Array(r).fill(0)]);for(let e=0;e<=r;e+=1)i[0][e]=e;for(let a=1;a<=n;a+=1)for(let n=1;n<=r;n+=1)i[a][n]=Math.min(i[a-1][n]+1,i[a][n-1]+1,i[a-1][n-1]+(e[a-1]===t[n-1]?0:1));return i[n][r]}function Fu(e,t=!1,n=!1){return(t||n)&&e.toLowerCase()===`r`}var Iu={Everyday:`常用`,"Task management":`任务管理`,"Sessions & diagnostics":`会话与诊断`,Configuration:`配置`,Other:`其他`},Lu={crystalpilot:`在当前 Argus 会话启用晶体学工具,保持原生界面`,status:`查看角色、队列、日志和健康状态`,roles:`查看各角色的后端、模型、推理强度和实时活动`,journal:`查看近期日志(默认 10 条)`,backlog:`查看待处理任务(all 包含已完成和已跳过)`,artifacts:`查看 Reviewer 批准的结果文件(按 Enter 预览)`,artifact:`预览一个已批准的结果文件`,events:`搜索动态:all / watch / milestones / messages`,find:`搜索当前事件缓冲区`,cancel:`停止等待当前 Manager 回复`,ask:`直接回答,不排任务、不走 Planner/Engineer/Reviewer`,task:`直接加入任务队列`,plan:`预览 Planner 编写的执行计划`,rewrite:`让 Manager 在发送前改写提示词`,nudge:`向正在运行的任务注入指导`,abort:`立即终止正在运行的任务`,note:`向时间线添加手动备注`,done:`将任务标记为完成`,skip:`跳过任务`,stop:`停止任务的自动迭代`,item:`查看完整任务契约`,run:`返回持续更新的任务动态`,new:`检查、创建并切换到新会话`,daemons:`查找全部会话并切换或创建`,resume:`切换到其他项目或会话`,attach:`跟随其他项目并读取其动态`,rename:`重命名当前会话`,doctor:`诊断为什么没有任务运行`,backend:`查看或更改共享 Runner 后端`,config:`查看或更改运行时设置`,identity:`查看或替换操作者身份卡`,reset:`清除 Manager 的热会话上下文`,skills:`查看或提升运行时 Skill`,clear:`清空事件动态视图`,reconnect:`重新连接实时动态`,help:`查看快捷键和完整命令参考`,quit:`离开控制台(后台工作继续运行)`};function Ru(e,t){return t===`zh-CN`?Lu[e.id]:e.id===`reconnect`?`reconnect live activity`:e.desc}function zu(e,t){return t===`zh-CN`?Iu[e.group]:e.group}function Bu(e,t){let n=new Map;for(let r of e){let e=zu(r,t),i=r.aliases?.length?` (= ${r.aliases.join(`, `)})`:``,a=`${r.name}${r.arg?` ${r.arg}`:``}${i}`;n.has(e)||n.set(e,[]),n.get(e).push({label:a,desc:Ru(r,t)})}return[...n.entries()].map(([e,t])=>({group:e,rows:t}))}var Vu=`slash-completion-listbox`;function Hu(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function Uu(e){return`slash-completion-option-${e}`}function Wu({query:e,selected:t,onSelect:n}){let{locale:r,t:i}=z(),a=Du(e);if(a.length===0)return null;let o=a.slice(0,8),s=Hu(t,o.length);return(0,J.jsx)(`div`,{id:Vu,role:`listbox`,"aria-label":i(`slash.suggestions`),className:`slash-completion-menu scroll-thin border-b border-line/40`,children:o.map((e,t)=>(0,J.jsxs)(`button`,{id:Uu(e.id),type:`button`,role:`option`,"aria-selected":t===s,onPointerDown:e=>{e.preventDefault(),n(t)},className:`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm transition-colors ${t===s?`bg-blue/10 text-ink`:`text-ink-dim hover:bg-line/20`}`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-blue`,children:e.name}),e.arg?(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-ink-faint`,children:e.arg}):null,(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:Ru(e,r)})]},e.id))})}var Gu=32e3,Ku=10485760,qu=26214400,Ju=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.pdf`,`.md`,`.markdown`,`.txt`,`.json`,`.csv`].join(`,`),Yu={".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".webp":`image/webp`,".pdf":`application/pdf`,".md":`text/markdown`,".markdown":`text/markdown`,".txt":`text/plain`,".json":`application/json`,".csv":`text/csv`};function Xu(e){let t=String(e||``).trim().toLowerCase(),n=t.lastIndexOf(`.`);return n>=0?t.slice(n):``}function Zu(e){return Yu[Xu(e.name)]||String(e.type||``).split(`;`,1)[0].trim()||`application/octet-stream`}function Qu(e){return Object.hasOwn(Yu,Xu(e.name))}function $u(e){return Zu(e).startsWith(`image/`)}function ed(e){return[e.name,String(e.size),Zu(e),String(e.lastModified??``)].join(`::`)}function td(e,t){let n=[],r=[],i=new Set(e.map(ed)),a=e.reduce((e,t)=>e+Math.max(0,t.size||0),0),o=e.length;for(let e of t){let t=ed(e);if(!i.has(t)){if(i.add(t),!Qu(e)){r.push({code:`unsupported`,fileName:e.name});continue}if(o>=5){r.push({code:`too-many`,limitCount:5});continue}if(e.size>10485760){r.push({code:`too-large`,fileName:e.name,limitBytes:Ku});continue}if(a+e.size>26214400){r.push({code:`too-large-total`,limitBytes:qu});continue}n.push(e),a+=e.size,o+=1}}return{accepted:n,issues:r}}function nd(e){return e?Array.from(e):[]}function rd(e){return nd(e?.types).map(e=>String(e)).includes(`Files`)||id(e).length>0}function id(e){let t=nd(e?.files).filter(e=>e instanceof File);if(t.length)return t;let n=[];for(let t of nd(e?.items)){if(String(t?.kind||``)!==`file`||typeof t?.getAsFile!=`function`)continue;let e=t.getAsFile();e instanceof File&&n.push(e)}return n}function ad({file:e,removeLabel:t,onRemove:n,disabled:r=!1}){let[i,a]=(0,G.useState)(``);return(0,G.useEffect)(()=>{if(!$u(e)||typeof URL>`u`||typeof URL.createObjectURL!=`function`){a(``);return}let t=URL.createObjectURL(e);return a(t),()=>URL.revokeObjectURL(t)},[e]),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-2xl border border-line/50 bg-panel/80 px-2.5 py-2 text-xs shadow-[0_10px_24px_-20px_rgb(0_0_0/0.2)]`,children:[i?(0,J.jsx)(`img`,{src:i,alt:``,className:`h-10 w-10 shrink-0 rounded-xl border border-line/40 object-cover`}):null,(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate font-medium text-ink`,title:e.name,children:e.name}),(0,J.jsxs)(`div`,{className:`truncate text-ink-faint`,children:[yt(e.size),` · `,Zu(e)]})]}),(0,J.jsx)(`button`,{type:`button`,onClick:n,disabled:r,"aria-label":t,title:t,className:`send-control h-8 w-8 shrink-0 rounded-full border-line/60 text-ink-faint hover:border-err/50 hover:bg-err/10 hover:text-err`,children:`×`})]})}function od({value:e,onChange:t,inputRef:n,fileInputRef:r,onFiles:i,inputProps:a,onSend:o,onCancel:s,pending:c,disabled:l=!1,controls:u}){let{t:d,locale:f}=z(),p=f===`zh-CN`,{refs:m,text:h}=io(e),g=e.length>Gu;return(0,G.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.getClientRects().length&&(e.style.height=`0px`,e.style.height=`${Math.min(132,Math.max(28,e.scrollHeight))}px`)};t();let r=e.clientWidth,i=new ResizeObserver(()=>{e.clientWidth!==r&&(r=e.clientWidth,t())});return i.observe(e),()=>i.disconnect()},[n,h]),(0,J.jsxs)(`div`,{className:`composer-surface`,"data-pending":c,children:[m.length>0&&(0,J.jsx)(`div`,{className:`map-reference-chips`,children:m.map((e,n)=>(0,J.jsxs)(`span`,{children:[(0,J.jsxs)(`span`,{children:[p?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":p?`移除引用`:`Remove reference`,onClick:()=>t(m.filter((e,t)=>t!==n).map(ro).join(``)+h),children:(0,J.jsx)(Je,{size:12})})]},`${e.task_id}:${e.step_id}:${n}`))}),(0,J.jsxs)(`form`,{className:`map-composer`,onSubmit:e=>{e.preventDefault(),!c&&!l&&!g&&o()},children:[(0,J.jsx)(`input`,{ref:r,type:`file`,multiple:!0,accept:Ju,hidden:!0,disabled:l||c,onChange:i}),(0,J.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":d(`chat.attach`),title:d(`chat.attach`),disabled:l||c,onClick:()=>r.current?.click(),children:(0,J.jsx)(un,{size:19,strokeWidth:1.6})}),(0,J.jsx)(`textarea`,{...a,ref:n,rows:1,value:h,disabled:l,onChange:e=>t(m.map(ro).join(``)+e.target.value),onKeyDown:e=>{if(g&&e.key===`Enter`&&!e.shiftKey&&!vu(e)){e.preventDefault();return}a.onKeyDown?.(e),!(e.defaultPrevented||vu(e))&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),!c&&!l&&o())}}),(0,J.jsx)(`button`,{type:c?`button`:`submit`,onClick:c?s:void 0,disabled:l||!c&&(!h.trim()||g),"aria-label":c?p?`停止回复`:`Stop reply`:p?`发送消息`:`Send message`,className:`map-send ${c?`is-pending`:``}`,children:c?(0,J.jsx)(gn,{size:15}):(0,J.jsx)(Ht,{size:20})})]}),g&&(0,J.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:d(`chat.messageTooLong`)}),u?(0,J.jsx)(`div`,{className:`composer-controls`,children:u}):null]})}var sd=[`auto`,`task`,`chat`];function cd({value:e,onChange:t,disabled:n=!1,tabIndex:r}){let{t:i}=z(),a={auto:i(`chat.routeAuto`),task:i(`chat.routeTask`),chat:i(`chat.routeChat`)};return(0,J.jsx)(`div`,{className:`route-seg`,role:`radiogroup`,"aria-label":i(`chat.routeLabel`),title:i(`chat.routeHint`),children:sd.map(i=>(0,J.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===i,disabled:n,tabIndex:r,onClick:()=>{i!==e&&t(i)},children:a[i]},i))})}function ld(e,t){if(!t.onRewrite||!Fu(e.key,e.ctrlKey,e.metaKey))return!1;e.preventDefault();let n=t.value.trim();return n&&!t.disabled&&!t.pending&&!t.rewriting&&t.onRewrite(n),!0}function ud({value:e,onChange:t,onSend:n,onCancel:r,disabled:i,pending:a,focusSignal:o,attachments:s,onAttachmentsChange:c,onRewrite:l,rewriting:u=!1,slashSelection:d,onSlashSelectionChange:f,routeOverride:p=`auto`,onRouteOverrideChange:m,footer:h}){let{t:g}=z(),_=(0,G.useRef)(null),v=(0,G.useRef)(null),y=(0,G.useRef)(!1),[b,x]=(0,G.useState)(0),[S,C]=(0,G.useState)(!1),[w,T]=(0,G.useState)(``),[E,D]=(0,G.useState)(0),[O,k]=(0,G.useState)(!1),[A,j]=(0,G.useState)(!1);(0,G.useEffect)(()=>{a||j(!1)},[a]),(0,G.useEffect)(()=>{if(!a&&!u)return;let e=setInterval(()=>x(e=>e+1),1e3);return()=>clearInterval(e)},[a,u]),(0,G.useEffect)(()=>{o&&!i&&_.current?.focus()},[o,i]);let M=Du(e).slice(0,8),ee=M.length>0&&!S,N=ee?Hu(d,M.length):0,P=ee?M[N]:void 0,F=e=>{let n=M[e];n&&(t(ku(n)),n.argument===`none`&&C(!0),f(0),_.current?.focus())},te=async()=>{if(!e.trim()||i||u||y.current)return;let t=a;if(t&&s.length){T(g(`chat.attachWhileRunning`));return}y.current=!0;try{(t?await n(e.trim(),[],void 0,{whileRunning:!0}):await n(e.trim(),s))&&(f(0),C(!1),T(``),j(t))}finally{y.current=!1}},ne=e=>{if(!e.length||i||a||y.current)return;let{accepted:t,issues:n}=td(s,e);t.length&&c([...s,...t]),T(n.map(e=>e.code===`unsupported`?g(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?g(`chat.attachTooLarge`,{name:e.fileName,size:yt(e.limitBytes)}):e.code===`too-many`?g(`chat.attachTooMany`,{count:e.limitCount}):g(`chat.attachTotalTooLarge`,{size:yt(e.limitBytes)})).join(` `))},re=(e,t)=>{rd(e.dataTransfer)&&(e.preventDefault(),D(e=>Math.max(0,e+t)))};return(0,J.jsxs)(`div`,{className:`conversation-composer flex flex-col ${E>0?`rounded-3xl ring-2 ring-manager/60`:``}`,"data-compact":!O&&!e.trim()&&!s.length&&!a&&!u&&!w&&!E,onFocusCapture:()=>k(!0),onBlurCapture:e=>k(e.currentTarget.contains(e.relatedTarget)),onDragEnter:e=>re(e,1),onDragOver:e=>re(e,0),onDragLeave:e=>re(e,-1),onDrop:e=>{rd(e.dataTransfer)&&(e.preventDefault(),D(0),ne(id(e.dataTransfer)))},children:[a?(0,J.jsx)(`div`,{className:`px-3 py-2 text-xs text-ink-faint`,role:`status`,children:g(A?`chat.queuedWhileRunning`:`chat.stopWaitingHint`)}):null,ee?(0,J.jsx)(Wu,{query:e,selected:N,onSelect:F}):null,s.length||w||E>0?(0,J.jsxs)(`div`,{className:`px-3 py-2`,children:[E>0?(0,J.jsx)(`div`,{className:`mb-2 text-xs text-manager`,children:g(`chat.attachDrop`)}):null,(0,J.jsx)(`div`,{className:`map-attachment-tray`,children:s.map((e,t)=>(0,J.jsx)(ad,{file:e,removeLabel:g(`chat.attachRemove`,{name:e.name}),onRemove:()=>{c(s.filter(t=>t!==e)),T(``)}},`${e.name}:${e.lastModified}:${t}`))}),(0,J.jsx)(`div`,{className:`text-xs ${w?`text-err`:`text-ink-faint`}`,children:w||g(`chat.attachHint`,{count:5,perFile:yt(10485760),total:yt(26214400)})})]}):null,(0,J.jsx)(od,{value:e,onChange:e=>{t(e),f(0),C(!1)},inputRef:_,fileInputRef:v,onFiles:e=>{ne(Array.from(e.target.files??[])),e.target.value=``},onSend:()=>void te(),onCancel:r,pending:a,disabled:i,inputProps:{onPaste:e=>{let t=id(e.clipboardData);t.length&&(e.preventDefault(),ne(t))},onKeyDown:t=>{vu(t)||ld(t,{value:e,disabled:i,pending:a,rewriting:u,onRewrite:l})||(ee?t.key===`ArrowDown`||t.key===`ArrowUp`?(t.preventDefault(),f(Hu(N+(t.key===`ArrowDown`?1:-1),M.length))):t.key===`Tab`||t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),F(N)):t.key===`Escape`&&(t.preventDefault(),C(!0)):t.key===`Escape`&&a?(t.preventDefault(),r()):t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),te()))},"aria-label":g(`chat.messageArgus`),"aria-keyshortcuts":`Control+R Meta+R`,"aria-controls":ee?Vu:void 0,"aria-expanded":ee,"aria-activedescendant":P?Uu(P.id):void 0,placeholder:g(i?`chat.selectSession`:`chat.placeholder`)},controls:(0,J.jsxs)(J.Fragment,{children:[m?(0,J.jsx)(cd,{value:p,onChange:m,disabled:i||a}):null,l&&e.trim()?(0,J.jsx)(`button`,{type:`button`,onClick:()=>l(e.trim()),disabled:i||a||u,title:`Ctrl/⌘+R · ${g(`chat.rewriteHint`)}`,"aria-label":g(`chat.rewriteLabel`),"aria-keyshortcuts":`Control+R Meta+R`,children:u?`${bu(b)} ${g(`chat.rewriting`)}`:g(`chat.rewrite`)}):null]})}),h]})}function dd(e,t,n,r=`en`){return e.map(e=>({id:`command-${e.id}`,label:Ru(e,r),hint:`${e.name}${e.arg?` ${e.arg}`:``}`,group:zu(e,r),keywords:[e.name,...e.aliases??[]].join(` `),run:()=>Cu(e)?n(`${e.name} `):t(e.name)}))}function fd(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=`${e.label} ${e.group} ${e.hint??``} ${e.keywords??``}`.toLowerCase();return n.every(e=>t.includes(e))}):e}function pd({open:e,onClose:t,items:n}){let{t:r}=z(),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(0),c=(0,G.useRef)(null),l=(0,G.useRef)(null);(0,G.useEffect)(()=>{e&&(a(``),s(0),setTimeout(()=>c.current?.focus(),0))},[e]);let u=(0,G.useMemo)(()=>fd(n,i),[i,n]);(0,G.useEffect)(()=>{o>=u.length&&s(Math.max(0,u.length-1))},[u.length,o]),(0,G.useEffect)(()=>{l.current?.scrollIntoView({block:`nearest`})},[e,i,o]);let d=e=>{e&&(t(),e.run())},f=e=>{vu(e)||(e.key===`ArrowDown`?(e.preventDefault(),u.length&&s(e=>Math.min(u.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),d(u[o])))},p=[];for(let e of u){let t=p.find(t=>t.name===e.group);t||(t={name:e.group,items:[]},p.push(t)),t.items.push(e)}let m=-1;return(0,J.jsxs)(dt,{open:e,onClose:t,label:r(`help.palette`),width:`max-w-xl`,align:`top`,children:[(0,J.jsx)(`div`,{className:`border-b border-line px-4 py-3`,children:(0,J.jsx)(`input`,{ref:c,value:i,onChange:e=>a(e.target.value),onKeyDown:f,placeholder:r(`palette.placeholder`),role:`combobox`,"aria-expanded":e,"aria-autocomplete":`list`,"aria-controls":`command-palette-results`,"aria-activedescendant":u[o]?`palette-${u[o].id}`:void 0,className:`w-full bg-transparent font-mono text-sm text-ink outline-none placeholder:text-ink-faint`})}),(0,J.jsxs)(`div`,{id:`command-palette-results`,role:`listbox`,className:`max-h-[52vh] overflow-y-auto scroll-thin py-1.5`,children:[u.length===0&&(0,J.jsx)(`div`,{className:`px-4 py-6 text-center text-xs text-ink-faint`,children:r(`palette.noMatches`)}),p.map(e=>(0,J.jsxs)(`div`,{className:`mb-1`,children:[(0,J.jsx)(`div`,{className:`px-4 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.name}),e.items.map(e=>{m++;let t=m===o;return(0,J.jsxs)(`button`,{id:`palette-${e.id}`,ref:t?l:void 0,role:`option`,"aria-selected":t,onMouseEnter:()=>s(u.indexOf(e)),onClick:()=>d(e),className:`flex w-full items-center justify-between px-4 py-1.5 text-left text-sm transition-colors ${t?`bg-blue-deep/20 text-ink`:`text-ink-dim hover:bg-panel/60`}`,children:[(0,J.jsx)(`span`,{children:e.label}),e.hint&&(0,J.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:e.hint})]},e.id)})]},e.name))]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-4 py-1.5 text-[10px] text-ink-faint`,children:[(0,J.jsx)(`span`,{children:r(`palette.navigate`)}),(0,J.jsx)(`span`,{children:r(`palette.run`)}),(0,J.jsx)(`span`,{children:r(`palette.close`)})]})]})}var md=[{keys:`⌘K / Ctrl+K`,desc:`help.palette`},{keys:`⌘B / Ctrl+B`,desc:`help.sessions`},{keys:`⌘J / Ctrl+J`,desc:`help.managerChat`},{keys:`⌘R / Ctrl+R`,desc:`help.rewrite`},{keys:`⌘T / Ctrl+T`,desc:`help.reasoning`},{keys:`⌘. / Ctrl+.`,desc:`help.kiosk`},{keys:`/`,desc:`help.composer`},{keys:`↵ Enter`,desc:`help.send`},{keys:`Shift+Enter`,desc:`help.newline`},{keys:`?`,desc:`help.thisHelp`},{keys:`Esc`,desc:`help.escape`}];function hd({open:e,onClose:t}){let{locale:n,t:r}=z(),i=Bu(xu,n);return(0,J.jsxs)(dt,{open:e,onClose:t,label:r(`help.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`help.title`)}),(0,J.jsxs)(`div`,{className:`max-h-[70dvh] overflow-y-auto scroll-thin`,children:[(0,J.jsx)(`div`,{className:`p-4`,children:md.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between py-1.5`,children:[(0,J.jsx)(`span`,{className:`text-sm text-ink-dim`,children:r(e.desc)}),(0,J.jsx)(`kbd`,{className:`rounded border border-line bg-surface px-2 py-0.5 font-mono text-[11px] text-ink`,children:e.keys})]},e.keys))}),(0,J.jsxs)(`div`,{className:`border-t border-line px-4 pb-4 pt-3`,children:[(0,J.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-ink-faint`,children:r(`help.commands`)}),i.map(e=>(0,J.jsxs)(`div`,{className:`mb-4`,children:[(0,J.jsx)(`p`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.group}),e.rows.map(e=>(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1`,children:[(0,J.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-ink`,children:e.label}),(0,J.jsx)(`span`,{className:`text-right text-xs text-ink-dim`,children:e.desc})]},e.label))]},e.group))]})]})]})}var gd=[[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]];function _d({sid:e,config:t,onSaved:n}){let{locale:r}=z(),i=r===`zh-CN`,a=t.roles.find(e=>e.role===`manager`),o=t.roles.find(e=>e.role===`engineer`),s=a&&a.backend!==`memory`?a:o,c=new Map(t.operator_knobs.map(e=>[e.name,e.value])),l=c.get(`ARGUS_SKILL_MAP_MODEL`)||`auto`,[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(``),m=(t.model_options??[]).map(e=>e.model);l!==`auto`&&!m.includes(l)&&m.unshift(l);let h=async(t,r)=>{if(!u){d(!0),p(``);try{await R.setConfig(e,t,r),await n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},g=i?`自动(轻量)`:`Auto (light)`,_=i?`跟随前台模型`:`Follow the front-door model`,v=[{name:`ARGUS_SKILL_MAP_REASONING_EFFORT`,label:i?`讲解生成强度`:`Explanation effort`,follow:g},{name:`ARGUS_SKILL_MAP_REVIEW_REASONING_EFFORT`,label:i?`讲解复核强度`:`Explanation review effort`,follow:i?`自动(中)`:`Auto (medium)`}];return(0,J.jsxs)(`section`,{className:`map-model-settings rounded-lg border border-line glass-card p-3`,"aria-label":i?`地图模型`:`Map model`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:i?`地图模型`:`Map model`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:i?`地图讲解与摘要用的模型;默认沿用前台(经理)的接入与账号,以低强度起草,不占用科研的推理预算。可以选一个便宜的。`:`The model that writes map explanations and summaries. By default it uses the front-door (Manager) runner and account at a light effort, not the research budget. A cheaper one is fine.`}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[s?.backend_label,` · `,s?.model||(i?`接入默认模型`:`Runner default model`)]}),t.map_model?.note&&(0,J.jsx)(`p`,{role:`status`,"data-map-model-note":!0,className:`mt-1 text-xs text-warn`,children:i?`已改用自动:所选摘要模型在当前接入(${t.map_model.backend})下不可用。`:t.map_model.note}),(0,J.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[i?`摘要模型`:`Summary model`,(0,J.jsxs)(`select`,{value:l,disabled:u,"aria-label":i?`摘要模型`:`Summary model`,onChange:e=>void h(`ARGUS_SKILL_MAP_MODEL`,e.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:_}),m.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]}),v.map(e=>(0,J.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[e.label,(0,J.jsxs)(`select`,{value:c.get(e.name)||`auto`,disabled:u,onChange:t=>void h(e.name,t.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:e.follow}),gd.map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:i?t:e},e))]})]},e.name)),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`复核用于检查讲解文字,保存后对新发起的讲解生效。`:`The review checks explanation text. Changes apply to newly requested explanations.`}),f&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:f})]})}function vd({sid:e,primaryModel:t}){let{locale:n}=z(),r=n===`zh-CN`,i=(e,t)=>r?e:t,a=M(),o=A({queryKey:[`advisor-settings`,e],queryFn:({signal:t})=>R.advisorSettings(e,t),enabled:!!e,retry:!1}),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(!1),_=(0,G.useRef)(e);_.current=e,(0,G.useEffect)(()=>{c(o.data?.saved??null);let e=o.data?.saved;u(!!(e?.model&&!o.data?.model_options?.some(t=>t.backend===e.backend&&t.model===e.model)))},[e,o.data]),(0,G.useEffect)(()=>{m(``),g(!1),f(!1)},[e]);let v=e=>{c(t=>t&&{...t,...e}),g(!1)},y=o.data?.model_options??[],b=(e,t)=>JSON.stringify([e,t]),x=s&&y.some(e=>e.backend===s.backend&&e.model===s.model)?b(s.backend,s.model):``,S=async()=>{if(!s||d)return;let t=e;f(!0),m(``),g(!1);try{let{schema_version:e,...n}=s,r=await R.saveAdvisorSettings(t,{...n,model:n.model.trim()});a.setQueryData([`advisor-settings`,t],r),_.current===t&&g(!0)}catch(e){_.current===t&&m(e instanceof Error?e.message:String(e))}finally{_.current===t&&f(!1)}};return(0,J.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,"aria-label":i(`顾问模型`,`Advisor model`),children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`顾问模型`,`Advisor model`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:i(`团队遇到难题时可以向它提问。只在咨询时调用,用量计入当前项目。`,`The team can consult this model on specific questions. It runs only when asked, and usage belongs to this project.`)}),t?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[i(`当前执行模型:`,`Current execution model: `),t]}):null,o.isPending?(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-ink-faint`,children:i(`正在读取设置…`,`Loading settings…`)}):o.isError?(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-err`,role:`alert`,children:[i(`顾问设置读取失败。`,`Could not load advisor settings.`),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void o.refetch(),className:`underline`,children:i(`重试`,`Retry`)})]}):s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:s.enabled,disabled:d,onChange:e=>v({enabled:e.target.checked})}),i(`允许团队咨询顾问`,`Let the team consult the advisor`)]}),(0,J.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[y.length>0?(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim sm:col-span-2`,children:[i(`顾问使用的模型`,`Advisor model`),(0,J.jsxs)(`select`,{"aria-label":i(`选择顾问模型`,`Choose advisor model`),value:l?`custom`:x,disabled:d,onChange:e=>{if(e.target.value===`custom`){u(!0);return}let t=y.find(t=>b(t.backend,t.model)===e.target.value);t&&(u(!1),v({backend:t.backend,model:t.model}))},className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,disabled:!0,children:i(`选择模型`,`Choose a model`)}),y.map(e=>(0,J.jsx)(`option`,{value:b(e.backend,e.model),children:e.model},b(e.backend,e.model))),(0,J.jsx)(`option`,{value:`custom`,children:i(`配置其他模型…`,`Configure another model…`)})]})]}):null,l||y.length===0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`接入`,`Runner`),(0,J.jsxs)(`select`,{"aria-label":i(`顾问接入`,`Advisor runner`),value:s.backend,disabled:d,onChange:e=>v({backend:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:i(`选择接入`,`Choose a runner`)}),o.data?.supported_backends.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`顾问使用的模型`,`Advisor model ID`),(0,J.jsx)(`input`,{value:s.model,disabled:d,onChange:e=>v({model:e.target.value}),placeholder:i(`填写该接入的模型标识`,`Model ID for this runner`),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}):null,(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`思考强度`,`Reasoning effort`),(0,J.jsxs)(`select`,{"aria-label":i(`顾问思考强度`,`Advisor reasoning effort`),value:s.effort,disabled:d,onChange:e=>v({effort:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,J.jsx)(`option`,{value:``,children:i(`模型默认`,`Model default`)}),[[`minimal`,`最低`],[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]].map(([e,t])=>(0,J.jsx)(`option`,{value:e,children:r?t:e},e))]})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`每次角色调用最多咨询`,`Consultations per role call`),(0,J.jsx)(`input`,{type:`number`,min:1,max:20,value:s.max_calls_per_turn,disabled:d,onChange:e=>v({max_calls_per_turn:Number(e.target.value)}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}),o.data?.overridden_fields.length?(0,J.jsxs)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:[i(`运行服务另有指定设置;当前顾问:`,`The runtime overrides some saved settings. Current advisor: `),o.data.config.enabled?`${o.data.config.backend} · ${o.data.config.model}`:i(`未启用`,`disabled`)]}):null,(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void S(),disabled:d||s.enabled&&(!s.backend||!s.model.trim()),className:`rounded border border-line px-3 py-2 text-xs text-ink hover:border-blue disabled:opacity-40`,children:d?i(`保存中…`,`Saving…`):i(`保存顾问设置`,`Save advisor settings`)}),h?(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-dim`,children:i(`已保存,下次咨询生效。`,`Saved for the next consultation.`)}):null]}),p?(0,J.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:p}):null]}):null]})}var yd=[/^\[?\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[.,]\d+)?(?:Z|[+-]\d{2}:?\d{2})?\]?\s*/,/^\[?(?:INFO|WARNING|WARN|ERROR|DEBUG|CRITICAL|TRACE)\]?\s*[:\-|]?\s*/i,/^(?:\[\d+\]|[\w.]+:)\s+/];function bd(e){let t=e.trim();for(let e of yd)t=t.replace(e,``);return t.trim()}var xd=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`;function Sd(e,t=200){let n=String(e??``).split(/\r?\n/).map(bd).filter(e=>e&&!/^[-=_.\s]+$/.test(e));return n.length?xd(n[n.length-1],t):``}var Cd=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function wd(e){if(!e)return[];let t=e.provider??{},n=[],r=Cd(t.completed)??0,i=Cd(t.errors)??0;n.push({key:`calls`,value:String(r+i)}),n.push({key:`failed`,value:String(i)});let a=Cd(t.p95_duration_ms);return a&&a>0&&n.push({key:`slowest`,value:`${(a/1e3).toFixed(1)}s`}),n}var Td=[{name:`ARGUS_SKILL_MAX_ACTIVE_DAEMONS`,group:`Limits`,label:`Active daemon limit`,description:`Maximum background sessions running on this host.`},{name:`ARGUS_SKILL_SAFE_MODE`,group:`Safety`,label:`Safe mode`,description:`Enable extra-conservative runtime guardrails.`},{name:`ARGUS_SKILL_OPERATOR_AVAILABLE`,group:`Safety`,label:`Operator available`,description:`Off suppresses operator questions: Argus decides on recorded assumptions.`},{name:`ARGUS_SKILL_ENABLE_TELEGRAM`,group:`Interface`,label:`Telegram`,description:`Enable the Telegram notification bridge.`},{name:`ARGUS_SKILL_SHOW_REASONING`,group:`Interface`,label:`Show reasoning`,description:`Stream role reasoning into the cockpit activity view.`}];function Ed(e){let t=new Map(e.map(e=>[e.name,e]));return Td.flatMap(e=>{let n=t.get(e.name);return n?[{...n,group:e.group,label:e.label,doc:e.description}]:[]})}function Dd(e,t){let n=new URL(e),r=n.protocol===`https:`?`wss:`:`ws:`,i=encodeURIComponent(t);return{webApi:`${n.origin}/api`,eventStream:`${r}//${n.host}/api/projects/${i}/stream`,daemon:`local process · events.jsonl · no TCP port`}}var Od=`ARGUS_SKILL_OPERATOR_AVAILABLE`,kd=new Set([`0`,`false`,`no`,`off`,`disable`,`disabled`]);function Ad(e){let t=(e??[]).find(e=>e.name===Od);return!!(t&&kd.has(t.value.trim().toLowerCase()))}function jd(e){return e instanceof se?e.code===`trial_route_unavailable`||e.status===403||e.status===404:!1}function Md(e,t){let n=jd(e);return{text:t(n?`operations.unavailableHere`:`operations.requestFailed`),technical:e instanceof Error?e.message:String(e||``),refused:n}}var Nd={ARGUS_SKILL_MAX_ACTIVE_DAEMONS:{label:`settings.knob.activeDaemons`,doc:`settings.knob.activeDaemonsDoc`},ARGUS_SKILL_SAFE_MODE:{label:`settings.knob.safeMode`,doc:`settings.knob.safeModeDoc`},ARGUS_SKILL_OPERATOR_AVAILABLE:{label:`settings.knob.operatorAvailable`,doc:`settings.knob.operatorAvailableDoc`},ARGUS_SKILL_ENABLE_TELEGRAM:{label:`settings.knob.telegram`,doc:`settings.knob.telegramDoc`},ARGUS_SKILL_SHOW_REASONING:{label:`settings.knob.showReasoning`,doc:`settings.knob.showReasoningDoc`}},Pd={Limits:`settings.group.limits`,Safety:`settings.group.safety`,Interface:`settings.group.interface`};function Fd(e,t){let n=e.trim();return n===`not applicable for this model`?t(`settings.source.notApplicable`):n.startsWith(`capability vault`)?t(`settings.source.vaultDefault`):n.startsWith(`default`)?t(`settings.source.default`):n.startsWith(`persisted:`)||n===`persisted`?t(`settings.source.saved`):n.startsWith(`ARGUS_SKILL_`)||n===`env`?t(`settings.source.environment`):n.startsWith(`global:`)?t(`settings.source.hostConfig`):t(`settings.source.other`)}function Id(e,t){let n=e.value.trim().toLowerCase();return[`ARGUS_SKILL_SAFE_MODE`,`ARGUS_SKILL_OPERATOR_AVAILABLE`,`ARGUS_SKILL_ENABLE_TELEGRAM`,`ARGUS_SKILL_SHOW_REASONING`].includes(e.name)?t([`1`,`true`,`on`,`yes`].includes(n)?`settings.value.enabled`:`settings.value.disabled`):e.value}function Ld(e,t){let n={low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`}[e.toLowerCase()];return n?t(`settings.effort.${n}`):e}function Rd({message:e,retrying:t,onRetry:n,t:r}){return(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 px-4 py-8 text-center`,children:[(0,J.jsx)(`p`,{className:`text-sm text-err`,children:e}),(0,J.jsx)(`button`,{type:`button`,onClick:n,disabled:t,className:`rounded-md border border-err/40 px-3 py-1.5 text-xs font-medium text-err hover:bg-err/10 disabled:opacity-40`,children:r(t?`common.loading`:`common.retry`)})]})}function zd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a,isError:o,isFetching:s,refetch:c}=ye(e,t),l=!!(i&&(i.recommended||i.checks.length||i.log_tail.trim()));return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`doctor.title`),width:`max-w-3xl`,children:[(0,J.jsx)(lt,{title:r(`doctor.title`),sub:r(`doctor.subtitle`)}),(0,J.jsxs)(`div`,{className:`p-4`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!a&&o&&(0,J.jsx)(Rd,{message:r(`doctor.loadError`),retrying:s,onRetry:()=>void c(),t:r}),!a&&!o&&!l&&(0,J.jsx)($e,{children:r(`doctor.empty`)}),!a&&!o&&i?.recommended&&(0,J.jsxs)(`div`,{className:`mb-4 rounded-lg border border-gold/40 bg-gold/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-gold`,children:r(`doctor.recommended`)}),(0,J.jsx)(`div`,{className:`mt-1 text-sm text-ink`,children:i.recommended.name}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:i.recommended.detail}),i.recommended.fix&&(0,J.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap break-words rounded bg-bg p-2 font-mono text-xs text-blue-sky`,children:i.recommended.fix})]}),!a&&!o&&(0,J.jsx)(`div`,{className:`space-y-1.5`,children:(i?.checks??[]).map((e,t)=>(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-line/60 px-3 py-2`,children:[(0,J.jsx)(`span`,{className:e.ok?`text-ok`:`text-err`,children:e.ok?`✓`:`✗`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.name}),e.detail&&(0,J.jsx)(`div`,{className:`mt-0.5 text-[11px] text-ink-dim`,children:e.detail}),!e.ok&&e.fix&&(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words rounded bg-bg p-1.5 font-mono text-xs text-ink-dim`,children:e.fix})]})]},t))}),!a&&!o&&i?.log_tail?.trim()&&(0,J.jsxs)(`div`,{className:`mt-4`,children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`doctor.daemonLog`)}),(0,J.jsxs)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:[(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[r(`doctor.lastEntry`),` · `]}),Sd(i.log_tail)]}),(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:i.log_tail})})]})]})]})}function Bd({sid:e,open:t,onClose:n}){let{t:r}=z(),i=M(),{data:a,isLoading:s,isError:c,isFetching:l,refetch:u}=Me(e,t),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(!1),[b,x]=(0,G.useState)(``),[C,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)(``),[k,A]=(0,G.useState)(!1),[j,ee]=(0,G.useState)(``);(0,G.useEffect)(()=>{t||f(!1)},[t]),(0,G.useEffect)(()=>{!t||!a||(m(a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MODEL`)?.value??``),g(``))},[a,t]);let N=async()=>{await u(),await i.invalidateQueries({queryKey:[`map-copy`]})},P=br(a),F=xr(a),te=Sr(a),ne=e=>!e||(te?vr(te)===e:e===vr(P)),re=h||vr(P),ie=async t=>{if(!(_||ne(t))){v(!0),x(``),w(!1);try{await R.setConfig(e,`ARGUS_SKILL_RUNNER_BACKEND`,t),await N(),x(r(`settings.backendSwitched`,{backend:yr(t,r)}))}catch(e){w(!0),x(Md(e,r).text)}finally{v(!1)}}},I=async t=>{if(!_){v(!0),x(``),w(!1);try{await R.setConfig(e,`ARGUS_SKILL_MAP_MODEL`,t||`auto`),await N(),x(t&&t!==`auto`?r(`settings.mapModelSet`,{model:t}):r(`settings.mapModelFollows`))}catch(e){w(!0),x(Md(e,r).text)}finally{v(!1)}}},L=async()=>{if(!_){v(!0),x(``),w(!1);try{let t=p.trim()||`auto`;await R.setConfig(e,`ARGUS_SKILL_MODEL`,t,!0),await N(),x(r(`settings.modelAppliedToRoles`,{model:t}))}catch(e){w(!0),x(Md(e,r).text)}finally{v(!1)}}},ae=async t=>{if(t.preventDefault(),!(!T.trim()||!D.trim()||k)){A(!0),ee(``);try{await R.setConfig(e,T.trim(),D.trim()),await N(),ee(r(`settings.applied`))}catch(e){ee(Md(e,r).text)}finally{A(!1)}}},oe=Ed(a?.operator_knobs??[]).reduce((e,t)=>((e[t.group]??=[]).push(t),e),{}),se=Dd(window.location.origin,e),ce=!!(a&&(a.roles.length||a.operator_knobs.length));return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`common.settings`),width:`max-w-4xl`,children:[(0,J.jsx)(lt,{title:r(`common.settings`),sub:r(`settings.subtitle`)}),(0,J.jsxs)(`div`,{className:`p-4`,children:[s&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!s&&c&&(0,J.jsx)(Rd,{message:r(`settings.loadError`),retrying:l,onRetry:()=>void u(),t:r}),!s&&!c&&!ce&&(0,J.jsx)($e,{children:r(`settings.empty`)}),!s&&!c&&ce&&a&&(0,J.jsxs)(`div`,{className:`space-y-4`,children:[!a.trial_mode&&(0,J.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`settings.quickConfig`)}),(0,J.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.backend`)}),(0,J.jsxs)(`select`,{value:h||vr(P),disabled:_,onChange:e=>g(e.target.value),"aria-label":r(`settings.backend`),className:`h-8 min-w-44 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[vr(P)?null:(0,J.jsx)(`option`,{value:``,disabled:!0,children:P?r(`settings.backendUnsupported`,{backend:P}):r(`settings.backendUnavailable`)}),gr.map(e=>(0,J.jsx)(`option`,{value:e.value,children:r(e.label)},e.value))]}),(0,J.jsx)(`button`,{type:`button`,"data-apply-backend":!0,onClick:()=>{re&&ie(re)},disabled:_||ne(re),className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:r(`settings.applyModel`)}),F&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,"data-backend-source":F,children:r(`settings.backendSource.${F}`)}),!ne(re)&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-dim`,"data-backend-change":!0,children:te?r(`settings.backendWillReplace`,{saved:yr(te,r),backend:yr(re,r)}):r(`settings.backendWillSave`,{backend:yr(re,r)})})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.model`)}),(0,J.jsxs)(`select`,{value:p||`auto`,onChange:e=>m(e.target.value===`auto`?``:e.target.value),"aria-label":r(`settings.model`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,J.jsx)(`option`,{value:`auto`,children:a.model_auto_resolves_to?`auto → ${a.model_auto_resolves_to}`:r(`settings.modelPlaceholder`)}),(()=>{let e=a.model_options??[],t=new Set(e.filter(e=>e.invalid).map(e=>e.model)),n=e.map(e=>e.model),i=p.trim();return i&&i!==`auto`&&!n.includes(i)&&(n.unshift(i),t.add(i)),n.map(e=>(0,J.jsx)(`option`,{value:e,children:t.has(e)?`${e} (${r(`settings.modelUnavailable`)})`:e},e))})()]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void L(),disabled:_,className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:r(`settings.applyModel`)})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:r(`settings.mapModel`)}),(0,J.jsxs)(`select`,{value:a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||`auto`,disabled:_,onChange:e=>void I(e.target.value),"aria-label":r(`settings.mapModel`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[(0,J.jsx)(`option`,{value:`auto`,children:r(`settings.mapModelFollows`)}),(()=>{let e=(a.model_options??[]).map(e=>e.model),t=a.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||``;return t&&t!==`auto`&&!e.includes(t)&&e.unshift(t),e.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))})()]})]}),(a.model_options??[]).some(e=>e.offline)&&(0,J.jsx)(`p`,{className:`mt-1 text-[10px] text-ink-faint`,"data-model-offline":!0,children:r(`settings.modelOfflineList`)}),a.roles.some(e=>e.model&&p.trim()&&e.model!==p.trim())&&(0,J.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-ink-faint`,"data-role-models":!0,children:[r(`settings.rolesRunning`),` `,a.roles.map(e=>`${e.role} · ${e.model||`auto`}`).join(`,`),` — `,r(`settings.applyUnifies`)]}),b&&(0,J.jsx)(`div`,{role:C?`alert`:`status`,className:`mt-1.5 text-[10px] ${C?`text-err`:`text-ink-dim`}`,children:b})]}),a.trial_mode&&(0,J.jsx)(`section`,{className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,"aria-label":r(`settings.trialAccount`),children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:r(`settings.trialAccount`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:`GPT-5.5 · high`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:r(`settings.trialKeyHint`)})]}),Ar()&&(0,J.jsx)(`button`,{type:`button`,className:`compact-control px-3 py-2`,onClick:()=>{n(),jr()},children:r(`settings.changeTrialKey`)})]})}),d&&(0,J.jsx)(_d,{sid:e,config:a,onSaved:N}),d&&(0,J.jsx)(vd,{sid:e,primaryModel:a.roles.find(e=>e.role===`engineer`)?.model}),(0,J.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface/50`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":d,"aria-controls":`config-advanced-settings`,onClick:()=>f(e=>!e),className:`flex w-full items-center justify-between gap-3 px-3 py-3 text-left hover:bg-bg/30`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block text-xs font-semibold text-ink`,children:r(`settings.advanced`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-ink-faint`,children:r(`settings.advancedHint`)})]}),(0,J.jsx)(o,{icon:S,className:`text-xs text-ink-faint transition-transform ${d?`rotate-180`:``}`})]}),d&&(0,J.jsxs)(`div`,{id:`config-advanced-settings`,className:`space-y-4 border-t border-line/70 p-3`,children:[(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`settings.connection`)}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2 text-[10px] sm:grid-cols-[100px_minmax(0,1fr)]`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.webApi`)}),(0,J.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:se.webApi}),(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.eventStream`)}),(0,J.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:se.eventStream}),(0,J.jsx)(`span`,{className:`text-ink-faint`,children:r(`settings.taskDaemon`)}),(0,J.jsx)(`span`,{className:`text-ink-dim`,children:r(`settings.taskDaemonValue`)})]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>void ae(e),className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-blue`,children:r(`settings.overrideTitle`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[10px] text-ink-faint`,children:r(`settings.overrideHint`)}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,J.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:r(`settings.namePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),placeholder:r(`settings.valuePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{disabled:k||!T.trim()||!D.trim(),title:r(`settings.applyAdvanced`),"aria-label":r(`settings.applyAdvanced`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:k?`…`:(0,J.jsx)(o,{icon:y})})]}),j?(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-dim`,children:j}):null]}),a.roles.length>0&&(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(`settings.rolesTitle`)}),(0,J.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:a.roles.map(e=>(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:e.role===`curator`?r(`settings.role.curator`):zn(e.role,r)}),(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.backend_label})]}),(0,J.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px] text-ink-dim`,title:e.model,children:e.model}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:Fd(e.model_source,r)}),e.reasoning_effort&&(0,J.jsx)(`span`,{className:`ml-auto shrink-0`,style:{color:Ze(e.reasoning_effort)},children:Ld(e.reasoning_effort,r)})]}),(gt(e.role)||e.role===`curator`)&&(0,J.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-ink-faint`,children:gt(e.role)?Xe(e.role,r):r(`settings.role.curatorDoc`)})]},e.role))})]}),Object.keys(oe).length>0&&(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(`settings.rawConfig`)}),Object.entries(oe).map(([e,t])=>(0,J.jsxs)(`div`,{className:`mt-3 first:mt-0`,children:[(0,J.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:r(Pd[e])}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-line`,children:t.map((e,t)=>{let n=Nd[e.name],i=Id(e,r);return(0,J.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] ${t?`border-t border-line/60`:``}`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-dim`,children:r(n.label)}),(0,J.jsx)(`code`,{className:`mt-0.5 block break-all text-[9px] text-ink-faint`,children:e.name}),(0,J.jsx)(`div`,{className:`mt-1 text-[10px] leading-relaxed text-ink-faint`,children:r(n.doc)})]}),(0,J.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,J.jsxs)(`div`,{className:`text-[11px] text-ink`,children:[i,i!==e.value&&(0,J.jsxs)(`code`,{className:`ml-1 text-[9px] text-ink-faint`,children:[`(`,e.value,`)`]})]}),(0,J.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Fd(e.source,r)})]})]},e.name)})})]},e))]}),(0,J.jsxs)(`p`,{className:`text-[10px] text-ink-faint`,children:[r(`settings.footer`),` `,(0,J.jsx)(`code`,{children:`argus --config-help`}),`.`]})]})]})]})]})]})}function Vd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a,refetch:s}=be(e,t),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(``);(0,G.useEffect)(()=>{t&&i!=null&&l(i)},[i,t]);let h=async()=>{if(!u){d(!0),m(``);try{await R.setIdentity(e,c),await s(),m(r(`identity.saved`))}catch(e){m(Md(e,r).text)}finally{d(!1)}}};return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`identity.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`identity.title`),sub:r(`identity.subtitle`)}),(0,J.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-5`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),a?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),rows:12,className:`w-full resize-y rounded-lg border border-line bg-bg p-3 font-sans text-sm leading-relaxed text-ink outline-none focus:border-blue`,placeholder:r(`identity.placeholder`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:u||c===(i??``),title:r(`identity.save`),"aria-label":r(`identity.save`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:u?`…`:(0,J.jsx)(o,{icon:f})})]})]})]})]})}function Hd({sid:e,open:t,onClose:n}){let{t:r}=z(),{data:i,isLoading:a}=ge(e,t),o=i??[];return(0,J.jsxs)(dt,{open:t,onClose:n,label:r(`transcript.title`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:r(`transcript.title`),sub:r(`transcript.subtitle`)}),(0,J.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-4`,children:[a&&(0,J.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,J.jsx)(tt,{})}),!a&&o.length===0&&(0,J.jsx)($e,{children:r(`transcript.empty`)}),o.map((e,t)=>{let n=e.role===`operator`;return(0,J.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)] border-b border-line/50 py-2.5 last:border-b-0`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`font-mono text-[10px] font-semibold uppercase tracking-wide ${n?`text-ink-faint`:`text-blue-sky`}`,children:n?r(`transcript.operator`):`argus`}),(0,J.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Dt(e.ts)})]}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink-dim`,children:e.text})]},t)})]})]})}function Ud({card:e}){let{t,locale:n}=z(),r=typeof e.asked_at==`number`&&Number.isFinite(e.asked_at)&&e.asked_at>0?new Date(e.asked_at*1e3):null,i=e.task_status?.startsWith(`paused`);return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] text-ink-faint`,"data-decision-task":e.item_id,children:[e.task_title?(0,J.jsx)(`span`,{className:`min-w-0 basis-full break-words text-xs leading-relaxed text-ink-dim`,title:e.task_title,children:t(`decision.taskName`,{title:e.task_title})}):null,e.kind!==`domain_intake`&&e.is_current_task!=null?(0,J.jsx)(`span`,{children:t(e.is_current_task?`decision.currentTask`:`decision.otherTask`)}):null,(0,J.jsx)(at,{children:t(`decision.awaitingReply`)}),e.task_status?(0,J.jsx)(`span`,{children:i?t(`label.status.paused`):Rn(e.task_status,t)}):null,r&&!Number.isNaN(r.getTime())?(0,J.jsx)(`time`,{dateTime:r.toISOString(),title:r.toLocaleString(n),children:t(`decision.askedAt`,{time:wt(r,n)})}):null]})}function Wd({questions:e,backlog:t,currentTaskId:n,onAnswer:r,onLocate:i}){let{t:a}=z(),o=Xr(e,t,n);if(!o.length)return null;let s=o[0];return(0,J.jsxs)(`div`,{className:`mb-2 flex min-h-11 items-center gap-3 rounded-md border border-gold/40 bg-gold/5 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s.title===s.task_title?null:(0,J.jsx)(`div`,{className:`truncate text-xs font-medium text-gold`,title:s.title,children:s.title}),(0,J.jsx)(Ud,{card:s}),(0,J.jsx)(`div`,{className:`truncate text-xs text-ink-dim`,title:s.reason||s.question,children:s.reason||s.question})]}),o.length>1?(0,J.jsxs)(`span`,{className:`font-mono text-xs text-ink-faint`,children:[`+`,o.length-1]}):null,i&&s.item_id?(0,J.jsx)(`button`,{onClick:()=>i(s.item_id),className:`shrink-0 text-xs text-ink-dim hover:text-gold`,children:a(`pending.showOnMap`)}):null,(0,J.jsx)(`button`,{onClick:r,className:`shrink-0 text-xs font-medium text-gold hover:text-gold-soft`,children:a(`pending.reviewRespond`)})]})}function Gd({reply:e,open:t,busy:n,onClose:r,onSubmit:i,error:a=``}){let{t:o,locale:s}=z(),c=s===`zh-CN`,l=(0,G.useMemo)(()=>e?.options[0]?.id??`custom`,[e]),[u,d]=(0,G.useState)(l),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(``);if((0,G.useEffect)(()=>{t&&(d(l),p(``),h(``))},[l,t,e?.id]),!e)return null;let g=e.options.length===0,_=e.kind===`domain_intake`,v=e.options.find(e=>e.id===u),y=g?!!f.trim():!!(v&&(!v.requires_note||f.trim())),b=()=>{if(!n){if(!y){h(o(`decision.noteRequired`));return}h(``),i(g?`custom`:u,f.trim())}};return(0,J.jsxs)(dt,{open:t,onClose:n?()=>void 0:r,label:o(`decision.operator`),width:`max-w-2xl`,children:[(0,J.jsx)(lt,{title:_?e.title:o(`decision.required`),sub:!_&&e.title!==e.task_title?e.title:void 0}),(0,J.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[(0,J.jsx)(Ud,{card:e}),e.reason?(0,J.jsxs)(`section`,{className:`rounded-md border border-gold/30 bg-gold/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-gold`,children:o(`decision.whyBlocked`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.reason})]}):null,e.evidence.length?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:o(`decision.evidence`)}),(0,J.jsx)(`div`,{className:`space-y-2`,children:e.evidence.map((e,t)=>(0,J.jsxs)(`div`,{className:`rounded border border-line/70 bg-bg/40 p-2.5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.label}),e.summary?(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:e.summary}):null,e.path?(0,J.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10px] text-blue-sky`,children:e.path}):null]},`${e.path}:${t}`))})]}):null,(0,J.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.question}),e.options.length?(0,J.jsx)(`div`,{className:`space-y-2`,children:e.options.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{d(e.id),h(``)},disabled:n,"aria-pressed":u===e.id,className:`w-full rounded-md border p-3 text-left ${u===e.id?`border-blue bg-blue/5`:`border-line bg-bg/30`}`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-ink`,children:e.label}),(0,J.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-ink-dim`,children:e.description})]},e.id))}):null,_||g||v?.requires_note||f?(0,J.jsx)(`textarea`,{"data-autofocus":!0,value:f,onChange:e=>{p(e.target.value),h(``)},onKeyDown:e=>{vu(e)||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},rows:3,disabled:n,"aria-label":_?c?`你的回答或补充说明`:`Your answer or additional details`:o(`decision.notePlaceholder`),placeholder:_?v?.requires_note?c?`填写你的回答…`:`Enter your answer…`:c?`补充说明(可选)`:`Additional details (optional)`:o(`decision.notePlaceholder`),className:`w-full resize-y rounded-lg border border-line bg-bg px-3 py-2 text-sm leading-relaxed text-ink outline-none focus:border-blue disabled:opacity-60`}):null,m||a?(0,J.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:m||a}):null,(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:_?c?`确认后继续这次任务。`:`Confirm to continue this request.`:o(`decision.resumeHint`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md px-3 py-2 text-xs text-ink-dim hover:bg-bg`,children:o(n?`decision.closeContinue`:`decision.later`)}),(0,J.jsx)(`button`,{type:`button`,onClick:b,disabled:n,className:`rounded-md border border-blue/35 bg-blue/8 px-3 py-2 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-50`,children:o(n?`decision.applying`:g||u===`custom`?`decision.sendAnswer`:u===`stop`?`decision.stopCampaign`:`decision.useOption`)})]})]})]})]})}function Kd({alert:e}){if(!e)return null;let t=e.tone===`block`,n=e.kind===`budget`;return(0,J.jsxs)(`div`,{className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border px-3.5 py-2 text-[13px] ${t?`border-err/50 bg-err/10 text-err`:`border-warn/50 bg-warn/10 text-warn`}`,role:t?`alert`:`status`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-bold leading-none`,children:n?`$`:t?`!`:`i`}),(0,J.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold uppercase tracking-wide`,children:n?`budget alarm`:t?`action required`:`notice`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.text,children:e.text})]})}function qd({sid:e}){let{t}=z(),n=M(),{data:r}=Me(e,!0),[i,a]=(0,G.useState)(!1);if(!e||!Ad(r?.operator_knobs))return null;let o=async()=>{a(!0);try{await R.setConfig(e,Od,`1`),await n.invalidateQueries({queryKey:[`config`,e]})}finally{a(!1)}};return(0,J.jsxs)(`div`,{"data-no-operator-banner":!0,role:`status`,className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border border-warn/50 bg-warn/10 px-3.5 py-2 text-[13px] text-warn`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:t(`noOperator.banner`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:i,className:`shrink-0 rounded border border-warn/50 px-2 py-0.5 text-xs font-medium hover:bg-warn/10 disabled:opacity-40`,children:t(`noOperator.turnOff`)})]})}function Jd(e){let t=(e.label||e.display_name||``).trim();return!!(t&&t!==e.id)}function Yd(e){return[...e].sort((e,t)=>{if(e.daemon_alive!==t.daemon_alive)return e.daemon_alive?-1:1;let n=Jd(e);return n===Jd(t)?(t.last_active||0)-(e.last_active||0):n?-1:1})}function Xd(e){return Yd(e)[0]}function Zd(e,t){let n=t?.trim()||null;return n&&e.some(e=>e.id===n)?{id:n,requested:n,recovered:!1}:{id:Xd(e)?.id??null,requested:n,recovered:!!n}}function Qd(e,t,n){if(n){let e=t?.trim()||null;return{id:e,requested:e,recovered:!1}}return Zd(e,t)}function $d(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return!0;let r=e.daemon_alive?`live running`:`stopped idle`,i=[e.id,e.label,e.display_name,e.objective,r].filter(Boolean).join(` `).toLowerCase();return n.every(e=>i.includes(e))}function ef(e,t){return e.filter(e=>$d(e,t))}function tf({sid:e,change:t,zh:n}){let[r,i]=(0,G.useState)({open:!1,loading:!1,diff:``,error:``,truncated:!1});return(0,J.jsxs)(`div`,{className:`delivery-changes`,children:[(0,J.jsx)(`button`,{type:`button`,"aria-expanded":r.open,onClick:()=>{if(r.open){i(e=>({...e,open:!1}));return}i(e=>({...e,open:!0,loading:!e.diff&&!e.error})),!(r.diff||r.error)&&R.deliveryDiff(e,t).then(e=>i(t=>({...t,loading:!1,truncated:e.truncated,diff:e.available?e.diff:``,error:e.available?e.diff?``:n?`内容没有变化`:`No content changes`:n?`上一版已不再保存,无法对比`:`The previous version is no longer kept`}))).catch(e=>i(t=>({...t,loading:!1,error:e instanceof Error?e.message:String(e)})))},children:r.open?n?`收起改动`:`Hide changes`:n?`查看与上一次交付相比的改动`:`Show changes since the previous delivery`}),r.open&&(r.loading?(0,J.jsx)(`p`,{children:n?`正在读取…`:`Loading…`}):r.error?(0,J.jsx)(`p`,{children:r.error}):(0,J.jsxs)(`pre`,{"aria-label":n?`改动`:`Changes`,children:[r.diff.split(` +`).map((e,t)=>(0,J.jsxs)(`span`,{className:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:void 0,children:[e,` +`]},t)),r.truncated?n?`…(改动过长,已截断)`:`… (truncated)`:``]}))]})}var nf=({children:e})=>(0,J.jsxs)(`span`,{children:[e,` `]}),rf=(0,G.memo)(function({children:e}){return(0,J.jsx)(F,{remarkPlugins:vt,rehypePlugins:ht,components:{p:nf,h1:nf,h2:nf,h3:nf,h4:nf,h5:nf,h6:nf,ul:nf,ol:nf,blockquote:nf,pre:nf,li:({children:e})=>(0,J.jsxs)(`span`,{className:`markdown-excerpt-item`,children:[e,` `]}),table:nf,thead:nf,tbody:nf,tr:nf,th:({children:e})=>(0,J.jsxs)(`strong`,{children:[e,` · `]}),td:nf,a:({children:e})=>(0,J.jsx)(`span`,{className:`markdown-excerpt-link`,children:e}),img:({alt:e})=>(0,J.jsx)(`span`,{children:e}),input:({checked:e})=>(0,J.jsx)(`span`,{children:e?`✓ `:`○ `}),hr:()=>(0,J.jsx)(`span`,{children:` · `}),code:({children:e})=>(0,J.jsx)(`code`,{children:e})},children:Jo(e)})});function af({html:e,title:t,className:n=``,sid:r,path:i}){return r&&i?(0,J.jsx)(of,{sid:r,path:i,html:e,title:t,className:n}):(0,J.jsx)(`iframe`,{title:t,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white ${n}`})}function of({html:e,title:t,className:n,sid:r,path:i}){let{locale:a}=z(),o=a===`zh-CN`,s=A({queryKey:[`artifact-html`,r,i,e],queryFn:({signal:e})=>R.artifactPreview(r,i,e),enabled:!!(r&&i),staleTime:3e4,retry:1});if(r&&i&&s.isPending)return(0,J.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,role:`status`,children:o?`正在加载网页和配套资源…`:`Loading the website and its assets…`});if(r&&i&&s.isError)return(0,J.jsxs)(`div`,{className:`m-auto p-6 text-sm text-err`,role:`alert`,children:[o?`网页预览加载失败,请重试或下载文件。`:`Preview could not load. Retry or download the file.`,(0,J.jsx)(`button`,{type:`button`,className:`ml-3 underline`,onClick:()=>void s.refetch(),children:o?`重试`:`Retry`})]});let c=s.data?.served_page===!0;return(0,J.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col ${n}`,children:[!!s.data?.warnings.length&&(0,J.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`部分配套资源无法加载,页面可能不完整。`:`Some linked assets are unavailable; the preview may be incomplete.`}),!c&&(0,J.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`此后端尚未支持独立网页预览;当前为内嵌预览,交互脚本可能不可用。`:`This backend does not yet support standalone preview; embedded preview may not run interactive scripts.`}),(0,J.jsx)(`iframe`,{title:t,src:c?me(r,i):void 0,srcDoc:c?void 0:s.data?.html??e,sandbox:`allow-scripts allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]})}function sf(e){let t=e.trim();if(!t)return``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{try{return t.split(/\r?\n/).filter(Boolean).map(e=>JSON.parse(e)).map(e=>JSON.stringify(e,null,2)).join(` +`)}catch{return e}}}function cf(e,t){let n=[],r=[],i=``,a=!1;for(let o=0;oe.some(e=>e.length>0))}function lf({value:e}){return(0,J.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:sf(e)||`(empty data)`})}function uf({value:e,delimiter:t}){let n=cf(e,t).slice(0,200),r=n[0]??[];return(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4 scroll-thin`,children:n.length?(0,J.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:r.slice(0,40).map((e,t)=>(0,J.jsx)(`th`,{className:`border border-line/60 bg-surface px-2 py-1.5 font-semibold text-ink`,children:e},t))})}),(0,J.jsx)(`tbody`,{children:n.slice(1).map((e,t)=>(0,J.jsx)(`tr`,{children:r.slice(0,40).map((t,n)=>(0,J.jsx)(`td`,{className:`border border-line/50 px-2 py-1.5 align-top text-ink-dim`,children:e[n]??``},n))},t))})]}):(0,J.jsx)(`div`,{className:`text-sm text-ink-faint`,children:`(empty table)`})})}var df=``+new URL(`pdf.min-Bbvtrhlt.mjs`,import.meta.url).href,ff=``+new URL(`pdf.worker.min-CLrFZWeq.mjs`,import.meta.url).href,pf=null,mf=0;function hf(){pf=null,mf+=1}function gf(){if(pf)return pf;let e=new URL(df,import.meta.url),t=new URL(ff,import.meta.url);mf&&(e.searchParams.set(`retry`,String(mf)),t.searchParams.set(`retry`,String(mf)));let n=Ne(()=>import(e.href).then(e=>(e.GlobalWorkerOptions.workerSrc=t.href,e)),[],import.meta.url).catch(e=>{throw pf===n&&hf(),e});return pf=n,n}function _f(e,t,n,r){let i=Math.max(1,n-32)/Math.max(1,e),a=Math.max(1,r-32)/Math.max(1,t);return Math.min(2.5,i,a)}function vf({src:e,name:t,className:n=``,onPageOrientation:r,onRetry:i}){let{locale:a}=z(),o=a===`zh-CN`,s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(1),[m,h]=(0,G.useState)(1),[g,_]=(0,G.useState)({width:0,height:0}),[v,y]=(0,G.useState)(!0),[b,x]=(0,G.useState)(!1),[S,C]=(0,G.useState)(``),[w,T]=(0,G.useState)(0);(0,G.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>_({width:e.clientWidth,height:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,G.useEffect)(()=>{let t=!0,n=new AbortController,r=null;return d(null),p(1),h(1),l.current=null,c.current?.scrollTo(0,0),C(``),y(!0),Promise.all([fetch(e,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`PDF request failed (${e.status})`);return e.arrayBuffer()}),gf()]).then(async([e,n])=>{if(!t)return;r=n.getDocument({data:new Uint8Array(e)});let i=await r.promise;t&&(d(i),y(!1))}).catch(e=>{t&&(y(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!1,n.abort(),r?.destroy().catch(()=>{})}},[e,w]),(0,G.useEffect)(()=>{let e=s.current;if(!u||!e||g.width<=0||g.height<=0)return;let t=!1,n=null;return x(!0),C(``),u.getPage(f).then(e=>{if(t||!s.current)return;let i=e.getViewport({scale:1});r?.(i.width>i.height?`landscape`:`portrait`);let a=_f(i.width,i.height,g.width,g.height),o=e.getViewport({scale:a*m}),u=document.createElement(`canvas`),d=u.getContext(`2d`,{alpha:!1});if(!d)throw Error(`Canvas rendering is unavailable`);let f=Math.min(window.devicePixelRatio||1,2);return u.width=Math.max(1,Math.floor(o.width*f)),u.height=Math.max(1,Math.floor(o.height*f)),n=e.render({canvas:u,canvasContext:d,viewport:o,transform:f===1?void 0:[f,0,0,f,0,0]}),n.promise.then(()=>{if(t||!s.current)return;let e=s.current,n=e.getContext(`2d`,{alpha:!1});if(!n)throw Error(`Canvas rendering is unavailable`);e.width=u.width,e.height=u.height,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`,n.drawImage(u,0,0);let r=c.current,i=l.current;if(r&&i){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect();r.scrollLeft+=n.left+i.x*n.width-t.left-r.clientWidth/2,r.scrollTop+=n.top+i.y*n.height-t.top-r.clientHeight/2,l.current=null}})}).then(()=>{t||x(!1)}).catch(e=>{t||e instanceof Error&&e.name===`RenderingCancelledException`||(x(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!0,n?.cancel()}},[r,f,u,g.height,g.width,m]);let E=e=>{let t=c.current,n=s.current;if(t&&n&&n.clientWidth&&n.clientHeight){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();l.current={x:Math.max(0,Math.min(1,(e.left+t.clientWidth/2-r.left)/r.width)),y:Math.max(0,Math.min(1,(e.top+t.clientHeight/2-r.top)/r.height))}}h(t=>Math.max(.6,Math.min(2.2,Math.round((t+e)*100)/100)))},D=()=>{l.current=null,c.current?.scrollTo(0,0),h(1)},O=u?.numPages??0;return(0,J.jsxs)(`div`,{className:`pdf-viewer flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-bg ${n}`,"aria-busy":v||b,children:[(0,J.jsxs)(`div`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-2 border-b border-line/70 bg-panel px-3 py-1.5 text-[11px] text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink`,title:t,children:t}),(0,J.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[o?`第`:`Page`,` `,f,` / `,O||`…`]}),(0,J.jsx)(`button`,{type:`button`,disabled:!u||f<=1,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.max(1,e-1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`上一页`:`Previous`}),(0,J.jsx)(`button`,{type:`button`,disabled:!u||f>=O,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.min(O,e+1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`下一页`:`Next`}),(0,J.jsx)(`button`,{type:`button`,"aria-label":o?`缩小`:`Zoom out`,disabled:!u||m<=.6,onClick:()=>E(-.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`−`}),(0,J.jsxs)(`span`,{className:`w-10 text-center font-mono tabular-nums`,children:[Math.round(m*100),`%`]}),(0,J.jsx)(`button`,{type:`button`,"aria-label":o?`放大`:`Zoom in`,disabled:!u||m>=2.2,onClick:()=>E(.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`+`}),(0,J.jsx)(`button`,{type:`button`,disabled:!u,onClick:D,className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`适合页面`:`Fit page`})]}),(0,J.jsxs)(`div`,{ref:c,className:`pdf-scroll-viewport relative min-h-0 min-w-0 flex-1 overflow-auto bg-surface/60 p-4 scroll-thin`,tabIndex:0,"aria-label":o?`PDF 页面滚动区域`:`PDF page scroll area`,children:[v?(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,J.jsx)(tt,{})}):null,S?(0,J.jsxs)(`div`,{role:`alert`,className:`m-auto max-w-sm rounded border border-err/35 bg-err/5 p-4 text-center text-sm text-err`,children:[(0,J.jsx)(`p`,{children:o?`PDF 暂时无法预览`:`PDF preview is temporarily unavailable`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>{hf(),i?i():T(e=>e+1)},className:`mt-3 rounded border border-line bg-panel px-3 py-1.5 text-ink hover:border-blue/50`,children:o?`重试预览`:`Retry preview`}),(0,J.jsxs)(`details`,{className:`mt-3 break-words text-xs text-ink-dim`,children:[(0,J.jsx)(`summary`,{children:o?`错误详情`:`Error details`}),S]})]}):null,S?null:(0,J.jsx)(`div`,{className:`pdf-page-stage flex min-h-full min-w-full w-max items-center justify-center`,children:(0,J.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`${t} · ${o?`第`:`page`} ${f}`,className:`block max-w-none shrink-0 bg-white shadow-xl`})})]})]})}function yf({sid:e,path:t,onClose:n,delivery:r,deliveries:i=[],onSelectDelivery:a,onSelectPath:o,reviewActivity:s,artifacts:c=[]}){let{t:l,locale:u}=z(),d=u===`zh-CN`,f=r?Ko(r):[],p=we(e,t),m=p.data,h=m?.source===`reader_foundation`?m.reader_foundation:void 0,g=m?.source===`progress_snapshot`,_=m?us(m):!1,[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(``),[S,C]=(0,G.useState)(0),[w,T]=(0,G.useState)(!1),[E,D]=(0,G.useState)(!1),[O,k]=(0,G.useState)(`portrait`),A=m?.kind===`pdf`||t?.toLowerCase().endsWith(`.pdf`)===!0,j=!!(t&&/(?:^|[\\/])REVIEW\.md$/i.test(t));(0,G.useEffect)(()=>{if(!(!t||!A))return Pr(!0),()=>Pr(!1)},[t,A]),(0,G.useEffect)(()=>{if(k(`portrait`),y(null),x(``),!e||!t||!m||![`image`,`pdf`,`audio`,`video`].includes(m.kind))return;let n=!0,r=``,i=new AbortController;return R.artifactBlob(e,t,!1,i.signal).then(e=>{n&&(r=URL.createObjectURL(e),y(r))},e=>n&&x(e.message)),()=>{n=!1,i.abort(),r&&URL.revokeObjectURL(r)}},[e,t,m?.kind,S]);let M=async(n=!1)=>{if(!(!e||!t||!m)){T(!0),x(``);try{let r=n?await R.artifactBundle(e,t):await R.artifactBlob(e,t,!0);ut(r,n?`${m.name.replace(/\.html?$/i,``)}-website.zip`:m.name)}catch(e){x(e.message)}finally{T(!1)}}};return(0,J.jsxs)(dt,{open:!!(t||r),onClose:n,label:r?d?`交付成果`:`Delivery`:l(`artifact.preview`),width:r?E?`max-w-none`:`max-w-6xl`:A?`max-w-none`:`max-w-5xl`,viewport:r?E:A,showClose:!1,style:r?{height:E?`100dvh`:`min(92dvh, 960px)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:A?{maxWidth:O===`portrait`?`min(96vw, 76dvh)`:`min(96vw, 145dvh)`}:void 0,children:[r&&!E&&(0,J.jsxs)(`header`,{className:`delivery-header`,children:[(0,J.jsxs)(`div`,{className:`delivery-heading`,children:[(0,J.jsx)(`span`,{className:`delivery-mark`,children:(0,J.jsx)(ln,{size:22})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`p`,{children:[`DELIVERY · `,d?`交付成果`:`Your results`]}),(0,J.jsx)(`h2`,{children:d?`成果文件`:`Result files`})]}),(0,J.jsxs)(`button`,{type:`button`,onClick:n,className:`delivery-return`,"aria-label":d?`关闭交付弹窗`:`Close delivery`,children:[d?`返回地图`:`Back to map`,` ×`]})]}),i.length>1?(0,J.jsx)(`select`,{"aria-label":d?`选择交付任务`:`Choose delivery`,className:`delivery-task-select`,value:r.delivery_id,onChange:e=>{let t=i.find(t=>t.delivery_id===e.target.value);t&&a?.(t)},children:i.map(e=>(0,J.jsx)(`option`,{value:e.delivery_id,children:e.title},e.delivery_id))}):(0,J.jsx)(`p`,{className:`delivery-task-title`,title:r.title,children:r.title}),(0,J.jsxs)(`div`,{className:`delivery-facts`,children:[(()=>{let e=Qo(r,d);return(0,J.jsxs)(`span`,{className:e.independent?`delivery-review-independent`:`delivery-review-self`,title:e.title,children:[e.independent?(0,J.jsx)(Kt,{size:13}):null,e.text]})})(),(0,J.jsxs)(`span`,{children:[f.length,` `,d?`个文件`:`files`]})]}),r.summary&&(0,J.jsxs)(`details`,{className:`delivery-summary`,children:[(0,J.jsx)(`summary`,{children:d?`查看成果说明`:`Result summary`}),(0,J.jsx)(`p`,{children:(0,J.jsx)(rf,{children:r.summary})})]})]}),!E&&!!f.length&&(0,J.jsx)(`nav`,{className:`delivery-files`,"aria-label":d?`交付文件`:`Delivery files`,children:f.map(e=>(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":t===e.path,onClick:()=>o?.(e.path),title:e.path,children:[(0,J.jsx)(`span`,{children:e.path.split(`/`).at(-1)}),r?.primary_target?.path===e.path&&(0,J.jsx)(`small`,{children:d?`主要成果`:`Main result`})]},e.path))}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-line px-4 py-3 sm:px-5 ${t?``:`hidden`}`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink ${h||g?``:`font-mono`}`,title:h?.question??m?.progress_source?.title??m?.storage_path??m?.path??t??``,children:h?ds(h):g?m?.progress_source?.title||l(`artifact.title`):m?.name??t??l(`artifact.title`)}),(0,J.jsx)(`p`,{className:`mt-0.5 truncate text-[11px] text-ink-faint`,children:h?h.kind===`clarification`||h.kind===`progress_answer`?d?`阅读问答`:`Reading question and answer`:d?`背景说明 · 不计作研究进展`:`Background explanation · separate from research progress`:g?d?`保存的进展说明 · 提问来源`:`Saved progress explanation · question source`:m?`${m.kind} · ${yt(m.size)} · ${m.mime}`:d?`正在读取文件`:`Loading file`})]}),r&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>D(e=>!e),"aria-label":E?d?`收起预览`:`Exit full screen`:d?`全屏预览`:`Full screen preview`,title:d?`切换全屏预览`:`Toggle full screen preview`,className:`shrink-0 rounded-md border border-line p-2 text-ink-dim`,children:E?(0,J.jsx)(cn,{size:16}):(0,J.jsx)(on,{size:16})}),m?.kind===`html`&&(0,J.jsx)(`button`,{type:`button`,disabled:w,onClick:()=>void M(!0),className:`shrink-0 rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-2 text-xs text-blue-sky disabled:opacity-50`,children:d?`下载完整网页`:`Download website`}),(0,J.jsx)(`button`,{type:`button`,disabled:!m||w,onClick:()=>void M(),className:`rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-1.5 text-xs text-blue-sky transition-colors hover:bg-blue-deep/20 disabled:cursor-wait disabled:opacity-50`,children:l(w?`artifact.downloading`:`artifact.download`)}),(!r||E)&&(0,J.jsx)(`button`,{type:`button`,"aria-label":l(`artifact.close`),onClick:n,className:`rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink`,children:`×`})]}),(0,J.jsxs)(`div`,{className:r?`flex min-h-0 flex-1 flex-col overflow-auto bg-bg/40 p-2 sm:p-3`:A?`flex min-h-0 flex-1 flex-col overflow-hidden bg-bg/40`:`flex min-h-64 max-h-[72vh] flex-col overflow-x-hidden overflow-y-auto bg-bg/40 p-3 scroll-thin sm:p-4`,children:[!t&&r&&(0,J.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,children:(0,J.jsx)(rf,{children:r.summary})}),r&&e&&(()=>{let n=$o(r,i,t);return n?(0,J.jsx)(tf,{sid:e,change:n,zh:d},`${n.before}:${n.after}`):null})(),p.isLoading?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,p.isError?(0,J.jsxs)(`div`,{className:`m-auto text-sm text-err`,children:[l(`artifact.unavailable`),` · `,p.error.message]}):null,m?.why&&!h&&!g&&!A&&!r?(0,J.jsxs)(`div`,{className:`mb-3 rounded-md border border-line bg-surface px-3 py-2 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{className:`mr-1 text-ink-faint`,children:`Reviewer:`}),m.why]}):null,m?.kind===`text`&&!_?(0,J.jsxs)(`pre`,{className:`min-h-52 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-bg p-4 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:[m.preview||l(`artifact.empty`),m.truncated?`\n\n… ${l(`artifact.truncated`)}`:``]}):null,m&&_?(0,J.jsxs)(`div`,{className:`min-h-52 overflow-auto rounded-lg border border-line bg-bg p-4 text-sm text-ink-dim scroll-thin`,children:[j&&(0,J.jsxs)(`div`,{className:`mb-4 border-b border-line pb-3 text-xs leading-5 text-ink-faint`,role:`status`,children:[s===`revising`?d?`正在根据这份意见修改论文,修改后的版本尚待复审。`:`The paper is being revised against this opinion; the revised version awaits review.`:s===`reviewing`?d?`Reviewer 正在更新本轮审稿意见,内容会自动刷新。`:`The Reviewer is updating this round’s opinion. This file refreshes automatically.`:d?`这是最近保存的审稿意见,文件更新后会自动刷新。`:`This is the latest saved review. Changes to this file appear automatically.`,m.mtime!=null&&(0,J.jsxs)(`div`,{children:[d?`最近更新:`:`Last updated: `,new Date(m.mtime*1e3).toLocaleString(u)]})]}),(0,J.jsx)(H,{sid:e,basePath:t||``,artifacts:[...c,...f.map(e=>({path:e.path})),...h?.sources??[],...h?.progress_source?[{path:h.progress_source.path}]:[]],onOpenArtifact:o,children:m.preview||l(`artifact.empty`)}),m.truncated?(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 border-t border-line pt-2 text-xs text-ink-faint`,children:[l(`artifact.truncated`),` · `,l(`artifact.downloadHint`)]}):null]}):null,m?.kind===`json`?(0,J.jsx)(lf,{value:m.preview||``}):null,m?.kind===`table`?(0,J.jsx)(uf,{value:m.preview||``,delimiter:m.name.endsWith(`.tsv`)?` `:`,`}):null,m?.kind===`html`?(0,J.jsx)(`div`,{className:`flex flex-1 overflow-hidden rounded-lg border border-line ${r?`min-h-0`:`min-h-[60vh]`}`,children:(0,J.jsx)(af,{sid:e,path:t,html:m.preview||``,title:`HTML preview: ${m.name}`})}):null,m?.kind===`image`&&v?(0,J.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-bg/50`,children:(0,J.jsx)(`img`,{src:v,alt:m.why||m.name,className:`max-h-[62vh] max-w-full object-contain`})}):null,m?.kind===`pdf`&&v?(0,J.jsx)(vf,{src:v,name:m.name,className:`min-h-0 overflow-hidden`,onPageOrientation:k,onRetry:()=>C(e=>e+1)}):null,m?.kind===`audio`&&v?(0,J.jsx)(`div`,{className:`m-auto w-full max-w-xl`,children:(0,J.jsx)(`audio`,{controls:!0,preload:`metadata`,src:v,className:`w-full`})}):null,m?.kind===`video`&&v?(0,J.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-black`,children:(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:v,className:`max-h-[62vh] max-w-full`})}):null,m&&[`image`,`pdf`,`audio`,`video`].includes(m.kind)&&!v&&!b?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,m?.kind===`binary`?(0,J.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-ink-dim`,children:l(`artifact.noPreview`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:l(`artifact.downloadHint`)})]}):null,b?(0,J.jsx)(`div`,{className:`mt-3 text-center text-xs text-err`,children:b}):null]})]})}function bf({sid:e,objective:t,taskId:n,taskTitle:r,readOnly:i,onOpenArtifact:a}){let{locale:o}=z(),s=o===`zh-CN`,c=s?`zh-CN`:`en-US`,l=(e,t)=>s?e:t,u=gs(e,c),{client:d,list:f,generation:p,progress:m,creationBlocked:h}=u,g=Uo(e,c),[_,v]=(0,G.useState)(null);(0,G.useEffect)(()=>v(null),[e,c]);let y=u.pendingRequest?.draft.progressSource?null:u.pendingRequest,b=u.notes.filter(e=>!e.reader_foundation?.progress_source&&e.reader_foundation?.kind!==`progress_answer`),x=b.filter(hs),S=x.find(e=>e.reader_foundation?.id===g.id),C=S?b.filter(e=>e.reader_foundation?.kind===`clarification`&&e.reader_foundation.root_id===S.reader_foundation?.id).reverse():[],w=S?.exists&&S.reader_foundation?.state===`complete`,T=b.some(e=>e.reader_foundation?.state===`generating`),E=b.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),D=b.filter(e=>e.reader_foundation?.state===`failed`),O=b.filter(e=>e.exists&&e.reader_foundation?.state===`complete`),k=!u.pendingRequest?.draft.progressSource&&u.creating,A=!u.requested?.reader_foundation?.progress_source&&u.confirmedFailure,j=!!y&&u.requestRejected,M=!!y&&u.unknownResult,ee=()=>{!_?.question.trim()||i||h||_.parentId&&!O.some(e=>e.reader_foundation?.id===_.parentId)||u.submit(_)&&v(null)},N=e=>{i||h||!e.exists||e.reader_foundation?.state!==`complete`||v({question:``,parentId:e.reader_foundation.id,parentTitle:ds(e.reader_foundation)})};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`mx-4 mt-3 rounded-lg border border-line/70 bg-panel px-3 py-2`,"aria-label":l(`问题基础`,`Question foundations`),"data-testid":`question-foundation`,"data-project-id":e,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(K,{size:15,className:`text-blue-sky`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:l(`问题基础`,`Question foundations`)}),(0,J.jsx)(`span`,{className:`hidden text-xs text-ink-faint sm:inline`,children:l(`一份说明,陪你读后续进展`,`A saved explanation to help you follow later progress`)}),i?null:(0,J.jsxs)(W,{className:`ml-auto inline-flex items-center gap-1 text-xs`,disabled:h,onClick:()=>v({question:t??``,sourceTaskId:n,sourceTitle:r}),children:[(0,J.jsx)(fn,{size:12}),l(`从基础理解`,`Understand the foundations`)]})]}),x.length?(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`select`,{className:`min-w-0 flex-1 rounded border border-line bg-bg px-2 py-1.5 text-xs text-ink`,"aria-label":l(`选择基础说明`,`Choose a foundation explanation`),value:g.id??``,onChange:t=>Vo(d,e,c,t.target.value||null),children:[(0,J.jsx)(`option`,{value:``,children:l(`选择你正在理解的问题`,`Choose the question you are studying`)}),x.map(e=>(0,J.jsxs)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,disabled:!e.exists||e.reader_foundation.state!==`complete`,children:[ds(e.reader_foundation),e.reader_foundation.state===`generating`?l(` · 正在整理`,` · preparing`):e.exists?``:l(` · 尚未完成`,` · not completed`)]},e.path))]}),(0,J.jsx)(W,{className:`text-xs`,disabled:!w,onClick:()=>S&&a(S.path),children:l(`阅读基础说明`,`Read foundations`)}),!i&&S?(0,J.jsxs)(W,{className:`inline-flex items-center gap-1 text-xs`,disabled:!w||h,onClick:()=>N(S),children:[(0,J.jsx)(sn,{size:12}),l(`问这份说明`,`Ask about these foundations`)]}):null]}):!f.isPending&&!k?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:l(`先选一个想理解的问题;保存后,后续进度会引用同一份说明。`,`Start with a question you want to understand. Later progress can refer to the same saved explanation.`)}):null,C.length?(0,J.jsxs)(`div`,{className:`mt-3 border-t border-line/60 pt-2`,"data-testid":`foundation-questions`,"data-foundation-id":S?.reader_foundation?.id,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:l(`围绕这份说明的问答`,`Questions about these foundations`)}),(0,J.jsx)(`ul`,{className:`mt-1 max-h-48 space-y-2 overflow-y-auto scroll-thin`,children:C.map(e=>(0,J.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,"data-reading-question-id":e.reader_foundation.id,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-ink-dim`,children:e.reader_foundation.question}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:e.reader_foundation.state===`generating`?l(`正在回答`,`Preparing an answer`):e.reader_foundation.state===`failed`||!e.exists?l(`这次回答未完成`,`This answer did not finish`):l(`回答已保存`,`Answer saved`)})]}),e.exists&&e.reader_foundation.state===`complete`?(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,children:[(0,J.jsx)(W,{className:`text-xs`,onClick:()=>a(e.path),children:l(`阅读回答`,`Read answer`)}),i?null:(0,J.jsx)(W,{className:`text-xs`,disabled:h,onClick:()=>N(e),children:l(`继续问`,`Ask a follow-up`)})]}):null]},e.path))})]}):null,f.isError?(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-ink-faint`,role:`status`,children:[(0,J.jsx)(`span`,{children:l(`已保存的基础说明暂时读取失败。`,`Saved explanations could not be loaded.`)}),(0,J.jsx)(W,{className:`text-xs`,disabled:f.isFetching,onClick:()=>void f.refetch(),children:l(`重新读取`,`Reload records`)})]}):null,k?(0,J.jsx)(`div`,{className:`mt-2`,children:m.active?(0,J.jsx)(ss,{generating:!0,phase:m.phase}):(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:l(`正在核对保存结果`,`Checking the saved result`)})}):T?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:E?l(`等待时间已较长,仍未收到完整说明;生成尚未确认结束。`,`The wait is taking longer. A complete explanation has not arrived, and generation has not been confirmed to have stopped.`):l(`基础说明仍在整理,保存后会出现在这里。`,`An explanation is still being prepared. It will appear here when saved.`)}):null,A?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`这次说明未完成,失败记录已保留。可以重新明确生成一份。`,`This explanation did not finish. The failed request is retained; you can explicitly generate a new one.`)}):M?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`这次请求的结果尚未确认;刷新不会重新生成。`,`The result of this request is unconfirmed. Refreshing does not generate it again.`)}):null,j?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,role:`status`,children:l(`引用的说明目前不可用,这次追问未发起。问题已保留,可以重新选择来源。`,`The reading source is unavailable, so this question was not started. Your question is saved; you can choose another source.`)}):null,!i&&y&&!k&&!T?j?(0,J.jsx)(W,{className:`mt-2 text-xs`,onClick:()=>{v(y.draft),p.reset()},children:l(`编辑问题与来源`,`Edit question and source`)}):(0,J.jsx)(W,{className:`mt-2 text-xs`,onClick:()=>u.retrySavedRequest(y),children:l(`重试同一请求`,`Retry this same request`)}):null,!i&&D.length?(0,J.jsx)(ft,{label:l(`未完成的说明(${D.length})`,`Unfinished explanations (${D.length})`),children:(0,J.jsx)(`div`,{className:`max-h-[24vh] overflow-y-auto`,children:D.map(e=>(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-ink-faint`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.reader_foundation.question,children:[l(`未完成:`,`Not completed: `),e.reader_foundation.question]}),(0,J.jsx)(W,{className:`shrink-0 text-xs`,disabled:h,onClick:()=>v({question:e.reader_foundation.question,sourceTaskId:e.reader_foundation.source_task_id??void 0,parentId:e.reader_foundation.parent_id??void 0,parentTitle:e.reader_foundation.parent_id?ds(b.find(t=>t.reader_foundation?.id===e.reader_foundation.parent_id)?.reader_foundation??{question:l(`先前选择的说明`,`Previously selected reading`)}):void 0}),children:l(`重新编辑问题`,`Edit this question`)})]},e.path))})}):null,(0,J.jsx)(`p`,{className:`mt-1.5 text-[11px] text-ink-faint`,children:l(`说明和问答会保存下来,供你随时回看。`,`Explanations and questions are saved for later reading.`)})]}),(0,J.jsxs)(dt,{open:!!_,onClose:()=>v(null),label:_?.parentId?l(`继续理解`,`Ask about your reading`):l(`从基础理解`,`Understand the foundations`),children:[(0,J.jsx)(lt,{title:_?.parentId?l(`哪里还不明白`,`What is still unclear`):l(`你想理解什么`,`What would you like to understand`),sub:_?.parentId?l(`可以引用一句话,或者写下算不明白的那一步。`,`Quote a sentence or describe the step you could not work through.`):l(`用自己的话选定一个问题,说明会保存下来供以后阅读。`,`Choose a question in your own words. Its explanation will be saved for later reading.`)}),(0,J.jsxs)(`div`,{className:`px-6 pb-6`,children:[_?.parentId?(0,J.jsxs)(`label`,{className:`mb-3 block text-xs text-ink-dim`,children:[l(`引用的说明或回答`,`Reading source`),(0,J.jsxs)(`select`,{"aria-label":l(`引用的说明或回答`,`Reading source`),className:`mt-1 block w-full min-w-0 rounded border border-line bg-bg px-2 py-2 text-xs text-ink`,value:_.parentId,onChange:t=>{let n=O.find(e=>e.reader_foundation?.id===t.target.value);n&&(v(e=>e&&{...e,parentId:n.reader_foundation.id,parentTitle:ds(n.reader_foundation)}),Vo(d,e,c,n.reader_foundation.root_id??n.reader_foundation.id))},children:[O.some(e=>e.reader_foundation?.id===_.parentId)?null:(0,J.jsxs)(`option`,{value:_.parentId,disabled:!0,children:[_.parentTitle||l(`原来源`,`Original source`),l(` · 当前不可用`,` · unavailable`)]}),O.map(e=>(0,J.jsx)(`option`,{value:e.reader_foundation.id,children:ds(e.reader_foundation)},e.path))]})]}):null,_?(0,J.jsx)(ps,{draft:_,onChange:v,onSubmit:ee,disabled:h||i||!!_.parentId&&!O.some(e=>e.reader_foundation?.id===_.parentId)}):null]})]})]})}var xf=[`manager`,`planner`,`engineer`,`reviewer`],Sf=new Set([`planner`,`engineer`,`reviewer`]),Cf=new Set([`running`,`in_progress`,`claimed`]),$=(e,t)=>String(e[t]??``).trim(),wf=(e,t)=>{let n=Number(e[t]);return Number.isFinite(n)?n:null};function Tf(e){return JSON.parse(JSON.stringify(e))}function Ef(){return{schema_version:7,bootstrapped:!1,language:``,mission:{id:``,title:``,objective:``,summary:``,final_output:``,status:`idle`,started_at:null,completed_at:null,elapsed_seconds:0,campaign_started_at:null,campaign_elapsed_seconds:0},stage:{id:``,label:``},routing:{route:``,vertical:``,workflow_mode:``,lifetime:``,continuous:!1,open_ended:!1},round:{current:0,max:0},active_role:``,roles:xf.map(e=>({role:e,status:`waiting`,label:`Waiting`,updated_at:0})),role_work:[],dag:[],timeline:[],artifacts:[],learned_skills:[],learned_wiki_pages:[],storage:{project_skill_dir:``,global_skill_dir:``,project_skill_count:0,global_skill_count:0,skill_history_compressed:0,wiki_retired_compressed:0,skill_history_bytes_saved:0,wiki_retired_bytes_saved:0,wiki_paths:[]},achievement:null,review:{status:``,reason:``,rejected_attempts:0},frontier:{change:``,summary:``,updated_at:0},delivery:null,outcome:{},last_event_ts:0,updated_at:0}}function Df(e,t,n,r){if(n==null||n===``)return;let i=e.findIndex(e=>e[t]===n);i>=0?e[i]={...e[i],...r}:e.push(r)}function Of(e,t,n,r,i){if(!xf.includes(t))return;n===`active`&&Sf.has(t)&&e.roles.forEach(e=>{Sf.has(e.role)&&e.role!==t&&e.status===`active`&&Object.assign(e,{status:`done`,label:`Handed off`,updated_at:i})});let a={role:t,status:n,label:r,updated_at:i};Df(e.roles,`role`,t,a),n===`active`?e.active_role=t:e.active_role===t&&(e.active_role=``)}function kf(e,t,n,r,i=``,a=`neutral`){let o=Re(t);if(e.timeline.some(e=>e.id===o))return;let s={id:o,ts:Number(t.ts??Date.now()/1e3),type:ie(t.type),role:n,title:r.slice(0,180),detail:i.slice(0,500),tone:a};[`item_id`,`branch_id`].forEach(e=>{let n=$(t,e);n&&(s[e]=n)}),e.timeline=[...e.timeline,s].slice(-120)}function Af(e,t,n,r,i,a=``,o=``){if(!xf.includes(n))return;let s=$(t,`message_id`),c=s?`${n}:${s}`:Re(t),l=e.role_work.find(e=>e.id===c),u=l&&l.detail.length>a.length?l.detail:a,d={id:c,ts:Number(t.ts??Date.now()/1e3),role:n,kind:r,title:i.slice(0,240),detail:u.slice(0,4e3),status:o,item_id:$(t,`item_id`),mission_id:e.mission.id,mission_title:e.mission.title.slice(0,240),round_index:wf(t,`round_index`)},f=e.role_work.findIndex(e=>e.id===c);f>=0?e.role_work[f]=d:e.role_work.push(d);let p=new Set;xf.forEach(t=>{e.role_work.filter(e=>e.role===t).slice(-40).forEach(e=>p.add(e.id))}),e.role_work=e.role_work.filter(e=>p.has(e.id))}function jf(e){return e===`ok`?`success`:e===`err`?`error`:`info`}var Mf={agent_message:`Reporting progress`,assistant_message:`Reporting progress`,command_execution:`Running a command`,reasoning:`Reasoning`,tool_use:`Using a tool`,tool_result:`Inspecting tool output`,codex_idle:`Waiting for model output`};function Nf(e,t){let n=ie(t.type),r=Number(t.ts??Date.now()/1e3);if(e.last_event_ts=Math.max(e.last_event_ts,r),n===I.LIFE_MANAGER_INTENT_STARTED)e.mission.id=$(t,`item_id`)||$(t,`intent_id`),e.mission.title=$(t,`objective`).slice(0,240),e.mission.objective=$(t,`objective`),e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`grounding`,Of(e,`manager`,`active`,`Grounding project`,r),kf(e,t,`manager`,`Project grounding started`,$(t,`objective`)),Af(e,t,`manager`,`grounding`,`Grounding project`,$(t,`objective`),`active`);else if(n===I.LIFE_MANAGER_INTENT_COMPLETED){let n=$(t,`execution_task`)||$(t,`objective`);e.mission.id=$(t,`item_id`),e.mission.title=n.slice(0,240),e.mission.objective=n,e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`framed`,e.routing.route=$(t,`route`)||e.routing.route||`team`,e.routing.vertical=$(t,`vertical`)||e.routing.vertical,e.routing.workflow_mode=$(t,`workflow_mode`)||e.routing.workflow_mode,e.routing.lifetime=$(t,`lifetime`)||e.routing.lifetime,`continuous`in t&&(e.routing.continuous=t.continuous===!0),`open_ended`in t&&(e.routing.open_ended=t.open_ended===!0);let i=$(t,`current_stage`),a=Array.isArray(t.stages)?t.stages:[];if(i)e.stage={id:i,label:i.replaceAll(`_`,` `)};else if(!e.stage.id&&a[0]){let t=String(a[0]);e.stage={id:t,label:t.replaceAll(`_`,` `)}}Of(e,`manager`,`done`,`Goal framed`,r),kf(e,t,`manager`,`Goal framed`,$(t,`reason`),`success`),Af(e,t,`manager`,`decision`,`Goal framed`,$(t,`reason`)||$(t,`execution_task`),`done`)}else if(n===I.LIFE_MANAGER_INTENT_FAILED)e.mission.status=`failed`,Of(e,`manager`,`error`,`Manager routing failed`,r),kf(e,t,`manager`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`),Af(e,t,`manager`,`grounding`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`);else if(n===I.LIFE_MANAGER_STAGE_DECISION){let n=$(t,`target_stage`)||$(t,`stage`)||$(t,`current_stage`);n&&(e.stage={id:n,label:n.replaceAll(`_`,` `)}),Of(e,`manager`,`done`,n?`Stage · ${n}`:`Stage reviewed`,r),kf(e,t,`manager`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`)),Af(e,t,`manager`,`stage_decision`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`),$(t,`action`))}else if(n===I.LIFE_PLANNER_START)Of(e,`planner`,`active`,`Planning next work`,r),Af(e,t,`planner`,`planning`,`Planning next work`,$(t,`objective`),`active`);else if(n===I.LIFE_PLANNER_TASK_ADDED){let n=$(t,`item_id`),i={id:n,title:$(t,`title`),objective:$(t,`objective`),status:`pending`,deps:Array.isArray(t.deps)?t.deps.map(String):[],branch_id:$(t,`branch_id`)||n,parent_branch_id:$(t,`parent_branch_id`)||null};Df(e.dag,`id`,n,i);let a=e.routing.vertical===`research`?`Research branch added`:`Task added`;Of(e,`planner`,`done`,a,r),kf(e,t,`planner`,a,i.title,`info`),Af(e,t,`planner`,`task`,i.title||`Task added`,i.objective,`pending`)}else if(n===I.LIFE_PLANNER_VERDICT){let n=!!t.project_done,i=n&&t.delivery&&typeof t.delivery==`object`&&!Array.isArray(t.delivery)?JSON.parse(JSON.stringify(t.delivery)):null,a=i?`Task completed`:n?`Project reviewed`:`Planning complete`;i&&(e.delivery=i,e.mission.status=`complete`,e.mission.summary=i.summary||``,e.mission.completed_at=r),Of(e,`planner`,`done`,a,r),kf(e,t,`planner`,a,$(t,`reason`),n?`success`:`neutral`),Af(e,t,`planner`,`verdict`,a,$(t,`reason`),n?`done`:`planned`)}else if(n===I.LIFE_PLANNER_WAITING){Of(e,`planner`,`waiting`,`Waiting on external work`,r);let n=$(t,`reason`)||$(t,`waiting_reason`);kf(e,t,`planner`,`Planner waiting`,n),Af(e,t,`planner`,`waiting`,`Planner waiting`,n,`waiting`)}else if(n===I.LIFE_MISSION_STARTED)e.review={status:``,reason:``,rejected_attempts:0},e.delivery=null,e.mission.campaign_started_at??=r,e.mission={...e.mission,id:$(t,`item_id`),title:$(t,`title`),objective:$(t,`objective`),summary:``,final_output:``,status:`working`,started_at:r,completed_at:null},Of(e,`reviewer`,`waiting`,`Waiting for the Engineer to finish`,r),Of(e,`engineer`,`active`,`Starting mission`,r),kf(e,t,`engineer`,`Mission started`,$(t,`title`),`info`),Af(e,t,`engineer`,`task`,$(t,`title`)||`Mission started`,$(t,`objective`),`active`);else if(n===I.ROUND_START)e.round={current:wf(t,`round_index`)??0,max:wf(t,`round_max`)??e.round.max},Of(e,`engineer`,`active`,`Running round ${e.round.current}`,r),kf(e,t,`engineer`,`Round ${e.round.current} started`);else if(n===I.ENGINEER_PROGRESS){let n=$(t,`agent_layer`)||$(t,`actor`)||`engineer`,i=n===`main`?`engineer`:n,a=$(t,`kind`),o=Mf[a]??`Working`;Of(e,i,`active`,o,r),i===`engineer`&&[`assistant_message`,`agent_message`,`message`].includes(a)&&t.final_delivery===!0&&e.mission.started_at!=null&&e.mission.completed_at==null&&r>=e.mission.started_at&&(!t.item_id||$(t,`item_id`)===e.mission.id)&&(e.mission.final_output=pe(t.text));let s=$(t,`action_summary`)||$(t,`text`);s&&!fe(t)&&!re(t)&&Af(e,t,i,a||`progress`,o,s,`active`),[`reasoning`,`assistant_message`,`agent_message`].includes(a)||kf(e,t,i,o,$(t,`action_summary`)||$(t,`text`))}else if(n===I.ROUND_MAIN_COMPLETED)Of(e,`engineer`,`done`,`Work ready for review`,r),Af(e,t,`engineer`,`handoff`,`Work ready for review`,$(t,`text`)||$(t,`summary`),`done`);else if(n===I.ROUND_REVIEW_STARTED)e.review={status:``,reason:``,rejected_attempts:e.review.rejected_attempts},Of(e,`reviewer`,`active`,`Reviewing benchmark evidence`,r),Af(e,t,`reviewer`,`review`,`Review started`,``,`active`);else if(n===I.ROUND_REVIEW_DEFERRED){let n=$(t,`next_step`);Of(e,`engineer`,`active`,`Continuing before review`,r),Of(e,`reviewer`,`waiting`,`Review deferred for one round`,r),kf(e,t,`engineer`,`Continued before review`,n,`info`)}else if(n===I.ROUND_REVIEW_COMPLETED){let n=t.review_skipped===!0,i=n?`skipped`:$(t,`status`),a=$(t,`reason`);e.review={status:i,reason:a,rejected_attempts:e.review.rejected_attempts+ +!![`continue`,`blocked`].includes(i)};let o=$(t,`frontier_change`);o&&(e.frontier={change:o,summary:$(t,`frontier_summary`),updated_at:r});let s=n?`No review this round`:i===`done`?`Evidence accepted`:`Attempt rejected`;Of(e,`reviewer`,n?`waiting`:i===`done`?`done`:`rejected`,n?s:i===`done`?`Accepted evidence`:`Requested another attempt`,r),kf(e,t,`reviewer`,s,a,n?`info`:i===`done`?`success`:`error`);let c=$(t,`next_action`);Af(e,t,`reviewer`,n?`review`:`verdict`,s,c?`${a}\n\nNext action: ${c}`:a,i)}else if([I.SKILL_CREATED,I.SKILL_UPDATED].includes(n)){let i=$(t,`skill_id`)||$(t,`name`);i&&(Df(e.learned_skills,`id`,i,{id:i,name:$(t,`name`),version:wf(t,`version`)??1,scope:$(t,`scope`),path:$(t,`path`),status:`active`,updated_at:r,mission_id:e.mission.id,mission_title:e.mission.title}),kf(e,t,`reviewer`,n===I.SKILL_CREATED?`Capability unlocked`:`Capability upgraded`,$(t,`name`),`skill`))}else if(n===I.SKILL_EVOLUTION_COMPLETED)e.storage.project_skill_dir=$(t,`project_skill_dir`)||e.storage.project_skill_dir,e.storage.global_skill_dir=$(t,`global_skill_dir`)||e.storage.global_skill_dir,e.storage.project_skill_count=wf(t,`project_skill_count`)??e.storage.project_skill_count,e.storage.global_skill_count=wf(t,`global_skill_count`)??e.storage.global_skill_count;else if(n===I.SKILL_HISTORY_COMPRESSED)e.storage.skill_history_compressed+=wf(t,`count`)??0,e.storage.skill_history_bytes_saved+=wf(t,`bytes_saved`)??0;else if(n===I.SKILL_TIDIED){let n=$(t,`name`);if(n){let i=e.learned_skills.find(e=>e.name===n),a={source_path:$(t,`path`),source_placement:$(t,`placement`),source_vertical:$(t,`vertical`),updated_at:r};i?Object.assign(i,a):Df(e.learned_skills,`id`,n,{id:n,name:n,version:1,scope:``,path:``,status:`active`,...a}),kf(e,t,`manager`,`Capability promoted to source`,n,`skill`)}}else if([I.WIKI_INITIALIZED,I.WIKI_EVOLUTION_COMPLETED].includes(n)){let n=[...(Array.isArray(t.paths)?t.paths:[]).map(e=>String(e)),$(t,`path`)].filter(Boolean);e.storage.wiki_paths=[...new Set([...e.storage.wiki_paths,...n])]}else if(n===I.WIKI_RETIRED_COMPRESSED)e.storage.wiki_retired_compressed+=wf(t,`count`)??0,e.storage.wiki_retired_bytes_saved+=wf(t,`bytes_saved`)??0;else if([I.WIKI_CREATED,I.WIKI_UPDATED].includes(n)){let i=$(t,`page_id`);i&&(Df(e.learned_wiki_pages,`id`,i,{id:i,title:$(t,`title`)||i,card_type:$(t,`card_type`),status:$(t,`status`)||`scratch`,path:$(t,`path`),updated_at:r}),kf(e,t,`reviewer`,n===I.WIKI_CREATED?`Knowledge captured`:`Knowledge refined`,$(t,`title`)||i,`skill`))}else if(n===I.WIKI_RETIRED){let n=$(t,`page_id`);if(n){let i=e.learned_wiki_pages.find(e=>e.id===n);i?Object.assign(i,{status:`retired`,updated_at:r}):Df(e.learned_wiki_pages,`id`,n,{id:n,title:n,card_type:$(t,`card_type`),status:`retired`,path:``,updated_at:r}),kf(e,t,`reviewer`,`Knowledge retired`,n,`error`)}}else if([I.WIKI_PROMOTION_PROMOTED,I.WIKI_PROMOTION_DEMOTED].includes(n)){let i=$(t,`page_id`);if(i){let a=e.learned_wiki_pages.find(e=>e.id===i);a?Object.assign(a,{status:$(t,`to_status`),updated_at:r}):Df(e.learned_wiki_pages,`id`,i,{id:i,title:i,card_type:$(t,`card_type`),status:$(t,`to_status`),path:``,updated_at:r});let o=n===I.WIKI_PROMOTION_PROMOTED;kf(e,t,`reviewer`,o?`Knowledge promoted`:`Knowledge demoted`,`${i} → ${$(t,`to_status`)}`,o?`success`:`neutral`)}}else if(n===I.RESEARCH_ACHIEVEMENT_CERTIFIED)e.achievement={id:$(t,`achievement_id`),title:$(t,`title`),goal:$(t,`goal`),summary:$(t,`summary`),rejected_attempts:e.review.rejected_attempts,skills_learned:e.learned_skills.filter(e=>e.status===`active`).length,artifacts:e.artifacts.length,elapsed_seconds:e.mission.elapsed_seconds,evidence:Array.isArray(t.evidence)?t.evidence.map(String):[],reviewer_certified:!0,certified_at:r};else if([I.LIFE_MISSION_COMPLETED,I.LIFE_MISSION_FAILED].includes(n)){let i=n===I.LIFE_MISSION_FAILED?oc({...t,outcome_class:`failed`,status:$(t,`status`)||`failed`,success:!1}):oc(t),a=`final_output`in t?$(t,`final_output`):$(t,`item_id`)===e.mission.id&&e.mission.started_at!=null&&(e.mission.completed_at==null||e.mission.completed_at===r)&&e.mission.final_output||``;e.mission.id=$(t,`item_id`)||e.mission.id,e.mission.title=$(t,`title`)||e.mission.title,e.mission.objective=$(t,`objective`)||e.mission.objective,e.mission.summary=$(t,`summary`),e.mission.final_output=a,e.mission.status=i.missionStatus,e.mission.completed_at=r;let o=t.delivery;t.success===!0&&o&&typeof o==`object`&&!Array.isArray(o)?e.delivery=JSON.parse(JSON.stringify(o)):t.success!==!0&&(e.delivery=null),e.outcome=ac(t),Of(e,`engineer`,i.missionStatus===`complete`?`done`:i.missionStatus,i.label,r),kf(e,t,`engineer`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),jf(i.tone)),Af(e,t,`engineer`,`completion`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),i.missionStatus)}return e.updated_at=Date.now()/1e3,e}function Pf(e,t,n){let r=t.backlog.find(e=>Cf.has(e.status)),i=t.backlog.find(e=>e.status===`pending`),a=t.backlog.find(t=>t.id===e.mission.id),o=r??a,s=!!(r||i||t.continuous?.enabled||t.continuous?.done_reason||t.continuous?.done_at||e.mission.id||![``,`idle`].includes(e.mission.status));t.continuous?.enabled&&(e.routing.route=e.routing.route||`team`,e.routing.continuous=!0,e.routing.open_ended=t.continuous.open_ended===!0,e.routing.lifetime=e.routing.open_ended?`standing`:e.routing.lifetime||`bounded`);let c=o?.objective||o?.title||(t.continuous?.enabled?t.continuous.objective:``)||t.session.objective||(e.mission.id?``:i?.objective)||(e.mission.id?``:i?.title)||e.mission.objective;c&&(e.mission.objective=c,o?e.mission.title=(o.title||c.split(` +`)[0]).slice(0,240):e.mission.title||(e.mission.title=c.split(` +`)[0].slice(0,240))),r?((r.id!==e.mission.id||r.started_ts!=null&&r.started_ts!==e.mission.started_at||e.mission.completed_at!=null)&&(e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=r.started_ts??null,e.mission.completed_at=null),e.mission.id=r.id,e.mission.status=`working`,e.mission.started_at=e.mission.started_at??r.started_ts??null):a?a.status===`pending`&&(e.mission.status=`queued`):t.continuous?.done_reason||t.continuous?.done_at?e.mission.status=`complete`:i||t.continuous?.enabled?e.mission.status=`queued`:t.daemon.alive&&(e.mission.status=`idle`),t.roles.forEach(t=>{t.active?Of(e,t.role,`active`,t.label||t.status||`Working`,Date.now()/1e3-(t.age_s??0)):s||Of(e,t.role,`waiting`,`Waiting`,Date.now()/1e3);let n=e.roles.find(e=>e.role===t.role);n&&Object.assign(n,{backend:t.backend,model:t.model,effort:t.effort})});let l=t.roles.filter(e=>e.active);l.length?e.active_role=l[l.length-1].role:s||(e.active_role=``),t.backlog.forEach(t=>{let n={id:t.id,title:t.title,objective:t.objective,status:t.status,deps:t.deps??[],branch_id:t.id,parent_branch_id:t.deps?.[0]??null,acceptance_check:t.acceptance_check??``,plan_hypothesis:t.plan_hypothesis??``,goal_contribution:t.goal_contribution??``,expected_regressions:t.expected_regressions??``,decision_rule:t.decision_rule??``,non_goals:t.non_goals??[]};Df(e.dag,`id`,n.id,n)});let u=o?.outcome?.execution_status?o.outcome:e.mission.id?void 0:[...t.backlog].filter(e=>e.outcome?.execution_status).sort((e,t)=>Number(e.finished_ts??0)-Number(t.finished_ts??0)).at(-1)?.outcome;return!r&&u&&(e.outcome=ac({outcome:u,status:`done`,success:!0})),n.forEach(t=>{Df(e.artifacts,`path`,t.path,{id:t.path,path:t.path,title:t.name,kind:t.kind,why:t.why,exists:t.exists,storage_path:t.storage_path,source:t.source})}),s}function Ff(e,t,n,r){r||(t.roles.forEach(t=>{t.active||Of(e,t.role,`waiting`,`Waiting`,Date.now()/1e3)}),e.active_role=``);let i=Date.now()/1e3,a=e.mission.campaign_started_at??t.session.created??e.mission.started_at;a&&(e.mission.campaign_started_at=a,e.mission.campaign_elapsed_seconds=Math.max(0,i-a)),e.mission.started_at&&e.mission.status===`working`?e.mission.elapsed_seconds=Math.max(0,i-e.mission.started_at):e.mission.started_at&&e.mission.completed_at&&(e.mission.elapsed_seconds=Math.max(0,e.mission.completed_at-e.mission.started_at)),e.achievement?.reviewer_certified&&(e.achievement.elapsed_seconds=e.mission.elapsed_seconds,e.achievement.rejected_attempts=e.review.rejected_attempts,e.achievement.skills_learned=e.learned_skills.filter(e=>e.status===`active`).length,e.achievement.artifacts=n.filter(e=>e.exists).length)}function If(e,t=[],n=[]){let r=e.mission_view?Tf(e.mission_view):Ef();r.storage??=Ef().storage,r.storage.skill_history_compressed??=0,r.storage.wiki_retired_compressed??=0,r.storage.skill_history_bytes_saved??=0,r.storage.wiki_retired_bytes_saved??=0,r.learned_wiki_pages??=[],r.role_work??=[],r.delivery??=null,r.outcome??={};let i=r.last_event_ts,a=Pf(r,e,n),o=[...t].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0));return o.filter(e=>e.ts==null||Number(e.ts)>i).forEach(e=>Nf(r,e)),r.mission.final_output||(r.mission.final_output=Lf(o,r.mission)),Ff(r,e,n,a),r}function Lf(e,t){if(!t.id||[`working`,`queued`,`grounding`,`framed`].includes(t.status))return``;let n=e.reduce(Nf,Ef()).mission;return n.id!==t.id||n.started_at==null||n.completed_at==null||t.started_at!=null&&n.started_at!==t.started_at||t.completed_at!=null&&n.completed_at!==t.completed_at?``:n.final_output||``}function Rf(e){return String(e||``).replace(/\\([*_`~])/g,`$1`).replace(/\\\\(?=[A-Za-z])/g,`\\`)}function zf(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h ${r}m`:r?`${r}m`:`${t}s`}var Bf=`__argus_live_progress__`,Vf=new Set([`framed`,`grounding`,`queued`,`running`,`in_progress`,`working`]),Hf=new Set([`complete`,`completed`,`done`,`success`]);function Uf(e){return Hf.has(String(e?.mission.status||``).toLowerCase())}function Wf(e){return(e??[]).filter(e=>e.source===`manager_live`)}function Gf(e){return Wf(e).filter(e=>e.exists)[0]??null}function Kf(e){let t=e??[],n={markdown:0,pdf:1,html:2,text:3,table:4,json:5,image:6,video:7,audio:8,binary:9},r=t.filter(e=>e.exists&&e.source===`delivery`),i=t.filter(e=>e.exists&&e.source===`manager_live`),a=t.filter(e=>e.exists&&e.source!==`manager_live`&&e.source!==`delivery`);return a.length||r.length?[...r,...[...a].sort((e,t)=>(n[e.kind]??99)-(n[t.kind]??99)),...i]:i}function qf(e){return Kf(e).find(e=>e.exists)??null}function Jf(e){let t=Kf(e);return t.find(e=>e.source===`delivery`)??t.find(e=>e.source!==`manager_live`)??t[0]??null}function Yf(e){let t=e.path.split(`/`);return t[t.length-1]||e.path}function Xf(e,t){if(e){let n=String(e.mission.status||``).toLowerCase();if(Vf.has(n))return Bf;let r=e.delivery?.primary_target?.path;if(r)return r;if(Uf(e))return Jf(t)?.path??`__argus_live_progress__`;let i=Gf(t);return i?i.path:Bf}return qf(t)?.path??``}function Zf(e){let t=String(e.agent_layer??e.actor??``);if(t===`main`)return`engineer`;if(t)return t;let n=String(e.type??``);return n.startsWith(`round.review`)||n.startsWith(`reviewer`)?`reviewer`:n.startsWith(`life.planner`)?`planner`:n.startsWith(`life.manager`)||n.startsWith(`manager`)?`manager`:n.startsWith(`engineer`)||n.startsWith(`round.`)?`engineer`:``}function Qf(e,t=[],n,r=`en`){if(n&&ci(n,e,t).state!==`running`||Uf(e))return null;let i=String(e?.active_role??``);if(!i)return null;let a=e?.roles.find(e=>e.role===i),o=``;for(let n=t.length-1;n>=0;--n){let r=t[n];if(e?.mission.id&&ri(r)!==e.mission.id||e?.mission.started_at&&Number(r.ts||0)ue(e,{},r)):i,label:a?.label||`Working`,detail:o}}function $f({view:e,artifacts:t=[],onOpenArtifact:n,routeVisible:r,snapshot:i,connected:a}){let{locale:o,t:s}=z(),c=e.dag.filter(e=>[`done`,`completed`].includes(e.status)).length,l=[...t].filter(e=>e.exists&&e.source!==`manager_live`).sort((e,t)=>Number(t.mtime??0)-Number(e.mtime??0)).slice(0,4),u=e=>[`running`,`in_progress`,`claimed`].includes(e),d=a&&i?.daemon.alive!==!1,f=e=>e===`done`?`text-ok`:u(e)?`text-blue-sky`:[`failed`,`blocked`,`rejected`].includes(e)?`text-err`:`text-ink-faint`;return(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 text-sm text-ink-dim scroll-thin`,children:[(0,J.jsx)(`section`,{className:`rounded-lg border border-blue-deep/30 bg-blue-deep/10 p-4`,children:(0,J.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.stage`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm font-medium text-blue-sky`,children:Pc(e.stage.id,o)===e.stage.id?e.stage.label||e.stage.id||`—`:Pc(e.stage.id,o)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.totalTime`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:zf(e.mission.campaign_elapsed_seconds)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.round`)}),(0,J.jsxs)(`dd`,{className:`mt-1 text-sm text-ink`,children:[e.round.current||`—`,e.round.max?` / ${e.round.max}`:``]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.dagProgress`)}),(0,J.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:Rc(c,e.dag.length,o)})]})]})}),r&&e.dag.length?(0,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:s(`mission.researchDag`)}),(0,J.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.dag.map(e=>(0,J.jsx)(`li`,{className:`rounded-md border border-line/60 bg-panel px-3 py-2.5`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 shrink-0 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,"aria-hidden":`true`,children:e.status===`done`?`✓`:d&&u(e.status)?`●`:`○`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium leading-5 text-ink`,children:(0,J.jsx)(H,{children:e.title})}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,children:!d&&u(e.status)?a?o===`zh-CN`?`当前未在运行`:`Not currently running`:o===`zh-CN`?`断连前记录:进行中`:`Last received state: in progress`:Wc(e.status,o)})]})]})},e.id))})]}):null,l.length?(0,J.jsxs)(`section`,{className:`mt-5`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:o===`zh-CN`?`已生成的文件`:`Files produced so far`}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o===`zh-CN`?`文件已生成,结论是否成立仍以核验记录为准。`:`A saved file is not a verification of its conclusions.`}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:l.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),title:e.storage_path||e.path,className:`rounded border border-line/70 bg-panel px-2.5 py-1.5 font-mono text-xs text-blue-sky hover:border-blue/60`,children:[Yf(e),` ↗`]},e.path))})]}):null]})}function ep({sid:e,artifacts:t,error:n=!1,onExpand:r,onOpenFile:i,className:a=``,embedded:s=!1,onCollapse:c,missionView:l,activityEvents:u=[],requestedPath:d,requestedPathToken:f,routeVisible:p=!0,snapshot:m,connected:h=!0}){let{t:g,locale:_}=z(),y=(0,G.useMemo)(()=>Kf(t),[t]),b=(0,G.useMemo)(()=>qf(t),[t]),x=Uf(l),S=(0,G.useMemo)(()=>{if(!x)return null;let e=l?.delivery?.primary_target?.path;return y.find(t=>t.path===e&&t.exists)??Jf(t)},[t,x,l?.delivery?.primary_target?.path,y]),[C,w]=(0,G.useState)(null);(0,G.useEffect)(()=>{w(x&&S?S.path:null)},[x,S?.path,l?.mission.id,e]),(0,G.useEffect)(()=>{if(!d)return;let e=y.find(e=>e.path===d&&e.exists);e&&w(e.path)},[y,d,f]);let T=e=>{w(e),e!==`__argus_live_progress__`&&i?.()},E=C??Xf(l,t),D=E===Bf,O=D?null:y.find(e=>e.path===E)??(x?S:b),k=we(e,O?.exists?O.path:null,O?.mtime??null),A=k.data,j=A?us(A):!1,[M,ee]=(0,G.useState)(null),[N,P]=(0,G.useState)(``),[F,te]=(0,G.useState)(!1),[ne,re]=(0,G.useState)(``),ie=(0,G.useMemo)(()=>h?Qf(l,u,m,_):null,[u,l,m,h,_]);(0,G.useEffect)(()=>{if(ee(null),P(``),!e||!O||!A||![`image`,`pdf`,`audio`,`video`].includes(A.kind))return;let t=!0,n=``,r=new AbortController;return R.artifactBlob(e,O.path,!1,r.signal).then(e=>{t&&(n=URL.createObjectURL(e),ee(n))},e=>t&&P(e.message)),()=>{t=!1,r.abort(),n&&URL.revokeObjectURL(n)}},[e,O?.path,A?.kind,A?.mtime]);let I=l?.delivery??null,L=I?.primary_target?.path??``,ae=!!(x&&!D&&O&&(O.source===`delivery`||O.path===L)),oe=_===`zh-CN`?I?.kind===`submission_certified`?`交付已认证`:`已完成`:I?.kind===`submission_certified`?`Certified delivery`:`Delivered result`,se=ae?oe:D?g(`research.liveProgress`):y[0]?.group_title||g(`research.artifact`),ce=async()=>{if(!(!e||!O)){te(!0),re(``);try{let t=await R.artifactBlob(e,O.path,!0);ut(t,O.name)}catch(e){re(e.message)}finally{te(!1)}}};return(0,J.jsxs)(`section`,{className:`glass-panel glass-panel--side flex min-h-0 flex-col overflow-hidden ${s?``:`rounded-lg border`} ${a}`,"aria-label":g(`research.canvas`),children:[(0,J.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-line/50 bg-panel px-4`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 rounded-full ${ae?`bg-ok`:ie?`animate-pulse bg-blue`:`bg-ink-faint/60`}`}),(0,J.jsx)(`h2`,{className:`max-w-24 truncate text-sm font-semibold text-ink sm:max-w-48`,children:se})]}),l||y.length>0?(0,J.jsxs)(`label`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:g(`research.previewArtifact`)}),(0,J.jsxs)(`select`,{value:D?Bf:O?.path??``,onChange:e=>T(e.target.value),title:D?g(`research.liveProgress`):O?.storage_path||O?.path,className:`h-8 w-full min-w-0 max-w-64 truncate rounded-md border border-line/50 bg-bg px-2 font-mono text-xs text-ink-dim outline-none focus:border-blue/60`,children:[l?(0,J.jsx)(`option`,{value:Bf,children:g(`research.liveProgress`)}):null,y.map(e=>(0,J.jsxs)(`option`,{value:e.path,disabled:!e.exists,title:e.storage_path||e.path,children:[e.source===`delivery`?`${g(`research.optionDelivery`)} · `:``,Yf(e),e.exists?``:` · ${g(`research.optionPending`)}`]},e.path))]})]}):(0,J.jsx)(`div`,{className:`flex-1`}),(0,J.jsx)(`div`,{className:`shrink-0`,children:O?(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void ce(),disabled:F||!O.exists,title:g(`artifact.download`),"aria-label":g(`artifact.download`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink disabled:opacity-40`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M8 2.25v7.5M5.25 7.5 8 10.25 10.75 7.5M3 13.25h10`})})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(O.path),title:g(`research.openLarge`),"aria-label":g(`research.openLarge`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink`,children:(0,J.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,J.jsx)(`path`,{d:`M6 3H3v3M10 3h3v3M6 13H3v-3M10 13h3v-3`})})})]}):null}),c?(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":g(`research.collapse`),title:g(`research.collapse`),className:`hidden h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink lg:flex`,children:(0,J.jsx)(o,{icon:v,className:`h-3.5 w-3.5`})}):null]}),m?(0,J.jsx)(ru,{snapshot:m,view:l,events:u,connected:h,compact:!0}):ie?(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-line/50 bg-blue-deep/10 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsx)(`span`,{"data-role-dot":ie.role,className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:B.role[ie.role]??B.inkFaint},"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:`font-semibold text-ink`,children:ie.roleLabel}),(0,J.jsx)(`span`,{className:`text-blue-sky`,children:g(`mission.active`)}),(0,J.jsxs)(`span`,{className:`truncate text-ink-faint`,children:[`· `,Hc(ie.label,_,{kind:l?.roles.find(e=>e.role===ie.role)?.kind,language:l?.language})]})]}),ie.detail?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-ink-dim`,children:ie.detail}):null]}):null,(0,J.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col bg-bg`,children:[D&&l?(0,J.jsx)($f,{view:l,artifacts:t,onOpenArtifact:T,routeVisible:p,snapshot:m,connected:h}):null,!D&&n?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-6 text-center text-sm text-warn`,children:g(`research.unavailable`)}):null,!D&&!n&&y.length===0?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,J.jsx)(`h3`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.noPreview`)})]}):null,!D&&!n&&y.length>0&&!O?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(tt,{}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.waiting`)})]}):null,O&&!O.exists?(0,J.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,J.jsx)(tt,{}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:g(`research.updating`)})]}):null,O?.exists&&k.isLoading?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,O?.exists&&k.isError?(0,J.jsxs)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:[g(`artifact.unavailable`),` · `,k.error.message]}):null,A?.kind===`text`&&!j?(0,J.jsxs)(`pre`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:[A.preview||`(empty file)`,A.truncated?` + +… live preview truncated · expand to inspect the complete file`:``]}):null,A&&j?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-5 text-sm text-ink-dim scroll-thin`,children:(0,J.jsx)(H,{sid:e,basePath:A.path,artifacts:t,onOpenArtifact:T,children:A.preview||`(empty file)`})}):null,A?.kind===`json`?(0,J.jsx)(lf,{value:A.preview||``}):null,A?.kind===`table`?(0,J.jsx)(uf,{value:A.preview||``,delimiter:A.name.endsWith(`.tsv`)?` `:`,`}):null,A?.kind===`html`&&!A.truncated?(0,J.jsx)(af,{sid:e,path:A.path,html:A.preview||``,title:`Live HTML preview: ${A.name}`}):null,A?.kind===`html`&&A.truncated?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-warn`,children:g(`artifact.htmlTooLarge`)}):null,A?.kind===`image`&&M?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4`,children:(0,J.jsx)(`img`,{src:M,alt:A.why||A.name,className:`max-h-full max-w-full object-contain`})}):null,A?.kind===`pdf`&&M?(0,J.jsx)(vf,{src:M,name:A.name}):null,A?.kind===`audio`&&M?(0,J.jsx)(`div`,{className:`m-auto w-full max-w-xl px-6`,children:(0,J.jsx)(`audio`,{controls:!0,preload:`metadata`,src:M,className:`w-full`})}):null,A?.kind===`video`&&M?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-2`,children:(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:M,className:`max-h-full max-w-full`})}):null,A?.kind===`binary`?(0,J.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-ink-dim`,children:g(`research.fileUnavailable`)}):null,A&&[`image`,`pdf`,`audio`,`video`].includes(A.kind)&&!M&&!N?(0,J.jsx)(`div`,{className:`m-auto`,children:(0,J.jsx)(tt,{})}):null,N?(0,J.jsx)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:N}):null]}),!D&&A?(0,J.jsxs)(`footer`,{className:`flex h-9 items-center gap-2 border-t border-line px-4 font-mono text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:A.storage_path||A.path,children:A.path}),ne?(0,J.jsx)(`span`,{className:`ml-auto truncate text-err`,title:ne,children:g(`research.downloadFailed`)}):null,(0,J.jsx)(`span`,{className:`shrink-0`,children:yt(A.size)})]}):null]})}function tp({notice:e,onClose:t}){if((0,G.useEffect)(()=>{if(!e)return;let n=window.setTimeout(t,e.tone===`error`?8e3:4e3);return()=>window.clearTimeout(n)},[e,t]),!e)return null;let n=e.tone===`error`?`border-err/60 bg-err/10 text-err`:e.tone===`success`?`border-ok/60 bg-ok/10 text-ok`:`border-blue-deep/60 bg-panel text-blue-sky`;return(0,J.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,"aria-live":e.tone===`error`?`assertive`:`polite`,className:`fixed bottom-4 left-4 right-4 z-[70] flex items-start gap-2 rounded-md border px-3 py-2.5 shadow-glow sm:left-auto sm:max-w-md ${n}`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0`,children:e.tone===`error`?`!`:e.tone===`success`?`✓`:`i`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-xs leading-relaxed text-ink-dim`,children:e.message}),(0,J.jsx)(`button`,{type:`button`,"aria-label":`dismiss notification`,onClick:t,className:`shrink-0 rounded px-1 text-base leading-none opacity-70 hover:bg-white/5 hover:opacity-100`,children:`×`})]})}function np({open:e,sid:t,name:n,alive:r,controlAvailable:i=!0,busy:a,onClose:o,onRename:s,onStart:c,onStop:l,onDelete:u}){let{t:d}=z(),[f,p]=(0,G.useState)(n),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(!1);(0,G.useEffect)(()=>{e&&(p(n),h(!1),_(!1))},[e,n,t]);let v=async e=>{e.preventDefault(),await s(f.trim())},y=r&&!g,b=async()=>{if(y){await l()&&_(!0);return}await c()&&_(!1)};return(0,J.jsxs)(dt,{open:e,onClose:()=>!a&&o(),label:d(`manage.daemon`),width:`max-w-lg`,children:[(0,J.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-ink`,children:d(`topbar.manageSession`)}),(0,J.jsx)(`p`,{className:`mt-0.5 font-mono text-[10px] text-ink-faint`,children:t})]}),(0,J.jsx)(`form`,{onSubmit:e=>void v(e),className:`border-b border-line p-5`,children:(0,J.jsxs)(`label`,{className:`block`,children:[(0,J.jsx)(`span`,{className:`mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.displayName`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),maxLength:80,disabled:a,className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg/50 px-3 text-sm text-ink outline-none focus:border-blue-deep disabled:opacity-50`}),(0,J.jsx)(`button`,{type:`submit`,disabled:a||f.trim()===n,className:`rounded border border-line px-3 text-xs text-ink-dim hover:bg-surface disabled:opacity-40`,children:d(`common.save`)})]})]})}),(0,J.jsxs)(`div`,{className:`border-b border-line p-5`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.executor`)}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center justify-between rounded border border-line bg-bg/30 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm text-ink`,children:d(y?i?`manage.running`:`manage.runningExternally`:`manage.paused`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:d(y?i?`manage.stopNowHint`:`manage.externalHint`:`manage.resumeHint`)})]}),(0,J.jsx)(`button`,{type:`button`,disabled:a||!i,onClick:()=>void b(),className:`rounded border px-3 py-1.5 text-xs disabled:cursor-wait disabled:opacity-50 ${y?`border-warn/50 text-warn hover:bg-warn/10`:`border-blue-deep bg-blue-deep text-white hover:bg-blue-deep/80`}`,children:d(a?`manage.working`:i?y?`manage.stopNow`:`manage.resume`:`common.external`)})]})]}),(0,J.jsxs)(`div`,{className:`p-5`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:d(`manage.deleteSession`)}),(0,J.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-ink-faint`,children:d(`manage.deleteHint`)}),m?(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded border border-err/40 bg-err/5 p-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-ink-dim`,children:d(`manage.confirmQuestion`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`rounded px-2 py-1 text-xs text-ink-faint hover:bg-surface`,children:d(`common.cancel`)}),(0,J.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void u(),className:`rounded bg-err px-3 py-1 text-xs font-medium text-bg disabled:opacity-50`,children:d(`manage.confirmDelete`)})]})]}):(0,J.jsx)(`button`,{type:`button`,disabled:a||y,onClick:()=>h(!0),className:`mt-3 rounded border border-err/40 px-3 py-1.5 text-xs text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-40`,children:d(`manage.delete`)})]})]})}var rp={科学环境已就绪:`Scientific environment ready`,更新科学环境校验:`Update scientific environment checks`,验证科学环境依赖和关键模块:`Validating scientific dependencies and required modules`,"科学环境 · 上次检查结果":`Scientific environment · previous check`,"下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。":`The results below predate this operation. Refer to the latest error above or check the environment again.`,"科学环境 · ⟦0⟧ 项待配置":`Scientific environment · ⟦0⟧ item(s) to configure`,科学环境:`Scientific environment`,检查环境:`Check environment`,"免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。":`Free scientific components are configured automatically; SHELX requires academic authorization from the official website before entering download credentials.`,修复依赖:`Repair dependencies`,"继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。":`Confirm the official PLATON license before continuing. The same installation or repair action will prepare the complete runtime; no separate repair button is required.`,同意并继续:`Agree and continue`,"请先确认 PLATON 使用许可,再继续安装或修复依赖。":`Confirm the PLATON license before installing or repairing dependencies.`,依赖修复完成:`Dependency repair complete`,依赖修复未完成:`Dependency repair incomplete`,环境操作未完成:`Environment operation incomplete`,"依赖修复未完成:⟦0⟧。请查看组件检查结果;不会报告修复成功。":`Dependency repair is incomplete: ⟦0⟧. Check the component results; this is not reported as a successful repair.`,"PLATON 已可用,保留当前安装。":`PLATON is already available; keeping the existing installation.`,"准备 PLATON 官方环境":`Prepare official PLATON runtime`,"下载、验证并配置":`Download, verify and configure`,"我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。":`I confirm that my use complies with the official PLATON license; for commercial use, I have obtained separate authorization.`,"PLATON 官方允许注明来源的学术、科学及非商业用途;商业用途需自行取得许可。本操作只从官方网站下载到插件私有目录,不安装系统运行库、不修改系统 PATH。":`The publisher permits acknowledged academic, scientific and non-commercial use of PLATON; commercial use requires a separate license. This downloads from official sites into the plugin's private directory, without installing system runtimes or changing the system PATH.`,"PLATON 缺少 Windows Salford 运行库(0xC0000135)。请点击“修复依赖”,确认许可后会在同一流程准备完整运行环境。":`PLATON is missing the Windows Salford runtime (0xC0000135). Click Repair dependencies and confirm the license to prepare the complete runtime in the same action.`,"正在校验 PLATON 官方程序与 Windows 配套运行环境…":`Verifying the official PLATON program and Windows runtime…`,"正在提取官方 Salford 运行库(不执行系统安装程序)…":`Extracting the official Salford runtime without executing the system installer…`,"正在实际运行 PLATON,验证 Windows 运行库和校验规则…":`Running PLATON to verify the Windows runtime and validation rules…`,"PLATON 官方 Windows 运行环境验证通过。":`The official PLATON Windows runtime passed verification.`,"PLATON 官方运行环境已可用,保留当前安装。":`The official PLATON runtime is already available; keeping the existing installation.`,"配置 SHELX":`Configure SHELX`,"SHELX 授权安装":`SHELX authorized installation`,学术授权:`Academic authorization`,前往官网申请:`Apply on official website`,"填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。":`Enter the username and password from the authorization email to download and install automatically. Credentials are used only for this official download, are not saved, and are not sent to the model.`,用户名:`Username`,"SHELX 用户名":`SHELX username`,密码:`Password`,"SHELX 密码":`SHELX password`,"查看许可 ↗":`View license ↗`,"下载并安装 SHELX":`Download and install SHELX`,取消:`Cancel`,科学软件健康检查:`Scientific software health check`,"点击“检查环境”可验证科学内核与外部程序。":`Click “Check environment” to verify the scientific kernel and external programs.`,可用:`Available`,待授权安装:`Authorization required`,待修复:`Needs repair`,查看检查详情:`View check details`,查看原因与安装方式:`View cause and installation method`,"官方安装说明 ↗":`Official installation instructions ↗`,使用已有安装:`Use existing installation`,"DIALS 环境目录":`DIALS environment directory`,"Systre JAR 路径(需要已有 Java)":`Systre JAR path (existing Java required)`,"⟦0⟧ 可执行文件路径":`⟦0⟧ executable path`,"填写运行 Argus 的电脑上的路径,验证成功后生效。":`Enter the path on the computer running Argus. It takes effect after successful verification.`,验证并使用:`Verify and use`,最近检查:`Last checked`,"· 检查不调用模型":`· Check does not call the model`,无法读取插件列表:`Unable to read plugin list`,插件操作未完成:`Plugin operation incomplete`,插件:`Plugins`,关闭插件列表:`Close plugin list`,"按需安装研究工具,沿用 Argus 的模型与执行后端。":`Install research tools as needed, using Argus's model and execution backend.`,"正在读取插件…":`Reading plugins…`,暂无可用插件:`No plugins available`,已启用:`Enabled`,已停用:`Disabled`,未安装:`Not installed`,"· 当前后端":`· Current backend`,安装:`Install`,打开工作台:`Open workbench`,启用:`Enable`,更新至:`Update to`,停用:`Disable`,卸载:`Uninstall`,"原生会话输入 ⟦0⟧ 可启用后台工具。卸载保留会话、研究数据和科学软件。":`Native session input ⟦0⟧ can enable background tools. Uninstalling preserves sessions, research data, and scientific software.`,"首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。":`First installation automatically configures standalone Python, DIALS, Systre / Java, and free academic PLATON components. SHELX can be installed later by entering authorization details.`,"暂不支持,敬请期待。当前插件支持 Codex、Copilot 和 Pi。":`Not supported yet. Stay tuned. Current plugins support Codex, Copilot, and Pi.`,"安装科学环境需要 Python 3.11–3.13。请安装 Python 后重试,或设置 ARGUS_PLUGIN_PYTHON。":`Installing the scientific environment requires Python 3.11–3.13. Install Python and try again, or set ARGUS_PLUGIN_PYTHON.`,准备安装:`Prepare installation`,获取并校验插件包:`Download and verify plugin package`,"安装独立运行环境(首次可能需要几分钟)":`Install standalone environment (may take several minutes the first time)`,"插件仍有任务运行,请等任务结束或先暂停,再进行此操作。":`This plugin still has running tasks. Wait for them to finish or pause them before continuing.`,"此插件版本尚未提供可校验的发行包。":`No verifiable release package is available for this plugin version.`,"插件包校验失败,未安装。":`Plugin package verification failed. Not installed.`,正在准备:`Preparing`,"当前系统或 Argus 插件接口版本暂不支持此插件。":`This plugin is not currently supported by the system or Argus plugin API version.`,"插件发行包尚未发布。":`The plugin release package has not been published.`,安装完成:`Installation complete`,环境检查完成:`Environment check complete`,"此插件已有安装或更新操作正在进行。":`An installation or update operation for this plugin is already in progress.`,插件尚未安装:`Plugin not installed`,"安装进程已中断;已有可用版本保持不变,可重试。":`Installation was interrupted. The existing available version is unchanged; you can retry.`,"安装未完成,已有版本保持不变":`Installation incomplete; existing version unchanged`,"此版本已安装,可启用插件。":`This version is installed. You can enable the plugin.`,请先安装插件:`Install the plugin first`,请先更新插件以使用环境管理功能:`Update the plugin first to use environment management`,"插件包超过允许大小。":`The plugin package exceeds the allowed size.`,科学计算内核:`Scientific computing kernel`,"cctbx · Gemmi · RDKit · 科学服务":`cctbx · Gemmi · RDKit · scientific services`,衍射帧处理与探测器格式支持:`Diffraction frame processing and detector format support`,周期网络与拓扑识别:`Periodic networks and topology identification`,"本地 checkCIF 结构校验 · 学术免费":`Local checkCIF structure validation · free for academic use`,"结构精修 · 需要学术授权":`Structure refinement · academic authorization required`,"结构求解 · 需要学术授权":`Structure solution · academic authorization required`,全部组件可用:`All components available`,部分组件需要配置或修复:`Some components require configuration or repair`,"PLATON 官网中间证书已更换,请更新插件安装器":`The PLATON official-site intermediate certificate has changed. Update the plugin installer.`,"PLATON Mac 发行包架构不符":`PLATON Mac release package architecture mismatch`,"请输入授权邮件中的用户名和密码。":`Enter the username and password from the authorization email.`,请选择有效的科学软件路径:`Select a valid scientific software path`,检查科学软件与运行环境:`Check scientific software and runtime environment`,"正在修复科学 Python 依赖":`Repairing scientific Python dependencies`,"(首次下载可能需要几分钟)":`(The initial download may take several minutes)`,"from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('科学内核及工作台资源可用')":`from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('Scientific kernel and workbench resources available')`,"; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · 探测器格式插件可用')":`; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · detector format plugins available')`,"Systre 19.6.0 · pcu 拓扑计算通过":`Systre 19.6.0 · pcu topology calculation passed`,"正在安装 Apple Rosetta 2 兼容组件":`Installing Apple Rosetta 2 compatibility components`,"从 SHELX 官方站点下载":`Downloading from the official SHELX site`,"SHELX 下载内容不是支持的可执行程序":`SHELX download is not a supported executable`,"已可用,保留当前安装":`Already available; keeping current installation`,正在安装:`Installing`,"尚未安装 DIALS":`DIALS is not installed`,"PLATON 编译需要 Apple 命令行工具;请运行 xcode-select --install,然后点击修复依赖。":`PLATON compilation requires Apple Command Line Tools; run xcode-select --install, then click Repair dependencies.`,"SHELX 官方 Mac 版需要 Rosetta 2,请先同意安装兼容组件。":`The official Mac version of SHELX requires Rosetta 2. Agree to install the compatibility components first.`,"暂未完成;可在健康检查中重试":`Not completed; retry from the health check`,"SHELX 下载或启动失败;请核对授权、网络及系统平台后重试。":`SHELX download or launch failed; check authorization, network, and system platform, then retry.`,"尚未安装 Systre":`Systre is not installed`,"尚未安装 Java":`Java is not installed`,"Systre 未能识别内置 pcu 网络":`Systre could not identify the built-in pcu network`,"尚未安装 PLATON":`PLATON is not installed`,"PLATON 安装配方已更新,点击修复依赖即可使用当前版本。":`The PLATON installation recipe has been updated. Click Repair dependencies to use the current version.`,"PLATON 未生成校验规则;请检查运行库":`PLATON did not generate verification rules; check the runtime`,"请输入 SHELX 授权信息以安装":`Enter SHELX authorization details to install`,"无法启动,请核对平台与运行库":`Unable to start; check the platform and runtime`,"衍射数据处理、结构求解、精修与三维晶体研究工作台":`Diffraction data processing, structure solution, refinement and a 3D crystallography workbench`,"正在准备 ⟦0⟧ 工作台,首次需要几分钟":`Preparing the ⟦0⟧ workbench; the first time takes a few minutes`,"⟦0⟧ 暂时无法使用":`⟦0⟧ is unavailable for now`,"管理 ⟦0⟧":`Manage ⟦0⟧`,"原生会话输入 ⟦0⟧ 可启用后台工具。":`Native session input ⟦0⟧ can enable background tools.`,"研究工具由服务方提供,沿用 Argus 的模型与执行后端。":`Research tools are provided by the service and use Argus's model and execution backend.`,"此插件由服务方提供并维护,无需停用或卸载。":`This plugin is provided and maintained by the service; there is nothing to disable or uninstall.`},ip=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),ap=/⟦\d+⟧/g,op=Object.entries(rp).filter(([e])=>e.includes(`⟦`)).sort((e,t)=>t[0].length-e[0].length).map(([e,t])=>({regex:RegExp(`^`+e.split(ap).map(ip).join(`([\\s\\S]*?)`)+`$`),slots:e.match(ap)??[],target:t})),sp=new RegExp(Object.keys(rp).filter(e=>e.length>1&&!e.includes(`⟦`)).sort((e,t)=>t.length-e.length).map(ip).join(`|`),`g`);function cp(e,t){if(t===`zh-CN`||!/[\u3400-\u9fff]/.test(e))return e;if(rp[e.trim()])return e.replace(e.trim(),rp[e.trim()]);for(let t of op){let n=t.regex.exec(e.trim());if(n){let e=new Map(t.slots.map((e,t)=>[e,n[t+1]]));return t.target.replace(ap,t=>e.get(t)??t)}}return e.replace(sp,e=>rp[e])}function lp(){let{locale:e}=z();return t=>typeof t==`string`?cp(t,e):t}var up=oe(),dp=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;function fp({health:e,setup:t,running:n,act:r,platform:i,machine:a}){let o=lp(),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(!1),[C,w]=(0,G.useState)(!1),T=t.windows_runtime,E=t.license?.platform_consent,D=E?.platform===i&&E?.machines.includes(a||``),O=e?.components||[],k=O.filter(e=>e.status!==`ready`),A=k.some(e=>e.license_required),j=k.some(e=>e.automatic);async function M(e){e.preventDefault();let n=await r(t.license.action,{username:d,password:p,accept_platform_license:y});m(``),n&&(u(!1),f(``),c(!0))}return(0,J.jsxs)(`div`,{className:`mt-5 border-t border-line/60 pt-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:()=>c(!s),className:`inline-flex items-center gap-2 text-sm text-ink-dim hover:text-ink`,children:[(0,J.jsx)(Be,{size:16,strokeWidth:1.5}),(0,J.jsx)(`span`,{children:o(e?.stale?o(`科学环境 · 上次检查结果`):e?.checked?e.ready?o(`科学环境已就绪`):o(`科学环境 · ${k.length} 项待配置`):o(`科学环境`))}),(0,J.jsx)(Ue,{size:13,className:`transition-transform duration-200 ${s?`rotate-180`:``}`})]}),(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint hover:text-ink disabled:opacity-45`,disabled:n,onClick:()=>{c(!0),r(`health`)},children:[(0,J.jsx)(Ke,{size:12}),o(`检查环境`)]})]}),e?.stale&&(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs leading-relaxed text-ink-dim`,children:o(`下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。`)}),o((A||j||!e?.checked)&&(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:o(` 免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。 `)})),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[o((j||!e?.checked||e.stale)&&(0,J.jsxs)(`button`,{className:dp,disabled:n,onClick:()=>{c(!0),r(`repair`)},children:[(0,J.jsx)(Ye,{size:14}),o(`修复依赖`)]})),o(t.license&&(0,J.jsxs)(`button`,{className:dp,disabled:n,onClick:()=>{u(!l),m(``),f(``)},children:[(0,J.jsx)(nn,{size:14}),o(o(A?`配置 SHELX`:`SHELX 授权安装`))]}))]}),T&&(0,J.jsxs)(`div`,{className:`mt-3`,children:[(0,J.jsxs)(`button`,{type:`button`,className:dp,disabled:n,onClick:()=>{w(!C),S(!1)},children:[(0,J.jsx)(Ye,{size:14}),o(`准备 PLATON 官方环境`)]}),C&&(0,J.jsxs)(`form`,{className:`mt-3 rounded-lg bg-bg/70 p-3`,onSubmit:async e=>{e.preventDefault(),x&&await r(T.action,{accept_software_license:!0})&&(w(!1),S(!1),c(!0))},children:[(0,J.jsxs)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:[o(T.notice),` `,(0,J.jsx)(`a`,{href:T.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)})]}),(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5`}),o(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{type:`submit`,className:dp,disabled:n||!x,children:o(`下载、验证并配置`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>{w(!1),S(!1)},children:o(`取消`)})]})]})]}),o(l&&t.license&&(0,J.jsxs)(`form`,{onSubmit:M,className:`mt-4 rounded-lg bg-bg/70 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm`,children:[(0,J.jsxs)(`span`,{className:`font-medium`,children:[o(t.license.name),o(` 学术授权`)]}),(0,J.jsxs)(`a`,{href:t.license.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-blue`,children:[o(`前往官网申请`),(0,J.jsx)(qe,{size:11})]})]}),(0,J.jsx)(`p`,{className:`mb-3 mt-1.5 text-xs leading-relaxed text-ink-faint`,children:o(`填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。`)}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`用户名`),(0,J.jsx)(`input`,{"aria-label":o(`SHELX 用户名`),value:d,onChange:e=>f(e.target.value),required:!0,maxLength:200,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]}),(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`密码`),(0,J.jsx)(`input`,{"aria-label":o(`SHELX 密码`),type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,maxLength:500,autoComplete:`new-password`,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]})]}),o(D&&E&&(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-faint`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5`}),(0,J.jsxs)(`span`,{children:[o(E.text),` `,(0,J.jsx)(`a`,{href:E.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`查看许可 ↗`)})]})]})),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,J.jsxs)(`button`,{type:`submit`,className:dp,disabled:n||!d.trim()||!p.trim(),children:[(0,J.jsx)(Ye,{size:14}),o(`下载并安装 SHELX`)]}),(0,J.jsx)(`button`,{type:`button`,className:`px-2 text-xs text-ink-faint`,onClick:()=>{u(!1),f(``),m(``)},children:o(`取消`)})]})]})),s&&(0,J.jsxs)(`div`,{className:`mt-3`,"aria-label":o(`科学软件健康检查`),children:[o(!O.length&&(0,J.jsx)(`p`,{className:`py-2 text-xs text-ink-faint`,children:o(`点击“检查环境”可验证科学内核与外部程序。`)})),O.map(e=>(0,J.jsx)(`div`,{className:`border-b border-line/40 py-2.5 last:border-0`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[o(e.status===`ready`?(0,J.jsx)(We,{size:15,strokeWidth:1.7,className:`mt-0.5 shrink-0 text-blue/75`}):(0,J.jsx)(qt,{size:15,strokeWidth:1.5,className:`mt-0.5 shrink-0 text-ink-faint`})),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,J.jsx)(`span`,{children:o(e.name)}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-ink-faint`,children:o(e.status===`ready`?o(`可用`):e.license_required?o(`待授权安装`):o(`待修复`))})]}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-ink-faint`,children:o(e.description)}),(0,J.jsxs)(`details`,{className:`mt-1.5 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer hover:text-ink-dim`,children:o(e.status===`ready`?o(`查看检查详情`):o(`查看原因与安装方式`))}),(0,J.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words leading-relaxed`,children:o(e.detail)}),e.path&&(0,J.jsx)(`p`,{className:`mt-1 break-all leading-relaxed`,children:e.path}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[(0,J.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)}),o(e.id!==`python`&&t.actions.includes(`configure`)&&(0,J.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>{g(e.id),v(``)},className:`text-blue`,children:o(`使用已有安装`)}))]})]})]})]})},e.id)),o(h&&(0,J.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),await r(`configure`,{paths:{[h]:_}})&&(g(null),v(``))},className:`mt-3 rounded-lg bg-bg/70 p-3`,children:[(0,J.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(o(h===`dials`?`DIALS 环境目录`:h===`systre`?`Systre JAR 路径(需要已有 Java)`:`${h.toUpperCase()} 可执行文件路径`)),(0,J.jsx)(`input`,{required:!0,value:_,onChange:e=>v(e.target.value),className:`mt-2 w-full rounded-md border border-line bg-panel px-2 py-2 text-sm text-ink`})]}),(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-ink-faint`,children:o(`填写运行 Argus 的电脑上的路径,验证成功后生效。`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{className:dp,disabled:n,children:o(`验证并使用`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>g(null),children:o(`取消`)})]})]})),o(e?.checked&&(0,J.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[o(`最近检查 `),o(new Date(e.checked*1e3).toLocaleString()),o(` · 检查不调用模型`)]}))]})]})}function pp(e){return e.installed&&e.enabled&&e.supported?`ready`:e.managed_by_host?!e.supported||e.operation?.status===`failed`?`unavailable`:`preparing`:`manual`}var mp=e=>`正在准备 ${e} 工作台,首次需要几分钟`,hp=e=>`${e} 暂时无法使用`,gp=e=>`flex h-9 min-w-0 flex-1 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`;function _p({plugins:e,compact:t=!1,pending:n,onLaunch:r,onManage:i}){let a=lp(),o=e.filter(e=>pp(e)!==`manual`),s=!e.length||e.some(e=>pp(e)===`manual`);return(0,J.jsxs)(J.Fragment,{children:[o.map(e=>{let o=pp(e),s=!t&&(0,J.jsx)(`button`,{type:`button`,onClick:i,"aria-label":a(`管理 ${e.name}`),title:a(`管理 ${e.name}`),className:`icon-control mr-1 shrink-0 p-1.5 text-ink-faint hover:text-ink`,children:(0,J.jsx)(Xt,{size:15})});if(o===`ready`)return(0,J.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,J.jsxs)(`button`,{type:`button`,disabled:n===e.id,onClick:()=>r(e),title:e.name,"aria-label":e.name,className:`${gp(t)} disabled:opacity-60`,children:[(0,J.jsx)(Yt,{size:17,strokeWidth:1.5,className:`shrink-0 text-blue`}),!t&&(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),!t&&(0,J.jsx)(Vt,{size:13,className:`shrink-0 text-ink-faint`})]}),s]},e.id);let c=o===`preparing`?mp(e.name):hp(e.name),l=o===`preparing`?e.operation?.progress:e.operation?.error||e.reason;return(0,J.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,J.jsxs)(`div`,{role:`status`,title:a(l||c),className:`flex min-w-0 flex-1 items-center text-sm text-ink-faint ${t?`h-9 justify-center`:`gap-2 px-3 py-1.5`}`,children:[o===`preparing`?(0,J.jsx)(an,{size:17,strokeWidth:1.5,className:`shrink-0 animate-spin`}):(0,J.jsx)(Yt,{size:17,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,J.jsxs)(`div`,{className:`min-w-0 leading-snug`,children:[(0,J.jsx)(`p`,{children:a(c)}),l&&(0,J.jsx)(`p`,{className:`mt-0.5 truncate text-xs`,children:a(l)})]})]}),s]},e.id)}),s&&(0,J.jsx)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,children:(0,J.jsxs)(`button`,{type:`button`,onClick:i,title:a(`插件`),"aria-label":a(`插件`),className:gp(t),children:[(0,J.jsx)(q,{size:16,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,J.jsx)(`span`,{children:a(`插件`)})]})})]})}function vp({compact:e=!1}){let t=lp(),{locale:n}=z(),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)([]),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(!1),_=(0,G.useRef)(null),v=a.some(e=>pp(e)===`preparing`),y=a.length>0&&a.every(e=>e.managed_by_host);async function b(e){let n=await fetch(`/api/plugins`,{headers:L(),signal:e});if(!n.ok)throw Error(t(`无法读取插件列表`));let r=await n.json();e?.aborted||o(r.plugins)}(0,G.useEffect)(()=>{r||(m(null),g(!1))},[r]),(0,G.useEffect)(()=>{let e=new AbortController,t=()=>b(e.signal).catch(t=>{!e.signal.aborted&&r&&c(t.message)});r&&(_.current?.focus(),c(``),u(!0)),t().finally(()=>{e.signal.aborted||u(!1)});let n=r||v?window.setInterval(t,r?1500:4e3):0,a=e=>{e.key===`Escape`&&i(!1)};return r&&window.addEventListener(`keydown`,a),()=>{e.abort(),n&&window.clearInterval(n),window.removeEventListener(`keydown`,a)}},[r,v]);async function x(e,n,r){let i=e.setup?.windows_runtime;if(i&&!i.accepted&&[`install`,`update`,`repair`,i.action].includes(n)&&r?.accept_software_license!==!0)return m({pluginId:e.id,action:n}),g(!1),c(``),!1;f(e.id),c(``);try{let i=await fetch(`/api/plugins/${e.id}/${n===`launch`?`launch`:`manage/${n}`}`,{method:`POST`,headers:{...L(),"Content-Type":`application/json`},body:r?JSON.stringify(r):void 0}),a=await i.json();if(!i.ok)throw Error(a.detail||t(`插件操作未完成`));return n===`launch`?window.location.assign(a.url):await b(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{f(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_p,{plugins:a,compact:e,pending:d,onLaunch:e=>void x(e,`launch`),onManage:()=>i(!0)}),r&&(0,up.createPortal)((0,J.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:()=>i(!1),children:(0,J.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`plugin-title`,onClick:e=>e.stopPropagation(),className:`max-h-[85vh] w-full max-w-xl overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`h2`,{id:`plugin-title`,className:`text-lg font-semibold`,children:t(`插件`)}),(0,J.jsx)(`button`,{ref:_,type:`button`,"aria-label":t(`关闭插件列表`),className:`icon-control p-1.5`,onClick:()=>i(!1),children:(0,J.jsx)(Je,{size:18})})]}),(0,J.jsx)(`p`,{className:`mb-6 mt-2 text-sm text-ink-faint`,children:t(t(y?`研究工具由服务方提供,沿用 Argus 的模型与执行后端。`:`按需安装研究工具,沿用 Argus 的模型与执行后端。`))}),t(s&&(0,J.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-ink-dim`,children:t(s)})),t(l&&(0,J.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`正在读取插件…`)})),t(!l&&!a.length&&(0,J.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`暂无可用插件`)})),t(a.map(e=>{let r=e.operation?.status===`running`||d===e.id,i=r||!e.supported,a=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;return(0,J.jsxs)(`article`,{className:`rounded-xl border border-line/70 p-4`,"data-testid":`plugin-${e.id}`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(Yt,{size:24,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:t(e.name)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t(e.installed_version||e.version)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:t(e.description)})]})]}),(0,J.jsxs)(`div`,{className:`mt-4 text-xs text-ink-faint`,children:[t(e.installed?e.enabled?t(`已启用`):t(`已停用`):t(`未安装`)),t(` · 当前后端 `),t(Array.from(new Set(Object.values(e.backends))).join(` / `))]}),t(!e.supported&&(0,J.jsx)(`p`,{className:`mt-3 text-sm text-ink-dim`,children:t(e.reason)})),t(e.operation?.status===`running`&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-sm text-ink-dim`,children:[(0,J.jsx)(an,{size:14,className:`animate-spin`}),t(e.operation.progress)]})),t(e.operation?.status===`failed`&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-ink-dim`,children:t(e.operation.error)})),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[t(!e.installed&&!e.managed_by_host&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`install`),children:[(0,J.jsx)(Ye,{size:14}),t(`安装`)]})),t(e.installed&&e.enabled&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`launch`),children:[t(`打开工作台`),(0,J.jsx)(Vt,{size:14})]})),t(e.installed&&!e.enabled&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`enable`),children:t(`启用`)})),t(e.update_available&&!e.managed_by_host&&(0,J.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`update`),children:[(0,J.jsx)(Ke,{size:14}),e.environment_update?t(`更新科学环境校验`):(0,J.jsxs)(J.Fragment,{children:[t(`更新至 `),t(e.version)]})]})),t(e.installed&&e.enabled&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`disable`),children:t(`停用`)})),t(e.installed&&!e.managed_by_host&&(0,J.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`uninstall`),children:t(`卸载`)}))]}),p?.pluginId===e.id&&e.setup?.windows_runtime&&(0,J.jsxs)(`form`,{className:`mt-4 rounded-lg bg-bg/70 p-3`,onSubmit:async t=>{t.preventDefault(),!(!h||r)&&await x(e,p.action,{accept_software_license:!0})&&(m(null),g(!1))},children:[(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:t(`继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。`)}),(0,J.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:[t(e.setup.windows_runtime.notice),` `,(0,J.jsx)(`a`,{href:e.setup.windows_runtime.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:t(`官方安装说明 ↗`)})]}),(0,J.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`mt-0.5`}),t(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,J.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,J.jsx)(`button`,{type:`submit`,className:a,disabled:r||!h,children:t(`同意并继续`)}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,disabled:r,onClick:()=>{m(null),g(!1)},children:t(`取消`)})]})]}),(0,J.jsx)(`p`,{className:`mt-4 text-xs leading-relaxed text-ink-faint`,children:t(e.installed?t(`原生会话输入 ${e.command||``} 可启用后台工具。卸载保留会话、研究数据和科学软件。`):t(`首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。`))}),t(e.rights_notice&&(0,J.jsx)(`p`,{className:`mt-3 text-[10px] leading-relaxed text-ink-faint`,"data-testid":`plugin-rights-notice`,children:t(n===`zh-CN`&&e.rights_notice_zh||e.rights_notice)})),t(e.installed&&e.setup&&(0,J.jsx)(fp,{health:e.health,setup:e.setup,running:r,platform:e.platform,machine:e.machine,act:(t,n)=>x(e,t,n)}))]},e.id)}))]})}),document.body)]})}var yp=[`all`,`installed`,`available`,`builtin`],bp=[`install`,`update`,`enable`,`disable`,`uninstall`],xp=new Set([`install`,`update`,`uninstall`]),Sp={query:``,kind:`all`,tag:null};function Cp(e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}){return e.VITE_ARGUS_HOSTED_TRIAL===`1`}function wp(e,t){switch(t){case`all`:return!0;case`installed`:return e===`installed`||e===`package`;case`available`:return e===`available`;case`builtin`:return e===`builtin`}}function Tp(e,t){let n=t.trim().toLowerCase();return!n||[e.name,e.purpose,e.purpose_zh??``,...e.routing_path??[],...e.tags,...e.requires].join(` +`).toLowerCase().includes(n)}function Ep(e,t){return e.filter(e=>wp(e.kind,t.kind)&&(!t.tag||e.tags.includes(t.tag))&&(!t.routingPath||(e.routing_path??[]).join(`/`)===t.routingPath||(e.routing_path??[]).join(`/`).startsWith(`${t.routingPath}/`))&&Tp(e,t.query))}function Dp(e){let t=new Set;for(let n of e){let e=n.routing_path??[];for(let n=1;n<=e.length;n++)t.add(e.slice(0,n).join(`/`))}return[...t].sort()}function Op(e){let t=new Set;for(let n of e)for(let e of n.tags)e.trim()&&t.add(e.trim());return[...t].sort((e,t)=>e.localeCompare(t))}function kp(e,t){let n=t||e.managed_by_host;return e.actions.filter(e=>bp.includes(e)&&!(n&&xp.has(e)))}var Ap=e=>`verticals.action.${e}`,jp=e=>`verticals.kind.${e}`,Mp=e=>`verticals.filter.${e}`,Np=e=>`verticals.operation.${e}`;function Pp(e,t){return t===`zh-CN`&&e.purpose_zh&&e.purpose_zh.trim()?e.purpose_zh:e.purpose}function Fp(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function Ip(e){if(!e||e.status!==`running`)return null;let t=Number(e.progress);return!Number.isFinite(t)||t<=0?null:Math.max(0,Math.min(100,Math.round(t)))}var Lp=e=>e.operation?.status===`running`;function Rp(e){return e.some(Lp)}function zp(e,t){return e?t?1500:4e3:t?4e3:0}function Bp(e){if(e instanceof se){if(e.detail)return e.detail;let t=/^[A-Z]+ \S+ → \S+: ([\s\S]+)$/.exec(e.message);return t?t[1]:``}return e instanceof Error?e.message:String(e??``)}function Vp(e){return e instanceof se&&e.status===409}function Hp(e){return e instanceof se&&e.status===404}function Up(e,t){return Array.isArray(e)&&e.includes(t)}function Wp(e){return new Set(e.map(e=>e.name))}var Gp=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`,Kp=e=>`rounded-full border px-2.5 py-0.5 text-xs transition-colors ${e?`border-blue/60 bg-blue/10 text-blue`:`border-line text-ink-dim hover:border-blue/40 hover:text-ink`}`,qp=e=>`rounded px-1.5 py-0.5 text-[10px] font-semibold ${e===`ok`?`bg-ok/10 text-ok`:e===`warn`?`bg-warn/10 text-warn`:e===`blue`?`bg-blue/10 text-blue`:`bg-line text-ink-dim`}`,Jp={install:Ye,update:Ke,enable:mn,disable:pn,uninstall:vn};function Yp(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}catch{return n.toISOString()}}function Xp({compact:e=!1,onOpen:t}){let{t:n}=z();return(0,J.jsxs)(`button`,{type:`button`,onClick:t,title:n(`verticals.entry`),"aria-label":n(`verticals.entry`),"data-testid":`vertical-store-entry`,className:`mx-2 my-1 flex h-9 shrink-0 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`,children:[(0,J.jsx)(_n,{size:17,strokeWidth:1.5}),!e&&(0,J.jsx)(`span`,{children:n(`verticals.entry`)})]})}function Zp({row:e,locale:t,hosted:n,busy:r,failure:i,known:a,onAct:o,onJump:s,onTag:c}){let{t:l}=z(),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),m=Lp(e),h=r||m,g=kp(e,n),_=e.operation,v=Ip(_),y=e=>bp.includes(e)?l(Ap(e)):e,b=_&&bp.includes(_.action)?l(Np(_.action)):l(`verticals.operationRunning`),x=e.kind===`installed`?`ok`:e.kind===`available`?`neutral`:`blue`,S=async(t=!1)=>{d(!1),await o(e,`uninstall`,t?{force:!0}:void 0)};return(0,J.jsxs)(`article`,{id:`vertical-${e.name}`,"data-testid":`vertical-${e.name}`,"data-kind":e.kind,tabIndex:-1,className:`flex flex-col rounded-xl border border-line/70 p-4 outline-none focus-visible:border-blue/60`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(rn,{size:22,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`font-medium`,children:e.name}),(0,J.jsx)(`span`,{className:qp(x),"data-testid":`vertical-kind`,children:l(jp(e.kind))}),e.kind!==`available`&&(0,J.jsx)(`span`,{className:qp(e.enabled?`ok`:`neutral`),children:e.enabled?l(`verticals.enabled`):l(`verticals.disabledState`)}),e.update_available&&(0,J.jsx)(`span`,{className:qp(`warn`),"data-testid":`vertical-update`,children:l(`verticals.updateAvailable`)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:Pp(e,t)}),e.routing_path?.length?(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:e.routing_path.join(` / `)}):null]})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-ink-faint`,children:[e.installed_version&&(0,J.jsx)(`span`,{children:l(`verticals.installedVersion`,{version:e.installed_version})}),e.version&&e.version!==e.installed_version&&(0,J.jsx)(`span`,{children:l(`verticals.catalogVersion`,{version:e.version})}),e.size_bytes!=null&&(0,J.jsxs)(`span`,{children:[l(`verticals.size`),` `,Fp(e.size_bytes)]})]}),e.requires.length>0&&(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.requires`)}),e.requires.map(e=>a.has(e)&&s?(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e),"aria-label":l(`verticals.jumpTo`,{name:e}),title:l(`verticals.jumpTo`,{name:e}),className:`rounded-full border border-line px-2 py-0.5 font-mono text-ink-dim transition-colors hover:border-blue/60 hover:text-blue`,children:e},e):(0,J.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.shared.length>0&&(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,J.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.shared`)}),e.shared.map(e=>(0,J.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.tags.length>0&&(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.tags.map(e=>c?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint transition-colors hover:text-blue`,children:[`#`,e]},e):(0,J.jsxs)(`span`,{className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint`,children:[`#`,e]},e))}),e.missing_python.length>0&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-start gap-2 rounded-lg bg-warn/10 p-2.5 text-xs leading-relaxed text-warn`,"data-testid":`vertical-missing-python`,children:[(0,J.jsx)(yn,{size:14,className:`mt-0.5 shrink-0`}),(0,J.jsx)(`span`,{children:l(`verticals.missingPython`,{packages:e.missing_python.join(`, `)})})]}),!!e.runtime_issues?.length&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-runtime-issues`,children:l(`verticals.runtimeIssues`,{issues:e.runtime_issues.join(`; `)})}),!!e.install_issues?.length&&(0,J.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-install-issues`,children:l(`verticals.installIssues`,{issues:e.install_issues.join(`; `)})}),e.used_by.length>0&&(0,J.jsxs)(`div`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:()=>p(e=>!e),className:`inline-flex items-center gap-1 transition-colors hover:text-ink`,"data-testid":`vertical-used-by`,children:[e.used_by.length===1?l(`verticals.usedByOne`):l(`verticals.usedBy`,{count:e.used_by.length}),f?(0,J.jsx)(Wt,{size:12}):(0,J.jsx)(Ue,{size:12})]}),f&&(0,J.jsx)(`ul`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono`,children:e.used_by.map(e=>(0,J.jsx)(`li`,{className:`rounded bg-bg px-1.5 py-0.5`,children:e},e))})]}),m&&_&&(0,J.jsxs)(`div`,{className:`mt-3`,"data-testid":`vertical-progress`,children:[(0,J.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-ink-dim`,children:[(0,J.jsx)(an,{size:14,className:`animate-spin`}),(0,J.jsx)(`span`,{children:b}),v!=null&&(0,J.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-ink-faint`,children:[v,`%`]})]}),(0,J.jsx)(`div`,{role:`progressbar`,"aria-label":b,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":v??void 0,className:`mt-1.5 h-1 overflow-hidden rounded bg-line`,children:v==null?(0,J.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`}):(0,J.jsx)(`div`,{className:`h-full rounded bg-blue transition-[width] duration-500`,style:{width:`${v}%`}})}),_.message&&(0,J.jsx)(`p`,{className:`mt-1 break-words text-xs text-ink-faint`,children:_.message})]}),_?.status===`failed`&&(0,J.jsxs)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-err`,"data-testid":`vertical-operation-failed`,children:[l(`verticals.operationFailed`,{action:y(_.action)}),_.message?` — ${_.message}`:``]}),i&&(0,J.jsxs)(`div`,{role:`alert`,className:`mt-3 rounded-lg border border-err/30 bg-err/5 p-2.5 text-sm text-ink-dim`,"data-testid":`vertical-failure`,children:[(0,J.jsx)(`p`,{className:`break-words`,children:i.text}),i.offerForce&&(0,J.jsxs)(`button`,{type:`button`,className:`${Gp} mt-2 border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(!0),children:[(0,J.jsx)(vn,{size:14}),l(`verticals.removeAnyway`)]})]}),g.length>0&&(0,J.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:g.map(t=>{let n=Jp[t];if(t===`uninstall`)return u?(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`${Gp} border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(),"data-testid":`vertical-confirm-uninstall`,children:[(0,J.jsx)(vn,{size:14}),l(`verticals.confirmUninstall`)]}),(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint hover:text-ink`,onClick:()=>d(!1),children:l(`common.cancel`)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:l(`verticals.confirmUninstallHint`,{name:e.name})})]},t):(0,J.jsxs)(`button`,{type:`button`,className:Gp,disabled:h,onClick:()=>d(!0),"data-action":t,children:[(0,J.jsx)(n,{size:14}),l(Ap(t))]},t);let r=t===`update`&&e.version?l(`verticals.updateTo`,{version:e.version}):l(Ap(t));return(0,J.jsxs)(`button`,{type:`button`,className:Gp,disabled:h,onClick:()=>void o(e,t),"data-action":t,children:[(0,J.jsx)(n,{size:14}),r]},t)})})]})}function Qp({payload:e,filter:t,onFilter:n,hosted:r,supported:i,loading:a,refreshing:o,error:s,pending:c,failures:l,onAct:u,onRefresh:d,onJump:f}){let{t:p,locale:m}=z(),h=e?.verticals??[],g=(0,G.useMemo)(()=>Op(h),[h]),_=(0,G.useMemo)(()=>Dp(h),[h]),v=(0,G.useMemo)(()=>Wp(h),[h]),y=(0,G.useMemo)(()=>Ep(h,t),[h,t]),b=t.query.trim()!==``||t.kind!==`all`||t.tag!==null||!!t.routingPath,x=e?.catalog;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:p(r?`verticals.hostedNote`:`verticals.intro`)}),i===!1&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-4 rounded-lg border border-line bg-bg/70 p-3 text-sm text-ink-dim`,"data-testid":`vertical-store-too-old`,children:p(`verticals.tooOld`)}),i!==!1&&(0,J.jsxs)(J.Fragment,{children:[x&&(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-faint`,"data-testid":`vertical-catalog`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,title:x.source,children:p(`verticals.catalogSource`,{source:x.source})}),x.release_tag&&(0,J.jsx)(`span`,{className:`rounded bg-bg px-1.5 py-0.5 font-mono`,children:p(`verticals.catalogRelease`,{tag:x.release_tag})}),(0,J.jsx)(`span`,{children:x.fetched_at?p(`verticals.catalogFetched`,{time:Yp(x.fetched_at,m)}):p(`verticals.catalogNever`)}),(0,J.jsxs)(`button`,{type:`button`,className:`${Gp} ml-auto`,disabled:o||a,onClick:d,"data-testid":`vertical-refresh-catalog`,children:[(0,J.jsx)(Ke,{size:14,className:o?`animate-spin`:``}),p(o?`verticals.refreshing`:`verticals.refreshCatalog`)]})]}),x?.error&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 rounded-lg border border-warn/40 bg-warn/10 p-2.5 text-sm text-warn`,"data-testid":`vertical-catalog-error`,children:p(`verticals.catalogError`,{error:x.error})}),s&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-err`,"data-testid":`vertical-store-error`,children:s}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-line bg-bg px-2.5 focus-within:border-blue/60`,children:[(0,J.jsx)(ot,{size:14,className:`shrink-0 text-ink-faint`}),(0,J.jsx)(`span`,{className:`sr-only`,children:p(`verticals.search`)}),(0,J.jsx)(`input`,{type:`search`,value:t.query,onChange:e=>n({...t,query:e.target.value}),placeholder:p(`verticals.searchPlaceholder`),className:`min-w-0 flex-1 bg-transparent text-sm text-ink outline-none placeholder:text-ink-faint`})]}),(0,J.jsx)(`div`,{role:`group`,"aria-label":p(`verticals.kindFilter`),className:`flex flex-wrap gap-1`,children:yp.map(e=>(0,J.jsx)(`button`,{type:`button`,"aria-pressed":t.kind===e,onClick:()=>n({...t,kind:e}),className:`h-8 rounded-md px-2.5 text-xs font-medium transition-colors ${t.kind===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:p(Mp(e))},e))})]}),_.length>0&&(0,J.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink-faint`,children:[p(`verticals.routingPath`),(0,J.jsxs)(`select`,{className:`rounded-md border border-line bg-bg p-1.5`,value:t.routingPath??``,onChange:e=>n({...t,routingPath:e.target.value}),children:[(0,J.jsx)(`option`,{value:``,children:p(`verticals.filter.all`)}),_.map(e=>(0,J.jsx)(`option`,{value:e,children:e.replaceAll(`/`,` / `)},e))]})]}),(g.length>0||b)&&(0,J.jsxs)(`div`,{role:`group`,"aria-label":p(`verticals.tagFilter`),className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[g.map(e=>(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":t.tag===e,className:Kp(t.tag===e),onClick:()=>n({...t,tag:t.tag===e?null:e}),children:[`#`,e]},e)),b&&(0,J.jsx)(`button`,{type:`button`,className:`ml-1 text-xs text-ink-faint hover:text-ink`,onClick:()=>n(Sp),children:p(`verticals.clearFilters`)})]}),h.length>0&&(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`verticals.count`,{shown:y.length,total:h.length})}),a&&!e&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.loading`)}),e&&h.length===0&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.none`)}),h.length>0&&y.length===0&&(0,J.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.noMatches`)}),y.length>0&&(0,J.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,"data-testid":`vertical-grid`,children:y.map(e=>(0,J.jsx)(Zp,{row:e,locale:m,hosted:r,busy:c===e.name,failure:l[e.name],known:v,onAct:u,onJump:f,onTag:e=>n({...t,tag:e})},e.name))})]})]})}function $p({open:e,onClose:t}){let{t:n}=z(),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)({}),[_,v]=(0,G.useState)(Sp),y=(0,G.useRef)(null),b=(0,G.useRef)(t);b.current=t;let x=(0,G.useRef)(n);x.current=n;let S=Rp(r?.verticals??[]),C=!!r?.host.managed_by_host||Cp();(0,G.useEffect)(()=>{if(!e||a!==null)return;let t=!1;return R.meta().then(e=>{t||o(Up(e.capabilities,le))},()=>{t||o(!0)}),()=>{t=!0}},[e,a]),(0,G.useEffect)(()=>{if(a!==!0||!e&&!S)return;let t=new AbortController,n=()=>R.verticals(t.signal).then(e=>{t.signal.aborted||(i(e),f(e=>e?.source===`load`?null:e))},n=>{t.signal.aborted||(Hp(n)?o(!1):e&&f({text:x.current(`verticals.loadFailed`),source:`load`}))});e&&c(!0),n().finally(()=>{t.signal.aborted||c(!1)});let r=zp(e,S),s=r?window.setInterval(n,r):0;return()=>{t.abort(),s&&window.clearInterval(s)}},[e,S,a]),(0,G.useEffect)(()=>{if(!e){g({}),f(e=>e?.source===`refresh`?null:e);return}y.current?.focus();let t=e=>{e.key===`Escape`&&b.current()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let w=(0,G.useCallback)(async()=>{try{i(await R.verticals()),f(e=>e?.source===`load`?null:e)}catch(e){Hp(e)?o(!1):f({text:x.current(`verticals.loadFailed`),source:`load`})}},[]),T=(0,G.useCallback)(async(e,t,n={})=>{m(e.name),g(t=>{let{[e.name]:n,...r}=t;return r});try{return await R.manageVertical(e.name,t,n),await w(),!0}catch(r){let i=Bp(r)||x.current(`verticals.actionFailed`),a=t===`uninstall`&&Vp(r)&&!n.force;return g(t=>({...t,[e.name]:{text:i,offerForce:a}})),!1}finally{m(null)}},[w]),E=(0,G.useCallback)(async()=>{u(!0),f(null);try{i(await R.refreshVerticalCatalog())}catch(e){f({text:Bp(e)||x.current(`verticals.loadFailed`),source:`refresh`})}finally{u(!1)}},[]),D=(0,G.useCallback)(e=>{v(Sp),!(typeof document>`u`)&&window.setTimeout(()=>{let t=document.getElementById(`vertical-${e}`);t?.scrollIntoView?.({block:`nearest`,behavior:`smooth`}),t?.focus?.()},0)},[]);return e?(0,up.createPortal)((0,J.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:t,children:(0,J.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`vertical-store-title`,onClick:e=>e.stopPropagation(),className:`flex max-h-[85vh] w-full max-w-4xl flex-col overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl scroll-thin`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`h2`,{id:`vertical-store-title`,className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,J.jsx)(_n,{size:20,strokeWidth:1.5,className:`text-blue`}),n(`verticals.title`)]}),(0,J.jsx)(`button`,{ref:y,type:`button`,"aria-label":n(`verticals.close`),className:`icon-control p-1.5`,onClick:t,children:(0,J.jsx)(Je,{size:18})})]}),(0,J.jsx)(Qp,{payload:r,filter:_,onFilter:v,hosted:C,supported:a,loading:s,refreshing:l,error:d?.text??``,pending:p,failures:h,onAct:T,onRefresh:()=>void E(),onJump:D})]})}),document.body):null}function em(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)||e}function tm(e,t,n){if(e.length===0)return`local`;let r=n.trim(),i=r?e.filter(e=>e.launch_cwd?.trim()===r):[];return i.length===0||t&&!i.some(e=>e.id===t)?`all`:`local`}function nm({projects:e,activeId:t,activeWork:n,localCwd:r,onSelect:i,onPrefetch:a,onManage:s,onResume:c,resumingId:l,onOpenPanel:u,onOpenLearning:d,onOpenVerticals:f,onNew:p,loading:m,creating:h=!1,error:g,onRetry:y,mobileOpen:x=!1,collapsed:T=!1,onToggleCollapse:E,themeMode:O,onCycleTheme:k}){let{t:A,locale:j}=z(),[M,ee]=(0,G.useState)(`local`),N=(0,G.useRef)(!1),[P,F]=(0,G.useState)(``),[te,ne]=(0,G.useState)(()=>new Set),re=T&&!x,ie=r.trim(),I=(0,G.useMemo)(()=>ie?e.filter(e=>e.launch_cwd?.trim()===ie):[],[ie,e]);(0,G.useEffect)(()=>{N.current||m||e.length===0||(N.current=!0,ee(tm(e,t,ie)))},[t,m,ie,e]);let L=M===`local`?I:e,ae=P.trim()?ef(L,P):L,oe=(0,G.useMemo)(()=>{if(M===`local`)return ae.length>0?[[ie||`Local`,ae]]:[];let e=new Map;return ae.forEach(t=>{let n=t.launch_cwd?.trim()||A(`common.unassigned`),r=e.get(n)??[];r.push(t),e.set(n,r)}),[...e.entries()]},[ie,M,ae]),se=e=>te.has(e)&&!P.trim();return(0,J.jsxs)(rt,{mobileOpen:x,collapsed:T,children:[(0,J.jsx)(`div`,{className:`chrome-seam-surface flex h-12 shrink-0 items-center border-b border-line/50 ${re?`justify-center`:`justify-between px-4`}`,children:re?(0,J.jsx)(jt,{size:22,compact:!0}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(jt,{size:24}),(0,J.jsx)(`button`,{type:`button`,onClick:E,"aria-label":A(`sidebar.collapse`),title:`${A(`sidebar.collapse`)} · Ctrl/⌘ B`,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,J.jsx)(o,{icon:C,className:`h-3.5 w-3.5`})})]})}),re?(0,J.jsx)(`div`,{className:`flex h-12 shrink-0 items-center justify-center`,children:(0,J.jsx)(`button`,{type:`button`,onClick:E,"aria-label":A(`sidebar.expand`),title:`${A(`sidebar.expand`)} · Ctrl/⌘ B`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink`,children:(0,J.jsx)(o,{icon:v,className:`h-3.5 w-3.5`})})}):null,re?(0,J.jsx)(vp,{compact:!0}):null,re&&f?(0,J.jsx)(Xp,{compact:!0,onOpen:f}):null,re&&d?(0,J.jsx)(pr,{onOpen:d,compact:!0}):null,re?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`nav`,{"aria-label":j===`zh-CN`?`工具与知识`:`Tools and knowledge`,"data-sidebar-resources":!0,className:`shrink-0 overflow-y-auto overscroll-contain border-b border-line/50 px-2 py-2 scroll-thin [&>section]:mx-2 [&>section]:border-0 [&>section]:py-0 [&>section>div>button:first-child]:px-3`,style:{maxHeight:`min(40dvh, 360px)`},children:[(0,J.jsx)(vp,{}),d&&(0,J.jsx)(pr,{onOpen:d}),(0,J.jsxs)(`details`,{className:`sidebar-tools mx-2 mt-1`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer px-2 py-2 text-xs text-ink-dim`,children:j===`zh-CN`?`更多工具与资源`:`More tools and resources`}),f?(0,J.jsx)(Xp,{onOpen:f}):null,null]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pb-1 pt-3`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:j===`zh-CN`?`项目`:`Projects`}),I.length>0&&I.lengthee(e.target.value),className:`min-w-0 bg-transparent text-xs text-ink-faint`,children:[(0,J.jsx)(`option`,{value:`local`,children:A(`common.local`)}),(0,J.jsx)(`option`,{value:`all`,children:A(`common.all`)})]}):null,(0,J.jsx)(`button`,{type:`button`,onClick:p,disabled:h,"aria-label":A(`sidebar.create`),title:A(`sidebar.create`),className:`ml-auto flex h-8 items-center justify-center rounded-md px-2 text-xs text-ink-dim hover:bg-bg disabled:opacity-40`,children:h?`…`:j===`zh-CN`?`+ 新建`:`+ New`})]}),(0,J.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,J.jsx)(`label`,{className:`sr-only`,htmlFor:`daemon-search`,children:A(`sidebar.find`)}),(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-line/60 bg-bg/60 px-2 focus-within:border-blue/60`,children:[(0,J.jsx)(`input`,{id:`daemon-search`,value:P,onChange:e=>F(e.target.value),placeholder:A(`sidebar.find`),className:`h-8 min-w-0 flex-1 bg-transparent text-xs text-ink outline-none placeholder:text-ink-faint`}),P?(0,J.jsx)(`button`,{type:`button`,"aria-label":A(`sidebar.clearSearch`),onClick:()=>F(``),className:`px-1 text-sm text-ink-faint hover:text-ink`,children:`×`}):null]})]}),(0,J.jsxs)(`div`,{className:`mobile-scroll-region min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-3 pb-3 scroll-thin`,children:[m&&e.length===0?(0,J.jsx)(`div`,{className:`px-1 py-3 text-xs text-ink-faint`,children:A(`common.loading`)}):null,g?(0,J.jsx)(`button`,{type:`button`,onClick:y,className:`mb-2 w-full rounded-md bg-err/5 px-3 py-2 text-left text-xs text-err`,children:A(`sidebar.refreshFailed`)}):null,!m&&!g&&ae.length===0?(0,J.jsxs)(`div`,{className:`px-1 py-4 text-xs text-ink-faint`,children:[(0,J.jsx)(`div`,{children:P.trim()?A(`sidebar.noMatches`,{query:P.trim()}):A(`sidebar.noSessions`)}),P.trim()?(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(``),className:`mt-2 text-xs text-ink-dim underline underline-offset-2 hover:text-ink`,children:A(`sidebar.clearSearch`)}):null]}):null,oe.map(([e,r])=>(0,J.jsxs)(`section`,{className:`mb-1 last:mb-0`,children:[r.length>1&&oe.length>1?(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":!se(e),title:e,onClick:()=>ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),className:`mb-1 flex h-7 w-full items-center gap-2 rounded-md px-1.5 text-left text-[11px] font-medium text-ink-faint hover:bg-bg/70 hover:text-ink-dim`,children:[(0,J.jsx)(o,{icon:S,className:`h-2.5 w-2.5 transition-transform ${se(e)?`-rotate-90`:``}`}),(0,J.jsx)(o,{icon:b,className:`h-3 w-3`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:em(e)})]}):null,r.length===1||oe.length===1||!se(e)?r.map(e=>{let r=e.id===t,u=r&&n?.sessionId===e.id?n:void 0,d=u?pi(u.status,j,u.connected):void 0,f=Jd(e),p=f?(e.label||e.display_name||``).trim():e.objective.trim()||A(`sidebar.unnamedSession`),m=e.daemon_alive&&e.daemon_protocol_compatible===!1,h=m&&e.daemon_protocol_error===`daemon release is incompatible with WebAPI release`,g=m&&!h,_=!e.daemon_alive&&e.last_active>0&&!!e.workdir?.trim();return(0,J.jsxs)(`div`,{"data-active":r?`true`:`false`,onPointerEnter:()=>{r||a?.(e.id)},className:`session-card group relative mb-0.5 h-14 w-full rounded-md transition-colors duration-150 ease-panel ${r?`text-ink`:`text-ink-dim hover:text-ink`}`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`absolute left-0 transition-colors ${r?`inset-y-1 w-px bg-blue`:`inset-y-2 w-px bg-transparent group-hover:bg-ink-faint/30`}`}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),onFocus:()=>{r||a?.(e.id)},"aria-current":r?`page`:void 0,title:`${p}${!f&&p!==e.id?` · ${e.id}`:``}${e.objective&&e.objective!==p?` — ${e.objective}`:``}`,className:`flex h-14 w-full min-w-0 flex-col justify-center px-2.5 text-left ${_?`pr-[4.75rem]`:`pr-10`}`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(ct,{ok:e.daemon_alive&&!g,title:g?A(`sidebar.updateRequired`):e.daemon_alive?A(`sidebar.daemonAlive`):A(`sidebar.stopped`)}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:p})]}),(0,J.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5 pl-3.5 text-[11px] text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate ${g?`text-warn`:``}`,title:d,"data-session-work-state":u?.status.state,children:g?A(`sidebar.updateRequired`):d??(e.daemon_alive?A(`sidebar.runningFor`,{uptime:St(e.uptime_seconds)}):e.last_active>0?A(`sidebar.lastActive`,{time:wt(e.last_active,j)}):A(`sidebar.stopped`))}),h&&(0,J.jsx)(`span`,{title:A(`sidebar.updateAvailableHint`),className:`shrink-0 rounded border border-line px-1 text-[10px] leading-4`,children:A(`sidebar.updateAvailable`)})]})]}),_&&c?(0,J.jsx)(`button`,{type:`button`,disabled:l!=null,onClick:t=>{t.stopPropagation(),c(e.id)},"aria-label":A(`sidebar.resume`),title:A(`sidebar.resumeHint`,{workdir:e.workdir??``}),className:`absolute right-9 top-3 flex h-8 w-8 items-center justify-center rounded-md text-blue opacity-100 hover:bg-blue/10 disabled:opacity-40 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:l===e.id?`…`:(0,J.jsx)(o,{icon:D,className:`h-3 w-3`})}):null,(0,J.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),s(e.id)},"aria-label":A(`sidebar.manage`,{name:p}),title:A(`sidebar.manageHint`),className:`absolute right-1 top-3 flex h-8 w-8 items-center justify-center rounded-md text-ink-faint opacity-100 transition-opacity hover:bg-panel-raised hover:text-ink sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,J.jsx)(o,{icon:w,className:`h-4 w-4`})})]},e.id)}):null]},e))]}),(0,J.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between border-t border-line/50 px-4 py-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`config`),className:`icon-control flex h-8 w-8 items-center justify-center`,"aria-label":A(`sidebar.openSettings`),title:A(`common.settings`),children:(0,J.jsx)(o,{icon:_,className:`h-3.5 w-3.5`})}),(0,J.jsx)(pt,{themeMode:O,onCycleTheme:k})]})]})]})}var rm=new Set([`done`,`completed`,`failed`,`skipped`]);function im(e){return rm.has(e.status)}function am(e,t){return e.filter(e=>im(e)===t)}var om={in_progress:`rgb(var(--blue))`,running:`rgb(var(--blue))`,pending:`rgb(var(--ink-faint))`,queued:`rgb(var(--ink-faint))`,done:`rgb(var(--blue))`,completed:`rgb(var(--blue))`,blocked:`rgb(var(--err))`,failed:`rgb(var(--err))`};function sm({items:e,onDispose:t,onStop:n,onInspect:r,busy:i,readOnly:a=!1}){let{t:o}=z(),[s,c]=(0,G.useState)(!1),l=am(e,!1),u=am(e,!0),d=s?u:l;return(0,J.jsxs)(`section`,{className:`card flex flex-col ${d.length>0?`min-h-0 flex-1`:`shrink-0`}`,children:[(0,J.jsx)(U,{title:o(`panel.backlog`),right:(0,J.jsx)(`button`,{className:`text-[10px] text-ink-faint transition-colors hover:text-ink`,onClick:()=>c(e=>!e),children:o(s?`backlog.active`:`backlog.history`,{count:s?l.length:u.length})})}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[d.length===0&&(0,J.jsx)($e,{children:o(s?`backlog.noHistory`:`backlog.empty`)}),d.map(e=>{let s=om[e.status]??`rgb(var(--ink-faint))`,c=e.iterate;return(0,J.jsx)(`div`,{className:`group border-b border-line/60 px-3 py-2 last:border-0`,children:(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>r?.(e.id),disabled:!r,className:`block max-w-full truncate text-left text-xs font-medium text-ink enabled:hover:text-blue-sky enabled:focus-visible:outline-none enabled:focus-visible:underline`,title:r?o(`backlog.viewDetails`):void 0,children:e.title||e.objective}),(0,J.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[(0,J.jsx)(at,{color:s,children:Rn(e.status,o)}),typeof e.priority==`number`&&(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:Bn(e.priority,o)}),c&&(0,J.jsxs)(`span`,{className:`text-[10px] text-blue-sky`,children:[`↻ `,o(`backlog.iterating`)]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100`,children:[!a&&c&&(0,J.jsx)(W,{variant:`ghost`,onClick:()=>n(e.id),disabled:i,title:o(`backlog.stopIterating`),children:o(`backlog.stop`)}),!a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(W,{variant:`ghost`,onClick:()=>t(e.id,`done`),disabled:i,title:o(`backlog.markDone`),children:`✓`}),(0,J.jsx)(W,{variant:`ghost`,onClick:()=>t(e.id,`rm`),disabled:i,title:o(`backlog.remove`),children:`✕`})]})]})]})},e.id)})]})]})}var cm={win:`rgb(var(--blue))`,milestone:`rgb(var(--blue))`,insight:`rgb(var(--ink-dim))`,decision:`rgb(var(--ink-dim))`,failure:`rgb(var(--err))`,note:`rgb(var(--ink-faint))`};function lm({entries:e}){let{t}=z(),n=[...e].reverse();return(0,J.jsxs)(`section`,{className:`card flex min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(U,{title:t(`panel.journal`),right:(0,J.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.length})}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[e.length===0&&(0,J.jsx)($e,{children:`no journal entries yet`}),n.map(e=>{let t=cm[e.kind]??`rgb(var(--ink-faint))`,n=String(e.extra?.pricing_status??``),r=e.extra&&Object.prototype.hasOwnProperty.call(e.extra,`cost_usd`)?e.extra.cost_usd:e.cost_usd,i=typeof r==`number`&&r>0?`${bt(r)}${n===`partial`||n===`unpriced`?`+`:``}`:n===`partial`||n===`unpriced`?n:``;return(0,J.jsxs)(`div`,{className:`border-b border-line/60 px-3 py-2 last:border-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full`,style:{background:t}}),(0,J.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide`,style:{color:t},children:e.kind}),(0,J.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:Dt(e.ts)})]}),(0,J.jsx)(`div`,{className:`mt-1 text-xs font-medium text-ink`,children:e.title}),e.summary&&(0,J.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-snug text-ink-dim`,children:e.summary}),(0,J.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(e.tags??[]).slice(0,4).map(e=>(0,J.jsx)(`span`,{className:`rounded bg-line/60 px-1 text-[9px] text-ink-faint`,children:e},e)),i?(0,J.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:i}):null]})]},e.id)})]})]})}function um(e){return e==null?``:e<3?`now`:e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h`}function dm({roles:e}){let{t}=z(),n=new Map(e.map(e=>[e.role,e])),r=et.map(e=>n.get(e)).filter(Boolean),i=e.filter(e=>!gt(e.role)),a=[...r,...i];return(0,J.jsxs)(`section`,{className:`card`,children:[(0,J.jsx)(U,{title:t(`panel.roles`)}),(0,J.jsx)(`div`,{children:a.map(e=>{let n=B.role[e.role]??B.info;return(0,J.jsxs)(`div`,{className:`grid grid-cols-[84px_minmax(0,1fr)_auto] items-center gap-2 border-b border-line/60 px-3 py-2 last:border-b-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{"data-role-dot":e.role,"aria-hidden":`true`,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{background:n}}),(0,J.jsx)(`span`,{className:`text-[11px] font-medium capitalize`,style:{color:e.active?n:B.inkDim},children:gt(e.role)?Ve(e.role,t):e.role})]}),(0,J.jsx)(`div`,{className:`min-w-0 truncate font-mono text-[10px] text-ink-faint`,title:e.model,children:e.model||`—`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 text-right`,children:[(0,J.jsx)(`span`,{className:`text-[10px]`,style:{color:e.active?B.ink:B.inkFaint},children:e.active?e.status||`active`:`idle`}),e.active&&um(e.age_s)&&(0,J.jsxs)(`span`,{className:`text-[10px] tabular-nums text-ink-faint`,children:[`· `,um(e.age_s)]}),e.effort&&(0,J.jsxs)(`span`,{className:`text-[10px]`,style:{color:Ze(e.effort)},children:[`· `,e.effort]})]})]},e.role)})})]})}function fm({open:e,snap:t,journal:n,busy:r,onClose:i,onDispose:a,onStop:o,onInspect:s}){let{t:c}=z();return(0,J.jsxs)(dt,{open:e,onClose:i,label:`Project inspector`,width:`max-w-6xl`,children:[(0,J.jsx)(lt,{title:c(`panel.project`),sub:t.session.display_name||t.session.id}),(0,J.jsxs)(`div`,{className:`h-[68vh] min-h-0 space-y-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid lg:grid-cols-[minmax(0,1.4fr)_minmax(300px,0.8fr)] lg:gap-3 lg:space-y-0 lg:overflow-hidden`,children:[(0,J.jsx)(sm,{items:t.backlog,onDispose:a,onStop:o,onInspect:s,busy:r}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,J.jsx)(dm,{roles:t.roles}),(0,J.jsx)(lm,{entries:n})]})]})]})}var pm=e=>e?new Date(e*1e3).toLocaleString():`—`;function mm({label:e,value:t}){return(0,J.jsxs)(`div`,{className:`rounded-md border border-line/70 bg-bg/40 px-3 py-2`,children:[(0,J.jsx)(`div`,{className:`text-[9px] font-semibold uppercase tracking-wider text-ink-faint`,children:e}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:t})]})}function hm({sid:e,itemId:t,onClose:n,onDone:r,onSkip:i,onStop:a,busy:o,readOnly:s=!1}){let{t:c}=z(),l=ke(e,t),u=l.data,d=u?im(u):!1,f=Vn(u?.outcome,c);return(0,J.jsxs)(dt,{open:!!t,onClose:n,label:c(`task.details`),width:`max-w-3xl`,showClose:!1,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 border-b border-line px-4 py-3 sm:flex-nowrap sm:px-5`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink`,children:u?.title||c(`task.details`)}),u?(0,J.jsx)(at,{children:Rn(u.status,c)}):null]})}),!s&&u&&!d?(0,J.jsxs)(`div`,{className:`order-3 flex w-full shrink-0 items-center justify-end gap-1 sm:order-none sm:w-auto`,children:[u.iterate?(0,J.jsx)(W,{onClick:()=>a(u.id),disabled:o,children:c(`task.stopLoop`)}):null,(0,J.jsx)(W,{onClick:()=>r(u.id),disabled:o,children:c(`task.done`)}),(0,J.jsx)(W,{variant:`danger`,onClick:()=>i(u.id),disabled:o,children:c(`task.skip`)})]}):null,(0,J.jsx)(`button`,{type:`button`,"aria-label":c(`task.close`),onClick:n,className:`order-2 rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink sm:order-none`,children:`×`})]}),(0,J.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto p-4 scroll-thin sm:p-5`,children:[l.isLoading?(0,J.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,J.jsx)(tt,{})}):null,l.isError?(0,J.jsx)(`div`,{className:`rounded-md border border-err/40 bg-err/5 p-3 text-xs text-err`,children:l.error.message}):null,u?(0,J.jsxs)(`div`,{className:`space-y-4`,children:[u.pending_question?(0,J.jsxs)(`div`,{className:`rounded-lg border border-warn/40 bg-warn/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-warn`,children:c(`task.waitingOnYou`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:u.pending_question})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.objective`)}),(0,J.jsx)(`div`,{className:`whitespace-pre-wrap rounded-lg border border-line bg-bg/50 p-3 text-sm leading-relaxed text-ink-dim`,children:u.objective||u.original_objective||c(`task.noObjective`)})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[(0,J.jsx)(mm,{label:c(`task.priority`),value:Bn(u.priority,c)}),(0,J.jsx)(mm,{label:c(`task.started`),value:pm(u.started_ts)}),(0,J.jsx)(mm,{label:c(`task.finished`),value:pm(u.finished_ts)})]}),f.length?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.outcome`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,J.jsx)(at,{children:e},e))})]}):null,u.iterate||u.iteration_cycles_done||u.iteration_cost_usd?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.iteration`)}),(0,J.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,J.jsx)(mm,{label:c(`task.mode`),value:u.iterate?c(`task.autoIterate`):c(`task.singlePass`)}),(0,J.jsx)(mm,{label:c(`task.cycles`),value:`${u.iteration_cycles_done??0}/${u.iteration_max_cycles??`—`}`}),(0,J.jsx)(mm,{label:c(`task.cost`),value:`$${(u.iteration_cost_usd??0).toFixed(2)}`})]})]}):null,u.last_error?(0,J.jsxs)(`section`,{className:`rounded-lg border border-err/30 bg-err/5 p-3`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:c(`task.lastError`)}),(0,J.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs leading-relaxed text-ink-dim`,children:u.last_error})]}):null,u.notes?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.notes`)}),(0,J.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-relaxed text-ink-dim`,children:u.notes})]}):null,u.tags?.length||u.deps?.length?(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(u.tags??[]).map(e=>(0,J.jsxs)(at,{children:[`#`,e]},`tag-${e}`)),u.deps?.length?(0,J.jsx)(at,{children:c(`task.dependsOnCount`,{count:u.deps.length})}):null]}):null]}):null]})]})}function gm({onPointerDown:e,onReset:t,onNudge:n,value:r,min:i=240,max:a=600,label:o=`Resize panel`}){return(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":o,"aria-valuenow":r,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:e,onDoubleClick:t,onKeyDown:e=>{e.key===`ArrowLeft`?(e.preventDefault(),n(-16)):e.key===`ArrowRight`?(e.preventDefault(),n(16)):e.key===`Home`&&(e.preventDefault(),t())},className:`group relative hidden w-2 shrink-0 cursor-col-resize items-center justify-center outline-none lg:flex`,children:(0,J.jsx)(`span`,{className:`h-full w-px bg-line/30 transition-colors duration-150 group-hover:bg-blue/70 group-focus:bg-blue/70`})})}function _m({sid:e,record:t,expanded:n=!1,zh:r}){let[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(``);(0,G.useEffect)(()=>{if(!i||!e)return;let n=new AbortController;return l(!0),d(``),R.workRecord(e,t.role,t.id,n.signal).then(e=>{n.signal.aborted||s(e.detail)}).catch(e=>{n.signal.aborted||d(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||l(!1)}),()=>n.abort()},[i,e,t.id,t.role,t.detail]);let f=o.length>=t.detail.length?o:t.detail;return(0,J.jsxs)(`details`,{open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,J.jsxs)(`summary`,{children:[(0,J.jsx)(`span`,{children:i?r?`收起详情`:`Hide details`:r?`展开完整记录`:`Read full record`}),(0,J.jsx)(Ue,{size:12})]}),(0,J.jsxs)(J.Fragment,{children:[c&&(0,J.jsx)(`small`,{role:`status`,children:r?`正在读取完整记录…`:`Loading the full record…`}),u&&(0,J.jsx)(`small`,{role:`status`,children:r?`暂未读取到完整记录,已显示保存的摘要。可收起后重试。`:`Full record unavailable; the saved preview is shown. Reopen to retry.`}),(0,J.jsx)(`div`,{className:`agent-record-actions`,children:(0,J.jsx)(Qe,{text:f,label:r?`复制完整记录`:`Copy full record`,copiedLabel:r?`已复制`:`Copied`})}),(0,J.jsx)(`div`,{className:`agent-record-detail`,children:(0,J.jsx)(H,{children:f})}),t.round_index!=null&&(0,J.jsx)(`small`,{children:r?`第 ${t.round_index} 轮`:`Round ${t.round_index}`})]})]})}function vm({sid:e,view:t,roles:n=[],events:r=[],taskId:i,paused:a=!1,selectedRole:o,onSelectRole:s,onClose:c,showTabs:l=!0}){let{locale:u,t:d}=z(),f=u===`zh-CN`,[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(24),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(``),[x,S]=(0,G.useState)(Date.now),C=o||p||n.find(e=>e.active)?.role||t?.active_role||`manager`,w=bi(t,n,C,a,i),T=vi(t,C,i).map(e=>{let t=e.detail;for(let n of r){if(n.kind===`reasoning`)continue;let r=String(n.event_id||n.id||``),i=String(n.message_id||``);if(r!==e.id&&(!i||e.id!==`${e.role}:${i}`))continue;let a=gi(String(n.text||n.reason||n.summary||``));a.length>t.length&&(t=a)}return t===e.detail?e:{...e,detail:t}});(0,G.useEffect)(()=>{g(24),b(``)},[e,C,i]);let E=i?ii(void 0,t,i):0,D=E?vi(t,C,i,E):T,O=D[0],k=D.find(e=>e.detail&&[`agent_message`,`assistant_message`,`decision`,`verdict`,`handoff`,`review`,`completion`].includes(e.kind)),A=yi(r,C,i,E),j=A&&Number(A.ts||0)>=(O?.ts??0),M=!j&&O&&[`agent_message`,`assistant_message`].includes(O.kind)&&O.detail?O.detail.split(/[。\n]/)[0].slice(0,70):_i(j?String(A.kind):O?.kind||`task`,f,j?String(A.tool_name||``):``),ee=n.find(e=>e.role===C)?.model||t?.roles.find(e=>e.role===C)?.model,N=O?Math.max(0,Math.floor(x/1e3-O.ts)):0,P=Math.max(O?.ts??0,j?Number(A?.ts||0):0),F=w&&P?xi(x/1e3-P,f):``;(0,G.useEffect)(()=>{if(!w)return;let e=setInterval(()=>S(Date.now()),1e3);return()=>clearInterval(e)},[w]);let te=e=>gt(e)?Ve(e,d):e;return(0,J.jsxs)(`section`,{className:`agent-activity`,style:{"--agent-role-color":_t(C)},"aria-label":f?`工作详情`:`Work details`,children:[(0,J.jsxs)(`header`,{className:`agent-activity-heading`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(Ge,{size:15}),f?`工作详情`:`Work details`]}),c&&(0,J.jsx)(`button`,{type:`button`,onClick:c,"aria-label":f?`关闭工作详情`:`Close work details`,children:(0,J.jsx)(Je,{size:17})})]}),l&&(0,J.jsx)(`div`,{className:`agent-activity-tabs`,role:`group`,"aria-label":f?`筛选 Agent`:`Filter agents`,children:et.map(e=>(0,J.jsxs)(`button`,{type:`button`,"data-role":e,"aria-pressed":C===e,style:{"--agent-role-color":_t(e)},onClick:()=>{m(e),s?.(e)},children:[(0,J.jsx)(`i`,{"data-active":bi(t,n,e,a,i)}),te(e)]},e))}),(0,J.jsxs)(`div`,{className:`agent-current`,"data-active":w,children:[(0,J.jsxs)(`div`,{className:`agent-current-kicker`,children:[(0,J.jsx)(`span`,{children:w?f?`当前工作`:`Current work`:a?f?`工作已暂停`:`Work paused`:f?`最近进度`:`Latest progress`}),w?(0,J.jsxs)(`span`,{className:`agent-live-indicator`,"data-stale":F?!0:void 0,children:[(0,J.jsx)(`i`,{}),f?`处理中`:`In progress`,F&&(0,J.jsx)(`small`,{className:`agent-live-stale`,children:F})]}):(0,J.jsx)(dn,{size:12})]}),(0,J.jsx)(`h3`,{children:O||j?M:w?f?`尚无本次工作记录`:`No work recorded for this attempt yet`:f?`等待任务分配`:`Waiting for an assignment`}),k?.detail&&(0,J.jsx)(`div`,{className:`agent-current-summary`,children:(0,J.jsx)(H,{children:k.detail})}),!k&&O?.detail&&(0,J.jsx)(`p`,{className:`agent-current-summary`,children:O.detail}),O&&(0,J.jsxs)(`div`,{className:`agent-current-meta`,children:[(0,J.jsx)(Jt,{size:12}),(0,J.jsx)(`span`,{children:f?`${N<60?N+` 秒`:N<3600?Math.floor(N/60)+` 分钟`:N<86400?Math.floor(N/3600)+` 小时`:Math.floor(N/86400)+` 天`}前更新`:`Updated ${N<60?N+`s`:N<3600?Math.floor(N/60)+`m`:N<86400?Math.floor(N/3600)+`h`:Math.floor(N/86400)+`d`} ago`})]}),(0,J.jsxs)(`details`,{className:`agent-technical-details`,children:[(0,J.jsx)(`summary`,{children:f?`查看运行信息`:`Runtime details`}),(0,J.jsxs)(`p`,{children:[te(C),ee?` · ${ee}`:``,O?.round_index==null?``:f?` · 第 ${O.round_index} 轮`:` · Round ${O.round_index}`]})]})]}),(0,J.jsxs)(`div`,{className:`agent-records-heading`,children:[(0,J.jsx)(`span`,{children:f?`工作记录`:`Work log`}),(0,J.jsxs)(`span`,{children:[T.length,` `,f?`条`:`records`]})]}),(0,J.jsxs)(`div`,{className:`agent-records`,role:`log`,"aria-live":`off`,children:[T.slice(0,h).map((t,n)=>{let r=w&&t.id===O?.id,i=[`done`,`completed`].includes(t.status),a=[`failed`,`error`,`rejected`].includes(t.status),o=i?We:[`tool_use`,`command_execution`].includes(t.kind)?st:Qt;return(0,J.jsxs)(`article`,{className:`agent-record`,"data-active":r,"data-failed":a,children:[(0,J.jsx)(`span`,{className:`agent-record-icon`,children:(0,J.jsx)(o,{size:13})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`agent-record-title`,children:[(0,J.jsx)(`strong`,{children:_i(t.kind,f)}),(0,J.jsx)(`time`,{children:new Date(t.ts*1e3).toLocaleTimeString(f?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})})]}),(0,J.jsx)(`small`,{children:r?f?`进行中`:`In progress`:a?f?`未完成`:`Did not finish`:i?f?`已完成`:`Completed`:f?`已记录`:`Recorded`}),(t.detail||e)&&(0,J.jsx)(_m,{sid:e,record:t,zh:f,expanded:n===0||t.id===k?.id})]})]},t.id)}),!T.length&&(0,J.jsx)(`p`,{className:`agent-records-empty`,children:f?`${te(C)}尚未留下这个任务的工作记录。`:`No work has been recorded for this task by ${te(C)}.`})]}),(0,J.jsxs)(`div`,{className:`agent-records-footer`,children:[hg(e=>e+24),children:f?`加载更早记录(还剩 ${T.length-h} 条)`:`Load earlier records (${T.length-h} remaining)`}),e&&(0,J.jsx)(`button`,{type:`button`,disabled:_,onClick:()=>{v(!0),b(``),R.downloadWorkLog(e,C,i).catch(e=>b(e instanceof Error?e.message:String(e))).finally(()=>v(!1))},children:_?f?`正在准备完整记录…`:`Preparing full log…`:f?`下载完整工作记录(含更早历史)`:`Download full work log (including earlier history)`}),y&&(0,J.jsx)(`small`,{role:`alert`,children:y})]})]})}var ym=[`active`,`running`,`in_progress`,`claimed`],bm=[`complete`,`completed`,`done`,`success`,`incomplete`,`stalled`,`blocked`,`ended`],xm=864e5,Sm=300;function Cm(e,t){return zn(e,t)}function wm(e){let t=e.type.toLowerCase().split(/[._-]/).at(-1);return[`failed`,`failure`,`error`].includes(t??``)||e.tone===`error`&&/\bfailed\b/i.test(e.title)}function Tm(e,t,n=new Date){let r=new Date(e*1e3),i=r.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate()),o=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate());if(o===a)return i;let s=+(t===`zh-CN`);return o>=a-(n.getDay()-s+7)%7*xm&&on;(0,G.useEffect)(()=>{if(n!=null||o)return;let e=a.current;if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight);t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[e,o,n]);let d=!o&&n!=null&&u?`${e.slice(0,n)}…`:e;return(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(`p`,{ref:a,title:t||void 0,className:`${n==null&&!o?`line-clamp-3`:``} whitespace-pre-wrap break-words ${r}`,children:d}),u?(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`mt-1 text-xs text-blue-sky hover:text-ink`,children:i(o?`mission.showLess`:`mission.showMore`)}):null]})}function Dm(e){let t=[...e.dag],n=[],r=new Set;for(;t.length;){let i=t.findIndex(t=>t.deps.every(t=>r.has(t)||!e.dag.some(e=>e.id===t))),[a]=t.splice(i>=0?i:0,1);n.push(a),r.add(a.id)}return n}function Om(e,t=16){let n=Dm(e);if(n.length<=t)return{nodes:n,hidden:[]};let r=new Set(n.slice(-t).map(e=>e.id)),i=n.find(e=>[`running`,`in_progress`,`claimed`].includes(e.status)),a=new Map(n.map(e=>[e.id,e])),o=i?[i]:[];for(;o.length;){let e=o.pop();r.has(e.id)||(r.add(e.id),e.deps.forEach(e=>{let t=a.get(e);t&&o.push(t)}))}return{nodes:n.filter(e=>r.has(e.id)),hidden:n.filter(e=>!r.has(e.id))}}function km({view:e}){let{t}=z(),n=e.achievement;return n?(0,J.jsxs)(`section`,{className:`border-b border-ok/35 bg-ok/5 px-5 py-4 animate-appear`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ok`,children:t(`mission.achievement`)}),(0,J.jsx)(`div`,{className:`mt-2 text-sm font-semibold text-ink`,children:n.title}),n.summary?(0,J.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:n.summary}):null,(0,J.jsxs)(`div`,{className:`mt-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[t(`mission.elapsed`),` `]}),(0,J.jsx)(`span`,{className:`font-mono text-ink`,children:zf(n.elapsed_seconds??0)})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-1 text-xs text-ink-dim`,children:[(0,J.jsx)(`span`,{children:t(`mission.rejectedAttempts`,{count:n.rejected_attempts??0})}),(0,J.jsx)(`span`,{children:t(`mission.skillsLearned`,{count:n.skills_learned??0})}),(0,J.jsx)(`span`,{children:t(`mission.artifacts`,{count:n.artifacts??0})})]})]}):null}function Am({view:e,sid:t=``,snapshot:n,artifacts:r=[],onOpenArtifact:i,onOpenDelivery:a,gitDiff:o,onNotify:s,onAsk:c,connected:l=!0,events:u=[]}){let{locale:d,t:f}=z(),p=(0,G.useMemo)(()=>({...e,role_work:e.role_work.map(e=>({...e,detail:Xc(e.detail,d).text}))}),[d,e]),m=new Map(e.roles.map(e=>[e.role,e])),h=!!n?.daemon.alive||e.dag.length>0||e.roles.some(e=>![``,`idle`,`waiting`].includes(e.status)),g=e.dag.find(e=>[`running`,`in_progress`,`claimed`].includes(e.status)),_=Om(e),v=_.nodes,y=n?ci(n,e,u):null,b=y?[`running`,`waiting`].includes(y.state):!1,x=d===`zh-CN`,S=Rf(e.mission.objective||e.mission.title||(b?x?`正在处理你的请求`:`Working on your request`:e.artifacts.length?x?`已完成,成果在下方`:`Completed; results below`:f(`mission.waiting`))),[C,w]=(0,G.useState)(b);(0,G.useEffect)(()=>{b&&w(!0)},[b]);let T=e.mission.final_output?.trim()||``,E=!!(T&&T!==e.mission.summary.trim()),[D,O]=(0,G.useState)(Math.max(0,e.timeline.length-1)),[k,A]=(0,G.useState)(e.active_role||`planner`),[j,M]=(0,G.useState)(g?.id||``),[ee,N]=(0,G.useState)(!1),P=e.delivery,F=(()=>{if(!P)return!1;let t=e=>e.replace(/\s+/g,``).slice(0,80),n=t(e.mission.summary||``),r=t(P.summary||P.title||``);return!!(n&&r)&&(n.startsWith(r)||r.startsWith(n))})(),te=new Map(r.map(e=>[e.path,e])),ne=e.learned_skills.filter(e=>e.status===`active`),re=e.learned_wiki_pages.filter(e=>e.status!==`retired`),ie=!!(e.storage.project_skill_dir||e.storage.global_skill_dir||e.storage.wiki_paths.length||e.storage.skill_history_compressed||e.storage.wiki_retired_compressed),I=!!(ne.length||re.length||ie),L=e.mission.status.toLowerCase(),ae=n?ci(n,e,u):null,oe=ae?ae.state===`running`:[`working`,`grounding`,`framed`].includes(L),se=[`degraded`,`red`,`critical`].includes(e.health?.toLowerCase()??``),ce=[`failed`,`error`].includes(e.mission.status.toLowerCase()),le=e.dag.some(t=>t.status.toLowerCase()===`failed`&&(t.id===e.mission.id||!e.mission.id&&!oe&&!g)),ue=ae?.state===`paused`||[`hold`,`paused`].includes(e.stage.id.toLowerCase()),de=e.outcome.execution_status?.toLowerCase()===`failed`&&e.stage.id.toLowerCase()===`delivery`,fe=se||de||ce||le||ue,pe=se?`mission.attentionHealth`:de?`mission.deliveryFailed`:ce?`mission.attentionFailed`:le?`mission.attentionStepFailed`:`mission.attentionPaused`,me=e.role_work.filter(t=>ym.includes(t.status.toLowerCase())&&(!e.mission.id||(t.item_id||t.mission_id)===e.mission.id)).sort((e,t)=>t.ts-e.ts),he=me.find(t=>t.role===e.active_role)??me[0],ge=bm.includes(L),_e=Vn(e.outcome,f)[0]??Rn(e.mission.status,f),ve=l?ae?.state===`paused`||ae?.state===`unknown`?pi(ae,d):fe?f(pe):ge?[f(`mission.statusDone`,{outcome:_e,elapsed:zf(e.mission.elapsed_seconds)}),ae?.state===`waiting`?pi(ae,d):``].filter(Boolean).join(` `):ae?pi(ae,d):oe&&he?f(`mission.statusActive`,{role:zn(e.active_role||he.role,f),work:he.title}):f(`mission.statusWaiting`):d===`zh-CN`?`实时连接已断开,以下是已收到的记录。`:`Live connection lost; these are the records already received.`,ye=l?se||de||ce||le?`error`:ue||ae?.state===`waiting`?`waiting`:ge?`done`:oe&&he?`active`:`waiting`:`waiting`,be=String(e.outcome.execution_status||``).toLowerCase(),xe=ge&&![`completed`,`done`,`success`].includes(be),Se=ge&&!xe&&e.outcome.review_status===`done`&&e.review.status===`done`?Xc(e.review.reason,d).text.trim():``,Ce=Se||e.mission.summary,we=[...e.timeline].reverse().find(t=>t.cause&&t.detail&&(!e.mission.id||t.item_id===e.mission.id)&&(!e.mission.started_at||t.ts>=e.mission.started_at)),Te=we?Xc(we.detail,d,{cause:we.cause,technical:we.technical,language:e.language}):[`skipped`,`blocked`,`rejected`,`continue`].includes(String(e.review.status||``).toLowerCase())?Xc(e.review.reason,d):null,Ee=String(e.outcome.interruption_kind||``).toLowerCase(),De=fe||xe,Oe=De?Te?.text||(Ee&&Ee!==`none`?Ic(Ee,d):``):``,ke=ae?.reason===`operator_input`?f(`mission.nextAfterReply`):De&&e.outcome.resumable?f(n?.daemon.alive?`mission.nextResumeLive`:`mission.nextResume`):``;(0,G.useEffect)(()=>O(Math.max(0,e.timeline.length-1)),[e.timeline.length]),(0,G.useEffect)(()=>{g?.id&&M(g.id)},[g?.id]);let Ae=async()=>{if(!ee){N(!0);try{await R.setContinuous(t,!0,n?.continuous?.objective??``),s?.(`success`,f(`sidebar.resumeSuccess`))}catch(e){s?.(`error`,f(`sidebar.resumeFailed`,{error:xt(e)}))}finally{N(!1)}}},je=e.timeline.slice(0,D+1).slice(-12).reverse(),Me=e.dag.find(e=>e.id===j);if(n&&l&&n.daemon.read_status!==`error`&&!h&&!fe&&[``,`idle`,`waiting`].includes(L)&&!n.backlog.length&&!e.role_work.length&&!e.timeline.length&&!e.mission.summary&&!E&&!P&&!e.artifacts.length&&!I&&!r.some(e=>e.exists)&&!(o?.available&&(o.status||o.diff))){let e=d===`zh-CN`,t=n.session.objective?.trim();return(0,J.jsx)(`section`,{className:`min-h-0 flex-1 overflow-y-auto bg-panel px-5 py-8 scroll-thin`,"aria-label":f(`mission.control`),"data-testid":`project-ready`,children:(0,J.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold text-ink`,children:e?`还没有安排执行任务`:`No work has been assigned yet`}),t?(0,J.jsx)(`div`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:(0,J.jsx)(H,{children:t})}):null,(0,J.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`在下方告诉 Manager 你想完成什么,也可以直接询问这个项目的进展。`:`Tell the Manager what you want to accomplish below, or ask about this project’s progress.`}),c?(0,J.jsx)(`button`,{type:`button`,className:`mt-4 rounded-lg border border-line px-3 py-2 text-sm text-ink hover:border-blue`,onClick:()=>c(e?`这个项目目前做到了哪一步?有哪些结果,下一步是什么?`:`Where does this project stand? What results do we have, and what comes next?`),children:e?`问 Manager 项目现状`:`Ask the Manager about this project`}):null]})})}return(0,J.jsx)(`section`,{className:`mission-overview min-h-0 flex-1 overflow-x-hidden overflow-y-auto bg-panel scroll-thin`,"aria-label":f(`mission.control`),children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-[960px]`,children:[(0,J.jsxs)(`header`,{className:`px-5 pb-6 pt-7 sm:px-8`,children:[(0,J.jsx)(`div`,{role:`heading`,"aria-level":1,className:`mt-1 line-clamp-4 max-w-4xl text-xl font-semibold leading-snug text-ink`,title:S,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:S})}),S.length>600?(0,J.jsxs)(`details`,{className:`mt-2 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer hover:text-ink`,children:f(`mission.showObjective`)}),(0,J.jsx)(`div`,{className:`mt-2 text-ink-dim`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:S})})]}):null,(0,J.jsxs)(`div`,{className:`mission-status-line`,"data-tone":ye,role:fe?`alert`:`status`,children:[(0,J.jsxs)(`div`,{className:`mission-status-line__signal`,children:[(0,J.jsx)(`span`,{className:`mission-status-line__marker`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:ve})]}),e.frontier.change?(0,J.jsx)(`div`,{className:`mission-status-line__subtitle`,children:e.frontier.change}):null,Oe?(0,J.jsx)(`p`,{className:`mt-1.5 pl-[1.125rem] text-sm leading-relaxed text-ink-dim`,title:Te?.technical||void 0,children:Oe}):null,ke?(0,J.jsx)(`p`,{className:`mt-1 pl-[1.125rem] text-sm leading-relaxed text-ink-dim`,children:ke}):null]}),oe&&he?.detail?(0,J.jsx)(`div`,{className:`mt-4 text-sm text-ink-dim`,children:(0,J.jsx)(Em,{detail:Xc(he.detail,d).text,previewLength:Sm,textClassName:`leading-6`})}):null,Ce||E?(0,J.jsxs)(`div`,{className:`mt-5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1 text-sm font-semibold text-ink`,children:Se?d===`zh-CN`?`验收结果`:`Review result`:f(P&&F?P.kind===`submission_certified`?`mission.deliveryCertified`:`mission.taskCompleted`:xe?`mission.lastProgress`:`mission.summary`)}),P&&F&&a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(P),title:P.primary_target?te.get(P.primary_target.path)?.storage_path||P.primary_target.path:P.title,className:`shrink-0 rounded-md bg-ink px-3 py-2 text-sm font-medium text-surface hover:opacity-80`,children:f(P.primary_target?`mission.openResult`:`mission.viewTask`)}):null]}),(0,J.jsx)(`div`,{className:`mt-3 whitespace-pre-wrap text-sm leading-7 text-ink-dim`,"data-testid":`mission-result-summary`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:Ce})}),Se&&e.mission.summary&&Se!==e.mission.summary?(0,J.jsxs)(`details`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer`,children:d===`zh-CN`?`执行者记录`:`Execution note`}),(0,J.jsx)(`div`,{className:`mt-2 text-sm leading-6`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:e.mission.summary})})]}):null,E?(0,J.jsxs)(`details`,{className:`mt-2 border-t border-ok/20 pt-2 text-xs text-ink-dim`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer font-medium text-ok hover:text-ink`,children:f(`mission.showFullOutput`)}),(0,J.jsx)(`div`,{className:`mt-3 break-words text-sm leading-relaxed text-ink`,children:(0,J.jsx)(H,{artifacts:r,onOpenArtifact:i,children:T})})]}):null]}):null,P&&!F?(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 rounded border border-ok/30 bg-ok/5 px-3 py-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ok`,children:f(P.kind===`submission_certified`?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,J.jsx)(`div`,{className:`mt-1 truncate text-xs text-ink-dim`,title:P.summary||P.title,children:P.summary||P.title})]}),a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(P),title:P.primary_target?te.get(P.primary_target.path)?.storage_path||P.primary_target.path:P.title,className:`shrink-0 rounded border border-ok/40 px-2 py-1 font-mono text-xs text-ok hover:border-ok`,children:f(P.primary_target?`mission.openResult`:`mission.viewTask`)}):null]}):null]}),e.artifacts.length?(0,J.jsxs)(`section`,{className:`px-5 pb-6 sm:px-8`,"aria-label":d===`zh-CN`?`成果文件`:`Result files`,children:[(0,J.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-ink`,children:d===`zh-CN`?`成果文件`:`Result files`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.artifacts.slice(-8).map(e=>{let t=String(e.path||``),n=te.get(t);return(0,J.jsx)(`button`,{type:`button`,disabled:!t||!i||n?.exists===!1,onClick:()=>t&&i?.(t),title:n?.storage_path||t,className:`rounded-md border border-line px-3 py-2 text-sm text-ink-dim hover:border-ink-faint hover:text-ink disabled:opacity-50`,children:String(e.title||t.split(`/`).at(-1)||f(`research.artifact`))},String(e.id||t))})})]}):null,n?.continuous?.done_at&&(0,J.jsxs)(`div`,{className:`mx-5 mb-6 flex items-center gap-3 border-t border-line/60 py-3 sm:mx-8`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-ink-dim`,children:f(`mission.continuousDone`)}),(0,J.jsx)(`button`,{type:`button`,disabled:ee,onClick:()=>void Ae(),className:`compact-control shrink-0 px-3`,children:ee?`…`:f(`mission.resumeContinuous`)})]}),(0,J.jsxs)(`details`,{className:`mission-detail-records mx-5 mb-8 border-t border-line sm:mx-8`,open:C,onToggle:e=>w(e.currentTarget.open),children:[(0,J.jsxs)(`summary`,{className:`cursor-pointer py-4 text-sm text-ink-dim`,children:[d===`zh-CN`?`执行过程与记录`:`Execution details and records`,e.dag.length?` · ${e.dag.length}`:``]}),(0,J.jsx)(km,{view:e}),h?(0,J.jsxs)(`section`,{className:`border-b border-line/60 px-5 py-4`,"aria-label":f(`mission.team`),children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.team`)}),(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2 xl:grid-cols-4`,children:et.map(t=>{let n=m.get(t),r=n?.status===`active`,i=n?.status===`rejected`||n?.status===`error`,a=B.role[t]??B.inkFaint,o=n?.label?Hc(n.label,d,{kind:n.kind,language:e.language}):``;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>A(t),"aria-pressed":k===t,className:`min-w-0 rounded-r-md border-l-2 py-2 pl-3 text-left transition-colors hover:bg-bg/60 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue`,style:{borderColor:k===t||r||n?.status===`done`?a:`rgb(var(--line))`,backgroundColor:k===t?`color-mix(in srgb, ${a} 8%, transparent)`:void 0},children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{"data-role-dot":t,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:a}}),(0,J.jsx)(`span`,{className:`text-xs font-semibold`,style:{color:a},children:zn(t,f)})]}),(0,J.jsx)(`div`,{className:`mt-1 line-clamp-2 text-sm leading-5 ${i?`text-err`:`text-ink-dim`}`,title:o||void 0,children:o||f(`mission.waitingShort`)})]},t)})})]}):null,h?(0,J.jsxs)(`details`,{className:`border-b border-line/60 px-5 py-4`,open:!!n?.daemon.alive,children:[(0,J.jsxs)(`summary`,{className:`flex cursor-pointer flex-wrap items-center justify-between gap-2 list-none`,children:[(0,J.jsxs)(`div`,{className:`text-xs font-medium text-ink-faint`,children:[f(`mission.roleWork`),` · `,(0,J.jsx)(`span`,{style:{color:B.role[k]??B.inkDim},children:zn(k,f)})]}),Me?(0,J.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`text-xs text-ink-faint hover:text-ink`,children:f(`mission.filteredBy`,{task:Me.title||Me.objective||f(`task.untitled`)})}):(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:f(`mission.allVisible`)})]}),(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(vm,{sid:t,view:p,roles:n?.roles,events:n?.recent_events,taskId:j||void 0,selectedRole:k,showTabs:!1,paused:n?!n.daemon.alive:!1})})]}):null,(0,J.jsxs)(`div`,{className:`grid min-h-[320px] border-b border-line/60 lg:grid-cols-[minmax(0,1.15fr)_minmax(260px,0.85fr)]`,children:[(0,J.jsxs)(`section`,{className:`min-w-0 border-b border-line/60 px-5 py-4 lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.researchDag`)}),g?(0,J.jsxs)(`span`,{className:`max-w-48 truncate text-xs text-blue-sky`,children:[f(`mission.active`),` · `,g.title]}):null]}),(0,J.jsxs)(`div`,{className:`mt-3 space-y-0`,children:[_.hidden.length?(0,J.jsx)(`div`,{className:`mb-3 rounded border border-line/60 bg-bg/50 px-3 py-2 text-xs text-ink-faint`,children:f(`mission.hiddenTasks`,{count:_.hidden.length,failed:_.hidden.filter(e=>[`failed`,`blocked`].includes(e.status)).length,skipped:_.hidden.filter(e=>e.status===`skipped`).length})}):null,v.length?v.map((e,t)=>{let n=e.id===g?.id,r=[`done`,`completed`].includes(e.status),i=[`failed`,`blocked`].includes(e.status);return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>M(e.id),className:`relative flex w-full min-w-0 gap-3 pb-3 text-left last:pb-0 ${j===e.id?`bg-white/[0.03]`:``}`,children:[t(0,J.jsx)(`li`,{children:e},e))})]}):null]}):null]}),(0,J.jsxs)(`section`,{className:`min-w-0 px-5 py-4`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.capabilities`)}),ne.length?(0,J.jsxs)(`div`,{className:`mt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-ok`,children:f(`mission.capabilitiesUnlocked`)}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:ne.slice(-8).map(e=>(0,J.jsxs)(`details`,{className:`rounded border border-ok/35 bg-ok/5 px-2 py-1.5`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-xs text-ok`,children:String(e.name||f(`mission.learnedCapability`))}),e.mission_title?(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-faint`,children:f(`mission.learnedDuring`,{mission:e.mission_title})}):null,e.content?(0,J.jsxs)(`pre`,{className:`mt-2 max-h-64 overflow-auto whitespace-pre-wrap border-t border-ok/20 pt-2 font-mono text-xs leading-5 text-ink-dim scroll-thin`,children:[e.content,e.content_truncated?`\n… ${f(`mission.contentTruncated`)}`:``]}):(0,J.jsx)(`div`,{className:`mt-2 text-xs text-ink-faint`,children:f(`mission.skillUnavailable`)})]},String(e.id)))})]}):null,re.length?(0,J.jsxs)(`div`,{className:`mt-4 border-t border-line/50 pt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-blue-sky`,children:f(`mission.knowledgeRetained`)}),(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:re.slice(-6).map(e=>(0,J.jsx)(`span`,{className:`rounded border border-blue/35 bg-blue/5 px-2 py-1 text-xs text-blue-sky`,children:String(e.title||e.id)},String(e.id)))})]}):null,ie?(0,J.jsxs)(`div`,{className:`mt-4 border-t border-line/50 pt-3`,children:[(0,J.jsx)(`div`,{className:`text-xs text-ink-faint`,children:f(`mission.selfEvolution`)}),(0,J.jsx)(`div`,{className:`mt-2 text-sm text-ink-dim`,children:f(`mission.knowledgeSaved`)})]}):null,I?null:(0,J.jsx)(`div`,{className:`py-10 text-center text-xs text-ink-faint`,children:f(`mission.noCapabilities`)})]})]}),(0,J.jsxs)(`section`,{className:`px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-ink-faint`,children:f(`mission.replay`)}),e.timeline.length>1?(0,J.jsx)(`input`,{type:`range`,min:0,max:e.timeline.length-1,value:D,onChange:e=>O(Number(e.target.value)),"aria-label":f(`mission.replayTimeline`),className:`h-1 min-w-32 flex-1 accent-blue`}):null,je.length?(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:f(je.length===1?`mission.showingLatestEvent`:`mission.showingLastEvents`,{count:je.length})}):null]}),(0,J.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[je.map(t=>{let n=new Date(t.ts*1e3),r=B.role[t.role]??B.inkFaint,i=wm(t)&&!t.kind?f(`mission.roleFailed`,{role:Cm(t.role,f)}):Hc(t.title,d,{kind:t.kind,language:e.language}),a=Xc(t.detail.trim()===e.mission.summary.trim()?``:t.detail,d,{cause:t.cause,technical:t.technical,language:e.language});return(0,J.jsxs)(`article`,{className:`rounded border border-line/60 bg-bg/35 px-3 py-2.5 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1.5 h-2 w-2 shrink-0 rounded-full ${t.tone===`error`?`bg-err`:t.tone===`success`||t.tone===`metric`||t.tone===`skill`?`bg-ok`:`bg-blue`}`}),(0,J.jsx)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 text-xs font-medium`,style:{borderColor:r,color:r},children:Cm(t.role,f)}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 break-words font-medium leading-5 text-ink`,children:i}),(0,J.jsx)(`time`,{dateTime:n.toISOString(),title:n.toLocaleString(d,{dateStyle:`medium`,timeStyle:`short`}),className:`shrink-0 font-mono text-xs text-ink-faint`,children:Tm(t.ts,d)})]}),a.text?(0,J.jsx)(Em,{detail:a.text,technical:a.technical,previewLength:Sm,textClassName:`leading-5 text-ink-dim`}):null]},t.id)}),e.timeline.length?null:(0,J.jsx)(`div`,{className:`py-10 text-center text-xs text-ink-faint`,children:f(`mission.waitingEvents`)})]}),o?.available&&(o.status||o.diff)?(0,J.jsxs)(`div`,{className:`mt-5 border-t border-line/50 pt-4 text-xs text-ink-faint`,children:[(0,J.jsx)(`span`,{className:`font-semibold uppercase tracking-[0.14em]`,children:f(`mission.projectFilesChanged`)}),(0,J.jsxs)(`span`,{children:[` · `,f(`mission.reviewInIde`)]})]}):null]})]})]})})}function jm(e){let t=Math.ceil(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}var Mm={available:`bg-ok/10 text-ok`,absent:`bg-bg text-ink-faint`,inaccessible:`bg-warn/10 text-warn`,degraded:`bg-warn/10 text-warn`};function Nm({status:e,error:t}){let{t:n}=z();return(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:n(`resource.title`)}),e?(0,J.jsx)(`span`,{className:`rounded px-2 py-1 text-[10px] font-semibold uppercase ${e.enforcement===`strict`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:Un(e.enforcement,n)}):null]}),t?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-err`,children:t}):null,!e&&!t?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:n(`resource.loading`)}):null,e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.accelerators.map(e=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:Hn(e.kind,n)}),(0,J.jsxs)(`span`,{className:`rounded px-2 py-0.5 text-[10px] font-medium ${Mm[e.status]}`,children:[Rn(e.status,n),` · `,n(`resource.devices`,{count:e.device_count})]})]}),e.detail?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:e.detail}):null]},e.kind))}),(0,J.jsxs)(`div`,{className:`mt-4 grid gap-4 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.inUse`,{count:e.holders.length})}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.holders.length===0?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.holders.map((e,t)=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.devices`,{count:e.device_count})}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:jm(e.ttl_seconds)})})]}),(0,J.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)}),e.yield_requests.map((e,t)=>(0,J.jsxs)(`div`,{className:`mt-2 border-l-2 border-warn/50 pl-2 text-ink-faint`,children:[(0,J.jsx)(`div`,{children:n(`resource.yieldRequest`,{reason:e.reason})}),e.response?(0,J.jsxs)(`div`,{children:[Wn(e.response.decision,n),` · `,e.response.reason]}):null]},t))]},`${e.project}:${e.task_id}:${t}`))})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.queue`,{count:e.queue.length})}),(0,J.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.queue.length===0?(0,J.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.queue.map(e=>(0,J.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.queuePosition`,{position:e.position})}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:jm(e.ttl_seconds)})})]}),(0,J.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)})]},e.position))})]})]})]}):null]})}async function Pm(e){let t=await e,n=t&&typeof t==`object`?t:{},r=String(n.command_status??``);if(Number(n.rc??0)!==0||r===`failed`||r===`rejected`)throw Error(String(n.error||`daemon command ${r||`failed`}`));return t}function Fm({open:e,sid:t,snap:r,onClose:i,onChanged:l,onRestored:d,onOpenSkills:f}){let{t:p,locale:h}=z(),[v,b]=(0,G.useState)(`task`),[S,C]=(0,G.useState)(``),[w,E]=(0,G.useState)(r.session.workdir??r.session.cwd??``),[D,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(null),[M,ee]=(0,G.useState)(()=>new Set),[N,P]=(0,G.useState)(null),[F,te]=(0,G.useState)(null),[ne,re]=(0,G.useState)(null),[ie,I]=(0,G.useState)(``),[L,ae]=(0,G.useState)([]),[oe,se]=(0,G.useState)(0),[ce,le]=(0,G.useState)(``),[ue,de]=(0,G.useState)(``),[fe,pe]=(0,G.useState)(`work`),me=e=>ee(t=>t.has(e)?t:new Set([...t,e])),he=e=>j(Md(e,p)),ge=!M.has(`sourceUpdate`);(0,G.useEffect)(()=>{e&&(E(r.session.workdir??r.session.cwd??``),R.metrics().then(P,e=>{jd(e)?me(`metrics`):he(e)}),R.trash().then(e=>{ae(e.entries),se(e.total)},e=>{jd(e)?me(`trash`):he(e)}))},[e,r.session.cwd,r.session.workdir]),(0,G.useEffect)(()=>{if(!e||!ge)return;let t=!1,n=e=>{t||(jd(e)?me(`sourceUpdate`):he(e))},r=async()=>{try{let e=await R.sourceUpdateStatus();t||te(e)}catch(e){n(e)}};R.sourceUpdateStatus().then(async e=>{if(!t&&(te(e),!e.running)){let e=await R.checkSourceUpdate();t||te(e)}}).catch(n);let i=window.setInterval(()=>void r(),1500);return()=>{t=!0,window.clearInterval(i)}},[e,ge]),(0,G.useEffect)(()=>{!e||fe!==`system`||(re(null),I(``),R.resources().then(re,e=>{jd(e)?me(`resources`):I(p(`operations.requestFailed`))}))},[e,fe]);let _e=async(e,t,n)=>{if(!ue){de(e),k(null),j(null);try{let e=await t();n!==null&&k(n?{text:n}:{text:p(`operations.done`),raw:JSON.stringify(e,null,2)}),l()}catch(e){he(e)}finally{de(``)}}},ve=async()=>{let e=S.trim();if(e){if(v===`plan`){await _e(`quick`,async()=>{let n=await R.previewPlan(t,e);return k({text:[...n.steps.map((e,t)=>`${t+1}. ${e.title}${e.detail?` — ${e.detail}`:``}`),...n.notes.map(e=>`Note: ${e}`),...n.error?[`Error: ${n.error}`]:[]].join(` +`)}),n},null);return}await _e(`quick`,v===`task`?()=>R.addTask(t,e):v===`nudge`?()=>R.nudge(t,e):()=>R.note(t,e),`${v} submitted.`),C(``)}},ye=async e=>{await _e(`restore:${e.trash_id}`,async()=>{let t=await R.restoreTrash(e.trash_id);return ae(t=>t.filter(t=>t.trash_id!==e.trash_id)),se(e=>Math.max(0,e-1)),await d(t.sid),t},`Restored ${e.label}.`)},be=r.daemon.alive&&r.daemon.protocol_compatible===!1,xe=r.daemon.alive&&r.daemon.control_available===!1,Se=r.daemon_admission?.running_daemons??[],Ce=v===`task`?m:v===`nudge`?O:v===`note`?T:g,we=p(`operations.action.${v}`),Te=async()=>{await _e(`trash-search`,async()=>{let e=await R.trash(ce);return ae(e.entries),se(e.total),e},null)};return(0,J.jsxs)(dt,{open:e,onClose:()=>!ue&&i(),label:p(`operations.title`),width:`max-w-5xl`,children:[(0,J.jsx)(lt,{title:p(`operations.title`),sub:r.session.display_name||t}),(0,J.jsx)(`div`,{className:`flex gap-1 overflow-x-auto border-b border-line bg-panel px-4 py-2 scroll-thin`,children:[[`work`,p(`operations.work`),m],[`runtime`,p(`operations.runtime`),_],[`system`,p(`operations.system`),c],[`recovery`,p(`operations.recovery`),n]].map(([e,t,n])=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{pe(e),k(null),j(null)},"aria-current":fe===e?`page`:void 0,className:`flex h-8 shrink-0 items-center justify-center gap-2 rounded-md px-3 text-xs font-medium ${fe===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:[(0,J.jsx)(o,{icon:n}),(0,J.jsx)(`span`,{children:t})]},e))}),(0,J.jsxs)(`div`,{className:`grid max-h-[76vh] gap-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid-cols-2`,children:[fe===`work`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.workInput`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:p(`operations.workHint`)}),(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-1 sm:grid-cols-4`,children:[[`task`,m],[`nudge`,O],[`note`,T],[`plan`,g]].map(([e,t])=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>b(e),"aria-pressed":v===e,className:`flex h-9 items-center justify-center gap-2 rounded px-2 text-xs font-medium ${v===e?`bg-blue/10 text-blue`:`bg-bg text-ink-dim hover:text-ink`}`,children:[(0,J.jsx)(o,{icon:t}),(0,J.jsx)(`span`,{children:p(`operations.action.${e}`)})]},e))}),(0,J.jsx)(`textarea`,{value:S,onChange:e=>C(e.target.value),rows:5,placeholder:v===`plan`?p(`operations.planPlaceholder`):p(`operations.actionPlaceholder`,{action:v}),className:`mt-3 w-full resize-y rounded border border-line bg-bg p-3 text-sm text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void ve(),disabled:!!ue||!S.trim(),className:`mt-2 flex h-9 items-center justify-center gap-2 rounded border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:ue===`quick`?`…`:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(o,{icon:Ce}),(0,J.jsx)(`span`,{children:v===`plan`?p(`operations.previewPlan`):p(`operations.submitAction`,{action:we})})]})})]}):null,fe===`runtime`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.runtime`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:p(`operations.runtimeHint`)}),(0,J.jsx)(`label`,{className:`mt-3 block text-[10px] uppercase tracking-wide text-ink-faint`,children:p(`operations.workdir`)}),(0,J.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[(0,J.jsx)(`input`,{value:w,onChange:e=>E(e.target.value),className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`cwd`,()=>R.setWorkdir(t,w),p(`operations.workdirUpdated`)),disabled:!!ue||!w.trim(),title:p(`operations.applyWorkdir`),"aria-label":p(`operations.applyWorkdir`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:y})})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`reset`,()=>R.resetManager(t),`Manager context reset.`),disabled:!!ue,title:p(`operations.resetManager`),"aria-label":p(`operations.resetManager`),className:`flex h-9 w-9 items-center justify-center rounded border border-line text-xs text-ink-dim disabled:opacity-40`,children:(0,J.jsx)(o,{icon:a})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void _e(`upgrade`,()=>Pm(R.upgradeDaemon(t,r.daemon_commands?.revision)),`Current-release daemon started after safely draining active work.`),disabled:!!ue||xe,title:xe?`Externally supervised daemon cannot be restarted from this Web host`:be?`Upgrade incompatible daemon`:`Restart on current release`,"aria-label":xe?`Externally supervised daemon`:be?`Upgrade incompatible daemon`:`Restart on current release`,className:`flex h-9 w-9 items-center justify-center rounded border text-xs disabled:opacity-40 ${be?`border-err/60 bg-err/10 text-err`:`border-line text-ink-dim`}`,children:(0,J.jsx)(o,{icon:x})})]}),ge?(0,J.jsxs)(`div`,{className:`mt-4 rounded-lg border border-line bg-bg p-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:p(`operations.sourceUpdate`)}),(0,J.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold ${F?.state===`failed`?`bg-err/10 text-err`:F?.update_available?`bg-warn/10 text-warn`:F?.update_available===!1?`bg-ok/10 text-ok`:`bg-line text-ink-dim`}`,children:F?.running?p(`operations.updateRunning`):F?.update_available?p(`operations.updateAvailable`):F?.update_available===!1?p(`operations.updateCurrent`):p(`operations.updateChecking`)})]}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:F?.error||F?.message||p(`operations.updateChecking`)}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 font-mono text-[10px] text-ink-dim`,children:[(0,J.jsxs)(`span`,{children:[p(`operations.currentRevision`),`: `,F?.current_revision?.slice(0,12)||`—`]}),(0,J.jsxs)(`span`,{children:[p(`operations.latestRevision`),`: `,F?.upstream_revision?.slice(0,12)||`—`]}),F?.phase&&F.phase!==`complete`&&F.phase!==`idle`?(0,J.jsxs)(`span`,{children:[p(`operations.updatePhase`),`: `,F.phase]}):null]}),F?.running?(0,J.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded bg-line`,children:(0,J.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`})}):null]}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>void _e(`source-update`,async()=>{let e=await R.applySourceUpdate();return te(e),e},null),disabled:!!ue||!!F?.running||F?.can_update===!1,title:F?.can_update===!1?F.error||p(`operations.updateUnavailable`):p(`operations.pullLatest`),"aria-label":p(`operations.pullLatest`),className:`flex h-9 items-center gap-2 rounded border border-blue/50 px-3 text-xs font-medium text-blue disabled:opacity-40`,children:[(0,J.jsx)(o,{icon:u}),(0,J.jsx)(`span`,{children:F?.running?p(`operations.updateRunning`):p(`operations.pullLatest`)})]})]}),F?.restart_required?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-warn`,children:p(`operations.updateRestart`)}):null]}):null,r.daemon.protocol_error?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-err`,children:r.daemon.protocol_error}):null,Se.length?(0,J.jsxs)(`div`,{className:`mt-4`,children:[(0,J.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-ink-faint`,children:p(`operations.replaceSlot`)}),(0,J.jsx)(`div`,{className:`mt-2 space-y-1`,children:Se.map(e=>(0,J.jsxs)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void _e(`replace:${e.id}`,()=>Pm(R.replaceDaemon(t,e.id,!!r.continuous?.enabled,r.daemon_commands?.revision)),`Parked ${e.label||e.id} and started this session.`),title:`Replace ${e.label||e.id}`,"aria-label":`Replace ${e.label||e.id}`,className:`flex w-full items-center justify-between rounded border border-line bg-bg px-2 py-1.5 text-left text-xs text-ink-dim disabled:opacity-40`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:e.label||e.id}),(0,J.jsx)(o,{icon:x,className:`ml-2 text-warn`})]},e.id))})]}):null]}):null,fe===`system`?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.skills`)}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:h===`zh-CN`?`全局技能对所有任务可用。在技能库中查看各分类与最近更新。`:`Global skills are available to every task. Browse all classes and recent updates in the skill library.`}),(0,J.jsx)(`button`,{type:`button`,onClick:f,className:`mt-3 rounded border border-line px-3 py-2 text-sm text-blue hover:bg-bg`,children:h===`zh-CN`?`打开技能库`:`Open skill library`})]}):null,fe===`system`&&!M.has(`metrics`)?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:p(`operations.metrics`)}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,J.jsx)(`span`,{className:`rounded px-2 py-1 text-xs font-semibold ${N?.slo?.status===`healthy`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:p(N?N.slo?.status===`healthy`?`operations.slo.healthy`:`operations.slo.degraded`:`operations.slo.loading`)}),(0,J.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p(`operations.validationFailures`,{count:N?.event_validation_failures??`—`})})]}),N?(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-dim`,children:wd(N).map((e,t)=>(0,J.jsxs)(`span`,{children:[t>0?(0,J.jsx)(`span`,{className:`text-ink-faint`,children:` · `}):null,(0,J.jsxs)(`span`,{className:`text-ink-faint`,children:[p(`operations.metric.${e.key}`),` `]}),(0,J.jsx)(`span`,{className:`font-mono tabular-nums text-ink`,children:e.value})]},e.key))}):null,N?(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap rounded bg-bg p-3 font-mono text-[10px] text-ink-dim scroll-thin`,children:JSON.stringify({web:N.web,provider:N.provider},null,2)})}):null]}):null,fe===`system`&&!M.has(`resources`)?(0,J.jsx)(Nm,{status:ne,error:ie}):null,fe===`recovery`&&M.has(`trash`)?(0,J.jsx)(`p`,{className:`text-sm text-ink-faint lg:col-span-2`,children:p(`operations.unavailableHere`)}):null,fe===`recovery`&&!M.has(`trash`)?(0,J.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`h3`,{className:`mr-auto text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:[p(`operations.trash`),` · `,oe]}),(0,J.jsx)(`input`,{value:ce,onChange:e=>le(e.target.value),onKeyDown:e=>{!vu(e)&&e.key===`Enter`&&Te()},placeholder:p(`operations.searchTrash`),className:`h-8 min-w-52 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void Te(),title:p(`operations.searchTrash`),"aria-label":p(`operations.searchTrash`),className:`flex h-8 w-8 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:s})})]}),L.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:L.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded border border-line bg-bg p-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-xs text-ink`,children:e.label}),(0,J.jsx)(`div`,{className:`truncate font-mono text-[10px] text-ink-faint`,children:e.trash_path})]}),(0,J.jsx)(`button`,{type:`button`,disabled:!!ue,onClick:()=>void ye(e),title:`Restore ${e.label}`,"aria-label":`Restore ${e.label}`,className:`flex h-8 w-8 items-center justify-center rounded border border-blue/50 text-xs text-blue disabled:opacity-40`,children:(0,J.jsx)(o,{icon:n})})]},e.trash_id))}):(0,J.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`operations.trashEmpty`)}),oe>L.length?(0,J.jsxs)(`p`,{className:`mt-2 text-[10px] text-ink-faint`,children:[`Showing the newest `,L.length,` matches. Narrow the search to find older sessions.`]}):null]}):null,A?(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-panel p-3 text-sm text-ink-dim lg:col-span-2`,children:[(0,J.jsx)(`p`,{children:A.text}),A.technical?(0,J.jsx)(ft,{label:p(`operations.technicalDetails`),children:(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap font-mono`,children:A.technical})}):null]}):null,D?(0,J.jsxs)(`div`,{className:`rounded-lg border border-line bg-panel p-3 text-sm text-ink-dim lg:col-span-2`,children:[(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:D.text}),D.raw?(0,J.jsx)(ft,{children:(0,J.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs`,children:D.raw})}):null]}):null]})]})}var Im=[`handshake.service`,`handshake.project`,`handshake.ready`];function Lm(){let{t:e}=z(),t=(0,G.useRef)(null);return it(t,(e,t)=>{if(t){e.set(`[data-handshake-line], [data-handshake-node]`,{opacity:1,scale:1,clearProps:`transform`});return}e.to(`[data-handshake-mark]`,{scale:1.055,duration:.75,ease:`sine.inOut`,repeat:-1,yoyo:!0,transformOrigin:`50% 50%`}),e.timeline({repeat:-1,repeatDelay:.25}).fromTo(`[data-handshake-line]`,{scaleX:0,opacity:.25,transformOrigin:`0% 50%`},{scaleX:1,opacity:.8,duration:.9,ease:`power2.inOut`}).fromTo(`[data-handshake-node]`,{autoAlpha:.25,scale:.72},{autoAlpha:1,scale:1,duration:.28,stagger:.16,ease:`back.out(1.8)`},.12).to(`[data-handshake-node]`,{autoAlpha:.35,duration:.3,stagger:.08},`+=0.35`)}),(0,J.jsxs)(`div`,{ref:t,role:`status`,"aria-label":e(`handshake.connecting`),className:`w-full max-w-xl px-6 text-center`,children:[(0,J.jsx)(`div`,{"data-handshake-mark":!0,className:`handshake-mark glass-card mx-auto flex h-16 w-16 items-center justify-center rounded-3xl text-blue shadow-glow sm:h-20 sm:w-20`,children:(0,J.jsx)(At,{size:48,className:`text-ink`})}),(0,J.jsxs)(`div`,{className:`relative mx-auto mt-8 h-10 max-w-sm sm:max-w-md`,children:[(0,J.jsx)(`div`,{className:`absolute left-[10%] right-[10%] top-3 h-px bg-line/80`}),(0,J.jsx)(`div`,{"data-handshake-line":!0,className:`handshake-line absolute left-[10%] right-[10%] top-3 h-px`}),(0,J.jsx)(`div`,{className:`relative flex justify-between`,children:Im.map(t=>(0,J.jsxs)(`div`,{className:`flex w-20 flex-col items-center gap-2.5`,children:[(0,J.jsx)(`span`,{"data-handshake-node":!0,className:`handshake-node h-6 w-6 rounded-full border ring-4 ring-bg`,children:(0,J.jsx)(`span`,{className:`m-auto mt-[7px] block h-2 w-2 rounded-full bg-blue`})}),(0,J.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:e(t)})]},t))})]}),(0,J.jsx)(`p`,{className:`mt-9 text-base font-medium text-ink-dim`,children:e(`handshake.title`)}),(0,J.jsx)(`p`,{className:`mt-1.5 text-sm text-ink-faint`,children:e(`handshake.detail`)})]})}function Rm({loading:e,hasProjects:t,error:n,onRetry:r,onNew:i,onChoose:a,canCreate:o}){let{t:s,locale:c}=z();return(0,J.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-4 px-6 text-center`,children:[e?(0,J.jsx)(Lm,{}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`h1`,{className:`text-2xl font-semibold text-ink`,children:c===`zh-CN`?t?`继续你的项目`:`开始一个项目`:t?`Continue your work`:`Start a project`}),(0,J.jsx)(`p`,{className:`max-w-md text-sm leading-relaxed ${n?`text-err`:`text-ink-faint`}`,children:n||s(t?`landing.selectOrCreate`:`landing.noSessions`)})]}),!e&&(0,J.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[n?(0,J.jsx)(W,{onClick:r,variant:`danger`,children:s(`common.retry`)}):null,t?(0,J.jsx)(W,{onClick:a,children:s(`landing.select`)}):o?(0,J.jsx)(W,{onClick:i,variant:`primary`,children:s(`landing.new`)}):null,!t&&!n?(0,J.jsx)(`span`,{className:`lg:hidden`,children:(0,J.jsx)(W,{onClick:a,children:s(`landing.menu`)})}):null]})]})}function zm({active:e,onSelect:t,onOpenSessions:n,sidebarOpen:r=!1,onRead:i,onOpenSkills:a}){let{t:s,locale:c}=z(),l=[{id:`map`,label:s(`mobile.map`),icon:g},{id:`activity`,label:s(`mobile.activity`),icon:p},{id:`preview`,label:s(`mobile.preview`),icon:E}];return(0,J.jsxs)(`nav`,{"aria-label":s(`mobile.views`),className:`mobile-tabbar glass-panel glass-panel--raised fixed inset-x-0 bottom-0 z-40 items-stretch border-t border-line/60 lg:hidden ${r?`hidden`:`flex`}`,children:[n?(0,J.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":s(`topbar.openSessions`),className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 text-ink-faint active:bg-panel-raised`,children:[(0,J.jsx)(o,{icon:h,className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`text-[10px] leading-none`,children:s(`mobile.sessions`)})]}):null,l.map(n=>{let r=n.id===e;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-current":r?`page`:void 0,className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 active:bg-panel-raised ${r?`text-blue`:`text-ink-faint`}`,children:[(0,J.jsx)(o,{icon:n.icon,className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`text-[10px] leading-none`,children:n.label})]},n.id)}),(0,J.jsxs)(`details`,{className:`workspace-more mobile-more flex-1`,onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,J.jsxs)(`summary`,{className:`min-h-[3.25rem]`,"aria-current":e===`mission`||e===`workbench`?`page`:void 0,children:[(0,J.jsx)(o,{icon:w,className:`h-4 w-4`}),(0,J.jsx)(`span`,{children:c===`zh-CN`?`更多`:`More`})]}),(0,J.jsxs)(`div`,{className:`workspace-more-menu`,onClick:e=>{e.target.closest(`button`)&&e.currentTarget.closest(`details`)?.removeAttribute(`open`)},children:[a&&(0,J.jsx)(`button`,{type:`button`,onClick:a,children:c===`zh-CN`?`技能库`:`Skill library`}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(`mission`),children:[(0,J.jsx)(o,{icon:p}),s(`mobile.mission`)]}),i?(0,J.jsx)(`button`,{type:`button`,onClick:i,children:c===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}):null,(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(`workbench`),children:[(0,J.jsx)(o,{icon:d}),s(`mobile.workbench`)]})]})]})]})}function Bm(e,t,n){let r=n?.height??t,i=t-r-(n?.offsetTop??0);return{keyboardInset:i>24?Math.round(i):0,compact:e<1024&&r<=600}}function Vm(){let[e,t]=(0,G.useState)(()=>typeof window<`u`&&Bm(window.innerWidth,window.innerHeight,window.visualViewport).compact);return(0,G.useEffect)(()=>{let e=window.visualViewport,n=document.documentElement,r=null,i=()=>{r!=null&&window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let r=Bm(window.innerWidth,window.innerHeight,e);n.style.setProperty(`--keyboard-inset`,`${r.keyboardInset}px`),n.dataset.compactViewport=String(r.compact),t(r.compact)})};return i(),e?.addEventListener(`resize`,i),e?.addEventListener(`scroll`,i),window.addEventListener(`resize`,i),()=>{r!=null&&window.cancelAnimationFrame(r),e?.removeEventListener(`resize`,i),e?.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),n.style.removeProperty(`--keyboard-inset`),delete n.dataset.compactViewport}},[]),e}var Hm={[I.LIFE_LIFECYCLE_BLOCK]:`block`,[I.ROUND_REVIEWER_BACKEND_FAILURE]:`block`,[I.LIFE_BUDGET_PAUSE]:`warn`,[I.ROUND_STALL]:`warn`,[I.ROUND_ESCALATED]:`warn`,[I.LIFE_PLANNER_STALL_ESCALATION]:`warn`},Um=new Set([I.BUDGET_RESERVATION_DENIED,I.BUDGET_UNPRICED_BLOCKED]),Wm=new Set([I.LIFE_MISSION_STARTED,I.ROUND_MAIN_COMPLETED,I.LIFE_MISSION_COMPLETED,I.LOOP_DONE,I.ROUND_START,`ui.operator`]),Gm=new Set([I.BUDGET_RESERVATION_CREATED,I.PROVIDER_REQUEST_STARTED]);function Km(e){let t=ie(e.canonical_type??e.type);if(e.event_validation?.status===`invalid`)return t===I.ROLE_SESSION_TURN?null:{tone:`warn`,kind:`validation`,text:`invalid event ${t||`unknown`}: ${e.event_validation.errors.join(`; `)}`};if(Um.has(t))return{tone:`block`,kind:`budget`,text:`Budget exhausted or blocked — ${String(e.reason??e.text??t).trim()}`};let n=e.operator_alert===!0?`block`:Hm[t];return n?{tone:n,text:String(e.text??e.reason??t).trim()}:null}function qm(e){let t=null;for(let n of e){let e=ie(n.canonical_type??n.type),r=Km(n);r?t=r:(t?.kind===`validation`||t?.kind===`budget`&&Gm.has(e)||t&&t.kind!==`budget`&&Wm.has(e))&&(t=null)}return t}async function Jm(e,t){let n=ju(e.trim());if(!n)return{kind:`not-command`};if(!n.cmd){let e=Mu(n.name);return{kind:`error`,message:e?`Unknown command ${n.name}. Did you mean ${e}?`:`Unknown command ${n.name}. Use /help for the full list.`}}if(n.cmd.id===`ask`||n.cmd.id===`crystalpilot`)return{kind:`not-command`};if(Cu(n.cmd)&&!n.rest)return{kind:`error`,message:`Usage: ${n.cmd.name}${n.cmd.arg?` ${n.cmd.arg}`:``}`};try{await t[n.cmd.id](n.rest)}catch(e){return{kind:`error`,message:e instanceof Error?e.message:String(e??`Command failed`)}}return{kind:`handled`}}function Ym({activeSid:e,activityEventsRef:t,notify:n,onClearEvents:r,onDispose:i,onOpenConfig:a,onOpenDoctor:o,onOpenHelp:s,onOpenIdentity:c,onOpenInspector:l,onOpenNewDaemon:u,onOpenOperations:d,onOpenSidebar:f,onOpenSkills:p,onReconnectEvents:m,onRenameProject:h,onRewriteDraft:g,onSelectProject:_,onSetArtifactPath:v,onSetEventFilter:y,onSetEventQuery:b,onSetTaskItemId:x,onSetWorkspaceView:S,onShowArtifacts:C,onStopIteration:w,onStopWaiting:T,refetchSnapshot:E}){return{status:async()=>l(),roles:async()=>d(),journal:async()=>l(),backlog:async()=>S(`mission`),item:async e=>{e&&x(e)},artifacts:async()=>C(),artifact:async e=>{e&&v(e)},events:async e=>{S(`activity`);let{filter:t,query:n}=Au(e);y(t),b(n)},find:async e=>{S(`activity`),y(`all`),b(e)},run:async()=>S(`activity`),clear:async()=>{S(`activity`),y(`all`),b(``),r(t.current.length)},cancel:async()=>T(),task:async t=>{e&&(await R.addTask(e,t),E(),n(`success`,`Task queued.`))},rewrite:async e=>{let t=e.trim();if(!t){n(`info`,`Type your prompt in the composer and press Rewrite, or use /rewrite .`);return}g(t)},plan:async t=>{if(!e)return;let r=await R.previewPlan(e,t);r.error?n(`error`,r.error):n(`info`,r.steps.map(e=>e.title).join(` +`)||`Plan preview ready.`)},nudge:async t=>{e&&(await R.nudge(e,t),n(`success`,`Guidance injected.`))},abort:async t=>{e&&(await R.abortMission(e,t||`operator abort`),n(`info`,`Abort requested.`))},note:async t=>{e&&(await R.note(e,t),n(`success`,`Note appended to timeline.`))},done:async e=>{e&&i(e,`done`)},skip:async e=>{e&&i(e,`rm`)},stop:async e=>{e&&w(e)},new:async()=>u(),daemons:async()=>f(),resume:async e=>{e&&e!==`list`?_(e):f()},attach:async e=>{e&&_(e)},rename:async t=>{!e||!t||await h(t)},doctor:async()=>o(),backend:async t=>{if(!e||!t){a();return}await R.setConfig(e,`runner_backend`,t),n(`success`,`Backend set to ${t}.`)},config:async t=>{if(!e||!t){a();return}let r=t.indexOf(`=`);r>0?(await R.setConfig(e,t.slice(0,r).trim(),t.slice(r+1).trim()),n(`success`,`Config updated.`)):a()},identity:async()=>c(),reset:async()=>{e&&(await R.resetManager(e),n(`success`,`Manager context reset.`))},skills:async t=>{if([``,`ls`,`list`].includes(t.trim().toLowerCase())){p();return}e&&n(`info`,(await R.skills(e,t||`ls`)).slice(0,400))},reconnect:async()=>m(),help:async()=>s(),quit:async()=>n(`info`,`Background work continues; close this browser tab when ready.`)}}function Xm(e){return e.kind===`error`?(typeof e.reply==`string`?e.reply.trim():``)||`Manager could not handle this message.`:null}function Zm(e,t){e.kind===`task`&&t.dispatchTask(e);let n=Xm(e);n&&t.notifyError(n),t.refetchTranscript()}var Qm={skipFirst:0,reconnectKey:0};function $m(e,t){return t.kind===`clear`?{...e,skipFirst:Math.max(0,t.offset)}:t.kind===`reconnect`?{skipFirst:0,reconnectKey:e.reconnectKey+1}:{...e,skipFirst:0}}function eh(e,t){if(!t.length)return e;let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return t?{...e,spend_usd:t.spend_usd,known_cost_usd:t.known_cost_usd,spend_status:t.spend_status,usage_calls:t.usage_calls,premium_requests:t.premium_requests,cost_updated_at:t.updated_at}:e})}async function th(e,t,n,r=``){let i=await e.createDaemon(``,t,r),a=n.trim();return{created:i,startCampaign:a?()=>e.setContinuous(i.sid,!0,a):null}}var nh=e=>e instanceof Error?e.message:String(e||`Unknown error`);function rh({localCwd:e,notify:t,onFocusComposer:n,queryClient:r,refetchProjects:i,selectProject:a,translate:o}){let[s,c]=(0,G.useState)(!1),l=(0,G.useRef)(!1);return{createDaemon:async(s,u,d)=>{if(l.current)return!1;l.current=!0,c(!0);try{let{created:c,startCampaign:l}=await th(R,s,u,d),f=String(c.workdir||d||``);return r.setQueryData([`projects`],t=>({local_cwd:t?.local_cwd??e,projects:[{id:c.sid,label:s||c.sid,display_name:s,objective:``,launch_cwd:f,workdir:f,last_active:Date.now()/1e3,daemon_alive:!1,daemon_pid:null,uptime_seconds:null},...(t?.projects??[]).filter(e=>e.id!==c.sid)]})),a(c.sid),i(),window.setTimeout(n,0),t(l?`info`:`success`,l?o?o(`new.createdStarting`):`Session created and selected. Campaign is starting in the background.`:o?o(`new.createdIdle`):`Session created and selected.`),l&&l().then(()=>{r.invalidateQueries({queryKey:[`snapshot`,c.sid]}),i(),t(`success`,`Campaign started.`)}).catch(e=>{t(`error`,`Session was created, but the campaign could not start: ${nh(e)}`)}),!0}catch(e){return t(`error`,`Could not create session: ${nh(e)}`),!1}finally{l.current=!1,c(!1)}},creatingDaemon:s}}var ih=e=>e instanceof Error?e.message:String(e||`Unknown error`);function ah({actions:e,manageActions:t,manageTargetSid:n,setManageTargetSid:r,activeSid:i,clearProjectSelection:a,continuous:o,notify:s,refetchProjects:c,selectProject:l,setDaemonManageOpen:u}){let d=e.startDaemon.isPending||e.stopDaemon.isPending||e.forceStopDaemon.isPending||t.startDaemon.isPending||t.forceStopDaemon.isPending||t.updateProject.isPending||t.deleteProject.isPending,f=(0,G.useCallback)(e=>({onSuccess:()=>s(`success`,e),onError:e=>s(`error`,ih(e))}),[s]),p=(0,G.useCallback)(()=>e.startDaemon.mutate(void 0,f(`Daemon start requested.`)),[f,e.startDaemon]),m=(0,G.useCallback)(()=>e.forceStopDaemon.mutate(void 0,f(`Stop requested; the verified daemon process is being interrupted.`)),[f,e.forceStopDaemon]),h=(0,G.useCallback)(async()=>{try{return await t.startDaemon.mutateAsync(),s(`success`,`Daemon resumed.`),!0}catch(e){return s(`error`,ih(e)),!1}},[t.startDaemon,s]),g=(0,G.useCallback)(async()=>{try{return await t.forceStopDaemon.mutateAsync(),await c(),s(`success`,`Daemon stopped. This session can now be deleted.`),!0}catch(e){return s(`error`,ih(e)),!1}},[t.forceStopDaemon,s,c]),_=(0,G.useCallback)(async e=>{if(!n)return!1;try{return await t.updateProject.mutateAsync({sid:n,name:e}),s(`success`,`Session name updated.`),!0}catch(e){return s(`error`,ih(e)),!1}},[t.updateProject,n,s]),v=(0,G.useCallback)(async()=>{if(!n)return!1;try{let e=n,o=await t.deleteProject.mutateAsync();u(!1),r(null);let d=await c();if(e===i){a(`replace`);let e=Yd(d.data?.projects??[])[0];e&&l(e.id,`replace`)}return s(`success`,o.workdir_preserved?`Session moved to recoverable trash. Files remain in ${o.workdir}.`:`Session moved to recoverable trash.`),!0}catch(e){return s(`error`,ih(e)),!1}},[i,a,t.deleteProject,n,s,c,l,u,r]),y=(0,G.useCallback)(e=>{r(e),u(!0)},[u,r]);return{daemonBusy:d,manageDeleteProject:v,manageStopDaemon:g,manageRenameProject:_,manageStartDaemon:h,requestDispose:(0,G.useCallback)((t,n)=>e.disposeBacklog.mutate({id:t,op:n},{onSuccess:()=>s(`success`,n===`done`?`Work marked done.`:`Work removed.`),onError:e=>s(`error`,ih(e))}),[e.disposeBacklog,s]),requestManageSession:y,requestStartDaemon:p,requestStopDaemon:m,requestStopIteration:(0,G.useCallback)(t=>e.stopBacklog.mutate(t,{onSuccess:()=>s(`success`,`Iteration stopped.`),onError:e=>s(`error`,ih(e))}),[e.stopBacklog,s]),toggleContinuous:(0,G.useCallback)(()=>{if(!o)return;let t=!o.enabled;e.setContinuous.mutate({enabled:t,objective:o.objective},f(t?`Continuous campaign enabled.`:`Continuous campaign stopped.`))},[f,e.setContinuous,o])}}function oh({focusComposer:e,openHelp:t,toggleKiosk:n,togglePalette:r,toggleReasoning:i,toggleSidebarCollapse:a}){(0,G.useEffect)(()=>{let o=o=>{let s=o.target,c=s?.tagName===`INPUT`||s?.tagName===`TEXTAREA`,l=o.metaKey||o.ctrlKey;l&&o.key.toLowerCase()===`k`?(o.preventDefault(),r()):l&&o.key.toLowerCase()===`t`?(o.preventDefault(),i()):l&&o.key===`.`?(o.preventDefault(),n()):l&&o.key.toLowerCase()===`b`?(o.preventDefault(),a()):l&&o.key.toLowerCase()===`j`?(o.preventDefault(),e()):!c&&o.key===`?`?(o.preventDefault(),t()):!c&&o.key===`/`&&(o.preventDefault(),e())};return window.addEventListener(`keydown`,o),()=>window.removeEventListener(`keydown`,o)},[e,t,n,r,i,a])}var sh=e=>e instanceof Error?e.message:String(e||`Unknown error`),ch=`argus.decision.prompted.v1`,lh=()=>{try{return window.sessionStorage.getItem(ch)??``}catch{return``}},uh=e=>{try{window.sessionStorage.setItem(ch,e)}catch{}};function dh({activeSid:e,currentTaskId:t,autoOpen:n=!0,backlog:r,notify:i,pendingQuestions:a,refetchSnapshot:o}){let[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(``),p=(0,G.useRef)(!1),m=(0,G.useRef)(``),h=(0,G.useMemo)(()=>{let e=(r??[]).map(e=>({...e,operator_decision:e.operator_decision}));return Xr(a??[],e,t)},[r,a,t]),g=h[0]??null,_=r!==void 0||a!==void 0,v=s!==null&&s.sid===e,y=v?{...s.card,is_current_task:t&&s.card.kind!==`domain_intake`?s.card.item_id===t:void 0}:g;return(0,G.useEffect)(()=>{if(s&&(s.sid!==e||_&&!l&&!h.some(e=>e.id===s.card.id))&&c(null),!e||!g||!n&&g.kind!==`domain_intake`||v||l)return;let t=`${e}:${g.id}`;m.current!==t&&lh()!==t&&(m.current=t,uh(t),f(``),c({sid:e,card:g}))},[e,n,h,_,g,s,v,l]),{answerPendingReply:async(t,n)=>{if(!(!e||!y||p.current)){p.current=!0,u(!0),f(``);try{let r=y.kind===`domain_intake`?await R.answerDomain(e,y.id,t,n):y.legacy?await R.answerPending(e,y.item_id,n):await R.resolveDecision(e,y.id,t,n);if(r.resolved===!1||`kind`in r&&[`error`,`cancelled`].includes(String(r.kind))){f(String(r.reply||`Could not send answer.`)),await o();return}c(e=>e===s?null:e),await o(),r.daemon&&Number(r.daemon.rc??0)!==0?i(`error`,`Answer queued, but the daemon did not start: ${r.daemon.error||`operator action required`}`):y.kind!==`domain_intake`&&i(`success`,String(r.reply||`Manager delivered your answer to the team.`))}catch(e){f(sh(e)),i(`error`,`Could not send answer: ${sh(e)}`),await o()}finally{p.current=!1,u(!1)}}},pendingReply:y,pendingReplyBusy:l,pendingReplyError:d,pendingReplyOpen:v,setPendingReplyOpen:t=>{f(``),t?e&&g&&c(t=>t?.sid===e?t:{sid:e,card:g}):c(null)}}}var fh=`argus.browser.project.v1`;function ph(){try{return window.sessionStorage.getItem(fh)}catch{return null}}function mh(e){try{e?window.sessionStorage.setItem(fh,e):window.sessionStorage.removeItem(fh)}catch{}}function hh(e,t){let n=new URL(window.location.href);e?n.searchParams.set(`project`,e):n.searchParams.delete(`project`);let r=t===`push`?`pushState`:`replaceState`;window.history[r](window.history.state,``,n.toString())}function gh({cancelActiveMessage:e,notify:t,formatProjectMissing:n,projects:r,projectsError:i,projectsReady:a,queryClient:o,setArtifactPath:s,setSidebarOpen:c,setTaskItemId:l}){let u=(e,t)=>n?n(e,t):t?`Project “${e}” was not found. Switched to ${t}.`:`Project “${e}” was not found. Create a project to continue.`,d=new URLSearchParams(window.location.search),[f,p]=(0,G.useState)(d.get(`project`)||ph()),m=(0,G.useRef)(f),h=(0,G.useRef)(!1);m.current=f;let g=(0,G.useCallback)(t=>{t!==m.current&&(e(),s(null),l(null)),m.current=t,p(t),mh(t)},[e,s,l]),_=(0,G.useCallback)((e,t=`push`)=>{let n=new URLSearchParams(window.location.search).get(`project`);g(e),n!==e&&hh(e,t)},[g]),v=(0,G.useCallback)((e=`replace`)=>{let t=new URLSearchParams(window.location.search).get(`project`);g(null),t!=null&&hh(null,e)},[g]),y=(0,G.useCallback)(e=>{o.prefetchQuery({queryKey:[`snapshot`,e],queryFn:({signal:t})=>R.prefetchSnapshot(e,t),staleTime:3e3})},[o]);return(0,G.useEffect)(()=>{if(!a)return;let e=h.current,n=Qd(r,m.current,e);if(!e&&(h.current=!0,n.id===m.current?mh(n.id):g(n.id),new URLSearchParams(window.location.search).get(`project`)!==n.id&&hh(n.id,`replace`),n.recovered)){let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}},[g,n,t,r,a]),(0,G.useEffect)(()=>{let e=()=>{let e=new URLSearchParams(window.location.search).get(`project`);if(c(!1),!e){g(null);return}if(!a){g(e);return}let n=Zd(r,e);if(g(n.id),n.recovered){hh(n.id,`replace`);let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[g,t,r,a,c]),{activateProject:g,activeSid:a?f&&r.some(e=>e.id===f)?f:null:i?f:null,clearProjectSelection:v,prefetchProject:y,selectProject:_,sid:f,sidRef:m}}var _h={text:``,attachments:[],revision:0};function vh(e){let t=(0,G.useRef)(new Map),n=(0,G.useRef)(new Map),r=(0,G.useRef)(0),i=(0,G.useRef)(!0),[,a]=(0,G.useReducer)(e=>e+1,0);(0,G.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let o=(0,G.useCallback)((e,n)=>{let o={text:n.text,attachments:[...n.attachments],revision:++r.current};return t.current.set(e,o),i.current&&a(),{sid:e,...o}},[]),s=(0,G.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??_h;o(e,{...r,text:typeof n==`function`?n(r.text):n})},[o,e]),c=(0,G.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??_h;o(e,{...r,attachments:typeof n==`function`?n(r.attachments):n})},[o,e]),l=(0,G.useCallback)(e=>{if(!e)return null;let n=t.current.get(e);return n||(n={..._h,attachments:[],revision:++r.current},t.current.set(e,n)),{sid:e,...n,attachments:[...n.attachments]}},[]),u=(0,G.useCallback)(e=>i.current&&t.current.get(e.sid)?.revision===e.revision,[]),d=(0,G.useCallback)((e,t)=>u(e)?o(e.sid,{text:``,attachments:e.attachments.filter(e=>!t.includes(e))}):null,[u,o]),f=(0,G.useCallback)((e,t)=>e.sid!==t.sid||!u(e)?!1:(o(t.sid,t),!0),[u,o]),p=(0,G.useCallback)(e=>{if(!e||n.current.has(e))return null;let t={...l(e),request:++r.current};return n.current.set(e,t),a(),t},[l]),m=(0,G.useCallback)((e,t)=>{if(n.current.get(e.sid)!==e)return!1;n.current.delete(e.sid);let r=u(e);return r&&t!==void 0?o(e.sid,{...e,text:t}):i.current&&a(),r},[u,o]),h=(0,G.useCallback)(e=>{t.current.delete(e),n.current.delete(e),i.current&&a()},[]);return{draft:(e?t.current.get(e):null)??_h,rewriting:!!(e&&n.current.has(e)),setText:s,setAttachments:c,capture:l,consume:d,restore:f,beginRewrite:p,finishRewrite:m,drop:h}}function yh(e,t){if(!t.loadedSid||t.loadedSid!==t.sidRef.current)return null;let n=t.receipts.filter(t=>{let n=Or(t);return n?.deliveryId===e.deliveryId&&n.title===e.title&&n.summary===e.summary&&(!e.path||Ko(t).some(t=>t.path===e.path))}),r=!!(t.completionId&&t.completionId===e.deliveryId);return n.length+Number(r)===1?t.loadedSid:null}function bh(e){let t=(0,G.useRef)(e);t.current=e;let n=(0,G.useRef)(null),[r,i]=(0,G.useReducer)(e=>e+1,0),a=(0,G.useCallback)(()=>{n.current?.controller.abort(),n.current=null},[]),o=(0,G.useCallback)((e,r)=>{n.current===e&&(a(),t.current.notify(`error`,`Cannot open notification: ${xt(r)}. No other session was used.`))},[a]);return(0,G.useEffect)(()=>{let e=Ir(e=>{a();let r=e.sessionId??yh(e,t.current);if(!r){t.current.notify(`info`,`This older notification cannot be automatically located. Select its session and open the result manually.`);return}if(!Cr(r)){t.current.notify(`error`,`Cannot open notification: invalid session identity.`);return}let s={payload:e,target:null,phase:`resolving`,controller:new AbortController};n.current=s,t.current.queryClient.fetchQuery({queryKey:[`projects`],queryFn:R.projectIndex,staleTime:0}).then(e=>{if(n.current===s){if(!e.projects.some(e=>e.id===r))throw Error(`the target session is unavailable or no longer accessible`);s.target=r,s.phase=`loading`,t.current.selectProject(r),i()}}).catch(e=>o(s,e))});return window.addEventListener(`popstate`,a),()=>{e(),window.removeEventListener(`popstate`,a),a()}},[a,o]),(0,G.useEffect)(()=>{let e=n.current;if(!e?.target)return;let r=t.current;if(r.sidRef.current!==e.target){a();return}if(e.phase!==`loading`)return;if(r.snapshotError){o(e,r.snapshotError);return}if(r.loadedSid!==e.target)return;e.phase=`opening`;let i=e.payload.path;if(!i){n.current=null,r.noPath(),r.notify(`info`,`Notification session opened. This notification does not identify a file.`);return}R.artifact(e.target,i,e.controller.signal).then(r=>{let a=t.current;if(n.current!==e||a.sidRef.current!==e.target||a.loadedSid!==e.target)return;if(!r.exists||r.path!==i)throw Error(`the target file is unavailable`);n.current=null;let o=a.receipts.find(t=>t.delivery_id===e.payload.deliveryId&&Ko(t).some(e=>e.path===i));o?a.openDelivery(o,i):a.focusPath(i)}).catch(t=>o(e,t))},[e.selectedSid,e.loadedSid,e.snapshotError,r,a,o]),a}function xh(e,t,n){let r=n?t+8:56,i=Math.max(320,e-r-360-8);return Math.max(320,Math.min(840,i,Math.round(e*.45)))}var Sh=[`mission`,`activity`,`workbench`,`map`],Ch=`argus.workspace.view.v3`;function wh(e){return Sh.includes(e)}function Th(e,t){let n=kt(e);return n==null?t:n===`true`}function Eh(){let e=new URLSearchParams(window.location.search),[t,n]=(0,G.useState)(e.get(`kiosk`)===`1`),[r,i]=(0,G.useState)(()=>Th(`argus.reasoning.visible.v1`,!1)),[a,o]=(0,G.useState)(()=>{let t=e.get(`view`);if(wh(t))return t;let n=kt(Ch);return wh(n)?n:e.get(`kiosk`)===`1`?`map`:`activity`}),s=(0,G.useCallback)(e=>{Ot(Ch,e),o(e)},[]),[c,l]=(0,G.useState)(`activity`),[u,d]=(0,G.useState)(()=>Th(`argus.preview.expanded.v6`,!1)),[f,p]=(0,G.useState)(()=>{let e=Number(kt(`argus.sidebar.width.v2`)||256);return Number.isFinite(e)?Math.max(220,Math.min(400,e)):256}),[m,h]=(0,G.useState)(()=>{let e=Number(kt(`argus.preview.width.v2`)||440);return Number.isFinite(e)?Math.max(320,Math.min(840,e)):440}),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(()=>Th(`argus.sidebar.expanded.v4`,!0)),{themeMode:b,themeStyle:x,cycleTheme:S}=Mt(),C=(0,G.useRef)(null),w=(0,G.useRef)(null);(0,G.useEffect)(()=>{Ot(`argus.sidebar.expanded.v4`,String(v)),Ot(`argus.preview.expanded.v6`,String(u)),Ot(`argus.sidebar.width.v2`,String(f)),Ot(`argus.preview.width.v2`,String(m))},[v,f,u,m]),(0,G.useEffect)(()=>{Ot(`argus.reasoning.visible.v1`,String(r))},[r]);let T=(0,G.useCallback)(()=>{d(!0),l(`preview`);let e=C.current?.clientWidth??window.innerWidth;if(e>=1024){let t=xh(e,f,v);h(e=>Math.max(e,t))}},[v,f]),E=(0,G.useCallback)((e,t)=>{let n=C.current;if(!n)return;t.preventDefault();let r=n.getBoundingClientRect(),i=e===`left`?f:m;n.dataset.resizing=e,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let a=t=>{if(e===`left`){let e=u?m+8:0,n=Math.max(220,Math.min(400,r.width-e-360-8));i=Math.max(220,Math.min(n,t.clientX-r.left))}else{let e=v?f+8:56,n=Math.max(320,Math.min(840,r.width-e-360-8));i=Math.max(320,Math.min(n,r.right-t.clientX))}w.current??=window.requestAnimationFrame(()=>{n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),w.current=null})},o=()=>{w.current!=null&&window.cancelAnimationFrame(w.current),w.current=null,n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),e===`left`?p(i):h(i),delete n.dataset.resizing,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o,{once:!0}),window.addEventListener(`pointercancel`,o,{once:!0})},[v,f,u,m]);return(0,G.useEffect)(()=>{let e=()=>{if(window.innerWidth<1024||!C.current)return;let e=C.current.clientWidth,t=v?f:56,n=u?m:0,r=(v?8:0)+(u?8:0),i=Math.max(540,e-360-r);if(t+n<=i)return;let a=u?Math.max(320,Math.min(m,i-t)):n,o=v?Math.max(220,Math.min(f,i-a)):t;o+a>i&&u&&(a=Math.max(320,i-o)),v&&p(o),u&&h(a)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[v,f,u,m]),{cycleTheme:S,kiosk:t,leftPanelOpen:v,leftWidth:f,mobileView:c,openPreview:T,resizeSidebar:E,rightPanelOpen:u,rightWidth:m,setKiosk:n,setLeftPanelOpen:y,setLeftWidth:p,setMobileView:l,setRightPanelOpen:d,setRightWidth:h,setShowReasoning:i,setSidebarOpen:_,setWorkspaceView:s,shellRef:C,showReasoning:r,sidebarOpen:g,themeMode:b,themeStyle:x,workspaceView:a}}function Dh(e){let t=e.trim();if(!t||/\s/.test(t))return``;if(!t.includes(`?`)&&!t.includes(`://`))return t;try{return new URL(t,window.location.href).searchParams.get(`token`)?.trim()??``}catch{return``}}function Oh(e){try{let t=new URL(window.location.href),n=new URL(e.trim(),t);return n.origin===t.origin&&/^\/pair\/[\w-]{32}$/.test(n.pathname)?n.toString():``}catch{return``}}function kh({error:e,onRetry:t}){let{t:n}=z(),r=de(e),i=e instanceof Te,[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``);return!r&&!i?null:(0,J.jsxs)(`div`,{role:`alert`,className:`fixed left-1/2 top-3 z-[100] flex w-[min(92vw,42rem)] -translate-x-1/2 flex-wrap items-start gap-3 rounded-xl border border-err/50 bg-panel/95 px-4 py-3 text-left text-sm text-ink shadow-xl backdrop-blur`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 font-mono font-bold text-err`,children:`!`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`strong`,{className:`block text-err`,children:n(r?`connection.pairingTitle`:`connection.unreachableTitle`)}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-ink-dim`,children:n(r?`connection.pairingDetail`:`connection.unreachableDetail`)})]}),r&&!a?(0,J.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`shrink-0 rounded-md border border-blue/45 bg-blue/10 px-2.5 py-1 text-xs font-medium text-blue hover:bg-blue/15`,children:n(`connection.pairAgain`)}):r?null:(0,J.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded-md border border-err/40 px-2.5 py-1 text-xs text-err hover:bg-err/10`,children:n(`common.retry`)}),r&&a?(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=Oh(s);if(t){window.location.replace(t);return}let r=Dh(s);if(!r){u(n(`connection.pairingInvalid`));return}let i=new URL(window.location.href);i.searchParams.set(`token`,r),window.location.replace(i.toString())},className:`flex w-full basis-full flex-wrap gap-2 pl-7`,children:[(0,J.jsx)(`label`,{className:`sr-only`,htmlFor:`pairing-link`,children:n(`connection.pairingInput`)}),(0,J.jsx)(`input`,{id:`pairing-link`,"data-autofocus":!0,type:`password`,autoComplete:`off`,value:s,onChange:e=>{c(e.target.value),u(``)},placeholder:n(`connection.pairingPlaceholder`),className:`h-9 min-w-0 flex-1 rounded-md border border-line bg-bg px-3 text-xs text-ink outline-none focus:border-blue`}),(0,J.jsx)(`button`,{type:`submit`,className:`h-9 rounded-md border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white`,children:n(`connection.connect`)}),l?(0,J.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-err`,children:l}):null]}):null]})}function Ah(e){try{let t=JSON.parse(kt(e)||`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function jh(e,t,n,r=!0){let i=(0,G.useRef)(),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),l=(0,G.useCallback)(t=>{if(!e)return;let n=`argus.delivery.seen.v1:${e}`;Ot(n,JSON.stringify([...new Set([...Ah(n),t])].slice(-80)))},[e]),u=(0,G.useCallback)((t,n)=>{if(!e)return;l(t.delivery_id);let r=Ko(t),i=r.find(e=>e.path===n)?.path||r[0]?.path||null;o({sid:e,receipt:t,path:i}),c(null)},[e,l]);return(0,G.useEffect)(()=>{if(!e||!t)return;let a=n?.delivery_id;if(i.current?.sid!==e){i.current={sid:e,ids:new Set(a?[a]:[])},o(null),c(null);return}!a||i.current.ids.has(a)||!r||(i.current.ids.add(a),n&&Ko(n).length&&!Ah(`argus.delivery.seen.v1:${e}`).includes(a)&&c({sid:e,receipt:n}))},[e,t,n,r]),{selection:a?.sid===e?a:null,open:u,fresh:s?.sid===e?s.receipt:null,dismissFresh:(0,G.useCallback)(()=>c(null),[]),close:(0,G.useCallback)(()=>o(null),[]),selectPath:(0,G.useCallback)(e=>o(t=>t&&{...t,path:e}),[])}}var Mh=e({default:()=>Lh}),Nh=0,Ph=(0,G.lazy)(async()=>({default:(await Ne(()=>import(`./ResearchWorkbenchPanel-Cf8TK3Lj.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url)).ResearchWorkbenchPanel})),Fh=(0,G.lazy)(async()=>({default:(await Ne(()=>import(`./MapPanel-Bdo6K37E.js`),__vite__mapDeps([13,1,2,3,4,5,6,7,8,14,10,15,11,16]),import.meta.url)).MapPanel}));function Ih(e,t){let[n,r]=(0,G.useState)(e),i=(0,G.useRef)(e),a=(0,G.useRef)(null),o=(0,G.useRef)(0);return i.current=e,(0,G.useEffect)(()=>{if(e===n)return;let s=o.current+t-Date.now();if(s<=0){o.current=Date.now(),r(e);return}a.current||=setTimeout(()=>{a.current=null,o.current=Date.now(),r(i.current)},s)},[e,n,t]),(0,G.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),n}function Lh(){let{locale:e,t}=z(),n=e=>e instanceof ce?t(`connection.pairingDetail`):xt(e),r=M(),i=Ce(),a=De(),o=(0,G.useMemo)(()=>Yd(eh(i.data?.projects??[],a.data?.projects??[])),[a.data?.projects,i.data?.projects]),s=i.data?.local_cwd??``,c=[i.error,a.error].find(e=>ze(e)),[l,u]=(0,G.useState)(`none`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(`feed`),h=(0,G.useCallback)(e=>{f(null),m(e),u(`learning`)},[]),g=(0,G.useCallback)((e,t=`recent`)=>{f(e?{kind:`skill`,item:e}:null),m(e?.scope??(t===`recent`?`feed`:t)),u(`learning`)},[]),_=(0,G.useCallback)(e=>{f(e?{kind:`knowledge`,item:e}:null),m(e?.scope===`private`?`global`:e?.scope??`feed`),u(`learning`)},[]),{cycleTheme:v,kiosk:y,leftPanelOpen:b,leftWidth:x,mobileView:S,openPreview:C,resizeSidebar:w,rightPanelOpen:T,rightWidth:E,setKiosk:D,setLeftPanelOpen:O,setLeftWidth:k,setMobileView:A,setRightPanelOpen:j,setRightWidth:ee,setShowReasoning:N,setSidebarOpen:P,setWorkspaceView:F,shellRef:te,showReasoning:re,sidebarOpen:ie,themeMode:I,workspaceView:L}=Eh(),[oe,se]=(0,G.useState)(()=>L===`mission`?`mission`:`activity`),[le,ue]=(0,G.useState)(L===`workbench`);(0,G.useEffect)(()=>{if(L===`workbench`){ue(!0);return}L!==`map`&&se(L)},[L]);let de=Vm(),[fe,pe]=(0,G.useState)(0),[me,he]=(0,G.useState)(0),[ge,ve]=(0,G.useState)(`auto`),[ye,be]=(0,G.useState)(!1),[we,Te]=(0,G.useState)([]),ke=(0,G.useRef)(null),[Me,Ne]=(0,G.useState)([]),[Fe,Ie]=(0,G.useState)(null),[Le,Re]=(0,G.useState)({path:``,token:0}),[Be,Ve]=(0,G.useState)(null),[He,B]=(0,G.useState)(!1),[Ue,We]=(0,G.useState)(null),[Ge,Ke]=(0,G.useState)(null),qe=(0,G.useRef)(!1),Je=(0,G.useRef)(null),Ye=(0,G.useRef)(0),V=(0,G.useRef)(),Xe=(0,G.useRef)({sid:``,completionId:``,view:null,artifacts:[]}),Ze=(0,G.useRef)(()=>void 0),[Qe,$e]=(0,G.useState)(null),[et,tt]=(0,G.useReducer)($m,Qm),[rt,H]=(0,G.useState)(`all`),[it,at]=(0,G.useState)(``),ot=(0,G.useCallback)(()=>$e(null),[]),st=(0,G.useCallback)((e,t)=>{$e({id:++Nh,tone:e,message:t})},[]),ct=(0,G.useCallback)(()=>{let e=!!Je.current;return Ye.current+=1,Je.current?.controller.abort(),Je.current=null,be(!1),Ne([]),e},[]),ut=(0,G.useCallback)(()=>{let e=Je.current;if(!e||!ct())return;let n=Ye.current;st(`info`,t(`chat.stoppingReply`)),R.cancelMessage(e.sid,e.serverRequestId).then(e=>{Ye.current===n&&st(`info`,t(e.requested?`chat.stopReplyRequested`:`chat.replyAlreadyFinished`))}).catch(e=>{Ye.current===n&&st(`error`,t(`chat.stopReplyFailed`,{error:xt(e)}))})},[ct,st,t]),{activeSid:U,clearProjectSelection:W,prefetchProject:ft,selectProject:pt,sid:mt,sidRef:ht}=gh({cancelActiveMessage:ct,notify:st,formatProjectMissing:(e,n)=>n?t(`project.missingSwitched`,{requested:e??``,fallback:n}):t(`project.missingCreate`,{requested:e??``}),projects:o,projectsError:i.isError,projectsReady:i.isSuccess,queryClient:r,setArtifactPath:Ie,setSidebarOpen:P,setTaskItemId:Ve}),{draft:{text:gt,attachments:_t},rewriting:vt,setText:yt,setAttachments:bt,capture:St,consume:Ct,restore:wt,beginRewrite:Tt,finishRewrite:Dt,drop:Ot}=vh(mt),kt=(0,G.useCallback)((e,t)=>{Ze.current(),pt(e,t)},[pt]),At=(0,G.useCallback)(e=>{Ze.current(),W(e)},[W]);(0,G.useEffect)(()=>ve(`auto`),[U]),(0,G.useEffect)(()=>{Re(e=>e.path?{path:``,token:e.token+1}:e)},[mt]),(0,G.useEffect)(()=>()=>{Ye.current+=1,Je.current?.controller.abort(),Je.current=null},[]),(0,G.useEffect)(()=>Rr(),[]);let jt=(0,G.useCallback)(e=>{let t=(e||``).trim(),n=ht.current;if(!t||!n)return;let r=Tt(n);r&&R.rewritePrompt(n,t).then(e=>{if(e.error||!e.rewritten.trim()){Dt(r)&&ht.current===n&&st(`error`,`Rewrite failed: ${e.error||`empty rewrite`} — your prompt is unchanged`);return}if(!Dt(r,e.rewritten)||ht.current!==n)return;pe(e=>e+1);let t=e.questions.length?` Manager asks: ${e.questions.join(` · `)}`:``;st(`success`,`Prompt rewritten — review it, then send.${t}`)},e=>{Dt(r)&&ht.current===n&&st(`error`,`Rewrite failed: ${xt(e)} — your prompt is unchanged`)})},[Tt,Dt,st,ht]),{createDaemon:Mt,creatingDaemon:Nt}=rh({localCwd:s,notify:st,onFocusComposer:()=>pe(e=>e+1),queryClient:r,refetchProjects:i.refetch,selectProject:kt,translate:t}),Pt=(0,G.useCallback)(()=>{Mt(``,``,``)},[Mt]),zt=(0,G.useRef)(Pt);zt.current=Pt,(0,G.useEffect)(()=>Lr(()=>zt.current()),[]);let Vt=Se(U),Ht=Se(Ue),K=Vt.data,q=K?.session.id===U?U:null,Ut=K?.continuous,Wt=_e(q,!0),Gt=Pe(q,oe===`mission`),{events:Kt,connected:qt}=Ee(q,et.reconnectKey),Jt=(0,G.useMemo)(()=>Oe(Kt),[Kt]),Yt=(0,G.useMemo)(()=>je(Kt),[Kt]);(0,G.useEffect)(()=>{if(!q||!Jt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`artifacts`,q],exact:!0})},180);return()=>window.clearTimeout(e)},[Jt,q,r]),(0,G.useEffect)(()=>{if(!q||!Yt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`snapshot`,q],exact:!0})},80);return()=>window.clearTimeout(e)},[q,r,Yt]);let Xt=(0,G.useMemo)(()=>qm(Kt),[Kt]),{query:Zt,events:Qt,status:$t}=Bt(q,oe===`activity`,Kt,we,ke.current),en=q&&K?.manager_requests?.filter(e=>e.status===`running`).at(-1)?.request_id||``,tn=ye||!!en;(0,G.useEffect)(()=>{if(!q)return;let e=Je.current;if(en){e||(Je.current={id:++Ye.current,serverRequestId:en,sid:q,controller:new AbortController,recovered:!0},be(!0));return}e?.recovered&&e.sid===q&&(Je.current=null,be(!1),Ne([]),Zt.refetch())},[en,q,Zt.refetch]);let nn=xe(U,20,l===`inspector`),rn=Ih((0,G.useMemo)(()=>({sid:q,events:Kt,conversation:Qt}),[q,Kt,Qt]),250),an=rn.sid===q?rn.events:[],on=rn.sid===q?rn.conversation:[],sn=(0,G.useMemo)(()=>K?If(K,Qt,Wt.data??[]):null,[Qt,Wt.data,K]),{answerPendingReply:cn,pendingReply:ln,pendingReplyBusy:un,pendingReplyError:dn,pendingReplyOpen:fn,setPendingReplyOpen:pn}=dh({activeSid:U,currentTaskId:sn?.mission.id,autoOpen:L!==`map`,backlog:K?.backlog,notify:st,pendingQuestions:K?.pending_questions,refetchSnapshot:Vt.refetch}),mn=K?.daemon.alive&&sn?.routing.vertical===`research`?sn.active_role.startsWith(`reviewer`)?`reviewing`:sn.active_role.startsWith(`engineer`)?`revising`:void 0:void 0,hn=Yo((0,G.useMemo)(()=>mu(Qt),[Qt]),sn?.delivery??null,Qt),gn=K?.backlog.some(e=>[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))??!1,_n=Uf(sn)&&!gn&&!K?.continuous?.enabled,vn=q&&_n&&sn?.mission.id?`completion:${q}:${sn.mission.id}`:``;Xe.current={sid:q||``,completionId:vn,view:sn,artifacts:Wt.data??[]};let yn=(0,G.useCallback)(()=>{C()},[C]),bn=(0,G.useCallback)((e,t=!0)=>{let n=e.trim();if(!n){t&&F(`map`);return}if(L===`map`){Ie(n);return}j(!0),A(`preview`),Re(e=>({path:n,token:e.token+1}))},[A,j,F,L]),xn=jh(q,!!K&&!Zt.isPending,hn,!Fe&&!Xo(K?.backlog??[],hn?.item_id)),Sn=xn.open,Cn=(0,G.useMemo)(()=>{let e=new Map;for(let t of Qt){let n=t.delivery;n?.delivery_id&&Array.isArray(n.targets)&&e.set(n.delivery_id,n)}for(let t of[sn?.delivery,hn])t&&e.set(t.delivery_id,t);return[...e.values()].filter(e=>Ko(e).length).sort((e,t)=>t.delivered_at-e.delivered_at)},[Qt,sn?.delivery,hn]);(0,G.useEffect)(()=>{q&&hn?.delivery_id&&r.invalidateQueries({queryKey:[`artifacts`,q],exact:!0})},[q,hn?.delivery_id,r]),(0,G.useEffect)(()=>{if(!q)return;let e=V.current;if(!e||e.sid!==q){V.current={sid:q,id:vn||null};return}if(!vn){V.current={sid:q,id:null};return}if(e.id===vn)return;let n=window.setTimeout(()=>{let e=Xe.current;if(e.sid!==q||e.completionId!==vn||!e.view)return;let n=e.view.delivery,r=Jf(e.artifacts),i=Dr({completionId:vn,sessionId:q,title:n?.title||e.view.mission.title||t(`mission.taskCompleted`),summary:n?.summary||e.view.mission.summary,path:n?.primary_target?.path||r?.path});i&&Nr(i),V.current={sid:q,id:vn}},500);return()=>window.clearTimeout(n)},[vn,q,t]),Ze.current=bh({selectedSid:mt,loadedSid:q,sidRef:ht,snapshotError:Vt.error,queryClient:r,receipts:Zt.isPending?[]:Cn,completionId:vn,selectProject:e=>{pt(e),P(!1)},openDelivery:Sn,focusPath:e=>{Wt.data?.some(t=>t.path===e&&t.exists)?bn(e):Ie(e)},noPath:()=>{A(`activity`),F(`map`)},notify:st});let wn=(0,G.useRef)(Qt);wn.current=Qt,(0,G.useEffect)(()=>{H(`all`),at(``),Te([]),tt({kind:`reset`})},[q]);let Tn=Ae(U,K?.daemon_commands?.revision),En=Ae(Ue,Ht.data?.daemon_commands?.revision),Dn=(0,G.useCallback)(async e=>{Ke(e);try{await R.startDaemon(e),await i.refetch(),st(`success`,t(`sidebar.resumeSuccess`))}catch(e){st(`error`,t(`sidebar.resumeFailed`,{error:xt(e)}))}finally{Ke(null)}},[st,i,t]),{daemonBusy:On,manageDeleteProject:kn,manageStopDaemon:An,manageRenameProject:jn,manageStartDaemon:Mn,requestDispose:Nn,requestManageSession:Pn,requestStartDaemon:Fn,requestStopDaemon:In,requestStopIteration:Ln,toggleContinuous:Rn}=ah({actions:Tn,manageActions:En,manageTargetSid:Ue,setManageTargetSid:We,activeSid:U,clearProjectSelection:At,continuous:Ut,notify:st,refetchProjects:i.refetch,selectProject:kt,setDaemonManageOpen:B}),zn=(0,G.useCallback)(async e=>{if(!U)return;let t=await Tn.updateProject.mutateAsync({sid:U,name:e});st(`success`,`Renamed to "${t.name}".`)},[Tn.updateProject,U,st]),Bn=(0,G.useMemo)(()=>Ym({activeSid:U,activityEventsRef:wn,notify:st,onClearEvents:e=>tt({kind:`clear`,offset:e}),onDispose:Nn,onOpenConfig:()=>u(`config`),onOpenDoctor:()=>u(`doctor`),onOpenHelp:()=>u(`help`),onOpenIdentity:()=>u(`identity`),onOpenInspector:()=>u(`inspector`),onOpenNewDaemon:Pt,onOpenOperations:()=>u(`operations`),onOpenSidebar:()=>P(!0),onOpenSkills:()=>g(void 0,`global`),onReconnectEvents:()=>tt({kind:`reconnect`}),onRenameProject:zn,onRewriteDraft:jt,onSelectProject:kt,onSetArtifactPath:Ie,onSetEventFilter:H,onSetEventQuery:at,onSetTaskItemId:Ve,onSetWorkspaceView:F,onShowArtifacts:yn,onStopIteration:Ln,onStopWaiting:ut,refetchSnapshot:Vt.refetch}),[U,st,yn,g,zn,Nn,Ln,jt,kt,Vt.refetch,ut,F]);oh({focusComposer:()=>pe(e=>e+1),openHelp:()=>u(`help`),toggleKiosk:()=>D(e=>!e),togglePalette:()=>u(e=>e===`palette`?`none`:`palette`),toggleReasoning:()=>N(e=>!e),toggleSidebarCollapse:()=>O(e=>!e)});let Vn=async(e,n=[],i)=>{let a=U;if(!a||a!==ht.current||qe.current||Je.current)return!1;let o=Ye.current;qe.current=!0;let s,c,l;try{if(!n.length){let t=await Jm(e,Bn);if(t.kind===`handled`)return i?.({type:`settled`,outcome:`message`}),!0;if(t.kind===`error`)return st(`error`,t.message),!1}if(ht.current!==a||Ye.current!==o)return!1;s=++Ye.current,c=ne(),l=new AbortController,Je.current={id:s,serverRequestId:c,sid:a,controller:l}}finally{qe.current=!1}let u=()=>{let e=Je.current;return!!(e&&e.id===s&&e.sid===a&&ht.current===a&&!l.signal.aborted)},d=()=>{Je.current?.id===s&&(Je.current=null,be(!1),Ne([]))};be(!0),Ne([]);let f=[];if(n.length)try{let e=await R.uploadAttachments(a,n,l.signal);if(!u())return!1;f=e.attachments.map(e=>({attachment_id:e.attachment_id}))}catch(e){return u()&&(st(`error`,t(`chat.attachmentUploadFailed`,{error:xt(e)})),d()),!1}let p=ke.current===a;ke.current=a,Te(t=>Ft([...p?t:[],Lt(a,s,e)],a,s,[]));let m=(e,t=``,n=`auto`)=>{!u()||typeof e!=`string`||!e.trim()||Te(r=>Rt(r,a,s,e,t,Date.now(),n))},h=e=>{if(!u())return;let t=e.item;typeof t?.id==`string`&&i?.({type:`task`,taskId:t.id});let n=e.daemon&&typeof e.daemon==`object`?e.daemon:null,r=typeof e.reply==`string`?e.reply:null;n?.admission_required?st(`error`,r||`Task queued, but all daemon slots are busy: ${String(n.error||`operator action required`)}`):n&&Number(n.rc??0)!==0?st(`error`,r||`Task queued, but executor did not start: ${String(n.error||`unknown error`)}`):r&&!i&&st(`success`,r),Vt.refetch?.()},g=e=>{u()&&(r.invalidateQueries({queryKey:[`artifacts`,a]}),Zm(e,{dispatchTask:h,notifyError:e=>st(`error`,e),refetchTranscript:()=>{Zt.refetch()}}))};return(async()=>{let t=!1,n=null,r=[];try{try{await R.messageStream(a,e,{onPhase:(e,t,n)=>{if(!u()||n.heartbeat)return;r=Hl(r,{label:e,role:t,kind:n.kind,detail:n.detail,heartbeat:n.heartbeat,quietS:n.quietS,tool:n.tool,toolKind:n.toolKind,callId:n.callId,status:n.status,output:n.output}),Ne(r);let i=Gl(r);i.length&&Te(e=>Ft(e,a,s,i,Date.now(),!0))},onDelta:(e,n,r)=>{u()&&(t=!0,m(e,n,r===`append`||r===`snapshot`?r:`auto`))},onDone:e=>{if(!u())return;e.kind!==`error`&&ve(`auto`),r=Ul(r),Ne(r);let t=Jl(e.steps),n=t.length?t:Gl(r,Date.now()/1e3,!0);Te(t=>Ft(t,a,s,n,Date.now(),!1,e.kind===`error`?`failed`:`completed`)),m(e.reply,``,`snapshot`),g(e);let o=e.item;(e.kind!==`task`||typeof o?.id!=`string`)&&i?.({type:`settled`,outcome:e.kind===`error`?`error`:`message`})},onError:e=>{u()&&(n=e)}},{signal:l.signal,attachments:f,routeOverride:ge,requestId:c})}catch(e){u()&&(n=e)}if(!u())return;n&&(st(`error`,Et(n,t)),i?.({type:`settled`,outcome:`error`}))}finally{Te(e=>It(e,s,Date.now(),n&&!l.signal.aborted?`failed`:`stopped`)),l.signal.aborted&&i?.({type:`settled`,outcome:`cancelled`}),d()}})(),!0},Hn=(0,G.useRef)(Vn);Hn.current=Vn;let Un=async(e,t=[],n,r)=>{let i=St(ht.current);if(!i)return!1;if(r?.whileRunning){try{if(!t.length){let n=await Jm(e,Bn);if(n.kind===`error`)return st(`error`,n.message),!1;if(n.kind===`handled`)return Ct(i,t),!0}await R.queueFollowup(i.sid,e,ge)}catch(e){return st(`error`,xt(e)),!1}return Ct(i,t),!0}let a=null,o=!1,s=!t.length&&ju(e.trim())?.cmd?.id===`rewrite`,c=await Vn(e,t,e=>{e.type===`settled`&&e.outcome===`error`&&(o=!0,a&&wt(a,i)),ht.current===i.sid&&n?.(e)});return c&&!o&&!s&&(a=Ct(i,t)),c},Wn=(0,G.useMemo)(()=>{let n=dd(xu,e=>{Hn.current(e)},e=>{yt(e),pe(e=>e+1)},e),r=[...y?[]:[{id:`new`,label:t(`palette.newDaemon`),hint:`+`,group:t(`palette.view`),run:Pt}],{id:`transcript`,label:t(`palette.openTranscript`),hint:`/transcript`,group:t(`palette.view`),run:()=>u(`transcript`)},{id:`inspector`,label:t(`palette.openProject`),hint:t(`palette.projectHint`),group:t(`palette.view`),run:()=>u(`inspector`)},{id:`operations`,label:t(`palette.openOperations`),hint:t(`palette.operationsHint`),group:t(`palette.view`),run:()=>u(`operations`)},{id:`verticals`,label:t(`verticals.openStore`),hint:t(`verticals.paletteHint`),group:t(`palette.view`),run:()=>u(`verticals`)},{id:`help`,label:t(`help.title`),hint:`?`,group:t(`palette.view`),run:()=>u(`help`)},{id:`reasoning`,label:t(re?`palette.hideReasoning`:`palette.showReasoning`),hint:`⌘T`,group:t(`palette.view`),run:()=>N(e=>!e)},{id:`kiosk`,label:t(y?`palette.exitKiosk`:`palette.enterKiosk`),hint:`⌘.`,group:t(`palette.view`),run:()=>D(e=>!e)}],i=y?[]:[{id:`message`,label:t(`palette.messageArgus`),hint:`/`,group:t(`palette.action`),run:()=>pe(e=>e+1)},...tn?[{id:`cancel-message`,label:t(`palette.stopWaiting`),hint:`Esc`,group:t(`palette.action`),run:ut}]:[],...Ut?[{id:`continuous`,label:Ut.enabled?t(`palette.stopContinuous`):t(`palette.startContinuous`),group:t(`palette.action`),run:Rn}]:[],...K?.daemon.control_available===!1?[]:[K?.daemon.alive?{id:`stop`,label:t(`palette.stopDaemon`),group:t(`palette.action`),run:In}:{id:`start`,label:t(`palette.startDaemon`),group:t(`palette.action`),run:Fn}]],a=o.map(e=>({id:`p-${e.id}`,label:Jd(e)?(e.label||e.display_name||``).trim():e.objective.trim()||t(`sidebar.unnamedSession`),hint:e.daemon_alive?`● ${t(`common.live`)}`:`○`,keywords:`${e.id} ${e.display_name??``} ${e.objective} ${e.daemon_alive?`live running`:`stopped idle`}`,group:t(`palette.project`),run:()=>kt(e.id)}));return[...r,...i,...n,...a]},[o,K?.daemon.alive,y,re,Ut?.enabled,tn,ut,yt,e,t]);return(0,J.jsx)(xs,{sid:U,readOnly:y,children:(0,J.jsxs)(nt,{ref:te,style:{"--sidebar-width":`${x}px`,"--preview-width":`${E}px`},children:[(0,J.jsx)(kh,{error:c,onRetry:()=>{i.refetch(),a.refetch()}}),xn.fresh&&!xn.selection&&(0,J.jsxs)(`div`,{className:`delivery-toast`,role:`status`,"aria-live":`polite`,children:[(0,J.jsxs)(`span`,{children:[e===`zh-CN`?`新交付:`:`New delivery: `,xn.fresh.title]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>Sn(xn.fresh),children:e===`zh-CN`?`查看`:`Open`}),(0,J.jsx)(`button`,{type:`button`,"aria-label":e===`zh-CN`?`关闭`:`Dismiss`,onClick:xn.dismissFresh,children:`×`})]}),xn.selection&&(0,J.jsx)(yf,{sid:xn.selection.sid,path:xn.selection.path,delivery:xn.selection.receipt,deliveries:Cn,reviewActivity:xn.selection.sid===q?mn:void 0,onSelectDelivery:Sn,onSelectPath:xn.selectPath,onClose:xn.close},`${xn.selection.sid}:${xn.selection.receipt.delivery_id}`),!y&&ie?(0,J.jsx)(`button`,{type:`button`,"aria-label":t(`common.closeSessions`),onClick:()=>P(!1),className:`fixed inset-0 z-30 bg-black/40 lg:hidden`}):null,y?null:(0,J.jsx)(nm,{projects:o,activeId:U,activeWork:q?{sessionId:q,status:ci(K,sn,Qt),connected:qt&&!Vt.isError}:void 0,localCwd:s,onSelect:e=>{kt(e),P(!1)},onPrefetch:ft,onManage:Pn,onResume:e=>void Dn(e),resumingId:Ge,onOpenPanel:e=>u(e),onOpenLearning:h,onOpenVerticals:()=>u(`verticals`),onNew:Pt,loading:i.isLoading,creating:Nt,error:i.isError?xt(i.error):void 0,onRetry:()=>void i.refetch(),mobileOpen:ie,collapsed:!b,onToggleCollapse:()=>O(e=>!e),themeMode:I,onCycleTheme:v}),!y&&b?(0,J.jsx)(gm,{label:t(`common.resizeSessions`),value:x,min:220,max:400,onPointerDown:e=>w(`left`,e),onReset:()=>k(256),onNudge:e=>k(t=>Math.max(220,Math.min(400,t+e)))}):null,(0,J.jsx)(`main`,{className:`flex min-w-0 flex-1 overflow-x-hidden`,children:K?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`${S===`activity`?`flex`:`hidden`} ${L===`map`&&!y?`mobile-scroll-region`:``} glass-panel glass-panel--main h-full min-w-0 flex-1 flex-col lg:flex`,children:[(0,J.jsx)(qd,{sid:q}),L!==`map`&&(0,J.jsx)(wi,{events:Qt,snap:K,streamOk:qt,onStart:Fn,onStop:In,onManage:()=>U&&Pn(U),busy:On,snapshotStale:Vt.isError,readOnly:y,missionView:sn}),(0,J.jsxs)(`nav`,{"aria-label":t(`mobile.views`),className:`hidden h-11 shrink-0 items-center gap-3 border-b border-line/60 px-5 lg:flex`,children:[(0,J.jsxs)(`div`,{className:`workspace-tabs`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`map`),className:`workspace-tab`,"data-selected":L===`map`,children:t(`mobile.map`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`activity`),className:`workspace-tab`,"data-selected":L===`activity`,children:t(`mobile.activity`)})]}),(0,J.jsxs)(`details`,{className:`workspace-more`,onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.open=!1,e.currentTarget.querySelector(`summary`)?.focus())},children:[(0,J.jsx)(`summary`,{children:L===`mission`?t(`mobile.mission`):L===`workbench`?t(`mobile.workbench`):e===`zh-CN`?`更多`:`More`}),(0,J.jsxs)(`div`,{className:`workspace-more-menu`,onClick:e=>{e.target.closest(`button`)&&e.currentTarget.closest(`details`)?.removeAttribute(`open`)},children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`mission`),children:t(`mobile.mission`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`reading`),children:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>F(`workbench`),children:t(`mobile.workbench`)}),y?null:(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(`operations`),children:t(`mission.operations`)})]})]}),(0,J.jsxs)(`button`,{type:`button`,className:`ml-auto px-2 py-1 text-sm text-ink-dim hover:text-ink`,"aria-expanded":T,onClick:()=>{T?(j(!1),A(`activity`)):yn()},children:[e===`zh-CN`?`文件`:`Files`,Wt.data?.length?` · ${Wt.data.filter(e=>e.exists).length}`:``]})]}),!y&&(0,J.jsx)(tr,{sid:U,onOpenKnowledge:()=>_(),onOpenSkills:()=>g()}),L===`map`&&(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(`div`,{className:`m-auto text-sm text-ink-faint`,children:t(`common.loading`)}),children:(0,J.jsx)(Fh,{snapshot:K,events:an,managerSteps:Me,draft:gt,onDraftChange:yt,onSend:Un,attachments:_t,onAttachmentsChange:bt,pending:tn,onCancel:ut,focusSignal:fe,readOnly:y,onOpenSettings:()=>u(`config`),currentTaskId:sn?.mission.id,routeOverride:ge,onRouteOverrideChange:ve,conversationEvents:on,connected:qt,artifacts:Wt.data??[],deliveryCount:Cn.length,onOpenDelivery:()=>{let e=qo(Cn,sn?.routing.vertical||``);e&&Sn(e.receipt,e.path)},onOpenReceipt:Sn,onOpenArtifact:Ie,onAnswer:()=>pn(!0)},K.session.id)}),(0,J.jsxs)(`div`,{className:`${L===`workbench`||L===`map`?`hidden`:`flex`} min-h-0 flex-1 flex-col`,children:[(0,J.jsx)(Kd,{alert:Xt}),oe===`mission`&&sn?(0,J.jsx)(Am,{events:Qt,connected:qt&&!Vt.isError,view:sn,sid:K.session.id,snapshot:K,gitDiff:Gt.data,artifacts:Wt.data,onOpenArtifact:bn,onOpenDelivery:Sn,onNotify:st,onAsk:y?void 0:e=>{yt(t=>t.trim()?`${t}\n\n${e}`:e),pe(e=>e+1)}}):(0,J.jsx)(`div`,{className:`flex flex-1 flex-col ${de?`min-h-0`:`min-h-[209px] lg:min-h-0`}`,children:(0,J.jsx)(_u,{snapshot:K,missionView:sn,events:Qt,connected:qt&&!Vt.isError,showReasoning:re,onToggleReasoning:()=>N(e=>!e),historyStatus:$t,historyRefreshing:Zt.isFetching,onRetryHistory:()=>void Zt.refetch(),embedded:!0,filter:rt,query:it,skipFirst:et.skipFirst,artifacts:Wt.data,onOpenArtifact:bn,onOpenDelivery:Sn},q)}),y?null:(0,J.jsx)(`div`,{className:`composer-dock shrink-0 px-4 pt-3`,children:(0,J.jsxs)(`div`,{className:`mx-auto w-full max-w-full lg:max-w-[61.8vw]`,children:[(0,J.jsx)(Wd,{questions:K.pending_questions??[],backlog:K.backlog,currentTaskId:sn?.mission.id,onAnswer:()=>pn(!0)}),(0,J.jsx)(ud,{value:gt,attachments:_t,onAttachmentsChange:bt,onChange:yt,onSend:Un,onCancel:ut,disabled:!U,pending:tn,focusSignal:fe,embedded:!0,onRewrite:jt,rewriting:vt,slashSelection:me,onSlashSelectionChange:he,routeOverride:ge,onRouteOverrideChange:ve,footer:U?(0,J.jsx)(Vr,{sid:K.session.id,roles:K.roles,running:K.daemon.alive||!!K.manager_requests?.length,lastCall:K.last_call,onOpenSettings:()=>u(`config`)}):void 0},U||`no-session`)]})})]}),le&&U?(0,J.jsx)(`div`,{className:`${L===`workbench`?`flex`:`hidden`} min-h-0 flex-1`,children:(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-xs text-ink-faint`,children:t(`common.loading`)}),children:(0,J.jsx)(Ph,{sid:U,active:L===`workbench`})})}):null]}),T&&L!==`map`?(0,J.jsx)(gm,{label:t(`common.resizePreview`),value:E,min:320,max:840,onPointerDown:e=>w(`right`,e),onReset:()=>ee(440),onNudge:e=>ee(t=>Math.max(320,Math.min(840,t-e)))}):null,(T&&L!==`map`||S===`preview`)&&(0,J.jsxs)(`aside`,{"data-resizable-panel":`right`,className:`${S===`preview`?`flex`:`hidden`} relative min-w-0 flex-1 flex-col overflow-hidden border-l border-line/60 bg-panel lg:flex lg:flex-none lg:w-[var(--preview-width)]`,children:[(0,J.jsx)(`div`,{className:`lg:hidden`,children:(0,J.jsx)(wi,{events:Qt,snap:K,streamOk:qt,onStart:Fn,onStop:In,onManage:()=>U&&Pn(U),busy:On,snapshotStale:Vt.isError,readOnly:y,missionView:sn})}),(0,J.jsx)(ep,{snapshot:K,connected:qt&&!Vt.isError,sid:q,artifacts:Wt.data,error:Wt.isError,onExpand:Ie,onOpenFile:yn,className:`min-h-0 flex-1 mobile-scroll-region`,embedded:!0,onCollapse:()=>{j(!1),A(`activity`)},missionView:sn,activityEvents:Qt,requestedPath:Le.path,requestedPathToken:Le.token,routeVisible:L!==`mission`})]})]}):(0,J.jsx)(Rm,{loading:i.isLoading||!!(U&&Vt.isLoading),hasProjects:o.length>0,error:i.isError&&o.length===0?n(i.error):Vt.isError&&!K?n(Vt.error):void 0,onRetry:()=>{i.refetch(),U&&Vt.refetch()},onNew:Pt,onChoose:()=>P(!0),canCreate:!y})}),(0,J.jsx)(dt,{open:l===`learning`,onClose:()=>u(`none`),label:e===`zh-CN`?`知识与技能`:`Knowledge and skills`,width:`max-w-6xl`,children:l===`learning`&&(0,J.jsx)(mr,{sid:U,initialSelection:d,initialScope:p,projectNames:Object.fromEntries(o.flatMap(e=>e.display_name?[[e.id,e.display_name]]:[]))})}),(0,J.jsxs)(dt,{open:l===`reading`,onClose:()=>u(`none`),label:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`,children:[(0,J.jsx)(lt,{title:e===`zh-CN`?`任务说明与依据`:`Task explanation and evidence`}),l===`reading`&&K&&sn?.mission.id&&U?(0,J.jsxs)(J.Fragment,{children:[ae()===`question-foundation`?(0,J.jsx)(bf,{sid:U,objective:K.session.objective,readOnly:y,onOpenArtifact:Ie}):null,(0,J.jsx)(Ws,{sid:U,snapshot:K,view:sn,active:!0,readOnly:y,onOpenArtifact:Ie,onAsk:e=>{yt(t=>t.trim()?`${t}\n\n${e}`:e),pe(e=>e+1),u(`none`)}},U),(0,J.jsx)(`div`,{className:`px-4 pb-4`,children:(0,J.jsx)(ys,{})})]}):(0,J.jsx)(`p`,{className:`px-6 pb-6 text-sm text-ink-dim`,children:e===`zh-CN`?`开始任务后,可以在这里查看说明和依据。`:`Task explanations and evidence appear here once work begins.`})]}),(0,J.jsx)(pd,{open:l===`palette`,onClose:()=>u(`none`),items:Wn}),(0,J.jsx)($p,{open:l===`verticals`,onClose:()=>u(`none`)}),(0,J.jsx)(hd,{open:l===`help`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(zd,{sid:U,open:l===`doctor`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Bd,{sid:U,open:l===`config`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Vd,{sid:U,open:l===`identity`,onClose:()=>u(`none`)}),U&&(0,J.jsx)(Hd,{sid:U,open:l===`transcript`,onClose:()=>u(`none`)}),U&&K?(0,J.jsx)(fm,{open:l===`inspector`,snap:K,journal:nn.data??[],busy:Tn.disposeBacklog.isPending||Tn.stopBacklog.isPending,onClose:()=>u(`none`),onDispose:Nn,onStop:Ln,onInspect:Ve}):null,U&&K?(0,J.jsx)(Fm,{open:l===`operations`,onOpenSkills:()=>g(void 0,`global`),sid:U,snap:K,onClose:()=>u(`none`),onChanged:()=>{Vt.refetch(),i.refetch()},onRestored:async e=>{await i.refetch(),kt(e)}}):null,(0,J.jsx)(yf,{sid:U,path:Fe,artifacts:Wt.data??[],reviewActivity:U===q?mn:void 0,onSelectPath:Ie,onClose:()=>Ie(null)}),(0,J.jsx)(hm,{sid:U,itemId:Be,onClose:()=>Ve(null),onDone:e=>Nn(e,`done`),onSkip:e=>Nn(e,`rm`),onStop:Ln,busy:Tn.disposeBacklog.isPending||Tn.stopBacklog.isPending,readOnly:y}),(0,J.jsx)(Gd,{reply:ln,open:fn,busy:un,error:dn,onClose:()=>pn(!1),onSubmit:cn}),Ue?(0,J.jsx)(np,{open:He,sid:Ue,name:Ht.data?.session.display_name||o.find(e=>e.id===Ue)?.display_name||o.find(e=>e.id===Ue)?.label||``,alive:Ht.data?.daemon.alive??!!o.find(e=>e.id===Ue)?.daemon_alive,controlAvailable:Ht.data?.daemon.control_available!==!1,busy:On,onClose:()=>{B(!1),We(null)},onRename:jn,onStart:Mn,onStop:An,onDelete:async()=>{let e=Ue,t=await kn();return t&&e&&Ot(e),t}}):null,(0,J.jsx)(tp,{notice:Qe,onClose:ot}),K&&!y?(0,J.jsx)(zm,{active:S===`preview`?`preview`:L,sidebarOpen:ie,onSelect:e=>{if(e===`preview`){A(`preview`);return}A(`activity`),F(e)},onOpenSessions:()=>P(!0),onRead:()=>u(`reading`),onOpenSkills:()=>g()}):null]})})}export{Ii as $,go as A,Jt as At,ga as B,Do as C,sn as Ct,So as D,$t as Dt,wo as E,rn as Et,eo as F,Ja as G,Ya as H,ro as I,oa as J,ma as K,so as L,Qa as M,Kt as Mt,to as N,Ut as Nt,xo as O,Qt as Ot,no as P,Ht as Pt,ki as Q,io as R,Oo as S,ln as St,Co as T,an as Tt,ba as U,Ra as V,Ca as W,sa as X,aa as Y,Ti as Z,Gc as _,Hr as _t,Wd as a,Ui as at,Ss as b,gn as bt,Ju as c,Bi as ct,id as d,Lh as default,Si as dt,Zi as et,vu as f,ii as ft,Xc as g,Qr as gt,Kc as h,pi as ht,rf as i,Pi as it,ho as j,qt as jt,mo as k,Xt as kt,Gu as l,zi as lt,Ml as m,ri as mt,vm as n,Yi as nt,cd as o,Mi as ot,_u as p,ci as pt,la as q,vf as r,Hi as rt,ad as s,ji as st,Mh as t,Ai as tt,td as u,Xi as ut,Pc as v,Vr as vt,ko as w,on as wt,Uo as x,dn as xt,Hc as y,yn as yt,oo as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/App-q-3YCWKy.js b/frontend/web/dist/assets/App-q-3YCWKy.js new file mode 100644 index 000000000..f280cdeb3 --- /dev/null +++ b/frontend/web/dist/assets/App-q-3YCWKy.js @@ -0,0 +1,48 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ResearchWorkbenchPanel-BmPuH7pM.js","./rolldown-runtime-hePW80VL.js","./icons-DHjcpj5P.js","./query-dCPZk0Xc.js","./index-DPfzOfKU.js","./markdown-BGG43fCg.js","./markdown-DvoRHisr.css","./index-CNuZH30Y.css","./AppearanceControls-Bc1ibrT3.js","./activity-BEiyr9-4.js","./sliders-horizontal-CSN_5pyz.js","./code-xml-DnBfjec4.js","./useWorkbenchTheme-BqK4B8rm.js","./ResearchWorkbenchPanel-Cc5mx_fm.css","./MapPanel-C4kGIk-g.js","./history-B00Gliyq.js","./format-D4uyBiG8.js","./MapPanel-H65d2ArA.css"])))=>i.map(i=>d[i]); +import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y}from"./icons-DHjcpj5P.js";import{S as b,a as x,c as S,n as C,r as w}from"./query-dCPZk0Xc.js";import{i as T}from"./markdown-BGG43fCg.js";import{A as E,B as D,C as O,D as k,E as A,G as j,J as M,K as N,L as ee,M as P,N as F,O as I,P as te,R as ne,S as re,T as L,_ as ie,a as ae,b as oe,c as se,d as ce,f as le,g as ue,h as de,i as fe,j as pe,k as me,l as he,m as ge,n as _e,o as ve,p as ye,r as be,s as xe,t as Se,u as Ce,v as we,w as Te,x as Ee,y as De,z as Oe}from"./index-DPfzOfKU.js";import{A as ke,C as Ae,D as je,E as R,F as Me,I as Ne,L as z,M as Pe,N as Fe,O as Ie,P as Le,S as Re,T as ze,_ as Be,a as Ve,b as He,c as Ue,d as We,f as Ge,g as Ke,h as qe,i as Je,j as Ye,k as Xe,l as Ze,m as Qe,n as $e,o as et,p as tt,r as B,s as nt,t as rt,u as it,v as at,w as ot,y as st}from"./AppearanceControls-Bc1ibrT3.js";import{a as ct,c as V,i as lt,l as ut,n as dt,o as H,r as ft,s as pt,t as mt}from"./format-D4uyBiG8.js";import{a as ht,i as gt,n as _t,r as vt,t as yt}from"./useWorkbenchTheme-BqK4B8rm.js";var U=t(y(),1),bt=`local_request_id`,xt=e=>Array.isArray(e)&&e.length>0;function St(e,t,n,r,i=Date.now(),a=!0,o){let s=e.findIndex(e=>e.type===`ui.argus`&&Number(e[bt])===n);if(s<0)return!r.length&&!a?e:[...e,{type:`ui.argus`,agent_layer:`manager`,text:``,ts:i/1e3,event_id:`local-${t}-${n}-argus`,message_id:`local-${n}-argus`,fragment_mode:`snapshot`,steps:r,live:a,...o?{status:o}:{},[bt]:n}];let c=[...e];return c[s]={...c[s],...r.length?{steps:r}:{},live:a,...o?{status:o}:{}},c}function Ct(e,t,n=Date.now(),r=`stopped`){return e.map(e=>{if(e.type!==`ui.argus`||Number(e[bt])!==t||e.live!==!0)return e;let i=Array.isArray(e.steps)?e.steps.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return t.ended_ts||t.status!==`running`?e:{...t,ended_ts:n/1e3,status:r}}):e.steps;return{...e,live:!1,status:r,...i===void 0?{}:{steps:i}}})}function wt(e,t,n,r=Date.now()){return{type:`ui.operator`,agent_layer:`operator`,text:n,ts:r/1e3,event_id:`local-${e}-${t}-operator`,message_id:`local-${t}-operator`,[bt]:t}}function Tt(e,t,n,r,i,a=Date.now(),o=`auto`){let s=r.trim();if(!s)return e;let c=e.findIndex(e=>e.type===`ui.argus`&&Number(e[bt])===n),l=i.endsWith(`-argus`)?`${i.slice(0,-6)}-operator`:``,u=l?e.map(e=>e.type===`ui.operator`&&Number(e[bt])===n?{...e,message_id:l}:e):e,d=u.find(e=>e.type===`ui.operator`&&Number(e[bt])===n),f=d?Math.max(0,a-Number(d.ts??a/1e3)*1e3):0;if(c<0)return[...u,{type:`ui.argus`,agent_layer:`manager`,text:s,ts:a/1e3,event_id:`local-${t}-${n}-argus`,message_id:i||`local-${n}-argus`,fragment_mode:o,response_latency_ms:f,[bt]:n}];let p=u[c],m=[...u];return m[c]={...p,text:O(String(p.text??``),s,o),message_id:i||p.message_id,fragment_mode:o},m}function Et(e,t,n){let r=e.filter(e=>e.type!==`engineer.progress`||e.turn_step!==!0),i=new Map,a=[...r];r.forEach((e,t)=>{let n=String(e.type??``);if(n!==`ui.operator`&&n!==`ui.argus`)return;let r=`${n}\u0000${String(e.text??``)}`;i.set(r,[t,...i.get(r)??[]])});let o=t.map(e=>({type:e.role===`operator`?`ui.operator`:`ui.argus`,agent_layer:e.role===`operator`?`operator`:`manager`,text:e.text,ts:e.ts,message_id:e.message_id||`transcript-${e.ts}-${e.role}`,...e.mission_result===!0?{mission_result:!0}:{},...typeof e.item_id==`string`?{item_id:e.item_id}:{},...typeof e.success==`boolean`?{success:e.success}:{},...typeof e.summary==`string`?{summary:e.summary}:{},...typeof e.delivery_id==`string`?{delivery_id:e.delivery_id}:{},...e.delivery&&typeof e.delivery==`object`?{delivery:e.delivery}:{},...xt(e.steps)?{steps:e.steps}:{}})),s=Array(o.length).fill(!0);for(let e=o.length-1;e>=0;--e){let n=o[e],r=`${String(n.type)}\u0000${String(n.text??``)}`,c=i.get(r)??[],l=t[e].message_id,u=e=>{let t=a[e];return n.item_id&&t.item_id&&n.item_id!==t.item_id?!1:n.mission_result!==!0&&t.mission_result!==!0||!!(l&&t.message_id===l)||!!(!l&&n.delivery_id&&n.delivery_id===t.delivery_id)},d=c.findIndex(e=>u(e)&&!!(l&&a[e].message_id===l));if(d<0&&(d=c.findIndex(u)),d>=0){s[e]=!1;let[t]=c.splice(d,1),r=a[t];if(l&&r.message_id===l){let e={};for(let t of[`mission_result`,`item_id`,`success`])(r[t]==null||r[t]===``)&&n[t]!=null&&(e[t]=n[t]);a[t]={...r,...e}}}}let c=[...o.filter((e,t)=>s[t]),...a],l=Array(c.length).fill(!0),u=new Set,d=n.map(e=>{let t=String(e.message_id??``),n=t?c.findIndex((e,n)=>!u.has(n)&&String(e.message_id??``)===t):-1,r=Number(e.ts??0);if(n<0&&(n=c.findIndex((t,n)=>{if(u.has(n)||t.type!==e.type||t.text!==e.text)return!1;let i=Number(t.ts??0);return Math.abs(i-r)<=5})),n>=0){u.add(n),l[n]=!1;let t=c[n];return{...e,...t.mission_result===!0?{mission_result:!0}:{},...typeof t.item_id==`string`?{item_id:t.item_id}:{},...typeof t.success==`boolean`?{success:t.success}:{},...typeof t.summary==`string`?{summary:t.summary}:{},...typeof t.delivery_id==`string`?{delivery_id:t.delivery_id}:{},...t.delivery&&typeof t.delivery==`object`?{delivery:t.delivery}:{},...xt(t.steps)?{steps:t.steps,live:!1}:{}}}return e});return[...c.filter((e,t)=>l[t]),...d].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0))}function Dt(e,t,n,r,i){let a=ue(e,t,120);return{query:a,events:(0,U.useMemo)(()=>e?Et(n,a.data??[],i===e?r:[]):[],[e,n,a.data,r,i]),status:a.isError?`error`:a.isPending?`loading`:`ready`}}var Ot=z(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),kt=z(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),At=z(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),jt=z(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Mt=z(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Nt=z(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Pt=z(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ft=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),It=z(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Lt=z(`Diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Rt=z(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),zt=z(`FilePenLine`,[[`path`,{d:`m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2`,key:`142zxg`}],[`path`,{d:`M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`2t3380`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),Bt=z(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Vt=z(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ht=z(`Layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),W=z(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),G=z(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Ut=z(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),Wt=z(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Gt=z(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),Kt=z(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),qt=z(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Jt=z(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),Yt=z(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Xt=z(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),Zt=z(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),Qt=z(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),$t=z(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),en={"global/agent-team-lead.md":{title:`多智能体团队协作`,summary:`判断何时值得并行工作,按文件与职责拆分协作,并独立审查汇总结果;不替代原有角色与授权。`,originalName:`Agent Team Lead`,source:`argus/builtin_skills/agent-team-lead.md`,sourceSha256:`b490cc96572941fa4a2fe4937bd3e86c9802c132439ae779fcf8e88241ba9521`},"global/curator/argus-curator-role.md":{title:`团队成果整理`,summary:`维护团队候选成果池和比较记录,归纳后续策略;整理者不代替执行者完成工程任务。`,originalName:`Team Curator`,source:`argus/builtin_skills/curator/argus-curator-role.md`,sourceSha256:`3dfd743254a91f88feef76e85683225dc5b510b7f417f6430ef7b975b8eb0f5b`},"global/engineer/minimal-coding-agent.md":{title:`最小且严谨的软件修改`,summary:`用足够小的改动实现、修复或重构软件与界面,保留既有行为,避免无依据的抽象和新增依赖。`,originalName:`极简而严谨的 Coding Agent`,source:`argus/builtin_skills/engineer/minimal-coding-agent.md`,sourceSha256:`aa47c79252eb5086451530ae25aac77ce87bd4315eda1e9defae2af719295cab`},"global/engineer/pdf-chat.md":{title:`分段阅读 PDF`,summary:`按页或章节阅读并核对版本、页码;图片和版式需查看实际页面,回答只依据相关证据。`,originalName:`Progressive PDF Reading`,source:`argus/builtin_skills/engineer/pdf-chat.md`,sourceSha256:`141bd41eb888191aedc391f0df2ba100ab5aee3e7970f9afc21a6f50f4deca5f`},"global/engineer/presentation-master.md":{title:`可编辑演示文稿`,summary:`使用已有 PPT Master 工具制作或修改可编辑演示文稿和原生 PPT 图,经指定解释器运行并核对导出效果;科研绘图路线由科研垂域决定。`,originalName:`Editable Presentations with PPT Master`,source:`argus/builtin_skills/engineer/presentation-master.md`,sourceSha256:`b9f5ed3935b538a18280ac79a504a3b28b432b66efb884e3e06284b4f1729ff3`},"global/engineer/skill-authoring-guide.md":{title:`编写与审阅技能和 Wiki 页面`,summary:`只在证据表明有可复用做法时写技能;先学操作者材料再忠实编辑;Wiki 更新来自一手来源;审阅者按证据真实、无冗余、不倒退、层级正确来判断一次修改。`,originalName:`Writing and Reviewing Skills and Wiki Pages`,source:`argus/builtin_skills/engineer/skill-authoring-guide.md`,sourceSha256:`cf4073da950ef34a359fa3f4b9c77c9d00ebd56bcb79a678efc3e04197ec7e79`},"global/engineer/web-primary-source-evidence.md":{title:`查证一手网络来源`,summary:`为软件、产品、接口和基准等现实信息寻找并保留一手来源,让重要结论能够追溯。`,originalName:`Web Primary-Source Evidence`,source:`argus/builtin_skills/engineer/web-primary-source-evidence.md`,sourceSha256:`632930eb13afc66ebf4742ab6c87fa586edee916c3eeacef25f50215e78f776f`},"global/manager/evidence-based-stage-decision.md":{title:`经理的职责与阶段决定`,summary:`经理是唯一改变阶段的角色;结合规划和评审证据决定继续、推进、返回或结束,部署始终需要操作者批准。`,originalName:`The Manager's role and stage decisions`,source:`argus/builtin_skills/manager/evidence-based-stage-decision.md`,sourceSha256:`d664fa7b6e92045335da59739575326b89e70d38662c1ffdc79774c599e36817`},"global/performance-profile-ground-truth.md":{title:`真实工作负载性能分析`,summary:`用指定环境和代表性输入定位瓶颈,对照未开启剖析的实测结果;不顺带执行未要求的优化。`,originalName:`Performance Profile Ground Truth`,source:`argus/builtin_skills/performance-profile-ground-truth.md`,sourceSha256:`42430420ce8bd31047780e9b08ac5eab366f849eb222805ca05492779095f4d0`},"global/planner/dependency-aware-task-decomposition.md":{title:`规划者的职责与按依赖拆解任务`,summary:`规划者只读只派、不执行,阶段只由经理改变;把目标与已有证据整理成最小、可执行、有真实依赖且能明确验收的任务集合。`,originalName:`The Planner's role and dependency-aware task decomposition`,source:`argus/builtin_skills/planner/dependency-aware-task-decomposition.md`,sourceSha256:`06d5295c6777a64c90a28a5603884e557a72ad5961b19a3f411dc1e83e331886`},"global/project-venv-package-management.md":{title:`项目环境、依赖与运行前核查`,summary:`使用项目自身的环境与锁文件,只安装任务需要的依赖,在承载论断的运行前只核查它真正用到的资源;不修改 Argus 框架自己的运行环境。`,originalName:`Project Environment and Dependencies`,source:`argus/builtin_skills/project-venv-package-management.md`,sourceSha256:`ab8728ad9fff58e8bc4672e5bc2446135f376b55b52392a6104b2eb52e9ed327`},"global/reviewer/argus-reviewer-role.md":{title:`评审者的职责与给执行者的下一步`,summary:`独立判断执行结果是否成立、需要补充或转向,把检查结果提炼成执行者需要的那一个下一步;评审有争议时以带标签的证据而非角色权威定论,不替执行者作完成声明。`,originalName:`The Reviewer's role`,source:`argus/builtin_skills/reviewer/argus-reviewer-role.md`,sourceSha256:`8457a177a4376eab0e4bef7a652e3276ce3b6f9a0ab421fd15bd96eb057cf852`},"global/reviewer/engineer-process-audit.md":{title:`核对执行过程与证据`,summary:`当成果或验证声明存在争议时检查任务相关回执和日志,区分缺少记录与确实未执行。`,originalName:`Engineer Process Audit`,source:`argus/builtin_skills/reviewer/engineer-process-audit.md`,sourceSha256:`b109fb737e747b863244c9b03e1b23ff82acf724ef420bc547ad457c1cf65ac5`},"global/reviewer/web-source-evidence-audit.md":{title:`审查网络证据是否支撑结论`,summary:`核对实际取得的来源与重要现实信息声明是否一致,不把有链接等同于已经证实。`,originalName:`Web Source-Evidence Audit`,source:`argus/builtin_skills/reviewer/web-source-evidence-audit.md`,sourceSha256:`35dbb6288199c52d4ecfd4e241a54346f5ef8af985f50bf24121e687ea9dc22e`},"global/stale-blocker-verification-probe.md":{title:`核实旧阻塞与易变的外部事实`,summary:`用最小且已授权的探针判断记录中的阻塞是否仍然存在;只在决策依赖时核实外部事实,把身份、许可与执行当作三个不同的问题。`,originalName:`Verify a Recorded Blocker or a Changing External Fact`,source:`argus/builtin_skills/stale-blocker-verification-probe.md`,sourceSha256:`3eb5f473bbf1cf482a840e7af3c84bc939a6710b60f84415ad94e6932a9122b3`},"vertical/argus_maintenance/engineer/argus-maintenance-execution.md":{title:`Argus 小范围维护`,summary:`按核心与领域职责检查和简化框架,用小而可复用的修改解决明确问题。`,originalName:`Argus Maintenance`,source:`argus/verticals/argus_maintenance/skills/engineer/argus-maintenance-execution.md`,sourceSha256:`138f9b7e2503c5ce0307e575fa0555a62e1820c559e105d60cc6e31ab9991c0f`},"vertical/argus_maintenance/reviewer/argus-maintenance-review.md":{title:`Argus 维护变更评审`,summary:`核对补丁是否真正简化、复用和解耦,并用验证结果证明行为,而不是只看代码缩短。`,originalName:`Argus Maintenance Review`,source:`argus/verticals/argus_maintenance/skills/reviewer/argus-maintenance-review.md`,sourceSha256:`d6ad0f8eb29d5ca3d5a66fbc7df34de86e42229f15e8e2e22ce601a8ae08c4f8`},"vertical/chemistry/engineer/batteries/battery-identity-and-data-normalization.md":{title:`电池对象与测试数据对齐`,summary:`在循环分析前统一电芯、电极、电解液、测试协议和时间序列身份;不用于分子计算或一般光谱分析。`,originalName:`Battery Cell Identity and Electrochemical Data Normalization`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-identity-and-data-normalization.md`,sourceSha256:`d1cfc1cb94cf4e4828fcd2b75fb0f1dc57181208f2fad1f19c343a9d169462e6`},"vertical/chemistry/engineer/batteries/battery-model-validation.md":{title:`电池模型与退化解释验证`,summary:`用防止数据泄漏的实测电芯数据验证预测和退化解释,明确模型边界;不把预测当作实测。`,originalName:`Battery Model Boundary and Degradation Validation`,source:`argus/domains/chemistry/skills/engineer/batteries/battery-model-validation.md`,sourceSha256:`fe4ec1ec78ec21dd0d568b71276c2f85e13b6216d5a7770f5f75d09baabc6d27`},"vertical/chemistry/engineer/batteries/cycling-and-degradation-analysis.md":{title:`电池循环与退化分析`,summary:`分析循环、倍率、阻抗和退化轨迹,保留电芯与协议对照,并避免评估数据泄漏。`,originalName:`Battery Cycling and Degradation Analysis Workflow`,source:`argus/domains/chemistry/skills/engineer/batteries/cycling-and-degradation-analysis.md`,sourceSha256:`3e0870b82fbc40463f81ca8eb1e84576c9fe1ae5fe501da6d2b274535fd16d2e`},"vertical/chemistry/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md":{title:`生化结合与功能实验分析`,summary:`分析亲和力、动力学、抑制和功能证据,核对构建体、辅因子、状态与实验对照;对接结果不能单独证明活性。`,originalName:`Biochemical Binding, Kinetics, and Functional Assay Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemical-assay-and-mechanism-workflow.md`,sourceSha256:`12d235a655a1b6b6022a84a5c36e3c291df6227cb40bd2dc78f19012deff62e5`},"vertical/chemistry/engineer/biochemistry/biochemistry-structural-computational-evidence.md":{title:`生化结构与模拟的证据边界`,summary:`把结构、分子对接、动力学和突变结果作为待验证假设,结合真实实验边界解释,不直接宣称亲和力成立。`,originalName:`Biochemistry Structural, Docking, and MD Evidence Boundary Workflow`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-structural-computational-evidence.md`,sourceSha256:`47283774a89fa87050fd35df791c961dce37588ec9c92c9d4e357d59a9f14d6c`},"vertical/chemistry/engineer/biochemistry/biochemistry-system-and-assay-normalization.md":{title:`生化体系与实验对象对齐`,summary:`统一序列、构建体、分子状态、配体、辅因子、突变、结构和实验身份,再开展比较。`,originalName:`Biochemistry and Chemical Biology System Identity Normalization`,source:`argus/domains/chemistry/skills/engineer/biochemistry/biochemistry-system-and-assay-normalization.md`,sourceSha256:`9b7d80ae04064e9a1b5465dc1fee60f5511491694aaa20e423ae92779ad12ee5`},"vertical/chemistry/engineer/characterization/characterization-data-and-sample-normalization.md":{title:`表征样品与原始数据对齐`,summary:`保留衍射、光谱、质谱、核磁和显微原始数据及仪器信息;不把不同测试方式统一成简单拟峰。`,originalName:`Characterization Sample, Instrument Data, and Metadata Normalization`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-data-and-sample-normalization.md`,sourceSha256:`dad27a33c24c37fdc17a7f7386478246e7847edde9cac4cc2939590ab3e07b9c`},"vertical/chemistry/engineer/characterization/characterization-validation-and-integration.md":{title:`多种表征证据交叉验证`,summary:`综合不同仪器证据时保留各自适用范围和限制,避免跨测试方式作过强推断。`,originalName:`Characterization Validation and Multimodal Evidence Integration`,source:`argus/domains/chemistry/skills/engineer/characterization/characterization-validation-and-integration.md`,sourceSha256:`9671988085d6a0127a4739300c9c851e904016f8f17c31fafb676303b7d736c1`},"vertical/chemistry/engineer/characterization/modality-specific-interpretation-workflow.md":{title:`按测试方式解释表征结果`,summary:`依据衍射、光谱、质谱、核磁或显微的具体机制选择对照和模型,不使用一套解释套用全部数据。`,originalName:`Modality-Specific Chemical Characterization Interpretation Workflow`,source:`argus/domains/chemistry/skills/engineer/characterization/modality-specific-interpretation-workflow.md`,sourceSha256:`c09d9f9710e8ee7a72ff7cfd0f04ec741ea792a61a8b8abf56c038c26b126e46`},"vertical/chemistry/engineer/chemistry-execution.md":{title:`化学研究执行指南`,summary:`按任务选择领域流程,核实实际工具能力,保留一手证据并验证科学结论;实体实验仍需明确授权。`,originalName:`Chemistry Research Execution`,source:`argus/domains/chemistry/skills/engineer/chemistry-execution.md`,sourceSha256:`d6ad8b3ae0254319e31de1ca91a7c75fd06c70795d3948b38b8d35b895e69d59`},"vertical/chemistry/engineer/chemistry-toolkit.md":{title:`化学方法与工具导航`,summary:`先选择科学问题对应的方法,再查看具体工具说明;这是导航目录,不是自动安装或执行脚本。`,originalName:`Chemistry Skill and Capability Router`,source:`argus/domains/chemistry/skills/engineer/chemistry-toolkit.md`,sourceSha256:`14840bc5603ce237373ab4832f7bf747c24e6d4ef524eb2ccd112a8bb9eaea70`},"vertical/chemistry/engineer/computational_chemistry/computational-identity-normalization.md":{title:`计算化学对象与输入对齐`,summary:`在量子化学、力场、分子动力学或自由能计算前,统一分子或周期体系的输入与状态。`,originalName:`Computational Chemistry Identity and Input Normalization`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-identity-normalization.md`,sourceSha256:`fd9bebbdc28731a9eeab536279466e3b97c289a49db515f509c713f4b3f0df7b`},"vertical/chemistry/engineer/computational_chemistry/computational-validation-and-interpretation.md":{title:`计算收敛性与结论边界`,summary:`验证数值收敛、模型敏感性和适用范围,区分计算预测与实验测量,不外推为生物活性证明。`,originalName:`Computational Chemistry Convergence and Interpretation Validation`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/computational-validation-and-interpretation.md`,sourceSha256:`ed1bffff26a5cb22ff61c60dcbf3464cbcff0f15200b9d604436bcd6243ab3f7`},"vertical/chemistry/engineer/computational_chemistry/electronic-structure-simulation-workflow.md":{title:`可复现电子结构与分子模拟`,summary:`组织分子或周期体系计算,分别检查方法选择和数值收敛,保留可复现的输入与输出。`,originalName:`Reproducible Electronic-Structure and Molecular Simulation Workflow`,source:`argus/domains/chemistry/skills/engineer/computational_chemistry/electronic-structure-simulation-workflow.md`,sourceSha256:`13c5d42ae2f417c7f16665e33f3660fad9f76163be2a08401edd57662ab6f22c`},"vertical/chemistry/engineer/crystallography/cif-and-structure-validation.md":{title:`CIF 与晶体结构检查`,summary:`核对格式、对称性、组成、几何、占位、位移参数和精修证据;不代替从头解结构。`,originalName:`CIF and Crystal Structure Validation`,source:`argus/domains/chemistry/skills/engineer/crystallography/cif-and-structure-validation.md`,sourceSha256:`b49527c827b69b5a37543059faf997fa8d0c9c3f60ed2c0a0e6807ddf5b0e802`},"vertical/chemistry/engineer/crystallography/diffraction-and-crystal-identity.md":{title:`衍射数据与晶体对象对齐`,summary:`核对单晶或粉末衍射的波长、几何、晶胞、对称性、物相及 CIF 来源。`,originalName:`Diffraction and Crystal Structure Identity`,source:`argus/domains/chemistry/skills/engineer/crystallography/diffraction-and-crystal-identity.md`,sourceSha256:`97367c0fad622c1d2ae19868b12a8de571bbc99c282c8b5eec4c4b97ed3615ed`},"vertical/chemistry/engineer/crystallography/structure-solution-and-refinement.md":{title:`晶体结构求解与精修`,summary:`结合数据处理、对称性检验、化学约束、残差和替代解释完成结构求解及精修。`,originalName:`Crystal Structure Solution and Refinement Workflow`,source:`argus/domains/chemistry/skills/engineer/crystallography/structure-solution-and-refinement.md`,sourceSha256:`8f5d913cf3bfc6c421f2d137ece735eba96e3b6840da63d6c4d40c22bc518e08`},"vertical/chemistry/engineer/foundations/chemical-identity-and-representation.md":{title:`化学对象与表达方式核实`,summary:`先核对分子、反应、材料、晶体、样品、序列或配方身份;这是跨领域基础,不替代专门流程。`,originalName:`Chemical Identity and Representation`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-identity-and-representation.md`,sourceSha256:`b1b0f0148ae94a1ad6ad60b6383cc8f6b1596b387d885ca896148486004ac392`},"vertical/chemistry/engineer/foundations/chemical-risk-and-authorization.md":{title:`化学风险与授权边界`,summary:`识别化学、生物、热、电、压力、辐射和仪器风险;文档建议不等于允许开展实体操作。`,originalName:`Chemical Risk and Authorization Boundary`,source:`argus/domains/chemistry/skills/engineer/foundations/chemical-risk-and-authorization.md`,sourceSha256:`2d6cb4a8421bb62bbde199f7aa131f5f678019ffbeed231f0676e9095f176b5e`},"vertical/chemistry/engineer/foundations/chemistry-workflow-output-contract.md":{title:`化学任务输入与交付约定`,summary:`明确输入、决策、能力核实、证据、验证方式、输出与停止条件,用于缺少更具体流程的任务。`,originalName:`Chemistry Workflow and Output Contract`,source:`argus/domains/chemistry/skills/engineer/foundations/chemistry-workflow-output-contract.md`,sourceSha256:`1b52c242611bb39cbbe929dc2bee8072e501ab56b23907df50a51c5c0b4f15fd`},"vertical/chemistry/engineer/foundations/computational-reproducibility.md":{title:`化学计算与分析的可复现性`,summary:`保留计算、模拟、数据处理和模型训练的输入、环境、数值设置、诊断与主要输出。`,originalName:`Chemistry Computational Reproducibility`,source:`argus/domains/chemistry/skills/engineer/foundations/computational-reproducibility.md`,sourceSha256:`d92b4a7b6e65c92138ef785a04a47f1fae6ab4ef2e6c4af111264cdc081a0bd8`},"vertical/chemistry/engineer/foundations/dataset-curation-and-leakage.md":{title:`化学数据整理与泄漏控制`,summary:`核对数据来源、去重、分组、标签和划分方式,避免分子、反应或样品间的信息泄漏。`,originalName:`Chemistry Dataset Curation and Leakage Control`,source:`argus/domains/chemistry/skills/engineer/foundations/dataset-curation-and-leakage.md`,sourceSha256:`ceeaf0a929c67df26cc91651721d943749c7e2c3bad6c7978cb78fa085bf948b`},"vertical/chemistry/engineer/foundations/evidence-provenance-and-claim-levels.md":{title:`化学证据来源与结论强度`,summary:`区分检索、整理、预测、计算、模拟、测量与推断,让结论不超出证据能支持的程度。`,originalName:`Chemistry Evidence Provenance and Claim Levels`,source:`argus/domains/chemistry/skills/engineer/foundations/evidence-provenance-and-claim-levels.md`,sourceSha256:`c8b6454e673aae3298d4089c1603b9edfe63c4be7f5f3ad8fd6f24ef2b2910f5`},"vertical/chemistry/engineer/foundations/failure-diagnosis-and-negative-results.md":{title:`化学任务失败与负结果分析`,summary:`保留失败证据,区分实现缺陷、资源问题和科学假设被否定,不把负结果隐去。`,originalName:`Chemistry Failure Diagnosis and Negative Results`,source:`argus/domains/chemistry/skills/engineer/foundations/failure-diagnosis-and-negative-results.md`,sourceSha256:`068cf8400d770fb6c97edbd26d6788adb1acc0e7d6ea00e3b14949c7a9a64a40`},"vertical/chemistry/engineer/foundations/uncertainty-and-applicability-domain.md":{title:`化学结果的不确定性与适用范围`,summary:`判断模型、计算、测量或文献结论能否用于当前实际体系,并量化或说明不确定性。`,originalName:`Chemistry Uncertainty and Applicability Domain`,source:`argus/domains/chemistry/skills/engineer/foundations/uncertainty-and-applicability-domain.md`,sourceSha256:`d552b6cad9e2a942e44a1a4c98647236488186458d3f2cd4bdd395a34c23d8ae`},"vertical/chemistry/engineer/foundations/units-conditions-and-normalization.md":{title:`化学单位与条件规范化`,summary:`比较不同来源前明确单位、计量基础、环境条件、样品归一方式和报告约定。`,originalName:`Chemical Units Conditions and Normalization`,source:`argus/domains/chemistry/skills/engineer/foundations/units-conditions-and-normalization.md`,sourceSha256:`540d6c4a3389900be51e3e9a7bdcf7f16169bb72246d53cbb1fbac247b527cde`},"vertical/chemistry/engineer/materials_science/materials-discovery-and-optimization.md":{title:`材料发现与优化研究`,summary:`限定设计空间、性质目标、基线与不确定性,组织可验证的筛选或工艺优化,不替代晶体精修。`,originalName:`Materials Discovery and Optimization Workflow`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-discovery-and-optimization.md`,sourceSha256:`02d2aeacb74302eb2853345772f5096cce5b26db15ab5d229a210ccfabe04cbd`},"vertical/chemistry/engineer/materials_science/materials-identity-processing-and-property-data.md":{title:`材料组成、工艺与性能数据`,summary:`统一组成、物相、工艺历史、样品形态、微结构和测试条件,建立可比的性能记录。`,originalName:`Materials Identity Processing and Property Data`,source:`argus/domains/chemistry/skills/engineer/materials_science/materials-identity-processing-and-property-data.md`,sourceSha256:`ec0ac9c5a4b62eb9d027a97f9c78cc9ed986776e48f9f3bbf94f015a8d689521`},"vertical/chemistry/engineer/materials_science/processing-structure-property-validation.md":{title:`工艺—结构—性能关系验证`,summary:`用可比样品、对照和不确定性检验材料关系声明,保留机理解释的适用边界。`,originalName:`Materials Processing Structure Property Validation`,source:`argus/domains/chemistry/skills/engineer/materials_science/processing-structure-property-validation.md`,sourceSha256:`7c556e48b0b97de122d0f342839c92ece5e33f36c1aa3f7efbcc6fbc319ea06c`},"vertical/chemistry/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md":{title:`MOF 构筑单元与拓扑识别`,summary:`从来源结构核实节点、连接体、连通性、穿插、缺陷、客体和网络拓扑,不以普通 CIF 检查代替。`,originalName:`MOF Framework Identity Node Linker and Topology`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/framework-identity-node-linker-and-topology.md`,sourceSha256:`7a6490bd8dad40deeb548f03541673b91df2bd9bddbe3e9c8cf58d73b3ee31b8`},"vertical/chemistry/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md":{title:`MOF 数据、预测与结构生成`,summary:`组织拓扑相关去重、泄漏控制、性质预测和生成结构的分阶段验证;生成不等于可合成。`,originalName:`MOF Datasets Prediction and Structure Generation`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/mof-datasets-prediction-and-generation.md`,sourceSha256:`8f1d023caf19aeb5801036cc58e2531cd8d39bb398008a4b614c654b3073ab51`},"vertical/chemistry/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md":{title:`MOF 孔隙、吸附与性质分析`,summary:`关联原始等温线、活化和样品状态,检查孔隙、吸附、输运模型及不确定性。`,originalName:`MOF Porosity Adsorption and Structure Property Workflow`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/porosity-adsorption-and-structure-property.md`,sourceSha256:`98088eef9fa108d0f0aa8fab9f746315414cc64edbcfab0d0da8accd4ab83b0b`},"vertical/chemistry/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md":{title:`MOF 合成与后处理证据`,summary:`整理合成、活化、溶剂交换、缺陷调节和后修饰的证据,核对样品关联与表征要求。`,originalName:`MOF Synthesis Activation and Postsynthetic Evidence`,source:`argus/domains/chemistry/skills/engineer/mof_reticular_chemistry/synthesis-activation-and-postsynthetic-evidence.md`,sourceSha256:`b65377f7d995a638f721e8dea34a99807e97c948ec274bbc3f9cc1d35ccf1f5a`},"vertical/chemistry/engineer/organic_synthesis/reaction-identity-and-records.md":{title:`有机反应对象与记录对齐`,summary:`核对反应物、映射、计量、立体化学、条件、后处理和收率,用于路线或数据整理。`,originalName:`Organic Reaction Identity and Records`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/reaction-identity-and-records.md`,sourceSha256:`02221beebf4e39d9bd0e5c4090de61aba6596ceb48fb3a5f29b3e54466999d87`},"vertical/chemistry/engineer/organic_synthesis/retrosynthesis-and-route-design.md":{title:`有机逆合成与路线设计`,summary:`结合目标、断键、已有先例、选择性、供应和安全设计候选路线;候选仍需证据验证。`,originalName:`Organic Retrosynthesis and Route Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/retrosynthesis-and-route-design.md`,sourceSha256:`6ee1e514bf05cc052de12ee39497c783d1dd6ca9549335cbe62e7f2106ec8de4`},"vertical/chemistry/engineer/organic_synthesis/route-validation-and-experiment-design.md":{title:`有机路线验证与实验设计`,summary:`把候选路线转化为有对照、分析读数和停止条件的验证计划;不授权自动开展实体实验。`,originalName:`Organic Route Validation and Experiment Design`,source:`argus/domains/chemistry/skills/engineer/organic_synthesis/route-validation-and-experiment-design.md`,sourceSha256:`9a543fdca5cc4fa3ed0cc9cef2395af55ffaa35758b3c36895a2309d1d09dc80`},"vertical/chemistry/engineer/tools/aizynthfinder.md":{title:`AiZynthFinder 逆合成候选`,summary:`在明确模型、原料库、配置和预算后使用本地搜索生成候选路线;搜索结果不是可行性证明。`,originalName:`AiZynthFinder Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/aizynthfinder.md`,sourceSha256:`fd406198b2a436d954aefb95c1062f945e08cf98806ca7ceaba5d402c006f4dc`},"vertical/chemistry/engineer/tools/askcos.md":{title:`ASKCOS 路线与反应预测`,summary:`仅使用已获授权的部署,记录接口、模型、数据库、预算与结果来源;不假定已有服务权限。`,originalName:`ASKCOS Retrosynthesis`,source:`argus/domains/chemistry/skills/engineer/tools/askcos.md`,sourceSha256:`31689603c8f5b80f2ed94a25ef05148edf311287e64bf336fc98fea5aeeaf486`},"vertical/chemistry/engineer/tools/chembl.md":{title:`ChEMBL 生物活性资料检索`,summary:`检索分子、靶点、实验和活性记录,核对版本、单位及来源;已有记录不证明新体系的活性。`,originalName:`ChEMBL Bioactivity Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/chembl.md`,sourceSha256:`9b33111794504afb064302785f66bd7fcbccac9e855d83df0eb84297f00b4863`},"vertical/chemistry/engineer/tools/chemcrow.md":{title:`ChemCrow 工具集成参考`,summary:`研究公开工具集成方式及其依赖、安全和证据要求;架构借鉴不等于复现论文结果。`,originalName:`ChemCrow Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemcrow.md`,sourceSha256:`877388249df2ed635a78ae2edb68b1d25fa2cd5305eec4e09c289fb0f1bd1ba3`},"vertical/chemistry/engineer/tools/chemos.md":{title:`ChemOS 实验室编排参考`,summary:`仅在设备服务、设施归属、安全联锁、数据约定和恢复机制已具备时评估编排能力。`,originalName:`ChemOS Orchestration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/chemos.md`,sourceSha256:`2dbb97df4b7107f08f00bbdd88fef587eda0b6d3d04e5850b619550e7a9c4cc3`},"vertical/chemistry/engineer/tools/coscientist.md":{title:`Coscientist 系统集成参考`,summary:`依据确切公开实现借鉴组件和架构,保留授权边界;不宣称得到可直接运行的自主实验室。`,originalName:`Coscientist Integration Reference`,source:`argus/domains/chemistry/skills/engineer/tools/coscientist.md`,sourceSha256:`8a47d850deb1d7dfb2ddeecbea4cba38ceecec129a6e2b2d8ad403e9bbff5252`},"vertical/chemistry/engineer/tools/deepchem.md":{title:`DeepChem 分子机器学习`,summary:`先明确目标、对象、分组、泄漏控制、基线和适用范围,再选择数据、特征、模型与评估工具。`,originalName:`DeepChem Molecular Machine Learning`,source:`argus/domains/chemistry/skills/engineer/tools/deepchem.md`,sourceSha256:`27a9bd06792446cfeeafb63db293fcd8305d59ca3da164810e1267c13e6dcdeb`},"vertical/chemistry/engineer/tools/guacamol.md":{title:`GuacaMol 分子设计基准`,summary:`按确定任务、评分、参考数据、预算和有效性检查评估方法;结论仅限对应基准。`,originalName:`GuacaMol Molecular Design Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/guacamol.md`,sourceSha256:`f626a4b92ec2b081620f5da146f6baebe3b5cc44df824e77fc2becd0b3e87e7e`},"vertical/chemistry/engineer/tools/olympus.md":{title:`Olympus 反应优化基准`,summary:`使用规划器和模拟曲面作有对照的优化研究,明确参数空间、噪声和预算;模拟不等于实体实验。`,originalName:`Olympus Reaction Optimization`,source:`argus/domains/chemistry/skills/engineer/tools/olympus.md`,sourceSha256:`160f357db2ec4527b7368d2b41a2ab43d2ab6b76130e8a27b2a035e0531c4be2`},"vertical/chemistry/engineer/tools/openbabel.md":{title:`Open Babel 化学格式转换`,summary:`转换结构格式并核对解析、氢原子、坐标和互操作性,保留原始身份及转换来源。`,originalName:`Open Babel Structure Conversion`,source:`argus/domains/chemistry/skills/engineer/tools/openbabel.md`,sourceSha256:`6eca4f250101ad817f624a76ca6c22193c73fd67a8d13d76a39bcf07d848fd75`},"vertical/chemistry/engineer/tools/orca.md":{title:`ORCA 量子化学计算`,summary:`在用户提供并授权的安装上计算,记录版本、分子状态、方法、基组、数值设置和主要输出。`,originalName:`ORCA Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/orca.md`,sourceSha256:`683637ad2fb781da58295e67229859794085fb01fcaaa43c10e11e13c8a91085`},"vertical/chemistry/engineer/tools/ord.md":{title:`开放反应数据库读写规范`,summary:`按数据库结构验证反应角色、数量、条件、结果与来源;结构有效不等于实验可复现。`,originalName:`Open Reaction Database I/O`,source:`argus/domains/chemistry/skills/engineer/tools/ord.md`,sourceSha256:`eb81cbde5711e04c578cc89a5b233a3de109c5b68b7322adeefd0996df21b8da`},"vertical/chemistry/engineer/tools/psi4.md":{title:`Psi4 量子化学计算`,summary:`明确分子状态、方法、基组、选项、收敛和单位,保留计算输出来源。`,originalName:`Psi4 Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/psi4.md`,sourceSha256:`2d8bf9817a90f90fe2407d8e4d71e6ffbf431f64207f61b8c2fca8acda199a69`},"vertical/chemistry/engineer/tools/pubchem.md":{title:`PubChem 公共资料检索`,summary:`通过核实的标识和带日期的查询取得公共化合物、性质及安全记录,保留原始响应与来源边界。`,originalName:`PubChem PUG REST Retrieval`,source:`argus/domains/chemistry/skills/engineer/tools/pubchem.md`,sourceSha256:`9aa66ea316f8180a29884f78b1ae927adf55f727476fa0529c01e7300161c89e`},"vertical/chemistry/engineer/tools/pyscf.md":{title:`PySCF 电子结构计算`,summary:`先确定电荷、自旋、几何、方法、基组、边界和收敛要求,再组织分子或周期体系计算。`,originalName:`PySCF Quantum Chemistry`,source:`argus/domains/chemistry/skills/engineer/tools/pyscf.md`,sourceSha256:`9ccb368195807ed7390cf2397506d004f849ccd1c0e1d51532b31e42e579dbc2`},"vertical/chemistry/engineer/tools/rdkit.md":{title:`RDKit 分子数据处理`,summary:`用于解析、规范化、立体化学、子结构、描述符、指纹与构象等处理;不直接证明化学身份或可行性。`,originalName:`RDKit Molecular Integrity`,source:`argus/domains/chemistry/skills/engineer/tools/rdkit.md`,sourceSha256:`b9330a5a8c90fb31bf3b551555d4f439cca90f9ecd45506734ce5051628ee074`},"vertical/chemistry/engineer/tools/tdc.md":{title:`TDC 药物研究数据基准`,summary:`使用明确任务、版本、许可、划分和评估器开展比较,核对污染与证据边界。`,originalName:`Therapeutics Data Commons Benchmarking`,source:`argus/domains/chemistry/skills/engineer/tools/tdc.md`,sourceSha256:`a1aaed9bff60b1df25ccc8a9846ebcd30784c1f814cb20633e8a5ef57e11decb`},"vertical/chemistry/engineer/workflows/chemistry-playground.md":{title:`受限化学假设试探`,summary:`仅对明确提出的候选问题开展有边界的计算优先试探,保留问题、结果和负证据,并经过评审。`,originalName:`Chemistry Playground Bounded Hypothesis Probe`,source:`argus/domains/chemistry/skills/engineer/workflows/chemistry-playground.md`,sourceSha256:`72326a42543600e3fffedf0562c171466cc25b433cb8c05913e9fcfac3eb2d12`},"vertical/chemistry/manager/chemistry-manager.md":{title:`化学任务协调与分流`,summary:`为科学问题选择专门技能组合,保留原研究阶段、证据强度与授权边界。`,originalName:`Chemistry Manager Context`,source:`argus/domains/chemistry/skills/manager/chemistry-manager.md`,sourceSha256:`ecc7e16be351188d3c6ae75aa0e55c4b3978f1916e67c45754766cb63085f336`},"vertical/chemistry/planner/chemistry-planning.md":{title:`化学研究规划`,summary:`选择最贴合任务的流程,保持证据和安全要求;未完成时才安排具有科学判别力的后续工作。`,originalName:`Chemistry Research Planning`,source:`argus/domains/chemistry/skills/planner/chemistry-planning.md`,sourceSha256:`c9258fa062f3853d7a04950d0e0045b10be65c41c11248d6fe5c981e0ed02e02`},"vertical/chemistry/reviewer/battery-review.md":{title:`电池与电化学证据评审`,summary:`独立核对电芯身份、协议可比性、单位、循环退化证据和防泄漏模型评估。`,originalName:`Battery and Electrochemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/battery-review.md`,sourceSha256:`e0aa8763587e38281b5c2c5b6f7c92b3e07264b1cee076539751de8971d87725`},"vertical/chemistry/reviewer/biochemistry-review.md":{title:`生化与化学生物学评审`,summary:`检查构建体、结构、实验、动力学、模拟和功能声明,保留各自对照与结论边界。`,originalName:`Biochemistry and Chemical Biology Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/biochemistry-review.md`,sourceSha256:`68f2cc57f10d6c9bf30c41c249ebe7fc192b8ac4b763cb6ff40d9a41377135d0`},"vertical/chemistry/reviewer/characterization-review.md":{title:`化学表征证据评审`,summary:`独立核对原始仪器数据、校准、对照、归属和多模态证据,避免用通用解释越过测试边界。`,originalName:`Chemical Characterization Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/characterization-review.md`,sourceSha256:`3ba8858ac408729e78fa27a9338cd6eb435bd64d38da803d837aaec111ef8d67`},"vertical/chemistry/reviewer/chemistry-playground-review.md":{title:`化学试探结果评审`,summary:`检查受限问题与结果、证据和状态历史,防止未经确认的探索被当作正式科学结论。`,originalName:`Chemistry Playground Promotion Gate`,source:`argus/domains/chemistry/skills/reviewer/chemistry-playground-review.md`,sourceSha256:`309f1ff685c93c46c47239d9db1a3b85c41c6c384e986532e774ed3795e8d3c0`},"vertical/chemistry/reviewer/chemistry-review.md":{title:`化学研究综合评审`,summary:`按问题转交专门评审方法,核对对象、原始证据、对照、可复现性、不确定性和安全要求。`,originalName:`Chemistry Research Review`,source:`argus/domains/chemistry/skills/reviewer/chemistry-review.md`,sourceSha256:`bc2587f915788c94f8de55a0f2947a18e7bd368cccf1b400d1479e1681c64cf7`},"vertical/chemistry/reviewer/computational-review.md":{title:`计算化学证据评审`,summary:`审查输入身份、数值收敛、方法有效性,以及计算结果和测量结果之间的界线。`,originalName:`Computational Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/computational-review.md`,sourceSha256:`cab134d61ce5d45bf0240d2219eca03002e7b6315c4abf3738c2740229353e68`},"vertical/chemistry/reviewer/crystallography-review.md":{title:`晶体学证据评审`,summary:`独立检查衍射、对称性、精修、CIF、物相声明和结构不确定性,不替代其他领域评审。`,originalName:`Crystallography Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/crystallography-review.md`,sourceSha256:`034223d76528f09aede5febdb7fff1c848819f82564a8be7acf23ebc1a25d369`},"vertical/chemistry/reviewer/materials-science-review.md":{title:`材料科学证据评审`,summary:`核对非 MOF 材料的身份、工艺、性质和发现声明,不把结论跨用到晶体精修或电池循环。`,originalName:`Materials Science Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/materials-science-review.md`,sourceSha256:`ac639340d34bc5dae734e9f9841e91762cb31ec42c73c5a108dc69b25c2b76ba`},"vertical/chemistry/reviewer/mof-reticular-chemistry-review.md":{title:`MOF 与网状化学证据评审`,summary:`核对构筑单元、拓扑、合成活化、孔隙吸附、后修饰、数据与生成结构的证据。`,originalName:`MOF and Reticular Chemistry Evidence Review`,source:`argus/domains/chemistry/skills/reviewer/mof-reticular-chemistry-review.md`,sourceSha256:`d095ca81ab168c658696b20de0e149647cdbfcffe545cff73e3ed9ccaeb37dcf`},"vertical/chemistry/reviewer/organic-synthesis-review.md":{title:`有机合成与逆合成评审`,summary:`独立核对反应记录、路线先例、选择性、分析证据、安全和实际可行性声明。`,originalName:`Organic Synthesis and Retrosynthesis Review`,source:`argus/domains/chemistry/skills/reviewer/organic-synthesis-review.md`,sourceSha256:`0ce7fdeee239a78b9d74f7e64dbd55b38d99b9e88bf141399ec999d30f519ad0`},"vertical/chemistry/scientist/chemistry-adaptation.md":{title:`根据证据改进化学方法`,summary:`只有证据显示现有方法在对象、能力、验证或安全等机制层面存在缺口时,才调整可复用流程。`,originalName:`Chemistry Skill Adaptation`,source:`argus/domains/chemistry/skills/scientist/chemistry-adaptation.md`,sourceSha256:`d231961e4c85bee737df313c376e046dba50ed5a375460a924176db507f8ee9a`},"vertical/chemistry/scientist/chemistry-distillation.md":{title:`沉淀可复用化学流程`,summary:`在技能匹配缺失后归纳带范围、证据、验证和停止条件的方法,而不是保存目标答案或工具教程。`,originalName:`Chemistry Skill Distillation`,source:`argus/domains/chemistry/skills/scientist/chemistry-distillation.md`,sourceSha256:`1f7c9b2cddae0e19332d6e38edbac2671026d04e5ca0f3203f3d777e5e51d010`},"vertical/kernel_engineering/engineer/kernel-benchmark-measurement-integrity.md":{title:`GPU 算子工程:先算屋顶线,隔离测量`,summary:`先用屋顶线定瓶颈再改机制而非参数;一次干净的隔离运行足以筛选想法,要主张或保留的提升必须在官方条件下测量;审阅只看正确性与基准证据。`,originalName:`Kernel Engineering: Roofline First, Measure in Isolation`,source:`argus/verticals/kernel_engineering/skills/engineer/kernel-benchmark-measurement-integrity.md`,sourceSha256:`b6bbe44b147dfea2dd68810db53571a9fae5db238c2bcde24d51c79756bf1785`},"vertical/learning/learning-curation.md":{title:`学习任务的整理与审阅`,summary:`把操作者材料变成有证据锚点的项目 Skill/Wiki 修改或诚实的空操作,说明 CHANGE_PLAN.json 的约定以及审阅者如何判断修改是否忠实、无冗余、不倒退、层级正确。`,originalName:`Learning Curation`,source:`argus/verticals/learning/skills/learning-curation.md`,sourceSha256:`71490b8d95eecb97a88a18e8bc4dd0a1aa163d7c0f82a02114440aae1f5f6999`},"vertical/math/engineer/math-research-execution.md":{title:`数学研究执行`,summary:`忠实保留命题与范围,诚实区分结果类别;需要 Lean 证据时实际编译,不虚构证明。`,originalName:`Math Research Execution`,source:`argus/verticals/math/skills/engineer/math-research-execution.md`,sourceSha256:`ddcf8321ce873130c1de3e71b78d816115182813e8a6dfdd4bc89d0fe9629736`},"vertical/math/manager/math-research-manager.md":{title:`数学研究任务协调`,summary:`在通用协调流程中保持研究目标、范围、求解和评审职责,不另造一套权限体系。`,originalName:`Math Research Manager Context`,source:`argus/verticals/math/skills/manager/math-research-manager.md`,sourceSha256:`e228b24cd82e6dee678458b5e32c4e1fc6092151b06c7eee198b158bdd1a1b95`},"vertical/math/planner/math-research-planning.md":{title:`数学研究规划`,summary:`围绕范围界定、求解和评审安排动态任务,保持原有角色与生命周期规则。`,originalName:`Math Research Planning`,source:`argus/verticals/math/skills/planner/math-research-planning.md`,sourceSha256:`e3320bf8a0b986eae0251ce1004962659ab2a9505a2cc73da63c33b94d2799f4`},"vertical/math/reviewer/math-research-review.md":{title:`数学研究独立评审`,summary:`检查正确性、新意、意义、命题忠实性和真实形式化证据,不以叙述代替证明。`,originalName:`Math Research Review`,source:`argus/verticals/math/skills/reviewer/math-research-review.md`,sourceSha256:`21b7e0f172bbb695ae9950c0e9dd1cdac60ae6aa21df0962a88a1b06ba505251`},"vertical/math/scientist/math-research-adaptation.md":{title:`改进数学研究方法`,summary:`在评审确认方法失败或技能缺口后,按已有适应阶段调整可复用方法。`,originalName:`Math Research Scientist Adaptation`,source:`argus/verticals/math/skills/scientist/math-research-adaptation.md`,sourceSha256:`fd8961cb0155e3fc05428cf0b5dbd6be86ed048636dc657b3b23abbee6495933`},"vertical/math/scientist/math-research-distillation.md":{title:`沉淀数学研究方法`,summary:`在首次匹配缺失后整理可复用研究方法,不假定已经失败,也不代替当前任务的执行。`,originalName:`Math Research Skill Distillation`,source:`argus/verticals/math/skills/scientist/math-research-distillation.md`,sourceSha256:`83a7367798b1ac327861deaa94accf1d77da0e140ebc8da8137442a30a83b09a`},"vertical/research/engineer/ablation-planner.md":{title:`选择有判别力的消融实验`,summary:`只选择能区分结果解释、说明所选方法作用的必要消融,而不是机械穷举组合。`,originalName:`Choosing ablations that distinguish explanations`,source:`argus/verticals/research/skills/engineer/ablation-planner.md`,sourceSha256:`f5c9bff3d6b5bc9dc4b50316e172856fcc01d708685c08a1ff29650871369858`},"vertical/research/engineer/method-card.md":{title:`方法卡、可执行规范与审阅锚点`,summary:`在 METHOD.md 中写清方法、组件、协议和证伪条件;以钉版参考实现为底把方法写成 diff;先写 tests/spec 再跑承载论断的实验;用代码锚点让不在场的审阅者找到机制;规划者据此写实现简报。`,originalName:`Method card (METHOD.md), executable spec and review anchors`,source:`argus/verticals/research/skills/engineer/method-card.md`,sourceSha256:`2e756a2fd09bca2abe4175fea4042af6905a6166b629c940909b10090cfe6855`},"vertical/research/engineer/novelty-check.md":{title:`检验研究想法的新意`,summary:`通过当前来源对照最接近的已有工作,判断一条候选想法的差异,而非先宣称创新。`,originalName:`Testing the idea's novelty`,source:`argus/verticals/research/skills/engineer/novelty-check.md`,sourceSha256:`e20a0f4290c72b07c9b09fa77633ecc915f0f7a8b90d8efd4c627fb9d12f8c16`},"vertical/research/engineer/paper-chart-styling.md":{title:`论文数据图样式`,summary:`统一数据图的配色、尺寸、标记和字体嵌入,遵守所选期刊会议版式;不改变数据本身。`,originalName:`Styling data figures for publication`,source:`argus/verticals/research/skills/engineer/paper-chart-styling.md`,sourceSha256:`c40b9f431de9cd01f16e245d819563566fc5db02c2217505599921adcca65b75`},"vertical/research/engineer/paper-framework-figure-studio.md":{title:`论文图的路线选择与概念图编排`,summary:`按表达内容选渲染路线:数据图走 SciencePlots/Matplotlib,概念与框架图默认以图像蓝图重建为可编辑 PPT,无图像接口时直接原生绘制;生成图像只用于不承载论断的部分。`,originalName:`Composing a conceptual paper figure`,source:`argus/verticals/research/skills/engineer/paper-framework-figure-studio.md`,sourceSha256:`e01ffd101b8fcd701b86918d93994079dfc87d9df79dbcd348bdfe3508cfcd9b`},"vertical/research/engineer/references/ideation/ideation-patterns/overview.md":{title:`研究构思模式总览`,summary:`汇总各研究构思模式的定义、操作特征与适用时机,帮助为路线挑选机制视角;模式在语料中常见不代表适合当前问题,也不替代创新性与正确性验证。`,originalName:`engineer/references/ideation/ideation-patterns/overview`,source:`argus/verticals/research/skills/engineer/references/ideation/ideation-patterns/overview.md`,sourceSha256:`8b2b43b5ce63c70a1b54c0ff5fb3f1954bc8ef6c05bda95a71a011d2f5f4eb34`},"vertical/research/engineer/references/paper-writing-craft.md":{title:`论文写作方法参考`,summary:`提供论文论证和表达的写作参考,需结合真实证据与所选期刊会议要求使用。`,originalName:`engineer/references/paper-writing-craft`,source:`argus/verticals/research/skills/engineer/references/paper-writing-craft.md`,sourceSha256:`bd645d2f2f48987c988c54b6b22843b22ee3b5a9dc0ce950bff4acdc0fcf3eeb`},"vertical/research/engineer/research-grind.md":{title:`沿诊断阶梯打磨研究结果`,summary:`把首次实现当作草稿,在固定声明下沿诊断阶梯逐级排查;结果异常先怀疑设置;从原始逐种子行算数;依据证据而非尝试次数判断何时足够。`,originalName:`Working a research result into shape`,source:`argus/verticals/research/skills/engineer/research-grind.md`,sourceSha256:`e955fe1ac7aa975a9172394bdca4e8b2ed6a504355ab00573a26badf442f038a`},"vertical/research/engineer/rl-training-collapse-diagnosis.md":{title:`强化学习训练健康诊断`,summary:`检查奖励、优势、梯度、KL、截断和吞吐异常,先诊断配置与过程,再归因方法;不同训练目标不能混用规则。`,originalName:`RL Training Health Diagnosis`,source:`argus/verticals/research/skills/engineer/rl-training-collapse-diagnosis.md`,sourceSha256:`d48fd69adaac73ad45c41cd9565798a94a476de52c9354097abe2d8604db8782`},"vertical/research/engineer/sources-and-citations.md":{title:`对照来源核对论断与引用`,summary:`把稿件中的论断对回支撑它的证据,把引用对回被引的原文,并用 Semantic Scholar 核对版本;补充全局的一手来源技能,不另起一轮整篇审阅。`,originalName:`Checking claims and citations against their sources`,source:`argus/verticals/research/skills/engineer/sources-and-citations.md`,sourceSha256:`450410c4b428e31104819c07a98e19b615ced499e0d2d4df473305ca789d55ed`},"vertical/research/engineer/training-infrastructure.md":{title:`训练基础设施的选择、搭建与调参`,summary:`训练或大规模推理需要框架时,用实时来源调查候选、在隔离环境中试装并剖析一步真实更新、以官方配方为锚每次只改一个因素,并把结论写成带日期的项目决策记录;不按记忆推荐技术栈。`,originalName:`Training infrastructure: choosing, standing up and tuning it`,source:`argus/verticals/research/skills/engineer/training-infrastructure.md`,sourceSha256:`4c495369ffba7ff2b9954a2fafd72b874e63abc6065a5afab7c61ce10afb9087`},"vertical/research/engineer/venue-format-preflight.md":{title:`投稿前的编译与泄露检查`,summary:`用目标会场的官方作者模板编译完整稿件并核对结构,同时检查稿件没有泄露内部路径、角色名与运行时用语。`,originalName:`Preparing the draft for the venue`,source:`argus/verticals/research/skills/engineer/venue-format-preflight.md`,sourceSha256:`e146afba818a8436d0807aff610084d6a321277778e7ce299bd96f9f57795eb0`},"vertical/research/engineer/venue-format-research.md":{title:`选择投稿目标并核对要求`,summary:`根据研究内容选择合适期刊会议,获取当前官方作者要求,而非沿用过时模板。`,originalName:`Choosing a venue and reading its requirements`,source:`argus/verticals/research/skills/engineer/venue-format-research.md`,sourceSha256:`aad2d0ec25649231ec233f4abb5b216af313a7a1dfa699cc6f0c8b23be7cbcf2`},"vertical/research/engineer/venue-paper-drafting.md":{title:`面向投稿目标撰写论文`,summary:`先定论证形状,按所选作者模板和确认的证据写完整论文,读一次强范文校准视觉与结构标准;不把未验证探索写成既定结论。`,originalName:`Writing for the selected venue`,source:`argus/verticals/research/skills/engineer/venue-paper-drafting.md`,sourceSha256:`d7bb7d7e59f5ce6e20433fa843e3d7002575b1892b131c0d0f7f247e986281f1`},"vertical/research/research-experiment-playbook.md":{title:`通过实验发展研究想法`,summary:`忠实实现已选想法,通过适应性实验形成足以支撑论文的证据,而不是只完成首次运行。`,originalName:`Developing an idea through experiments`,source:`argus/verticals/research/skills/research-experiment-playbook.md`,sourceSha256:`df8f6a724b93f063a6e0dd2e36af1838fca72eea689f062b096d3ad0c4ad2c85`},"vertical/research/research-idea-playbook.md":{title:`寻找并选择研究想法`,summary:`从来源中发现候选可能性,经独立审查后作最终选择,不把构思直接当作实验结果。`,originalName:`Finding a research idea`,source:`argus/verticals/research/skills/research-idea-playbook.md`,sourceSha256:`91104461d9115ee280db1f5e89d3c35bc8301422bfd7d9a70c66fa559c09eed6`},"vertical/research/research-paper-playbook.md":{title:`撰写完整研究论文`,summary:`从已确认的正向证据组织论文、编译并准备投稿材料,保持证据与论述一致。`,originalName:`Writing the research paper`,source:`argus/verticals/research/skills/research-paper-playbook.md`,sourceSha256:`2efcabc2904fe55831b0f5d9c61846c544aab2a211687f0fbf51ad417e66afec`},"vertical/research/research-review-playbook.md":{title:`对论文形成独立判断`,summary:`综合科学性、图示、语言和整体论证,判断工作是否成立并提出建设性意见。`,originalName:`Reaching a judgment on the paper`,source:`argus/verticals/research/skills/research-review-playbook.md`,sourceSha256:`368d0bc3b8dba80c1e8d84257a10f95bbe2124a35d03a30e553e1d6b56ae829a`},"vertical/research/reviewer/academic-paper-peer-review-benchmark.md":{title:`按目标期刊会议评审论文`,summary:`以独立评审视角判断当前稿件,提供科学指导并更新评审记录。`,originalName:`Reading the paper as a venue reviewer`,source:`argus/verticals/research/skills/reviewer/academic-paper-peer-review-benchmark.md`,sourceSha256:`6446f17af2a751bd9570b4351e4b28d84d09cc06ed2c59174111f17f39e0cbc9`},"vertical/research/reviewer/claim-to-code-trace.md":{title:`追溯声明到实际代码`,summary:`沿配置和执行路径核对公式、比较条件与观测,判断研究声明是否对应实际产生证据的代码。`,originalName:`Claim-to-Code Trace`,source:`argus/verticals/research/skills/reviewer/claim-to-code-trace.md`,sourceSha256:`fef3ef16ce27a9c1e9ec5f095c73bb734da06aedba74fa994122e28d32c293ee`},"vertical/research/reviewer/experiment-results-review.md":{title:`判断实验真正说明了什么`,summary:`亲自读代码、配置、评测器和原始行,判断证据对固定声明的支持与缺口;低于基线的结果在阶梯未走完前是修复请求;训练类实验另核对基础设施决策记录。`,originalName:`What the experiments establish`,source:`argus/verticals/research/skills/reviewer/experiment-results-review.md`,sourceSha256:`bc158d8b51107b697d290eb6ed461f2a596aa601bc78cce7e88089743411533e`},"vertical/research/reviewer/strongest-argument-against.md":{title:`寻找最有力的科学反对意见`,summary:`在最终评审中识别论文最关键的科学弱点,不通过直接改稿掩盖它。`,originalName:`The strongest argument against the paper`,source:`argus/verticals/research/skills/reviewer/strongest-argument-against.md`,sourceSha256:`6cc3e7990dacb420a04ff945cb1f221852bd249b981a60def70dfcace2ac3418`},"vertical/research/reviewer/venue-academic-language-review.md":{title:`审查论文论证与学术表达`,summary:`对照目标期刊会议的当前惯例阅读论证与语言,指出问题,不擅自编辑论文。`,originalName:`Reading the paper's argument and language`,source:`argus/verticals/research/skills/reviewer/venue-academic-language-review.md`,sourceSha256:`a2fe9faf57ff0a09181f42de2ac2b5080158e08c430078fb48722fd6b9893f66`},"vertical/software/engineer/software-change-implementation.md":{title:`有边界的软件实现与拆解`,summary:`结合仓库结构选择合适工具,以与任务规模相称的检查完成软件修改;分阶段工作按架构边界拆解,每个任务写明兼容性风险与独立预言机。`,originalName:`Software Change Implementation`,source:`argus/verticals/software/skills/engineer/software-change-implementation.md`,sourceSha256:`34dad5e10c880fb48964573768b72d8377829ca8163ddd21987c2c05538d70a9`},"vertical/software/reviewer/software-change-review.md":{title:`软件修改独立评审`,summary:`检查真实调用路径、兼容性与验证证据,不依赖参考答案或仅凭完成声明判断。`,originalName:`Software Change Review`,source:`argus/verticals/software/skills/reviewer/software-change-review.md`,sourceSha256:`5d1a66ff65accae04ec02005724735c9767308ac63c005b8be6e269eb9acb25f`}};function tn(e){if(!e.is_default||![`bundled`,`shared`].includes(e.source)||!(e.scope===`global`?[`global:${e.source}`]:e.scope===`vertical`?[`vertical:${e.vertical}:${e.source}`,...e.source===`bundled`?[`domain:${e.vertical}:bundled`]:[]]:[]).includes(e.library))return null;let t=e.scope===`global`?`global/${e.path}`:`vertical/${e.vertical}/${e.path}`,n=Object.hasOwn(en,t)?en[t]:null;return n?.originalName===e.name?n:null}function nn(e,t){let n=t===`zh-CN`?tn(e):null;return{title:n?.title??e.name,summary:n?.summary??e.description,guide:n}}function rn(e,t){let n=nn(e,t);return`${e.name} ${e.description} ${e.path} ${e.vertical} ${n.title} ${n.summary}`.toLocaleLowerCase()}var an={research:`科研`,software:`软件开发`,math:`数学研究`,chemistry:`化学`,kernel_engineering:`GPU 算子工程`,argus_maintenance:`Argus 维护`,learning:`资料学习`};function on(e,t){return t===`zh-CN`&&Object.hasOwn(an,e)?an[e]:e}var sn={fact:[`记录可核对的环境、对象或事实,供后续工作查证;记录本身不保证事实仍然有效。`,`Records checkable facts for later verification; a saved record is not a guarantee that it is still current.`],lesson:[`保留工作中得到的经验和问题,帮助类似任务少走弯路;不能代替当前证据或评审。`,`Keeps lessons from work to inform similar tasks; it does not replace current evidence or review.`],survey:[`整理问答或调研材料与来源,为后续查阅提供线索;结论仍需结合原文核对。`,`Organizes answers or research and their sources for later reference; check conclusions against the original evidence.`],principles:[`归纳可反复参考的建议,帮助选择方法;应检查所引用的经验与适用条件。`,`Distills recurring guidance for choosing methods; check the cited lessons and applicability.`],note:[`保存关于你的背景、偏好或计划,帮助后续任务理解上下文;不是工具使用授权。`,`Keeps personal context, preferences or plans for later work; it is not authorization to use tools.`],profile:[`汇总 Argus 对你的背景与偏好的了解,方便核对是否准确;不代表公开资料或任务完成情况。`,`Summarizes personal context and preferences for inspection; it is neither a public record nor a task-completion report.`],page:[`一般参考资料。具体用途取决于原文和来源,不能仅凭“已保存”判断内容可靠或适用。`,`General reference material. Its use depends on the original content and sources, not merely on being saved.`]};function cn(e,t){return(Object.hasOwn(sn,e)?sn[e]:sn.page)[t===`zh-CN`?0:1]}var ln={private:[`你的个人背景资料,与共享知识分开保存。这里不改变既有读取权限或模型的数据处理方式。`,`Personal context is stored separately from shared knowledge. This view does not change existing access or model data handling.`],global:[`跨项目参考的通用资料;不要把个人信息当作公共知识放在这里。`,`General reference across projects; personal information does not belong in shared knowledge.`],vertical:[`同一领域可复用的专门资料,使用前仍要核对当前任务的条件。`,`Domain-specific reference; verify that it applies to the current task.`],project:[`围绕当前项目保存的资料与背景;分类不是操作系统沙箱或文件权限边界。`,`Material associated with this project; the category is not an OS sandbox or file-permission boundary.`]};function un(e,t){return Object.hasOwn(ln,e)?ln[e][t===`zh-CN`?0:1]:t===`zh-CN`?`范围尚未确认,请以来源说明为准。`:`Scope not confirmed; consult the source.`}var dn={active:`label.status.inProgress`,claimed:`label.status.inProgress`,in_progress:`label.status.inProgress`,running:`label.status.inProgress`,working:`label.status.inProgress`,pending:`label.status.waiting`,queued:`label.status.waiting`,waiting:`label.status.waiting`,idle:`label.status.waiting`,accepted:`label.status.completed`,complete:`label.status.completed`,completed:`label.status.completed`,done:`label.status.completed`,success:`label.status.completed`,blocked:`label.status.blocked`,failed:`label.status.failed`,error:`label.status.failed`,rejected:`label.status.needsChanges`,continue:`label.status.needsChanges`,skipped:`label.status.skipped`,paused:`label.status.paused`,paused_cost:`label.outcome.costUnreconciled`,stopped:`label.status.paused`,cancelled:`label.status.cancelled`,aborted:`label.status.cancelled`,not_started:`label.status.waiting`,available:`label.status.available`,absent:`label.status.unavailable`,inaccessible:`label.status.inaccessible`,degraded:`label.status.limited`,healthy:`label.status.healthy`},fn={system:`label.role.argus`,operator:`label.role.you`},pn={completed:`label.outcome.workCompleted`,done:`label.outcome.workCompleted`,success:`label.outcome.workCompleted`,paused:`label.outcome.workPaused`,blocked:`label.outcome.workBlocked`,failed:`label.outcome.workFailed`,error:`label.outcome.workFailed`,aborted:`label.outcome.workEnded`,ended:`label.outcome.workEnded`,incomplete:`label.outcome.workIncomplete`,research_incomplete:`label.outcome.workIncomplete`,paused_no_breakthrough:`label.outcome.workIncomplete`,exhausted_current_methods:`label.outcome.workIncomplete`,stalled:`label.outcome.workStalled`,no_progress:`label.outcome.workStalled`,max_rounds:`label.outcome.workStalled`,infra_blocked:`label.outcome.workBlocked`,supervisor_error:`label.outcome.workFailed`},mn={accepted:`label.outcome.reviewPassed`,done:`label.outcome.reviewPassed`,passed:`label.outcome.reviewPassed`,continue:`label.outcome.reviewNeedsChanges`,rejected:`label.outcome.reviewNeedsChanges`,blocked:`label.outcome.reviewBlocked`,stale:`label.outcome.reviewOutdated`,pending:`label.outcome.reviewPending`,pending_review:`label.outcome.reviewPending`},hn={certified:`label.outcome.stageApproved`,not_certified:`label.outcome.stageNotApproved`,revoked:`label.outcome.stageRevoked`,intentionally_skipped:`label.outcome.stageNotNeeded`,deferred:`label.outcome.stagePending`},gn={budget_exhausted:`label.outcome.budgetPaused`,budget_pause:`label.outcome.budgetPaused`,cost_unreconciled:`label.outcome.costUnreconciled`,operator_input_required:`label.outcome.waitingForYou`,operator_abort:`label.outcome.stoppedByYou`,operator_pause:`label.outcome.pausedByYou`,daemon_shutdown:`label.outcome.sessionPaused`,backend_unavailable:`label.outcome.serviceUnavailable`,provider_cooldown:`label.outcome.serviceCoolingDown`,provider_fence:`label.outcome.serviceUnavailable`,transient_error:`label.outcome.temporaryIssue`,permanent_error:`label.outcome.serviceError`,planner_empty_plan:`label.outcome.needsPlan`},_n={cuda:`label.resource.nvidiaGpu`,rocm:`label.resource.amdGpu`,mps:`label.resource.appleGpu`,cpu:`label.resource.cpu`};function vn(e,t){return t(dn[String(e??``).toLowerCase()]??`label.status.updated`)}function yn(e,t){let n=String(e??``).toLowerCase();return ot(n)?Ae(n,t):t(fn[n]??`label.role.argus`)}function bn(e,t){return t(`label.priority`,{priority:e})}function xn(e,t){if(!e?.execution_status)return[];let n=[t(pn[e.execution_status.toLowerCase()]??`label.outcome.workUpdated`)],r=mn[String(e.review_status??``).toLowerCase()],i=hn[String(e.stage_certification??``).toLowerCase()],a=gn[String(e.interruption_kind??``).toLowerCase()];return r&&n.push(t(r)),i&&n.push(t(i)),a&&n.push(t(a)),e.resumable&&n.push(t(`label.outcome.canResume`)),n}function Sn(e,t){return t(_n[e.toLowerCase()]??`label.resource.accelerator`)}function Cn(e,t){return t(e===`strict`?`label.resource.enforced`:`label.resource.advisory`)}function wn(e,t){return t(e===`yield`?`label.resource.released`:`label.resource.kept`)}var K=n(),Tn=e=>[`knowledge-feed`,e];function En(e=!0,t=50){return x({queryKey:Tn(t),queryFn:({signal:e})=>F.knowledgeFeed(t,e),enabled:e,staleTime:5e3,refetchInterval:1e4})}var Dn={en:{learned:`Learned`,recalled:`Recalled`,promoted:`Promoted`,corrected:`Corrected`},zh:{learned:`学到了`,recalled:`读取了`,promoted:`提升了`,corrected:`纠正了`}},On={en:{private:`About you`,global:`Global`,vertical:`Vertical`,project:`Project`},zh:{private:`关于你`,global:`全局`,vertical:`垂直领域`,project:`项目`}};function kn(e,t=60){let n=[...e].sort((e,t)=>t.ts-e.ts),r=[];for(let e of n){let n=r[r.length-1];if(e.kind===`recalled`&&n?.kind===`recalls`&&n.role===e.role&&n.ts-e.ts<=t){n.events.push(e);continue}r.push(e.kind===`recalled`?{kind:`recalls`,ts:e.ts,role:e.role,events:[e]}:{kind:`single`,event:e})}return r}function An(e,t,n=null){return e.path?e.scope===`project`?n&&e.source_project&&e.source_project!==n?null:t.find(t=>t.scope===`project`&&t.path===e.path)??null:t.find(t=>t.scope===e.scope&&t.vertical===e.vertical&&t.path===e.path)??null:null}var jn={learned:`bg-blue/10 text-blue`,recalled:`bg-line/60 text-ink-dim`,promoted:`bg-ok/10 text-ok`,corrected:`bg-warn/10 text-warn`};function Mn({events:e,items:t,sid:n,projectNames:r={},query:i=``,onSelect:a,selected:o}){let{locale:s,t:c}=I(),l=s===`zh-CN`,u=Dn[l?`zh`:`en`],d=On[l?`zh`:`en`],f=e=>H(e,l?`zh-CN`:`en`),p=i.trim().toLocaleLowerCase(),m=kn(p?e.filter(e=>`${e.title} ${e.path} ${e.vertical} ${e.source_project} ${e.role} ${e.note}`.toLocaleLowerCase().includes(p)):e),h=e=>[d[e.scope]??e.scope,on(e.vertical,s),e.source_project?`${l?`来自 `:`from `}${r[e.source_project]||e.source_project}`:``,l&&e.role?yn(e.role,c):e.role].filter(Boolean).join(` · `),g=e=>!!(e&&o&&e.scope===o.scope&&e.vertical===o.vertical&&e.path===o.path),_=(e,r)=>{let i=An(e,t,n),o=e.title||e.path;return i?(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(i),"aria-pressed":g(i),"data-feed-title":!0,className:`${r} text-left hover:text-blue ${g(i)?`text-blue`:`text-ink`}`,children:o}):(0,K.jsx)(`span`,{"data-feed-title":!0,className:`${r} text-ink`,title:e.path,children:o})};return m.length===0?(0,K.jsx)(`p`,{className:`p-3 text-sm leading-relaxed text-ink-faint`,children:p?l?`没有匹配的学习动态。`:`No feed lines match the search.`:l?`还没有学习动态。Argus 在任务后反思写下教训、把已有知识读进提示、或把评审通过的页面提升到共享层时,都会在这里留下一行。`:`Nothing learned yet. A line appears here whenever Argus writes a lesson after a mission, reads existing knowledge into a prompt, or promotes a reviewed page to a shared level.`}):(0,K.jsx)(`ol`,{className:`space-y-1`,"aria-label":l?`学习动态`:`Learning feed`,children:m.map(e=>e.kind===`single`?(0,K.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":e.event.kind,children:[(0,K.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,K.jsx)(`time`,{dateTime:new Date(e.event.ts*1e3).toISOString(),children:f(e.event.ts)}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${jn[e.event.kind]??jn.learned}`,children:u[e.event.kind]??e.event.kind})]}),_(e.event,`mt-1 block w-full break-words text-sm font-medium`),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.event)}),e.event.note&&(0,K.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-ink-dim`,children:e.event.note})]},`${e.event.ts}/${e.event.kind}/${e.event.path}`):(0,K.jsxs)(`li`,{className:`rounded-md px-3 py-2.5`,"data-feed-row":`recalls`,children:[(0,K.jsxs)(`span`,{className:`flex items-baseline gap-2 text-[11px] text-ink-faint`,children:[(0,K.jsx)(`time`,{dateTime:new Date(e.ts*1e3).toISOString(),children:f(e.ts)}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${jn.recalled}`,children:u.recalled})]}),(0,K.jsx)(`span`,{className:`mt-1 block text-sm font-medium text-ink`,"data-feed-title":!0,children:e.events.length===1?e.events[0].title||e.events[0].path:l?`读取了 ${e.events.length} 条已有知识`:`Recalled ${e.events.length} existing pages`}),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:h(e.events[0])}),e.events.length>1&&(0,K.jsx)(`span`,{className:`mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-xs`,children:e.events.map(e=>(0,K.jsx)(`span`,{children:_(e,`inline text-xs text-ink-dim`)},`${e.ts}/${e.scope}/${e.vertical}/${e.path}`))})]},`${e.ts}/recalls/${e.role}`))})}function Nn({guide:e,item:t}){let{t:n}=I();return(0,K.jsxs)(`section`,{"data-skill-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-4 text-sm leading-relaxed text-ink`,children:[(0,K.jsx)(`h4`,{className:`font-semibold`,children:`这项方法有什么用`}),(0,K.jsx)(`p`,{className:`mt-2`,children:e.summary}),(0,K.jsxs)(`dl`,{className:`mt-3 space-y-2 text-xs text-ink-dim`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`font-medium`,children:`什么时候参考`}),(0,K.jsx)(`dd`,{children:`当前任务与上面的用途相符时,由既有任务与技能选择流程按需读取;浏览本页不会运行工具或发起模型任务。`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`font-medium`,children:`目录标注的角色`}),(0,K.jsxs)(`dd`,{children:[yn(t.role,n),`;这只是说明,不调整角色职责或权限。`]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`font-medium`,children:`需要注意`}),(0,K.jsx)(`dd`,{children:`这是随包版本的中文导读,不是完整执行指令,也不是已经完成或验证的证据。具体步骤、前置条件、软件许可和授权限制请对照原文。`})]})]})]})}function Pn({item:e}){let{locale:t}=I(),n=t===`zh-CN`;return(0,K.jsxs)(`section`,{"data-knowledge-reading-guide":!0,className:`mt-4 rounded-lg border border-line/60 bg-bg/60 p-3 text-xs leading-relaxed text-ink-dim`,children:[(0,K.jsx)(`h4`,{className:`font-semibold text-ink`,children:n?`这类知识怎样帮助工作`:`How this kind of knowledge helps`}),(0,K.jsx)(`p`,{className:`mt-2`,children:cn(e.kind,t)}),(0,K.jsx)(`p`,{className:`mt-2`,children:un(e.scope,t)}),(0,K.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n?`以上解释条目类型与范围,不是这篇正文的翻译或真实性证明。具体内容、来源和适用条件仍以原文为准。`:`This explains the kind and scope, not the page itself or its validity. Consult the original content, sources and conditions.`})]})}function Fn({sid:e,channel:t,onOpenKnowledge:n,onOpenSkills:r}){let{locale:i}=I(),a=i===`zh-CN`,o=S(),s=x({queryKey:[`learning-status`,e],queryFn:({signal:t})=>F.learningStatus(e,t),enabled:!!e,refetchInterval:2e3,staleTime:1e3}),c=(0,U.useRef)(``);(0,U.useEffect)(()=>{let t=`${e}:${s.data?.revision??0}`;if(!(!s.data?.revision||t===c.current)){c.current=t;for(let e of[`skill-library`,`wiki-library`,`knowledge-feed`])o.invalidateQueries({queryKey:[e]})}},[e,s.data?.revision,o]);let l=C({mutationFn:e=>F.retryLearning(e.sid,e.id),onSuccess:(e,t)=>o.setQueryData([`learning-status`,t.sid],e)});if(!e||!s.data?.jobs.length)return null;let u=s.data.jobs,d=u.find(e=>e.status===`running`)??u.find(e=>e.status===`queued`),f=d??u[0],p=!!d||s.data.pending>0,m=!p&&f.status===`skipped`&&f.outcome.reason===`paused`;if(!p&&f.status===`skipped`&&(!m||!t))return null;let h={cost_unreconciled:[`上一次模型调用的费用尚未结算,结算前暂停新的模型调用`,`model calls are paused until an earlier call's cost is settled`],budget_exhausted:[`今日模型预算已用完`,`today's model budget is used up`],provider_cooldown:[`模型服务暂时限流`,`the model provider is briefly rate-limited`],operator_pause:[`模型调用已暂停`,`model calls are paused`]},g=h[f.outcome.detail??``]??h.operator_pause,_=m||!p&&f.status===`failed`,v=a?{knowledge:`知识库`,skills:`技能库`,preferences:`用户偏好`}:{knowledge:`Knowledge base`,skills:`Skill library`,preferences:`Preferences`},y=t?[t]:[`knowledge`,`skills`,`preferences`],b=p?y:y.filter(e=>(f.outcome.counts?.[e]??0)>0);if(!p&&!_&&!b.length)return null;let w=e=>{let t=f.outcome.counts?.[e]??0;return p?f.status===`running`?a?`${v[e]}正在更新`:`Updating ${v[e].toLowerCase()}`:a?`${v[e]}等待更新`:`${v[e]} update queued`:a?`${v[e]}已更新 · ${t} 条`:`${v[e]} updated · ${t}`},T=(f.outcome.items??[]).filter(e=>!t||e.channel===t);return(0,K.jsxs)(`div`,{className:`px-2 py-1.5 text-[11px] leading-5 text-ink-dim`,"data-learning-status":f.status,children:[(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:[p?(0,K.jsx)(W,{className:`h-3 w-3 animate-spin text-blue`}):_?(0,K.jsx)(Bt,{className:`h-3 w-3 text-ink-faint`}):(0,K.jsx)(Jt,{className:`h-3 w-3 text-blue`}),m&&(0,K.jsx)(`span`,{children:a?`本轮未学习:${g[0]}。回复不受影响。`:`Learning skipped: ${g[1]}. Your reply is unaffected.`}),!p&&f.status===`failed`&&(0,K.jsx)(`span`,{children:a?`本轮学习未完成,回复不受影响。`:`Learning from this turn did not finish. Your reply is unaffected.`}),!_&&b.map(e=>(0,K.jsx)(`span`,{children:w(e)},e)),s.data.pending>1&&(0,K.jsx)(`span`,{children:a?`还有 ${s.data.pending-1} 轮待学习`:`${s.data.pending-1} more queued`}),_&&f.retryable!==!1&&(0,K.jsx)(`button`,{type:`button`,disabled:l.isPending,className:`text-blue underline`,onClick:()=>l.mutate({sid:e,id:f.id}),children:a?`重试学习`:`Retry learning`})]}),p&&!t&&(0,K.jsx)(`p`,{className:`text-ink-faint`,children:a?`正在整理本轮的知识、方法和偏好,你可以继续工作。`:`Saving useful knowledge, methods and preferences. You can keep working.`}),T.length>0&&!t&&(0,K.jsxs)(`details`,{className:`mt-0.5`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-blue`,children:a?`查看本轮学到了什么`:`What this turn taught Argus`}),(0,K.jsx)(`ul`,{className:`pl-4 list-disc`,children:T.map((e,t)=>(0,K.jsx)(`li`,{children:(e.channel===`skills`?r:n)?(0,K.jsx)(`button`,{type:`button`,className:`text-left underline`,onClick:e.channel===`skills`?r:n,children:e.title}):e.title},t))})]}),(l.isError||s.isError)&&(0,K.jsx)(`p`,{role:`alert`,children:a?`暂时无法同步学习状态,请稍后重试。`:`Learning status could not be refreshed. Please retry.`})]})}var In=e=>`${e.library}/${e.path}`,Ln=e=>e.filter(e=>!e.is_default&&e.updated_at!=null).sort((e,t)=>(t.updated_at??0)-(e.updated_at??0)||In(e).localeCompare(In(t)));function Rn(e,t=!0){return x({queryKey:[`skill-library`,e],queryFn:({signal:t})=>F.skillLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var zn={en:{fact:`Fact`,lesson:`Lesson`,survey:`Survey`,principles:`Principles`,note:`Note`,profile:`Profile`,page:`Page`},zh:{fact:`事实`,lesson:`经验教训`,survey:`调研摘要`,principles:`原则`,note:`个人记录`,profile:`个人概况`,page:`参考页面`}},Bn=e=>e.kind in zn.en?e.kind:`page`,Vn=e=>[`wiki-library`,e];function Hn(e,t=!0){return x({queryKey:Vn(e),queryFn:({signal:t})=>F.wikiLibrary(e,t),enabled:t,staleTime:1e4,refetchInterval:15e3})}var Un=[`feed`,`global`,`vertical`,`project`],Wn={"zh-CN":{feed:`学习动态`,global:`全局项目`,vertical:`垂直领域`,project:`项目`},en:{feed:`Learning feed`,global:`Across projects`,vertical:`Vertical`,project:`Project`}};function Gn(e,t,n,r){let i=r===`zh-CN`,a=e=>n===`feed`||e===n||n===`global`&&e===`private`,o=(e?.items??[]).filter(e=>a(e.scope)).map(e=>({kind:`knowledge`,item:e,id:`knowledge/${e.scope}/${e.vertical}/${e.path}`,title:e.title,description:e.description,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at,search:`${e.title} ${e.description} ${e.path}`})),s=(n===`feed`?Ln(t?.items??[]):t?.items??[]).filter(e=>a(e.scope)).map(e=>{let t=nn(e,r);return{kind:`skill`,item:e,id:`skill/${e.library}/${e.path}`,title:t.title,description:t.summary,path:e.path,scope:e.scope,vertical:e.vertical,updated:e.updated_at??0,search:rn(e,r)}}),c=n===`feed`?[]:(e?.libraries??[]).filter(e=>a(e.scope)).flatMap(e=>[{kind:`index`,content:e.index_markdown,name:`INDEX.md`,title:i?`索引`:`Index`},{kind:`principles`,content:e.principles,name:`principles.md`,title:i?`原则`:`Principles`},{kind:`profile`,content:e.profile,name:`profile.md`,title:i?`个人概况(原私有范围)`:`Personal profile (private scope)`}].flatMap(t=>t.content?.trim()?[{kind:t.kind,content:t.content,id:`${t.kind}/${e.scope}/${e.vertical}/${e.root}`,title:t.title,description:``,path:`${e.root}/${t.name}`,scope:e.scope,vertical:e.vertical,updated:0,search:`${t.title} ${t.name}`}]:[]));return[...o,...s,...c].sort((e,t)=>t.updated-e.updated||e.id.localeCompare(t.id))}function Kn({onOpen:e,compact:t=!1}){let{locale:n}=I(),r=n===`zh-CN`?`技能库`:`Skill library`;return(0,K.jsx)(`section`,{className:`shrink-0 ${t?`py-2`:`mx-2 py-1`}`,"data-learning-navigation":!0,children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>e(`feed`),"aria-label":r,title:r,className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-ink-dim hover:bg-bg hover:text-ink ${t?`justify-center`:``}`,children:[(0,K.jsx)(At,{size:16,"aria-hidden":`true`}),!t&&r]})})}function qn({sid:e,initialScope:t=`feed`,initialSelection:n=null,projectNames:r={}}){let i=(0,U.useRef)(e);return(0,K.jsx)(Jn,{sid:e,initialScope:t,initialSelection:i.current===e?n:null,projectNames:r},e??`no-project`)}function Jn({sid:e,initialScope:t,initialSelection:n,projectNames:r}){let{locale:i}=I(),a=i===`zh-CN`,o=Wn[i],[s,c]=(0,U.useState)(t),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(``),[p,m]=(0,U.useState)(()=>n?n.kind===`skill`?`skill/${n.item.library}/${n.item.path}`:`knowledge/${n.item.scope}/${n.item.vertical}/${n.item.path}`:null),h=Hn(e),g=Rn(e),_=En(s===`feed`),v=Gn(h.data,g.data,s,i),y=v.find(e=>e.id===p),b=y?.kind===`knowledge`?y.item:null,S=y?.kind===`skill`?y.item:null,C=x({queryKey:[`wiki-document`,e,b?.scope,b?.vertical,b?.path,b?.updated_at],queryFn:({signal:t})=>{if(!b)throw Error(`No knowledge document selected`);return F.wikiDocument(e,b.scope,b.vertical,b.path,t)},enabled:!!b}),w=x({queryKey:[`skill-document`,e,S?.library,S?.path,S?.updated_at],queryFn:({signal:t})=>{if(!S)throw Error(`No skill document selected`);return F.skillDocument(e,S.library,S.path,t)},enabled:!!S}),T=l.trim().toLocaleLowerCase(),E=v.filter(e=>(s!==`vertical`||!d||e.vertical===d)&&(!T||`${e.search} ${e.vertical}`.toLocaleLowerCase().includes(T))),D=[...new Set([...h.data?.verticals??[],...g.data?.verticals??[]])].sort(),O=e=>e.scope===`private`?a?`个人记录 · 原私有范围,不共享`:`Personal record · private, not shared`:`${o[e.scope]}${e.vertical?` · ${on(e.vertical,i)}`:``}`,k=e=>e.kind===`skill`?a?`技能`:`Skill`:e.kind===`knowledge`?zn[a?`zh`:`en`][Bn(e.item)]:e.kind===`principles`?a?`原则`:`Principles`:e.kind===`profile`?a?`个人概况`:`Profile`:a?`索引`:`Index`,A=S?w:C,j=S?nn(S,i).guide:null,M=e=>{c(e),m(null),f(``)};return(0,K.jsxs)(`div`,{className:`flex h-[min(780px,84dvh)] min-h-0 flex-col`,"data-learning-library":!0,children:[(0,K.jsx)(Qe,{title:a?`技能库`:`Skill library`,sub:a?`在一起查看学到的知识、可复用的方法和原始资料。`:`Explore learned knowledge, reusable methods and original sources together.`}),(0,K.jsx)(Fn,{sid:e,onOpenKnowledge:()=>M(`feed`),onOpenSkills:()=>M(`feed`)}),(0,K.jsx)(`nav`,{"aria-label":a?`学习资源分类`:`Learning resource categories`,className:`flex shrink-0 overflow-x-auto border-b border-line/60 px-4`,children:Un.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":s===e,onClick:()=>M(e),className:`shrink-0 border-b-2 px-3 py-2.5 text-sm ${s===e?`border-blue text-ink`:`border-transparent text-ink-faint hover:text-ink`}`,children:o[e]},e))}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,K.jsxs)(`aside`,{className:`${y?`hidden md:flex`:`flex`} min-h-0 w-full flex-col md:w-80 md:shrink-0 md:border-r md:border-line/60`,children:[(0,K.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,K.jsx)(`input`,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":a?`搜索知识与技能`:`Search knowledge and skills`,placeholder:a?`搜索知识与技能`:`Search knowledge and skills`,className:`w-full rounded-md border border-line bg-bg px-3 py-2 text-sm text-ink`}),s===`vertical`&&(0,K.jsxs)(`select`,{value:d,onChange:e=>{f(e.target.value),m(null)},"aria-label":a?`垂直领域`:`Vertical`,className:`w-full rounded-md border border-line bg-bg px-2 py-2 text-sm text-ink`,children:[(0,K.jsx)(`option`,{value:``,children:a?`所有领域`:`All verticals`}),D.map(e=>(0,K.jsx)(`option`,{value:e,children:on(e,i)},e))]}),s===`feed`&&(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`学习记录与文件更新分开展示。文件变更不等于知识已验证。`:`Learning records and file updates are separate. An update does not prove knowledge is verified.`}),s===`global`&&(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-faint`,children:a?`跨项目共享的知识和方法;个人记录保留原私有范围,不会被共享。`:`Shared knowledge and methods across projects. Personal records retain their private scope.`})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:[h.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`知识无法加载。`:`Knowledge could not load.`,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void h.refetch(),children:a?`重试`:`Retry`})]}),g.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`技能无法加载。`:`Skills could not load.`,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void g.refetch(),children:a?`重试`:`Retry`})]}),h.data?.errors.length||g.data?.errors.length?(0,K.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-err`,children:a?`部分资料无法读取;已加载的内容仍可查看。`:`Some sources could not be read; loaded material remains available.`}):null,s===`feed`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`学习记录`:`Learning records`}),_.isPending&&(0,K.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载学习记录…`:`Loading learning records…`}),_.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`p-3 text-xs text-err`,children:[a?`学习记录无法加载。`:`Learning records could not load.`,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void _.refetch(),children:a?`重试`:`Retry`})]}),_.data&&(0,K.jsx)(Mn,{events:_.data.events,items:h.data?.items??[],sid:e,projectNames:r,query:l,selected:b,onSelect:e=>{m(`knowledge/${e.scope}/${e.vertical}/${e.path}`)}}),(0,K.jsx)(`h3`,{className:`px-3 py-2 text-xs font-medium text-ink-faint`,children:a?`文件更新`:`File updates`})]}),(h.isPending||g.isPending)&&(0,K.jsx)(`p`,{className:`p-3 text-xs text-ink-faint`,children:a?`正在加载资料…`:`Loading material…`}),!h.isPending&&!g.isPending&&!h.isError&&!g.isError&&!E.length&&(0,K.jsx)(`p`,{className:`p-3 text-sm text-ink-faint`,children:s===`project`&&!e?a?`选择一个项目以查看资料。`:`Select a project to see its material.`:a?`当前分类或筛选条件下没有资料。`:`No material matches this category or filter.`}),E.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>m(e.id),"aria-pressed":y?.id===e.id,className:`block w-full rounded-md px-3 py-3 text-left ${y?.id===e.id?`bg-blue/10`:`hover:bg-bg`}`,children:[(0,K.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-line/60 px-1.5 text-[10px] text-ink-dim`,children:k(e)}),(0,K.jsx)(`span`,{className:`break-words text-sm font-medium text-ink`,children:e.title})]}),e.description&&(0,K.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs text-ink-dim`,children:e.description}),(0,K.jsx)(`span`,{className:`mt-1 block text-[11px] text-ink-faint`,children:O(e)}),e.updated>0&&(0,K.jsx)(`time`,{className:`mt-1 block text-[11px] text-ink-faint`,dateTime:new Date(e.updated*1e3).toISOString(),children:new Date(e.updated*1e3).toLocaleString(i)})]},e.id))]})]}),(0,K.jsx)(`article`,{className:`${y?`block`:`hidden md:block`} min-w-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:y?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`mb-4 text-sm text-blue md:hidden`,onClick:()=>m(null),children:a?`← 返回列表`:`← Back to the list`}),(0,K.jsx)(`h3`,{className:`break-words text-lg font-semibold text-ink`,children:y.title}),(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[k(y),` · `,O(y)]}),(0,K.jsx)(`p`,{className:`mt-1 break-all text-xs text-ink-faint`,children:y.path}),b&&(0,K.jsx)(Pn,{item:b}),S&&j&&(0,K.jsx)(Nn,{item:S,guide:j}),(0,K.jsx)(`div`,{className:`mt-5 border-t border-line/60 pt-5 text-sm text-ink`,children:y.kind===`knowledge`||y.kind===`skill`?(0,K.jsxs)(K.Fragment,{children:[A.isPending&&(0,K.jsx)(`p`,{children:a?`正在加载全文…`:`Loading document…`}),A.isError&&(0,K.jsxs)(`p`,{role:`alert`,className:`text-err`,children:[A.error.message,` `,(0,K.jsx)(`button`,{className:`underline`,onClick:()=>void A.refetch(),children:a?`重试`:`Retry`})]}),b&&C.data?.truncated&&(0,K.jsx)(`p`,{role:`status`,className:`mb-3 text-xs text-ink-faint`,children:a?`页面过长,已截断显示。`:`Page shortened for display.`}),A.data&&(j?(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2 text-blue`,children:a?`查看原始技能文档`:`Read the original skill`}),(0,K.jsx)(Ke,{children:A.data.content})]}):(0,K.jsx)(Ke,{children:A.data.content}))]}):(0,K.jsx)(Ke,{children:y.content})})]}):(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-ink-faint`,children:[(0,K.jsx)(At,{size:18,"aria-hidden":`true`}),a?`选择资料,阅读原文与使用条件。查看不会执行技能。`:`Select material to read its original and conditions. Reading does not execute a skill.`]})})]})]})}var Yn=[{value:`copilot`,label:`settings.backendLabel.copilot`},{value:`codex`,label:`settings.backendLabel.codex`},{value:`claude`,label:`settings.backendLabel.claude`},{value:`cursor`,label:`settings.backendLabel.cursor`},{value:`opencode`,label:`settings.backendLabel.opencode`},{value:`pi`,label:`settings.backendLabel.pi`},{value:`grok`,label:`settings.backendLabel.grok`},{value:`qoder`,label:`settings.backendLabel.qoder`},{value:`dsh`,label:`settings.backendLabel.dsh`}],Xn={copilot:`copilot`,codex:`codex`,claude:`claude`,cursor:`cursor`,opencode:`opencode`,pi:`pi`,grok:`grok`,qoder:`qoder`,dsh:`dsh`};function Zn(e){return Xn[e]??``}function Qn(e,t){let n=Zn(e);return n?t(`settings.backendLabel.${n}`):e}function $n(e){return e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.value??e?.roles[0]?.backend??``}function er(e){let t=e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.source??``;return t===`env`||t===`persisted`||t==="default"?t:``}function tr(e){return(e?.operator_knobs.find(e=>e.name===`ARGUS_SKILL_RUNNER_BACKEND`)?.saved??``).trim()}function nr(e){return typeof e==`string`&&/^[\p{L}\p{N}_-][\p{L}\p{N}_.-]{0,127}$/u.test(e)}function rr(e){return e===void 0?{}:nr(e)?{sessionId:e}:null}function ir(e,t){return typeof e==`string`?e.trim().slice(0,t):``}function ar(e,t){return ir(e,t*2).replace(/!?(?:\[([^\]]+)\])\([^)]+\)/g,`$1`).replace(/[*_`#]/g,``).replace(/\s+/g,` `).trim().slice(0,t)}function or(e){let t=ir(e.completionId,300),n=rr(e.sessionId);if(!t||!n)return null;let r=ir(e.path,1e3);return{...n,deliveryId:t,title:ar(e.title,240)||`已完成的任务`,summary:ar(e.summary,500),...r?{path:r}:{}}}function sr(e,t){let n=ir(e.delivery_id,300),r=rr(t);return!n||!r?null:{...r,deliveryId:n,title:ir(e.title,240)||`Argus`,summary:ir(e.summary,1e3),...e.primary_target?.path?{path:ir(e.primary_target.path,1e3)}:{}}}function cr(){return typeof window>`u`||window.parent===window?null:window.parent}function lr(){return cr()!==null}function ur(){cr()?.postMessage({type:`argus:show-trial-setup`},`*`)}function dr(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=ir(t.deliveryId,300),r=rr(t.sessionId);if(!n||!r)return null;let i=ir(t.path,1e3);return{...r,deliveryId:n,title:ir(t.title,240)||`Argus`,summary:ir(t.summary,1e3),...i?{path:i}:{}}}function fr(e){let t=dr(e),n=cr();return!t||!n?Promise.resolve(!1):(n.postMessage({type:`argus:notify-completion`,payload:t},`*`),Promise.resolve(!0))}function pr(e){let t=cr();t&&t.postMessage({type:`argus:large-preview`,payload:e},`*`)}function mr(e){let t=typeof window<`u`?window.location?.ancestorOrigins?.[0]:void 0;if(t&&t!==`null`)return e===t;if(typeof document<`u`&&document.referrer)try{let t=new URL(document.referrer);if(t.protocol===`http:`||t.protocol===`https:`)return e===t.origin;if(t.protocol===`tauri:`&&t.hostname===`localhost`)return e===`tauri://localhost`}catch{}return[`http://tauri.localhost`,`https://tauri.localhost`,`tauri://localhost`].includes(e)}function hr(e){let t=cr();if(!t)return()=>void 0;let n=n=>{if(n.source!==t||!mr(n.origin)||n.data?.type!==`argus:open-delivery`)return;let r=dr(n.data.payload);r&&e(r)};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function gr(e){let t=cr();if(!t)return()=>void 0;let n=n=>{n.source===t&&n.data?.type===`argus:new-chat`&&e()};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)}function _r(){if(typeof document>`u`)return()=>void 0;let e=cr();if(!e)return()=>void 0;let t=t=>{if(t.defaultPrevented||t.button!==0&&t.button!==1)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null;if(!n)return;let r;try{r=new URL(n.href,window.location.href)}catch{return}r.origin===window.location.origin||![`http:`,`https:`].includes(r.protocol)||(t.preventDefault(),e.postMessage({type:`argus:open-external`,payload:r.toString()},`*`))},n=t=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.shiftKey||!(t.ctrlKey||t.metaKey))return;let n=t.key===`,`?`argus:show-setup`:t.key.toLowerCase()===`n`?`argus:request-new-chat`:null;n&&(t.preventDefault(),e.postMessage({type:n},`*`))},r=()=>e.postMessage({type:`argus:cockpit-interaction`},`*`);return document.addEventListener(`click`,t,!0),document.addEventListener(`auxclick`,t,!0),window.addEventListener(`keydown`,n),document.addEventListener(`pointerdown`,r,{passive:!0}),()=>{document.removeEventListener(`click`,t,!0),document.removeEventListener(`auxclick`,t,!0),window.removeEventListener(`keydown`,n),document.removeEventListener(`pointerdown`,r)}}var vr=21600,yr=e=>!e||[`auto`,`inherit`,`default`].includes(e.toLowerCase());function br({sid:e,roles:t,running:n,lastCall:r,onOpenSettings:i}){let{locale:a,t:o}=I(),{data:s}=xe(e,!0),c=a===`zh-CN`,l=(n?t.find(e=>e.active):void 0)??t.find(e=>e.role===`manager`),u=s?.trial_mode===!0,d=!!r&&(n||Date.now()/1e3-(r.ts||0)e.role===f.role):void 0,_=g&&g.backend&&g.backend!==f?.backend?g.backend:``,v=g&&!yr(g.model)&&g.model!==f?.model?g.model:``,y=_||v?[Qn(_||g.backend,o),v||g.model||`auto`].join(` · `):``,b=(0,K.jsxs)(K.Fragment,{children:[u?c?`试用`:`Trial`:p?Qn(p,o):c?`模型信息待确认`:`Model information unavailable`,m?` · ${m}`:``,h?` · ${h}`:``,!u&&!f&&n&&l?.active?` · ${ot(l.role)?Ae(l.role,o):l.role}`:``]}),x=f?c?`最近一次模型调用实际使用的后端、模型和推理强度;点击更改`:`Backend, model and effort the latest model call actually used; click to change`:c?`当前配置的后端与模型;点击更改`:`Configured backend and model; click to change`;return(0,K.jsxs)(`div`,{className:`composer-runtime`,"aria-label":c?`当前后端与模型`:`Current backend and model`,children:[i&&!u?(0,K.jsxs)(`button`,{type:`button`,className:`composer-runtime-model`,onClick:i,title:x,"data-runtime-open-settings":!0,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}):(0,K.jsxs)(`span`,{className:`composer-runtime-model`,title:u?void 0:x,children:[c?`模型:`:`Model: `,m||(c?`自动选择`:`Automatic`)]}),(0,K.jsxs)(`details`,{className:`composer-runtime-details`,children:[(0,K.jsx)(`summary`,{children:c?`运行信息`:`Runtime details`}),(0,K.jsx)(`div`,{children:b})]}),y?(0,K.jsx)(`span`,{className:`composer-runtime-next`,"data-runtime-next":!0,children:c?`下次使用:${y}`:`next call: ${y}`}):null,u&&lr()?(0,K.jsx)(`button`,{type:`button`,onClick:ur,children:c?`更换 Key`:`Change Key`}):null]})}function xr({session:e}){let{locale:t}=I(),n=t===`zh-CN`,r=n?`会话目录`:`Session directory`,i=e.workdir||e.cwd||(n?`待确认`:`Pending confirmation`);return(0,K.jsxs)(`details`,{className:`session-workdir`,"data-session-workdir":!0,children:[(0,K.jsxs)(`summary`,{title:`${r}: ${i}`,"aria-label":`${r}: ${i}`,children:[(0,K.jsx)(`span`,{children:r}),(0,K.jsx)(`code`,{children:i})]}),(0,K.jsxs)(`div`,{className:`session-workdir__detail`,children:[(0,K.jsx)(`strong`,{children:r}),(0,K.jsx)(`code`,{children:i}),(0,K.jsx)(`p`,{children:n?`来自已加载会话快照的工作目录;不是每个任务的实际 cwd,也不是安全沙箱边界。`:`Working directory from the loaded session snapshot; not each task’s actual cwd or a security sandbox boundary.`})]})]})}function Sr(e){return!Number.isFinite(e)||e<=0?`$0.00`:e>=100?`$${e.toFixed(0)}`:e>=10?`$${e.toFixed(1)}`:e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(3)}`}function Cr({settledUsd:e,knownUsd:t=0,status:n=`empty`}){let r=typeof e==`number`&&Number.isFinite(e)?e:t,i=n===`partial`||n===`unpriced`;return`${Sr(Math.max(0,r||0))}${i?`+`:``}`}function wr({settledUsd:e,knownUsd:t,status:n,calls:r=0,premiumRequests:i=0,live:a=!1,compact:o=!1}){let s=Cr({settledUsd:e,knownUsd:t,status:n}),c=[`Cumulative settled project spend`,`${r} model call${r===1?``:`s`}`,i>0?`${i.toFixed(1)} premium requests`:``,n&&n!==`empty`?`pricing: ${n}`:``].filter(Boolean).join(` · `);return(0,K.jsxs)(`span`,{title:c,"aria-label":`Project spend ${s}`,className:`inline-flex shrink-0 items-center rounded-full border border-gold/25 bg-gold/8 font-mono tabular-nums text-gold ${o?`h-6 gap-1 px-2 text-[10px]`:`h-5 gap-1 px-1.5 text-[9px]`}`,children:[a?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-gold/80`}):null,(0,K.jsx)(`span`,{children:s})]})}var Tr=e=>String(e??``).trim(),Er=/^[a-z][a-z -]+ requires an operator-owned decision before continuing\.?$/i,Dr=e=>{let t=Tr(e);return Er.test(t)?``:t},Or=(e,t)=>{let n=/[\u3400-\u9fff]/.test(`${e}\n${t}`);return{id:`custom`,label:n?`自己输入`:`Write my own answer`,description:n?`直接告诉 Argus 你的决定。`:`Tell Argus your decision directly.`,requires_note:!0}};function kr(e,t,n){let r=[...e,...t],i=new Map(t.map(e=>[Tr(e.id),e])),a=(e,t)=>{let n=i.get(e)??(Tr(t.id)===e?t:void 0);return{task_title:Tr(n?.title)||void 0,task_status:Tr(n?.status)||void 0}},o=[],s=new Set;for(let e of r){let t=Tr(e.id),n=e.operator_decision;if(n&&typeof n==`object`&&!Array.isArray(n)){let r=n,i=Tr(r.id);if(!i||s.has(i)||Tr(r.status)!==`pending`)continue;s.add(i);let c=Tr(r.options_source),l=r.kind===`domain_intake`,u=(c===`agent`||l&&c===`workflow`)&&Array.isArray(r.options)?r.options.filter(e=>!!Tr(e?.id)&&!!Tr(e?.label)).map(e=>({...e,requires_note:e.requires_note===!0})):[];u.some(e=>e.id===`custom`)||u.push(Or(Tr(r.title),Tr(r.question)));let d=Tr(r.item_id)||t;o.push({id:i,...l?{kind:`domain_intake`}:{},item_id:d,revision:Number(r.revision??1),status:`pending`,title:Tr(r.title)||Tr(e.title)||`Decision required`,reason:Dr(r.reason),question:Tr(r.question)||Tr(e.pending_question),evidence:Array.isArray(r.evidence)?r.evidence.filter(e=>Tr(e?.label)!==`Acceptance check`):[],options:u,options_source:l?`workflow`:u.length?`agent`:`none`,selected_option:``,note:``,...a(d,e),...l?{task_title:Tr(r.task_title),task_status:void 0}:{},...typeof r.asked_at==`number`&&Number.isFinite(r.asked_at)&&r.asked_at>0?{asked_at:r.asked_at}:{}});continue}let r=Tr(e.pending_question??e.question??e.text);if(!t||!r)continue;let i=`legacy-${t}`;s.has(i)||(s.add(i),o.push({id:i,item_id:t,revision:1,status:`pending`,title:Tr(e.title??e.objective)||`Blocked task`,reason:``,question:r,evidence:[],options:[Or(Tr(e.title??e.objective),r)],options_source:`none`,selected_option:``,note:``,legacy:!0,...a(t,e)}))}if(!n)return o;let c=o.map(e=>({...e,is_current_task:e.kind===`domain_intake`?void 0:e.item_id===n}));return[...c.filter(e=>e.kind===`domain_intake`),...c.filter(e=>e.is_current_task),...c.filter(e=>e.kind!==`domain_intake`&&!e.is_current_task)]}function Ar(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function jr(e,t,n=``){let r=Ar(n,70);switch(e){case`manager`:return t?`正在整理任务进展`:`Summarizing progress`;case`planner`:return t?`正在安排接下来要做的事`:`Planning what to do next`;case`reviewer`:return r?t?`正在检查结果:${r}`:`Checking the result: ${r}`:t?`正在检查结果是否正确`:`Checking whether the result is correct`;default:return r?t?`正在处理:${r}`:`Working on: ${r}`:t?`正在处理当前任务`:`Working on the current task`}}var Mr=new Set([`running`,`in_progress`,`claimed`,`active`,`working`,`grounding`,`framed`]),Nr=new Set([`complete`,`completed`,`done`,`success`,`ended`]),Pr=new Set([`paused`,`stopped`,`cancelled`,`aborted`,`incomplete`,`blocked`,`stalled`]),Fr=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:null;function Ir(e){return String(e.item_id||e.mission_id||``).split(`:attempt:`)[0]}function Lr(e,t,n){let r=e?.backlog?.find(e=>e.id===n),i=Date.parse(e?.daemon.started_at_iso||``)/1e3;return Math.max(t?.mission.id===n&&t.mission.started_at||0,r?.started_ts||0,Number.isFinite(i)?i:0)}function Rr(e,t=0){let n=new Map;for(let r of e){if(Number(r.ts||0)zr.has(String(e.type||``))&&Ir(e)===t.id&&Number(e.ts||0)>=r);e?.type===`round.external_work_wait.started`&&(i=String(e.work_id||``)),a=e?.type===`round.external_work_wait.completed`}else return null;if(a)return null;let o=(e.background_work||[]).find(e=>i&&e.work_id===i||e.waited_by?.includes(t.id));return o?{workId:o.work_id,parts:(o.parts||[]).map(e=>({role:e.role,done:e.done,total:e.total,running:e.running})),done:o.done,total:o.total,lastProgressAt:Fr(o.last_progress_ts)}:i?{workId:i,parts:[],done:0,total:0,lastProgressAt:null}:null}function Vr(e,t,n=[],r=Date.now()/1e3){let i=t?.mission.id||e?.backlog?.find(e=>Mr.has(e.status)||e.status===`paused_external_work`)?.id||``,a=e?.backlog?.find(e=>e.id===i),o=Lr(e,t,i),s=e?.roles?.filter(e=>e.active)||[],c=(e?.backlog?.filter(e=>Mr.has(e.status)).length||0)>1,l=new Map;for(let e of t?.role_work||[])i&&(e.item_id||e.mission_id)!==i||e.tsMr.has(e.status)).sort((e,t)=>t.ts-e.ts).find(e=>s.some(t=>t.role===e.role))?.role||(c?``:(s.find(e=>e.role===t?.active_role)||s[0])?.role)||(e?``:t?.roles.find(e=>e.status===`active`)?.role)||``,d=n.filter(e=>{let t=Ir(e);return(!i||t===i)&&Number(e.ts||0)>=o&&!String(e.run_label||``).startsWith(`map-summary`)&&/(?:progress|round\.(?:main|review)|life\.(?:mission|phase)|work\.segment)/.test(String(e.type||``))}).map(e=>Fr(e.ts));for(let e of t?.role_work||[]){let t=e.item_id||e.mission_id;(!i||t===i)&&e.ts>=o&&e.kind!==`waiting`&&![`waiting`,`idle`].includes(e.status)&&d.push(Fr(e.ts))}let f=d.filter(e=>e!==null&&e<=r+5),p=f.length?Math.max(...f):null,m={state:`idle`,role:u,taskId:i,title:t?.mission.title||a?.title||t?.mission.objective||``,activityAt:p,activityAgeSeconds:p===null?null:Math.max(0,r-p),reason:``};if(!e||e.daemon.read_status===`error`)return{...m,state:`unknown`};if(e.manager_requests?.some(e=>e.status===`running`)??!1){let e=Fr(Rr(n)?.ts)??p;return{...m,state:`running`,role:`manager`,foreground:!0,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}if(!i){let e=[...n].reverse().find(e=>e.type===`ui.argus`&&e.mission_result===!0&&!e.item_id&&e.live!==!0);if(e){let t=Fr(e.ts);return{...m,state:`step_finished`,activityAt:t,activityAgeSeconds:t===null?null:Math.max(0,r-t),reason:e.success===!1?`task_failed`:``}}}let h=Br(e,a,n,o);if(h){let e=h.lastProgressAt??p;return{...m,state:`waiting`,role:``,reason:`background_work`,waitingOn:h,activityAt:e,activityAgeSeconds:e===null?null:Math.max(0,r-e)}}let g=String(a?.status||t?.mission.status||``).toLowerCase();if(Pr.has(g)||g.startsWith(`paused_`)||g===`research_incomplete`){let t=kr(e.pending_questions??[],e.backlog.map(e=>({...e})),i).some(e=>e.item_id===i);return{...m,state:`paused`,role:``,reason:t?`operator_input`:`not_running`}}if([`failed`,`error`].includes(g))return{...m,state:`step_finished`,role:``,reason:`task_failed`};if(Nr.has(g))return e.daemon.alive&&s.some(e=>e.role===`planner`)?{...m,state:`running`,role:`planner`}:{...m,role:``,state:e.daemon.alive&&(t?.routing?.continuous||e.continuous?.enabled)?`waiting`:`step_finished`};if(!e.daemon.alive)return Mr.has(g)?{...m,state:`paused`,role:``,reason:`not_running`}:{...m,role:``};let _=[...n].reverse().find(e=>e.type===`round.backend_failure.backoff`&&Number(e.ts||0)>=o&&(!i||Ir(e)===i));return _&&Number(_.ts||0)+Number(_.seconds||0)>r&&Number(_.ts||0)>=(p||0)?{...m,state:`waiting`,reason:`provider_wait`}:e.daemon.health?.stalled?{...m,state:`waiting`,reason:`no_recent_progress`}:u?{...m,state:`running`}:c&&s.length>0&&i?{...m,state:`unknown`}:{...m,state:`waiting`,reason:`awaiting_next_step`}}function Hr(e,t){let n=t===`zh-CN`;return e===null?``:e<60?n?`刚刚`:`just now`:e<3600?n?`${Math.floor(e/60)} 分钟前`:`${Math.floor(e/60)} min ago`:n?`${Math.floor(e/3600)} 小时前`:`${Math.floor(e/3600)} hr ago`}var Ur={"idea-route":[`条研究路线`,[`research route`,`research routes`]],"idea-review":[`次独立复核`,[`independent review`,`independent reviews`]],"idea-selector":[`次方案选择`,[`idea selection`,`idea selections`]]};function Wr(e,t){if(!e.total)return``;let[n,[r,i]]=Ur[e.role]??[`项子任务`,[`subtask`,`subtasks`]],a=e.total===1?r:i;return e.done===e.total?t?`${e.total} ${n}全部完成`:`all ${e.total} ${a} done`:t?`${e.total} ${n}中 ${e.done} ${n.slice(0,1)}完成`:`${e.done} of ${e.total} ${a} done`}function Gr(e,t){let n=t===`zh-CN`,r=e.waitingOn,i=(r?.parts??[]).map(e=>Wr(e,n)).filter(Boolean),a=i.length?i.join(n?`、`:`, `):r?.total?n?`${r.total} 项子任务中 ${r.done} 项完成`:`${r.done} of ${r.total} subtasks done`:``,o=Hr(e.activityAgeSeconds,t),s=o?n?o===`刚刚`?`,最近一次进展就在刚刚`:`,最近一次进展在 ${o}`:`, last progress ${o}`:``;return a?n?`正在等待后台团队:${a}${s}`:`Waiting for the background team: ${a}${s}`:n?`正在等待后台团队完成工作${s}`:`Waiting for the background team to finish${s}`}function Kr(e,t,n=!0){let r=t===`zh-CN`;return n?e.reason===`operator_input`?r?`当前任务等待你的回复`:`This task is waiting for your reply`:e.reason===`task_failed`?r?`这一步执行未完成`:`Execution of this step did not finish`:e.reason===`background_work`?Gr(e,t):e.state===`running`?e.foreground?r?`正在处理你的请求`:`Working on your request`:jr(e.role,r,e.title):e.reason===`provider_wait`?r?`模型服务暂时未能完成请求,等待后会重试`:`The model service could not complete the request; waiting before retrying`:e.reason===`no_recent_progress`?r?`暂时没有收到新的进展`:`No new progress received recently`:{running:[`正在处理当前任务`,`Working on the current task`],waiting:[`等待下一步工作`,`Waiting for the next step`],paused:[`当前任务未在运行`,`The current task is not running`],step_finished:[`这一步已结束`,`This step has ended`],idle:[`可以开始新任务`,`Ready for a new task`],unknown:[`暂时无法确认任务进度`,`Unable to confirm task progress right now`]}[e.state][+!r]:r?`实时连接已断开`:`Live connection lost`}var qr=new Set([`grounding`,`task`,`decision`,`agent_message`,`assistant_message`,`command_execution`,`tool_use`,`tool_result`,`handoff`,`review`,`verdict`,`completion`,`plan`,`file_change`,`result`]),Jr=/^(using a tool|running project command|inspecting project state|working|reporting progress|暂无详细记录)$/i;function Yr(e){let t=Te(e).replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/gim,``).trim();return Jr.test(t)||t.startsWith(`{`)?``:t}function Xr(e,t,n=``){if(n){if(/^(?:rg|grep|glob|search)$/.test(n))return t?`检索项目文件`:`Searching project files`;if(/^(?:view|read|read_file)$/.test(n))return t?`读取文件`:`Reading a file`;if(/apply_patch|edit|write/.test(n))return t?`编辑文件`:`Editing a file`;if(/bash|shell|exec|terminal/.test(n))return t?`运行终端命令`:`Running a command`;if(/playwright|browser/.test(n))return t?`检查浏览器交互`:`Checking browser interactions`}return({grounding:[`理解任务与检查项目`,`Understanding the task`],task:[`安排任务`,`Task assignment`],decision:[`确定执行方案`,`Execution decision`],plan:[`制定执行计划`,`Planning the work`],agent_message:[`更新执行进度`,`Progress update`],assistant_message:[`更新执行进度`,`Progress update`],command_execution:[`运行项目命令`,`Running a project command`],tool_use:[`使用工具`,`Using a tool`],tool_result:[`工具输出`,`Tool output`],file_change:[`更新项目文件`,`Updating project files`],handoff:[`整理结果与后续工作`,`Summarizing results and next steps`],review:[`检查实现与结果`,`Checking implementation and results`],verdict:[`说明检查结果`,`Explaining the check result`],completion:[`完成任务`,`Task completed`],result:[`产出结果`,`Result`]}[e]??[`处理当前任务`,`Working on the current task`])[+!t]}function Zr(e,t,n,r=0){let i=new Map;for(let a of e?.role_work??[]){if(a.role!==t||!qr.has(a.kind)||a.tst.ts-e.ts)}function Qr(e,t,n,r=0){return[...e].reverse().find(e=>e.type===`engineer.progress`&&Number(e.ts||0)>=r&&[`tool_use`,`command_execution`,`file_change`].includes(String(e.kind))&&String(e.agent_layer||e.actor||e.role)===t&&(!n||String(e.item_id||e.mission_id)===n))}function $r(e,t,n,r,i){return r||[`done`,`completed`,`failed`,`aborted`,`stopped`].includes(e?.mission.status??``)||i&&e?.mission.id!==i?!1:t.length?t.some(e=>e.role===n&&e.active):e?.active_role===n&&[`working`,`grounding`,`framed`,`running`].includes(e?.mission.status??``)}function ei(e,t){let n=Math.max(0,Math.floor(e));if(n<30)return``;let[r,i,a]=n<60?[n,`秒`,`s`]:n<3600?[Math.floor(n/60),`分钟`,`m`]:n<86400?[Math.floor(n/3600),`小时`,`h`]:[Math.floor(n/86400),`天`,`d`];return t?`上次更新 ${r} ${i}前`:`last update ${r}${a} ago`}function ti(e,t,n,r,i=!0,a=0){let o=Kr(e,r,i);if(!i||e.state!==`running`||e.foreground||!e.taskId||!e.role)return o;let s=Math.max(a,t?.mission.id===e.taskId&&t.mission.started_at||0),c=Zr(t,e.role,e.taskId,s).find(e=>e.detail&&[`agent_message`,`assistant_message`].includes(e.kind)||[`tool_use`,`command_execution`,`file_change`].includes(e.kind)),l=Qr(n,e.role,e.taskId,s);if(c?.detail&&[`agent_message`,`assistant_message`].includes(c.kind)&&(!l||Number(l.ts||0)=c.ts)){let t=Xr(String(l.kind),r===`zh-CN`,String(l.tool_name||``));return e.title?`${t}${r===`zh-CN`?`:`:`: `}${Ar(e.title,70)}`:t}return c&&[`tool_use`,`command_execution`,`file_change`].includes(c.kind)?Xr(c.kind,r===`zh-CN`):o}var ni=new Set([`running`,`in_progress`,`claimed`]);function ri({snap:e,streamOk:t,onStart:n,onStop:r,onManage:i,onOpenSessions:a,mobileView:o,onToggleMobileView:c,busy:l,snapshotStale:u=!1,readOnly:f=!1,missionView:p,events:h=[]}){let{t:g,locale:_}=I(),v=Vr(e,p,h),y=ti(v,p,h,_,t,Lr(e,p,v.taskId)),b=[`complete`,`completed`,`done`,`success`].includes(String(p?.mission.status||``).toLowerCase()),x=v.role||`manager`,S=v.state===`running`&&t&&!u,C=e.backlog.find(e=>ni.has(e.status)),w=v.title||C?.title||C?.objective||(b?p?.mission.summary||p?.mission.title:``)||e.session.objective||``,T=!!(e.partial||e.observability?.slo.status===`degraded`),E=typeof e.spend_usd==`number`?e.spend_usd:e.usage_summary?.known_cost_usd??0,D=e.daemon.alive&&e.daemon.control_available===!1,O=!e.daemon.alive&&[`running`,`waiting`].includes(Vr(e,p,h).state),k=D?g(`topbar.externallyManaged`):e.daemon.alive?g(`topbar.pauseDaemon`):g(O?`topbar.working`:`topbar.runDaemon`),A=T?[...(e.diagnostics??[]).map(e=>`${e.section}: ${e.message}`),...e.observability?.slo.violations??[]].join(` +`)||g(`common.degraded`):g(u?`common.stale`:t?`common.live`:`common.reconnecting`);return(0,K.jsxs)(it,{children:[a?(0,K.jsx)(`button`,{type:`button`,onClick:a,"aria-label":g(`topbar.openSessions`),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-ink-faint hover:bg-bg hover:text-ink lg:hidden`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,K.jsx)(`path`,{d:`M2.5 4h11M2.5 8h11M2.5 12h11`})})}):null,(0,K.jsxs)(`div`,{className:`topbar-heading flex min-w-0 flex-1 flex-col justify-center gap-0.5`,children:[(0,K.jsx)(`div`,{className:`topbar-title min-w-0 truncate text-sm font-semibold text-ink`,title:e.session.display_name||e.session.id,children:e.session.display_name||e.session.id}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[S?(0,K.jsx)(`span`,{"data-role-dot":x,"aria-label":g(`topbar.roleActive`,{role:yn(x,g)}),className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:R.role[x]||`rgb(var(--ink-faint))`}}):null,S||w?(0,K.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-ink-dim`,title:y,children:t?u?g(`common.stale`):y:g(`common.reconnecting`)}):null,(0,K.jsx)(xr,{session:e.session})]})]}),(0,K.jsx)(`span`,{title:A,className:`h-2 w-2 shrink-0 rounded-full transition-shadow duration-150 ${T||u?`bg-err ring-1 ring-err/30 ring-offset-1 ring-offset-panel`:t?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,children:(0,K.jsx)(`span`,{className:`sr-only`,children:A})}),E>0?(0,K.jsx)(wr,{settledUsd:e.spend_usd,knownUsd:e.usage_summary?.known_cost_usd,status:e.spend_status,calls:e.usage_summary?.call_count,premiumRequests:e.usage_summary?.premium_requests,live:e.daemon.alive,compact:!0}):null,c?(0,K.jsx)(`button`,{type:`button`,onClick:c,"aria-label":g(o===`activity`?`topbar.showPreview`:`topbar.showActivity`),title:g(o===`activity`?`topbar.showPreview`:`topbar.showActivity`),className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center lg:hidden`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:o===`activity`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`11`,rx:`1.5`}),(0,K.jsx)(`path`,{d:`M9.5 2.75v10.5`})]}):(0,K.jsx)(`path`,{d:`M3 4h10M3 8h10M3 12h7`})})}):null,f?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,disabled:l||D||O,onClick:e.daemon.alive?r:n,"aria-label":k,title:D?g(`topbar.externalDaemonHint`):k,className:`compact-control flex h-8 shrink-0 items-center gap-1 px-2 disabled:opacity-40`,children:[(0,K.jsx)(s,{icon:e.daemon.alive?m:d,className:`h-3 w-3`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:D?g(`common.external`):e.daemon.alive?g(`common.pause`):g(O?`common.working`:`common.run`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":g(`topbar.manageSession`),title:g(`topbar.manageSession`),onClick:i,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center text-sm tracking-widest`,children:`···`})]})]})}var ii=new Set([`done`,`success`,`completed`]),ai=new Set([`research_incomplete`,`paused_no_breakthrough`,`exhausted_current_methods`]),oi=new Set([`no_progress`,`max_rounds`]),si=new Set([`blocked`,`infra_blocked`]),ci=new Set([`error`,`failed`,`supervisor_error`]),li={completed:{glyph:`🎉`,tone:`ok`,missionStatus:`complete`},incomplete:{glyph:`◌`,tone:`warn`,missionStatus:`incomplete`},stalled:{glyph:`⏸`,tone:`warn`,missionStatus:`stalled`},blocked:{glyph:`⛔`,tone:`err`,missionStatus:`blocked`},failed:{glyph:`💥`,tone:`err`,missionStatus:`failed`},ended:{glyph:`■`,tone:`info`,missionStatus:`ended`}},ui={completed:`mission_completed`,incomplete:`mission_incomplete`,stalled:`mission_stalled`,blocked:`mission_blocked`,failed:`mission_failed`,ended:`mission_ended`},di={mission_completed:`The task was completed.`,mission_continued:`The task was completed and the project continues with the next one.`,mission_certified:`The final submission was checked and approved.`,mission_incomplete:`The task stopped with work still remaining.`,mission_stalled:`The task stopped because recent rounds made no useful progress.`,mission_blocked:`The task cannot continue until something outside it is resolved.`,mission_failed:`The task could not be completed.`,mission_paused:`The task was paused before it finished because {why}; its progress is saved and it can be resumed.`,mission_ended:`The task ended without a recorded outcome.`},fi={budget_exhausted:`the project reached its budget limit`,provider_cooldown:`the model service asked Argus to wait before calling again`,provider_fence:`the model provider is not accepting calls right now`,daemon_shutdown:`Argus was stopped`,operator_pause:`the operator paused the work`,operator_abort:`the operator cancelled the task`,backend_unavailable:`the model service was unavailable`,transient_error:`a temporary error interrupted the call`,permanent_error:`an error that will not clear on its own stopped the call`},pi={paused_budget:`budget_exhausted`,paused_provider_cooldown:`provider_cooldown`,paused_provider_fence:`provider_fence`,paused_daemon_shutdown:`daemon_shutdown`,paused_operator:`operator_pause`};function mi(e){return String(e??``).trim().toLowerCase()}function hi(e,t){if(e===`paused_external_work`)return`work outside Argus had to finish first`;let n=pi[e];return n?fi[n]:fi[t]?fi[t]:e.startsWith(`paused_`)?`the work was paused`:`the work was interrupted`}function gi(e){let t=mi(e);switch(t){case`completed`:case`incomplete`:case`stalled`:case`blocked`:case`failed`:case`ended`:return t;default:return null}}function _i(e){let t=mi(e.status);return e.success===!0||ii.has(t)?`completed`:ai.has(t)?`incomplete`:oi.has(t)?`stalled`:si.has(t)?`blocked`:ci.has(t)?`failed`:`ended`}function vi(e){let t=e.outcome;if(t&&typeof t==`object`&&!Array.isArray(t)){let n=t;return{execution_status:mi(n.execution_status)||_i(e),review_status:mi(n.review_status)||`not_assessed`,stage_certification:mi(n.stage_certification)||`not_assessed`,interruption_kind:mi(n.interruption_kind)||`none`,resumable:n.resumable===!0}}return{execution_status:_i(e),review_status:`not_assessed`,stage_certification:`not_assessed`,interruption_kind:mi(e.stop_kind)||`none`,resumable:e.resumable===!0}}function yi(e){if(e.success===!0&&e.campaign_continues===!0)return{outcomeClass:`completed`,kind:`mission_continued`,label:di.mission_continued,glyph:`↻`,tone:`info`,missionStatus:`continued`,technical:``};let t=gi(e.outcome_class)??_i(e),n=mi(e.status),r=li[t],i=ui[t],a=di[i],o=``;if(t===`completed`&&e.final_submission_certified===!0)i=`mission_certified`,a=di.mission_certified;else if(t===`ended`&&(o=String(e.status??``).trim(),n.startsWith(`paused_`)||e.resumable===!0)){let t=e.outcome&&typeof e.outcome==`object`&&!Array.isArray(e.outcome)?e.outcome:{},r=mi(e.stop_kind)||mi(t.interruption_kind);i=`mission_paused`,a=di.mission_paused.replace(`{why}`,hi(n,r))}return{outcomeClass:t,kind:i,label:a,glyph:r.glyph,tone:r.tone,missionStatus:r.missionStatus,technical:o}}function bi(e,t){let n=typeof e==`string`?e.trim():``;return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function xi(e,t){let n=t===`zh-CN`,r=bi(e.route,40),i=bi(e.workflow_mode,40),a=bi(e.execution_task,160),o;o=r===`self`?n?`计划由 Manager 直接处理`:`Manager plans to handle this request`:i===`staged`?r===`team`?n?`计划由团队分阶段推进`:`The team plans to work in stages`:n?`计划分阶段推进`:`The plan is to work in stages`:i===`direct`?r===`team`?n?`计划由团队直接处理`:`The team plans to handle this task directly`:n?`计划直接处理这项工作`:`The plan is to handle this task directly`:n?`处理方案已确定`:`A plan is ready`,a&&(o+=`${n?`:`:`: `}${a}`);let s=``;e.lifetime===`standing`&&e.open_ended!==!1||!e.lifetime&&e.open_ended===!0?s=n?`持续跟进后续工作。`:`Keep following up on subsequent work.`:e.lifetime===`bounded_increment`?s=n?`本次只推进一个明确的增量。`:`Limit this run to one defined increment.`:e.lifetime===`bounded`&&(s=e.continuous===!0&&e.open_ended===!1?n?`完成这次目标后结束。`:`Finish once this objective is met.`:n?`范围限于本次目标。`:`Keep the work within this objective.`);let c=bi(e.reason,320),l=c&&!/^(?:\[manager\]|manager routed\b|\{)/i.test(c)&&c!==(bi(e.execution_task,320)||bi(e.objective,320))?c:``;return[o,[s,l].filter(Boolean).join(n?``:` `)].filter(Boolean).join(` +`)}function Si(e){let t=e;return t=t.replace(/^(\s*(?:authorization|proxy-authorization)\s*:).*$/gim,`$1 `),t=t.replace(/^(\s*(?:x-api-key|api-key|cookie|set-cookie)\s*:).*$/gim,`$1 `),t=t.replace(/gh[pousr]_[A-Za-z0-9]{20,}/g,``).replace(/xox[baprs]-[A-Za-z0-9-]{10,}/g,``).replace(/AKIA[0-9A-Z]{16}/g,``).replace(/\bbearer\s+[A-Za-z0-9._\-+/=]{16,}/gi,``).replace(/(?`).replace(/(?`).replace(/\b([a-z][a-z0-9+.\-]*:\/\/)[^/\s:@]+:[^/\s@]+@/gi,`$1@`),{text:e,sensitive:t!==e}}function Ci(e){return Si(Te(e))}function q(e,t){let n=String(e??``).replace(/```[a-z]*\n?/gi,``).replace(/\[([^\]]+)\]\([^)]+\)/g,`[$1]`).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}var J=e=>e,Y=(e,t)=>String(J(e)[t]??``);function wi(e,t){return`${e} ${t}${e===1?``:`s`}`}function X(e,t,n){return e.locale===`zh-CN`?n:t}function Ti(e,t){let n=Y(e,`error_code`),r=Y(e,`failure_stage`),i=Y(e,`stop_kind`),a=[`daemon_shutdown`,`operator_pause`,`operator_abort`].includes(i);if(n===`cancelled`&&r===`commit`&&Y(e,`status`)===`issued`)return{text:X(t,`Applying the adjustment was interrupted; the saved decision is waiting to be applied.`,`应用调整时被中断,已保存的决定等待继续处理。`),tone:`warn`};if(n===`timeout`&&r===`commit`)return{text:X(t,`Manager reached a decision, but applying the adjustment timed out.`,`Manager 已作出判断,但应用调整超时。`),tone:`warn`};let o={trial_quota_exceeded:[`The remaining trial quota cannot cover this Manager check.`,`剩余试用额度不足以启动这次 Manager 检查。`],observation_incomplete:[`Manager could not fully read the required project evidence; this check has stopped.`,`Manager 未能完整读取所需的项目资料,这次检查已停止。`],timeout:[`The model did not respond before the Manager check timed out.`,`模型未在时限内返回,Manager 这次检查已结束。`],cancelled:[`This Manager check was cancelled.`,`已取消这次 Manager 检查。`],superseded:[`New input or evidence superseded this Manager check.`,`新的操作或证据已取代这次 Manager 检查。`]};if(Object.hasOwn(o,n)&&!(n===`cancelled`&&a))return{text:X(t,...o[n]),tone:n===`cancelled`||n===`superseded`?`dim`:`warn`};let s={budget_exhausted:[`The project budget limit prevented this Manager check.`,`项目预算已达上限,Manager 暂未完成检查。`],provider_cooldown:[`The model service asked Manager to wait before calling again.`,`模型服务要求稍后再调用,Manager 暂未完成检查。`],provider_fence:[`The model service is not accepting calls; Manager could not finish this check.`,`模型服务当前不接受调用,Manager 未完成这次检查。`],backend_unavailable:[`The model service was unavailable for this Manager check.`,`模型服务不可用,Manager 未完成这次检查。`],transient_error:[`A temporary model service error interrupted this Manager check.`,`模型服务的临时错误中断了这次 Manager 检查。`],permanent_error:[`The model call failed; Manager could not finish this check.`,`模型调用失败,Manager 未完成这次检查。`],daemon_shutdown:[`Argus stopped, ending this Manager check.`,`Argus 已停止,这次 Manager 检查已结束。`],operator_pause:[`This Manager check was paused by your request.`,`已按你的要求暂停这次 Manager 检查。`],operator_abort:[`This Manager check was cancelled by your request.`,`已按你的要求取消这次 Manager 检查。`]};if(Object.hasOwn(s,i))return{text:X(t,...s[i]),tone:a?`dim`:`warn`};let c=Y(e,`status`);return c===`cancelled`||c===`superseded`?{text:X(t,`This Manager check was cancelled.`,`这次 Manager 检查已取消。`),tone:`dim`}:{text:r===`commit`&&[`continue`,`wait`,`steer`].includes(Y(e,`action`))?X(t,`Manager reached a decision, but the team adjustment could not be applied.`,`Manager 已作出判断,但团队调整未能生效。`):r===`decision`?X(t,`Manager returned a decision that could not be validated.`,`Manager 返回的判断或引用依据未通过核验。`):X(t,`Manager could not finish this check.`,`Manager 未能完成这次检查。`),tone:`warn`}}function Z(e,t,n,r,i,a={}){let o=Ci(r);return{visibility:a.visibility??(i===`err`||i===`warn`?`alert`:`normal`),role:e,labelKey:t,glyph:n,tone:i,segments:o.text?[{kind:`text`,text:o.text}]:[],expandable:a.expandable===!0,sensitive:o.sensitive||a.sensitive===!0,fallback:a.fallback===!0,rule:a.rule===!0,reasoning:a.reasoning===!0}}function Ei(){return{visibility:`hidden`,role:`system`,labelKey:`event.hidden`,glyph:``,tone:`dim`,segments:[],expandable:!1,sensitive:!1,fallback:!1,rule:!1,reasoning:!1}}function Di(e,t){if(J(e).operator_alert===!0){let n=q(Y(e,`text`)||Y(e,`reason`)||e.type,170);return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,n,`err`,{rule:!0})}if(t.unknownEventPolicy===`hide`)return Ei();let n=String(e.type||`?`),r=Y(e,`text`).trim();return Z(`system`,`event.fallback`,`•`,`[${n}]${r?` ${r}`:``}`,`dim`,{fallback:!0})}function Oi(e,t=`engineer`){return Y(e,`agent_layer`)||(e.type.startsWith(`life.manager.`)?`manager`:e.type.startsWith(`life.planner.`)?`planner`:e.type.startsWith(`round.review.`)?`reviewer`:t)}function ki(e,t){let n=Y(e,`phase`),r=Y(e,`cause`)||Y(e,`backend_error`),i=Y(e,`error`);if(!n||!r)return`${X(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} ${q(i,t.density===`full`?160:140)}`;let a={backend:[`model service`,`模型服务`],parse:[`reading the answer`,`读取回答`],contract:[`answer shape:`,`回答格式:`],timeout:[`timed out`,`超时`]},o=a[n]?X(t,a[n][0],a[n][1]):n,s=Number(J(e).attempts||0),c=s>1?X(t,` (attempt ${s})`,` (第${s}次尝试)`):``,l=`${X(t,`could not work out where this request belongs`,`没能判断这个请求该归谁`)} · ${o} ${r}${c}`;return i?`${l} · ${X(t,`error text`,`原始错误`)}: ${i}`:l}function Ai(e){let t=J(e).round_index??J(e).round;return typeof t==`string`||typeof t==`number`?t:`?`}function ji(e,t){let n=Y(e,`kind`),r=Oi(e),i=`role.${r}`;if(n===`reasoning`){if(!t.showReasoning)return Ei();let n=q(Y(e,`text`),280);return n?Z(r,i,`∴`,n,`dim`,{expandable:t.density===`full`,reasoning:!0}):Ei()}if(n===`assistant_message`||n===`agent_message`||n===`message`){if(re(J(e)))return Di(e,t);let n=Ci(Y(e,`text`));return n.text?Z(r,i,`▌`,n.text,`bright`,{expandable:t.density===`full`,sensitive:n.sensitive}):Ei()}if(n===`command_execution`){let n=Y(e,`text`)||Y(e,`command`)||Y(e,`action_summary`),a=Y(e,`status`)===`failed`?`err`:`dim`;return n?Z(r,i,`▸ $`,n,a,{expandable:t.density===`full`}):Ei()}if(n===`tool_use`||n===`file_change`){let a=Y(e,`text`)||Y(e,`action_summary`);if(!a&&t.density===`full`)return Ei();let o=n===`file_change`?X(t,`(file change)`,`(文件变更)`):X(t,`(tool)`,`(工具)`);return Z(r,i,n===`file_change`?`✎`:`⚙`,a||o,Y(e,`status`)===`failed`?`err`:`dim`,{expandable:t.density===`full`})}if(t.density===`full`)return Ei();let a=String(J(e).text??J(e).action_summary??``).split(` +`)[0]?.trim()??``;return a?Z(r,i,`▸`,q(a,160),`dim`):Ei()}function Mi(e,t){let n=A(J(e).canonical_type??e.type);if(n&&n!==e.type)return Mi({...e,type:n},t);switch(e.type){case`advisor.consultation.requested`:case`life.manager.supervision.issued`:return Ei();case`advisor.consultation.completed`:{let t=Y(e,`question`).trim(),n=Y(e,`summary`).trim();return!t&&!n?Ei():Z(`advisor`,`role.advisor`,`◇`,[t,n].filter(Boolean).join(` +`),`info`,{expandable:!0})}case`advisor.consultation.cancelled`:{let n=q(Y(e,`question`),160);return Z(`advisor`,`role.advisor`,`◇`,`${X(t,`Consultation cancelled`,`已取消咨询`)}${n?` · ${n}`:``}`,`dim`)}case`advisor.consultation.failed`:case`advisor.consultation.timed_out`:case`advisor.consultation.model_mismatch`:{let n=e.type.endsWith(`model_mismatch`)?X(t,`The provider returned a different model`,`接入返回的模型与所选模型不一致`):e.type.endsWith(`timed_out`)?X(t,`The advisor did not respond in time`,`顾问未在时限内返回`):X(t,`The consultation did not finish`,`顾问咨询未完成`),r=q(Y(e,`question`),160);return Z(`advisor`,`role.advisor`,`◇`,`${n}${r?` · ${r}`:``}`,`warn`,{expandable:!0})}case`life.manager.supervision.applied`:return Z(`manager`,`role.manager`,`🧭`,Y(e,`summary`)||Y(e,`reason`),`info`,{expandable:!0,rule:!0});case`life.peer.message.processed`:return Z(`manager`,`role.peer`,`↔`,Y(e,`text`),`info`,{expandable:!0});case`life.manager.supervision.failed`:{let n=Ti(e,t);return Z(`manager`,`role.manager`,`🧭`,n.text,n.tone,{expandable:!0})}case`engineer.progress`:return ji(e,t);case`life.manager.intent.started`:return Z(`manager`,`role.manager`,`🧭`,X(t,`Working out how to handle your request…`,`正在安排处理方式…`),`info`);case`life.manager.intent.completed`:return Z(`manager`,`role.manager`,`🧭`,xi(J(e),t.locale),`info`,{expandable:!0});case`life.manager.intent.failed`:return Z(`manager`,`role.manager`,`⚠`,ki(e,t),`err`,{expandable:t.density===`full`});case`life.manager.stage_decision`:{let n=Y(e,`target_stage`)||Y(e,`stage`)||Y(e,`current_stage`);return Z(`manager`,`role.manager`,`🧭`,`${Y(e,`action`)}${n?` → ${n}`:``} ${q(Y(e,`reason`),t.density===`full`?140:120)}`,`info`)}case`life.research.second_reading`:{let n=Oi(e,`manager`),r=q(Y(e,`supported`),160),i=X(t,`reread the evidence and reworked the plan`,`重读了证据并重排了计划`);return Z(n,`role.${n}`,`📖`,r?`${i} · ${r}`:i,`info`)}case`life.letter.written`:{let n=Oi(e,`manager`);return Z(n,`role.${n}`,`✉`,X(t,`wrote you a letter`,`给你写了一封信`),`accent`)}case`life.planner.start`:return Z(`planner`,`role.planner`,`📋`,`${X(t,`planning`,`正在规划`)} ${q(Y(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.verdict`:return Y(e,`status`)===`done`||J(e).project_done===!0?Z(`planner`,`role.planner`,`🏁`,X(t,`the project is finished`,`项目已完成`),`ok`):Z(`planner`,`role.planner`,`📋`,X(t,`lined up ${Y(e,`queued`)||Y(e,`n`)||`next`} task(s) to do next`,`已排好 ${Y(e,`queued`)||Y(e,`n`)||`下一`} 个接下来要做的任务`),`accent`);case`life.planner.task_added`:return Z(`planner`,`role.planner`,`+`,`${X(t,`added a task`,`新增任务`)} · ${q(Y(e,`title`)||Y(e,`objective`),t.density===`full`?160:140)}`,`accent`);case`life.planner.task_skipped`:return Z(`planner`,`role.planner`,`⏭`,`${Y(e,`skip_category`)===`paper_review_purchase_deferred`?X(t,`put off another paper review`,`推迟了再买一次评审`):X(t,`skipped a task already planned`,`跳过了已在计划中的任务`)} ${q(Y(e,`title`),t.density===`full`?140:120)}`,`dim`);case`life.planner.preview_skipped`:return Z(`planner`,`role.planner`,`⏭`,X(t,`skipped the plan preview: the research Planner owns the campaign plan`,`跳过了计划预览:研究规划师负责整个计划`),`dim`);case`life.planner.normalized`:return Z(`planner`,`role.planner`,`≋`,`${X(t,`tidied the plan`,`整理了计划`)} · ${q(Y(e,`diagnostic`),180)}`,`dim`);case`life.planner.waiting`:return Z(`planner`,`role.planner`,`⌛`,`${X(t,`waiting`,`等待中`)} · ${q(Y(e,`reason`),180)}`,`info`);case`life.planner.waiting_woken`:return Z(`planner`,`role.planner`,`↻`,`${X(t,`resumed`,`已唤醒`)} · ${q(Y(e,`wake_reason`),180)}`,`info`);case`life.planner.terminal_idle`:return Z(`planner`,`role.planner`,`Ⅱ`,`${X(t,`nothing left to plan`,`暂时没有要规划的`)} · ${q(Y(e,`reason`),180)}`,`dim`);case`life.planner.verification_probe`:return t.showReasoning?Z(`planner`,`role.planner`,`⌕`,`${X(t,`checking that the plan still holds`,`检查计划是否仍然成立`)} · ${q(Y(e,`reason`),180)}`,`dim`):Ei();case`life.planner.error`:return Z(`planner`,`role.planner`,`⚠`,`${X(t,`the Planner hit an error`,`规划者出错`)} ${q(Y(e,`error`)||Y(e,`text`),t.density===`full`?160:140)}`,`err`);case`life.mission.started`:return Z(`engineer`,`role.engineer`,`🚀`,q(Y(e,`title`)||Y(e,`objective`)||Y(e,`text`)||X(t,`started work on this task`,`开始做这项任务`),t.density===`full`?180:160),`info`,{rule:!0});case`round.start`:return Z(`engineer`,`role.engineer`,`──`,X(t,`round ${Ai(e)}`,`第 ${Ai(e)} 轮`),`dim`,{rule:!0});case`life.phase.started`:{let n=Y(e,`label`)||Y(e,`phase`),r=Oi(e);return n?Z(r,`role.${r}`,`🔄`,X(t,`entering ${n}`,`进入 ${n}`),`info`):Ei()}case`round.review.started`:return Z(`reviewer`,`role.reviewer`,`🔄`,X(t,`the Reviewer checks round ${Ai(e)}`,`审阅者检查第 ${Ai(e)} 轮`),`info`);case`round.review.deferred`:return Z(`engineer`,`role.engineer`,`↪`,X(t,`carries on into the next round without a review · ${q(Y(e,`next_step`),t.density===`full`?180:160)}`,`不经审阅直接进入下一轮 · ${q(Y(e,`next_step`),t.density===`full`?180:160)}`),`info`);case`round.main.completed`:return Z(`engineer`,`role.engineer`,`✅`,X(t,`finished round ${Ai(e)} of work`,`第 ${Ai(e)} 轮工作已完成`),`info`);case`round.review.completed`:{if(e.review_skipped===!0)return Z(`reviewer`,`role.reviewer`,`↪`,`${X(t,`no review this round`,`这一轮没有审阅`)} · ${q(Y(e,`reason`),t.density===`full`?200:160)}`,`info`);let n=Y(e,`status`),r=n===`done`?q(Y(e,`residual_risk`),200):``;if(r)return Z(`reviewer`,`role.reviewer`,`⚠`,`${X(t,`verified with residual risk`,`已验证,但有残余风险`)}: ${r} · ${q(Y(e,`reason`),t.density===`full`?200:160)}`,`warn`);let i=n===`done`?`ok`:n===`blocked`||n===`no_progress`?`err`:`warn`;return Z(`reviewer`,`role.reviewer`,n===`done`?`✅`:n===`blocked`||n===`no_progress`?`⛔`:`↻`,`${Li(n,t)} · ${q(Y(e,`reason`),t.density===`full`?200:160)}`,i)}case`life.mission.completed`:{let n=yi(J(e)),r=q(Y(e,`summary`),240),i=q(Y(e,`residual_risk`),200);return i&&n.tone===`ok`?Z(`engineer`,`role.engineer`,`⚠`,`${X(t,`completed with residual risk`,`已完成,但有残余风险`)} · ${r.includes(i)?r:`${i}${r?` · ${r}`:``}`}`,`warn`,{rule:!0}):Z(`engineer`,`role.engineer`,n.glyph,r?`${n.label} · ${r}`:n.label,n.tone,{rule:!0})}case`life.mission.failed`:return Z(`engineer`,`role.engineer`,`❌`,`${X(t,`this task failed`,`这项任务失败了`)} ${q(Y(e,`reason`)||Y(e,`error`),t.density===`full`?160:140)}`,`err`,{rule:!0});case`loop.start`:return Z(`engineer`,`role.engineer`,`▶`,q(Y(e,`text`)||Y(e,`objective`),t.density===`full`?16e3:160),`info`,{expandable:t.density===`full`});case`loop.done`:return Z(`engineer`,`role.engineer`,`🏁`,`${X(t,`the run finished`,`这次运行结束`)} ${q(Y(e,`text`),t.density===`full`?140:120)}`,`dim`);case`life.inbox.queued`:return Z(`system`,`role.operator`,`📥`,`${X(t,`you added guidance`,`你追加了指导`)} · ${q(Y(e,`text`),t.density===`full`?180:160)}`,`accent`);case`daemon.parked`:{let n=Y(e,`replaced_by`),r=X(t,`Argus set this project aside with its state saved`,`Argus 已把这个项目搁置,状态已保存`);return Z(`system`,`role.system`,`Ⅱ`,n?`${r} · ${X(t,`continued as ${n}`,`由 ${n} 接续`)}`:r,`warn`,{rule:!0})}case`accounting.journal_repaired`:{let n=J(e).damaged_lines,r=J(e).liabilities,i=Array.isArray(n)?n.length:0,a=Array.isArray(r)?r.length:0,o=q(Y(e,`damaged_copy`),120),s=`the usage journal was repaired: ${i} damaged line(s) set aside${o?` in ${o}`:``}, ${a} call(s) written back as a liability`,c=`用量账本已修复:${i} 行损坏记录已另存${o?`到 ${o}`:``},${a} 次调用按负债记回`;return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,X(t,s,c),`warn`,{rule:!0})}case`provider.request.denied`:{let n=Y(e,`provider`);return Z(`system`,`event.quota`,`⏸`,`${X(t,`a request to ${n||`the model service`} was held back`,`发往${n||`模型服务`}的一次请求被暂缓`)} · ${q(Y(e,`reason`),160)}`,`warn`,{rule:!0})}case`round.reviewer_backend_failure`:{let n=q(Y(e,`text`),150),r=t.density===`full`?X(t,`the Reviewer's model service is unreachable — waiting rather than going on unchecked`,`审阅者的模型服务连不上 — 先等待,不在无人审阅的情况下继续`):X(t,`the Reviewer's model service is unreachable — waiting`,`审阅者的模型服务连不上 — 先等待`);return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${r} · ${n}`,`err`,{rule:!0})}case`round.stall`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,q(Y(e,`text`)||X(t,t.density===`full`?`no progress this round — keeping a close eye on it`:`no progress this round`,`这一轮没有进展`),170),`warn`);case`round.escalated`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,q(Y(e,`text`)||X(t,`many rounds without a finish — raising what is blocking the work`,`轮次已经很多还没做完 — 把外部阻碍提出来`),170),`warn`);case`life.planner.stall_escalation`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,`${X(t,`the Planner is stuck`,`规划者卡住了`)} — ${q(Y(e,`reason`)||Y(e,`text`),150)}`,`warn`);case`life.budget.pause`:return Y(e,`stop_kind`)===`cost_unreconciled`||Y(e,`reason`).startsWith(`unresolved provider cost`)?Z(`system`,`event.budget`,`$`,X(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Z(`system`,`event.watch`,`⏸`,X(t,`budget cap reached — paused · ${q(Y(e,`text`)||Y(e,`reason`),140)}`,`已达到预算上限 — 已暂停 · ${q(Y(e,`text`)||Y(e,`reason`),140)}`),`warn`);case`budget.reservation.denied`:return Y(e,`reason`).startsWith(`unresolved provider cost`)?Z(`system`,`event.budget`,`$`,X(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`):Z(`system`,`event.budget`,`$`,`${X(t,`budget denied`,`预算申请被拒绝`)} — ${q(Y(e,`reason`)||Y(e,`text`),t.density===`full`?160:150)}`,`err`,{rule:!0});case`budget.unpriced.blocked`:return Z(`system`,`event.budget`,`$`,X(t,`Provider usage awaits reconciliation — not budget exhaustion`,`调用费用待对账 — 并非预算耗尽`),`warn`);case`budget.unpriced.acknowledged`:return Z(`system`,`event.budget`,`$`,X(t,`Single-call cost risk approved; original usage remains pending`,`已批准单笔费用风险;原始费用仍待对账`),`warn`);case`life.lifecycle.block`:return Z(`system`,`event.watch`,`⛔`,`${X(t,`blocked — needs you`,`卡住了 — 需要你来处理`)} · ${q(Y(e,`text`)||Y(e,`reason`),150)}`,`err`,{rule:!0});case`life.daemon.idle_timeout`:return Z(`system`,`event.watch`,`🟦`,q(Y(e,`text`)||X(t,`nothing to do for a while — standing by`,`一段时间没有事做 — 待命中`),150),`dim`);case`operator_alert`:return Z(`system`,`event.notice`,t.density===`full`?`👁`:`!`,q(Y(e,`text`)||Y(e,`reason`)||e.type,170),`err`,{rule:!0});case`life.supervisor.error`:return Z(`system`,`role.system`,`⚠`,`${X(t,`Argus hit an internal error while coordinating the work`,`Argus 在统筹工作时遇到内部错误`)} · ${q(Y(e,`error`),160)}`,`err`,{rule:!0});case`life.auth_failure`:return Z(`system`,`role.system`,`🔑`,X(t,`the model service rejected the sign-in — refresh the credentials and Argus will carry on`,`模型服务拒绝了登录 — 更新凭据后 Argus 会继续`),`err`,{rule:!0});case`life.planner.deferred`:return Z(`planner`,`role.planner`,`⌛`,`${X(t,`planning is on hold`,`规划暂缓`)} · ${q(Y(e,`reason`),180)}`,`dim`);case`life.post_mission.stop`:return Z(`system`,`role.system`,`■`,`${X(t,`stopped after this task`,`这项任务之后停下`)} · ${q(Y(e,`reason`),180)}`,`info`);case`life.planner.final_submission_skipped`:return Z(`planner`,`role.planner`,`⏭`,`${X(t,`dropped an outdated final-submission task`,`跳过了一项过时的最终提交任务`)} · ${q(Y(e,`title`),140)}`,`dim`);case`life.execution_host.blocked`:return Z(`system`,`event.watch`,`⛔`,q(Y(e,`reason`)||X(t,`the program that runs code for Argus could not be started`,`为 Argus 运行代码的程序无法启动`),t.density===`full`?260:180),`err`,{rule:!0});case`life.mission.provider_configuration_disabled`:{let n=Number(J(e).streak||0),r=X(t,`the model configuration failed ${wi(n,`time`)} in a row — this task is paused until you decide`,`模型配置连续 ${n} 次失败 — 这项任务已暂停,等待你的决定`),i=q(Y(e,`text`),160);return Z(`system`,`event.watch`,`⛔`,i?`${r} · ${i}`:r,`err`,{rule:!0})}case`life.iteration.continued`:return Z(`critic`,`role.critic`,`🔁`,X(t,`lined up the next iteration`,`排好了下一轮迭代`),`dim`);case`life.learned_vertical.promoted`:return Z(`manager`,`role.manager`,`★`,X(t,`made the learned domain "${Y(e,`vertical`)}" official`,`把新学到的领域「${Y(e,`vertical`)}」正式收录`),`accent`);case`life.learned_vertical.promotion_failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`could not record "${Y(e,`vertical`)}" as a formal domain`,`未能把「${Y(e,`vertical`)}」收录为正式领域`)} · ${q(Y(e,`error`),140)}`,`warn`);case`life.review.waived`:return Z(`planner`,`role.planner`,`↪`,`${X(t,`this task will skip the independent review`,`这项任务将不做独立审阅`)} · ${q(Y(e,`reason`),160)}`,`dim`);case`life.manager.feedback.exhausted`:{let n=Number(J(e).attempts||0);return Z(`manager`,`role.manager`,`⚠`,`${X(t,`the Manager's objection went unanswered ${wi(n,`time`)} — planning pauses for a while`,`管理者的异议 ${n} 次未被回应 — 规划暂停一段时间`)} · ${q(Y(e,`reason`),140)}`,`warn`)}case`life.manager.feedback.persisted`:{let n=Y(e,`stage`);return Z(`manager`,`role.manager`,`↩`,`${n?X(t,`sent the plan back for another pass at ${n}`,`把计划退回 ${n} 阶段再改一轮`):X(t,`sent the plan back for another pass`,`把计划退回再改一轮`)} · ${q(Y(e,`reason`),160)}`,`info`)}case`life.manager.goal_contract.failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`could not save the agreed goal`,`未能保存商定的目标`)} · ${q(Y(e,`error`),140)}`,`warn`);case`life.manager.intent.superseded`:return Z(`manager`,`role.manager`,`↷`,X(t,`a newer instruction replaced this request`,`更新的指令取代了这个请求`),`info`);case`life.manager.project_report.failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`could not deliver the project report`,`未能送出项目报告`)} · ${q(Y(e,`error`),140)}`,`warn`);case`life.planner.completion_circuit_opened`:{let n=Number(J(e).consecutive_rejections||0);return Z(`planner`,`role.planner`,`⏸`,X(t,`the same completion requirement turned the plan back ${wi(n,`time`)} — pausing completion attempts until something changes`,`同一项完成要求已 ${n} 次打回计划 — 暂停完成尝试,直到情况变化`),`warn`)}case`life.planner.completion_rejected`:return Z(`manager`,`role.manager`,`↩`,`${X(t,`the Manager did not accept the completion claim`,`管理者未接受完成的说法`)} · ${q(Y(e,`reason`),160)}`,`info`);case`life.planner.continuation_required`:return Z(`planner`,`role.planner`,`↻`,X(t,`finished one increment; the standing objective continues`,`完成了一个增量;长期目标继续推进`),`dim`);case`life.planner.superseded`:return Z(`planner`,`role.planner`,`↷`,X(t,`dropped an outdated planning pass after a newer instruction`,`收到更新的指令,放弃了过时的规划`),`dim`);case`life.planner.wait_overridden`:return Z(`planner`,`role.planner`,`+`,`${X(t,`scheduled independent work instead of waiting`,`不再干等,安排了独立的工作`)} · ${q(Y(e,`task_title`),140)}`,`info`);case`life.daemon.degraded`:return Z(`system`,`role.system`,`⚠`,`${X(t,`Argus started, but the objective did not reach the Manager`,`Argus 已启动,但目标没有交到管理者手上`)} · ${q(Y(e,`error`),140)}`,`warn`);case`round.orphan_process_group`:return Z(`engineer`,`role.engineer`,`⚠`,J(e).cleanup_succeeded===!0?X(t,`background processes outlived the turn and were cleaned up`,`有后台进程在这一轮结束后仍在运行,已清理`):X(t,`background processes outlived the turn and could not be cleaned up`,`有后台进程在这一轮结束后仍在运行,未能清理`),`warn`);case`round.model_configuration_error`:return Z(`engineer`,`role.engineer`,`⛔`,`${X(t,`the model configuration is not usable`,`模型配置无法使用`)} · ${q(Y(e,`text`)||Y(e,`error`),160)}`,`err`,{rule:!0});case`round.watchdog.retry`:{let n=Number(J(e).attempt||0),r=Number(J(e).max_attempts||0);return Z(`engineer`,`role.engineer`,`↻`,X(t,`the model call failed — retrying in a fresh session (attempt ${n} of ${r})`,`模型调用失败 — 在新会话中重试(第 ${n} 次,共 ${r} 次)`),`warn`)}case`round.watchdog.retry_exhausted`:{let n=Number(J(e).attempt||0),r=q(Y(e,`fatal_error`),140),i=X(t,`the model call kept failing — giving up after ${wi(n,`attempt`)}`,`模型调用持续失败 — ${n} 次后放弃`);return Z(`engineer`,`role.engineer`,`⛔`,r?`${i} · ${r}`:i,`err`,{rule:!0})}case`round.backend_failure.backoff`:{let n=Math.round(Number(J(e).seconds||0));return Z(`engineer`,`role.engineer`,`⏳`,q(Y(e,`text`)||X(t,`the model service failed — waiting ${n}s before trying again`,`模型服务出错 — 等待 ${n} 秒后再试`),200),`warn`)}case`round.backend_failure.hold_interrupted`:return Z(`engineer`,`role.engineer`,`↪`,q(Y(e,`text`)||X(t,`the wait after a model-service failure ended early`,`模型服务出错后的等待提前结束`),180),`info`);case`round.provider_turn_cap.restart`:return Z(`engineer`,`role.engineer`,`↻`,X(t,`reached the per-call turn allowance — continuing the same task in a fresh session`,`达到单次调用的轮次上限 — 在新会话中继续同一任务`),`info`);case`round.provider_turn_cap.reviewer_restart`:return Z(`reviewer`,`role.reviewer`,`↻`,X(t,`the review reached its turn allowance — restarting it in a fresh session`,`审阅达到轮次上限 — 在新会话中重新开始`),`info`);case`round.reviewer_backend_failure.backoff`:{let n=Math.round(Number(J(e).seconds||0));return Z(`reviewer`,`role.reviewer`,`⏳`,q(Y(e,`text`),200)||X(t,`the Reviewer's model service is unavailable — retrying in ${n}s`,`审阅者的模型服务不可用 — ${n} 秒后重试`),`warn`)}case`round.external_work_wait.started`:return Z(`engineer`,`role.engineer`,`⌛`,`${X(t,`waiting for background work to report`,`等待后台工作汇报`)} · ${q(Y(e,`work_id`),80)}`,`dim`);case`round.external_work_wait.completed`:return Z(`engineer`,`role.engineer`,`↻`,X(t,`background work reported — resuming`,`后台工作已汇报 — 继续`),`dim`);case`round.external_work_review.required`:return Z(`reviewer`,`role.reviewer`,`⌛`,`${X(t,`background work finished — an independent review of its result is required before resuming`,`后台工作已结束 — 恢复前需要对其结果做一次独立审阅`)} · ${q(Y(e,`work_id`),80)}`,`dim`);case`round.external_work_review.completed`:return Z(`reviewer`,`role.reviewer`,`✓`,`${X(t,`background work result reviewed`,`后台工作结果已审阅`)} · ${q(Y(e,`review_status`),40)}`,`dim`);case`plan.draft.failed`:return Z(`planner`,`role.planner`,`⚠`,`${X(t,`could not draft the plan`,`未能起草计划`)} · ${q(Y(e,`reason`),140)}`,`err`);case`plan.draft.done`:{let n=Number(J(e).steps||0);return Z(`planner`,`role.planner`,`📋`,X(t,`drafted a plan with ${wi(n,`step`)}`,`起草了一份 ${n} 步的计划`),`dim`)}case`team.learning.review.started`:return Z(`manager`,`role.manager`,`📚`,X(t,`reviewing what this task taught the team`,`整理这项任务给团队带来的经验`),`dim`);case`team.learning.review.failed`:return Z(`manager`,`role.manager`,`⚠`,`${X(t,`the team learning review failed`,`团队经验整理失败`)} · ${q(Y(e,`error`),140)}`,`warn`);case`team.learning.review.completed`:{let n=Number(J(e).created||0),r=Number(J(e).updated||0);return Z(`manager`,`role.manager`,`📚`,X(t,`kept ${n} new and ${r} updated team procedures`,`保留了 ${n} 条新的、${r} 条更新的团队做法`),`dim`)}case`team.learning.promotion.quarantined`:return Z(`manager`,`role.manager`,`⚠`,X(t,`set aside a new procedure that would have judged its own work`,`搁置了一条会评判自己工作的新做法`),`warn`);case`self.learning.review.failed`:return Z(`system`,`role.system`,`⚠`,`${X(t,`the review of Argus's own conversation habits failed`,`对 Argus 自身对话习惯的复盘失败`)} · ${q(Y(e,`error`),140)}`,`warn`);case`domain.promotion`:return Z(`manager`,`role.manager`,`★`,q(Y(e,`text`),180),`dim`);case`idea.portfolio.formed`:{let n=J(e).selection,r=n&&typeof n==`object`?String(n.route_id??``):``,i=Number(J(e).route_count||0),a=q(Y(e,`text`),180),o=i>0?X(t,`formed an idea portfolio of ${wi(i,`route`)}`,`组成了 ${i} 条思路的组合`):X(t,`formed an idea portfolio`,`组成了思路组合`);return Z(`engineer`,`role.engineer`,`💡`,r?X(t,`chose route ${r} from the idea portfolio`,`从思路组合中选定了路线 ${r}`):a||o,`accent`)}case`user.note`:{let n=Array.isArray(J(e).tags)?J(e).tags.map(String):[];if(n.includes(`config`))return Ei();if(n.includes(`planner`))return Z(`planner`,`role.planner`,`📝`,X(t,`updated the research plan`,`更新了研究计划`),`dim`);let r=q(Y(e,`summary`)||Y(e,`text`)||Y(e,`title`),180);return Z(`system`,`role.operator`,`📝`,`${X(t,`you added a note`,`你添加了一条笔记`)}${r?` · ${r}`:``}`,`accent`)}case`ui.operator`:{let t=Y(e,`text`);return t.trim()?Z(`system`,`role.operator`,`›`,t,`accent`,{rule:!0}):Ei()}case`ui.argus`:{let n=Y(e,`text`),r=J(e).live===!0||Array.isArray(J(e).steps)&&J(e).steps.length>0;return n.trim()||r?Z(`manager`,`role.argus`,`▌`,n,`bright`,{expandable:t.density===`full`,rule:!0}):Ei()}case`agent.io.start`:case`agent.io.stream`:case`agent.io.complete`:case`agent.io.error`:case`usage.recorded`:case`provider.request.started`:case`provider.request.completed`:case`codex.util.completed`:case`skill.cost.completed`:case`budget.reservation.created`:case`budget.reservation.settled`:case`budget.reservation.released`:case`round.checkpoint.recorded`:case`round.checkpoint.failed`:case`round.secret_redacted`:case`role.session.turn`:case`engineer.skill_maintenance.completed`:case`life.status`:case`life.mission.skipped`:case`life.mission.orphaned`:case`life.mission.requeued`:case`life.manager.plan_challenge.decided`:case`life.vertical.resolved`:case`life.manager.backend_resolved`:case`life.planner.backend_resolved`:case`life.planner.dependency_dropped`:case`life.planner.parallel_dropped`:case`life.engineer.backend_resolved`:case`life.reviewer.backend_resolved`:case`life.curator.backend_resolved`:case`life.runtime_failure.circuit_opened`:case`life.runtime_failure.circuit_blocked`:case`life.runtime_failure.canary_passed`:case`life.runtime.incident.detected`:case`life.runtime.incident.recovered`:case`life.runtime.incident.escalated`:case`life.plan.revision.proposed`:case`life.plan.revision.rejected`:case`life.plan.revision.committed`:case`life.plan.node.superseded`:case`life.lifecycle.transition`:case`life.inbox.drained`:case`life.operator_question.pending`:case`life.operator_question.answered`:case`project.completed`:case`project.completion_refused`:case`daemon.command.submitted`:case`daemon.command.completed`:case`daemon.command.rejected`:case`idea.search.started`:case`idea.search.completed`:case`idea.search.skipped`:case`venue.research.started`:case`venue.research.completed`:case`research.achievement.certified`:case`skill.library.available`:case`skill.created`:case`skill.updated`:case`skill.archived`:case`skill.tidied`:case`skill.history.compressed`:case`skill.evolution.completed`:case`wiki.initialized`:case`wiki.hook.warning`:case`wiki.created`:case`wiki.updated`:case`wiki.retired`:case`wiki.promotion.promoted`:case`wiki.promotion.demoted`:case`wiki.retired.compressed`:case`wiki.evolution.completed`:case`knowledge.learned`:case`knowledge.recalled`:case`life.planner.verdict.discarded`:case`life.manager.feedback.unresolved`:case`life.manager.project_report`:case`life.plan.revision.rolled_back`:case`life.planner.completion_circuit.notify_failed`:case`life.planner.completion_circuit_holding`:case`life.planner.external_poll_suppressed`:case`life.planner.waiting_contract.normalized`:case`life.daemon.ready`:case`plan.draft.start`:case`team.learning.review.skipped`:case`self.learning.review.started`:case`self.learning.review.completed`:case`manager.live_view.updated`:case`manager.live_view.rejected`:case`idea.portfolio.nested_skipped`:case`manager.turn.started`:case`manager.turn.cancelled`:case`life.config.parse_failed`:return Di(e,t);default:return Di(e,t)}}function Ni(e){return e.segments.map(e=>e.text).join(``)}var Pi={"role.manager":[`Manager`,`Manager`],"role.planner":[`Planner`,`Planner`],"role.engineer":[`Engineer`,`Engineer`],"role.reviewer":[`Reviewer`,`Reviewer`],"role.advisor":[`Advisor`,`顾问`],"role.peer":[`Project exchange`,`项目交流`],"role.critic":[`Critic`,`Critic`],"role.system":[`Argus`,`Argus`],"role.argus":[`Argus`,`Argus`],"role.operator":[`You`,`你`],"event.notice":[`Notice`,`通知`],"event.watch":[`Watch`,`监控`],"event.budget":[`Budget`,`预算`],"event.quota":[`Quota`,`额度`],"event.fallback":[`Argus`,`Argus`],"event.hidden":[``,``]};function Fi(e,t){let n=Pi[e];if(n)return t===`zh-CN`?n[1]:n[0];let r=e.startsWith(`role.`)?e.slice(5):e;return r?`${r.slice(0,1).toUpperCase()}${r.slice(1)}`:``}function Ii(e,t){let n=Mi(e,t);if(n.visibility===`hidden`)return null;let r=Ni(n);return!r&&!(e.type===`ui.argus`&&(e.live===!0||Array.isArray(e.steps)&&e.steps.length>0))?null:{role:n.role,labelKey:n.labelKey,label:Fi(n.labelKey,t.locale),glyph:n.glyph,text:r,tone:n.tone,rule:n.rule,reasoning:n.reasoning,expand:n.expandable,sensitive:n.sensitive}}function Li(e,t){let n={done:[`the Reviewer was satisfied`,`审阅者认可了这一轮`],blocked:[`the Reviewer found the work stuck`,`审阅者认为工作卡住了`],no_progress:[`the Reviewer saw no progress`,`审阅者没有看到进展`]};if(!e)return X(t,`the Reviewer gave no verdict`,`审阅者没有给出结论`);let r=n[e]??[`the Reviewer asked for another pass`,`审阅者要求再改一轮`];return X(t,r[0],r[1])}var Ri=[{match:/External interrupt|daemon (?:stop|shutdown)|stopped by its operator/i,bare:/^(?:Engineer interrupted because daemon shutdown|Argus was stopped by its operator|Reviewer backend returned no complete judgment \([^)]*External interrupt)/,kind:`interrupt`,zh:`运行被操作员停下,这一轮没有做完;这不是对工作本身的评价`,en:`Argus was stopped by its operator before this round could finish; this says nothing about the work itself`},{match:/no complete judgment|before reaching a judgment|reached a conclusion|did not reach a conclusion/i,bare:/^(?:Reviewer backend (?:returned no complete judgment|ended before reaching a judgment)|The Reviewer's session ended before it reached a conclusion|The review did not reach a conclusion)/,kind:`reviewer`,zh:`审阅者的会话在得出结论前就结束了,这一轮没有评审意见`,en:`The Reviewer's session ended before it reached a conclusion, so this round was not judged`},{bare:/^Engineer backend failed before a trustworthy completed turn/,kind:`reviewer`,zh:`模型服务在工程师做完之前断开了;Argus 会换一个新会话重试,审阅等到那时再做`,en:`The model service dropped the Engineer's session before it finished; Argus retries in a fresh session and the review waits until then`},{bare:/^Retry in a fresh (?:\w+ )?session/,zh:`Argus 会换一个新会话再试一次`,en:`Argus will try again in a fresh session`},{bare:/^Restart the daemon when ready/,zh:`重新启动后,Argus 会从项目留下的状态继续,选择下一项具体任务`,en:`Once Argus is started again it continues from the saved project state and picks the next concrete task`},{bare:/^engineer round \d+ \((?:fresh|rotated|resumed)[^)]*\)\s*$/i,kind:`round`,zh:`工程师开始了新的一轮工作`,en:`The Engineer began a new round of work`},{match:/provider[\s-]?turn/i,bare:/^(?:One Engineer call|\d+ Engineer sessions in a row each) used (?:its|their) whole per-call provider-turn allowance/,zh:`继续换了个新会话接着做,之前的进展都在`,en:`Continued in a fresh session; earlier progress is kept`},{match:/budget (limit|cap|exhausted)|blocking budget|预算上限/i,bare:/^Paused because this project reached its budget limit/,zh:`花费到了预算上限,先暂停;提高预算后可以继续`,en:`Paused at the budget limit; work resumes once the budget is raised`},{match:/quarantin/i,bare:/^The task signature is quarantined out of planner rotation/,zh:`这个方向连续失败,先搁置,不再自动重试`,en:`This direction kept failing and is set aside; it will not retry on its own`},{match:/backend[\s\S]{0,24}?(fail|unavailable|paused)|backend_failure|provider cooldown|configured model is unavailable/i,bare:/^(?:backend failure; retrying in a fresh|The backend has failed the same way \d+ times in a row)/,zh:`模型服务暂时不稳定,稍后会自动重试`,en:`The model service was briefly unavailable; it retries after a short wait`}],zi=/Runner receipt:|Technical record:|技术记录[::]/i,Bi=/^(?:Runner receipt|Technical record|技术记录)\s*[::]\s*/i;function Vi(e){let t=String(e||``).trim(),n=t.search(zi);return n<0?{prose:t,receipt:``}:{prose:t.slice(0,n).trim(),receipt:t.slice(n).trim()}}function Hi(e,t){let n=String(e||``).trim(),{receipt:r}=Vi(n),i=r?Ri.find(e=>e.match?.test(n)):Ri.find(e=>e.bare?.test(n));return i?{summary:t?i.zh:i.en,receipt:r||n,kind:i.kind}:{summary:``,receipt:r}}function Ui(e,t){return t===`zh-CN`?e[0]:e[1]}function Wi(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``)}var Gi={grounding_started:[`正在阅读这项请求,弄清楚它要做什么`,`Reading the request to understand what it asks`],goal_framed:[`已经理解这项请求,项目目标已经确定。`,`The request is understood and the project goal is set.`],goal_not_understood:[`这项请求还没有被理解清楚。`,`The request could not be understood yet.`],request_not_routed:[`这项请求没能被安排下去。`,`The request could not be routed to the team.`],stage_advanced:[`研究进入了下一阶段。`,`The research moved to the next stage.`],stage_entered:[`研究进入「{stage}」阶段。`,`The research moved to the {stage} stage.`],stage_held:[`当前阶段暂不推进。`,`The current stage is on hold.`],stage_rolled_back:[`研究退回到了前一阶段。`,`The research went back a stage.`],stage_completed:[`当前阶段已完成。`,`The current stage is complete.`],stage_reconsidered:[`阶段安排已重新考虑。`,`The stage plan was reconsidered.`],stage_reviewed:[`阶段已复核。`,`The stage was reviewed.`],planning_started:[`正在规划下一步工作`,`Planning the next step`],task_added:[`计划中加入了一项新任务。`,`A new task was added to the plan.`],research_route_added:[`计划中加入了一条新的研究路线。`,`A new research route was added to the plan.`],planning_complete:[`下一步的计划已经排好。`,`The next step is planned.`],project_finished:[`项目已经完成。`,`The project is finished.`],task_delivered:[`成果已交付。`,`The result was delivered.`],planner_waiting:[`规划者在等待前一步完成。`,`The Planner is waiting for the previous step.`],planner_idle:[`暂时没有需要规划的工作。`,`Nothing to plan right now.`],planning_failed:[`这次规划没有成功。`,`Planning did not succeed this time.`],mission_started:[`开始处理这项任务`,`Work on the task started`],awaiting_engineer:[`等待工程师完成这一轮。`,`Waiting for the Engineer to finish the round.`],waiting_external:[`等待外部工作完成。`,`Waiting on work outside Argus.`],mission_completed:[`任务已完成。`,`The task is complete.`],mission_continued:[`任务将继续进行。`,`The task continues.`],mission_certified:[`成果已通过独立核对。`,`The result passed an independent check.`],mission_incomplete:[`任务没有完成。`,`The task was not completed.`],mission_stalled:[`任务停滞不前。`,`The task stalled.`],mission_blocked:[`任务被挡住了。`,`The task is blocked.`],mission_failed:[`任务没能完成。`,`The task could not be completed.`],mission_paused:[`任务在完成前暂停;进度已保存,可以继续。`,`The task was paused before it finished; its progress is saved and it can be resumed.`],mission_ended:[`任务已结束。`,`The task ended.`],mission_ready:[`可以开始新任务。`,`Ready for a new task.`],round_in_progress:[`这一轮正在进行。`,`The round is in progress.`],round_running:[`第 {n} 轮正在进行。`,`Round {n} is in progress.`],round_started:[`第 {n} 轮工作开始。`,`Round {n} started.`],progress_tool:[`正在使用工具`,`Using a tool`],progress_command:[`正在运行命令`,`Running a command`],progress_message:[`正在汇报进展`,`Reporting progress`],progress_file:[`正在更新项目文件`,`Updating project files`],progress_inspecting:[`正在查看项目状态`,`Looking at the project state`],engineer_round_finished:[`工程师完成了这一轮,结果已准备好供核对。`,`The Engineer finished the round; the result is ready to be checked.`],checking_started:[`正在阅读工程师的结果并核对证据`,`Reading the Engineer's result and checking the evidence`],continuing_before_check:[`先继续下一轮,核对稍后进行。`,`Continuing to the next round; the check comes later.`],check_postponed:[`这一轮的核对推迟了。`,`The check of this round was postponed.`],round_not_judged:[`这一轮没有人审阅。`,`No one reviewed this round.`],results_accepted:[`结果通过了核对。`,`The result passed the check.`],another_attempt_requested:[`审阅者要求再试一次。`,`The reviewer asked for another attempt.`],attempt_blocked:[`这次尝试被挡住了。`,`This attempt is blocked.`],replan_requested:[`审阅者要求重新规划。`,`The reviewer asked for a new plan.`],results_not_final:[`结果还不是最终的。`,`The result is not final yet.`],handed_off:[`已交给下一位。`,`Handed off to the next role.`],waiting:[`等待中`,`Waiting`],live_activity:[`正在工作`,`Working`],role_failed:[`{role} 执行失败`,`{role} failed`],capability_unlocked:[`解锁了一项新能力。`,`A new capability was unlocked.`],capability_upgraded:[`一项能力得到了升级。`,`A capability was upgraded.`],capability_promoted:[`一项能力被提升为来源。`,`A capability was promoted to a source.`],knowledge_captured:[`记下了一条新知识。`,`New knowledge was captured.`],knowledge_refined:[`一条知识得到了完善。`,`A piece of knowledge was refined.`],knowledge_promoted:[`一条知识被提升。`,`A piece of knowledge was promoted.`],knowledge_demoted:[`一条知识被降级。`,`A piece of knowledge was demoted.`],knowledge_retired:[`一条知识已退役。`,`A piece of knowledge was retired.`],"event.model_call.started":[`开始调用模型`,`Model call started`],"event.model_call.completed":[`模型调用完成`,`Model call completed`],"event.model_call.failed":[`模型调用失败`,`Model call failed`],"event.usage.recorded":[`已记录用量`,`Usage recorded`],"event.budget.reserved":[`已预留预算`,`Budget reserved`],"event.budget.settled":[`预算已结算`,`Budget settled`],"event.model_turn":[`与模型完成一次往返`,`One exchange with the model`],"event.instruction.received":[`收到你的指令`,`Your instruction was received`],"event.instruction.done":[`指令已执行`,`Instruction carried out`],"event.inbox.processed":[`已处理收件箱`,`Inbox processed`],"event.round.started":[`新的一轮开始`,`A new round started`],"event.round.finished":[`执行者完成了这一轮`,`The Engineer finished the round`],"event.review.finished":[`这一轮的审阅结束`,`Review of the round finished`],"event.retry.waiting":[`等待后重试`,`Waiting before retrying`],"event.retry.interrupted":[`等待被打断`,`The wait was interrupted`],"event.status":[`状态更新`,`Status update`],"event.planning.started":[`开始规划`,`Planning started`],"event.planning.failed":[`规划没有完成`,`Planning did not complete`],"event.planning.tidied":[`计划已整理`,`Plan tidied`],"event.planning.decided":[`规划结论`,`Planning decision`],"event.task.started":[`开始执行任务`,`Task execution started`],"event.task.ended":[`任务执行结束`,`Task execution ended`],"event.skills.ready":[`技能库已就绪`,`Skill library ready`],"event.routes.formed":[`已形成候选路线组合`,`Candidate route portfolio formed`],"event.lessons.skipped":[`本次没有总结经验`,`No lessons recorded this time`],"event.argus.reply":[`Argus 的回复`,`Reply from Argus`]},Ki={daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],paused_daemon_shutdown:[`Argus 被暂停`,`Argus was paused`],operator_pause:[`你暂停了它`,`you paused it`],paused_operator:[`你暂停了它`,`you paused it`],operator_abort:[`你停止了它`,`you stopped it`],budget_exhausted:[`预算用完了`,`the budget ran out`],budget_pause:[`预算用完了`,`the budget ran out`],paused_budget:[`预算用完了`,`the budget ran out`],provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],paused_provider_cooldown:[`模型服务正在限流`,`the model service is cooling down`],provider_fence:[`模型服务不可用`,`the model service is unavailable`],paused_provider_fence:[`模型服务不可用`,`the model service is unavailable`],backend_unavailable:[`模型服务不可用`,`the model service is unavailable`],transient_error:[`出现了暂时性的问题`,`a temporary problem came up`],permanent_error:[`遇到了无法自动恢复的错误`,`an error could not be recovered from`],operator_input_required:[`需要你的回复`,`your reply is needed`],planner_empty_plan:[`需要一份新的计划`,`a new plan is needed`]},qi={pending:[`待开始`,`Waiting`],queued:[`待开始`,`Waiting`],not_started:[`待开始`,`Not started`],waiting:[`等待中`,`Waiting`],idle:[`空闲`,`Idle`],running:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],active:[`进行中`,`In progress`],working:[`进行中`,`In progress`],framed:[`已明确目标`,`Objective settled`],grounding:[`了解项目中`,`Getting oriented`],planned:[`已规划`,`Planned`],done:[`已完成`,`Done`],complete:[`已完成`,`Done`],completed:[`已完成`,`Done`],success:[`已完成`,`Done`],accepted:[`已完成`,`Done`],failed:[`失败`,`Failed`],error:[`出错`,`Failed`],blocked:[`受阻`,`Blocked`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],skipped:[`已跳过`,`Skipped`],ended:[`已结束`,`Ended`],incomplete:[`未完成`,`Not finished`],stalled:[`停滞`,`Stalled`],paused:[`已暂停`,`Paused`],stopped:[`已停止`,`Stopped`],cancelled:[`已停止`,`Stopped`],aborted:[`已停止`,`Stopped`],paused_external_work:[`等待外部工作完成`,`Waiting for external work`],superseded:[`已由新方案替代`,`Replaced by a newer plan`]},Ji={engineer_service_dropped:[`模型服务在工程师得出可核对的结果之前中断了会话,因此没有可以审阅的内容。Argus 会换一个新会话重试。`,`The model service dropped the session before the Engineer produced a checkable result, so there was nothing to review. Argus will retry in a fresh session.`],reviewer_unreachable:[`审阅者的会话在得出结论前就结束了,Argus 会再试一次。`,`The reviewer's session ended before it reached a conclusion; Argus will try again.`],argus_stopped:[`Argus 被停止了,任务随之暂停。`,`Argus was stopped, so the task paused.`],task_cancelled:[`这项任务被取消了。`,`The task was cancelled.`],session_length_limit:[`这一轮达到了单次会话的长度上限;已做的工作保留,会在新的会话里继续。`,`The round reached the length limit of one session; the work so far is kept and continues in a fresh session.`],tools_unavailable:[`执行环境里缺少需要的工具。`,`The tools the work needs are not available in the execution environment.`],model_unavailable:[`模型服务暂时不可用。`,`The model service is unavailable for now.`],sign_in_failed:[`模型服务的登录没有成功。`,`Signing in to the model service did not succeed.`],paused:[`任务被暂停了。`,`The task was paused.`],unknown:[`原因暂时不明。`,`The reason is not known yet.`],retry_wait_cut_short:[`在等待重试时 Argus 被要求停止。`,`Argus was asked to stop while waiting to retry.`]},Yi={idea:[`选题`,`Idea`],scope:[`研究定义`,`Scope`],research:[`文献与假设`,`Literature and hypotheses`],literature:[`文献与假设`,`Literature and hypotheses`],implementation:[`方法实现`,`Implementation`],implement:[`方法实现`,`Implementation`],experiment:[`实验验证`,`Experiments`],experiments:[`实验验证`,`Experiments`],analysis:[`结果分析`,`Analysis`],writing:[`论文写作`,`Writing`],review:[`最终审核`,`Final review`],delivery:[`成果交付`,`Delivery`],optimize:[`优化`,`Optimization`],solve:[`推导与验证`,`Derivation and verification`],hold:[`已暂停`,`Paused`],paused:[`已暂停`,`Paused`]},Xi={"provider.request.started":`event.model_call.started`,"provider.request.completed":`event.model_call.completed`,"provider.request.failed":`event.model_call.failed`,"agent.io.start":`event.model_call.started`,"agent.io.complete":`event.model_call.completed`,"usage.recorded":`event.usage.recorded`,"budget.reservation.created":`event.budget.reserved`,"budget.reservation.settled":`event.budget.settled`,"role.session.turn":`event.model_turn`,"daemon.command.submitted":`event.instruction.received`,"daemon.command.completed":`event.instruction.done`,"life.inbox.drained":`event.inbox.processed`,"round.start":`event.round.started`,"round.main.completed":`event.round.finished`,"round.review.completed":`event.review.finished`,"round.backend_failure.backoff":`event.retry.waiting`,"round.backend_failure.hold_interrupted":`event.retry.interrupted`,"life.status":`event.status`,"life.planner.start":`event.planning.started`,"life.planner.error":`event.planning.failed`,"life.planner.normalized":`event.planning.tidied`,"life.planner.verdict":`event.planning.decided`,"loop.start":`event.task.started`,"loop.done":`event.task.ended`,"skill.library.available":`event.skills.ready`,"idea.portfolio.formed":`event.routes.formed`,"team.learning.review.skipped":`event.lessons.skipped`,"ui.argus":`event.argus.reply`};function Zi(e,t){let n=String(e??``).trim(),r=Yi[n.toLowerCase()];return r?Ui(r,t):n}function Qi(e,t){let n=String(e??``).trim().toLowerCase(),r=Ki[n];return r?Ui(r,t):n}function $i(e,t,n){if(!t)return e;let r=Qi(t,n);return n===`zh-CN`?`${e.replace(/。$/,``)}(${r})。`:`${e.replace(/\.$/,``)} — ${r}.`}function ea(e,t,n){return t?n===`zh-CN`?`已完成 ${e} / ${t}`:`${e} of ${t} done`:Ui([`尚未规划`,`Not planned yet`],n)}var ta=[[/^Reporting progress$/i,`progress_message`],[/^(?:Running a command|running project command)$/i,`progress_command`],[/^Using a tool$/i,`progress_tool`],[/^inspecting project state$/i,`progress_inspecting`],[/^Working$/i,`live_activity`]],na=[...ta,[/^(?:Review not performed|No review this round)$/i,`round_not_judged`],[/^Goal framed$/i,`goal_framed`],[/^(?:Grounding project|Project grounding started)$/i,`grounding_started`],[/^Manager routing failed$/i,`request_not_routed`],[/^Stage reviewed$/i,`stage_reviewed`],[/^(?:Planning next work|Planning started)$/i,`planning_started`],[/^Planning complete$/i,`planning_complete`],[/^Planner waiting$/i,`planner_waiting`],[/^Project reviewed$/i,`project_finished`],[/^Research branch added$/i,`research_route_added`],[/^Task added$/i,`task_added`],[/^(?:Engineer handoff ready|Work ready for review)$/i,`engineer_round_finished`],[/^(?:Review started|Reviewing benchmark evidence)$/i,`checking_started`],[/^(?:Continuing before review|Continued before review)$/i,`continuing_before_check`],[/^Review deferred for one round$/i,`check_postponed`],[/^Waiting for the Engineer to finish$/i,`awaiting_engineer`],[/^Waiting on external work$/i,`waiting_external`],[/^(?:Evidence accepted|Accepted evidence)$/i,`results_accepted`],[/^(?:Attempt rejected|Requested another attempt)$/i,`another_attempt_requested`],[/^Handed off$/i,`handed_off`],[/^(?:Mission started|Starting mission)$/i,`mission_started`],[/^(?:Task completed|Mission complete)$/i,`mission_completed`],[/^Task failed$/i,`mission_failed`],[/^Awaiting Planner$/i,`planner_waiting`],[/^Ready for a new mission$/i,`mission_ready`],[/^Waiting$/i,`waiting`],[/^Capability unlocked$/i,`capability_unlocked`],[/^Capability upgraded$/i,`capability_upgraded`],[/^Capability promoted to source$/i,`capability_promoted`],[/^Knowledge captured$/i,`knowledge_captured`],[/^Knowledge refined$/i,`knowledge_refined`],[/^Knowledge promoted$/i,`knowledge_promoted`],[/^Knowledge demoted$/i,`knowledge_demoted`],[/^Knowledge retired$/i,`knowledge_retired`],[/^(?:request · started|io · start)$/i,`event.model_call.started`],[/^(?:request · completed|io · complete)$/i,`event.model_call.completed`],[/^usage · recorded$/i,`event.usage.recorded`],[/^reservation · created$/i,`event.budget.reserved`],[/^reservation · settled$/i,`event.budget.settled`],[/^Round (\d+) started$/i,(e,t)=>Wi(Ui(Gi.round_started,t),{n:e[1]})],[/^Running round (\d+)$/i,(e,t)=>Wi(Ui(Gi.round_running,t),{n:e[1]})],[/^Stage (?:·|→) (.+)$/i,(e,t)=>Wi(Ui(Gi.stage_entered,t),{stage:Zi(e[1],t)})],[/^Mission (ended|incomplete|stalled|blocked|failed)(?: · (\S+))?$/i,(e,t)=>$i(Ui(Gi[`mission_${e[1].toLowerCase()}`],t),e[2],t)],[/^(Manager|Planner|Engineer|Reviewer) failed$/i,(e,t)=>Wi(Ui(Gi.role_failed,t),{role:e[1]})],[/^(\d+) \/ (\d+) complete$/i,(e,t)=>ea(Number(e[1]),Number(e[2]),t)],[/^Not planned$/i,(e,t)=>ea(0,0,t)]];function ra(e){return e===`zh-CN`?`zh`:`en`}function ia(e,t,n){let r=String(e??``).trim(),i=typeof n==`string`?{kind:n}:n??{};if(!i.kind||i.kind===`live_activity`){for(let[e,n]of ta)if(e.test(r))return Ui(Gi[n],t)}let a=i.kind?Gi[i.kind]:void 0;if(i.kind){let e=!!i.language&&i.language!==ra(t);if(a&&(e||!r)&&!a[0].includes(`{`))return Ui(a,t);if(r&&!e)return r}for(let[e,n]of na){let i=r.match(e);if(i)return typeof n==`string`?Ui(Gi[n],t):n(i,t)}if(a){let e=Ui(a,t);if(!e.includes(`{`))return e;let n=r.match(/\d+/)?.[0];return n&&e.includes(`{n}`)?Wi(e,{n}):r}let o=qi[r.toLowerCase()];return o?Ui(o,t):r}function aa(e,t){let n=Ji[String(e??``).trim().toLowerCase()];return n?Ui(n,t):``}function oa(e,t){let n=String(e??``).trim().toLowerCase(),r=qi[n];return r?Ui(r,t):n}function sa(e,t){let n=Xi[String(e??``).trim()];return n?Ui(Gi[n],t):null}function ca(e){return/^(?:provider\.|agent\.io\.|usage\.|budget\.|role\.session\.turn$)/.test(String(e??``))}var la=[[/^Next action:\s*/i,[`下一步:`,`Next: `]],[/^(?:原因:|Reason:)\s*/i,[`原因:`,`Reason: `]],[/^The backend has failed the same way (\d+) times in a row \(([^)]*)\)\. Waiting ([\d.]+)s before the next attempt[^\n]*/i,(e,t)=>({text:t===`zh-CN`?`模型服务已连续 ${e[1]} 次以同样的方式失败;为了不让持续的故障白白花钱,${e[3]} 秒后再试。`:`The model service has failed the same way ${e[1]} times in a row; waiting ${e[3]} seconds before trying again so a standing failure does not keep costing money.`,technical:e[2]})],[/^review: \w+(?: \([^)]*\))? — /i,[``,``]],[/^status=(\S+) rounds=(\d+) reason=/i,(e,t)=>{let n=Ki[e[1].toLowerCase()],r=n?Ui(n,t):oa(e[1],t);return t===`zh-CN`?`任务已结束(${r}),共 ${e[2]} 轮。`:`Task ended — ${r}, after ${e[2]} rounds.`}],[/^engineer round (\d+) \((?:fresh session|new session)\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮,在新的会话里开始。`:`Round ${e[1]}, started in a fresh session.`],[/^engineer round (\d+) \([^)]*\)\.?$/i,(e,t)=>t===`zh-CN`?`第 ${e[1]} 轮开始。`:`Round ${e[1]} started.`],[/^backend failure; retrying in a fresh \w+ session after ([\d.]+)s\.?$/i,(e,t)=>t===`zh-CN`?`模型服务调用失败,${e[1]} 秒后在新的会话里重试。`:`The model service call failed; retrying in a fresh session after ${e[1]} seconds.`],[/^planner error: (.*; retry later)\.?$/i,(e,t)=>({text:t===`zh-CN`?`规划这一步没有完成,稍后会重试。`:`Planning did not complete; it will be retried later.`,technical:e[1]})],[/^mission failed\.?$/i,[`任务失败了。`,`The task failed.`]],[/^Engineer backend failed before a trustworthy completed turn; reviewer skipped\.?/i,[`这一轮模型服务没有完成调用,所以没有人审阅。`,`The model service did not complete this round, so no one reviewed it.`]],[/^Reviewer backend unavailable for (\d+) consecutive attempt\(s\); failing loud rather than settling the round without a real review\.?/i,(e,t)=>t===`zh-CN`?`审阅者的模型服务连续 ${e[1]} 次没有响应,这一轮因此没有得到审阅。`:`The reviewer's model service did not respond ${e[1]} times in a row, so this round was not reviewed.`],[/^The Reviewer's session ended before it reached a conclusion, so this round was not judged\.?/i,[`审阅者在得出结论前就中断了,这一轮没有被评判。`,`The reviewer stopped before reaching a conclusion, so this round was not judged.`]],[/^The wait after a repeated backend failure ended early: daemon stop requested\.?/i,[`在等待重试时 Argus 被要求停止,任务随之暂停。`,`Argus was asked to stop while waiting to retry, so the task paused.`]],[/^Backend call paused before a trustworthy completed turn \(stop_kind=(\w+)\); reviewer skipped\.?/i,(e,t)=>t===`zh-CN`?`这一轮在得出可信结果前被暂停(${Qi(e[1],t)}),所以没有人审阅。`:`This round was paused before it produced a trustworthy result (${Qi(e[1],t)}), so no one reviewed it.`],[/^One Engineer call used its whole per-call provider-turn allowance \([^)]*\); reviewer skipped\. The work so far is kept and the task continues in a fresh session from the checkpoint\.?/i,[`这一轮用完了单次调用的额度;已做的工作保留,会在新的会话里接着做,本轮没有审阅。`,`This round used up its per-call allowance; the work so far is kept and continues in a fresh session. No review this round.`]],[/^Execution host is unavailable; reviewer skipped\.?/i,[`执行环境暂时不可用,这一轮没有审阅。`,`The execution environment is unavailable, so this round was not reviewed.`]],[/^Copilot CLI exited with code \d+\.?/i,[`模型服务的调用没有完成。`,`The model service call did not complete.`]],[/^Grounded bounded plan completed with (\d+) step\(s\)\.?/i,(e,t)=>t===`zh-CN`?`规划完成,共 ${e[1]} 步。`:`Planning finished with ${e[1]} steps.`],[/^Retry in a fresh \w+ session; do not resume the failed thread\.(?:\s*If this repeats, pause the daemon and reduce concurrent \w+ load\.)?/i,[`接下来会在新的会话里重试这一轮。`,`The round will be retried in a fresh session.`]],[/^Restart the daemon to resume this mission from its checkpoint\.?/i,[`重新运行 Argus 即可从保存的进度继续。`,`Run Argus again to continue from the saved progress.`]],[/^Resume this mission when the operator is ready\.?/i,[`准备好后即可恢复这项任务。`,`Resume the task whenever you are ready.`]],[/^Resume from the persisted checkpoint after the blocking budget or provider condition has been cleared\.?/i,[`预算或模型服务恢复后,即可从保存的进度继续。`,`Once the budget or model service is back, the task continues from the saved progress.`]],[/^inspecting project state$/i,[`正在查看项目状态`,`Looking at the project state`]],[/^running project command$/i,[`正在运行项目命令`,`Running a project command`]],[/^using a tool$/i,[`正在使用工具`,`Using a tool`]]],ua=/^(?:[\w.]+_(?:streak|code|error|kind)=|error=|exit=|fatal_error=|Runner receipt:|stop_kind=|backend_)/i;function da(e,t){let n=e.trim(),r=[],i=[],a=!1;for(;n;){let e=!1;for(let[o,s]of la){let c=n.match(o);if(!c)continue;let l=typeof s==`function`?s(c,t):Ui(s,t);typeof l==`string`?r.push(l):(r.push(l.text),l.technical&&i.push(l.technical)),n=n.slice(c[0].length).replace(/^[\s;,]+/,``),e=!0,a=!0;break}e||(a&&ua.test(n)?i.push(n):r.push(n),n=``)}let o=t===`zh-CN`?``:` `;return{text:r.filter(Boolean).join(o).replace(/:\s+/g,`:`),technical:i.join(` `)}}function fa(e,t,n){let r=String(e??``).trim();if(n){let e=n.language&&n.language!==ra(t)?aa(n.cause,t):``;if(e)return{text:e,technical:String(n.technical??``)};if(n.technical)return{text:r,technical:String(n.technical)}}if(!r)return{text:``,technical:``};let i=r.split(/(\n[ \t]*\n|\n)/),a=[],o=[];return i.forEach((e,n)=>{if(n%2==1){a.push(e.includes(` + +`)||/\n[ \t]*\n/.test(e)?` + +`:` +`);return}let r=da(e,t);a.push(r.text),r.technical&&o.push(r.technical)}),{text:a.join(``).replace(/\n{3,}/g,` + +`).trim(),technical:o.join(` `)}}function pa(e,t){let n=e.split(/(\r?\n)/),r=n.findIndex((e,t)=>t%2==0&&e.trim()!==``),i=n[r]?.trim()??``,a=i.match(/^(?:Task continued|任务已继续)(?: · (.+))?$/),o=i.match(/^Could not complete (.+)\.$/)??i.match(/^未能完成:(.+)。$/);if(!a&&!o)return null;let s=t===`zh-CN`,c=[],l=``,u=!1;return{text:n.map((e,n)=>{if(n%2==1)return e;if(n===r){if(a){let e=a[1]??``,n=e.match(/^(.*?) · review=(\S+)$/),r=n?n[1]:e;return[s?`当时记录:工作继续推进。`:`Recorded then: work continued.`,r?`${s?`任务:`:`Task: `}${r}`:``,n?`${s?`当时记录的审阅状态:`:`Review status recorded then: `}${oa(n[2],t)}`:``].filter(Boolean).join(` +`)}let e=o[1];return/^(?:the current task|当前任务)$/.test(e)?s?`当时这项任务未能完成。`:`This task had not completed at that time.`:s?`当时未能完成:${e}。`:`Not completed at that time: ${e}.`}if(/^(?:Progress|Mission summary|本次进展|本次完成)[::]/.test(e)&&(u=!0),u)return e;let i=e.match(/^\s*(`{3,}|~{3,})/);if(i)return l?l===i[1][0]&&(l=``):l=i[1][0],e;if(l)return e;if(/^(?:Nothing is queued yet; the Planner is deciding what comes next\.|计划里暂时没有下一项,Planner 正在决定接下来做什么。)$/.test(e))return s?`当时尚未排入下一项任务,规划者还在决定接下来做什么。`:`At that time, nothing was queued and the Planner was still deciding what to do next.`;let d=e.match(/^(?:Next(?: action| up)?|下一步|接下来做)[::]\s*(.*)$/);if(d){let e=/^(?:Argus will diagnose the failure and choose a safe next step\.|Argus 会诊断原因并选择可恢复的方案。)$/.test(d[1])?s?`诊断当时的原因,再选择可恢复的方案。`:`Diagnose the cause and choose a recovery approach.`:d[1];return`${s?`当时记录的下一步:`:`Next step recorded at the time: `}${e}`}let f=e.match(/^(?:Reason:|原因:)\s*(.*)$/);if(f){let e=Vi(f[1]);if(e.prose===`Argus was stopped by its operator in the middle of this round; the Engineer's work so far is kept and nothing was retried.`){let t=Hi(f[1],s);return e.receipt&&c.push(e.receipt),s?`当时${t.summary}。已做的工作保留,当时没有重试。`:`At that time, ${t.summary}. Work done so far was kept, and no retry was made then.`}let n=fa(f[1],t);if(n.text!==f[1].trim()||n.technical)return n.technical&&c.push(n.technical),`${s?`当时记录的原因:`:`Reason recorded at the time: `}${n.text}`}return Bi.test(e.trim())?(c.push(e),``):e}).join(``),technical:c.join(` +`)}}var ma=3,ha=`engineer.progress`,ga=new Set([`tool_use`,`command_execution`,`file_change`]),_a=[`assistant_message`,`agent_message`,`message`],va=e=>e,Q=(e,t)=>String(va(e)[t]??``),ya=e=>Q(e,`type`)===ha?Q(e,`kind`):``;function ba(e,{locale:t,showReasoning:n,filter:r=`all`,query:i=``}){let a=[],o=new Map,s=0,c={locale:t,showReasoning:n,unknownEventPolicy:`hide`,density:`compact`};return e.forEach(e=>{let t=Ii(e,c);if(!t){!n&&Ee(e)&&s++;return}if(!De(e,t,r,i))return;let l=Q(e,`message_id`),u=!!l&&Q(e,`type`)===ha&&_a.includes(Q(e,`kind`));if(u&&o.has(l)){let n=o.get(l);a[n]={...a[n],ev:{...a[n].ev,...e},r:{...a[n].r,...t,text:O(a[n].r.text,t.text,oe(e))}};return}let d={ev:e,r:t,key:we(e)};u&&o.set(l,a.length),a.push(d)}),{list:a,hiddenReasoning:s}}function xa(e){let t=Q(e,`tool_name`)||Q(e,`tool`)||Q(e,`name`);if(t)return t;let n=Q(e,`text`).match(/^([A-Za-z_][\w.-]{0,40}):\s/);return n?n[1]:``}function Sa(e){let t=Q(e,`status`).toLowerCase();if(t===`running`||t===`started`||t===`in_progress`||t===`pending`)return`running`;if(t===`failed`||t===`error`||t===`errored`)return`failed`;let n=va(e).exit_code;return typeof n==`number`&&n!==0?`failed`:[`completed`,`complete`,`success`,`succeeded`,`done`,`ok`,`finished`].includes(t)?`completed`:``}function Ca(e,t){let n=Q(t,`call_id`),r=Q(e.ev,`call_id`);return n&&r?n===r:ya(e.ev)===ya(t)&&xa(e.ev)===xa(t)&&Q(e.ev,`text`)===Q(t,`text`)}var wa=(e,t)=>({kind:`step`,key:e.key,ev:e.ev,r:e.r,latest:e.ev,repeat:1,status:t});function Ta(e){let t=[],n=[],r=(e,t,r,i)=>{let[a]=n.splice(e,1);a.status=r,a.latest=t,i&&(a.result=i)};for(let i of e){let e=ya(i.ev);if(ga.has(e)){let e=Sa(i.ev);if(e!==`running`){let t=n.length-1;for(;t>=0&&!Ca(n[t],i.ev);)--t;if(t>=0){r(t,i.ev,e||`completed`);continue}}let a=wa(i,e);t.push(a),e===`running`&&n.push(a);continue}if(e===`tool_result`){let e=Q(i.ev,`call_id`),t=xa(i.ev),a=e?n.findIndex(t=>Q(t.ev,`call_id`)===e):n.findIndex(e=>!t||xa(e.ev)===t);if(a>=0){r(a,i.ev,Sa(i.ev)||`completed`,i);continue}}t.push(wa(i,``))}return t}var Ea=/fail|error|backoff|stall|denied|blocked|nudge|escalat/i,Da=/\b(?:fail(?:ed|ure)?|error|unavailable|unreachable|exited with code|backoff|retry(?:ing)?|stuck|skipped)\b/i;function Oa(e){if(ya(e.ev))return!1;let t=e.ev;return e.r.tone===`err`||e.r.tone===`warn`||Ea.test(Q(t,`type`))||va(t).backend_unavailable===!0||va(t).review_skipped===!0||Da.test(e.r.text)}var ka=e=>e.toLowerCase().replace(/\d+(?:\.\d+)?/g,`#`).replace(/\s+/g,` `).trim();function Aa(e){let t=e.ev;return ka(Q(t,`signature`)||Q(t,`cause`)||Q(t,`backend_error`)||Q(t,`error`)||Q(t,`reason`)||Q(t,`stop_kind`)||e.r.text)}function ja(e,t){return Oa(e)?`fail|${e.r.role}|${Q(e.ev,`type`)}|${Aa(e)}`:`text|${e.r.role}|${e.r.glyph}|${fa(e.r.text,t).text}`}function Ma(e,t){e.repeat+=t.repeat,e.latest=t.latest,e.r=t.r,t.status&&(e.status=t.status),t.result&&(e.result=t.result)}function Na(e,t){let n=[],r=[];for(let i of e){let e=ja(i,t),a=n[n.length-1];if(a&&r[r.length-1]===e){Ma(a,i);continue}n.push({...i}),r.push(e)}let i=r.map((e,t)=>ya(n[t].ev)?e:ka(e)),a=(e,t)=>{if(e+2*t>n.length)return!1;for(let n=0;ne.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,Ra=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,za=e=>Ra(e.replace(/^[a-z]+:\/\/(?:www\.)?/i,``).replace(/#.*$/,``).replace(/\/$/,``),48),Ba=/\*\*\* (?:Add|Update|Delete|Move to) File:\s*(\S+)/;function Va(e,t,n){for(let r of n){if(e){let t=e[r];if(typeof t==`string`&&t.trim())return t.trim();if(Array.isArray(t)&&typeof t[0]==`string`&&t[0].trim())return t[0].trim();continue}let n=t.match(RegExp(`"${r}":\\s*"((?:[^"\\\\]|\\\\.)*)"`));if(n&&n[1])return n[1].replace(/\\(.)/g,`$1`)}return``}function Ha(e){return Ua(e.ev)}function Ua(e){let t=Q(e,`text`);if(ya(e)===`file_change`){let e=t.match(Ba);if(e)return La(e[1].trim());let n=t.match(/^(\S+\.[A-Za-z0-9]{1,8})\b/);return n?La(n[1]):``}let n=t.replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),r=null;if(n.startsWith(`{`))try{let e=JSON.parse(n);r=e&&typeof e==`object`&&!Array.isArray(e)?e:null}catch{r=null}let i=Va(r,n,[`path`,`file_path`,`filePath`,`file`,`filename`,`target_file`,`notebook_path`,`paths`]);if(i&&!/^\.\/?$/.test(i))return La(i);let a=Va(r,n,[`url`,`uri`]);if(a)return za(a);let o=Va(r,n,[`pattern`,`query`,`regex`,`glob`,`q`]);if(o)return Ra(o,32);let s=n.match(Ba);return s?La(s[1].trim()):``}function Wa(e,t){let n=t===`zh-CN`,r=e.trim().replace(/\\/g,`/`).split(`/`).filter(e=>e&&e!==`**`&&e!==`.`),i=r[r.length-1]??`*`,a=r.slice(0,-1).filter(e=>!/[*?]/.test(e)),o;o=i===`*`||i===`*.*`?n?`所有文件`:`all files`:/^\*\.[\w.]+$/.test(i)?n?`${i.slice(1)} 文件`:`${i.slice(1)} files`:Ra(i,40);let s=a[a.length-1];return s?n?`${s} 里的 ${o}`:`${o} in ${s}`:o}var Ga=/^(glob|find|find_?files|list_?files|file_?search)$/i;function Ka(e,t){let n=t===`zh-CN`,r=xa(e),i=Fa(r,ya(e)),a=Ua(e);if(i===`search`){let t=Va(null,Q(e,`text`).replace(/^[A-Za-z_][\w.-]{0,40}:\s*/,``),[`pattern`,`query`,`regex`,`glob`,`q`]);t&&(a=Ra(t,48))}if(i===`search`&&Ga.test(r)&&a)return`${n?`查找`:`Find`} ${Wa(a,t)}`;let o=a.startsWith(`/`)?La(a):a,[s,c,l,u]={read:[`查阅`,`查阅文件`,`Read`,`Read a file`],search:[`搜索:`,`搜索`,`Search:`,`Search`],fetch:[`读取`,`读取网页`,`Open`,`Open a page`],edit:[`修改`,`修改文件`,`Edit`,`Edit a file`],tool:[`调用`,`调用工具`,`Use`,`Use a tool`]}[i],d=i===`tool`?r:o;if(!d)return n?c:u;let f=n?s:l;return f.endsWith(`:`)?`${f}${d}`:`${f} ${d}`}function qa(e,t){let n=ya(e);return n===`command_execution`?{title:t===`zh-CN`?`正在运行命令`:`Running a command`,detail:``}:[`tool_use`,`file_change`].includes(n)?{title:{read:[`查看资料`,`Reading material`],search:[`查找相关信息`,`Searching for relevant information`],fetch:[`读取资料页面`,`Reading a source page`],edit:[`更新项目文件`,`Updating project files`],tool:[`执行一个工作步骤`,`Carrying out a work step`]}[Fa(xa(e),n)][t===`zh-CN`?0:1],detail:Ua(e)}:null}function Ja(e){let t=e[0],n=e[e.length-1],r=xa(t.ev)||(ya(t.ev)===`file_change`?`file`:`tool`),i=Fa(r,ya(t.ev)),a=[],o=0;for(let t of e){let e=Ha(t);e&&(o+=1,a.includes(e)||a.push(e))}let s=e.reduce((e,t)=>e+t.repeat,0),c=i===`read`||i===`edit`||i===`fetch`;return{kind:`group`,key:`group:${t.key}`,r:{...t.r,text:``},latest:n.latest,tool:r,action:i,steps:e,targets:a,count:c&&o===e.length?a.length:s,calls:s,failed:e.filter(e=>e.status===`failed`).length}}function Ya(e){let t=[],n=[],r=null,i=()=>{n.length>=3?t.push(Ja(n)):t.push(...n),n=[],r=null};for(let a of e){let e=Ia(a);if(e&&(r===null||r===e)){n.push(a),r=e;continue}i(),e?(n.push(a),r=e):t.push(a)}return i(),t}function Xa(e,t){return Ya(Na(Ta(e),t))}function Za(e,t,n){let r=t(`stream.fold.${e.action}`,{count:e.count,tool:e.tool}),i=e.targets.slice(0,ma);return`${r}${i.length?`${n===`zh-CN`?`:`:`: `}${i.join(n===`zh-CN`?`、`:`, `)}${e.targets.length>i.length?`…`:``}`:``}${e.failed?` · ${t(`stream.fold.failed`,{count:e.failed})}`:``}`}function Qa(e,t,n){return e.kind===`group`?Za(e,t,n):fa(e.r.text,n).text}var $a=new Set([`tool_use`,`command_execution`,`file_change`]),eo=new Set([`completed`,`failed`,`cancelled`,`canceled`,`error`,`done`,`stopped`]),to=()=>Date.now()/1e3;function no(e){return e.trim().replace(/[.…]+$/u,``).toLowerCase()}function ro(e,t,n=to()){let r=(t.label??``).trim();if(!r)return e;let i=t.heartbeat===!0,a=e.slice(),o=(t.callId??``).trim(),s=(t.status??``).trim().toLowerCase(),c=(t.kind??``).trim();if(o){let e=-1;for(let t=a.length-1;t>=0;--t)if(a[t].callId===o){e=t;break}if(e>=0){let i=a[e];return a[e]={...i,label:c===`tool_result`?i.label:r,detail:(t.detail||``).trim()||i.detail,tool:(t.tool||``).trim()||i.tool,output:(t.output||``).trim()||i.output,status:s||i.status,endedTs:eo.has(s)?n:i.endedTs},a}if(c===`tool_result`)return a}let l=a[a.length-1];if(c===`tool_result`)return!l||l.endedTs||l.heartbeat||(a[a.length-1]={...l,output:(t.output||``).trim()||l.output,status:s||`completed`,endedTs:n}),a;if(l&&!l.endedTs){if(no(l.label)===no(r)||i&&l.heartbeat)return a[a.length-1]={...l,label:r,detail:t.detail||l.detail,kind:t.kind||l.kind,heartbeat:i,endedTs:0},a;l.callId||(a[a.length-1]={...l,endedTs:n})}return a.push({id:`${a.length}:${r}:${n}`,role:(t.role||`manager`).trim()||`manager`,label:r,detail:(t.detail||``).trim(),kind:c,startedTs:n,endedTs:0,heartbeat:i,...t.tool?.trim()?{tool:t.tool.trim()}:{},...t.toolKind?.trim()?{toolKind:t.toolKind.trim()}:{},...o?{callId:o}:{},...s||o?{status:s||`running`}:{},...t.output?.trim()?{output:t.output.trim()}:{}}),a}function io(e,t=to()){return e.length===0?[]:e.map(e=>e.endedTs?e:{...e,endedTs:t})}function ao(e){if(!Number.isFinite(e)||e<1)return``;if(e<60)return`${Math.floor(e)}s`;let t=Math.floor(e/60),n=Math.floor(e%60);return n?`${t}m${n}s`:`${t}m`}function oo(e,t=to(),n=!1){return e.filter(e=>!e.heartbeat&&$a.has(e.kind)).map(e=>{let r=!e.endedTs&&(!e.status||e.status===`running`)?n?`completed`:`running`:e.status||`completed`;return{kind:e.kind,label:e.label,...e.detail?{detail:e.detail}:{},...e.tool?{tool:e.tool}:{},...e.toolKind?{tool_kind:e.toolKind}:{},...e.callId?{call_id:e.callId}:{},status:r,started_ts:e.startedTs,ended_ts:e.endedTs||(n?t:0),...e.output?{output:e.output}:{}}})}var so=e=>typeof e==`string`?e.trim():``,co=e=>typeof e==`number`&&Number.isFinite(e)?e:0;function lo(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(e=>{if(!e||typeof e!=`object`)return;let n=e,r=so(n.label);r&&t.push({kind:so(n.kind)||`tool_use`,label:r,...so(n.detail)?{detail:so(n.detail)}:{},...so(n.tool)?{tool:so(n.tool)}:{},...so(n.tool_kind)?{tool_kind:so(n.tool_kind)}:{},...so(n.call_id)?{call_id:so(n.call_id)}:{},status:so(n.status).toLowerCase()||`completed`,started_ts:co(n.started_ts),ended_ts:co(n.ended_ts),...so(n.output)?{output:so(n.output)}:{}})}),t}function uo(e,t=to()){if(!e.length)return 0;let n=Math.min(...e.map(e=>e.started_ts||t)),r=Math.max(...e.map(e=>e.ended_ts||t));return Math.max(0,r-n)}var fo={command_execution:Xe,tool_use:$t,file_change:zt},po=new Set([`failed`,`error`]),mo=new Set([`cancelled`,`canceled`,`stopped`]),ho=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,go=/^⚙\s*([\w.-]+)\s*·\s*(.*)$/su;function _o(e,t=`zh-CN`){let n=(e.tool??``).trim(),r=(e.detail??``).trim(),i=e.label.match(go);if(i){let e=i[1],a=r||i[2];return{primary:Ka({type:`engineer.progress`,kind:`tool_use`,tool_name:n||e,text:`${e}: ${a}`},t),secondary:a}}let a=e.label.replace(ho,``).trim();return{primary:a||n,secondary:r&&r!==a?r:``}}function vo({steps:e,live:t,startedTs:n,status:r=``}){let{t:i,locale:a}=I(),[o,s]=(0,U.useState)(!1),[,c]=(0,U.useState)(0);if((0,U.useEffect)(()=>{if(!t)return;let e=setInterval(()=>c(e=>e+1),1e3);return()=>clearInterval(e)},[t]),(0,U.useEffect)(()=>{t||s(!1)},[t]),!e.length&&!t)return null;let l=Date.now()/1e3,u=po.has(r)||e.some(e=>po.has(e.status)),d=mo.has(r)||e.some(e=>mo.has(e.status)),f=ao(t&&n?Math.max(0,l-n):uo(e,l))||`<1s`,p=[...e].reverse().find(e=>e.status===`running`),m=t?`${p?_o(p,a).primary:a===`zh-CN`?`正在准备回复`:`Preparing a reply`} · ${f}`:u?`${a===`zh-CN`?`过程出现问题,请查看详情`:`An issue occurred; see details`} · ${f}`:d?`${a===`zh-CN`?`已停止`:`Stopped`} · ${f}`:i(`chat.stepsDone`,{count:e.length,seconds:f});return(0,K.jsxs)(`div`,{className:`turn-steps mt-3 rounded-lg border border-line/50 bg-surface/50 text-xs`,"data-live":t||void 0,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,"aria-label":a===`zh-CN`?`查看工作过程`:`View work progress`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-ink-dim hover:text-ink`,children:[(0,K.jsx)(t?W:u?Pt:d?Yt:Ne,{size:14,"aria-hidden":`true`,className:`shrink-0 ${t?`animate-spin text-manager motion-reduce:animate-none`:u?`text-err`:d?`text-ink-faint`:`text-ok`}`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:m}),(0,K.jsx)(o?Me:Mt,{size:14,"aria-hidden":`true`,className:`shrink-0 text-ink-faint`})]}),o?(0,K.jsxs)(`ol`,{className:`space-y-1 border-t border-line/40 px-3 py-2`,children:[!e.length&&(0,K.jsx)(`li`,{className:`text-ink-faint`,children:a===`zh-CN`?`尚未记录工具操作。`:`No tool operations recorded yet.`}),e.map((e,n)=>{let{primary:r,secondary:o}=_o(e,a),s=e.status===`running`,c=po.has(e.status),u=mo.has(e.status),d=e.kind===`command_execution`?fo.command_execution:e.kind===`file_change`?fo.file_change:fo.tool_use,f=ao(Math.max(0,(e.ended_ts||l)-e.started_ts));return(0,K.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,K.jsx)(d,{size:13,"aria-hidden":`true`,className:`shrink-0 self-start mt-0.5 ${c?`text-err`:`text-ink-faint`}`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`${s&&t?`text-ink`:c?`text-err`:`text-ink-dim`}`,title:o||r,children:r}),o?(0,K.jsxs)(`details`,{className:`turn-step-raw inline`,children:[(0,K.jsx)(`summary`,{className:`ml-2 inline cursor-pointer list-none text-[11px] text-ink-faint hover:text-ink-dim`,children:i(`chat.stepRaw`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block break-all font-mono text-[11px] text-ink-faint`,children:o})]}):null,c&&e.output?(0,K.jsx)(`span`,{className:`mt-0.5 block font-mono text-[11px] text-err/80`,children:e.output}):null]}),(0,K.jsx)(`span`,{className:`shrink-0 font-mono tabular-nums ${s&&t?`text-manager`:`text-ink-faint`}`,children:s&&t?(0,K.jsx)(W,{size:12,className:`animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):c?i(`chat.stepFailed`):u?a===`zh-CN`?`已停止`:`Stopped`:f})]},e.call_id||`${n}:${e.started_ts}`)})]}):null]})}var yo=new Set([`running`,`in_progress`,`claimed`]);function bo(e,t){let n;for(let r of t)r.item_id!==e.id||![`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.mission.orphaned`].includes(r.type)||(!n||r.ts>=n.ts)&&(n=r);if(n?.type===`life.mission.completed`&&!(n.ts(t.status===`done`||yo.has(t.status))&&(t.ts??0)>e?t.ts??0:e,0)}function So(e,t){return e.status===`failed`&&!e.pending_question&&(e.ts??0)t.status!==`done`&&!yo.has(t.status)&&(t.pending_question||t.status===`failed`&&!So(t,e))).sort((e,t)=>Number(!!t.pending_question)-Number(!!e.pending_question))}function wo(e){return e.find(e=>yo.has(e.status))??Co(e)[0]??e.find(e=>e.status===`pending`)??e.at(-1)}function To(e,t){let n=new Set,r=new Set;for(let i of e.links)i.kind===`dependency`&&(i.target===t&&n.add(i.source),i.source===t&&r.add(i.target));return{upstream:e.tasks.filter(e=>n.has(e.id)),downstream:e.tasks.filter(e=>r.has(e.id))}}function Eo(e){return e.status===`cancelled`?`aborted`:e.pending_question?`question`:yo.has(e.status)?`running`:e.outcome?.review_status===`unavailable`?`review_unavailable`:e.status===`failed`&&Do(e)?`held`:e.status.startsWith(`paused`)||e.status===`blocked`?`paused`:[`done`,`failed`,`aborted`,`skipped`,`superseded`,`pending`,`missing`].includes(e.status)?e.status:`unknown`}function Do(e){return e.outcome?.stage_certification===`not_certified`||!e.outcome?.execution_status&&/^manager stage hold:/i.test(e.last_error||``)}function Oo(e,t){let n=e=>t.some(t=>t.type===`life.mission.started`&&t.ts>e);return e.filter(e=>e.status===`done`&&e.outcome?.review_status===`done`&&e.outcome.stage_certification===`certified`).map(e=>({task:e,completion:bo(e,t)})).filter(({completion:e})=>e?.overall_complete===!0&&!n(e.ts)).map(({task:e})=>e).sort((e,t)=>(t.finished_ts??t.ts??0)-(e.finished_ts??e.ts??0))[0]}function ko(e){let t=new Set,n=[],r=new Map([...e.keys()].map(e=>[e,[]]));for(let[t,n]of e)for(let e of n)r.get(e).push(t);for(let r of e.keys()){let i=[[r,!1]];for(;i.length;){let[r,a]=i.pop();if(a)n.push(r);else if(!t.has(r)){t.add(r),i.push([r,!0]);for(let n of e.get(r))t.has(n)||i.push([n,!1])}}}let i=new Map;for(let e of n.reverse()){if(i.has(e))continue;let t=i.size,n=[e];for(;n.length;){let e=n.pop();if(!i.has(e)){i.set(e,t);for(let t of r.get(e))n.push(t)}}}return i}function Ao(e){let t=new Map(e.map(e=>[e.id,e])),n=[...t.values()].sort((e,t)=>(e.ts??0)-(t.ts??0)||e.id.localeCompare(t.id)),r=[],i=new Set;for(let e of n)for(let n of new Set(e.deps??[]))t.has(n)||i.add(n),r.push({id:JSON.stringify([`dep`,n,e.id]),source:n,target:e.id,kind:`dependency`,missing:!t.has(n)});let a=[...[...i].map(e=>({id:e,title:`未包含的依赖`,objective:`该引用不在当前数据范围内。`,status:`missing`,deps:[],role:`system`})),...n],o=new Map(a.map(e=>[e.id,0])),s=new Map(a.map(e=>[e.id,[]]));r.forEach(e=>{o.set(e.target,(o.get(e.target)??0)+1),s.get(e.source)?.push(e.target)});let c=a.filter(e=>o.get(e.id)===0).map(e=>e.id),l=0;for(let e=0;et.id!==e.id&&t.plan_id===e.superseded_by_plan_id);t.length&&r.push({id:JSON.stringify([`replacement`,e.id,e.superseded_by_plan_id]),source:e.id,target:t[0].id,kind:`replacement`,target_plan_id:e.superseded_by_plan_id,target_count:t.length})}if(u){let e=ko(s);r.filter(t=>t.kind===`dependency`&&e.get(t.source)===e.get(t.target)).forEach(e=>{e.cycle=!0})}return{tasks:a,links:r,missing:i.size,cyclic:u}}function jo(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function Mo(e){return e?.match(/route[-_ ]?(\d+)/i)?.[1]??e?.match(/(\d+)\s*$/)?.[1]??``}function No(e,t){if(!e)return``;if(e.kind===`review`)return e.verdict===`rejected`?t?`复核:驳回`:`Review: rejected`:e.verdict===`qualified`?t?`复核:通过`:`Review: qualified`:``;if(e.kind===`route`)return e.selected?t?`通过 · 被选中`:`Qualified · chosen`:e.verdict===`rejected`?t?`驳回`:`Rejected`:e.verdict===`qualified`?e.selected===!1?t?`通过 · 未选中`:`Qualified · not chosen`:t?`通过`:`Qualified`:``;let n=Mo(e.selected_route);return n?t?`已选研究路线 ${n}`:`Chose route ${n}`:``}function Po(e){return e?e.kind===`selection`?e.selected_route?`chosen`:``:e.selected?`chosen`:e.verdict??``:``}function Fo(e){let t=String(e||``).split(/\r?\n/).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY|NEXT_ACTION)\s*=\s*/i,``).trim()).filter(e=>e&&!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e)).join(` `);return t.length>160?`${t.slice(0,159)}…`:t}function Io(e){let t=new Map;for(let n of e){if(n.type!==`idea.portfolio.formed`)continue;let e=Number(n.width);if(!Number.isInteger(e)||e<=0)continue;let r=t.get(n.item_id);(!r||n.ts>=r.ts)&&t.set(n.item_id,{ts:n.ts,width:e})}return new Map([...t].map(([e,t])=>[e,t.width]))}function Lo(e,t,n,r=16){let i=new Map;for(let e of t){if(e.type!==`team.task`||!e.item_id)continue;let t=i.get(e.item_id)??new Map;t.set(e.id,e),i.set(e.item_id,t)}if(!i.size)return e;let a=new Set(e.tasks.map(e=>e.id)),o=[],s=[];for(let t of e.tasks){if(t.branch)continue;let e=[...i.get(t.id)?.values()??[]].filter(e=>!a.has(e.id)).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));if(!e.length)continue;let c=e.slice(0,r),l=new Set(c.map(e=>e.id));for(let e of c)a.add(e.id),o.push({id:e.id,title:jo(e,n),objective:Fo(e.text),excerpt:Fo(e.text),status:e.status||`unknown`,deps:[],pending_question:e.pending_question,role:`team`,team_role:e.team_role,...e.team_outcome?{team_outcome:e.team_outcome}:{},ts:e.ts,branch:!0,parent_id:t.id});let u=new Set(c.flatMap(e=>(e.deps??[]).filter(t=>l.has(t)&&t!==e.id)));for(let e of c){let n=[...new Set(e.deps??[])].filter(t=>l.has(t)&&t!==e.id);if(n.length)for(let t of n)s.push({id:JSON.stringify([`fanout`,t,e.id]),source:t,target:e.id,kind:`fanout`});else s.push({id:JSON.stringify([`fanout`,t.id,e.id]),source:t.id,target:e.id,kind:`fanout`});u.has(e.id)||s.push({id:JSON.stringify([`fanin`,e.id,t.id]),source:e.id,target:t.id,kind:`fanin`})}let d=e.length-c.length,f=`team-overflow:${t.id}`;d>0&&!a.has(f)&&(a.add(f),o.push({id:f,title:n?`还有 ${d} 条`:`+${d} more`,objective:n?`更多并行子任务收录在所属任务卡片中。`:`The remaining parallel subtasks live inside the owning card.`,status:`recorded`,deps:[],role:`team`,ts:e[r]?.ts,branch:!0,parent_id:t.id,overflow_count:d}),s.push({id:JSON.stringify([`fanout`,t.id,f]),source:t.id,target:f,kind:`fanout`},{id:JSON.stringify([`fanin`,f,t.id]),source:f,target:t.id,kind:`fanin`}))}return o.length?{...e,tasks:[...e.tasks,...o],links:[...e.links,...s]}:e}var Ro={"idea-route":[e=>`${e} 条研究路线`,e=>`${e} research route${e===1?``:`s`}`],"idea-review":[e=>`${e} 次独立复核`,e=>`${e} independent review${e===1?``:`s`}`],"idea-selector":[e=>`${e} 次方案选择`,e=>`${e} idea selection${e===1?``:`s`}`]},zo=[e=>`${e} 个并行子任务`,e=>`${e} parallel subtask${e===1?``:`s`}`],Bo={pending:[`尚未开始`,`have not started`],running:[`正在进行`,`are under way`],done:[`已经完成`,`are complete`],failed:[`没有完成`,`did not finish`],question:[`在等待答复`,`are waiting for an answer`],paused:[`已暂停`,`are paused`],superseded:[`已被新计划替代`,`were replaced by a new plan`],aborted:[`已取消`,`were cancelled`],skipped:[`已跳过`,`were skipped`]};function Vo(e,t,n){let r=e.map(({role:e,count:t})=>(Ro[e]??zo)[+!n](t)),i=n?r.length>1?`${r.slice(0,-1).join(`、`)}与 ${r[r.length-1]}`:r[0]:r.length>1?`${r.slice(0,-1).join(`, `)} and ${r[r.length-1]}`:r[0],a=(Bo[t]??[`已记录在案`,`are on record`])[+!n];return n?`${i}${a}`:`${i} ${a}`}function Ho(e,t){let n=e.filter(e=>e.team_outcome?.kind===`route`),r=n.filter(e=>e.team_outcome?.selected).map(e=>Mo(e.title)),i=n.filter(e=>e.team_outcome?.verdict===`rejected`&&!e.team_outcome.selected).map(e=>Mo(e.title)),a=n.filter(e=>e.team_outcome?.verdict===`qualified`&&!e.team_outcome.selected).map(e=>Mo(e.title)),o=[],s=e=>[...e].sort().join(t?`、`:`, `);return r.length&&o.push(t?`路线 ${s(r)} 通过并被选中`:`route ${s(r)} qualified and chosen`),a.length&&o.push(t?`路线 ${s(a)} 通过${r.length?`但未被选中`:`,等待选择`}`:`route${a.length>1?`s`:``} ${s(a)} qualified${r.length?` but not chosen`:`, selection pending`}`),i.length&&o.push(t?`路线 ${s(i)} 被驳回`:`route${i.length>1?`s`:``} ${s(i)} rejected`),o.length?t?`:${o.join(`,`)}`:`: ${o.join(`; `)}`:``}function Uo(e,t,n,r=3){let i=new Map;for(let t of e.tasks){if(!t.branch||t.overflow_count||t.group||!t.parent_id)continue;let e=JSON.stringify([t.parent_id,Eo(t)]);(i.get(e)??i.set(e,[]).get(e)).push(t)}let a=new Set(e.tasks.map(e=>e.id)),o=new Map,s=new Map;for(let[e,c]of i){if(c.lengthe.role===t);n?n.count++:d.push({role:t,count:1})}let f=c[0],p=t.has(u);o.set(u,{id:u,title:Vo(d,l,n)+Ho(c,n),objective:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,excerpt:n?`点击展开,逐条查看这些子任务;再点一次收起。`:`Click to see them one by one; click again to fold them back.`,status:f.status,deps:[],pending_question:f.pending_question,role:`team`,ts:f.ts,branch:!0,parent_id:i,group:{status:l,members:c.map(e=>e.id),counts:d,expanded:p}});for(let e of c)s.set(e.id,u)}if(!o.size)return e;let c=[],l=new Set;for(let n of e.tasks){let e=s.get(n.id);if(!e){c.push(n);continue}l.has(e)||(l.add(e),c.push(o.get(e))),t.has(e)&&c.push(n)}let u=[],d=new Set;for(let n of e.links){let e=s.get(n.source),r=s.get(n.target),i=n.source,a=n.target;if(e&&!t.has(e)&&(i=e),r&&!t.has(r)&&(a=r),r&&t.has(r)&&n.kind===`fanout`&&n.source===o.get(r).parent_id&&(i=r),i===a)continue;if(i===n.source&&a===n.target){u.push(n);continue}let c=JSON.stringify([n.kind,i,a]);d.has(c)||(d.add(c),u.push({...n,id:c,source:i,target:a}))}for(let[e,n]of o){if(!t.has(e))continue;let r=JSON.stringify([`fanout`,n.parent_id,e]);d.has(r)||(d.add(r),u.push({id:r,source:n.parent_id,target:e,kind:`fanout`}))}return{...e,tasks:c,links:u}}function Wo(e){return e.filter(e=>!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)).map(({source:e,target:t})=>({source:e,target:t}))}function Go(e,t,n,r=[]){let i=(e,t)=>r.find(n=>n.source===e&&n.target===t&&n.label),a=e.links.map(e=>{if(e.kind!==`dependency`)return e;let r=t.find(t=>t.source===e.source&&t.target===e.target)??i(e.source,e.target);return r?{...e,label:r.label,stated:!0,evidence:`${n?`执行依赖`:`Execution dependency`} · ${r.label}`}:e}),o=new Map(e.tasks.map(e=>[e.id,e.id])),s=e=>{let t=o.get(e);return t===e?e:s(t)},c=(e,t)=>{o.set(s(e),s(t))};for(let e of a.filter(e=>e.kind===`dependency`))c(e.source,e.target);for(let n of t)!o.has(n.source)||!o.has(n.target)||e.tasks.findIndex(e=>e.id===n.source)>=e.tasks.findIndex(e=>e.id===n.target)||s(n.source)===s(n.target)||(a.push({source:n.source,target:n.target,label:n.label,kind:`semantic`,stated:!0,id:`semantic:${n.source}:${n.target}`}),c(n.source,n.target));for(let t=1;tKo+Math.min(500,Math.max(0,e-8)*60);function Yo(e,t,n,r,i,a,o){let s=new Map(n.map(e=>[e,t[e].y+i[e].height/2]));for(let c=0;c<6;c++)for(let l of c%2?[...e].reverse():e){let e=new Set(l),c=[],u=[],d=0;l.forEach((f,p)=>{let m=s.get(f)*.8,h=.8;for(let o of a[r.get(f)]){let r=n[o.index];e.has(r)||(m+=(t[r].y+i[r].height/2)*o.weight,h+=o.weight)}c.push(d);let g=m/h-i[f].height/2-d;for(u.push({start:p,end:p,sum:g*h,weight:h});u.length>1;){let e=u[u.length-2],t=u[u.length-1];if(e.sum/e.weight<=t.sum/t.weight)break;e.end=t.end,e.sum+=t.sum,e.weight+=t.weight,u.pop()}d+=i[f].height+(p+1[e,t])),a=t.filter(e=>e.kind!==`replacement`&&e.source!==e.target).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:.4})),o=e.map(()=>[]),s=e.map(()=>[]),c=e.map(()=>[]);for(let e of a)o[e.source].push(e.target),s[e.target].push(e.source),c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let l=new Set(a.filter(e=>e.weight===1).map(e=>`${Math.min(e.source,e.target)}:${Math.max(e.source,e.target)}`)),u=(e,t)=>{let n=i.get(e),r=i.get(t);return l.has(`${Math.min(n,r)}:${Math.max(n,r)}`)?qo:qo*1.3},d=e.reduce((e,t)=>e+n[t].width*n[t].height,0),f=Math.sqrt(d/e.length),p=e.reduce((e,t)=>e+n[t].height,0)/e.length,m=Math.ceil(Math.sqrt(e.length)*1.8),h=e.map(()=>[]);for(let e of a)h[Math.max(e.source,e.target)].push(e);let g=e.map((t,n)=>{let r=0;return Array.from({length:Math.min(m,e.length-n)+1},(e,t)=>{if(t)for(let e of h[n+t-1])Math.min(e.source,e.target)1||s[e.target].length>1)&&(r+=e.weight*.9),r+=Math.max(0,Math.abs(e.target-e.source)-1)*e.weight);return r})}),_={},v=1/0,y=new Set;for(let t=1;t<=m;t++){let o=t*p+(t-1)*qo,l=Array(e.length+1).fill(1/0),m=Array(e.length+1).fill(0);l[0]=0;for(let r=1;r<=e.length;r++){let i=0;for(let a=r-1;a>=Math.max(0,r-t);a--){i+=n[e[a]].height+(a===r-1?0:qo);let t=g[a][r-a];a>0&&s[a].some(e=>s[a-1].includes(e))&&(t+=.7);let c=l[a]+.2+(i/o-1)**2+t;c0;t=m[t])h.unshift(e.slice(m[t],t));let b=JSON.stringify(h);if(y.has(b))continue;y.add(b);let x=h.map(e=>Math.max(...e.map(e=>n[e].width))),S=h.map(e=>e.reduce((e,t)=>e+n[t].height,0)+(e.length-1)*qo),C=x.reduce((e,t)=>e+t,0)+(h.length-1)*r,w=Math.max(...S),T={},E=0;h.forEach((e,t)=>{let i=(w-S[t])/2;e.forEach((r,a)=>{T[r]={x:E+(x[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1T[e].y));for(let t of e)T[t].y-=D;w=Math.max(...e.map(e=>T[e].y+n[e].height));let O=a.reduce((t,r)=>{let i=T[e[r.source]],a=T[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,a.length)/f,k=2*Math.log(C/w/2.1)**2+.08*C*w/d+.14*O+.08*l[e.length]/h.length;k[e,t])),a=e=>e.source!==e.target&&i.has(e.source)&&i.has(e.target),o=new Set,s=new Map;for(let e of t)!a(e)||e.kind!==`fanout`&&e.kind!==`fanin`||(e.kind===`fanout`?o.add(e.target):o.add(e.source),(s.get(e.source)??s.set(e.source,new Set).get(e.source)).add(e.target),(s.get(e.target)??s.set(e.target,new Set).get(e.target)).add(e.source));let c=e.map(()=>[]),l=t.filter(e=>e.kind!==`replacement`&&a(e)).map(e=>({source:i.get(e.source),target:i.get(e.target),weight:e.kind===`dependency`||e.kind===`continuation`?1:e.kind===`fanout`||e.kind===`fanin`?.8:.4}));for(let e of l)c[e.source].push({index:e.target,weight:e.weight}),c[e.target].push({index:e.source,weight:e.weight});let u=e.map(()=>[]);for(let e of t){if(!Zo.has(e.kind)||!a(e))continue;let t=i.get(e.source),n=i.get(e.target);td[e]))+1:f+1;d.push(e),f=Math.max(f,e)}let p=[];e.forEach((e,t)=>{(p[d[t]]??=[]).push(e)});let m=p.filter(e=>e?.length),h=(e,t)=>o.has(e)&&o.has(t)?qo/2:qo,g=e=>e.reduce((t,r,i)=>t+n[r].height+(i?h(e[i-1],r):0),0),_=e.reduce((e,t)=>e+n[t].width*n[t].height,0),v=Math.sqrt(_/e.length),y=e.filter(e=>!o.has(e)),b=(y.length?y:e).reduce((e,t)=>e+n[t].height,0)/Math.max(1,y.length||e.length),x=Math.ceil(Math.sqrt(e.length)*1.8),S={},C=1/0,w=new Set;for(let t=1;t<=x;t++){let a=t*b+(t-1)*qo,u=[];for(let e of m){let t=[],n=()=>{if(!t.length)return;let e=o.has(t[0]);if(e)u.push({nodes:t,isBranch:e});else{let n=[];for(let r of t)n.length&&g([...n,r])>a&&(u.push({nodes:n,isBranch:e}),n=[]),n.push(r);n.length&&u.push({nodes:n,isBranch:e})}t=[]};for(let r of e)t.length&&o.has(t[0])!==o.has(r)&&n(),t.push(r);n()}let d=[],f=[];for(let e of u){let t=d.at(-1),n=t&&e.nodes.some(e=>t.some(t=>s.get(e)?.has(t)));!t||n||f.at(-1)!==e.isBranch||g([...t,...e.nodes])>a?(d.push([...e.nodes]),f.push(e.isBranch)):t.push(...e.nodes)}let p=JSON.stringify(d);if(w.has(p))continue;w.add(p);let y=d.map(e=>Math.max(...e.map(e=>n[e].width))),x=d.map(g),T=y.reduce((e,t)=>e+t,0)+(d.length-1)*r,E=Math.max(...x),D={},O=0;d.forEach((e,t)=>{let i=(E-x[t])/2;e.forEach((r,a)=>{D[r]={x:O+(y[t]-n[r].width)/2,y:i},i+=n[r].height+(a+1D[e].y));for(let t of e)D[t].y-=k;E=Math.max(...e.map(e=>D[e].y+n[e].height));let A=l.reduce((t,r)=>{let i=D[e[r.source]],a=D[e[r.target]];return t+Math.hypot(a.x+n[e[r.target]].width/2-i.x-n[e[r.source]].width/2,a.y+n[e[r.target]].height/2-i.y-n[e[r.source]].height/2)*r.weight},0)/Math.max(1,l.length)/v,j=2*Math.log(T/E/2.1)**2+.08*T*E/_+.14*A;j=e.length*.3?Qo(e,t,n):Xo(e,t,n)}function es(e){let t=new Map,n=new Map,r=new Map;return e.map(e=>{let i=`${e.source}\u0000${e.target}`,a=(t.get(e.source)??0)+(n.get(e.target)??0)-(r.get(i)??0);return t.set(e.source,(t.get(e.source)??0)+1),n.set(e.target,(n.get(e.target)??0)+1),r.set(i,(r.get(i)??0)+1),a})}function ts(e,t){if(e.x===t.x&&e.y===t.y)return{sourceHandle:`right`,targetHandle:`bottom`};let n=t.x+t.width/2-e.x-e.width/2,r=t.y+t.height/2-e.y-e.height/2,i=r>0?t.y-e.y-e.height:e.y-t.y-t.height,a=n>0?t.x-e.x-e.width:e.x-t.x-t.width;return i>=0&&a<0?r>=0?{sourceHandle:`bottom`,targetHandle:`top`}:{sourceHandle:`top`,targetHandle:`bottom`}:n>=0?{sourceHandle:`right`,targetHandle:`left`}:{sourceHandle:`left`,targetHandle:`right`}}function ns(e,t){return e?.type!==`life.mission.completed`||e.overall_complete!==!1&&e.campaign_continues!==!0||e.outcome?.execution_status===`completed`&&e.outcome.review_status===`done`?``:t?`当次执行已结束;当时总体目标尚未完成${e.campaign_continues===!0?`,仍需后续工作`:``}。`:`This execution ended; the overall goal was not complete at that time${e.campaign_continues===!0?` and further work remained`:``}.`}function rs(e){let{total:t,qa:n=0,complete:r,ended:i=0,reviewUnavailable:a=0,held:o=0,running:s,pending:c,paused:l,hasOpenWork:u,role:d,current:f,waiting:p,zh:m}=e,h=t>0&&r===t&&i===0,g=n===t&&n>0?m?`已全部回答`:`all answered`:m?`已全部完成`:`all completed`,_=m?[t>n?`${t-n} 个任务`:``,n>0?`${n} 条问答`:``,r>0&&!h?`已完成 ${r} 个`:``,i>0?`${i} 个任务结束时目标还没完成`:``,a>0?`${a} 个结果尚未检查成功`:``,o>0?`${o} 个任务暂停,后续工作尚未安排`:``,s>1?`${s} 个任务同时进行`:``]:[t>n?`${t-n} ${t-n===1?`task`:`tasks`}`:``,n>0?`${n} Q&A`:``,r>0&&!h?`${r} done`:``,i>0?`${i} ended before their goals were complete`:``,a>0?`${a} ${a===1?`result has`:`results have`} not been checked successfully`:``,o>0?`${o} paused with no next step scheduled`:``,s>1?`${s} tasks in progress`:``],v=c?m?`正在处理你的消息`:`working on your message`:p||(l?h?g:u?m?`已暂停`:`paused`:t>0?m?`没有在进行的工作`:`nothing in progress`:m?`就绪`:`ready`:f||(d?jr(d,m):h?g:``));return[..._,v].filter(Boolean).join(` · `)}var is={width:1440,height:1080},as=[`plan`,`execution`,`review`,`revision`,`result`];function os(e,t){let n=e.team_task_id?.match(/route-(\d+)/)?.[1],r=e.team_role===`idea-route`?t?`研究路线`:`Research route`:e.team_role===`idea-review`?t?`独立复核`:`Independent review`:e.team_role===`idea-selector`?t?`方案选择`:`Idea selection`:``;return r?`${r}${n?` ${n}`:``}`:e.title||(t?`并行子任务`:`Parallel task`)}function ss(e,t){let n=e.team_outcome;if(!n)return``;if(n.kind===`review`){let e=n.verdict===`rejected`?t?`复核结论:驳回`:`Verdict: rejected`:n.verdict===`qualified`?t?`复核结论:通过`:`Verdict: qualified`:``;if(!e)return``;let r=n.summary?us(n.summary,120):``;return r?`${e}${t?`。`:`. `}${r}`:e}if(n.kind===`route`){let e=n.title?t?`「${n.title}」`:`“${n.title}”`:``;if(n.selected)return t?`${e}通过独立复核,被选为唯一方案`:`${e} passed its independent review and was chosen`;if(n.verdict===`rejected`){let r=n.rejection?us(n.rejection,120):``;return(t?`${e}被独立复核驳回`:`${e} was rejected by its independent review`)+(r?t?`。${r}`:`. ${r}`:``)}return n.verdict===`qualified`?n.selected===!1?t?`${e}通过独立复核,但未被选中`:`${e} passed its independent review but was not chosen`:t?`${e}通过独立复核,等待选择`:`${e} passed its independent review; selection pending`:``}let r=Mo(n.selected_route);if(!r)return``;let i=n.selected_title?t?`(${n.selected_title})`:` (${n.selected_title})`:``,a=(n.rejected??[]).map(Mo).filter(Boolean);return(t?`选定研究路线 ${r}${i}`:`Chose route ${r}${i}`)+(a.length?t?`,驳回路线 ${a.join(`、`)}`:`; rejected route${a.length>1?`s`:``} ${a.join(`, `)}`:``)}function cs(e,t,n){return e.pending_question?t?`需要答复,展开查看具体问题`:`Needs your input; open to read the question`:e.status===`failed`?t?`本次执行失败,展开查看原因`:`This attempt failed; open to read the reason`:e.status===`blocked`?t?`执行受阻,展开查看原因`:`Work is blocked; open to read the reason`:ss(e,t)||(e.status===`done`?e.team_role===`idea-review`?t?`独立复核已完成,展开查看记录`:`Independent review completed; open to read the record`:t?`子任务执行已完成,展开查看记录`:`Subtask execution completed; open to read the record`:e.status===`pending`?n?t?`等待前置子任务完成后开始`:`Waiting for prerequisite subtasks to finish`:t?`等待分配 Agent 执行`:`Waiting for an agent to start`:yo.has(e.status||``)?e.team_role===`idea-route`?t?`正在开展来源研究,整理候选方案`:`Researching sources and developing a candidate idea`:e.team_role===`idea-review`?t?`正在独立核对依据、创新性和风险`:`Independently checking evidence, novelty and risks`:e.team_role===`idea-selector`?t?`正在对比研究路线及复核意见`:`Comparing research routes and independent reviews`:t?`Agent 正在执行此子任务`:`An agent is working on this subtask`:t?`展开查看子任务执行记录`:`Open to read the subtask record`)}var ls=e=>e?`这一步还没有留下记录`:`Nothing has been written down for this step yet.`;function us(e,t=140){let n=e.replace(/\s+/g,` `).trim();if(!n)return``;let r=n.match(/^.*?[。!?!?.](?=\s|$)/),i=(r?r[0]:n).trim();return i.length>t?`${i.slice(0,t-1).trimEnd()}…`:i}function ds(e){let t=e.replace(/\s+/g,` `).trim().split(/[。!?;;::,,\n]|\.(?=\s|$)|[!?](?=\s|$)/)[0]?.trim();return t&&t.length>=6&&t.length<=40?t:``}function fs(e){return String(e||``).split(/\r?\n/).filter(e=>!/^(?:Decision\s*:|(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS)\s*=)/i.test(e.trim())&&!/^\{\s*"[\w-]+"\s*:.*\}$/.test(e.trim())).map(e=>e.replace(/^\s*(?:RESULT|SUMMARY)\s*=\s*/i,``).replace(/^\s*NEXT_ACTION\s*=\s*/i,``)).join(` +`).trim()}function ps(e,t,n){switch(e.type){case`life.planner.task_added`:return n?`规划者把这项任务列入了计划。`:`The Planner added this task to the plan.`;case`life.mission.started`:return n?`工程师接手了这项任务,开始动手。`:`The Engineer picked up this task and began working.`;case`life.phase.started`:case`round.review.started`:return e.role===`reviewer`?n?`审阅者打开了工程师的工作,开始核查。`:`The Reviewer opened the Engineer's work to check it.`:``;case`life.mission.completed`:return ns(e,n)||(t===`done`?n?`任务完成,结果已经记录在案。`:`The task was finished; its result is on record.`:t===`paused_external_work`?n?`这项任务在等待后台团队的结果;结果就绪后会自动继续。`:`This task is waiting for its background team; it continues on its own once the results are in.`:t.startsWith(`paused`)?n?`这项任务的工作暂停了。`:`Work on this task was paused.`:n?`任务到此结束。`:`The task ended here.`);case`life.mission.failed`:return n?`任务没有达到目标就结束了。`:`The task ended without reaching its goal.`;default:return``}}var ms=/^(?:[⚙✎↳$…∴▸]|✗ \$)\s*/u,hs=(e,t)=>e.length>t?`${e.slice(0,t-1).trimEnd()}…`:e;function gs(e){let t=e.slice(e.indexOf(`:`)+1).trim();if(!t)return``;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of[`path`,`file`,`file_path`,`pattern`,`query`,`url`,`command`,`paths`]){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim();if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}let n=Object.values(t).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n.trim():``}}catch{}return/^[{[]/.test(t)?/"(?:path|file|file_path|pattern|query|url|command)"\s*:\s*"([^"]+)/.exec(t)?.[1]??``:t}function _s(e){let t=(e.tool||e.label.replace(ms,``).split(`:`)[0]||``).trim().toLowerCase();return e.kind===`command_execution`?`run`:e.kind===`file_change`?`edit`:/^(view|read|cat|open|read_file|str_replace_editor)$/.test(t)?`read`:/^(rg|grep|search|find_text|semantic_search|codebase_search|web_search|search_web)$/.test(t)||/^(glob|find|list|ls|list_dir|find_files)$/.test(t)?`search`:/^(web_fetch|fetch|http_get|browse)$/.test(t)?`fetch`:/^(apply_patch|edit|write|create|write_file|edit_file|replace_in_file|str_replace)$/.test(t)?`edit`:/^(bash|shell|sh|execute|terminal|run)$/.test(t)?`run`:`other`}function vs(e,t){let n=(e.tool||``).trim(),r=e.label.replace(ms,``).trim(),i=n&&/\s/.test(n)&&n.length>8,a=hs(gs(r),72),o=hs(r,72),s=_s(e),c=i?n:s===`run`?t?`运行命令 \`${o}\``:`Ran \`${o}\``:s===`read`?t?`查看 ${a||(t?`一份文件`:``)}`:`Read ${a||`a file`}`:s===`search`?t?`查找 ${a||`内容`}`:`Looked for ${a||`something`}`:s===`fetch`?t?`读取网页 ${a||``}`.trim():`Fetched ${a||`a page`}`:s===`edit`?t?`修改文件 ${a||``}`.trim():`Edited ${a||`a file`}`:hs(/^[^:{]*:\s*[{[]/.test(r)?r.slice(0,r.indexOf(`:`)):r,80);return e.status===`failed`?`${c}${t?`(失败)`:` (failed)`}`:c}function ys(e,t,n){let r=new Map;e.forEach(e=>r.set(_s(e),(r.get(_s(e))??0)+1));let i=[],a=(e,t,a,o)=>{let s=r.get(e);s&&i.push(n?`${t}${s}${e===`run`?`条命令`:e===`fetch`?`个网页`:`处`}`:`${s} ${s===1?a:o}`)};a(`read`,`查看了`,`file read`,`files read`),a(`search`,`查找了`,`search`,`searches`),a(`fetch`,`读取了`,`page fetched`,`pages fetched`),a(`edit`,`修改了`,`file edited`,`files edited`),a(`run`,`运行了`,`command run`,`commands run`);let o=r.get(`other`);return o&&i.push(n?`${o}次其他操作`:`${o} other ${o===1?`action`:`actions`}`),t>0&&i.push(n?`另有 ${t} 步未列出`:`${t} more not listed`),i.length?n?`${i.join(`,`)}。`:`${i.join(`, `)}.`:``}function bs(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.status===`running`&&n.status&&n.status!==`running`&&(e.call_id&&n.call_id?e.call_id===n.call_id:!e.call_id&&!n.call_id&&e.kind===n.kind&&e.label===n.label&&(e.tool??``)===(n.tool??``))?t[t.length-1]={...e,status:n.status,...n.call_id?{call_id:n.call_id}:{}}:t.push(n)}return t}function xs(e,t){let n=bs(e.steps??[]),r=fs(e.text),i=e.tool_details_recorded===!1,a=i?t?`执行日志确认发生过工具活动,但这一轮没有记录详细工具步骤。`:`Execution logs confirm tool activity, but detailed tool steps were not recorded for this turn.`:``;return ws({id:e.id,kind:e.role===`reviewer`?`review`:`execution`,title:``,detail:``,status:e.status||`recorded`,ts:e.ts,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id],segment:!0,work:{steps:[...n],overflow:e.overflow??0,narrations:r?[r]:[],note:a,title:i?t?`已记录的执行`:`Recorded execution`:``,single:e.role===`manager`}},t)}var Ss=8,Cs=(e,t)=>{let n=Math.max(0,e.steps.length-Ss)+e.overflow;return[...e.steps.slice(0,Ss).map(e=>`· ${vs(e,t)}`),...n>0?[t?`· 另有 ${n} 步未列出`:`· ${n} more not listed`]:[]]};function ws(e,t){let n=e.work,r=n.narrations.join(` + +`);return e.title=n.title||ds(n.narrations[0]??``)||(n.single?t?`Argus 动手查证`:`Argus did the work`:n.steps.length?t?`做了 ${n.steps.length} 步操作`:`${n.steps.length} steps of work`:t?`说明了接下来要做什么`:`Said what comes next`),e.summary=us(n.narrations[0]??``)||ys(n.steps,n.overflow,t)||void 0,e.detail=[n.note,r,Cs(n,t).join(` +`)].filter(Boolean).join(` + +`)||ls(t),e.workCount=n.steps.length+n.overflow||void 0,e}function Ts(e,t){let n=e.work;if(!n||e.segment)return e;let r=e.detail===ls(t)?``:e.detail,i=n.narrations.filter(e=>!r.includes(e.slice(0,60))),a=n.steps.length+n.overflow,o=ys(n.steps,0,t),s=a?[t?`这一步里做的操作(${a} 步):${o}`:`What was done in this step (${a} actions): ${o}`,Cs(n,t).join(` +`)].join(` +`):``,c=n.narrations[n.narrations.length-1];return!e.closed&&c&&(e.title=ds(c)||e.title,e.summary=us(c)||e.summary),e.detail=[n.note,r,i.join(` + +`),s].filter(Boolean).join(` + +`)||ls(t),e.workCount=a||void 0,e}function Es(e,t){switch(e){case`done`:return t?`这项任务已经完成。`:`This task was completed.`;case`failed`:return t?`这项任务没有达到目标。`:`This task did not reach its goal.`;case`cancelled`:case`aborted`:return t?`这项任务被取消了。`:`This task was cancelled.`;case`skipped`:return t?`这项任务被跳过了。`:`This task was skipped.`;case`superseded`:return t?`这项任务被一个新的计划取代了。`:`A new plan took the place of this task.`;default:return``}}function Ds(e,t,n){let r=e.kind===`turn`,i=[{id:`${e.id}:brief`,kind:`plan`,title:r?n?e.turn_kind===`qa`?`你提出的问题`:`你提出的要求`:`What you asked`:n?`任务目标`:`Task goal`,detail:e.objective||e.title,status:`recorded`,source:`task`,eventIds:[]}],a=new Set,o=0,s,c=t.filter(t=>t.item_id===e.id).sort((e,t)=>e.ts-t.ts||(e.type===`team.task`&&t.type===`team.task`?(e.team_task_id||e.id).localeCompare(t.team_task_id||t.id):0)),l=new Map(c.filter(e=>e.type===`team.task`).map(e=>[e.id,e]));for(let e of c){if(a.has(e.id))continue;if(a.add(e.id),e.type===`team.task`){let t=[...new Set(e.deps||[])],r=t.map(e=>l.has(e)?os(l.get(e),n):n?`其他记录中的子任务`:`Task outside this view`),a=fs(e.text);i.push({id:e.id,kind:e.team_role===`idea-review`||e.role===`reviewer`?`review`:e.team_role===`idea-selector`?`plan`:`execution`,title:os(e,n),summary:cs(e,n,t.some(e=>l.has(e)&&l.get(e).status!==`done`)),detail:[a,e.reason&&!a.includes(e.reason)?e.reason:``,e.pending_question?`${n?`需要答复`:`Needs input`}: ${e.pending_question}`:``,r.length?`${n?`依赖`:`Depends on`}: ${r.join(` · `)}`:``].filter(Boolean).join(` + +`),status:e.pending_question?`question`:e.status||`unknown`,ts:e.ts,source:`team`,eventIds:[e.id],teamId:e.team_id,teamTaskId:e.team_task_id,teamRole:e.team_role,...e.team_outcome?{teamOutcome:e.team_outcome}:{},deps:t,updatedAt:e.updated_ts,revision:e.revision});continue}if(e.type===`work.segment`){i.push({...xs(e,n),episode:o});continue}if(e.type===`turn.replied`){let t=fs(e.text);i.push({id:e.id,kind:`result`,title:n?`Argus 的回答`:`What Argus answered`,summary:us(t)||void 0,detail:t||ls(n),status:e.status||`done`,ts:e.ts,source:`event`,eventIds:[e.id]});continue}e.type===`life.mission.started`&&(o++,s=void 0),e.type===`round.review.completed`&&(s=e);let t=e.type.includes(`review`)||e.type===`life.phase.started`&&e.role===`reviewer`?`review`:e.type===`life.planner.task_added`?`plan`:e.type===`life.mission.completed`||e.type===`life.mission.failed`?`result`:e.type===`round.start`||e.type===`round.main.completed`||e.type===`life.mission.started`||e.type===`life.phase.started`?`execution`:null;if(!t)continue;let r=e.round_index,c=e.type.endsWith(`.completed`)||e.type.endsWith(`.failed`),u=t===`review`&&e.review_skipped===!0,d=e.backend_unavailable===!0||t===`result`&&s?.backend_unavailable===!0,f=d?``:ns(e,n),p=(d?`review_unavailable`:u?`skipped`:e.status===`error`?`failed`:e.status)||(e.success===!1||e.type.endsWith(`.failed`)?`failed`:e.success===!0?`done`:c||e.type===`life.planner.task_added`||e.type===`life.mission.started`?`recorded`:`started`),m=Hi(e.text||``,n),h=String(e.text||``),g=m.receipt?h.lastIndexOf(m.receipt):-1,_=fs(g>=0?h.slice(0,g):h),v=p===`done`?n?`审阅通过`:`Review passed`:p===`continue`?n?`审阅:要求再改一轮`:`Review: another pass asked for`:[`blocked`,`replan`,`replan_requested`].includes(p)?n?`审阅:建议调整方向`:`Review: a change of course asked for`:p===`failed`?n?`审阅未通过`:`Review not passed`:``,y=m.kind===`interrupt`,b=t===`execution`&&!m.summary?ds(_):``,x=d?n?`当次审查异常`:`Review error on this attempt`:y?n?`这一轮没做完就被停下`:`Stopped before the round could finish`:u?n?`本轮未审阅`:`No review this round`:t===`review`?c?v||(n?`审阅意见`:`Review`):n?`开始审阅`:`Review started`:t===`result`?f?n?`本次执行已结束`:`This execution ended`:p===`paused_external_work`?n?`等待后台团队`:`Waiting for the background team`:n?`执行结果`:`Result of the work`:t===`plan`?n?`列入计划`:`Taken into the plan`:b||(m.kind===`round`?n?`新一轮开始`:`A new round began`:e.type===`life.mission.started`?n?`开始执行`:`Work started`:e.type===`round.main.completed`?n?`本轮执行记录`:`This round's work`:n?`一次执行尝试`:`An attempt at the work`),S=Hi(e.next_action||``,n),C=_||m.summary?``:ps(e,p,n);i.push({id:e.id,kind:t,title:x,summary:d?n?`审查器未能给出判断,不是审阅否决。`:`The Reviewer could not return a judgment; this was not a rejection.`:f||m.summary||us(_)||C||void 0,detail:[f,_||m.summary||(f?``:C||ls(n)),f&&e.stage_certification===`intentionally_skipped`?n?`本阶段认证被有意跳过;这不代表最终验收通过。`:`Stage certification was intentionally skipped; this is not final acceptance.`:``,u&&e.next_action&&!S.summary?`${n?`接下来`:`What happens next`}: ${e.next_action}`:``,m.receipt?`${n?`——技术记录:`:`— technical record: `}${m.receipt.replace(Bi,``)}`:``].filter(Boolean).join(` + +`),status:f&&p===`done`?`recorded`:p,completionScope:f||void 0,closed:c,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]}),!u&&!y&&e.next_action&&[`continue`,`blocked`,`replan`,`replan_requested`].includes(e.status||``)&&i.push({id:`${e.id}:next`,kind:`revision`,title:n?`建议的修改`:`Changes asked for`,detail:S.summary||e.next_action,status:`requested`,ts:e.ts,round:r,episode:o,source:e.association===`single_active_window`?`interval`:`event`,eventIds:[e.id]})}e.turn_kind===`qa`&&!i.some(e=>e.kind===`result`)&&i.push({id:`${e.id}:answer`,kind:`result`,title:yo.has(e.status)?n?`正在回答`:`Answering`:n?`回答状态`:`Answer status`,detail:e.summary||(e.status===`cancelled`?n?`本次回答已中断。`:`This answer was interrupted.`:``),status:e.status,source:`task`,eventIds:[]}),e.turn_kind!==`qa`&&!i.some(e=>e.kind===`execution`)&&yo.has(e.status)&&i.push({id:`${e.id}:active`,kind:`execution`,title:n?`正在进行的工作`:`Work under way`,detail:e.summary||``,status:e.status,source:`task`,eventIds:[]}),!i.some(e=>e.kind===`result`)&&[`done`,`failed`,`aborted`,`cancelled`,`skipped`,`superseded`].includes(e.status)&&i.push({id:`${e.id}:outcome`,kind:`result`,title:n?`任务的最终状态`:`Where this task ended up`,detail:e.summary||Es(e.status,n),status:e.status,source:`task`,eventIds:[]});let u=[],d=new Map,f=new Map,p=(e,t)=>{let n=e.work??={steps:[],overflow:0,narrations:[],note:``,title:``,single:!1};n.steps.push(...t.work.steps),n.overflow+=t.work.overflow,n.narrations.push(...t.work.narrations.filter(e=>!n.narrations.includes(e))),n.note||=t.work.note,e.eventIds.push(...t.eventIds),t.source===`interval`&&(e.source=`interval`)};for(let e of i){if(e.segment){let t=f.get(e.kind),r=u[u.length-1],i=t&&t.episode===e.episode?t:r?.segment&&r.kind===e.kind?r:void 0;i?(p(i,e),i.segment&&ws(i,n)):u.push({...e,eventIds:[...e.eventIds]});continue}let t=e.round!=null&&[`execution`,`review`].includes(e.kind),r=`${e.episode}:${e.round}:${e.kind}`,i=t?d.get(r):void 0;if(i)i.title=e.title,i.summary=e.summary??i.summary,i.detail=e.detail,i.status=e.status,i.closed=i.closed||e.closed,i.eventIds.push(...e.eventIds),e.source===`interval`&&(i.source=`interval`);else{let n={...e,eventIds:[...e.eventIds]};u.push(n),t&&(d.set(r,n),f.set(n.kind,n))}}return u.map(e=>{let{work:t,segment:r,closed:i,...a}=Ts(e,n);return a})}function Os(e,t,n=!0){let r=e.filter(e=>e.source===`team`),i=r.filter(e=>e.teamOutcome?.kind===`route`),a=r.find(e=>e.teamOutcome?.kind===`selection`)?.teamOutcome,o=i.find(e=>e.teamOutcome?.selected),s=[],c=e=>e.join(t?`、`:`, `);if(o||a?.selected_route){let e=Mo(o?.teamTaskId)||Mo(a?.selected_route),n=o?.teamOutcome?.title||a?.selected_title;s.push(t?`已选定研究路线 ${e}${n?`(${n})`:``}`:`route ${e} chosen${n?` (${n})`:``}`);let r=i.filter(e=>e.teamOutcome?.verdict===`rejected`&&!e.teamOutcome.selected).map(e=>Mo(e.teamTaskId)).filter(Boolean);r.length&&s.push(t?`路线 ${c(r)} 被驳回`:`route${r.length>1?`s`:``} ${c(r)} rejected`)}else if(i.some(e=>e.teamOutcome?.verdict)){let e=i.filter(e=>e.teamOutcome?.verdict===`qualified`).length,n=i.filter(e=>e.teamOutcome?.verdict===`rejected`).length;s.push(t?`复核结果:${e} 条路线通过、${n} 条驳回,等待选择`:`reviews so far: ${e} route${e===1?``:`s`} qualified, ${n} rejected; selection pending`)}let l=[...e].reverse().find(e=>e.source!==`team`&&e.kind===`review`&&[`done`,`continue`,`blocked`,`replan`,`replan_requested`,`failed`].includes(e.status));l&&s.push(l.status===`done`?t?`复核通过`:`review passed`:l.status===`continue`?t?`复核要求再改一轮`:`the review asked for another pass`:l.status===`failed`?t?`复核未通过`:`review not passed`:t?`复核建议调整方向`:`the review asked for a change of course`);let u=n?[...e].reverse().find(e=>e.source!==`team`&&e.kind===`execution`&&e.round!=null&&e.status===`started`):void 0;return u&&s.push(t?`第 ${u.round} 轮进行中`:`round ${u.round} under way`),s.length?(t?`当前结论:`:`So far: `)+s.join(t?`;`:`; `):``}var ks=480;function As(e,t,n,r=Ds(e,t,n),i=0,a=!1){let o=a&&r.length>0,s=o?ks:640,c=o?r.length:1,l=1/0;for(let e=1;!o&&e<=Math.min(3,r.length);e++){let t=Math.ceil(r.length/e),n=Math.max(640,t*232+(t-1)*108+96),i=408+(e-1)*236,a=Math.abs(Math.log(n/i/1.6))+.6*(t*e-r.length)/(t*e);a{let a=t*c,o=Math.min(a+c,r.length),s=m+t*340,l=r.slice(a,o);l.forEach((e,t)=>{h[e.id]={x:s,y:f+t*236}});let d=i+a+1,p=i+o,v=d===p?n?`环节 ${d}`:`Step ${d}`:n?`环节 ${d}–${p}`:`Steps ${d}–${p}`,y=Ms(g.slice(a,o)),b=Ns(l,y,_,t===0&&i===0,t===u-1,n,v);return _=y,{id:`steps:${i+a}`,title:b,x:s,y:f-38}});return{steps:r,links:Fs(r,n),columns:v,positions:h,width:d,height:p,...o?{stacked:o}:{}}}function js(e){let t;return e.map(e=>{if(typeof e.round==`number`)return t=e.round;if(e.kind!==`result`&&e.kind!==`plan`)return t})}function Ms(e){return[...new Set(e.filter(e=>typeof e==`number`))].sort((e,t)=>e-t)}function Ns(e,t,n,r,i,a,o){if(!t.length)return r&&i&&e.length>1&&e[0].kind===`plan`&&e[e.length-1].kind===`result`?a?`起点 → 结果`:`Setting out → Outcome`:r&&e.some(e=>e.kind===`plan`)?a?`起点`:`Setting out`:i&&e.some(e=>e.kind===`result`)?a?`结果`:`Outcome`:o;let s=t[0],c=t[t.length-1],l=t.length===1&&n.length>0&&n[n.length-1]===s,u=s===c?a?`第 ${s} 轮`:`Round ${s}`:a?`第 ${s}–${c} 轮`:`Rounds ${s}–${c}`;return l&&(u=e[0].kind===`review`?a?`${u} · 审阅`:`${u} · review`:a?`${u} · 续`:`${u} · cont.`),r&&e[0].kind===`plan`&&(u=a?`起点 · ${u}`:`Setting out · ${u}`),i&&e[e.length-1].kind===`result`&&(u=a?`${u} · 结果`:`${u} · Outcome`),u}function Ps(e){let t=e.stacked?900/e.width:Math.max(600/e.height,Math.min(1e3/e.height,is.width/e.width));return{width:e.width*t,height:e.height*t,scale:t}}function Fs(e,t){let n=e.filter(e=>e.source===`team`);if(n.length){let r=e.filter(e=>e.source!==`team`),i=new Map(n.map(e=>[e.id,e])),a=r.find(e=>e.source===`task`&&e.kind===`plan`),o=[];for(let e of n){for(let n of e.deps||[]){let r=i.get(n);!r||r.id===e.id||r.teamId!==e.teamId||o.push({id:`link:${r.id}:${e.id}`,source:r.id,target:e.id,relation:`dependency`,label:t?`前置任务`:`Depends on`,explanation:t?`${e.title} 的任务记录明确依赖 ${r.title}。`:`${e.title} explicitly depends on ${r.title} in its taskboard.`,contextual:!1})}a&&!e.deps?.length&&o.push({id:`link:${a.id}:${e.id}`,source:a.id,target:e.id,relation:`assignment`,label:t?`任务分支`:`Branch`,explanation:t?`该子任务属于当前主任务;此线不表示等待主任务完成。`:`This worker belongs to the current mission; the link does not require the parent to finish first.`,contextual:!0})}return[...Fs(r,t),...o]}return e.slice(1).map((n,r)=>{let i=e[r],a=i.episode===n.episode,o=a&&i.round!=null&&i.round===n.round,s=`record_order`,c=t?`接着`:`then`,l=t?`同一任务的相邻观察,未确认直接因果或执行依赖。`:`Adjacent observations of the same task; no causal dependency is asserted.`;i.kind===`plan`&&[`plan`,`execution`].includes(n.kind)?(s=`assignment`,c=t?n.kind===`plan`?`纳入计划`:`执行此任务`:n.kind===`plan`?`planned`:`carried out`,l=t?`同一任务的目标/计划与其执行记录关联。`:`The task brief or plan is linked to execution of that same task.`):i.kind===`execution`&&n.kind===`review`&&o?(s=`review`,c=t?`提交审阅`:`sent for review`,l=t?`同一个任务、同一执行段、同一轮次的执行与审查记录。`:`Execution and review belong to the same task, episode and numbered round.`):i.kind===`review`&&n.kind===`revision`&&n.eventIds.some(e=>i.eventIds.includes(e))?(s=`revision`,c=t?`提出修改`:`asked to change`,l=t?`这条修订建议来自对应的审查记录。`:`This revision was requested in the corresponding review.`):i.kind===`revision`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`修订建议之后出现了同一任务的下一轮执行;不表示建议的全部内容已被采纳。`:`A later round follows the revision request; this does not certify every requested change was applied.`):i.kind===`review`&&n.kind===`execution`&&a&&i.round!=null&&n.round!=null&&n.round>i.round?(s=`next_attempt`,c=t?`进入下一轮`:`next round`,l=t?`审阅之后出现了同一任务的下一轮执行。`:`A later round of the same task follows the review.`):i.kind===`execution`&&n.kind===`execution`&&i.round==null&&n.round!=null?(c=t?`进入第 ${n.round} 轮`:`round ${n.round} begins`,l=t?`任务开始执行后记录的一轮工作。`:`A round of work recorded after the task was taken up.`):i.kind===`result`&&n.kind===`execution`?(c=t?`再次开始`:`taken up again`,l=t?`上一次执行结束之后,这项任务又被接手。`:`The task was taken up again after an earlier execution ended.`):n.kind===`result`&&n.source===`task`?(s=`snapshot`,c=t?`最终状态`:`ended as`,l=t?`任务状态记录;部分执行过程可能缺失。`:`Links to the captured state of this task; intermediate records may be missing.`):n.kind===`result`&&[`review`,`execution`,`revision`].includes(i.kind)&&(s=`outcome`,c=t?`形成结果`:`led to`,l=t?`同一任务的后续完成/失败事件,不等同于成功认证。`:`A completion or failure event of this task, not a certification of success.`);let u=[`record_order`,`snapshot`].includes(s)||i.source===`interval`||n.source===`interval`;return(i.source===`interval`||n.source===`interval`)&&(l+=t?` 部分旧记录按唯一活动任务区间归属,因此使用虚线。`:` Some legacy observations are associated by the sole active mission window, so this link is dashed.`),{id:`link:${i.id}:${n.id}`,source:i.id,target:n.id,relation:s,label:c,explanation:l,contextual:u}})}function Is(e){let t=[],n=[];for(let r=0;r12&&(t.push(n),n=[]),n.push(...i)}return n.length&&t.push(n),t}function Ls(e,t,n,r){for(let i of[n,r]){let n={x:(i.x-t.x)/t.zoom,y:(i.y-t.y)/t.zoom},r=e.find(e=>!e.hidden&&n.x>=e.position.x&&n.x<=e.position.x+(e.width??1152)&&n.y>=e.position.y&&n.y<=e.position.y+(e.height??824));if(r)return r.id}return null}function Rs(e,t,n,r,i=Go(e,[],n),a,o=!1){let s=[],c={},l=[],u=new Map;for(let[r,i]of e.tasks.entries()){let e=Ds(i,t,n),a=i.status===`done`?ns(bo(i,t),n):``,d=i.kind===`turn`?``:Os(e,n,yo.has(i.status)),f=Is(e),p=f.length,m=e=>e===1?i.id:JSON.stringify([`part`,i.id,e]),h=0;for(let u=1;u<=p;u++){let g=f[u-1],_=m(u);if(s.push({id:_,task:i,ordinal:r+1,part:u,partCount:p,start:h+1,end:h+g.length,totalSteps:e.length,previousId:u>1?m(u-1):void 0,nextId:u1){let t=Fs([e[h-1],g[0]],n)[0];l.push({id:JSON.stringify([`continuation`,i.id,u]),source:m(u-1),target:_,kind:`continuation`,label:t?n?`继续`:`Continued`:n?`更多分支`:`More branches`,evidence:t?`${i.title} · ${t.label} · ${e[h-1].title} → ${g[0].title}`:`${i.title} · ${n?`同一任务的其他分支,不表示串行依赖。`:`Other branches of the same mission, without a serial dependency.`}`})}h+=g.length}u.set(i.id,m(p))}let d=s.slice(),f=new Map;if(a){s.length=0;for(let e of d){let t=a.has(e.task.id);if(f.set(e.id,t?e.id:e.task.id),!t&&e.part!==e.partCount)continue;let n=t?e.id:e.task.id;c[n]=c[e.id],s.push({...e,id:n,historyCount:e.partCount-1,historyExpanded:t})}}let p=e=>f.get(e)??e,m=Object.fromEntries(s.map(({id:e})=>[e,Ps(c[e])])),h=[...i.map(e=>({...e,source:p(u.get(e.source)),target:p(e.target)})),...l.filter(e=>p(e.source)!==p(e.target))],g=s.map(e=>e.id),_=JSON.stringify([g.map(e=>[e,m[e].width,m[e].height]),h.map(e=>[e.source,e.target,e.kind])]);return{cards:s,allCards:d,links:h,layouts:c,positions:r?.structure===_?r.positions:$o(g,h,m),frames:m,structure:_}}function zs({snapshot:e,view:t,events:n=[],connected:r,compact:i=!1}){let{locale:a}=I(),o=a===`zh-CN`,[s,c]=(0,U.useState)(()=>Date.now()/1e3);(0,U.useEffect)(()=>{let e=window.setInterval(()=>c(Date.now()/1e3),1e4);return()=>window.clearInterval(e)},[]);let l=Vr(e,t,n,s),u=l.activityAgeSeconds,d=l.waitingOn?``:u===null?o?`暂无本次运行的进展记录`:`No progress recorded for this run yet`:u<60?o?`刚刚有进展`:`Progress in the last minute`:u<3600?o?`${Math.floor(u/60)} 分钟前有进展`:`Progress ${Math.floor(u/60)} min ago`:o?`${Math.floor(u/3600)} 小时前有进展`:`Progress ${Math.floor(u/3600)} hr ago`;return(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-line/60 bg-panel px-4 py-2.5 text-xs`,"data-testid":`work-status`,"data-state":l.state,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r?l.state===`running`?`bg-blue`:`bg-ink-faint`:`bg-warn`}`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`font-medium text-ink`,children:Kr(l,a,r)}),d?(0,K.jsx)(`time`,{className:`text-ink-faint`,dateTime:l.activityAt?new Date(l.activityAt*1e3).toISOString():void 0,children:d}):null]}),r?!i&&l.title?(0,K.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-ink-dim`,title:l.title,children:l.title}):null:(0,K.jsx)(`p`,{className:`mt-1 leading-5 text-ink-faint`,children:o?`这里保留的是已收到的记录;连接恢复后继续更新。`:`These are the records already received. Updates resume when the connection returns.`})]})}function Bs(e,t,n){if(e.pending_question)return e.pending_question;let r=t.filter(t=>t.item_id===e.id&&(t.status===`failed`||t.success===!1||t.type.endsWith(`.failed`))).sort((e,t)=>t.ts-e.ts)[0],i=(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``),a=r?.reason||r?.text||i,o=Hi(a,n),s=o.receipt?a.lastIndexOf(o.receipt):-1,c=fs(s>=0?a.slice(0,s):a);return o.summary||c||(n?`这项任务没有完成,记录里没有写明原因。`:`This task did not finish, and the record does not say why.`)}function Vs(e){return(e.last_error||``).replace(/^manager stage (?:hold|rollback):\s*/i,``).trim()}function Hs(e,t,n,r=``){if(e.pending_question)return{reason:e.pending_question,next:n?`下一步:回答这个问题,团队才会继续。`:`Next: answer this question so the team can continue.`,detail:``,showDetail:!1};if(Do(e)){let t=Vs(e),i=r.trim();return{reason:i?n?`工作已暂停:${i}`:`Work paused: ${i}`:t?n?`工作已暂停:当前结果还没有满足要求,具体原因见下方说明。`:`Work paused: the current result does not yet meet the requirements. The reason is shown below.`:n?`工作已暂停:当前结果还没有满足要求,记录里没有说明具体原因。`:`Work paused: the current result does not yet meet the requirements. No specific reason was recorded.`,next:n?`工作不会自动继续。请看暂停原因,再在对话里告诉我接下来做什么。`:`Work will not resume on its own. Read the reason, then tell me what to do next in the conversation.`,detail:t,showDetail:!!t&&!i}}let i=Bs(e,t,n),a=Vs(e);return{reason:n?`执行失败:${i}`:`Execution failed: ${i}`,next:n?`下一步:查看原因后重试,或在对话里调整任务。`:`Next: check the reason, then retry or adjust the task in the conversation.`,detail:a&&!i.includes(a)?a:``,showDetail:!1}}var Us=(e,t=80)=>e.length>t?`${e.slice(0,t)}…`:e;function Ws(e,t,n,r=()=>``){let i=e.filter(e=>e.turn_kind!==`qa`&&e.kind!==`turn`),a=[...i].sort((e,t)=>(t.ts??0)-(e.ts??0)),o=a[0],s=o?Us((o.objective||o.title).trim()):n?`还没有任务`:`No task yet`,c=Oo(e,t),l=e=>{let t=Eo(e);return{held:n?`工作已暂停`:`work paused`,failed:n?`这项工作没有做完`:`this task did not finish`,review_unavailable:n?`结果检查没有完成`:`the result check did not finish`,done:n?`已完成`:`done`,running:n?`进行中`:`running`,pending:n?`待开始`:`planned`,question:n?`等你回答`:`waiting on you`,paused:n?`已暂停`:`paused`}[t]||(n?`还没有新的进展记录`:`No new progress has been recorded`)},u=c?n?`已确认:${Us(fs(r(c)||c.summary||c.title),160)}`:`Confirmed: ${Us(fs(r(c)||c.summary||c.title),160)}`:o?Eo(o)===`review_unavailable`?n?`这次结果检查没有完成,暂时不能确认结果。`:`The result check did not finish, so the result is not yet confirmed.`:n?`还没有经过检查确认的结果。`:`There is no checked, confirmed result yet.`:n?`还没有结果`:`No result yet`,d=i.find(e=>yo.has(e.status)),f=a.find(e=>[`question`,`held`,`failed`,`review_unavailable`].includes(Eo(e))),p=[...i].sort((e,t)=>(e.ts??0)-(t.ts??0)).find(e=>Eo(e)===`pending`);return{goal:s,current:d?n?`正在处理:${Us(d.title,70)}`:`Working on: ${Us(d.title,70)}`:o?l(o):n?`可以开始新任务`:`Ready for a new task`,conclusion:u,next:d?p?n?`待做任务:${Us(p.title,70)}`:`Queued next: ${Us(p.title,70)}`:n?`等当前工作完成,再查看检查结果。`:`Wait for the current work to finish, then check the result.`:f&&f===o?Hs(f,t,n,r(f)).next:p?n?`下一步:${Us(p.title,60)}`:`Next: ${Us(p.title,60)}`:c?n?`可以查看结果,或继续提出要求。`:`Read the result, or tell me what to do next.`:n?`还没有后续任务,可在对话里告诉我接下来做什么。`:`Nothing else is scheduled. Tell me what to do next in the conversation.`}}function Gs(e,t,n){let r=e?.model_revision&&e.model_revision!==n,i={...e?.cards};for(let[n,a]of Object.entries(t.cards)){if(r&&i[n]?.model_revision===e.model_revision)continue;let t=i[n];t?.version&&(a.version??0)(t.copy_revision??0)||(a.copy_revision??0)===(t.copy_revision??0)&&(a.generated_at>t.generated_at||a.generated_at===t.generated_at&&!t.input_revision))&&(i[n]=a)}let a=(t.cache_revision??0)<(e?.cache_revision??0);return{...e,...t,cards:i,...e?.version!=null||t.version!=null?{version:Math.max(e?.version??0,t.version??0)}:{},cache_revision:Math.max(t.cache_revision??0,e?.cache_revision??0),relations:(r||a)&&e?e.relations:t.relations,available:t.available??!0,...r?{model_revision:e.model_revision,available:e.available}:{}}}function Ks(e,t,n,r){let i=n?.cards[e.key],a=t.tasks.find(t=>t.id===e.task_id);if(!i||!a||(i.version??0)<(n?.version??0)||n?.model_revision&&i.model_revision!==n.model_revision)return!0;let o=[a.id,a.id+`:active`,a.id+`:outcome`].includes(e.key);if(o||!i.task_content_revision||!a.content_revision){if(a.revision&&i.task_revision!==a.revision||o&&i.task_status!==a.status)return!0}else if(i.task_content_revision!==a.content_revision)return!0;let s=i.event_ids||[];return e.event_ids.some(e=>{let n=s.indexOf(e),a=r?r.get(e):t.events.find(t=>t.id===e);return n<0||i.event_revisions&&a?.revision&&i.event_revisions[n]!==a.revision})||!o&&JSON.stringify(e.event_ids)!==JSON.stringify(s)}var qs=e=>`[[Argus引用 ${JSON.stringify(e)}]]\n`;function Js(e){let t=[];return{refs:t,text:e.split(` +`).filter(e=>{if(e.startsWith(`[[Argus引用 `)&&e.endsWith(`]]`))try{let n=JSON.parse(e.slice(10,-2));if(typeof n.task_id==`string`&&typeof n.source==`string`&&typeof n.task_title==`string`&&(n.part===void 0||Number.isInteger(n.part)&&n.part>0)&&(n.step_title===void 0||typeof n.step_title==`string`)&&(n.step_id===void 0||typeof n.step_id==`string`)&&(n.team_id===void 0||typeof n.team_id==`string`)&&(n.team_task_id===void 0||typeof n.team_task_id==`string`)&&(n.lang===void 0||typeof n.lang==`string`)&&Array.isArray(n.event_ids)&&n.event_ids.every(e=>typeof e==`string`))return t.push(n),!1}catch{}return!0}).join(` +`).replace(/^\n+/,``)}}function Ys(e,t,n=1/0){let r=Math.max(-1/0,...e.events.filter(e=>e.item_id===t&&e.type===`life.mission.started`&&e.ts<=n).map(e=>e.ts));return e.events.filter(e=>e.item_id===t&&e.ts>=r&&e.ts<=n&&[`round.main.completed`,`round.review.completed`].includes(e.type)).slice(-2).map(e=>e.id)}function Xs(e,t,n){return n.map(n=>({key:n.id,task_id:t.id,kind:n.kind,event_ids:[...new Set([...n.kind===`result`?Ys(e,t.id,n.ts):[],...n.eventIds])].slice(-16)}))}function Zs(e,t,n){let r=e.tasks.find(e=>e.id===n),i=(r?[r,...e.tasks.filter(e=>e.id!==n)]:e.tasks).map(t=>({key:t.id,task_id:t.id,kind:`task`,event_ids:[...new Set([...Ys(e,t.id),...e.events.filter(e=>e.item_id===t.id).slice(-2).map(e=>e.id)])]})),a=r?Xs(e,r,t):[];return[...i.slice(0,1),...a,...i.slice(1)]}var Qs=/Info: (?:Operation cancelled by user|Response was interrupted due to a server error\. Retrying\.\.\.)/gi;function $s({ev:e,r:t,first:n,last:r,latest:i,repeat:a=1,status:o=``,result:s}){let{locale:c,t:l}=I(),u=R.role[t.role]??R.inkFaint,d=je(t.tone),f=e.type===`engineer.progress`&&String(e.kind||``)===`tool_use`,p=[`agent_message`,`assistant_message`,`message`].includes(String(e.kind||``))?fs(t.text):t.text,m=f?{text:Ka(e,c),technical:t.text}:fa(p,c),h=s?fa(s.r.text,c).text:``,g=[m.technical,h?`${l(`stream.stepResult`)}: ${h}`:``].filter(Boolean).join(` +`);return(0,K.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${r?`animate-appear`:``} ${t.reasoning?`opacity-60`:``}`,style:t.rule?{marginTop:4}:void 0,children:[(0,K.jsxs)(`div`,{className:`relative flex justify-center`,children:[n?null:(0,K.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),r?null:(0,K.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,K.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:u,boxShadow:`0 0 0 1px ${u}55`}})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:u},title:t.label,children:t.label}),(0,K.jsx)(`span`,{className:`text-xs`,style:{color:d},children:t.glyph}),a>1?(0,K.jsxs)(`span`,{className:`rounded bg-line/60 px-1 font-mono text-[10px] tabular-nums text-ink-dim`,title:l(`stream.repeated`,{count:a}),"data-repeat":a,children:[`×`,a]}):null,o===`failed`?(0,K.jsx)(`span`,{className:`text-xs text-err`,children:l(`stream.stepFailed`)}):null,(0,K.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:dt(i??e)})]}),(0,K.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5 ${t.reasoning?`italic`:``}`,style:{color:d},title:g||void 0,children:m.text})]})]})}function ec({group:e,first:t,last:n,open:r,onToggle:i}){let{locale:a,t:o}=I(),s=R.role[e.r.role]??R.inkFaint,c=je(e.r.tone),l=Za(e,o,a);return(0,K.jsxs)(`div`,{className:`event-activity-row group relative grid grid-cols-[16px_minmax(0,1fr)] gap-3 px-4 py-3 transition-colors hover:bg-bg/70 ${n?`animate-appear`:``}`,"data-feed-group":e.action,"data-open":r?`true`:`false`,children:[(0,K.jsxs)(`div`,{className:`relative flex justify-center`,children:[t?null:(0,K.jsx)(`span`,{className:`absolute -top-2.5 h-4 w-px bg-line/60`}),n?null:(0,K.jsx)(`span`,{className:`absolute -bottom-2.5 top-2 w-px bg-line/60`}),(0,K.jsx)(`span`,{className:`relative z-10 mt-1.5 h-2 w-2 rounded-full border-2 border-panel`,style:{backgroundColor:s,boxShadow:`0 0 0 1px ${s}55`}})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":r,title:o(r?`stream.fold.collapse`:`stream.fold.expand`),className:`block w-full rounded text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-blue-sky`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-[0.06em]`,style:{color:s},title:e.r.label,children:e.r.label}),(0,K.jsx)(`span`,{className:`text-xs`,style:{color:c},children:e.r.glyph}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-ink-faint`,children:e.calls}),(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,K.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})}),(0,K.jsx)(`time`,{className:`ml-auto font-mono text-xs tabular-nums text-ink-faint opacity-0 transition-opacity group-hover:opacity-100`,children:dt(e.latest)})]}),(0,K.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap break-words text-sm leading-5`,style:{color:c},children:l})]}),r?(0,K.jsx)(`div`,{className:`mt-1 border-l border-line/50`,children:e.steps.map((t,n)=>(0,K.jsx)($s,{ev:t.ev,r:t.r,first:n===0,last:n===e.steps.length-1,latest:t.latest,repeat:t.repeat,status:t.status,result:t.result},t.key))}):null]})]})}function tc({rows:e}){let[t,n]=(0,U.useState)(()=>new Set),r=e=>n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,K.jsx)(K.Fragment,{children:e.map((n,i)=>n.kind===`group`?(0,K.jsx)(ec,{group:n,first:i===0,last:i===e.length-1,open:t.has(n.key),onToggle:()=>r(n.key)},n.key):(0,K.jsx)($s,{ev:n.ev,r:n.r,first:i===0,last:i===e.length-1,latest:n.latest,repeat:n.repeat,status:n.status,result:n.result},n.key))})}function nc({ev:e,r:t,artifacts:n,onOpenArtifact:r}){let{t:i,locale:a}=I(),o=String(e.type)===`ui.operator`,s=!o&&e.mission_result===!0,c=s&&typeof e.text==`string`?e.text:t.text,l=s?pa(c,a):null,u=s?ft(e):null,d=o?Js(t.text):null,f=d?.refs??[],p=d&&f.length?d.text:t.text,m=o?[]:lo(e.steps),h=Number(e.response_latency_ms??0),g=!o&&h>=100?` · ${(h/1e3).toFixed(1)}s`:``,_=(0,U.useRef)(null);return qe(_,(e,t)=>{_.current&&(t||e.fromTo(_.current,{autoAlpha:0,x:o?12:0,y:o?0:8},{autoAlpha:1,x:0,y:0,duration:.28,ease:`power2.out`,clearProps:`transform,opacity,visibility`}))}),(0,K.jsx)(`article`,{ref:_,"data-task-receipt":s||void 0,"data-task-receipt-id":s?String(e.message_id||e.event_id||``):void 0,className:`conversation-row group mx-auto w-full max-w-full px-4 py-3 sm:px-6 lg:max-w-[61.8vw]`,children:o?(0,K.jsxs)(`div`,{className:`flex items-end justify-end gap-2`,children:[(0,K.jsx)(Be,{text:t.text,label:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,K.jsx)(`time`,{className:`shrink-0 pb-1 font-mono text-[10px] tabular-nums text-ink-faint`,children:dt(e)}),(0,K.jsxs)(`div`,{className:`max-w-[calc(100%_-_3rem)] rounded-[18px] bg-conversation-user px-4 py-2.5 text-[15px] leading-relaxed text-ink ring-1 ring-line/35 sm:max-w-[82%]`,children:[f.length?(0,K.jsx)(`div`,{className:`mb-2 space-y-2`,children:f.map((e,t)=>(0,K.jsxs)(`blockquote`,{"aria-label":a===`zh-CN`?`引用`:`Reference`,className:`border-l-2 border-blue/40 pl-3 text-sm text-ink-dim`,children:[(0,K.jsxs)(`div`,{className:`text-xs text-ink-faint`,children:[a===`zh-CN`?`引用`:`Reference`,e.part?` · ${a===`zh-CN`?`第 ${e.part} 部分`:`Part ${e.part}`}`:``]}),(0,K.jsx)(`div`,{className:`font-medium`,children:e.task_title||e.step_title||e.task_id}),e.task_title&&e.step_title&&e.step_title!==e.task_title?(0,K.jsx)(`div`,{children:e.step_title}):null]},`${e.source}:${e.task_id}:${e.step_id}:${t}`))}):null,p?(0,K.jsx)(Ke,{artifacts:n,onOpenArtifact:r,children:p}):null]})]}):(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center`,children:(0,K.jsx)(_t,{size:26,className:`text-ink`})}),(0,K.jsxs)(`div`,{className:`relative min-w-0 flex-1 text-[15px] leading-relaxed text-ink`,children:[(0,K.jsxs)(`div`,{"data-task-receipt-header":s||void 0,className:s?`sticky -top-1.5 z-10 mb-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 bg-panel py-1`:`mb-1 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-xs font-semibold text-blue`,children:me().name}),s?(0,K.jsx)(`span`,{className:`text-[11px] text-ink-dim`,children:a===`zh-CN`?`任务回报 · 当时记录`:`Task report · Recorded then`}):null,(0,K.jsx)(Be,{text:c,label:l?a===`zh-CN`?`复制原始回报`:`Copy original report`:i(`copy.message`),copiedLabel:i(`copy.copied`),className:`ml-auto opacity-60 sm:opacity-0 sm:group-hover:opacity-100`}),(0,K.jsxs)(`time`,{className:`font-mono text-[10px] tabular-nums text-ink-faint ${s?`basis-full sm:basis-auto`:``}`,dateTime:u?.toISOString(),title:u?.toLocaleString(a,{dateStyle:`full`,timeStyle:`long`}),children:[u?u.toLocaleString(a,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):dt(e),g]})]}),c?(0,K.jsx)(`div`,{"data-task-receipt-prose":s||void 0,children:(0,K.jsx)(Ke,{artifacts:n,onOpenArtifact:r,children:l?.text??c})}):null,m.length||e.live===!0?(0,K.jsx)(vo,{steps:m,live:e.live===!0,startedTs:Number(e.ts),status:e.success===!1?`failed`:String(e.status??``)}):null,l?(0,K.jsx)(nt,{className:`task-receipt-original`,label:a===`zh-CN`?`查看原始回报(含技术记录)`:`View original report (including technical records)`,children:(0,K.jsx)(`pre`,{"data-task-receipt-original":!0,className:`mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs text-ink-dim`,children:c})}):null]})]})})}function rc({role:e,rows:t,open:n,active:r,onToggle:i}){let{t:a,locale:o}=I(),s=R.role[e],c=(0,U.useRef)(null),l=(0,U.useRef)(!0),u=(0,U.useRef)(0),[d,f]=(0,U.useState)(!1),p=t[t.length-1]?.r.text.length??0,m=(0,U.useMemo)(()=>Xa(t,o),[t,o]),h=m.length?Qa(m[m.length-1],a,o):``;return(0,U.useEffect)(()=>{n&&!l.current&&c.current&&(c.current.scrollTop=u.current)},[n]),(0,U.useEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{l.current&&c.current&&(c.current.scrollTop=c.current.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[n,t.length,p]),(0,K.jsxs)(`section`,{className:`role-log-group border-b border-line/50`,"data-role":e,"data-open":n?`true`:`false`,"data-active":r?`true`:`false`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":n,className:`group flex h-11 w-full items-center gap-2 px-4 text-left transition-colors hover:bg-bg/60`,children:[(0,K.jsx)(`span`,{"data-role-dot":e,"aria-hidden":`true`,className:`h-2 w-2 shrink-0 rounded-full ${r?`animate-pulse motion-reduce:animate-none`:``}`,style:{background:s}}),(0,K.jsx)(`span`,{className:`text-xs font-semibold text-ink-dim`,children:yn(e,a)}),(0,K.jsx)(`span`,{className:`font-mono text-xs text-ink-faint`,children:m.length}),h?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:h}):(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-ink-faint transition-transform duration-panel ease-panel ${n?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,K.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),n?(0,K.jsx)(`div`,{className:`grid grid-rows-[1fr]`,children:(0,K.jsxs)(`div`,{className:`relative min-h-0 overflow-hidden`,children:[(0,K.jsx)(`div`,{ref:c,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollTop,l.current=t.scrollHeight-t.scrollTop-t.clientHeight<=2,f(!l.current)},className:`max-h-72 overflow-x-hidden overflow-y-auto border-t border-line/40 scroll-thin`,children:m.length>0?(0,K.jsx)(tc,{rows:m}):(0,K.jsx)(`div`,{className:`px-4 py-3 text-xs text-ink-faint`,children:a(`stream.noLogs`)})}),d?(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{l.current=!0,f(!1),c.current&&(c.current.scrollTop=c.current.scrollHeight)},className:`absolute bottom-2 right-3 rounded-full border border-line/60 bg-panel px-3 py-1 text-xs text-ink-dim shadow-glow hover:text-ink`,children:[`↓ `,a(`stream.jumpToLatest`)]}):null]})}):null]})}function ic(e){let t={manager:[],planner:[],engineer:[],reviewer:[]},n=[];return e.forEach(e=>{He.includes(e.r.role)?t[e.r.role].push(e):n.push(e)}),{roleRows:t,systemRows:n,lastRole:[...e].reverse().find(e=>He.includes(e.r.role))?.r.role??``}}function ac({rows:e}){let{t,locale:n}=I(),[r,i]=(0,U.useState)(!1),a=(0,U.useMemo)(()=>Xa(e,n),[e,n]);return(0,K.jsxs)(`section`,{className:`border-b border-line/50`,"data-system-open":r?`true`:`false`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex h-10 w-full items-center gap-2 px-4 text-left text-xs text-ink-faint hover:bg-bg/60`,children:[(0,K.jsx)(`span`,{children:t(`stream.system`)}),(0,K.jsx)(`span`,{className:`font-mono`,children:a.length}),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4 shrink-0 transition-transform duration-panel ease-panel ${r?`rotate-90`:``}`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,children:(0,K.jsx)(`path`,{d:`m6 3.5 4.5 4.5L6 12.5`})})]}),r?(0,K.jsx)(`div`,{className:`border-t border-line/40`,children:(0,K.jsx)(tc,{rows:a})}):null]})}function oc({rows:e,live:t,followLatest:n,activeRole:r,activeTaskId:i}){let{roleRows:a,systemRows:o,lastRole:s}=(0,U.useMemo)(()=>ic(e),[e]),[c,l]=(0,U.useState)(()=>new Set(n&&s?[s]:[])),u=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{!n||!s||u.current||l(new Set([s]))},[s,n]),(0,K.jsxs)(`div`,{className:`bg-bg/25`,children:[He.map(e=>(0,K.jsx)(rc,{role:e,rows:a[e],open:c.has(e),active:t&&(r??s)===e&&(!i||a[e].some(e=>Ir(e.ev)===i)),onToggle:()=>{u.current=!0,l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}},e)),o.length>0?(0,K.jsx)(ac,{rows:o}):null]})}function sc(e){let t=e.delivery;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.delivery_id!=`string`||!n.delivery_id.trim()?null:n}function cc(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.type===`ui.operator`)return null;let r=sc(n);if(r)return r}}function lc({delivery:e,onOpen:t}){let{t:n}=I(),r=e.kind===`submission_certified`;return(0,K.jsxs)(`aside`,{className:`mx-auto my-3 flex w-full max-w-full gap-3 rounded-lg border border-ok/35 bg-ok/5 px-4 py-3 lg:max-w-[61.8vw]`,children:[(0,K.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-ok/15 font-semibold text-ok`,children:`✓`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-ok`,children:n(r?`mission.deliveryCertified`:`mission.taskCompleted`)}),(0,K.jsx)(`div`,{className:`mt-1 truncate text-sm font-semibold text-ink`,title:e.title,children:e.title}),t?(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`mt-2 rounded border border-ok/40 px-2 py-1 font-mono text-[10px] text-ok hover:border-ok hover:bg-ok/10`,children:n(e.primary_target?`mission.openResult`:`mission.viewTask`)}):null]})]})}function uc({group:e,artifacts:t,onOpenArtifact:n,onOpenDelivery:r}){let i=e=>e.ev.type===`ui.argus`&&/^(info:|operation cancelled|cancelled\b)/i.test(e.r.text.trim()),a=e.rows.filter(e=>e.ev.type===`ui.argus`).map(e=>{if(e.ev.mission_result===!0)return{reply:e,messages:[]};let t=e.r.text.match(Qs)??[],n=e.r.text.replace(Qs,``).trim(),r=e.ev.live===!0||Array.isArray(e.ev.steps)&&e.ev.steps.length>0;return{reply:(n||r)&&!i(e)?{...e,r:{...e.r,text:n}}:null,messages:i(e)&&t.length===0?[e.r.text]:t}}),o=a.flatMap(e=>e.reply?[e.reply]:[]),s=a.flatMap(e=>e.messages),c=(()=>{let t=new Set;return e.rows.flatMap(e=>{let n=sc(e.ev);return!n||t.has(n.delivery_id)?[]:(t.add(n.delivery_id),[n])})})();return(0,K.jsxs)(`section`,{className:`conversation-thread border-b border-line/60`,children:[(0,K.jsx)(nc,{ev:e.operator.ev,r:e.operator.r,artifacts:t,onOpenArtifact:n}),o.map(e=>(0,K.jsx)(nc,{ev:e.ev,r:e.r,artifacts:t,onOpenArtifact:n},e.key)),s.map((t,n)=>(0,K.jsx)(`div`,{className:`mx-auto w-full max-w-full px-6 py-1.5 text-center text-xs text-ink-faint lg:max-w-[61.8vw]`,children:t},`${e.key}-system-${n}`)),c.map(e=>(0,K.jsx)(lc,{delivery:e,onOpen:r},e.delivery_id))]})}function dc({events:e,connected:t,showReasoning:n,onToggleReasoning:r,embedded:i=!1,showHeader:a=!0,filter:o=`all`,query:s=``,skipFirst:c=0,artifacts:l,onOpenArtifact:u,onOpenDelivery:d,snapshot:f,missionView:p,historyStatus:m=`ready`,historyRefreshing:h=!1,onRetryHistory:g}){let{locale:_,t:v}=I(),[y,b]=(0,U.useState)(!0),x=(0,U.useRef)(!0),S=(0,U.useRef)(0),[C,w]=(0,U.useState)(()=>Date.now()),T=(0,U.useRef)(null),E=(0,U.useRef)(null),D=(0,U.useDeferredValue)(e),O=(0,U.useMemo)(()=>f?Vr(f,p,D):null,[D,p,f]),k=t&&(!f||O?.state===`running`),A=(0,U.useMemo)(()=>f||!t?null:Rr(D),[t,D,f]);(0,U.useEffect)(()=>{if(!A)return;w(Date.now());let e=window.setInterval(()=>w(Date.now()),1e3);return()=>window.clearInterval(e)},[A]);let j=A?Math.max(0,Math.floor((C-Number(A.ts??0)*1e3)/1e3)):0,M=(0,U.useMemo)(()=>ba(c>0?D.slice(c):D,{locale:_,showReasoning:n,filter:o,query:s}),[D,n,o,s,c,_]),N=(0,U.useMemo)(()=>{let e=[],t=[],n=[],r=null;M.list.forEach(i=>{i.ev.type===`ui.operator`?(r={key:i.key,operator:i,rows:[]},e.push(r)):i.ev.type===`ui.argus`?r?r.rows.push(i):t.push(i):n.push(i)});let i=new Set(M.list.filter(e=>e.ev.type===`ui.argus`).map(e=>sc(e.ev)?.delivery_id).filter(Boolean));return{groups:e,earlierReplies:t,projectWork:n,projectDeliveries:n.flatMap(e=>{let t=sc(e.ev);return!t||i.has(t.delivery_id)?[]:(i.add(t.delivery_id),[t])})}},[M.list]),ee=(0,U.useMemo)(()=>D.filter(Ee).length,[D]),P=(0,U.useMemo)(()=>M.list.slice(-20).reduce((e,t)=>e+t.r.text.length,0),[M.list]);return(0,U.useEffect)(()=>{if(!y)return;let e=window.requestAnimationFrame(()=>{x.current&&T.current&&(T.current.scrollTop=T.current.scrollHeight,S.current=T.current.scrollTop)});return()=>window.cancelAnimationFrame(e)},[M.list.length,P,y]),(0,U.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<40;x.current=t||x.current&&e.scrollTop>=S.current-1,S.current=e.scrollTop,b(x.current)};e.addEventListener(`scroll`,t,{passive:!0});let n=null,r=new ResizeObserver(()=>{x.current&&(n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,x.current&&(e.scrollTop=e.scrollHeight,S.current=e.scrollTop)}))});return r.observe(e),E.current&&r.observe(E.current),()=>{e.removeEventListener(`scroll`,t),r.disconnect(),n!==null&&window.cancelAnimationFrame(n)}},[]),(0,K.jsxs)(`section`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden bg-panel ${i?``:`rounded-lg border border-line/80`}`,children:[a&&(0,K.jsx)(et,{title:v(`panel.activity`),right:(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[N.projectWork.length>0?(0,K.jsx)(`button`,{type:`button`,onClick:()=>{x.current=!1,b(!1),T.current?.scrollTo({top:0,behavior:`auto`})},className:`rounded px-1.5 py-0.5 text-xs text-blue-sky hover:bg-bg`,children:_===`zh-CN`?`查看工作进展`:`View work progress`}):null,(0,K.jsxs)(`button`,{onClick:r,className:`rounded px-1.5 py-0.5 text-xs transition-colors ${n?`text-blue-sky`:`text-ink-faint hover:text-ink-dim`}`,title:v(`stream.toggleReasoning`),children:[v(`stream.reasoning`),ee?` ·${ee}`:``]}),(0,K.jsx)(`span`,{className:`text-xs ${t?`text-ok`:`text-ink-faint`}`,children:t?`● ${v(`common.live`)}`:`○ ${v(`common.reconnecting`)}`})]})}),f?(0,K.jsx)(zs,{snapshot:f,view:p,events:D,connected:t,compact:!0}):A?(0,K.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-line/60 bg-blue-deep/5 px-4 text-xs text-ink-dim`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-blue-sky`}),(0,K.jsx)(`span`,{className:`truncate`,children:v(`stream.backgroundWork`)}),(0,K.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono tabular-nums text-ink-faint`,children:[j,`s`]})]}):null,m===`ready`?null:(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 px-4 py-3 text-sm text-ink-faint`,role:m===`error`?`alert`:`status`,"data-conversation-history":m,children:[(0,K.jsx)(`span`,{children:v(m===`error`?`stream.historyError`:`stream.historyLoading`)}),m===`error`&&g?(0,K.jsx)(`button`,{type:`button`,onClick:g,disabled:h,className:`shrink-0 rounded px-2 py-1 text-blue-sky hover:bg-bg disabled:opacity-50`,children:v(`stream.historyRetry`)}):null]}),(0,K.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto pb-6 pt-1.5 scroll-thin`,"aria-busy":m===`loading`,children:(0,K.jsx)(`div`,{ref:E,className:`flow-root`,"data-event-stream-content":!0,children:M.list.length===0?m===`ready`?(0,K.jsx)(Ve,{children:v(`stream.ready`)}):null:(0,K.jsxs)(K.Fragment,{children:[N.projectWork.length>0?(0,K.jsxs)(`section`,{"data-project-work":!0,className:`mx-auto w-full max-w-full border-b border-line/60 lg:max-w-[61.8vw]`,children:[(0,K.jsxs)(`div`,{className:`flex h-10 items-center gap-2 border-b border-line/40 px-4 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink-faint`,children:[_===`zh-CN`?`项目工作进展`:`Project work progress`,(0,K.jsx)(`span`,{className:`font-mono font-normal tracking-normal`,children:N.projectWork.length})]}),(0,K.jsx)(oc,{rows:N.projectWork,live:k,followLatest:!0,activeRole:O?.role,activeTaskId:O?.taskId}),N.projectDeliveries.map(e=>(0,K.jsx)(lc,{delivery:e,onOpen:d},e.delivery_id))]},`project-work`):null,N.earlierReplies.map(e=>(0,K.jsx)(nc,{ev:e.ev,r:e.r,artifacts:l,onOpenArtifact:u},e.key)),N.groups.map(e=>(0,K.jsx)(uc,{group:e,artifacts:l,onOpenArtifact:u,onOpenDelivery:d},e.key))]})})}),!y&&(0,K.jsx)(`button`,{onClick:()=>{x.current=!0,b(!0),T.current&&(T.current.scrollTo({top:T.current.scrollHeight,behavior:`auto`}),S.current=T.current.scrollTop)},"aria-label":v(`stream.jumpToLatest`),title:v(`stream.jumpToLatest`),className:`absolute bottom-4 left-1/2 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-line/60 bg-panel text-sm text-ink-dim shadow-glow transition-all duration-200 hover:border-ink-faint hover:text-ink`,children:`↓`})]})}function fc(e){return e.nativeEvent.isComposing||e.keyCode===229}var pc=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function mc(e){return pc[e%pc.length]}var hc=[{id:`status`,name:`/status`,argument:`none`,desc:`roles, queued work, journal, and health`,group:`Everyday`,kind:`panel`},{id:`roles`,name:`/roles`,argument:`none`,desc:`per-role backend / model / effort + live activity`,group:`Everyday`,kind:`panel`},{id:`journal`,name:`/journal`,arg:`[N]`,argument:`optional`,desc:`recent journal entries (default 10)`,group:`Everyday`,kind:`panel`},{id:`backlog`,name:`/backlog`,arg:`[all]`,argument:`optional`,desc:`pending tasks (all = incl. done/skipped)`,group:`Everyday`,kind:`panel`},{id:`artifacts`,name:`/artifacts`,argument:`none`,desc:`result files the Reviewer has checked (Enter previews)`,group:`Everyday`,kind:`panel`},{id:`artifact`,name:`/artifact`,arg:``,argument:`required`,desc:`preview one reviewed result file`,group:`Everyday`,kind:`panel`},{id:`events`,name:`/events`,arg:`[filter] [query]`,argument:`optional`,desc:`search feed: all / watch / milestones / messages`,group:`Everyday`,kind:`panel`},{id:`find`,name:`/find`,arg:``,argument:`required`,desc:`search the current event buffer`,group:`Everyday`,kind:`panel`},{id:`cancel`,name:`/cancel`,argument:`none`,desc:`stop waiting for the current Manager reply`,group:`Everyday`,kind:`local`},{id:`ask`,name:`/ask`,arg:``,argument:`required`,desc:`answer inline — no task queued, no Planner/Engineer/Reviewer`,aliases:[`/chat`],group:`Everyday`,kind:`action`},{id:`crystalpilot`,name:`/crystalpilot`,arg:`[status|off|use ]`,argument:`optional`,desc:`enable crystallography tools in this Argus conversation`,group:`Everyday`,kind:`action`},{id:`task`,name:`/task`,arg:``,argument:`required`,desc:`queue work directly`,aliases:[`/add`],group:`Task management`,kind:`action`},{id:`plan`,name:`/plan`,arg:``,argument:`required`,desc:`preview a Planner-authored execution plan`,group:`Task management`,kind:`action`},{id:`rewrite`,name:`/rewrite`,arg:`[text]`,argument:`optional`,desc:`let the Manager rewrite your prompt before sending`,aliases:[`/refine`],group:`Task management`,kind:`action`},{id:`nudge`,name:`/nudge`,arg:``,argument:`required`,desc:`inject guidance into the running mission`,aliases:[`/inject`,`/notify`],group:`Task management`,kind:`action`},{id:`abort`,name:`/abort`,argument:`none`,desc:`immediately stop the running mission`,group:`Task management`,kind:`action`},{id:`note`,name:`/note`,arg:``,argument:`required`,desc:`append a manual note to the timeline`,group:`Task management`,kind:`action`},{id:`done`,name:`/done`,arg:``,argument:`required`,desc:`mark a task done`,group:`Task management`,kind:`action`},{id:`skip`,name:`/skip`,arg:``,argument:`required`,desc:`skip a task`,aliases:[`/rm`],group:`Task management`,kind:`action`},{id:`stop`,name:`/stop`,arg:``,argument:`required`,desc:`stop a task's auto-iteration`,group:`Task management`,kind:`action`},{id:`item`,name:`/item`,arg:``,argument:`required`,desc:`inspect a full task contract`,group:`Task management`,kind:`panel`},{id:`run`,name:`/run`,argument:`none`,desc:`return to the always-live mission feed`,group:`Task management`,kind:`local`},{id:`new`,name:`/new`,arg:`[objective]`,argument:`optional`,desc:`review, create, and switch to a fresh conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`daemons`,name:`/daemons`,arg:`[query]`,argument:`optional`,desc:`find every session + switch or create`,group:`Sessions & diagnostics`,kind:`panel`},{id:`resume`,name:`/resume`,arg:`[list|]`,argument:`optional`,desc:`switch to another project/session`,group:`Sessions & diagnostics`,kind:`action`},{id:`attach`,name:`/attach`,arg:``,argument:`required`,desc:`follow another project (read the stream)`,group:`Sessions & diagnostics`,kind:`action`},{id:`rename`,name:`/rename`,arg:``,argument:`required`,desc:`rename the current conversation`,group:`Sessions & diagnostics`,kind:`action`},{id:`doctor`,name:`/doctor`,argument:`none`,desc:`diagnose 'why isn't anything running'`,group:`Sessions & diagnostics`,kind:`panel`},{id:`backend`,name:`/backend`,arg:`[codex|claude|copilot|cursor|opencode|pi|grok|qoder|dsh]`,argument:`optional`,desc:`view or change the shared runner backend`,group:`Configuration`,kind:`action`},{id:`config`,name:`/config`,arg:`[key=value …]`,argument:`optional`,desc:`view or change runtime settings`,group:`Configuration`,kind:`panel`},{id:`identity`,name:`/identity`,arg:`[set ]`,argument:`optional`,desc:`view or replace the operator identity card`,group:`Configuration`,kind:`panel`},{id:`reset`,name:`/reset`,argument:`none`,desc:`drop the warm Manager conversation context`,group:`Configuration`,kind:`action`},{id:`skills`,name:`/skills`,arg:`[ls|promote ]`,argument:`optional`,desc:`inspect or promote runtime skills`,group:`Configuration`,kind:`action`},{id:`clear`,name:`/clear`,argument:`none`,desc:`clear the event feed view`,group:`Other`,kind:`local`},{id:`reconnect`,name:`/reconnect`,argument:`none`,desc:`reconnect the live event stream`,group:`Other`,kind:`local`},{id:`help`,name:`/help`,argument:`none`,desc:`keys + full command reference`,aliases:[`/?`,`/commands`],group:`Other`,kind:`local`},{id:`quit`,name:`/quit`,argument:`none`,desc:`leave the cockpit (background work keeps running)`,aliases:[`/exit`,`/q`],group:`Other`,kind:`local`}];new Map(hc.map(e=>[e.id,e]));var gc=new Map;for(let e of hc)for(let t of[e.name,...e.aliases??[]])gc.set(t.toLowerCase(),e);function _c(e){return e.argument===`required`}var vc=/^\/[A-Za-z0-9_-]+$/;function yc(e){if(!e.startsWith(`/`))return!1;let t=e.indexOf(` `),n=t===-1?e:e.slice(0,t);return vc.test(n)}function bc(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.slice(1).includes(`/`)}function xc(e){if(!bc(e))return[];let t=e.toLowerCase(),n=new Set,r=[];for(let e of hc)[e.name,...e.aliases??[]].some(e=>e.toLowerCase().startsWith(t))&&!n.has(e.name)&&(n.add(e.name),r.push(e));return r.sort((e,n)=>Number(Sc(n,t))-Number(Sc(e,t)))}function Sc(e,t){return[e.name,...e.aliases??[]].some(e=>e.toLowerCase()===t)}function Cc(e){return e.arg?`${e.name} `:e.name}function wc(e){let t=e.trim();if(!t)return{filter:`all`,query:``};let[n,...r]=t.split(/\s+/);return n.toLowerCase()===`watch`?{filter:`attention`,query:r.join(` `)}:ie.includes(n.toLowerCase())?{filter:n.toLowerCase(),query:r.join(` `)}:{filter:`all`,query:t}}function Tc(e){if(!yc(e))return null;let t=e.indexOf(` `),n=(t===-1?e:e.slice(0,t)).toLowerCase(),r=t===-1?``:e.slice(t+1).trim(),i=gc.get(n)??null;return{cmd:i,name:i?i.name:n,rest:r}}function Ec(e){let t=e.toLowerCase(),n=null,r=0;for(let e of gc.keys()){let i=Dc(t,e);i>r&&(r=i,n=gc.get(e).name)}return r>=.6?n:null}function Dc(e,t){return 1-Oc(e,t)/(Math.max(e.length,t.length)||1)}function Oc(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},(e,t)=>[t,...Array(r).fill(0)]);for(let e=0;e<=r;e+=1)i[0][e]=e;for(let a=1;a<=n;a+=1)for(let n=1;n<=r;n+=1)i[a][n]=Math.min(i[a-1][n]+1,i[a][n-1]+1,i[a-1][n-1]+(e[a-1]===t[n-1]?0:1));return i[n][r]}function kc(e,t=!1,n=!1){return(t||n)&&e.toLowerCase()===`r`}var Ac={Everyday:`常用`,"Task management":`任务管理`,"Sessions & diagnostics":`会话与诊断`,Configuration:`配置`,Other:`其他`},jc={crystalpilot:`在当前 Argus 会话启用晶体学工具,保持原生界面`,status:`查看角色、队列、日志和健康状态`,roles:`查看各角色的后端、模型、推理强度和实时活动`,journal:`查看近期日志(默认 10 条)`,backlog:`查看待处理任务(all 包含已完成和已跳过)`,artifacts:`查看 Reviewer 批准的结果文件(按 Enter 预览)`,artifact:`预览一个已批准的结果文件`,events:`搜索动态:all / watch / milestones / messages`,find:`搜索当前事件缓冲区`,cancel:`停止等待当前 Manager 回复`,ask:`直接回答,不排任务、不走 Planner/Engineer/Reviewer`,task:`直接加入任务队列`,plan:`预览 Planner 编写的执行计划`,rewrite:`让 Manager 在发送前改写提示词`,nudge:`向正在运行的任务注入指导`,abort:`立即终止正在运行的任务`,note:`向时间线添加手动备注`,done:`将任务标记为完成`,skip:`跳过任务`,stop:`停止任务的自动迭代`,item:`查看完整任务契约`,run:`返回持续更新的任务动态`,new:`检查、创建并切换到新会话`,daemons:`查找全部会话并切换或创建`,resume:`切换到其他项目或会话`,attach:`跟随其他项目并读取其动态`,rename:`重命名当前会话`,doctor:`诊断为什么没有任务运行`,backend:`查看或更改共享 Runner 后端`,config:`查看或更改运行时设置`,identity:`查看或替换操作者身份卡`,reset:`清除 Manager 的热会话上下文`,skills:`查看或提升运行时 Skill`,clear:`清空事件动态视图`,reconnect:`重新连接实时动态`,help:`查看快捷键和完整命令参考`,quit:`离开控制台(后台工作继续运行)`};function Mc(e,t){return t===`zh-CN`?jc[e.id]:e.id===`reconnect`?`reconnect live activity`:e.desc}function Nc(e,t){return t===`zh-CN`?Ac[e.group]:e.group}function Pc(e,t){let n=new Map;for(let r of e){let e=Nc(r,t),i=r.aliases?.length?` (= ${r.aliases.join(`, `)})`:``,a=`${r.name}${r.arg?` ${r.arg}`:``}${i}`;n.has(e)||n.set(e,[]),n.get(e).push({label:a,desc:Mc(r,t)})}return[...n.entries()].map(([e,t])=>({group:e,rows:t}))}var Fc=`slash-completion-listbox`;function Ic(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function Lc(e){return`slash-completion-option-${e}`}function Rc({query:e,selected:t,onSelect:n}){let{locale:r,t:i}=I(),a=xc(e);if(a.length===0)return null;let o=a.slice(0,8),s=Ic(t,o.length);return(0,K.jsx)(`div`,{id:Fc,role:`listbox`,"aria-label":i(`slash.suggestions`),className:`slash-completion-menu scroll-thin border-b border-line/40`,children:o.map((e,t)=>(0,K.jsxs)(`button`,{id:Lc(e.id),type:`button`,role:`option`,"aria-selected":t===s,onPointerDown:e=>{e.preventDefault(),n(t)},className:`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-sm transition-colors ${t===s?`bg-blue/10 text-ink`:`text-ink-dim hover:bg-line/20`}`,children:[(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-blue`,children:e.name}),e.arg?(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-ink-faint`,children:e.arg}):null,(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-ink-faint`,children:Mc(e,r)})]},e.id))})}var zc=32e3,Bc=10485760,Vc=26214400,Hc=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.pdf`,`.md`,`.markdown`,`.txt`,`.json`,`.csv`].join(`,`),Uc={".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".webp":`image/webp`,".pdf":`application/pdf`,".md":`text/markdown`,".markdown":`text/markdown`,".txt":`text/plain`,".json":`application/json`,".csv":`text/csv`};function Wc(e){let t=String(e||``).trim().toLowerCase(),n=t.lastIndexOf(`.`);return n>=0?t.slice(n):``}function Gc(e){return Uc[Wc(e.name)]||String(e.type||``).split(`;`,1)[0].trim()||`application/octet-stream`}function Kc(e){return Object.hasOwn(Uc,Wc(e.name))}function qc(e){return Gc(e).startsWith(`image/`)}function Jc(e){return[e.name,String(e.size),Gc(e),String(e.lastModified??``)].join(`::`)}function Yc(e,t){let n=[],r=[],i=new Set(e.map(Jc)),a=e.reduce((e,t)=>e+Math.max(0,t.size||0),0),o=e.length;for(let e of t){let t=Jc(e);if(!i.has(t)){if(i.add(t),!Kc(e)){r.push({code:`unsupported`,fileName:e.name});continue}if(o>=5){r.push({code:`too-many`,limitCount:5});continue}if(e.size>10485760){r.push({code:`too-large`,fileName:e.name,limitBytes:Bc});continue}if(a+e.size>26214400){r.push({code:`too-large-total`,limitBytes:Vc});continue}n.push(e),a+=e.size,o+=1}}return{accepted:n,issues:r}}function Xc(e){return e?Array.from(e):[]}function Zc(e){return Xc(e?.types).map(e=>String(e)).includes(`Files`)||Qc(e).length>0}function Qc(e){let t=Xc(e?.files).filter(e=>e instanceof File);if(t.length)return t;let n=[];for(let t of Xc(e?.items)){if(String(t?.kind||``)!==`file`||typeof t?.getAsFile!=`function`)continue;let e=t.getAsFile();e instanceof File&&n.push(e)}return n}function $c({file:e,removeLabel:t,onRemove:n,disabled:r=!1}){let[i,a]=(0,U.useState)(``);return(0,U.useEffect)(()=>{if(!qc(e)||typeof URL>`u`||typeof URL.createObjectURL!=`function`){a(``);return}let t=URL.createObjectURL(e);return a(t),()=>URL.revokeObjectURL(t)},[e]),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-2xl border border-line/50 bg-panel/80 px-2.5 py-2 text-xs shadow-[0_10px_24px_-20px_rgb(0_0_0/0.2)]`,children:[i?(0,K.jsx)(`img`,{src:i,alt:``,className:`h-10 w-10 shrink-0 rounded-xl border border-line/40 object-cover`}):null,(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate font-medium text-ink`,title:e.name,children:e.name}),(0,K.jsxs)(`div`,{className:`truncate text-ink-faint`,children:[ct(e.size),` · `,Gc(e)]})]}),(0,K.jsx)(`button`,{type:`button`,onClick:n,disabled:r,"aria-label":t,title:t,className:`send-control h-8 w-8 shrink-0 rounded-full border-line/60 text-ink-faint hover:border-err/50 hover:bg-err/10 hover:text-err`,children:`×`})]})}function el({value:e,onChange:t,inputRef:n,fileInputRef:r,onFiles:i,inputProps:a,onSend:o,onCancel:s,pending:c,disabled:l=!1,controls:u}){let{t:d,locale:f}=I(),p=f===`zh-CN`,{refs:m,text:h}=Js(e),g=e.length>zc;return(0,U.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{e.getClientRects().length&&(e.style.height=`0px`,e.style.height=`${Math.min(132,Math.max(28,e.scrollHeight))}px`)};t();let r=e.clientWidth,i=new ResizeObserver(()=>{e.clientWidth!==r&&(r=e.clientWidth,t())});return i.observe(e),()=>i.disconnect()},[n,h]),(0,K.jsxs)(`div`,{className:`composer-surface`,"data-pending":c,children:[m.length>0&&(0,K.jsx)(`div`,{className:`map-reference-chips`,children:m.map((e,n)=>(0,K.jsxs)(`span`,{children:[(0,K.jsxs)(`span`,{children:[p?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":p?`移除引用`:`Remove reference`,onClick:()=>t(m.filter((e,t)=>t!==n).map(qs).join(``)+h),children:(0,K.jsx)(Ie,{size:12})})]},`${e.task_id}:${e.step_id}:${n}`))}),(0,K.jsxs)(`form`,{className:`map-composer`,onSubmit:e=>{e.preventDefault(),!c&&!l&&!g&&o()},children:[(0,K.jsx)(`input`,{ref:r,type:`file`,multiple:!0,accept:Hc,hidden:!0,disabled:l||c,onChange:i}),(0,K.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":d(`chat.attach`),title:d(`chat.attach`),disabled:l||c,onClick:()=>r.current?.click(),children:(0,K.jsx)(`span`,{"aria-hidden":`true`,children:(0,K.jsx)(_t,{size:28})})}),(0,K.jsx)(`textarea`,{...a,ref:n,rows:1,value:h,disabled:l,onChange:e=>t(m.map(qs).join(``)+e.target.value),onKeyDown:e=>{if(g&&e.key===`Enter`&&!e.shiftKey&&!fc(e)){e.preventDefault();return}a.onKeyDown?.(e),!(e.defaultPrevented||fc(e))&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),!c&&!l&&o())}}),(0,K.jsx)(`button`,{type:c?`button`:`submit`,onClick:c?s:void 0,disabled:l||!c&&(!h.trim()||g),"aria-label":c?p?`停止回复`:`Stop reply`:p?`发送消息`:`Send message`,className:`map-send ${c?`is-pending`:``}`,children:c?(0,K.jsx)(Yt,{size:15}):(0,K.jsx)(kt,{size:20})})]}),g&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:d(`chat.messageTooLong`)}),u?(0,K.jsx)(`div`,{className:`composer-controls`,children:u}):null]})}var tl=[`auto`,`task`,`chat`];function nl({value:e,onChange:t,disabled:n=!1,tabIndex:r}){let{t:i}=I(),a={auto:i(`chat.routeAuto`),task:i(`chat.routeTask`),chat:i(`chat.routeChat`)};return(0,K.jsx)(`div`,{className:`route-seg`,role:`radiogroup`,"aria-label":i(`chat.routeLabel`),title:i(`chat.routeHint`),children:tl.map(i=>(0,K.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===i,disabled:n,tabIndex:r,onClick:()=>{i!==e&&t(i)},children:a[i]},i))})}function rl(e,t){if(!t.onRewrite||!kc(e.key,e.ctrlKey,e.metaKey))return!1;e.preventDefault();let n=t.value.trim();return n&&!t.disabled&&!t.pending&&!t.rewriting&&t.onRewrite(n),!0}function il({value:e,onChange:t,onSend:n,onCancel:r,disabled:i,pending:a,focusSignal:o,attachments:s,onAttachmentsChange:c,onRewrite:l,rewriting:u=!1,slashSelection:d,onSlashSelectionChange:f,routeOverride:p=`auto`,onRouteOverrideChange:m,footer:h}){let{t:g}=I(),_=(0,U.useRef)(null),v=(0,U.useRef)(null),y=(0,U.useRef)(!1),[b,x]=(0,U.useState)(0),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(``),[E,D]=(0,U.useState)(0),[O,k]=(0,U.useState)(!1),[A,j]=(0,U.useState)(!1);(0,U.useEffect)(()=>{a||j(!1)},[a]),(0,U.useEffect)(()=>{if(!a&&!u)return;let e=setInterval(()=>x(e=>e+1),1e3);return()=>clearInterval(e)},[a,u]),(0,U.useEffect)(()=>{o&&!i&&_.current?.focus()},[o,i]);let M=xc(e).slice(0,8),N=M.length>0&&!S,ee=N?Ic(d,M.length):0,P=N?M[ee]:void 0,F=e=>{let n=M[e];n&&(t(Cc(n)),n.argument===`none`&&C(!0),f(0),_.current?.focus())},te=async()=>{if(!e.trim()||i||u||y.current)return;let t=a;if(t&&s.length){T(g(`chat.attachWhileRunning`));return}y.current=!0;try{(t?await n(e.trim(),[],void 0,{whileRunning:!0}):await n(e.trim(),s))&&(f(0),C(!1),T(``),j(t))}finally{y.current=!1}},ne=e=>{if(!e.length||i||a||y.current)return;let{accepted:t,issues:n}=Yc(s,e);t.length&&c([...s,...t]),T(n.map(e=>e.code===`unsupported`?g(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?g(`chat.attachTooLarge`,{name:e.fileName,size:ct(e.limitBytes)}):e.code===`too-many`?g(`chat.attachTooMany`,{count:e.limitCount}):g(`chat.attachTotalTooLarge`,{size:ct(e.limitBytes)})).join(` `))},re=(e,t)=>{Zc(e.dataTransfer)&&(e.preventDefault(),D(e=>Math.max(0,e+t)))};return(0,K.jsxs)(`div`,{className:`conversation-composer flex flex-col ${E>0?`rounded-3xl ring-2 ring-manager/60`:``}`,"data-compact":!O&&!e.trim()&&!s.length&&!a&&!u&&!w&&!E,onFocusCapture:()=>k(!0),onBlurCapture:e=>k(e.currentTarget.contains(e.relatedTarget)),onDragEnter:e=>re(e,1),onDragOver:e=>re(e,0),onDragLeave:e=>re(e,-1),onDrop:e=>{Zc(e.dataTransfer)&&(e.preventDefault(),D(0),ne(Qc(e.dataTransfer)))},children:[a?(0,K.jsx)(`div`,{className:`px-3 py-2 text-xs text-ink-faint`,role:`status`,children:g(A?`chat.queuedWhileRunning`:`chat.stopWaitingHint`)}):null,N?(0,K.jsx)(Rc,{query:e,selected:ee,onSelect:F}):null,s.length||w||E>0?(0,K.jsxs)(`div`,{className:`px-3 py-2`,children:[E>0?(0,K.jsx)(`div`,{className:`mb-2 text-xs text-manager`,children:g(`chat.attachDrop`)}):null,(0,K.jsx)(`div`,{className:`map-attachment-tray`,children:s.map((e,t)=>(0,K.jsx)($c,{file:e,removeLabel:g(`chat.attachRemove`,{name:e.name}),onRemove:()=>{c(s.filter(t=>t!==e)),T(``)}},`${e.name}:${e.lastModified}:${t}`))}),(0,K.jsx)(`div`,{className:`text-xs ${w?`text-err`:`text-ink-faint`}`,children:w||g(`chat.attachHint`,{count:5,perFile:ct(10485760),total:ct(26214400)})})]}):null,(0,K.jsx)(el,{value:e,onChange:e=>{t(e),f(0),C(!1)},inputRef:_,fileInputRef:v,onFiles:e=>{ne(Array.from(e.target.files??[])),e.target.value=``},onSend:()=>void te(),onCancel:r,pending:a,disabled:i,inputProps:{onPaste:e=>{let t=Qc(e.clipboardData);t.length&&(e.preventDefault(),ne(t))},onKeyDown:t=>{fc(t)||rl(t,{value:e,disabled:i,pending:a,rewriting:u,onRewrite:l})||(N?t.key===`ArrowDown`||t.key===`ArrowUp`?(t.preventDefault(),f(Ic(ee+(t.key===`ArrowDown`?1:-1),M.length))):t.key===`Tab`||t.key===`Enter`&&!t.shiftKey?(t.preventDefault(),F(ee)):t.key===`Escape`&&(t.preventDefault(),C(!0)):t.key===`Escape`&&a?(t.preventDefault(),r()):t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),te()))},"aria-label":g(`chat.messageArgus`),"aria-keyshortcuts":`Control+R Meta+R`,"aria-controls":N?Fc:void 0,"aria-expanded":N,"aria-activedescendant":P?Lc(P.id):void 0,placeholder:g(i?`chat.selectSession`:`chat.placeholder`)},controls:(0,K.jsxs)(K.Fragment,{children:[m?(0,K.jsx)(nl,{value:p,onChange:m,disabled:i||a}):null,l&&e.trim()?(0,K.jsx)(`button`,{type:`button`,onClick:()=>l(e.trim()),disabled:i||a||u,title:`Ctrl/⌘+R · ${g(`chat.rewriteHint`)}`,"aria-label":g(`chat.rewriteLabel`),"aria-keyshortcuts":`Control+R Meta+R`,children:u?`${mc(b)} ${g(`chat.rewriting`)}`:g(`chat.rewrite`)}):null]})}),h]})}function al(e,t,n,r=`en`){return e.map(e=>({id:`command-${e.id}`,label:Mc(e,r),hint:`${e.name}${e.arg?` ${e.arg}`:``}`,group:Nc(e,r),keywords:[e.name,...e.aliases??[]].join(` `),run:()=>_c(e)?n(`${e.name} `):t(e.name)}))}function ol(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length?e.filter(e=>{let t=`${e.label} ${e.group} ${e.hint??``} ${e.keywords??``}`.toLowerCase();return n.every(e=>t.includes(e))}):e}function sl({open:e,onClose:t,items:n}){let{t:r}=I(),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(0),c=(0,U.useRef)(null),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{e&&(a(``),s(0),setTimeout(()=>c.current?.focus(),0))},[e]);let u=(0,U.useMemo)(()=>ol(n,i),[i,n]);(0,U.useEffect)(()=>{o>=u.length&&s(Math.max(0,u.length-1))},[u.length,o]),(0,U.useEffect)(()=>{l.current?.scrollIntoView({block:`nearest`})},[e,i,o]);let d=e=>{e&&(t(),e.run())},f=e=>{fc(e)||(e.key===`ArrowDown`?(e.preventDefault(),u.length&&s(e=>Math.min(u.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),d(u[o])))},p=[];for(let e of u){let t=p.find(t=>t.name===e.group);t||(t={name:e.group,items:[]},p.push(t)),t.items.push(e)}let m=-1;return(0,K.jsxs)(tt,{open:e,onClose:t,label:r(`help.palette`),width:`max-w-xl`,align:`top`,children:[(0,K.jsx)(`div`,{className:`border-b border-line px-4 py-3`,children:(0,K.jsx)(`input`,{ref:c,value:i,onChange:e=>a(e.target.value),onKeyDown:f,placeholder:r(`palette.placeholder`),role:`combobox`,"aria-expanded":e,"aria-autocomplete":`list`,"aria-controls":`command-palette-results`,"aria-activedescendant":u[o]?`palette-${u[o].id}`:void 0,className:`w-full bg-transparent font-mono text-sm text-ink outline-none placeholder:text-ink-faint`})}),(0,K.jsxs)(`div`,{id:`command-palette-results`,role:`listbox`,className:`max-h-[52vh] overflow-y-auto scroll-thin py-1.5`,children:[u.length===0&&(0,K.jsx)(`div`,{className:`px-4 py-6 text-center text-xs text-ink-faint`,children:r(`palette.noMatches`)}),p.map(e=>(0,K.jsxs)(`div`,{className:`mb-1`,children:[(0,K.jsx)(`div`,{className:`px-4 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.name}),e.items.map(e=>{m++;let t=m===o;return(0,K.jsxs)(`button`,{id:`palette-${e.id}`,ref:t?l:void 0,role:`option`,"aria-selected":t,onMouseEnter:()=>s(u.indexOf(e)),onClick:()=>d(e),className:`flex w-full items-center justify-between px-4 py-1.5 text-left text-sm transition-colors ${t?`bg-blue-deep/20 text-ink`:`text-ink-dim hover:bg-panel/60`}`,children:[(0,K.jsx)(`span`,{children:e.label}),e.hint&&(0,K.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:e.hint})]},e.id)})]},e.name))]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-line px-4 py-1.5 text-[10px] text-ink-faint`,children:[(0,K.jsx)(`span`,{children:r(`palette.navigate`)}),(0,K.jsx)(`span`,{children:r(`palette.run`)}),(0,K.jsx)(`span`,{children:r(`palette.close`)})]})]})}var cl=[{keys:`⌘K / Ctrl+K`,desc:`help.palette`},{keys:`⌘B / Ctrl+B`,desc:`help.sessions`},{keys:`⌘J / Ctrl+J`,desc:`help.managerChat`},{keys:`⌘R / Ctrl+R`,desc:`help.rewrite`},{keys:`⌘T / Ctrl+T`,desc:`help.reasoning`},{keys:`⌘. / Ctrl+.`,desc:`help.kiosk`},{keys:`/`,desc:`help.composer`},{keys:`↵ Enter`,desc:`help.send`},{keys:`Shift+Enter`,desc:`help.newline`},{keys:`?`,desc:`help.thisHelp`},{keys:`Esc`,desc:`help.escape`}];function ll({open:e,onClose:t}){let{locale:n,t:r}=I(),i=Pc(hc,n);return(0,K.jsxs)(tt,{open:e,onClose:t,label:r(`help.title`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:r(`help.title`)}),(0,K.jsxs)(`div`,{className:`max-h-[70dvh] overflow-y-auto scroll-thin`,children:[(0,K.jsx)(`div`,{className:`p-4`,children:cl.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center justify-between py-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm text-ink-dim`,children:r(e.desc)}),(0,K.jsx)(`kbd`,{className:`rounded border border-line bg-surface px-2 py-0.5 font-mono text-[11px] text-ink`,children:e.keys})]},e.keys))}),(0,K.jsxs)(`div`,{className:`border-t border-line px-4 pb-4 pt-3`,children:[(0,K.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-ink-faint`,children:r(`help.commands`)}),i.map(e=>(0,K.jsxs)(`div`,{className:`mb-4`,children:[(0,K.jsx)(`p`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:e.group}),e.rows.map(e=>(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1`,children:[(0,K.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-ink`,children:e.label}),(0,K.jsx)(`span`,{className:`text-right text-xs text-ink-dim`,children:e.desc})]},e.label))]},e.group))]})]})]})}var ul=[[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]];function dl({sid:e,config:t,onSaved:n}){let{locale:r}=I(),i=r===`zh-CN`,a=t.roles.find(e=>e.role===`manager`),o=t.roles.find(e=>e.role===`engineer`),s=a&&a.backend!==`memory`?a:o,c=new Map(t.operator_knobs.map(e=>[e.name,e.value])),l=c.get(`ARGUS_SKILL_MAP_MODEL`)||`auto`,[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(``),m=(t.model_options??[]).map(e=>e.model);l!==`auto`&&!m.includes(l)&&m.unshift(l);let h=async(t,r)=>{if(!u){d(!0),p(``);try{await F.setConfig(e,t,r),await n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}},g=i?`自动(轻量)`:`Auto (light)`,_=i?`跟随前台模型`:`Follow the front-door model`,v=[{name:`ARGUS_SKILL_MAP_REASONING_EFFORT`,label:i?`讲解生成强度`:`Explanation effort`,follow:g},{name:`ARGUS_SKILL_MAP_REVIEW_REASONING_EFFORT`,label:i?`讲解复核强度`:`Explanation review effort`,follow:i?`自动(中)`:`Auto (medium)`}];return(0,K.jsxs)(`section`,{className:`map-model-settings rounded-lg border border-line glass-card p-3`,"aria-label":i?`地图模型`:`Map model`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:i?`地图模型`:`Map model`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:i?`地图讲解与摘要用的模型;默认沿用前台(经理)的接入与账号,以低强度起草,不占用科研的推理预算。可以选一个便宜的。`:`The model that writes map explanations and summaries. By default it uses the front-door (Manager) runner and account at a light effort, not the research budget. A cheaper one is fine.`}),(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[s?.backend_label,` · `,s?.model||(i?`接入默认模型`:`Runner default model`)]}),t.map_model?.note&&(0,K.jsx)(`p`,{role:`status`,"data-map-model-note":!0,className:`mt-1 text-xs text-warn`,children:i?`已改用自动:所选摘要模型在当前接入(${t.map_model.backend})下不可用。`:t.map_model.note}),(0,K.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[i?`摘要模型`:`Summary model`,(0,K.jsxs)(`select`,{value:l,disabled:u,"aria-label":i?`摘要模型`:`Summary model`,onChange:e=>void h(`ARGUS_SKILL_MAP_MODEL`,e.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,K.jsx)(`option`,{value:`auto`,children:_}),m.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]}),v.map(e=>(0,K.jsxs)(`label`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-dim`,children:[e.label,(0,K.jsxs)(`select`,{value:c.get(e.name)||`auto`,disabled:u,onChange:t=>void h(e.name,t.target.value),className:`h-9 min-w-0 max-w-full rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue`,children:[(0,K.jsx)(`option`,{value:`auto`,children:e.follow}),ul.map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:i?t:e},e))]})]},e.name)),(0,K.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`复核用于检查讲解文字,保存后对新发起的讲解生效。`:`The review checks explanation text. Changes apply to newly requested explanations.`}),f&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:f})]})}function fl({sid:e,primaryModel:t}){let{locale:n}=I(),r=n===`zh-CN`,i=(e,t)=>r?e:t,a=S(),o=x({queryKey:[`advisor-settings`,e],queryFn:({signal:t})=>F.advisorSettings(e,t),enabled:!!e,retry:!1}),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(``),[h,g]=(0,U.useState)(!1),_=(0,U.useRef)(e);_.current=e,(0,U.useEffect)(()=>{c(o.data?.saved??null);let e=o.data?.saved;u(!!(e?.model&&!o.data?.model_options?.some(t=>t.backend===e.backend&&t.model===e.model)))},[e,o.data]),(0,U.useEffect)(()=>{m(``),g(!1),f(!1)},[e]);let v=e=>{c(t=>t&&{...t,...e}),g(!1)},y=o.data?.model_options??[],b=(e,t)=>JSON.stringify([e,t]),C=s&&y.some(e=>e.backend===s.backend&&e.model===s.model)?b(s.backend,s.model):``,w=async()=>{if(!s||d)return;let t=e;f(!0),m(``),g(!1);try{let{schema_version:e,...n}=s,r=await F.saveAdvisorSettings(t,{...n,model:n.model.trim()});a.setQueryData([`advisor-settings`,t],r),_.current===t&&g(!0)}catch(e){_.current===t&&m(e instanceof Error?e.message:String(e))}finally{_.current===t&&f(!1)}};return(0,K.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,"aria-label":i(`顾问模型`,`Advisor model`),children:[(0,K.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`顾问模型`,`Advisor model`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:i(`团队遇到难题时可以向它提问。只在咨询时调用,用量计入当前项目。`,`The team can consult this model on specific questions. It runs only when asked, and usage belongs to this project.`)}),t?(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[i(`当前执行模型:`,`Current execution model: `),t]}):null,o.isPending?(0,K.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-ink-faint`,children:i(`正在读取设置…`,`Loading settings…`)}):o.isError?(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-err`,role:`alert`,children:[i(`顾问设置读取失败。`,`Could not load advisor settings.`),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void o.refetch(),className:`underline`,children:i(`重试`,`Retry`)})]}):s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:s.enabled,disabled:d,onChange:e=>v({enabled:e.target.checked})}),i(`允许团队咨询顾问`,`Let the team consult the advisor`)]}),(0,K.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[y.length>0?(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim sm:col-span-2`,children:[i(`顾问使用的模型`,`Advisor model`),(0,K.jsxs)(`select`,{"aria-label":i(`选择顾问模型`,`Choose advisor model`),value:l?`custom`:C,disabled:d,onChange:e=>{if(e.target.value===`custom`){u(!0);return}let t=y.find(t=>b(t.backend,t.model)===e.target.value);t&&(u(!1),v({backend:t.backend,model:t.model}))},className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,K.jsx)(`option`,{value:``,disabled:!0,children:i(`选择模型`,`Choose a model`)}),y.map(e=>(0,K.jsx)(`option`,{value:b(e.backend,e.model),children:e.model},b(e.backend,e.model))),(0,K.jsx)(`option`,{value:`custom`,children:i(`配置其他模型…`,`Configure another model…`)})]})]}):null,l||y.length===0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`接入`,`Runner`),(0,K.jsxs)(`select`,{"aria-label":i(`顾问接入`,`Advisor runner`),value:s.backend,disabled:d,onChange:e=>v({backend:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,K.jsx)(`option`,{value:``,children:i(`选择接入`,`Choose a runner`)}),o.data?.supported_backends.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]}),(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`顾问使用的模型`,`Advisor model ID`),(0,K.jsx)(`input`,{value:s.model,disabled:d,onChange:e=>v({model:e.target.value}),placeholder:i(`填写该接入的模型标识`,`Model ID for this runner`),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}):null,(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`思考强度`,`Reasoning effort`),(0,K.jsxs)(`select`,{"aria-label":i(`顾问思考强度`,`Advisor reasoning effort`),value:s.effort,disabled:d,onChange:e=>v({effort:e.target.value}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`,children:[(0,K.jsx)(`option`,{value:``,children:i(`模型默认`,`Model default`)}),[[`minimal`,`最低`],[`low`,`低`],[`medium`,`中`],[`high`,`高`],[`xhigh`,`很高`],[`max`,`最高`]].map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:r?t:e},e))]})]}),(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[i(`每次角色调用最多咨询`,`Consultations per role call`),(0,K.jsx)(`input`,{type:`number`,min:1,max:20,value:s.max_calls_per_turn,disabled:d,onChange:e=>v({max_calls_per_turn:Number(e.target.value)}),className:`mt-1 h-9 w-full rounded border border-line bg-bg px-2 text-xs text-ink`})]})]}),o.data?.overridden_fields.length?(0,K.jsxs)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:[i(`运行服务另有指定设置;当前顾问:`,`The runtime overrides some saved settings. Current advisor: `),o.data.config.enabled?`${o.data.config.backend} · ${o.data.config.model}`:i(`未启用`,`disabled`)]}):null,(0,K.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:d||s.enabled&&(!s.backend||!s.model.trim()),className:`rounded border border-line px-3 py-2 text-xs text-ink hover:border-blue disabled:opacity-40`,children:d?i(`保存中…`,`Saving…`):i(`保存顾问设置`,`Save advisor settings`)}),h?(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-ink-dim`,children:i(`已保存,下次咨询生效。`,`Saved for the next consultation.`)}):null]}),p?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-err`,children:p}):null]}):null]})}var pl=[/^\[?\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[.,]\d+)?(?:Z|[+-]\d{2}:?\d{2})?\]?\s*/,/^\[?(?:INFO|WARNING|WARN|ERROR|DEBUG|CRITICAL|TRACE)\]?\s*[:\-|]?\s*/i,/^(?:\[\d+\]|[\w.]+:)\s+/];function ml(e){let t=e.trim();for(let e of pl)t=t.replace(e,``);return t.trim()}var hl=(e,t)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`;function gl(e,t=200){let n=String(e??``).split(/\r?\n/).map(ml).filter(e=>e&&!/^[-=_.\s]+$/.test(e));return n.length?hl(n[n.length-1],t):``}var _l=[{name:`ARGUS_SKILL_MAX_ACTIVE_DAEMONS`,group:`Limits`,label:`Active daemon limit`,description:`Maximum background sessions running on this host.`},{name:`ARGUS_SKILL_SAFE_MODE`,group:`Safety`,label:`Safe mode`,description:`Enable extra-conservative runtime guardrails.`},{name:`ARGUS_SKILL_OPERATOR_AVAILABLE`,group:`Safety`,label:`Operator available`,description:`Off suppresses operator questions: Argus decides on recorded assumptions.`},{name:`ARGUS_SKILL_ENABLE_TELEGRAM`,group:`Interface`,label:`Telegram`,description:`Enable the Telegram notification bridge.`},{name:`ARGUS_SKILL_SHOW_REASONING`,group:`Interface`,label:`Show reasoning`,description:`Stream role reasoning into the cockpit activity view.`}];function vl(e){let t=new Map(e.map(e=>[e.name,e]));return _l.flatMap(e=>{let n=t.get(e.name);return n?[{...n,group:e.group,label:e.label,doc:e.description}]:[]})}function yl(e,t){let n=new URL(e),r=n.protocol===`https:`?`wss:`:`ws:`,i=encodeURIComponent(t);return{webApi:`${n.origin}/api`,eventStream:`${r}//${n.host}/api/projects/${i}/stream`,daemon:`local process · events.jsonl · no TCP port`}}var bl=`ARGUS_SKILL_OPERATOR_AVAILABLE`,xl=new Set([`0`,`false`,`no`,`off`,`disable`,`disabled`]);function Sl(e){let t=(e??[]).find(e=>e.name===bl);return!!(t&&xl.has(t.value.trim().toLowerCase()))}function Cl(e){return e instanceof N?e.code===`trial_route_unavailable`||e.status===403||e.status===404:!1}function wl(e,t){let n=Cl(e);return{text:t(n?`operations.unavailableHere`:`operations.requestFailed`),technical:e instanceof Error?e.message:String(e||``),refused:n}}var Tl={ARGUS_SKILL_MAX_ACTIVE_DAEMONS:{label:`settings.knob.activeDaemons`,doc:`settings.knob.activeDaemonsDoc`},ARGUS_SKILL_SAFE_MODE:{label:`settings.knob.safeMode`,doc:`settings.knob.safeModeDoc`},ARGUS_SKILL_OPERATOR_AVAILABLE:{label:`settings.knob.operatorAvailable`,doc:`settings.knob.operatorAvailableDoc`},ARGUS_SKILL_ENABLE_TELEGRAM:{label:`settings.knob.telegram`,doc:`settings.knob.telegramDoc`},ARGUS_SKILL_SHOW_REASONING:{label:`settings.knob.showReasoning`,doc:`settings.knob.showReasoningDoc`}},El={Limits:`settings.group.limits`,Safety:`settings.group.safety`,Interface:`settings.group.interface`};function Dl(e,t){let n=e.trim();return n===`not applicable for this model`?t(`settings.source.notApplicable`):n.startsWith(`capability vault`)?t(`settings.source.vaultDefault`):n.startsWith(`default`)?t(`settings.source.default`):n.startsWith(`persisted:`)||n===`persisted`?t(`settings.source.saved`):n.startsWith(`ARGUS_SKILL_`)||n===`env`?t(`settings.source.environment`):n.startsWith(`global:`)?t(`settings.source.hostConfig`):t(`settings.source.other`)}function Ol(e,t){let n=e.value.trim().toLowerCase();return[`ARGUS_SKILL_SAFE_MODE`,`ARGUS_SKILL_OPERATOR_AVAILABLE`,`ARGUS_SKILL_ENABLE_TELEGRAM`,`ARGUS_SKILL_SHOW_REASONING`].includes(e.name)?t([`1`,`true`,`on`,`yes`].includes(n)?`settings.value.enabled`:`settings.value.disabled`):e.value}function kl(e,t){let n={low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`}[e.toLowerCase()];return n?t(`settings.effort.${n}`):e}function Al({message:e,retrying:t,onRetry:n,t:r}){return(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 px-4 py-8 text-center`,children:[(0,K.jsx)(`p`,{className:`text-sm text-err`,children:e}),(0,K.jsx)(`button`,{type:`button`,onClick:n,disabled:t,className:`rounded-md border border-err/40 px-3 py-1.5 text-xs font-medium text-err hover:bg-err/10 disabled:opacity-40`,children:r(t?`common.loading`:`common.retry`)})]})}function jl({sid:e,open:t,onClose:n}){let{t:r}=I(),{data:i,isLoading:a,isError:o,isFetching:s,refetch:c}=se(e,t),l=!!(i&&(i.recommended||i.checks.length||i.log_tail.trim()));return(0,K.jsxs)(tt,{open:t,onClose:n,label:r(`doctor.title`),width:`max-w-3xl`,children:[(0,K.jsx)(Qe,{title:r(`doctor.title`),sub:r(`doctor.subtitle`)}),(0,K.jsxs)(`div`,{className:`p-4`,children:[a&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),!a&&o&&(0,K.jsx)(Al,{message:r(`doctor.loadError`),retrying:s,onRetry:()=>void c(),t:r}),!a&&!o&&!l&&(0,K.jsx)(Ve,{children:r(`doctor.empty`)}),!a&&!o&&i?.recommended&&(0,K.jsxs)(`div`,{className:`mb-4 rounded-lg border border-gold/40 bg-gold/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-gold`,children:r(`doctor.recommended`)}),(0,K.jsx)(`div`,{className:`mt-1 text-sm text-ink`,children:i.recommended.name}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:i.recommended.detail}),i.recommended.fix&&(0,K.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap break-words rounded bg-bg p-2 font-mono text-xs text-blue-sky`,children:i.recommended.fix})]}),!a&&!o&&(0,K.jsx)(`div`,{className:`space-y-1.5`,children:(i?.checks??[]).map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-line/60 px-3 py-2`,children:[(0,K.jsx)(`span`,{className:e.ok?`text-ok`:`text-err`,children:e.ok?`✓`:`✗`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.name}),e.detail&&(0,K.jsx)(`div`,{className:`mt-0.5 text-[11px] text-ink-dim`,children:e.detail}),!e.ok&&e.fix&&(0,K.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words rounded bg-bg p-1.5 font-mono text-xs text-ink-dim`,children:e.fix})]})]},t))}),!a&&!o&&i?.log_tail?.trim()&&(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:r(`doctor.daemonLog`)}),(0,K.jsxs)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:[(0,K.jsxs)(`span`,{className:`text-ink-faint`,children:[r(`doctor.lastEntry`),` · `]}),gl(i.log_tail)]}),(0,K.jsx)(nt,{children:(0,K.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg bg-bg p-3 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:i.log_tail})})]})]})]})}function Ml({sid:e,open:t,onClose:n}){let{t:i}=I(),a=S(),{data:o,isLoading:c,isError:u,isFetching:d,refetch:f}=xe(e,t),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(``),[y,b]=(0,U.useState)(!1),[x,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(``),[O,k]=(0,U.useState)(``),[A,j]=(0,U.useState)(!1),[M,N]=(0,U.useState)(``);(0,U.useEffect)(()=>{t||m(!1)},[t]),(0,U.useEffect)(()=>{!t||!o||(g(o.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MODEL`)?.value??``),v(``))},[o,t]);let ee=async()=>{await f(),await a.invalidateQueries({queryKey:[`map-copy`]})},P=$n(o),te=er(o),ne=tr(o),re=e=>!e||(ne?Zn(ne)===e:e===Zn(P)),L=_||Zn(P),ie=async t=>{if(!(y||re(t))){b(!0),C(``),T(!1);try{await F.setConfig(e,`ARGUS_SKILL_RUNNER_BACKEND`,t),await ee(),C(i(`settings.backendSwitched`,{backend:Qn(t,i)}))}catch(e){T(!0),C(wl(e,i).text)}finally{b(!1)}}},ae=async t=>{if(!y){b(!0),C(``),T(!1);try{await F.setConfig(e,`ARGUS_SKILL_MAP_MODEL`,t||`auto`),await ee(),C(t&&t!==`auto`?i(`settings.mapModelSet`,{model:t}):i(`settings.mapModelFollows`))}catch(e){T(!0),C(wl(e,i).text)}finally{b(!1)}}},oe=async()=>{if(!y){b(!0),C(``),T(!1);try{let t=h.trim()||`auto`;await F.setConfig(e,`ARGUS_SKILL_MODEL`,t,!0),await ee(),C(i(`settings.modelAppliedToRoles`,{model:t}))}catch(e){T(!0),C(wl(e,i).text)}finally{b(!1)}}},se=async t=>{if(t.preventDefault(),!(!E.trim()||!O.trim()||A)){j(!0),N(``);try{await F.setConfig(e,E.trim(),O.trim()),await ee(),N(i(`settings.applied`))}catch(e){N(wl(e,i).text)}finally{j(!1)}}},ce=vl(o?.operator_knobs??[]).reduce((e,t)=>((e[t.group]??=[]).push(t),e),{}),le=yl(window.location.origin,e),ue=!!(o&&(o.roles.length||o.operator_knobs.length));return(0,K.jsxs)(tt,{open:t,onClose:n,label:i(`common.settings`),width:`max-w-4xl`,children:[(0,K.jsx)(Qe,{title:i(`common.settings`),sub:i(`settings.subtitle`)}),(0,K.jsxs)(`div`,{className:`p-4`,children:[c&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),!c&&u&&(0,K.jsx)(Al,{message:i(`settings.loadError`),retrying:d,onRetry:()=>void f(),t:i}),!c&&!u&&!ue&&(0,K.jsx)(Ve,{children:i(`settings.empty`)}),!c&&!u&&ue&&o&&(0,K.jsxs)(`div`,{className:`space-y-4`,children:[!o.trial_mode&&(0,K.jsxs)(`section`,{className:`rounded-lg border border-line glass-card p-3`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:i(`settings.quickConfig`)}),(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:i(`settings.backend`)}),(0,K.jsxs)(`select`,{value:_||Zn(P),disabled:y,onChange:e=>v(e.target.value),"aria-label":i(`settings.backend`),className:`h-8 min-w-44 rounded border border-line bg-bg px-2 text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[Zn(P)?null:(0,K.jsx)(`option`,{value:``,disabled:!0,children:P?i(`settings.backendUnsupported`,{backend:P}):i(`settings.backendUnavailable`)}),Yn.map(e=>(0,K.jsx)(`option`,{value:e.value,children:i(e.label)},e.value))]}),(0,K.jsx)(`button`,{type:`button`,"data-apply-backend":!0,onClick:()=>{L&&ie(L)},disabled:y||re(L),className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:i(`settings.applyModel`)}),te&&(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,"data-backend-source":te,children:i(`settings.backendSource.${te}`)}),!re(L)&&(0,K.jsx)(`span`,{className:`text-[10px] text-ink-dim`,"data-backend-change":!0,children:ne?i(`settings.backendWillReplace`,{saved:Qn(ne,i),backend:Qn(L,i)}):i(`settings.backendWillSave`,{backend:Qn(L,i)})})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:i(`settings.model`)}),(0,K.jsxs)(`select`,{value:h||`auto`,onChange:e=>g(e.target.value===`auto`?``:e.target.value),"aria-label":i(`settings.model`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`,children:[(0,K.jsx)(`option`,{value:`auto`,children:o.model_auto_resolves_to?`auto → ${o.model_auto_resolves_to}`:i(`settings.modelPlaceholder`)}),(()=>{let e=o.model_options??[],t=new Set(e.filter(e=>e.invalid).map(e=>e.model)),n=e.map(e=>e.model),r=h.trim();return r&&r!==`auto`&&!n.includes(r)&&(n.unshift(r),t.add(r)),n.map(e=>(0,K.jsx)(`option`,{value:e,children:t.has(e)?`${e} (${i(`settings.modelUnavailable`)})`:e},e))})()]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void oe(),disabled:y,className:`h-8 shrink-0 rounded border border-line/70 px-2.5 text-xs font-medium text-ink-dim hover:border-blue/50 disabled:opacity-40`,children:i(`settings.applyModel`)})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`w-12 shrink-0 text-[10px] text-ink-faint`,children:i(`settings.mapModel`)}),(0,K.jsxs)(`select`,{value:o.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||`auto`,disabled:y,onChange:e=>void ae(e.target.value),"aria-label":i(`settings.mapModel`),className:`h-8 min-w-0 flex-1 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue disabled:opacity-40`,children:[(0,K.jsx)(`option`,{value:`auto`,children:i(`settings.mapModelFollows`)}),(()=>{let e=(o.model_options??[]).map(e=>e.model),t=o.operator_knobs.find(e=>e.name===`ARGUS_SKILL_MAP_MODEL`)?.value||``;return t&&t!==`auto`&&!e.includes(t)&&e.unshift(t),e.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})()]})]}),(o.model_options??[]).some(e=>e.offline)&&(0,K.jsx)(`p`,{className:`mt-1 text-[10px] text-ink-faint`,"data-model-offline":!0,children:i(`settings.modelOfflineList`)}),o.roles.some(e=>e.model&&h.trim()&&e.model!==h.trim())&&(0,K.jsxs)(`p`,{className:`mt-1.5 text-[10px] text-ink-faint`,"data-role-models":!0,children:[i(`settings.rolesRunning`),` `,o.roles.map(e=>`${e.role} · ${e.model||`auto`}`).join(`,`),` — `,i(`settings.applyUnifies`)]}),x&&(0,K.jsx)(`div`,{role:w?`alert`:`status`,className:`mt-1.5 text-[10px] ${w?`text-err`:`text-ink-dim`}`,children:x})]}),o.trial_mode&&(0,K.jsx)(`section`,{className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,"aria-label":i(`settings.trialAccount`),children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`text-sm font-semibold text-ink`,children:i(`settings.trialAccount`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:`GPT-5.5 · high`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:i(`settings.trialKeyHint`)})]}),lr()&&(0,K.jsx)(`button`,{type:`button`,className:`compact-control px-3 py-2`,onClick:()=>{n(),ur()},children:i(`settings.changeTrialKey`)})]})}),p&&(0,K.jsx)(dl,{sid:e,config:o,onSaved:ee}),p&&(0,K.jsx)(fl,{sid:e,primaryModel:o.roles.find(e=>e.role===`engineer`)?.model}),(0,K.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface/50`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":p,"aria-controls":`config-advanced-settings`,onClick:()=>m(e=>!e),className:`flex w-full items-center justify-between gap-3 px-3 py-3 text-left hover:bg-bg/30`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`block text-xs font-semibold text-ink`,children:i(`settings.advanced`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-ink-faint`,children:i(`settings.advancedHint`)})]}),(0,K.jsx)(s,{icon:r,className:`text-xs text-ink-faint transition-transform ${p?`rotate-180`:``}`})]}),p&&(0,K.jsxs)(`div`,{id:`config-advanced-settings`,className:`space-y-4 border-t border-line/70 p-3`,children:[(0,K.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:i(`settings.connection`)}),(0,K.jsxs)(`div`,{className:`mt-2 grid gap-2 text-[10px] sm:grid-cols-[100px_minmax(0,1fr)]`,children:[(0,K.jsx)(`span`,{className:`text-ink-faint`,children:i(`settings.webApi`)}),(0,K.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:le.webApi}),(0,K.jsx)(`span`,{className:`text-ink-faint`,children:i(`settings.eventStream`)}),(0,K.jsx)(`code`,{className:`min-w-0 break-all text-ink-dim`,children:le.eventStream}),(0,K.jsx)(`span`,{className:`text-ink-faint`,children:i(`settings.taskDaemon`)}),(0,K.jsx)(`span`,{className:`text-ink-dim`,children:i(`settings.taskDaemonValue`)})]})]}),(0,K.jsxs)(`form`,{onSubmit:e=>void se(e),className:`rounded-lg border border-blue/30 bg-blue/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-blue`,children:i(`settings.overrideTitle`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-[10px] text-ink-faint`,children:i(`settings.overrideHint`)}),(0,K.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,K.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),placeholder:i(`settings.namePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,K.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:i(`settings.valuePlaceholder`),className:`h-9 rounded border border-line bg-bg px-2 font-mono text-xs text-ink outline-none focus:border-blue`}),(0,K.jsx)(`button`,{disabled:A||!E.trim()||!O.trim(),title:i(`settings.applyAdvanced`),"aria-label":i(`settings.applyAdvanced`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:A?`…`:(0,K.jsx)(s,{icon:l})})]}),M?(0,K.jsx)(`div`,{className:`mt-2 text-xs text-ink-dim`,children:M}):null]}),o.roles.length>0&&(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:i(`settings.rolesTitle`)}),(0,K.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:o.roles.map(e=>(0,K.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink`,children:e.role===`curator`?i(`settings.role.curator`):yn(e.role,i)}),(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.backend_label})]}),(0,K.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px] text-ink-dim`,title:e.model,children:e.model}),(0,K.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-ink-faint`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:Dl(e.model_source,i)}),e.reasoning_effort&&(0,K.jsx)(`span`,{className:`ml-auto shrink-0`,style:{color:ze(e.reasoning_effort)},children:kl(e.reasoning_effort,i)})]}),(ot(e.role)||e.role===`curator`)&&(0,K.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-ink-faint`,children:ot(e.role)?Re(e.role,i):i(`settings.role.curatorDoc`)})]},e.role))})]}),Object.keys(ce).length>0&&(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:i(`settings.rawConfig`)}),Object.entries(ce).map(([e,t])=>(0,K.jsxs)(`div`,{className:`mt-3 first:mt-0`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-ink-faint`,children:i(El[e])}),(0,K.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-line`,children:t.map((e,t)=>{let n=Tl[e.name],r=Ol(e,i);return(0,K.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] ${t?`border-t border-line/60`:``}`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-ink-dim`,children:i(n.label)}),(0,K.jsx)(`code`,{className:`mt-0.5 block break-all text-[9px] text-ink-faint`,children:e.name}),(0,K.jsx)(`div`,{className:`mt-1 text-[10px] leading-relaxed text-ink-faint`,children:i(n.doc)})]}),(0,K.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,K.jsxs)(`div`,{className:`text-[11px] text-ink`,children:[r,r!==e.value&&(0,K.jsxs)(`code`,{className:`ml-1 text-[9px] text-ink-faint`,children:[`(`,e.value,`)`]})]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:Dl(e.source,i)})]})]},e.name)})})]},e))]}),(0,K.jsxs)(`p`,{className:`text-[10px] text-ink-faint`,children:[i(`settings.footer`),` `,(0,K.jsx)(`code`,{children:`argus --config-help`}),`.`]})]})]})]})]})]})}function Nl({sid:e,open:t,onClose:n}){let{t:r}=I(),{data:i,isLoading:a,refetch:o}=Ce(e,t),[c,l]=(0,U.useState)(``),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(``);(0,U.useEffect)(()=>{t&&i!=null&&l(i)},[i,t]);let h=async()=>{if(!d){f(!0),m(``);try{await F.setIdentity(e,c),await o(),m(r(`identity.saved`))}catch(e){m(wl(e,r).text)}finally{f(!1)}}};return(0,K.jsxs)(tt,{open:t,onClose:n,label:r(`identity.title`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:r(`identity.title`),sub:r(`identity.subtitle`)}),(0,K.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-5`,children:[a&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),a?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),rows:12,className:`w-full resize-y rounded-lg border border-line bg-bg p-3 font-sans text-sm leading-relaxed text-ink outline-none focus:border-blue`,placeholder:r(`identity.placeholder`)}),(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:p}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void h(),disabled:d||c===(i??``),title:r(`identity.save`),"aria-label":r(`identity.save`),className:`flex h-9 w-9 items-center justify-center rounded border border-blue/35 bg-blue/8 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-40`,children:d?`…`:(0,K.jsx)(s,{icon:u})})]})]})]})]})}function Pl({sid:e,open:t,onClose:n}){let{t:r}=I(),{data:i,isLoading:a}=ue(e,t),o=i??[];return(0,K.jsxs)(tt,{open:t,onClose:n,label:r(`transcript.title`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:r(`transcript.title`),sub:r(`transcript.subtitle`)}),(0,K.jsxs)(`div`,{className:`max-h-[64vh] overflow-y-auto scroll-thin p-4`,children:[a&&(0,K.jsx)(`div`,{className:`flex justify-center py-8`,children:(0,K.jsx)(Ue,{})}),!a&&o.length===0&&(0,K.jsx)(Ve,{children:r(`transcript.empty`)}),o.map((e,t)=>{let n=e.role===`operator`;return(0,K.jsxs)(`div`,{className:`grid grid-cols-[72px_minmax(0,1fr)] border-b border-line/50 py-2.5 last:border-b-0`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`font-mono text-[10px] font-semibold uppercase tracking-wide ${n?`text-ink-faint`:`text-blue-sky`}`,children:n?r(`transcript.operator`):`argus`}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[9px] text-ink-faint`,children:mt(e.ts)})]}),(0,K.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink-dim`,children:e.text})]},t)})]})]})}function Fl({card:e}){let{t,locale:n}=I(),r=typeof e.asked_at==`number`&&Number.isFinite(e.asked_at)&&e.asked_at>0?new Date(e.asked_at*1e3):null,i=e.task_status?.startsWith(`paused`);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] text-ink-faint`,"data-decision-task":e.item_id,children:[e.task_title?(0,K.jsx)(`span`,{className:`min-w-0 basis-full break-words text-xs leading-relaxed text-ink-dim`,title:e.task_title,children:t(`decision.taskName`,{title:e.task_title})}):null,e.kind!==`domain_intake`&&e.is_current_task!=null?(0,K.jsx)(`span`,{children:t(e.is_current_task?`decision.currentTask`:`decision.otherTask`)}):null,(0,K.jsx)(Je,{children:t(`decision.awaitingReply`)}),e.task_status?(0,K.jsx)(`span`,{children:i?t(`label.status.paused`):vn(e.task_status,t)}):null,r&&!Number.isNaN(r.getTime())?(0,K.jsx)(`time`,{dateTime:r.toISOString(),title:r.toLocaleString(n),children:t(`decision.askedAt`,{time:H(r,n)})}):null]})}function Il({questions:e,backlog:t,currentTaskId:n,onAnswer:r,onLocate:i}){let{t:a}=I(),o=kr(e,t,n);if(!o.length)return null;let s=o[0];return(0,K.jsxs)(`div`,{className:`mb-2 flex min-h-11 items-center gap-3 rounded-md border border-gold/40 bg-gold/5 px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s.title===s.task_title?null:(0,K.jsx)(`div`,{className:`truncate text-xs font-medium text-gold`,title:s.title,children:s.title}),(0,K.jsx)(Fl,{card:s}),(0,K.jsx)(`div`,{className:`truncate text-xs text-ink-dim`,title:s.reason||s.question,children:s.reason||s.question})]}),o.length>1?(0,K.jsxs)(`span`,{className:`font-mono text-xs text-ink-faint`,children:[`+`,o.length-1]}):null,i&&s.item_id?(0,K.jsx)(`button`,{onClick:()=>i(s.item_id),className:`shrink-0 text-xs text-ink-dim hover:text-gold`,children:a(`pending.showOnMap`)}):null,(0,K.jsx)(`button`,{onClick:r,className:`shrink-0 text-xs font-medium text-gold hover:text-gold-soft`,children:a(`pending.reviewRespond`)})]})}function Ll({reply:e,open:t,busy:n,onClose:r,onSubmit:i,error:a=``}){let{t:o,locale:s}=I(),c=s===`zh-CN`,l=(0,U.useMemo)(()=>e?.options[0]?.id??`custom`,[e]),[u,d]=(0,U.useState)(l),[f,p]=(0,U.useState)(``),[m,h]=(0,U.useState)(``);if((0,U.useEffect)(()=>{t&&(d(l),p(``),h(``))},[l,t,e?.id]),!e)return null;let g=e.options.length===0,_=e.kind===`domain_intake`,v=e.options.find(e=>e.id===u),y=g?!!f.trim():!!(v&&(!v.requires_note||f.trim())),b=()=>{if(!n){if(!y){h(o(`decision.noteRequired`));return}h(``),i(g?`custom`:u,f.trim())}};return(0,K.jsxs)(tt,{open:t,onClose:n?()=>void 0:r,label:o(`decision.operator`),width:`max-w-2xl`,children:[(0,K.jsx)(Qe,{title:_?e.title:o(`decision.required`),sub:!_&&e.title!==e.task_title?e.title:void 0}),(0,K.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[(0,K.jsx)(Fl,{card:e}),e.reason?(0,K.jsxs)(`section`,{className:`rounded-md border border-gold/30 bg-gold/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-gold`,children:o(`decision.whyBlocked`)}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.reason})]}):null,e.evidence.length?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:o(`decision.evidence`)}),(0,K.jsx)(`div`,{className:`space-y-2`,children:e.evidence.map((e,t)=>(0,K.jsxs)(`div`,{className:`rounded border border-line/70 bg-bg/40 p-2.5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-ink`,children:e.label}),e.summary?(0,K.jsx)(`div`,{className:`mt-1 text-xs text-ink-dim`,children:e.summary}):null,e.path?(0,K.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10px] text-blue-sky`,children:e.path}):null]},`${e.path}:${t}`))})]}):null,(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:e.question}),e.options.length?(0,K.jsx)(`div`,{className:`space-y-2`,children:e.options.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{d(e.id),h(``)},disabled:n,"aria-pressed":u===e.id,className:`w-full rounded-md border p-3 text-left ${u===e.id?`border-blue bg-blue/5`:`border-line bg-bg/30`}`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-ink`,children:e.label}),(0,K.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-ink-dim`,children:e.description})]},e.id))}):null,_||g||v?.requires_note||f?(0,K.jsx)(`textarea`,{"data-autofocus":!0,value:f,onChange:e=>{p(e.target.value),h(``)},onKeyDown:e=>{fc(e)||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},rows:3,disabled:n,"aria-label":_?c?`你的回答或补充说明`:`Your answer or additional details`:o(`decision.notePlaceholder`),placeholder:_?v?.requires_note?c?`填写你的回答…`:`Enter your answer…`:c?`补充说明(可选)`:`Additional details (optional)`:o(`decision.notePlaceholder`),className:`w-full resize-y rounded-lg border border-line bg-bg px-3 py-2 text-sm leading-relaxed text-ink outline-none focus:border-blue disabled:opacity-60`}):null,m||a?(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-err`,children:m||a}):null,(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:_?c?`确认后继续这次任务。`:`Confirm to continue this request.`:o(`decision.resumeHint`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md px-3 py-2 text-xs text-ink-dim hover:bg-bg`,children:o(n?`decision.closeContinue`:`decision.later`)}),(0,K.jsx)(`button`,{type:`button`,onClick:b,disabled:n,className:`rounded-md border border-blue/35 bg-blue/8 px-3 py-2 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white disabled:opacity-50`,children:o(n?`decision.applying`:g||u===`custom`?`decision.sendAnswer`:u===`stop`?`decision.stopCampaign`:`decision.useOption`)})]})]})]})]})}function Rl({alert:e}){if(!e)return null;let t=e.tone===`block`,n=e.kind===`budget`;return(0,K.jsxs)(`div`,{className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border px-3.5 py-2 text-[13px] ${t?`border-err/50 bg-err/10 text-err`:`border-warn/50 bg-warn/10 text-warn`}`,role:t?`alert`:`status`,children:[(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-bold leading-none`,children:n?`$`:t?`!`:`i`}),(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold uppercase tracking-wide`,children:n?`budget alarm`:t?`action required`:`notice`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.text,children:e.text})]})}function zl({sid:e}){let{t}=I(),n=S(),{data:r}=xe(e,!0),[i,a]=(0,U.useState)(!1);if(!e||!Sl(r?.operator_knobs))return null;let o=async()=>{a(!0);try{await F.setConfig(e,bl,`1`),await n.invalidateQueries({queryKey:[`config`,e]})}finally{a(!1)}};return(0,K.jsxs)(`div`,{"data-no-operator-banner":!0,role:`status`,className:`mx-3 mt-3 flex items-center gap-2.5 rounded-lg border border-warn/50 bg-warn/10 px-3.5 py-2 text-[13px] text-warn`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:t(`noOperator.banner`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:i,className:`shrink-0 rounded border border-warn/50 px-2 py-0.5 text-xs font-medium hover:bg-warn/10 disabled:opacity-40`,children:t(`noOperator.turnOff`)})]})}function Bl(e){let t=(e.label||e.display_name||``).trim();return!!(t&&t!==e.id)}function Vl(e){return[...e].sort((e,t)=>{if(e.daemon_alive!==t.daemon_alive)return e.daemon_alive?-1:1;let n=Bl(e);return n===Bl(t)?(t.last_active||0)-(e.last_active||0):n?-1:1})}function Hl(e){return Vl(e)[0]}function Ul(e,t){let n=t?.trim()||null;return n&&e.some(e=>e.id===n)?{id:n,requested:n,recovered:!1}:{id:Hl(e)?.id??null,requested:n,recovered:!!n}}function Wl(e,t,n){if(n){let e=t?.trim()||null;return{id:e,requested:e,recovered:!1}}return Ul(e,t)}function Gl(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return!0;let r=e.daemon_alive?`live running`:`stopped idle`,i=[e.id,e.label,e.display_name,e.objective,r].filter(Boolean).join(` `).toLowerCase();return n.every(e=>i.includes(e))}function Kl(e,t){return e.filter(e=>Gl(e,t))}function ql(e){let t=new Set;return[e.primary_target,...e.targets].filter(e=>!e?.path||t.has(e.path)?!1:(t.add(e.path),!0))}function Jl(e,t){if(t===`research`)for(let t of e){let e=ql(t).find(e=>/(?:^|\/)paper\/main\.pdf$/i.test(e.path.replace(/\\/g,`/`)));if(e)return{receipt:t,path:e.path}}let n=e[0];return n?{receipt:n,path:ql(n)[0]?.path||null}:null}function Yl(e){return e.replace(/\s*\bRESULT\s*=\s*/g,` + +`).replace(/\s*\b(?:STATUS|REVIEW_STATUS)\s*=\s*\S+/g,``).trim()}function Xl(e,t,n){let r=n.reduce((e,t)=>t.type===`ui.operator`?Math.max(e,Number(t.ts)||0):e,0),i=t&&(e===void 0||t.delivered_at>r)?t:null;return e?i&&i.delivered_at>e.delivered_at?i:e:i}function Zl(e,t){if(!t)return!1;let n=new Set([t]),r=[t];for(let t=0;te.id!==t&&n.has(e.id)&&[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))}var Ql=new Set([`done`,`passed`,`approved`,`accepted`]);function $l(e,t){let n=String(e.review_status||``).toLowerCase(),r=String(e.review_source||``).toLowerCase(),i=String(e.residual_risk||``).trim();return Ql.has(n)&&r===`reviewer`&&i?{independent:!0,text:t?`独立复核通过 · 有残余风险`:`Independently reviewed · residual risk`,title:t?`有一项检查在此环境中无法进行,已被接受为残余风险:${i}`:`One check was impossible here and its risk was accepted: ${i}`}:Ql.has(n)&&r===`reviewer`?{independent:!0,text:t?`独立复核通过`:`Independently reviewed`,title:t?`另一个审查角色检查过这份成果`:`A separate reviewer checked this result`}:!n||n===`not_assessed`||Ql.has(n)&&r?{independent:!1,text:t?`实现者自检 · 未独立复核`:`Self-checked · not independently reviewed`,title:t?`只有完成它的人自己检查过,没有另外的审查`:`Only the worker that produced it checked it; no separate review`}:Ql.has(n)?{independent:!1,text:t?`已完成 · 未记录是否独立复核`:`Completed · review source not recorded`,title:t?`这份较早的交付没有记录是谁检查的,不能确认经过独立复核`:`This older delivery did not record who checked it, so independent review cannot be confirmed`}:{independent:!1,text:t?`复核状态:${n}`:`Review: ${n}`,title:t?`独立复核没有通过或已过期`:`Independent review did not pass or is out of date`}}function eu(e,t,n){if(!n)return null;let r=e.snapshots?.find(e=>e.path===n&&e.stored);if(!r)return null;let i=t.filter(t=>t.delivery_id!==e.delivery_id&&t.delivered_att.delivered_at-e.delivered_at);for(let e of i){let t=e.snapshots?.find(e=>e.path===n);if(!(!t||t.sha256===r.sha256))return t.stored?{path:n,before:t.sha256,after:r.sha256}:null}return null}function tu({sid:e,change:t,zh:n}){let[r,i]=(0,U.useState)({open:!1,loading:!1,diff:``,error:``,truncated:!1});return(0,K.jsxs)(`div`,{className:`delivery-changes`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-expanded":r.open,onClick:()=>{if(r.open){i(e=>({...e,open:!1}));return}i(e=>({...e,open:!0,loading:!e.diff&&!e.error})),!(r.diff||r.error)&&F.deliveryDiff(e,t).then(e=>i(t=>({...t,loading:!1,truncated:e.truncated,diff:e.available?e.diff:``,error:e.available?e.diff?``:n?`内容没有变化`:`No content changes`:n?`上一版已不再保存,无法对比`:`The previous version is no longer kept`}))).catch(e=>i(t=>({...t,loading:!1,error:e instanceof Error?e.message:String(e)})))},children:r.open?n?`收起改动`:`Hide changes`:n?`查看与上一次交付相比的改动`:`Show changes since the previous delivery`}),r.open&&(r.loading?(0,K.jsx)(`p`,{children:n?`正在读取…`:`Loading…`}):r.error?(0,K.jsx)(`p`,{children:r.error}):(0,K.jsxs)(`pre`,{"aria-label":n?`改动`:`Changes`,children:[r.diff.split(` +`).map((e,t)=>(0,K.jsxs)(`span`,{className:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:void 0,children:[e,` +`]},t)),r.truncated?n?`…(改动过长,已截断)`:`… (truncated)`:``]}))]})}var nu=({children:e})=>(0,K.jsxs)(`span`,{children:[e,` `]}),ru=(0,U.memo)(function({children:e}){return(0,K.jsx)(T,{remarkPlugins:st,rehypePlugins:at,components:{p:nu,h1:nu,h2:nu,h3:nu,h4:nu,h5:nu,h6:nu,ul:nu,ol:nu,blockquote:nu,pre:nu,li:({children:e})=>(0,K.jsxs)(`span`,{className:`markdown-excerpt-item`,children:[e,` `]}),table:nu,thead:nu,tbody:nu,tr:nu,th:({children:e})=>(0,K.jsxs)(`strong`,{children:[e,` · `]}),td:nu,a:({children:e})=>(0,K.jsx)(`span`,{className:`markdown-excerpt-link`,children:e}),img:({alt:e})=>(0,K.jsx)(`span`,{children:e}),input:({checked:e})=>(0,K.jsx)(`span`,{children:e?`✓ `:`○ `}),hr:()=>(0,K.jsx)(`span`,{children:` · `}),code:({children:e})=>(0,K.jsx)(`code`,{children:e})},children:Yl(e)})});function iu({html:e,title:t,className:n=``,sid:r,path:i}){return r&&i?(0,K.jsx)(au,{sid:r,path:i,html:e,title:t,className:n}):(0,K.jsx)(`iframe`,{title:t,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white ${n}`})}function au({html:e,title:t,className:n,sid:r,path:i}){let{locale:a}=I(),o=a===`zh-CN`,s=x({queryKey:[`artifact-html`,r,i,e],queryFn:({signal:e})=>F.artifactPreview(r,i,e),enabled:!!(r&&i),staleTime:3e4,retry:1});if(r&&i&&s.isPending)return(0,K.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,role:`status`,children:o?`正在加载网页和配套资源…`:`Loading the website and its assets…`});if(r&&i&&s.isError)return(0,K.jsxs)(`div`,{className:`m-auto p-6 text-sm text-err`,role:`alert`,children:[o?`网页预览加载失败,请重试或下载文件。`:`Preview could not load. Retry or download the file.`,(0,K.jsx)(`button`,{type:`button`,className:`ml-3 underline`,onClick:()=>void s.refetch(),children:o?`重试`:`Retry`})]});let c=s.data?.served_page===!0;return(0,K.jsxs)(`div`,{className:`flex min-h-0 w-full flex-1 flex-col ${n}`,children:[!!s.data?.warnings.length&&(0,K.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`部分配套资源无法加载,页面可能不完整。`:`Some linked assets are unavailable; the preview may be incomplete.`}),!c&&(0,K.jsx)(`p`,{className:`shrink-0 bg-warn/10 px-3 py-2 text-xs text-warn`,role:`status`,children:o?`此后端尚未支持独立网页预览;当前为内嵌预览,交互脚本可能不可用。`:`This backend does not yet support standalone preview; embedded preview may not run interactive scripts.`}),(0,K.jsx)(`iframe`,{title:t,src:c?D(r,i):void 0,srcDoc:c?void 0:s.data?.html??e,sandbox:`allow-scripts allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]})}function ou(e){let t=e.trim();if(!t)return``;try{return JSON.stringify(JSON.parse(t),null,2)}catch{try{return t.split(/\r?\n/).filter(Boolean).map(e=>JSON.parse(e)).map(e=>JSON.stringify(e,null,2)).join(` +`)}catch{return e}}}function su(e,t){let n=[],r=[],i=``,a=!1;for(let o=0;oe.some(e=>e.length>0))}function cu({value:e}){return(0,K.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:ou(e)||`(empty data)`})}function lu({value:e,delimiter:t}){let n=su(e,t).slice(0,200),r=n[0]??[];return(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4 scroll-thin`,children:n.length?(0,K.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsx)(`tr`,{children:r.slice(0,40).map((e,t)=>(0,K.jsx)(`th`,{className:`border border-line/60 bg-surface px-2 py-1.5 font-semibold text-ink`,children:e},t))})}),(0,K.jsx)(`tbody`,{children:n.slice(1).map((e,t)=>(0,K.jsx)(`tr`,{children:r.slice(0,40).map((t,n)=>(0,K.jsx)(`td`,{className:`border border-line/50 px-2 py-1.5 align-top text-ink-dim`,children:e[n]??``},n))},t))})]}):(0,K.jsx)(`div`,{className:`text-sm text-ink-faint`,children:`(empty table)`})})}var uu=``+new URL(`pdf.min-Bbvtrhlt.mjs`,import.meta.url).href,du=``+new URL(`pdf.worker.min-CLrFZWeq.mjs`,import.meta.url).href,fu=null,pu=0;function mu(){fu=null,pu+=1}function hu(){if(fu)return fu;let e=new URL(uu,import.meta.url),t=new URL(du,import.meta.url);pu&&(e.searchParams.set(`retry`,String(pu)),t.searchParams.set(`retry`,String(pu)));let n=Se(()=>import(e.href).then(e=>(e.GlobalWorkerOptions.workerSrc=t.href,e)),[],import.meta.url).catch(e=>{throw fu===n&&mu(),e});return fu=n,n}function gu(e,t,n,r){let i=Math.max(1,n-32)/Math.max(1,e),a=Math.max(1,r-32)/Math.max(1,t);return Math.min(2.5,i,a)}function _u({src:e,name:t,className:n=``,onPageOrientation:r,onRetry:i}){let{locale:a}=I(),o=a===`zh-CN`,s=(0,U.useRef)(null),c=(0,U.useRef)(null),l=(0,U.useRef)(null),[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(1),[m,h]=(0,U.useState)(1),[g,_]=(0,U.useState)({width:0,height:0}),[v,y]=(0,U.useState)(!0),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(0);(0,U.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>_({width:e.clientWidth,height:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,U.useEffect)(()=>{let t=!0,n=new AbortController,r=null;return d(null),p(1),h(1),l.current=null,c.current?.scrollTo(0,0),C(``),y(!0),Promise.all([fetch(e,{signal:n.signal}).then(e=>{if(!e.ok)throw Error(`PDF request failed (${e.status})`);return e.arrayBuffer()}),hu()]).then(async([e,n])=>{if(!t)return;r=n.getDocument({data:new Uint8Array(e)});let i=await r.promise;t&&(d(i),y(!1))}).catch(e=>{t&&(y(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!1,n.abort(),r?.destroy().catch(()=>{})}},[e,w]),(0,U.useEffect)(()=>{let e=s.current;if(!u||!e||g.width<=0||g.height<=0)return;let t=!1,n=null;return x(!0),C(``),u.getPage(f).then(e=>{if(t||!s.current)return;let i=e.getViewport({scale:1});r?.(i.width>i.height?`landscape`:`portrait`);let a=gu(i.width,i.height,g.width,g.height),o=e.getViewport({scale:a*m}),u=document.createElement(`canvas`),d=u.getContext(`2d`,{alpha:!1});if(!d)throw Error(`Canvas rendering is unavailable`);let f=Math.min(window.devicePixelRatio||1,2);return u.width=Math.max(1,Math.floor(o.width*f)),u.height=Math.max(1,Math.floor(o.height*f)),n=e.render({canvas:u,canvasContext:d,viewport:o,transform:f===1?void 0:[f,0,0,f,0,0]}),n.promise.then(()=>{if(t||!s.current)return;let e=s.current,n=e.getContext(`2d`,{alpha:!1});if(!n)throw Error(`Canvas rendering is unavailable`);e.width=u.width,e.height=u.height,e.style.width=`${o.width}px`,e.style.height=`${o.height}px`,n.drawImage(u,0,0);let r=c.current,i=l.current;if(r&&i){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect();r.scrollLeft+=n.left+i.x*n.width-t.left-r.clientWidth/2,r.scrollTop+=n.top+i.y*n.height-t.top-r.clientHeight/2,l.current=null}})}).then(()=>{t||x(!1)}).catch(e=>{t||e instanceof Error&&e.name===`RenderingCancelledException`||(x(!1),C(e instanceof Error?e.message:String(e)))}),()=>{t=!0,n?.cancel()}},[r,f,u,g.height,g.width,m]);let E=e=>{let t=c.current,n=s.current;if(t&&n&&n.clientWidth&&n.clientHeight){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();l.current={x:Math.max(0,Math.min(1,(e.left+t.clientWidth/2-r.left)/r.width)),y:Math.max(0,Math.min(1,(e.top+t.clientHeight/2-r.top)/r.height))}}h(t=>Math.max(.6,Math.min(2.2,Math.round((t+e)*100)/100)))},D=()=>{l.current=null,c.current?.scrollTo(0,0),h(1)},O=u?.numPages??0;return(0,K.jsxs)(`div`,{className:`pdf-viewer flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-bg ${n}`,"aria-busy":v||b,children:[(0,K.jsxs)(`div`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-2 border-b border-line/70 bg-panel px-3 py-1.5 text-[11px] text-ink-dim`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-ink`,title:t,children:t}),(0,K.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[o?`第`:`Page`,` `,f,` / `,O||`…`]}),(0,K.jsx)(`button`,{type:`button`,disabled:!u||f<=1,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.max(1,e-1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`上一页`:`Previous`}),(0,K.jsx)(`button`,{type:`button`,disabled:!u||f>=O,onClick:()=>{c.current?.scrollTo(0,0),l.current=null,p(e=>Math.min(O,e+1))},className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`下一页`:`Next`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o?`缩小`:`Zoom out`,disabled:!u||m<=.6,onClick:()=>E(-.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`−`}),(0,K.jsxs)(`span`,{className:`w-10 text-center font-mono tabular-nums`,children:[Math.round(m*100),`%`]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o?`放大`:`Zoom in`,disabled:!u||m>=2.2,onClick:()=>E(.15),className:`flex h-7 w-7 items-center justify-center rounded border border-line hover:border-blue/50 hover:text-ink`,children:`+`}),(0,K.jsx)(`button`,{type:`button`,disabled:!u,onClick:D,className:`rounded border border-line px-2 py-1 hover:border-blue/50 hover:text-ink disabled:opacity-35`,children:o?`适合页面`:`Fit page`})]}),(0,K.jsxs)(`div`,{ref:c,className:`pdf-scroll-viewport relative min-h-0 min-w-0 flex-1 overflow-auto bg-surface/60 p-4 scroll-thin`,tabIndex:0,"aria-label":o?`PDF 页面滚动区域`:`PDF page scroll area`,children:[v?(0,K.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,K.jsx)(Ue,{})}):null,S?(0,K.jsxs)(`div`,{role:`alert`,className:`m-auto max-w-sm rounded border border-err/35 bg-err/5 p-4 text-center text-sm text-err`,children:[(0,K.jsx)(`p`,{children:o?`PDF 暂时无法预览`:`PDF preview is temporarily unavailable`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{mu(),i?i():T(e=>e+1)},className:`mt-3 rounded border border-line bg-panel px-3 py-1.5 text-ink hover:border-blue/50`,children:o?`重试预览`:`Retry preview`}),(0,K.jsxs)(`details`,{className:`mt-3 break-words text-xs text-ink-dim`,children:[(0,K.jsx)(`summary`,{children:o?`错误详情`:`Error details`}),S]})]}):null,S?null:(0,K.jsx)(`div`,{className:`pdf-page-stage flex min-h-full min-w-full w-max items-center justify-center`,children:(0,K.jsx)(`canvas`,{ref:s,role:`img`,"aria-label":`${t} · ${o?`第`:`page`} ${f}`,className:`block max-w-none shrink-0 bg-white shadow-xl`})})]})]})}function vu(e){return e.kind===`markdown`||e.mime?.split(`;`,1)[0].trim().toLowerCase()===`text/markdown`||/\.(?:md|markdown)$/i.test(e.name||e.path||``)}function yu(e){return e.title?.trim()||e.question}function bu({sid:e,path:t,onClose:n,delivery:r,deliveries:i=[],onSelectDelivery:a,onSelectPath:o,reviewActivity:s,artifacts:c=[]}){let{t:l,locale:u}=I(),d=u===`zh-CN`,f=r?ql(r):[],p=fe(e,t),m=p.data,h=m?.source===`reader_foundation`?m.reader_foundation:void 0,g=m?.source===`progress_snapshot`,_=m?vu(m):!1,[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(0),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(!1),[O,k]=(0,U.useState)(`portrait`),A=m?.kind===`pdf`||t?.toLowerCase().endsWith(`.pdf`)===!0,j=!!(t&&/(?:^|[\\/])REVIEW\.md$/i.test(t));(0,U.useEffect)(()=>{if(!(!t||!A))return pr(!0),()=>pr(!1)},[t,A]),(0,U.useEffect)(()=>{if(k(`portrait`),y(null),x(``),!e||!t||!m||![`image`,`pdf`,`audio`,`video`].includes(m.kind))return;let n=!0,r=``,i=new AbortController;return F.artifactBlob(e,t,!1,i.signal).then(e=>{n&&(r=URL.createObjectURL(e),y(r))},e=>n&&x(e.message)),()=>{n=!1,i.abort(),r&&URL.revokeObjectURL(r)}},[e,t,m?.kind,S]);let M=async(n=!1)=>{if(!(!e||!t||!m)){T(!0),x(``);try{let r=n?await F.artifactBundle(e,t):await F.artifactBlob(e,t,!0);$e(r,n?`${m.name.replace(/\.html?$/i,``)}-website.zip`:m.name)}catch(e){x(e.message)}finally{T(!1)}}};return(0,K.jsxs)(tt,{open:!!(t||r),onClose:n,label:r?d?`交付成果`:`Delivery`:l(`artifact.preview`),width:r?E?`max-w-none`:`max-w-6xl`:A?`max-w-none`:`max-w-5xl`,viewport:r?E:A,showClose:!1,style:r?{height:E?`100dvh`:`min(92dvh, 960px)`,display:`flex`,flexDirection:`column`,overflow:`hidden`}:A?{maxWidth:O===`portrait`?`min(96vw, 76dvh)`:`min(96vw, 145dvh)`}:void 0,children:[r&&!E&&(0,K.jsxs)(`header`,{className:`delivery-header`,children:[(0,K.jsxs)(`div`,{className:`delivery-heading`,children:[(0,K.jsx)(`span`,{className:`delivery-mark`,children:(0,K.jsx)(Gt,{size:22})}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{children:[`DELIVERY · `,d?`交付成果`:`Your results`]}),(0,K.jsx)(`h2`,{children:d?`成果文件`:`Result files`})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:n,className:`delivery-return`,"aria-label":d?`关闭交付弹窗`:`Close delivery`,children:[d?`返回地图`:`Back to map`,` ×`]})]}),i.length>1?(0,K.jsx)(`select`,{"aria-label":d?`选择交付任务`:`Choose delivery`,className:`delivery-task-select`,value:r.delivery_id,onChange:e=>{let t=i.find(t=>t.delivery_id===e.target.value);t&&a?.(t)},children:i.map(e=>(0,K.jsx)(`option`,{value:e.delivery_id,children:e.title},e.delivery_id))}):(0,K.jsx)(`p`,{className:`delivery-task-title`,title:r.title,children:r.title}),(0,K.jsxs)(`div`,{className:`delivery-facts`,children:[(()=>{let e=$l(r,d);return(0,K.jsxs)(`span`,{className:e.independent?`delivery-review-independent`:`delivery-review-self`,title:e.title,children:[e.independent?(0,K.jsx)(Ft,{size:13}):null,e.text]})})(),(0,K.jsxs)(`span`,{children:[f.length,` `,d?`个文件`:`files`]})]}),r.summary&&(0,K.jsxs)(`details`,{className:`delivery-summary`,children:[(0,K.jsx)(`summary`,{children:d?`查看成果说明`:`Result summary`}),(0,K.jsx)(`p`,{children:(0,K.jsx)(ru,{children:r.summary})})]})]}),!E&&!!f.length&&(0,K.jsx)(`nav`,{className:`delivery-files`,"aria-label":d?`交付文件`:`Delivery files`,children:f.map(e=>(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":t===e.path,onClick:()=>o?.(e.path),title:e.path,children:[(0,K.jsx)(`span`,{children:e.path.split(`/`).at(-1)}),r?.primary_target?.path===e.path&&(0,K.jsx)(`small`,{children:d?`主要成果`:`Main result`})]},e.path))}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-line px-4 py-3 sm:px-5 ${t?``:`hidden`}`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink ${h||g?``:`font-mono`}`,title:h?.question??m?.progress_source?.title??m?.storage_path??m?.path??t??``,children:h?yu(h):g?m?.progress_source?.title||l(`artifact.title`):m?.name??t??l(`artifact.title`)}),(0,K.jsx)(`p`,{className:`mt-0.5 truncate text-[11px] text-ink-faint`,children:h?h.kind===`clarification`||h.kind===`progress_answer`?d?`阅读问答`:`Reading question and answer`:d?`背景说明 · 不计作研究进展`:`Background explanation · separate from research progress`:g?d?`保存的进展说明 · 提问来源`:`Saved progress explanation · question source`:m?`${m.kind} · ${ct(m.size)} · ${m.mime}`:d?`正在读取文件`:`Loading file`})]}),r&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>D(e=>!e),"aria-label":E?d?`收起预览`:`Exit full screen`:d?`全屏预览`:`Full screen preview`,title:d?`切换全屏预览`:`Toggle full screen preview`,className:`shrink-0 rounded-md border border-line p-2 text-ink-dim`,children:E?(0,K.jsx)(Wt,{size:16}):(0,K.jsx)(G,{size:16})}),m?.kind===`html`&&(0,K.jsx)(`button`,{type:`button`,disabled:w,onClick:()=>void M(!0),className:`shrink-0 rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-2 text-xs text-blue-sky disabled:opacity-50`,children:d?`下载完整网页`:`Download website`}),(0,K.jsx)(`button`,{type:`button`,disabled:!m||w,onClick:()=>void M(),className:`rounded-md border border-blue-deep/60 bg-blue-deep/10 px-3 py-1.5 text-xs text-blue-sky transition-colors hover:bg-blue-deep/20 disabled:cursor-wait disabled:opacity-50`,children:l(w?`artifact.downloading`:`artifact.download`)}),(!r||E)&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(`artifact.close`),onClick:n,className:`rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink`,children:`×`})]}),(0,K.jsxs)(`div`,{className:r?`flex min-h-0 flex-1 flex-col overflow-auto bg-bg/40 p-2 sm:p-3`:A?`flex min-h-0 flex-1 flex-col overflow-hidden bg-bg/40`:`flex min-h-64 max-h-[72vh] flex-col overflow-x-hidden overflow-y-auto bg-bg/40 p-3 scroll-thin sm:p-4`,children:[!t&&r&&(0,K.jsx)(`div`,{className:`m-auto p-6 text-sm text-ink-dim`,children:(0,K.jsx)(ru,{children:r.summary})}),r&&e&&(()=>{let n=eu(r,i,t);return n?(0,K.jsx)(tu,{sid:e,change:n,zh:d},`${n.before}:${n.after}`):null})(),p.isLoading?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,p.isError?(0,K.jsxs)(`div`,{className:`m-auto text-sm text-err`,children:[l(`artifact.unavailable`),` · `,p.error.message]}):null,m?.why&&!h&&!g&&!A&&!r?(0,K.jsxs)(`div`,{className:`mb-3 rounded-md border border-line bg-surface px-3 py-2 text-xs text-ink-dim`,children:[(0,K.jsx)(`span`,{className:`mr-1 text-ink-faint`,children:`Reviewer:`}),m.why]}):null,m?.kind===`text`&&!_?(0,K.jsxs)(`pre`,{className:`min-h-52 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-bg p-4 font-mono text-xs leading-relaxed text-ink-dim scroll-thin`,children:[m.preview||l(`artifact.empty`),m.truncated?`\n\n… ${l(`artifact.truncated`)}`:``]}):null,m&&_?(0,K.jsxs)(`div`,{className:`min-h-52 overflow-auto rounded-lg border border-line bg-bg p-4 text-sm text-ink-dim scroll-thin`,children:[j&&(0,K.jsxs)(`div`,{className:`mb-4 border-b border-line pb-3 text-xs leading-5 text-ink-faint`,role:`status`,children:[s===`revising`?d?`正在根据这份意见修改论文,修改后的版本尚待复审。`:`The paper is being revised against this opinion; the revised version awaits review.`:s===`reviewing`?d?`Reviewer 正在更新本轮审稿意见,内容会自动刷新。`:`The Reviewer is updating this round’s opinion. This file refreshes automatically.`:d?`这是最近保存的审稿意见,文件更新后会自动刷新。`:`This is the latest saved review. Changes to this file appear automatically.`,m.mtime!=null&&(0,K.jsxs)(`div`,{children:[d?`最近更新:`:`Last updated: `,new Date(m.mtime*1e3).toLocaleString(u)]})]}),(0,K.jsx)(Ke,{sid:e,basePath:t||``,artifacts:[...c,...f.map(e=>({path:e.path})),...h?.sources??[],...h?.progress_source?[{path:h.progress_source.path}]:[]],onOpenArtifact:o,children:m.preview||l(`artifact.empty`)}),m.truncated?(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 border-t border-line pt-2 text-xs text-ink-faint`,children:[l(`artifact.truncated`),` · `,l(`artifact.downloadHint`)]}):null]}):null,m?.kind===`json`?(0,K.jsx)(cu,{value:m.preview||``}):null,m?.kind===`table`?(0,K.jsx)(lu,{value:m.preview||``,delimiter:m.name.endsWith(`.tsv`)?` `:`,`}):null,m?.kind===`html`?(0,K.jsx)(`div`,{className:`flex flex-1 overflow-hidden rounded-lg border border-line ${r?`min-h-0`:`min-h-[60vh]`}`,children:(0,K.jsx)(iu,{sid:e,path:t,html:m.preview||``,title:`HTML preview: ${m.name}`})}):null,m?.kind===`image`&&v?(0,K.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-bg/50`,children:(0,K.jsx)(`img`,{src:v,alt:m.why||m.name,className:`max-h-[62vh] max-w-full object-contain`})}):null,m?.kind===`pdf`&&v?(0,K.jsx)(_u,{src:v,name:m.name,className:`min-h-0 overflow-hidden`,onPageOrientation:k,onRetry:()=>C(e=>e+1)}):null,m?.kind===`audio`&&v?(0,K.jsx)(`div`,{className:`m-auto w-full max-w-xl`,children:(0,K.jsx)(`audio`,{controls:!0,preload:`metadata`,src:v,className:`w-full`})}):null,m?.kind===`video`&&v?(0,K.jsx)(`div`,{className:`flex min-h-64 flex-1 items-center justify-center rounded border border-line bg-black`,children:(0,K.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:v,className:`max-h-[62vh] max-w-full`})}):null,m&&[`image`,`pdf`,`audio`,`video`].includes(m.kind)&&!v&&!b?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,m?.kind===`binary`?(0,K.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,K.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-ink-dim`,children:l(`artifact.noPreview`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:l(`artifact.downloadHint`)})]}):null,b?(0,K.jsx)(`div`,{className:`mt-3 text-center text-xs text-err`,children:b}):null]})]})}var xu=[{label:[`从头讲清楚`,`Explain from the beginning`],question:[`请从头讲清楚这份说明。先用日常语言解释它在讨论什么、要判断什么,再按需要解释其中的对象和符号。涉及比较或公式时,请明确两边是什么、哪些条件下能比较,并用一个可复算的小例子说明。请分别说明标准背景知识、本次已有证据和仍未知的内容。`,`Explain this reading from the beginning using everyday language. Start with what it discusses and what we are trying to determine, then explain the necessary objects and symbols. For a comparison or formula, define both sides and when the comparison is valid, and work a small example I can recompute. Distinguish standard background, evidence from this run, and what remains unknown.`]},{label:[`带我算一遍`,`Work through an example`],question:[`请带我实际算一遍这份说明中的关键一步。先解释对象、输入和运算规则,再用一组明确标为教学例子的小数据展示中间步骤与结果,然后换一个输入让我能照着计算。请说明它怎样关系到正在判断的结论,以及这个例子还不能证明什么。`,`Walk me through the key operation in this reading. Explain the objects, inputs, and rules, then use a small example clearly labeled as a teaching example to show the intermediate steps and result. Change one input and work it again so I can follow the calculation. Explain how it relates to the conclusion being assessed and what the example does not prove.`]},{label:[`这说明了什么`,`What does this establish?`],question:[`这份说明究竟支持什么结论?请用我能懂的语言解释已经验证的部分、依赖的条件、未覆盖的情况,以及它和整个任务目标的关系。解释必要概念,并指出哪些只是记录中的说法、哪些有可核对的依据。`,`What conclusion does this reading support? Explain the part that has been checked, its assumptions, the cases it does not cover, and how it relates to the overall task. Explain the necessary concepts and distinguish reported claims from conclusions with verifiable supporting evidence.`]}];function Su({draft:e,onChange:t,onSubmit:n,disabled:r,children:i}){let a=I().locale===`zh-CN`,o=!!e.parentId||!!e.progressSource,s=(0,U.useRef)(null);return(0,K.jsxs)(K.Fragment,{children:[i,o&&!e.question.trim()?(0,K.jsxs)(`div`,{className:`mb-3 space-y-2`,"data-reading-question-suggestions":!0,children:[(0,K.jsx)(`p`,{className:`text-xs text-ink-dim`,children:a?`可以从这些问题开始,也可以直接输入。`:`Start with one of these questions, or write your own.`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:xu.map(n=>(0,K.jsx)(B,{type:`button`,className:`text-xs`,disabled:r,onClick:()=>{t({...e,question:n.question[+!a]}),s.current?.focus()},children:n.label[+!a]},n.label[1]))})]}):null,(0,K.jsx)(`textarea`,{ref:s,"aria-label":a?`想理解的问题`:`Question to understand`,className:`min-h-40 w-full rounded-lg border border-line bg-bg p-3 text-sm leading-6 text-ink`,maxLength:8e3,value:e.question,onChange:n=>t({...e,question:n.target.value})}),e.sourceTitle?(0,K.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[a?`从这项任务打开:`:`Opened from this task: `,e.sourceTitle]}):null,(0,K.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,K.jsx)(B,{"data-reading-submit":!0,disabled:!e.question.trim()||r,onClick:n,children:o?a?`提问`:`Ask question`:a?`生成并保存基础说明`:`Generate and save foundations`})})]})}var Cu=[1,0],wu=[{id:`up`,vector:[0,1],zh:`向上 1 格`,en:`Up 1 square`},{id:`right`,vector:[2,0],zh:`向右 2 格`,en:`Right 2 squares`},{id:`fraction`,vector:[1.5,0],zh:`向右 1.5 格`,en:`Right 1.5 squares`},{id:`zero`,vector:[0,0],zh:`留在原点`,en:`Stay at the origin`}];function Tu(e,t){return e[0]*t[1]-e[1]*t[0]===0?e.some(Boolean)||t.some(Boolean)?1:0:2}function Eu(e){if(!e)return!1;let t=[e.name,e.explanation,e.example,e.connection].join(` `);return/独立(?:的)?方向|线性(?:无关|独立)|independent\s+directions?\b|linear\s+independence\b|linearly\s+independent\b/iu.test(t)}function Du(){let{locale:e}=I(),t=e===`zh-CN`,n=(e,n)=>t?e:n,[r,i]=(0,U.useState)(wu[0]),a=(0,U.useId)(),o=r.vector,s=Tu(Cu,o),c=e=>62+e*36,l=e=>116-e*36,u=r.id===`up`?n(`只沿 A 左右移动,走不到 B 的终点;B 补上了上下方向。`,`Moving left or right along A cannot reach B’s endpoint. B adds an up-and-down direction.`):r.id===`right`?n(`走两次 A 就能代替 B。步子更长,并没有增加独立方向。`,`Two copies of A replace B. A longer step does not add an independent direction.`):r.id===`fraction`?n(`走两次 B 和走三次 A,都向右走了 3 格。虽然两者互相都不是整数倍,仍只有一个独立方向。`,`Two copies of B and three copies of A both move 3 squares right. Neither is an integer multiple of the other, but they still provide only one independent direction.`):n(`B 没有移动,没有增加方向;A 仍提供一个独立方向。`,`B does not move, so it adds no direction. A still provides one independent direction.`),d=n(`这两支箭头提供 ${s} 个独立方向`,`These two arrows provide ${s} independent direction${s===1?``:`s`}`);return(0,K.jsxs)(`section`,{className:`my-2 rounded-lg border border-line bg-surface p-3`,"aria-label":n(`平面上的独立方向示意`,`Independent directions in a plane`),"data-testid":`direction-example`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-5 text-ink-dim`,children:n(`A 固定向右走 1 格。改变 B,看看它是否提供新的走法。允许把箭头缩放、反向,再相加。`,`A always moves 1 square right. Change B to see whether it adds a new way to move. Arrows may be scaled, reversed, and added.`)}),(0,K.jsxs)(`svg`,{viewBox:`0 0 210 180`,className:`mx-auto my-2 block w-full max-w-[260px]`,role:`img`,"aria-labelledby":`${a}-title ${a}-desc`,children:[(0,K.jsx)(`title`,{id:`${a}-title`,children:d}),(0,K.jsx)(`desc`,{id:`${a}-desc`,children:`A = (1, 0), B = (${o[0]}, ${o[1]}). ${u}`}),(0,K.jsxs)(`defs`,{children:[(0,K.jsx)(`marker`,{id:`${a}-a`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,K.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:R.accent})}),(0,K.jsx)(`marker`,{id:`${a}-b`,markerWidth:`7`,markerHeight:`7`,refX:`5.5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,K.jsx)(`path`,{d:`M0 0 L6 3 L0 6`,fill:R.success})})]}),(0,K.jsx)(`rect`,{x:`20`,y:`32`,width:`165`,height:`125`,rx:`4`,fill:R.accent,opacity:s===2?.07:0}),[-1,0,1,2,3].map(e=>(0,K.jsx)(`line`,{x1:c(e),x2:c(e),y1:`32`,y2:`157`,stroke:`rgb(var(--line))`},`x${e}`)),[-1,0,1,2].map(e=>(0,K.jsx)(`line`,{y1:l(e),y2:l(e),x1:`20`,x2:`185`,stroke:`rgb(var(--line))`},`y${e}`)),s===1?(0,K.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:R.accent,strokeWidth:`10`,opacity:`.09`}):null,(0,K.jsx)(`line`,{x1:`20`,x2:`185`,y1:l(0),y2:l(0),stroke:R.inkFaint}),(0,K.jsx)(`line`,{x1:c(0),x2:c(0),y1:`32`,y2:`157`,stroke:R.inkFaint}),[0,1,2,3].map(e=>(0,K.jsx)(`text`,{x:c(e)-3,y:l(0)+14,fill:R.inkFaint,fontSize:`9`,children:e},e)),r.id===`zero`?(0,K.jsx)(`circle`,{cx:c(0),cy:l(0),r:`5`,fill:`rgb(var(--surface))`,stroke:R.success,strokeWidth:`3`,"data-testid":`direction-b-zero`}):(0,K.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(o[0]),y2:l(o[1]),stroke:R.success,strokeWidth:`3`,markerEnd:`url(#${a}-b)`,"data-testid":`direction-b`}),(0,K.jsx)(`line`,{x1:c(0),y1:l(0),x2:c(Cu[0]),y2:l(Cu[1]),stroke:R.accent,strokeWidth:`3`,markerEnd:`url(#${a}-a)`}),(0,K.jsx)(`text`,{x:c(Cu[0])+3,y:l(Cu[1])-10,fill:R.accent,fontSize:`12`,fontWeight:`600`,children:`A`}),(0,K.jsx)(`text`,{x:c(o[0])+(r.id===`zero`?-17:8),y:l(o[1])+(r.id===`up`?-3:28),fill:R.success,fontSize:`12`,fontWeight:`600`,children:`B`})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,role:`group`,"aria-label":n(`选择 B 的走法`,`Choose B’s movement`),children:wu.map(e=>(0,K.jsx)(B,{className:`text-[11px]`,variant:r.id===e.id?`primary`:`ghost`,"aria-pressed":r.id===e.id,onClick:()=>i(e),"data-choice":e.id,children:t?e.zh:e.en},e.id))}),(0,K.jsxs)(`div`,{className:`mt-3`,"aria-live":`polite`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium text-ink`,"data-testid":`direction-count`,children:d}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-ink-dim`,children:u})]}),(0,K.jsx)(`p`,{className:`mt-3 border-t border-line pt-2 text-[11px] leading-5 text-ink-faint`,children:n(`这里只统计这两支箭头提供的方向。找到一些独立方向,不等于已经找全研究对象的所有方向;图里的数字不能用来计算曲面的 Picard 数,也不能证明研究中的条件。`,`This counts only the directions supplied by these two arrows. Finding some independent directions does not establish that they span the whole research object. These numbers cannot determine a surface’s Picard number or prove the conditions used in the research.`)})]})}function Ou({path:e,identity:t,artifacts:n,onOpenArtifact:r}){let{locale:i}=I(),a=i===`zh-CN`,o={artifacts:n,onOpenArtifact:r};return(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-learning-path":t,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`理解这个问题`:`Understand the question`}),(0,K.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-question":!0,children:(0,K.jsx)(Ke,{...o,children:e.question})}),(0,K.jsx)(`ol`,{className:`mt-4 grid list-none gap-5 p-0`,children:e.steps.map((e,n)=>(0,K.jsxs)(`li`,{className:`min-w-0 border-t border-line/50 pt-3`,"data-learning-step":n+1,children:[(0,K.jsxs)(`h4`,{className:`mb-2 text-sm font-medium text-ink`,children:[(0,K.jsxs)(`span`,{className:`mr-2 text-ink-faint`,children:[n+1,`.`]}),e.title]}),(0,K.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,"data-learning-explanation":!0,children:(0,K.jsx)(Ke,{...o,children:e.explanation})}),(0,K.jsxs)(`div`,{className:`mt-3 border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-learning-example":!0,children:[(0,K.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`例子`:`Example`}),(0,K.jsx)(Ke,{...o,children:e.example})]}),(0,K.jsxs)(`div`,{className:`mt-3 text-[13px] leading-6 text-ink-dim`,"data-learning-check":!0,children:[(0,K.jsx)(`h5`,{className:`mb-1 text-xs font-medium text-ink`,children:a?`小问题`:`Try it`}),(0,K.jsx)(`div`,{"data-learning-check-question":!0,children:(0,K.jsx)(Ke,{...o,children:e.check.question})}),(0,K.jsx)(nt,{label:a?`点击看解答`:`Show the answer`,children:(0,K.jsx)(`div`,{"data-learning-check-answer":!0,children:(0,K.jsx)(Ke,{...o,children:e.check.answer})})},`${e.check.question}:${e.check.answer}`)]})]},`${t}:${n}`))})]})}var ku=0,Au=(e,t,n=0)=>[`explanation-progress`,...e,t,n];function ju(e,t,n=0){return t?[t.id,`${t.id}:active`,`${t.id}:outcome`].includes(e??``)?typeof t.started_ts==`number`&&Number.isFinite(t.started_ts)&&t.started_ts>=0?t.started_ts:n:0:n}function Mu(e,t,n){let r=++ku,i=n.map(e=>Au(t,e.key,e.startedAt));for(let t of i)e.setQueryData(t,{requestId:r,phase:null});return{update:t=>{for(let n of i)e.setQueryData(n,e=>e?.requestId===r?{requestId:r,phase:t}:e)},finish:()=>{for(let t of i)e.setQueryData(t,e=>e?.requestId===r?null:e)}}}function Nu(e,t,n=0){let r=x({queryKey:Au(e,t??``,n),queryFn:async()=>null,initialData:null,enabled:!1,staleTime:1/0,gcTime:72e5});return{active:!!r.data,phase:r.data?.phase??void 0}}function Pu(e,t){return e?{waiting_for_source:[`等待开始整理说明`,`Waiting to prepare the explanation`],planning:[`正在梳理概念与讲解顺序`,`Organizing the concepts and explanation`],writing:[`正在撰写说明`,`Writing the explanation`],reviewing:[`正在核对说明与来源`,`Checking the explanation against its sources`]}[e][+!t]:t?`正在整理说明`:`Preparing an explanation`}function Fu({value:e,expandLabel:t,clamp:n=!0}){let[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(null),{locale:c}=I();return(0,U.useEffect)(()=>{let e=s.current;if(!e||!n||r)return;let t=()=>o(e.scrollHeight>e.clientHeight+1);t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,n,r]),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{ref:s,className:`text-[13px] leading-6 text-ink-dim ${!n||r?``:`line-clamp-3`}`,children:(0,K.jsx)(Ke,{children:e})}),n&&(a||r)?(0,K.jsxs)(`button`,{type:`button`,className:`mt-0.5 text-xs text-blue-sky hover:underline`,onClick:()=>i(!r),"aria-expanded":r,children:[r?c===`zh-CN`?`收起`:`Show less`:t,(0,K.jsx)(Me,{size:11,className:`ml-1 inline ${r?`rotate-180`:``}`})]}):null]})}function Iu({generatedAt:e,pending:t=!1,generating:n=!1,phase:r,hasExplanation:i=!1,error:a,unavailable:o=!1,retry:s,retryDisabled:c=!1}){let{locale:l}=I(),u=l===`zh-CN`,d=ft({ts:e}),f=d?.toLocaleString(l,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})??``,p=!!a||o;return!(i&&(f||t))&&!n&&!p?null:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,"data-testid":`research-brief-status`,children:[i&&(f||t)?(0,K.jsxs)(`span`,{className:`text-[11px] text-ink-faint`,children:[t?`${u?`上次说明`:`Previous explanation`}${f||!p?` · `:``}`:``,f?(0,K.jsx)(`time`,{dateTime:d?.toISOString(),title:d?.toLocaleString(l),children:f}):null,t&&!p?`${f?` · `:``}${u?`待更新`:`update pending`}`:``]}):null,p?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-ink-faint`,children:a?u?`说明生成未完成;不会自动重复请求。`:`The explanation could not be prepared. This request will not be repeated automatically.`:u?`说明暂未更新;可以手动重试。`:`The explanation has not been updated yet. You can retry manually.`}),s?(0,K.jsxs)(B,{className:`inline-flex items-center gap-1 text-xs`,disabled:n||c,onClick:()=>void s(),children:[(0,K.jsx)(Pe,{size:12}),u?`重试`:`Retry`]}):null]}):n?(0,K.jsxs)(`span`,{role:`status`,"data-explanation-phase":r??`pending`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint`,children:[(0,K.jsx)(Ue,{}),Pu(r,u)]}):null]})}function Lu({brief:e,identity:t,detail:n,learningPath:r,foundation:i,readingUnavailable:a=!1,teachingUnavailable:o=!1,artifacts:s,onOpenArtifact:c}){let{locale:l}=I(),u=l===`zh-CN`,d=(e,t)=>u?e:t;return(0,K.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-4`,"data-reader-explanation":t,children:[i?(0,K.jsxs)(`div`,{className:`rounded border border-line/60 p-2 text-xs text-ink-dim`,"data-foundation-id":i.id,children:[(0,K.jsxs)(`p`,{children:[d(`这次进展参考的基础说明:`,`Foundations used to explain this progress: `),i.question]}),c?(0,K.jsx)(B,{className:`mt-1 text-xs`,onClick:()=>c(i.path),children:d(`阅读这份基础说明`,`Read these foundations`)}):null]}):null,a?(0,K.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`阅读说明还需要核对,可以继续问这一步。`,`The reading explanation still needs checking. You can keep asking about this step.`)}):o?(0,K.jsx)(`p`,{className:`text-xs text-ink-faint`,children:d(`这个概念的说明还没核对清楚,可以继续问这一步。`,`The explanation of this concept has not been checked clearly yet. You can keep asking about this step.`)}):null,r?(0,K.jsx)(Ou,{path:r,identity:t,artifacts:s,onOpenArtifact:c},t):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-why":t,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`这一步为什么有用`,`Why this step helps`)}),(0,K.jsx)(Fu,{value:e.why,expandLabel:d(`完整说明`,`Full explanation`),clamp:!1},`why:${t}`)]}),e.concept?(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-teaching":t,children:[(0,K.jsxs)(`h3`,{className:`mb-3 text-xs font-medium text-ink`,children:[d(`认识一个概念`,`One useful concept`),` · `,e.concept.name]}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3`,"data-reader-teaching-columns":t,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,"data-reader-definition":t,children:[(0,K.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`定义`,`Definition`)}),(0,K.jsx)(Fu,{value:e.concept.explanation,expandLabel:d(`完整定义`,`Full definition`),clamp:!1},`concept:${t}:${e.concept.name}`)]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`border-l-2 border-line pl-3 text-[13px] leading-6 text-ink-dim`,"data-testid":`concept-example`,children:[(0,K.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`例子`,`Example`)}),(0,K.jsx)(Ke,{artifacts:s,onOpenArtifact:c,children:e.concept.example})]}),Eu(e.concept)?(0,K.jsx)(nt,{label:d(`动手看两个方向`,`Try two directions`),children:(0,K.jsx)(Du,{})}):null]}),(0,K.jsxs)(`div`,{className:`min-w-0`,"data-reader-connection":t,children:[(0,K.jsx)(`h4`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`与本步的关系`,`Connection to this step`)}),(0,K.jsx)(`div`,{className:`text-[13px] leading-6 text-ink-dim`,children:(0,K.jsx)(Ke,{artifacts:s,onOpenArtifact:c,children:e.concept.connection})})]})]})]}):null]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`结论到哪里为止`,`What this does and does not establish`)}),(0,K.jsx)(Fu,{value:e.scope,expandLabel:d(`完整适用范围`,`Full scope`),clamp:!1},`scope:${t}`)]}),(0,K.jsxs)(`section`,{className:`min-w-0`,"data-reader-next-interpretation":t,children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-medium text-ink`,children:d(`解说对后续的理解`,`How the explanation interprets the follow-up`)}),(0,K.jsx)(Fu,{value:e.next,expandLabel:d(`完整解读`,`Full interpretation`),clamp:!1},`next:${t}`)]}),n?(0,K.jsx)(nt,{className:`min-w-0`,label:d(`详细说明与条件`,`Detailed explanation and conditions`),children:(0,K.jsx)(`div`,{className:`macro-reader-markdown text-[13px] leading-6 text-ink-dim`,children:(0,K.jsx)(Ke,{artifacts:s,onOpenArtifact:c,children:n})})},`detail:${t}`):null]})}function Ru(e){if(!e||typeof e!=`object`)return!1;let t=e;return[`source_id`,`title`,`path`,`task_id`,`card_key`].every(e=>typeof t[e]==`string`&&String(t[e]).trim())&&Number.isFinite(t.generated_at)&&t.generated_at>=0&&Number.isSafeInteger(t.copy_revision)&&t.copy_revision>=0}var zu=(e,t)=>[`reader-foundation-choice`,e,t],Bu=(e,t)=>`argus:reader-foundation:${e}:${t}`,Vu=e=>[`artifacts`,e,`reader`],Hu=(e,t)=>[`reader-foundation-request`,e,t],Uu=(e,t)=>`${Bu(e,t)}:request`;function Wu(e,t){let n=gt(Bu(e,t));if(!n)return{id:null,choice:0};try{let e=JSON.parse(n);if((typeof e?.id==`string`||e?.id===null)&&Number.isSafeInteger(e.choice)&&e.choice>=0)return e}catch{}return{id:n,choice:0}}function Gu(e,t){try{let n=JSON.parse(gt(Uu(e,t))||`null`);return typeof n?.id==`string`&&typeof n.draft?.question==`string`&&typeof n.beforeChoice==`number`?n:null}catch{return null}}function Ku(e,t,n,r){e.setQueryData(Hu(t,n),r),ht(Uu(t,n),JSON.stringify(r))}function qu(e,t,n,r){let i=e.getQueryData(Hu(t,n)),a=Gu(t,n);i?.id===r&&(!a||a.id===r)&&Ku(e,t,n,null)}function Ju(e,t){return x({queryKey:Hu(e,t),queryFn:b,enabled:!1,initialData:()=>Gu(e,t),staleTime:1/0,gcTime:1/0}).data??null}function Yu(e,t,n,r){let i={id:r,choice:Xu(e,t,n).choice+1};return e.setQueryData(zu(t,n),i),ht(Bu(t,n),JSON.stringify(i)),i}function Xu(e,t,n){let r=e.getQueryData(zu(t,n)),i=Wu(t,n);return r&&r.choice>=i.choice?r:i}function Zu(e,t){return x({queryKey:zu(e,t),queryFn:b,enabled:!1,initialData:()=>Wu(e,t),staleTime:1/0,gcTime:1/0}).data}function Qu(e,t=j()===`question-foundation`){return x({queryKey:Vu(e),queryFn:async({signal:t})=>(await F.artifacts(e,t,!0)).filter(e=>e.source===`reader_foundation`),enabled:!!e&&t,refetchInterval:e=>e.state.data?.some(e=>e.reader_foundation?.state===`generating`)?5e3:!1,retry:!1,refetchOnWindowFocus:!1})}function $u(e){let t=e.reader_foundation;return!!t&&(t.kind??`foundation`)===`foundation`&&!t.parent_id&&!t.progress_source}function ed(e,t,n=!0){let r=S(),i=Qu(e,n),a=Ju(e,t),o=[`reader-foundation-create`,e,t],s=w({filters:{mutationKey:o,status:`pending`},select:e=>e.state.variables?.id}),c=Nu(o,s.at(-1)??a?.id),l=n=>({sid:n.sid??e,locale:n.locale??t}),u=C({mutationKey:o,mutationFn:async e=>{let t=l(e),n=Mu(r,[`reader-foundation-create`,t.sid,t.locale],[{key:e.id}]);try{let r={request_id:e.id,question:e.draft.question.trim(),locale:t.locale},i=e.draft.parentId?await F.askReaderFoundation(t.sid,e.draft.parentId,r,n.update):await F.generateReaderFoundation(t.sid,{...r,...e.draft.progressSource?{progress_source:{source_id:e.draft.progressSource.source_id}}:e.draft.sourceTaskId?{source_task_id:e.draft.sourceTaskId}:{}},n.update),a=i.reader_foundation;if(a?.id!==e.id||a.locale!==t.locale)throw Error(t.locale===`zh-CN`?`说明请求的结果尚未确认。`:`The result of this explanation request is unconfirmed.`);if(e.draft.parentId&&(a.kind!==`clarification`||a.parent_id!==e.draft.parentId))throw Error(t.locale===`zh-CN`?`追问与来源说明的对应关系尚未确认。`:`The question’s connection to its source is unconfirmed.`);if(e.draft.progressSource&&(a.progress_source?.source_id!==e.draft.progressSource.source_id||!e.draft.parentId&&a.kind!==`progress_answer`))throw Error(t.locale===`zh-CN`?`回答与这版进展说明的对应关系尚未确认。`:`The answer’s connection to this progress explanation is unconfirmed.`);return i}finally{n.finish(),await r.invalidateQueries({queryKey:Vu(t.sid)})}},onSuccess:(e,t)=>{let n=l(t);!t.draft.parentId&&!t.draft.progressSource&&$u(e)&&e.exists&&e.reader_foundation?.state===`complete`&&Xu(r,n.sid,n.locale).choice===t.beforeChoice&&Yu(r,n.sid,n.locale,e.reader_foundation.id),r.setQueryData(Vu(n.sid),t=>{let n=t?.find(t=>t.path===e.path);return n&&n.reader_foundation?.state!==`generating`&&e.reader_foundation?.state===`generating`?t:[...(t??[]).filter(t=>t.path!==e.path),e]}),t.draft.progressSource||r.invalidateQueries({queryKey:[`map-copy`,`project`,n.sid]})},onError:(e,t)=>{if(e instanceof N&&e.code===`reader_source_unavailable`){let e=l(t);Ku(r,e.sid,e.locale,{...t,rejected:`reader_source_unavailable`})}},retry:!1}),d=(i.data??[]).filter(e=>e.reader_foundation?.locale===t),f=d.some(e=>e.reader_foundation?.state===`generating`),p=d.some(e=>e.reader_foundation?.state===`generating`&&e.reader_foundation.deadline_exceeded),m=u.variables&&l(u.variables),h=m?.sid===e&&m.locale===t,g=h&&u.isPending||s.length>0||c.active,_=a?.id??(h?u.variables?.id:void 0),v=d.find(e=>e.reader_foundation?.id===_),y=v?.reader_foundation?.state===`failed`,b=v?.reader_foundation?.state===`complete`,x=a?.rejected===`reader_source_unavailable`,T=!!a&&!x&&!v&&!g,E=g||f||!!a&&!x||i.isPending||i.isError;return(0,U.useEffect)(()=>{a&&(y||b)&&qu(r,e,t,a.id)},[r,e,t,a,y,b]),{client:r,list:i,notes:d,pendingRequest:a,progress:c,generation:u,waiting:f,overdue:p,creating:g,requested:v,confirmedFailure:y,confirmedComplete:b,requestRejected:x,unknownResult:T,creationBlocked:E,submit:n=>{if(!n.question.trim()||E)return null;let i=crypto.randomUUID(),a={id:i,sid:e,locale:t,draft:{...n,...n.progressSource?{progressSource:{...n.progressSource}}:{}},beforeChoice:Xu(r,e,t).choice};return Ku(r,e,t,a),u.mutate(a),i},retrySavedRequest:n=>u.mutate({...n,sid:n.sid??e,locale:n.locale??t})}}var td=(0,U.createContext)(null);function nd({card:e,cardKey:t,taskId:n,readOnly:r=!1,context:i}){let a=(0,U.useContext)(td),o=I().locale===`zh-CN`,[s,c]=(0,U.useState)(`idle`),[l,u]=(0,U.useState)(!1),d=(0,U.useRef)(0),f=i??a?.context,p=JSON.stringify([a?.sid,a?.readOnly,r,f,t,n,e?.copy_revision,e?.generated_at,e?.title]),m=(0,U.useRef)(p);if(m.current=p,(0,U.useEffect)(()=>(c(`idle`),()=>{d.current+=1}),[p]),!a?.sid||a.readOnly||r)return null;let h=!!e&&Number.isSafeInteger(e.copy_revision)&&!!e.title?.trim()&&!(f?.preview===`question-foundation`&&!f.foundationId),g=async()=>{if(!h||!f||s===`opening`)return;let r=++d.current;c(`opening`);try{let i=await a.source(t,n,f);if(r!==d.current||m.current!==p)return;if(i&&(i.copy_revision!==e.copy_revision||i.generated_at!==e.generated_at||i.title!==e.title))throw new N(`The selected explanation has changed.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);c(`idle`),i&&a.open(i)}catch(e){r===d.current&&m.current===p&&(u(e instanceof N&&e.code===`reader_source_unavailable`),c(`failed`))}};return(0,K.jsxs)(`span`,{className:`inline-flex flex-col items-start gap-1`,children:[(0,K.jsxs)(B,{className:`inline-flex items-center gap-1 text-xs`,disabled:!h||s===`opening`,title:h?void 0:o?`这一步的说明写好后就可以提问。`:`Questions open once this step has an explanation.`,"data-testid":`progress-question-trigger`,"data-progress-question-card":t,"data-progress-question-state":s,onClick:()=>void g(),children:[(0,K.jsx)(Ut,{size:12}),o?`问这一步`:`Ask about this step`]}),s===`failed`?(0,K.jsx)(`span`,{role:`alert`,className:`text-xs text-ink-dim`,children:l?o?`这版说明暂不可用或已变化,未打开提问。请刷新页面后再试。`:`This explanation is unavailable or has changed. No question was opened. Reload this page and try again.`:o?`暂时无法读取这一步的提问材料,未打开提问。请再试一次。`:`The question material could not be loaded. No question was opened. Please try again.`}):null]})}function rd({sid:e,path:t,artifacts:n,onOpenArtifact:r}){let i=I().locale===`zh-CN`,a=x({queryKey:[`reading-question-artifact`,e,t],queryFn:async({signal:n})=>{let r=await F.artifact(e,t,n);if(r.exists&&r.path===t&&(r.truncated||typeof r.preview!=`string`)){let i=await F.artifactBlob(e,t,!1,n);return{...r,preview:await i.text(),truncated:!1}}return r},retry:!1,staleTime:1/0,refetchOnWindowFocus:!1});return a.isPending?(0,K.jsx)(`p`,{className:`text-xs text-ink-faint`,children:i?`正在读取保存内容…`:`Loading saved reading…`}):a.isError||!a.data?.exists||a.data.path!==t?(0,K.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[i?`保存内容暂时无法读取。`:`The saved reading could not be loaded.`,(0,K.jsx)(B,{className:`ml-2 text-xs`,onClick:()=>void a.refetch(),children:i?`重新读取`:`Reload`})]}):(0,K.jsxs)(`div`,{className:`min-w-0 max-w-full overflow-x-auto break-words`,"data-reading-artifact-path":t,children:[(0,K.jsx)(Ke,{artifacts:[...n,...a.data.reader_foundation?.sources??[]],onOpenArtifact:r,children:a.data.preview??``}),a.data.truncated?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:i?`此处显示保存内容的节选。`:`This view shows an excerpt of the saved reading.`}):null]})}function id({sid:e,readOnly:t=!1,children:n}){let r=I().locale,i=r===`zh-CN`?`zh-CN`:`en-US`,a=i===`zh-CN`,o=ed(e??``,i,!!e),s=Zu(e??``,i).id,c=(0,U.useRef)(0),l=async(t,n,r)=>{let i=++c.current,{preview:a,foundationId:o,locale:s}=r,l=await F.mapQuestionSource(e??``,{card_key:t,task_id:n,locale:s,...a?{preview:a}:{},...a===`question-foundation`&&o?{foundation_id:o}:{}});if(i!==c.current)return null;if(!Ru(l)||l.card_key!==t||l.task_id!==n||!l.path.startsWith(`reader-progress/${e}/`))throw new N(`The reading source does not match this step.`,422,`POST`,`/map-question-source`,`reader_source_unavailable`);return l},[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(null);(0,U.useEffect)(()=>(d(null),p(null),h(null),_(!1),y(null),()=>{c.current+=1}),[e,i]);let b=u&&u.sid===e&&u.locale===i?u:null,x=b?.source,S=o.notes.filter(e=>Ru(e.reader_foundation?.progress_source)),C=o.pendingRequest?.draft.progressSource?o.pendingRequest:null,w=new Map;for(let t of S){let n=t.reader_foundation.progress_source;n.path.startsWith(`reader-progress/${e}/`)&&w.set(n.source_id,n)}C?.draft.progressSource&&w.set(C.draft.progressSource.source_id,C.draft.progressSource),x&&w.set(x.source_id,x);let T=[...o.list.data??[],...[...w.values()].map(e=>({path:e.path}))],E=e=>{e===x?.path?(_(!0),y(null)):y(e)},D=x?S.filter(e=>e.reader_foundation.progress_source.source_id===x.source_id):[],O=D.find(e=>e.reader_foundation?.id===m),k=O?.exists&&O.reader_foundation?.state===`complete`,A=C?.draft.progressSource?.source_id===x?.source_id?C:null,M=A?D.find(e=>e.reader_foundation?.id===A.id):void 0,ee=!!A&&A.rejected===`reader_source_unavailable`,P=!!A&&!ee&&!M&&!o.creating,te=n=>{c.current+=1;let r=n??C?.draft.progressSource??[...w.values()].at(-1);if(!e||!Ru(r)||!r.path.startsWith(`reader-progress/${e}/`))return;d({sid:e,locale:i,source:{...r}}),_(!1),y(null);let a=S.filter(e=>e.reader_foundation?.progress_source?.source_id===r.source_id).at(-1);h(a?.reader_foundation?.id??null),p(n&&!t?{question:``,progressSource:{...r}}:null)},ne=()=>{d(null),p(null),h(null),_(!1),y(null)},re=t=>{e&&(d({sid:e,locale:i,source:{...t}}),h(null),_(!1),y(null),p(e=>e?{question:e.question,progressSource:{...t}}:null))},L=()=>{if(t||!b||!f?.progressSource||f.progressSource.source_id!==b.source.source_id||f.parentId&&!D.some(e=>e.reader_foundation?.id===f.parentId&&e.exists&&e.reader_foundation?.state===`complete`))return;let e=o.submit(f);e&&(h(e),p(null))},ie=!!A&&o.creating||D.some(e=>e.reader_foundation?.state===`generating`);return(0,K.jsxs)(td.Provider,{value:{sid:e??``,readOnly:t,hasHistory:w.size>0,open:te,source:l,context:{locale:i,preview:j(),foundationId:s}},children:[n,(0,K.jsx)(tt,{open:!!b,onClose:ne,label:a?`进展阅读问答`:`Questions about this progress`,children:b&&x?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Qe,{title:a?`哪里还不明白`:`What is still unclear`,sub:x.title}),(0,K.jsxs)(`div`,{className:`space-y-4 px-6 pb-6`,"data-testid":`progress-questions`,"data-project-id":b.sid,"data-progress-source-id":x.source_id,"data-progress-source-title":x.title,"data-reader-card":x.card_key,"data-reader-task-id":x.task_id,children:[(0,K.jsxs)(`div`,{className:`rounded-lg border border-line/70 p-3 text-xs text-ink-dim`,children:[(0,K.jsxs)(`p`,{children:[a?`引用打开提问时的这版说明:`:`Using the explanation selected when this question was opened: `,x.title]}),(0,K.jsx)(`time`,{dateTime:new Date(x.generated_at*1e3).toISOString(),className:`mt-1 block text-ink-faint`,children:new Date(x.generated_at*1e3).toLocaleString(r)}),(0,K.jsx)(B,{className:`mt-2 text-xs`,"data-reading-source-path":x.path,onClick:()=>_(e=>!e),children:g?a?`收起原说明`:`Hide original explanation`:a?`阅读当时说明`:`Read the original explanation`}),g?(0,K.jsx)(`div`,{className:`mt-3 text-[13px] leading-6`,children:(0,K.jsx)(rd,{sid:b.sid,path:x.path,artifacts:T,onOpenArtifact:E})}):null]}),w.size>1?(0,K.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`查看已保存的进展问答`:`Saved progress questions`,(0,K.jsx)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:x.source_id,disabled:o.creating,onChange:e=>{let t=w.get(e.target.value);t&&re(t)},children:[...w.values()].map(e=>(0,K.jsxs)(`option`,{value:e.source_id,children:[e.title,` · `,new Date(e.generated_at*1e3).toLocaleString(r)]},e.source_id))})]}):null,D.length?(0,K.jsxs)(`label`,{className:`block text-xs text-ink-dim`,children:[a?`已保存的问题`:`Saved questions`,(0,K.jsxs)(`select`,{className:`mt-1 block w-full rounded border border-line bg-bg px-2 py-2 text-xs`,value:m??``,onChange:e=>{h(e.target.value||null),y(null)},children:[(0,K.jsx)(`option`,{value:``,children:a?`选择一个问题`:`Choose a question`}),D.map(e=>(0,K.jsx)(`option`,{value:e.reader_foundation.id,title:e.reader_foundation.question,children:yu(e.reader_foundation)},e.path))]})]}):null,O?(0,K.jsxs)(`section`,{className:`space-y-3 text-[13px] leading-6`,"data-reading-question-id":O.reader_foundation.id,children:[k?(0,K.jsx)(nt,{label:a?`查看这次问题`:`View this question`,children:(0,K.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-ink-dim`,children:O.reader_foundation.question})},O.reader_foundation.id):(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words font-medium`,children:O.reader_foundation.question}),k?(0,K.jsx)(rd,{sid:b.sid,path:O.path,artifacts:T,onOpenArtifact:E}):(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:O.reader_foundation.state===`generating`?a?`回答仍在整理,尚未确认结束。`:`The answer is still being prepared; completion is unconfirmed.`:a?`这次回答未完成,原问题已保留。`:`This answer did not finish; its question is retained.`}),!t&&O.exists&&O.reader_foundation.state===`complete`?(0,K.jsx)(B,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x},parentId:O.reader_foundation.id,parentTitle:yu(O.reader_foundation)}),children:a?`继续问这份回答`:`Ask a follow-up to this answer`}):null,!t&&O.reader_foundation.state===`failed`?(0,K.jsx)(B,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:O.reader_foundation.question,progressSource:{...x},parentId:O.reader_foundation.parent_id??void 0}),children:a?`重新编辑问题`:`Edit this question`}):null]}):null,v?(0,K.jsxs)(`section`,{className:`space-y-2 rounded-lg border border-line/70 p-3 text-[13px] leading-6`,"data-referenced-reading-path":v,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-ink-faint`,children:[(0,K.jsx)(`span`,{children:a?`引用的保存内容`:`Referenced saved reading`}),(0,K.jsx)(B,{className:`text-xs`,onClick:()=>y(null),children:a?`收起引用`:`Close referenced reading`})]}),(0,K.jsx)(rd,{sid:b.sid,path:v,artifacts:T,onOpenArtifact:E})]}):null,ie?(0,K.jsx)(Iu,{generating:!0,phase:A?o.progress.phase:void 0}):null,A?(0,K.jsxs)(`div`,{className:`space-y-2 text-xs text-ink-faint`,"data-pending-reading-question":A.id,children:[(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:A.draft.question}),ee?(0,K.jsx)(`p`,{role:`status`,children:a?`引用的说明目前不可用,这次追问未发起。问题与原来源已保留。`:`The reading source is unavailable, so this question was not started. Its question and original source are saved.`}):P?(0,K.jsx)(`p`,{role:`status`,children:a?`这次请求的结果尚未确认;刷新不会重新生成。`:`The result of this request is unconfirmed. Refreshing does not generate it again.`}):null,!t&&!o.creating&&!o.waiting?(0,K.jsx)(B,{className:`text-xs`,onClick:()=>{ee?(p({...A.draft}),o.generation.reset()):o.retrySavedRequest(A)},children:ee?a?`编辑问题与来源`:`Edit question and source`:a?`重试同一请求`:`Retry this same request`}):null]}):C&&o.creationBlocked?(0,K.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`另一个阅读请求尚未结束。`:`Another reading request is still unresolved.`,(0,K.jsx)(B,{className:`ml-2 text-xs`,onClick:()=>te(),children:a?`查看原问题`:`View the original question`})]}):null,o.list.isError?(0,K.jsxs)(`p`,{role:`status`,className:`text-xs text-ink-faint`,children:[a?`保存的问答暂时读取失败。`:`Saved questions could not be loaded.`,(0,K.jsx)(B,{className:`ml-2 text-xs`,onClick:()=>void o.list.refetch(),children:a?`重新读取`:`Reload`})]}):null,f&&!t?(0,K.jsxs)(`section`,{className:`border-t border-line/60 pt-3`,children:[f.parentId?(0,K.jsxs)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:[a?`继续引用这份回答:`:`Following up on this answer: `,f.parentTitle||D.find(e=>e.reader_foundation?.id===f.parentId)?.reader_foundation?.question]}):null,(0,K.jsx)(Su,{draft:f,onChange:p,onSubmit:L,disabled:o.creationBlocked})]}):t?null:(0,K.jsx)(B,{className:`text-xs`,disabled:o.creationBlocked,onClick:()=>p({question:``,progressSource:{...x}}),children:a?`问这版说明`:`Ask about this explanation`})]})]}):null})]})}var ad=[`manager`,`planner`,`engineer`,`reviewer`],od=new Set([`planner`,`engineer`,`reviewer`]),sd=new Set([`running`,`in_progress`,`claimed`]),$=(e,t)=>String(e[t]??``).trim(),cd=(e,t)=>{let n=Number(e[t]);return Number.isFinite(n)?n:null};function ld(e){return JSON.parse(JSON.stringify(e))}function ud(){return{schema_version:7,bootstrapped:!1,language:``,mission:{id:``,title:``,objective:``,summary:``,final_output:``,status:`idle`,started_at:null,completed_at:null,elapsed_seconds:0,campaign_started_at:null,campaign_elapsed_seconds:0},stage:{id:``,label:``},routing:{route:``,vertical:``,workflow_mode:``,lifetime:``,continuous:!1,open_ended:!1},round:{current:0,max:0},active_role:``,roles:ad.map(e=>({role:e,status:`waiting`,label:`Waiting`,updated_at:0})),role_work:[],dag:[],timeline:[],artifacts:[],learned_skills:[],learned_wiki_pages:[],storage:{project_skill_dir:``,global_skill_dir:``,project_skill_count:0,global_skill_count:0,skill_history_compressed:0,wiki_retired_compressed:0,skill_history_bytes_saved:0,wiki_retired_bytes_saved:0,wiki_paths:[]},achievement:null,review:{status:``,reason:``,rejected_attempts:0},frontier:{change:``,summary:``,updated_at:0},delivery:null,outcome:{},last_event_ts:0,updated_at:0}}function dd(e,t,n,r){if(n==null||n===``)return;let i=e.findIndex(e=>e[t]===n);i>=0?e[i]={...e[i],...r}:e.push(r)}function fd(e,t,n,r,i){if(!ad.includes(t))return;n===`active`&&od.has(t)&&e.roles.forEach(e=>{od.has(e.role)&&e.role!==t&&e.status===`active`&&Object.assign(e,{status:`done`,label:`Handed off`,updated_at:i})});let a={role:t,status:n,label:r,updated_at:i};dd(e.roles,`role`,t,a),n===`active`?e.active_role=t:e.active_role===t&&(e.active_role=``)}function pd(e,t,n,r,i=``,a=`neutral`){let o=we(t);if(e.timeline.some(e=>e.id===o))return;let s={id:o,ts:Number(t.ts??Date.now()/1e3),type:A(t.type),role:n,title:r.slice(0,180),detail:i.slice(0,500),tone:a};[`item_id`,`branch_id`].forEach(e=>{let n=$(t,e);n&&(s[e]=n)}),e.timeline=[...e.timeline,s].slice(-120)}function md(e,t,n,r,i,a=``,o=``){if(!ad.includes(n))return;let s=$(t,`message_id`),c=s?`${n}:${s}`:we(t),l=e.role_work.find(e=>e.id===c),u=l&&l.detail.length>a.length?l.detail:a,d={id:c,ts:Number(t.ts??Date.now()/1e3),role:n,kind:r,title:i.slice(0,240),detail:u.slice(0,4e3),status:o,item_id:$(t,`item_id`),mission_id:e.mission.id,mission_title:e.mission.title.slice(0,240),round_index:cd(t,`round_index`)},f=e.role_work.findIndex(e=>e.id===c);f>=0?e.role_work[f]=d:e.role_work.push(d);let p=new Set;ad.forEach(t=>{e.role_work.filter(e=>e.role===t).slice(-40).forEach(e=>p.add(e.id))}),e.role_work=e.role_work.filter(e=>p.has(e.id))}function hd(e){return e===`ok`?`success`:e===`err`?`error`:`info`}var gd={agent_message:`Reporting progress`,assistant_message:`Reporting progress`,command_execution:`Running a command`,reasoning:`Reasoning`,tool_use:`Using a tool`,tool_result:`Inspecting tool output`,codex_idle:`Waiting for model output`};function _d(e,t){let n=A(t.type),r=Number(t.ts??Date.now()/1e3);if(e.last_event_ts=Math.max(e.last_event_ts,r),n===L.LIFE_MANAGER_INTENT_STARTED)e.mission.id=$(t,`item_id`)||$(t,`intent_id`),e.mission.title=$(t,`objective`).slice(0,240),e.mission.objective=$(t,`objective`),e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`grounding`,fd(e,`manager`,`active`,`Grounding project`,r),pd(e,t,`manager`,`Project grounding started`,$(t,`objective`)),md(e,t,`manager`,`grounding`,`Grounding project`,$(t,`objective`),`active`);else if(n===L.LIFE_MANAGER_INTENT_COMPLETED){let n=$(t,`execution_task`)||$(t,`objective`);e.mission.id=$(t,`item_id`),e.mission.title=n.slice(0,240),e.mission.objective=n,e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=null,e.mission.completed_at=null,e.mission.status=`framed`,e.routing.route=$(t,`route`)||e.routing.route||`team`,e.routing.vertical=$(t,`vertical`)||e.routing.vertical,e.routing.workflow_mode=$(t,`workflow_mode`)||e.routing.workflow_mode,e.routing.lifetime=$(t,`lifetime`)||e.routing.lifetime,`continuous`in t&&(e.routing.continuous=t.continuous===!0),`open_ended`in t&&(e.routing.open_ended=t.open_ended===!0);let i=$(t,`current_stage`),a=Array.isArray(t.stages)?t.stages:[];if(i)e.stage={id:i,label:i.replaceAll(`_`,` `)};else if(!e.stage.id&&a[0]){let t=String(a[0]);e.stage={id:t,label:t.replaceAll(`_`,` `)}}fd(e,`manager`,`done`,`Goal framed`,r),pd(e,t,`manager`,`Goal framed`,$(t,`reason`),`success`),md(e,t,`manager`,`decision`,`Goal framed`,$(t,`reason`)||$(t,`execution_task`),`done`)}else if(n===L.LIFE_MANAGER_INTENT_FAILED)e.mission.status=`failed`,fd(e,`manager`,`error`,`Manager routing failed`,r),pd(e,t,`manager`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`),md(e,t,`manager`,`grounding`,`Manager routing failed`,$(t,`error`)||$(t,`reason`),`error`);else if(n===L.LIFE_MANAGER_STAGE_DECISION){let n=$(t,`target_stage`)||$(t,`stage`)||$(t,`current_stage`);n&&(e.stage={id:n,label:n.replaceAll(`_`,` `)}),fd(e,`manager`,`done`,n?`Stage · ${n}`:`Stage reviewed`,r),pd(e,t,`manager`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`)),md(e,t,`manager`,`stage_decision`,n?`Stage → ${n}`:`Stage reviewed`,$(t,`reason`),$(t,`action`))}else if(n===L.LIFE_PLANNER_START)fd(e,`planner`,`active`,`Planning next work`,r),md(e,t,`planner`,`planning`,`Planning next work`,$(t,`objective`),`active`);else if(n===L.LIFE_PLANNER_TASK_ADDED){let n=$(t,`item_id`),i={id:n,title:$(t,`title`),objective:$(t,`objective`),status:`pending`,deps:Array.isArray(t.deps)?t.deps.map(String):[],branch_id:$(t,`branch_id`)||n,parent_branch_id:$(t,`parent_branch_id`)||null};dd(e.dag,`id`,n,i);let a=e.routing.vertical===`research`?`Research branch added`:`Task added`;fd(e,`planner`,`done`,a,r),pd(e,t,`planner`,a,i.title,`info`),md(e,t,`planner`,`task`,i.title||`Task added`,i.objective,`pending`)}else if(n===L.LIFE_PLANNER_VERDICT){let n=!!t.project_done,i=n&&t.delivery&&typeof t.delivery==`object`&&!Array.isArray(t.delivery)?JSON.parse(JSON.stringify(t.delivery)):null,a=i?`Task completed`:n?`Project reviewed`:`Planning complete`;i&&(e.delivery=i,e.mission.status=`complete`,e.mission.summary=i.summary||``,e.mission.completed_at=r),fd(e,`planner`,`done`,a,r),pd(e,t,`planner`,a,$(t,`reason`),n?`success`:`neutral`),md(e,t,`planner`,`verdict`,a,$(t,`reason`),n?`done`:`planned`)}else if(n===L.LIFE_PLANNER_WAITING){fd(e,`planner`,`waiting`,`Waiting on external work`,r);let n=$(t,`reason`)||$(t,`waiting_reason`);pd(e,t,`planner`,`Planner waiting`,n),md(e,t,`planner`,`waiting`,`Planner waiting`,n,`waiting`)}else if(n===L.LIFE_MISSION_STARTED)e.review={status:``,reason:``,rejected_attempts:0},e.delivery=null,e.mission.campaign_started_at??=r,e.mission={...e.mission,id:$(t,`item_id`),title:$(t,`title`),objective:$(t,`objective`),summary:``,final_output:``,status:`working`,started_at:r,completed_at:null},fd(e,`reviewer`,`waiting`,`Waiting for the Engineer to finish`,r),fd(e,`engineer`,`active`,`Starting mission`,r),pd(e,t,`engineer`,`Mission started`,$(t,`title`),`info`),md(e,t,`engineer`,`task`,$(t,`title`)||`Mission started`,$(t,`objective`),`active`);else if(n===L.ROUND_START)e.round={current:cd(t,`round_index`)??0,max:cd(t,`round_max`)??e.round.max},fd(e,`engineer`,`active`,`Running round ${e.round.current}`,r),pd(e,t,`engineer`,`Round ${e.round.current} started`);else if(n===L.ENGINEER_PROGRESS){let n=$(t,`agent_layer`)||$(t,`actor`)||`engineer`,i=n===`main`?`engineer`:n,a=$(t,`kind`),o=gd[a]??`Working`;fd(e,i,`active`,o,r),i===`engineer`&&[`assistant_message`,`agent_message`,`message`].includes(a)&&t.final_delivery===!0&&e.mission.started_at!=null&&e.mission.completed_at==null&&r>=e.mission.started_at&&(!t.item_id||$(t,`item_id`)===e.mission.id)&&(e.mission.final_output=Te(t.text));let s=$(t,`action_summary`)||$(t,`text`);s&&!Ee(t)&&!re(t)&&md(e,t,i,a||`progress`,o,s,`active`),[`reasoning`,`assistant_message`,`agent_message`].includes(a)||pd(e,t,i,o,$(t,`action_summary`)||$(t,`text`))}else if(n===L.ROUND_MAIN_COMPLETED)fd(e,`engineer`,`done`,`Work ready for review`,r),md(e,t,`engineer`,`handoff`,`Work ready for review`,$(t,`text`)||$(t,`summary`),`done`);else if(n===L.ROUND_REVIEW_STARTED)e.review={status:``,reason:``,rejected_attempts:e.review.rejected_attempts},fd(e,`reviewer`,`active`,`Reviewing benchmark evidence`,r),md(e,t,`reviewer`,`review`,`Review started`,``,`active`);else if(n===L.ROUND_REVIEW_DEFERRED){let n=$(t,`next_step`);fd(e,`engineer`,`active`,`Continuing before review`,r),fd(e,`reviewer`,`waiting`,`Review deferred for one round`,r),pd(e,t,`engineer`,`Continued before review`,n,`info`)}else if(n===L.ROUND_REVIEW_COMPLETED){let n=t.review_skipped===!0,i=n?`skipped`:$(t,`status`),a=$(t,`reason`);e.review={status:i,reason:a,rejected_attempts:e.review.rejected_attempts+ +!![`continue`,`blocked`].includes(i)};let o=$(t,`frontier_change`);o&&(e.frontier={change:o,summary:$(t,`frontier_summary`),updated_at:r});let s=n?`No review this round`:i===`done`?`Evidence accepted`:`Attempt rejected`;fd(e,`reviewer`,n?`waiting`:i===`done`?`done`:`rejected`,n?s:i===`done`?`Accepted evidence`:`Requested another attempt`,r),pd(e,t,`reviewer`,s,a,n?`info`:i===`done`?`success`:`error`);let c=$(t,`next_action`);md(e,t,`reviewer`,n?`review`:`verdict`,s,c?`${a}\n\nNext action: ${c}`:a,i)}else if([L.SKILL_CREATED,L.SKILL_UPDATED].includes(n)){let i=$(t,`skill_id`)||$(t,`name`);i&&(dd(e.learned_skills,`id`,i,{id:i,name:$(t,`name`),version:cd(t,`version`)??1,scope:$(t,`scope`),path:$(t,`path`),status:`active`,updated_at:r,mission_id:e.mission.id,mission_title:e.mission.title}),pd(e,t,`reviewer`,n===L.SKILL_CREATED?`Capability unlocked`:`Capability upgraded`,$(t,`name`),`skill`))}else if(n===L.SKILL_EVOLUTION_COMPLETED)e.storage.project_skill_dir=$(t,`project_skill_dir`)||e.storage.project_skill_dir,e.storage.global_skill_dir=$(t,`global_skill_dir`)||e.storage.global_skill_dir,e.storage.project_skill_count=cd(t,`project_skill_count`)??e.storage.project_skill_count,e.storage.global_skill_count=cd(t,`global_skill_count`)??e.storage.global_skill_count;else if(n===L.SKILL_HISTORY_COMPRESSED)e.storage.skill_history_compressed+=cd(t,`count`)??0,e.storage.skill_history_bytes_saved+=cd(t,`bytes_saved`)??0;else if(n===L.SKILL_TIDIED){let n=$(t,`name`);if(n){let i=e.learned_skills.find(e=>e.name===n),a={source_path:$(t,`path`),source_placement:$(t,`placement`),source_vertical:$(t,`vertical`),updated_at:r};i?Object.assign(i,a):dd(e.learned_skills,`id`,n,{id:n,name:n,version:1,scope:``,path:``,status:`active`,...a}),pd(e,t,`manager`,`Capability promoted to source`,n,`skill`)}}else if([L.WIKI_INITIALIZED,L.WIKI_EVOLUTION_COMPLETED].includes(n)){let n=[...(Array.isArray(t.paths)?t.paths:[]).map(e=>String(e)),$(t,`path`)].filter(Boolean);e.storage.wiki_paths=[...new Set([...e.storage.wiki_paths,...n])]}else if(n===L.WIKI_RETIRED_COMPRESSED)e.storage.wiki_retired_compressed+=cd(t,`count`)??0,e.storage.wiki_retired_bytes_saved+=cd(t,`bytes_saved`)??0;else if([L.WIKI_CREATED,L.WIKI_UPDATED].includes(n)){let i=$(t,`page_id`);i&&(dd(e.learned_wiki_pages,`id`,i,{id:i,title:$(t,`title`)||i,card_type:$(t,`card_type`),status:$(t,`status`)||`scratch`,path:$(t,`path`),updated_at:r}),pd(e,t,`reviewer`,n===L.WIKI_CREATED?`Knowledge captured`:`Knowledge refined`,$(t,`title`)||i,`skill`))}else if(n===L.WIKI_RETIRED){let n=$(t,`page_id`);if(n){let i=e.learned_wiki_pages.find(e=>e.id===n);i?Object.assign(i,{status:`retired`,updated_at:r}):dd(e.learned_wiki_pages,`id`,n,{id:n,title:n,card_type:$(t,`card_type`),status:`retired`,path:``,updated_at:r}),pd(e,t,`reviewer`,`Knowledge retired`,n,`error`)}}else if([L.WIKI_PROMOTION_PROMOTED,L.WIKI_PROMOTION_DEMOTED].includes(n)){let i=$(t,`page_id`);if(i){let a=e.learned_wiki_pages.find(e=>e.id===i);a?Object.assign(a,{status:$(t,`to_status`),updated_at:r}):dd(e.learned_wiki_pages,`id`,i,{id:i,title:i,card_type:$(t,`card_type`),status:$(t,`to_status`),path:``,updated_at:r});let o=n===L.WIKI_PROMOTION_PROMOTED;pd(e,t,`reviewer`,o?`Knowledge promoted`:`Knowledge demoted`,`${i} → ${$(t,`to_status`)}`,o?`success`:`neutral`)}}else if(n===L.RESEARCH_ACHIEVEMENT_CERTIFIED)e.achievement={id:$(t,`achievement_id`),title:$(t,`title`),goal:$(t,`goal`),summary:$(t,`summary`),rejected_attempts:e.review.rejected_attempts,skills_learned:e.learned_skills.filter(e=>e.status===`active`).length,artifacts:e.artifacts.length,elapsed_seconds:e.mission.elapsed_seconds,evidence:Array.isArray(t.evidence)?t.evidence.map(String):[],reviewer_certified:!0,certified_at:r};else if([L.LIFE_MISSION_COMPLETED,L.LIFE_MISSION_FAILED].includes(n)){let i=n===L.LIFE_MISSION_FAILED?yi({...t,outcome_class:`failed`,status:$(t,`status`)||`failed`,success:!1}):yi(t),a=`final_output`in t?$(t,`final_output`):$(t,`item_id`)===e.mission.id&&e.mission.started_at!=null&&(e.mission.completed_at==null||e.mission.completed_at===r)&&e.mission.final_output||``;e.mission.id=$(t,`item_id`)||e.mission.id,e.mission.title=$(t,`title`)||e.mission.title,e.mission.objective=$(t,`objective`)||e.mission.objective,e.mission.summary=$(t,`summary`),e.mission.final_output=a,e.mission.status=i.missionStatus,e.mission.completed_at=r;let o=t.delivery;t.success===!0&&o&&typeof o==`object`&&!Array.isArray(o)?e.delivery=JSON.parse(JSON.stringify(o)):t.success!==!0&&(e.delivery=null),e.outcome=vi(t),fd(e,`engineer`,i.missionStatus===`complete`?`done`:i.missionStatus,i.label,r),pd(e,t,`engineer`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),hd(i.tone)),md(e,t,`engineer`,`completion`,i.label,$(t,`summary`)||$(t,`title`)||$(t,`status`),i.missionStatus)}return e.updated_at=Date.now()/1e3,e}function vd(e,t,n){let r=t.backlog.find(e=>sd.has(e.status)),i=t.backlog.find(e=>e.status===`pending`),a=t.backlog.find(t=>t.id===e.mission.id),o=r??a,s=!!(r||i||t.continuous?.enabled||t.continuous?.done_reason||t.continuous?.done_at||e.mission.id||![``,`idle`].includes(e.mission.status));t.continuous?.enabled&&(e.routing.route=e.routing.route||`team`,e.routing.continuous=!0,e.routing.open_ended=t.continuous.open_ended===!0,e.routing.lifetime=e.routing.open_ended?`standing`:e.routing.lifetime||`bounded`);let c=o?.objective||o?.title||(t.continuous?.enabled?t.continuous.objective:``)||t.session.objective||(e.mission.id?``:i?.objective)||(e.mission.id?``:i?.title)||e.mission.objective;c&&(e.mission.objective=c,o?e.mission.title=(o.title||c.split(` +`)[0]).slice(0,240):e.mission.title||(e.mission.title=c.split(` +`)[0].slice(0,240))),r?((r.id!==e.mission.id||r.started_ts!=null&&r.started_ts!==e.mission.started_at||e.mission.completed_at!=null)&&(e.mission.summary=``,e.mission.final_output=``,e.mission.started_at=r.started_ts??null,e.mission.completed_at=null),e.mission.id=r.id,e.mission.status=`working`,e.mission.started_at=e.mission.started_at??r.started_ts??null):a?a.status===`pending`&&(e.mission.status=`queued`):t.continuous?.done_reason||t.continuous?.done_at?e.mission.status=`complete`:i||t.continuous?.enabled?e.mission.status=`queued`:t.daemon.alive&&(e.mission.status=`idle`),t.roles.forEach(t=>{t.active?fd(e,t.role,`active`,t.label||t.status||`Working`,Date.now()/1e3-(t.age_s??0)):s||fd(e,t.role,`waiting`,`Waiting`,Date.now()/1e3);let n=e.roles.find(e=>e.role===t.role);n&&Object.assign(n,{backend:t.backend,model:t.model,effort:t.effort})});let l=t.roles.filter(e=>e.active);l.length?e.active_role=l[l.length-1].role:s||(e.active_role=``),t.backlog.forEach(t=>{let n={id:t.id,title:t.title,objective:t.objective,status:t.status,deps:t.deps??[],branch_id:t.id,parent_branch_id:t.deps?.[0]??null,acceptance_check:t.acceptance_check??``,plan_hypothesis:t.plan_hypothesis??``,goal_contribution:t.goal_contribution??``,expected_regressions:t.expected_regressions??``,decision_rule:t.decision_rule??``,non_goals:t.non_goals??[]};dd(e.dag,`id`,n.id,n)});let u=o?.outcome?.execution_status?o.outcome:e.mission.id?void 0:[...t.backlog].filter(e=>e.outcome?.execution_status).sort((e,t)=>Number(e.finished_ts??0)-Number(t.finished_ts??0)).at(-1)?.outcome;return!r&&u&&(e.outcome=vi({outcome:u,status:`done`,success:!0})),n.forEach(t=>{dd(e.artifacts,`path`,t.path,{id:t.path,path:t.path,title:t.name,kind:t.kind,why:t.why,exists:t.exists,storage_path:t.storage_path,source:t.source})}),s}function yd(e,t,n,r){r||(t.roles.forEach(t=>{t.active||fd(e,t.role,`waiting`,`Waiting`,Date.now()/1e3)}),e.active_role=``);let i=Date.now()/1e3,a=e.mission.campaign_started_at??t.session.created??e.mission.started_at;a&&(e.mission.campaign_started_at=a,e.mission.campaign_elapsed_seconds=Math.max(0,i-a)),e.mission.started_at&&e.mission.status===`working`?e.mission.elapsed_seconds=Math.max(0,i-e.mission.started_at):e.mission.started_at&&e.mission.completed_at&&(e.mission.elapsed_seconds=Math.max(0,e.mission.completed_at-e.mission.started_at)),e.achievement?.reviewer_certified&&(e.achievement.elapsed_seconds=e.mission.elapsed_seconds,e.achievement.rejected_attempts=e.review.rejected_attempts,e.achievement.skills_learned=e.learned_skills.filter(e=>e.status===`active`).length,e.achievement.artifacts=n.filter(e=>e.exists).length)}function bd(e,t=[],n=[]){let r=e.mission_view?ld(e.mission_view):ud();r.storage??=ud().storage,r.storage.skill_history_compressed??=0,r.storage.wiki_retired_compressed??=0,r.storage.skill_history_bytes_saved??=0,r.storage.wiki_retired_bytes_saved??=0,r.learned_wiki_pages??=[],r.role_work??=[],r.delivery??=null,r.outcome??={};let i=r.last_event_ts,a=vd(r,e,n),o=[...t].sort((e,t)=>Number(e.ts??0)-Number(t.ts??0));return o.filter(e=>e.ts==null||Number(e.ts)>i).forEach(e=>_d(r,e)),r.mission.final_output||(r.mission.final_output=xd(o,r.mission)),yd(r,e,n,a),r}function xd(e,t){if(!t.id||[`working`,`queued`,`grounding`,`framed`].includes(t.status))return``;let n=e.reduce(_d,ud()).mission;return n.id!==t.id||n.started_at==null||n.completed_at==null||t.started_at!=null&&n.started_at!==t.started_at||t.completed_at!=null&&n.completed_at!==t.completed_at?``:n.final_output||``}function Sd(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60);return n?`${n}h ${r}m`:r?`${r}m`:`${t}s`}var Cd=`__argus_live_progress__`,wd=new Set([`framed`,`grounding`,`queued`,`running`,`in_progress`,`working`]),Td=new Set([`complete`,`completed`,`done`,`success`]);function Ed(e){return Td.has(String(e?.mission.status||``).toLowerCase())}function Dd(e){return(e??[]).filter(e=>e.source===`manager_live`)}function Od(e){return Dd(e).filter(e=>e.exists)[0]??null}function kd(e){let t=e??[],n={markdown:0,pdf:1,html:2,text:3,table:4,json:5,image:6,video:7,audio:8,binary:9},r=t.filter(e=>e.exists&&e.source===`delivery`),i=t.filter(e=>e.exists&&e.source===`manager_live`),a=t.filter(e=>e.exists&&e.source!==`manager_live`&&e.source!==`delivery`);return a.length||r.length?[...r,...[...a].sort((e,t)=>(n[e.kind]??99)-(n[t.kind]??99)),...i]:i}function Ad(e){return kd(e).find(e=>e.exists)??null}function jd(e){let t=kd(e);return t.find(e=>e.source===`delivery`)??t.find(e=>e.source!==`manager_live`)??t[0]??null}function Md(e){let t=e.path.split(`/`);return t[t.length-1]||e.path}function Nd(e,t){if(e){let n=String(e.mission.status||``).toLowerCase();if(wd.has(n))return Cd;let r=e.delivery?.primary_target?.path;if(r)return r;if(Ed(e))return jd(t)?.path??`__argus_live_progress__`;let i=Od(t);return i?i.path:Cd}return Ad(t)?.path??``}function Pd(e){let t=String(e.agent_layer??e.actor??``);if(t===`main`)return`engineer`;if(t)return t;let n=String(e.type??``);return n.startsWith(`round.review`)||n.startsWith(`reviewer`)?`reviewer`:n.startsWith(`life.planner`)?`planner`:n.startsWith(`life.manager`)||n.startsWith(`manager`)?`manager`:n.startsWith(`engineer`)||n.startsWith(`round.`)?`engineer`:``}function Fd(e,t=[],n,r=`en`){if(n&&Vr(n,e,t).state!==`running`||Ed(e))return null;let i=String(e?.active_role??``);if(!i)return null;let a=e?.roles.find(e=>e.role===i),o=``;for(let n=t.length-1;n>=0;--n){let r=t[n];if(e?.mission.id&&Ir(r)!==e.mission.id||e?.mission.started_at&&Number(r.ts||0)k(e,{},r)):i,label:a?.label||`Working`,detail:o}}function Id({view:e,artifacts:t=[],onOpenArtifact:n,routeVisible:r,snapshot:i,connected:a}){let{locale:o,t:s}=I(),c=e.dag.filter(e=>[`done`,`completed`].includes(e.status)).length,l=[...t].filter(e=>e.exists&&e.source!==`manager_live`).sort((e,t)=>Number(t.mtime??0)-Number(e.mtime??0)).slice(0,4),u=e=>[`running`,`in_progress`,`claimed`].includes(e),d=a&&i?.daemon.alive!==!1,f=e=>e===`done`?`text-ok`:u(e)?`text-blue-sky`:[`failed`,`blocked`,`rejected`].includes(e)?`text-err`:`text-ink-faint`;return(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 text-sm text-ink-dim scroll-thin`,children:[(0,K.jsx)(`section`,{className:`rounded-lg border border-blue-deep/30 bg-blue-deep/10 p-4`,children:(0,K.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.stage`)}),(0,K.jsx)(`dd`,{className:`mt-1 text-sm font-medium text-blue-sky`,children:Zi(e.stage.id,o)===e.stage.id?e.stage.label||e.stage.id||`—`:Zi(e.stage.id,o)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.totalTime`)}),(0,K.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:Sd(e.mission.campaign_elapsed_seconds)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`mission.round`)}),(0,K.jsxs)(`dd`,{className:`mt-1 text-sm text-ink`,children:[e.round.current||`—`,e.round.max?` / ${e.round.max}`:``]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-ink-faint`,children:s(`research.dagProgress`)}),(0,K.jsx)(`dd`,{className:`mt-1 text-sm text-ink`,children:ea(c,e.dag.length,o)})]})]})}),r&&e.dag.length?(0,K.jsxs)(`section`,{className:`mt-5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:s(`mission.researchDag`)}),(0,K.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.dag.map(e=>(0,K.jsx)(`li`,{className:`rounded-md border border-line/60 bg-panel px-3 py-2.5`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,"aria-hidden":`true`,children:e.status===`done`?`✓`:d&&u(e.status)?`●`:`○`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium leading-5 text-ink`,children:(0,K.jsx)(Ke,{children:e.title})}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs ${f(!d&&u(e.status)?`waiting`:e.status)}`,children:!d&&u(e.status)?a?o===`zh-CN`?`当前未在运行`:`Not currently running`:o===`zh-CN`?`断连前记录:进行中`:`Last received state: in progress`:oa(e.status,o)})]})]})},e.id))})]}):null,l.length?(0,K.jsxs)(`section`,{className:`mt-5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold text-ink-faint`,children:o===`zh-CN`?`已生成的文件`:`Files produced so far`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:o===`zh-CN`?`文件已生成,结论是否成立仍以核验记录为准。`:`A saved file is not a verification of its conclusions.`}),(0,K.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:l.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),title:e.storage_path||e.path,className:`rounded border border-line/70 bg-panel px-2.5 py-1.5 font-mono text-xs text-blue-sky hover:border-blue/60`,children:[Md(e),` ↗`]},e.path))})]}):null]})}function Ld({sid:e,artifacts:t,error:n=!1,onExpand:r,onOpenFile:i,className:a=``,embedded:o=!1,onCollapse:c,missionView:l,activityEvents:u=[],requestedPath:d,requestedPathToken:p,routeVisible:m=!0,snapshot:h,connected:g=!0}){let{t:_,locale:v}=I(),y=(0,U.useMemo)(()=>kd(t),[t]),b=(0,U.useMemo)(()=>Ad(t),[t]),x=Ed(l),S=(0,U.useMemo)(()=>{if(!x)return null;let e=l?.delivery?.primary_target?.path;return y.find(t=>t.path===e&&t.exists)??jd(t)},[t,x,l?.delivery?.primary_target?.path,y]),[C,w]=(0,U.useState)(null);(0,U.useEffect)(()=>{w(x&&S?S.path:null)},[x,S?.path,l?.mission.id,e]),(0,U.useEffect)(()=>{if(!d)return;let e=y.find(e=>e.path===d&&e.exists);e&&w(e.path)},[y,d,p]);let T=e=>{w(e),e!==`__argus_live_progress__`&&i?.()},E=C??Nd(l,t),D=E===Cd,O=D?null:y.find(e=>e.path===E)??(x?S:b),k=fe(e,O?.exists?O.path:null,O?.mtime??null),A=k.data,j=A?vu(A):!1,[M,N]=(0,U.useState)(null),[ee,P]=(0,U.useState)(``),[te,ne]=(0,U.useState)(!1),[re,L]=(0,U.useState)(``),ie=(0,U.useMemo)(()=>g?Fd(l,u,h,v):null,[u,l,h,g,v]);(0,U.useEffect)(()=>{if(N(null),P(``),!e||!O||!A||![`image`,`pdf`,`audio`,`video`].includes(A.kind))return;let t=!0,n=``,r=new AbortController;return F.artifactBlob(e,O.path,!1,r.signal).then(e=>{t&&(n=URL.createObjectURL(e),N(n))},e=>t&&P(e.message)),()=>{t=!1,r.abort(),n&&URL.revokeObjectURL(n)}},[e,O?.path,A?.kind,A?.mtime]);let ae=l?.delivery??null,oe=ae?.primary_target?.path??``,se=!!(x&&!D&&O&&(O.source===`delivery`||O.path===oe)),ce=v===`zh-CN`?ae?.kind===`submission_certified`?`交付已认证`:`已完成`:ae?.kind===`submission_certified`?`Certified delivery`:`Delivered result`,le=se?ce:D?_(`research.liveProgress`):y[0]?.group_title||_(`research.artifact`),ue=async()=>{if(!(!e||!O)){ne(!0),L(``);try{let t=await F.artifactBlob(e,O.path,!0);$e(t,O.name)}catch(e){L(e.message)}finally{ne(!1)}}};return(0,K.jsxs)(`section`,{className:`glass-panel glass-panel--side flex min-h-0 flex-col overflow-hidden ${o?``:`rounded-lg border`} ${a}`,"aria-label":_(`research.canvas`),children:[(0,K.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-line/50 bg-panel px-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full ${se?`bg-ok`:ie?`animate-pulse bg-blue`:`bg-ink-faint/60`}`}),(0,K.jsx)(`h2`,{className:`max-w-24 truncate text-sm font-semibold text-ink sm:max-w-48`,children:le})]}),l||y.length>0?(0,K.jsxs)(`label`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:_(`research.previewArtifact`)}),(0,K.jsxs)(`select`,{value:D?Cd:O?.path??``,onChange:e=>T(e.target.value),title:D?_(`research.liveProgress`):O?.storage_path||O?.path,className:`h-8 w-full min-w-0 max-w-64 truncate rounded-md border border-line/50 bg-bg px-2 font-mono text-xs text-ink-dim outline-none focus:border-blue/60`,children:[l?(0,K.jsx)(`option`,{value:Cd,children:_(`research.liveProgress`)}):null,y.map(e=>(0,K.jsxs)(`option`,{value:e.path,disabled:!e.exists,title:e.storage_path||e.path,children:[e.source===`delivery`?`${_(`research.optionDelivery`)} · `:``,Md(e),e.exists?``:` · ${_(`research.optionPending`)}`]},e.path))]})]}):(0,K.jsx)(`div`,{className:`flex-1`}),(0,K.jsx)(`div`,{className:`shrink-0`,children:O?(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>void ue(),disabled:te||!O.exists,title:_(`artifact.download`),"aria-label":_(`artifact.download`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink disabled:opacity-40`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,K.jsx)(`path`,{d:`M8 2.25v7.5M5.25 7.5 8 10.25 10.75 7.5M3 13.25h10`})})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(O.path),title:_(`research.openLarge`),"aria-label":_(`research.openLarge`),className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-faint hover:bg-surface hover:text-ink`,children:(0,K.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,children:(0,K.jsx)(`path`,{d:`M6 3H3v3M10 3h3v3M6 13H3v-3M10 13h3v-3`})})})]}):null}),c?(0,K.jsx)(`button`,{type:`button`,onClick:c,"aria-label":_(`research.collapse`),title:_(`research.collapse`),className:`hidden h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink lg:flex`,children:(0,K.jsx)(s,{icon:f,className:`h-3.5 w-3.5`})}):null]}),h?(0,K.jsx)(zs,{snapshot:h,view:l,events:u,connected:g,compact:!0}):ie?(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-line/50 bg-blue-deep/10 px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(`span`,{"data-role-dot":ie.role,className:`h-2 w-2 shrink-0 animate-pulse rounded-full motion-reduce:animate-none`,style:{background:R.role[ie.role]??R.inkFaint},"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`font-semibold text-ink`,children:ie.roleLabel}),(0,K.jsx)(`span`,{className:`text-blue-sky`,children:_(`mission.active`)}),(0,K.jsxs)(`span`,{className:`truncate text-ink-faint`,children:[`· `,ia(ie.label,v,{kind:l?.roles.find(e=>e.role===ie.role)?.kind,language:l?.language})]})]}),ie.detail?(0,K.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-ink-dim`,children:ie.detail}):null]}):null,(0,K.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col bg-bg`,children:[D&&l?(0,K.jsx)(Id,{view:l,artifacts:t,onOpenArtifact:T,routeVisible:m,snapshot:h,connected:g}):null,!D&&n?(0,K.jsx)(`div`,{className:`m-auto max-w-sm px-6 text-center text-sm text-warn`,children:_(`research.unavailable`)}):null,!D&&!n&&y.length===0?(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,K.jsx)(`div`,{className:`text-3xl text-ink-faint`,children:`◇`}),(0,K.jsx)(`h3`,{className:`mt-3 text-xs text-ink-faint`,children:_(`research.noPreview`)})]}):null,!D&&!n&&y.length>0&&!O?(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,K.jsx)(Ue,{}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:_(`research.waiting`)})]}):null,O&&!O.exists?(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-8 text-center`,children:[(0,K.jsx)(Ue,{}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:_(`research.updating`)})]}):null,O?.exists&&k.isLoading?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,O?.exists&&k.isError?(0,K.jsxs)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:[_(`artifact.unavailable`),` · `,k.error.message]}):null,A?.kind===`text`&&!j?(0,K.jsxs)(`pre`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words p-5 font-mono text-xs leading-6 text-ink-dim scroll-thin`,children:[A.preview||`(empty file)`,A.truncated?` + +… live preview truncated · expand to inspect the complete file`:``]}):null,A&&j?(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-5 text-sm text-ink-dim scroll-thin`,children:(0,K.jsx)(Ke,{sid:e,basePath:A.path,artifacts:t,onOpenArtifact:T,children:A.preview||`(empty file)`})}):null,A?.kind===`json`?(0,K.jsx)(cu,{value:A.preview||``}):null,A?.kind===`table`?(0,K.jsx)(lu,{value:A.preview||``,delimiter:A.name.endsWith(`.tsv`)?` `:`,`}):null,A?.kind===`html`&&!A.truncated?(0,K.jsx)(iu,{sid:e,path:A.path,html:A.preview||``,title:`Live HTML preview: ${A.name}`}):null,A?.kind===`html`&&A.truncated?(0,K.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-warn`,children:_(`artifact.htmlTooLarge`)}):null,A?.kind===`image`&&M?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden p-4`,children:(0,K.jsx)(`img`,{src:M,alt:A.why||A.name,className:`max-h-full max-w-full object-contain`})}):null,A?.kind===`pdf`&&M?(0,K.jsx)(_u,{src:M,name:A.name}):null,A?.kind===`audio`&&M?(0,K.jsx)(`div`,{className:`m-auto w-full max-w-xl px-6`,children:(0,K.jsx)(`audio`,{controls:!0,preload:`metadata`,src:M,className:`w-full`})}):null,A?.kind===`video`&&M?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-black p-2`,children:(0,K.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:M,className:`max-h-full max-w-full`})}):null,A?.kind===`binary`?(0,K.jsx)(`div`,{className:`m-auto max-w-sm px-8 text-center text-sm text-ink-dim`,children:_(`research.fileUnavailable`)}):null,A&&[`image`,`pdf`,`audio`,`video`].includes(A.kind)&&!M&&!ee?(0,K.jsx)(`div`,{className:`m-auto`,children:(0,K.jsx)(Ue,{})}):null,ee?(0,K.jsx)(`div`,{className:`m-auto px-6 text-center text-sm text-err`,children:ee}):null]}),!D&&A?(0,K.jsxs)(`footer`,{className:`flex h-9 items-center gap-2 border-t border-line px-4 font-mono text-xs text-ink-faint`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:A.storage_path||A.path,children:A.path}),re?(0,K.jsx)(`span`,{className:`ml-auto truncate text-err`,title:re,children:_(`research.downloadFailed`)}):null,(0,K.jsx)(`span`,{className:`shrink-0`,children:ct(A.size)})]}):null]})}function Rd({notice:e,onClose:t}){if((0,U.useEffect)(()=>{if(!e)return;let n=window.setTimeout(t,e.tone===`error`?8e3:4e3);return()=>window.clearTimeout(n)},[e,t]),!e)return null;let n=e.tone===`error`?`border-err/60 bg-err/10 text-err`:e.tone===`success`?`border-ok/60 bg-ok/10 text-ok`:`border-blue-deep/60 bg-panel text-blue-sky`;return(0,K.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,"aria-live":e.tone===`error`?`assertive`:`polite`,className:`fixed bottom-4 left-4 right-4 z-[70] flex items-start gap-2 rounded-md border px-3 py-2.5 shadow-glow sm:left-auto sm:max-w-md ${n}`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px shrink-0`,children:e.tone===`error`?`!`:e.tone===`success`?`✓`:`i`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-xs leading-relaxed text-ink-dim`,children:e.message}),(0,K.jsx)(`button`,{type:`button`,"aria-label":`dismiss notification`,onClick:t,className:`shrink-0 rounded px-1 text-base leading-none opacity-70 hover:bg-white/5 hover:opacity-100`,children:`×`})]})}function zd({open:e,sid:t,name:n,alive:r,controlAvailable:i=!0,busy:a,onClose:o,onRename:s,onStart:c,onStop:l,onDelete:u}){let{t:d}=I(),[f,p]=(0,U.useState)(n),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1);(0,U.useEffect)(()=>{e&&(p(n),h(!1),_(!1))},[e,n,t]);let v=async e=>{e.preventDefault(),await s(f.trim())},y=r&&!g,b=async()=>{if(y){await l()&&_(!0);return}await c()&&_(!1)};return(0,K.jsxs)(tt,{open:e,onClose:()=>!a&&o(),label:d(`manage.daemon`),width:`max-w-lg`,children:[(0,K.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-ink`,children:d(`topbar.manageSession`)}),(0,K.jsx)(`p`,{className:`mt-0.5 font-mono text-[10px] text-ink-faint`,children:t})]}),(0,K.jsx)(`form`,{onSubmit:e=>void v(e),className:`border-b border-line p-5`,children:(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.displayName`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),maxLength:80,disabled:a,className:`h-9 min-w-0 flex-1 rounded border border-line bg-bg/50 px-3 text-sm text-ink outline-none focus:border-blue-deep disabled:opacity-50`}),(0,K.jsx)(`button`,{type:`submit`,disabled:a||f.trim()===n,className:`rounded border border-line px-3 text-xs text-ink-dim hover:bg-surface disabled:opacity-40`,children:d(`common.save`)})]})]})}),(0,K.jsxs)(`div`,{className:`border-b border-line p-5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:d(`manage.executor`)}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center justify-between rounded border border-line bg-bg/30 p-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm text-ink`,children:d(y?i?`manage.running`:`manage.runningExternally`:`manage.paused`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-[11px] text-ink-faint`,children:d(y?i?`manage.stopNowHint`:`manage.externalHint`:`manage.resumeHint`)})]}),(0,K.jsx)(`button`,{type:`button`,disabled:a||!i,onClick:()=>void b(),className:`rounded border px-3 py-1.5 text-xs disabled:cursor-wait disabled:opacity-50 ${y?`border-warn/50 text-warn hover:bg-warn/10`:`border-blue-deep bg-blue-deep text-white hover:bg-blue-deep/80`}`,children:d(a?`manage.working`:i?y?`manage.stopNow`:`manage.resume`:`common.external`)})]})]}),(0,K.jsxs)(`div`,{className:`p-5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:d(`manage.deleteSession`)}),(0,K.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-ink-faint`,children:d(`manage.deleteHint`)}),m?(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded border border-err/40 bg-err/5 p-3`,children:[(0,K.jsx)(`span`,{className:`text-xs text-ink-dim`,children:d(`manage.confirmQuestion`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`rounded px-2 py-1 text-xs text-ink-faint hover:bg-surface`,children:d(`common.cancel`)}),(0,K.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>void u(),className:`rounded bg-err px-3 py-1 text-xs font-medium text-bg disabled:opacity-50`,children:d(`manage.confirmDelete`)})]})]}):(0,K.jsx)(`button`,{type:`button`,disabled:a||y,onClick:()=>h(!0),className:`mt-3 rounded border border-err/40 px-3 py-1.5 text-xs text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-40`,children:d(`manage.delete`)})]})]})}var Bd={科学环境已就绪:`Scientific environment ready`,更新科学环境校验:`Update scientific environment checks`,验证科学环境依赖和关键模块:`Validating scientific dependencies and required modules`,"科学环境 · 上次检查结果":`Scientific environment · previous check`,"下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。":`The results below predate this operation. Refer to the latest error above or check the environment again.`,"科学环境 · ⟦0⟧ 项待配置":`Scientific environment · ⟦0⟧ item(s) to configure`,科学环境:`Scientific environment`,检查环境:`Check environment`,"免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。":`Free scientific components are configured automatically; SHELX requires academic authorization from the official website before entering download credentials.`,修复依赖:`Repair dependencies`,"继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。":`Confirm the official PLATON license before continuing. The same installation or repair action will prepare the complete runtime; no separate repair button is required.`,同意并继续:`Agree and continue`,"请先确认 PLATON 使用许可,再继续安装或修复依赖。":`Confirm the PLATON license before installing or repairing dependencies.`,依赖修复完成:`Dependency repair complete`,依赖修复未完成:`Dependency repair incomplete`,环境操作未完成:`Environment operation incomplete`,"依赖修复未完成:⟦0⟧。请查看组件检查结果;不会报告修复成功。":`Dependency repair is incomplete: ⟦0⟧. Check the component results; this is not reported as a successful repair.`,"PLATON 已可用,保留当前安装。":`PLATON is already available; keeping the existing installation.`,"准备 PLATON 官方环境":`Prepare official PLATON runtime`,"下载、验证并配置":`Download, verify and configure`,"我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。":`I confirm that my use complies with the official PLATON license; for commercial use, I have obtained separate authorization.`,"PLATON 官方允许注明来源的学术、科学及非商业用途;商业用途需自行取得许可。本操作只从官方网站下载到插件私有目录,不安装系统运行库、不修改系统 PATH。":`The publisher permits acknowledged academic, scientific and non-commercial use of PLATON; commercial use requires a separate license. This downloads from official sites into the plugin's private directory, without installing system runtimes or changing the system PATH.`,"PLATON 缺少 Windows Salford 运行库(0xC0000135)。请点击“修复依赖”,确认许可后会在同一流程准备完整运行环境。":`PLATON is missing the Windows Salford runtime (0xC0000135). Click Repair dependencies and confirm the license to prepare the complete runtime in the same action.`,"正在校验 PLATON 官方程序与 Windows 配套运行环境…":`Verifying the official PLATON program and Windows runtime…`,"正在提取官方 Salford 运行库(不执行系统安装程序)…":`Extracting the official Salford runtime without executing the system installer…`,"正在实际运行 PLATON,验证 Windows 运行库和校验规则…":`Running PLATON to verify the Windows runtime and validation rules…`,"PLATON 官方 Windows 运行环境验证通过。":`The official PLATON Windows runtime passed verification.`,"PLATON 官方运行环境已可用,保留当前安装。":`The official PLATON runtime is already available; keeping the existing installation.`,"配置 SHELX":`Configure SHELX`,"SHELX 授权安装":`SHELX authorized installation`,学术授权:`Academic authorization`,前往官网申请:`Apply on official website`,"填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。":`Enter the username and password from the authorization email to download and install automatically. Credentials are used only for this official download, are not saved, and are not sent to the model.`,用户名:`Username`,"SHELX 用户名":`SHELX username`,密码:`Password`,"SHELX 密码":`SHELX password`,"查看许可 ↗":`View license ↗`,"下载并安装 SHELX":`Download and install SHELX`,取消:`Cancel`,科学软件健康检查:`Scientific software health check`,"点击“检查环境”可验证科学内核与外部程序。":`Click “Check environment” to verify the scientific kernel and external programs.`,可用:`Available`,待授权安装:`Authorization required`,待修复:`Needs repair`,查看检查详情:`View check details`,查看原因与安装方式:`View cause and installation method`,"官方安装说明 ↗":`Official installation instructions ↗`,使用已有安装:`Use existing installation`,"DIALS 环境目录":`DIALS environment directory`,"Systre JAR 路径(需要已有 Java)":`Systre JAR path (existing Java required)`,"⟦0⟧ 可执行文件路径":`⟦0⟧ executable path`,"填写运行 Argus 的电脑上的路径,验证成功后生效。":`Enter the path on the computer running Argus. It takes effect after successful verification.`,验证并使用:`Verify and use`,最近检查:`Last checked`,"· 检查不调用模型":`· Check does not call the model`,无法读取插件列表:`Unable to read plugin list`,插件操作未完成:`Plugin operation incomplete`,插件:`Plugins`,关闭插件列表:`Close plugin list`,"按需安装研究工具,沿用 Argus 的模型与执行后端。":`Install research tools as needed, using Argus's model and execution backend.`,"正在读取插件…":`Reading plugins…`,暂无可用插件:`No plugins available`,已启用:`Enabled`,已停用:`Disabled`,未安装:`Not installed`,"· 当前后端":`· Current backend`,安装:`Install`,打开工作台:`Open workbench`,启用:`Enable`,更新至:`Update to`,停用:`Disable`,卸载:`Uninstall`,"原生会话输入 ⟦0⟧ 可启用后台工具。卸载保留会话、研究数据和科学软件。":`Native session input ⟦0⟧ can enable background tools. Uninstalling preserves sessions, research data, and scientific software.`,"首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。":`First installation automatically configures standalone Python, DIALS, Systre / Java, and free academic PLATON components. SHELX can be installed later by entering authorization details.`,"暂不支持,敬请期待。当前插件支持 Codex、Copilot 和 Pi。":`Not supported yet. Stay tuned. Current plugins support Codex, Copilot, and Pi.`,"安装科学环境需要 Python 3.11–3.13。请安装 Python 后重试,或设置 ARGUS_PLUGIN_PYTHON。":`Installing the scientific environment requires Python 3.11–3.13. Install Python and try again, or set ARGUS_PLUGIN_PYTHON.`,准备安装:`Prepare installation`,获取并校验插件包:`Download and verify plugin package`,"安装独立运行环境(首次可能需要几分钟)":`Install standalone environment (may take several minutes the first time)`,"插件仍有任务运行,请等任务结束或先暂停,再进行此操作。":`This plugin still has running tasks. Wait for them to finish or pause them before continuing.`,"此插件版本尚未提供可校验的发行包。":`No verifiable release package is available for this plugin version.`,"插件包校验失败,未安装。":`Plugin package verification failed. Not installed.`,正在准备:`Preparing`,"当前系统或 Argus 插件接口版本暂不支持此插件。":`This plugin is not currently supported by the system or Argus plugin API version.`,"插件发行包尚未发布。":`The plugin release package has not been published.`,安装完成:`Installation complete`,环境检查完成:`Environment check complete`,"此插件已有安装或更新操作正在进行。":`An installation or update operation for this plugin is already in progress.`,插件尚未安装:`Plugin not installed`,"安装进程已中断;已有可用版本保持不变,可重试。":`Installation was interrupted. The existing available version is unchanged; you can retry.`,"安装未完成,已有版本保持不变":`Installation incomplete; existing version unchanged`,"此版本已安装,可启用插件。":`This version is installed. You can enable the plugin.`,请先安装插件:`Install the plugin first`,请先更新插件以使用环境管理功能:`Update the plugin first to use environment management`,"插件包超过允许大小。":`The plugin package exceeds the allowed size.`,科学计算内核:`Scientific computing kernel`,"cctbx · Gemmi · RDKit · 科学服务":`cctbx · Gemmi · RDKit · scientific services`,衍射帧处理与探测器格式支持:`Diffraction frame processing and detector format support`,周期网络与拓扑识别:`Periodic networks and topology identification`,"本地 checkCIF 结构校验 · 学术免费":`Local checkCIF structure validation · free for academic use`,"结构精修 · 需要学术授权":`Structure refinement · academic authorization required`,"结构求解 · 需要学术授权":`Structure solution · academic authorization required`,全部组件可用:`All components available`,部分组件需要配置或修复:`Some components require configuration or repair`,"PLATON 官网中间证书已更换,请更新插件安装器":`The PLATON official-site intermediate certificate has changed. Update the plugin installer.`,"PLATON Mac 发行包架构不符":`PLATON Mac release package architecture mismatch`,"请输入授权邮件中的用户名和密码。":`Enter the username and password from the authorization email.`,请选择有效的科学软件路径:`Select a valid scientific software path`,检查科学软件与运行环境:`Check scientific software and runtime environment`,"正在修复科学 Python 依赖":`Repairing scientific Python dependencies`,"(首次下载可能需要几分钟)":`(The initial download may take several minutes)`,"from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('科学内核及工作台资源可用')":`from cctbx.array_family import flex; import gemmi,rdkit; from argus_crystalpilot import worker; from argus_crystalpilot.resources import bundle_root; assert (bundle_root()/'ui/dist/index.html').is_file(); import crystalpilot; from pathlib import Path; assert (Path(crystalpilot.__file__).parent/'io/dxtbx_plugin/pyproject.toml').is_file(); assert flex.double([1,2]).size()==2; print('Scientific kernel and workbench resources available')`,"; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · 探测器格式插件可用')":`; from importlib.metadata import entry_points; assert {'FormatCBFMiniRigaku:FormatCBF','FormatBrukerSfrmGeom:FormatBruker','FormatRODLegacy:FormatROD'} <= {e.name for e in entry_points(group='dxtbx.format')}; from dials.util.version import dials_version; assert flex.reflection_table() is not None; print(dials_version()+' · detector format plugins available')`,"Systre 19.6.0 · pcu 拓扑计算通过":`Systre 19.6.0 · pcu topology calculation passed`,"正在安装 Apple Rosetta 2 兼容组件":`Installing Apple Rosetta 2 compatibility components`,"从 SHELX 官方站点下载":`Downloading from the official SHELX site`,"SHELX 下载内容不是支持的可执行程序":`SHELX download is not a supported executable`,"已可用,保留当前安装":`Already available; keeping current installation`,正在安装:`Installing`,"尚未安装 DIALS":`DIALS is not installed`,"PLATON 编译需要 Apple 命令行工具;请运行 xcode-select --install,然后点击修复依赖。":`PLATON compilation requires Apple Command Line Tools; run xcode-select --install, then click Repair dependencies.`,"SHELX 官方 Mac 版需要 Rosetta 2,请先同意安装兼容组件。":`The official Mac version of SHELX requires Rosetta 2. Agree to install the compatibility components first.`,"暂未完成;可在健康检查中重试":`Not completed; retry from the health check`,"SHELX 下载或启动失败;请核对授权、网络及系统平台后重试。":`SHELX download or launch failed; check authorization, network, and system platform, then retry.`,"尚未安装 Systre":`Systre is not installed`,"尚未安装 Java":`Java is not installed`,"Systre 未能识别内置 pcu 网络":`Systre could not identify the built-in pcu network`,"尚未安装 PLATON":`PLATON is not installed`,"PLATON 安装配方已更新,点击修复依赖即可使用当前版本。":`The PLATON installation recipe has been updated. Click Repair dependencies to use the current version.`,"PLATON 未生成校验规则;请检查运行库":`PLATON did not generate verification rules; check the runtime`,"请输入 SHELX 授权信息以安装":`Enter SHELX authorization details to install`,"无法启动,请核对平台与运行库":`Unable to start; check the platform and runtime`,"衍射数据处理、结构求解、精修与三维晶体研究工作台":`Diffraction data processing, structure solution, refinement and a 3D crystallography workbench`,"正在准备 ⟦0⟧ 工作台,首次需要几分钟":`Preparing the ⟦0⟧ workbench; the first time takes a few minutes`,"⟦0⟧ 暂时无法使用":`⟦0⟧ is unavailable for now`,"管理 ⟦0⟧":`Manage ⟦0⟧`,"原生会话输入 ⟦0⟧ 可启用后台工具。":`Native session input ⟦0⟧ can enable background tools.`,"研究工具由服务方提供,沿用 Argus 的模型与执行后端。":`Research tools are provided by the service and use Argus's model and execution backend.`,"此插件由服务方提供并维护,无需停用或卸载。":`This plugin is provided and maintained by the service; there is nothing to disable or uninstall.`},Vd=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Hd=/⟦\d+⟧/g,Ud=Object.entries(Bd).filter(([e])=>e.includes(`⟦`)).sort((e,t)=>t[0].length-e[0].length).map(([e,t])=>({regex:RegExp(`^`+e.split(Hd).map(Vd).join(`([\\s\\S]*?)`)+`$`),slots:e.match(Hd)??[],target:t})),Wd=new RegExp(Object.keys(Bd).filter(e=>e.length>1&&!e.includes(`⟦`)).sort((e,t)=>t.length-e.length).map(Vd).join(`|`),`g`);function Gd(e,t){if(t===`zh-CN`||!/[\u3400-\u9fff]/.test(e))return e;if(Bd[e.trim()])return e.replace(e.trim(),Bd[e.trim()]);for(let t of Ud){let n=t.regex.exec(e.trim());if(n){let e=new Map(t.slots.map((e,t)=>[e,n[t+1]]));return t.target.replace(Hd,t=>e.get(t)??t)}}return e.replace(Wd,e=>Bd[e])}function Kd(){let{locale:e}=I();return t=>typeof t==`string`?Gd(t,e):t}var qd=M(),Jd=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;function Yd({health:e,setup:t,running:n,act:r,platform:i,machine:a}){let o=Kd(),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(``),[p,m]=(0,U.useState)(``),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(``),[y,b]=(0,U.useState)(!1),[x,S]=(0,U.useState)(!1),[C,w]=(0,U.useState)(!1),T=t.windows_runtime,E=t.license?.platform_consent,D=E?.platform===i&&E?.machines.includes(a||``),O=e?.components||[],k=O.filter(e=>e.status!==`ready`),A=k.some(e=>e.license_required),j=k.some(e=>e.automatic);async function M(e){e.preventDefault();let n=await r(t.license.action,{username:d,password:p,accept_platform_license:y});m(``),n&&(u(!1),f(``),c(!0))}return(0,K.jsxs)(`div`,{className:`mt-5 border-t border-line/60 pt-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:()=>c(!s),className:`inline-flex items-center gap-2 text-sm text-ink-dim hover:text-ink`,children:[(0,K.jsx)(ke,{size:16,strokeWidth:1.5}),(0,K.jsx)(`span`,{children:o(e?.stale?o(`科学环境 · 上次检查结果`):e?.checked?e.ready?o(`科学环境已就绪`):o(`科学环境 · ${k.length} 项待配置`):o(`科学环境`))}),(0,K.jsx)(Me,{size:13,className:`transition-transform duration-200 ${s?`rotate-180`:``}`})]}),(0,K.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-ink-faint hover:text-ink disabled:opacity-45`,disabled:n,onClick:()=>{c(!0),r(`health`)},children:[(0,K.jsx)(Pe,{size:12}),o(`检查环境`)]})]}),e?.stale&&(0,K.jsx)(`p`,{role:`status`,className:`mt-2 text-xs leading-relaxed text-ink-dim`,children:o(`下方为本次操作前的检查结果;请以上方最新错误为准,或重新检查环境。`)}),o((A||j||!e?.checked)&&(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:o(` 免费科学组件自动配置;SHELX 需要你在官网取得学术授权后输入下载凭据。 `)})),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[o((j||!e?.checked||e.stale)&&(0,K.jsxs)(`button`,{className:Jd,disabled:n,onClick:()=>{c(!0),r(`repair`)},children:[(0,K.jsx)(Le,{size:14}),o(`修复依赖`)]})),o(t.license&&(0,K.jsxs)(`button`,{className:Jd,disabled:n,onClick:()=>{u(!l),m(``),f(``)},children:[(0,K.jsx)(Vt,{size:14}),o(o(A?`配置 SHELX`:`SHELX 授权安装`))]}))]}),T&&(0,K.jsxs)(`div`,{className:`mt-3`,children:[(0,K.jsxs)(`button`,{type:`button`,className:Jd,disabled:n,onClick:()=>{w(!C),S(!1)},children:[(0,K.jsx)(Le,{size:14}),o(`准备 PLATON 官方环境`)]}),C&&(0,K.jsxs)(`form`,{className:`mt-3 rounded-lg bg-bg/70 p-3`,onSubmit:async e=>{e.preventDefault(),x&&await r(T.action,{accept_software_license:!0})&&(w(!1),S(!1),c(!0))},children:[(0,K.jsxs)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:[o(T.notice),` `,(0,K.jsx)(`a`,{href:T.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)})]}),(0,K.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:x,onChange:e=>S(e.target.checked),className:`mt-0.5`}),o(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,K.jsx)(`button`,{type:`submit`,className:Jd,disabled:n||!x,children:o(`下载、验证并配置`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>{w(!1),S(!1)},children:o(`取消`)})]})]})]}),o(l&&t.license&&(0,K.jsxs)(`form`,{onSubmit:M,className:`mt-4 rounded-lg bg-bg/70 p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm`,children:[(0,K.jsxs)(`span`,{className:`font-medium`,children:[o(t.license.name),o(` 学术授权`)]}),(0,K.jsxs)(`a`,{href:t.license.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-xs text-blue`,children:[o(`前往官网申请`),(0,K.jsx)(Fe,{size:11})]})]}),(0,K.jsx)(`p`,{className:`mb-3 mt-1.5 text-xs leading-relaxed text-ink-faint`,children:o(`填写授权邮件中的 username 和 password,即可自动下载安装。凭据仅用于本次官方下载,不保存,也不发送给模型。`)}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`用户名`),(0,K.jsx)(`input`,{"aria-label":o(`SHELX 用户名`),value:d,onChange:e=>f(e.target.value),required:!0,maxLength:200,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]}),(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(`密码`),(0,K.jsx)(`input`,{"aria-label":o(`SHELX 密码`),type:`password`,value:p,onChange:e=>m(e.target.value),required:!0,maxLength:500,autoComplete:`new-password`,className:`mt-1.5 w-full rounded-md border border-line bg-panel px-2.5 py-2 text-sm text-ink outline-none focus:border-blue/60`})]})]}),o(D&&E&&(0,K.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-faint`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`mt-0.5`}),(0,K.jsxs)(`span`,{children:[o(E.text),` `,(0,K.jsx)(`a`,{href:E.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`查看许可 ↗`)})]})]})),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`submit`,className:Jd,disabled:n||!d.trim()||!p.trim(),children:[(0,K.jsx)(Le,{size:14}),o(`下载并安装 SHELX`)]}),(0,K.jsx)(`button`,{type:`button`,className:`px-2 text-xs text-ink-faint`,onClick:()=>{u(!1),f(``),m(``)},children:o(`取消`)})]})]})),s&&(0,K.jsxs)(`div`,{className:`mt-3`,"aria-label":o(`科学软件健康检查`),children:[o(!O.length&&(0,K.jsx)(`p`,{className:`py-2 text-xs text-ink-faint`,children:o(`点击“检查环境”可验证科学内核与外部程序。`)})),O.map(e=>(0,K.jsx)(`div`,{className:`border-b border-line/40 py-2.5 last:border-0`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[o(e.status===`ready`?(0,K.jsx)(Ne,{size:15,strokeWidth:1.7,className:`mt-0.5 shrink-0 text-blue/75`}):(0,K.jsx)(It,{size:15,strokeWidth:1.5,className:`mt-0.5 shrink-0 text-ink-faint`})),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,K.jsx)(`span`,{children:o(e.name)}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-ink-faint`,children:o(e.status===`ready`?o(`可用`):e.license_required?o(`待授权安装`):o(`待修复`))})]}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-ink-faint`,children:o(e.description)}),(0,K.jsxs)(`details`,{className:`mt-1.5 text-xs text-ink-faint`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer hover:text-ink-dim`,children:o(e.status===`ready`?o(`查看检查详情`):o(`查看原因与安装方式`))}),(0,K.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words leading-relaxed`,children:o(e.detail)}),e.path&&(0,K.jsx)(`p`,{className:`mt-1 break-all leading-relaxed`,children:e.path}),(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:o(`官方安装说明 ↗`)}),o(e.id!==`python`&&t.actions.includes(`configure`)&&(0,K.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>{g(e.id),v(``)},className:`text-blue`,children:o(`使用已有安装`)}))]})]})]})]})},e.id)),o(h&&(0,K.jsxs)(`form`,{onSubmit:async e=>{e.preventDefault(),await r(`configure`,{paths:{[h]:_}})&&(g(null),v(``))},className:`mt-3 rounded-lg bg-bg/70 p-3`,children:[(0,K.jsxs)(`label`,{className:`text-xs text-ink-dim`,children:[o(o(h===`dials`?`DIALS 环境目录`:h===`systre`?`Systre JAR 路径(需要已有 Java)`:`${h.toUpperCase()} 可执行文件路径`)),(0,K.jsx)(`input`,{required:!0,value:_,onChange:e=>v(e.target.value),className:`mt-2 w-full rounded-md border border-line bg-panel px-2 py-2 text-sm text-ink`})]}),(0,K.jsx)(`p`,{className:`mt-1.5 text-xs text-ink-faint`,children:o(`填写运行 Argus 的电脑上的路径,验证成功后生效。`)}),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,K.jsx)(`button`,{className:Jd,disabled:n,children:o(`验证并使用`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,onClick:()=>g(null),children:o(`取消`)})]})]})),o(e?.checked&&(0,K.jsxs)(`p`,{className:`mt-2 text-[11px] text-ink-faint`,children:[o(`最近检查 `),o(new Date(e.checked*1e3).toLocaleString()),o(` · 检查不调用模型`)]}))]})]})}function Xd(e){return e.installed&&e.enabled&&e.supported?`ready`:e.managed_by_host?!e.supported||e.operation?.status===`failed`?`unavailable`:`preparing`:`manual`}var Zd=e=>`正在准备 ${e} 工作台,首次需要几分钟`,Qd=e=>`${e} 暂时无法使用`,$d=e=>`flex h-9 min-w-0 flex-1 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`;function ef({plugins:e,compact:t=!1,pending:n,onLaunch:r,onManage:i}){let a=Kd(),o=e.filter(e=>Xd(e)!==`manual`),s=!e.length||e.some(e=>Xd(e)===`manual`);return(0,K.jsxs)(K.Fragment,{children:[o.map(e=>{let o=Xd(e),s=!t&&(0,K.jsx)(`button`,{type:`button`,onClick:i,"aria-label":a(`管理 ${e.name}`),title:a(`管理 ${e.name}`),className:`icon-control mr-1 shrink-0 p-1.5 text-ink-faint hover:text-ink`,children:(0,K.jsx)(Rt,{size:15})});if(o===`ready`)return(0,K.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:n===e.id,onClick:()=>r(e),title:e.name,"aria-label":e.name,className:`${$d(t)} disabled:opacity-60`,children:[(0,K.jsx)(Lt,{size:17,strokeWidth:1.5,className:`shrink-0 text-blue`}),!t&&(0,K.jsx)(`span`,{className:`truncate`,children:e.name}),!t&&(0,K.jsx)(Ot,{size:13,className:`shrink-0 text-ink-faint`})]}),s]},e.id);let c=o===`preparing`?Zd(e.name):Qd(e.name),l=o===`preparing`?e.operation?.progress:e.operation?.error||e.reason;return(0,K.jsxs)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,"data-testid":`plugin-entry-${e.id}`,children:[(0,K.jsxs)(`div`,{role:`status`,title:a(l||c),className:`flex min-w-0 flex-1 items-center text-sm text-ink-faint ${t?`h-9 justify-center`:`gap-2 px-3 py-1.5`}`,children:[o===`preparing`?(0,K.jsx)(W,{size:17,strokeWidth:1.5,className:`shrink-0 animate-spin`}):(0,K.jsx)(Lt,{size:17,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,K.jsxs)(`div`,{className:`min-w-0 leading-snug`,children:[(0,K.jsx)(`p`,{children:a(c)}),l&&(0,K.jsx)(`p`,{className:`mt-0.5 truncate text-xs`,children:a(l)})]})]}),s]},e.id)}),s&&(0,K.jsx)(`div`,{className:`mx-2 my-1 flex shrink-0 items-center`,children:(0,K.jsxs)(`button`,{type:`button`,onClick:i,title:a(`插件`),"aria-label":a(`插件`),className:$d(t),children:[(0,K.jsx)(jt,{size:16,strokeWidth:1.5,className:`shrink-0`}),!t&&(0,K.jsx)(`span`,{children:a(`插件`)})]})})]})}function tf({compact:e=!1}){let t=Kd(),{locale:n}=I(),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)([]),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(!1),_=(0,U.useRef)(null),v=a.some(e=>Xd(e)===`preparing`),y=a.length>0&&a.every(e=>e.managed_by_host);async function b(e){let n=await fetch(`/api/plugins`,{headers:te(),signal:e});if(!n.ok)throw Error(t(`无法读取插件列表`));let r=await n.json();e?.aborted||o(r.plugins)}(0,U.useEffect)(()=>{r||(m(null),g(!1))},[r]),(0,U.useEffect)(()=>{let e=new AbortController,t=()=>b(e.signal).catch(t=>{!e.signal.aborted&&r&&c(t.message)});r&&(_.current?.focus(),c(``),u(!0)),t().finally(()=>{e.signal.aborted||u(!1)});let n=r||v?window.setInterval(t,r?1500:4e3):0,a=e=>{e.key===`Escape`&&i(!1)};return r&&window.addEventListener(`keydown`,a),()=>{e.abort(),n&&window.clearInterval(n),window.removeEventListener(`keydown`,a)}},[r,v]);async function x(e,n,r){let i=e.setup?.windows_runtime;if(i&&!i.accepted&&[`install`,`update`,`repair`,i.action].includes(n)&&r?.accept_software_license!==!0)return m({pluginId:e.id,action:n}),g(!1),c(``),!1;f(e.id),c(``);try{let i=await fetch(`/api/plugins/${e.id}/${n===`launch`?`launch`:`manage/${n}`}`,{method:`POST`,headers:{...te(),"Content-Type":`application/json`},body:r?JSON.stringify(r):void 0}),a=await i.json();if(!i.ok)throw Error(a.detail||t(`插件操作未完成`));return n===`launch`?window.location.assign(a.url):await b(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{f(null)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ef,{plugins:a,compact:e,pending:d,onLaunch:e=>void x(e,`launch`),onManage:()=>i(!0)}),r&&(0,qd.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:()=>i(!1),children:(0,K.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`plugin-title`,onClick:e=>e.stopPropagation(),className:`max-h-[85vh] w-full max-w-xl overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`h2`,{id:`plugin-title`,className:`text-lg font-semibold`,children:t(`插件`)}),(0,K.jsx)(`button`,{ref:_,type:`button`,"aria-label":t(`关闭插件列表`),className:`icon-control p-1.5`,onClick:()=>i(!1),children:(0,K.jsx)(Ie,{size:18})})]}),(0,K.jsx)(`p`,{className:`mb-6 mt-2 text-sm text-ink-faint`,children:t(t(y?`研究工具由服务方提供,沿用 Argus 的模型与执行后端。`:`按需安装研究工具,沿用 Argus 的模型与执行后端。`))}),t(s&&(0,K.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-ink-dim`,children:t(s)})),t(l&&(0,K.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`正在读取插件…`)})),t(!l&&!a.length&&(0,K.jsx)(`p`,{className:`text-sm text-ink-faint`,children:t(`暂无可用插件`)})),t(a.map(e=>{let r=e.operation?.status===`running`||d===e.id,i=r||!e.supported,a=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`;return(0,K.jsxs)(`article`,{className:`rounded-xl border border-line/70 p-4`,"data-testid":`plugin-${e.id}`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(Lt,{size:24,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-medium`,children:t(e.name)}),(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t(e.installed_version||e.version)})]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:t(e.description)})]})]}),(0,K.jsxs)(`div`,{className:`mt-4 text-xs text-ink-faint`,children:[t(e.installed?e.enabled?t(`已启用`):t(`已停用`):t(`未安装`)),t(` · 当前后端 `),t(Array.from(new Set(Object.values(e.backends))).join(` / `))]}),t(!e.supported&&(0,K.jsx)(`p`,{className:`mt-3 text-sm text-ink-dim`,children:t(e.reason)})),t(e.operation?.status===`running`&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-sm text-ink-dim`,children:[(0,K.jsx)(W,{size:14,className:`animate-spin`}),t(e.operation.progress)]})),t(e.operation?.status===`failed`&&(0,K.jsx)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-ink-dim`,children:t(e.operation.error)})),(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[t(!e.installed&&!e.managed_by_host&&(0,K.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`install`),children:[(0,K.jsx)(Le,{size:14}),t(`安装`)]})),t(e.installed&&e.enabled&&(0,K.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`launch`),children:[t(`打开工作台`),(0,K.jsx)(Ot,{size:14})]})),t(e.installed&&!e.enabled&&!e.managed_by_host&&(0,K.jsx)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`enable`),children:t(`启用`)})),t(e.update_available&&!e.managed_by_host&&(0,K.jsxs)(`button`,{className:a,disabled:i,onClick:()=>void x(e,`update`),children:[(0,K.jsx)(Pe,{size:14}),e.environment_update?t(`更新科学环境校验`):(0,K.jsxs)(K.Fragment,{children:[t(`更新至 `),t(e.version)]})]})),t(e.installed&&e.enabled&&!e.managed_by_host&&(0,K.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`disable`),children:t(`停用`)})),t(e.installed&&!e.managed_by_host&&(0,K.jsx)(`button`,{className:a,disabled:r,onClick:()=>void x(e,`uninstall`),children:t(`卸载`)}))]}),p?.pluginId===e.id&&e.setup?.windows_runtime&&(0,K.jsxs)(`form`,{className:`mt-4 rounded-lg bg-bg/70 p-3`,onSubmit:async t=>{t.preventDefault(),!(!h||r)&&await x(e,p.action,{accept_software_license:!0})&&(m(null),g(!1))},children:[(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-dim`,children:t(`继续安装或修复前,请确认 PLATON 官方许可。确认后会在同一流程准备完整运行环境,无需另点其他修复按钮。`)}),(0,K.jsxs)(`p`,{className:`mt-2 text-xs leading-relaxed text-ink-faint`,children:[t(e.setup.windows_runtime.notice),` `,(0,K.jsx)(`a`,{href:e.setup.windows_runtime.url,target:`_blank`,rel:`noreferrer`,className:`text-blue`,children:t(`官方安装说明 ↗`)})]}),(0,K.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-xs leading-relaxed text-ink-dim`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked),className:`mt-0.5`}),t(`我确认用途符合 PLATON 官方许可;如用于商业用途,已另行取得授权。`)]}),(0,K.jsxs)(`div`,{className:`mt-3 flex gap-3`,children:[(0,K.jsx)(`button`,{type:`submit`,className:a,disabled:r||!h,children:t(`同意并继续`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint`,disabled:r,onClick:()=>{m(null),g(!1)},children:t(`取消`)})]})]}),(0,K.jsx)(`p`,{className:`mt-4 text-xs leading-relaxed text-ink-faint`,children:t(e.installed?t(`原生会话输入 ${e.command||``} 可启用后台工具。卸载保留会话、研究数据和科学软件。`):t(`首次安装自动配置独立 Python、DIALS、Systre / Java 和 PLATON 学术免费组件。SHELX 稍后输入授权信息即可安装。`))}),t(e.rights_notice&&(0,K.jsx)(`p`,{className:`mt-3 text-[10px] leading-relaxed text-ink-faint`,"data-testid":`plugin-rights-notice`,children:t(n===`zh-CN`&&e.rights_notice_zh||e.rights_notice)})),t(e.installed&&e.setup&&(0,K.jsx)(Yd,{health:e.health,setup:e.setup,running:r,platform:e.platform,machine:e.machine,act:(t,n)=>x(e,t,n)}))]},e.id)}))]})}),document.body)]})}var nf=[`all`,`installed`,`available`,`builtin`],rf=[`install`,`update`,`enable`,`disable`,`uninstall`],af=new Set([`install`,`update`,`uninstall`]),of={query:``,kind:`all`,tag:null};function sf(e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}){return e.VITE_ARGUS_HOSTED_TRIAL===`1`}function cf(e,t){switch(t){case`all`:return!0;case`installed`:return e===`installed`||e===`package`;case`available`:return e===`available`;case`builtin`:return e===`builtin`}}function lf(e,t){let n=t.trim().toLowerCase();return!n||[e.name,e.purpose,e.purpose_zh??``,...e.routing_path??[],...e.tags,...e.requires].join(` +`).toLowerCase().includes(n)}function uf(e,t){return e.filter(e=>cf(e.kind,t.kind)&&(!t.tag||e.tags.includes(t.tag))&&(!t.routingPath||(e.routing_path??[]).join(`/`)===t.routingPath||(e.routing_path??[]).join(`/`).startsWith(`${t.routingPath}/`))&&lf(e,t.query))}function df(e){let t=new Set;for(let n of e){let e=n.routing_path??[];for(let n=1;n<=e.length;n++)t.add(e.slice(0,n).join(`/`))}return[...t].sort()}function ff(e){let t=new Set;for(let n of e)for(let e of n.tags)e.trim()&&t.add(e.trim());return[...t].sort((e,t)=>e.localeCompare(t))}function pf(e,t){let n=t||e.managed_by_host;return e.actions.filter(e=>rf.includes(e)&&!(n&&af.has(e)))}var mf=e=>`verticals.action.${e}`,hf=e=>`verticals.kind.${e}`,gf=e=>`verticals.filter.${e}`,_f=e=>`verticals.operation.${e}`;function vf(e,t){return t===`zh-CN`&&e.purpose_zh&&e.purpose_zh.trim()?e.purpose_zh:e.purpose}function yf(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function bf(e){if(!e||e.status!==`running`)return null;let t=Number(e.progress);return!Number.isFinite(t)||t<=0?null:Math.max(0,Math.min(100,Math.round(t)))}var xf=e=>e.operation?.status===`running`;function Sf(e){return e.some(xf)}function Cf(e,t){return e?t?1500:4e3:t?4e3:0}function wf(e){if(e instanceof N){if(e.detail)return e.detail;let t=/^[A-Z]+ \S+ → \S+: ([\s\S]+)$/.exec(e.message);return t?t[1]:``}return e instanceof Error?e.message:String(e??``)}function Tf(e){return e instanceof N&&e.status===409}function Ef(e){return e instanceof N&&e.status===404}function Df(e,t){return Array.isArray(e)&&e.includes(t)}function Of(e){return new Set(e.map(e=>e.name))}var kf=`inline-flex items-center justify-center gap-1.5 rounded-lg border border-line px-3 py-1.5 text-sm transition-colors hover:bg-bg disabled:cursor-not-allowed disabled:opacity-45`,Af=e=>`rounded-full border px-2.5 py-0.5 text-xs transition-colors ${e?`border-blue/60 bg-blue/10 text-blue`:`border-line text-ink-dim hover:border-blue/40 hover:text-ink`}`,jf=e=>`rounded px-1.5 py-0.5 text-[10px] font-semibold ${e===`ok`?`bg-ok/10 text-ok`:e===`warn`?`bg-warn/10 text-warn`:e===`blue`?`bg-blue/10 text-blue`:`bg-line text-ink-dim`}`,Mf={install:Le,update:Pe,enable:qt,disable:Kt,uninstall:Zt};function Nf(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;try{return new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}catch{return n.toISOString()}}function Pf({compact:e=!1,onOpen:t}){let{t:n}=I();return(0,K.jsxs)(`button`,{type:`button`,onClick:t,title:n(`verticals.entry`),"aria-label":n(`verticals.entry`),"data-testid":`vertical-store-entry`,className:`mx-2 my-1 flex h-9 shrink-0 items-center rounded-md text-sm text-ink-dim transition-colors hover:bg-bg hover:text-ink ${e?`justify-center`:`gap-2 px-3`}`,children:[(0,K.jsx)(Xt,{size:17,strokeWidth:1.5}),!e&&(0,K.jsx)(`span`,{children:n(`verticals.entry`)})]})}function Ff({row:e,locale:t,hosted:n,busy:r,failure:i,known:a,onAct:o,onJump:s,onTag:c}){let{t:l}=I(),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),m=xf(e),h=r||m,g=pf(e,n),_=e.operation,v=bf(_),y=e=>rf.includes(e)?l(mf(e)):e,b=_&&rf.includes(_.action)?l(_f(_.action)):l(`verticals.operationRunning`),x=e.kind===`installed`?`ok`:e.kind===`available`?`neutral`:`blue`,S=async(t=!1)=>{d(!1),await o(e,`uninstall`,t?{force:!0}:void 0)};return(0,K.jsxs)(`article`,{id:`vertical-${e.name}`,"data-testid":`vertical-${e.name}`,"data-kind":e.kind,tabIndex:-1,className:`flex flex-col rounded-xl border border-line/70 p-4 outline-none focus-visible:border-blue/60`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(Ht,{size:22,strokeWidth:1.25,className:`mt-0.5 shrink-0 text-blue`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:jf(x),"data-testid":`vertical-kind`,children:l(hf(e.kind))}),e.kind!==`available`&&(0,K.jsx)(`span`,{className:jf(e.enabled?`ok`:`neutral`),children:e.enabled?l(`verticals.enabled`):l(`verticals.disabledState`)}),e.update_available&&(0,K.jsx)(`span`,{className:jf(`warn`),"data-testid":`vertical-update`,children:l(`verticals.updateAvailable`)})]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-ink-faint`,children:vf(e,t)}),e.routing_path?.length?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:e.routing_path.join(` / `)}):null]})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-ink-faint`,children:[e.installed_version&&(0,K.jsx)(`span`,{children:l(`verticals.installedVersion`,{version:e.installed_version})}),e.version&&e.version!==e.installed_version&&(0,K.jsx)(`span`,{children:l(`verticals.catalogVersion`,{version:e.version})}),e.size_bytes!=null&&(0,K.jsxs)(`span`,{children:[l(`verticals.size`),` `,yf(e.size_bytes)]})]}),e.requires.length>0&&(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.requires`)}),e.requires.map(e=>a.has(e)&&s?(0,K.jsx)(`button`,{type:`button`,onClick:()=>s(e),"aria-label":l(`verticals.jumpTo`,{name:e}),title:l(`verticals.jumpTo`,{name:e}),className:`rounded-full border border-line px-2 py-0.5 font-mono text-ink-dim transition-colors hover:border-blue/60 hover:text-blue`,children:e},e):(0,K.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.shared.length>0&&(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-ink-faint`,children:l(`verticals.shared`)}),e.shared.map(e=>(0,K.jsx)(`span`,{className:`rounded-full border border-line/50 px-2 py-0.5 font-mono text-ink-faint`,children:e},e))]}),e.tags.length>0&&(0,K.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.tags.map(e=>c?(0,K.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint transition-colors hover:text-blue`,children:[`#`,e]},e):(0,K.jsxs)(`span`,{className:`rounded-full bg-bg px-2 py-0.5 text-[11px] text-ink-faint`,children:[`#`,e]},e))}),e.missing_python.length>0&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-start gap-2 rounded-lg bg-warn/10 p-2.5 text-xs leading-relaxed text-warn`,"data-testid":`vertical-missing-python`,children:[(0,K.jsx)(Qt,{size:14,className:`mt-0.5 shrink-0`}),(0,K.jsx)(`span`,{children:l(`verticals.missingPython`,{packages:e.missing_python.join(`, `)})})]}),!!e.runtime_issues?.length&&(0,K.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-runtime-issues`,children:l(`verticals.runtimeIssues`,{issues:e.runtime_issues.join(`; `)})}),!!e.install_issues?.length&&(0,K.jsx)(`p`,{role:`status`,className:`mt-3 rounded-lg bg-warn/10 p-2.5 text-xs text-warn`,"data-testid":`vertical-install-issues`,children:l(`verticals.installIssues`,{issues:e.install_issues.join(`; `)})}),e.used_by.length>0&&(0,K.jsxs)(`div`,{className:`mt-3 text-xs text-ink-faint`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":f,onClick:()=>p(e=>!e),className:`inline-flex items-center gap-1 transition-colors hover:text-ink`,"data-testid":`vertical-used-by`,children:[e.used_by.length===1?l(`verticals.usedByOne`):l(`verticals.usedBy`,{count:e.used_by.length}),f?(0,K.jsx)(Nt,{size:12}):(0,K.jsx)(Me,{size:12})]}),f&&(0,K.jsx)(`ul`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono`,children:e.used_by.map(e=>(0,K.jsx)(`li`,{className:`rounded bg-bg px-1.5 py-0.5`,children:e},e))})]}),m&&_&&(0,K.jsxs)(`div`,{className:`mt-3`,"data-testid":`vertical-progress`,children:[(0,K.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-ink-dim`,children:[(0,K.jsx)(W,{size:14,className:`animate-spin`}),(0,K.jsx)(`span`,{children:b}),v!=null&&(0,K.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-ink-faint`,children:[v,`%`]})]}),(0,K.jsx)(`div`,{role:`progressbar`,"aria-label":b,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":v??void 0,className:`mt-1.5 h-1 overflow-hidden rounded bg-line`,children:v==null?(0,K.jsx)(`div`,{className:`h-full w-1/2 animate-pulse rounded bg-blue`}):(0,K.jsx)(`div`,{className:`h-full rounded bg-blue transition-[width] duration-500`,style:{width:`${v}%`}})}),_.message&&(0,K.jsx)(`p`,{className:`mt-1 break-words text-xs text-ink-faint`,children:_.message})]}),_?.status===`failed`&&(0,K.jsxs)(`p`,{role:`status`,className:`mt-3 break-words text-sm text-err`,"data-testid":`vertical-operation-failed`,children:[l(`verticals.operationFailed`,{action:y(_.action)}),_.message?` — ${_.message}`:``]}),i&&(0,K.jsxs)(`div`,{role:`alert`,className:`mt-3 rounded-lg border border-err/30 bg-err/5 p-2.5 text-sm text-ink-dim`,"data-testid":`vertical-failure`,children:[(0,K.jsx)(`p`,{className:`break-words`,children:i.text}),i.offerForce&&(0,K.jsxs)(`button`,{type:`button`,className:`${kf} mt-2 border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(!0),children:[(0,K.jsx)(Zt,{size:14}),l(`verticals.removeAnyway`)]})]}),g.length>0&&(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:g.map(t=>{let n=Mf[t];if(t===`uninstall`)return u?(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`${kf} border-err/50 text-err hover:bg-err/10`,disabled:h,onClick:()=>void S(),"data-testid":`vertical-confirm-uninstall`,children:[(0,K.jsx)(Zt,{size:14}),l(`verticals.confirmUninstall`)]}),(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-ink-faint hover:text-ink`,onClick:()=>d(!1),children:l(`common.cancel`)}),(0,K.jsx)(`span`,{className:`text-xs text-ink-faint`,children:l(`verticals.confirmUninstallHint`,{name:e.name})})]},t):(0,K.jsxs)(`button`,{type:`button`,className:kf,disabled:h,onClick:()=>d(!0),"data-action":t,children:[(0,K.jsx)(n,{size:14}),l(mf(t))]},t);let r=t===`update`&&e.version?l(`verticals.updateTo`,{version:e.version}):l(mf(t));return(0,K.jsxs)(`button`,{type:`button`,className:kf,disabled:h,onClick:()=>void o(e,t),"data-action":t,children:[(0,K.jsx)(n,{size:14}),r]},t)})})]})}function If({payload:e,filter:t,onFilter:n,hosted:r,supported:i,loading:a,refreshing:o,error:s,pending:c,failures:l,onAct:u,onRefresh:d,onJump:f}){let{t:p,locale:m}=I(),h=e?.verticals??[],g=(0,U.useMemo)(()=>ff(h),[h]),_=(0,U.useMemo)(()=>df(h),[h]),v=(0,U.useMemo)(()=>Of(h),[h]),y=(0,U.useMemo)(()=>uf(h,t),[h,t]),b=t.query.trim()!==``||t.kind!==`all`||t.tag!==null||!!t.routingPath,x=e?.catalog;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:p(r?`verticals.hostedNote`:`verticals.intro`)}),i===!1&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-4 rounded-lg border border-line bg-bg/70 p-3 text-sm text-ink-dim`,"data-testid":`vertical-store-too-old`,children:p(`verticals.tooOld`)}),i!==!1&&(0,K.jsxs)(K.Fragment,{children:[x&&(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-faint`,"data-testid":`vertical-catalog`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,title:x.source,children:p(`verticals.catalogSource`,{source:x.source})}),x.release_tag&&(0,K.jsx)(`span`,{className:`rounded bg-bg px-1.5 py-0.5 font-mono`,children:p(`verticals.catalogRelease`,{tag:x.release_tag})}),(0,K.jsx)(`span`,{children:x.fetched_at?p(`verticals.catalogFetched`,{time:Nf(x.fetched_at,m)}):p(`verticals.catalogNever`)}),(0,K.jsxs)(`button`,{type:`button`,className:`${kf} ml-auto`,disabled:o||a,onClick:d,"data-testid":`vertical-refresh-catalog`,children:[(0,K.jsx)(Pe,{size:14,className:o?`animate-spin`:``}),p(o?`verticals.refreshing`:`verticals.refreshCatalog`)]})]}),x?.error&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-3 rounded-lg border border-warn/40 bg-warn/10 p-2.5 text-sm text-warn`,"data-testid":`vertical-catalog-error`,children:p(`verticals.catalogError`,{error:x.error})}),s&&(0,K.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-err`,"data-testid":`vertical-store-error`,children:s}),(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-line bg-bg px-2.5 focus-within:border-blue/60`,children:[(0,K.jsx)(Ye,{size:14,className:`shrink-0 text-ink-faint`}),(0,K.jsx)(`span`,{className:`sr-only`,children:p(`verticals.search`)}),(0,K.jsx)(`input`,{type:`search`,value:t.query,onChange:e=>n({...t,query:e.target.value}),placeholder:p(`verticals.searchPlaceholder`),className:`min-w-0 flex-1 bg-transparent text-sm text-ink outline-none placeholder:text-ink-faint`})]}),(0,K.jsx)(`div`,{role:`group`,"aria-label":p(`verticals.kindFilter`),className:`flex flex-wrap gap-1`,children:nf.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":t.kind===e,onClick:()=>n({...t,kind:e}),className:`h-8 rounded-md px-2.5 text-xs font-medium transition-colors ${t.kind===e?`bg-blue/10 text-blue`:`text-ink-faint hover:bg-bg hover:text-ink`}`,children:p(gf(e))},e))})]}),_.length>0&&(0,K.jsxs)(`label`,{className:`mt-3 flex items-center gap-2 text-xs text-ink-faint`,children:[p(`verticals.routingPath`),(0,K.jsxs)(`select`,{className:`rounded-md border border-line bg-bg p-1.5`,value:t.routingPath??``,onChange:e=>n({...t,routingPath:e.target.value}),children:[(0,K.jsx)(`option`,{value:``,children:p(`verticals.filter.all`)}),_.map(e=>(0,K.jsx)(`option`,{value:e,children:e.replaceAll(`/`,` / `)},e))]})]}),(g.length>0||b)&&(0,K.jsxs)(`div`,{role:`group`,"aria-label":p(`verticals.tagFilter`),className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[g.map(e=>(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":t.tag===e,className:Af(t.tag===e),onClick:()=>n({...t,tag:t.tag===e?null:e}),children:[`#`,e]},e)),b&&(0,K.jsx)(`button`,{type:`button`,className:`ml-1 text-xs text-ink-faint hover:text-ink`,onClick:()=>n(of),children:p(`verticals.clearFilters`)})]}),h.length>0&&(0,K.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:p(`verticals.count`,{shown:y.length,total:h.length})}),a&&!e&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.loading`)}),e&&h.length===0&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.none`)}),h.length>0&&y.length===0&&(0,K.jsx)(`p`,{className:`mt-4 text-sm text-ink-faint`,children:p(`verticals.noMatches`)}),y.length>0&&(0,K.jsx)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,"data-testid":`vertical-grid`,children:y.map(e=>(0,K.jsx)(Ff,{row:e,locale:m,hosted:r,busy:c===e.name,failure:l[e.name],known:v,onAct:u,onJump:f,onTag:e=>n({...t,tag:e})},e.name))})]})]})}function Lf({open:e,onClose:t}){let{t:n}=I(),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)({}),[_,v]=(0,U.useState)(of),y=(0,U.useRef)(null),b=(0,U.useRef)(t);b.current=t;let x=(0,U.useRef)(n);x.current=n;let S=Sf(r?.verticals??[]),C=!!r?.host.managed_by_host||sf();(0,U.useEffect)(()=>{if(!e||a!==null)return;let t=!1;return F.meta().then(e=>{t||o(Df(e.capabilities,P))},()=>{t||o(!0)}),()=>{t=!0}},[e,a]),(0,U.useEffect)(()=>{if(a!==!0||!e&&!S)return;let t=new AbortController,n=()=>F.verticals(t.signal).then(e=>{t.signal.aborted||(i(e),f(e=>e?.source===`load`?null:e))},n=>{t.signal.aborted||(Ef(n)?o(!1):e&&f({text:x.current(`verticals.loadFailed`),source:`load`}))});e&&c(!0),n().finally(()=>{t.signal.aborted||c(!1)});let r=Cf(e,S),s=r?window.setInterval(n,r):0;return()=>{t.abort(),s&&window.clearInterval(s)}},[e,S,a]),(0,U.useEffect)(()=>{if(!e){g({}),f(e=>e?.source===`refresh`?null:e);return}y.current?.focus();let t=e=>{e.key===`Escape`&&b.current()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let w=(0,U.useCallback)(async()=>{try{i(await F.verticals()),f(e=>e?.source===`load`?null:e)}catch(e){Ef(e)?o(!1):f({text:x.current(`verticals.loadFailed`),source:`load`})}},[]),T=(0,U.useCallback)(async(e,t,n={})=>{m(e.name),g(t=>{let{[e.name]:n,...r}=t;return r});try{return await F.manageVertical(e.name,t,n),await w(),!0}catch(r){let i=wf(r)||x.current(`verticals.actionFailed`),a=t===`uninstall`&&Tf(r)&&!n.force;return g(t=>({...t,[e.name]:{text:i,offerForce:a}})),!1}finally{m(null)}},[w]),E=(0,U.useCallback)(async()=>{u(!0),f(null);try{i(await F.refreshVerticalCatalog())}catch(e){f({text:wf(e)||x.current(`verticals.loadFailed`),source:`refresh`})}finally{u(!1)}},[]),D=(0,U.useCallback)(e=>{v(of),!(typeof document>`u`)&&window.setTimeout(()=>{let t=document.getElementById(`vertical-${e}`);t?.scrollIntoView?.({block:`nearest`,behavior:`smooth`}),t?.focus?.()},0)},[]);return e?(0,qd.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-black/20 p-5 backdrop-blur-sm`,onClick:t,children:(0,K.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`vertical-store-title`,onClick:e=>e.stopPropagation(),className:`flex max-h-[85vh] w-full max-w-4xl flex-col overflow-y-auto rounded-2xl border border-line bg-panel p-6 text-ink shadow-xl scroll-thin`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`h2`,{id:`vertical-store-title`,className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Xt,{size:20,strokeWidth:1.5,className:`text-blue`}),n(`verticals.title`)]}),(0,K.jsx)(`button`,{ref:y,type:`button`,"aria-label":n(`verticals.close`),className:`icon-control p-1.5`,onClick:t,children:(0,K.jsx)(Ie,{size:18})})]}),(0,K.jsx)(If,{payload:r,filter:_,onFilter:v,hosted:C,supported:a,loading:s,refreshing:l,error:d?.text??``,pending:p,failures:h,onAct:T,onRefresh:()=>void E(),onJump:D})]})}),document.body):null}function Rf(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).at(-1)||e}function zf(e,t,n){if(e.length===0)return`local`;let r=n.trim(),i=r?e.filter(e=>e.launch_cwd?.trim()===r):[];return i.length===0||t&&!i.some(e=>e.id===t)?`all`:`local`}function Bf({projects:e,activeId:t,activeWork:n,localCwd:i,onSelect:o,onPrefetch:c,onManage:l,onResume:u,resumingId:p,onOpenPanel:m,onOpenLearning:h,onOpenVerticals:y,onNew:b,loading:x,creating:S=!1,error:C,onRetry:w,mobileOpen:T=!1,collapsed:E=!1,onToggleCollapse:D,themeMode:O,onCycleTheme:k}){let{t:A,locale:j}=I(),[M,N]=(0,U.useState)(`local`),ee=(0,U.useRef)(!1),[P,F]=(0,U.useState)(``),[te,ne]=(0,U.useState)(()=>new Set),re=E&&!T,L=i.trim(),ie=(0,U.useMemo)(()=>L?e.filter(e=>e.launch_cwd?.trim()===L):[],[L,e]);(0,U.useEffect)(()=>{ee.current||x||e.length===0||(ee.current=!0,N(zf(e,t,L)))},[t,x,L,e]);let ae=M===`local`?ie:e,oe=P.trim()?Kl(ae,P):ae,se=(0,U.useMemo)(()=>{if(M===`local`)return oe.length>0?[[L||`Local`,oe]]:[];let e=new Map;return oe.forEach(t=>{let n=t.launch_cwd?.trim()||A(`common.unassigned`),r=e.get(n)??[];r.push(t),e.set(n,r)}),[...e.entries()]},[L,M,oe]),ce=e=>te.has(e)&&!P.trim();return(0,K.jsxs)(Ge,{mobileOpen:T,collapsed:E,children:[(0,K.jsx)(`div`,{className:`chrome-seam-surface flex h-12 shrink-0 items-center border-b border-line/50 ${re?`justify-center`:`justify-between px-4`}`,children:re?(0,K.jsx)(vt,{size:22,compact:!0}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(vt,{size:24}),(0,K.jsx)(`button`,{type:`button`,onClick:D,"aria-label":A(`sidebar.collapse`),title:`${A(`sidebar.collapse`)} · Ctrl/⌘ B`,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,K.jsx)(s,{icon:_,className:`h-3.5 w-3.5`})})]})}),re?(0,K.jsx)(`div`,{className:`flex h-12 shrink-0 items-center justify-center`,children:(0,K.jsx)(`button`,{type:`button`,onClick:D,"aria-label":A(`sidebar.expand`),title:`${A(`sidebar.expand`)} · Ctrl/⌘ B`,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-line/50 bg-bg/40 text-ink-faint hover:border-blue/50 hover:text-ink`,children:(0,K.jsx)(s,{icon:f,className:`h-3.5 w-3.5`})})}):null,re?(0,K.jsx)(tf,{compact:!0}):null,re&&h?(0,K.jsx)(Kn,{onOpen:h,compact:!0}):null,re&&y?(0,K.jsx)(Pf,{compact:!0,onOpen:y}):null,re?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`nav`,{"aria-label":j===`zh-CN`?`工具与知识`:`Tools and knowledge`,"data-sidebar-resources":!0,className:`shrink-0 overflow-y-auto overscroll-contain border-b border-line/50 px-2 py-2 scroll-thin [&>section]:mx-2 [&>section]:border-0 [&>section]:py-0 [&>section>div>button:first-child]:px-3`,style:{maxHeight:`min(40dvh, 360px)`},children:[(0,K.jsx)(tf,{}),h&&(0,K.jsx)(Kn,{onOpen:h}),y?(0,K.jsx)(Pf,{onOpen:y}):null]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 pb-1 pt-3`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:j===`zh-CN`?`项目`:`Projects`}),ie.length>0&&ie.lengthN(e.target.value),className:`min-w-0 bg-transparent text-xs text-ink-faint`,children:[(0,K.jsx)(`option`,{value:`local`,children:A(`common.local`)}),(0,K.jsx)(`option`,{value:`all`,children:A(`common.all`)})]}):null,(0,K.jsx)(`button`,{type:`button`,onClick:b,disabled:S,"aria-label":A(`sidebar.create`),title:A(`sidebar.create`),className:`ml-auto flex h-8 items-center justify-center rounded-md px-2 text-xs text-ink-dim hover:bg-bg disabled:opacity-40`,children:S?`…`:j===`zh-CN`?`+ 新建`:`+ New`})]}),(0,K.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,K.jsx)(`label`,{className:`sr-only`,htmlFor:`daemon-search`,children:A(`sidebar.find`)}),(0,K.jsxs)(`div`,{className:`flex items-center rounded-md border border-line/60 bg-bg/60 px-2 focus-within:border-blue/60`,children:[(0,K.jsx)(`input`,{id:`daemon-search`,value:P,onChange:e=>F(e.target.value),placeholder:A(`sidebar.find`),className:`h-8 min-w-0 flex-1 bg-transparent text-xs text-ink outline-none placeholder:text-ink-faint`}),P?(0,K.jsx)(`button`,{type:`button`,"aria-label":A(`sidebar.clearSearch`),onClick:()=>F(``),className:`px-1 text-sm text-ink-faint hover:text-ink`,children:`×`}):null]})]}),(0,K.jsxs)(`div`,{className:`mobile-scroll-region min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-3 pb-3 scroll-thin`,children:[x&&e.length===0?(0,K.jsx)(`div`,{className:`px-1 py-3 text-xs text-ink-faint`,children:A(`common.loading`)}):null,C?(0,K.jsx)(`button`,{type:`button`,onClick:w,className:`mb-2 w-full rounded-md bg-err/5 px-3 py-2 text-left text-xs text-err`,children:A(`sidebar.refreshFailed`)}):null,!x&&!C&&oe.length===0?(0,K.jsxs)(`div`,{className:`px-1 py-4 text-xs text-ink-faint`,children:[(0,K.jsx)(`div`,{children:P.trim()?A(`sidebar.noMatches`,{query:P.trim()}):A(`sidebar.noSessions`)}),P.trim()?(0,K.jsx)(`button`,{type:`button`,onClick:()=>F(``),className:`mt-2 text-xs text-ink-dim underline underline-offset-2 hover:text-ink`,children:A(`sidebar.clearSearch`)}):null]}):null,se.map(([e,i])=>(0,K.jsxs)(`section`,{className:`mb-1 last:mb-0`,children:[i.length>1&&se.length>1?(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":!ce(e),title:e,onClick:()=>ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),className:`mb-1 flex h-7 w-full items-center gap-2 rounded-md px-1.5 text-left text-[11px] font-medium text-ink-faint hover:bg-bg/70 hover:text-ink-dim`,children:[(0,K.jsx)(s,{icon:r,className:`h-2.5 w-2.5 transition-transform ${ce(e)?`-rotate-90`:``}`}),(0,K.jsx)(s,{icon:v,className:`h-3 w-3`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Rf(e)})]}):null,i.length===1||se.length===1||!ce(e)?i.map(e=>{let r=e.id===t,i=r&&n?.sessionId===e.id?n:void 0,a=i?Kr(i.status,j,i.connected):void 0,f=Bl(e),m=f?(e.label||e.display_name||``).trim():e.objective.trim()||A(`sidebar.unnamedSession`),h=e.daemon_alive&&e.daemon_protocol_compatible===!1,_=h&&e.daemon_protocol_error===`daemon release is incompatible with WebAPI release`,v=h&&!_,y=!e.daemon_alive&&e.last_active>0&&!!e.workdir?.trim();return(0,K.jsxs)(`div`,{"data-active":r?`true`:`false`,onPointerEnter:()=>{r||c?.(e.id)},className:`session-card group relative mb-0.5 h-14 w-full rounded-md transition-colors duration-150 ease-panel ${r?`text-ink`:`text-ink-dim hover:text-ink`}`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`absolute left-0 transition-colors ${r?`inset-y-1 w-px bg-blue`:`inset-y-2 w-px bg-transparent group-hover:bg-ink-faint/30`}`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>o(e.id),onFocus:()=>{r||c?.(e.id)},"aria-current":r?`page`:void 0,title:`${m}${!f&&m!==e.id?` · ${e.id}`:``}${e.objective&&e.objective!==m?` — ${e.objective}`:``}`,className:`flex h-14 w-full min-w-0 flex-col justify-center px-2.5 text-left ${y?`pr-[4.75rem]`:`pr-10`}`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(Ze,{ok:e.daemon_alive&&!v,title:v?A(`sidebar.updateRequired`):e.daemon_alive?A(`sidebar.daemonAlive`):A(`sidebar.stopped`)}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:m})]}),(0,K.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5 pl-3.5 text-[11px] text-ink-faint`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate ${v?`text-warn`:``}`,title:a,"data-session-work-state":i?.status.state,children:v?A(`sidebar.updateRequired`):a??(e.daemon_alive?A(`sidebar.runningFor`,{uptime:ut(e.uptime_seconds)}):e.last_active>0?A(`sidebar.lastActive`,{time:H(e.last_active,j)}):A(`sidebar.stopped`))}),_&&(0,K.jsx)(`span`,{title:A(`sidebar.updateAvailableHint`),className:`shrink-0 rounded border border-line px-1 text-[10px] leading-4`,children:A(`sidebar.updateAvailable`)})]})]}),y&&u?(0,K.jsx)(`button`,{type:`button`,disabled:p!=null,onClick:t=>{t.stopPropagation(),u(e.id)},"aria-label":A(`sidebar.resume`),title:A(`sidebar.resumeHint`,{workdir:e.workdir??``}),className:`absolute right-9 top-3 flex h-8 w-8 items-center justify-center rounded-md text-blue opacity-100 hover:bg-blue/10 disabled:opacity-40 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:p===e.id?`…`:(0,K.jsx)(s,{icon:d,className:`h-3 w-3`})}):null,(0,K.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),l(e.id)},"aria-label":A(`sidebar.manage`,{name:m}),title:A(`sidebar.manageHint`),className:`absolute right-1 top-3 flex h-8 w-8 items-center justify-center rounded-md text-ink-faint opacity-100 transition-opacity hover:bg-panel-raised hover:text-ink sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100`,children:(0,K.jsx)(s,{icon:g,className:`h-4 w-4`})})]},e.id)}):null]},e))]}),(0,K.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between border-t border-line/50 px-4 py-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>m(`config`),className:`icon-control flex h-8 w-8 items-center justify-center`,"aria-label":A(`sidebar.openSettings`),title:A(`common.settings`),children:(0,K.jsx)(s,{icon:a,className:`h-3.5 w-3.5`})}),null,(0,K.jsx)(rt,{themeMode:O,onCycleTheme:k})]})]})]})}var Vf=new Set([`done`,`completed`,`failed`,`skipped`]);function Hf(e){return Vf.has(e.status)}function Uf(e,t){return e.filter(e=>Hf(e)===t)}var Wf={in_progress:`rgb(var(--blue))`,running:`rgb(var(--blue))`,pending:`rgb(var(--ink-faint))`,queued:`rgb(var(--ink-faint))`,done:`rgb(var(--blue))`,completed:`rgb(var(--blue))`,blocked:`rgb(var(--err))`,failed:`rgb(var(--err))`};function Gf({items:e,onDispose:t,onStop:n,onInspect:r,busy:i,readOnly:a=!1}){let{t:o}=I(),[s,c]=(0,U.useState)(!1),l=Uf(e,!1),u=Uf(e,!0),d=s?u:l;return(0,K.jsxs)(`section`,{className:`card flex flex-col ${d.length>0?`min-h-0 flex-1`:`shrink-0`}`,children:[(0,K.jsx)(et,{title:o(`panel.backlog`),right:(0,K.jsx)(`button`,{className:`text-[10px] text-ink-faint transition-colors hover:text-ink`,onClick:()=>c(e=>!e),children:o(s?`backlog.active`:`backlog.history`,{count:s?l.length:u.length})})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[d.length===0&&(0,K.jsx)(Ve,{children:o(s?`backlog.noHistory`:`backlog.empty`)}),d.map(e=>{let s=Wf[e.status]??`rgb(var(--ink-faint))`,c=e.iterate;return(0,K.jsx)(`div`,{className:`group border-b border-line/60 px-3 py-2 last:border-0`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>r?.(e.id),disabled:!r,className:`block max-w-full truncate text-left text-xs font-medium text-ink enabled:hover:text-blue-sky enabled:focus-visible:outline-none enabled:focus-visible:underline`,title:r?o(`backlog.viewDetails`):void 0,children:e.title||e.objective}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[(0,K.jsx)(Je,{color:s,children:vn(e.status,o)}),typeof e.priority==`number`&&(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:bn(e.priority,o)}),c&&(0,K.jsxs)(`span`,{className:`text-[10px] text-blue-sky`,children:[`↻ `,o(`backlog.iterating`)]})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100`,children:[!a&&c&&(0,K.jsx)(B,{variant:`ghost`,onClick:()=>n(e.id),disabled:i,title:o(`backlog.stopIterating`),children:o(`backlog.stop`)}),!a&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{variant:`ghost`,onClick:()=>t(e.id,`done`),disabled:i,title:o(`backlog.markDone`),children:`✓`}),(0,K.jsx)(B,{variant:`ghost`,onClick:()=>t(e.id,`rm`),disabled:i,title:o(`backlog.remove`),children:`✕`})]})]})]})},e.id)})]})]})}var Kf={win:`rgb(var(--blue))`,milestone:`rgb(var(--blue))`,insight:`rgb(var(--ink-dim))`,decision:`rgb(var(--ink-dim))`,failure:`rgb(var(--err))`,note:`rgb(var(--ink-faint))`};function qf({entries:e}){let{t}=I(),n=[...e].reverse();return(0,K.jsxs)(`section`,{className:`card flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(et,{title:t(`panel.journal`),right:(0,K.jsx)(`span`,{className:`text-[10px] text-ink-faint`,children:e.length})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scroll-thin`,children:[e.length===0&&(0,K.jsx)(Ve,{children:`no journal entries yet`}),n.map(e=>{let t=Kf[e.kind]??`rgb(var(--ink-faint))`,n=String(e.extra?.pricing_status??``),r=e.extra&&Object.prototype.hasOwnProperty.call(e.extra,`cost_usd`)?e.extra.cost_usd:e.cost_usd,i=typeof r==`number`&&r>0?`${V(r)}${n===`partial`||n===`unpriced`?`+`:``}`:n===`partial`||n===`unpriced`?n:``;return(0,K.jsxs)(`div`,{className:`border-b border-line/60 px-3 py-2 last:border-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full`,style:{background:t}}),(0,K.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide`,style:{color:t},children:e.kind}),(0,K.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:mt(e.ts)})]}),(0,K.jsx)(`div`,{className:`mt-1 text-xs font-medium text-ink`,children:e.title}),e.summary&&(0,K.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-snug text-ink-dim`,children:e.summary}),(0,K.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(e.tags??[]).slice(0,4).map(e=>(0,K.jsx)(`span`,{className:`rounded bg-line/60 px-1 text-[9px] text-ink-faint`,children:e},e)),i?(0,K.jsx)(`span`,{className:`ml-auto text-[10px] text-ink-faint`,children:i}):null]})]},e.id)})]})]})}function Jf(e){return e==null?``:e<3?`now`:e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h`}function Yf({roles:e}){let{t}=I(),n=new Map(e.map(e=>[e.role,e])),r=He.map(e=>n.get(e)).filter(Boolean),i=e.filter(e=>!ot(e.role)),a=[...r,...i];return(0,K.jsxs)(`section`,{className:`card`,children:[(0,K.jsx)(et,{title:t(`panel.roles`)}),(0,K.jsx)(`div`,{children:a.map(e=>{let n=R.role[e.role]??R.info;return(0,K.jsxs)(`div`,{className:`grid grid-cols-[84px_minmax(0,1fr)_auto] items-center gap-2 border-b border-line/60 px-3 py-2 last:border-b-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{"data-role-dot":e.role,"aria-hidden":`true`,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{background:n}}),(0,K.jsx)(`span`,{className:`text-[11px] font-medium capitalize`,style:{color:e.active?n:R.inkDim},children:ot(e.role)?Ae(e.role,t):e.role})]}),(0,K.jsx)(`div`,{className:`min-w-0 truncate font-mono text-[10px] text-ink-faint`,title:e.model,children:e.model||`—`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-right`,children:[(0,K.jsx)(`span`,{className:`text-[10px]`,style:{color:e.active?R.ink:R.inkFaint},children:e.active?e.status||`active`:`idle`}),e.active&&Jf(e.age_s)&&(0,K.jsxs)(`span`,{className:`text-[10px] tabular-nums text-ink-faint`,children:[`· `,Jf(e.age_s)]}),e.effort&&(0,K.jsxs)(`span`,{className:`text-[10px]`,style:{color:ze(e.effort)},children:[`· `,e.effort]})]})]},e.role)})})]})}function Xf({open:e,snap:t,journal:n,busy:r,onClose:i,onDispose:a,onStop:o,onInspect:s}){let{t:c}=I();return(0,K.jsxs)(tt,{open:e,onClose:i,label:`Project inspector`,width:`max-w-6xl`,children:[(0,K.jsx)(Qe,{title:c(`panel.project`),sub:t.session.display_name||t.session.id}),(0,K.jsxs)(`div`,{className:`h-[68vh] min-h-0 space-y-3 overflow-y-auto bg-bg p-3 scroll-thin lg:grid lg:grid-cols-[minmax(0,1.4fr)_minmax(300px,0.8fr)] lg:gap-3 lg:space-y-0 lg:overflow-hidden`,children:[(0,K.jsx)(Gf,{items:t.backlog,onDispose:a,onStop:o,onInspect:s,busy:r}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,K.jsx)(Yf,{roles:t.roles}),(0,K.jsx)(qf,{entries:n})]})]})]})}var Zf=e=>e?new Date(e*1e3).toLocaleString():`—`;function Qf({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`rounded-md border border-line/70 bg-bg/40 px-3 py-2`,children:[(0,K.jsx)(`div`,{className:`text-[9px] font-semibold uppercase tracking-wider text-ink-faint`,children:e}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-ink-dim`,children:t})]})}function $f({sid:e,itemId:t,onClose:n,onDone:r,onSkip:i,onStop:a,busy:o,readOnly:s=!1}){let{t:c}=I(),l=ve(e,t),u=l.data,d=u?Hf(u):!1,f=xn(u?.outcome,c);return(0,K.jsxs)(tt,{open:!!t,onClose:n,label:c(`task.details`),width:`max-w-3xl`,showClose:!1,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3 border-b border-line px-4 py-3 sm:flex-nowrap sm:px-5`,children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`h2`,{className:`truncate text-sm font-semibold text-ink`,children:u?.title||c(`task.details`)}),u?(0,K.jsx)(Je,{children:vn(u.status,c)}):null]})}),!s&&u&&!d?(0,K.jsxs)(`div`,{className:`order-3 flex w-full shrink-0 items-center justify-end gap-1 sm:order-none sm:w-auto`,children:[u.iterate?(0,K.jsx)(B,{onClick:()=>a(u.id),disabled:o,children:c(`task.stopLoop`)}):null,(0,K.jsx)(B,{onClick:()=>r(u.id),disabled:o,children:c(`task.done`)}),(0,K.jsx)(B,{variant:`danger`,onClick:()=>i(u.id),disabled:o,children:c(`task.skip`)})]}):null,(0,K.jsx)(`button`,{type:`button`,"aria-label":c(`task.close`),onClick:n,className:`order-2 rounded-md px-2 py-1 text-lg leading-none text-ink-faint hover:bg-surface hover:text-ink sm:order-none`,children:`×`})]}),(0,K.jsxs)(`div`,{className:`max-h-[70vh] overflow-y-auto p-4 scroll-thin sm:p-5`,children:[l.isLoading?(0,K.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,K.jsx)(Ue,{})}):null,l.isError?(0,K.jsx)(`div`,{className:`rounded-md border border-err/40 bg-err/5 p-3 text-xs text-err`,children:l.error.message}):null,u?(0,K.jsxs)(`div`,{className:`space-y-4`,children:[u.pending_question?(0,K.jsxs)(`div`,{className:`rounded-lg border border-warn/40 bg-warn/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-warn`,children:c(`task.waitingOnYou`)}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm leading-relaxed text-ink`,children:u.pending_question})]}):null,(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.objective`)}),(0,K.jsx)(`div`,{className:`whitespace-pre-wrap rounded-lg border border-line bg-bg/50 p-3 text-sm leading-relaxed text-ink-dim`,children:u.objective||u.original_objective||c(`task.noObjective`)})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[(0,K.jsx)(Qf,{label:c(`task.priority`),value:bn(u.priority,c)}),(0,K.jsx)(Qf,{label:c(`task.started`),value:Zf(u.started_ts)}),(0,K.jsx)(Qf,{label:c(`task.finished`),value:Zf(u.finished_ts)})]}),f.length?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.outcome`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,K.jsx)(Je,{children:e},e))})]}):null,u.iterate||u.iteration_cycles_done||u.iteration_cost_usd?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.iteration`)}),(0,K.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,K.jsx)(Qf,{label:c(`task.mode`),value:u.iterate?c(`task.autoIterate`):c(`task.singlePass`)}),(0,K.jsx)(Qf,{label:c(`task.cycles`),value:`${u.iteration_cycles_done??0}/${u.iteration_max_cycles??`—`}`}),(0,K.jsx)(Qf,{label:c(`task.cost`),value:`$${(u.iteration_cost_usd??0).toFixed(2)}`})]})]}):null,u.last_error?(0,K.jsxs)(`section`,{className:`rounded-lg border border-err/30 bg-err/5 p-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-err`,children:c(`task.lastError`)}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap font-mono text-xs leading-relaxed text-ink-dim`,children:u.last_error})]}):null,u.notes?(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wider text-ink-faint`,children:c(`task.notes`)}),(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-relaxed text-ink-dim`,children:u.notes})]}):null,u.tags?.length||u.deps?.length?(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(u.tags??[]).map(e=>(0,K.jsxs)(Je,{children:[`#`,e]},`tag-${e}`)),u.deps?.length?(0,K.jsx)(Je,{children:c(`task.dependsOnCount`,{count:u.deps.length})}):null]}):null]}):null]})]})}function ep({onPointerDown:e,onReset:t,onNudge:n,value:r,min:i=240,max:a=600,label:o=`Resize panel`}){return(0,K.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":o,"aria-valuenow":r,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:e,onDoubleClick:t,onKeyDown:e=>{e.key===`ArrowLeft`?(e.preventDefault(),n(-16)):e.key===`ArrowRight`?(e.preventDefault(),n(16)):e.key===`Home`&&(e.preventDefault(),t())},className:`group relative hidden w-2 shrink-0 cursor-col-resize items-center justify-center outline-none lg:flex`,children:(0,K.jsx)(`span`,{className:`h-full w-px bg-line/30 transition-colors duration-150 group-hover:bg-blue/70 group-focus:bg-blue/70`})})}var tp=[`handshake.service`,`handshake.project`,`handshake.ready`];function np(){let{t:e}=I(),t=(0,U.useRef)(null);return qe(t,(e,t)=>{if(t){e.set(`[data-handshake-line], [data-handshake-node]`,{opacity:1,scale:1,clearProps:`transform`});return}e.to(`[data-handshake-mark]`,{scale:1.055,duration:.75,ease:`sine.inOut`,repeat:-1,yoyo:!0,transformOrigin:`50% 50%`}),e.timeline({repeat:-1,repeatDelay:.25}).fromTo(`[data-handshake-line]`,{scaleX:0,opacity:.25,transformOrigin:`0% 50%`},{scaleX:1,opacity:.8,duration:.9,ease:`power2.inOut`}).fromTo(`[data-handshake-node]`,{autoAlpha:.25,scale:.72},{autoAlpha:1,scale:1,duration:.28,stagger:.16,ease:`back.out(1.8)`},.12).to(`[data-handshake-node]`,{autoAlpha:.35,duration:.3,stagger:.08},`+=0.35`)}),(0,K.jsxs)(`div`,{ref:t,role:`status`,"aria-label":e(`handshake.connecting`),className:`w-full max-w-xl px-6 text-center`,children:[(0,K.jsx)(`div`,{"data-handshake-mark":!0,className:`handshake-mark glass-card mx-auto flex h-16 w-16 items-center justify-center rounded-3xl text-blue shadow-glow sm:h-20 sm:w-20`,children:(0,K.jsx)(_t,{size:48,className:`text-ink`})}),(0,K.jsxs)(`div`,{className:`relative mx-auto mt-8 h-10 max-w-sm sm:max-w-md`,children:[(0,K.jsx)(`div`,{className:`absolute left-[10%] right-[10%] top-3 h-px bg-line/80`}),(0,K.jsx)(`div`,{"data-handshake-line":!0,className:`handshake-line absolute left-[10%] right-[10%] top-3 h-px`}),(0,K.jsx)(`div`,{className:`relative flex justify-between`,children:tp.map(t=>(0,K.jsxs)(`div`,{className:`flex w-20 flex-col items-center gap-2.5`,children:[(0,K.jsx)(`span`,{"data-handshake-node":!0,className:`handshake-node h-6 w-6 rounded-full border ring-4 ring-bg`,children:(0,K.jsx)(`span`,{className:`m-auto mt-[7px] block h-2 w-2 rounded-full bg-blue`})}),(0,K.jsx)(`span`,{className:`text-xs font-medium text-ink-faint`,children:e(t)})]},t))})]}),(0,K.jsx)(`p`,{className:`mt-9 text-base font-medium text-ink-dim`,children:e(`handshake.title`)}),(0,K.jsx)(`p`,{className:`mt-1.5 text-sm text-ink-faint`,children:e(`handshake.detail`)})]})}function rp({loading:e,hasProjects:t,error:n,onRetry:r,onNew:i,onChoose:a,canCreate:o}){let{t:s,locale:c}=I();return(0,K.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-4 px-6 text-center`,children:[e?(0,K.jsx)(np,{}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h1`,{className:`text-2xl font-semibold text-ink`,children:c===`zh-CN`?t?`继续你的项目`:`开始一个项目`:t?`Continue your work`:`Start a project`}),(0,K.jsx)(`p`,{className:`max-w-md text-sm leading-relaxed ${n?`text-err`:`text-ink-faint`}`,children:n||s(t?`landing.selectOrCreate`:`landing.noSessions`)})]}),!e&&(0,K.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[n?(0,K.jsx)(B,{onClick:r,variant:`danger`,children:s(`common.retry`)}):null,t?(0,K.jsx)(B,{onClick:a,children:s(`landing.select`)}):o?(0,K.jsx)(B,{onClick:i,variant:`primary`,children:s(`landing.new`)}):null,!t&&!n?(0,K.jsx)(`span`,{className:`lg:hidden`,children:(0,K.jsx)(B,{onClick:a,children:s(`landing.menu`)})}):null]})]})}function ip({active:e,onSelect:t,onOpenSessions:n,sidebarOpen:r=!1}){let{t:a}=I(),l=[{id:`map`,label:a(`mobile.map`),icon:p},{id:`activity`,label:a(`mobile.activity`),icon:o},{id:`workbench`,label:a(`mobile.workbench`),icon:i},{id:`preview`,label:a(`mobile.preview`),icon:c}];return(0,K.jsxs)(`nav`,{"aria-label":a(`mobile.views`),className:`mobile-tabbar glass-panel glass-panel--raised fixed inset-x-0 bottom-0 z-40 items-stretch border-t border-line/60 lg:hidden ${r?`hidden`:`flex`}`,children:[n?(0,K.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":a(`topbar.openSessions`),className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 text-ink-faint active:bg-panel-raised`,children:[(0,K.jsx)(s,{icon:h,className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-[10px] leading-none`,children:a(`mobile.sessions`)})]}):null,l.map(n=>{let r=n.id===e;return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),"aria-current":r?`page`:void 0,className:`flex min-h-[3.25rem] flex-1 flex-col items-center justify-center gap-0.5 active:bg-panel-raised ${r?`text-blue`:`text-ink-faint`}`,children:[(0,K.jsx)(s,{icon:n.icon,className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-[10px] leading-none`,children:n.label})]},n.id)})]})}function ap(e,t,n){let r=n?.height??t,i=t-r-(n?.offsetTop??0);return{keyboardInset:i>24?Math.round(i):0,compact:e<1024&&r<=600}}function op(){let[e,t]=(0,U.useState)(()=>typeof window<`u`&&ap(window.innerWidth,window.innerHeight,window.visualViewport).compact);return(0,U.useEffect)(()=>{let e=window.visualViewport,n=document.documentElement,r=null,i=()=>{r!=null&&window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let r=ap(window.innerWidth,window.innerHeight,e);n.style.setProperty(`--keyboard-inset`,`${r.keyboardInset}px`),n.dataset.compactViewport=String(r.compact),t(r.compact)})};return i(),e?.addEventListener(`resize`,i),e?.addEventListener(`scroll`,i),window.addEventListener(`resize`,i),()=>{r!=null&&window.cancelAnimationFrame(r),e?.removeEventListener(`resize`,i),e?.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),n.style.removeProperty(`--keyboard-inset`),delete n.dataset.compactViewport}},[]),e}var sp={[L.LIFE_LIFECYCLE_BLOCK]:`block`,[L.ROUND_REVIEWER_BACKEND_FAILURE]:`block`,[L.LIFE_BUDGET_PAUSE]:`warn`,[L.ROUND_STALL]:`warn`,[L.ROUND_ESCALATED]:`warn`,[L.LIFE_PLANNER_STALL_ESCALATION]:`warn`},cp=new Set([L.BUDGET_RESERVATION_DENIED,L.BUDGET_UNPRICED_BLOCKED]),lp=new Set([L.LIFE_MISSION_STARTED,L.ROUND_MAIN_COMPLETED,L.LIFE_MISSION_COMPLETED,L.LOOP_DONE,L.ROUND_START,`ui.operator`]),up=new Set([L.BUDGET_RESERVATION_CREATED,L.PROVIDER_REQUEST_STARTED]);function dp(e){let t=A(e.canonical_type??e.type);if(e.event_validation?.status===`invalid`)return t===L.ROLE_SESSION_TURN?null:{tone:`warn`,kind:`validation`,text:`invalid event ${t||`unknown`}: ${e.event_validation.errors.join(`; `)}`};if(cp.has(t))return{tone:`block`,kind:`budget`,text:`Budget exhausted or blocked — ${String(e.reason??e.text??t).trim()}`};let n=e.operator_alert===!0?`block`:sp[t];return n?{tone:n,text:String(e.text??e.reason??t).trim()}:null}function fp(e){let t=null;for(let n of e){let e=A(n.canonical_type??n.type),r=dp(n);r?t=r:(t?.kind===`validation`||t?.kind===`budget`&&up.has(e)||t&&t.kind!==`budget`&&lp.has(e))&&(t=null)}return t}async function pp(e,t){let n=Tc(e.trim());if(!n)return{kind:`not-command`};if(!n.cmd){let e=Ec(n.name);return{kind:`error`,message:e?`Unknown command ${n.name}. Did you mean ${e}?`:`Unknown command ${n.name}. Use /help for the full list.`}}if(n.cmd.id===`ask`||n.cmd.id===`crystalpilot`)return{kind:`not-command`};if(_c(n.cmd)&&!n.rest)return{kind:`error`,message:`Usage: ${n.cmd.name}${n.cmd.arg?` ${n.cmd.arg}`:``}`};try{await t[n.cmd.id](n.rest)}catch(e){return{kind:`error`,message:e instanceof Error?e.message:String(e??`Command failed`)}}return{kind:`handled`}}function mp({activeSid:e,activityEventsRef:t,notify:n,onClearEvents:r,onDispose:i,onOpenConfig:a,onOpenDoctor:o,onOpenHelp:s,onOpenIdentity:c,onOpenInspector:l,onOpenNewDaemon:u,onOpenOperations:d,onOpenSidebar:f,onOpenSkills:p,onReconnectEvents:m,onRenameProject:h,onRewriteDraft:g,onSelectProject:_,onSetArtifactPath:v,onSetEventFilter:y,onSetEventQuery:b,onSetTaskItemId:x,onSetWorkspaceView:S,onShowArtifacts:C,onStopIteration:w,onStopWaiting:T,refetchSnapshot:E}){return{status:async()=>l(),roles:async()=>d(),journal:async()=>l(),backlog:async()=>l(),item:async e=>{e&&x(e)},artifacts:async()=>C(),artifact:async e=>{e&&v(e)},events:async e=>{S(`activity`);let{filter:t,query:n}=wc(e);y(t),b(n)},find:async e=>{S(`activity`),y(`all`),b(e)},run:async()=>S(`activity`),clear:async()=>{S(`activity`),y(`all`),b(``),r(t.current.length)},cancel:async()=>T(),task:async t=>{e&&(await F.addTask(e,t),E(),n(`success`,`Task queued.`))},rewrite:async e=>{let t=e.trim();if(!t){n(`info`,`Type your prompt in the composer and press Rewrite, or use /rewrite .`);return}g(t)},plan:async t=>{if(!e)return;let r=await F.previewPlan(e,t);r.error?n(`error`,r.error):n(`info`,r.steps.map(e=>e.title).join(` +`)||`Plan preview ready.`)},nudge:async t=>{e&&(await F.nudge(e,t),n(`success`,`Guidance injected.`))},abort:async t=>{e&&(await F.abortMission(e,t||`operator abort`),n(`info`,`Abort requested.`))},note:async t=>{e&&(await F.note(e,t),n(`success`,`Note appended to timeline.`))},done:async e=>{e&&i(e,`done`)},skip:async e=>{e&&i(e,`rm`)},stop:async e=>{e&&w(e)},new:async()=>u(),daemons:async()=>f(),resume:async e=>{e&&e!==`list`?_(e):f()},attach:async e=>{e&&_(e)},rename:async t=>{!e||!t||await h(t)},doctor:async()=>o(),backend:async t=>{if(!e||!t){a();return}await F.setConfig(e,`runner_backend`,t),n(`success`,`Backend set to ${t}.`)},config:async t=>{if(!e||!t){a();return}let r=t.indexOf(`=`);r>0?(await F.setConfig(e,t.slice(0,r).trim(),t.slice(r+1).trim()),n(`success`,`Config updated.`)):a()},identity:async()=>c(),reset:async()=>{e&&(await F.resetManager(e),n(`success`,`Manager context reset.`))},skills:async t=>{if([``,`ls`,`list`].includes(t.trim().toLowerCase())){p();return}e&&n(`info`,(await F.skills(e,t||`ls`)).slice(0,400))},reconnect:async()=>m(),help:async()=>s(),quit:async()=>n(`info`,`Background work continues; close this browser tab when ready.`)}}function hp(e){return e.kind===`error`?(typeof e.reply==`string`?e.reply.trim():``)||`Manager could not handle this message.`:null}function gp(e,t){e.kind===`task`&&t.dispatchTask(e);let n=hp(e);n&&t.notifyError(n),t.refetchTranscript()}var _p={skipFirst:0,reconnectKey:0};function vp(e,t){return t.kind===`clear`?{...e,skipFirst:Math.max(0,t.offset)}:t.kind===`reconnect`?{skipFirst:0,reconnectKey:e.reconnectKey+1}:{...e,skipFirst:0}}function yp(e,t){if(!t.length)return e;let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return t?{...e,spend_usd:t.spend_usd,known_cost_usd:t.known_cost_usd,spend_status:t.spend_status,usage_calls:t.usage_calls,premium_requests:t.premium_requests,cost_updated_at:t.updated_at}:e})}async function bp(e,t,n,r=``){let i=await e.createDaemon(``,t,r),a=n.trim();return{created:i,startCampaign:a?()=>e.setContinuous(i.sid,!0,a):null}}var xp=e=>e instanceof Error?e.message:String(e||`Unknown error`);function Sp({localCwd:e,notify:t,onFocusComposer:n,queryClient:r,refetchProjects:i,selectProject:a,translate:o}){let[s,c]=(0,U.useState)(!1),l=(0,U.useRef)(!1);return{createDaemon:async(s,u,d)=>{if(l.current)return!1;l.current=!0,c(!0);try{let{created:c,startCampaign:l}=await bp(F,s,u,d),f=String(c.workdir||d||``);return r.setQueryData([`projects`],t=>({local_cwd:t?.local_cwd??e,projects:[{id:c.sid,label:s||c.sid,display_name:s,objective:``,launch_cwd:f,workdir:f,last_active:Date.now()/1e3,daemon_alive:!1,daemon_pid:null,uptime_seconds:null},...(t?.projects??[]).filter(e=>e.id!==c.sid)]})),a(c.sid),i(),window.setTimeout(n,0),t(l?`info`:`success`,l?o?o(`new.createdStarting`):`Session created and selected. Campaign is starting in the background.`:o?o(`new.createdIdle`):`Session created and selected.`),l&&l().then(()=>{r.invalidateQueries({queryKey:[`snapshot`,c.sid]}),i(),t(`success`,`Campaign started.`)}).catch(e=>{t(`error`,`Session was created, but the campaign could not start: ${xp(e)}`)}),!0}catch(e){return t(`error`,`Could not create session: ${xp(e)}`),!1}finally{l.current=!1,c(!1)}},creatingDaemon:s}}var Cp=e=>e instanceof Error?e.message:String(e||`Unknown error`);function wp({actions:e,manageActions:t,manageTargetSid:n,setManageTargetSid:r,activeSid:i,clearProjectSelection:a,continuous:o,notify:s,refetchProjects:c,selectProject:l,setDaemonManageOpen:u}){let d=e.startDaemon.isPending||e.stopDaemon.isPending||e.forceStopDaemon.isPending||t.startDaemon.isPending||t.forceStopDaemon.isPending||t.updateProject.isPending||t.deleteProject.isPending,f=(0,U.useCallback)(e=>({onSuccess:()=>s(`success`,e),onError:e=>s(`error`,Cp(e))}),[s]),p=(0,U.useCallback)(()=>e.startDaemon.mutate(void 0,f(`Daemon start requested.`)),[f,e.startDaemon]),m=(0,U.useCallback)(()=>e.forceStopDaemon.mutate(void 0,f(`Stop requested; the verified daemon process is being interrupted.`)),[f,e.forceStopDaemon]),h=(0,U.useCallback)(async()=>{try{return await t.startDaemon.mutateAsync(),s(`success`,`Daemon resumed.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[t.startDaemon,s]),g=(0,U.useCallback)(async()=>{try{return await t.forceStopDaemon.mutateAsync(),await c(),s(`success`,`Daemon stopped. This session can now be deleted.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[t.forceStopDaemon,s,c]),_=(0,U.useCallback)(async e=>{if(!n)return!1;try{return await t.updateProject.mutateAsync({sid:n,name:e}),s(`success`,`Session name updated.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[t.updateProject,n,s]),v=(0,U.useCallback)(async()=>{if(!n)return!1;try{let e=n,o=await t.deleteProject.mutateAsync();u(!1),r(null);let d=await c();if(e===i){a(`replace`);let e=Vl(d.data?.projects??[])[0];e&&l(e.id,`replace`)}return s(`success`,o.workdir_preserved?`Session moved to recoverable trash. Files remain in ${o.workdir}.`:`Session moved to recoverable trash.`),!0}catch(e){return s(`error`,Cp(e)),!1}},[i,a,t.deleteProject,n,s,c,l,u,r]),y=(0,U.useCallback)(e=>{r(e),u(!0)},[u,r]);return{daemonBusy:d,manageDeleteProject:v,manageStopDaemon:g,manageRenameProject:_,manageStartDaemon:h,requestDispose:(0,U.useCallback)((t,n)=>e.disposeBacklog.mutate({id:t,op:n},{onSuccess:()=>s(`success`,n===`done`?`Work marked done.`:`Work removed.`),onError:e=>s(`error`,Cp(e))}),[e.disposeBacklog,s]),requestManageSession:y,requestStartDaemon:p,requestStopDaemon:m,requestStopIteration:(0,U.useCallback)(t=>e.stopBacklog.mutate(t,{onSuccess:()=>s(`success`,`Iteration stopped.`),onError:e=>s(`error`,Cp(e))}),[e.stopBacklog,s]),toggleContinuous:(0,U.useCallback)(()=>{if(!o)return;let t=!o.enabled;e.setContinuous.mutate({enabled:t,objective:o.objective},f(t?`Continuous campaign enabled.`:`Continuous campaign stopped.`))},[f,e.setContinuous,o])}}function Tp({focusComposer:e,openHelp:t,toggleKiosk:n,togglePalette:r,toggleReasoning:i,toggleSidebarCollapse:a}){(0,U.useEffect)(()=>{let o=o=>{let s=o.target,c=s?.tagName===`INPUT`||s?.tagName===`TEXTAREA`,l=o.metaKey||o.ctrlKey;l&&o.key.toLowerCase()===`k`?(o.preventDefault(),r()):l&&o.key.toLowerCase()===`t`?(o.preventDefault(),i()):l&&o.key===`.`?(o.preventDefault(),n()):l&&o.key.toLowerCase()===`b`?(o.preventDefault(),a()):l&&o.key.toLowerCase()===`j`?(o.preventDefault(),e()):!c&&o.key===`?`?(o.preventDefault(),t()):!c&&o.key===`/`&&(o.preventDefault(),e())};return window.addEventListener(`keydown`,o),()=>window.removeEventListener(`keydown`,o)},[e,t,n,r,i,a])}var Ep=e=>e instanceof Error?e.message:String(e||`Unknown error`),Dp=`argus.decision.prompted.v1`,Op=()=>{try{return window.sessionStorage.getItem(Dp)??``}catch{return``}},kp=e=>{try{window.sessionStorage.setItem(Dp,e)}catch{}};function Ap({activeSid:e,currentTaskId:t,autoOpen:n=!0,backlog:r,notify:i,pendingQuestions:a,refetchSnapshot:o}){let[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(``),p=(0,U.useRef)(!1),m=(0,U.useRef)(``),h=(0,U.useMemo)(()=>{let e=(r??[]).map(e=>({...e,operator_decision:e.operator_decision}));return kr(a??[],e,t)},[r,a,t]),g=h[0]??null,_=r!==void 0||a!==void 0,v=s!==null&&s.sid===e,y=v?{...s.card,is_current_task:t&&s.card.kind!==`domain_intake`?s.card.item_id===t:void 0}:g;return(0,U.useEffect)(()=>{if(s&&(s.sid!==e||_&&!l&&!h.some(e=>e.id===s.card.id))&&c(null),!e||!g||!n&&g.kind!==`domain_intake`||v||l)return;let t=`${e}:${g.id}`;m.current!==t&&Op()!==t&&(m.current=t,kp(t),f(``),c({sid:e,card:g}))},[e,n,h,_,g,s,v,l]),{answerPendingReply:async(t,n)=>{if(!(!e||!y||p.current)){p.current=!0,u(!0),f(``);try{let r=y.kind===`domain_intake`?await F.answerDomain(e,y.id,t,n):y.legacy?await F.answerPending(e,y.item_id,n):await F.resolveDecision(e,y.id,t,n);if(r.resolved===!1||`kind`in r&&[`error`,`cancelled`].includes(String(r.kind))){f(String(r.reply||`Could not send answer.`)),await o();return}c(e=>e===s?null:e),await o(),r.daemon&&Number(r.daemon.rc??0)!==0?i(`error`,`Answer queued, but the daemon did not start: ${r.daemon.error||`operator action required`}`):y.kind!==`domain_intake`&&i(`success`,String(r.reply||`Manager delivered your answer to the team.`))}catch(e){f(Ep(e)),i(`error`,`Could not send answer: ${Ep(e)}`),await o()}finally{p.current=!1,u(!1)}}},pendingReply:y,pendingReplyBusy:l,pendingReplyError:d,pendingReplyOpen:v,setPendingReplyOpen:t=>{f(``),t?e&&g&&c(t=>t?.sid===e?t:{sid:e,card:g}):c(null)}}}var jp=`argus.browser.project.v1`;function Mp(){try{return window.sessionStorage.getItem(jp)}catch{return null}}function Np(e){try{e?window.sessionStorage.setItem(jp,e):window.sessionStorage.removeItem(jp)}catch{}}function Pp(e,t){let n=new URL(window.location.href);e?n.searchParams.set(`project`,e):n.searchParams.delete(`project`);let r=t===`push`?`pushState`:`replaceState`;window.history[r](window.history.state,``,n.toString())}function Fp({cancelActiveMessage:e,notify:t,formatProjectMissing:n,projects:r,projectsError:i,projectsReady:a,queryClient:o,setArtifactPath:s,setSidebarOpen:c,setTaskItemId:l}){let u=(e,t)=>n?n(e,t):t?`Project “${e}” was not found. Switched to ${t}.`:`Project “${e}” was not found. Create a project to continue.`,d=new URLSearchParams(window.location.search),[f,p]=(0,U.useState)(d.get(`project`)||Mp()),m=(0,U.useRef)(f),h=(0,U.useRef)(!1);m.current=f;let g=(0,U.useCallback)(t=>{t!==m.current&&(e(),s(null),l(null)),m.current=t,p(t),Np(t)},[e,s,l]),_=(0,U.useCallback)((e,t=`push`)=>{let n=new URLSearchParams(window.location.search).get(`project`);g(e),n!==e&&Pp(e,t)},[g]),v=(0,U.useCallback)((e=`replace`)=>{let t=new URLSearchParams(window.location.search).get(`project`);g(null),t!=null&&Pp(null,e)},[g]),y=(0,U.useCallback)(e=>{o.prefetchQuery({queryKey:[`snapshot`,e],queryFn:({signal:t})=>F.prefetchSnapshot(e,t),staleTime:3e3})},[o]);return(0,U.useEffect)(()=>{if(!a)return;let e=h.current,n=Wl(r,m.current,e);if(!e&&(h.current=!0,n.id===m.current?Np(n.id):g(n.id),new URLSearchParams(window.location.search).get(`project`)!==n.id&&Pp(n.id,`replace`),n.recovered)){let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}},[g,n,t,r,a]),(0,U.useEffect)(()=>{let e=()=>{let e=new URLSearchParams(window.location.search).get(`project`);if(c(!1),!e){g(null);return}if(!a){g(e);return}let n=Ul(r,e);if(g(n.id),n.recovered){Pp(n.id,`replace`);let e=r.find(e=>e.id===n.id);t(`info`,u(n.requested,e?e.label||e.id:void 0))}};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[g,t,r,a,c]),{activateProject:g,activeSid:a?f&&r.some(e=>e.id===f)?f:null:i?f:null,clearProjectSelection:v,prefetchProject:y,selectProject:_,sid:f,sidRef:m}}var Ip={text:``,attachments:[],revision:0};function Lp(e){let t=(0,U.useRef)(new Map),n=(0,U.useRef)(new Map),r=(0,U.useRef)(0),i=(0,U.useRef)(!0),[,a]=(0,U.useReducer)(e=>e+1,0);(0,U.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]);let o=(0,U.useCallback)((e,n)=>{let o={text:n.text,attachments:[...n.attachments],revision:++r.current};return t.current.set(e,o),i.current&&a(),{sid:e,...o}},[]),s=(0,U.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??Ip;o(e,{...r,text:typeof n==`function`?n(r.text):n})},[o,e]),c=(0,U.useCallback)(n=>{if(!e)return;let r=t.current.get(e)??Ip;o(e,{...r,attachments:typeof n==`function`?n(r.attachments):n})},[o,e]),l=(0,U.useCallback)(e=>{if(!e)return null;let n=t.current.get(e);return n||(n={...Ip,attachments:[],revision:++r.current},t.current.set(e,n)),{sid:e,...n,attachments:[...n.attachments]}},[]),u=(0,U.useCallback)(e=>i.current&&t.current.get(e.sid)?.revision===e.revision,[]),d=(0,U.useCallback)((e,t)=>u(e)?o(e.sid,{text:``,attachments:e.attachments.filter(e=>!t.includes(e))}):null,[u,o]),f=(0,U.useCallback)((e,t)=>e.sid!==t.sid||!u(e)?!1:(o(t.sid,t),!0),[u,o]),p=(0,U.useCallback)(e=>{if(!e||n.current.has(e))return null;let t={...l(e),request:++r.current};return n.current.set(e,t),a(),t},[l]),m=(0,U.useCallback)((e,t)=>{if(n.current.get(e.sid)!==e)return!1;n.current.delete(e.sid);let r=u(e);return r&&t!==void 0?o(e.sid,{...e,text:t}):i.current&&a(),r},[u,o]),h=(0,U.useCallback)(e=>{t.current.delete(e),n.current.delete(e),i.current&&a()},[]);return{draft:(e?t.current.get(e):null)??Ip,rewriting:!!(e&&n.current.has(e)),setText:s,setAttachments:c,capture:l,consume:d,restore:f,beginRewrite:p,finishRewrite:m,drop:h}}function Rp(e,t){if(!t.loadedSid||t.loadedSid!==t.sidRef.current)return null;let n=t.receipts.filter(t=>{let n=sr(t);return n?.deliveryId===e.deliveryId&&n.title===e.title&&n.summary===e.summary&&(!e.path||ql(t).some(t=>t.path===e.path))}),r=!!(t.completionId&&t.completionId===e.deliveryId);return n.length+Number(r)===1?t.loadedSid:null}function zp(e){let t=(0,U.useRef)(e);t.current=e;let n=(0,U.useRef)(null),[r,i]=(0,U.useReducer)(e=>e+1,0),a=(0,U.useCallback)(()=>{n.current?.controller.abort(),n.current=null},[]),o=(0,U.useCallback)((e,r)=>{n.current===e&&(a(),t.current.notify(`error`,`Cannot open notification: ${lt(r)}. No other session was used.`))},[a]);return(0,U.useEffect)(()=>{let e=hr(e=>{a();let r=e.sessionId??Rp(e,t.current);if(!r){t.current.notify(`info`,`This older notification cannot be automatically located. Select its session and open the result manually.`);return}if(!nr(r)){t.current.notify(`error`,`Cannot open notification: invalid session identity.`);return}let s={payload:e,target:null,phase:`resolving`,controller:new AbortController};n.current=s,t.current.queryClient.fetchQuery({queryKey:[`projects`],queryFn:F.projectIndex,staleTime:0}).then(e=>{if(n.current===s){if(!e.projects.some(e=>e.id===r))throw Error(`the target session is unavailable or no longer accessible`);s.target=r,s.phase=`loading`,t.current.selectProject(r),i()}}).catch(e=>o(s,e))});return window.addEventListener(`popstate`,a),()=>{e(),window.removeEventListener(`popstate`,a),a()}},[a,o]),(0,U.useEffect)(()=>{let e=n.current;if(!e?.target)return;let r=t.current;if(r.sidRef.current!==e.target){a();return}if(e.phase!==`loading`)return;if(r.snapshotError){o(e,r.snapshotError);return}if(r.loadedSid!==e.target)return;e.phase=`opening`;let i=e.payload.path;if(!i){n.current=null,r.noPath(),r.notify(`info`,`Notification session opened. This notification does not identify a file.`);return}F.artifact(e.target,i,e.controller.signal).then(r=>{let a=t.current;if(n.current!==e||a.sidRef.current!==e.target||a.loadedSid!==e.target)return;if(!r.exists||r.path!==i)throw Error(`the target file is unavailable`);n.current=null;let o=a.receipts.find(t=>t.delivery_id===e.payload.deliveryId&&ql(t).some(e=>e.path===i));o?a.openDelivery(o,i):a.focusPath(i)}).catch(t=>o(e,t))},[e.selectedSid,e.loadedSid,e.snapshotError,r,a,o]),a}function Bp(e,t,n){let r=n?t+8:56,i=Math.max(320,e-r-360-8);return Math.max(320,Math.min(840,i,Math.round(e*.45)))}var Vp=[`activity`,`workbench`,`map`],Hp=`argus.workspace.view.v3`;function Up(e){return Vp.includes(e)}function Wp(e,t){let n=gt(e);return n==null?t:n===`true`}function Gp(){let e=new URLSearchParams(window.location.search),[t,n]=(0,U.useState)(e.get(`kiosk`)===`1`),[r,i]=(0,U.useState)(()=>Wp(`argus.reasoning.visible.v1`,!1)),[a,o]=(0,U.useState)(()=>{let t=e.get(`view`);if(t===`mission`)return`activity`;if(Up(t))return t;let n=gt(Hp);return Up(n)?n:e.get(`kiosk`)===`1`?`map`:`activity`}),s=(0,U.useCallback)(e=>{ht(Hp,e),o(e)},[]),[c,l]=(0,U.useState)(`activity`),[u,d]=(0,U.useState)(()=>Wp(`argus.preview.expanded.v6`,!1)),[f,p]=(0,U.useState)(()=>{let e=Number(gt(`argus.sidebar.width.v2`)||256);return Number.isFinite(e)?Math.max(220,Math.min(400,e)):256}),[m,h]=(0,U.useState)(()=>{let e=Number(gt(`argus.preview.width.v2`)||440);return Number.isFinite(e)?Math.max(320,Math.min(840,e)):440}),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(()=>Wp(`argus.sidebar.expanded.v4`,!0)),{themeMode:b,themeStyle:x,cycleTheme:S}=yt(),C=(0,U.useRef)(null),w=(0,U.useRef)(null);(0,U.useEffect)(()=>{ht(`argus.sidebar.expanded.v4`,String(v)),ht(`argus.preview.expanded.v6`,String(u)),ht(`argus.sidebar.width.v2`,String(f)),ht(`argus.preview.width.v2`,String(m))},[v,f,u,m]),(0,U.useEffect)(()=>{ht(`argus.reasoning.visible.v1`,String(r))},[r]);let T=(0,U.useCallback)(()=>{d(!0),l(`preview`);let e=C.current?.clientWidth??window.innerWidth;if(e>=1024){let t=Bp(e,f,v);h(e=>Math.max(e,t))}},[v,f]),E=(0,U.useCallback)((e,t)=>{let n=C.current;if(!n)return;t.preventDefault();let r=n.getBoundingClientRect(),i=e===`left`?f:m;n.dataset.resizing=e,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let a=t=>{if(e===`left`){let e=u?m+8:0,n=Math.max(220,Math.min(400,r.width-e-360-8));i=Math.max(220,Math.min(n,t.clientX-r.left))}else{let e=v?f+8:56,n=Math.max(320,Math.min(840,r.width-e-360-8));i=Math.max(320,Math.min(n,r.right-t.clientX))}w.current??=window.requestAnimationFrame(()=>{n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),w.current=null})},o=()=>{w.current!=null&&window.cancelAnimationFrame(w.current),w.current=null,n.style.setProperty(e===`left`?`--sidebar-width`:`--preview-width`,`${i}px`),e===`left`?p(i):h(i),delete n.dataset.resizing,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o,{once:!0}),window.addEventListener(`pointercancel`,o,{once:!0})},[v,f,u,m]);return(0,U.useEffect)(()=>{let e=()=>{if(window.innerWidth<1024||!C.current)return;let e=C.current.clientWidth,t=v?f:56,n=u?m:0,r=(v?8:0)+(u?8:0),i=Math.max(540,e-360-r);if(t+n<=i)return;let a=u?Math.max(320,Math.min(m,i-t)):n,o=v?Math.max(220,Math.min(f,i-a)):t;o+a>i&&u&&(a=Math.max(320,i-o)),v&&p(o),u&&h(a)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[v,f,u,m]),{cycleTheme:S,kiosk:t,leftPanelOpen:v,leftWidth:f,mobileView:c,openPreview:T,resizeSidebar:E,rightPanelOpen:u,rightWidth:m,setKiosk:n,setLeftPanelOpen:y,setLeftWidth:p,setMobileView:l,setRightPanelOpen:d,setRightWidth:h,setShowReasoning:i,setSidebarOpen:_,setWorkspaceView:s,shellRef:C,showReasoning:r,sidebarOpen:g,themeMode:b,themeStyle:x,workspaceView:a}}function Kp(e){let t=e.trim();if(!t||/\s/.test(t))return``;if(!t.includes(`?`)&&!t.includes(`://`))return t;try{return new URL(t,window.location.href).searchParams.get(`token`)?.trim()??``}catch{return``}}function qp(e){try{let t=new URL(window.location.href),n=new URL(e.trim(),t);return n.origin===t.origin&&/^\/pair\/[\w-]{32}$/.test(n.pathname)?n.toString():``}catch{return``}}function Jp({error:e,onRetry:t}){let{t:n}=I(),r=ee(e),i=e instanceof E,[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``);return!r&&!i?null:(0,K.jsxs)(`div`,{role:`alert`,className:`fixed left-1/2 top-3 z-[100] flex w-[min(92vw,42rem)] -translate-x-1/2 flex-wrap items-start gap-3 rounded-xl border border-err/50 bg-panel/95 px-4 py-3 text-left text-sm text-ink shadow-xl backdrop-blur`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 font-mono font-bold text-err`,children:`!`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`strong`,{className:`block text-err`,children:n(r?`connection.pairingTitle`:`connection.unreachableTitle`)}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-ink-dim`,children:n(r?`connection.pairingDetail`:`connection.unreachableDetail`)})]}),r&&!a?(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`shrink-0 rounded-md border border-blue/45 bg-blue/10 px-2.5 py-1 text-xs font-medium text-blue hover:bg-blue/15`,children:n(`connection.pairAgain`)}):r?null:(0,K.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded-md border border-err/40 px-2.5 py-1 text-xs text-err hover:bg-err/10`,children:n(`common.retry`)}),r&&a?(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=qp(s);if(t){window.location.replace(t);return}let r=Kp(s);if(!r){u(n(`connection.pairingInvalid`));return}let i=new URL(window.location.href);i.searchParams.set(`token`,r),window.location.replace(i.toString())},className:`flex w-full basis-full flex-wrap gap-2 pl-7`,children:[(0,K.jsx)(`label`,{className:`sr-only`,htmlFor:`pairing-link`,children:n(`connection.pairingInput`)}),(0,K.jsx)(`input`,{id:`pairing-link`,"data-autofocus":!0,type:`password`,autoComplete:`off`,value:s,onChange:e=>{c(e.target.value),u(``)},placeholder:n(`connection.pairingPlaceholder`),className:`h-9 min-w-0 flex-1 rounded-md border border-line bg-bg px-3 text-xs text-ink outline-none focus:border-blue`}),(0,K.jsx)(`button`,{type:`submit`,className:`h-9 rounded-md border border-blue/35 bg-blue/8 px-3 text-xs font-medium text-blue hover:border-blue-deep hover:bg-blue-deep hover:text-white`,children:n(`connection.connect`)}),l?(0,K.jsx)(`span`,{role:`alert`,className:`w-full text-xs text-err`,children:l}):null]}):null]})}function Yp(e){try{let t=JSON.parse(gt(e)||`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Xp(e,t,n,r=!0){let i=(0,U.useRef)(),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(null),l=(0,U.useCallback)(t=>{if(!e)return;let n=`argus.delivery.seen.v1:${e}`;ht(n,JSON.stringify([...new Set([...Yp(n),t])].slice(-80)))},[e]),u=(0,U.useCallback)((t,n)=>{if(!e)return;l(t.delivery_id);let r=ql(t),i=r.find(e=>e.path===n)?.path||r[0]?.path||null;o({sid:e,receipt:t,path:i}),c(null)},[e,l]);return(0,U.useEffect)(()=>{if(!e||!t)return;let a=n?.delivery_id;if(i.current?.sid!==e){i.current={sid:e,ids:new Set(a?[a]:[])},o(null),c(null);return}!a||i.current.ids.has(a)||!r||(i.current.ids.add(a),n&&ql(n).length&&!Yp(`argus.delivery.seen.v1:${e}`).includes(a)&&c({sid:e,receipt:n}))},[e,t,n,r]),{selection:a?.sid===e?a:null,open:u,fresh:s?.sid===e?s.receipt:null,dismissFresh:(0,U.useCallback)(()=>c(null),[]),close:(0,U.useCallback)(()=>o(null),[]),selectPath:(0,U.useCallback)(e=>o(t=>t&&{...t,path:e}),[])}}var Zp=e({default:()=>nm}),Qp=0,$p=(0,U.lazy)(async()=>({default:(await Se(()=>import(`./ResearchWorkbenchPanel-BmPuH7pM.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)).ResearchWorkbenchPanel})),em=(0,U.lazy)(async()=>({default:(await Se(()=>import(`./MapPanel-C4kGIk-g.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,15,10,16,12,17]),import.meta.url)).MapPanel}));function tm(e,t){let[n,r]=(0,U.useState)(e),i=(0,U.useRef)(e),a=(0,U.useRef)(null),o=(0,U.useRef)(0);return i.current=e,(0,U.useEffect)(()=>{if(e===n)return;let s=o.current+t-Date.now();if(s<=0){o.current=Date.now(),r(e);return}a.current||=setTimeout(()=>{a.current=null,o.current=Date.now(),r(i.current)},s)},[e,n,t]),(0,U.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),n}function nm(){let{locale:e,t}=I(),n=e=>e instanceof pe?t(`connection.pairingDetail`):lt(e),r=S(),i=ge(),a=ye(),o=(0,U.useMemo)(()=>Vl(yp(i.data?.projects??[],a.data?.projects??[])),[a.data?.projects,i.data?.projects]),s=i.data?.local_cwd??``,c=[i.error,a.error].find(e=>ne(e)),[l,u]=(0,U.useState)(`none`),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(`feed`),h=(0,U.useCallback)(e=>{f(null),m(e),u(`learning`)},[]),g=(0,U.useCallback)((e,t=`recent`)=>{f(e?{kind:`skill`,item:e}:null),m(e?.scope??(t===`recent`?`feed`:t)),u(`learning`)},[]),_=(0,U.useCallback)(e=>{f(e?{kind:`knowledge`,item:e}:null),m(e?.scope===`private`?`global`:e?.scope??`feed`),u(`learning`)},[]),{cycleTheme:v,kiosk:y,leftPanelOpen:b,leftWidth:x,mobileView:C,openPreview:w,resizeSidebar:T,rightPanelOpen:E,rightWidth:D,setKiosk:O,setLeftPanelOpen:k,setLeftWidth:A,setMobileView:j,setRightPanelOpen:M,setRightWidth:N,setShowReasoning:ee,setSidebarOpen:P,setWorkspaceView:te,shellRef:re,showReasoning:L,sidebarOpen:ie,themeMode:oe,workspaceView:se}=Gp(),[ue,fe]=(0,U.useState)(se===`workbench`),[me,ve]=(0,U.useState)(0),xe=(0,U.useCallback)(()=>{u(`none`),j(`activity`),te(`workbench`),ve(e=>e+1)},[j,te]);(0,U.useEffect)(()=>{se===`workbench`&&fe(!0)},[se]);let Se=op(),[Ce,we]=(0,U.useState)(0),[Te,Ee]=(0,U.useState)(0),[De,ke]=(0,U.useState)(`auto`),[Ae,je]=(0,U.useState)(!1),[R,Me]=(0,U.useState)([]),Ne=(0,U.useRef)(null),[z,Pe]=(0,U.useState)([]),[Fe,Ie]=(0,U.useState)(null),[Le,Re]=(0,U.useState)({path:``,token:0}),[ze,Be]=(0,U.useState)(null),[Ve,He]=(0,U.useState)(!1),[Ue,Ge]=(0,U.useState)(null),[Ke,qe]=(0,U.useState)(null),Je=(0,U.useRef)(!1),Ye=(0,U.useRef)(null),Xe=(0,U.useRef)(0),Ze=(0,U.useRef)(),Qe=(0,U.useRef)({sid:``,completionId:``,view:null,artifacts:[]}),$e=(0,U.useRef)(()=>void 0),[et,B]=(0,U.useState)(null),[nt,rt]=(0,U.useReducer)(vp,_p),[it,at]=(0,U.useState)(`all`),[ot,st]=(0,U.useState)(``),ct=(0,U.useCallback)(()=>B(null),[]),V=(0,U.useCallback)((e,t)=>{B({id:++Qp,tone:e,message:t})},[]),ut=(0,U.useCallback)(()=>{let e=!!Ye.current;return Xe.current+=1,Ye.current?.controller.abort(),Ye.current=null,je(!1),Pe([]),e},[]),dt=(0,U.useCallback)(()=>{let e=Ye.current;if(!e||!ut())return;let n=Xe.current;V(`info`,t(`chat.stoppingReply`)),F.cancelMessage(e.sid,e.serverRequestId).then(e=>{Xe.current===n&&V(`info`,t(e.requested?`chat.stopReplyRequested`:`chat.replyAlreadyFinished`))}).catch(e=>{Xe.current===n&&V(`error`,t(`chat.stopReplyFailed`,{error:lt(e)}))})},[ut,V,t]),{activeSid:H,clearProjectSelection:ft,prefetchProject:mt,selectProject:ht,sid:gt,sidRef:_t}=Fp({cancelActiveMessage:ut,notify:V,formatProjectMissing:(e,n)=>n?t(`project.missingSwitched`,{requested:e??``,fallback:n}):t(`project.missingCreate`,{requested:e??``}),projects:o,projectsError:i.isError,projectsReady:i.isSuccess,queryClient:r,setArtifactPath:Ie,setSidebarOpen:P,setTaskItemId:Be}),{draft:{text:vt,attachments:yt},rewriting:bt,setText:xt,setAttachments:Et,capture:Ot,consume:kt,restore:At,beginRewrite:jt,finishRewrite:Mt,drop:Nt}=Lp(gt),Pt=(0,U.useCallback)((e,t)=>{$e.current(),ht(e,t)},[ht]),Ft=(0,U.useCallback)(e=>{$e.current(),ft(e)},[ft]);(0,U.useEffect)(()=>ke(`auto`),[H]),(0,U.useEffect)(()=>{Re(e=>e.path?{path:``,token:e.token+1}:e)},[gt]),(0,U.useEffect)(()=>()=>{Xe.current+=1,Ye.current?.controller.abort(),Ye.current=null},[]),(0,U.useEffect)(()=>_r(),[]);let It=(0,U.useCallback)(e=>{let t=(e||``).trim(),n=_t.current;if(!t||!n)return;let r=jt(n);r&&F.rewritePrompt(n,t).then(e=>{if(e.error||!e.rewritten.trim()){Mt(r)&&_t.current===n&&V(`error`,`Rewrite failed: ${e.error||`empty rewrite`} — your prompt is unchanged`);return}if(!Mt(r,e.rewritten)||_t.current!==n)return;we(e=>e+1);let t=e.questions.length?` Manager asks: ${e.questions.join(` · `)}`:``;V(`success`,`Prompt rewritten — review it, then send.${t}`)},e=>{Mt(r)&&_t.current===n&&V(`error`,`Rewrite failed: ${lt(e)} — your prompt is unchanged`)})},[jt,Mt,V,_t]),{createDaemon:Lt,creatingDaemon:Rt}=Sp({localCwd:s,notify:V,onFocusComposer:()=>we(e=>e+1),queryClient:r,refetchProjects:i.refetch,selectProject:Pt,translate:t}),zt=(0,U.useCallback)(()=>{Lt(``,``,``)},[Lt]),Bt=(0,U.useRef)(zt);Bt.current=zt,(0,U.useEffect)(()=>gr(()=>Bt.current()),[]);let Vt=de(H),Ht=de(Ue),W=Vt.data,G=W?.session.id===H?H:null,Ut=W?.continuous,Wt=ae(G,!0),{events:Gt,connected:Kt}=he(G,nt.reconnectKey),qt=(0,U.useMemo)(()=>_e(Gt),[Gt]),Jt=(0,U.useMemo)(()=>be(Gt),[Gt]);(0,U.useEffect)(()=>{if(!G||!qt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`artifacts`,G],exact:!0})},180);return()=>window.clearTimeout(e)},[qt,G,r]),(0,U.useEffect)(()=>{if(!G||!Jt)return;let e=window.setTimeout(()=>{r.invalidateQueries({queryKey:[`snapshot`,G],exact:!0})},80);return()=>window.clearTimeout(e)},[G,r,Jt]);let Yt=(0,U.useMemo)(()=>fp(Gt),[Gt]),{query:Xt,events:Zt,status:Qt}=Dt(G,!0,Gt,R,Ne.current),$t=G&&W?.manager_requests?.filter(e=>e.status===`running`).at(-1)?.request_id||``,en=Ae||!!$t;(0,U.useEffect)(()=>{if(!G)return;let e=Ye.current;if($t){e||(Ye.current={id:++Xe.current,serverRequestId:$t,sid:G,controller:new AbortController,recovered:!0},je(!0));return}e?.recovered&&e.sid===G&&(Ye.current=null,je(!1),Pe([]),Xt.refetch())},[$t,G,Xt.refetch]);let tn=ce(H,20,l===`inspector`),nn=tm((0,U.useMemo)(()=>({sid:G,events:Gt,conversation:Zt}),[G,Gt,Zt]),250),rn=nn.sid===G?nn.events:[],an=nn.sid===G?nn.conversation:[],on=(0,U.useMemo)(()=>W?bd(W,Zt,Wt.data??[]):null,[Zt,Wt.data,W]),{answerPendingReply:sn,pendingReply:cn,pendingReplyBusy:ln,pendingReplyError:un,pendingReplyOpen:dn,setPendingReplyOpen:fn}=Ap({activeSid:H,currentTaskId:on?.mission.id,autoOpen:se!==`map`,backlog:W?.backlog,notify:V,pendingQuestions:W?.pending_questions,refetchSnapshot:Vt.refetch}),pn=W?.daemon.alive&&on?.routing.vertical===`research`?on.active_role.startsWith(`reviewer`)?`reviewing`:on.active_role.startsWith(`engineer`)?`revising`:void 0:void 0,mn=Xl((0,U.useMemo)(()=>cc(Zt),[Zt]),on?.delivery??null,Zt),hn=W?.backlog.some(e=>[`pending`,`running`,`in_progress`,`claimed`].includes(e.status))??!1,gn=Ed(on)&&!hn&&!W?.continuous?.enabled,_n=G&&gn&&on?.mission.id?`completion:${G}:${on.mission.id}`:``;Qe.current={sid:G||``,completionId:_n,view:on,artifacts:Wt.data??[]};let vn=(0,U.useCallback)(()=>{w()},[w]),yn=(0,U.useCallback)((e,t=!0)=>{let n=e.trim();if(!n){t&&te(`map`);return}if(se===`map`||!Wt.data?.some(e=>e.path===n&&e.exists)){Ie(n);return}M(!0),j(`preview`),Re(e=>({path:n,token:e.token+1}))},[Wt.data,j,M,te,se]),bn=Xp(G,!!W&&!Xt.isPending,mn,!Fe&&!Zl(W?.backlog??[],mn?.item_id)),xn=bn.open,Sn=(0,U.useMemo)(()=>{let e=new Map;for(let t of Zt){let n=t.delivery;n?.delivery_id&&Array.isArray(n.targets)&&e.set(n.delivery_id,n)}for(let t of[on?.delivery,mn])t&&e.set(t.delivery_id,t);return[...e.values()].filter(e=>ql(e).length).sort((e,t)=>t.delivered_at-e.delivered_at)},[Zt,on?.delivery,mn]);(0,U.useEffect)(()=>{G&&mn?.delivery_id&&r.invalidateQueries({queryKey:[`artifacts`,G],exact:!0})},[G,mn?.delivery_id,r]),(0,U.useEffect)(()=>{if(!G)return;let e=Ze.current;if(!e||e.sid!==G){Ze.current={sid:G,id:_n||null};return}if(!_n){Ze.current={sid:G,id:null};return}if(e.id===_n)return;let n=window.setTimeout(()=>{let e=Qe.current;if(e.sid!==G||e.completionId!==_n||!e.view)return;let n=e.view.delivery,r=jd(e.artifacts),i=or({completionId:_n,sessionId:G,title:n?.title||e.view.mission.title||t(`mission.taskCompleted`),summary:n?.summary||e.view.mission.summary,path:n?.primary_target?.path||r?.path});i&&fr(i),Ze.current={sid:G,id:_n}},500);return()=>window.clearTimeout(n)},[_n,G,t]),$e.current=zp({selectedSid:gt,loadedSid:G,sidRef:_t,snapshotError:Vt.error,queryClient:r,receipts:Xt.isPending?[]:Sn,completionId:_n,selectProject:e=>{ht(e),P(!1)},openDelivery:xn,focusPath:e=>{Wt.data?.some(t=>t.path===e&&t.exists)?yn(e):Ie(e)},noPath:()=>{j(`activity`),te(`map`)},notify:V});let Cn=(0,U.useRef)(Zt);Cn.current=Zt,(0,U.useEffect)(()=>{at(`all`),st(``),Me([]),rt({kind:`reset`})},[G]);let wn=le(H,W?.daemon_commands?.revision),Tn=le(Ue,Ht.data?.daemon_commands?.revision),En=(0,U.useCallback)(async e=>{qe(e);try{await F.startDaemon(e),await i.refetch(),V(`success`,t(`sidebar.resumeSuccess`))}catch(e){V(`error`,t(`sidebar.resumeFailed`,{error:lt(e)}))}finally{qe(null)}},[V,i,t]),{daemonBusy:Dn,manageDeleteProject:On,manageStopDaemon:kn,manageRenameProject:An,manageStartDaemon:jn,requestDispose:Mn,requestManageSession:Nn,requestStartDaemon:Pn,requestStopDaemon:In,requestStopIteration:Ln,toggleContinuous:Rn}=wp({actions:wn,manageActions:Tn,manageTargetSid:Ue,setManageTargetSid:Ge,activeSid:H,clearProjectSelection:Ft,continuous:Ut,notify:V,refetchProjects:i.refetch,selectProject:Pt,setDaemonManageOpen:He}),zn=(0,U.useCallback)(async e=>{if(!H)return;let t=await wn.updateProject.mutateAsync({sid:H,name:e});V(`success`,`Renamed to "${t.name}".`)},[wn.updateProject,H,V]),Bn=(0,U.useMemo)(()=>mp({activeSid:H,activityEventsRef:Cn,notify:V,onClearEvents:e=>rt({kind:`clear`,offset:e}),onDispose:Mn,onOpenConfig:()=>u(`config`),onOpenDoctor:()=>u(`doctor`),onOpenHelp:()=>u(`help`),onOpenIdentity:()=>u(`identity`),onOpenInspector:()=>u(`inspector`),onOpenNewDaemon:zt,onOpenOperations:xe,onOpenSidebar:()=>P(!0),onOpenSkills:()=>g(void 0,`global`),onReconnectEvents:()=>rt({kind:`reconnect`}),onRenameProject:zn,onRewriteDraft:It,onSelectProject:Pt,onSetArtifactPath:Ie,onSetEventFilter:at,onSetEventQuery:st,onSetTaskItemId:Be,onSetWorkspaceView:te,onShowArtifacts:vn,onStopIteration:Ln,onStopWaiting:dt,refetchSnapshot:Vt.refetch}),[H,V,vn,g,xe,zn,Mn,Ln,It,Pt,Vt.refetch,dt,te]);Tp({focusComposer:()=>we(e=>e+1),openHelp:()=>u(`help`),toggleKiosk:()=>O(e=>!e),togglePalette:()=>u(e=>e===`palette`?`none`:`palette`),toggleReasoning:()=>ee(e=>!e),toggleSidebarCollapse:()=>k(e=>!e)});let Vn=async(e,n=[],i)=>{let a=H;if(!a||a!==_t.current||Je.current||Ye.current)return!1;let o=Xe.current;Je.current=!0;let s,c,l;try{if(!n.length){let t=await pp(e,Bn);if(t.kind===`handled`)return i?.({type:`settled`,outcome:`message`}),!0;if(t.kind===`error`)return V(`error`,t.message),!1}if(_t.current!==a||Xe.current!==o)return!1;s=++Xe.current,c=Oe(),l=new AbortController,Ye.current={id:s,serverRequestId:c,sid:a,controller:l}}finally{Je.current=!1}let u=()=>{let e=Ye.current;return!!(e&&e.id===s&&e.sid===a&&_t.current===a&&!l.signal.aborted)},d=()=>{Ye.current?.id===s&&(Ye.current=null,je(!1),Pe([]))};je(!0),Pe([]);let f=[];if(n.length)try{let e=await F.uploadAttachments(a,n,l.signal);if(!u())return!1;f=e.attachments.map(e=>({attachment_id:e.attachment_id}))}catch(e){return u()&&(V(`error`,t(`chat.attachmentUploadFailed`,{error:lt(e)})),d()),!1}let p=Ne.current===a;Ne.current=a,Me(t=>St([...p?t:[],wt(a,s,e)],a,s,[]));let m=(e,t=``,n=`auto`)=>{!u()||typeof e!=`string`||!e.trim()||Me(r=>Tt(r,a,s,e,t,Date.now(),n))},h=e=>{if(!u())return;let t=e.item;typeof t?.id==`string`&&i?.({type:`task`,taskId:t.id});let n=e.daemon&&typeof e.daemon==`object`?e.daemon:null,r=typeof e.reply==`string`?e.reply:null;n?.admission_required?V(`error`,r||`Task queued, but all daemon slots are busy: ${String(n.error||`operator action required`)}`):n&&Number(n.rc??0)!==0?V(`error`,r||`Task queued, but executor did not start: ${String(n.error||`unknown error`)}`):r&&!i&&V(`success`,r),Vt.refetch?.()},g=e=>{u()&&(r.invalidateQueries({queryKey:[`artifacts`,a]}),gp(e,{dispatchTask:h,notifyError:e=>V(`error`,e),refetchTranscript:()=>{Xt.refetch()}}))};return(async()=>{let t=!1,n=null,r=[];try{try{await F.messageStream(a,e,{onPhase:(e,t,n)=>{if(!u()||n.heartbeat)return;r=ro(r,{label:e,role:t,kind:n.kind,detail:n.detail,heartbeat:n.heartbeat,quietS:n.quietS,tool:n.tool,toolKind:n.toolKind,callId:n.callId,status:n.status,output:n.output}),Pe(r);let i=oo(r);i.length&&Me(e=>St(e,a,s,i,Date.now(),!0))},onDelta:(e,n,r)=>{u()&&(t=!0,m(e,n,r===`append`||r===`snapshot`?r:`auto`))},onDone:e=>{if(!u())return;e.kind!==`error`&&ke(`auto`),r=io(r),Pe(r);let t=lo(e.steps),n=t.length?t:oo(r,Date.now()/1e3,!0);Me(t=>St(t,a,s,n,Date.now(),!1,e.kind===`error`?`failed`:`completed`)),m(e.reply,``,`snapshot`),g(e);let o=e.item;(e.kind!==`task`||typeof o?.id!=`string`)&&i?.({type:`settled`,outcome:e.kind===`error`?`error`:`message`})},onError:e=>{u()&&(n=e)}},{signal:l.signal,attachments:f,routeOverride:De,requestId:c})}catch(e){u()&&(n=e)}if(!u())return;n&&(V(`error`,pt(n,t)),i?.({type:`settled`,outcome:`error`}))}finally{Me(e=>Ct(e,s,Date.now(),n&&!l.signal.aborted?`failed`:`stopped`)),l.signal.aborted&&i?.({type:`settled`,outcome:`cancelled`}),d()}})(),!0},Hn=(0,U.useRef)(Vn);Hn.current=Vn;let Un=async(e,t=[],n,r)=>{let i=Ot(_t.current);if(!i)return!1;if(r?.whileRunning){try{if(!t.length){let n=await pp(e,Bn);if(n.kind===`error`)return V(`error`,n.message),!1;if(n.kind===`handled`)return kt(i,t),!0}await F.queueFollowup(i.sid,e,De)}catch(e){return V(`error`,lt(e)),!1}return kt(i,t),!0}let a=null,o=!1,s=!t.length&&Tc(e.trim())?.cmd?.id===`rewrite`,c=await Vn(e,t,e=>{e.type===`settled`&&e.outcome===`error`&&(o=!0,a&&At(a,i)),_t.current===i.sid&&n?.(e)});return c&&!o&&!s&&(a=kt(i,t)),c},Wn=(0,U.useMemo)(()=>{let n=al(hc,e=>{Hn.current(e)},e=>{xt(e),we(e=>e+1)},e),r=[...y?[]:[{id:`new`,label:t(`palette.newDaemon`),hint:`+`,group:t(`palette.view`),run:zt}],{id:`transcript`,label:t(`palette.openTranscript`),hint:`/transcript`,group:t(`palette.view`),run:()=>u(`transcript`)},{id:`inspector`,label:t(`palette.openProject`),hint:t(`palette.projectHint`),group:t(`palette.view`),run:()=>u(`inspector`)},{id:`operations`,label:t(`palette.openOperations`),hint:t(`palette.operationsHint`),group:t(`palette.view`),run:xe},{id:`verticals`,label:t(`verticals.openStore`),hint:t(`verticals.paletteHint`),group:t(`palette.view`),run:()=>u(`verticals`)},{id:`help`,label:t(`help.title`),hint:`?`,group:t(`palette.view`),run:()=>u(`help`)},{id:`reasoning`,label:t(L?`palette.hideReasoning`:`palette.showReasoning`),hint:`⌘T`,group:t(`palette.view`),run:()=>ee(e=>!e)},{id:`kiosk`,label:t(y?`palette.exitKiosk`:`palette.enterKiosk`),hint:`⌘.`,group:t(`palette.view`),run:()=>O(e=>!e)}],i=y?[]:[{id:`message`,label:t(`palette.messageArgus`),hint:`/`,group:t(`palette.action`),run:()=>we(e=>e+1)},...en?[{id:`cancel-message`,label:t(`palette.stopWaiting`),hint:`Esc`,group:t(`palette.action`),run:dt}]:[],...Ut?[{id:`continuous`,label:Ut.enabled?t(`palette.stopContinuous`):t(`palette.startContinuous`),group:t(`palette.action`),run:Rn}]:[],...W?.daemon.control_available===!1?[]:[W?.daemon.alive?{id:`stop`,label:t(`palette.stopDaemon`),group:t(`palette.action`),run:In}:{id:`start`,label:t(`palette.startDaemon`),group:t(`palette.action`),run:Pn}]],a=o.map(e=>({id:`p-${e.id}`,label:Bl(e)?(e.label||e.display_name||``).trim():e.objective.trim()||t(`sidebar.unnamedSession`),hint:e.daemon_alive?`● ${t(`common.live`)}`:`○`,keywords:`${e.id} ${e.display_name??``} ${e.objective} ${e.daemon_alive?`live running`:`stopped idle`}`,group:t(`palette.project`),run:()=>Pt(e.id)}));return[...r,...i,...n,...a]},[o,W?.daemon.alive,y,L,Ut?.enabled,en,dt,xt,e,t]);return(0,K.jsx)(id,{sid:H,readOnly:y,children:(0,K.jsxs)(We,{ref:re,style:{"--sidebar-width":`${x}px`,"--preview-width":`${D}px`},children:[(0,K.jsx)(Jp,{error:c,onRetry:()=>{i.refetch(),a.refetch()}}),bn.fresh&&!bn.selection&&(0,K.jsxs)(`div`,{className:`delivery-toast`,role:`status`,"aria-live":`polite`,children:[(0,K.jsxs)(`span`,{children:[e===`zh-CN`?`新交付:`:`New delivery: `,bn.fresh.title]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>xn(bn.fresh),children:e===`zh-CN`?`查看`:`Open`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":e===`zh-CN`?`关闭`:`Dismiss`,onClick:bn.dismissFresh,children:`×`})]}),bn.selection&&(0,K.jsx)(bu,{sid:bn.selection.sid,path:bn.selection.path,delivery:bn.selection.receipt,deliveries:Sn,reviewActivity:bn.selection.sid===G?pn:void 0,onSelectDelivery:xn,onSelectPath:bn.selectPath,onClose:bn.close},`${bn.selection.sid}:${bn.selection.receipt.delivery_id}`),!y&&ie?(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`common.closeSessions`),onClick:()=>P(!1),className:`fixed inset-0 z-30 bg-black/40 lg:hidden`}):null,y?null:(0,K.jsx)(Bf,{projects:o,activeId:H,activeWork:G?{sessionId:G,status:Vr(W,on,Zt),connected:Kt&&!Vt.isError}:void 0,localCwd:s,onSelect:e=>{Pt(e),P(!1)},onPrefetch:mt,onManage:Nn,onResume:e=>void En(e),resumingId:Ke,onOpenPanel:e=>u(e),onOpenLearning:h,onOpenVerticals:()=>u(`verticals`),onNew:zt,loading:i.isLoading,creating:Rt,error:i.isError?lt(i.error):void 0,onRetry:()=>void i.refetch(),mobileOpen:ie,collapsed:!b,onToggleCollapse:()=>k(e=>!e),themeMode:oe,onCycleTheme:v}),!y&&b?(0,K.jsx)(ep,{label:t(`common.resizeSessions`),value:x,min:220,max:400,onPointerDown:e=>T(`left`,e),onReset:()=>A(256),onNudge:e=>A(t=>Math.max(220,Math.min(400,t+e)))}):null,(0,K.jsx)(`main`,{className:`flex min-w-0 flex-1 overflow-x-hidden`,children:W?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`${C===`activity`?`flex`:`hidden`} ${se===`map`&&!y?`mobile-scroll-region`:``} glass-panel glass-panel--main h-full min-w-0 flex-1 flex-col lg:flex`,children:[(0,K.jsx)(zl,{sid:G}),se!==`map`&&(0,K.jsx)(ri,{events:Zt,snap:W,streamOk:Kt,onStart:Pn,onStop:In,onManage:()=>H&&Nn(H),busy:Dn,snapshotStale:Vt.isError,readOnly:y,missionView:on}),(0,K.jsxs)(`nav`,{"aria-label":t(`mobile.views`),className:`hidden h-11 shrink-0 items-center gap-3 border-b border-line/60 px-5 lg:flex`,children:[(0,K.jsxs)(`div`,{className:`workspace-tabs`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>te(`map`),className:`workspace-tab`,"data-selected":se===`map`,children:t(`mobile.map`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>te(`activity`),className:`workspace-tab`,"data-selected":se===`activity`,children:t(`mobile.activity`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>te(`workbench`),className:`workspace-tab`,"data-selected":se===`workbench`,children:t(`mobile.workbench`)})]}),(0,K.jsxs)(`button`,{type:`button`,className:`ml-auto px-2 py-1 text-sm text-ink-dim hover:text-ink`,"aria-expanded":E,onClick:()=>{E?(M(!1),j(`activity`)):vn()},children:[e===`zh-CN`?`文件`:`Files`,Wt.data?.length?` · ${Wt.data.filter(e=>e.exists).length}`:``]})]}),!y&&(0,K.jsx)(Fn,{sid:H,onOpenKnowledge:()=>_(),onOpenSkills:()=>g()}),se===`map`&&(0,K.jsx)(U.Suspense,{fallback:(0,K.jsx)(`div`,{className:`m-auto text-sm text-ink-faint`,children:t(`common.loading`)}),children:(0,K.jsx)(em,{snapshot:W,events:rn,managerSteps:z,draft:vt,onDraftChange:xt,onSend:Un,attachments:yt,onAttachmentsChange:Et,pending:en,onCancel:dt,focusSignal:Ce,readOnly:y,onOpenSettings:()=>u(`config`),currentTaskId:on?.mission.id,routeOverride:De,onRouteOverrideChange:ke,conversationEvents:an,connected:Kt,artifacts:Wt.data??[],deliveryCount:Sn.length,onOpenDelivery:()=>{let e=Jl(Sn,on?.routing.vertical||``);e&&xn(e.receipt,e.path)},onOpenReceipt:xn,onOpenArtifact:Ie,onAnswer:()=>fn(!0)},W.session.id)}),(0,K.jsxs)(`div`,{className:`${se===`activity`?`flex`:`hidden`} workspace-view-surface min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(Rl,{alert:Yt}),(0,K.jsx)(`div`,{className:`flex flex-1 flex-col ${Se?`min-h-0`:`min-h-[209px] lg:min-h-0`}`,children:(0,K.jsx)(dc,{snapshot:W,missionView:on,events:Zt,connected:Kt&&!Vt.isError,showReasoning:L,onToggleReasoning:()=>ee(e=>!e),historyStatus:Qt,historyRefreshing:Xt.isFetching,onRetryHistory:()=>void Xt.refetch(),embedded:!0,filter:it,query:ot,skipFirst:nt.skipFirst,artifacts:Wt.data,onOpenArtifact:yn,onOpenDelivery:xn},G)}),y?null:(0,K.jsx)(`div`,{className:`composer-dock shrink-0 px-4 pt-3`,children:(0,K.jsxs)(`div`,{className:`mx-auto w-full max-w-full lg:max-w-[61.8vw]`,children:[(0,K.jsx)(Il,{questions:W.pending_questions??[],backlog:W.backlog,currentTaskId:on?.mission.id,onAnswer:()=>fn(!0)}),(0,K.jsx)(il,{value:vt,attachments:yt,onAttachmentsChange:Et,onChange:xt,onSend:Un,onCancel:dt,disabled:!H,pending:en,focusSignal:Ce,embedded:!0,onRewrite:It,rewriting:bt,slashSelection:Te,onSlashSelectionChange:Ee,routeOverride:De,onRouteOverrideChange:ke,footer:H?(0,K.jsx)(br,{sid:W.session.id,roles:W.roles,running:W.daemon.alive||!!W.manager_requests?.length,lastCall:W.last_call,onOpenSettings:()=>u(`config`)}):void 0},H||`no-session`)]})})]}),ue&&H?(0,K.jsx)(`div`,{className:`${se===`workbench`?`flex`:`hidden`} workspace-view-surface min-h-0 flex-1`,children:(0,K.jsx)(U.Suspense,{fallback:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-xs text-ink-faint`,children:t(`common.loading`)}),children:(0,K.jsx)($p,{sid:H,active:se===`workbench`,readOnly:y,runtimeRequest:me,onRestored:async e=>{await i.refetch(),Pt(e)}})})}):null]}),E&&se!==`map`?(0,K.jsx)(ep,{label:t(`common.resizePreview`),value:D,min:320,max:840,onPointerDown:e=>T(`right`,e),onReset:()=>N(440),onNudge:e=>N(t=>Math.max(320,Math.min(840,t-e)))}):null,(E&&se!==`map`||C===`preview`)&&(0,K.jsxs)(`aside`,{"data-resizable-panel":`right`,className:`${C===`preview`?`flex`:`hidden`} relative min-w-0 flex-1 flex-col overflow-hidden border-l border-line/60 bg-panel lg:flex lg:flex-none lg:w-[var(--preview-width)]`,children:[(0,K.jsx)(`div`,{className:`lg:hidden`,children:(0,K.jsx)(ri,{events:Zt,snap:W,streamOk:Kt,onStart:Pn,onStop:In,onManage:()=>H&&Nn(H),busy:Dn,snapshotStale:Vt.isError,readOnly:y,missionView:on})}),(0,K.jsx)(Ld,{snapshot:W,connected:Kt&&!Vt.isError,sid:G,artifacts:Wt.data,error:Wt.isError,onExpand:Ie,onOpenFile:vn,className:`min-h-0 flex-1 mobile-scroll-region`,embedded:!0,onCollapse:()=>{M(!1),j(`activity`)},missionView:on,activityEvents:Zt,requestedPath:Le.path,requestedPathToken:Le.token,routeVisible:!0})]})]}):(0,K.jsx)(rp,{loading:i.isLoading||!!(H&&Vt.isLoading),hasProjects:o.length>0,error:i.isError&&o.length===0?n(i.error):Vt.isError&&!W?n(Vt.error):void 0,onRetry:()=>{i.refetch(),H&&Vt.refetch()},onNew:zt,onChoose:()=>P(!0),canCreate:!y})}),(0,K.jsx)(tt,{open:l===`learning`,onClose:()=>u(`none`),label:e===`zh-CN`?`技能库`:`Skill library`,width:`max-w-6xl`,children:l===`learning`&&(0,K.jsx)(qn,{sid:H,initialSelection:d,initialScope:p,projectNames:Object.fromEntries(o.flatMap(e=>e.display_name?[[e.id,e.display_name]]:[]))})}),(0,K.jsx)(sl,{open:l===`palette`,onClose:()=>u(`none`),items:Wn}),(0,K.jsx)(Lf,{open:l===`verticals`,onClose:()=>u(`none`)}),(0,K.jsx)(ll,{open:l===`help`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(jl,{sid:H,open:l===`doctor`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(Ml,{sid:H,open:l===`config`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(Nl,{sid:H,open:l===`identity`,onClose:()=>u(`none`)}),H&&(0,K.jsx)(Pl,{sid:H,open:l===`transcript`,onClose:()=>u(`none`)}),H&&W?(0,K.jsx)(Xf,{open:l===`inspector`,snap:W,journal:tn.data??[],busy:wn.disposeBacklog.isPending||wn.stopBacklog.isPending,onClose:()=>u(`none`),onDispose:Mn,onStop:Ln,onInspect:Be}):null,(0,K.jsx)(bu,{sid:H,path:Fe,artifacts:Wt.data??[],reviewActivity:H===G?pn:void 0,onSelectPath:Ie,onClose:()=>Ie(null)}),(0,K.jsx)($f,{sid:H,itemId:ze,onClose:()=>Be(null),onDone:e=>Mn(e,`done`),onSkip:e=>Mn(e,`rm`),onStop:Ln,busy:wn.disposeBacklog.isPending||wn.stopBacklog.isPending,readOnly:y}),(0,K.jsx)(Ll,{reply:cn,open:dn,busy:ln,error:un,onClose:()=>fn(!1),onSubmit:sn}),Ue?(0,K.jsx)(zd,{open:Ve,sid:Ue,name:Ht.data?.session.display_name||o.find(e=>e.id===Ue)?.display_name||o.find(e=>e.id===Ue)?.label||``,alive:Ht.data?.daemon.alive??!!o.find(e=>e.id===Ue)?.daemon_alive,controlAvailable:Ht.data?.daemon.control_available!==!1,busy:Dn,onClose:()=>{He(!1),Ge(null)},onRename:An,onStart:jn,onStop:kn,onDelete:async()=>{let e=Ue,t=await On();return t&&e&&Nt(e),t}}):null,(0,K.jsx)(Rd,{notice:et,onClose:ct}),W&&!y?(0,K.jsx)(ip,{active:C===`preview`?`preview`:se,sidebarOpen:ie,onSelect:e=>{if(e===`preview`){j(`preview`);return}j(`activity`),te(e)},onOpenSessions:()=>P(!0)}):null]})})}export{No as $,Xs as A,G as At,ts as B,Hs as C,vn as Ct,qs as D,Yt as Dt,Ws as E,Zt as Et,fs as F,Ft,wo as G,Co as H,Ls as I,Mt as It,Oo as J,Uo as K,rs as L,kt as Lt,Ds as M,Ht as Mt,Rs as N,Rt as Nt,Zs as O,Gt as Ot,ls as P,It as Pt,Po as Q,es as R,dc as S,Cn as St,Ks as T,Qt as Tt,Ao as U,yo as V,Go as W,Eo as X,Lo as Y,To as Z,Hc as _,Ir as _t,Iu as a,Zi as at,Qc as b,br as bt,Nu as c,ti as ct,Yl as d,nm as default,Zr as dt,Wo as et,Il as f,Yr as ft,$c as g,Vr as gt,nl as h,Lr as ht,Lu as i,sa as it,as as j,W as jt,Js as k,Ut as kt,_u as l,Xr as lt,Cl as m,ei as mt,nd as n,ca as nt,Mu as o,ia as ot,wl as p,Qr as pt,Io as q,Zu as r,fa as rt,ju as s,Hi as st,Zp as t,qa as tt,ru as u,$r as ut,zc as v,Kr as vt,Gs as w,wn as wt,fc as x,Sn as xt,Yc as y,jr as yt,$o as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AppearanceControls-BFWF0z-J.js b/frontend/web/dist/assets/AppearanceControls-BFWF0z-J.js new file mode 100644 index 000000000..3c5e4a756 --- /dev/null +++ b/frontend/web/dist/assets/AppearanceControls-BFWF0z-J.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./motion-sqs9Ax-g.js","./rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]); +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,i,n as a,r as o,t as s}from"./markdown-D-35pK1E.js";import{P as c,k as l,t as u}from"./index-W1lBlVkr.js";var d=e(t()),f=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),p=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),m={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ee=(0,d.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,d.createElement)(`svg`,{ref:c,...m,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:p(`lucide`,i),...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])),h=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(ee,{ref:i,iconNode:t,className:p(`lucide-${f(e)}`,n),...r}));return n.displayName=`${e}`,n},te=h(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),g=h(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),_=h(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),v=h(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),y=h(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),b=h(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),x=h(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),S=h(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),C=h(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),w=h(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),T=h(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),ne=h(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),re=h(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),E={accent:`rgb(var(--blue))`,success:`rgb(var(--ok))`,error:`rgb(var(--err))`,warning:`rgb(var(--warn))`,info:`rgb(var(--blue))`,ink:`rgb(var(--ink))`,inkDim:`rgb(var(--ink-dim))`,inkFaint:`rgb(var(--ink-faint))`,role:{manager:`rgb(var(--role-manager))`,planner:`rgb(var(--role-planner))`,engineer:`rgb(var(--role-engineer))`,reviewer:`rgb(var(--role-reviewer))`}};function ie(e){switch(e){case`bright`:return E.ink;case`dim`:return E.inkDim;case`accent`:return E.accent;case`ok`:return E.success;case`warn`:return E.warning;case`err`:return E.error;case`info`:return E.info}}function ae(e){switch(e){case`medium`:return E.inkDim;case`high`:return E.info;case`xhigh`:return E.accent;case`max`:return E.error;default:return E.inkFaint}}var D=[`manager`,`planner`,`engineer`,`reviewer`];function oe(e){return D.some(t=>t===e)}function se(e,t){return t(`role.${e}`)}function O(e,t){return t(`role.${e}.description`)}function k(e){return E.role[e]??E.inkFaint}var A=[o,[a,{backslashDelimiters:!0,singleDollarTextMath:!1}]],j={output:`htmlAndMathml`},M={"\\Sha":`\\mathord{\\text{Ш}}`};function N({zh:e}){return(t,n)=>{let r=s({...j,macros:{...M}}),i=n.messages.length;r(t,n);let a=n.messages.slice(i).filter(e=>e.source===`rehype-katex`).length;a&&t.children.unshift({type:`element`,tagName:`div`,properties:{role:`note`,"data-math-error-count":a,className:[`my-2`,`rounded-md`,`border`,`border-line`,`px-3`,`py-2`,`text-xs`,`text-ink-dim`]},children:[{type:`text`,value:e?`有 ${a} 处公式暂时无法正确显示,原式已保留。`:`${a} formula${a===1?``:`s`} cannot currently be displayed correctly. The original expression${a===1?` is`:`s are`} preserved.`}]})}}function P(e){return[[N,{zh:e}]]}function F(){return(e,t)=>{s({...j,macros:{...M}})(e,t)}}var I=[F],L=n();async function R(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function z({text:e,label:t,copiedLabel:n,className:r=``}){let[i,a]=(0,d.useState)(!1),o=(0,d.useRef)();(0,d.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=async()=>{await R(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),1600))};return(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void s(),"aria-label":i?n:t,title:i?n:t,className:`inline-flex h-7 items-center gap-1 rounded-md border border-line/60 bg-panel/85 px-2 text-[10px] text-ink-faint shadow-sm backdrop-blur transition hover:border-blue/45 hover:text-blue focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue/50 ${r}`,children:[i?(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`path`,{d:`m3.5 8.5 2.7 2.7 6.3-6.4`})}):(0,L.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:[(0,L.jsx)(`rect`,{x:`5.2`,y:`5.2`,width:`7.2`,height:`7.2`,rx:`1.2`}),(0,L.jsx)(`path`,{d:`M10.8 5.2V3.8a1.2 1.2 0 0 0-1.2-1.2H3.8a1.2 1.2 0 0 0-1.2 1.2v5.8a1.2 1.2 0 0 0 1.2 1.2h1.4`})]}),(0,L.jsx)(`span`,{children:i?n:t})]})}function B(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(B).join(``):(0,d.isValidElement)(e)?B(e.props.children):``}function V(e){let t=String(e||``).trim();try{t=decodeURIComponent(t)}catch{}if(/^sandbox:/i.test(t)&&(t=t.slice(8)),/^file:/i.test(t))try{let e=new URL(t);if(e.hostname&&e.hostname!==`localhost`)return``;t=e.pathname}catch{return``}else if(/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/^[a-z]:[\\/]/i.test(t))return``;for(t=t.split(`#`,1)[0].split(`?`,1)[0].replaceAll(`\\`,`/`),/^\/[a-z]:\//i.test(t)&&(t=t.slice(1));t.startsWith(`./`);)t=t.slice(2);return t.replace(/\/{2,}/g,`/`)}function H(e,t){return!e||!t?!1:/^[a-z]:\//i.test(e)||/^[a-z]:\//i.test(t)?e.toLowerCase()===t.toLowerCase():e===t}function U(e){if(e.startsWith(`#`))return``;let t=V(e);return/\.(?:md|markdown|txt|pdf|csv|tsv|json|html|png|jpe?g|svg|zip|pptx|xlsx)$/i.test(t)?t:``}function W(e,t=[],n=``){let r=V(e||``);if(!r)return null;let i=``;if(n&&!/^(?:\/|[a-z]:\/)/i.test(r)){let e=n.replaceAll(`\\`,`/`).split(`/`).slice(0,-1);for(let t of r.split(`/`))if(t===`..`){if(!e.length)return null;e.pop()}else t&&t!==`.`&&e.push(t);i=e.join(`/`)}let a=t.find(e=>H(i,V(e.path)));if(a)return a.path;for(let e of t){let t=V(e.path),n=V(e.storage_path||``);if(H(r,t)||H(r.replace(/^\//,``),t)||H(r,n))return e.path}return null}function G({src:e,alt:t,sid:n,path:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``);return(0,d.useEffect)(()=>{if(a(!1),s(``),!n||!r)return;let e=new AbortController,t=``;return c.artifactBlob(n,r,!1,e.signal).then(n=>{e.signal.aborted||(t=URL.createObjectURL(n),s(t))}).catch(()=>{e.signal.aborted||a(!0)}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[n,r,e]),i||!e?(0,L.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[`Image unavailable`,t?` · ${t}`:``]}):n&&r&&!o?(0,L.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t||`…`}):(0,L.jsx)(`img`,{src:n&&r?o:e,alt:t||``,loading:`lazy`,decoding:`async`,onError:()=>a(!0),className:`my-2 h-auto max-w-full rounded-lg`})}function K({children:e,artifacts:t=[],onOpenArtifact:n,basePath:a=``,sid:o}){let{t:s,locale:c}=l();return(0,L.jsx)(i,{remarkPlugins:A,rehypePlugins:P(c===`zh-CN`),urlTransform:(e,i)=>i===`href`&&n&&(W(e,t,a)||U(e))?e:r(e),components:{h1:({children:e})=>(0,L.jsx)(`h1`,{className:`mb-2 mt-3 text-base font-semibold text-ink first:mt-0`,children:e}),h2:({children:e})=>(0,L.jsx)(`h2`,{className:`mb-1.5 mt-3 text-sm font-semibold text-ink first:mt-0`,children:e}),h3:({children:e})=>(0,L.jsx)(`h3`,{className:`mb-1 mt-2 text-sm font-medium text-ink first:mt-0`,children:e}),p:({children:e})=>(0,L.jsx)(`p`,{className:`my-1.5 whitespace-pre-wrap break-words leading-[1.625] first:mt-0 last:mb-0`,children:e}),ul:({children:e})=>(0,L.jsx)(`ul`,{className:`my-2 list-disc space-y-1 pl-5`,children:e}),ol:({children:e})=>(0,L.jsx)(`ol`,{className:`my-2 list-decimal space-y-1 pl-5`,children:e}),li:({children:e})=>(0,L.jsx)(`li`,{className:`pl-0.5`,children:e}),blockquote:({children:e})=>(0,L.jsx)(`blockquote`,{className:`my-2 border-l border-blue/50 pl-3 text-ink-dim`,children:e}),hr:()=>(0,L.jsx)(`hr`,{className:`my-3 border-line/60`}),a:({href:e,title:r,children:i})=>{let o=W(e,t,a),s=o?t.find(e=>e.path===o):void 0;if(o&&n)return(0,L.jsx)(`a`,{href:e,"data-artifact-path":o,title:s?.storage_path||o,onClick:e=>{e.preventDefault(),n(o)},className:`cursor-pointer text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i});let l=U(e||``);if(n&&l){let e=a&&!/^(?:\/|[a-z]:\/)/i.test(l)?`${a.replaceAll(`\\`,`/`).split(`/`).slice(0,-1).join(`/`)}/${l}`.replace(/^\//,``):l;return(0,L.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:c===`zh-CN`?`查看文件;不存在或不允许访问时会显示原因`:`Preview file; unavailable files show an error`,className:`inline cursor-pointer text-left text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})}return(0,L.jsx)(`a`,{href:e,title:r,target:`_blank`,rel:`noreferrer`,className:`text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})},code:({className:e,children:t,...n})=>{let r=!!e||String(t).includes(` +`);return(0,L.jsx)(`code`,{...n,className:r?`block min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-ink ${e??``}`:`break-all rounded bg-bg px-1.5 py-0.5 font-mono text-xs text-ink`,children:t})},pre:({children:e})=>(0,L.jsxs)(`pre`,{className:`group/code relative my-2 max-w-full overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-line/50 bg-bg px-3 pb-3 pt-10`,children:[(0,L.jsx)(z,{text:d.Children.toArray(e).map(B).join(``),label:s(`copy.code`),copiedLabel:s(`copy.copied`),className:`absolute right-2 top-2`}),e]}),table:({children:e})=>(0,L.jsx)(`table`,{className:`my-2 w-full table-fixed border-collapse text-left text-xs`,children:e}),th:({children:e})=>(0,L.jsx)(`th`,{className:`break-words border border-line/60 bg-bg px-2 py-1.5 font-semibold text-ink`,children:e}),td:({children:e})=>(0,L.jsx)(`td`,{className:`break-words border border-line/60 px-2 py-1.5 align-top`,children:e}),strong:({children:e})=>(0,L.jsx)(`strong`,{className:`font-semibold text-ink`,children:e}),img:({src:e,alt:n})=>(0,L.jsx)(G,{src:e,alt:n,sid:o,path:W(e,t,a)})},children:e})}var ce={all:`(min-width: 0px)`,reduceMotion:`(prefers-reduced-motion: reduce)`};function q(e,t,n=[]){let r=(0,d.useRef)(t);r.current=t,(0,d.useEffect)(()=>{let t=!1,n=null;return u(()=>import(`./motion-sqs9Ax-g.js`).then(e=>e.t).then(i=>{if(t||!e.current)return;let a=i.gsap;n=a.matchMedia(),n.add(ce,e=>r.current(a,!!e.conditions?.reduceMotion),e.current)}),__vite__mapDeps([0,1]),import.meta.url),()=>{t=!0,n?.revert()}},n)}var J=`input:not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), summary, [href], [tabindex]:not([tabindex="-1"])`,Y=[],X=()=>Y[Y.length-1],le=e=>Array.from(e.querySelectorAll(J)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);function Z(e){(e.querySelector(`[data-autofocus]`)??e.querySelector(J)??e).focus()}function Q(e){let t=X();if(!t)return;if(e.key===`Escape`){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=le(t.dialog),r=n[0],i=n[n.length-1];r?t.dialog.contains(document.activeElement)?e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()):(e.preventDefault(),(e.shiftKey?i:r).focus()):(e.preventDefault(),t.dialog.focus())}function ue(e,t){let n={dialog:e,close:t,previous:document.activeElement instanceof HTMLElement?document.activeElement:null},r=Y.findIndex(t=>{let n=e.compareDocumentPosition(t.dialog);return!(n&Node.DOCUMENT_POSITION_DISCONNECTED)&&!!(n&Node.DOCUMENT_POSITION_FOLLOWING)});Y.splice(r<0?Y.length:r,0,n),Y.length===1&&window.addEventListener(`keydown`,Q);let i=window.requestAnimationFrame(()=>{X()===n&&Z(e)});return()=>{window.cancelAnimationFrame(i);let t=Y.indexOf(n);if(t<0)return;let r=X()===n;Y.splice(t,1);for(let t of Y)t.previous&&e.contains(t.previous)&&(t.previous=n.previous);Y.length||window.removeEventListener(`keydown`,Q);let a=document.activeElement,o=!a||a===document.body||!a.isConnected||e.contains(a);if(!r||!o)return;let s=X();n.previous?.isConnected&&(!s||s.dialog.contains(n.previous))?n.previous.focus():s&&Z(s.dialog)}}function de({open:e,onClose:t,children:n,label:r,width:i=`max-w-2xl`,align:a=`center`,viewport:o=!1,showClose:s=!0,style:c}){let{t:u}=l(),f=(0,d.useRef)(null),p=(0,d.useRef)(null),m=(0,d.useRef)(t);return m.current=t,q(f,(t,n)=>{if(!(!e||!f.current||!p.current)){if(n){t.set([p.current,f.current],{clearProps:`all`});return}t.timeline({defaults:{overwrite:`auto`}}).fromTo(p.current,{autoAlpha:0},{autoAlpha:1,duration:.14,ease:`power1.out`},0).fromTo(f.current,{autoAlpha:0,y:a===`top`?-6:8,scale:.992},{autoAlpha:1,y:0,scale:1,duration:.2,ease:`power3.out`,clearProps:`transform,opacity,visibility`},.03)}},[e,a]),(0,d.useEffect)(()=>{if(!(!e||!f.current))return ue(f.current,()=>m.current())},[e]),e?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 flex ${a===`top`?`items-start pt-3 sm:pt-14`:`items-center`} justify-center ${o?`p-0`:`p-3 sm:p-4`}`,onPointerDown:t,children:[(0,L.jsx)(`div`,{ref:p,className:`modal-scrim absolute inset-0`}),(0,L.jsxs)(`div`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":r,tabIndex:-1,style:c,className:`brand-modal glass-panel glass-panel--raised relative z-10 w-full overscroll-contain ${i} scroll-thin ${o?`flex h-[100dvh] max-h-[100dvh] flex-col overflow-hidden rounded-none`:`max-h-[calc(100dvh-1.5rem)] overflow-x-hidden overflow-y-auto rounded-2xl sm:max-h-[88dvh]`}`,onPointerDown:e=>e.stopPropagation(),children:[!o&&s?(0,L.jsx)(`button`,{type:`button`,"data-modal-close":!0,onClick:t,"aria-label":u(`common.close`),className:`modal-close`,children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m4 4 8 8m0-8-8 8`})})}):null,n]})]}):null}function fe({title:e,sub:t}){return(0,L.jsxs)(`div`,{className:`px-6 pb-3 pr-14 pt-5`,children:[(0,L.jsx)(`h2`,{className:`text-base font-semibold tracking-[-0.01em] text-ink`,children:e}),t&&(0,L.jsx)(`p`,{className:`mt-1 text-sm text-ink-faint`,children:t})]})}var pe=(0,d.forwardRef)(function({className:e=``,...t},n){return(0,L.jsx)(`div`,{ref:n,className:`workbench-shell ambient-canvas flex w-screen max-w-full overflow-hidden text-ink ${e}`,...t})});function $({className:e=``,...t}){return(0,L.jsx)(`header`,{className:`chrome-seam-surface glass-panel glass-panel--raised flex h-12 min-w-0 shrink-0 items-center gap-2 border-b px-3 sm:gap-3 sm:px-4 ${e}`,...t})}function me({mobileOpen:e=!1,collapsed:t=!1,className:n=``,...r}){let i=t&&!e;return(0,L.jsx)(`aside`,{"data-state":i?`collapsed`:`expanded`,"data-resizable-panel":`left`,className:`glass-panel glass-panel--side fixed inset-y-0 left-0 z-50 flex h-full shrink-0 flex-col border-r transition-[width,transform,visibility] duration-panel ease-panel lg:visible lg:static lg:z-auto lg:translate-x-0 ${i?`w-14`:`w-64 lg:w-[var(--sidebar-width,256px)]`} ${e?`visible translate-x-0`:`invisible -translate-x-full`} ${n}`,...r})}function he({ok:e,pulse:t=!1,title:n}){return(0,L.jsx)(`span`,{title:n,className:`inline-block h-1.5 w-1.5 rounded-full transition-shadow duration-150 ${e?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,"data-live":e&&t?`true`:void 0})}function ge({children:e,color:t,className:n=``}){return(0,L.jsx)(`span`,{className:`chip text-ink-dim ${n}`,style:t?{color:t,borderColor:`${t}44`}:void 0,children:e})}function _e({children:e,onClick:t,variant:n=`ghost`,disabled:r,title:i,className:a=``,...o}){let s={ghost:`brand-button-ghost`,primary:`brand-button-primary`,danger:`brand-button-danger`};return(0,L.jsx)(`button`,{...o,type:`button`,title:i,disabled:r,onClick:t,className:`brand-button ${s[n]} ${a}`,children:e})}function ve({title:e,right:t}){return(0,L.jsxs)(`div`,{className:`panel-header flex min-h-11 items-center justify-between border-b px-4`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium text-ink-dim`,children:e}),t]})}function ye(){return(0,L.jsx)(`span`,{className:`inline-block h-3 w-3 animate-spin rounded-full border-2 border-line border-t-blue`})}function be({children:e}){return(0,L.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-ink-faint`,children:e})}function xe({label:e,children:t,className:n=``}){let{t:r}=l();return(0,L.jsxs)(`details`,{className:`raw-disclosure mt-1 text-xs text-ink-faint ${n}`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer select-none hover:text-ink`,children:e??r(`common.showRaw`)}),t]})}function Se(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);try{r.href=n,r.download=t,document.body.appendChild(r),r.click()}finally{r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function Ce({themeMode:e,onCycleTheme:t}){let{locale:n,setLocale:r,t:i}=l(),a=i(`language.switchTo`,{language:i(n===`zh-CN`?`language.english`:`language.chinese`)}),o=i(`sidebar.theme`,{current:e,next:e===`light`?`dark`:`light`});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,"data-testid":`appearance-language`,onClick:()=>r(n===`zh-CN`?`en`:`zh-CN`),title:a,"aria-label":a,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(b,{size:18,strokeWidth:1.75,"aria-hidden":`true`})}),(0,L.jsx)(`button`,{type:`button`,"data-testid":`appearance-theme`,onClick:t,title:o,"aria-label":o,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(e===`light`?T:x,{size:18,strokeWidth:1.75,"aria-hidden":`true`})})]})}export{w as A,se as C,ie as D,E,_ as F,g as I,te as L,S as M,y as N,re as O,v as P,h as R,O as S,ae as T,z as _,be as a,D as b,ye as c,pe as d,me as f,K as g,q as h,ge as i,C as j,ne as k,he as l,fe as m,Se as n,ve as o,de as p,_e as r,xe as s,Ce as t,$ as u,I as v,oe as w,k as x,A as y}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AppearanceControls-BIflq6l1.js b/frontend/web/dist/assets/AppearanceControls-BIflq6l1.js new file mode 100644 index 000000000..217431d81 --- /dev/null +++ b/frontend/web/dist/assets/AppearanceControls-BIflq6l1.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./motion-sqs9Ax-g.js","./rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]); +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,i,n as a,r as o,t as s}from"./markdown-BGG43fCg.js";import{N as c,O as l,t as u}from"./index-Cr9q41CR.js";var d=e(n()),f=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),p=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),m={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ee=(0,d.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,d.createElement)(`svg`,{ref:c,...m,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:p(`lucide`,i),...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])),h=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(ee,{ref:i,iconNode:t,className:p(`lucide-${f(e)}`,n),...r}));return n.displayName=`${e}`,n},te=h(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),g=h(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),_=h(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),v=h(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),y=h(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),b=h(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),x=h(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),S=h(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),C=h(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),w=h(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),T=h(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ne=h(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),E={accent:`rgb(var(--blue))`,success:`rgb(var(--ok))`,error:`rgb(var(--err))`,warning:`rgb(var(--warn))`,info:`rgb(var(--blue))`,ink:`rgb(var(--ink))`,inkDim:`rgb(var(--ink-dim))`,inkFaint:`rgb(var(--ink-faint))`,role:{manager:`rgb(var(--role-manager))`,planner:`rgb(var(--role-planner))`,engineer:`rgb(var(--role-engineer))`,reviewer:`rgb(var(--role-reviewer))`}};function re(e){switch(e){case`bright`:return E.ink;case`dim`:return E.inkDim;case`accent`:return E.accent;case`ok`:return E.success;case`warn`:return E.warning;case`err`:return E.error;case`info`:return E.info}}function ie(e){switch(e){case`medium`:return E.inkDim;case`high`:return E.info;case`xhigh`:return E.accent;case`max`:return E.error;default:return E.inkFaint}}var D=[`manager`,`planner`,`engineer`,`reviewer`];function ae(e){return D.some(t=>t===e)}function oe(e,t){return t(`role.${e}`)}function se(e,t){return t(`role.${e}.description`)}function O(e){return E.role[e]??E.inkFaint}var k=[o,[a,{backslashDelimiters:!0,singleDollarTextMath:!1}]],A={output:`htmlAndMathml`},j={"\\Sha":`\\mathord{\\text{Ш}}`};function M({zh:e}){return(t,n)=>{let r=s({...A,macros:{...j}}),i=n.messages.length;r(t,n);let a=n.messages.slice(i).filter(e=>e.source===`rehype-katex`).length;a&&t.children.unshift({type:`element`,tagName:`div`,properties:{role:`note`,"data-math-error-count":a,className:[`my-2`,`rounded-md`,`border`,`border-line`,`px-3`,`py-2`,`text-xs`,`text-ink-dim`]},children:[{type:`text`,value:e?`有 ${a} 处公式暂时无法正确显示,原式已保留。`:`${a} formula${a===1?``:`s`} cannot currently be displayed correctly. The original expression${a===1?` is`:`s are`} preserved.`}]})}}function N(e){return[[M,{zh:e}]]}function P(){return(e,t)=>{s({...A,macros:{...j}})(e,t)}}var F=[P],I=t();async function L(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function R({text:e,label:t,copiedLabel:n,className:r=``}){let[i,a]=(0,d.useState)(!1),o=(0,d.useRef)();(0,d.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=async()=>{await L(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),1600))};return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>void s(),"aria-label":i?n:t,title:i?n:t,className:`inline-flex h-7 items-center gap-1 rounded-md border border-line/60 bg-panel/85 px-2 text-[10px] text-ink-faint shadow-sm backdrop-blur transition hover:border-blue/45 hover:text-blue focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue/50 ${r}`,children:[i?(0,I.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`m3.5 8.5 2.7 2.7 6.3-6.4`})}):(0,I.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:[(0,I.jsx)(`rect`,{x:`5.2`,y:`5.2`,width:`7.2`,height:`7.2`,rx:`1.2`}),(0,I.jsx)(`path`,{d:`M10.8 5.2V3.8a1.2 1.2 0 0 0-1.2-1.2H3.8a1.2 1.2 0 0 0-1.2 1.2v5.8a1.2 1.2 0 0 0 1.2 1.2h1.4`})]}),(0,I.jsx)(`span`,{children:i?n:t})]})}function z(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(z).join(``):(0,d.isValidElement)(e)?z(e.props.children):``}function B(e){let t=String(e||``).trim();try{t=decodeURIComponent(t)}catch{}if(/^sandbox:/i.test(t)&&(t=t.slice(8)),/^file:/i.test(t))try{let e=new URL(t);if(e.hostname&&e.hostname!==`localhost`)return``;t=e.pathname}catch{return``}else if(/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/^[a-z]:[\\/]/i.test(t))return``;for(t=t.split(`#`,1)[0].split(`?`,1)[0].replaceAll(`\\`,`/`),/^\/[a-z]:\//i.test(t)&&(t=t.slice(1));t.startsWith(`./`);)t=t.slice(2);return t.replace(/\/{2,}/g,`/`)}function V(e,t){return!e||!t?!1:/^[a-z]:\//i.test(e)||/^[a-z]:\//i.test(t)?e.toLowerCase()===t.toLowerCase():e===t}function H(e){if(e.startsWith(`#`))return``;let t=B(e);return/\.(?:md|markdown|txt|pdf|csv|tsv|json|html|png|jpe?g|svg|zip|pptx|xlsx)$/i.test(t)?t:``}function U(e,t=[],n=``){let r=B(e||``);if(!r)return null;let i=``;if(n&&!/^(?:\/|[a-z]:\/)/i.test(r)){let e=n.replaceAll(`\\`,`/`).split(`/`).slice(0,-1);for(let t of r.split(`/`))if(t===`..`){if(!e.length)return null;e.pop()}else t&&t!==`.`&&e.push(t);i=e.join(`/`)}let a=t.find(e=>V(i,B(e.path)));if(a)return a.path;for(let e of t){let t=B(e.path),n=B(e.storage_path||``);if(V(r,t)||V(r.replace(/^\//,``),t)||V(r,n))return e.path}return null}function W({src:e,alt:t,sid:n,path:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``);return(0,d.useEffect)(()=>{if(a(!1),s(``),!n||!r)return;let e=new AbortController,t=``;return c.artifactBlob(n,r,!1,e.signal).then(n=>{e.signal.aborted||(t=URL.createObjectURL(n),s(t))}).catch(()=>{e.signal.aborted||a(!0)}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[n,r,e]),i||!e?(0,I.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[`Image unavailable`,t?` · ${t}`:``]}):n&&r&&!o?(0,I.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t||`…`}):(0,I.jsx)(`img`,{src:n&&r?o:e,alt:t||``,loading:`lazy`,decoding:`async`,onError:()=>a(!0),className:`my-2 h-auto max-w-full rounded-lg`})}function G({children:e,artifacts:t=[],onOpenArtifact:n,basePath:a=``,sid:o}){let{t:s,locale:c}=l();return(0,I.jsx)(i,{remarkPlugins:k,rehypePlugins:N(c===`zh-CN`),urlTransform:(e,i)=>i===`href`&&n&&(U(e,t,a)||H(e))?e:r(e),components:{h1:({children:e})=>(0,I.jsx)(`h1`,{className:`mb-2 mt-3 text-base font-semibold text-ink first:mt-0`,children:e}),h2:({children:e})=>(0,I.jsx)(`h2`,{className:`mb-1.5 mt-3 text-sm font-semibold text-ink first:mt-0`,children:e}),h3:({children:e})=>(0,I.jsx)(`h3`,{className:`mb-1 mt-2 text-sm font-medium text-ink first:mt-0`,children:e}),p:({children:e})=>(0,I.jsx)(`p`,{className:`my-1.5 whitespace-pre-wrap break-words leading-[1.625] first:mt-0 last:mb-0`,children:e}),ul:({children:e})=>(0,I.jsx)(`ul`,{className:`my-2 list-disc space-y-1 pl-5`,children:e}),ol:({children:e})=>(0,I.jsx)(`ol`,{className:`my-2 list-decimal space-y-1 pl-5`,children:e}),li:({children:e})=>(0,I.jsx)(`li`,{className:`pl-0.5`,children:e}),blockquote:({children:e})=>(0,I.jsx)(`blockquote`,{className:`my-2 border-l border-blue/50 pl-3 text-ink-dim`,children:e}),hr:()=>(0,I.jsx)(`hr`,{className:`my-3 border-line/60`}),a:({href:e,title:r,children:i})=>{let o=U(e,t,a),s=o?t.find(e=>e.path===o):void 0;if(o&&n)return(0,I.jsx)(`a`,{href:e,"data-artifact-path":o,title:s?.storage_path||o,onClick:e=>{e.preventDefault(),n(o)},className:`cursor-pointer text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i});let l=H(e||``);if(n&&l){let e=a&&!/^(?:\/|[a-z]:\/)/i.test(l)?`${a.replaceAll(`\\`,`/`).split(`/`).slice(0,-1).join(`/`)}/${l}`.replace(/^\//,``):l;return(0,I.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:c===`zh-CN`?`查看文件;不存在或不允许访问时会显示原因`:`Preview file; unavailable files show an error`,className:`inline cursor-pointer text-left text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})}return(0,I.jsx)(`a`,{href:e,title:r,target:`_blank`,rel:`noreferrer`,className:`text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})},code:({className:e,children:t,...n})=>{let r=!!e||String(t).includes(` +`);return(0,I.jsx)(`code`,{...n,className:r?`block min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-ink ${e??``}`:`break-all rounded bg-bg px-1.5 py-0.5 font-mono text-xs text-ink`,children:t})},pre:({children:e})=>(0,I.jsxs)(`pre`,{className:`group/code relative my-2 max-w-full overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-line/50 bg-bg px-3 pb-3 pt-10`,children:[(0,I.jsx)(R,{text:d.Children.toArray(e).map(z).join(``),label:s(`copy.code`),copiedLabel:s(`copy.copied`),className:`absolute right-2 top-2`}),e]}),table:({children:e})=>(0,I.jsx)(`table`,{className:`my-2 w-full table-fixed border-collapse text-left text-xs`,children:e}),th:({children:e})=>(0,I.jsx)(`th`,{className:`break-words border border-line/60 bg-bg px-2 py-1.5 font-semibold text-ink`,children:e}),td:({children:e})=>(0,I.jsx)(`td`,{className:`break-words border border-line/60 px-2 py-1.5 align-top`,children:e}),strong:({children:e})=>(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:e}),img:({src:e,alt:n})=>(0,I.jsx)(W,{src:e,alt:n,sid:o,path:U(e,t,a)})},children:e})}var K={all:`(min-width: 0px)`,reduceMotion:`(prefers-reduced-motion: reduce)`};function q(e,t,n=[]){let r=(0,d.useRef)(t);r.current=t,(0,d.useEffect)(()=>{let t=!1,n=null;return u(()=>import(`./motion-sqs9Ax-g.js`).then(e=>e.t).then(i=>{if(t||!e.current)return;let a=i.gsap;n=a.matchMedia(),n.add(K,e=>r.current(a,!!e.conditions?.reduceMotion),e.current)}),__vite__mapDeps([0,1]),import.meta.url),()=>{t=!0,n?.revert()}},n)}var J=`input:not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), summary, [href], [tabindex]:not([tabindex="-1"])`,Y=[],X=()=>Y[Y.length-1],ce=e=>Array.from(e.querySelectorAll(J)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);function Z(e){(e.querySelector(`[data-autofocus]`)??e.querySelector(J)??e).focus()}function Q(e){let t=X();if(!t)return;if(e.key===`Escape`){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=ce(t.dialog),r=n[0],i=n[n.length-1];r?t.dialog.contains(document.activeElement)?e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()):(e.preventDefault(),(e.shiftKey?i:r).focus()):(e.preventDefault(),t.dialog.focus())}function le(e,t){let n={dialog:e,close:t,previous:document.activeElement instanceof HTMLElement?document.activeElement:null},r=Y.findIndex(t=>{let n=e.compareDocumentPosition(t.dialog);return!(n&Node.DOCUMENT_POSITION_DISCONNECTED)&&!!(n&Node.DOCUMENT_POSITION_FOLLOWING)});Y.splice(r<0?Y.length:r,0,n),Y.length===1&&window.addEventListener(`keydown`,Q);let i=window.requestAnimationFrame(()=>{X()===n&&Z(e)});return()=>{window.cancelAnimationFrame(i);let t=Y.indexOf(n);if(t<0)return;let r=X()===n;Y.splice(t,1);for(let t of Y)t.previous&&e.contains(t.previous)&&(t.previous=n.previous);Y.length||window.removeEventListener(`keydown`,Q);let a=document.activeElement,o=!a||a===document.body||!a.isConnected||e.contains(a);if(!r||!o)return;let s=X();n.previous?.isConnected&&(!s||s.dialog.contains(n.previous))?n.previous.focus():s&&Z(s.dialog)}}function ue({open:e,onClose:t,children:n,label:r,width:i=`max-w-2xl`,align:a=`center`,viewport:o=!1,showClose:s=!0,style:c}){let{t:u}=l(),f=(0,d.useRef)(null),p=(0,d.useRef)(null),m=(0,d.useRef)(t);return m.current=t,q(f,(t,n)=>{if(!(!e||!f.current||!p.current)){if(n){t.set([p.current,f.current],{clearProps:`all`});return}t.timeline({defaults:{overwrite:`auto`}}).fromTo(p.current,{autoAlpha:0},{autoAlpha:1,duration:.14,ease:`power1.out`},0).fromTo(f.current,{autoAlpha:0,y:a===`top`?-6:8,scale:.992},{autoAlpha:1,y:0,scale:1,duration:.2,ease:`power3.out`,clearProps:`transform,opacity,visibility`},.03)}},[e,a]),(0,d.useEffect)(()=>{if(!(!e||!f.current))return le(f.current,()=>m.current())},[e]),e?(0,I.jsxs)(`div`,{className:`fixed inset-0 z-50 flex ${a===`top`?`items-start pt-3 sm:pt-14`:`items-center`} justify-center ${o?`p-0`:`p-3 sm:p-4`}`,onPointerDown:t,children:[(0,I.jsx)(`div`,{ref:p,className:`modal-scrim absolute inset-0`}),(0,I.jsxs)(`div`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":r,tabIndex:-1,style:c,className:`brand-modal glass-panel glass-panel--raised relative z-10 w-full overscroll-contain ${i} scroll-thin ${o?`flex h-[100dvh] max-h-[100dvh] flex-col overflow-hidden rounded-none`:`max-h-[calc(100dvh-1.5rem)] overflow-x-hidden overflow-y-auto rounded-2xl sm:max-h-[88dvh]`}`,onPointerDown:e=>e.stopPropagation(),children:[!o&&s?(0,I.jsx)(`button`,{type:`button`,"data-modal-close":!0,onClick:t,"aria-label":u(`common.close`),className:`modal-close`,children:(0,I.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,I.jsx)(`path`,{d:`m4 4 8 8m0-8-8 8`})})}):null,n]})]}):null}function de({title:e,sub:t}){return(0,I.jsxs)(`div`,{className:`px-6 pb-3 pr-14 pt-5`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold tracking-[-0.01em] text-ink`,children:e}),t&&(0,I.jsx)(`p`,{className:`mt-1 text-sm text-ink-faint`,children:t})]})}var fe=(0,d.forwardRef)(function({className:e=``,...t},n){return(0,I.jsx)(`div`,{ref:n,className:`workbench-shell ambient-canvas flex w-screen max-w-full overflow-hidden text-ink ${e}`,...t})});function pe({className:e=``,...t}){return(0,I.jsx)(`header`,{className:`chrome-seam-surface glass-panel glass-panel--raised flex h-12 min-w-0 shrink-0 items-center gap-2 border-b px-3 sm:gap-3 sm:px-4 ${e}`,...t})}function $({mobileOpen:e=!1,collapsed:t=!1,className:n=``,...r}){let i=t&&!e;return(0,I.jsx)(`aside`,{"data-state":i?`collapsed`:`expanded`,"data-resizable-panel":`left`,className:`glass-panel glass-panel--side fixed inset-y-0 left-0 z-50 flex h-full shrink-0 flex-col border-r transition-[width,transform,visibility] duration-panel ease-panel lg:visible lg:static lg:z-auto lg:translate-x-0 ${i?`w-14`:`w-64 lg:w-[var(--sidebar-width,256px)]`} ${e?`visible translate-x-0`:`invisible -translate-x-full`} ${n}`,...r})}function me({ok:e,pulse:t=!1,title:n}){return(0,I.jsx)(`span`,{title:n,className:`inline-block h-1.5 w-1.5 rounded-full transition-shadow duration-150 ${e?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,"data-live":e&&t?`true`:void 0})}function he({children:e,color:t,className:n=``}){return(0,I.jsx)(`span`,{className:`chip text-ink-dim ${n}`,style:t?{color:t,borderColor:`${t}44`}:void 0,children:e})}function ge({children:e,onClick:t,variant:n=`ghost`,disabled:r,title:i,className:a=``,...o}){let s={ghost:`brand-button-ghost`,primary:`brand-button-primary`,danger:`brand-button-danger`};return(0,I.jsx)(`button`,{...o,type:`button`,title:i,disabled:r,onClick:t,className:`brand-button ${s[n]} ${a}`,children:e})}function _e({title:e,right:t}){return(0,I.jsxs)(`div`,{className:`panel-header flex min-h-11 items-center justify-between border-b px-4`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-ink-dim`,children:e}),t]})}function ve(){return(0,I.jsx)(`span`,{className:`inline-block h-3 w-3 animate-spin rounded-full border-2 border-line border-t-blue`})}function ye({children:e}){return(0,I.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-ink-faint`,children:e})}function be({label:e,children:t,className:n=``}){let{t:r}=l();return(0,I.jsxs)(`details`,{className:`raw-disclosure mt-1 text-xs text-ink-faint ${n}`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer select-none hover:text-ink`,children:e??r(`common.showRaw`)}),t]})}function xe(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);try{r.href=n,r.download=t,document.body.appendChild(r),r.click()}finally{r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function Se({themeMode:e,onCycleTheme:t}){let{locale:n,setLocale:r,t:i}=l(),a=i(`language.switchTo`,{language:i(n===`zh-CN`?`language.english`:`language.chinese`)}),o=i(`sidebar.theme`,{current:e,next:e===`light`?`dark`:`light`});return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,"data-testid":`appearance-language`,onClick:()=>r(n===`zh-CN`?`en`:`zh-CN`),title:a,"aria-label":a,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,I.jsx)(y,{size:18,strokeWidth:1.75,"aria-hidden":`true`})}),(0,I.jsx)(`button`,{type:`button`,"data-testid":`appearance-theme`,onClick:t,title:o,"aria-label":o,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,I.jsx)(e===`light`?w:b,{size:18,strokeWidth:1.75,"aria-hidden":`true`})})]})}export{C as A,oe as C,re as D,E,g as F,te as I,h as L,x as M,v as N,ne as O,_ as P,se as S,ie as T,R as _,ye as a,D as b,ve as c,fe as d,$ as f,G as g,q as h,he as i,S as j,T as k,me as l,de as m,xe as n,_e as o,ue as p,ge as r,be as s,Se as t,pe as u,F as v,ae as w,O as x,k as y}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AppearanceControls-BNJdEiGG.js b/frontend/web/dist/assets/AppearanceControls-BNJdEiGG.js new file mode 100644 index 000000000..576bc5014 --- /dev/null +++ b/frontend/web/dist/assets/AppearanceControls-BNJdEiGG.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./motion-sqs9Ax-g.js","./rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]); +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,i,n as a,r as o,t as s}from"./markdown-D-35pK1E.js";import{P as c,k as l,t as u}from"./index-Cb5-aRKO.js";var d=e(t()),f=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),p=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),m={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ee=(0,d.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,d.createElement)(`svg`,{ref:c,...m,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:p(`lucide`,i),...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])),h=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(ee,{ref:i,iconNode:t,className:p(`lucide-${f(e)}`,n),...r}));return n.displayName=`${e}`,n},te=h(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),g=h(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),_=h(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),v=h(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),y=h(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),b=h(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),x=h(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),S=h(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),C=h(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),w=h(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),T=h(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),ne=h(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),re=h(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),E={accent:`rgb(var(--blue))`,success:`rgb(var(--ok))`,error:`rgb(var(--err))`,warning:`rgb(var(--warn))`,info:`rgb(var(--blue))`,ink:`rgb(var(--ink))`,inkDim:`rgb(var(--ink-dim))`,inkFaint:`rgb(var(--ink-faint))`,role:{manager:`rgb(var(--role-manager))`,planner:`rgb(var(--role-planner))`,engineer:`rgb(var(--role-engineer))`,reviewer:`rgb(var(--role-reviewer))`}};function ie(e){switch(e){case`bright`:return E.ink;case`dim`:return E.inkDim;case`accent`:return E.accent;case`ok`:return E.success;case`warn`:return E.warning;case`err`:return E.error;case`info`:return E.info}}function ae(e){switch(e){case`medium`:return E.inkDim;case`high`:return E.info;case`xhigh`:return E.accent;case`max`:return E.error;default:return E.inkFaint}}var D=[`manager`,`planner`,`engineer`,`reviewer`];function oe(e){return D.some(t=>t===e)}function se(e,t){return t(`role.${e}`)}function O(e,t){return t(`role.${e}.description`)}function k(e){return E.role[e]??E.inkFaint}var A=[o,[a,{backslashDelimiters:!0,singleDollarTextMath:!1}]],j={output:`htmlAndMathml`},M={"\\Sha":`\\mathord{\\text{Ш}}`};function N({zh:e}){return(t,n)=>{let r=s({...j,macros:{...M}}),i=n.messages.length;r(t,n);let a=n.messages.slice(i).filter(e=>e.source===`rehype-katex`).length;a&&t.children.unshift({type:`element`,tagName:`div`,properties:{role:`note`,"data-math-error-count":a,className:[`my-2`,`rounded-md`,`border`,`border-line`,`px-3`,`py-2`,`text-xs`,`text-ink-dim`]},children:[{type:`text`,value:e?`有 ${a} 处公式暂时无法正确显示,原式已保留。`:`${a} formula${a===1?``:`s`} cannot currently be displayed correctly. The original expression${a===1?` is`:`s are`} preserved.`}]})}}function P(e){return[[N,{zh:e}]]}function F(){return(e,t)=>{s({...j,macros:{...M}})(e,t)}}var I=[F],L=n();async function R(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function z({text:e,label:t,copiedLabel:n,className:r=``}){let[i,a]=(0,d.useState)(!1),o=(0,d.useRef)();(0,d.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=async()=>{await R(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),1600))};return(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void s(),"aria-label":i?n:t,title:i?n:t,className:`inline-flex h-7 items-center gap-1 rounded-md border border-line/60 bg-panel/85 px-2 text-[10px] text-ink-faint shadow-sm backdrop-blur transition hover:border-blue/45 hover:text-blue focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue/50 ${r}`,children:[i?(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`path`,{d:`m3.5 8.5 2.7 2.7 6.3-6.4`})}):(0,L.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:[(0,L.jsx)(`rect`,{x:`5.2`,y:`5.2`,width:`7.2`,height:`7.2`,rx:`1.2`}),(0,L.jsx)(`path`,{d:`M10.8 5.2V3.8a1.2 1.2 0 0 0-1.2-1.2H3.8a1.2 1.2 0 0 0-1.2 1.2v5.8a1.2 1.2 0 0 0 1.2 1.2h1.4`})]}),(0,L.jsx)(`span`,{children:i?n:t})]})}function B(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(B).join(``):(0,d.isValidElement)(e)?B(e.props.children):``}function V(e){let t=String(e||``).trim();try{t=decodeURIComponent(t)}catch{}if(/^sandbox:/i.test(t)&&(t=t.slice(8)),/^file:/i.test(t))try{let e=new URL(t);if(e.hostname&&e.hostname!==`localhost`)return``;t=e.pathname}catch{return``}else if(/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/^[a-z]:[\\/]/i.test(t))return``;for(t=t.split(`#`,1)[0].split(`?`,1)[0].replaceAll(`\\`,`/`),/^\/[a-z]:\//i.test(t)&&(t=t.slice(1));t.startsWith(`./`);)t=t.slice(2);return t.replace(/\/{2,}/g,`/`)}function H(e,t){return!e||!t?!1:/^[a-z]:\//i.test(e)||/^[a-z]:\//i.test(t)?e.toLowerCase()===t.toLowerCase():e===t}function U(e){if(e.startsWith(`#`))return``;let t=V(e);return/\.(?:md|markdown|txt|pdf|csv|tsv|json|html|png|jpe?g|svg|zip|pptx|xlsx)$/i.test(t)?t:``}function W(e,t=[],n=``){let r=V(e||``);if(!r)return null;let i=``;if(n&&!/^(?:\/|[a-z]:\/)/i.test(r)){let e=n.replaceAll(`\\`,`/`).split(`/`).slice(0,-1);for(let t of r.split(`/`))if(t===`..`){if(!e.length)return null;e.pop()}else t&&t!==`.`&&e.push(t);i=e.join(`/`)}let a=t.find(e=>H(i,V(e.path)));if(a)return a.path;for(let e of t){let t=V(e.path),n=V(e.storage_path||``);if(H(r,t)||H(r.replace(/^\//,``),t)||H(r,n))return e.path}return null}function G({src:e,alt:t,sid:n,path:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``);return(0,d.useEffect)(()=>{if(a(!1),s(``),!n||!r)return;let e=new AbortController,t=``;return c.artifactBlob(n,r,!1,e.signal).then(n=>{e.signal.aborted||(t=URL.createObjectURL(n),s(t))}).catch(()=>{e.signal.aborted||a(!0)}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[n,r,e]),i||!e?(0,L.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[`Image unavailable`,t?` · ${t}`:``]}):n&&r&&!o?(0,L.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t||`…`}):(0,L.jsx)(`img`,{src:n&&r?o:e,alt:t||``,loading:`lazy`,decoding:`async`,onError:()=>a(!0),className:`my-2 h-auto max-w-full rounded-lg`})}function K({children:e,artifacts:t=[],onOpenArtifact:n,basePath:a=``,sid:o}){let{t:s,locale:c}=l();return(0,L.jsx)(i,{remarkPlugins:A,rehypePlugins:P(c===`zh-CN`),urlTransform:(e,i)=>i===`href`&&n&&(W(e,t,a)||U(e))?e:r(e),components:{h1:({children:e})=>(0,L.jsx)(`h1`,{className:`mb-2 mt-3 text-base font-semibold text-ink first:mt-0`,children:e}),h2:({children:e})=>(0,L.jsx)(`h2`,{className:`mb-1.5 mt-3 text-sm font-semibold text-ink first:mt-0`,children:e}),h3:({children:e})=>(0,L.jsx)(`h3`,{className:`mb-1 mt-2 text-sm font-medium text-ink first:mt-0`,children:e}),p:({children:e})=>(0,L.jsx)(`p`,{className:`my-1.5 whitespace-pre-wrap break-words leading-[1.625] first:mt-0 last:mb-0`,children:e}),ul:({children:e})=>(0,L.jsx)(`ul`,{className:`my-2 list-disc space-y-1 pl-5`,children:e}),ol:({children:e})=>(0,L.jsx)(`ol`,{className:`my-2 list-decimal space-y-1 pl-5`,children:e}),li:({children:e})=>(0,L.jsx)(`li`,{className:`pl-0.5`,children:e}),blockquote:({children:e})=>(0,L.jsx)(`blockquote`,{className:`my-2 border-l border-blue/50 pl-3 text-ink-dim`,children:e}),hr:()=>(0,L.jsx)(`hr`,{className:`my-3 border-line/60`}),a:({href:e,title:r,children:i})=>{let o=W(e,t,a),s=o?t.find(e=>e.path===o):void 0;if(o&&n)return(0,L.jsx)(`a`,{href:e,"data-artifact-path":o,title:s?.storage_path||o,onClick:e=>{e.preventDefault(),n(o)},className:`cursor-pointer text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i});let l=U(e||``);if(n&&l){let e=a&&!/^(?:\/|[a-z]:\/)/i.test(l)?`${a.replaceAll(`\\`,`/`).split(`/`).slice(0,-1).join(`/`)}/${l}`.replace(/^\//,``):l;return(0,L.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:c===`zh-CN`?`查看文件;不存在或不允许访问时会显示原因`:`Preview file; unavailable files show an error`,className:`inline cursor-pointer text-left text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})}return(0,L.jsx)(`a`,{href:e,title:r,target:`_blank`,rel:`noreferrer`,className:`text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})},code:({className:e,children:t,...n})=>{let r=!!e||String(t).includes(` +`);return(0,L.jsx)(`code`,{...n,className:r?`block min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-ink ${e??``}`:`break-all rounded bg-bg px-1.5 py-0.5 font-mono text-xs text-ink`,children:t})},pre:({children:e})=>(0,L.jsxs)(`pre`,{className:`group/code relative my-2 max-w-full overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-line/50 bg-bg px-3 pb-3 pt-10`,children:[(0,L.jsx)(z,{text:d.Children.toArray(e).map(B).join(``),label:s(`copy.code`),copiedLabel:s(`copy.copied`),className:`absolute right-2 top-2`}),e]}),table:({children:e})=>(0,L.jsx)(`table`,{className:`my-2 w-full table-fixed border-collapse text-left text-xs`,children:e}),th:({children:e})=>(0,L.jsx)(`th`,{className:`break-words border border-line/60 bg-bg px-2 py-1.5 font-semibold text-ink`,children:e}),td:({children:e})=>(0,L.jsx)(`td`,{className:`break-words border border-line/60 px-2 py-1.5 align-top`,children:e}),strong:({children:e})=>(0,L.jsx)(`strong`,{className:`font-semibold text-ink`,children:e}),img:({src:e,alt:n})=>(0,L.jsx)(G,{src:e,alt:n,sid:o,path:W(e,t,a)})},children:e})}var ce={all:`(min-width: 0px)`,reduceMotion:`(prefers-reduced-motion: reduce)`};function q(e,t,n=[]){let r=(0,d.useRef)(t);r.current=t,(0,d.useEffect)(()=>{let t=!1,n=null;return u(()=>import(`./motion-sqs9Ax-g.js`).then(e=>e.t).then(i=>{if(t||!e.current)return;let a=i.gsap;n=a.matchMedia(),n.add(ce,e=>r.current(a,!!e.conditions?.reduceMotion),e.current)}),__vite__mapDeps([0,1]),import.meta.url),()=>{t=!0,n?.revert()}},n)}var J=`input:not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), summary, [href], [tabindex]:not([tabindex="-1"])`,Y=[],X=()=>Y[Y.length-1],le=e=>Array.from(e.querySelectorAll(J)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);function Z(e){(e.querySelector(`[data-autofocus]`)??e.querySelector(J)??e).focus()}function Q(e){let t=X();if(!t)return;if(e.key===`Escape`){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=le(t.dialog),r=n[0],i=n[n.length-1];r?t.dialog.contains(document.activeElement)?e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()):(e.preventDefault(),(e.shiftKey?i:r).focus()):(e.preventDefault(),t.dialog.focus())}function ue(e,t){let n={dialog:e,close:t,previous:document.activeElement instanceof HTMLElement?document.activeElement:null},r=Y.findIndex(t=>{let n=e.compareDocumentPosition(t.dialog);return!(n&Node.DOCUMENT_POSITION_DISCONNECTED)&&!!(n&Node.DOCUMENT_POSITION_FOLLOWING)});Y.splice(r<0?Y.length:r,0,n),Y.length===1&&window.addEventListener(`keydown`,Q);let i=window.requestAnimationFrame(()=>{X()===n&&Z(e)});return()=>{window.cancelAnimationFrame(i);let t=Y.indexOf(n);if(t<0)return;let r=X()===n;Y.splice(t,1);for(let t of Y)t.previous&&e.contains(t.previous)&&(t.previous=n.previous);Y.length||window.removeEventListener(`keydown`,Q);let a=document.activeElement,o=!a||a===document.body||!a.isConnected||e.contains(a);if(!r||!o)return;let s=X();n.previous?.isConnected&&(!s||s.dialog.contains(n.previous))?n.previous.focus():s&&Z(s.dialog)}}function de({open:e,onClose:t,children:n,label:r,width:i=`max-w-2xl`,align:a=`center`,viewport:o=!1,showClose:s=!0,style:c}){let{t:u}=l(),f=(0,d.useRef)(null),p=(0,d.useRef)(null),m=(0,d.useRef)(t);return m.current=t,q(f,(t,n)=>{if(!(!e||!f.current||!p.current)){if(n){t.set([p.current,f.current],{clearProps:`all`});return}t.timeline({defaults:{overwrite:`auto`}}).fromTo(p.current,{autoAlpha:0},{autoAlpha:1,duration:.14,ease:`power1.out`},0).fromTo(f.current,{autoAlpha:0,y:a===`top`?-6:8,scale:.992},{autoAlpha:1,y:0,scale:1,duration:.2,ease:`power3.out`,clearProps:`transform,opacity,visibility`},.03)}},[e,a]),(0,d.useEffect)(()=>{if(!(!e||!f.current))return ue(f.current,()=>m.current())},[e]),e?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 flex ${a===`top`?`items-start pt-3 sm:pt-14`:`items-center`} justify-center ${o?`p-0`:`p-3 sm:p-4`}`,onPointerDown:t,children:[(0,L.jsx)(`div`,{ref:p,className:`modal-scrim absolute inset-0`}),(0,L.jsxs)(`div`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":r,tabIndex:-1,style:c,className:`brand-modal glass-panel glass-panel--raised relative z-10 w-full overscroll-contain ${i} scroll-thin ${o?`flex h-[100dvh] max-h-[100dvh] flex-col overflow-hidden rounded-none`:`max-h-[calc(100dvh-1.5rem)] overflow-x-hidden overflow-y-auto rounded-2xl sm:max-h-[88dvh]`}`,onPointerDown:e=>e.stopPropagation(),children:[!o&&s?(0,L.jsx)(`button`,{type:`button`,"data-modal-close":!0,onClick:t,"aria-label":u(`common.close`),className:`modal-close`,children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m4 4 8 8m0-8-8 8`})})}):null,n]})]}):null}function fe({title:e,sub:t}){return(0,L.jsxs)(`div`,{className:`px-6 pb-3 pr-14 pt-5`,children:[(0,L.jsx)(`h2`,{className:`text-base font-semibold tracking-[-0.01em] text-ink`,children:e}),t&&(0,L.jsx)(`p`,{className:`mt-1 text-sm text-ink-faint`,children:t})]})}var pe=(0,d.forwardRef)(function({className:e=``,...t},n){return(0,L.jsx)(`div`,{ref:n,className:`workbench-shell ambient-canvas flex w-screen max-w-full overflow-hidden text-ink ${e}`,...t})});function $({className:e=``,...t}){return(0,L.jsx)(`header`,{className:`chrome-seam-surface glass-panel glass-panel--raised flex h-12 min-w-0 shrink-0 items-center gap-2 border-b px-3 sm:gap-3 sm:px-4 ${e}`,...t})}function me({mobileOpen:e=!1,collapsed:t=!1,className:n=``,...r}){let i=t&&!e;return(0,L.jsx)(`aside`,{"data-state":i?`collapsed`:`expanded`,"data-resizable-panel":`left`,className:`glass-panel glass-panel--side fixed inset-y-0 left-0 z-50 flex h-full shrink-0 flex-col border-r transition-[width,transform,visibility] duration-panel ease-panel lg:visible lg:static lg:z-auto lg:translate-x-0 ${i?`w-14`:`w-64 lg:w-[var(--sidebar-width,256px)]`} ${e?`visible translate-x-0`:`invisible -translate-x-full`} ${n}`,...r})}function he({ok:e,pulse:t=!1,title:n}){return(0,L.jsx)(`span`,{title:n,className:`inline-block h-1.5 w-1.5 rounded-full transition-shadow duration-150 ${e?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,"data-live":e&&t?`true`:void 0})}function ge({children:e,color:t,className:n=``}){return(0,L.jsx)(`span`,{className:`chip text-ink-dim ${n}`,style:t?{color:t,borderColor:`${t}44`}:void 0,children:e})}function _e({children:e,onClick:t,variant:n=`ghost`,disabled:r,title:i,className:a=``,...o}){let s={ghost:`brand-button-ghost`,primary:`brand-button-primary`,danger:`brand-button-danger`};return(0,L.jsx)(`button`,{...o,type:`button`,title:i,disabled:r,onClick:t,className:`brand-button ${s[n]} ${a}`,children:e})}function ve({title:e,right:t}){return(0,L.jsxs)(`div`,{className:`panel-header flex min-h-11 items-center justify-between border-b px-4`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium text-ink-dim`,children:e}),t]})}function ye(){return(0,L.jsx)(`span`,{className:`inline-block h-3 w-3 animate-spin rounded-full border-2 border-line border-t-blue`})}function be({children:e}){return(0,L.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-ink-faint`,children:e})}function xe({label:e,children:t,className:n=``}){let{t:r}=l();return(0,L.jsxs)(`details`,{className:`raw-disclosure mt-1 text-xs text-ink-faint ${n}`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer select-none hover:text-ink`,children:e??r(`common.showRaw`)}),t]})}function Se(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);try{r.href=n,r.download=t,document.body.appendChild(r),r.click()}finally{r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function Ce({themeMode:e,onCycleTheme:t}){let{locale:n,setLocale:r,t:i}=l(),a=i(`language.switchTo`,{language:i(n===`zh-CN`?`language.english`:`language.chinese`)}),o=i(`sidebar.theme`,{current:e,next:e===`light`?`dark`:`light`});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,"data-testid":`appearance-language`,onClick:()=>r(n===`zh-CN`?`en`:`zh-CN`),title:a,"aria-label":a,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(b,{size:18,strokeWidth:1.75,"aria-hidden":`true`})}),(0,L.jsx)(`button`,{type:`button`,"data-testid":`appearance-theme`,onClick:t,title:o,"aria-label":o,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(e===`light`?T:x,{size:18,strokeWidth:1.75,"aria-hidden":`true`})})]})}export{w as A,se as C,ie as D,E,_ as F,g as I,te as L,S as M,y as N,re as O,v as P,h as R,O as S,ae as T,z as _,be as a,D as b,ye as c,pe as d,me as f,K as g,q as h,ge as i,C as j,ne as k,he as l,fe as m,Se as n,ve as o,de as p,_e as r,xe as s,Ce as t,$ as u,I as v,oe as w,k as x,A as y}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AppearanceControls-Bc1ibrT3.js b/frontend/web/dist/assets/AppearanceControls-Bc1ibrT3.js new file mode 100644 index 000000000..dcb1ebf90 --- /dev/null +++ b/frontend/web/dist/assets/AppearanceControls-Bc1ibrT3.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./motion-sqs9Ax-g.js","./rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]); +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,i,n as a,r as o,t as s}from"./markdown-BGG43fCg.js";import{N as c,O as l,t as u}from"./index-DPfzOfKU.js";var d=e(n()),f=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),p=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),m={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ee=(0,d.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,d.createElement)(`svg`,{ref:c,...m,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:p(`lucide`,i),...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])),h=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(ee,{ref:i,iconNode:t,className:p(`lucide-${f(e)}`,n),...r}));return n.displayName=`${e}`,n},te=h(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),g=h(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),_=h(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),v=h(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),y=h(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),b=h(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),x=h(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),S=h(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),C=h(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),w=h(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),T=h(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ne=h(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),E={accent:`rgb(var(--blue))`,success:`rgb(var(--ok))`,error:`rgb(var(--err))`,warning:`rgb(var(--warn))`,info:`rgb(var(--blue))`,ink:`rgb(var(--ink))`,inkDim:`rgb(var(--ink-dim))`,inkFaint:`rgb(var(--ink-faint))`,role:{manager:`rgb(var(--role-manager))`,planner:`rgb(var(--role-planner))`,engineer:`rgb(var(--role-engineer))`,reviewer:`rgb(var(--role-reviewer))`}};function re(e){switch(e){case`bright`:return E.ink;case`dim`:return E.inkDim;case`accent`:return E.accent;case`ok`:return E.success;case`warn`:return E.warning;case`err`:return E.error;case`info`:return E.info}}function ie(e){switch(e){case`medium`:return E.inkDim;case`high`:return E.info;case`xhigh`:return E.accent;case`max`:return E.error;default:return E.inkFaint}}var D=[`manager`,`planner`,`engineer`,`reviewer`];function ae(e){return D.some(t=>t===e)}function oe(e,t){return t(`role.${e}`)}function se(e,t){return t(`role.${e}.description`)}function O(e){return E.role[e]??E.inkFaint}var k=[o,[a,{backslashDelimiters:!0,singleDollarTextMath:!1}]],A={output:`htmlAndMathml`},j={"\\Sha":`\\mathord{\\text{Ш}}`};function M({zh:e}){return(t,n)=>{let r=s({...A,macros:{...j}}),i=n.messages.length;r(t,n);let a=n.messages.slice(i).filter(e=>e.source===`rehype-katex`).length;a&&t.children.unshift({type:`element`,tagName:`div`,properties:{role:`note`,"data-math-error-count":a,className:[`my-2`,`rounded-md`,`border`,`border-line`,`px-3`,`py-2`,`text-xs`,`text-ink-dim`]},children:[{type:`text`,value:e?`有 ${a} 处公式暂时无法正确显示,原式已保留。`:`${a} formula${a===1?``:`s`} cannot currently be displayed correctly. The original expression${a===1?` is`:`s are`} preserved.`}]})}}function N(e){return[[M,{zh:e}]]}function P(){return(e,t)=>{s({...A,macros:{...j}})(e,t)}}var F=[P],I=t();async function L(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function R({text:e,label:t,copiedLabel:n,className:r=``}){let[i,a]=(0,d.useState)(!1),o=(0,d.useRef)();(0,d.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=async()=>{await L(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),1600))};return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>void s(),"aria-label":i?n:t,title:i?n:t,className:`inline-flex h-7 items-center gap-1 rounded-md border border-line/60 bg-panel/85 px-2 text-[10px] text-ink-faint shadow-sm backdrop-blur transition hover:border-blue/45 hover:text-blue focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue/50 ${r}`,children:[i?(0,I.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`m3.5 8.5 2.7 2.7 6.3-6.4`})}):(0,I.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:[(0,I.jsx)(`rect`,{x:`5.2`,y:`5.2`,width:`7.2`,height:`7.2`,rx:`1.2`}),(0,I.jsx)(`path`,{d:`M10.8 5.2V3.8a1.2 1.2 0 0 0-1.2-1.2H3.8a1.2 1.2 0 0 0-1.2 1.2v5.8a1.2 1.2 0 0 0 1.2 1.2h1.4`})]}),(0,I.jsx)(`span`,{children:i?n:t})]})}function z(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(z).join(``):(0,d.isValidElement)(e)?z(e.props.children):``}function B(e){let t=String(e||``).trim();try{t=decodeURIComponent(t)}catch{}if(/^sandbox:/i.test(t)&&(t=t.slice(8)),/^file:/i.test(t))try{let e=new URL(t);if(e.hostname&&e.hostname!==`localhost`)return``;t=e.pathname}catch{return``}else if(/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/^[a-z]:[\\/]/i.test(t))return``;for(t=t.split(`#`,1)[0].split(`?`,1)[0].replaceAll(`\\`,`/`),/^\/[a-z]:\//i.test(t)&&(t=t.slice(1));t.startsWith(`./`);)t=t.slice(2);return t.replace(/\/{2,}/g,`/`)}function V(e,t){return!e||!t?!1:/^[a-z]:\//i.test(e)||/^[a-z]:\//i.test(t)?e.toLowerCase()===t.toLowerCase():e===t}function H(e){if(e.startsWith(`#`))return``;let t=B(e);return/\.(?:md|markdown|txt|pdf|csv|tsv|json|html|png|jpe?g|svg|zip|pptx|xlsx)$/i.test(t)?t:``}function U(e,t=[],n=``){let r=B(e||``);if(!r)return null;let i=``;if(n&&!/^(?:\/|[a-z]:\/)/i.test(r)){let e=n.replaceAll(`\\`,`/`).split(`/`).slice(0,-1);for(let t of r.split(`/`))if(t===`..`){if(!e.length)return null;e.pop()}else t&&t!==`.`&&e.push(t);i=e.join(`/`)}let a=t.find(e=>V(i,B(e.path)));if(a)return a.path;for(let e of t){let t=B(e.path),n=B(e.storage_path||``);if(V(r,t)||V(r.replace(/^\//,``),t)||V(r,n))return e.path}return null}function W({src:e,alt:t,sid:n,path:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``);return(0,d.useEffect)(()=>{if(a(!1),s(``),!n||!r)return;let e=new AbortController,t=``;return c.artifactBlob(n,r,!1,e.signal).then(n=>{e.signal.aborted||(t=URL.createObjectURL(n),s(t))}).catch(()=>{e.signal.aborted||a(!0)}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[n,r,e]),i||!e?(0,I.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[`Image unavailable`,t?` · ${t}`:``]}):n&&r&&!o?(0,I.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t||`…`}):(0,I.jsx)(`img`,{src:n&&r?o:e,alt:t||``,loading:`lazy`,decoding:`async`,onError:()=>a(!0),className:`my-2 h-auto max-w-full rounded-lg`})}function G({children:e,artifacts:t=[],onOpenArtifact:n,basePath:a=``,sid:o}){let{t:s,locale:c}=l();return(0,I.jsx)(i,{remarkPlugins:k,rehypePlugins:N(c===`zh-CN`),urlTransform:(e,i)=>i===`href`&&n&&(U(e,t,a)||H(e))?e:r(e),components:{h1:({children:e})=>(0,I.jsx)(`h1`,{className:`mb-2 mt-3 text-base font-semibold text-ink first:mt-0`,children:e}),h2:({children:e})=>(0,I.jsx)(`h2`,{className:`mb-1.5 mt-3 text-sm font-semibold text-ink first:mt-0`,children:e}),h3:({children:e})=>(0,I.jsx)(`h3`,{className:`mb-1 mt-2 text-sm font-medium text-ink first:mt-0`,children:e}),p:({children:e})=>(0,I.jsx)(`p`,{className:`my-1.5 whitespace-pre-wrap break-words leading-[1.625] first:mt-0 last:mb-0`,children:e}),ul:({children:e})=>(0,I.jsx)(`ul`,{className:`my-2 list-disc space-y-1 pl-5`,children:e}),ol:({children:e})=>(0,I.jsx)(`ol`,{className:`my-2 list-decimal space-y-1 pl-5`,children:e}),li:({children:e})=>(0,I.jsx)(`li`,{className:`pl-0.5`,children:e}),blockquote:({children:e})=>(0,I.jsx)(`blockquote`,{className:`my-2 border-l border-blue/50 pl-3 text-ink-dim`,children:e}),hr:()=>(0,I.jsx)(`hr`,{className:`my-3 border-line/60`}),a:({href:e,title:r,children:i})=>{let o=U(e,t,a),s=o?t.find(e=>e.path===o):void 0;if(o&&n)return(0,I.jsx)(`a`,{href:e,"data-artifact-path":o,title:s?.storage_path||o,onClick:e=>{e.preventDefault(),n(o)},className:`cursor-pointer text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i});let l=H(e||``);if(n&&l){let e=a&&!/^(?:\/|[a-z]:\/)/i.test(l)?`${a.replaceAll(`\\`,`/`).split(`/`).slice(0,-1).join(`/`)}/${l}`.replace(/^\//,``):l;return(0,I.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:c===`zh-CN`?`查看文件;不存在或不允许访问时会显示原因`:`Preview file; unavailable files show an error`,className:`inline cursor-pointer text-left text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})}return(0,I.jsx)(`a`,{href:e,title:r,target:`_blank`,rel:`noreferrer`,className:`text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})},code:({className:e,children:t,...n})=>{let r=!!e||String(t).includes(` +`);return(0,I.jsx)(`code`,{...n,className:r?`block min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-ink ${e??``}`:`break-all rounded bg-bg px-1.5 py-0.5 font-mono text-xs text-ink`,children:t})},pre:({children:e})=>(0,I.jsxs)(`pre`,{className:`group/code relative my-2 max-w-full overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-line/50 bg-bg px-3 pb-3 pt-10`,children:[(0,I.jsx)(R,{text:d.Children.toArray(e).map(z).join(``),label:s(`copy.code`),copiedLabel:s(`copy.copied`),className:`absolute right-2 top-2`}),e]}),table:({children:e})=>(0,I.jsx)(`table`,{className:`my-2 w-full table-fixed border-collapse text-left text-xs`,children:e}),th:({children:e})=>(0,I.jsx)(`th`,{className:`break-words border border-line/60 bg-bg px-2 py-1.5 font-semibold text-ink`,children:e}),td:({children:e})=>(0,I.jsx)(`td`,{className:`break-words border border-line/60 px-2 py-1.5 align-top`,children:e}),strong:({children:e})=>(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:e}),img:({src:e,alt:n})=>(0,I.jsx)(W,{src:e,alt:n,sid:o,path:U(e,t,a)})},children:e})}var K={all:`(min-width: 0px)`,reduceMotion:`(prefers-reduced-motion: reduce)`};function q(e,t,n=[]){let r=(0,d.useRef)(t);r.current=t,(0,d.useEffect)(()=>{let t=!1,n=null;return u(()=>import(`./motion-sqs9Ax-g.js`).then(e=>e.t).then(i=>{if(t||!e.current)return;let a=i.gsap;n=a.matchMedia(),n.add(K,e=>r.current(a,!!e.conditions?.reduceMotion),e.current)}),__vite__mapDeps([0,1]),import.meta.url),()=>{t=!0,n?.revert()}},n)}var J=`input:not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), summary, [href], [tabindex]:not([tabindex="-1"])`,Y=[],X=()=>Y[Y.length-1],ce=e=>Array.from(e.querySelectorAll(J)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);function Z(e){(e.querySelector(`[data-autofocus]`)??e.querySelector(J)??e).focus()}function Q(e){let t=X();if(!t)return;if(e.key===`Escape`){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=ce(t.dialog),r=n[0],i=n[n.length-1];r?t.dialog.contains(document.activeElement)?e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()):(e.preventDefault(),(e.shiftKey?i:r).focus()):(e.preventDefault(),t.dialog.focus())}function le(e,t){let n={dialog:e,close:t,previous:document.activeElement instanceof HTMLElement?document.activeElement:null},r=Y.findIndex(t=>{let n=e.compareDocumentPosition(t.dialog);return!(n&Node.DOCUMENT_POSITION_DISCONNECTED)&&!!(n&Node.DOCUMENT_POSITION_FOLLOWING)});Y.splice(r<0?Y.length:r,0,n),Y.length===1&&window.addEventListener(`keydown`,Q);let i=window.requestAnimationFrame(()=>{X()===n&&Z(e)});return()=>{window.cancelAnimationFrame(i);let t=Y.indexOf(n);if(t<0)return;let r=X()===n;Y.splice(t,1);for(let t of Y)t.previous&&e.contains(t.previous)&&(t.previous=n.previous);Y.length||window.removeEventListener(`keydown`,Q);let a=document.activeElement,o=!a||a===document.body||!a.isConnected||e.contains(a);if(!r||!o)return;let s=X();n.previous?.isConnected&&(!s||s.dialog.contains(n.previous))?n.previous.focus():s&&Z(s.dialog)}}function ue({open:e,onClose:t,children:n,label:r,width:i=`max-w-2xl`,align:a=`center`,viewport:o=!1,showClose:s=!0,style:c}){let{t:u}=l(),f=(0,d.useRef)(null),p=(0,d.useRef)(null),m=(0,d.useRef)(t);return m.current=t,q(f,(t,n)=>{if(!(!e||!f.current||!p.current)){if(n){t.set([p.current,f.current],{clearProps:`all`});return}t.timeline({defaults:{overwrite:`auto`}}).fromTo(p.current,{autoAlpha:0},{autoAlpha:1,duration:.14,ease:`power1.out`},0).fromTo(f.current,{autoAlpha:0,y:a===`top`?-6:8,scale:.992},{autoAlpha:1,y:0,scale:1,duration:.2,ease:`power3.out`,clearProps:`transform,opacity,visibility`},.03)}},[e,a]),(0,d.useEffect)(()=>{if(!(!e||!f.current))return le(f.current,()=>m.current())},[e]),e?(0,I.jsxs)(`div`,{className:`fixed inset-0 z-50 flex ${a===`top`?`items-start pt-3 sm:pt-14`:`items-center`} justify-center ${o?`p-0`:`p-3 sm:p-4`}`,onPointerDown:t,children:[(0,I.jsx)(`div`,{ref:p,className:`modal-scrim absolute inset-0`}),(0,I.jsxs)(`div`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":r,tabIndex:-1,style:c,className:`brand-modal glass-panel glass-panel--raised relative z-10 w-full overscroll-contain ${i} scroll-thin ${o?`flex h-[100dvh] max-h-[100dvh] flex-col overflow-hidden rounded-none`:`max-h-[calc(100dvh-1.5rem)] overflow-x-hidden overflow-y-auto rounded-2xl sm:max-h-[88dvh]`}`,onPointerDown:e=>e.stopPropagation(),children:[!o&&s?(0,I.jsx)(`button`,{type:`button`,"data-modal-close":!0,onClick:t,"aria-label":u(`common.close`),className:`modal-close`,children:(0,I.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,I.jsx)(`path`,{d:`m4 4 8 8m0-8-8 8`})})}):null,n]})]}):null}function de({title:e,sub:t}){return(0,I.jsxs)(`div`,{className:`px-6 pb-3 pr-14 pt-5`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold tracking-[-0.01em] text-ink`,children:e}),t&&(0,I.jsx)(`p`,{className:`mt-1 text-sm text-ink-faint`,children:t})]})}var fe=(0,d.forwardRef)(function({className:e=``,...t},n){return(0,I.jsx)(`div`,{ref:n,className:`workbench-shell ambient-canvas flex w-screen max-w-full overflow-hidden text-ink ${e}`,...t})});function pe({className:e=``,...t}){return(0,I.jsx)(`header`,{className:`chrome-seam-surface glass-panel glass-panel--raised flex h-12 min-w-0 shrink-0 items-center gap-2 border-b px-3 sm:gap-3 sm:px-4 ${e}`,...t})}function $({mobileOpen:e=!1,collapsed:t=!1,className:n=``,...r}){let i=t&&!e;return(0,I.jsx)(`aside`,{"data-state":i?`collapsed`:`expanded`,"data-resizable-panel":`left`,className:`glass-panel glass-panel--side fixed inset-y-0 left-0 z-50 flex h-full shrink-0 flex-col border-r transition-[width,transform,visibility] duration-panel ease-panel lg:visible lg:static lg:z-auto lg:translate-x-0 ${i?`w-14`:`w-64 lg:w-[var(--sidebar-width,256px)]`} ${e?`visible translate-x-0`:`invisible -translate-x-full`} ${n}`,...r})}function me({ok:e,pulse:t=!1,title:n}){return(0,I.jsx)(`span`,{title:n,className:`inline-block h-1.5 w-1.5 rounded-full transition-shadow duration-150 ${e?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,"data-live":e&&t?`true`:void 0})}function he({children:e,color:t,className:n=``}){return(0,I.jsx)(`span`,{className:`chip text-ink-dim ${n}`,style:t?{color:t,borderColor:`${t}44`}:void 0,children:e})}function ge({children:e,onClick:t,variant:n=`ghost`,disabled:r,title:i,className:a=``,...o}){let s={ghost:`brand-button-ghost`,primary:`brand-button-primary`,danger:`brand-button-danger`};return(0,I.jsx)(`button`,{...o,type:`button`,title:i,disabled:r,onClick:t,className:`brand-button ${s[n]} ${a}`,children:e})}function _e({title:e,right:t}){return(0,I.jsxs)(`div`,{className:`panel-header flex min-h-11 items-center justify-between border-b px-4`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-ink-dim`,children:e}),t]})}function ve(){return(0,I.jsx)(`span`,{className:`inline-block h-3 w-3 animate-spin rounded-full border-2 border-line border-t-blue`})}function ye({children:e}){return(0,I.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-ink-faint`,children:e})}function be({label:e,children:t,className:n=``}){let{t:r}=l();return(0,I.jsxs)(`details`,{className:`raw-disclosure mt-1 text-xs text-ink-faint ${n}`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer select-none hover:text-ink`,children:e??r(`common.showRaw`)}),t]})}function xe(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);try{r.href=n,r.download=t,document.body.appendChild(r),r.click()}finally{r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function Se({themeMode:e,onCycleTheme:t}){let{locale:n,setLocale:r,t:i}=l(),a=i(`language.switchTo`,{language:i(n===`zh-CN`?`language.english`:`language.chinese`)}),o=i(`sidebar.theme`,{current:e,next:e===`light`?`dark`:`light`});return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,"data-testid":`appearance-language`,onClick:()=>r(n===`zh-CN`?`en`:`zh-CN`),title:a,"aria-label":a,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,I.jsx)(y,{size:18,strokeWidth:1.75,"aria-hidden":`true`})}),(0,I.jsx)(`button`,{type:`button`,"data-testid":`appearance-theme`,onClick:t,title:o,"aria-label":o,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,I.jsx)(e===`light`?w:b,{size:18,strokeWidth:1.75,"aria-hidden":`true`})})]})}export{C as A,oe as C,re as D,E,g as F,te as I,h as L,x as M,v as N,ne as O,_ as P,se as S,ie as T,R as _,ye as a,D as b,ve as c,fe as d,$ as f,G as g,q as h,he as i,S as j,T as k,me as l,de as m,xe as n,_e as o,ue as p,ge as r,be as s,Se as t,pe as u,F as v,ae as w,O as x,k as y}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AppearanceControls-C_eUyO2x.js b/frontend/web/dist/assets/AppearanceControls-C_eUyO2x.js new file mode 100644 index 000000000..ec68cdb35 --- /dev/null +++ b/frontend/web/dist/assets/AppearanceControls-C_eUyO2x.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./motion-sqs9Ax-g.js","./rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]); +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,i,n as a,r as o,t as s}from"./markdown-D-35pK1E.js";import{P as c,k as l,t as u}from"./index-DbVni4qR.js";var d=e(t()),f=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),p=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),m={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ee=(0,d.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,d.createElement)(`svg`,{ref:c,...m,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:p(`lucide`,i),...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])),h=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(ee,{ref:i,iconNode:t,className:p(`lucide-${f(e)}`,n),...r}));return n.displayName=`${e}`,n},te=h(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),g=h(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),_=h(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),v=h(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),y=h(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),b=h(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),x=h(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),S=h(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),C=h(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),w=h(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),T=h(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),ne=h(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),re=h(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),E={accent:`rgb(var(--blue))`,success:`rgb(var(--ok))`,error:`rgb(var(--err))`,warning:`rgb(var(--warn))`,info:`rgb(var(--blue))`,ink:`rgb(var(--ink))`,inkDim:`rgb(var(--ink-dim))`,inkFaint:`rgb(var(--ink-faint))`,role:{manager:`rgb(var(--role-manager))`,planner:`rgb(var(--role-planner))`,engineer:`rgb(var(--role-engineer))`,reviewer:`rgb(var(--role-reviewer))`}};function ie(e){switch(e){case`bright`:return E.ink;case`dim`:return E.inkDim;case`accent`:return E.accent;case`ok`:return E.success;case`warn`:return E.warning;case`err`:return E.error;case`info`:return E.info}}function ae(e){switch(e){case`medium`:return E.inkDim;case`high`:return E.info;case`xhigh`:return E.accent;case`max`:return E.error;default:return E.inkFaint}}var D=[`manager`,`planner`,`engineer`,`reviewer`];function oe(e){return D.some(t=>t===e)}function se(e,t){return t(`role.${e}`)}function O(e,t){return t(`role.${e}.description`)}function k(e){return E.role[e]??E.inkFaint}var A=[o,[a,{backslashDelimiters:!0,singleDollarTextMath:!1}]],j={output:`htmlAndMathml`},M={"\\Sha":`\\mathord{\\text{Ш}}`};function N({zh:e}){return(t,n)=>{let r=s({...j,macros:{...M}}),i=n.messages.length;r(t,n);let a=n.messages.slice(i).filter(e=>e.source===`rehype-katex`).length;a&&t.children.unshift({type:`element`,tagName:`div`,properties:{role:`note`,"data-math-error-count":a,className:[`my-2`,`rounded-md`,`border`,`border-line`,`px-3`,`py-2`,`text-xs`,`text-ink-dim`]},children:[{type:`text`,value:e?`有 ${a} 处公式暂时无法正确显示,原式已保留。`:`${a} formula${a===1?``:`s`} cannot currently be displayed correctly. The original expression${a===1?` is`:`s are`} preserved.`}]})}}function P(e){return[[N,{zh:e}]]}function F(){return(e,t)=>{s({...j,macros:{...M}})(e,t)}}var I=[F],L=n();async function R(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function z({text:e,label:t,copiedLabel:n,className:r=``}){let[i,a]=(0,d.useState)(!1),o=(0,d.useRef)();(0,d.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=async()=>{await R(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),1600))};return(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void s(),"aria-label":i?n:t,title:i?n:t,className:`inline-flex h-7 items-center gap-1 rounded-md border border-line/60 bg-panel/85 px-2 text-[10px] text-ink-faint shadow-sm backdrop-blur transition hover:border-blue/45 hover:text-blue focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue/50 ${r}`,children:[i?(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`path`,{d:`m3.5 8.5 2.7 2.7 6.3-6.4`})}):(0,L.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:[(0,L.jsx)(`rect`,{x:`5.2`,y:`5.2`,width:`7.2`,height:`7.2`,rx:`1.2`}),(0,L.jsx)(`path`,{d:`M10.8 5.2V3.8a1.2 1.2 0 0 0-1.2-1.2H3.8a1.2 1.2 0 0 0-1.2 1.2v5.8a1.2 1.2 0 0 0 1.2 1.2h1.4`})]}),(0,L.jsx)(`span`,{children:i?n:t})]})}function B(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(B).join(``):(0,d.isValidElement)(e)?B(e.props.children):``}function V(e){let t=String(e||``).trim();try{t=decodeURIComponent(t)}catch{}if(/^sandbox:/i.test(t)&&(t=t.slice(8)),/^file:/i.test(t))try{let e=new URL(t);if(e.hostname&&e.hostname!==`localhost`)return``;t=e.pathname}catch{return``}else if(/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/^[a-z]:[\\/]/i.test(t))return``;for(t=t.split(`#`,1)[0].split(`?`,1)[0].replaceAll(`\\`,`/`),/^\/[a-z]:\//i.test(t)&&(t=t.slice(1));t.startsWith(`./`);)t=t.slice(2);return t.replace(/\/{2,}/g,`/`)}function H(e,t){return!e||!t?!1:/^[a-z]:\//i.test(e)||/^[a-z]:\//i.test(t)?e.toLowerCase()===t.toLowerCase():e===t}function U(e){if(e.startsWith(`#`))return``;let t=V(e);return/\.(?:md|markdown|txt|pdf|csv|tsv|json|html|png|jpe?g|svg|zip|pptx|xlsx)$/i.test(t)?t:``}function W(e,t=[],n=``){let r=V(e||``);if(!r)return null;let i=``;if(n&&!/^(?:\/|[a-z]:\/)/i.test(r)){let e=n.replaceAll(`\\`,`/`).split(`/`).slice(0,-1);for(let t of r.split(`/`))if(t===`..`){if(!e.length)return null;e.pop()}else t&&t!==`.`&&e.push(t);i=e.join(`/`)}let a=t.find(e=>H(i,V(e.path)));if(a)return a.path;for(let e of t){let t=V(e.path),n=V(e.storage_path||``);if(H(r,t)||H(r.replace(/^\//,``),t)||H(r,n))return e.path}return null}function G({src:e,alt:t,sid:n,path:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``);return(0,d.useEffect)(()=>{if(a(!1),s(``),!n||!r)return;let e=new AbortController,t=``;return c.artifactBlob(n,r,!1,e.signal).then(n=>{e.signal.aborted||(t=URL.createObjectURL(n),s(t))}).catch(()=>{e.signal.aborted||a(!0)}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[n,r,e]),i||!e?(0,L.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[`Image unavailable`,t?` · ${t}`:``]}):n&&r&&!o?(0,L.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t||`…`}):(0,L.jsx)(`img`,{src:n&&r?o:e,alt:t||``,loading:`lazy`,decoding:`async`,onError:()=>a(!0),className:`my-2 h-auto max-w-full rounded-lg`})}function K({children:e,artifacts:t=[],onOpenArtifact:n,basePath:a=``,sid:o}){let{t:s,locale:c}=l();return(0,L.jsx)(i,{remarkPlugins:A,rehypePlugins:P(c===`zh-CN`),urlTransform:(e,i)=>i===`href`&&n&&(W(e,t,a)||U(e))?e:r(e),components:{h1:({children:e})=>(0,L.jsx)(`h1`,{className:`mb-2 mt-3 text-base font-semibold text-ink first:mt-0`,children:e}),h2:({children:e})=>(0,L.jsx)(`h2`,{className:`mb-1.5 mt-3 text-sm font-semibold text-ink first:mt-0`,children:e}),h3:({children:e})=>(0,L.jsx)(`h3`,{className:`mb-1 mt-2 text-sm font-medium text-ink first:mt-0`,children:e}),p:({children:e})=>(0,L.jsx)(`p`,{className:`my-1.5 whitespace-pre-wrap break-words leading-[1.625] first:mt-0 last:mb-0`,children:e}),ul:({children:e})=>(0,L.jsx)(`ul`,{className:`my-2 list-disc space-y-1 pl-5`,children:e}),ol:({children:e})=>(0,L.jsx)(`ol`,{className:`my-2 list-decimal space-y-1 pl-5`,children:e}),li:({children:e})=>(0,L.jsx)(`li`,{className:`pl-0.5`,children:e}),blockquote:({children:e})=>(0,L.jsx)(`blockquote`,{className:`my-2 border-l border-blue/50 pl-3 text-ink-dim`,children:e}),hr:()=>(0,L.jsx)(`hr`,{className:`my-3 border-line/60`}),a:({href:e,title:r,children:i})=>{let o=W(e,t,a),s=o?t.find(e=>e.path===o):void 0;if(o&&n)return(0,L.jsx)(`a`,{href:e,"data-artifact-path":o,title:s?.storage_path||o,onClick:e=>{e.preventDefault(),n(o)},className:`cursor-pointer text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i});let l=U(e||``);if(n&&l){let e=a&&!/^(?:\/|[a-z]:\/)/i.test(l)?`${a.replaceAll(`\\`,`/`).split(`/`).slice(0,-1).join(`/`)}/${l}`.replace(/^\//,``):l;return(0,L.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:c===`zh-CN`?`查看文件;不存在或不允许访问时会显示原因`:`Preview file; unavailable files show an error`,className:`inline cursor-pointer text-left text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})}return(0,L.jsx)(`a`,{href:e,title:r,target:`_blank`,rel:`noreferrer`,className:`text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})},code:({className:e,children:t,...n})=>{let r=!!e||String(t).includes(` +`);return(0,L.jsx)(`code`,{...n,className:r?`block min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-ink ${e??``}`:`break-all rounded bg-bg px-1.5 py-0.5 font-mono text-xs text-ink`,children:t})},pre:({children:e})=>(0,L.jsxs)(`pre`,{className:`group/code relative my-2 max-w-full overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-line/50 bg-bg px-3 pb-3 pt-10`,children:[(0,L.jsx)(z,{text:d.Children.toArray(e).map(B).join(``),label:s(`copy.code`),copiedLabel:s(`copy.copied`),className:`absolute right-2 top-2`}),e]}),table:({children:e})=>(0,L.jsx)(`table`,{className:`my-2 w-full table-fixed border-collapse text-left text-xs`,children:e}),th:({children:e})=>(0,L.jsx)(`th`,{className:`break-words border border-line/60 bg-bg px-2 py-1.5 font-semibold text-ink`,children:e}),td:({children:e})=>(0,L.jsx)(`td`,{className:`break-words border border-line/60 px-2 py-1.5 align-top`,children:e}),strong:({children:e})=>(0,L.jsx)(`strong`,{className:`font-semibold text-ink`,children:e}),img:({src:e,alt:n})=>(0,L.jsx)(G,{src:e,alt:n,sid:o,path:W(e,t,a)})},children:e})}var ce={all:`(min-width: 0px)`,reduceMotion:`(prefers-reduced-motion: reduce)`};function q(e,t,n=[]){let r=(0,d.useRef)(t);r.current=t,(0,d.useEffect)(()=>{let t=!1,n=null;return u(()=>import(`./motion-sqs9Ax-g.js`).then(e=>e.t).then(i=>{if(t||!e.current)return;let a=i.gsap;n=a.matchMedia(),n.add(ce,e=>r.current(a,!!e.conditions?.reduceMotion),e.current)}),__vite__mapDeps([0,1]),import.meta.url),()=>{t=!0,n?.revert()}},n)}var J=`input:not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), summary, [href], [tabindex]:not([tabindex="-1"])`,Y=[],X=()=>Y[Y.length-1],le=e=>Array.from(e.querySelectorAll(J)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);function Z(e){(e.querySelector(`[data-autofocus]`)??e.querySelector(J)??e).focus()}function Q(e){let t=X();if(!t)return;if(e.key===`Escape`){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=le(t.dialog),r=n[0],i=n[n.length-1];r?t.dialog.contains(document.activeElement)?e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()):(e.preventDefault(),(e.shiftKey?i:r).focus()):(e.preventDefault(),t.dialog.focus())}function ue(e,t){let n={dialog:e,close:t,previous:document.activeElement instanceof HTMLElement?document.activeElement:null},r=Y.findIndex(t=>{let n=e.compareDocumentPosition(t.dialog);return!(n&Node.DOCUMENT_POSITION_DISCONNECTED)&&!!(n&Node.DOCUMENT_POSITION_FOLLOWING)});Y.splice(r<0?Y.length:r,0,n),Y.length===1&&window.addEventListener(`keydown`,Q);let i=window.requestAnimationFrame(()=>{X()===n&&Z(e)});return()=>{window.cancelAnimationFrame(i);let t=Y.indexOf(n);if(t<0)return;let r=X()===n;Y.splice(t,1);for(let t of Y)t.previous&&e.contains(t.previous)&&(t.previous=n.previous);Y.length||window.removeEventListener(`keydown`,Q);let a=document.activeElement,o=!a||a===document.body||!a.isConnected||e.contains(a);if(!r||!o)return;let s=X();n.previous?.isConnected&&(!s||s.dialog.contains(n.previous))?n.previous.focus():s&&Z(s.dialog)}}function de({open:e,onClose:t,children:n,label:r,width:i=`max-w-2xl`,align:a=`center`,viewport:o=!1,showClose:s=!0,style:c}){let{t:u}=l(),f=(0,d.useRef)(null),p=(0,d.useRef)(null),m=(0,d.useRef)(t);return m.current=t,q(f,(t,n)=>{if(!(!e||!f.current||!p.current)){if(n){t.set([p.current,f.current],{clearProps:`all`});return}t.timeline({defaults:{overwrite:`auto`}}).fromTo(p.current,{autoAlpha:0},{autoAlpha:1,duration:.14,ease:`power1.out`},0).fromTo(f.current,{autoAlpha:0,y:a===`top`?-6:8,scale:.992},{autoAlpha:1,y:0,scale:1,duration:.2,ease:`power3.out`,clearProps:`transform,opacity,visibility`},.03)}},[e,a]),(0,d.useEffect)(()=>{if(!(!e||!f.current))return ue(f.current,()=>m.current())},[e]),e?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 flex ${a===`top`?`items-start pt-3 sm:pt-14`:`items-center`} justify-center ${o?`p-0`:`p-3 sm:p-4`}`,onPointerDown:t,children:[(0,L.jsx)(`div`,{ref:p,className:`modal-scrim absolute inset-0`}),(0,L.jsxs)(`div`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":r,tabIndex:-1,style:c,className:`brand-modal glass-panel glass-panel--raised relative z-10 w-full overscroll-contain ${i} scroll-thin ${o?`flex h-[100dvh] max-h-[100dvh] flex-col overflow-hidden rounded-none`:`max-h-[calc(100dvh-1.5rem)] overflow-x-hidden overflow-y-auto rounded-2xl sm:max-h-[88dvh]`}`,onPointerDown:e=>e.stopPropagation(),children:[!o&&s?(0,L.jsx)(`button`,{type:`button`,"data-modal-close":!0,onClick:t,"aria-label":u(`common.close`),className:`modal-close`,children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m4 4 8 8m0-8-8 8`})})}):null,n]})]}):null}function fe({title:e,sub:t}){return(0,L.jsxs)(`div`,{className:`px-6 pb-3 pr-14 pt-5`,children:[(0,L.jsx)(`h2`,{className:`text-base font-semibold tracking-[-0.01em] text-ink`,children:e}),t&&(0,L.jsx)(`p`,{className:`mt-1 text-sm text-ink-faint`,children:t})]})}var pe=(0,d.forwardRef)(function({className:e=``,...t},n){return(0,L.jsx)(`div`,{ref:n,className:`workbench-shell ambient-canvas flex w-screen max-w-full overflow-hidden text-ink ${e}`,...t})});function $({className:e=``,...t}){return(0,L.jsx)(`header`,{className:`chrome-seam-surface glass-panel glass-panel--raised flex h-12 min-w-0 shrink-0 items-center gap-2 border-b px-3 sm:gap-3 sm:px-4 ${e}`,...t})}function me({mobileOpen:e=!1,collapsed:t=!1,className:n=``,...r}){let i=t&&!e;return(0,L.jsx)(`aside`,{"data-state":i?`collapsed`:`expanded`,"data-resizable-panel":`left`,className:`glass-panel glass-panel--side fixed inset-y-0 left-0 z-50 flex h-full shrink-0 flex-col border-r transition-[width,transform,visibility] duration-panel ease-panel lg:visible lg:static lg:z-auto lg:translate-x-0 ${i?`w-14`:`w-64 lg:w-[var(--sidebar-width,256px)]`} ${e?`visible translate-x-0`:`invisible -translate-x-full`} ${n}`,...r})}function he({ok:e,pulse:t=!1,title:n}){return(0,L.jsx)(`span`,{title:n,className:`inline-block h-1.5 w-1.5 rounded-full transition-shadow duration-150 ${e?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,"data-live":e&&t?`true`:void 0})}function ge({children:e,color:t,className:n=``}){return(0,L.jsx)(`span`,{className:`chip text-ink-dim ${n}`,style:t?{color:t,borderColor:`${t}44`}:void 0,children:e})}function _e({children:e,onClick:t,variant:n=`ghost`,disabled:r,title:i,className:a=``,...o}){let s={ghost:`brand-button-ghost`,primary:`brand-button-primary`,danger:`brand-button-danger`};return(0,L.jsx)(`button`,{...o,type:`button`,title:i,disabled:r,onClick:t,className:`brand-button ${s[n]} ${a}`,children:e})}function ve({title:e,right:t}){return(0,L.jsxs)(`div`,{className:`panel-header flex min-h-11 items-center justify-between border-b px-4`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium text-ink-dim`,children:e}),t]})}function ye(){return(0,L.jsx)(`span`,{className:`inline-block h-3 w-3 animate-spin rounded-full border-2 border-line border-t-blue`})}function be({children:e}){return(0,L.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-ink-faint`,children:e})}function xe({label:e,children:t,className:n=``}){let{t:r}=l();return(0,L.jsxs)(`details`,{className:`raw-disclosure mt-1 text-xs text-ink-faint ${n}`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer select-none hover:text-ink`,children:e??r(`common.showRaw`)}),t]})}function Se(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);try{r.href=n,r.download=t,document.body.appendChild(r),r.click()}finally{r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function Ce({themeMode:e,onCycleTheme:t}){let{locale:n,setLocale:r,t:i}=l(),a=i(`language.switchTo`,{language:i(n===`zh-CN`?`language.english`:`language.chinese`)}),o=i(`sidebar.theme`,{current:e,next:e===`light`?`dark`:`light`});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,"data-testid":`appearance-language`,onClick:()=>r(n===`zh-CN`?`en`:`zh-CN`),title:a,"aria-label":a,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(b,{size:18,strokeWidth:1.75,"aria-hidden":`true`})}),(0,L.jsx)(`button`,{type:`button`,"data-testid":`appearance-theme`,onClick:t,title:o,"aria-label":o,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(e===`light`?T:x,{size:18,strokeWidth:1.75,"aria-hidden":`true`})})]})}export{w as A,se as C,ie as D,E,_ as F,g as I,te as L,S as M,y as N,re as O,v as P,h as R,O as S,ae as T,z as _,be as a,D as b,ye as c,pe as d,me as f,K as g,q as h,ge as i,C as j,ne as k,he as l,fe as m,Se as n,ve as o,de as p,_e as r,xe as s,Ce as t,$ as u,I as v,oe as w,k as x,A as y}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AppearanceControls-DpaE5wy6.js b/frontend/web/dist/assets/AppearanceControls-DpaE5wy6.js new file mode 100644 index 000000000..ceddaad84 --- /dev/null +++ b/frontend/web/dist/assets/AppearanceControls-DpaE5wy6.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./motion-sqs9Ax-g.js","./rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]); +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,i,n as a,r as o,t as s}from"./markdown-BGG43fCg.js";import{N as c,O as l,t as u}from"./index-Dkv2HM-n.js";var d=e(n()),f=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),p=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),m={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ee=(0,d.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,d.createElement)(`svg`,{ref:c,...m,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:p(`lucide`,i),...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])),h=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(ee,{ref:i,iconNode:t,className:p(`lucide-${f(e)}`,n),...r}));return n.displayName=`${e}`,n},te=h(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),g=h(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),_=h(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),v=h(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),y=h(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),b=h(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),x=h(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),S=h(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),C=h(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),w=h(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),T=h(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ne=h(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),E={accent:`rgb(var(--blue))`,success:`rgb(var(--ok))`,error:`rgb(var(--err))`,warning:`rgb(var(--warn))`,info:`rgb(var(--blue))`,ink:`rgb(var(--ink))`,inkDim:`rgb(var(--ink-dim))`,inkFaint:`rgb(var(--ink-faint))`,role:{manager:`rgb(var(--role-manager))`,planner:`rgb(var(--role-planner))`,engineer:`rgb(var(--role-engineer))`,reviewer:`rgb(var(--role-reviewer))`}};function re(e){switch(e){case`bright`:return E.ink;case`dim`:return E.inkDim;case`accent`:return E.accent;case`ok`:return E.success;case`warn`:return E.warning;case`err`:return E.error;case`info`:return E.info}}function ie(e){switch(e){case`medium`:return E.inkDim;case`high`:return E.info;case`xhigh`:return E.accent;case`max`:return E.error;default:return E.inkFaint}}var D=[`manager`,`planner`,`engineer`,`reviewer`];function ae(e){return D.some(t=>t===e)}function oe(e,t){return t(`role.${e}`)}function se(e,t){return t(`role.${e}.description`)}function O(e){return E.role[e]??E.inkFaint}var k=[o,[a,{backslashDelimiters:!0,singleDollarTextMath:!1}]],A={output:`htmlAndMathml`},j={"\\Sha":`\\mathord{\\text{Ш}}`};function M({zh:e}){return(t,n)=>{let r=s({...A,macros:{...j}}),i=n.messages.length;r(t,n);let a=n.messages.slice(i).filter(e=>e.source===`rehype-katex`).length;a&&t.children.unshift({type:`element`,tagName:`div`,properties:{role:`note`,"data-math-error-count":a,className:[`my-2`,`rounded-md`,`border`,`border-line`,`px-3`,`py-2`,`text-xs`,`text-ink-dim`]},children:[{type:`text`,value:e?`有 ${a} 处公式暂时无法正确显示,原式已保留。`:`${a} formula${a===1?``:`s`} cannot currently be displayed correctly. The original expression${a===1?` is`:`s are`} preserved.`}]})}}function N(e){return[[M,{zh:e}]]}function P(){return(e,t)=>{s({...A,macros:{...j}})(e,t)}}var F=[P],I=t();async function L(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function R({text:e,label:t,copiedLabel:n,className:r=``}){let[i,a]=(0,d.useState)(!1),o=(0,d.useRef)();(0,d.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=async()=>{await L(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),1600))};return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>void s(),"aria-label":i?n:t,title:i?n:t,className:`inline-flex h-7 items-center gap-1 rounded-md border border-line/60 bg-panel/85 px-2 text-[10px] text-ink-faint shadow-sm backdrop-blur transition hover:border-blue/45 hover:text-blue focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue/50 ${r}`,children:[i?(0,I.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`m3.5 8.5 2.7 2.7 6.3-6.4`})}):(0,I.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:[(0,I.jsx)(`rect`,{x:`5.2`,y:`5.2`,width:`7.2`,height:`7.2`,rx:`1.2`}),(0,I.jsx)(`path`,{d:`M10.8 5.2V3.8a1.2 1.2 0 0 0-1.2-1.2H3.8a1.2 1.2 0 0 0-1.2 1.2v5.8a1.2 1.2 0 0 0 1.2 1.2h1.4`})]}),(0,I.jsx)(`span`,{children:i?n:t})]})}function z(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(z).join(``):(0,d.isValidElement)(e)?z(e.props.children):``}function B(e){let t=String(e||``).trim();try{t=decodeURIComponent(t)}catch{}if(/^sandbox:/i.test(t)&&(t=t.slice(8)),/^file:/i.test(t))try{let e=new URL(t);if(e.hostname&&e.hostname!==`localhost`)return``;t=e.pathname}catch{return``}else if(/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/^[a-z]:[\\/]/i.test(t))return``;for(t=t.split(`#`,1)[0].split(`?`,1)[0].replaceAll(`\\`,`/`),/^\/[a-z]:\//i.test(t)&&(t=t.slice(1));t.startsWith(`./`);)t=t.slice(2);return t.replace(/\/{2,}/g,`/`)}function V(e,t){return!e||!t?!1:/^[a-z]:\//i.test(e)||/^[a-z]:\//i.test(t)?e.toLowerCase()===t.toLowerCase():e===t}function H(e){if(e.startsWith(`#`))return``;let t=B(e);return/\.(?:md|markdown|txt|pdf|csv|tsv|json|html|png|jpe?g|svg|zip|pptx|xlsx)$/i.test(t)?t:``}function U(e,t=[],n=``){let r=B(e||``);if(!r)return null;let i=``;if(n&&!/^(?:\/|[a-z]:\/)/i.test(r)){let e=n.replaceAll(`\\`,`/`).split(`/`).slice(0,-1);for(let t of r.split(`/`))if(t===`..`){if(!e.length)return null;e.pop()}else t&&t!==`.`&&e.push(t);i=e.join(`/`)}let a=t.find(e=>V(i,B(e.path)));if(a)return a.path;for(let e of t){let t=B(e.path),n=B(e.storage_path||``);if(V(r,t)||V(r.replace(/^\//,``),t)||V(r,n))return e.path}return null}function W({src:e,alt:t,sid:n,path:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``);return(0,d.useEffect)(()=>{if(a(!1),s(``),!n||!r)return;let e=new AbortController,t=``;return c.artifactBlob(n,r,!1,e.signal).then(n=>{e.signal.aborted||(t=URL.createObjectURL(n),s(t))}).catch(()=>{e.signal.aborted||a(!0)}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[n,r,e]),i||!e?(0,I.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[`Image unavailable`,t?` · ${t}`:``]}):n&&r&&!o?(0,I.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t||`…`}):(0,I.jsx)(`img`,{src:n&&r?o:e,alt:t||``,loading:`lazy`,decoding:`async`,onError:()=>a(!0),className:`my-2 h-auto max-w-full rounded-lg`})}function G({children:e,artifacts:t=[],onOpenArtifact:n,basePath:a=``,sid:o}){let{t:s,locale:c}=l();return(0,I.jsx)(i,{remarkPlugins:k,rehypePlugins:N(c===`zh-CN`),urlTransform:(e,i)=>i===`href`&&n&&(U(e,t,a)||H(e))?e:r(e),components:{h1:({children:e})=>(0,I.jsx)(`h1`,{className:`mb-2 mt-3 text-base font-semibold text-ink first:mt-0`,children:e}),h2:({children:e})=>(0,I.jsx)(`h2`,{className:`mb-1.5 mt-3 text-sm font-semibold text-ink first:mt-0`,children:e}),h3:({children:e})=>(0,I.jsx)(`h3`,{className:`mb-1 mt-2 text-sm font-medium text-ink first:mt-0`,children:e}),p:({children:e})=>(0,I.jsx)(`p`,{className:`my-1.5 whitespace-pre-wrap break-words leading-[1.625] first:mt-0 last:mb-0`,children:e}),ul:({children:e})=>(0,I.jsx)(`ul`,{className:`my-2 list-disc space-y-1 pl-5`,children:e}),ol:({children:e})=>(0,I.jsx)(`ol`,{className:`my-2 list-decimal space-y-1 pl-5`,children:e}),li:({children:e})=>(0,I.jsx)(`li`,{className:`pl-0.5`,children:e}),blockquote:({children:e})=>(0,I.jsx)(`blockquote`,{className:`my-2 border-l border-blue/50 pl-3 text-ink-dim`,children:e}),hr:()=>(0,I.jsx)(`hr`,{className:`my-3 border-line/60`}),a:({href:e,title:r,children:i})=>{let o=U(e,t,a),s=o?t.find(e=>e.path===o):void 0;if(o&&n)return(0,I.jsx)(`a`,{href:e,"data-artifact-path":o,title:s?.storage_path||o,onClick:e=>{e.preventDefault(),n(o)},className:`cursor-pointer text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i});let l=H(e||``);if(n&&l){let e=a&&!/^(?:\/|[a-z]:\/)/i.test(l)?`${a.replaceAll(`\\`,`/`).split(`/`).slice(0,-1).join(`/`)}/${l}`.replace(/^\//,``):l;return(0,I.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:c===`zh-CN`?`查看文件;不存在或不允许访问时会显示原因`:`Preview file; unavailable files show an error`,className:`inline cursor-pointer text-left text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})}return(0,I.jsx)(`a`,{href:e,title:r,target:`_blank`,rel:`noreferrer`,className:`text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})},code:({className:e,children:t,...n})=>{let r=!!e||String(t).includes(` +`);return(0,I.jsx)(`code`,{...n,className:r?`block min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-ink ${e??``}`:`break-all rounded bg-bg px-1.5 py-0.5 font-mono text-xs text-ink`,children:t})},pre:({children:e})=>(0,I.jsxs)(`pre`,{className:`group/code relative my-2 max-w-full overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-line/50 bg-bg px-3 pb-3 pt-10`,children:[(0,I.jsx)(R,{text:d.Children.toArray(e).map(z).join(``),label:s(`copy.code`),copiedLabel:s(`copy.copied`),className:`absolute right-2 top-2`}),e]}),table:({children:e})=>(0,I.jsx)(`table`,{className:`my-2 w-full table-fixed border-collapse text-left text-xs`,children:e}),th:({children:e})=>(0,I.jsx)(`th`,{className:`break-words border border-line/60 bg-bg px-2 py-1.5 font-semibold text-ink`,children:e}),td:({children:e})=>(0,I.jsx)(`td`,{className:`break-words border border-line/60 px-2 py-1.5 align-top`,children:e}),strong:({children:e})=>(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:e}),img:({src:e,alt:n})=>(0,I.jsx)(W,{src:e,alt:n,sid:o,path:U(e,t,a)})},children:e})}var K={all:`(min-width: 0px)`,reduceMotion:`(prefers-reduced-motion: reduce)`};function q(e,t,n=[]){let r=(0,d.useRef)(t);r.current=t,(0,d.useEffect)(()=>{let t=!1,n=null;return u(()=>import(`./motion-sqs9Ax-g.js`).then(e=>e.t).then(i=>{if(t||!e.current)return;let a=i.gsap;n=a.matchMedia(),n.add(K,e=>r.current(a,!!e.conditions?.reduceMotion),e.current)}),__vite__mapDeps([0,1]),import.meta.url),()=>{t=!0,n?.revert()}},n)}var J=`input:not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), summary, [href], [tabindex]:not([tabindex="-1"])`,Y=[],X=()=>Y[Y.length-1],ce=e=>Array.from(e.querySelectorAll(J)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);function Z(e){(e.querySelector(`[data-autofocus]`)??e.querySelector(J)??e).focus()}function Q(e){let t=X();if(!t)return;if(e.key===`Escape`){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=ce(t.dialog),r=n[0],i=n[n.length-1];r?t.dialog.contains(document.activeElement)?e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()):(e.preventDefault(),(e.shiftKey?i:r).focus()):(e.preventDefault(),t.dialog.focus())}function le(e,t){let n={dialog:e,close:t,previous:document.activeElement instanceof HTMLElement?document.activeElement:null},r=Y.findIndex(t=>{let n=e.compareDocumentPosition(t.dialog);return!(n&Node.DOCUMENT_POSITION_DISCONNECTED)&&!!(n&Node.DOCUMENT_POSITION_FOLLOWING)});Y.splice(r<0?Y.length:r,0,n),Y.length===1&&window.addEventListener(`keydown`,Q);let i=window.requestAnimationFrame(()=>{X()===n&&Z(e)});return()=>{window.cancelAnimationFrame(i);let t=Y.indexOf(n);if(t<0)return;let r=X()===n;Y.splice(t,1);for(let t of Y)t.previous&&e.contains(t.previous)&&(t.previous=n.previous);Y.length||window.removeEventListener(`keydown`,Q);let a=document.activeElement,o=!a||a===document.body||!a.isConnected||e.contains(a);if(!r||!o)return;let s=X();n.previous?.isConnected&&(!s||s.dialog.contains(n.previous))?n.previous.focus():s&&Z(s.dialog)}}function ue({open:e,onClose:t,children:n,label:r,width:i=`max-w-2xl`,align:a=`center`,viewport:o=!1,showClose:s=!0,style:c}){let{t:u}=l(),f=(0,d.useRef)(null),p=(0,d.useRef)(null),m=(0,d.useRef)(t);return m.current=t,q(f,(t,n)=>{if(!(!e||!f.current||!p.current)){if(n){t.set([p.current,f.current],{clearProps:`all`});return}t.timeline({defaults:{overwrite:`auto`}}).fromTo(p.current,{autoAlpha:0},{autoAlpha:1,duration:.14,ease:`power1.out`},0).fromTo(f.current,{autoAlpha:0,y:a===`top`?-6:8,scale:.992},{autoAlpha:1,y:0,scale:1,duration:.2,ease:`power3.out`,clearProps:`transform,opacity,visibility`},.03)}},[e,a]),(0,d.useEffect)(()=>{if(!(!e||!f.current))return le(f.current,()=>m.current())},[e]),e?(0,I.jsxs)(`div`,{className:`fixed inset-0 z-50 flex ${a===`top`?`items-start pt-3 sm:pt-14`:`items-center`} justify-center ${o?`p-0`:`p-3 sm:p-4`}`,onPointerDown:t,children:[(0,I.jsx)(`div`,{ref:p,className:`modal-scrim absolute inset-0`}),(0,I.jsxs)(`div`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":r,tabIndex:-1,style:c,className:`brand-modal glass-panel glass-panel--raised relative z-10 w-full overscroll-contain ${i} scroll-thin ${o?`flex h-[100dvh] max-h-[100dvh] flex-col overflow-hidden rounded-none`:`max-h-[calc(100dvh-1.5rem)] overflow-x-hidden overflow-y-auto rounded-2xl sm:max-h-[88dvh]`}`,onPointerDown:e=>e.stopPropagation(),children:[!o&&s?(0,I.jsx)(`button`,{type:`button`,"data-modal-close":!0,onClick:t,"aria-label":u(`common.close`),className:`modal-close`,children:(0,I.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,I.jsx)(`path`,{d:`m4 4 8 8m0-8-8 8`})})}):null,n]})]}):null}function de({title:e,sub:t}){return(0,I.jsxs)(`div`,{className:`px-6 pb-3 pr-14 pt-5`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold tracking-[-0.01em] text-ink`,children:e}),t&&(0,I.jsx)(`p`,{className:`mt-1 text-sm text-ink-faint`,children:t})]})}var fe=(0,d.forwardRef)(function({className:e=``,...t},n){return(0,I.jsx)(`div`,{ref:n,className:`workbench-shell ambient-canvas flex w-screen max-w-full overflow-hidden text-ink ${e}`,...t})});function pe({className:e=``,...t}){return(0,I.jsx)(`header`,{className:`chrome-seam-surface glass-panel glass-panel--raised flex h-12 min-w-0 shrink-0 items-center gap-2 border-b px-3 sm:gap-3 sm:px-4 ${e}`,...t})}function $({mobileOpen:e=!1,collapsed:t=!1,className:n=``,...r}){let i=t&&!e;return(0,I.jsx)(`aside`,{"data-state":i?`collapsed`:`expanded`,"data-resizable-panel":`left`,className:`glass-panel glass-panel--side fixed inset-y-0 left-0 z-50 flex h-full shrink-0 flex-col border-r transition-[width,transform,visibility] duration-panel ease-panel lg:visible lg:static lg:z-auto lg:translate-x-0 ${i?`w-14`:`w-64 lg:w-[var(--sidebar-width,256px)]`} ${e?`visible translate-x-0`:`invisible -translate-x-full`} ${n}`,...r})}function me({ok:e,pulse:t=!1,title:n}){return(0,I.jsx)(`span`,{title:n,className:`inline-block h-1.5 w-1.5 rounded-full transition-shadow duration-150 ${e?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,"data-live":e&&t?`true`:void 0})}function he({children:e,color:t,className:n=``}){return(0,I.jsx)(`span`,{className:`chip text-ink-dim ${n}`,style:t?{color:t,borderColor:`${t}44`}:void 0,children:e})}function ge({children:e,onClick:t,variant:n=`ghost`,disabled:r,title:i,className:a=``,...o}){let s={ghost:`brand-button-ghost`,primary:`brand-button-primary`,danger:`brand-button-danger`};return(0,I.jsx)(`button`,{...o,type:`button`,title:i,disabled:r,onClick:t,className:`brand-button ${s[n]} ${a}`,children:e})}function _e({title:e,right:t}){return(0,I.jsxs)(`div`,{className:`panel-header flex min-h-11 items-center justify-between border-b px-4`,children:[(0,I.jsx)(`span`,{className:`text-sm font-medium text-ink-dim`,children:e}),t]})}function ve(){return(0,I.jsx)(`span`,{className:`inline-block h-3 w-3 animate-spin rounded-full border-2 border-line border-t-blue`})}function ye({children:e}){return(0,I.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-ink-faint`,children:e})}function be({label:e,children:t,className:n=``}){let{t:r}=l();return(0,I.jsxs)(`details`,{className:`raw-disclosure mt-1 text-xs text-ink-faint ${n}`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer select-none hover:text-ink`,children:e??r(`common.showRaw`)}),t]})}function xe(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);try{r.href=n,r.download=t,document.body.appendChild(r),r.click()}finally{r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function Se({themeMode:e,onCycleTheme:t}){let{locale:n,setLocale:r,t:i}=l(),a=i(`language.switchTo`,{language:i(n===`zh-CN`?`language.english`:`language.chinese`)}),o=i(`sidebar.theme`,{current:e,next:e===`light`?`dark`:`light`});return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,"data-testid":`appearance-language`,onClick:()=>r(n===`zh-CN`?`en`:`zh-CN`),title:a,"aria-label":a,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,I.jsx)(y,{size:18,strokeWidth:1.75,"aria-hidden":`true`})}),(0,I.jsx)(`button`,{type:`button`,"data-testid":`appearance-theme`,onClick:t,title:o,"aria-label":o,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,I.jsx)(e===`light`?w:b,{size:18,strokeWidth:1.75,"aria-hidden":`true`})})]})}export{C as A,oe as C,re as D,E,g as F,te as I,h as L,x as M,v as N,ne as O,_ as P,se as S,ie as T,R as _,ye as a,D as b,ve as c,fe as d,$ as f,G as g,q as h,he as i,S as j,T as k,me as l,de as m,xe as n,_e as o,ue as p,ge as r,be as s,Se as t,pe as u,F as v,ae as w,O as x,k as y}; \ No newline at end of file diff --git a/frontend/web/dist/assets/AppearanceControls-vjVM_spw.js b/frontend/web/dist/assets/AppearanceControls-vjVM_spw.js new file mode 100644 index 000000000..58192e206 --- /dev/null +++ b/frontend/web/dist/assets/AppearanceControls-vjVM_spw.js @@ -0,0 +1,3 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./motion-sqs9Ax-g.js","./rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]); +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,i,n as a,r as o,t as s}from"./markdown-D-35pK1E.js";import{P as c,k as l,t as u}from"./index-DbdG0NfU.js";var d=e(t()),f=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),p=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),m={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ee=(0,d.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,d.createElement)(`svg`,{ref:c,...m,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:p(`lucide`,i),...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])),h=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(ee,{ref:i,iconNode:t,className:p(`lucide-${f(e)}`,n),...r}));return n.displayName=`${e}`,n},te=h(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),g=h(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),_=h(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),v=h(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),y=h(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),b=h(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),x=h(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),S=h(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),C=h(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),w=h(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),T=h(`Sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),ne=h(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),re=h(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),E={accent:`rgb(var(--blue))`,success:`rgb(var(--ok))`,error:`rgb(var(--err))`,warning:`rgb(var(--warn))`,info:`rgb(var(--blue))`,ink:`rgb(var(--ink))`,inkDim:`rgb(var(--ink-dim))`,inkFaint:`rgb(var(--ink-faint))`,role:{manager:`rgb(var(--role-manager))`,planner:`rgb(var(--role-planner))`,engineer:`rgb(var(--role-engineer))`,reviewer:`rgb(var(--role-reviewer))`}};function ie(e){switch(e){case`bright`:return E.ink;case`dim`:return E.inkDim;case`accent`:return E.accent;case`ok`:return E.success;case`warn`:return E.warning;case`err`:return E.error;case`info`:return E.info}}function ae(e){switch(e){case`medium`:return E.inkDim;case`high`:return E.info;case`xhigh`:return E.accent;case`max`:return E.error;default:return E.inkFaint}}var D=[`manager`,`planner`,`engineer`,`reviewer`];function oe(e){return D.some(t=>t===e)}function se(e,t){return t(`role.${e}`)}function O(e,t){return t(`role.${e}.description`)}function k(e){return E.role[e]??E.inkFaint}var A=[o,[a,{backslashDelimiters:!0,singleDollarTextMath:!1}]],j={output:`htmlAndMathml`},M={"\\Sha":`\\mathord{\\text{Ш}}`};function N({zh:e}){return(t,n)=>{let r=s({...j,macros:{...M}}),i=n.messages.length;r(t,n);let a=n.messages.slice(i).filter(e=>e.source===`rehype-katex`).length;a&&t.children.unshift({type:`element`,tagName:`div`,properties:{role:`note`,"data-math-error-count":a,className:[`my-2`,`rounded-md`,`border`,`border-line`,`px-3`,`py-2`,`text-xs`,`text-ink-dim`]},children:[{type:`text`,value:e?`有 ${a} 处公式暂时无法正确显示,原式已保留。`:`${a} formula${a===1?``:`s`} cannot currently be displayed correctly. The original expression${a===1?` is`:`s are`} preserved.`}]})}}function P(e){return[[N,{zh:e}]]}function F(){return(e,t)=>{s({...j,macros:{...M}})(e,t)}}var I=[F],L=n();async function R(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function z({text:e,label:t,copiedLabel:n,className:r=``}){let[i,a]=(0,d.useState)(!1),o=(0,d.useRef)();(0,d.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=async()=>{await R(e)&&(a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),1600))};return(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void s(),"aria-label":i?n:t,title:i?n:t,className:`inline-flex h-7 items-center gap-1 rounded-md border border-line/60 bg-panel/85 px-2 text-[10px] text-ink-faint shadow-sm backdrop-blur transition hover:border-blue/45 hover:text-blue focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue/50 ${r}`,children:[i?(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`path`,{d:`m3.5 8.5 2.7 2.7 6.3-6.4`})}):(0,L.jsxs)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,children:[(0,L.jsx)(`rect`,{x:`5.2`,y:`5.2`,width:`7.2`,height:`7.2`,rx:`1.2`}),(0,L.jsx)(`path`,{d:`M10.8 5.2V3.8a1.2 1.2 0 0 0-1.2-1.2H3.8a1.2 1.2 0 0 0-1.2 1.2v5.8a1.2 1.2 0 0 0 1.2 1.2h1.4`})]}),(0,L.jsx)(`span`,{children:i?n:t})]})}function B(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(B).join(``):(0,d.isValidElement)(e)?B(e.props.children):``}function V(e){let t=String(e||``).trim();try{t=decodeURIComponent(t)}catch{}if(/^sandbox:/i.test(t)&&(t=t.slice(8)),/^file:/i.test(t))try{let e=new URL(t);if(e.hostname&&e.hostname!==`localhost`)return``;t=e.pathname}catch{return``}else if(/^[a-z][a-z0-9+.-]*:/i.test(t)&&!/^[a-z]:[\\/]/i.test(t))return``;for(t=t.split(`#`,1)[0].split(`?`,1)[0].replaceAll(`\\`,`/`),/^\/[a-z]:\//i.test(t)&&(t=t.slice(1));t.startsWith(`./`);)t=t.slice(2);return t.replace(/\/{2,}/g,`/`)}function H(e,t){return!e||!t?!1:/^[a-z]:\//i.test(e)||/^[a-z]:\//i.test(t)?e.toLowerCase()===t.toLowerCase():e===t}function U(e){if(e.startsWith(`#`))return``;let t=V(e);return/\.(?:md|markdown|txt|pdf|csv|tsv|json|html|png|jpe?g|svg|zip|pptx|xlsx)$/i.test(t)?t:``}function W(e,t=[],n=``){let r=V(e||``);if(!r)return null;let i=``;if(n&&!/^(?:\/|[a-z]:\/)/i.test(r)){let e=n.replaceAll(`\\`,`/`).split(`/`).slice(0,-1);for(let t of r.split(`/`))if(t===`..`){if(!e.length)return null;e.pop()}else t&&t!==`.`&&e.push(t);i=e.join(`/`)}let a=t.find(e=>H(i,V(e.path)));if(a)return a.path;for(let e of t){let t=V(e.path),n=V(e.storage_path||``);if(H(r,t)||H(r.replace(/^\//,``),t)||H(r,n))return e.path}return null}function G({src:e,alt:t,sid:n,path:r}){let[i,a]=(0,d.useState)(!1),[o,s]=(0,d.useState)(``);return(0,d.useEffect)(()=>{if(a(!1),s(``),!n||!r)return;let e=new AbortController,t=``;return c.artifactBlob(n,r,!1,e.signal).then(n=>{e.signal.aborted||(t=URL.createObjectURL(n),s(t))}).catch(()=>{e.signal.aborted||a(!0)}),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[n,r,e]),i||!e?(0,L.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[`Image unavailable`,t?` · ${t}`:``]}):n&&r&&!o?(0,L.jsx)(`span`,{className:`text-xs text-ink-faint`,children:t||`…`}):(0,L.jsx)(`img`,{src:n&&r?o:e,alt:t||``,loading:`lazy`,decoding:`async`,onError:()=>a(!0),className:`my-2 h-auto max-w-full rounded-lg`})}function K({children:e,artifacts:t=[],onOpenArtifact:n,basePath:a=``,sid:o}){let{t:s,locale:c}=l();return(0,L.jsx)(i,{remarkPlugins:A,rehypePlugins:P(c===`zh-CN`),urlTransform:(e,i)=>i===`href`&&n&&(W(e,t,a)||U(e))?e:r(e),components:{h1:({children:e})=>(0,L.jsx)(`h1`,{className:`mb-2 mt-3 text-base font-semibold text-ink first:mt-0`,children:e}),h2:({children:e})=>(0,L.jsx)(`h2`,{className:`mb-1.5 mt-3 text-sm font-semibold text-ink first:mt-0`,children:e}),h3:({children:e})=>(0,L.jsx)(`h3`,{className:`mb-1 mt-2 text-sm font-medium text-ink first:mt-0`,children:e}),p:({children:e})=>(0,L.jsx)(`p`,{className:`my-1.5 whitespace-pre-wrap break-words leading-[1.625] first:mt-0 last:mb-0`,children:e}),ul:({children:e})=>(0,L.jsx)(`ul`,{className:`my-2 list-disc space-y-1 pl-5`,children:e}),ol:({children:e})=>(0,L.jsx)(`ol`,{className:`my-2 list-decimal space-y-1 pl-5`,children:e}),li:({children:e})=>(0,L.jsx)(`li`,{className:`pl-0.5`,children:e}),blockquote:({children:e})=>(0,L.jsx)(`blockquote`,{className:`my-2 border-l border-blue/50 pl-3 text-ink-dim`,children:e}),hr:()=>(0,L.jsx)(`hr`,{className:`my-3 border-line/60`}),a:({href:e,title:r,children:i})=>{let o=W(e,t,a),s=o?t.find(e=>e.path===o):void 0;if(o&&n)return(0,L.jsx)(`a`,{href:e,"data-artifact-path":o,title:s?.storage_path||o,onClick:e=>{e.preventDefault(),n(o)},className:`cursor-pointer text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i});let l=U(e||``);if(n&&l){let e=a&&!/^(?:\/|[a-z]:\/)/i.test(l)?`${a.replaceAll(`\\`,`/`).split(`/`).slice(0,-1).join(`/`)}/${l}`.replace(/^\//,``):l;return(0,L.jsx)(`button`,{type:`button`,onClick:()=>n(e),title:c===`zh-CN`?`查看文件;不存在或不允许访问时会显示原因`:`Preview file; unavailable files show an error`,className:`inline cursor-pointer text-left text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})}return(0,L.jsx)(`a`,{href:e,title:r,target:`_blank`,rel:`noreferrer`,className:`text-blue underline decoration-blue/35 underline-offset-2 hover:decoration-blue`,children:i})},code:({className:e,children:t,...n})=>{let r=!!e||String(t).includes(` +`);return(0,L.jsx)(`code`,{...n,className:r?`block min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-ink ${e??``}`:`break-all rounded bg-bg px-1.5 py-0.5 font-mono text-xs text-ink`,children:t})},pre:({children:e})=>(0,L.jsxs)(`pre`,{className:`group/code relative my-2 max-w-full overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-line/50 bg-bg px-3 pb-3 pt-10`,children:[(0,L.jsx)(z,{text:d.Children.toArray(e).map(B).join(``),label:s(`copy.code`),copiedLabel:s(`copy.copied`),className:`absolute right-2 top-2`}),e]}),table:({children:e})=>(0,L.jsx)(`table`,{className:`my-2 w-full table-fixed border-collapse text-left text-xs`,children:e}),th:({children:e})=>(0,L.jsx)(`th`,{className:`break-words border border-line/60 bg-bg px-2 py-1.5 font-semibold text-ink`,children:e}),td:({children:e})=>(0,L.jsx)(`td`,{className:`break-words border border-line/60 px-2 py-1.5 align-top`,children:e}),strong:({children:e})=>(0,L.jsx)(`strong`,{className:`font-semibold text-ink`,children:e}),img:({src:e,alt:n})=>(0,L.jsx)(G,{src:e,alt:n,sid:o,path:W(e,t,a)})},children:e})}var ce={all:`(min-width: 0px)`,reduceMotion:`(prefers-reduced-motion: reduce)`};function q(e,t,n=[]){let r=(0,d.useRef)(t);r.current=t,(0,d.useEffect)(()=>{let t=!1,n=null;return u(()=>import(`./motion-sqs9Ax-g.js`).then(e=>e.t).then(i=>{if(t||!e.current)return;let a=i.gsap;n=a.matchMedia(),n.add(ce,e=>r.current(a,!!e.conditions?.reduceMotion),e.current)}),__vite__mapDeps([0,1]),import.meta.url),()=>{t=!0,n?.revert()}},n)}var J=`input:not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), summary, [href], [tabindex]:not([tabindex="-1"])`,Y=[],X=()=>Y[Y.length-1],le=e=>Array.from(e.querySelectorAll(J)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);function Z(e){(e.querySelector(`[data-autofocus]`)??e.querySelector(J)??e).focus()}function Q(e){let t=X();if(!t)return;if(e.key===`Escape`){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=le(t.dialog),r=n[0],i=n[n.length-1];r?t.dialog.contains(document.activeElement)?e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()):(e.preventDefault(),(e.shiftKey?i:r).focus()):(e.preventDefault(),t.dialog.focus())}function ue(e,t){let n={dialog:e,close:t,previous:document.activeElement instanceof HTMLElement?document.activeElement:null},r=Y.findIndex(t=>{let n=e.compareDocumentPosition(t.dialog);return!(n&Node.DOCUMENT_POSITION_DISCONNECTED)&&!!(n&Node.DOCUMENT_POSITION_FOLLOWING)});Y.splice(r<0?Y.length:r,0,n),Y.length===1&&window.addEventListener(`keydown`,Q);let i=window.requestAnimationFrame(()=>{X()===n&&Z(e)});return()=>{window.cancelAnimationFrame(i);let t=Y.indexOf(n);if(t<0)return;let r=X()===n;Y.splice(t,1);for(let t of Y)t.previous&&e.contains(t.previous)&&(t.previous=n.previous);Y.length||window.removeEventListener(`keydown`,Q);let a=document.activeElement,o=!a||a===document.body||!a.isConnected||e.contains(a);if(!r||!o)return;let s=X();n.previous?.isConnected&&(!s||s.dialog.contains(n.previous))?n.previous.focus():s&&Z(s.dialog)}}function de({open:e,onClose:t,children:n,label:r,width:i=`max-w-2xl`,align:a=`center`,viewport:o=!1,showClose:s=!0,style:c}){let{t:u}=l(),f=(0,d.useRef)(null),p=(0,d.useRef)(null),m=(0,d.useRef)(t);return m.current=t,q(f,(t,n)=>{if(!(!e||!f.current||!p.current)){if(n){t.set([p.current,f.current],{clearProps:`all`});return}t.timeline({defaults:{overwrite:`auto`}}).fromTo(p.current,{autoAlpha:0},{autoAlpha:1,duration:.14,ease:`power1.out`},0).fromTo(f.current,{autoAlpha:0,y:a===`top`?-6:8,scale:.992},{autoAlpha:1,y:0,scale:1,duration:.2,ease:`power3.out`,clearProps:`transform,opacity,visibility`},.03)}},[e,a]),(0,d.useEffect)(()=>{if(!(!e||!f.current))return ue(f.current,()=>m.current())},[e]),e?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 flex ${a===`top`?`items-start pt-3 sm:pt-14`:`items-center`} justify-center ${o?`p-0`:`p-3 sm:p-4`}`,onPointerDown:t,children:[(0,L.jsx)(`div`,{ref:p,className:`modal-scrim absolute inset-0`}),(0,L.jsxs)(`div`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":r,tabIndex:-1,style:c,className:`brand-modal glass-panel glass-panel--raised relative z-10 w-full overscroll-contain ${i} scroll-thin ${o?`flex h-[100dvh] max-h-[100dvh] flex-col overflow-hidden rounded-none`:`max-h-[calc(100dvh-1.5rem)] overflow-x-hidden overflow-y-auto rounded-2xl sm:max-h-[88dvh]`}`,onPointerDown:e=>e.stopPropagation(),children:[!o&&s?(0,L.jsx)(`button`,{type:`button`,"data-modal-close":!0,onClick:t,"aria-label":u(`common.close`),className:`modal-close`,children:(0,L.jsx)(`svg`,{viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m4 4 8 8m0-8-8 8`})})}):null,n]})]}):null}function fe({title:e,sub:t}){return(0,L.jsxs)(`div`,{className:`px-6 pb-3 pr-14 pt-5`,children:[(0,L.jsx)(`h2`,{className:`text-base font-semibold tracking-[-0.01em] text-ink`,children:e}),t&&(0,L.jsx)(`p`,{className:`mt-1 text-sm text-ink-faint`,children:t})]})}var pe=(0,d.forwardRef)(function({className:e=``,...t},n){return(0,L.jsx)(`div`,{ref:n,className:`workbench-shell ambient-canvas flex w-screen max-w-full overflow-hidden text-ink ${e}`,...t})});function $({className:e=``,...t}){return(0,L.jsx)(`header`,{className:`chrome-seam-surface glass-panel glass-panel--raised flex h-12 min-w-0 shrink-0 items-center gap-2 border-b px-3 sm:gap-3 sm:px-4 ${e}`,...t})}function me({mobileOpen:e=!1,collapsed:t=!1,className:n=``,...r}){let i=t&&!e;return(0,L.jsx)(`aside`,{"data-state":i?`collapsed`:`expanded`,"data-resizable-panel":`left`,className:`glass-panel glass-panel--side fixed inset-y-0 left-0 z-50 flex h-full shrink-0 flex-col border-r transition-[width,transform,visibility] duration-panel ease-panel lg:visible lg:static lg:z-auto lg:translate-x-0 ${i?`w-14`:`w-64 lg:w-[var(--sidebar-width,256px)]`} ${e?`visible translate-x-0`:`invisible -translate-x-full`} ${n}`,...r})}function he({ok:e,pulse:t=!1,title:n}){return(0,L.jsx)(`span`,{title:n,className:`inline-block h-1.5 w-1.5 rounded-full transition-shadow duration-150 ${e?`bg-ok ring-1 ring-ok/30 ring-offset-1 ring-offset-panel`:`bg-ink-faint/50`}`,"data-live":e&&t?`true`:void 0})}function ge({children:e,color:t,className:n=``}){return(0,L.jsx)(`span`,{className:`chip text-ink-dim ${n}`,style:t?{color:t,borderColor:`${t}44`}:void 0,children:e})}function _e({children:e,onClick:t,variant:n=`ghost`,disabled:r,title:i,className:a=``,...o}){let s={ghost:`brand-button-ghost`,primary:`brand-button-primary`,danger:`brand-button-danger`};return(0,L.jsx)(`button`,{...o,type:`button`,title:i,disabled:r,onClick:t,className:`brand-button ${s[n]} ${a}`,children:e})}function ve({title:e,right:t}){return(0,L.jsxs)(`div`,{className:`panel-header flex min-h-11 items-center justify-between border-b px-4`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium text-ink-dim`,children:e}),t]})}function ye(){return(0,L.jsx)(`span`,{className:`inline-block h-3 w-3 animate-spin rounded-full border-2 border-line border-t-blue`})}function be({children:e}){return(0,L.jsx)(`div`,{className:`px-3 py-6 text-center text-xs text-ink-faint`,children:e})}function xe({label:e,children:t,className:n=``}){let{t:r}=l();return(0,L.jsxs)(`details`,{className:`raw-disclosure mt-1 text-xs text-ink-faint ${n}`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer select-none hover:text-ink`,children:e??r(`common.showRaw`)}),t]})}function Se(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);try{r.href=n,r.download=t,document.body.appendChild(r),r.click()}finally{r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function Ce({themeMode:e,onCycleTheme:t}){let{locale:n,setLocale:r,t:i}=l(),a=i(`language.switchTo`,{language:i(n===`zh-CN`?`language.english`:`language.chinese`)}),o=i(`sidebar.theme`,{current:e,next:e===`light`?`dark`:`light`});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,"data-testid":`appearance-language`,onClick:()=>r(n===`zh-CN`?`en`:`zh-CN`),title:a,"aria-label":a,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(b,{size:18,strokeWidth:1.75,"aria-hidden":`true`})}),(0,L.jsx)(`button`,{type:`button`,"data-testid":`appearance-theme`,onClick:t,title:o,"aria-label":o,className:`icon-control flex h-8 w-8 shrink-0 items-center justify-center`,children:(0,L.jsx)(e===`light`?T:x,{size:18,strokeWidth:1.75,"aria-hidden":`true`})})]})}export{w as A,se as C,ie as D,E,_ as F,g as I,te as L,S as M,y as N,re as O,v as P,h as R,O as S,ae as T,z as _,be as a,D as b,ye as c,pe as d,me as f,K as g,q as h,ge as i,C as j,ne as k,he as l,fe as m,Se as n,ve as o,de as p,_e as r,xe as s,Ce as t,$ as u,I as v,oe as w,k as x,A as y}; \ No newline at end of file diff --git a/frontend/web/dist/assets/MapPanel-B8sBUMHd.js b/frontend/web/dist/assets/MapPanel-B8sBUMHd.js new file mode 100644 index 000000000..237553989 --- /dev/null +++ b/frontend/web/dist/assets/MapPanel-B8sBUMHd.js @@ -0,0 +1,7 @@ +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{D as n,E as r}from"./icons-DRlFT_ri.js";import{a as i,b as a,c as o,i as s}from"./query-CUzIxVzm.js";import{A as c,G as l,J as u,P as d,W as f,k as p}from"./index-Cb5-aRKO.js";import{A as m,F as h,I as g,L as _,O as v,R as y,j as b,m as x,p as S,r as C}from"./AppearanceControls-BNJdEiGG.js";import{n as w,t as T}from"./history-DuGaxgzd.js";import{n as E,t as D}from"./play-CBzqX6Qi.js";import{a as O}from"./format-CtVQGh59.js";import{a as k,i as A,n as j}from"./useWorkbenchTheme-Bu46ZOFm.js";import{$ as M,A as N,At as P,B as F,C as I,Ct as L,D as R,E as z,Et as B,F as ee,G as V,H,I as U,J as W,K as G,L as te,M as ne,N as re,Nt as ie,O as ae,Ot as K,P as oe,Pt as se,Q as ce,R as le,S as ue,St as de,T as fe,U as q,V as pe,X as me,Y as he,Z as ge,a as _e,at as ve,b as ye,bt as be,c as xe,ct as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,gt as Oe,ht as ke,i as Ae,it as je,j as Me,jt as Ne,k as Pe,kt as Fe,l as Ie,lt as Le,n as Re,nt as ze,o as Be,ot as Ve,p as J,pt as He,q as Ue,rt as We,s as Ge,st as Ke,tt as qe,u as Je,ut as Ye,vt as Xe,w as Ze,wt as Qe,x as $e,xt as et,yt as tt,z as nt}from"./App-D406npOP.js";var rt=y(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),it=y(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),at=y(`CornerDownLeft`,[[`polyline`,{points:`9 10 4 15 9 20`,key:`r3jprv`}],[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}]]),ot=y(`ListChecks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),st=y(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ct=y(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),lt=y(`Route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),ut=y(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),Y=r();function dt({events:e,connected:t,pending:n,artifacts:r,zh:i,onClose:a,onOpenArtifact:o,onOpenDelivery:s}){let l=e.filter(e=>e.type===`ui.operator`||e.type===`ui.argus`);return(0,Y.jsxs)(`aside`,{className:`map-conversation nowheel nodrag nopan`,"aria-label":i?`地图对话`:`Map conversation`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(L,{size:16}),(0,Y.jsx)(`strong`,{children:i?`与 ${c().name} 对话`:`Talk to ${c().name}`}),(0,Y.jsx)(`button`,{type:`button`,onClick:a,"aria-label":i?`关闭对话`:`Close conversation`,children:(0,Y.jsx)(v,{size:18})})]}),l.length?(0,Y.jsx)(J,{events:l,connected:t,showReasoning:!1,onToggleReasoning:()=>{},embedded:!0,showHeader:!1,artifacts:r,onOpenArtifact:o,onOpenDelivery:s}):(0,Y.jsx)(`p`,{className:`map-conversation-empty`,children:i?`在下方发送目标或问题,回复会保留在这里。`:`Send a goal or question below. Your conversation stays here.`}),n&&(0,Y.jsx)(`p`,{className:`map-conversation-pending`,role:`status`,children:i?`${c().name} 正在回复…`:`${c().name} is replying…`})]})}var X=e(n(),1),ft=u(),pt=(e,t,n)=>e+(t-e)*n,mt=e=>e*e*(3-2*e),ht=(e,t,n)=>Math.max(t,Math.min(n,e));function gt(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y),i=Math.min(140,Math.max(54,r*.22))*(t.x>=e.x?-1:1),a=Math.min(120,r*.3),o={x:ht(e.x+i,28,n-28),y:e.y-a},s={x:ht(t.x+i*.6,28,n-28),y:t.y+a};return n=>{let r=1-n;return{x:r**3*e.x+3*r**2*n*o.x+3*r*n**2*s.x+n**3*t.x,y:r**3*e.y+3*r**2*n*o.y+3*r*n**2*s.y+n**3*t.y}}}function _t({flight:e,canvas:t,zh:n,historical:r=!1,onReveal:i,onLand:a,onFinish:o}){let s=(0,X.useRef)(null),c=(0,X.useRef)(null),l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=`dispatch-wake-${(0,X.useId)().replace(/:/g,``)}`,f=(0,X.useRef)({onReveal:i,onLand:a,onFinish:o});f.current={onReveal:i,onLand:a,onFinish:o};let p=e.result?.type===`task`&&!r;return(0,X.useEffect)(()=>{if(!e.result)return;let n=0,i,a,o=()=>f.current.onFinish(e.id);if(e.result.type!==`task`||r)return i=setTimeout(o,2200),()=>clearTimeout(i);let d=s.current;if(!d)return;let p=e.result.taskId,m=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,h=t.current,g=()=>{cancelAnimationFrame(n),clearTimeout(i),f.current.onLand(e.id),o()};h?.addEventListener(`pointerdown`,g,{once:!0}),h?.addEventListener(`wheel`,g,{once:!0,passive:!0});let _=performance.now(),v=0,y=!1,b=0,x,S=r=>{if(r-_>6e3){o();return}let s=t.current?.querySelector(`.map-macro[data-task-id="${CSS.escape(p)}"]`);if(!s||s.getBoundingClientRect().width<8){r-v>600&&(f.current.onReveal(p),v=r),n=requestAnimationFrame(S);return}if(m){f.current.onLand(e.id),i=setTimeout(o,1200);return}y||(f.current.onReveal(p),y=!0,v=r);let h=s.getBoundingClientRect();if((!x||Math.abs(x.x-h.x)+Math.abs(x.y-h.y)+Math.abs(x.width-h.width)>.7)&&(b=r),x=h,r-v<360||r-b<100){n=requestAnimationFrame(S);return}let g=t.current?.querySelector(`.map-composer`)?.getBoundingClientRect(),C=g?{x:g.left,y:g.top,width:g.width,height:g.height}:e.origin,w={x:C.x+C.width/2,y:C.y+C.height/2},T={x:w.x,y:w.y-26},E={x:h.left+h.width/2,y:h.top+h.height/2},D=gt(T,E,innerWidth),O=Math.min(320,C.width),k=Math.min(68,C.height),A=performance.now(),j=!1,M=t=>{if(!s.isConnected){o();return}let r=Math.min(1,(t-A)/1050),p=mt(Math.min(1,r/.22)),m=mt(ht((r-.22)/.6,0,1)),h=mt(ht((r-.82)/.18,0,1)),g=r<.22?{x:w.x,y:pt(w.y,T.y,p)}:D(m),_=pt(52,22,h),v=pt(O,_,p),y=pt(k,_,p);if(d.style.width=`${v}px`,d.style.height=`${y}px`,d.style.transform=`translate3d(${g.x-v/2}px,${g.y-y/2}px,0)`,d.style.opacity=String(Math.min(1,r/.045)*(1-h)),d.style.setProperty(`--dispatch-copy`,String(1-mt(Math.min(1,r/.12)))),d.style.setProperty(`--dispatch-mark`,String(pt(1,.7,h))),d.dataset.phase=r<.22?`compress`:r<.82?`travel`:`arrive`,c.current&&l.current&&r>.22){let e=Math.max(0,m-.16),t=Array.from({length:13},(t,n)=>D(pt(e,m,n/12)));c.current.setAttribute(`d`,t.map((e,t)=>`${t?`L`:`M`} ${e.x} ${e.y}`).join(` `)),c.current.style.opacity=String(.7*(1-h)),l.current.setAttribute(`x1`,String(t[0].x)),l.current.setAttribute(`y1`,String(t[0].y)),l.current.setAttribute(`x2`,String(g.x)),l.current.setAttribute(`y2`,String(g.y))}r>=.82&&!j&&(j=!0,f.current.onLand(e.id),u.current&&(u.current.style.left=`${E.x}px`,u.current.style.top=`${E.y}px`,a=u.current.animate([{transform:`translate(-50%,-50%) scale(.65)`,opacity:.65},{transform:`translate(-50%,-50%) scale(2.8)`,opacity:0}],{duration:650,easing:`cubic-bezier(.16,1,.3,1)`,fill:`both`}))),r<1?n=requestAnimationFrame(M):i=setTimeout(o,550)};n=requestAnimationFrame(M)};return n=requestAnimationFrame(S),()=>{cancelAnimationFrame(n),clearTimeout(i),a?.cancel(),h?.removeEventListener(`pointerdown`,g),h?.removeEventListener(`wheel`,g)}},[e.id,e.result,t,r]),p?(0,ft.createPortal)((0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`svg`,{className:`map-dispatch-trail`,"aria-hidden":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{ref:l,id:d,gradientUnits:`userSpaceOnUse`,children:[(0,Y.jsx)(`stop`,{stopColor:`#6fbcce`,stopOpacity:`0`}),(0,Y.jsx)(`stop`,{offset:`1`,stopColor:`#87d9cf`})]})}),(0,Y.jsx)(`path`,{ref:c,fill:`none`,stroke:`url(#${d})`,strokeWidth:`2.5`,strokeLinecap:`round`})]}),(0,Y.jsxs)(`div`,{ref:s,className:`map-dispatch-flight`,"data-testid":`map-dispatch-flight`,"data-state":`task`,"data-task-id":e.result?.type===`task`?e.result.taskId:void 0,"aria-hidden":`true`,children:[(0,Y.jsx)(`div`,{className:`map-dispatch-symbol`,children:(0,Y.jsx)(j,{size:25})}),(0,Y.jsxs)(`div`,{className:`map-dispatch-copy`,children:[(0,Y.jsx)(`strong`,{children:e.text}),(0,Y.jsx)(`span`,{children:n?`进入任务地图`:`Into your task map`})]})]}),(0,Y.jsx)(`div`,{ref:u,className:`map-dispatch-halo`,"aria-hidden":`true`})]}),document.body):null}var vt=()=>({revision:0,cards:{},steps:{},links:{}}),yt=(e,t)=>`${e}\u0000${t}`,bt=class{initialized=!1;seen=new Set;revision=0;loadingHistory=!1;observe(e,t=!1){let n=vt(),r=0;for(let t of e.cards){this.seen.has(`card:${t.id}`)||(n.cards[t.id]=Math.min(r++*100,400)),this.seen.add(`card:${t.id}`);let i=e.layouts[t.id],a=0;for(let e of i.steps){let r=yt(t.id,e.id);this.seen.has(`step:${r}`)||(n.steps[r]=160+Math.min(a++*120,720)),this.seen.add(`step:${r}`)}for(let e of i.links){let r=yt(t.id,e.id);this.seen.has(`link:${r}`)||(n.links[r]=Math.max(0,(n.steps[yt(t.id,e.target)]??160)-160)),this.seen.add(`link:${r}`)}}for(let t of e.links)this.seen.has(`outer:${t.id}`)||(n.links[t.id]=0),this.seen.add(`outer:${t.id}`);let i=!this.initialized||t||this.loadingHistory;return this.loadingHistory=t,this.initialized=!0,i||![n.cards,n.steps,n.links].some(e=>Object.keys(e).length)?null:{...n,revision:++this.revision}}};function xt(e,t=!1){let n=(0,X.useRef)(new bt),r=(0,X.useRef)(new Set),[i,a]=(0,X.useState)(vt);return(0,X.useEffect)(()=>{let i=n.current.observe(e,t);if(t)r.current.forEach(clearTimeout),r.current.clear(),a(vt());else if(i){a(e=>({revision:i.revision,cards:{...e.cards,...i.cards},steps:{...e.steps,...i.steps},links:{...e.links,...i.links}}));let e=setTimeout(()=>{r.current.delete(e),a(e=>({revision:e.revision,cards:Object.fromEntries(Object.entries(e.cards).filter(([e])=>!(e in i.cards))),steps:Object.fromEntries(Object.entries(e.steps).filter(([e])=>!(e in i.steps))),links:Object.fromEntries(Object.entries(e.links).filter(([e])=>!(e in i.links)))}))},2e3);r.current.add(e)}},[e,t]),(0,X.useEffect)(()=>()=>{r.current.forEach(clearTimeout),r.current.clear()},[]),i}var St=e=>1-(1-e)**3;function Ct(e,t,n){let r=St(Math.min(1,Math.max(0,n))),i={};for(let n in t){let a=e[n],o=t[n];i[n]=!a||r>=1?o:{x:a.x+(o.x-a.x)*r,y:a.y+(o.y-a.y)*r}}return i}function wt(e,t){for(let n in t){let r=e[n];if(r&&(r.x!==t[n].x||r.y!==t[n].y))return!0}return!1}function Tt(e,t,n=680){let[r,i]=(0,X.useState)(e),a=(0,X.useRef)(e),o=(0,X.useRef)(e);return(0,X.useEffect)(()=>{if(e===o.current)return;o.current=e;let r=a.current;if(t||!wt(r,e)||typeof requestAnimationFrame!=`function`){a.current=e,i(e);return}let s=null,c=performance.now(),l=t=>{let o=(t-c)/n;if(o>=1){a.current=e,i(e),s=null;return}a.current=Ct(r,e,o),i(a.current),s=requestAnimationFrame(l)};return s=requestAnimationFrame(l),()=>{s!=null&&cancelAnimationFrame(s)}},[e,t,n]),r}var Et={edges:new Set,nodes:new Set};function Dt(e,t){if(!t)return Et;let n=new Set,r=new Set([t]);for(let i of e)(i.source===t||i.target===t)&&(n.add(i.id),r.add(i.source),r.add(i.target));return{edges:n,nodes:r}}var Ot=2600,kt=e=>Math.min(Math.max(e-1,0),10)*80,At=e=>kt(e)+320;function jt(e,t){let n=Math.max(0,Math.floor(e));if(n<60)return t?`${n} 秒`:`${n}s`;let r=Math.floor(n/60);if(r<60)return t?`${r} 分钟`:`${r} min`;let i=Math.floor(r/60),a=r%60;return t?`${i} 小时 ${a} 分`:`${i} h ${String(a).padStart(2,`0`)} min`}function Mt(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n{}};function Pt(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Ft.prototype=Pt.prototype={constructor:Ft,on:function(e,t){var n=this._,r=It(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Rt.hasOwnProperty(t)?{space:Rt[t],local:e}:e}function Bt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Vt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ht(e){var t=zt(e);return(t.local?Vt:Bt)(t)}function Ut(){}function Wt(e){return e==null?Ut:function(){return this.querySelector(e)}}function Gt(e){typeof e!=`function`&&(e=Wt(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i=v&&(v=_+1);!(b=g[v])&&++v=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Sn(e){e||=Cn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;at?1:e>=t?0:NaN}function wn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Tn(){return Array.from(this)}function En(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Rn:typeof t==`function`?Bn:zn)(e,t,n??``)):Hn(this.node(),e)}function Hn(e,t){return e.style.getPropertyValue(t)||Ln(e).getComputedStyle(e,null).getPropertyValue(t)}function Un(e){return function(){delete this[e]}}function Wn(e,t){return function(){this[e]=t}}function Gn(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Kn(e,t){return arguments.length>1?this.each((t==null?Un:typeof t==`function`?Gn:Wn)(e,t)):this.node()[e]}function qn(e){return e.trim().split(/^|\s+/)}function Jn(e){return e.classList||new Yn(e)}function Yn(e){this._node=e,this._names=qn(e.getAttribute(`class`)||``)}Yn.prototype={add:function(e){this._names.indexOf(e)<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 Xn(e,t){for(var n=Jn(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Tr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n()=>e;function qr(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){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:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}qr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Jr(e){return!e.ctrlKey&&!e.button}function Yr(){return this.parentNode}function Xr(e,t){return t??{x:e.x,y:e.y}}function Zr(){return navigator.maxTouchPoints||`ontouchstart`in this}function Qr(){var e=Jr,t=Yr,n=Xr,r=Zr,i={},a=Pt(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Br).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(Lr(n.view).on(`mousemove.drag`,m,Vr).on(`mouseup.drag`,h,Vr),Wr(n.view),Hr(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Ur(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){Lr(e.view).on(`mousemove.drag mouseup.drag`,null),Gr(e.view,l),Ur(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?xi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?xi(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=ci.exec(e))?new wi(t[1],t[2],t[3],1):(t=li.exec(e))?new wi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ui.exec(e))?xi(t[1],t[2],t[3],t[4]):(t=di.exec(e))?xi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fi.exec(e))?ji(t[1],t[2]/100,t[3]/100,1):(t=pi.exec(e))?ji(t[1],t[2]/100,t[3]/100,t[4]):mi.hasOwnProperty(e)?bi(mi[e]):e===`transparent`?new wi(NaN,NaN,NaN,0):null}function bi(e){return new wi(e>>16&255,e>>8&255,e&255,1)}function xi(e,t,n,r){return r<=0&&(e=t=n=NaN),new wi(e,t,n,r)}function Si(e){return e instanceof ti||(e=yi(e)),e?(e=e.rgb(),new wi(e.r,e.g,e.b,e.opacity)):new wi}function Ci(e,t,n,r){return arguments.length===1?Si(e):new wi(e,t,n,r??1)}function wi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}$r(wi,Ci,ei(ti,{brighter(e){return e=e==null?ri:ri**+e,new wi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ni:ni**+e,new wi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wi(ki(this.r),ki(this.g),ki(this.b),Oi(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:Ti,formatHex:Ti,formatHex8:Ei,formatRgb:Di,toString:Di}));function Ti(){return`#${Ai(this.r)}${Ai(this.g)}${Ai(this.b)}`}function Ei(){return`#${Ai(this.r)}${Ai(this.g)}${Ai(this.b)}${Ai((isNaN(this.opacity)?1:this.opacity)*255)}`}function Di(){let e=Oi(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ki(this.r)}, ${ki(this.g)}, ${ki(this.b)}${e===1?`)`:`, ${e})`}`}function Oi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ki(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ai(e){return e=ki(e),(e<16?`0`:``)+e.toString(16)}function ji(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Pi(e,t,n,r)}function Mi(e){if(e instanceof Pi)return new Pi(e.h,e.s,e.l,e.opacity);if(e instanceof ti||(e=yi(e)),!e)return new Pi;if(e instanceof Pi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Pi(o,s,c,e.opacity)}function Ni(e,t,n,r){return arguments.length===1?Mi(e):new Pi(e,t,n,r??1)}function Pi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}$r(Pi,Ni,ei(ti,{brighter(e){return e=e==null?ri:ri**+e,new Pi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ni:ni**+e,new Pi(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,i=2*n-r;return new wi(Li(e>=240?e-240:e+120,i,r),Li(e,i,r),Li(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pi(Fi(this.h),Ii(this.s),Ii(this.l),Oi(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(){let e=Oi(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Fi(this.h)}, ${Ii(this.s)*100}%, ${Ii(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Fi(e){return e=(e||0)%360,e<0?e+360:e}function Ii(e){return Math.max(0,Math.min(1,e||0))}function Li(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Ri=e=>()=>e;function zi(e,t){return function(n){return e+n*t}}function Bi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Vi(e){return(e=+e)==1?Hi:function(t,n){return n-t?Bi(t,n,e):Ri(isNaN(t)?n:t)}}function Hi(e,t){var n=t-e;return n?zi(e,n):Ri(isNaN(e)?t:e)}var Ui=(function e(t){var n=Vi(t);function r(e,t){var r=n((e=Ci(e)).r,(t=Ci(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Hi(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Wi(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Ji(r,i)})),n=Zi.lastIndex;return n180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Ji(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Ji(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Ji(e,n)},{i:s-2,x:Ji(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t=0&&e._call.call(void 0,t),e=e._next;--ga}function Ma(){Ca=(Sa=Ta.now())+wa,ga=_a=0;try{ja()}finally{ga=0,Pa(),Ca=0}}function Na(){var e=Ta.now(),t=e-Sa;t>ya&&(wa-=t,Sa=e)}function Pa(){for(var e,t=ba,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:ba=n);xa=e,Fa(r)}function Fa(e){ga||(_a&&=clearTimeout(_a),e-Ca>24?(e<1/0&&(_a=setTimeout(Ma,e-Ta.now()-wa)),va&&=clearInterval(va)):(va||=(Sa=Ta.now(),setInterval(Na,ya)),ga=1,Ea(Ma)))}function Ia(e,t,n){var r=new ka;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var La=Pt(`start`,`end`,`cancel`,`interrupt`),Ra=[];function za(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Ua(e,n,{name:t,index:r,group:i,on:La,tween:Ra,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ba(e,t){var n=Ha(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Va(e,t){var n=Ha(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function Ha(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Ua(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Aa(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Ia(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Ga(e){return this.each(function(){Wa(this,e)})}function Ka(e,t){var n,r;return function(){var i=Va(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o=0&&(e=e.slice(0,t)),!e||e===`start`})}function Co(e,t,n){var r,i,a=So(t)?Ba:Va;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function wo(e,t){var n=this._id;return arguments.length<2?Ha(this.node(),n).on.on(e):this.each(Co(n,e,t))}function To(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Eo(){return this.on(`end.remove`,To(this._id))}function Do(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Wt(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o()=>e;function rs(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function is(e,t,n){this.k=e,this.x=t,this.y=n}is.prototype={constructor:is,scale:function(e){return e===1?this:new is(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new is(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 as=new is(1,0,0);os.prototype=is.prototype;function os(e){for(;!e.__zoom;)if(!(e=e.parentNode))return as;return e.__zoom}function ss(e){e.stopImmediatePropagation()}function cs(e){e.preventDefault(),e.stopImmediatePropagation()}function ls(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function us(){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 ds(){return this.__zoom||as}function fs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ps(){return navigator.maxTouchPoints||`ontouchstart`in this}function ms(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function hs(){var e=ls,t=us,n=ms,r=fs,i=ps,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ha,l=Pt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,ds).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,ds),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(as.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new is(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new is(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new is(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Lr(this.that).datum();l.call(e,this.that,new rs(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=zr(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Wa(this),s.start();cs(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Lr(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=zr(t,i),l=t.clientX,u=t.clientY;Wr(t.view),ss(t),a.mouse=[c,this.__zoom.invert(c)],Wa(this),a.start();function d(e){if(cs(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=zr(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Gr(e.view,a.moved),cs(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=zr(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);cs(r),s>0?Lr(this).transition().duration(s).call(x,d,c,r):Lr(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(ss(t),s=0;s`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} 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.`},_s=[[-1/0,-1/0],[1/0,1/0]],vs=[`Enter`,` `,`Escape`],ys={"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`},bs;(function(e){e.Strict=`strict`,e.Loose=`loose`})(bs||={});var xs;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(xs||={});var Ss;(function(e){e.Partial=`partial`,e.Full=`full`})(Ss||={});var Cs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ws;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(ws||={});var Ts;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Ts||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var Es={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function Ds(e){return e===null?null:e?`valid`:`invalid`}var Os=e=>`id`in e&&`source`in e&&`target`in e,ks=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),As=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),js=(e,t=[0,0])=>{let{width:n,height:r}=dc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ms=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:qs(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):As(n)?n:t.nodeLookup.get(n.id)),Gs(e,i?Ys(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Ns=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Gs(n,Ys(e)),r=!0)}),r?qs(n):{x:0,y:0,width:0,height:0}},Ps=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=Zs(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Fs=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Is(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Ls({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=cc(Ns(Is(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function Rs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,gs.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&uc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=uc(d)?Vs(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,gs.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function zs({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Fs(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var Bs=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Vs=(e={x:0,y:0},t,n)=>({x:Bs(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Bs(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hs(e,t,n){let{width:r,height:i}=dc(n),{x:a,y:o}=n.internals.positionAbsolute;return Vs(e,[[a,o],[a+r,o+i]],t)}var Us=(e,t,n)=>en?-Bs(Math.abs(e-n),1,t)/t:0,Ws=(e,t,n=15,r=40)=>[Us(e.x,r,t.width-r)*n,Us(e.y,r,t.height-r)*n],Gs=(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)}),Ks=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),qs=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Js=(e,t=[0,0])=>{let{x:n,y:r}=As(e)?e.internals.positionAbsolute:js(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ys=(e,t=[0,0])=>{let{x:n,y:r}=As(e)?e.internals.positionAbsolute:js(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Xs=(e,t)=>qs(Gs(Ks(e),Ks(t))),Zs=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},Qs=(e,t)=>Zs(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),$s=e=>ec(e.width)&&ec(e.height)&&ec(e.x)&&ec(e.y),ec=e=>!isNaN(e)&&isFinite(e),tc=(e,t)=>(e,t)=>{},nc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),rc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?nc(s,o):s},ic=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ac(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let 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 oc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=ac(e,n),i=ac(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=ac(e.top??e.y??0,n),i=ac(e.bottom??e.y??0,n),a=ac(e.left??e.x??0,t),o=ac(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function sc(e,t,n,r,i,a){let{x:o,y:s}=ic(e,[t,n,r]),{x:c,y:l}=ic({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var cc=(e,t,n,r,i,a)=>{let o=oc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=Bs(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=sc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},lc=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function uc(e){return e!=null&&e!==`parent`}function dc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function fc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function pc(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function mc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function hc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function gc(e){return{...ys,...e||{}}}function _c(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Cc(e),s=rc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?nc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var vc=e=>({width:e.offsetWidth,height:e.offsetHeight}),yc=e=>e?.getRootNode?.()||window?.document,bc=[`INPUT`,`SELECT`,`TEXTAREA`];function xc(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?bc.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Sc=e=>`clientX`in e,Cc=(e,t)=>{let n=Sc(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},wc=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...vc(t)}})};function Tc({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Ec(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Dc({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Ec(t-r,a),n];case Q.Right:return[t+Ec(r-t,a),n];case Q.Top:return[t,n-Ec(n-i,a)];case Q.Bottom:return[t,n+Ec(i-n,a)]}}function Oc({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Dc({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Dc({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Tc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function kc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n0}var Mc=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Nc=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Pc=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,gs.error006()),t;let r=n.getEdgeId||Mc,i;return i=Os(e)?{...e}:{...e,id:r(e)},Nc(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Fc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=kc({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Ic={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},Lc=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.xMath.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function zc({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=Ic[t],c=Ic[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Lc({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=kc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Bc(e,t,n,r){let i=Math.min(Rc(e,t)/2,Rc(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.xe.id===t):e[0])||null}function qc(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Jc(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=qc(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var Yc=1e3,Xc=10,Zc={nodeOrigin:[0,0],nodeExtent:_s,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Qc={...Zc,checkEquality:!0};function $c(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function el(e,t,n){let r=$c(Zc,n);for(let n of e.values())if(n.parentId)al(n,e,t,r);else{let e=Vs(js(n,r.nodeOrigin),uc(n.extent)?n.extent:r.nodeExtent,dc(n));n.internals.positionAbsolute=e}}function tl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function nl(e){return e===`manual`}function rl(e,t,n,r={}){let i=$c(Qc,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!nl(i.zIndexMode)?Yc:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=Vs(js(u,i.nodeOrigin),uc(u.extent)?u.extent:i.nodeExtent,dc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:tl(u,e),z:ol(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&al(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function il(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function al(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=$c(Zc,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}il(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*Xc),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=sl(e,u,o,s,a&&!nl(c)?Yc:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function ol(e,t,n){let r=ec(e.zIndex)?e.zIndex:0;return nl(n)?r:r+(e.selected?t:0)}function sl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=dc(e),l=js(e,n),u=uc(e.extent)?Vs(l,e.extent,c):l,d=Vs({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Hs(d,c,t));let f=ol(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function cl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=Xs(a.get(n.parentId)?.expandedRect??Js(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=dc(a),l=a.origin??r,u=t.x0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width0){let e=cl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function ul({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function dl(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function fl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;dl(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),dl(`target`,s,c,e,i,o),t.set(r.id,r)}}function pl(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:pl(n,t):!1}function ml(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function hl(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!pl(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function gl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function _l({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=nc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function vl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=Lr(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Ks(Ns(s)):null,x=v&&l?_l({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:nc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=Rs({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=gl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Ws(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=_c(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=hl(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=gl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Qr().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=_c(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Cc(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=_c(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Cc(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Cc(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=gl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!ml(t,`.${g}`,v))&&(!_||ml(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function yl(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())Qs(i,Js(e))>0&&r.push(e);return r}var bl=250;function xl(e,t,n,r){let i=[],a=1/0,o=yl(e,n,t+bl);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Gc(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function Sl(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Gc(o,c,c.position,!0)}:c}function Cl(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function wl(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Tl=()=>!0;function El(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Tl,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=yc(e.target),E=0,D,{x:O,y:k}=Cc(e),A=Cl(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=Sl(i,A,r,c,t);if(!N)return;let P=Cc(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=Ws(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},ee=c.get(i),V={inProgress:!0,isValid:null,from:Gc(ee,B,Q.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:ee,to:P,toHandle:null,toPosition:Es[B.position],toNode:null,pointer:P};function H(){M=!0,y(V),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&H();function U(e){if(!M){let{x:t,y:n}=Cc(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;H()}if(!x()||!B){W(e);return}let a=b();P=Cc(e,j),D=xl(rc(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=Dl(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=wl(!!D,s.isValid);let u=c.get(i),f=u?Gc(u,B,Q.Left,!0):V.from,p={...V,from:f,isValid:L,to:s.toHandle&&L?ic({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:Es[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),V=p}function W(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,U),T.removeEventListener(`mouseup`,W),T.removeEventListener(`touchmove`,U),T.removeEventListener(`touchend`,W)}}T.addEventListener(`mousemove`,U),T.addEventListener(`mouseup`,W),T.addEventListener(`touchmove`,U),T.addEventListener(`touchend`,W)}function Dl(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Tl,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Cc(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=Cl(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===bs.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=Sl(t,e,a,u,n,!0)}return _}var Ol={onPointerDown:El,isValid:Dl};function kl({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Lr(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&lc()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=hs().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:zr}}var Al=e=>({x:e.x,y:e.y,zoom:e.k}),jl=({x:e,y:t,zoom:n})=>as.translate(e,t).scale(n),Ml=(e,t)=>e.target.closest(`.${t}`),Nl=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Pl=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Fl=(e,t=0,n=Pl,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Il=e=>{let t=e.ctrlKey&&lc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ll({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Ml(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=zr(u),t=d*2**Il(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===xs.Vertical?0:u.deltaX*f,m=i===xs.Horizontal?0:u.deltaY*f;!lc()&&u.shiftKey&&i!==xs.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=Al(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function Rl({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=Ml(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function zl({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Al(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function Bl({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Nl(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,Al(a.transform))}}function Vl({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Nl(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=Al(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Hl({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(Ml(d,`${l}-flow__node`)||Ml(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||Ml(d,s)&&m||Ml(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function Ul({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=hs().scaleExtent([t,n]).translateExtent(r),f=Lr(e).call(d);v({x:i.x,y:i.y,zoom:Bs(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(Il);async function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).transform(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!ec(E)||E<0?0:E);let k=O?Ll({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Rl({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});f.on(`wheel.zoom`,k,{passive:!1});let A=zl({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,A);let j=Bl({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,j);let M=Vl({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,M);let N=Hl({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(N),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=jl(e),i=d?.constrain()(r,t,n);return i&&await h(i),i}async function y(e,t){let n=jl(e);return await h(n,t),n}function b(e){if(f){let t=jl(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?os(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).scaleTo(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).scaleBy(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!ec(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var Wl;(function(e){e.Line=`line`,e.Handle=`handle`})(Wl||={});function Gl({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function Kl(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function ql(e,t){return Math.max(0,t-e)}function Jl(e,t){return Math.max(0,e-t)}function Yl(e,t,n){return Math.max(0,t-e,e-n)}function Xl(e,t){return e?!t:t}function Zl(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=Yl(E,h,g),j=Yl(D,_,v);if(o){let e=0,t=0;c&&w<0?e=ql(y+w+O,o[0][0]):!c&&w>0&&(e=Jl(y+E+O,o[1][0])),l&&T<0?t=ql(b+T+k,o[0][1]):!l&&T>0&&(t=Jl(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Jl(y+w,s[0][0]):!c&&w<0&&(e=ql(y+E,s[1][0])),l&&T>0?t=Jl(b+T,s[0][1]):!l&&T<0&&(t=ql(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=Yl(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Jl(b+k+E/C,o[1][1])*C:ql(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?ql(b+E/C,s[1][1])*C:Jl(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=Yl(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Jl(y+D*C+O,o[1][0])/C:ql(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?ql(y+D*C,s[1][0])/C:Jl(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(Xl(c,l)?-w:w)/C:w=(Xl(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Ql={width:0,height:0,x:0,y:0},$l={...Ql,pointerX:0,pointerY:0,aspectRatio:1};function eu(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function tu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=Lr(e),o={controlDirection:Kl(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Ql},h={...$l};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:Kl(e)};let g,_=null,v=[],y,b,x,S=!1,C=Qr().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=_c(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=uc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=eu(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=_c(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=Zl(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var nu=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ru=t(((e,t)=>{t.exports=nu()})),iu=t((e=>{var t=n(),r=ru();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),au=e(t(((e,t)=>{t.exports=iu()}))(),1),ou=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},su=e=>e?ou(e):ou,{useDebugValue:cu}=X.default,{useSyncExternalStoreWithSelector:lu}=au.default,uu=e=>e;function du(e,t=uu,n){let r=lu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return cu(r),r}var fu=(e,t)=>{let n=su(e),r=(e,r=t)=>du(n,e,r);return Object.assign(r,n),r},pu=(e,t)=>e?fu(e,t):fu;function mu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var hu=(0,X.createContext)(null),gu=hu.Provider,_u=gs.error001(`react`);function $(e,t){let n=(0,X.useContext)(hu);if(n===null)throw Error(_u);return du(n,e,t)}function vu(){let e=(0,X.useContext)(hu);if(e===null)throw Error(_u);return(0,X.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var yu={display:`none`},bu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},xu=`react-flow__node-desc`,Su=`react-flow__edge-desc`,Cu=`react-flow__aria-live`,wu=e=>e.ariaLiveMessage,Tu=e=>e.ariaLabelConfig;function Eu({rfId:e}){let t=$(wu);return(0,Y.jsx)(`div`,{id:`${Cu}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:bu,children:t})}function Du({rfId:e,disableKeyboardA11y:t}){let n=$(Tu);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{id:`${xu}-${e}`,style:yu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Y.jsx)(`div`,{id:`${Su}-${e}`,style:yu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Y.jsx)(Eu,{rfId:e})]})}var Ou=(0,X.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,Y.jsx)(`div`,{className:Mt([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Ou.displayName=`Panel`;var ku=`https://reactflow.dev?utm_source=attribution`;function Au({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Y.jsx)(Ou,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ku}`,children:(0,Y.jsx)(`a`,{href:ku,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var ju=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Mu=e=>e.id;function Nu(e,t){return mu(e.selectedNodes.map(Mu),t.selectedNodes.map(Mu))&&mu(e.selectedEdges.map(Mu),t.selectedEdges.map(Mu))}function Pu({onSelectionChange:e}){let t=vu(),{selectedNodes:n,selectedEdges:r}=$(ju,Nu);return(0,X.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Fu=e=>!!e.onSelectionChangeHandlers;function Iu({onSelectionChange:e}){let t=$(Fu);return e||t?(0,Y.jsx)(Pu,{onSelectionChange:e}):null}var Lu=[0,0],Ru={x:0,y:0,zoom:1},zu=[...`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`.split(`.`),`rfId`],Bu=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}),Vu={translateExtent:_s,nodeOrigin:Lu,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Hu(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(Bu,mu),l=vu();(0,X.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Vu,s()}),[]);let u=(0,X.useRef)(Vu);return(0,X.useEffect)(()=>{for(let s of zu){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:gc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},zu.map(t=>e[t])),null}function Uu(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function Wu(e){let[t,n]=(0,X.useState)(e===`system`?null:e);return(0,X.useEffect)(()=>{if(e!==`system`){n(e);return}let t=Uu(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?Uu()?.matches?`dark`:`light`:t}var Gu=typeof document<`u`?document:null;function Ku(e=null,t={target:Gu,actInsideInputWithModifier:!0}){let[n,r]=(0,X.useState)(!1),i=(0,X.useRef)(!1),a=(0,X.useRef)(new Set([])),[o,s]=(0,X.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,` +`).replace(` + +`,` ++`).split(` +`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,X.useEffect)(()=>{let n=t?.target??Gu,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&xc(e))return!1;let n=Ju(e.code,s);if(a.current.add(e[n]),qu(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=Ju(e.code,s);qu(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function qu(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Ju(e,t){return t.includes(e)?`code`:`key`}var Yu=()=>{let e=vu();return(0,X.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=cc(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return rc(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=ic(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Xu(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)Zu(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function Zu(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(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)}}function Qu(e,t){return Xu(e,t)}function $u(e,t){return Xu(e,t)}function ed(e,t){return{id:e,type:`select`,selected:t}}function td(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(ed(a.id,e)))}return r}function nd({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function rd(e){return{id:e.id,type:`remove`}}var id=tc(`React Flow`,`https://reactflow.dev/`);function ad(e,t,n={}){return Pc(e,t,{...n,onError:n.onError??id})}var od=e=>ks(e),sd=e=>Os(e);function cd(e){return(0,X.forwardRef)(e)}var ld=typeof window<`u`?X.useLayoutEffect:X.useEffect;function ud(e){let[t,n]=(0,X.useState)(BigInt(0)),[r]=(0,X.useState)(()=>dd(()=>n(e=>e+BigInt(1))));return ld(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function dd(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var fd=(0,X.createContext)(null);function pd({children:e}){let t=vu(),n=ud((0,X.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=nd({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=ud((0,X.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(nd({items:s,lookup:o}))},[])),i=(0,X.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,Y.jsx)(fd.Provider,{value:i,children:e})}function md(){let e=(0,X.useContext)(fd);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var hd=e=>!!e.panZoom;function gd(){let e=Yu(),t=vu(),n=md(),r=$(hd),i=(0,X.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=od(e)?e:n.get(e.id),a=i.parentId?pc(i.position,i.measured,i.parentId,n,r):i.position;return Js({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&od(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&sd(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await zs({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(rd);o?.(f),c(e)}if(m){let e=d.map(rd);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=$s(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=Js(s?r:a),l=Qs(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=$s(e)?e:a(e);if(!r)return!1;let i=Qs(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Ms(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??hc();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,X.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var _d=e=>e.selected,vd=typeof window<`u`?window:void 0;function yd({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=vu(),{deleteElements:r}=gd(),i=Ku(e,{actInsideInputWithModifier:!1}),a=Ku(t,{target:vd});(0,X.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(_d),edges:e.filter(_d)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,X.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function bd(e){let t=vu();(0,X.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=vc(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,gs.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var xd={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Sd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Cd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=xs.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=vu(),S=(0,X.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=$(Sd,mu),E=Ku(f),D=(0,X.useRef)();bd(S);let O=(0,X.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,X.useEffect)(()=>{if(S.current){D.current=Ul({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,X.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,Y.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:xd,children:m})}var wd=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Td(){let{userSelectionActive:e,userSelectionRect:t}=$(wd,mu);return e&&t?(0,Y.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}var Ed=(e,t)=>n=>{n.target===t.current&&e?.(n)},Dd=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Od({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ss.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,X.useRef)(0),_=vu(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(Dd,mu),C=y&&(e||v),w=(0,X.useRef)(null),T=(0,X.useRef)(),E=(0,X.useRef)(new Set),D=(0,X.useRef)(new Set),O=(0,X.useRef)(!1),k=(0,X.useRef)(!1),A=(0,X.useRef)({x:0,y:0}),j=(0,X.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=Cc(n.nativeEvent,T.current),l=rc({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=ic(d,i),m={startX:d.x,startY:d.y,x:ee.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}mc(h,E.current)||c(td(a,E.current,!0)),mc(g,D.current)||l(td(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!T.current)return;let[e,t]=Ws(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(R)})}let z=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,X.useEffect)(()=>()=>z(),[]);let B=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Cc(e.nativeEvent,T.current);A.current={x:o,y:c};let l=ic({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(R(),!0),L(o,c)},ee=e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),z())},V=e=>{e.target?.releasePointerCapture?.(e.pointerId),z()},H=r===!0||Array.isArray(r)&&r.includes(0);return(0,Y.jsxs)(`div`,{className:Mt([`react-flow__pane`,{draggable:H,dragging:b,selection:e}]),onClick:C?void 0:Ed(M,w),onContextMenu:Ed(N,w),onWheel:Ed(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?B:p,onPointerUp:ee,onPointerCancel:C?V:void 0,onPointerDownCapture:C?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:xd,children:[h,(0,Y.jsx)(Td,{})]})}function kd({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,gs.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function Ad({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=vu(),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)();return(0,X.useEffect)(()=>{u.current=vl({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{kd({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,X.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var jd=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Md(){let e=vu();return(0,X.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=jd(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=nc(t,i));let{position:a,positionAbsolute:s}=Rs({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Nd=(0,X.createContext)(null),Pd=Nd.Provider;Nd.Consumer;var Fd=()=>(0,X.useContext)(Nd),Id=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Ld=(0,X.createContext)(null);function Rd({children:e}){let t=$(Id,mu);return(0,Y.jsx)(Ld.Provider,{value:t,children:e})}function zd(){let e=(0,X.useContext)(Ld);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var Bd={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Vd=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return Bd;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===bs.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Hd({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=vu(),_=Fd(),{connectOnClick:v,noPanClassName:y,rfId:b}=zd(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(Vd(_,m,e),mu);_||g.getState().onError?.(`010`,gs.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(ad(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Sc(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Ol.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,Y.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Mt([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=yc(t.target),h=n||c,{connection:v,isValid:y}=Ol.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var Ud=(0,X.memo)(cd(Hd));function Wd({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[e?.label,(0,Y.jsx)(Ud,{type:`source`,position:n,isConnectable:t})]})}function Gd({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ud,{type:`target`,position:n,isConnectable:t}),e?.label,(0,Y.jsx)(Ud,{type:`source`,position:r,isConnectable:t})]})}function Kd(){return null}function qd({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ud,{type:`target`,position:n,isConnectable:t}),e?.label]})}var Jd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Yd={input:Wd,default:Gd,output:qd,group:Kd};function Xd(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var Zd=e=>{let{width:t,height:n,x:r,y:i}=Ns(e.nodeLookup,{filter:e=>!!e.selected});return{width:ec(t)?t:null,height:ec(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Qd({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=vu(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(Zd,mu),c=Md(),l=(0,X.useRef)(null);(0,X.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(Ad({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,Y.jsx)(`div`,{className:Mt([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,Y.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Jd,e.key)&&(e.preventDefault(),c({direction:Jd[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var $d=typeof window<`u`?window:void 0,ef=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function tf({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:R}=$(ef,mu),z=Ku(l,{target:$d}),B=Ku(h,{target:$d}),ee=B||w,V=B||b,H=u&&ee!==!0,U=z||R||H;return yd({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,Y.jsx)(Cd,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:V,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!z&&ee,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:H,children:(0,Y.jsxs)(Od,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ee,autoPanOnSelection:T,isSelecting:!!U,selectionMode:d,selectionKeyPressed:z,paneClickDistance:s,selectionOnDrag:H,children:[e,L&&(0,Y.jsx)(Qd,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}tf.displayName=`FlowRenderer`;var nf=(0,X.memo)(tf),rf=e=>t=>e?Ps(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function af(e){return $((0,X.useCallback)(rf(e),[e]),mu)}var of=e=>e.updateNodeInternals;function sf(){let e=$(of),[t]=(0,X.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,X.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function cf({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=vu(),a=(0,X.useRef)(null),o=(0,X.useRef)(null),s=(0,X.useRef)(e.sourcePosition),c=(0,X.useRef)(e.targetPosition),l=(0,X.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,X.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,X.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,X.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function lf({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},mu),S=y.type||`default`,C=g?.[S]||Yd[S];C===void 0&&(v?.(`003`,gs.error003(S)),S=`default`,C=g?.default||Yd.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=vu(),k=fc(y),A=cf({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=Ad({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=Md();if(y.hidden)return null;let N=dc(y),P=Xd(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,R=i?e=>i(e,{...b.userNode}):void 0,z=a?e=>a(e,{...b.userNode}):void 0,B=o?e=>o(e,{...b.userNode}):void 0,ee=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&kd({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},V=t=>{if(!(xc(t.nativeEvent)||m)){if(vs.includes(t.key)&&T){let n=t.key===`Escape`;kd({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(Jd,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:Jd[t.key],factor:t.shiftKey?4:1})}}},H=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Ps(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,Y.jsx)(`div`,{className:Mt([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:R,onContextMenu:z,onClick:ee,onDoubleClick:B,onKeyDown:D?V:void 0,tabIndex:D?0:void 0,onFocus:D?H:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${xu}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,Y.jsx)(Pd,{value:e,children:(0,Y.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var uf=(0,X.memo)(lf),df=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ff(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=$(df,mu),o=af(e.onlyRenderVisibleElements),s=sf();return(0,Y.jsx)(`div`,{className:`react-flow__nodes`,style:xd,children:o.map(o=>(0,Y.jsx)(uf,{id:o,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:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}ff.displayName=`NodeRenderer`;var pf=(0,X.memo)(ff);function mf(e){return $((0,X.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&jc({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),mu)}var hf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,Y.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},gf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,Y.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},_f={[Ts.Arrow]:hf,[Ts.ArrowClosed]:gf};function vf(e){let t=vu();return(0,X.useMemo)(()=>Object.prototype.hasOwnProperty.call(_f,e)?_f[e]:(t.getState().onError?.(`009`,gs.error009(e)),null),[e])}var yf=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=vf(t);return c?(0,Y.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,Y.jsx)(c,{color:n,strokeWidth:o})}):null},bf=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,X.useMemo)(()=>Jc(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,Y.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,Y.jsx)(`defs`,{children:i.map(e=>(0,Y.jsx)(yf,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};bf.displayName=`MarkerDefinitions`;var xf=(0,X.memo)(bf);function Sf({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,X.useState)({x:1,y:0,width:0,height:0}),p=Mt([`react-flow__edge-textwrapper`,l]),m=(0,X.useRef)(null);return(0,X.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,Y.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,Y.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,Y.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Sf.displayName=`EdgeText`;var Cf=(0,X.memo)(Sf);function wf({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{...u,d:e,fill:`none`,className:Mt([`react-flow__edge-path`,u.className])}),l?(0,Y.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&ec(t)&&ec(n)?(0,Y.jsx)(Cf,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Tf({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Ef({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=Tf({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Tf({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Tc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Df(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Ef({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Of=Df({isInternal:!1}),kf=Df({isInternal:!0});Of.displayName=`SimpleBezierEdge`,kf.displayName=`SimpleBezierEdgeInternal`;function Af(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Vc({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var jf=Af({isInternal:!1}),Mf=Af({isInternal:!0});jf.displayName=`SmoothStepEdge`,Mf.displayName=`SmoothStepEdgeInternal`;function Nf(e){return(0,X.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,Y.jsx)(jf,{...n,id:r,pathOptions:(0,X.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Pf=Nf({isInternal:!1}),Ff=Nf({isInternal:!0});Pf.displayName=`StepEdge`,Ff.displayName=`StepEdgeInternal`;function If(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Fc({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var Lf=If({isInternal:!1}),Rf=If({isInternal:!0});Lf.displayName=`StraightEdge`,Rf.displayName=`StraightEdgeInternal`;function zf(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Oc({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var Bf=zf({isInternal:!1}),Vf=zf({isInternal:!0});Bf.displayName=`BezierEdge`,Vf.displayName=`BezierEdgeInternal`;var Hf={default:Vf,straight:Rf,step:Ff,smoothstep:Mf,simplebezier:kf},Uf={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Wf=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,Gf=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,Kf=`react-flow__edgeupdater`;function qf({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,Y.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Mt([Kf,`${Kf}-${s}`]),cx:Wf(t,r,e),cy:Gf(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function Jf({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=vu(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Ol.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(e===!0||e===`source`)&&(0,Y.jsx)(qf,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,Y.jsx)(qf,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function Yf({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||Hf[x];S===void 0&&(_?.(`011`,gs.error011(x)),x=`default`,S=h?.default||Hf.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,X.useRef)(null),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),j=vu(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=$((0,X.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return Uf;let i=Uc({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=Ac({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||Uf,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),mu),z=(0,X.useMemo)(()=>y.markerStart?`url('#${qc(y.markerStart,m)}')`:void 0,[y.markerStart,m]),B=(0,X.useMemo)(()=>y.markerEnd?`url('#${qc(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let ee=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},V=a?e=>{a(e,{...y})}:void 0,H=o?e=>{o(e,{...y})}:void 0,U=s?e=>{s(e,{...y})}:void 0,W=c?e=>{c(e,{...y})}:void 0,G=l?e=>{l(e,{...y})}:void 0;return(0,Y.jsx)(`svg`,{style:{zIndex:M},children:(0,Y.jsxs)(`g`,{className:Mt([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:ee,onDoubleClick:V,onContextMenu:H,onMouseEnter:U,onMouseMove:W,onMouseLeave:G,onKeyDown:C?t=>{if(!v&&vs.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${Su}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,Y.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:z,markerEnd:B,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,Y.jsx)(Jf,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var Xf=(0,X.memo)(Yf),Zf=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Qf({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(Zf,mu),b=mf(t);return(0,Y.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,Y.jsx)(xf,{defaultColor:e,rfId:n}),b.map(e=>(0,Y.jsx)(Xf,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}Qf.displayName=`EdgeRenderer`;var $f=(0,X.memo)(Qf),ep=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function tp({children:e}){let t=$(ep);return(0,Y.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:t},children:e})}function np(e){let t=gd(),n=(0,X.useRef)(!1);(0,X.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var rp=e=>e.panZoom?.syncViewport;function ip(e){let t=$(rp),n=vu();return(0,X.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function ap(e){return e.connection.inProgress?{...e.connection,to:rc(e.connection.to,e.transform)}:{...e.connection}}function op(e){return e?t=>e(ap(t)):ap}function sp(e){return $(op(e),mu)}var cp=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function lp({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(cp,mu);return a&&i&&c?(0,Y.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,Y.jsx)(`g`,{className:Mt([`react-flow__connection`,Ds(s)]),children:(0,Y.jsx)(up,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var up=({style:e,type:t=ws.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=sp();if(!i)return;if(n)return(0,Y.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Ds(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case ws.Bezier:[m]=Oc(h);break;case ws.SimpleBezier:[m]=Ef(h);break;case ws.Step:[m]=Vc({...h,borderRadius:0});break;case ws.SmoothStep:[m]=Vc(h);break;default:[m]=Fc(h)}return(0,Y.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};up.displayName=`ConnectionLine`;var dp={};function fp(e=dp){(0,X.useRef)(e),vu(),(0,X.useEffect)(()=>{},[e])}function pp(){vu(),(0,X.useRef)(!1),(0,X.useEffect)(()=>{},[])}function mp({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:z,autoPanOnSelection:B,onPaneClick:ee,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneScroll:W,onPaneContextMenu:G,paneClickDistance:te,nodeClickDistance:ne,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:K,reconnectRadius:oe,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:q,nodeExtent:pe,rfId:me,viewport:he,onViewportChange:ge}){return fp(e),fp(t),pp(),np(n),ip(he),(0,Y.jsx)(nf,{onPaneClick:ee,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:W,paneClickDistance:te,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:z,autoPanOnSelection:B,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:q,onViewportChange:ge,isControlledViewport:!!he,children:(0,Y.jsxs)(tp,{children:[(0,Y.jsx)($f,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,onlyRenderVisibleElements:T,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:K,reconnectRadius:oe,defaultMarkerColor:M,noPanClassName:fe,disableKeyboardA11y:q,rfId:me}),(0,Y.jsx)(lp,{style:h,type:m,component:g,containerStyle:_}),(0,Y.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,Y.jsx)(pf,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ne,onlyRenderVisibleElements:T,noPanClassName:fe,noDragClassName:ue,disableKeyboardA11y:q,nodeExtent:pe,rfId:me}),(0,Y.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}mp.displayName=`GraphView`;var hp=(0,X.memo)(mp),gp=tc(`React Flow`,`https://reactflow.dev/`),_p=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??_s;fl(h,g,_);let{nodesInitialized:x}=rl(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=cc(Ns(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:_s,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bs.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Cs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gp,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:ys,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},vp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>pu((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await Ls({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{..._p({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=rl(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();fl(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=ll(e,n,r,i,a,o,l);d&&(el(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=Gc(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=cl(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(Qu(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n($u(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>ed(e,!0)));return}i(td(r,new Set([...e]),!0)),a(td(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>ed(e,!0)));return}a(td(n,new Set([...e]))),i(td(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(ed(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(ed(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,ed(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,ed(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(rl(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return ul({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Cs}})},updateConnection:e=>{p({connection:e})},reset:()=>p({..._p()})}},Object.is);function yp({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,X.useState)(()=>vp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,Y.jsx)(gu,{value:m,children:(0,Y.jsx)(pd,{children:(0,Y.jsx)(Rd,{children:p})})})}function bp({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,X.useContext)(hu)?(0,Y.jsx)(Y.Fragment,{children:e}):(0,Y.jsx)(yp,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var xp={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Sp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:R=ws.Bezier,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,deleteKeyCode:V=`Backspace`,selectionKeyCode:H=`Shift`,selectionOnDrag:U=!1,selectionMode:W=Ss.Full,panActivationKeyCode:G=`Space`,multiSelectionKeyCode:te=lc()?`Meta`:`Control`,zoomActivationKeyCode:ne=lc()?`Meta`:`Control`,snapToGrid:re,snapGrid:ie,onlyRenderVisibleElements:ae=!1,selectNodesOnDrag:K,nodesDraggable:oe,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,nodeOrigin:ue=Lu,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:q=!0,defaultViewport:pe=Ru,minZoom:me=.5,maxZoom:he=2,translateExtent:ge=_s,preventScrolling:_e=!0,nodeExtent:ve,defaultMarkerColor:ye=`#b1b1b7`,zoomOnScroll:be=!0,zoomOnPinch:xe=!0,panOnScroll:Se=!1,panOnScrollSpeed:Ce=.5,panOnScrollMode:we=xs.Free,zoomOnDoubleClick:Te=!0,panOnDrag:Ee=!0,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne=1,nodeClickDistance:Pe=0,children:Fe,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:J,onEdgeMouseLeave:He,reconnectRadius:Ue=10,onNodesChange:We,onEdgesChange:Ge,noDragClassName:Ke=`nodrag`,noWheelClassName:qe=`nowheel`,noPanClassName:Je=`nopan`,fitView:Ye,fitViewOptions:Xe,connectOnClick:Ze,attributionPosition:Qe,proOptions:$e,defaultEdgeOptions:et,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:nt=!1,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanOnSelection:ot=!0,autoPanSpeed:st,connectionRadius:ct,isValidConnection:lt,onError:ut,style:dt,id:ft,nodeDragThreshold:pt,connectionDragThreshold:mt,viewport:ht,onViewportChange:gt,width:_t,height:vt,colorMode:yt=`light`,debug:bt,onScroll:xt,ariaLabelConfig:St,zIndexMode:Ct=`basic`,...wt},Tt){let Et=ft||`1`,Dt=Wu(yt),Ot=(0,X.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),xt?.(e)},[xt]);return(0,Y.jsx)(`div`,{"data-testid":`rf__wrapper`,...wt,onScroll:Ot,style:{...dt,...xp},ref:Tt,className:Mt([`react-flow`,i,Dt]),id:ft,role:`application`,children:(0,Y.jsxs)(bp,{nodes:e,edges:t,width:_t,height:vt,fitView:Ye,fitViewOptions:Xe,minZoom:me,maxZoom:he,nodeOrigin:ue,nodeExtent:ve,zIndexMode:Ct,children:[(0,Y.jsx)(Hu,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:oe,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:q,elevateNodesOnSelect:tt,elevateEdgesOnSelect:nt,minZoom:me,maxZoom:he,nodeExtent:ve,onNodesChange:We,onEdgesChange:Ge,snapToGrid:re,snapGrid:ie,connectionMode:L,translateExtent:ge,connectOnClick:Ze,defaultEdgeOptions:et,fitView:Ye,fitViewOptions:Xe,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Je,nodeOrigin:ue,rfId:Et,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:ut,connectionRadius:ct,isValidConnection:lt,selectNodesOnDrag:K,nodeDragThreshold:pt,connectionDragThreshold:mt,onBeforeDelete:I,debug:bt,ariaLabelConfig:St,zIndexMode:Ct}),(0,Y.jsx)(hp,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,selectionKeyCode:H,selectionOnDrag:U,selectionMode:W,deleteKeyCode:V,multiSelectionKeyCode:te,panActivationKeyCode:G,zoomActivationKeyCode:ne,onlyRenderVisibleElements:ae,defaultViewport:pe,translateExtent:ge,minZoom:me,maxZoom:he,preventScrolling:_e,zoomOnScroll:be,zoomOnPinch:xe,zoomOnDoubleClick:Te,panOnScroll:Se,panOnScrollSpeed:Ce,panOnScrollMode:we,panOnDrag:Ee,autoPanOnSelection:ot,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne,nodeClickDistance:Pe,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:J,onEdgeMouseLeave:He,reconnectRadius:Ue,defaultMarkerColor:ye,noDragClassName:Ke,noWheelClassName:qe,noPanClassName:Je,rfId:Et,disableKeyboardA11y:rt,nodeExtent:ve,viewport:ht,onViewportChange:gt}),(0,Y.jsx)(Iu,{onSelectionChange:k}),Fe,(0,Y.jsx)(Au,{proOptions:$e,position:Qe}),(0,Y.jsx)(Du,{rfId:Et,disableKeyboardA11y:rt})]})})}var Cp=cd(Sp),wp=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Tp({children:e}){let t=$(wp);return t?(0,ft.createPortal)(e,t):null}function Ep(e){let[t,n]=(0,X.useState)(e);return[t,n,(0,X.useCallback)(e=>n(t=>Qu(e,t)),[])]}var Dp=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(let[,{internals:e}]of t.nodeLookup)if(e.handleBounds===void 0||!fc(e.userNode))return!1;return!0};function Op(e={includeHiddenNodes:!1}){return $(Dp(e))}gs.error014();function kp({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,Y.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Mt([`react-flow__background-pattern`,n,r])})}function Ap({radius:e,className:t}){return(0,Y.jsx)(`circle`,{cx:e,cy:e,r:e,className:Mt([`react-flow__background-pattern`,`dots`,t])})}var jp;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(jp||={});var Mp={[jp.Dots]:1,[jp.Lines]:1,[jp.Cross]:6},Np=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Pp({id:e,variant:t=jp.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,X.useRef)(null),{transform:f,patternId:p}=$(Np,mu),m=r||Mp[t],h=t===jp.Dots,g=t===jp.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,Y.jsxs)(`svg`,{className:Mt([`react-flow__background`,l]),style:{...c,...xd,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,Y.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,Y.jsx)(Ap,{radius:y/2,className:u}):(0,Y.jsx)(kp,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,Y.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}Pp.displayName=`Background`;var Fp=(0,X.memo)(Pp);function Ip(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,Y.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function Lp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,Y.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function Rp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,Y.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 zp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 Bp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 Vp({children:e,className:t,...n}){return(0,Y.jsx)(`button`,{type:`button`,className:Mt([`react-flow__controls-button`,t]),...n,children:e})}var Hp=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Up({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=vu(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(Hp,mu),{zoomIn:y,zoomOut:b,fitView:x}=gd();return(0,Y.jsxs)(Ou,{className:Mt([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Vp,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,Y.jsx)(Ip,{})}),(0,Y.jsx)(Vp,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,Y.jsx)(Lp,{})})]}),n&&(0,Y.jsx)(Vp,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,Y.jsx)(Rp,{})}),r&&(0,Y.jsx)(Vp,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,Y.jsx)(Bp,{}):(0,Y.jsx)(zp,{})}),u]})}Up.displayName=`Controls`;var Wp=(0,X.memo)(Up);function Gp({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,Y.jsx)(`rect`,{className:Mt([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var Kp=(0,X.memo)(Gp),qp=e=>e.nodes.map(e=>e.id),Jp=e=>e instanceof Function?e:()=>e;function Yp({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Kp,onClick:o}){let s=$(qp,mu),c=Jp(t),l=Jp(e),u=Jp(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,Y.jsx)(Y.Fragment,{children:s.map(e=>(0,Y.jsx)(Zp,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function Xp({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=dc(r);return{node:r,x:i,y:a,width:o,height:s}},mu);return!l||l.hidden||!fc(l)?null:(0,Y.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var Zp=(0,X.memo)(Xp),Qp=(0,X.memo)(Yp),$p=200,em=150,tm=e=>!e.hidden,nm=e=>{let 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?Xs(Ns(e.nodeLookup,{filter:tm}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},rm=`react-flow__minimap-desc`;function im({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=vu(),S=(0,X.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(nm,mu),j=e?.width??$p,M=e?.height??em,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,z=C.x-(I-C.width)/2-R,B=C.y-(L-C.height)/2-R,ee=I+R*2,V=L+R*2,H=`${rm}-${T}`,U=(0,X.useRef)(0),W=(0,X.useRef)();U.current=F,(0,X.useEffect)(()=>{if(S.current&&E)return W.current=kl({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>U.current}),()=>{W.current?.destroy()}},[E]),(0,X.useEffect)(()=>{W.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let G=p?e=>{let[t,n]=W.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,te=m?(0,X.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ne=_??A[`minimap.ariaLabel`];return(0,Y.jsx)(Ou,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F: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 o==`number`?o:void 0},className:Mt([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,Y.jsxs)(`svg`,{width:j,height:M,viewBox:`${z} ${B} ${ee} ${V}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":H,ref:S,onClick:G,children:[ne&&(0,Y.jsx)(`title`,{id:H,children:ne}),(0,Y.jsx)(Qp,{onClick:te,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,Y.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${z-R},${B-R}h${ee+R*2}v${V+R*2}h${-ee-R*2}z + M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}im.displayName=`MiniMap`;var am=(0,X.memo)(im),om=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,sm={[Wl.Line]:`right`,[Wl.Handle]:`bottom-right`};function cm({nodeId:e,position:t,variant:n=Wl.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=Fd(),y=typeof e==`string`?e:v,b=vu(),x=(0,X.useRef)(null),S=n===Wl.Handle,C=$((0,X.useCallback)(om(S&&p),[S,p]),mu),w=(0,X.useRef)(null),T=t??sm[n];(0,X.useEffect)(()=>{if(!(!x.current||!y))return w.current||=tu({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=cl([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...pc({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,Y.jsx)(`div`,{className:Mt([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,X.memo)(cm);function lm({path:e,delay:t,padding:n=24,children:r}){let i=`map-growth-${(0,X.useId)().replace(/:/g,``)}`;if(t==null)return(0,Y.jsx)(Y.Fragment,{children:r});let a=(e.match(/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/gi)??[]).map(Number),o=a.filter((e,t)=>t%2==0),s=a.filter((e,t)=>t%2==1);if(!o.length||!s.length)return(0,Y.jsx)(Y.Fragment,{children:r});let c=Math.min(...o)-n,l=Math.min(...s)-n;return(0,Y.jsxs)(`g`,{"data-map-growing-edge":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`mask`,{id:i,maskUnits:`userSpaceOnUse`,x:c,y:l,width:Math.max(...o)-c+n,height:Math.max(...s)-l+n,children:(0,Y.jsx)(`path`,{className:`map-growth-mask`,d:e,pathLength:1,fill:`none`,stroke:`white`,strokeWidth:n*2,strokeLinecap:`round`,style:{animationDelay:`${t}ms`}})})}),(0,Y.jsx)(`g`,{mask:`url(#${i})`,children:r})]})}function um({layout:e,growing:t={},activeStep:n,activeTeamSteps:r=[]}){let i=`submap-arrow-${(0,X.useId)().replace(/:/g,``)}`;return(0,Y.jsxs)(`svg`,{className:`submap-relations`,width:e.width,height:e.height,"aria-label":`Task process relationships`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`marker`,{id:i,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6.5`,markerHeight:`6.5`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,fill:`var(--map-edge-context, #6f8ca8)`})})}),e.links.map(a=>{let o=e.positions[a.source],s=e.positions[a.target],c=o.x===s.x&&s.y>o.y,l=o.x+(c?116:232),u=o.y+(c?180:90),d=s.x+(c?116:0),f=s.y+(c?0:90),p=(l+d)/2,m=(u+f)/2,h=c?`M ${l} ${u} L ${d} ${f}`:`M ${l} ${u} C ${p} ${u}, ${p} ${f}, ${d} ${f}`;return(0,Y.jsxs)(`g`,{"data-testid":`submap-relation`,"data-relation":a.relation,"data-source":a.source,"data-target":a.target,"aria-label":`${a.label}: ${a.explanation}`,children:[(0,Y.jsx)(`title`,{children:a.explanation}),(0,Y.jsx)(lm,{path:h,delay:t[a.id],children:(0,Y.jsx)(`path`,{className:`submap-relation-path`,d:h,fill:`none`,stroke:`var(--map-edge-context, #6f8ca8)`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeDasharray:a.contextual?`5 6`:void 0,markerEnd:`url(#${i})`})}),(n===a.target||r.includes(a.target))&&(0,Y.jsx)(`path`,{className:`submap-flow`,d:h,pathLength:1,fill:`none`,stroke:`#4b9cae`,strokeWidth:`3`,strokeDasharray:`.09 .91`,strokeLinecap:`round`,"aria-hidden":`true`}),(0,Y.jsxs)(`g`,{className:`submap-relation-label`,transform:`translate(${p}, ${m})`,children:[(0,Y.jsx)(`rect`,{x:`-38`,y:`-11`,width:`76`,height:`22`,rx:`6`}),(0,Y.jsx)(`text`,{textAnchor:`middle`,dominantBaseline:`central`,children:a.label})]})]},a.id)})]})}function dm({role:e,since:t,zh:n,text:r}){let[i,a]=(0,X.useState)(()=>Date.now()/1e3);(0,X.useEffect)(()=>{if(t==null||r)return;let e=setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(e)},[t,r]);let o=t==null?null:jt(i-t,n);return(0,Y.jsxs)(`div`,{className:`map-card-live`,"data-testid":`map-card-live`,"data-waiting":!!r||void 0,"aria-live":`off`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{title:r,children:r||(0,Y.jsxs)(Y.Fragment,{children:[Oe(e,n),o?n?` · 本次已进行 ${o}`:` · ${o} this run`:``]})})]})}var fm=(0,X.createContext)({notes:{}}),pm=(0,X.createContext)({}),mm={plan:[`计划`,`Plan`],execution:[`动手处理`,`Work`],review:[`检查结果`,`Check`],revision:[`修订`,`Revise`],result:[`结果`,`Result`]},hm={plan:E,execution:D,review:m,revision:ct,result:K},gm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],review_unavailable:[`这次结果检查没有完成`,`Result check did not finish`],held:[`工作暂停,后续尚未安排`,`Work paused; no next step scheduled`],aborted:[`已取消`,`Cancelled`],cancelled:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已被新计划替代`,`Replaced by a new plan`],question:[`等待答复`,`Waiting for an answer`],paused:[`已暂停`,`Paused`],paused_external_work:[`等待后台任务`,`Waiting on background work`],missing:[`记录中缺失`,`Not in this record`],unknown:[`状态未知`,`Unknown`],continue:[`需再改一轮`,`Another pass needed`],blocked:[`受阻`,`Held up`],started:[`进行中`,`Under way`],recorded:[`已记录`,`On record`],requested:[`修改建议`,`Requested`],replan:[`需要调整计划`,`Plan needs adjusting`],replan_requested:[`需要调整计划`,`Plan needs adjusting`]},_m={plan:[`接下来要做什么,为什么这样做`,`What to do next and why`],execution:[`实际做了什么,遇到了什么问题`,`What was done and what happened`],review:[`结果是否正确,有什么依据`,`Whether the result is correct and what supports it`],revision:[`检查后发现需要修改的地方`,`What the check found needs changing`],result:[`这项任务最后得到了什么`,`What the task produced in the end`]},vm={plan:[`提问`,`Asked`],execution:[`Argus 查证`,`Argus`],review:[`核对`,`Check`],revision:[`修订`,`Revise`],result:[`回答`,`Answer`]},ym={plan:[`你提出的要求`,`What you asked for`],execution:[`Argus 自己动手查证、运行命令`,`Argus did the work itself: read, searched, ran commands`],review:[`对结果的核对`,`A check of the result`],revision:[`需要修改的地方`,`What had to change`],result:[`Argus 给出的回答`,`What Argus answered`]},bm=(e,t)=>e.source===`team`?t?`子任务工作记录`:`Subtask work record`:e.source===`task`?t?`任务记录`:`Task record`:e.source===`interval`?t?`根据同期记录关联`:`By execution window`:t?`来自任务记录`:`Linked event`,xm=(0,X.memo)(function({id:e,data:t}){let{task:n,ordinal:r,zh:i,layout:a,focused:o,detailed:s}=t,{artifacts:c,onOpenArtifact:l}=(0,X.useContext)(pm),u=(0,X.useContext)(fm).notes[n.id]??[],[d]=(0,X.useState)(()=>!!t.revealing||!t.restoring&&!t.seenCards?.has(e));(0,X.useEffect)(()=>{t.seenCards?.add(e)},[t.seenCards,e]);let[f,p]=(0,X.useState)(null),m=f||a,h=e=>e.source===`team`&&a.steps.find(t=>t.id===e.id)||e,_=t.canvasSize?.width||window.innerWidth,y=t.canvasSize?.height||window.innerHeight;(0,X.useEffect)(()=>{s||(x(null),p(null),t.readCopy?.(e,null))},[s]);let[b,x]=(0,X.useState)(null),S=(0,X.useRef)(n.status),[w,T]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=S.current!==n.status;if(S.current=n.status,!e||n.status!==`done`||t.completionScope)return;T(!0);let r=setTimeout(()=>T(!1),1500);return()=>clearTimeout(r)},[n.status,t.completionScope]);let E=m.steps.find(e=>e.id===b),D=E?h(E):void 0,O=D?.updatedAt??D?.ts,k=t.part===t.partCount,A=!k||t.completionScope?`recorded`:n.status===`missing`?`missing`:t.paused&&ge.has(n.status)?`paused`:Ve(n),j=A===`paused`&&n.status===`paused_external_work`?n.status:A,M=Math.min(t.frame.width/288,t.frame.height/280),N=t.copy?.cards||{},P=!!N[n.id]?.summary&&N[n.id]?.task_status!==n.status&&(ge.has(n.status)||n.status===`pending`),I=e=>{if(e.completionScope||e.status===`review_unavailable`)return;let t=N[e.id];if(e.source!==`team`)return t;let n=t?.event_ids?.indexOf(e.id)??-1;return h(e).revision&&n>=0&&t?.event_revisions?.[n]===h(e).revision?t:void 0},L=n.kind===`turn`?void 0:t.words,R=(t.completionScope?``:N[n.id]?.title)||L?.title||n.title,z=i?`环节 ${t.start}–${t.end} / ${t.totalSteps}`:`Steps ${t.start}–${t.end} / ${t.totalSteps}`,B=t.partCount>1&&!k?m.steps.map(e=>I(e)?.summary||h(e).summary||h(e).detail).filter(e=>e&&![q(!0),q(!1)].includes(e)).at(-1):void 0,ee=k&&n.objective&&n.objective.trim()!==n.title.trim(),V=A===`review_unavailable`?i?`当次审查器未能给出判断,未形成审阅结论。`:`The Reviewer could not return a judgment on this attempt.`:(t.completionScope?``:N[n.id]?.summary)||L?.summary||``,H=(k?n.pending_question:``)||B||V||t.completionScope||n.pending_question||G(n.summary||``,i).summary||n.summary||(ee?``:n.objective),U=Math.min(t.frame.width/m.width,t.frame.height/m.height),W=k&&t.live&&ge.has(n.status)?[...m.steps].reverse().find(e=>e.source!==`team`&&![`plan`,`result`].includes(e.kind))?.id:null,te=t.paused?null:W,ne=a.steps.filter(e=>e.source===`team`),re=t.live?ne.filter(e=>ge.has(e.status)).map(e=>e.id):[],ae=ne.filter(e=>e.status===`done`).length,K=ne.filter(e=>ge.has(e.status)).length,oe=(i?`子任务 ${ae}/${ne.length} 完成 · ${K} 进行中`:`Subtasks ${ae}/${ne.length} done · ${K} running`)+((t.plannedWidth??0)>ne.length?i?` · 计划并行 ×${t.plannedWidth}`:` · planned ×${t.plannedWidth}`:``),se=e=>e.source===`team`?re.includes(e.id):te===e.id,ce=e=>e.source===`team`?h(e).status:W===e.id?t.paused?`paused`:`running`:e.status,le=e=>({source:t.source,task_id:n.id,task_title:R,lang:i?`zh`:`en`,part:t.partCount>1?t.part:void 0,step_id:e?.id,step_title:e?.title,team_id:e?.teamId,team_task_id:e?.teamTaskId,event_ids:e?e.eventIds:t.partCount>1?[...new Set(m.steps.flatMap(e=>e.eventIds))]:N[n.id]?.event_ids||[]}),ue=Math.min(640,m.width-48,Math.max(260,(_-50)/1.05)),de=Math.min(600,m.height-48,Math.max(300,(y-(_<640?180:160))/1.05)),fe=e=>({x:Math.max(24,Math.min(m.positions[e.id].x-16,m.width-ue-24)),y:Math.max(24,Math.min(m.positions[e.id].y-16,m.height-de-24)),width:ue,height:de,scale:U}),pe=D?fe(D):null,me=n=>{p(m),x(n.id),t.readCopy?.(e,n.id),t.readStep(e,fe(n))};(0,X.useEffect)(()=>{D&&t.readStep(e,fe(D))},[_,y]);let he=e=>(gm[e===`paused_external_work`?e:e.startsWith(`paused_`)?`paused`:ge.has(e)?`running`:e]??gm.unknown)[+!i],_e=t.completionScope?i?`当次结束 · 当时目标未完成`:`Execution ended · goal incomplete then`:n.turn_kind===`qa`&&[`done`,`running`,`cancelled`,`failed`].includes(A)?{done:[`已回答`,`Answered`],running:[`正在回答`,`Answering`],cancelled:[`已中断`,`Interrupted`],failed:[`回答失败`,`Answer failed`]}[A][+!i]:he(j);return(0,Y.jsxs)(`article`,{className:`map-macro map-state-${A}`,"data-testid":`map-macro`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,"data-history":!k,"data-has-history":!!t.historyCount,"data-arrive":!!t.arriving||d&&!!t.revealing,"data-lit":!!t.lit,"data-hovered":!!t.hovered,"data-growing":t.growthDelay!=null,"data-dispatch":t.dispatchState,style:{animationDelay:`${t.growthDelay??(t.arriving?kt(r):0)}ms`},"data-focused":o,"data-detailed":s,"aria-label":R,"data-completed-now":w,"data-active":re.length>0||k&&t.live&&!t.paused&&ge.has(n.status),onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(),{x:e.clientX,y:e.clientY})},children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(Ud,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsxs)(`div`,{className:`macro-summary`,"aria-hidden":s,style:{"--summary-height":`${t.frame.height/M-20}px`,width:t.frame.width/M-20,transform:`translate(-50%, -50%) scale(${M})`},children:[(0,Y.jsxs)(`button`,{className:`map-card map-state-${A} nodrag nopan`,"data-testid":`map-card`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,tabIndex:s?-1:0,onClick:()=>n.turn_kind===`qa`&&t.readCopy?t.readCopy(e,n.id):t.open(e),"aria-label":`${R} · ${n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`放大任务`:`Explore task`}`,children:[(0,Y.jsxs)(`div`,{className:`map-card-top`,children:[(0,Y.jsxs)(`span`,{className:`map-card-number`,children:[n.turn_kind===`qa`?i?`问答`:`Q&A`:k?i?`任务`:`MISSION`:i?`历史`:`HISTORY`,` `,String(r).padStart(2,`0`),!k&&` · ${t.part}/${t.partCount}`]}),(A!==`recorded`||t.completionScope)&&(0,Y.jsxs)(`span`,{className:`map-status`,children:[A===`done`?(0,Y.jsx)(g,{size:11}):A===`failed`?(0,Y.jsx)(v,{size:11}):A===`review_unavailable`?(0,Y.jsx)(tt,{size:11}):A===`question`?(0,Y.jsx)(Ne,{size:11}):A===`paused`||A===`held`?(0,Y.jsx)(et,{size:11}):(0,Y.jsx)(`span`,{className:`map-state-dot`}),_e]})]}),(0,Y.jsxs)(`h3`,{children:[(0,Y.jsx)(Ae,{children:R}),u.length>0&&(0,Y.jsx)(`span`,{className:`macro-note-badge`,title:i?`操作员批注`:`Operator notes`,children:u.length})]}),ee&&!V&&(0,Y.jsx)(`p`,{className:`map-card-objective`,title:n.objective,children:n.objective}),H&&H.trim()!==(ee?n.objective.trim():``)&&(0,Y.jsx)(`div`,{className:`map-card-copy`,children:(0,Y.jsx)(Ae,{children:H})}),t.conclusion&&(0,Y.jsx)(`p`,{className:`map-card-conclusion`,"data-testid":`map-card-conclusion`,title:t.conclusion,children:t.conclusion}),n.kind!==`turn`&&(0,Y.jsx)(`div`,{className:`map-card-course`,"aria-label":i?`任务经过`:`Course of the task`,children:[`plan`,`execution`,`review`,`result`].map(e=>{let t=hm[e],n=m.steps.some(t=>t.kind===e),r=m.steps.some(t=>t.kind===e&&se(t)),a=i?{plan:`规划`,execution:`执行`,review:`审查`,result:`交付`}[e]:mm[e][1];return(0,Y.jsxs)(`span`,{className:`submap-kind-${e}`,"data-present":n,"data-active":r,title:a,children:[(0,Y.jsx)(t,{size:12,"aria-hidden":!0}),(0,Y.jsx)(`b`,{children:a})]},e)})}),(()=>{let e=k&&t.live&&t.waiting,r=!e&&k&&t.live&&!t.paused&&ge.has(n.status),a=A!==`recorded`||!!t.completionScope,o=!!t.historyCount&&ne.length>0;return!r&&!e&&k&&a&&!o?null:(0,Y.jsxs)(`div`,{className:`map-card-stages`,children:[e?(0,Y.jsx)(dm,{text:t.waiting,zh:i}):r?(0,Y.jsx)(dm,{role:t.phase??n.role,since:n.started_ts,zh:i}):k&&a?null:(0,Y.jsx)(`span`,{className:`map-card-recorded`,children:k?_e:i?`历史记录 · 非当前执行`:`History · not current execution`}),o&&(0,Y.jsx)(`span`,{className:`map-card-team-summary`,children:oe})]})})(),k&&ne.length>0&&(0,Y.jsx)(`span`,{className:`map-card-teambar`,"aria-hidden":!0,children:(0,Y.jsx)(`i`,{style:{width:`${Math.round(ae/ne.length*100)}%`}})}),(0,Y.jsxs)(`div`,{className:`map-card-bottom`,children:[(0,Y.jsx)(`span`,{className:ne.length?`map-card-team-summary`:void 0,title:z,children:n.turn_kind===`qa`?i?`问题与回答`:`Question and answer`:t.historyCount?``:ne.length?oe:t.plannedWidth&&ge.has(n.status)?i?`并行编队 ×${t.plannedWidth} 展开中`:`Fanning out ×${t.plannedWidth}`:t.partCount>1?z:`${m.steps.length} ${i?`个环节`:`steps`}`}),(0,Y.jsxs)(`span`,{className:`map-card-submap-hint`,children:[P?i?`描述更新中`:`Summary updating`:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`查看进展`:`View progress`,(0,Y.jsx)(ie,{size:12})]})]})]}),!!t.historyCount&&t.toggleHistory&&(0,Y.jsxs)(`button`,{type:`button`,className:`map-history-toggle nodrag nopan`,"aria-expanded":t.historyExpanded,"aria-label":`${i?`任务历史`:`Mission history`}: ${R}`,title:i?`保留全部 ${t.totalSteps} 个环节`:`All ${t.totalSteps} steps retained`,onClick:()=>t.toggleHistory?.(n.id),children:[t.historyExpanded?i?`收起历史`:`Hide history`:`${i?`历史`:`History`} ${t.historyCount}`,(0,Y.jsx)(ie,{size:12})]})]}),o&&(0,Y.jsxs)(`div`,{className:`macro-detail ${D?`is-reading`:``}`,"data-stacked":m.stacked||void 0,"aria-hidden":!s,style:{width:m.width,height:m.height,transform:`scale(${U})`,transformOrigin:`top left`},children:[(0,Y.jsxs)(`header`,{className:`macro-heading`,children:[(0,Y.jsx)(`span`,{className:`macro-index`,children:String(r).padStart(2,`0`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`small`,{children:t.partCount>1?i?`第 ${t.part} / ${t.partCount} 部分`:`Part ${t.part} / ${t.partCount}`:n.turn_kind===`qa`?i?`问答内容`:`Q&A`:i?`任务内部`:`INSIDE THIS TASK`}),(0,Y.jsx)(`h2`,{children:(0,Y.jsx)(Ae,{children:R})})]}),t.conclusion&&(0,Y.jsx)(`span`,{className:`macro-conclusion`,"data-testid":`macro-conclusion`,title:t.conclusion,children:t.conclusion}),(A!==`recorded`||t.completionScope)&&(0,Y.jsx)(`span`,{className:`macro-state`,title:t.completionScope,children:_e}),s&&k?(0,Y.jsx)(C,{"data-testid":`map-task-read`,className:`nodrag nopan text-xs`,onClick:()=>{if(n.turn_kind===`qa`){t.readCopy?.(e,n.id);return}x(null),p(null),t.readCopy?.(e,n.id)},children:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`阅读任务说明`:`Read task explanation`}):null]}),(0,Y.jsx)(`div`,{className:`macro-stage-key`,children:F.filter(e=>n.kind!==`turn`||m.steps.some(t=>t.kind===e)).map(e=>(0,Y.jsx)(`span`,{className:`submap-kind-${e} ${m.steps.some(t=>t.kind===e)?``:`is-unrecorded`}`,title:n.kind===`turn`?ym[e][+!i]:_m[e][+!i],children:n.kind===`turn`?vm[e][+!i]:mm[e][+!i]},e))}),u.length>0&&(0,Y.jsxs)(`aside`,{className:`macro-notes`,"aria-label":i?`操作员批注`:`Operator notes`,children:[(0,Y.jsx)(`small`,{children:i?`批注`:`Notes`}),u.map(e=>(0,Y.jsx)(`p`,{children:e.text},e.id))]}),(0,Y.jsx)(um,{layout:m,growing:t.growingLinks,activeStep:te,activeTeamSteps:re}),m.columns.map(e=>(0,Y.jsx)(`div`,{className:`macro-column-label`,style:{left:e.x,top:e.y},children:e.title},e.id)),m.steps.map((e,r)=>{let a=h(e),o=hm[a.kind];return(0,Y.jsxs)(`button`,{className:`submap-step submap-kind-${a.kind} nodrag nopan ${b===a.id?`is-selected`:``}`,"data-testid":`submap-step`,"data-step-id":a.id,"data-source":a.source,"data-team-id":a.teamId,"data-team-task-id":a.teamTaskId,"data-status":ce(a),"data-active":se(a),"data-growing":t.growingSteps?.[a.id]!=null,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(a),{x:e.clientX,y:e.clientY})},style:{animationDelay:`${t.growingSteps?.[a.id]??0}ms`,"--step-index":r,left:m.positions[a.id].x,top:m.positions[a.id].y},tabIndex:s?0:-1,onClick:()=>me(a),"aria-expanded":b===a.id,children:[(0,Y.jsxs)(`div`,{className:`submap-step-meta`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(o,{size:16}),a.source===`team`?i?`子任务 · `:`Subtask · `:``,(n.kind===`turn`?vm:mm)[a.kind][+!i],a.round!=null&&(0,Y.jsx)(`em`,{className:`submap-round`,children:i?`第 ${a.round} 轮`:`Round ${a.round}`})]}),(0,Y.jsx)(`small`,{"data-verdict":a.source===`team`&&Se(h(a).teamOutcome)||void 0,children:a.completionScope&&a.status===`recorded`?i?`执行结束`:`Execution ended`:a.source===`team`&&ce(a)===`failed`?i?`失败`:`Failed`:a.source===`team`&&Le(h(a).teamOutcome,i)||he(ce(a))})]}),(0,Y.jsx)(`h4`,{children:(0,Y.jsx)(Ae,{children:a.title})}),(0,Y.jsx)(`div`,{className:`submap-step-copy`,children:(0,Y.jsx)(Ae,{children:I(a)?.summary||h(a).summary||a.detail||q(i)})}),(0,Y.jsxs)(`div`,{className:`submap-step-foot`,children:[(0,Y.jsxs)(`span`,{title:bm(a,i),children:[i?`查看详情`:`Read more`,a.workCount?(0,Y.jsx)(`em`,{className:`submap-step-work`,children:i?` · ${a.workCount} 步操作`:` · ${a.workCount} actions`}):null]}),(0,Y.jsx)(ie,{size:14})]})]},a.id)}),t.partCount>1&&!D&&(0,Y.jsxs)(`nav`,{className:`macro-part-nav nodrag nopan`,"aria-label":i?`任务各部分`:`Task parts`,children:[(0,Y.jsx)(`span`,{children:z}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{disabled:!t.previousId,onClick:()=>t.previousId&&t.open(t.previousId,!0),children:[(0,Y.jsx)(rt,{size:14}),i?`上一部分`:`Previous part`]}),(0,Y.jsxs)(`button`,{disabled:!t.nextId,onClick:()=>t.nextId&&t.open(t.nextId,!0),children:[i?`下一部分`:`Next part`,(0,Y.jsx)(ie,{size:14})]})]})]}),D&&pe&&(0,Y.jsxs)(`section`,{className:`macro-reader nodrag nopan nowheel`,"data-testid":`map-reader`,"data-kind":D.kind,role:`region`,"aria-label":i?`卡片详情`:`Card details`,style:{left:pe.x,top:pe.y,width:pe.width,height:pe.height},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(D),{x:e.clientX,y:e.clientY})},children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsxs)(`span`,{children:[(n.kind===`turn`?vm:mm)[D.kind][+!i],n.turn_kind!==`qa`&&(0,Y.jsx)(`small`,{className:`macro-reader-note`,children:_m[D.kind][+!i]})]}),(0,Y.jsx)(`button`,{"aria-label":`Close step details`,onClick:()=>{x(null),p(null),t.readCopy?.(e,null),t.open(e)},children:(0,Y.jsx)(v,{size:20})})]}),(0,Y.jsx)(`h3`,{children:(0,Y.jsx)(Ae,{children:I(D)?.title||D.title})}),(0,Y.jsx)(`div`,{className:`macro-reader-body`,children:(0,Y.jsx)(ye,{cardKey:D.id,taskId:n.id,card:I(D),task:n,readOnly:t.readOnly,originalDetail:D.detail||q(i),selection:t.readerCopy,artifacts:c,onOpenArtifact:l})}),(0,Y.jsxs)(`footer`,{children:[(0,Y.jsx)(`span`,{title:bm(D,i),children:O?new Date(O*1e3).toLocaleString(i?`zh-CN`:`en-US`):``}),!t.readOnly&&(0,Y.jsx)(`button`,{onClick:()=>t.quote(le(D)),children:i?`引用此项`:`Reference`})]})]})]})]})});function Sm(e){if(!(e>0)||!Number.isFinite(e))return e;let t=Math.floor(Math.log2(e)*4+1e-9)/4;return Math.round(2**t*1e4)/1e4}function Cm(e,t){let n=Sm(t);if(e==null||!(e>0))return n;let r=Math.log2(t/e)*4;return r<-2||r>=3?n:e}function wm(){let e=null,t=new Set;return{get:()=>e,set(n){n!==e&&(e=n,t.forEach(e=>e()))},subscribe(e){return t.add(e),()=>void t.delete(e)}}}var Tm=(0,X.createContext)(null),Em=()=>()=>{};function Dm(e){let t=(0,X.useContext)(Tm),n=()=>{let n=t?.get();return n==null?null:e(n)},r=(0,X.useSyncExternalStore)(t?t.subscribe:Em,n,n),i=$(t=>r===null?e(Sm(t.transform[2])):null);return r??i}function Om(e){let t={};for(let n of e)(t[n.node_id]??=[]).push(n);for(let e of Object.values(t))e.sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));return t}var km={width:640,height:190},Am={width:1440,height:640},jm={"idea-route":lt,"idea-review":m,"idea-selector":ot},Mm={done:`✓`,failed:`✕`,question:`?`,paused:`‖`,running:`▶`,superseded:`↪`},Nm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],question:[`待答复`,`Needs input`],paused:[`已暂停`,`Paused`],aborted:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已替代`,`Superseded`],unknown:[`已记录`,`Recorded`]},Pm=(0,X.memo)(function({data:e}){let{task:t,zh:n,fanIndex:r,fanCount:i}=e,a=Ve(t),o=t.group,s=o?B:t.overflow_count?Fe:jm[t.team_role??``]??E,c=o?``:Le(t.team_outcome,n),l=o?``:Se(t.team_outcome),u=c||(Nm[a]??Nm.unknown)[+!n],d=l===`rejected`?`✕`:l===`chosen`?`★`:Mm[a],f=!o&&typeof r==`number`&&typeof i==`number`,p=o?.expanded?n?`收起`:`Fold`:n?`展开`:`Unfold`;return(0,Y.jsxs)(`button`,{type:`button`,className:`map-branch map-state-${a}${o?` map-branch-group`:``} nodrag nopan`,"data-testid":`map-branch`,"data-branch-id":t.id,"data-status":a,"data-verdict":l||void 0,"data-overflow":!!t.overflow_count,"data-group":!!o,"data-expanded":o?o.expanded:void 0,"aria-expanded":o?o.expanded:void 0,title:t.excerpt||t.objective||t.title,"aria-label":o?`${t.title} · ${p}`:`${t.title} · ${u} · ${n?`打开所属任务`:`Open the owning task`}`,onClick:()=>o?e.toggleGroup?.(t.id):e.open(e.parentCardId),children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(Ud,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsx)(`span`,{className:`map-branch-glyph`,"aria-hidden":`true`,children:(0,Y.jsx)(s,{})}),d&&(0,Y.jsx)(`span`,{className:`map-branch-state`,"aria-hidden":`true`,children:d}),(0,Y.jsx)(`span`,{className:`map-branch-title`,children:t.title}),c&&(0,Y.jsx)(`span`,{className:`map-branch-verdict`,"data-testid":`map-branch-verdict`,children:c}),f&&(0,Y.jsx)(`span`,{className:`map-branch-fan`,"data-testid":`map-branch-fan`,title:n?`并行分支 ${r} / ${i}`:`Parallel branch ${r} of ${i}`,children:`${r}/${i}`}),o&&(0,Y.jsxs)(`span`,{className:`map-branch-toggle`,"data-testid":`map-branch-toggle`,"aria-hidden":`true`,children:[p,o.expanded?(0,Y.jsx)(h,{}):(0,Y.jsx)(ie,{})]}),(0,Y.jsx)(`span`,{className:`map-branch-dot`,"aria-hidden":`true`})]})}),Fm={x:52,y:125,zoom:.24},Im=.01,Lm=3.5,Rm=(e,t,n)=>Math.max(t,Math.min(n,e));function zm(e,t){let n=e.querySelector(t)?.getBoundingClientRect();return n&&n.width>0&&n.height>0?n:void 0}function Bm(e,t=!1){let n=e.getBoundingClientRect(),r=zm(e,`.map-canvas-toolbar`),i=zm(e,`.map-composer-dock`),a=zm(e,`.react-flow__minimap`),o=zm(e,`.map-legend`),s=zm(e,`.react-flow__controls`),c=e.dataset.reading===`true`||t&&e.clientWidth<640,l=e.clientWidth<640?20:50,u=Math.max(r?r.bottom-n.top+20:85,!c&&e.clientWidth<640&&o?o.bottom-n.top+16:0,!c&&e.clientWidth<640&&s?s.bottom-n.top+16:0),d=Math.max(i?n.bottom-i.top+24:100,!c&&a?n.bottom-a.top+20:0);return{x:l,y:u,width:Math.max(180,e.clientWidth-l*2),height:Math.max(100,e.clientHeight-u-d)}}var Vm=.72,Hm=.85,Um=(e,t)=>e?0:t;function Wm(e,t,n){let r=Math.min(t.width/n.width,t.height/n.height),i=Math.min(e.width,e.height)/Math.min(n.width,n.height);return Math.min(Math.max(r,Vm*i),Hm*i)}function Gm(e,t,n,r,i){let a=r||1;if(e.width<640&&i?.stacked&&i.width>0)return t.width/(i.width*a);let o=Wm(e,t,n),s=e.width<640||(i?.steps.length??0)>20?.6/a:0,c=e.width>=1024?1/a:0;return Math.max(o,s,c)}function Km(e,t,n){let r=Rm(Math.min(t.width/(n.width+160),t.height/(n.height+160)),Im,.27),i=(e,t,n,r)=>r>t?(n-r)/2:Rm((n-r)/2,e,e+t-r);return{x:i(t.x,t.width,e.width,n.width*r)-n.x*r,y:i(t.y,t.height,e.height,n.height*r)-n.y*r,zoom:r}}function qm(e,t,n){let r=Math.min(48,e.height*.35),i=e.height-r,a=Math.min(Lm,Math.min(1.05,e.width/n.width,i/n.height)/n.scale);return{x:e.x+e.width/2-(t.x+(n.x+n.width/2)*n.scale)*a,y:e.y+r+i/2-(t.y+(n.y+n.height/2)*n.scale)*a,zoom:a}}function Jm(e,t=!0){let n=gd(),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)({width:0,height:0}),l=(0,X.useRef)(null),u=(0,X.useRef)(!1),d=(0,X.useRef)(!1),f=(0,X.useRef)(!1),p=(0,X.useRef)(),m=(0,X.useRef)(()=>{}),h=(0,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.useRef)(()=>{}),v=(0,X.useRef)(()=>{}),[y,b]=(0,X.useState)(()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),x=(0,X.useRef)(Fm),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null),T=(0,X.useRef)(0),E=(0,X.useRef)(null),D=(0,X.useRef)(0);(0,X.useEffect)(()=>()=>window.clearTimeout(D.current),[]);let[O]=(0,X.useState)(wm),k=(0,X.useCallback)((e,t)=>{O.get()!==t&&(e.style.setProperty(`--map-zoom-step`,String(t)),O.set(t))},[O]),A=(0,X.useCallback)(()=>{cancelAnimationFrame(T.current),T.current=0,E.current=null},[]),j=(0,X.useCallback)((t,r)=>{t&&(f.current=!1,d.current=!1);let a=e.current;if(!a)return;a.dataset.moving||(a.dataset.moving=`true`),window.clearTimeout(D.current),D.current=window.setTimeout(()=>{delete a.dataset.moving,k(a,Sm(n.getZoom()))},180);let s={x:a.clientWidth/2,y:a.clientHeight/2},c=S.current&&S.current.until>performance.now()?S.current:s,p=C.current??(u.current?h.current:null)??V(n.getNodes().filter(e=>e.data.frame),r,c,s),m=p&&(n.getNode(p)?.data)?.frame?.scale||1,g=Rm((r.zoom-.3)/.14,0,1)*Rm((r.zoom*m-.28)/.3,0,1),_=w.current,v=u.current?1:_?.id===p?Rm((r.zoom-_.zoom*.65)/(_.zoom*.35),0,1):g;l.current=v>0?p:null,a.style.setProperty(`--detail-alpha`,String(v)),a.style.setProperty(`--summary-alpha`,String(1-v)),a.style.setProperty(`--context-alpha`,String(p?1-v*.72:1)),a.dataset.zoom=r.zoom.toFixed(2),k(a,Cm(O.get(),r.zoom)),i(v>0&&p?p:null),o(!!p&&v>=.55),r.zoom<=.32&&!C.current&&!E.current&&!w.current&&(x.current=r)},[n,e,k,O]),M=(0,X.useCallback)(t=>{let r=f.current;f.current=!1,A();let i=n.getNode(t),a=e.current;if(!i||!a)return;!r&&n.getZoom()<=.32&&!w.current&&(x.current=n.getViewport()),C.current=t,u.current=!1,delete a.dataset.reading,d.current=!0;let o=Bm(a,!0),s=i.width||1440,c=i.height||1080,l=Rm(Gm({width:a.clientWidth,height:a.clientHeight},o,{width:s,height:c},i.data.frame?.scale||1,i.data.layout),Im,Lm);w.current={id:t,zoom:l};let p=o.x+Math.max(0,(o.width-s*l)/2)-i.position.x*l,m=o.y+Math.max(0,(o.height-c*l)/2)-i.position.y*l;n.setViewport({x:p,y:m,zoom:l},{duration:Um(y,380)}).then(()=>{C.current=null})},[A,n,y,e]);v.current=M;let N=(0,X.useCallback)(()=>{f.current=!1,A(),C.current=null,u.current=!1,e.current&&delete e.current.dataset.reading,d.current=!1,w.current=null,S.current=null;let t=e.current?.querySelector(`.map-macro[data-focused="true"]`)?.dataset.cardId;n.setViewport(x.current,{duration:Um(y,320)}).then(()=>{t&&e.current?.querySelector(`[data-testid="map-card"][data-card-id="${CSS.escape(t)}"]`)?.focus({preventScroll:!0})})},[A,n,y,e]),P=(0,X.useCallback)((t,r)=>{f.current=!1,A(),C.current=t;let i=n.getNode(t),a=e.current;!i||!a||(u.current=!0,a.dataset.reading=`true`,d.current=!0,h.current=t,g.current={id:t,rect:r},n.setViewport(qm(Bm(a),i.position,r),{duration:Um(y,340)}).then(()=>{C.current=null}))},[A,n,y,e]);_.current=P;let F=(0,X.useCallback)(e=>{f.current=!1,A(),u.current=!1,d.current=!1,C.current=null,S.current=null,n.setCenter(e.x,e.y,{zoom:n.getZoom(),duration:Um(y,180)})},[A,n,y]),I=(0,X.useCallback)(t=>{f.current=!0,p.current=t,A(),C.current=null,u.current=!1,d.current=!1,w.current=null,S.current=null;let r=e.current;r&&delete r.dataset.reading;let i=n.getNodes().filter(e=>!e.hidden&&(!t||t.has(e.data.task.id)));if(!r||!i.length)return;let a=Km({width:r.clientWidth,height:r.clientHeight},Bm(r),n.getNodesBounds(i));t||(x.current=a),n.setViewport(a,{duration:Um(y,320)})},[A,n,y,e]);m.current=()=>I(p.current);let L=(0,X.useCallback)(()=>{f.current?m.current():d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&v.current(l.current)},[]);return(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let n,r=t.querySelector(`.map-composer-dock`),i=-1,a=-1,o=-1,s=new ResizeObserver(()=>{let e=r?.getBoundingClientRect().height||0;(i!==t.clientWidth||a!==t.clientHeight||o!==e)&&(i=t.clientWidth,a=t.clientHeight,o=e,t.style.setProperty(`--map-composer-height`,`${o}px`),c(e=>e.width===i&&e.height===a?e:{width:i,height:a}),clearTimeout(n),n=setTimeout(()=>{d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&!u.current?v.current(l.current):f.current&&m.current()},100))});return s.observe(t),r&&s.observe(r),()=>{s.disconnect(),clearTimeout(n)}},[e,t]),(0,X.useEffect)(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let r=e=>{if(e.target.closest(`.nowheel, .map-canvas-toolbar, .map-legend, .react-flow__minimap, .react-flow__controls`))return;e.preventDefault(),e.stopPropagation(),f.current=!1,u.current=!1,d.current=!0,C.current=null;let r=t.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top;S.current={x:i,y:a,until:performance.now()+1e3};let o=E.current??n.getViewport();!E.current&&o.zoom<=.32&&!w.current&&(x.current=o);let s=e.deltaY*(e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1),c=Rm(o.zoom*Math.exp(-Rm(s,-400,400)*.002),Im,Lm);if(E.current={x:i-(i-o.x)*c/o.zoom,y:a-(a-o.y)*c/o.zoom,zoom:c},y){n.setViewport(E.current),E.current=null;return}if(T.current)return;let l=performance.now(),p=e=>{if(!E.current)return;let t=1-Math.exp(-Math.min(e-l,64)/55);l=e;let r=n.getViewport(),i=E.current,a=Math.abs(i.zoom-r.zoom)<15e-5&&Math.abs(i.x-r.x)+Math.abs(i.y-r.y)<.15;n.setViewport(a?i:{x:r.x+(i.x-r.x)*t,y:r.y+(i.y-r.y)*t,zoom:r.zoom+(i.zoom-r.zoom)*t}),a?(T.current=0,E.current=null):T.current=requestAnimationFrame(p)};T.current=requestAnimationFrame(p)},i=()=>{A(),C.current=null,S.current=null},a=e=>{e.defaultPrevented||document.querySelector(`[role="dialog"][aria-modal="true"]`)||e.key===`Escape`&&![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&N()};return t.addEventListener(`wheel`,r,{passive:!1,capture:!0}),t.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a),()=>{A(),t.removeEventListener(`wheel`,r,!0),t.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a)}},[N,A,n,y,e]),{capture:(0,X.useCallback)(()=>({viewport:n.getViewport(),overview:x.current,focusId:l.current,detailed:!!l.current&&(u.current||!!w.current||n.getZoom()>=.44)}),[n]),restore:(0,X.useCallback)(e=>{A(),x.current=e.overview;let t=e.focusId&&n.getNode(e.focusId)?e.focusId:null;C.current=e.detailed?t:null,w.current=e.detailed&&t?{id:t,zoom:e.viewport.zoom}:null,d.current=!1,f.current=!1,n.setViewport(e.viewport,{duration:0}),j(null,e.viewport)},[A,n,j]),focusId:r,canvasSize:s,detailed:a,enter:M,back:N,fit:I,fitUpdatedScene:L,navigate:F,readStep:P,onMove:j,reducedMotion:y,zoomSteps:O}}function Ym(e,t,n,r=n){if(!n||!r)return[];let i=e.tasks.find(e=>e.id===n);if(!i||i.turn_kind===`qa`)return[];if(r===n)return[Me(i,Pe(e,i,i.started_ts??0))];let a=new Map(e.events.map(e=>[e.id,e.item_id]));return te(e,t,n).filter(e=>e.task_id===n&&e.key===r&&e.event_ids.every(e=>!a.get(e)||a.get(e)===n))}function Xm(e,t){let n=new Map(e.events.map(e=>[e.id,e]));return JSON.stringify(t.map(t=>{let r=e.tasks.find(e=>e.id===t.task_id),i=[t.task_id,`${t.task_id}:active`,`${t.task_id}:outcome`].includes(t.key),a=!r||i?r:{...r,status:``,summary:void 0,outcome:void 0,pending_question:void 0,started_ts:void 0,finished_ts:void 0,attempt:void 0};return[t,N(a,t.event_ids.flatMap(e=>n.get(e)?[n.get(e)]:[]))]}))}function Zm(e,t,n,r=600){let i=e=>[`done`,`failed`,`cancelled`,`recorded`,`skipped`].includes(e||``),a=e.tasks.filter(e=>e.id!==n&&e.turn_kind!==`qa`),o=[...a.filter(e=>i(e.status)),...a.filter(e=>!i(e.status))],s=[];for(let n of o){if(s.length>=r)break;s.push(...nt(e,n,pe(n,e.events,t)))}return s.slice(0,r)}function Qm(e,t,n,r=!0,a,c,u=!1,p=t,m){let h=n?`zh-CN`:`en-US`,g=e.kind===`live`?`project`:`dataset`,_=e.id.replace(/^live:/,``),v=l(),y=$e(c??_,h),b=v===`question-foundation`?m===void 0?y.id:m:null,x=v===`question-foundation`&&!b,S=f(g,_,h,c,v,b),C=o(),w=i({queryKey:S,queryFn:async({signal:e})=>{let t=v===`question-foundation`?await d.mapCopy(g,_,h,e,c,v,b):await d.mapCopy(g,_,h,e,c,v),n=C.getQueryData(S);return re(n,t,n?.model_revision)},staleTime:1/0,gcTime:72e5,refetchOnWindowFocus:!1}),T=e.tasks.find(e=>e.id===t),E=Ze(S,p,I(p,T)),D=(0,X.useMemo)(()=>a??(T?pe(T,e.events,n):[]),[T,e.events,n,a]),[O,k]=(0,X.useState)(0),[A,j]=(0,X.useState)(!1),M=(0,X.useRef)(!0),N=(0,X.useRef)(null),P=(0,X.useMemo)(()=>new Map(e.events.map(e=>[e.id,e])),[e.events]),F=u?te(e,D,t):Ym(e,D,t,p),L=(0,X.useMemo)(()=>u?Zm(e,n,t):[],[e,n,t,u]),R=[...F,...L].filter(t=>e.tasks.find(e=>e.id===t.task_id)?.turn_kind!==`qa`).filter(t=>oe(t,e,w.data,P)).slice(0,8),z=Xm(e,R),B=[`map-copy-generation`,g,_,h,c],ee=[...B,v,...v===`question-foundation`?[b]:[],w.data?.version??null,w.data?.model_revision??null,z],V=JSON.stringify(ee),H=s({queryKey:B}),U={queryKey:ee,queryFn:async()=>{let t=w.data?.model_revision,n=ue(C,S,R.map(t=>({key:t.key,startedAt:I(t.key,e.tasks.find(e=>e.id===t.task_id))}))),r;try{r=await d.generateMapCopy(g,_,{cards:R,locale:h,...b?{foundation_id:b}:{}},void 0,c,v,n.update)}finally{n.finish()}return C.setQueryData(S,e=>re(e,r,t)),{available:!r.retry_after&&r.available!==!1&&R.every(t=>!oe(t,e,r,P)),retryAfter:typeof r.retry_after==`number`&&r.retry_after>0?r.retry_after:null}},staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1},W=i({...U,enabled:!1}),G=W.isSuccess&&W.data.available===!1?W.data.retryAfter:null,ne=(0,X.useMemo)(()=>w.data?.generation_error?Error(w.data.generation_error.message):null,[w.data?.generation_error?.code,w.data?.generation_error?.message]),ie=()=>{let e=C.fetchQuery({...U,staleTime:0});return N.current=e,j(!0),e.then(()=>void 0,()=>void 0).finally(()=>{N.current===e&&(N.current=null,M.current&&(j(!1),k(e=>e+1)))}),e};(0,X.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]),(0,X.useEffect)(()=>{if(!r||x||!w.data?.available||!R.length||W.isError||W.isSuccess&&!G||H>0||N.current)return;let e=w.data.generation_error&&typeof w.data.retry_after==`number`&&w.data.retry_after>0?w.data.retry_after:0,t=Math.max(G?W.dataUpdatedAt+G*1e3:0,e?w.dataUpdatedAt+e*1e3:0),n=setTimeout(()=>{C.isFetching({queryKey:B})===0&&ie()},Math.max(700,t-Date.now()));return()=>clearTimeout(n)},[V,O,w.data?.available,w.data?.retry_after,w.dataUpdatedAt,r,x,H,W.status,W.dataUpdatedAt]);let ae=A||W.isFetching||H>0;return{copy:w.data,generating:ae,ready:w.isFetched,foundationRequired:x,questionContext:{locale:h,preview:v,foundationId:b},readingGenerating:E.active,generationPhase:E.phase,generationError:R.length&&!W.isFetching&&!E.active?W.error||ne:null,generationUnavailable:!!R.length&&!W.isFetching&&!E.active&&!G&&W.data?.available===!1,retry:async()=>{!r||x||!w.data?.available||!R.length||ae||N.current||await ie().catch(()=>void 0)},readingRequest:F.find(e=>e.key===p),readingNeedsUpdate:W.data?.available!==!0&&R.some(e=>e.key===p)}}var $m=new Set([`done`,`failed`,`cancelled`,`recorded`,`skipped`,`aborted`,`superseded`]);function eh(e,t,n,r,a){let o=n?`zh-CN`:`en-US`,s=e.kind===`live`?`project`:`dataset`,c=e.id.replace(/^live:/,``),l=(0,X.useMemo)(()=>{let n=new Map(e.tasks.map(e=>[e.id,$m.has(e.status||``)])),r=t.filter(e=>n.has(e.source)&&n.has(e.target)).slice(0,48);return JSON.stringify(r.map(e=>[e.source,e.target,n.get(e.source),n.get(e.target)]))},[e.tasks,t]),u=(0,X.useMemo)(()=>JSON.parse(l).map(([e,t])=>({source:e,target:t})),[l]),f=[`map-lines`,s,c,o,a,l],p=i({queryKey:[...f,`saved`],queryFn:({signal:e})=>d.mapLines(s,c,{pairs:u,locale:o,write:!1},e,a),enabled:u.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...f,`written`],queryFn:({signal:e})=>d.mapLines(s,c,{pairs:u,locale:o,write:!0},e,a),enabled:u.length>0&&r&&p.data?.available===!0&&p.data.lines.lengthJSON.stringify(e.tasks.filter(e=>e.kind!==`turn`&&e.turn_kind!==`qa`).slice(-40).map(e=>[e.id,nh.has(e.status||``)])),[e.tasks]),l=(0,X.useMemo)(()=>JSON.parse(c).map(([e])=>e),[c]),u=[`map-card-words`,o,s,a,r,c],f=i({queryKey:[...u,`saved`],queryFn:({signal:e})=>d.mapCardWords(o,s,{tasks:l,locale:a,write:!1},e,r),enabled:l.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...u,`written`],queryFn:({signal:e})=>d.mapCardWords(o,s,{tasks:l,locale:a,write:!0},e,r),enabled:l.length>0&&n&&f.data?.available===!0&&Object.keys(f.data.cards).length`u`||typeof window.matchMedia!=`function`?!1:window.innerWidth>=1024&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function oh({footer:e,value:t,onChange:n,onSend:r,attachments:i,onAttachmentsChange:a,pending:o,pendingLabel:s,progressVisible:l=!0,dispatchStatus:u,onCancel:d,focusSignal:f,sessionName:m,historical:_,zh:y,routeOverride:b=`auto`,onRouteOverrideChange:x}){let{t:S}=p(),C=(0,X.useId)(),w=(0,X.useRef)(null),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(!1),k=(0,X.useRef)(!0),A=(0,X.useRef)(),[M,N]=(0,X.useState)(``),[P,F]=(0,X.useState)(!1),[I,L]=(0,X.useState)(!1),[R,z]=(0,X.useState)(()=>!!(t.trim()||i.length)||ah()),[B,ee]=(0,X.useState)(44),V=(0,X.useRef)(t);V.current=t;let H=!R,{refs:W,text:G}=le(t),te=t.length>Ie,ne=!!(t.trim()||i.length),re=(0,X.useRef)(ne);re.current=ne,(0,X.useEffect)(()=>{u===`error`&&z(!0)},[u]),(0,X.useEffect)(()=>{k.current=!0;let e=e=>{let t=e.type===`focusout`?e.relatedTarget:e.target;t?.closest?.(`.map-island-launch, .map-island-stop, .map-composer-brand`)||(T.current?.contains(t)?z(!0):re.current||z(!1))},t=e=>{let t=e.target;T.current?.contains(t)||t?.closest?.(`.map-context-menu`)||re.current||(z(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur())},n=e=>{if(e.key!==`c`||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||e.isComposing)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)||t?.closest?.(`[role="dialog"], [role="menu"]`)||(e.preventDefault(),z(!0),w.current?.focus())};return document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e),document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{k.current=!1,clearTimeout(A.current),document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[]);let ie=(0,X.useRef)(f);(0,X.useEffect)(()=>{f!==ie.current&&(ie.current=f,z(!0),w.current?.focus())},[f]);let ae=(0,X.useRef)(W.length);(0,X.useEffect)(()=>{W.length>ae.current&&(z(!0),w.current?.focus()),ae.current=W.length},[W.length]);let K=()=>{if(!w.current)return;w.current.style.height=`0px`;let e=Math.min(156,Math.max(44,w.current.scrollHeight));w.current.style.height=`${e}px`,ee(e)};(0,X.useEffect)(K,[G]),(0,X.useEffect)(()=>(window.addEventListener(`resize`,K),()=>window.removeEventListener(`resize`,K)),[]);let oe=()=>{z(!0),w.current?.focus()},ce=()=>{z(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur()},ue=(0,X.useRef)(),de=(0,X.useRef)(typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches);(0,X.useEffect)(()=>()=>clearTimeout(ue.current),[]);let fe=()=>{de.current&&(clearTimeout(ue.current),z(!0))},q=()=>{de.current&&(clearTimeout(ue.current),ue.current=setTimeout(()=>{re.current||T.current?.contains(document.activeElement)||z(!1)},320))};(0,X.useEffect)(()=>{o||L(!1)},[o]);let pe=async()=>{if(!G.trim()||D.current||te)return;let e=o;if(e&&i.length){N(y?`附件要等这条回复结束后再发送`:`Attachments can be sent once this reply finishes`);return}D.current=!0;try{(e?await r(t,[],void 0,{whileRunning:!0}):await r(t,i))&&k.current&&(N(``),F(!0),L(e),(!V.current.trim()||V.current===t)&&ce(),clearTimeout(A.current),A.current=setTimeout(()=>F(!1),1800))}finally{D.current=!1}},me=e=>{if(o||D.current||!e.length)return;let{accepted:t,issues:n}=Je(i,e);a([...i,...t]),N(n.map(e=>e.code===`unsupported`?S(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?S(`chat.attachTooLarge`,{name:e.fileName,size:O(e.limitBytes)}):e.code===`too-many`?S(`chat.attachTooMany`,{count:e.limitCount}):S(`chat.attachTotalTooLarge`,{size:O(e.limitBytes)})).join(` `))},he=u?{launching:[y?`任务已接收`:`Task accepted`,y?`正在放入地图…`:`Adding it to your map…`],task:[y?`任务已进入地图`:`Your task is on the map`,y?`跟随地图,查看执行进展`:`Follow its progress on the map`],message:[y?`${c().name} 已回复`:`${c().name} replied`,y?`在对话中查看回复`:`Open the conversation to read it`],error:[y?`发送没有成功`:`Message could not be sent`,y?`草稿已保留,可以重试`:`Your draft is ready to retry`],cancelled:[y?`正在停止回复`:`Stopping reply`,y?`可以发送新消息`:`You can send another message`]}[u]:void 0,ge=[y?`已排队`:`Queued`,y?`这条回复结束后立即处理`:`Answered right after this reply`],_e=he?.[0]||(o&&I?ge[0]:o?l?y?`${c().name} 正在处理`:`${c().name} is working`:y?`继续对话`:`Continue chatting`:P?y?`已发送给 ${c().name}`:`Sent to ${c().name}`:y?`交给 ${c().name}`:`Ask ${c().name}`),ve=he?.[1]||(o&&I?ge[1]:o?l?s||(y?`正在处理你的消息…`:`Processing your message…`):y?`可发送后续消息或停止回复`:`Send a follow-up or stop the reply`:P?y?`点此继续对话`:`Tap to keep the conversation going`:ne?y?`草稿已保留,点此继续`:`Draft saved — tap to continue`:y?`描述目标,看它变成成果`:`Turn your next idea into a result`),ye=u||(o?`working`:P?`sent`:`idle`);return(0,Y.jsxs)(`div`,{ref:T,className:`map-composer-dock map-island-dock`,"data-compact":H,"data-state":ye,"data-pending":o,style:{"--map-editor-height":`${B}px`},onPointerEnter:fe,onPointerLeave:q,onTransitionEnd:e=>{e.target===T.current&&e.propertyName===`width`&&K()},children:[!H&&W.length>0&&(0,Y.jsx)(`div`,{className:`map-reference-chips`,children:W.map((e,t)=>(0,Y.jsxs)(`span`,{title:`${e.source} · ${e.task_id} ${e.step_id||``}`,children:[(0,Y.jsxs)(`span`,{children:[y?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,Y.jsx)(`button`,{"aria-label":y?`移除引用`:`Remove reference`,onClick:()=>n(W.filter((e,n)=>t!==n).map(U).join(``)+G),children:(0,Y.jsx)(v,{size:12})})]},`${e.task_id}:${e.step_id}:${t}`))}),!H&&!!i.length&&(0,Y.jsx)(`div`,{className:`map-attachment-tray nowheel`,role:`group`,"aria-label":y?`待发送附件`:`Selected attachments`,children:i.map((e,t)=>(0,Y.jsx)(Ge,{file:e,disabled:o,removeLabel:S(`chat.attachRemove`,{name:e.name}),onRemove:()=>{a(i.filter(t=>t!==e)),N(``)}},`${e.name}:${e.lastModified}:${t}`))}),!H&&M&&(0,Y.jsx)(`div`,{className:`map-attachment-notice nowheel`,role:`alert`,children:M}),(0,Y.jsxs)(`div`,{className:`map-composer map-island-surface`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":S(`chat.attach`),title:S(`chat.attach`),"aria-hidden":H,tabIndex:H?-1:0,disabled:o&&!H,onClick:()=>E.current?.click(),children:(0,Y.jsx)(j,{size:25})}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-island-launch`,"aria-label":y?`打开消息输入`:`Open message composer`,"aria-expanded":!H,"aria-controls":C,"aria-hidden":!H,tabIndex:H?0:-1,onClick:oe,children:[(0,Y.jsxs)(`span`,{className:`map-island-copy`,children:[(0,Y.jsx)(`strong`,{children:_e}),(0,Y.jsx)(`small`,{title:ve,children:ve})]}),(0,Y.jsx)(`span`,{className:`map-island-indicator`,"aria-hidden":`true`,children:ye===`working`||ye===`launching`?(0,Y.jsxs)(`span`,{className:`map-island-wave`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}):ye===`sent`||ye===`task`||ye===`message`?(0,Y.jsx)(g,{size:16}):(0,Y.jsx)(at,{size:15})})]}),H&&o&&(0,Y.jsx)(`button`,{type:`button`,className:`map-island-stop`,onClick:d,"aria-label":y?`停止回复`:`Stop reply`,children:(0,Y.jsx)(be,{size:13})}),(0,Y.jsxs)(`form`,{id:C,className:`map-composer-editor`,"aria-hidden":H,onSubmit:e=>{e.preventDefault(),pe()},children:[(0,Y.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:xe,hidden:!0,disabled:o,onChange:e=>{me(Array.from(e.target.files||[])),e.target.value=``}}),(0,Y.jsx)(`textarea`,{ref:w,rows:1,tabIndex:H?-1:0,value:G,"aria-label":y?`给 ${c().name} 发送消息`:`Message ${c().name}`,placeholder:y?`告诉 ${c().name},你想完成什么…`:`What would you like ${c().name} to do?`,onFocus:()=>z(!0),onChange:e=>{F(!1),n(W.map(U).join(``)+e.target.value)},onPaste:e=>{let t=Ce(e.clipboardData);t.length&&(e.preventDefault(),me(t))},onKeyDown:e=>{e.key===`Escape`&&!Ee(e)&&!G.trim()&&!i.length&&(e.preventDefault(),e.stopPropagation(),ce()),e.key===`Enter`&&!e.shiftKey&&!Ee(e)&&(e.preventDefault(),pe())}}),(0,Y.jsxs)(`div`,{className:`map-island-toolbar`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-island-collapse`,tabIndex:H?-1:0,onClick:ce,"aria-label":y?`收起消息输入`:`Collapse message composer`,title:y?`收起(草稿会保留)`:`Collapse (draft is kept)`,children:(0,Y.jsx)(h,{size:15})}),x&&(0,Y.jsx)(Be,{value:b,onChange:x,disabled:o,tabIndex:H?-1:0}),o&&(0,Y.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),d()},tabIndex:H?-1:0,"aria-label":y?`停止回复`:`Stop reply`,className:`map-send is-pending`,children:(0,Y.jsx)(be,{size:15})},`stop`),(0,Y.jsx)(`button`,{type:`submit`,tabIndex:H?-1:0,disabled:!G.trim()||te,"aria-label":o?y?`在 ${c().name} 工作时发送`:`Send while ${c().name} works`:y?`发送消息`:`Send message`,title:o?y?`排队到这条回复之后处理`:`Queued right after this reply`:void 0,className:`map-send`,children:(0,Y.jsx)(se,{size:20})},`send`)]})]})]}),te&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1 px-3 text-xs text-err`,children:S(`chat.messageTooLong`)}),e,(0,Y.jsx)(`span`,{className:`map-composer-caption`,role:`status`,children:he?`${he[0]} · ${he[1]}`:o&&I?`${ge[0]} · ${ge[1]}`:o?``:P?y?`已发送`:`Sent`:_?`${y?`发送至`:`Send to`} ${m}`:``})]})}function sh(e,t,n){if(e.length<2)return``;let r=[0];for(let t=1;t0))return``;let a=Math.min(n,i/3),o=a*1.22,s=1,c=t=>{let n=Math.max(0,Math.min(i,t));for(;s1&&r[s-1]>n;)s--;let a=r[s]-r[s-1]||1,o=(n-r[s-1])/a,c=e[s-1],l=e[s];return{x:c.x+(l.x-c.x)*o,y:c.y+(l.y-c.y)*o}},l=e=>e*e*(3-2*e),u=e=>{let n=i-e;if(n<=a)return t*2.5*(n/a)**.85;let r=t*(.34+.66*l(Math.min(1,e/Math.max(1,i-o))));return n>=o?r:r+(t*2.5-r)*l((o-n)/(o-a))},d=Math.max(12,Math.min(72,Math.round(i/Math.max(a,1)*1.5))),f=Array.from({length:d+1},(e,t)=>(i-o)*(t/d));f.push(i-(o+a)/2,i-a,i);let p=[],m=[],h=e=>Math.round(e*100)/100;for(let e of f){let t=c(e),n=c(e-i*.004-.5),r=c(e+i*.004+.5),a=r.x-n.x,o=r.y-n.y,s=Math.hypot(a,o)||1,l=u(e)/2,d=-o/s*l,f=a/s*l;p.push(`${h(t.x+d)} ${h(t.y+f)}`),m.push(`${h(t.x-d)} ${h(t.y-f)}`)}return`M ${p.join(` L `)} L ${m.reverse().join(` L `)} Z`}function ch(e,t){let n=1-t;return{x:n**3*e[0].x+3*n**2*t*e[1].x+3*n*t**2*e[2].x+t**3*e[3].x,y:n**3*e[0].y+3*n**2*t*e[1].y+3*n*t**2*e[2].y+t**3*e[3].y}}function lh(e,t,n=!1){if(!e.length)return null;let r=n?[...e].reverse():e,i=0;for(let e=1;e0&&i+n>=t){let a=(t-i)/n;return{x:r[e-1].x+(r[e].x-r[e-1].x)*a,y:r[e-1].y+(r[e].y-r[e-1].y)*a}}i+=n}return r[r.length-1]}function uh(e,t,n=0){return e.x>t.x-n&&e.xt.y-n&&e.y({x:n===`left`?-e.x:e.x,y:n===`up`?-e.y:e.y}),s=o(e),c=o(t);i=i.map(e=>({...e,x:n===`left`?-e.x-e.width:e.x,y:n===`up`?-e.y-e.height:e.y}));let l=Math.max(80,n===`loop`?Math.max(Math.abs(c.x-s.x),Math.abs(c.y-s.y))*2.8:0,Math.abs(a?c.y-s.y:c.x-s.x)*(.4+r*.06)),u=[s,a?{x:s.x+0,y:s.y+l}:{x:s.x+l,y:s.y},n===`loop`?{x:c.x,y:c.y+l}:a?{x:c.x-0,y:c.y-l}:{x:c.x-l,y:c.y},c],d=e=>e.flatMap(e=>Array.from({length:31},(t,n)=>ch(e,n/30))),f=e=>d(e).reduce((e,t)=>e+i.filter(e=>uh(t,e,22)).length,0),p=[u],m=f(p)*1e5;if(m){let e={x:(s.x+c.x)/2,y:(s.y+c.y)/2},t=a?e.x:e.y,n=[...new Set(i.flatMap(e=>a?[e.x-110-r*30,e.x+e.width+110+r*30]:[e.y-110-r*30,e.y+e.height+110+r*30]))].sort((e,n)=>Math.abs(e-t)-Math.abs(n-t)).slice(0,12);for(let e of n){let n=(e-t)*4/3;for(let r of[.25,.4,.55]){let i=Math.max(60,Math.abs(a?c.y-s.y:c.x-s.x)*r),o=[a?[s,{x:s.x+n,y:s.y+i},{x:c.x+n,y:c.y-i},c]:[s,{x:s.x+i,y:s.y+n},{x:c.x-i,y:c.y+n},c]],l=f(o)*1e5+Math.abs(e-t)+Math.abs(r-.4)*100;le.map(o)),{path:`M ${e.x} ${e.y}`+p.map(e=>` C ${e[1].x} ${e[1].y}, ${e[2].x} ${e[2].y}, ${e[3].x} ${e[3].y}`).join(``),points:d(p),labels:[.5,.4,.6,.3,.7,.2,.8,.35,.45,.55,.65,.25,.75,.15,.85].map(e=>{let t=Math.min(p.length-1,Math.floor(e*p.length));return ch(p[t],e*p.length-t)})}}var fh=new WeakMap,ph=.5,mh=.05;function hh(e){return e>=ph?Math.max(ph,Math.floor(e*8)/8):ee+(/[^\x00-\x7F]/.test(t)?10.5:7),20);return{width:Math.min(t,216),height:26}}function vh(e,t){let n=e.getState(),r=[...n.nodeLookup.values()].filter(e=>!e.hidden).map(e=>({id:e.id,...e.internals.positionAbsolute,width:e.width||e.measured.width||0,height:e.height||e.measured.height||0}));function i(e,t){let r=n.nodeLookup.get(e);if(!r)return null;let{x:i,y:a}=r.internals.positionAbsolute,o=r.width||r.measured.width||0,s=r.height||r.measured.height||0;return{x:i+(t===`left`?0:t===`right`?o:o/2),y:a+(t===`top`?0:t===`bottom`?s:s/2)}}let a=n.edges.filter(e=>!e.hidden).map(e=>({...e,s:i(e.source,e.sourceHandle),t:i(e.target,e.targetHandle)})),o=JSON.stringify([r,a.map(e=>[e.id,e.s,e.t,e.label,e.data?.lane,e.sourceHandle,e.targetHandle,e.className])]),s=fh.get(e);if(!s||s.key!==o){let t=new Map,n=new Map;for(let e of a)n.set(e.id,/(?:^|\s)map-edge-(\w+)/.exec(e.className??``)?.[1]),e.s&&e.t&&t.set(e.id,dh(e.s,e.t,e.source===e.target?`loop`:e.sourceHandle===`left`?`left`:e.sourceHandle===`top`?`up`:e.sourceHandle===`bottom`,Number(e.data?.lane||0),r.filter(t=>t.id!==e.source&&t.id!==e.target)));s={key:o,routes:t,kinds:n,zoom:-1,labels:new Map},fh.set(e,s)}let c=hh(t);return s.zoom!==c&&(s.zoom=c,s.labels=new Map,c&&yh(s,a,r,c)),s}function yh(e,t,n,r){let i=[...n],a=e=>+!!e.data?.quiet;for(let n of[...t].sort((e,t)=>a(e)-a(t))){let t=e.routes.get(n.id);if(!t||!n.label)continue;let a=_h(n.label),o=a.width/r,s=a.height/r,c=[0,3,4,5,6][Number(n.data?.lane||0)%5],l=[t.labels[c],...t.labels.filter((e,t)=>t!==c)].filter(e=>i.every(t=>e.x+o/2<=t.x||e.x-o/2>=t.x+t.width||e.y+s/2<=t.y||e.y-s/2>=t.y+t.height)),u,d=1/0;for(let t of l){let r={x:t.x-o/2,y:t.y-s/2,width:o,height:s},i=0;for(let[t,a]of e.routes)t!==n.id&&a.points.some(e=>uh(e,r))&&i++;if(ie),a=(0,X.useId)().replace(/:/g,``),o=`relation-arrow-${a}`,s=`relation-flow-${a}`,c=vh(vu(),i),l=c.routes.get(e),u=c.labels.get(e);if(!l)return null;let d=c.kinds.get(e),f=d===`fanout`||d===`fanin`,p=!d||n?.stroke===bh?n?.stroke||`#7594ad`:`var(--map-edge-${d}, ${n?.stroke||`#7594ad`})`,m=(Number(n?.strokeWidth||2)+(f?.4:0))/i,h=f?lh(l.points,(d===`fanout`?2:15)/i,d===`fanin`):null,g=typeof t==`string`?gh(t):void 0,_=l.points[0],v=l.points[l.points.length-1],y=!!_&&!!v&&n?.stroke!==bh&&(Math.abs(_.x-v.x)>1||Math.abs(_.y-v.y)>1),b=!f&&!n?.strokeDasharray,x=b?sh(l.points,Number(n?.strokeWidth||2)*1.45/i,16/i):``;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`defs`,{children:[(0,Y.jsx)(`marker`,{id:o,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:9/i,markerHeight:9/i,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,style:{fill:p}})}),y&&(0,Y.jsxs)(`linearGradient`,{id:s,gradientUnits:`userSpaceOnUse`,x1:_.x,y1:_.y,x2:v.x,y2:v.y,children:[(0,Y.jsx)(`stop`,{offset:`0`,style:{stopColor:p,stopOpacity:b?.34:.28}}),(0,Y.jsx)(`stop`,{offset:`0.55`,style:{stopColor:p,stopOpacity:b?.7:.78}}),(0,Y.jsx)(`stop`,{offset:`1`,style:{stopColor:p,stopOpacity:1}})]})]}),(0,Y.jsxs)(lm,{path:l.path,delay:r?.growthDelay,padding:24/i,children:[(0,Y.jsx)(wf,{id:e,path:l.path,markerEnd:x?void 0:`url(#${o})`,style:{...n,stroke:x?`transparent`:y?`url(#${s})`:p,strokeLinecap:`round`,vectorEffect:`none`,strokeWidth:m,strokeDasharray:n?.strokeDasharray?String(n.strokeDasharray).split(/[\s,]+/).map(e=>Number(e)/i).join(` `):void 0}}),x&&(0,Y.jsx)(`path`,{className:`map-edge-ink`,d:x,style:{fill:y?`url(#${s})`:p,opacity:n?.opacity},"aria-hidden":`true`}),!f&&_&&(0,Y.jsx)(`circle`,{className:`map-edge-anchor`,cx:_.x,cy:_.y,r:(x?2.1:2.6)/i,style:x?{fill:p,opacity:Number(n?.opacity??1)*.62}:{fill:`var(--map-paper)`,stroke:p,strokeWidth:1.4/i,opacity:n?.opacity},"aria-hidden":`true`}),h&&(0,Y.jsx)(`circle`,{className:`map-edge-joint`,cx:h.x,cy:h.y,r:3.2/i,style:{fill:p,opacity:n?.opacity},"aria-hidden":`true`})]}),(r?.active&&!r.muted||r?.lit)&&(0,Y.jsx)(Tp,{children:(0,Y.jsx)(`div`,{className:`map-edge-spark`,"data-lit":!r?.active&&!!r?.lit,"aria-hidden":`true`,style:{offsetPath:`path("${l.path}")`,width:8/i,height:8/i,margin:`${-4/i}px 0 0 ${-4/i}px`,animationDelay:`${-((e.charCodeAt(0)*131+e.length*47)%2800)}ms`}})}),t&&g!==``&&u&&(0,Y.jsx)(Tp,{children:(0,Y.jsx)(`div`,{className:`map-relation-label nodrag nopan`,"data-kind":d,"data-lit":!!r?.lit,"data-quiet":!!r?.quiet,title:g,style:{opacity:r?.quiet&&!r.lit?0:n?.opacity,pointerEvents:r?.quiet&&!r.lit?`none`:void 0,transform:`translate(-50%, -50%) translate(${u.x}px, ${u.y}px) scale(${1/i})`},children:g??t})})]})}function Sh({open:e,info:t,zh:n,onChoose:r,readOnly:i=!1}){return(0,Y.jsx)(S,{open:e,onClose:()=>r({mode:`off`}),label:n?`选择地图加载范围`:`Choose map history`,width:`max-w-lg`,children:(0,Y.jsxs)(`div`,{className:`map-history-choice`,children:[(0,Y.jsx)(`h2`,{children:n?`选择地图加载范围`:`Choose map history`}),(0,Y.jsx)(`p`,{children:n?`本会话有 ${t.task_count} 个任务,历史记录约 ${(t.event_bytes/1024/1024).toFixed(1)} MB。`:`This session has ${t.task_count} tasks and about ${(t.event_bytes/1024/1024).toFixed(1)} MB of history.`}),(0,Y.jsx)(`p`,{children:i?n?`只读模式只加载历史记录,不调用模型。较长历史需要一些加载时间。`:`Read-only mode loads records without model calls. Long histories take time to load.`:n?`加载较长历史需要一些时间。生成卡片摘要与关系说明会调用已配置的模型,并消耗额外 Token。已有摘要会优先复用。`:`Loading a long history takes time. Card summaries and relationship descriptions use your configured model and consume additional tokens. Existing summaries are reused.`}),(0,Y.jsxs)(`div`,{className:`map-history-options`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`current`,since:t.current_task_ts,eventSince:t.current_event_ts,taskId:t.current_task_id||void 0}),children:[(0,Y.jsx)(`strong`,{children:n?`从当前进度加载`:`Start at current progress`}),(0,Y.jsx)(`span`,{children:n?`推荐 · 加载当前任务及后续进度,保留相关连接`:`Recommended · Load current and future work with its connections`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`full`}),children:[(0,Y.jsx)(`strong`,{children:n?`从头加载`:`Load from the beginning`}),(0,Y.jsx)(`span`,{children:i?n?`分批加载历史记录,查看已有说明`:`Load history in pages and view existing explanations`:n?`分批加载历史记录;打开卡片阅读时,再整理它的说明`:`Load history in pages; prepare an explanation when you open a card to read`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`off`}),children:[(0,Y.jsx)(`strong`,{children:n?`不开启地图模式`:`Keep map mode off`}),(0,Y.jsx)(`span`,{children:n?`不加载地图,也不生成摘要`:`Do not load the map or generate summaries`})]})]}),(0,Y.jsx)(`small`,{children:n?`选择仅用于本会话,可随时更改加载范围。`:`This choice applies to this session and can be changed later.`})]})})}var Ch=new Map;function wh(e){let t=Ch.get(e);if(t)return t;try{let t=JSON.parse(A(`argus.map.camera.v1:`+e)||`null`);if(t&&[t.viewport,t.overview].every(e=>e&&[e.x,e.y,e.zoom].every(Number.isFinite)&&e.zoom>=.035&&e.zoom<=3.5)&&(t.focusId===null||typeof t.focusId==`string`)&&typeof t.detailed==`boolean`)return{camera:t}}catch{}return{}}function Th(e,t){for(Ch.delete(e),Ch.set(e,t);Ch.size>8;)Ch.delete(Ch.keys().next().value);t.camera&&k(`argus.map.camera.v1:`+e,JSON.stringify(t.camera))}var Eh={task:xm,branch:Pm},Dh={relation:xh},Oh={done:`#a9c4b6`,running:`#9fb6cc`,question:`#dcc797`,failed:`#d9a79f`,review_unavailable:`#cdbba3`,held:`#cdbba3`,paused:`#cdbba3`,superseded:`#c5bdcd`,aborted:`#c6c8cb`,skipped:`#c6c8cb`,missing:`#c6c8cb`};function kh({events:e,zh:t}){let n=[...new Map(e.filter(e=>e.type===`team.task`).map(e=>[e.id,e])).values()];if(!n.length)return null;let r=n.filter(e=>e.status===`done`).length,i=n.filter(e=>ge.has(e.status||``)).length,a=n.filter(e=>e.status===`failed`).length;return(0,Y.jsxs)(`div`,{className:`map-team-progress`,role:`status`,"aria-label":t?`子任务进度`:`Subtask progress`,children:[(0,Y.jsx)(`strong`,{children:t?`子任务`:`Subtasks`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(g,{size:12}),(0,Y.jsxs)(`b`,{children:[r,`/`,n.length]}),` `,t?`已完成`:`completed`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:i}),` `,t?`进行中`:`running`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:a}),` `,t?`失败`:`failed`]})]})}function Ah({data:e,zh:t,composer:n,activePhase:r,waiting:s,snapshot:c,currentTaskId:l,events:u,pendingLabel:f,readOnly:p,sessionId:m,viewKey:h,paused:g,actions:y,replacements:O}){let[k,A]=(0,X.useState)(!1),[j,N]=(0,X.useState)(()=>e.kind===`live`&&!p&&y.conversationEvents.some(e=>e.type===`ui.operator`||e.type===`ui.argus`)),P=[...y.conversationEvents].reverse().find(e=>e.type===`ui.operator`),F=P?String(P.message_id||P.ts||``):``,I=(0,X.useRef)(F),R=(0,X.useRef)(n.pending);(0,X.useEffect)(()=>{e.kind===`live`&&!p&&(F&&F!==I.current||n.pending&&!R.current)&&(N(!0),A(!1)),I.current=F,R.current=n.pending},[F,n.pending,e.kind,p]);let[z,B]=(0,X.useState)(()=>new Set),V=(0,X.useCallback)(e=>{B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[G,te]=(0,X.useState)(null),re=(0,X.useRef)(0),ae=(0,X.useRef)(!0);(0,X.useEffect)(()=>(ae.current=!0,()=>{ae.current=!1}),[]);let K=(0,X.useMemo)(()=>M(e.tasks),[e.tasks]),[oe,se,ue]=Ep([]),fe=(0,X.useRef)(null),q=Jm(fe,!p),pe=Op(),be=(0,X.useRef)(!1),[xe,Se]=(0,X.useState)(!1),Ce=(0,X.useRef)(null);Ce.current||=wh(h);let[Ee,Oe]=(0,X.useState)(()=>{let e=Ce.current?.scene?.cards.find(e=>e.id===Ce.current?.camera?.focusId);return new Set(e&&e.id!==e.task.id?[e.task.id]:[])}),[ke,Ae]=(0,X.useState)(null),[Me]=(0,X.useState)(()=>new Set(Ce.current?.scene?.cards.map(e=>e.id))),Ne=oe.find(e=>e.id===q.focusId),Pe=(0,X.useMemo)(()=>je(e.tasks,e.events),[e.tasks,e.events]),Fe=$e(m,t?`zh-CN`:`en-US`),[Ie,Le]=(0,X.useState)(null),Be=(0,X.useCallback)((t,n)=>{Le(r=>n?{nodeId:t,key:n,foundationId:Fe.id}:r?.nodeId===t&&!e.tasks.some(e=>e.id===r.key)?null:r)},[e.tasks,Fe.id]);(0,X.useEffect)(()=>{Le(t=>t&&(t.nodeId===q.focusId||e.tasks.some(e=>e.id===t.key))?t:null)},[q.focusId,e.tasks]);let J=Ie?e.tasks.find(e=>e.id===Ie.key):void 0,Ge=J?.turn_kind===`qa`?e.events.find(e=>e.item_id===J.id&&e.type===`turn.replied`):void 0,Je=Ie?oe.find(e=>e.id===Ie.nodeId):void 0,Xe=J?.id??(Ie?.nodeId===q.focusId?Ie.key:null),Ze=(0,X.useMemo)(()=>ce(e.tasks),[e.tasks]),tt=Ze.findIndex(e=>e.id===Ne?.data.task.id),[nt,it]=(0,X.useState)(null),at=K.tasks.find(e=>e.id===nt),ot=(0,X.useMemo)(()=>at?Ke(K,at.id):null,[K,at]),lt=(0,X.useMemo)(()=>at&&ot?new Set([at.id,...ot.upstream.map(e=>e.id),...ot.downstream.map(e=>e.id)]):null,[at,ot]),{copy:ut,ready:ft,generating:pt,readingRequest:mt,readingNeedsUpdate:ht,readingGenerating:gt,generationPhase:vt,foundationRequired:bt,questionContext:St,generationError:Ct,generationUnavailable:wt,retry:Et}=Qm(e,J?.id||Ne?.data.task.id||null,t,!p&&!e.history_loading,Ne?.data.layout.steps,m,!1,Xe,Ie?.foundationId),kt=(0,X.useMemo)(()=>mt?{request:mt,questionContext:St,pending:ht,generating:gt,phase:vt,error:Ct,unavailable:wt,foundationRequired:bt,retry:p?void 0:Et,retryDisabled:pt}:void 0,[mt,St,ht,pt,gt,vt,Ct,wt,p,Et,bt]),jt=(0,X.useMemo)(()=>Ye(Te(K,ut?.relations||[],t)),[K,ut?.relations,t]),Mt=ih(e,t,!p&&!e.history_loading,m),Nt=eh(e,jt,t,!p&&!e.history_loading,m),Pt=(0,X.useMemo)(()=>Te(K,ut?.relations||[],t,Nt),[K,ut?.relations,t,Nt]),Ft=(0,X.useRef)(Ce.current.scene),It=(q.canvasSize.width||window.innerWidth)<640,Z=(0,X.useMemo)(()=>{let n=H(K,e.events,t,Ft.current,Pt,Ee,It);return Ft.current=a(Ft.current,n),Ft.current},[K,e.events,t,Pt,Ee,It]),Lt=(0,X.useRef)(null),Rt=(0,X.useMemo)(()=>(Lt.current=a(Lt.current,ze(ve(K,e.events,t,48),z,t)),Lt.current),[K,e.events,t,z]),zt=(0,X.useRef)(null),Bt=(0,X.useMemo)(()=>{let e=Rt.tasks.filter(e=>e.branch);if(!e.length)return{links:Z.links,positions:Z.positions,frames:Z.frames,structure:Z.structure,branches:e,branchAnchor:new Map};let t=new Map;for(let e of Z.cards)t.set(e.task.id,e.id);let n=new Map(e.map(e=>[e.id,t.get(e.parent_id)??e.parent_id])),r={...Z.frames};for(let t of e)r[t.id]={...t.group?Am:km,scale:1};let i=[...Z.links,...Rt.links.filter(e=>e.kind===`fanout`||e.kind===`fanin`).map(e=>({...e,source:t.get(e.source)??e.source,target:t.get(e.target)??e.target}))],a=new Map;for(let t of e){let e=n.get(t.id);a.set(e,[...a.get(e)??[],t.id])}let o=Z.cards.flatMap(e=>[e.id,...a.get(e.id)??[]]),s=JSON.stringify([o.map(e=>[e,r[e].width,r[e].height]),i.map(e=>[e.source,e.target,e.kind])]),c=zt.current?.structure===s?zt.current.positions:he(o,i,r);return zt.current={structure:s,positions:c},{links:i,positions:c,frames:r,structure:s,branches:e,branchAnchor:n}},[Z,Rt]),Vt=Tt(Bt.positions,q.reducedMotion),[Ht,Ut]=(0,X.useState)(null),Wt=(0,X.useMemo)(()=>Dt(Bt.links,Ht),[Bt.links,Ht]),[Gt,Kt]=(0,X.useState)(!1),[qt,Jt]=(0,X.useState)(!1),Yt=(0,X.useMemo)(()=>new Map(Z.cards.map(e=>[e.id,e.ordinal])),[Z.cards]),Xt=xt(Z,!!e.history_loading),Zt=(0,X.useMemo)(()=>We(e.events),[e.events]),Qt=async(e,t=[],r,i)=>{if(i?.whileRunning)return n.onSend(e,t,void 0,i);let a=++re.current,o=fe.current?.querySelector(`.map-composer`)?.getBoundingClientRect();te({id:a,text:le(e).text.replace(/\s+/g,` `).slice(0,180),origin:{x:o?.left??20,y:o?.top??innerHeight-100,width:o?.width??260,height:o?.height??56}});let s=!1,c=e=>{e.type===`task`&&(s=!0),ae.current&&e.type===`settled`&&e.outcome===`message`&&!s&&(N(!0),A(!1)),ae.current&&te(t=>t?.id===a?{...t,result:e}:t)};try{let r=await n.onSend(e,t,c);return r&&ae.current&&le(e).refs.length>0&&(N(!0),A(!1)),r||c({type:`settled`,outcome:`error`}),r}catch(e){throw c({type:`settled`,outcome:`error`}),e}},$t=()=>{te(e=>e?{...e,result:{type:`settled`,outcome:`cancelled`}}:null),n.onCancel()};(0,X.useEffect)(()=>{if(!pe||be.current||!ft||Ce.current?.camera&&e.history_loading)return;let t=requestAnimationFrame(()=>{if(be.current=!0,Ce.current?.camera)q.restore(Ce.current.camera);else if(q.fit(),e.kind===`live`&&fe.current.clientWidth<640){let t=qe(e.tasks);t&&q.fit(new Set([t.id]))}Se(!0)});return()=>cancelAnimationFrame(t)},[pe,q.fit,q.enter,q.restore,e.kind,e.tasks,Z.cards,e.history_loading,ft]),(0,X.useEffect)(()=>{let e=fe.current;if(!e||q.reducedMotion)return;let t=null,n=n=>{t??=requestAnimationFrame(()=>{t=null;let r=e.getBoundingClientRect();!r.width||!r.height||(e.style.setProperty(`--lean-x`,((n.clientX-r.left)/r.width-.5).toFixed(3)),e.style.setProperty(`--lean-y`,((n.clientY-r.top)/r.height-.5).toFixed(3)))})},r=()=>{e.style.setProperty(`--lean-x`,`0`),e.style.setProperty(`--lean-y`,`0`)};return e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,r),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,r)}},[q.reducedMotion]),(0,X.useEffect)(()=>{if(!xe||Ce.current?.camera||q.reducedMotion)return;Kt(!0);let e=window.setTimeout(()=>Kt(!1),Ot);return()=>window.clearTimeout(e)},[xe,q.reducedMotion]),(0,X.useEffect)(()=>{let e=()=>{be.current&&Th(h,{scene:Ft.current,camera:q.capture()})};return window.addEventListener(`pagehide`,e),()=>{e(),window.removeEventListener(`pagehide`,e)}},[h,q.capture]),(0,X.useEffect)(()=>{if(!pe)return;let e=requestAnimationFrame(q.fitUpdatedScene);return()=>cancelAnimationFrame(e)},[Bt.structure,pe,q.fitUpdatedScene]);let en=(0,X.useRef)(n);en.current=n;let tn=(0,X.useCallback)(e=>{if(p)return;let t=en.current;t.onChange(U(e)+t.value),window.setTimeout(()=>document.querySelector(`.map-composer textarea`)?.focus(),0)},[p]),[nn,rn]=(0,X.useState)(null),an=o(),on=i({queryKey:[`map-notes`,m],queryFn:({signal:e})=>d.mapNotes(m,e),enabled:e.kind===`live`&&!p,staleTime:6e4}),sn=(0,X.useMemo)(()=>({notes:Om(on.data?.notes??[])}),[on.data]),[cn,ln]=(0,X.useState)(null),[un,dn]=(0,X.useState)(``),[fn,pn]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!cn)return;let e=e=>{e.target.closest(`.map-note-editor`)||ln(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),ln(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[cn]);let mn=async()=>{let e=cn,t=un.trim();if(!(!e||!t)){pn(!1);try{await d.addMapNote(m,{node_id:e.ref.task_id,text:t}),await an.invalidateQueries({queryKey:[`map-notes`,m]}),ln(null),dn(``)}catch{pn(!0)}}},hn=(0,X.useCallback)((e,t)=>{p||rn({ref:e,x:Math.min(window.innerWidth-180,t.x),y:Math.min(window.innerHeight-140,t.y)})},[p]);(0,X.useEffect)(()=>{if(!nn)return;let e=e=>{e.target.closest(`.map-context-menu`)||rn(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),rn(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[nn]);let[gn,_n]=(0,X.useState)(``),vn=(0,X.useCallback)(e=>`${e.task.title} ${e.task.objective??``} ${ut?.cards[e.task.id]?.title||``} ${ut?.cards[e.task.id]?.summary||``} ${Mt[e.task.id]?.title||``} ${Mt[e.task.id]?.summary||``} ${e.part>1?t?`续篇 ${e.part-1}`:`Continued ${e.part-1}`:``}`.toLowerCase(),[ut,Mt,t]),yn=(0,X.useMemo)(()=>gn?Z.cards.filter(e=>vn(e).includes(gn.toLowerCase())):[],[gn,Z.cards,vn]),bn=yn.findIndex(e=>e.id===q.focusId),[xn,Sn]=(0,X.useState)(K.tasks.length),[Cn,wn]=(0,X.useState)(!1),[Tn,En]=(0,X.useState)(!1),Dn=O?.shown??Tn,On=O?.toggle??(()=>En(e=>!e)),[kn,An]=(0,X.useState)(``),jn=(0,X.useCallback)(e=>{if(it(e),_n(``),An(``),e){let{upstream:t,downstream:n}=Ke(K,e);q.fit(new Set([e,...t.map(e=>e.id),...n.map(e=>e.id)]))}else q.fit()},[q.fit,K]),Mn=(0,X.useCallback)((e,t=!1)=>{let n=Ft.current?.allCards.find(t=>t.id===e);if(n&&!Ee.has(n.task.id)&&(t||e!==n.task.id)){Oe(e=>new Set([...e,n.task.id])),Ae(e);return}at&&n?jn(n.task.id===at.id?null:n.task.id):q.enter(e)},[q.enter,at,jn,Ee]),Nn=(0,X.useCallback)(e=>{let t=Ee.has(e);if(Oe(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),Ne?.data.task.id===e){let n=Ft.current?.allCards.filter(t=>t.task.id===e).at(-1);Ae(t?e:n?.id??e)}},[Ee,Ne?.data.task.id]);(0,X.useEffect)(()=>{!ke||!oe.some(e=>e.id===ke)||(q.enter(ke),Ae(null))},[ke,oe,q.enter]);let Pn=(0,X.useCallback)(()=>{it(null),An(``),q.fit()},[q.fit]);(0,X.useEffect)(()=>{se(n=>a(n,Z.cards.map(n=>({id:n.id,type:`task`,position:Vt[n.id]??Z.positions[n.id],width:Z.frames[n.id].width,height:Z.frames[n.id].height,style:{width:Z.frames[n.id].width,height:Z.frames[n.id].height},data:{...n,zh:t,open:Mn,toggleHistory:Nn,readStep:q.readStep,readCopy:Be,menu:hn,quote:tn,source:e.id,readOnly:p,live:e.kind===`live`,paused:g,seenCards:Me,restoring:!!Ce.current?.camera&&!be.current,layout:Z.layouts[n.id],frame:Z.frames[n.id],plannedWidth:Zt.get(n.task.id),focused:!1,detailed:!1}}))))},[K,Z,Bt,Vt,t,se,Mn,Nn,q.readStep,Be,hn,tn,e.id,e.kind,p,g,Me,Zt]),(0,X.useEffect)(()=>{Sn(e=>Math.min(Math.max(e,1),K.tasks.length))},[K.tasks.length]),(0,X.useEffect)(()=>{if(!Cn||q.detailed)return;let e=window.setInterval(()=>Sn(e=>e>=K.tasks.length?(wn(!1),e):e+1),900);return()=>window.clearInterval(e)},[Cn,K.tasks.length,q.detailed]),(0,X.useEffect)(()=>{if(!qt||Cn||xnJt(!1),1400);return()=>window.clearTimeout(e)},[qt,Cn,xn,K.tasks.length]);let Fn=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(t=>e.kind===`live`&&!qt||t.ordinal<=xn).map(e=>e.id));for(let[e,n]of Bt.branchAnchor)t.has(n)&&t.add(e);return t},[Z.cards,xn,e.kind,qt,Bt.branchAnchor]),In=(0,X.useRef)([]),Ln=(0,X.useMemo)(()=>{let e=oe.map(e=>({...e,hidden:!Fn.has(e.id),data:{...e.data,copy:ut?{version:ut.version,cards:Object.fromEntries([e.data.task.id,...e.data.layout.steps.map(e=>e.id)].filter(e=>ut.cards[e]).map(e=>[e,ut.cards[e]]))}:void 0,words:Mt[e.data.task.id],readerCopy:Ie?.nodeId===e.id?kt:void 0,focused:e.id===q.focusId,detailed:q.detailed&&e.id===q.focusId,canvasSize:q.canvasSize,lit:Wt.nodes.has(e.id),hovered:e.id===Ht,arriving:Gt,revealing:qt,phase:r&&ge.has(e.data.task.status)?r:void 0,waiting:s&&s.taskId===e.data.task.id?s.sentence:void 0,growthDelay:Xt.cards[e.id],dispatchState:G?.result?.type===`task`&&G.result.taskId===e.data.task.id&&!n.historical?G.landed?`landed`:`receiving`:void 0,growingSteps:Object.fromEntries(e.data.layout.steps.flatMap(t=>{let n=Xt.steps[yt(e.id,t.id)];return n==null?[]:[[t.id,n]]})),growingLinks:Object.fromEntries(e.data.layout.links.flatMap(t=>{let n=Xt.links[yt(e.id,t.id)];return n==null?[]:[[t.id,n]]}))},style:{...e.style,opacity:lt&&!lt.has(e.data.task.id)||gn&&!vn(e.data).includes(gn.toLowerCase())?.22:1}}));return In.current=a(In.current,e),In.current},[oe,Fn,q.focusId,q.detailed,q.canvasSize,gn,vn,ut,Mt,Ie,kt,t,Xt,G,n.historical,lt,Wt,Ht,Gt,qt,r,s]),Rn=(0,X.useRef)([]),zn=(0,X.useMemo)(()=>{let e=new Map;for(let t of Bt.branches){if(t.group)continue;let n=t.parent_id??``;e.set(n,(e.get(n)??0)+1)}let n=new Map,r=Bt.branches.map(r=>{let i=r.parent_id??``,a=Bt.frames[r.id],o=r.group?void 0:(n.get(i)??0)+1;return o!==void 0&&n.set(i,o),{id:r.id,type:`branch`,position:Vt[r.id]??{x:0,y:0},width:a.width,height:a.height,style:{width:a.width,height:a.height,opacity:lt&&!lt.has(i)?.22:1},hidden:!Fn.has(r.id),draggable:!1,selectable:!1,focusable:!1,data:{task:r,zh:t,parentCardId:Bt.branchAnchor.get(r.id),open:Mn,toggleGroup:V,fanIndex:o,fanCount:o===void 0?void 0:e.get(i)}}});return Rn.current=a(Rn.current,r),Rn.current},[Bt,Vt,Fn,t,Mn,V,lt]),Bn=(0,X.useMemo)(()=>zn.length?[...Ln,...zn]:Ln,[Ln,zn]),Vn=(0,X.useMemo)(()=>{let n=Bt.links.filter(e=>Fn.has(e.source)&&Fn.has(e.target)&&(e.kind!==`replacement`||Dn)),r=W(n),i=new Map(Z.cards.map(e=>[e.id,e.task])),a=new Set;if(e.kind===`live`&&!g){for(let e of Z.cards)ge.has(e.task.status)&&a.add(e.id);for(let e of Bt.branches)ge.has(e.status)&&a.add(e.id)}return n.map((e,n)=>{let o=e.kind===`fanout`||e.kind===`fanin`,s=i.get(e.source)?.id,c=i.get(e.target)?.id,l=!!at&&e.kind===`dependency`&&(s===at.id||c===at.id),u=!!at&&!l&&(e.kind!==`continuation`||s!==at.id);return{id:e.id,source:e.source,target:e.target,...me({...Vt[e.source],...Bt.frames[e.source]},{...Vt[e.target],...Bt.frames[e.target]}),type:`relation`,data:{growthDelay:Xt.links[e.id]??(Gt?At(Yt.get(e.source)??1):qt&&Yt.get(e.target)===xn?120:void 0),active:a.has(e.target),lit:Wt.edges.has(e.id),lane:r[n],muted:u,quiet:!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)},className:`map-edge-${e.kind}${Wt.edges.has(e.id)?` is-lit`:``}`,label:o?void 0:e.label||(e.kind===`replacement`?(i.get(e.source)?.superseded_reason||``).replace(/\s+/g,` `).slice(0,60)||(t?`转入新计划`:`New plan`):e.kind===`dependency`?t?`依赖`:`Dependency`:t?`同一研究`:`Related work`),labelStyle:{fontSize:30,fill:e.kind===`replacement`?`#95809f`:`#6685a4`},labelBgPadding:[12,6],labelBgBorderRadius:12,labelBgStyle:{fill:`var(--map-paper)`,fillOpacity:.96},style:{opacity:u?.12:1,stroke:e.cycle?`#dc6648`:e.kind===`replacement`?`#a48caf`:e.kind===`dependency`?`#527fa7`:`#7594ad`,strokeWidth:l?2.6:e.kind===`dependency`?2:o?1.1:1.6,vectorEffect:`non-scaling-stroke`,strokeDasharray:e.kind===`dependency`||e.kind===`context`||e.kind===`continuation`||o?void 0:`5 6`},markerEnd:{type:Ts.ArrowClosed,color:e.kind===`replacement`?`#a48caf`:`#8aa5b8`,width:32,height:32},ariaLabel:e.evidence||(o?`Team branch: ${e.source} → ${e.target}`:e.kind===`dependency`?`Dependency: ${e.source} → ${e.target}`:`Plan replacement: ${e.source} → ${e.target_plan_id} (${e.target_count} tasks, representative ${e.target})`)}})},[Bt,Fn,Dn,t,Xt,e.kind,g,Z.cards,at,Vt,Wt,Gt,qt,xn,Yt]),Hn=K.links.filter(e=>e.kind===`replacement`).length,Un=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(e=>e.completionScope).map(e=>e.task.id)),n={done:0,ended:0,running:0,question:0,review_unavailable:0,held:0,failed:0,other:0};for(let r of e.tasks)t.has(r.id)?n.ended++:r.status===`done`?n.done++:ge.has(r.status)?n.running++:r.pending_question?n.question++:Ve(r)===`review_unavailable`?n.review_unavailable++:Ve(r)===`held`?n.held++:r.status===`failed`?n.failed++:n.other++;return n},[e.tasks,Z.cards]),Wn=Un.done,Gn=(0,X.useCallback)(e=>ut?.cards?.[`${e.id}:outcome`]?.summary||``,[ut]),Kn=(0,X.useMemo)(()=>e.tasks.some(e=>e.turn_kind!==`qa`&&e.kind!==`turn`)?ee(e.tasks,e.events,t,Gn):null,[e.tasks,e.events,t,Gn]),qn=He(c,c.mission_view,u),Jn=we(qn,c.mission_view,u,t?`zh-CN`:`en`,y.connected,De(c,c.mission_view,qn.taskId)),Yn=e=>{it(null),An(``),Sn(t=>Math.max(t,Z.cards.find(t=>t.id===e)?.ordinal||1)),q.enter(e)},Xn=()=>{let e=Z.cards.filter(e=>e.task.id===Pe?.id).at(-1);e&&(Le(null),Yn(e.id))},Zn=()=>{let n=qe(e.tasks);n?(Yn(Z.cards.filter(e=>e.task.id===n.id).at(-1).id),An(``)):An(t?`发送一个目标,地图就会开始生长`:`Send a goal to start your map`)},Qn=()=>{let e=Ze[(tt+1)%Ze.length];e&&Yn(Z.cards.filter(t=>t.task.id===e.id).at(-1).id)};(0,X.useEffect)(()=>{let e=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.isComposing)&&!e.target?.closest(`input, textarea, select, [contenteditable], [role="dialog"]`)){if(e.key===`/`)e.preventDefault(),fe.current?.querySelector(`.map-search input`)?.focus();else if(e.key===`f`||e.key===`F`)Pn();else if((e.key===`ArrowRight`||e.key===`ArrowLeft`)&&q.detailed&&q.focusId){let t=Z.cards.filter(e=>Fn.has(e.id)),n=t.findIndex(e=>e.id===q.focusId);if(n<0)return;let r=t[n+(e.key===`ArrowRight`?1:-1)];r&&(e.preventDefault(),q.enter(r.id))}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pn,q.enter,q.detailed,q.focusId,Z.cards,Fn]);let $n=(0,X.useMemo)(()=>({artifacts:y.artifacts,onOpenArtifact:y.onOpenArtifact}),[y.artifacts,y.onOpenArtifact]),er=(0,Y.jsxs)(`div`,{className:`map-playback`,"data-floating":e.kind===`live`,children:[(0,Y.jsx)(`button`,{"aria-label":Cn?`Pause reveal`:`Play reveal`,onClick:()=>{xn>=K.tasks.length&&Sn(1),wn(e=>!e)},children:Cn?(0,Y.jsx)(et,{size:14}):(0,Y.jsx)(D,{size:14})}),(0,Y.jsx)(`button`,{"aria-label":`Restart reveal`,onClick:()=>{wn(!1),Sn(1),e.kind!==`live`&&q.back()},children:(0,Y.jsx)(ct,{size:13})}),(0,Y.jsx)(`span`,{children:t?`逐卡展开`:`Reveal cards`}),(0,Y.jsx)(`input`,{"aria-label":`Visible task count`,type:`range`,min:Math.min(1,K.tasks.length),max:K.tasks.length,value:xn,onChange:e=>{wn(!1),Sn(Number(e.target.value))}}),(0,Y.jsxs)(`span`,{className:`map-count`,children:[xn,` / `,K.tasks.length]}),(0,Y.jsx)(`button`,{"aria-label":`Reveal next card`,disabled:xn>=K.tasks.length,onClick:()=>Sn(e=>Math.min(K.tasks.length,e+1)),children:(0,Y.jsx)(ie,{size:14})}),(0,Y.jsx)(`small`,{children:t?`时间顺序`:`Chronological order`}),e.kind===`live`&&(0,Y.jsx)(`button`,{className:`map-replay-exit`,"aria-label":t?`回到当前`:`Back to the present`,title:t?`回到当前`:`Back to the present`,onClick:()=>{wn(!1),Jt(!1),Sn(K.tasks.length)},children:(0,Y.jsx)(v,{size:14})})]});return(0,Y.jsx)(Tm.Provider,{value:q.zoomSteps,children:(0,Y.jsx)(fm.Provider,{value:sn,children:(0,Y.jsxs)(pm.Provider,{value:$n,children:[ut?.generation_error&&(0,Y.jsxs)(`div`,{role:`status`,className:`map-paused-label`,children:[t?`地图说明暂时不可用,任务和已有说明仍可阅读。`:`Map explanation unavailable; tasks and saved explanations remain readable.`,ut.generation_error.code===`cost_unreconciled`&&(t?` 调用费用待对账,并非预算耗尽。`:` Provider usage awaits reconciliation, not budget exhaustion.`)]}),e.kind===`live`&&!qt&&Kn&&(0,Y.jsxs)(`dl`,{className:`map-brief`,"aria-label":t?`任务进展`:`Task progress`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`正在做`:`Now`}),(0,Y.jsx)(`dd`,{title:Kn.goal,children:qn.state===`running`||qn.state===`waiting`||qn.reason===`operator_input`?Jn:Kn.current})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`已有结果`:`Results`}),(0,Y.jsx)(`dd`,{children:Kn.conclusion})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`接下来`:`Next`}),(0,Y.jsx)(`dd`,{children:Kn.next})]})]}),(0,Y.jsxs)(`div`,{className:`map-status-row`,children:[e.tasks.length>0&&(0,Y.jsx)(`span`,{className:`map-progress`,"aria-hidden":`true`,children:[`done`,`ended`,`running`,`question`,`review_unavailable`,`held`,`failed`,`other`].map(e=>Un[e]>0?(0,Y.jsx)(`i`,{"data-bucket":e,style:{flexGrow:Un[e]}},e):null)}),(0,Y.jsxs)(`p`,{className:`map-status-line`,role:`status`,children:[n.pending||!g&&(r||s)?(0,Y.jsx)(`i`,{className:`map-live-dot`,"aria-hidden":!0}):null,(0,Y.jsx)(`span`,{className:`map-status-text`,children:Ue({total:e.tasks.length,qa:e.tasks.filter(e=>e.turn_kind===`qa`).length,complete:Wn,ended:Un.ended,reviewUnavailable:Un.review_unavailable,held:Un.held,running:Un.running,pending:n.pending,paused:g,hasOpenWork:e.tasks.some(e=>[`running`,`pending`,`paused`,`held`,`question`].includes(Ve(e))),role:r,current:e.kind===`live`&&![`idle`,`step_finished`].includes(qn.state)?Jn:void 0,waiting:s?.sentence,zh:t})}),Ze.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`map-status-sep`,"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`button`,{type:`button`,className:`map-attention-link`,onClick:Qn,title:t?`跳到需要你处理的任务`:`Jump to the task waiting on you`,"aria-label":t?`逐个查看 ${Ze.length} 项需要你处理的任务`:`Cycle through ${Ze.length} tasks needing attention`,children:t?`${Ze.length} 项需要你处理`:`${Ze.length} ${Ze.length===1?`needs`:`need`} your attention`})]})]})]}),e.kind===`live`&&Pe&&!qt&&(0,Y.jsxs)(`div`,{className:`map-final-review`,role:`status`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:t?`最终结果已检查通过`:`Final delivery passed review`}),Ne?.data.task.id!==Pe.id&&Ne?.data.task.outcome?.review_status===`unavailable`&&(Pe.finished_ts??0)>(Ne.data.task.finished_ts??0)?(0,Y.jsx)(`span`,{children:t?` · 本项目后续已交付;此卡保留当次审查异常。`:` · This project was delivered later; this card retains its earlier review error.`}):null]}),(0,Y.jsx)(`button`,{type:`button`,onClick:Xn,children:t?`查看结果检查`:`View final review`}),y.deliveryCount>0&&(0,Y.jsx)(`button`,{type:`button`,onClick:y.onOpenDelivery,children:t?`查看项目成果`:`View project deliverables`})]}),e.kind===`live`&&!p&&(0,Y.jsx)(_e,{questions:c.pending_questions??[],backlog:c.backlog,currentTaskId:l??c.mission_view?.mission.id,onAnswer:y.onAnswer,onLocate:e=>{let t=Z.cards.filter(t=>t.task.id===e).at(-1);t&&Yn(t.id)}}),q.detailed&&tt>=0&&(0,Y.jsxs)(`div`,{className:`map-attention-detail`,role:`status`,children:[(0,Y.jsxs)(`strong`,{children:[t?`待处理`:`Needs attention`,` `,tt+1,` / `,Ze.length]}),(()=>{let n=ne(Ze[tt],e.events,t,Gn(Ze[tt]));return(0,Y.jsxs)(`div`,{tabIndex:0,children:[(0,Y.jsx)(`p`,{children:n.reason}),(0,Y.jsx)(`p`,{children:n.next}),n.detail&&(n.showDetail?(0,Y.jsxs)(`blockquote`,{className:`map-attention-quote`,children:[(0,Y.jsx)(`strong`,{children:t?`暂停原因原文`:`Recorded reason`}),` `,n.detail]}):(0,Y.jsxs)(`details`,{children:[(0,Y.jsx)(`summary`,{children:t?`原始记录`:`Recorded words`}),(0,Y.jsx)(`p`,{children:n.detail})]}))]})})()]}),at&&ot&&(0,Y.jsxs)(`nav`,{className:`map-dependencies`,"aria-label":t?`任务来路与去向`:`Task dependencies`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`来路`:`Depends on`}),ot.upstream.length?ot.upstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的前置依赖`:`No recorded prerequisites`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`当前`:`Selected`}),(0,Y.jsxs)(`button`,{className:`map-trace-task`,title:at.title,onClick:()=>Yn(Z.cards.find(e=>e.task.id===at.id).id),children:[at.title,` · `,t?`查看任务`:`Open task`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`去向`:`Enables`}),ot.downstream.length?ot.downstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的后续依赖`:`No recorded dependents`})]})]}),(0,Y.jsx)(`div`,{className:`map-workspace`,children:(0,Y.jsxs)(`div`,{ref:fe,className:`map-canvas-wrap`,"data-focused":!!q.focusId,"data-detailed":q.detailed,"data-fitted":xe,"data-hovering":!!Ht&&!q.detailed,children:[(0,Y.jsxs)(`div`,{className:`map-ambient`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),j&&(0,Y.jsx)(dt,{events:y.conversationEvents,connected:y.connected,pending:n.pending,artifacts:y.artifacts,zh:t,onClose:()=>N(!1),onOpenArtifact:y.onOpenArtifact,onOpenDelivery:y.onOpenReceipt}),k&&e.kind===`live`&&(0,Y.jsx)(`aside`,{className:`map-agent-drawer nowheel nodrag nopan`,children:(0,Y.jsx)(Re,{sid:c.session.id,view:c.mission_view,roles:c.roles,events:u,taskId:Ne?.data.task.id||c.mission_view?.mission.id||void 0,paused:g&&!n.pending,onClose:()=>A(!1)})}),G&&!p&&(0,Y.jsx)(_t,{flight:G,canvas:fe,zh:t,historical:n.historical,onReveal:t=>{e.tasks.some(e=>e.id===t)&&q.fit()},onLand:e=>te(t=>t?.id===e?{...t,landed:!0}:t),onFinish:e=>te(t=>t?.id===e?null:t)}),(0,Y.jsxs)(`div`,{className:`map-canvas-toolbar nowheel`,children:[(0,Y.jsxs)(`label`,{className:`map-search`,children:[(0,Y.jsx)(b,{size:14}),(0,Y.jsx)(`input`,{"aria-label":t?`搜索地图任务`:`Search map tasks`,placeholder:t?`搜索任务…`:`Find a task…`,title:t?`Enter 逐个跳转匹配`:`Enter jumps through matches`,value:gn,onChange:e=>_n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&yn.length?Yn(yn[(bn+1)%yn.length].id):e.key===`Escape`&&gn&&(e.stopPropagation(),_n(``))}}),gn&&(0,Y.jsx)(`span`,{className:`map-search-count`,"aria-live":`polite`,children:yn.length?bn>=0?`${bn+1}/${yn.length}`:`${yn.length} ${t?`项`:`found`}`:t?`无匹配`:`0 found`})]}),(0,Y.jsxs)(`button`,{onClick:Zn,title:t?`定位当前或最近任务`:`Locate current or latest task`,"aria-label":t?`定位当前`:`Locate current`,children:[(0,Y.jsx)(st,{size:15}),(0,Y.jsx)(`span`,{children:t?`定位当前`:`Locate current`})]}),(0,Y.jsx)(`button`,{className:`map-fit-button`,onClick:Pn,title:t?`适配全图`:`Fit map`,"aria-label":`Fit map`,children:(0,Y.jsx)(Qe,{size:15})}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":t?`来路 / 去向`:`Trace dependencies`,title:t?`突出显示任务的直接前后依赖;点击卡片切换,再次点击退出`:`Highlight direct dependencies; click a card to switch, click it again to exit`,"aria-pressed":!!at,disabled:!K.tasks.length,onClick:()=>jn(at?null:Ne?.data.task.id??qe(e.tasks)?.id??null),children:[(0,Y.jsx)(E,{size:15}),(0,Y.jsx)(`span`,{children:t?`来路 / 去向`:`Dependencies`})]}),e.kind===`live`&&K.tasks.length>1&&!q.detailed&&!qt&&(0,Y.jsxs)(`button`,{onClick:()=>{Jt(!0),Sn(1),wn(!0)},title:t?`回放这项研究是如何展开的`:`Replay how this research unfolded`,"aria-label":`Replay`,children:[(0,Y.jsx)(T,{size:15}),(0,Y.jsx)(`span`,{children:t?`回放`:`Replay`})]}),q.detailed&&(0,Y.jsxs)(`button`,{onClick:q.back,className:`map-back-button`,"aria-label":`Return to map`,children:[(0,Y.jsx)(w,{size:14}),(0,Y.jsx)(`span`,{children:t?`返回全图`:`Overview`})]}),q.detailed&&Ne&&Ne.data.partCount>1&&(0,Y.jsxs)(`nav`,{className:`map-part-switcher`,"aria-label":t?`切换任务部分`:`Switch task part`,children:[(0,Y.jsx)(`button`,{"aria-label":t?`上一部分`:`Previous part`,disabled:!Ne.data.previousId,onClick:()=>Ne.data.previousId&&Mn(Ne.data.previousId,!0),children:(0,Y.jsx)(rt,{size:15})}),(0,Y.jsxs)(`span`,{children:[Ne.data.part,` / `,Ne.data.partCount]}),(0,Y.jsx)(`button`,{"aria-label":t?`下一部分`:`Next part`,disabled:!Ne.data.nextId,onClick:()=>Ne.data.nextId&&Mn(Ne.data.nextId,!0),children:(0,Y.jsx)(ie,{size:15})})]}),(0,Y.jsx)(`span`,{className:`map-toolbar-gap`,"aria-hidden":!0}),e.kind===`live`&&(0,Y.jsxs)(`div`,{className:`map-workspace-actions`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":j,"aria-label":t?`对话`:`Conversation`,title:t?`与 Argus 的对话`:`Your conversation with Argus`,onClick:()=>{N(e=>!e),A(!1)},children:[(0,Y.jsx)(L,{size:15}),(0,Y.jsx)(`span`,{children:t?`对话`:`Conversation`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-agent-toggle`,"aria-expanded":k,"aria-label":t?`Agent 动态`:`Agent activity`,title:t?`各个 Agent 正在做什么`:`What each agent is doing`,onClick:()=>{A(e=>!e),N(!1)},children:[(0,Y.jsx)(_,{size:15}),(0,Y.jsx)(`i`,{"data-active":!!r||n.pending,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:t?`工作详情`:`Work details`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-delivery-toggle`,disabled:!y.deliveryCount,"aria-label":t?`交付成果`:`Deliveries`,title:t?`已交付的成果`:`What has been delivered`,onClick:y.onOpenDelivery,children:[(0,Y.jsx)(de,{size:15}),(0,Y.jsx)(`span`,{children:t?`交付成果`:`Deliveries`}),y.deliveryCount>0&&(0,Y.jsx)(`b`,{children:y.deliveryCount})]})]})]}),kn&&(0,Y.jsx)(`div`,{className:`map-feedback`,role:`status`,children:kn}),K.tasks.length===0?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(E,{size:36}),(0,Y.jsx)(`h3`,{children:t?`把一个目标,变成可见的成果`:`Turn a goal into a visible result`}),(0,Y.jsx)(`p`,{children:p?t?`尚无任务记录。`:`No task records are available.`:t?`描述你想完成的事情,看 Argus 规划、执行、审查,最后在这里交付。`:`Describe your goal. Watch Argus plan, build, review, and deliver here.`}),!p&&(0,Y.jsx)(`div`,{className:`map-starters`,children:(t?[[`交互实验`,`做一个交互式实验室,用动画展示 Dijkstra 和 A* 怎样寻找最短路径。让我能画障碍、单步播放、比较探索范围,并验证两个算法的结果一致。`],[`数据洞察`,`用一组可复现的模拟数据,做一个辛普森悖论交互演示。让我能切换整体和分组视角,看结论怎样反转,附上验证过程。`],[`产品原型`,`做一个精致的个人旅行规划网页。我能调整预算和出行天数,比较三种行程方案,并将选中的方案导出。让手机上也方便操作。`]]:[[`Interactive lab`,`Build an interactive Dijkstra vs A* pathfinding lab with editable obstacles, step-by-step animation, and correctness checks.`],[`Data insights`,`Create an interactive Simpson’s paradox demo using reproducible synthetic data, with aggregate and grouped views and validation.`],[`Product prototype`,`Build a polished travel planner. Let me adjust budget and duration, compare three itineraries, and export my choice. Make it easy to use on a phone.`]]).map(([e,t])=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{n.onChange(t),requestAnimationFrame(()=>fe.current?.querySelector(`textarea`)?.focus())},children:[e,` ↗`]},e))})]}):(0,Y.jsxs)(Cp,{nodes:Bn,edges:Vn,nodeTypes:Eh,edgeTypes:Dh,onNodesChange:ue,onNodeMouseEnter:(e,t)=>Ut(t.id),onNodeMouseLeave:()=>Ut(null),onMove:q.onMove,defaultViewport:Fm,minZoom:.01,maxZoom:3.5,nodesDraggable:!1,nodesFocusable:!1,nodesConnectable:!1,edgesReconnectable:!1,zoomOnScroll:!1,zoomOnPinch:!0,zoomOnDoubleClick:!1,deleteKeyCode:null,selectionKeyCode:null,onlyRenderVisibleElements:xe&&pe,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Fp,{variant:jp.Dots,gap:88,size:3,color:`var(--map-dot)`}),(0,Y.jsx)(Wp,{orientation:`horizontal`,showInteractive:!1,onFitView:Pn,fitViewOptions:{padding:.16,maxZoom:.27,minZoom:.01,duration:q.reducedMotion?0:320}}),(0,Y.jsx)(am,{nodeColor:e=>e.type===`branch`?`#cfd2d5`:Oh[Ve(e.data.task)]??`#c6c8cb`,maskColor:`var(--map-minimap-mask)`,maskStrokeColor:`#6d737a`,maskStrokeWidth:1.5,onClick:(e,t)=>q.navigate(t),pannable:!0,zoomable:!0,ariaLabel:t?`地图导航预览`:`Map navigation preview`})]}),e.kind===`live`&&qt&&er,(0,Y.jsxs)(`div`,{className:`map-legend nowheel`,children:[(0,Y.jsxs)(`span`,{title:t?`内容相关的工作,不是执行依赖`:`Related in content, not an execution dependency`,children:[(0,Y.jsx)(`b`,{className:`dashed`}),t?`内容关联`:`Related work`]}),(0,Y.jsxs)(`span`,{title:t?`工作发生的先后`:`The order work happened in`,children:[(0,Y.jsx)(`b`,{className:`order`}),t?`先后`:`Order`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{}),t?`任务依赖`:`Dependency`]}),(0,Y.jsxs)(`button`,{className:Dn?``:`is-muted`,onClick:On,"aria-pressed":Dn,disabled:Hn===0,"aria-label":`Toggle plan replacements`,children:[(0,Y.jsx)(`b`,{className:`replacement`}),t?`计划替代`:`Plan changes`,Hn?` · ${Hn}`:``]})]}),!p&&(0,Y.jsx)(oh,{...n,pendingLabel:f,progressVisible:!j,dispatchStatus:G?.result?.type===`task`?G.landed||n.historical?`task`:`launching`:G?.result?.outcome,onSend:Qt,onCancel:$t,overview:!q.detailed}),nn&&!p&&(0,Y.jsxs)(`div`,{className:`map-context-menu`,role:`menu`,style:{left:nn.x,top:nn.y},children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{tn(nn.ref),rn(null)},children:t?`引用`:`Reference`}),e.kind===`live`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{dn(``),ln({ref:nn.ref,x:nn.x,y:nn.y}),rn(null)},children:t?`添加批注`:`Add a note`}),(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{n.onRouteOverrideChange?.(`task`),tn(nn.ref),rn(null)},children:t?`从这里展开`:`Branch from here`})]})]}),cn&&!p&&(0,Y.jsxs)(`div`,{className:`map-note-editor nodrag nopan`,style:{left:Math.min(window.innerWidth-320,cn.x),top:Math.min(window.innerHeight-240,cn.y)},children:[(0,Y.jsx)(`small`,{children:t?`批注《${cn.ref.task_title}》`:`Note on “${cn.ref.task_title}”`}),(0,Y.jsx)(`textarea`,{autoFocus:!0,maxLength:2e3,value:un,onChange:e=>dn(e.target.value),placeholder:t?`写下你的观察,Argus 在下个规划周期会读到`:`Your observation; Argus reads it next planning cycle`}),fn&&(0,Y.jsx)(`small`,{className:`map-note-error`,children:t?`没有保存上,稍后再试;草稿还在`:`Not saved; try again — the draft is kept`}),(0,Y.jsxs)(`div`,{className:`map-note-actions`,children:[(0,Y.jsx)(`button`,{onClick:()=>ln(null),children:t?`取消`:`Cancel`}),(0,Y.jsx)(`button`,{className:`is-primary`,disabled:!un.trim(),onClick:()=>void mn(),children:t?`保存`:`Save`})]})]}),(K.cyclic||K.missing>0)&&(0,Y.jsx)(`div`,{className:`map-graph-warning`,children:K.cyclic?t?`检测到循环引用,保留原始连线。`:`Cyclic references retained.`:`${K.missing} ${t?`个依赖不在当前记录范围内`:`dependencies outside the available history`}`})]})}),e.kind!==`live`&&er,(0,Y.jsx)(S,{open:!!J,onClose:()=>Le(null),label:J?.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,children:J&&(mt||J.turn_kind===`qa`)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{title:J.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,sub:J.turn_kind===`qa`?J.objective||J.title:ut?.cards[J.id]?.title||J.title}),(0,Y.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`map-task-reading`,"data-task-id":J.id,children:[J.outcome?.review_status===`unavailable`&&(0,Y.jsxs)(`p`,{className:`mb-3 text-sm text-ink-dim`,role:`status`,children:[t?`当次审查异常,未形成审阅结论。`:`No review judgment was returned on this attempt.`,Pe&&(Pe.finished_ts??0)>(J.finished_ts??0)&&(0,Y.jsx)(`button`,{type:`button`,className:`ml-2 text-blue underline`,onClick:Xn,children:t?`查看本项目后续通过的最终审稿`:`View this project's later accepted final review`})]}),Je?.data.completionScope?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:Je.data.completionScope}):null,(0,Y.jsx)(ye,{cardKey:J.id,taskId:J.id,card:ut?.cards[J.id],task:J,readOnly:p,originalDetail:J.turn_kind===`qa`?Ge?.text||(J.status===`running`?t?`正在回答…`:`Answering…`:J.status===`cancelled`?t?`本次回答已中断。`:`This answer was interrupted.`:J.summary||(t?`尚无回答。`:`No answer recorded.`)):J.objective||J.summary||(t?`这项任务尚无详细记录。`:`No detailed task record is available.`),selection:kt,artifacts:$n.artifacts,onOpenArtifact:$n.onOpenArtifact}),p?null:(0,Y.jsx)(C,{className:`mt-3 text-xs`,onClick:()=>tn({source:e.id,task_id:J.id,task_title:ut?.cards[J.id]?.title||J.title,event_ids:Ge?[Ge.id]:ut?.cards[J.id]?.event_ids||mt?.event_ids||[],lang:t?`zh`:`en`}),children:J.turn_kind===`qa`?t?`引用这条问答`:`Reference this Q&A`:t?`引用此任务`:`Reference this task`})]})]}):null})]})})})}var jh=(0,X.memo)(function({snapshot:e,currentTaskId:t,events:n,managerSteps:r=[],draft:a,onDraftChange:s,onSend:c,attachments:l,onAttachmentsChange:u,pending:f,onCancel:m,focusSignal:h,readOnly:g=!1,onOpenSettings:_,routeOverride:v,onRouteOverrideChange:y,conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}){let{locale:O}=p(),j=O===`zh-CN`,[N,F]=(0,X.useState)([]),I=l??N,L=(0,X.useRef)(I);L.current=I;let B=(0,X.useCallback)(e=>{let t=typeof e==`function`?e(L.current):e;L.current=t,u?u(t):F(t)},[u]),ee=(0,X.useRef)(a);ee.current=a;let V=(0,X.useRef)(!0);(0,X.useEffect)(()=>(V.current=!0,()=>{V.current=!1}),[]);let H=(0,X.useCallback)(async(e,t=[],n,r)=>{let i=!1,a=await c(e,t,r=>{r.type===`settled`&&r.outcome===`error`&&(i=!0),V.current&&(r.type===`settled`&&r.outcome===`error`&&!ee.current.trim()&&(s(e),B(e=>e.length?e:t)),n?.(r))},r);return a&&!i&&V.current&&(ee.current===e&&s(``),B(e=>e.filter(e=>!t.includes(e)))),a},[c,s,B]),[U,W]=(0,X.useState)(()=>new URLSearchParams(window.location.search).get(`dataset`)||A(`argus.map.source.v1`)||`live`),G=i({queryKey:[`map-datasets`],queryFn:({signal:e})=>d.mapDatasets(e),staleTime:1/0}),te=i({queryKey:[`map-dataset`,U],queryFn:({signal:e})=>d.mapDataset(U,e),enabled:U!==`live`,staleTime:1/0,retry:!1}),ne=o(),re=`argus.map.history.v1:`+e.session.id,[ie,K]=(0,X.useState)(()=>ae(A(re))),[oe,se]=(0,X.useState)(!1),ce=i({queryKey:[`map-info`,e.session.id],queryFn:({signal:t})=>d.mapInfo(e.session.id,t),enabled:U===`live`,staleTime:6e4}),le=ie??(ce.data&&!ce.data.requires_choice?{mode:`full`}:null);(0,X.useEffect)(()=>{if(!ie&&ce.data&&!ce.data.requires_choice){let e={mode:`full`};K(e),k(re,JSON.stringify(e))}},[ce.data,ie,re]);let ue=U!==`live`||!!le&&le.mode!==`off`&&!oe,de=[`map-live`,e.session.id,le?.mode,le?.since,le?.eventSince,le?.taskId],q=JSON.stringify([U,e.session.id,O,le]),pe=e=>{K(e),k(re,JSON.stringify(e)),se(!1)},me=i({queryKey:de,queryFn:async({signal:t})=>{let n=ne.getQueryData(de),r=le?.mode===`full`?await d.mapHistory(e.session.id,t,n?.history_cursor,n?.cursor):await d.liveMap(e.session.id,t,n?.cursor,le||void 0);return R(ne.getQueryData(de),r)},enabled:U===`live`&&ue,staleTime:1/0,gcTime:72e5,refetchOnMount:`always`,refetchInterval:t=>fe(ue,t.state.data,e)}),he=U===`live`&&z(e),ge=He(e,e.mission_view,n),_e=ge.reason===`background_work`&&ge.taskId?ke(ge,j?`zh-CN`:`en`):``,ve=(0,X.useMemo)(()=>U===`live`&&!he&&_e?{taskId:ge.taskId,sentence:_e}:void 0,[U,he,ge.taskId,_e]),ye=n.filter(e=>e.run_label!==`map-summary`&&/^(life\.(mission\.|phase\.|planner\.task_added)|manager\.turn\.|round\.|agent\.message|engineer\.progress|ui\.argus|team\.|idea\.portfolio\.)/.test(String(e.type))).at(-1),be=JSON.stringify([ye?.ts,ye?.event_id||ye?.id,ye?.revision,ye?.updated_ts,ye?.status,e.backlog,he]),xe=(0,X.useRef)(null),Se=(0,X.useRef)(0),Ce=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=Ce.current;if(!e)return;let t=()=>{Se.current=Date.now()+900},n=e=>{e.buttons&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`pointerdown`,t),e.addEventListener(`pointermove`,n),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`pointerdown`,t),e.removeEventListener(`pointermove`,n)}},[]),(0,X.useEffect)(()=>{if(U!==`live`||!ue||xe.current)return;let t=()=>{let n=Se.current-Date.now();if(n>0){xe.current=setTimeout(t,n+120);return}xe.current=null,ne.invalidateQueries({queryKey:[`map-live`,e.session.id]})};xe.current=setTimeout(t,650)},[be,U,e.session.id,ne,ue]),(0,X.useEffect)(()=>()=>{xe.current&&clearTimeout(xe.current),xe.current=null},[U,e.session.id,ue]);let we=U===`live`?me.data:te.data,[Te,Ee]=(0,X.useState)(!1),De=(0,X.useMemo)(()=>({shown:Te,toggle:()=>Ee(e=>!e)}),[Te]),Oe=(0,X.useMemo)(()=>we?M(we.tasks).links.filter(e=>e.kind===`replacement`).length:0,[we]),Ae=(0,X.useMemo)(()=>({conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}),[b,x,S,C,w,T,E,D]),je=(0,X.useMemo)(()=>({footer:(0,Y.jsx)(Xe,{sid:e.session.id,roles:e.roles,running:e.daemon.alive||!!e.manager_requests?.length,lastCall:e.last_call,onOpenSettings:g?void 0:_}),routeOverride:v,onRouteOverrideChange:y,value:a,onChange:s,onSend:H,attachments:I,onAttachmentsChange:B,pending:f,onCancel:m,focusSignal:h,sessionName:e.session.display_name||e.session.id,historical:U!==`live`,zh:j}),[v,y,a,s,H,I,f,m,h,e.session.display_name,e.session.id,U,j,e.roles,e.daemon.alive,e.manager_requests,e.last_call,g,_]),Me=e=>{W(e),k(`argus.map.source.v1`,e);let t=new URL(window.location.href);t.searchParams.set(`dataset`,e),window.history.replaceState(null,``,t)};return(0,Y.jsxs)(`section`,{ref:Ce,className:`argus-map`,"aria-label":j?`进度地图`:`Progress map`,children:[(0,Y.jsxs)(`header`,{className:`map-header`,children:[(0,Y.jsxs)(`div`,{className:`map-heading`,children:[(0,Y.jsx)(`span`,{className:`map-kicker`,"aria-hidden":`true`,children:j?`ARGUS · 研究地图`:`ARGUS · RESEARCH MAP`}),(0,Y.jsx)(`h1`,{title:e.session.display_name,children:e.session.display_name})]}),(0,Y.jsxs)(`details`,{className:`map-more`,children:[(0,Y.jsx)(`summary`,{"aria-label":j?`地图选项`:`Map options`,title:j?`地图选项`:`Map options`,children:(0,Y.jsx)(ut,{size:16})}),(0,Y.jsxs)(`div`,{className:`map-more-menu`,children:[we&&(0,Y.jsx)(kh,{events:we.events,zh:j}),(0,Y.jsxs)(`div`,{className:`map-dataset-bar`,children:[(0,Y.jsx)(it,{size:15}),(0,Y.jsxs)(`select`,{"aria-label":j?`地图数据来源`:`Map data source`,value:U,onChange:e=>Me(e.target.value),children:[(0,Y.jsxs)(`option`,{value:`live`,children:[j?`当前会话`:`Current session`,` ·`,` `,e.session.display_name]}),!G.data?.datasets.some(e=>e.id===U)&&U!==`live`&&(0,Y.jsx)(`option`,{value:U,children:U}),G.data?.datasets.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.task_count]},e.id))]}),we?.captured_at&&(0,Y.jsxs)(`span`,{className:`map-capture`,children:[(0,Y.jsx)(P,{size:12}),new Date(we.captured_at).toLocaleDateString()]})]}),U===`live`&&ce.data&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button`,onClick:()=>se(!0),children:j?`加载范围`:`History range`}),!g&&_&&(0,Y.jsx)(`button`,{type:`button`,onClick:_,className:`map-scope-button`,children:j?`地图模型设置`:`Map model settings`}),Oe>0&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button map-narrow-only`,"aria-pressed":Te,onClick:De.toggle,children:Te?j?`隐藏计划替代连线 · ${Oe}`:`Hide plan changes · ${Oe}`:j?`显示计划替代连线 · ${Oe}`:`Show plan changes · ${Oe}`})]})]})]}),U===`live`&&ce.data&&(0,Y.jsx)(Sh,{open:oe||!le&&ce.data.requires_choice,info:ce.data,zh:j,readOnly:g,onChoose:pe}),U===`live`&&ce.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[j?`暂时无法检查历史记录。`:`Could not check session history.`,(0,Y.jsx)(`button`,{onClick:()=>void ce.refetch(),children:j?`重试`:`Retry`})]}),ue&&we?.history_loading&&(0,Y.jsxs)(`div`,{className:`map-history-progress`,role:`status`,children:[j?`正在分批加载历史记录`:`Loading history in pages`,we.history_progress&&` · ${(we.history_progress.loaded_bytes/1024/1024).toFixed(1)} / ${(we.history_progress.total_bytes/1024/1024).toFixed(1)} MB`,(0,Y.jsx)(`button`,{onClick:()=>se(!0),children:j?`更改范围`:`Change range`})]}),ue&&we&&(U===`live`?me.isError:te.isError)&&(0,Y.jsxs)(`div`,{className:`map-data-error`,role:`status`,children:[j?`暂时无法更新,已保留加载的地图。`:`Updates are unavailable. Your loaded map is preserved.`,(0,Y.jsx)(`button`,{onClick:()=>void(U===`live`?me.refetch():te.refetch()),children:j?`重试`:`Retry`})]}),G.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[j?`历史记录列表暂时无法读取,可切换当前会话或重试。`:`Historical maps are unavailable. Open the current session or retry.`,(0,Y.jsx)(`button`,{onClick:()=>void G.refetch(),children:j?`重试`:`Retry`})]}),ue?(U===`live`?me.isError:te.isError)&&!we?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:j?`地图暂时无法读取`:`Map unavailable`}),(0,Y.jsx)(`p`,{children:String(U===`live`?me.error:te.error)}),(0,Y.jsx)(`button`,{onClick:()=>void(U===`live`?me.refetch():te.refetch()),children:j?`重试`:`Retry`})]}):we?(0,Y.jsx)(yp,{children:(0,Y.jsx)(Ah,{data:we,actions:Ae,snapshot:e,currentTaskId:t,events:n,pendingLabel:r.at(-1)?.detail||r.at(-1)?.label,viewKey:q,paused:he,sessionId:e.session.id,zh:j,readOnly:g,replacements:De,activePhase:U===`live`&&!he&&!ve?e.roles.find(e=>e.active)?.role:void 0,waiting:ve,composer:je})},q):(0,Y.jsxs)(`div`,{className:`map-empty is-loading`,"aria-busy":`true`,children:[(0,Y.jsxs)(`div`,{className:`map-ghosts`,"aria-hidden":!0,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),j?`正在载入地图…`:`Loading map…`]}):(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:j?`地图尚未开启`:`Map is not enabled`}),(0,Y.jsx)(`p`,{children:ce.isPending?j?`正在检查历史记录规模…`:`Checking history size…`:j?`选择加载范围后查看研究进度。`:`Choose a history range to view research progress.`}),ce.data&&(0,Y.jsx)(`button`,{onClick:()=>se(!0),children:j?`选择加载范围`:`Choose history range`})]})]})});export{Ah as MapCanvas,jh as MapPanel,kh as MapTeamProgress}; \ No newline at end of file diff --git a/frontend/web/dist/assets/MapPanel-BJMQIQc6.js b/frontend/web/dist/assets/MapPanel-BJMQIQc6.js new file mode 100644 index 000000000..76ae57d0e --- /dev/null +++ b/frontend/web/dist/assets/MapPanel-BJMQIQc6.js @@ -0,0 +1,7 @@ +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{D as n,E as r}from"./icons-DRlFT_ri.js";import{a as i,b as a,c as o,i as s}from"./query-CUzIxVzm.js";import{A as c,G as l,J as u,P as d,W as f,k as p}from"./index-DbVni4qR.js";import{A as m,F as h,I as g,L as _,O as v,R as y,j as b,m as x,p as S,r as C}from"./AppearanceControls-C_eUyO2x.js";import{n as w,t as T}from"./history-MzF_RldS.js";import{n as E,t as D}from"./play-DwGoGarL.js";import{a as O}from"./format-8giTdXya.js";import{a as k,i as A,n as j}from"./useWorkbenchTheme-CV-C3OBr.js";import{$ as M,A as N,At as P,B as F,C as I,Ct as L,D as R,E as z,Et as B,F as ee,G as V,H,I as U,J as W,K as G,L as te,M as ne,N as re,Nt as ie,O as ae,Ot as K,P as oe,Pt as se,Q as ce,R as le,S as ue,St as de,T as fe,U as q,V as pe,X as me,Y as he,Z as ge,a as _e,at as ve,b as ye,bt as be,c as xe,ct as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,gt as Oe,ht as ke,i as Ae,it as je,j as Me,jt as Ne,k as Pe,kt as Fe,l as Ie,lt as Le,n as Re,nt as ze,o as Be,ot as Ve,p as J,pt as He,q as Ue,rt as We,s as Ge,st as Ke,tt as qe,u as Je,ut as Ye,vt as Xe,w as Ze,wt as Qe,x as $e,xt as et,yt as tt,z as nt}from"./App-BzMKY0Y_.js";var rt=y(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),it=y(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),at=y(`CornerDownLeft`,[[`polyline`,{points:`9 10 4 15 9 20`,key:`r3jprv`}],[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}]]),ot=y(`ListChecks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),st=y(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ct=y(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),lt=y(`Route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),ut=y(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),Y=r();function dt({events:e,connected:t,pending:n,artifacts:r,zh:i,onClose:a,onOpenArtifact:o,onOpenDelivery:s}){let l=e.filter(e=>e.type===`ui.operator`||e.type===`ui.argus`);return(0,Y.jsxs)(`aside`,{className:`map-conversation nowheel nodrag nopan`,"aria-label":i?`地图对话`:`Map conversation`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(L,{size:16}),(0,Y.jsx)(`strong`,{children:i?`与 ${c().name} 对话`:`Talk to ${c().name}`}),(0,Y.jsx)(`button`,{type:`button`,onClick:a,"aria-label":i?`关闭对话`:`Close conversation`,children:(0,Y.jsx)(v,{size:18})})]}),l.length?(0,Y.jsx)(J,{events:l,connected:t,showReasoning:!1,onToggleReasoning:()=>{},embedded:!0,showHeader:!1,artifacts:r,onOpenArtifact:o,onOpenDelivery:s}):(0,Y.jsx)(`p`,{className:`map-conversation-empty`,children:i?`在下方发送目标或问题,回复会保留在这里。`:`Send a goal or question below. Your conversation stays here.`}),n&&!l.some(e=>e.type===`ui.argus`&&e.live===!0)&&(0,Y.jsx)(`p`,{className:`map-conversation-pending`,role:`status`,children:i?`${c().name} 正在回复…`:`${c().name} is replying…`})]})}var X=e(n(),1),ft=u(),pt=(e,t,n)=>e+(t-e)*n,mt=e=>e*e*(3-2*e),ht=(e,t,n)=>Math.max(t,Math.min(n,e));function gt(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y),i=Math.min(140,Math.max(54,r*.22))*(t.x>=e.x?-1:1),a=Math.min(120,r*.3),o={x:ht(e.x+i,28,n-28),y:e.y-a},s={x:ht(t.x+i*.6,28,n-28),y:t.y+a};return n=>{let r=1-n;return{x:r**3*e.x+3*r**2*n*o.x+3*r*n**2*s.x+n**3*t.x,y:r**3*e.y+3*r**2*n*o.y+3*r*n**2*s.y+n**3*t.y}}}function _t({flight:e,canvas:t,zh:n,historical:r=!1,onReveal:i,onLand:a,onFinish:o}){let s=(0,X.useRef)(null),c=(0,X.useRef)(null),l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=`dispatch-wake-${(0,X.useId)().replace(/:/g,``)}`,f=(0,X.useRef)({onReveal:i,onLand:a,onFinish:o});f.current={onReveal:i,onLand:a,onFinish:o};let p=e.result?.type===`task`&&!r;return(0,X.useEffect)(()=>{if(!e.result)return;let n=0,i,a,o=()=>f.current.onFinish(e.id);if(e.result.type!==`task`||r)return i=setTimeout(o,2200),()=>clearTimeout(i);let d=s.current;if(!d)return;let p=e.result.taskId,m=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,h=t.current,g=()=>{cancelAnimationFrame(n),clearTimeout(i),f.current.onLand(e.id),o()};h?.addEventListener(`pointerdown`,g,{once:!0}),h?.addEventListener(`wheel`,g,{once:!0,passive:!0});let _=performance.now(),v=0,y=!1,b=0,x,S=r=>{if(r-_>6e3){o();return}let s=t.current?.querySelector(`.map-macro[data-task-id="${CSS.escape(p)}"]`);if(!s||s.getBoundingClientRect().width<8){r-v>600&&(f.current.onReveal(p),v=r),n=requestAnimationFrame(S);return}if(m){f.current.onLand(e.id),i=setTimeout(o,1200);return}y||(f.current.onReveal(p),y=!0,v=r);let h=s.getBoundingClientRect();if((!x||Math.abs(x.x-h.x)+Math.abs(x.y-h.y)+Math.abs(x.width-h.width)>.7)&&(b=r),x=h,r-v<360||r-b<100){n=requestAnimationFrame(S);return}let g=t.current?.querySelector(`.map-composer`)?.getBoundingClientRect(),C=g?{x:g.left,y:g.top,width:g.width,height:g.height}:e.origin,w={x:C.x+C.width/2,y:C.y+C.height/2},T={x:w.x,y:w.y-26},E={x:h.left+h.width/2,y:h.top+h.height/2},D=gt(T,E,innerWidth),O=Math.min(320,C.width),k=Math.min(68,C.height),A=performance.now(),j=!1,M=t=>{if(!s.isConnected){o();return}let r=Math.min(1,(t-A)/1050),p=mt(Math.min(1,r/.22)),m=mt(ht((r-.22)/.6,0,1)),h=mt(ht((r-.82)/.18,0,1)),g=r<.22?{x:w.x,y:pt(w.y,T.y,p)}:D(m),_=pt(52,22,h),v=pt(O,_,p),y=pt(k,_,p);if(d.style.width=`${v}px`,d.style.height=`${y}px`,d.style.transform=`translate3d(${g.x-v/2}px,${g.y-y/2}px,0)`,d.style.opacity=String(Math.min(1,r/.045)*(1-h)),d.style.setProperty(`--dispatch-copy`,String(1-mt(Math.min(1,r/.12)))),d.style.setProperty(`--dispatch-mark`,String(pt(1,.7,h))),d.dataset.phase=r<.22?`compress`:r<.82?`travel`:`arrive`,c.current&&l.current&&r>.22){let e=Math.max(0,m-.16),t=Array.from({length:13},(t,n)=>D(pt(e,m,n/12)));c.current.setAttribute(`d`,t.map((e,t)=>`${t?`L`:`M`} ${e.x} ${e.y}`).join(` `)),c.current.style.opacity=String(.7*(1-h)),l.current.setAttribute(`x1`,String(t[0].x)),l.current.setAttribute(`y1`,String(t[0].y)),l.current.setAttribute(`x2`,String(g.x)),l.current.setAttribute(`y2`,String(g.y))}r>=.82&&!j&&(j=!0,f.current.onLand(e.id),u.current&&(u.current.style.left=`${E.x}px`,u.current.style.top=`${E.y}px`,a=u.current.animate([{transform:`translate(-50%,-50%) scale(.65)`,opacity:.65},{transform:`translate(-50%,-50%) scale(2.8)`,opacity:0}],{duration:650,easing:`cubic-bezier(.16,1,.3,1)`,fill:`both`}))),r<1?n=requestAnimationFrame(M):i=setTimeout(o,550)};n=requestAnimationFrame(M)};return n=requestAnimationFrame(S),()=>{cancelAnimationFrame(n),clearTimeout(i),a?.cancel(),h?.removeEventListener(`pointerdown`,g),h?.removeEventListener(`wheel`,g)}},[e.id,e.result,t,r]),p?(0,ft.createPortal)((0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`svg`,{className:`map-dispatch-trail`,"aria-hidden":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{ref:l,id:d,gradientUnits:`userSpaceOnUse`,children:[(0,Y.jsx)(`stop`,{stopColor:`#6fbcce`,stopOpacity:`0`}),(0,Y.jsx)(`stop`,{offset:`1`,stopColor:`#87d9cf`})]})}),(0,Y.jsx)(`path`,{ref:c,fill:`none`,stroke:`url(#${d})`,strokeWidth:`2.5`,strokeLinecap:`round`})]}),(0,Y.jsxs)(`div`,{ref:s,className:`map-dispatch-flight`,"data-testid":`map-dispatch-flight`,"data-state":`task`,"data-task-id":e.result?.type===`task`?e.result.taskId:void 0,"aria-hidden":`true`,children:[(0,Y.jsx)(`div`,{className:`map-dispatch-symbol`,children:(0,Y.jsx)(j,{size:25})}),(0,Y.jsxs)(`div`,{className:`map-dispatch-copy`,children:[(0,Y.jsx)(`strong`,{children:e.text}),(0,Y.jsx)(`span`,{children:n?`进入任务地图`:`Into your task map`})]})]}),(0,Y.jsx)(`div`,{ref:u,className:`map-dispatch-halo`,"aria-hidden":`true`})]}),document.body):null}var vt=()=>({revision:0,cards:{},steps:{},links:{}}),yt=(e,t)=>`${e}\u0000${t}`,bt=class{initialized=!1;seen=new Set;revision=0;loadingHistory=!1;observe(e,t=!1){let n=vt(),r=0;for(let t of e.cards){this.seen.has(`card:${t.id}`)||(n.cards[t.id]=Math.min(r++*100,400)),this.seen.add(`card:${t.id}`);let i=e.layouts[t.id],a=0;for(let e of i.steps){let r=yt(t.id,e.id);this.seen.has(`step:${r}`)||(n.steps[r]=160+Math.min(a++*120,720)),this.seen.add(`step:${r}`)}for(let e of i.links){let r=yt(t.id,e.id);this.seen.has(`link:${r}`)||(n.links[r]=Math.max(0,(n.steps[yt(t.id,e.target)]??160)-160)),this.seen.add(`link:${r}`)}}for(let t of e.links)this.seen.has(`outer:${t.id}`)||(n.links[t.id]=0),this.seen.add(`outer:${t.id}`);let i=!this.initialized||t||this.loadingHistory;return this.loadingHistory=t,this.initialized=!0,i||![n.cards,n.steps,n.links].some(e=>Object.keys(e).length)?null:{...n,revision:++this.revision}}};function xt(e,t=!1){let n=(0,X.useRef)(new bt),r=(0,X.useRef)(new Set),[i,a]=(0,X.useState)(vt);return(0,X.useEffect)(()=>{let i=n.current.observe(e,t);if(t)r.current.forEach(clearTimeout),r.current.clear(),a(vt());else if(i){a(e=>({revision:i.revision,cards:{...e.cards,...i.cards},steps:{...e.steps,...i.steps},links:{...e.links,...i.links}}));let e=setTimeout(()=>{r.current.delete(e),a(e=>({revision:e.revision,cards:Object.fromEntries(Object.entries(e.cards).filter(([e])=>!(e in i.cards))),steps:Object.fromEntries(Object.entries(e.steps).filter(([e])=>!(e in i.steps))),links:Object.fromEntries(Object.entries(e.links).filter(([e])=>!(e in i.links)))}))},2e3);r.current.add(e)}},[e,t]),(0,X.useEffect)(()=>()=>{r.current.forEach(clearTimeout),r.current.clear()},[]),i}var St=e=>1-(1-e)**3;function Ct(e,t,n){let r=St(Math.min(1,Math.max(0,n))),i={};for(let n in t){let a=e[n],o=t[n];i[n]=!a||r>=1?o:{x:a.x+(o.x-a.x)*r,y:a.y+(o.y-a.y)*r}}return i}function wt(e,t){for(let n in t){let r=e[n];if(r&&(r.x!==t[n].x||r.y!==t[n].y))return!0}return!1}function Tt(e,t,n=680){let[r,i]=(0,X.useState)(e),a=(0,X.useRef)(e),o=(0,X.useRef)(e);return(0,X.useEffect)(()=>{if(e===o.current)return;o.current=e;let r=a.current;if(t||!wt(r,e)||typeof requestAnimationFrame!=`function`){a.current=e,i(e);return}let s=null,c=performance.now(),l=t=>{let o=(t-c)/n;if(o>=1){a.current=e,i(e),s=null;return}a.current=Ct(r,e,o),i(a.current),s=requestAnimationFrame(l)};return s=requestAnimationFrame(l),()=>{s!=null&&cancelAnimationFrame(s)}},[e,t,n]),r}var Et={edges:new Set,nodes:new Set};function Dt(e,t){if(!t)return Et;let n=new Set,r=new Set([t]);for(let i of e)(i.source===t||i.target===t)&&(n.add(i.id),r.add(i.source),r.add(i.target));return{edges:n,nodes:r}}var Ot=2600,kt=e=>Math.min(Math.max(e-1,0),10)*80,At=e=>kt(e)+320;function jt(e,t){let n=Math.max(0,Math.floor(e));if(n<60)return t?`${n} 秒`:`${n}s`;let r=Math.floor(n/60);if(r<60)return t?`${r} 分钟`:`${r} min`;let i=Math.floor(r/60),a=r%60;return t?`${i} 小时 ${a} 分`:`${i} h ${String(a).padStart(2,`0`)} min`}function Mt(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n{}};function Pt(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Ft.prototype=Pt.prototype={constructor:Ft,on:function(e,t){var n=this._,r=It(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Rt.hasOwnProperty(t)?{space:Rt[t],local:e}:e}function Bt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Vt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ht(e){var t=zt(e);return(t.local?Vt:Bt)(t)}function Ut(){}function Wt(e){return e==null?Ut:function(){return this.querySelector(e)}}function Gt(e){typeof e!=`function`&&(e=Wt(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i=v&&(v=_+1);!(b=g[v])&&++v=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Sn(e){e||=Cn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;at?1:e>=t?0:NaN}function wn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Tn(){return Array.from(this)}function En(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Rn:typeof t==`function`?Bn:zn)(e,t,n??``)):Hn(this.node(),e)}function Hn(e,t){return e.style.getPropertyValue(t)||Ln(e).getComputedStyle(e,null).getPropertyValue(t)}function Un(e){return function(){delete this[e]}}function Wn(e,t){return function(){this[e]=t}}function Gn(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Kn(e,t){return arguments.length>1?this.each((t==null?Un:typeof t==`function`?Gn:Wn)(e,t)):this.node()[e]}function qn(e){return e.trim().split(/^|\s+/)}function Jn(e){return e.classList||new Yn(e)}function Yn(e){this._node=e,this._names=qn(e.getAttribute(`class`)||``)}Yn.prototype={add:function(e){this._names.indexOf(e)<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 Xn(e,t){for(var n=Jn(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Tr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n()=>e;function qr(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){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:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}qr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Jr(e){return!e.ctrlKey&&!e.button}function Yr(){return this.parentNode}function Xr(e,t){return t??{x:e.x,y:e.y}}function Zr(){return navigator.maxTouchPoints||`ontouchstart`in this}function Qr(){var e=Jr,t=Yr,n=Xr,r=Zr,i={},a=Pt(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Br).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(Lr(n.view).on(`mousemove.drag`,m,Vr).on(`mouseup.drag`,h,Vr),Wr(n.view),Hr(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Ur(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){Lr(e.view).on(`mousemove.drag mouseup.drag`,null),Gr(e.view,l),Ur(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?xi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?xi(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=ci.exec(e))?new wi(t[1],t[2],t[3],1):(t=li.exec(e))?new wi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ui.exec(e))?xi(t[1],t[2],t[3],t[4]):(t=di.exec(e))?xi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fi.exec(e))?ji(t[1],t[2]/100,t[3]/100,1):(t=pi.exec(e))?ji(t[1],t[2]/100,t[3]/100,t[4]):mi.hasOwnProperty(e)?bi(mi[e]):e===`transparent`?new wi(NaN,NaN,NaN,0):null}function bi(e){return new wi(e>>16&255,e>>8&255,e&255,1)}function xi(e,t,n,r){return r<=0&&(e=t=n=NaN),new wi(e,t,n,r)}function Si(e){return e instanceof ti||(e=yi(e)),e?(e=e.rgb(),new wi(e.r,e.g,e.b,e.opacity)):new wi}function Ci(e,t,n,r){return arguments.length===1?Si(e):new wi(e,t,n,r??1)}function wi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}$r(wi,Ci,ei(ti,{brighter(e){return e=e==null?ri:ri**+e,new wi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ni:ni**+e,new wi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wi(ki(this.r),ki(this.g),ki(this.b),Oi(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:Ti,formatHex:Ti,formatHex8:Ei,formatRgb:Di,toString:Di}));function Ti(){return`#${Ai(this.r)}${Ai(this.g)}${Ai(this.b)}`}function Ei(){return`#${Ai(this.r)}${Ai(this.g)}${Ai(this.b)}${Ai((isNaN(this.opacity)?1:this.opacity)*255)}`}function Di(){let e=Oi(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ki(this.r)}, ${ki(this.g)}, ${ki(this.b)}${e===1?`)`:`, ${e})`}`}function Oi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ki(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ai(e){return e=ki(e),(e<16?`0`:``)+e.toString(16)}function ji(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Pi(e,t,n,r)}function Mi(e){if(e instanceof Pi)return new Pi(e.h,e.s,e.l,e.opacity);if(e instanceof ti||(e=yi(e)),!e)return new Pi;if(e instanceof Pi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Pi(o,s,c,e.opacity)}function Ni(e,t,n,r){return arguments.length===1?Mi(e):new Pi(e,t,n,r??1)}function Pi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}$r(Pi,Ni,ei(ti,{brighter(e){return e=e==null?ri:ri**+e,new Pi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ni:ni**+e,new Pi(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,i=2*n-r;return new wi(Li(e>=240?e-240:e+120,i,r),Li(e,i,r),Li(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pi(Fi(this.h),Ii(this.s),Ii(this.l),Oi(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(){let e=Oi(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Fi(this.h)}, ${Ii(this.s)*100}%, ${Ii(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Fi(e){return e=(e||0)%360,e<0?e+360:e}function Ii(e){return Math.max(0,Math.min(1,e||0))}function Li(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Ri=e=>()=>e;function zi(e,t){return function(n){return e+n*t}}function Bi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Vi(e){return(e=+e)==1?Hi:function(t,n){return n-t?Bi(t,n,e):Ri(isNaN(t)?n:t)}}function Hi(e,t){var n=t-e;return n?zi(e,n):Ri(isNaN(e)?t:e)}var Ui=(function e(t){var n=Vi(t);function r(e,t){var r=n((e=Ci(e)).r,(t=Ci(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Hi(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Wi(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Ji(r,i)})),n=Zi.lastIndex;return n180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Ji(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Ji(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Ji(e,n)},{i:s-2,x:Ji(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t=0&&e._call.call(void 0,t),e=e._next;--ga}function Ma(){Ca=(Sa=Ta.now())+wa,ga=_a=0;try{ja()}finally{ga=0,Pa(),Ca=0}}function Na(){var e=Ta.now(),t=e-Sa;t>ya&&(wa-=t,Sa=e)}function Pa(){for(var e,t=ba,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:ba=n);xa=e,Fa(r)}function Fa(e){ga||(_a&&=clearTimeout(_a),e-Ca>24?(e<1/0&&(_a=setTimeout(Ma,e-Ta.now()-wa)),va&&=clearInterval(va)):(va||=(Sa=Ta.now(),setInterval(Na,ya)),ga=1,Ea(Ma)))}function Ia(e,t,n){var r=new ka;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var La=Pt(`start`,`end`,`cancel`,`interrupt`),Ra=[];function za(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Ua(e,n,{name:t,index:r,group:i,on:La,tween:Ra,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ba(e,t){var n=Ha(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Va(e,t){var n=Ha(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function Ha(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Ua(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Aa(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Ia(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Ga(e){return this.each(function(){Wa(this,e)})}function Ka(e,t){var n,r;return function(){var i=Va(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o=0&&(e=e.slice(0,t)),!e||e===`start`})}function Co(e,t,n){var r,i,a=So(t)?Ba:Va;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function wo(e,t){var n=this._id;return arguments.length<2?Ha(this.node(),n).on.on(e):this.each(Co(n,e,t))}function To(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Eo(){return this.on(`end.remove`,To(this._id))}function Do(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Wt(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o()=>e;function rs(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function is(e,t,n){this.k=e,this.x=t,this.y=n}is.prototype={constructor:is,scale:function(e){return e===1?this:new is(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new is(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 as=new is(1,0,0);os.prototype=is.prototype;function os(e){for(;!e.__zoom;)if(!(e=e.parentNode))return as;return e.__zoom}function ss(e){e.stopImmediatePropagation()}function cs(e){e.preventDefault(),e.stopImmediatePropagation()}function ls(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function us(){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 ds(){return this.__zoom||as}function fs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ps(){return navigator.maxTouchPoints||`ontouchstart`in this}function ms(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function hs(){var e=ls,t=us,n=ms,r=fs,i=ps,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ha,l=Pt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,ds).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,ds),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(as.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new is(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new is(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new is(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Lr(this.that).datum();l.call(e,this.that,new rs(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=zr(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Wa(this),s.start();cs(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Lr(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=zr(t,i),l=t.clientX,u=t.clientY;Wr(t.view),ss(t),a.mouse=[c,this.__zoom.invert(c)],Wa(this),a.start();function d(e){if(cs(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=zr(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Gr(e.view,a.moved),cs(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=zr(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);cs(r),s>0?Lr(this).transition().duration(s).call(x,d,c,r):Lr(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(ss(t),s=0;s`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} 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.`},_s=[[-1/0,-1/0],[1/0,1/0]],vs=[`Enter`,` `,`Escape`],ys={"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`},bs;(function(e){e.Strict=`strict`,e.Loose=`loose`})(bs||={});var xs;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(xs||={});var Ss;(function(e){e.Partial=`partial`,e.Full=`full`})(Ss||={});var Cs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ws;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(ws||={});var Ts;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Ts||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var Es={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function Ds(e){return e===null?null:e?`valid`:`invalid`}var Os=e=>`id`in e&&`source`in e&&`target`in e,ks=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),As=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),js=(e,t=[0,0])=>{let{width:n,height:r}=dc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ms=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:qs(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):As(n)?n:t.nodeLookup.get(n.id)),Gs(e,i?Ys(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Ns=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Gs(n,Ys(e)),r=!0)}),r?qs(n):{x:0,y:0,width:0,height:0}},Ps=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=Zs(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Fs=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Is(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Ls({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=cc(Ns(Is(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function Rs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,gs.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&uc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=uc(d)?Vs(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,gs.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function zs({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Fs(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var Bs=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Vs=(e={x:0,y:0},t,n)=>({x:Bs(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Bs(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hs(e,t,n){let{width:r,height:i}=dc(n),{x:a,y:o}=n.internals.positionAbsolute;return Vs(e,[[a,o],[a+r,o+i]],t)}var Us=(e,t,n)=>en?-Bs(Math.abs(e-n),1,t)/t:0,Ws=(e,t,n=15,r=40)=>[Us(e.x,r,t.width-r)*n,Us(e.y,r,t.height-r)*n],Gs=(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)}),Ks=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),qs=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Js=(e,t=[0,0])=>{let{x:n,y:r}=As(e)?e.internals.positionAbsolute:js(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ys=(e,t=[0,0])=>{let{x:n,y:r}=As(e)?e.internals.positionAbsolute:js(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Xs=(e,t)=>qs(Gs(Ks(e),Ks(t))),Zs=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},Qs=(e,t)=>Zs(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),$s=e=>ec(e.width)&&ec(e.height)&&ec(e.x)&&ec(e.y),ec=e=>!isNaN(e)&&isFinite(e),tc=(e,t)=>(e,t)=>{},nc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),rc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?nc(s,o):s},ic=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ac(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let 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 oc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=ac(e,n),i=ac(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=ac(e.top??e.y??0,n),i=ac(e.bottom??e.y??0,n),a=ac(e.left??e.x??0,t),o=ac(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function sc(e,t,n,r,i,a){let{x:o,y:s}=ic(e,[t,n,r]),{x:c,y:l}=ic({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var cc=(e,t,n,r,i,a)=>{let o=oc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=Bs(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=sc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},lc=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function uc(e){return e!=null&&e!==`parent`}function dc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function fc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function pc(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function mc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function hc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function gc(e){return{...ys,...e||{}}}function _c(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Cc(e),s=rc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?nc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var vc=e=>({width:e.offsetWidth,height:e.offsetHeight}),yc=e=>e?.getRootNode?.()||window?.document,bc=[`INPUT`,`SELECT`,`TEXTAREA`];function xc(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?bc.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Sc=e=>`clientX`in e,Cc=(e,t)=>{let n=Sc(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},wc=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...vc(t)}})};function Tc({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Ec(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Dc({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Ec(t-r,a),n];case Q.Right:return[t+Ec(r-t,a),n];case Q.Top:return[t,n-Ec(n-i,a)];case Q.Bottom:return[t,n+Ec(i-n,a)]}}function Oc({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Dc({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Dc({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Tc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function kc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n0}var Mc=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Nc=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Pc=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,gs.error006()),t;let r=n.getEdgeId||Mc,i;return i=Os(e)?{...e}:{...e,id:r(e)},Nc(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Fc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=kc({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Ic={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},Lc=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.xMath.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function zc({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=Ic[t],c=Ic[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Lc({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=kc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Bc(e,t,n,r){let i=Math.min(Rc(e,t)/2,Rc(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.xe.id===t):e[0])||null}function qc(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Jc(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=qc(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var Yc=1e3,Xc=10,Zc={nodeOrigin:[0,0],nodeExtent:_s,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Qc={...Zc,checkEquality:!0};function $c(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function el(e,t,n){let r=$c(Zc,n);for(let n of e.values())if(n.parentId)al(n,e,t,r);else{let e=Vs(js(n,r.nodeOrigin),uc(n.extent)?n.extent:r.nodeExtent,dc(n));n.internals.positionAbsolute=e}}function tl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function nl(e){return e===`manual`}function rl(e,t,n,r={}){let i=$c(Qc,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!nl(i.zIndexMode)?Yc:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=Vs(js(u,i.nodeOrigin),uc(u.extent)?u.extent:i.nodeExtent,dc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:tl(u,e),z:ol(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&al(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function il(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function al(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=$c(Zc,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}il(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*Xc),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=sl(e,u,o,s,a&&!nl(c)?Yc:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function ol(e,t,n){let r=ec(e.zIndex)?e.zIndex:0;return nl(n)?r:r+(e.selected?t:0)}function sl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=dc(e),l=js(e,n),u=uc(e.extent)?Vs(l,e.extent,c):l,d=Vs({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Hs(d,c,t));let f=ol(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function cl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=Xs(a.get(n.parentId)?.expandedRect??Js(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=dc(a),l=a.origin??r,u=t.x0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width0){let e=cl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function ul({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function dl(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function fl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;dl(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),dl(`target`,s,c,e,i,o),t.set(r.id,r)}}function pl(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:pl(n,t):!1}function ml(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function hl(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!pl(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function gl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function _l({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=nc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function vl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=Lr(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Ks(Ns(s)):null,x=v&&l?_l({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:nc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=Rs({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=gl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Ws(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=_c(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=hl(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=gl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Qr().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=_c(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Cc(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=_c(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Cc(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Cc(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=gl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!ml(t,`.${g}`,v))&&(!_||ml(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function yl(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())Qs(i,Js(e))>0&&r.push(e);return r}var bl=250;function xl(e,t,n,r){let i=[],a=1/0,o=yl(e,n,t+bl);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Gc(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function Sl(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Gc(o,c,c.position,!0)}:c}function Cl(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function wl(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Tl=()=>!0;function El(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Tl,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=yc(e.target),E=0,D,{x:O,y:k}=Cc(e),A=Cl(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=Sl(i,A,r,c,t);if(!N)return;let P=Cc(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=Ws(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},ee=c.get(i),V={inProgress:!0,isValid:null,from:Gc(ee,B,Q.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:ee,to:P,toHandle:null,toPosition:Es[B.position],toNode:null,pointer:P};function H(){M=!0,y(V),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&H();function U(e){if(!M){let{x:t,y:n}=Cc(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;H()}if(!x()||!B){W(e);return}let a=b();P=Cc(e,j),D=xl(rc(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=Dl(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=wl(!!D,s.isValid);let u=c.get(i),f=u?Gc(u,B,Q.Left,!0):V.from,p={...V,from:f,isValid:L,to:s.toHandle&&L?ic({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:Es[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),V=p}function W(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,U),T.removeEventListener(`mouseup`,W),T.removeEventListener(`touchmove`,U),T.removeEventListener(`touchend`,W)}}T.addEventListener(`mousemove`,U),T.addEventListener(`mouseup`,W),T.addEventListener(`touchmove`,U),T.addEventListener(`touchend`,W)}function Dl(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Tl,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Cc(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=Cl(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===bs.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=Sl(t,e,a,u,n,!0)}return _}var Ol={onPointerDown:El,isValid:Dl};function kl({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Lr(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&lc()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=hs().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:zr}}var Al=e=>({x:e.x,y:e.y,zoom:e.k}),jl=({x:e,y:t,zoom:n})=>as.translate(e,t).scale(n),Ml=(e,t)=>e.target.closest(`.${t}`),Nl=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Pl=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Fl=(e,t=0,n=Pl,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Il=e=>{let t=e.ctrlKey&&lc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ll({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Ml(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=zr(u),t=d*2**Il(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===xs.Vertical?0:u.deltaX*f,m=i===xs.Horizontal?0:u.deltaY*f;!lc()&&u.shiftKey&&i!==xs.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=Al(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function Rl({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=Ml(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function zl({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Al(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function Bl({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Nl(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,Al(a.transform))}}function Vl({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Nl(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=Al(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Hl({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(Ml(d,`${l}-flow__node`)||Ml(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||Ml(d,s)&&m||Ml(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function Ul({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=hs().scaleExtent([t,n]).translateExtent(r),f=Lr(e).call(d);v({x:i.x,y:i.y,zoom:Bs(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(Il);async function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).transform(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!ec(E)||E<0?0:E);let k=O?Ll({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Rl({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});f.on(`wheel.zoom`,k,{passive:!1});let A=zl({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,A);let j=Bl({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,j);let M=Vl({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,M);let N=Hl({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(N),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=jl(e),i=d?.constrain()(r,t,n);return i&&await h(i),i}async function y(e,t){let n=jl(e);return await h(n,t),n}function b(e){if(f){let t=jl(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?os(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).scaleTo(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).scaleBy(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!ec(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var Wl;(function(e){e.Line=`line`,e.Handle=`handle`})(Wl||={});function Gl({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function Kl(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function ql(e,t){return Math.max(0,t-e)}function Jl(e,t){return Math.max(0,e-t)}function Yl(e,t,n){return Math.max(0,t-e,e-n)}function Xl(e,t){return e?!t:t}function Zl(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=Yl(E,h,g),j=Yl(D,_,v);if(o){let e=0,t=0;c&&w<0?e=ql(y+w+O,o[0][0]):!c&&w>0&&(e=Jl(y+E+O,o[1][0])),l&&T<0?t=ql(b+T+k,o[0][1]):!l&&T>0&&(t=Jl(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Jl(y+w,s[0][0]):!c&&w<0&&(e=ql(y+E,s[1][0])),l&&T>0?t=Jl(b+T,s[0][1]):!l&&T<0&&(t=ql(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=Yl(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Jl(b+k+E/C,o[1][1])*C:ql(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?ql(b+E/C,s[1][1])*C:Jl(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=Yl(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Jl(y+D*C+O,o[1][0])/C:ql(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?ql(y+D*C,s[1][0])/C:Jl(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(Xl(c,l)?-w:w)/C:w=(Xl(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Ql={width:0,height:0,x:0,y:0},$l={...Ql,pointerX:0,pointerY:0,aspectRatio:1};function eu(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function tu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=Lr(e),o={controlDirection:Kl(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Ql},h={...$l};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:Kl(e)};let g,_=null,v=[],y,b,x,S=!1,C=Qr().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=_c(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=uc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=eu(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=_c(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=Zl(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var nu=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ru=t(((e,t)=>{t.exports=nu()})),iu=t((e=>{var t=n(),r=ru();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),au=e(t(((e,t)=>{t.exports=iu()}))(),1),ou=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},su=e=>e?ou(e):ou,{useDebugValue:cu}=X.default,{useSyncExternalStoreWithSelector:lu}=au.default,uu=e=>e;function du(e,t=uu,n){let r=lu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return cu(r),r}var fu=(e,t)=>{let n=su(e),r=(e,r=t)=>du(n,e,r);return Object.assign(r,n),r},pu=(e,t)=>e?fu(e,t):fu;function mu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var hu=(0,X.createContext)(null),gu=hu.Provider,_u=gs.error001(`react`);function $(e,t){let n=(0,X.useContext)(hu);if(n===null)throw Error(_u);return du(n,e,t)}function vu(){let e=(0,X.useContext)(hu);if(e===null)throw Error(_u);return(0,X.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var yu={display:`none`},bu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},xu=`react-flow__node-desc`,Su=`react-flow__edge-desc`,Cu=`react-flow__aria-live`,wu=e=>e.ariaLiveMessage,Tu=e=>e.ariaLabelConfig;function Eu({rfId:e}){let t=$(wu);return(0,Y.jsx)(`div`,{id:`${Cu}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:bu,children:t})}function Du({rfId:e,disableKeyboardA11y:t}){let n=$(Tu);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{id:`${xu}-${e}`,style:yu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Y.jsx)(`div`,{id:`${Su}-${e}`,style:yu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Y.jsx)(Eu,{rfId:e})]})}var Ou=(0,X.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,Y.jsx)(`div`,{className:Mt([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Ou.displayName=`Panel`;var ku=`https://reactflow.dev?utm_source=attribution`;function Au({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Y.jsx)(Ou,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ku}`,children:(0,Y.jsx)(`a`,{href:ku,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var ju=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Mu=e=>e.id;function Nu(e,t){return mu(e.selectedNodes.map(Mu),t.selectedNodes.map(Mu))&&mu(e.selectedEdges.map(Mu),t.selectedEdges.map(Mu))}function Pu({onSelectionChange:e}){let t=vu(),{selectedNodes:n,selectedEdges:r}=$(ju,Nu);return(0,X.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Fu=e=>!!e.onSelectionChangeHandlers;function Iu({onSelectionChange:e}){let t=$(Fu);return e||t?(0,Y.jsx)(Pu,{onSelectionChange:e}):null}var Lu=[0,0],Ru={x:0,y:0,zoom:1},zu=[...`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`.split(`.`),`rfId`],Bu=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}),Vu={translateExtent:_s,nodeOrigin:Lu,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Hu(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(Bu,mu),l=vu();(0,X.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Vu,s()}),[]);let u=(0,X.useRef)(Vu);return(0,X.useEffect)(()=>{for(let s of zu){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:gc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},zu.map(t=>e[t])),null}function Uu(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function Wu(e){let[t,n]=(0,X.useState)(e===`system`?null:e);return(0,X.useEffect)(()=>{if(e!==`system`){n(e);return}let t=Uu(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?Uu()?.matches?`dark`:`light`:t}var Gu=typeof document<`u`?document:null;function Ku(e=null,t={target:Gu,actInsideInputWithModifier:!0}){let[n,r]=(0,X.useState)(!1),i=(0,X.useRef)(!1),a=(0,X.useRef)(new Set([])),[o,s]=(0,X.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,` +`).replace(` + +`,` ++`).split(` +`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,X.useEffect)(()=>{let n=t?.target??Gu,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&xc(e))return!1;let n=Ju(e.code,s);if(a.current.add(e[n]),qu(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=Ju(e.code,s);qu(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function qu(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Ju(e,t){return t.includes(e)?`code`:`key`}var Yu=()=>{let e=vu();return(0,X.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=cc(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return rc(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=ic(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Xu(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)Zu(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function Zu(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(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)}}function Qu(e,t){return Xu(e,t)}function $u(e,t){return Xu(e,t)}function ed(e,t){return{id:e,type:`select`,selected:t}}function td(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(ed(a.id,e)))}return r}function nd({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function rd(e){return{id:e.id,type:`remove`}}var id=tc(`React Flow`,`https://reactflow.dev/`);function ad(e,t,n={}){return Pc(e,t,{...n,onError:n.onError??id})}var od=e=>ks(e),sd=e=>Os(e);function cd(e){return(0,X.forwardRef)(e)}var ld=typeof window<`u`?X.useLayoutEffect:X.useEffect;function ud(e){let[t,n]=(0,X.useState)(BigInt(0)),[r]=(0,X.useState)(()=>dd(()=>n(e=>e+BigInt(1))));return ld(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function dd(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var fd=(0,X.createContext)(null);function pd({children:e}){let t=vu(),n=ud((0,X.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=nd({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=ud((0,X.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(nd({items:s,lookup:o}))},[])),i=(0,X.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,Y.jsx)(fd.Provider,{value:i,children:e})}function md(){let e=(0,X.useContext)(fd);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var hd=e=>!!e.panZoom;function gd(){let e=Yu(),t=vu(),n=md(),r=$(hd),i=(0,X.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=od(e)?e:n.get(e.id),a=i.parentId?pc(i.position,i.measured,i.parentId,n,r):i.position;return Js({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&od(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&sd(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await zs({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(rd);o?.(f),c(e)}if(m){let e=d.map(rd);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=$s(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=Js(s?r:a),l=Qs(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=$s(e)?e:a(e);if(!r)return!1;let i=Qs(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Ms(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??hc();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,X.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var _d=e=>e.selected,vd=typeof window<`u`?window:void 0;function yd({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=vu(),{deleteElements:r}=gd(),i=Ku(e,{actInsideInputWithModifier:!1}),a=Ku(t,{target:vd});(0,X.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(_d),edges:e.filter(_d)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,X.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function bd(e){let t=vu();(0,X.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=vc(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,gs.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var xd={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Sd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Cd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=xs.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=vu(),S=(0,X.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=$(Sd,mu),E=Ku(f),D=(0,X.useRef)();bd(S);let O=(0,X.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,X.useEffect)(()=>{if(S.current){D.current=Ul({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,X.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,Y.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:xd,children:m})}var wd=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Td(){let{userSelectionActive:e,userSelectionRect:t}=$(wd,mu);return e&&t?(0,Y.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}var Ed=(e,t)=>n=>{n.target===t.current&&e?.(n)},Dd=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Od({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ss.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,X.useRef)(0),_=vu(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(Dd,mu),C=y&&(e||v),w=(0,X.useRef)(null),T=(0,X.useRef)(),E=(0,X.useRef)(new Set),D=(0,X.useRef)(new Set),O=(0,X.useRef)(!1),k=(0,X.useRef)(!1),A=(0,X.useRef)({x:0,y:0}),j=(0,X.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=Cc(n.nativeEvent,T.current),l=rc({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=ic(d,i),m={startX:d.x,startY:d.y,x:ee.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}mc(h,E.current)||c(td(a,E.current,!0)),mc(g,D.current)||l(td(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!T.current)return;let[e,t]=Ws(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(R)})}let z=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,X.useEffect)(()=>()=>z(),[]);let B=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Cc(e.nativeEvent,T.current);A.current={x:o,y:c};let l=ic({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(R(),!0),L(o,c)},ee=e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),z())},V=e=>{e.target?.releasePointerCapture?.(e.pointerId),z()},H=r===!0||Array.isArray(r)&&r.includes(0);return(0,Y.jsxs)(`div`,{className:Mt([`react-flow__pane`,{draggable:H,dragging:b,selection:e}]),onClick:C?void 0:Ed(M,w),onContextMenu:Ed(N,w),onWheel:Ed(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?B:p,onPointerUp:ee,onPointerCancel:C?V:void 0,onPointerDownCapture:C?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:xd,children:[h,(0,Y.jsx)(Td,{})]})}function kd({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,gs.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function Ad({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=vu(),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)();return(0,X.useEffect)(()=>{u.current=vl({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{kd({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,X.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var jd=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Md(){let e=vu();return(0,X.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=jd(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=nc(t,i));let{position:a,positionAbsolute:s}=Rs({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Nd=(0,X.createContext)(null),Pd=Nd.Provider;Nd.Consumer;var Fd=()=>(0,X.useContext)(Nd),Id=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Ld=(0,X.createContext)(null);function Rd({children:e}){let t=$(Id,mu);return(0,Y.jsx)(Ld.Provider,{value:t,children:e})}function zd(){let e=(0,X.useContext)(Ld);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var Bd={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Vd=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return Bd;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===bs.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Hd({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=vu(),_=Fd(),{connectOnClick:v,noPanClassName:y,rfId:b}=zd(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(Vd(_,m,e),mu);_||g.getState().onError?.(`010`,gs.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(ad(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Sc(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Ol.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,Y.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Mt([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=yc(t.target),h=n||c,{connection:v,isValid:y}=Ol.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var Ud=(0,X.memo)(cd(Hd));function Wd({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[e?.label,(0,Y.jsx)(Ud,{type:`source`,position:n,isConnectable:t})]})}function Gd({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ud,{type:`target`,position:n,isConnectable:t}),e?.label,(0,Y.jsx)(Ud,{type:`source`,position:r,isConnectable:t})]})}function Kd(){return null}function qd({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ud,{type:`target`,position:n,isConnectable:t}),e?.label]})}var Jd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Yd={input:Wd,default:Gd,output:qd,group:Kd};function Xd(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var Zd=e=>{let{width:t,height:n,x:r,y:i}=Ns(e.nodeLookup,{filter:e=>!!e.selected});return{width:ec(t)?t:null,height:ec(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Qd({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=vu(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(Zd,mu),c=Md(),l=(0,X.useRef)(null);(0,X.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(Ad({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,Y.jsx)(`div`,{className:Mt([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,Y.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Jd,e.key)&&(e.preventDefault(),c({direction:Jd[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var $d=typeof window<`u`?window:void 0,ef=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function tf({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:R}=$(ef,mu),z=Ku(l,{target:$d}),B=Ku(h,{target:$d}),ee=B||w,V=B||b,H=u&&ee!==!0,U=z||R||H;return yd({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,Y.jsx)(Cd,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:V,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!z&&ee,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:H,children:(0,Y.jsxs)(Od,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ee,autoPanOnSelection:T,isSelecting:!!U,selectionMode:d,selectionKeyPressed:z,paneClickDistance:s,selectionOnDrag:H,children:[e,L&&(0,Y.jsx)(Qd,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}tf.displayName=`FlowRenderer`;var nf=(0,X.memo)(tf),rf=e=>t=>e?Ps(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function af(e){return $((0,X.useCallback)(rf(e),[e]),mu)}var of=e=>e.updateNodeInternals;function sf(){let e=$(of),[t]=(0,X.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,X.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function cf({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=vu(),a=(0,X.useRef)(null),o=(0,X.useRef)(null),s=(0,X.useRef)(e.sourcePosition),c=(0,X.useRef)(e.targetPosition),l=(0,X.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,X.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,X.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,X.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function lf({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},mu),S=y.type||`default`,C=g?.[S]||Yd[S];C===void 0&&(v?.(`003`,gs.error003(S)),S=`default`,C=g?.default||Yd.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=vu(),k=fc(y),A=cf({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=Ad({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=Md();if(y.hidden)return null;let N=dc(y),P=Xd(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,R=i?e=>i(e,{...b.userNode}):void 0,z=a?e=>a(e,{...b.userNode}):void 0,B=o?e=>o(e,{...b.userNode}):void 0,ee=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&kd({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},V=t=>{if(!(xc(t.nativeEvent)||m)){if(vs.includes(t.key)&&T){let n=t.key===`Escape`;kd({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(Jd,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:Jd[t.key],factor:t.shiftKey?4:1})}}},H=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Ps(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,Y.jsx)(`div`,{className:Mt([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:R,onContextMenu:z,onClick:ee,onDoubleClick:B,onKeyDown:D?V:void 0,tabIndex:D?0:void 0,onFocus:D?H:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${xu}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,Y.jsx)(Pd,{value:e,children:(0,Y.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var uf=(0,X.memo)(lf),df=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ff(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=$(df,mu),o=af(e.onlyRenderVisibleElements),s=sf();return(0,Y.jsx)(`div`,{className:`react-flow__nodes`,style:xd,children:o.map(o=>(0,Y.jsx)(uf,{id:o,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:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}ff.displayName=`NodeRenderer`;var pf=(0,X.memo)(ff);function mf(e){return $((0,X.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&jc({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),mu)}var hf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,Y.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},gf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,Y.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},_f={[Ts.Arrow]:hf,[Ts.ArrowClosed]:gf};function vf(e){let t=vu();return(0,X.useMemo)(()=>Object.prototype.hasOwnProperty.call(_f,e)?_f[e]:(t.getState().onError?.(`009`,gs.error009(e)),null),[e])}var yf=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=vf(t);return c?(0,Y.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,Y.jsx)(c,{color:n,strokeWidth:o})}):null},bf=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,X.useMemo)(()=>Jc(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,Y.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,Y.jsx)(`defs`,{children:i.map(e=>(0,Y.jsx)(yf,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};bf.displayName=`MarkerDefinitions`;var xf=(0,X.memo)(bf);function Sf({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,X.useState)({x:1,y:0,width:0,height:0}),p=Mt([`react-flow__edge-textwrapper`,l]),m=(0,X.useRef)(null);return(0,X.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,Y.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,Y.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,Y.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Sf.displayName=`EdgeText`;var Cf=(0,X.memo)(Sf);function wf({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{...u,d:e,fill:`none`,className:Mt([`react-flow__edge-path`,u.className])}),l?(0,Y.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&ec(t)&&ec(n)?(0,Y.jsx)(Cf,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Tf({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Ef({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=Tf({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Tf({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Tc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Df(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Ef({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Of=Df({isInternal:!1}),kf=Df({isInternal:!0});Of.displayName=`SimpleBezierEdge`,kf.displayName=`SimpleBezierEdgeInternal`;function Af(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Vc({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var jf=Af({isInternal:!1}),Mf=Af({isInternal:!0});jf.displayName=`SmoothStepEdge`,Mf.displayName=`SmoothStepEdgeInternal`;function Nf(e){return(0,X.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,Y.jsx)(jf,{...n,id:r,pathOptions:(0,X.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Pf=Nf({isInternal:!1}),Ff=Nf({isInternal:!0});Pf.displayName=`StepEdge`,Ff.displayName=`StepEdgeInternal`;function If(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Fc({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var Lf=If({isInternal:!1}),Rf=If({isInternal:!0});Lf.displayName=`StraightEdge`,Rf.displayName=`StraightEdgeInternal`;function zf(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Oc({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var Bf=zf({isInternal:!1}),Vf=zf({isInternal:!0});Bf.displayName=`BezierEdge`,Vf.displayName=`BezierEdgeInternal`;var Hf={default:Vf,straight:Rf,step:Ff,smoothstep:Mf,simplebezier:kf},Uf={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Wf=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,Gf=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,Kf=`react-flow__edgeupdater`;function qf({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,Y.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Mt([Kf,`${Kf}-${s}`]),cx:Wf(t,r,e),cy:Gf(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function Jf({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=vu(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Ol.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(e===!0||e===`source`)&&(0,Y.jsx)(qf,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,Y.jsx)(qf,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function Yf({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||Hf[x];S===void 0&&(_?.(`011`,gs.error011(x)),x=`default`,S=h?.default||Hf.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,X.useRef)(null),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),j=vu(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=$((0,X.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return Uf;let i=Uc({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=Ac({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||Uf,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),mu),z=(0,X.useMemo)(()=>y.markerStart?`url('#${qc(y.markerStart,m)}')`:void 0,[y.markerStart,m]),B=(0,X.useMemo)(()=>y.markerEnd?`url('#${qc(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let ee=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},V=a?e=>{a(e,{...y})}:void 0,H=o?e=>{o(e,{...y})}:void 0,U=s?e=>{s(e,{...y})}:void 0,W=c?e=>{c(e,{...y})}:void 0,G=l?e=>{l(e,{...y})}:void 0;return(0,Y.jsx)(`svg`,{style:{zIndex:M},children:(0,Y.jsxs)(`g`,{className:Mt([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:ee,onDoubleClick:V,onContextMenu:H,onMouseEnter:U,onMouseMove:W,onMouseLeave:G,onKeyDown:C?t=>{if(!v&&vs.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${Su}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,Y.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:z,markerEnd:B,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,Y.jsx)(Jf,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var Xf=(0,X.memo)(Yf),Zf=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Qf({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(Zf,mu),b=mf(t);return(0,Y.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,Y.jsx)(xf,{defaultColor:e,rfId:n}),b.map(e=>(0,Y.jsx)(Xf,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}Qf.displayName=`EdgeRenderer`;var $f=(0,X.memo)(Qf),ep=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function tp({children:e}){let t=$(ep);return(0,Y.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:t},children:e})}function np(e){let t=gd(),n=(0,X.useRef)(!1);(0,X.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var rp=e=>e.panZoom?.syncViewport;function ip(e){let t=$(rp),n=vu();return(0,X.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function ap(e){return e.connection.inProgress?{...e.connection,to:rc(e.connection.to,e.transform)}:{...e.connection}}function op(e){return e?t=>e(ap(t)):ap}function sp(e){return $(op(e),mu)}var cp=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function lp({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(cp,mu);return a&&i&&c?(0,Y.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,Y.jsx)(`g`,{className:Mt([`react-flow__connection`,Ds(s)]),children:(0,Y.jsx)(up,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var up=({style:e,type:t=ws.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=sp();if(!i)return;if(n)return(0,Y.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Ds(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case ws.Bezier:[m]=Oc(h);break;case ws.SimpleBezier:[m]=Ef(h);break;case ws.Step:[m]=Vc({...h,borderRadius:0});break;case ws.SmoothStep:[m]=Vc(h);break;default:[m]=Fc(h)}return(0,Y.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};up.displayName=`ConnectionLine`;var dp={};function fp(e=dp){(0,X.useRef)(e),vu(),(0,X.useEffect)(()=>{},[e])}function pp(){vu(),(0,X.useRef)(!1),(0,X.useEffect)(()=>{},[])}function mp({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:z,autoPanOnSelection:B,onPaneClick:ee,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneScroll:W,onPaneContextMenu:G,paneClickDistance:te,nodeClickDistance:ne,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:K,reconnectRadius:oe,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:q,nodeExtent:pe,rfId:me,viewport:he,onViewportChange:ge}){return fp(e),fp(t),pp(),np(n),ip(he),(0,Y.jsx)(nf,{onPaneClick:ee,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:W,paneClickDistance:te,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:z,autoPanOnSelection:B,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:q,onViewportChange:ge,isControlledViewport:!!he,children:(0,Y.jsxs)(tp,{children:[(0,Y.jsx)($f,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,onlyRenderVisibleElements:T,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:K,reconnectRadius:oe,defaultMarkerColor:M,noPanClassName:fe,disableKeyboardA11y:q,rfId:me}),(0,Y.jsx)(lp,{style:h,type:m,component:g,containerStyle:_}),(0,Y.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,Y.jsx)(pf,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ne,onlyRenderVisibleElements:T,noPanClassName:fe,noDragClassName:ue,disableKeyboardA11y:q,nodeExtent:pe,rfId:me}),(0,Y.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}mp.displayName=`GraphView`;var hp=(0,X.memo)(mp),gp=tc(`React Flow`,`https://reactflow.dev/`),_p=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??_s;fl(h,g,_);let{nodesInitialized:x}=rl(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=cc(Ns(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:_s,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bs.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Cs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gp,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:ys,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},vp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>pu((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await Ls({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{..._p({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=rl(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();fl(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=ll(e,n,r,i,a,o,l);d&&(el(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=Gc(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=cl(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(Qu(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n($u(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>ed(e,!0)));return}i(td(r,new Set([...e]),!0)),a(td(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>ed(e,!0)));return}a(td(n,new Set([...e]))),i(td(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(ed(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(ed(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,ed(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,ed(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(rl(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return ul({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Cs}})},updateConnection:e=>{p({connection:e})},reset:()=>p({..._p()})}},Object.is);function yp({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,X.useState)(()=>vp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,Y.jsx)(gu,{value:m,children:(0,Y.jsx)(pd,{children:(0,Y.jsx)(Rd,{children:p})})})}function bp({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,X.useContext)(hu)?(0,Y.jsx)(Y.Fragment,{children:e}):(0,Y.jsx)(yp,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var xp={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Sp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:R=ws.Bezier,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,deleteKeyCode:V=`Backspace`,selectionKeyCode:H=`Shift`,selectionOnDrag:U=!1,selectionMode:W=Ss.Full,panActivationKeyCode:G=`Space`,multiSelectionKeyCode:te=lc()?`Meta`:`Control`,zoomActivationKeyCode:ne=lc()?`Meta`:`Control`,snapToGrid:re,snapGrid:ie,onlyRenderVisibleElements:ae=!1,selectNodesOnDrag:K,nodesDraggable:oe,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,nodeOrigin:ue=Lu,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:q=!0,defaultViewport:pe=Ru,minZoom:me=.5,maxZoom:he=2,translateExtent:ge=_s,preventScrolling:_e=!0,nodeExtent:ve,defaultMarkerColor:ye=`#b1b1b7`,zoomOnScroll:be=!0,zoomOnPinch:xe=!0,panOnScroll:Se=!1,panOnScrollSpeed:Ce=.5,panOnScrollMode:we=xs.Free,zoomOnDoubleClick:Te=!0,panOnDrag:Ee=!0,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne=1,nodeClickDistance:Pe=0,children:Fe,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:J,onEdgeMouseLeave:He,reconnectRadius:Ue=10,onNodesChange:We,onEdgesChange:Ge,noDragClassName:Ke=`nodrag`,noWheelClassName:qe=`nowheel`,noPanClassName:Je=`nopan`,fitView:Ye,fitViewOptions:Xe,connectOnClick:Ze,attributionPosition:Qe,proOptions:$e,defaultEdgeOptions:et,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:nt=!1,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanOnSelection:ot=!0,autoPanSpeed:st,connectionRadius:ct,isValidConnection:lt,onError:ut,style:dt,id:ft,nodeDragThreshold:pt,connectionDragThreshold:mt,viewport:ht,onViewportChange:gt,width:_t,height:vt,colorMode:yt=`light`,debug:bt,onScroll:xt,ariaLabelConfig:St,zIndexMode:Ct=`basic`,...wt},Tt){let Et=ft||`1`,Dt=Wu(yt),Ot=(0,X.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),xt?.(e)},[xt]);return(0,Y.jsx)(`div`,{"data-testid":`rf__wrapper`,...wt,onScroll:Ot,style:{...dt,...xp},ref:Tt,className:Mt([`react-flow`,i,Dt]),id:ft,role:`application`,children:(0,Y.jsxs)(bp,{nodes:e,edges:t,width:_t,height:vt,fitView:Ye,fitViewOptions:Xe,minZoom:me,maxZoom:he,nodeOrigin:ue,nodeExtent:ve,zIndexMode:Ct,children:[(0,Y.jsx)(Hu,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:oe,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:q,elevateNodesOnSelect:tt,elevateEdgesOnSelect:nt,minZoom:me,maxZoom:he,nodeExtent:ve,onNodesChange:We,onEdgesChange:Ge,snapToGrid:re,snapGrid:ie,connectionMode:L,translateExtent:ge,connectOnClick:Ze,defaultEdgeOptions:et,fitView:Ye,fitViewOptions:Xe,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Je,nodeOrigin:ue,rfId:Et,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:ut,connectionRadius:ct,isValidConnection:lt,selectNodesOnDrag:K,nodeDragThreshold:pt,connectionDragThreshold:mt,onBeforeDelete:I,debug:bt,ariaLabelConfig:St,zIndexMode:Ct}),(0,Y.jsx)(hp,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,selectionKeyCode:H,selectionOnDrag:U,selectionMode:W,deleteKeyCode:V,multiSelectionKeyCode:te,panActivationKeyCode:G,zoomActivationKeyCode:ne,onlyRenderVisibleElements:ae,defaultViewport:pe,translateExtent:ge,minZoom:me,maxZoom:he,preventScrolling:_e,zoomOnScroll:be,zoomOnPinch:xe,zoomOnDoubleClick:Te,panOnScroll:Se,panOnScrollSpeed:Ce,panOnScrollMode:we,panOnDrag:Ee,autoPanOnSelection:ot,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne,nodeClickDistance:Pe,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:J,onEdgeMouseLeave:He,reconnectRadius:Ue,defaultMarkerColor:ye,noDragClassName:Ke,noWheelClassName:qe,noPanClassName:Je,rfId:Et,disableKeyboardA11y:rt,nodeExtent:ve,viewport:ht,onViewportChange:gt}),(0,Y.jsx)(Iu,{onSelectionChange:k}),Fe,(0,Y.jsx)(Au,{proOptions:$e,position:Qe}),(0,Y.jsx)(Du,{rfId:Et,disableKeyboardA11y:rt})]})})}var Cp=cd(Sp),wp=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Tp({children:e}){let t=$(wp);return t?(0,ft.createPortal)(e,t):null}function Ep(e){let[t,n]=(0,X.useState)(e);return[t,n,(0,X.useCallback)(e=>n(t=>Qu(e,t)),[])]}var Dp=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(let[,{internals:e}]of t.nodeLookup)if(e.handleBounds===void 0||!fc(e.userNode))return!1;return!0};function Op(e={includeHiddenNodes:!1}){return $(Dp(e))}gs.error014();function kp({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,Y.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Mt([`react-flow__background-pattern`,n,r])})}function Ap({radius:e,className:t}){return(0,Y.jsx)(`circle`,{cx:e,cy:e,r:e,className:Mt([`react-flow__background-pattern`,`dots`,t])})}var jp;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(jp||={});var Mp={[jp.Dots]:1,[jp.Lines]:1,[jp.Cross]:6},Np=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Pp({id:e,variant:t=jp.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,X.useRef)(null),{transform:f,patternId:p}=$(Np,mu),m=r||Mp[t],h=t===jp.Dots,g=t===jp.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,Y.jsxs)(`svg`,{className:Mt([`react-flow__background`,l]),style:{...c,...xd,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,Y.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,Y.jsx)(Ap,{radius:y/2,className:u}):(0,Y.jsx)(kp,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,Y.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}Pp.displayName=`Background`;var Fp=(0,X.memo)(Pp);function Ip(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,Y.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function Lp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,Y.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function Rp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,Y.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 zp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 Bp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 Vp({children:e,className:t,...n}){return(0,Y.jsx)(`button`,{type:`button`,className:Mt([`react-flow__controls-button`,t]),...n,children:e})}var Hp=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Up({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=vu(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(Hp,mu),{zoomIn:y,zoomOut:b,fitView:x}=gd();return(0,Y.jsxs)(Ou,{className:Mt([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Vp,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,Y.jsx)(Ip,{})}),(0,Y.jsx)(Vp,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,Y.jsx)(Lp,{})})]}),n&&(0,Y.jsx)(Vp,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,Y.jsx)(Rp,{})}),r&&(0,Y.jsx)(Vp,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,Y.jsx)(Bp,{}):(0,Y.jsx)(zp,{})}),u]})}Up.displayName=`Controls`;var Wp=(0,X.memo)(Up);function Gp({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,Y.jsx)(`rect`,{className:Mt([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var Kp=(0,X.memo)(Gp),qp=e=>e.nodes.map(e=>e.id),Jp=e=>e instanceof Function?e:()=>e;function Yp({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Kp,onClick:o}){let s=$(qp,mu),c=Jp(t),l=Jp(e),u=Jp(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,Y.jsx)(Y.Fragment,{children:s.map(e=>(0,Y.jsx)(Zp,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function Xp({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=dc(r);return{node:r,x:i,y:a,width:o,height:s}},mu);return!l||l.hidden||!fc(l)?null:(0,Y.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var Zp=(0,X.memo)(Xp),Qp=(0,X.memo)(Yp),$p=200,em=150,tm=e=>!e.hidden,nm=e=>{let 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?Xs(Ns(e.nodeLookup,{filter:tm}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},rm=`react-flow__minimap-desc`;function im({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=vu(),S=(0,X.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(nm,mu),j=e?.width??$p,M=e?.height??em,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,z=C.x-(I-C.width)/2-R,B=C.y-(L-C.height)/2-R,ee=I+R*2,V=L+R*2,H=`${rm}-${T}`,U=(0,X.useRef)(0),W=(0,X.useRef)();U.current=F,(0,X.useEffect)(()=>{if(S.current&&E)return W.current=kl({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>U.current}),()=>{W.current?.destroy()}},[E]),(0,X.useEffect)(()=>{W.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let G=p?e=>{let[t,n]=W.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,te=m?(0,X.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ne=_??A[`minimap.ariaLabel`];return(0,Y.jsx)(Ou,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F: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 o==`number`?o:void 0},className:Mt([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,Y.jsxs)(`svg`,{width:j,height:M,viewBox:`${z} ${B} ${ee} ${V}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":H,ref:S,onClick:G,children:[ne&&(0,Y.jsx)(`title`,{id:H,children:ne}),(0,Y.jsx)(Qp,{onClick:te,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,Y.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${z-R},${B-R}h${ee+R*2}v${V+R*2}h${-ee-R*2}z + M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}im.displayName=`MiniMap`;var am=(0,X.memo)(im),om=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,sm={[Wl.Line]:`right`,[Wl.Handle]:`bottom-right`};function cm({nodeId:e,position:t,variant:n=Wl.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=Fd(),y=typeof e==`string`?e:v,b=vu(),x=(0,X.useRef)(null),S=n===Wl.Handle,C=$((0,X.useCallback)(om(S&&p),[S,p]),mu),w=(0,X.useRef)(null),T=t??sm[n];(0,X.useEffect)(()=>{if(!(!x.current||!y))return w.current||=tu({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=cl([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...pc({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,Y.jsx)(`div`,{className:Mt([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,X.memo)(cm);function lm({path:e,delay:t,padding:n=24,children:r}){let i=`map-growth-${(0,X.useId)().replace(/:/g,``)}`;if(t==null)return(0,Y.jsx)(Y.Fragment,{children:r});let a=(e.match(/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/gi)??[]).map(Number),o=a.filter((e,t)=>t%2==0),s=a.filter((e,t)=>t%2==1);if(!o.length||!s.length)return(0,Y.jsx)(Y.Fragment,{children:r});let c=Math.min(...o)-n,l=Math.min(...s)-n;return(0,Y.jsxs)(`g`,{"data-map-growing-edge":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`mask`,{id:i,maskUnits:`userSpaceOnUse`,x:c,y:l,width:Math.max(...o)-c+n,height:Math.max(...s)-l+n,children:(0,Y.jsx)(`path`,{className:`map-growth-mask`,d:e,pathLength:1,fill:`none`,stroke:`white`,strokeWidth:n*2,strokeLinecap:`round`,style:{animationDelay:`${t}ms`}})})}),(0,Y.jsx)(`g`,{mask:`url(#${i})`,children:r})]})}function um({layout:e,growing:t={},activeStep:n,activeTeamSteps:r=[]}){let i=`submap-arrow-${(0,X.useId)().replace(/:/g,``)}`;return(0,Y.jsxs)(`svg`,{className:`submap-relations`,width:e.width,height:e.height,"aria-label":`Task process relationships`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`marker`,{id:i,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6.5`,markerHeight:`6.5`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,fill:`var(--map-edge-context, #6f8ca8)`})})}),e.links.map(a=>{let o=e.positions[a.source],s=e.positions[a.target],c=o.x===s.x&&s.y>o.y,l=o.x+(c?116:232),u=o.y+(c?180:90),d=s.x+(c?116:0),f=s.y+(c?0:90),p=(l+d)/2,m=(u+f)/2,h=c?`M ${l} ${u} L ${d} ${f}`:`M ${l} ${u} C ${p} ${u}, ${p} ${f}, ${d} ${f}`;return(0,Y.jsxs)(`g`,{"data-testid":`submap-relation`,"data-relation":a.relation,"data-source":a.source,"data-target":a.target,"aria-label":`${a.label}: ${a.explanation}`,children:[(0,Y.jsx)(`title`,{children:a.explanation}),(0,Y.jsx)(lm,{path:h,delay:t[a.id],children:(0,Y.jsx)(`path`,{className:`submap-relation-path`,d:h,fill:`none`,stroke:`var(--map-edge-context, #6f8ca8)`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeDasharray:a.contextual?`5 6`:void 0,markerEnd:`url(#${i})`})}),(n===a.target||r.includes(a.target))&&(0,Y.jsx)(`path`,{className:`submap-flow`,d:h,pathLength:1,fill:`none`,stroke:`#4b9cae`,strokeWidth:`3`,strokeDasharray:`.09 .91`,strokeLinecap:`round`,"aria-hidden":`true`}),(0,Y.jsxs)(`g`,{className:`submap-relation-label`,transform:`translate(${p}, ${m})`,children:[(0,Y.jsx)(`rect`,{x:`-38`,y:`-11`,width:`76`,height:`22`,rx:`6`}),(0,Y.jsx)(`text`,{textAnchor:`middle`,dominantBaseline:`central`,children:a.label})]})]},a.id)})]})}function dm({role:e,since:t,zh:n,text:r}){let[i,a]=(0,X.useState)(()=>Date.now()/1e3);(0,X.useEffect)(()=>{if(t==null||r)return;let e=setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(e)},[t,r]);let o=t==null?null:jt(i-t,n);return(0,Y.jsxs)(`div`,{className:`map-card-live`,"data-testid":`map-card-live`,"data-waiting":!!r||void 0,"aria-live":`off`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{title:r,children:r||(0,Y.jsxs)(Y.Fragment,{children:[Oe(e,n),o?n?` · 本次已进行 ${o}`:` · ${o} this run`:``]})})]})}var fm=(0,X.createContext)({notes:{}}),pm=(0,X.createContext)({}),mm={plan:[`计划`,`Plan`],execution:[`动手处理`,`Work`],review:[`检查结果`,`Check`],revision:[`修订`,`Revise`],result:[`结果`,`Result`]},hm={plan:E,execution:D,review:m,revision:ct,result:K},gm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],review_unavailable:[`这次结果检查没有完成`,`Result check did not finish`],held:[`工作暂停,后续尚未安排`,`Work paused; no next step scheduled`],aborted:[`已取消`,`Cancelled`],cancelled:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已被新计划替代`,`Replaced by a new plan`],question:[`等待答复`,`Waiting for an answer`],paused:[`已暂停`,`Paused`],paused_external_work:[`等待后台任务`,`Waiting on background work`],missing:[`记录中缺失`,`Not in this record`],unknown:[`状态未知`,`Unknown`],continue:[`需再改一轮`,`Another pass needed`],blocked:[`受阻`,`Held up`],started:[`进行中`,`Under way`],recorded:[`已记录`,`On record`],requested:[`修改建议`,`Requested`],replan:[`需要调整计划`,`Plan needs adjusting`],replan_requested:[`需要调整计划`,`Plan needs adjusting`]},_m={plan:[`接下来要做什么,为什么这样做`,`What to do next and why`],execution:[`实际做了什么,遇到了什么问题`,`What was done and what happened`],review:[`结果是否正确,有什么依据`,`Whether the result is correct and what supports it`],revision:[`检查后发现需要修改的地方`,`What the check found needs changing`],result:[`这项任务最后得到了什么`,`What the task produced in the end`]},vm={plan:[`提问`,`Asked`],execution:[`Argus 查证`,`Argus`],review:[`核对`,`Check`],revision:[`修订`,`Revise`],result:[`回答`,`Answer`]},ym={plan:[`你提出的要求`,`What you asked for`],execution:[`Argus 自己动手查证、运行命令`,`Argus did the work itself: read, searched, ran commands`],review:[`对结果的核对`,`A check of the result`],revision:[`需要修改的地方`,`What had to change`],result:[`Argus 给出的回答`,`What Argus answered`]},bm=(e,t)=>e.source===`team`?t?`子任务工作记录`:`Subtask work record`:e.source===`task`?t?`任务记录`:`Task record`:e.source===`interval`?t?`根据同期记录关联`:`By execution window`:t?`来自任务记录`:`Linked event`,xm=(0,X.memo)(function({id:e,data:t}){let{task:n,ordinal:r,zh:i,layout:a,focused:o,detailed:s}=t,{artifacts:c,onOpenArtifact:l}=(0,X.useContext)(pm),u=(0,X.useContext)(fm).notes[n.id]??[],[d]=(0,X.useState)(()=>!!t.revealing||!t.restoring&&!t.seenCards?.has(e));(0,X.useEffect)(()=>{t.seenCards?.add(e)},[t.seenCards,e]);let[f,p]=(0,X.useState)(null),m=f||a,h=e=>e.source===`team`&&a.steps.find(t=>t.id===e.id)||e,_=t.canvasSize?.width||window.innerWidth,y=t.canvasSize?.height||window.innerHeight;(0,X.useEffect)(()=>{s||(x(null),p(null),t.readCopy?.(e,null))},[s]);let[b,x]=(0,X.useState)(null),S=(0,X.useRef)(n.status),[w,T]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=S.current!==n.status;if(S.current=n.status,!e||n.status!==`done`||t.completionScope)return;T(!0);let r=setTimeout(()=>T(!1),1500);return()=>clearTimeout(r)},[n.status,t.completionScope]);let E=m.steps.find(e=>e.id===b),D=E?h(E):void 0,O=D?.updatedAt??D?.ts,k=t.part===t.partCount,A=!k||t.completionScope?`recorded`:n.status===`missing`?`missing`:t.paused&&ge.has(n.status)?`paused`:Ve(n),j=A===`paused`&&n.status===`paused_external_work`?n.status:A,M=Math.min(t.frame.width/288,t.frame.height/280),N=t.copy?.cards||{},P=!!N[n.id]?.summary&&N[n.id]?.task_status!==n.status&&(ge.has(n.status)||n.status===`pending`),I=e=>{if(e.completionScope||e.status===`review_unavailable`)return;let t=N[e.id];if(e.source!==`team`)return t;let n=t?.event_ids?.indexOf(e.id)??-1;return h(e).revision&&n>=0&&t?.event_revisions?.[n]===h(e).revision?t:void 0},L=n.kind===`turn`?void 0:t.words,R=(t.completionScope?``:N[n.id]?.title)||L?.title||n.title,z=i?`环节 ${t.start}–${t.end} / ${t.totalSteps}`:`Steps ${t.start}–${t.end} / ${t.totalSteps}`,B=t.partCount>1&&!k?m.steps.map(e=>I(e)?.summary||h(e).summary||h(e).detail).filter(e=>e&&![q(!0),q(!1)].includes(e)).at(-1):void 0,ee=k&&n.objective&&n.objective.trim()!==n.title.trim(),V=A===`review_unavailable`?i?`当次审查器未能给出判断,未形成审阅结论。`:`The Reviewer could not return a judgment on this attempt.`:(t.completionScope?``:N[n.id]?.summary)||L?.summary||``,H=(k?n.pending_question:``)||B||V||t.completionScope||n.pending_question||G(n.summary||``,i).summary||n.summary||(ee?``:n.objective),U=Math.min(t.frame.width/m.width,t.frame.height/m.height),W=k&&t.live&&ge.has(n.status)?[...m.steps].reverse().find(e=>e.source!==`team`&&![`plan`,`result`].includes(e.kind))?.id:null,te=t.paused?null:W,ne=a.steps.filter(e=>e.source===`team`),re=t.live?ne.filter(e=>ge.has(e.status)).map(e=>e.id):[],ae=ne.filter(e=>e.status===`done`).length,K=ne.filter(e=>ge.has(e.status)).length,oe=(i?`子任务 ${ae}/${ne.length} 完成 · ${K} 进行中`:`Subtasks ${ae}/${ne.length} done · ${K} running`)+((t.plannedWidth??0)>ne.length?i?` · 计划并行 ×${t.plannedWidth}`:` · planned ×${t.plannedWidth}`:``),se=e=>e.source===`team`?re.includes(e.id):te===e.id,ce=e=>e.source===`team`?h(e).status:W===e.id?t.paused?`paused`:`running`:e.status,le=e=>({source:t.source,task_id:n.id,task_title:R,lang:i?`zh`:`en`,part:t.partCount>1?t.part:void 0,step_id:e?.id,step_title:e?.title,team_id:e?.teamId,team_task_id:e?.teamTaskId,event_ids:e?e.eventIds:t.partCount>1?[...new Set(m.steps.flatMap(e=>e.eventIds))]:N[n.id]?.event_ids||[]}),ue=Math.min(640,m.width-48,Math.max(260,(_-50)/1.05)),de=Math.min(600,m.height-48,Math.max(300,(y-(_<640?180:160))/1.05)),fe=e=>({x:Math.max(24,Math.min(m.positions[e.id].x-16,m.width-ue-24)),y:Math.max(24,Math.min(m.positions[e.id].y-16,m.height-de-24)),width:ue,height:de,scale:U}),pe=D?fe(D):null,me=n=>{p(m),x(n.id),t.readCopy?.(e,n.id),t.readStep(e,fe(n))};(0,X.useEffect)(()=>{D&&t.readStep(e,fe(D))},[_,y]);let he=e=>(gm[e===`paused_external_work`?e:e.startsWith(`paused_`)?`paused`:ge.has(e)?`running`:e]??gm.unknown)[+!i],_e=t.completionScope?i?`当次结束 · 当时目标未完成`:`Execution ended · goal incomplete then`:n.turn_kind===`qa`&&[`done`,`running`,`cancelled`,`failed`].includes(A)?{done:[`已回答`,`Answered`],running:[`正在回答`,`Answering`],cancelled:[`已中断`,`Interrupted`],failed:[`回答失败`,`Answer failed`]}[A][+!i]:he(j);return(0,Y.jsxs)(`article`,{className:`map-macro map-state-${A}`,"data-testid":`map-macro`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,"data-history":!k,"data-has-history":!!t.historyCount,"data-arrive":!!t.arriving||d&&!!t.revealing,"data-lit":!!t.lit,"data-hovered":!!t.hovered,"data-growing":t.growthDelay!=null,"data-dispatch":t.dispatchState,style:{animationDelay:`${t.growthDelay??(t.arriving?kt(r):0)}ms`},"data-focused":o,"data-detailed":s,"aria-label":R,"data-completed-now":w,"data-active":re.length>0||k&&t.live&&!t.paused&&ge.has(n.status),onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(),{x:e.clientX,y:e.clientY})},children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(Ud,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsxs)(`div`,{className:`macro-summary`,"aria-hidden":s,style:{"--summary-height":`${t.frame.height/M-20}px`,width:t.frame.width/M-20,transform:`translate(-50%, -50%) scale(${M})`},children:[(0,Y.jsxs)(`button`,{className:`map-card map-state-${A} nodrag nopan`,"data-testid":`map-card`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,tabIndex:s?-1:0,onClick:()=>n.turn_kind===`qa`&&t.readCopy?t.readCopy(e,n.id):t.open(e),"aria-label":`${R} · ${n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`放大任务`:`Explore task`}`,children:[(0,Y.jsxs)(`div`,{className:`map-card-top`,children:[(0,Y.jsxs)(`span`,{className:`map-card-number`,children:[n.turn_kind===`qa`?i?`问答`:`Q&A`:k?i?`任务`:`MISSION`:i?`历史`:`HISTORY`,` `,String(r).padStart(2,`0`),!k&&` · ${t.part}/${t.partCount}`]}),(A!==`recorded`||t.completionScope)&&(0,Y.jsxs)(`span`,{className:`map-status`,children:[A===`done`?(0,Y.jsx)(g,{size:11}):A===`failed`?(0,Y.jsx)(v,{size:11}):A===`review_unavailable`?(0,Y.jsx)(tt,{size:11}):A===`question`?(0,Y.jsx)(Ne,{size:11}):A===`paused`||A===`held`?(0,Y.jsx)(et,{size:11}):(0,Y.jsx)(`span`,{className:`map-state-dot`}),_e]})]}),(0,Y.jsxs)(`h3`,{children:[(0,Y.jsx)(Ae,{children:R}),u.length>0&&(0,Y.jsx)(`span`,{className:`macro-note-badge`,title:i?`操作员批注`:`Operator notes`,children:u.length})]}),ee&&!V&&(0,Y.jsx)(`p`,{className:`map-card-objective`,title:n.objective,children:n.objective}),H&&H.trim()!==(ee?n.objective.trim():``)&&(0,Y.jsx)(`div`,{className:`map-card-copy`,children:(0,Y.jsx)(Ae,{children:H})}),t.conclusion&&(0,Y.jsx)(`p`,{className:`map-card-conclusion`,"data-testid":`map-card-conclusion`,title:t.conclusion,children:t.conclusion}),n.kind!==`turn`&&(0,Y.jsx)(`div`,{className:`map-card-course`,"aria-label":i?`任务经过`:`Course of the task`,children:[`plan`,`execution`,`review`,`result`].map(e=>{let t=hm[e],n=m.steps.some(t=>t.kind===e),r=m.steps.some(t=>t.kind===e&&se(t)),a=i?{plan:`规划`,execution:`执行`,review:`审查`,result:`交付`}[e]:mm[e][1];return(0,Y.jsxs)(`span`,{className:`submap-kind-${e}`,"data-present":n,"data-active":r,title:a,children:[(0,Y.jsx)(t,{size:12,"aria-hidden":!0}),(0,Y.jsx)(`b`,{children:a})]},e)})}),(()=>{let e=k&&t.live&&t.waiting,r=!e&&k&&t.live&&!t.paused&&ge.has(n.status),a=A!==`recorded`||!!t.completionScope,o=!!t.historyCount&&ne.length>0;return!r&&!e&&k&&a&&!o?null:(0,Y.jsxs)(`div`,{className:`map-card-stages`,children:[e?(0,Y.jsx)(dm,{text:t.waiting,zh:i}):r?(0,Y.jsx)(dm,{role:t.phase??n.role,since:n.started_ts,zh:i}):k&&a?null:(0,Y.jsx)(`span`,{className:`map-card-recorded`,children:k?_e:i?`历史记录 · 非当前执行`:`History · not current execution`}),o&&(0,Y.jsx)(`span`,{className:`map-card-team-summary`,children:oe})]})})(),k&&ne.length>0&&(0,Y.jsx)(`span`,{className:`map-card-teambar`,"aria-hidden":!0,children:(0,Y.jsx)(`i`,{style:{width:`${Math.round(ae/ne.length*100)}%`}})}),(0,Y.jsxs)(`div`,{className:`map-card-bottom`,children:[(0,Y.jsx)(`span`,{className:ne.length?`map-card-team-summary`:void 0,title:z,children:n.turn_kind===`qa`?i?`问题与回答`:`Question and answer`:t.historyCount?``:ne.length?oe:t.plannedWidth&&ge.has(n.status)?i?`并行编队 ×${t.plannedWidth} 展开中`:`Fanning out ×${t.plannedWidth}`:t.partCount>1?z:`${m.steps.length} ${i?`个环节`:`steps`}`}),(0,Y.jsxs)(`span`,{className:`map-card-submap-hint`,children:[P?i?`描述更新中`:`Summary updating`:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`查看进展`:`View progress`,(0,Y.jsx)(ie,{size:12})]})]})]}),!!t.historyCount&&t.toggleHistory&&(0,Y.jsxs)(`button`,{type:`button`,className:`map-history-toggle nodrag nopan`,"aria-expanded":t.historyExpanded,"aria-label":`${i?`任务历史`:`Mission history`}: ${R}`,title:i?`保留全部 ${t.totalSteps} 个环节`:`All ${t.totalSteps} steps retained`,onClick:()=>t.toggleHistory?.(n.id),children:[t.historyExpanded?i?`收起历史`:`Hide history`:`${i?`历史`:`History`} ${t.historyCount}`,(0,Y.jsx)(ie,{size:12})]})]}),o&&(0,Y.jsxs)(`div`,{className:`macro-detail ${D?`is-reading`:``}`,"data-stacked":m.stacked||void 0,"aria-hidden":!s,style:{width:m.width,height:m.height,transform:`scale(${U})`,transformOrigin:`top left`},children:[(0,Y.jsxs)(`header`,{className:`macro-heading`,children:[(0,Y.jsx)(`span`,{className:`macro-index`,children:String(r).padStart(2,`0`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`small`,{children:t.partCount>1?i?`第 ${t.part} / ${t.partCount} 部分`:`Part ${t.part} / ${t.partCount}`:n.turn_kind===`qa`?i?`问答内容`:`Q&A`:i?`任务内部`:`INSIDE THIS TASK`}),(0,Y.jsx)(`h2`,{children:(0,Y.jsx)(Ae,{children:R})})]}),t.conclusion&&(0,Y.jsx)(`span`,{className:`macro-conclusion`,"data-testid":`macro-conclusion`,title:t.conclusion,children:t.conclusion}),(A!==`recorded`||t.completionScope)&&(0,Y.jsx)(`span`,{className:`macro-state`,title:t.completionScope,children:_e}),s&&k?(0,Y.jsx)(C,{"data-testid":`map-task-read`,className:`nodrag nopan text-xs`,onClick:()=>{if(n.turn_kind===`qa`){t.readCopy?.(e,n.id);return}x(null),p(null),t.readCopy?.(e,n.id)},children:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`阅读任务说明`:`Read task explanation`}):null]}),(0,Y.jsx)(`div`,{className:`macro-stage-key`,children:F.filter(e=>n.kind!==`turn`||m.steps.some(t=>t.kind===e)).map(e=>(0,Y.jsx)(`span`,{className:`submap-kind-${e} ${m.steps.some(t=>t.kind===e)?``:`is-unrecorded`}`,title:n.kind===`turn`?ym[e][+!i]:_m[e][+!i],children:n.kind===`turn`?vm[e][+!i]:mm[e][+!i]},e))}),u.length>0&&(0,Y.jsxs)(`aside`,{className:`macro-notes`,"aria-label":i?`操作员批注`:`Operator notes`,children:[(0,Y.jsx)(`small`,{children:i?`批注`:`Notes`}),u.map(e=>(0,Y.jsx)(`p`,{children:e.text},e.id))]}),(0,Y.jsx)(um,{layout:m,growing:t.growingLinks,activeStep:te,activeTeamSteps:re}),m.columns.map(e=>(0,Y.jsx)(`div`,{className:`macro-column-label`,style:{left:e.x,top:e.y},children:e.title},e.id)),m.steps.map((e,r)=>{let a=h(e),o=hm[a.kind];return(0,Y.jsxs)(`button`,{className:`submap-step submap-kind-${a.kind} nodrag nopan ${b===a.id?`is-selected`:``}`,"data-testid":`submap-step`,"data-step-id":a.id,"data-source":a.source,"data-team-id":a.teamId,"data-team-task-id":a.teamTaskId,"data-status":ce(a),"data-active":se(a),"data-growing":t.growingSteps?.[a.id]!=null,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(a),{x:e.clientX,y:e.clientY})},style:{animationDelay:`${t.growingSteps?.[a.id]??0}ms`,"--step-index":r,left:m.positions[a.id].x,top:m.positions[a.id].y},tabIndex:s?0:-1,onClick:()=>me(a),"aria-expanded":b===a.id,children:[(0,Y.jsxs)(`div`,{className:`submap-step-meta`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(o,{size:16}),a.source===`team`?i?`子任务 · `:`Subtask · `:``,(n.kind===`turn`?vm:mm)[a.kind][+!i],a.round!=null&&(0,Y.jsx)(`em`,{className:`submap-round`,children:i?`第 ${a.round} 轮`:`Round ${a.round}`})]}),(0,Y.jsx)(`small`,{"data-verdict":a.source===`team`&&Se(h(a).teamOutcome)||void 0,children:a.completionScope&&a.status===`recorded`?i?`执行结束`:`Execution ended`:a.source===`team`&&ce(a)===`failed`?i?`失败`:`Failed`:a.source===`team`&&Le(h(a).teamOutcome,i)||he(ce(a))})]}),(0,Y.jsx)(`h4`,{children:(0,Y.jsx)(Ae,{children:a.title})}),(0,Y.jsx)(`div`,{className:`submap-step-copy`,children:(0,Y.jsx)(Ae,{children:I(a)?.summary||h(a).summary||a.detail||q(i)})}),(0,Y.jsxs)(`div`,{className:`submap-step-foot`,children:[(0,Y.jsxs)(`span`,{title:bm(a,i),children:[i?`查看详情`:`Read more`,a.workCount?(0,Y.jsx)(`em`,{className:`submap-step-work`,children:i?` · ${a.workCount} 步操作`:` · ${a.workCount} actions`}):null]}),(0,Y.jsx)(ie,{size:14})]})]},a.id)}),t.partCount>1&&!D&&(0,Y.jsxs)(`nav`,{className:`macro-part-nav nodrag nopan`,"aria-label":i?`任务各部分`:`Task parts`,children:[(0,Y.jsx)(`span`,{children:z}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{disabled:!t.previousId,onClick:()=>t.previousId&&t.open(t.previousId,!0),children:[(0,Y.jsx)(rt,{size:14}),i?`上一部分`:`Previous part`]}),(0,Y.jsxs)(`button`,{disabled:!t.nextId,onClick:()=>t.nextId&&t.open(t.nextId,!0),children:[i?`下一部分`:`Next part`,(0,Y.jsx)(ie,{size:14})]})]})]}),D&&pe&&(0,Y.jsxs)(`section`,{className:`macro-reader nodrag nopan nowheel`,"data-testid":`map-reader`,"data-kind":D.kind,role:`region`,"aria-label":i?`卡片详情`:`Card details`,style:{left:pe.x,top:pe.y,width:pe.width,height:pe.height},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(D),{x:e.clientX,y:e.clientY})},children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsxs)(`span`,{children:[(n.kind===`turn`?vm:mm)[D.kind][+!i],n.turn_kind!==`qa`&&(0,Y.jsx)(`small`,{className:`macro-reader-note`,children:_m[D.kind][+!i]})]}),(0,Y.jsx)(`button`,{"aria-label":`Close step details`,onClick:()=>{x(null),p(null),t.readCopy?.(e,null),t.open(e)},children:(0,Y.jsx)(v,{size:20})})]}),(0,Y.jsx)(`h3`,{children:(0,Y.jsx)(Ae,{children:I(D)?.title||D.title})}),(0,Y.jsx)(`div`,{className:`macro-reader-body`,children:(0,Y.jsx)(ye,{cardKey:D.id,taskId:n.id,card:I(D),task:n,readOnly:t.readOnly,originalDetail:D.detail||q(i),selection:t.readerCopy,artifacts:c,onOpenArtifact:l})}),(0,Y.jsxs)(`footer`,{children:[(0,Y.jsx)(`span`,{title:bm(D,i),children:O?new Date(O*1e3).toLocaleString(i?`zh-CN`:`en-US`):``}),!t.readOnly&&(0,Y.jsx)(`button`,{onClick:()=>t.quote(le(D)),children:i?`引用此项`:`Reference`})]})]})]})]})});function Sm(e){if(!(e>0)||!Number.isFinite(e))return e;let t=Math.floor(Math.log2(e)*4+1e-9)/4;return Math.round(2**t*1e4)/1e4}function Cm(e,t){let n=Sm(t);if(e==null||!(e>0))return n;let r=Math.log2(t/e)*4;return r<-2||r>=3?n:e}function wm(){let e=null,t=new Set;return{get:()=>e,set(n){n!==e&&(e=n,t.forEach(e=>e()))},subscribe(e){return t.add(e),()=>void t.delete(e)}}}var Tm=(0,X.createContext)(null),Em=()=>()=>{};function Dm(e){let t=(0,X.useContext)(Tm),n=()=>{let n=t?.get();return n==null?null:e(n)},r=(0,X.useSyncExternalStore)(t?t.subscribe:Em,n,n),i=$(t=>r===null?e(Sm(t.transform[2])):null);return r??i}function Om(e){let t={};for(let n of e)(t[n.node_id]??=[]).push(n);for(let e of Object.values(t))e.sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));return t}var km={width:640,height:190},Am={width:1440,height:640},jm={"idea-route":lt,"idea-review":m,"idea-selector":ot},Mm={done:`✓`,failed:`✕`,question:`?`,paused:`‖`,running:`▶`,superseded:`↪`},Nm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],question:[`待答复`,`Needs input`],paused:[`已暂停`,`Paused`],aborted:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已替代`,`Superseded`],unknown:[`已记录`,`Recorded`]},Pm=(0,X.memo)(function({data:e}){let{task:t,zh:n,fanIndex:r,fanCount:i}=e,a=Ve(t),o=t.group,s=o?B:t.overflow_count?Fe:jm[t.team_role??``]??E,c=o?``:Le(t.team_outcome,n),l=o?``:Se(t.team_outcome),u=c||(Nm[a]??Nm.unknown)[+!n],d=l===`rejected`?`✕`:l===`chosen`?`★`:Mm[a],f=!o&&typeof r==`number`&&typeof i==`number`,p=o?.expanded?n?`收起`:`Fold`:n?`展开`:`Unfold`;return(0,Y.jsxs)(`button`,{type:`button`,className:`map-branch map-state-${a}${o?` map-branch-group`:``} nodrag nopan`,"data-testid":`map-branch`,"data-branch-id":t.id,"data-status":a,"data-verdict":l||void 0,"data-overflow":!!t.overflow_count,"data-group":!!o,"data-expanded":o?o.expanded:void 0,"aria-expanded":o?o.expanded:void 0,title:t.excerpt||t.objective||t.title,"aria-label":o?`${t.title} · ${p}`:`${t.title} · ${u} · ${n?`打开所属任务`:`Open the owning task`}`,onClick:()=>o?e.toggleGroup?.(t.id):e.open(e.parentCardId),children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(Ud,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsx)(`span`,{className:`map-branch-glyph`,"aria-hidden":`true`,children:(0,Y.jsx)(s,{})}),d&&(0,Y.jsx)(`span`,{className:`map-branch-state`,"aria-hidden":`true`,children:d}),(0,Y.jsx)(`span`,{className:`map-branch-title`,children:t.title}),c&&(0,Y.jsx)(`span`,{className:`map-branch-verdict`,"data-testid":`map-branch-verdict`,children:c}),f&&(0,Y.jsx)(`span`,{className:`map-branch-fan`,"data-testid":`map-branch-fan`,title:n?`并行分支 ${r} / ${i}`:`Parallel branch ${r} of ${i}`,children:`${r}/${i}`}),o&&(0,Y.jsxs)(`span`,{className:`map-branch-toggle`,"data-testid":`map-branch-toggle`,"aria-hidden":`true`,children:[p,o.expanded?(0,Y.jsx)(h,{}):(0,Y.jsx)(ie,{})]}),(0,Y.jsx)(`span`,{className:`map-branch-dot`,"aria-hidden":`true`})]})}),Fm={x:52,y:125,zoom:.24},Im=.01,Lm=3.5,Rm=(e,t,n)=>Math.max(t,Math.min(n,e));function zm(e,t){let n=e.querySelector(t)?.getBoundingClientRect();return n&&n.width>0&&n.height>0?n:void 0}function Bm(e,t=!1){let n=e.getBoundingClientRect(),r=zm(e,`.map-canvas-toolbar`),i=zm(e,`.map-composer-dock`),a=zm(e,`.react-flow__minimap`),o=zm(e,`.map-legend`),s=zm(e,`.react-flow__controls`),c=e.dataset.reading===`true`||t&&e.clientWidth<640,l=e.clientWidth<640?20:50,u=Math.max(r?r.bottom-n.top+20:85,!c&&e.clientWidth<640&&o?o.bottom-n.top+16:0,!c&&e.clientWidth<640&&s?s.bottom-n.top+16:0),d=Math.max(i?n.bottom-i.top+24:100,!c&&a?n.bottom-a.top+20:0);return{x:l,y:u,width:Math.max(180,e.clientWidth-l*2),height:Math.max(100,e.clientHeight-u-d)}}var Vm=.72,Hm=.85,Um=(e,t)=>e?0:t;function Wm(e,t,n){let r=Math.min(t.width/n.width,t.height/n.height),i=Math.min(e.width,e.height)/Math.min(n.width,n.height);return Math.min(Math.max(r,Vm*i),Hm*i)}function Gm(e,t,n,r,i){let a=r||1;if(e.width<640&&i?.stacked&&i.width>0)return t.width/(i.width*a);let o=Wm(e,t,n),s=e.width<640||(i?.steps.length??0)>20?.6/a:0,c=e.width>=1024?1/a:0;return Math.max(o,s,c)}function Km(e,t,n){let r=Rm(Math.min(t.width/(n.width+160),t.height/(n.height+160)),Im,.27),i=(e,t,n,r)=>r>t?(n-r)/2:Rm((n-r)/2,e,e+t-r);return{x:i(t.x,t.width,e.width,n.width*r)-n.x*r,y:i(t.y,t.height,e.height,n.height*r)-n.y*r,zoom:r}}function qm(e,t,n){let r=Math.min(48,e.height*.35),i=e.height-r,a=Math.min(Lm,Math.min(1.05,e.width/n.width,i/n.height)/n.scale);return{x:e.x+e.width/2-(t.x+(n.x+n.width/2)*n.scale)*a,y:e.y+r+i/2-(t.y+(n.y+n.height/2)*n.scale)*a,zoom:a}}function Jm(e,t=!0){let n=gd(),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)({width:0,height:0}),l=(0,X.useRef)(null),u=(0,X.useRef)(!1),d=(0,X.useRef)(!1),f=(0,X.useRef)(!1),p=(0,X.useRef)(),m=(0,X.useRef)(()=>{}),h=(0,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.useRef)(()=>{}),v=(0,X.useRef)(()=>{}),[y,b]=(0,X.useState)(()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),x=(0,X.useRef)(Fm),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null),T=(0,X.useRef)(0),E=(0,X.useRef)(null),D=(0,X.useRef)(0);(0,X.useEffect)(()=>()=>window.clearTimeout(D.current),[]);let[O]=(0,X.useState)(wm),k=(0,X.useCallback)((e,t)=>{O.get()!==t&&(e.style.setProperty(`--map-zoom-step`,String(t)),O.set(t))},[O]),A=(0,X.useCallback)(()=>{cancelAnimationFrame(T.current),T.current=0,E.current=null},[]),j=(0,X.useCallback)((t,r)=>{t&&(f.current=!1,d.current=!1);let a=e.current;if(!a)return;a.dataset.moving||(a.dataset.moving=`true`),window.clearTimeout(D.current),D.current=window.setTimeout(()=>{delete a.dataset.moving,k(a,Sm(n.getZoom()))},180);let s={x:a.clientWidth/2,y:a.clientHeight/2},c=S.current&&S.current.until>performance.now()?S.current:s,p=C.current??(u.current?h.current:null)??V(n.getNodes().filter(e=>e.data.frame),r,c,s),m=p&&(n.getNode(p)?.data)?.frame?.scale||1,g=Rm((r.zoom-.3)/.14,0,1)*Rm((r.zoom*m-.28)/.3,0,1),_=w.current,v=u.current?1:_?.id===p?Rm((r.zoom-_.zoom*.65)/(_.zoom*.35),0,1):g;l.current=v>0?p:null,a.style.setProperty(`--detail-alpha`,String(v)),a.style.setProperty(`--summary-alpha`,String(1-v)),a.style.setProperty(`--context-alpha`,String(p?1-v*.72:1)),a.dataset.zoom=r.zoom.toFixed(2),k(a,Cm(O.get(),r.zoom)),i(v>0&&p?p:null),o(!!p&&v>=.55),r.zoom<=.32&&!C.current&&!E.current&&!w.current&&(x.current=r)},[n,e,k,O]),M=(0,X.useCallback)(t=>{let r=f.current;f.current=!1,A();let i=n.getNode(t),a=e.current;if(!i||!a)return;!r&&n.getZoom()<=.32&&!w.current&&(x.current=n.getViewport()),C.current=t,u.current=!1,delete a.dataset.reading,d.current=!0;let o=Bm(a,!0),s=i.width||1440,c=i.height||1080,l=Rm(Gm({width:a.clientWidth,height:a.clientHeight},o,{width:s,height:c},i.data.frame?.scale||1,i.data.layout),Im,Lm);w.current={id:t,zoom:l};let p=o.x+Math.max(0,(o.width-s*l)/2)-i.position.x*l,m=o.y+Math.max(0,(o.height-c*l)/2)-i.position.y*l;n.setViewport({x:p,y:m,zoom:l},{duration:Um(y,380)}).then(()=>{C.current=null})},[A,n,y,e]);v.current=M;let N=(0,X.useCallback)(()=>{f.current=!1,A(),C.current=null,u.current=!1,e.current&&delete e.current.dataset.reading,d.current=!1,w.current=null,S.current=null;let t=e.current?.querySelector(`.map-macro[data-focused="true"]`)?.dataset.cardId;n.setViewport(x.current,{duration:Um(y,320)}).then(()=>{t&&e.current?.querySelector(`[data-testid="map-card"][data-card-id="${CSS.escape(t)}"]`)?.focus({preventScroll:!0})})},[A,n,y,e]),P=(0,X.useCallback)((t,r)=>{f.current=!1,A(),C.current=t;let i=n.getNode(t),a=e.current;!i||!a||(u.current=!0,a.dataset.reading=`true`,d.current=!0,h.current=t,g.current={id:t,rect:r},n.setViewport(qm(Bm(a),i.position,r),{duration:Um(y,340)}).then(()=>{C.current=null}))},[A,n,y,e]);_.current=P;let F=(0,X.useCallback)(e=>{f.current=!1,A(),u.current=!1,d.current=!1,C.current=null,S.current=null,n.setCenter(e.x,e.y,{zoom:n.getZoom(),duration:Um(y,180)})},[A,n,y]),I=(0,X.useCallback)(t=>{f.current=!0,p.current=t,A(),C.current=null,u.current=!1,d.current=!1,w.current=null,S.current=null;let r=e.current;r&&delete r.dataset.reading;let i=n.getNodes().filter(e=>!e.hidden&&(!t||t.has(e.data.task.id)));if(!r||!i.length)return;let a=Km({width:r.clientWidth,height:r.clientHeight},Bm(r),n.getNodesBounds(i));t||(x.current=a),n.setViewport(a,{duration:Um(y,320)})},[A,n,y,e]);m.current=()=>I(p.current);let L=(0,X.useCallback)(()=>{f.current?m.current():d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&v.current(l.current)},[]);return(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let n,r=t.querySelector(`.map-composer-dock`),i=-1,a=-1,o=-1,s=new ResizeObserver(()=>{let e=r?.getBoundingClientRect().height||0;(i!==t.clientWidth||a!==t.clientHeight||o!==e)&&(i=t.clientWidth,a=t.clientHeight,o=e,t.style.setProperty(`--map-composer-height`,`${o}px`),c(e=>e.width===i&&e.height===a?e:{width:i,height:a}),clearTimeout(n),n=setTimeout(()=>{d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&!u.current?v.current(l.current):f.current&&m.current()},100))});return s.observe(t),r&&s.observe(r),()=>{s.disconnect(),clearTimeout(n)}},[e,t]),(0,X.useEffect)(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let r=e=>{if(e.target.closest(`.nowheel, .map-canvas-toolbar, .map-legend, .react-flow__minimap, .react-flow__controls`))return;e.preventDefault(),e.stopPropagation(),f.current=!1,u.current=!1,d.current=!0,C.current=null;let r=t.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top;S.current={x:i,y:a,until:performance.now()+1e3};let o=E.current??n.getViewport();!E.current&&o.zoom<=.32&&!w.current&&(x.current=o);let s=e.deltaY*(e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1),c=Rm(o.zoom*Math.exp(-Rm(s,-400,400)*.002),Im,Lm);if(E.current={x:i-(i-o.x)*c/o.zoom,y:a-(a-o.y)*c/o.zoom,zoom:c},y){n.setViewport(E.current),E.current=null;return}if(T.current)return;let l=performance.now(),p=e=>{if(!E.current)return;let t=1-Math.exp(-Math.min(e-l,64)/55);l=e;let r=n.getViewport(),i=E.current,a=Math.abs(i.zoom-r.zoom)<15e-5&&Math.abs(i.x-r.x)+Math.abs(i.y-r.y)<.15;n.setViewport(a?i:{x:r.x+(i.x-r.x)*t,y:r.y+(i.y-r.y)*t,zoom:r.zoom+(i.zoom-r.zoom)*t}),a?(T.current=0,E.current=null):T.current=requestAnimationFrame(p)};T.current=requestAnimationFrame(p)},i=()=>{A(),C.current=null,S.current=null},a=e=>{e.defaultPrevented||document.querySelector(`[role="dialog"][aria-modal="true"]`)||e.key===`Escape`&&![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&N()};return t.addEventListener(`wheel`,r,{passive:!1,capture:!0}),t.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a),()=>{A(),t.removeEventListener(`wheel`,r,!0),t.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a)}},[N,A,n,y,e]),{capture:(0,X.useCallback)(()=>({viewport:n.getViewport(),overview:x.current,focusId:l.current,detailed:!!l.current&&(u.current||!!w.current||n.getZoom()>=.44)}),[n]),restore:(0,X.useCallback)(e=>{A(),x.current=e.overview;let t=e.focusId&&n.getNode(e.focusId)?e.focusId:null;C.current=e.detailed?t:null,w.current=e.detailed&&t?{id:t,zoom:e.viewport.zoom}:null,d.current=!1,f.current=!1,n.setViewport(e.viewport,{duration:0}),j(null,e.viewport)},[A,n,j]),focusId:r,canvasSize:s,detailed:a,enter:M,back:N,fit:I,fitUpdatedScene:L,navigate:F,readStep:P,onMove:j,reducedMotion:y,zoomSteps:O}}function Ym(e,t,n,r=n){if(!n||!r)return[];let i=e.tasks.find(e=>e.id===n);if(!i||i.turn_kind===`qa`)return[];if(r===n)return[Me(i,Pe(e,i,i.started_ts??0))];let a=new Map(e.events.map(e=>[e.id,e.item_id]));return te(e,t,n).filter(e=>e.task_id===n&&e.key===r&&e.event_ids.every(e=>!a.get(e)||a.get(e)===n))}function Xm(e,t){let n=new Map(e.events.map(e=>[e.id,e]));return JSON.stringify(t.map(t=>{let r=e.tasks.find(e=>e.id===t.task_id),i=[t.task_id,`${t.task_id}:active`,`${t.task_id}:outcome`].includes(t.key),a=!r||i?r:{...r,status:``,summary:void 0,outcome:void 0,pending_question:void 0,started_ts:void 0,finished_ts:void 0,attempt:void 0};return[t,N(a,t.event_ids.flatMap(e=>n.get(e)?[n.get(e)]:[]))]}))}function Zm(e,t,n,r=600){let i=e=>[`done`,`failed`,`cancelled`,`recorded`,`skipped`].includes(e||``),a=e.tasks.filter(e=>e.id!==n&&e.turn_kind!==`qa`),o=[...a.filter(e=>i(e.status)),...a.filter(e=>!i(e.status))],s=[];for(let n of o){if(s.length>=r)break;s.push(...nt(e,n,pe(n,e.events,t)))}return s.slice(0,r)}function Qm(e,t,n,r=!0,a,c,u=!1,p=t,m){let h=n?`zh-CN`:`en-US`,g=e.kind===`live`?`project`:`dataset`,_=e.id.replace(/^live:/,``),v=l(),y=$e(c??_,h),b=v===`question-foundation`?m===void 0?y.id:m:null,x=v===`question-foundation`&&!b,S=f(g,_,h,c,v,b),C=o(),w=i({queryKey:S,queryFn:async({signal:e})=>{let t=v===`question-foundation`?await d.mapCopy(g,_,h,e,c,v,b):await d.mapCopy(g,_,h,e,c,v),n=C.getQueryData(S);return re(n,t,n?.model_revision)},staleTime:1/0,gcTime:72e5,refetchOnWindowFocus:!1}),T=e.tasks.find(e=>e.id===t),E=Ze(S,p,I(p,T)),D=(0,X.useMemo)(()=>a??(T?pe(T,e.events,n):[]),[T,e.events,n,a]),[O,k]=(0,X.useState)(0),[A,j]=(0,X.useState)(!1),M=(0,X.useRef)(!0),N=(0,X.useRef)(null),P=(0,X.useMemo)(()=>new Map(e.events.map(e=>[e.id,e])),[e.events]),F=u?te(e,D,t):Ym(e,D,t,p),L=(0,X.useMemo)(()=>u?Zm(e,n,t):[],[e,n,t,u]),R=[...F,...L].filter(t=>e.tasks.find(e=>e.id===t.task_id)?.turn_kind!==`qa`).filter(t=>oe(t,e,w.data,P)).slice(0,8),z=Xm(e,R),B=[`map-copy-generation`,g,_,h,c],ee=[...B,v,...v===`question-foundation`?[b]:[],w.data?.version??null,w.data?.model_revision??null,z],V=JSON.stringify(ee),H=s({queryKey:B}),U={queryKey:ee,queryFn:async()=>{let t=w.data?.model_revision,n=ue(C,S,R.map(t=>({key:t.key,startedAt:I(t.key,e.tasks.find(e=>e.id===t.task_id))}))),r;try{r=await d.generateMapCopy(g,_,{cards:R,locale:h,...b?{foundation_id:b}:{}},void 0,c,v,n.update)}finally{n.finish()}return C.setQueryData(S,e=>re(e,r,t)),{available:!r.retry_after&&r.available!==!1&&R.every(t=>!oe(t,e,r,P)),retryAfter:typeof r.retry_after==`number`&&r.retry_after>0?r.retry_after:null}},staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1},W=i({...U,enabled:!1}),G=W.isSuccess&&W.data.available===!1?W.data.retryAfter:null,ne=(0,X.useMemo)(()=>w.data?.generation_error?Error(w.data.generation_error.message):null,[w.data?.generation_error?.code,w.data?.generation_error?.message]),ie=()=>{let e=C.fetchQuery({...U,staleTime:0});return N.current=e,j(!0),e.then(()=>void 0,()=>void 0).finally(()=>{N.current===e&&(N.current=null,M.current&&(j(!1),k(e=>e+1)))}),e};(0,X.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]),(0,X.useEffect)(()=>{if(!r||x||!w.data?.available||!R.length||W.isError||W.isSuccess&&!G||H>0||N.current)return;let e=w.data.generation_error&&typeof w.data.retry_after==`number`&&w.data.retry_after>0?w.data.retry_after:0,t=Math.max(G?W.dataUpdatedAt+G*1e3:0,e?w.dataUpdatedAt+e*1e3:0),n=setTimeout(()=>{C.isFetching({queryKey:B})===0&&ie()},Math.max(700,t-Date.now()));return()=>clearTimeout(n)},[V,O,w.data?.available,w.data?.retry_after,w.dataUpdatedAt,r,x,H,W.status,W.dataUpdatedAt]);let ae=A||W.isFetching||H>0;return{copy:w.data,generating:ae,ready:w.isFetched,foundationRequired:x,questionContext:{locale:h,preview:v,foundationId:b},readingGenerating:E.active,generationPhase:E.phase,generationError:R.length&&!W.isFetching&&!E.active?W.error||ne:null,generationUnavailable:!!R.length&&!W.isFetching&&!E.active&&!G&&W.data?.available===!1,retry:async()=>{!r||x||!w.data?.available||!R.length||ae||N.current||await ie().catch(()=>void 0)},readingRequest:F.find(e=>e.key===p),readingNeedsUpdate:W.data?.available!==!0&&R.some(e=>e.key===p)}}var $m=new Set([`done`,`failed`,`cancelled`,`recorded`,`skipped`,`aborted`,`superseded`]);function eh(e,t,n,r,a){let o=n?`zh-CN`:`en-US`,s=e.kind===`live`?`project`:`dataset`,c=e.id.replace(/^live:/,``),l=(0,X.useMemo)(()=>{let n=new Map(e.tasks.map(e=>[e.id,$m.has(e.status||``)])),r=t.filter(e=>n.has(e.source)&&n.has(e.target)).slice(0,48);return JSON.stringify(r.map(e=>[e.source,e.target,n.get(e.source),n.get(e.target)]))},[e.tasks,t]),u=(0,X.useMemo)(()=>JSON.parse(l).map(([e,t])=>({source:e,target:t})),[l]),f=[`map-lines`,s,c,o,a,l],p=i({queryKey:[...f,`saved`],queryFn:({signal:e})=>d.mapLines(s,c,{pairs:u,locale:o,write:!1},e,a),enabled:u.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...f,`written`],queryFn:({signal:e})=>d.mapLines(s,c,{pairs:u,locale:o,write:!0},e,a),enabled:u.length>0&&r&&p.data?.available===!0&&p.data.lines.lengthJSON.stringify(e.tasks.filter(e=>e.kind!==`turn`&&e.turn_kind!==`qa`).slice(-40).map(e=>[e.id,nh.has(e.status||``)])),[e.tasks]),l=(0,X.useMemo)(()=>JSON.parse(c).map(([e])=>e),[c]),u=[`map-card-words`,o,s,a,r,c],f=i({queryKey:[...u,`saved`],queryFn:({signal:e})=>d.mapCardWords(o,s,{tasks:l,locale:a,write:!1},e,r),enabled:l.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...u,`written`],queryFn:({signal:e})=>d.mapCardWords(o,s,{tasks:l,locale:a,write:!0},e,r),enabled:l.length>0&&n&&f.data?.available===!0&&Object.keys(f.data.cards).length`u`||typeof window.matchMedia!=`function`?!1:window.innerWidth>=1024&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function oh({footer:e,value:t,onChange:n,onSend:r,attachments:i,onAttachmentsChange:a,pending:o,pendingLabel:s,progressVisible:l=!0,dispatchStatus:u,onCancel:d,focusSignal:f,sessionName:m,historical:_,zh:y,routeOverride:b=`auto`,onRouteOverrideChange:x}){let{t:S}=p(),C=(0,X.useId)(),w=(0,X.useRef)(null),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(!1),k=(0,X.useRef)(!0),A=(0,X.useRef)(),[M,N]=(0,X.useState)(``),[P,F]=(0,X.useState)(!1),[I,L]=(0,X.useState)(!1),[R,z]=(0,X.useState)(()=>!!(t.trim()||i.length)||ah()),[B,ee]=(0,X.useState)(44),V=(0,X.useRef)(t);V.current=t;let H=!R,{refs:W,text:G}=le(t),te=t.length>Ie,ne=!!(t.trim()||i.length),re=(0,X.useRef)(ne);re.current=ne,(0,X.useEffect)(()=>{u===`error`&&z(!0)},[u]),(0,X.useEffect)(()=>{k.current=!0;let e=e=>{let t=e.type===`focusout`?e.relatedTarget:e.target;t?.closest?.(`.map-island-launch, .map-island-stop, .map-composer-brand`)||(T.current?.contains(t)?z(!0):re.current||z(!1))},t=e=>{let t=e.target;T.current?.contains(t)||t?.closest?.(`.map-context-menu`)||re.current||(z(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur())},n=e=>{if(e.key!==`c`||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||e.isComposing)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)||t?.closest?.(`[role="dialog"], [role="menu"]`)||(e.preventDefault(),z(!0),w.current?.focus())};return document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e),document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{k.current=!1,clearTimeout(A.current),document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[]);let ie=(0,X.useRef)(f);(0,X.useEffect)(()=>{f!==ie.current&&(ie.current=f,z(!0),w.current?.focus())},[f]);let ae=(0,X.useRef)(W.length);(0,X.useEffect)(()=>{W.length>ae.current&&(z(!0),w.current?.focus()),ae.current=W.length},[W.length]);let K=()=>{if(!w.current)return;w.current.style.height=`0px`;let e=Math.min(156,Math.max(44,w.current.scrollHeight));w.current.style.height=`${e}px`,ee(e)};(0,X.useEffect)(K,[G]),(0,X.useEffect)(()=>(window.addEventListener(`resize`,K),()=>window.removeEventListener(`resize`,K)),[]);let oe=()=>{z(!0),w.current?.focus()},ce=()=>{z(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur()},ue=(0,X.useRef)(),de=(0,X.useRef)(typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches);(0,X.useEffect)(()=>()=>clearTimeout(ue.current),[]);let fe=()=>{de.current&&(clearTimeout(ue.current),z(!0))},q=()=>{de.current&&(clearTimeout(ue.current),ue.current=setTimeout(()=>{re.current||T.current?.contains(document.activeElement)||z(!1)},320))};(0,X.useEffect)(()=>{o||L(!1)},[o]);let pe=async()=>{if(!G.trim()||D.current||te)return;let e=o;if(e&&i.length){N(y?`附件要等这条回复结束后再发送`:`Attachments can be sent once this reply finishes`);return}D.current=!0;try{(e?await r(t,[],void 0,{whileRunning:!0}):await r(t,i))&&k.current&&(N(``),F(!0),L(e),(!V.current.trim()||V.current===t)&&ce(),clearTimeout(A.current),A.current=setTimeout(()=>F(!1),1800))}finally{D.current=!1}},me=e=>{if(o||D.current||!e.length)return;let{accepted:t,issues:n}=Je(i,e);a([...i,...t]),N(n.map(e=>e.code===`unsupported`?S(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?S(`chat.attachTooLarge`,{name:e.fileName,size:O(e.limitBytes)}):e.code===`too-many`?S(`chat.attachTooMany`,{count:e.limitCount}):S(`chat.attachTotalTooLarge`,{size:O(e.limitBytes)})).join(` `))},he=u?{launching:[y?`任务已接收`:`Task accepted`,y?`正在放入地图…`:`Adding it to your map…`],task:[y?`任务已进入地图`:`Your task is on the map`,y?`跟随地图,查看执行进展`:`Follow its progress on the map`],message:[y?`${c().name} 已回复`:`${c().name} replied`,y?`在对话中查看回复`:`Open the conversation to read it`],error:[y?`发送没有成功`:`Message could not be sent`,y?`草稿已保留,可以重试`:`Your draft is ready to retry`],cancelled:[y?`正在停止回复`:`Stopping reply`,y?`可以发送新消息`:`You can send another message`]}[u]:void 0,ge=[y?`已排队`:`Queued`,y?`这条回复结束后立即处理`:`Answered right after this reply`],_e=he?.[0]||(o&&I?ge[0]:o?l?y?`${c().name} 正在处理`:`${c().name} is working`:y?`继续对话`:`Continue chatting`:P?y?`已发送给 ${c().name}`:`Sent to ${c().name}`:y?`交给 ${c().name}`:`Ask ${c().name}`),ve=he?.[1]||(o&&I?ge[1]:o?l?s||(y?`正在处理你的消息…`:`Processing your message…`):y?`可发送后续消息或停止回复`:`Send a follow-up or stop the reply`:P?y?`点此继续对话`:`Tap to keep the conversation going`:ne?y?`草稿已保留,点此继续`:`Draft saved — tap to continue`:y?`描述目标,看它变成成果`:`Turn your next idea into a result`),ye=u||(o?`working`:P?`sent`:`idle`);return(0,Y.jsxs)(`div`,{ref:T,className:`map-composer-dock map-island-dock`,"data-compact":H,"data-state":ye,"data-pending":o,style:{"--map-editor-height":`${B}px`},onPointerEnter:fe,onPointerLeave:q,onTransitionEnd:e=>{e.target===T.current&&e.propertyName===`width`&&K()},children:[!H&&W.length>0&&(0,Y.jsx)(`div`,{className:`map-reference-chips`,children:W.map((e,t)=>(0,Y.jsxs)(`span`,{title:`${e.source} · ${e.task_id} ${e.step_id||``}`,children:[(0,Y.jsxs)(`span`,{children:[y?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,Y.jsx)(`button`,{"aria-label":y?`移除引用`:`Remove reference`,onClick:()=>n(W.filter((e,n)=>t!==n).map(U).join(``)+G),children:(0,Y.jsx)(v,{size:12})})]},`${e.task_id}:${e.step_id}:${t}`))}),!H&&!!i.length&&(0,Y.jsx)(`div`,{className:`map-attachment-tray nowheel`,role:`group`,"aria-label":y?`待发送附件`:`Selected attachments`,children:i.map((e,t)=>(0,Y.jsx)(Ge,{file:e,disabled:o,removeLabel:S(`chat.attachRemove`,{name:e.name}),onRemove:()=>{a(i.filter(t=>t!==e)),N(``)}},`${e.name}:${e.lastModified}:${t}`))}),!H&&M&&(0,Y.jsx)(`div`,{className:`map-attachment-notice nowheel`,role:`alert`,children:M}),(0,Y.jsxs)(`div`,{className:`map-composer map-island-surface`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":S(`chat.attach`),title:S(`chat.attach`),"aria-hidden":H,tabIndex:H?-1:0,disabled:o&&!H,onClick:()=>E.current?.click(),children:(0,Y.jsx)(j,{size:25})}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-island-launch`,"aria-label":y?`打开消息输入`:`Open message composer`,"aria-expanded":!H,"aria-controls":C,"aria-hidden":!H,tabIndex:H?0:-1,onClick:oe,children:[(0,Y.jsxs)(`span`,{className:`map-island-copy`,children:[(0,Y.jsx)(`strong`,{children:_e}),(0,Y.jsx)(`small`,{title:ve,children:ve})]}),(0,Y.jsx)(`span`,{className:`map-island-indicator`,"aria-hidden":`true`,children:ye===`working`||ye===`launching`?(0,Y.jsxs)(`span`,{className:`map-island-wave`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}):ye===`sent`||ye===`task`||ye===`message`?(0,Y.jsx)(g,{size:16}):(0,Y.jsx)(at,{size:15})})]}),H&&o&&(0,Y.jsx)(`button`,{type:`button`,className:`map-island-stop`,onClick:d,"aria-label":y?`停止回复`:`Stop reply`,children:(0,Y.jsx)(be,{size:13})}),(0,Y.jsxs)(`form`,{id:C,className:`map-composer-editor`,"aria-hidden":H,onSubmit:e=>{e.preventDefault(),pe()},children:[(0,Y.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:xe,hidden:!0,disabled:o,onChange:e=>{me(Array.from(e.target.files||[])),e.target.value=``}}),(0,Y.jsx)(`textarea`,{ref:w,rows:1,tabIndex:H?-1:0,value:G,"aria-label":y?`给 ${c().name} 发送消息`:`Message ${c().name}`,placeholder:y?`告诉 ${c().name},你想完成什么…`:`What would you like ${c().name} to do?`,onFocus:()=>z(!0),onChange:e=>{F(!1),n(W.map(U).join(``)+e.target.value)},onPaste:e=>{let t=Ce(e.clipboardData);t.length&&(e.preventDefault(),me(t))},onKeyDown:e=>{e.key===`Escape`&&!Ee(e)&&!G.trim()&&!i.length&&(e.preventDefault(),e.stopPropagation(),ce()),e.key===`Enter`&&!e.shiftKey&&!Ee(e)&&(e.preventDefault(),pe())}}),(0,Y.jsxs)(`div`,{className:`map-island-toolbar`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-island-collapse`,tabIndex:H?-1:0,onClick:ce,"aria-label":y?`收起消息输入`:`Collapse message composer`,title:y?`收起(草稿会保留)`:`Collapse (draft is kept)`,children:(0,Y.jsx)(h,{size:15})}),x&&(0,Y.jsx)(Be,{value:b,onChange:x,disabled:o,tabIndex:H?-1:0}),o&&(0,Y.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),d()},tabIndex:H?-1:0,"aria-label":y?`停止回复`:`Stop reply`,className:`map-send is-pending`,children:(0,Y.jsx)(be,{size:15})},`stop`),(0,Y.jsx)(`button`,{type:`submit`,tabIndex:H?-1:0,disabled:!G.trim()||te,"aria-label":o?y?`在 ${c().name} 工作时发送`:`Send while ${c().name} works`:y?`发送消息`:`Send message`,title:o?y?`排队到这条回复之后处理`:`Queued right after this reply`:void 0,className:`map-send`,children:(0,Y.jsx)(se,{size:20})},`send`)]})]})]}),te&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1 px-3 text-xs text-err`,children:S(`chat.messageTooLong`)}),e,(0,Y.jsx)(`span`,{className:`map-composer-caption`,role:`status`,children:he?`${he[0]} · ${he[1]}`:o&&I?`${ge[0]} · ${ge[1]}`:o?``:P?y?`已发送`:`Sent`:_?`${y?`发送至`:`Send to`} ${m}`:``})]})}function sh(e,t,n){if(e.length<2)return``;let r=[0];for(let t=1;t0))return``;let a=Math.min(n,i/3),o=a*1.22,s=1,c=t=>{let n=Math.max(0,Math.min(i,t));for(;s1&&r[s-1]>n;)s--;let a=r[s]-r[s-1]||1,o=(n-r[s-1])/a,c=e[s-1],l=e[s];return{x:c.x+(l.x-c.x)*o,y:c.y+(l.y-c.y)*o}},l=e=>e*e*(3-2*e),u=e=>{let n=i-e;if(n<=a)return t*2.5*(n/a)**.85;let r=t*(.34+.66*l(Math.min(1,e/Math.max(1,i-o))));return n>=o?r:r+(t*2.5-r)*l((o-n)/(o-a))},d=Math.max(12,Math.min(72,Math.round(i/Math.max(a,1)*1.5))),f=Array.from({length:d+1},(e,t)=>(i-o)*(t/d));f.push(i-(o+a)/2,i-a,i);let p=[],m=[],h=e=>Math.round(e*100)/100;for(let e of f){let t=c(e),n=c(e-i*.004-.5),r=c(e+i*.004+.5),a=r.x-n.x,o=r.y-n.y,s=Math.hypot(a,o)||1,l=u(e)/2,d=-o/s*l,f=a/s*l;p.push(`${h(t.x+d)} ${h(t.y+f)}`),m.push(`${h(t.x-d)} ${h(t.y-f)}`)}return`M ${p.join(` L `)} L ${m.reverse().join(` L `)} Z`}function ch(e,t){let n=1-t;return{x:n**3*e[0].x+3*n**2*t*e[1].x+3*n*t**2*e[2].x+t**3*e[3].x,y:n**3*e[0].y+3*n**2*t*e[1].y+3*n*t**2*e[2].y+t**3*e[3].y}}function lh(e,t,n=!1){if(!e.length)return null;let r=n?[...e].reverse():e,i=0;for(let e=1;e0&&i+n>=t){let a=(t-i)/n;return{x:r[e-1].x+(r[e].x-r[e-1].x)*a,y:r[e-1].y+(r[e].y-r[e-1].y)*a}}i+=n}return r[r.length-1]}function uh(e,t,n=0){return e.x>t.x-n&&e.xt.y-n&&e.y({x:n===`left`?-e.x:e.x,y:n===`up`?-e.y:e.y}),s=o(e),c=o(t);i=i.map(e=>({...e,x:n===`left`?-e.x-e.width:e.x,y:n===`up`?-e.y-e.height:e.y}));let l=Math.max(80,n===`loop`?Math.max(Math.abs(c.x-s.x),Math.abs(c.y-s.y))*2.8:0,Math.abs(a?c.y-s.y:c.x-s.x)*(.4+r*.06)),u=[s,a?{x:s.x+0,y:s.y+l}:{x:s.x+l,y:s.y},n===`loop`?{x:c.x,y:c.y+l}:a?{x:c.x-0,y:c.y-l}:{x:c.x-l,y:c.y},c],d=e=>e.flatMap(e=>Array.from({length:31},(t,n)=>ch(e,n/30))),f=e=>d(e).reduce((e,t)=>e+i.filter(e=>uh(t,e,22)).length,0),p=[u],m=f(p)*1e5;if(m){let e={x:(s.x+c.x)/2,y:(s.y+c.y)/2},t=a?e.x:e.y,n=[...new Set(i.flatMap(e=>a?[e.x-110-r*30,e.x+e.width+110+r*30]:[e.y-110-r*30,e.y+e.height+110+r*30]))].sort((e,n)=>Math.abs(e-t)-Math.abs(n-t)).slice(0,12);for(let e of n){let n=(e-t)*4/3;for(let r of[.25,.4,.55]){let i=Math.max(60,Math.abs(a?c.y-s.y:c.x-s.x)*r),o=[a?[s,{x:s.x+n,y:s.y+i},{x:c.x+n,y:c.y-i},c]:[s,{x:s.x+i,y:s.y+n},{x:c.x-i,y:c.y+n},c]],l=f(o)*1e5+Math.abs(e-t)+Math.abs(r-.4)*100;le.map(o)),{path:`M ${e.x} ${e.y}`+p.map(e=>` C ${e[1].x} ${e[1].y}, ${e[2].x} ${e[2].y}, ${e[3].x} ${e[3].y}`).join(``),points:d(p),labels:[.5,.4,.6,.3,.7,.2,.8,.35,.45,.55,.65,.25,.75,.15,.85].map(e=>{let t=Math.min(p.length-1,Math.floor(e*p.length));return ch(p[t],e*p.length-t)})}}var fh=new WeakMap,ph=.5,mh=.05;function hh(e){return e>=ph?Math.max(ph,Math.floor(e*8)/8):ee+(/[^\x00-\x7F]/.test(t)?10.5:7),20);return{width:Math.min(t,216),height:26}}function vh(e,t){let n=e.getState(),r=[...n.nodeLookup.values()].filter(e=>!e.hidden).map(e=>({id:e.id,...e.internals.positionAbsolute,width:e.width||e.measured.width||0,height:e.height||e.measured.height||0}));function i(e,t){let r=n.nodeLookup.get(e);if(!r)return null;let{x:i,y:a}=r.internals.positionAbsolute,o=r.width||r.measured.width||0,s=r.height||r.measured.height||0;return{x:i+(t===`left`?0:t===`right`?o:o/2),y:a+(t===`top`?0:t===`bottom`?s:s/2)}}let a=n.edges.filter(e=>!e.hidden).map(e=>({...e,s:i(e.source,e.sourceHandle),t:i(e.target,e.targetHandle)})),o=JSON.stringify([r,a.map(e=>[e.id,e.s,e.t,e.label,e.data?.lane,e.sourceHandle,e.targetHandle,e.className])]),s=fh.get(e);if(!s||s.key!==o){let t=new Map,n=new Map;for(let e of a)n.set(e.id,/(?:^|\s)map-edge-(\w+)/.exec(e.className??``)?.[1]),e.s&&e.t&&t.set(e.id,dh(e.s,e.t,e.source===e.target?`loop`:e.sourceHandle===`left`?`left`:e.sourceHandle===`top`?`up`:e.sourceHandle===`bottom`,Number(e.data?.lane||0),r.filter(t=>t.id!==e.source&&t.id!==e.target)));s={key:o,routes:t,kinds:n,zoom:-1,labels:new Map},fh.set(e,s)}let c=hh(t);return s.zoom!==c&&(s.zoom=c,s.labels=new Map,c&&yh(s,a,r,c)),s}function yh(e,t,n,r){let i=[...n],a=e=>+!!e.data?.quiet;for(let n of[...t].sort((e,t)=>a(e)-a(t))){let t=e.routes.get(n.id);if(!t||!n.label)continue;let a=_h(n.label),o=a.width/r,s=a.height/r,c=[0,3,4,5,6][Number(n.data?.lane||0)%5],l=[t.labels[c],...t.labels.filter((e,t)=>t!==c)].filter(e=>i.every(t=>e.x+o/2<=t.x||e.x-o/2>=t.x+t.width||e.y+s/2<=t.y||e.y-s/2>=t.y+t.height)),u,d=1/0;for(let t of l){let r={x:t.x-o/2,y:t.y-s/2,width:o,height:s},i=0;for(let[t,a]of e.routes)t!==n.id&&a.points.some(e=>uh(e,r))&&i++;if(ie),a=(0,X.useId)().replace(/:/g,``),o=`relation-arrow-${a}`,s=`relation-flow-${a}`,c=vh(vu(),i),l=c.routes.get(e),u=c.labels.get(e);if(!l)return null;let d=c.kinds.get(e),f=d===`fanout`||d===`fanin`,p=!d||n?.stroke===bh?n?.stroke||`#7594ad`:`var(--map-edge-${d}, ${n?.stroke||`#7594ad`})`,m=(Number(n?.strokeWidth||2)+(f?.4:0))/i,h=f?lh(l.points,(d===`fanout`?2:15)/i,d===`fanin`):null,g=typeof t==`string`?gh(t):void 0,_=l.points[0],v=l.points[l.points.length-1],y=!!_&&!!v&&n?.stroke!==bh&&(Math.abs(_.x-v.x)>1||Math.abs(_.y-v.y)>1),b=!f&&!n?.strokeDasharray,x=b?sh(l.points,Number(n?.strokeWidth||2)*1.45/i,16/i):``;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`defs`,{children:[(0,Y.jsx)(`marker`,{id:o,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:9/i,markerHeight:9/i,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,style:{fill:p}})}),y&&(0,Y.jsxs)(`linearGradient`,{id:s,gradientUnits:`userSpaceOnUse`,x1:_.x,y1:_.y,x2:v.x,y2:v.y,children:[(0,Y.jsx)(`stop`,{offset:`0`,style:{stopColor:p,stopOpacity:b?.34:.28}}),(0,Y.jsx)(`stop`,{offset:`0.55`,style:{stopColor:p,stopOpacity:b?.7:.78}}),(0,Y.jsx)(`stop`,{offset:`1`,style:{stopColor:p,stopOpacity:1}})]})]}),(0,Y.jsxs)(lm,{path:l.path,delay:r?.growthDelay,padding:24/i,children:[(0,Y.jsx)(wf,{id:e,path:l.path,markerEnd:x?void 0:`url(#${o})`,style:{...n,stroke:x?`transparent`:y?`url(#${s})`:p,strokeLinecap:`round`,vectorEffect:`none`,strokeWidth:m,strokeDasharray:n?.strokeDasharray?String(n.strokeDasharray).split(/[\s,]+/).map(e=>Number(e)/i).join(` `):void 0}}),x&&(0,Y.jsx)(`path`,{className:`map-edge-ink`,d:x,style:{fill:y?`url(#${s})`:p,opacity:n?.opacity},"aria-hidden":`true`}),!f&&_&&(0,Y.jsx)(`circle`,{className:`map-edge-anchor`,cx:_.x,cy:_.y,r:(x?2.1:2.6)/i,style:x?{fill:p,opacity:Number(n?.opacity??1)*.62}:{fill:`var(--map-paper)`,stroke:p,strokeWidth:1.4/i,opacity:n?.opacity},"aria-hidden":`true`}),h&&(0,Y.jsx)(`circle`,{className:`map-edge-joint`,cx:h.x,cy:h.y,r:3.2/i,style:{fill:p,opacity:n?.opacity},"aria-hidden":`true`})]}),(r?.active&&!r.muted||r?.lit)&&(0,Y.jsx)(Tp,{children:(0,Y.jsx)(`div`,{className:`map-edge-spark`,"data-lit":!r?.active&&!!r?.lit,"aria-hidden":`true`,style:{offsetPath:`path("${l.path}")`,width:8/i,height:8/i,margin:`${-4/i}px 0 0 ${-4/i}px`,animationDelay:`${-((e.charCodeAt(0)*131+e.length*47)%2800)}ms`}})}),t&&g!==``&&u&&(0,Y.jsx)(Tp,{children:(0,Y.jsx)(`div`,{className:`map-relation-label nodrag nopan`,"data-kind":d,"data-lit":!!r?.lit,"data-quiet":!!r?.quiet,title:g,style:{opacity:r?.quiet&&!r.lit?0:n?.opacity,pointerEvents:r?.quiet&&!r.lit?`none`:void 0,transform:`translate(-50%, -50%) translate(${u.x}px, ${u.y}px) scale(${1/i})`},children:g??t})})]})}function Sh({open:e,info:t,zh:n,onChoose:r,readOnly:i=!1}){return(0,Y.jsx)(S,{open:e,onClose:()=>r({mode:`off`}),label:n?`选择地图加载范围`:`Choose map history`,width:`max-w-lg`,children:(0,Y.jsxs)(`div`,{className:`map-history-choice`,children:[(0,Y.jsx)(`h2`,{children:n?`选择地图加载范围`:`Choose map history`}),(0,Y.jsx)(`p`,{children:n?`本会话有 ${t.task_count} 个任务,历史记录约 ${(t.event_bytes/1024/1024).toFixed(1)} MB。`:`This session has ${t.task_count} tasks and about ${(t.event_bytes/1024/1024).toFixed(1)} MB of history.`}),(0,Y.jsx)(`p`,{children:i?n?`只读模式只加载历史记录,不调用模型。较长历史需要一些加载时间。`:`Read-only mode loads records without model calls. Long histories take time to load.`:n?`加载较长历史需要一些时间。生成卡片摘要与关系说明会调用已配置的模型,并消耗额外 Token。已有摘要会优先复用。`:`Loading a long history takes time. Card summaries and relationship descriptions use your configured model and consume additional tokens. Existing summaries are reused.`}),(0,Y.jsxs)(`div`,{className:`map-history-options`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`current`,since:t.current_task_ts,eventSince:t.current_event_ts,taskId:t.current_task_id||void 0}),children:[(0,Y.jsx)(`strong`,{children:n?`从当前进度加载`:`Start at current progress`}),(0,Y.jsx)(`span`,{children:n?`推荐 · 加载当前任务及后续进度,保留相关连接`:`Recommended · Load current and future work with its connections`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`full`}),children:[(0,Y.jsx)(`strong`,{children:n?`从头加载`:`Load from the beginning`}),(0,Y.jsx)(`span`,{children:i?n?`分批加载历史记录,查看已有说明`:`Load history in pages and view existing explanations`:n?`分批加载历史记录;打开卡片阅读时,再整理它的说明`:`Load history in pages; prepare an explanation when you open a card to read`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`off`}),children:[(0,Y.jsx)(`strong`,{children:n?`不开启地图模式`:`Keep map mode off`}),(0,Y.jsx)(`span`,{children:n?`不加载地图,也不生成摘要`:`Do not load the map or generate summaries`})]})]}),(0,Y.jsx)(`small`,{children:n?`选择仅用于本会话,可随时更改加载范围。`:`This choice applies to this session and can be changed later.`})]})})}var Ch=new Map;function wh(e){let t=Ch.get(e);if(t)return t;try{let t=JSON.parse(A(`argus.map.camera.v1:`+e)||`null`);if(t&&[t.viewport,t.overview].every(e=>e&&[e.x,e.y,e.zoom].every(Number.isFinite)&&e.zoom>=.035&&e.zoom<=3.5)&&(t.focusId===null||typeof t.focusId==`string`)&&typeof t.detailed==`boolean`)return{camera:t}}catch{}return{}}function Th(e,t){for(Ch.delete(e),Ch.set(e,t);Ch.size>8;)Ch.delete(Ch.keys().next().value);t.camera&&k(`argus.map.camera.v1:`+e,JSON.stringify(t.camera))}var Eh={task:xm,branch:Pm},Dh={relation:xh},Oh={done:`#a9c4b6`,running:`#9fb6cc`,question:`#dcc797`,failed:`#d9a79f`,review_unavailable:`#cdbba3`,held:`#cdbba3`,paused:`#cdbba3`,superseded:`#c5bdcd`,aborted:`#c6c8cb`,skipped:`#c6c8cb`,missing:`#c6c8cb`};function kh({events:e,zh:t}){let n=[...new Map(e.filter(e=>e.type===`team.task`).map(e=>[e.id,e])).values()];if(!n.length)return null;let r=n.filter(e=>e.status===`done`).length,i=n.filter(e=>ge.has(e.status||``)).length,a=n.filter(e=>e.status===`failed`).length;return(0,Y.jsxs)(`div`,{className:`map-team-progress`,role:`status`,"aria-label":t?`子任务进度`:`Subtask progress`,children:[(0,Y.jsx)(`strong`,{children:t?`子任务`:`Subtasks`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(g,{size:12}),(0,Y.jsxs)(`b`,{children:[r,`/`,n.length]}),` `,t?`已完成`:`completed`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:i}),` `,t?`进行中`:`running`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:a}),` `,t?`失败`:`failed`]})]})}function Ah({data:e,zh:t,composer:n,activePhase:r,waiting:s,snapshot:c,currentTaskId:l,events:u,pendingLabel:f,readOnly:p,sessionId:m,viewKey:h,paused:g,actions:y,replacements:O}){let[k,A]=(0,X.useState)(!1),[j,N]=(0,X.useState)(()=>e.kind===`live`&&!p&&y.conversationEvents.some(e=>e.type===`ui.operator`||e.type===`ui.argus`)),P=[...y.conversationEvents].reverse().find(e=>e.type===`ui.operator`),F=P?String(P.message_id||P.ts||``):``,I=(0,X.useRef)(F),R=(0,X.useRef)(n.pending);(0,X.useEffect)(()=>{e.kind===`live`&&!p&&(F&&F!==I.current||n.pending&&!R.current)&&(N(!0),A(!1)),I.current=F,R.current=n.pending},[F,n.pending,e.kind,p]);let[z,B]=(0,X.useState)(()=>new Set),V=(0,X.useCallback)(e=>{B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[G,te]=(0,X.useState)(null),re=(0,X.useRef)(0),ae=(0,X.useRef)(!0);(0,X.useEffect)(()=>(ae.current=!0,()=>{ae.current=!1}),[]);let K=(0,X.useMemo)(()=>M(e.tasks),[e.tasks]),[oe,se,ue]=Ep([]),fe=(0,X.useRef)(null),q=Jm(fe,!p),pe=Op(),be=(0,X.useRef)(!1),[xe,Se]=(0,X.useState)(!1),Ce=(0,X.useRef)(null);Ce.current||=wh(h);let[Ee,Oe]=(0,X.useState)(()=>{let e=Ce.current?.scene?.cards.find(e=>e.id===Ce.current?.camera?.focusId);return new Set(e&&e.id!==e.task.id?[e.task.id]:[])}),[ke,Ae]=(0,X.useState)(null),[Me]=(0,X.useState)(()=>new Set(Ce.current?.scene?.cards.map(e=>e.id))),Ne=oe.find(e=>e.id===q.focusId),Pe=(0,X.useMemo)(()=>je(e.tasks,e.events),[e.tasks,e.events]),Fe=$e(m,t?`zh-CN`:`en-US`),[Ie,Le]=(0,X.useState)(null),Be=(0,X.useCallback)((t,n)=>{Le(r=>n?{nodeId:t,key:n,foundationId:Fe.id}:r?.nodeId===t&&!e.tasks.some(e=>e.id===r.key)?null:r)},[e.tasks,Fe.id]);(0,X.useEffect)(()=>{Le(t=>t&&(t.nodeId===q.focusId||e.tasks.some(e=>e.id===t.key))?t:null)},[q.focusId,e.tasks]);let J=Ie?e.tasks.find(e=>e.id===Ie.key):void 0,Ge=J?.turn_kind===`qa`?e.events.find(e=>e.item_id===J.id&&e.type===`turn.replied`):void 0,Je=Ie?oe.find(e=>e.id===Ie.nodeId):void 0,Xe=J?.id??(Ie?.nodeId===q.focusId?Ie.key:null),Ze=(0,X.useMemo)(()=>ce(e.tasks),[e.tasks]),tt=Ze.findIndex(e=>e.id===Ne?.data.task.id),[nt,it]=(0,X.useState)(null),at=K.tasks.find(e=>e.id===nt),ot=(0,X.useMemo)(()=>at?Ke(K,at.id):null,[K,at]),lt=(0,X.useMemo)(()=>at&&ot?new Set([at.id,...ot.upstream.map(e=>e.id),...ot.downstream.map(e=>e.id)]):null,[at,ot]),{copy:ut,ready:ft,generating:pt,readingRequest:mt,readingNeedsUpdate:ht,readingGenerating:gt,generationPhase:vt,foundationRequired:bt,questionContext:St,generationError:Ct,generationUnavailable:wt,retry:Et}=Qm(e,J?.id||Ne?.data.task.id||null,t,!p&&!e.history_loading,Ne?.data.layout.steps,m,!1,Xe,Ie?.foundationId),kt=(0,X.useMemo)(()=>mt?{request:mt,questionContext:St,pending:ht,generating:gt,phase:vt,error:Ct,unavailable:wt,foundationRequired:bt,retry:p?void 0:Et,retryDisabled:pt}:void 0,[mt,St,ht,pt,gt,vt,Ct,wt,p,Et,bt]),jt=(0,X.useMemo)(()=>Ye(Te(K,ut?.relations||[],t)),[K,ut?.relations,t]),Mt=ih(e,t,!p&&!e.history_loading,m),Nt=eh(e,jt,t,!p&&!e.history_loading,m),Pt=(0,X.useMemo)(()=>Te(K,ut?.relations||[],t,Nt),[K,ut?.relations,t,Nt]),Ft=(0,X.useRef)(Ce.current.scene),It=(q.canvasSize.width||window.innerWidth)<640,Z=(0,X.useMemo)(()=>{let n=H(K,e.events,t,Ft.current,Pt,Ee,It);return Ft.current=a(Ft.current,n),Ft.current},[K,e.events,t,Pt,Ee,It]),Lt=(0,X.useRef)(null),Rt=(0,X.useMemo)(()=>(Lt.current=a(Lt.current,ze(ve(K,e.events,t,48),z,t)),Lt.current),[K,e.events,t,z]),zt=(0,X.useRef)(null),Bt=(0,X.useMemo)(()=>{let e=Rt.tasks.filter(e=>e.branch);if(!e.length)return{links:Z.links,positions:Z.positions,frames:Z.frames,structure:Z.structure,branches:e,branchAnchor:new Map};let t=new Map;for(let e of Z.cards)t.set(e.task.id,e.id);let n=new Map(e.map(e=>[e.id,t.get(e.parent_id)??e.parent_id])),r={...Z.frames};for(let t of e)r[t.id]={...t.group?Am:km,scale:1};let i=[...Z.links,...Rt.links.filter(e=>e.kind===`fanout`||e.kind===`fanin`).map(e=>({...e,source:t.get(e.source)??e.source,target:t.get(e.target)??e.target}))],a=new Map;for(let t of e){let e=n.get(t.id);a.set(e,[...a.get(e)??[],t.id])}let o=Z.cards.flatMap(e=>[e.id,...a.get(e.id)??[]]),s=JSON.stringify([o.map(e=>[e,r[e].width,r[e].height]),i.map(e=>[e.source,e.target,e.kind])]),c=zt.current?.structure===s?zt.current.positions:he(o,i,r);return zt.current={structure:s,positions:c},{links:i,positions:c,frames:r,structure:s,branches:e,branchAnchor:n}},[Z,Rt]),Vt=Tt(Bt.positions,q.reducedMotion),[Ht,Ut]=(0,X.useState)(null),Wt=(0,X.useMemo)(()=>Dt(Bt.links,Ht),[Bt.links,Ht]),[Gt,Kt]=(0,X.useState)(!1),[qt,Jt]=(0,X.useState)(!1),Yt=(0,X.useMemo)(()=>new Map(Z.cards.map(e=>[e.id,e.ordinal])),[Z.cards]),Xt=xt(Z,!!e.history_loading),Zt=(0,X.useMemo)(()=>We(e.events),[e.events]),Qt=async(e,t=[],r,i)=>{if(i?.whileRunning)return n.onSend(e,t,void 0,i);let a=++re.current,o=fe.current?.querySelector(`.map-composer`)?.getBoundingClientRect();te({id:a,text:le(e).text.replace(/\s+/g,` `).slice(0,180),origin:{x:o?.left??20,y:o?.top??innerHeight-100,width:o?.width??260,height:o?.height??56}});let s=!1,c=e=>{e.type===`task`&&(s=!0),ae.current&&e.type===`settled`&&e.outcome===`message`&&!s&&(N(!0),A(!1)),ae.current&&te(t=>t?.id===a?{...t,result:e}:t)};try{let r=await n.onSend(e,t,c);return r&&ae.current&&le(e).refs.length>0&&(N(!0),A(!1)),r||c({type:`settled`,outcome:`error`}),r}catch(e){throw c({type:`settled`,outcome:`error`}),e}},$t=()=>{te(e=>e?{...e,result:{type:`settled`,outcome:`cancelled`}}:null),n.onCancel()};(0,X.useEffect)(()=>{if(!pe||be.current||!ft||Ce.current?.camera&&e.history_loading)return;let t=requestAnimationFrame(()=>{if(be.current=!0,Ce.current?.camera)q.restore(Ce.current.camera);else if(q.fit(),e.kind===`live`&&fe.current.clientWidth<640){let t=qe(e.tasks);t&&q.fit(new Set([t.id]))}Se(!0)});return()=>cancelAnimationFrame(t)},[pe,q.fit,q.enter,q.restore,e.kind,e.tasks,Z.cards,e.history_loading,ft]),(0,X.useEffect)(()=>{let e=fe.current;if(!e||q.reducedMotion)return;let t=null,n=n=>{t??=requestAnimationFrame(()=>{t=null;let r=e.getBoundingClientRect();!r.width||!r.height||(e.style.setProperty(`--lean-x`,((n.clientX-r.left)/r.width-.5).toFixed(3)),e.style.setProperty(`--lean-y`,((n.clientY-r.top)/r.height-.5).toFixed(3)))})},r=()=>{e.style.setProperty(`--lean-x`,`0`),e.style.setProperty(`--lean-y`,`0`)};return e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,r),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,r)}},[q.reducedMotion]),(0,X.useEffect)(()=>{if(!xe||Ce.current?.camera||q.reducedMotion)return;Kt(!0);let e=window.setTimeout(()=>Kt(!1),Ot);return()=>window.clearTimeout(e)},[xe,q.reducedMotion]),(0,X.useEffect)(()=>{let e=()=>{be.current&&Th(h,{scene:Ft.current,camera:q.capture()})};return window.addEventListener(`pagehide`,e),()=>{e(),window.removeEventListener(`pagehide`,e)}},[h,q.capture]),(0,X.useEffect)(()=>{if(!pe)return;let e=requestAnimationFrame(q.fitUpdatedScene);return()=>cancelAnimationFrame(e)},[Bt.structure,pe,q.fitUpdatedScene]);let en=(0,X.useRef)(n);en.current=n;let tn=(0,X.useCallback)(e=>{if(p)return;let t=en.current;t.onChange(U(e)+t.value),window.setTimeout(()=>document.querySelector(`.map-composer textarea`)?.focus(),0)},[p]),[nn,rn]=(0,X.useState)(null),an=o(),on=i({queryKey:[`map-notes`,m],queryFn:({signal:e})=>d.mapNotes(m,e),enabled:e.kind===`live`&&!p,staleTime:6e4}),sn=(0,X.useMemo)(()=>({notes:Om(on.data?.notes??[])}),[on.data]),[cn,ln]=(0,X.useState)(null),[un,dn]=(0,X.useState)(``),[fn,pn]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!cn)return;let e=e=>{e.target.closest(`.map-note-editor`)||ln(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),ln(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[cn]);let mn=async()=>{let e=cn,t=un.trim();if(!(!e||!t)){pn(!1);try{await d.addMapNote(m,{node_id:e.ref.task_id,text:t}),await an.invalidateQueries({queryKey:[`map-notes`,m]}),ln(null),dn(``)}catch{pn(!0)}}},hn=(0,X.useCallback)((e,t)=>{p||rn({ref:e,x:Math.min(window.innerWidth-180,t.x),y:Math.min(window.innerHeight-140,t.y)})},[p]);(0,X.useEffect)(()=>{if(!nn)return;let e=e=>{e.target.closest(`.map-context-menu`)||rn(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),rn(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[nn]);let[gn,_n]=(0,X.useState)(``),vn=(0,X.useCallback)(e=>`${e.task.title} ${e.task.objective??``} ${ut?.cards[e.task.id]?.title||``} ${ut?.cards[e.task.id]?.summary||``} ${Mt[e.task.id]?.title||``} ${Mt[e.task.id]?.summary||``} ${e.part>1?t?`续篇 ${e.part-1}`:`Continued ${e.part-1}`:``}`.toLowerCase(),[ut,Mt,t]),yn=(0,X.useMemo)(()=>gn?Z.cards.filter(e=>vn(e).includes(gn.toLowerCase())):[],[gn,Z.cards,vn]),bn=yn.findIndex(e=>e.id===q.focusId),[xn,Sn]=(0,X.useState)(K.tasks.length),[Cn,wn]=(0,X.useState)(!1),[Tn,En]=(0,X.useState)(!1),Dn=O?.shown??Tn,On=O?.toggle??(()=>En(e=>!e)),[kn,An]=(0,X.useState)(``),jn=(0,X.useCallback)(e=>{if(it(e),_n(``),An(``),e){let{upstream:t,downstream:n}=Ke(K,e);q.fit(new Set([e,...t.map(e=>e.id),...n.map(e=>e.id)]))}else q.fit()},[q.fit,K]),Mn=(0,X.useCallback)((e,t=!1)=>{let n=Ft.current?.allCards.find(t=>t.id===e);if(n&&!Ee.has(n.task.id)&&(t||e!==n.task.id)){Oe(e=>new Set([...e,n.task.id])),Ae(e);return}at&&n?jn(n.task.id===at.id?null:n.task.id):q.enter(e)},[q.enter,at,jn,Ee]),Nn=(0,X.useCallback)(e=>{let t=Ee.has(e);if(Oe(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),Ne?.data.task.id===e){let n=Ft.current?.allCards.filter(t=>t.task.id===e).at(-1);Ae(t?e:n?.id??e)}},[Ee,Ne?.data.task.id]);(0,X.useEffect)(()=>{!ke||!oe.some(e=>e.id===ke)||(q.enter(ke),Ae(null))},[ke,oe,q.enter]);let Pn=(0,X.useCallback)(()=>{it(null),An(``),q.fit()},[q.fit]);(0,X.useEffect)(()=>{se(n=>a(n,Z.cards.map(n=>({id:n.id,type:`task`,position:Vt[n.id]??Z.positions[n.id],width:Z.frames[n.id].width,height:Z.frames[n.id].height,style:{width:Z.frames[n.id].width,height:Z.frames[n.id].height},data:{...n,zh:t,open:Mn,toggleHistory:Nn,readStep:q.readStep,readCopy:Be,menu:hn,quote:tn,source:e.id,readOnly:p,live:e.kind===`live`,paused:g,seenCards:Me,restoring:!!Ce.current?.camera&&!be.current,layout:Z.layouts[n.id],frame:Z.frames[n.id],plannedWidth:Zt.get(n.task.id),focused:!1,detailed:!1}}))))},[K,Z,Bt,Vt,t,se,Mn,Nn,q.readStep,Be,hn,tn,e.id,e.kind,p,g,Me,Zt]),(0,X.useEffect)(()=>{Sn(e=>Math.min(Math.max(e,1),K.tasks.length))},[K.tasks.length]),(0,X.useEffect)(()=>{if(!Cn||q.detailed)return;let e=window.setInterval(()=>Sn(e=>e>=K.tasks.length?(wn(!1),e):e+1),900);return()=>window.clearInterval(e)},[Cn,K.tasks.length,q.detailed]),(0,X.useEffect)(()=>{if(!qt||Cn||xnJt(!1),1400);return()=>window.clearTimeout(e)},[qt,Cn,xn,K.tasks.length]);let Fn=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(t=>e.kind===`live`&&!qt||t.ordinal<=xn).map(e=>e.id));for(let[e,n]of Bt.branchAnchor)t.has(n)&&t.add(e);return t},[Z.cards,xn,e.kind,qt,Bt.branchAnchor]),In=(0,X.useRef)([]),Ln=(0,X.useMemo)(()=>{let e=oe.map(e=>({...e,hidden:!Fn.has(e.id),data:{...e.data,copy:ut?{version:ut.version,cards:Object.fromEntries([e.data.task.id,...e.data.layout.steps.map(e=>e.id)].filter(e=>ut.cards[e]).map(e=>[e,ut.cards[e]]))}:void 0,words:Mt[e.data.task.id],readerCopy:Ie?.nodeId===e.id?kt:void 0,focused:e.id===q.focusId,detailed:q.detailed&&e.id===q.focusId,canvasSize:q.canvasSize,lit:Wt.nodes.has(e.id),hovered:e.id===Ht,arriving:Gt,revealing:qt,phase:r&&ge.has(e.data.task.status)?r:void 0,waiting:s&&s.taskId===e.data.task.id?s.sentence:void 0,growthDelay:Xt.cards[e.id],dispatchState:G?.result?.type===`task`&&G.result.taskId===e.data.task.id&&!n.historical?G.landed?`landed`:`receiving`:void 0,growingSteps:Object.fromEntries(e.data.layout.steps.flatMap(t=>{let n=Xt.steps[yt(e.id,t.id)];return n==null?[]:[[t.id,n]]})),growingLinks:Object.fromEntries(e.data.layout.links.flatMap(t=>{let n=Xt.links[yt(e.id,t.id)];return n==null?[]:[[t.id,n]]}))},style:{...e.style,opacity:lt&&!lt.has(e.data.task.id)||gn&&!vn(e.data).includes(gn.toLowerCase())?.22:1}}));return In.current=a(In.current,e),In.current},[oe,Fn,q.focusId,q.detailed,q.canvasSize,gn,vn,ut,Mt,Ie,kt,t,Xt,G,n.historical,lt,Wt,Ht,Gt,qt,r,s]),Rn=(0,X.useRef)([]),zn=(0,X.useMemo)(()=>{let e=new Map;for(let t of Bt.branches){if(t.group)continue;let n=t.parent_id??``;e.set(n,(e.get(n)??0)+1)}let n=new Map,r=Bt.branches.map(r=>{let i=r.parent_id??``,a=Bt.frames[r.id],o=r.group?void 0:(n.get(i)??0)+1;return o!==void 0&&n.set(i,o),{id:r.id,type:`branch`,position:Vt[r.id]??{x:0,y:0},width:a.width,height:a.height,style:{width:a.width,height:a.height,opacity:lt&&!lt.has(i)?.22:1},hidden:!Fn.has(r.id),draggable:!1,selectable:!1,focusable:!1,data:{task:r,zh:t,parentCardId:Bt.branchAnchor.get(r.id),open:Mn,toggleGroup:V,fanIndex:o,fanCount:o===void 0?void 0:e.get(i)}}});return Rn.current=a(Rn.current,r),Rn.current},[Bt,Vt,Fn,t,Mn,V,lt]),Bn=(0,X.useMemo)(()=>zn.length?[...Ln,...zn]:Ln,[Ln,zn]),Vn=(0,X.useMemo)(()=>{let n=Bt.links.filter(e=>Fn.has(e.source)&&Fn.has(e.target)&&(e.kind!==`replacement`||Dn)),r=W(n),i=new Map(Z.cards.map(e=>[e.id,e.task])),a=new Set;if(e.kind===`live`&&!g){for(let e of Z.cards)ge.has(e.task.status)&&a.add(e.id);for(let e of Bt.branches)ge.has(e.status)&&a.add(e.id)}return n.map((e,n)=>{let o=e.kind===`fanout`||e.kind===`fanin`,s=i.get(e.source)?.id,c=i.get(e.target)?.id,l=!!at&&e.kind===`dependency`&&(s===at.id||c===at.id),u=!!at&&!l&&(e.kind!==`continuation`||s!==at.id);return{id:e.id,source:e.source,target:e.target,...me({...Vt[e.source],...Bt.frames[e.source]},{...Vt[e.target],...Bt.frames[e.target]}),type:`relation`,data:{growthDelay:Xt.links[e.id]??(Gt?At(Yt.get(e.source)??1):qt&&Yt.get(e.target)===xn?120:void 0),active:a.has(e.target),lit:Wt.edges.has(e.id),lane:r[n],muted:u,quiet:!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)},className:`map-edge-${e.kind}${Wt.edges.has(e.id)?` is-lit`:``}`,label:o?void 0:e.label||(e.kind===`replacement`?(i.get(e.source)?.superseded_reason||``).replace(/\s+/g,` `).slice(0,60)||(t?`转入新计划`:`New plan`):e.kind===`dependency`?t?`依赖`:`Dependency`:t?`同一研究`:`Related work`),labelStyle:{fontSize:30,fill:e.kind===`replacement`?`#95809f`:`#6685a4`},labelBgPadding:[12,6],labelBgBorderRadius:12,labelBgStyle:{fill:`var(--map-paper)`,fillOpacity:.96},style:{opacity:u?.12:1,stroke:e.cycle?`#dc6648`:e.kind===`replacement`?`#a48caf`:e.kind===`dependency`?`#527fa7`:`#7594ad`,strokeWidth:l?2.6:e.kind===`dependency`?2:o?1.1:1.6,vectorEffect:`non-scaling-stroke`,strokeDasharray:e.kind===`dependency`||e.kind===`context`||e.kind===`continuation`||o?void 0:`5 6`},markerEnd:{type:Ts.ArrowClosed,color:e.kind===`replacement`?`#a48caf`:`#8aa5b8`,width:32,height:32},ariaLabel:e.evidence||(o?`Team branch: ${e.source} → ${e.target}`:e.kind===`dependency`?`Dependency: ${e.source} → ${e.target}`:`Plan replacement: ${e.source} → ${e.target_plan_id} (${e.target_count} tasks, representative ${e.target})`)}})},[Bt,Fn,Dn,t,Xt,e.kind,g,Z.cards,at,Vt,Wt,Gt,qt,xn,Yt]),Hn=K.links.filter(e=>e.kind===`replacement`).length,Un=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(e=>e.completionScope).map(e=>e.task.id)),n={done:0,ended:0,running:0,question:0,review_unavailable:0,held:0,failed:0,other:0};for(let r of e.tasks)t.has(r.id)?n.ended++:r.status===`done`?n.done++:ge.has(r.status)?n.running++:r.pending_question?n.question++:Ve(r)===`review_unavailable`?n.review_unavailable++:Ve(r)===`held`?n.held++:r.status===`failed`?n.failed++:n.other++;return n},[e.tasks,Z.cards]),Wn=Un.done,Gn=(0,X.useCallback)(e=>ut?.cards?.[`${e.id}:outcome`]?.summary||``,[ut]),Kn=(0,X.useMemo)(()=>e.tasks.some(e=>e.turn_kind!==`qa`&&e.kind!==`turn`)?ee(e.tasks,e.events,t,Gn):null,[e.tasks,e.events,t,Gn]),qn=He(c,c.mission_view,u),Jn=we(qn,c.mission_view,u,t?`zh-CN`:`en`,y.connected,De(c,c.mission_view,qn.taskId)),Yn=e=>{it(null),An(``),Sn(t=>Math.max(t,Z.cards.find(t=>t.id===e)?.ordinal||1)),q.enter(e)},Xn=()=>{let e=Z.cards.filter(e=>e.task.id===Pe?.id).at(-1);e&&(Le(null),Yn(e.id))},Zn=()=>{let n=qe(e.tasks);n?(Yn(Z.cards.filter(e=>e.task.id===n.id).at(-1).id),An(``)):An(t?`发送一个目标,地图就会开始生长`:`Send a goal to start your map`)},Qn=()=>{let e=Ze[(tt+1)%Ze.length];e&&Yn(Z.cards.filter(t=>t.task.id===e.id).at(-1).id)};(0,X.useEffect)(()=>{let e=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.isComposing)&&!e.target?.closest(`input, textarea, select, [contenteditable], [role="dialog"]`)){if(e.key===`/`)e.preventDefault(),fe.current?.querySelector(`.map-search input`)?.focus();else if(e.key===`f`||e.key===`F`)Pn();else if((e.key===`ArrowRight`||e.key===`ArrowLeft`)&&q.detailed&&q.focusId){let t=Z.cards.filter(e=>Fn.has(e.id)),n=t.findIndex(e=>e.id===q.focusId);if(n<0)return;let r=t[n+(e.key===`ArrowRight`?1:-1)];r&&(e.preventDefault(),q.enter(r.id))}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pn,q.enter,q.detailed,q.focusId,Z.cards,Fn]);let $n=(0,X.useMemo)(()=>({artifacts:y.artifacts,onOpenArtifact:y.onOpenArtifact}),[y.artifacts,y.onOpenArtifact]),er=(0,Y.jsxs)(`div`,{className:`map-playback`,"data-floating":e.kind===`live`,children:[(0,Y.jsx)(`button`,{"aria-label":Cn?`Pause reveal`:`Play reveal`,onClick:()=>{xn>=K.tasks.length&&Sn(1),wn(e=>!e)},children:Cn?(0,Y.jsx)(et,{size:14}):(0,Y.jsx)(D,{size:14})}),(0,Y.jsx)(`button`,{"aria-label":`Restart reveal`,onClick:()=>{wn(!1),Sn(1),e.kind!==`live`&&q.back()},children:(0,Y.jsx)(ct,{size:13})}),(0,Y.jsx)(`span`,{children:t?`逐卡展开`:`Reveal cards`}),(0,Y.jsx)(`input`,{"aria-label":`Visible task count`,type:`range`,min:Math.min(1,K.tasks.length),max:K.tasks.length,value:xn,onChange:e=>{wn(!1),Sn(Number(e.target.value))}}),(0,Y.jsxs)(`span`,{className:`map-count`,children:[xn,` / `,K.tasks.length]}),(0,Y.jsx)(`button`,{"aria-label":`Reveal next card`,disabled:xn>=K.tasks.length,onClick:()=>Sn(e=>Math.min(K.tasks.length,e+1)),children:(0,Y.jsx)(ie,{size:14})}),(0,Y.jsx)(`small`,{children:t?`时间顺序`:`Chronological order`}),e.kind===`live`&&(0,Y.jsx)(`button`,{className:`map-replay-exit`,"aria-label":t?`回到当前`:`Back to the present`,title:t?`回到当前`:`Back to the present`,onClick:()=>{wn(!1),Jt(!1),Sn(K.tasks.length)},children:(0,Y.jsx)(v,{size:14})})]});return(0,Y.jsx)(Tm.Provider,{value:q.zoomSteps,children:(0,Y.jsx)(fm.Provider,{value:sn,children:(0,Y.jsxs)(pm.Provider,{value:$n,children:[ut?.generation_error&&(0,Y.jsxs)(`div`,{role:`status`,className:`map-paused-label`,children:[t?`地图说明暂时不可用,任务和已有说明仍可阅读。`:`Map explanation unavailable; tasks and saved explanations remain readable.`,ut.generation_error.code===`cost_unreconciled`&&(t?` 调用费用待对账,并非预算耗尽。`:` Provider usage awaits reconciliation, not budget exhaustion.`)]}),e.kind===`live`&&!qt&&Kn&&(0,Y.jsxs)(`dl`,{className:`map-brief`,"aria-label":t?`任务进展`:`Task progress`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`正在做`:`Now`}),(0,Y.jsx)(`dd`,{title:Kn.goal,children:qn.state===`running`||qn.state===`waiting`||qn.reason===`operator_input`?Jn:Kn.current})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`已有结果`:`Results`}),(0,Y.jsx)(`dd`,{children:Kn.conclusion})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`接下来`:`Next`}),(0,Y.jsx)(`dd`,{children:Kn.next})]})]}),(0,Y.jsxs)(`div`,{className:`map-status-row`,children:[e.tasks.length>0&&(0,Y.jsx)(`span`,{className:`map-progress`,"aria-hidden":`true`,children:[`done`,`ended`,`running`,`question`,`review_unavailable`,`held`,`failed`,`other`].map(e=>Un[e]>0?(0,Y.jsx)(`i`,{"data-bucket":e,style:{flexGrow:Un[e]}},e):null)}),(0,Y.jsxs)(`p`,{className:`map-status-line`,role:`status`,children:[n.pending||!g&&(r||s)?(0,Y.jsx)(`i`,{className:`map-live-dot`,"aria-hidden":!0}):null,(0,Y.jsx)(`span`,{className:`map-status-text`,children:Ue({total:e.tasks.length,qa:e.tasks.filter(e=>e.turn_kind===`qa`).length,complete:Wn,ended:Un.ended,reviewUnavailable:Un.review_unavailable,held:Un.held,running:Un.running,pending:n.pending,paused:g,hasOpenWork:e.tasks.some(e=>[`running`,`pending`,`paused`,`held`,`question`].includes(Ve(e))),role:r,current:e.kind===`live`&&![`idle`,`step_finished`].includes(qn.state)?Jn:void 0,waiting:s?.sentence,zh:t})}),Ze.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`map-status-sep`,"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`button`,{type:`button`,className:`map-attention-link`,onClick:Qn,title:t?`跳到需要你处理的任务`:`Jump to the task waiting on you`,"aria-label":t?`逐个查看 ${Ze.length} 项需要你处理的任务`:`Cycle through ${Ze.length} tasks needing attention`,children:t?`${Ze.length} 项需要你处理`:`${Ze.length} ${Ze.length===1?`needs`:`need`} your attention`})]})]})]}),e.kind===`live`&&Pe&&!qt&&(0,Y.jsxs)(`div`,{className:`map-final-review`,role:`status`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:t?`最终结果已检查通过`:`Final delivery passed review`}),Ne?.data.task.id!==Pe.id&&Ne?.data.task.outcome?.review_status===`unavailable`&&(Pe.finished_ts??0)>(Ne.data.task.finished_ts??0)?(0,Y.jsx)(`span`,{children:t?` · 本项目后续已交付;此卡保留当次审查异常。`:` · This project was delivered later; this card retains its earlier review error.`}):null]}),(0,Y.jsx)(`button`,{type:`button`,onClick:Xn,children:t?`查看结果检查`:`View final review`}),y.deliveryCount>0&&(0,Y.jsx)(`button`,{type:`button`,onClick:y.onOpenDelivery,children:t?`查看项目成果`:`View project deliverables`})]}),e.kind===`live`&&!p&&(0,Y.jsx)(_e,{questions:c.pending_questions??[],backlog:c.backlog,currentTaskId:l??c.mission_view?.mission.id,onAnswer:y.onAnswer,onLocate:e=>{let t=Z.cards.filter(t=>t.task.id===e).at(-1);t&&Yn(t.id)}}),q.detailed&&tt>=0&&(0,Y.jsxs)(`div`,{className:`map-attention-detail`,role:`status`,children:[(0,Y.jsxs)(`strong`,{children:[t?`待处理`:`Needs attention`,` `,tt+1,` / `,Ze.length]}),(()=>{let n=ne(Ze[tt],e.events,t,Gn(Ze[tt]));return(0,Y.jsxs)(`div`,{tabIndex:0,children:[(0,Y.jsx)(`p`,{children:n.reason}),(0,Y.jsx)(`p`,{children:n.next}),n.detail&&(n.showDetail?(0,Y.jsxs)(`blockquote`,{className:`map-attention-quote`,children:[(0,Y.jsx)(`strong`,{children:t?`暂停原因原文`:`Recorded reason`}),` `,n.detail]}):(0,Y.jsxs)(`details`,{children:[(0,Y.jsx)(`summary`,{children:t?`原始记录`:`Recorded words`}),(0,Y.jsx)(`p`,{children:n.detail})]}))]})})()]}),at&&ot&&(0,Y.jsxs)(`nav`,{className:`map-dependencies`,"aria-label":t?`任务来路与去向`:`Task dependencies`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`来路`:`Depends on`}),ot.upstream.length?ot.upstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的前置依赖`:`No recorded prerequisites`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`当前`:`Selected`}),(0,Y.jsxs)(`button`,{className:`map-trace-task`,title:at.title,onClick:()=>Yn(Z.cards.find(e=>e.task.id===at.id).id),children:[at.title,` · `,t?`查看任务`:`Open task`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`去向`:`Enables`}),ot.downstream.length?ot.downstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的后续依赖`:`No recorded dependents`})]})]}),(0,Y.jsx)(`div`,{className:`map-workspace`,children:(0,Y.jsxs)(`div`,{ref:fe,className:`map-canvas-wrap`,"data-focused":!!q.focusId,"data-detailed":q.detailed,"data-fitted":xe,"data-hovering":!!Ht&&!q.detailed,children:[(0,Y.jsxs)(`div`,{className:`map-ambient`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),j&&(0,Y.jsx)(dt,{events:y.conversationEvents,connected:y.connected,pending:n.pending,artifacts:y.artifacts,zh:t,onClose:()=>N(!1),onOpenArtifact:y.onOpenArtifact,onOpenDelivery:y.onOpenReceipt}),k&&e.kind===`live`&&(0,Y.jsx)(`aside`,{className:`map-agent-drawer nowheel nodrag nopan`,children:(0,Y.jsx)(Re,{sid:c.session.id,view:c.mission_view,roles:c.roles,events:u,taskId:Ne?.data.task.id||c.mission_view?.mission.id||void 0,paused:g&&!n.pending,onClose:()=>A(!1)})}),G&&!p&&(0,Y.jsx)(_t,{flight:G,canvas:fe,zh:t,historical:n.historical,onReveal:t=>{e.tasks.some(e=>e.id===t)&&q.fit()},onLand:e=>te(t=>t?.id===e?{...t,landed:!0}:t),onFinish:e=>te(t=>t?.id===e?null:t)}),(0,Y.jsxs)(`div`,{className:`map-canvas-toolbar nowheel`,children:[(0,Y.jsxs)(`label`,{className:`map-search`,children:[(0,Y.jsx)(b,{size:14}),(0,Y.jsx)(`input`,{"aria-label":t?`搜索地图任务`:`Search map tasks`,placeholder:t?`搜索任务…`:`Find a task…`,title:t?`Enter 逐个跳转匹配`:`Enter jumps through matches`,value:gn,onChange:e=>_n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&yn.length?Yn(yn[(bn+1)%yn.length].id):e.key===`Escape`&&gn&&(e.stopPropagation(),_n(``))}}),gn&&(0,Y.jsx)(`span`,{className:`map-search-count`,"aria-live":`polite`,children:yn.length?bn>=0?`${bn+1}/${yn.length}`:`${yn.length} ${t?`项`:`found`}`:t?`无匹配`:`0 found`})]}),(0,Y.jsxs)(`button`,{onClick:Zn,title:t?`定位当前或最近任务`:`Locate current or latest task`,"aria-label":t?`定位当前`:`Locate current`,children:[(0,Y.jsx)(st,{size:15}),(0,Y.jsx)(`span`,{children:t?`定位当前`:`Locate current`})]}),(0,Y.jsx)(`button`,{className:`map-fit-button`,onClick:Pn,title:t?`适配全图`:`Fit map`,"aria-label":`Fit map`,children:(0,Y.jsx)(Qe,{size:15})}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":t?`来路 / 去向`:`Trace dependencies`,title:t?`突出显示任务的直接前后依赖;点击卡片切换,再次点击退出`:`Highlight direct dependencies; click a card to switch, click it again to exit`,"aria-pressed":!!at,disabled:!K.tasks.length,onClick:()=>jn(at?null:Ne?.data.task.id??qe(e.tasks)?.id??null),children:[(0,Y.jsx)(E,{size:15}),(0,Y.jsx)(`span`,{children:t?`来路 / 去向`:`Dependencies`})]}),e.kind===`live`&&K.tasks.length>1&&!q.detailed&&!qt&&(0,Y.jsxs)(`button`,{onClick:()=>{Jt(!0),Sn(1),wn(!0)},title:t?`回放这项研究是如何展开的`:`Replay how this research unfolded`,"aria-label":`Replay`,children:[(0,Y.jsx)(T,{size:15}),(0,Y.jsx)(`span`,{children:t?`回放`:`Replay`})]}),q.detailed&&(0,Y.jsxs)(`button`,{onClick:q.back,className:`map-back-button`,"aria-label":`Return to map`,children:[(0,Y.jsx)(w,{size:14}),(0,Y.jsx)(`span`,{children:t?`返回全图`:`Overview`})]}),q.detailed&&Ne&&Ne.data.partCount>1&&(0,Y.jsxs)(`nav`,{className:`map-part-switcher`,"aria-label":t?`切换任务部分`:`Switch task part`,children:[(0,Y.jsx)(`button`,{"aria-label":t?`上一部分`:`Previous part`,disabled:!Ne.data.previousId,onClick:()=>Ne.data.previousId&&Mn(Ne.data.previousId,!0),children:(0,Y.jsx)(rt,{size:15})}),(0,Y.jsxs)(`span`,{children:[Ne.data.part,` / `,Ne.data.partCount]}),(0,Y.jsx)(`button`,{"aria-label":t?`下一部分`:`Next part`,disabled:!Ne.data.nextId,onClick:()=>Ne.data.nextId&&Mn(Ne.data.nextId,!0),children:(0,Y.jsx)(ie,{size:15})})]}),(0,Y.jsx)(`span`,{className:`map-toolbar-gap`,"aria-hidden":!0}),e.kind===`live`&&(0,Y.jsxs)(`div`,{className:`map-workspace-actions`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":j,"aria-label":t?`对话`:`Conversation`,title:t?`与 Argus 的对话`:`Your conversation with Argus`,onClick:()=>{N(e=>!e),A(!1)},children:[(0,Y.jsx)(L,{size:15}),(0,Y.jsx)(`span`,{children:t?`对话`:`Conversation`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-agent-toggle`,"aria-expanded":k,"aria-label":t?`Agent 动态`:`Agent activity`,title:t?`各个 Agent 正在做什么`:`What each agent is doing`,onClick:()=>{A(e=>!e),N(!1)},children:[(0,Y.jsx)(_,{size:15}),(0,Y.jsx)(`i`,{"data-active":!!r||n.pending,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:t?`工作详情`:`Work details`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-delivery-toggle`,disabled:!y.deliveryCount,"aria-label":t?`交付成果`:`Deliveries`,title:t?`已交付的成果`:`What has been delivered`,onClick:y.onOpenDelivery,children:[(0,Y.jsx)(de,{size:15}),(0,Y.jsx)(`span`,{children:t?`交付成果`:`Deliveries`}),y.deliveryCount>0&&(0,Y.jsx)(`b`,{children:y.deliveryCount})]})]})]}),kn&&(0,Y.jsx)(`div`,{className:`map-feedback`,role:`status`,children:kn}),K.tasks.length===0?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(E,{size:36}),(0,Y.jsx)(`h3`,{children:t?`把一个目标,变成可见的成果`:`Turn a goal into a visible result`}),(0,Y.jsx)(`p`,{children:p?t?`尚无任务记录。`:`No task records are available.`:t?`描述你想完成的事情,看 Argus 规划、执行、审查,最后在这里交付。`:`Describe your goal. Watch Argus plan, build, review, and deliver here.`}),!p&&(0,Y.jsx)(`div`,{className:`map-starters`,children:(t?[[`交互实验`,`做一个交互式实验室,用动画展示 Dijkstra 和 A* 怎样寻找最短路径。让我能画障碍、单步播放、比较探索范围,并验证两个算法的结果一致。`],[`数据洞察`,`用一组可复现的模拟数据,做一个辛普森悖论交互演示。让我能切换整体和分组视角,看结论怎样反转,附上验证过程。`],[`产品原型`,`做一个精致的个人旅行规划网页。我能调整预算和出行天数,比较三种行程方案,并将选中的方案导出。让手机上也方便操作。`]]:[[`Interactive lab`,`Build an interactive Dijkstra vs A* pathfinding lab with editable obstacles, step-by-step animation, and correctness checks.`],[`Data insights`,`Create an interactive Simpson’s paradox demo using reproducible synthetic data, with aggregate and grouped views and validation.`],[`Product prototype`,`Build a polished travel planner. Let me adjust budget and duration, compare three itineraries, and export my choice. Make it easy to use on a phone.`]]).map(([e,t])=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{n.onChange(t),requestAnimationFrame(()=>fe.current?.querySelector(`textarea`)?.focus())},children:[e,` ↗`]},e))})]}):(0,Y.jsxs)(Cp,{nodes:Bn,edges:Vn,nodeTypes:Eh,edgeTypes:Dh,onNodesChange:ue,onNodeMouseEnter:(e,t)=>Ut(t.id),onNodeMouseLeave:()=>Ut(null),onMove:q.onMove,defaultViewport:Fm,minZoom:.01,maxZoom:3.5,nodesDraggable:!1,nodesFocusable:!1,nodesConnectable:!1,edgesReconnectable:!1,zoomOnScroll:!1,zoomOnPinch:!0,zoomOnDoubleClick:!1,deleteKeyCode:null,selectionKeyCode:null,onlyRenderVisibleElements:xe&&pe,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Fp,{variant:jp.Dots,gap:88,size:3,color:`var(--map-dot)`}),(0,Y.jsx)(Wp,{orientation:`horizontal`,showInteractive:!1,onFitView:Pn,fitViewOptions:{padding:.16,maxZoom:.27,minZoom:.01,duration:q.reducedMotion?0:320}}),(0,Y.jsx)(am,{nodeColor:e=>e.type===`branch`?`#cfd2d5`:Oh[Ve(e.data.task)]??`#c6c8cb`,maskColor:`var(--map-minimap-mask)`,maskStrokeColor:`#6d737a`,maskStrokeWidth:1.5,onClick:(e,t)=>q.navigate(t),pannable:!0,zoomable:!0,ariaLabel:t?`地图导航预览`:`Map navigation preview`})]}),e.kind===`live`&&qt&&er,(0,Y.jsxs)(`div`,{className:`map-legend nowheel`,children:[(0,Y.jsxs)(`span`,{title:t?`内容相关的工作,不是执行依赖`:`Related in content, not an execution dependency`,children:[(0,Y.jsx)(`b`,{className:`dashed`}),t?`内容关联`:`Related work`]}),(0,Y.jsxs)(`span`,{title:t?`工作发生的先后`:`The order work happened in`,children:[(0,Y.jsx)(`b`,{className:`order`}),t?`先后`:`Order`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{}),t?`任务依赖`:`Dependency`]}),(0,Y.jsxs)(`button`,{className:Dn?``:`is-muted`,onClick:On,"aria-pressed":Dn,disabled:Hn===0,"aria-label":`Toggle plan replacements`,children:[(0,Y.jsx)(`b`,{className:`replacement`}),t?`计划替代`:`Plan changes`,Hn?` · ${Hn}`:``]})]}),!p&&(0,Y.jsx)(oh,{...n,pendingLabel:f,progressVisible:!j,dispatchStatus:G?.result?.type===`task`?G.landed||n.historical?`task`:`launching`:G?.result?.outcome,onSend:Qt,onCancel:$t,overview:!q.detailed}),nn&&!p&&(0,Y.jsxs)(`div`,{className:`map-context-menu`,role:`menu`,style:{left:nn.x,top:nn.y},children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{tn(nn.ref),rn(null)},children:t?`引用`:`Reference`}),e.kind===`live`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{dn(``),ln({ref:nn.ref,x:nn.x,y:nn.y}),rn(null)},children:t?`添加批注`:`Add a note`}),(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{n.onRouteOverrideChange?.(`task`),tn(nn.ref),rn(null)},children:t?`从这里展开`:`Branch from here`})]})]}),cn&&!p&&(0,Y.jsxs)(`div`,{className:`map-note-editor nodrag nopan`,style:{left:Math.min(window.innerWidth-320,cn.x),top:Math.min(window.innerHeight-240,cn.y)},children:[(0,Y.jsx)(`small`,{children:t?`批注《${cn.ref.task_title}》`:`Note on “${cn.ref.task_title}”`}),(0,Y.jsx)(`textarea`,{autoFocus:!0,maxLength:2e3,value:un,onChange:e=>dn(e.target.value),placeholder:t?`写下你的观察,Argus 在下个规划周期会读到`:`Your observation; Argus reads it next planning cycle`}),fn&&(0,Y.jsx)(`small`,{className:`map-note-error`,children:t?`没有保存上,稍后再试;草稿还在`:`Not saved; try again — the draft is kept`}),(0,Y.jsxs)(`div`,{className:`map-note-actions`,children:[(0,Y.jsx)(`button`,{onClick:()=>ln(null),children:t?`取消`:`Cancel`}),(0,Y.jsx)(`button`,{className:`is-primary`,disabled:!un.trim(),onClick:()=>void mn(),children:t?`保存`:`Save`})]})]}),(K.cyclic||K.missing>0)&&(0,Y.jsx)(`div`,{className:`map-graph-warning`,children:K.cyclic?t?`检测到循环引用,保留原始连线。`:`Cyclic references retained.`:`${K.missing} ${t?`个依赖不在当前记录范围内`:`dependencies outside the available history`}`})]})}),e.kind!==`live`&&er,(0,Y.jsx)(S,{open:!!J,onClose:()=>Le(null),label:J?.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,children:J&&(mt||J.turn_kind===`qa`)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{title:J.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,sub:J.turn_kind===`qa`?J.objective||J.title:ut?.cards[J.id]?.title||J.title}),(0,Y.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`map-task-reading`,"data-task-id":J.id,children:[J.outcome?.review_status===`unavailable`&&(0,Y.jsxs)(`p`,{className:`mb-3 text-sm text-ink-dim`,role:`status`,children:[t?`当次审查异常,未形成审阅结论。`:`No review judgment was returned on this attempt.`,Pe&&(Pe.finished_ts??0)>(J.finished_ts??0)&&(0,Y.jsx)(`button`,{type:`button`,className:`ml-2 text-blue underline`,onClick:Xn,children:t?`查看本项目后续通过的最终审稿`:`View this project's later accepted final review`})]}),Je?.data.completionScope?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:Je.data.completionScope}):null,(0,Y.jsx)(ye,{cardKey:J.id,taskId:J.id,card:ut?.cards[J.id],task:J,readOnly:p,originalDetail:J.turn_kind===`qa`?Ge?.text||(J.status===`running`?t?`正在回答…`:`Answering…`:J.status===`cancelled`?t?`本次回答已中断。`:`This answer was interrupted.`:J.summary||(t?`尚无回答。`:`No answer recorded.`)):J.objective||J.summary||(t?`这项任务尚无详细记录。`:`No detailed task record is available.`),selection:kt,artifacts:$n.artifacts,onOpenArtifact:$n.onOpenArtifact}),p?null:(0,Y.jsx)(C,{className:`mt-3 text-xs`,onClick:()=>tn({source:e.id,task_id:J.id,task_title:ut?.cards[J.id]?.title||J.title,event_ids:Ge?[Ge.id]:ut?.cards[J.id]?.event_ids||mt?.event_ids||[],lang:t?`zh`:`en`}),children:J.turn_kind===`qa`?t?`引用这条问答`:`Reference this Q&A`:t?`引用此任务`:`Reference this task`})]})]}):null})]})})})}var jh=(0,X.memo)(function({snapshot:e,currentTaskId:t,events:n,managerSteps:r=[],draft:a,onDraftChange:s,onSend:c,attachments:l,onAttachmentsChange:u,pending:f,onCancel:m,focusSignal:h,readOnly:g=!1,onOpenSettings:_,routeOverride:v,onRouteOverrideChange:y,conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}){let{locale:O}=p(),j=O===`zh-CN`,[N,F]=(0,X.useState)([]),I=l??N,L=(0,X.useRef)(I);L.current=I;let B=(0,X.useCallback)(e=>{let t=typeof e==`function`?e(L.current):e;L.current=t,u?u(t):F(t)},[u]),ee=(0,X.useRef)(a);ee.current=a;let V=(0,X.useRef)(!0);(0,X.useEffect)(()=>(V.current=!0,()=>{V.current=!1}),[]);let H=(0,X.useCallback)(async(e,t=[],n,r)=>{let i=!1,a=await c(e,t,r=>{r.type===`settled`&&r.outcome===`error`&&(i=!0),V.current&&(r.type===`settled`&&r.outcome===`error`&&!ee.current.trim()&&(s(e),B(e=>e.length?e:t)),n?.(r))},r);return a&&!i&&V.current&&(ee.current===e&&s(``),B(e=>e.filter(e=>!t.includes(e)))),a},[c,s,B]),[U,W]=(0,X.useState)(()=>new URLSearchParams(window.location.search).get(`dataset`)||A(`argus.map.source.v1`)||`live`),G=i({queryKey:[`map-datasets`],queryFn:({signal:e})=>d.mapDatasets(e),staleTime:1/0}),te=i({queryKey:[`map-dataset`,U],queryFn:({signal:e})=>d.mapDataset(U,e),enabled:U!==`live`,staleTime:1/0,retry:!1}),ne=o(),re=`argus.map.history.v1:`+e.session.id,[ie,K]=(0,X.useState)(()=>ae(A(re))),[oe,se]=(0,X.useState)(!1),ce=i({queryKey:[`map-info`,e.session.id],queryFn:({signal:t})=>d.mapInfo(e.session.id,t),enabled:U===`live`,staleTime:6e4}),le=ie??(ce.data&&!ce.data.requires_choice?{mode:`full`}:null);(0,X.useEffect)(()=>{if(!ie&&ce.data&&!ce.data.requires_choice){let e={mode:`full`};K(e),k(re,JSON.stringify(e))}},[ce.data,ie,re]);let ue=U!==`live`||!!le&&le.mode!==`off`&&!oe,de=[`map-live`,e.session.id,le?.mode,le?.since,le?.eventSince,le?.taskId],q=JSON.stringify([U,e.session.id,O,le]),pe=e=>{K(e),k(re,JSON.stringify(e)),se(!1)},me=i({queryKey:de,queryFn:async({signal:t})=>{let n=ne.getQueryData(de),r=le?.mode===`full`?await d.mapHistory(e.session.id,t,n?.history_cursor,n?.cursor):await d.liveMap(e.session.id,t,n?.cursor,le||void 0);return R(ne.getQueryData(de),r)},enabled:U===`live`&&ue,staleTime:1/0,gcTime:72e5,refetchOnMount:`always`,refetchInterval:t=>fe(ue,t.state.data,e)}),he=U===`live`&&z(e),ge=He(e,e.mission_view,n),_e=ge.reason===`background_work`&&ge.taskId?ke(ge,j?`zh-CN`:`en`):``,ve=(0,X.useMemo)(()=>U===`live`&&!he&&_e?{taskId:ge.taskId,sentence:_e}:void 0,[U,he,ge.taskId,_e]),ye=n.filter(e=>e.run_label!==`map-summary`&&/^(life\.(mission\.|phase\.|planner\.task_added)|manager\.turn\.|round\.|agent\.message|engineer\.progress|ui\.argus|team\.|idea\.portfolio\.)/.test(String(e.type))).at(-1),be=JSON.stringify([ye?.ts,ye?.event_id||ye?.id,ye?.revision,ye?.updated_ts,ye?.status,e.backlog,he]),xe=(0,X.useRef)(null),Se=(0,X.useRef)(0),Ce=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=Ce.current;if(!e)return;let t=()=>{Se.current=Date.now()+900},n=e=>{e.buttons&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`pointerdown`,t),e.addEventListener(`pointermove`,n),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`pointerdown`,t),e.removeEventListener(`pointermove`,n)}},[]),(0,X.useEffect)(()=>{if(U!==`live`||!ue||xe.current)return;let t=()=>{let n=Se.current-Date.now();if(n>0){xe.current=setTimeout(t,n+120);return}xe.current=null,ne.invalidateQueries({queryKey:[`map-live`,e.session.id]})};xe.current=setTimeout(t,650)},[be,U,e.session.id,ne,ue]),(0,X.useEffect)(()=>()=>{xe.current&&clearTimeout(xe.current),xe.current=null},[U,e.session.id,ue]);let we=U===`live`?me.data:te.data,[Te,Ee]=(0,X.useState)(!1),De=(0,X.useMemo)(()=>({shown:Te,toggle:()=>Ee(e=>!e)}),[Te]),Oe=(0,X.useMemo)(()=>we?M(we.tasks).links.filter(e=>e.kind===`replacement`).length:0,[we]),Ae=(0,X.useMemo)(()=>({conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}),[b,x,S,C,w,T,E,D]),je=(0,X.useMemo)(()=>({footer:(0,Y.jsx)(Xe,{sid:e.session.id,roles:e.roles,running:e.daemon.alive||!!e.manager_requests?.length,lastCall:e.last_call,onOpenSettings:g?void 0:_}),routeOverride:v,onRouteOverrideChange:y,value:a,onChange:s,onSend:H,attachments:I,onAttachmentsChange:B,pending:f,onCancel:m,focusSignal:h,sessionName:e.session.display_name||e.session.id,historical:U!==`live`,zh:j}),[v,y,a,s,H,I,f,m,h,e.session.display_name,e.session.id,U,j,e.roles,e.daemon.alive,e.manager_requests,e.last_call,g,_]),Me=e=>{W(e),k(`argus.map.source.v1`,e);let t=new URL(window.location.href);t.searchParams.set(`dataset`,e),window.history.replaceState(null,``,t)};return(0,Y.jsxs)(`section`,{ref:Ce,className:`argus-map`,"aria-label":j?`进度地图`:`Progress map`,children:[(0,Y.jsxs)(`header`,{className:`map-header`,children:[(0,Y.jsxs)(`div`,{className:`map-heading`,children:[(0,Y.jsx)(`span`,{className:`map-kicker`,"aria-hidden":`true`,children:j?`ARGUS · 研究地图`:`ARGUS · RESEARCH MAP`}),(0,Y.jsx)(`h1`,{title:e.session.display_name,children:e.session.display_name})]}),(0,Y.jsxs)(`details`,{className:`map-more`,children:[(0,Y.jsx)(`summary`,{"aria-label":j?`地图选项`:`Map options`,title:j?`地图选项`:`Map options`,children:(0,Y.jsx)(ut,{size:16})}),(0,Y.jsxs)(`div`,{className:`map-more-menu`,children:[we&&(0,Y.jsx)(kh,{events:we.events,zh:j}),(0,Y.jsxs)(`div`,{className:`map-dataset-bar`,children:[(0,Y.jsx)(it,{size:15}),(0,Y.jsxs)(`select`,{"aria-label":j?`地图数据来源`:`Map data source`,value:U,onChange:e=>Me(e.target.value),children:[(0,Y.jsxs)(`option`,{value:`live`,children:[j?`当前会话`:`Current session`,` ·`,` `,e.session.display_name]}),!G.data?.datasets.some(e=>e.id===U)&&U!==`live`&&(0,Y.jsx)(`option`,{value:U,children:U}),G.data?.datasets.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.task_count]},e.id))]}),we?.captured_at&&(0,Y.jsxs)(`span`,{className:`map-capture`,children:[(0,Y.jsx)(P,{size:12}),new Date(we.captured_at).toLocaleDateString()]})]}),U===`live`&&ce.data&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button`,onClick:()=>se(!0),children:j?`加载范围`:`History range`}),!g&&_&&(0,Y.jsx)(`button`,{type:`button`,onClick:_,className:`map-scope-button`,children:j?`地图模型设置`:`Map model settings`}),Oe>0&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button map-narrow-only`,"aria-pressed":Te,onClick:De.toggle,children:Te?j?`隐藏计划替代连线 · ${Oe}`:`Hide plan changes · ${Oe}`:j?`显示计划替代连线 · ${Oe}`:`Show plan changes · ${Oe}`})]})]})]}),U===`live`&&ce.data&&(0,Y.jsx)(Sh,{open:oe||!le&&ce.data.requires_choice,info:ce.data,zh:j,readOnly:g,onChoose:pe}),U===`live`&&ce.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[j?`暂时无法检查历史记录。`:`Could not check session history.`,(0,Y.jsx)(`button`,{onClick:()=>void ce.refetch(),children:j?`重试`:`Retry`})]}),ue&&we?.history_loading&&(0,Y.jsxs)(`div`,{className:`map-history-progress`,role:`status`,children:[j?`正在分批加载历史记录`:`Loading history in pages`,we.history_progress&&` · ${(we.history_progress.loaded_bytes/1024/1024).toFixed(1)} / ${(we.history_progress.total_bytes/1024/1024).toFixed(1)} MB`,(0,Y.jsx)(`button`,{onClick:()=>se(!0),children:j?`更改范围`:`Change range`})]}),ue&&we&&(U===`live`?me.isError:te.isError)&&(0,Y.jsxs)(`div`,{className:`map-data-error`,role:`status`,children:[j?`暂时无法更新,已保留加载的地图。`:`Updates are unavailable. Your loaded map is preserved.`,(0,Y.jsx)(`button`,{onClick:()=>void(U===`live`?me.refetch():te.refetch()),children:j?`重试`:`Retry`})]}),G.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[j?`历史记录列表暂时无法读取,可切换当前会话或重试。`:`Historical maps are unavailable. Open the current session or retry.`,(0,Y.jsx)(`button`,{onClick:()=>void G.refetch(),children:j?`重试`:`Retry`})]}),ue?(U===`live`?me.isError:te.isError)&&!we?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:j?`地图暂时无法读取`:`Map unavailable`}),(0,Y.jsx)(`p`,{children:String(U===`live`?me.error:te.error)}),(0,Y.jsx)(`button`,{onClick:()=>void(U===`live`?me.refetch():te.refetch()),children:j?`重试`:`Retry`})]}):we?(0,Y.jsx)(yp,{children:(0,Y.jsx)(Ah,{data:we,actions:Ae,snapshot:e,currentTaskId:t,events:n,pendingLabel:r.at(-1)?.detail||r.at(-1)?.label,viewKey:q,paused:he,sessionId:e.session.id,zh:j,readOnly:g,replacements:De,activePhase:U===`live`&&!he&&!ve?e.roles.find(e=>e.active)?.role:void 0,waiting:ve,composer:je})},q):(0,Y.jsxs)(`div`,{className:`map-empty is-loading`,"aria-busy":`true`,children:[(0,Y.jsxs)(`div`,{className:`map-ghosts`,"aria-hidden":!0,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),j?`正在载入地图…`:`Loading map…`]}):(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:j?`地图尚未开启`:`Map is not enabled`}),(0,Y.jsx)(`p`,{children:ce.isPending?j?`正在检查历史记录规模…`:`Checking history size…`:j?`选择加载范围后查看研究进度。`:`Choose a history range to view research progress.`}),ce.data&&(0,Y.jsx)(`button`,{onClick:()=>se(!0),children:j?`选择加载范围`:`Choose history range`})]})]})});export{Ah as MapCanvas,jh as MapPanel,kh as MapTeamProgress}; \ No newline at end of file diff --git a/frontend/web/dist/assets/MapPanel-Bdo6K37E.js b/frontend/web/dist/assets/MapPanel-Bdo6K37E.js new file mode 100644 index 000000000..76bf05672 --- /dev/null +++ b/frontend/web/dist/assets/MapPanel-Bdo6K37E.js @@ -0,0 +1,7 @@ +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{D as n,E as r}from"./icons-DRlFT_ri.js";import{a as i,b as a,c as o,i as s}from"./query-CUzIxVzm.js";import{A as c,G as l,J as u,P as d,W as f,k as p}from"./index-DbdG0NfU.js";import{A as m,F as h,I as g,L as _,O as v,R as y,j as b,m as x,p as S,r as C}from"./AppearanceControls-vjVM_spw.js";import{n as w,t as T}from"./history-CBChoFHN.js";import{n as E,t as D}from"./play-utjdE9zp.js";import{a as O}from"./format-DsyV_JEZ.js";import{a as k,i as A,n as j}from"./useWorkbenchTheme-CXN9ftdE.js";import{$ as M,A as N,At as P,B as F,C as I,Ct as L,D as R,E as z,Et as B,F as ee,G as V,H,I as U,J as W,K as G,L as te,M as ne,N as re,Nt as ie,O as ae,Ot as K,P as oe,Pt as se,Q as ce,R as le,S as ue,St as de,T as fe,U as q,V as pe,X as me,Y as he,Z as ge,a as _e,at as ve,b as ye,bt as be,c as xe,ct as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,gt as Oe,ht as ke,i as Ae,it as je,j as Me,jt as Ne,k as Pe,kt as Fe,l as Ie,lt as Le,n as Re,nt as ze,o as Be,ot as Ve,p as J,pt as He,q as Ue,rt as We,s as Ge,st as Ke,tt as qe,u as Je,ut as Ye,vt as Xe,w as Ze,wt as Qe,x as $e,xt as et,yt as tt,z as nt}from"./App-d69nDaHg.js";var rt=y(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),it=y(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),at=y(`CornerDownLeft`,[[`polyline`,{points:`9 10 4 15 9 20`,key:`r3jprv`}],[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}]]),ot=y(`ListChecks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),st=y(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ct=y(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),lt=y(`Route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),ut=y(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),Y=r();function dt({events:e,connected:t,pending:n,artifacts:r,zh:i,onClose:a,onOpenArtifact:o,onOpenDelivery:s}){let l=e.filter(e=>e.type===`ui.operator`||e.type===`ui.argus`);return(0,Y.jsxs)(`aside`,{className:`map-conversation nowheel nodrag nopan`,"aria-label":i?`地图对话`:`Map conversation`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(L,{size:16}),(0,Y.jsx)(`strong`,{children:i?`与 ${c().name} 对话`:`Talk to ${c().name}`}),(0,Y.jsx)(`button`,{type:`button`,onClick:a,"aria-label":i?`关闭对话`:`Close conversation`,children:(0,Y.jsx)(v,{size:18})})]}),l.length?(0,Y.jsx)(J,{events:l,connected:t,showReasoning:!1,onToggleReasoning:()=>{},embedded:!0,showHeader:!1,artifacts:r,onOpenArtifact:o,onOpenDelivery:s}):(0,Y.jsx)(`p`,{className:`map-conversation-empty`,children:i?`在下方发送目标或问题,回复会保留在这里。`:`Send a goal or question below. Your conversation stays here.`}),n&&!l.some(e=>e.type===`ui.argus`&&e.live===!0)&&(0,Y.jsx)(`p`,{className:`map-conversation-pending`,role:`status`,children:i?`${c().name} 正在回复…`:`${c().name} is replying…`})]})}var X=e(n(),1),ft=u(),pt=(e,t,n)=>e+(t-e)*n,mt=e=>e*e*(3-2*e),ht=(e,t,n)=>Math.max(t,Math.min(n,e));function gt(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y),i=Math.min(140,Math.max(54,r*.22))*(t.x>=e.x?-1:1),a=Math.min(120,r*.3),o={x:ht(e.x+i,28,n-28),y:e.y-a},s={x:ht(t.x+i*.6,28,n-28),y:t.y+a};return n=>{let r=1-n;return{x:r**3*e.x+3*r**2*n*o.x+3*r*n**2*s.x+n**3*t.x,y:r**3*e.y+3*r**2*n*o.y+3*r*n**2*s.y+n**3*t.y}}}function _t({flight:e,canvas:t,zh:n,historical:r=!1,onReveal:i,onLand:a,onFinish:o}){let s=(0,X.useRef)(null),c=(0,X.useRef)(null),l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=`dispatch-wake-${(0,X.useId)().replace(/:/g,``)}`,f=(0,X.useRef)({onReveal:i,onLand:a,onFinish:o});f.current={onReveal:i,onLand:a,onFinish:o};let p=e.result?.type===`task`&&!r;return(0,X.useEffect)(()=>{if(!e.result)return;let n=0,i,a,o=()=>f.current.onFinish(e.id);if(e.result.type!==`task`||r)return i=setTimeout(o,2200),()=>clearTimeout(i);let d=s.current;if(!d)return;let p=e.result.taskId,m=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,h=t.current,g=()=>{cancelAnimationFrame(n),clearTimeout(i),f.current.onLand(e.id),o()};h?.addEventListener(`pointerdown`,g,{once:!0}),h?.addEventListener(`wheel`,g,{once:!0,passive:!0});let _=performance.now(),v=0,y=!1,b=0,x,S=r=>{if(r-_>6e3){o();return}let s=t.current?.querySelector(`.map-macro[data-task-id="${CSS.escape(p)}"]`);if(!s||s.getBoundingClientRect().width<8){r-v>600&&(f.current.onReveal(p),v=r),n=requestAnimationFrame(S);return}if(m){f.current.onLand(e.id),i=setTimeout(o,1200);return}y||(f.current.onReveal(p),y=!0,v=r);let h=s.getBoundingClientRect();if((!x||Math.abs(x.x-h.x)+Math.abs(x.y-h.y)+Math.abs(x.width-h.width)>.7)&&(b=r),x=h,r-v<360||r-b<100){n=requestAnimationFrame(S);return}let g=t.current?.querySelector(`.map-composer`)?.getBoundingClientRect(),C=g?{x:g.left,y:g.top,width:g.width,height:g.height}:e.origin,w={x:C.x+C.width/2,y:C.y+C.height/2},T={x:w.x,y:w.y-26},E={x:h.left+h.width/2,y:h.top+h.height/2},D=gt(T,E,innerWidth),O=Math.min(320,C.width),k=Math.min(68,C.height),A=performance.now(),j=!1,M=t=>{if(!s.isConnected){o();return}let r=Math.min(1,(t-A)/1050),p=mt(Math.min(1,r/.22)),m=mt(ht((r-.22)/.6,0,1)),h=mt(ht((r-.82)/.18,0,1)),g=r<.22?{x:w.x,y:pt(w.y,T.y,p)}:D(m),_=pt(52,22,h),v=pt(O,_,p),y=pt(k,_,p);if(d.style.width=`${v}px`,d.style.height=`${y}px`,d.style.transform=`translate3d(${g.x-v/2}px,${g.y-y/2}px,0)`,d.style.opacity=String(Math.min(1,r/.045)*(1-h)),d.style.setProperty(`--dispatch-copy`,String(1-mt(Math.min(1,r/.12)))),d.style.setProperty(`--dispatch-mark`,String(pt(1,.7,h))),d.dataset.phase=r<.22?`compress`:r<.82?`travel`:`arrive`,c.current&&l.current&&r>.22){let e=Math.max(0,m-.16),t=Array.from({length:13},(t,n)=>D(pt(e,m,n/12)));c.current.setAttribute(`d`,t.map((e,t)=>`${t?`L`:`M`} ${e.x} ${e.y}`).join(` `)),c.current.style.opacity=String(.7*(1-h)),l.current.setAttribute(`x1`,String(t[0].x)),l.current.setAttribute(`y1`,String(t[0].y)),l.current.setAttribute(`x2`,String(g.x)),l.current.setAttribute(`y2`,String(g.y))}r>=.82&&!j&&(j=!0,f.current.onLand(e.id),u.current&&(u.current.style.left=`${E.x}px`,u.current.style.top=`${E.y}px`,a=u.current.animate([{transform:`translate(-50%,-50%) scale(.65)`,opacity:.65},{transform:`translate(-50%,-50%) scale(2.8)`,opacity:0}],{duration:650,easing:`cubic-bezier(.16,1,.3,1)`,fill:`both`}))),r<1?n=requestAnimationFrame(M):i=setTimeout(o,550)};n=requestAnimationFrame(M)};return n=requestAnimationFrame(S),()=>{cancelAnimationFrame(n),clearTimeout(i),a?.cancel(),h?.removeEventListener(`pointerdown`,g),h?.removeEventListener(`wheel`,g)}},[e.id,e.result,t,r]),p?(0,ft.createPortal)((0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`svg`,{className:`map-dispatch-trail`,"aria-hidden":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{ref:l,id:d,gradientUnits:`userSpaceOnUse`,children:[(0,Y.jsx)(`stop`,{stopColor:`#6fbcce`,stopOpacity:`0`}),(0,Y.jsx)(`stop`,{offset:`1`,stopColor:`#87d9cf`})]})}),(0,Y.jsx)(`path`,{ref:c,fill:`none`,stroke:`url(#${d})`,strokeWidth:`2.5`,strokeLinecap:`round`})]}),(0,Y.jsxs)(`div`,{ref:s,className:`map-dispatch-flight`,"data-testid":`map-dispatch-flight`,"data-state":`task`,"data-task-id":e.result?.type===`task`?e.result.taskId:void 0,"aria-hidden":`true`,children:[(0,Y.jsx)(`div`,{className:`map-dispatch-symbol`,children:(0,Y.jsx)(j,{size:25})}),(0,Y.jsxs)(`div`,{className:`map-dispatch-copy`,children:[(0,Y.jsx)(`strong`,{children:e.text}),(0,Y.jsx)(`span`,{children:n?`进入任务地图`:`Into your task map`})]})]}),(0,Y.jsx)(`div`,{ref:u,className:`map-dispatch-halo`,"aria-hidden":`true`})]}),document.body):null}var vt=()=>({revision:0,cards:{},steps:{},links:{}}),yt=(e,t)=>`${e}\u0000${t}`,bt=class{initialized=!1;seen=new Set;revision=0;loadingHistory=!1;observe(e,t=!1){let n=vt(),r=0;for(let t of e.cards){this.seen.has(`card:${t.id}`)||(n.cards[t.id]=Math.min(r++*100,400)),this.seen.add(`card:${t.id}`);let i=e.layouts[t.id],a=0;for(let e of i.steps){let r=yt(t.id,e.id);this.seen.has(`step:${r}`)||(n.steps[r]=160+Math.min(a++*120,720)),this.seen.add(`step:${r}`)}for(let e of i.links){let r=yt(t.id,e.id);this.seen.has(`link:${r}`)||(n.links[r]=Math.max(0,(n.steps[yt(t.id,e.target)]??160)-160)),this.seen.add(`link:${r}`)}}for(let t of e.links)this.seen.has(`outer:${t.id}`)||(n.links[t.id]=0),this.seen.add(`outer:${t.id}`);let i=!this.initialized||t||this.loadingHistory;return this.loadingHistory=t,this.initialized=!0,i||![n.cards,n.steps,n.links].some(e=>Object.keys(e).length)?null:{...n,revision:++this.revision}}};function xt(e,t=!1){let n=(0,X.useRef)(new bt),r=(0,X.useRef)(new Set),[i,a]=(0,X.useState)(vt);return(0,X.useEffect)(()=>{let i=n.current.observe(e,t);if(t)r.current.forEach(clearTimeout),r.current.clear(),a(vt());else if(i){a(e=>({revision:i.revision,cards:{...e.cards,...i.cards},steps:{...e.steps,...i.steps},links:{...e.links,...i.links}}));let e=setTimeout(()=>{r.current.delete(e),a(e=>({revision:e.revision,cards:Object.fromEntries(Object.entries(e.cards).filter(([e])=>!(e in i.cards))),steps:Object.fromEntries(Object.entries(e.steps).filter(([e])=>!(e in i.steps))),links:Object.fromEntries(Object.entries(e.links).filter(([e])=>!(e in i.links)))}))},2e3);r.current.add(e)}},[e,t]),(0,X.useEffect)(()=>()=>{r.current.forEach(clearTimeout),r.current.clear()},[]),i}var St=e=>1-(1-e)**3;function Ct(e,t,n){let r=St(Math.min(1,Math.max(0,n))),i={};for(let n in t){let a=e[n],o=t[n];i[n]=!a||r>=1?o:{x:a.x+(o.x-a.x)*r,y:a.y+(o.y-a.y)*r}}return i}function wt(e,t){for(let n in t){let r=e[n];if(r&&(r.x!==t[n].x||r.y!==t[n].y))return!0}return!1}function Tt(e,t,n=680){let[r,i]=(0,X.useState)(e),a=(0,X.useRef)(e),o=(0,X.useRef)(e);return(0,X.useEffect)(()=>{if(e===o.current)return;o.current=e;let r=a.current;if(t||!wt(r,e)||typeof requestAnimationFrame!=`function`){a.current=e,i(e);return}let s=null,c=performance.now(),l=t=>{let o=(t-c)/n;if(o>=1){a.current=e,i(e),s=null;return}a.current=Ct(r,e,o),i(a.current),s=requestAnimationFrame(l)};return s=requestAnimationFrame(l),()=>{s!=null&&cancelAnimationFrame(s)}},[e,t,n]),r}var Et={edges:new Set,nodes:new Set};function Dt(e,t){if(!t)return Et;let n=new Set,r=new Set([t]);for(let i of e)(i.source===t||i.target===t)&&(n.add(i.id),r.add(i.source),r.add(i.target));return{edges:n,nodes:r}}var Ot=2600,kt=e=>Math.min(Math.max(e-1,0),10)*80,At=e=>kt(e)+320;function jt(e,t){let n=Math.max(0,Math.floor(e));if(n<60)return t?`${n} 秒`:`${n}s`;let r=Math.floor(n/60);if(r<60)return t?`${r} 分钟`:`${r} min`;let i=Math.floor(r/60),a=r%60;return t?`${i} 小时 ${a} 分`:`${i} h ${String(a).padStart(2,`0`)} min`}function Mt(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n{}};function Pt(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Ft.prototype=Pt.prototype={constructor:Ft,on:function(e,t){var n=this._,r=It(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Rt.hasOwnProperty(t)?{space:Rt[t],local:e}:e}function Bt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Vt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ht(e){var t=zt(e);return(t.local?Vt:Bt)(t)}function Ut(){}function Wt(e){return e==null?Ut:function(){return this.querySelector(e)}}function Gt(e){typeof e!=`function`&&(e=Wt(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i=v&&(v=_+1);!(b=g[v])&&++v=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Sn(e){e||=Cn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;at?1:e>=t?0:NaN}function wn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Tn(){return Array.from(this)}function En(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Rn:typeof t==`function`?Bn:zn)(e,t,n??``)):Hn(this.node(),e)}function Hn(e,t){return e.style.getPropertyValue(t)||Ln(e).getComputedStyle(e,null).getPropertyValue(t)}function Un(e){return function(){delete this[e]}}function Wn(e,t){return function(){this[e]=t}}function Gn(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Kn(e,t){return arguments.length>1?this.each((t==null?Un:typeof t==`function`?Gn:Wn)(e,t)):this.node()[e]}function qn(e){return e.trim().split(/^|\s+/)}function Jn(e){return e.classList||new Yn(e)}function Yn(e){this._node=e,this._names=qn(e.getAttribute(`class`)||``)}Yn.prototype={add:function(e){this._names.indexOf(e)<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 Xn(e,t){for(var n=Jn(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Tr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n()=>e;function qr(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){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:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}qr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Jr(e){return!e.ctrlKey&&!e.button}function Yr(){return this.parentNode}function Xr(e,t){return t??{x:e.x,y:e.y}}function Zr(){return navigator.maxTouchPoints||`ontouchstart`in this}function Qr(){var e=Jr,t=Yr,n=Xr,r=Zr,i={},a=Pt(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Br).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(Lr(n.view).on(`mousemove.drag`,m,Vr).on(`mouseup.drag`,h,Vr),Wr(n.view),Hr(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Ur(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){Lr(e.view).on(`mousemove.drag mouseup.drag`,null),Gr(e.view,l),Ur(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?xi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?xi(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=ci.exec(e))?new wi(t[1],t[2],t[3],1):(t=li.exec(e))?new wi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ui.exec(e))?xi(t[1],t[2],t[3],t[4]):(t=di.exec(e))?xi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fi.exec(e))?ji(t[1],t[2]/100,t[3]/100,1):(t=pi.exec(e))?ji(t[1],t[2]/100,t[3]/100,t[4]):mi.hasOwnProperty(e)?bi(mi[e]):e===`transparent`?new wi(NaN,NaN,NaN,0):null}function bi(e){return new wi(e>>16&255,e>>8&255,e&255,1)}function xi(e,t,n,r){return r<=0&&(e=t=n=NaN),new wi(e,t,n,r)}function Si(e){return e instanceof ti||(e=yi(e)),e?(e=e.rgb(),new wi(e.r,e.g,e.b,e.opacity)):new wi}function Ci(e,t,n,r){return arguments.length===1?Si(e):new wi(e,t,n,r??1)}function wi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}$r(wi,Ci,ei(ti,{brighter(e){return e=e==null?ri:ri**+e,new wi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ni:ni**+e,new wi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wi(ki(this.r),ki(this.g),ki(this.b),Oi(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:Ti,formatHex:Ti,formatHex8:Ei,formatRgb:Di,toString:Di}));function Ti(){return`#${Ai(this.r)}${Ai(this.g)}${Ai(this.b)}`}function Ei(){return`#${Ai(this.r)}${Ai(this.g)}${Ai(this.b)}${Ai((isNaN(this.opacity)?1:this.opacity)*255)}`}function Di(){let e=Oi(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ki(this.r)}, ${ki(this.g)}, ${ki(this.b)}${e===1?`)`:`, ${e})`}`}function Oi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ki(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ai(e){return e=ki(e),(e<16?`0`:``)+e.toString(16)}function ji(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Pi(e,t,n,r)}function Mi(e){if(e instanceof Pi)return new Pi(e.h,e.s,e.l,e.opacity);if(e instanceof ti||(e=yi(e)),!e)return new Pi;if(e instanceof Pi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Pi(o,s,c,e.opacity)}function Ni(e,t,n,r){return arguments.length===1?Mi(e):new Pi(e,t,n,r??1)}function Pi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}$r(Pi,Ni,ei(ti,{brighter(e){return e=e==null?ri:ri**+e,new Pi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ni:ni**+e,new Pi(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,i=2*n-r;return new wi(Li(e>=240?e-240:e+120,i,r),Li(e,i,r),Li(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pi(Fi(this.h),Ii(this.s),Ii(this.l),Oi(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(){let e=Oi(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Fi(this.h)}, ${Ii(this.s)*100}%, ${Ii(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Fi(e){return e=(e||0)%360,e<0?e+360:e}function Ii(e){return Math.max(0,Math.min(1,e||0))}function Li(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Ri=e=>()=>e;function zi(e,t){return function(n){return e+n*t}}function Bi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Vi(e){return(e=+e)==1?Hi:function(t,n){return n-t?Bi(t,n,e):Ri(isNaN(t)?n:t)}}function Hi(e,t){var n=t-e;return n?zi(e,n):Ri(isNaN(e)?t:e)}var Ui=(function e(t){var n=Vi(t);function r(e,t){var r=n((e=Ci(e)).r,(t=Ci(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Hi(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Wi(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Ji(r,i)})),n=Zi.lastIndex;return n180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Ji(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Ji(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Ji(e,n)},{i:s-2,x:Ji(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t=0&&e._call.call(void 0,t),e=e._next;--ga}function Ma(){Ca=(Sa=Ta.now())+wa,ga=_a=0;try{ja()}finally{ga=0,Pa(),Ca=0}}function Na(){var e=Ta.now(),t=e-Sa;t>ya&&(wa-=t,Sa=e)}function Pa(){for(var e,t=ba,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:ba=n);xa=e,Fa(r)}function Fa(e){ga||(_a&&=clearTimeout(_a),e-Ca>24?(e<1/0&&(_a=setTimeout(Ma,e-Ta.now()-wa)),va&&=clearInterval(va)):(va||=(Sa=Ta.now(),setInterval(Na,ya)),ga=1,Ea(Ma)))}function Ia(e,t,n){var r=new ka;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var La=Pt(`start`,`end`,`cancel`,`interrupt`),Ra=[];function za(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Ua(e,n,{name:t,index:r,group:i,on:La,tween:Ra,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ba(e,t){var n=Ha(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Va(e,t){var n=Ha(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function Ha(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Ua(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Aa(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Ia(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Ga(e){return this.each(function(){Wa(this,e)})}function Ka(e,t){var n,r;return function(){var i=Va(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o=0&&(e=e.slice(0,t)),!e||e===`start`})}function Co(e,t,n){var r,i,a=So(t)?Ba:Va;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function wo(e,t){var n=this._id;return arguments.length<2?Ha(this.node(),n).on.on(e):this.each(Co(n,e,t))}function To(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Eo(){return this.on(`end.remove`,To(this._id))}function Do(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Wt(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o()=>e;function rs(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function is(e,t,n){this.k=e,this.x=t,this.y=n}is.prototype={constructor:is,scale:function(e){return e===1?this:new is(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new is(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 as=new is(1,0,0);os.prototype=is.prototype;function os(e){for(;!e.__zoom;)if(!(e=e.parentNode))return as;return e.__zoom}function ss(e){e.stopImmediatePropagation()}function cs(e){e.preventDefault(),e.stopImmediatePropagation()}function ls(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function us(){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 ds(){return this.__zoom||as}function fs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ps(){return navigator.maxTouchPoints||`ontouchstart`in this}function ms(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function hs(){var e=ls,t=us,n=ms,r=fs,i=ps,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ha,l=Pt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,ds).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,ds),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(as.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new is(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new is(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new is(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Lr(this.that).datum();l.call(e,this.that,new rs(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=zr(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Wa(this),s.start();cs(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Lr(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=zr(t,i),l=t.clientX,u=t.clientY;Wr(t.view),ss(t),a.mouse=[c,this.__zoom.invert(c)],Wa(this),a.start();function d(e){if(cs(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=zr(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Gr(e.view,a.moved),cs(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=zr(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);cs(r),s>0?Lr(this).transition().duration(s).call(x,d,c,r):Lr(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(ss(t),s=0;s`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} 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.`},_s=[[-1/0,-1/0],[1/0,1/0]],vs=[`Enter`,` `,`Escape`],ys={"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`},bs;(function(e){e.Strict=`strict`,e.Loose=`loose`})(bs||={});var xs;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(xs||={});var Ss;(function(e){e.Partial=`partial`,e.Full=`full`})(Ss||={});var Cs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ws;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(ws||={});var Ts;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Ts||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var Es={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function Ds(e){return e===null?null:e?`valid`:`invalid`}var Os=e=>`id`in e&&`source`in e&&`target`in e,ks=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),As=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),js=(e,t=[0,0])=>{let{width:n,height:r}=dc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ms=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:qs(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):As(n)?n:t.nodeLookup.get(n.id)),Gs(e,i?Ys(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Ns=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Gs(n,Ys(e)),r=!0)}),r?qs(n):{x:0,y:0,width:0,height:0}},Ps=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=Zs(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Fs=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Is(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Ls({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=cc(Ns(Is(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function Rs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,gs.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&uc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=uc(d)?Vs(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,gs.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function zs({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Fs(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var Bs=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Vs=(e={x:0,y:0},t,n)=>({x:Bs(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Bs(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hs(e,t,n){let{width:r,height:i}=dc(n),{x:a,y:o}=n.internals.positionAbsolute;return Vs(e,[[a,o],[a+r,o+i]],t)}var Us=(e,t,n)=>en?-Bs(Math.abs(e-n),1,t)/t:0,Ws=(e,t,n=15,r=40)=>[Us(e.x,r,t.width-r)*n,Us(e.y,r,t.height-r)*n],Gs=(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)}),Ks=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),qs=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Js=(e,t=[0,0])=>{let{x:n,y:r}=As(e)?e.internals.positionAbsolute:js(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ys=(e,t=[0,0])=>{let{x:n,y:r}=As(e)?e.internals.positionAbsolute:js(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Xs=(e,t)=>qs(Gs(Ks(e),Ks(t))),Zs=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},Qs=(e,t)=>Zs(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),$s=e=>ec(e.width)&&ec(e.height)&&ec(e.x)&&ec(e.y),ec=e=>!isNaN(e)&&isFinite(e),tc=(e,t)=>(e,t)=>{},nc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),rc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?nc(s,o):s},ic=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ac(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let 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 oc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=ac(e,n),i=ac(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=ac(e.top??e.y??0,n),i=ac(e.bottom??e.y??0,n),a=ac(e.left??e.x??0,t),o=ac(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function sc(e,t,n,r,i,a){let{x:o,y:s}=ic(e,[t,n,r]),{x:c,y:l}=ic({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var cc=(e,t,n,r,i,a)=>{let o=oc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=Bs(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=sc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},lc=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function uc(e){return e!=null&&e!==`parent`}function dc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function fc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function pc(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function mc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function hc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function gc(e){return{...ys,...e||{}}}function _c(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Cc(e),s=rc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?nc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var vc=e=>({width:e.offsetWidth,height:e.offsetHeight}),yc=e=>e?.getRootNode?.()||window?.document,bc=[`INPUT`,`SELECT`,`TEXTAREA`];function xc(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?bc.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Sc=e=>`clientX`in e,Cc=(e,t)=>{let n=Sc(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},wc=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...vc(t)}})};function Tc({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Ec(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Dc({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Ec(t-r,a),n];case Q.Right:return[t+Ec(r-t,a),n];case Q.Top:return[t,n-Ec(n-i,a)];case Q.Bottom:return[t,n+Ec(i-n,a)]}}function Oc({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Dc({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Dc({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Tc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function kc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n0}var Mc=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Nc=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Pc=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,gs.error006()),t;let r=n.getEdgeId||Mc,i;return i=Os(e)?{...e}:{...e,id:r(e)},Nc(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Fc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=kc({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Ic={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},Lc=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.xMath.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function zc({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=Ic[t],c=Ic[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Lc({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=kc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Bc(e,t,n,r){let i=Math.min(Rc(e,t)/2,Rc(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.xe.id===t):e[0])||null}function qc(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Jc(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=qc(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var Yc=1e3,Xc=10,Zc={nodeOrigin:[0,0],nodeExtent:_s,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Qc={...Zc,checkEquality:!0};function $c(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function el(e,t,n){let r=$c(Zc,n);for(let n of e.values())if(n.parentId)al(n,e,t,r);else{let e=Vs(js(n,r.nodeOrigin),uc(n.extent)?n.extent:r.nodeExtent,dc(n));n.internals.positionAbsolute=e}}function tl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function nl(e){return e===`manual`}function rl(e,t,n,r={}){let i=$c(Qc,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!nl(i.zIndexMode)?Yc:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=Vs(js(u,i.nodeOrigin),uc(u.extent)?u.extent:i.nodeExtent,dc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:tl(u,e),z:ol(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&al(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function il(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function al(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=$c(Zc,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}il(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*Xc),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=sl(e,u,o,s,a&&!nl(c)?Yc:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function ol(e,t,n){let r=ec(e.zIndex)?e.zIndex:0;return nl(n)?r:r+(e.selected?t:0)}function sl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=dc(e),l=js(e,n),u=uc(e.extent)?Vs(l,e.extent,c):l,d=Vs({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Hs(d,c,t));let f=ol(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function cl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=Xs(a.get(n.parentId)?.expandedRect??Js(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=dc(a),l=a.origin??r,u=t.x0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width0){let e=cl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function ul({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function dl(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function fl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;dl(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),dl(`target`,s,c,e,i,o),t.set(r.id,r)}}function pl(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:pl(n,t):!1}function ml(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function hl(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!pl(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function gl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function _l({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=nc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function vl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=Lr(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Ks(Ns(s)):null,x=v&&l?_l({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:nc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=Rs({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=gl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Ws(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=_c(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=hl(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=gl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Qr().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=_c(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Cc(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=_c(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Cc(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Cc(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=gl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!ml(t,`.${g}`,v))&&(!_||ml(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function yl(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())Qs(i,Js(e))>0&&r.push(e);return r}var bl=250;function xl(e,t,n,r){let i=[],a=1/0,o=yl(e,n,t+bl);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Gc(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function Sl(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Gc(o,c,c.position,!0)}:c}function Cl(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function wl(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Tl=()=>!0;function El(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Tl,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=yc(e.target),E=0,D,{x:O,y:k}=Cc(e),A=Cl(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=Sl(i,A,r,c,t);if(!N)return;let P=Cc(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=Ws(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},ee=c.get(i),V={inProgress:!0,isValid:null,from:Gc(ee,B,Q.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:ee,to:P,toHandle:null,toPosition:Es[B.position],toNode:null,pointer:P};function H(){M=!0,y(V),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&H();function U(e){if(!M){let{x:t,y:n}=Cc(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;H()}if(!x()||!B){W(e);return}let a=b();P=Cc(e,j),D=xl(rc(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=Dl(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=wl(!!D,s.isValid);let u=c.get(i),f=u?Gc(u,B,Q.Left,!0):V.from,p={...V,from:f,isValid:L,to:s.toHandle&&L?ic({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:Es[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),V=p}function W(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,U),T.removeEventListener(`mouseup`,W),T.removeEventListener(`touchmove`,U),T.removeEventListener(`touchend`,W)}}T.addEventListener(`mousemove`,U),T.addEventListener(`mouseup`,W),T.addEventListener(`touchmove`,U),T.addEventListener(`touchend`,W)}function Dl(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Tl,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Cc(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=Cl(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===bs.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=Sl(t,e,a,u,n,!0)}return _}var Ol={onPointerDown:El,isValid:Dl};function kl({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Lr(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&lc()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=hs().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:zr}}var Al=e=>({x:e.x,y:e.y,zoom:e.k}),jl=({x:e,y:t,zoom:n})=>as.translate(e,t).scale(n),Ml=(e,t)=>e.target.closest(`.${t}`),Nl=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Pl=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Fl=(e,t=0,n=Pl,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Il=e=>{let t=e.ctrlKey&&lc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ll({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Ml(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=zr(u),t=d*2**Il(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===xs.Vertical?0:u.deltaX*f,m=i===xs.Horizontal?0:u.deltaY*f;!lc()&&u.shiftKey&&i!==xs.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=Al(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function Rl({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=Ml(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function zl({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Al(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function Bl({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Nl(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,Al(a.transform))}}function Vl({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Nl(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=Al(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Hl({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(Ml(d,`${l}-flow__node`)||Ml(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||Ml(d,s)&&m||Ml(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function Ul({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=hs().scaleExtent([t,n]).translateExtent(r),f=Lr(e).call(d);v({x:i.x,y:i.y,zoom:Bs(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(Il);async function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).transform(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!ec(E)||E<0?0:E);let k=O?Ll({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Rl({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});f.on(`wheel.zoom`,k,{passive:!1});let A=zl({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,A);let j=Bl({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,j);let M=Vl({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,M);let N=Hl({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(N),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=jl(e),i=d?.constrain()(r,t,n);return i&&await h(i),i}async function y(e,t){let n=jl(e);return await h(n,t),n}function b(e){if(f){let t=jl(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?os(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).scaleTo(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).scaleBy(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!ec(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var Wl;(function(e){e.Line=`line`,e.Handle=`handle`})(Wl||={});function Gl({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function Kl(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function ql(e,t){return Math.max(0,t-e)}function Jl(e,t){return Math.max(0,e-t)}function Yl(e,t,n){return Math.max(0,t-e,e-n)}function Xl(e,t){return e?!t:t}function Zl(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=Yl(E,h,g),j=Yl(D,_,v);if(o){let e=0,t=0;c&&w<0?e=ql(y+w+O,o[0][0]):!c&&w>0&&(e=Jl(y+E+O,o[1][0])),l&&T<0?t=ql(b+T+k,o[0][1]):!l&&T>0&&(t=Jl(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Jl(y+w,s[0][0]):!c&&w<0&&(e=ql(y+E,s[1][0])),l&&T>0?t=Jl(b+T,s[0][1]):!l&&T<0&&(t=ql(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=Yl(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Jl(b+k+E/C,o[1][1])*C:ql(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?ql(b+E/C,s[1][1])*C:Jl(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=Yl(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Jl(y+D*C+O,o[1][0])/C:ql(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?ql(y+D*C,s[1][0])/C:Jl(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(Xl(c,l)?-w:w)/C:w=(Xl(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Ql={width:0,height:0,x:0,y:0},$l={...Ql,pointerX:0,pointerY:0,aspectRatio:1};function eu(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function tu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=Lr(e),o={controlDirection:Kl(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Ql},h={...$l};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:Kl(e)};let g,_=null,v=[],y,b,x,S=!1,C=Qr().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=_c(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=uc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=eu(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=_c(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=Zl(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var nu=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ru=t(((e,t)=>{t.exports=nu()})),iu=t((e=>{var t=n(),r=ru();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),au=e(t(((e,t)=>{t.exports=iu()}))(),1),ou=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},su=e=>e?ou(e):ou,{useDebugValue:cu}=X.default,{useSyncExternalStoreWithSelector:lu}=au.default,uu=e=>e;function du(e,t=uu,n){let r=lu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return cu(r),r}var fu=(e,t)=>{let n=su(e),r=(e,r=t)=>du(n,e,r);return Object.assign(r,n),r},pu=(e,t)=>e?fu(e,t):fu;function mu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var hu=(0,X.createContext)(null),gu=hu.Provider,_u=gs.error001(`react`);function $(e,t){let n=(0,X.useContext)(hu);if(n===null)throw Error(_u);return du(n,e,t)}function vu(){let e=(0,X.useContext)(hu);if(e===null)throw Error(_u);return(0,X.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var yu={display:`none`},bu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},xu=`react-flow__node-desc`,Su=`react-flow__edge-desc`,Cu=`react-flow__aria-live`,wu=e=>e.ariaLiveMessage,Tu=e=>e.ariaLabelConfig;function Eu({rfId:e}){let t=$(wu);return(0,Y.jsx)(`div`,{id:`${Cu}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:bu,children:t})}function Du({rfId:e,disableKeyboardA11y:t}){let n=$(Tu);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{id:`${xu}-${e}`,style:yu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Y.jsx)(`div`,{id:`${Su}-${e}`,style:yu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Y.jsx)(Eu,{rfId:e})]})}var Ou=(0,X.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,Y.jsx)(`div`,{className:Mt([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Ou.displayName=`Panel`;var ku=`https://reactflow.dev?utm_source=attribution`;function Au({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Y.jsx)(Ou,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ku}`,children:(0,Y.jsx)(`a`,{href:ku,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var ju=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Mu=e=>e.id;function Nu(e,t){return mu(e.selectedNodes.map(Mu),t.selectedNodes.map(Mu))&&mu(e.selectedEdges.map(Mu),t.selectedEdges.map(Mu))}function Pu({onSelectionChange:e}){let t=vu(),{selectedNodes:n,selectedEdges:r}=$(ju,Nu);return(0,X.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Fu=e=>!!e.onSelectionChangeHandlers;function Iu({onSelectionChange:e}){let t=$(Fu);return e||t?(0,Y.jsx)(Pu,{onSelectionChange:e}):null}var Lu=[0,0],Ru={x:0,y:0,zoom:1},zu=[...`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`.split(`.`),`rfId`],Bu=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}),Vu={translateExtent:_s,nodeOrigin:Lu,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Hu(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(Bu,mu),l=vu();(0,X.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Vu,s()}),[]);let u=(0,X.useRef)(Vu);return(0,X.useEffect)(()=>{for(let s of zu){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:gc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},zu.map(t=>e[t])),null}function Uu(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function Wu(e){let[t,n]=(0,X.useState)(e===`system`?null:e);return(0,X.useEffect)(()=>{if(e!==`system`){n(e);return}let t=Uu(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?Uu()?.matches?`dark`:`light`:t}var Gu=typeof document<`u`?document:null;function Ku(e=null,t={target:Gu,actInsideInputWithModifier:!0}){let[n,r]=(0,X.useState)(!1),i=(0,X.useRef)(!1),a=(0,X.useRef)(new Set([])),[o,s]=(0,X.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,` +`).replace(` + +`,` ++`).split(` +`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,X.useEffect)(()=>{let n=t?.target??Gu,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&xc(e))return!1;let n=Ju(e.code,s);if(a.current.add(e[n]),qu(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=Ju(e.code,s);qu(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function qu(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Ju(e,t){return t.includes(e)?`code`:`key`}var Yu=()=>{let e=vu();return(0,X.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=cc(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return rc(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=ic(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Xu(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)Zu(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function Zu(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(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)}}function Qu(e,t){return Xu(e,t)}function $u(e,t){return Xu(e,t)}function ed(e,t){return{id:e,type:`select`,selected:t}}function td(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(ed(a.id,e)))}return r}function nd({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function rd(e){return{id:e.id,type:`remove`}}var id=tc(`React Flow`,`https://reactflow.dev/`);function ad(e,t,n={}){return Pc(e,t,{...n,onError:n.onError??id})}var od=e=>ks(e),sd=e=>Os(e);function cd(e){return(0,X.forwardRef)(e)}var ld=typeof window<`u`?X.useLayoutEffect:X.useEffect;function ud(e){let[t,n]=(0,X.useState)(BigInt(0)),[r]=(0,X.useState)(()=>dd(()=>n(e=>e+BigInt(1))));return ld(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function dd(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var fd=(0,X.createContext)(null);function pd({children:e}){let t=vu(),n=ud((0,X.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=nd({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=ud((0,X.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(nd({items:s,lookup:o}))},[])),i=(0,X.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,Y.jsx)(fd.Provider,{value:i,children:e})}function md(){let e=(0,X.useContext)(fd);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var hd=e=>!!e.panZoom;function gd(){let e=Yu(),t=vu(),n=md(),r=$(hd),i=(0,X.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=od(e)?e:n.get(e.id),a=i.parentId?pc(i.position,i.measured,i.parentId,n,r):i.position;return Js({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&od(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&sd(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await zs({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(rd);o?.(f),c(e)}if(m){let e=d.map(rd);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=$s(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=Js(s?r:a),l=Qs(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=$s(e)?e:a(e);if(!r)return!1;let i=Qs(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Ms(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??hc();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,X.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var _d=e=>e.selected,vd=typeof window<`u`?window:void 0;function yd({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=vu(),{deleteElements:r}=gd(),i=Ku(e,{actInsideInputWithModifier:!1}),a=Ku(t,{target:vd});(0,X.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(_d),edges:e.filter(_d)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,X.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function bd(e){let t=vu();(0,X.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=vc(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,gs.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var xd={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Sd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Cd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=xs.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=vu(),S=(0,X.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=$(Sd,mu),E=Ku(f),D=(0,X.useRef)();bd(S);let O=(0,X.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,X.useEffect)(()=>{if(S.current){D.current=Ul({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,X.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,Y.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:xd,children:m})}var wd=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Td(){let{userSelectionActive:e,userSelectionRect:t}=$(wd,mu);return e&&t?(0,Y.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}var Ed=(e,t)=>n=>{n.target===t.current&&e?.(n)},Dd=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Od({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ss.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,X.useRef)(0),_=vu(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(Dd,mu),C=y&&(e||v),w=(0,X.useRef)(null),T=(0,X.useRef)(),E=(0,X.useRef)(new Set),D=(0,X.useRef)(new Set),O=(0,X.useRef)(!1),k=(0,X.useRef)(!1),A=(0,X.useRef)({x:0,y:0}),j=(0,X.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=Cc(n.nativeEvent,T.current),l=rc({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=ic(d,i),m={startX:d.x,startY:d.y,x:ee.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}mc(h,E.current)||c(td(a,E.current,!0)),mc(g,D.current)||l(td(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!T.current)return;let[e,t]=Ws(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(R)})}let z=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,X.useEffect)(()=>()=>z(),[]);let B=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Cc(e.nativeEvent,T.current);A.current={x:o,y:c};let l=ic({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(R(),!0),L(o,c)},ee=e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),z())},V=e=>{e.target?.releasePointerCapture?.(e.pointerId),z()},H=r===!0||Array.isArray(r)&&r.includes(0);return(0,Y.jsxs)(`div`,{className:Mt([`react-flow__pane`,{draggable:H,dragging:b,selection:e}]),onClick:C?void 0:Ed(M,w),onContextMenu:Ed(N,w),onWheel:Ed(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?B:p,onPointerUp:ee,onPointerCancel:C?V:void 0,onPointerDownCapture:C?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:xd,children:[h,(0,Y.jsx)(Td,{})]})}function kd({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,gs.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function Ad({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=vu(),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)();return(0,X.useEffect)(()=>{u.current=vl({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{kd({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,X.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var jd=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Md(){let e=vu();return(0,X.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=jd(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=nc(t,i));let{position:a,positionAbsolute:s}=Rs({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Nd=(0,X.createContext)(null),Pd=Nd.Provider;Nd.Consumer;var Fd=()=>(0,X.useContext)(Nd),Id=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Ld=(0,X.createContext)(null);function Rd({children:e}){let t=$(Id,mu);return(0,Y.jsx)(Ld.Provider,{value:t,children:e})}function zd(){let e=(0,X.useContext)(Ld);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var Bd={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Vd=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return Bd;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===bs.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Hd({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=vu(),_=Fd(),{connectOnClick:v,noPanClassName:y,rfId:b}=zd(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(Vd(_,m,e),mu);_||g.getState().onError?.(`010`,gs.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(ad(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Sc(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Ol.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,Y.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Mt([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=yc(t.target),h=n||c,{connection:v,isValid:y}=Ol.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var Ud=(0,X.memo)(cd(Hd));function Wd({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[e?.label,(0,Y.jsx)(Ud,{type:`source`,position:n,isConnectable:t})]})}function Gd({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ud,{type:`target`,position:n,isConnectable:t}),e?.label,(0,Y.jsx)(Ud,{type:`source`,position:r,isConnectable:t})]})}function Kd(){return null}function qd({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ud,{type:`target`,position:n,isConnectable:t}),e?.label]})}var Jd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Yd={input:Wd,default:Gd,output:qd,group:Kd};function Xd(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var Zd=e=>{let{width:t,height:n,x:r,y:i}=Ns(e.nodeLookup,{filter:e=>!!e.selected});return{width:ec(t)?t:null,height:ec(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Qd({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=vu(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(Zd,mu),c=Md(),l=(0,X.useRef)(null);(0,X.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(Ad({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,Y.jsx)(`div`,{className:Mt([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,Y.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Jd,e.key)&&(e.preventDefault(),c({direction:Jd[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var $d=typeof window<`u`?window:void 0,ef=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function tf({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:R}=$(ef,mu),z=Ku(l,{target:$d}),B=Ku(h,{target:$d}),ee=B||w,V=B||b,H=u&&ee!==!0,U=z||R||H;return yd({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,Y.jsx)(Cd,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:V,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!z&&ee,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:H,children:(0,Y.jsxs)(Od,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ee,autoPanOnSelection:T,isSelecting:!!U,selectionMode:d,selectionKeyPressed:z,paneClickDistance:s,selectionOnDrag:H,children:[e,L&&(0,Y.jsx)(Qd,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}tf.displayName=`FlowRenderer`;var nf=(0,X.memo)(tf),rf=e=>t=>e?Ps(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function af(e){return $((0,X.useCallback)(rf(e),[e]),mu)}var of=e=>e.updateNodeInternals;function sf(){let e=$(of),[t]=(0,X.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,X.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function cf({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=vu(),a=(0,X.useRef)(null),o=(0,X.useRef)(null),s=(0,X.useRef)(e.sourcePosition),c=(0,X.useRef)(e.targetPosition),l=(0,X.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,X.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,X.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,X.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function lf({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},mu),S=y.type||`default`,C=g?.[S]||Yd[S];C===void 0&&(v?.(`003`,gs.error003(S)),S=`default`,C=g?.default||Yd.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=vu(),k=fc(y),A=cf({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=Ad({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=Md();if(y.hidden)return null;let N=dc(y),P=Xd(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,R=i?e=>i(e,{...b.userNode}):void 0,z=a?e=>a(e,{...b.userNode}):void 0,B=o?e=>o(e,{...b.userNode}):void 0,ee=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&kd({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},V=t=>{if(!(xc(t.nativeEvent)||m)){if(vs.includes(t.key)&&T){let n=t.key===`Escape`;kd({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(Jd,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:Jd[t.key],factor:t.shiftKey?4:1})}}},H=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Ps(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,Y.jsx)(`div`,{className:Mt([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:R,onContextMenu:z,onClick:ee,onDoubleClick:B,onKeyDown:D?V:void 0,tabIndex:D?0:void 0,onFocus:D?H:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${xu}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,Y.jsx)(Pd,{value:e,children:(0,Y.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var uf=(0,X.memo)(lf),df=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ff(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=$(df,mu),o=af(e.onlyRenderVisibleElements),s=sf();return(0,Y.jsx)(`div`,{className:`react-flow__nodes`,style:xd,children:o.map(o=>(0,Y.jsx)(uf,{id:o,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:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}ff.displayName=`NodeRenderer`;var pf=(0,X.memo)(ff);function mf(e){return $((0,X.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&jc({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),mu)}var hf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,Y.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},gf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,Y.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},_f={[Ts.Arrow]:hf,[Ts.ArrowClosed]:gf};function vf(e){let t=vu();return(0,X.useMemo)(()=>Object.prototype.hasOwnProperty.call(_f,e)?_f[e]:(t.getState().onError?.(`009`,gs.error009(e)),null),[e])}var yf=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=vf(t);return c?(0,Y.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,Y.jsx)(c,{color:n,strokeWidth:o})}):null},bf=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,X.useMemo)(()=>Jc(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,Y.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,Y.jsx)(`defs`,{children:i.map(e=>(0,Y.jsx)(yf,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};bf.displayName=`MarkerDefinitions`;var xf=(0,X.memo)(bf);function Sf({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,X.useState)({x:1,y:0,width:0,height:0}),p=Mt([`react-flow__edge-textwrapper`,l]),m=(0,X.useRef)(null);return(0,X.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,Y.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,Y.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,Y.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Sf.displayName=`EdgeText`;var Cf=(0,X.memo)(Sf);function wf({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{...u,d:e,fill:`none`,className:Mt([`react-flow__edge-path`,u.className])}),l?(0,Y.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&ec(t)&&ec(n)?(0,Y.jsx)(Cf,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Tf({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Ef({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=Tf({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Tf({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Tc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Df(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Ef({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Of=Df({isInternal:!1}),kf=Df({isInternal:!0});Of.displayName=`SimpleBezierEdge`,kf.displayName=`SimpleBezierEdgeInternal`;function Af(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Vc({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var jf=Af({isInternal:!1}),Mf=Af({isInternal:!0});jf.displayName=`SmoothStepEdge`,Mf.displayName=`SmoothStepEdgeInternal`;function Nf(e){return(0,X.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,Y.jsx)(jf,{...n,id:r,pathOptions:(0,X.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Pf=Nf({isInternal:!1}),Ff=Nf({isInternal:!0});Pf.displayName=`StepEdge`,Ff.displayName=`StepEdgeInternal`;function If(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Fc({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var Lf=If({isInternal:!1}),Rf=If({isInternal:!0});Lf.displayName=`StraightEdge`,Rf.displayName=`StraightEdgeInternal`;function zf(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Oc({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,Y.jsx)(wf,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var Bf=zf({isInternal:!1}),Vf=zf({isInternal:!0});Bf.displayName=`BezierEdge`,Vf.displayName=`BezierEdgeInternal`;var Hf={default:Vf,straight:Rf,step:Ff,smoothstep:Mf,simplebezier:kf},Uf={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Wf=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,Gf=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,Kf=`react-flow__edgeupdater`;function qf({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,Y.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Mt([Kf,`${Kf}-${s}`]),cx:Wf(t,r,e),cy:Gf(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function Jf({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=vu(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Ol.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(e===!0||e===`source`)&&(0,Y.jsx)(qf,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,Y.jsx)(qf,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function Yf({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||Hf[x];S===void 0&&(_?.(`011`,gs.error011(x)),x=`default`,S=h?.default||Hf.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,X.useRef)(null),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),j=vu(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=$((0,X.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return Uf;let i=Uc({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=Ac({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||Uf,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),mu),z=(0,X.useMemo)(()=>y.markerStart?`url('#${qc(y.markerStart,m)}')`:void 0,[y.markerStart,m]),B=(0,X.useMemo)(()=>y.markerEnd?`url('#${qc(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let ee=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},V=a?e=>{a(e,{...y})}:void 0,H=o?e=>{o(e,{...y})}:void 0,U=s?e=>{s(e,{...y})}:void 0,W=c?e=>{c(e,{...y})}:void 0,G=l?e=>{l(e,{...y})}:void 0;return(0,Y.jsx)(`svg`,{style:{zIndex:M},children:(0,Y.jsxs)(`g`,{className:Mt([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:ee,onDoubleClick:V,onContextMenu:H,onMouseEnter:U,onMouseMove:W,onMouseLeave:G,onKeyDown:C?t=>{if(!v&&vs.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${Su}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,Y.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:z,markerEnd:B,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,Y.jsx)(Jf,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var Xf=(0,X.memo)(Yf),Zf=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Qf({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(Zf,mu),b=mf(t);return(0,Y.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,Y.jsx)(xf,{defaultColor:e,rfId:n}),b.map(e=>(0,Y.jsx)(Xf,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}Qf.displayName=`EdgeRenderer`;var $f=(0,X.memo)(Qf),ep=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function tp({children:e}){let t=$(ep);return(0,Y.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:t},children:e})}function np(e){let t=gd(),n=(0,X.useRef)(!1);(0,X.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var rp=e=>e.panZoom?.syncViewport;function ip(e){let t=$(rp),n=vu();return(0,X.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function ap(e){return e.connection.inProgress?{...e.connection,to:rc(e.connection.to,e.transform)}:{...e.connection}}function op(e){return e?t=>e(ap(t)):ap}function sp(e){return $(op(e),mu)}var cp=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function lp({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(cp,mu);return a&&i&&c?(0,Y.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,Y.jsx)(`g`,{className:Mt([`react-flow__connection`,Ds(s)]),children:(0,Y.jsx)(up,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var up=({style:e,type:t=ws.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=sp();if(!i)return;if(n)return(0,Y.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Ds(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case ws.Bezier:[m]=Oc(h);break;case ws.SimpleBezier:[m]=Ef(h);break;case ws.Step:[m]=Vc({...h,borderRadius:0});break;case ws.SmoothStep:[m]=Vc(h);break;default:[m]=Fc(h)}return(0,Y.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};up.displayName=`ConnectionLine`;var dp={};function fp(e=dp){(0,X.useRef)(e),vu(),(0,X.useEffect)(()=>{},[e])}function pp(){vu(),(0,X.useRef)(!1),(0,X.useEffect)(()=>{},[])}function mp({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:z,autoPanOnSelection:B,onPaneClick:ee,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneScroll:W,onPaneContextMenu:G,paneClickDistance:te,nodeClickDistance:ne,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:K,reconnectRadius:oe,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:q,nodeExtent:pe,rfId:me,viewport:he,onViewportChange:ge}){return fp(e),fp(t),pp(),np(n),ip(he),(0,Y.jsx)(nf,{onPaneClick:ee,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneContextMenu:G,onPaneScroll:W,paneClickDistance:te,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:z,autoPanOnSelection:B,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:q,onViewportChange:ge,isControlledViewport:!!he,children:(0,Y.jsxs)(tp,{children:[(0,Y.jsx)($f,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,onlyRenderVisibleElements:T,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:K,reconnectRadius:oe,defaultMarkerColor:M,noPanClassName:fe,disableKeyboardA11y:q,rfId:me}),(0,Y.jsx)(lp,{style:h,type:m,component:g,containerStyle:_}),(0,Y.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,Y.jsx)(pf,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ne,onlyRenderVisibleElements:T,noPanClassName:fe,noDragClassName:ue,disableKeyboardA11y:q,nodeExtent:pe,rfId:me}),(0,Y.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}mp.displayName=`GraphView`;var hp=(0,X.memo)(mp),gp=tc(`React Flow`,`https://reactflow.dev/`),_p=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??_s;fl(h,g,_);let{nodesInitialized:x}=rl(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=cc(Ns(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:_s,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bs.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Cs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gp,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:ys,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},vp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>pu((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await Ls({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{..._p({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=rl(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();fl(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=ll(e,n,r,i,a,o,l);d&&(el(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=Gc(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=cl(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(Qu(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n($u(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>ed(e,!0)));return}i(td(r,new Set([...e]),!0)),a(td(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>ed(e,!0)));return}a(td(n,new Set([...e]))),i(td(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(ed(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(ed(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,ed(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,ed(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(rl(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return ul({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Cs}})},updateConnection:e=>{p({connection:e})},reset:()=>p({..._p()})}},Object.is);function yp({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,X.useState)(()=>vp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,Y.jsx)(gu,{value:m,children:(0,Y.jsx)(pd,{children:(0,Y.jsx)(Rd,{children:p})})})}function bp({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,X.useContext)(hu)?(0,Y.jsx)(Y.Fragment,{children:e}):(0,Y.jsx)(yp,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var xp={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Sp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:R=ws.Bezier,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,deleteKeyCode:V=`Backspace`,selectionKeyCode:H=`Shift`,selectionOnDrag:U=!1,selectionMode:W=Ss.Full,panActivationKeyCode:G=`Space`,multiSelectionKeyCode:te=lc()?`Meta`:`Control`,zoomActivationKeyCode:ne=lc()?`Meta`:`Control`,snapToGrid:re,snapGrid:ie,onlyRenderVisibleElements:ae=!1,selectNodesOnDrag:K,nodesDraggable:oe,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,nodeOrigin:ue=Lu,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:q=!0,defaultViewport:pe=Ru,minZoom:me=.5,maxZoom:he=2,translateExtent:ge=_s,preventScrolling:_e=!0,nodeExtent:ve,defaultMarkerColor:ye=`#b1b1b7`,zoomOnScroll:be=!0,zoomOnPinch:xe=!0,panOnScroll:Se=!1,panOnScrollSpeed:Ce=.5,panOnScrollMode:we=xs.Free,zoomOnDoubleClick:Te=!0,panOnDrag:Ee=!0,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne=1,nodeClickDistance:Pe=0,children:Fe,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:J,onEdgeMouseLeave:He,reconnectRadius:Ue=10,onNodesChange:We,onEdgesChange:Ge,noDragClassName:Ke=`nodrag`,noWheelClassName:qe=`nowheel`,noPanClassName:Je=`nopan`,fitView:Ye,fitViewOptions:Xe,connectOnClick:Ze,attributionPosition:Qe,proOptions:$e,defaultEdgeOptions:et,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:nt=!1,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanOnSelection:ot=!0,autoPanSpeed:st,connectionRadius:ct,isValidConnection:lt,onError:ut,style:dt,id:ft,nodeDragThreshold:pt,connectionDragThreshold:mt,viewport:ht,onViewportChange:gt,width:_t,height:vt,colorMode:yt=`light`,debug:bt,onScroll:xt,ariaLabelConfig:St,zIndexMode:Ct=`basic`,...wt},Tt){let Et=ft||`1`,Dt=Wu(yt),Ot=(0,X.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),xt?.(e)},[xt]);return(0,Y.jsx)(`div`,{"data-testid":`rf__wrapper`,...wt,onScroll:Ot,style:{...dt,...xp},ref:Tt,className:Mt([`react-flow`,i,Dt]),id:ft,role:`application`,children:(0,Y.jsxs)(bp,{nodes:e,edges:t,width:_t,height:vt,fitView:Ye,fitViewOptions:Xe,minZoom:me,maxZoom:he,nodeOrigin:ue,nodeExtent:ve,zIndexMode:Ct,children:[(0,Y.jsx)(Hu,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:oe,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:q,elevateNodesOnSelect:tt,elevateEdgesOnSelect:nt,minZoom:me,maxZoom:he,nodeExtent:ve,onNodesChange:We,onEdgesChange:Ge,snapToGrid:re,snapGrid:ie,connectionMode:L,translateExtent:ge,connectOnClick:Ze,defaultEdgeOptions:et,fitView:Ye,fitViewOptions:Xe,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Je,nodeOrigin:ue,rfId:Et,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:ut,connectionRadius:ct,isValidConnection:lt,selectNodesOnDrag:K,nodeDragThreshold:pt,connectionDragThreshold:mt,onBeforeDelete:I,debug:bt,ariaLabelConfig:St,zIndexMode:Ct}),(0,Y.jsx)(hp,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,selectionKeyCode:H,selectionOnDrag:U,selectionMode:W,deleteKeyCode:V,multiSelectionKeyCode:te,panActivationKeyCode:G,zoomActivationKeyCode:ne,onlyRenderVisibleElements:ae,defaultViewport:pe,translateExtent:ge,minZoom:me,maxZoom:he,preventScrolling:_e,zoomOnScroll:be,zoomOnPinch:xe,zoomOnDoubleClick:Te,panOnScroll:Se,panOnScrollSpeed:Ce,panOnScrollMode:we,panOnDrag:Ee,autoPanOnSelection:ot,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne,nodeClickDistance:Pe,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:J,onEdgeMouseLeave:He,reconnectRadius:Ue,defaultMarkerColor:ye,noDragClassName:Ke,noWheelClassName:qe,noPanClassName:Je,rfId:Et,disableKeyboardA11y:rt,nodeExtent:ve,viewport:ht,onViewportChange:gt}),(0,Y.jsx)(Iu,{onSelectionChange:k}),Fe,(0,Y.jsx)(Au,{proOptions:$e,position:Qe}),(0,Y.jsx)(Du,{rfId:Et,disableKeyboardA11y:rt})]})})}var Cp=cd(Sp),wp=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Tp({children:e}){let t=$(wp);return t?(0,ft.createPortal)(e,t):null}function Ep(e){let[t,n]=(0,X.useState)(e);return[t,n,(0,X.useCallback)(e=>n(t=>Qu(e,t)),[])]}var Dp=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(let[,{internals:e}]of t.nodeLookup)if(e.handleBounds===void 0||!fc(e.userNode))return!1;return!0};function Op(e={includeHiddenNodes:!1}){return $(Dp(e))}gs.error014();function kp({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,Y.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Mt([`react-flow__background-pattern`,n,r])})}function Ap({radius:e,className:t}){return(0,Y.jsx)(`circle`,{cx:e,cy:e,r:e,className:Mt([`react-flow__background-pattern`,`dots`,t])})}var jp;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(jp||={});var Mp={[jp.Dots]:1,[jp.Lines]:1,[jp.Cross]:6},Np=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Pp({id:e,variant:t=jp.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,X.useRef)(null),{transform:f,patternId:p}=$(Np,mu),m=r||Mp[t],h=t===jp.Dots,g=t===jp.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,Y.jsxs)(`svg`,{className:Mt([`react-flow__background`,l]),style:{...c,...xd,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,Y.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,Y.jsx)(Ap,{radius:y/2,className:u}):(0,Y.jsx)(kp,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,Y.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}Pp.displayName=`Background`;var Fp=(0,X.memo)(Pp);function Ip(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,Y.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function Lp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,Y.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function Rp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,Y.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 zp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 Bp(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 Vp({children:e,className:t,...n}){return(0,Y.jsx)(`button`,{type:`button`,className:Mt([`react-flow__controls-button`,t]),...n,children:e})}var Hp=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Up({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=vu(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(Hp,mu),{zoomIn:y,zoomOut:b,fitView:x}=gd();return(0,Y.jsxs)(Ou,{className:Mt([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Vp,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,Y.jsx)(Ip,{})}),(0,Y.jsx)(Vp,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,Y.jsx)(Lp,{})})]}),n&&(0,Y.jsx)(Vp,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,Y.jsx)(Rp,{})}),r&&(0,Y.jsx)(Vp,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,Y.jsx)(Bp,{}):(0,Y.jsx)(zp,{})}),u]})}Up.displayName=`Controls`;var Wp=(0,X.memo)(Up);function Gp({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,Y.jsx)(`rect`,{className:Mt([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var Kp=(0,X.memo)(Gp),qp=e=>e.nodes.map(e=>e.id),Jp=e=>e instanceof Function?e:()=>e;function Yp({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Kp,onClick:o}){let s=$(qp,mu),c=Jp(t),l=Jp(e),u=Jp(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,Y.jsx)(Y.Fragment,{children:s.map(e=>(0,Y.jsx)(Zp,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function Xp({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=dc(r);return{node:r,x:i,y:a,width:o,height:s}},mu);return!l||l.hidden||!fc(l)?null:(0,Y.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var Zp=(0,X.memo)(Xp),Qp=(0,X.memo)(Yp),$p=200,em=150,tm=e=>!e.hidden,nm=e=>{let 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?Xs(Ns(e.nodeLookup,{filter:tm}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},rm=`react-flow__minimap-desc`;function im({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=vu(),S=(0,X.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(nm,mu),j=e?.width??$p,M=e?.height??em,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,z=C.x-(I-C.width)/2-R,B=C.y-(L-C.height)/2-R,ee=I+R*2,V=L+R*2,H=`${rm}-${T}`,U=(0,X.useRef)(0),W=(0,X.useRef)();U.current=F,(0,X.useEffect)(()=>{if(S.current&&E)return W.current=kl({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>U.current}),()=>{W.current?.destroy()}},[E]),(0,X.useEffect)(()=>{W.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let G=p?e=>{let[t,n]=W.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,te=m?(0,X.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ne=_??A[`minimap.ariaLabel`];return(0,Y.jsx)(Ou,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F: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 o==`number`?o:void 0},className:Mt([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,Y.jsxs)(`svg`,{width:j,height:M,viewBox:`${z} ${B} ${ee} ${V}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":H,ref:S,onClick:G,children:[ne&&(0,Y.jsx)(`title`,{id:H,children:ne}),(0,Y.jsx)(Qp,{onClick:te,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,Y.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${z-R},${B-R}h${ee+R*2}v${V+R*2}h${-ee-R*2}z + M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}im.displayName=`MiniMap`;var am=(0,X.memo)(im),om=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,sm={[Wl.Line]:`right`,[Wl.Handle]:`bottom-right`};function cm({nodeId:e,position:t,variant:n=Wl.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=Fd(),y=typeof e==`string`?e:v,b=vu(),x=(0,X.useRef)(null),S=n===Wl.Handle,C=$((0,X.useCallback)(om(S&&p),[S,p]),mu),w=(0,X.useRef)(null),T=t??sm[n];(0,X.useEffect)(()=>{if(!(!x.current||!y))return w.current||=tu({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=cl([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...pc({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,Y.jsx)(`div`,{className:Mt([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,X.memo)(cm);function lm({path:e,delay:t,padding:n=24,children:r}){let i=`map-growth-${(0,X.useId)().replace(/:/g,``)}`;if(t==null)return(0,Y.jsx)(Y.Fragment,{children:r});let a=(e.match(/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/gi)??[]).map(Number),o=a.filter((e,t)=>t%2==0),s=a.filter((e,t)=>t%2==1);if(!o.length||!s.length)return(0,Y.jsx)(Y.Fragment,{children:r});let c=Math.min(...o)-n,l=Math.min(...s)-n;return(0,Y.jsxs)(`g`,{"data-map-growing-edge":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`mask`,{id:i,maskUnits:`userSpaceOnUse`,x:c,y:l,width:Math.max(...o)-c+n,height:Math.max(...s)-l+n,children:(0,Y.jsx)(`path`,{className:`map-growth-mask`,d:e,pathLength:1,fill:`none`,stroke:`white`,strokeWidth:n*2,strokeLinecap:`round`,style:{animationDelay:`${t}ms`}})})}),(0,Y.jsx)(`g`,{mask:`url(#${i})`,children:r})]})}function um({layout:e,growing:t={},activeStep:n,activeTeamSteps:r=[]}){let i=`submap-arrow-${(0,X.useId)().replace(/:/g,``)}`;return(0,Y.jsxs)(`svg`,{className:`submap-relations`,width:e.width,height:e.height,"aria-label":`Task process relationships`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`marker`,{id:i,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6.5`,markerHeight:`6.5`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,fill:`var(--map-edge-context, #6f8ca8)`})})}),e.links.map(a=>{let o=e.positions[a.source],s=e.positions[a.target],c=o.x===s.x&&s.y>o.y,l=o.x+(c?116:232),u=o.y+(c?180:90),d=s.x+(c?116:0),f=s.y+(c?0:90),p=(l+d)/2,m=(u+f)/2,h=c?`M ${l} ${u} L ${d} ${f}`:`M ${l} ${u} C ${p} ${u}, ${p} ${f}, ${d} ${f}`;return(0,Y.jsxs)(`g`,{"data-testid":`submap-relation`,"data-relation":a.relation,"data-source":a.source,"data-target":a.target,"aria-label":`${a.label}: ${a.explanation}`,children:[(0,Y.jsx)(`title`,{children:a.explanation}),(0,Y.jsx)(lm,{path:h,delay:t[a.id],children:(0,Y.jsx)(`path`,{className:`submap-relation-path`,d:h,fill:`none`,stroke:`var(--map-edge-context, #6f8ca8)`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeDasharray:a.contextual?`5 6`:void 0,markerEnd:`url(#${i})`})}),(n===a.target||r.includes(a.target))&&(0,Y.jsx)(`path`,{className:`submap-flow`,d:h,pathLength:1,fill:`none`,stroke:`#4b9cae`,strokeWidth:`3`,strokeDasharray:`.09 .91`,strokeLinecap:`round`,"aria-hidden":`true`}),(0,Y.jsxs)(`g`,{className:`submap-relation-label`,transform:`translate(${p}, ${m})`,children:[(0,Y.jsx)(`rect`,{x:`-38`,y:`-11`,width:`76`,height:`22`,rx:`6`}),(0,Y.jsx)(`text`,{textAnchor:`middle`,dominantBaseline:`central`,children:a.label})]})]},a.id)})]})}function dm({role:e,since:t,zh:n,text:r}){let[i,a]=(0,X.useState)(()=>Date.now()/1e3);(0,X.useEffect)(()=>{if(t==null||r)return;let e=setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(e)},[t,r]);let o=t==null?null:jt(i-t,n);return(0,Y.jsxs)(`div`,{className:`map-card-live`,"data-testid":`map-card-live`,"data-waiting":!!r||void 0,"aria-live":`off`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{title:r,children:r||(0,Y.jsxs)(Y.Fragment,{children:[Oe(e,n),o?n?` · 本次已进行 ${o}`:` · ${o} this run`:``]})})]})}var fm=(0,X.createContext)({notes:{}}),pm=(0,X.createContext)({}),mm={plan:[`计划`,`Plan`],execution:[`动手处理`,`Work`],review:[`检查结果`,`Check`],revision:[`修订`,`Revise`],result:[`结果`,`Result`]},hm={plan:E,execution:D,review:m,revision:ct,result:K},gm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],review_unavailable:[`这次结果检查没有完成`,`Result check did not finish`],held:[`工作暂停,后续尚未安排`,`Work paused; no next step scheduled`],aborted:[`已取消`,`Cancelled`],cancelled:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已被新计划替代`,`Replaced by a new plan`],question:[`等待答复`,`Waiting for an answer`],paused:[`已暂停`,`Paused`],paused_external_work:[`等待后台任务`,`Waiting on background work`],missing:[`记录中缺失`,`Not in this record`],unknown:[`状态未知`,`Unknown`],continue:[`需再改一轮`,`Another pass needed`],blocked:[`受阻`,`Held up`],started:[`进行中`,`Under way`],recorded:[`已记录`,`On record`],requested:[`修改建议`,`Requested`],replan:[`需要调整计划`,`Plan needs adjusting`],replan_requested:[`需要调整计划`,`Plan needs adjusting`]},_m={plan:[`接下来要做什么,为什么这样做`,`What to do next and why`],execution:[`实际做了什么,遇到了什么问题`,`What was done and what happened`],review:[`结果是否正确,有什么依据`,`Whether the result is correct and what supports it`],revision:[`检查后发现需要修改的地方`,`What the check found needs changing`],result:[`这项任务最后得到了什么`,`What the task produced in the end`]},vm={plan:[`提问`,`Asked`],execution:[`Argus 查证`,`Argus`],review:[`核对`,`Check`],revision:[`修订`,`Revise`],result:[`回答`,`Answer`]},ym={plan:[`你提出的要求`,`What you asked for`],execution:[`Argus 自己动手查证、运行命令`,`Argus did the work itself: read, searched, ran commands`],review:[`对结果的核对`,`A check of the result`],revision:[`需要修改的地方`,`What had to change`],result:[`Argus 给出的回答`,`What Argus answered`]},bm=(e,t)=>e.source===`team`?t?`子任务工作记录`:`Subtask work record`:e.source===`task`?t?`任务记录`:`Task record`:e.source===`interval`?t?`根据同期记录关联`:`By execution window`:t?`来自任务记录`:`Linked event`,xm=(0,X.memo)(function({id:e,data:t}){let{task:n,ordinal:r,zh:i,layout:a,focused:o,detailed:s}=t,{artifacts:c,onOpenArtifact:l}=(0,X.useContext)(pm),u=(0,X.useContext)(fm).notes[n.id]??[],[d]=(0,X.useState)(()=>!!t.revealing||!t.restoring&&!t.seenCards?.has(e));(0,X.useEffect)(()=>{t.seenCards?.add(e)},[t.seenCards,e]);let[f,p]=(0,X.useState)(null),m=f||a,h=e=>e.source===`team`&&a.steps.find(t=>t.id===e.id)||e,_=t.canvasSize?.width||window.innerWidth,y=t.canvasSize?.height||window.innerHeight;(0,X.useEffect)(()=>{s||(x(null),p(null),t.readCopy?.(e,null))},[s]);let[b,x]=(0,X.useState)(null),S=(0,X.useRef)(n.status),[w,T]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=S.current!==n.status;if(S.current=n.status,!e||n.status!==`done`||t.completionScope)return;T(!0);let r=setTimeout(()=>T(!1),1500);return()=>clearTimeout(r)},[n.status,t.completionScope]);let E=m.steps.find(e=>e.id===b),D=E?h(E):void 0,O=D?.updatedAt??D?.ts,k=t.part===t.partCount,A=!k||t.completionScope?`recorded`:n.status===`missing`?`missing`:t.paused&&ge.has(n.status)?`paused`:Ve(n),j=A===`paused`&&n.status===`paused_external_work`?n.status:A,M=Math.min(t.frame.width/288,t.frame.height/280),N=t.copy?.cards||{},P=!!N[n.id]?.summary&&N[n.id]?.task_status!==n.status&&(ge.has(n.status)||n.status===`pending`),I=e=>{if(e.completionScope||e.status===`review_unavailable`)return;let t=N[e.id];if(e.source!==`team`)return t;let n=t?.event_ids?.indexOf(e.id)??-1;return h(e).revision&&n>=0&&t?.event_revisions?.[n]===h(e).revision?t:void 0},L=n.kind===`turn`?void 0:t.words,R=(t.completionScope?``:N[n.id]?.title)||L?.title||n.title,z=i?`环节 ${t.start}–${t.end} / ${t.totalSteps}`:`Steps ${t.start}–${t.end} / ${t.totalSteps}`,B=t.partCount>1&&!k?m.steps.map(e=>I(e)?.summary||h(e).summary||h(e).detail).filter(e=>e&&![q(!0),q(!1)].includes(e)).at(-1):void 0,ee=k&&n.objective&&n.objective.trim()!==n.title.trim(),V=A===`review_unavailable`?i?`当次审查器未能给出判断,未形成审阅结论。`:`The Reviewer could not return a judgment on this attempt.`:(t.completionScope?``:N[n.id]?.summary)||L?.summary||``,H=(k?n.pending_question:``)||B||V||t.completionScope||n.pending_question||G(n.summary||``,i).summary||n.summary||(ee?``:n.objective),U=Math.min(t.frame.width/m.width,t.frame.height/m.height),W=k&&t.live&&ge.has(n.status)?[...m.steps].reverse().find(e=>e.source!==`team`&&![`plan`,`result`].includes(e.kind))?.id:null,te=t.paused?null:W,ne=a.steps.filter(e=>e.source===`team`),re=t.live?ne.filter(e=>ge.has(e.status)).map(e=>e.id):[],ae=ne.filter(e=>e.status===`done`).length,K=ne.filter(e=>ge.has(e.status)).length,oe=(i?`子任务 ${ae}/${ne.length} 完成 · ${K} 进行中`:`Subtasks ${ae}/${ne.length} done · ${K} running`)+((t.plannedWidth??0)>ne.length?i?` · 计划并行 ×${t.plannedWidth}`:` · planned ×${t.plannedWidth}`:``),se=e=>e.source===`team`?re.includes(e.id):te===e.id,ce=e=>e.source===`team`?h(e).status:W===e.id?t.paused?`paused`:`running`:e.status,le=e=>({source:t.source,task_id:n.id,task_title:R,lang:i?`zh`:`en`,part:t.partCount>1?t.part:void 0,step_id:e?.id,step_title:e?.title,team_id:e?.teamId,team_task_id:e?.teamTaskId,event_ids:e?e.eventIds:t.partCount>1?[...new Set(m.steps.flatMap(e=>e.eventIds))]:N[n.id]?.event_ids||[]}),ue=Math.min(640,m.width-48,Math.max(260,(_-50)/1.05)),de=Math.min(600,m.height-48,Math.max(300,(y-(_<640?180:160))/1.05)),fe=e=>({x:Math.max(24,Math.min(m.positions[e.id].x-16,m.width-ue-24)),y:Math.max(24,Math.min(m.positions[e.id].y-16,m.height-de-24)),width:ue,height:de,scale:U}),pe=D?fe(D):null,me=n=>{p(m),x(n.id),t.readCopy?.(e,n.id),t.readStep(e,fe(n))};(0,X.useEffect)(()=>{D&&t.readStep(e,fe(D))},[_,y]);let he=e=>(gm[e===`paused_external_work`?e:e.startsWith(`paused_`)?`paused`:ge.has(e)?`running`:e]??gm.unknown)[+!i],_e=t.completionScope?i?`当次结束 · 当时目标未完成`:`Execution ended · goal incomplete then`:n.turn_kind===`qa`&&[`done`,`running`,`cancelled`,`failed`].includes(A)?{done:[`已回答`,`Answered`],running:[`正在回答`,`Answering`],cancelled:[`已中断`,`Interrupted`],failed:[`回答失败`,`Answer failed`]}[A][+!i]:he(j);return(0,Y.jsxs)(`article`,{className:`map-macro map-state-${A}`,"data-testid":`map-macro`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,"data-history":!k,"data-has-history":!!t.historyCount,"data-arrive":!!t.arriving||d&&!!t.revealing,"data-lit":!!t.lit,"data-hovered":!!t.hovered,"data-growing":t.growthDelay!=null,"data-dispatch":t.dispatchState,style:{animationDelay:`${t.growthDelay??(t.arriving?kt(r):0)}ms`},"data-focused":o,"data-detailed":s,"aria-label":R,"data-completed-now":w,"data-active":re.length>0||k&&t.live&&!t.paused&&ge.has(n.status),onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(),{x:e.clientX,y:e.clientY})},children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(Ud,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsxs)(`div`,{className:`macro-summary`,"aria-hidden":s,style:{"--summary-height":`${t.frame.height/M-20}px`,width:t.frame.width/M-20,transform:`translate(-50%, -50%) scale(${M})`},children:[(0,Y.jsxs)(`button`,{className:`map-card map-state-${A} nodrag nopan`,"data-testid":`map-card`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,tabIndex:s?-1:0,onClick:()=>n.turn_kind===`qa`&&t.readCopy?t.readCopy(e,n.id):t.open(e),"aria-label":`${R} · ${n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`放大任务`:`Explore task`}`,children:[(0,Y.jsxs)(`div`,{className:`map-card-top`,children:[(0,Y.jsxs)(`span`,{className:`map-card-number`,children:[n.turn_kind===`qa`?i?`问答`:`Q&A`:k?i?`任务`:`MISSION`:i?`历史`:`HISTORY`,` `,String(r).padStart(2,`0`),!k&&` · ${t.part}/${t.partCount}`]}),(A!==`recorded`||t.completionScope)&&(0,Y.jsxs)(`span`,{className:`map-status`,children:[A===`done`?(0,Y.jsx)(g,{size:11}):A===`failed`?(0,Y.jsx)(v,{size:11}):A===`review_unavailable`?(0,Y.jsx)(tt,{size:11}):A===`question`?(0,Y.jsx)(Ne,{size:11}):A===`paused`||A===`held`?(0,Y.jsx)(et,{size:11}):(0,Y.jsx)(`span`,{className:`map-state-dot`}),_e]})]}),(0,Y.jsxs)(`h3`,{children:[(0,Y.jsx)(Ae,{children:R}),u.length>0&&(0,Y.jsx)(`span`,{className:`macro-note-badge`,title:i?`操作员批注`:`Operator notes`,children:u.length})]}),ee&&!V&&(0,Y.jsx)(`p`,{className:`map-card-objective`,title:n.objective,children:n.objective}),H&&H.trim()!==(ee?n.objective.trim():``)&&(0,Y.jsx)(`div`,{className:`map-card-copy`,children:(0,Y.jsx)(Ae,{children:H})}),t.conclusion&&(0,Y.jsx)(`p`,{className:`map-card-conclusion`,"data-testid":`map-card-conclusion`,title:t.conclusion,children:t.conclusion}),n.kind!==`turn`&&(0,Y.jsx)(`div`,{className:`map-card-course`,"aria-label":i?`任务经过`:`Course of the task`,children:[`plan`,`execution`,`review`,`result`].map(e=>{let t=hm[e],n=m.steps.some(t=>t.kind===e),r=m.steps.some(t=>t.kind===e&&se(t)),a=i?{plan:`规划`,execution:`执行`,review:`审查`,result:`交付`}[e]:mm[e][1];return(0,Y.jsxs)(`span`,{className:`submap-kind-${e}`,"data-present":n,"data-active":r,title:a,children:[(0,Y.jsx)(t,{size:12,"aria-hidden":!0}),(0,Y.jsx)(`b`,{children:a})]},e)})}),(()=>{let e=k&&t.live&&t.waiting,r=!e&&k&&t.live&&!t.paused&&ge.has(n.status),a=A!==`recorded`||!!t.completionScope,o=!!t.historyCount&&ne.length>0;return!r&&!e&&k&&a&&!o?null:(0,Y.jsxs)(`div`,{className:`map-card-stages`,children:[e?(0,Y.jsx)(dm,{text:t.waiting,zh:i}):r?(0,Y.jsx)(dm,{role:t.phase??n.role,since:n.started_ts,zh:i}):k&&a?null:(0,Y.jsx)(`span`,{className:`map-card-recorded`,children:k?_e:i?`历史记录 · 非当前执行`:`History · not current execution`}),o&&(0,Y.jsx)(`span`,{className:`map-card-team-summary`,children:oe})]})})(),k&&ne.length>0&&(0,Y.jsx)(`span`,{className:`map-card-teambar`,"aria-hidden":!0,children:(0,Y.jsx)(`i`,{style:{width:`${Math.round(ae/ne.length*100)}%`}})}),(0,Y.jsxs)(`div`,{className:`map-card-bottom`,children:[(0,Y.jsx)(`span`,{className:ne.length?`map-card-team-summary`:void 0,title:z,children:n.turn_kind===`qa`?i?`问题与回答`:`Question and answer`:t.historyCount?``:ne.length?oe:t.plannedWidth&&ge.has(n.status)?i?`并行编队 ×${t.plannedWidth} 展开中`:`Fanning out ×${t.plannedWidth}`:t.partCount>1?z:`${m.steps.length} ${i?`个环节`:`steps`}`}),(0,Y.jsxs)(`span`,{className:`map-card-submap-hint`,children:[P?i?`描述更新中`:`Summary updating`:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`查看进展`:`View progress`,(0,Y.jsx)(ie,{size:12})]})]})]}),!!t.historyCount&&t.toggleHistory&&(0,Y.jsxs)(`button`,{type:`button`,className:`map-history-toggle nodrag nopan`,"aria-expanded":t.historyExpanded,"aria-label":`${i?`任务历史`:`Mission history`}: ${R}`,title:i?`保留全部 ${t.totalSteps} 个环节`:`All ${t.totalSteps} steps retained`,onClick:()=>t.toggleHistory?.(n.id),children:[t.historyExpanded?i?`收起历史`:`Hide history`:`${i?`历史`:`History`} ${t.historyCount}`,(0,Y.jsx)(ie,{size:12})]})]}),o&&(0,Y.jsxs)(`div`,{className:`macro-detail ${D?`is-reading`:``}`,"data-stacked":m.stacked||void 0,"aria-hidden":!s,style:{width:m.width,height:m.height,transform:`scale(${U})`,transformOrigin:`top left`},children:[(0,Y.jsxs)(`header`,{className:`macro-heading`,children:[(0,Y.jsx)(`span`,{className:`macro-index`,children:String(r).padStart(2,`0`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`small`,{children:t.partCount>1?i?`第 ${t.part} / ${t.partCount} 部分`:`Part ${t.part} / ${t.partCount}`:n.turn_kind===`qa`?i?`问答内容`:`Q&A`:i?`任务内部`:`INSIDE THIS TASK`}),(0,Y.jsx)(`h2`,{children:(0,Y.jsx)(Ae,{children:R})})]}),t.conclusion&&(0,Y.jsx)(`span`,{className:`macro-conclusion`,"data-testid":`macro-conclusion`,title:t.conclusion,children:t.conclusion}),(A!==`recorded`||t.completionScope)&&(0,Y.jsx)(`span`,{className:`macro-state`,title:t.completionScope,children:_e}),s&&k?(0,Y.jsx)(C,{"data-testid":`map-task-read`,className:`nodrag nopan text-xs`,onClick:()=>{if(n.turn_kind===`qa`){t.readCopy?.(e,n.id);return}x(null),p(null),t.readCopy?.(e,n.id)},children:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`阅读任务说明`:`Read task explanation`}):null]}),(0,Y.jsx)(`div`,{className:`macro-stage-key`,children:F.filter(e=>n.kind!==`turn`||m.steps.some(t=>t.kind===e)).map(e=>(0,Y.jsx)(`span`,{className:`submap-kind-${e} ${m.steps.some(t=>t.kind===e)?``:`is-unrecorded`}`,title:n.kind===`turn`?ym[e][+!i]:_m[e][+!i],children:n.kind===`turn`?vm[e][+!i]:mm[e][+!i]},e))}),u.length>0&&(0,Y.jsxs)(`aside`,{className:`macro-notes`,"aria-label":i?`操作员批注`:`Operator notes`,children:[(0,Y.jsx)(`small`,{children:i?`批注`:`Notes`}),u.map(e=>(0,Y.jsx)(`p`,{children:e.text},e.id))]}),(0,Y.jsx)(um,{layout:m,growing:t.growingLinks,activeStep:te,activeTeamSteps:re}),m.columns.map(e=>(0,Y.jsx)(`div`,{className:`macro-column-label`,style:{left:e.x,top:e.y},children:e.title},e.id)),m.steps.map((e,r)=>{let a=h(e),o=hm[a.kind];return(0,Y.jsxs)(`button`,{className:`submap-step submap-kind-${a.kind} nodrag nopan ${b===a.id?`is-selected`:``}`,"data-testid":`submap-step`,"data-step-id":a.id,"data-source":a.source,"data-team-id":a.teamId,"data-team-task-id":a.teamTaskId,"data-status":ce(a),"data-active":se(a),"data-growing":t.growingSteps?.[a.id]!=null,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(a),{x:e.clientX,y:e.clientY})},style:{animationDelay:`${t.growingSteps?.[a.id]??0}ms`,"--step-index":r,left:m.positions[a.id].x,top:m.positions[a.id].y},tabIndex:s?0:-1,onClick:()=>me(a),"aria-expanded":b===a.id,children:[(0,Y.jsxs)(`div`,{className:`submap-step-meta`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(o,{size:16}),a.source===`team`?i?`子任务 · `:`Subtask · `:``,(n.kind===`turn`?vm:mm)[a.kind][+!i],a.round!=null&&(0,Y.jsx)(`em`,{className:`submap-round`,children:i?`第 ${a.round} 轮`:`Round ${a.round}`})]}),(0,Y.jsx)(`small`,{"data-verdict":a.source===`team`&&Se(h(a).teamOutcome)||void 0,children:a.completionScope&&a.status===`recorded`?i?`执行结束`:`Execution ended`:a.source===`team`&&ce(a)===`failed`?i?`失败`:`Failed`:a.source===`team`&&Le(h(a).teamOutcome,i)||he(ce(a))})]}),(0,Y.jsx)(`h4`,{children:(0,Y.jsx)(Ae,{children:a.title})}),(0,Y.jsx)(`div`,{className:`submap-step-copy`,children:(0,Y.jsx)(Ae,{children:I(a)?.summary||h(a).summary||a.detail||q(i)})}),(0,Y.jsxs)(`div`,{className:`submap-step-foot`,children:[(0,Y.jsxs)(`span`,{title:bm(a,i),children:[i?`查看详情`:`Read more`,a.workCount?(0,Y.jsx)(`em`,{className:`submap-step-work`,children:i?` · ${a.workCount} 步操作`:` · ${a.workCount} actions`}):null]}),(0,Y.jsx)(ie,{size:14})]})]},a.id)}),t.partCount>1&&!D&&(0,Y.jsxs)(`nav`,{className:`macro-part-nav nodrag nopan`,"aria-label":i?`任务各部分`:`Task parts`,children:[(0,Y.jsx)(`span`,{children:z}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{disabled:!t.previousId,onClick:()=>t.previousId&&t.open(t.previousId,!0),children:[(0,Y.jsx)(rt,{size:14}),i?`上一部分`:`Previous part`]}),(0,Y.jsxs)(`button`,{disabled:!t.nextId,onClick:()=>t.nextId&&t.open(t.nextId,!0),children:[i?`下一部分`:`Next part`,(0,Y.jsx)(ie,{size:14})]})]})]}),D&&pe&&(0,Y.jsxs)(`section`,{className:`macro-reader nodrag nopan nowheel`,"data-testid":`map-reader`,"data-kind":D.kind,role:`region`,"aria-label":i?`卡片详情`:`Card details`,style:{left:pe.x,top:pe.y,width:pe.width,height:pe.height},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(D),{x:e.clientX,y:e.clientY})},children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsxs)(`span`,{children:[(n.kind===`turn`?vm:mm)[D.kind][+!i],n.turn_kind!==`qa`&&(0,Y.jsx)(`small`,{className:`macro-reader-note`,children:_m[D.kind][+!i]})]}),(0,Y.jsx)(`button`,{"aria-label":`Close step details`,onClick:()=>{x(null),p(null),t.readCopy?.(e,null),t.open(e)},children:(0,Y.jsx)(v,{size:20})})]}),(0,Y.jsx)(`h3`,{children:(0,Y.jsx)(Ae,{children:I(D)?.title||D.title})}),(0,Y.jsx)(`div`,{className:`macro-reader-body`,children:(0,Y.jsx)(ye,{cardKey:D.id,taskId:n.id,card:I(D),task:n,readOnly:t.readOnly,originalDetail:D.detail||q(i),selection:t.readerCopy,artifacts:c,onOpenArtifact:l})}),(0,Y.jsxs)(`footer`,{children:[(0,Y.jsx)(`span`,{title:bm(D,i),children:O?new Date(O*1e3).toLocaleString(i?`zh-CN`:`en-US`):``}),!t.readOnly&&(0,Y.jsx)(`button`,{onClick:()=>t.quote(le(D)),children:i?`引用此项`:`Reference`})]})]})]})]})});function Sm(e){if(!(e>0)||!Number.isFinite(e))return e;let t=Math.floor(Math.log2(e)*4+1e-9)/4;return Math.round(2**t*1e4)/1e4}function Cm(e,t){let n=Sm(t);if(e==null||!(e>0))return n;let r=Math.log2(t/e)*4;return r<-2||r>=3?n:e}function wm(){let e=null,t=new Set;return{get:()=>e,set(n){n!==e&&(e=n,t.forEach(e=>e()))},subscribe(e){return t.add(e),()=>void t.delete(e)}}}var Tm=(0,X.createContext)(null),Em=()=>()=>{};function Dm(e){let t=(0,X.useContext)(Tm),n=()=>{let n=t?.get();return n==null?null:e(n)},r=(0,X.useSyncExternalStore)(t?t.subscribe:Em,n,n),i=$(t=>r===null?e(Sm(t.transform[2])):null);return r??i}function Om(e){let t={};for(let n of e)(t[n.node_id]??=[]).push(n);for(let e of Object.values(t))e.sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));return t}var km={width:640,height:190},Am={width:1440,height:640},jm={"idea-route":lt,"idea-review":m,"idea-selector":ot},Mm={done:`✓`,failed:`✕`,question:`?`,paused:`‖`,running:`▶`,superseded:`↪`},Nm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],question:[`待答复`,`Needs input`],paused:[`已暂停`,`Paused`],aborted:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已替代`,`Superseded`],unknown:[`已记录`,`Recorded`]},Pm=(0,X.memo)(function({data:e}){let{task:t,zh:n,fanIndex:r,fanCount:i}=e,a=Ve(t),o=t.group,s=o?B:t.overflow_count?Fe:jm[t.team_role??``]??E,c=o?``:Le(t.team_outcome,n),l=o?``:Se(t.team_outcome),u=c||(Nm[a]??Nm.unknown)[+!n],d=l===`rejected`?`✕`:l===`chosen`?`★`:Mm[a],f=!o&&typeof r==`number`&&typeof i==`number`,p=o?.expanded?n?`收起`:`Fold`:n?`展开`:`Unfold`;return(0,Y.jsxs)(`button`,{type:`button`,className:`map-branch map-state-${a}${o?` map-branch-group`:``} nodrag nopan`,"data-testid":`map-branch`,"data-branch-id":t.id,"data-status":a,"data-verdict":l||void 0,"data-overflow":!!t.overflow_count,"data-group":!!o,"data-expanded":o?o.expanded:void 0,"aria-expanded":o?o.expanded:void 0,title:t.excerpt||t.objective||t.title,"aria-label":o?`${t.title} · ${p}`:`${t.title} · ${u} · ${n?`打开所属任务`:`Open the owning task`}`,onClick:()=>o?e.toggleGroup?.(t.id):e.open(e.parentCardId),children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(Ud,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsx)(`span`,{className:`map-branch-glyph`,"aria-hidden":`true`,children:(0,Y.jsx)(s,{})}),d&&(0,Y.jsx)(`span`,{className:`map-branch-state`,"aria-hidden":`true`,children:d}),(0,Y.jsx)(`span`,{className:`map-branch-title`,children:t.title}),c&&(0,Y.jsx)(`span`,{className:`map-branch-verdict`,"data-testid":`map-branch-verdict`,children:c}),f&&(0,Y.jsx)(`span`,{className:`map-branch-fan`,"data-testid":`map-branch-fan`,title:n?`并行分支 ${r} / ${i}`:`Parallel branch ${r} of ${i}`,children:`${r}/${i}`}),o&&(0,Y.jsxs)(`span`,{className:`map-branch-toggle`,"data-testid":`map-branch-toggle`,"aria-hidden":`true`,children:[p,o.expanded?(0,Y.jsx)(h,{}):(0,Y.jsx)(ie,{})]}),(0,Y.jsx)(`span`,{className:`map-branch-dot`,"aria-hidden":`true`})]})}),Fm={x:52,y:125,zoom:.24},Im=.01,Lm=3.5,Rm=(e,t,n)=>Math.max(t,Math.min(n,e));function zm(e,t){let n=e.querySelector(t)?.getBoundingClientRect();return n&&n.width>0&&n.height>0?n:void 0}function Bm(e,t=!1){let n=e.getBoundingClientRect(),r=zm(e,`.map-canvas-toolbar`),i=zm(e,`.map-composer-dock`),a=zm(e,`.react-flow__minimap`),o=zm(e,`.map-legend`),s=zm(e,`.react-flow__controls`),c=e.dataset.reading===`true`||t&&e.clientWidth<640,l=e.clientWidth<640?20:50,u=Math.max(r?r.bottom-n.top+20:85,!c&&e.clientWidth<640&&o?o.bottom-n.top+16:0,!c&&e.clientWidth<640&&s?s.bottom-n.top+16:0),d=Math.max(i?n.bottom-i.top+24:100,!c&&a?n.bottom-a.top+20:0);return{x:l,y:u,width:Math.max(180,e.clientWidth-l*2),height:Math.max(100,e.clientHeight-u-d)}}var Vm=.72,Hm=.85,Um=(e,t)=>e?0:t;function Wm(e,t,n){let r=Math.min(t.width/n.width,t.height/n.height),i=Math.min(e.width,e.height)/Math.min(n.width,n.height);return Math.min(Math.max(r,Vm*i),Hm*i)}function Gm(e,t,n,r,i){let a=r||1;if(e.width<640&&i?.stacked&&i.width>0)return t.width/(i.width*a);let o=Wm(e,t,n),s=e.width<640||(i?.steps.length??0)>20?.6/a:0,c=e.width>=1024?1/a:0;return Math.max(o,s,c)}function Km(e,t,n){let r=Rm(Math.min(t.width/(n.width+160),t.height/(n.height+160)),Im,.27),i=(e,t,n,r)=>r>t?(n-r)/2:Rm((n-r)/2,e,e+t-r);return{x:i(t.x,t.width,e.width,n.width*r)-n.x*r,y:i(t.y,t.height,e.height,n.height*r)-n.y*r,zoom:r}}function qm(e,t,n){let r=Math.min(48,e.height*.35),i=e.height-r,a=Math.min(Lm,Math.min(1.05,e.width/n.width,i/n.height)/n.scale);return{x:e.x+e.width/2-(t.x+(n.x+n.width/2)*n.scale)*a,y:e.y+r+i/2-(t.y+(n.y+n.height/2)*n.scale)*a,zoom:a}}function Jm(e,t=!0){let n=gd(),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)({width:0,height:0}),l=(0,X.useRef)(null),u=(0,X.useRef)(!1),d=(0,X.useRef)(!1),f=(0,X.useRef)(!1),p=(0,X.useRef)(),m=(0,X.useRef)(()=>{}),h=(0,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.useRef)(()=>{}),v=(0,X.useRef)(()=>{}),[y,b]=(0,X.useState)(()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),x=(0,X.useRef)(Fm),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null),T=(0,X.useRef)(0),E=(0,X.useRef)(null),D=(0,X.useRef)(0);(0,X.useEffect)(()=>()=>window.clearTimeout(D.current),[]);let[O]=(0,X.useState)(wm),k=(0,X.useCallback)((e,t)=>{O.get()!==t&&(e.style.setProperty(`--map-zoom-step`,String(t)),O.set(t))},[O]),A=(0,X.useCallback)(()=>{cancelAnimationFrame(T.current),T.current=0,E.current=null},[]),j=(0,X.useCallback)((t,r)=>{t&&(f.current=!1,d.current=!1);let a=e.current;if(!a)return;a.dataset.moving||(a.dataset.moving=`true`),window.clearTimeout(D.current),D.current=window.setTimeout(()=>{delete a.dataset.moving,k(a,Sm(n.getZoom()))},180);let s={x:a.clientWidth/2,y:a.clientHeight/2},c=S.current&&S.current.until>performance.now()?S.current:s,p=C.current??(u.current?h.current:null)??V(n.getNodes().filter(e=>e.data.frame),r,c,s),m=p&&(n.getNode(p)?.data)?.frame?.scale||1,g=Rm((r.zoom-.3)/.14,0,1)*Rm((r.zoom*m-.28)/.3,0,1),_=w.current,v=u.current?1:_?.id===p?Rm((r.zoom-_.zoom*.65)/(_.zoom*.35),0,1):g;l.current=v>0?p:null,a.style.setProperty(`--detail-alpha`,String(v)),a.style.setProperty(`--summary-alpha`,String(1-v)),a.style.setProperty(`--context-alpha`,String(p?1-v*.72:1)),a.dataset.zoom=r.zoom.toFixed(2),k(a,Cm(O.get(),r.zoom)),i(v>0&&p?p:null),o(!!p&&v>=.55),r.zoom<=.32&&!C.current&&!E.current&&!w.current&&(x.current=r)},[n,e,k,O]),M=(0,X.useCallback)(t=>{let r=f.current;f.current=!1,A();let i=n.getNode(t),a=e.current;if(!i||!a)return;!r&&n.getZoom()<=.32&&!w.current&&(x.current=n.getViewport()),C.current=t,u.current=!1,delete a.dataset.reading,d.current=!0;let o=Bm(a,!0),s=i.width||1440,c=i.height||1080,l=Rm(Gm({width:a.clientWidth,height:a.clientHeight},o,{width:s,height:c},i.data.frame?.scale||1,i.data.layout),Im,Lm);w.current={id:t,zoom:l};let p=o.x+Math.max(0,(o.width-s*l)/2)-i.position.x*l,m=o.y+Math.max(0,(o.height-c*l)/2)-i.position.y*l;n.setViewport({x:p,y:m,zoom:l},{duration:Um(y,380)}).then(()=>{C.current=null})},[A,n,y,e]);v.current=M;let N=(0,X.useCallback)(()=>{f.current=!1,A(),C.current=null,u.current=!1,e.current&&delete e.current.dataset.reading,d.current=!1,w.current=null,S.current=null;let t=e.current?.querySelector(`.map-macro[data-focused="true"]`)?.dataset.cardId;n.setViewport(x.current,{duration:Um(y,320)}).then(()=>{t&&e.current?.querySelector(`[data-testid="map-card"][data-card-id="${CSS.escape(t)}"]`)?.focus({preventScroll:!0})})},[A,n,y,e]),P=(0,X.useCallback)((t,r)=>{f.current=!1,A(),C.current=t;let i=n.getNode(t),a=e.current;!i||!a||(u.current=!0,a.dataset.reading=`true`,d.current=!0,h.current=t,g.current={id:t,rect:r},n.setViewport(qm(Bm(a),i.position,r),{duration:Um(y,340)}).then(()=>{C.current=null}))},[A,n,y,e]);_.current=P;let F=(0,X.useCallback)(e=>{f.current=!1,A(),u.current=!1,d.current=!1,C.current=null,S.current=null,n.setCenter(e.x,e.y,{zoom:n.getZoom(),duration:Um(y,180)})},[A,n,y]),I=(0,X.useCallback)(t=>{f.current=!0,p.current=t,A(),C.current=null,u.current=!1,d.current=!1,w.current=null,S.current=null;let r=e.current;r&&delete r.dataset.reading;let i=n.getNodes().filter(e=>!e.hidden&&(!t||t.has(e.data.task.id)));if(!r||!i.length)return;let a=Km({width:r.clientWidth,height:r.clientHeight},Bm(r),n.getNodesBounds(i));t||(x.current=a),n.setViewport(a,{duration:Um(y,320)})},[A,n,y,e]);m.current=()=>I(p.current);let L=(0,X.useCallback)(()=>{f.current?m.current():d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&v.current(l.current)},[]);return(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let n,r=t.querySelector(`.map-composer-dock`),i=-1,a=-1,o=-1,s=new ResizeObserver(()=>{let e=r?.getBoundingClientRect().height||0;(i!==t.clientWidth||a!==t.clientHeight||o!==e)&&(i=t.clientWidth,a=t.clientHeight,o=e,t.style.setProperty(`--map-composer-height`,`${o}px`),c(e=>e.width===i&&e.height===a?e:{width:i,height:a}),clearTimeout(n),n=setTimeout(()=>{d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&!u.current?v.current(l.current):f.current&&m.current()},100))});return s.observe(t),r&&s.observe(r),()=>{s.disconnect(),clearTimeout(n)}},[e,t]),(0,X.useEffect)(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let r=e=>{if(e.target.closest(`.nowheel, .map-canvas-toolbar, .map-legend, .react-flow__minimap, .react-flow__controls`))return;e.preventDefault(),e.stopPropagation(),f.current=!1,u.current=!1,d.current=!0,C.current=null;let r=t.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top;S.current={x:i,y:a,until:performance.now()+1e3};let o=E.current??n.getViewport();!E.current&&o.zoom<=.32&&!w.current&&(x.current=o);let s=e.deltaY*(e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1),c=Rm(o.zoom*Math.exp(-Rm(s,-400,400)*.002),Im,Lm);if(E.current={x:i-(i-o.x)*c/o.zoom,y:a-(a-o.y)*c/o.zoom,zoom:c},y){n.setViewport(E.current),E.current=null;return}if(T.current)return;let l=performance.now(),p=e=>{if(!E.current)return;let t=1-Math.exp(-Math.min(e-l,64)/55);l=e;let r=n.getViewport(),i=E.current,a=Math.abs(i.zoom-r.zoom)<15e-5&&Math.abs(i.x-r.x)+Math.abs(i.y-r.y)<.15;n.setViewport(a?i:{x:r.x+(i.x-r.x)*t,y:r.y+(i.y-r.y)*t,zoom:r.zoom+(i.zoom-r.zoom)*t}),a?(T.current=0,E.current=null):T.current=requestAnimationFrame(p)};T.current=requestAnimationFrame(p)},i=()=>{A(),C.current=null,S.current=null},a=e=>{e.defaultPrevented||document.querySelector(`[role="dialog"][aria-modal="true"]`)||e.key===`Escape`&&![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&N()};return t.addEventListener(`wheel`,r,{passive:!1,capture:!0}),t.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a),()=>{A(),t.removeEventListener(`wheel`,r,!0),t.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a)}},[N,A,n,y,e]),{capture:(0,X.useCallback)(()=>({viewport:n.getViewport(),overview:x.current,focusId:l.current,detailed:!!l.current&&(u.current||!!w.current||n.getZoom()>=.44)}),[n]),restore:(0,X.useCallback)(e=>{A(),x.current=e.overview;let t=e.focusId&&n.getNode(e.focusId)?e.focusId:null;C.current=e.detailed?t:null,w.current=e.detailed&&t?{id:t,zoom:e.viewport.zoom}:null,d.current=!1,f.current=!1,n.setViewport(e.viewport,{duration:0}),j(null,e.viewport)},[A,n,j]),focusId:r,canvasSize:s,detailed:a,enter:M,back:N,fit:I,fitUpdatedScene:L,navigate:F,readStep:P,onMove:j,reducedMotion:y,zoomSteps:O}}function Ym(e,t,n,r=n){if(!n||!r)return[];let i=e.tasks.find(e=>e.id===n);if(!i||i.turn_kind===`qa`)return[];if(r===n)return[Me(i,Pe(e,i,i.started_ts??0))];let a=new Map(e.events.map(e=>[e.id,e.item_id]));return te(e,t,n).filter(e=>e.task_id===n&&e.key===r&&e.event_ids.every(e=>!a.get(e)||a.get(e)===n))}function Xm(e,t){let n=new Map(e.events.map(e=>[e.id,e]));return JSON.stringify(t.map(t=>{let r=e.tasks.find(e=>e.id===t.task_id),i=[t.task_id,`${t.task_id}:active`,`${t.task_id}:outcome`].includes(t.key),a=!r||i?r:{...r,status:``,summary:void 0,outcome:void 0,pending_question:void 0,started_ts:void 0,finished_ts:void 0,attempt:void 0};return[t,N(a,t.event_ids.flatMap(e=>n.get(e)?[n.get(e)]:[]))]}))}function Zm(e,t,n,r=600){let i=e=>[`done`,`failed`,`cancelled`,`recorded`,`skipped`].includes(e||``),a=e.tasks.filter(e=>e.id!==n&&e.turn_kind!==`qa`),o=[...a.filter(e=>i(e.status)),...a.filter(e=>!i(e.status))],s=[];for(let n of o){if(s.length>=r)break;s.push(...nt(e,n,pe(n,e.events,t)))}return s.slice(0,r)}function Qm(e,t,n,r=!0,a,c,u=!1,p=t,m){let h=n?`zh-CN`:`en-US`,g=e.kind===`live`?`project`:`dataset`,_=e.id.replace(/^live:/,``),v=l(),y=$e(c??_,h),b=v===`question-foundation`?m===void 0?y.id:m:null,x=v===`question-foundation`&&!b,S=f(g,_,h,c,v,b),C=o(),w=i({queryKey:S,queryFn:async({signal:e})=>{let t=v===`question-foundation`?await d.mapCopy(g,_,h,e,c,v,b):await d.mapCopy(g,_,h,e,c,v),n=C.getQueryData(S);return re(n,t,n?.model_revision)},staleTime:1/0,gcTime:72e5,refetchOnWindowFocus:!1}),T=e.tasks.find(e=>e.id===t),E=Ze(S,p,I(p,T)),D=(0,X.useMemo)(()=>a??(T?pe(T,e.events,n):[]),[T,e.events,n,a]),[O,k]=(0,X.useState)(0),[A,j]=(0,X.useState)(!1),M=(0,X.useRef)(!0),N=(0,X.useRef)(null),P=(0,X.useMemo)(()=>new Map(e.events.map(e=>[e.id,e])),[e.events]),F=u?te(e,D,t):Ym(e,D,t,p),L=(0,X.useMemo)(()=>u?Zm(e,n,t):[],[e,n,t,u]),R=[...F,...L].filter(t=>e.tasks.find(e=>e.id===t.task_id)?.turn_kind!==`qa`).filter(t=>oe(t,e,w.data,P)).slice(0,8),z=Xm(e,R),B=[`map-copy-generation`,g,_,h,c],ee=[...B,v,...v===`question-foundation`?[b]:[],w.data?.version??null,w.data?.model_revision??null,z],V=JSON.stringify(ee),H=s({queryKey:B}),U={queryKey:ee,queryFn:async()=>{let t=w.data?.model_revision,n=ue(C,S,R.map(t=>({key:t.key,startedAt:I(t.key,e.tasks.find(e=>e.id===t.task_id))}))),r;try{r=await d.generateMapCopy(g,_,{cards:R,locale:h,...b?{foundation_id:b}:{}},void 0,c,v,n.update)}finally{n.finish()}return C.setQueryData(S,e=>re(e,r,t)),{available:!r.retry_after&&r.available!==!1&&R.every(t=>!oe(t,e,r,P)),retryAfter:typeof r.retry_after==`number`&&r.retry_after>0?r.retry_after:null}},staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1},W=i({...U,enabled:!1}),G=W.isSuccess&&W.data.available===!1?W.data.retryAfter:null,ne=(0,X.useMemo)(()=>w.data?.generation_error?Error(w.data.generation_error.message):null,[w.data?.generation_error?.code,w.data?.generation_error?.message]),ie=()=>{let e=C.fetchQuery({...U,staleTime:0});return N.current=e,j(!0),e.then(()=>void 0,()=>void 0).finally(()=>{N.current===e&&(N.current=null,M.current&&(j(!1),k(e=>e+1)))}),e};(0,X.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]),(0,X.useEffect)(()=>{if(!r||x||!w.data?.available||!R.length||W.isError||W.isSuccess&&!G||H>0||N.current)return;let e=w.data.generation_error&&typeof w.data.retry_after==`number`&&w.data.retry_after>0?w.data.retry_after:0,t=Math.max(G?W.dataUpdatedAt+G*1e3:0,e?w.dataUpdatedAt+e*1e3:0),n=setTimeout(()=>{C.isFetching({queryKey:B})===0&&ie()},Math.max(700,t-Date.now()));return()=>clearTimeout(n)},[V,O,w.data?.available,w.data?.retry_after,w.dataUpdatedAt,r,x,H,W.status,W.dataUpdatedAt]);let ae=A||W.isFetching||H>0;return{copy:w.data,generating:ae,ready:w.isFetched,foundationRequired:x,questionContext:{locale:h,preview:v,foundationId:b},readingGenerating:E.active,generationPhase:E.phase,generationError:R.length&&!W.isFetching&&!E.active?W.error||ne:null,generationUnavailable:!!R.length&&!W.isFetching&&!E.active&&!G&&W.data?.available===!1,retry:async()=>{!r||x||!w.data?.available||!R.length||ae||N.current||await ie().catch(()=>void 0)},readingRequest:F.find(e=>e.key===p),readingNeedsUpdate:W.data?.available!==!0&&R.some(e=>e.key===p)}}var $m=new Set([`done`,`failed`,`cancelled`,`recorded`,`skipped`,`aborted`,`superseded`]);function eh(e,t,n,r,a){let o=n?`zh-CN`:`en-US`,s=e.kind===`live`?`project`:`dataset`,c=e.id.replace(/^live:/,``),l=(0,X.useMemo)(()=>{let n=new Map(e.tasks.map(e=>[e.id,$m.has(e.status||``)])),r=t.filter(e=>n.has(e.source)&&n.has(e.target)).slice(0,48);return JSON.stringify(r.map(e=>[e.source,e.target,n.get(e.source),n.get(e.target)]))},[e.tasks,t]),u=(0,X.useMemo)(()=>JSON.parse(l).map(([e,t])=>({source:e,target:t})),[l]),f=[`map-lines`,s,c,o,a,l],p=i({queryKey:[...f,`saved`],queryFn:({signal:e})=>d.mapLines(s,c,{pairs:u,locale:o,write:!1},e,a),enabled:u.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...f,`written`],queryFn:({signal:e})=>d.mapLines(s,c,{pairs:u,locale:o,write:!0},e,a),enabled:u.length>0&&r&&p.data?.available===!0&&p.data.lines.lengthJSON.stringify(e.tasks.filter(e=>e.kind!==`turn`&&e.turn_kind!==`qa`).slice(-40).map(e=>[e.id,nh.has(e.status||``)])),[e.tasks]),l=(0,X.useMemo)(()=>JSON.parse(c).map(([e])=>e),[c]),u=[`map-card-words`,o,s,a,r,c],f=i({queryKey:[...u,`saved`],queryFn:({signal:e})=>d.mapCardWords(o,s,{tasks:l,locale:a,write:!1},e,r),enabled:l.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...u,`written`],queryFn:({signal:e})=>d.mapCardWords(o,s,{tasks:l,locale:a,write:!0},e,r),enabled:l.length>0&&n&&f.data?.available===!0&&Object.keys(f.data.cards).length`u`||typeof window.matchMedia!=`function`?!1:window.innerWidth>=1024&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function oh({footer:e,value:t,onChange:n,onSend:r,attachments:i,onAttachmentsChange:a,pending:o,pendingLabel:s,progressVisible:l=!0,dispatchStatus:u,onCancel:d,focusSignal:f,sessionName:m,historical:_,zh:y,routeOverride:b=`auto`,onRouteOverrideChange:x}){let{t:S}=p(),C=(0,X.useId)(),w=(0,X.useRef)(null),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(!1),k=(0,X.useRef)(!0),A=(0,X.useRef)(),[M,N]=(0,X.useState)(``),[P,F]=(0,X.useState)(!1),[I,L]=(0,X.useState)(!1),[R,z]=(0,X.useState)(()=>!!(t.trim()||i.length)||ah()),[B,ee]=(0,X.useState)(44),V=(0,X.useRef)(t);V.current=t;let H=!R,{refs:W,text:G}=le(t),te=t.length>Ie,ne=!!(t.trim()||i.length),re=(0,X.useRef)(ne);re.current=ne,(0,X.useEffect)(()=>{u===`error`&&z(!0)},[u]),(0,X.useEffect)(()=>{k.current=!0;let e=e=>{let t=e.type===`focusout`?e.relatedTarget:e.target;t?.closest?.(`.map-island-launch, .map-island-stop, .map-composer-brand`)||(T.current?.contains(t)?z(!0):re.current||z(!1))},t=e=>{let t=e.target;T.current?.contains(t)||t?.closest?.(`.map-context-menu`)||re.current||(z(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur())},n=e=>{if(e.key!==`c`||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||e.isComposing)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)||t?.closest?.(`[role="dialog"], [role="menu"]`)||(e.preventDefault(),z(!0),w.current?.focus())};return document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e),document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{k.current=!1,clearTimeout(A.current),document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[]);let ie=(0,X.useRef)(f);(0,X.useEffect)(()=>{f!==ie.current&&(ie.current=f,z(!0),w.current?.focus())},[f]);let ae=(0,X.useRef)(W.length);(0,X.useEffect)(()=>{W.length>ae.current&&(z(!0),w.current?.focus()),ae.current=W.length},[W.length]);let K=()=>{if(!w.current)return;w.current.style.height=`0px`;let e=Math.min(156,Math.max(44,w.current.scrollHeight));w.current.style.height=`${e}px`,ee(e)};(0,X.useEffect)(K,[G]),(0,X.useEffect)(()=>(window.addEventListener(`resize`,K),()=>window.removeEventListener(`resize`,K)),[]);let oe=()=>{z(!0),w.current?.focus()},ce=()=>{z(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur()},ue=(0,X.useRef)(),de=(0,X.useRef)(typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches);(0,X.useEffect)(()=>()=>clearTimeout(ue.current),[]);let fe=()=>{de.current&&(clearTimeout(ue.current),z(!0))},q=()=>{de.current&&(clearTimeout(ue.current),ue.current=setTimeout(()=>{re.current||T.current?.contains(document.activeElement)||z(!1)},320))};(0,X.useEffect)(()=>{o||L(!1)},[o]);let pe=async()=>{if(!G.trim()||D.current||te)return;let e=o;if(e&&i.length){N(y?`附件要等这条回复结束后再发送`:`Attachments can be sent once this reply finishes`);return}D.current=!0;try{(e?await r(t,[],void 0,{whileRunning:!0}):await r(t,i))&&k.current&&(N(``),F(!0),L(e),(!V.current.trim()||V.current===t)&&ce(),clearTimeout(A.current),A.current=setTimeout(()=>F(!1),1800))}finally{D.current=!1}},me=e=>{if(o||D.current||!e.length)return;let{accepted:t,issues:n}=Je(i,e);a([...i,...t]),N(n.map(e=>e.code===`unsupported`?S(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?S(`chat.attachTooLarge`,{name:e.fileName,size:O(e.limitBytes)}):e.code===`too-many`?S(`chat.attachTooMany`,{count:e.limitCount}):S(`chat.attachTotalTooLarge`,{size:O(e.limitBytes)})).join(` `))},he=u?{launching:[y?`任务已接收`:`Task accepted`,y?`正在放入地图…`:`Adding it to your map…`],task:[y?`任务已进入地图`:`Your task is on the map`,y?`跟随地图,查看执行进展`:`Follow its progress on the map`],message:[y?`${c().name} 已回复`:`${c().name} replied`,y?`在对话中查看回复`:`Open the conversation to read it`],error:[y?`发送没有成功`:`Message could not be sent`,y?`草稿已保留,可以重试`:`Your draft is ready to retry`],cancelled:[y?`正在停止回复`:`Stopping reply`,y?`可以发送新消息`:`You can send another message`]}[u]:void 0,ge=[y?`已排队`:`Queued`,y?`这条回复结束后立即处理`:`Answered right after this reply`],_e=he?.[0]||(o&&I?ge[0]:o?l?y?`${c().name} 正在处理`:`${c().name} is working`:y?`继续对话`:`Continue chatting`:P?y?`已发送给 ${c().name}`:`Sent to ${c().name}`:y?`交给 ${c().name}`:`Ask ${c().name}`),ve=he?.[1]||(o&&I?ge[1]:o?l?s||(y?`正在处理你的消息…`:`Processing your message…`):y?`可发送后续消息或停止回复`:`Send a follow-up or stop the reply`:P?y?`点此继续对话`:`Tap to keep the conversation going`:ne?y?`草稿已保留,点此继续`:`Draft saved — tap to continue`:y?`描述目标,看它变成成果`:`Turn your next idea into a result`),ye=u||(o?`working`:P?`sent`:`idle`);return(0,Y.jsxs)(`div`,{ref:T,className:`map-composer-dock map-island-dock`,"data-compact":H,"data-state":ye,"data-pending":o,style:{"--map-editor-height":`${B}px`},onPointerEnter:fe,onPointerLeave:q,onTransitionEnd:e=>{e.target===T.current&&e.propertyName===`width`&&K()},children:[!H&&W.length>0&&(0,Y.jsx)(`div`,{className:`map-reference-chips`,children:W.map((e,t)=>(0,Y.jsxs)(`span`,{title:`${e.source} · ${e.task_id} ${e.step_id||``}`,children:[(0,Y.jsxs)(`span`,{children:[y?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,Y.jsx)(`button`,{"aria-label":y?`移除引用`:`Remove reference`,onClick:()=>n(W.filter((e,n)=>t!==n).map(U).join(``)+G),children:(0,Y.jsx)(v,{size:12})})]},`${e.task_id}:${e.step_id}:${t}`))}),!H&&!!i.length&&(0,Y.jsx)(`div`,{className:`map-attachment-tray nowheel`,role:`group`,"aria-label":y?`待发送附件`:`Selected attachments`,children:i.map((e,t)=>(0,Y.jsx)(Ge,{file:e,disabled:o,removeLabel:S(`chat.attachRemove`,{name:e.name}),onRemove:()=>{a(i.filter(t=>t!==e)),N(``)}},`${e.name}:${e.lastModified}:${t}`))}),!H&&M&&(0,Y.jsx)(`div`,{className:`map-attachment-notice nowheel`,role:`alert`,children:M}),(0,Y.jsxs)(`div`,{className:`map-composer map-island-surface`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":S(`chat.attach`),title:S(`chat.attach`),"aria-hidden":H,tabIndex:H?-1:0,disabled:o&&!H,onClick:()=>E.current?.click(),children:(0,Y.jsx)(j,{size:25})}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-island-launch`,"aria-label":y?`打开消息输入`:`Open message composer`,"aria-expanded":!H,"aria-controls":C,"aria-hidden":!H,tabIndex:H?0:-1,onClick:oe,children:[(0,Y.jsxs)(`span`,{className:`map-island-copy`,children:[(0,Y.jsx)(`strong`,{children:_e}),(0,Y.jsx)(`small`,{title:ve,children:ve})]}),(0,Y.jsx)(`span`,{className:`map-island-indicator`,"aria-hidden":`true`,children:ye===`working`||ye===`launching`?(0,Y.jsxs)(`span`,{className:`map-island-wave`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}):ye===`sent`||ye===`task`||ye===`message`?(0,Y.jsx)(g,{size:16}):(0,Y.jsx)(at,{size:15})})]}),H&&o&&(0,Y.jsx)(`button`,{type:`button`,className:`map-island-stop`,onClick:d,"aria-label":y?`停止回复`:`Stop reply`,children:(0,Y.jsx)(be,{size:13})}),(0,Y.jsxs)(`form`,{id:C,className:`map-composer-editor`,"aria-hidden":H,onSubmit:e=>{e.preventDefault(),pe()},children:[(0,Y.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:xe,hidden:!0,disabled:o,onChange:e=>{me(Array.from(e.target.files||[])),e.target.value=``}}),(0,Y.jsx)(`textarea`,{ref:w,rows:1,tabIndex:H?-1:0,value:G,"aria-label":y?`给 ${c().name} 发送消息`:`Message ${c().name}`,placeholder:y?`告诉 ${c().name},你想完成什么…`:`What would you like ${c().name} to do?`,onFocus:()=>z(!0),onChange:e=>{F(!1),n(W.map(U).join(``)+e.target.value)},onPaste:e=>{let t=Ce(e.clipboardData);t.length&&(e.preventDefault(),me(t))},onKeyDown:e=>{e.key===`Escape`&&!Ee(e)&&!G.trim()&&!i.length&&(e.preventDefault(),e.stopPropagation(),ce()),e.key===`Enter`&&!e.shiftKey&&!Ee(e)&&(e.preventDefault(),pe())}}),(0,Y.jsxs)(`div`,{className:`map-island-toolbar`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-island-collapse`,tabIndex:H?-1:0,onClick:ce,"aria-label":y?`收起消息输入`:`Collapse message composer`,title:y?`收起(草稿会保留)`:`Collapse (draft is kept)`,children:(0,Y.jsx)(h,{size:15})}),x&&(0,Y.jsx)(Be,{value:b,onChange:x,disabled:o,tabIndex:H?-1:0}),o&&(0,Y.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),d()},tabIndex:H?-1:0,"aria-label":y?`停止回复`:`Stop reply`,className:`map-send is-pending`,children:(0,Y.jsx)(be,{size:15})},`stop`),(0,Y.jsx)(`button`,{type:`submit`,tabIndex:H?-1:0,disabled:!G.trim()||te,"aria-label":o?y?`在 ${c().name} 工作时发送`:`Send while ${c().name} works`:y?`发送消息`:`Send message`,title:o?y?`排队到这条回复之后处理`:`Queued right after this reply`:void 0,className:`map-send`,children:(0,Y.jsx)(se,{size:20})},`send`)]})]})]}),te&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1 px-3 text-xs text-err`,children:S(`chat.messageTooLong`)}),e,(0,Y.jsx)(`span`,{className:`map-composer-caption`,role:`status`,children:he?`${he[0]} · ${he[1]}`:o&&I?`${ge[0]} · ${ge[1]}`:o?``:P?y?`已发送`:`Sent`:_?`${y?`发送至`:`Send to`} ${m}`:``})]})}function sh(e,t,n){if(e.length<2)return``;let r=[0];for(let t=1;t0))return``;let a=Math.min(n,i/3),o=a*1.22,s=1,c=t=>{let n=Math.max(0,Math.min(i,t));for(;s1&&r[s-1]>n;)s--;let a=r[s]-r[s-1]||1,o=(n-r[s-1])/a,c=e[s-1],l=e[s];return{x:c.x+(l.x-c.x)*o,y:c.y+(l.y-c.y)*o}},l=e=>e*e*(3-2*e),u=e=>{let n=i-e;if(n<=a)return t*2.5*(n/a)**.85;let r=t*(.34+.66*l(Math.min(1,e/Math.max(1,i-o))));return n>=o?r:r+(t*2.5-r)*l((o-n)/(o-a))},d=Math.max(12,Math.min(72,Math.round(i/Math.max(a,1)*1.5))),f=Array.from({length:d+1},(e,t)=>(i-o)*(t/d));f.push(i-(o+a)/2,i-a,i);let p=[],m=[],h=e=>Math.round(e*100)/100;for(let e of f){let t=c(e),n=c(e-i*.004-.5),r=c(e+i*.004+.5),a=r.x-n.x,o=r.y-n.y,s=Math.hypot(a,o)||1,l=u(e)/2,d=-o/s*l,f=a/s*l;p.push(`${h(t.x+d)} ${h(t.y+f)}`),m.push(`${h(t.x-d)} ${h(t.y-f)}`)}return`M ${p.join(` L `)} L ${m.reverse().join(` L `)} Z`}function ch(e,t){let n=1-t;return{x:n**3*e[0].x+3*n**2*t*e[1].x+3*n*t**2*e[2].x+t**3*e[3].x,y:n**3*e[0].y+3*n**2*t*e[1].y+3*n*t**2*e[2].y+t**3*e[3].y}}function lh(e,t,n=!1){if(!e.length)return null;let r=n?[...e].reverse():e,i=0;for(let e=1;e0&&i+n>=t){let a=(t-i)/n;return{x:r[e-1].x+(r[e].x-r[e-1].x)*a,y:r[e-1].y+(r[e].y-r[e-1].y)*a}}i+=n}return r[r.length-1]}function uh(e,t,n=0){return e.x>t.x-n&&e.xt.y-n&&e.y({x:n===`left`?-e.x:e.x,y:n===`up`?-e.y:e.y}),s=o(e),c=o(t);i=i.map(e=>({...e,x:n===`left`?-e.x-e.width:e.x,y:n===`up`?-e.y-e.height:e.y}));let l=Math.max(80,n===`loop`?Math.max(Math.abs(c.x-s.x),Math.abs(c.y-s.y))*2.8:0,Math.abs(a?c.y-s.y:c.x-s.x)*(.4+r*.06)),u=[s,a?{x:s.x+0,y:s.y+l}:{x:s.x+l,y:s.y},n===`loop`?{x:c.x,y:c.y+l}:a?{x:c.x-0,y:c.y-l}:{x:c.x-l,y:c.y},c],d=e=>e.flatMap(e=>Array.from({length:31},(t,n)=>ch(e,n/30))),f=e=>d(e).reduce((e,t)=>e+i.filter(e=>uh(t,e,22)).length,0),p=[u],m=f(p)*1e5;if(m){let e={x:(s.x+c.x)/2,y:(s.y+c.y)/2},t=a?e.x:e.y,n=[...new Set(i.flatMap(e=>a?[e.x-110-r*30,e.x+e.width+110+r*30]:[e.y-110-r*30,e.y+e.height+110+r*30]))].sort((e,n)=>Math.abs(e-t)-Math.abs(n-t)).slice(0,12);for(let e of n){let n=(e-t)*4/3;for(let r of[.25,.4,.55]){let i=Math.max(60,Math.abs(a?c.y-s.y:c.x-s.x)*r),o=[a?[s,{x:s.x+n,y:s.y+i},{x:c.x+n,y:c.y-i},c]:[s,{x:s.x+i,y:s.y+n},{x:c.x-i,y:c.y+n},c]],l=f(o)*1e5+Math.abs(e-t)+Math.abs(r-.4)*100;le.map(o)),{path:`M ${e.x} ${e.y}`+p.map(e=>` C ${e[1].x} ${e[1].y}, ${e[2].x} ${e[2].y}, ${e[3].x} ${e[3].y}`).join(``),points:d(p),labels:[.5,.4,.6,.3,.7,.2,.8,.35,.45,.55,.65,.25,.75,.15,.85].map(e=>{let t=Math.min(p.length-1,Math.floor(e*p.length));return ch(p[t],e*p.length-t)})}}var fh=new WeakMap,ph=.5,mh=.05;function hh(e){return e>=ph?Math.max(ph,Math.floor(e*8)/8):ee+(/[^\x00-\x7F]/.test(t)?10.5:7),20);return{width:Math.min(t,216),height:26}}function vh(e,t){let n=e.getState(),r=[...n.nodeLookup.values()].filter(e=>!e.hidden).map(e=>({id:e.id,...e.internals.positionAbsolute,width:e.width||e.measured.width||0,height:e.height||e.measured.height||0}));function i(e,t){let r=n.nodeLookup.get(e);if(!r)return null;let{x:i,y:a}=r.internals.positionAbsolute,o=r.width||r.measured.width||0,s=r.height||r.measured.height||0;return{x:i+(t===`left`?0:t===`right`?o:o/2),y:a+(t===`top`?0:t===`bottom`?s:s/2)}}let a=n.edges.filter(e=>!e.hidden).map(e=>({...e,s:i(e.source,e.sourceHandle),t:i(e.target,e.targetHandle)})),o=JSON.stringify([r,a.map(e=>[e.id,e.s,e.t,e.label,e.data?.lane,e.sourceHandle,e.targetHandle,e.className])]),s=fh.get(e);if(!s||s.key!==o){let t=new Map,n=new Map;for(let e of a)n.set(e.id,/(?:^|\s)map-edge-(\w+)/.exec(e.className??``)?.[1]),e.s&&e.t&&t.set(e.id,dh(e.s,e.t,e.source===e.target?`loop`:e.sourceHandle===`left`?`left`:e.sourceHandle===`top`?`up`:e.sourceHandle===`bottom`,Number(e.data?.lane||0),r.filter(t=>t.id!==e.source&&t.id!==e.target)));s={key:o,routes:t,kinds:n,zoom:-1,labels:new Map},fh.set(e,s)}let c=hh(t);return s.zoom!==c&&(s.zoom=c,s.labels=new Map,c&&yh(s,a,r,c)),s}function yh(e,t,n,r){let i=[...n],a=e=>+!!e.data?.quiet;for(let n of[...t].sort((e,t)=>a(e)-a(t))){let t=e.routes.get(n.id);if(!t||!n.label)continue;let a=_h(n.label),o=a.width/r,s=a.height/r,c=[0,3,4,5,6][Number(n.data?.lane||0)%5],l=[t.labels[c],...t.labels.filter((e,t)=>t!==c)].filter(e=>i.every(t=>e.x+o/2<=t.x||e.x-o/2>=t.x+t.width||e.y+s/2<=t.y||e.y-s/2>=t.y+t.height)),u,d=1/0;for(let t of l){let r={x:t.x-o/2,y:t.y-s/2,width:o,height:s},i=0;for(let[t,a]of e.routes)t!==n.id&&a.points.some(e=>uh(e,r))&&i++;if(ie),a=(0,X.useId)().replace(/:/g,``),o=`relation-arrow-${a}`,s=`relation-flow-${a}`,c=vh(vu(),i),l=c.routes.get(e),u=c.labels.get(e);if(!l)return null;let d=c.kinds.get(e),f=d===`fanout`||d===`fanin`,p=!d||n?.stroke===bh?n?.stroke||`#7594ad`:`var(--map-edge-${d}, ${n?.stroke||`#7594ad`})`,m=(Number(n?.strokeWidth||2)+(f?.4:0))/i,h=f?lh(l.points,(d===`fanout`?2:15)/i,d===`fanin`):null,g=typeof t==`string`?gh(t):void 0,_=l.points[0],v=l.points[l.points.length-1],y=!!_&&!!v&&n?.stroke!==bh&&(Math.abs(_.x-v.x)>1||Math.abs(_.y-v.y)>1),b=!f&&!n?.strokeDasharray,x=b?sh(l.points,Number(n?.strokeWidth||2)*1.45/i,16/i):``;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`defs`,{children:[(0,Y.jsx)(`marker`,{id:o,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:9/i,markerHeight:9/i,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,style:{fill:p}})}),y&&(0,Y.jsxs)(`linearGradient`,{id:s,gradientUnits:`userSpaceOnUse`,x1:_.x,y1:_.y,x2:v.x,y2:v.y,children:[(0,Y.jsx)(`stop`,{offset:`0`,style:{stopColor:p,stopOpacity:b?.34:.28}}),(0,Y.jsx)(`stop`,{offset:`0.55`,style:{stopColor:p,stopOpacity:b?.7:.78}}),(0,Y.jsx)(`stop`,{offset:`1`,style:{stopColor:p,stopOpacity:1}})]})]}),(0,Y.jsxs)(lm,{path:l.path,delay:r?.growthDelay,padding:24/i,children:[(0,Y.jsx)(wf,{id:e,path:l.path,markerEnd:x?void 0:`url(#${o})`,style:{...n,stroke:x?`transparent`:y?`url(#${s})`:p,strokeLinecap:`round`,vectorEffect:`none`,strokeWidth:m,strokeDasharray:n?.strokeDasharray?String(n.strokeDasharray).split(/[\s,]+/).map(e=>Number(e)/i).join(` `):void 0}}),x&&(0,Y.jsx)(`path`,{className:`map-edge-ink`,d:x,style:{fill:y?`url(#${s})`:p,opacity:n?.opacity},"aria-hidden":`true`}),!f&&_&&(0,Y.jsx)(`circle`,{className:`map-edge-anchor`,cx:_.x,cy:_.y,r:(x?2.1:2.6)/i,style:x?{fill:p,opacity:Number(n?.opacity??1)*.62}:{fill:`var(--map-paper)`,stroke:p,strokeWidth:1.4/i,opacity:n?.opacity},"aria-hidden":`true`}),h&&(0,Y.jsx)(`circle`,{className:`map-edge-joint`,cx:h.x,cy:h.y,r:3.2/i,style:{fill:p,opacity:n?.opacity},"aria-hidden":`true`})]}),(r?.active&&!r.muted||r?.lit)&&(0,Y.jsx)(Tp,{children:(0,Y.jsx)(`div`,{className:`map-edge-spark`,"data-lit":!r?.active&&!!r?.lit,"aria-hidden":`true`,style:{offsetPath:`path("${l.path}")`,width:8/i,height:8/i,margin:`${-4/i}px 0 0 ${-4/i}px`,animationDelay:`${-((e.charCodeAt(0)*131+e.length*47)%2800)}ms`}})}),t&&g!==``&&u&&(0,Y.jsx)(Tp,{children:(0,Y.jsx)(`div`,{className:`map-relation-label nodrag nopan`,"data-kind":d,"data-lit":!!r?.lit,"data-quiet":!!r?.quiet,title:g,style:{opacity:r?.quiet&&!r.lit?0:n?.opacity,pointerEvents:r?.quiet&&!r.lit?`none`:void 0,transform:`translate(-50%, -50%) translate(${u.x}px, ${u.y}px) scale(${1/i})`},children:g??t})})]})}function Sh({open:e,info:t,zh:n,onChoose:r,readOnly:i=!1}){return(0,Y.jsx)(S,{open:e,onClose:()=>r({mode:`off`}),label:n?`选择地图加载范围`:`Choose map history`,width:`max-w-lg`,children:(0,Y.jsxs)(`div`,{className:`map-history-choice`,children:[(0,Y.jsx)(`h2`,{children:n?`选择地图加载范围`:`Choose map history`}),(0,Y.jsx)(`p`,{children:n?`本会话有 ${t.task_count} 个任务,历史记录约 ${(t.event_bytes/1024/1024).toFixed(1)} MB。`:`This session has ${t.task_count} tasks and about ${(t.event_bytes/1024/1024).toFixed(1)} MB of history.`}),(0,Y.jsx)(`p`,{children:i?n?`只读模式只加载历史记录,不调用模型。较长历史需要一些加载时间。`:`Read-only mode loads records without model calls. Long histories take time to load.`:n?`加载较长历史需要一些时间。生成卡片摘要与关系说明会调用已配置的模型,并消耗额外 Token。已有摘要会优先复用。`:`Loading a long history takes time. Card summaries and relationship descriptions use your configured model and consume additional tokens. Existing summaries are reused.`}),(0,Y.jsxs)(`div`,{className:`map-history-options`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`current`,since:t.current_task_ts,eventSince:t.current_event_ts,taskId:t.current_task_id||void 0}),children:[(0,Y.jsx)(`strong`,{children:n?`从当前进度加载`:`Start at current progress`}),(0,Y.jsx)(`span`,{children:n?`推荐 · 加载当前任务及后续进度,保留相关连接`:`Recommended · Load current and future work with its connections`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`full`}),children:[(0,Y.jsx)(`strong`,{children:n?`从头加载`:`Load from the beginning`}),(0,Y.jsx)(`span`,{children:i?n?`分批加载历史记录,查看已有说明`:`Load history in pages and view existing explanations`:n?`分批加载历史记录;打开卡片阅读时,再整理它的说明`:`Load history in pages; prepare an explanation when you open a card to read`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`off`}),children:[(0,Y.jsx)(`strong`,{children:n?`不开启地图模式`:`Keep map mode off`}),(0,Y.jsx)(`span`,{children:n?`不加载地图,也不生成摘要`:`Do not load the map or generate summaries`})]})]}),(0,Y.jsx)(`small`,{children:n?`选择仅用于本会话,可随时更改加载范围。`:`This choice applies to this session and can be changed later.`})]})})}var Ch=new Map;function wh(e){let t=Ch.get(e);if(t)return t;try{let t=JSON.parse(A(`argus.map.camera.v1:`+e)||`null`);if(t&&[t.viewport,t.overview].every(e=>e&&[e.x,e.y,e.zoom].every(Number.isFinite)&&e.zoom>=.035&&e.zoom<=3.5)&&(t.focusId===null||typeof t.focusId==`string`)&&typeof t.detailed==`boolean`)return{camera:t}}catch{}return{}}function Th(e,t){for(Ch.delete(e),Ch.set(e,t);Ch.size>8;)Ch.delete(Ch.keys().next().value);t.camera&&k(`argus.map.camera.v1:`+e,JSON.stringify(t.camera))}var Eh={task:xm,branch:Pm},Dh={relation:xh},Oh={done:`#a9c4b6`,running:`#9fb6cc`,question:`#dcc797`,failed:`#d9a79f`,review_unavailable:`#cdbba3`,held:`#cdbba3`,paused:`#cdbba3`,superseded:`#c5bdcd`,aborted:`#c6c8cb`,skipped:`#c6c8cb`,missing:`#c6c8cb`};function kh({events:e,zh:t}){let n=[...new Map(e.filter(e=>e.type===`team.task`).map(e=>[e.id,e])).values()];if(!n.length)return null;let r=n.filter(e=>e.status===`done`).length,i=n.filter(e=>ge.has(e.status||``)).length,a=n.filter(e=>e.status===`failed`).length;return(0,Y.jsxs)(`div`,{className:`map-team-progress`,role:`status`,"aria-label":t?`子任务进度`:`Subtask progress`,children:[(0,Y.jsx)(`strong`,{children:t?`子任务`:`Subtasks`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(g,{size:12}),(0,Y.jsxs)(`b`,{children:[r,`/`,n.length]}),` `,t?`已完成`:`completed`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:i}),` `,t?`进行中`:`running`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:a}),` `,t?`失败`:`failed`]})]})}function Ah({data:e,zh:t,composer:n,activePhase:r,waiting:s,snapshot:c,currentTaskId:l,events:u,pendingLabel:f,readOnly:p,sessionId:m,viewKey:h,paused:g,actions:y,replacements:O}){let[k,A]=(0,X.useState)(!1),[j,N]=(0,X.useState)(()=>e.kind===`live`&&!p&&y.conversationEvents.some(e=>e.type===`ui.operator`||e.type===`ui.argus`)),P=[...y.conversationEvents].reverse().find(e=>e.type===`ui.operator`),F=P?String(P.message_id||P.ts||``):``,I=(0,X.useRef)(F),R=(0,X.useRef)(n.pending);(0,X.useEffect)(()=>{e.kind===`live`&&!p&&(F&&F!==I.current||n.pending&&!R.current)&&(N(!0),A(!1)),I.current=F,R.current=n.pending},[F,n.pending,e.kind,p]);let[z,B]=(0,X.useState)(()=>new Set),V=(0,X.useCallback)(e=>{B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[G,te]=(0,X.useState)(null),re=(0,X.useRef)(0),ae=(0,X.useRef)(!0);(0,X.useEffect)(()=>(ae.current=!0,()=>{ae.current=!1}),[]);let K=(0,X.useMemo)(()=>M(e.tasks),[e.tasks]),[oe,se,ue]=Ep([]),fe=(0,X.useRef)(null),q=Jm(fe,!p),pe=Op(),be=(0,X.useRef)(!1),[xe,Se]=(0,X.useState)(!1),Ce=(0,X.useRef)(null);Ce.current||=wh(h);let[Ee,Oe]=(0,X.useState)(()=>{let e=Ce.current?.scene?.cards.find(e=>e.id===Ce.current?.camera?.focusId);return new Set(e&&e.id!==e.task.id?[e.task.id]:[])}),[ke,Ae]=(0,X.useState)(null),[Me]=(0,X.useState)(()=>new Set(Ce.current?.scene?.cards.map(e=>e.id))),Ne=oe.find(e=>e.id===q.focusId),Pe=(0,X.useMemo)(()=>je(e.tasks,e.events),[e.tasks,e.events]),Fe=$e(m,t?`zh-CN`:`en-US`),[Ie,Le]=(0,X.useState)(null),Be=(0,X.useCallback)((t,n)=>{Le(r=>n?{nodeId:t,key:n,foundationId:Fe.id}:r?.nodeId===t&&!e.tasks.some(e=>e.id===r.key)?null:r)},[e.tasks,Fe.id]);(0,X.useEffect)(()=>{Le(t=>t&&(t.nodeId===q.focusId||e.tasks.some(e=>e.id===t.key))?t:null)},[q.focusId,e.tasks]);let J=Ie?e.tasks.find(e=>e.id===Ie.key):void 0,Ge=J?.turn_kind===`qa`?e.events.find(e=>e.item_id===J.id&&e.type===`turn.replied`):void 0,Je=Ie?oe.find(e=>e.id===Ie.nodeId):void 0,Xe=J?.id??(Ie?.nodeId===q.focusId?Ie.key:null),Ze=(0,X.useMemo)(()=>ce(e.tasks),[e.tasks]),tt=Ze.findIndex(e=>e.id===Ne?.data.task.id),[nt,it]=(0,X.useState)(null),at=K.tasks.find(e=>e.id===nt),ot=(0,X.useMemo)(()=>at?Ke(K,at.id):null,[K,at]),lt=(0,X.useMemo)(()=>at&&ot?new Set([at.id,...ot.upstream.map(e=>e.id),...ot.downstream.map(e=>e.id)]):null,[at,ot]),{copy:ut,ready:ft,generating:pt,readingRequest:mt,readingNeedsUpdate:ht,readingGenerating:gt,generationPhase:vt,foundationRequired:bt,questionContext:St,generationError:Ct,generationUnavailable:wt,retry:Et}=Qm(e,J?.id||Ne?.data.task.id||null,t,!p&&!e.history_loading,Ne?.data.layout.steps,m,!1,Xe,Ie?.foundationId),kt=(0,X.useMemo)(()=>mt?{request:mt,questionContext:St,pending:ht,generating:gt,phase:vt,error:Ct,unavailable:wt,foundationRequired:bt,retry:p?void 0:Et,retryDisabled:pt}:void 0,[mt,St,ht,pt,gt,vt,Ct,wt,p,Et,bt]),jt=(0,X.useMemo)(()=>Ye(Te(K,ut?.relations||[],t)),[K,ut?.relations,t]),Mt=ih(e,t,!p&&!e.history_loading,m),Nt=eh(e,jt,t,!p&&!e.history_loading,m),Pt=(0,X.useMemo)(()=>Te(K,ut?.relations||[],t,Nt),[K,ut?.relations,t,Nt]),Ft=(0,X.useRef)(Ce.current.scene),It=(q.canvasSize.width||window.innerWidth)<640,Z=(0,X.useMemo)(()=>{let n=H(K,e.events,t,Ft.current,Pt,Ee,It);return Ft.current=a(Ft.current,n),Ft.current},[K,e.events,t,Pt,Ee,It]),Lt=(0,X.useRef)(null),Rt=(0,X.useMemo)(()=>(Lt.current=a(Lt.current,ze(ve(K,e.events,t,48),z,t)),Lt.current),[K,e.events,t,z]),zt=(0,X.useRef)(null),Bt=(0,X.useMemo)(()=>{let e=Rt.tasks.filter(e=>e.branch);if(!e.length)return{links:Z.links,positions:Z.positions,frames:Z.frames,structure:Z.structure,branches:e,branchAnchor:new Map};let t=new Map;for(let e of Z.cards)t.set(e.task.id,e.id);let n=new Map(e.map(e=>[e.id,t.get(e.parent_id)??e.parent_id])),r={...Z.frames};for(let t of e)r[t.id]={...t.group?Am:km,scale:1};let i=[...Z.links,...Rt.links.filter(e=>e.kind===`fanout`||e.kind===`fanin`).map(e=>({...e,source:t.get(e.source)??e.source,target:t.get(e.target)??e.target}))],a=new Map;for(let t of e){let e=n.get(t.id);a.set(e,[...a.get(e)??[],t.id])}let o=Z.cards.flatMap(e=>[e.id,...a.get(e.id)??[]]),s=JSON.stringify([o.map(e=>[e,r[e].width,r[e].height]),i.map(e=>[e.source,e.target,e.kind])]),c=zt.current?.structure===s?zt.current.positions:he(o,i,r);return zt.current={structure:s,positions:c},{links:i,positions:c,frames:r,structure:s,branches:e,branchAnchor:n}},[Z,Rt]),Vt=Tt(Bt.positions,q.reducedMotion),[Ht,Ut]=(0,X.useState)(null),Wt=(0,X.useMemo)(()=>Dt(Bt.links,Ht),[Bt.links,Ht]),[Gt,Kt]=(0,X.useState)(!1),[qt,Jt]=(0,X.useState)(!1),Yt=(0,X.useMemo)(()=>new Map(Z.cards.map(e=>[e.id,e.ordinal])),[Z.cards]),Xt=xt(Z,!!e.history_loading),Zt=(0,X.useMemo)(()=>We(e.events),[e.events]),Qt=async(e,t=[],r,i)=>{if(i?.whileRunning)return n.onSend(e,t,void 0,i);let a=++re.current,o=fe.current?.querySelector(`.map-composer`)?.getBoundingClientRect();te({id:a,text:le(e).text.replace(/\s+/g,` `).slice(0,180),origin:{x:o?.left??20,y:o?.top??innerHeight-100,width:o?.width??260,height:o?.height??56}});let s=!1,c=e=>{e.type===`task`&&(s=!0),ae.current&&e.type===`settled`&&e.outcome===`message`&&!s&&(N(!0),A(!1)),ae.current&&te(t=>t?.id===a?{...t,result:e}:t)};try{let r=await n.onSend(e,t,c);return r&&ae.current&&le(e).refs.length>0&&(N(!0),A(!1)),r||c({type:`settled`,outcome:`error`}),r}catch(e){throw c({type:`settled`,outcome:`error`}),e}},$t=()=>{te(e=>e?{...e,result:{type:`settled`,outcome:`cancelled`}}:null),n.onCancel()};(0,X.useEffect)(()=>{if(!pe||be.current||!ft||Ce.current?.camera&&e.history_loading)return;let t=requestAnimationFrame(()=>{if(be.current=!0,Ce.current?.camera)q.restore(Ce.current.camera);else if(q.fit(),e.kind===`live`&&fe.current.clientWidth<640){let t=qe(e.tasks);t&&q.fit(new Set([t.id]))}Se(!0)});return()=>cancelAnimationFrame(t)},[pe,q.fit,q.enter,q.restore,e.kind,e.tasks,Z.cards,e.history_loading,ft]),(0,X.useEffect)(()=>{let e=fe.current;if(!e||q.reducedMotion)return;let t=null,n=n=>{t??=requestAnimationFrame(()=>{t=null;let r=e.getBoundingClientRect();!r.width||!r.height||(e.style.setProperty(`--lean-x`,((n.clientX-r.left)/r.width-.5).toFixed(3)),e.style.setProperty(`--lean-y`,((n.clientY-r.top)/r.height-.5).toFixed(3)))})},r=()=>{e.style.setProperty(`--lean-x`,`0`),e.style.setProperty(`--lean-y`,`0`)};return e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,r),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,r)}},[q.reducedMotion]),(0,X.useEffect)(()=>{if(!xe||Ce.current?.camera||q.reducedMotion)return;Kt(!0);let e=window.setTimeout(()=>Kt(!1),Ot);return()=>window.clearTimeout(e)},[xe,q.reducedMotion]),(0,X.useEffect)(()=>{let e=()=>{be.current&&Th(h,{scene:Ft.current,camera:q.capture()})};return window.addEventListener(`pagehide`,e),()=>{e(),window.removeEventListener(`pagehide`,e)}},[h,q.capture]),(0,X.useEffect)(()=>{if(!pe)return;let e=requestAnimationFrame(q.fitUpdatedScene);return()=>cancelAnimationFrame(e)},[Bt.structure,pe,q.fitUpdatedScene]);let en=(0,X.useRef)(n);en.current=n;let tn=(0,X.useCallback)(e=>{if(p)return;let t=en.current;t.onChange(U(e)+t.value),window.setTimeout(()=>document.querySelector(`.map-composer textarea`)?.focus(),0)},[p]),[nn,rn]=(0,X.useState)(null),an=o(),on=i({queryKey:[`map-notes`,m],queryFn:({signal:e})=>d.mapNotes(m,e),enabled:e.kind===`live`&&!p,staleTime:6e4}),sn=(0,X.useMemo)(()=>({notes:Om(on.data?.notes??[])}),[on.data]),[cn,ln]=(0,X.useState)(null),[un,dn]=(0,X.useState)(``),[fn,pn]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!cn)return;let e=e=>{e.target.closest(`.map-note-editor`)||ln(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),ln(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[cn]);let mn=async()=>{let e=cn,t=un.trim();if(!(!e||!t)){pn(!1);try{await d.addMapNote(m,{node_id:e.ref.task_id,text:t}),await an.invalidateQueries({queryKey:[`map-notes`,m]}),ln(null),dn(``)}catch{pn(!0)}}},hn=(0,X.useCallback)((e,t)=>{p||rn({ref:e,x:Math.min(window.innerWidth-180,t.x),y:Math.min(window.innerHeight-140,t.y)})},[p]);(0,X.useEffect)(()=>{if(!nn)return;let e=e=>{e.target.closest(`.map-context-menu`)||rn(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),rn(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[nn]);let[gn,_n]=(0,X.useState)(``),vn=(0,X.useCallback)(e=>`${e.task.title} ${e.task.objective??``} ${ut?.cards[e.task.id]?.title||``} ${ut?.cards[e.task.id]?.summary||``} ${Mt[e.task.id]?.title||``} ${Mt[e.task.id]?.summary||``} ${e.part>1?t?`续篇 ${e.part-1}`:`Continued ${e.part-1}`:``}`.toLowerCase(),[ut,Mt,t]),yn=(0,X.useMemo)(()=>gn?Z.cards.filter(e=>vn(e).includes(gn.toLowerCase())):[],[gn,Z.cards,vn]),bn=yn.findIndex(e=>e.id===q.focusId),[xn,Sn]=(0,X.useState)(K.tasks.length),[Cn,wn]=(0,X.useState)(!1),[Tn,En]=(0,X.useState)(!1),Dn=O?.shown??Tn,On=O?.toggle??(()=>En(e=>!e)),[kn,An]=(0,X.useState)(``),jn=(0,X.useCallback)(e=>{if(it(e),_n(``),An(``),e){let{upstream:t,downstream:n}=Ke(K,e);q.fit(new Set([e,...t.map(e=>e.id),...n.map(e=>e.id)]))}else q.fit()},[q.fit,K]),Mn=(0,X.useCallback)((e,t=!1)=>{let n=Ft.current?.allCards.find(t=>t.id===e);if(n&&!Ee.has(n.task.id)&&(t||e!==n.task.id)){Oe(e=>new Set([...e,n.task.id])),Ae(e);return}at&&n?jn(n.task.id===at.id?null:n.task.id):q.enter(e)},[q.enter,at,jn,Ee]),Nn=(0,X.useCallback)(e=>{let t=Ee.has(e);if(Oe(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),Ne?.data.task.id===e){let n=Ft.current?.allCards.filter(t=>t.task.id===e).at(-1);Ae(t?e:n?.id??e)}},[Ee,Ne?.data.task.id]);(0,X.useEffect)(()=>{!ke||!oe.some(e=>e.id===ke)||(q.enter(ke),Ae(null))},[ke,oe,q.enter]);let Pn=(0,X.useCallback)(()=>{it(null),An(``),q.fit()},[q.fit]);(0,X.useEffect)(()=>{se(n=>a(n,Z.cards.map(n=>({id:n.id,type:`task`,position:Vt[n.id]??Z.positions[n.id],width:Z.frames[n.id].width,height:Z.frames[n.id].height,style:{width:Z.frames[n.id].width,height:Z.frames[n.id].height},data:{...n,zh:t,open:Mn,toggleHistory:Nn,readStep:q.readStep,readCopy:Be,menu:hn,quote:tn,source:e.id,readOnly:p,live:e.kind===`live`,paused:g,seenCards:Me,restoring:!!Ce.current?.camera&&!be.current,layout:Z.layouts[n.id],frame:Z.frames[n.id],plannedWidth:Zt.get(n.task.id),focused:!1,detailed:!1}}))))},[K,Z,Bt,Vt,t,se,Mn,Nn,q.readStep,Be,hn,tn,e.id,e.kind,p,g,Me,Zt]),(0,X.useEffect)(()=>{Sn(e=>Math.min(Math.max(e,1),K.tasks.length))},[K.tasks.length]),(0,X.useEffect)(()=>{if(!Cn||q.detailed)return;let e=window.setInterval(()=>Sn(e=>e>=K.tasks.length?(wn(!1),e):e+1),900);return()=>window.clearInterval(e)},[Cn,K.tasks.length,q.detailed]),(0,X.useEffect)(()=>{if(!qt||Cn||xnJt(!1),1400);return()=>window.clearTimeout(e)},[qt,Cn,xn,K.tasks.length]);let Fn=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(t=>e.kind===`live`&&!qt||t.ordinal<=xn).map(e=>e.id));for(let[e,n]of Bt.branchAnchor)t.has(n)&&t.add(e);return t},[Z.cards,xn,e.kind,qt,Bt.branchAnchor]),In=(0,X.useRef)([]),Ln=(0,X.useMemo)(()=>{let e=oe.map(e=>({...e,hidden:!Fn.has(e.id),data:{...e.data,copy:ut?{version:ut.version,cards:Object.fromEntries([e.data.task.id,...e.data.layout.steps.map(e=>e.id)].filter(e=>ut.cards[e]).map(e=>[e,ut.cards[e]]))}:void 0,words:Mt[e.data.task.id],readerCopy:Ie?.nodeId===e.id?kt:void 0,focused:e.id===q.focusId,detailed:q.detailed&&e.id===q.focusId,canvasSize:q.canvasSize,lit:Wt.nodes.has(e.id),hovered:e.id===Ht,arriving:Gt,revealing:qt,phase:r&&ge.has(e.data.task.status)?r:void 0,waiting:s&&s.taskId===e.data.task.id?s.sentence:void 0,growthDelay:Xt.cards[e.id],dispatchState:G?.result?.type===`task`&&G.result.taskId===e.data.task.id&&!n.historical?G.landed?`landed`:`receiving`:void 0,growingSteps:Object.fromEntries(e.data.layout.steps.flatMap(t=>{let n=Xt.steps[yt(e.id,t.id)];return n==null?[]:[[t.id,n]]})),growingLinks:Object.fromEntries(e.data.layout.links.flatMap(t=>{let n=Xt.links[yt(e.id,t.id)];return n==null?[]:[[t.id,n]]}))},style:{...e.style,opacity:lt&&!lt.has(e.data.task.id)||gn&&!vn(e.data).includes(gn.toLowerCase())?.22:1}}));return In.current=a(In.current,e),In.current},[oe,Fn,q.focusId,q.detailed,q.canvasSize,gn,vn,ut,Mt,Ie,kt,t,Xt,G,n.historical,lt,Wt,Ht,Gt,qt,r,s]),Rn=(0,X.useRef)([]),zn=(0,X.useMemo)(()=>{let e=new Map;for(let t of Bt.branches){if(t.group)continue;let n=t.parent_id??``;e.set(n,(e.get(n)??0)+1)}let n=new Map,r=Bt.branches.map(r=>{let i=r.parent_id??``,a=Bt.frames[r.id],o=r.group?void 0:(n.get(i)??0)+1;return o!==void 0&&n.set(i,o),{id:r.id,type:`branch`,position:Vt[r.id]??{x:0,y:0},width:a.width,height:a.height,style:{width:a.width,height:a.height,opacity:lt&&!lt.has(i)?.22:1},hidden:!Fn.has(r.id),draggable:!1,selectable:!1,focusable:!1,data:{task:r,zh:t,parentCardId:Bt.branchAnchor.get(r.id),open:Mn,toggleGroup:V,fanIndex:o,fanCount:o===void 0?void 0:e.get(i)}}});return Rn.current=a(Rn.current,r),Rn.current},[Bt,Vt,Fn,t,Mn,V,lt]),Bn=(0,X.useMemo)(()=>zn.length?[...Ln,...zn]:Ln,[Ln,zn]),Vn=(0,X.useMemo)(()=>{let n=Bt.links.filter(e=>Fn.has(e.source)&&Fn.has(e.target)&&(e.kind!==`replacement`||Dn)),r=W(n),i=new Map(Z.cards.map(e=>[e.id,e.task])),a=new Set;if(e.kind===`live`&&!g){for(let e of Z.cards)ge.has(e.task.status)&&a.add(e.id);for(let e of Bt.branches)ge.has(e.status)&&a.add(e.id)}return n.map((e,n)=>{let o=e.kind===`fanout`||e.kind===`fanin`,s=i.get(e.source)?.id,c=i.get(e.target)?.id,l=!!at&&e.kind===`dependency`&&(s===at.id||c===at.id),u=!!at&&!l&&(e.kind!==`continuation`||s!==at.id);return{id:e.id,source:e.source,target:e.target,...me({...Vt[e.source],...Bt.frames[e.source]},{...Vt[e.target],...Bt.frames[e.target]}),type:`relation`,data:{growthDelay:Xt.links[e.id]??(Gt?At(Yt.get(e.source)??1):qt&&Yt.get(e.target)===xn?120:void 0),active:a.has(e.target),lit:Wt.edges.has(e.id),lane:r[n],muted:u,quiet:!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)},className:`map-edge-${e.kind}${Wt.edges.has(e.id)?` is-lit`:``}`,label:o?void 0:e.label||(e.kind===`replacement`?(i.get(e.source)?.superseded_reason||``).replace(/\s+/g,` `).slice(0,60)||(t?`转入新计划`:`New plan`):e.kind===`dependency`?t?`依赖`:`Dependency`:t?`同一研究`:`Related work`),labelStyle:{fontSize:30,fill:e.kind===`replacement`?`#95809f`:`#6685a4`},labelBgPadding:[12,6],labelBgBorderRadius:12,labelBgStyle:{fill:`var(--map-paper)`,fillOpacity:.96},style:{opacity:u?.12:1,stroke:e.cycle?`#dc6648`:e.kind===`replacement`?`#a48caf`:e.kind===`dependency`?`#527fa7`:`#7594ad`,strokeWidth:l?2.6:e.kind===`dependency`?2:o?1.1:1.6,vectorEffect:`non-scaling-stroke`,strokeDasharray:e.kind===`dependency`||e.kind===`context`||e.kind===`continuation`||o?void 0:`5 6`},markerEnd:{type:Ts.ArrowClosed,color:e.kind===`replacement`?`#a48caf`:`#8aa5b8`,width:32,height:32},ariaLabel:e.evidence||(o?`Team branch: ${e.source} → ${e.target}`:e.kind===`dependency`?`Dependency: ${e.source} → ${e.target}`:`Plan replacement: ${e.source} → ${e.target_plan_id} (${e.target_count} tasks, representative ${e.target})`)}})},[Bt,Fn,Dn,t,Xt,e.kind,g,Z.cards,at,Vt,Wt,Gt,qt,xn,Yt]),Hn=K.links.filter(e=>e.kind===`replacement`).length,Un=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(e=>e.completionScope).map(e=>e.task.id)),n={done:0,ended:0,running:0,question:0,review_unavailable:0,held:0,failed:0,other:0};for(let r of e.tasks)t.has(r.id)?n.ended++:r.status===`done`?n.done++:ge.has(r.status)?n.running++:r.pending_question?n.question++:Ve(r)===`review_unavailable`?n.review_unavailable++:Ve(r)===`held`?n.held++:r.status===`failed`?n.failed++:n.other++;return n},[e.tasks,Z.cards]),Wn=Un.done,Gn=(0,X.useCallback)(e=>ut?.cards?.[`${e.id}:outcome`]?.summary||``,[ut]),Kn=(0,X.useMemo)(()=>e.tasks.some(e=>e.turn_kind!==`qa`&&e.kind!==`turn`)?ee(e.tasks,e.events,t,Gn):null,[e.tasks,e.events,t,Gn]),qn=He(c,c.mission_view,u),Jn=we(qn,c.mission_view,u,t?`zh-CN`:`en`,y.connected,De(c,c.mission_view,qn.taskId)),Yn=e=>{it(null),An(``),Sn(t=>Math.max(t,Z.cards.find(t=>t.id===e)?.ordinal||1)),q.enter(e)},Xn=()=>{let e=Z.cards.filter(e=>e.task.id===Pe?.id).at(-1);e&&(Le(null),Yn(e.id))},Zn=()=>{let n=qe(e.tasks);n?(Yn(Z.cards.filter(e=>e.task.id===n.id).at(-1).id),An(``)):An(t?`发送一个目标,地图就会开始生长`:`Send a goal to start your map`)},Qn=()=>{let e=Ze[(tt+1)%Ze.length];e&&Yn(Z.cards.filter(t=>t.task.id===e.id).at(-1).id)};(0,X.useEffect)(()=>{let e=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.isComposing)&&!e.target?.closest(`input, textarea, select, [contenteditable], [role="dialog"]`)){if(e.key===`/`)e.preventDefault(),fe.current?.querySelector(`.map-search input`)?.focus();else if(e.key===`f`||e.key===`F`)Pn();else if((e.key===`ArrowRight`||e.key===`ArrowLeft`)&&q.detailed&&q.focusId){let t=Z.cards.filter(e=>Fn.has(e.id)),n=t.findIndex(e=>e.id===q.focusId);if(n<0)return;let r=t[n+(e.key===`ArrowRight`?1:-1)];r&&(e.preventDefault(),q.enter(r.id))}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pn,q.enter,q.detailed,q.focusId,Z.cards,Fn]);let $n=(0,X.useMemo)(()=>({artifacts:y.artifacts,onOpenArtifact:y.onOpenArtifact}),[y.artifacts,y.onOpenArtifact]),er=(0,Y.jsxs)(`div`,{className:`map-playback`,"data-floating":e.kind===`live`,children:[(0,Y.jsx)(`button`,{"aria-label":Cn?`Pause reveal`:`Play reveal`,onClick:()=>{xn>=K.tasks.length&&Sn(1),wn(e=>!e)},children:Cn?(0,Y.jsx)(et,{size:14}):(0,Y.jsx)(D,{size:14})}),(0,Y.jsx)(`button`,{"aria-label":`Restart reveal`,onClick:()=>{wn(!1),Sn(1),e.kind!==`live`&&q.back()},children:(0,Y.jsx)(ct,{size:13})}),(0,Y.jsx)(`span`,{children:t?`逐卡展开`:`Reveal cards`}),(0,Y.jsx)(`input`,{"aria-label":`Visible task count`,type:`range`,min:Math.min(1,K.tasks.length),max:K.tasks.length,value:xn,onChange:e=>{wn(!1),Sn(Number(e.target.value))}}),(0,Y.jsxs)(`span`,{className:`map-count`,children:[xn,` / `,K.tasks.length]}),(0,Y.jsx)(`button`,{"aria-label":`Reveal next card`,disabled:xn>=K.tasks.length,onClick:()=>Sn(e=>Math.min(K.tasks.length,e+1)),children:(0,Y.jsx)(ie,{size:14})}),(0,Y.jsx)(`small`,{children:t?`时间顺序`:`Chronological order`}),e.kind===`live`&&(0,Y.jsx)(`button`,{className:`map-replay-exit`,"aria-label":t?`回到当前`:`Back to the present`,title:t?`回到当前`:`Back to the present`,onClick:()=>{wn(!1),Jt(!1),Sn(K.tasks.length)},children:(0,Y.jsx)(v,{size:14})})]});return(0,Y.jsx)(Tm.Provider,{value:q.zoomSteps,children:(0,Y.jsx)(fm.Provider,{value:sn,children:(0,Y.jsxs)(pm.Provider,{value:$n,children:[ut?.generation_error&&(0,Y.jsxs)(`div`,{role:`status`,className:`map-paused-label`,children:[t?`地图说明暂时不可用,任务和已有说明仍可阅读。`:`Map explanation unavailable; tasks and saved explanations remain readable.`,ut.generation_error.code===`cost_unreconciled`&&(t?` 调用费用待对账,并非预算耗尽。`:` Provider usage awaits reconciliation, not budget exhaustion.`)]}),e.kind===`live`&&!qt&&Kn&&(0,Y.jsxs)(`dl`,{className:`map-brief`,"aria-label":t?`任务进展`:`Task progress`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`正在做`:`Now`}),(0,Y.jsx)(`dd`,{title:Kn.goal,children:qn.state===`running`||qn.state===`waiting`||qn.reason===`operator_input`?Jn:Kn.current})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`已有结果`:`Results`}),(0,Y.jsx)(`dd`,{children:Kn.conclusion})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`接下来`:`Next`}),(0,Y.jsx)(`dd`,{children:Kn.next})]})]}),(0,Y.jsxs)(`div`,{className:`map-status-row`,children:[e.tasks.length>0&&(0,Y.jsx)(`span`,{className:`map-progress`,"aria-hidden":`true`,children:[`done`,`ended`,`running`,`question`,`review_unavailable`,`held`,`failed`,`other`].map(e=>Un[e]>0?(0,Y.jsx)(`i`,{"data-bucket":e,style:{flexGrow:Un[e]}},e):null)}),(0,Y.jsxs)(`p`,{className:`map-status-line`,role:`status`,children:[n.pending||!g&&(r||s)?(0,Y.jsx)(`i`,{className:`map-live-dot`,"aria-hidden":!0}):null,(0,Y.jsx)(`span`,{className:`map-status-text`,children:Ue({total:e.tasks.length,qa:e.tasks.filter(e=>e.turn_kind===`qa`).length,complete:Wn,ended:Un.ended,reviewUnavailable:Un.review_unavailable,held:Un.held,running:Un.running,pending:n.pending,paused:g,hasOpenWork:e.tasks.some(e=>[`running`,`pending`,`paused`,`held`,`question`].includes(Ve(e))),role:r,current:e.kind===`live`&&![`idle`,`step_finished`].includes(qn.state)?Jn:void 0,waiting:s?.sentence,zh:t})}),Ze.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`map-status-sep`,"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`button`,{type:`button`,className:`map-attention-link`,onClick:Qn,title:t?`跳到需要你处理的任务`:`Jump to the task waiting on you`,"aria-label":t?`逐个查看 ${Ze.length} 项需要你处理的任务`:`Cycle through ${Ze.length} tasks needing attention`,children:t?`${Ze.length} 项需要你处理`:`${Ze.length} ${Ze.length===1?`needs`:`need`} your attention`})]})]})]}),e.kind===`live`&&Pe&&!qt&&(0,Y.jsxs)(`div`,{className:`map-final-review`,role:`status`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:t?`最终结果已检查通过`:`Final delivery passed review`}),Ne?.data.task.id!==Pe.id&&Ne?.data.task.outcome?.review_status===`unavailable`&&(Pe.finished_ts??0)>(Ne.data.task.finished_ts??0)?(0,Y.jsx)(`span`,{children:t?` · 本项目后续已交付;此卡保留当次审查异常。`:` · This project was delivered later; this card retains its earlier review error.`}):null]}),(0,Y.jsx)(`button`,{type:`button`,onClick:Xn,children:t?`查看结果检查`:`View final review`}),y.deliveryCount>0&&(0,Y.jsx)(`button`,{type:`button`,onClick:y.onOpenDelivery,children:t?`查看项目成果`:`View project deliverables`})]}),e.kind===`live`&&!p&&(0,Y.jsx)(_e,{questions:c.pending_questions??[],backlog:c.backlog,currentTaskId:l??c.mission_view?.mission.id,onAnswer:y.onAnswer,onLocate:e=>{let t=Z.cards.filter(t=>t.task.id===e).at(-1);t&&Yn(t.id)}}),q.detailed&&tt>=0&&(0,Y.jsxs)(`div`,{className:`map-attention-detail`,role:`status`,children:[(0,Y.jsxs)(`strong`,{children:[t?`待处理`:`Needs attention`,` `,tt+1,` / `,Ze.length]}),(()=>{let n=ne(Ze[tt],e.events,t,Gn(Ze[tt]));return(0,Y.jsxs)(`div`,{tabIndex:0,children:[(0,Y.jsx)(`p`,{children:n.reason}),(0,Y.jsx)(`p`,{children:n.next}),n.detail&&(n.showDetail?(0,Y.jsxs)(`blockquote`,{className:`map-attention-quote`,children:[(0,Y.jsx)(`strong`,{children:t?`暂停原因原文`:`Recorded reason`}),` `,n.detail]}):(0,Y.jsxs)(`details`,{children:[(0,Y.jsx)(`summary`,{children:t?`原始记录`:`Recorded words`}),(0,Y.jsx)(`p`,{children:n.detail})]}))]})})()]}),at&&ot&&(0,Y.jsxs)(`nav`,{className:`map-dependencies`,"aria-label":t?`任务来路与去向`:`Task dependencies`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`来路`:`Depends on`}),ot.upstream.length?ot.upstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的前置依赖`:`No recorded prerequisites`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`当前`:`Selected`}),(0,Y.jsxs)(`button`,{className:`map-trace-task`,title:at.title,onClick:()=>Yn(Z.cards.find(e=>e.task.id===at.id).id),children:[at.title,` · `,t?`查看任务`:`Open task`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`去向`:`Enables`}),ot.downstream.length?ot.downstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的后续依赖`:`No recorded dependents`})]})]}),(0,Y.jsx)(`div`,{className:`map-workspace`,children:(0,Y.jsxs)(`div`,{ref:fe,className:`map-canvas-wrap`,"data-focused":!!q.focusId,"data-detailed":q.detailed,"data-fitted":xe,"data-hovering":!!Ht&&!q.detailed,children:[(0,Y.jsxs)(`div`,{className:`map-ambient`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),j&&(0,Y.jsx)(dt,{events:y.conversationEvents,connected:y.connected,pending:n.pending,artifacts:y.artifacts,zh:t,onClose:()=>N(!1),onOpenArtifact:y.onOpenArtifact,onOpenDelivery:y.onOpenReceipt}),k&&e.kind===`live`&&(0,Y.jsx)(`aside`,{className:`map-agent-drawer nowheel nodrag nopan`,children:(0,Y.jsx)(Re,{sid:c.session.id,view:c.mission_view,roles:c.roles,events:u,taskId:Ne?.data.task.id||c.mission_view?.mission.id||void 0,paused:g&&!n.pending,onClose:()=>A(!1)})}),G&&!p&&(0,Y.jsx)(_t,{flight:G,canvas:fe,zh:t,historical:n.historical,onReveal:t=>{e.tasks.some(e=>e.id===t)&&q.fit()},onLand:e=>te(t=>t?.id===e?{...t,landed:!0}:t),onFinish:e=>te(t=>t?.id===e?null:t)}),(0,Y.jsxs)(`div`,{className:`map-canvas-toolbar nowheel`,children:[(0,Y.jsxs)(`label`,{className:`map-search`,children:[(0,Y.jsx)(b,{size:14}),(0,Y.jsx)(`input`,{"aria-label":t?`搜索地图任务`:`Search map tasks`,placeholder:t?`搜索任务…`:`Find a task…`,title:t?`Enter 逐个跳转匹配`:`Enter jumps through matches`,value:gn,onChange:e=>_n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&yn.length?Yn(yn[(bn+1)%yn.length].id):e.key===`Escape`&&gn&&(e.stopPropagation(),_n(``))}}),gn&&(0,Y.jsx)(`span`,{className:`map-search-count`,"aria-live":`polite`,children:yn.length?bn>=0?`${bn+1}/${yn.length}`:`${yn.length} ${t?`项`:`found`}`:t?`无匹配`:`0 found`})]}),(0,Y.jsxs)(`button`,{onClick:Zn,title:t?`定位当前或最近任务`:`Locate current or latest task`,"aria-label":t?`定位当前`:`Locate current`,children:[(0,Y.jsx)(st,{size:15}),(0,Y.jsx)(`span`,{children:t?`定位当前`:`Locate current`})]}),(0,Y.jsx)(`button`,{className:`map-fit-button`,onClick:Pn,title:t?`适配全图`:`Fit map`,"aria-label":`Fit map`,children:(0,Y.jsx)(Qe,{size:15})}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":t?`来路 / 去向`:`Trace dependencies`,title:t?`突出显示任务的直接前后依赖;点击卡片切换,再次点击退出`:`Highlight direct dependencies; click a card to switch, click it again to exit`,"aria-pressed":!!at,disabled:!K.tasks.length,onClick:()=>jn(at?null:Ne?.data.task.id??qe(e.tasks)?.id??null),children:[(0,Y.jsx)(E,{size:15}),(0,Y.jsx)(`span`,{children:t?`来路 / 去向`:`Dependencies`})]}),e.kind===`live`&&K.tasks.length>1&&!q.detailed&&!qt&&(0,Y.jsxs)(`button`,{onClick:()=>{Jt(!0),Sn(1),wn(!0)},title:t?`回放这项研究是如何展开的`:`Replay how this research unfolded`,"aria-label":`Replay`,children:[(0,Y.jsx)(T,{size:15}),(0,Y.jsx)(`span`,{children:t?`回放`:`Replay`})]}),q.detailed&&(0,Y.jsxs)(`button`,{onClick:q.back,className:`map-back-button`,"aria-label":`Return to map`,children:[(0,Y.jsx)(w,{size:14}),(0,Y.jsx)(`span`,{children:t?`返回全图`:`Overview`})]}),q.detailed&&Ne&&Ne.data.partCount>1&&(0,Y.jsxs)(`nav`,{className:`map-part-switcher`,"aria-label":t?`切换任务部分`:`Switch task part`,children:[(0,Y.jsx)(`button`,{"aria-label":t?`上一部分`:`Previous part`,disabled:!Ne.data.previousId,onClick:()=>Ne.data.previousId&&Mn(Ne.data.previousId,!0),children:(0,Y.jsx)(rt,{size:15})}),(0,Y.jsxs)(`span`,{children:[Ne.data.part,` / `,Ne.data.partCount]}),(0,Y.jsx)(`button`,{"aria-label":t?`下一部分`:`Next part`,disabled:!Ne.data.nextId,onClick:()=>Ne.data.nextId&&Mn(Ne.data.nextId,!0),children:(0,Y.jsx)(ie,{size:15})})]}),(0,Y.jsx)(`span`,{className:`map-toolbar-gap`,"aria-hidden":!0}),e.kind===`live`&&(0,Y.jsxs)(`div`,{className:`map-workspace-actions`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":j,"aria-label":t?`对话`:`Conversation`,title:t?`与 Argus 的对话`:`Your conversation with Argus`,onClick:()=>{N(e=>!e),A(!1)},children:[(0,Y.jsx)(L,{size:15}),(0,Y.jsx)(`span`,{children:t?`对话`:`Conversation`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-agent-toggle`,"aria-expanded":k,"aria-label":t?`Agent 动态`:`Agent activity`,title:t?`各个 Agent 正在做什么`:`What each agent is doing`,onClick:()=>{A(e=>!e),N(!1)},children:[(0,Y.jsx)(_,{size:15}),(0,Y.jsx)(`i`,{"data-active":!!r||n.pending,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:t?`工作详情`:`Work details`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-delivery-toggle`,disabled:!y.deliveryCount,"aria-label":t?`交付成果`:`Deliveries`,title:t?`已交付的成果`:`What has been delivered`,onClick:y.onOpenDelivery,children:[(0,Y.jsx)(de,{size:15}),(0,Y.jsx)(`span`,{children:t?`交付成果`:`Deliveries`}),y.deliveryCount>0&&(0,Y.jsx)(`b`,{children:y.deliveryCount})]})]})]}),kn&&(0,Y.jsx)(`div`,{className:`map-feedback`,role:`status`,children:kn}),K.tasks.length===0?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(E,{size:36}),(0,Y.jsx)(`h3`,{children:t?`把一个目标,变成可见的成果`:`Turn a goal into a visible result`}),(0,Y.jsx)(`p`,{children:p?t?`尚无任务记录。`:`No task records are available.`:t?`描述你想完成的事情,看 Argus 规划、执行、审查,最后在这里交付。`:`Describe your goal. Watch Argus plan, build, review, and deliver here.`}),!p&&(0,Y.jsx)(`div`,{className:`map-starters`,children:(t?[[`交互实验`,`做一个交互式实验室,用动画展示 Dijkstra 和 A* 怎样寻找最短路径。让我能画障碍、单步播放、比较探索范围,并验证两个算法的结果一致。`],[`数据洞察`,`用一组可复现的模拟数据,做一个辛普森悖论交互演示。让我能切换整体和分组视角,看结论怎样反转,附上验证过程。`],[`产品原型`,`做一个精致的个人旅行规划网页。我能调整预算和出行天数,比较三种行程方案,并将选中的方案导出。让手机上也方便操作。`]]:[[`Interactive lab`,`Build an interactive Dijkstra vs A* pathfinding lab with editable obstacles, step-by-step animation, and correctness checks.`],[`Data insights`,`Create an interactive Simpson’s paradox demo using reproducible synthetic data, with aggregate and grouped views and validation.`],[`Product prototype`,`Build a polished travel planner. Let me adjust budget and duration, compare three itineraries, and export my choice. Make it easy to use on a phone.`]]).map(([e,t])=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{n.onChange(t),requestAnimationFrame(()=>fe.current?.querySelector(`textarea`)?.focus())},children:[e,` ↗`]},e))})]}):(0,Y.jsxs)(Cp,{nodes:Bn,edges:Vn,nodeTypes:Eh,edgeTypes:Dh,onNodesChange:ue,onNodeMouseEnter:(e,t)=>Ut(t.id),onNodeMouseLeave:()=>Ut(null),onMove:q.onMove,defaultViewport:Fm,minZoom:.01,maxZoom:3.5,nodesDraggable:!1,nodesFocusable:!1,nodesConnectable:!1,edgesReconnectable:!1,zoomOnScroll:!1,zoomOnPinch:!0,zoomOnDoubleClick:!1,deleteKeyCode:null,selectionKeyCode:null,onlyRenderVisibleElements:xe&&pe,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Fp,{variant:jp.Dots,gap:88,size:3,color:`var(--map-dot)`}),(0,Y.jsx)(Wp,{orientation:`horizontal`,showInteractive:!1,onFitView:Pn,fitViewOptions:{padding:.16,maxZoom:.27,minZoom:.01,duration:q.reducedMotion?0:320}}),(0,Y.jsx)(am,{nodeColor:e=>e.type===`branch`?`#cfd2d5`:Oh[Ve(e.data.task)]??`#c6c8cb`,maskColor:`var(--map-minimap-mask)`,maskStrokeColor:`#6d737a`,maskStrokeWidth:1.5,onClick:(e,t)=>q.navigate(t),pannable:!0,zoomable:!0,ariaLabel:t?`地图导航预览`:`Map navigation preview`})]}),e.kind===`live`&&qt&&er,(0,Y.jsxs)(`div`,{className:`map-legend nowheel`,children:[(0,Y.jsxs)(`span`,{title:t?`内容相关的工作,不是执行依赖`:`Related in content, not an execution dependency`,children:[(0,Y.jsx)(`b`,{className:`dashed`}),t?`内容关联`:`Related work`]}),(0,Y.jsxs)(`span`,{title:t?`工作发生的先后`:`The order work happened in`,children:[(0,Y.jsx)(`b`,{className:`order`}),t?`先后`:`Order`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{}),t?`任务依赖`:`Dependency`]}),(0,Y.jsxs)(`button`,{className:Dn?``:`is-muted`,onClick:On,"aria-pressed":Dn,disabled:Hn===0,"aria-label":`Toggle plan replacements`,children:[(0,Y.jsx)(`b`,{className:`replacement`}),t?`计划替代`:`Plan changes`,Hn?` · ${Hn}`:``]})]}),!p&&(0,Y.jsx)(oh,{...n,pendingLabel:f,progressVisible:!j,dispatchStatus:G?.result?.type===`task`?G.landed||n.historical?`task`:`launching`:G?.result?.outcome,onSend:Qt,onCancel:$t,overview:!q.detailed}),nn&&!p&&(0,Y.jsxs)(`div`,{className:`map-context-menu`,role:`menu`,style:{left:nn.x,top:nn.y},children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{tn(nn.ref),rn(null)},children:t?`引用`:`Reference`}),e.kind===`live`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{dn(``),ln({ref:nn.ref,x:nn.x,y:nn.y}),rn(null)},children:t?`添加批注`:`Add a note`}),(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{n.onRouteOverrideChange?.(`task`),tn(nn.ref),rn(null)},children:t?`从这里展开`:`Branch from here`})]})]}),cn&&!p&&(0,Y.jsxs)(`div`,{className:`map-note-editor nodrag nopan`,style:{left:Math.min(window.innerWidth-320,cn.x),top:Math.min(window.innerHeight-240,cn.y)},children:[(0,Y.jsx)(`small`,{children:t?`批注《${cn.ref.task_title}》`:`Note on “${cn.ref.task_title}”`}),(0,Y.jsx)(`textarea`,{autoFocus:!0,maxLength:2e3,value:un,onChange:e=>dn(e.target.value),placeholder:t?`写下你的观察,Argus 在下个规划周期会读到`:`Your observation; Argus reads it next planning cycle`}),fn&&(0,Y.jsx)(`small`,{className:`map-note-error`,children:t?`没有保存上,稍后再试;草稿还在`:`Not saved; try again — the draft is kept`}),(0,Y.jsxs)(`div`,{className:`map-note-actions`,children:[(0,Y.jsx)(`button`,{onClick:()=>ln(null),children:t?`取消`:`Cancel`}),(0,Y.jsx)(`button`,{className:`is-primary`,disabled:!un.trim(),onClick:()=>void mn(),children:t?`保存`:`Save`})]})]}),(K.cyclic||K.missing>0)&&(0,Y.jsx)(`div`,{className:`map-graph-warning`,children:K.cyclic?t?`检测到循环引用,保留原始连线。`:`Cyclic references retained.`:`${K.missing} ${t?`个依赖不在当前记录范围内`:`dependencies outside the available history`}`})]})}),e.kind!==`live`&&er,(0,Y.jsx)(S,{open:!!J,onClose:()=>Le(null),label:J?.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,children:J&&(mt||J.turn_kind===`qa`)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{title:J.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,sub:J.turn_kind===`qa`?J.objective||J.title:ut?.cards[J.id]?.title||J.title}),(0,Y.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`map-task-reading`,"data-task-id":J.id,children:[J.outcome?.review_status===`unavailable`&&(0,Y.jsxs)(`p`,{className:`mb-3 text-sm text-ink-dim`,role:`status`,children:[t?`当次审查异常,未形成审阅结论。`:`No review judgment was returned on this attempt.`,Pe&&(Pe.finished_ts??0)>(J.finished_ts??0)&&(0,Y.jsx)(`button`,{type:`button`,className:`ml-2 text-blue underline`,onClick:Xn,children:t?`查看本项目后续通过的最终审稿`:`View this project's later accepted final review`})]}),Je?.data.completionScope?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:Je.data.completionScope}):null,(0,Y.jsx)(ye,{cardKey:J.id,taskId:J.id,card:ut?.cards[J.id],task:J,readOnly:p,originalDetail:J.turn_kind===`qa`?Ge?.text||(J.status===`running`?t?`正在回答…`:`Answering…`:J.status===`cancelled`?t?`本次回答已中断。`:`This answer was interrupted.`:J.summary||(t?`尚无回答。`:`No answer recorded.`)):J.objective||J.summary||(t?`这项任务尚无详细记录。`:`No detailed task record is available.`),selection:kt,artifacts:$n.artifacts,onOpenArtifact:$n.onOpenArtifact}),p?null:(0,Y.jsx)(C,{className:`mt-3 text-xs`,onClick:()=>tn({source:e.id,task_id:J.id,task_title:ut?.cards[J.id]?.title||J.title,event_ids:Ge?[Ge.id]:ut?.cards[J.id]?.event_ids||mt?.event_ids||[],lang:t?`zh`:`en`}),children:J.turn_kind===`qa`?t?`引用这条问答`:`Reference this Q&A`:t?`引用此任务`:`Reference this task`})]})]}):null})]})})})}var jh=(0,X.memo)(function({snapshot:e,currentTaskId:t,events:n,managerSteps:r=[],draft:a,onDraftChange:s,onSend:c,attachments:l,onAttachmentsChange:u,pending:f,onCancel:m,focusSignal:h,readOnly:g=!1,onOpenSettings:_,routeOverride:v,onRouteOverrideChange:y,conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}){let{locale:O}=p(),j=O===`zh-CN`,[N,F]=(0,X.useState)([]),I=l??N,L=(0,X.useRef)(I);L.current=I;let B=(0,X.useCallback)(e=>{let t=typeof e==`function`?e(L.current):e;L.current=t,u?u(t):F(t)},[u]),ee=(0,X.useRef)(a);ee.current=a;let V=(0,X.useRef)(!0);(0,X.useEffect)(()=>(V.current=!0,()=>{V.current=!1}),[]);let H=(0,X.useCallback)(async(e,t=[],n,r)=>{let i=!1,a=await c(e,t,r=>{r.type===`settled`&&r.outcome===`error`&&(i=!0),V.current&&(r.type===`settled`&&r.outcome===`error`&&!ee.current.trim()&&(s(e),B(e=>e.length?e:t)),n?.(r))},r);return a&&!i&&V.current&&(ee.current===e&&s(``),B(e=>e.filter(e=>!t.includes(e)))),a},[c,s,B]),[U,W]=(0,X.useState)(()=>new URLSearchParams(window.location.search).get(`dataset`)||A(`argus.map.source.v1`)||`live`),G=i({queryKey:[`map-datasets`],queryFn:({signal:e})=>d.mapDatasets(e),staleTime:1/0}),te=i({queryKey:[`map-dataset`,U],queryFn:({signal:e})=>d.mapDataset(U,e),enabled:U!==`live`,staleTime:1/0,retry:!1}),ne=o(),re=`argus.map.history.v1:`+e.session.id,[ie,K]=(0,X.useState)(()=>ae(A(re))),[oe,se]=(0,X.useState)(!1),ce=i({queryKey:[`map-info`,e.session.id],queryFn:({signal:t})=>d.mapInfo(e.session.id,t),enabled:U===`live`,staleTime:6e4}),le=ie??(ce.data&&!ce.data.requires_choice?{mode:`full`}:null);(0,X.useEffect)(()=>{if(!ie&&ce.data&&!ce.data.requires_choice){let e={mode:`full`};K(e),k(re,JSON.stringify(e))}},[ce.data,ie,re]);let ue=U!==`live`||!!le&&le.mode!==`off`&&!oe,de=[`map-live`,e.session.id,le?.mode,le?.since,le?.eventSince,le?.taskId],q=JSON.stringify([U,e.session.id,O,le]),pe=e=>{K(e),k(re,JSON.stringify(e)),se(!1)},me=i({queryKey:de,queryFn:async({signal:t})=>{let n=ne.getQueryData(de),r=le?.mode===`full`?await d.mapHistory(e.session.id,t,n?.history_cursor,n?.cursor):await d.liveMap(e.session.id,t,n?.cursor,le||void 0);return R(ne.getQueryData(de),r)},enabled:U===`live`&&ue,staleTime:1/0,gcTime:72e5,refetchOnMount:`always`,refetchInterval:t=>fe(ue,t.state.data,e)}),he=U===`live`&&z(e),ge=He(e,e.mission_view,n),_e=ge.reason===`background_work`&&ge.taskId?ke(ge,j?`zh-CN`:`en`):``,ve=(0,X.useMemo)(()=>U===`live`&&!he&&_e?{taskId:ge.taskId,sentence:_e}:void 0,[U,he,ge.taskId,_e]),ye=n.filter(e=>e.run_label!==`map-summary`&&/^(life\.(mission\.|phase\.|planner\.task_added)|manager\.turn\.|round\.|agent\.message|engineer\.progress|ui\.argus|team\.|idea\.portfolio\.)/.test(String(e.type))).at(-1),be=JSON.stringify([ye?.ts,ye?.event_id||ye?.id,ye?.revision,ye?.updated_ts,ye?.status,e.backlog,he]),xe=(0,X.useRef)(null),Se=(0,X.useRef)(0),Ce=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=Ce.current;if(!e)return;let t=()=>{Se.current=Date.now()+900},n=e=>{e.buttons&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`pointerdown`,t),e.addEventListener(`pointermove`,n),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`pointerdown`,t),e.removeEventListener(`pointermove`,n)}},[]),(0,X.useEffect)(()=>{if(U!==`live`||!ue||xe.current)return;let t=()=>{let n=Se.current-Date.now();if(n>0){xe.current=setTimeout(t,n+120);return}xe.current=null,ne.invalidateQueries({queryKey:[`map-live`,e.session.id]})};xe.current=setTimeout(t,650)},[be,U,e.session.id,ne,ue]),(0,X.useEffect)(()=>()=>{xe.current&&clearTimeout(xe.current),xe.current=null},[U,e.session.id,ue]);let we=U===`live`?me.data:te.data,[Te,Ee]=(0,X.useState)(!1),De=(0,X.useMemo)(()=>({shown:Te,toggle:()=>Ee(e=>!e)}),[Te]),Oe=(0,X.useMemo)(()=>we?M(we.tasks).links.filter(e=>e.kind===`replacement`).length:0,[we]),Ae=(0,X.useMemo)(()=>({conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}),[b,x,S,C,w,T,E,D]),je=(0,X.useMemo)(()=>({footer:(0,Y.jsx)(Xe,{sid:e.session.id,roles:e.roles,running:e.daemon.alive||!!e.manager_requests?.length,lastCall:e.last_call,onOpenSettings:g?void 0:_}),routeOverride:v,onRouteOverrideChange:y,value:a,onChange:s,onSend:H,attachments:I,onAttachmentsChange:B,pending:f,onCancel:m,focusSignal:h,sessionName:e.session.display_name||e.session.id,historical:U!==`live`,zh:j}),[v,y,a,s,H,I,f,m,h,e.session.display_name,e.session.id,U,j,e.roles,e.daemon.alive,e.manager_requests,e.last_call,g,_]),Me=e=>{W(e),k(`argus.map.source.v1`,e);let t=new URL(window.location.href);t.searchParams.set(`dataset`,e),window.history.replaceState(null,``,t)};return(0,Y.jsxs)(`section`,{ref:Ce,className:`argus-map`,"aria-label":j?`进度地图`:`Progress map`,children:[(0,Y.jsxs)(`header`,{className:`map-header`,children:[(0,Y.jsxs)(`div`,{className:`map-heading`,children:[(0,Y.jsx)(`span`,{className:`map-kicker`,"aria-hidden":`true`,children:j?`ARGUS · 研究地图`:`ARGUS · RESEARCH MAP`}),(0,Y.jsx)(`h1`,{title:e.session.display_name,children:e.session.display_name})]}),(0,Y.jsxs)(`details`,{className:`map-more`,children:[(0,Y.jsx)(`summary`,{"aria-label":j?`地图选项`:`Map options`,title:j?`地图选项`:`Map options`,children:(0,Y.jsx)(ut,{size:16})}),(0,Y.jsxs)(`div`,{className:`map-more-menu`,children:[we&&(0,Y.jsx)(kh,{events:we.events,zh:j}),(0,Y.jsxs)(`div`,{className:`map-dataset-bar`,children:[(0,Y.jsx)(it,{size:15}),(0,Y.jsxs)(`select`,{"aria-label":j?`地图数据来源`:`Map data source`,value:U,onChange:e=>Me(e.target.value),children:[(0,Y.jsxs)(`option`,{value:`live`,children:[j?`当前会话`:`Current session`,` ·`,` `,e.session.display_name]}),!G.data?.datasets.some(e=>e.id===U)&&U!==`live`&&(0,Y.jsx)(`option`,{value:U,children:U}),G.data?.datasets.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.task_count]},e.id))]}),we?.captured_at&&(0,Y.jsxs)(`span`,{className:`map-capture`,children:[(0,Y.jsx)(P,{size:12}),new Date(we.captured_at).toLocaleDateString()]})]}),U===`live`&&ce.data&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button`,onClick:()=>se(!0),children:j?`加载范围`:`History range`}),!g&&_&&(0,Y.jsx)(`button`,{type:`button`,onClick:_,className:`map-scope-button`,children:j?`地图模型设置`:`Map model settings`}),Oe>0&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button map-narrow-only`,"aria-pressed":Te,onClick:De.toggle,children:Te?j?`隐藏计划替代连线 · ${Oe}`:`Hide plan changes · ${Oe}`:j?`显示计划替代连线 · ${Oe}`:`Show plan changes · ${Oe}`})]})]})]}),U===`live`&&ce.data&&(0,Y.jsx)(Sh,{open:oe||!le&&ce.data.requires_choice,info:ce.data,zh:j,readOnly:g,onChoose:pe}),U===`live`&&ce.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[j?`暂时无法检查历史记录。`:`Could not check session history.`,(0,Y.jsx)(`button`,{onClick:()=>void ce.refetch(),children:j?`重试`:`Retry`})]}),ue&&we?.history_loading&&(0,Y.jsxs)(`div`,{className:`map-history-progress`,role:`status`,children:[j?`正在分批加载历史记录`:`Loading history in pages`,we.history_progress&&` · ${(we.history_progress.loaded_bytes/1024/1024).toFixed(1)} / ${(we.history_progress.total_bytes/1024/1024).toFixed(1)} MB`,(0,Y.jsx)(`button`,{onClick:()=>se(!0),children:j?`更改范围`:`Change range`})]}),ue&&we&&(U===`live`?me.isError:te.isError)&&(0,Y.jsxs)(`div`,{className:`map-data-error`,role:`status`,children:[j?`暂时无法更新,已保留加载的地图。`:`Updates are unavailable. Your loaded map is preserved.`,(0,Y.jsx)(`button`,{onClick:()=>void(U===`live`?me.refetch():te.refetch()),children:j?`重试`:`Retry`})]}),G.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[j?`历史记录列表暂时无法读取,可切换当前会话或重试。`:`Historical maps are unavailable. Open the current session or retry.`,(0,Y.jsx)(`button`,{onClick:()=>void G.refetch(),children:j?`重试`:`Retry`})]}),ue?(U===`live`?me.isError:te.isError)&&!we?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:j?`地图暂时无法读取`:`Map unavailable`}),(0,Y.jsx)(`p`,{children:String(U===`live`?me.error:te.error)}),(0,Y.jsx)(`button`,{onClick:()=>void(U===`live`?me.refetch():te.refetch()),children:j?`重试`:`Retry`})]}):we?(0,Y.jsx)(yp,{children:(0,Y.jsx)(Ah,{data:we,actions:Ae,snapshot:e,currentTaskId:t,events:n,pendingLabel:r.at(-1)?.detail||r.at(-1)?.label,viewKey:q,paused:he,sessionId:e.session.id,zh:j,readOnly:g,replacements:De,activePhase:U===`live`&&!he&&!ve?e.roles.find(e=>e.active)?.role:void 0,waiting:ve,composer:je})},q):(0,Y.jsxs)(`div`,{className:`map-empty is-loading`,"aria-busy":`true`,children:[(0,Y.jsxs)(`div`,{className:`map-ghosts`,"aria-hidden":!0,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),j?`正在载入地图…`:`Loading map…`]}):(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:j?`地图尚未开启`:`Map is not enabled`}),(0,Y.jsx)(`p`,{children:ce.isPending?j?`正在检查历史记录规模…`:`Checking history size…`:j?`选择加载范围后查看研究进度。`:`Choose a history range to view research progress.`}),ce.data&&(0,Y.jsx)(`button`,{onClick:()=>se(!0),children:j?`选择加载范围`:`Choose history range`})]})]})});export{Ah as MapCanvas,jh as MapPanel,kh as MapTeamProgress}; \ No newline at end of file diff --git a/frontend/web/dist/assets/MapPanel-BvIILI52.js b/frontend/web/dist/assets/MapPanel-BvIILI52.js new file mode 100644 index 000000000..38542d976 --- /dev/null +++ b/frontend/web/dist/assets/MapPanel-BvIILI52.js @@ -0,0 +1,7 @@ +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,v as r}from"./icons-DHjcpj5P.js";import{a as i,b as a,c as o,i as s}from"./query-dCPZk0Xc.js";import{N as c,O as l,U as u,W as d,k as f,q as p}from"./index-Cr9q41CR.js";import{A as m,C as h,F as g,I as _,L as v,O as y,_ as b,b as x,g as S,j as C,k as w,m as T,p as E,r as D,w as O,x as k}from"./AppearanceControls-BIflq6l1.js";import{t as A}from"./activity-DRTghqfr.js";import{n as j,t as M}from"./history-DKaffr1B.js";import{a as N,i as P,n as F,o as ee,r as I,t as L}from"./sliders-horizontal-BIXOePK5.js";import{a as R}from"./format-BNcptKD6.js";import{a as z,i as B,n as V}from"./useWorkbenchTheme-Drg51S8W.js";import{$ as H,A as U,At as W,B as te,C as G,D as ne,Dt as re,E as ie,G as ae,H as oe,I as K,It as se,J as ce,K as le,L as ue,Lt as de,M as fe,Mt as pe,N as me,Nt as he,O as q,Ot as ge,P as _e,Pt as ve,Q as ye,R as be,S as xe,T as Se,Tt as Ce,U as we,V as Te,W as Ee,X as De,Y as Oe,Z as ke,_ as Ae,a as je,b as Me,bt as Ne,c as Pe,ct as Fe,d as Ie,dt as Le,et as Re,f as ze,ft as Be,g as Ve,gt as He,h as Ue,ht as We,i as J,j as Ge,k as Ke,kt as qe,lt as Je,mt as Ye,n as Xe,o as Ze,pt as Qe,q as $e,r as et,s as tt,st as nt,u as rt,ut as it,v as at,vt as ot,w as st,x as ct,y as lt,yt as ut,z as dt}from"./App-ButSXpk-.js";var ft=v(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),pt=v(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),mt=v(`CornerDownLeft`,[[`polyline`,{points:`9 10 4 15 9 20`,key:`r3jprv`}],[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}]]),ht=v(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),gt=v(`ListChecks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),_t=v(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),vt=v(`Route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),Y=n();function yt({events:e,connected:t,pending:n,artifacts:r,zh:i,onClose:a,onOpenArtifact:o,onOpenDelivery:s}){let c=e.filter(e=>e.type===`ui.operator`||e.type===`ui.argus`);return(0,Y.jsxs)(`aside`,{className:`map-conversation nowheel nodrag nopan`,"aria-label":i?`地图对话`:`Map conversation`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(qe,{size:16}),(0,Y.jsx)(`strong`,{children:i?`与 ${f().name} 对话`:`Talk to ${f().name}`}),(0,Y.jsx)(`button`,{type:`button`,onClick:a,"aria-label":i?`关闭对话`:`Close conversation`,children:(0,Y.jsx)(y,{size:18})})]}),c.length?(0,Y.jsx)(xe,{events:c,connected:t,showReasoning:!1,onToggleReasoning:()=>{},embedded:!0,showHeader:!1,artifacts:r,onOpenArtifact:o,onOpenDelivery:s}):(0,Y.jsx)(`p`,{className:`map-conversation-empty`,children:i?`在下方发送目标或问题,回复会保留在这里。`:`Send a goal or question below. Your conversation stays here.`}),n&&!c.some(e=>e.type===`ui.argus`&&e.live===!0)&&(0,Y.jsx)(`p`,{className:`map-conversation-pending`,role:`status`,children:i?`${f().name} 正在回复…`:`${f().name} is replying…`})]})}var bt=new Set([`life.planner.task_added`,`life.mission.started`,`round.main.completed`,`round.review.completed`,`turn.asked`,`turn.replied`]);function xt(e,t,n=0){if(!e||!t)return[];let r=e.events.filter(e=>e.item_id===t.id&&bt.has(e.type)&&Number.isFinite(e.ts)&&e.ts>=n),i=Math.max(n,...r.filter(e=>e.type===`life.mission.started`).map(e=>e.ts)),a=r.filter(e=>e.ts>=i),o=new Map;for(let e of bt){let t=e.startsWith(`round.`)?2:1;for(let n of a.filter(t=>t.type===e).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id)).slice(-t))o.set(n.id,n)}return[...o.values()].sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id))}function St(e,t){return{key:e.id,task_id:e.id,kind:`task`,event_ids:t.map(e=>e.id)}}function Ct(e,t){return e?JSON.stringify({task:{id:e.id,title:e.title,objective:e.objective,status:e.status,summary:e.summary,acceptance_check:e.acceptance_check,goal_contribution:e.goal_contribution,plan_hypothesis:e.plan_hypothesis,non_goals:e.non_goals,outcome:e.outcome,pending_question:e.pending_question,started_ts:e.started_ts,finished_ts:e.finished_ts,attempt:e.attempt},events:t.map(e=>[e.id,e.revision??e])}):``}function wt(e){if(!e||typeof e!=`object`)return!1;let t=e;if(![`why`,`scope`,`next`].every(e=>typeof t[e]==`string`&&t[e].trim()))return!1;if(t.concept===null)return!0;if(!t.concept||typeof t.concept!=`object`)return!1;let n=t.concept;return[`name`,`explanation`,`example`,`connection`].every(e=>typeof n[e]==`string`&&n[e].trim())}function Tt({task:e,artifacts:t,onOpenArtifact:n}){let r=l().locale===`zh-CN`,i=typeof e?.pending_question==`string`?e.pending_question.trim():``;return i?(0,Y.jsxs)(`section`,{className:`mt-4 min-w-0 border-t border-line/60 pt-3 text-[13px] leading-6 text-ink-dim`,"data-reader-pending-question":e.id,children:[(0,Y.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:r?`这一步在等你回答`:`This step is waiting for your answer`}),(0,Y.jsx)(S,{artifacts:t,onOpenArtifact:n,children:i})]}):null}function Et({cardKey:e,taskId:t,card:n,task:r,originalDetail:i,selection:a,artifacts:o,onOpenArtifact:s,readOnly:c}){let{locale:u}=l(),d=u===`zh-CN`;if(r?.turn_kind===`qa`)return(0,Y.jsx)(`div`,{className:`macro-reader-markdown`,"data-reader-card":e,"data-reader-task-id":t,children:(0,Y.jsx)(S,{artifacts:o,onOpenArtifact:s,children:i})});let f=a?.request.key===e&&a.request.task_id===t?a:void 0,p=(n?.version??0)>=14&&wt(n?.reader_brief)?n.reader_brief:void 0;return(0,Y.jsxs)(`div`,{className:`font-sans`,"data-reader-card":e,"data-reader-task-id":t,children:[(0,Y.jsx)(je,{generatedAt:n?.generated_at,pending:f?.pending,generating:f?.generating,hasExplanation:!!n,phase:f?.phase,error:f?.error,unavailable:f?.unavailable,retry:f?.retry,retryDisabled:f?.retryDisabled}),f?.foundationRequired?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:d?`先在“问题基础”里选择一份说明,再阅读本次进展的解释。`:`Choose a saved foundation to explain this progress.`}):null,p?(0,Y.jsx)(J,{brief:p,identity:e,detail:n?.detail,learningPath:n?.learning_path,foundation:n?.foundation_ref,readingUnavailable:n?.teaching_review?.reading_review?.status===`unavailable`,teachingUnavailable:n?.teaching_review?.status===`unavailable`,artifacts:o,onOpenArtifact:s}):(0,Y.jsx)(`div`,{className:`macro-reader-markdown`,children:(0,Y.jsx)(S,{artifacts:o,onOpenArtifact:s,children:Ie(n?.detail||i)})}),(0,Y.jsx)(Tt,{task:r?.id===t?r:void 0,artifacts:o,onOpenArtifact:s}),(0,Y.jsx)(`div`,{className:`my-3`,children:(0,Y.jsx)(Xe,{card:n,cardKey:e,taskId:t,readOnly:c,context:f?.questionContext})})]})}var X=e(r(),1);function Dt({sid:e,record:t,expanded:n=!1,zh:r}){let[i,a]=(0,X.useState)(n),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(``);(0,X.useEffect)(()=>{if(!i||!e)return;let n=new AbortController;return u(!0),f(``),c.workRecord(e,t.role,t.id,n.signal).then(e=>{n.signal.aborted||s(e.detail)}).catch(e=>{n.signal.aborted||f(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||u(!1)}),()=>n.abort()},[i,e,t.id,t.role,t.detail]);let p=o.length>=t.detail.length?o:t.detail;return(0,Y.jsxs)(`details`,{open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(`span`,{children:i?r?`收起详情`:`Hide details`:r?`展开完整记录`:`Read full record`}),(0,Y.jsx)(g,{size:12})]}),(0,Y.jsxs)(Y.Fragment,{children:[l&&(0,Y.jsx)(`small`,{role:`status`,children:r?`正在读取完整记录…`:`Loading the full record…`}),d&&(0,Y.jsx)(`small`,{role:`status`,children:r?`暂未读取到完整记录,已显示保存的摘要。可收起后重试。`:`Full record unavailable; the saved preview is shown. Reopen to retry.`}),(0,Y.jsx)(`div`,{className:`agent-record-actions`,children:(0,Y.jsx)(b,{text:p,label:r?`复制完整记录`:`Copy full record`,copiedLabel:r?`已复制`:`Copied`})}),(0,Y.jsx)(`div`,{className:`agent-record-detail`,children:(0,Y.jsx)(S,{children:p})}),t.round_index!=null&&(0,Y.jsx)(`small`,{children:r?`第 ${t.round_index} 轮`:`Round ${t.round_index}`})]})]})}function Ot({sid:e,view:t,roles:n=[],events:r=[],taskId:i,paused:a=!1,selectedRole:o,onSelectRole:s,onClose:u,showTabs:d=!0}){let{locale:f,t:p}=l(),m=f===`zh-CN`,[g,v]=(0,X.useState)(null),[b,C]=(0,X.useState)(24),[T,E]=(0,X.useState)(!1),[D,j]=(0,X.useState)(``),[M,N]=(0,X.useState)(Date.now),F=o||g||n.find(e=>e.active)?.role||t?.active_role||`manager`,I=it(t,n,F,a,i),L=Le(t,F,i).map(e=>{let t=e.detail;for(let n of r){if(n.kind===`reasoning`)continue;let r=String(n.event_id||n.id||``),i=String(n.message_id||``);if(r!==e.id&&(!i||e.id!==`${e.role}:${i}`))continue;let a=Be(String(n.text||n.reason||n.summary||``));a.length>t.length&&(t=a)}return t===e.detail?e:{...e,detail:t}});(0,X.useEffect)(()=>{C(24),j(``)},[e,F,i]);let R=i?We(void 0,t,i):0,z=R?Le(t,F,i,R):L,B=z[0],V=z.find(e=>e.detail&&[`agent_message`,`assistant_message`,`decision`,`verdict`,`handoff`,`review`,`completion`].includes(e.kind)),H=Qe(r,F,i,R),U=H&&Number(H.ts||0)>=(B?.ts??0),W=!U&&B&&[`agent_message`,`assistant_message`].includes(B.kind)&&B.detail?B.detail.split(/[。\n]/)[0].slice(0,70):Je(U?String(H.kind):B?.kind||`task`,m,U?String(H.tool_name||``):``),te=n.find(e=>e.role===F)?.model||t?.roles.find(e=>e.role===F)?.model,G=B?Math.max(0,Math.floor(M/1e3-B.ts)):0,ne=Math.max(B?.ts??0,U?Number(H?.ts||0):0),re=I&&ne?Ye(M/1e3-ne,m):``;(0,X.useEffect)(()=>{if(!I)return;let e=setInterval(()=>N(Date.now()),1e3);return()=>clearInterval(e)},[I]);let ie=e=>O(e)?h(e,p):e;return(0,Y.jsxs)(`section`,{className:`agent-activity`,style:{"--agent-role-color":k(F)},"aria-label":m?`工作详情`:`Work details`,children:[(0,Y.jsxs)(`header`,{className:`agent-activity-heading`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(A,{size:15}),m?`工作详情`:`Work details`]}),u&&(0,Y.jsx)(`button`,{type:`button`,onClick:u,"aria-label":m?`关闭工作详情`:`Close work details`,children:(0,Y.jsx)(y,{size:17})})]}),d&&(0,Y.jsx)(`div`,{className:`agent-activity-tabs`,role:`group`,"aria-label":m?`筛选 Agent`:`Filter agents`,children:x.map(e=>(0,Y.jsxs)(`button`,{type:`button`,"data-role":e,"aria-pressed":F===e,style:{"--agent-role-color":k(e)},onClick:()=>{v(e),s?.(e)},children:[(0,Y.jsx)(`i`,{"data-active":it(t,n,e,a,i)}),ie(e)]},e))}),(0,Y.jsxs)(`div`,{className:`agent-current`,"data-active":I,children:[(0,Y.jsxs)(`div`,{className:`agent-current-kicker`,children:[(0,Y.jsx)(`span`,{children:I?m?`当前工作`:`Current work`:a?m?`工作已暂停`:`Work paused`:m?`最近进度`:`Latest progress`}),I?(0,Y.jsxs)(`span`,{className:`agent-live-indicator`,"data-stale":re?!0:void 0,children:[(0,Y.jsx)(`i`,{}),m?`处理中`:`In progress`,re&&(0,Y.jsx)(`small`,{className:`agent-live-stale`,children:re})]}):(0,Y.jsx)(P,{size:12})]}),(0,Y.jsx)(`h3`,{children:B||U?W:I?m?`尚无本次工作记录`:`No work recorded for this attempt yet`:m?`等待任务分配`:`Waiting for an assignment`}),V?.detail&&(0,Y.jsx)(`div`,{className:`agent-current-summary`,children:(0,Y.jsx)(S,{children:V.detail})}),!V&&B?.detail&&(0,Y.jsx)(`p`,{className:`agent-current-summary`,children:B.detail}),B&&(0,Y.jsxs)(`div`,{className:`agent-current-meta`,children:[(0,Y.jsx)(ee,{size:12}),(0,Y.jsx)(`span`,{children:m?`${G<60?G+` 秒`:G<3600?Math.floor(G/60)+` 分钟`:G<86400?Math.floor(G/3600)+` 小时`:Math.floor(G/86400)+` 天`}前更新`:`Updated ${G<60?G+`s`:G<3600?Math.floor(G/60)+`m`:G<86400?Math.floor(G/3600)+`h`:Math.floor(G/86400)+`d`} ago`})]}),(0,Y.jsxs)(`details`,{className:`agent-technical-details`,children:[(0,Y.jsx)(`summary`,{children:m?`查看运行信息`:`Runtime details`}),(0,Y.jsxs)(`p`,{children:[ie(F),te?` · ${te}`:``,B?.round_index==null?``:m?` · 第 ${B.round_index} 轮`:` · Round ${B.round_index}`]})]})]}),(0,Y.jsxs)(`div`,{className:`agent-records-heading`,children:[(0,Y.jsx)(`span`,{children:m?`工作记录`:`Work log`}),(0,Y.jsxs)(`span`,{children:[L.length,` `,m?`条`:`records`]})]}),(0,Y.jsxs)(`div`,{className:`agent-records`,role:`log`,"aria-live":`off`,children:[L.slice(0,b).map((t,n)=>{let r=I&&t.id===B?.id,i=[`done`,`completed`].includes(t.status),a=[`failed`,`error`,`rejected`].includes(t.status),o=i?_:[`tool_use`,`command_execution`].includes(t.kind)?w:ht;return(0,Y.jsxs)(`article`,{className:`agent-record`,"data-active":r,"data-failed":a,children:[(0,Y.jsx)(`span`,{className:`agent-record-icon`,children:(0,Y.jsx)(o,{size:13})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`agent-record-title`,children:[(0,Y.jsx)(`strong`,{children:Je(t.kind,m)}),(0,Y.jsx)(`time`,{children:new Date(t.ts*1e3).toLocaleTimeString(m?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})})]}),(0,Y.jsx)(`small`,{children:r?m?`进行中`:`In progress`:a?m?`未完成`:`Did not finish`:i?m?`已完成`:`Completed`:m?`已记录`:`Recorded`}),(t.detail||e)&&(0,Y.jsx)(Dt,{sid:e,record:t,zh:m,expanded:n===0||t.id===V?.id})]})]},t.id)}),!L.length&&(0,Y.jsx)(`p`,{className:`agent-records-empty`,children:m?`${ie(F)}尚未留下这个任务的工作记录。`:`No work has been recorded for this task by ${ie(F)}.`})]}),(0,Y.jsxs)(`div`,{className:`agent-records-footer`,children:[bC(e=>e+24),children:m?`加载更早记录(还剩 ${L.length-b} 条)`:`Load earlier records (${L.length-b} remaining)`}),e&&(0,Y.jsx)(`button`,{type:`button`,disabled:T,onClick:()=>{E(!0),j(``),c.downloadWorkLog(e,F,i).catch(e=>j(e instanceof Error?e.message:String(e))).finally(()=>E(!1))},children:T?m?`正在准备完整记录…`:`Preparing full log…`:m?`下载完整工作记录(含更早历史)`:`Download full work log (including earlier history)`}),D&&(0,Y.jsx)(`small`,{role:`alert`,children:D})]})]})}var kt=p(),Z=(e,t,n)=>e+(t-e)*n,At=e=>e*e*(3-2*e),jt=(e,t,n)=>Math.max(t,Math.min(n,e));function Mt(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y),i=Math.min(140,Math.max(54,r*.22))*(t.x>=e.x?-1:1),a=Math.min(120,r*.3),o={x:jt(e.x+i,28,n-28),y:e.y-a},s={x:jt(t.x+i*.6,28,n-28),y:t.y+a};return n=>{let r=1-n;return{x:r**3*e.x+3*r**2*n*o.x+3*r*n**2*s.x+n**3*t.x,y:r**3*e.y+3*r**2*n*o.y+3*r*n**2*s.y+n**3*t.y}}}function Nt({flight:e,canvas:t,zh:n,historical:r=!1,onReveal:i,onLand:a,onFinish:o}){let s=(0,X.useRef)(null),c=(0,X.useRef)(null),l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=`dispatch-wake-${(0,X.useId)().replace(/:/g,``)}`,f=(0,X.useRef)({onReveal:i,onLand:a,onFinish:o});f.current={onReveal:i,onLand:a,onFinish:o};let p=e.result?.type===`task`&&!r;return(0,X.useEffect)(()=>{if(!e.result)return;let n=0,i,a,o=()=>f.current.onFinish(e.id);if(e.result.type!==`task`||r)return i=setTimeout(o,2200),()=>clearTimeout(i);let d=s.current;if(!d)return;let p=e.result.taskId,m=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,h=t.current,g=()=>{cancelAnimationFrame(n),clearTimeout(i),f.current.onLand(e.id),o()};h?.addEventListener(`pointerdown`,g,{once:!0}),h?.addEventListener(`wheel`,g,{once:!0,passive:!0});let _=performance.now(),v=0,y=!1,b=0,x,S=r=>{if(r-_>6e3){o();return}let s=t.current?.querySelector(`.map-macro[data-task-id="${CSS.escape(p)}"]`);if(!s||s.getBoundingClientRect().width<8){r-v>600&&(f.current.onReveal(p),v=r),n=requestAnimationFrame(S);return}if(m){f.current.onLand(e.id),i=setTimeout(o,1200);return}y||(f.current.onReveal(p),y=!0,v=r);let h=s.getBoundingClientRect();if((!x||Math.abs(x.x-h.x)+Math.abs(x.y-h.y)+Math.abs(x.width-h.width)>.7)&&(b=r),x=h,r-v<360||r-b<100){n=requestAnimationFrame(S);return}let g=t.current?.querySelector(`.map-composer`)?.getBoundingClientRect(),C=g?{x:g.left,y:g.top,width:g.width,height:g.height}:e.origin,w={x:C.x+C.width/2,y:C.y+C.height/2},T={x:w.x,y:w.y-26},E={x:h.left+h.width/2,y:h.top+h.height/2},D=Mt(T,E,innerWidth),O=Math.min(320,C.width),k=Math.min(68,C.height),A=performance.now(),j=!1,M=t=>{if(!s.isConnected){o();return}let r=Math.min(1,(t-A)/1050),p=At(Math.min(1,r/.22)),m=At(jt((r-.22)/.6,0,1)),h=At(jt((r-.82)/.18,0,1)),g=r<.22?{x:w.x,y:Z(w.y,T.y,p)}:D(m),_=Z(52,22,h),v=Z(O,_,p),y=Z(k,_,p);if(d.style.width=`${v}px`,d.style.height=`${y}px`,d.style.transform=`translate3d(${g.x-v/2}px,${g.y-y/2}px,0)`,d.style.opacity=String(Math.min(1,r/.045)*(1-h)),d.style.setProperty(`--dispatch-copy`,String(1-At(Math.min(1,r/.12)))),d.style.setProperty(`--dispatch-mark`,String(Z(1,.7,h))),d.dataset.phase=r<.22?`compress`:r<.82?`travel`:`arrive`,c.current&&l.current&&r>.22){let e=Math.max(0,m-.16),t=Array.from({length:13},(t,n)=>D(Z(e,m,n/12)));c.current.setAttribute(`d`,t.map((e,t)=>`${t?`L`:`M`} ${e.x} ${e.y}`).join(` `)),c.current.style.opacity=String(.7*(1-h)),l.current.setAttribute(`x1`,String(t[0].x)),l.current.setAttribute(`y1`,String(t[0].y)),l.current.setAttribute(`x2`,String(g.x)),l.current.setAttribute(`y2`,String(g.y))}r>=.82&&!j&&(j=!0,f.current.onLand(e.id),u.current&&(u.current.style.left=`${E.x}px`,u.current.style.top=`${E.y}px`,a=u.current.animate([{transform:`translate(-50%,-50%) scale(.65)`,opacity:.65},{transform:`translate(-50%,-50%) scale(2.8)`,opacity:0}],{duration:650,easing:`cubic-bezier(.16,1,.3,1)`,fill:`both`}))),r<1?n=requestAnimationFrame(M):i=setTimeout(o,550)};n=requestAnimationFrame(M)};return n=requestAnimationFrame(S),()=>{cancelAnimationFrame(n),clearTimeout(i),a?.cancel(),h?.removeEventListener(`pointerdown`,g),h?.removeEventListener(`wheel`,g)}},[e.id,e.result,t,r]),p?(0,kt.createPortal)((0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`svg`,{className:`map-dispatch-trail`,"aria-hidden":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{ref:l,id:d,gradientUnits:`userSpaceOnUse`,children:[(0,Y.jsx)(`stop`,{stopColor:`#6fbcce`,stopOpacity:`0`}),(0,Y.jsx)(`stop`,{offset:`1`,stopColor:`#87d9cf`})]})}),(0,Y.jsx)(`path`,{ref:c,fill:`none`,stroke:`url(#${d})`,strokeWidth:`2.5`,strokeLinecap:`round`})]}),(0,Y.jsxs)(`div`,{ref:s,className:`map-dispatch-flight`,"data-testid":`map-dispatch-flight`,"data-state":`task`,"data-task-id":e.result?.type===`task`?e.result.taskId:void 0,"aria-hidden":`true`,children:[(0,Y.jsx)(`div`,{className:`map-dispatch-symbol`,children:(0,Y.jsx)(V,{size:25})}),(0,Y.jsxs)(`div`,{className:`map-dispatch-copy`,children:[(0,Y.jsx)(`strong`,{children:e.text}),(0,Y.jsx)(`span`,{children:n?`进入任务地图`:`Into your task map`})]})]}),(0,Y.jsx)(`div`,{ref:u,className:`map-dispatch-halo`,"aria-hidden":`true`})]}),document.body):null}var Pt=()=>({revision:0,cards:{},steps:{},links:{}}),Ft=(e,t)=>`${e}\u0000${t}`,It=class{initialized=!1;seen=new Set;revision=0;loadingHistory=!1;observe(e,t=!1){let n=Pt(),r=0;for(let t of e.cards){this.seen.has(`card:${t.id}`)||(n.cards[t.id]=Math.min(r++*100,400)),this.seen.add(`card:${t.id}`);let i=e.layouts[t.id],a=0;for(let e of i.steps){let r=Ft(t.id,e.id);this.seen.has(`step:${r}`)||(n.steps[r]=160+Math.min(a++*120,720)),this.seen.add(`step:${r}`)}for(let e of i.links){let r=Ft(t.id,e.id);this.seen.has(`link:${r}`)||(n.links[r]=Math.max(0,(n.steps[Ft(t.id,e.target)]??160)-160)),this.seen.add(`link:${r}`)}}for(let t of e.links)this.seen.has(`outer:${t.id}`)||(n.links[t.id]=0),this.seen.add(`outer:${t.id}`);let i=!this.initialized||t||this.loadingHistory;return this.loadingHistory=t,this.initialized=!0,i||![n.cards,n.steps,n.links].some(e=>Object.keys(e).length)?null:{...n,revision:++this.revision}}};function Lt(e,t=!1){let n=(0,X.useRef)(new It),r=(0,X.useRef)(new Set),[i,a]=(0,X.useState)(Pt);return(0,X.useEffect)(()=>{let i=n.current.observe(e,t);if(t)r.current.forEach(clearTimeout),r.current.clear(),a(Pt());else if(i){a(e=>({revision:i.revision,cards:{...e.cards,...i.cards},steps:{...e.steps,...i.steps},links:{...e.links,...i.links}}));let e=setTimeout(()=>{r.current.delete(e),a(e=>({revision:e.revision,cards:Object.fromEntries(Object.entries(e.cards).filter(([e])=>!(e in i.cards))),steps:Object.fromEntries(Object.entries(e.steps).filter(([e])=>!(e in i.steps))),links:Object.fromEntries(Object.entries(e.links).filter(([e])=>!(e in i.links)))}))},2e3);r.current.add(e)}},[e,t]),(0,X.useEffect)(()=>()=>{r.current.forEach(clearTimeout),r.current.clear()},[]),i}var Rt=e=>1-(1-e)**3;function zt(e,t,n){let r=Rt(Math.min(1,Math.max(0,n))),i={};for(let n in t){let a=e[n],o=t[n];i[n]=!a||r>=1?o:{x:a.x+(o.x-a.x)*r,y:a.y+(o.y-a.y)*r}}return i}function Bt(e,t){for(let n in t){let r=e[n];if(r&&(r.x!==t[n].x||r.y!==t[n].y))return!0}return!1}function Vt(e,t,n=680){let[r,i]=(0,X.useState)(e),a=(0,X.useRef)(e),o=(0,X.useRef)(e);return(0,X.useEffect)(()=>{if(e===o.current)return;o.current=e;let r=a.current;if(t||!Bt(r,e)||typeof requestAnimationFrame!=`function`){a.current=e,i(e);return}let s=null,c=performance.now(),l=t=>{let o=(t-c)/n;if(o>=1){a.current=e,i(e),s=null;return}a.current=zt(r,e,o),i(a.current),s=requestAnimationFrame(l)};return s=requestAnimationFrame(l),()=>{s!=null&&cancelAnimationFrame(s)}},[e,t,n]),r}var Ht={edges:new Set,nodes:new Set};function Ut(e,t){if(!t)return Ht;let n=new Set,r=new Set([t]);for(let i of e)(i.source===t||i.target===t)&&(n.add(i.id),r.add(i.source),r.add(i.target));return{edges:n,nodes:r}}var Wt=2600,Gt=e=>Math.min(Math.max(e-1,0),10)*80,Kt=e=>Gt(e)+320;function qt(e,t){let n=Math.max(0,Math.floor(e));if(n<60)return t?`${n} 秒`:`${n}s`;let r=Math.floor(n/60);if(r<60)return t?`${r} 分钟`:`${r} min`;let i=Math.floor(r/60),a=r%60;return t?`${i} 小时 ${a} 分`:`${i} h ${String(a).padStart(2,`0`)} min`}function Jt(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n{}};function Xt(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Zt.prototype=Xt.prototype={constructor:Zt,on:function(e,t){var n=this._,r=Qt(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),tn.hasOwnProperty(t)?{space:tn[t],local:e}:e}function rn(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function an(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function on(e){var t=nn(e);return(t.local?an:rn)(t)}function sn(){}function cn(e){return e==null?sn:function(){return this.querySelector(e)}}function ln(e){typeof e!=`function`&&(e=cn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i=v&&(v=_+1);!(b=g[v])&&++v=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function zn(e){e||=Bn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;at?1:e>=t?0:NaN}function Vn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Hn(){return Array.from(this)}function Un(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?tr:typeof t==`function`?rr:nr)(e,t,n??``)):ar(this.node(),e)}function ar(e,t){return e.style.getPropertyValue(t)||er(e).getComputedStyle(e,null).getPropertyValue(t)}function or(e){return function(){delete this[e]}}function sr(e,t){return function(){this[e]=t}}function cr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function lr(e,t){return arguments.length>1?this.each((t==null?or:typeof t==`function`?cr:sr)(e,t)):this.node()[e]}function ur(e){return e.trim().split(/^|\s+/)}function dr(e){return e.classList||new fr(e)}function fr(e){this._node=e,this._names=ur(e.getAttribute(`class`)||``)}fr.prototype={add:function(e){this._names.indexOf(e)<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 pr(e,t){for(var n=dr(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Hr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n()=>e;function ui(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){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:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}ui.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function di(e){return!e.ctrlKey&&!e.button}function fi(){return this.parentNode}function pi(e,t){return t??{x:e.x,y:e.y}}function mi(){return navigator.maxTouchPoints||`ontouchstart`in this}function hi(){var e=di,t=fi,n=pi,r=mi,i={},a=Xt(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,ri).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(ei(n.view).on(`mousemove.drag`,m,ii).on(`mouseup.drag`,h,ii),si(n.view),ai(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(oi(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){ei(e.view).on(`mousemove.drag mouseup.drag`,null),ci(e.view,l),oi(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ri(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ri(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=Ti.exec(e))?new Vi(t[1],t[2],t[3],1):(t=Ei.exec(e))?new Vi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Di.exec(e))?Ri(t[1],t[2],t[3],t[4]):(t=Oi.exec(e))?Ri(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ki.exec(e))?Ji(t[1],t[2]/100,t[3]/100,1):(t=Ai.exec(e))?Ji(t[1],t[2]/100,t[3]/100,t[4]):ji.hasOwnProperty(e)?Li(ji[e]):e===`transparent`?new Vi(NaN,NaN,NaN,0):null}function Li(e){return new Vi(e>>16&255,e>>8&255,e&255,1)}function Ri(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vi(e,t,n,r)}function zi(e){return e instanceof vi||(e=Ii(e)),e?(e=e.rgb(),new Vi(e.r,e.g,e.b,e.opacity)):new Vi}function Bi(e,t,n,r){return arguments.length===1?zi(e):new Vi(e,t,n,r??1)}function Vi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}gi(Vi,Bi,_i(vi,{brighter(e){return e=e==null?bi:bi**+e,new Vi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yi:yi**+e,new Vi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vi(Ki(this.r),Ki(this.g),Ki(this.b),Gi(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:Hi,formatHex:Hi,formatHex8:Ui,formatRgb:Wi,toString:Wi}));function Hi(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}`}function Ui(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}${qi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Wi(){let e=Gi(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Ki(this.r)}, ${Ki(this.g)}, ${Ki(this.b)}${e===1?`)`:`, ${e})`}`}function Gi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ki(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function qi(e){return e=Ki(e),(e<16?`0`:``)+e.toString(16)}function Ji(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Zi(e,t,n,r)}function Yi(e){if(e instanceof Zi)return new Zi(e.h,e.s,e.l,e.opacity);if(e instanceof vi||(e=Ii(e)),!e)return new Zi;if(e instanceof Zi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Zi(o,s,c,e.opacity)}function Xi(e,t,n,r){return arguments.length===1?Yi(e):new Zi(e,t,n,r??1)}function Zi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}gi(Zi,Xi,_i(vi,{brighter(e){return e=e==null?bi:bi**+e,new Zi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yi:yi**+e,new Zi(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,i=2*n-r;return new Vi(ea(e>=240?e-240:e+120,i,r),ea(e,i,r),ea(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Zi(Qi(this.h),$i(this.s),$i(this.l),Gi(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(){let e=Gi(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Qi(this.h)}, ${$i(this.s)*100}%, ${$i(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Qi(e){return e=(e||0)%360,e<0?e+360:e}function $i(e){return Math.max(0,Math.min(1,e||0))}function ea(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ta=e=>()=>e;function na(e,t){return function(n){return e+n*t}}function ra(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ia(e){return(e=+e)==1?aa:function(t,n){return n-t?ra(t,n,e):ta(isNaN(t)?n:t)}}function aa(e,t){var n=t-e;return n?na(e,n):ta(isNaN(e)?t:e)}var oa=(function e(t){var n=ia(t);function r(e,t){var r=n((e=Bi(e)).r,(t=Bi(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=aa(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function sa(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:da(r,i)})),n=ma.lastIndex;return n180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:da(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:da(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:da(e,n)},{i:s-2,x:da(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t=0&&e._call.call(void 0,t),e=e._next;--Na}function Ya(){Ba=(za=Ha.now())+Va,Na=Pa=0;try{Ja()}finally{Na=0,Za(),Ba=0}}function Xa(){var e=Ha.now(),t=e-za;t>Ia&&(Va-=t,za=e)}function Za(){for(var e,t=La,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:La=n);Ra=e,Qa(r)}function Qa(e){Na||(Pa&&=clearTimeout(Pa),e-Ba>24?(e<1/0&&(Pa=setTimeout(Ya,e-Ha.now()-Va)),Fa&&=clearInterval(Fa)):(Fa||=(za=Ha.now(),setInterval(Xa,Ia)),Na=1,Ua(Ya)))}function $a(e,t,n){var r=new Ka;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var eo=Xt(`start`,`end`,`cancel`,`interrupt`),to=[];function no(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;oo(e,n,{name:t,index:r,group:i,on:eo,tween:to,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function ro(e,t){var n=ao(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function io(e,t){var n=ao(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function ao(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function oo(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=qa(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return $a(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function co(e){return this.each(function(){so(this,e)})}function lo(e,t){var n,r;return function(){var i=io(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o=0&&(e=e.slice(0,t)),!e||e===`start`})}function Bo(e,t,n){var r,i,a=zo(t)?ro:io;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Vo(e,t){var n=this._id;return arguments.length<2?ao(this.node(),n).on.on(e):this.each(Bo(n,e,t))}function Ho(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Uo(){return this.on(`end.remove`,Ho(this._id))}function Wo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=cn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o()=>e;function bs(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function xs(e,t,n){this.k=e,this.x=t,this.y=n}xs.prototype={constructor:xs,scale:function(e){return e===1?this:new xs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new xs(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 Ss=new xs(1,0,0);Cs.prototype=xs.prototype;function Cs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ss;return e.__zoom}function ws(e){e.stopImmediatePropagation()}function Ts(e){e.preventDefault(),e.stopImmediatePropagation()}function Es(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Ds(){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 Os(){return this.__zoom||Ss}function ks(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function As(){return navigator.maxTouchPoints||`ontouchstart`in this}function js(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Ms(){var e=Es,t=Ds,n=js,r=ks,i=As,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Ma,l=Xt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Os).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Os),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Ss.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new xs(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new xs(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new xs(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=ei(this.that).datum();l.call(e,this.that,new bs(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=ni(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],so(this),s.start();Ts(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=ei(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=ni(t,i),l=t.clientX,u=t.clientY;si(t.view),ws(t),a.mouse=[c,this.__zoom.invert(c)],so(this),a.start();function d(e){if(Ts(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=ni(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),ci(e.view,a.moved),Ts(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=ni(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Ts(r),s>0?ei(this).transition().duration(s).call(x,d,c,r):ei(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(ws(t),s=0;s`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} 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.`},Ps=[[-1/0,-1/0],[1/0,1/0]],Fs=[`Enter`,` `,`Escape`],Is={"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`},Ls;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Ls||={});var Rs;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Rs||={});var zs;(function(e){e.Partial=`partial`,e.Full=`full`})(zs||={});var Bs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Vs;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(Vs||={});var Hs;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Hs||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var Us={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function Ws(e){return e===null?null:e?`valid`:`invalid`}var Gs=e=>`id`in e&&`source`in e&&`target`in e,Ks=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),qs=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Js=(e,t=[0,0])=>{let{width:n,height:r}=Oc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ys=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:uc(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):qs(n)?n:t.nodeLookup.get(n.id)),cc(e,i?fc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Xs=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=cc(n,fc(e)),r=!0)}),r?uc(n):{x:0,y:0,width:0,height:0}},Zs=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=mc(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Qs=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function $s(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function ec({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Tc(Xs($s(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function tc({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,Ns.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&Dc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Dc(d)?ic(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Ns.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function nc({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Qs(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var rc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ic=(e={x:0,y:0},t,n)=>({x:rc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:rc(e.y,t[0][1],t[1][1]-(n?.height??0))});function ac(e,t,n){let{width:r,height:i}=Oc(n),{x:a,y:o}=n.internals.positionAbsolute;return ic(e,[[a,o],[a+r,o+i]],t)}var oc=(e,t,n)=>en?-rc(Math.abs(e-n),1,t)/t:0,sc=(e,t,n=15,r=40)=>[oc(e.x,r,t.width-r)*n,oc(e.y,r,t.height-r)*n],cc=(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)}),lc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),uc=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),dc=(e,t=[0,0])=>{let{x:n,y:r}=qs(e)?e.internals.positionAbsolute:Js(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},fc=(e,t=[0,0])=>{let{x:n,y:r}=qs(e)?e.internals.positionAbsolute:Js(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},pc=(e,t)=>uc(cc(lc(e),lc(t))),mc=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},hc=(e,t)=>mc(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),gc=e=>_c(e.width)&&_c(e.height)&&_c(e.x)&&_c(e.y),_c=e=>!isNaN(e)&&isFinite(e),vc=(e,t)=>(e,t)=>{},yc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),bc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?yc(s,o):s},xc=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Sc(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let 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 Cc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=Sc(e,n),i=Sc(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=Sc(e.top??e.y??0,n),i=Sc(e.bottom??e.y??0,n),a=Sc(e.left??e.x??0,t),o=Sc(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function wc(e,t,n,r,i,a){let{x:o,y:s}=xc(e,[t,n,r]),{x:c,y:l}=xc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Tc=(e,t,n,r,i,a)=>{let o=Cc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=rc(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=wc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Ec=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Dc(e){return e!=null&&e!==`parent`}function Oc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function kc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ac(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function jc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Mc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Nc(e){return{...Is,...e||{}}}function Pc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Bc(e),s=bc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?yc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Fc=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ic=e=>e?.getRootNode?.()||window?.document,Lc=[`INPUT`,`SELECT`,`TEXTAREA`];function Rc(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Lc.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var zc=e=>`clientX`in e,Bc=(e,t)=>{let n=zc(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Vc=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Fc(t)}})};function Hc({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Uc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wc({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Uc(t-r,a),n];case Q.Right:return[t+Uc(r-t,a),n];case Q.Top:return[t,n-Uc(n-i,a)];case Q.Bottom:return[t,n+Uc(i-n,a)]}}function Gc({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Wc({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Wc({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Hc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Kc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n0}var Yc=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Xc=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Zc=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Ns.error006()),t;let r=n.getEdgeId||Yc,i;return i=Gs(e)?{...e}:{...e,id:r(e)},Xc(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Qc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Kc({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var $c={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},el=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.xMath.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function nl({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=$c[t],c=$c[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=el({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Kc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function rl(e,t,n,r){let i=Math.min(tl(e,t)/2,tl(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.xe.id===t):e[0])||null}function ul(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function dl(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=ul(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var fl=1e3,pl=10,ml={nodeOrigin:[0,0],nodeExtent:Ps,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},hl={...ml,checkEquality:!0};function gl(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function _l(e,t,n){let r=gl(ml,n);for(let n of e.values())if(n.parentId)Sl(n,e,t,r);else{let e=ic(Js(n,r.nodeOrigin),Dc(n.extent)?n.extent:r.nodeExtent,Oc(n));n.internals.positionAbsolute=e}}function vl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function yl(e){return e===`manual`}function bl(e,t,n,r={}){let i=gl(hl,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!yl(i.zIndexMode)?fl:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=ic(Js(u,i.nodeOrigin),Dc(u.extent)?u.extent:i.nodeExtent,Oc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:vl(u,e),z:Cl(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&Sl(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function xl(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Sl(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=gl(ml,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xl(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*pl),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=wl(e,u,o,s,a&&!yl(c)?fl:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function Cl(e,t,n){let r=_c(e.zIndex)?e.zIndex:0;return yl(n)?r:r+(e.selected?t:0)}function wl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Oc(e),l=Js(e,n),u=Dc(e.extent)?ic(l,e.extent,c):l,d=ic({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=ac(d,c,t));let f=Cl(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Tl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=pc(a.get(n.parentId)?.expandedRect??dc(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Oc(a),l=a.origin??r,u=t.x0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width0){let e=Tl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Dl({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Ol(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function kl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Ol(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Ol(`target`,s,c,e,i,o),t.set(r.id,r)}}function Al(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Al(n,t):!1}function jl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Ml(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Al(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Nl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Pl({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=yc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Fl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=ei(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?lc(Xs(s)):null,x=v&&l?Pl({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:yc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=tc({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Nl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=sc(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=Pc(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Ml(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Nl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=hi().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Pc(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Bc(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Pc(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Bc(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Bc(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Nl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!jl(t,`.${g}`,v))&&(!_||jl(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Il(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())hc(i,dc(e))>0&&r.push(e);return r}var Ll=250;function Rl(e,t,n,r){let i=[],a=1/0,o=Il(e,n,t+Ll);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=cl(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function zl(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...cl(o,c,c.position,!0)}:c}function Bl(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Vl(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Hl=()=>!0;function Ul(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Hl,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Ic(e.target),E=0,D,{x:O,y:k}=Bc(e),A=Bl(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=zl(i,A,r,c,t);if(!N)return;let P=Bc(e,j),F=!1,ee=null,I=!1,L=null;function R(){if(!u||!j)return;let[e,t]=sc(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(R)}let z={...N,nodeId:i,type:A,position:N.position},B=c.get(i),V={inProgress:!0,isValid:null,from:cl(B,z,Q.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:B,to:P,toHandle:null,toPosition:Us[z.position],toNode:null,pointer:P};function H(){M=!0,y(V),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&H();function U(e){if(!M){let{x:t,y:n}=Bc(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;H()}if(!x()||!z){W(e);return}let a=b();P=Bc(e,j),D=Rl(bc(P,a,!1,[1,1]),n,c,z),F||=(R(),!0);let s=Wl(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,ee=s.connection,I=Vl(!!D,s.isValid);let u=c.get(i),f=u?cl(u,z,Q.Left,!0):V.from,p={...V,from:f,isValid:I,to:s.toHandle&&I?xc({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:Us[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),V=p}function W(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&ee&&I&&h?.(ee);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,I=!1,ee=null,L=null,T.removeEventListener(`mousemove`,U),T.removeEventListener(`mouseup`,W),T.removeEventListener(`touchmove`,U),T.removeEventListener(`touchend`,W)}}T.addEventListener(`mousemove`,U),T.addEventListener(`mouseup`,W),T.addEventListener(`touchmove`,U),T.addEventListener(`touchend`,W)}function Wl(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Hl,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Bc(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=Bl(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===Ls.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=zl(t,e,a,u,n,!0)}return _}var Gl={onPointerDown:Ul,isValid:Wl};function Kl({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=ei(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Ec()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=Ms().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:ni}}var ql=e=>({x:e.x,y:e.y,zoom:e.k}),Jl=({x:e,y:t,zoom:n})=>Ss.translate(e,t).scale(n),Yl=(e,t)=>e.target.closest(`.${t}`),Xl=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zl=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ql=(e,t=0,n=Zl,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},$l=e=>{let t=e.ctrlKey&&Ec()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function eu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Yl(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=ni(u),t=d*2**$l(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Rs.Vertical?0:u.deltaX*f,m=i===Rs.Horizontal?0:u.deltaY*f;!Ec()&&u.shiftKey&&i!==Rs.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=ql(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function tu({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=Yl(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function nu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=ql(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function ru({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Xl(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,ql(a.transform))}}function iu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Xl(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=ql(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function au({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(Yl(d,`${l}-flow__node`)||Yl(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||Yl(d,s)&&m||Yl(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function ou({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Ms().scaleExtent([t,n]).translateExtent(r),f=ei(e).call(d);v({x:i.x,y:i.y,zoom:rc(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta($l);async function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?va:Ma).transform(Ql(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!_c(E)||E<0?0:E);let k=O?eu({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):tu({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});f.on(`wheel.zoom`,k,{passive:!1});let A=nu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,A);let j=ru({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,j);let M=iu({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,M);let N=au({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(N),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=Jl(e),i=d?.constrain()(r,t,n);return i&&await h(i),i}async function y(e,t){let n=Jl(e);return await h(n,t),n}function b(e){if(f){let t=Jl(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?Cs(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?va:Ma).scaleTo(Ql(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?va:Ma).scaleBy(Ql(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!_c(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var su;(function(e){e.Line=`line`,e.Handle=`handle`})(su||={});function cu({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function lu(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function uu(e,t){return Math.max(0,t-e)}function du(e,t){return Math.max(0,e-t)}function fu(e,t,n){return Math.max(0,t-e,e-n)}function pu(e,t){return e?!t:t}function mu(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=fu(E,h,g),j=fu(D,_,v);if(o){let e=0,t=0;c&&w<0?e=uu(y+w+O,o[0][0]):!c&&w>0&&(e=du(y+E+O,o[1][0])),l&&T<0?t=uu(b+T+k,o[0][1]):!l&&T>0&&(t=du(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=du(y+w,s[0][0]):!c&&w<0&&(e=uu(y+E,s[1][0])),l&&T>0?t=du(b+T,s[0][1]):!l&&T<0&&(t=uu(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=fu(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?du(b+k+E/C,o[1][1])*C:uu(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?uu(b+E/C,s[1][1])*C:du(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=fu(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?du(y+D*C+O,o[1][0])/C:uu(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?uu(y+D*C,s[1][0])/C:du(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(pu(c,l)?-w:w)/C:w=(pu(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var hu={width:0,height:0,x:0,y:0},gu={...hu,pointerX:0,pointerY:0,aspectRatio:1};function _u(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function vu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=ei(e),o={controlDirection:lu(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...hu},h={...gu};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:lu(e)};let g,_=null,v=[],y,b,x,S=!1,C=hi().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=Pc(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Dc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=_u(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=Pc(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=mu(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var yu=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),bu=t(((e,t)=>{t.exports=yu()})),xu=t((e=>{var t=r(),n=bu();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Su=e(t(((e,t)=>{t.exports=xu()}))(),1),Cu=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},wu=e=>e?Cu(e):Cu,{useDebugValue:Tu}=X.default,{useSyncExternalStoreWithSelector:Eu}=Su.default,Du=e=>e;function Ou(e,t=Du,n){let r=Eu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Tu(r),r}var ku=(e,t)=>{let n=wu(e),r=(e,r=t)=>Ou(n,e,r);return Object.assign(r,n),r},Au=(e,t)=>e?ku(e,t):ku;function ju(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Mu=(0,X.createContext)(null),Nu=Mu.Provider,Pu=Ns.error001(`react`);function $(e,t){let n=(0,X.useContext)(Mu);if(n===null)throw Error(Pu);return Ou(n,e,t)}function Fu(){let e=(0,X.useContext)(Mu);if(e===null)throw Error(Pu);return(0,X.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Iu={display:`none`},Lu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Ru=`react-flow__node-desc`,zu=`react-flow__edge-desc`,Bu=`react-flow__aria-live`,Vu=e=>e.ariaLiveMessage,Hu=e=>e.ariaLabelConfig;function Uu({rfId:e}){let t=$(Vu);return(0,Y.jsx)(`div`,{id:`${Bu}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Lu,children:t})}function Wu({rfId:e,disableKeyboardA11y:t}){let n=$(Hu);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{id:`${Ru}-${e}`,style:Iu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Y.jsx)(`div`,{id:`${zu}-${e}`,style:Iu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Y.jsx)(Uu,{rfId:e})]})}var Gu=(0,X.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,Y.jsx)(`div`,{className:Jt([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Gu.displayName=`Panel`;var Ku=`https://reactflow.dev?utm_source=attribution`;function qu({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Y.jsx)(Gu,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ku}`,children:(0,Y.jsx)(`a`,{href:Ku,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var Ju=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Yu=e=>e.id;function Xu(e,t){return ju(e.selectedNodes.map(Yu),t.selectedNodes.map(Yu))&&ju(e.selectedEdges.map(Yu),t.selectedEdges.map(Yu))}function Zu({onSelectionChange:e}){let t=Fu(),{selectedNodes:n,selectedEdges:r}=$(Ju,Xu);return(0,X.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Qu=e=>!!e.onSelectionChangeHandlers;function $u({onSelectionChange:e}){let t=$(Qu);return e||t?(0,Y.jsx)(Zu,{onSelectionChange:e}):null}var ed=[0,0],td={x:0,y:0,zoom:1},nd=[...`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`.split(`.`),`rfId`],rd=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}),id={translateExtent:Ps,nodeOrigin:ed,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function ad(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(rd,ju),l=Fu();(0,X.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=id,s()}),[]);let u=(0,X.useRef)(id);return(0,X.useEffect)(()=>{for(let s of nd){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Nc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},nd.map(t=>e[t])),null}function od(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function sd(e){let[t,n]=(0,X.useState)(e===`system`?null:e);return(0,X.useEffect)(()=>{if(e!==`system`){n(e);return}let t=od(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?od()?.matches?`dark`:`light`:t}var cd=typeof document<`u`?document:null;function ld(e=null,t={target:cd,actInsideInputWithModifier:!0}){let[n,r]=(0,X.useState)(!1),i=(0,X.useRef)(!1),a=(0,X.useRef)(new Set([])),[o,s]=(0,X.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,` +`).replace(` + +`,` ++`).split(` +`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,X.useEffect)(()=>{let n=t?.target??cd,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&Rc(e))return!1;let n=dd(e.code,s);if(a.current.add(e[n]),ud(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=dd(e.code,s);ud(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function ud(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function dd(e,t){return t.includes(e)?`code`:`key`}var fd=()=>{let e=Fu();return(0,X.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=Tc(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return bc(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=xc(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function pd(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)md(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function md(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(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)}}function hd(e,t){return pd(e,t)}function gd(e,t){return pd(e,t)}function _d(e,t){return{id:e,type:`select`,selected:t}}function vd(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(_d(a.id,e)))}return r}function yd({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function bd(e){return{id:e.id,type:`remove`}}var xd=vc(`React Flow`,`https://reactflow.dev/`);function Sd(e,t,n={}){return Zc(e,t,{...n,onError:n.onError??xd})}var Cd=e=>Ks(e),wd=e=>Gs(e);function Td(e){return(0,X.forwardRef)(e)}var Ed=typeof window<`u`?X.useLayoutEffect:X.useEffect;function Dd(e){let[t,n]=(0,X.useState)(BigInt(0)),[r]=(0,X.useState)(()=>Od(()=>n(e=>e+BigInt(1))));return Ed(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Od(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var kd=(0,X.createContext)(null);function Ad({children:e}){let t=Fu(),n=Dd((0,X.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=yd({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Dd((0,X.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(yd({items:s,lookup:o}))},[])),i=(0,X.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,Y.jsx)(kd.Provider,{value:i,children:e})}function jd(){let e=(0,X.useContext)(kd);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Md=e=>!!e.panZoom;function Nd(){let e=fd(),t=Fu(),n=jd(),r=$(Md),i=(0,X.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=Cd(e)?e:n.get(e.id),a=i.parentId?Ac(i.position,i.measured,i.parentId,n,r):i.position;return dc({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Cd(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&wd(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await nc({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(bd);o?.(f),c(e)}if(m){let e=d.map(bd);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=gc(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=dc(s?r:a),l=hc(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=gc(e)?e:a(e);if(!r)return!1;let i=hc(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Ys(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??Mc();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,X.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Pd=e=>e.selected,Fd=typeof window<`u`?window:void 0;function Id({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=Fu(),{deleteElements:r}=Nd(),i=ld(e,{actInsideInputWithModifier:!1}),a=ld(t,{target:Fd});(0,X.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Pd),edges:e.filter(Pd)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,X.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Ld(e){let t=Fu();(0,X.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Fc(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,Ns.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var Rd={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},zd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Bd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=Rs.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=Fu(),S=(0,X.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=$(zd,ju),E=ld(f),D=(0,X.useRef)();Ld(S);let O=(0,X.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,X.useEffect)(()=>{if(S.current){D.current=ou({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,X.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,Y.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:Rd,children:m})}var Vd=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Hd(){let{userSelectionActive:e,userSelectionRect:t}=$(Vd,ju);return e&&t?(0,Y.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}var Ud=(e,t)=>n=>{n.target===t.current&&e?.(n)},Wd=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Gd({isSelecting:e,selectionKeyPressed:t,selectionMode:n=zs.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,X.useRef)(0),_=Fu(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(Wd,ju),C=y&&(e||v),w=(0,X.useRef)(null),T=(0,X.useRef)(),E=(0,X.useRef)(new Set),D=(0,X.useRef)(new Set),O=(0,X.useRef)(!1),k=(0,X.useRef)(!1),A=(0,X.useRef)({x:0,y:0}),j=(0,X.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},ee=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=Bc(n.nativeEvent,T.current),l=bc({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function I(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=xc(d,i),m={startX:d.x,startY:d.y,x:ee.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}jc(h,E.current)||c(vd(a,E.current,!0)),jc(g,D.current)||l(vd(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function L(){if(!i||!T.current)return;let[e,t]=sc(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(L);return}let{x:t,y:n}=A.current;I(t,n),g.current=requestAnimationFrame(L)})}let R=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,X.useEffect)(()=>()=>R(),[]);let z=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Bc(e.nativeEvent,T.current);A.current={x:o,y:c};let l=xc({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(L(),!0),I(o,c)},B=e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),R())},V=e=>{e.target?.releasePointerCapture?.(e.pointerId),R()},H=r===!0||Array.isArray(r)&&r.includes(0);return(0,Y.jsxs)(`div`,{className:Jt([`react-flow__pane`,{draggable:H,dragging:b,selection:e}]),onClick:C?void 0:Ud(M,w),onContextMenu:Ud(N,w),onWheel:Ud(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?z:p,onPointerUp:B,onPointerCancel:C?V:void 0,onPointerDownCapture:C?ee:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:Rd,children:[h,(0,Y.jsx)(Hd,{})]})}function Kd({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,Ns.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function qd({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=Fu(),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)();return(0,X.useEffect)(()=>{u.current=Fl({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Kd({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,X.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var Jd=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Yd(){let e=Fu();return(0,X.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Jd(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=yc(t,i));let{position:a,positionAbsolute:s}=tc({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Xd=(0,X.createContext)(null),Zd=Xd.Provider;Xd.Consumer;var Qd=()=>(0,X.useContext)(Xd),$d=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ef=(0,X.createContext)(null);function tf({children:e}){let t=$($d,ju);return(0,Y.jsx)(ef.Provider,{value:t,children:e})}function nf(){let e=(0,X.useContext)(ef);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var rf={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},af=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return rf;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===Ls.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function of({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=Fu(),_=Qd(),{connectOnClick:v,noPanClassName:y,rfId:b}=nf(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(af(_,m,e),ju);_||g.getState().onError?.(`010`,Ns.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(Sd(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=zc(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Gl.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,Y.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Jt([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=Ic(t.target),h=n||c,{connection:v,isValid:y}=Gl.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var sf=(0,X.memo)(Td(of));function cf({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[e?.label,(0,Y.jsx)(sf,{type:`source`,position:n,isConnectable:t})]})}function lf({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(sf,{type:`target`,position:n,isConnectable:t}),e?.label,(0,Y.jsx)(sf,{type:`source`,position:r,isConnectable:t})]})}function uf(){return null}function df({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(sf,{type:`target`,position:n,isConnectable:t}),e?.label]})}var ff={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},pf={input:cf,default:lf,output:df,group:uf};function mf(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var hf=e=>{let{width:t,height:n,x:r,y:i}=Xs(e.nodeLookup,{filter:e=>!!e.selected});return{width:_c(t)?t:null,height:_c(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function gf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=Fu(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(hf,ju),c=Yd(),l=(0,X.useRef)(null);(0,X.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(qd({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,Y.jsx)(`div`,{className:Jt([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,Y.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(ff,e.key)&&(e.preventDefault(),c({direction:ff[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var _f=typeof window<`u`?window:void 0,vf=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function yf({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:ee}){let{nodesSelectionActive:I,userSelectionActive:L}=$(vf,ju),R=ld(l,{target:_f}),z=ld(h,{target:_f}),B=z||w,V=z||b,H=u&&B!==!0,U=R||L||H;return Id({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,Y.jsx)(Bd,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:V,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!R&&B,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:ee,paneClickDistance:s,selectionOnDrag:H,children:(0,Y.jsxs)(Gd,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:B,autoPanOnSelection:T,isSelecting:!!U,selectionMode:d,selectionKeyPressed:R,paneClickDistance:s,selectionOnDrag:H,children:[e,I&&(0,Y.jsx)(gf,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}yf.displayName=`FlowRenderer`;var bf=(0,X.memo)(yf),xf=e=>t=>e?Zs(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function Sf(e){return $((0,X.useCallback)(xf(e),[e]),ju)}var Cf=e=>e.updateNodeInternals;function wf(){let e=$(Cf),[t]=(0,X.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,X.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Tf({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=Fu(),a=(0,X.useRef)(null),o=(0,X.useRef)(null),s=(0,X.useRef)(e.sourcePosition),c=(0,X.useRef)(e.targetPosition),l=(0,X.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,X.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,X.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,X.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Ef({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},ju),S=y.type||`default`,C=g?.[S]||pf[S];C===void 0&&(v?.(`003`,Ns.error003(S)),S=`default`,C=g?.default||pf.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=Fu(),k=kc(y),A=Tf({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=qd({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=Yd();if(y.hidden)return null;let N=Oc(y),P=mf(y),F=T||w||t||n||r||i,ee=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,R=a?e=>a(e,{...b.userNode}):void 0,z=o?e=>o(e,{...b.userNode}):void 0,B=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&Kd({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},V=t=>{if(!(Rc(t.nativeEvent)||m)){if(Fs.includes(t.key)&&T){let n=t.key===`Escape`;Kd({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(ff,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:ff[t.key],factor:t.shiftKey?4:1})}}},H=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Zs(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,Y.jsx)(`div`,{className:Jt([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:ee,onMouseMove:I,onMouseLeave:L,onContextMenu:R,onClick:B,onDoubleClick:z,onKeyDown:D?V:void 0,tabIndex:D?0:void 0,onFocus:D?H:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${Ru}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,Y.jsx)(Zd,{value:e,children:(0,Y.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var Df=(0,X.memo)(Ef),Of=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function kf(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=$(Of,ju),o=Sf(e.onlyRenderVisibleElements),s=wf();return(0,Y.jsx)(`div`,{className:`react-flow__nodes`,style:Rd,children:o.map(o=>(0,Y.jsx)(Df,{id:o,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:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}kf.displayName=`NodeRenderer`;var Af=(0,X.memo)(kf);function jf(e){return $((0,X.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Jc({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),ju)}var Mf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,Y.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},Nf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,Y.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},Pf={[Hs.Arrow]:Mf,[Hs.ArrowClosed]:Nf};function Ff(e){let t=Fu();return(0,X.useMemo)(()=>Object.prototype.hasOwnProperty.call(Pf,e)?Pf[e]:(t.getState().onError?.(`009`,Ns.error009(e)),null),[e])}var If=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Ff(t);return c?(0,Y.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,Y.jsx)(c,{color:n,strokeWidth:o})}):null},Lf=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,X.useMemo)(()=>dl(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,Y.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,Y.jsx)(`defs`,{children:i.map(e=>(0,Y.jsx)(If,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Lf.displayName=`MarkerDefinitions`;var Rf=(0,X.memo)(Lf);function zf({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,X.useState)({x:1,y:0,width:0,height:0}),p=Jt([`react-flow__edge-textwrapper`,l]),m=(0,X.useRef)(null);return(0,X.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,Y.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,Y.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,Y.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}zf.displayName=`EdgeText`;var Bf=(0,X.memo)(zf);function Vf({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{...u,d:e,fill:`none`,className:Jt([`react-flow__edge-path`,u.className])}),l?(0,Y.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&_c(t)&&_c(n)?(0,Y.jsx)(Bf,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Hf({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Uf({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=Hf({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Hf({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Hc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Wf(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Uf({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Gf=Wf({isInternal:!1}),Kf=Wf({isInternal:!0});Gf.displayName=`SimpleBezierEdge`,Kf.displayName=`SimpleBezierEdgeInternal`;function qf(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=il({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var Jf=qf({isInternal:!1}),Yf=qf({isInternal:!0});Jf.displayName=`SmoothStepEdge`,Yf.displayName=`SmoothStepEdgeInternal`;function Xf(e){return(0,X.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,Y.jsx)(Jf,{...n,id:r,pathOptions:(0,X.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Zf=Xf({isInternal:!1}),Qf=Xf({isInternal:!0});Zf.displayName=`StepEdge`,Qf.displayName=`StepEdgeInternal`;function $f(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Qc({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var ep=$f({isInternal:!1}),tp=$f({isInternal:!0});ep.displayName=`StraightEdge`,tp.displayName=`StraightEdgeInternal`;function np(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Gc({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var rp=np({isInternal:!1}),ip=np({isInternal:!0});rp.displayName=`BezierEdge`,ip.displayName=`BezierEdgeInternal`;var ap={default:ip,straight:tp,step:Qf,smoothstep:Yf,simplebezier:Kf},op={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},sp=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,cp=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,lp=`react-flow__edgeupdater`;function up({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,Y.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Jt([lp,`${lp}-${s}`]),cx:sp(t,r,e),cy:cp(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function dp({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=Fu(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Gl.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(e===!0||e===`source`)&&(0,Y.jsx)(up,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,Y.jsx)(up,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function fp({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||ap[x];S===void 0&&(_?.(`011`,Ns.error011(x)),x=`default`,S=h?.default||ap.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,X.useRef)(null),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),j=Fu(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L}=$((0,X.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return op;let i=ol({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=qc({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||op,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),ju),R=(0,X.useMemo)(()=>y.markerStart?`url('#${ul(y.markerStart,m)}')`:void 0,[y.markerStart,m]),z=(0,X.useMemo)(()=>y.markerEnd?`url('#${ul(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||ee===null)return null;let B=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},V=a?e=>{a(e,{...y})}:void 0,H=o?e=>{o(e,{...y})}:void 0,U=s?e=>{s(e,{...y})}:void 0,W=c?e=>{c(e,{...y})}:void 0,te=l?e=>{l(e,{...y})}:void 0;return(0,Y.jsx)(`svg`,{style:{zIndex:M},children:(0,Y.jsxs)(`g`,{className:Jt([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:B,onDoubleClick:V,onContextMenu:H,onMouseEnter:U,onMouseMove:W,onMouseLeave:te,onKeyDown:C?t=>{if(!v&&Fs.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${zu}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,Y.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:R,markerEnd:z,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,Y.jsx)(dp,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var pp=(0,X.memo)(fp),mp=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function hp({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(mp,ju),b=jf(t);return(0,Y.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,Y.jsx)(Rf,{defaultColor:e,rfId:n}),b.map(e=>(0,Y.jsx)(pp,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}hp.displayName=`EdgeRenderer`;var gp=(0,X.memo)(hp),_p=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function vp({children:e}){let t=$(_p);return(0,Y.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:t},children:e})}function yp(e){let t=Nd(),n=(0,X.useRef)(!1);(0,X.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var bp=e=>e.panZoom?.syncViewport;function xp(e){let t=$(bp),n=Fu();return(0,X.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Sp(e){return e.connection.inProgress?{...e.connection,to:bc(e.connection.to,e.transform)}:{...e.connection}}function Cp(e){return e?t=>e(Sp(t)):Sp}function wp(e){return $(Cp(e),ju)}var Tp=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ep({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(Tp,ju);return a&&i&&c?(0,Y.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,Y.jsx)(`g`,{className:Jt([`react-flow__connection`,Ws(s)]),children:(0,Y.jsx)(Dp,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var Dp=({style:e,type:t=Vs.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=wp();if(!i)return;if(n)return(0,Y.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Ws(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Vs.Bezier:[m]=Gc(h);break;case Vs.SimpleBezier:[m]=Uf(h);break;case Vs.Step:[m]=il({...h,borderRadius:0});break;case Vs.SmoothStep:[m]=il(h);break;default:[m]=Qc(h)}return(0,Y.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};Dp.displayName=`ConnectionLine`;var Op={};function kp(e=Op){(0,X.useRef)(e),Fu(),(0,X.useEffect)(()=>{},[e])}function Ap(){Fu(),(0,X.useRef)(!1),(0,X.useEffect)(()=>{},[])}function jp({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:ee,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:R,autoPanOnSelection:z,onPaneClick:B,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneScroll:W,onPaneContextMenu:te,paneClickDistance:G,nodeClickDistance:ne,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:oe,reconnectRadius:K,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:pe,nodeExtent:me,rfId:he,viewport:q,onViewportChange:ge}){return kp(e),kp(t),Ap(),yp(n),xp(q),(0,Y.jsx)(bf,{onPaneClick:B,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneContextMenu:te,onPaneScroll:W,paneClickDistance:G,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:L,panOnScroll:F,panOnScrollSpeed:ee,panOnScrollMode:I,panOnDrag:R,autoPanOnSelection:z,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:pe,onViewportChange:ge,isControlledViewport:!!q,children:(0,Y.jsxs)(vp,{children:[(0,Y.jsx)(gp,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,onlyRenderVisibleElements:T,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:oe,reconnectRadius:K,defaultMarkerColor:M,noPanClassName:fe,disableKeyboardA11y:pe,rfId:he}),(0,Y.jsx)(Ep,{style:h,type:m,component:g,containerStyle:_}),(0,Y.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,Y.jsx)(Af,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ne,onlyRenderVisibleElements:T,noPanClassName:fe,noDragClassName:ue,disableKeyboardA11y:pe,nodeExtent:me,rfId:he}),(0,Y.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}jp.displayName=`GraphView`;var Mp=(0,X.memo)(jp),Np=vc(`React Flow`,`https://reactflow.dev/`),Pp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??Ps;kl(h,g,_);let{nodesInitialized:x}=bl(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=Tc(Xs(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:Ps,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ls.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Bs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Np,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:Is,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Fp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>Au((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await ec({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...Pp({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=bl(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();kl(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=El(e,n,r,i,a,o,l);d&&(_l(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=cl(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=Tl(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(hd(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(gd(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>_d(e,!0)));return}i(vd(r,new Set([...e]),!0)),a(vd(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>_d(e,!0)));return}a(vd(n,new Set([...e]))),i(vd(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(_d(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(_d(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,_d(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,_d(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(bl(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return Dl({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Bs}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...Pp()})}},Object.is);function Ip({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,X.useState)(()=>Fp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,Y.jsx)(Nu,{value:m,children:(0,Y.jsx)(Ad,{children:(0,Y.jsx)(tf,{children:p})})})}function Lp({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,X.useContext)(Mu)?(0,Y.jsx)(Y.Fragment,{children:e}):(0,Y.jsx)(Ip,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var Rp={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function zp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:ee,connectionMode:I,connectionLineType:L=Vs.Bezier,connectionLineStyle:R,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:V=`Backspace`,selectionKeyCode:H=`Shift`,selectionOnDrag:U=!1,selectionMode:W=zs.Full,panActivationKeyCode:te=`Space`,multiSelectionKeyCode:G=Ec()?`Meta`:`Control`,zoomActivationKeyCode:ne=Ec()?`Meta`:`Control`,snapToGrid:re,snapGrid:ie,onlyRenderVisibleElements:ae=!1,selectNodesOnDrag:oe,nodesDraggable:K,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,nodeOrigin:ue=ed,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:pe=!0,defaultViewport:me=td,minZoom:he=.5,maxZoom:q=2,translateExtent:ge=Ps,preventScrolling:_e=!0,nodeExtent:ve,defaultMarkerColor:ye=`#b1b1b7`,zoomOnScroll:be=!0,zoomOnPinch:xe=!0,panOnScroll:Se=!1,panOnScrollSpeed:Ce=.5,panOnScrollMode:we=Rs.Free,zoomOnDoubleClick:Te=!0,panOnDrag:Ee=!0,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne=1,nodeClickDistance:Pe=0,children:Fe,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:He,onEdgeMouseLeave:Ue,reconnectRadius:We=10,onNodesChange:J,onEdgesChange:Ge,noDragClassName:Ke=`nodrag`,noWheelClassName:qe=`nowheel`,noPanClassName:Je=`nopan`,fitView:Ye,fitViewOptions:Xe,connectOnClick:Ze,attributionPosition:Qe,proOptions:$e,defaultEdgeOptions:et,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:nt=!1,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanOnSelection:ot=!0,autoPanSpeed:st,connectionRadius:ct,isValidConnection:lt,onError:ut,style:dt,id:ft,nodeDragThreshold:pt,connectionDragThreshold:mt,viewport:ht,onViewportChange:gt,width:_t,height:vt,colorMode:yt=`light`,debug:bt,onScroll:xt,ariaLabelConfig:St,zIndexMode:Ct=`basic`,...wt},Tt){let Et=ft||`1`,Dt=sd(yt),Ot=(0,X.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),xt?.(e)},[xt]);return(0,Y.jsx)(`div`,{"data-testid":`rf__wrapper`,...wt,onScroll:Ot,style:{...dt,...Rp},ref:Tt,className:Jt([`react-flow`,i,Dt]),id:ft,role:`application`,children:(0,Y.jsxs)(Lp,{nodes:e,edges:t,width:_t,height:vt,fitView:Ye,fitViewOptions:Xe,minZoom:he,maxZoom:q,nodeOrigin:ue,nodeExtent:ve,zIndexMode:Ct,children:[(0,Y.jsx)(ad,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:K,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:pe,elevateNodesOnSelect:tt,elevateEdgesOnSelect:nt,minZoom:he,maxZoom:q,nodeExtent:ve,onNodesChange:J,onEdgesChange:Ge,snapToGrid:re,snapGrid:ie,connectionMode:I,translateExtent:ge,connectOnClick:Ze,defaultEdgeOptions:et,fitView:Ye,fitViewOptions:Xe,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Je,nodeOrigin:ue,rfId:Et,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:ut,connectionRadius:ct,isValidConnection:lt,selectNodesOnDrag:oe,nodeDragThreshold:pt,connectionDragThreshold:mt,onBeforeDelete:ee,debug:bt,ariaLabelConfig:St,zIndexMode:Ct}),(0,Y.jsx)(Mp,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:R,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:H,selectionOnDrag:U,selectionMode:W,deleteKeyCode:V,multiSelectionKeyCode:G,panActivationKeyCode:te,zoomActivationKeyCode:ne,onlyRenderVisibleElements:ae,defaultViewport:me,translateExtent:ge,minZoom:he,maxZoom:q,preventScrolling:_e,zoomOnScroll:be,zoomOnPinch:xe,zoomOnDoubleClick:Te,panOnScroll:Se,panOnScrollSpeed:Ce,panOnScrollMode:we,panOnDrag:Ee,autoPanOnSelection:ot,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne,nodeClickDistance:Pe,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:He,onEdgeMouseLeave:Ue,reconnectRadius:We,defaultMarkerColor:ye,noDragClassName:Ke,noWheelClassName:qe,noPanClassName:Je,rfId:Et,disableKeyboardA11y:rt,nodeExtent:ve,viewport:ht,onViewportChange:gt}),(0,Y.jsx)($u,{onSelectionChange:k}),Fe,(0,Y.jsx)(qu,{proOptions:$e,position:Qe}),(0,Y.jsx)(Wu,{rfId:Et,disableKeyboardA11y:rt})]})})}var Bp=Td(zp),Vp=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Hp({children:e}){let t=$(Vp);return t?(0,kt.createPortal)(e,t):null}function Up(e){let[t,n]=(0,X.useState)(e);return[t,n,(0,X.useCallback)(e=>n(t=>hd(e,t)),[])]}var Wp=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(let[,{internals:e}]of t.nodeLookup)if(e.handleBounds===void 0||!kc(e.userNode))return!1;return!0};function Gp(e={includeHiddenNodes:!1}){return $(Wp(e))}Ns.error014();function Kp({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,Y.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Jt([`react-flow__background-pattern`,n,r])})}function qp({radius:e,className:t}){return(0,Y.jsx)(`circle`,{cx:e,cy:e,r:e,className:Jt([`react-flow__background-pattern`,`dots`,t])})}var Jp;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(Jp||={});var Yp={[Jp.Dots]:1,[Jp.Lines]:1,[Jp.Cross]:6},Xp=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Zp({id:e,variant:t=Jp.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,X.useRef)(null),{transform:f,patternId:p}=$(Xp,ju),m=r||Yp[t],h=t===Jp.Dots,g=t===Jp.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,Y.jsxs)(`svg`,{className:Jt([`react-flow__background`,l]),style:{...c,...Rd,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,Y.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,Y.jsx)(qp,{radius:y/2,className:u}):(0,Y.jsx)(Kp,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,Y.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}Zp.displayName=`Background`;var Qp=(0,X.memo)(Zp);function $p(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,Y.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function em(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,Y.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function tm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,Y.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 nm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 rm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 im({children:e,className:t,...n}){return(0,Y.jsx)(`button`,{type:`button`,className:Jt([`react-flow__controls-button`,t]),...n,children:e})}var am=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function om({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=Fu(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(am,ju),{zoomIn:y,zoomOut:b,fitView:x}=Nd();return(0,Y.jsxs)(Gu,{className:Jt([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(im,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,Y.jsx)($p,{})}),(0,Y.jsx)(im,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,Y.jsx)(em,{})})]}),n&&(0,Y.jsx)(im,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,Y.jsx)(tm,{})}),r&&(0,Y.jsx)(im,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,Y.jsx)(rm,{}):(0,Y.jsx)(nm,{})}),u]})}om.displayName=`Controls`;var sm=(0,X.memo)(om);function cm({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,Y.jsx)(`rect`,{className:Jt([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var lm=(0,X.memo)(cm),um=e=>e.nodes.map(e=>e.id),dm=e=>e instanceof Function?e:()=>e;function fm({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=lm,onClick:o}){let s=$(um,ju),c=dm(t),l=dm(e),u=dm(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,Y.jsx)(Y.Fragment,{children:s.map(e=>(0,Y.jsx)(mm,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function pm({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=Oc(r);return{node:r,x:i,y:a,width:o,height:s}},ju);return!l||l.hidden||!kc(l)?null:(0,Y.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var mm=(0,X.memo)(pm),hm=(0,X.memo)(fm),gm=200,_m=150,vm=e=>!e.hidden,ym=e=>{let 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?pc(Xs(e.nodeLookup,{filter:vm}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},bm=`react-flow__minimap-desc`;function xm({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=Fu(),S=(0,X.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(ym,ju),j=e?.width??gm,M=e?.height??_m,N=C.width/j,P=C.height/M,F=Math.max(N,P),ee=F*j,I=F*M,L=b*F,R=C.x-(ee-C.width)/2-L,z=C.y-(I-C.height)/2-L,B=ee+L*2,V=I+L*2,H=`${bm}-${T}`,U=(0,X.useRef)(0),W=(0,X.useRef)();U.current=F,(0,X.useEffect)(()=>{if(S.current&&E)return W.current=Kl({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>U.current}),()=>{W.current?.destroy()}},[E]),(0,X.useEffect)(()=>{W.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let te=p?e=>{let[t,n]=W.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,G=m?(0,X.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ne=_??A[`minimap.ariaLabel`];return(0,Y.jsx)(Gu,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F: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 o==`number`?o:void 0},className:Jt([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,Y.jsxs)(`svg`,{width:j,height:M,viewBox:`${R} ${z} ${B} ${V}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":H,ref:S,onClick:te,children:[ne&&(0,Y.jsx)(`title`,{id:H,children:ne}),(0,Y.jsx)(hm,{onClick:G,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,Y.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${R-L},${z-L}h${B+L*2}v${V+L*2}h${-B-L*2}z + M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}xm.displayName=`MiniMap`;var Sm=(0,X.memo)(xm),Cm=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,wm={[su.Line]:`right`,[su.Handle]:`bottom-right`};function Tm({nodeId:e,position:t,variant:n=su.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=Qd(),y=typeof e==`string`?e:v,b=Fu(),x=(0,X.useRef)(null),S=n===su.Handle,C=$((0,X.useCallback)(Cm(S&&p),[S,p]),ju),w=(0,X.useRef)(null),T=t??wm[n];(0,X.useEffect)(()=>{if(!(!x.current||!y))return w.current||=vu({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Tl([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Ac({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,Y.jsx)(`div`,{className:Jt([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,X.memo)(Tm);function Em({path:e,delay:t,padding:n=24,children:r}){let i=`map-growth-${(0,X.useId)().replace(/:/g,``)}`;if(t==null)return(0,Y.jsx)(Y.Fragment,{children:r});let a=(e.match(/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/gi)??[]).map(Number),o=a.filter((e,t)=>t%2==0),s=a.filter((e,t)=>t%2==1);if(!o.length||!s.length)return(0,Y.jsx)(Y.Fragment,{children:r});let c=Math.min(...o)-n,l=Math.min(...s)-n;return(0,Y.jsxs)(`g`,{"data-map-growing-edge":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`mask`,{id:i,maskUnits:`userSpaceOnUse`,x:c,y:l,width:Math.max(...o)-c+n,height:Math.max(...s)-l+n,children:(0,Y.jsx)(`path`,{className:`map-growth-mask`,d:e,pathLength:1,fill:`none`,stroke:`white`,strokeWidth:n*2,strokeLinecap:`round`,style:{animationDelay:`${t}ms`}})})}),(0,Y.jsx)(`g`,{mask:`url(#${i})`,children:r})]})}function Dm({layout:e,growing:t={},activeStep:n,activeTeamSteps:r=[]}){let i=`submap-arrow-${(0,X.useId)().replace(/:/g,``)}`;return(0,Y.jsxs)(`svg`,{className:`submap-relations`,width:e.width,height:e.height,"aria-label":`Task process relationships`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`marker`,{id:i,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6.5`,markerHeight:`6.5`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,fill:`var(--map-edge-context, #6f8ca8)`})})}),e.links.map(a=>{let o=e.positions[a.source],s=e.positions[a.target],c=o.x===s.x&&s.y>o.y,l=o.x+(c?116:232),u=o.y+(c?180:90),d=s.x+(c?116:0),f=s.y+(c?0:90),p=(l+d)/2,m=(u+f)/2,h=c?`M ${l} ${u} L ${d} ${f}`:`M ${l} ${u} C ${p} ${u}, ${p} ${f}, ${d} ${f}`;return(0,Y.jsxs)(`g`,{"data-testid":`submap-relation`,"data-relation":a.relation,"data-source":a.source,"data-target":a.target,"aria-label":`${a.label}: ${a.explanation}`,children:[(0,Y.jsx)(`title`,{children:a.explanation}),(0,Y.jsx)(Em,{path:h,delay:t[a.id],children:(0,Y.jsx)(`path`,{className:`submap-relation-path`,d:h,fill:`none`,stroke:`var(--map-edge-context, #6f8ca8)`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeDasharray:a.contextual?`5 6`:void 0,markerEnd:`url(#${i})`})}),(n===a.target||r.includes(a.target))&&(0,Y.jsx)(`path`,{className:`submap-flow`,d:h,pathLength:1,fill:`none`,stroke:`#4b9cae`,strokeWidth:`3`,strokeDasharray:`.09 .91`,strokeLinecap:`round`,"aria-hidden":`true`}),(0,Y.jsxs)(`g`,{className:`submap-relation-label`,transform:`translate(${p}, ${m})`,children:[(0,Y.jsx)(`rect`,{x:`-38`,y:`-11`,width:`76`,height:`22`,rx:`6`}),(0,Y.jsx)(`text`,{textAnchor:`middle`,dominantBaseline:`central`,children:a.label})]})]},a.id)})]})}function Om({role:e,since:t,zh:n,text:r}){let[i,a]=(0,X.useState)(()=>Date.now()/1e3);(0,X.useEffect)(()=>{if(t==null||r)return;let e=setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(e)},[t,r]);let o=t==null?null:qt(i-t,n);return(0,Y.jsxs)(`div`,{className:`map-card-live`,"data-testid":`map-card-live`,"data-waiting":!!r||void 0,"aria-live":`off`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{title:r,children:r||(0,Y.jsxs)(Y.Fragment,{children:[ut(e,n),o?n?` · 本次已进行 ${o}`:` · ${o} this run`:``]})})]})}var km=(0,X.createContext)({notes:{}}),Am=(0,X.createContext)({}),jm={plan:[`计划`,`Plan`],execution:[`动手处理`,`Work`],review:[`检查结果`,`Check`],revision:[`修订`,`Revise`],result:[`结果`,`Result`]},Mm={plan:N,execution:I,review:m,revision:F,result:ht},Nm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],review_unavailable:[`这次结果检查没有完成`,`Result check did not finish`],held:[`工作暂停,后续尚未安排`,`Work paused; no next step scheduled`],aborted:[`已取消`,`Cancelled`],cancelled:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已被新计划替代`,`Replaced by a new plan`],question:[`等待答复`,`Waiting for an answer`],paused:[`已暂停`,`Paused`],paused_external_work:[`等待后台任务`,`Waiting on background work`],missing:[`记录中缺失`,`Not in this record`],unknown:[`状态未知`,`Unknown`],continue:[`需再改一轮`,`Another pass needed`],blocked:[`受阻`,`Held up`],started:[`进行中`,`Under way`],recorded:[`已记录`,`On record`],requested:[`修改建议`,`Requested`],replan:[`需要调整计划`,`Plan needs adjusting`],replan_requested:[`需要调整计划`,`Plan needs adjusting`]},Pm={plan:[`接下来要做什么,为什么这样做`,`What to do next and why`],execution:[`实际做了什么,遇到了什么问题`,`What was done and what happened`],review:[`结果是否正确,有什么依据`,`Whether the result is correct and what supports it`],revision:[`检查后发现需要修改的地方`,`What the check found needs changing`],result:[`这项任务最后得到了什么`,`What the task produced in the end`]},Fm={plan:[`提问`,`Asked`],execution:[`Argus 查证`,`Argus`],review:[`核对`,`Check`],revision:[`修订`,`Revise`],result:[`回答`,`Answer`]},Im={plan:[`你提出的要求`,`What you asked for`],execution:[`Argus 自己动手查证、运行命令`,`Argus did the work itself: read, searched, ran commands`],review:[`对结果的核对`,`A check of the result`],revision:[`需要修改的地方`,`What had to change`],result:[`Argus 给出的回答`,`What Argus answered`]},Lm=(e,t)=>e.source===`team`?t?`子任务工作记录`:`Subtask work record`:e.source===`task`?t?`任务记录`:`Task record`:e.source===`interval`?t?`根据同期记录关联`:`By execution window`:t?`来自任务记录`:`Linked event`,Rm=(0,X.memo)(function({id:e,data:t}){let{task:n,ordinal:r,zh:i,layout:a,focused:o,detailed:s}=t,{artifacts:c,onOpenArtifact:l}=(0,X.useContext)(Am),u=(0,X.useContext)(km).notes[n.id]??[],[d]=(0,X.useState)(()=>!!t.revealing||!t.restoring&&!t.seenCards?.has(e));(0,X.useEffect)(()=>{t.seenCards?.add(e)},[t.seenCards,e]);let[f,p]=(0,X.useState)(null),m=f||a,h=e=>e.source===`team`&&a.steps.find(t=>t.id===e.id)||e,g=t.canvasSize?.width||window.innerWidth,v=t.canvasSize?.height||window.innerHeight;(0,X.useEffect)(()=>{s||(x(null),p(null),t.readCopy?.(e,null))},[s]);let[b,x]=(0,X.useState)(null),S=(0,X.useRef)(n.status),[C,w]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=S.current!==n.status;if(S.current=n.status,!e||n.status!==`done`||t.completionScope)return;w(!0);let r=setTimeout(()=>w(!1),1500);return()=>clearTimeout(r)},[n.status,t.completionScope]);let T=m.steps.find(e=>e.id===b),E=T?h(T):void 0,O=E?.updatedAt??E?.ts,k=t.part===t.partCount,A=!k||t.completionScope?`recorded`:n.status===`missing`?`missing`:t.paused&&Te.has(n.status)?`paused`:De(n),j=A===`paused`&&n.status===`paused_external_work`?n.status:A,M=Math.min(t.frame.width/288,t.frame.height/280),N=t.copy?.cards||{},F=!!N[n.id]?.summary&&N[n.id]?.task_status!==n.status&&(Te.has(n.status)||n.status===`pending`),ee=e=>{if(e.completionScope||e.status===`review_unavailable`)return;let t=N[e.id];if(e.source!==`team`)return t;let n=t?.event_ids?.indexOf(e.id)??-1;return h(e).revision&&n>=0&&t?.event_revisions?.[n]===h(e).revision?t:void 0},I=n.kind===`turn`?void 0:t.words,L=(t.completionScope?``:N[n.id]?.title)||I?.title||n.title,R=i?`环节 ${t.start}–${t.end} / ${t.totalSteps}`:`Steps ${t.start}–${t.end} / ${t.totalSteps}`,z=t.partCount>1&&!k?m.steps.map(e=>ee(e)?.summary||h(e).summary||h(e).detail).filter(e=>e&&![_e(!0),_e(!1)].includes(e)).at(-1):void 0,B=k&&n.objective&&n.objective.trim()!==n.title.trim(),V=A===`review_unavailable`?i?`当次审查器未能给出判断,未形成审阅结论。`:`The Reviewer could not return a judgment on this attempt.`:(t.completionScope?``:N[n.id]?.summary)||I?.summary||``,U=(k?n.pending_question:``)||z||V||t.completionScope||n.pending_question||nt(n.summary||``,i).summary||n.summary||(B?``:n.objective),W=Math.min(t.frame.width/m.width,t.frame.height/m.height),te=k&&t.live&&Te.has(n.status)?[...m.steps].reverse().find(e=>e.source!==`team`&&![`plan`,`result`].includes(e.kind))?.id:null,G=t.paused?null:te,ne=a.steps.filter(e=>e.source===`team`),re=t.live?ne.filter(e=>Te.has(e.status)).map(e=>e.id):[],ie=ne.filter(e=>e.status===`done`).length,ae=ne.filter(e=>Te.has(e.status)).length,oe=(i?`子任务 ${ie}/${ne.length} 完成 · ${ae} 进行中`:`Subtasks ${ie}/${ne.length} done · ${ae} running`)+((t.plannedWidth??0)>ne.length?i?` · 计划并行 ×${t.plannedWidth}`:` · planned ×${t.plannedWidth}`:``),K=e=>e.source===`team`?re.includes(e.id):G===e.id,ce=e=>e.source===`team`?h(e).status:te===e.id?t.paused?`paused`:`running`:e.status,le=e=>({source:t.source,task_id:n.id,task_title:L,lang:i?`zh`:`en`,part:t.partCount>1?t.part:void 0,step_id:e?.id,step_title:e?.title,team_id:e?.teamId,team_task_id:e?.teamTaskId,event_ids:e?e.eventIds:t.partCount>1?[...new Set(m.steps.flatMap(e=>e.eventIds))]:N[n.id]?.event_ids||[]}),ue=Math.min(640,m.width-48,Math.max(260,(g-50)/1.05)),de=Math.min(600,m.height-48,Math.max(300,(v-(g<640?180:160))/1.05)),fe=e=>({x:Math.max(24,Math.min(m.positions[e.id].x-16,m.width-ue-24)),y:Math.max(24,Math.min(m.positions[e.id].y-16,m.height-de-24)),width:ue,height:de,scale:W}),pe=E?fe(E):null,me=n=>{p(m),x(n.id),t.readCopy?.(e,n.id),t.readStep(e,fe(n))};(0,X.useEffect)(()=>{E&&t.readStep(e,fe(E))},[g,v]);let he=e=>(Nm[e===`paused_external_work`?e:e.startsWith(`paused_`)?`paused`:Te.has(e)?`running`:e]??Nm.unknown)[+!i],q=t.completionScope?i?`当次结束 · 当时目标未完成`:`Execution ended · goal incomplete then`:n.turn_kind===`qa`&&[`done`,`running`,`cancelled`,`failed`].includes(A)?{done:[`已回答`,`Answered`],running:[`正在回答`,`Answering`],cancelled:[`已中断`,`Interrupted`],failed:[`回答失败`,`Answer failed`]}[A][+!i]:he(j);return(0,Y.jsxs)(`article`,{className:`map-macro map-state-${A}`,"data-testid":`map-macro`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,"data-history":!k,"data-has-history":!!t.historyCount,"data-arrive":!!t.arriving||d&&!!t.revealing,"data-lit":!!t.lit,"data-hovered":!!t.hovered,"data-growing":t.growthDelay!=null,"data-dispatch":t.dispatchState,style:{animationDelay:`${t.growthDelay??(t.arriving?Gt(r):0)}ms`},"data-focused":o,"data-detailed":s,"aria-label":L,"data-completed-now":C,"data-active":re.length>0||k&&t.live&&!t.paused&&Te.has(n.status),onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(),{x:e.clientX,y:e.clientY})},children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(sf,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsxs)(`div`,{className:`macro-summary`,"aria-hidden":s,style:{"--summary-height":`${t.frame.height/M-20}px`,width:t.frame.width/M-20,transform:`translate(-50%, -50%) scale(${M})`},children:[(0,Y.jsxs)(`button`,{className:`map-card map-state-${A} nodrag nopan`,"data-testid":`map-card`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,tabIndex:s?-1:0,onClick:()=>n.turn_kind===`qa`&&t.readCopy?t.readCopy(e,n.id):t.open(e),"aria-label":`${L} · ${n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`放大任务`:`Explore task`}`,children:[(0,Y.jsxs)(`div`,{className:`map-card-top`,children:[(0,Y.jsxs)(`span`,{className:`map-card-number`,children:[n.turn_kind===`qa`?i?`问答`:`Q&A`:k?i?`任务`:`MISSION`:i?`历史`:`HISTORY`,` `,String(r).padStart(2,`0`),!k&&` · ${t.part}/${t.partCount}`]}),(A!==`recorded`||t.completionScope)&&(0,Y.jsxs)(`span`,{className:`map-status`,children:[A===`done`?(0,Y.jsx)(_,{size:11}):A===`failed`?(0,Y.jsx)(y,{size:11}):A===`review_unavailable`?(0,Y.jsx)(Ce,{size:11}):A===`question`?(0,Y.jsx)(ve,{size:11}):A===`paused`||A===`held`?(0,Y.jsx)(P,{size:11}):(0,Y.jsx)(`span`,{className:`map-state-dot`}),q]})]}),(0,Y.jsxs)(`h3`,{children:[(0,Y.jsx)(rt,{children:L}),u.length>0&&(0,Y.jsx)(`span`,{className:`macro-note-badge`,title:i?`操作员批注`:`Operator notes`,children:u.length})]}),B&&!V&&(0,Y.jsx)(`p`,{className:`map-card-objective`,title:n.objective,children:n.objective}),U&&U.trim()!==(B?n.objective.trim():``)&&(0,Y.jsx)(`div`,{className:`map-card-copy`,children:(0,Y.jsx)(rt,{children:U})}),t.conclusion&&(0,Y.jsx)(`p`,{className:`map-card-conclusion`,"data-testid":`map-card-conclusion`,title:t.conclusion,children:t.conclusion}),n.kind!==`turn`&&(0,Y.jsx)(`div`,{className:`map-card-course`,"aria-label":i?`任务经过`:`Course of the task`,children:[`plan`,`execution`,`review`,`result`].map(e=>{let t=Mm[e],n=m.steps.some(t=>t.kind===e),r=m.steps.some(t=>t.kind===e&&K(t)),a=i?{plan:`规划`,execution:`执行`,review:`审查`,result:`交付`}[e]:jm[e][1];return(0,Y.jsxs)(`span`,{className:`submap-kind-${e}`,"data-present":n,"data-active":r,title:a,children:[(0,Y.jsx)(t,{size:12,"aria-hidden":!0}),(0,Y.jsx)(`b`,{children:a})]},e)})}),(()=>{let e=k&&t.live&&t.waiting,r=!e&&k&&t.live&&!t.paused&&Te.has(n.status),a=A!==`recorded`||!!t.completionScope,o=!!t.historyCount&&ne.length>0;return!r&&!e&&k&&a&&!o?null:(0,Y.jsxs)(`div`,{className:`map-card-stages`,children:[e?(0,Y.jsx)(Om,{text:t.waiting,zh:i}):r?(0,Y.jsx)(Om,{role:t.phase??n.role,since:n.started_ts,zh:i}):k&&a?null:(0,Y.jsx)(`span`,{className:`map-card-recorded`,children:k?q:i?`历史记录 · 非当前执行`:`History · not current execution`}),o&&(0,Y.jsx)(`span`,{className:`map-card-team-summary`,children:oe})]})})(),k&&ne.length>0&&(0,Y.jsx)(`span`,{className:`map-card-teambar`,"aria-hidden":!0,children:(0,Y.jsx)(`i`,{style:{width:`${Math.round(ie/ne.length*100)}%`}})}),(0,Y.jsxs)(`div`,{className:`map-card-bottom`,children:[(0,Y.jsx)(`span`,{className:ne.length?`map-card-team-summary`:void 0,title:R,children:n.turn_kind===`qa`?i?`问题与回答`:`Question and answer`:t.historyCount?``:ne.length?oe:t.plannedWidth&&Te.has(n.status)?i?`并行编队 ×${t.plannedWidth} 展开中`:`Fanning out ×${t.plannedWidth}`:t.partCount>1?R:`${m.steps.length} ${i?`个环节`:`steps`}`}),(0,Y.jsxs)(`span`,{className:`map-card-submap-hint`,children:[F?i?`描述更新中`:`Summary updating`:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`查看进展`:`View progress`,(0,Y.jsx)(se,{size:12})]})]})]}),!!t.historyCount&&t.toggleHistory&&(0,Y.jsxs)(`button`,{type:`button`,className:`map-history-toggle nodrag nopan`,"aria-expanded":t.historyExpanded,"aria-label":`${i?`任务历史`:`Mission history`}: ${L}`,title:i?`保留全部 ${t.totalSteps} 个环节`:`All ${t.totalSteps} steps retained`,onClick:()=>t.toggleHistory?.(n.id),children:[t.historyExpanded?i?`收起历史`:`Hide history`:`${i?`历史`:`History`} ${t.historyCount}`,(0,Y.jsx)(se,{size:12})]})]}),o&&(0,Y.jsxs)(`div`,{className:`macro-detail ${E?`is-reading`:``}`,"data-stacked":m.stacked||void 0,"aria-hidden":!s,style:{width:m.width,height:m.height,transform:`scale(${W})`,transformOrigin:`top left`},children:[(0,Y.jsxs)(`header`,{className:`macro-heading`,children:[(0,Y.jsx)(`span`,{className:`macro-index`,children:String(r).padStart(2,`0`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`small`,{children:t.partCount>1?i?`第 ${t.part} / ${t.partCount} 部分`:`Part ${t.part} / ${t.partCount}`:n.turn_kind===`qa`?i?`问答内容`:`Q&A`:i?`任务内部`:`INSIDE THIS TASK`}),(0,Y.jsx)(`h2`,{children:(0,Y.jsx)(rt,{children:L})})]}),t.conclusion&&(0,Y.jsx)(`span`,{className:`macro-conclusion`,"data-testid":`macro-conclusion`,title:t.conclusion,children:t.conclusion}),(A!==`recorded`||t.completionScope)&&(0,Y.jsx)(`span`,{className:`macro-state`,title:t.completionScope,children:q}),s&&k?(0,Y.jsx)(D,{"data-testid":`map-task-read`,className:`nodrag nopan text-xs`,onClick:()=>{if(n.turn_kind===`qa`){t.readCopy?.(e,n.id);return}x(null),p(null),t.readCopy?.(e,n.id)},children:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`阅读任务说明`:`Read task explanation`}):null]}),(0,Y.jsx)(`div`,{className:`macro-stage-key`,children:Ge.filter(e=>n.kind!==`turn`||m.steps.some(t=>t.kind===e)).map(e=>(0,Y.jsx)(`span`,{className:`submap-kind-${e} ${m.steps.some(t=>t.kind===e)?``:`is-unrecorded`}`,title:n.kind===`turn`?Im[e][+!i]:Pm[e][+!i],children:n.kind===`turn`?Fm[e][+!i]:jm[e][+!i]},e))}),u.length>0&&(0,Y.jsxs)(`aside`,{className:`macro-notes`,"aria-label":i?`操作员批注`:`Operator notes`,children:[(0,Y.jsx)(`small`,{children:i?`批注`:`Notes`}),u.map(e=>(0,Y.jsx)(`p`,{children:e.text},e.id))]}),(0,Y.jsx)(Dm,{layout:m,growing:t.growingLinks,activeStep:G,activeTeamSteps:re}),m.columns.map(e=>(0,Y.jsx)(`div`,{className:`macro-column-label`,style:{left:e.x,top:e.y},children:e.title},e.id)),m.steps.map((e,r)=>{let a=h(e),o=Mm[a.kind];return(0,Y.jsxs)(`button`,{className:`submap-step submap-kind-${a.kind} nodrag nopan ${b===a.id?`is-selected`:``}`,"data-testid":`submap-step`,"data-step-id":a.id,"data-source":a.source,"data-team-id":a.teamId,"data-team-task-id":a.teamTaskId,"data-status":ce(a),"data-active":K(a),"data-growing":t.growingSteps?.[a.id]!=null,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(a),{x:e.clientX,y:e.clientY})},style:{animationDelay:`${t.growingSteps?.[a.id]??0}ms`,"--step-index":r,left:m.positions[a.id].x,top:m.positions[a.id].y},tabIndex:s?0:-1,onClick:()=>me(a),"aria-expanded":b===a.id,children:[(0,Y.jsxs)(`div`,{className:`submap-step-meta`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(o,{size:16}),a.source===`team`?i?`子任务 · `:`Subtask · `:``,(n.kind===`turn`?Fm:jm)[a.kind][+!i],a.round!=null&&(0,Y.jsx)(`em`,{className:`submap-round`,children:i?`第 ${a.round} 轮`:`Round ${a.round}`})]}),(0,Y.jsx)(`small`,{"data-verdict":a.source===`team`&&ye(h(a).teamOutcome)||void 0,children:a.completionScope&&a.status===`recorded`?i?`执行结束`:`Execution ended`:a.source===`team`&&ce(a)===`failed`?i?`失败`:`Failed`:a.source===`team`&&H(h(a).teamOutcome,i)||he(ce(a))})]}),(0,Y.jsx)(`h4`,{children:(0,Y.jsx)(rt,{children:a.title})}),(0,Y.jsx)(`div`,{className:`submap-step-copy`,children:(0,Y.jsx)(rt,{children:ee(a)?.summary||h(a).summary||a.detail||_e(i)})}),(0,Y.jsxs)(`div`,{className:`submap-step-foot`,children:[(0,Y.jsxs)(`span`,{title:Lm(a,i),children:[i?`查看详情`:`Read more`,a.workCount?(0,Y.jsx)(`em`,{className:`submap-step-work`,children:i?` · ${a.workCount} 步操作`:` · ${a.workCount} actions`}):null]}),(0,Y.jsx)(se,{size:14})]})]},a.id)}),t.partCount>1&&!E&&(0,Y.jsxs)(`nav`,{className:`macro-part-nav nodrag nopan`,"aria-label":i?`任务各部分`:`Task parts`,children:[(0,Y.jsx)(`span`,{children:R}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{disabled:!t.previousId,onClick:()=>t.previousId&&t.open(t.previousId,!0),children:[(0,Y.jsx)(ft,{size:14}),i?`上一部分`:`Previous part`]}),(0,Y.jsxs)(`button`,{disabled:!t.nextId,onClick:()=>t.nextId&&t.open(t.nextId,!0),children:[i?`下一部分`:`Next part`,(0,Y.jsx)(se,{size:14})]})]})]}),E&&pe&&(0,Y.jsxs)(`section`,{className:`macro-reader nodrag nopan nowheel`,"data-testid":`map-reader`,"data-kind":E.kind,role:`region`,"aria-label":i?`卡片详情`:`Card details`,style:{left:pe.x,top:pe.y,width:pe.width,height:pe.height},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(E),{x:e.clientX,y:e.clientY})},children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsxs)(`span`,{children:[(n.kind===`turn`?Fm:jm)[E.kind][+!i],n.turn_kind!==`qa`&&(0,Y.jsx)(`small`,{className:`macro-reader-note`,children:Pm[E.kind][+!i]})]}),(0,Y.jsx)(`button`,{"aria-label":`Close step details`,onClick:()=>{x(null),p(null),t.readCopy?.(e,null),t.open(e)},children:(0,Y.jsx)(y,{size:20})})]}),(0,Y.jsx)(`h3`,{children:(0,Y.jsx)(rt,{children:ee(E)?.title||E.title})}),(0,Y.jsx)(`div`,{className:`macro-reader-body`,children:(0,Y.jsx)(Et,{cardKey:E.id,taskId:n.id,card:ee(E),task:n,readOnly:t.readOnly,originalDetail:E.detail||_e(i),selection:t.readerCopy,artifacts:c,onOpenArtifact:l})}),(0,Y.jsxs)(`footer`,{children:[(0,Y.jsx)(`span`,{title:Lm(E,i),children:O?new Date(O*1e3).toLocaleString(i?`zh-CN`:`en-US`):``}),!t.readOnly&&(0,Y.jsx)(`button`,{onClick:()=>t.quote(le(E)),children:i?`引用此项`:`Reference`})]})]})]})]})});function zm(e){if(!(e>0)||!Number.isFinite(e))return e;let t=Math.floor(Math.log2(e)*4+1e-9)/4;return Math.round(2**t*1e4)/1e4}function Bm(e,t){let n=zm(t);if(e==null||!(e>0))return n;let r=Math.log2(t/e)*4;return r<-2||r>=3?n:e}function Vm(){let e=null,t=new Set;return{get:()=>e,set(n){n!==e&&(e=n,t.forEach(e=>e()))},subscribe(e){return t.add(e),()=>void t.delete(e)}}}var Hm=(0,X.createContext)(null),Um=()=>()=>{};function Wm(e){let t=(0,X.useContext)(Hm),n=()=>{let n=t?.get();return n==null?null:e(n)},r=(0,X.useSyncExternalStore)(t?t.subscribe:Um,n,n),i=$(t=>r===null?e(zm(t.transform[2])):null);return r??i}function Gm(e){let t={};for(let n of e)(t[n.node_id]??=[]).push(n);for(let e of Object.values(t))e.sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));return t}var Km={width:640,height:190},qm={width:1440,height:640},Jm={"idea-route":vt,"idea-review":m,"idea-selector":gt},Ym={done:`✓`,failed:`✕`,question:`?`,paused:`‖`,running:`▶`,superseded:`↪`},Xm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],question:[`待答复`,`Needs input`],paused:[`已暂停`,`Paused`],aborted:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已替代`,`Superseded`],unknown:[`已记录`,`Recorded`]},Zm=(0,X.memo)(function({data:e}){let{task:t,zh:n,fanIndex:r,fanCount:i}=e,a=De(t),o=t.group,s=o?pe:t.overflow_count?he:Jm[t.team_role??``]??N,c=o?``:H(t.team_outcome,n),l=o?``:ye(t.team_outcome),u=c||(Xm[a]??Xm.unknown)[+!n],d=l===`rejected`?`✕`:l===`chosen`?`★`:Ym[a],f=!o&&typeof r==`number`&&typeof i==`number`,p=o?.expanded?n?`收起`:`Fold`:n?`展开`:`Unfold`;return(0,Y.jsxs)(`button`,{type:`button`,className:`map-branch map-state-${a}${o?` map-branch-group`:``} nodrag nopan`,"data-testid":`map-branch`,"data-branch-id":t.id,"data-status":a,"data-verdict":l||void 0,"data-overflow":!!t.overflow_count,"data-group":!!o,"data-expanded":o?o.expanded:void 0,"aria-expanded":o?o.expanded:void 0,title:t.excerpt||t.objective||t.title,"aria-label":o?`${t.title} · ${p}`:`${t.title} · ${u} · ${n?`打开所属任务`:`Open the owning task`}`,onClick:()=>o?e.toggleGroup?.(t.id):e.open(e.parentCardId),children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(sf,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsx)(`span`,{className:`map-branch-glyph`,"aria-hidden":`true`,children:(0,Y.jsx)(s,{})}),d&&(0,Y.jsx)(`span`,{className:`map-branch-state`,"aria-hidden":`true`,children:d}),(0,Y.jsx)(`span`,{className:`map-branch-title`,children:t.title}),c&&(0,Y.jsx)(`span`,{className:`map-branch-verdict`,"data-testid":`map-branch-verdict`,children:c}),f&&(0,Y.jsx)(`span`,{className:`map-branch-fan`,"data-testid":`map-branch-fan`,title:n?`并行分支 ${r} / ${i}`:`Parallel branch ${r} of ${i}`,children:`${r}/${i}`}),o&&(0,Y.jsxs)(`span`,{className:`map-branch-toggle`,"data-testid":`map-branch-toggle`,"aria-hidden":`true`,children:[p,o.expanded?(0,Y.jsx)(g,{}):(0,Y.jsx)(se,{})]}),(0,Y.jsx)(`span`,{className:`map-branch-dot`,"aria-hidden":`true`})]})}),Qm={x:52,y:125,zoom:.24},$m=.01,eh=3.5,th=(e,t,n)=>Math.max(t,Math.min(n,e));function nh(e,t){let n=e.querySelector(t)?.getBoundingClientRect();return n&&n.width>0&&n.height>0?n:void 0}function rh(e,t=!1){let n=e.getBoundingClientRect(),r=nh(e,`.map-canvas-toolbar`),i=nh(e,`.map-composer-dock`),a=nh(e,`.react-flow__minimap`),o=nh(e,`.map-legend`),s=nh(e,`.react-flow__controls`),c=e.dataset.reading===`true`||t&&e.clientWidth<640,l=e.clientWidth<640?20:50,u=Math.max(r?r.bottom-n.top+20:85,!c&&e.clientWidth<640&&o?o.bottom-n.top+16:0,!c&&e.clientWidth<640&&s?s.bottom-n.top+16:0),d=Math.max(i?n.bottom-i.top+24:100,!c&&a?n.bottom-a.top+20:0);return{x:l,y:u,width:Math.max(180,e.clientWidth-l*2),height:Math.max(100,e.clientHeight-u-d)}}var ih=.72,ah=.85,oh=(e,t)=>e?0:t;function sh(e,t,n){let r=Math.min(t.width/n.width,t.height/n.height),i=Math.min(e.width,e.height)/Math.min(n.width,n.height);return Math.min(Math.max(r,ih*i),ah*i)}function ch(e,t,n,r,i){let a=r||1;if(e.width<640&&i?.stacked&&i.width>0)return t.width/(i.width*a);let o=sh(e,t,n),s=e.width<640||(i?.steps.length??0)>20?.6/a:0,c=e.width>=1024?1/a:0;return Math.max(o,s,c)}function lh(e,t,n){let r=th(Math.min(t.width/(n.width+160),t.height/(n.height+160)),$m,.27),i=(e,t,n,r)=>r>t?(n-r)/2:th((n-r)/2,e,e+t-r);return{x:i(t.x,t.width,e.width,n.width*r)-n.x*r,y:i(t.y,t.height,e.height,n.height*r)-n.y*r,zoom:r}}function uh(e,t,n){let r=Math.min(48,e.height*.35),i=e.height-r,a=Math.min(eh,Math.min(1.05,e.width/n.width,i/n.height)/n.scale);return{x:e.x+e.width/2-(t.x+(n.x+n.width/2)*n.scale)*a,y:e.y+r+i/2-(t.y+(n.y+n.height/2)*n.scale)*a,zoom:a}}function dh(e,t=!0){let n=Nd(),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)({width:0,height:0}),l=(0,X.useRef)(null),u=(0,X.useRef)(!1),d=(0,X.useRef)(!1),f=(0,X.useRef)(!1),p=(0,X.useRef)(),m=(0,X.useRef)(()=>{}),h=(0,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.useRef)(()=>{}),v=(0,X.useRef)(()=>{}),[y,b]=(0,X.useState)(()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),x=(0,X.useRef)(Qm),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null),T=(0,X.useRef)(0),E=(0,X.useRef)(null),D=(0,X.useRef)(0);(0,X.useEffect)(()=>()=>window.clearTimeout(D.current),[]);let[O]=(0,X.useState)(Vm),k=(0,X.useCallback)((e,t)=>{O.get()!==t&&(e.style.setProperty(`--map-zoom-step`,String(t)),O.set(t))},[O]),A=(0,X.useCallback)(()=>{cancelAnimationFrame(T.current),T.current=0,E.current=null},[]),j=(0,X.useCallback)((t,r)=>{t&&(f.current=!1,d.current=!1);let a=e.current;if(!a)return;a.dataset.moving||(a.dataset.moving=`true`),window.clearTimeout(D.current),D.current=window.setTimeout(()=>{delete a.dataset.moving,k(a,zm(n.getZoom()))},180);let s={x:a.clientWidth/2,y:a.clientHeight/2},c=S.current&&S.current.until>performance.now()?S.current:s,p=C.current??(u.current?h.current:null)??K(n.getNodes().filter(e=>e.data.frame),r,c,s),m=p&&(n.getNode(p)?.data)?.frame?.scale||1,g=th((r.zoom-.3)/.14,0,1)*th((r.zoom*m-.28)/.3,0,1),_=w.current,v=u.current?1:_?.id===p?th((r.zoom-_.zoom*.65)/(_.zoom*.35),0,1):g;l.current=v>0?p:null,a.style.setProperty(`--detail-alpha`,String(v)),a.style.setProperty(`--summary-alpha`,String(1-v)),a.style.setProperty(`--context-alpha`,String(p?1-v*.72:1)),a.dataset.zoom=r.zoom.toFixed(2),k(a,Bm(O.get(),r.zoom)),i(v>0&&p?p:null),o(!!p&&v>=.55),r.zoom<=.32&&!C.current&&!E.current&&!w.current&&(x.current=r)},[n,e,k,O]),M=(0,X.useCallback)(t=>{let r=f.current;f.current=!1,A();let i=n.getNode(t),a=e.current;if(!i||!a)return;!r&&n.getZoom()<=.32&&!w.current&&(x.current=n.getViewport()),C.current=t,u.current=!1,delete a.dataset.reading,d.current=!0;let o=rh(a,!0),s=i.width||1440,c=i.height||1080,l=th(ch({width:a.clientWidth,height:a.clientHeight},o,{width:s,height:c},i.data.frame?.scale||1,i.data.layout),$m,eh);w.current={id:t,zoom:l};let p=o.x+Math.max(0,(o.width-s*l)/2)-i.position.x*l,m=o.y+Math.max(0,(o.height-c*l)/2)-i.position.y*l;n.setViewport({x:p,y:m,zoom:l},{duration:oh(y,380)}).then(()=>{C.current=null})},[A,n,y,e]);v.current=M;let N=(0,X.useCallback)(()=>{f.current=!1,A(),C.current=null,u.current=!1,e.current&&delete e.current.dataset.reading,d.current=!1,w.current=null,S.current=null;let t=e.current?.querySelector(`.map-macro[data-focused="true"]`)?.dataset.cardId;n.setViewport(x.current,{duration:oh(y,320)}).then(()=>{t&&e.current?.querySelector(`[data-testid="map-card"][data-card-id="${CSS.escape(t)}"]`)?.focus({preventScroll:!0})})},[A,n,y,e]),P=(0,X.useCallback)((t,r)=>{f.current=!1,A(),C.current=t;let i=n.getNode(t),a=e.current;!i||!a||(u.current=!0,a.dataset.reading=`true`,d.current=!0,h.current=t,g.current={id:t,rect:r},n.setViewport(uh(rh(a),i.position,r),{duration:oh(y,340)}).then(()=>{C.current=null}))},[A,n,y,e]);_.current=P;let F=(0,X.useCallback)(e=>{f.current=!1,A(),u.current=!1,d.current=!1,C.current=null,S.current=null,n.setCenter(e.x,e.y,{zoom:n.getZoom(),duration:oh(y,180)})},[A,n,y]),ee=(0,X.useCallback)(t=>{f.current=!0,p.current=t,A(),C.current=null,u.current=!1,d.current=!1,w.current=null,S.current=null;let r=e.current;r&&delete r.dataset.reading;let i=n.getNodes().filter(e=>!e.hidden&&(!t||t.has(e.data.task.id)));if(!r||!i.length)return;let a=lh({width:r.clientWidth,height:r.clientHeight},rh(r),n.getNodesBounds(i));t||(x.current=a),n.setViewport(a,{duration:oh(y,320)})},[A,n,y,e]);m.current=()=>ee(p.current);let I=(0,X.useCallback)(()=>{f.current?m.current():d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&v.current(l.current)},[]);return(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let n,r=t.querySelector(`.map-composer-dock`),i=-1,a=-1,o=-1,s=new ResizeObserver(()=>{let e=r?.getBoundingClientRect().height||0;(i!==t.clientWidth||a!==t.clientHeight||o!==e)&&(i=t.clientWidth,a=t.clientHeight,o=e,t.style.setProperty(`--map-composer-height`,`${o}px`),c(e=>e.width===i&&e.height===a?e:{width:i,height:a}),clearTimeout(n),n=setTimeout(()=>{d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&!u.current?v.current(l.current):f.current&&m.current()},100))});return s.observe(t),r&&s.observe(r),()=>{s.disconnect(),clearTimeout(n)}},[e,t]),(0,X.useEffect)(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let r=e=>{if(e.target.closest(`.nowheel, .map-canvas-toolbar, .map-legend, .react-flow__minimap, .react-flow__controls`))return;e.preventDefault(),e.stopPropagation(),f.current=!1,u.current=!1,d.current=!0,C.current=null;let r=t.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top;S.current={x:i,y:a,until:performance.now()+1e3};let o=E.current??n.getViewport();!E.current&&o.zoom<=.32&&!w.current&&(x.current=o);let s=e.deltaY*(e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1),c=th(o.zoom*Math.exp(-th(s,-400,400)*.002),$m,eh);if(E.current={x:i-(i-o.x)*c/o.zoom,y:a-(a-o.y)*c/o.zoom,zoom:c},y){n.setViewport(E.current),E.current=null;return}if(T.current)return;let l=performance.now(),p=e=>{if(!E.current)return;let t=1-Math.exp(-Math.min(e-l,64)/55);l=e;let r=n.getViewport(),i=E.current,a=Math.abs(i.zoom-r.zoom)<15e-5&&Math.abs(i.x-r.x)+Math.abs(i.y-r.y)<.15;n.setViewport(a?i:{x:r.x+(i.x-r.x)*t,y:r.y+(i.y-r.y)*t,zoom:r.zoom+(i.zoom-r.zoom)*t}),a?(T.current=0,E.current=null):T.current=requestAnimationFrame(p)};T.current=requestAnimationFrame(p)},i=()=>{A(),C.current=null,S.current=null},a=e=>{e.defaultPrevented||document.querySelector(`[role="dialog"][aria-modal="true"]`)||e.key===`Escape`&&![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&N()};return t.addEventListener(`wheel`,r,{passive:!1,capture:!0}),t.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a),()=>{A(),t.removeEventListener(`wheel`,r,!0),t.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a)}},[N,A,n,y,e]),{capture:(0,X.useCallback)(()=>({viewport:n.getViewport(),overview:x.current,focusId:l.current,detailed:!!l.current&&(u.current||!!w.current||n.getZoom()>=.44)}),[n]),restore:(0,X.useCallback)(e=>{A(),x.current=e.overview;let t=e.focusId&&n.getNode(e.focusId)?e.focusId:null;C.current=e.detailed?t:null,w.current=e.detailed&&t?{id:t,zoom:e.viewport.zoom}:null,d.current=!1,f.current=!1,n.setViewport(e.viewport,{duration:0}),j(null,e.viewport)},[A,n,j]),focusId:r,canvasSize:s,detailed:a,enter:M,back:N,fit:ee,fitUpdatedScene:I,navigate:F,readStep:P,onMove:j,reducedMotion:y,zoomSteps:O}}function fh(e,t,n,r=n){if(!n||!r)return[];let i=e.tasks.find(e=>e.id===n);if(!i||i.turn_kind===`qa`)return[];if(r===n)return[St(i,xt(e,i,i.started_ts??0))];let a=new Map(e.events.map(e=>[e.id,e.item_id]));return q(e,t,n).filter(e=>e.task_id===n&&e.key===r&&e.event_ids.every(e=>!a.get(e)||a.get(e)===n))}function ph(e,t){let n=new Map(e.events.map(e=>[e.id,e]));return JSON.stringify(t.map(t=>{let r=e.tasks.find(e=>e.id===t.task_id),i=[t.task_id,`${t.task_id}:active`,`${t.task_id}:outcome`].includes(t.key);return[t,Ct(!r||i?r:{...r,status:``,summary:void 0,outcome:void 0,pending_question:void 0,started_ts:void 0,finished_ts:void 0,attempt:void 0},t.event_ids.flatMap(e=>n.get(e)?[n.get(e)]:[]))]}))}function mh(e,t,n,r=600){let i=e=>[`done`,`failed`,`cancelled`,`recorded`,`skipped`].includes(e||``),a=e.tasks.filter(e=>e.id!==n&&e.turn_kind!==`qa`),o=[...a.filter(e=>i(e.status)),...a.filter(e=>!i(e.status))],s=[];for(let n of o){if(s.length>=r)break;s.push(...U(e,n,fe(n,e.events,t)))}return s.slice(0,r)}function hh(e,t,n,r=!0,a,l,f=!1,p=t,m){let h=n?`zh-CN`:`en-US`,g=e.kind===`live`?`project`:`dataset`,_=e.id.replace(/^live:/,``),v=d(),y=et(l??_,h),b=v===`question-foundation`?m===void 0?y.id:m:null,x=v===`question-foundation`&&!b,S=u(g,_,h,l,v,b),C=o(),w=i({queryKey:S,queryFn:async({signal:e})=>{let t=v===`question-foundation`?await c.mapCopy(g,_,h,e,l,v,b):await c.mapCopy(g,_,h,e,l,v),n=C.getQueryData(S);return st(n,t,n?.model_revision)},staleTime:1/0,gcTime:72e5,refetchOnWindowFocus:!1}),T=e.tasks.find(e=>e.id===t),E=Pe(S,p,tt(p,T)),D=(0,X.useMemo)(()=>a??(T?fe(T,e.events,n):[]),[T,e.events,n,a]),[O,k]=(0,X.useState)(0),[A,j]=(0,X.useState)(!1),M=(0,X.useRef)(!0),N=(0,X.useRef)(null),P=(0,X.useMemo)(()=>new Map(e.events.map(e=>[e.id,e])),[e.events]),F=f?q(e,D,t):fh(e,D,t,p),ee=(0,X.useMemo)(()=>f?mh(e,n,t):[],[e,n,t,f]),I=[...F,...ee].filter(t=>e.tasks.find(e=>e.id===t.task_id)?.turn_kind!==`qa`).filter(t=>Se(t,e,w.data,P)).slice(0,8),L=ph(e,I),R=[`map-copy-generation`,g,_,h,l],z=[...R,v,...v===`question-foundation`?[b]:[],w.data?.version??null,w.data?.model_revision??null,L],B=JSON.stringify(z),V=s({queryKey:R}),H={queryKey:z,queryFn:async()=>{let t=w.data?.model_revision,n=Ze(C,S,I.map(t=>({key:t.key,startedAt:tt(t.key,e.tasks.find(e=>e.id===t.task_id))}))),r;try{r=await c.generateMapCopy(g,_,{cards:I,locale:h,...b?{foundation_id:b}:{}},void 0,l,v,n.update)}finally{n.finish()}return C.setQueryData(S,e=>st(e,r,t)),{available:!r.retry_after&&r.available!==!1&&I.every(t=>!Se(t,e,r,P)),retryAfter:typeof r.retry_after==`number`&&r.retry_after>0?r.retry_after:null}},staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1},U=i({...H,enabled:!1}),W=U.isSuccess&&U.data.available===!1?U.data.retryAfter:null,te=(0,X.useMemo)(()=>w.data?.generation_error?Error(w.data.generation_error.message):null,[w.data?.generation_error?.code,w.data?.generation_error?.message]),G=()=>{let e=C.fetchQuery({...H,staleTime:0});return N.current=e,j(!0),e.then(()=>void 0,()=>void 0).finally(()=>{N.current===e&&(N.current=null,M.current&&(j(!1),k(e=>e+1)))}),e};(0,X.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]),(0,X.useEffect)(()=>{if(!r||x||!w.data?.available||!I.length||U.isError||U.isSuccess&&!W||V>0||N.current)return;let e=w.data.generation_error&&typeof w.data.retry_after==`number`&&w.data.retry_after>0?w.data.retry_after:0,t=Math.max(W?U.dataUpdatedAt+W*1e3:0,e?w.dataUpdatedAt+e*1e3:0),n=setTimeout(()=>{C.isFetching({queryKey:R})===0&&G()},Math.max(700,t-Date.now()));return()=>clearTimeout(n)},[B,O,w.data?.available,w.data?.retry_after,w.dataUpdatedAt,r,x,V,U.status,U.dataUpdatedAt]);let ne=A||U.isFetching||V>0;return{copy:w.data,generating:ne,ready:w.isFetched,foundationRequired:x,questionContext:{locale:h,preview:v,foundationId:b},readingGenerating:E.active,generationPhase:E.phase,generationError:I.length&&!U.isFetching&&!E.active?U.error||te:null,generationUnavailable:!!I.length&&!U.isFetching&&!E.active&&!W&&U.data?.available===!1,retry:async()=>{!r||x||!w.data?.available||!I.length||ne||N.current||await G().catch(()=>void 0)},readingRequest:F.find(e=>e.key===p),readingNeedsUpdate:U.data?.available!==!0&&I.some(e=>e.key===p)}}var gh=new Set([`done`,`failed`,`cancelled`,`recorded`,`skipped`,`aborted`,`superseded`]);function _h(e,t,n,r,a){let o=n?`zh-CN`:`en-US`,s=e.kind===`live`?`project`:`dataset`,l=e.id.replace(/^live:/,``),u=(0,X.useMemo)(()=>{let n=new Map(e.tasks.map(e=>[e.id,gh.has(e.status||``)])),r=t.filter(e=>n.has(e.source)&&n.has(e.target)).slice(0,48);return JSON.stringify(r.map(e=>[e.source,e.target,n.get(e.source),n.get(e.target)]))},[e.tasks,t]),d=(0,X.useMemo)(()=>JSON.parse(u).map(([e,t])=>({source:e,target:t})),[u]),f=[`map-lines`,s,l,o,a,u],p=i({queryKey:[...f,`saved`],queryFn:({signal:e})=>c.mapLines(s,l,{pairs:d,locale:o,write:!1},e,a),enabled:d.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...f,`written`],queryFn:({signal:e})=>c.mapLines(s,l,{pairs:d,locale:o,write:!0},e,a),enabled:d.length>0&&r&&p.data?.available===!0&&p.data.lines.lengthJSON.stringify(e.tasks.filter(e=>e.kind!==`turn`&&e.turn_kind!==`qa`).slice(-40).map(e=>[e.id,yh.has(e.status||``)])),[e.tasks]),u=(0,X.useMemo)(()=>JSON.parse(l).map(([e])=>e),[l]),d=[`map-card-words`,o,s,a,r,l],f=i({queryKey:[...d,`saved`],queryFn:({signal:e})=>c.mapCardWords(o,s,{tasks:u,locale:a,write:!1},e,r),enabled:u.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...d,`written`],queryFn:({signal:e})=>c.mapCardWords(o,s,{tasks:u,locale:a,write:!0},e,r),enabled:u.length>0&&n&&f.data?.available===!0&&Object.keys(f.data.cards).length`u`||typeof window.matchMedia!=`function`?!1:window.innerWidth>=1024&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function Ch({footer:e,value:t,onChange:n,onSend:r,attachments:i,onAttachmentsChange:a,pending:o,pendingLabel:s,progressVisible:c=!0,dispatchStatus:u,onCancel:d,focusSignal:p,sessionName:m,historical:h,zh:v,routeOverride:b=`auto`,onRouteOverrideChange:x}){let{t:S}=l(),C=(0,X.useId)(),w=(0,X.useRef)(null),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(!1),O=(0,X.useRef)(!0),k=(0,X.useRef)(),[A,j]=(0,X.useState)(``),[M,N]=(0,X.useState)(!1),[P,F]=(0,X.useState)(!1),[ee,I]=(0,X.useState)(()=>!!(t.trim()||i.length)||Sh()),[L,z]=(0,X.useState)(44),B=(0,X.useRef)(t);B.current=t;let H=!ee,{refs:U,text:W}=Ke(t),te=t.length>at,G=!!(t.trim()||i.length),ie=(0,X.useRef)(G);ie.current=G,(0,X.useEffect)(()=>{u===`error`&&I(!0)},[u]),(0,X.useEffect)(()=>{O.current=!0;let e=e=>{let t=e.type===`focusout`?e.relatedTarget:e.target;t?.closest?.(`.map-island-launch, .map-island-stop, .map-composer-brand`)||(T.current?.contains(t)?I(!0):ie.current||I(!1))},t=e=>{let t=e.target;T.current?.contains(t)||t?.closest?.(`.map-context-menu`)||ie.current||(I(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur())},n=e=>{if(e.key!==`c`||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||e.isComposing)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)||t?.closest?.(`[role="dialog"], [role="menu"]`)||(e.preventDefault(),I(!0),w.current?.focus())};return document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e),document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{O.current=!1,clearTimeout(k.current),document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[]);let ae=(0,X.useRef)(p);(0,X.useEffect)(()=>{p!==ae.current&&(ae.current=p,I(!0),w.current?.focus())},[p]);let oe=(0,X.useRef)(U.length);(0,X.useEffect)(()=>{U.length>oe.current&&(I(!0),w.current?.focus()),oe.current=U.length},[U.length]);let K=()=>{if(!w.current)return;w.current.style.height=`0px`;let e=Math.min(156,Math.max(44,w.current.scrollHeight));w.current.style.height=`${e}px`,z(e)};(0,X.useEffect)(K,[W]),(0,X.useEffect)(()=>(window.addEventListener(`resize`,K),()=>window.removeEventListener(`resize`,K)),[]);let se=()=>{I(!0),w.current?.focus()},ce=()=>{I(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur()},le=(0,X.useRef)(),ue=(0,X.useRef)(typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches);(0,X.useEffect)(()=>()=>clearTimeout(le.current),[]);let fe=()=>{ue.current&&(clearTimeout(le.current),I(!0))},pe=()=>{ue.current&&(clearTimeout(le.current),le.current=setTimeout(()=>{ie.current||T.current?.contains(document.activeElement)||I(!1)},320))};(0,X.useEffect)(()=>{o||F(!1)},[o]);let me=async()=>{if(!W.trim()||D.current||te)return;let e=o;if(e&&i.length){j(v?`附件要等这条回复结束后再发送`:`Attachments can be sent once this reply finishes`);return}D.current=!0;try{(e?await r(t,[],void 0,{whileRunning:!0}):await r(t,i))&&O.current&&(j(``),N(!0),F(e),(!B.current.trim()||B.current===t)&&ce(),clearTimeout(k.current),k.current=setTimeout(()=>N(!1),1800))}finally{D.current=!1}},he=e=>{if(o||D.current||!e.length)return;let{accepted:t,issues:n}=lt(i,e);a([...i,...t]),j(n.map(e=>e.code===`unsupported`?S(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?S(`chat.attachTooLarge`,{name:e.fileName,size:R(e.limitBytes)}):e.code===`too-many`?S(`chat.attachTooMany`,{count:e.limitCount}):S(`chat.attachTotalTooLarge`,{size:R(e.limitBytes)})).join(` `))},q=u?{launching:[v?`任务已接收`:`Task accepted`,v?`正在放入地图…`:`Adding it to your map…`],task:[v?`任务已进入地图`:`Your task is on the map`,v?`跟随地图,查看执行进展`:`Follow its progress on the map`],message:[v?`${f().name} 已回复`:`${f().name} replied`,v?`在对话中查看回复`:`Open the conversation to read it`],error:[v?`发送没有成功`:`Message could not be sent`,v?`草稿已保留,可以重试`:`Your draft is ready to retry`],cancelled:[v?`正在停止回复`:`Stopping reply`,v?`可以发送新消息`:`You can send another message`]}[u]:void 0,ge=[v?`已排队`:`Queued`,v?`这条回复结束后立即处理`:`Answered right after this reply`],_e=q?.[0]||(o&&P?ge[0]:o?c?v?`${f().name} 正在处理`:`${f().name} is working`:v?`继续对话`:`Continue chatting`:M?v?`已发送给 ${f().name}`:`Sent to ${f().name}`:v?`交给 ${f().name}`:`Ask ${f().name}`),ve=q?.[1]||(o&&P?ge[1]:o?c?s||(v?`正在处理你的消息…`:`Processing your message…`):v?`可发送后续消息或停止回复`:`Send a follow-up or stop the reply`:M?v?`点此继续对话`:`Tap to keep the conversation going`:G?v?`草稿已保留,点此继续`:`Draft saved — tap to continue`:v?`描述目标,看它变成成果`:`Turn your next idea into a result`),ye=u||(o?`working`:M?`sent`:`idle`);return(0,Y.jsxs)(`div`,{ref:T,className:`map-composer-dock map-island-dock`,"data-compact":H,"data-state":ye,"data-pending":o,style:{"--map-editor-height":`${L}px`},onPointerEnter:fe,onPointerLeave:pe,onTransitionEnd:e=>{e.target===T.current&&e.propertyName===`width`&&K()},children:[!H&&U.length>0&&(0,Y.jsx)(`div`,{className:`map-reference-chips`,children:U.map((e,t)=>(0,Y.jsxs)(`span`,{title:`${e.source} · ${e.task_id} ${e.step_id||``}`,children:[(0,Y.jsxs)(`span`,{children:[v?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,Y.jsx)(`button`,{"aria-label":v?`移除引用`:`Remove reference`,onClick:()=>n(U.filter((e,n)=>t!==n).map(ne).join(``)+W),children:(0,Y.jsx)(y,{size:12})})]},`${e.task_id}:${e.step_id}:${t}`))}),!H&&!!i.length&&(0,Y.jsx)(`div`,{className:`map-attachment-tray nowheel`,role:`group`,"aria-label":v?`待发送附件`:`Selected attachments`,children:i.map((e,t)=>(0,Y.jsx)(Ve,{file:e,disabled:o,removeLabel:S(`chat.attachRemove`,{name:e.name}),onRemove:()=>{a(i.filter(t=>t!==e)),j(``)}},`${e.name}:${e.lastModified}:${t}`))}),!H&&A&&(0,Y.jsx)(`div`,{className:`map-attachment-notice nowheel`,role:`alert`,children:A}),(0,Y.jsxs)(`div`,{className:`map-composer map-island-surface`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":S(`chat.attach`),title:S(`chat.attach`),"aria-hidden":H,tabIndex:H?-1:0,disabled:o&&!H,onClick:()=>E.current?.click(),children:(0,Y.jsx)(V,{size:25})}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-island-launch`,"aria-label":v?`打开消息输入`:`Open message composer`,"aria-expanded":!H,"aria-controls":C,"aria-hidden":!H,tabIndex:H?0:-1,onClick:se,children:[(0,Y.jsxs)(`span`,{className:`map-island-copy`,children:[(0,Y.jsx)(`strong`,{children:_e}),(0,Y.jsx)(`small`,{title:ve,children:ve})]}),(0,Y.jsx)(`span`,{className:`map-island-indicator`,"aria-hidden":`true`,children:ye===`working`||ye===`launching`?(0,Y.jsxs)(`span`,{className:`map-island-wave`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}):ye===`sent`||ye===`task`||ye===`message`?(0,Y.jsx)(_,{size:16}):(0,Y.jsx)(mt,{size:15})})]}),H&&o&&(0,Y.jsx)(`button`,{type:`button`,className:`map-island-stop`,onClick:d,"aria-label":v?`停止回复`:`Stop reply`,children:(0,Y.jsx)(re,{size:13})}),(0,Y.jsxs)(`form`,{id:C,className:`map-composer-editor`,"aria-hidden":H,onSubmit:e=>{e.preventDefault(),me()},children:[(0,Y.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:Ae,hidden:!0,disabled:o,onChange:e=>{he(Array.from(e.target.files||[])),e.target.value=``}}),(0,Y.jsx)(`textarea`,{ref:w,rows:1,tabIndex:H?-1:0,value:W,"aria-label":v?`给 ${f().name} 发送消息`:`Message ${f().name}`,placeholder:v?`告诉 ${f().name},你想完成什么…`:`What would you like ${f().name} to do?`,onFocus:()=>I(!0),onChange:e=>{N(!1),n(U.map(ne).join(``)+e.target.value)},onPaste:e=>{let t=Me(e.clipboardData);t.length&&(e.preventDefault(),he(t))},onKeyDown:e=>{e.key===`Escape`&&!ct(e)&&!W.trim()&&!i.length&&(e.preventDefault(),e.stopPropagation(),ce()),e.key===`Enter`&&!e.shiftKey&&!ct(e)&&(e.preventDefault(),me())}}),(0,Y.jsxs)(`div`,{className:`map-island-toolbar`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-island-collapse`,tabIndex:H?-1:0,onClick:ce,"aria-label":v?`收起消息输入`:`Collapse message composer`,title:v?`收起(草稿会保留)`:`Collapse (draft is kept)`,children:(0,Y.jsx)(g,{size:15})}),x&&(0,Y.jsx)(Ue,{value:b,onChange:x,disabled:o,tabIndex:H?-1:0}),o&&(0,Y.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),d()},tabIndex:H?-1:0,"aria-label":v?`停止回复`:`Stop reply`,className:`map-send is-pending`,children:(0,Y.jsx)(re,{size:15})},`stop`),(0,Y.jsx)(`button`,{type:`submit`,tabIndex:H?-1:0,disabled:!W.trim()||te,"aria-label":o?v?`在 ${f().name} 工作时发送`:`Send while ${f().name} works`:v?`发送消息`:`Send message`,title:o?v?`排队到这条回复之后处理`:`Queued right after this reply`:void 0,className:`map-send`,children:(0,Y.jsx)(de,{size:20})},`send`)]})]})]}),te&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1 px-3 text-xs text-err`,children:S(`chat.messageTooLong`)}),e,(0,Y.jsx)(`span`,{className:`map-composer-caption`,role:`status`,children:q?`${q[0]} · ${q[1]}`:o&&P?`${ge[0]} · ${ge[1]}`:o?``:M?v?`已发送`:`Sent`:h?`${v?`发送至`:`Send to`} ${m}`:``})]})}function wh(e,t,n){if(e.length<2)return``;let r=[0];for(let t=1;t0))return``;let a=Math.min(n,i/3),o=a*1.22,s=1,c=t=>{let n=Math.max(0,Math.min(i,t));for(;s1&&r[s-1]>n;)s--;let a=r[s]-r[s-1]||1,o=(n-r[s-1])/a,c=e[s-1],l=e[s];return{x:c.x+(l.x-c.x)*o,y:c.y+(l.y-c.y)*o}},l=e=>e*e*(3-2*e),u=e=>{let n=i-e;if(n<=a)return t*2.5*(n/a)**.85;let r=t*(.34+.66*l(Math.min(1,e/Math.max(1,i-o))));return n>=o?r:r+(t*2.5-r)*l((o-n)/(o-a))},d=Math.max(12,Math.min(72,Math.round(i/Math.max(a,1)*1.5))),f=Array.from({length:d+1},(e,t)=>(i-o)*(t/d));f.push(i-(o+a)/2,i-a,i);let p=[],m=[],h=e=>Math.round(e*100)/100;for(let e of f){let t=c(e),n=c(e-i*.004-.5),r=c(e+i*.004+.5),a=r.x-n.x,o=r.y-n.y,s=Math.hypot(a,o)||1,l=u(e)/2,d=-o/s*l,f=a/s*l;p.push(`${h(t.x+d)} ${h(t.y+f)}`),m.push(`${h(t.x-d)} ${h(t.y-f)}`)}return`M ${p.join(` L `)} L ${m.reverse().join(` L `)} Z`}function Th(e,t){let n=1-t;return{x:n**3*e[0].x+3*n**2*t*e[1].x+3*n*t**2*e[2].x+t**3*e[3].x,y:n**3*e[0].y+3*n**2*t*e[1].y+3*n*t**2*e[2].y+t**3*e[3].y}}function Eh(e,t,n=!1){if(!e.length)return null;let r=n?[...e].reverse():e,i=0;for(let e=1;e0&&i+n>=t){let a=(t-i)/n;return{x:r[e-1].x+(r[e].x-r[e-1].x)*a,y:r[e-1].y+(r[e].y-r[e-1].y)*a}}i+=n}return r[r.length-1]}function Dh(e,t,n=0){return e.x>t.x-n&&e.xt.y-n&&e.y({x:n===`left`?-e.x:e.x,y:n===`up`?-e.y:e.y}),s=o(e),c=o(t);i=i.map(e=>({...e,x:n===`left`?-e.x-e.width:e.x,y:n===`up`?-e.y-e.height:e.y}));let l=Math.max(80,n===`loop`?Math.max(Math.abs(c.x-s.x),Math.abs(c.y-s.y))*2.8:0,Math.abs(a?c.y-s.y:c.x-s.x)*(.4+r*.06)),u=[s,a?{x:s.x+0,y:s.y+l}:{x:s.x+l,y:s.y},n===`loop`?{x:c.x,y:c.y+l}:a?{x:c.x-0,y:c.y-l}:{x:c.x-l,y:c.y},c],d=e=>e.flatMap(e=>Array.from({length:31},(t,n)=>Th(e,n/30))),f=e=>d(e).reduce((e,t)=>e+i.filter(e=>Dh(t,e,22)).length,0),p=[u],m=f(p)*1e5;if(m){let e={x:(s.x+c.x)/2,y:(s.y+c.y)/2},t=a?e.x:e.y,n=[...new Set(i.flatMap(e=>a?[e.x-110-r*30,e.x+e.width+110+r*30]:[e.y-110-r*30,e.y+e.height+110+r*30]))].sort((e,n)=>Math.abs(e-t)-Math.abs(n-t)).slice(0,12);for(let e of n){let n=(e-t)*4/3;for(let r of[.25,.4,.55]){let i=Math.max(60,Math.abs(a?c.y-s.y:c.x-s.x)*r),o=[a?[s,{x:s.x+n,y:s.y+i},{x:c.x+n,y:c.y-i},c]:[s,{x:s.x+i,y:s.y+n},{x:c.x-i,y:c.y+n},c]],l=f(o)*1e5+Math.abs(e-t)+Math.abs(r-.4)*100;le.map(o)),{path:`M ${e.x} ${e.y}`+p.map(e=>` C ${e[1].x} ${e[1].y}, ${e[2].x} ${e[2].y}, ${e[3].x} ${e[3].y}`).join(``),points:d(p),labels:[.5,.4,.6,.3,.7,.2,.8,.35,.45,.55,.65,.25,.75,.15,.85].map(e=>{let t=Math.min(p.length-1,Math.floor(e*p.length));return Th(p[t],e*p.length-t)})}}var kh=new WeakMap,Ah=.5,jh=.05;function Mh(e){return e>=Ah?Math.max(Ah,Math.floor(e*8)/8):ee+(/[^\x00-\x7F]/.test(t)?10.5:7),20);return{width:Math.min(t,216),height:26}}function Fh(e,t){let n=e.getState(),r=[...n.nodeLookup.values()].filter(e=>!e.hidden).map(e=>({id:e.id,...e.internals.positionAbsolute,width:e.width||e.measured.width||0,height:e.height||e.measured.height||0}));function i(e,t){let r=n.nodeLookup.get(e);if(!r)return null;let{x:i,y:a}=r.internals.positionAbsolute,o=r.width||r.measured.width||0,s=r.height||r.measured.height||0;return{x:i+(t===`left`?0:t===`right`?o:o/2),y:a+(t===`top`?0:t===`bottom`?s:s/2)}}let a=n.edges.filter(e=>!e.hidden).map(e=>({...e,s:i(e.source,e.sourceHandle),t:i(e.target,e.targetHandle)})),o=JSON.stringify([r,a.map(e=>[e.id,e.s,e.t,e.label,e.data?.lane,e.sourceHandle,e.targetHandle,e.className])]),s=kh.get(e);if(!s||s.key!==o){let t=new Map,n=new Map;for(let e of a)n.set(e.id,/(?:^|\s)map-edge-(\w+)/.exec(e.className??``)?.[1]),e.s&&e.t&&t.set(e.id,Oh(e.s,e.t,e.source===e.target?`loop`:e.sourceHandle===`left`?`left`:e.sourceHandle===`top`?`up`:e.sourceHandle===`bottom`,Number(e.data?.lane||0),r.filter(t=>t.id!==e.source&&t.id!==e.target)));s={key:o,routes:t,kinds:n,zoom:-1,labels:new Map},kh.set(e,s)}let c=Mh(t);return s.zoom!==c&&(s.zoom=c,s.labels=new Map,c&&Ih(s,a,r,c)),s}function Ih(e,t,n,r){let i=[...n],a=e=>+!!e.data?.quiet;for(let n of[...t].sort((e,t)=>a(e)-a(t))){let t=e.routes.get(n.id);if(!t||!n.label)continue;let a=Ph(n.label),o=a.width/r,s=a.height/r,c=[0,3,4,5,6][Number(n.data?.lane||0)%5],l=[t.labels[c],...t.labels.filter((e,t)=>t!==c)].filter(e=>i.every(t=>e.x+o/2<=t.x||e.x-o/2>=t.x+t.width||e.y+s/2<=t.y||e.y-s/2>=t.y+t.height)),u,d=1/0;for(let t of l){let r={x:t.x-o/2,y:t.y-s/2,width:o,height:s},i=0;for(let[t,a]of e.routes)t!==n.id&&a.points.some(e=>Dh(e,r))&&i++;if(ie),a=(0,X.useId)().replace(/:/g,``),o=`relation-arrow-${a}`,s=`relation-flow-${a}`,c=Fh(Fu(),i),l=c.routes.get(e),u=c.labels.get(e);if(!l)return null;let d=c.kinds.get(e),f=d===`fanout`||d===`fanin`,p=!d||n?.stroke===Lh?n?.stroke||`#7594ad`:`var(--map-edge-${d}, ${n?.stroke||`#7594ad`})`,m=(Number(n?.strokeWidth||2)+(f?.4:0))/i,h=f?Eh(l.points,(d===`fanout`?2:15)/i,d===`fanin`):null,g=typeof t==`string`?Nh(t):void 0,_=l.points[0],v=l.points[l.points.length-1],y=!!_&&!!v&&n?.stroke!==Lh&&(Math.abs(_.x-v.x)>1||Math.abs(_.y-v.y)>1),b=!f&&!n?.strokeDasharray,x=b?wh(l.points,Number(n?.strokeWidth||2)*1.45/i,16/i):``;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`defs`,{children:[(0,Y.jsx)(`marker`,{id:o,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:9/i,markerHeight:9/i,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,style:{fill:p}})}),y&&(0,Y.jsxs)(`linearGradient`,{id:s,gradientUnits:`userSpaceOnUse`,x1:_.x,y1:_.y,x2:v.x,y2:v.y,children:[(0,Y.jsx)(`stop`,{offset:`0`,style:{stopColor:p,stopOpacity:b?.34:.28}}),(0,Y.jsx)(`stop`,{offset:`0.55`,style:{stopColor:p,stopOpacity:b?.7:.78}}),(0,Y.jsx)(`stop`,{offset:`1`,style:{stopColor:p,stopOpacity:1}})]})]}),(0,Y.jsxs)(Em,{path:l.path,delay:r?.growthDelay,padding:24/i,children:[(0,Y.jsx)(Vf,{id:e,path:l.path,markerEnd:x?void 0:`url(#${o})`,style:{...n,stroke:x?`transparent`:y?`url(#${s})`:p,strokeLinecap:`round`,vectorEffect:`none`,strokeWidth:m,strokeDasharray:n?.strokeDasharray?String(n.strokeDasharray).split(/[\s,]+/).map(e=>Number(e)/i).join(` `):void 0}}),x&&(0,Y.jsx)(`path`,{className:`map-edge-ink`,d:x,style:{fill:y?`url(#${s})`:p,opacity:n?.opacity},"aria-hidden":`true`}),!f&&_&&(0,Y.jsx)(`circle`,{className:`map-edge-anchor`,cx:_.x,cy:_.y,r:(x?2.1:2.6)/i,style:x?{fill:p,opacity:Number(n?.opacity??1)*.62}:{fill:`var(--map-paper)`,stroke:p,strokeWidth:1.4/i,opacity:n?.opacity},"aria-hidden":`true`}),h&&(0,Y.jsx)(`circle`,{className:`map-edge-joint`,cx:h.x,cy:h.y,r:3.2/i,style:{fill:p,opacity:n?.opacity},"aria-hidden":`true`})]}),(r?.active&&!r.muted||r?.lit)&&(0,Y.jsx)(Hp,{children:(0,Y.jsx)(`div`,{className:`map-edge-spark`,"data-lit":!r?.active&&!!r?.lit,"aria-hidden":`true`,style:{offsetPath:`path("${l.path}")`,width:8/i,height:8/i,margin:`${-4/i}px 0 0 ${-4/i}px`,animationDelay:`${-((e.charCodeAt(0)*131+e.length*47)%2800)}ms`}})}),t&&g!==``&&u&&(0,Y.jsx)(Hp,{children:(0,Y.jsx)(`div`,{className:`map-relation-label nodrag nopan`,"data-kind":d,"data-lit":!!r?.lit,"data-quiet":!!r?.quiet,title:g,style:{opacity:r?.quiet&&!r.lit?0:n?.opacity,pointerEvents:r?.quiet&&!r.lit?`none`:void 0,transform:`translate(-50%, -50%) translate(${u.x}px, ${u.y}px) scale(${1/i})`},children:g??t})})]})}function zh({open:e,info:t,zh:n,onChoose:r,readOnly:i=!1}){return(0,Y.jsx)(E,{open:e,onClose:()=>r({mode:`off`}),label:n?`选择地图加载范围`:`Choose map history`,width:`max-w-lg`,children:(0,Y.jsxs)(`div`,{className:`map-history-choice`,children:[(0,Y.jsx)(`h2`,{children:n?`选择地图加载范围`:`Choose map history`}),(0,Y.jsx)(`p`,{children:n?`本会话有 ${t.task_count} 个任务,历史记录约 ${(t.event_bytes/1024/1024).toFixed(1)} MB。`:`This session has ${t.task_count} tasks and about ${(t.event_bytes/1024/1024).toFixed(1)} MB of history.`}),(0,Y.jsx)(`p`,{children:i?n?`只读模式只加载历史记录,不调用模型。较长历史需要一些加载时间。`:`Read-only mode loads records without model calls. Long histories take time to load.`:n?`加载较长历史需要一些时间。生成卡片摘要与关系说明会调用已配置的模型,并消耗额外 Token。已有摘要会优先复用。`:`Loading a long history takes time. Card summaries and relationship descriptions use your configured model and consume additional tokens. Existing summaries are reused.`}),(0,Y.jsxs)(`div`,{className:`map-history-options`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`current`,since:t.current_task_ts,eventSince:t.current_event_ts,taskId:t.current_task_id||void 0}),children:[(0,Y.jsx)(`strong`,{children:n?`从当前进度加载`:`Start at current progress`}),(0,Y.jsx)(`span`,{children:n?`推荐 · 加载当前任务及后续进度,保留相关连接`:`Recommended · Load current and future work with its connections`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`full`}),children:[(0,Y.jsx)(`strong`,{children:n?`从头加载`:`Load from the beginning`}),(0,Y.jsx)(`span`,{children:i?n?`分批加载历史记录,查看已有说明`:`Load history in pages and view existing explanations`:n?`分批加载历史记录;打开卡片阅读时,再整理它的说明`:`Load history in pages; prepare an explanation when you open a card to read`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`off`}),children:[(0,Y.jsx)(`strong`,{children:n?`不开启地图模式`:`Keep map mode off`}),(0,Y.jsx)(`span`,{children:n?`不加载地图,也不生成摘要`:`Do not load the map or generate summaries`})]})]}),(0,Y.jsx)(`small`,{children:n?`选择仅用于本会话,可随时更改加载范围。`:`This choice applies to this session and can be changed later.`})]})})}function Bh(e){try{let t=JSON.parse(e||`null`);return!t||![`full`,`current`,`off`].includes(t.mode)||t.mode===`current`&&![t.since,t.eventSince].every(e=>typeof e==`number`&&Number.isFinite(e)&&e>=0)?null:t}catch{return null}}function Vh(e,t){if(!e||e.id!==t.id||t.reset_history)return t;let n=new Map((!t.incremental||t.tasks_complete?[]:e.tasks).map(e=>[e.id,e]));for(let e of t.tasks)n.set(e.id,e);for(let e of t.removed_task_ids||[])n.delete(e);let r=new Map(e.events.filter(e=>t.incremental&&!t.team_events_complete||e.type!==`team.task`).map(e=>[e.id,e]));for(let e of t.events)r.set(e.id,e);for(let e of t.removed_event_ids||[])r.delete(e);return a(e,{...e,...t,tasks:[...n.values()].sort((e,t)=>(e.ts||0)-(t.ts||0)||e.id.localeCompare(t.id)),events:[...r.values()].filter(e=>n.has(e.item_id))})}function Hh(e,t,n){return e?t?.history_loading?400:!Uh(n)||t?.events.some(e=>e.type===`team.task`&&Te.has(e.status||``))?15e3:!1:!1}function Uh(e){return e.manager_requests?.some(e=>e.status===`running`)?!1:!e.daemon.alive||e.continuous?.enabled===!1&&/pause|stop/i.test(e.continuous.done_reason||``)?!0:e.daemon.health?.state===`stopped`}var Wh=new Map;function Gh(e){let t=Wh.get(e);if(t)return t;try{let t=JSON.parse(B(`argus.map.camera.v1:`+e)||`null`);if(t&&[t.viewport,t.overview].every(e=>e&&[e.x,e.y,e.zoom].every(Number.isFinite)&&e.zoom>=.035&&e.zoom<=3.5)&&(t.focusId===null||typeof t.focusId==`string`)&&typeof t.detailed==`boolean`)return{camera:t}}catch{}return{}}function Kh(e,t){for(Wh.delete(e),Wh.set(e,t);Wh.size>8;)Wh.delete(Wh.keys().next().value);t.camera&&z(`argus.map.camera.v1:`+e,JSON.stringify(t.camera))}var qh={task:Rm,branch:Zm},Jh={relation:Rh},Yh={done:`#a9c4b6`,running:`#9fb6cc`,question:`#dcc797`,failed:`#d9a79f`,review_unavailable:`#cdbba3`,held:`#cdbba3`,paused:`#cdbba3`,superseded:`#c5bdcd`,aborted:`#c6c8cb`,skipped:`#c6c8cb`,missing:`#c6c8cb`};function Xh({events:e,zh:t}){let n=[...new Map(e.filter(e=>e.type===`team.task`).map(e=>[e.id,e])).values()];if(!n.length)return null;let r=n.filter(e=>e.status===`done`).length,i=n.filter(e=>Te.has(e.status||``)).length,a=n.filter(e=>e.status===`failed`).length;return(0,Y.jsxs)(`div`,{className:`map-team-progress`,role:`status`,"aria-label":t?`子任务进度`:`Subtask progress`,children:[(0,Y.jsx)(`strong`,{children:t?`子任务`:`Subtasks`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(_,{size:12}),(0,Y.jsxs)(`b`,{children:[r,`/`,n.length]}),` `,t?`已完成`:`completed`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:i}),` `,t?`进行中`:`running`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:a}),` `,t?`失败`:`failed`]})]})}function Zh({data:e,zh:t,composer:n,activePhase:r,waiting:s,snapshot:l,currentTaskId:u,events:d,pendingLabel:f,readOnly:p,sessionId:m,viewKey:h,paused:g,actions:_,replacements:v}){let[b,x]=(0,X.useState)(!1),[S,w]=(0,X.useState)(()=>e.kind===`live`&&!p&&_.conversationEvents.some(e=>e.type===`ui.operator`||e.type===`ui.argus`)),O=[..._.conversationEvents].reverse().find(e=>e.type===`ui.operator`),k=O?String(O.message_id||O.ts||``):``,ee=(0,X.useRef)(k),L=(0,X.useRef)(n.pending);(0,X.useEffect)(()=>{e.kind===`live`&&!p&&(k&&k!==ee.current||n.pending&&!L.current)&&(w(!0),x(!1)),ee.current=k,L.current=n.pending},[k,n.pending,e.kind,p]);let[R,z]=(0,X.useState)(()=>new Set),B=(0,X.useCallback)(e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[V,H]=(0,X.useState)(null),U=(0,X.useRef)(0),re=(0,X.useRef)(!0);(0,X.useEffect)(()=>(re.current=!0,()=>{re.current=!1}),[]);let K=(0,X.useMemo)(()=>we(e.tasks),[e.tasks]),[de,fe,pe]=Up([]),he=(0,X.useRef)(null),q=dh(he,!p),_e=Gp(),ve=(0,X.useRef)(!1),[ye,xe]=(0,X.useState)(!1),Se=(0,X.useRef)(null);Se.current||=Gh(h);let[Ce,Ae]=(0,X.useState)(()=>{let e=Se.current?.scene?.cards.find(e=>e.id===Se.current?.camera?.focusId);return new Set(e&&e.id!==e.task.id?[e.task.id]:[])}),[je,Me]=(0,X.useState)(null),[Ne]=(0,X.useState)(()=>new Set(Se.current?.scene?.cards.map(e=>e.id))),Pe=de.find(e=>e.id===q.focusId),Ie=(0,X.useMemo)(()=>ce(e.tasks,e.events),[e.tasks,e.events]),Le=et(m,t?`zh-CN`:`en-US`),[Be,Ve]=(0,X.useState)(null),Ue=(0,X.useCallback)((t,n)=>{Ve(r=>n?{nodeId:t,key:n,foundationId:Le.id}:r?.nodeId===t&&!e.tasks.some(e=>e.id===r.key)?null:r)},[e.tasks,Le.id]);(0,X.useEffect)(()=>{Ve(t=>t&&(t.nodeId===q.focusId||e.tasks.some(e=>e.id===t.key))?t:null)},[q.focusId,e.tasks]);let J=Be?e.tasks.find(e=>e.id===Be.key):void 0,Ge=J?.turn_kind===`qa`?e.events.find(e=>e.item_id===J.id&&e.type===`turn.replied`):void 0,Je=Be?de.find(e=>e.id===Be.nodeId):void 0,Ye=J?.id??(Be?.nodeId===q.focusId?Be.key:null),Xe=(0,X.useMemo)(()=>oe(e.tasks),[e.tasks]),Ze=Xe.findIndex(e=>e.id===Pe?.data.task.id),[Qe,tt]=(0,X.useState)(null),nt=K.tasks.find(e=>e.id===Qe),rt=(0,X.useMemo)(()=>nt?ke(K,nt.id):null,[K,nt]),it=(0,X.useMemo)(()=>nt&&rt?new Set([nt.id,...rt.upstream.map(e=>e.id),...rt.downstream.map(e=>e.id)]):null,[nt,rt]),{copy:at,ready:ot,generating:st,readingRequest:ct,readingNeedsUpdate:lt,readingGenerating:ut,generationPhase:pt,foundationRequired:mt,questionContext:ht,generationError:gt,generationUnavailable:vt,retry:bt}=hh(e,J?.id||Pe?.data.task.id||null,t,!p&&!e.history_loading,Pe?.data.layout.steps,m,!1,Ye,Be?.foundationId),xt=(0,X.useMemo)(()=>ct?{request:ct,questionContext:ht,pending:lt,generating:ut,phase:pt,error:gt,unavailable:vt,foundationRequired:mt,retry:p?void 0:bt,retryDisabled:st}:void 0,[ct,ht,lt,st,ut,pt,gt,vt,p,bt,mt]),St=(0,X.useMemo)(()=>Re(Ee(K,at?.relations||[],t)),[K,at?.relations,t]),Ct=xh(e,t,!p&&!e.history_loading,m),wt=_h(e,St,t,!p&&!e.history_loading,m),Tt=(0,X.useMemo)(()=>Ee(K,at?.relations||[],t,wt),[K,at?.relations,t,wt]),Dt=(0,X.useRef)(Se.current.scene),kt=(q.canvasSize.width||window.innerWidth)<640,Z=(0,X.useMemo)(()=>{let n=me(K,e.events,t,Dt.current,Tt,Ce,kt);return Dt.current=a(Dt.current,n),Dt.current},[K,e.events,t,Tt,Ce,kt]),At=(0,X.useRef)(null),jt=(0,X.useMemo)(()=>(At.current=a(At.current,le(Oe(K,e.events,t,48),R,t)),At.current),[K,e.events,t,R]),Mt=(0,X.useRef)(null),Pt=(0,X.useMemo)(()=>{let e=jt.tasks.filter(e=>e.branch);if(!e.length)return{links:Z.links,positions:Z.positions,frames:Z.frames,structure:Z.structure,branches:e,branchAnchor:new Map};let t=new Map;for(let e of Z.cards)t.set(e.task.id,e.id);let n=new Map(e.map(e=>[e.id,t.get(e.parent_id)??e.parent_id])),r={...Z.frames};for(let t of e)r[t.id]={...t.group?qm:Km,scale:1};let i=[...Z.links,...jt.links.filter(e=>e.kind===`fanout`||e.kind===`fanin`).map(e=>({...e,source:t.get(e.source)??e.source,target:t.get(e.target)??e.target}))],a=new Map;for(let t of e){let e=n.get(t.id);a.set(e,[...a.get(e)??[],t.id])}let o=Z.cards.flatMap(e=>[e.id,...a.get(e.id)??[]]),s=JSON.stringify([o.map(e=>[e,r[e].width,r[e].height]),i.map(e=>[e.source,e.target,e.kind])]),c=Mt.current?.structure===s?Mt.current.positions:dt(o,i,r);return Mt.current={structure:s,positions:c},{links:i,positions:c,frames:r,structure:s,branches:e,branchAnchor:n}},[Z,jt]),It=Vt(Pt.positions,q.reducedMotion),[Rt,zt]=(0,X.useState)(null),Bt=(0,X.useMemo)(()=>Ut(Pt.links,Rt),[Pt.links,Rt]),[Ht,Gt]=(0,X.useState)(!1),[qt,Jt]=(0,X.useState)(!1),Yt=(0,X.useMemo)(()=>new Map(Z.cards.map(e=>[e.id,e.ordinal])),[Z.cards]),Xt=Lt(Z,!!e.history_loading),Zt=(0,X.useMemo)(()=>$e(e.events),[e.events]),Qt=async(e,t=[],r,i)=>{if(i?.whileRunning)return n.onSend(e,t,void 0,i);let a=++U.current,o=he.current?.querySelector(`.map-composer`)?.getBoundingClientRect();H({id:a,text:Ke(e).text.replace(/\s+/g,` `).slice(0,180),origin:{x:o?.left??20,y:o?.top??innerHeight-100,width:o?.width??260,height:o?.height??56}});let s=!1,c=e=>{e.type===`task`&&(s=!0),re.current&&e.type===`settled`&&e.outcome===`message`&&!s&&(w(!0),x(!1)),re.current&&H(t=>t?.id===a?{...t,result:e}:t)};try{let r=await n.onSend(e,t,c);return r&&re.current&&Ke(e).refs.length>0&&(w(!0),x(!1)),r||c({type:`settled`,outcome:`error`}),r}catch(e){throw c({type:`settled`,outcome:`error`}),e}},$t=()=>{H(e=>e?{...e,result:{type:`settled`,outcome:`cancelled`}}:null),n.onCancel()};(0,X.useEffect)(()=>{if(!_e||ve.current||!ot||Se.current?.camera&&e.history_loading)return;let t=requestAnimationFrame(()=>{if(ve.current=!0,Se.current?.camera)q.restore(Se.current.camera);else if(q.fit(),e.kind===`live`&&he.current.clientWidth<640){let t=ae(e.tasks);t&&q.fit(new Set([t.id]))}xe(!0)});return()=>cancelAnimationFrame(t)},[_e,q.fit,q.enter,q.restore,e.kind,e.tasks,Z.cards,e.history_loading,ot]),(0,X.useEffect)(()=>{let e=he.current;if(!e||q.reducedMotion)return;let t=null,n=n=>{t??=requestAnimationFrame(()=>{t=null;let r=e.getBoundingClientRect();!r.width||!r.height||(e.style.setProperty(`--lean-x`,((n.clientX-r.left)/r.width-.5).toFixed(3)),e.style.setProperty(`--lean-y`,((n.clientY-r.top)/r.height-.5).toFixed(3)))})},r=()=>{e.style.setProperty(`--lean-x`,`0`),e.style.setProperty(`--lean-y`,`0`)};return e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,r),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,r)}},[q.reducedMotion]),(0,X.useEffect)(()=>{if(!ye||Se.current?.camera||q.reducedMotion)return;Gt(!0);let e=window.setTimeout(()=>Gt(!1),Wt);return()=>window.clearTimeout(e)},[ye,q.reducedMotion]),(0,X.useEffect)(()=>{let e=()=>{ve.current&&Kh(h,{scene:Dt.current,camera:q.capture()})};return window.addEventListener(`pagehide`,e),()=>{e(),window.removeEventListener(`pagehide`,e)}},[h,q.capture]),(0,X.useEffect)(()=>{if(!_e)return;let e=requestAnimationFrame(q.fitUpdatedScene);return()=>cancelAnimationFrame(e)},[Pt.structure,_e,q.fitUpdatedScene]);let en=(0,X.useRef)(n);en.current=n;let tn=(0,X.useCallback)(e=>{if(p)return;let t=en.current;t.onChange(ne(e)+t.value),window.setTimeout(()=>document.querySelector(`.map-composer textarea`)?.focus(),0)},[p]),[nn,rn]=(0,X.useState)(null),an=o(),on=i({queryKey:[`map-notes`,m],queryFn:({signal:e})=>c.mapNotes(m,e),enabled:e.kind===`live`&&!p,staleTime:6e4}),sn=(0,X.useMemo)(()=>({notes:Gm(on.data?.notes??[])}),[on.data]),[cn,ln]=(0,X.useState)(null),[un,dn]=(0,X.useState)(``),[fn,pn]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!cn)return;let e=e=>{e.target.closest(`.map-note-editor`)||ln(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),ln(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[cn]);let mn=async()=>{let e=cn,t=un.trim();if(!(!e||!t)){pn(!1);try{await c.addMapNote(m,{node_id:e.ref.task_id,text:t}),await an.invalidateQueries({queryKey:[`map-notes`,m]}),ln(null),dn(``)}catch{pn(!0)}}},hn=(0,X.useCallback)((e,t)=>{p||rn({ref:e,x:Math.min(window.innerWidth-180,t.x),y:Math.min(window.innerHeight-140,t.y)})},[p]);(0,X.useEffect)(()=>{if(!nn)return;let e=e=>{e.target.closest(`.map-context-menu`)||rn(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),rn(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[nn]);let[gn,_n]=(0,X.useState)(``),vn=(0,X.useCallback)(e=>`${e.task.title} ${e.task.objective??``} ${at?.cards[e.task.id]?.title||``} ${at?.cards[e.task.id]?.summary||``} ${Ct[e.task.id]?.title||``} ${Ct[e.task.id]?.summary||``} ${e.part>1?t?`续篇 ${e.part-1}`:`Continued ${e.part-1}`:``}`.toLowerCase(),[at,Ct,t]),yn=(0,X.useMemo)(()=>gn?Z.cards.filter(e=>vn(e).includes(gn.toLowerCase())):[],[gn,Z.cards,vn]),bn=yn.findIndex(e=>e.id===q.focusId),[xn,Sn]=(0,X.useState)(K.tasks.length),[Cn,wn]=(0,X.useState)(!1),[Tn,En]=(0,X.useState)(!1),Dn=v?.shown??Tn,On=v?.toggle??(()=>En(e=>!e)),[kn,An]=(0,X.useState)(``),jn=(0,X.useCallback)(e=>{if(tt(e),_n(``),An(``),e){let{upstream:t,downstream:n}=ke(K,e);q.fit(new Set([e,...t.map(e=>e.id),...n.map(e=>e.id)]))}else q.fit()},[q.fit,K]),Mn=(0,X.useCallback)((e,t=!1)=>{let n=Dt.current?.allCards.find(t=>t.id===e);if(n&&!Ce.has(n.task.id)&&(t||e!==n.task.id)){Ae(e=>new Set([...e,n.task.id])),Me(e);return}nt&&n?jn(n.task.id===nt.id?null:n.task.id):q.enter(e)},[q.enter,nt,jn,Ce]),Nn=(0,X.useCallback)(e=>{let t=Ce.has(e);if(Ae(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),Pe?.data.task.id===e){let n=Dt.current?.allCards.filter(t=>t.task.id===e).at(-1);Me(t?e:n?.id??e)}},[Ce,Pe?.data.task.id]);(0,X.useEffect)(()=>{!je||!de.some(e=>e.id===je)||(q.enter(je),Me(null))},[je,de,q.enter]);let Pn=(0,X.useCallback)(()=>{tt(null),An(``),q.fit()},[q.fit]);(0,X.useEffect)(()=>{fe(n=>a(n,Z.cards.map(n=>({id:n.id,type:`task`,position:It[n.id]??Z.positions[n.id],width:Z.frames[n.id].width,height:Z.frames[n.id].height,style:{width:Z.frames[n.id].width,height:Z.frames[n.id].height},data:{...n,zh:t,open:Mn,toggleHistory:Nn,readStep:q.readStep,readCopy:Ue,menu:hn,quote:tn,source:e.id,readOnly:p,live:e.kind===`live`,paused:g,seenCards:Ne,restoring:!!Se.current?.camera&&!ve.current,layout:Z.layouts[n.id],frame:Z.frames[n.id],plannedWidth:Zt.get(n.task.id),focused:!1,detailed:!1}}))))},[K,Z,Pt,It,t,fe,Mn,Nn,q.readStep,Ue,hn,tn,e.id,e.kind,p,g,Ne,Zt]),(0,X.useEffect)(()=>{Sn(e=>Math.min(Math.max(e,1),K.tasks.length))},[K.tasks.length]),(0,X.useEffect)(()=>{if(!Cn||q.detailed)return;let e=window.setInterval(()=>Sn(e=>e>=K.tasks.length?(wn(!1),e):e+1),900);return()=>window.clearInterval(e)},[Cn,K.tasks.length,q.detailed]),(0,X.useEffect)(()=>{if(!qt||Cn||xnJt(!1),1400);return()=>window.clearTimeout(e)},[qt,Cn,xn,K.tasks.length]);let Fn=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(t=>e.kind===`live`&&!qt||t.ordinal<=xn).map(e=>e.id));for(let[e,n]of Pt.branchAnchor)t.has(n)&&t.add(e);return t},[Z.cards,xn,e.kind,qt,Pt.branchAnchor]),In=(0,X.useRef)([]),Ln=(0,X.useMemo)(()=>{let e=de.map(e=>({...e,hidden:!Fn.has(e.id),data:{...e.data,copy:at?{version:at.version,cards:Object.fromEntries([e.data.task.id,...e.data.layout.steps.map(e=>e.id)].filter(e=>at.cards[e]).map(e=>[e,at.cards[e]]))}:void 0,words:Ct[e.data.task.id],readerCopy:Be?.nodeId===e.id?xt:void 0,focused:e.id===q.focusId,detailed:q.detailed&&e.id===q.focusId,canvasSize:q.canvasSize,lit:Bt.nodes.has(e.id),hovered:e.id===Rt,arriving:Ht,revealing:qt,phase:r&&Te.has(e.data.task.status)?r:void 0,waiting:s&&s.taskId===e.data.task.id?s.sentence:void 0,growthDelay:Xt.cards[e.id],dispatchState:V?.result?.type===`task`&&V.result.taskId===e.data.task.id&&!n.historical?V.landed?`landed`:`receiving`:void 0,growingSteps:Object.fromEntries(e.data.layout.steps.flatMap(t=>{let n=Xt.steps[Ft(e.id,t.id)];return n==null?[]:[[t.id,n]]})),growingLinks:Object.fromEntries(e.data.layout.links.flatMap(t=>{let n=Xt.links[Ft(e.id,t.id)];return n==null?[]:[[t.id,n]]}))},style:{...e.style,opacity:it&&!it.has(e.data.task.id)||gn&&!vn(e.data).includes(gn.toLowerCase())?.22:1}}));return In.current=a(In.current,e),In.current},[de,Fn,q.focusId,q.detailed,q.canvasSize,gn,vn,at,Ct,Be,xt,t,Xt,V,n.historical,it,Bt,Rt,Ht,qt,r,s]),Rn=(0,X.useRef)([]),zn=(0,X.useMemo)(()=>{let e=new Map;for(let t of Pt.branches){if(t.group)continue;let n=t.parent_id??``;e.set(n,(e.get(n)??0)+1)}let n=new Map,r=Pt.branches.map(r=>{let i=r.parent_id??``,a=Pt.frames[r.id],o=r.group?void 0:(n.get(i)??0)+1;return o!==void 0&&n.set(i,o),{id:r.id,type:`branch`,position:It[r.id]??{x:0,y:0},width:a.width,height:a.height,style:{width:a.width,height:a.height,opacity:it&&!it.has(i)?.22:1},hidden:!Fn.has(r.id),draggable:!1,selectable:!1,focusable:!1,data:{task:r,zh:t,parentCardId:Pt.branchAnchor.get(r.id),open:Mn,toggleGroup:B,fanIndex:o,fanCount:o===void 0?void 0:e.get(i)}}});return Rn.current=a(Rn.current,r),Rn.current},[Pt,It,Fn,t,Mn,B,it]),Bn=(0,X.useMemo)(()=>zn.length?[...Ln,...zn]:Ln,[Ln,zn]),Vn=(0,X.useMemo)(()=>{let n=Pt.links.filter(e=>Fn.has(e.source)&&Fn.has(e.target)&&(e.kind!==`replacement`||Dn)),r=be(n),i=new Map(Z.cards.map(e=>[e.id,e.task])),a=new Set;if(e.kind===`live`&&!g){for(let e of Z.cards)Te.has(e.task.status)&&a.add(e.id);for(let e of Pt.branches)Te.has(e.status)&&a.add(e.id)}return n.map((e,n)=>{let o=e.kind===`fanout`||e.kind===`fanin`,s=i.get(e.source)?.id,c=i.get(e.target)?.id,l=!!nt&&e.kind===`dependency`&&(s===nt.id||c===nt.id),u=!!nt&&!l&&(e.kind!==`continuation`||s!==nt.id);return{id:e.id,source:e.source,target:e.target,...te({...It[e.source],...Pt.frames[e.source]},{...It[e.target],...Pt.frames[e.target]}),type:`relation`,data:{growthDelay:Xt.links[e.id]??(Ht?Kt(Yt.get(e.source)??1):qt&&Yt.get(e.target)===xn?120:void 0),active:a.has(e.target),lit:Bt.edges.has(e.id),lane:r[n],muted:u,quiet:!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)},className:`map-edge-${e.kind}${Bt.edges.has(e.id)?` is-lit`:``}`,label:o?void 0:e.label||(e.kind===`replacement`?(i.get(e.source)?.superseded_reason||``).replace(/\s+/g,` `).slice(0,60)||(t?`转入新计划`:`New plan`):e.kind===`dependency`?t?`依赖`:`Dependency`:t?`同一研究`:`Related work`),labelStyle:{fontSize:30,fill:e.kind===`replacement`?`#95809f`:`#6685a4`},labelBgPadding:[12,6],labelBgBorderRadius:12,labelBgStyle:{fill:`var(--map-paper)`,fillOpacity:.96},style:{opacity:u?.12:1,stroke:e.cycle?`#dc6648`:e.kind===`replacement`?`#a48caf`:e.kind===`dependency`?`#527fa7`:`#7594ad`,strokeWidth:l?2.6:e.kind===`dependency`?2:o?1.1:1.6,vectorEffect:`non-scaling-stroke`,strokeDasharray:e.kind===`dependency`||e.kind===`context`||e.kind===`continuation`||o?void 0:`5 6`},markerEnd:{type:Hs.ArrowClosed,color:e.kind===`replacement`?`#a48caf`:`#8aa5b8`,width:32,height:32},ariaLabel:e.evidence||(o?`Team branch: ${e.source} → ${e.target}`:e.kind===`dependency`?`Dependency: ${e.source} → ${e.target}`:`Plan replacement: ${e.source} → ${e.target_plan_id} (${e.target_count} tasks, representative ${e.target})`)}})},[Pt,Fn,Dn,t,Xt,e.kind,g,Z.cards,nt,It,Bt,Ht,qt,xn,Yt]),Hn=K.links.filter(e=>e.kind===`replacement`).length,Un=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(e=>e.completionScope).map(e=>e.task.id)),n={done:0,ended:0,running:0,question:0,review_unavailable:0,held:0,failed:0,other:0};for(let r of e.tasks)t.has(r.id)?n.ended++:r.status===`done`?n.done++:Te.has(r.status)?n.running++:r.pending_question?n.question++:De(r)===`review_unavailable`?n.review_unavailable++:De(r)===`held`?n.held++:r.status===`failed`?n.failed++:n.other++;return n},[e.tasks,Z.cards]),Wn=Un.done,Gn=(0,X.useCallback)(e=>at?.cards?.[`${e.id}:outcome`]?.summary||``,[at]),Kn=(0,X.useMemo)(()=>e.tasks.some(e=>e.turn_kind!==`qa`&&e.kind!==`turn`)?ie(e.tasks,e.events,t,Gn):null,[e.tasks,e.events,t,Gn]),qn=He(l,l.mission_view,d),Jn=Fe(qn,l.mission_view,d,t?`zh-CN`:`en`,_.connected,We(l,l.mission_view,qn.taskId)),Yn=e=>{tt(null),An(``),Sn(t=>Math.max(t,Z.cards.find(t=>t.id===e)?.ordinal||1)),q.enter(e)},Xn=()=>{let e=Z.cards.filter(e=>e.task.id===Ie?.id).at(-1);e&&(Ve(null),Yn(e.id))},Zn=()=>{let n=ae(e.tasks);n?(Yn(Z.cards.filter(e=>e.task.id===n.id).at(-1).id),An(``)):An(t?`发送一个目标,地图就会开始生长`:`Send a goal to start your map`)},Qn=()=>{let e=Xe[(Ze+1)%Xe.length];e&&Yn(Z.cards.filter(t=>t.task.id===e.id).at(-1).id)};(0,X.useEffect)(()=>{let e=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.isComposing)&&!e.target?.closest(`input, textarea, select, [contenteditable], [role="dialog"]`)){if(e.key===`/`)e.preventDefault(),he.current?.querySelector(`.map-search input`)?.focus();else if(e.key===`f`||e.key===`F`)Pn();else if((e.key===`ArrowRight`||e.key===`ArrowLeft`)&&q.detailed&&q.focusId){let t=Z.cards.filter(e=>Fn.has(e.id)),n=t.findIndex(e=>e.id===q.focusId);if(n<0)return;let r=t[n+(e.key===`ArrowRight`?1:-1)];r&&(e.preventDefault(),q.enter(r.id))}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pn,q.enter,q.detailed,q.focusId,Z.cards,Fn]);let $n=(0,X.useMemo)(()=>({artifacts:_.artifacts,onOpenArtifact:_.onOpenArtifact}),[_.artifacts,_.onOpenArtifact]),er=(0,Y.jsxs)(`div`,{className:`map-playback`,"data-floating":e.kind===`live`,children:[(0,Y.jsx)(`button`,{"aria-label":Cn?`Pause reveal`:`Play reveal`,onClick:()=>{xn>=K.tasks.length&&Sn(1),wn(e=>!e)},children:Cn?(0,Y.jsx)(P,{size:14}):(0,Y.jsx)(I,{size:14})}),(0,Y.jsx)(`button`,{"aria-label":`Restart reveal`,onClick:()=>{wn(!1),Sn(1),e.kind!==`live`&&q.back()},children:(0,Y.jsx)(F,{size:13})}),(0,Y.jsx)(`span`,{children:t?`逐卡展开`:`Reveal cards`}),(0,Y.jsx)(`input`,{"aria-label":`Visible task count`,type:`range`,min:Math.min(1,K.tasks.length),max:K.tasks.length,value:xn,onChange:e=>{wn(!1),Sn(Number(e.target.value))}}),(0,Y.jsxs)(`span`,{className:`map-count`,children:[xn,` / `,K.tasks.length]}),(0,Y.jsx)(`button`,{"aria-label":`Reveal next card`,disabled:xn>=K.tasks.length,onClick:()=>Sn(e=>Math.min(K.tasks.length,e+1)),children:(0,Y.jsx)(se,{size:14})}),(0,Y.jsx)(`small`,{children:t?`时间顺序`:`Chronological order`}),e.kind===`live`&&(0,Y.jsx)(`button`,{className:`map-replay-exit`,"aria-label":t?`回到当前`:`Back to the present`,title:t?`回到当前`:`Back to the present`,onClick:()=>{wn(!1),Jt(!1),Sn(K.tasks.length)},children:(0,Y.jsx)(y,{size:14})})]});return(0,Y.jsx)(Hm.Provider,{value:q.zoomSteps,children:(0,Y.jsx)(km.Provider,{value:sn,children:(0,Y.jsxs)(Am.Provider,{value:$n,children:[at?.generation_error&&(0,Y.jsxs)(`div`,{role:`status`,className:`map-paused-label`,children:[t?`地图说明暂时不可用,任务和已有说明仍可阅读。`:`Map explanation unavailable; tasks and saved explanations remain readable.`,at.generation_error.code===`cost_unreconciled`&&(t?` 调用费用待对账,并非预算耗尽。`:` Provider usage awaits reconciliation, not budget exhaustion.`)]}),e.kind===`live`&&!qt&&Kn&&(0,Y.jsxs)(`dl`,{className:`map-brief`,"aria-label":t?`任务进展`:`Task progress`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`正在做`:`Now`}),(0,Y.jsx)(`dd`,{title:Kn.goal,children:qn.state===`running`||qn.state===`waiting`||qn.reason===`operator_input`?Jn:Kn.current})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`已有结果`:`Results`}),(0,Y.jsx)(`dd`,{children:Kn.conclusion})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`接下来`:`Next`}),(0,Y.jsx)(`dd`,{children:Kn.next})]})]}),(0,Y.jsxs)(`div`,{className:`map-status-row`,children:[e.tasks.length>0&&(0,Y.jsx)(`span`,{className:`map-progress`,"aria-hidden":`true`,children:[`done`,`ended`,`running`,`question`,`review_unavailable`,`held`,`failed`,`other`].map(e=>Un[e]>0?(0,Y.jsx)(`i`,{"data-bucket":e,style:{flexGrow:Un[e]}},e):null)}),(0,Y.jsxs)(`p`,{className:`map-status-line`,role:`status`,children:[n.pending||!g&&(r||s)?(0,Y.jsx)(`i`,{className:`map-live-dot`,"aria-hidden":!0}):null,(0,Y.jsx)(`span`,{className:`map-status-text`,children:ue({total:e.tasks.length,qa:e.tasks.filter(e=>e.turn_kind===`qa`).length,complete:Wn,ended:Un.ended,reviewUnavailable:Un.review_unavailable,held:Un.held,running:Un.running,pending:n.pending,paused:g,hasOpenWork:e.tasks.some(e=>[`running`,`pending`,`paused`,`held`,`question`].includes(De(e))),role:r,current:e.kind===`live`&&![`idle`,`step_finished`].includes(qn.state)?Jn:void 0,waiting:s?.sentence,zh:t})}),Xe.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`map-status-sep`,"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`button`,{type:`button`,className:`map-attention-link`,onClick:Qn,title:t?`跳到需要你处理的任务`:`Jump to the task waiting on you`,"aria-label":t?`逐个查看 ${Xe.length} 项需要你处理的任务`:`Cycle through ${Xe.length} tasks needing attention`,children:t?`${Xe.length} 项需要你处理`:`${Xe.length} ${Xe.length===1?`needs`:`need`} your attention`})]})]})]}),e.kind===`live`&&Ie&&!qt&&(0,Y.jsxs)(`div`,{className:`map-final-review`,role:`status`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:t?`最终结果已检查通过`:`Final delivery passed review`}),Pe?.data.task.id!==Ie.id&&Pe?.data.task.outcome?.review_status===`unavailable`&&(Ie.finished_ts??0)>(Pe.data.task.finished_ts??0)?(0,Y.jsx)(`span`,{children:t?` · 本项目后续已交付;此卡保留当次审查异常。`:` · This project was delivered later; this card retains its earlier review error.`}):null]}),(0,Y.jsx)(`button`,{type:`button`,onClick:Xn,children:t?`查看结果检查`:`View final review`}),_.deliveryCount>0&&(0,Y.jsx)(`button`,{type:`button`,onClick:_.onOpenDelivery,children:t?`查看项目成果`:`View project deliverables`})]}),e.kind===`live`&&!p&&(0,Y.jsx)(ze,{questions:l.pending_questions??[],backlog:l.backlog,currentTaskId:u??l.mission_view?.mission.id,onAnswer:_.onAnswer,onLocate:e=>{let t=Z.cards.filter(t=>t.task.id===e).at(-1);t&&Yn(t.id)}}),q.detailed&&Ze>=0&&(0,Y.jsxs)(`div`,{className:`map-attention-detail`,role:`status`,children:[(0,Y.jsxs)(`strong`,{children:[t?`待处理`:`Needs attention`,` `,Ze+1,` / `,Xe.length]}),(()=>{let n=G(Xe[Ze],e.events,t,Gn(Xe[Ze]));return(0,Y.jsxs)(`div`,{tabIndex:0,children:[(0,Y.jsx)(`p`,{children:n.reason}),(0,Y.jsx)(`p`,{children:n.next}),n.detail&&(n.showDetail?(0,Y.jsxs)(`blockquote`,{className:`map-attention-quote`,children:[(0,Y.jsx)(`strong`,{children:t?`暂停原因原文`:`Recorded reason`}),` `,n.detail]}):(0,Y.jsxs)(`details`,{children:[(0,Y.jsx)(`summary`,{children:t?`原始记录`:`Recorded words`}),(0,Y.jsx)(`p`,{children:n.detail})]}))]})})()]}),nt&&rt&&(0,Y.jsxs)(`nav`,{className:`map-dependencies`,"aria-label":t?`任务来路与去向`:`Task dependencies`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`来路`:`Depends on`}),rt.upstream.length?rt.upstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的前置依赖`:`No recorded prerequisites`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`当前`:`Selected`}),(0,Y.jsxs)(`button`,{className:`map-trace-task`,title:nt.title,onClick:()=>Yn(Z.cards.find(e=>e.task.id===nt.id).id),children:[nt.title,` · `,t?`查看任务`:`Open task`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`去向`:`Enables`}),rt.downstream.length?rt.downstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的后续依赖`:`No recorded dependents`})]})]}),(0,Y.jsx)(`div`,{className:`map-workspace`,children:(0,Y.jsxs)(`div`,{ref:he,className:`map-canvas-wrap`,"data-focused":!!q.focusId,"data-detailed":q.detailed,"data-fitted":ye,"data-hovering":!!Rt&&!q.detailed,children:[(0,Y.jsxs)(`div`,{className:`map-ambient`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),S&&(0,Y.jsx)(yt,{events:_.conversationEvents,connected:_.connected,pending:n.pending,artifacts:_.artifacts,zh:t,onClose:()=>w(!1),onOpenArtifact:_.onOpenArtifact,onOpenDelivery:_.onOpenReceipt}),b&&e.kind===`live`&&(0,Y.jsx)(`aside`,{className:`map-agent-drawer nowheel nodrag nopan`,children:(0,Y.jsx)(Ot,{sid:l.session.id,view:l.mission_view,roles:l.roles,events:d,taskId:Pe?.data.task.id||l.mission_view?.mission.id||void 0,paused:g&&!n.pending,onClose:()=>x(!1)})}),V&&!p&&(0,Y.jsx)(Nt,{flight:V,canvas:he,zh:t,historical:n.historical,onReveal:t=>{e.tasks.some(e=>e.id===t)&&q.fit()},onLand:e=>H(t=>t?.id===e?{...t,landed:!0}:t),onFinish:e=>H(t=>t?.id===e?null:t)}),(0,Y.jsxs)(`div`,{className:`map-canvas-toolbar nowheel`,children:[(0,Y.jsxs)(`label`,{className:`map-search`,children:[(0,Y.jsx)(C,{size:14}),(0,Y.jsx)(`input`,{"aria-label":t?`搜索地图任务`:`Search map tasks`,placeholder:t?`搜索任务…`:`Find a task…`,title:t?`Enter 逐个跳转匹配`:`Enter jumps through matches`,value:gn,onChange:e=>_n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&yn.length?Yn(yn[(bn+1)%yn.length].id):e.key===`Escape`&&gn&&(e.stopPropagation(),_n(``))}}),gn&&(0,Y.jsx)(`span`,{className:`map-search-count`,"aria-live":`polite`,children:yn.length?bn>=0?`${bn+1}/${yn.length}`:`${yn.length} ${t?`项`:`found`}`:t?`无匹配`:`0 found`})]}),(0,Y.jsxs)(`button`,{onClick:Zn,title:t?`定位当前或最近任务`:`Locate current or latest task`,"aria-label":t?`定位当前`:`Locate current`,children:[(0,Y.jsx)(_t,{size:15}),(0,Y.jsx)(`span`,{children:t?`定位当前`:`Locate current`})]}),(0,Y.jsx)(`button`,{className:`map-fit-button`,onClick:Pn,title:t?`适配全图`:`Fit map`,"aria-label":`Fit map`,children:(0,Y.jsx)(W,{size:15})}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":t?`来路 / 去向`:`Trace dependencies`,title:t?`突出显示任务的直接前后依赖;点击卡片切换,再次点击退出`:`Highlight direct dependencies; click a card to switch, click it again to exit`,"aria-pressed":!!nt,disabled:!K.tasks.length,onClick:()=>jn(nt?null:Pe?.data.task.id??ae(e.tasks)?.id??null),children:[(0,Y.jsx)(N,{size:15}),(0,Y.jsx)(`span`,{children:t?`来路 / 去向`:`Dependencies`})]}),e.kind===`live`&&K.tasks.length>1&&!q.detailed&&!qt&&(0,Y.jsxs)(`button`,{onClick:()=>{Jt(!0),Sn(1),wn(!0)},title:t?`回放这项研究是如何展开的`:`Replay how this research unfolded`,"aria-label":`Replay`,children:[(0,Y.jsx)(M,{size:15}),(0,Y.jsx)(`span`,{children:t?`回放`:`Replay`})]}),q.detailed&&(0,Y.jsxs)(`button`,{onClick:q.back,className:`map-back-button`,"aria-label":`Return to map`,children:[(0,Y.jsx)(j,{size:14}),(0,Y.jsx)(`span`,{children:t?`返回全图`:`Overview`})]}),q.detailed&&Pe&&Pe.data.partCount>1&&(0,Y.jsxs)(`nav`,{className:`map-part-switcher`,"aria-label":t?`切换任务部分`:`Switch task part`,children:[(0,Y.jsx)(`button`,{"aria-label":t?`上一部分`:`Previous part`,disabled:!Pe.data.previousId,onClick:()=>Pe.data.previousId&&Mn(Pe.data.previousId,!0),children:(0,Y.jsx)(ft,{size:15})}),(0,Y.jsxs)(`span`,{children:[Pe.data.part,` / `,Pe.data.partCount]}),(0,Y.jsx)(`button`,{"aria-label":t?`下一部分`:`Next part`,disabled:!Pe.data.nextId,onClick:()=>Pe.data.nextId&&Mn(Pe.data.nextId,!0),children:(0,Y.jsx)(se,{size:15})})]}),(0,Y.jsx)(`span`,{className:`map-toolbar-gap`,"aria-hidden":!0}),e.kind===`live`&&(0,Y.jsxs)(`div`,{className:`map-workspace-actions`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":S,"aria-label":t?`对话`:`Conversation`,title:t?`与 Argus 的对话`:`Your conversation with Argus`,onClick:()=>{w(e=>!e),x(!1)},children:[(0,Y.jsx)(qe,{size:15}),(0,Y.jsx)(`span`,{children:t?`对话`:`Conversation`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-agent-toggle`,"aria-expanded":b,"aria-label":t?`Agent 动态`:`Agent activity`,title:t?`各个 Agent 正在做什么`:`What each agent is doing`,onClick:()=>{x(e=>!e),w(!1)},children:[(0,Y.jsx)(A,{size:15}),(0,Y.jsx)(`i`,{"data-active":!!r||n.pending,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:t?`工作详情`:`Work details`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-delivery-toggle`,disabled:!_.deliveryCount,"aria-label":t?`交付成果`:`Deliveries`,title:t?`已交付的成果`:`What has been delivered`,onClick:_.onOpenDelivery,children:[(0,Y.jsx)(ge,{size:15}),(0,Y.jsx)(`span`,{children:t?`交付成果`:`Deliveries`}),_.deliveryCount>0&&(0,Y.jsx)(`b`,{children:_.deliveryCount})]})]})]}),kn&&(0,Y.jsx)(`div`,{className:`map-feedback`,role:`status`,children:kn}),K.tasks.length===0?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(N,{size:36}),(0,Y.jsx)(`h3`,{children:t?`把一个目标,变成可见的成果`:`Turn a goal into a visible result`}),(0,Y.jsx)(`p`,{children:p?t?`尚无任务记录。`:`No task records are available.`:t?`描述你想完成的事情,看 Argus 规划、执行、审查,最后在这里交付。`:`Describe your goal. Watch Argus plan, build, review, and deliver here.`}),!p&&(0,Y.jsx)(`div`,{className:`map-starters`,children:(t?[[`交互实验`,`做一个交互式实验室,用动画展示 Dijkstra 和 A* 怎样寻找最短路径。让我能画障碍、单步播放、比较探索范围,并验证两个算法的结果一致。`],[`数据洞察`,`用一组可复现的模拟数据,做一个辛普森悖论交互演示。让我能切换整体和分组视角,看结论怎样反转,附上验证过程。`],[`产品原型`,`做一个精致的个人旅行规划网页。我能调整预算和出行天数,比较三种行程方案,并将选中的方案导出。让手机上也方便操作。`]]:[[`Interactive lab`,`Build an interactive Dijkstra vs A* pathfinding lab with editable obstacles, step-by-step animation, and correctness checks.`],[`Data insights`,`Create an interactive Simpson’s paradox demo using reproducible synthetic data, with aggregate and grouped views and validation.`],[`Product prototype`,`Build a polished travel planner. Let me adjust budget and duration, compare three itineraries, and export my choice. Make it easy to use on a phone.`]]).map(([e,t])=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{n.onChange(t),requestAnimationFrame(()=>he.current?.querySelector(`textarea`)?.focus())},children:[e,` ↗`]},e))})]}):(0,Y.jsxs)(Bp,{nodes:Bn,edges:Vn,nodeTypes:qh,edgeTypes:Jh,onNodesChange:pe,onNodeMouseEnter:(e,t)=>zt(t.id),onNodeMouseLeave:()=>zt(null),onMove:q.onMove,defaultViewport:Qm,minZoom:.01,maxZoom:3.5,nodesDraggable:!1,nodesFocusable:!1,nodesConnectable:!1,edgesReconnectable:!1,zoomOnScroll:!1,zoomOnPinch:!0,zoomOnDoubleClick:!1,deleteKeyCode:null,selectionKeyCode:null,onlyRenderVisibleElements:ye&&_e,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Qp,{variant:Jp.Dots,gap:88,size:3,color:`var(--map-dot)`}),(0,Y.jsx)(sm,{orientation:`horizontal`,showInteractive:!1,onFitView:Pn,fitViewOptions:{padding:.16,maxZoom:.27,minZoom:.01,duration:q.reducedMotion?0:320}}),(0,Y.jsx)(Sm,{nodeColor:e=>e.type===`branch`?`#cfd2d5`:Yh[De(e.data.task)]??`#c6c8cb`,maskColor:`var(--map-minimap-mask)`,maskStrokeColor:`#6d737a`,maskStrokeWidth:1.5,onClick:(e,t)=>q.navigate(t),pannable:!0,zoomable:!0,ariaLabel:t?`地图导航预览`:`Map navigation preview`})]}),e.kind===`live`&&qt&&er,(0,Y.jsxs)(`div`,{className:`map-legend nowheel`,children:[(0,Y.jsxs)(`span`,{title:t?`内容相关的工作,不是执行依赖`:`Related in content, not an execution dependency`,children:[(0,Y.jsx)(`b`,{className:`dashed`}),t?`内容关联`:`Related work`]}),(0,Y.jsxs)(`span`,{title:t?`工作发生的先后`:`The order work happened in`,children:[(0,Y.jsx)(`b`,{className:`order`}),t?`先后`:`Order`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{}),t?`任务依赖`:`Dependency`]}),(0,Y.jsxs)(`button`,{className:Dn?``:`is-muted`,onClick:On,"aria-pressed":Dn,disabled:Hn===0,"aria-label":`Toggle plan replacements`,children:[(0,Y.jsx)(`b`,{className:`replacement`}),t?`计划替代`:`Plan changes`,Hn?` · ${Hn}`:``]})]}),!p&&(0,Y.jsx)(Ch,{...n,pendingLabel:f,progressVisible:!S,dispatchStatus:V?.result?.type===`task`?V.landed||n.historical?`task`:`launching`:V?.result?.outcome,onSend:Qt,onCancel:$t,overview:!q.detailed}),nn&&!p&&(0,Y.jsxs)(`div`,{className:`map-context-menu`,role:`menu`,style:{left:nn.x,top:nn.y},children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{tn(nn.ref),rn(null)},children:t?`引用`:`Reference`}),e.kind===`live`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{dn(``),ln({ref:nn.ref,x:nn.x,y:nn.y}),rn(null)},children:t?`添加批注`:`Add a note`}),(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{n.onRouteOverrideChange?.(`task`),tn(nn.ref),rn(null)},children:t?`从这里展开`:`Branch from here`})]})]}),cn&&!p&&(0,Y.jsxs)(`div`,{className:`map-note-editor nodrag nopan`,style:{left:Math.min(window.innerWidth-320,cn.x),top:Math.min(window.innerHeight-240,cn.y)},children:[(0,Y.jsx)(`small`,{children:t?`批注《${cn.ref.task_title}》`:`Note on “${cn.ref.task_title}”`}),(0,Y.jsx)(`textarea`,{autoFocus:!0,maxLength:2e3,value:un,onChange:e=>dn(e.target.value),placeholder:t?`写下你的观察,Argus 在下个规划周期会读到`:`Your observation; Argus reads it next planning cycle`}),fn&&(0,Y.jsx)(`small`,{className:`map-note-error`,children:t?`没有保存上,稍后再试;草稿还在`:`Not saved; try again — the draft is kept`}),(0,Y.jsxs)(`div`,{className:`map-note-actions`,children:[(0,Y.jsx)(`button`,{onClick:()=>ln(null),children:t?`取消`:`Cancel`}),(0,Y.jsx)(`button`,{className:`is-primary`,disabled:!un.trim(),onClick:()=>void mn(),children:t?`保存`:`Save`})]})]}),(K.cyclic||K.missing>0)&&(0,Y.jsx)(`div`,{className:`map-graph-warning`,children:K.cyclic?t?`检测到循环引用,保留原始连线。`:`Cyclic references retained.`:`${K.missing} ${t?`个依赖不在当前记录范围内`:`dependencies outside the available history`}`})]})}),e.kind!==`live`&&er,(0,Y.jsx)(E,{open:!!J,onClose:()=>Ve(null),label:J?.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,children:J&&(ct||J.turn_kind===`qa`)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{title:J.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,sub:J.turn_kind===`qa`?J.objective||J.title:at?.cards[J.id]?.title||J.title}),(0,Y.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`map-task-reading`,"data-task-id":J.id,children:[J.outcome?.review_status===`unavailable`&&(0,Y.jsxs)(`p`,{className:`mb-3 text-sm text-ink-dim`,role:`status`,children:[t?`当次审查异常,未形成审阅结论。`:`No review judgment was returned on this attempt.`,Ie&&(Ie.finished_ts??0)>(J.finished_ts??0)&&(0,Y.jsx)(`button`,{type:`button`,className:`ml-2 text-blue underline`,onClick:Xn,children:t?`查看本项目后续通过的最终审稿`:`View this project's later accepted final review`})]}),Je?.data.completionScope?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:Je.data.completionScope}):null,(0,Y.jsx)(Et,{cardKey:J.id,taskId:J.id,card:at?.cards[J.id],task:J,readOnly:p,originalDetail:J.turn_kind===`qa`?Ge?.text||(J.status===`running`?t?`正在回答…`:`Answering…`:J.status===`cancelled`?t?`本次回答已中断。`:`This answer was interrupted.`:J.summary||(t?`尚无回答。`:`No answer recorded.`)):J.objective||J.summary||(t?`这项任务尚无详细记录。`:`No detailed task record is available.`),selection:xt,artifacts:$n.artifacts,onOpenArtifact:$n.onOpenArtifact}),p?null:(0,Y.jsx)(D,{className:`mt-3 text-xs`,onClick:()=>tn({source:e.id,task_id:J.id,task_title:at?.cards[J.id]?.title||J.title,event_ids:Ge?[Ge.id]:at?.cards[J.id]?.event_ids||ct?.event_ids||[],lang:t?`zh`:`en`}),children:J.turn_kind===`qa`?t?`引用这条问答`:`Reference this Q&A`:t?`引用此任务`:`Reference this task`})]})]}):null})]})})})}var Qh=(0,X.memo)(function({snapshot:e,currentTaskId:t,events:n,managerSteps:r=[],draft:a,onDraftChange:s,onSend:u,attachments:d,onAttachmentsChange:f,pending:p,onCancel:m,focusSignal:h,readOnly:g=!1,onOpenSettings:_,routeOverride:v,onRouteOverrideChange:y,conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}){let{locale:O}=l(),k=O===`zh-CN`,[A,j]=(0,X.useState)([]),M=d??A,N=(0,X.useRef)(M);N.current=M;let P=(0,X.useCallback)(e=>{let t=typeof e==`function`?e(N.current):e;N.current=t,f?f(t):j(t)},[f]),F=(0,X.useRef)(a);F.current=a;let I=(0,X.useRef)(!0);(0,X.useEffect)(()=>(I.current=!0,()=>{I.current=!1}),[]);let R=(0,X.useCallback)(async(e,t=[],n,r)=>{let i=!1,a=await u(e,t,r=>{r.type===`settled`&&r.outcome===`error`&&(i=!0),I.current&&(r.type===`settled`&&r.outcome===`error`&&!F.current.trim()&&(s(e),P(e=>e.length?e:t)),n?.(r))},r);return a&&!i&&I.current&&(F.current===e&&s(``),P(e=>e.filter(e=>!t.includes(e)))),a},[u,s,P]),[V,H]=(0,X.useState)(()=>new URLSearchParams(window.location.search).get(`dataset`)||B(`argus.map.source.v1`)||`live`),U=i({queryKey:[`map-datasets`],queryFn:({signal:e})=>c.mapDatasets(e),staleTime:1/0}),W=i({queryKey:[`map-dataset`,V],queryFn:({signal:e})=>c.mapDataset(V,e),enabled:V!==`live`,staleTime:1/0,retry:!1}),te=o(),G=`argus.map.history.v1:`+e.session.id,[ne,re]=(0,X.useState)(()=>Bh(B(G))),[ie,ae]=(0,X.useState)(!1),oe=i({queryKey:[`map-info`,e.session.id],queryFn:({signal:t})=>c.mapInfo(e.session.id,t),enabled:V===`live`,staleTime:6e4}),K=ne??(oe.data&&!oe.data.requires_choice?{mode:`full`}:null);(0,X.useEffect)(()=>{if(!ne&&oe.data&&!oe.data.requires_choice){let e={mode:`full`};re(e),z(G,JSON.stringify(e))}},[oe.data,ne,G]);let se=V!==`live`||!!K&&K.mode!==`off`&&!ie,ce=[`map-live`,e.session.id,K?.mode,K?.since,K?.eventSince,K?.taskId],le=JSON.stringify([V,e.session.id,O,K]),ue=e=>{re(e),z(G,JSON.stringify(e)),ae(!1)},de=i({queryKey:ce,queryFn:async({signal:t})=>{let n=te.getQueryData(ce),r=K?.mode===`full`?await c.mapHistory(e.session.id,t,n?.history_cursor,n?.cursor):await c.liveMap(e.session.id,t,n?.cursor,K||void 0);return Vh(te.getQueryData(ce),r)},enabled:V===`live`&&se,staleTime:1/0,gcTime:72e5,refetchOnMount:`always`,refetchInterval:t=>Hh(se,t.state.data,e)}),fe=V===`live`&&Uh(e),pe=He(e,e.mission_view,n),me=pe.reason===`background_work`&&pe.taskId?ot(pe,k?`zh-CN`:`en`):``,he=(0,X.useMemo)(()=>V===`live`&&!fe&&me?{taskId:pe.taskId,sentence:me}:void 0,[V,fe,pe.taskId,me]),q=n.filter(e=>e.run_label!==`map-summary`&&/^(life\.(mission\.|phase\.|planner\.task_added)|manager\.turn\.|round\.|agent\.message|engineer\.progress|ui\.argus|team\.|idea\.portfolio\.)/.test(String(e.type))).at(-1),ge=JSON.stringify([q?.ts,q?.event_id||q?.id,q?.revision,q?.updated_ts,q?.status,e.backlog,fe]),_e=(0,X.useRef)(null),ve=(0,X.useRef)(0),ye=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=ye.current;if(!e)return;let t=()=>{ve.current=Date.now()+900},n=e=>{e.buttons&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`pointerdown`,t),e.addEventListener(`pointermove`,n),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`pointerdown`,t),e.removeEventListener(`pointermove`,n)}},[]),(0,X.useEffect)(()=>{if(V!==`live`||!se||_e.current)return;let t=()=>{let n=ve.current-Date.now();if(n>0){_e.current=setTimeout(t,n+120);return}_e.current=null,te.invalidateQueries({queryKey:[`map-live`,e.session.id]})};_e.current=setTimeout(t,650)},[ge,V,e.session.id,te,se]),(0,X.useEffect)(()=>()=>{_e.current&&clearTimeout(_e.current),_e.current=null},[V,e.session.id,se]);let be=V===`live`?de.data:W.data,[xe,Se]=(0,X.useState)(!1),Ce=(0,X.useMemo)(()=>({shown:xe,toggle:()=>Se(e=>!e)}),[xe]),Te=(0,X.useMemo)(()=>be?we(be.tasks).links.filter(e=>e.kind===`replacement`).length:0,[be]),Ee=(0,X.useMemo)(()=>({conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}),[b,x,S,C,w,T,E,D]),De=(0,X.useMemo)(()=>({footer:(0,Y.jsx)(Ne,{sid:e.session.id,roles:e.roles,running:e.daemon.alive||!!e.manager_requests?.length,lastCall:e.last_call,onOpenSettings:g?void 0:_}),routeOverride:v,onRouteOverrideChange:y,value:a,onChange:s,onSend:R,attachments:M,onAttachmentsChange:P,pending:p,onCancel:m,focusSignal:h,sessionName:e.session.display_name||e.session.id,historical:V!==`live`,zh:k}),[v,y,a,s,R,M,p,m,h,e.session.display_name,e.session.id,V,k,e.roles,e.daemon.alive,e.manager_requests,e.last_call,g,_]),Oe=e=>{H(e),z(`argus.map.source.v1`,e);let t=new URL(window.location.href);t.searchParams.set(`dataset`,e),window.history.replaceState(null,``,t)};return(0,Y.jsxs)(`section`,{ref:ye,className:`argus-map`,"aria-label":k?`进度地图`:`Progress map`,children:[(0,Y.jsxs)(`header`,{className:`map-header`,children:[(0,Y.jsxs)(`div`,{className:`map-heading`,children:[(0,Y.jsx)(`span`,{className:`map-kicker`,"aria-hidden":`true`,children:k?`ARGUS · 研究地图`:`ARGUS · RESEARCH MAP`}),(0,Y.jsx)(`h1`,{title:e.session.display_name,children:e.session.display_name})]}),(0,Y.jsxs)(`details`,{className:`map-more`,children:[(0,Y.jsx)(`summary`,{"aria-label":k?`地图选项`:`Map options`,title:k?`地图选项`:`Map options`,children:(0,Y.jsx)(L,{size:16})}),(0,Y.jsxs)(`div`,{className:`map-more-menu`,children:[be&&(0,Y.jsx)(Xh,{events:be.events,zh:k}),(0,Y.jsxs)(`div`,{className:`map-dataset-bar`,children:[(0,Y.jsx)(pt,{size:15}),(0,Y.jsxs)(`select`,{"aria-label":k?`地图数据来源`:`Map data source`,value:V,onChange:e=>Oe(e.target.value),children:[(0,Y.jsxs)(`option`,{value:`live`,children:[k?`当前会话`:`Current session`,` ·`,` `,e.session.display_name]}),!U.data?.datasets.some(e=>e.id===V)&&V!==`live`&&(0,Y.jsx)(`option`,{value:V,children:V}),U.data?.datasets.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.task_count]},e.id))]}),be?.captured_at&&(0,Y.jsxs)(`span`,{className:`map-capture`,children:[(0,Y.jsx)(ee,{size:12}),new Date(be.captured_at).toLocaleDateString()]})]}),V===`live`&&oe.data&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button`,onClick:()=>ae(!0),children:k?`加载范围`:`History range`}),!g&&_&&(0,Y.jsx)(`button`,{type:`button`,onClick:_,className:`map-scope-button`,children:k?`地图模型设置`:`Map model settings`}),Te>0&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button map-narrow-only`,"aria-pressed":xe,onClick:Ce.toggle,children:xe?k?`隐藏计划替代连线 · ${Te}`:`Hide plan changes · ${Te}`:k?`显示计划替代连线 · ${Te}`:`Show plan changes · ${Te}`})]})]})]}),V===`live`&&oe.data&&(0,Y.jsx)(zh,{open:ie||!K&&oe.data.requires_choice,info:oe.data,zh:k,readOnly:g,onChoose:ue}),V===`live`&&oe.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[k?`暂时无法检查历史记录。`:`Could not check session history.`,(0,Y.jsx)(`button`,{onClick:()=>void oe.refetch(),children:k?`重试`:`Retry`})]}),se&&be?.history_loading&&(0,Y.jsxs)(`div`,{className:`map-history-progress`,role:`status`,children:[k?`正在分批加载历史记录`:`Loading history in pages`,be.history_progress&&` · ${(be.history_progress.loaded_bytes/1024/1024).toFixed(1)} / ${(be.history_progress.total_bytes/1024/1024).toFixed(1)} MB`,(0,Y.jsx)(`button`,{onClick:()=>ae(!0),children:k?`更改范围`:`Change range`})]}),se&&be&&(V===`live`?de.isError:W.isError)&&(0,Y.jsxs)(`div`,{className:`map-data-error`,role:`status`,children:[k?`暂时无法更新,已保留加载的地图。`:`Updates are unavailable. Your loaded map is preserved.`,(0,Y.jsx)(`button`,{onClick:()=>void(V===`live`?de.refetch():W.refetch()),children:k?`重试`:`Retry`})]}),U.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[k?`历史记录列表暂时无法读取,可切换当前会话或重试。`:`Historical maps are unavailable. Open the current session or retry.`,(0,Y.jsx)(`button`,{onClick:()=>void U.refetch(),children:k?`重试`:`Retry`})]}),se?(V===`live`?de.isError:W.isError)&&!be?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:k?`地图暂时无法读取`:`Map unavailable`}),(0,Y.jsx)(`p`,{children:String(V===`live`?de.error:W.error)}),(0,Y.jsx)(`button`,{onClick:()=>void(V===`live`?de.refetch():W.refetch()),children:k?`重试`:`Retry`})]}):be?(0,Y.jsx)(Ip,{children:(0,Y.jsx)(Zh,{data:be,actions:Ee,snapshot:e,currentTaskId:t,events:n,pendingLabel:r.at(-1)?.detail||r.at(-1)?.label,viewKey:le,paused:fe,sessionId:e.session.id,zh:k,readOnly:g,replacements:Ce,activePhase:V===`live`&&!fe&&!he?e.roles.find(e=>e.active)?.role:void 0,waiting:he,composer:De})},le):(0,Y.jsxs)(`div`,{className:`map-empty is-loading`,"aria-busy":`true`,children:[(0,Y.jsxs)(`div`,{className:`map-ghosts`,"aria-hidden":!0,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),k?`正在载入地图…`:`Loading map…`]}):(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:k?`地图尚未开启`:`Map is not enabled`}),(0,Y.jsx)(`p`,{children:oe.isPending?k?`正在检查历史记录规模…`:`Checking history size…`:k?`选择加载范围后查看研究进度。`:`Choose a history range to view research progress.`}),oe.data&&(0,Y.jsx)(`button`,{onClick:()=>ae(!0),children:k?`选择加载范围`:`Choose history range`})]})]})});export{Zh as MapCanvas,Qh as MapPanel,Xh as MapTeamProgress}; \ No newline at end of file diff --git a/frontend/web/dist/assets/MapPanel-C4kGIk-g.js b/frontend/web/dist/assets/MapPanel-C4kGIk-g.js new file mode 100644 index 000000000..0fb8cd67b --- /dev/null +++ b/frontend/web/dist/assets/MapPanel-C4kGIk-g.js @@ -0,0 +1,7 @@ +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,v as r}from"./icons-DHjcpj5P.js";import{a as i,b as a,c as o,i as s}from"./query-dCPZk0Xc.js";import{G as c,J as l,N as u,O as d,W as f,k as p}from"./index-DPfzOfKU.js";import{A as m,C as h,F as g,I as _,L as v,O as y,_ as b,b as x,g as S,j as C,k as w,m as T,p as E,r as D,w as O,x as k}from"./AppearanceControls-Bc1ibrT3.js";import{t as A}from"./activity-BEiyr9-4.js";import{n as j,t as M}from"./history-B00Gliyq.js";import{a as N,i as P,n as F,o as ee,r as I,t as L}from"./sliders-horizontal-CSN_5pyz.js";import{a as R}from"./format-D4uyBiG8.js";import{a as z,i as B,n as V}from"./useWorkbenchTheme-BqK4B8rm.js";import{$ as H,A as U,At as W,B as te,C as G,D as ne,Dt as re,E as ie,G as ae,H as oe,I as K,It as se,J as ce,K as le,L as ue,Lt as de,M as fe,Mt as pe,N as me,Nt as he,O as q,Ot as ge,P as _e,Pt as ve,Q as ye,R as be,S as xe,T as Se,Tt as Ce,U as we,V as Te,W as Ee,X as De,Y as Oe,Z as ke,_ as Ae,a as je,b as Me,bt as Ne,c as Pe,ct as Fe,d as Ie,dt as Le,et as Re,f as ze,ft as Be,g as Ve,gt as He,h as Ue,ht as We,i as J,j as Ge,k as Ke,kt as qe,lt as Je,mt as Ye,n as Xe,o as Ze,pt as Qe,q as $e,r as et,s as tt,st as nt,u as rt,ut as it,v as at,vt as ot,w as st,x as ct,y as lt,yt as ut,z as dt}from"./App-q-3YCWKy.js";var ft=v(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),pt=v(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),mt=v(`CornerDownLeft`,[[`polyline`,{points:`9 10 4 15 9 20`,key:`r3jprv`}],[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}]]),ht=v(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),gt=v(`ListChecks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),_t=v(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),vt=v(`Route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),Y=n();function yt({events:e,connected:t,pending:n,artifacts:r,zh:i,onClose:a,onOpenArtifact:o,onOpenDelivery:s}){let c=e.filter(e=>e.type===`ui.operator`||e.type===`ui.argus`);return(0,Y.jsxs)(`aside`,{className:`map-conversation nowheel nodrag nopan`,"aria-label":i?`地图对话`:`Map conversation`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(qe,{size:16}),(0,Y.jsx)(`strong`,{children:i?`与 ${p().name} 对话`:`Talk to ${p().name}`}),(0,Y.jsx)(`button`,{type:`button`,onClick:a,"aria-label":i?`关闭对话`:`Close conversation`,children:(0,Y.jsx)(y,{size:18})})]}),c.length?(0,Y.jsx)(xe,{events:c,connected:t,showReasoning:!1,onToggleReasoning:()=>{},embedded:!0,showHeader:!1,artifacts:r,onOpenArtifact:o,onOpenDelivery:s}):(0,Y.jsx)(`p`,{className:`map-conversation-empty`,children:i?`在下方发送目标或问题,回复会保留在这里。`:`Send a goal or question below. Your conversation stays here.`}),n&&!c.some(e=>e.type===`ui.argus`&&e.live===!0)&&(0,Y.jsx)(`p`,{className:`map-conversation-pending`,role:`status`,children:i?`${p().name} 正在回复…`:`${p().name} is replying…`})]})}var bt=new Set([`life.planner.task_added`,`life.mission.started`,`round.main.completed`,`round.review.completed`,`turn.asked`,`turn.replied`]);function xt(e,t,n=0){if(!e||!t)return[];let r=e.events.filter(e=>e.item_id===t.id&&bt.has(e.type)&&Number.isFinite(e.ts)&&e.ts>=n),i=Math.max(n,...r.filter(e=>e.type===`life.mission.started`).map(e=>e.ts)),a=r.filter(e=>e.ts>=i),o=new Map;for(let e of bt){let t=e.startsWith(`round.`)?2:1;for(let n of a.filter(t=>t.type===e).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id)).slice(-t))o.set(n.id,n)}return[...o.values()].sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id))}function St(e,t){return{key:e.id,task_id:e.id,kind:`task`,event_ids:t.map(e=>e.id)}}function Ct(e,t){return e?JSON.stringify({task:{id:e.id,title:e.title,objective:e.objective,status:e.status,summary:e.summary,acceptance_check:e.acceptance_check,goal_contribution:e.goal_contribution,plan_hypothesis:e.plan_hypothesis,non_goals:e.non_goals,outcome:e.outcome,pending_question:e.pending_question,started_ts:e.started_ts,finished_ts:e.finished_ts,attempt:e.attempt},events:t.map(e=>[e.id,e.revision??e])}):``}function wt(e){if(!e||typeof e!=`object`)return!1;let t=e;if(![`why`,`scope`,`next`].every(e=>typeof t[e]==`string`&&t[e].trim()))return!1;if(t.concept===null)return!0;if(!t.concept||typeof t.concept!=`object`)return!1;let n=t.concept;return[`name`,`explanation`,`example`,`connection`].every(e=>typeof n[e]==`string`&&n[e].trim())}function Tt({task:e,artifacts:t,onOpenArtifact:n}){let r=d().locale===`zh-CN`,i=typeof e?.pending_question==`string`?e.pending_question.trim():``;return i?(0,Y.jsxs)(`section`,{className:`mt-4 min-w-0 border-t border-line/60 pt-3 text-[13px] leading-6 text-ink-dim`,"data-reader-pending-question":e.id,children:[(0,Y.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:r?`这一步在等你回答`:`This step is waiting for your answer`}),(0,Y.jsx)(S,{artifacts:t,onOpenArtifact:n,children:i})]}):null}function Et({cardKey:e,taskId:t,card:n,task:r,originalDetail:i,selection:a,artifacts:o,onOpenArtifact:s,readOnly:c}){let{locale:l}=d(),u=l===`zh-CN`;if(r?.turn_kind===`qa`)return(0,Y.jsx)(`div`,{className:`macro-reader-markdown`,"data-reader-card":e,"data-reader-task-id":t,children:(0,Y.jsx)(S,{artifacts:o,onOpenArtifact:s,children:i})});let f=a?.request.key===e&&a.request.task_id===t?a:void 0,p=(n?.version??0)>=14&&wt(n?.reader_brief)?n.reader_brief:void 0;return(0,Y.jsxs)(`div`,{className:`font-sans`,"data-reader-card":e,"data-reader-task-id":t,children:[(0,Y.jsx)(je,{generatedAt:n?.generated_at,pending:f?.pending,generating:f?.generating,hasExplanation:!!n,phase:f?.phase,error:f?.error,unavailable:f?.unavailable,retry:f?.retry,retryDisabled:f?.retryDisabled}),f?.foundationRequired?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:u?`先在“问题基础”里选择一份说明,再阅读本次进展的解释。`:`Choose a saved foundation to explain this progress.`}):null,p?(0,Y.jsx)(J,{brief:p,identity:e,detail:n?.detail,learningPath:n?.learning_path,foundation:n?.foundation_ref,readingUnavailable:n?.teaching_review?.reading_review?.status===`unavailable`,teachingUnavailable:n?.teaching_review?.status===`unavailable`,artifacts:o,onOpenArtifact:s}):(0,Y.jsx)(`div`,{className:`macro-reader-markdown`,children:(0,Y.jsx)(S,{artifacts:o,onOpenArtifact:s,children:Ie(n?.detail||i)})}),(0,Y.jsx)(Tt,{task:r?.id===t?r:void 0,artifacts:o,onOpenArtifact:s}),(0,Y.jsx)(`div`,{className:`my-3`,children:(0,Y.jsx)(Xe,{card:n,cardKey:e,taskId:t,readOnly:c,context:f?.questionContext})})]})}var X=e(r(),1);function Dt({sid:e,record:t,expanded:n=!1,zh:r}){let[i,a]=(0,X.useState)(n),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(!1),[d,f]=(0,X.useState)(``);(0,X.useEffect)(()=>{if(!i||!e)return;let n=new AbortController;return l(!0),f(``),u.workRecord(e,t.role,t.id,n.signal).then(e=>{n.signal.aborted||s(e.detail)}).catch(e=>{n.signal.aborted||f(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||l(!1)}),()=>n.abort()},[i,e,t.id,t.role,t.detail]);let p=o.length>=t.detail.length?o:t.detail;return(0,Y.jsxs)(`details`,{open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(`span`,{children:i?r?`收起详情`:`Hide details`:r?`展开完整记录`:`Read full record`}),(0,Y.jsx)(g,{size:12})]}),(0,Y.jsxs)(Y.Fragment,{children:[c&&(0,Y.jsx)(`small`,{role:`status`,children:r?`正在读取完整记录…`:`Loading the full record…`}),d&&(0,Y.jsx)(`small`,{role:`status`,children:r?`暂未读取到完整记录,已显示保存的摘要。可收起后重试。`:`Full record unavailable; the saved preview is shown. Reopen to retry.`}),(0,Y.jsx)(`div`,{className:`agent-record-actions`,children:(0,Y.jsx)(b,{text:p,label:r?`复制完整记录`:`Copy full record`,copiedLabel:r?`已复制`:`Copied`})}),(0,Y.jsx)(`div`,{className:`agent-record-detail`,children:(0,Y.jsx)(S,{children:p})}),t.round_index!=null&&(0,Y.jsx)(`small`,{children:r?`第 ${t.round_index} 轮`:`Round ${t.round_index}`})]})]})}function Ot({sid:e,view:t,roles:n=[],events:r=[],taskId:i,paused:a=!1,selectedRole:o,onSelectRole:s,onClose:c,showTabs:l=!0}){let{locale:f,t:p}=d(),m=f===`zh-CN`,[g,v]=(0,X.useState)(null),[b,C]=(0,X.useState)(24),[T,E]=(0,X.useState)(!1),[D,j]=(0,X.useState)(``),[M,N]=(0,X.useState)(Date.now),F=o||g||n.find(e=>e.active)?.role||t?.active_role||`manager`,I=it(t,n,F,a,i),L=Le(t,F,i).map(e=>{let t=e.detail;for(let n of r){if(n.kind===`reasoning`)continue;let r=String(n.event_id||n.id||``),i=String(n.message_id||``);if(r!==e.id&&(!i||e.id!==`${e.role}:${i}`))continue;let a=Be(String(n.text||n.reason||n.summary||``));a.length>t.length&&(t=a)}return t===e.detail?e:{...e,detail:t}});(0,X.useEffect)(()=>{C(24),j(``)},[e,F,i]);let R=i?We(void 0,t,i):0,z=R?Le(t,F,i,R):L,B=z[0],V=z.find(e=>e.detail&&[`agent_message`,`assistant_message`,`decision`,`verdict`,`handoff`,`review`,`completion`].includes(e.kind)),H=Qe(r,F,i,R),U=H&&Number(H.ts||0)>=(B?.ts??0),W=!U&&B&&[`agent_message`,`assistant_message`].includes(B.kind)&&B.detail?B.detail.split(/[。\n]/)[0].slice(0,70):Je(U?String(H.kind):B?.kind||`task`,m,U?String(H.tool_name||``):``),te=n.find(e=>e.role===F)?.model||t?.roles.find(e=>e.role===F)?.model,G=B?Math.max(0,Math.floor(M/1e3-B.ts)):0,ne=Math.max(B?.ts??0,U?Number(H?.ts||0):0),re=I&&ne?Ye(M/1e3-ne,m):``;(0,X.useEffect)(()=>{if(!I)return;let e=setInterval(()=>N(Date.now()),1e3);return()=>clearInterval(e)},[I]);let ie=e=>O(e)?h(e,p):e;return(0,Y.jsxs)(`section`,{className:`agent-activity`,style:{"--agent-role-color":k(F)},"aria-label":m?`工作详情`:`Work details`,children:[(0,Y.jsxs)(`header`,{className:`agent-activity-heading`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(A,{size:15}),m?`工作详情`:`Work details`]}),c&&(0,Y.jsx)(`button`,{type:`button`,onClick:c,"aria-label":m?`关闭工作详情`:`Close work details`,children:(0,Y.jsx)(y,{size:17})})]}),l&&(0,Y.jsx)(`div`,{className:`agent-activity-tabs`,role:`group`,"aria-label":m?`筛选 Agent`:`Filter agents`,children:x.map(e=>(0,Y.jsxs)(`button`,{type:`button`,"data-role":e,"aria-pressed":F===e,style:{"--agent-role-color":k(e)},onClick:()=>{v(e),s?.(e)},children:[(0,Y.jsx)(`i`,{"data-active":it(t,n,e,a,i)}),ie(e)]},e))}),(0,Y.jsxs)(`div`,{className:`agent-current`,"data-active":I,children:[(0,Y.jsxs)(`div`,{className:`agent-current-kicker`,children:[(0,Y.jsx)(`span`,{children:I?m?`当前工作`:`Current work`:a?m?`工作已暂停`:`Work paused`:m?`最近进度`:`Latest progress`}),I?(0,Y.jsxs)(`span`,{className:`agent-live-indicator`,"data-stale":re?!0:void 0,children:[(0,Y.jsx)(`i`,{}),m?`处理中`:`In progress`,re&&(0,Y.jsx)(`small`,{className:`agent-live-stale`,children:re})]}):(0,Y.jsx)(P,{size:12})]}),(0,Y.jsx)(`h3`,{children:B||U?W:I?m?`尚无本次工作记录`:`No work recorded for this attempt yet`:m?`等待任务分配`:`Waiting for an assignment`}),V?.detail&&(0,Y.jsx)(`div`,{className:`agent-current-summary`,children:(0,Y.jsx)(S,{children:V.detail})}),!V&&B?.detail&&(0,Y.jsx)(`p`,{className:`agent-current-summary`,children:B.detail}),B&&(0,Y.jsxs)(`div`,{className:`agent-current-meta`,children:[(0,Y.jsx)(ee,{size:12}),(0,Y.jsx)(`span`,{children:m?`${G<60?G+` 秒`:G<3600?Math.floor(G/60)+` 分钟`:G<86400?Math.floor(G/3600)+` 小时`:Math.floor(G/86400)+` 天`}前更新`:`Updated ${G<60?G+`s`:G<3600?Math.floor(G/60)+`m`:G<86400?Math.floor(G/3600)+`h`:Math.floor(G/86400)+`d`} ago`})]}),(0,Y.jsxs)(`details`,{className:`agent-technical-details`,children:[(0,Y.jsx)(`summary`,{children:m?`查看运行信息`:`Runtime details`}),(0,Y.jsxs)(`p`,{children:[ie(F),te?` · ${te}`:``,B?.round_index==null?``:m?` · 第 ${B.round_index} 轮`:` · Round ${B.round_index}`]})]})]}),(0,Y.jsxs)(`div`,{className:`agent-records-heading`,children:[(0,Y.jsx)(`span`,{children:m?`工作记录`:`Work log`}),(0,Y.jsxs)(`span`,{children:[L.length,` `,m?`条`:`records`]})]}),(0,Y.jsxs)(`div`,{className:`agent-records`,role:`log`,"aria-live":`off`,children:[L.slice(0,b).map((t,n)=>{let r=I&&t.id===B?.id,i=[`done`,`completed`].includes(t.status),a=[`failed`,`error`,`rejected`].includes(t.status),o=i?_:[`tool_use`,`command_execution`].includes(t.kind)?w:ht;return(0,Y.jsxs)(`article`,{className:`agent-record`,"data-active":r,"data-failed":a,children:[(0,Y.jsx)(`span`,{className:`agent-record-icon`,children:(0,Y.jsx)(o,{size:13})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`agent-record-title`,children:[(0,Y.jsx)(`strong`,{children:Je(t.kind,m)}),(0,Y.jsx)(`time`,{children:new Date(t.ts*1e3).toLocaleTimeString(m?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})})]}),(0,Y.jsx)(`small`,{children:r?m?`进行中`:`In progress`:a?m?`未完成`:`Did not finish`:i?m?`已完成`:`Completed`:m?`已记录`:`Recorded`}),(t.detail||e)&&(0,Y.jsx)(Dt,{sid:e,record:t,zh:m,expanded:n===0||t.id===V?.id})]})]},t.id)}),!L.length&&(0,Y.jsx)(`p`,{className:`agent-records-empty`,children:m?`${ie(F)}尚未留下这个任务的工作记录。`:`No work has been recorded for this task by ${ie(F)}.`})]}),(0,Y.jsxs)(`div`,{className:`agent-records-footer`,children:[bC(e=>e+24),children:m?`加载更早记录(还剩 ${L.length-b} 条)`:`Load earlier records (${L.length-b} remaining)`}),e&&(0,Y.jsx)(`button`,{type:`button`,disabled:T,onClick:()=>{E(!0),j(``),u.downloadWorkLog(e,F,i).catch(e=>j(e instanceof Error?e.message:String(e))).finally(()=>E(!1))},children:T?m?`正在准备完整记录…`:`Preparing full log…`:m?`下载完整工作记录(含更早历史)`:`Download full work log (including earlier history)`}),D&&(0,Y.jsx)(`small`,{role:`alert`,children:D})]})]})}var kt=l(),Z=(e,t,n)=>e+(t-e)*n,At=e=>e*e*(3-2*e),jt=(e,t,n)=>Math.max(t,Math.min(n,e));function Mt(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y),i=Math.min(140,Math.max(54,r*.22))*(t.x>=e.x?-1:1),a=Math.min(120,r*.3),o={x:jt(e.x+i,28,n-28),y:e.y-a},s={x:jt(t.x+i*.6,28,n-28),y:t.y+a};return n=>{let r=1-n;return{x:r**3*e.x+3*r**2*n*o.x+3*r*n**2*s.x+n**3*t.x,y:r**3*e.y+3*r**2*n*o.y+3*r*n**2*s.y+n**3*t.y}}}function Nt({flight:e,canvas:t,zh:n,historical:r=!1,onReveal:i,onLand:a,onFinish:o}){let s=(0,X.useRef)(null),c=(0,X.useRef)(null),l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=`dispatch-wake-${(0,X.useId)().replace(/:/g,``)}`,f=(0,X.useRef)({onReveal:i,onLand:a,onFinish:o});f.current={onReveal:i,onLand:a,onFinish:o};let p=e.result?.type===`task`&&!r;return(0,X.useEffect)(()=>{if(!e.result)return;let n=0,i,a,o=()=>f.current.onFinish(e.id);if(e.result.type!==`task`||r)return i=setTimeout(o,2200),()=>clearTimeout(i);let d=s.current;if(!d)return;let p=e.result.taskId,m=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,h=t.current,g=()=>{cancelAnimationFrame(n),clearTimeout(i),f.current.onLand(e.id),o()};h?.addEventListener(`pointerdown`,g,{once:!0}),h?.addEventListener(`wheel`,g,{once:!0,passive:!0});let _=performance.now(),v=0,y=!1,b=0,x,S=r=>{if(r-_>6e3){o();return}let s=t.current?.querySelector(`.map-macro[data-task-id="${CSS.escape(p)}"]`);if(!s||s.getBoundingClientRect().width<8){r-v>600&&(f.current.onReveal(p),v=r),n=requestAnimationFrame(S);return}if(m){f.current.onLand(e.id),i=setTimeout(o,1200);return}y||(f.current.onReveal(p),y=!0,v=r);let h=s.getBoundingClientRect();if((!x||Math.abs(x.x-h.x)+Math.abs(x.y-h.y)+Math.abs(x.width-h.width)>.7)&&(b=r),x=h,r-v<360||r-b<100){n=requestAnimationFrame(S);return}let g=t.current?.querySelector(`.map-composer`)?.getBoundingClientRect(),C=g?{x:g.left,y:g.top,width:g.width,height:g.height}:e.origin,w={x:C.x+C.width/2,y:C.y+C.height/2},T={x:w.x,y:w.y-26},E={x:h.left+h.width/2,y:h.top+h.height/2},D=Mt(T,E,innerWidth),O=Math.min(320,C.width),k=Math.min(68,C.height),A=performance.now(),j=!1,M=t=>{if(!s.isConnected){o();return}let r=Math.min(1,(t-A)/1050),p=At(Math.min(1,r/.22)),m=At(jt((r-.22)/.6,0,1)),h=At(jt((r-.82)/.18,0,1)),g=r<.22?{x:w.x,y:Z(w.y,T.y,p)}:D(m),_=Z(52,22,h),v=Z(O,_,p),y=Z(k,_,p);if(d.style.width=`${v}px`,d.style.height=`${y}px`,d.style.transform=`translate3d(${g.x-v/2}px,${g.y-y/2}px,0)`,d.style.opacity=String(Math.min(1,r/.045)*(1-h)),d.style.setProperty(`--dispatch-copy`,String(1-At(Math.min(1,r/.12)))),d.style.setProperty(`--dispatch-mark`,String(Z(1,.7,h))),d.dataset.phase=r<.22?`compress`:r<.82?`travel`:`arrive`,c.current&&l.current&&r>.22){let e=Math.max(0,m-.16),t=Array.from({length:13},(t,n)=>D(Z(e,m,n/12)));c.current.setAttribute(`d`,t.map((e,t)=>`${t?`L`:`M`} ${e.x} ${e.y}`).join(` `)),c.current.style.opacity=String(.7*(1-h)),l.current.setAttribute(`x1`,String(t[0].x)),l.current.setAttribute(`y1`,String(t[0].y)),l.current.setAttribute(`x2`,String(g.x)),l.current.setAttribute(`y2`,String(g.y))}r>=.82&&!j&&(j=!0,f.current.onLand(e.id),u.current&&(u.current.style.left=`${E.x}px`,u.current.style.top=`${E.y}px`,a=u.current.animate([{transform:`translate(-50%,-50%) scale(.65)`,opacity:.65},{transform:`translate(-50%,-50%) scale(2.8)`,opacity:0}],{duration:650,easing:`cubic-bezier(.16,1,.3,1)`,fill:`both`}))),r<1?n=requestAnimationFrame(M):i=setTimeout(o,550)};n=requestAnimationFrame(M)};return n=requestAnimationFrame(S),()=>{cancelAnimationFrame(n),clearTimeout(i),a?.cancel(),h?.removeEventListener(`pointerdown`,g),h?.removeEventListener(`wheel`,g)}},[e.id,e.result,t,r]),p?(0,kt.createPortal)((0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`svg`,{className:`map-dispatch-trail`,"aria-hidden":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{ref:l,id:d,gradientUnits:`userSpaceOnUse`,children:[(0,Y.jsx)(`stop`,{stopColor:`#6fbcce`,stopOpacity:`0`}),(0,Y.jsx)(`stop`,{offset:`1`,stopColor:`#87d9cf`})]})}),(0,Y.jsx)(`path`,{ref:c,fill:`none`,stroke:`url(#${d})`,strokeWidth:`2.5`,strokeLinecap:`round`})]}),(0,Y.jsxs)(`div`,{ref:s,className:`map-dispatch-flight`,"data-testid":`map-dispatch-flight`,"data-state":`task`,"data-task-id":e.result?.type===`task`?e.result.taskId:void 0,"aria-hidden":`true`,children:[(0,Y.jsx)(`div`,{className:`map-dispatch-symbol`,children:(0,Y.jsx)(V,{size:25})}),(0,Y.jsxs)(`div`,{className:`map-dispatch-copy`,children:[(0,Y.jsx)(`strong`,{children:e.text}),(0,Y.jsx)(`span`,{children:n?`进入任务地图`:`Into your task map`})]})]}),(0,Y.jsx)(`div`,{ref:u,className:`map-dispatch-halo`,"aria-hidden":`true`})]}),document.body):null}var Pt=()=>({revision:0,cards:{},steps:{},links:{}}),Ft=(e,t)=>`${e}\u0000${t}`,It=class{initialized=!1;seen=new Set;revision=0;loadingHistory=!1;observe(e,t=!1){let n=Pt(),r=0;for(let t of e.cards){this.seen.has(`card:${t.id}`)||(n.cards[t.id]=Math.min(r++*100,400)),this.seen.add(`card:${t.id}`);let i=e.layouts[t.id],a=0;for(let e of i.steps){let r=Ft(t.id,e.id);this.seen.has(`step:${r}`)||(n.steps[r]=160+Math.min(a++*120,720)),this.seen.add(`step:${r}`)}for(let e of i.links){let r=Ft(t.id,e.id);this.seen.has(`link:${r}`)||(n.links[r]=Math.max(0,(n.steps[Ft(t.id,e.target)]??160)-160)),this.seen.add(`link:${r}`)}}for(let t of e.links)this.seen.has(`outer:${t.id}`)||(n.links[t.id]=0),this.seen.add(`outer:${t.id}`);let i=!this.initialized||t||this.loadingHistory;return this.loadingHistory=t,this.initialized=!0,i||![n.cards,n.steps,n.links].some(e=>Object.keys(e).length)?null:{...n,revision:++this.revision}}};function Lt(e,t=!1){let n=(0,X.useRef)(new It),r=(0,X.useRef)(new Set),[i,a]=(0,X.useState)(Pt);return(0,X.useEffect)(()=>{let i=n.current.observe(e,t);if(t)r.current.forEach(clearTimeout),r.current.clear(),a(Pt());else if(i){a(e=>({revision:i.revision,cards:{...e.cards,...i.cards},steps:{...e.steps,...i.steps},links:{...e.links,...i.links}}));let e=setTimeout(()=>{r.current.delete(e),a(e=>({revision:e.revision,cards:Object.fromEntries(Object.entries(e.cards).filter(([e])=>!(e in i.cards))),steps:Object.fromEntries(Object.entries(e.steps).filter(([e])=>!(e in i.steps))),links:Object.fromEntries(Object.entries(e.links).filter(([e])=>!(e in i.links)))}))},2e3);r.current.add(e)}},[e,t]),(0,X.useEffect)(()=>()=>{r.current.forEach(clearTimeout),r.current.clear()},[]),i}var Rt=e=>1-(1-e)**3;function zt(e,t,n){let r=Rt(Math.min(1,Math.max(0,n))),i={};for(let n in t){let a=e[n],o=t[n];i[n]=!a||r>=1?o:{x:a.x+(o.x-a.x)*r,y:a.y+(o.y-a.y)*r}}return i}function Bt(e,t){for(let n in t){let r=e[n];if(r&&(r.x!==t[n].x||r.y!==t[n].y))return!0}return!1}function Vt(e,t,n=680){let[r,i]=(0,X.useState)(e),a=(0,X.useRef)(e),o=(0,X.useRef)(e);return(0,X.useEffect)(()=>{if(e===o.current)return;o.current=e;let r=a.current;if(t||!Bt(r,e)||typeof requestAnimationFrame!=`function`){a.current=e,i(e);return}let s=null,c=performance.now(),l=t=>{let o=(t-c)/n;if(o>=1){a.current=e,i(e),s=null;return}a.current=zt(r,e,o),i(a.current),s=requestAnimationFrame(l)};return s=requestAnimationFrame(l),()=>{s!=null&&cancelAnimationFrame(s)}},[e,t,n]),r}var Ht={edges:new Set,nodes:new Set};function Ut(e,t){if(!t)return Ht;let n=new Set,r=new Set([t]);for(let i of e)(i.source===t||i.target===t)&&(n.add(i.id),r.add(i.source),r.add(i.target));return{edges:n,nodes:r}}var Wt=2600,Gt=e=>Math.min(Math.max(e-1,0),10)*80,Kt=e=>Gt(e)+320;function qt(e,t){let n=Math.max(0,Math.floor(e));if(n<60)return t?`${n} 秒`:`${n}s`;let r=Math.floor(n/60);if(r<60)return t?`${r} 分钟`:`${r} min`;let i=Math.floor(r/60),a=r%60;return t?`${i} 小时 ${a} 分`:`${i} h ${String(a).padStart(2,`0`)} min`}function Jt(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n{}};function Xt(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Zt.prototype=Xt.prototype={constructor:Zt,on:function(e,t){var n=this._,r=Qt(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),tn.hasOwnProperty(t)?{space:tn[t],local:e}:e}function rn(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function an(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function on(e){var t=nn(e);return(t.local?an:rn)(t)}function sn(){}function cn(e){return e==null?sn:function(){return this.querySelector(e)}}function ln(e){typeof e!=`function`&&(e=cn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i=v&&(v=_+1);!(b=g[v])&&++v=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function zn(e){e||=Bn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;at?1:e>=t?0:NaN}function Vn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Hn(){return Array.from(this)}function Un(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?tr:typeof t==`function`?rr:nr)(e,t,n??``)):ar(this.node(),e)}function ar(e,t){return e.style.getPropertyValue(t)||er(e).getComputedStyle(e,null).getPropertyValue(t)}function or(e){return function(){delete this[e]}}function sr(e,t){return function(){this[e]=t}}function cr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function lr(e,t){return arguments.length>1?this.each((t==null?or:typeof t==`function`?cr:sr)(e,t)):this.node()[e]}function ur(e){return e.trim().split(/^|\s+/)}function dr(e){return e.classList||new fr(e)}function fr(e){this._node=e,this._names=ur(e.getAttribute(`class`)||``)}fr.prototype={add:function(e){this._names.indexOf(e)<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 pr(e,t){for(var n=dr(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Hr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n()=>e;function ui(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){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:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}ui.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function di(e){return!e.ctrlKey&&!e.button}function fi(){return this.parentNode}function pi(e,t){return t??{x:e.x,y:e.y}}function mi(){return navigator.maxTouchPoints||`ontouchstart`in this}function hi(){var e=di,t=fi,n=pi,r=mi,i={},a=Xt(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,ri).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(ei(n.view).on(`mousemove.drag`,m,ii).on(`mouseup.drag`,h,ii),si(n.view),ai(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(oi(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){ei(e.view).on(`mousemove.drag mouseup.drag`,null),ci(e.view,l),oi(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ri(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ri(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=Ti.exec(e))?new Vi(t[1],t[2],t[3],1):(t=Ei.exec(e))?new Vi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Di.exec(e))?Ri(t[1],t[2],t[3],t[4]):(t=Oi.exec(e))?Ri(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ki.exec(e))?Ji(t[1],t[2]/100,t[3]/100,1):(t=Ai.exec(e))?Ji(t[1],t[2]/100,t[3]/100,t[4]):ji.hasOwnProperty(e)?Li(ji[e]):e===`transparent`?new Vi(NaN,NaN,NaN,0):null}function Li(e){return new Vi(e>>16&255,e>>8&255,e&255,1)}function Ri(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vi(e,t,n,r)}function zi(e){return e instanceof vi||(e=Ii(e)),e?(e=e.rgb(),new Vi(e.r,e.g,e.b,e.opacity)):new Vi}function Bi(e,t,n,r){return arguments.length===1?zi(e):new Vi(e,t,n,r??1)}function Vi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}gi(Vi,Bi,_i(vi,{brighter(e){return e=e==null?bi:bi**+e,new Vi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yi:yi**+e,new Vi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vi(Ki(this.r),Ki(this.g),Ki(this.b),Gi(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:Hi,formatHex:Hi,formatHex8:Ui,formatRgb:Wi,toString:Wi}));function Hi(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}`}function Ui(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}${qi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Wi(){let e=Gi(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Ki(this.r)}, ${Ki(this.g)}, ${Ki(this.b)}${e===1?`)`:`, ${e})`}`}function Gi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ki(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function qi(e){return e=Ki(e),(e<16?`0`:``)+e.toString(16)}function Ji(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Zi(e,t,n,r)}function Yi(e){if(e instanceof Zi)return new Zi(e.h,e.s,e.l,e.opacity);if(e instanceof vi||(e=Ii(e)),!e)return new Zi;if(e instanceof Zi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Zi(o,s,c,e.opacity)}function Xi(e,t,n,r){return arguments.length===1?Yi(e):new Zi(e,t,n,r??1)}function Zi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}gi(Zi,Xi,_i(vi,{brighter(e){return e=e==null?bi:bi**+e,new Zi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yi:yi**+e,new Zi(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,i=2*n-r;return new Vi(ea(e>=240?e-240:e+120,i,r),ea(e,i,r),ea(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Zi(Qi(this.h),$i(this.s),$i(this.l),Gi(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(){let e=Gi(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Qi(this.h)}, ${$i(this.s)*100}%, ${$i(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Qi(e){return e=(e||0)%360,e<0?e+360:e}function $i(e){return Math.max(0,Math.min(1,e||0))}function ea(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ta=e=>()=>e;function na(e,t){return function(n){return e+n*t}}function ra(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ia(e){return(e=+e)==1?aa:function(t,n){return n-t?ra(t,n,e):ta(isNaN(t)?n:t)}}function aa(e,t){var n=t-e;return n?na(e,n):ta(isNaN(e)?t:e)}var oa=(function e(t){var n=ia(t);function r(e,t){var r=n((e=Bi(e)).r,(t=Bi(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=aa(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function sa(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:da(r,i)})),n=ma.lastIndex;return n180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:da(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:da(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:da(e,n)},{i:s-2,x:da(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t=0&&e._call.call(void 0,t),e=e._next;--Na}function Ya(){Ba=(za=Ha.now())+Va,Na=Pa=0;try{Ja()}finally{Na=0,Za(),Ba=0}}function Xa(){var e=Ha.now(),t=e-za;t>Ia&&(Va-=t,za=e)}function Za(){for(var e,t=La,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:La=n);Ra=e,Qa(r)}function Qa(e){Na||(Pa&&=clearTimeout(Pa),e-Ba>24?(e<1/0&&(Pa=setTimeout(Ya,e-Ha.now()-Va)),Fa&&=clearInterval(Fa)):(Fa||=(za=Ha.now(),setInterval(Xa,Ia)),Na=1,Ua(Ya)))}function $a(e,t,n){var r=new Ka;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var eo=Xt(`start`,`end`,`cancel`,`interrupt`),to=[];function no(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;oo(e,n,{name:t,index:r,group:i,on:eo,tween:to,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function ro(e,t){var n=ao(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function io(e,t){var n=ao(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function ao(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function oo(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=qa(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return $a(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function co(e){return this.each(function(){so(this,e)})}function lo(e,t){var n,r;return function(){var i=io(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o=0&&(e=e.slice(0,t)),!e||e===`start`})}function Bo(e,t,n){var r,i,a=zo(t)?ro:io;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Vo(e,t){var n=this._id;return arguments.length<2?ao(this.node(),n).on.on(e):this.each(Bo(n,e,t))}function Ho(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Uo(){return this.on(`end.remove`,Ho(this._id))}function Wo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=cn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o()=>e;function bs(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function xs(e,t,n){this.k=e,this.x=t,this.y=n}xs.prototype={constructor:xs,scale:function(e){return e===1?this:new xs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new xs(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 Ss=new xs(1,0,0);Cs.prototype=xs.prototype;function Cs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ss;return e.__zoom}function ws(e){e.stopImmediatePropagation()}function Ts(e){e.preventDefault(),e.stopImmediatePropagation()}function Es(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Ds(){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 Os(){return this.__zoom||Ss}function ks(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function As(){return navigator.maxTouchPoints||`ontouchstart`in this}function js(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Ms(){var e=Es,t=Ds,n=js,r=ks,i=As,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Ma,l=Xt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Os).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Os),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Ss.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new xs(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new xs(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new xs(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=ei(this.that).datum();l.call(e,this.that,new bs(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=ni(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],so(this),s.start();Ts(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=ei(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=ni(t,i),l=t.clientX,u=t.clientY;si(t.view),ws(t),a.mouse=[c,this.__zoom.invert(c)],so(this),a.start();function d(e){if(Ts(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=ni(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),ci(e.view,a.moved),Ts(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=ni(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Ts(r),s>0?ei(this).transition().duration(s).call(x,d,c,r):ei(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(ws(t),s=0;s`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} 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.`},Ps=[[-1/0,-1/0],[1/0,1/0]],Fs=[`Enter`,` `,`Escape`],Is={"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`},Ls;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Ls||={});var Rs;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Rs||={});var zs;(function(e){e.Partial=`partial`,e.Full=`full`})(zs||={});var Bs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Vs;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(Vs||={});var Hs;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Hs||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var Us={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function Ws(e){return e===null?null:e?`valid`:`invalid`}var Gs=e=>`id`in e&&`source`in e&&`target`in e,Ks=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),qs=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Js=(e,t=[0,0])=>{let{width:n,height:r}=Oc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ys=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:uc(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):qs(n)?n:t.nodeLookup.get(n.id)),cc(e,i?fc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Xs=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=cc(n,fc(e)),r=!0)}),r?uc(n):{x:0,y:0,width:0,height:0}},Zs=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=mc(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Qs=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function $s(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function ec({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Tc(Xs($s(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function tc({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,Ns.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&Dc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Dc(d)?ic(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Ns.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function nc({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Qs(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var rc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ic=(e={x:0,y:0},t,n)=>({x:rc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:rc(e.y,t[0][1],t[1][1]-(n?.height??0))});function ac(e,t,n){let{width:r,height:i}=Oc(n),{x:a,y:o}=n.internals.positionAbsolute;return ic(e,[[a,o],[a+r,o+i]],t)}var oc=(e,t,n)=>en?-rc(Math.abs(e-n),1,t)/t:0,sc=(e,t,n=15,r=40)=>[oc(e.x,r,t.width-r)*n,oc(e.y,r,t.height-r)*n],cc=(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)}),lc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),uc=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),dc=(e,t=[0,0])=>{let{x:n,y:r}=qs(e)?e.internals.positionAbsolute:Js(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},fc=(e,t=[0,0])=>{let{x:n,y:r}=qs(e)?e.internals.positionAbsolute:Js(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},pc=(e,t)=>uc(cc(lc(e),lc(t))),mc=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},hc=(e,t)=>mc(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),gc=e=>_c(e.width)&&_c(e.height)&&_c(e.x)&&_c(e.y),_c=e=>!isNaN(e)&&isFinite(e),vc=(e,t)=>(e,t)=>{},yc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),bc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?yc(s,o):s},xc=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Sc(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let 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 Cc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=Sc(e,n),i=Sc(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=Sc(e.top??e.y??0,n),i=Sc(e.bottom??e.y??0,n),a=Sc(e.left??e.x??0,t),o=Sc(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function wc(e,t,n,r,i,a){let{x:o,y:s}=xc(e,[t,n,r]),{x:c,y:l}=xc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Tc=(e,t,n,r,i,a)=>{let o=Cc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=rc(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=wc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Ec=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Dc(e){return e!=null&&e!==`parent`}function Oc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function kc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ac(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function jc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Mc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Nc(e){return{...Is,...e||{}}}function Pc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Bc(e),s=bc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?yc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Fc=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ic=e=>e?.getRootNode?.()||window?.document,Lc=[`INPUT`,`SELECT`,`TEXTAREA`];function Rc(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Lc.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var zc=e=>`clientX`in e,Bc=(e,t)=>{let n=zc(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Vc=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Fc(t)}})};function Hc({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Uc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wc({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Uc(t-r,a),n];case Q.Right:return[t+Uc(r-t,a),n];case Q.Top:return[t,n-Uc(n-i,a)];case Q.Bottom:return[t,n+Uc(i-n,a)]}}function Gc({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Wc({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Wc({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Hc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Kc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n0}var Yc=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Xc=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Zc=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Ns.error006()),t;let r=n.getEdgeId||Yc,i;return i=Gs(e)?{...e}:{...e,id:r(e)},Xc(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Qc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Kc({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var $c={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},el=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.xMath.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function nl({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=$c[t],c=$c[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=el({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Kc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function rl(e,t,n,r){let i=Math.min(tl(e,t)/2,tl(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.xe.id===t):e[0])||null}function ul(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function dl(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=ul(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var fl=1e3,pl=10,ml={nodeOrigin:[0,0],nodeExtent:Ps,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},hl={...ml,checkEquality:!0};function gl(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function _l(e,t,n){let r=gl(ml,n);for(let n of e.values())if(n.parentId)Sl(n,e,t,r);else{let e=ic(Js(n,r.nodeOrigin),Dc(n.extent)?n.extent:r.nodeExtent,Oc(n));n.internals.positionAbsolute=e}}function vl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function yl(e){return e===`manual`}function bl(e,t,n,r={}){let i=gl(hl,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!yl(i.zIndexMode)?fl:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=ic(Js(u,i.nodeOrigin),Dc(u.extent)?u.extent:i.nodeExtent,Oc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:vl(u,e),z:Cl(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&Sl(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function xl(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Sl(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=gl(ml,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xl(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*pl),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=wl(e,u,o,s,a&&!yl(c)?fl:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function Cl(e,t,n){let r=_c(e.zIndex)?e.zIndex:0;return yl(n)?r:r+(e.selected?t:0)}function wl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Oc(e),l=Js(e,n),u=Dc(e.extent)?ic(l,e.extent,c):l,d=ic({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=ac(d,c,t));let f=Cl(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Tl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=pc(a.get(n.parentId)?.expandedRect??dc(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Oc(a),l=a.origin??r,u=t.x0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width0){let e=Tl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Dl({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Ol(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function kl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Ol(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Ol(`target`,s,c,e,i,o),t.set(r.id,r)}}function Al(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Al(n,t):!1}function jl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Ml(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Al(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Nl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Pl({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=yc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Fl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=ei(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?lc(Xs(s)):null,x=v&&l?Pl({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:yc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=tc({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Nl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=sc(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=Pc(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Ml(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Nl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=hi().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Pc(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Bc(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Pc(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Bc(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Bc(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Nl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!jl(t,`.${g}`,v))&&(!_||jl(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Il(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())hc(i,dc(e))>0&&r.push(e);return r}var Ll=250;function Rl(e,t,n,r){let i=[],a=1/0,o=Il(e,n,t+Ll);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=cl(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function zl(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...cl(o,c,c.position,!0)}:c}function Bl(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Vl(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Hl=()=>!0;function Ul(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Hl,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Ic(e.target),E=0,D,{x:O,y:k}=Bc(e),A=Bl(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=zl(i,A,r,c,t);if(!N)return;let P=Bc(e,j),F=!1,ee=null,I=!1,L=null;function R(){if(!u||!j)return;let[e,t]=sc(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(R)}let z={...N,nodeId:i,type:A,position:N.position},B=c.get(i),V={inProgress:!0,isValid:null,from:cl(B,z,Q.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:B,to:P,toHandle:null,toPosition:Us[z.position],toNode:null,pointer:P};function H(){M=!0,y(V),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&H();function U(e){if(!M){let{x:t,y:n}=Bc(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;H()}if(!x()||!z){W(e);return}let a=b();P=Bc(e,j),D=Rl(bc(P,a,!1,[1,1]),n,c,z),F||=(R(),!0);let s=Wl(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,ee=s.connection,I=Vl(!!D,s.isValid);let u=c.get(i),f=u?cl(u,z,Q.Left,!0):V.from,p={...V,from:f,isValid:I,to:s.toHandle&&I?xc({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:Us[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),V=p}function W(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&ee&&I&&h?.(ee);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,I=!1,ee=null,L=null,T.removeEventListener(`mousemove`,U),T.removeEventListener(`mouseup`,W),T.removeEventListener(`touchmove`,U),T.removeEventListener(`touchend`,W)}}T.addEventListener(`mousemove`,U),T.addEventListener(`mouseup`,W),T.addEventListener(`touchmove`,U),T.addEventListener(`touchend`,W)}function Wl(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Hl,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Bc(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=Bl(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===Ls.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=zl(t,e,a,u,n,!0)}return _}var Gl={onPointerDown:Ul,isValid:Wl};function Kl({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=ei(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Ec()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=Ms().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:ni}}var ql=e=>({x:e.x,y:e.y,zoom:e.k}),Jl=({x:e,y:t,zoom:n})=>Ss.translate(e,t).scale(n),Yl=(e,t)=>e.target.closest(`.${t}`),Xl=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zl=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ql=(e,t=0,n=Zl,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},$l=e=>{let t=e.ctrlKey&&Ec()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function eu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Yl(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=ni(u),t=d*2**$l(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Rs.Vertical?0:u.deltaX*f,m=i===Rs.Horizontal?0:u.deltaY*f;!Ec()&&u.shiftKey&&i!==Rs.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=ql(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function tu({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=Yl(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function nu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=ql(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function ru({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Xl(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,ql(a.transform))}}function iu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Xl(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=ql(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function au({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(Yl(d,`${l}-flow__node`)||Yl(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||Yl(d,s)&&m||Yl(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function ou({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Ms().scaleExtent([t,n]).translateExtent(r),f=ei(e).call(d);v({x:i.x,y:i.y,zoom:rc(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta($l);async function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?va:Ma).transform(Ql(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!_c(E)||E<0?0:E);let k=O?eu({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):tu({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});f.on(`wheel.zoom`,k,{passive:!1});let A=nu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,A);let j=ru({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,j);let M=iu({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,M);let N=au({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(N),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=Jl(e),i=d?.constrain()(r,t,n);return i&&await h(i),i}async function y(e,t){let n=Jl(e);return await h(n,t),n}function b(e){if(f){let t=Jl(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?Cs(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?va:Ma).scaleTo(Ql(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?va:Ma).scaleBy(Ql(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!_c(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var su;(function(e){e.Line=`line`,e.Handle=`handle`})(su||={});function cu({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function lu(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function uu(e,t){return Math.max(0,t-e)}function du(e,t){return Math.max(0,e-t)}function fu(e,t,n){return Math.max(0,t-e,e-n)}function pu(e,t){return e?!t:t}function mu(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=fu(E,h,g),j=fu(D,_,v);if(o){let e=0,t=0;c&&w<0?e=uu(y+w+O,o[0][0]):!c&&w>0&&(e=du(y+E+O,o[1][0])),l&&T<0?t=uu(b+T+k,o[0][1]):!l&&T>0&&(t=du(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=du(y+w,s[0][0]):!c&&w<0&&(e=uu(y+E,s[1][0])),l&&T>0?t=du(b+T,s[0][1]):!l&&T<0&&(t=uu(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=fu(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?du(b+k+E/C,o[1][1])*C:uu(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?uu(b+E/C,s[1][1])*C:du(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=fu(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?du(y+D*C+O,o[1][0])/C:uu(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?uu(y+D*C,s[1][0])/C:du(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(pu(c,l)?-w:w)/C:w=(pu(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var hu={width:0,height:0,x:0,y:0},gu={...hu,pointerX:0,pointerY:0,aspectRatio:1};function _u(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function vu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=ei(e),o={controlDirection:lu(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...hu},h={...gu};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:lu(e)};let g,_=null,v=[],y,b,x,S=!1,C=hi().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=Pc(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Dc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=_u(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=Pc(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=mu(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var yu=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),bu=t(((e,t)=>{t.exports=yu()})),xu=t((e=>{var t=r(),n=bu();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Su=e(t(((e,t)=>{t.exports=xu()}))(),1),Cu=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},wu=e=>e?Cu(e):Cu,{useDebugValue:Tu}=X.default,{useSyncExternalStoreWithSelector:Eu}=Su.default,Du=e=>e;function Ou(e,t=Du,n){let r=Eu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Tu(r),r}var ku=(e,t)=>{let n=wu(e),r=(e,r=t)=>Ou(n,e,r);return Object.assign(r,n),r},Au=(e,t)=>e?ku(e,t):ku;function ju(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Mu=(0,X.createContext)(null),Nu=Mu.Provider,Pu=Ns.error001(`react`);function $(e,t){let n=(0,X.useContext)(Mu);if(n===null)throw Error(Pu);return Ou(n,e,t)}function Fu(){let e=(0,X.useContext)(Mu);if(e===null)throw Error(Pu);return(0,X.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Iu={display:`none`},Lu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Ru=`react-flow__node-desc`,zu=`react-flow__edge-desc`,Bu=`react-flow__aria-live`,Vu=e=>e.ariaLiveMessage,Hu=e=>e.ariaLabelConfig;function Uu({rfId:e}){let t=$(Vu);return(0,Y.jsx)(`div`,{id:`${Bu}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Lu,children:t})}function Wu({rfId:e,disableKeyboardA11y:t}){let n=$(Hu);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{id:`${Ru}-${e}`,style:Iu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Y.jsx)(`div`,{id:`${zu}-${e}`,style:Iu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Y.jsx)(Uu,{rfId:e})]})}var Gu=(0,X.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,Y.jsx)(`div`,{className:Jt([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Gu.displayName=`Panel`;var Ku=`https://reactflow.dev?utm_source=attribution`;function qu({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Y.jsx)(Gu,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ku}`,children:(0,Y.jsx)(`a`,{href:Ku,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var Ju=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Yu=e=>e.id;function Xu(e,t){return ju(e.selectedNodes.map(Yu),t.selectedNodes.map(Yu))&&ju(e.selectedEdges.map(Yu),t.selectedEdges.map(Yu))}function Zu({onSelectionChange:e}){let t=Fu(),{selectedNodes:n,selectedEdges:r}=$(Ju,Xu);return(0,X.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Qu=e=>!!e.onSelectionChangeHandlers;function $u({onSelectionChange:e}){let t=$(Qu);return e||t?(0,Y.jsx)(Zu,{onSelectionChange:e}):null}var ed=[0,0],td={x:0,y:0,zoom:1},nd=[...`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`.split(`.`),`rfId`],rd=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}),id={translateExtent:Ps,nodeOrigin:ed,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function ad(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(rd,ju),l=Fu();(0,X.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=id,s()}),[]);let u=(0,X.useRef)(id);return(0,X.useEffect)(()=>{for(let s of nd){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Nc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},nd.map(t=>e[t])),null}function od(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function sd(e){let[t,n]=(0,X.useState)(e===`system`?null:e);return(0,X.useEffect)(()=>{if(e!==`system`){n(e);return}let t=od(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?od()?.matches?`dark`:`light`:t}var cd=typeof document<`u`?document:null;function ld(e=null,t={target:cd,actInsideInputWithModifier:!0}){let[n,r]=(0,X.useState)(!1),i=(0,X.useRef)(!1),a=(0,X.useRef)(new Set([])),[o,s]=(0,X.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,` +`).replace(` + +`,` ++`).split(` +`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,X.useEffect)(()=>{let n=t?.target??cd,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&Rc(e))return!1;let n=dd(e.code,s);if(a.current.add(e[n]),ud(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=dd(e.code,s);ud(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function ud(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function dd(e,t){return t.includes(e)?`code`:`key`}var fd=()=>{let e=Fu();return(0,X.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=Tc(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return bc(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=xc(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function pd(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)md(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function md(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(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)}}function hd(e,t){return pd(e,t)}function gd(e,t){return pd(e,t)}function _d(e,t){return{id:e,type:`select`,selected:t}}function vd(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(_d(a.id,e)))}return r}function yd({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function bd(e){return{id:e.id,type:`remove`}}var xd=vc(`React Flow`,`https://reactflow.dev/`);function Sd(e,t,n={}){return Zc(e,t,{...n,onError:n.onError??xd})}var Cd=e=>Ks(e),wd=e=>Gs(e);function Td(e){return(0,X.forwardRef)(e)}var Ed=typeof window<`u`?X.useLayoutEffect:X.useEffect;function Dd(e){let[t,n]=(0,X.useState)(BigInt(0)),[r]=(0,X.useState)(()=>Od(()=>n(e=>e+BigInt(1))));return Ed(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Od(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var kd=(0,X.createContext)(null);function Ad({children:e}){let t=Fu(),n=Dd((0,X.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=yd({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Dd((0,X.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(yd({items:s,lookup:o}))},[])),i=(0,X.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,Y.jsx)(kd.Provider,{value:i,children:e})}function jd(){let e=(0,X.useContext)(kd);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Md=e=>!!e.panZoom;function Nd(){let e=fd(),t=Fu(),n=jd(),r=$(Md),i=(0,X.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=Cd(e)?e:n.get(e.id),a=i.parentId?Ac(i.position,i.measured,i.parentId,n,r):i.position;return dc({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Cd(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&wd(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await nc({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(bd);o?.(f),c(e)}if(m){let e=d.map(bd);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=gc(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=dc(s?r:a),l=hc(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=gc(e)?e:a(e);if(!r)return!1;let i=hc(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Ys(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??Mc();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,X.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Pd=e=>e.selected,Fd=typeof window<`u`?window:void 0;function Id({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=Fu(),{deleteElements:r}=Nd(),i=ld(e,{actInsideInputWithModifier:!1}),a=ld(t,{target:Fd});(0,X.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Pd),edges:e.filter(Pd)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,X.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Ld(e){let t=Fu();(0,X.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Fc(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,Ns.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var Rd={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},zd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Bd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=Rs.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=Fu(),S=(0,X.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=$(zd,ju),E=ld(f),D=(0,X.useRef)();Ld(S);let O=(0,X.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,X.useEffect)(()=>{if(S.current){D.current=ou({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,X.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,Y.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:Rd,children:m})}var Vd=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Hd(){let{userSelectionActive:e,userSelectionRect:t}=$(Vd,ju);return e&&t?(0,Y.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}var Ud=(e,t)=>n=>{n.target===t.current&&e?.(n)},Wd=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Gd({isSelecting:e,selectionKeyPressed:t,selectionMode:n=zs.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,X.useRef)(0),_=Fu(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(Wd,ju),C=y&&(e||v),w=(0,X.useRef)(null),T=(0,X.useRef)(),E=(0,X.useRef)(new Set),D=(0,X.useRef)(new Set),O=(0,X.useRef)(!1),k=(0,X.useRef)(!1),A=(0,X.useRef)({x:0,y:0}),j=(0,X.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},ee=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=Bc(n.nativeEvent,T.current),l=bc({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function I(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=xc(d,i),m={startX:d.x,startY:d.y,x:ee.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}jc(h,E.current)||c(vd(a,E.current,!0)),jc(g,D.current)||l(vd(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function L(){if(!i||!T.current)return;let[e,t]=sc(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(L);return}let{x:t,y:n}=A.current;I(t,n),g.current=requestAnimationFrame(L)})}let R=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,X.useEffect)(()=>()=>R(),[]);let z=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Bc(e.nativeEvent,T.current);A.current={x:o,y:c};let l=xc({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(L(),!0),I(o,c)},B=e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),R())},V=e=>{e.target?.releasePointerCapture?.(e.pointerId),R()},H=r===!0||Array.isArray(r)&&r.includes(0);return(0,Y.jsxs)(`div`,{className:Jt([`react-flow__pane`,{draggable:H,dragging:b,selection:e}]),onClick:C?void 0:Ud(M,w),onContextMenu:Ud(N,w),onWheel:Ud(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?z:p,onPointerUp:B,onPointerCancel:C?V:void 0,onPointerDownCapture:C?ee:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:Rd,children:[h,(0,Y.jsx)(Hd,{})]})}function Kd({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,Ns.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function qd({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=Fu(),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)();return(0,X.useEffect)(()=>{u.current=Fl({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Kd({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,X.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var Jd=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Yd(){let e=Fu();return(0,X.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Jd(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=yc(t,i));let{position:a,positionAbsolute:s}=tc({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Xd=(0,X.createContext)(null),Zd=Xd.Provider;Xd.Consumer;var Qd=()=>(0,X.useContext)(Xd),$d=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ef=(0,X.createContext)(null);function tf({children:e}){let t=$($d,ju);return(0,Y.jsx)(ef.Provider,{value:t,children:e})}function nf(){let e=(0,X.useContext)(ef);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var rf={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},af=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return rf;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===Ls.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function of({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=Fu(),_=Qd(),{connectOnClick:v,noPanClassName:y,rfId:b}=nf(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(af(_,m,e),ju);_||g.getState().onError?.(`010`,Ns.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(Sd(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=zc(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Gl.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,Y.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Jt([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=Ic(t.target),h=n||c,{connection:v,isValid:y}=Gl.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var sf=(0,X.memo)(Td(of));function cf({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[e?.label,(0,Y.jsx)(sf,{type:`source`,position:n,isConnectable:t})]})}function lf({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(sf,{type:`target`,position:n,isConnectable:t}),e?.label,(0,Y.jsx)(sf,{type:`source`,position:r,isConnectable:t})]})}function uf(){return null}function df({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(sf,{type:`target`,position:n,isConnectable:t}),e?.label]})}var ff={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},pf={input:cf,default:lf,output:df,group:uf};function mf(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var hf=e=>{let{width:t,height:n,x:r,y:i}=Xs(e.nodeLookup,{filter:e=>!!e.selected});return{width:_c(t)?t:null,height:_c(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function gf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=Fu(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(hf,ju),c=Yd(),l=(0,X.useRef)(null);(0,X.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(qd({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,Y.jsx)(`div`,{className:Jt([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,Y.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(ff,e.key)&&(e.preventDefault(),c({direction:ff[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var _f=typeof window<`u`?window:void 0,vf=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function yf({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:ee}){let{nodesSelectionActive:I,userSelectionActive:L}=$(vf,ju),R=ld(l,{target:_f}),z=ld(h,{target:_f}),B=z||w,V=z||b,H=u&&B!==!0,U=R||L||H;return Id({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,Y.jsx)(Bd,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:V,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!R&&B,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:ee,paneClickDistance:s,selectionOnDrag:H,children:(0,Y.jsxs)(Gd,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:B,autoPanOnSelection:T,isSelecting:!!U,selectionMode:d,selectionKeyPressed:R,paneClickDistance:s,selectionOnDrag:H,children:[e,I&&(0,Y.jsx)(gf,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}yf.displayName=`FlowRenderer`;var bf=(0,X.memo)(yf),xf=e=>t=>e?Zs(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function Sf(e){return $((0,X.useCallback)(xf(e),[e]),ju)}var Cf=e=>e.updateNodeInternals;function wf(){let e=$(Cf),[t]=(0,X.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,X.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Tf({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=Fu(),a=(0,X.useRef)(null),o=(0,X.useRef)(null),s=(0,X.useRef)(e.sourcePosition),c=(0,X.useRef)(e.targetPosition),l=(0,X.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,X.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,X.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,X.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Ef({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},ju),S=y.type||`default`,C=g?.[S]||pf[S];C===void 0&&(v?.(`003`,Ns.error003(S)),S=`default`,C=g?.default||pf.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=Fu(),k=kc(y),A=Tf({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=qd({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=Yd();if(y.hidden)return null;let N=Oc(y),P=mf(y),F=T||w||t||n||r||i,ee=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,R=a?e=>a(e,{...b.userNode}):void 0,z=o?e=>o(e,{...b.userNode}):void 0,B=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&Kd({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},V=t=>{if(!(Rc(t.nativeEvent)||m)){if(Fs.includes(t.key)&&T){let n=t.key===`Escape`;Kd({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(ff,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:ff[t.key],factor:t.shiftKey?4:1})}}},H=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Zs(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,Y.jsx)(`div`,{className:Jt([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:ee,onMouseMove:I,onMouseLeave:L,onContextMenu:R,onClick:B,onDoubleClick:z,onKeyDown:D?V:void 0,tabIndex:D?0:void 0,onFocus:D?H:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${Ru}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,Y.jsx)(Zd,{value:e,children:(0,Y.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var Df=(0,X.memo)(Ef),Of=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function kf(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=$(Of,ju),o=Sf(e.onlyRenderVisibleElements),s=wf();return(0,Y.jsx)(`div`,{className:`react-flow__nodes`,style:Rd,children:o.map(o=>(0,Y.jsx)(Df,{id:o,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:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}kf.displayName=`NodeRenderer`;var Af=(0,X.memo)(kf);function jf(e){return $((0,X.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Jc({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),ju)}var Mf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,Y.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},Nf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,Y.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},Pf={[Hs.Arrow]:Mf,[Hs.ArrowClosed]:Nf};function Ff(e){let t=Fu();return(0,X.useMemo)(()=>Object.prototype.hasOwnProperty.call(Pf,e)?Pf[e]:(t.getState().onError?.(`009`,Ns.error009(e)),null),[e])}var If=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Ff(t);return c?(0,Y.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,Y.jsx)(c,{color:n,strokeWidth:o})}):null},Lf=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,X.useMemo)(()=>dl(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,Y.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,Y.jsx)(`defs`,{children:i.map(e=>(0,Y.jsx)(If,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Lf.displayName=`MarkerDefinitions`;var Rf=(0,X.memo)(Lf);function zf({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,X.useState)({x:1,y:0,width:0,height:0}),p=Jt([`react-flow__edge-textwrapper`,l]),m=(0,X.useRef)(null);return(0,X.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,Y.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,Y.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,Y.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}zf.displayName=`EdgeText`;var Bf=(0,X.memo)(zf);function Vf({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{...u,d:e,fill:`none`,className:Jt([`react-flow__edge-path`,u.className])}),l?(0,Y.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&_c(t)&&_c(n)?(0,Y.jsx)(Bf,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Hf({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Uf({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=Hf({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Hf({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Hc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Wf(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Uf({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Gf=Wf({isInternal:!1}),Kf=Wf({isInternal:!0});Gf.displayName=`SimpleBezierEdge`,Kf.displayName=`SimpleBezierEdgeInternal`;function qf(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=il({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var Jf=qf({isInternal:!1}),Yf=qf({isInternal:!0});Jf.displayName=`SmoothStepEdge`,Yf.displayName=`SmoothStepEdgeInternal`;function Xf(e){return(0,X.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,Y.jsx)(Jf,{...n,id:r,pathOptions:(0,X.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Zf=Xf({isInternal:!1}),Qf=Xf({isInternal:!0});Zf.displayName=`StepEdge`,Qf.displayName=`StepEdgeInternal`;function $f(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Qc({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var ep=$f({isInternal:!1}),tp=$f({isInternal:!0});ep.displayName=`StraightEdge`,tp.displayName=`StraightEdgeInternal`;function np(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Gc({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var rp=np({isInternal:!1}),ip=np({isInternal:!0});rp.displayName=`BezierEdge`,ip.displayName=`BezierEdgeInternal`;var ap={default:ip,straight:tp,step:Qf,smoothstep:Yf,simplebezier:Kf},op={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},sp=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,cp=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,lp=`react-flow__edgeupdater`;function up({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,Y.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Jt([lp,`${lp}-${s}`]),cx:sp(t,r,e),cy:cp(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function dp({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=Fu(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Gl.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(e===!0||e===`source`)&&(0,Y.jsx)(up,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,Y.jsx)(up,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function fp({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||ap[x];S===void 0&&(_?.(`011`,Ns.error011(x)),x=`default`,S=h?.default||ap.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,X.useRef)(null),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),j=Fu(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L}=$((0,X.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return op;let i=ol({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=qc({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||op,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),ju),R=(0,X.useMemo)(()=>y.markerStart?`url('#${ul(y.markerStart,m)}')`:void 0,[y.markerStart,m]),z=(0,X.useMemo)(()=>y.markerEnd?`url('#${ul(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||ee===null)return null;let B=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},V=a?e=>{a(e,{...y})}:void 0,H=o?e=>{o(e,{...y})}:void 0,U=s?e=>{s(e,{...y})}:void 0,W=c?e=>{c(e,{...y})}:void 0,te=l?e=>{l(e,{...y})}:void 0;return(0,Y.jsx)(`svg`,{style:{zIndex:M},children:(0,Y.jsxs)(`g`,{className:Jt([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:B,onDoubleClick:V,onContextMenu:H,onMouseEnter:U,onMouseMove:W,onMouseLeave:te,onKeyDown:C?t=>{if(!v&&Fs.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${zu}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,Y.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:R,markerEnd:z,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,Y.jsx)(dp,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var pp=(0,X.memo)(fp),mp=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function hp({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(mp,ju),b=jf(t);return(0,Y.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,Y.jsx)(Rf,{defaultColor:e,rfId:n}),b.map(e=>(0,Y.jsx)(pp,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}hp.displayName=`EdgeRenderer`;var gp=(0,X.memo)(hp),_p=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function vp({children:e}){let t=$(_p);return(0,Y.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:t},children:e})}function yp(e){let t=Nd(),n=(0,X.useRef)(!1);(0,X.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var bp=e=>e.panZoom?.syncViewport;function xp(e){let t=$(bp),n=Fu();return(0,X.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Sp(e){return e.connection.inProgress?{...e.connection,to:bc(e.connection.to,e.transform)}:{...e.connection}}function Cp(e){return e?t=>e(Sp(t)):Sp}function wp(e){return $(Cp(e),ju)}var Tp=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ep({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(Tp,ju);return a&&i&&c?(0,Y.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,Y.jsx)(`g`,{className:Jt([`react-flow__connection`,Ws(s)]),children:(0,Y.jsx)(Dp,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var Dp=({style:e,type:t=Vs.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=wp();if(!i)return;if(n)return(0,Y.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Ws(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Vs.Bezier:[m]=Gc(h);break;case Vs.SimpleBezier:[m]=Uf(h);break;case Vs.Step:[m]=il({...h,borderRadius:0});break;case Vs.SmoothStep:[m]=il(h);break;default:[m]=Qc(h)}return(0,Y.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};Dp.displayName=`ConnectionLine`;var Op={};function kp(e=Op){(0,X.useRef)(e),Fu(),(0,X.useEffect)(()=>{},[e])}function Ap(){Fu(),(0,X.useRef)(!1),(0,X.useEffect)(()=>{},[])}function jp({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:ee,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:R,autoPanOnSelection:z,onPaneClick:B,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneScroll:W,onPaneContextMenu:te,paneClickDistance:G,nodeClickDistance:ne,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:oe,reconnectRadius:K,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:pe,nodeExtent:me,rfId:he,viewport:q,onViewportChange:ge}){return kp(e),kp(t),Ap(),yp(n),xp(q),(0,Y.jsx)(bf,{onPaneClick:B,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneContextMenu:te,onPaneScroll:W,paneClickDistance:G,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:L,panOnScroll:F,panOnScrollSpeed:ee,panOnScrollMode:I,panOnDrag:R,autoPanOnSelection:z,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:pe,onViewportChange:ge,isControlledViewport:!!q,children:(0,Y.jsxs)(vp,{children:[(0,Y.jsx)(gp,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,onlyRenderVisibleElements:T,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:oe,reconnectRadius:K,defaultMarkerColor:M,noPanClassName:fe,disableKeyboardA11y:pe,rfId:he}),(0,Y.jsx)(Ep,{style:h,type:m,component:g,containerStyle:_}),(0,Y.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,Y.jsx)(Af,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ne,onlyRenderVisibleElements:T,noPanClassName:fe,noDragClassName:ue,disableKeyboardA11y:pe,nodeExtent:me,rfId:he}),(0,Y.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}jp.displayName=`GraphView`;var Mp=(0,X.memo)(jp),Np=vc(`React Flow`,`https://reactflow.dev/`),Pp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??Ps;kl(h,g,_);let{nodesInitialized:x}=bl(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=Tc(Xs(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:Ps,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ls.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Bs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Np,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:Is,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Fp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>Au((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await ec({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...Pp({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=bl(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();kl(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=El(e,n,r,i,a,o,l);d&&(_l(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=cl(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=Tl(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(hd(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(gd(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>_d(e,!0)));return}i(vd(r,new Set([...e]),!0)),a(vd(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>_d(e,!0)));return}a(vd(n,new Set([...e]))),i(vd(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(_d(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(_d(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,_d(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,_d(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(bl(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return Dl({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Bs}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...Pp()})}},Object.is);function Ip({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,X.useState)(()=>Fp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,Y.jsx)(Nu,{value:m,children:(0,Y.jsx)(Ad,{children:(0,Y.jsx)(tf,{children:p})})})}function Lp({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,X.useContext)(Mu)?(0,Y.jsx)(Y.Fragment,{children:e}):(0,Y.jsx)(Ip,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var Rp={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function zp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:ee,connectionMode:I,connectionLineType:L=Vs.Bezier,connectionLineStyle:R,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:V=`Backspace`,selectionKeyCode:H=`Shift`,selectionOnDrag:U=!1,selectionMode:W=zs.Full,panActivationKeyCode:te=`Space`,multiSelectionKeyCode:G=Ec()?`Meta`:`Control`,zoomActivationKeyCode:ne=Ec()?`Meta`:`Control`,snapToGrid:re,snapGrid:ie,onlyRenderVisibleElements:ae=!1,selectNodesOnDrag:oe,nodesDraggable:K,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,nodeOrigin:ue=ed,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:pe=!0,defaultViewport:me=td,minZoom:he=.5,maxZoom:q=2,translateExtent:ge=Ps,preventScrolling:_e=!0,nodeExtent:ve,defaultMarkerColor:ye=`#b1b1b7`,zoomOnScroll:be=!0,zoomOnPinch:xe=!0,panOnScroll:Se=!1,panOnScrollSpeed:Ce=.5,panOnScrollMode:we=Rs.Free,zoomOnDoubleClick:Te=!0,panOnDrag:Ee=!0,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne=1,nodeClickDistance:Pe=0,children:Fe,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:He,onEdgeMouseLeave:Ue,reconnectRadius:We=10,onNodesChange:J,onEdgesChange:Ge,noDragClassName:Ke=`nodrag`,noWheelClassName:qe=`nowheel`,noPanClassName:Je=`nopan`,fitView:Ye,fitViewOptions:Xe,connectOnClick:Ze,attributionPosition:Qe,proOptions:$e,defaultEdgeOptions:et,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:nt=!1,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanOnSelection:ot=!0,autoPanSpeed:st,connectionRadius:ct,isValidConnection:lt,onError:ut,style:dt,id:ft,nodeDragThreshold:pt,connectionDragThreshold:mt,viewport:ht,onViewportChange:gt,width:_t,height:vt,colorMode:yt=`light`,debug:bt,onScroll:xt,ariaLabelConfig:St,zIndexMode:Ct=`basic`,...wt},Tt){let Et=ft||`1`,Dt=sd(yt),Ot=(0,X.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),xt?.(e)},[xt]);return(0,Y.jsx)(`div`,{"data-testid":`rf__wrapper`,...wt,onScroll:Ot,style:{...dt,...Rp},ref:Tt,className:Jt([`react-flow`,i,Dt]),id:ft,role:`application`,children:(0,Y.jsxs)(Lp,{nodes:e,edges:t,width:_t,height:vt,fitView:Ye,fitViewOptions:Xe,minZoom:he,maxZoom:q,nodeOrigin:ue,nodeExtent:ve,zIndexMode:Ct,children:[(0,Y.jsx)(ad,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:K,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:pe,elevateNodesOnSelect:tt,elevateEdgesOnSelect:nt,minZoom:he,maxZoom:q,nodeExtent:ve,onNodesChange:J,onEdgesChange:Ge,snapToGrid:re,snapGrid:ie,connectionMode:I,translateExtent:ge,connectOnClick:Ze,defaultEdgeOptions:et,fitView:Ye,fitViewOptions:Xe,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Je,nodeOrigin:ue,rfId:Et,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:ut,connectionRadius:ct,isValidConnection:lt,selectNodesOnDrag:oe,nodeDragThreshold:pt,connectionDragThreshold:mt,onBeforeDelete:ee,debug:bt,ariaLabelConfig:St,zIndexMode:Ct}),(0,Y.jsx)(Mp,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:R,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:H,selectionOnDrag:U,selectionMode:W,deleteKeyCode:V,multiSelectionKeyCode:G,panActivationKeyCode:te,zoomActivationKeyCode:ne,onlyRenderVisibleElements:ae,defaultViewport:me,translateExtent:ge,minZoom:he,maxZoom:q,preventScrolling:_e,zoomOnScroll:be,zoomOnPinch:xe,zoomOnDoubleClick:Te,panOnScroll:Se,panOnScrollSpeed:Ce,panOnScrollMode:we,panOnDrag:Ee,autoPanOnSelection:ot,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne,nodeClickDistance:Pe,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:He,onEdgeMouseLeave:Ue,reconnectRadius:We,defaultMarkerColor:ye,noDragClassName:Ke,noWheelClassName:qe,noPanClassName:Je,rfId:Et,disableKeyboardA11y:rt,nodeExtent:ve,viewport:ht,onViewportChange:gt}),(0,Y.jsx)($u,{onSelectionChange:k}),Fe,(0,Y.jsx)(qu,{proOptions:$e,position:Qe}),(0,Y.jsx)(Wu,{rfId:Et,disableKeyboardA11y:rt})]})})}var Bp=Td(zp),Vp=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Hp({children:e}){let t=$(Vp);return t?(0,kt.createPortal)(e,t):null}function Up(e){let[t,n]=(0,X.useState)(e);return[t,n,(0,X.useCallback)(e=>n(t=>hd(e,t)),[])]}var Wp=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(let[,{internals:e}]of t.nodeLookup)if(e.handleBounds===void 0||!kc(e.userNode))return!1;return!0};function Gp(e={includeHiddenNodes:!1}){return $(Wp(e))}Ns.error014();function Kp({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,Y.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Jt([`react-flow__background-pattern`,n,r])})}function qp({radius:e,className:t}){return(0,Y.jsx)(`circle`,{cx:e,cy:e,r:e,className:Jt([`react-flow__background-pattern`,`dots`,t])})}var Jp;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(Jp||={});var Yp={[Jp.Dots]:1,[Jp.Lines]:1,[Jp.Cross]:6},Xp=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Zp({id:e,variant:t=Jp.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,X.useRef)(null),{transform:f,patternId:p}=$(Xp,ju),m=r||Yp[t],h=t===Jp.Dots,g=t===Jp.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,Y.jsxs)(`svg`,{className:Jt([`react-flow__background`,l]),style:{...c,...Rd,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,Y.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,Y.jsx)(qp,{radius:y/2,className:u}):(0,Y.jsx)(Kp,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,Y.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}Zp.displayName=`Background`;var Qp=(0,X.memo)(Zp);function $p(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,Y.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function em(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,Y.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function tm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,Y.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 nm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 rm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 im({children:e,className:t,...n}){return(0,Y.jsx)(`button`,{type:`button`,className:Jt([`react-flow__controls-button`,t]),...n,children:e})}var am=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function om({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=Fu(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(am,ju),{zoomIn:y,zoomOut:b,fitView:x}=Nd();return(0,Y.jsxs)(Gu,{className:Jt([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(im,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,Y.jsx)($p,{})}),(0,Y.jsx)(im,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,Y.jsx)(em,{})})]}),n&&(0,Y.jsx)(im,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,Y.jsx)(tm,{})}),r&&(0,Y.jsx)(im,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,Y.jsx)(rm,{}):(0,Y.jsx)(nm,{})}),u]})}om.displayName=`Controls`;var sm=(0,X.memo)(om);function cm({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,Y.jsx)(`rect`,{className:Jt([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var lm=(0,X.memo)(cm),um=e=>e.nodes.map(e=>e.id),dm=e=>e instanceof Function?e:()=>e;function fm({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=lm,onClick:o}){let s=$(um,ju),c=dm(t),l=dm(e),u=dm(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,Y.jsx)(Y.Fragment,{children:s.map(e=>(0,Y.jsx)(mm,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function pm({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=Oc(r);return{node:r,x:i,y:a,width:o,height:s}},ju);return!l||l.hidden||!kc(l)?null:(0,Y.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var mm=(0,X.memo)(pm),hm=(0,X.memo)(fm),gm=200,_m=150,vm=e=>!e.hidden,ym=e=>{let 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?pc(Xs(e.nodeLookup,{filter:vm}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},bm=`react-flow__minimap-desc`;function xm({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=Fu(),S=(0,X.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(ym,ju),j=e?.width??gm,M=e?.height??_m,N=C.width/j,P=C.height/M,F=Math.max(N,P),ee=F*j,I=F*M,L=b*F,R=C.x-(ee-C.width)/2-L,z=C.y-(I-C.height)/2-L,B=ee+L*2,V=I+L*2,H=`${bm}-${T}`,U=(0,X.useRef)(0),W=(0,X.useRef)();U.current=F,(0,X.useEffect)(()=>{if(S.current&&E)return W.current=Kl({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>U.current}),()=>{W.current?.destroy()}},[E]),(0,X.useEffect)(()=>{W.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let te=p?e=>{let[t,n]=W.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,G=m?(0,X.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ne=_??A[`minimap.ariaLabel`];return(0,Y.jsx)(Gu,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F: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 o==`number`?o:void 0},className:Jt([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,Y.jsxs)(`svg`,{width:j,height:M,viewBox:`${R} ${z} ${B} ${V}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":H,ref:S,onClick:te,children:[ne&&(0,Y.jsx)(`title`,{id:H,children:ne}),(0,Y.jsx)(hm,{onClick:G,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,Y.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${R-L},${z-L}h${B+L*2}v${V+L*2}h${-B-L*2}z + M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}xm.displayName=`MiniMap`;var Sm=(0,X.memo)(xm),Cm=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,wm={[su.Line]:`right`,[su.Handle]:`bottom-right`};function Tm({nodeId:e,position:t,variant:n=su.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=Qd(),y=typeof e==`string`?e:v,b=Fu(),x=(0,X.useRef)(null),S=n===su.Handle,C=$((0,X.useCallback)(Cm(S&&p),[S,p]),ju),w=(0,X.useRef)(null),T=t??wm[n];(0,X.useEffect)(()=>{if(!(!x.current||!y))return w.current||=vu({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Tl([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Ac({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,Y.jsx)(`div`,{className:Jt([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,X.memo)(Tm);function Em({path:e,delay:t,padding:n=24,children:r}){let i=`map-growth-${(0,X.useId)().replace(/:/g,``)}`;if(t==null)return(0,Y.jsx)(Y.Fragment,{children:r});let a=(e.match(/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/gi)??[]).map(Number),o=a.filter((e,t)=>t%2==0),s=a.filter((e,t)=>t%2==1);if(!o.length||!s.length)return(0,Y.jsx)(Y.Fragment,{children:r});let c=Math.min(...o)-n,l=Math.min(...s)-n;return(0,Y.jsxs)(`g`,{"data-map-growing-edge":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`mask`,{id:i,maskUnits:`userSpaceOnUse`,x:c,y:l,width:Math.max(...o)-c+n,height:Math.max(...s)-l+n,children:(0,Y.jsx)(`path`,{className:`map-growth-mask`,d:e,pathLength:1,fill:`none`,stroke:`white`,strokeWidth:n*2,strokeLinecap:`round`,style:{animationDelay:`${t}ms`}})})}),(0,Y.jsx)(`g`,{mask:`url(#${i})`,children:r})]})}function Dm({layout:e,growing:t={},activeStep:n,activeTeamSteps:r=[]}){let i=`submap-arrow-${(0,X.useId)().replace(/:/g,``)}`;return(0,Y.jsxs)(`svg`,{className:`submap-relations`,width:e.width,height:e.height,"aria-label":`Task process relationships`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`marker`,{id:i,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6.5`,markerHeight:`6.5`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,fill:`var(--map-edge-context, #6f8ca8)`})})}),e.links.map(a=>{let o=e.positions[a.source],s=e.positions[a.target],c=o.x===s.x&&s.y>o.y,l=o.x+(c?116:232),u=o.y+(c?180:90),d=s.x+(c?116:0),f=s.y+(c?0:90),p=(l+d)/2,m=(u+f)/2,h=c?`M ${l} ${u} L ${d} ${f}`:`M ${l} ${u} C ${p} ${u}, ${p} ${f}, ${d} ${f}`;return(0,Y.jsxs)(`g`,{"data-testid":`submap-relation`,"data-relation":a.relation,"data-source":a.source,"data-target":a.target,"aria-label":`${a.label}: ${a.explanation}`,children:[(0,Y.jsx)(`title`,{children:a.explanation}),(0,Y.jsx)(Em,{path:h,delay:t[a.id],children:(0,Y.jsx)(`path`,{className:`submap-relation-path`,d:h,fill:`none`,stroke:`var(--map-edge-context, #6f8ca8)`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeDasharray:a.contextual?`5 6`:void 0,markerEnd:`url(#${i})`})}),(n===a.target||r.includes(a.target))&&(0,Y.jsx)(`path`,{className:`submap-flow`,d:h,pathLength:1,fill:`none`,stroke:`#4b9cae`,strokeWidth:`3`,strokeDasharray:`.09 .91`,strokeLinecap:`round`,"aria-hidden":`true`}),(0,Y.jsxs)(`g`,{className:`submap-relation-label`,transform:`translate(${p}, ${m})`,children:[(0,Y.jsx)(`rect`,{x:`-38`,y:`-11`,width:`76`,height:`22`,rx:`6`}),(0,Y.jsx)(`text`,{textAnchor:`middle`,dominantBaseline:`central`,children:a.label})]})]},a.id)})]})}function Om({role:e,since:t,zh:n,text:r}){let[i,a]=(0,X.useState)(()=>Date.now()/1e3);(0,X.useEffect)(()=>{if(t==null||r)return;let e=setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(e)},[t,r]);let o=t==null?null:qt(i-t,n);return(0,Y.jsxs)(`div`,{className:`map-card-live`,"data-testid":`map-card-live`,"data-waiting":!!r||void 0,"aria-live":`off`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{title:r,children:r||(0,Y.jsxs)(Y.Fragment,{children:[ut(e,n),o?n?` · 本次已进行 ${o}`:` · ${o} this run`:``]})})]})}var km=(0,X.createContext)({notes:{}}),Am=(0,X.createContext)({}),jm={plan:[`计划`,`Plan`],execution:[`动手处理`,`Work`],review:[`检查结果`,`Check`],revision:[`修订`,`Revise`],result:[`结果`,`Result`]},Mm={plan:N,execution:I,review:m,revision:F,result:ht},Nm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],review_unavailable:[`这次结果检查没有完成`,`Result check did not finish`],held:[`工作暂停,后续尚未安排`,`Work paused; no next step scheduled`],aborted:[`已取消`,`Cancelled`],cancelled:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已被新计划替代`,`Replaced by a new plan`],question:[`等待答复`,`Waiting for an answer`],paused:[`已暂停`,`Paused`],paused_external_work:[`等待后台任务`,`Waiting on background work`],missing:[`记录中缺失`,`Not in this record`],unknown:[`状态未知`,`Unknown`],continue:[`需再改一轮`,`Another pass needed`],blocked:[`受阻`,`Held up`],started:[`进行中`,`Under way`],recorded:[`已记录`,`On record`],requested:[`修改建议`,`Requested`],replan:[`需要调整计划`,`Plan needs adjusting`],replan_requested:[`需要调整计划`,`Plan needs adjusting`]},Pm={plan:[`接下来要做什么,为什么这样做`,`What to do next and why`],execution:[`实际做了什么,遇到了什么问题`,`What was done and what happened`],review:[`结果是否正确,有什么依据`,`Whether the result is correct and what supports it`],revision:[`检查后发现需要修改的地方`,`What the check found needs changing`],result:[`这项任务最后得到了什么`,`What the task produced in the end`]},Fm={plan:[`提问`,`Asked`],execution:[`Argus 查证`,`Argus`],review:[`核对`,`Check`],revision:[`修订`,`Revise`],result:[`回答`,`Answer`]},Im={plan:[`你提出的要求`,`What you asked for`],execution:[`Argus 自己动手查证、运行命令`,`Argus did the work itself: read, searched, ran commands`],review:[`对结果的核对`,`A check of the result`],revision:[`需要修改的地方`,`What had to change`],result:[`Argus 给出的回答`,`What Argus answered`]},Lm=(e,t)=>e.source===`team`?t?`子任务工作记录`:`Subtask work record`:e.source===`task`?t?`任务记录`:`Task record`:e.source===`interval`?t?`根据同期记录关联`:`By execution window`:t?`来自任务记录`:`Linked event`,Rm=(0,X.memo)(function({id:e,data:t}){let{task:n,ordinal:r,zh:i,layout:a,focused:o,detailed:s}=t,{artifacts:c,onOpenArtifact:l}=(0,X.useContext)(Am),u=(0,X.useContext)(km).notes[n.id]??[],[d]=(0,X.useState)(()=>!!t.revealing||!t.restoring&&!t.seenCards?.has(e));(0,X.useEffect)(()=>{t.seenCards?.add(e)},[t.seenCards,e]);let[f,p]=(0,X.useState)(null),m=f||a,h=e=>e.source===`team`&&a.steps.find(t=>t.id===e.id)||e,g=t.canvasSize?.width||window.innerWidth,v=t.canvasSize?.height||window.innerHeight;(0,X.useEffect)(()=>{s||(x(null),p(null),t.readCopy?.(e,null))},[s]);let[b,x]=(0,X.useState)(null),S=(0,X.useRef)(n.status),[C,w]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=S.current!==n.status;if(S.current=n.status,!e||n.status!==`done`||t.completionScope)return;w(!0);let r=setTimeout(()=>w(!1),1500);return()=>clearTimeout(r)},[n.status,t.completionScope]);let T=m.steps.find(e=>e.id===b),E=T?h(T):void 0,O=E?.updatedAt??E?.ts,k=t.part===t.partCount,A=!k||t.completionScope?`recorded`:n.status===`missing`?`missing`:t.paused&&Te.has(n.status)?`paused`:De(n),j=A===`paused`&&n.status===`paused_external_work`?n.status:A,M=Math.min(t.frame.width/288,t.frame.height/280),N=t.copy?.cards||{},F=!!N[n.id]?.summary&&N[n.id]?.task_status!==n.status&&(Te.has(n.status)||n.status===`pending`),ee=e=>{if(e.completionScope||e.status===`review_unavailable`)return;let t=N[e.id];if(e.source!==`team`)return t;let n=t?.event_ids?.indexOf(e.id)??-1;return h(e).revision&&n>=0&&t?.event_revisions?.[n]===h(e).revision?t:void 0},I=n.kind===`turn`?void 0:t.words,L=(t.completionScope?``:N[n.id]?.title)||I?.title||n.title,R=i?`环节 ${t.start}–${t.end} / ${t.totalSteps}`:`Steps ${t.start}–${t.end} / ${t.totalSteps}`,z=t.partCount>1&&!k?m.steps.map(e=>ee(e)?.summary||h(e).summary||h(e).detail).filter(e=>e&&![_e(!0),_e(!1)].includes(e)).at(-1):void 0,B=k&&n.objective&&n.objective.trim()!==n.title.trim(),V=A===`review_unavailable`?i?`当次审查器未能给出判断,未形成审阅结论。`:`The Reviewer could not return a judgment on this attempt.`:(t.completionScope?``:N[n.id]?.summary)||I?.summary||``,U=(k?n.pending_question:``)||z||V||t.completionScope||n.pending_question||nt(n.summary||``,i).summary||n.summary||(B?``:n.objective),W=Math.min(t.frame.width/m.width,t.frame.height/m.height),te=k&&t.live&&Te.has(n.status)?[...m.steps].reverse().find(e=>e.source!==`team`&&![`plan`,`result`].includes(e.kind))?.id:null,G=t.paused?null:te,ne=a.steps.filter(e=>e.source===`team`),re=t.live?ne.filter(e=>Te.has(e.status)).map(e=>e.id):[],ie=ne.filter(e=>e.status===`done`).length,ae=ne.filter(e=>Te.has(e.status)).length,oe=(i?`子任务 ${ie}/${ne.length} 完成 · ${ae} 进行中`:`Subtasks ${ie}/${ne.length} done · ${ae} running`)+((t.plannedWidth??0)>ne.length?i?` · 计划并行 ×${t.plannedWidth}`:` · planned ×${t.plannedWidth}`:``),K=e=>e.source===`team`?re.includes(e.id):G===e.id,ce=e=>e.source===`team`?h(e).status:te===e.id?t.paused?`paused`:`running`:e.status,le=e=>({source:t.source,task_id:n.id,task_title:L,lang:i?`zh`:`en`,part:t.partCount>1?t.part:void 0,step_id:e?.id,step_title:e?.title,team_id:e?.teamId,team_task_id:e?.teamTaskId,event_ids:e?e.eventIds:t.partCount>1?[...new Set(m.steps.flatMap(e=>e.eventIds))]:N[n.id]?.event_ids||[]}),ue=Math.min(640,m.width-48,Math.max(260,(g-50)/1.05)),de=Math.min(600,m.height-48,Math.max(300,(v-(g<640?180:160))/1.05)),fe=e=>({x:Math.max(24,Math.min(m.positions[e.id].x-16,m.width-ue-24)),y:Math.max(24,Math.min(m.positions[e.id].y-16,m.height-de-24)),width:ue,height:de,scale:W}),pe=E?fe(E):null,me=n=>{p(m),x(n.id),t.readCopy?.(e,n.id),t.readStep(e,fe(n))};(0,X.useEffect)(()=>{E&&t.readStep(e,fe(E))},[g,v]);let he=e=>(Nm[e===`paused_external_work`?e:e.startsWith(`paused_`)?`paused`:Te.has(e)?`running`:e]??Nm.unknown)[+!i],q=t.completionScope?i?`当次结束 · 当时目标未完成`:`Execution ended · goal incomplete then`:n.turn_kind===`qa`&&[`done`,`running`,`cancelled`,`failed`].includes(A)?{done:[`已回答`,`Answered`],running:[`正在回答`,`Answering`],cancelled:[`已中断`,`Interrupted`],failed:[`回答失败`,`Answer failed`]}[A][+!i]:he(j);return(0,Y.jsxs)(`article`,{className:`map-macro map-state-${A}`,"data-testid":`map-macro`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,"data-history":!k,"data-has-history":!!t.historyCount,"data-arrive":!!t.arriving||d&&!!t.revealing,"data-lit":!!t.lit,"data-hovered":!!t.hovered,"data-growing":t.growthDelay!=null,"data-dispatch":t.dispatchState,style:{animationDelay:`${t.growthDelay??(t.arriving?Gt(r):0)}ms`},"data-focused":o,"data-detailed":s,"aria-label":L,"data-completed-now":C,"data-active":re.length>0||k&&t.live&&!t.paused&&Te.has(n.status),onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(),{x:e.clientX,y:e.clientY})},children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(sf,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsxs)(`div`,{className:`macro-summary`,"aria-hidden":s,style:{"--summary-height":`${t.frame.height/M-20}px`,width:t.frame.width/M-20,transform:`translate(-50%, -50%) scale(${M})`},children:[(0,Y.jsxs)(`button`,{className:`map-card map-state-${A} nodrag nopan`,"data-testid":`map-card`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,tabIndex:s?-1:0,onClick:()=>n.turn_kind===`qa`&&t.readCopy?t.readCopy(e,n.id):t.open(e),"aria-label":`${L} · ${n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`放大任务`:`Explore task`}`,children:[(0,Y.jsxs)(`div`,{className:`map-card-top`,children:[(0,Y.jsxs)(`span`,{className:`map-card-number`,children:[n.turn_kind===`qa`?i?`问答`:`Q&A`:k?i?`任务`:`MISSION`:i?`历史`:`HISTORY`,` `,String(r).padStart(2,`0`),!k&&` · ${t.part}/${t.partCount}`]}),(A!==`recorded`||t.completionScope)&&(0,Y.jsxs)(`span`,{className:`map-status`,children:[A===`done`?(0,Y.jsx)(_,{size:11}):A===`failed`?(0,Y.jsx)(y,{size:11}):A===`review_unavailable`?(0,Y.jsx)(Ce,{size:11}):A===`question`?(0,Y.jsx)(ve,{size:11}):A===`paused`||A===`held`?(0,Y.jsx)(P,{size:11}):(0,Y.jsx)(`span`,{className:`map-state-dot`}),q]})]}),(0,Y.jsxs)(`h3`,{children:[(0,Y.jsx)(rt,{children:L}),u.length>0&&(0,Y.jsx)(`span`,{className:`macro-note-badge`,title:i?`操作员批注`:`Operator notes`,children:u.length})]}),B&&!V&&(0,Y.jsx)(`p`,{className:`map-card-objective`,title:n.objective,children:n.objective}),U&&U.trim()!==(B?n.objective.trim():``)&&(0,Y.jsx)(`div`,{className:`map-card-copy`,children:(0,Y.jsx)(rt,{children:U})}),t.conclusion&&(0,Y.jsx)(`p`,{className:`map-card-conclusion`,"data-testid":`map-card-conclusion`,title:t.conclusion,children:t.conclusion}),n.kind!==`turn`&&(0,Y.jsx)(`div`,{className:`map-card-course`,"aria-label":i?`任务经过`:`Course of the task`,children:[`plan`,`execution`,`review`,`result`].map(e=>{let t=Mm[e],n=m.steps.some(t=>t.kind===e),r=m.steps.some(t=>t.kind===e&&K(t)),a=i?{plan:`规划`,execution:`执行`,review:`审查`,result:`交付`}[e]:jm[e][1];return(0,Y.jsxs)(`span`,{className:`submap-kind-${e}`,"data-present":n,"data-active":r,title:a,children:[(0,Y.jsx)(t,{size:12,"aria-hidden":!0}),(0,Y.jsx)(`b`,{children:a})]},e)})}),(()=>{let e=k&&t.live&&t.waiting,r=!e&&k&&t.live&&!t.paused&&Te.has(n.status),a=A!==`recorded`||!!t.completionScope,o=!!t.historyCount&&ne.length>0;return!r&&!e&&k&&a&&!o?null:(0,Y.jsxs)(`div`,{className:`map-card-stages`,children:[e?(0,Y.jsx)(Om,{text:t.waiting,zh:i}):r?(0,Y.jsx)(Om,{role:t.phase??n.role,since:n.started_ts,zh:i}):k&&a?null:(0,Y.jsx)(`span`,{className:`map-card-recorded`,children:k?q:i?`历史记录 · 非当前执行`:`History · not current execution`}),o&&(0,Y.jsx)(`span`,{className:`map-card-team-summary`,children:oe})]})})(),k&&ne.length>0&&(0,Y.jsx)(`span`,{className:`map-card-teambar`,"aria-hidden":!0,children:(0,Y.jsx)(`i`,{style:{width:`${Math.round(ie/ne.length*100)}%`}})}),(0,Y.jsxs)(`div`,{className:`map-card-bottom`,children:[(0,Y.jsx)(`span`,{className:ne.length?`map-card-team-summary`:void 0,title:R,children:n.turn_kind===`qa`?i?`问题与回答`:`Question and answer`:t.historyCount?``:ne.length?oe:t.plannedWidth&&Te.has(n.status)?i?`并行编队 ×${t.plannedWidth} 展开中`:`Fanning out ×${t.plannedWidth}`:t.partCount>1?R:`${m.steps.length} ${i?`个环节`:`steps`}`}),(0,Y.jsxs)(`span`,{className:`map-card-submap-hint`,children:[F?i?`描述更新中`:`Summary updating`:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`查看进展`:`View progress`,(0,Y.jsx)(se,{size:12})]})]})]}),!!t.historyCount&&t.toggleHistory&&(0,Y.jsxs)(`button`,{type:`button`,className:`map-history-toggle nodrag nopan`,"aria-expanded":t.historyExpanded,"aria-label":`${i?`任务历史`:`Mission history`}: ${L}`,title:i?`保留全部 ${t.totalSteps} 个环节`:`All ${t.totalSteps} steps retained`,onClick:()=>t.toggleHistory?.(n.id),children:[t.historyExpanded?i?`收起历史`:`Hide history`:`${i?`历史`:`History`} ${t.historyCount}`,(0,Y.jsx)(se,{size:12})]})]}),o&&(0,Y.jsxs)(`div`,{className:`macro-detail ${E?`is-reading`:``}`,"data-stacked":m.stacked||void 0,"aria-hidden":!s,style:{width:m.width,height:m.height,transform:`scale(${W})`,transformOrigin:`top left`},children:[(0,Y.jsxs)(`header`,{className:`macro-heading`,children:[(0,Y.jsx)(`span`,{className:`macro-index`,children:String(r).padStart(2,`0`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`small`,{children:t.partCount>1?i?`第 ${t.part} / ${t.partCount} 部分`:`Part ${t.part} / ${t.partCount}`:n.turn_kind===`qa`?i?`问答内容`:`Q&A`:i?`任务内部`:`INSIDE THIS TASK`}),(0,Y.jsx)(`h2`,{children:(0,Y.jsx)(rt,{children:L})})]}),t.conclusion&&(0,Y.jsx)(`span`,{className:`macro-conclusion`,"data-testid":`macro-conclusion`,title:t.conclusion,children:t.conclusion}),(A!==`recorded`||t.completionScope)&&(0,Y.jsx)(`span`,{className:`macro-state`,title:t.completionScope,children:q}),s&&k?(0,Y.jsx)(D,{"data-testid":`map-task-read`,className:`nodrag nopan text-xs`,onClick:()=>{if(n.turn_kind===`qa`){t.readCopy?.(e,n.id);return}x(null),p(null),t.readCopy?.(e,n.id)},children:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`阅读任务说明`:`Read task explanation`}):null]}),(0,Y.jsx)(`div`,{className:`macro-stage-key`,children:Ge.filter(e=>n.kind!==`turn`||m.steps.some(t=>t.kind===e)).map(e=>(0,Y.jsx)(`span`,{className:`submap-kind-${e} ${m.steps.some(t=>t.kind===e)?``:`is-unrecorded`}`,title:n.kind===`turn`?Im[e][+!i]:Pm[e][+!i],children:n.kind===`turn`?Fm[e][+!i]:jm[e][+!i]},e))}),u.length>0&&(0,Y.jsxs)(`aside`,{className:`macro-notes`,"aria-label":i?`操作员批注`:`Operator notes`,children:[(0,Y.jsx)(`small`,{children:i?`批注`:`Notes`}),u.map(e=>(0,Y.jsx)(`p`,{children:e.text},e.id))]}),(0,Y.jsx)(Dm,{layout:m,growing:t.growingLinks,activeStep:G,activeTeamSteps:re}),m.columns.map(e=>(0,Y.jsx)(`div`,{className:`macro-column-label`,style:{left:e.x,top:e.y},children:e.title},e.id)),m.steps.map((e,r)=>{let a=h(e),o=Mm[a.kind];return(0,Y.jsxs)(`button`,{className:`submap-step submap-kind-${a.kind} nodrag nopan ${b===a.id?`is-selected`:``}`,"data-testid":`submap-step`,"data-step-id":a.id,"data-source":a.source,"data-team-id":a.teamId,"data-team-task-id":a.teamTaskId,"data-status":ce(a),"data-active":K(a),"data-growing":t.growingSteps?.[a.id]!=null,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(a),{x:e.clientX,y:e.clientY})},style:{animationDelay:`${t.growingSteps?.[a.id]??0}ms`,"--step-index":r,left:m.positions[a.id].x,top:m.positions[a.id].y},tabIndex:s?0:-1,onClick:()=>me(a),"aria-expanded":b===a.id,children:[(0,Y.jsxs)(`div`,{className:`submap-step-meta`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(o,{size:16}),a.source===`team`?i?`子任务 · `:`Subtask · `:``,(n.kind===`turn`?Fm:jm)[a.kind][+!i],a.round!=null&&(0,Y.jsx)(`em`,{className:`submap-round`,children:i?`第 ${a.round} 轮`:`Round ${a.round}`})]}),(0,Y.jsx)(`small`,{"data-verdict":a.source===`team`&&ye(h(a).teamOutcome)||void 0,children:a.completionScope&&a.status===`recorded`?i?`执行结束`:`Execution ended`:a.source===`team`&&ce(a)===`failed`?i?`失败`:`Failed`:a.source===`team`&&H(h(a).teamOutcome,i)||he(ce(a))})]}),(0,Y.jsx)(`h4`,{children:(0,Y.jsx)(rt,{children:a.title})}),(0,Y.jsx)(`div`,{className:`submap-step-copy`,children:(0,Y.jsx)(rt,{children:ee(a)?.summary||h(a).summary||a.detail||_e(i)})}),(0,Y.jsxs)(`div`,{className:`submap-step-foot`,children:[(0,Y.jsxs)(`span`,{title:Lm(a,i),children:[i?`查看详情`:`Read more`,a.workCount?(0,Y.jsx)(`em`,{className:`submap-step-work`,children:i?` · ${a.workCount} 步操作`:` · ${a.workCount} actions`}):null]}),(0,Y.jsx)(se,{size:14})]})]},a.id)}),t.partCount>1&&!E&&(0,Y.jsxs)(`nav`,{className:`macro-part-nav nodrag nopan`,"aria-label":i?`任务各部分`:`Task parts`,children:[(0,Y.jsx)(`span`,{children:R}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{disabled:!t.previousId,onClick:()=>t.previousId&&t.open(t.previousId,!0),children:[(0,Y.jsx)(ft,{size:14}),i?`上一部分`:`Previous part`]}),(0,Y.jsxs)(`button`,{disabled:!t.nextId,onClick:()=>t.nextId&&t.open(t.nextId,!0),children:[i?`下一部分`:`Next part`,(0,Y.jsx)(se,{size:14})]})]})]}),E&&pe&&(0,Y.jsxs)(`section`,{className:`macro-reader nodrag nopan nowheel`,"data-testid":`map-reader`,"data-kind":E.kind,role:`region`,"aria-label":i?`卡片详情`:`Card details`,style:{left:pe.x,top:pe.y,width:pe.width,height:pe.height},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(E),{x:e.clientX,y:e.clientY})},children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsxs)(`span`,{children:[(n.kind===`turn`?Fm:jm)[E.kind][+!i],n.turn_kind!==`qa`&&(0,Y.jsx)(`small`,{className:`macro-reader-note`,children:Pm[E.kind][+!i]})]}),(0,Y.jsx)(`button`,{"aria-label":`Close step details`,onClick:()=>{x(null),p(null),t.readCopy?.(e,null),t.open(e)},children:(0,Y.jsx)(y,{size:20})})]}),(0,Y.jsx)(`h3`,{children:(0,Y.jsx)(rt,{children:ee(E)?.title||E.title})}),(0,Y.jsx)(`div`,{className:`macro-reader-body`,children:(0,Y.jsx)(Et,{cardKey:E.id,taskId:n.id,card:ee(E),task:n,readOnly:t.readOnly,originalDetail:E.detail||_e(i),selection:t.readerCopy,artifacts:c,onOpenArtifact:l})}),(0,Y.jsxs)(`footer`,{children:[(0,Y.jsx)(`span`,{title:Lm(E,i),children:O?new Date(O*1e3).toLocaleString(i?`zh-CN`:`en-US`):``}),!t.readOnly&&(0,Y.jsx)(`button`,{onClick:()=>t.quote(le(E)),children:i?`引用此项`:`Reference`})]})]})]})]})});function zm(e){if(!(e>0)||!Number.isFinite(e))return e;let t=Math.floor(Math.log2(e)*4+1e-9)/4;return Math.round(2**t*1e4)/1e4}function Bm(e,t){let n=zm(t);if(e==null||!(e>0))return n;let r=Math.log2(t/e)*4;return r<-2||r>=3?n:e}function Vm(){let e=null,t=new Set;return{get:()=>e,set(n){n!==e&&(e=n,t.forEach(e=>e()))},subscribe(e){return t.add(e),()=>void t.delete(e)}}}var Hm=(0,X.createContext)(null),Um=()=>()=>{};function Wm(e){let t=(0,X.useContext)(Hm),n=()=>{let n=t?.get();return n==null?null:e(n)},r=(0,X.useSyncExternalStore)(t?t.subscribe:Um,n,n),i=$(t=>r===null?e(zm(t.transform[2])):null);return r??i}function Gm(e){let t={};for(let n of e)(t[n.node_id]??=[]).push(n);for(let e of Object.values(t))e.sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));return t}var Km={width:640,height:190},qm={width:1440,height:640},Jm={"idea-route":vt,"idea-review":m,"idea-selector":gt},Ym={done:`✓`,failed:`✕`,question:`?`,paused:`‖`,running:`▶`,superseded:`↪`},Xm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],question:[`待答复`,`Needs input`],paused:[`已暂停`,`Paused`],aborted:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已替代`,`Superseded`],unknown:[`已记录`,`Recorded`]},Zm=(0,X.memo)(function({data:e}){let{task:t,zh:n,fanIndex:r,fanCount:i}=e,a=De(t),o=t.group,s=o?pe:t.overflow_count?he:Jm[t.team_role??``]??N,c=o?``:H(t.team_outcome,n),l=o?``:ye(t.team_outcome),u=c||(Xm[a]??Xm.unknown)[+!n],d=l===`rejected`?`✕`:l===`chosen`?`★`:Ym[a],f=!o&&typeof r==`number`&&typeof i==`number`,p=o?.expanded?n?`收起`:`Fold`:n?`展开`:`Unfold`;return(0,Y.jsxs)(`button`,{type:`button`,className:`map-branch map-state-${a}${o?` map-branch-group`:``} nodrag nopan`,"data-testid":`map-branch`,"data-branch-id":t.id,"data-status":a,"data-verdict":l||void 0,"data-overflow":!!t.overflow_count,"data-group":!!o,"data-expanded":o?o.expanded:void 0,"aria-expanded":o?o.expanded:void 0,title:t.excerpt||t.objective||t.title,"aria-label":o?`${t.title} · ${p}`:`${t.title} · ${u} · ${n?`打开所属任务`:`Open the owning task`}`,onClick:()=>o?e.toggleGroup?.(t.id):e.open(e.parentCardId),children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(sf,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsx)(`span`,{className:`map-branch-glyph`,"aria-hidden":`true`,children:(0,Y.jsx)(s,{})}),d&&(0,Y.jsx)(`span`,{className:`map-branch-state`,"aria-hidden":`true`,children:d}),(0,Y.jsx)(`span`,{className:`map-branch-title`,children:t.title}),c&&(0,Y.jsx)(`span`,{className:`map-branch-verdict`,"data-testid":`map-branch-verdict`,children:c}),f&&(0,Y.jsx)(`span`,{className:`map-branch-fan`,"data-testid":`map-branch-fan`,title:n?`并行分支 ${r} / ${i}`:`Parallel branch ${r} of ${i}`,children:`${r}/${i}`}),o&&(0,Y.jsxs)(`span`,{className:`map-branch-toggle`,"data-testid":`map-branch-toggle`,"aria-hidden":`true`,children:[p,o.expanded?(0,Y.jsx)(g,{}):(0,Y.jsx)(se,{})]}),(0,Y.jsx)(`span`,{className:`map-branch-dot`,"aria-hidden":`true`})]})}),Qm={x:52,y:125,zoom:.24},$m=.01,eh=3.5,th=(e,t,n)=>Math.max(t,Math.min(n,e));function nh(e,t){let n=e.querySelector(t)?.getBoundingClientRect();return n&&n.width>0&&n.height>0?n:void 0}function rh(e,t=!1){let n=e.getBoundingClientRect(),r=nh(e,`.map-canvas-toolbar`),i=nh(e,`.map-composer-dock`),a=nh(e,`.react-flow__minimap`),o=nh(e,`.map-legend`),s=nh(e,`.react-flow__controls`),c=e.dataset.reading===`true`||t&&e.clientWidth<640,l=e.clientWidth<640?20:50,u=Math.max(r?r.bottom-n.top+20:85,!c&&e.clientWidth<640&&o?o.bottom-n.top+16:0,!c&&e.clientWidth<640&&s?s.bottom-n.top+16:0),d=Math.max(i?n.bottom-i.top+24:100,!c&&a?n.bottom-a.top+20:0);return{x:l,y:u,width:Math.max(180,e.clientWidth-l*2),height:Math.max(100,e.clientHeight-u-d)}}var ih=.72,ah=.85,oh=(e,t)=>e?0:t;function sh(e,t,n){let r=Math.min(t.width/n.width,t.height/n.height),i=Math.min(e.width,e.height)/Math.min(n.width,n.height);return Math.min(Math.max(r,ih*i),ah*i)}function ch(e,t,n,r,i){let a=r||1;if(e.width<640&&i?.stacked&&i.width>0)return t.width/(i.width*a);let o=sh(e,t,n),s=e.width<640||(i?.steps.length??0)>20?.6/a:0,c=e.width>=1024?1/a:0;return Math.max(o,s,c)}function lh(e,t,n){let r=th(Math.min(t.width/(n.width+160),t.height/(n.height+160)),$m,.27),i=(e,t,n,r)=>r>t?(n-r)/2:th((n-r)/2,e,e+t-r);return{x:i(t.x,t.width,e.width,n.width*r)-n.x*r,y:i(t.y,t.height,e.height,n.height*r)-n.y*r,zoom:r}}function uh(e,t,n){let r=Math.min(48,e.height*.35),i=e.height-r,a=Math.min(eh,Math.min(1.05,e.width/n.width,i/n.height)/n.scale);return{x:e.x+e.width/2-(t.x+(n.x+n.width/2)*n.scale)*a,y:e.y+r+i/2-(t.y+(n.y+n.height/2)*n.scale)*a,zoom:a}}function dh(e,t=!0){let n=Nd(),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)({width:0,height:0}),l=(0,X.useRef)(null),u=(0,X.useRef)(!1),d=(0,X.useRef)(!1),f=(0,X.useRef)(!1),p=(0,X.useRef)(),m=(0,X.useRef)(()=>{}),h=(0,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.useRef)(()=>{}),v=(0,X.useRef)(()=>{}),[y,b]=(0,X.useState)(()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),x=(0,X.useRef)(Qm),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null),T=(0,X.useRef)(0),E=(0,X.useRef)(null),D=(0,X.useRef)(0);(0,X.useEffect)(()=>()=>window.clearTimeout(D.current),[]);let[O]=(0,X.useState)(Vm),k=(0,X.useCallback)((e,t)=>{O.get()!==t&&(e.style.setProperty(`--map-zoom-step`,String(t)),O.set(t))},[O]),A=(0,X.useCallback)(()=>{cancelAnimationFrame(T.current),T.current=0,E.current=null},[]),j=(0,X.useCallback)((t,r)=>{t&&(f.current=!1,d.current=!1);let a=e.current;if(!a)return;a.dataset.moving||(a.dataset.moving=`true`),window.clearTimeout(D.current),D.current=window.setTimeout(()=>{delete a.dataset.moving,k(a,zm(n.getZoom()))},180);let s={x:a.clientWidth/2,y:a.clientHeight/2},c=S.current&&S.current.until>performance.now()?S.current:s,p=C.current??(u.current?h.current:null)??K(n.getNodes().filter(e=>e.data.frame),r,c,s),m=p&&(n.getNode(p)?.data)?.frame?.scale||1,g=th((r.zoom-.3)/.14,0,1)*th((r.zoom*m-.28)/.3,0,1),_=w.current,v=u.current?1:_?.id===p?th((r.zoom-_.zoom*.65)/(_.zoom*.35),0,1):g;l.current=v>0?p:null,a.style.setProperty(`--detail-alpha`,String(v)),a.style.setProperty(`--summary-alpha`,String(1-v)),a.style.setProperty(`--context-alpha`,String(p?1-v*.72:1)),a.dataset.zoom=r.zoom.toFixed(2),k(a,Bm(O.get(),r.zoom)),i(v>0&&p?p:null),o(!!p&&v>=.55),r.zoom<=.32&&!C.current&&!E.current&&!w.current&&(x.current=r)},[n,e,k,O]),M=(0,X.useCallback)(t=>{let r=f.current;f.current=!1,A();let i=n.getNode(t),a=e.current;if(!i||!a)return;!r&&n.getZoom()<=.32&&!w.current&&(x.current=n.getViewport()),C.current=t,u.current=!1,delete a.dataset.reading,d.current=!0;let o=rh(a,!0),s=i.width||1440,c=i.height||1080,l=th(ch({width:a.clientWidth,height:a.clientHeight},o,{width:s,height:c},i.data.frame?.scale||1,i.data.layout),$m,eh);w.current={id:t,zoom:l};let p=o.x+Math.max(0,(o.width-s*l)/2)-i.position.x*l,m=o.y+Math.max(0,(o.height-c*l)/2)-i.position.y*l;n.setViewport({x:p,y:m,zoom:l},{duration:oh(y,380)}).then(()=>{C.current=null})},[A,n,y,e]);v.current=M;let N=(0,X.useCallback)(()=>{f.current=!1,A(),C.current=null,u.current=!1,e.current&&delete e.current.dataset.reading,d.current=!1,w.current=null,S.current=null;let t=e.current?.querySelector(`.map-macro[data-focused="true"]`)?.dataset.cardId;n.setViewport(x.current,{duration:oh(y,320)}).then(()=>{t&&e.current?.querySelector(`[data-testid="map-card"][data-card-id="${CSS.escape(t)}"]`)?.focus({preventScroll:!0})})},[A,n,y,e]),P=(0,X.useCallback)((t,r)=>{f.current=!1,A(),C.current=t;let i=n.getNode(t),a=e.current;!i||!a||(u.current=!0,a.dataset.reading=`true`,d.current=!0,h.current=t,g.current={id:t,rect:r},n.setViewport(uh(rh(a),i.position,r),{duration:oh(y,340)}).then(()=>{C.current=null}))},[A,n,y,e]);_.current=P;let F=(0,X.useCallback)(e=>{f.current=!1,A(),u.current=!1,d.current=!1,C.current=null,S.current=null,n.setCenter(e.x,e.y,{zoom:n.getZoom(),duration:oh(y,180)})},[A,n,y]),ee=(0,X.useCallback)(t=>{f.current=!0,p.current=t,A(),C.current=null,u.current=!1,d.current=!1,w.current=null,S.current=null;let r=e.current;r&&delete r.dataset.reading;let i=n.getNodes().filter(e=>!e.hidden&&(!t||t.has(e.data.task.id)));if(!r||!i.length)return;let a=lh({width:r.clientWidth,height:r.clientHeight},rh(r),n.getNodesBounds(i));t||(x.current=a),n.setViewport(a,{duration:oh(y,320)})},[A,n,y,e]);m.current=()=>ee(p.current);let I=(0,X.useCallback)(()=>{f.current?m.current():d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&v.current(l.current)},[]);return(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let n,r=t.querySelector(`.map-composer-dock`),i=-1,a=-1,o=-1,s=new ResizeObserver(()=>{let e=r?.getBoundingClientRect().height||0;(i!==t.clientWidth||a!==t.clientHeight||o!==e)&&(i=t.clientWidth,a=t.clientHeight,o=e,t.style.setProperty(`--map-composer-height`,`${o}px`),c(e=>e.width===i&&e.height===a?e:{width:i,height:a}),clearTimeout(n),n=setTimeout(()=>{d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&!u.current?v.current(l.current):f.current&&m.current()},100))});return s.observe(t),r&&s.observe(r),()=>{s.disconnect(),clearTimeout(n)}},[e,t]),(0,X.useEffect)(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let r=e=>{if(e.target.closest(`.nowheel, .map-canvas-toolbar, .map-legend, .react-flow__minimap, .react-flow__controls`))return;e.preventDefault(),e.stopPropagation(),f.current=!1,u.current=!1,d.current=!0,C.current=null;let r=t.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top;S.current={x:i,y:a,until:performance.now()+1e3};let o=E.current??n.getViewport();!E.current&&o.zoom<=.32&&!w.current&&(x.current=o);let s=e.deltaY*(e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1),c=th(o.zoom*Math.exp(-th(s,-400,400)*.002),$m,eh);if(E.current={x:i-(i-o.x)*c/o.zoom,y:a-(a-o.y)*c/o.zoom,zoom:c},y){n.setViewport(E.current),E.current=null;return}if(T.current)return;let l=performance.now(),p=e=>{if(!E.current)return;let t=1-Math.exp(-Math.min(e-l,64)/55);l=e;let r=n.getViewport(),i=E.current,a=Math.abs(i.zoom-r.zoom)<15e-5&&Math.abs(i.x-r.x)+Math.abs(i.y-r.y)<.15;n.setViewport(a?i:{x:r.x+(i.x-r.x)*t,y:r.y+(i.y-r.y)*t,zoom:r.zoom+(i.zoom-r.zoom)*t}),a?(T.current=0,E.current=null):T.current=requestAnimationFrame(p)};T.current=requestAnimationFrame(p)},i=()=>{A(),C.current=null,S.current=null},a=e=>{e.defaultPrevented||document.querySelector(`[role="dialog"][aria-modal="true"]`)||e.key===`Escape`&&![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&N()};return t.addEventListener(`wheel`,r,{passive:!1,capture:!0}),t.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a),()=>{A(),t.removeEventListener(`wheel`,r,!0),t.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a)}},[N,A,n,y,e]),{capture:(0,X.useCallback)(()=>({viewport:n.getViewport(),overview:x.current,focusId:l.current,detailed:!!l.current&&(u.current||!!w.current||n.getZoom()>=.44)}),[n]),restore:(0,X.useCallback)(e=>{A(),x.current=e.overview;let t=e.focusId&&n.getNode(e.focusId)?e.focusId:null;C.current=e.detailed?t:null,w.current=e.detailed&&t?{id:t,zoom:e.viewport.zoom}:null,d.current=!1,f.current=!1,n.setViewport(e.viewport,{duration:0}),j(null,e.viewport)},[A,n,j]),focusId:r,canvasSize:s,detailed:a,enter:M,back:N,fit:ee,fitUpdatedScene:I,navigate:F,readStep:P,onMove:j,reducedMotion:y,zoomSteps:O}}function fh(e,t,n,r=n){if(!n||!r)return[];let i=e.tasks.find(e=>e.id===n);if(!i||i.turn_kind===`qa`)return[];if(r===n)return[St(i,xt(e,i,i.started_ts??0))];let a=new Map(e.events.map(e=>[e.id,e.item_id]));return q(e,t,n).filter(e=>e.task_id===n&&e.key===r&&e.event_ids.every(e=>!a.get(e)||a.get(e)===n))}function ph(e,t){let n=new Map(e.events.map(e=>[e.id,e]));return JSON.stringify(t.map(t=>{let r=e.tasks.find(e=>e.id===t.task_id),i=[t.task_id,`${t.task_id}:active`,`${t.task_id}:outcome`].includes(t.key);return[t,Ct(!r||i?r:{...r,status:``,summary:void 0,outcome:void 0,pending_question:void 0,started_ts:void 0,finished_ts:void 0,attempt:void 0},t.event_ids.flatMap(e=>n.get(e)?[n.get(e)]:[]))]}))}function mh(e,t,n,r=600){let i=e=>[`done`,`failed`,`cancelled`,`recorded`,`skipped`].includes(e||``),a=e.tasks.filter(e=>e.id!==n&&e.turn_kind!==`qa`),o=[...a.filter(e=>i(e.status)),...a.filter(e=>!i(e.status))],s=[];for(let n of o){if(s.length>=r)break;s.push(...U(e,n,fe(n,e.events,t)))}return s.slice(0,r)}function hh(e,t,n,r=!0,a,l,d=!1,p=t,m){let h=n?`zh-CN`:`en-US`,g=e.kind===`live`?`project`:`dataset`,_=e.id.replace(/^live:/,``),v=c(),y=et(l??_,h),b=v===`question-foundation`?m===void 0?y.id:m:null,x=v===`question-foundation`&&!b,S=f(g,_,h,l,v,b),C=o(),w=i({queryKey:S,queryFn:async({signal:e})=>{let t=v===`question-foundation`?await u.mapCopy(g,_,h,e,l,v,b):await u.mapCopy(g,_,h,e,l,v),n=C.getQueryData(S);return st(n,t,n?.model_revision)},staleTime:1/0,gcTime:72e5,refetchOnWindowFocus:!1}),T=e.tasks.find(e=>e.id===t),E=Pe(S,p,tt(p,T)),D=(0,X.useMemo)(()=>a??(T?fe(T,e.events,n):[]),[T,e.events,n,a]),[O,k]=(0,X.useState)(0),[A,j]=(0,X.useState)(!1),M=(0,X.useRef)(!0),N=(0,X.useRef)(null),P=(0,X.useMemo)(()=>new Map(e.events.map(e=>[e.id,e])),[e.events]),F=d?q(e,D,t):fh(e,D,t,p),ee=(0,X.useMemo)(()=>d?mh(e,n,t):[],[e,n,t,d]),I=[...F,...ee].filter(t=>e.tasks.find(e=>e.id===t.task_id)?.turn_kind!==`qa`).filter(t=>Se(t,e,w.data,P)).slice(0,8),L=ph(e,I),R=[`map-copy-generation`,g,_,h,l],z=[...R,v,...v===`question-foundation`?[b]:[],w.data?.version??null,w.data?.model_revision??null,L],B=JSON.stringify(z),V=s({queryKey:R}),H={queryKey:z,queryFn:async()=>{let t=w.data?.model_revision,n=Ze(C,S,I.map(t=>({key:t.key,startedAt:tt(t.key,e.tasks.find(e=>e.id===t.task_id))}))),r;try{r=await u.generateMapCopy(g,_,{cards:I,locale:h,...b?{foundation_id:b}:{}},void 0,l,v,n.update)}finally{n.finish()}return C.setQueryData(S,e=>st(e,r,t)),{available:!r.retry_after&&r.available!==!1&&I.every(t=>!Se(t,e,r,P)),retryAfter:typeof r.retry_after==`number`&&r.retry_after>0?r.retry_after:null}},staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1},U=i({...H,enabled:!1}),W=U.isSuccess&&U.data.available===!1?U.data.retryAfter:null,te=(0,X.useMemo)(()=>w.data?.generation_error?Error(w.data.generation_error.message):null,[w.data?.generation_error?.code,w.data?.generation_error?.message]),G=()=>{let e=C.fetchQuery({...H,staleTime:0});return N.current=e,j(!0),e.then(()=>void 0,()=>void 0).finally(()=>{N.current===e&&(N.current=null,M.current&&(j(!1),k(e=>e+1)))}),e};(0,X.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]),(0,X.useEffect)(()=>{if(!r||x||!w.data?.available||!I.length||U.isError||U.isSuccess&&!W||V>0||N.current)return;let e=w.data.generation_error&&typeof w.data.retry_after==`number`&&w.data.retry_after>0?w.data.retry_after:0,t=Math.max(W?U.dataUpdatedAt+W*1e3:0,e?w.dataUpdatedAt+e*1e3:0),n=setTimeout(()=>{C.isFetching({queryKey:R})===0&&G()},Math.max(700,t-Date.now()));return()=>clearTimeout(n)},[B,O,w.data?.available,w.data?.retry_after,w.dataUpdatedAt,r,x,V,U.status,U.dataUpdatedAt]);let ne=A||U.isFetching||V>0;return{copy:w.data,generating:ne,ready:w.isFetched,foundationRequired:x,questionContext:{locale:h,preview:v,foundationId:b},readingGenerating:E.active,generationPhase:E.phase,generationError:I.length&&!U.isFetching&&!E.active?U.error||te:null,generationUnavailable:!!I.length&&!U.isFetching&&!E.active&&!W&&U.data?.available===!1,retry:async()=>{!r||x||!w.data?.available||!I.length||ne||N.current||await G().catch(()=>void 0)},readingRequest:F.find(e=>e.key===p),readingNeedsUpdate:U.data?.available!==!0&&I.some(e=>e.key===p)}}var gh=new Set([`done`,`failed`,`cancelled`,`recorded`,`skipped`,`aborted`,`superseded`]);function _h(e,t,n,r,a){let o=n?`zh-CN`:`en-US`,s=e.kind===`live`?`project`:`dataset`,c=e.id.replace(/^live:/,``),l=(0,X.useMemo)(()=>{let n=new Map(e.tasks.map(e=>[e.id,gh.has(e.status||``)])),r=t.filter(e=>n.has(e.source)&&n.has(e.target)).slice(0,48);return JSON.stringify(r.map(e=>[e.source,e.target,n.get(e.source),n.get(e.target)]))},[e.tasks,t]),d=(0,X.useMemo)(()=>JSON.parse(l).map(([e,t])=>({source:e,target:t})),[l]),f=[`map-lines`,s,c,o,a,l],p=i({queryKey:[...f,`saved`],queryFn:({signal:e})=>u.mapLines(s,c,{pairs:d,locale:o,write:!1},e,a),enabled:d.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...f,`written`],queryFn:({signal:e})=>u.mapLines(s,c,{pairs:d,locale:o,write:!0},e,a),enabled:d.length>0&&r&&p.data?.available===!0&&p.data.lines.lengthJSON.stringify(e.tasks.filter(e=>e.kind!==`turn`&&e.turn_kind!==`qa`).slice(-40).map(e=>[e.id,yh.has(e.status||``)])),[e.tasks]),l=(0,X.useMemo)(()=>JSON.parse(c).map(([e])=>e),[c]),d=[`map-card-words`,o,s,a,r,c],f=i({queryKey:[...d,`saved`],queryFn:({signal:e})=>u.mapCardWords(o,s,{tasks:l,locale:a,write:!1},e,r),enabled:l.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...d,`written`],queryFn:({signal:e})=>u.mapCardWords(o,s,{tasks:l,locale:a,write:!0},e,r),enabled:l.length>0&&n&&f.data?.available===!0&&Object.keys(f.data.cards).length`u`||typeof window.matchMedia!=`function`?!1:window.innerWidth>=1024&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function Ch({footer:e,value:t,onChange:n,onSend:r,attachments:i,onAttachmentsChange:a,pending:o,pendingLabel:s,progressVisible:c=!0,dispatchStatus:l,onCancel:u,focusSignal:f,sessionName:m,historical:h,zh:v,routeOverride:b=`auto`,onRouteOverrideChange:x}){let{t:S}=d(),C=(0,X.useId)(),w=(0,X.useRef)(null),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(!1),O=(0,X.useRef)(!0),k=(0,X.useRef)(),[A,j]=(0,X.useState)(``),[M,N]=(0,X.useState)(!1),[P,F]=(0,X.useState)(!1),[ee,I]=(0,X.useState)(()=>!!(t.trim()||i.length)||Sh()),[L,z]=(0,X.useState)(44),B=(0,X.useRef)(t);B.current=t;let H=!ee,{refs:U,text:W}=Ke(t),te=t.length>at,G=!!(t.trim()||i.length),ie=(0,X.useRef)(G);ie.current=G,(0,X.useEffect)(()=>{l===`error`&&I(!0)},[l]),(0,X.useEffect)(()=>{O.current=!0;let e=e=>{let t=e.type===`focusout`?e.relatedTarget:e.target;t?.closest?.(`.map-island-launch, .map-island-stop, .map-composer-brand`)||(T.current?.contains(t)?I(!0):ie.current||I(!1))},t=e=>{let t=e.target;T.current?.contains(t)||t?.closest?.(`.map-context-menu`)||ie.current||(I(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur())},n=e=>{if(e.key!==`c`||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||e.isComposing)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)||t?.closest?.(`[role="dialog"], [role="menu"]`)||(e.preventDefault(),I(!0),w.current?.focus())};return document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e),document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{O.current=!1,clearTimeout(k.current),document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[]);let ae=(0,X.useRef)(f);(0,X.useEffect)(()=>{f!==ae.current&&(ae.current=f,I(!0),w.current?.focus())},[f]);let oe=(0,X.useRef)(U.length);(0,X.useEffect)(()=>{U.length>oe.current&&(I(!0),w.current?.focus()),oe.current=U.length},[U.length]);let K=()=>{if(!w.current)return;w.current.style.height=`0px`;let e=Math.min(156,Math.max(44,w.current.scrollHeight));w.current.style.height=`${e}px`,z(e)};(0,X.useEffect)(K,[W]),(0,X.useEffect)(()=>(window.addEventListener(`resize`,K),()=>window.removeEventListener(`resize`,K)),[]);let se=()=>{I(!0),w.current?.focus()},ce=()=>{I(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur()},le=(0,X.useRef)(),ue=(0,X.useRef)(typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches);(0,X.useEffect)(()=>()=>clearTimeout(le.current),[]);let fe=()=>{ue.current&&(clearTimeout(le.current),I(!0))},pe=()=>{ue.current&&(clearTimeout(le.current),le.current=setTimeout(()=>{ie.current||T.current?.contains(document.activeElement)||I(!1)},320))};(0,X.useEffect)(()=>{o||F(!1)},[o]);let me=async()=>{if(!W.trim()||D.current||te)return;let e=o;if(e&&i.length){j(v?`附件要等这条回复结束后再发送`:`Attachments can be sent once this reply finishes`);return}D.current=!0;try{(e?await r(t,[],void 0,{whileRunning:!0}):await r(t,i))&&O.current&&(j(``),N(!0),F(e),(!B.current.trim()||B.current===t)&&ce(),clearTimeout(k.current),k.current=setTimeout(()=>N(!1),1800))}finally{D.current=!1}},he=e=>{if(o||D.current||!e.length)return;let{accepted:t,issues:n}=lt(i,e);a([...i,...t]),j(n.map(e=>e.code===`unsupported`?S(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?S(`chat.attachTooLarge`,{name:e.fileName,size:R(e.limitBytes)}):e.code===`too-many`?S(`chat.attachTooMany`,{count:e.limitCount}):S(`chat.attachTotalTooLarge`,{size:R(e.limitBytes)})).join(` `))},q=l?{launching:[v?`任务已接收`:`Task accepted`,v?`正在放入地图…`:`Adding it to your map…`],task:[v?`任务已进入地图`:`Your task is on the map`,v?`跟随地图,查看执行进展`:`Follow its progress on the map`],message:[v?`${p().name} 已回复`:`${p().name} replied`,v?`在对话中查看回复`:`Open the conversation to read it`],error:[v?`发送没有成功`:`Message could not be sent`,v?`草稿已保留,可以重试`:`Your draft is ready to retry`],cancelled:[v?`正在停止回复`:`Stopping reply`,v?`可以发送新消息`:`You can send another message`]}[l]:void 0,ge=[v?`已排队`:`Queued`,v?`这条回复结束后立即处理`:`Answered right after this reply`],_e=q?.[0]||(o&&P?ge[0]:o?c?v?`${p().name} 正在处理`:`${p().name} is working`:v?`继续对话`:`Continue chatting`:M?v?`已发送给 ${p().name}`:`Sent to ${p().name}`:v?`交给 ${p().name}`:`Ask ${p().name}`),ve=q?.[1]||(o&&P?ge[1]:o?c?s||(v?`正在处理你的消息…`:`Processing your message…`):v?`可发送后续消息或停止回复`:`Send a follow-up or stop the reply`:M?v?`点此继续对话`:`Tap to keep the conversation going`:G?v?`草稿已保留,点此继续`:`Draft saved — tap to continue`:v?`描述目标,看它变成成果`:`Turn your next idea into a result`),ye=l||(o?`working`:M?`sent`:`idle`);return(0,Y.jsxs)(`div`,{ref:T,className:`map-composer-dock map-island-dock`,"data-compact":H,"data-state":ye,"data-pending":o,style:{"--map-editor-height":`${L}px`},onPointerEnter:fe,onPointerLeave:pe,onTransitionEnd:e=>{e.target===T.current&&e.propertyName===`width`&&K()},children:[!H&&U.length>0&&(0,Y.jsx)(`div`,{className:`map-reference-chips`,children:U.map((e,t)=>(0,Y.jsxs)(`span`,{title:`${e.source} · ${e.task_id} ${e.step_id||``}`,children:[(0,Y.jsxs)(`span`,{children:[v?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,Y.jsx)(`button`,{"aria-label":v?`移除引用`:`Remove reference`,onClick:()=>n(U.filter((e,n)=>t!==n).map(ne).join(``)+W),children:(0,Y.jsx)(y,{size:12})})]},`${e.task_id}:${e.step_id}:${t}`))}),!H&&!!i.length&&(0,Y.jsx)(`div`,{className:`map-attachment-tray nowheel`,role:`group`,"aria-label":v?`待发送附件`:`Selected attachments`,children:i.map((e,t)=>(0,Y.jsx)(Ve,{file:e,disabled:o,removeLabel:S(`chat.attachRemove`,{name:e.name}),onRemove:()=>{a(i.filter(t=>t!==e)),j(``)}},`${e.name}:${e.lastModified}:${t}`))}),!H&&A&&(0,Y.jsx)(`div`,{className:`map-attachment-notice nowheel`,role:`alert`,children:A}),(0,Y.jsxs)(`div`,{className:`map-composer map-island-surface`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":S(`chat.attach`),title:S(`chat.attach`),"aria-hidden":H,tabIndex:H?-1:0,disabled:o&&!H,onClick:()=>E.current?.click(),children:(0,Y.jsx)(V,{size:25})}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-island-launch`,"aria-label":v?`打开消息输入`:`Open message composer`,"aria-expanded":!H,"aria-controls":C,"aria-hidden":!H,tabIndex:H?0:-1,onClick:se,children:[(0,Y.jsxs)(`span`,{className:`map-island-copy`,children:[(0,Y.jsx)(`strong`,{children:_e}),(0,Y.jsx)(`small`,{title:ve,children:ve})]}),(0,Y.jsx)(`span`,{className:`map-island-indicator`,"aria-hidden":`true`,children:ye===`working`||ye===`launching`?(0,Y.jsxs)(`span`,{className:`map-island-wave`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}):ye===`sent`||ye===`task`||ye===`message`?(0,Y.jsx)(_,{size:16}):(0,Y.jsx)(mt,{size:15})})]}),H&&o&&(0,Y.jsx)(`button`,{type:`button`,className:`map-island-stop`,onClick:u,"aria-label":v?`停止回复`:`Stop reply`,children:(0,Y.jsx)(re,{size:13})}),(0,Y.jsxs)(`form`,{id:C,className:`map-composer-editor`,"aria-hidden":H,onSubmit:e=>{e.preventDefault(),me()},children:[(0,Y.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:Ae,hidden:!0,disabled:o,onChange:e=>{he(Array.from(e.target.files||[])),e.target.value=``}}),(0,Y.jsx)(`textarea`,{ref:w,rows:1,tabIndex:H?-1:0,value:W,"aria-label":v?`给 ${p().name} 发送消息`:`Message ${p().name}`,placeholder:v?`告诉 ${p().name},你想完成什么…`:`What would you like ${p().name} to do?`,onFocus:()=>I(!0),onChange:e=>{N(!1),n(U.map(ne).join(``)+e.target.value)},onPaste:e=>{let t=Me(e.clipboardData);t.length&&(e.preventDefault(),he(t))},onKeyDown:e=>{e.key===`Escape`&&!ct(e)&&!W.trim()&&!i.length&&(e.preventDefault(),e.stopPropagation(),ce()),e.key===`Enter`&&!e.shiftKey&&!ct(e)&&(e.preventDefault(),me())}}),(0,Y.jsxs)(`div`,{className:`map-island-toolbar`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-island-collapse`,tabIndex:H?-1:0,onClick:ce,"aria-label":v?`收起消息输入`:`Collapse message composer`,title:v?`收起(草稿会保留)`:`Collapse (draft is kept)`,children:(0,Y.jsx)(g,{size:15})}),x&&(0,Y.jsx)(Ue,{value:b,onChange:x,disabled:o,tabIndex:H?-1:0}),o&&(0,Y.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),u()},tabIndex:H?-1:0,"aria-label":v?`停止回复`:`Stop reply`,className:`map-send is-pending`,children:(0,Y.jsx)(re,{size:15})},`stop`),(0,Y.jsx)(`button`,{type:`submit`,tabIndex:H?-1:0,disabled:!W.trim()||te,"aria-label":o?v?`在 ${p().name} 工作时发送`:`Send while ${p().name} works`:v?`发送消息`:`Send message`,title:o?v?`排队到这条回复之后处理`:`Queued right after this reply`:void 0,className:`map-send`,children:(0,Y.jsx)(de,{size:20})},`send`)]})]})]}),te&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1 px-3 text-xs text-err`,children:S(`chat.messageTooLong`)}),e,(0,Y.jsx)(`span`,{className:`map-composer-caption`,role:`status`,children:q?`${q[0]} · ${q[1]}`:o&&P?`${ge[0]} · ${ge[1]}`:o?``:M?v?`已发送`:`Sent`:h?`${v?`发送至`:`Send to`} ${m}`:``})]})}function wh(e,t,n){if(e.length<2)return``;let r=[0];for(let t=1;t0))return``;let a=Math.min(n,i/3),o=a*1.22,s=1,c=t=>{let n=Math.max(0,Math.min(i,t));for(;s1&&r[s-1]>n;)s--;let a=r[s]-r[s-1]||1,o=(n-r[s-1])/a,c=e[s-1],l=e[s];return{x:c.x+(l.x-c.x)*o,y:c.y+(l.y-c.y)*o}},l=e=>e*e*(3-2*e),u=e=>{let n=i-e;if(n<=a)return t*2.5*(n/a)**.85;let r=t*(.34+.66*l(Math.min(1,e/Math.max(1,i-o))));return n>=o?r:r+(t*2.5-r)*l((o-n)/(o-a))},d=Math.max(12,Math.min(72,Math.round(i/Math.max(a,1)*1.5))),f=Array.from({length:d+1},(e,t)=>(i-o)*(t/d));f.push(i-(o+a)/2,i-a,i);let p=[],m=[],h=e=>Math.round(e*100)/100;for(let e of f){let t=c(e),n=c(e-i*.004-.5),r=c(e+i*.004+.5),a=r.x-n.x,o=r.y-n.y,s=Math.hypot(a,o)||1,l=u(e)/2,d=-o/s*l,f=a/s*l;p.push(`${h(t.x+d)} ${h(t.y+f)}`),m.push(`${h(t.x-d)} ${h(t.y-f)}`)}return`M ${p.join(` L `)} L ${m.reverse().join(` L `)} Z`}function Th(e,t){let n=1-t;return{x:n**3*e[0].x+3*n**2*t*e[1].x+3*n*t**2*e[2].x+t**3*e[3].x,y:n**3*e[0].y+3*n**2*t*e[1].y+3*n*t**2*e[2].y+t**3*e[3].y}}function Eh(e,t,n=!1){if(!e.length)return null;let r=n?[...e].reverse():e,i=0;for(let e=1;e0&&i+n>=t){let a=(t-i)/n;return{x:r[e-1].x+(r[e].x-r[e-1].x)*a,y:r[e-1].y+(r[e].y-r[e-1].y)*a}}i+=n}return r[r.length-1]}function Dh(e,t,n=0){return e.x>t.x-n&&e.xt.y-n&&e.y({x:n===`left`?-e.x:e.x,y:n===`up`?-e.y:e.y}),s=o(e),c=o(t);i=i.map(e=>({...e,x:n===`left`?-e.x-e.width:e.x,y:n===`up`?-e.y-e.height:e.y}));let l=Math.max(80,n===`loop`?Math.max(Math.abs(c.x-s.x),Math.abs(c.y-s.y))*2.8:0,Math.abs(a?c.y-s.y:c.x-s.x)*(.4+r*.06)),u=[s,a?{x:s.x+0,y:s.y+l}:{x:s.x+l,y:s.y},n===`loop`?{x:c.x,y:c.y+l}:a?{x:c.x-0,y:c.y-l}:{x:c.x-l,y:c.y},c],d=e=>e.flatMap(e=>Array.from({length:31},(t,n)=>Th(e,n/30))),f=e=>d(e).reduce((e,t)=>e+i.filter(e=>Dh(t,e,22)).length,0),p=[u],m=f(p)*1e5;if(m){let e={x:(s.x+c.x)/2,y:(s.y+c.y)/2},t=a?e.x:e.y,n=[...new Set(i.flatMap(e=>a?[e.x-110-r*30,e.x+e.width+110+r*30]:[e.y-110-r*30,e.y+e.height+110+r*30]))].sort((e,n)=>Math.abs(e-t)-Math.abs(n-t)).slice(0,12);for(let e of n){let n=(e-t)*4/3;for(let r of[.25,.4,.55]){let i=Math.max(60,Math.abs(a?c.y-s.y:c.x-s.x)*r),o=[a?[s,{x:s.x+n,y:s.y+i},{x:c.x+n,y:c.y-i},c]:[s,{x:s.x+i,y:s.y+n},{x:c.x-i,y:c.y+n},c]],l=f(o)*1e5+Math.abs(e-t)+Math.abs(r-.4)*100;le.map(o)),{path:`M ${e.x} ${e.y}`+p.map(e=>` C ${e[1].x} ${e[1].y}, ${e[2].x} ${e[2].y}, ${e[3].x} ${e[3].y}`).join(``),points:d(p),labels:[.5,.4,.6,.3,.7,.2,.8,.35,.45,.55,.65,.25,.75,.15,.85].map(e=>{let t=Math.min(p.length-1,Math.floor(e*p.length));return Th(p[t],e*p.length-t)})}}var kh=new WeakMap,Ah=.5,jh=.05;function Mh(e){return e>=Ah?Math.max(Ah,Math.floor(e*8)/8):ee+(/[^\x00-\x7F]/.test(t)?10.5:7),20);return{width:Math.min(t,216),height:26}}function Fh(e,t){let n=e.getState(),r=[...n.nodeLookup.values()].filter(e=>!e.hidden).map(e=>({id:e.id,...e.internals.positionAbsolute,width:e.width||e.measured.width||0,height:e.height||e.measured.height||0}));function i(e,t){let r=n.nodeLookup.get(e);if(!r)return null;let{x:i,y:a}=r.internals.positionAbsolute,o=r.width||r.measured.width||0,s=r.height||r.measured.height||0;return{x:i+(t===`left`?0:t===`right`?o:o/2),y:a+(t===`top`?0:t===`bottom`?s:s/2)}}let a=n.edges.filter(e=>!e.hidden).map(e=>({...e,s:i(e.source,e.sourceHandle),t:i(e.target,e.targetHandle)})),o=JSON.stringify([r,a.map(e=>[e.id,e.s,e.t,e.label,e.data?.lane,e.sourceHandle,e.targetHandle,e.className])]),s=kh.get(e);if(!s||s.key!==o){let t=new Map,n=new Map;for(let e of a)n.set(e.id,/(?:^|\s)map-edge-(\w+)/.exec(e.className??``)?.[1]),e.s&&e.t&&t.set(e.id,Oh(e.s,e.t,e.source===e.target?`loop`:e.sourceHandle===`left`?`left`:e.sourceHandle===`top`?`up`:e.sourceHandle===`bottom`,Number(e.data?.lane||0),r.filter(t=>t.id!==e.source&&t.id!==e.target)));s={key:o,routes:t,kinds:n,zoom:-1,labels:new Map},kh.set(e,s)}let c=Mh(t);return s.zoom!==c&&(s.zoom=c,s.labels=new Map,c&&Ih(s,a,r,c)),s}function Ih(e,t,n,r){let i=[...n],a=e=>+!!e.data?.quiet;for(let n of[...t].sort((e,t)=>a(e)-a(t))){let t=e.routes.get(n.id);if(!t||!n.label)continue;let a=Ph(n.label),o=a.width/r,s=a.height/r,c=[0,3,4,5,6][Number(n.data?.lane||0)%5],l=[t.labels[c],...t.labels.filter((e,t)=>t!==c)].filter(e=>i.every(t=>e.x+o/2<=t.x||e.x-o/2>=t.x+t.width||e.y+s/2<=t.y||e.y-s/2>=t.y+t.height)),u,d=1/0;for(let t of l){let r={x:t.x-o/2,y:t.y-s/2,width:o,height:s},i=0;for(let[t,a]of e.routes)t!==n.id&&a.points.some(e=>Dh(e,r))&&i++;if(ie),a=(0,X.useId)().replace(/:/g,``),o=`relation-arrow-${a}`,s=`relation-flow-${a}`,c=Fh(Fu(),i),l=c.routes.get(e),u=c.labels.get(e);if(!l)return null;let d=c.kinds.get(e),f=d===`fanout`||d===`fanin`,p=!d||n?.stroke===Lh?n?.stroke||`#7594ad`:`var(--map-edge-${d}, ${n?.stroke||`#7594ad`})`,m=(Number(n?.strokeWidth||2)+(f?.4:0))/i,h=f?Eh(l.points,(d===`fanout`?2:15)/i,d===`fanin`):null,g=typeof t==`string`?Nh(t):void 0,_=l.points[0],v=l.points[l.points.length-1],y=!!_&&!!v&&n?.stroke!==Lh&&(Math.abs(_.x-v.x)>1||Math.abs(_.y-v.y)>1),b=!f&&!n?.strokeDasharray,x=b?wh(l.points,Number(n?.strokeWidth||2)*1.45/i,16/i):``;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`defs`,{children:[(0,Y.jsx)(`marker`,{id:o,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:9/i,markerHeight:9/i,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,style:{fill:p}})}),y&&(0,Y.jsxs)(`linearGradient`,{id:s,gradientUnits:`userSpaceOnUse`,x1:_.x,y1:_.y,x2:v.x,y2:v.y,children:[(0,Y.jsx)(`stop`,{offset:`0`,style:{stopColor:p,stopOpacity:b?.34:.28}}),(0,Y.jsx)(`stop`,{offset:`0.55`,style:{stopColor:p,stopOpacity:b?.7:.78}}),(0,Y.jsx)(`stop`,{offset:`1`,style:{stopColor:p,stopOpacity:1}})]})]}),(0,Y.jsxs)(Em,{path:l.path,delay:r?.growthDelay,padding:24/i,children:[(0,Y.jsx)(Vf,{id:e,path:l.path,markerEnd:x?void 0:`url(#${o})`,style:{...n,stroke:x?`transparent`:y?`url(#${s})`:p,strokeLinecap:`round`,vectorEffect:`none`,strokeWidth:m,strokeDasharray:n?.strokeDasharray?String(n.strokeDasharray).split(/[\s,]+/).map(e=>Number(e)/i).join(` `):void 0}}),x&&(0,Y.jsx)(`path`,{className:`map-edge-ink`,d:x,style:{fill:y?`url(#${s})`:p,opacity:n?.opacity},"aria-hidden":`true`}),!f&&_&&(0,Y.jsx)(`circle`,{className:`map-edge-anchor`,cx:_.x,cy:_.y,r:(x?2.1:2.6)/i,style:x?{fill:p,opacity:Number(n?.opacity??1)*.62}:{fill:`var(--map-paper)`,stroke:p,strokeWidth:1.4/i,opacity:n?.opacity},"aria-hidden":`true`}),h&&(0,Y.jsx)(`circle`,{className:`map-edge-joint`,cx:h.x,cy:h.y,r:3.2/i,style:{fill:p,opacity:n?.opacity},"aria-hidden":`true`})]}),(r?.active&&!r.muted||r?.lit)&&(0,Y.jsx)(Hp,{children:(0,Y.jsx)(`div`,{className:`map-edge-spark`,"data-lit":!r?.active&&!!r?.lit,"aria-hidden":`true`,style:{offsetPath:`path("${l.path}")`,width:8/i,height:8/i,margin:`${-4/i}px 0 0 ${-4/i}px`,animationDelay:`${-((e.charCodeAt(0)*131+e.length*47)%2800)}ms`}})}),t&&g!==``&&u&&(0,Y.jsx)(Hp,{children:(0,Y.jsx)(`div`,{className:`map-relation-label nodrag nopan`,"data-kind":d,"data-lit":!!r?.lit,"data-quiet":!!r?.quiet,title:g,style:{opacity:r?.quiet&&!r.lit?0:n?.opacity,pointerEvents:r?.quiet&&!r.lit?`none`:void 0,transform:`translate(-50%, -50%) translate(${u.x}px, ${u.y}px) scale(${1/i})`},children:g??t})})]})}function zh({open:e,info:t,zh:n,onChoose:r,readOnly:i=!1}){return(0,Y.jsx)(E,{open:e,onClose:()=>r({mode:`off`}),label:n?`选择地图加载范围`:`Choose map history`,width:`max-w-lg`,children:(0,Y.jsxs)(`div`,{className:`map-history-choice`,children:[(0,Y.jsx)(`h2`,{children:n?`选择地图加载范围`:`Choose map history`}),(0,Y.jsx)(`p`,{children:n?`本会话有 ${t.task_count} 个任务,历史记录约 ${(t.event_bytes/1024/1024).toFixed(1)} MB。`:`This session has ${t.task_count} tasks and about ${(t.event_bytes/1024/1024).toFixed(1)} MB of history.`}),(0,Y.jsx)(`p`,{children:i?n?`只读模式只加载历史记录,不调用模型。较长历史需要一些加载时间。`:`Read-only mode loads records without model calls. Long histories take time to load.`:n?`加载较长历史需要一些时间。生成卡片摘要与关系说明会调用已配置的模型,并消耗额外 Token。已有摘要会优先复用。`:`Loading a long history takes time. Card summaries and relationship descriptions use your configured model and consume additional tokens. Existing summaries are reused.`}),(0,Y.jsxs)(`div`,{className:`map-history-options`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`current`,since:t.current_task_ts,eventSince:t.current_event_ts,taskId:t.current_task_id||void 0}),children:[(0,Y.jsx)(`strong`,{children:n?`从当前进度加载`:`Start at current progress`}),(0,Y.jsx)(`span`,{children:n?`推荐 · 加载当前任务及后续进度,保留相关连接`:`Recommended · Load current and future work with its connections`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`full`}),children:[(0,Y.jsx)(`strong`,{children:n?`从头加载`:`Load from the beginning`}),(0,Y.jsx)(`span`,{children:i?n?`分批加载历史记录,查看已有说明`:`Load history in pages and view existing explanations`:n?`分批加载历史记录;打开卡片阅读时,再整理它的说明`:`Load history in pages; prepare an explanation when you open a card to read`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`off`}),children:[(0,Y.jsx)(`strong`,{children:n?`不开启地图模式`:`Keep map mode off`}),(0,Y.jsx)(`span`,{children:n?`不加载地图,也不生成摘要`:`Do not load the map or generate summaries`})]})]}),(0,Y.jsx)(`small`,{children:n?`选择仅用于本会话,可随时更改加载范围。`:`This choice applies to this session and can be changed later.`})]})})}function Bh(e){try{let t=JSON.parse(e||`null`);return!t||![`full`,`current`,`off`].includes(t.mode)||t.mode===`current`&&![t.since,t.eventSince].every(e=>typeof e==`number`&&Number.isFinite(e)&&e>=0)?null:t}catch{return null}}function Vh(e,t){if(!e||e.id!==t.id||t.reset_history)return t;let n=new Map((!t.incremental||t.tasks_complete?[]:e.tasks).map(e=>[e.id,e]));for(let e of t.tasks)n.set(e.id,e);for(let e of t.removed_task_ids||[])n.delete(e);let r=new Map(e.events.filter(e=>t.incremental&&!t.team_events_complete||e.type!==`team.task`).map(e=>[e.id,e]));for(let e of t.events)r.set(e.id,e);for(let e of t.removed_event_ids||[])r.delete(e);return a(e,{...e,...t,tasks:[...n.values()].sort((e,t)=>(e.ts||0)-(t.ts||0)||e.id.localeCompare(t.id)),events:[...r.values()].filter(e=>n.has(e.item_id))})}function Hh(e,t,n){return e?t?.history_loading?400:!Uh(n)||t?.events.some(e=>e.type===`team.task`&&Te.has(e.status||``))?15e3:!1:!1}function Uh(e){return e.manager_requests?.some(e=>e.status===`running`)?!1:!e.daemon.alive||e.continuous?.enabled===!1&&/pause|stop/i.test(e.continuous.done_reason||``)?!0:e.daemon.health?.state===`stopped`}var Wh=new Map;function Gh(e){let t=Wh.get(e);if(t)return t;try{let t=JSON.parse(B(`argus.map.camera.v1:`+e)||`null`);if(t&&[t.viewport,t.overview].every(e=>e&&[e.x,e.y,e.zoom].every(Number.isFinite)&&e.zoom>=.035&&e.zoom<=3.5)&&(t.focusId===null||typeof t.focusId==`string`)&&typeof t.detailed==`boolean`)return{camera:t}}catch{}return{}}function Kh(e,t){for(Wh.delete(e),Wh.set(e,t);Wh.size>8;)Wh.delete(Wh.keys().next().value);t.camera&&z(`argus.map.camera.v1:`+e,JSON.stringify(t.camera))}var qh={task:Rm,branch:Zm},Jh={relation:Rh},Yh={done:`#a9c4b6`,running:`#9fb6cc`,question:`#dcc797`,failed:`#d9a79f`,review_unavailable:`#cdbba3`,held:`#cdbba3`,paused:`#cdbba3`,superseded:`#c5bdcd`,aborted:`#c6c8cb`,skipped:`#c6c8cb`,missing:`#c6c8cb`};function Xh({events:e,zh:t}){let n=[...new Map(e.filter(e=>e.type===`team.task`).map(e=>[e.id,e])).values()];if(!n.length)return null;let r=n.filter(e=>e.status===`done`).length,i=n.filter(e=>Te.has(e.status||``)).length,a=n.filter(e=>e.status===`failed`).length;return(0,Y.jsxs)(`div`,{className:`map-team-progress`,role:`status`,"aria-label":t?`子任务进度`:`Subtask progress`,children:[(0,Y.jsx)(`strong`,{children:t?`子任务`:`Subtasks`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(_,{size:12}),(0,Y.jsxs)(`b`,{children:[r,`/`,n.length]}),` `,t?`已完成`:`completed`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:i}),` `,t?`进行中`:`running`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:a}),` `,t?`失败`:`failed`]})]})}function Zh({data:e,zh:t,composer:n,activePhase:r,waiting:s,snapshot:c,currentTaskId:l,events:d,pendingLabel:f,readOnly:p,sessionId:m,viewKey:h,paused:g,actions:_,replacements:v}){let[b,x]=(0,X.useState)(!1),[S,w]=(0,X.useState)(()=>e.kind===`live`&&!p&&_.conversationEvents.some(e=>e.type===`ui.operator`||e.type===`ui.argus`)),O=[..._.conversationEvents].reverse().find(e=>e.type===`ui.operator`),k=O?String(O.message_id||O.ts||``):``,ee=(0,X.useRef)(k),L=(0,X.useRef)(n.pending);(0,X.useEffect)(()=>{e.kind===`live`&&!p&&(k&&k!==ee.current||n.pending&&!L.current)&&(w(!0),x(!1)),ee.current=k,L.current=n.pending},[k,n.pending,e.kind,p]);let[R,z]=(0,X.useState)(()=>new Set),B=(0,X.useCallback)(e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[V,H]=(0,X.useState)(null),U=(0,X.useRef)(0),re=(0,X.useRef)(!0);(0,X.useEffect)(()=>(re.current=!0,()=>{re.current=!1}),[]);let K=(0,X.useMemo)(()=>we(e.tasks),[e.tasks]),[de,fe,pe]=Up([]),he=(0,X.useRef)(null),q=dh(he,!p),_e=Gp(),ve=(0,X.useRef)(!1),[ye,xe]=(0,X.useState)(!1),Se=(0,X.useRef)(null);Se.current||=Gh(h);let[Ce,Ae]=(0,X.useState)(()=>{let e=Se.current?.scene?.cards.find(e=>e.id===Se.current?.camera?.focusId);return new Set(e&&e.id!==e.task.id?[e.task.id]:[])}),[je,Me]=(0,X.useState)(null),[Ne]=(0,X.useState)(()=>new Set(Se.current?.scene?.cards.map(e=>e.id))),Pe=de.find(e=>e.id===q.focusId),Ie=(0,X.useMemo)(()=>ce(e.tasks,e.events),[e.tasks,e.events]),Le=et(m,t?`zh-CN`:`en-US`),[Be,Ve]=(0,X.useState)(null),Ue=(0,X.useCallback)((t,n)=>{Ve(r=>n?{nodeId:t,key:n,foundationId:Le.id}:r?.nodeId===t&&!e.tasks.some(e=>e.id===r.key)?null:r)},[e.tasks,Le.id]);(0,X.useEffect)(()=>{Ve(t=>t&&(t.nodeId===q.focusId||e.tasks.some(e=>e.id===t.key))?t:null)},[q.focusId,e.tasks]);let J=Be?e.tasks.find(e=>e.id===Be.key):void 0,Ge=J?.turn_kind===`qa`?e.events.find(e=>e.item_id===J.id&&e.type===`turn.replied`):void 0,Je=Be?de.find(e=>e.id===Be.nodeId):void 0,Ye=J?.id??(Be?.nodeId===q.focusId?Be.key:null),Xe=(0,X.useMemo)(()=>oe(e.tasks),[e.tasks]),Ze=Xe.findIndex(e=>e.id===Pe?.data.task.id),[Qe,tt]=(0,X.useState)(null),nt=K.tasks.find(e=>e.id===Qe),rt=(0,X.useMemo)(()=>nt?ke(K,nt.id):null,[K,nt]),it=(0,X.useMemo)(()=>nt&&rt?new Set([nt.id,...rt.upstream.map(e=>e.id),...rt.downstream.map(e=>e.id)]):null,[nt,rt]),{copy:at,ready:ot,generating:st,readingRequest:ct,readingNeedsUpdate:lt,readingGenerating:ut,generationPhase:pt,foundationRequired:mt,questionContext:ht,generationError:gt,generationUnavailable:vt,retry:bt}=hh(e,J?.id||Pe?.data.task.id||null,t,!p&&!e.history_loading,Pe?.data.layout.steps,m,!1,Ye,Be?.foundationId),xt=(0,X.useMemo)(()=>ct?{request:ct,questionContext:ht,pending:lt,generating:ut,phase:pt,error:gt,unavailable:vt,foundationRequired:mt,retry:p?void 0:bt,retryDisabled:st}:void 0,[ct,ht,lt,st,ut,pt,gt,vt,p,bt,mt]),St=(0,X.useMemo)(()=>Re(Ee(K,at?.relations||[],t)),[K,at?.relations,t]),Ct=xh(e,t,!p&&!e.history_loading,m),wt=_h(e,St,t,!p&&!e.history_loading,m),Tt=(0,X.useMemo)(()=>Ee(K,at?.relations||[],t,wt),[K,at?.relations,t,wt]),Dt=(0,X.useRef)(Se.current.scene),kt=(q.canvasSize.width||window.innerWidth)<640,Z=(0,X.useMemo)(()=>{let n=me(K,e.events,t,Dt.current,Tt,Ce,kt);return Dt.current=a(Dt.current,n),Dt.current},[K,e.events,t,Tt,Ce,kt]),At=(0,X.useRef)(null),jt=(0,X.useMemo)(()=>(At.current=a(At.current,le(Oe(K,e.events,t,48),R,t)),At.current),[K,e.events,t,R]),Mt=(0,X.useRef)(null),Pt=(0,X.useMemo)(()=>{let e=jt.tasks.filter(e=>e.branch);if(!e.length)return{links:Z.links,positions:Z.positions,frames:Z.frames,structure:Z.structure,branches:e,branchAnchor:new Map};let t=new Map;for(let e of Z.cards)t.set(e.task.id,e.id);let n=new Map(e.map(e=>[e.id,t.get(e.parent_id)??e.parent_id])),r={...Z.frames};for(let t of e)r[t.id]={...t.group?qm:Km,scale:1};let i=[...Z.links,...jt.links.filter(e=>e.kind===`fanout`||e.kind===`fanin`).map(e=>({...e,source:t.get(e.source)??e.source,target:t.get(e.target)??e.target}))],a=new Map;for(let t of e){let e=n.get(t.id);a.set(e,[...a.get(e)??[],t.id])}let o=Z.cards.flatMap(e=>[e.id,...a.get(e.id)??[]]),s=JSON.stringify([o.map(e=>[e,r[e].width,r[e].height]),i.map(e=>[e.source,e.target,e.kind])]),c=Mt.current?.structure===s?Mt.current.positions:dt(o,i,r);return Mt.current={structure:s,positions:c},{links:i,positions:c,frames:r,structure:s,branches:e,branchAnchor:n}},[Z,jt]),It=Vt(Pt.positions,q.reducedMotion),[Rt,zt]=(0,X.useState)(null),Bt=(0,X.useMemo)(()=>Ut(Pt.links,Rt),[Pt.links,Rt]),[Ht,Gt]=(0,X.useState)(!1),[qt,Jt]=(0,X.useState)(!1),Yt=(0,X.useMemo)(()=>new Map(Z.cards.map(e=>[e.id,e.ordinal])),[Z.cards]),Xt=Lt(Z,!!e.history_loading),Zt=(0,X.useMemo)(()=>$e(e.events),[e.events]),Qt=async(e,t=[],r,i)=>{if(i?.whileRunning)return n.onSend(e,t,void 0,i);let a=++U.current,o=he.current?.querySelector(`.map-composer`)?.getBoundingClientRect();H({id:a,text:Ke(e).text.replace(/\s+/g,` `).slice(0,180),origin:{x:o?.left??20,y:o?.top??innerHeight-100,width:o?.width??260,height:o?.height??56}});let s=!1,c=e=>{e.type===`task`&&(s=!0),re.current&&e.type===`settled`&&e.outcome===`message`&&!s&&(w(!0),x(!1)),re.current&&H(t=>t?.id===a?{...t,result:e}:t)};try{let r=await n.onSend(e,t,c);return r&&re.current&&Ke(e).refs.length>0&&(w(!0),x(!1)),r||c({type:`settled`,outcome:`error`}),r}catch(e){throw c({type:`settled`,outcome:`error`}),e}},$t=()=>{H(e=>e?{...e,result:{type:`settled`,outcome:`cancelled`}}:null),n.onCancel()};(0,X.useEffect)(()=>{if(!_e||ve.current||!ot||Se.current?.camera&&e.history_loading)return;let t=requestAnimationFrame(()=>{if(ve.current=!0,Se.current?.camera)q.restore(Se.current.camera);else if(q.fit(),e.kind===`live`&&he.current.clientWidth<640){let t=ae(e.tasks);t&&q.fit(new Set([t.id]))}xe(!0)});return()=>cancelAnimationFrame(t)},[_e,q.fit,q.enter,q.restore,e.kind,e.tasks,Z.cards,e.history_loading,ot]),(0,X.useEffect)(()=>{let e=he.current;if(!e||q.reducedMotion)return;let t=null,n=n=>{t??=requestAnimationFrame(()=>{t=null;let r=e.getBoundingClientRect();!r.width||!r.height||(e.style.setProperty(`--lean-x`,((n.clientX-r.left)/r.width-.5).toFixed(3)),e.style.setProperty(`--lean-y`,((n.clientY-r.top)/r.height-.5).toFixed(3)))})},r=()=>{e.style.setProperty(`--lean-x`,`0`),e.style.setProperty(`--lean-y`,`0`)};return e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,r),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,r)}},[q.reducedMotion]),(0,X.useEffect)(()=>{if(!ye||Se.current?.camera||q.reducedMotion)return;Gt(!0);let e=window.setTimeout(()=>Gt(!1),Wt);return()=>window.clearTimeout(e)},[ye,q.reducedMotion]),(0,X.useEffect)(()=>{let e=()=>{ve.current&&Kh(h,{scene:Dt.current,camera:q.capture()})};return window.addEventListener(`pagehide`,e),()=>{e(),window.removeEventListener(`pagehide`,e)}},[h,q.capture]),(0,X.useEffect)(()=>{if(!_e)return;let e=requestAnimationFrame(q.fitUpdatedScene);return()=>cancelAnimationFrame(e)},[Pt.structure,_e,q.fitUpdatedScene]);let en=(0,X.useRef)(n);en.current=n;let tn=(0,X.useCallback)(e=>{if(p)return;let t=en.current;t.onChange(ne(e)+t.value),window.setTimeout(()=>document.querySelector(`.map-composer textarea`)?.focus(),0)},[p]),[nn,rn]=(0,X.useState)(null),an=o(),on=i({queryKey:[`map-notes`,m],queryFn:({signal:e})=>u.mapNotes(m,e),enabled:e.kind===`live`&&!p,staleTime:6e4}),sn=(0,X.useMemo)(()=>({notes:Gm(on.data?.notes??[])}),[on.data]),[cn,ln]=(0,X.useState)(null),[un,dn]=(0,X.useState)(``),[fn,pn]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!cn)return;let e=e=>{e.target.closest(`.map-note-editor`)||ln(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),ln(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[cn]);let mn=async()=>{let e=cn,t=un.trim();if(!(!e||!t)){pn(!1);try{await u.addMapNote(m,{node_id:e.ref.task_id,text:t}),await an.invalidateQueries({queryKey:[`map-notes`,m]}),ln(null),dn(``)}catch{pn(!0)}}},hn=(0,X.useCallback)((e,t)=>{p||rn({ref:e,x:Math.min(window.innerWidth-180,t.x),y:Math.min(window.innerHeight-140,t.y)})},[p]);(0,X.useEffect)(()=>{if(!nn)return;let e=e=>{e.target.closest(`.map-context-menu`)||rn(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),rn(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[nn]);let[gn,_n]=(0,X.useState)(``),vn=(0,X.useCallback)(e=>`${e.task.title} ${e.task.objective??``} ${at?.cards[e.task.id]?.title||``} ${at?.cards[e.task.id]?.summary||``} ${Ct[e.task.id]?.title||``} ${Ct[e.task.id]?.summary||``} ${e.part>1?t?`续篇 ${e.part-1}`:`Continued ${e.part-1}`:``}`.toLowerCase(),[at,Ct,t]),yn=(0,X.useMemo)(()=>gn?Z.cards.filter(e=>vn(e).includes(gn.toLowerCase())):[],[gn,Z.cards,vn]),bn=yn.findIndex(e=>e.id===q.focusId),[xn,Sn]=(0,X.useState)(K.tasks.length),[Cn,wn]=(0,X.useState)(!1),[Tn,En]=(0,X.useState)(!1),Dn=v?.shown??Tn,On=v?.toggle??(()=>En(e=>!e)),[kn,An]=(0,X.useState)(``),jn=(0,X.useCallback)(e=>{if(tt(e),_n(``),An(``),e){let{upstream:t,downstream:n}=ke(K,e);q.fit(new Set([e,...t.map(e=>e.id),...n.map(e=>e.id)]))}else q.fit()},[q.fit,K]),Mn=(0,X.useCallback)((e,t=!1)=>{let n=Dt.current?.allCards.find(t=>t.id===e);if(n&&!Ce.has(n.task.id)&&(t||e!==n.task.id)){Ae(e=>new Set([...e,n.task.id])),Me(e);return}nt&&n?jn(n.task.id===nt.id?null:n.task.id):q.enter(e)},[q.enter,nt,jn,Ce]),Nn=(0,X.useCallback)(e=>{let t=Ce.has(e);if(Ae(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),Pe?.data.task.id===e){let n=Dt.current?.allCards.filter(t=>t.task.id===e).at(-1);Me(t?e:n?.id??e)}},[Ce,Pe?.data.task.id]);(0,X.useEffect)(()=>{!je||!de.some(e=>e.id===je)||(q.enter(je),Me(null))},[je,de,q.enter]);let Pn=(0,X.useCallback)(()=>{tt(null),An(``),q.fit()},[q.fit]);(0,X.useEffect)(()=>{fe(n=>a(n,Z.cards.map(n=>({id:n.id,type:`task`,position:It[n.id]??Z.positions[n.id],width:Z.frames[n.id].width,height:Z.frames[n.id].height,style:{width:Z.frames[n.id].width,height:Z.frames[n.id].height},data:{...n,zh:t,open:Mn,toggleHistory:Nn,readStep:q.readStep,readCopy:Ue,menu:hn,quote:tn,source:e.id,readOnly:p,live:e.kind===`live`,paused:g,seenCards:Ne,restoring:!!Se.current?.camera&&!ve.current,layout:Z.layouts[n.id],frame:Z.frames[n.id],plannedWidth:Zt.get(n.task.id),focused:!1,detailed:!1}}))))},[K,Z,Pt,It,t,fe,Mn,Nn,q.readStep,Ue,hn,tn,e.id,e.kind,p,g,Ne,Zt]),(0,X.useEffect)(()=>{Sn(e=>Math.min(Math.max(e,1),K.tasks.length))},[K.tasks.length]),(0,X.useEffect)(()=>{if(!Cn||q.detailed)return;let e=window.setInterval(()=>Sn(e=>e>=K.tasks.length?(wn(!1),e):e+1),900);return()=>window.clearInterval(e)},[Cn,K.tasks.length,q.detailed]),(0,X.useEffect)(()=>{if(!qt||Cn||xnJt(!1),1400);return()=>window.clearTimeout(e)},[qt,Cn,xn,K.tasks.length]);let Fn=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(t=>e.kind===`live`&&!qt||t.ordinal<=xn).map(e=>e.id));for(let[e,n]of Pt.branchAnchor)t.has(n)&&t.add(e);return t},[Z.cards,xn,e.kind,qt,Pt.branchAnchor]),In=(0,X.useRef)([]),Ln=(0,X.useMemo)(()=>{let e=de.map(e=>({...e,hidden:!Fn.has(e.id),data:{...e.data,copy:at?{version:at.version,cards:Object.fromEntries([e.data.task.id,...e.data.layout.steps.map(e=>e.id)].filter(e=>at.cards[e]).map(e=>[e,at.cards[e]]))}:void 0,words:Ct[e.data.task.id],readerCopy:Be?.nodeId===e.id?xt:void 0,focused:e.id===q.focusId,detailed:q.detailed&&e.id===q.focusId,canvasSize:q.canvasSize,lit:Bt.nodes.has(e.id),hovered:e.id===Rt,arriving:Ht,revealing:qt,phase:r&&Te.has(e.data.task.status)?r:void 0,waiting:s&&s.taskId===e.data.task.id?s.sentence:void 0,growthDelay:Xt.cards[e.id],dispatchState:V?.result?.type===`task`&&V.result.taskId===e.data.task.id&&!n.historical?V.landed?`landed`:`receiving`:void 0,growingSteps:Object.fromEntries(e.data.layout.steps.flatMap(t=>{let n=Xt.steps[Ft(e.id,t.id)];return n==null?[]:[[t.id,n]]})),growingLinks:Object.fromEntries(e.data.layout.links.flatMap(t=>{let n=Xt.links[Ft(e.id,t.id)];return n==null?[]:[[t.id,n]]}))},style:{...e.style,opacity:it&&!it.has(e.data.task.id)||gn&&!vn(e.data).includes(gn.toLowerCase())?.22:1}}));return In.current=a(In.current,e),In.current},[de,Fn,q.focusId,q.detailed,q.canvasSize,gn,vn,at,Ct,Be,xt,t,Xt,V,n.historical,it,Bt,Rt,Ht,qt,r,s]),Rn=(0,X.useRef)([]),zn=(0,X.useMemo)(()=>{let e=new Map;for(let t of Pt.branches){if(t.group)continue;let n=t.parent_id??``;e.set(n,(e.get(n)??0)+1)}let n=new Map,r=Pt.branches.map(r=>{let i=r.parent_id??``,a=Pt.frames[r.id],o=r.group?void 0:(n.get(i)??0)+1;return o!==void 0&&n.set(i,o),{id:r.id,type:`branch`,position:It[r.id]??{x:0,y:0},width:a.width,height:a.height,style:{width:a.width,height:a.height,opacity:it&&!it.has(i)?.22:1},hidden:!Fn.has(r.id),draggable:!1,selectable:!1,focusable:!1,data:{task:r,zh:t,parentCardId:Pt.branchAnchor.get(r.id),open:Mn,toggleGroup:B,fanIndex:o,fanCount:o===void 0?void 0:e.get(i)}}});return Rn.current=a(Rn.current,r),Rn.current},[Pt,It,Fn,t,Mn,B,it]),Bn=(0,X.useMemo)(()=>zn.length?[...Ln,...zn]:Ln,[Ln,zn]),Vn=(0,X.useMemo)(()=>{let n=Pt.links.filter(e=>Fn.has(e.source)&&Fn.has(e.target)&&(e.kind!==`replacement`||Dn)),r=be(n),i=new Map(Z.cards.map(e=>[e.id,e.task])),a=new Set;if(e.kind===`live`&&!g){for(let e of Z.cards)Te.has(e.task.status)&&a.add(e.id);for(let e of Pt.branches)Te.has(e.status)&&a.add(e.id)}return n.map((e,n)=>{let o=e.kind===`fanout`||e.kind===`fanin`,s=i.get(e.source)?.id,c=i.get(e.target)?.id,l=!!nt&&e.kind===`dependency`&&(s===nt.id||c===nt.id),u=!!nt&&!l&&(e.kind!==`continuation`||s!==nt.id);return{id:e.id,source:e.source,target:e.target,...te({...It[e.source],...Pt.frames[e.source]},{...It[e.target],...Pt.frames[e.target]}),type:`relation`,data:{growthDelay:Xt.links[e.id]??(Ht?Kt(Yt.get(e.source)??1):qt&&Yt.get(e.target)===xn?120:void 0),active:a.has(e.target),lit:Bt.edges.has(e.id),lane:r[n],muted:u,quiet:!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)},className:`map-edge-${e.kind}${Bt.edges.has(e.id)?` is-lit`:``}`,label:o?void 0:e.label||(e.kind===`replacement`?(i.get(e.source)?.superseded_reason||``).replace(/\s+/g,` `).slice(0,60)||(t?`转入新计划`:`New plan`):e.kind===`dependency`?t?`依赖`:`Dependency`:t?`同一研究`:`Related work`),labelStyle:{fontSize:30,fill:e.kind===`replacement`?`#95809f`:`#6685a4`},labelBgPadding:[12,6],labelBgBorderRadius:12,labelBgStyle:{fill:`var(--map-paper)`,fillOpacity:.96},style:{opacity:u?.12:1,stroke:e.cycle?`#dc6648`:e.kind===`replacement`?`#a48caf`:e.kind===`dependency`?`#527fa7`:`#7594ad`,strokeWidth:l?2.6:e.kind===`dependency`?2:o?1.1:1.6,vectorEffect:`non-scaling-stroke`,strokeDasharray:e.kind===`dependency`||e.kind===`context`||e.kind===`continuation`||o?void 0:`5 6`},markerEnd:{type:Hs.ArrowClosed,color:e.kind===`replacement`?`#a48caf`:`#8aa5b8`,width:32,height:32},ariaLabel:e.evidence||(o?`Team branch: ${e.source} → ${e.target}`:e.kind===`dependency`?`Dependency: ${e.source} → ${e.target}`:`Plan replacement: ${e.source} → ${e.target_plan_id} (${e.target_count} tasks, representative ${e.target})`)}})},[Pt,Fn,Dn,t,Xt,e.kind,g,Z.cards,nt,It,Bt,Ht,qt,xn,Yt]),Hn=K.links.filter(e=>e.kind===`replacement`).length,Un=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(e=>e.completionScope).map(e=>e.task.id)),n={done:0,ended:0,running:0,question:0,review_unavailable:0,held:0,failed:0,other:0};for(let r of e.tasks)t.has(r.id)?n.ended++:r.status===`done`?n.done++:Te.has(r.status)?n.running++:r.pending_question?n.question++:De(r)===`review_unavailable`?n.review_unavailable++:De(r)===`held`?n.held++:r.status===`failed`?n.failed++:n.other++;return n},[e.tasks,Z.cards]),Wn=Un.done,Gn=(0,X.useCallback)(e=>at?.cards?.[`${e.id}:outcome`]?.summary||``,[at]),Kn=(0,X.useMemo)(()=>e.tasks.some(e=>e.turn_kind!==`qa`&&e.kind!==`turn`)?ie(e.tasks,e.events,t,Gn):null,[e.tasks,e.events,t,Gn]),qn=He(c,c.mission_view,d),Jn=Fe(qn,c.mission_view,d,t?`zh-CN`:`en`,_.connected,We(c,c.mission_view,qn.taskId)),Yn=e=>{tt(null),An(``),Sn(t=>Math.max(t,Z.cards.find(t=>t.id===e)?.ordinal||1)),q.enter(e)},Xn=()=>{let e=Z.cards.filter(e=>e.task.id===Ie?.id).at(-1);e&&(Ve(null),Yn(e.id))},Zn=()=>{let n=ae(e.tasks);n?(Yn(Z.cards.filter(e=>e.task.id===n.id).at(-1).id),An(``)):An(t?`发送一个目标,地图就会开始生长`:`Send a goal to start your map`)},Qn=()=>{let e=Xe[(Ze+1)%Xe.length];e&&Yn(Z.cards.filter(t=>t.task.id===e.id).at(-1).id)};(0,X.useEffect)(()=>{let e=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.isComposing)&&!e.target?.closest(`input, textarea, select, [contenteditable], [role="dialog"]`)){if(e.key===`/`)e.preventDefault(),he.current?.querySelector(`.map-search input`)?.focus();else if(e.key===`f`||e.key===`F`)Pn();else if((e.key===`ArrowRight`||e.key===`ArrowLeft`)&&q.detailed&&q.focusId){let t=Z.cards.filter(e=>Fn.has(e.id)),n=t.findIndex(e=>e.id===q.focusId);if(n<0)return;let r=t[n+(e.key===`ArrowRight`?1:-1)];r&&(e.preventDefault(),q.enter(r.id))}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pn,q.enter,q.detailed,q.focusId,Z.cards,Fn]);let $n=(0,X.useMemo)(()=>({artifacts:_.artifacts,onOpenArtifact:_.onOpenArtifact}),[_.artifacts,_.onOpenArtifact]),er=(0,Y.jsxs)(`div`,{className:`map-playback`,"data-floating":e.kind===`live`,children:[(0,Y.jsx)(`button`,{"aria-label":Cn?`Pause reveal`:`Play reveal`,onClick:()=>{xn>=K.tasks.length&&Sn(1),wn(e=>!e)},children:Cn?(0,Y.jsx)(P,{size:14}):(0,Y.jsx)(I,{size:14})}),(0,Y.jsx)(`button`,{"aria-label":`Restart reveal`,onClick:()=>{wn(!1),Sn(1),e.kind!==`live`&&q.back()},children:(0,Y.jsx)(F,{size:13})}),(0,Y.jsx)(`span`,{children:t?`逐卡展开`:`Reveal cards`}),(0,Y.jsx)(`input`,{"aria-label":`Visible task count`,type:`range`,min:Math.min(1,K.tasks.length),max:K.tasks.length,value:xn,onChange:e=>{wn(!1),Sn(Number(e.target.value))}}),(0,Y.jsxs)(`span`,{className:`map-count`,children:[xn,` / `,K.tasks.length]}),(0,Y.jsx)(`button`,{"aria-label":`Reveal next card`,disabled:xn>=K.tasks.length,onClick:()=>Sn(e=>Math.min(K.tasks.length,e+1)),children:(0,Y.jsx)(se,{size:14})}),(0,Y.jsx)(`small`,{children:t?`时间顺序`:`Chronological order`}),e.kind===`live`&&(0,Y.jsx)(`button`,{className:`map-replay-exit`,"aria-label":t?`回到当前`:`Back to the present`,title:t?`回到当前`:`Back to the present`,onClick:()=>{wn(!1),Jt(!1),Sn(K.tasks.length)},children:(0,Y.jsx)(y,{size:14})})]});return(0,Y.jsx)(Hm.Provider,{value:q.zoomSteps,children:(0,Y.jsx)(km.Provider,{value:sn,children:(0,Y.jsxs)(Am.Provider,{value:$n,children:[at?.generation_error&&(0,Y.jsxs)(`div`,{role:`status`,className:`map-paused-label`,children:[t?`地图说明暂时不可用,任务和已有说明仍可阅读。`:`Map explanation unavailable; tasks and saved explanations remain readable.`,at.generation_error.code===`cost_unreconciled`&&(t?` 调用费用待对账,并非预算耗尽。`:` Provider usage awaits reconciliation, not budget exhaustion.`)]}),e.kind===`live`&&!qt&&Kn&&(0,Y.jsxs)(`dl`,{className:`map-brief`,"aria-label":t?`任务进展`:`Task progress`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`正在做`:`Now`}),(0,Y.jsx)(`dd`,{title:Kn.goal,children:qn.state===`running`||qn.state===`waiting`||qn.reason===`operator_input`?Jn:Kn.current})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`已有结果`:`Results`}),(0,Y.jsx)(`dd`,{children:Kn.conclusion})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`接下来`:`Next`}),(0,Y.jsx)(`dd`,{children:Kn.next})]})]}),(0,Y.jsxs)(`div`,{className:`map-status-row`,children:[e.tasks.length>0&&(0,Y.jsx)(`span`,{className:`map-progress`,"aria-hidden":`true`,children:[`done`,`ended`,`running`,`question`,`review_unavailable`,`held`,`failed`,`other`].map(e=>Un[e]>0?(0,Y.jsx)(`i`,{"data-bucket":e,style:{flexGrow:Un[e]}},e):null)}),(0,Y.jsxs)(`p`,{className:`map-status-line`,role:`status`,children:[n.pending||!g&&(r||s)?(0,Y.jsx)(`i`,{className:`map-live-dot`,"aria-hidden":!0}):null,(0,Y.jsx)(`span`,{className:`map-status-text`,children:ue({total:e.tasks.length,qa:e.tasks.filter(e=>e.turn_kind===`qa`).length,complete:Wn,ended:Un.ended,reviewUnavailable:Un.review_unavailable,held:Un.held,running:Un.running,pending:n.pending,paused:g,hasOpenWork:e.tasks.some(e=>[`running`,`pending`,`paused`,`held`,`question`].includes(De(e))),role:r,current:e.kind===`live`&&![`idle`,`step_finished`].includes(qn.state)?Jn:void 0,waiting:s?.sentence,zh:t})}),Xe.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`map-status-sep`,"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`button`,{type:`button`,className:`map-attention-link`,onClick:Qn,title:t?`跳到需要你处理的任务`:`Jump to the task waiting on you`,"aria-label":t?`逐个查看 ${Xe.length} 项需要你处理的任务`:`Cycle through ${Xe.length} tasks needing attention`,children:t?`${Xe.length} 项需要你处理`:`${Xe.length} ${Xe.length===1?`needs`:`need`} your attention`})]})]})]}),e.kind===`live`&&Ie&&!qt&&(0,Y.jsxs)(`div`,{className:`map-final-review`,role:`status`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:t?`最终结果已检查通过`:`Final delivery passed review`}),Pe?.data.task.id!==Ie.id&&Pe?.data.task.outcome?.review_status===`unavailable`&&(Ie.finished_ts??0)>(Pe.data.task.finished_ts??0)?(0,Y.jsx)(`span`,{children:t?` · 本项目后续已交付;此卡保留当次审查异常。`:` · This project was delivered later; this card retains its earlier review error.`}):null]}),(0,Y.jsx)(`button`,{type:`button`,onClick:Xn,children:t?`查看结果检查`:`View final review`}),_.deliveryCount>0&&(0,Y.jsx)(`button`,{type:`button`,onClick:_.onOpenDelivery,children:t?`查看项目成果`:`View project deliverables`})]}),e.kind===`live`&&!p&&(0,Y.jsx)(ze,{questions:c.pending_questions??[],backlog:c.backlog,currentTaskId:l??c.mission_view?.mission.id,onAnswer:_.onAnswer,onLocate:e=>{let t=Z.cards.filter(t=>t.task.id===e).at(-1);t&&Yn(t.id)}}),q.detailed&&Ze>=0&&(0,Y.jsxs)(`div`,{className:`map-attention-detail`,role:`status`,children:[(0,Y.jsxs)(`strong`,{children:[t?`待处理`:`Needs attention`,` `,Ze+1,` / `,Xe.length]}),(()=>{let n=G(Xe[Ze],e.events,t,Gn(Xe[Ze]));return(0,Y.jsxs)(`div`,{tabIndex:0,children:[(0,Y.jsx)(`p`,{children:n.reason}),(0,Y.jsx)(`p`,{children:n.next}),n.detail&&(n.showDetail?(0,Y.jsxs)(`blockquote`,{className:`map-attention-quote`,children:[(0,Y.jsx)(`strong`,{children:t?`暂停原因原文`:`Recorded reason`}),` `,n.detail]}):(0,Y.jsxs)(`details`,{children:[(0,Y.jsx)(`summary`,{children:t?`原始记录`:`Recorded words`}),(0,Y.jsx)(`p`,{children:n.detail})]}))]})})()]}),nt&&rt&&(0,Y.jsxs)(`nav`,{className:`map-dependencies`,"aria-label":t?`任务来路与去向`:`Task dependencies`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`来路`:`Depends on`}),rt.upstream.length?rt.upstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的前置依赖`:`No recorded prerequisites`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`当前`:`Selected`}),(0,Y.jsxs)(`button`,{className:`map-trace-task`,title:nt.title,onClick:()=>Yn(Z.cards.find(e=>e.task.id===nt.id).id),children:[nt.title,` · `,t?`查看任务`:`Open task`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`去向`:`Enables`}),rt.downstream.length?rt.downstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的后续依赖`:`No recorded dependents`})]})]}),(0,Y.jsx)(`div`,{className:`map-workspace`,children:(0,Y.jsxs)(`div`,{ref:he,className:`map-canvas-wrap`,"data-focused":!!q.focusId,"data-detailed":q.detailed,"data-fitted":ye,"data-hovering":!!Rt&&!q.detailed,children:[(0,Y.jsxs)(`div`,{className:`map-ambient`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),S&&(0,Y.jsx)(yt,{events:_.conversationEvents,connected:_.connected,pending:n.pending,artifacts:_.artifacts,zh:t,onClose:()=>w(!1),onOpenArtifact:_.onOpenArtifact,onOpenDelivery:_.onOpenReceipt}),b&&e.kind===`live`&&(0,Y.jsx)(`aside`,{className:`map-agent-drawer nowheel nodrag nopan`,children:(0,Y.jsx)(Ot,{sid:c.session.id,view:c.mission_view,roles:c.roles,events:d,taskId:Pe?.data.task.id||c.mission_view?.mission.id||void 0,paused:g&&!n.pending,onClose:()=>x(!1)})}),V&&!p&&(0,Y.jsx)(Nt,{flight:V,canvas:he,zh:t,historical:n.historical,onReveal:t=>{e.tasks.some(e=>e.id===t)&&q.fit()},onLand:e=>H(t=>t?.id===e?{...t,landed:!0}:t),onFinish:e=>H(t=>t?.id===e?null:t)}),(0,Y.jsxs)(`div`,{className:`map-canvas-toolbar nowheel`,children:[(0,Y.jsxs)(`label`,{className:`map-search`,children:[(0,Y.jsx)(C,{size:14}),(0,Y.jsx)(`input`,{"aria-label":t?`搜索地图任务`:`Search map tasks`,placeholder:t?`搜索任务…`:`Find a task…`,title:t?`Enter 逐个跳转匹配`:`Enter jumps through matches`,value:gn,onChange:e=>_n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&yn.length?Yn(yn[(bn+1)%yn.length].id):e.key===`Escape`&&gn&&(e.stopPropagation(),_n(``))}}),gn&&(0,Y.jsx)(`span`,{className:`map-search-count`,"aria-live":`polite`,children:yn.length?bn>=0?`${bn+1}/${yn.length}`:`${yn.length} ${t?`项`:`found`}`:t?`无匹配`:`0 found`})]}),(0,Y.jsxs)(`button`,{onClick:Zn,title:t?`定位当前或最近任务`:`Locate current or latest task`,"aria-label":t?`定位当前`:`Locate current`,children:[(0,Y.jsx)(_t,{size:15}),(0,Y.jsx)(`span`,{children:t?`定位当前`:`Locate current`})]}),(0,Y.jsx)(`button`,{className:`map-fit-button`,onClick:Pn,title:t?`适配全图`:`Fit map`,"aria-label":`Fit map`,children:(0,Y.jsx)(W,{size:15})}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":t?`来路 / 去向`:`Trace dependencies`,title:t?`突出显示任务的直接前后依赖;点击卡片切换,再次点击退出`:`Highlight direct dependencies; click a card to switch, click it again to exit`,"aria-pressed":!!nt,disabled:!K.tasks.length,onClick:()=>jn(nt?null:Pe?.data.task.id??ae(e.tasks)?.id??null),children:[(0,Y.jsx)(N,{size:15}),(0,Y.jsx)(`span`,{children:t?`来路 / 去向`:`Dependencies`})]}),e.kind===`live`&&K.tasks.length>1&&!q.detailed&&!qt&&(0,Y.jsxs)(`button`,{onClick:()=>{Jt(!0),Sn(1),wn(!0)},title:t?`回放这项研究是如何展开的`:`Replay how this research unfolded`,"aria-label":`Replay`,children:[(0,Y.jsx)(M,{size:15}),(0,Y.jsx)(`span`,{children:t?`回放`:`Replay`})]}),q.detailed&&(0,Y.jsxs)(`button`,{onClick:q.back,className:`map-back-button`,"aria-label":`Return to map`,children:[(0,Y.jsx)(j,{size:14}),(0,Y.jsx)(`span`,{children:t?`返回全图`:`Overview`})]}),q.detailed&&Pe&&Pe.data.partCount>1&&(0,Y.jsxs)(`nav`,{className:`map-part-switcher`,"aria-label":t?`切换任务部分`:`Switch task part`,children:[(0,Y.jsx)(`button`,{"aria-label":t?`上一部分`:`Previous part`,disabled:!Pe.data.previousId,onClick:()=>Pe.data.previousId&&Mn(Pe.data.previousId,!0),children:(0,Y.jsx)(ft,{size:15})}),(0,Y.jsxs)(`span`,{children:[Pe.data.part,` / `,Pe.data.partCount]}),(0,Y.jsx)(`button`,{"aria-label":t?`下一部分`:`Next part`,disabled:!Pe.data.nextId,onClick:()=>Pe.data.nextId&&Mn(Pe.data.nextId,!0),children:(0,Y.jsx)(se,{size:15})})]}),(0,Y.jsx)(`span`,{className:`map-toolbar-gap`,"aria-hidden":!0}),e.kind===`live`&&(0,Y.jsxs)(`div`,{className:`map-workspace-actions`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":S,"aria-label":t?`对话`:`Conversation`,title:t?`与 Argus 的对话`:`Your conversation with Argus`,onClick:()=>{w(e=>!e),x(!1)},children:[(0,Y.jsx)(qe,{size:15}),(0,Y.jsx)(`span`,{children:t?`对话`:`Conversation`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-agent-toggle`,"aria-expanded":b,"aria-label":t?`Agent 动态`:`Agent activity`,title:t?`各个 Agent 正在做什么`:`What each agent is doing`,onClick:()=>{x(e=>!e),w(!1)},children:[(0,Y.jsx)(A,{size:15}),(0,Y.jsx)(`i`,{"data-active":!!r||n.pending,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:t?`工作详情`:`Work details`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-delivery-toggle`,disabled:!_.deliveryCount,"aria-label":t?`交付成果`:`Deliveries`,title:t?`已交付的成果`:`What has been delivered`,onClick:_.onOpenDelivery,children:[(0,Y.jsx)(ge,{size:15}),(0,Y.jsx)(`span`,{children:t?`交付成果`:`Deliveries`}),_.deliveryCount>0&&(0,Y.jsx)(`b`,{children:_.deliveryCount})]})]})]}),kn&&(0,Y.jsx)(`div`,{className:`map-feedback`,role:`status`,children:kn}),K.tasks.length===0?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(N,{size:36}),(0,Y.jsx)(`h3`,{children:t?`把一个目标,变成可见的成果`:`Turn a goal into a visible result`}),(0,Y.jsx)(`p`,{children:p?t?`尚无任务记录。`:`No task records are available.`:t?`描述你想完成的事情,看 Argus 规划、执行、审查,最后在这里交付。`:`Describe your goal. Watch Argus plan, build, review, and deliver here.`}),!p&&(0,Y.jsx)(`div`,{className:`map-starters`,children:(t?[[`交互实验`,`做一个交互式实验室,用动画展示 Dijkstra 和 A* 怎样寻找最短路径。让我能画障碍、单步播放、比较探索范围,并验证两个算法的结果一致。`],[`数据洞察`,`用一组可复现的模拟数据,做一个辛普森悖论交互演示。让我能切换整体和分组视角,看结论怎样反转,附上验证过程。`],[`产品原型`,`做一个精致的个人旅行规划网页。我能调整预算和出行天数,比较三种行程方案,并将选中的方案导出。让手机上也方便操作。`]]:[[`Interactive lab`,`Build an interactive Dijkstra vs A* pathfinding lab with editable obstacles, step-by-step animation, and correctness checks.`],[`Data insights`,`Create an interactive Simpson’s paradox demo using reproducible synthetic data, with aggregate and grouped views and validation.`],[`Product prototype`,`Build a polished travel planner. Let me adjust budget and duration, compare three itineraries, and export my choice. Make it easy to use on a phone.`]]).map(([e,t])=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{n.onChange(t),requestAnimationFrame(()=>he.current?.querySelector(`textarea`)?.focus())},children:[e,` ↗`]},e))})]}):(0,Y.jsxs)(Bp,{nodes:Bn,edges:Vn,nodeTypes:qh,edgeTypes:Jh,onNodesChange:pe,onNodeMouseEnter:(e,t)=>zt(t.id),onNodeMouseLeave:()=>zt(null),onMove:q.onMove,defaultViewport:Qm,minZoom:.01,maxZoom:3.5,nodesDraggable:!1,nodesFocusable:!1,nodesConnectable:!1,edgesReconnectable:!1,zoomOnScroll:!1,zoomOnPinch:!0,zoomOnDoubleClick:!1,deleteKeyCode:null,selectionKeyCode:null,onlyRenderVisibleElements:ye&&_e,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Qp,{variant:Jp.Dots,gap:88,size:3,color:`var(--map-dot)`}),(0,Y.jsx)(sm,{orientation:`horizontal`,showInteractive:!1,onFitView:Pn,fitViewOptions:{padding:.16,maxZoom:.27,minZoom:.01,duration:q.reducedMotion?0:320}}),(0,Y.jsx)(Sm,{nodeColor:e=>e.type===`branch`?`#cfd2d5`:Yh[De(e.data.task)]??`#c6c8cb`,maskColor:`var(--map-minimap-mask)`,maskStrokeColor:`#6d737a`,maskStrokeWidth:1.5,onClick:(e,t)=>q.navigate(t),pannable:!0,zoomable:!0,ariaLabel:t?`地图导航预览`:`Map navigation preview`})]}),e.kind===`live`&&qt&&er,(0,Y.jsxs)(`div`,{className:`map-legend nowheel`,children:[(0,Y.jsxs)(`span`,{title:t?`内容相关的工作,不是执行依赖`:`Related in content, not an execution dependency`,children:[(0,Y.jsx)(`b`,{className:`dashed`}),t?`内容关联`:`Related work`]}),(0,Y.jsxs)(`span`,{title:t?`工作发生的先后`:`The order work happened in`,children:[(0,Y.jsx)(`b`,{className:`order`}),t?`先后`:`Order`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{}),t?`任务依赖`:`Dependency`]}),(0,Y.jsxs)(`button`,{className:Dn?``:`is-muted`,onClick:On,"aria-pressed":Dn,disabled:Hn===0,"aria-label":`Toggle plan replacements`,children:[(0,Y.jsx)(`b`,{className:`replacement`}),t?`计划替代`:`Plan changes`,Hn?` · ${Hn}`:``]})]}),!p&&(0,Y.jsx)(Ch,{...n,pendingLabel:f,progressVisible:!S,dispatchStatus:V?.result?.type===`task`?V.landed||n.historical?`task`:`launching`:V?.result?.outcome,onSend:Qt,onCancel:$t,overview:!q.detailed}),nn&&!p&&(0,Y.jsxs)(`div`,{className:`map-context-menu`,role:`menu`,style:{left:nn.x,top:nn.y},children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{tn(nn.ref),rn(null)},children:t?`引用`:`Reference`}),e.kind===`live`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{dn(``),ln({ref:nn.ref,x:nn.x,y:nn.y}),rn(null)},children:t?`添加批注`:`Add a note`}),(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{n.onRouteOverrideChange?.(`task`),tn(nn.ref),rn(null)},children:t?`从这里展开`:`Branch from here`})]})]}),cn&&!p&&(0,Y.jsxs)(`div`,{className:`map-note-editor nodrag nopan`,style:{left:Math.min(window.innerWidth-320,cn.x),top:Math.min(window.innerHeight-240,cn.y)},children:[(0,Y.jsx)(`small`,{children:t?`批注《${cn.ref.task_title}》`:`Note on “${cn.ref.task_title}”`}),(0,Y.jsx)(`textarea`,{autoFocus:!0,maxLength:2e3,value:un,onChange:e=>dn(e.target.value),placeholder:t?`写下你的观察,Argus 在下个规划周期会读到`:`Your observation; Argus reads it next planning cycle`}),fn&&(0,Y.jsx)(`small`,{className:`map-note-error`,children:t?`没有保存上,稍后再试;草稿还在`:`Not saved; try again — the draft is kept`}),(0,Y.jsxs)(`div`,{className:`map-note-actions`,children:[(0,Y.jsx)(`button`,{onClick:()=>ln(null),children:t?`取消`:`Cancel`}),(0,Y.jsx)(`button`,{className:`is-primary`,disabled:!un.trim(),onClick:()=>void mn(),children:t?`保存`:`Save`})]})]}),(K.cyclic||K.missing>0)&&(0,Y.jsx)(`div`,{className:`map-graph-warning`,children:K.cyclic?t?`检测到循环引用,保留原始连线。`:`Cyclic references retained.`:`${K.missing} ${t?`个依赖不在当前记录范围内`:`dependencies outside the available history`}`})]})}),e.kind!==`live`&&er,(0,Y.jsx)(E,{open:!!J,onClose:()=>Ve(null),label:J?.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,children:J&&(ct||J.turn_kind===`qa`)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{title:J.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,sub:J.turn_kind===`qa`?J.objective||J.title:at?.cards[J.id]?.title||J.title}),(0,Y.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`map-task-reading`,"data-task-id":J.id,children:[J.outcome?.review_status===`unavailable`&&(0,Y.jsxs)(`p`,{className:`mb-3 text-sm text-ink-dim`,role:`status`,children:[t?`当次审查异常,未形成审阅结论。`:`No review judgment was returned on this attempt.`,Ie&&(Ie.finished_ts??0)>(J.finished_ts??0)&&(0,Y.jsx)(`button`,{type:`button`,className:`ml-2 text-blue underline`,onClick:Xn,children:t?`查看本项目后续通过的最终审稿`:`View this project's later accepted final review`})]}),Je?.data.completionScope?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:Je.data.completionScope}):null,(0,Y.jsx)(Et,{cardKey:J.id,taskId:J.id,card:at?.cards[J.id],task:J,readOnly:p,originalDetail:J.turn_kind===`qa`?Ge?.text||(J.status===`running`?t?`正在回答…`:`Answering…`:J.status===`cancelled`?t?`本次回答已中断。`:`This answer was interrupted.`:J.summary||(t?`尚无回答。`:`No answer recorded.`)):J.objective||J.summary||(t?`这项任务尚无详细记录。`:`No detailed task record is available.`),selection:xt,artifacts:$n.artifacts,onOpenArtifact:$n.onOpenArtifact}),p?null:(0,Y.jsx)(D,{className:`mt-3 text-xs`,onClick:()=>tn({source:e.id,task_id:J.id,task_title:at?.cards[J.id]?.title||J.title,event_ids:Ge?[Ge.id]:at?.cards[J.id]?.event_ids||ct?.event_ids||[],lang:t?`zh`:`en`}),children:J.turn_kind===`qa`?t?`引用这条问答`:`Reference this Q&A`:t?`引用此任务`:`Reference this task`})]})]}):null})]})})})}var Qh=(0,X.memo)(function({snapshot:e,currentTaskId:t,events:n,managerSteps:r=[],draft:a,onDraftChange:s,onSend:c,attachments:l,onAttachmentsChange:f,pending:p,onCancel:m,focusSignal:h,readOnly:g=!1,onOpenSettings:_,routeOverride:v,onRouteOverrideChange:y,conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}){let{locale:O}=d(),k=O===`zh-CN`,[A,j]=(0,X.useState)([]),M=l??A,N=(0,X.useRef)(M);N.current=M;let P=(0,X.useCallback)(e=>{let t=typeof e==`function`?e(N.current):e;N.current=t,f?f(t):j(t)},[f]),F=(0,X.useRef)(a);F.current=a;let I=(0,X.useRef)(!0);(0,X.useEffect)(()=>(I.current=!0,()=>{I.current=!1}),[]);let R=(0,X.useCallback)(async(e,t=[],n,r)=>{let i=!1,a=await c(e,t,r=>{r.type===`settled`&&r.outcome===`error`&&(i=!0),I.current&&(r.type===`settled`&&r.outcome===`error`&&!F.current.trim()&&(s(e),P(e=>e.length?e:t)),n?.(r))},r);return a&&!i&&I.current&&(F.current===e&&s(``),P(e=>e.filter(e=>!t.includes(e)))),a},[c,s,P]),[V,H]=(0,X.useState)(()=>new URLSearchParams(window.location.search).get(`dataset`)||B(`argus.map.source.v1`)||`live`),U=i({queryKey:[`map-datasets`],queryFn:({signal:e})=>u.mapDatasets(e),staleTime:1/0}),W=i({queryKey:[`map-dataset`,V],queryFn:({signal:e})=>u.mapDataset(V,e),enabled:V!==`live`,staleTime:1/0,retry:!1}),te=o(),G=`argus.map.history.v1:`+e.session.id,[ne,re]=(0,X.useState)(()=>Bh(B(G))),[ie,ae]=(0,X.useState)(!1),oe=i({queryKey:[`map-info`,e.session.id],queryFn:({signal:t})=>u.mapInfo(e.session.id,t),enabled:V===`live`,staleTime:6e4}),K=ne??(oe.data&&!oe.data.requires_choice?{mode:`full`}:null);(0,X.useEffect)(()=>{if(!ne&&oe.data&&!oe.data.requires_choice){let e={mode:`full`};re(e),z(G,JSON.stringify(e))}},[oe.data,ne,G]);let se=V!==`live`||!!K&&K.mode!==`off`&&!ie,ce=[`map-live`,e.session.id,K?.mode,K?.since,K?.eventSince,K?.taskId],le=JSON.stringify([V,e.session.id,O,K]),ue=e=>{re(e),z(G,JSON.stringify(e)),ae(!1)},de=i({queryKey:ce,queryFn:async({signal:t})=>{let n=te.getQueryData(ce),r=K?.mode===`full`?await u.mapHistory(e.session.id,t,n?.history_cursor,n?.cursor):await u.liveMap(e.session.id,t,n?.cursor,K||void 0);return Vh(te.getQueryData(ce),r)},enabled:V===`live`&&se,staleTime:1/0,gcTime:72e5,refetchOnMount:`always`,refetchInterval:t=>Hh(se,t.state.data,e)}),fe=V===`live`&&Uh(e),pe=He(e,e.mission_view,n),me=pe.reason===`background_work`&&pe.taskId?ot(pe,k?`zh-CN`:`en`):``,he=(0,X.useMemo)(()=>V===`live`&&!fe&&me?{taskId:pe.taskId,sentence:me}:void 0,[V,fe,pe.taskId,me]),q=n.filter(e=>e.run_label!==`map-summary`&&/^(life\.(mission\.|phase\.|planner\.task_added)|manager\.turn\.|round\.|agent\.message|engineer\.progress|ui\.argus|team\.|idea\.portfolio\.)/.test(String(e.type))).at(-1),ge=JSON.stringify([q?.ts,q?.event_id||q?.id,q?.revision,q?.updated_ts,q?.status,e.backlog,fe]),_e=(0,X.useRef)(null),ve=(0,X.useRef)(0),ye=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=ye.current;if(!e)return;let t=()=>{ve.current=Date.now()+900},n=e=>{e.buttons&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`pointerdown`,t),e.addEventListener(`pointermove`,n),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`pointerdown`,t),e.removeEventListener(`pointermove`,n)}},[]),(0,X.useEffect)(()=>{if(V!==`live`||!se||_e.current)return;let t=()=>{let n=ve.current-Date.now();if(n>0){_e.current=setTimeout(t,n+120);return}_e.current=null,te.invalidateQueries({queryKey:[`map-live`,e.session.id]})};_e.current=setTimeout(t,650)},[ge,V,e.session.id,te,se]),(0,X.useEffect)(()=>()=>{_e.current&&clearTimeout(_e.current),_e.current=null},[V,e.session.id,se]);let be=V===`live`?de.data:W.data,[xe,Se]=(0,X.useState)(!1),Ce=(0,X.useMemo)(()=>({shown:xe,toggle:()=>Se(e=>!e)}),[xe]),Te=(0,X.useMemo)(()=>be?we(be.tasks).links.filter(e=>e.kind===`replacement`).length:0,[be]),Ee=(0,X.useMemo)(()=>({conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}),[b,x,S,C,w,T,E,D]),De=(0,X.useMemo)(()=>({footer:(0,Y.jsx)(Ne,{sid:e.session.id,roles:e.roles,running:e.daemon.alive||!!e.manager_requests?.length,lastCall:e.last_call,onOpenSettings:g?void 0:_}),routeOverride:v,onRouteOverrideChange:y,value:a,onChange:s,onSend:R,attachments:M,onAttachmentsChange:P,pending:p,onCancel:m,focusSignal:h,sessionName:e.session.display_name||e.session.id,historical:V!==`live`,zh:k}),[v,y,a,s,R,M,p,m,h,e.session.display_name,e.session.id,V,k,e.roles,e.daemon.alive,e.manager_requests,e.last_call,g,_]),Oe=e=>{H(e),z(`argus.map.source.v1`,e);let t=new URL(window.location.href);t.searchParams.set(`dataset`,e),window.history.replaceState(null,``,t)};return(0,Y.jsxs)(`section`,{ref:ye,className:`argus-map`,"aria-label":k?`进度地图`:`Progress map`,children:[(0,Y.jsxs)(`header`,{className:`map-header`,children:[(0,Y.jsxs)(`div`,{className:`map-heading`,children:[(0,Y.jsx)(`span`,{className:`map-kicker`,"aria-hidden":`true`,children:k?`ARGUS · 研究地图`:`ARGUS · RESEARCH MAP`}),(0,Y.jsx)(`h1`,{title:e.session.display_name,children:e.session.display_name})]}),(0,Y.jsxs)(`details`,{className:`map-more`,children:[(0,Y.jsx)(`summary`,{"aria-label":k?`地图选项`:`Map options`,title:k?`地图选项`:`Map options`,children:(0,Y.jsx)(L,{size:16})}),(0,Y.jsxs)(`div`,{className:`map-more-menu`,children:[be&&(0,Y.jsx)(Xh,{events:be.events,zh:k}),(0,Y.jsxs)(`div`,{className:`map-dataset-bar`,children:[(0,Y.jsx)(pt,{size:15}),(0,Y.jsxs)(`select`,{"aria-label":k?`地图数据来源`:`Map data source`,value:V,onChange:e=>Oe(e.target.value),children:[(0,Y.jsxs)(`option`,{value:`live`,children:[k?`当前会话`:`Current session`,` ·`,` `,e.session.display_name]}),!U.data?.datasets.some(e=>e.id===V)&&V!==`live`&&(0,Y.jsx)(`option`,{value:V,children:V}),U.data?.datasets.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.task_count]},e.id))]}),be?.captured_at&&(0,Y.jsxs)(`span`,{className:`map-capture`,children:[(0,Y.jsx)(ee,{size:12}),new Date(be.captured_at).toLocaleDateString()]})]}),V===`live`&&oe.data&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button`,onClick:()=>ae(!0),children:k?`加载范围`:`History range`}),!g&&_&&(0,Y.jsx)(`button`,{type:`button`,onClick:_,className:`map-scope-button`,children:k?`地图模型设置`:`Map model settings`}),Te>0&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button map-narrow-only`,"aria-pressed":xe,onClick:Ce.toggle,children:xe?k?`隐藏计划替代连线 · ${Te}`:`Hide plan changes · ${Te}`:k?`显示计划替代连线 · ${Te}`:`Show plan changes · ${Te}`})]})]})]}),V===`live`&&oe.data&&(0,Y.jsx)(zh,{open:ie||!K&&oe.data.requires_choice,info:oe.data,zh:k,readOnly:g,onChoose:ue}),V===`live`&&oe.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[k?`暂时无法检查历史记录。`:`Could not check session history.`,(0,Y.jsx)(`button`,{onClick:()=>void oe.refetch(),children:k?`重试`:`Retry`})]}),se&&be?.history_loading&&(0,Y.jsxs)(`div`,{className:`map-history-progress`,role:`status`,children:[k?`正在分批加载历史记录`:`Loading history in pages`,be.history_progress&&` · ${(be.history_progress.loaded_bytes/1024/1024).toFixed(1)} / ${(be.history_progress.total_bytes/1024/1024).toFixed(1)} MB`,(0,Y.jsx)(`button`,{onClick:()=>ae(!0),children:k?`更改范围`:`Change range`})]}),se&&be&&(V===`live`?de.isError:W.isError)&&(0,Y.jsxs)(`div`,{className:`map-data-error`,role:`status`,children:[k?`暂时无法更新,已保留加载的地图。`:`Updates are unavailable. Your loaded map is preserved.`,(0,Y.jsx)(`button`,{onClick:()=>void(V===`live`?de.refetch():W.refetch()),children:k?`重试`:`Retry`})]}),U.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[k?`历史记录列表暂时无法读取,可切换当前会话或重试。`:`Historical maps are unavailable. Open the current session or retry.`,(0,Y.jsx)(`button`,{onClick:()=>void U.refetch(),children:k?`重试`:`Retry`})]}),se?(V===`live`?de.isError:W.isError)&&!be?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:k?`地图暂时无法读取`:`Map unavailable`}),(0,Y.jsx)(`p`,{children:String(V===`live`?de.error:W.error)}),(0,Y.jsx)(`button`,{onClick:()=>void(V===`live`?de.refetch():W.refetch()),children:k?`重试`:`Retry`})]}):be?(0,Y.jsx)(Ip,{children:(0,Y.jsx)(Zh,{data:be,actions:Ee,snapshot:e,currentTaskId:t,events:n,pendingLabel:r.at(-1)?.detail||r.at(-1)?.label,viewKey:le,paused:fe,sessionId:e.session.id,zh:k,readOnly:g,replacements:Ce,activePhase:V===`live`&&!fe&&!he?e.roles.find(e=>e.active)?.role:void 0,waiting:he,composer:De})},le):(0,Y.jsxs)(`div`,{className:`map-empty is-loading`,"aria-busy":`true`,children:[(0,Y.jsxs)(`div`,{className:`map-ghosts`,"aria-hidden":!0,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),k?`正在载入地图…`:`Loading map…`]}):(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:k?`地图尚未开启`:`Map is not enabled`}),(0,Y.jsx)(`p`,{children:oe.isPending?k?`正在检查历史记录规模…`:`Checking history size…`:k?`选择加载范围后查看研究进度。`:`Choose a history range to view research progress.`}),oe.data&&(0,Y.jsx)(`button`,{onClick:()=>ae(!0),children:k?`选择加载范围`:`Choose history range`})]})]})});export{Zh as MapCanvas,Qh as MapPanel,Xh as MapTeamProgress}; \ No newline at end of file diff --git a/frontend/web/dist/assets/MapPanel-H65d2ArA.css b/frontend/web/dist/assets/MapPanel-H65d2ArA.css new file mode 100644 index 000000000..b74936539 --- /dev/null +++ b/frontend/web/dist/assets/MapPanel-H65d2ArA.css @@ -0,0 +1 @@ +.agent-activity{color:rgb(var(--ink));min-width:0;font-size:12px}.agent-activity-heading{justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;font-weight:650;display:flex}.agent-activity-heading>span{align-items:center;gap:8px;display:flex}.agent-activity-heading>button{color:rgb(var(--ink-dim));cursor:pointer;background:0 0;border:0;border-radius:9px;place-items:center;padding:8px;display:grid}.agent-activity-tabs{background:rgb(var(--ink)/.045);border-radius:12px;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;margin-bottom:14px;padding:4px;display:grid}.agent-activity-tabs button{min-height:36px;color:rgb(var(--ink-faint));cursor:pointer;background:0 0;border:0;border-radius:9px;justify-content:center;align-items:center;gap:6px;font-size:12px;transition:background .2s,color .2s;display:flex}.agent-activity-tabs button[aria-pressed=true]{background:rgb(var(--panel));color:rgb(var(--ink));box-shadow:0 2px 8px #16345112}.agent-activity-tabs i{background:rgb(var(--ink-faint)/.4);border-radius:50%;width:5px;height:5px}.agent-activity-tabs i[data-active=true]{background:var(--agent-role-color);box-shadow:0 0 0 3px color-mix(in srgb,var(--agent-role-color) 10%,transparent)}.agent-current{border:1px solid rgb(var(--line));background:rgb(var(--bg)/.4);border-radius:14px;padding:16px}.agent-current[data-active=true]{background:linear-gradient(135deg,#629cc40b,#6bb49b08);border-color:#79a8c457}.agent-current-kicker{color:rgb(var(--ink-faint));justify-content:space-between;align-items:center;gap:12px;font-size:11px;display:flex}.agent-current h3{margin:8px 0;font-size:16px;font-weight:650;line-height:1.45}.agent-live-indicator{letter-spacing:1px;color:var(--agent-role-color);align-items:center;gap:5px;font-size:9px;display:flex}.agent-live-indicator i{background:currentColor;border-radius:50%;width:5px;height:5px;animation:2s ease-in-out infinite agent-live-breathe}.agent-live-indicator[data-stale] i{opacity:.45;animation:none}.agent-live-stale{letter-spacing:0;color:var(--ink-faint,#8a8f98);margin-left:4px;font-size:10px}.agent-current-summary{color:rgb(var(--ink-dim));overflow-wrap:anywhere;max-height:220px;font-size:13px;line-height:1.7;overflow:auto}.agent-current-summary p{margin:4px 0}.agent-current-meta{color:rgb(var(--ink-faint));flex-wrap:wrap;align-items:center;gap:6px;margin-top:12px;font-size:10px;display:flex}.agent-current-meta span:last-child{margin-left:auto}.agent-records-heading{color:rgb(var(--ink-faint));justify-content:space-between;margin:18px 0 10px;font-size:11px;display:flex}.agent-records{overscroll-behavior:contain;max-height:360px;overflow:auto}.agent-record{grid-template-columns:24px minmax(0,1fr);gap:8px;padding:10px 0;display:grid;position:relative}.agent-record:not(:last-child):before{content:"";background:rgb(var(--line));width:1px;position:absolute;top:31px;bottom:-9px;left:11px}.agent-record-icon{color:#68879e;background:#7099b40e;border:1px solid #7099b426;border-radius:8px;place-items:center;width:24px;height:24px;display:grid}.agent-record[data-active=true] .agent-record-icon{color:#367ea4;background:#7099b418}.agent-record[data-failed=true] .agent-record-icon{color:#b3744e}.agent-record-title{justify-content:space-between;align-items:flex-start;gap:10px;font-size:12px;line-height:1.6;display:flex}.agent-record-title strong{font-weight:550}.agent-record time{color:rgb(var(--ink-faint));font-variant-numeric:tabular-nums;flex-shrink:0;font-size:10px}.agent-record small{color:rgb(var(--ink-faint));font-size:10px}.agent-record summary{color:#5b87a3;cursor:pointer;align-items:center;gap:4px;padding:6px 0;font-size:11px;list-style:none;display:flex}.agent-record summary::-webkit-details-marker{display:none}.agent-record details[open] summary svg{transform:rotate(180deg)}.agent-record-detail{color:rgb(var(--ink-dim));overflow-wrap:anywhere;font-size:12px;line-height:1.7}.agent-record-detail p{margin:4px 0}.agent-records-empty{color:rgb(var(--ink-faint));padding:20px 0;line-height:1.7}@keyframes agent-live-breathe{50%{opacity:.5;box-shadow:0 0 0 4px color-mix(in srgb,var(--agent-role-color) 8%,transparent)}}@media (width<=640px){.agent-activity-tabs button{min-height:44px}.agent-current-summary{max-height:160px}.agent-records{max-height:32dvh}}@media (prefers-reduced-motion:reduce){.agent-live-indicator i{animation:none}.agent-activity-tabs button{transition:none}}.agent-technical-details{color:rgb(var(--ink-dim));margin-top:8px;font-size:11px;line-height:1.6}.agent-technical-details summary{cursor:pointer}.agent-technical-details p{margin:6px 0 0}.agent-records-footer{flex-wrap:wrap;gap:8px;margin-top:12px;display:flex}.agent-records-footer button{border:1px solid rgb(var(--line));background:rgb(var(--panel));color:rgb(var(--ink-dim));cursor:pointer;border-radius:8px;padding:8px 10px;font-size:11px}.agent-records-footer button:disabled{opacity:.6;cursor:wait}.agent-record-actions{justify-content:flex-end;margin-bottom:4px;display:flex}.agent-record-detail pre{white-space:pre-wrap;overflow-wrap:anywhere}.map-dispatch-flight{z-index:45;pointer-events:none;border:1px solid rgb(var(--line) / .8);background:rgb(var(--panel));width:260px;height:56px;color:rgb(var(--ink));opacity:0;will-change:transform, opacity;border-radius:999px;align-items:center;display:flex;position:fixed;top:0;left:0;overflow:hidden;box-shadow:0 9px 28px #233b5510,0 2px 5px #233b5509}.map-dispatch-symbol{width:32px;height:32px;color:rgb(var(--ink));transform:translate(-50%, -50%) scale(var(--dispatch-mark,1));place-items:center;display:grid;position:absolute;top:50%;left:50%}.map-dispatch-copy{opacity:var(--dispatch-copy,1);position:absolute;top:50%;left:54px;right:20px;transform:translateY(-50%)}.map-dispatch-copy strong{white-space:nowrap;text-overflow:ellipsis;font-size:12px;font-weight:550;display:block;overflow:hidden}.map-dispatch-copy span{color:rgb(var(--ink-faint));margin-top:3px;font-size:11px;display:block}.map-dispatch-flight[data-phase=compress] .map-dispatch-symbol{left:26px}.map-dispatch-halo{z-index:44;pointer-events:none;opacity:0;background:radial-gradient(circle,#98ddd125,#0000 70%);border:1px solid #81c9be;border-radius:50%;width:56px;height:56px;position:fixed}.map-macro[data-dispatch=receiving]{pointer-events:none;opacity:0!important;animation:none!important}.map-macro[data-dispatch=landed]{transform-origin:50%;animation:.65s cubic-bezier(.16,1,.3,1) both map-dispatch-receive!important}@keyframes map-dispatch-receive{0%{opacity:0;filter:blur(3px);transform:scale(.82)}62%{opacity:1;filter:blur();transform:scale(1.018)}to{opacity:1;filter:blur();transform:scale(1)}}.map-macro[data-growing=true]{transform-origin:bottom;animation:.65s cubic-bezier(.18,.8,.25,1) both map-task-grow}.map-macro .submap-step[data-growing=true]{animation:.58s cubic-bezier(.2,.8,.24,1) both map-step-grow!important}.map-growth-mask{stroke-dasharray:1;stroke-dashoffset:0;animation:.7s cubic-bezier(.25,.6,.3,1) backwards map-link-grow}.map-agent-toggle{background:rgb(var(--panel));color:#557f9c;cursor:pointer;border:1px solid #7b9eb529;border-radius:20px;align-items:center;gap:6px;min-height:32px;padding:5px 10px;font-size:11px;display:inline-flex}.map-summary .map-agent-toggle i{background:#94a4b0;border-radius:50%;flex:0 0 5px;width:5px;height:5px;margin:0;display:block}.map-summary .map-agent-toggle i[data-active=true]{background:#5da890}.map-agent-drawer{z-index:9;overscroll-behavior:contain;background:rgb(var(--panel));border:1px solid rgb(var(--line));border-radius:18px;width:min(360px,100% - 36px);max-height:calc(100% - 130px);padding:18px;animation:.25s ease-out map-agent-enter;position:absolute;top:62px;right:18px;overflow:auto;box-shadow:0 16px 60px #1834541c}@keyframes map-task-grow{0%{opacity:0;transform:translateY(24px)scale(.95)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes map-step-grow{0%{opacity:0;filter:blur(2px);transform:translateY(14px)scale(.94)}to{opacity:1;filter:blur();transform:translateY(0)scale(1)}}@keyframes map-link-grow{0%{stroke-dashoffset:1px}to{stroke-dashoffset:0}}@keyframes map-agent-enter{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@media (width<=640px){.map-agent-drawer{width:calc(100% - 20px);max-height:calc(100% - 120px);padding:16px;top:56px;right:10px}.map-agent-toggle{min-height:34px}.map-summary-note{display:none}}@media (prefers-reduced-motion:reduce){.map-dispatch-flight,.map-macro[data-dispatch],.map-macro[data-growing=true],.map-macro .submap-step[data-growing=true],.map-growth-mask,.map-agent-drawer{filter:none;stroke-dashoffset:0;animation:none!important}.map-dispatch-flight,.map-dispatch-halo{display:none}.map-macro[data-dispatch=receiving]{opacity:1!important}}.map-ambient{pointer-events:none;z-index:0;transform:translate(calc(var(--lean-x,0) * -22px), calc(var(--lean-y,0) * -22px));will-change:transform;transition:transform .9s cubic-bezier(.2,.7,.2,1);position:absolute;inset:-6%;overflow:hidden}.map-ambient i{will-change:transform;border-radius:50%;display:block;position:absolute}.map-ambient i:first-child{background:radial-gradient(circle, rgb(var(--blue) / .11), transparent 66%);width:58%;height:74%;animation:46s ease-in-out infinite alternate atlas-drift-a;top:-24%;left:-12%}.map-ambient i:nth-child(2){background:radial-gradient(circle,#65b9a11c,#0000 66%);width:62%;height:78%;animation:58s ease-in-out infinite alternate atlas-drift-b;bottom:-28%;right:-16%}.map-ambient i:nth-child(3){background:radial-gradient(circle,#c9a56b14,#0000 66%);width:42%;height:54%;animation:71s ease-in-out infinite alternate atlas-drift-c;top:28%;left:34%}[data-theme=dark] .map-ambient i:first-child{background:radial-gradient(circle, rgb(var(--blue) / .16), transparent 66%)}[data-theme=dark] .map-ambient i:nth-child(2){background:radial-gradient(circle,#65b9a126,#0000 66%)}[data-theme=dark] .map-ambient i:nth-child(3){background:radial-gradient(circle,#c9a56b1a,#0000 66%)}.map-canvas-wrap>.react-flow{z-index:1;position:relative}@keyframes atlas-drift-a{0%{transform:translate(0)scale(1)}to{transform:translate(14%,12%)scale(1.14)}}@keyframes atlas-drift-b{0%{transform:translate(0)scale(1.08)}to{transform:translate(-12%,-14%)scale(.96)}}@keyframes atlas-drift-c{0%{transform:translate(-6%,4%)scale(.94)}to{transform:translate(8%,-8%)scale(1.1)}}.argus-map .react-flow__edge{transition:opacity .3s}.map-canvas-wrap[data-hovering=true]:not([data-detailed=true]) .map-macro[data-lit=false]{opacity:.48}.map-canvas-wrap[data-hovering=true]:not([data-detailed=true]) .react-flow__edge:not(.is-lit){opacity:.26}.map-canvas-wrap[data-hovering=true]:not([data-detailed=true]) .react-flow__edge.is-lit .react-flow__edge-path{filter:drop-shadow(0 0 3px rgb(var(--blue) / .5))}.map-canvas-wrap[data-hovering=true]:not([data-detailed=true]) .map-macro[data-lit=true][data-hovered=false] .map-card{box-shadow:0 8px 26px #24364c14,0 0 0 1px #7ca9c86b}.map-canvas-wrap[data-hovering=true]:not([data-detailed=true]) .map-macro[data-lit=true][data-hovered=true] .map-card{box-shadow:0 16px 40px #24364c1c,0 2px 6px #24364c0a}.argus-map .map-relation-label{transition:opacity .3s,box-shadow .3s}.map-canvas-wrap[data-hovering=true]:not([data-detailed=true]) .map-relation-label[data-lit=false]{opacity:.3}.map-canvas-wrap[data-hovering=true]:not([data-detailed=true]) .map-relation-label[data-lit=true]{box-shadow:0 0 0 1px color-mix(in srgb, var(--edge-hue) 35%, transparent)}.map-edge-spark[data-lit=true]{background:#7fb0cd;animation-duration:2s;box-shadow:0 0 6px 1px #7fb0cd66}.map-macro[data-arrive=true]:not([data-growing=true]){transform-origin:50% 70%;animation:.76s cubic-bezier(.16,1,.3,1) backwards atlas-arrive}@keyframes atlas-arrive{0%{opacity:0;transform:translateY(28px)scale(.965)}60%{opacity:1}to{opacity:1;transform:none}}.map-macro[data-detailed=true] .submap-step:not([data-growing=true]){animation:.52s cubic-bezier(.16,1,.3,1) backwards atlas-step-settle;animation-delay:calc(var(--step-index,0) * 45ms)}@keyframes atlas-step-settle{0%{opacity:0;transform:translateY(14px)scale(.985)}to{opacity:1;transform:none}}.map-card-live{color:color-mix(in srgb, #4a86c5 78%, rgb(var(--ink)));background:#4a86c514;border-radius:7px;align-items:center;gap:7px;margin:0 16px 10px;padding:6px 10px;font-size:11px;line-height:1.4;display:flex}.map-card-live i{background:#4a86c5;border-radius:50%;flex:0 0 7px;width:7px;height:7px;position:relative}.map-card-live i:after{content:"";opacity:0;border:1.5px solid #4a86c5;border-radius:50%;animation:2.2s cubic-bezier(.2,.7,.3,1) infinite atlas-live-ring;position:absolute;inset:-4px}.map-card-live span{text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums;min-width:0;overflow:hidden}.map-card-live[data-waiting=true] i:after{animation:none}.map-card-live[data-waiting=true] span{white-space:normal;-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}@keyframes atlas-live-ring{0%{opacity:.9;transform:scale(.55)}70%{opacity:0;transform:scale(1.35)}to{opacity:0;transform:scale(1.35)}}.macro-reader header>span .macro-reader-note{letter-spacing:0;text-transform:none;color:rgb(var(--ink-faint));margin-top:3px;font-size:11px;font-weight:450;display:block}.map-playback .map-replay-exit{margin-left:4px}.map-playback[data-floating=true]{z-index:7;border:1px solid rgb(var(--line) / .7);background:var(--map-paper);border-radius:10px;width:min(560px,100% - 40px);height:38px;padding:0 12px;animation:.25s ease-out map-agent-enter;position:absolute;top:61px;left:20px;box-shadow:0 6px 22px #24364c14}.map-playback[data-floating=true] small{display:none}@media (width<=640px){.map-playback[data-floating=true]{width:calc(100% - 24px);top:54px;left:12px}}@media (prefers-reduced-motion:reduce){.map-ambient{transition:none;transform:none}.map-ambient i,.map-macro[data-arrive=true],.map-macro[data-detailed=true] .submap-step,.map-card-live i:after{animation:none!important}.argus-map .react-flow__edge,.argus-map .map-relation-label{transition:none}}.macro-note-badge{min-width:18px;height:18px;color:color-mix(in srgb, #bd923f 62%, rgb(var(--ink)));vertical-align:middle;background:#bd923f2e;border-radius:9px;justify-content:center;align-items:center;margin-left:8px;padding:0 5px;font-size:11px;font-weight:600;display:inline-flex}.macro-notes{background:color-mix(in srgb, #c99b3f 8%, var(--map-paper));z-index:3;border:1px solid #bd923f4d;border-left:3px solid #bd923fbf;border-radius:8px;max-width:280px;max-height:300px;padding:10px 12px;font-size:12px;line-height:1.6;position:absolute;top:64px;right:18px;overflow-y:auto}.macro-notes small{letter-spacing:.12em;text-transform:uppercase;color:color-mix(in srgb, #bd923f 60%, rgb(var(--ink)));margin-bottom:5px;font-size:11px;font-weight:650;display:block}.macro-notes p{color:rgb(var(--ink) / .88);white-space:pre-wrap;word-break:break-word;margin:0 0 6px}.macro-notes p+p{border-top:1px dashed #bd923f47;padding-top:6px}.macro-notes p:last-child{margin-bottom:0}.map-note-editor{z-index:60;border:1px solid rgb(var(--line) / .6);background:var(--map-paper);border-radius:10px;flex-direction:column;gap:8px;width:300px;padding:12px;display:flex;position:fixed;box-shadow:0 12px 32px #0000002e}.map-note-editor small{color:rgb(var(--ink) / .65);text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}.map-note-editor textarea{resize:vertical;border:1px solid rgb(var(--line) / .5);min-height:84px;color:rgb(var(--ink));font:inherit;background:0 0;border-radius:6px;padding:8px;font-size:13px}.map-note-error{color:#c8503c;font-size:11px}.map-note-actions{justify-content:flex-end;gap:8px;display:flex}.map-note-actions button{border:1px solid rgb(var(--line) / .5);color:rgb(var(--ink));cursor:pointer;background:0 0;border-radius:6px;padding:5px 12px;font-size:12px}.map-note-actions button.is-primary{background:rgb(var(--ink));color:var(--map-paper);border-color:rgb(var(--ink))}.map-note-actions button:disabled{opacity:.45;cursor:default}.map-composer-dock.map-island-dock{--island-clear-left:392px;--island-clear-right:176px;--composer-width:clamp(320px, calc(100% - var(--island-clear-left) - var(--island-clear-right)), 560px);--island-ease:cubic-bezier(.32, .72, 0, 1);left:min(max(50%, calc(var(--island-clear-left) + var(--composer-width) / 2)), calc(100% - var(--composer-width) / 2 - 13px));width:var(--composer-width);max-width:calc(100% - 26px);transition:width .28s var(--island-ease);contain:layout;will-change:width}.map-composer-dock.map-island-dock[data-compact=true]{width:278px;left:50%}.map-composer-dock.map-island-dock[data-compact=true][data-pending=true]{width:340px}.map-island-dock .map-island-surface{height:calc(var(--map-editor-height) + 80px);isolation:isolate;border:1px solid rgb(var(--line) / .8);background:var(--map-paper);max-height:40vh;transition:height .28s var(--island-ease), border-radius .28s var(--island-ease), background-color .22s ease, border-color .22s ease, box-shadow .26s ease;will-change:height;border-radius:25px;padding:0;display:block;position:relative;overflow:hidden;transform:translateZ(0);box-shadow:0 9px 28px #233b5510,0 2px 5px #233b5509}.map-island-dock .map-island-surface:focus-within{border-color:#a0b8cb;box-shadow:0 10px 32px #233b5516}.map-island-dock[data-compact=true] .map-island-surface{border-radius:32px;height:60px}.map-island-dock .map-composer-brand{z-index:3;width:34px;height:34px;transition:background-color .16s,opacity .16s;position:absolute;bottom:13px;left:15px}.map-island-dock[data-compact=true] .map-composer-brand{pointer-events:none}.map-island-dock .map-composer-brand path,.map-island-dock .map-composer-brand circle{transition:fill .22s}.map-island-launch{z-index:2;text-align:left;color:rgb(var(--ink));opacity:0;pointer-events:none;transition:opacity 90ms ease, transform .28s var(--island-ease);align-items:center;gap:18px;padding:0 19px 0 61px;display:flex;position:absolute;inset:0;transform:translateY(-7px)scale(.985)}.map-island-dock[data-compact=true] .map-island-launch{opacity:1;pointer-events:auto;transition:opacity .16s ease 70ms, transform .28s var(--island-ease);transform:translateY(0)scale(1)}.map-island-launch:focus-visible{outline-offset:-5px;border-radius:inherit;outline:2px solid #a3bccf}.map-island-copy{flex:1;min-width:0}.map-island-copy strong,.map-island-copy small{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.map-island-copy strong{letter-spacing:.01em;font-size:13px;font-weight:580;line-height:20px}.map-island-copy small{color:rgb(var(--ink-faint));font-size:11px;line-height:16px}.map-island-indicator{color:rgb(var(--ink-dim));flex:0 0 18px;place-items:center;display:grid}.map-island-dock[data-state=sent] .map-island-indicator,.map-island-dock[data-state=task] .map-island-indicator,.map-island-dock[data-state=message] .map-island-indicator{color:rgb(var(--ok))}.map-island-dock[data-pending=true] .map-island-launch{gap:12px;padding-right:10px;right:45px}.map-island-wave{height:18px;color:rgb(var(--blue));align-items:center;gap:3px;display:flex}.map-island-wave i{background:currentColor;border-radius:2px;width:2px;height:13px;animation:1.1s ease-in-out infinite map-island-listening}.map-island-wave i:nth-child(2){animation-delay:-260ms}.map-island-wave i:nth-child(3){animation-delay:-520ms}.map-island-stop{z-index:4;border:1px solid rgb(var(--line) / .8);width:30px;height:30px;color:rgb(var(--ink-dim));background:rgb(var(--line) / .25);border-radius:50%;place-items:center;display:grid;position:absolute;top:14px;right:12px}.map-island-stop:hover{background:rgb(var(--line) / .6)}.map-island-stop:focus-visible{outline-offset:2px;outline:2px solid #a3bccf}.map-island-dock .map-composer-editor{opacity:1;transition:opacity .18s ease 90ms, transform .28s var(--island-ease) 40ms;flex-direction:column;gap:10px;padding:16px 15px 13px;display:flex;transform:translateY(0)}.map-island-dock[data-compact=true] .map-composer-editor{opacity:0;pointer-events:none;transition:opacity 80ms ease, transform .28s var(--island-ease);transform:translateY(9px)}.map-island-dock .map-composer textarea{overscroll-behavior:contain;flex:none;width:100%;min-height:44px;max-height:min(156px,40vh - 104px);padding:0 3px;font-size:15px;line-height:26px;display:block}.map-island-dock .map-reference-chips{max-height:96px;overflow-y:auto}.map-island-toolbar{align-items:center;gap:9px;height:38px;padding-left:44px;display:flex}.map-island-collapse{height:28px;color:rgb(var(--ink-faint));border-radius:7px;flex:0 0 26px;place-items:center;display:grid}.map-island-collapse:hover{background:rgb(var(--line) / .6)}.map-island-collapse:focus-visible{outline:2px solid #a3bccf}.map-island-dock .map-send{background:#2d536f;width:36px;height:36px;transition:background-color .15s,transform .16s,opacity .1s}.map-island-dock .map-send:disabled{background:rgb(var(--line) / .7)}.map-island-dock .map-send:not(:disabled):hover{background:#24445b;transform:translateY(-1px)}.map-island-dock .map-send:not(:disabled):active{transform:scale(.92)}.map-island-dock[data-compact=true] .map-send,.map-island-dock[data-compact=true]:hover .map-send{opacity:0;pointer-events:none;width:36px}.map-island-dock .map-composer-caption{max-width:100%;transition:opacity .16s}.map-island-dock[data-compact=true] .map-composer-caption{opacity:0}.map-island-dock[data-state=error] .map-composer-caption{color:rgb(var(--err))}@keyframes map-island-listening{0%,to{opacity:.65;transform:scaleY(.38)}50%{opacity:1;transform:scaleY(1)}}@media (hover:hover) and (pointer:fine){.map-island-dock[data-compact=true] .map-island-surface:hover{border-color:#a0b8cb;box-shadow:0 10px 32px #233b5516}}@media (width<=640px){.map-composer-dock.map-island-dock{--composer-width:calc(100% - 26px);left:50%;bottom:max(8px, env(safe-area-inset-bottom,0px))}.map-island-dock .map-composer textarea{max-height:156px;font-size:16px}.map-island-dock .map-island-surface{border-radius:23px;max-height:none}.map-island-dock .map-reference-chips{max-height:65px}.map-island-toolbar{gap:6px}}@media (prefers-reduced-motion:reduce){.map-composer-dock.map-island-dock,.map-island-dock *,.map-island-dock :before,.map-island-dock :after{transition:none!important;animation:none!important}}.react-flow{--xy-edge-stroke-default:#b1b1b7;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#555;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#ffffff80;--xy-minimap-background-color-default:#fff;--xy-minimap-mask-background-color-default:#f0f0f099;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#e2e2e2;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:transparent;--xy-background-pattern-dots-color-default:#91919a;--xy-background-pattern-lines-color-default:#eee;--xy-background-pattern-cross-color-default:#e2e2e2;background-color:var(--xy-background-color,var(--xy-background-color-default));--xy-node-color-default:inherit;--xy-node-border-default:1px solid #1a192b;--xy-node-background-color-default:#fff;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #00000014;--xy-node-boxshadow-selected-default:0 0 0 .5px #1a192b;--xy-node-border-radius-default:3px;--xy-handle-background-color-default:#1a192b;--xy-handle-border-color-default:#fff;--xy-selection-background-color-default:#0059dc14;--xy-selection-border-default:1px dotted #0059dccc;--xy-controls-button-background-color-default:#fefefe;--xy-controls-button-background-color-hover-default:#f4f4f4;--xy-controls-button-color-default:inherit;--xy-controls-button-color-hover-default:inherit;--xy-controls-button-border-color-default:#eee;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#fff;--xy-edge-label-color-default:inherit;--xy-resize-background-color-default:#3367d9;direction:ltr}.react-flow.dark{--xy-edge-stroke-default:#3e3e3e;--xy-edge-stroke-width-default:1;--xy-edge-stroke-selected-default:#727272;--xy-connectionline-stroke-default:#b1b1b7;--xy-connectionline-stroke-width-default:1;--xy-attribution-background-color-default:#96969640;--xy-minimap-background-color-default:#141414;--xy-minimap-mask-background-color-default:#3c3c3c99;--xy-minimap-mask-stroke-color-default:transparent;--xy-minimap-mask-stroke-width-default:1;--xy-minimap-node-background-color-default:#2b2b2b;--xy-minimap-node-stroke-color-default:transparent;--xy-minimap-node-stroke-width-default:2;--xy-background-color-default:#141414;--xy-background-pattern-dots-color-default:#777;--xy-background-pattern-lines-color-default:#777;--xy-background-pattern-cross-color-default:#777;--xy-node-color-default:#f8f8f8;--xy-node-border-default:1px solid #3c3c3c;--xy-node-background-color-default:#1e1e1e;--xy-node-group-background-color-default:#f0f0f040;--xy-node-boxshadow-hover-default:0 1px 4px 1px #ffffff14;--xy-node-boxshadow-selected-default:0 0 0 .5px #999;--xy-handle-background-color-default:#bebebe;--xy-handle-border-color-default:#1e1e1e;--xy-selection-background-color-default:#c8c8dc14;--xy-selection-border-default:1px dotted #c8c8dccc;--xy-controls-button-background-color-default:#2b2b2b;--xy-controls-button-background-color-hover-default:#3e3e3e;--xy-controls-button-color-default:#f8f8f8;--xy-controls-button-color-hover-default:#fff;--xy-controls-button-border-color-default:#5b5b5b;--xy-controls-box-shadow-default:0 0 2px 1px #00000014;--xy-edge-label-background-color-default:#141414;--xy-edge-label-color-default:#f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props,var(--xy-background-color,var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width,var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke,var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width,var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{pointer-events:none;position:absolute;overflow:visible}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected,var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke,var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:.5s linear infinite dashdraw}svg.react-flow__connectionline{z-index:1001;position:absolute;overflow:visible}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{-webkit-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default;position:absolute}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:0 0;pointer-events:none}.react-flow__nodesselection-rect{pointer-events:all;cursor:grab;position:absolute}.react-flow__handle{pointer-events:none;background-color:var(--xy-handle-background-color,var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color,var(--xy-handle-border-color-default));border-radius:100%;width:6px;min-width:5px;height:6px;min-height:5px;position:absolute}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;bottom:0;left:50%;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{z-index:5;margin:15px;position:absolute}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px)translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px)translateY(-50%)}.react-flow__attribution{background:var(--xy-attribution-background-color,var(--xy-attribution-background-color-default));margin:0;padding:2px 3px;font-size:10px}.react-flow__attribution a{color:#999;text-decoration:none}@keyframes dashdraw{0%{stroke-dashoffset:10px}}.react-flow__edgelabel-renderer{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__viewport-portal{-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute;top:0;left:0}.react-flow__minimap{background:var(--xy-minimap-background-color-props,var(--xy-minimap-background-color,var(--xy-minimap-background-color-default)))}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var(--xy-minimap-mask-background-color-props,var(--xy-minimap-mask-background-color,var(--xy-minimap-mask-background-color-default)));stroke:var(--xy-minimap-mask-stroke-color-props,var(--xy-minimap-mask-stroke-color,var(--xy-minimap-mask-stroke-color-default)));stroke-width:var(--xy-minimap-mask-stroke-width-props,var(--xy-minimap-mask-stroke-width,var(--xy-minimap-mask-stroke-width-default)))}.react-flow__minimap-node{fill:var(--xy-minimap-node-background-color-props,var(--xy-minimap-node-background-color,var(--xy-minimap-node-background-color-default)));stroke:var(--xy-minimap-node-stroke-color-props,var(--xy-minimap-node-stroke-color,var(--xy-minimap-node-stroke-color-default)));stroke-width:var(--xy-minimap-node-stroke-width-props,var(--xy-minimap-node-stroke-width,var(--xy-minimap-node-stroke-width-default)))}.react-flow__background-pattern.dots{fill:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-dots-color-default)))}.react-flow__background-pattern.lines{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-lines-color-default)))}.react-flow__background-pattern.cross{stroke:var(--xy-background-pattern-color-props,var(--xy-background-pattern-color,var(--xy-background-pattern-cross-color-default)))}.react-flow__controls{box-shadow:var(--xy-controls-box-shadow,var(--xy-controls-box-shadow-default));flex-direction:column;display:flex}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{background:var(--xy-controls-button-background-color,var(--xy-controls-button-background-color-default));border:none;border-bottom:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)));width:26px;height:26px;color:var(--xy-controls-button-color-props,var(--xy-controls-button-color,var(--xy-controls-button-color-default)));cursor:pointer;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;padding:4px;display:flex}.react-flow__controls-button svg{fill:currentColor;width:100%;max-width:12px;max-height:12px}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{border-radius:var(--xy-node-border-radius,var(--xy-node-border-radius-default));width:150px;color:var(--xy-node-color,var(--xy-node-color-default));text-align:center;border:var(--xy-node-border,var(--xy-node-border-default));background-color:var(--xy-node-background-color,var(--xy-node-background-color-default));padding:10px;font-size:12px}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover,var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected,var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color,var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color,var(--xy-selection-background-color-default));border:var(--xy-selection-border,var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var(--xy-controls-button-background-color-hover-props,var(--xy-controls-button-background-color-hover,var(--xy-controls-button-background-color-hover-default)));color:var(--xy-controls-button-color-hover-props,var(--xy-controls-button-color-hover,var(--xy-controls-button-color-hover-default)))}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var(--xy-controls-button-border-color-props,var(--xy-controls-button-border-color,var(--xy-controls-button-border-color-default)))}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{background-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border:1px solid #fff;border-radius:1px;width:5px;height:5px;translate:-50% -50%}.react-flow__resize-control.handle.left{top:50%;left:0}.react-flow__resize-control.handle.right{top:50%;left:100%}.react-flow__resize-control.handle.top{top:0;left:50%}.react-flow__resize-control.handle.bottom{top:100%;left:50%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color,var(--xy-resize-background-color-default));border-style:solid;border-width:0}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;height:100%;top:0;transform:translate(-50%)}.react-flow__resize-control.line.left{border-left-width:1px;left:0}.react-flow__resize-control.line.right{border-right-width:1px;left:100%}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{width:100%;height:1px;left:0;transform:translateY(-50%)}.react-flow__resize-control.line.top{border-top-width:1px;top:0}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color,var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color,var(--xy-edge-label-color-default))}.argus-map{--map-paper:rgb(var(--panel));--map-card-surface:rgb(var(--panel));--map-canvas:#f5f7fa;--map-dot:#d6dfe9;--map-minimap-mask:#f2f5f9bf;--map-vignette:#24364c0b;background:var(--map-paper);min-height:0;color:rgb(var(--ink));flex-direction:column;flex:1;font-family:Geist Variable,sans-serif;display:flex;overflow:hidden}[data-theme=dark] .argus-map{--map-card-surface:#1d2734;--map-canvas:#10161f;--map-dot:#263241;--map-minimap-mask:#0d131bb8;--map-vignette:#0000004d}.map-header{align-items:center;gap:12px;padding:14px 24px 0;display:flex}.map-heading{flex:1;min-width:0}.map-more{flex-shrink:0;position:relative}.map-more>summary{border:1px solid rgb(var(--line));width:34px;height:34px;color:rgb(var(--ink-dim));cursor:pointer;border-radius:10px;place-items:center;list-style:none;display:grid}.map-more>summary::-webkit-details-marker{display:none}.map-more[open]>summary{color:rgb(var(--blue));border-color:rgb(var(--blue) / .45)}.map-more-menu{z-index:30;background:rgb(var(--panel));border:1px solid rgb(var(--line));border-radius:12px;flex-direction:column;gap:10px;min-width:300px;padding:12px;display:flex;position:absolute;top:40px;right:0;box-shadow:0 12px 40px #1834541a}.map-more-menu .map-scope-button{text-align:left;margin-left:0}.map-more-menu .map-team-progress{border-bottom:1px solid rgb(var(--line) / .6);padding:2px 0 6px}.map-narrow-only{display:none}.map-status-row{color:rgb(var(--ink-dim));align-items:center;padding:3px 24px 10px;font-size:12.5px;display:flex}.map-status-line{align-items:center;gap:8px;min-width:0;margin:0;display:flex}.map-status-text{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.map-status-sep{color:rgb(var(--ink-faint))}.map-attention-link{color:#a06a4b;text-underline-offset:3px;cursor:pointer;flex-shrink:0;font-weight:550;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;transition:color .15s}.map-attention-link:hover{color:#7f5238;text-decoration-style:solid}[data-theme=dark] .map-attention-link{color:#d9a883}.map-live-dot{background:#5da890;border-radius:50%;width:6px;height:6px;animation:1.6s ease-in-out infinite map-live-dot;box-shadow:0 0 0 3px #5da89020}@keyframes map-live-dot{0%,to{opacity:1}50%{opacity:.35}}@media (width<=640px){.map-status-row{padding:2px 14px 8px;font-size:12px}.map-header{padding:10px 14px 0}}.map-heading h1{letter-spacing:-.3px;text-overflow:ellipsis;white-space:nowrap;font-size:18px;font-weight:600;line-height:1.3;overflow:hidden}.map-dataset-bar{color:rgb(var(--ink-dim));align-items:center;gap:10px;min-width:0;font-size:12px;display:flex}.map-dataset-bar>svg{color:#6186a9;flex-shrink:0}.map-dataset-bar select{background:var(--map-paper);color:rgb(var(--ink));outline-offset:3px;border:0;min-width:0;max-width:360px;font-weight:550}.map-dataset-description{color:rgb(var(--ink-faint));white-space:nowrap;text-overflow:ellipsis;font-size:11px;overflow:hidden}.map-capture{white-space:nowrap;color:rgb(var(--ink-faint));align-items:center;gap:5px;margin-left:auto;font-size:11px;display:flex}.map-team-progress{color:rgb(var(--ink-faint));flex-wrap:wrap;align-items:center;gap:6px 14px;font-size:12px;display:flex}.map-team-progress>span{align-items:center;gap:5px;display:inline-flex}.map-team-progress strong,.map-team-progress b{color:rgb(var(--ink-dim));font-variant-numeric:tabular-nums;font-weight:550}.map-card-team-summary{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.map-workspace{flex:1;min-height:0;display:flex;position:relative}.map-canvas-wrap{background:var(--map-canvas);flex:1;min-width:0;min-height:0;position:relative}.map-canvas-toolbar{z-index:6;pointer-events:none;flex-wrap:nowrap;align-items:center;gap:6px;display:flex;position:absolute;top:17px;left:20px;right:20px}.map-canvas-toolbar>*{pointer-events:auto}.map-toolbar-gap{pointer-events:none;flex:1;min-width:6px}.map-canvas-toolbar>button,.map-search,.map-workspace-actions button{background:var(--map-paper);border:1px solid rgb(var(--line) / .7);height:34px;color:rgb(var(--ink-dim));white-space:nowrap;border-radius:7px;align-items:center;gap:6px;font-size:12px;display:flex;box-shadow:0 2px 6px #24364c05}.map-canvas-toolbar>button{padding:0 10px}.map-search{width:195px;padding:0 10px}.map-search svg{color:rgb(var(--ink-faint));flex-shrink:0}.map-search input{width:100%;min-width:0;color:rgb(var(--ink));background:0 0;border:0;outline:none;font-size:12px}.map-search:focus-within{border-color:#7b9cbc}.map-feedback{z-index:8;background:var(--map-paper);border:1px solid rgb(var(--line));border-radius:6px;padding:7px 12px;font-size:11px;position:absolute;top:61px;left:20px}.map-attention-detail,.map-dependencies{border-bottom:1px solid rgb(var(--line) / .6);color:rgb(var(--ink-dim));flex-shrink:0;padding:8px 28px;font-size:11px}.map-attention-detail{align-items:baseline;gap:10px;display:flex}.map-attention-detail>strong{color:#ac724a;flex-shrink:0}.map-attention-detail>p{white-space:pre-line;max-height:4.5em;overflow-y:auto}.map-attention-quote{border-left:2px solid rgb(var(--line));max-height:6em;margin:4px 0 0;padding-left:8px;overflow-y:auto}.map-attention-quote>strong{margin-right:4px;font-weight:550}.map-dependencies>div{align-items:center;gap:8px;padding:3px 0;display:flex;overflow-x:auto}.map-dependencies strong{flex:0 0 70px;font-weight:550}.map-dependencies button{text-overflow:ellipsis;white-space:nowrap;border:1px solid rgb(var(--line) / .7);border-radius:6px;flex-shrink:0;max-width:min(420px,65vw);padding:4px 8px;overflow:hidden}.map-dependencies button:hover,.map-dependencies .map-trace-task,.map-canvas-toolbar>button[aria-pressed=true]{color:rgb(var(--blue));border-color:rgb(var(--blue) / .45);background:rgb(var(--blue) / .06)}.map-card{--state:#9babbc;box-sizing:border-box;border:1px solid rgb(var(--line) / .8);border-top:3px solid var(--state);background:var(--map-card-surface);cursor:pointer;border-radius:10px;width:272px;min-height:192px;transition:box-shadow .18s,border-color .18s,transform .18s;position:relative;box-shadow:0 3px 12px #24364c07,0 1px 2px #24364c05}.map-card:hover{transform:translateY(-2px)}.map-card:active{transition-duration:80ms;transform:translateY(0)scale(.988)}[data-theme=dark] .map-card{border-color:#ffffff17;box-shadow:0 4px 16px #00000059}.map-card:hover{box-shadow:0 7px 24px #24364c12}[data-theme=dark] .map-card:hover{box-shadow:0 8px 28px #00000080}.map-card.is-selected{outline-offset:3px;outline:2px solid #528abd}.map-card-top{justify-content:space-between;align-items:center;padding:12px 16px 9px;display:flex}.map-card-number{color:rgb(var(--ink-faint));letter-spacing:.4px;font-family:Geist Mono Variable,monospace;font-size:11px}.map-status{color:var(--state,#6b859f);background:color-mix(in srgb, var(--state,#6b859f) 9%, transparent);white-space:nowrap;border-radius:4px;align-items:center;gap:5px;padding:3px 6px;font-size:11px;font-weight:550;display:inline-flex}.map-state-done{--state:#528e73}.map-state-running{--state:#4a86c5}.map-state-failed{--state:#bd785f}.map-state-question{--state:#bd923f}.map-state-paused,.map-state-held,.map-state-review_unavailable{--state:#a58a56}.map-state-superseded{--state:#9588a8}.map-state-aborted,.map-state-skipped,.map-state-missing{--state:#9d9fa6}.map-live-dot,.map-state-dot{background:currentColor;border-radius:50%;width:5px;height:5px}.map-live-dot{box-shadow:0 0 0 3px #4a86c516}.map-card h3{letter-spacing:-.1px;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-height:44px;margin:0 16px 7px;font-size:14px;font-weight:600;line-height:1.6;display:-webkit-box;overflow:hidden}.map-card-copy{color:rgb(var(--ink-faint));-webkit-line-clamp:2;-webkit-box-orient:vertical;min-height:36px;margin:0 16px 13px;font-size:11px;line-height:1.65;display:-webkit-box;overflow:hidden}.map-card-bottom{border-top:1px solid rgb(var(--line) / .45);color:rgb(var(--ink-faint));align-items:center;gap:8px;padding:10px 16px;font-size:11px;display:flex}.map-card-bottom time{margin-left:auto;font-size:11px}.map-role{color:#77899f;align-items:center;gap:6px;display:flex}.map-role>span{background:currentColor;border-radius:2px;width:5px;height:5px}.map-role-engineer{color:rgb(var(--role-engineer))}.map-role-reviewer{color:rgb(var(--role-reviewer))}.map-role-manager{color:rgb(var(--role-manager))}.map-role-planner{color:rgb(var(--role-planner))}.argus-map .react-flow__handle{background:var(--map-paper);border:1.5px solid #94a6b8;width:7px;height:7px}.argus-map .react-flow__node:focus-visible .map-card{outline-offset:3px;outline:3px solid #528abd}.map-legend{z-index:6;background:var(--map-paper);border:1px solid rgb(var(--line) / .7);color:rgb(var(--ink-faint));border-radius:7px;align-items:center;gap:14px;padding:9px 12px;font-size:11px;display:flex;position:absolute;bottom:19px;left:76px;box-shadow:0 2px 6px #24364c05}.map-legend>span,.map-legend>button{align-items:center;gap:7px;display:flex}.map-legend b{border-top:1.5px solid #648db7;width:20px;display:block}.map-legend .dashed{border-top:1.5px dashed #a0afbf}.map-legend .is-muted{opacity:.45}.map-graph-warning{background:var(--map-paper);color:#b47d45;z-index:5;border:1px solid #b47d4530;border-radius:6px;padding:7px 10px;font-size:11px;position:absolute;bottom:67px;left:76px}.argus-map .react-flow__controls{border:1px solid rgb(var(--line) / .7);border-radius:7px;bottom:5px;left:6px;overflow:hidden;box-shadow:0 2px 9px #24364c08}.argus-map .react-flow__controls-button{background:var(--map-paper);fill:rgb(var(--ink-dim));border-bottom:1px solid rgb(var(--line) / .5);width:28px;height:28px}.argus-map .react-flow__minimap{background:var(--map-paper);border:1px solid rgb(var(--line) / .7);border-radius:9px;width:140px;height:95px;bottom:3px;right:5px;overflow:hidden;box-shadow:0 3px 10px #24364c08}.map-playback{border-top:1px solid rgb(var(--line) / .7);height:48px;color:rgb(var(--ink-dim));flex-shrink:0;align-items:center;gap:12px;padding:0 25px;font-size:11px;display:flex}.map-playback button{color:#6988a8;align-items:center;padding:4px;display:flex}.map-playback button:disabled{opacity:.3}.map-playback input{accent-color:#7094b6;flex:1;max-width:280px;height:3px}.map-playback small{color:rgb(var(--ink-faint));margin-left:auto;font-size:11px}.map-count{font-family:Geist Mono Variable,monospace;font-size:11px}.map-empty{height:100%;min-height:200px;color:rgb(var(--ink-faint));flex-direction:column;flex:1;justify-content:center;align-items:center;gap:12px;font-size:12px;display:flex}.map-empty h3{color:rgb(var(--ink-dim));font-size:16px}.map-empty button,.map-data-error button{border:1px solid rgb(var(--line));border-radius:5px;padding:5px 10px}.map-data-error{color:#b87753;padding:8px 28px;font-size:11px}@media (width<=1100px){.map-dataset-description{display:none}.map-header{padding:18px 20px}.map-inspector{position:absolute;top:0;bottom:0;right:0;box-shadow:-8px 0 30px #13223612}.map-heading h1{font-size:19px}}@media (width<=1023px){.map-legend,.argus-map .react-flow__minimap{display:none}.map-more-menu .map-narrow-only{display:block}}@media (width<=1199px){.map-canvas-toolbar button>span{display:none}.map-search{width:150px}}@media (width<=640px){.map-heading h1{font-size:15px}.map-dataset-bar>svg{display:none}.map-dataset-bar select{max-width:100%;font-size:12px}.map-capture{display:none}.map-canvas-toolbar{gap:4px;top:12px;left:12px;right:12px}.map-search{flex-shrink:0;width:38px;padding:0 11px;overflow:hidden}.map-search:focus-within{width:160px}.map-search:not(:focus-within) input{opacity:0}.map-canvas-toolbar>button{flex-shrink:0}.map-canvas-wrap[data-detailed=true] .map-search,.map-canvas-wrap[data-detailed=true] .map-fit-button{display:none}.map-attention-detail,.map-dependencies{padding:7px 14px}.map-dependencies strong{flex-basis:60px}.map-playback{gap:9px;padding:0 12px}.map-playback small{display:none}.map-inspector{width:min(340px,94%)}.map-graph-warning{bottom:110px;left:12px;right:12px}.argus-map{padding-bottom:calc(3.25rem + env(safe-area-inset-bottom))}.mobile-scroll-region .argus-map{padding-bottom:0}.map-playback input{width:80px;min-width:30px}}.map-scope-button{border:1px solid var(--line);color:rgb(var(--ink-dim));border-radius:9px;margin-left:12px;padding:7px 11px;font-size:12px}.map-history-progress{color:rgb(var(--ink-dim));align-items:center;gap:12px;padding:10px 24px;font-size:12px;display:flex}.map-history-progress button{color:rgb(var(--blue));margin-left:auto}.map-history-choice{padding:30px}.map-history-choice h2{margin-bottom:16px;font-size:20px;font-weight:600}.map-history-choice p{margin-bottom:10px;font-size:13px;line-height:1.8}.map-history-options{gap:10px;margin:22px 0 16px;display:grid}.map-history-options button{text-align:left;border:1px solid rgb(var(--line));border-radius:12px;padding:14px 16px;transition:border-color .16s,background .16s}.map-history-options button:first-child,.map-history-options button:hover{border-color:rgb(var(--blue));background:rgb(var(--blue) / .05)}.map-history-options strong{margin-bottom:5px;font-size:14px;display:block}.map-history-options span,.map-history-choice small{opacity:.72;font-size:12px;line-height:1.6;display:block}@media (width<=640px){.map-history-choice{padding:22px}.map-scope-button{margin-left:8px}}.map-workspace-actions{flex-shrink:0;align-items:center;gap:6px;display:flex}.map-workspace-actions button{padding:0 10px;position:relative}.map-workspace-actions button[aria-expanded=true]{color:rgb(var(--blue));border-color:rgb(var(--blue) / .45);background:rgb(var(--blue) / .07)}.map-workspace-actions button:disabled{opacity:.45;cursor:default}.map-agent-toggle i{box-sizing:content-box;border:1.5px solid var(--map-paper);background:#94a4b0;border-radius:50%;width:6px;height:6px;position:absolute;top:7px;left:21px}.map-agent-toggle i[data-active=true]{background:#5da890;box-shadow:0 0 0 2px #5da89033}.map-delivery-toggle:not(:disabled){color:rgb(var(--blue))}.map-delivery-toggle b{background:rgb(var(--blue) / .1);color:rgb(var(--blue));border-radius:6px;padding:1px 6px;font-size:11px;font-weight:600}.map-conversation{z-index:10;background:rgb(var(--panel));border:1px solid rgb(var(--line));border-radius:18px;flex-direction:column;width:min(520px,100% - 36px);min-height:150px;animation:.25s ease-out map-agent-enter;display:flex;position:absolute;top:62px;bottom:150px;right:18px;overflow:hidden;box-shadow:0 16px 60px #1834541c}.map-conversation>header{border-bottom:1px solid rgb(var(--line));color:rgb(var(--ink-dim));flex-shrink:0;align-items:center;gap:8px;padding:10px 16px;font-size:12px;display:flex}.map-conversation>header button{border-radius:8px;margin-left:auto;padding:10px}.map-conversation .conversation-row{max-width:100%;padding:12px 16px}.map-conversation .conversation-row .text-\[15px\]{font-size:13px}.map-conversation-empty{max-width:300px;color:rgb(var(--ink-dim));margin:auto;padding:24px;font-size:13px;line-height:1.8}.map-conversation-pending{color:rgb(var(--blue));border-top:1px solid rgb(var(--line));padding:10px 16px;font-size:12px}.map-starters{flex-wrap:wrap;justify-content:center;gap:8px;margin-top:20px;display:flex}.map-starters button{border:1px solid rgb(var(--line));background:rgb(var(--panel));color:rgb(var(--blue));pointer-events:auto;border-radius:10px;padding:9px 12px;font-size:12px}.map-empty p{max-width:450px}@media (width<=640px){.map-workspace-actions{gap:4px}.map-workspace-actions button{justify-content:center;width:36px;padding:0}.map-agent-toggle i{left:20px}.map-delivery-toggle b{padding:0 4px;font-size:11px;line-height:15px;position:absolute;top:-6px;right:-5px}.map-conversation{width:calc(100% - 20px);top:56px;bottom:148px;right:10px}.map-starters{margin-top:12px}.map-starters button{padding:9px;font-size:12px}}@media (prefers-reduced-motion:reduce){.map-conversation{animation:none}}.map-macro[data-active=true] .map-card:after{content:"";border:2px solid color-mix(in srgb, var(--state) 55%, transparent);pointer-events:none;border-radius:13px;animation:2.6s ease-in-out infinite map-live-ring;position:absolute;inset:-3px}@keyframes map-live-ring{0%,to{opacity:.35;transform:scale(1)}50%{opacity:.9;transform:scale(1.012)}}@media (prefers-reduced-motion:reduce){.map-macro[data-active=true] .map-card:after{opacity:.7;animation:none}}.map-macro.map-state-failed .map-card,.map-macro.map-state-question .map-card{border-color:color-mix(in srgb, var(--state) 42%, rgb(var(--line)))}.map-macro.map-state-superseded .map-card{opacity:.72;filter:saturate(.72)}.map-macro.map-state-superseded .map-card:hover{opacity:.95;filter:none}.map-card-teambar{background:rgb(var(--line) / .55);border-radius:2px;height:3px;margin:0 16px 8px;display:block;overflow:hidden}.map-card-teambar i{background:color-mix(in srgb, var(--state) 75%, transparent);border-radius:2px;height:100%;transition:width .4s ease-out;display:block}.map-canvas-wrap:after{content:"";pointer-events:none;z-index:4;background:radial-gradient(120% 92% at 50% 42%, transparent 62%, var(--map-vignette) 100%);position:absolute;inset:0}.map-macro[data-focused=false] .macro-detail{content-visibility:hidden}.map-macro{transition:opacity .35s}.map-canvas-wrap[data-detailed=true] .map-macro[data-focused=false]{opacity:.24}.map-canvas-wrap[data-detailed=true] .map-macro[data-focused=false]:hover{opacity:.85}.argus-map .react-flow__edges{transition:opacity .35s}.map-canvas-wrap[data-detailed=true] .react-flow__edges{opacity:.3}.map-canvas-wrap[data-detailed=true] .react-flow__node-branch{opacity:.35}.map-canvas-wrap .react-flow{transition:opacity .5s}.map-canvas-wrap[data-fitted=false] .react-flow{opacity:0;transition:none}.map-search{transition:width .25s}.map-canvas-wrap[data-detailed=true] .map-search:not(:focus-within){width:38px}.map-canvas-wrap[data-detailed=true] .map-search:not(:focus-within) input{opacity:0}.map-canvas-wrap[data-detailed=true] .map-canvas-toolbar>button:not(.map-back-button) span{display:none}.map-canvas-toolbar>button,.map-workspace-actions button{transition:transform .12s,border-color .15s,background .15s,color .15s}.map-canvas-toolbar>button:active,.map-workspace-actions button:active{transform:scale(.95)}@media (prefers-reduced-motion:reduce){.map-macro,.argus-map .react-flow__edges,.map-canvas-wrap .react-flow,.map-search,.map-card,.map-canvas-toolbar>button,.map-workspace-actions button,.map-attention-link{transition:none}.map-card:hover,.map-card:active{transform:none}}.map-search-count{color:rgb(var(--ink-faint));background:rgb(var(--line) / .35);font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:8px;flex-shrink:0;padding:2px 7px;font-size:11px}.map-empty.is-loading .map-ghosts{gap:14px;margin-bottom:6px;display:flex}.map-empty.is-loading .map-ghosts i{border:1px solid rgb(var(--line) / .6);background:color-mix(in srgb, rgb(var(--line)) 12%, var(--map-paper));border-radius:9px;width:118px;height:84px;position:relative;overflow:hidden}.map-empty.is-loading .map-ghosts i:after{content:"";background:linear-gradient(100deg,#0000 30%,#ffffff59 50%,#0000 70%);animation:1.6s ease-in-out infinite map-ghost-sheen;position:absolute;inset:0;transform:translate(-100%)}[data-theme=dark] .map-empty.is-loading .map-ghosts i:after{background:linear-gradient(100deg,#0000 30%,#ffffff12 50%,#0000 70%)}.map-empty.is-loading .map-ghosts i:nth-child(2):after{animation-delay:.14s}.map-empty.is-loading .map-ghosts i:nth-child(3):after{animation-delay:.28s}@keyframes map-ghost-sheen{60%,to{transform:translate(100%)}}@media (prefers-reduced-motion:reduce){.map-empty.is-loading .map-ghosts i:after{animation:none}}.map-playback button{border:1px solid rgb(var(--line) / .7);background:var(--map-paper);border-radius:8px;justify-content:center;width:30px;height:26px;transition:transform .12s,border-color .15s,color .15s}.map-playback button:not(:disabled):hover{color:rgb(var(--blue));border-color:#7ca9c8}.map-playback button:not(:disabled):active{transform:scale(.94)}.map-playback input{border-radius:3px;height:4px}.map-playback .map-count{background:rgb(var(--line) / .35);border-radius:8px;padding:2px 8px}@media (prefers-reduced-motion:reduce){.map-playback button{transition:none}}.map-brief{color:rgb(var(--ink));flex-shrink:0;gap:4px;margin:0;padding:10px 28px 8px;font-size:13px;line-height:1.6;display:grid}.map-brief>div{gap:10px;min-width:0;display:flex}.map-brief dt{color:rgb(var(--ink-dim));flex:0 0 4em;font-weight:550}.map-brief dd{white-space:normal;overflow-wrap:anywhere;min-width:0;margin:0}.map-attention-detail>div{white-space:pre-line;max-height:7em;overflow-y:auto}.map-attention-detail>div>p{margin:0 0 2px}.map-attention-detail details{color:rgb(var(--ink-dim))}.map-canvas-wrap{--detail-alpha:0;--summary-alpha:1;--context-alpha:1}.map-macro{background:var(--map-paper);border:2px solid rgb(var(--line) / .9);border-top:7px solid var(--state,#9babbc);width:100%;height:100%;opacity:var(--context-alpha);border-radius:32px;transition:opacity .15s,border-color .15s;position:relative;box-shadow:0 10px 36px #24364c0b}.map-macro[data-focused=true]{opacity:1;border-color:#82a6c5}.argus-map .map-macro>.react-flow__handle{border-width:4px;width:24px;height:24px}.macro-summary{opacity:1;width:272px;position:absolute;top:50%;left:50%}.map-macro[data-focused=true] .macro-summary{opacity:var(--summary-alpha)}.macro-summary .map-card{text-align:left;width:100%;box-shadow:none;border:none;border-radius:7px;min-height:196px}.macro-summary .map-card:focus-visible{outline-offset:1px;outline:2px solid #7da6c7}.map-card-submap-hint{color:#6a8da8;align-items:center;gap:4px;margin-left:auto;font-size:11px;display:flex}.macro-detail{opacity:0;pointer-events:none;position:absolute;inset:0}.map-macro[data-focused=true] .macro-detail{opacity:var(--detail-alpha)}.map-macro[data-detailed=true] .macro-detail{pointer-events:auto}.map-macro[data-detailed=true] .macro-summary{pointer-events:none}.macro-heading{align-items:center;gap:22px;display:flex;position:absolute;top:30px;left:48px;right:48px}.macro-index{color:#8ca3b6;letter-spacing:.5px;font:18px Geist Mono Variable,monospace}.macro-heading>div{flex:1;min-width:0}.macro-heading small{color:rgb(var(--ink-faint));letter-spacing:2.5px;text-transform:uppercase;font-size:12px;font-weight:650}.macro-heading h2{letter-spacing:-.2px;white-space:nowrap;text-overflow:ellipsis;margin-top:4px;font-size:19px;font-weight:600;line-height:1.35;overflow:hidden}.macro-state{color:color-mix(in srgb, var(--state,#859eb5) 82%, rgb(var(--ink)));white-space:nowrap;border:1px solid color-mix(in srgb, var(--state,#859eb5) 28%, transparent);background:color-mix(in srgb, var(--state,#859eb5) 10%, transparent);border-radius:999px;padding:7px 12px;font-size:12px;font-weight:550;line-height:1}.macro-conclusion{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:46%;color:rgb(var(--ink-dim));background:#3f8f6817;border:1px solid #3f8f6838;border-radius:999px;flex:auto;padding:6px 12px;font-size:13px;line-height:1.3;overflow:hidden}.macro-detail[data-stacked=true] .macro-heading{flex-wrap:wrap;gap:10px 14px}.macro-detail[data-stacked=true] .macro-heading>div{flex:60%}.macro-detail[data-stacked=true] .macro-heading small{white-space:nowrap;letter-spacing:1.5px}.macro-detail[data-stacked=true] .macro-conclusion{white-space:normal;flex:100%;order:2;max-width:100%;line-height:1.4}.macro-detail[data-stacked=true] .macro-state{order:3}.macro-detail[data-stacked=true] .macro-heading>button{white-space:nowrap;order:4}.macro-detail[data-stacked=true] .macro-stage-key{flex-wrap:wrap;top:222px}.submap-step-meta small[data-verdict=rejected]{color:#bd785f;font-weight:600}.submap-step-meta small[data-verdict=chosen]{color:#3f8f68;font-weight:600}.submap-step-meta small[data-verdict=qualified]{color:#528e73;font-weight:600}.macro-stage-key{color:rgb(var(--ink-dim));gap:8px;font-size:12px;display:flex;position:absolute;top:103px;left:48px}.macro-stage-key span{color:color-mix(in srgb, var(--step-color) 78%, rgb(var(--ink)));letter-spacing:.02em;border:1px solid color-mix(in srgb, var(--step-color) 24%, transparent);background:color-mix(in srgb, var(--step-color) 13%, transparent);border-radius:999px;padding:5px 10px;font-weight:550;line-height:1}.macro-stage-key .is-unrecorded{color:rgb(var(--ink-faint));border-color:rgb(var(--ink-faint) / .35);opacity:.55;background:0 0}.macro-stage-key small{font-size:12px}.macro-column-label{letter-spacing:.02em;color:rgb(var(--ink-dim));flex-direction:column;align-items:flex-start;gap:7px;font-size:13px;font-weight:600;display:flex;position:absolute}.macro-column-label:after{content:"";background:rgb(var(--ink-faint) / .45);border-radius:1px;width:24px;height:2px}.macro-column-label>span{color:#94a5b6;padding-top:3px;font:13px Geist Mono Variable,monospace}.submap-kind-plan{--step-color:#ad9262}.submap-kind-execution{--step-color:#618faf}.submap-kind-review{--step-color:#9882b0}.submap-kind-revision{--step-color:#b48b62}.submap-kind-result{--step-color:#609884}.submap-step{text-align:left;border:1.5px solid rgb(var(--line) / .8);background:var(--map-paper);border-radius:13px;flex-direction:column;width:232px;height:180px;padding:15px 16px 12px;transition:border-color .12s,box-shadow .12s;display:flex;position:absolute;overflow:hidden;box-shadow:0 4px 13px #24364c08}.submap-step:hover,.submap-step.is-selected,.submap-step:focus-visible{border-color:var(--step-color);outline:none;box-shadow:0 4px 18px #24364c14}.submap-step-meta{color:color-mix(in srgb, var(--step-color) 78%, rgb(var(--ink)));justify-content:space-between;align-items:center;gap:6px;font-size:12px;line-height:1.35;display:flex}.submap-step-meta>span{letter-spacing:.01em;align-items:center;gap:6px;min-width:0;font-weight:600;display:flex}.submap-step-meta>span svg{flex-shrink:0;width:14px;height:14px}.submap-step-meta small{letter-spacing:.02em;text-align:right;color:rgb(var(--ink-faint));font-size:12px;font-weight:550}.submap-step h4{letter-spacing:-.1px;-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin:8px 0 4px;font-size:14px;font-weight:600;line-height:1.45;display:-webkit-box;overflow:hidden}.submap-step-copy{color:rgb(var(--ink-dim));-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;font-size:12px;line-height:1.6;display:-webkit-box;overflow:hidden}.submap-step-foot{color:rgb(var(--ink-faint) / .85);border-top:1px solid rgb(var(--line) / .5);justify-content:space-between;align-items:center;margin-top:auto;padding-top:8px;font-size:12px;display:flex}.submap-step-work{font-variant-numeric:tabular-nums;font-style:normal}.submap-step-foot svg{width:12px;height:12px}.submap-relations{pointer-events:none;position:absolute;top:0;left:0;overflow:visible}.map-macro[data-detailed=true] .submap-relations>g{pointer-events:visiblePainted}.submap-relation-label rect{fill:var(--map-paper)}.submap-relation-label text{fill:#8297aa;font-size:13px}.macro-evidence{border-top:1px solid rgb(var(--line) / .6);height:118px;color:rgb(var(--ink-faint));position:absolute;left:48px;right:48px}.macro-evidence>p{padding-top:27px;font-size:14px}.macro-step-detail{overflow-wrap:anywhere;height:118px;padding:17px 34px 8px 0;font-size:14px;overflow:auto}.macro-step-detail>strong{color:rgb(var(--ink));margin-right:18px}.macro-step-detail>span,.macro-step-detail>small{color:#8b9faf;font-size:12px}.macro-step-detail p{white-space:pre-wrap;color:rgb(var(--ink-dim));margin:9px 0;line-height:1.8}.macro-step-detail>button{padding:4px;position:absolute;top:15px;right:0}.map-timeline-context{pointer-events:none;opacity:var(--context-alpha);position:absolute}.map-timeline-context path{fill:none;stroke:#aabac9;stroke-width:1px;stroke-dasharray:3 5;vector-effect:non-scaling-stroke}.map-timeline-context circle{fill:#aabac9}.map-timeline-context text{fill:#899daf;letter-spacing:1px;font-size:36px}.map-canvas-wrap .react-flow__edges{opacity:var(--context-alpha);transition:opacity .15s}.map-relation-label{color:#426783;background:var(--map-paper);white-space:nowrap;opacity:var(--context-alpha);pointer-events:none;border:1px solid #92aabd55;border-radius:7px;padding:3px 7px;font-size:12px;font-weight:500;line-height:18px;position:absolute;box-shadow:0 2px 7px #294c6a0b}.map-legend .replacement{border-color:#a48caf;border-top-style:dashed}.map-legend button:disabled{cursor:default}.argus-map .react-flow__minimap{z-index:7;width:185px;height:120px}.argus-map .react-flow__minimap svg{width:100%;height:100%}.map-back-button{color:#517fa6!important}@media (width<=800px){.map-legend{bottom:149px;left:16px}.map-summary-note{display:none}}@media (width<=640px){.macro-step-detail{overscroll-behavior:contain}}@media (prefers-reduced-motion:reduce){.map-macro,.map-card,.submap-step,.map-canvas-wrap .react-flow__edges{transition:none}}.map-macro{box-shadow:0 16px 48px #233d5818,0 3px 8px #233d5810}.macro-detail{transition:transform .26s}.macro-detail.is-reading .submap-step,.macro-detail.is-reading .submap-relations,.macro-detail.is-reading .macro-column-label{opacity:.22}.submap-step{box-shadow:0 6px 20px #233d5812,0 2px 4px #233d5808}.map-macro[data-active=true]{border-color:#74a5c7}.map-macro[data-active=true] .macro-state,.submap-step[data-active=true] .submap-step-meta{color:color-mix(in srgb, #4a86c5 82%, rgb(var(--ink)))}.map-macro[data-active=true] .map-state-dot{animation:2.2s ease-in-out infinite map-working}.submap-step[data-active=true]{border-color:#6ca1c4 #6ca1c4 #6ca1c4 #4a86c5;border-left-style:solid;border-left-width:3px;animation:2s ease-in-out infinite submap-step-pulse}.macro-reader{--reader-accent:#8facc3;z-index:4;border:1.5px solid #8facc3;border-top:3px solid var(--reader-accent);background:var(--map-paper);border-radius:22px;flex-direction:column;padding:22px 30px 20px;animation:.22s backwards map-arrive;display:flex;position:absolute;box-shadow:0 20px 65px #28435c25}.submap-step.submap-kind-plan.is-selected~.macro-reader{--reader-accent:#ad9262}.submap-step.submap-kind-execution.is-selected~.macro-reader{--reader-accent:#618faf}.submap-step.submap-kind-review.is-selected~.macro-reader{--reader-accent:#9882b0}.submap-step.submap-kind-revision.is-selected~.macro-reader{--reader-accent:#b48b62}.submap-step.submap-kind-result.is-selected~.macro-reader{--reader-accent:#609884}.macro-reader header{color:rgb(var(--ink-faint));justify-content:space-between;align-items:center;font-size:12px;display:flex}.macro-reader header>span{color:color-mix(in srgb, var(--reader-accent) 76%, rgb(var(--ink)));letter-spacing:.14em;text-transform:uppercase;font-size:12px;font-weight:650}.macro-reader header button{width:32px;height:32px;color:rgb(var(--ink-faint));border-radius:9px;place-items:center;margin:-6px -10px -6px 0;transition:background .14s,color .14s;display:grid}.macro-reader header button:hover,.macro-reader header button:focus-visible{background:rgb(var(--line) / .5);color:rgb(var(--ink))}.macro-reader>h3{letter-spacing:-.2px;margin:12px 0 14px;font-size:18px;font-weight:600;line-height:1.4}.macro-reader-body{min-height:0;color:rgb(var(--ink-dim));overflow-wrap:anywhere;flex:1;padding-inline:max(0px,50% - 32ch);font-size:14px;line-height:1.7;overflow:auto}.macro-reader-markdown p{margin:0 0 12px}.macro-reader-markdown ul,.macro-reader-markdown ol{margin:10px 0 14px;padding-left:24px}.macro-reader-markdown h1,.macro-reader-markdown h2,.macro-reader-markdown h3{margin:18px 0 8px;line-height:1.45}.macro-reader-markdown code{font-size:.9em}.macro-reader footer{border-top:1px solid rgb(var(--line) / .6);color:rgb(var(--ink-faint) / .9);justify-content:space-between;align-items:center;margin-top:14px;padding-top:12px;font-size:12px;display:flex}.macro-reader footer button{color:rgb(var(--blue));background:rgb(var(--blue) / .1);border-radius:8px;padding:8px 12px;font-size:12px;font-weight:550;line-height:1;transition:background .14s}.macro-reader footer button:hover,.macro-reader footer button:focus-visible{background:rgb(var(--blue) / .16)}.map-composer-dock{--composer-width:min(660px, calc(100% - 440px));z-index:8;width:var(--composer-width);transition:width .32s cubic-bezier(.22,1.18,.3,1);position:absolute;bottom:16px;left:50%;transform:translate(-50%)}.map-composer-dock[data-compact=true]{width:210px}.map-composer-dock[data-compact=true] .map-send{opacity:0;pointer-events:none;width:0;overflow:hidden}@media (hover:hover) and (pointer:fine){.map-composer-dock[data-compact=true]:hover{width:var(--composer-width)}.map-composer-dock[data-compact=true]:hover .map-send{opacity:1;pointer-events:auto;width:33px}}.map-composer{border:1px solid rgb(var(--line) / .8);background:var(--map-paper);border-radius:29px;align-items:center;gap:15px;padding:14px 15px 14px 22px;display:flex;box-shadow:0 9px 28px #233b5510,0 2px 5px #233b5509}.map-composer:focus-within{border-color:#a0b8cb;box-shadow:0 10px 32px #233b5516}.map-composer-brand{color:rgb(var(--ink));flex-shrink:0}.map-attach{border-radius:50%;place-items:center;width:34px;height:34px;transition:background .14s;display:grid}.map-attach:hover,.map-attach:focus-visible{background:rgb(var(--line) / .6);outline-offset:2px;outline:2px solid #a3bccf}.map-attach:disabled{opacity:.45;cursor:default}.map-attachment-tray{overscroll-behavior:contain;flex-wrap:wrap;gap:8px;max-height:140px;padding:0 8px 9px;display:flex;overflow-y:auto}.map-attachment-tray>div{flex:200px;max-width:100%}.map-attachment-notice{background:var(--map-paper);color:rgb(var(--err));border-radius:10px;max-height:72px;margin-bottom:6px;padding:7px 12px;font-size:12px;overflow-y:auto}.map-composer textarea{resize:none;min-width:0;color:rgb(var(--ink));background:0 0;border:none;outline:none;flex:1;max-height:132px;font-size:15px;line-height:28px}.map-composer textarea::placeholder{color:rgb(var(--ink-faint))}.map-send{color:#fff;background:#2d536f;border-radius:50%;flex-shrink:0;place-items:center;width:33px;height:33px;transition:width .22s,opacity .15s;display:grid}.map-send:disabled{background:rgb(var(--line) / .7);color:rgb(var(--ink-faint))}.map-composer-caption{white-space:nowrap;text-overflow:ellipsis;text-align:center;color:rgb(var(--ink-faint));min-height:15px;padding-top:5px;font-size:11px;display:block;overflow:hidden}.map-reference-chips{flex-wrap:wrap;gap:6px;padding:0 16px 7px;display:flex}.map-reference-chips>span{background:var(--map-paper);color:#5d7e98;border:1px solid #b9ccd9;border-radius:9px;align-items:center;gap:9px;max-width:100%;padding:5px 9px;font-size:11px;display:flex;box-shadow:0 2px 5px #233b5508}.map-reference-chips>span>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.map-context-menu{z-index:50;border:1px solid rgb(var(--line));background:var(--map-paper);border-radius:10px;width:156px;padding:5px;position:fixed;box-shadow:0 8px 28px #233b5522}.map-context-menu button{text-align:left;border-radius:6px;width:100%;padding:8px 12px;font-size:13px;display:block}.map-context-menu button:hover{background:var(--map-canvas)}.map-legend{bottom:70px;left:20px}.argus-map .react-flow__controls{margin:0;bottom:24px;left:20px}.argus-map .react-flow__controls-button{border-bottom:0;border-right:1px solid rgb(var(--line) / .5)}.argus-map .react-flow__controls-button:last-child{border-right:0}.map-graph-warning{bottom:120px;left:20px}.map-playback small{display:none}@keyframes map-arrive{0%{opacity:0;transform:translateY(7px)}to{opacity:1;transform:translateY(0)}}@keyframes map-working{0%,to{opacity:.55;transform:scale(1)}50%{opacity:1;transform:scale(1.5)}}@keyframes map-step-working{0%,to{box-shadow:0 4px 16px #497ea51a}50%{box-shadow:0 5px 25px #497ea536}}@media (width<=1100px){.map-composer-dock{--composer-width:min(580px, calc(100% - 230px));left:42%}}@media (width<=640px){.map-composer-dock{--composer-width:calc(100% - 26px);bottom:6px;left:50%}.map-composer{border-radius:24px;gap:10px;padding:10px 12px}.map-composer textarea{font-size:14px}.argus-map .react-flow__controls{display:none}.map-reference-chips{max-height:65px;overflow-y:auto}.map-attachment-tray{flex-wrap:nowrap;max-height:100px;overflow:auto hidden}.map-attachment-tray>div{flex:0 0 240px}}@media (prefers-reduced-motion:reduce){.map-composer-dock,.map-send{transition:none}.macro-detail,.macro-reader,.submap-step,.map-macro .map-state-dot{transition:none;animation:none!important}}.macro-summary .map-card>p{-webkit-line-clamp:3;min-height:54px}.map-live-phase{color:#5689ac;align-items:center;gap:6px;font-size:12px;display:flex}.map-live-phase i{background:currentColor;border-radius:50%;width:5px;height:5px;animation:2.2s ease-in-out infinite map-working;display:block}.macro-part-nav{color:rgb(var(--ink-faint));justify-content:space-between;align-items:center;gap:16px;font-size:12px;display:flex;position:absolute;bottom:10px;left:48px;right:48px}.macro-part-nav>div,.macro-part-nav button{align-items:center;gap:8px;display:flex}.macro-part-nav button{border:1px solid rgb(var(--line) / .9);background:var(--map-paper);color:rgb(var(--ink-dim));border-radius:8px;padding:6px 12px;font-size:12px;font-weight:500;transition:border-color .14s,color .14s,background .14s}.macro-part-nav button:hover:not(:disabled),.macro-part-nav button:focus-visible:not(:disabled){color:rgb(var(--blue));background:rgb(var(--blue) / .05);border-color:#7ca9c8}.macro-part-nav button:disabled{opacity:.35}.map-part-switcher{display:none}@media (width<=640px){.map-part-switcher{border:1px solid rgb(var(--line) / .7);background:var(--map-paper);font-variant-numeric:tabular-nums;color:#527fa7;border-radius:7px;flex-shrink:0;align-items:center;gap:2px;height:34px;padding:0 2px;font-size:12px;display:flex;box-shadow:0 2px 6px #24364c05}.map-part-switcher button{place-items:center;width:26px;height:30px;display:grid}.map-part-switcher button:disabled{opacity:.35}.macro-part-nav{display:none}}.submap-round{color:rgb(var(--ink-faint));background:rgb(var(--line) / .4);white-space:nowrap;border-radius:999px;flex-shrink:0;padding:2px 6px;font-size:12px;font-style:normal;font-weight:550}.map-card-copy strong,.submap-step-copy strong{color:rgb(var(--ink));font-weight:600}.map-card-copy code,.submap-step-copy code{background:rgb(var(--blue) / .06);border-radius:3px;padding:0 3px;font-size:.94em}.submap-step-copy code{font-size:1em}.markdown-excerpt-link{color:rgb(var(--blue))}.markdown-excerpt-item+.markdown-excerpt-item:before{content:" · ";color:rgb(var(--ink-faint))}.macro-reader-markdown table{table-layout:auto}.macro-reader-markdown h1{font-size:1.2em}.macro-reader-markdown h2{font-size:1.1em}.macro-reader-markdown h3{font-size:1em}.macro-reader-markdown th,.macro-reader-markdown td{min-width:5em}.submap-step[data-status=done] .submap-step-meta small{color:color-mix(in srgb, #528e73 78%, rgb(var(--ink)))}.submap-step[data-status=done] .submap-step-meta small:before{content:"✓ ";color:#528e7399}.submap-step[data-status=failed]{border-left:3px solid #bd785fbf}.submap-step[data-status=failed] .submap-step-meta small{color:color-mix(in srgb, #bd785f 82%, rgb(var(--ink)))}.submap-step[data-status=running]{border-left:3px solid #4a86c5}.submap-step[data-status=running] .submap-step-meta small{color:color-mix(in srgb, #4a86c5 82%, rgb(var(--ink)))}.submap-step[data-status=superseded]{opacity:.6;filter:grayscale(.3)}.submap-step.is-selected{outline:2px solid color-mix(in srgb, var(--step-color) 80%, rgb(var(--ink)));outline-offset:2px}@keyframes submap-step-pulse{0%,to{border-left-color:#4a86c573}50%{border-left-color:#4a86c5}}@media (prefers-reduced-motion:reduce){.macro-part-nav button,.macro-reader header button,.macro-reader footer button{transition:none}}.argus-map{--atlas-flow:#3f9fba}.map-canvas-wrap{background-image:radial-gradient(ellipse at 45% 40%, rgb(var(--blue) / .035), transparent 70%)}.map-macro{box-shadow:0 12px 36px rgb(var(--ink) / .06);border-top-width:4px;border-radius:28px}.map-macro[data-active=true]{border-color:rgb(var(--line));border-top-color:var(--state);box-shadow:0 12px 36px rgb(var(--blue) / .09)}.map-macro[data-active=true]:before{content:none}.map-macro[data-history=true]{background:color-mix(in srgb, var(--map-paper) 94%, rgb(var(--line)));box-shadow:none}.map-macro[data-completed-now=true]{animation:1.4s ease-out atlas-complete}.macro-summary .map-card{background:0 0;border-radius:9px}.map-card-number{color:rgb(var(--ink-faint));letter-spacing:.08em;font-size:10px}.map-card h3{letter-spacing:-.015em;margin-bottom:10px;font-size:16px;font-weight:600;line-height:1.45}.macro-summary .map-card h3{-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.map-card-objective{color:rgb(var(--ink-faint));-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0 16px 9px;font-size:11px;line-height:1.5;display:-webkit-box;overflow:hidden}.macro-summary .map-card>p.map-card-objective{-webkit-line-clamp:2;min-height:0;overflow:hidden}.map-card-copy{color:rgb(var(--ink-dim));margin-bottom:12px;font-size:12px;line-height:1.6}.macro-summary .map-card-copy{-webkit-line-clamp:3;overflow-wrap:anywhere;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.map-card-stages{flex-direction:column;align-items:flex-start;gap:4px;margin:0 16px 12px;display:flex}.map-card-stages>span{color:rgb(var(--ink-faint));font-size:10px}.map-card-stages .map-live-line{margin:0}.map-history-toggle{color:rgb(var(--ink-dim));background:0 0;border:0;align-items:center;gap:5px;padding:3px 0;font-size:11px;display:flex;position:absolute;bottom:9px;left:16px}.map-history-toggle:hover{color:rgb(var(--blue))}.map-history-toggle:focus-visible{outline:2px solid rgb(var(--blue) / .5);outline-offset:3px;border-radius:3px}.map-history-toggle[aria-expanded=true] svg{transform:rotate(90deg)}.map-macro[data-detailed=true] .map-history-toggle{visibility:hidden}.map-card-stages>span[data-present=true]{color:var(--step-color);background:color-mix(in srgb, var(--step-color) 9%, transparent);opacity:1}.map-card-stages>span[data-active=true]{box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--step-color) 40%, transparent)}.map-card-stages>span[data-active=true] svg{animation:1.8s ease-in-out infinite atlas-stage-pulse}.map-card-bottom{padding-top:9px;padding-bottom:9px}.map-edge-spark{background:var(--atlas-flow,#3f9fba);offset-rotate:0deg;pointer-events:none;will-change:offset-distance, opacity;border-radius:50%;animation:2.8s linear infinite atlas-spark;position:absolute;top:0;left:0;box-shadow:0 0 5px 1px #76b7cf59}.submap-flow{pointer-events:none;animation:1.7s ease-in-out infinite atlas-submap-flow}.map-dispatch-trail{z-index:44;pointer-events:none;filter:drop-shadow(0 0 7px #78c8d166);width:100vw;height:100dvh;position:fixed;inset:0;overflow:visible}.map-dispatch-trail path{opacity:0}.map-canvas-toolbar>button:hover,.map-workspace-actions button:not(:disabled):hover{background:rgb(var(--blue) / .045);border-color:#7ca9c8}.map-relation-label{color:#557a97;border-color:#8daec53b;font-size:11px;box-shadow:0 3px 10px #1c486510}.submap-step[data-active=true]{background:linear-gradient(130deg, #6ca1c407, var(--map-paper) 60%)}[data-theme=dark] .map-macro{box-shadow:0 18px 60px #0004}[data-theme=dark] .map-macro[data-active=true]{box-shadow:0 12px 36px #0003}[data-theme=dark] .map-relation-label{color:#9dc0dc}@keyframes atlas-spark{0%{offset-distance:0%;opacity:0}12%{opacity:.95}82%{opacity:.95}to{offset-distance:100%;opacity:0}}@keyframes atlas-submap-flow{0%,to{opacity:.25}50%{opacity:.9}}@keyframes atlas-breathe{0%,to{opacity:.3}50%{opacity:1}}@keyframes atlas-stage-pulse{0%,to{opacity:.6}50%{opacity:1}}@keyframes atlas-complete{0%{box-shadow:0 0 #69b39500}35%{box-shadow:0 0 0 14px #69b39535,0 18px 70px #4d9b7840}to{box-shadow:0 0 0 35px #69b39500}}@media (prefers-reduced-motion:reduce){.map-edge-spark,.map-dispatch-trail{display:none}.submap-flow,.map-macro[data-active=true]:before,.map-macro[data-completed-now=true],.map-card-stages>span[data-active=true] svg{animation:none}}.macro-reader-body table{font-size:.85em}.map-canvas-wrap[data-reading=true] .map-legend,.map-canvas-wrap[data-reading=true] .react-flow__minimap,.map-canvas-wrap[data-reading=true] .react-flow__controls{opacity:0;pointer-events:none}@media (width<=640px){.map-canvas-wrap[data-detailed=true] .map-legend,.map-canvas-wrap[data-detailed=true] .react-flow__minimap,.map-canvas-wrap[data-detailed=true] .react-flow__controls{visibility:hidden;pointer-events:none}}.macro-reader-body{scrollbar-gutter:stable;overscroll-behavior:contain}[data-theme=dark] .macro-reader{border-color:rgb(var(--line));border-top-color:var(--reader-accent,#8facc3);box-shadow:0 20px 65px #0005}[data-theme=dark] .macro-notes{background:color-mix(in srgb, #c99b3f 13%, var(--map-paper))}[data-theme=dark] .submap-step[data-status=superseded]{opacity:.6;filter:grayscale(.3)brightness(.92)}.map-branch{--state:#9babbc;box-sizing:border-box;background:color-mix(in srgb, var(--state) 14%, var(--map-paper));border:2px solid color-mix(in srgb, var(--state) 30%, rgb(var(--line)));border-left:12px solid var(--state);cursor:pointer;text-align:left;width:100%;height:100%;font:inherit;color:rgb(var(--ink));border-radius:95px;align-items:center;gap:26px;padding:0 40px 0 30px;transition:box-shadow .15s,border-color .15s;display:flex;position:relative;box-shadow:0 10px 42px #16375010,0 2px 6px #16375008}.map-branch.map-state-done{--state:#528e73}.map-branch.map-state-running{--state:#4a86c5}.map-branch.map-state-failed{--state:#bd785f}.map-branch.map-state-question{--state:#bd923f}.map-branch.map-state-paused{--state:#a58a56}.map-branch.map-state-superseded{--state:#9588a8}.map-branch:hover{border-color:color-mix(in srgb, var(--state) 58%, rgb(var(--line)));border-left-color:var(--state);box-shadow:0 14px 52px color-mix(in srgb, var(--state) 22%, transparent), 0 2px 8px #16375012}.map-branch:focus-visible{outline:6px solid rgb(var(--blue) / .45);outline-offset:6px}.map-branch-glyph{width:84px;height:84px;color:var(--state);background:color-mix(in srgb, var(--state) 12%, transparent);border-radius:50%;flex:none;justify-content:center;align-items:center;display:flex}.map-branch-glyph svg{width:44px;height:44px}.map-branch-state{color:color-mix(in srgb, var(--state) 82%, rgb(var(--ink)));flex:none;margin-right:-6px;font-size:42px;font-weight:700;line-height:1}.map-branch-title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:46px;font-weight:620;line-height:1.25;overflow:hidden}.map-branch[data-verdict=rejected]{--state:#bd785f}.map-branch[data-verdict=chosen]{--state:#3f8f68}.map-branch[data-verdict=qualified]{--state:#528e73}.map-branch-verdict{text-overflow:ellipsis;white-space:nowrap;max-width:45%;color:color-mix(in srgb, var(--state) 72%, rgb(var(--ink)));background:color-mix(in srgb, var(--state) 14%, transparent);border:2px solid color-mix(in srgb, var(--state) 30%, transparent);border-radius:40px;flex:none;padding:10px 18px;font-size:34px;font-weight:640;line-height:1;overflow:hidden}.map-branch-fan{letter-spacing:1px;color:color-mix(in srgb, var(--state) 70%, rgb(var(--ink)));background:color-mix(in srgb, var(--state) 14%, transparent);border:2px solid color-mix(in srgb, var(--state) 30%, transparent);border-radius:40px;flex:none;padding:9px 16px;font-family:Geist Mono Variable,monospace;font-size:30px;font-weight:620;line-height:1}.map-branch-dot{background:var(--state);width:26px;height:26px;box-shadow:0 0 0 9px color-mix(in srgb, var(--state) 16%, transparent);border-radius:50%;flex:none}.map-branch[data-status=running]{animation:2.4s ease-in-out infinite map-branch-breathe}.map-branch[data-overflow=true]{color:rgb(var(--ink-dim));border-style:dashed dashed dashed solid}.map-branch-group{--group-type:46px;gap:calc(var(--group-type) * .45);padding:0 calc(var(--group-type) * .7) 0 calc(var(--group-type) * .55);border-radius:64px}.map-branch-group .map-branch-title{white-space:normal;-webkit-line-clamp:4;font-size:var(--group-type);-webkit-box-orient:vertical;line-height:1.3;display:-webkit-box}.map-branch-group .map-branch-glyph{width:calc(var(--group-type) * 1.8);height:calc(var(--group-type) * 1.8)}.map-branch-group .map-branch-glyph svg{width:calc(var(--group-type) * .95);height:calc(var(--group-type) * .95)}.map-branch-group .map-branch-dot{width:calc(var(--group-type) * .6);height:calc(var(--group-type) * .6)}.map-branch-toggle{font-size:calc(var(--group-type) * .8);color:color-mix(in srgb, var(--state) 70%, rgb(var(--ink)));background:color-mix(in srgb, var(--state) 14%, transparent);border:2px solid color-mix(in srgb, var(--state) 30%, transparent);border-radius:999px;flex:none;align-items:center;gap:.2em;padding:.4em .7em;font-weight:560;line-height:1;display:inline-flex}.map-branch-toggle svg{width:1em;height:1em}.map-branch-group[data-expanded=true]{border-style:dashed dashed dashed solid}[data-theme=dark] .map-branch{box-shadow:0 10px 36px #0004}@keyframes map-branch-breathe{0%,to{opacity:1}50%{opacity:.8}}@media (prefers-reduced-motion:reduce){.map-branch[data-status=running]{animation:none}}.react-flow__edge.map-edge-fanout,.react-flow__edge.map-edge-fanin{opacity:.62}.react-flow__edge.map-edge-context{opacity:.55}.map-canvas-wrap{--z:var(--map-zoom-step,.24);--px:calc(1px / var(--z));--map-card-shadow:0 calc(1 * var(--px)) calc(2 * var(--px)) #1e30480d, 0 calc(8 * var(--px)) calc(24 * var(--px)) #1e304812;--map-card-shadow-lift:0 calc(2 * var(--px)) calc(4 * var(--px)) #1e30480f, 0 calc(16 * var(--px)) calc(40 * var(--px)) #1e304821;--map-card-line:rgb(var(--ink) / .1)}[data-theme=dark] .map-canvas-wrap{--map-card-shadow:0 calc(1 * var(--px)) calc(2 * var(--px)) #0006, 0 calc(10 * var(--px)) calc(28 * var(--px)) #00000059;--map-card-shadow-lift:0 calc(2 * var(--px)) calc(4 * var(--px)) #00000073, 0 calc(18 * var(--px)) calc(44 * var(--px)) #00000080;--map-card-line:#ffffff1a}.argus-map .map-macro{border:var(--px) solid var(--map-card-line);border-radius:calc(12 * var(--px));box-shadow:var(--map-card-shadow);background:linear-gradient(180deg, color-mix(in srgb, var(--state,#9babbc) 7%, var(--map-paper)) 0, var(--map-paper) 46%);transition:opacity .15s,border-color .18s,box-shadow .22s;overflow:visible}.argus-map .map-macro:after{content:"";left:calc(-1 * var(--px));top:calc(12 * var(--px));bottom:calc(12 * var(--px));width:calc(3 * var(--px));border-radius:calc(3 * var(--px));background:var(--state,#9babbc);pointer-events:none;position:absolute}.argus-map .map-macro[data-history=true]{box-shadow:none;background:color-mix(in srgb, var(--map-paper) 92%, rgb(var(--line)))}.argus-map .map-macro[data-history=true]:after{opacity:.45}.argus-map .map-macro[data-hovered=true],.argus-map .map-macro:hover{box-shadow:var(--map-card-shadow-lift);border-color:color-mix(in srgb, var(--state,#82a6c5) 38%, var(--map-card-line))}.argus-map .map-macro[data-active=true]{border-color:color-mix(in srgb, var(--state) 45%, var(--map-card-line));box-shadow:0 0 0 calc(3 * var(--px)) color-mix(in srgb, var(--state) 16%, transparent), var(--map-card-shadow-lift)}.argus-map .map-macro>.react-flow__handle{opacity:0}.argus-map .macro-summary .map-card{height:var(--summary-height);min-height:0;box-shadow:none;background:0 0;border:0;border-radius:10px;flex-direction:column;justify-content:flex-start;padding:14px 16px 12px 18px;display:flex;overflow:hidden;transform:none}.argus-map .macro-summary .map-card:hover,.argus-map .macro-summary .map-card:active{box-shadow:none;transform:none}.argus-map .macro-summary .map-card>*{max-width:560px;margin-left:0;margin-right:0}.argus-map .macro-summary .map-card-top{flex-shrink:0;align-items:center;gap:8px;margin:0 0 9px;padding:0;display:flex}.argus-map .macro-summary .map-card-number{letter-spacing:.06em;color:rgb(var(--ink-faint));white-space:nowrap;font-family:Geist Mono Variable,ui-monospace,monospace;font-size:10px}.argus-map .macro-summary .map-status{white-space:nowrap;color:color-mix(in srgb, var(--state,#6b859f) 78%, rgb(var(--ink)));background:color-mix(in srgb, var(--state,#6b859f) 12%, transparent);text-overflow:ellipsis;border-radius:999px;min-width:0;margin-left:auto;padding:1.5px 7px;font-size:10px;line-height:1.5;display:block;overflow:hidden}.argus-map .macro-summary .map-status svg{vertical-align:-.14em;width:1.05em;height:1.05em;margin-right:.3em;display:inline-block}.argus-map .macro-summary .map-state-dot{vertical-align:.12em;width:.5em;height:.5em;margin-right:.4em;display:inline-block}.argus-map .macro-summary .map-card h3{letter-spacing:-.012em;color:rgb(var(--ink));-webkit-line-clamp:2;overflow-wrap:break-word;word-break:normal;-webkit-box-orient:vertical;flex-shrink:0;min-height:0;margin:0 0 7px;font-size:16px;font-weight:620;line-height:1.38;display:-webkit-box;overflow:hidden}.argus-map .macro-summary .map-card-objective,.argus-map .macro-summary .map-card>p.map-card-objective{color:rgb(var(--ink-faint));-webkit-line-clamp:2;flex-shrink:0;margin:0 0 8px;font-size:12px;line-height:1.55}.argus-map .macro-summary .map-card-conclusion{color:color-mix(in srgb, #3f8f68 72%, rgb(var(--ink)));-webkit-line-clamp:2;background:#3f8f6817;border-radius:6px;-webkit-box-orient:vertical;flex-shrink:0;margin:0 0 8px;padding:4px 8px;font-size:12px;line-height:1.5;display:-webkit-box;overflow:hidden}.argus-map .macro-summary .map-card-copy{-webkit-line-clamp:unset;min-height:0;color:rgb(var(--ink-dim));flex:1 1 0;margin:0 0 8px;font-size:12px;line-height:1.6;display:block;overflow:hidden;-webkit-mask-image:linear-gradient(#000 calc(100% - 2.4em),#0000);mask-image:linear-gradient(#000 calc(100% - 2.4em),#0000)}.argus-map .macro-summary .map-card-stages{flex-shrink:0;margin:auto 0 0;padding-top:4px}.argus-map .macro-summary .map-card-stages>span,.argus-map .macro-summary .map-card-bottom,.argus-map .macro-summary .map-card-submap-hint{font-size:10px}.argus-map .macro-summary .map-card-bottom{border-top:1px solid var(--map-card-line);color:rgb(var(--ink-faint));flex-shrink:0;align-items:center;gap:8px;margin-top:6px;padding:8px 0 0;display:flex}.argus-map .macro-summary .map-card-submap-hint svg{width:1.1em;height:1.1em}.argus-map .macro-summary .map-card-teambar{flex-shrink:0;margin:4px 0 0}.argus-map .macro-summary .map-history-toggle{font-size:10px}.argus-map .map-macro[data-has-history=true] .map-card{padding-bottom:30px}.argus-map .map-macro[data-has-history=true]:before{content:"";inset:calc(7 * var(--px)) calc(-7 * var(--px)) calc(-7 * var(--px)) calc(7 * var(--px));border:var(--px) solid var(--map-card-line);border-radius:calc(12 * var(--px));background:color-mix(in srgb, var(--map-paper) 88%, rgb(var(--line)));z-index:-1;pointer-events:none;position:absolute}.argus-map .macro-summary .map-status{max-width:64%}.argus-map.argus-map{--map-canvas:#f4f1ea;--map-paper:#fffdf8;--map-card-surface:#fffdf8;--map-dot:#4a423417;--map-minimap-mask:#f4f1eac7;--map-vignette:#3a322612;--ink-1:#1f2226;--ink-2:#3c4248;--ink-3:#6d737a;--ink-4:#a2a7ad;--pig-malachite:#4f7f68;--pig-indigo:#3b668c;--pig-vermilion:#b0463a;--pig-gamboge:#b38a34;--pig-ochre:#977650;--pig-lotus:#867a93;--map-serif:"New York", "Iowan Old Style", "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", Georgia, serif;--map-edge-context:var(--ink-2);--map-edge-continuation:var(--ink-2);--map-edge-dependency:var(--ink-1);--map-edge-semantic:var(--ink-4);--map-edge-replacement:var(--pig-ochre);--map-edge-fanout:var(--ink-3);--map-edge-fanin:var(--ink-3)}[data-theme=dark] .argus-map.argus-map{--map-canvas:#131518;--map-paper:#1c1f23;--map-card-surface:#1c1f23;--map-dot:#e2dccd0f;--map-minimap-mask:#131518bd;--map-vignette:#00000057;--ink-1:#eceae4;--ink-2:#c4c6c8;--ink-3:#8f959b;--ink-4:#5d636a;--pig-malachite:#74a88f;--pig-indigo:#6f9cc4;--pig-vermilion:#d07466;--pig-gamboge:#d1ab58;--pig-ochre:#b89873;--pig-lotus:#a99db8;--map-edge-context:var(--ink-2);--map-edge-continuation:var(--ink-2);--map-edge-dependency:var(--ink-1);--map-edge-semantic:var(--ink-4);--map-edge-replacement:var(--pig-ochre);--map-edge-fanout:var(--ink-3);--map-edge-fanin:var(--ink-3)}.argus-map .map-state-done{--state:var(--pig-malachite)}.argus-map .map-state-running{--state:var(--pig-indigo)}.argus-map .map-state-failed{--state:var(--pig-vermilion)}.argus-map .map-state-question{--state:var(--pig-gamboge)}.argus-map .map-state-paused,.argus-map .map-state-review_unavailable,.argus-map .map-state-held{--state:var(--pig-ochre)}.argus-map .map-state-superseded{--state:var(--pig-lotus)}.argus-map .map-state-recorded,.argus-map .map-state-aborted,.argus-map .map-state-skipped,.argus-map .map-state-missing{--state:var(--ink-4)}.argus-map .submap-kind-plan{--step-color:var(--pig-ochre)}.argus-map .submap-kind-execution{--step-color:var(--pig-indigo)}.argus-map .submap-kind-review{--step-color:var(--pig-lotus)}.argus-map .submap-kind-revision{--step-color:var(--pig-gamboge)}.argus-map .submap-kind-result{--step-color:var(--pig-malachite)}.argus-map .map-canvas-wrap:before{content:"";z-index:0;pointer-events:none;opacity:.5;background-image:url("data:image/svg+xml;utf8,");position:absolute;inset:0}[data-theme=dark] .argus-map .map-canvas-wrap:before{opacity:.4;background-image:url("data:image/svg+xml;utf8,")}.argus-map .map-ambient i:first-child{background:radial-gradient(64% 54% at 46% 54%,#343a421f,#343a4213 26%,#343a4208 52%,#343a4202 70%,#0000 82%);width:66%;height:78%;top:-30%;left:-14%}.argus-map .map-ambient i:nth-child(2){background:radial-gradient(62% 50% at 52% 46%,#3042541c,#30425412 26%,#30425407 54%,#30425402 72%,#0000 84%);width:70%;height:80%;bottom:-34%;right:-18%}.argus-map .map-ambient i:nth-child(3){background:radial-gradient(60% 48%,#785c3a11,#785c3a08 38%,#785c3a02 64%,#0000 80%);width:46%;height:50%;top:34%;left:30%}[data-theme=dark] .argus-map .map-ambient i:first-child{background:radial-gradient(64% 54% at 46% 54%,#bec6d013,#bec6d00b 26%,#bec6d004 52%,#bec6d001 70%,#0000 82%)}[data-theme=dark] .argus-map .map-ambient i:nth-child(2){background:radial-gradient(62% 50% at 52% 46%,#688eb218,#688eb20f 26%,#688eb205 54%,#688eb201 72%,#0000 84%)}[data-theme=dark] .argus-map .map-ambient i:nth-child(3){background:radial-gradient(60% 48%,#b08e600e,#b08e6007 38%,#b08e6002 64%,#0000 80%)}.argus-map .map-ambient:after{content:"";opacity:.55;background:url("data:image/svg+xml;utf8,") bottom/100% 100% no-repeat;height:34%;position:absolute;bottom:4%;left:0;right:0}[data-theme=dark] .argus-map .map-ambient:after{opacity:.8;background-image:url("data:image/svg+xml;utf8,")}.argus-map .react-flow__background{opacity:clamp(.2, calc(var(--z) * 1.8), .7)}.argus-map .map-macro{border-radius:calc(14 * var(--px));border-color:rgb(var(--ink) / .09);background:linear-gradient(180deg, color-mix(in srgb, var(--state,var(--ink-4)) 6%, var(--map-paper)) 0, var(--map-paper) 42%);box-shadow:0 0 0 calc(.5 * var(--px)) #fff9 inset, 0 calc(1 * var(--px)) calc(1.5 * var(--px)) #2822180d, 0 calc(10 * var(--px)) calc(30 * var(--px)) #28221814}[data-theme=dark] .argus-map .map-macro{box-shadow:0 0 0 calc(.5 * var(--px)) #ffffff0d inset, 0 calc(1 * var(--px)) calc(2 * var(--px)) #00000080, 0 calc(12 * var(--px)) calc(34 * var(--px)) #0000006b;border-color:#ffffff14}.argus-map .map-macro[data-hovered=true],.argus-map .map-macro:hover{border-color:color-mix(in srgb, var(--state,var(--ink-3)) 34%, rgb(var(--ink) / .1));box-shadow:0 0 0 calc(.5 * var(--px)) #fff9 inset, 0 calc(2 * var(--px)) calc(4 * var(--px)) #2822180f, 0 calc(18 * var(--px)) calc(46 * var(--px)) #28221824}.argus-map .map-macro[data-focused=true]{border-color:color-mix(in srgb, var(--ink-2) 55%, transparent);box-shadow:0 0 0 calc(3 * var(--px)) rgb(var(--ink) / .07), 0 calc(2 * var(--px)) calc(4 * var(--px)) #2822180f, 0 calc(22 * var(--px)) calc(56 * var(--px)) #28221829}.argus-map .map-macro:after{width:calc(3.5 * var(--px));top:calc(14 * var(--px));bottom:calc(14 * var(--px));border-radius:50% / calc(18 * var(--px));background:linear-gradient(180deg, transparent, var(--state,var(--ink-4)) 16%, var(--state,var(--ink-4)) 78%, transparent)}.argus-map .macro-summary .map-card h3,.argus-map .macro-heading h2{font-family:var(--map-serif);letter-spacing:-.006em;color:var(--ink-1);font-weight:600}.argus-map .macro-summary .map-card-number{color:var(--ink-3)}.argus-map .macro-summary .map-card-copy{color:var(--ink-2)}.argus-map .map-card-course{flex-wrap:wrap;flex-shrink:0;align-items:center;gap:6px;margin:auto 0 0;padding-top:6px;display:flex}.argus-map .map-card-course~.map-card-stages{margin-top:6px}.argus-map .map-card-course>span{color:var(--ink-4);box-shadow:inset 0 0 0 1px rgb(var(--ink) / .08);opacity:.75;background:0 0;border-radius:999px;align-items:center;gap:4px;padding:2.5px 7px;font-size:10px;line-height:1.4;display:inline-flex}.argus-map .map-card-course>span b{font-weight:520}.argus-map .map-card-course>span svg{width:1.05em;height:1.05em}.argus-map .map-card-course>span[data-present=true]{opacity:1;color:color-mix(in srgb, var(--step-color) 82%, var(--ink-1));background:color-mix(in srgb, var(--step-color) 11%, transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--step-color) 22%, transparent)}.argus-map .map-card-course>span[data-active=true]{box-shadow:inset 0 0 0 1.5px color-mix(in srgb, var(--step-color) 55%, transparent)}.argus-map .map-kicker{letter-spacing:.22em;color:var(--ink-3);margin-bottom:3px;font-size:10px;font-weight:600;display:block}.argus-map .map-heading h1{font-family:var(--map-serif);letter-spacing:-.012em;color:var(--ink-1);font-size:21px;font-weight:600}.argus-map .map-status-row{gap:12px}.argus-map .map-progress{flex:0 0 132px;gap:2px;height:4px;display:flex}.argus-map .map-progress i{background:var(--ink-4);border-radius:2px;flex-basis:0;min-width:3px;display:block}.argus-map .map-progress i[data-bucket=done]{background:var(--pig-malachite)}.argus-map .map-progress i[data-bucket=ended]{background:var(--ink-3)}.argus-map .map-progress i[data-bucket=running]{background:var(--pig-indigo)}.argus-map .map-progress i[data-bucket=question]{background:var(--pig-gamboge)}.argus-map .map-progress i[data-bucket=failed]{background:var(--pig-vermilion)}.argus-map .map-progress i[data-bucket=review_unavailable]{background:var(--pig-ochre)}.argus-map .map-progress i[data-bucket=held]{background:var(--pig-ochre);opacity:.6}.argus-map .map-final-review{color:var(--ink-2);background:var(--map-paper);border-bottom:1px solid rgb(var(--ink) / .08);flex-wrap:wrap;align-items:center;gap:6px 12px;padding:8px 24px;font-size:12px;display:flex}.argus-map .map-final-review strong{color:var(--pig-malachite)}.argus-map .map-final-review button{color:var(--pig-indigo);text-decoration:underline}.argus-map .map-canvas-toolbar button,.argus-map .map-canvas-toolbar label,.argus-map .map-legend,.argus-map .react-flow__controls,.argus-map .react-flow__minimap{background-color:color-mix(in srgb, var(--map-paper) 72%, transparent);-webkit-backdrop-filter:saturate(1.5)blur(18px);backdrop-filter:saturate(1.5)blur(18px);border-color:rgb(var(--ink) / .08)}.argus-map .map-canvas-wrap[data-moving=true] :is(.map-canvas-toolbar button,.map-canvas-toolbar label,.map-legend,.react-flow__controls,.react-flow__minimap){background-color:color-mix(in srgb, var(--map-paper) 94%, transparent);-webkit-backdrop-filter:none;backdrop-filter:none}.argus-map .map-legend b.order{border-top-color:var(--map-edge-context);opacity:.7;border-top-width:1.5px}.argus-map .map-legend b:not(.dashed):not(.replacement):not(.order){border-top-color:var(--map-edge-dependency);border-top-width:2.5px}.argus-map .map-delivery-toggle:not(:disabled){color:var(--pig-indigo);border-color:color-mix(in srgb, var(--pig-indigo) 28%, transparent)}.argus-map .map-delivery-toggle:not(:disabled) b{color:var(--pig-indigo);background:color-mix(in srgb, var(--pig-indigo) 14%, transparent)}.argus-map .react-flow__minimap{border-radius:12px;overflow:hidden}.argus-map .map-branch{background:color-mix(in srgb, var(--state) 9%, var(--map-paper));border:2px solid color-mix(in srgb, var(--state) 26%, rgb(var(--ink) / .1));border-left:12px solid var(--state);border-radius:calc(14 * var(--px));box-shadow:0 calc(1 * var(--px)) calc(1.5 * var(--px)) #2822180d, 0 calc(8 * var(--px)) calc(24 * var(--px)) #28221812}.argus-map .map-branch.map-state-done{--state:var(--pig-malachite)}.argus-map .map-branch.map-state-running{--state:var(--pig-indigo)}.argus-map .map-branch.map-state-failed{--state:var(--pig-vermilion)}.argus-map .map-branch.map-state-question{--state:var(--pig-gamboge)}.argus-map .map-branch.map-state-paused{--state:var(--pig-ochre)}.argus-map .map-branch.map-state-superseded{--state:var(--pig-lotus)}.argus-map .map-branch-title{font-family:var(--map-serif);color:var(--ink-1);font-weight:600}.argus-map .map-relation-label{font-family:var(--map-serif);letter-spacing:0;color:var(--ink-1);background:color-mix(in srgb, var(--map-paper) 92%, transparent);box-shadow:inset 0 0 0 1px rgb(var(--ink) / .1), 0 1px 2px #2822180f;border-radius:999px;padding:3px 8px;font-size:11px;font-weight:560;line-height:16px}.argus-map .map-relation-label[data-kind=context][data-quiet=true]{letter-spacing:.04em;color:var(--ink-3);background:color-mix(in srgb, var(--map-canvas) 86%, transparent);box-shadow:none;padding:1px 6px;font-family:inherit;font-size:10.5px;font-weight:500}.argus-map .map-relation-label[data-kind=replacement]{color:color-mix(in srgb, var(--pig-ochre) 80%, var(--ink-1))}.argus-map .map-relation-label[data-lit=true]{color:var(--ink-1);box-shadow:inset 0 0 0 1px rgb(var(--ink) / .22), 0 2px 6px #2822181a}.argus-map{--map-edge-dependency:#3f74a6;--map-edge-continuation:#527fa7;--map-edge-semantic:#8b95a0;--map-edge-context:#6f8ca8;--map-edge-replacement:#af8149;--map-edge-fanout:#6a9ab8;--map-edge-fanin:#6a9ab8}[data-theme=dark] .argus-map{--map-edge-dependency:#7ea9cd;--map-edge-continuation:#7ea9cd;--map-edge-semantic:#939ea9;--map-edge-context:#7d97b0;--map-edge-replacement:#c79e63;--map-edge-fanout:#7fb0cd;--map-edge-fanin:#7fb0cd}.argus-map .map-legend b{border-top-color:var(--map-edge-dependency)}.argus-map .map-legend .dashed{border-top-color:var(--map-edge-semantic)}.argus-map .map-legend .replacement{border-top-color:var(--map-edge-replacement)}.argus-map .map-relation-label{--edge-hue:var(--map-edge-semantic);text-overflow:ellipsis;letter-spacing:.035em;max-width:200px;box-shadow:none;pointer-events:auto;color:color-mix(in srgb, var(--edge-hue) 62%, rgb(var(--ink)));background:color-mix(in srgb, var(--edge-hue) 13%, var(--map-paper));border:0;border-radius:4px;padding:3px 8px;font-size:11px;font-weight:560;line-height:15px;overflow:hidden}.argus-map .map-relation-label[data-kind=dependency]{--edge-hue:var(--map-edge-dependency)}.argus-map .map-relation-label[data-kind=continuation]{--edge-hue:var(--map-edge-continuation)}.argus-map .map-relation-label[data-kind=context]{--edge-hue:var(--map-edge-context)}.argus-map .map-relation-label[data-kind=replacement]{--edge-hue:var(--map-edge-replacement)}[data-theme=dark] .argus-map .map-relation-label{color:color-mix(in srgb, var(--edge-hue) 66%, rgb(var(--ink)));background:color-mix(in srgb, var(--edge-hue) 16%, var(--map-paper))}.argus-map .map-edge-joint{pointer-events:none} diff --git a/frontend/web/dist/assets/MapPanel-RwxFeqjp.js b/frontend/web/dist/assets/MapPanel-RwxFeqjp.js new file mode 100644 index 000000000..b6511ba6b --- /dev/null +++ b/frontend/web/dist/assets/MapPanel-RwxFeqjp.js @@ -0,0 +1,7 @@ +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{D as n,E as r}from"./icons-DRlFT_ri.js";import{a as i,b as a,c as o,i as s}from"./query-CUzIxVzm.js";import{A as c,G as l,J as u,P as d,W as f,k as p}from"./index-W1lBlVkr.js";import{A as m,F as h,I as g,L as _,O as v,R as y,j as b,m as x,p as S,r as C}from"./AppearanceControls-BFWF0z-J.js";import{n as w,t as T}from"./history-BtuT-8i3.js";import{n as E,t as D}from"./play-CwpVgDoP.js";import{a as O}from"./format-1SN2SmDZ.js";import{a as k,i as A,n as j}from"./useWorkbenchTheme-D7cPkLzc.js";import{$ as M,A as N,At as P,B as F,C as I,Ct as L,D as R,Dt as z,E as B,Et as ee,F as te,G as V,H,I as U,J as ne,K as re,L as ie,M as ae,Mt as oe,N as se,Nt as W,O as ce,Ot as le,P as ue,Q as de,R as fe,S as pe,St as me,T as G,U as he,V as ge,X as _e,Y as ve,Z as ye,a as be,at as xe,b as Se,bt as Ce,c as we,ct as K,d as Te,dt as Ee,et as De,f as Oe,ft as ke,gt as Ae,ht as je,i as Me,it as Ne,j as Pe,k as Fe,kt as Ie,l as Le,lt as Re,n as ze,nt as Be,o as Ve,ot as He,p as q,pt as Ue,q as We,rt as Ge,s as Ke,st as qe,tt as Je,u as Ye,ut as Xe,vt as Ze,w as Qe,wt as $e,x as et,xt as tt,yt as nt,z as rt}from"./App-DaQfrTdA.js";var it=y(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),at=y(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),ot=y(`CornerDownLeft`,[[`polyline`,{points:`9 10 4 15 9 20`,key:`r3jprv`}],[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}]]),st=y(`ListChecks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),ct=y(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),lt=y(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ut=y(`Route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),dt=y(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),J=r();function ft({events:e,connected:t,pending:n,artifacts:r,zh:i,onClose:a,onOpenArtifact:o,onOpenDelivery:s}){let l=e.filter(e=>e.type===`ui.operator`||e.type===`ui.argus`);return(0,J.jsxs)(`aside`,{className:`map-conversation nowheel nodrag nopan`,"aria-label":i?`地图对话`:`Map conversation`,children:[(0,J.jsxs)(`header`,{children:[(0,J.jsx)(L,{size:16}),(0,J.jsx)(`strong`,{children:i?`与 ${c().name} 对话`:`Talk to ${c().name}`}),(0,J.jsx)(`button`,{type:`button`,onClick:a,"aria-label":i?`关闭对话`:`Close conversation`,children:(0,J.jsx)(v,{size:18})})]}),l.length?(0,J.jsx)(q,{events:l,connected:t,showReasoning:!1,onToggleReasoning:()=>{},embedded:!0,showHeader:!1,artifacts:r,onOpenArtifact:o,onOpenDelivery:s}):(0,J.jsx)(`p`,{className:`map-conversation-empty`,children:i?`在下方发送目标或问题,回复会保留在这里。`:`Send a goal or question below. Your conversation stays here.`}),n&&!l.some(e=>e.type===`ui.argus`&&e.live===!0)&&(0,J.jsx)(`p`,{className:`map-conversation-pending`,role:`status`,children:i?`${c().name} 正在回复…`:`${c().name} is replying…`})]})}var Y=e(n(),1),pt=u(),mt=(e,t,n)=>e+(t-e)*n,ht=e=>e*e*(3-2*e),gt=(e,t,n)=>Math.max(t,Math.min(n,e));function _t(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y),i=Math.min(140,Math.max(54,r*.22))*(t.x>=e.x?-1:1),a=Math.min(120,r*.3),o={x:gt(e.x+i,28,n-28),y:e.y-a},s={x:gt(t.x+i*.6,28,n-28),y:t.y+a};return n=>{let r=1-n;return{x:r**3*e.x+3*r**2*n*o.x+3*r*n**2*s.x+n**3*t.x,y:r**3*e.y+3*r**2*n*o.y+3*r*n**2*s.y+n**3*t.y}}}function vt({flight:e,canvas:t,zh:n,historical:r=!1,onReveal:i,onLand:a,onFinish:o}){let s=(0,Y.useRef)(null),c=(0,Y.useRef)(null),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=`dispatch-wake-${(0,Y.useId)().replace(/:/g,``)}`,f=(0,Y.useRef)({onReveal:i,onLand:a,onFinish:o});f.current={onReveal:i,onLand:a,onFinish:o};let p=e.result?.type===`task`&&!r;return(0,Y.useEffect)(()=>{if(!e.result)return;let n=0,i,a,o=()=>f.current.onFinish(e.id);if(e.result.type!==`task`||r)return i=setTimeout(o,2200),()=>clearTimeout(i);let d=s.current;if(!d)return;let p=e.result.taskId,m=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,h=t.current,g=()=>{cancelAnimationFrame(n),clearTimeout(i),f.current.onLand(e.id),o()};h?.addEventListener(`pointerdown`,g,{once:!0}),h?.addEventListener(`wheel`,g,{once:!0,passive:!0});let _=performance.now(),v=0,y=!1,b=0,x,S=r=>{if(r-_>6e3){o();return}let s=t.current?.querySelector(`.map-macro[data-task-id="${CSS.escape(p)}"]`);if(!s||s.getBoundingClientRect().width<8){r-v>600&&(f.current.onReveal(p),v=r),n=requestAnimationFrame(S);return}if(m){f.current.onLand(e.id),i=setTimeout(o,1200);return}y||(f.current.onReveal(p),y=!0,v=r);let h=s.getBoundingClientRect();if((!x||Math.abs(x.x-h.x)+Math.abs(x.y-h.y)+Math.abs(x.width-h.width)>.7)&&(b=r),x=h,r-v<360||r-b<100){n=requestAnimationFrame(S);return}let g=t.current?.querySelector(`.map-composer`)?.getBoundingClientRect(),C=g?{x:g.left,y:g.top,width:g.width,height:g.height}:e.origin,w={x:C.x+C.width/2,y:C.y+C.height/2},T={x:w.x,y:w.y-26},E={x:h.left+h.width/2,y:h.top+h.height/2},D=_t(T,E,innerWidth),O=Math.min(320,C.width),k=Math.min(68,C.height),A=performance.now(),j=!1,M=t=>{if(!s.isConnected){o();return}let r=Math.min(1,(t-A)/1050),p=ht(Math.min(1,r/.22)),m=ht(gt((r-.22)/.6,0,1)),h=ht(gt((r-.82)/.18,0,1)),g=r<.22?{x:w.x,y:mt(w.y,T.y,p)}:D(m),_=mt(52,22,h),v=mt(O,_,p),y=mt(k,_,p);if(d.style.width=`${v}px`,d.style.height=`${y}px`,d.style.transform=`translate3d(${g.x-v/2}px,${g.y-y/2}px,0)`,d.style.opacity=String(Math.min(1,r/.045)*(1-h)),d.style.setProperty(`--dispatch-copy`,String(1-ht(Math.min(1,r/.12)))),d.style.setProperty(`--dispatch-mark`,String(mt(1,.7,h))),d.dataset.phase=r<.22?`compress`:r<.82?`travel`:`arrive`,c.current&&l.current&&r>.22){let e=Math.max(0,m-.16),t=Array.from({length:13},(t,n)=>D(mt(e,m,n/12)));c.current.setAttribute(`d`,t.map((e,t)=>`${t?`L`:`M`} ${e.x} ${e.y}`).join(` `)),c.current.style.opacity=String(.7*(1-h)),l.current.setAttribute(`x1`,String(t[0].x)),l.current.setAttribute(`y1`,String(t[0].y)),l.current.setAttribute(`x2`,String(g.x)),l.current.setAttribute(`y2`,String(g.y))}r>=.82&&!j&&(j=!0,f.current.onLand(e.id),u.current&&(u.current.style.left=`${E.x}px`,u.current.style.top=`${E.y}px`,a=u.current.animate([{transform:`translate(-50%,-50%) scale(.65)`,opacity:.65},{transform:`translate(-50%,-50%) scale(2.8)`,opacity:0}],{duration:650,easing:`cubic-bezier(.16,1,.3,1)`,fill:`both`}))),r<1?n=requestAnimationFrame(M):i=setTimeout(o,550)};n=requestAnimationFrame(M)};return n=requestAnimationFrame(S),()=>{cancelAnimationFrame(n),clearTimeout(i),a?.cancel(),h?.removeEventListener(`pointerdown`,g),h?.removeEventListener(`wheel`,g)}},[e.id,e.result,t,r]),p?(0,pt.createPortal)((0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`svg`,{className:`map-dispatch-trail`,"aria-hidden":`true`,children:[(0,J.jsx)(`defs`,{children:(0,J.jsxs)(`linearGradient`,{ref:l,id:d,gradientUnits:`userSpaceOnUse`,children:[(0,J.jsx)(`stop`,{stopColor:`#6fbcce`,stopOpacity:`0`}),(0,J.jsx)(`stop`,{offset:`1`,stopColor:`#87d9cf`})]})}),(0,J.jsx)(`path`,{ref:c,fill:`none`,stroke:`url(#${d})`,strokeWidth:`2.5`,strokeLinecap:`round`})]}),(0,J.jsxs)(`div`,{ref:s,className:`map-dispatch-flight`,"data-testid":`map-dispatch-flight`,"data-state":`task`,"data-task-id":e.result?.type===`task`?e.result.taskId:void 0,"aria-hidden":`true`,children:[(0,J.jsx)(`div`,{className:`map-dispatch-symbol`,children:(0,J.jsx)(j,{size:25})}),(0,J.jsxs)(`div`,{className:`map-dispatch-copy`,children:[(0,J.jsx)(`strong`,{children:e.text}),(0,J.jsx)(`span`,{children:n?`进入任务地图`:`Into your task map`})]})]}),(0,J.jsx)(`div`,{ref:u,className:`map-dispatch-halo`,"aria-hidden":`true`})]}),document.body):null}var yt=()=>({revision:0,cards:{},steps:{},links:{}}),bt=(e,t)=>`${e}\u0000${t}`,xt=class{initialized=!1;seen=new Set;revision=0;loadingHistory=!1;observe(e,t=!1){let n=yt(),r=0;for(let t of e.cards){this.seen.has(`card:${t.id}`)||(n.cards[t.id]=Math.min(r++*100,400)),this.seen.add(`card:${t.id}`);let i=e.layouts[t.id],a=0;for(let e of i.steps){let r=bt(t.id,e.id);this.seen.has(`step:${r}`)||(n.steps[r]=160+Math.min(a++*120,720)),this.seen.add(`step:${r}`)}for(let e of i.links){let r=bt(t.id,e.id);this.seen.has(`link:${r}`)||(n.links[r]=Math.max(0,(n.steps[bt(t.id,e.target)]??160)-160)),this.seen.add(`link:${r}`)}}for(let t of e.links)this.seen.has(`outer:${t.id}`)||(n.links[t.id]=0),this.seen.add(`outer:${t.id}`);let i=!this.initialized||t||this.loadingHistory;return this.loadingHistory=t,this.initialized=!0,i||![n.cards,n.steps,n.links].some(e=>Object.keys(e).length)?null:{...n,revision:++this.revision}}};function St(e,t=!1){let n=(0,Y.useRef)(new xt),r=(0,Y.useRef)(new Set),[i,a]=(0,Y.useState)(yt);return(0,Y.useEffect)(()=>{let i=n.current.observe(e,t);if(t)r.current.forEach(clearTimeout),r.current.clear(),a(yt());else if(i){a(e=>({revision:i.revision,cards:{...e.cards,...i.cards},steps:{...e.steps,...i.steps},links:{...e.links,...i.links}}));let e=setTimeout(()=>{r.current.delete(e),a(e=>({revision:e.revision,cards:Object.fromEntries(Object.entries(e.cards).filter(([e])=>!(e in i.cards))),steps:Object.fromEntries(Object.entries(e.steps).filter(([e])=>!(e in i.steps))),links:Object.fromEntries(Object.entries(e.links).filter(([e])=>!(e in i.links)))}))},2e3);r.current.add(e)}},[e,t]),(0,Y.useEffect)(()=>()=>{r.current.forEach(clearTimeout),r.current.clear()},[]),i}var Ct=e=>1-(1-e)**3;function wt(e,t,n){let r=Ct(Math.min(1,Math.max(0,n))),i={};for(let n in t){let a=e[n],o=t[n];i[n]=!a||r>=1?o:{x:a.x+(o.x-a.x)*r,y:a.y+(o.y-a.y)*r}}return i}function Tt(e,t){for(let n in t){let r=e[n];if(r&&(r.x!==t[n].x||r.y!==t[n].y))return!0}return!1}function Et(e,t,n=680){let[r,i]=(0,Y.useState)(e),a=(0,Y.useRef)(e),o=(0,Y.useRef)(e);return(0,Y.useEffect)(()=>{if(e===o.current)return;o.current=e;let r=a.current;if(t||!Tt(r,e)||typeof requestAnimationFrame!=`function`){a.current=e,i(e);return}let s=null,c=performance.now(),l=t=>{let o=(t-c)/n;if(o>=1){a.current=e,i(e),s=null;return}a.current=wt(r,e,o),i(a.current),s=requestAnimationFrame(l)};return s=requestAnimationFrame(l),()=>{s!=null&&cancelAnimationFrame(s)}},[e,t,n]),r}var Dt={edges:new Set,nodes:new Set};function Ot(e,t){if(!t)return Dt;let n=new Set,r=new Set([t]);for(let i of e)(i.source===t||i.target===t)&&(n.add(i.id),r.add(i.source),r.add(i.target));return{edges:n,nodes:r}}var kt=2600,At=e=>Math.min(Math.max(e-1,0),10)*80,jt=e=>At(e)+320;function Mt(e,t){let n=Math.max(0,Math.floor(e));if(n<60)return t?`${n} 秒`:`${n}s`;let r=Math.floor(n/60);if(r<60)return t?`${r} 分钟`:`${r} min`;let i=Math.floor(r/60),a=r%60;return t?`${i} 小时 ${a} 分`:`${i} h ${String(a).padStart(2,`0`)} min`}function X(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n{}};function Pt(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Ft.prototype=Pt.prototype={constructor:Ft,on:function(e,t){var n=this._,r=It(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Rt.hasOwnProperty(t)?{space:Rt[t],local:e}:e}function Bt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Vt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ht(e){var t=zt(e);return(t.local?Vt:Bt)(t)}function Ut(){}function Wt(e){return e==null?Ut:function(){return this.querySelector(e)}}function Gt(e){typeof e!=`function`&&(e=Wt(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i=v&&(v=_+1);!(b=g[v])&&++v=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Sn(e){e||=Cn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;at?1:e>=t?0:NaN}function wn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Tn(){return Array.from(this)}function En(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Rn:typeof t==`function`?Bn:zn)(e,t,n??``)):Hn(this.node(),e)}function Hn(e,t){return e.style.getPropertyValue(t)||Ln(e).getComputedStyle(e,null).getPropertyValue(t)}function Un(e){return function(){delete this[e]}}function Wn(e,t){return function(){this[e]=t}}function Gn(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Kn(e,t){return arguments.length>1?this.each((t==null?Un:typeof t==`function`?Gn:Wn)(e,t)):this.node()[e]}function qn(e){return e.trim().split(/^|\s+/)}function Jn(e){return e.classList||new Yn(e)}function Yn(e){this._node=e,this._names=qn(e.getAttribute(`class`)||``)}Yn.prototype={add:function(e){this._names.indexOf(e)<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 Xn(e,t){for(var n=Jn(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Tr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n()=>e;function qr(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){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:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}qr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Jr(e){return!e.ctrlKey&&!e.button}function Yr(){return this.parentNode}function Xr(e,t){return t??{x:e.x,y:e.y}}function Zr(){return navigator.maxTouchPoints||`ontouchstart`in this}function Qr(){var e=Jr,t=Yr,n=Xr,r=Zr,i={},a=Pt(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,Br).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(Lr(n.view).on(`mousemove.drag`,m,Vr).on(`mouseup.drag`,h,Vr),Wr(n.view),Hr(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(Ur(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){Lr(e.view).on(`mousemove.drag mouseup.drag`,null),Gr(e.view,l),Ur(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?xi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?xi(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=ci.exec(e))?new wi(t[1],t[2],t[3],1):(t=li.exec(e))?new wi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ui.exec(e))?xi(t[1],t[2],t[3],t[4]):(t=di.exec(e))?xi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=fi.exec(e))?ji(t[1],t[2]/100,t[3]/100,1):(t=pi.exec(e))?ji(t[1],t[2]/100,t[3]/100,t[4]):mi.hasOwnProperty(e)?bi(mi[e]):e===`transparent`?new wi(NaN,NaN,NaN,0):null}function bi(e){return new wi(e>>16&255,e>>8&255,e&255,1)}function xi(e,t,n,r){return r<=0&&(e=t=n=NaN),new wi(e,t,n,r)}function Si(e){return e instanceof ti||(e=yi(e)),e?(e=e.rgb(),new wi(e.r,e.g,e.b,e.opacity)):new wi}function Ci(e,t,n,r){return arguments.length===1?Si(e):new wi(e,t,n,r??1)}function wi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}$r(wi,Ci,ei(ti,{brighter(e){return e=e==null?ri:ri**+e,new wi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ni:ni**+e,new wi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wi(ki(this.r),ki(this.g),ki(this.b),Oi(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:Ti,formatHex:Ti,formatHex8:Ei,formatRgb:Di,toString:Di}));function Ti(){return`#${Ai(this.r)}${Ai(this.g)}${Ai(this.b)}`}function Ei(){return`#${Ai(this.r)}${Ai(this.g)}${Ai(this.b)}${Ai((isNaN(this.opacity)?1:this.opacity)*255)}`}function Di(){let e=Oi(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ki(this.r)}, ${ki(this.g)}, ${ki(this.b)}${e===1?`)`:`, ${e})`}`}function Oi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ki(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ai(e){return e=ki(e),(e<16?`0`:``)+e.toString(16)}function ji(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Pi(e,t,n,r)}function Mi(e){if(e instanceof Pi)return new Pi(e.h,e.s,e.l,e.opacity);if(e instanceof ti||(e=yi(e)),!e)return new Pi;if(e instanceof Pi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Pi(o,s,c,e.opacity)}function Ni(e,t,n,r){return arguments.length===1?Mi(e):new Pi(e,t,n,r??1)}function Pi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}$r(Pi,Ni,ei(ti,{brighter(e){return e=e==null?ri:ri**+e,new Pi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ni:ni**+e,new Pi(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,i=2*n-r;return new wi(Li(e>=240?e-240:e+120,i,r),Li(e,i,r),Li(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pi(Fi(this.h),Ii(this.s),Ii(this.l),Oi(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(){let e=Oi(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Fi(this.h)}, ${Ii(this.s)*100}%, ${Ii(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Fi(e){return e=(e||0)%360,e<0?e+360:e}function Ii(e){return Math.max(0,Math.min(1,e||0))}function Li(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Ri=e=>()=>e;function zi(e,t){return function(n){return e+n*t}}function Bi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Vi(e){return(e=+e)==1?Hi:function(t,n){return n-t?Bi(t,n,e):Ri(isNaN(t)?n:t)}}function Hi(e,t){var n=t-e;return n?zi(e,n):Ri(isNaN(e)?t:e)}var Ui=(function e(t){var n=Vi(t);function r(e,t){var r=n((e=Ci(e)).r,(t=Ci(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Hi(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Wi(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Ji(r,i)})),n=Zi.lastIndex;return n180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Ji(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Ji(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Ji(e,n)},{i:s-2,x:Ji(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t=0&&e._call.call(void 0,t),e=e._next;--ga}function Ma(){Ca=(Sa=Ta.now())+wa,ga=_a=0;try{ja()}finally{ga=0,Pa(),Ca=0}}function Na(){var e=Ta.now(),t=e-Sa;t>ya&&(wa-=t,Sa=e)}function Pa(){for(var e,t=ba,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:ba=n);xa=e,Fa(r)}function Fa(e){ga||(_a&&=clearTimeout(_a),e-Ca>24?(e<1/0&&(_a=setTimeout(Ma,e-Ta.now()-wa)),va&&=clearInterval(va)):(va||=(Sa=Ta.now(),setInterval(Na,ya)),ga=1,Ea(Ma)))}function Ia(e,t,n){var r=new ka;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var La=Pt(`start`,`end`,`cancel`,`interrupt`),Ra=[];function za(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Ua(e,n,{name:t,index:r,group:i,on:La,tween:Ra,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Ba(e,t){var n=Ha(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function Va(e,t){var n=Ha(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function Ha(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Ua(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Aa(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Ia(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Ga(e){return this.each(function(){Wa(this,e)})}function Ka(e,t){var n,r;return function(){var i=Va(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o=0&&(e=e.slice(0,t)),!e||e===`start`})}function Co(e,t,n){var r,i,a=So(t)?Ba:Va;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function wo(e,t){var n=this._id;return arguments.length<2?Ha(this.node(),n).on.on(e):this.each(Co(n,e,t))}function To(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Eo(){return this.on(`end.remove`,To(this._id))}function Do(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Wt(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o()=>e;function rs(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function is(e,t,n){this.k=e,this.x=t,this.y=n}is.prototype={constructor:is,scale:function(e){return e===1?this:new is(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new is(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 as=new is(1,0,0);os.prototype=is.prototype;function os(e){for(;!e.__zoom;)if(!(e=e.parentNode))return as;return e.__zoom}function ss(e){e.stopImmediatePropagation()}function cs(e){e.preventDefault(),e.stopImmediatePropagation()}function ls(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function us(){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 ds(){return this.__zoom||as}function fs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ps(){return navigator.maxTouchPoints||`ontouchstart`in this}function ms(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function hs(){var e=ls,t=us,n=ms,r=fs,i=ps,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ha,l=Pt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,ds).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,ds),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(as.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new is(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new is(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new is(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Lr(this.that).datum();l.call(e,this.that,new rs(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=zr(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Wa(this),s.start();cs(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Lr(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=zr(t,i),l=t.clientX,u=t.clientY;Wr(t.view),ss(t),a.mouse=[c,this.__zoom.invert(c)],Wa(this),a.start();function d(e){if(cs(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=zr(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Gr(e.view,a.moved),cs(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=zr(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);cs(r),s>0?Lr(this).transition().duration(s).call(x,d,c,r):Lr(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(ss(t),s=0;s`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} 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.`},_s=[[-1/0,-1/0],[1/0,1/0]],vs=[`Enter`,` `,`Escape`],ys={"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`},bs;(function(e){e.Strict=`strict`,e.Loose=`loose`})(bs||={});var xs;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(xs||={});var Ss;(function(e){e.Partial=`partial`,e.Full=`full`})(Ss||={});var Cs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ws;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(ws||={});var Ts;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Ts||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var Es={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function Ds(e){return e===null?null:e?`valid`:`invalid`}var Os=e=>`id`in e&&`source`in e&&`target`in e,ks=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),As=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),js=(e,t=[0,0])=>{let{width:n,height:r}=dc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ms=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:qs(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):As(n)?n:t.nodeLookup.get(n.id)),Gs(e,i?Ys(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Ns=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=Gs(n,Ys(e)),r=!0)}),r?qs(n):{x:0,y:0,width:0,height:0}},Ps=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=Zs(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Fs=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Is(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function Ls({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=cc(Ns(Is(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function Rs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,gs.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&uc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=uc(d)?Vs(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,gs.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function zs({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Fs(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var Bs=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Vs=(e={x:0,y:0},t,n)=>({x:Bs(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Bs(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hs(e,t,n){let{width:r,height:i}=dc(n),{x:a,y:o}=n.internals.positionAbsolute;return Vs(e,[[a,o],[a+r,o+i]],t)}var Us=(e,t,n)=>en?-Bs(Math.abs(e-n),1,t)/t:0,Ws=(e,t,n=15,r=40)=>[Us(e.x,r,t.width-r)*n,Us(e.y,r,t.height-r)*n],Gs=(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)}),Ks=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),qs=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Js=(e,t=[0,0])=>{let{x:n,y:r}=As(e)?e.internals.positionAbsolute:js(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ys=(e,t=[0,0])=>{let{x:n,y:r}=As(e)?e.internals.positionAbsolute:js(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Xs=(e,t)=>qs(Gs(Ks(e),Ks(t))),Zs=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},Qs=(e,t)=>Zs(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),$s=e=>ec(e.width)&&ec(e.height)&&ec(e.x)&&ec(e.y),ec=e=>!isNaN(e)&&isFinite(e),tc=(e,t)=>(e,t)=>{},nc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),rc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?nc(s,o):s},ic=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ac(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let 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 oc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=ac(e,n),i=ac(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=ac(e.top??e.y??0,n),i=ac(e.bottom??e.y??0,n),a=ac(e.left??e.x??0,t),o=ac(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function sc(e,t,n,r,i,a){let{x:o,y:s}=ic(e,[t,n,r]),{x:c,y:l}=ic({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var cc=(e,t,n,r,i,a)=>{let o=oc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=Bs(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=sc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},lc=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function uc(e){return e!=null&&e!==`parent`}function dc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function fc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function pc(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function mc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function hc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function gc(e){return{...ys,...e||{}}}function _c(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Cc(e),s=rc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?nc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var vc=e=>({width:e.offsetWidth,height:e.offsetHeight}),yc=e=>e?.getRootNode?.()||window?.document,bc=[`INPUT`,`SELECT`,`TEXTAREA`];function xc(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?bc.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Sc=e=>`clientX`in e,Cc=(e,t)=>{let n=Sc(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},wc=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...vc(t)}})};function Tc({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Ec(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Dc({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Ec(t-r,a),n];case Q.Right:return[t+Ec(r-t,a),n];case Q.Top:return[t,n-Ec(n-i,a)];case Q.Bottom:return[t,n+Ec(i-n,a)]}}function Oc({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Dc({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Dc({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Tc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function kc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n0}var Mc=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Nc=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Pc=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,gs.error006()),t;let r=n.getEdgeId||Mc,i;return i=Os(e)?{...e}:{...e,id:r(e)},Nc(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Fc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=kc({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Ic={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},Lc=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.xMath.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function zc({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=Ic[t],c=Ic[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Lc({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=kc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function Bc(e,t,n,r){let i=Math.min(Rc(e,t)/2,Rc(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.xe.id===t):e[0])||null}function qc(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Jc(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=qc(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var Yc=1e3,Xc=10,Zc={nodeOrigin:[0,0],nodeExtent:_s,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Qc={...Zc,checkEquality:!0};function $c(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function el(e,t,n){let r=$c(Zc,n);for(let n of e.values())if(n.parentId)al(n,e,t,r);else{let e=Vs(js(n,r.nodeOrigin),uc(n.extent)?n.extent:r.nodeExtent,dc(n));n.internals.positionAbsolute=e}}function tl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function nl(e){return e===`manual`}function rl(e,t,n,r={}){let i=$c(Qc,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!nl(i.zIndexMode)?Yc:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=Vs(js(u,i.nodeOrigin),uc(u.extent)?u.extent:i.nodeExtent,dc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:tl(u,e),z:ol(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&al(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function il(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function al(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=$c(Zc,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}il(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*Xc),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=sl(e,u,o,s,a&&!nl(c)?Yc:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function ol(e,t,n){let r=ec(e.zIndex)?e.zIndex:0;return nl(n)?r:r+(e.selected?t:0)}function sl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=dc(e),l=js(e,n),u=uc(e.extent)?Vs(l,e.extent,c):l,d=Vs({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=Hs(d,c,t));let f=ol(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function cl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=Xs(a.get(n.parentId)?.expandedRect??Js(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=dc(a),l=a.origin??r,u=t.x0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width0){let e=cl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function ul({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function dl(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function fl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;dl(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),dl(`target`,s,c,e,i,o),t.set(r.id,r)}}function pl(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:pl(n,t):!1}function ml(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function hl(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!pl(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function gl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function _l({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=nc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function vl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=Lr(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?Ks(Ns(s)):null,x=v&&l?_l({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:nc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=Rs({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=gl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Ws(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=_c(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=hl(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=gl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Qr().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=_c(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Cc(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=_c(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Cc(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Cc(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=gl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!ml(t,`.${g}`,v))&&(!_||ml(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function yl(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())Qs(i,Js(e))>0&&r.push(e);return r}var bl=250;function xl(e,t,n,r){let i=[],a=1/0,o=yl(e,n,t+bl);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Gc(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function Sl(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Gc(o,c,c.position,!0)}:c}function Cl(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function wl(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Tl=()=>!0;function El(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Tl,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=yc(e.target),E=0,D,{x:O,y:k}=Cc(e),A=Cl(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=Sl(i,A,r,c,t);if(!N)return;let P=Cc(e,j),F=!1,I=null,L=!1,R=null;function z(){if(!u||!j)return;let[e,t]=Ws(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(z)}let B={...N,nodeId:i,type:A,position:N.position},ee=c.get(i),te={inProgress:!0,isValid:null,from:Gc(ee,B,Q.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:ee,to:P,toHandle:null,toPosition:Es[B.position],toNode:null,pointer:P};function V(){M=!0,y(te),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&V();function H(e){if(!M){let{x:t,y:n}=Cc(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;V()}if(!x()||!B){U(e);return}let a=b();P=Cc(e,j),D=xl(rc(P,a,!1,[1,1]),n,c,B),F||=(z(),!0);let s=Dl(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=wl(!!D,s.isValid);let u=c.get(i),f=u?Gc(u,B,Q.Left,!0):te.from,p={...te,from:f,isValid:L,to:s.toHandle&&L?ic({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:Es[B.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),te=p}function U(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=te,r={...n,toPosition:te.toHandle?te.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,H),T.removeEventListener(`mouseup`,U),T.removeEventListener(`touchmove`,H),T.removeEventListener(`touchend`,U)}}T.addEventListener(`mousemove`,H),T.addEventListener(`mouseup`,U),T.addEventListener(`touchmove`,H),T.addEventListener(`touchend`,U)}function Dl(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Tl,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Cc(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=Cl(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===bs.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=Sl(t,e,a,u,n,!0)}return _}var Ol={onPointerDown:El,isValid:Dl};function kl({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Lr(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&lc()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=hs().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:zr}}var Al=e=>({x:e.x,y:e.y,zoom:e.k}),jl=({x:e,y:t,zoom:n})=>as.translate(e,t).scale(n),Ml=(e,t)=>e.target.closest(`.${t}`),Nl=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Pl=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Fl=(e,t=0,n=Pl,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Il=e=>{let t=e.ctrlKey&&lc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ll({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Ml(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=zr(u),t=d*2**Il(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===xs.Vertical?0:u.deltaX*f,m=i===xs.Horizontal?0:u.deltaY*f;!lc()&&u.shiftKey&&i!==xs.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=Al(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function Rl({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=Ml(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function zl({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Al(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function Bl({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Nl(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,Al(a.transform))}}function Vl({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Nl(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=Al(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Hl({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(Ml(d,`${l}-flow__node`)||Ml(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||Ml(d,s)&&m||Ml(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function Ul({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=hs().scaleExtent([t,n]).translateExtent(r),f=Lr(e).call(d);v({x:i.x,y:i.y,zoom:Bs(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(Il);async function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).transform(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!ec(E)||E<0?0:E);let k=O?Ll({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):Rl({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});f.on(`wheel.zoom`,k,{passive:!1});let A=zl({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,A);let j=Bl({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,j);let M=Vl({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,M);let N=Hl({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(N),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=jl(e),i=d?.constrain()(r,t,n);return i&&await h(i),i}async function y(e,t){let n=jl(e);return await h(n,t),n}function b(e){if(f){let t=jl(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?os(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).scaleTo(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?ta:ha).scaleBy(Fl(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!ec(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var Wl;(function(e){e.Line=`line`,e.Handle=`handle`})(Wl||={});function Gl({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function Kl(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function ql(e,t){return Math.max(0,t-e)}function Jl(e,t){return Math.max(0,e-t)}function Yl(e,t,n){return Math.max(0,t-e,e-n)}function Xl(e,t){return e?!t:t}function Zl(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=Yl(E,h,g),j=Yl(D,_,v);if(o){let e=0,t=0;c&&w<0?e=ql(y+w+O,o[0][0]):!c&&w>0&&(e=Jl(y+E+O,o[1][0])),l&&T<0?t=ql(b+T+k,o[0][1]):!l&&T>0&&(t=Jl(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=Jl(y+w,s[0][0]):!c&&w<0&&(e=ql(y+E,s[1][0])),l&&T>0?t=Jl(b+T,s[0][1]):!l&&T<0&&(t=ql(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=Yl(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?Jl(b+k+E/C,o[1][1])*C:ql(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?ql(b+E/C,s[1][1])*C:Jl(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=Yl(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?Jl(y+D*C+O,o[1][0])/C:ql(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?ql(y+D*C,s[1][0])/C:Jl(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(Xl(c,l)?-w:w)/C:w=(Xl(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Ql={width:0,height:0,x:0,y:0},$l={...Ql,pointerX:0,pointerY:0,aspectRatio:1};function eu(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function tu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=Lr(e),o={controlDirection:Kl(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Ql},h={...$l};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:Kl(e)};let g,_=null,v=[],y,b,x,S=!1,C=Qr().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=_c(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=uc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=eu(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=_c(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=Zl(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var nu=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ru=t(((e,t)=>{t.exports=nu()})),iu=t((e=>{var t=n(),r=ru();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),au=e(t(((e,t)=>{t.exports=iu()}))(),1),ou=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},su=e=>e?ou(e):ou,{useDebugValue:cu}=Y.default,{useSyncExternalStoreWithSelector:lu}=au.default,uu=e=>e;function du(e,t=uu,n){let r=lu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return cu(r),r}var fu=(e,t)=>{let n=su(e),r=(e,r=t)=>du(n,e,r);return Object.assign(r,n),r},pu=(e,t)=>e?fu(e,t):fu;function mu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var hu=(0,Y.createContext)(null),gu=hu.Provider,_u=gs.error001(`react`);function $(e,t){let n=(0,Y.useContext)(hu);if(n===null)throw Error(_u);return du(n,e,t)}function vu(){let e=(0,Y.useContext)(hu);if(e===null)throw Error(_u);return(0,Y.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var yu={display:`none`},bu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},xu=`react-flow__node-desc`,Su=`react-flow__edge-desc`,Cu=`react-flow__aria-live`,wu=e=>e.ariaLiveMessage,Tu=e=>e.ariaLabelConfig;function Eu({rfId:e}){let t=$(wu);return(0,J.jsx)(`div`,{id:`${Cu}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:bu,children:t})}function Du({rfId:e,disableKeyboardA11y:t}){let n=$(Tu);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{id:`${xu}-${e}`,style:yu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,J.jsx)(`div`,{id:`${Su}-${e}`,style:yu,children:n[`edge.a11yDescription.default`]}),!t&&(0,J.jsx)(Eu,{rfId:e})]})}var Ou=(0,Y.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,J.jsx)(`div`,{className:X([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Ou.displayName=`Panel`;var ku=`https://reactflow.dev?utm_source=attribution`;function Au({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,J.jsx)(Ou,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ku}`,children:(0,J.jsx)(`a`,{href:ku,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var ju=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Mu=e=>e.id;function Nu(e,t){return mu(e.selectedNodes.map(Mu),t.selectedNodes.map(Mu))&&mu(e.selectedEdges.map(Mu),t.selectedEdges.map(Mu))}function Pu({onSelectionChange:e}){let t=vu(),{selectedNodes:n,selectedEdges:r}=$(ju,Nu);return(0,Y.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Fu=e=>!!e.onSelectionChangeHandlers;function Iu({onSelectionChange:e}){let t=$(Fu);return e||t?(0,J.jsx)(Pu,{onSelectionChange:e}):null}var Lu=[0,0],Ru={x:0,y:0,zoom:1},zu=[...`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`.split(`.`),`rfId`],Bu=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}),Vu={translateExtent:_s,nodeOrigin:Lu,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function Hu(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(Bu,mu),l=vu();(0,Y.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Vu,s()}),[]);let u=(0,Y.useRef)(Vu);return(0,Y.useEffect)(()=>{for(let s of zu){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:gc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},zu.map(t=>e[t])),null}function Uu(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function Wu(e){let[t,n]=(0,Y.useState)(e===`system`?null:e);return(0,Y.useEffect)(()=>{if(e!==`system`){n(e);return}let t=Uu(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?Uu()?.matches?`dark`:`light`:t}var Gu=typeof document<`u`?document:null;function Ku(e=null,t={target:Gu,actInsideInputWithModifier:!0}){let[n,r]=(0,Y.useState)(!1),i=(0,Y.useRef)(!1),a=(0,Y.useRef)(new Set([])),[o,s]=(0,Y.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,` +`).replace(` + +`,` ++`).split(` +`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,Y.useEffect)(()=>{let n=t?.target??Gu,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&xc(e))return!1;let n=Ju(e.code,s);if(a.current.add(e[n]),qu(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=Ju(e.code,s);qu(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function qu(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Ju(e,t){return t.includes(e)?`code`:`key`}var Yu=()=>{let e=vu();return(0,Y.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=cc(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return rc(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=ic(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Xu(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)Zu(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function Zu(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(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)}}function Qu(e,t){return Xu(e,t)}function $u(e,t){return Xu(e,t)}function ed(e,t){return{id:e,type:`select`,selected:t}}function td(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(ed(a.id,e)))}return r}function nd({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function rd(e){return{id:e.id,type:`remove`}}var id=tc(`React Flow`,`https://reactflow.dev/`);function ad(e,t,n={}){return Pc(e,t,{...n,onError:n.onError??id})}var od=e=>ks(e),sd=e=>Os(e);function cd(e){return(0,Y.forwardRef)(e)}var ld=typeof window<`u`?Y.useLayoutEffect:Y.useEffect;function ud(e){let[t,n]=(0,Y.useState)(BigInt(0)),[r]=(0,Y.useState)(()=>dd(()=>n(e=>e+BigInt(1))));return ld(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function dd(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var fd=(0,Y.createContext)(null);function pd({children:e}){let t=vu(),n=ud((0,Y.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=nd({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=ud((0,Y.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(nd({items:s,lookup:o}))},[])),i=(0,Y.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,J.jsx)(fd.Provider,{value:i,children:e})}function md(){let e=(0,Y.useContext)(fd);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var hd=e=>!!e.panZoom;function gd(){let e=Yu(),t=vu(),n=md(),r=$(hd),i=(0,Y.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=od(e)?e:n.get(e.id),a=i.parentId?pc(i.position,i.measured,i.parentId,n,r):i.position;return Js({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&od(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&sd(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await zs({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(rd);o?.(f),c(e)}if(m){let e=d.map(rd);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=$s(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=Js(s?r:a),l=Qs(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=$s(e)?e:a(e);if(!r)return!1;let i=Qs(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Ms(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??hc();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,Y.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var _d=e=>e.selected,vd=typeof window<`u`?window:void 0;function yd({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=vu(),{deleteElements:r}=gd(),i=Ku(e,{actInsideInputWithModifier:!1}),a=Ku(t,{target:vd});(0,Y.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(_d),edges:e.filter(_d)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,Y.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function bd(e){let t=vu();(0,Y.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=vc(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,gs.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var xd={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Sd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Cd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=xs.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=vu(),S=(0,Y.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=$(Sd,mu),E=Ku(f),D=(0,Y.useRef)();bd(S);let O=(0,Y.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,Y.useEffect)(()=>{if(S.current){D.current=Ul({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,Y.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,J.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:xd,children:m})}var wd=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Td(){let{userSelectionActive:e,userSelectionRect:t}=$(wd,mu);return e&&t?(0,J.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}var Ed=(e,t)=>n=>{n.target===t.current&&e?.(n)},Dd=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Od({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ss.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,Y.useRef)(0),_=vu(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(Dd,mu),C=y&&(e||v),w=(0,Y.useRef)(null),T=(0,Y.useRef)(),E=(0,Y.useRef)(new Set),D=(0,Y.useRef)(new Set),O=(0,Y.useRef)(!1),k=(0,Y.useRef)(!1),A=(0,Y.useRef)({x:0,y:0}),j=(0,Y.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=Cc(n.nativeEvent,T.current),l=rc({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=ic(d,i),m={startX:d.x,startY:d.y,x:ee.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}mc(h,E.current)||c(td(a,E.current,!0)),mc(g,D.current)||l(td(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function R(){if(!i||!T.current)return;let[e,t]=Ws(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(R);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(R)})}let z=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,Y.useEffect)(()=>()=>z(),[]);let B=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Cc(e.nativeEvent,T.current);A.current={x:o,y:c};let l=ic({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(R(),!0),L(o,c)},ee=e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),z())},te=e=>{e.target?.releasePointerCapture?.(e.pointerId),z()},V=r===!0||Array.isArray(r)&&r.includes(0);return(0,J.jsxs)(`div`,{className:X([`react-flow__pane`,{draggable:V,dragging:b,selection:e}]),onClick:C?void 0:Ed(M,w),onContextMenu:Ed(N,w),onWheel:Ed(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?B:p,onPointerUp:ee,onPointerCancel:C?te:void 0,onPointerDownCapture:C?I:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:xd,children:[h,(0,J.jsx)(Td,{})]})}function kd({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,gs.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function Ad({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=vu(),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)();return(0,Y.useEffect)(()=>{u.current=vl({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{kd({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,Y.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var jd=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Md(){let e=vu();return(0,Y.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=jd(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=nc(t,i));let{position:a,positionAbsolute:s}=Rs({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Nd=(0,Y.createContext)(null),Pd=Nd.Provider;Nd.Consumer;var Fd=()=>(0,Y.useContext)(Nd),Id=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Ld=(0,Y.createContext)(null);function Rd({children:e}){let t=$(Id,mu);return(0,J.jsx)(Ld.Provider,{value:t,children:e})}function zd(){let e=(0,Y.useContext)(Ld);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var Bd={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Vd=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return Bd;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===bs.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Hd({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=vu(),_=Fd(),{connectOnClick:v,noPanClassName:y,rfId:b}=zd(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(Vd(_,m,e),mu);_||g.getState().onError?.(`010`,gs.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(ad(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Sc(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Ol.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,J.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:X([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=yc(t.target),h=n||c,{connection:v,isValid:y}=Ol.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var Ud=(0,Y.memo)(cd(Hd));function Wd({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,J.jsxs)(J.Fragment,{children:[e?.label,(0,J.jsx)(Ud,{type:`source`,position:n,isConnectable:t})]})}function Gd({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ud,{type:`target`,position:n,isConnectable:t}),e?.label,(0,J.jsx)(Ud,{type:`source`,position:r,isConnectable:t})]})}function Kd(){return null}function qd({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ud,{type:`target`,position:n,isConnectable:t}),e?.label]})}var Jd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Yd={input:Wd,default:Gd,output:qd,group:Kd};function Xd(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var Zd=e=>{let{width:t,height:n,x:r,y:i}=Ns(e.nodeLookup,{filter:e=>!!e.selected});return{width:ec(t)?t:null,height:ec(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Qd({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=vu(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(Zd,mu),c=Md(),l=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(Ad({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,J.jsx)(`div`,{className:X([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,J.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Jd,e.key)&&(e.preventDefault(),c({direction:Jd[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var $d=typeof window<`u`?window:void 0,ef=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function tf({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:R}=$(ef,mu),z=Ku(l,{target:$d}),B=Ku(h,{target:$d}),ee=B||w,te=B||b,V=u&&ee!==!0,H=z||R||V;return yd({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,J.jsx)(Cd,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:te,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!z&&ee,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:V,children:(0,J.jsxs)(Od,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ee,autoPanOnSelection:T,isSelecting:!!H,selectionMode:d,selectionKeyPressed:z,paneClickDistance:s,selectionOnDrag:V,children:[e,L&&(0,J.jsx)(Qd,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}tf.displayName=`FlowRenderer`;var nf=(0,Y.memo)(tf),rf=e=>t=>e?Ps(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function af(e){return $((0,Y.useCallback)(rf(e),[e]),mu)}var of=e=>e.updateNodeInternals;function sf(){let e=$(of),[t]=(0,Y.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,Y.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function cf({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=vu(),a=(0,Y.useRef)(null),o=(0,Y.useRef)(null),s=(0,Y.useRef)(e.sourcePosition),c=(0,Y.useRef)(e.targetPosition),l=(0,Y.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,Y.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,Y.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,Y.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function lf({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},mu),S=y.type||`default`,C=g?.[S]||Yd[S];C===void 0&&(v?.(`003`,gs.error003(S)),S=`default`,C=g?.default||Yd.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=vu(),k=fc(y),A=cf({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=Ad({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=Md();if(y.hidden)return null;let N=dc(y),P=Xd(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,R=i?e=>i(e,{...b.userNode}):void 0,z=a?e=>a(e,{...b.userNode}):void 0,B=o?e=>o(e,{...b.userNode}):void 0,ee=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&kd({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},te=t=>{if(!(xc(t.nativeEvent)||m)){if(vs.includes(t.key)&&T){let n=t.key===`Escape`;kd({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(Jd,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:Jd[t.key],factor:t.shiftKey?4:1})}}},V=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Ps(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,J.jsx)(`div`,{className:X([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:R,onContextMenu:z,onClick:ee,onDoubleClick:B,onKeyDown:D?te:void 0,tabIndex:D?0:void 0,onFocus:D?V:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${xu}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,J.jsx)(Pd,{value:e,children:(0,J.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var uf=(0,Y.memo)(lf),df=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ff(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=$(df,mu),o=af(e.onlyRenderVisibleElements),s=sf();return(0,J.jsx)(`div`,{className:`react-flow__nodes`,style:xd,children:o.map(o=>(0,J.jsx)(uf,{id:o,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:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}ff.displayName=`NodeRenderer`;var pf=(0,Y.memo)(ff);function mf(e){return $((0,Y.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&jc({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),mu)}var hf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,J.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},gf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,J.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},_f={[Ts.Arrow]:hf,[Ts.ArrowClosed]:gf};function vf(e){let t=vu();return(0,Y.useMemo)(()=>Object.prototype.hasOwnProperty.call(_f,e)?_f[e]:(t.getState().onError?.(`009`,gs.error009(e)),null),[e])}var yf=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=vf(t);return c?(0,J.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,J.jsx)(c,{color:n,strokeWidth:o})}):null},bf=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,Y.useMemo)(()=>Jc(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,J.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,J.jsx)(`defs`,{children:i.map(e=>(0,J.jsx)(yf,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};bf.displayName=`MarkerDefinitions`;var xf=(0,Y.memo)(bf);function Sf({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,Y.useState)({x:1,y:0,width:0,height:0}),p=X([`react-flow__edge-textwrapper`,l]),m=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,J.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,J.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,J.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Sf.displayName=`EdgeText`;var Cf=(0,Y.memo)(Sf);function wf({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`path`,{...u,d:e,fill:`none`,className:X([`react-flow__edge-path`,u.className])}),l?(0,J.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&ec(t)&&ec(n)?(0,J.jsx)(Cf,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Tf({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Ef({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=Tf({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Tf({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Tc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Df(e){return(0,Y.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Ef({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,J.jsx)(wf,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Of=Df({isInternal:!1}),kf=Df({isInternal:!0});Of.displayName=`SimpleBezierEdge`,kf.displayName=`SimpleBezierEdgeInternal`;function Af(e){return(0,Y.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Vc({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,J.jsx)(wf,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var jf=Af({isInternal:!1}),Mf=Af({isInternal:!0});jf.displayName=`SmoothStepEdge`,Mf.displayName=`SmoothStepEdgeInternal`;function Nf(e){return(0,Y.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,J.jsx)(jf,{...n,id:r,pathOptions:(0,Y.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Pf=Nf({isInternal:!1}),Ff=Nf({isInternal:!0});Pf.displayName=`StepEdge`,Ff.displayName=`StepEdgeInternal`;function If(e){return(0,Y.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Fc({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,J.jsx)(wf,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var Lf=If({isInternal:!1}),Rf=If({isInternal:!0});Lf.displayName=`StraightEdge`,Rf.displayName=`StraightEdgeInternal`;function zf(e){return(0,Y.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Oc({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,J.jsx)(wf,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var Bf=zf({isInternal:!1}),Vf=zf({isInternal:!0});Bf.displayName=`BezierEdge`,Vf.displayName=`BezierEdgeInternal`;var Hf={default:Vf,straight:Rf,step:Ff,smoothstep:Mf,simplebezier:kf},Uf={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Wf=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,Gf=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,Kf=`react-flow__edgeupdater`;function qf({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,J.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:X([Kf,`${Kf}-${s}`]),cx:Wf(t,r,e),cy:Gf(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function Jf({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=vu(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Ol.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,J.jsxs)(J.Fragment,{children:[(e===!0||e===`source`)&&(0,J.jsx)(qf,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,J.jsx)(qf,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function Yf({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||Hf[x];S===void 0&&(_?.(`011`,gs.error011(x)),x=`default`,S=h?.default||Hf.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,Y.useRef)(null),[D,O]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(!1),j=vu(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=$((0,Y.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return Uf;let i=Uc({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=Ac({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||Uf,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),mu),z=(0,Y.useMemo)(()=>y.markerStart?`url('#${qc(y.markerStart,m)}')`:void 0,[y.markerStart,m]),B=(0,Y.useMemo)(()=>y.markerEnd?`url('#${qc(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let ee=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},te=a?e=>{a(e,{...y})}:void 0,V=o?e=>{o(e,{...y})}:void 0,H=s?e=>{s(e,{...y})}:void 0,U=c?e=>{c(e,{...y})}:void 0,ne=l?e=>{l(e,{...y})}:void 0;return(0,J.jsx)(`svg`,{style:{zIndex:M},children:(0,J.jsxs)(`g`,{className:X([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:ee,onDoubleClick:te,onContextMenu:V,onMouseEnter:H,onMouseMove:U,onMouseLeave:ne,onKeyDown:C?t=>{if(!v&&vs.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${Su}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,J.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:z,markerEnd:B,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,J.jsx)(Jf,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var Xf=(0,Y.memo)(Yf),Zf=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Qf({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(Zf,mu),b=mf(t);return(0,J.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,J.jsx)(xf,{defaultColor:e,rfId:n}),b.map(e=>(0,J.jsx)(Xf,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}Qf.displayName=`EdgeRenderer`;var $f=(0,Y.memo)(Qf),ep=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function tp({children:e}){let t=$(ep);return(0,J.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:t},children:e})}function np(e){let t=gd(),n=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var rp=e=>e.panZoom?.syncViewport;function ip(e){let t=$(rp),n=vu();return(0,Y.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function ap(e){return e.connection.inProgress?{...e.connection,to:rc(e.connection.to,e.transform)}:{...e.connection}}function op(e){return e?t=>e(ap(t)):ap}function sp(e){return $(op(e),mu)}var cp=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function lp({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(cp,mu);return a&&i&&c?(0,J.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,J.jsx)(`g`,{className:X([`react-flow__connection`,Ds(s)]),children:(0,J.jsx)(up,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var up=({style:e,type:t=ws.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=sp();if(!i)return;if(n)return(0,J.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Ds(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case ws.Bezier:[m]=Oc(h);break;case ws.SimpleBezier:[m]=Ef(h);break;case ws.Step:[m]=Vc({...h,borderRadius:0});break;case ws.SmoothStep:[m]=Vc(h);break;default:[m]=Fc(h)}return(0,J.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};up.displayName=`ConnectionLine`;var dp={};function fp(e=dp){(0,Y.useRef)(e),vu(),(0,Y.useEffect)(()=>{},[e])}function pp(){vu(),(0,Y.useRef)(!1),(0,Y.useEffect)(()=>{},[])}function mp({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:z,autoPanOnSelection:B,onPaneClick:ee,onPaneMouseEnter:te,onPaneMouseMove:V,onPaneMouseLeave:H,onPaneScroll:U,onPaneContextMenu:ne,paneClickDistance:re,nodeClickDistance:ie,onEdgeContextMenu:ae,onEdgeMouseEnter:oe,onEdgeMouseMove:se,onEdgeMouseLeave:W,reconnectRadius:ce,onReconnect:le,onReconnectStart:ue,onReconnectEnd:de,noDragClassName:fe,noWheelClassName:pe,noPanClassName:me,disableKeyboardA11y:G,nodeExtent:he,rfId:ge,viewport:_e,onViewportChange:ve}){return fp(e),fp(t),pp(),np(n),ip(_e),(0,J.jsx)(nf,{onPaneClick:ee,onPaneMouseEnter:te,onPaneMouseMove:V,onPaneMouseLeave:H,onPaneContextMenu:ne,onPaneScroll:U,paneClickDistance:re,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:z,autoPanOnSelection:B,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:fe,noWheelClassName:pe,noPanClassName:me,disableKeyboardA11y:G,onViewportChange:ve,isControlledViewport:!!_e,children:(0,J.jsxs)(tp,{children:[(0,J.jsx)($f,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:le,onReconnectStart:ue,onReconnectEnd:de,onlyRenderVisibleElements:T,onEdgeContextMenu:ae,onEdgeMouseEnter:oe,onEdgeMouseMove:se,onEdgeMouseLeave:W,reconnectRadius:ce,defaultMarkerColor:M,noPanClassName:me,disableKeyboardA11y:G,rfId:ge}),(0,J.jsx)(lp,{style:h,type:m,component:g,containerStyle:_}),(0,J.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,J.jsx)(pf,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ie,onlyRenderVisibleElements:T,noPanClassName:me,noDragClassName:fe,disableKeyboardA11y:G,nodeExtent:he,rfId:ge}),(0,J.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}mp.displayName=`GraphView`;var hp=(0,Y.memo)(mp),gp=tc(`React Flow`,`https://reactflow.dev/`),_p=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??_s;fl(h,g,_);let{nodesInitialized:x}=rl(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=cc(Ns(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:_s,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bs.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Cs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gp,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:ys,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},vp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>pu((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await Ls({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{..._p({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=rl(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();fl(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=ll(e,n,r,i,a,o,l);d&&(el(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=Gc(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=cl(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(Qu(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n($u(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>ed(e,!0)));return}i(td(r,new Set([...e]),!0)),a(td(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>ed(e,!0)));return}a(td(n,new Set([...e]))),i(td(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(ed(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(ed(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,ed(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,ed(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(rl(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return ul({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Cs}})},updateConnection:e=>{p({connection:e})},reset:()=>p({..._p()})}},Object.is);function yp({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,Y.useState)(()=>vp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,J.jsx)(gu,{value:m,children:(0,J.jsx)(pd,{children:(0,J.jsx)(Rd,{children:p})})})}function bp({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,Y.useContext)(hu)?(0,J.jsx)(J.Fragment,{children:e}):(0,J.jsx)(yp,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var xp={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Sp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:R=ws.Bezier,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,deleteKeyCode:te=`Backspace`,selectionKeyCode:V=`Shift`,selectionOnDrag:H=!1,selectionMode:U=Ss.Full,panActivationKeyCode:ne=`Space`,multiSelectionKeyCode:re=lc()?`Meta`:`Control`,zoomActivationKeyCode:ie=lc()?`Meta`:`Control`,snapToGrid:ae,snapGrid:oe,onlyRenderVisibleElements:se=!1,selectNodesOnDrag:W,nodesDraggable:ce,autoPanOnNodeFocus:le,nodesConnectable:ue,nodesFocusable:de,nodeOrigin:fe=Lu,edgesFocusable:pe,edgesReconnectable:me,elementsSelectable:G=!0,defaultViewport:he=Ru,minZoom:ge=.5,maxZoom:_e=2,translateExtent:ve=_s,preventScrolling:ye=!0,nodeExtent:be,defaultMarkerColor:xe=`#b1b1b7`,zoomOnScroll:Se=!0,zoomOnPinch:Ce=!0,panOnScroll:we=!1,panOnScrollSpeed:K=.5,panOnScrollMode:Te=xs.Free,zoomOnDoubleClick:Ee=!0,panOnDrag:De=!0,onPaneClick:Oe,onPaneMouseEnter:ke,onPaneMouseMove:Ae,onPaneMouseLeave:je,onPaneScroll:Me,onPaneContextMenu:Ne,paneClickDistance:Pe=1,nodeClickDistance:Fe=0,children:Ie,onReconnect:Le,onReconnectStart:Re,onReconnectEnd:ze,onEdgeContextMenu:Be,onEdgeDoubleClick:Ve,onEdgeMouseEnter:He,onEdgeMouseMove:q,onEdgeMouseLeave:Ue,reconnectRadius:We=10,onNodesChange:Ge,onEdgesChange:Ke,noDragClassName:qe=`nodrag`,noWheelClassName:Je=`nowheel`,noPanClassName:Ye=`nopan`,fitView:Xe,fitViewOptions:Ze,connectOnClick:Qe,attributionPosition:$e,proOptions:et,defaultEdgeOptions:tt,elevateNodesOnSelect:nt=!0,elevateEdgesOnSelect:rt=!1,disableKeyboardA11y:it=!1,autoPanOnConnect:at,autoPanOnNodeDrag:ot,autoPanOnSelection:st=!0,autoPanSpeed:ct,connectionRadius:lt,isValidConnection:ut,onError:dt,style:ft,id:pt,nodeDragThreshold:mt,connectionDragThreshold:ht,viewport:gt,onViewportChange:_t,width:vt,height:yt,colorMode:bt=`light`,debug:xt,onScroll:St,ariaLabelConfig:Ct,zIndexMode:wt=`basic`,...Tt},Et){let Dt=pt||`1`,Ot=Wu(bt),kt=(0,Y.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),St?.(e)},[St]);return(0,J.jsx)(`div`,{"data-testid":`rf__wrapper`,...Tt,onScroll:kt,style:{...ft,...xp},ref:Et,className:X([`react-flow`,i,Ot]),id:pt,role:`application`,children:(0,J.jsxs)(bp,{nodes:e,edges:t,width:vt,height:yt,fitView:Xe,fitViewOptions:Ze,minZoom:ge,maxZoom:_e,nodeOrigin:fe,nodeExtent:be,zIndexMode:wt,children:[(0,J.jsx)(Hu,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:ce,autoPanOnNodeFocus:le,nodesConnectable:ue,nodesFocusable:de,edgesFocusable:pe,edgesReconnectable:me,elementsSelectable:G,elevateNodesOnSelect:nt,elevateEdgesOnSelect:rt,minZoom:ge,maxZoom:_e,nodeExtent:be,onNodesChange:Ge,onEdgesChange:Ke,snapToGrid:ae,snapGrid:oe,connectionMode:L,translateExtent:ve,connectOnClick:Qe,defaultEdgeOptions:tt,fitView:Xe,fitViewOptions:Ze,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Ye,nodeOrigin:fe,rfId:Dt,autoPanOnConnect:at,autoPanOnNodeDrag:ot,autoPanSpeed:ct,onError:dt,connectionRadius:lt,isValidConnection:ut,selectNodesOnDrag:W,nodeDragThreshold:mt,connectionDragThreshold:ht,onBeforeDelete:I,debug:xt,ariaLabelConfig:Ct,zIndexMode:wt}),(0,J.jsx)(hp,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,selectionKeyCode:V,selectionOnDrag:H,selectionMode:U,deleteKeyCode:te,multiSelectionKeyCode:re,panActivationKeyCode:ne,zoomActivationKeyCode:ie,onlyRenderVisibleElements:se,defaultViewport:he,translateExtent:ve,minZoom:ge,maxZoom:_e,preventScrolling:ye,zoomOnScroll:Se,zoomOnPinch:Ce,zoomOnDoubleClick:Ee,panOnScroll:we,panOnScrollSpeed:K,panOnScrollMode:Te,panOnDrag:De,autoPanOnSelection:st,onPaneClick:Oe,onPaneMouseEnter:ke,onPaneMouseMove:Ae,onPaneMouseLeave:je,onPaneScroll:Me,onPaneContextMenu:Ne,paneClickDistance:Pe,nodeClickDistance:Fe,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Le,onReconnectStart:Re,onReconnectEnd:ze,onEdgeContextMenu:Be,onEdgeDoubleClick:Ve,onEdgeMouseEnter:He,onEdgeMouseMove:q,onEdgeMouseLeave:Ue,reconnectRadius:We,defaultMarkerColor:xe,noDragClassName:qe,noWheelClassName:Je,noPanClassName:Ye,rfId:Dt,disableKeyboardA11y:it,nodeExtent:be,viewport:gt,onViewportChange:_t}),(0,J.jsx)(Iu,{onSelectionChange:k}),Ie,(0,J.jsx)(Au,{proOptions:et,position:$e}),(0,J.jsx)(Du,{rfId:Dt,disableKeyboardA11y:it})]})})}var Cp=cd(Sp),wp=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Tp({children:e}){let t=$(wp);return t?(0,pt.createPortal)(e,t):null}function Ep(e){let[t,n]=(0,Y.useState)(e);return[t,n,(0,Y.useCallback)(e=>n(t=>Qu(e,t)),[])]}var Dp=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(let[,{internals:e}]of t.nodeLookup)if(e.handleBounds===void 0||!fc(e.userNode))return!1;return!0};function Op(e={includeHiddenNodes:!1}){return $(Dp(e))}gs.error014();function kp({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,J.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:X([`react-flow__background-pattern`,n,r])})}function Ap({radius:e,className:t}){return(0,J.jsx)(`circle`,{cx:e,cy:e,r:e,className:X([`react-flow__background-pattern`,`dots`,t])})}var jp;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(jp||={});var Mp={[jp.Dots]:1,[jp.Lines]:1,[jp.Cross]:6},Np=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Pp({id:e,variant:t=jp.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,Y.useRef)(null),{transform:f,patternId:p}=$(Np,mu),m=r||Mp[t],h=t===jp.Dots,g=t===jp.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,J.jsxs)(`svg`,{className:X([`react-flow__background`,l]),style:{...c,...xd,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,J.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,J.jsx)(Ap,{radius:y/2,className:u}):(0,J.jsx)(kp,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,J.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}Pp.displayName=`Background`;var Fp=(0,Y.memo)(Pp);function Ip(){return(0,J.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,J.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function Lp(){return(0,J.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,J.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function Rp(){return(0,J.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,J.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 zp(){return(0,J.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,J.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 Bp(){return(0,J.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,J.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 Vp({children:e,className:t,...n}){return(0,J.jsx)(`button`,{type:`button`,className:X([`react-flow__controls-button`,t]),...n,children:e})}var Hp=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Up({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=vu(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(Hp,mu),{zoomIn:y,zoomOut:b,fitView:x}=gd();return(0,J.jsxs)(Ou,{className:X([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Vp,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,J.jsx)(Ip,{})}),(0,J.jsx)(Vp,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,J.jsx)(Lp,{})})]}),n&&(0,J.jsx)(Vp,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,J.jsx)(Rp,{})}),r&&(0,J.jsx)(Vp,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,J.jsx)(Bp,{}):(0,J.jsx)(zp,{})}),u]})}Up.displayName=`Controls`;var Wp=(0,Y.memo)(Up);function Gp({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,J.jsx)(`rect`,{className:X([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var Kp=(0,Y.memo)(Gp),qp=e=>e.nodes.map(e=>e.id),Jp=e=>e instanceof Function?e:()=>e;function Yp({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Kp,onClick:o}){let s=$(qp,mu),c=Jp(t),l=Jp(e),u=Jp(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,J.jsx)(J.Fragment,{children:s.map(e=>(0,J.jsx)(Zp,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function Xp({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=dc(r);return{node:r,x:i,y:a,width:o,height:s}},mu);return!l||l.hidden||!fc(l)?null:(0,J.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var Zp=(0,Y.memo)(Xp),Qp=(0,Y.memo)(Yp),$p=200,em=150,tm=e=>!e.hidden,nm=e=>{let 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?Xs(Ns(e.nodeLookup,{filter:tm}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},rm=`react-flow__minimap-desc`;function im({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=vu(),S=(0,Y.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(nm,mu),j=e?.width??$p,M=e?.height??em,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,z=C.x-(I-C.width)/2-R,B=C.y-(L-C.height)/2-R,ee=I+R*2,te=L+R*2,V=`${rm}-${T}`,H=(0,Y.useRef)(0),U=(0,Y.useRef)();H.current=F,(0,Y.useEffect)(()=>{if(S.current&&E)return U.current=kl({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>H.current}),()=>{U.current?.destroy()}},[E]),(0,Y.useEffect)(()=>{U.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ne=p?e=>{let[t,n]=U.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,re=m?(0,Y.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ie=_??A[`minimap.ariaLabel`];return(0,J.jsx)(Ou,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F: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 o==`number`?o:void 0},className:X([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,J.jsxs)(`svg`,{width:j,height:M,viewBox:`${z} ${B} ${ee} ${te}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":V,ref:S,onClick:ne,children:[ie&&(0,J.jsx)(`title`,{id:V,children:ie}),(0,J.jsx)(Qp,{onClick:re,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,J.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${z-R},${B-R}h${ee+R*2}v${te+R*2}h${-ee-R*2}z + M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}im.displayName=`MiniMap`;var am=(0,Y.memo)(im),om=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,sm={[Wl.Line]:`right`,[Wl.Handle]:`bottom-right`};function cm({nodeId:e,position:t,variant:n=Wl.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=Fd(),y=typeof e==`string`?e:v,b=vu(),x=(0,Y.useRef)(null),S=n===Wl.Handle,C=$((0,Y.useCallback)(om(S&&p),[S,p]),mu),w=(0,Y.useRef)(null),T=t??sm[n];(0,Y.useEffect)(()=>{if(!(!x.current||!y))return w.current||=tu({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=cl([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...pc({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,J.jsx)(`div`,{className:X([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,Y.memo)(cm);function lm({path:e,delay:t,padding:n=24,children:r}){let i=`map-growth-${(0,Y.useId)().replace(/:/g,``)}`;if(t==null)return(0,J.jsx)(J.Fragment,{children:r});let a=(e.match(/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/gi)??[]).map(Number),o=a.filter((e,t)=>t%2==0),s=a.filter((e,t)=>t%2==1);if(!o.length||!s.length)return(0,J.jsx)(J.Fragment,{children:r});let c=Math.min(...o)-n,l=Math.min(...s)-n;return(0,J.jsxs)(`g`,{"data-map-growing-edge":`true`,children:[(0,J.jsx)(`defs`,{children:(0,J.jsx)(`mask`,{id:i,maskUnits:`userSpaceOnUse`,x:c,y:l,width:Math.max(...o)-c+n,height:Math.max(...s)-l+n,children:(0,J.jsx)(`path`,{className:`map-growth-mask`,d:e,pathLength:1,fill:`none`,stroke:`white`,strokeWidth:n*2,strokeLinecap:`round`,style:{animationDelay:`${t}ms`}})})}),(0,J.jsx)(`g`,{mask:`url(#${i})`,children:r})]})}function um({layout:e,growing:t={},activeStep:n,activeTeamSteps:r=[]}){let i=`submap-arrow-${(0,Y.useId)().replace(/:/g,``)}`;return(0,J.jsxs)(`svg`,{className:`submap-relations`,width:e.width,height:e.height,"aria-label":`Task process relationships`,children:[(0,J.jsx)(`defs`,{children:(0,J.jsx)(`marker`,{id:i,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6.5`,markerHeight:`6.5`,orient:`auto`,children:(0,J.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,fill:`var(--map-edge-context, #6f8ca8)`})})}),e.links.map(a=>{let o=e.positions[a.source],s=e.positions[a.target],c=o.x===s.x&&s.y>o.y,l=o.x+(c?116:232),u=o.y+(c?180:90),d=s.x+(c?116:0),f=s.y+(c?0:90),p=(l+d)/2,m=(u+f)/2,h=c?`M ${l} ${u} L ${d} ${f}`:`M ${l} ${u} C ${p} ${u}, ${p} ${f}, ${d} ${f}`;return(0,J.jsxs)(`g`,{"data-testid":`submap-relation`,"data-relation":a.relation,"data-source":a.source,"data-target":a.target,"aria-label":`${a.label}: ${a.explanation}`,children:[(0,J.jsx)(`title`,{children:a.explanation}),(0,J.jsx)(lm,{path:h,delay:t[a.id],children:(0,J.jsx)(`path`,{className:`submap-relation-path`,d:h,fill:`none`,stroke:`var(--map-edge-context, #6f8ca8)`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeDasharray:a.contextual?`5 6`:void 0,markerEnd:`url(#${i})`})}),(n===a.target||r.includes(a.target))&&(0,J.jsx)(`path`,{className:`submap-flow`,d:h,pathLength:1,fill:`none`,stroke:`#4b9cae`,strokeWidth:`3`,strokeDasharray:`.09 .91`,strokeLinecap:`round`,"aria-hidden":`true`}),(0,J.jsxs)(`g`,{className:`submap-relation-label`,transform:`translate(${p}, ${m})`,children:[(0,J.jsx)(`rect`,{x:`-38`,y:`-11`,width:`76`,height:`22`,rx:`6`}),(0,J.jsx)(`text`,{textAnchor:`middle`,dominantBaseline:`central`,children:a.label})]})]},a.id)})]})}function dm({role:e,since:t,zh:n,text:r}){let[i,a]=(0,Y.useState)(()=>Date.now()/1e3);(0,Y.useEffect)(()=>{if(t==null||r)return;let e=setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(e)},[t,r]);let o=t==null?null:Mt(i-t,n);return(0,J.jsxs)(`div`,{className:`map-card-live`,"data-testid":`map-card-live`,"data-waiting":!!r||void 0,"aria-live":`off`,children:[(0,J.jsx)(`i`,{"aria-hidden":`true`}),(0,J.jsx)(`span`,{title:r,children:r||(0,J.jsxs)(J.Fragment,{children:[Ae(e,n),o?n?` · 本次已进行 ${o}`:` · ${o} this run`:``]})})]})}var fm=(0,Y.createContext)({notes:{}}),pm=(0,Y.createContext)({}),mm={plan:[`计划`,`Plan`],execution:[`动手处理`,`Work`],review:[`检查结果`,`Check`],revision:[`修订`,`Revise`],result:[`结果`,`Result`]},hm={plan:E,execution:D,review:m,revision:lt,result:z},gm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],review_unavailable:[`这次结果检查没有完成`,`Result check did not finish`],held:[`工作暂停,后续尚未安排`,`Work paused; no next step scheduled`],aborted:[`已取消`,`Cancelled`],cancelled:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已被新计划替代`,`Replaced by a new plan`],question:[`等待答复`,`Waiting for an answer`],paused:[`已暂停`,`Paused`],paused_external_work:[`等待后台任务`,`Waiting on background work`],missing:[`记录中缺失`,`Not in this record`],unknown:[`状态未知`,`Unknown`],continue:[`需再改一轮`,`Another pass needed`],blocked:[`受阻`,`Held up`],started:[`进行中`,`Under way`],recorded:[`已记录`,`On record`],requested:[`修改建议`,`Requested`],replan:[`需要调整计划`,`Plan needs adjusting`],replan_requested:[`需要调整计划`,`Plan needs adjusting`]},_m={plan:[`接下来要做什么,为什么这样做`,`What to do next and why`],execution:[`实际做了什么,遇到了什么问题`,`What was done and what happened`],review:[`结果是否正确,有什么依据`,`Whether the result is correct and what supports it`],revision:[`检查后发现需要修改的地方`,`What the check found needs changing`],result:[`这项任务最后得到了什么`,`What the task produced in the end`]},vm={plan:[`提问`,`Asked`],execution:[`Argus 查证`,`Argus`],review:[`核对`,`Check`],revision:[`修订`,`Revise`],result:[`回答`,`Answer`]},ym={plan:[`你提出的要求`,`What you asked for`],execution:[`Argus 自己动手查证、运行命令`,`Argus did the work itself: read, searched, ran commands`],review:[`对结果的核对`,`A check of the result`],revision:[`需要修改的地方`,`What had to change`],result:[`Argus 给出的回答`,`What Argus answered`]},bm=(e,t)=>e.source===`team`?t?`子任务工作记录`:`Subtask work record`:e.source===`task`?t?`任务记录`:`Task record`:e.source===`interval`?t?`根据同期记录关联`:`By execution window`:t?`来自任务记录`:`Linked event`,xm=(0,Y.memo)(function({id:e,data:t}){let{task:n,ordinal:r,zh:i,layout:a,focused:o,detailed:s}=t,{artifacts:c,onOpenArtifact:l}=(0,Y.useContext)(pm),u=(0,Y.useContext)(fm).notes[n.id]??[],[d]=(0,Y.useState)(()=>!!t.revealing||!t.restoring&&!t.seenCards?.has(e));(0,Y.useEffect)(()=>{t.seenCards?.add(e)},[t.seenCards,e]);let[f,p]=(0,Y.useState)(null),m=f||a,h=e=>e.source===`team`&&a.steps.find(t=>t.id===e.id)||e,_=t.canvasSize?.width||window.innerWidth,y=t.canvasSize?.height||window.innerHeight;(0,Y.useEffect)(()=>{s||(x(null),p(null),t.readCopy?.(e,null))},[s]);let[b,x]=(0,Y.useState)(null),S=(0,Y.useRef)(n.status),[w,T]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let e=S.current!==n.status;if(S.current=n.status,!e||n.status!==`done`||t.completionScope)return;T(!0);let r=setTimeout(()=>T(!1),1500);return()=>clearTimeout(r)},[n.status,t.completionScope]);let E=m.steps.find(e=>e.id===b),D=E?h(E):void 0,O=D?.updatedAt??D?.ts,k=t.part===t.partCount,A=!k||t.completionScope?`recorded`:n.status===`missing`?`missing`:t.paused&&ye.has(n.status)?`paused`:He(n),j=A===`paused`&&n.status===`paused_external_work`?n.status:A,M=Math.min(t.frame.width/288,t.frame.height/280),N=t.copy?.cards||{},I=!!N[n.id]?.summary&&N[n.id]?.task_status!==n.status&&(ye.has(n.status)||n.status===`pending`),L=e=>{if(e.completionScope||e.status===`review_unavailable`)return;let t=N[e.id];if(e.source!==`team`)return t;let n=t?.event_ids?.indexOf(e.id)??-1;return h(e).revision&&n>=0&&t?.event_revisions?.[n]===h(e).revision?t:void 0},R=n.kind===`turn`?void 0:t.words,z=(t.completionScope?``:N[n.id]?.title)||R?.title||n.title,B=i?`环节 ${t.start}–${t.end} / ${t.totalSteps}`:`Steps ${t.start}–${t.end} / ${t.totalSteps}`,ee=t.partCount>1&&!k?m.steps.map(e=>L(e)?.summary||h(e).summary||h(e).detail).filter(e=>e&&![he(!0),he(!1)].includes(e)).at(-1):void 0,te=k&&n.objective&&n.objective.trim()!==n.title.trim(),V=A===`review_unavailable`?i?`当次审查器未能给出判断,未形成审阅结论。`:`The Reviewer could not return a judgment on this attempt.`:(t.completionScope?``:N[n.id]?.summary)||R?.summary||``,H=(k?n.pending_question:``)||ee||V||t.completionScope||n.pending_question||re(n.summary||``,i).summary||n.summary||(te?``:n.objective),U=Math.min(t.frame.width/m.width,t.frame.height/m.height),ne=k&&t.live&&ye.has(n.status)?[...m.steps].reverse().find(e=>e.source!==`team`&&![`plan`,`result`].includes(e.kind))?.id:null,ie=t.paused?null:ne,ae=a.steps.filter(e=>e.source===`team`),se=t.live?ae.filter(e=>ye.has(e.status)).map(e=>e.id):[],W=ae.filter(e=>e.status===`done`).length,ce=ae.filter(e=>ye.has(e.status)).length,le=(i?`子任务 ${W}/${ae.length} 完成 · ${ce} 进行中`:`Subtasks ${W}/${ae.length} done · ${ce} running`)+((t.plannedWidth??0)>ae.length?i?` · 计划并行 ×${t.plannedWidth}`:` · planned ×${t.plannedWidth}`:``),ue=e=>e.source===`team`?se.includes(e.id):ie===e.id,de=e=>e.source===`team`?h(e).status:ne===e.id?t.paused?`paused`:`running`:e.status,fe=e=>({source:t.source,task_id:n.id,task_title:z,lang:i?`zh`:`en`,part:t.partCount>1?t.part:void 0,step_id:e?.id,step_title:e?.title,team_id:e?.teamId,team_task_id:e?.teamTaskId,event_ids:e?e.eventIds:t.partCount>1?[...new Set(m.steps.flatMap(e=>e.eventIds))]:N[n.id]?.event_ids||[]}),pe=Math.min(640,m.width-48,Math.max(260,(_-50)/1.05)),me=Math.min(600,m.height-48,Math.max(300,(y-(_<640?180:160))/1.05)),G=e=>({x:Math.max(24,Math.min(m.positions[e.id].x-16,m.width-pe-24)),y:Math.max(24,Math.min(m.positions[e.id].y-16,m.height-me-24)),width:pe,height:me,scale:U}),ge=D?G(D):null,_e=n=>{p(m),x(n.id),t.readCopy?.(e,n.id),t.readStep(e,G(n))};(0,Y.useEffect)(()=>{D&&t.readStep(e,G(D))},[_,y]);let ve=e=>(gm[e===`paused_external_work`?e:e.startsWith(`paused_`)?`paused`:ye.has(e)?`running`:e]??gm.unknown)[+!i],be=t.completionScope?i?`当次结束 · 当时目标未完成`:`Execution ended · goal incomplete then`:n.turn_kind===`qa`&&[`done`,`running`,`cancelled`,`failed`].includes(A)?{done:[`已回答`,`Answered`],running:[`正在回答`,`Answering`],cancelled:[`已中断`,`Interrupted`],failed:[`回答失败`,`Answer failed`]}[A][+!i]:ve(j);return(0,J.jsxs)(`article`,{className:`map-macro map-state-${A}`,"data-testid":`map-macro`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,"data-history":!k,"data-has-history":!!t.historyCount,"data-arrive":!!t.arriving||d&&!!t.revealing,"data-lit":!!t.lit,"data-hovered":!!t.hovered,"data-growing":t.growthDelay!=null,"data-dispatch":t.dispatchState,style:{animationDelay:`${t.growthDelay??(t.arriving?At(r):0)}ms`},"data-focused":o,"data-detailed":s,"aria-label":z,"data-completed-now":w,"data-active":se.length>0||k&&t.live&&!t.paused&&ye.has(n.status),onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(fe(),{x:e.clientX,y:e.clientY})},children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,J.jsx)(Ud,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,J.jsxs)(`div`,{className:`macro-summary`,"aria-hidden":s,style:{"--summary-height":`${t.frame.height/M-20}px`,width:t.frame.width/M-20,transform:`translate(-50%, -50%) scale(${M})`},children:[(0,J.jsxs)(`button`,{className:`map-card map-state-${A} nodrag nopan`,"data-testid":`map-card`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,tabIndex:s?-1:0,onClick:()=>n.turn_kind===`qa`&&t.readCopy?t.readCopy(e,n.id):t.open(e),"aria-label":`${z} · ${n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`放大任务`:`Explore task`}`,children:[(0,J.jsxs)(`div`,{className:`map-card-top`,children:[(0,J.jsxs)(`span`,{className:`map-card-number`,children:[n.turn_kind===`qa`?i?`问答`:`Q&A`:k?i?`任务`:`MISSION`:i?`历史`:`HISTORY`,` `,String(r).padStart(2,`0`),!k&&` · ${t.part}/${t.partCount}`]}),(A!==`recorded`||t.completionScope)&&(0,J.jsxs)(`span`,{className:`map-status`,children:[A===`done`?(0,J.jsx)(g,{size:11}):A===`failed`?(0,J.jsx)(v,{size:11}):A===`review_unavailable`?(0,J.jsx)(nt,{size:11}):A===`question`?(0,J.jsx)(P,{size:11}):A===`paused`||A===`held`?(0,J.jsx)(tt,{size:11}):(0,J.jsx)(`span`,{className:`map-state-dot`}),be]})]}),(0,J.jsxs)(`h3`,{children:[(0,J.jsx)(Me,{children:z}),u.length>0&&(0,J.jsx)(`span`,{className:`macro-note-badge`,title:i?`操作员批注`:`Operator notes`,children:u.length})]}),te&&!V&&(0,J.jsx)(`p`,{className:`map-card-objective`,title:n.objective,children:n.objective}),H&&H.trim()!==(te?n.objective.trim():``)&&(0,J.jsx)(`div`,{className:`map-card-copy`,children:(0,J.jsx)(Me,{children:H})}),t.conclusion&&(0,J.jsx)(`p`,{className:`map-card-conclusion`,"data-testid":`map-card-conclusion`,title:t.conclusion,children:t.conclusion}),n.kind!==`turn`&&(0,J.jsx)(`div`,{className:`map-card-course`,"aria-label":i?`任务经过`:`Course of the task`,children:[`plan`,`execution`,`review`,`result`].map(e=>{let t=hm[e],n=m.steps.some(t=>t.kind===e),r=m.steps.some(t=>t.kind===e&&ue(t)),a=i?{plan:`规划`,execution:`执行`,review:`审查`,result:`交付`}[e]:mm[e][1];return(0,J.jsxs)(`span`,{className:`submap-kind-${e}`,"data-present":n,"data-active":r,title:a,children:[(0,J.jsx)(t,{size:12,"aria-hidden":!0}),(0,J.jsx)(`b`,{children:a})]},e)})}),(()=>{let e=k&&t.live&&t.waiting,r=!e&&k&&t.live&&!t.paused&&ye.has(n.status),a=A!==`recorded`||!!t.completionScope,o=!!t.historyCount&&ae.length>0;return!r&&!e&&k&&a&&!o?null:(0,J.jsxs)(`div`,{className:`map-card-stages`,children:[e?(0,J.jsx)(dm,{text:t.waiting,zh:i}):r?(0,J.jsx)(dm,{role:t.phase??n.role,since:n.started_ts,zh:i}):k&&a?null:(0,J.jsx)(`span`,{className:`map-card-recorded`,children:k?be:i?`历史记录 · 非当前执行`:`History · not current execution`}),o&&(0,J.jsx)(`span`,{className:`map-card-team-summary`,children:le})]})})(),k&&ae.length>0&&(0,J.jsx)(`span`,{className:`map-card-teambar`,"aria-hidden":!0,children:(0,J.jsx)(`i`,{style:{width:`${Math.round(W/ae.length*100)}%`}})}),(0,J.jsxs)(`div`,{className:`map-card-bottom`,children:[(0,J.jsx)(`span`,{className:ae.length?`map-card-team-summary`:void 0,title:B,children:n.turn_kind===`qa`?i?`问题与回答`:`Question and answer`:t.historyCount?``:ae.length?le:t.plannedWidth&&ye.has(n.status)?i?`并行编队 ×${t.plannedWidth} 展开中`:`Fanning out ×${t.plannedWidth}`:t.partCount>1?B:`${m.steps.length} ${i?`个环节`:`steps`}`}),(0,J.jsxs)(`span`,{className:`map-card-submap-hint`,children:[I?i?`描述更新中`:`Summary updating`:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`查看进展`:`View progress`,(0,J.jsx)(oe,{size:12})]})]})]}),!!t.historyCount&&t.toggleHistory&&(0,J.jsxs)(`button`,{type:`button`,className:`map-history-toggle nodrag nopan`,"aria-expanded":t.historyExpanded,"aria-label":`${i?`任务历史`:`Mission history`}: ${z}`,title:i?`保留全部 ${t.totalSteps} 个环节`:`All ${t.totalSteps} steps retained`,onClick:()=>t.toggleHistory?.(n.id),children:[t.historyExpanded?i?`收起历史`:`Hide history`:`${i?`历史`:`History`} ${t.historyCount}`,(0,J.jsx)(oe,{size:12})]})]}),o&&(0,J.jsxs)(`div`,{className:`macro-detail ${D?`is-reading`:``}`,"data-stacked":m.stacked||void 0,"aria-hidden":!s,style:{width:m.width,height:m.height,transform:`scale(${U})`,transformOrigin:`top left`},children:[(0,J.jsxs)(`header`,{className:`macro-heading`,children:[(0,J.jsx)(`span`,{className:`macro-index`,children:String(r).padStart(2,`0`)}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`small`,{children:t.partCount>1?i?`第 ${t.part} / ${t.partCount} 部分`:`Part ${t.part} / ${t.partCount}`:n.turn_kind===`qa`?i?`问答内容`:`Q&A`:i?`任务内部`:`INSIDE THIS TASK`}),(0,J.jsx)(`h2`,{children:(0,J.jsx)(Me,{children:z})})]}),t.conclusion&&(0,J.jsx)(`span`,{className:`macro-conclusion`,"data-testid":`macro-conclusion`,title:t.conclusion,children:t.conclusion}),(A!==`recorded`||t.completionScope)&&(0,J.jsx)(`span`,{className:`macro-state`,title:t.completionScope,children:be}),s&&k?(0,J.jsx)(C,{"data-testid":`map-task-read`,className:`nodrag nopan text-xs`,onClick:()=>{if(n.turn_kind===`qa`){t.readCopy?.(e,n.id);return}x(null),p(null),t.readCopy?.(e,n.id)},children:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`阅读任务说明`:`Read task explanation`}):null]}),(0,J.jsx)(`div`,{className:`macro-stage-key`,children:F.filter(e=>n.kind!==`turn`||m.steps.some(t=>t.kind===e)).map(e=>(0,J.jsx)(`span`,{className:`submap-kind-${e} ${m.steps.some(t=>t.kind===e)?``:`is-unrecorded`}`,title:n.kind===`turn`?ym[e][+!i]:_m[e][+!i],children:n.kind===`turn`?vm[e][+!i]:mm[e][+!i]},e))}),u.length>0&&(0,J.jsxs)(`aside`,{className:`macro-notes`,"aria-label":i?`操作员批注`:`Operator notes`,children:[(0,J.jsx)(`small`,{children:i?`批注`:`Notes`}),u.map(e=>(0,J.jsx)(`p`,{children:e.text},e.id))]}),(0,J.jsx)(um,{layout:m,growing:t.growingLinks,activeStep:ie,activeTeamSteps:se}),m.columns.map(e=>(0,J.jsx)(`div`,{className:`macro-column-label`,style:{left:e.x,top:e.y},children:e.title},e.id)),m.steps.map((e,r)=>{let a=h(e),o=hm[a.kind];return(0,J.jsxs)(`button`,{className:`submap-step submap-kind-${a.kind} nodrag nopan ${b===a.id?`is-selected`:``}`,"data-testid":`submap-step`,"data-step-id":a.id,"data-source":a.source,"data-team-id":a.teamId,"data-team-task-id":a.teamTaskId,"data-status":de(a),"data-active":ue(a),"data-growing":t.growingSteps?.[a.id]!=null,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(fe(a),{x:e.clientX,y:e.clientY})},style:{animationDelay:`${t.growingSteps?.[a.id]??0}ms`,"--step-index":r,left:m.positions[a.id].x,top:m.positions[a.id].y},tabIndex:s?0:-1,onClick:()=>_e(a),"aria-expanded":b===a.id,children:[(0,J.jsxs)(`div`,{className:`submap-step-meta`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(o,{size:16}),a.source===`team`?i?`子任务 · `:`Subtask · `:``,(n.kind===`turn`?vm:mm)[a.kind][+!i],a.round!=null&&(0,J.jsx)(`em`,{className:`submap-round`,children:i?`第 ${a.round} 轮`:`Round ${a.round}`})]}),(0,J.jsx)(`small`,{"data-verdict":a.source===`team`&&K(h(a).teamOutcome)||void 0,children:a.completionScope&&a.status===`recorded`?i?`执行结束`:`Execution ended`:a.source===`team`&&de(a)===`failed`?i?`失败`:`Failed`:a.source===`team`&&Re(h(a).teamOutcome,i)||ve(de(a))})]}),(0,J.jsx)(`h4`,{children:(0,J.jsx)(Me,{children:a.title})}),(0,J.jsx)(`div`,{className:`submap-step-copy`,children:(0,J.jsx)(Me,{children:L(a)?.summary||h(a).summary||a.detail||he(i)})}),(0,J.jsxs)(`div`,{className:`submap-step-foot`,children:[(0,J.jsxs)(`span`,{title:bm(a,i),children:[i?`查看详情`:`Read more`,a.workCount?(0,J.jsx)(`em`,{className:`submap-step-work`,children:i?` · ${a.workCount} 步操作`:` · ${a.workCount} actions`}):null]}),(0,J.jsx)(oe,{size:14})]})]},a.id)}),t.partCount>1&&!D&&(0,J.jsxs)(`nav`,{className:`macro-part-nav nodrag nopan`,"aria-label":i?`任务各部分`:`Task parts`,children:[(0,J.jsx)(`span`,{children:B}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`button`,{disabled:!t.previousId,onClick:()=>t.previousId&&t.open(t.previousId,!0),children:[(0,J.jsx)(it,{size:14}),i?`上一部分`:`Previous part`]}),(0,J.jsxs)(`button`,{disabled:!t.nextId,onClick:()=>t.nextId&&t.open(t.nextId,!0),children:[i?`下一部分`:`Next part`,(0,J.jsx)(oe,{size:14})]})]})]}),D&&ge&&(0,J.jsxs)(`section`,{className:`macro-reader nodrag nopan nowheel`,"data-testid":`map-reader`,"data-kind":D.kind,role:`region`,"aria-label":i?`卡片详情`:`Card details`,style:{left:ge.x,top:ge.y,width:ge.width,height:ge.height},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(fe(D),{x:e.clientX,y:e.clientY})},children:[(0,J.jsxs)(`header`,{children:[(0,J.jsxs)(`span`,{children:[(n.kind===`turn`?vm:mm)[D.kind][+!i],n.turn_kind!==`qa`&&(0,J.jsx)(`small`,{className:`macro-reader-note`,children:_m[D.kind][+!i]})]}),(0,J.jsx)(`button`,{"aria-label":`Close step details`,onClick:()=>{x(null),p(null),t.readCopy?.(e,null),t.open(e)},children:(0,J.jsx)(v,{size:20})})]}),(0,J.jsx)(`h3`,{children:(0,J.jsx)(Me,{children:L(D)?.title||D.title})}),(0,J.jsx)(`div`,{className:`macro-reader-body`,children:(0,J.jsx)(Se,{cardKey:D.id,taskId:n.id,card:L(D),task:n,readOnly:t.readOnly,originalDetail:D.detail||he(i),selection:t.readerCopy,artifacts:c,onOpenArtifact:l})}),(0,J.jsxs)(`footer`,{children:[(0,J.jsx)(`span`,{title:bm(D,i),children:O?new Date(O*1e3).toLocaleString(i?`zh-CN`:`en-US`):``}),!t.readOnly&&(0,J.jsx)(`button`,{onClick:()=>t.quote(fe(D)),children:i?`引用此项`:`Reference`})]})]})]})]})});function Sm(e){if(!(e>0)||!Number.isFinite(e))return e;let t=Math.floor(Math.log2(e)*4+1e-9)/4;return Math.round(2**t*1e4)/1e4}function Cm(e,t){let n=Sm(t);if(e==null||!(e>0))return n;let r=Math.log2(t/e)*4;return r<-2||r>=3?n:e}function wm(){let e=null,t=new Set;return{get:()=>e,set(n){n!==e&&(e=n,t.forEach(e=>e()))},subscribe(e){return t.add(e),()=>void t.delete(e)}}}var Tm=(0,Y.createContext)(null),Em=()=>()=>{};function Dm(e){let t=(0,Y.useContext)(Tm),n=()=>{let n=t?.get();return n==null?null:e(n)},r=(0,Y.useSyncExternalStore)(t?t.subscribe:Em,n,n),i=$(t=>r===null?e(Sm(t.transform[2])):null);return r??i}function Om(e){let t={};for(let n of e)(t[n.node_id]??=[]).push(n);for(let e of Object.values(t))e.sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));return t}var km={width:640,height:190},Am={width:1440,height:640},jm={"idea-route":ut,"idea-review":m,"idea-selector":st},Mm={done:`✓`,failed:`✕`,question:`?`,paused:`‖`,running:`▶`,superseded:`↪`},Nm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],question:[`待答复`,`Needs input`],paused:[`已暂停`,`Paused`],aborted:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已替代`,`Superseded`],unknown:[`已记录`,`Recorded`]},Pm=(0,Y.memo)(function({data:e}){let{task:t,zh:n,fanIndex:r,fanCount:i}=e,a=He(t),o=t.group,s=o?ee:t.overflow_count?le:jm[t.team_role??``]??E,c=o?``:Re(t.team_outcome,n),l=o?``:K(t.team_outcome),u=c||(Nm[a]??Nm.unknown)[+!n],d=l===`rejected`?`✕`:l===`chosen`?`★`:Mm[a],f=!o&&typeof r==`number`&&typeof i==`number`,p=o?.expanded?n?`收起`:`Fold`:n?`展开`:`Unfold`;return(0,J.jsxs)(`button`,{type:`button`,className:`map-branch map-state-${a}${o?` map-branch-group`:``} nodrag nopan`,"data-testid":`map-branch`,"data-branch-id":t.id,"data-status":a,"data-verdict":l||void 0,"data-overflow":!!t.overflow_count,"data-group":!!o,"data-expanded":o?o.expanded:void 0,"aria-expanded":o?o.expanded:void 0,title:t.excerpt||t.objective||t.title,"aria-label":o?`${t.title} · ${p}`:`${t.title} · ${u} · ${n?`打开所属任务`:`Open the owning task`}`,onClick:()=>o?e.toggleGroup?.(t.id):e.open(e.parentCardId),children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,J.jsx)(Ud,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,J.jsx)(`span`,{className:`map-branch-glyph`,"aria-hidden":`true`,children:(0,J.jsx)(s,{})}),d&&(0,J.jsx)(`span`,{className:`map-branch-state`,"aria-hidden":`true`,children:d}),(0,J.jsx)(`span`,{className:`map-branch-title`,children:t.title}),c&&(0,J.jsx)(`span`,{className:`map-branch-verdict`,"data-testid":`map-branch-verdict`,children:c}),f&&(0,J.jsx)(`span`,{className:`map-branch-fan`,"data-testid":`map-branch-fan`,title:n?`并行分支 ${r} / ${i}`:`Parallel branch ${r} of ${i}`,children:`${r}/${i}`}),o&&(0,J.jsxs)(`span`,{className:`map-branch-toggle`,"data-testid":`map-branch-toggle`,"aria-hidden":`true`,children:[p,o.expanded?(0,J.jsx)(h,{}):(0,J.jsx)(oe,{})]}),(0,J.jsx)(`span`,{className:`map-branch-dot`,"aria-hidden":`true`})]})}),Fm={x:52,y:125,zoom:.24},Im=.01,Lm=3.5,Rm=(e,t,n)=>Math.max(t,Math.min(n,e));function zm(e,t){let n=e.querySelector(t)?.getBoundingClientRect();return n&&n.width>0&&n.height>0?n:void 0}function Bm(e,t=!1){let n=e.getBoundingClientRect(),r=zm(e,`.map-canvas-toolbar`),i=zm(e,`.map-composer-dock`),a=zm(e,`.react-flow__minimap`),o=zm(e,`.map-legend`),s=zm(e,`.react-flow__controls`),c=e.dataset.reading===`true`||t&&e.clientWidth<640,l=e.clientWidth<640?20:50,u=Math.max(r?r.bottom-n.top+20:85,!c&&e.clientWidth<640&&o?o.bottom-n.top+16:0,!c&&e.clientWidth<640&&s?s.bottom-n.top+16:0),d=Math.max(i?n.bottom-i.top+24:100,!c&&a?n.bottom-a.top+20:0);return{x:l,y:u,width:Math.max(180,e.clientWidth-l*2),height:Math.max(100,e.clientHeight-u-d)}}var Vm=.72,Hm=.85,Um=(e,t)=>e?0:t;function Wm(e,t,n){let r=Math.min(t.width/n.width,t.height/n.height),i=Math.min(e.width,e.height)/Math.min(n.width,n.height);return Math.min(Math.max(r,Vm*i),Hm*i)}function Gm(e,t,n,r,i){let a=r||1;if(e.width<640&&i?.stacked&&i.width>0)return t.width/(i.width*a);let o=Wm(e,t,n),s=e.width<640||(i?.steps.length??0)>20?.6/a:0,c=e.width>=1024?1/a:0;return Math.max(o,s,c)}function Km(e,t,n){let r=Rm(Math.min(t.width/(n.width+160),t.height/(n.height+160)),Im,.27),i=(e,t,n,r)=>r>t?(n-r)/2:Rm((n-r)/2,e,e+t-r);return{x:i(t.x,t.width,e.width,n.width*r)-n.x*r,y:i(t.y,t.height,e.height,n.height*r)-n.y*r,zoom:r}}function qm(e,t,n){let r=Math.min(48,e.height*.35),i=e.height-r,a=Math.min(Lm,Math.min(1.05,e.width/n.width,i/n.height)/n.scale);return{x:e.x+e.width/2-(t.x+(n.x+n.width/2)*n.scale)*a,y:e.y+r+i/2-(t.y+(n.y+n.height/2)*n.scale)*a,zoom:a}}function Jm(e,t=!0){let n=gd(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)({width:0,height:0}),l=(0,Y.useRef)(null),u=(0,Y.useRef)(!1),d=(0,Y.useRef)(!1),f=(0,Y.useRef)(!1),p=(0,Y.useRef)(),m=(0,Y.useRef)(()=>{}),h=(0,Y.useRef)(null),g=(0,Y.useRef)(null),_=(0,Y.useRef)(()=>{}),v=(0,Y.useRef)(()=>{}),[y,b]=(0,Y.useState)(()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),x=(0,Y.useRef)(Fm),S=(0,Y.useRef)(null),C=(0,Y.useRef)(null),w=(0,Y.useRef)(null),T=(0,Y.useRef)(0),E=(0,Y.useRef)(null),D=(0,Y.useRef)(0);(0,Y.useEffect)(()=>()=>window.clearTimeout(D.current),[]);let[O]=(0,Y.useState)(wm),k=(0,Y.useCallback)((e,t)=>{O.get()!==t&&(e.style.setProperty(`--map-zoom-step`,String(t)),O.set(t))},[O]),A=(0,Y.useCallback)(()=>{cancelAnimationFrame(T.current),T.current=0,E.current=null},[]),j=(0,Y.useCallback)((t,r)=>{t&&(f.current=!1,d.current=!1);let a=e.current;if(!a)return;a.dataset.moving||(a.dataset.moving=`true`),window.clearTimeout(D.current),D.current=window.setTimeout(()=>{delete a.dataset.moving,k(a,Sm(n.getZoom()))},180);let s={x:a.clientWidth/2,y:a.clientHeight/2},c=S.current&&S.current.until>performance.now()?S.current:s,p=C.current??(u.current?h.current:null)??V(n.getNodes().filter(e=>e.data.frame),r,c,s),m=p&&(n.getNode(p)?.data)?.frame?.scale||1,g=Rm((r.zoom-.3)/.14,0,1)*Rm((r.zoom*m-.28)/.3,0,1),_=w.current,v=u.current?1:_?.id===p?Rm((r.zoom-_.zoom*.65)/(_.zoom*.35),0,1):g;l.current=v>0?p:null,a.style.setProperty(`--detail-alpha`,String(v)),a.style.setProperty(`--summary-alpha`,String(1-v)),a.style.setProperty(`--context-alpha`,String(p?1-v*.72:1)),a.dataset.zoom=r.zoom.toFixed(2),k(a,Cm(O.get(),r.zoom)),i(v>0&&p?p:null),o(!!p&&v>=.55),r.zoom<=.32&&!C.current&&!E.current&&!w.current&&(x.current=r)},[n,e,k,O]),M=(0,Y.useCallback)(t=>{let r=f.current;f.current=!1,A();let i=n.getNode(t),a=e.current;if(!i||!a)return;!r&&n.getZoom()<=.32&&!w.current&&(x.current=n.getViewport()),C.current=t,u.current=!1,delete a.dataset.reading,d.current=!0;let o=Bm(a,!0),s=i.width||1440,c=i.height||1080,l=Rm(Gm({width:a.clientWidth,height:a.clientHeight},o,{width:s,height:c},i.data.frame?.scale||1,i.data.layout),Im,Lm);w.current={id:t,zoom:l};let p=o.x+Math.max(0,(o.width-s*l)/2)-i.position.x*l,m=o.y+Math.max(0,(o.height-c*l)/2)-i.position.y*l;n.setViewport({x:p,y:m,zoom:l},{duration:Um(y,380)}).then(()=>{C.current=null})},[A,n,y,e]);v.current=M;let N=(0,Y.useCallback)(()=>{f.current=!1,A(),C.current=null,u.current=!1,e.current&&delete e.current.dataset.reading,d.current=!1,w.current=null,S.current=null;let t=e.current?.querySelector(`.map-macro[data-focused="true"]`)?.dataset.cardId;n.setViewport(x.current,{duration:Um(y,320)}).then(()=>{t&&e.current?.querySelector(`[data-testid="map-card"][data-card-id="${CSS.escape(t)}"]`)?.focus({preventScroll:!0})})},[A,n,y,e]),P=(0,Y.useCallback)((t,r)=>{f.current=!1,A(),C.current=t;let i=n.getNode(t),a=e.current;!i||!a||(u.current=!0,a.dataset.reading=`true`,d.current=!0,h.current=t,g.current={id:t,rect:r},n.setViewport(qm(Bm(a),i.position,r),{duration:Um(y,340)}).then(()=>{C.current=null}))},[A,n,y,e]);_.current=P;let F=(0,Y.useCallback)(e=>{f.current=!1,A(),u.current=!1,d.current=!1,C.current=null,S.current=null,n.setCenter(e.x,e.y,{zoom:n.getZoom(),duration:Um(y,180)})},[A,n,y]),I=(0,Y.useCallback)(t=>{f.current=!0,p.current=t,A(),C.current=null,u.current=!1,d.current=!1,w.current=null,S.current=null;let r=e.current;r&&delete r.dataset.reading;let i=n.getNodes().filter(e=>!e.hidden&&(!t||t.has(e.data.task.id)));if(!r||!i.length)return;let a=Km({width:r.clientWidth,height:r.clientHeight},Bm(r),n.getNodesBounds(i));t||(x.current=a),n.setViewport(a,{duration:Um(y,320)})},[A,n,y,e]);m.current=()=>I(p.current);let L=(0,Y.useCallback)(()=>{f.current?m.current():d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&v.current(l.current)},[]);return(0,Y.useEffect)(()=>{let t=e.current;if(!t)return;let n,r=t.querySelector(`.map-composer-dock`),i=-1,a=-1,o=-1,s=new ResizeObserver(()=>{let e=r?.getBoundingClientRect().height||0;(i!==t.clientWidth||a!==t.clientHeight||o!==e)&&(i=t.clientWidth,a=t.clientHeight,o=e,t.style.setProperty(`--map-composer-height`,`${o}px`),c(e=>e.width===i&&e.height===a?e:{width:i,height:a}),clearTimeout(n),n=setTimeout(()=>{d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&!u.current?v.current(l.current):f.current&&m.current()},100))});return s.observe(t),r&&s.observe(r),()=>{s.disconnect(),clearTimeout(n)}},[e,t]),(0,Y.useEffect)(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,Y.useEffect)(()=>{let t=e.current;if(!t)return;let r=e=>{if(e.target.closest(`.nowheel, .map-canvas-toolbar, .map-legend, .react-flow__minimap, .react-flow__controls`))return;e.preventDefault(),e.stopPropagation(),f.current=!1,u.current=!1,d.current=!0,C.current=null;let r=t.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top;S.current={x:i,y:a,until:performance.now()+1e3};let o=E.current??n.getViewport();!E.current&&o.zoom<=.32&&!w.current&&(x.current=o);let s=e.deltaY*(e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1),c=Rm(o.zoom*Math.exp(-Rm(s,-400,400)*.002),Im,Lm);if(E.current={x:i-(i-o.x)*c/o.zoom,y:a-(a-o.y)*c/o.zoom,zoom:c},y){n.setViewport(E.current),E.current=null;return}if(T.current)return;let l=performance.now(),p=e=>{if(!E.current)return;let t=1-Math.exp(-Math.min(e-l,64)/55);l=e;let r=n.getViewport(),i=E.current,a=Math.abs(i.zoom-r.zoom)<15e-5&&Math.abs(i.x-r.x)+Math.abs(i.y-r.y)<.15;n.setViewport(a?i:{x:r.x+(i.x-r.x)*t,y:r.y+(i.y-r.y)*t,zoom:r.zoom+(i.zoom-r.zoom)*t}),a?(T.current=0,E.current=null):T.current=requestAnimationFrame(p)};T.current=requestAnimationFrame(p)},i=()=>{A(),C.current=null,S.current=null},a=e=>{e.defaultPrevented||document.querySelector(`[role="dialog"][aria-modal="true"]`)||e.key===`Escape`&&![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&N()};return t.addEventListener(`wheel`,r,{passive:!1,capture:!0}),t.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a),()=>{A(),t.removeEventListener(`wheel`,r,!0),t.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a)}},[N,A,n,y,e]),{capture:(0,Y.useCallback)(()=>({viewport:n.getViewport(),overview:x.current,focusId:l.current,detailed:!!l.current&&(u.current||!!w.current||n.getZoom()>=.44)}),[n]),restore:(0,Y.useCallback)(e=>{A(),x.current=e.overview;let t=e.focusId&&n.getNode(e.focusId)?e.focusId:null;C.current=e.detailed?t:null,w.current=e.detailed&&t?{id:t,zoom:e.viewport.zoom}:null,d.current=!1,f.current=!1,n.setViewport(e.viewport,{duration:0}),j(null,e.viewport)},[A,n,j]),focusId:r,canvasSize:s,detailed:a,enter:M,back:N,fit:I,fitUpdatedScene:L,navigate:F,readStep:P,onMove:j,reducedMotion:y,zoomSteps:O}}function Ym(e,t,n,r=n){if(!n||!r)return[];let i=e.tasks.find(e=>e.id===n);if(!i||i.turn_kind===`qa`)return[];if(r===n)return[Pe(i,Fe(e,i,i.started_ts??0))];let a=new Map(e.events.map(e=>[e.id,e.item_id]));return ie(e,t,n).filter(e=>e.task_id===n&&e.key===r&&e.event_ids.every(e=>!a.get(e)||a.get(e)===n))}function Xm(e,t){let n=new Map(e.events.map(e=>[e.id,e]));return JSON.stringify(t.map(t=>{let r=e.tasks.find(e=>e.id===t.task_id),i=[t.task_id,`${t.task_id}:active`,`${t.task_id}:outcome`].includes(t.key),a=!r||i?r:{...r,status:``,summary:void 0,outcome:void 0,pending_question:void 0,started_ts:void 0,finished_ts:void 0,attempt:void 0};return[t,N(a,t.event_ids.flatMap(e=>n.get(e)?[n.get(e)]:[]))]}))}function Zm(e,t,n,r=600){let i=e=>[`done`,`failed`,`cancelled`,`recorded`,`skipped`].includes(e||``),a=e.tasks.filter(e=>e.id!==n&&e.turn_kind!==`qa`),o=[...a.filter(e=>i(e.status)),...a.filter(e=>!i(e.status))],s=[];for(let n of o){if(s.length>=r)break;s.push(...rt(e,n,ge(n,e.events,t)))}return s.slice(0,r)}function Qm(e,t,n,r=!0,a,c,u=!1,p=t,m){let h=n?`zh-CN`:`en-US`,g=e.kind===`live`?`project`:`dataset`,_=e.id.replace(/^live:/,``),v=l(),y=et(c??_,h),b=v===`question-foundation`?m===void 0?y.id:m:null,x=v===`question-foundation`&&!b,S=f(g,_,h,c,v,b),C=o(),w=i({queryKey:S,queryFn:async({signal:e})=>{let t=v===`question-foundation`?await d.mapCopy(g,_,h,e,c,v,b):await d.mapCopy(g,_,h,e,c,v),n=C.getQueryData(S);return se(n,t,n?.model_revision)},staleTime:1/0,gcTime:72e5,refetchOnWindowFocus:!1}),T=e.tasks.find(e=>e.id===t),E=Qe(S,p,I(p,T)),D=(0,Y.useMemo)(()=>a??(T?ge(T,e.events,n):[]),[T,e.events,n,a]),[O,k]=(0,Y.useState)(0),[A,j]=(0,Y.useState)(!1),M=(0,Y.useRef)(!0),N=(0,Y.useRef)(null),P=(0,Y.useMemo)(()=>new Map(e.events.map(e=>[e.id,e])),[e.events]),F=u?ie(e,D,t):Ym(e,D,t,p),L=(0,Y.useMemo)(()=>u?Zm(e,n,t):[],[e,n,t,u]),R=[...F,...L].filter(t=>e.tasks.find(e=>e.id===t.task_id)?.turn_kind!==`qa`).filter(t=>ue(t,e,w.data,P)).slice(0,8),z=Xm(e,R),B=[`map-copy-generation`,g,_,h,c],ee=[...B,v,...v===`question-foundation`?[b]:[],w.data?.version??null,w.data?.model_revision??null,z],te=JSON.stringify(ee),V=s({queryKey:B}),H={queryKey:ee,queryFn:async()=>{let t=w.data?.model_revision,n=pe(C,S,R.map(t=>({key:t.key,startedAt:I(t.key,e.tasks.find(e=>e.id===t.task_id))}))),r;try{r=await d.generateMapCopy(g,_,{cards:R,locale:h,...b?{foundation_id:b}:{}},void 0,c,v,n.update)}finally{n.finish()}return C.setQueryData(S,e=>se(e,r,t)),{available:!r.retry_after&&r.available!==!1&&R.every(t=>!ue(t,e,r,P)),retryAfter:typeof r.retry_after==`number`&&r.retry_after>0?r.retry_after:null}},staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1},U=i({...H,enabled:!1}),ne=U.isSuccess&&U.data.available===!1?U.data.retryAfter:null,re=(0,Y.useMemo)(()=>w.data?.generation_error?Error(w.data.generation_error.message):null,[w.data?.generation_error?.code,w.data?.generation_error?.message]),ae=()=>{let e=C.fetchQuery({...H,staleTime:0});return N.current=e,j(!0),e.then(()=>void 0,()=>void 0).finally(()=>{N.current===e&&(N.current=null,M.current&&(j(!1),k(e=>e+1)))}),e};(0,Y.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]),(0,Y.useEffect)(()=>{if(!r||x||!w.data?.available||!R.length||U.isError||U.isSuccess&&!ne||V>0||N.current)return;let e=w.data.generation_error&&typeof w.data.retry_after==`number`&&w.data.retry_after>0?w.data.retry_after:0,t=Math.max(ne?U.dataUpdatedAt+ne*1e3:0,e?w.dataUpdatedAt+e*1e3:0),n=setTimeout(()=>{C.isFetching({queryKey:B})===0&&ae()},Math.max(700,t-Date.now()));return()=>clearTimeout(n)},[te,O,w.data?.available,w.data?.retry_after,w.dataUpdatedAt,r,x,V,U.status,U.dataUpdatedAt]);let oe=A||U.isFetching||V>0;return{copy:w.data,generating:oe,ready:w.isFetched,foundationRequired:x,questionContext:{locale:h,preview:v,foundationId:b},readingGenerating:E.active,generationPhase:E.phase,generationError:R.length&&!U.isFetching&&!E.active?U.error||re:null,generationUnavailable:!!R.length&&!U.isFetching&&!E.active&&!ne&&U.data?.available===!1,retry:async()=>{!r||x||!w.data?.available||!R.length||oe||N.current||await ae().catch(()=>void 0)},readingRequest:F.find(e=>e.key===p),readingNeedsUpdate:U.data?.available!==!0&&R.some(e=>e.key===p)}}var $m=new Set([`done`,`failed`,`cancelled`,`recorded`,`skipped`,`aborted`,`superseded`]);function eh(e,t,n,r,a){let o=n?`zh-CN`:`en-US`,s=e.kind===`live`?`project`:`dataset`,c=e.id.replace(/^live:/,``),l=(0,Y.useMemo)(()=>{let n=new Map(e.tasks.map(e=>[e.id,$m.has(e.status||``)])),r=t.filter(e=>n.has(e.source)&&n.has(e.target)).slice(0,48);return JSON.stringify(r.map(e=>[e.source,e.target,n.get(e.source),n.get(e.target)]))},[e.tasks,t]),u=(0,Y.useMemo)(()=>JSON.parse(l).map(([e,t])=>({source:e,target:t})),[l]),f=[`map-lines`,s,c,o,a,l],p=i({queryKey:[...f,`saved`],queryFn:({signal:e})=>d.mapLines(s,c,{pairs:u,locale:o,write:!1},e,a),enabled:u.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...f,`written`],queryFn:({signal:e})=>d.mapLines(s,c,{pairs:u,locale:o,write:!0},e,a),enabled:u.length>0&&r&&p.data?.available===!0&&p.data.lines.lengthJSON.stringify(e.tasks.filter(e=>e.kind!==`turn`&&e.turn_kind!==`qa`).slice(-40).map(e=>[e.id,nh.has(e.status||``)])),[e.tasks]),l=(0,Y.useMemo)(()=>JSON.parse(c).map(([e])=>e),[c]),u=[`map-card-words`,o,s,a,r,c],f=i({queryKey:[...u,`saved`],queryFn:({signal:e})=>d.mapCardWords(o,s,{tasks:l,locale:a,write:!1},e,r),enabled:l.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...u,`written`],queryFn:({signal:e})=>d.mapCardWords(o,s,{tasks:l,locale:a,write:!0},e,r),enabled:l.length>0&&n&&f.data?.available===!0&&Object.keys(f.data.cards).length`u`||typeof window.matchMedia!=`function`?!1:window.innerWidth>=1024&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function oh({footer:e,value:t,onChange:n,onSend:r,attachments:i,onAttachmentsChange:a,pending:o,pendingLabel:s,progressVisible:l=!0,dispatchStatus:u,onCancel:d,focusSignal:f,sessionName:m,historical:_,zh:y,routeOverride:b=`auto`,onRouteOverrideChange:x}){let{t:S}=p(),C=(0,Y.useId)(),w=(0,Y.useRef)(null),T=(0,Y.useRef)(null),E=(0,Y.useRef)(null),D=(0,Y.useRef)(!1),k=(0,Y.useRef)(!0),A=(0,Y.useRef)(),[M,N]=(0,Y.useState)(``),[P,F]=(0,Y.useState)(!1),[I,L]=(0,Y.useState)(!1),[R,z]=(0,Y.useState)(()=>!!(t.trim()||i.length)||ah()),[B,ee]=(0,Y.useState)(44),te=(0,Y.useRef)(t);te.current=t;let V=!R,{refs:H,text:ne}=fe(t),re=t.length>Le,ie=!!(t.trim()||i.length),ae=(0,Y.useRef)(ie);ae.current=ie,(0,Y.useEffect)(()=>{u===`error`&&z(!0)},[u]),(0,Y.useEffect)(()=>{k.current=!0;let e=e=>{let t=e.type===`focusout`?e.relatedTarget:e.target;t?.closest?.(`.map-island-launch, .map-island-stop, .map-composer-brand`)||(T.current?.contains(t)?z(!0):ae.current||z(!1))},t=e=>{let t=e.target;T.current?.contains(t)||t?.closest?.(`.map-context-menu`)||ae.current||(z(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur())},n=e=>{if(e.key!==`c`||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||e.isComposing)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)||t?.closest?.(`[role="dialog"], [role="menu"]`)||(e.preventDefault(),z(!0),w.current?.focus())};return document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e),document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{k.current=!1,clearTimeout(A.current),document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[]);let oe=(0,Y.useRef)(f);(0,Y.useEffect)(()=>{f!==oe.current&&(oe.current=f,z(!0),w.current?.focus())},[f]);let se=(0,Y.useRef)(H.length);(0,Y.useEffect)(()=>{H.length>se.current&&(z(!0),w.current?.focus()),se.current=H.length},[H.length]);let ce=()=>{if(!w.current)return;w.current.style.height=`0px`;let e=Math.min(156,Math.max(44,w.current.scrollHeight));w.current.style.height=`${e}px`,ee(e)};(0,Y.useEffect)(ce,[ne]),(0,Y.useEffect)(()=>(window.addEventListener(`resize`,ce),()=>window.removeEventListener(`resize`,ce)),[]);let le=()=>{z(!0),w.current?.focus()},ue=()=>{z(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur()},de=(0,Y.useRef)(),pe=(0,Y.useRef)(typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches);(0,Y.useEffect)(()=>()=>clearTimeout(de.current),[]);let me=()=>{pe.current&&(clearTimeout(de.current),z(!0))},G=()=>{pe.current&&(clearTimeout(de.current),de.current=setTimeout(()=>{ae.current||T.current?.contains(document.activeElement)||z(!1)},320))};(0,Y.useEffect)(()=>{o||L(!1)},[o]);let he=async()=>{if(!ne.trim()||D.current||re)return;let e=o;if(e&&i.length){N(y?`附件要等这条回复结束后再发送`:`Attachments can be sent once this reply finishes`);return}D.current=!0;try{(e?await r(t,[],void 0,{whileRunning:!0}):await r(t,i))&&k.current&&(N(``),F(!0),L(e),(!te.current.trim()||te.current===t)&&ue(),clearTimeout(A.current),A.current=setTimeout(()=>F(!1),1800))}finally{D.current=!1}},ge=e=>{if(o||D.current||!e.length)return;let{accepted:t,issues:n}=Ye(i,e);a([...i,...t]),N(n.map(e=>e.code===`unsupported`?S(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?S(`chat.attachTooLarge`,{name:e.fileName,size:O(e.limitBytes)}):e.code===`too-many`?S(`chat.attachTooMany`,{count:e.limitCount}):S(`chat.attachTotalTooLarge`,{size:O(e.limitBytes)})).join(` `))},_e=u?{launching:[y?`任务已接收`:`Task accepted`,y?`正在放入地图…`:`Adding it to your map…`],task:[y?`任务已进入地图`:`Your task is on the map`,y?`跟随地图,查看执行进展`:`Follow its progress on the map`],message:[y?`${c().name} 已回复`:`${c().name} replied`,y?`在对话中查看回复`:`Open the conversation to read it`],error:[y?`发送没有成功`:`Message could not be sent`,y?`草稿已保留,可以重试`:`Your draft is ready to retry`],cancelled:[y?`正在停止回复`:`Stopping reply`,y?`可以发送新消息`:`You can send another message`]}[u]:void 0,ve=[y?`已排队`:`Queued`,y?`这条回复结束后立即处理`:`Answered right after this reply`],ye=_e?.[0]||(o&&I?ve[0]:o?l?y?`${c().name} 正在处理`:`${c().name} is working`:y?`继续对话`:`Continue chatting`:P?y?`已发送给 ${c().name}`:`Sent to ${c().name}`:y?`交给 ${c().name}`:`Ask ${c().name}`),be=_e?.[1]||(o&&I?ve[1]:o?l?s||(y?`正在处理你的消息…`:`Processing your message…`):y?`可发送后续消息或停止回复`:`Send a follow-up or stop the reply`:P?y?`点此继续对话`:`Tap to keep the conversation going`:ie?y?`草稿已保留,点此继续`:`Draft saved — tap to continue`:y?`描述目标,看它变成成果`:`Turn your next idea into a result`),xe=u||(o?`working`:P?`sent`:`idle`);return(0,J.jsxs)(`div`,{ref:T,className:`map-composer-dock map-island-dock`,"data-compact":V,"data-state":xe,"data-pending":o,style:{"--map-editor-height":`${B}px`},onPointerEnter:me,onPointerLeave:G,onTransitionEnd:e=>{e.target===T.current&&e.propertyName===`width`&&ce()},children:[!V&&H.length>0&&(0,J.jsx)(`div`,{className:`map-reference-chips`,children:H.map((e,t)=>(0,J.jsxs)(`span`,{title:`${e.source} · ${e.task_id} ${e.step_id||``}`,children:[(0,J.jsxs)(`span`,{children:[y?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,J.jsx)(`button`,{"aria-label":y?`移除引用`:`Remove reference`,onClick:()=>n(H.filter((e,n)=>t!==n).map(U).join(``)+ne),children:(0,J.jsx)(v,{size:12})})]},`${e.task_id}:${e.step_id}:${t}`))}),!V&&!!i.length&&(0,J.jsx)(`div`,{className:`map-attachment-tray nowheel`,role:`group`,"aria-label":y?`待发送附件`:`Selected attachments`,children:i.map((e,t)=>(0,J.jsx)(Ke,{file:e,disabled:o,removeLabel:S(`chat.attachRemove`,{name:e.name}),onRemove:()=>{a(i.filter(t=>t!==e)),N(``)}},`${e.name}:${e.lastModified}:${t}`))}),!V&&M&&(0,J.jsx)(`div`,{className:`map-attachment-notice nowheel`,role:`alert`,children:M}),(0,J.jsxs)(`div`,{className:`map-composer map-island-surface`,children:[(0,J.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":S(`chat.attach`),title:S(`chat.attach`),"aria-hidden":V,tabIndex:V?-1:0,disabled:o&&!V,onClick:()=>E.current?.click(),children:(0,J.jsx)(j,{size:25})}),(0,J.jsxs)(`button`,{type:`button`,className:`map-island-launch`,"aria-label":y?`打开消息输入`:`Open message composer`,"aria-expanded":!V,"aria-controls":C,"aria-hidden":!V,tabIndex:V?0:-1,onClick:le,children:[(0,J.jsxs)(`span`,{className:`map-island-copy`,children:[(0,J.jsx)(`strong`,{children:ye}),(0,J.jsx)(`small`,{title:be,children:be})]}),(0,J.jsx)(`span`,{className:`map-island-indicator`,"aria-hidden":`true`,children:xe===`working`||xe===`launching`?(0,J.jsxs)(`span`,{className:`map-island-wave`,children:[(0,J.jsx)(`i`,{}),(0,J.jsx)(`i`,{}),(0,J.jsx)(`i`,{})]}):xe===`sent`||xe===`task`||xe===`message`?(0,J.jsx)(g,{size:16}):(0,J.jsx)(ot,{size:15})})]}),V&&o&&(0,J.jsx)(`button`,{type:`button`,className:`map-island-stop`,onClick:d,"aria-label":y?`停止回复`:`Stop reply`,children:(0,J.jsx)(Ce,{size:13})}),(0,J.jsxs)(`form`,{id:C,className:`map-composer-editor`,"aria-hidden":V,onSubmit:e=>{e.preventDefault(),he()},children:[(0,J.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:we,hidden:!0,disabled:o,onChange:e=>{ge(Array.from(e.target.files||[])),e.target.value=``}}),(0,J.jsx)(`textarea`,{ref:w,rows:1,tabIndex:V?-1:0,value:ne,"aria-label":y?`给 ${c().name} 发送消息`:`Message ${c().name}`,placeholder:y?`告诉 ${c().name},你想完成什么…`:`What would you like ${c().name} to do?`,onFocus:()=>z(!0),onChange:e=>{F(!1),n(H.map(U).join(``)+e.target.value)},onPaste:e=>{let t=Te(e.clipboardData);t.length&&(e.preventDefault(),ge(t))},onKeyDown:e=>{e.key===`Escape`&&!Oe(e)&&!ne.trim()&&!i.length&&(e.preventDefault(),e.stopPropagation(),ue()),e.key===`Enter`&&!e.shiftKey&&!Oe(e)&&(e.preventDefault(),he())}}),(0,J.jsxs)(`div`,{className:`map-island-toolbar`,children:[(0,J.jsx)(`button`,{type:`button`,className:`map-island-collapse`,tabIndex:V?-1:0,onClick:ue,"aria-label":y?`收起消息输入`:`Collapse message composer`,title:y?`收起(草稿会保留)`:`Collapse (draft is kept)`,children:(0,J.jsx)(h,{size:15})}),x&&(0,J.jsx)(Ve,{value:b,onChange:x,disabled:o,tabIndex:V?-1:0}),o&&(0,J.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),d()},tabIndex:V?-1:0,"aria-label":y?`停止回复`:`Stop reply`,className:`map-send is-pending`,children:(0,J.jsx)(Ce,{size:15})},`stop`),(0,J.jsx)(`button`,{type:`submit`,tabIndex:V?-1:0,disabled:!ne.trim()||re,"aria-label":o?y?`在 ${c().name} 工作时发送`:`Send while ${c().name} works`:y?`发送消息`:`Send message`,title:o?y?`排队到这条回复之后处理`:`Queued right after this reply`:void 0,className:`map-send`,children:(0,J.jsx)(W,{size:20})},`send`)]})]})]}),re&&(0,J.jsx)(`p`,{role:`alert`,className:`mt-1 px-3 text-xs text-err`,children:S(`chat.messageTooLong`)}),e,(0,J.jsx)(`span`,{className:`map-composer-caption`,role:`status`,children:_e?`${_e[0]} · ${_e[1]}`:o&&I?`${ve[0]} · ${ve[1]}`:o?``:P?y?`已发送`:`Sent`:_?`${y?`发送至`:`Send to`} ${m}`:``})]})}function sh(e,t,n){if(e.length<2)return``;let r=[0];for(let t=1;t0))return``;let a=Math.min(n,i/3),o=a*1.22,s=1,c=t=>{let n=Math.max(0,Math.min(i,t));for(;s1&&r[s-1]>n;)s--;let a=r[s]-r[s-1]||1,o=(n-r[s-1])/a,c=e[s-1],l=e[s];return{x:c.x+(l.x-c.x)*o,y:c.y+(l.y-c.y)*o}},l=e=>e*e*(3-2*e),u=e=>{let n=i-e;if(n<=a)return t*2.5*(n/a)**.85;let r=t*(.34+.66*l(Math.min(1,e/Math.max(1,i-o))));return n>=o?r:r+(t*2.5-r)*l((o-n)/(o-a))},d=Math.max(12,Math.min(72,Math.round(i/Math.max(a,1)*1.5))),f=Array.from({length:d+1},(e,t)=>(i-o)*(t/d));f.push(i-(o+a)/2,i-a,i);let p=[],m=[],h=e=>Math.round(e*100)/100;for(let e of f){let t=c(e),n=c(e-i*.004-.5),r=c(e+i*.004+.5),a=r.x-n.x,o=r.y-n.y,s=Math.hypot(a,o)||1,l=u(e)/2,d=-o/s*l,f=a/s*l;p.push(`${h(t.x+d)} ${h(t.y+f)}`),m.push(`${h(t.x-d)} ${h(t.y-f)}`)}return`M ${p.join(` L `)} L ${m.reverse().join(` L `)} Z`}function ch(e,t){let n=1-t;return{x:n**3*e[0].x+3*n**2*t*e[1].x+3*n*t**2*e[2].x+t**3*e[3].x,y:n**3*e[0].y+3*n**2*t*e[1].y+3*n*t**2*e[2].y+t**3*e[3].y}}function lh(e,t,n=!1){if(!e.length)return null;let r=n?[...e].reverse():e,i=0;for(let e=1;e0&&i+n>=t){let a=(t-i)/n;return{x:r[e-1].x+(r[e].x-r[e-1].x)*a,y:r[e-1].y+(r[e].y-r[e-1].y)*a}}i+=n}return r[r.length-1]}function uh(e,t,n=0){return e.x>t.x-n&&e.xt.y-n&&e.y({x:n===`left`?-e.x:e.x,y:n===`up`?-e.y:e.y}),s=o(e),c=o(t);i=i.map(e=>({...e,x:n===`left`?-e.x-e.width:e.x,y:n===`up`?-e.y-e.height:e.y}));let l=Math.max(80,n===`loop`?Math.max(Math.abs(c.x-s.x),Math.abs(c.y-s.y))*2.8:0,Math.abs(a?c.y-s.y:c.x-s.x)*(.4+r*.06)),u=[s,a?{x:s.x+0,y:s.y+l}:{x:s.x+l,y:s.y},n===`loop`?{x:c.x,y:c.y+l}:a?{x:c.x-0,y:c.y-l}:{x:c.x-l,y:c.y},c],d=e=>e.flatMap(e=>Array.from({length:31},(t,n)=>ch(e,n/30))),f=e=>d(e).reduce((e,t)=>e+i.filter(e=>uh(t,e,22)).length,0),p=[u],m=f(p)*1e5;if(m){let e={x:(s.x+c.x)/2,y:(s.y+c.y)/2},t=a?e.x:e.y,n=[...new Set(i.flatMap(e=>a?[e.x-110-r*30,e.x+e.width+110+r*30]:[e.y-110-r*30,e.y+e.height+110+r*30]))].sort((e,n)=>Math.abs(e-t)-Math.abs(n-t)).slice(0,12);for(let e of n){let n=(e-t)*4/3;for(let r of[.25,.4,.55]){let i=Math.max(60,Math.abs(a?c.y-s.y:c.x-s.x)*r),o=[a?[s,{x:s.x+n,y:s.y+i},{x:c.x+n,y:c.y-i},c]:[s,{x:s.x+i,y:s.y+n},{x:c.x-i,y:c.y+n},c]],l=f(o)*1e5+Math.abs(e-t)+Math.abs(r-.4)*100;le.map(o)),{path:`M ${e.x} ${e.y}`+p.map(e=>` C ${e[1].x} ${e[1].y}, ${e[2].x} ${e[2].y}, ${e[3].x} ${e[3].y}`).join(``),points:d(p),labels:[.5,.4,.6,.3,.7,.2,.8,.35,.45,.55,.65,.25,.75,.15,.85].map(e=>{let t=Math.min(p.length-1,Math.floor(e*p.length));return ch(p[t],e*p.length-t)})}}var fh=new WeakMap,ph=.5,mh=.05;function hh(e){return e>=ph?Math.max(ph,Math.floor(e*8)/8):ee+(/[^\x00-\x7F]/.test(t)?10.5:7),20);return{width:Math.min(t,216),height:26}}function vh(e,t){let n=e.getState(),r=[...n.nodeLookup.values()].filter(e=>!e.hidden).map(e=>({id:e.id,...e.internals.positionAbsolute,width:e.width||e.measured.width||0,height:e.height||e.measured.height||0}));function i(e,t){let r=n.nodeLookup.get(e);if(!r)return null;let{x:i,y:a}=r.internals.positionAbsolute,o=r.width||r.measured.width||0,s=r.height||r.measured.height||0;return{x:i+(t===`left`?0:t===`right`?o:o/2),y:a+(t===`top`?0:t===`bottom`?s:s/2)}}let a=n.edges.filter(e=>!e.hidden).map(e=>({...e,s:i(e.source,e.sourceHandle),t:i(e.target,e.targetHandle)})),o=JSON.stringify([r,a.map(e=>[e.id,e.s,e.t,e.label,e.data?.lane,e.sourceHandle,e.targetHandle,e.className])]),s=fh.get(e);if(!s||s.key!==o){let t=new Map,n=new Map;for(let e of a)n.set(e.id,/(?:^|\s)map-edge-(\w+)/.exec(e.className??``)?.[1]),e.s&&e.t&&t.set(e.id,dh(e.s,e.t,e.source===e.target?`loop`:e.sourceHandle===`left`?`left`:e.sourceHandle===`top`?`up`:e.sourceHandle===`bottom`,Number(e.data?.lane||0),r.filter(t=>t.id!==e.source&&t.id!==e.target)));s={key:o,routes:t,kinds:n,zoom:-1,labels:new Map},fh.set(e,s)}let c=hh(t);return s.zoom!==c&&(s.zoom=c,s.labels=new Map,c&&yh(s,a,r,c)),s}function yh(e,t,n,r){let i=[...n],a=e=>+!!e.data?.quiet;for(let n of[...t].sort((e,t)=>a(e)-a(t))){let t=e.routes.get(n.id);if(!t||!n.label)continue;let a=_h(n.label),o=a.width/r,s=a.height/r,c=[0,3,4,5,6][Number(n.data?.lane||0)%5],l=[t.labels[c],...t.labels.filter((e,t)=>t!==c)].filter(e=>i.every(t=>e.x+o/2<=t.x||e.x-o/2>=t.x+t.width||e.y+s/2<=t.y||e.y-s/2>=t.y+t.height)),u,d=1/0;for(let t of l){let r={x:t.x-o/2,y:t.y-s/2,width:o,height:s},i=0;for(let[t,a]of e.routes)t!==n.id&&a.points.some(e=>uh(e,r))&&i++;if(ie),a=(0,Y.useId)().replace(/:/g,``),o=`relation-arrow-${a}`,s=`relation-flow-${a}`,c=vh(vu(),i),l=c.routes.get(e),u=c.labels.get(e);if(!l)return null;let d=c.kinds.get(e),f=d===`fanout`||d===`fanin`,p=!d||n?.stroke===bh?n?.stroke||`#7594ad`:`var(--map-edge-${d}, ${n?.stroke||`#7594ad`})`,m=(Number(n?.strokeWidth||2)+(f?.4:0))/i,h=f?lh(l.points,(d===`fanout`?2:15)/i,d===`fanin`):null,g=typeof t==`string`?gh(t):void 0,_=l.points[0],v=l.points[l.points.length-1],y=!!_&&!!v&&n?.stroke!==bh&&(Math.abs(_.x-v.x)>1||Math.abs(_.y-v.y)>1),b=!f&&!n?.strokeDasharray,x=b?sh(l.points,Number(n?.strokeWidth||2)*1.45/i,16/i):``;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`defs`,{children:[(0,J.jsx)(`marker`,{id:o,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:9/i,markerHeight:9/i,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,J.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,style:{fill:p}})}),y&&(0,J.jsxs)(`linearGradient`,{id:s,gradientUnits:`userSpaceOnUse`,x1:_.x,y1:_.y,x2:v.x,y2:v.y,children:[(0,J.jsx)(`stop`,{offset:`0`,style:{stopColor:p,stopOpacity:b?.34:.28}}),(0,J.jsx)(`stop`,{offset:`0.55`,style:{stopColor:p,stopOpacity:b?.7:.78}}),(0,J.jsx)(`stop`,{offset:`1`,style:{stopColor:p,stopOpacity:1}})]})]}),(0,J.jsxs)(lm,{path:l.path,delay:r?.growthDelay,padding:24/i,children:[(0,J.jsx)(wf,{id:e,path:l.path,markerEnd:x?void 0:`url(#${o})`,style:{...n,stroke:x?`transparent`:y?`url(#${s})`:p,strokeLinecap:`round`,vectorEffect:`none`,strokeWidth:m,strokeDasharray:n?.strokeDasharray?String(n.strokeDasharray).split(/[\s,]+/).map(e=>Number(e)/i).join(` `):void 0}}),x&&(0,J.jsx)(`path`,{className:`map-edge-ink`,d:x,style:{fill:y?`url(#${s})`:p,opacity:n?.opacity},"aria-hidden":`true`}),!f&&_&&(0,J.jsx)(`circle`,{className:`map-edge-anchor`,cx:_.x,cy:_.y,r:(x?2.1:2.6)/i,style:x?{fill:p,opacity:Number(n?.opacity??1)*.62}:{fill:`var(--map-paper)`,stroke:p,strokeWidth:1.4/i,opacity:n?.opacity},"aria-hidden":`true`}),h&&(0,J.jsx)(`circle`,{className:`map-edge-joint`,cx:h.x,cy:h.y,r:3.2/i,style:{fill:p,opacity:n?.opacity},"aria-hidden":`true`})]}),(r?.active&&!r.muted||r?.lit)&&(0,J.jsx)(Tp,{children:(0,J.jsx)(`div`,{className:`map-edge-spark`,"data-lit":!r?.active&&!!r?.lit,"aria-hidden":`true`,style:{offsetPath:`path("${l.path}")`,width:8/i,height:8/i,margin:`${-4/i}px 0 0 ${-4/i}px`,animationDelay:`${-((e.charCodeAt(0)*131+e.length*47)%2800)}ms`}})}),t&&g!==``&&u&&(0,J.jsx)(Tp,{children:(0,J.jsx)(`div`,{className:`map-relation-label nodrag nopan`,"data-kind":d,"data-lit":!!r?.lit,"data-quiet":!!r?.quiet,title:g,style:{opacity:r?.quiet&&!r.lit?0:n?.opacity,pointerEvents:r?.quiet&&!r.lit?`none`:void 0,transform:`translate(-50%, -50%) translate(${u.x}px, ${u.y}px) scale(${1/i})`},children:g??t})})]})}function Sh({open:e,info:t,zh:n,onChoose:r,readOnly:i=!1}){return(0,J.jsx)(S,{open:e,onClose:()=>r({mode:`off`}),label:n?`选择地图加载范围`:`Choose map history`,width:`max-w-lg`,children:(0,J.jsxs)(`div`,{className:`map-history-choice`,children:[(0,J.jsx)(`h2`,{children:n?`选择地图加载范围`:`Choose map history`}),(0,J.jsx)(`p`,{children:n?`本会话有 ${t.task_count} 个任务,历史记录约 ${(t.event_bytes/1024/1024).toFixed(1)} MB。`:`This session has ${t.task_count} tasks and about ${(t.event_bytes/1024/1024).toFixed(1)} MB of history.`}),(0,J.jsx)(`p`,{children:i?n?`只读模式只加载历史记录,不调用模型。较长历史需要一些加载时间。`:`Read-only mode loads records without model calls. Long histories take time to load.`:n?`加载较长历史需要一些时间。生成卡片摘要与关系说明会调用已配置的模型,并消耗额外 Token。已有摘要会优先复用。`:`Loading a long history takes time. Card summaries and relationship descriptions use your configured model and consume additional tokens. Existing summaries are reused.`}),(0,J.jsxs)(`div`,{className:`map-history-options`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`current`,since:t.current_task_ts,eventSince:t.current_event_ts,taskId:t.current_task_id||void 0}),children:[(0,J.jsx)(`strong`,{children:n?`从当前进度加载`:`Start at current progress`}),(0,J.jsx)(`span`,{children:n?`推荐 · 加载当前任务及后续进度,保留相关连接`:`Recommended · Load current and future work with its connections`})]}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`full`}),children:[(0,J.jsx)(`strong`,{children:n?`从头加载`:`Load from the beginning`}),(0,J.jsx)(`span`,{children:i?n?`分批加载历史记录,查看已有说明`:`Load history in pages and view existing explanations`:n?`分批加载历史记录;打开卡片阅读时,再整理它的说明`:`Load history in pages; prepare an explanation when you open a card to read`})]}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`off`}),children:[(0,J.jsx)(`strong`,{children:n?`不开启地图模式`:`Keep map mode off`}),(0,J.jsx)(`span`,{children:n?`不加载地图,也不生成摘要`:`Do not load the map or generate summaries`})]})]}),(0,J.jsx)(`small`,{children:n?`选择仅用于本会话,可随时更改加载范围。`:`This choice applies to this session and can be changed later.`})]})})}var Ch=new Map;function wh(e){let t=Ch.get(e);if(t)return t;try{let t=JSON.parse(A(`argus.map.camera.v1:`+e)||`null`);if(t&&[t.viewport,t.overview].every(e=>e&&[e.x,e.y,e.zoom].every(Number.isFinite)&&e.zoom>=.035&&e.zoom<=3.5)&&(t.focusId===null||typeof t.focusId==`string`)&&typeof t.detailed==`boolean`)return{camera:t}}catch{}return{}}function Th(e,t){for(Ch.delete(e),Ch.set(e,t);Ch.size>8;)Ch.delete(Ch.keys().next().value);t.camera&&k(`argus.map.camera.v1:`+e,JSON.stringify(t.camera))}var Eh={task:xm,branch:Pm},Dh={relation:xh},Oh={done:`#a9c4b6`,running:`#9fb6cc`,question:`#dcc797`,failed:`#d9a79f`,review_unavailable:`#cdbba3`,held:`#cdbba3`,paused:`#cdbba3`,superseded:`#c5bdcd`,aborted:`#c6c8cb`,skipped:`#c6c8cb`,missing:`#c6c8cb`};function kh({events:e,zh:t}){let n=[...new Map(e.filter(e=>e.type===`team.task`).map(e=>[e.id,e])).values()];if(!n.length)return null;let r=n.filter(e=>e.status===`done`).length,i=n.filter(e=>ye.has(e.status||``)).length,a=n.filter(e=>e.status===`failed`).length;return(0,J.jsxs)(`div`,{className:`map-team-progress`,role:`status`,"aria-label":t?`子任务进度`:`Subtask progress`,children:[(0,J.jsx)(`strong`,{children:t?`子任务`:`Subtasks`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(g,{size:12}),(0,J.jsxs)(`b`,{children:[r,`/`,n.length]}),` `,t?`已完成`:`completed`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`b`,{children:i}),` `,t?`进行中`:`running`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`b`,{children:a}),` `,t?`失败`:`failed`]})]})}function Ah({data:e,zh:t,composer:n,activePhase:r,waiting:s,snapshot:c,currentTaskId:l,events:u,pendingLabel:f,readOnly:p,sessionId:m,viewKey:h,paused:g,actions:y,replacements:O}){let[k,A]=(0,Y.useState)(!1),[j,N]=(0,Y.useState)(()=>e.kind===`live`&&!p&&y.conversationEvents.some(e=>e.type===`ui.operator`||e.type===`ui.argus`)),P=[...y.conversationEvents].reverse().find(e=>e.type===`ui.operator`),F=P?String(P.message_id||P.ts||``):``,I=(0,Y.useRef)(F),R=(0,Y.useRef)(n.pending);(0,Y.useEffect)(()=>{e.kind===`live`&&!p&&(F&&F!==I.current||n.pending&&!R.current)&&(N(!0),A(!1)),I.current=F,R.current=n.pending},[F,n.pending,e.kind,p]);let[z,B]=(0,Y.useState)(()=>new Set),ee=(0,Y.useCallback)(e=>{B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[V,re]=(0,Y.useState)(null),ie=(0,Y.useRef)(0),se=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(se.current=!0,()=>{se.current=!1}),[]);let W=(0,Y.useMemo)(()=>M(e.tasks),[e.tasks]),[ce,le,ue]=Ep([]),pe=(0,Y.useRef)(null),G=Jm(pe,!p),he=Op(),ge=(0,Y.useRef)(!1),[Ce,we]=(0,Y.useState)(!1),K=(0,Y.useRef)(null);K.current||=wh(h);let[Te,Oe]=(0,Y.useState)(()=>{let e=K.current?.scene?.cards.find(e=>e.id===K.current?.camera?.focusId);return new Set(e&&e.id!==e.task.id?[e.task.id]:[])}),[Ae,je]=(0,Y.useState)(null),[Me]=(0,Y.useState)(()=>new Set(K.current?.scene?.cards.map(e=>e.id))),Pe=ce.find(e=>e.id===G.focusId),Fe=(0,Y.useMemo)(()=>Ne(e.tasks,e.events),[e.tasks,e.events]),Ie=et(m,t?`zh-CN`:`en-US`),[Le,Re]=(0,Y.useState)(null),Ve=(0,Y.useCallback)((t,n)=>{Re(r=>n?{nodeId:t,key:n,foundationId:Ie.id}:r?.nodeId===t&&!e.tasks.some(e=>e.id===r.key)?null:r)},[e.tasks,Ie.id]);(0,Y.useEffect)(()=>{Re(t=>t&&(t.nodeId===G.focusId||e.tasks.some(e=>e.id===t.key))?t:null)},[G.focusId,e.tasks]);let q=Le?e.tasks.find(e=>e.id===Le.key):void 0,Ke=q?.turn_kind===`qa`?e.events.find(e=>e.item_id===q.id&&e.type===`turn.replied`):void 0,Ye=Le?ce.find(e=>e.id===Le.nodeId):void 0,Ze=q?.id??(Le?.nodeId===G.focusId?Le.key:null),Qe=(0,Y.useMemo)(()=>de(e.tasks),[e.tasks]),nt=Qe.findIndex(e=>e.id===Pe?.data.task.id),[rt,at]=(0,Y.useState)(null),ot=W.tasks.find(e=>e.id===rt),st=(0,Y.useMemo)(()=>ot?qe(W,ot.id):null,[W,ot]),ut=(0,Y.useMemo)(()=>ot&&st?new Set([ot.id,...st.upstream.map(e=>e.id),...st.downstream.map(e=>e.id)]):null,[ot,st]),{copy:dt,ready:pt,generating:mt,readingRequest:ht,readingNeedsUpdate:gt,readingGenerating:_t,generationPhase:yt,foundationRequired:xt,questionContext:Ct,generationError:wt,generationUnavailable:Tt,retry:Dt}=Qm(e,q?.id||Pe?.data.task.id||null,t,!p&&!e.history_loading,Pe?.data.layout.steps,m,!1,Ze,Le?.foundationId),At=(0,Y.useMemo)(()=>ht?{request:ht,questionContext:Ct,pending:gt,generating:_t,phase:yt,error:wt,unavailable:Tt,foundationRequired:xt,retry:p?void 0:Dt,retryDisabled:mt}:void 0,[ht,Ct,gt,mt,_t,yt,wt,Tt,p,Dt,xt]),Mt=(0,Y.useMemo)(()=>Xe(De(W,dt?.relations||[],t)),[W,dt?.relations,t]),X=ih(e,t,!p&&!e.history_loading,m),Nt=eh(e,Mt,t,!p&&!e.history_loading,m),Pt=(0,Y.useMemo)(()=>De(W,dt?.relations||[],t,Nt),[W,dt?.relations,t,Nt]),Ft=(0,Y.useRef)(K.current.scene),It=(G.canvasSize.width||window.innerWidth)<640,Z=(0,Y.useMemo)(()=>{let n=H(W,e.events,t,Ft.current,Pt,Te,It);return Ft.current=a(Ft.current,n),Ft.current},[W,e.events,t,Pt,Te,It]),Lt=(0,Y.useRef)(null),Rt=(0,Y.useMemo)(()=>(Lt.current=a(Lt.current,Be(xe(W,e.events,t,48),z,t)),Lt.current),[W,e.events,t,z]),zt=(0,Y.useRef)(null),Bt=(0,Y.useMemo)(()=>{let e=Rt.tasks.filter(e=>e.branch);if(!e.length)return{links:Z.links,positions:Z.positions,frames:Z.frames,structure:Z.structure,branches:e,branchAnchor:new Map};let t=new Map;for(let e of Z.cards)t.set(e.task.id,e.id);let n=new Map(e.map(e=>[e.id,t.get(e.parent_id)??e.parent_id])),r={...Z.frames};for(let t of e)r[t.id]={...t.group?Am:km,scale:1};let i=[...Z.links,...Rt.links.filter(e=>e.kind===`fanout`||e.kind===`fanin`).map(e=>({...e,source:t.get(e.source)??e.source,target:t.get(e.target)??e.target}))],a=new Map;for(let t of e){let e=n.get(t.id);a.set(e,[...a.get(e)??[],t.id])}let o=Z.cards.flatMap(e=>[e.id,...a.get(e.id)??[]]),s=JSON.stringify([o.map(e=>[e,r[e].width,r[e].height]),i.map(e=>[e.source,e.target,e.kind])]),c=zt.current?.structure===s?zt.current.positions:ve(o,i,r);return zt.current={structure:s,positions:c},{links:i,positions:c,frames:r,structure:s,branches:e,branchAnchor:n}},[Z,Rt]),Vt=Et(Bt.positions,G.reducedMotion),[Ht,Ut]=(0,Y.useState)(null),Wt=(0,Y.useMemo)(()=>Ot(Bt.links,Ht),[Bt.links,Ht]),[Gt,Kt]=(0,Y.useState)(!1),[qt,Jt]=(0,Y.useState)(!1),Yt=(0,Y.useMemo)(()=>new Map(Z.cards.map(e=>[e.id,e.ordinal])),[Z.cards]),Xt=St(Z,!!e.history_loading),Zt=(0,Y.useMemo)(()=>Ge(e.events),[e.events]),Qt=async(e,t=[],r,i)=>{if(i?.whileRunning)return n.onSend(e,t,void 0,i);let a=++ie.current,o=pe.current?.querySelector(`.map-composer`)?.getBoundingClientRect();re({id:a,text:fe(e).text.replace(/\s+/g,` `).slice(0,180),origin:{x:o?.left??20,y:o?.top??innerHeight-100,width:o?.width??260,height:o?.height??56}});let s=!1,c=e=>{e.type===`task`&&(s=!0),se.current&&e.type===`settled`&&e.outcome===`message`&&!s&&(N(!0),A(!1)),se.current&&re(t=>t?.id===a?{...t,result:e}:t)};try{let r=await n.onSend(e,t,c);return r&&se.current&&fe(e).refs.length>0&&(N(!0),A(!1)),r||c({type:`settled`,outcome:`error`}),r}catch(e){throw c({type:`settled`,outcome:`error`}),e}},$t=()=>{re(e=>e?{...e,result:{type:`settled`,outcome:`cancelled`}}:null),n.onCancel()};(0,Y.useEffect)(()=>{if(!he||ge.current||!pt||K.current?.camera&&e.history_loading)return;let t=requestAnimationFrame(()=>{if(ge.current=!0,K.current?.camera)G.restore(K.current.camera);else if(G.fit(),e.kind===`live`&&pe.current.clientWidth<640){let t=Je(e.tasks);t&&G.fit(new Set([t.id]))}we(!0)});return()=>cancelAnimationFrame(t)},[he,G.fit,G.enter,G.restore,e.kind,e.tasks,Z.cards,e.history_loading,pt]),(0,Y.useEffect)(()=>{let e=pe.current;if(!e||G.reducedMotion)return;let t=null,n=n=>{t??=requestAnimationFrame(()=>{t=null;let r=e.getBoundingClientRect();!r.width||!r.height||(e.style.setProperty(`--lean-x`,((n.clientX-r.left)/r.width-.5).toFixed(3)),e.style.setProperty(`--lean-y`,((n.clientY-r.top)/r.height-.5).toFixed(3)))})},r=()=>{e.style.setProperty(`--lean-x`,`0`),e.style.setProperty(`--lean-y`,`0`)};return e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,r),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,r)}},[G.reducedMotion]),(0,Y.useEffect)(()=>{if(!Ce||K.current?.camera||G.reducedMotion)return;Kt(!0);let e=window.setTimeout(()=>Kt(!1),kt);return()=>window.clearTimeout(e)},[Ce,G.reducedMotion]),(0,Y.useEffect)(()=>{let e=()=>{ge.current&&Th(h,{scene:Ft.current,camera:G.capture()})};return window.addEventListener(`pagehide`,e),()=>{e(),window.removeEventListener(`pagehide`,e)}},[h,G.capture]),(0,Y.useEffect)(()=>{if(!he)return;let e=requestAnimationFrame(G.fitUpdatedScene);return()=>cancelAnimationFrame(e)},[Bt.structure,he,G.fitUpdatedScene]);let en=(0,Y.useRef)(n);en.current=n;let tn=(0,Y.useCallback)(e=>{if(p)return;let t=en.current;t.onChange(U(e)+t.value),window.setTimeout(()=>document.querySelector(`.map-composer textarea`)?.focus(),0)},[p]),[nn,rn]=(0,Y.useState)(null),an=o(),on=i({queryKey:[`map-notes`,m],queryFn:({signal:e})=>d.mapNotes(m,e),enabled:e.kind===`live`&&!p,staleTime:6e4}),sn=(0,Y.useMemo)(()=>({notes:Om(on.data?.notes??[])}),[on.data]),[cn,ln]=(0,Y.useState)(null),[un,dn]=(0,Y.useState)(``),[fn,pn]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{if(!cn)return;let e=e=>{e.target.closest(`.map-note-editor`)||ln(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),ln(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[cn]);let mn=async()=>{let e=cn,t=un.trim();if(!(!e||!t)){pn(!1);try{await d.addMapNote(m,{node_id:e.ref.task_id,text:t}),await an.invalidateQueries({queryKey:[`map-notes`,m]}),ln(null),dn(``)}catch{pn(!0)}}},hn=(0,Y.useCallback)((e,t)=>{p||rn({ref:e,x:Math.min(window.innerWidth-180,t.x),y:Math.min(window.innerHeight-140,t.y)})},[p]);(0,Y.useEffect)(()=>{if(!nn)return;let e=e=>{e.target.closest(`.map-context-menu`)||rn(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),rn(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[nn]);let[gn,_n]=(0,Y.useState)(``),vn=(0,Y.useCallback)(e=>`${e.task.title} ${e.task.objective??``} ${dt?.cards[e.task.id]?.title||``} ${dt?.cards[e.task.id]?.summary||``} ${X[e.task.id]?.title||``} ${X[e.task.id]?.summary||``} ${e.part>1?t?`续篇 ${e.part-1}`:`Continued ${e.part-1}`:``}`.toLowerCase(),[dt,X,t]),yn=(0,Y.useMemo)(()=>gn?Z.cards.filter(e=>vn(e).includes(gn.toLowerCase())):[],[gn,Z.cards,vn]),bn=yn.findIndex(e=>e.id===G.focusId),[xn,Sn]=(0,Y.useState)(W.tasks.length),[Cn,wn]=(0,Y.useState)(!1),[Tn,En]=(0,Y.useState)(!1),Dn=O?.shown??Tn,On=O?.toggle??(()=>En(e=>!e)),[kn,An]=(0,Y.useState)(``),jn=(0,Y.useCallback)(e=>{if(at(e),_n(``),An(``),e){let{upstream:t,downstream:n}=qe(W,e);G.fit(new Set([e,...t.map(e=>e.id),...n.map(e=>e.id)]))}else G.fit()},[G.fit,W]),Mn=(0,Y.useCallback)((e,t=!1)=>{let n=Ft.current?.allCards.find(t=>t.id===e);if(n&&!Te.has(n.task.id)&&(t||e!==n.task.id)){Oe(e=>new Set([...e,n.task.id])),je(e);return}ot&&n?jn(n.task.id===ot.id?null:n.task.id):G.enter(e)},[G.enter,ot,jn,Te]),Nn=(0,Y.useCallback)(e=>{let t=Te.has(e);if(Oe(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),Pe?.data.task.id===e){let n=Ft.current?.allCards.filter(t=>t.task.id===e).at(-1);je(t?e:n?.id??e)}},[Te,Pe?.data.task.id]);(0,Y.useEffect)(()=>{!Ae||!ce.some(e=>e.id===Ae)||(G.enter(Ae),je(null))},[Ae,ce,G.enter]);let Pn=(0,Y.useCallback)(()=>{at(null),An(``),G.fit()},[G.fit]);(0,Y.useEffect)(()=>{le(n=>a(n,Z.cards.map(n=>({id:n.id,type:`task`,position:Vt[n.id]??Z.positions[n.id],width:Z.frames[n.id].width,height:Z.frames[n.id].height,style:{width:Z.frames[n.id].width,height:Z.frames[n.id].height},data:{...n,zh:t,open:Mn,toggleHistory:Nn,readStep:G.readStep,readCopy:Ve,menu:hn,quote:tn,source:e.id,readOnly:p,live:e.kind===`live`,paused:g,seenCards:Me,restoring:!!K.current?.camera&&!ge.current,layout:Z.layouts[n.id],frame:Z.frames[n.id],plannedWidth:Zt.get(n.task.id),focused:!1,detailed:!1}}))))},[W,Z,Bt,Vt,t,le,Mn,Nn,G.readStep,Ve,hn,tn,e.id,e.kind,p,g,Me,Zt]),(0,Y.useEffect)(()=>{Sn(e=>Math.min(Math.max(e,1),W.tasks.length))},[W.tasks.length]),(0,Y.useEffect)(()=>{if(!Cn||G.detailed)return;let e=window.setInterval(()=>Sn(e=>e>=W.tasks.length?(wn(!1),e):e+1),900);return()=>window.clearInterval(e)},[Cn,W.tasks.length,G.detailed]),(0,Y.useEffect)(()=>{if(!qt||Cn||xnJt(!1),1400);return()=>window.clearTimeout(e)},[qt,Cn,xn,W.tasks.length]);let Fn=(0,Y.useMemo)(()=>{let t=new Set(Z.cards.filter(t=>e.kind===`live`&&!qt||t.ordinal<=xn).map(e=>e.id));for(let[e,n]of Bt.branchAnchor)t.has(n)&&t.add(e);return t},[Z.cards,xn,e.kind,qt,Bt.branchAnchor]),In=(0,Y.useRef)([]),Ln=(0,Y.useMemo)(()=>{let e=ce.map(e=>({...e,hidden:!Fn.has(e.id),data:{...e.data,copy:dt?{version:dt.version,cards:Object.fromEntries([e.data.task.id,...e.data.layout.steps.map(e=>e.id)].filter(e=>dt.cards[e]).map(e=>[e,dt.cards[e]]))}:void 0,words:X[e.data.task.id],readerCopy:Le?.nodeId===e.id?At:void 0,focused:e.id===G.focusId,detailed:G.detailed&&e.id===G.focusId,canvasSize:G.canvasSize,lit:Wt.nodes.has(e.id),hovered:e.id===Ht,arriving:Gt,revealing:qt,phase:r&&ye.has(e.data.task.status)?r:void 0,waiting:s&&s.taskId===e.data.task.id?s.sentence:void 0,growthDelay:Xt.cards[e.id],dispatchState:V?.result?.type===`task`&&V.result.taskId===e.data.task.id&&!n.historical?V.landed?`landed`:`receiving`:void 0,growingSteps:Object.fromEntries(e.data.layout.steps.flatMap(t=>{let n=Xt.steps[bt(e.id,t.id)];return n==null?[]:[[t.id,n]]})),growingLinks:Object.fromEntries(e.data.layout.links.flatMap(t=>{let n=Xt.links[bt(e.id,t.id)];return n==null?[]:[[t.id,n]]}))},style:{...e.style,opacity:ut&&!ut.has(e.data.task.id)||gn&&!vn(e.data).includes(gn.toLowerCase())?.22:1}}));return In.current=a(In.current,e),In.current},[ce,Fn,G.focusId,G.detailed,G.canvasSize,gn,vn,dt,X,Le,At,t,Xt,V,n.historical,ut,Wt,Ht,Gt,qt,r,s]),Rn=(0,Y.useRef)([]),zn=(0,Y.useMemo)(()=>{let e=new Map;for(let t of Bt.branches){if(t.group)continue;let n=t.parent_id??``;e.set(n,(e.get(n)??0)+1)}let n=new Map,r=Bt.branches.map(r=>{let i=r.parent_id??``,a=Bt.frames[r.id],o=r.group?void 0:(n.get(i)??0)+1;return o!==void 0&&n.set(i,o),{id:r.id,type:`branch`,position:Vt[r.id]??{x:0,y:0},width:a.width,height:a.height,style:{width:a.width,height:a.height,opacity:ut&&!ut.has(i)?.22:1},hidden:!Fn.has(r.id),draggable:!1,selectable:!1,focusable:!1,data:{task:r,zh:t,parentCardId:Bt.branchAnchor.get(r.id),open:Mn,toggleGroup:ee,fanIndex:o,fanCount:o===void 0?void 0:e.get(i)}}});return Rn.current=a(Rn.current,r),Rn.current},[Bt,Vt,Fn,t,Mn,ee,ut]),Bn=(0,Y.useMemo)(()=>zn.length?[...Ln,...zn]:Ln,[Ln,zn]),Vn=(0,Y.useMemo)(()=>{let n=Bt.links.filter(e=>Fn.has(e.source)&&Fn.has(e.target)&&(e.kind!==`replacement`||Dn)),r=ne(n),i=new Map(Z.cards.map(e=>[e.id,e.task])),a=new Set;if(e.kind===`live`&&!g){for(let e of Z.cards)ye.has(e.task.status)&&a.add(e.id);for(let e of Bt.branches)ye.has(e.status)&&a.add(e.id)}return n.map((e,n)=>{let o=e.kind===`fanout`||e.kind===`fanin`,s=i.get(e.source)?.id,c=i.get(e.target)?.id,l=!!ot&&e.kind===`dependency`&&(s===ot.id||c===ot.id),u=!!ot&&!l&&(e.kind!==`continuation`||s!==ot.id);return{id:e.id,source:e.source,target:e.target,..._e({...Vt[e.source],...Bt.frames[e.source]},{...Vt[e.target],...Bt.frames[e.target]}),type:`relation`,data:{growthDelay:Xt.links[e.id]??(Gt?jt(Yt.get(e.source)??1):qt&&Yt.get(e.target)===xn?120:void 0),active:a.has(e.target),lit:Wt.edges.has(e.id),lane:r[n],muted:u,quiet:!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)},className:`map-edge-${e.kind}${Wt.edges.has(e.id)?` is-lit`:``}`,label:o?void 0:e.label||(e.kind===`replacement`?(i.get(e.source)?.superseded_reason||``).replace(/\s+/g,` `).slice(0,60)||(t?`转入新计划`:`New plan`):e.kind===`dependency`?t?`依赖`:`Dependency`:t?`同一研究`:`Related work`),labelStyle:{fontSize:30,fill:e.kind===`replacement`?`#95809f`:`#6685a4`},labelBgPadding:[12,6],labelBgBorderRadius:12,labelBgStyle:{fill:`var(--map-paper)`,fillOpacity:.96},style:{opacity:u?.12:1,stroke:e.cycle?`#dc6648`:e.kind===`replacement`?`#a48caf`:e.kind===`dependency`?`#527fa7`:`#7594ad`,strokeWidth:l?2.6:e.kind===`dependency`?2:o?1.1:1.6,vectorEffect:`non-scaling-stroke`,strokeDasharray:e.kind===`dependency`||e.kind===`context`||e.kind===`continuation`||o?void 0:`5 6`},markerEnd:{type:Ts.ArrowClosed,color:e.kind===`replacement`?`#a48caf`:`#8aa5b8`,width:32,height:32},ariaLabel:e.evidence||(o?`Team branch: ${e.source} → ${e.target}`:e.kind===`dependency`?`Dependency: ${e.source} → ${e.target}`:`Plan replacement: ${e.source} → ${e.target_plan_id} (${e.target_count} tasks, representative ${e.target})`)}})},[Bt,Fn,Dn,t,Xt,e.kind,g,Z.cards,ot,Vt,Wt,Gt,qt,xn,Yt]),Hn=W.links.filter(e=>e.kind===`replacement`).length,Un=(0,Y.useMemo)(()=>{let t=new Set(Z.cards.filter(e=>e.completionScope).map(e=>e.task.id)),n={done:0,ended:0,running:0,question:0,review_unavailable:0,held:0,failed:0,other:0};for(let r of e.tasks)t.has(r.id)?n.ended++:r.status===`done`?n.done++:ye.has(r.status)?n.running++:r.pending_question?n.question++:He(r)===`review_unavailable`?n.review_unavailable++:He(r)===`held`?n.held++:r.status===`failed`?n.failed++:n.other++;return n},[e.tasks,Z.cards]),Wn=Un.done,Gn=(0,Y.useCallback)(e=>dt?.cards?.[`${e.id}:outcome`]?.summary||``,[dt]),Kn=(0,Y.useMemo)(()=>e.tasks.some(e=>e.turn_kind!==`qa`&&e.kind!==`turn`)?te(e.tasks,e.events,t,Gn):null,[e.tasks,e.events,t,Gn]),qn=Ue(c,c.mission_view,u),Jn=Ee(qn,c.mission_view,u,t?`zh-CN`:`en`,y.connected,ke(c,c.mission_view,qn.taskId)),Yn=e=>{at(null),An(``),Sn(t=>Math.max(t,Z.cards.find(t=>t.id===e)?.ordinal||1)),G.enter(e)},Xn=()=>{let e=Z.cards.filter(e=>e.task.id===Fe?.id).at(-1);e&&(Re(null),Yn(e.id))},Zn=()=>{let n=Je(e.tasks);n?(Yn(Z.cards.filter(e=>e.task.id===n.id).at(-1).id),An(``)):An(t?`发送一个目标,地图就会开始生长`:`Send a goal to start your map`)},Qn=()=>{let e=Qe[(nt+1)%Qe.length];e&&Yn(Z.cards.filter(t=>t.task.id===e.id).at(-1).id)};(0,Y.useEffect)(()=>{let e=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.isComposing)&&!e.target?.closest(`input, textarea, select, [contenteditable], [role="dialog"]`)){if(e.key===`/`)e.preventDefault(),pe.current?.querySelector(`.map-search input`)?.focus();else if(e.key===`f`||e.key===`F`)Pn();else if((e.key===`ArrowRight`||e.key===`ArrowLeft`)&&G.detailed&&G.focusId){let t=Z.cards.filter(e=>Fn.has(e.id)),n=t.findIndex(e=>e.id===G.focusId);if(n<0)return;let r=t[n+(e.key===`ArrowRight`?1:-1)];r&&(e.preventDefault(),G.enter(r.id))}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pn,G.enter,G.detailed,G.focusId,Z.cards,Fn]);let $n=(0,Y.useMemo)(()=>({artifacts:y.artifacts,onOpenArtifact:y.onOpenArtifact}),[y.artifacts,y.onOpenArtifact]),er=(0,J.jsxs)(`div`,{className:`map-playback`,"data-floating":e.kind===`live`,children:[(0,J.jsx)(`button`,{"aria-label":Cn?`Pause reveal`:`Play reveal`,onClick:()=>{xn>=W.tasks.length&&Sn(1),wn(e=>!e)},children:Cn?(0,J.jsx)(tt,{size:14}):(0,J.jsx)(D,{size:14})}),(0,J.jsx)(`button`,{"aria-label":`Restart reveal`,onClick:()=>{wn(!1),Sn(1),e.kind!==`live`&&G.back()},children:(0,J.jsx)(lt,{size:13})}),(0,J.jsx)(`span`,{children:t?`逐卡展开`:`Reveal cards`}),(0,J.jsx)(`input`,{"aria-label":`Visible task count`,type:`range`,min:Math.min(1,W.tasks.length),max:W.tasks.length,value:xn,onChange:e=>{wn(!1),Sn(Number(e.target.value))}}),(0,J.jsxs)(`span`,{className:`map-count`,children:[xn,` / `,W.tasks.length]}),(0,J.jsx)(`button`,{"aria-label":`Reveal next card`,disabled:xn>=W.tasks.length,onClick:()=>Sn(e=>Math.min(W.tasks.length,e+1)),children:(0,J.jsx)(oe,{size:14})}),(0,J.jsx)(`small`,{children:t?`时间顺序`:`Chronological order`}),e.kind===`live`&&(0,J.jsx)(`button`,{className:`map-replay-exit`,"aria-label":t?`回到当前`:`Back to the present`,title:t?`回到当前`:`Back to the present`,onClick:()=>{wn(!1),Jt(!1),Sn(W.tasks.length)},children:(0,J.jsx)(v,{size:14})})]});return(0,J.jsx)(Tm.Provider,{value:G.zoomSteps,children:(0,J.jsx)(fm.Provider,{value:sn,children:(0,J.jsxs)(pm.Provider,{value:$n,children:[dt?.generation_error&&(0,J.jsxs)(`div`,{role:`status`,className:`map-paused-label`,children:[t?`地图说明暂时不可用,任务和已有说明仍可阅读。`:`Map explanation unavailable; tasks and saved explanations remain readable.`,dt.generation_error.code===`cost_unreconciled`&&(t?` 调用费用待对账,并非预算耗尽。`:` Provider usage awaits reconciliation, not budget exhaustion.`)]}),e.kind===`live`&&!qt&&Kn&&(0,J.jsxs)(`dl`,{className:`map-brief`,"aria-label":t?`任务进展`:`Task progress`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:t?`正在做`:`Now`}),(0,J.jsx)(`dd`,{title:Kn.goal,children:qn.state===`running`||qn.state===`waiting`||qn.reason===`operator_input`?Jn:Kn.current})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:t?`已有结果`:`Results`}),(0,J.jsx)(`dd`,{children:Kn.conclusion})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:t?`接下来`:`Next`}),(0,J.jsx)(`dd`,{children:Kn.next})]})]}),(0,J.jsxs)(`div`,{className:`map-status-row`,children:[e.tasks.length>0&&(0,J.jsx)(`span`,{className:`map-progress`,"aria-hidden":`true`,children:[`done`,`ended`,`running`,`question`,`review_unavailable`,`held`,`failed`,`other`].map(e=>Un[e]>0?(0,J.jsx)(`i`,{"data-bucket":e,style:{flexGrow:Un[e]}},e):null)}),(0,J.jsxs)(`p`,{className:`map-status-line`,role:`status`,children:[n.pending||!g&&(r||s)?(0,J.jsx)(`i`,{className:`map-live-dot`,"aria-hidden":!0}):null,(0,J.jsx)(`span`,{className:`map-status-text`,children:We({total:e.tasks.length,qa:e.tasks.filter(e=>e.turn_kind===`qa`).length,complete:Wn,ended:Un.ended,reviewUnavailable:Un.review_unavailable,held:Un.held,running:Un.running,pending:n.pending,paused:g,hasOpenWork:e.tasks.some(e=>[`running`,`pending`,`paused`,`held`,`question`].includes(He(e))),role:r,current:e.kind===`live`&&![`idle`,`step_finished`].includes(qn.state)?Jn:void 0,waiting:s?.sentence,zh:t})}),Qe.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`map-status-sep`,"aria-hidden":!0,children:`·`}),(0,J.jsx)(`button`,{type:`button`,className:`map-attention-link`,onClick:Qn,title:t?`跳到需要你处理的任务`:`Jump to the task waiting on you`,"aria-label":t?`逐个查看 ${Qe.length} 项需要你处理的任务`:`Cycle through ${Qe.length} tasks needing attention`,children:t?`${Qe.length} 项需要你处理`:`${Qe.length} ${Qe.length===1?`needs`:`need`} your attention`})]})]})]}),e.kind===`live`&&Fe&&!qt&&(0,J.jsxs)(`div`,{className:`map-final-review`,role:`status`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`strong`,{children:t?`最终结果已检查通过`:`Final delivery passed review`}),Pe?.data.task.id!==Fe.id&&Pe?.data.task.outcome?.review_status===`unavailable`&&(Fe.finished_ts??0)>(Pe.data.task.finished_ts??0)?(0,J.jsx)(`span`,{children:t?` · 本项目后续已交付;此卡保留当次审查异常。`:` · This project was delivered later; this card retains its earlier review error.`}):null]}),(0,J.jsx)(`button`,{type:`button`,onClick:Xn,children:t?`查看结果检查`:`View final review`}),y.deliveryCount>0&&(0,J.jsx)(`button`,{type:`button`,onClick:y.onOpenDelivery,children:t?`查看项目成果`:`View project deliverables`})]}),e.kind===`live`&&!p&&(0,J.jsx)(be,{questions:c.pending_questions??[],backlog:c.backlog,currentTaskId:l??c.mission_view?.mission.id,onAnswer:y.onAnswer,onLocate:e=>{let t=Z.cards.filter(t=>t.task.id===e).at(-1);t&&Yn(t.id)}}),G.detailed&&nt>=0&&(0,J.jsxs)(`div`,{className:`map-attention-detail`,role:`status`,children:[(0,J.jsxs)(`strong`,{children:[t?`待处理`:`Needs attention`,` `,nt+1,` / `,Qe.length]}),(()=>{let n=ae(Qe[nt],e.events,t,Gn(Qe[nt]));return(0,J.jsxs)(`div`,{tabIndex:0,children:[(0,J.jsx)(`p`,{children:n.reason}),(0,J.jsx)(`p`,{children:n.next}),n.detail&&(n.showDetail?(0,J.jsxs)(`blockquote`,{className:`map-attention-quote`,children:[(0,J.jsx)(`strong`,{children:t?`暂停原因原文`:`Recorded reason`}),` `,n.detail]}):(0,J.jsxs)(`details`,{children:[(0,J.jsx)(`summary`,{children:t?`原始记录`:`Recorded words`}),(0,J.jsx)(`p`,{children:n.detail})]}))]})})()]}),ot&&st&&(0,J.jsxs)(`nav`,{className:`map-dependencies`,"aria-label":t?`任务来路与去向`:`Task dependencies`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`strong`,{children:t?`来路`:`Depends on`}),st.upstream.length?st.upstream.map(e=>(0,J.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,J.jsx)(`span`,{children:t?`无已记录的前置依赖`:`No recorded prerequisites`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`strong`,{children:t?`当前`:`Selected`}),(0,J.jsxs)(`button`,{className:`map-trace-task`,title:ot.title,onClick:()=>Yn(Z.cards.find(e=>e.task.id===ot.id).id),children:[ot.title,` · `,t?`查看任务`:`Open task`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`strong`,{children:t?`去向`:`Enables`}),st.downstream.length?st.downstream.map(e=>(0,J.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,J.jsx)(`span`,{children:t?`无已记录的后续依赖`:`No recorded dependents`})]})]}),(0,J.jsx)(`div`,{className:`map-workspace`,children:(0,J.jsxs)(`div`,{ref:pe,className:`map-canvas-wrap`,"data-focused":!!G.focusId,"data-detailed":G.detailed,"data-fitted":Ce,"data-hovering":!!Ht&&!G.detailed,children:[(0,J.jsxs)(`div`,{className:`map-ambient`,"aria-hidden":`true`,children:[(0,J.jsx)(`i`,{}),(0,J.jsx)(`i`,{}),(0,J.jsx)(`i`,{})]}),j&&(0,J.jsx)(ft,{events:y.conversationEvents,connected:y.connected,pending:n.pending,artifacts:y.artifacts,zh:t,onClose:()=>N(!1),onOpenArtifact:y.onOpenArtifact,onOpenDelivery:y.onOpenReceipt}),k&&e.kind===`live`&&(0,J.jsx)(`aside`,{className:`map-agent-drawer nowheel nodrag nopan`,children:(0,J.jsx)(ze,{sid:c.session.id,view:c.mission_view,roles:c.roles,events:u,taskId:Pe?.data.task.id||c.mission_view?.mission.id||void 0,paused:g&&!n.pending,onClose:()=>A(!1)})}),V&&!p&&(0,J.jsx)(vt,{flight:V,canvas:pe,zh:t,historical:n.historical,onReveal:t=>{e.tasks.some(e=>e.id===t)&&G.fit()},onLand:e=>re(t=>t?.id===e?{...t,landed:!0}:t),onFinish:e=>re(t=>t?.id===e?null:t)}),(0,J.jsxs)(`div`,{className:`map-canvas-toolbar nowheel`,children:[(0,J.jsxs)(`label`,{className:`map-search`,children:[(0,J.jsx)(b,{size:14}),(0,J.jsx)(`input`,{"aria-label":t?`搜索地图任务`:`Search map tasks`,placeholder:t?`搜索任务…`:`Find a task…`,title:t?`Enter 逐个跳转匹配`:`Enter jumps through matches`,value:gn,onChange:e=>_n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&yn.length?Yn(yn[(bn+1)%yn.length].id):e.key===`Escape`&&gn&&(e.stopPropagation(),_n(``))}}),gn&&(0,J.jsx)(`span`,{className:`map-search-count`,"aria-live":`polite`,children:yn.length?bn>=0?`${bn+1}/${yn.length}`:`${yn.length} ${t?`项`:`found`}`:t?`无匹配`:`0 found`})]}),(0,J.jsxs)(`button`,{onClick:Zn,title:t?`定位当前或最近任务`:`Locate current or latest task`,"aria-label":t?`定位当前`:`Locate current`,children:[(0,J.jsx)(ct,{size:15}),(0,J.jsx)(`span`,{children:t?`定位当前`:`Locate current`})]}),(0,J.jsx)(`button`,{className:`map-fit-button`,onClick:Pn,title:t?`适配全图`:`Fit map`,"aria-label":`Fit map`,children:(0,J.jsx)($e,{size:15})}),(0,J.jsxs)(`button`,{type:`button`,"aria-label":t?`来路 / 去向`:`Trace dependencies`,title:t?`突出显示任务的直接前后依赖;点击卡片切换,再次点击退出`:`Highlight direct dependencies; click a card to switch, click it again to exit`,"aria-pressed":!!ot,disabled:!W.tasks.length,onClick:()=>jn(ot?null:Pe?.data.task.id??Je(e.tasks)?.id??null),children:[(0,J.jsx)(E,{size:15}),(0,J.jsx)(`span`,{children:t?`来路 / 去向`:`Dependencies`})]}),e.kind===`live`&&W.tasks.length>1&&!G.detailed&&!qt&&(0,J.jsxs)(`button`,{onClick:()=>{Jt(!0),Sn(1),wn(!0)},title:t?`回放这项研究是如何展开的`:`Replay how this research unfolded`,"aria-label":`Replay`,children:[(0,J.jsx)(T,{size:15}),(0,J.jsx)(`span`,{children:t?`回放`:`Replay`})]}),G.detailed&&(0,J.jsxs)(`button`,{onClick:G.back,className:`map-back-button`,"aria-label":`Return to map`,children:[(0,J.jsx)(w,{size:14}),(0,J.jsx)(`span`,{children:t?`返回全图`:`Overview`})]}),G.detailed&&Pe&&Pe.data.partCount>1&&(0,J.jsxs)(`nav`,{className:`map-part-switcher`,"aria-label":t?`切换任务部分`:`Switch task part`,children:[(0,J.jsx)(`button`,{"aria-label":t?`上一部分`:`Previous part`,disabled:!Pe.data.previousId,onClick:()=>Pe.data.previousId&&Mn(Pe.data.previousId,!0),children:(0,J.jsx)(it,{size:15})}),(0,J.jsxs)(`span`,{children:[Pe.data.part,` / `,Pe.data.partCount]}),(0,J.jsx)(`button`,{"aria-label":t?`下一部分`:`Next part`,disabled:!Pe.data.nextId,onClick:()=>Pe.data.nextId&&Mn(Pe.data.nextId,!0),children:(0,J.jsx)(oe,{size:15})})]}),(0,J.jsx)(`span`,{className:`map-toolbar-gap`,"aria-hidden":!0}),e.kind===`live`&&(0,J.jsxs)(`div`,{className:`map-workspace-actions`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":j,"aria-label":t?`对话`:`Conversation`,title:t?`与 Argus 的对话`:`Your conversation with Argus`,onClick:()=>{N(e=>!e),A(!1)},children:[(0,J.jsx)(L,{size:15}),(0,J.jsx)(`span`,{children:t?`对话`:`Conversation`})]}),(0,J.jsxs)(`button`,{type:`button`,className:`map-agent-toggle`,"aria-expanded":k,"aria-label":t?`Agent 动态`:`Agent activity`,title:t?`各个 Agent 正在做什么`:`What each agent is doing`,onClick:()=>{A(e=>!e),N(!1)},children:[(0,J.jsx)(_,{size:15}),(0,J.jsx)(`i`,{"data-active":!!r||n.pending,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:t?`工作详情`:`Work details`})]}),(0,J.jsxs)(`button`,{type:`button`,className:`map-delivery-toggle`,disabled:!y.deliveryCount,"aria-label":t?`交付成果`:`Deliveries`,title:t?`已交付的成果`:`What has been delivered`,onClick:y.onOpenDelivery,children:[(0,J.jsx)(me,{size:15}),(0,J.jsx)(`span`,{children:t?`交付成果`:`Deliveries`}),y.deliveryCount>0&&(0,J.jsx)(`b`,{children:y.deliveryCount})]})]})]}),kn&&(0,J.jsx)(`div`,{className:`map-feedback`,role:`status`,children:kn}),W.tasks.length===0?(0,J.jsxs)(`div`,{className:`map-empty`,children:[(0,J.jsx)(E,{size:36}),(0,J.jsx)(`h3`,{children:t?`把一个目标,变成可见的成果`:`Turn a goal into a visible result`}),(0,J.jsx)(`p`,{children:p?t?`尚无任务记录。`:`No task records are available.`:t?`描述你想完成的事情,看 Argus 规划、执行、审查,最后在这里交付。`:`Describe your goal. Watch Argus plan, build, review, and deliver here.`}),!p&&(0,J.jsx)(`div`,{className:`map-starters`,children:(t?[[`交互实验`,`做一个交互式实验室,用动画展示 Dijkstra 和 A* 怎样寻找最短路径。让我能画障碍、单步播放、比较探索范围,并验证两个算法的结果一致。`],[`数据洞察`,`用一组可复现的模拟数据,做一个辛普森悖论交互演示。让我能切换整体和分组视角,看结论怎样反转,附上验证过程。`],[`产品原型`,`做一个精致的个人旅行规划网页。我能调整预算和出行天数,比较三种行程方案,并将选中的方案导出。让手机上也方便操作。`]]:[[`Interactive lab`,`Build an interactive Dijkstra vs A* pathfinding lab with editable obstacles, step-by-step animation, and correctness checks.`],[`Data insights`,`Create an interactive Simpson’s paradox demo using reproducible synthetic data, with aggregate and grouped views and validation.`],[`Product prototype`,`Build a polished travel planner. Let me adjust budget and duration, compare three itineraries, and export my choice. Make it easy to use on a phone.`]]).map(([e,t])=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>{n.onChange(t),requestAnimationFrame(()=>pe.current?.querySelector(`textarea`)?.focus())},children:[e,` ↗`]},e))})]}):(0,J.jsxs)(Cp,{nodes:Bn,edges:Vn,nodeTypes:Eh,edgeTypes:Dh,onNodesChange:ue,onNodeMouseEnter:(e,t)=>Ut(t.id),onNodeMouseLeave:()=>Ut(null),onMove:G.onMove,defaultViewport:Fm,minZoom:.01,maxZoom:3.5,nodesDraggable:!1,nodesFocusable:!1,nodesConnectable:!1,edgesReconnectable:!1,zoomOnScroll:!1,zoomOnPinch:!0,zoomOnDoubleClick:!1,deleteKeyCode:null,selectionKeyCode:null,onlyRenderVisibleElements:Ce&&he,proOptions:{hideAttribution:!0},children:[(0,J.jsx)(Fp,{variant:jp.Dots,gap:88,size:3,color:`var(--map-dot)`}),(0,J.jsx)(Wp,{orientation:`horizontal`,showInteractive:!1,onFitView:Pn,fitViewOptions:{padding:.16,maxZoom:.27,minZoom:.01,duration:G.reducedMotion?0:320}}),(0,J.jsx)(am,{nodeColor:e=>e.type===`branch`?`#cfd2d5`:Oh[He(e.data.task)]??`#c6c8cb`,maskColor:`var(--map-minimap-mask)`,maskStrokeColor:`#6d737a`,maskStrokeWidth:1.5,onClick:(e,t)=>G.navigate(t),pannable:!0,zoomable:!0,ariaLabel:t?`地图导航预览`:`Map navigation preview`})]}),e.kind===`live`&&qt&&er,(0,J.jsxs)(`div`,{className:`map-legend nowheel`,children:[(0,J.jsxs)(`span`,{title:t?`内容相关的工作,不是执行依赖`:`Related in content, not an execution dependency`,children:[(0,J.jsx)(`b`,{className:`dashed`}),t?`内容关联`:`Related work`]}),(0,J.jsxs)(`span`,{title:t?`工作发生的先后`:`The order work happened in`,children:[(0,J.jsx)(`b`,{className:`order`}),t?`先后`:`Order`]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`b`,{}),t?`任务依赖`:`Dependency`]}),(0,J.jsxs)(`button`,{className:Dn?``:`is-muted`,onClick:On,"aria-pressed":Dn,disabled:Hn===0,"aria-label":`Toggle plan replacements`,children:[(0,J.jsx)(`b`,{className:`replacement`}),t?`计划替代`:`Plan changes`,Hn?` · ${Hn}`:``]})]}),!p&&(0,J.jsx)(oh,{...n,pendingLabel:f,progressVisible:!j,dispatchStatus:V?.result?.type===`task`?V.landed||n.historical?`task`:`launching`:V?.result?.outcome,onSend:Qt,onCancel:$t,overview:!G.detailed}),nn&&!p&&(0,J.jsxs)(`div`,{className:`map-context-menu`,role:`menu`,style:{left:nn.x,top:nn.y},children:[(0,J.jsx)(`button`,{role:`menuitem`,onClick:()=>{tn(nn.ref),rn(null)},children:t?`引用`:`Reference`}),e.kind===`live`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{role:`menuitem`,onClick:()=>{dn(``),ln({ref:nn.ref,x:nn.x,y:nn.y}),rn(null)},children:t?`添加批注`:`Add a note`}),(0,J.jsx)(`button`,{role:`menuitem`,onClick:()=>{n.onRouteOverrideChange?.(`task`),tn(nn.ref),rn(null)},children:t?`从这里展开`:`Branch from here`})]})]}),cn&&!p&&(0,J.jsxs)(`div`,{className:`map-note-editor nodrag nopan`,style:{left:Math.min(window.innerWidth-320,cn.x),top:Math.min(window.innerHeight-240,cn.y)},children:[(0,J.jsx)(`small`,{children:t?`批注《${cn.ref.task_title}》`:`Note on “${cn.ref.task_title}”`}),(0,J.jsx)(`textarea`,{autoFocus:!0,maxLength:2e3,value:un,onChange:e=>dn(e.target.value),placeholder:t?`写下你的观察,Argus 在下个规划周期会读到`:`Your observation; Argus reads it next planning cycle`}),fn&&(0,J.jsx)(`small`,{className:`map-note-error`,children:t?`没有保存上,稍后再试;草稿还在`:`Not saved; try again — the draft is kept`}),(0,J.jsxs)(`div`,{className:`map-note-actions`,children:[(0,J.jsx)(`button`,{onClick:()=>ln(null),children:t?`取消`:`Cancel`}),(0,J.jsx)(`button`,{className:`is-primary`,disabled:!un.trim(),onClick:()=>void mn(),children:t?`保存`:`Save`})]})]}),(W.cyclic||W.missing>0)&&(0,J.jsx)(`div`,{className:`map-graph-warning`,children:W.cyclic?t?`检测到循环引用,保留原始连线。`:`Cyclic references retained.`:`${W.missing} ${t?`个依赖不在当前记录范围内`:`dependencies outside the available history`}`})]})}),e.kind!==`live`&&er,(0,J.jsx)(S,{open:!!q,onClose:()=>Re(null),label:q?.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,children:q&&(ht||q.turn_kind===`qa`)?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(x,{title:q.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,sub:q.turn_kind===`qa`?q.objective||q.title:dt?.cards[q.id]?.title||q.title}),(0,J.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`map-task-reading`,"data-task-id":q.id,children:[q.outcome?.review_status===`unavailable`&&(0,J.jsxs)(`p`,{className:`mb-3 text-sm text-ink-dim`,role:`status`,children:[t?`当次审查异常,未形成审阅结论。`:`No review judgment was returned on this attempt.`,Fe&&(Fe.finished_ts??0)>(q.finished_ts??0)&&(0,J.jsx)(`button`,{type:`button`,className:`ml-2 text-blue underline`,onClick:Xn,children:t?`查看本项目后续通过的最终审稿`:`View this project's later accepted final review`})]}),Ye?.data.completionScope?(0,J.jsx)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:Ye.data.completionScope}):null,(0,J.jsx)(Se,{cardKey:q.id,taskId:q.id,card:dt?.cards[q.id],task:q,readOnly:p,originalDetail:q.turn_kind===`qa`?Ke?.text||(q.status===`running`?t?`正在回答…`:`Answering…`:q.status===`cancelled`?t?`本次回答已中断。`:`This answer was interrupted.`:q.summary||(t?`尚无回答。`:`No answer recorded.`)):q.objective||q.summary||(t?`这项任务尚无详细记录。`:`No detailed task record is available.`),selection:At,artifacts:$n.artifacts,onOpenArtifact:$n.onOpenArtifact}),p?null:(0,J.jsx)(C,{className:`mt-3 text-xs`,onClick:()=>tn({source:e.id,task_id:q.id,task_title:dt?.cards[q.id]?.title||q.title,event_ids:Ke?[Ke.id]:dt?.cards[q.id]?.event_ids||ht?.event_ids||[],lang:t?`zh`:`en`}),children:q.turn_kind===`qa`?t?`引用这条问答`:`Reference this Q&A`:t?`引用此任务`:`Reference this task`})]})]}):null})]})})})}var jh=(0,Y.memo)(function({snapshot:e,currentTaskId:t,events:n,managerSteps:r=[],draft:a,onDraftChange:s,onSend:c,attachments:l,onAttachmentsChange:u,pending:f,onCancel:m,focusSignal:h,readOnly:g=!1,onOpenSettings:_,routeOverride:v,onRouteOverrideChange:y,conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}){let{locale:O}=p(),j=O===`zh-CN`,[N,P]=(0,Y.useState)([]),F=l??N,I=(0,Y.useRef)(F);I.current=F;let L=(0,Y.useCallback)(e=>{let t=typeof e==`function`?e(I.current):e;I.current=t,u?u(t):P(t)},[u]),z=(0,Y.useRef)(a);z.current=a;let ee=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(ee.current=!0,()=>{ee.current=!1}),[]);let te=(0,Y.useCallback)(async(e,t=[],n,r)=>{let i=!1,a=await c(e,t,r=>{r.type===`settled`&&r.outcome===`error`&&(i=!0),ee.current&&(r.type===`settled`&&r.outcome===`error`&&!z.current.trim()&&(s(e),L(e=>e.length?e:t)),n?.(r))},r);return a&&!i&&ee.current&&(z.current===e&&s(``),L(e=>e.filter(e=>!t.includes(e)))),a},[c,s,L]),[V,H]=(0,Y.useState)(()=>new URLSearchParams(window.location.search).get(`dataset`)||A(`argus.map.source.v1`)||`live`),U=i({queryKey:[`map-datasets`],queryFn:({signal:e})=>d.mapDatasets(e),staleTime:1/0}),ne=i({queryKey:[`map-dataset`,V],queryFn:({signal:e})=>d.mapDataset(V,e),enabled:V!==`live`,staleTime:1/0,retry:!1}),re=o(),ie=`argus.map.history.v1:`+e.session.id,[ae,oe]=(0,Y.useState)(()=>ce(A(ie))),[se,W]=(0,Y.useState)(!1),le=i({queryKey:[`map-info`,e.session.id],queryFn:({signal:t})=>d.mapInfo(e.session.id,t),enabled:V===`live`,staleTime:6e4}),ue=ae??(le.data&&!le.data.requires_choice?{mode:`full`}:null);(0,Y.useEffect)(()=>{if(!ae&&le.data&&!le.data.requires_choice){let e={mode:`full`};oe(e),k(ie,JSON.stringify(e))}},[le.data,ae,ie]);let de=V!==`live`||!!ue&&ue.mode!==`off`&&!se,fe=[`map-live`,e.session.id,ue?.mode,ue?.since,ue?.eventSince,ue?.taskId],pe=JSON.stringify([V,e.session.id,O,ue]),me=e=>{oe(e),k(ie,JSON.stringify(e)),W(!1)},he=i({queryKey:fe,queryFn:async({signal:t})=>{let n=re.getQueryData(fe),r=ue?.mode===`full`?await d.mapHistory(e.session.id,t,n?.history_cursor,n?.cursor):await d.liveMap(e.session.id,t,n?.cursor,ue||void 0);return R(re.getQueryData(fe),r)},enabled:V===`live`&&de,staleTime:1/0,gcTime:72e5,refetchOnMount:`always`,refetchInterval:t=>G(de,t.state.data,e)}),ge=V===`live`&&B(e),_e=Ue(e,e.mission_view,n),ve=_e.reason===`background_work`&&_e.taskId?je(_e,j?`zh-CN`:`en`):``,ye=(0,Y.useMemo)(()=>V===`live`&&!ge&&ve?{taskId:_e.taskId,sentence:ve}:void 0,[V,ge,_e.taskId,ve]),be=n.filter(e=>e.run_label!==`map-summary`&&/^(life\.(mission\.|phase\.|planner\.task_added)|manager\.turn\.|round\.|agent\.message|engineer\.progress|ui\.argus|team\.|idea\.portfolio\.)/.test(String(e.type))).at(-1),xe=JSON.stringify([be?.ts,be?.event_id||be?.id,be?.revision,be?.updated_ts,be?.status,e.backlog,ge]),Se=(0,Y.useRef)(null),Ce=(0,Y.useRef)(0),we=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let e=we.current;if(!e)return;let t=()=>{Ce.current=Date.now()+900},n=e=>{e.buttons&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`pointerdown`,t),e.addEventListener(`pointermove`,n),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`pointerdown`,t),e.removeEventListener(`pointermove`,n)}},[]),(0,Y.useEffect)(()=>{if(V!==`live`||!de||Se.current)return;let t=()=>{let n=Ce.current-Date.now();if(n>0){Se.current=setTimeout(t,n+120);return}Se.current=null,re.invalidateQueries({queryKey:[`map-live`,e.session.id]})};Se.current=setTimeout(t,650)},[xe,V,e.session.id,re,de]),(0,Y.useEffect)(()=>()=>{Se.current&&clearTimeout(Se.current),Se.current=null},[V,e.session.id,de]);let K=V===`live`?he.data:ne.data,[Te,Ee]=(0,Y.useState)(!1),De=(0,Y.useMemo)(()=>({shown:Te,toggle:()=>Ee(e=>!e)}),[Te]),Oe=(0,Y.useMemo)(()=>K?M(K.tasks).links.filter(e=>e.kind===`replacement`).length:0,[K]),ke=(0,Y.useMemo)(()=>({conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}),[b,x,S,C,w,T,E,D]),Ae=(0,Y.useMemo)(()=>({footer:(0,J.jsx)(Ze,{sid:e.session.id,roles:e.roles,running:e.daemon.alive||!!e.manager_requests?.length,lastCall:e.last_call,onOpenSettings:g?void 0:_}),routeOverride:v,onRouteOverrideChange:y,value:a,onChange:s,onSend:te,attachments:F,onAttachmentsChange:L,pending:f,onCancel:m,focusSignal:h,sessionName:e.session.display_name||e.session.id,historical:V!==`live`,zh:j}),[v,y,a,s,te,F,f,m,h,e.session.display_name,e.session.id,V,j,e.roles,e.daemon.alive,e.manager_requests,e.last_call,g,_]),Me=e=>{H(e),k(`argus.map.source.v1`,e);let t=new URL(window.location.href);t.searchParams.set(`dataset`,e),window.history.replaceState(null,``,t)};return(0,J.jsxs)(`section`,{ref:we,className:`argus-map`,"aria-label":j?`进度地图`:`Progress map`,children:[(0,J.jsxs)(`header`,{className:`map-header`,children:[(0,J.jsxs)(`div`,{className:`map-heading`,children:[(0,J.jsx)(`span`,{className:`map-kicker`,"aria-hidden":`true`,children:j?`ARGUS · 研究地图`:`ARGUS · RESEARCH MAP`}),(0,J.jsx)(`h1`,{title:e.session.display_name,children:e.session.display_name})]}),(0,J.jsxs)(`details`,{className:`map-more`,children:[(0,J.jsx)(`summary`,{"aria-label":j?`地图选项`:`Map options`,title:j?`地图选项`:`Map options`,children:(0,J.jsx)(dt,{size:16})}),(0,J.jsxs)(`div`,{className:`map-more-menu`,children:[K&&(0,J.jsx)(kh,{events:K.events,zh:j}),(0,J.jsxs)(`div`,{className:`map-dataset-bar`,children:[(0,J.jsx)(at,{size:15}),(0,J.jsxs)(`select`,{"aria-label":j?`地图数据来源`:`Map data source`,value:V,onChange:e=>Me(e.target.value),children:[(0,J.jsxs)(`option`,{value:`live`,children:[j?`当前会话`:`Current session`,` ·`,` `,e.session.display_name]}),!U.data?.datasets.some(e=>e.id===V)&&V!==`live`&&(0,J.jsx)(`option`,{value:V,children:V}),U.data?.datasets.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.task_count]},e.id))]}),K?.captured_at&&(0,J.jsxs)(`span`,{className:`map-capture`,children:[(0,J.jsx)(Ie,{size:12}),new Date(K.captured_at).toLocaleDateString()]})]}),V===`live`&&le.data&&(0,J.jsx)(`button`,{type:`button`,className:`map-scope-button`,onClick:()=>W(!0),children:j?`加载范围`:`History range`}),!g&&_&&(0,J.jsx)(`button`,{type:`button`,onClick:_,className:`map-scope-button`,children:j?`地图模型设置`:`Map model settings`}),Oe>0&&(0,J.jsx)(`button`,{type:`button`,className:`map-scope-button map-narrow-only`,"aria-pressed":Te,onClick:De.toggle,children:Te?j?`隐藏计划替代连线 · ${Oe}`:`Hide plan changes · ${Oe}`:j?`显示计划替代连线 · ${Oe}`:`Show plan changes · ${Oe}`})]})]})]}),V===`live`&&le.data&&(0,J.jsx)(Sh,{open:se||!ue&&le.data.requires_choice,info:le.data,zh:j,readOnly:g,onChoose:me}),V===`live`&&le.isError&&(0,J.jsxs)(`div`,{className:`map-data-error`,children:[j?`暂时无法检查历史记录。`:`Could not check session history.`,(0,J.jsx)(`button`,{onClick:()=>void le.refetch(),children:j?`重试`:`Retry`})]}),de&&K?.history_loading&&(0,J.jsxs)(`div`,{className:`map-history-progress`,role:`status`,children:[j?`正在分批加载历史记录`:`Loading history in pages`,K.history_progress&&` · ${(K.history_progress.loaded_bytes/1024/1024).toFixed(1)} / ${(K.history_progress.total_bytes/1024/1024).toFixed(1)} MB`,(0,J.jsx)(`button`,{onClick:()=>W(!0),children:j?`更改范围`:`Change range`})]}),de&&K&&(V===`live`?he.isError:ne.isError)&&(0,J.jsxs)(`div`,{className:`map-data-error`,role:`status`,children:[j?`暂时无法更新,已保留加载的地图。`:`Updates are unavailable. Your loaded map is preserved.`,(0,J.jsx)(`button`,{onClick:()=>void(V===`live`?he.refetch():ne.refetch()),children:j?`重试`:`Retry`})]}),U.isError&&(0,J.jsxs)(`div`,{className:`map-data-error`,children:[j?`历史记录列表暂时无法读取,可切换当前会话或重试。`:`Historical maps are unavailable. Open the current session or retry.`,(0,J.jsx)(`button`,{onClick:()=>void U.refetch(),children:j?`重试`:`Retry`})]}),de?(V===`live`?he.isError:ne.isError)&&!K?(0,J.jsxs)(`div`,{className:`map-empty`,children:[(0,J.jsx)(`h3`,{children:j?`地图暂时无法读取`:`Map unavailable`}),(0,J.jsx)(`p`,{children:String(V===`live`?he.error:ne.error)}),(0,J.jsx)(`button`,{onClick:()=>void(V===`live`?he.refetch():ne.refetch()),children:j?`重试`:`Retry`})]}):K?(0,J.jsx)(yp,{children:(0,J.jsx)(Ah,{data:K,actions:ke,snapshot:e,currentTaskId:t,events:n,pendingLabel:r.at(-1)?.detail||r.at(-1)?.label,viewKey:pe,paused:ge,sessionId:e.session.id,zh:j,readOnly:g,replacements:De,activePhase:V===`live`&&!ge&&!ye?e.roles.find(e=>e.active)?.role:void 0,waiting:ye,composer:Ae})},pe):(0,J.jsxs)(`div`,{className:`map-empty is-loading`,"aria-busy":`true`,children:[(0,J.jsxs)(`div`,{className:`map-ghosts`,"aria-hidden":!0,children:[(0,J.jsx)(`i`,{}),(0,J.jsx)(`i`,{}),(0,J.jsx)(`i`,{})]}),j?`正在载入地图…`:`Loading map…`]}):(0,J.jsxs)(`div`,{className:`map-empty`,children:[(0,J.jsx)(`h3`,{children:j?`地图尚未开启`:`Map is not enabled`}),(0,J.jsx)(`p`,{children:le.isPending?j?`正在检查历史记录规模…`:`Checking history size…`:j?`选择加载范围后查看研究进度。`:`Choose a history range to view research progress.`}),le.data&&(0,J.jsx)(`button`,{onClick:()=>W(!0),children:j?`选择加载范围`:`Choose history range`})]})]})});export{Ah as MapCanvas,jh as MapPanel,kh as MapTeamProgress}; \ No newline at end of file diff --git a/frontend/web/dist/assets/MapPanel-pOMl9sI3.js b/frontend/web/dist/assets/MapPanel-pOMl9sI3.js new file mode 100644 index 000000000..42989e860 --- /dev/null +++ b/frontend/web/dist/assets/MapPanel-pOMl9sI3.js @@ -0,0 +1,7 @@ +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,v as r}from"./icons-DHjcpj5P.js";import{a as i,b as a,c as o,i as s}from"./query-dCPZk0Xc.js";import{N as c,O as l,U as u,W as d,k as f,q as p}from"./index-Dkv2HM-n.js";import{A as m,C as h,F as g,I as _,L as v,O as y,_ as b,b as x,g as S,j as C,k as w,m as T,p as E,r as D,w as O,x as k}from"./AppearanceControls-DpaE5wy6.js";import{t as A}from"./activity-BmXzrCrJ.js";import{n as j,t as M}from"./history-BylQ-TOW.js";import{a as N,i as P,n as F,o as ee,r as I,t as L}from"./sliders-horizontal-BiyUR49M.js";import{a as R}from"./format-CB65te2P.js";import{a as z,i as B,n as V}from"./useWorkbenchTheme-DMn1yhZa.js";import{$ as H,A as U,At as W,B as te,C as G,D as ne,Dt as re,E as ie,G as ae,H as oe,I as K,It as se,J as ce,K as le,L as ue,Lt as de,M as fe,Mt as pe,N as me,Nt as he,O as q,Ot as ge,P as _e,Pt as ve,Q as ye,R as be,S as xe,T as Se,Tt as Ce,U as we,V as Te,W as Ee,X as De,Y as Oe,Z as ke,_ as Ae,a as je,b as Me,bt as Ne,c as Pe,ct as Fe,d as Ie,dt as Le,et as Re,f as ze,ft as Be,g as Ve,gt as He,h as Ue,ht as We,i as J,j as Ge,k as Ke,kt as qe,lt as Je,mt as Ye,n as Xe,o as Ze,pt as Qe,q as $e,r as et,s as tt,st as nt,u as rt,ut as it,v as at,vt as ot,w as st,x as ct,y as lt,yt as ut,z as dt}from"./App-DHmEWeHX.js";var ft=v(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),pt=v(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),mt=v(`CornerDownLeft`,[[`polyline`,{points:`9 10 4 15 9 20`,key:`r3jprv`}],[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}]]),ht=v(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),gt=v(`ListChecks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),_t=v(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),vt=v(`Route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),Y=n();function yt({events:e,connected:t,pending:n,artifacts:r,zh:i,onClose:a,onOpenArtifact:o,onOpenDelivery:s}){let c=e.filter(e=>e.type===`ui.operator`||e.type===`ui.argus`);return(0,Y.jsxs)(`aside`,{className:`map-conversation nowheel nodrag nopan`,"aria-label":i?`地图对话`:`Map conversation`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(qe,{size:16}),(0,Y.jsx)(`strong`,{children:i?`与 ${f().name} 对话`:`Talk to ${f().name}`}),(0,Y.jsx)(`button`,{type:`button`,onClick:a,"aria-label":i?`关闭对话`:`Close conversation`,children:(0,Y.jsx)(y,{size:18})})]}),c.length?(0,Y.jsx)(xe,{events:c,connected:t,showReasoning:!1,onToggleReasoning:()=>{},embedded:!0,showHeader:!1,artifacts:r,onOpenArtifact:o,onOpenDelivery:s}):(0,Y.jsx)(`p`,{className:`map-conversation-empty`,children:i?`在下方发送目标或问题,回复会保留在这里。`:`Send a goal or question below. Your conversation stays here.`}),n&&!c.some(e=>e.type===`ui.argus`&&e.live===!0)&&(0,Y.jsx)(`p`,{className:`map-conversation-pending`,role:`status`,children:i?`${f().name} 正在回复…`:`${f().name} is replying…`})]})}var bt=new Set([`life.planner.task_added`,`life.mission.started`,`round.main.completed`,`round.review.completed`,`turn.asked`,`turn.replied`]);function xt(e,t,n=0){if(!e||!t)return[];let r=e.events.filter(e=>e.item_id===t.id&&bt.has(e.type)&&Number.isFinite(e.ts)&&e.ts>=n),i=Math.max(n,...r.filter(e=>e.type===`life.mission.started`).map(e=>e.ts)),a=r.filter(e=>e.ts>=i),o=new Map;for(let e of bt){let t=e.startsWith(`round.`)?2:1;for(let n of a.filter(t=>t.type===e).sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id)).slice(-t))o.set(n.id,n)}return[...o.values()].sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id))}function St(e,t){return{key:e.id,task_id:e.id,kind:`task`,event_ids:t.map(e=>e.id)}}function Ct(e,t){return e?JSON.stringify({task:{id:e.id,title:e.title,objective:e.objective,status:e.status,summary:e.summary,acceptance_check:e.acceptance_check,goal_contribution:e.goal_contribution,plan_hypothesis:e.plan_hypothesis,non_goals:e.non_goals,outcome:e.outcome,pending_question:e.pending_question,started_ts:e.started_ts,finished_ts:e.finished_ts,attempt:e.attempt},events:t.map(e=>[e.id,e.revision??e])}):``}function wt(e){if(!e||typeof e!=`object`)return!1;let t=e;if(![`why`,`scope`,`next`].every(e=>typeof t[e]==`string`&&t[e].trim()))return!1;if(t.concept===null)return!0;if(!t.concept||typeof t.concept!=`object`)return!1;let n=t.concept;return[`name`,`explanation`,`example`,`connection`].every(e=>typeof n[e]==`string`&&n[e].trim())}function Tt({task:e,artifacts:t,onOpenArtifact:n}){let r=l().locale===`zh-CN`,i=typeof e?.pending_question==`string`?e.pending_question.trim():``;return i?(0,Y.jsxs)(`section`,{className:`mt-4 min-w-0 border-t border-line/60 pt-3 text-[13px] leading-6 text-ink-dim`,"data-reader-pending-question":e.id,children:[(0,Y.jsx)(`h3`,{className:`text-xs font-medium text-ink`,children:r?`这一步在等你回答`:`This step is waiting for your answer`}),(0,Y.jsx)(S,{artifacts:t,onOpenArtifact:n,children:i})]}):null}function Et({cardKey:e,taskId:t,card:n,task:r,originalDetail:i,selection:a,artifacts:o,onOpenArtifact:s,readOnly:c}){let{locale:u}=l(),d=u===`zh-CN`;if(r?.turn_kind===`qa`)return(0,Y.jsx)(`div`,{className:`macro-reader-markdown`,"data-reader-card":e,"data-reader-task-id":t,children:(0,Y.jsx)(S,{artifacts:o,onOpenArtifact:s,children:i})});let f=a?.request.key===e&&a.request.task_id===t?a:void 0,p=(n?.version??0)>=14&&wt(n?.reader_brief)?n.reader_brief:void 0;return(0,Y.jsxs)(`div`,{className:`font-sans`,"data-reader-card":e,"data-reader-task-id":t,children:[(0,Y.jsx)(je,{generatedAt:n?.generated_at,pending:f?.pending,generating:f?.generating,hasExplanation:!!n,phase:f?.phase,error:f?.error,unavailable:f?.unavailable,retry:f?.retry,retryDisabled:f?.retryDisabled}),f?.foundationRequired?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-ink-dim`,children:d?`先在“问题基础”里选择一份说明,再阅读本次进展的解释。`:`Choose a saved foundation to explain this progress.`}):null,p?(0,Y.jsx)(J,{brief:p,identity:e,detail:n?.detail,learningPath:n?.learning_path,foundation:n?.foundation_ref,readingUnavailable:n?.teaching_review?.reading_review?.status===`unavailable`,teachingUnavailable:n?.teaching_review?.status===`unavailable`,artifacts:o,onOpenArtifact:s}):(0,Y.jsx)(`div`,{className:`macro-reader-markdown`,children:(0,Y.jsx)(S,{artifacts:o,onOpenArtifact:s,children:Ie(n?.detail||i)})}),(0,Y.jsx)(Tt,{task:r?.id===t?r:void 0,artifacts:o,onOpenArtifact:s}),(0,Y.jsx)(`div`,{className:`my-3`,children:(0,Y.jsx)(Xe,{card:n,cardKey:e,taskId:t,readOnly:c,context:f?.questionContext})})]})}var X=e(r(),1);function Dt({sid:e,record:t,expanded:n=!1,zh:r}){let[i,a]=(0,X.useState)(n),[o,s]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(``);(0,X.useEffect)(()=>{if(!i||!e)return;let n=new AbortController;return u(!0),f(``),c.workRecord(e,t.role,t.id,n.signal).then(e=>{n.signal.aborted||s(e.detail)}).catch(e=>{n.signal.aborted||f(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||u(!1)}),()=>n.abort()},[i,e,t.id,t.role,t.detail]);let p=o.length>=t.detail.length?o:t.detail;return(0,Y.jsxs)(`details`,{open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(`span`,{children:i?r?`收起详情`:`Hide details`:r?`展开完整记录`:`Read full record`}),(0,Y.jsx)(g,{size:12})]}),(0,Y.jsxs)(Y.Fragment,{children:[l&&(0,Y.jsx)(`small`,{role:`status`,children:r?`正在读取完整记录…`:`Loading the full record…`}),d&&(0,Y.jsx)(`small`,{role:`status`,children:r?`暂未读取到完整记录,已显示保存的摘要。可收起后重试。`:`Full record unavailable; the saved preview is shown. Reopen to retry.`}),(0,Y.jsx)(`div`,{className:`agent-record-actions`,children:(0,Y.jsx)(b,{text:p,label:r?`复制完整记录`:`Copy full record`,copiedLabel:r?`已复制`:`Copied`})}),(0,Y.jsx)(`div`,{className:`agent-record-detail`,children:(0,Y.jsx)(S,{children:p})}),t.round_index!=null&&(0,Y.jsx)(`small`,{children:r?`第 ${t.round_index} 轮`:`Round ${t.round_index}`})]})]})}function Ot({sid:e,view:t,roles:n=[],events:r=[],taskId:i,paused:a=!1,selectedRole:o,onSelectRole:s,onClose:u,showTabs:d=!0}){let{locale:f,t:p}=l(),m=f===`zh-CN`,[g,v]=(0,X.useState)(null),[b,C]=(0,X.useState)(24),[T,E]=(0,X.useState)(!1),[D,j]=(0,X.useState)(``),[M,N]=(0,X.useState)(Date.now),F=o||g||n.find(e=>e.active)?.role||t?.active_role||`manager`,I=it(t,n,F,a,i),L=Le(t,F,i).map(e=>{let t=e.detail;for(let n of r){if(n.kind===`reasoning`)continue;let r=String(n.event_id||n.id||``),i=String(n.message_id||``);if(r!==e.id&&(!i||e.id!==`${e.role}:${i}`))continue;let a=Be(String(n.text||n.reason||n.summary||``));a.length>t.length&&(t=a)}return t===e.detail?e:{...e,detail:t}});(0,X.useEffect)(()=>{C(24),j(``)},[e,F,i]);let R=i?We(void 0,t,i):0,z=R?Le(t,F,i,R):L,B=z[0],V=z.find(e=>e.detail&&[`agent_message`,`assistant_message`,`decision`,`verdict`,`handoff`,`review`,`completion`].includes(e.kind)),H=Qe(r,F,i,R),U=H&&Number(H.ts||0)>=(B?.ts??0),W=!U&&B&&[`agent_message`,`assistant_message`].includes(B.kind)&&B.detail?B.detail.split(/[。\n]/)[0].slice(0,70):Je(U?String(H.kind):B?.kind||`task`,m,U?String(H.tool_name||``):``),te=n.find(e=>e.role===F)?.model||t?.roles.find(e=>e.role===F)?.model,G=B?Math.max(0,Math.floor(M/1e3-B.ts)):0,ne=Math.max(B?.ts??0,U?Number(H?.ts||0):0),re=I&&ne?Ye(M/1e3-ne,m):``;(0,X.useEffect)(()=>{if(!I)return;let e=setInterval(()=>N(Date.now()),1e3);return()=>clearInterval(e)},[I]);let ie=e=>O(e)?h(e,p):e;return(0,Y.jsxs)(`section`,{className:`agent-activity`,style:{"--agent-role-color":k(F)},"aria-label":m?`工作详情`:`Work details`,children:[(0,Y.jsxs)(`header`,{className:`agent-activity-heading`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(A,{size:15}),m?`工作详情`:`Work details`]}),u&&(0,Y.jsx)(`button`,{type:`button`,onClick:u,"aria-label":m?`关闭工作详情`:`Close work details`,children:(0,Y.jsx)(y,{size:17})})]}),d&&(0,Y.jsx)(`div`,{className:`agent-activity-tabs`,role:`group`,"aria-label":m?`筛选 Agent`:`Filter agents`,children:x.map(e=>(0,Y.jsxs)(`button`,{type:`button`,"data-role":e,"aria-pressed":F===e,style:{"--agent-role-color":k(e)},onClick:()=>{v(e),s?.(e)},children:[(0,Y.jsx)(`i`,{"data-active":it(t,n,e,a,i)}),ie(e)]},e))}),(0,Y.jsxs)(`div`,{className:`agent-current`,"data-active":I,children:[(0,Y.jsxs)(`div`,{className:`agent-current-kicker`,children:[(0,Y.jsx)(`span`,{children:I?m?`当前工作`:`Current work`:a?m?`工作已暂停`:`Work paused`:m?`最近进度`:`Latest progress`}),I?(0,Y.jsxs)(`span`,{className:`agent-live-indicator`,"data-stale":re?!0:void 0,children:[(0,Y.jsx)(`i`,{}),m?`处理中`:`In progress`,re&&(0,Y.jsx)(`small`,{className:`agent-live-stale`,children:re})]}):(0,Y.jsx)(P,{size:12})]}),(0,Y.jsx)(`h3`,{children:B||U?W:I?m?`尚无本次工作记录`:`No work recorded for this attempt yet`:m?`等待任务分配`:`Waiting for an assignment`}),V?.detail&&(0,Y.jsx)(`div`,{className:`agent-current-summary`,children:(0,Y.jsx)(S,{children:V.detail})}),!V&&B?.detail&&(0,Y.jsx)(`p`,{className:`agent-current-summary`,children:B.detail}),B&&(0,Y.jsxs)(`div`,{className:`agent-current-meta`,children:[(0,Y.jsx)(ee,{size:12}),(0,Y.jsx)(`span`,{children:m?`${G<60?G+` 秒`:G<3600?Math.floor(G/60)+` 分钟`:G<86400?Math.floor(G/3600)+` 小时`:Math.floor(G/86400)+` 天`}前更新`:`Updated ${G<60?G+`s`:G<3600?Math.floor(G/60)+`m`:G<86400?Math.floor(G/3600)+`h`:Math.floor(G/86400)+`d`} ago`})]}),(0,Y.jsxs)(`details`,{className:`agent-technical-details`,children:[(0,Y.jsx)(`summary`,{children:m?`查看运行信息`:`Runtime details`}),(0,Y.jsxs)(`p`,{children:[ie(F),te?` · ${te}`:``,B?.round_index==null?``:m?` · 第 ${B.round_index} 轮`:` · Round ${B.round_index}`]})]})]}),(0,Y.jsxs)(`div`,{className:`agent-records-heading`,children:[(0,Y.jsx)(`span`,{children:m?`工作记录`:`Work log`}),(0,Y.jsxs)(`span`,{children:[L.length,` `,m?`条`:`records`]})]}),(0,Y.jsxs)(`div`,{className:`agent-records`,role:`log`,"aria-live":`off`,children:[L.slice(0,b).map((t,n)=>{let r=I&&t.id===B?.id,i=[`done`,`completed`].includes(t.status),a=[`failed`,`error`,`rejected`].includes(t.status),o=i?_:[`tool_use`,`command_execution`].includes(t.kind)?w:ht;return(0,Y.jsxs)(`article`,{className:`agent-record`,"data-active":r,"data-failed":a,children:[(0,Y.jsx)(`span`,{className:`agent-record-icon`,children:(0,Y.jsx)(o,{size:13})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`agent-record-title`,children:[(0,Y.jsx)(`strong`,{children:Je(t.kind,m)}),(0,Y.jsx)(`time`,{children:new Date(t.ts*1e3).toLocaleTimeString(m?`zh-CN`:`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})})]}),(0,Y.jsx)(`small`,{children:r?m?`进行中`:`In progress`:a?m?`未完成`:`Did not finish`:i?m?`已完成`:`Completed`:m?`已记录`:`Recorded`}),(t.detail||e)&&(0,Y.jsx)(Dt,{sid:e,record:t,zh:m,expanded:n===0||t.id===V?.id})]})]},t.id)}),!L.length&&(0,Y.jsx)(`p`,{className:`agent-records-empty`,children:m?`${ie(F)}尚未留下这个任务的工作记录。`:`No work has been recorded for this task by ${ie(F)}.`})]}),(0,Y.jsxs)(`div`,{className:`agent-records-footer`,children:[bC(e=>e+24),children:m?`加载更早记录(还剩 ${L.length-b} 条)`:`Load earlier records (${L.length-b} remaining)`}),e&&(0,Y.jsx)(`button`,{type:`button`,disabled:T,onClick:()=>{E(!0),j(``),c.downloadWorkLog(e,F,i).catch(e=>j(e instanceof Error?e.message:String(e))).finally(()=>E(!1))},children:T?m?`正在准备完整记录…`:`Preparing full log…`:m?`下载完整工作记录(含更早历史)`:`Download full work log (including earlier history)`}),D&&(0,Y.jsx)(`small`,{role:`alert`,children:D})]})]})}var kt=p(),Z=(e,t,n)=>e+(t-e)*n,At=e=>e*e*(3-2*e),jt=(e,t,n)=>Math.max(t,Math.min(n,e));function Mt(e,t,n){let r=Math.hypot(t.x-e.x,t.y-e.y),i=Math.min(140,Math.max(54,r*.22))*(t.x>=e.x?-1:1),a=Math.min(120,r*.3),o={x:jt(e.x+i,28,n-28),y:e.y-a},s={x:jt(t.x+i*.6,28,n-28),y:t.y+a};return n=>{let r=1-n;return{x:r**3*e.x+3*r**2*n*o.x+3*r*n**2*s.x+n**3*t.x,y:r**3*e.y+3*r**2*n*o.y+3*r*n**2*s.y+n**3*t.y}}}function Nt({flight:e,canvas:t,zh:n,historical:r=!1,onReveal:i,onLand:a,onFinish:o}){let s=(0,X.useRef)(null),c=(0,X.useRef)(null),l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=`dispatch-wake-${(0,X.useId)().replace(/:/g,``)}`,f=(0,X.useRef)({onReveal:i,onLand:a,onFinish:o});f.current={onReveal:i,onLand:a,onFinish:o};let p=e.result?.type===`task`&&!r;return(0,X.useEffect)(()=>{if(!e.result)return;let n=0,i,a,o=()=>f.current.onFinish(e.id);if(e.result.type!==`task`||r)return i=setTimeout(o,2200),()=>clearTimeout(i);let d=s.current;if(!d)return;let p=e.result.taskId,m=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,h=t.current,g=()=>{cancelAnimationFrame(n),clearTimeout(i),f.current.onLand(e.id),o()};h?.addEventListener(`pointerdown`,g,{once:!0}),h?.addEventListener(`wheel`,g,{once:!0,passive:!0});let _=performance.now(),v=0,y=!1,b=0,x,S=r=>{if(r-_>6e3){o();return}let s=t.current?.querySelector(`.map-macro[data-task-id="${CSS.escape(p)}"]`);if(!s||s.getBoundingClientRect().width<8){r-v>600&&(f.current.onReveal(p),v=r),n=requestAnimationFrame(S);return}if(m){f.current.onLand(e.id),i=setTimeout(o,1200);return}y||(f.current.onReveal(p),y=!0,v=r);let h=s.getBoundingClientRect();if((!x||Math.abs(x.x-h.x)+Math.abs(x.y-h.y)+Math.abs(x.width-h.width)>.7)&&(b=r),x=h,r-v<360||r-b<100){n=requestAnimationFrame(S);return}let g=t.current?.querySelector(`.map-composer`)?.getBoundingClientRect(),C=g?{x:g.left,y:g.top,width:g.width,height:g.height}:e.origin,w={x:C.x+C.width/2,y:C.y+C.height/2},T={x:w.x,y:w.y-26},E={x:h.left+h.width/2,y:h.top+h.height/2},D=Mt(T,E,innerWidth),O=Math.min(320,C.width),k=Math.min(68,C.height),A=performance.now(),j=!1,M=t=>{if(!s.isConnected){o();return}let r=Math.min(1,(t-A)/1050),p=At(Math.min(1,r/.22)),m=At(jt((r-.22)/.6,0,1)),h=At(jt((r-.82)/.18,0,1)),g=r<.22?{x:w.x,y:Z(w.y,T.y,p)}:D(m),_=Z(52,22,h),v=Z(O,_,p),y=Z(k,_,p);if(d.style.width=`${v}px`,d.style.height=`${y}px`,d.style.transform=`translate3d(${g.x-v/2}px,${g.y-y/2}px,0)`,d.style.opacity=String(Math.min(1,r/.045)*(1-h)),d.style.setProperty(`--dispatch-copy`,String(1-At(Math.min(1,r/.12)))),d.style.setProperty(`--dispatch-mark`,String(Z(1,.7,h))),d.dataset.phase=r<.22?`compress`:r<.82?`travel`:`arrive`,c.current&&l.current&&r>.22){let e=Math.max(0,m-.16),t=Array.from({length:13},(t,n)=>D(Z(e,m,n/12)));c.current.setAttribute(`d`,t.map((e,t)=>`${t?`L`:`M`} ${e.x} ${e.y}`).join(` `)),c.current.style.opacity=String(.7*(1-h)),l.current.setAttribute(`x1`,String(t[0].x)),l.current.setAttribute(`y1`,String(t[0].y)),l.current.setAttribute(`x2`,String(g.x)),l.current.setAttribute(`y2`,String(g.y))}r>=.82&&!j&&(j=!0,f.current.onLand(e.id),u.current&&(u.current.style.left=`${E.x}px`,u.current.style.top=`${E.y}px`,a=u.current.animate([{transform:`translate(-50%,-50%) scale(.65)`,opacity:.65},{transform:`translate(-50%,-50%) scale(2.8)`,opacity:0}],{duration:650,easing:`cubic-bezier(.16,1,.3,1)`,fill:`both`}))),r<1?n=requestAnimationFrame(M):i=setTimeout(o,550)};n=requestAnimationFrame(M)};return n=requestAnimationFrame(S),()=>{cancelAnimationFrame(n),clearTimeout(i),a?.cancel(),h?.removeEventListener(`pointerdown`,g),h?.removeEventListener(`wheel`,g)}},[e.id,e.result,t,r]),p?(0,kt.createPortal)((0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`svg`,{className:`map-dispatch-trail`,"aria-hidden":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{ref:l,id:d,gradientUnits:`userSpaceOnUse`,children:[(0,Y.jsx)(`stop`,{stopColor:`#6fbcce`,stopOpacity:`0`}),(0,Y.jsx)(`stop`,{offset:`1`,stopColor:`#87d9cf`})]})}),(0,Y.jsx)(`path`,{ref:c,fill:`none`,stroke:`url(#${d})`,strokeWidth:`2.5`,strokeLinecap:`round`})]}),(0,Y.jsxs)(`div`,{ref:s,className:`map-dispatch-flight`,"data-testid":`map-dispatch-flight`,"data-state":`task`,"data-task-id":e.result?.type===`task`?e.result.taskId:void 0,"aria-hidden":`true`,children:[(0,Y.jsx)(`div`,{className:`map-dispatch-symbol`,children:(0,Y.jsx)(V,{size:25})}),(0,Y.jsxs)(`div`,{className:`map-dispatch-copy`,children:[(0,Y.jsx)(`strong`,{children:e.text}),(0,Y.jsx)(`span`,{children:n?`进入任务地图`:`Into your task map`})]})]}),(0,Y.jsx)(`div`,{ref:u,className:`map-dispatch-halo`,"aria-hidden":`true`})]}),document.body):null}var Pt=()=>({revision:0,cards:{},steps:{},links:{}}),Ft=(e,t)=>`${e}\u0000${t}`,It=class{initialized=!1;seen=new Set;revision=0;loadingHistory=!1;observe(e,t=!1){let n=Pt(),r=0;for(let t of e.cards){this.seen.has(`card:${t.id}`)||(n.cards[t.id]=Math.min(r++*100,400)),this.seen.add(`card:${t.id}`);let i=e.layouts[t.id],a=0;for(let e of i.steps){let r=Ft(t.id,e.id);this.seen.has(`step:${r}`)||(n.steps[r]=160+Math.min(a++*120,720)),this.seen.add(`step:${r}`)}for(let e of i.links){let r=Ft(t.id,e.id);this.seen.has(`link:${r}`)||(n.links[r]=Math.max(0,(n.steps[Ft(t.id,e.target)]??160)-160)),this.seen.add(`link:${r}`)}}for(let t of e.links)this.seen.has(`outer:${t.id}`)||(n.links[t.id]=0),this.seen.add(`outer:${t.id}`);let i=!this.initialized||t||this.loadingHistory;return this.loadingHistory=t,this.initialized=!0,i||![n.cards,n.steps,n.links].some(e=>Object.keys(e).length)?null:{...n,revision:++this.revision}}};function Lt(e,t=!1){let n=(0,X.useRef)(new It),r=(0,X.useRef)(new Set),[i,a]=(0,X.useState)(Pt);return(0,X.useEffect)(()=>{let i=n.current.observe(e,t);if(t)r.current.forEach(clearTimeout),r.current.clear(),a(Pt());else if(i){a(e=>({revision:i.revision,cards:{...e.cards,...i.cards},steps:{...e.steps,...i.steps},links:{...e.links,...i.links}}));let e=setTimeout(()=>{r.current.delete(e),a(e=>({revision:e.revision,cards:Object.fromEntries(Object.entries(e.cards).filter(([e])=>!(e in i.cards))),steps:Object.fromEntries(Object.entries(e.steps).filter(([e])=>!(e in i.steps))),links:Object.fromEntries(Object.entries(e.links).filter(([e])=>!(e in i.links)))}))},2e3);r.current.add(e)}},[e,t]),(0,X.useEffect)(()=>()=>{r.current.forEach(clearTimeout),r.current.clear()},[]),i}var Rt=e=>1-(1-e)**3;function zt(e,t,n){let r=Rt(Math.min(1,Math.max(0,n))),i={};for(let n in t){let a=e[n],o=t[n];i[n]=!a||r>=1?o:{x:a.x+(o.x-a.x)*r,y:a.y+(o.y-a.y)*r}}return i}function Bt(e,t){for(let n in t){let r=e[n];if(r&&(r.x!==t[n].x||r.y!==t[n].y))return!0}return!1}function Vt(e,t,n=680){let[r,i]=(0,X.useState)(e),a=(0,X.useRef)(e),o=(0,X.useRef)(e);return(0,X.useEffect)(()=>{if(e===o.current)return;o.current=e;let r=a.current;if(t||!Bt(r,e)||typeof requestAnimationFrame!=`function`){a.current=e,i(e);return}let s=null,c=performance.now(),l=t=>{let o=(t-c)/n;if(o>=1){a.current=e,i(e),s=null;return}a.current=zt(r,e,o),i(a.current),s=requestAnimationFrame(l)};return s=requestAnimationFrame(l),()=>{s!=null&&cancelAnimationFrame(s)}},[e,t,n]),r}var Ht={edges:new Set,nodes:new Set};function Ut(e,t){if(!t)return Ht;let n=new Set,r=new Set([t]);for(let i of e)(i.source===t||i.target===t)&&(n.add(i.id),r.add(i.source),r.add(i.target));return{edges:n,nodes:r}}var Wt=2600,Gt=e=>Math.min(Math.max(e-1,0),10)*80,Kt=e=>Gt(e)+320;function qt(e,t){let n=Math.max(0,Math.floor(e));if(n<60)return t?`${n} 秒`:`${n}s`;let r=Math.floor(n/60);if(r<60)return t?`${r} 分钟`:`${r} min`;let i=Math.floor(r/60),a=r%60;return t?`${i} 小时 ${a} 分`:`${i} h ${String(a).padStart(2,`0`)} min`}function Jt(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n{}};function Xt(){for(var e=0,t=arguments.length,n={},r;e=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Zt.prototype=Xt.prototype={constructor:Zt,on:function(e,t){var n=this._,r=Qt(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a0)for(var n=Array(i),r=0,i,a;r=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),tn.hasOwnProperty(t)?{space:tn[t],local:e}:e}function rn(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function an(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function on(e){var t=nn(e);return(t.local?an:rn)(t)}function sn(){}function cn(e){return e==null?sn:function(){return this.querySelector(e)}}function ln(e){typeof e!=`function`&&(e=cn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i=v&&(v=_+1);!(b=g[v])&&++v=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function zn(e){e||=Bn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;at?1:e>=t?0:NaN}function Vn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Hn(){return Array.from(this)}function Un(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?tr:typeof t==`function`?rr:nr)(e,t,n??``)):ar(this.node(),e)}function ar(e,t){return e.style.getPropertyValue(t)||er(e).getComputedStyle(e,null).getPropertyValue(t)}function or(e){return function(){delete this[e]}}function sr(e,t){return function(){this[e]=t}}function cr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function lr(e,t){return arguments.length>1?this.each((t==null?or:typeof t==`function`?cr:sr)(e,t)):this.node()[e]}function ur(e){return e.trim().split(/^|\s+/)}function dr(e){return e.classList||new fr(e)}function fr(e){this._node=e,this._names=ur(e.getAttribute(`class`)||``)}fr.prototype={add:function(e){this._names.indexOf(e)<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 pr(e,t){for(var n=dr(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Hr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n()=>e;function ui(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){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:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}ui.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function di(e){return!e.ctrlKey&&!e.button}function fi(){return this.parentNode}function pi(e,t){return t??{x:e.x,y:e.y}}function mi(){return navigator.maxTouchPoints||`ontouchstart`in this}function hi(){var e=di,t=fi,n=pi,r=mi,i={},a=Xt(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,ri).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(ei(n.view).on(`mousemove.drag`,m,ii).on(`mouseup.drag`,h,ii),si(n.view),ai(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(oi(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){ei(e.view).on(`mousemove.drag mouseup.drag`,null),ci(e.view,l),oi(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ri(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ri(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=Ti.exec(e))?new Vi(t[1],t[2],t[3],1):(t=Ei.exec(e))?new Vi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Di.exec(e))?Ri(t[1],t[2],t[3],t[4]):(t=Oi.exec(e))?Ri(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ki.exec(e))?Ji(t[1],t[2]/100,t[3]/100,1):(t=Ai.exec(e))?Ji(t[1],t[2]/100,t[3]/100,t[4]):ji.hasOwnProperty(e)?Li(ji[e]):e===`transparent`?new Vi(NaN,NaN,NaN,0):null}function Li(e){return new Vi(e>>16&255,e>>8&255,e&255,1)}function Ri(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vi(e,t,n,r)}function zi(e){return e instanceof vi||(e=Ii(e)),e?(e=e.rgb(),new Vi(e.r,e.g,e.b,e.opacity)):new Vi}function Bi(e,t,n,r){return arguments.length===1?zi(e):new Vi(e,t,n,r??1)}function Vi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}gi(Vi,Bi,_i(vi,{brighter(e){return e=e==null?bi:bi**+e,new Vi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yi:yi**+e,new Vi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vi(Ki(this.r),Ki(this.g),Ki(this.b),Gi(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:Hi,formatHex:Hi,formatHex8:Ui,formatRgb:Wi,toString:Wi}));function Hi(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}`}function Ui(){return`#${qi(this.r)}${qi(this.g)}${qi(this.b)}${qi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Wi(){let e=Gi(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Ki(this.r)}, ${Ki(this.g)}, ${Ki(this.b)}${e===1?`)`:`, ${e})`}`}function Gi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ki(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function qi(e){return e=Ki(e),(e<16?`0`:``)+e.toString(16)}function Ji(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Zi(e,t,n,r)}function Yi(e){if(e instanceof Zi)return new Zi(e.h,e.s,e.l,e.opacity);if(e instanceof vi||(e=Ii(e)),!e)return new Zi;if(e instanceof Zi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Zi(o,s,c,e.opacity)}function Xi(e,t,n,r){return arguments.length===1?Yi(e):new Zi(e,t,n,r??1)}function Zi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}gi(Zi,Xi,_i(vi,{brighter(e){return e=e==null?bi:bi**+e,new Zi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yi:yi**+e,new Zi(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,i=2*n-r;return new Vi(ea(e>=240?e-240:e+120,i,r),ea(e,i,r),ea(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Zi(Qi(this.h),$i(this.s),$i(this.l),Gi(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(){let e=Gi(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Qi(this.h)}, ${$i(this.s)*100}%, ${$i(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Qi(e){return e=(e||0)%360,e<0?e+360:e}function $i(e){return Math.max(0,Math.min(1,e||0))}function ea(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ta=e=>()=>e;function na(e,t){return function(n){return e+n*t}}function ra(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ia(e){return(e=+e)==1?aa:function(t,n){return n-t?ra(t,n,e):ta(isNaN(t)?n:t)}}function aa(e,t){var n=t-e;return n?na(e,n):ta(isNaN(e)?t:e)}var oa=(function e(t){var n=ia(t);function r(e,t){var r=n((e=Bi(e)).r,(t=Bi(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=aa(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function sa(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:da(r,i)})),n=ma.lastIndex;return n180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:da(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:da(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:da(e,n)},{i:s-2,x:da(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t=0&&e._call.call(void 0,t),e=e._next;--Na}function Ya(){Ba=(za=Ha.now())+Va,Na=Pa=0;try{Ja()}finally{Na=0,Za(),Ba=0}}function Xa(){var e=Ha.now(),t=e-za;t>Ia&&(Va-=t,za=e)}function Za(){for(var e,t=La,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:La=n);Ra=e,Qa(r)}function Qa(e){Na||(Pa&&=clearTimeout(Pa),e-Ba>24?(e<1/0&&(Pa=setTimeout(Ya,e-Ha.now()-Va)),Fa&&=clearInterval(Fa)):(Fa||=(za=Ha.now(),setInterval(Xa,Ia)),Na=1,Ua(Ya)))}function $a(e,t,n){var r=new Ka;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var eo=Xt(`start`,`end`,`cancel`,`interrupt`),to=[];function no(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;oo(e,n,{name:t,index:r,group:i,on:eo,tween:to,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function ro(e,t){var n=ao(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function io(e,t){var n=ao(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function ao(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function oo(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=qa(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return $a(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function co(e){return this.each(function(){so(this,e)})}function lo(e,t){var n,r;return function(){var i=io(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o=0&&(e=e.slice(0,t)),!e||e===`start`})}function Bo(e,t,n){var r,i,a=zo(t)?ro:io;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Vo(e,t){var n=this._id;return arguments.length<2?ao(this.node(),n).on.on(e):this.each(Bo(n,e,t))}function Ho(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Uo(){return this.on(`end.remove`,Ho(this._id))}function Wo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=cn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o()=>e;function bs(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function xs(e,t,n){this.k=e,this.x=t,this.y=n}xs.prototype={constructor:xs,scale:function(e){return e===1?this:new xs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new xs(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 Ss=new xs(1,0,0);Cs.prototype=xs.prototype;function Cs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ss;return e.__zoom}function ws(e){e.stopImmediatePropagation()}function Ts(e){e.preventDefault(),e.stopImmediatePropagation()}function Es(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Ds(){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 Os(){return this.__zoom||Ss}function ks(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function As(){return navigator.maxTouchPoints||`ontouchstart`in this}function js(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Ms(){var e=Es,t=Ds,n=js,r=ks,i=As,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Ma,l=Xt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Os).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Os),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Ss.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new xs(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new xs(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new xs(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=ei(this.that).datum();l.call(e,this.that,new bs(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=ni(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],so(this),s.start();Ts(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=ei(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=ni(t,i),l=t.clientX,u=t.clientY;si(t.view),ws(t),a.mouse=[c,this.__zoom.invert(c)],so(this),a.start();function d(e){if(Ts(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=ni(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),ci(e.view,a.moved),Ts(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=ni(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Ts(r),s>0?ei(this).transition().duration(s).call(x,d,c,r):ei(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(ws(t),s=0;s`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} 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.`},Ps=[[-1/0,-1/0],[1/0,1/0]],Fs=[`Enter`,` `,`Escape`],Is={"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`},Ls;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Ls||={});var Rs;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Rs||={});var zs;(function(e){e.Partial=`partial`,e.Full=`full`})(zs||={});var Bs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Vs;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(Vs||={});var Hs;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Hs||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var Us={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function Ws(e){return e===null?null:e?`valid`:`invalid`}var Gs=e=>`id`in e&&`source`in e&&`target`in e,Ks=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),qs=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Js=(e,t=[0,0])=>{let{width:n,height:r}=Oc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},Ys=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:uc(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):qs(n)?n:t.nodeLookup.get(n.id)),cc(e,i?fc(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Xs=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=cc(n,fc(e)),r=!0)}),r?uc(n):{x:0,y:0,width:0,height:0}},Zs=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=mc(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},Qs=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function $s(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function ec({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Tc(Xs($s(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function tc({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,Ns.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&Dc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Dc(d)?ic(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,Ns.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function nc({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Qs(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var rc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ic=(e={x:0,y:0},t,n)=>({x:rc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:rc(e.y,t[0][1],t[1][1]-(n?.height??0))});function ac(e,t,n){let{width:r,height:i}=Oc(n),{x:a,y:o}=n.internals.positionAbsolute;return ic(e,[[a,o],[a+r,o+i]],t)}var oc=(e,t,n)=>en?-rc(Math.abs(e-n),1,t)/t:0,sc=(e,t,n=15,r=40)=>[oc(e.x,r,t.width-r)*n,oc(e.y,r,t.height-r)*n],cc=(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)}),lc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),uc=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),dc=(e,t=[0,0])=>{let{x:n,y:r}=qs(e)?e.internals.positionAbsolute:Js(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},fc=(e,t=[0,0])=>{let{x:n,y:r}=qs(e)?e.internals.positionAbsolute:Js(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},pc=(e,t)=>uc(cc(lc(e),lc(t))),mc=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},hc=(e,t)=>mc(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),gc=e=>_c(e.width)&&_c(e.height)&&_c(e.x)&&_c(e.y),_c=e=>!isNaN(e)&&isFinite(e),vc=(e,t)=>(e,t)=>{},yc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),bc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?yc(s,o):s},xc=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Sc(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let 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 Cc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=Sc(e,n),i=Sc(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=Sc(e.top??e.y??0,n),i=Sc(e.bottom??e.y??0,n),a=Sc(e.left??e.x??0,t),o=Sc(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function wc(e,t,n,r,i,a){let{x:o,y:s}=xc(e,[t,n,r]),{x:c,y:l}=xc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Tc=(e,t,n,r,i,a)=>{let o=Cc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=rc(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=wc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},Ec=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Dc(e){return e!=null&&e!==`parent`}function Oc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function kc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ac(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function jc(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Mc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Nc(e){return{...Is,...e||{}}}function Pc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Bc(e),s=bc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?yc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Fc=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ic=e=>e?.getRootNode?.()||window?.document,Lc=[`INPUT`,`SELECT`,`TEXTAREA`];function Rc(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Lc.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var zc=e=>`clientX`in e,Bc=(e,t)=>{let n=zc(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Vc=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Fc(t)}})};function Hc({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Uc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wc({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Uc(t-r,a),n];case Q.Right:return[t+Uc(r-t,a),n];case Q.Top:return[t,n-Uc(n-i,a)];case Q.Bottom:return[t,n+Uc(i-n,a)]}}function Gc({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Wc({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Wc({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Hc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Kc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n0}var Yc=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Xc=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Zc=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,Ns.error006()),t;let r=n.getEdgeId||Yc,i;return i=Gs(e)?{...e}:{...e,id:r(e)},Xc(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Qc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Kc({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var $c={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},el=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.xMath.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function nl({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=$c[t],c=$c[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=el({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Kc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function rl(e,t,n,r){let i=Math.min(tl(e,t)/2,tl(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.xe.id===t):e[0])||null}function ul(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function dl(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=ul(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var fl=1e3,pl=10,ml={nodeOrigin:[0,0],nodeExtent:Ps,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},hl={...ml,checkEquality:!0};function gl(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function _l(e,t,n){let r=gl(ml,n);for(let n of e.values())if(n.parentId)Sl(n,e,t,r);else{let e=ic(Js(n,r.nodeOrigin),Dc(n.extent)?n.extent:r.nodeExtent,Oc(n));n.internals.positionAbsolute=e}}function vl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function yl(e){return e===`manual`}function bl(e,t,n,r={}){let i=gl(hl,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!yl(i.zIndexMode)?fl:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=ic(Js(u,i.nodeOrigin),Dc(u.extent)?u.extent:i.nodeExtent,Oc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:vl(u,e),z:Cl(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&Sl(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function xl(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Sl(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=gl(ml,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xl(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*pl),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=wl(e,u,o,s,a&&!yl(c)?fl:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function Cl(e,t,n){let r=_c(e.zIndex)?e.zIndex:0;return yl(n)?r:r+(e.selected?t:0)}function wl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Oc(e),l=Js(e,n),u=Dc(e.extent)?ic(l,e.extent,c):l,d=ic({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=ac(d,c,t));let f=Cl(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Tl(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=pc(a.get(n.parentId)?.expandedRect??dc(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Oc(a),l=a.origin??r,u=t.x0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width0){let e=Tl(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Dl({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Ol(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function kl(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Ol(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Ol(`target`,s,c,e,i,o),t.set(r.id,r)}}function Al(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Al(n,t):!1}function jl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function Ml(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!Al(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function Nl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Pl({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=yc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Fl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=ei(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?lc(Xs(s)):null,x=v&&l?Pl({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:yc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=tc({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Nl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=sc(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=Pc(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=Ml(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=Nl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=hi().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Pc(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Bc(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Pc(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Bc(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Bc(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Nl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!jl(t,`.${g}`,v))&&(!_||jl(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Il(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())hc(i,dc(e))>0&&r.push(e);return r}var Ll=250;function Rl(e,t,n,r){let i=[],a=1/0,o=Il(e,n,t+Ll);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=cl(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function zl(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...cl(o,c,c.position,!0)}:c}function Bl(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Vl(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Hl=()=>!0;function Ul(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Hl,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Ic(e.target),E=0,D,{x:O,y:k}=Bc(e),A=Bl(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=zl(i,A,r,c,t);if(!N)return;let P=Bc(e,j),F=!1,ee=null,I=!1,L=null;function R(){if(!u||!j)return;let[e,t]=sc(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(R)}let z={...N,nodeId:i,type:A,position:N.position},B=c.get(i),V={inProgress:!0,isValid:null,from:cl(B,z,Q.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:B,to:P,toHandle:null,toPosition:Us[z.position],toNode:null,pointer:P};function H(){M=!0,y(V),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&H();function U(e){if(!M){let{x:t,y:n}=Bc(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;H()}if(!x()||!z){W(e);return}let a=b();P=Bc(e,j),D=Rl(bc(P,a,!1,[1,1]),n,c,z),F||=(R(),!0);let s=Wl(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,ee=s.connection,I=Vl(!!D,s.isValid);let u=c.get(i),f=u?cl(u,z,Q.Left,!0):V.from,p={...V,from:f,isValid:I,to:s.toHandle&&I?xc({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:Us[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),V=p}function W(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&ee&&I&&h?.(ee);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,I=!1,ee=null,L=null,T.removeEventListener(`mousemove`,U),T.removeEventListener(`mouseup`,W),T.removeEventListener(`touchmove`,U),T.removeEventListener(`touchend`,W)}}T.addEventListener(`mousemove`,U),T.addEventListener(`mouseup`,W),T.addEventListener(`touchmove`,U),T.addEventListener(`touchend`,W)}function Wl(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Hl,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Bc(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=Bl(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===Ls.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=zl(t,e,a,u,n,!0)}return _}var Gl={onPointerDown:Ul,isValid:Wl};function Kl({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=ei(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&Ec()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=Ms().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:ni}}var ql=e=>({x:e.x,y:e.y,zoom:e.k}),Jl=({x:e,y:t,zoom:n})=>Ss.translate(e,t).scale(n),Yl=(e,t)=>e.target.closest(`.${t}`),Xl=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zl=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ql=(e,t=0,n=Zl,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},$l=e=>{let t=e.ctrlKey&&Ec()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function eu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Yl(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=ni(u),t=d*2**$l(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Rs.Vertical?0:u.deltaX*f,m=i===Rs.Horizontal?0:u.deltaY*f;!Ec()&&u.shiftKey&&i!==Rs.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=ql(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function tu({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=Yl(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function nu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=ql(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function ru({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Xl(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,ql(a.transform))}}function iu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Xl(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=ql(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function au({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(Yl(d,`${l}-flow__node`)||Yl(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||Yl(d,s)&&m||Yl(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function ou({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Ms().scaleExtent([t,n]).translateExtent(r),f=ei(e).call(d);v({x:i.x,y:i.y,zoom:rc(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta($l);async function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?va:Ma).transform(Ql(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!_c(E)||E<0?0:E);let k=O?eu({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):tu({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});f.on(`wheel.zoom`,k,{passive:!1});let A=nu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,A);let j=ru({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,j);let M=iu({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,M);let N=au({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(N),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=Jl(e),i=d?.constrain()(r,t,n);return i&&await h(i),i}async function y(e,t){let n=Jl(e);return await h(n,t),n}function b(e){if(f){let t=Jl(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?Cs(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?va:Ma).scaleTo(Ql(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?va:Ma).scaleBy(Ql(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!_c(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var su;(function(e){e.Line=`line`,e.Handle=`handle`})(su||={});function cu({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function lu(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function uu(e,t){return Math.max(0,t-e)}function du(e,t){return Math.max(0,e-t)}function fu(e,t,n){return Math.max(0,t-e,e-n)}function pu(e,t){return e?!t:t}function mu(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=fu(E,h,g),j=fu(D,_,v);if(o){let e=0,t=0;c&&w<0?e=uu(y+w+O,o[0][0]):!c&&w>0&&(e=du(y+E+O,o[1][0])),l&&T<0?t=uu(b+T+k,o[0][1]):!l&&T>0&&(t=du(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=du(y+w,s[0][0]):!c&&w<0&&(e=uu(y+E,s[1][0])),l&&T>0?t=du(b+T,s[0][1]):!l&&T<0&&(t=uu(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=fu(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?du(b+k+E/C,o[1][1])*C:uu(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?uu(b+E/C,s[1][1])*C:du(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=fu(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?du(y+D*C+O,o[1][0])/C:uu(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?uu(y+D*C,s[1][0])/C:du(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(pu(c,l)?-w:w)/C:w=(pu(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var hu={width:0,height:0,x:0,y:0},gu={...hu,pointerX:0,pointerY:0,aspectRatio:1};function _u(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function vu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=ei(e),o={controlDirection:lu(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...hu},h={...gu};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:lu(e)};let g,_=null,v=[],y,b,x,S=!1,C=hi().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=Pc(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Dc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=_u(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=Pc(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=mu(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var yu=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),bu=t(((e,t)=>{t.exports=yu()})),xu=t((e=>{var t=r(),n=bu();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Su=e(t(((e,t)=>{t.exports=xu()}))(),1),Cu=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},wu=e=>e?Cu(e):Cu,{useDebugValue:Tu}=X.default,{useSyncExternalStoreWithSelector:Eu}=Su.default,Du=e=>e;function Ou(e,t=Du,n){let r=Eu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Tu(r),r}var ku=(e,t)=>{let n=wu(e),r=(e,r=t)=>Ou(n,e,r);return Object.assign(r,n),r},Au=(e,t)=>e?ku(e,t):ku;function ju(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Mu=(0,X.createContext)(null),Nu=Mu.Provider,Pu=Ns.error001(`react`);function $(e,t){let n=(0,X.useContext)(Mu);if(n===null)throw Error(Pu);return Ou(n,e,t)}function Fu(){let e=(0,X.useContext)(Mu);if(e===null)throw Error(Pu);return(0,X.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Iu={display:`none`},Lu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Ru=`react-flow__node-desc`,zu=`react-flow__edge-desc`,Bu=`react-flow__aria-live`,Vu=e=>e.ariaLiveMessage,Hu=e=>e.ariaLabelConfig;function Uu({rfId:e}){let t=$(Vu);return(0,Y.jsx)(`div`,{id:`${Bu}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Lu,children:t})}function Wu({rfId:e,disableKeyboardA11y:t}){let n=$(Hu);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{id:`${Ru}-${e}`,style:Iu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Y.jsx)(`div`,{id:`${zu}-${e}`,style:Iu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Y.jsx)(Uu,{rfId:e})]})}var Gu=(0,X.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,Y.jsx)(`div`,{className:Jt([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});Gu.displayName=`Panel`;var Ku=`https://reactflow.dev?utm_source=attribution`;function qu({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,Y.jsx)(Gu,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ku}`,children:(0,Y.jsx)(`a`,{href:Ku,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var Ju=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Yu=e=>e.id;function Xu(e,t){return ju(e.selectedNodes.map(Yu),t.selectedNodes.map(Yu))&&ju(e.selectedEdges.map(Yu),t.selectedEdges.map(Yu))}function Zu({onSelectionChange:e}){let t=Fu(),{selectedNodes:n,selectedEdges:r}=$(Ju,Xu);return(0,X.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var Qu=e=>!!e.onSelectionChangeHandlers;function $u({onSelectionChange:e}){let t=$(Qu);return e||t?(0,Y.jsx)(Zu,{onSelectionChange:e}):null}var ed=[0,0],td={x:0,y:0,zoom:1},nd=[...`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`.split(`.`),`rfId`],rd=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}),id={translateExtent:Ps,nodeOrigin:ed,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function ad(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(rd,ju),l=Fu();(0,X.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=id,s()}),[]);let u=(0,X.useRef)(id);return(0,X.useEffect)(()=>{for(let s of nd){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Nc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},nd.map(t=>e[t])),null}function od(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function sd(e){let[t,n]=(0,X.useState)(e===`system`?null:e);return(0,X.useEffect)(()=>{if(e!==`system`){n(e);return}let t=od(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?od()?.matches?`dark`:`light`:t}var cd=typeof document<`u`?document:null;function ld(e=null,t={target:cd,actInsideInputWithModifier:!0}){let[n,r]=(0,X.useState)(!1),i=(0,X.useRef)(!1),a=(0,X.useRef)(new Set([])),[o,s]=(0,X.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,` +`).replace(` + +`,` ++`).split(` +`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,X.useEffect)(()=>{let n=t?.target??cd,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&Rc(e))return!1;let n=dd(e.code,s);if(a.current.add(e[n]),ud(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=dd(e.code,s);ud(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function ud(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function dd(e,t){return t.includes(e)?`code`:`key`}var fd=()=>{let e=Fu();return(0,X.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[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)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=Tc(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return bc(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=xc(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function pd(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)md(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function md(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(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)}}function hd(e,t){return pd(e,t)}function gd(e,t){return pd(e,t)}function _d(e,t){return{id:e,type:`select`,selected:t}}function vd(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(_d(a.id,e)))}return r}function yd({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function bd(e){return{id:e.id,type:`remove`}}var xd=vc(`React Flow`,`https://reactflow.dev/`);function Sd(e,t,n={}){return Zc(e,t,{...n,onError:n.onError??xd})}var Cd=e=>Ks(e),wd=e=>Gs(e);function Td(e){return(0,X.forwardRef)(e)}var Ed=typeof window<`u`?X.useLayoutEffect:X.useEffect;function Dd(e){let[t,n]=(0,X.useState)(BigInt(0)),[r]=(0,X.useState)(()=>Od(()=>n(e=>e+BigInt(1))));return Ed(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Od(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var kd=(0,X.createContext)(null);function Ad({children:e}){let t=Fu(),n=Dd((0,X.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=yd({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Dd((0,X.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(yd({items:s,lookup:o}))},[])),i=(0,X.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,Y.jsx)(kd.Provider,{value:i,children:e})}function jd(){let e=(0,X.useContext)(kd);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Md=e=>!!e.panZoom;function Nd(){let e=fd(),t=Fu(),n=jd(),r=$(Md),i=(0,X.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=Cd(e)?e:n.get(e.id),a=i.parentId?Ac(i.position,i.measured,i.parentId,n,r):i.position;return dc({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Cd(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&wd(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await nc({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(bd);o?.(f),c(e)}if(m){let e=d.map(bd);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=gc(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=dc(s?r:a),l=hc(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=gc(e)?e:a(e);if(!r)return!1;let i=hc(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return Ys(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??Mc();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,X.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Pd=e=>e.selected,Fd=typeof window<`u`?window:void 0;function Id({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=Fu(),{deleteElements:r}=Nd(),i=ld(e,{actInsideInputWithModifier:!1}),a=ld(t,{target:Fd});(0,X.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Pd),edges:e.filter(Pd)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,X.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Ld(e){let t=Fu();(0,X.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Fc(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,Ns.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var Rd={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},zd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Bd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=Rs.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=Fu(),S=(0,X.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=$(zd,ju),E=ld(f),D=(0,X.useRef)();Ld(S);let O=(0,X.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,X.useEffect)(()=>{if(S.current){D.current=ou({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,X.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,Y.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:Rd,children:m})}var Vd=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Hd(){let{userSelectionActive:e,userSelectionRect:t}=$(Vd,ju);return e&&t?(0,Y.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}var Ud=(e,t)=>n=>{n.target===t.current&&e?.(n)},Wd=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Gd({isSelecting:e,selectionKeyPressed:t,selectionMode:n=zs.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,X.useRef)(0),_=Fu(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(Wd,ju),C=y&&(e||v),w=(0,X.useRef)(null),T=(0,X.useRef)(),E=(0,X.useRef)(new Set),D=(0,X.useRef)(new Set),O=(0,X.useRef)(!1),k=(0,X.useRef)(!1),A=(0,X.useRef)({x:0,y:0}),j=(0,X.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},ee=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=Bc(n.nativeEvent,T.current),l=bc({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function I(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=xc(d,i),m={startX:d.x,startY:d.y,x:ee.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}jc(h,E.current)||c(vd(a,E.current,!0)),jc(g,D.current)||l(vd(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function L(){if(!i||!T.current)return;let[e,t]=sc(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(L);return}let{x:t,y:n}=A.current;I(t,n),g.current=requestAnimationFrame(L)})}let R=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,X.useEffect)(()=>()=>R(),[]);let z=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Bc(e.nativeEvent,T.current);A.current={x:o,y:c};let l=xc({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(L(),!0),I(o,c)},B=e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),R())},V=e=>{e.target?.releasePointerCapture?.(e.pointerId),R()},H=r===!0||Array.isArray(r)&&r.includes(0);return(0,Y.jsxs)(`div`,{className:Jt([`react-flow__pane`,{draggable:H,dragging:b,selection:e}]),onClick:C?void 0:Ud(M,w),onContextMenu:Ud(N,w),onWheel:Ud(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?z:p,onPointerUp:B,onPointerCancel:C?V:void 0,onPointerDownCapture:C?ee:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:Rd,children:[h,(0,Y.jsx)(Hd,{})]})}function Kd({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,Ns.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function qd({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=Fu(),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)();return(0,X.useEffect)(()=>{u.current=Fl({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{Kd({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,X.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var Jd=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function Yd(){let e=Fu();return(0,X.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Jd(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=yc(t,i));let{position:a,positionAbsolute:s}=tc({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var Xd=(0,X.createContext)(null),Zd=Xd.Provider;Xd.Consumer;var Qd=()=>(0,X.useContext)(Xd),$d=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ef=(0,X.createContext)(null);function tf({children:e}){let t=$($d,ju);return(0,Y.jsx)(ef.Provider,{value:t,children:e})}function nf(){let e=(0,X.useContext)(ef);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var rf={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},af=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return rf;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===Ls.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function of({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=Fu(),_=Qd(),{connectOnClick:v,noPanClassName:y,rfId:b}=nf(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(af(_,m,e),ju);_||g.getState().onError?.(`010`,Ns.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(Sd(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=zc(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Gl.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,Y.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:Jt([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=Ic(t.target),h=n||c,{connection:v,isValid:y}=Gl.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var sf=(0,X.memo)(Td(of));function cf({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[e?.label,(0,Y.jsx)(sf,{type:`source`,position:n,isConnectable:t})]})}function lf({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(sf,{type:`target`,position:n,isConnectable:t}),e?.label,(0,Y.jsx)(sf,{type:`source`,position:r,isConnectable:t})]})}function uf(){return null}function df({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(sf,{type:`target`,position:n,isConnectable:t}),e?.label]})}var ff={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},pf={input:cf,default:lf,output:df,group:uf};function mf(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var hf=e=>{let{width:t,height:n,x:r,y:i}=Xs(e.nodeLookup,{filter:e=>!!e.selected});return{width:_c(t)?t:null,height:_c(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function gf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=Fu(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(hf,ju),c=Yd(),l=(0,X.useRef)(null);(0,X.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(qd({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,Y.jsx)(`div`,{className:Jt([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,Y.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(ff,e.key)&&(e.preventDefault(),c({direction:ff[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var _f=typeof window<`u`?window:void 0,vf=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function yf({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:ee}){let{nodesSelectionActive:I,userSelectionActive:L}=$(vf,ju),R=ld(l,{target:_f}),z=ld(h,{target:_f}),B=z||w,V=z||b,H=u&&B!==!0,U=R||L||H;return Id({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,Y.jsx)(Bd,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:V,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!R&&B,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:ee,paneClickDistance:s,selectionOnDrag:H,children:(0,Y.jsxs)(Gd,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:B,autoPanOnSelection:T,isSelecting:!!U,selectionMode:d,selectionKeyPressed:R,paneClickDistance:s,selectionOnDrag:H,children:[e,I&&(0,Y.jsx)(gf,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}yf.displayName=`FlowRenderer`;var bf=(0,X.memo)(yf),xf=e=>t=>e?Zs(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function Sf(e){return $((0,X.useCallback)(xf(e),[e]),ju)}var Cf=e=>e.updateNodeInternals;function wf(){let e=$(Cf),[t]=(0,X.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,X.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Tf({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=Fu(),a=(0,X.useRef)(null),o=(0,X.useRef)(null),s=(0,X.useRef)(e.sourcePosition),c=(0,X.useRef)(e.targetPosition),l=(0,X.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,X.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,X.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,X.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Ef({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},ju),S=y.type||`default`,C=g?.[S]||pf[S];C===void 0&&(v?.(`003`,Ns.error003(S)),S=`default`,C=g?.default||pf.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=Fu(),k=kc(y),A=Tf({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=qd({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=Yd();if(y.hidden)return null;let N=Oc(y),P=mf(y),F=T||w||t||n||r||i,ee=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,R=a?e=>a(e,{...b.userNode}):void 0,z=o?e=>o(e,{...b.userNode}):void 0,B=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&Kd({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},V=t=>{if(!(Rc(t.nativeEvent)||m)){if(Fs.includes(t.key)&&T){let n=t.key===`Escape`;Kd({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(ff,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:ff[t.key],factor:t.shiftKey?4:1})}}},H=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Zs(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,Y.jsx)(`div`,{className:Jt([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:ee,onMouseMove:I,onMouseLeave:L,onContextMenu:R,onClick:B,onDoubleClick:z,onKeyDown:D?V:void 0,tabIndex:D?0:void 0,onFocus:D?H:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${Ru}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,Y.jsx)(Zd,{value:e,children:(0,Y.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var Df=(0,X.memo)(Ef),Of=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function kf(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=$(Of,ju),o=Sf(e.onlyRenderVisibleElements),s=wf();return(0,Y.jsx)(`div`,{className:`react-flow__nodes`,style:Rd,children:o.map(o=>(0,Y.jsx)(Df,{id:o,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:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}kf.displayName=`NodeRenderer`;var Af=(0,X.memo)(kf);function jf(e){return $((0,X.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Jc({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),ju)}var Mf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,Y.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},Nf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,Y.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},Pf={[Hs.Arrow]:Mf,[Hs.ArrowClosed]:Nf};function Ff(e){let t=Fu();return(0,X.useMemo)(()=>Object.prototype.hasOwnProperty.call(Pf,e)?Pf[e]:(t.getState().onError?.(`009`,Ns.error009(e)),null),[e])}var If=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Ff(t);return c?(0,Y.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,Y.jsx)(c,{color:n,strokeWidth:o})}):null},Lf=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,X.useMemo)(()=>dl(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,Y.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,Y.jsx)(`defs`,{children:i.map(e=>(0,Y.jsx)(If,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Lf.displayName=`MarkerDefinitions`;var Rf=(0,X.memo)(Lf);function zf({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,X.useState)({x:1,y:0,width:0,height:0}),p=Jt([`react-flow__edge-textwrapper`,l]),m=(0,X.useRef)(null);return(0,X.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,Y.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,Y.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,Y.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}zf.displayName=`EdgeText`;var Bf=(0,X.memo)(zf);function Vf({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{...u,d:e,fill:`none`,className:Jt([`react-flow__edge-path`,u.className])}),l?(0,Y.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&_c(t)&&_c(n)?(0,Y.jsx)(Bf,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Hf({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Uf({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=Hf({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Hf({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Hc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Wf(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Uf({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Gf=Wf({isInternal:!1}),Kf=Wf({isInternal:!0});Gf.displayName=`SimpleBezierEdge`,Kf.displayName=`SimpleBezierEdgeInternal`;function qf(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=il({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var Jf=qf({isInternal:!1}),Yf=qf({isInternal:!0});Jf.displayName=`SmoothStepEdge`,Yf.displayName=`SmoothStepEdgeInternal`;function Xf(e){return(0,X.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,Y.jsx)(Jf,{...n,id:r,pathOptions:(0,X.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Zf=Xf({isInternal:!1}),Qf=Xf({isInternal:!0});Zf.displayName=`StepEdge`,Qf.displayName=`StepEdgeInternal`;function $f(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Qc({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var ep=$f({isInternal:!1}),tp=$f({isInternal:!0});ep.displayName=`StraightEdge`,tp.displayName=`StraightEdgeInternal`;function np(e){return(0,X.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Gc({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,Y.jsx)(Vf,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var rp=np({isInternal:!1}),ip=np({isInternal:!0});rp.displayName=`BezierEdge`,ip.displayName=`BezierEdgeInternal`;var ap={default:ip,straight:tp,step:Qf,smoothstep:Yf,simplebezier:Kf},op={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},sp=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,cp=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,lp=`react-flow__edgeupdater`;function up({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,Y.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:Jt([lp,`${lp}-${s}`]),cx:sp(t,r,e),cy:cp(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function dp({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=Fu(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Gl.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(e===!0||e===`source`)&&(0,Y.jsx)(up,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,Y.jsx)(up,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function fp({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||ap[x];S===void 0&&(_?.(`011`,Ns.error011(x)),x=`default`,S=h?.default||ap.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,X.useRef)(null),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),j=Fu(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L}=$((0,X.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return op;let i=ol({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=qc({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||op,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),ju),R=(0,X.useMemo)(()=>y.markerStart?`url('#${ul(y.markerStart,m)}')`:void 0,[y.markerStart,m]),z=(0,X.useMemo)(()=>y.markerEnd?`url('#${ul(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||ee===null)return null;let B=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},V=a?e=>{a(e,{...y})}:void 0,H=o?e=>{o(e,{...y})}:void 0,U=s?e=>{s(e,{...y})}:void 0,W=c?e=>{c(e,{...y})}:void 0,te=l?e=>{l(e,{...y})}:void 0;return(0,Y.jsx)(`svg`,{style:{zIndex:M},children:(0,Y.jsxs)(`g`,{className:Jt([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:B,onDoubleClick:V,onContextMenu:H,onMouseEnter:U,onMouseMove:W,onMouseLeave:te,onKeyDown:C?t=>{if(!v&&Fs.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${zu}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,Y.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:R,markerEnd:z,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,Y.jsx)(dp,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var pp=(0,X.memo)(fp),mp=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function hp({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(mp,ju),b=jf(t);return(0,Y.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,Y.jsx)(Rf,{defaultColor:e,rfId:n}),b.map(e=>(0,Y.jsx)(pp,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}hp.displayName=`EdgeRenderer`;var gp=(0,X.memo)(hp),_p=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function vp({children:e}){let t=$(_p);return(0,Y.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:t},children:e})}function yp(e){let t=Nd(),n=(0,X.useRef)(!1);(0,X.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var bp=e=>e.panZoom?.syncViewport;function xp(e){let t=$(bp),n=Fu();return(0,X.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Sp(e){return e.connection.inProgress?{...e.connection,to:bc(e.connection.to,e.transform)}:{...e.connection}}function Cp(e){return e?t=>e(Sp(t)):Sp}function wp(e){return $(Cp(e),ju)}var Tp=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ep({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(Tp,ju);return a&&i&&c?(0,Y.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,Y.jsx)(`g`,{className:Jt([`react-flow__connection`,Ws(s)]),children:(0,Y.jsx)(Dp,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var Dp=({style:e,type:t=Vs.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=wp();if(!i)return;if(n)return(0,Y.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Ws(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Vs.Bezier:[m]=Gc(h);break;case Vs.SimpleBezier:[m]=Uf(h);break;case Vs.Step:[m]=il({...h,borderRadius:0});break;case Vs.SmoothStep:[m]=il(h);break;default:[m]=Qc(h)}return(0,Y.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};Dp.displayName=`ConnectionLine`;var Op={};function kp(e=Op){(0,X.useRef)(e),Fu(),(0,X.useEffect)(()=>{},[e])}function Ap(){Fu(),(0,X.useRef)(!1),(0,X.useEffect)(()=>{},[])}function jp({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:ee,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:R,autoPanOnSelection:z,onPaneClick:B,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneScroll:W,onPaneContextMenu:te,paneClickDistance:G,nodeClickDistance:ne,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:oe,reconnectRadius:K,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:pe,nodeExtent:me,rfId:he,viewport:q,onViewportChange:ge}){return kp(e),kp(t),Ap(),yp(n),xp(q),(0,Y.jsx)(bf,{onPaneClick:B,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneContextMenu:te,onPaneScroll:W,paneClickDistance:G,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:L,panOnScroll:F,panOnScrollSpeed:ee,panOnScrollMode:I,panOnDrag:R,autoPanOnSelection:z,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ue,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:pe,onViewportChange:ge,isControlledViewport:!!q,children:(0,Y.jsxs)(vp,{children:[(0,Y.jsx)(gp,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:se,onReconnectStart:ce,onReconnectEnd:le,onlyRenderVisibleElements:T,onEdgeContextMenu:re,onEdgeMouseEnter:ie,onEdgeMouseMove:ae,onEdgeMouseLeave:oe,reconnectRadius:K,defaultMarkerColor:M,noPanClassName:fe,disableKeyboardA11y:pe,rfId:he}),(0,Y.jsx)(Ep,{style:h,type:m,component:g,containerStyle:_}),(0,Y.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,Y.jsx)(Af,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ne,onlyRenderVisibleElements:T,noPanClassName:fe,noDragClassName:ue,disableKeyboardA11y:pe,nodeExtent:me,rfId:he}),(0,Y.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}jp.displayName=`GraphView`;var Mp=(0,X.memo)(jp),Np=vc(`React Flow`,`https://reactflow.dev/`),Pp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??Ps;kl(h,g,_);let{nodesInitialized:x}=bl(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=Tc(Xs(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:Ps,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ls.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Bs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Np,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:Is,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Fp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>Au((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await ec({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...Pp({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=bl(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();kl(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=El(e,n,r,i,a,o,l);d&&(_l(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=cl(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=Tl(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(hd(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(gd(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>_d(e,!0)));return}i(vd(r,new Set([...e]),!0)),a(vd(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>_d(e,!0)));return}a(vd(n,new Set([...e]))),i(vd(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(_d(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(_d(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,_d(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,_d(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(bl(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return Dl({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Bs}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...Pp()})}},Object.is);function Ip({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,X.useState)(()=>Fp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,Y.jsx)(Nu,{value:m,children:(0,Y.jsx)(Ad,{children:(0,Y.jsx)(tf,{children:p})})})}function Lp({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,X.useContext)(Mu)?(0,Y.jsx)(Y.Fragment,{children:e}):(0,Y.jsx)(Ip,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var Rp={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function zp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:ee,connectionMode:I,connectionLineType:L=Vs.Bezier,connectionLineStyle:R,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:V=`Backspace`,selectionKeyCode:H=`Shift`,selectionOnDrag:U=!1,selectionMode:W=zs.Full,panActivationKeyCode:te=`Space`,multiSelectionKeyCode:G=Ec()?`Meta`:`Control`,zoomActivationKeyCode:ne=Ec()?`Meta`:`Control`,snapToGrid:re,snapGrid:ie,onlyRenderVisibleElements:ae=!1,selectNodesOnDrag:oe,nodesDraggable:K,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,nodeOrigin:ue=ed,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:pe=!0,defaultViewport:me=td,minZoom:he=.5,maxZoom:q=2,translateExtent:ge=Ps,preventScrolling:_e=!0,nodeExtent:ve,defaultMarkerColor:ye=`#b1b1b7`,zoomOnScroll:be=!0,zoomOnPinch:xe=!0,panOnScroll:Se=!1,panOnScrollSpeed:Ce=.5,panOnScrollMode:we=Rs.Free,zoomOnDoubleClick:Te=!0,panOnDrag:Ee=!0,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne=1,nodeClickDistance:Pe=0,children:Fe,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:He,onEdgeMouseLeave:Ue,reconnectRadius:We=10,onNodesChange:J,onEdgesChange:Ge,noDragClassName:Ke=`nodrag`,noWheelClassName:qe=`nowheel`,noPanClassName:Je=`nopan`,fitView:Ye,fitViewOptions:Xe,connectOnClick:Ze,attributionPosition:Qe,proOptions:$e,defaultEdgeOptions:et,elevateNodesOnSelect:tt=!0,elevateEdgesOnSelect:nt=!1,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanOnSelection:ot=!0,autoPanSpeed:st,connectionRadius:ct,isValidConnection:lt,onError:ut,style:dt,id:ft,nodeDragThreshold:pt,connectionDragThreshold:mt,viewport:ht,onViewportChange:gt,width:_t,height:vt,colorMode:yt=`light`,debug:bt,onScroll:xt,ariaLabelConfig:St,zIndexMode:Ct=`basic`,...wt},Tt){let Et=ft||`1`,Dt=sd(yt),Ot=(0,X.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),xt?.(e)},[xt]);return(0,Y.jsx)(`div`,{"data-testid":`rf__wrapper`,...wt,onScroll:Ot,style:{...dt,...Rp},ref:Tt,className:Jt([`react-flow`,i,Dt]),id:ft,role:`application`,children:(0,Y.jsxs)(Lp,{nodes:e,edges:t,width:_t,height:vt,fitView:Ye,fitViewOptions:Xe,minZoom:he,maxZoom:q,nodeOrigin:ue,nodeExtent:ve,zIndexMode:Ct,children:[(0,Y.jsx)(ad,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:K,autoPanOnNodeFocus:se,nodesConnectable:ce,nodesFocusable:le,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:pe,elevateNodesOnSelect:tt,elevateEdgesOnSelect:nt,minZoom:he,maxZoom:q,nodeExtent:ve,onNodesChange:J,onEdgesChange:Ge,snapToGrid:re,snapGrid:ie,connectionMode:I,translateExtent:ge,connectOnClick:Ze,defaultEdgeOptions:et,fitView:Ye,fitViewOptions:Xe,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Je,nodeOrigin:ue,rfId:Et,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:ut,connectionRadius:ct,isValidConnection:lt,selectNodesOnDrag:oe,nodeDragThreshold:pt,connectionDragThreshold:mt,onBeforeDelete:ee,debug:bt,ariaLabelConfig:St,zIndexMode:Ct}),(0,Y.jsx)(Mp,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:R,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:H,selectionOnDrag:U,selectionMode:W,deleteKeyCode:V,multiSelectionKeyCode:G,panActivationKeyCode:te,zoomActivationKeyCode:ne,onlyRenderVisibleElements:ae,defaultViewport:me,translateExtent:ge,minZoom:he,maxZoom:q,preventScrolling:_e,zoomOnScroll:be,zoomOnPinch:xe,zoomOnDoubleClick:Te,panOnScroll:Se,panOnScrollSpeed:Ce,panOnScrollMode:we,panOnDrag:Ee,autoPanOnSelection:ot,onPaneClick:De,onPaneMouseEnter:Oe,onPaneMouseMove:ke,onPaneMouseLeave:Ae,onPaneScroll:je,onPaneContextMenu:Me,paneClickDistance:Ne,nodeClickDistance:Pe,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:He,onEdgeMouseLeave:Ue,reconnectRadius:We,defaultMarkerColor:ye,noDragClassName:Ke,noWheelClassName:qe,noPanClassName:Je,rfId:Et,disableKeyboardA11y:rt,nodeExtent:ve,viewport:ht,onViewportChange:gt}),(0,Y.jsx)($u,{onSelectionChange:k}),Fe,(0,Y.jsx)(qu,{proOptions:$e,position:Qe}),(0,Y.jsx)(Wu,{rfId:Et,disableKeyboardA11y:rt})]})})}var Bp=Td(zp),Vp=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Hp({children:e}){let t=$(Vp);return t?(0,kt.createPortal)(e,t):null}function Up(e){let[t,n]=(0,X.useState)(e);return[t,n,(0,X.useCallback)(e=>n(t=>hd(e,t)),[])]}var Wp=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(let[,{internals:e}]of t.nodeLookup)if(e.handleBounds===void 0||!kc(e.userNode))return!1;return!0};function Gp(e={includeHiddenNodes:!1}){return $(Wp(e))}Ns.error014();function Kp({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,Y.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Jt([`react-flow__background-pattern`,n,r])})}function qp({radius:e,className:t}){return(0,Y.jsx)(`circle`,{cx:e,cy:e,r:e,className:Jt([`react-flow__background-pattern`,`dots`,t])})}var Jp;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(Jp||={});var Yp={[Jp.Dots]:1,[Jp.Lines]:1,[Jp.Cross]:6},Xp=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Zp({id:e,variant:t=Jp.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,X.useRef)(null),{transform:f,patternId:p}=$(Xp,ju),m=r||Yp[t],h=t===Jp.Dots,g=t===Jp.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,Y.jsxs)(`svg`,{className:Jt([`react-flow__background`,l]),style:{...c,...Rd,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,Y.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,Y.jsx)(qp,{radius:y/2,className:u}):(0,Y.jsx)(Kp,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,Y.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}Zp.displayName=`Background`;var Qp=(0,X.memo)(Zp);function $p(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,Y.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function em(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,Y.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function tm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,Y.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 nm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 rm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.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 im({children:e,className:t,...n}){return(0,Y.jsx)(`button`,{type:`button`,className:Jt([`react-flow__controls-button`,t]),...n,children:e})}var am=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function om({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=Fu(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(am,ju),{zoomIn:y,zoomOut:b,fitView:x}=Nd();return(0,Y.jsxs)(Gu,{className:Jt([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(im,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,Y.jsx)($p,{})}),(0,Y.jsx)(im,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,Y.jsx)(em,{})})]}),n&&(0,Y.jsx)(im,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,Y.jsx)(tm,{})}),r&&(0,Y.jsx)(im,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,Y.jsx)(rm,{}):(0,Y.jsx)(nm,{})}),u]})}om.displayName=`Controls`;var sm=(0,X.memo)(om);function cm({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,Y.jsx)(`rect`,{className:Jt([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var lm=(0,X.memo)(cm),um=e=>e.nodes.map(e=>e.id),dm=e=>e instanceof Function?e:()=>e;function fm({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=lm,onClick:o}){let s=$(um,ju),c=dm(t),l=dm(e),u=dm(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,Y.jsx)(Y.Fragment,{children:s.map(e=>(0,Y.jsx)(mm,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function pm({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=Oc(r);return{node:r,x:i,y:a,width:o,height:s}},ju);return!l||l.hidden||!kc(l)?null:(0,Y.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var mm=(0,X.memo)(pm),hm=(0,X.memo)(fm),gm=200,_m=150,vm=e=>!e.hidden,ym=e=>{let 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?pc(Xs(e.nodeLookup,{filter:vm}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},bm=`react-flow__minimap-desc`;function xm({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=Fu(),S=(0,X.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(ym,ju),j=e?.width??gm,M=e?.height??_m,N=C.width/j,P=C.height/M,F=Math.max(N,P),ee=F*j,I=F*M,L=b*F,R=C.x-(ee-C.width)/2-L,z=C.y-(I-C.height)/2-L,B=ee+L*2,V=I+L*2,H=`${bm}-${T}`,U=(0,X.useRef)(0),W=(0,X.useRef)();U.current=F,(0,X.useEffect)(()=>{if(S.current&&E)return W.current=Kl({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>U.current}),()=>{W.current?.destroy()}},[E]),(0,X.useEffect)(()=>{W.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let te=p?e=>{let[t,n]=W.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,G=m?(0,X.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,ne=_??A[`minimap.ariaLabel`];return(0,Y.jsx)(Gu,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F: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 o==`number`?o:void 0},className:Jt([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,Y.jsxs)(`svg`,{width:j,height:M,viewBox:`${R} ${z} ${B} ${V}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":H,ref:S,onClick:te,children:[ne&&(0,Y.jsx)(`title`,{id:H,children:ne}),(0,Y.jsx)(hm,{onClick:G,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,Y.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${R-L},${z-L}h${B+L*2}v${V+L*2}h${-B-L*2}z + M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}xm.displayName=`MiniMap`;var Sm=(0,X.memo)(xm),Cm=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,wm={[su.Line]:`right`,[su.Handle]:`bottom-right`};function Tm({nodeId:e,position:t,variant:n=su.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=Qd(),y=typeof e==`string`?e:v,b=Fu(),x=(0,X.useRef)(null),S=n===su.Handle,C=$((0,X.useCallback)(Cm(S&&p),[S,p]),ju),w=(0,X.useRef)(null),T=t??wm[n];(0,X.useEffect)(()=>{if(!(!x.current||!y))return w.current||=vu({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Tl([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Ac({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,Y.jsx)(`div`,{className:Jt([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,X.memo)(Tm);function Em({path:e,delay:t,padding:n=24,children:r}){let i=`map-growth-${(0,X.useId)().replace(/:/g,``)}`;if(t==null)return(0,Y.jsx)(Y.Fragment,{children:r});let a=(e.match(/-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/gi)??[]).map(Number),o=a.filter((e,t)=>t%2==0),s=a.filter((e,t)=>t%2==1);if(!o.length||!s.length)return(0,Y.jsx)(Y.Fragment,{children:r});let c=Math.min(...o)-n,l=Math.min(...s)-n;return(0,Y.jsxs)(`g`,{"data-map-growing-edge":`true`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`mask`,{id:i,maskUnits:`userSpaceOnUse`,x:c,y:l,width:Math.max(...o)-c+n,height:Math.max(...s)-l+n,children:(0,Y.jsx)(`path`,{className:`map-growth-mask`,d:e,pathLength:1,fill:`none`,stroke:`white`,strokeWidth:n*2,strokeLinecap:`round`,style:{animationDelay:`${t}ms`}})})}),(0,Y.jsx)(`g`,{mask:`url(#${i})`,children:r})]})}function Dm({layout:e,growing:t={},activeStep:n,activeTeamSteps:r=[]}){let i=`submap-arrow-${(0,X.useId)().replace(/:/g,``)}`;return(0,Y.jsxs)(`svg`,{className:`submap-relations`,width:e.width,height:e.height,"aria-label":`Task process relationships`,children:[(0,Y.jsx)(`defs`,{children:(0,Y.jsx)(`marker`,{id:i,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6.5`,markerHeight:`6.5`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,fill:`var(--map-edge-context, #6f8ca8)`})})}),e.links.map(a=>{let o=e.positions[a.source],s=e.positions[a.target],c=o.x===s.x&&s.y>o.y,l=o.x+(c?116:232),u=o.y+(c?180:90),d=s.x+(c?116:0),f=s.y+(c?0:90),p=(l+d)/2,m=(u+f)/2,h=c?`M ${l} ${u} L ${d} ${f}`:`M ${l} ${u} C ${p} ${u}, ${p} ${f}, ${d} ${f}`;return(0,Y.jsxs)(`g`,{"data-testid":`submap-relation`,"data-relation":a.relation,"data-source":a.source,"data-target":a.target,"aria-label":`${a.label}: ${a.explanation}`,children:[(0,Y.jsx)(`title`,{children:a.explanation}),(0,Y.jsx)(Em,{path:h,delay:t[a.id],children:(0,Y.jsx)(`path`,{className:`submap-relation-path`,d:h,fill:`none`,stroke:`var(--map-edge-context, #6f8ca8)`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeDasharray:a.contextual?`5 6`:void 0,markerEnd:`url(#${i})`})}),(n===a.target||r.includes(a.target))&&(0,Y.jsx)(`path`,{className:`submap-flow`,d:h,pathLength:1,fill:`none`,stroke:`#4b9cae`,strokeWidth:`3`,strokeDasharray:`.09 .91`,strokeLinecap:`round`,"aria-hidden":`true`}),(0,Y.jsxs)(`g`,{className:`submap-relation-label`,transform:`translate(${p}, ${m})`,children:[(0,Y.jsx)(`rect`,{x:`-38`,y:`-11`,width:`76`,height:`22`,rx:`6`}),(0,Y.jsx)(`text`,{textAnchor:`middle`,dominantBaseline:`central`,children:a.label})]})]},a.id)})]})}function Om({role:e,since:t,zh:n,text:r}){let[i,a]=(0,X.useState)(()=>Date.now()/1e3);(0,X.useEffect)(()=>{if(t==null||r)return;let e=setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(e)},[t,r]);let o=t==null?null:qt(i-t,n);return(0,Y.jsxs)(`div`,{className:`map-card-live`,"data-testid":`map-card-live`,"data-waiting":!!r||void 0,"aria-live":`off`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{title:r,children:r||(0,Y.jsxs)(Y.Fragment,{children:[ut(e,n),o?n?` · 本次已进行 ${o}`:` · ${o} this run`:``]})})]})}var km=(0,X.createContext)({notes:{}}),Am=(0,X.createContext)({}),jm={plan:[`计划`,`Plan`],execution:[`动手处理`,`Work`],review:[`检查结果`,`Check`],revision:[`修订`,`Revise`],result:[`结果`,`Result`]},Mm={plan:N,execution:I,review:m,revision:F,result:ht},Nm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],review_unavailable:[`这次结果检查没有完成`,`Result check did not finish`],held:[`工作暂停,后续尚未安排`,`Work paused; no next step scheduled`],aborted:[`已取消`,`Cancelled`],cancelled:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已被新计划替代`,`Replaced by a new plan`],question:[`等待答复`,`Waiting for an answer`],paused:[`已暂停`,`Paused`],paused_external_work:[`等待后台任务`,`Waiting on background work`],missing:[`记录中缺失`,`Not in this record`],unknown:[`状态未知`,`Unknown`],continue:[`需再改一轮`,`Another pass needed`],blocked:[`受阻`,`Held up`],started:[`进行中`,`Under way`],recorded:[`已记录`,`On record`],requested:[`修改建议`,`Requested`],replan:[`需要调整计划`,`Plan needs adjusting`],replan_requested:[`需要调整计划`,`Plan needs adjusting`]},Pm={plan:[`接下来要做什么,为什么这样做`,`What to do next and why`],execution:[`实际做了什么,遇到了什么问题`,`What was done and what happened`],review:[`结果是否正确,有什么依据`,`Whether the result is correct and what supports it`],revision:[`检查后发现需要修改的地方`,`What the check found needs changing`],result:[`这项任务最后得到了什么`,`What the task produced in the end`]},Fm={plan:[`提问`,`Asked`],execution:[`Argus 查证`,`Argus`],review:[`核对`,`Check`],revision:[`修订`,`Revise`],result:[`回答`,`Answer`]},Im={plan:[`你提出的要求`,`What you asked for`],execution:[`Argus 自己动手查证、运行命令`,`Argus did the work itself: read, searched, ran commands`],review:[`对结果的核对`,`A check of the result`],revision:[`需要修改的地方`,`What had to change`],result:[`Argus 给出的回答`,`What Argus answered`]},Lm=(e,t)=>e.source===`team`?t?`子任务工作记录`:`Subtask work record`:e.source===`task`?t?`任务记录`:`Task record`:e.source===`interval`?t?`根据同期记录关联`:`By execution window`:t?`来自任务记录`:`Linked event`,Rm=(0,X.memo)(function({id:e,data:t}){let{task:n,ordinal:r,zh:i,layout:a,focused:o,detailed:s}=t,{artifacts:c,onOpenArtifact:l}=(0,X.useContext)(Am),u=(0,X.useContext)(km).notes[n.id]??[],[d]=(0,X.useState)(()=>!!t.revealing||!t.restoring&&!t.seenCards?.has(e));(0,X.useEffect)(()=>{t.seenCards?.add(e)},[t.seenCards,e]);let[f,p]=(0,X.useState)(null),m=f||a,h=e=>e.source===`team`&&a.steps.find(t=>t.id===e.id)||e,g=t.canvasSize?.width||window.innerWidth,v=t.canvasSize?.height||window.innerHeight;(0,X.useEffect)(()=>{s||(x(null),p(null),t.readCopy?.(e,null))},[s]);let[b,x]=(0,X.useState)(null),S=(0,X.useRef)(n.status),[C,w]=(0,X.useState)(!1);(0,X.useEffect)(()=>{let e=S.current!==n.status;if(S.current=n.status,!e||n.status!==`done`||t.completionScope)return;w(!0);let r=setTimeout(()=>w(!1),1500);return()=>clearTimeout(r)},[n.status,t.completionScope]);let T=m.steps.find(e=>e.id===b),E=T?h(T):void 0,O=E?.updatedAt??E?.ts,k=t.part===t.partCount,A=!k||t.completionScope?`recorded`:n.status===`missing`?`missing`:t.paused&&Te.has(n.status)?`paused`:De(n),j=A===`paused`&&n.status===`paused_external_work`?n.status:A,M=Math.min(t.frame.width/288,t.frame.height/280),N=t.copy?.cards||{},F=!!N[n.id]?.summary&&N[n.id]?.task_status!==n.status&&(Te.has(n.status)||n.status===`pending`),ee=e=>{if(e.completionScope||e.status===`review_unavailable`)return;let t=N[e.id];if(e.source!==`team`)return t;let n=t?.event_ids?.indexOf(e.id)??-1;return h(e).revision&&n>=0&&t?.event_revisions?.[n]===h(e).revision?t:void 0},I=n.kind===`turn`?void 0:t.words,L=(t.completionScope?``:N[n.id]?.title)||I?.title||n.title,R=i?`环节 ${t.start}–${t.end} / ${t.totalSteps}`:`Steps ${t.start}–${t.end} / ${t.totalSteps}`,z=t.partCount>1&&!k?m.steps.map(e=>ee(e)?.summary||h(e).summary||h(e).detail).filter(e=>e&&![_e(!0),_e(!1)].includes(e)).at(-1):void 0,B=k&&n.objective&&n.objective.trim()!==n.title.trim(),V=A===`review_unavailable`?i?`当次审查器未能给出判断,未形成审阅结论。`:`The Reviewer could not return a judgment on this attempt.`:(t.completionScope?``:N[n.id]?.summary)||I?.summary||``,U=(k?n.pending_question:``)||z||V||t.completionScope||n.pending_question||nt(n.summary||``,i).summary||n.summary||(B?``:n.objective),W=Math.min(t.frame.width/m.width,t.frame.height/m.height),te=k&&t.live&&Te.has(n.status)?[...m.steps].reverse().find(e=>e.source!==`team`&&![`plan`,`result`].includes(e.kind))?.id:null,G=t.paused?null:te,ne=a.steps.filter(e=>e.source===`team`),re=t.live?ne.filter(e=>Te.has(e.status)).map(e=>e.id):[],ie=ne.filter(e=>e.status===`done`).length,ae=ne.filter(e=>Te.has(e.status)).length,oe=(i?`子任务 ${ie}/${ne.length} 完成 · ${ae} 进行中`:`Subtasks ${ie}/${ne.length} done · ${ae} running`)+((t.plannedWidth??0)>ne.length?i?` · 计划并行 ×${t.plannedWidth}`:` · planned ×${t.plannedWidth}`:``),K=e=>e.source===`team`?re.includes(e.id):G===e.id,ce=e=>e.source===`team`?h(e).status:te===e.id?t.paused?`paused`:`running`:e.status,le=e=>({source:t.source,task_id:n.id,task_title:L,lang:i?`zh`:`en`,part:t.partCount>1?t.part:void 0,step_id:e?.id,step_title:e?.title,team_id:e?.teamId,team_task_id:e?.teamTaskId,event_ids:e?e.eventIds:t.partCount>1?[...new Set(m.steps.flatMap(e=>e.eventIds))]:N[n.id]?.event_ids||[]}),ue=Math.min(640,m.width-48,Math.max(260,(g-50)/1.05)),de=Math.min(600,m.height-48,Math.max(300,(v-(g<640?180:160))/1.05)),fe=e=>({x:Math.max(24,Math.min(m.positions[e.id].x-16,m.width-ue-24)),y:Math.max(24,Math.min(m.positions[e.id].y-16,m.height-de-24)),width:ue,height:de,scale:W}),pe=E?fe(E):null,me=n=>{p(m),x(n.id),t.readCopy?.(e,n.id),t.readStep(e,fe(n))};(0,X.useEffect)(()=>{E&&t.readStep(e,fe(E))},[g,v]);let he=e=>(Nm[e===`paused_external_work`?e:e.startsWith(`paused_`)?`paused`:Te.has(e)?`running`:e]??Nm.unknown)[+!i],q=t.completionScope?i?`当次结束 · 当时目标未完成`:`Execution ended · goal incomplete then`:n.turn_kind===`qa`&&[`done`,`running`,`cancelled`,`failed`].includes(A)?{done:[`已回答`,`Answered`],running:[`正在回答`,`Answering`],cancelled:[`已中断`,`Interrupted`],failed:[`回答失败`,`Answer failed`]}[A][+!i]:he(j);return(0,Y.jsxs)(`article`,{className:`map-macro map-state-${A}`,"data-testid":`map-macro`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,"data-history":!k,"data-has-history":!!t.historyCount,"data-arrive":!!t.arriving||d&&!!t.revealing,"data-lit":!!t.lit,"data-hovered":!!t.hovered,"data-growing":t.growthDelay!=null,"data-dispatch":t.dispatchState,style:{animationDelay:`${t.growthDelay??(t.arriving?Gt(r):0)}ms`},"data-focused":o,"data-detailed":s,"aria-label":L,"data-completed-now":C,"data-active":re.length>0||k&&t.live&&!t.paused&&Te.has(n.status),onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(),{x:e.clientX,y:e.clientY})},children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(sf,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsxs)(`div`,{className:`macro-summary`,"aria-hidden":s,style:{"--summary-height":`${t.frame.height/M-20}px`,width:t.frame.width/M-20,transform:`translate(-50%, -50%) scale(${M})`},children:[(0,Y.jsxs)(`button`,{className:`map-card map-state-${A} nodrag nopan`,"data-testid":`map-card`,"data-task-id":n.id,"data-card-id":e,"data-part":t.part,tabIndex:s?-1:0,onClick:()=>n.turn_kind===`qa`&&t.readCopy?t.readCopy(e,n.id):t.open(e),"aria-label":`${L} · ${n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`放大任务`:`Explore task`}`,children:[(0,Y.jsxs)(`div`,{className:`map-card-top`,children:[(0,Y.jsxs)(`span`,{className:`map-card-number`,children:[n.turn_kind===`qa`?i?`问答`:`Q&A`:k?i?`任务`:`MISSION`:i?`历史`:`HISTORY`,` `,String(r).padStart(2,`0`),!k&&` · ${t.part}/${t.partCount}`]}),(A!==`recorded`||t.completionScope)&&(0,Y.jsxs)(`span`,{className:`map-status`,children:[A===`done`?(0,Y.jsx)(_,{size:11}):A===`failed`?(0,Y.jsx)(y,{size:11}):A===`review_unavailable`?(0,Y.jsx)(Ce,{size:11}):A===`question`?(0,Y.jsx)(ve,{size:11}):A===`paused`||A===`held`?(0,Y.jsx)(P,{size:11}):(0,Y.jsx)(`span`,{className:`map-state-dot`}),q]})]}),(0,Y.jsxs)(`h3`,{children:[(0,Y.jsx)(rt,{children:L}),u.length>0&&(0,Y.jsx)(`span`,{className:`macro-note-badge`,title:i?`操作员批注`:`Operator notes`,children:u.length})]}),B&&!V&&(0,Y.jsx)(`p`,{className:`map-card-objective`,title:n.objective,children:n.objective}),U&&U.trim()!==(B?n.objective.trim():``)&&(0,Y.jsx)(`div`,{className:`map-card-copy`,children:(0,Y.jsx)(rt,{children:U})}),t.conclusion&&(0,Y.jsx)(`p`,{className:`map-card-conclusion`,"data-testid":`map-card-conclusion`,title:t.conclusion,children:t.conclusion}),n.kind!==`turn`&&(0,Y.jsx)(`div`,{className:`map-card-course`,"aria-label":i?`任务经过`:`Course of the task`,children:[`plan`,`execution`,`review`,`result`].map(e=>{let t=Mm[e],n=m.steps.some(t=>t.kind===e),r=m.steps.some(t=>t.kind===e&&K(t)),a=i?{plan:`规划`,execution:`执行`,review:`审查`,result:`交付`}[e]:jm[e][1];return(0,Y.jsxs)(`span`,{className:`submap-kind-${e}`,"data-present":n,"data-active":r,title:a,children:[(0,Y.jsx)(t,{size:12,"aria-hidden":!0}),(0,Y.jsx)(`b`,{children:a})]},e)})}),(()=>{let e=k&&t.live&&t.waiting,r=!e&&k&&t.live&&!t.paused&&Te.has(n.status),a=A!==`recorded`||!!t.completionScope,o=!!t.historyCount&&ne.length>0;return!r&&!e&&k&&a&&!o?null:(0,Y.jsxs)(`div`,{className:`map-card-stages`,children:[e?(0,Y.jsx)(Om,{text:t.waiting,zh:i}):r?(0,Y.jsx)(Om,{role:t.phase??n.role,since:n.started_ts,zh:i}):k&&a?null:(0,Y.jsx)(`span`,{className:`map-card-recorded`,children:k?q:i?`历史记录 · 非当前执行`:`History · not current execution`}),o&&(0,Y.jsx)(`span`,{className:`map-card-team-summary`,children:oe})]})})(),k&&ne.length>0&&(0,Y.jsx)(`span`,{className:`map-card-teambar`,"aria-hidden":!0,children:(0,Y.jsx)(`i`,{style:{width:`${Math.round(ie/ne.length*100)}%`}})}),(0,Y.jsxs)(`div`,{className:`map-card-bottom`,children:[(0,Y.jsx)(`span`,{className:ne.length?`map-card-team-summary`:void 0,title:R,children:n.turn_kind===`qa`?i?`问题与回答`:`Question and answer`:t.historyCount?``:ne.length?oe:t.plannedWidth&&Te.has(n.status)?i?`并行编队 ×${t.plannedWidth} 展开中`:`Fanning out ×${t.plannedWidth}`:t.partCount>1?R:`${m.steps.length} ${i?`个环节`:`steps`}`}),(0,Y.jsxs)(`span`,{className:`map-card-submap-hint`,children:[F?i?`描述更新中`:`Summary updating`:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`查看进展`:`View progress`,(0,Y.jsx)(se,{size:12})]})]})]}),!!t.historyCount&&t.toggleHistory&&(0,Y.jsxs)(`button`,{type:`button`,className:`map-history-toggle nodrag nopan`,"aria-expanded":t.historyExpanded,"aria-label":`${i?`任务历史`:`Mission history`}: ${L}`,title:i?`保留全部 ${t.totalSteps} 个环节`:`All ${t.totalSteps} steps retained`,onClick:()=>t.toggleHistory?.(n.id),children:[t.historyExpanded?i?`收起历史`:`Hide history`:`${i?`历史`:`History`} ${t.historyCount}`,(0,Y.jsx)(se,{size:12})]})]}),o&&(0,Y.jsxs)(`div`,{className:`macro-detail ${E?`is-reading`:``}`,"data-stacked":m.stacked||void 0,"aria-hidden":!s,style:{width:m.width,height:m.height,transform:`scale(${W})`,transformOrigin:`top left`},children:[(0,Y.jsxs)(`header`,{className:`macro-heading`,children:[(0,Y.jsx)(`span`,{className:`macro-index`,children:String(r).padStart(2,`0`)}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`small`,{children:t.partCount>1?i?`第 ${t.part} / ${t.partCount} 部分`:`Part ${t.part} / ${t.partCount}`:n.turn_kind===`qa`?i?`问答内容`:`Q&A`:i?`任务内部`:`INSIDE THIS TASK`}),(0,Y.jsx)(`h2`,{children:(0,Y.jsx)(rt,{children:L})})]}),t.conclusion&&(0,Y.jsx)(`span`,{className:`macro-conclusion`,"data-testid":`macro-conclusion`,title:t.conclusion,children:t.conclusion}),(A!==`recorded`||t.completionScope)&&(0,Y.jsx)(`span`,{className:`macro-state`,title:t.completionScope,children:q}),s&&k?(0,Y.jsx)(D,{"data-testid":`map-task-read`,className:`nodrag nopan text-xs`,onClick:()=>{if(n.turn_kind===`qa`){t.readCopy?.(e,n.id);return}x(null),p(null),t.readCopy?.(e,n.id)},children:n.turn_kind===`qa`?i?`查看回答`:`Read answer`:i?`阅读任务说明`:`Read task explanation`}):null]}),(0,Y.jsx)(`div`,{className:`macro-stage-key`,children:Ge.filter(e=>n.kind!==`turn`||m.steps.some(t=>t.kind===e)).map(e=>(0,Y.jsx)(`span`,{className:`submap-kind-${e} ${m.steps.some(t=>t.kind===e)?``:`is-unrecorded`}`,title:n.kind===`turn`?Im[e][+!i]:Pm[e][+!i],children:n.kind===`turn`?Fm[e][+!i]:jm[e][+!i]},e))}),u.length>0&&(0,Y.jsxs)(`aside`,{className:`macro-notes`,"aria-label":i?`操作员批注`:`Operator notes`,children:[(0,Y.jsx)(`small`,{children:i?`批注`:`Notes`}),u.map(e=>(0,Y.jsx)(`p`,{children:e.text},e.id))]}),(0,Y.jsx)(Dm,{layout:m,growing:t.growingLinks,activeStep:G,activeTeamSteps:re}),m.columns.map(e=>(0,Y.jsx)(`div`,{className:`macro-column-label`,style:{left:e.x,top:e.y},children:e.title},e.id)),m.steps.map((e,r)=>{let a=h(e),o=Mm[a.kind];return(0,Y.jsxs)(`button`,{className:`submap-step submap-kind-${a.kind} nodrag nopan ${b===a.id?`is-selected`:``}`,"data-testid":`submap-step`,"data-step-id":a.id,"data-source":a.source,"data-team-id":a.teamId,"data-team-task-id":a.teamTaskId,"data-status":ce(a),"data-active":K(a),"data-growing":t.growingSteps?.[a.id]!=null,onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(a),{x:e.clientX,y:e.clientY})},style:{animationDelay:`${t.growingSteps?.[a.id]??0}ms`,"--step-index":r,left:m.positions[a.id].x,top:m.positions[a.id].y},tabIndex:s?0:-1,onClick:()=>me(a),"aria-expanded":b===a.id,children:[(0,Y.jsxs)(`div`,{className:`submap-step-meta`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(o,{size:16}),a.source===`team`?i?`子任务 · `:`Subtask · `:``,(n.kind===`turn`?Fm:jm)[a.kind][+!i],a.round!=null&&(0,Y.jsx)(`em`,{className:`submap-round`,children:i?`第 ${a.round} 轮`:`Round ${a.round}`})]}),(0,Y.jsx)(`small`,{"data-verdict":a.source===`team`&&ye(h(a).teamOutcome)||void 0,children:a.completionScope&&a.status===`recorded`?i?`执行结束`:`Execution ended`:a.source===`team`&&ce(a)===`failed`?i?`失败`:`Failed`:a.source===`team`&&H(h(a).teamOutcome,i)||he(ce(a))})]}),(0,Y.jsx)(`h4`,{children:(0,Y.jsx)(rt,{children:a.title})}),(0,Y.jsx)(`div`,{className:`submap-step-copy`,children:(0,Y.jsx)(rt,{children:ee(a)?.summary||h(a).summary||a.detail||_e(i)})}),(0,Y.jsxs)(`div`,{className:`submap-step-foot`,children:[(0,Y.jsxs)(`span`,{title:Lm(a,i),children:[i?`查看详情`:`Read more`,a.workCount?(0,Y.jsx)(`em`,{className:`submap-step-work`,children:i?` · ${a.workCount} 步操作`:` · ${a.workCount} actions`}):null]}),(0,Y.jsx)(se,{size:14})]})]},a.id)}),t.partCount>1&&!E&&(0,Y.jsxs)(`nav`,{className:`macro-part-nav nodrag nopan`,"aria-label":i?`任务各部分`:`Task parts`,children:[(0,Y.jsx)(`span`,{children:R}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`button`,{disabled:!t.previousId,onClick:()=>t.previousId&&t.open(t.previousId,!0),children:[(0,Y.jsx)(ft,{size:14}),i?`上一部分`:`Previous part`]}),(0,Y.jsxs)(`button`,{disabled:!t.nextId,onClick:()=>t.nextId&&t.open(t.nextId,!0),children:[i?`下一部分`:`Next part`,(0,Y.jsx)(se,{size:14})]})]})]}),E&&pe&&(0,Y.jsxs)(`section`,{className:`macro-reader nodrag nopan nowheel`,"data-testid":`map-reader`,"data-kind":E.kind,role:`region`,"aria-label":i?`卡片详情`:`Card details`,style:{left:pe.x,top:pe.y,width:pe.width,height:pe.height},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),t.menu(le(E),{x:e.clientX,y:e.clientY})},children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsxs)(`span`,{children:[(n.kind===`turn`?Fm:jm)[E.kind][+!i],n.turn_kind!==`qa`&&(0,Y.jsx)(`small`,{className:`macro-reader-note`,children:Pm[E.kind][+!i]})]}),(0,Y.jsx)(`button`,{"aria-label":`Close step details`,onClick:()=>{x(null),p(null),t.readCopy?.(e,null),t.open(e)},children:(0,Y.jsx)(y,{size:20})})]}),(0,Y.jsx)(`h3`,{children:(0,Y.jsx)(rt,{children:ee(E)?.title||E.title})}),(0,Y.jsx)(`div`,{className:`macro-reader-body`,children:(0,Y.jsx)(Et,{cardKey:E.id,taskId:n.id,card:ee(E),task:n,readOnly:t.readOnly,originalDetail:E.detail||_e(i),selection:t.readerCopy,artifacts:c,onOpenArtifact:l})}),(0,Y.jsxs)(`footer`,{children:[(0,Y.jsx)(`span`,{title:Lm(E,i),children:O?new Date(O*1e3).toLocaleString(i?`zh-CN`:`en-US`):``}),!t.readOnly&&(0,Y.jsx)(`button`,{onClick:()=>t.quote(le(E)),children:i?`引用此项`:`Reference`})]})]})]})]})});function zm(e){if(!(e>0)||!Number.isFinite(e))return e;let t=Math.floor(Math.log2(e)*4+1e-9)/4;return Math.round(2**t*1e4)/1e4}function Bm(e,t){let n=zm(t);if(e==null||!(e>0))return n;let r=Math.log2(t/e)*4;return r<-2||r>=3?n:e}function Vm(){let e=null,t=new Set;return{get:()=>e,set(n){n!==e&&(e=n,t.forEach(e=>e()))},subscribe(e){return t.add(e),()=>void t.delete(e)}}}var Hm=(0,X.createContext)(null),Um=()=>()=>{};function Wm(e){let t=(0,X.useContext)(Hm),n=()=>{let n=t?.get();return n==null?null:e(n)},r=(0,X.useSyncExternalStore)(t?t.subscribe:Um,n,n),i=$(t=>r===null?e(zm(t.transform[2])):null);return r??i}function Gm(e){let t={};for(let n of e)(t[n.node_id]??=[]).push(n);for(let e of Object.values(t))e.sort((e,t)=>e.ts-t.ts||e.id.localeCompare(t.id));return t}var Km={width:640,height:190},qm={width:1440,height:640},Jm={"idea-route":vt,"idea-review":m,"idea-selector":gt},Ym={done:`✓`,failed:`✕`,question:`?`,paused:`‖`,running:`▶`,superseded:`↪`},Xm={done:[`已完成`,`Completed`],running:[`进行中`,`In progress`],pending:[`待开始`,`Planned`],failed:[`执行失败`,`Execution failed`],question:[`待答复`,`Needs input`],paused:[`已暂停`,`Paused`],aborted:[`已取消`,`Cancelled`],skipped:[`已跳过`,`Skipped`],superseded:[`已替代`,`Superseded`],unknown:[`已记录`,`Recorded`]},Zm=(0,X.memo)(function({data:e}){let{task:t,zh:n,fanIndex:r,fanCount:i}=e,a=De(t),o=t.group,s=o?pe:t.overflow_count?he:Jm[t.team_role??``]??N,c=o?``:H(t.team_outcome,n),l=o?``:ye(t.team_outcome),u=c||(Xm[a]??Xm.unknown)[+!n],d=l===`rejected`?`✕`:l===`chosen`?`★`:Ym[a],f=!o&&typeof r==`number`&&typeof i==`number`,p=o?.expanded?n?`收起`:`Fold`:n?`展开`:`Unfold`;return(0,Y.jsxs)(`button`,{type:`button`,className:`map-branch map-state-${a}${o?` map-branch-group`:``} nodrag nopan`,"data-testid":`map-branch`,"data-branch-id":t.id,"data-status":a,"data-verdict":l||void 0,"data-overflow":!!t.overflow_count,"data-group":!!o,"data-expanded":o?o.expanded:void 0,"aria-expanded":o?o.expanded:void 0,title:t.excerpt||t.objective||t.title,"aria-label":o?`${t.title} · ${p}`:`${t.title} · ${u} · ${n?`打开所属任务`:`Open the owning task`}`,onClick:()=>o?e.toggleGroup?.(t.id):e.open(e.parentCardId),children:[[`source`,`target`].flatMap(e=>[Q.Left,Q.Right,Q.Top,Q.Bottom].map(t=>(0,Y.jsx)(sf,{id:t,type:e,position:t,isConnectable:!1},`${e}-${t}`))),(0,Y.jsx)(`span`,{className:`map-branch-glyph`,"aria-hidden":`true`,children:(0,Y.jsx)(s,{})}),d&&(0,Y.jsx)(`span`,{className:`map-branch-state`,"aria-hidden":`true`,children:d}),(0,Y.jsx)(`span`,{className:`map-branch-title`,children:t.title}),c&&(0,Y.jsx)(`span`,{className:`map-branch-verdict`,"data-testid":`map-branch-verdict`,children:c}),f&&(0,Y.jsx)(`span`,{className:`map-branch-fan`,"data-testid":`map-branch-fan`,title:n?`并行分支 ${r} / ${i}`:`Parallel branch ${r} of ${i}`,children:`${r}/${i}`}),o&&(0,Y.jsxs)(`span`,{className:`map-branch-toggle`,"data-testid":`map-branch-toggle`,"aria-hidden":`true`,children:[p,o.expanded?(0,Y.jsx)(g,{}):(0,Y.jsx)(se,{})]}),(0,Y.jsx)(`span`,{className:`map-branch-dot`,"aria-hidden":`true`})]})}),Qm={x:52,y:125,zoom:.24},$m=.01,eh=3.5,th=(e,t,n)=>Math.max(t,Math.min(n,e));function nh(e,t){let n=e.querySelector(t)?.getBoundingClientRect();return n&&n.width>0&&n.height>0?n:void 0}function rh(e,t=!1){let n=e.getBoundingClientRect(),r=nh(e,`.map-canvas-toolbar`),i=nh(e,`.map-composer-dock`),a=nh(e,`.react-flow__minimap`),o=nh(e,`.map-legend`),s=nh(e,`.react-flow__controls`),c=e.dataset.reading===`true`||t&&e.clientWidth<640,l=e.clientWidth<640?20:50,u=Math.max(r?r.bottom-n.top+20:85,!c&&e.clientWidth<640&&o?o.bottom-n.top+16:0,!c&&e.clientWidth<640&&s?s.bottom-n.top+16:0),d=Math.max(i?n.bottom-i.top+24:100,!c&&a?n.bottom-a.top+20:0);return{x:l,y:u,width:Math.max(180,e.clientWidth-l*2),height:Math.max(100,e.clientHeight-u-d)}}var ih=.72,ah=.85,oh=(e,t)=>e?0:t;function sh(e,t,n){let r=Math.min(t.width/n.width,t.height/n.height),i=Math.min(e.width,e.height)/Math.min(n.width,n.height);return Math.min(Math.max(r,ih*i),ah*i)}function ch(e,t,n,r,i){let a=r||1;if(e.width<640&&i?.stacked&&i.width>0)return t.width/(i.width*a);let o=sh(e,t,n),s=e.width<640||(i?.steps.length??0)>20?.6/a:0,c=e.width>=1024?1/a:0;return Math.max(o,s,c)}function lh(e,t,n){let r=th(Math.min(t.width/(n.width+160),t.height/(n.height+160)),$m,.27),i=(e,t,n,r)=>r>t?(n-r)/2:th((n-r)/2,e,e+t-r);return{x:i(t.x,t.width,e.width,n.width*r)-n.x*r,y:i(t.y,t.height,e.height,n.height*r)-n.y*r,zoom:r}}function uh(e,t,n){let r=Math.min(48,e.height*.35),i=e.height-r,a=Math.min(eh,Math.min(1.05,e.width/n.width,i/n.height)/n.scale);return{x:e.x+e.width/2-(t.x+(n.x+n.width/2)*n.scale)*a,y:e.y+r+i/2-(t.y+(n.y+n.height/2)*n.scale)*a,zoom:a}}function dh(e,t=!0){let n=Nd(),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)({width:0,height:0}),l=(0,X.useRef)(null),u=(0,X.useRef)(!1),d=(0,X.useRef)(!1),f=(0,X.useRef)(!1),p=(0,X.useRef)(),m=(0,X.useRef)(()=>{}),h=(0,X.useRef)(null),g=(0,X.useRef)(null),_=(0,X.useRef)(()=>{}),v=(0,X.useRef)(()=>{}),[y,b]=(0,X.useState)(()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),x=(0,X.useRef)(Qm),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null),T=(0,X.useRef)(0),E=(0,X.useRef)(null),D=(0,X.useRef)(0);(0,X.useEffect)(()=>()=>window.clearTimeout(D.current),[]);let[O]=(0,X.useState)(Vm),k=(0,X.useCallback)((e,t)=>{O.get()!==t&&(e.style.setProperty(`--map-zoom-step`,String(t)),O.set(t))},[O]),A=(0,X.useCallback)(()=>{cancelAnimationFrame(T.current),T.current=0,E.current=null},[]),j=(0,X.useCallback)((t,r)=>{t&&(f.current=!1,d.current=!1);let a=e.current;if(!a)return;a.dataset.moving||(a.dataset.moving=`true`),window.clearTimeout(D.current),D.current=window.setTimeout(()=>{delete a.dataset.moving,k(a,zm(n.getZoom()))},180);let s={x:a.clientWidth/2,y:a.clientHeight/2},c=S.current&&S.current.until>performance.now()?S.current:s,p=C.current??(u.current?h.current:null)??K(n.getNodes().filter(e=>e.data.frame),r,c,s),m=p&&(n.getNode(p)?.data)?.frame?.scale||1,g=th((r.zoom-.3)/.14,0,1)*th((r.zoom*m-.28)/.3,0,1),_=w.current,v=u.current?1:_?.id===p?th((r.zoom-_.zoom*.65)/(_.zoom*.35),0,1):g;l.current=v>0?p:null,a.style.setProperty(`--detail-alpha`,String(v)),a.style.setProperty(`--summary-alpha`,String(1-v)),a.style.setProperty(`--context-alpha`,String(p?1-v*.72:1)),a.dataset.zoom=r.zoom.toFixed(2),k(a,Bm(O.get(),r.zoom)),i(v>0&&p?p:null),o(!!p&&v>=.55),r.zoom<=.32&&!C.current&&!E.current&&!w.current&&(x.current=r)},[n,e,k,O]),M=(0,X.useCallback)(t=>{let r=f.current;f.current=!1,A();let i=n.getNode(t),a=e.current;if(!i||!a)return;!r&&n.getZoom()<=.32&&!w.current&&(x.current=n.getViewport()),C.current=t,u.current=!1,delete a.dataset.reading,d.current=!0;let o=rh(a,!0),s=i.width||1440,c=i.height||1080,l=th(ch({width:a.clientWidth,height:a.clientHeight},o,{width:s,height:c},i.data.frame?.scale||1,i.data.layout),$m,eh);w.current={id:t,zoom:l};let p=o.x+Math.max(0,(o.width-s*l)/2)-i.position.x*l,m=o.y+Math.max(0,(o.height-c*l)/2)-i.position.y*l;n.setViewport({x:p,y:m,zoom:l},{duration:oh(y,380)}).then(()=>{C.current=null})},[A,n,y,e]);v.current=M;let N=(0,X.useCallback)(()=>{f.current=!1,A(),C.current=null,u.current=!1,e.current&&delete e.current.dataset.reading,d.current=!1,w.current=null,S.current=null;let t=e.current?.querySelector(`.map-macro[data-focused="true"]`)?.dataset.cardId;n.setViewport(x.current,{duration:oh(y,320)}).then(()=>{t&&e.current?.querySelector(`[data-testid="map-card"][data-card-id="${CSS.escape(t)}"]`)?.focus({preventScroll:!0})})},[A,n,y,e]),P=(0,X.useCallback)((t,r)=>{f.current=!1,A(),C.current=t;let i=n.getNode(t),a=e.current;!i||!a||(u.current=!0,a.dataset.reading=`true`,d.current=!0,h.current=t,g.current={id:t,rect:r},n.setViewport(uh(rh(a),i.position,r),{duration:oh(y,340)}).then(()=>{C.current=null}))},[A,n,y,e]);_.current=P;let F=(0,X.useCallback)(e=>{f.current=!1,A(),u.current=!1,d.current=!1,C.current=null,S.current=null,n.setCenter(e.x,e.y,{zoom:n.getZoom(),duration:oh(y,180)})},[A,n,y]),ee=(0,X.useCallback)(t=>{f.current=!0,p.current=t,A(),C.current=null,u.current=!1,d.current=!1,w.current=null,S.current=null;let r=e.current;r&&delete r.dataset.reading;let i=n.getNodes().filter(e=>!e.hidden&&(!t||t.has(e.data.task.id)));if(!r||!i.length)return;let a=lh({width:r.clientWidth,height:r.clientHeight},rh(r),n.getNodesBounds(i));t||(x.current=a),n.setViewport(a,{duration:oh(y,320)})},[A,n,y,e]);m.current=()=>ee(p.current);let I=(0,X.useCallback)(()=>{f.current?m.current():d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&v.current(l.current)},[]);return(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let n,r=t.querySelector(`.map-composer-dock`),i=-1,a=-1,o=-1,s=new ResizeObserver(()=>{let e=r?.getBoundingClientRect().height||0;(i!==t.clientWidth||a!==t.clientHeight||o!==e)&&(i=t.clientWidth,a=t.clientHeight,o=e,t.style.setProperty(`--map-composer-height`,`${o}px`),c(e=>e.width===i&&e.height===a?e:{width:i,height:a}),clearTimeout(n),n=setTimeout(()=>{d.current&&u.current&&g.current?_.current(g.current.id,g.current.rect):d.current&&l.current&&!u.current?v.current(l.current):f.current&&m.current()},100))});return s.observe(t),r&&s.observe(r),()=>{s.disconnect(),clearTimeout(n)}},[e,t]),(0,X.useEffect)(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>b(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.useEffect)(()=>{let t=e.current;if(!t)return;let r=e=>{if(e.target.closest(`.nowheel, .map-canvas-toolbar, .map-legend, .react-flow__minimap, .react-flow__controls`))return;e.preventDefault(),e.stopPropagation(),f.current=!1,u.current=!1,d.current=!0,C.current=null;let r=t.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top;S.current={x:i,y:a,until:performance.now()+1e3};let o=E.current??n.getViewport();!E.current&&o.zoom<=.32&&!w.current&&(x.current=o);let s=e.deltaY*(e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1),c=th(o.zoom*Math.exp(-th(s,-400,400)*.002),$m,eh);if(E.current={x:i-(i-o.x)*c/o.zoom,y:a-(a-o.y)*c/o.zoom,zoom:c},y){n.setViewport(E.current),E.current=null;return}if(T.current)return;let l=performance.now(),p=e=>{if(!E.current)return;let t=1-Math.exp(-Math.min(e-l,64)/55);l=e;let r=n.getViewport(),i=E.current,a=Math.abs(i.zoom-r.zoom)<15e-5&&Math.abs(i.x-r.x)+Math.abs(i.y-r.y)<.15;n.setViewport(a?i:{x:r.x+(i.x-r.x)*t,y:r.y+(i.y-r.y)*t,zoom:r.zoom+(i.zoom-r.zoom)*t}),a?(T.current=0,E.current=null):T.current=requestAnimationFrame(p)};T.current=requestAnimationFrame(p)},i=()=>{A(),C.current=null,S.current=null},a=e=>{e.defaultPrevented||document.querySelector(`[role="dialog"][aria-modal="true"]`)||e.key===`Escape`&&![`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName)&&N()};return t.addEventListener(`wheel`,r,{passive:!1,capture:!0}),t.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a),()=>{A(),t.removeEventListener(`wheel`,r,!0),t.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a)}},[N,A,n,y,e]),{capture:(0,X.useCallback)(()=>({viewport:n.getViewport(),overview:x.current,focusId:l.current,detailed:!!l.current&&(u.current||!!w.current||n.getZoom()>=.44)}),[n]),restore:(0,X.useCallback)(e=>{A(),x.current=e.overview;let t=e.focusId&&n.getNode(e.focusId)?e.focusId:null;C.current=e.detailed?t:null,w.current=e.detailed&&t?{id:t,zoom:e.viewport.zoom}:null,d.current=!1,f.current=!1,n.setViewport(e.viewport,{duration:0}),j(null,e.viewport)},[A,n,j]),focusId:r,canvasSize:s,detailed:a,enter:M,back:N,fit:ee,fitUpdatedScene:I,navigate:F,readStep:P,onMove:j,reducedMotion:y,zoomSteps:O}}function fh(e,t,n,r=n){if(!n||!r)return[];let i=e.tasks.find(e=>e.id===n);if(!i||i.turn_kind===`qa`)return[];if(r===n)return[St(i,xt(e,i,i.started_ts??0))];let a=new Map(e.events.map(e=>[e.id,e.item_id]));return q(e,t,n).filter(e=>e.task_id===n&&e.key===r&&e.event_ids.every(e=>!a.get(e)||a.get(e)===n))}function ph(e,t){let n=new Map(e.events.map(e=>[e.id,e]));return JSON.stringify(t.map(t=>{let r=e.tasks.find(e=>e.id===t.task_id),i=[t.task_id,`${t.task_id}:active`,`${t.task_id}:outcome`].includes(t.key);return[t,Ct(!r||i?r:{...r,status:``,summary:void 0,outcome:void 0,pending_question:void 0,started_ts:void 0,finished_ts:void 0,attempt:void 0},t.event_ids.flatMap(e=>n.get(e)?[n.get(e)]:[]))]}))}function mh(e,t,n,r=600){let i=e=>[`done`,`failed`,`cancelled`,`recorded`,`skipped`].includes(e||``),a=e.tasks.filter(e=>e.id!==n&&e.turn_kind!==`qa`),o=[...a.filter(e=>i(e.status)),...a.filter(e=>!i(e.status))],s=[];for(let n of o){if(s.length>=r)break;s.push(...U(e,n,fe(n,e.events,t)))}return s.slice(0,r)}function hh(e,t,n,r=!0,a,l,f=!1,p=t,m){let h=n?`zh-CN`:`en-US`,g=e.kind===`live`?`project`:`dataset`,_=e.id.replace(/^live:/,``),v=d(),y=et(l??_,h),b=v===`question-foundation`?m===void 0?y.id:m:null,x=v===`question-foundation`&&!b,S=u(g,_,h,l,v,b),C=o(),w=i({queryKey:S,queryFn:async({signal:e})=>{let t=v===`question-foundation`?await c.mapCopy(g,_,h,e,l,v,b):await c.mapCopy(g,_,h,e,l,v),n=C.getQueryData(S);return st(n,t,n?.model_revision)},staleTime:1/0,gcTime:72e5,refetchOnWindowFocus:!1}),T=e.tasks.find(e=>e.id===t),E=Pe(S,p,tt(p,T)),D=(0,X.useMemo)(()=>a??(T?fe(T,e.events,n):[]),[T,e.events,n,a]),[O,k]=(0,X.useState)(0),[A,j]=(0,X.useState)(!1),M=(0,X.useRef)(!0),N=(0,X.useRef)(null),P=(0,X.useMemo)(()=>new Map(e.events.map(e=>[e.id,e])),[e.events]),F=f?q(e,D,t):fh(e,D,t,p),ee=(0,X.useMemo)(()=>f?mh(e,n,t):[],[e,n,t,f]),I=[...F,...ee].filter(t=>e.tasks.find(e=>e.id===t.task_id)?.turn_kind!==`qa`).filter(t=>Se(t,e,w.data,P)).slice(0,8),L=ph(e,I),R=[`map-copy-generation`,g,_,h,l],z=[...R,v,...v===`question-foundation`?[b]:[],w.data?.version??null,w.data?.model_revision??null,L],B=JSON.stringify(z),V=s({queryKey:R}),H={queryKey:z,queryFn:async()=>{let t=w.data?.model_revision,n=Ze(C,S,I.map(t=>({key:t.key,startedAt:tt(t.key,e.tasks.find(e=>e.id===t.task_id))}))),r;try{r=await c.generateMapCopy(g,_,{cards:I,locale:h,...b?{foundation_id:b}:{}},void 0,l,v,n.update)}finally{n.finish()}return C.setQueryData(S,e=>st(e,r,t)),{available:!r.retry_after&&r.available!==!1&&I.every(t=>!Se(t,e,r,P)),retryAfter:typeof r.retry_after==`number`&&r.retry_after>0?r.retry_after:null}},staleTime:1/0,gcTime:72e5,retry:!1,retryOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1},U=i({...H,enabled:!1}),W=U.isSuccess&&U.data.available===!1?U.data.retryAfter:null,te=(0,X.useMemo)(()=>w.data?.generation_error?Error(w.data.generation_error.message):null,[w.data?.generation_error?.code,w.data?.generation_error?.message]),G=()=>{let e=C.fetchQuery({...H,staleTime:0});return N.current=e,j(!0),e.then(()=>void 0,()=>void 0).finally(()=>{N.current===e&&(N.current=null,M.current&&(j(!1),k(e=>e+1)))}),e};(0,X.useEffect)(()=>(M.current=!0,()=>{M.current=!1}),[]),(0,X.useEffect)(()=>{if(!r||x||!w.data?.available||!I.length||U.isError||U.isSuccess&&!W||V>0||N.current)return;let e=w.data.generation_error&&typeof w.data.retry_after==`number`&&w.data.retry_after>0?w.data.retry_after:0,t=Math.max(W?U.dataUpdatedAt+W*1e3:0,e?w.dataUpdatedAt+e*1e3:0),n=setTimeout(()=>{C.isFetching({queryKey:R})===0&&G()},Math.max(700,t-Date.now()));return()=>clearTimeout(n)},[B,O,w.data?.available,w.data?.retry_after,w.dataUpdatedAt,r,x,V,U.status,U.dataUpdatedAt]);let ne=A||U.isFetching||V>0;return{copy:w.data,generating:ne,ready:w.isFetched,foundationRequired:x,questionContext:{locale:h,preview:v,foundationId:b},readingGenerating:E.active,generationPhase:E.phase,generationError:I.length&&!U.isFetching&&!E.active?U.error||te:null,generationUnavailable:!!I.length&&!U.isFetching&&!E.active&&!W&&U.data?.available===!1,retry:async()=>{!r||x||!w.data?.available||!I.length||ne||N.current||await G().catch(()=>void 0)},readingRequest:F.find(e=>e.key===p),readingNeedsUpdate:U.data?.available!==!0&&I.some(e=>e.key===p)}}var gh=new Set([`done`,`failed`,`cancelled`,`recorded`,`skipped`,`aborted`,`superseded`]);function _h(e,t,n,r,a){let o=n?`zh-CN`:`en-US`,s=e.kind===`live`?`project`:`dataset`,l=e.id.replace(/^live:/,``),u=(0,X.useMemo)(()=>{let n=new Map(e.tasks.map(e=>[e.id,gh.has(e.status||``)])),r=t.filter(e=>n.has(e.source)&&n.has(e.target)).slice(0,48);return JSON.stringify(r.map(e=>[e.source,e.target,n.get(e.source),n.get(e.target)]))},[e.tasks,t]),d=(0,X.useMemo)(()=>JSON.parse(u).map(([e,t])=>({source:e,target:t})),[u]),f=[`map-lines`,s,l,o,a,u],p=i({queryKey:[...f,`saved`],queryFn:({signal:e})=>c.mapLines(s,l,{pairs:d,locale:o,write:!1},e,a),enabled:d.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...f,`written`],queryFn:({signal:e})=>c.mapLines(s,l,{pairs:d,locale:o,write:!0},e,a),enabled:d.length>0&&r&&p.data?.available===!0&&p.data.lines.lengthJSON.stringify(e.tasks.filter(e=>e.kind!==`turn`&&e.turn_kind!==`qa`).slice(-40).map(e=>[e.id,yh.has(e.status||``)])),[e.tasks]),u=(0,X.useMemo)(()=>JSON.parse(l).map(([e])=>e),[l]),d=[`map-card-words`,o,s,a,r,l],f=i({queryKey:[...d,`saved`],queryFn:({signal:e})=>c.mapCardWords(o,s,{tasks:u,locale:a,write:!1},e,r),enabled:u.length>0,staleTime:1/0,gcTime:72e5,retry:!1,refetchOnWindowFocus:!1});return(i({queryKey:[...d,`written`],queryFn:({signal:e})=>c.mapCardWords(o,s,{tasks:u,locale:a,write:!0},e,r),enabled:u.length>0&&n&&f.data?.available===!0&&Object.keys(f.data.cards).length`u`||typeof window.matchMedia!=`function`?!1:window.innerWidth>=1024&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function Ch({footer:e,value:t,onChange:n,onSend:r,attachments:i,onAttachmentsChange:a,pending:o,pendingLabel:s,progressVisible:c=!0,dispatchStatus:u,onCancel:d,focusSignal:p,sessionName:m,historical:h,zh:v,routeOverride:b=`auto`,onRouteOverrideChange:x}){let{t:S}=l(),C=(0,X.useId)(),w=(0,X.useRef)(null),T=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(!1),O=(0,X.useRef)(!0),k=(0,X.useRef)(),[A,j]=(0,X.useState)(``),[M,N]=(0,X.useState)(!1),[P,F]=(0,X.useState)(!1),[ee,I]=(0,X.useState)(()=>!!(t.trim()||i.length)||Sh()),[L,z]=(0,X.useState)(44),B=(0,X.useRef)(t);B.current=t;let H=!ee,{refs:U,text:W}=Ke(t),te=t.length>at,G=!!(t.trim()||i.length),ie=(0,X.useRef)(G);ie.current=G,(0,X.useEffect)(()=>{u===`error`&&I(!0)},[u]),(0,X.useEffect)(()=>{O.current=!0;let e=e=>{let t=e.type===`focusout`?e.relatedTarget:e.target;t?.closest?.(`.map-island-launch, .map-island-stop, .map-composer-brand`)||(T.current?.contains(t)?I(!0):ie.current||I(!1))},t=e=>{let t=e.target;T.current?.contains(t)||t?.closest?.(`.map-context-menu`)||ie.current||(I(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur())},n=e=>{if(e.key!==`c`||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||e.isComposing)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)||t?.closest?.(`[role="dialog"], [role="menu"]`)||(e.preventDefault(),I(!0),w.current?.focus())};return document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,e),document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{O.current=!1,clearTimeout(k.current),document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[]);let ae=(0,X.useRef)(p);(0,X.useEffect)(()=>{p!==ae.current&&(ae.current=p,I(!0),w.current?.focus())},[p]);let oe=(0,X.useRef)(U.length);(0,X.useEffect)(()=>{U.length>oe.current&&(I(!0),w.current?.focus()),oe.current=U.length},[U.length]);let K=()=>{if(!w.current)return;w.current.style.height=`0px`;let e=Math.min(156,Math.max(44,w.current.scrollHeight));w.current.style.height=`${e}px`,z(e)};(0,X.useEffect)(K,[W]),(0,X.useEffect)(()=>(window.addEventListener(`resize`,K),()=>window.removeEventListener(`resize`,K)),[]);let se=()=>{I(!0),w.current?.focus()},ce=()=>{I(!1),T.current?.contains(document.activeElement)&&document.activeElement?.blur()},le=(0,X.useRef)(),ue=(0,X.useRef)(typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches);(0,X.useEffect)(()=>()=>clearTimeout(le.current),[]);let fe=()=>{ue.current&&(clearTimeout(le.current),I(!0))},pe=()=>{ue.current&&(clearTimeout(le.current),le.current=setTimeout(()=>{ie.current||T.current?.contains(document.activeElement)||I(!1)},320))};(0,X.useEffect)(()=>{o||F(!1)},[o]);let me=async()=>{if(!W.trim()||D.current||te)return;let e=o;if(e&&i.length){j(v?`附件要等这条回复结束后再发送`:`Attachments can be sent once this reply finishes`);return}D.current=!0;try{(e?await r(t,[],void 0,{whileRunning:!0}):await r(t,i))&&O.current&&(j(``),N(!0),F(e),(!B.current.trim()||B.current===t)&&ce(),clearTimeout(k.current),k.current=setTimeout(()=>N(!1),1800))}finally{D.current=!1}},he=e=>{if(o||D.current||!e.length)return;let{accepted:t,issues:n}=lt(i,e);a([...i,...t]),j(n.map(e=>e.code===`unsupported`?S(`chat.attachUnsupported`,{name:e.fileName}):e.code===`too-large`?S(`chat.attachTooLarge`,{name:e.fileName,size:R(e.limitBytes)}):e.code===`too-many`?S(`chat.attachTooMany`,{count:e.limitCount}):S(`chat.attachTotalTooLarge`,{size:R(e.limitBytes)})).join(` `))},q=u?{launching:[v?`任务已接收`:`Task accepted`,v?`正在放入地图…`:`Adding it to your map…`],task:[v?`任务已进入地图`:`Your task is on the map`,v?`跟随地图,查看执行进展`:`Follow its progress on the map`],message:[v?`${f().name} 已回复`:`${f().name} replied`,v?`在对话中查看回复`:`Open the conversation to read it`],error:[v?`发送没有成功`:`Message could not be sent`,v?`草稿已保留,可以重试`:`Your draft is ready to retry`],cancelled:[v?`正在停止回复`:`Stopping reply`,v?`可以发送新消息`:`You can send another message`]}[u]:void 0,ge=[v?`已排队`:`Queued`,v?`这条回复结束后立即处理`:`Answered right after this reply`],_e=q?.[0]||(o&&P?ge[0]:o?c?v?`${f().name} 正在处理`:`${f().name} is working`:v?`继续对话`:`Continue chatting`:M?v?`已发送给 ${f().name}`:`Sent to ${f().name}`:v?`交给 ${f().name}`:`Ask ${f().name}`),ve=q?.[1]||(o&&P?ge[1]:o?c?s||(v?`正在处理你的消息…`:`Processing your message…`):v?`可发送后续消息或停止回复`:`Send a follow-up or stop the reply`:M?v?`点此继续对话`:`Tap to keep the conversation going`:G?v?`草稿已保留,点此继续`:`Draft saved — tap to continue`:v?`描述目标,看它变成成果`:`Turn your next idea into a result`),ye=u||(o?`working`:M?`sent`:`idle`);return(0,Y.jsxs)(`div`,{ref:T,className:`map-composer-dock map-island-dock`,"data-compact":H,"data-state":ye,"data-pending":o,style:{"--map-editor-height":`${L}px`},onPointerEnter:fe,onPointerLeave:pe,onTransitionEnd:e=>{e.target===T.current&&e.propertyName===`width`&&K()},children:[!H&&U.length>0&&(0,Y.jsx)(`div`,{className:`map-reference-chips`,children:U.map((e,t)=>(0,Y.jsxs)(`span`,{title:`${e.source} · ${e.task_id} ${e.step_id||``}`,children:[(0,Y.jsxs)(`span`,{children:[v?`引用`:`Reference`,` · `,e.step_title||e.task_title]}),(0,Y.jsx)(`button`,{"aria-label":v?`移除引用`:`Remove reference`,onClick:()=>n(U.filter((e,n)=>t!==n).map(ne).join(``)+W),children:(0,Y.jsx)(y,{size:12})})]},`${e.task_id}:${e.step_id}:${t}`))}),!H&&!!i.length&&(0,Y.jsx)(`div`,{className:`map-attachment-tray nowheel`,role:`group`,"aria-label":v?`待发送附件`:`Selected attachments`,children:i.map((e,t)=>(0,Y.jsx)(Ve,{file:e,disabled:o,removeLabel:S(`chat.attachRemove`,{name:e.name}),onRemove:()=>{a(i.filter(t=>t!==e)),j(``)}},`${e.name}:${e.lastModified}:${t}`))}),!H&&A&&(0,Y.jsx)(`div`,{className:`map-attachment-notice nowheel`,role:`alert`,children:A}),(0,Y.jsxs)(`div`,{className:`map-composer map-island-surface`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-composer-brand map-attach`,"aria-label":S(`chat.attach`),title:S(`chat.attach`),"aria-hidden":H,tabIndex:H?-1:0,disabled:o&&!H,onClick:()=>E.current?.click(),children:(0,Y.jsx)(V,{size:25})}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-island-launch`,"aria-label":v?`打开消息输入`:`Open message composer`,"aria-expanded":!H,"aria-controls":C,"aria-hidden":!H,tabIndex:H?0:-1,onClick:se,children:[(0,Y.jsxs)(`span`,{className:`map-island-copy`,children:[(0,Y.jsx)(`strong`,{children:_e}),(0,Y.jsx)(`small`,{title:ve,children:ve})]}),(0,Y.jsx)(`span`,{className:`map-island-indicator`,"aria-hidden":`true`,children:ye===`working`||ye===`launching`?(0,Y.jsxs)(`span`,{className:`map-island-wave`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}):ye===`sent`||ye===`task`||ye===`message`?(0,Y.jsx)(_,{size:16}):(0,Y.jsx)(mt,{size:15})})]}),H&&o&&(0,Y.jsx)(`button`,{type:`button`,className:`map-island-stop`,onClick:d,"aria-label":v?`停止回复`:`Stop reply`,children:(0,Y.jsx)(re,{size:13})}),(0,Y.jsxs)(`form`,{id:C,className:`map-composer-editor`,"aria-hidden":H,onSubmit:e=>{e.preventDefault(),me()},children:[(0,Y.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:Ae,hidden:!0,disabled:o,onChange:e=>{he(Array.from(e.target.files||[])),e.target.value=``}}),(0,Y.jsx)(`textarea`,{ref:w,rows:1,tabIndex:H?-1:0,value:W,"aria-label":v?`给 ${f().name} 发送消息`:`Message ${f().name}`,placeholder:v?`告诉 ${f().name},你想完成什么…`:`What would you like ${f().name} to do?`,onFocus:()=>I(!0),onChange:e=>{N(!1),n(U.map(ne).join(``)+e.target.value)},onPaste:e=>{let t=Me(e.clipboardData);t.length&&(e.preventDefault(),he(t))},onKeyDown:e=>{e.key===`Escape`&&!ct(e)&&!W.trim()&&!i.length&&(e.preventDefault(),e.stopPropagation(),ce()),e.key===`Enter`&&!e.shiftKey&&!ct(e)&&(e.preventDefault(),me())}}),(0,Y.jsxs)(`div`,{className:`map-island-toolbar`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`map-island-collapse`,tabIndex:H?-1:0,onClick:ce,"aria-label":v?`收起消息输入`:`Collapse message composer`,title:v?`收起(草稿会保留)`:`Collapse (draft is kept)`,children:(0,Y.jsx)(g,{size:15})}),x&&(0,Y.jsx)(Ue,{value:b,onChange:x,disabled:o,tabIndex:H?-1:0}),o&&(0,Y.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),d()},tabIndex:H?-1:0,"aria-label":v?`停止回复`:`Stop reply`,className:`map-send is-pending`,children:(0,Y.jsx)(re,{size:15})},`stop`),(0,Y.jsx)(`button`,{type:`submit`,tabIndex:H?-1:0,disabled:!W.trim()||te,"aria-label":o?v?`在 ${f().name} 工作时发送`:`Send while ${f().name} works`:v?`发送消息`:`Send message`,title:o?v?`排队到这条回复之后处理`:`Queued right after this reply`:void 0,className:`map-send`,children:(0,Y.jsx)(de,{size:20})},`send`)]})]})]}),te&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1 px-3 text-xs text-err`,children:S(`chat.messageTooLong`)}),e,(0,Y.jsx)(`span`,{className:`map-composer-caption`,role:`status`,children:q?`${q[0]} · ${q[1]}`:o&&P?`${ge[0]} · ${ge[1]}`:o?``:M?v?`已发送`:`Sent`:h?`${v?`发送至`:`Send to`} ${m}`:``})]})}function wh(e,t,n){if(e.length<2)return``;let r=[0];for(let t=1;t0))return``;let a=Math.min(n,i/3),o=a*1.22,s=1,c=t=>{let n=Math.max(0,Math.min(i,t));for(;s1&&r[s-1]>n;)s--;let a=r[s]-r[s-1]||1,o=(n-r[s-1])/a,c=e[s-1],l=e[s];return{x:c.x+(l.x-c.x)*o,y:c.y+(l.y-c.y)*o}},l=e=>e*e*(3-2*e),u=e=>{let n=i-e;if(n<=a)return t*2.5*(n/a)**.85;let r=t*(.34+.66*l(Math.min(1,e/Math.max(1,i-o))));return n>=o?r:r+(t*2.5-r)*l((o-n)/(o-a))},d=Math.max(12,Math.min(72,Math.round(i/Math.max(a,1)*1.5))),f=Array.from({length:d+1},(e,t)=>(i-o)*(t/d));f.push(i-(o+a)/2,i-a,i);let p=[],m=[],h=e=>Math.round(e*100)/100;for(let e of f){let t=c(e),n=c(e-i*.004-.5),r=c(e+i*.004+.5),a=r.x-n.x,o=r.y-n.y,s=Math.hypot(a,o)||1,l=u(e)/2,d=-o/s*l,f=a/s*l;p.push(`${h(t.x+d)} ${h(t.y+f)}`),m.push(`${h(t.x-d)} ${h(t.y-f)}`)}return`M ${p.join(` L `)} L ${m.reverse().join(` L `)} Z`}function Th(e,t){let n=1-t;return{x:n**3*e[0].x+3*n**2*t*e[1].x+3*n*t**2*e[2].x+t**3*e[3].x,y:n**3*e[0].y+3*n**2*t*e[1].y+3*n*t**2*e[2].y+t**3*e[3].y}}function Eh(e,t,n=!1){if(!e.length)return null;let r=n?[...e].reverse():e,i=0;for(let e=1;e0&&i+n>=t){let a=(t-i)/n;return{x:r[e-1].x+(r[e].x-r[e-1].x)*a,y:r[e-1].y+(r[e].y-r[e-1].y)*a}}i+=n}return r[r.length-1]}function Dh(e,t,n=0){return e.x>t.x-n&&e.xt.y-n&&e.y({x:n===`left`?-e.x:e.x,y:n===`up`?-e.y:e.y}),s=o(e),c=o(t);i=i.map(e=>({...e,x:n===`left`?-e.x-e.width:e.x,y:n===`up`?-e.y-e.height:e.y}));let l=Math.max(80,n===`loop`?Math.max(Math.abs(c.x-s.x),Math.abs(c.y-s.y))*2.8:0,Math.abs(a?c.y-s.y:c.x-s.x)*(.4+r*.06)),u=[s,a?{x:s.x+0,y:s.y+l}:{x:s.x+l,y:s.y},n===`loop`?{x:c.x,y:c.y+l}:a?{x:c.x-0,y:c.y-l}:{x:c.x-l,y:c.y},c],d=e=>e.flatMap(e=>Array.from({length:31},(t,n)=>Th(e,n/30))),f=e=>d(e).reduce((e,t)=>e+i.filter(e=>Dh(t,e,22)).length,0),p=[u],m=f(p)*1e5;if(m){let e={x:(s.x+c.x)/2,y:(s.y+c.y)/2},t=a?e.x:e.y,n=[...new Set(i.flatMap(e=>a?[e.x-110-r*30,e.x+e.width+110+r*30]:[e.y-110-r*30,e.y+e.height+110+r*30]))].sort((e,n)=>Math.abs(e-t)-Math.abs(n-t)).slice(0,12);for(let e of n){let n=(e-t)*4/3;for(let r of[.25,.4,.55]){let i=Math.max(60,Math.abs(a?c.y-s.y:c.x-s.x)*r),o=[a?[s,{x:s.x+n,y:s.y+i},{x:c.x+n,y:c.y-i},c]:[s,{x:s.x+i,y:s.y+n},{x:c.x-i,y:c.y+n},c]],l=f(o)*1e5+Math.abs(e-t)+Math.abs(r-.4)*100;le.map(o)),{path:`M ${e.x} ${e.y}`+p.map(e=>` C ${e[1].x} ${e[1].y}, ${e[2].x} ${e[2].y}, ${e[3].x} ${e[3].y}`).join(``),points:d(p),labels:[.5,.4,.6,.3,.7,.2,.8,.35,.45,.55,.65,.25,.75,.15,.85].map(e=>{let t=Math.min(p.length-1,Math.floor(e*p.length));return Th(p[t],e*p.length-t)})}}var kh=new WeakMap,Ah=.5,jh=.05;function Mh(e){return e>=Ah?Math.max(Ah,Math.floor(e*8)/8):ee+(/[^\x00-\x7F]/.test(t)?10.5:7),20);return{width:Math.min(t,216),height:26}}function Fh(e,t){let n=e.getState(),r=[...n.nodeLookup.values()].filter(e=>!e.hidden).map(e=>({id:e.id,...e.internals.positionAbsolute,width:e.width||e.measured.width||0,height:e.height||e.measured.height||0}));function i(e,t){let r=n.nodeLookup.get(e);if(!r)return null;let{x:i,y:a}=r.internals.positionAbsolute,o=r.width||r.measured.width||0,s=r.height||r.measured.height||0;return{x:i+(t===`left`?0:t===`right`?o:o/2),y:a+(t===`top`?0:t===`bottom`?s:s/2)}}let a=n.edges.filter(e=>!e.hidden).map(e=>({...e,s:i(e.source,e.sourceHandle),t:i(e.target,e.targetHandle)})),o=JSON.stringify([r,a.map(e=>[e.id,e.s,e.t,e.label,e.data?.lane,e.sourceHandle,e.targetHandle,e.className])]),s=kh.get(e);if(!s||s.key!==o){let t=new Map,n=new Map;for(let e of a)n.set(e.id,/(?:^|\s)map-edge-(\w+)/.exec(e.className??``)?.[1]),e.s&&e.t&&t.set(e.id,Oh(e.s,e.t,e.source===e.target?`loop`:e.sourceHandle===`left`?`left`:e.sourceHandle===`top`?`up`:e.sourceHandle===`bottom`,Number(e.data?.lane||0),r.filter(t=>t.id!==e.source&&t.id!==e.target)));s={key:o,routes:t,kinds:n,zoom:-1,labels:new Map},kh.set(e,s)}let c=Mh(t);return s.zoom!==c&&(s.zoom=c,s.labels=new Map,c&&Ih(s,a,r,c)),s}function Ih(e,t,n,r){let i=[...n],a=e=>+!!e.data?.quiet;for(let n of[...t].sort((e,t)=>a(e)-a(t))){let t=e.routes.get(n.id);if(!t||!n.label)continue;let a=Ph(n.label),o=a.width/r,s=a.height/r,c=[0,3,4,5,6][Number(n.data?.lane||0)%5],l=[t.labels[c],...t.labels.filter((e,t)=>t!==c)].filter(e=>i.every(t=>e.x+o/2<=t.x||e.x-o/2>=t.x+t.width||e.y+s/2<=t.y||e.y-s/2>=t.y+t.height)),u,d=1/0;for(let t of l){let r={x:t.x-o/2,y:t.y-s/2,width:o,height:s},i=0;for(let[t,a]of e.routes)t!==n.id&&a.points.some(e=>Dh(e,r))&&i++;if(ie),a=(0,X.useId)().replace(/:/g,``),o=`relation-arrow-${a}`,s=`relation-flow-${a}`,c=Fh(Fu(),i),l=c.routes.get(e),u=c.labels.get(e);if(!l)return null;let d=c.kinds.get(e),f=d===`fanout`||d===`fanin`,p=!d||n?.stroke===Lh?n?.stroke||`#7594ad`:`var(--map-edge-${d}, ${n?.stroke||`#7594ad`})`,m=(Number(n?.strokeWidth||2)+(f?.4:0))/i,h=f?Eh(l.points,(d===`fanout`?2:15)/i,d===`fanin`):null,g=typeof t==`string`?Nh(t):void 0,_=l.points[0],v=l.points[l.points.length-1],y=!!_&&!!v&&n?.stroke!==Lh&&(Math.abs(_.x-v.x)>1||Math.abs(_.y-v.y)>1),b=!f&&!n?.strokeDasharray,x=b?wh(l.points,Number(n?.strokeWidth||2)*1.45/i,16/i):``;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`defs`,{children:[(0,Y.jsx)(`marker`,{id:o,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:9/i,markerHeight:9/i,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,Y.jsx)(`path`,{d:`M 0.6 0.9 L 9.6 5 L 0.6 9.1 L 3 5 z`,style:{fill:p}})}),y&&(0,Y.jsxs)(`linearGradient`,{id:s,gradientUnits:`userSpaceOnUse`,x1:_.x,y1:_.y,x2:v.x,y2:v.y,children:[(0,Y.jsx)(`stop`,{offset:`0`,style:{stopColor:p,stopOpacity:b?.34:.28}}),(0,Y.jsx)(`stop`,{offset:`0.55`,style:{stopColor:p,stopOpacity:b?.7:.78}}),(0,Y.jsx)(`stop`,{offset:`1`,style:{stopColor:p,stopOpacity:1}})]})]}),(0,Y.jsxs)(Em,{path:l.path,delay:r?.growthDelay,padding:24/i,children:[(0,Y.jsx)(Vf,{id:e,path:l.path,markerEnd:x?void 0:`url(#${o})`,style:{...n,stroke:x?`transparent`:y?`url(#${s})`:p,strokeLinecap:`round`,vectorEffect:`none`,strokeWidth:m,strokeDasharray:n?.strokeDasharray?String(n.strokeDasharray).split(/[\s,]+/).map(e=>Number(e)/i).join(` `):void 0}}),x&&(0,Y.jsx)(`path`,{className:`map-edge-ink`,d:x,style:{fill:y?`url(#${s})`:p,opacity:n?.opacity},"aria-hidden":`true`}),!f&&_&&(0,Y.jsx)(`circle`,{className:`map-edge-anchor`,cx:_.x,cy:_.y,r:(x?2.1:2.6)/i,style:x?{fill:p,opacity:Number(n?.opacity??1)*.62}:{fill:`var(--map-paper)`,stroke:p,strokeWidth:1.4/i,opacity:n?.opacity},"aria-hidden":`true`}),h&&(0,Y.jsx)(`circle`,{className:`map-edge-joint`,cx:h.x,cy:h.y,r:3.2/i,style:{fill:p,opacity:n?.opacity},"aria-hidden":`true`})]}),(r?.active&&!r.muted||r?.lit)&&(0,Y.jsx)(Hp,{children:(0,Y.jsx)(`div`,{className:`map-edge-spark`,"data-lit":!r?.active&&!!r?.lit,"aria-hidden":`true`,style:{offsetPath:`path("${l.path}")`,width:8/i,height:8/i,margin:`${-4/i}px 0 0 ${-4/i}px`,animationDelay:`${-((e.charCodeAt(0)*131+e.length*47)%2800)}ms`}})}),t&&g!==``&&u&&(0,Y.jsx)(Hp,{children:(0,Y.jsx)(`div`,{className:`map-relation-label nodrag nopan`,"data-kind":d,"data-lit":!!r?.lit,"data-quiet":!!r?.quiet,title:g,style:{opacity:r?.quiet&&!r.lit?0:n?.opacity,pointerEvents:r?.quiet&&!r.lit?`none`:void 0,transform:`translate(-50%, -50%) translate(${u.x}px, ${u.y}px) scale(${1/i})`},children:g??t})})]})}function zh({open:e,info:t,zh:n,onChoose:r,readOnly:i=!1}){return(0,Y.jsx)(E,{open:e,onClose:()=>r({mode:`off`}),label:n?`选择地图加载范围`:`Choose map history`,width:`max-w-lg`,children:(0,Y.jsxs)(`div`,{className:`map-history-choice`,children:[(0,Y.jsx)(`h2`,{children:n?`选择地图加载范围`:`Choose map history`}),(0,Y.jsx)(`p`,{children:n?`本会话有 ${t.task_count} 个任务,历史记录约 ${(t.event_bytes/1024/1024).toFixed(1)} MB。`:`This session has ${t.task_count} tasks and about ${(t.event_bytes/1024/1024).toFixed(1)} MB of history.`}),(0,Y.jsx)(`p`,{children:i?n?`只读模式只加载历史记录,不调用模型。较长历史需要一些加载时间。`:`Read-only mode loads records without model calls. Long histories take time to load.`:n?`加载较长历史需要一些时间。生成卡片摘要与关系说明会调用已配置的模型,并消耗额外 Token。已有摘要会优先复用。`:`Loading a long history takes time. Card summaries and relationship descriptions use your configured model and consume additional tokens. Existing summaries are reused.`}),(0,Y.jsxs)(`div`,{className:`map-history-options`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`current`,since:t.current_task_ts,eventSince:t.current_event_ts,taskId:t.current_task_id||void 0}),children:[(0,Y.jsx)(`strong`,{children:n?`从当前进度加载`:`Start at current progress`}),(0,Y.jsx)(`span`,{children:n?`推荐 · 加载当前任务及后续进度,保留相关连接`:`Recommended · Load current and future work with its connections`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`full`}),children:[(0,Y.jsx)(`strong`,{children:n?`从头加载`:`Load from the beginning`}),(0,Y.jsx)(`span`,{children:i?n?`分批加载历史记录,查看已有说明`:`Load history in pages and view existing explanations`:n?`分批加载历史记录;打开卡片阅读时,再整理它的说明`:`Load history in pages; prepare an explanation when you open a card to read`})]}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r({mode:`off`}),children:[(0,Y.jsx)(`strong`,{children:n?`不开启地图模式`:`Keep map mode off`}),(0,Y.jsx)(`span`,{children:n?`不加载地图,也不生成摘要`:`Do not load the map or generate summaries`})]})]}),(0,Y.jsx)(`small`,{children:n?`选择仅用于本会话,可随时更改加载范围。`:`This choice applies to this session and can be changed later.`})]})})}function Bh(e){try{let t=JSON.parse(e||`null`);return!t||![`full`,`current`,`off`].includes(t.mode)||t.mode===`current`&&![t.since,t.eventSince].every(e=>typeof e==`number`&&Number.isFinite(e)&&e>=0)?null:t}catch{return null}}function Vh(e,t){if(!e||e.id!==t.id||t.reset_history)return t;let n=new Map((!t.incremental||t.tasks_complete?[]:e.tasks).map(e=>[e.id,e]));for(let e of t.tasks)n.set(e.id,e);for(let e of t.removed_task_ids||[])n.delete(e);let r=new Map(e.events.filter(e=>t.incremental&&!t.team_events_complete||e.type!==`team.task`).map(e=>[e.id,e]));for(let e of t.events)r.set(e.id,e);for(let e of t.removed_event_ids||[])r.delete(e);return a(e,{...e,...t,tasks:[...n.values()].sort((e,t)=>(e.ts||0)-(t.ts||0)||e.id.localeCompare(t.id)),events:[...r.values()].filter(e=>n.has(e.item_id))})}function Hh(e,t,n){return e?t?.history_loading?400:!Uh(n)||t?.events.some(e=>e.type===`team.task`&&Te.has(e.status||``))?15e3:!1:!1}function Uh(e){return e.manager_requests?.some(e=>e.status===`running`)?!1:!e.daemon.alive||e.continuous?.enabled===!1&&/pause|stop/i.test(e.continuous.done_reason||``)?!0:e.daemon.health?.state===`stopped`}var Wh=new Map;function Gh(e){let t=Wh.get(e);if(t)return t;try{let t=JSON.parse(B(`argus.map.camera.v1:`+e)||`null`);if(t&&[t.viewport,t.overview].every(e=>e&&[e.x,e.y,e.zoom].every(Number.isFinite)&&e.zoom>=.035&&e.zoom<=3.5)&&(t.focusId===null||typeof t.focusId==`string`)&&typeof t.detailed==`boolean`)return{camera:t}}catch{}return{}}function Kh(e,t){for(Wh.delete(e),Wh.set(e,t);Wh.size>8;)Wh.delete(Wh.keys().next().value);t.camera&&z(`argus.map.camera.v1:`+e,JSON.stringify(t.camera))}var qh={task:Rm,branch:Zm},Jh={relation:Rh},Yh={done:`#a9c4b6`,running:`#9fb6cc`,question:`#dcc797`,failed:`#d9a79f`,review_unavailable:`#cdbba3`,held:`#cdbba3`,paused:`#cdbba3`,superseded:`#c5bdcd`,aborted:`#c6c8cb`,skipped:`#c6c8cb`,missing:`#c6c8cb`};function Xh({events:e,zh:t}){let n=[...new Map(e.filter(e=>e.type===`team.task`).map(e=>[e.id,e])).values()];if(!n.length)return null;let r=n.filter(e=>e.status===`done`).length,i=n.filter(e=>Te.has(e.status||``)).length,a=n.filter(e=>e.status===`failed`).length;return(0,Y.jsxs)(`div`,{className:`map-team-progress`,role:`status`,"aria-label":t?`子任务进度`:`Subtask progress`,children:[(0,Y.jsx)(`strong`,{children:t?`子任务`:`Subtasks`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(_,{size:12}),(0,Y.jsxs)(`b`,{children:[r,`/`,n.length]}),` `,t?`已完成`:`completed`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:i}),` `,t?`进行中`:`running`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{children:a}),` `,t?`失败`:`failed`]})]})}function Zh({data:e,zh:t,composer:n,activePhase:r,waiting:s,snapshot:l,currentTaskId:u,events:d,pendingLabel:f,readOnly:p,sessionId:m,viewKey:h,paused:g,actions:_,replacements:v}){let[b,x]=(0,X.useState)(!1),[S,w]=(0,X.useState)(()=>e.kind===`live`&&!p&&_.conversationEvents.some(e=>e.type===`ui.operator`||e.type===`ui.argus`)),O=[..._.conversationEvents].reverse().find(e=>e.type===`ui.operator`),k=O?String(O.message_id||O.ts||``):``,ee=(0,X.useRef)(k),L=(0,X.useRef)(n.pending);(0,X.useEffect)(()=>{e.kind===`live`&&!p&&(k&&k!==ee.current||n.pending&&!L.current)&&(w(!0),x(!1)),ee.current=k,L.current=n.pending},[k,n.pending,e.kind,p]);let[R,z]=(0,X.useState)(()=>new Set),B=(0,X.useCallback)(e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[V,H]=(0,X.useState)(null),U=(0,X.useRef)(0),re=(0,X.useRef)(!0);(0,X.useEffect)(()=>(re.current=!0,()=>{re.current=!1}),[]);let K=(0,X.useMemo)(()=>we(e.tasks),[e.tasks]),[de,fe,pe]=Up([]),he=(0,X.useRef)(null),q=dh(he,!p),_e=Gp(),ve=(0,X.useRef)(!1),[ye,xe]=(0,X.useState)(!1),Se=(0,X.useRef)(null);Se.current||=Gh(h);let[Ce,Ae]=(0,X.useState)(()=>{let e=Se.current?.scene?.cards.find(e=>e.id===Se.current?.camera?.focusId);return new Set(e&&e.id!==e.task.id?[e.task.id]:[])}),[je,Me]=(0,X.useState)(null),[Ne]=(0,X.useState)(()=>new Set(Se.current?.scene?.cards.map(e=>e.id))),Pe=de.find(e=>e.id===q.focusId),Ie=(0,X.useMemo)(()=>ce(e.tasks,e.events),[e.tasks,e.events]),Le=et(m,t?`zh-CN`:`en-US`),[Be,Ve]=(0,X.useState)(null),Ue=(0,X.useCallback)((t,n)=>{Ve(r=>n?{nodeId:t,key:n,foundationId:Le.id}:r?.nodeId===t&&!e.tasks.some(e=>e.id===r.key)?null:r)},[e.tasks,Le.id]);(0,X.useEffect)(()=>{Ve(t=>t&&(t.nodeId===q.focusId||e.tasks.some(e=>e.id===t.key))?t:null)},[q.focusId,e.tasks]);let J=Be?e.tasks.find(e=>e.id===Be.key):void 0,Ge=J?.turn_kind===`qa`?e.events.find(e=>e.item_id===J.id&&e.type===`turn.replied`):void 0,Je=Be?de.find(e=>e.id===Be.nodeId):void 0,Ye=J?.id??(Be?.nodeId===q.focusId?Be.key:null),Xe=(0,X.useMemo)(()=>oe(e.tasks),[e.tasks]),Ze=Xe.findIndex(e=>e.id===Pe?.data.task.id),[Qe,tt]=(0,X.useState)(null),nt=K.tasks.find(e=>e.id===Qe),rt=(0,X.useMemo)(()=>nt?ke(K,nt.id):null,[K,nt]),it=(0,X.useMemo)(()=>nt&&rt?new Set([nt.id,...rt.upstream.map(e=>e.id),...rt.downstream.map(e=>e.id)]):null,[nt,rt]),{copy:at,ready:ot,generating:st,readingRequest:ct,readingNeedsUpdate:lt,readingGenerating:ut,generationPhase:pt,foundationRequired:mt,questionContext:ht,generationError:gt,generationUnavailable:vt,retry:bt}=hh(e,J?.id||Pe?.data.task.id||null,t,!p&&!e.history_loading,Pe?.data.layout.steps,m,!1,Ye,Be?.foundationId),xt=(0,X.useMemo)(()=>ct?{request:ct,questionContext:ht,pending:lt,generating:ut,phase:pt,error:gt,unavailable:vt,foundationRequired:mt,retry:p?void 0:bt,retryDisabled:st}:void 0,[ct,ht,lt,st,ut,pt,gt,vt,p,bt,mt]),St=(0,X.useMemo)(()=>Re(Ee(K,at?.relations||[],t)),[K,at?.relations,t]),Ct=xh(e,t,!p&&!e.history_loading,m),wt=_h(e,St,t,!p&&!e.history_loading,m),Tt=(0,X.useMemo)(()=>Ee(K,at?.relations||[],t,wt),[K,at?.relations,t,wt]),Dt=(0,X.useRef)(Se.current.scene),kt=(q.canvasSize.width||window.innerWidth)<640,Z=(0,X.useMemo)(()=>{let n=me(K,e.events,t,Dt.current,Tt,Ce,kt);return Dt.current=a(Dt.current,n),Dt.current},[K,e.events,t,Tt,Ce,kt]),At=(0,X.useRef)(null),jt=(0,X.useMemo)(()=>(At.current=a(At.current,le(Oe(K,e.events,t,48),R,t)),At.current),[K,e.events,t,R]),Mt=(0,X.useRef)(null),Pt=(0,X.useMemo)(()=>{let e=jt.tasks.filter(e=>e.branch);if(!e.length)return{links:Z.links,positions:Z.positions,frames:Z.frames,structure:Z.structure,branches:e,branchAnchor:new Map};let t=new Map;for(let e of Z.cards)t.set(e.task.id,e.id);let n=new Map(e.map(e=>[e.id,t.get(e.parent_id)??e.parent_id])),r={...Z.frames};for(let t of e)r[t.id]={...t.group?qm:Km,scale:1};let i=[...Z.links,...jt.links.filter(e=>e.kind===`fanout`||e.kind===`fanin`).map(e=>({...e,source:t.get(e.source)??e.source,target:t.get(e.target)??e.target}))],a=new Map;for(let t of e){let e=n.get(t.id);a.set(e,[...a.get(e)??[],t.id])}let o=Z.cards.flatMap(e=>[e.id,...a.get(e.id)??[]]),s=JSON.stringify([o.map(e=>[e,r[e].width,r[e].height]),i.map(e=>[e.source,e.target,e.kind])]),c=Mt.current?.structure===s?Mt.current.positions:dt(o,i,r);return Mt.current={structure:s,positions:c},{links:i,positions:c,frames:r,structure:s,branches:e,branchAnchor:n}},[Z,jt]),It=Vt(Pt.positions,q.reducedMotion),[Rt,zt]=(0,X.useState)(null),Bt=(0,X.useMemo)(()=>Ut(Pt.links,Rt),[Pt.links,Rt]),[Ht,Gt]=(0,X.useState)(!1),[qt,Jt]=(0,X.useState)(!1),Yt=(0,X.useMemo)(()=>new Map(Z.cards.map(e=>[e.id,e.ordinal])),[Z.cards]),Xt=Lt(Z,!!e.history_loading),Zt=(0,X.useMemo)(()=>$e(e.events),[e.events]),Qt=async(e,t=[],r,i)=>{if(i?.whileRunning)return n.onSend(e,t,void 0,i);let a=++U.current,o=he.current?.querySelector(`.map-composer`)?.getBoundingClientRect();H({id:a,text:Ke(e).text.replace(/\s+/g,` `).slice(0,180),origin:{x:o?.left??20,y:o?.top??innerHeight-100,width:o?.width??260,height:o?.height??56}});let s=!1,c=e=>{e.type===`task`&&(s=!0),re.current&&e.type===`settled`&&e.outcome===`message`&&!s&&(w(!0),x(!1)),re.current&&H(t=>t?.id===a?{...t,result:e}:t)};try{let r=await n.onSend(e,t,c);return r&&re.current&&Ke(e).refs.length>0&&(w(!0),x(!1)),r||c({type:`settled`,outcome:`error`}),r}catch(e){throw c({type:`settled`,outcome:`error`}),e}},$t=()=>{H(e=>e?{...e,result:{type:`settled`,outcome:`cancelled`}}:null),n.onCancel()};(0,X.useEffect)(()=>{if(!_e||ve.current||!ot||Se.current?.camera&&e.history_loading)return;let t=requestAnimationFrame(()=>{if(ve.current=!0,Se.current?.camera)q.restore(Se.current.camera);else if(q.fit(),e.kind===`live`&&he.current.clientWidth<640){let t=ae(e.tasks);t&&q.fit(new Set([t.id]))}xe(!0)});return()=>cancelAnimationFrame(t)},[_e,q.fit,q.enter,q.restore,e.kind,e.tasks,Z.cards,e.history_loading,ot]),(0,X.useEffect)(()=>{let e=he.current;if(!e||q.reducedMotion)return;let t=null,n=n=>{t??=requestAnimationFrame(()=>{t=null;let r=e.getBoundingClientRect();!r.width||!r.height||(e.style.setProperty(`--lean-x`,((n.clientX-r.left)/r.width-.5).toFixed(3)),e.style.setProperty(`--lean-y`,((n.clientY-r.top)/r.height-.5).toFixed(3)))})},r=()=>{e.style.setProperty(`--lean-x`,`0`),e.style.setProperty(`--lean-y`,`0`)};return e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,r),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,r)}},[q.reducedMotion]),(0,X.useEffect)(()=>{if(!ye||Se.current?.camera||q.reducedMotion)return;Gt(!0);let e=window.setTimeout(()=>Gt(!1),Wt);return()=>window.clearTimeout(e)},[ye,q.reducedMotion]),(0,X.useEffect)(()=>{let e=()=>{ve.current&&Kh(h,{scene:Dt.current,camera:q.capture()})};return window.addEventListener(`pagehide`,e),()=>{e(),window.removeEventListener(`pagehide`,e)}},[h,q.capture]),(0,X.useEffect)(()=>{if(!_e)return;let e=requestAnimationFrame(q.fitUpdatedScene);return()=>cancelAnimationFrame(e)},[Pt.structure,_e,q.fitUpdatedScene]);let en=(0,X.useRef)(n);en.current=n;let tn=(0,X.useCallback)(e=>{if(p)return;let t=en.current;t.onChange(ne(e)+t.value),window.setTimeout(()=>document.querySelector(`.map-composer textarea`)?.focus(),0)},[p]),[nn,rn]=(0,X.useState)(null),an=o(),on=i({queryKey:[`map-notes`,m],queryFn:({signal:e})=>c.mapNotes(m,e),enabled:e.kind===`live`&&!p,staleTime:6e4}),sn=(0,X.useMemo)(()=>({notes:Gm(on.data?.notes??[])}),[on.data]),[cn,ln]=(0,X.useState)(null),[un,dn]=(0,X.useState)(``),[fn,pn]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!cn)return;let e=e=>{e.target.closest(`.map-note-editor`)||ln(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),ln(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[cn]);let mn=async()=>{let e=cn,t=un.trim();if(!(!e||!t)){pn(!1);try{await c.addMapNote(m,{node_id:e.ref.task_id,text:t}),await an.invalidateQueries({queryKey:[`map-notes`,m]}),ln(null),dn(``)}catch{pn(!0)}}},hn=(0,X.useCallback)((e,t)=>{p||rn({ref:e,x:Math.min(window.innerWidth-180,t.x),y:Math.min(window.innerHeight-140,t.y)})},[p]);(0,X.useEffect)(()=>{if(!nn)return;let e=e=>{e.target.closest(`.map-context-menu`)||rn(null)},t=e=>{e.key===`Escape`&&(e.stopPropagation(),rn(null))};return window.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t,!0)}},[nn]);let[gn,_n]=(0,X.useState)(``),vn=(0,X.useCallback)(e=>`${e.task.title} ${e.task.objective??``} ${at?.cards[e.task.id]?.title||``} ${at?.cards[e.task.id]?.summary||``} ${Ct[e.task.id]?.title||``} ${Ct[e.task.id]?.summary||``} ${e.part>1?t?`续篇 ${e.part-1}`:`Continued ${e.part-1}`:``}`.toLowerCase(),[at,Ct,t]),yn=(0,X.useMemo)(()=>gn?Z.cards.filter(e=>vn(e).includes(gn.toLowerCase())):[],[gn,Z.cards,vn]),bn=yn.findIndex(e=>e.id===q.focusId),[xn,Sn]=(0,X.useState)(K.tasks.length),[Cn,wn]=(0,X.useState)(!1),[Tn,En]=(0,X.useState)(!1),Dn=v?.shown??Tn,On=v?.toggle??(()=>En(e=>!e)),[kn,An]=(0,X.useState)(``),jn=(0,X.useCallback)(e=>{if(tt(e),_n(``),An(``),e){let{upstream:t,downstream:n}=ke(K,e);q.fit(new Set([e,...t.map(e=>e.id),...n.map(e=>e.id)]))}else q.fit()},[q.fit,K]),Mn=(0,X.useCallback)((e,t=!1)=>{let n=Dt.current?.allCards.find(t=>t.id===e);if(n&&!Ce.has(n.task.id)&&(t||e!==n.task.id)){Ae(e=>new Set([...e,n.task.id])),Me(e);return}nt&&n?jn(n.task.id===nt.id?null:n.task.id):q.enter(e)},[q.enter,nt,jn,Ce]),Nn=(0,X.useCallback)(e=>{let t=Ce.has(e);if(Ae(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),Pe?.data.task.id===e){let n=Dt.current?.allCards.filter(t=>t.task.id===e).at(-1);Me(t?e:n?.id??e)}},[Ce,Pe?.data.task.id]);(0,X.useEffect)(()=>{!je||!de.some(e=>e.id===je)||(q.enter(je),Me(null))},[je,de,q.enter]);let Pn=(0,X.useCallback)(()=>{tt(null),An(``),q.fit()},[q.fit]);(0,X.useEffect)(()=>{fe(n=>a(n,Z.cards.map(n=>({id:n.id,type:`task`,position:It[n.id]??Z.positions[n.id],width:Z.frames[n.id].width,height:Z.frames[n.id].height,style:{width:Z.frames[n.id].width,height:Z.frames[n.id].height},data:{...n,zh:t,open:Mn,toggleHistory:Nn,readStep:q.readStep,readCopy:Ue,menu:hn,quote:tn,source:e.id,readOnly:p,live:e.kind===`live`,paused:g,seenCards:Ne,restoring:!!Se.current?.camera&&!ve.current,layout:Z.layouts[n.id],frame:Z.frames[n.id],plannedWidth:Zt.get(n.task.id),focused:!1,detailed:!1}}))))},[K,Z,Pt,It,t,fe,Mn,Nn,q.readStep,Ue,hn,tn,e.id,e.kind,p,g,Ne,Zt]),(0,X.useEffect)(()=>{Sn(e=>Math.min(Math.max(e,1),K.tasks.length))},[K.tasks.length]),(0,X.useEffect)(()=>{if(!Cn||q.detailed)return;let e=window.setInterval(()=>Sn(e=>e>=K.tasks.length?(wn(!1),e):e+1),900);return()=>window.clearInterval(e)},[Cn,K.tasks.length,q.detailed]),(0,X.useEffect)(()=>{if(!qt||Cn||xnJt(!1),1400);return()=>window.clearTimeout(e)},[qt,Cn,xn,K.tasks.length]);let Fn=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(t=>e.kind===`live`&&!qt||t.ordinal<=xn).map(e=>e.id));for(let[e,n]of Pt.branchAnchor)t.has(n)&&t.add(e);return t},[Z.cards,xn,e.kind,qt,Pt.branchAnchor]),In=(0,X.useRef)([]),Ln=(0,X.useMemo)(()=>{let e=de.map(e=>({...e,hidden:!Fn.has(e.id),data:{...e.data,copy:at?{version:at.version,cards:Object.fromEntries([e.data.task.id,...e.data.layout.steps.map(e=>e.id)].filter(e=>at.cards[e]).map(e=>[e,at.cards[e]]))}:void 0,words:Ct[e.data.task.id],readerCopy:Be?.nodeId===e.id?xt:void 0,focused:e.id===q.focusId,detailed:q.detailed&&e.id===q.focusId,canvasSize:q.canvasSize,lit:Bt.nodes.has(e.id),hovered:e.id===Rt,arriving:Ht,revealing:qt,phase:r&&Te.has(e.data.task.status)?r:void 0,waiting:s&&s.taskId===e.data.task.id?s.sentence:void 0,growthDelay:Xt.cards[e.id],dispatchState:V?.result?.type===`task`&&V.result.taskId===e.data.task.id&&!n.historical?V.landed?`landed`:`receiving`:void 0,growingSteps:Object.fromEntries(e.data.layout.steps.flatMap(t=>{let n=Xt.steps[Ft(e.id,t.id)];return n==null?[]:[[t.id,n]]})),growingLinks:Object.fromEntries(e.data.layout.links.flatMap(t=>{let n=Xt.links[Ft(e.id,t.id)];return n==null?[]:[[t.id,n]]}))},style:{...e.style,opacity:it&&!it.has(e.data.task.id)||gn&&!vn(e.data).includes(gn.toLowerCase())?.22:1}}));return In.current=a(In.current,e),In.current},[de,Fn,q.focusId,q.detailed,q.canvasSize,gn,vn,at,Ct,Be,xt,t,Xt,V,n.historical,it,Bt,Rt,Ht,qt,r,s]),Rn=(0,X.useRef)([]),zn=(0,X.useMemo)(()=>{let e=new Map;for(let t of Pt.branches){if(t.group)continue;let n=t.parent_id??``;e.set(n,(e.get(n)??0)+1)}let n=new Map,r=Pt.branches.map(r=>{let i=r.parent_id??``,a=Pt.frames[r.id],o=r.group?void 0:(n.get(i)??0)+1;return o!==void 0&&n.set(i,o),{id:r.id,type:`branch`,position:It[r.id]??{x:0,y:0},width:a.width,height:a.height,style:{width:a.width,height:a.height,opacity:it&&!it.has(i)?.22:1},hidden:!Fn.has(r.id),draggable:!1,selectable:!1,focusable:!1,data:{task:r,zh:t,parentCardId:Pt.branchAnchor.get(r.id),open:Mn,toggleGroup:B,fanIndex:o,fanCount:o===void 0?void 0:e.get(i)}}});return Rn.current=a(Rn.current,r),Rn.current},[Pt,It,Fn,t,Mn,B,it]),Bn=(0,X.useMemo)(()=>zn.length?[...Ln,...zn]:Ln,[Ln,zn]),Vn=(0,X.useMemo)(()=>{let n=Pt.links.filter(e=>Fn.has(e.source)&&Fn.has(e.target)&&(e.kind!==`replacement`||Dn)),r=be(n),i=new Map(Z.cards.map(e=>[e.id,e.task])),a=new Set;if(e.kind===`live`&&!g){for(let e of Z.cards)Te.has(e.task.status)&&a.add(e.id);for(let e of Pt.branches)Te.has(e.status)&&a.add(e.id)}return n.map((e,n)=>{let o=e.kind===`fanout`||e.kind===`fanin`,s=i.get(e.source)?.id,c=i.get(e.target)?.id,l=!!nt&&e.kind===`dependency`&&(s===nt.id||c===nt.id),u=!!nt&&!l&&(e.kind!==`continuation`||s!==nt.id);return{id:e.id,source:e.source,target:e.target,...te({...It[e.source],...Pt.frames[e.source]},{...It[e.target],...Pt.frames[e.target]}),type:`relation`,data:{growthDelay:Xt.links[e.id]??(Ht?Kt(Yt.get(e.source)??1):qt&&Yt.get(e.target)===xn?120:void 0),active:a.has(e.target),lit:Bt.edges.has(e.id),lane:r[n],muted:u,quiet:!e.stated&&(e.kind===`context`||e.kind===`dependency`&&!e.label)},className:`map-edge-${e.kind}${Bt.edges.has(e.id)?` is-lit`:``}`,label:o?void 0:e.label||(e.kind===`replacement`?(i.get(e.source)?.superseded_reason||``).replace(/\s+/g,` `).slice(0,60)||(t?`转入新计划`:`New plan`):e.kind===`dependency`?t?`依赖`:`Dependency`:t?`同一研究`:`Related work`),labelStyle:{fontSize:30,fill:e.kind===`replacement`?`#95809f`:`#6685a4`},labelBgPadding:[12,6],labelBgBorderRadius:12,labelBgStyle:{fill:`var(--map-paper)`,fillOpacity:.96},style:{opacity:u?.12:1,stroke:e.cycle?`#dc6648`:e.kind===`replacement`?`#a48caf`:e.kind===`dependency`?`#527fa7`:`#7594ad`,strokeWidth:l?2.6:e.kind===`dependency`?2:o?1.1:1.6,vectorEffect:`non-scaling-stroke`,strokeDasharray:e.kind===`dependency`||e.kind===`context`||e.kind===`continuation`||o?void 0:`5 6`},markerEnd:{type:Hs.ArrowClosed,color:e.kind===`replacement`?`#a48caf`:`#8aa5b8`,width:32,height:32},ariaLabel:e.evidence||(o?`Team branch: ${e.source} → ${e.target}`:e.kind===`dependency`?`Dependency: ${e.source} → ${e.target}`:`Plan replacement: ${e.source} → ${e.target_plan_id} (${e.target_count} tasks, representative ${e.target})`)}})},[Pt,Fn,Dn,t,Xt,e.kind,g,Z.cards,nt,It,Bt,Ht,qt,xn,Yt]),Hn=K.links.filter(e=>e.kind===`replacement`).length,Un=(0,X.useMemo)(()=>{let t=new Set(Z.cards.filter(e=>e.completionScope).map(e=>e.task.id)),n={done:0,ended:0,running:0,question:0,review_unavailable:0,held:0,failed:0,other:0};for(let r of e.tasks)t.has(r.id)?n.ended++:r.status===`done`?n.done++:Te.has(r.status)?n.running++:r.pending_question?n.question++:De(r)===`review_unavailable`?n.review_unavailable++:De(r)===`held`?n.held++:r.status===`failed`?n.failed++:n.other++;return n},[e.tasks,Z.cards]),Wn=Un.done,Gn=(0,X.useCallback)(e=>at?.cards?.[`${e.id}:outcome`]?.summary||``,[at]),Kn=(0,X.useMemo)(()=>e.tasks.some(e=>e.turn_kind!==`qa`&&e.kind!==`turn`)?ie(e.tasks,e.events,t,Gn):null,[e.tasks,e.events,t,Gn]),qn=He(l,l.mission_view,d),Jn=Fe(qn,l.mission_view,d,t?`zh-CN`:`en`,_.connected,We(l,l.mission_view,qn.taskId)),Yn=e=>{tt(null),An(``),Sn(t=>Math.max(t,Z.cards.find(t=>t.id===e)?.ordinal||1)),q.enter(e)},Xn=()=>{let e=Z.cards.filter(e=>e.task.id===Ie?.id).at(-1);e&&(Ve(null),Yn(e.id))},Zn=()=>{let n=ae(e.tasks);n?(Yn(Z.cards.filter(e=>e.task.id===n.id).at(-1).id),An(``)):An(t?`发送一个目标,地图就会开始生长`:`Send a goal to start your map`)},Qn=()=>{let e=Xe[(Ze+1)%Xe.length];e&&Yn(Z.cards.filter(t=>t.task.id===e.id).at(-1).id)};(0,X.useEffect)(()=>{let e=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.isComposing)&&!e.target?.closest(`input, textarea, select, [contenteditable], [role="dialog"]`)){if(e.key===`/`)e.preventDefault(),he.current?.querySelector(`.map-search input`)?.focus();else if(e.key===`f`||e.key===`F`)Pn();else if((e.key===`ArrowRight`||e.key===`ArrowLeft`)&&q.detailed&&q.focusId){let t=Z.cards.filter(e=>Fn.has(e.id)),n=t.findIndex(e=>e.id===q.focusId);if(n<0)return;let r=t[n+(e.key===`ArrowRight`?1:-1)];r&&(e.preventDefault(),q.enter(r.id))}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Pn,q.enter,q.detailed,q.focusId,Z.cards,Fn]);let $n=(0,X.useMemo)(()=>({artifacts:_.artifacts,onOpenArtifact:_.onOpenArtifact}),[_.artifacts,_.onOpenArtifact]),er=(0,Y.jsxs)(`div`,{className:`map-playback`,"data-floating":e.kind===`live`,children:[(0,Y.jsx)(`button`,{"aria-label":Cn?`Pause reveal`:`Play reveal`,onClick:()=>{xn>=K.tasks.length&&Sn(1),wn(e=>!e)},children:Cn?(0,Y.jsx)(P,{size:14}):(0,Y.jsx)(I,{size:14})}),(0,Y.jsx)(`button`,{"aria-label":`Restart reveal`,onClick:()=>{wn(!1),Sn(1),e.kind!==`live`&&q.back()},children:(0,Y.jsx)(F,{size:13})}),(0,Y.jsx)(`span`,{children:t?`逐卡展开`:`Reveal cards`}),(0,Y.jsx)(`input`,{"aria-label":`Visible task count`,type:`range`,min:Math.min(1,K.tasks.length),max:K.tasks.length,value:xn,onChange:e=>{wn(!1),Sn(Number(e.target.value))}}),(0,Y.jsxs)(`span`,{className:`map-count`,children:[xn,` / `,K.tasks.length]}),(0,Y.jsx)(`button`,{"aria-label":`Reveal next card`,disabled:xn>=K.tasks.length,onClick:()=>Sn(e=>Math.min(K.tasks.length,e+1)),children:(0,Y.jsx)(se,{size:14})}),(0,Y.jsx)(`small`,{children:t?`时间顺序`:`Chronological order`}),e.kind===`live`&&(0,Y.jsx)(`button`,{className:`map-replay-exit`,"aria-label":t?`回到当前`:`Back to the present`,title:t?`回到当前`:`Back to the present`,onClick:()=>{wn(!1),Jt(!1),Sn(K.tasks.length)},children:(0,Y.jsx)(y,{size:14})})]});return(0,Y.jsx)(Hm.Provider,{value:q.zoomSteps,children:(0,Y.jsx)(km.Provider,{value:sn,children:(0,Y.jsxs)(Am.Provider,{value:$n,children:[at?.generation_error&&(0,Y.jsxs)(`div`,{role:`status`,className:`map-paused-label`,children:[t?`地图说明暂时不可用,任务和已有说明仍可阅读。`:`Map explanation unavailable; tasks and saved explanations remain readable.`,at.generation_error.code===`cost_unreconciled`&&(t?` 调用费用待对账,并非预算耗尽。`:` Provider usage awaits reconciliation, not budget exhaustion.`)]}),e.kind===`live`&&!qt&&Kn&&(0,Y.jsxs)(`dl`,{className:`map-brief`,"aria-label":t?`任务进展`:`Task progress`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`正在做`:`Now`}),(0,Y.jsx)(`dd`,{title:Kn.goal,children:qn.state===`running`||qn.state===`waiting`||qn.reason===`operator_input`?Jn:Kn.current})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`已有结果`:`Results`}),(0,Y.jsx)(`dd`,{children:Kn.conclusion})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:t?`接下来`:`Next`}),(0,Y.jsx)(`dd`,{children:Kn.next})]})]}),(0,Y.jsxs)(`div`,{className:`map-status-row`,children:[e.tasks.length>0&&(0,Y.jsx)(`span`,{className:`map-progress`,"aria-hidden":`true`,children:[`done`,`ended`,`running`,`question`,`review_unavailable`,`held`,`failed`,`other`].map(e=>Un[e]>0?(0,Y.jsx)(`i`,{"data-bucket":e,style:{flexGrow:Un[e]}},e):null)}),(0,Y.jsxs)(`p`,{className:`map-status-line`,role:`status`,children:[n.pending||!g&&(r||s)?(0,Y.jsx)(`i`,{className:`map-live-dot`,"aria-hidden":!0}):null,(0,Y.jsx)(`span`,{className:`map-status-text`,children:ue({total:e.tasks.length,qa:e.tasks.filter(e=>e.turn_kind===`qa`).length,complete:Wn,ended:Un.ended,reviewUnavailable:Un.review_unavailable,held:Un.held,running:Un.running,pending:n.pending,paused:g,hasOpenWork:e.tasks.some(e=>[`running`,`pending`,`paused`,`held`,`question`].includes(De(e))),role:r,current:e.kind===`live`&&![`idle`,`step_finished`].includes(qn.state)?Jn:void 0,waiting:s?.sentence,zh:t})}),Xe.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`map-status-sep`,"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`button`,{type:`button`,className:`map-attention-link`,onClick:Qn,title:t?`跳到需要你处理的任务`:`Jump to the task waiting on you`,"aria-label":t?`逐个查看 ${Xe.length} 项需要你处理的任务`:`Cycle through ${Xe.length} tasks needing attention`,children:t?`${Xe.length} 项需要你处理`:`${Xe.length} ${Xe.length===1?`needs`:`need`} your attention`})]})]})]}),e.kind===`live`&&Ie&&!qt&&(0,Y.jsxs)(`div`,{className:`map-final-review`,role:`status`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:t?`最终结果已检查通过`:`Final delivery passed review`}),Pe?.data.task.id!==Ie.id&&Pe?.data.task.outcome?.review_status===`unavailable`&&(Ie.finished_ts??0)>(Pe.data.task.finished_ts??0)?(0,Y.jsx)(`span`,{children:t?` · 本项目后续已交付;此卡保留当次审查异常。`:` · This project was delivered later; this card retains its earlier review error.`}):null]}),(0,Y.jsx)(`button`,{type:`button`,onClick:Xn,children:t?`查看结果检查`:`View final review`}),_.deliveryCount>0&&(0,Y.jsx)(`button`,{type:`button`,onClick:_.onOpenDelivery,children:t?`查看项目成果`:`View project deliverables`})]}),e.kind===`live`&&!p&&(0,Y.jsx)(ze,{questions:l.pending_questions??[],backlog:l.backlog,currentTaskId:u??l.mission_view?.mission.id,onAnswer:_.onAnswer,onLocate:e=>{let t=Z.cards.filter(t=>t.task.id===e).at(-1);t&&Yn(t.id)}}),q.detailed&&Ze>=0&&(0,Y.jsxs)(`div`,{className:`map-attention-detail`,role:`status`,children:[(0,Y.jsxs)(`strong`,{children:[t?`待处理`:`Needs attention`,` `,Ze+1,` / `,Xe.length]}),(()=>{let n=G(Xe[Ze],e.events,t,Gn(Xe[Ze]));return(0,Y.jsxs)(`div`,{tabIndex:0,children:[(0,Y.jsx)(`p`,{children:n.reason}),(0,Y.jsx)(`p`,{children:n.next}),n.detail&&(n.showDetail?(0,Y.jsxs)(`blockquote`,{className:`map-attention-quote`,children:[(0,Y.jsx)(`strong`,{children:t?`暂停原因原文`:`Recorded reason`}),` `,n.detail]}):(0,Y.jsxs)(`details`,{children:[(0,Y.jsx)(`summary`,{children:t?`原始记录`:`Recorded words`}),(0,Y.jsx)(`p`,{children:n.detail})]}))]})})()]}),nt&&rt&&(0,Y.jsxs)(`nav`,{className:`map-dependencies`,"aria-label":t?`任务来路与去向`:`Task dependencies`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`来路`:`Depends on`}),rt.upstream.length?rt.upstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的前置依赖`:`No recorded prerequisites`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`当前`:`Selected`}),(0,Y.jsxs)(`button`,{className:`map-trace-task`,title:nt.title,onClick:()=>Yn(Z.cards.find(e=>e.task.id===nt.id).id),children:[nt.title,` · `,t?`查看任务`:`Open task`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:t?`去向`:`Enables`}),rt.downstream.length?rt.downstream.map(e=>(0,Y.jsx)(`button`,{title:e.title,onClick:()=>jn(e.id),children:e.title},e.id)):(0,Y.jsx)(`span`,{children:t?`无已记录的后续依赖`:`No recorded dependents`})]})]}),(0,Y.jsx)(`div`,{className:`map-workspace`,children:(0,Y.jsxs)(`div`,{ref:he,className:`map-canvas-wrap`,"data-focused":!!q.focusId,"data-detailed":q.detailed,"data-fitted":ye,"data-hovering":!!Rt&&!q.detailed,children:[(0,Y.jsxs)(`div`,{className:`map-ambient`,"aria-hidden":`true`,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),S&&(0,Y.jsx)(yt,{events:_.conversationEvents,connected:_.connected,pending:n.pending,artifacts:_.artifacts,zh:t,onClose:()=>w(!1),onOpenArtifact:_.onOpenArtifact,onOpenDelivery:_.onOpenReceipt}),b&&e.kind===`live`&&(0,Y.jsx)(`aside`,{className:`map-agent-drawer nowheel nodrag nopan`,children:(0,Y.jsx)(Ot,{sid:l.session.id,view:l.mission_view,roles:l.roles,events:d,taskId:Pe?.data.task.id||l.mission_view?.mission.id||void 0,paused:g&&!n.pending,onClose:()=>x(!1)})}),V&&!p&&(0,Y.jsx)(Nt,{flight:V,canvas:he,zh:t,historical:n.historical,onReveal:t=>{e.tasks.some(e=>e.id===t)&&q.fit()},onLand:e=>H(t=>t?.id===e?{...t,landed:!0}:t),onFinish:e=>H(t=>t?.id===e?null:t)}),(0,Y.jsxs)(`div`,{className:`map-canvas-toolbar nowheel`,children:[(0,Y.jsxs)(`label`,{className:`map-search`,children:[(0,Y.jsx)(C,{size:14}),(0,Y.jsx)(`input`,{"aria-label":t?`搜索地图任务`:`Search map tasks`,placeholder:t?`搜索任务…`:`Find a task…`,title:t?`Enter 逐个跳转匹配`:`Enter jumps through matches`,value:gn,onChange:e=>_n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&yn.length?Yn(yn[(bn+1)%yn.length].id):e.key===`Escape`&&gn&&(e.stopPropagation(),_n(``))}}),gn&&(0,Y.jsx)(`span`,{className:`map-search-count`,"aria-live":`polite`,children:yn.length?bn>=0?`${bn+1}/${yn.length}`:`${yn.length} ${t?`项`:`found`}`:t?`无匹配`:`0 found`})]}),(0,Y.jsxs)(`button`,{onClick:Zn,title:t?`定位当前或最近任务`:`Locate current or latest task`,"aria-label":t?`定位当前`:`Locate current`,children:[(0,Y.jsx)(_t,{size:15}),(0,Y.jsx)(`span`,{children:t?`定位当前`:`Locate current`})]}),(0,Y.jsx)(`button`,{className:`map-fit-button`,onClick:Pn,title:t?`适配全图`:`Fit map`,"aria-label":`Fit map`,children:(0,Y.jsx)(W,{size:15})}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":t?`来路 / 去向`:`Trace dependencies`,title:t?`突出显示任务的直接前后依赖;点击卡片切换,再次点击退出`:`Highlight direct dependencies; click a card to switch, click it again to exit`,"aria-pressed":!!nt,disabled:!K.tasks.length,onClick:()=>jn(nt?null:Pe?.data.task.id??ae(e.tasks)?.id??null),children:[(0,Y.jsx)(N,{size:15}),(0,Y.jsx)(`span`,{children:t?`来路 / 去向`:`Dependencies`})]}),e.kind===`live`&&K.tasks.length>1&&!q.detailed&&!qt&&(0,Y.jsxs)(`button`,{onClick:()=>{Jt(!0),Sn(1),wn(!0)},title:t?`回放这项研究是如何展开的`:`Replay how this research unfolded`,"aria-label":`Replay`,children:[(0,Y.jsx)(M,{size:15}),(0,Y.jsx)(`span`,{children:t?`回放`:`Replay`})]}),q.detailed&&(0,Y.jsxs)(`button`,{onClick:q.back,className:`map-back-button`,"aria-label":`Return to map`,children:[(0,Y.jsx)(j,{size:14}),(0,Y.jsx)(`span`,{children:t?`返回全图`:`Overview`})]}),q.detailed&&Pe&&Pe.data.partCount>1&&(0,Y.jsxs)(`nav`,{className:`map-part-switcher`,"aria-label":t?`切换任务部分`:`Switch task part`,children:[(0,Y.jsx)(`button`,{"aria-label":t?`上一部分`:`Previous part`,disabled:!Pe.data.previousId,onClick:()=>Pe.data.previousId&&Mn(Pe.data.previousId,!0),children:(0,Y.jsx)(ft,{size:15})}),(0,Y.jsxs)(`span`,{children:[Pe.data.part,` / `,Pe.data.partCount]}),(0,Y.jsx)(`button`,{"aria-label":t?`下一部分`:`Next part`,disabled:!Pe.data.nextId,onClick:()=>Pe.data.nextId&&Mn(Pe.data.nextId,!0),children:(0,Y.jsx)(se,{size:15})})]}),(0,Y.jsx)(`span`,{className:`map-toolbar-gap`,"aria-hidden":!0}),e.kind===`live`&&(0,Y.jsxs)(`div`,{className:`map-workspace-actions`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":S,"aria-label":t?`对话`:`Conversation`,title:t?`与 Argus 的对话`:`Your conversation with Argus`,onClick:()=>{w(e=>!e),x(!1)},children:[(0,Y.jsx)(qe,{size:15}),(0,Y.jsx)(`span`,{children:t?`对话`:`Conversation`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-agent-toggle`,"aria-expanded":b,"aria-label":t?`Agent 动态`:`Agent activity`,title:t?`各个 Agent 正在做什么`:`What each agent is doing`,onClick:()=>{x(e=>!e),w(!1)},children:[(0,Y.jsx)(A,{size:15}),(0,Y.jsx)(`i`,{"data-active":!!r||n.pending,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:t?`工作详情`:`Work details`})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`map-delivery-toggle`,disabled:!_.deliveryCount,"aria-label":t?`交付成果`:`Deliveries`,title:t?`已交付的成果`:`What has been delivered`,onClick:_.onOpenDelivery,children:[(0,Y.jsx)(ge,{size:15}),(0,Y.jsx)(`span`,{children:t?`交付成果`:`Deliveries`}),_.deliveryCount>0&&(0,Y.jsx)(`b`,{children:_.deliveryCount})]})]})]}),kn&&(0,Y.jsx)(`div`,{className:`map-feedback`,role:`status`,children:kn}),K.tasks.length===0?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(N,{size:36}),(0,Y.jsx)(`h3`,{children:t?`把一个目标,变成可见的成果`:`Turn a goal into a visible result`}),(0,Y.jsx)(`p`,{children:p?t?`尚无任务记录。`:`No task records are available.`:t?`描述你想完成的事情,看 Argus 规划、执行、审查,最后在这里交付。`:`Describe your goal. Watch Argus plan, build, review, and deliver here.`}),!p&&(0,Y.jsx)(`div`,{className:`map-starters`,children:(t?[[`交互实验`,`做一个交互式实验室,用动画展示 Dijkstra 和 A* 怎样寻找最短路径。让我能画障碍、单步播放、比较探索范围,并验证两个算法的结果一致。`],[`数据洞察`,`用一组可复现的模拟数据,做一个辛普森悖论交互演示。让我能切换整体和分组视角,看结论怎样反转,附上验证过程。`],[`产品原型`,`做一个精致的个人旅行规划网页。我能调整预算和出行天数,比较三种行程方案,并将选中的方案导出。让手机上也方便操作。`]]:[[`Interactive lab`,`Build an interactive Dijkstra vs A* pathfinding lab with editable obstacles, step-by-step animation, and correctness checks.`],[`Data insights`,`Create an interactive Simpson’s paradox demo using reproducible synthetic data, with aggregate and grouped views and validation.`],[`Product prototype`,`Build a polished travel planner. Let me adjust budget and duration, compare three itineraries, and export my choice. Make it easy to use on a phone.`]]).map(([e,t])=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{n.onChange(t),requestAnimationFrame(()=>he.current?.querySelector(`textarea`)?.focus())},children:[e,` ↗`]},e))})]}):(0,Y.jsxs)(Bp,{nodes:Bn,edges:Vn,nodeTypes:qh,edgeTypes:Jh,onNodesChange:pe,onNodeMouseEnter:(e,t)=>zt(t.id),onNodeMouseLeave:()=>zt(null),onMove:q.onMove,defaultViewport:Qm,minZoom:.01,maxZoom:3.5,nodesDraggable:!1,nodesFocusable:!1,nodesConnectable:!1,edgesReconnectable:!1,zoomOnScroll:!1,zoomOnPinch:!0,zoomOnDoubleClick:!1,deleteKeyCode:null,selectionKeyCode:null,onlyRenderVisibleElements:ye&&_e,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Qp,{variant:Jp.Dots,gap:88,size:3,color:`var(--map-dot)`}),(0,Y.jsx)(sm,{orientation:`horizontal`,showInteractive:!1,onFitView:Pn,fitViewOptions:{padding:.16,maxZoom:.27,minZoom:.01,duration:q.reducedMotion?0:320}}),(0,Y.jsx)(Sm,{nodeColor:e=>e.type===`branch`?`#cfd2d5`:Yh[De(e.data.task)]??`#c6c8cb`,maskColor:`var(--map-minimap-mask)`,maskStrokeColor:`#6d737a`,maskStrokeWidth:1.5,onClick:(e,t)=>q.navigate(t),pannable:!0,zoomable:!0,ariaLabel:t?`地图导航预览`:`Map navigation preview`})]}),e.kind===`live`&&qt&&er,(0,Y.jsxs)(`div`,{className:`map-legend nowheel`,children:[(0,Y.jsxs)(`span`,{title:t?`内容相关的工作,不是执行依赖`:`Related in content, not an execution dependency`,children:[(0,Y.jsx)(`b`,{className:`dashed`}),t?`内容关联`:`Related work`]}),(0,Y.jsxs)(`span`,{title:t?`工作发生的先后`:`The order work happened in`,children:[(0,Y.jsx)(`b`,{className:`order`}),t?`先后`:`Order`]}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`b`,{}),t?`任务依赖`:`Dependency`]}),(0,Y.jsxs)(`button`,{className:Dn?``:`is-muted`,onClick:On,"aria-pressed":Dn,disabled:Hn===0,"aria-label":`Toggle plan replacements`,children:[(0,Y.jsx)(`b`,{className:`replacement`}),t?`计划替代`:`Plan changes`,Hn?` · ${Hn}`:``]})]}),!p&&(0,Y.jsx)(Ch,{...n,pendingLabel:f,progressVisible:!S,dispatchStatus:V?.result?.type===`task`?V.landed||n.historical?`task`:`launching`:V?.result?.outcome,onSend:Qt,onCancel:$t,overview:!q.detailed}),nn&&!p&&(0,Y.jsxs)(`div`,{className:`map-context-menu`,role:`menu`,style:{left:nn.x,top:nn.y},children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{tn(nn.ref),rn(null)},children:t?`引用`:`Reference`}),e.kind===`live`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{dn(``),ln({ref:nn.ref,x:nn.x,y:nn.y}),rn(null)},children:t?`添加批注`:`Add a note`}),(0,Y.jsx)(`button`,{role:`menuitem`,onClick:()=>{n.onRouteOverrideChange?.(`task`),tn(nn.ref),rn(null)},children:t?`从这里展开`:`Branch from here`})]})]}),cn&&!p&&(0,Y.jsxs)(`div`,{className:`map-note-editor nodrag nopan`,style:{left:Math.min(window.innerWidth-320,cn.x),top:Math.min(window.innerHeight-240,cn.y)},children:[(0,Y.jsx)(`small`,{children:t?`批注《${cn.ref.task_title}》`:`Note on “${cn.ref.task_title}”`}),(0,Y.jsx)(`textarea`,{autoFocus:!0,maxLength:2e3,value:un,onChange:e=>dn(e.target.value),placeholder:t?`写下你的观察,Argus 在下个规划周期会读到`:`Your observation; Argus reads it next planning cycle`}),fn&&(0,Y.jsx)(`small`,{className:`map-note-error`,children:t?`没有保存上,稍后再试;草稿还在`:`Not saved; try again — the draft is kept`}),(0,Y.jsxs)(`div`,{className:`map-note-actions`,children:[(0,Y.jsx)(`button`,{onClick:()=>ln(null),children:t?`取消`:`Cancel`}),(0,Y.jsx)(`button`,{className:`is-primary`,disabled:!un.trim(),onClick:()=>void mn(),children:t?`保存`:`Save`})]})]}),(K.cyclic||K.missing>0)&&(0,Y.jsx)(`div`,{className:`map-graph-warning`,children:K.cyclic?t?`检测到循环引用,保留原始连线。`:`Cyclic references retained.`:`${K.missing} ${t?`个依赖不在当前记录范围内`:`dependencies outside the available history`}`})]})}),e.kind!==`live`&&er,(0,Y.jsx)(E,{open:!!J,onClose:()=>Ve(null),label:J?.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,children:J&&(ct||J.turn_kind===`qa`)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{title:J.turn_kind===`qa`?t?`问答`:`Q&A`:t?`任务说明`:`Task explanation`,sub:J.turn_kind===`qa`?J.objective||J.title:at?.cards[J.id]?.title||J.title}),(0,Y.jsxs)(`div`,{className:`px-6 pb-6`,"data-testid":`map-task-reading`,"data-task-id":J.id,children:[J.outcome?.review_status===`unavailable`&&(0,Y.jsxs)(`p`,{className:`mb-3 text-sm text-ink-dim`,role:`status`,children:[t?`当次审查异常,未形成审阅结论。`:`No review judgment was returned on this attempt.`,Ie&&(Ie.finished_ts??0)>(J.finished_ts??0)&&(0,Y.jsx)(`button`,{type:`button`,className:`ml-2 text-blue underline`,onClick:Xn,children:t?`查看本项目后续通过的最终审稿`:`View this project's later accepted final review`})]}),Je?.data.completionScope?(0,Y.jsx)(`p`,{className:`mb-2 text-xs text-ink-dim`,children:Je.data.completionScope}):null,(0,Y.jsx)(Et,{cardKey:J.id,taskId:J.id,card:at?.cards[J.id],task:J,readOnly:p,originalDetail:J.turn_kind===`qa`?Ge?.text||(J.status===`running`?t?`正在回答…`:`Answering…`:J.status===`cancelled`?t?`本次回答已中断。`:`This answer was interrupted.`:J.summary||(t?`尚无回答。`:`No answer recorded.`)):J.objective||J.summary||(t?`这项任务尚无详细记录。`:`No detailed task record is available.`),selection:xt,artifacts:$n.artifacts,onOpenArtifact:$n.onOpenArtifact}),p?null:(0,Y.jsx)(D,{className:`mt-3 text-xs`,onClick:()=>tn({source:e.id,task_id:J.id,task_title:at?.cards[J.id]?.title||J.title,event_ids:Ge?[Ge.id]:at?.cards[J.id]?.event_ids||ct?.event_ids||[],lang:t?`zh`:`en`}),children:J.turn_kind===`qa`?t?`引用这条问答`:`Reference this Q&A`:t?`引用此任务`:`Reference this task`})]})]}):null})]})})})}var Qh=(0,X.memo)(function({snapshot:e,currentTaskId:t,events:n,managerSteps:r=[],draft:a,onDraftChange:s,onSend:u,attachments:d,onAttachmentsChange:f,pending:p,onCancel:m,focusSignal:h,readOnly:g=!1,onOpenSettings:_,routeOverride:v,onRouteOverrideChange:y,conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}){let{locale:O}=l(),k=O===`zh-CN`,[A,j]=(0,X.useState)([]),M=d??A,N=(0,X.useRef)(M);N.current=M;let P=(0,X.useCallback)(e=>{let t=typeof e==`function`?e(N.current):e;N.current=t,f?f(t):j(t)},[f]),F=(0,X.useRef)(a);F.current=a;let I=(0,X.useRef)(!0);(0,X.useEffect)(()=>(I.current=!0,()=>{I.current=!1}),[]);let R=(0,X.useCallback)(async(e,t=[],n,r)=>{let i=!1,a=await u(e,t,r=>{r.type===`settled`&&r.outcome===`error`&&(i=!0),I.current&&(r.type===`settled`&&r.outcome===`error`&&!F.current.trim()&&(s(e),P(e=>e.length?e:t)),n?.(r))},r);return a&&!i&&I.current&&(F.current===e&&s(``),P(e=>e.filter(e=>!t.includes(e)))),a},[u,s,P]),[V,H]=(0,X.useState)(()=>new URLSearchParams(window.location.search).get(`dataset`)||B(`argus.map.source.v1`)||`live`),U=i({queryKey:[`map-datasets`],queryFn:({signal:e})=>c.mapDatasets(e),staleTime:1/0}),W=i({queryKey:[`map-dataset`,V],queryFn:({signal:e})=>c.mapDataset(V,e),enabled:V!==`live`,staleTime:1/0,retry:!1}),te=o(),G=`argus.map.history.v1:`+e.session.id,[ne,re]=(0,X.useState)(()=>Bh(B(G))),[ie,ae]=(0,X.useState)(!1),oe=i({queryKey:[`map-info`,e.session.id],queryFn:({signal:t})=>c.mapInfo(e.session.id,t),enabled:V===`live`,staleTime:6e4}),K=ne??(oe.data&&!oe.data.requires_choice?{mode:`full`}:null);(0,X.useEffect)(()=>{if(!ne&&oe.data&&!oe.data.requires_choice){let e={mode:`full`};re(e),z(G,JSON.stringify(e))}},[oe.data,ne,G]);let se=V!==`live`||!!K&&K.mode!==`off`&&!ie,ce=[`map-live`,e.session.id,K?.mode,K?.since,K?.eventSince,K?.taskId],le=JSON.stringify([V,e.session.id,O,K]),ue=e=>{re(e),z(G,JSON.stringify(e)),ae(!1)},de=i({queryKey:ce,queryFn:async({signal:t})=>{let n=te.getQueryData(ce),r=K?.mode===`full`?await c.mapHistory(e.session.id,t,n?.history_cursor,n?.cursor):await c.liveMap(e.session.id,t,n?.cursor,K||void 0);return Vh(te.getQueryData(ce),r)},enabled:V===`live`&&se,staleTime:1/0,gcTime:72e5,refetchOnMount:`always`,refetchInterval:t=>Hh(se,t.state.data,e)}),fe=V===`live`&&Uh(e),pe=He(e,e.mission_view,n),me=pe.reason===`background_work`&&pe.taskId?ot(pe,k?`zh-CN`:`en`):``,he=(0,X.useMemo)(()=>V===`live`&&!fe&&me?{taskId:pe.taskId,sentence:me}:void 0,[V,fe,pe.taskId,me]),q=n.filter(e=>e.run_label!==`map-summary`&&/^(life\.(mission\.|phase\.|planner\.task_added)|manager\.turn\.|round\.|agent\.message|engineer\.progress|ui\.argus|team\.|idea\.portfolio\.)/.test(String(e.type))).at(-1),ge=JSON.stringify([q?.ts,q?.event_id||q?.id,q?.revision,q?.updated_ts,q?.status,e.backlog,fe]),_e=(0,X.useRef)(null),ve=(0,X.useRef)(0),ye=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=ye.current;if(!e)return;let t=()=>{ve.current=Date.now()+900},n=e=>{e.buttons&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`pointerdown`,t),e.addEventListener(`pointermove`,n),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`pointerdown`,t),e.removeEventListener(`pointermove`,n)}},[]),(0,X.useEffect)(()=>{if(V!==`live`||!se||_e.current)return;let t=()=>{let n=ve.current-Date.now();if(n>0){_e.current=setTimeout(t,n+120);return}_e.current=null,te.invalidateQueries({queryKey:[`map-live`,e.session.id]})};_e.current=setTimeout(t,650)},[ge,V,e.session.id,te,se]),(0,X.useEffect)(()=>()=>{_e.current&&clearTimeout(_e.current),_e.current=null},[V,e.session.id,se]);let be=V===`live`?de.data:W.data,[xe,Se]=(0,X.useState)(!1),Ce=(0,X.useMemo)(()=>({shown:xe,toggle:()=>Se(e=>!e)}),[xe]),Te=(0,X.useMemo)(()=>be?we(be.tasks).links.filter(e=>e.kind===`replacement`).length:0,[be]),Ee=(0,X.useMemo)(()=>({conversationEvents:b,connected:x,artifacts:S,deliveryCount:C,onOpenDelivery:w,onOpenReceipt:T,onOpenArtifact:E,onAnswer:D}),[b,x,S,C,w,T,E,D]),De=(0,X.useMemo)(()=>({footer:(0,Y.jsx)(Ne,{sid:e.session.id,roles:e.roles,running:e.daemon.alive||!!e.manager_requests?.length,lastCall:e.last_call,onOpenSettings:g?void 0:_}),routeOverride:v,onRouteOverrideChange:y,value:a,onChange:s,onSend:R,attachments:M,onAttachmentsChange:P,pending:p,onCancel:m,focusSignal:h,sessionName:e.session.display_name||e.session.id,historical:V!==`live`,zh:k}),[v,y,a,s,R,M,p,m,h,e.session.display_name,e.session.id,V,k,e.roles,e.daemon.alive,e.manager_requests,e.last_call,g,_]),Oe=e=>{H(e),z(`argus.map.source.v1`,e);let t=new URL(window.location.href);t.searchParams.set(`dataset`,e),window.history.replaceState(null,``,t)};return(0,Y.jsxs)(`section`,{ref:ye,className:`argus-map`,"aria-label":k?`进度地图`:`Progress map`,children:[(0,Y.jsxs)(`header`,{className:`map-header`,children:[(0,Y.jsxs)(`div`,{className:`map-heading`,children:[(0,Y.jsx)(`span`,{className:`map-kicker`,"aria-hidden":`true`,children:k?`ARGUS · 研究地图`:`ARGUS · RESEARCH MAP`}),(0,Y.jsx)(`h1`,{title:e.session.display_name,children:e.session.display_name})]}),(0,Y.jsxs)(`details`,{className:`map-more`,children:[(0,Y.jsx)(`summary`,{"aria-label":k?`地图选项`:`Map options`,title:k?`地图选项`:`Map options`,children:(0,Y.jsx)(L,{size:16})}),(0,Y.jsxs)(`div`,{className:`map-more-menu`,children:[be&&(0,Y.jsx)(Xh,{events:be.events,zh:k}),(0,Y.jsxs)(`div`,{className:`map-dataset-bar`,children:[(0,Y.jsx)(pt,{size:15}),(0,Y.jsxs)(`select`,{"aria-label":k?`地图数据来源`:`Map data source`,value:V,onChange:e=>Oe(e.target.value),children:[(0,Y.jsxs)(`option`,{value:`live`,children:[k?`当前会话`:`Current session`,` ·`,` `,e.session.display_name]}),!U.data?.datasets.some(e=>e.id===V)&&V!==`live`&&(0,Y.jsx)(`option`,{value:V,children:V}),U.data?.datasets.map(e=>(0,Y.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.task_count]},e.id))]}),be?.captured_at&&(0,Y.jsxs)(`span`,{className:`map-capture`,children:[(0,Y.jsx)(ee,{size:12}),new Date(be.captured_at).toLocaleDateString()]})]}),V===`live`&&oe.data&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button`,onClick:()=>ae(!0),children:k?`加载范围`:`History range`}),!g&&_&&(0,Y.jsx)(`button`,{type:`button`,onClick:_,className:`map-scope-button`,children:k?`地图模型设置`:`Map model settings`}),Te>0&&(0,Y.jsx)(`button`,{type:`button`,className:`map-scope-button map-narrow-only`,"aria-pressed":xe,onClick:Ce.toggle,children:xe?k?`隐藏计划替代连线 · ${Te}`:`Hide plan changes · ${Te}`:k?`显示计划替代连线 · ${Te}`:`Show plan changes · ${Te}`})]})]})]}),V===`live`&&oe.data&&(0,Y.jsx)(zh,{open:ie||!K&&oe.data.requires_choice,info:oe.data,zh:k,readOnly:g,onChoose:ue}),V===`live`&&oe.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[k?`暂时无法检查历史记录。`:`Could not check session history.`,(0,Y.jsx)(`button`,{onClick:()=>void oe.refetch(),children:k?`重试`:`Retry`})]}),se&&be?.history_loading&&(0,Y.jsxs)(`div`,{className:`map-history-progress`,role:`status`,children:[k?`正在分批加载历史记录`:`Loading history in pages`,be.history_progress&&` · ${(be.history_progress.loaded_bytes/1024/1024).toFixed(1)} / ${(be.history_progress.total_bytes/1024/1024).toFixed(1)} MB`,(0,Y.jsx)(`button`,{onClick:()=>ae(!0),children:k?`更改范围`:`Change range`})]}),se&&be&&(V===`live`?de.isError:W.isError)&&(0,Y.jsxs)(`div`,{className:`map-data-error`,role:`status`,children:[k?`暂时无法更新,已保留加载的地图。`:`Updates are unavailable. Your loaded map is preserved.`,(0,Y.jsx)(`button`,{onClick:()=>void(V===`live`?de.refetch():W.refetch()),children:k?`重试`:`Retry`})]}),U.isError&&(0,Y.jsxs)(`div`,{className:`map-data-error`,children:[k?`历史记录列表暂时无法读取,可切换当前会话或重试。`:`Historical maps are unavailable. Open the current session or retry.`,(0,Y.jsx)(`button`,{onClick:()=>void U.refetch(),children:k?`重试`:`Retry`})]}),se?(V===`live`?de.isError:W.isError)&&!be?(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:k?`地图暂时无法读取`:`Map unavailable`}),(0,Y.jsx)(`p`,{children:String(V===`live`?de.error:W.error)}),(0,Y.jsx)(`button`,{onClick:()=>void(V===`live`?de.refetch():W.refetch()),children:k?`重试`:`Retry`})]}):be?(0,Y.jsx)(Ip,{children:(0,Y.jsx)(Zh,{data:be,actions:Ee,snapshot:e,currentTaskId:t,events:n,pendingLabel:r.at(-1)?.detail||r.at(-1)?.label,viewKey:le,paused:fe,sessionId:e.session.id,zh:k,readOnly:g,replacements:Ce,activePhase:V===`live`&&!fe&&!he?e.roles.find(e=>e.active)?.role:void 0,waiting:he,composer:De})},le):(0,Y.jsxs)(`div`,{className:`map-empty is-loading`,"aria-busy":`true`,children:[(0,Y.jsxs)(`div`,{className:`map-ghosts`,"aria-hidden":!0,children:[(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{}),(0,Y.jsx)(`i`,{})]}),k?`正在载入地图…`:`Loading map…`]}):(0,Y.jsxs)(`div`,{className:`map-empty`,children:[(0,Y.jsx)(`h3`,{children:k?`地图尚未开启`:`Map is not enabled`}),(0,Y.jsx)(`p`,{children:oe.isPending?k?`正在检查历史记录规模…`:`Checking history size…`:k?`选择加载范围后查看研究进度。`:`Choose a history range to view research progress.`}),oe.data&&(0,Y.jsx)(`button`,{onClick:()=>ae(!0),children:k?`选择加载范围`:`Choose history range`})]})]})});export{Zh as MapCanvas,Qh as MapPanel,Xh as MapTeamProgress}; \ No newline at end of file diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-7s5IqqE9.js b/frontend/web/dist/assets/ResearchWorkbenchPanel-7s5IqqE9.js new file mode 100644 index 000000000..357fe7be5 --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-7s5IqqE9.js @@ -0,0 +1,12 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,c as i,n as a}from"./query-dCPZk0Xc.js";import{D as o,F as s,H as c,I as l,N as u,O as d,P as f,S as p,V as m}from"./index-Cr9q41CR.js";import{A as h,C as g,F as _,I as v,L as y,M as b,O as x,S,_ as C,b as w,j as T,n as E,s as D,w as O,x as k}from"./AppearanceControls-BIflq6l1.js";import{t as A}from"./activity-DRTghqfr.js";import{a as j,i as M,n as ee,o as N,r as te,t as ne}from"./sliders-horizontal-BIXOePK5.js";import{t as re}from"./code-xml-Cgb6b1v3.js";import{a as P,i as F}from"./useWorkbenchTheme-Drg51S8W.js";import{Ct as ie,Dt as I,Et as ae,F as L,Ft as R,It as z,St as B,Tt as oe,_t as V,at as se,gt as H,it as ce,jt as le,l as ue,m as de,nt as fe,ot as pe,p as me,rt as he,tt as ge,vt as _e,wt as ve,x as ye,xt as be}from"./App-ButSXpk-.js";var xe=y(`ArrowDownToLine`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Se=y(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ce=y(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),we=y(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),Te=y(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Ee=y(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),De=y(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),Oe=y(`FlaskConical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),ke=y(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ae=y(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),je=y(`LockKeyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Me=y(`Radio`,[[`path`,{d:`M4.9 19.1C1 15.2 1 8.8 4.9 4.9`,key:`1vaf9d`}],[`path`,{d:`M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5`,key:`u1ii0m`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5`,key:`1j5fej`}],[`path`,{d:`M19.1 4.9C23 8.8 23 15.1 19.1 19`,key:`10b0cb`}]]),Ne=y(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Pe=y(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Fe=y(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Ie=y(`UserRound`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Le=y(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),U=e(n(),1),Re=12e3;function W(e=!1){let t={...f()};return e&&(t[`Content-Type`]=`application/json`),t}async function G(e,t={}){await l();let n={...t,headers:{...W(!!t.body),...t.headers??{}},cache:`no-store`},r=String(t.method??`GET`).toUpperCase(),i=async n=>{if(!n.ok){let r=await n.text().catch(()=>``),i=r;try{i=JSON.parse(r).detail??r}catch{}throw Error(i||`${t.method??`GET`} ${e} failed (${n.status})`)}return await n.json()};return r===`GET`?m(e,n,Re,i):i(await fetch(e,n))}var K=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`,ze=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`;function Be(e){let t=e.replaceAll(`\r +`,` +`).split(` + +`),n=t.pop()??``,r=[];return t.forEach(e=>{e.split(` +`).forEach(e=>{if(e.startsWith(`data:`))try{let t=JSON.parse(e.slice(5).trim());r.push(t)}catch{}})}),{frames:r,rest:n}}function Ve(e,t){let n=String(e.type??``);if(n===`phase`)t.onPhase?.(String(e.label??``),String(e.role??`manager`),String(e.detail??``),e.heartbeat===!0);else if(n===`delta`)t.onDelta?.(String(e.text??``),String(e.fragment_mode??`auto`));else if(n===`done`){let n=e.result??{};return t.onDone?.(n),n}else if(n===`error`)throw Error(String(e.error??`Manager stream failed`));return null}var q={timelineExample:()=>G(`/api/research/timeline/example`),timelineEstimate:(e,t)=>G(`/api/research/timeline/estimate`,{method:`POST`,body:JSON.stringify(e),signal:t}),timelineLatest:e=>G(K(e,`/research/timeline`)),timelineSave:(e,t,n,r)=>G(K(e,`/research/timeline`),{method:`POST`,body:JSON.stringify({input:t,expected_version:n,reason:r})}),projects:e=>G(`/api/projects`,{signal:e}),snapshot:(e,t)=>G(K(e,`/snapshot?events_limit=40&compact=false`),{signal:t}),status:(e,t)=>G(K(e,`/status`),{signal:t}),events:(e,t=180,n)=>G(K(e,`/events?limit=${t}&view=ui`),{signal:n}).then(e=>e.events),transcript:(e,t=100,n)=>G(K(e,`/transcript?n=${t}`),{signal:n}).then(e=>e.turns),journal:(e,t=80,n)=>G(K(e,`/journal?n=${t}`),{signal:n}).then(e=>e.journal),artifacts:(e,t)=>G(K(e,`/artifacts`),{signal:t}).then(e=>e.artifacts),counterexamples:(e,t)=>G(K(e,`/counterexamples`),{signal:t}),artifact:(e,t,n)=>G(K(e,`/artifact?${new URLSearchParams({path:t})}`),{signal:n}),artifactBlob:async(e,t,n=!1,r)=>{await l();let i=new URLSearchParams({path:t});n&&i.set(`download`,`true`);let a=K(e,`/artifact/raw?${i}`);return m(a,{headers:W(),signal:r,cache:`no-store`},Re,async e=>{if(!e.ok)throw Error(`Artifact unavailable (${e.status})`);return e.blob()})},gitDiff:(e,t)=>G(K(e,`/git-diff`),{signal:t}),rewritePrompt:(e,t,n)=>G(K(e,`/prompt/rewrite`),{method:`POST`,body:JSON.stringify({text:t}),signal:n}),note:(e,t)=>G(K(e,`/note`),{method:`POST`,body:JSON.stringify({text:t})}),uploadAttachments:async(e,t,n)=>{await l();let r=new FormData;t.forEach(e=>r.append(`files`,e,e.name));let i=await fetch(K(e,`/attachments`),{method:`POST`,headers:W(),body:r,signal:n});if(!i.ok)throw Error(await i.text()||`attachment upload failed (${i.status})`);return await i.json()},createDaemon:(e,t=``,n=``)=>G(`/api/daemons`,{method:`POST`,body:JSON.stringify({objective:e,name:t,workdir:n,command_id:ze()})}),createFinalReview:(e,t)=>G(K(e,`/reviews/final`),{method:`POST`,body:JSON.stringify(t)}),startDaemon:(e,t)=>G(K(e,`/daemon/start`),{method:`POST`,body:JSON.stringify({command_id:ze(),expected_revision:t})}).then(c),stopDaemon:(e,t,n)=>G(K(e,`/daemon/stop`),{method:`POST`,body:JSON.stringify({drain:t,command_id:ze(),expected_revision:n})}).then(c),async messageStream(e,t,n={},r,i=[]){await l();let a=K(e,`/message/stream`),o=await fetch(a,{method:`POST`,headers:W(!0),body:JSON.stringify(i.length?{text:t,attachments:i}:{text:t}),signal:r});if(!o.ok){let e=await o.text().catch(()=>``);throw Error(e||`Manager request failed (${o.status})`)}if(!o.body)throw Error(`Manager returned an empty stream`);let s=o.body.getReader(),c=new TextDecoder,u=``,d={};for(;;){let e=await s.read();if(e.done)break;u+=c.decode(e.value,{stream:!0});let t=Be(u);u=t.rest,t.frames.forEach(e=>{let t=Ve(e,n);t&&(d=t)})}return Be(`${u}\n\n`).frames.forEach(e=>{let t=Ve(e,n);t&&(d=t)}),d}};function He(e,t,n){let r=!1,i=null,a,o=800,c=()=>{if(r)return;let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({replay:`40`,view:`ui`}),d=s();d&&u.set(`token`,d),i=new WebSocket(`${l}//${window.location.host}${K(e,`/stream`)}?${u}`),i.onopen=()=>{o=800,n(!0)},i.onmessage=e=>{try{t(JSON.parse(String(e.data)))}catch{}},i.onerror=()=>i?.close(),i.onclose=e=>{n(!1),!(r||e.code===4401||e.code===4404)&&(a=window.setTimeout(c,o),o=Math.min(o*1.7,8e3))}};return c(),{close:()=>{r=!0,a&&window.clearTimeout(a),i?.close()}}}var Ue={active:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],running:[`进行中`,`In progress`],working:[`进行中`,`In progress`],pending:[`等待中`,`Waiting`],queued:[`等待中`,`Waiting`],waiting:[`等待中`,`Waiting`],idle:[`等待中`,`Waiting`],accepted:[`已完成`,`Completed`],complete:[`已完成`,`Completed`],completed:[`已完成`,`Completed`],done:[`已完成`,`Completed`],success:[`已完成`,`Completed`],blocked:[`已阻塞`,`Blocked`],failed:[`失败`,`Failed`],error:[`失败`,`Failed`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],replan_requested:[`需要重新规划`,`Needs replanning`],incomplete:[`尚未完成`,`Incomplete`],research_incomplete:[`研究尚未完成`,`Research incomplete`],paused_no_breakthrough:[`暂未取得突破,已暂停`,`Paused without a breakthrough`],exhausted_current_methods:[`当前方法已尝试完`,`Current methods exhausted`],no_progress:[`暂无新进展,已暂停`,`Paused without new progress`],max_rounds:[`已到本次轮次上限`,`Round limit reached`],infra_blocked:[`等待运行条件恢复`,`Waiting for the runtime to recover`],supervisor_error:[`执行异常`,`Execution failed`],skipped:[`已跳过`,`Skipped`],paused:[`已暂停`,`Paused`],paused_cost:[`费用待对账`,`Awaiting usage reconciliation`],stopped:[`已暂停`,`Paused`],cancelled:[`已暂停`,`Paused`],aborted:[`已暂停`,`Paused`],not_started:[`等待中`,`Waiting`],healthy:[`状态正常`,`Healthy`],degraded:[`部分受限`,`Limited`]},We={system:[`Argus`,`Argus`],operator:[`你`,`You`],stopped:[`已暂停`,`Paused`],idle:[`等待中`,`Waiting`]};function Ge(e,t,n,r){let i=t[String(e??``).toLowerCase()]??n;return r(i[0],i[1])}function Ke(e,t){return String(e??``).startsWith(`paused_`)&&!Ue[String(e)]?t(`已暂停`,`Paused`):Ge(e,Ue,[`状态已更新`,`Status updated`],t)}function qe(e,t){let n=String(e??``).toLowerCase();return O(n)?g(n,e=>t(o(e,{},`zh-CN`),o(e,{},`en`))):Ge(e,We,[`Argus`,`Argus`],t)}function J(){let{locale:e,t}=d();return{locale:e,text:(0,U.useCallback)((t,n)=>e===`zh-CN`?t:n,[e]),t}}function Je(...e){return e.filter(Boolean).join(` `)}function Ye(e){let t=Math.max(0,Math.floor(Number(e??0)));if(t<60)return`${t}s`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n?`${n}d ${r}h`:r?`${r}h ${i}m`:`${i}m`}function Xe(e,t){return e?new Date(e*1e3).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):`—`}function Ze(e){let t=String(e??``).toLowerCase();return/failed|error|blocked|rejected|stalled|dead|abort/.test(t)?`danger`:/warn|waiting|paused|hold|queued|pending|continue/.test(t)?`warn`:/done|complete|completed|accepted|healthy|success|passed/.test(t)?`success`:/run|active|work|claimed|progress|live/.test(t)?`live`:/research|plan|info|ready/.test(t)?`info`:`neutral`}function Qe(e){let t=String(e.agent_layer??e.actor??``).toLowerCase();if(t===`main`||t.startsWith(`engineer`))return`engineer`;if(t.startsWith(`review`))return`reviewer`;if(t.startsWith(`plan`))return`planner`;if(t.startsWith(`manager`))return`manager`;let n=String(e.type??``);return/review/.test(n)?`reviewer`:/planner/.test(n)?`planner`:/manager/.test(n)?`manager`:/engineer|round/.test(n)?`engineer`:`system`}function $e(e,t){let n=String(e.action_summary??``).trim();if(n)return t?pe(n,t):n;let r=String(e.title??``).trim();if(r)return t?pe(r,t):r;let i=t?ce(String(e.type??``),t):null;if(i)return i;let a=String(e.kind??``).trim();return a?a.replaceAll(`_`,` `):String(e.type??`event`).split(`.`).slice(-2).join(` · `).replaceAll(`_`,` `)}function et(e,t=400){let n=String(e.text??e.reason??e.summary??e.detail??``).trim();return n?n.length>t?`${n.slice(0,t)}…`:n:``}var Y=t();function X({children:e,tone:t=`neutral`,dot:n=!1,className:r}){return(0,Y.jsxs)(`span`,{className:Je(`badge`,`badge--${t}`,r),children:[n?(0,Y.jsx)(`span`,{className:Je(`badge__dot`,t===`live`&&`is-pulsing`)}):null,e]})}function Z({icon:e=Ee,title:t,description:n,action:r}){return(0,Y.jsxs)(`div`,{className:`empty-state`,children:[(0,Y.jsx)(`span`,{className:`empty-state__icon`,children:(0,Y.jsx)(e,{size:19})}),(0,Y.jsx)(`div`,{className:`empty-state__title`,children:t}),n?(0,Y.jsx)(`p`,{children:n}):null,r?(0,Y.jsx)(`div`,{className:`empty-state__action`,children:r}):null]})}function tt({label:e}){let{text:t}=J();return(0,Y.jsxs)(`span`,{className:`spinner`,role:`status`,children:[(0,Y.jsx)(le,{size:15,className:`spin`}),` `,e||t(`加载中`,`Loading`)]})}function nt({events:e,limit:t=24,empty:n,dense:r=!1}){let{locale:i,text:a}=J(),o=e.slice(-t).reverse();return o.length?(0,Y.jsx)(`div`,{className:Je(`event-list`,r&&`event-list--dense`),children:o.map((e,t)=>{let n=Qe(e),o=$e(e,i),s=he(et(e,r?180:480),i).text,c=Ze(String(e.status??e.kind??e.type??``));return(0,Y.jsxs)(`article`,{className:`event-row`,children:[(0,Y.jsx)(`div`,{className:Je(`event-row__marker`,`event-row__marker--${c}`)}),(0,Y.jsxs)(`div`,{className:`event-row__content`,children:[(0,Y.jsxs)(`div`,{className:`event-row__meta`,children:[(0,Y.jsx)(`span`,{className:`role-label`,style:{color:k(n)},children:qe(n,a)}),(0,Y.jsx)(`time`,{children:Xe(e.ts,i)})]}),(0,Y.jsx)(`div`,{className:`event-row__title`,children:o}),s?(0,Y.jsx)(`div`,{className:`event-row__detail`,children:s}):null]})]},`${e.type}-${e.ts}-${e.message_id??t}`)})}):(0,Y.jsx)(Z,{icon:Me,title:n||a(`还没有可展示的实时动态`,`No activity to show yet`)})}var rt=new Set([`done`,`completed`,`accepted`,`success`]),it=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]),at=/continue|replan|reject|blocked|fail|error|incomplete|revoked/,ot=new Set([`assistant_message`,`agent_message`,`message`]),st=new Set([`life.planner.task_added`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.phase.started`,`life.manager.stage_decision`,`round.start`,`round.main.completed`,`round.review.started`,`round.review.completed`,`round.review.deferred`,`round.backend_failure.backoff`,`work.segment`,`work.segment.started`,`work.segment.completed`]);function ct(e){let t=String(e.type??``),n=String(e.kind??``);return n!==`reasoning`&&!p(e)&&(st.has(t)||t===`engineer.progress`&&(ot.has(n)||[`tool_use`,`tool_result`,`command_execution`,`file_change`].includes(n)))}function lt(e){return e.type!==`engineer.progress`||!ot.has(String(e.kind??``))?e:{...e,text:L(String(e.text??``)),action_summary:L(String(e.action_summary??``)),title:L(String(e.title??``))}}function ut(e,t){return t?e.backlog.find(e=>e.id===t)??null:e.backlog.find(e=>it.has(e.status))??e.backlog.find(e=>e.status===`pending`)??e.backlog.at(-1)??null}function dt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function ft(e,t,n=Date.now()/1e3,r=`zh-CN`){let i=(e,t)=>r===`zh-CN`?e:t,a=e.mission_view,o=H(e,a,t,n),s=ut(e,o.taskId||a?.mission.id||``),c=s?.id||a?.mission.id||``,l=!!(c&&c===a?.mission.id),u=a?.dag?.length?a.dag:e.backlog,d=u.filter(e=>rt.has(e.status)).length,f=u.filter(e=>/^(pending|queued|waiting)$/.test(e.status)).length,p=!!(a?.routing?.open_ended||a?.routing?.lifetime===`standing`||e.continuous?.open_ended),m=dt(s?.started_ts)??(l?dt(a?.mission.started_at):null),h=dt(s?.finished_ts)??(l?dt(a?.mission.completed_at):null),g=e.backlog.filter(e=>it.has(e.status)).length>1,_=t.filter(e=>{if(!c||m!==null&&Number(e.ts??0)Number(e.ts??0)-Number(t.ts??0)),v=_.filter(ct).map(lt).filter(e=>!ot.has(String(e.kind??``))||!!(e.text||e.action_summary||e.title)),y=v.at(-1),b=o.state===`running`,x=h??(e.daemon.alive?n:dt(_.at(-1)?.ts)??m),S=m===null||x===null?null:Math.max(0,x-m),C=[..._].reverse().find(e=>V(e)===c&&e.type===`round.start`),w=Math.max(l?Number(a?.round.current??0):0,Number(C?.round_index??0)),T=[..._].reverse().find(e=>V(e)===c&&e.type===`round.start`&&Number(e.round_index)===w),E=_.filter(e=>{if(V(e)!==c||w<=0||T&&Number(e.ts??0)0?t===w:T!=null&&Number(e.ts??0)>=Number(T.ts??0)}),D=[...E].reverse().find(e=>e.type===`round.review.completed`),O=[...E].reverse().find(e=>e.type===`round.review.started`),k=!!(O&&(!D||Number(O.ts)>Number(D.ts))),A=b&&o.role===`reviewer`&&k,j=k?void 0:D,M=String(j?.status??``).toLowerCase(),ee=l?String(a?.review.status??``).toLowerCase():``,N=j?.review_skipped===!0||M===`skipped`,te=j?.review_source===`engineer_self_review`,ne=!j?.review_source||j.review_source===`reviewer`,re=!N&&ne&&M===`done`,P=!N&&(at.test(M)||!j&&!A&&at.test(ee)),F=A?`running`:N?`skipped`:re?`passed`:te&&M===`done`?`self_checked`:P?`needs_work`:`pending`,ie={pending:i(`结论待核对`,`Conclusion awaiting review`),running:i(`正在核对证据`,`Checking the evidence`),passed:i(`本轮工作通过核对`,`This round passed review`),needs_work:i(`仍需补充或修改`,`More work is needed`),skipped:i(`本轮未做审查`,`This round was not reviewed`),self_checked:i(`执行者已自查,待独立核对`,`Self-checked; independent review pending`)},I={pending:i(`尚无能对应到当前工作项和轮次的通过记录。`,`No passing review is linked to the current work item and round.`),running:i(`审阅者正在核对本轮结果及其证据。`,`The Reviewer is checking this round’s results and evidence.`),passed:i(`通过记录仅适用于本轮提交的工作与证据。`,`The passing verdict applies to the work and evidence submitted in this round.`),needs_work:i(`审查发现仍有待处理的问题,需要继续工作。`,`The review found issues that require further work.`),skipped:i(`执行结束并不代表证据已经通过核对。`,`The end of execution does not establish that the evidence passed review.`),self_checked:i(`这条记录来自执行者自查,尚无本轮独立审查通过记录。`,`This record is a self-check by the worker; no independent passing review is recorded for this round.`)},ae={state:F,label:ie[F],detail:String(j?.reason||P&&a?.review.reason||I[F]),scope:i(`当前工作项${w>0?` · 第 ${w} 轮`:``}。整体目标是否成立,仍须核对其完整验收条件。`,`Current work item${w>0?` · Round ${w}`:``}. The overall goal still requires checking its full acceptance criteria.`)},L=[...E].reverse().find(e=>e.type===`round.main.completed`),R=F===`passed`?`done`:F===`running`?`active`:F===`needs_work`?`blocked`:`pending`,z=[{id:`plan`,label:i(`工作项已记录`,`Work item recorded`),detail:s?.title||a?.mission.title||i(`等待任务`,`Waiting for a task`),status:s||l?`done`:`pending`},{id:`start`,label:i(`开始执行`,`Execution started`),detail:m===null?i(`尚无启动记录`,`No start is recorded`):i(`有任务启动时间记录`,`A task start time is recorded`),status:m===null?`pending`:`done`},{id:`handoff`,label:i(`本轮执行已结束`,`Round execution ended`),detail:L?i(`已记录本轮执行结束,结果是否可用仍需核对`,`The round’s execution ended; its results still need to be checked`):i(`尚无本轮执行结束记录`,`No end of execution is recorded for this round`),status:L?`done`:b&&o.role===`engineer`?`active`:`pending`},{id:`review`,label:i(`核对本轮证据`,`Check this round’s evidence`),detail:ae.label,status:R}],B=!!(s&&rt.has(s.status))||l&&[`complete`,`completed`,`done`].includes(a?.mission.status??``),oe=e.daemon.alive?p?i(`开放研究的剩余工作量尚不确定,无法可靠预计整体完成时间。`,`Open research has no known remaining workload, so its overall finish time cannot be reliably estimated.`):P?i(`审查要求继续补充或调整工作范围,暂无法预计完成时间。`,`Review requires further work or a scope change; a finish time is unavailable.`):B?i(`当前工作项已结束;这不提供整体目标的完成时间。`,`The current work item has ended; this does not establish when the overall goal will be reached.`):i(`当前记录没有可比较的固定工作量基线,暂无法可靠预计完成时间。`,`The current records contain no comparable, fixed-workload baseline for a reliable finish-time estimate.`):i(`运行已停止,无法预计完成时间。`,`Execution has stopped; a finish time is unavailable.`);return{workCompletion:u.length?d/u.length:null,workScope:i(`仅统计已记录的工作项;清单可随研究增减,完成比例不代表整体目标已成立。`,`Counts recorded work items only. The list can change during research; its completion fraction does not establish the overall goal.`),currentTask:s?.title||a?.mission.title||i(`等待新任务`,`Waiting for a new task`),currentTaskId:c,currentObjective:s?.objective||(l?a?.mission.objective:``)||``,currentStep:b&&y?$e(y,r):_e(o,r),currentDetail:y?et(y,700):s?.objective||``,currentEvent:y??null,runtime:o,elapsedSeconds:S,etaUnavailableReason:oe,checkpoints:z,completedTasks:d,totalTasks:u.length,pendingTasks:f,openEnded:p,review:ae,acceptanceCriteria:s?.acceptance_check||u.find(e=>e.id===c)?.acceptance_check||``,nextAction:s?.pending_question||String(j?.next_action||``),taskEvents:v}}var pt=new Set([`done`,`completed`,`accepted`,`success`]),mt=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]);function ht(e){let{locale:t,text:n,t:r}=J(),[i,a]=(0,U.useState)(()=>Date.now()/1e3),[o,s]=(0,U.useState)(``);(0,U.useEffect)(()=>{if(!e.active||!e.snapshot.daemon.alive)return;a(Date.now()/1e3);let t=window.setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(t)},[e.active,e.snapshot.daemon.alive]);let c=(0,U.useMemo)(()=>ft(e.snapshot,e.events,i,t),[t,i,e.events,e.snapshot]),l=e.snapshot.mission_view,u=l?.dag?.length?l.dag:e.snapshot.backlog.map(e=>({id:e.id,title:e.title,objective:e.objective,status:e.status,deps:e.deps??[],branch_id:e.id,parent_branch_id:``})),d=u.find(e=>e.id===o)??u.find(e=>e.id===c.currentTaskId),f=se(l?.stage.id,t),p=l?.stage.label&&l.stage.label!==l.stage.id?l.stage.label:f||l?.stage.id||n(`尚未记录`,`Not yet recorded`),m=c.runtime.state===`running`,g=_e(c.runtime,t),_=c.taskEvents.filter(e=>String(e.kind??``)!==`reasoning`&&!fe(String(e.type??``))),y=he(c.currentDetail,t),x=c.currentEvent?ge(c.currentEvent,t):null,C=he(c.review.detail,t),T=[{label:n(`已完成的工作`,`Completed work`),items:u.filter(e=>pt.has(e.status))},{label:n(`进行中与待处理`,`Active and remaining work`),items:u.filter(e=>!pt.has(e.status))}],E=async t=>{let r=t?n(`确认完成当前步骤后停止 Argus?`,`Stop Argus after the current step finishes?`):n(`确认立即停止 Argus?当前步骤可能被中断。`,`Stop Argus now? The current step may be interrupted.`);confirm(r)&&await e.controls.stop(t)};return(0,Y.jsxs)(`div`,{className:`ros-page experiment-v3`,children:[(0,Y.jsxs)(`header`,{className:`ros-page-header`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h1`,{children:n(`任务进展`,`Work progress`)}),(0,Y.jsx)(`p`,{children:n(`看清做了哪些工作、结论核对到了哪里,以及团队接下来要做什么。`,`See what work was done, which conclusions were checked, and what the team needs to do next.`)})]}),(0,Y.jsxs)(`div`,{className:`experiment-header-actions`,children:[(0,Y.jsxs)(`button`,{className:`button button--secondary`,type:`button`,onClick:()=>void e.refresh(),children:[(0,Y.jsx)(b,{size:14}),n(`刷新`,`Refresh`)]}),e.snapshot.daemon.alive&&e.snapshot.daemon.control_available===!1?null:e.snapshot.daemon.alive?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{className:`button button--secondary`,type:`button`,disabled:e.controls.busy,onClick:()=>void E(!0),children:[(0,Y.jsx)(M,{size:14}),n(`当前步后停止`,`Stop after step`)]}),(0,Y.jsxs)(`button`,{className:`button button--danger`,type:`button`,disabled:e.controls.busy,onClick:()=>void E(!1),children:[(0,Y.jsx)(I,{size:13}),n(`立即停止`,`Stop now`)]})]}):(0,Y.jsxs)(`button`,{className:`button button--primary`,type:`button`,disabled:e.controls.busy,onClick:()=>void e.controls.start(),children:[(0,Y.jsx)(te,{size:14}),n(`继续运行`,`Resume`)]})]})]}),(0,Y.jsxs)(`section`,{className:`experiment-progress-hero`,children:[(0,Y.jsxs)(`div`,{className:`progress-hero-main`,children:[(0,Y.jsxs)(`div`,{className:`progress-live-line`,children:[(0,Y.jsx)(X,{tone:m?`live`:`neutral`,dot:m,children:g}),c.runtime.role?(0,Y.jsx)(`span`,{children:qe(c.runtime.role,n)}):null]}),(0,Y.jsx)(`h2`,{children:c.currentTask}),c.currentObjective?(0,Y.jsx)(`p`,{className:`work-objective`,children:c.currentObjective}):null,(0,Y.jsxs)(`div`,{className:`current-step-callout`,children:[(0,Y.jsx)(`span`,{children:(0,Y.jsx)(A,{size:17})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`small`,{children:m?n(`当前动作`,`Current action`):n(`当前状态与最近记录`,`Current state and latest record`)}),(0,Y.jsx)(`strong`,{children:x?.title||c.currentStep}),x?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{children:x.detail}),(0,Y.jsx)(D,{label:n(`原始调用记录`,`Original call record`),children:(0,Y.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs`,children:c.currentDetail})})]}):c.currentDetail?(0,Y.jsx)(`p`,{title:y.technical||void 0,children:y.text}):null]})]})]}),(0,Y.jsxs)(`div`,{className:`progress-number`,children:[(0,Y.jsx)(`span`,{children:n(`已完成的工作项`,`Completed work items`)}),(0,Y.jsxs)(`strong`,{children:[c.completedTasks,(0,Y.jsxs)(`em`,{children:[` / `,c.totalTasks||`—`]})]}),(0,Y.jsx)(`small`,{children:n(`按当前记录计数`,`Counted from current records`)})]}),(0,Y.jsxs)(`div`,{className:`truthful-progress`,children:[c.workCompletion===null?null:(0,Y.jsx)(`div`,{className:`truthful-progress__track`,role:`progressbar`,"aria-label":n(`已记录工作项的完成情况`,`Completion of recorded work items`),"aria-valuemin":0,"aria-valuemax":c.totalTasks,"aria-valuenow":c.completedTasks,"aria-valuetext":n(`${c.totalTasks} 项已记录工作中完成 ${c.completedTasks} 项`,`${c.completedTasks} of ${c.totalTasks} recorded work items completed`),children:(0,Y.jsx)(`span`,{className:`confirmed`,style:{width:`${c.workCompletion*100}%`}})}),(0,Y.jsx)(`p`,{className:`work-scope`,children:c.workScope})]}),(0,Y.jsxs)(`div`,{className:`progress-metrics`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(N,{size:15}),n(`当前工作项已用时间`,`Current work item elapsed`)]}),(0,Y.jsx)(`strong`,{children:c.elapsedSeconds===null?`—`:Ye(c.elapsedSeconds)}),(0,Y.jsx)(`small`,{children:n(`按任务启动与结束记录计算`,`Based on recorded task start and end times`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`实际记录的阶段`,`Recorded stage`)}),(0,Y.jsx)(`strong`,{children:p}),(0,Y.jsx)(`small`,{children:n(`阶段名称不表示前面的工作已通过核验`,`The stage name does not certify earlier work`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`工作范围`,`Work scope`)}),(0,Y.jsx)(`strong`,{children:c.openEnded?n(`开放研究`,`Open research`):n(`当前工作项`,`Current work item`)}),(0,Y.jsx)(`small`,{children:c.openEnded?n(`可能产生新的问题和任务`,`New questions and tasks may emerge`):n(`以该工作项的验收条件为准`,`Defined by this item’s acceptance criteria`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(Le,{size:15}),n(`等待执行的工作`,`Work waiting to start`)]}),(0,Y.jsx)(`strong`,{children:c.pendingTasks}),(0,Y.jsx)(`small`,{children:n(`已记录清单中的等待项`,`Waiting items in the recorded list`)})]})]})]}),(0,Y.jsxs)(`div`,{className:`experiment-v3-grid`,children:[(0,Y.jsxs)(`aside`,{className:`ros-card experiment-task-route`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`工作项`,`Work items`)})}),(0,Y.jsx)(X,{tone:`neutral`,children:u.length})]}),(0,Y.jsx)(`div`,{children:u.length?T.map(e=>(0,Y.jsxs)(`section`,{className:`work-item-group`,children:[(0,Y.jsxs)(`h3`,{children:[e.label,(0,Y.jsx)(`span`,{children:e.items.length})]}),e.items.length?e.items.map(e=>{let t=m&&e.id===c.currentTaskId&&mt.has(e.status),r=mt.has(e.status)&&!t?e.id===c.currentTaskId?g:n(`等待状态确认`,`Awaiting status confirmation`):Ke(e.status,n);return(0,Y.jsxs)(`button`,{type:`button`,className:d?.id===e.id?`is-active`:``,onClick:()=>s(e.id),children:[(0,Y.jsx)(`span`,{className:`task-state task-state--${pt.has(e.status)?`success`:t?`live`:`neutral`}`,children:pt.has(e.status)?(0,Y.jsx)(v,{size:12}):t?(0,Y.jsx)(A,{size:12}):(0,Y.jsx)(Ce,{size:9})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.title||e.objective||n(`未命名任务`,`Untitled task`)}),(0,Y.jsxs)(`small`,{children:[r,e.deps.length?n(` · 前置工作 ${e.deps.length} 项`,` · ${e.deps.length} dependencies`):``]})]})]},e.id)}):(0,Y.jsx)(`p`,{className:`work-group-empty`,children:n(`暂无记录`,`No records yet`)})]},e.label)):(0,Y.jsx)(Z,{icon:Le,title:n(`尚无工作项`,`No work items yet`)})})]}),(0,Y.jsxs)(`main`,{className:`experiment-v3-center`,children:[(0,Y.jsxs)(`section`,{className:`ros-card work-conclusion`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`本轮结论与待核对问题`,`This round’s conclusions and open checks`)})}),(0,Y.jsx)(X,{tone:c.review.state===`passed`?`success`:c.review.state===`running`?`live`:`warn`,children:c.review.label})]}),(0,Y.jsxs)(`div`,{className:`work-conclusion__body`,children:[(0,Y.jsx)(`p`,{title:C.technical||void 0,children:C.text}),c.acceptanceCriteria?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:n(`判断这项工作是否完成的标准`,`How this work item is accepted`)}),(0,Y.jsx)(`p`,{children:c.acceptanceCriteria})]}):null,c.nextAction?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:n(`下一步要处理`,`What needs to happen next`)}),(0,Y.jsx)(`p`,{children:c.nextAction})]}):null,(0,Y.jsx)(`p`,{className:`work-scope`,children:c.review.scope})]})]}),(0,Y.jsxs)(`section`,{className:`ros-card checkpoint-card`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`当前工作项的过程记录`,`Current work item’s recorded steps`)})}),(0,Y.jsx)(X,{tone:`neutral`,children:n(`以记录为准`,`Based on records`)})]}),(0,Y.jsx)(`div`,{className:`checkpoint-list`,children:c.checkpoints.map((e,t)=>(0,Y.jsxs)(`div`,{className:`checkpoint checkpoint--${e.status}`,children:[(0,Y.jsx)(`span`,{children:e.status===`done`?(0,Y.jsx)(v,{size:13}):e.status===`active`?(0,Y.jsx)(A,{size:13}):e.status===`blocked`?(0,Y.jsx)(oe,{size:13}):t+1}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.label}),(0,Y.jsx)(`p`,{children:e.detail})]}),t{let t=m&&c.runtime.role===e;return(0,Y.jsxs)(`article`,{className:t?`is-active`:``,children:[(0,Y.jsx)(`span`,{"data-role-dot":e,className:`role-dot`,style:{backgroundColor:k(e)},"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:qe(e,n)}),(0,Y.jsx)(`p`,{children:S(e,r)})]}),t?(0,Y.jsx)(X,{tone:`live`,dot:!0,children:n(`执行中`,`Working`)}):(0,Y.jsx)(X,{tone:`neutral`,children:n(`未在执行`,`Not working`)})]},e)})})]}),(0,Y.jsxs)(`section`,{className:`ros-card estimate-note`,children:[(0,Y.jsx)(`header`,{children:(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`还需要多久`,`How much longer?`)})})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`strong`,{children:n(`暂无法可靠预计`,`No reliable estimate yet`)}),c.etaUnavailableReason]}),(0,Y.jsxs)(`div`,{className:`work-evidence-note`,children:[(0,Y.jsx)(h,{size:15}),(0,Y.jsx)(`span`,{children:n(`真实已用时间和已完成工作可以统计。读文件、运行命令或审查结束,都不能换算成整体目标的完成百分比。`,`Elapsed time and completed work can be counted. File reads, commands, and the end of a review do not establish a completion percentage for the overall goal.`)})]}),e.controls.error?(0,Y.jsx)(`div`,{className:`inline-error`,children:e.controls.error}):null]})]})]})]})]})}function gt(e){if(!e||e.length>2e5||e.includes(`\0`)||!e.startsWith(`diff --git `)&&!/^--- [^\n]+\n\+\+\+ /.test(e)||/^(?:Binary files |GIT binary patch)/m.test(e))return null;let t=e.match(/[^\n]*\n|[^\n]+$/g)??[];if(t.length>3e3)return null;let n=[],r=0,i=0;for(let e of t){let t=e.replace(/\r?\n$/,``),a,o=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@(?:.*)$/.exec(t);if(t.startsWith(`diff --git `))a=`header`,r=0,i=0;else if(o){if(a=`hunk`,r=Number(o[1]??1),i=Number(o[2]??1),!Number.isSafeInteger(r)||!Number.isSafeInteger(i))return null}else if(t===`\\ No newline at end of file`)a=`header`;else if(r||i){if(t.startsWith(`+`))a=`addition`,i--;else if(t.startsWith(`-`))a=`deletion`,r--;else if(t.startsWith(` `))a=`context`,r--,i--;else return null;if(r<0||i<0)return null}else if(/^(?:--- |\+\+\+ |index |old mode |new mode |new file mode |deleted file mode |similarity index |dissimilarity index |rename from |rename to |copy from |copy to )/.test(t))a=`header`;else return null;n.push({kind:a,text:e})}return n}function _t({diff:e,truncated:t=!1}){let{text:n}=J(),r=(0,U.useMemo)(()=>gt(e),[e]),[i,a]=(0,U.useState)(!1),o=r!==null&&!i;return(0,Y.jsxs)(`section`,{className:`readonly-diff`,"data-readonly-diff":!0,children:[(0,Y.jsxs)(`div`,{className:`readonly-diff__toolbar`,children:[(0,Y.jsx)(`strong`,{children:n(`当前工作区差异`,`Current workspace diff`)}),r&&(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?n(`着色视图`,`Highlighted view`):n(`原始文本`,`Original text`)}),e&&(0,Y.jsx)(C,{text:e,label:n(`复制原始差异`,`Copy original diff`),copiedLabel:n(`已复制`,`Copied`)})]}),(0,Y.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`不代表所有变更都来自当前 Agent 或任务。`,`Changes are not necessarily from this Agent or task.`)}),t&&(0,Y.jsx)(`p`,{role:`status`,className:`readonly-diff__notice`,children:n(`后端返回的差异已截断,当前内容不完整。`,`The backend truncated this diff; the displayed content is incomplete.`)}),e?r?null:(0,Y.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`无法识别、二进制或较大差异:显示原始文本。`,`Unrecognized, binary or large diff: showing original text.`)}):(0,Y.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`没有工作区差异。`,`No workspace diff.`)}),(0,Y.jsx)(`pre`,{className:`readonly-diff__text`,tabIndex:0,"aria-label":n(`工作区差异文本`,`Workspace diff text`),"data-diff-mode":o?`highlighted`:`raw`,children:o?r.map((e,t)=>(0,Y.jsx)(`span`,{"data-diff-kind":e.kind,className:`readonly-diff__line--${e.kind}`,children:e.text},t)):e})]})}async function vt(e,t,n){let r=new URLSearchParams(t),i=await fetch(`${e}?${r}`,{headers:W(),signal:n,cache:`no-store`});if(!i.ok){let t=await i.json().catch(()=>({}));throw Error(t.detail||t.error||`${e} failed (${i.status})`)}return i.json()}var yt=(e,t)=>({sid:e,workspace_id:t}),bt={profiles:(e,t)=>vt(`/api/v2/workspaces`,{sid:e},t),tree:(e,t,n)=>vt(`/api/v2/workspace/tree`,yt(e,t),n),file:(e,t,n,r)=>vt(`/api/v2/workspace/file`,{...yt(e,t),path:n},r),git:(e,t,n)=>vt(`/api/v2/workspace/git`,yt(e,t),n),literature:(e,t,n)=>vt(`/api/v2/workspace/literature`,yt(e,t),n),rawUrl:(e,t,n)=>`/api/v2/workspace/raw?${new URLSearchParams({...yt(e,t),path:n})}`,rawBlob:async(e,t,n,r)=>{let i=await fetch(`/api/v2/workspace/raw?${new URLSearchParams({...yt(e,t),path:n})}`,{headers:W(),signal:r,cache:`no-store`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`raw preview failed (${i.status})`)}return i.blob()}};function xt(e){let t=new Map;e.forEach(e=>t.set(e.path,{...e,children:[]}));let n=[];t.forEach(e=>{let r=e.path.lastIndexOf(`/`),i=r>=0?e.path.slice(0,r):``,a=i?t.get(i):null;a?a.children.push(e):n.push(e)});let r=e=>{e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1),e.forEach(e=>r(e.children))};return r(n),n}function St(e,t,n){let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(``);return(0,U.useEffect)(()=>{if(i(``),o(``),!e||!t||!n)return;let r=new AbortController,a=``;return bt.rawBlob(e,t,n,r.signal).then(e=>{a=URL.createObjectURL(e),i(a)},e=>{r.signal.aborted||o(e.message)}),()=>{r.abort(),a&&URL.revokeObjectURL(a)}},[n,e,t]),{url:r,error:a}}function Ct(e,t,n=!0){let i=r({queryKey:[`workspace-profiles`,e],queryFn:({signal:t})=>bt.profiles(e,t),staleTime:1e4,enabled:!!e&&n}),a=`argus-v2-workspace-profile:${t}:${e}`,[o,s]=(0,U.useState)(()=>F(a)||``),c=(0,U.useMemo)(()=>{let e=i.data?.profiles??[];return e.find(e=>e.id===o)??e.find(e=>e.id===i.data?.default_id)??e.find(e=>e.canonical)??e[0]??null},[i.data,o]);return(0,U.useEffect)(()=>{c&&c.id!==o&&s(c.id)},[c,o]),{profiles:i,active:c,workspaceId:c?.id??``,setWorkspaceId:e=>{s(e),P(a,e)}}}function wt({node:e,depth:t,selected:n,expanded:r,onToggle:i,onSelect:a}){let o=e.type===`directory`,s=r.has(e.path);return(0,Y.jsxs)(`div`,{className:`workspace-node`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:n===e.path?`is-selected`:``,style:{paddingLeft:7+t*13},onClick:()=>o?i(e.path):a(e.path),children:[o?s?(0,Y.jsx)(_,{size:13}):(0,Y.jsx)(z,{size:13}):(0,Y.jsx)(`span`,{className:`node-spacer`}),o?(0,Y.jsx)(ke,{size:14}):(0,Y.jsx)(Te,{size:14}),(0,Y.jsx)(`span`,{children:e.name}),e.skipped?(0,Y.jsx)(`small`,{children:`restricted`}):null]}),o&&s?e.children.map(e=>(0,Y.jsx)(wt,{node:e,depth:t+1,selected:n,expanded:r,onToggle:i,onSelect:a},e.path)):null]})}function Tt({sid:e,workspaceId:t,path:n,active:i}){let{text:a}=J(),o=n.toLowerCase().slice(n.lastIndexOf(`.`)),s=[`.pdf`,`.png`,`.jpg`,`.jpeg`,`.webp`,`.svg`].includes(o),c=r({queryKey:[`workspace-file`,e,t,n],queryFn:({signal:r})=>bt.file(e,t,n,r),enabled:!!(i&&n&&t&&!s),refetchInterval:5e3}),l=St(s?e:``,s?t:``,s?n:``);if(!n)return(0,Y.jsx)(Z,{icon:Ee,title:a(`打开一个文件开始阅读`,`Open a file to start reading`),description:a(`左侧文件树展示所选代码工作区。`,`The file tree shows the selected code workspace.`)});if(s)return l.error?(0,Y.jsx)(Z,{icon:je,title:`Preview unavailable`,description:l.error}):l.url?o===`.pdf`?(0,Y.jsx)(ue,{src:l.url,name:n.split(`/`).at(-1)||n,className:`workspace-pdf`}):(0,Y.jsx)(`img`,{className:`workspace-image`,src:l.url,alt:n}):(0,Y.jsx)(`div`,{className:`editor-loading`,children:`Loading preview…`});if(c.isLoading)return(0,Y.jsxs)(`div`,{className:`editor-loading`,children:[`Opening `,n,`…`]});if(c.isError)return(0,Y.jsx)(Z,{icon:je,title:`Preview unavailable`,description:c.error.message});let u=(c.data?.content??``).split(` +`);return(0,Y.jsxs)(`div`,{className:`vscode-code`,tabIndex:0,"aria-label":a(`文件内容`,`File contents`),children:[(0,Y.jsx)(`div`,{className:`vscode-line-numbers`,children:u.map((e,t)=>(0,Y.jsx)(`span`,{children:t+1},t))}),(0,Y.jsx)(`pre`,{children:(0,Y.jsx)(`code`,{children:c.data?.content})})]})}function Et(e){let{locale:t,text:n}=J(),i=Ct(e.sid,`ide`,e.active),a=i.workspaceId,o=i.active?.path||``,[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(new Set),d=(0,U.useRef)(``),f=(0,U.useRef)(null),p=e=>{c(e);let t=f.current,n=t?.closest(`.vscode-shell`),r=t?.closest(`.ros-content`);t&&n&&r&&getComputedStyle(n).display===`flex`&&r.scrollTo({top:r.scrollTop+t.getBoundingClientRect().top-r.getBoundingClientRect().top-12,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[m,h]=(0,U.useState)(`files`),[g,y]=(0,U.useState)(`repository`),S=r({queryKey:[`workspace-tree`,e.sid,a],queryFn:({signal:t})=>bt.tree(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),C=r({queryKey:[`workspace-git`,e.sid,a],queryFn:({signal:t})=>bt.git(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),w=(0,U.useMemo)(()=>xt(S.data?.entries??[]),[S.data?.entries]);(0,U.useEffect)(()=>{c(``),u(new Set),d.current=``},[a]),(0,U.useEffect)(()=>{!a||!w.length||d.current===a||(d.current=a,u(new Set(w.filter(e=>e.type===`directory`).slice(0,5).map(e=>e.path))))},[w,a]);let T=e.events.filter(e=>[`command_execution`,`tool_use`,`tool_result`,`file_change`].includes(String(e.kind??``))).slice(-100),E=(C.data?.status??``).split(` +`).filter(Boolean),D=(C.data?.log??``).split(` +`).filter(Boolean).map(e=>{let[t,n,r,...i]=e.split(` `);return{hash:t,date:n,author:r,subject:i.join(` `)}}),O=C.data;return(0,Y.jsxs)(`div`,{className:`ros-page ide-v3`,children:[(0,Y.jsxs)(`header`,{className:`ros-page-header`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`eyebrow`,children:`AI IDE`}),(0,Y.jsx)(`h1`,{children:n(`代码工作区`,`Code workspace`)}),(0,Y.jsx)(`p`,{children:n(`此视图只用于浏览文件、Git 状态与 Argus 活动;不限制 Agent 本身的文件写入权限。`,`This view only browses files, Git state and Argus activity; it does not restrict the Agent’s file write permissions.`)})]}),(0,Y.jsxs)(X,{tone:`info`,children:[(0,Y.jsx)(je,{size:12}),n(`此视图只读`,`This view is read-only`)]})]}),(0,Y.jsxs)(`div`,{className:`ide-context-strip`,children:[(0,Y.jsx)(Ne,{size:15}),(0,Y.jsx)(`select`,{"aria-label":n(`选择已批准工作区`,`Select approved workspace`),value:a,onChange:e=>i.setWorkspaceId(e.target.value),children:i.profiles.data?.profiles.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,Y.jsx)(`code`,{children:o}),S.isError?(0,Y.jsx)(X,{tone:`danger`,children:n(`连接失败`,`Connection failed`)}):S.isFetching?(0,Y.jsx)(X,{tone:`live`,dot:!0,children:n(`同步中`,`Syncing`)}):(0,Y.jsxs)(X,{tone:`success`,children:[(0,Y.jsx)(R,{size:11}),`Synced`]}),(0,Y.jsxs)(`small`,{children:[S.data?.entries.length??0,` entries`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{S.refetch(),C.refetch()},"aria-label":n(`刷新工作区`,`Refresh workspace`),children:(0,Y.jsx)(b,{size:14})})]}),(0,Y.jsxs)(`div`,{className:`vscode-shell`,children:[(0,Y.jsxs)(`nav`,{className:`vscode-activitybar`,children:[(0,Y.jsx)(`button`,{type:`button`,className:m===`files`?`is-active`:``,onClick:()=>h(`files`),title:`Explorer`,"aria-label":`Explorer`,children:(0,Y.jsx)(De,{size:21})}),(0,Y.jsxs)(`button`,{type:`button`,className:m===`git`?`is-active`:``,onClick:()=>h(`git`),title:`Source Control`,"aria-label":`Source Control`,children:[(0,Y.jsx)(j,{size:21}),E.length?(0,Y.jsx)(`i`,{children:E.length}):null]})]}),(0,Y.jsxs)(`aside`,{className:`vscode-sidebar`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`span`,{children:m===`git`?`SOURCE CONTROL`:`EXPLORER`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void S.refetch(),"aria-label":n(`刷新文件树`,`Refresh file tree`),children:(0,Y.jsx)(b,{size:14})})]}),m===`files`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`vscode-root`,children:[(0,Y.jsx)(_,{size:13}),(0,Y.jsx)(`strong`,{title:o,children:o.split(/[\\/]/).filter(Boolean).at(-1)||o})]}),(0,Y.jsx)(`div`,{className:`workspace-tree`,children:S.isError?(0,Y.jsx)(Z,{icon:Ne,title:n(`目录连接失败`,`Directory connection failed`),description:S.error.message}):w.map(e=>(0,Y.jsx)(wt,{node:e,depth:0,selected:s,expanded:l,onToggle:e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:p},e.path))})]}):(0,Y.jsx)(`div`,{className:`vscode-changes`,children:E.length?E.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{let t=e.slice(3).trim(),n=t.includes(` -> `)?t.split(` -> `).at(-1):t;n.endsWith(`/`)||p(n)},children:[(0,Y.jsx)(`b`,{children:e.slice(0,2).trim()||`?`}),(0,Y.jsx)(`span`,{children:e.slice(3)})]},e)):(0,Y.jsx)(`p`,{children:`No changes`})})]}),(0,Y.jsxs)(`main`,{className:`vscode-editor`,ref:f,children:[(0,Y.jsx)(`div`,{className:`vscode-tabs`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`is-active`,children:[(0,Y.jsx)(re,{size:13}),s||`Welcome`]})}),(0,Y.jsx)(`div`,{className:`vscode-breadcrumbs`,children:s?s.split(`/`).map((e,t)=>(0,Y.jsxs)(`span`,{children:[e,ty(`changes`),children:`Changes`}),(0,Y.jsx)(`button`,{type:`button`,className:g===`timeline`?`is-active`:``,onClick:()=>y(`timeline`),children:`Timeline`}),(0,Y.jsx)(`button`,{type:`button`,className:g===`repository`?`is-active`:``,onClick:()=>y(`repository`),children:`Repository`})]}),(0,Y.jsx)(`div`,{className:`vscode-git-content`,children:O?.available?g===`changes`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`vscode-status`,children:O.status||`Working tree clean`}),(0,Y.jsx)(_t,{diff:O.diff,truncated:O.truncated})]}):g===`timeline`?(0,Y.jsx)(`div`,{className:`vscode-commits`,children:D.map(e=>(0,Y.jsxs)(`article`,{children:[(0,Y.jsx)(j,{size:13}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.subject}),(0,Y.jsxs)(`small`,{children:[e.author,` · `,e.date?.slice(0,10)]})]})]},e.hash))}):(0,Y.jsxs)(`div`,{className:`repository-readiness`,children:[(0,Y.jsx)(`h3`,{children:`Repository readiness`}),(0,Y.jsxs)(`dl`,{children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(j,{size:13}),`Remote`]}),(0,Y.jsx)(`dd`,{children:O.remotes.length?O.remotes.map(e=>`${e.name}: ${e.fetch}`).join(` +`):`Not configured`}),(0,Y.jsx)(`i`,{className:O.remotes.length?`ok`:`missing`,children:O.remotes.length?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(j,{size:13}),`Upstream`]}),(0,Y.jsxs)(`dd`,{children:[O.upstream||`Not configured`,O.upstream?` · ahead ${O.ahead}, behind ${O.behind}`:``]}),(0,Y.jsx)(`i`,{className:O.upstream?`ok`:`missing`,children:O.upstream?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(Ie,{size:13}),`Commit identity`]}),(0,Y.jsx)(`dd`,{children:O.identity.name&&O.identity.email?`${O.identity.name} <${O.identity.email}>`:`Not configured`}),(0,Y.jsx)(`i`,{className:O.identity.valid?`ok`:`missing`,children:O.identity.valid?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(Ae,{size:13}),`GitHub CLI`]}),(0,Y.jsx)(`dd`,{children:O.github.authenticated?`${O.github.login} · ${O.github.protocol}`:`Not authenticated`}),(0,Y.jsx)(`i`,{className:O.github.authenticated?`ok`:`missing`,children:O.github.authenticated?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]})]}),(0,Y.jsx)(`p`,{children:O.publish_ready?`Repository is ready for an explicitly approved push.`:`Configure the missing items before publishing. No credentials are shown in this UI.`})]}):(0,Y.jsx)(Z,{icon:j,title:`Not a Git repository`})})]}),(0,Y.jsxs)(`section`,{className:`vscode-terminal`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`strong`,{children:`ARGUS ACTIVITY`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(Fe,{size:13}),`read-only`]})]}),(0,Y.jsx)(`div`,{children:T.length?T.map((e,r)=>(0,Y.jsxs)(`article`,{children:[(0,Y.jsx)(`time`,{children:Xe(e.ts,t)}),(0,Y.jsx)(`b`,{className:`terminal-role`,style:{color:k(Qe(e))},children:qe(Qe(e),n)}),(0,Y.jsx)(`span`,{children:`›`}),(0,Y.jsx)(`code`,{children:et(e,800)||$e(e)})]},`${e.ts}-${r}`)):(0,Y.jsx)(`p`,{children:`$ waiting for Argus activity`})})]}),(0,Y.jsxs)(`footer`,{className:`vscode-statusbar`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(j,{size:12}),O?.branch||`no branch`]}),(0,Y.jsx)(`span`,{children:S.isError?`Workspace error`:S.isFetching?`Workspace syncing`:S.data?.truncated?`Tree truncated`:`Workspace synced`}),(0,Y.jsx)(`span`,{children:O?.github.authenticated?`GitHub: ${O.github.login}`:`GitHub: offline`}),(0,Y.jsx)(`span`,{children:`UTF-8`}),(0,Y.jsx)(`span`,{children:s.split(`.`).at(-1)?.toUpperCase()||`Plain Text`})]})]})]})}var Dt=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm`;function Ot({task:e,resources:t,onChange:n,text:r}){let i=e.execution_options??[],a=(e,t)=>n(i.map(n=>n.id===e?{...n,...t}:n));return(0,Y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-dashed border-line p-3 sm:col-span-2`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium`,children:r(`期限紧张时的替代做法`,`Alternative execution options for tighter deadlines`)}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:r(`每种做法都有独立工期、资源和取舍。系统只会选择已声明保留必需验收目标的方案,不自动压缩原估计。`,`Each option has its own estimate, resources and tradeoff. Only options declared to preserve required acceptance scope can be selected.`)}),i.map(o=>(0,Y.jsxs)(`fieldset`,{disabled:e.status!=null&&e.status!==`pending`,className:`grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`text-xs sm:col-span-2`,children:[r(`替代做法`,`Alternative approach`),(0,Y.jsx)(`input`,{className:Dt,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:col-span-2`,children:[r(`替代下限(小时)`,`Option lower (h)`),r(`替代最可能(小时)`,`Option likely (h)`),r(`替代上限(小时)`,`Option upper (h)`)].map((e,t)=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,(0,Y.jsx)(`input`,{className:Dt,type:`number`,min:`0`,step:`any`,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),t.map(e=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,` `,r(`需求`,`required`),(0,Y.jsx)(`input`,{className:Dt,type:`number`,min:`0`,step:`1`,value:o.resources[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e)),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[r(`替代工期依据`,`Option estimate basis`),(0,Y.jsx)(`textarea`,{"aria-label":r(`替代工期依据`,`Option estimate basis`),className:Dt,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[r(`取舍与适用条件`,`Tradeoff and prerequisites`),(0,Y.jsx)(`textarea`,{"aria-label":r(`取舍与适用条件`,`Tradeoff and prerequisites`),className:Dt,value:o.tradeoff,onChange:e=>a(o.id,{tradeoff:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`flex gap-2 text-xs sm:col-span-2`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:o.preserves_acceptance,onChange:e=>a(o.id,{preserves_acceptance:e.target.checked})}),r(`确认条件适用且保留必需验收目标,允许重排时采用`,`Prerequisites apply and required acceptance is preserved; allow automatic selection`)]}),(0,Y.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>n(i.filter(e=>e.id!==o.id)),children:r(`移除替代做法`,`Remove alternative`)})]},o.id)),(0,Y.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-xs`,disabled:i.length>=8||e.status!=null&&e.status!==`pending`,onClick:()=>{let t=i.length+1;for(;i.some(e=>e.id===`option-${t}`);)t++;n([...i,{id:`option-${t}`,title:r(`新的替代做法`,`New alternative`),duration_hours:[...e.duration_hours],resources:{...e.resources},basis:e.basis,tradeoff:r(`待补充适用条件与取舍`,`Specify prerequisites and tradeoffs`),preserves_acceptance:!1}])},children:r(`添加替代做法`,`Add alternative`)})]})}var Q=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm text-ink`;function kt({input:e,onChange:t,text:n,forecast:r}){let i=e.proposals.find(t=>t.id===e.selected_proposal_id),a=(n,r)=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.map(e=>e.id===n?{...e,...r}:e)}:e)});return(0,Y.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`任务与实验`,`Tasks and experiments`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`h3`,{className:`font-medium`,children:n(`任务与实验`,`Tasks and experiments`)}),(0,Y.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-sm`,onClick:()=>{let r=i.tasks.length+1;for(;i.tasks.some(e=>e.id===`task-${r}`);)r++;t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:[...e.tasks,{id:`task-${r}`,title:n(`新增实验`,`New experiment`),phase:`experiment`,duration_hours:[1,2,8],basis:n(`初步估计,待实测校准`,`Preliminary estimate; needs calibration`)}]}:e)})},children:n(`添加任务`,`Add task`)})]}),i.tasks.map(o=>{let s=[`running`,`completed`,`failed`].includes(o.status??`pending`),c=[`completed`,`failed`].includes(o.status??`pending`);return(0,Y.jsxs)(`details`,{className:`rounded-xl border border-line p-3`,children:[(0,Y.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,Y.jsx)(`strong`,{children:o.title}),(0,Y.jsxs)(`span`,{className:`ml-2 text-ink-faint`,children:[o.duration_hours.join(` / `),` h · `,o.id]})]}),(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`任务名称`,`Task name`),(0,Y.jsx)(`input`,{className:Q,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`阶段`,`Phase`),(0,Y.jsx)(`input`,{className:Q,value:o.phase,onChange:e=>a(o.id,{phase:e.target.value})})]}),(0,Y.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`乐观(小时)`,`Lower (hours)`),n(`最可能(小时)`,`Likely (hours)`),n(`悲观(小时)`,`Upper (hours)`)].map((e,t)=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,disabled:s,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`估计依据`,`Estimate basis`),(0,Y.jsx)(`textarea`,{"aria-label":n(`估计依据`,`Estimate basis`),className:Q,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`模型 / 实现难度`,`Model / implementation difficulty`),(0,Y.jsx)(`textarea`,{"aria-label":n(`模型 / 实现难度`,`Model / implementation difficulty`),className:Q,value:o.difficulty??``,onChange:e=>a(o.id,{difficulty:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`前置任务(可多选)`,`Dependencies (multiple)`),(0,Y.jsx)(`select`,{"aria-label":n(`前置任务(可多选)`,`Dependencies (multiple)`),multiple:!0,className:Q,disabled:s,value:o.depends_on??[],onChange:e=>a(o.id,{depends_on:Array.from(e.target.selectedOptions,e=>e.value)}),children:i.tasks.filter(e=>e.id!==o.id).map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.keys(e.resources).map(e=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`占用`,`slots`),(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`1`,className:Q,disabled:s,value:o.resources?.[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e))}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`进展状态`,`Progress status`),(0,Y.jsx)(`select`,{"aria-label":n(`进展状态`,`Progress status`),className:Q,disabled:c||e.adapt_to_deadline&&!s&&!r,value:o.status??`pending`,onChange:t=>{let n=t.target.value,i=r?.schedule.find(e=>e.id===o.id),c=!s&&[`running`,`completed`,`failed`].includes(n)&&i?{duration_hours:i.duration_hours??o.duration_hours,resources:i.resources,execution_option_id:i.execution_option_id??`standard`,basis:i.basis}:{};a(o.id,{status:n,...c,...n===`running`?{actual_start_hours:o.actual_start_hours??e.now_hours,remaining_hours:o.remaining_hours??[...c.duration_hours??o.duration_hours]}:{},...[`completed`,`failed`].includes(n)?{actual_start_hours:o.actual_start_hours??0,actual_finish_hours:e.now_hours}:{}})},children:[[`pending`,`未开始`,`Pending`],[`running`,`运行中`,`Running`],[`completed`,`已完成`,`Completed`],[`failed`,`失败`,`Failed`],[`blocked`,`受阻`,`Blocked`]].filter(([e])=>!s||![`pending`,`blocked`].includes(e)).map(([e,t,r])=>(0,Y.jsx)(`option`,{value:e,children:n(t,r)},e))})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:o.optional??!1,onChange:e=>a(o.id,{optional:e.target.checked})}),n(`可选 / 已退出交付路径`,`Optional / retired from delivery path`)]}),s&&(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`实际开始(项目第几小时)`,`Actual start (project hour)`),(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,value:o.actual_start_hours??0,onChange:e=>a(o.id,{actual_start_hours:Number(e.target.value)})})]}),c&&(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`实际结束(项目第几小时)`,`Actual finish (project hour)`),(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,value:o.actual_finish_hours??0,onChange:e=>a(o.id,{actual_finish_hours:Number(e.target.value)})})]}),o.status===`running`&&(0,Y.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`剩余下限`,`Remaining lower`),n(`剩余最可能`,`Remaining likely`),n(`剩余上限`,`Remaining upper`)].map((e,t)=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,value:o.remaining_hours?.[t]??0,onChange:e=>{let n=[...o.remaining_hours??o.duration_hours];n[t]=Number(e.target.value),a(o.id,{remaining_hours:n})}})]},e))}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`变化 / 延期原因`,`Change / delay reason`),(0,Y.jsx)(`textarea`,{"aria-label":n(`变化 / 延期原因`,`Change / delay reason`),className:Q,value:o.reason??``,onChange:e=>a(o.id,{reason:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`证据引用(每行一个)`,`Evidence references (one per line)`),(0,Y.jsx)(`textarea`,{"aria-label":n(`证据引用(每行一个)`,`Evidence references (one per line)`),className:Q,value:(o.evidence??[]).join(` +`),onChange:e=>a(o.id,{evidence:e.target.value.split(` +`).filter(Boolean)})})]}),(0,Y.jsx)(Ot,{task:o,resources:Object.keys(e.resources),onChange:e=>a(o.id,{execution_options:e}),text:n}),!s&&i.tasks.length>1&&(0,Y.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.filter(e=>e.id!==o.id)}:e)}),children:n(`移除未开始任务`,`Remove unstarted task`)})]})]},o.id)})]})}function At({report:e,selectedId:t,text:n}){let r=e.proposals.find(e=>e.id===t),i=Math.max(1,...r.schedule.map(e=>e.finish_hours));return(0,Y.jsxs)(`div`,{className:`space-y-5`,"aria-label":n(`排期结果`,`Timeline results`),children:[(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:e.proposals.map(e=>(0,Y.jsxs)(`div`,{className:`rounded-xl border p-4 ${e.id===t?`border-blue`:`border-line`}`,children:[(0,Y.jsx)(`div`,{className:`text-xs text-ink-faint`,children:e.id===t?n(`已选方案`,`Selected proposal`):n(`备选方案`,`Alternative`)}),(0,Y.jsx)(`h3`,{className:`mt-1 text-sm font-medium`,children:e.title}),(0,Y.jsx)(`div`,{className:`mt-3 text-2xl font-semibold`,children:e.finish_hours?`${e.finish_hours.expected.toFixed(1)} h`:n(`待重规划`,`Needs replanning`)}),e.finish_hours&&(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[n(`区间`,`Range`),` `,e.finish_hours.lower.toFixed(1),`–`,e.finish_hours.upper.toFixed(1),` h · `,n(`剩余`,`Remaining`),` `,e.remaining_hours?.toFixed(1),` h`]}),e.deadline_gap_hours!=null&&(0,Y.jsxs)(`p`,{className:`mt-2 text-xs ${e.deadline_gap_hours>0?`text-red`:`text-ink-faint`}`,children:[n(`预计超期`,`Forecast overrun`),` `,e.deadline_gap_hours.toFixed(1),` h`]})]},e.id))}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`初步估计,非成功承诺。区间覆盖已列出的工作;验证失败后的新增实验可能超出上限。各方案作为备选单独计算。`,`Preliminary estimates, not success guarantees. New experiments after a failed premise can exceed the range. Proposals are estimated as alternatives.`)}),r.adaptation&&(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-blue/40 bg-blue/5 p-4`,"aria-label":n(`根据期限重排`,`Deadline adaptation`),children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`根据期限重排`,`Deadline adaptation`)}),r.adaptation.baseline_finish_hours&&r.finish_hours&&(0,Y.jsxs)(`p`,{className:`text-sm`,children:[n(`调整前`,`Before`),` `,(0,Y.jsxs)(`strong`,{children:[r.adaptation.baseline_finish_hours.expected.toFixed(1),` h`]}),` → `,n(`当前方案`,`Current plan`),` `,(0,Y.jsxs)(`strong`,{children:[r.finish_hours.expected.toFixed(1),` h`]})]}),r.adaptation.status===`gap`&&(0,Y.jsx)(`p`,{className:`text-sm text-red`,children:n(`已尝试可用的重排方式,仍无法满足期限。需要增加资源、提出新的执行方案,或调整交付目标。`,`Available adjustments still miss the deadline. More resources, another execution option, or a revised deliverable are needed.`)}),r.adaptation.status===`fits`&&r.finish_hours&&r.adaptation.target_hours!=null&&r.finish_hours.upper>r.adaptation.target_hours&&(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`点估计可按期;悲观情景仍可能超期,请留意区间上限。`,`The point estimate fits; the upper scenario can still miss the deadline.`)}),r.adaptation.changes.length===0&&(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`沿用原 proposal 的任务与做法;当前期限无需进一步调整,或尚无可用的替代做法。`,`Keeping the original tasks and approaches; no further adjustment is needed or no usable alternative is available.`)}),r.adaptation.changes.map(e=>(0,Y.jsxs)(`div`,{className:`border-t border-line/60 pt-2 text-xs`,children:[(0,Y.jsxs)(`p`,{className:`font-medium`,children:[e.title,e.option_title?` → ${e.option_title}`:``]}),e.from_duration_hours&&e.to_duration_hours&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[n(`任务估计(下限 / 最可能 / 上限)`,`Task estimate (lower / likely / upper)`),`: `,e.from_duration_hours.join(` / `),` → `,e.to_duration_hours.join(` / `),` h`]}),e.from_start_hours!=null&&e.to_start_hours!=null&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[n(`开始时间`,`Start time`),`: `,e.from_start_hours.toFixed(1),` → `,e.to_start_hours.toFixed(1),` h`]}),(0,Y.jsx)(`p`,{className:`mt-1 text-ink-faint`,children:e.reason}),e.tradeoff&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[n(`取舍 / 条件`,`Tradeoff / prerequisites`),`: `,e.tradeoff]})]},`${e.kind}:${e.id}`))]}),(0,Y.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,Y.jsxs)(`h3`,{className:`mb-4 text-sm font-medium`,children:[n(`实验排布`,`Experiment schedule`),` · `,n(`从项目开始计时`,`Hours from project start`)]}),(0,Y.jsx)(`div`,{className:`space-y-3`,children:r.schedule.map(e=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs`,children:[(0,Y.jsx)(`span`,{children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-ink-faint`,children:[e.start_hours.toFixed(1),`–`,e.finish_hours.toFixed(1),` h`]})]}),(0,Y.jsx)(`div`,{className:`h-2.5 rounded-full bg-line/40`,role:`img`,"aria-label":`${e.title}: ${e.start_hours.toFixed(1)}–${e.finish_hours.toFixed(1)} h`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full ${e.status===`failed`?`bg-red`:e.status===`completed`?`bg-emerald-500`:`bg-blue`}`,style:{marginLeft:`${e.start_hours/i*100}%`,width:`${Math.max(.3,(e.finish_hours-e.start_hours)/i*100)}%`}})})]},e.id))})]}),r.deferred_task_ids.length>0&&(0,Y.jsxs)(`p`,{className:`rounded-lg border border-line p-3 text-sm`,children:[n(`为满足期限延后的可选任务`,`Optional tasks deferred for the deadline`),`: `,r.deferred_task_ids.join(`, `)]}),[...r.failed_tasks,...r.blocked_tasks].map(e=>(0,Y.jsxs)(`p`,{role:`alert`,className:`rounded-lg border border-red/40 p-3 text-sm`,children:[e.id,`: `,e.reason]},e.id)),(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsx)(`tr`,{children:[n(`任务`,`Task`),n(`资源`,`Resources`),n(`排队`,`Queue`),n(`估计依据`,`Estimate basis`)].map(e=>(0,Y.jsx)(`th`,{className:`border-b border-line p-2`,children:e},e))})}),(0,Y.jsx)(`tbody`,{children:r.schedule.map(e=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{className:`border-b border-line p-2`,children:e.title}),(0,Y.jsx)(`td`,{className:`border-b border-line p-2`,children:Object.entries(e.resources).map(([e,t])=>`${e} × ${t}`).join(`, `)||`—`}),(0,Y.jsxs)(`td`,{className:`border-b border-line p-2`,children:[e.resource_wait_hours.toFixed(1),` h`]}),(0,Y.jsx)(`td`,{className:`border-b border-line p-2`,children:e.basis})]},e.id))})]})}),e.revision&&(0,Y.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`版本对照与延期原因`,`Revision and delay reasons`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm`,children:e.revision.reason}),(0,Y.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[n(`初版预计`,`Original forecast`),`: `,e.revision.baseline_finish_hours?.toFixed(1)??`—`,` h · `,n(`相对初版变化`,`Change from original`),`: `,e.revision.baseline_delta_hours?.toFixed(1)??`—`,` h`]}),e.revision.task_variances.map((e,t)=>(0,Y.jsxs)(`p`,{className:`mt-3 text-xs`,children:[e.id,` · `,e.observed?n(`实际延期`,`Observed delay`):n(`预测延期`,`Forecast delay`),` `,e.delay_hours.toFixed(1),` h — `,e.reason,(0,Y.jsx)(`br`,{}),e.evidence.join(`, `)]},`${e.id}-${t}`))]})]})}function jt(e){return{...e,resources:e.resources??{},now_hours:e.now_hours??0,defer_optional:e.defer_optional??!1}}var $=`w-full rounded-lg border border-line bg-transparent px-3 py-2 text-sm text-ink`,Mt=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40`;function Nt({sid:e}){let{locale:t}=d(),n=(e,n)=>t===`zh-CN`?e:n,[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!0),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(``),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(``),[D,O]=(0,U.useState)(``),[k,A]=(0,U.useState)(0),j=!!(r&&JSON.stringify(r)!==JSON.stringify(a?.input));return(0,U.useEffect)(()=>{let t=!0;return u(!0),p(!1),y(``),i(null),o(null),c(null),q.timelineLatest(e).then(({latest:e})=>{if(!t)return;let n=e?{...e,input:jt(e.input)}:null;o(n),i(n?.input??null),c(n?.report??null),T(``),C(``),p(!0)}).catch(e=>{t&&y(e.message)}).finally(()=>{t&&u(!1)}),()=>{t=!1}},[e,k]),(0,U.useEffect)(()=>{if(c(null),x(``),!r){_(!1);return}if(a&&JSON.stringify(r)===JSON.stringify(a.input)){c(a.report),_(!1);return}let e=new AbortController;_(!0);let t=setTimeout(()=>{q.timelineEstimate(r,e.signal).then(t=>{e.signal.aborted||c(t)}).catch(t=>{e.signal.aborted||x(t.message)}).finally(()=>{e.signal.aborted||_(!1)})},350);return()=>{clearTimeout(t),e.abort()}},[r,a]),l?(0,Y.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-ink-faint`,children:n(`正在读取已保存计划…`,`Loading saved timeline…`)}):(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 p-4 sm:p-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-xs text-blue`,children:`PROPOSAL → EXPERIMENT → PAPER`}),(0,Y.jsx)(`h2`,{className:`mt-1 text-xl font-semibold`,children:n(`研究排期`,`Research timeline`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`选择 idea 和期望期限,查看具体工期、实验排布与调整原因。`,`Choose an idea and deadline to see estimates, experiment schedules, and reasons for changes.`)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(`button`,{className:Mt,disabled:m||!f,onClick:async()=>{h(!0),y(``),C(``);try{i(await q.timelineExample()),T(n(`加载演示 proposal`,`Load demonstration proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`加载论文示例`,`Load paper example`)}),(0,Y.jsx)(`button`,{className:Mt,disabled:m,onClick:()=>A(e=>e+1),children:n(`重新载入已保存计划`,`Reload saved timeline`)}),r&&(0,Y.jsx)(`button`,{className:Mt,onClick:()=>E(new Blob([JSON.stringify(r,null,2)],{type:`application/json`}),`proposal.json`),children:n(`导出 proposal`,`Export proposal`)})]})]}),v&&(0,Y.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[v,(0,Y.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n(`若提示版本冲突,先导出当前草稿,再重新载入已保存计划。`,`For a version conflict, export your draft before reloading the saved timeline.`)})]}),S&&(0,Y.jsx)(`p`,{role:`status`,className:`rounded-xl border border-blue/40 p-3 text-sm`,children:S}),!r&&(0,Y.jsxs)(`section`,{className:`rounded-xl border border-dashed border-line p-8 text-center`,children:[(0,Y.jsx)(`h3`,{className:`font-medium`,children:n(`还没有研究排期`,`No research timeline yet`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`点击“加载论文示例”即可验证完整流程,也可以在下方导入自己的 proposal。示例数字仅用于演示。`,`Load the paper example to try the complete flow, or import your proposal below. Example numbers are illustrative.`)})]}),r&&(0,Y.jsxs)(`div`,{className:`grid items-start gap-6`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 360px), 1fr))`},children:[(0,Y.jsxs)(`fieldset`,{disabled:m,className:`min-w-0 space-y-5`,children:[(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[n(`选择 idea / proposal`,`Choose idea / proposal`),(0,Y.jsx)(`select`,{"aria-label":n(`选择 idea / proposal`,`Choose idea / proposal`),className:$,value:r.selected_proposal_id,onChange:e=>i({...r,selected_proposal_id:e.target.value}),children:r.proposals.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[n(`方案名称`,`Proposal title`),(0,Y.jsx)(`input`,{className:$,value:r.proposals.find(e=>e.id===r.selected_proposal_id).title,onChange:e=>i({...r,proposals:r.proposals.map(t=>t.id===r.selected_proposal_id?{...t,title:e.target.value}:t)})})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`期望完成时间(小时)`,`Target finish (hours)`),(0,Y.jsx)(`input`,{className:$,type:`number`,min:`0`,step:`any`,value:r.deadline_hours??``,placeholder:n(`不限`,`No deadline`),onChange:e=>i({...r,deadline_hours:e.target.value===``?null:Number(e.target.value)})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`已过去时间(小时)`,`Elapsed time (hours)`),(0,Y.jsx)(`input`,{className:$,type:`number`,min:`0`,step:`any`,value:r.now_hours,onChange:e=>i({...r,now_hours:Number(e.target.value)})})]}),Object.entries(r.resources).map(([e,t])=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`可用槽位`,`available slots`),(0,Y.jsx)(`input`,{className:$,type:`number`,min:`1`,step:`1`,value:t,onChange:t=>i({...r,resources:{...r.resources,[e]:Number(t.target.value)}})})]},e))]}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`所有时间从项目开始计时;例如 120 小时 = 第 5 天。资源按持续可用计算。`,`All times count from project start; 120 hours means day 5. Resources are assumed continuously available.`)}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r.adapt_to_deadline??!1,onChange:e=>i({...r,adapt_to_deadline:e.target.checked})}),n(`根据期限自动重排任务、选择替代做法并更新区间`,`Adapt task order, execution options and estimate ranges to the deadline`)]}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`缩短期限时优先调整关键路径;延长期限时恢复原做法和可选工作。替代做法可在任务中编辑。`,`Tighter deadlines prioritize the critical path; longer deadlines restore preferred approaches and optional work. Edit alternatives inside each task.`)}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r.defer_optional,onChange:e=>i({...r,defer_optional:e.target.checked})}),n(`超期时延后可选任务,保留必需实验`,`Defer optional tasks when over deadline; keep required experiments`)]}),(0,Y.jsx)(`button`,{className:Mt,onClick:()=>{let e=r.proposals.length+1;for(;r.proposals.some(t=>t.id===`idea-${e}`);)e++;let t=`idea-${e}`;i({...r,selected_proposal_id:t,proposals:[...r.proposals,{id:t,title:n(`新 proposal`,`New proposal`),tasks:[{id:`validation`,title:n(`关键假设验证`,`Validate the key premise`),phase:`validation`,duration_hours:[2,4,16],basis:n(`初步估计,待校准`,`Preliminary, uncalibrated estimate`)}]}]})},children:n(`添加候选方案`,`Add proposal`)})]}),(0,Y.jsx)(kt,{input:r,onChange:i,text:n,forecast:g?void 0:s?.proposals.find(e=>e.id===r.selected_proposal_id)}),(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[n(`本次保存 / 调整原因`,`Reason for this revision`),(0,Y.jsx)(`textarea`,{"aria-label":n(`本次保存 / 调整原因`,`Reason for this revision`),className:$,value:w,onChange:e=>T(e.target.value),placeholder:n(`说明为什么改变计划;延期请在具体任务中填写证据`,`Explain the change; add delay evidence on the affected task`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[a?n(`已保存 v${a.version}`,`Saved v${a.version}`):n(`未保存`,`Not saved`),j?n(` · 有未保存修改`,` · Unsaved changes`):``]}),(0,Y.jsx)(`button`,{className:`${Mt} border-blue bg-blue/10`,disabled:!f||!j||!s||g||!!b||!w.trim(),onClick:async()=>{if(!(!r||!s||g||!w.trim())){h(!0),y(``),C(``);try{let t=await q.timelineSave(e,r,a?.version??0,w);o(t),i(t.input),c(t.report),T(``),C(n(`已保存版本 ${t.version},刷新页面后仍可查看。`,`Version ${t.version} saved. It survives a page refresh.`))}catch(e){y(e.message)}finally{h(!1)}}},children:n(`保存计划版本`,`Save timeline version`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`保存计划不会启动实验。实际进展和失败原因由实验结果或操作者更新。`,`Saving a timeline does not start experiments. Update progress and failure reasons from actual results.`)})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[g&&(0,Y.jsx)(`p`,{role:`status`,className:`text-sm text-ink-faint`,children:n(`正在更新排期…`,`Updating schedule…`)}),b&&(0,Y.jsxs)(`p`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[n(`无法计算,请检查估计区间、依赖和资源:`,`Cannot calculate; check ranges, dependencies, and resources: `),b]}),!g&&s&&(0,Y.jsx)(At,{report:s,selectedId:r.selected_proposal_id,text:n})]})]}),(0,Y.jsxs)(`details`,{className:`rounded-xl border border-line p-4`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:n(`导入自己的 proposal(JSON)`,`Import your proposal (JSON)`)}),(0,Y.jsx)(`textarea`,{className:`${$} mt-3 font-mono`,rows:6,"aria-label":n(`Proposal JSON`,`Proposal JSON`),value:D,onChange:e=>O(e.target.value)}),(0,Y.jsx)(`button`,{className:`${Mt} mt-2`,disabled:!f||m||!D.trim(),onClick:async()=>{h(!0),y(``);try{let e=JSON.parse(D);await q.timelineEstimate(e),i(jt(e)),T(n(`导入 proposal`,`Import proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`校验并导入`,`Validate and import`)})]})]})}function Pt(e){let t=Math.ceil(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}var Ft={available:`bg-ok/10 text-ok`,absent:`bg-bg text-ink-faint`,inaccessible:`bg-warn/10 text-warn`,degraded:`bg-warn/10 text-warn`};function It({status:e,error:t}){let{t:n,locale:r}=d(),i=r===`zh-CN`;return(0,Y.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:n(`resource.title`)}),e?(0,Y.jsx)(`span`,{className:`rounded px-2 py-1 text-[10px] font-semibold uppercase ${e.enforcement===`strict`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:B(e.enforcement,n)}):null]}),t?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-err`,children:t}):null,!e&&!t?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:n(`resource.loading`)}):null,e?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.accelerators.map(e=>(0,Y.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:be(e.kind,n)}),(0,Y.jsxs)(`span`,{className:`rounded px-2 py-0.5 text-[10px] font-medium ${Ft[e.status]}`,children:[ie(e.status,n),` · `,n(`resource.devices`,{count:e.device_count})]})]}),e.detail?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:e.detail}):null]},e.kind))}),(0,Y.jsx)(`div`,{className:`gpu-device-grid`,children:e.accelerators.flatMap(e=>(e.devices??[]).map(t=>{let r=t.utilization_percent>0?`computing`:t.reserved?`reserved`:t.used_memory_mib>0?`allocated`:`quiet`,a=r===`computing`?i?`正在计算`:`Computing`:r===`reserved`?i?`已预留`:`Reserved`:r===`allocated`?i?`显存占用`:`Memory occupied`:i?`暂无活动`:`No activity`,o=t.total_memory_mib>0?Math.min(100,t.used_memory_mib/t.total_memory_mib*100):0;return(0,Y.jsxs)(`article`,{className:`gpu-device-card`,"data-gpu-state":r,"aria-label":`GPU ${t.index} · ${t.name} · ${a}`,children:[(0,Y.jsxs)(`div`,{className:`gpu-device-header`,children:[(0,Y.jsx)(`span`,{className:`gpu-device-icon`,"aria-hidden":`true`,children:(0,Y.jsx)(we,{size:26,strokeWidth:1.5})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`gpu-device-number`,children:[be(e.kind,n),` · GPU `,t.index]}),(0,Y.jsx)(`h4`,{children:t.name})]}),(0,Y.jsxs)(`span`,{className:`gpu-device-status`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),a]})]}),(0,Y.jsxs)(`div`,{className:`gpu-device-meter`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:i?`计算负载`:`Compute load`}),(0,Y.jsxs)(`strong`,{children:[t.utilization_percent,`%`]})]}),(0,Y.jsx)(`div`,{role:`meter`,"aria-label":i?`计算负载`:`Compute load`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t.utilization_percent,children:(0,Y.jsx)(`i`,{style:{width:`${t.utilization_percent}%`}})})]}),(0,Y.jsxs)(`div`,{className:`gpu-device-meter`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:i?`显存`:`GPU memory`}),(0,Y.jsxs)(`strong`,{children:[(t.used_memory_mib/1024).toFixed(1),` / `,(t.total_memory_mib/1024).toFixed(1),` GiB`]})]}),(0,Y.jsx)(`div`,{role:`meter`,"aria-label":i?`显存占用`:`GPU memory usage`,"aria-valuemin":0,"aria-valuemax":t.total_memory_mib||1,"aria-valuenow":t.used_memory_mib,children:(0,Y.jsx)(`i`,{style:{width:`${o}%`}})})]}),t.reserved&&r!==`reserved`&&(0,Y.jsx)(`p`,{className:`gpu-device-note`,children:i?`已由 Argus 预留`:`Reserved by Argus`})]},`${e.kind}:${t.index}`)}))}),!!e.accelerators.some(e=>e.device_count>0&&!e.devices)&&(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:i?`当前服务尚未提供单卡详情,不能判断各卡使用情况。`:`This server has no per-device details; individual usage is unknown.`}),(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:i?`编号使用主机原始 GPU 编号。负载和显存包含其他程序;“暂无活动”只是本次采样结果,不保证设备可独占使用。`:`Numbers match host GPU indices. Load and memory include other programs. “No activity” is a sample, not a guarantee of exclusive availability.`}),(0,Y.jsxs)(`details`,{className:`mt-4`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-xs text-ink-dim`,children:i?`Argus 资源预约 ${e.holders.length} · 等待 ${e.queue.length}`:`Argus reservations ${e.holders.length} · Waiting ${e.queue.length}`}),(0,Y.jsxs)(`div`,{className:`mt-3 grid gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.inUse`,{count:e.holders.length})}),(0,Y.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.holders.length===0?(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.holders.map((e,t)=>(0,Y.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.devices`,{count:e.device_count})}),(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:Pt(e.ttl_seconds)})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)}),e.yield_requests.map((e,t)=>(0,Y.jsxs)(`div`,{className:`mt-2 border-l-2 border-warn/50 pl-2 text-ink-faint`,children:[(0,Y.jsx)(`div`,{children:n(`resource.yieldRequest`,{reason:e.reason})}),e.response?(0,Y.jsxs)(`div`,{children:[ve(e.response.decision,n),` · `,e.response.reason]}):null]},t))]},`${e.project}:${e.task_id}:${t}`))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.queue`,{count:e.queue.length})}),(0,Y.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.queue.length===0?(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.queue.map(e=>(0,Y.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.queuePosition`,{position:e.position})}),(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:Pt(e.ttl_seconds)})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)})]},e.position))})]})]})]})]}):null]})}async function Lt(e){let t=await e;if(t&&typeof t==`object`){let e=t;if(Number(e.rc??0)!==0||e.command_status===`failed`||e.command_status===`rejected`)throw Error(String(e.error||`Command ${e.command_status||`failed`}`))}return t}function Rt({sid:e,snapshot:t,active:n,connected:i,controls:a,refresh:o,readOnly:s,onRestored:c}){let{t:l,locale:f}=d(),p=f===`zh-CN`,[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[y,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(t.session.workdir??t.session.cwd??``),[w,E]=(0,U.useState)(``),[O,k]=(0,U.useState)(``),[j,N]=(0,U.useState)(``),ne=(0,U.useRef)(!1),[re,P]=(0,U.useState)(``),[F,ie]=(0,U.useState)(null),I=r({queryKey:[`runtime-resources`],queryFn:({signal:e})=>u.resources(e),enabled:n,refetchInterval:1e4,retry:!1}),L=r({queryKey:[`runtime-trash`,O],queryFn:()=>u.trash(O),enabled:n&&g&&!s,retry:!1}),R=r({queryKey:[`runtime-metrics`],queryFn:()=>u.metrics(),enabled:n&&y,retry:!1}),z=r({queryKey:[`runtime-source-update`],queryFn:({signal:e})=>u.sourceUpdateStatus(e),enabled:n&&m&&!s,retry:!1,refetchInterval:e=>e.state.data?.running?1500:!1});(0,U.useEffect)(()=>{C(t.session.workdir??t.session.cwd??``)},[t.session.workdir,t.session.cwd]);let B=s||!!j||a.busy,oe=t.daemon.alive&&t.daemon.control_available===!1,V=t.daemon.alive&&t.daemon.protocol_compatible===!1,se=async(e,t,n)=>{if(!(s||ne.current||a.busy)){ne.current=!0,N(e),ie(null),P(``);try{await Lt(t()),P(n),await o()}catch(e){ie(me(e,l))}finally{ne.current=!1,N(``)}}},H=(e,t,n,r)=>{!B&&window.confirm(t)&&se(e,n,r)},ce=e=>e?de(e)?l(`operations.unavailableHere`):me(e,l).text:``,le=t.daemon_admission?.running_daemons??[];return(0,Y.jsxs)(`div`,{className:`runtime-control-page`,children:[(0,Y.jsxs)(`section`,{className:`runtime-summary`,children:[(0,Y.jsxs)(`div`,{className:`runtime-summary-copy`,children:[(0,Y.jsx)(`span`,{className:`runtime-eyebrow`,children:p?`运行控制`:`Runtime controls`}),(0,Y.jsx)(`h2`,{children:t.session.display_name||e}),(0,Y.jsxs)(`div`,{className:`runtime-status-line`,children:[(0,Y.jsxs)(`span`,{className:`runtime-status`,"data-running":t.daemon.alive,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),t.daemon.alive?p?`持续运行中`:`Running continuously`:p?`持续运行已暂停`:`Continuous work paused`]}),(0,Y.jsx)(`span`,{children:i?p?`实时连接`:`Live connection`:p?`连接恢复中,状态可能延迟`:`Reconnecting; status may be delayed`}),!!t.manager_requests?.length&&(0,Y.jsx)(`span`,{children:p?`对话处理中`:`Reply in progress`})]})]}),(0,Y.jsxs)(`div`,{className:`runtime-main-actions`,children:[(0,Y.jsxs)(`button`,{className:`button button--primary`,disabled:B||oe||V,onClick:()=>{t.daemon.alive?a.stop(!0):a.start()},children:[t.daemon.alive?(0,Y.jsx)(M,{size:16}):(0,Y.jsx)(te,{size:16}),a.busy?p?`正在处理…`:`Working…`:t.daemon.alive?p?`安全暂停`:`Pause safely`:p?`启动运行`:`Start work`]}),(0,Y.jsxs)(`button`,{className:`button button--ghost`,disabled:I.isFetching,onClick:()=>{I.refetch(),o()},children:[(0,Y.jsx)(b,{size:15}),p?`刷新状态`:`Refresh`]})]}),(0,Y.jsx)(`p`,{className:`runtime-summary-hint`,children:p?`安全暂停会等待当前工作结束。新的任务和调整直接在对话中告诉 Argus。`:`Safe pause waits for current work to finish. Send new tasks and adjustments in the conversation.`}),s&&(0,Y.jsx)(`p`,{children:p?`当前为只读展示,不能执行控制操作。`:`Read-only view; control actions are disabled.`}),oe&&(0,Y.jsx)(`p`,{role:`alert`,children:p?`此运行实例由外部管理,请在其启动端控制。`:`This instance is externally managed. Control it from its host.`}),V&&(0,Y.jsx)(`p`,{role:`alert`,children:p?`运行实例版本不兼容,请展开运行设置进行安全重启。`:`The running version is incompatible. Open settings to restart safely.`}),t.daemon.protocol_error&&(0,Y.jsx)(`p`,{role:`alert`,children:t.daemon.protocol_error}),a.error&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-err`,children:a.error})]}),(0,Y.jsx)(It,{status:I.isError?null:I.data??null,error:ce(I.error)}),F&&(0,Y.jsxs)(`div`,{className:`runtime-feedback`,role:`alert`,children:[(0,Y.jsx)(`p`,{children:F.text}),F.technical&&(0,Y.jsx)(D,{label:l(`operations.technicalDetails`),children:(0,Y.jsx)(`pre`,{children:F.technical})})]}),re&&(0,Y.jsxs)(`p`,{className:`runtime-feedback`,role:`status`,children:[(0,Y.jsx)(v,{size:16}),re]}),!!j&&(0,Y.jsx)(`p`,{role:`status`,className:`text-sm text-ink-dim`,children:p?`正在处理,请稍候…`:`Working, please wait…`}),(0,Y.jsxs)(`details`,{className:`runtime-section`,open:m,onToggle:e=>h(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(Pe,{size:17}),(0,Y.jsx)(`span`,{children:p?`运行设置`:`Runtime settings`}),(0,Y.jsx)(`small`,{children:p?`目录与维护`:`Directory & maintenance`})]}),(0,Y.jsxs)(`div`,{className:`runtime-section-body`,children:[(0,Y.jsxs)(`label`,{htmlFor:`runtime-workdir-${e}`,children:[(0,Y.jsx)(ke,{size:15}),l(`operations.workdir`)]}),(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsx)(`input`,{id:`runtime-workdir-${e}`,value:S,onChange:e=>C(e.target.value),disabled:B}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B||!S.trim()||S===(t.session.workdir??t.session.cwd??``),onClick:()=>H(`cwd`,p?`更改后,后续工作将使用新的会话目录。确认更改?`:`Future work will use the new session directory. Apply?`,()=>u.setWorkdir(e,S),l(`operations.workdirUpdated`)),children:[(0,Y.jsx)(v,{size:15}),p?`应用目录`:`Apply directory`]})]}),(0,Y.jsx)(`p`,{children:p?`这是会话工作目录,不是安全沙箱边界。以下维护操作不删除任务历史。`:`This is the session directory, not a sandbox boundary. Maintenance below preserves task history.`}),(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsxs)(`button`,{className:`button`,disabled:B,onClick:()=>H(`reset`,p?`将清空当前对话的上下文,任务和文件会保留。确认重置?`:`Clear conversation context? Tasks and files are preserved.`,()=>u.resetManager(e),p?`对话上下文已重置。`:`Conversation context reset.`),children:[(0,Y.jsx)(ee,{size:15}),p?`重置对话上下文`:`Reset conversation context`]}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B||oe,onClick:()=>H(`restart`,p?`等待当前工作结束后,使用当前版本重新启动。确认继续?`:`Wait for active work, then restart on the current release?`,()=>u.upgradeDaemon(e,t.daemon_commands?.revision),p?`安全重启请求已提交。`:`Safe restart requested.`),children:[(0,Y.jsx)(b,{size:15}),p?`安全重启`:`Restart safely`]})]}),!s&&(0,Y.jsxs)(`div`,{className:`runtime-source-update`,children:[(0,Y.jsx)(`h3`,{children:l(`operations.sourceUpdate`)}),z.error?(0,Y.jsx)(`p`,{role:`alert`,children:ce(z.error)}):(0,Y.jsx)(`p`,{children:z.data?.error||z.data?.message||(p?`按需检查,不会自动更新或重启。`:`Check on demand. Nothing updates or restarts automatically.`)}),!z.error&&(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsxs)(`button`,{className:`button`,disabled:B||z.data?.running,onClick:()=>void se(`check-update`,async()=>{await u.checkSourceUpdate(),await z.refetch()},p?`已提交更新检查。`:`Update check requested.`),children:[(0,Y.jsx)(b,{size:15}),p?`检查更新`:`Check updates`]}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B||!z.data?.can_update||!z.data.update_available||z.data.running,onClick:()=>H(`update`,p?`将下载并构建新版本;完成后可能需要重启服务。确认更新?`:`Download and build the new release? A service restart may be needed.`,async()=>{await u.applySourceUpdate(),await z.refetch()},p?`更新请求已提交。`:`Update requested.`),children:[(0,Y.jsx)(xe,{size:15}),l(`operations.pullLatest`)]})]}),z.data?.restart_required&&(0,Y.jsx)(`p`,{children:l(`operations.updateRestart`)})]}),!!le.length&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:p?`切换运行名额`:`Switch active session`}),(0,Y.jsx)(`p`,{children:p?`先安全暂停指定项目,再启动当前项目。`:`Safely pause the selected project, then start this one.`}),le.map(n=>(0,Y.jsxs)(`button`,{className:`button`,disabled:B,onClick:()=>H(`replace:${n.id}`,p?`将暂停“${n.label||n.id}”并启动当前项目,确认继续?`:`Pause ${n.label||n.id} and start this project?`,()=>u.replaceDaemon(e,n.id,!!t.continuous?.enabled,t.daemon_commands?.revision),p?`项目切换请求已提交。`:`Session switch requested.`),children:[(0,Y.jsx)(b,{size:15}),n.label||n.id]},n.id))]})]})]}),!s&&(0,Y.jsxs)(`details`,{className:`runtime-section`,open:g,onToggle:e=>_(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(ae,{size:17}),(0,Y.jsx)(`span`,{children:p?`恢复已移除项目`:`Restore removed projects`})]}),(0,Y.jsxs)(`div`,{className:`runtime-section-body`,children:[(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsx)(`input`,{"aria-label":l(`operations.searchTrash`),placeholder:l(`operations.searchTrash`),value:w,onChange:e=>E(e.target.value),onKeyDown:e=>{!ye(e)&&e.key===`Enter`&&(e.preventDefault(),k(w))}}),(0,Y.jsxs)(`button`,{className:`button`,onClick:()=>k(w),children:[(0,Y.jsx)(T,{size:15}),p?`搜索`:`Search`]})]}),L.error?(0,Y.jsx)(`p`,{role:`alert`,children:ce(L.error)}):L.isLoading?(0,Y.jsx)(`p`,{children:l(`common.loading`)}):L.data?.entries.length?L.data.entries.map(e=>(0,Y.jsxs)(`div`,{className:`runtime-restore-row`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B,onClick:()=>void se(`restore:${e.trash_id}`,async()=>{let t=await u.restoreTrash(e.trash_id);await L.refetch(),await c(t.sid)},p?`项目已恢复。`:`Project restored.`),children:[(0,Y.jsx)(ee,{size:15}),p?`恢复`:`Restore`]})]},e.trash_id)):(0,Y.jsx)(`p`,{children:l(`operations.trashEmpty`)}),L.data&&L.data.total>L.data.entries.length&&(0,Y.jsx)(`p`,{children:p?`显示最近 ${L.data.entries.length} 条,请缩小搜索范围。`:`Showing ${L.data.entries.length} recent matches. Narrow the search for more.`})]})]}),(0,Y.jsxs)(`details`,{className:`runtime-section`,open:y,onToggle:e=>x(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(A,{size:17}),(0,Y.jsx)(`span`,{children:p?`技术诊断`:`Technical diagnostics`})]}),(0,Y.jsx)(`div`,{className:`runtime-section-body`,children:R.error?(0,Y.jsx)(`p`,{role:`alert`,children:ce(R.error)}):R.data?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{children:l(R.data.slo?.status===`healthy`?`operations.slo.healthy`:`operations.slo.degraded`)}),(0,Y.jsx)(D,{children:(0,Y.jsx)(`pre`,{children:JSON.stringify(R.data,null,2)})})]}):(0,Y.jsx)(`p`,{children:l(`common.loading`)})})]})]})}var zt=[{id:`timeline`,zh:`研究排期`,en:`Research timeline`,zhDesc:`比较 proposal 工期,安排实验,并追踪延期原因。`,enDesc:`Compare proposal estimates, schedule experiments, and track delays.`,icon:Se,color:`blue`},{id:`experiments`,zh:`运行进程`,en:`Execution`,zhDesc:`查看当前步骤、任务路线,以及团队里谁在做什么。`,enDesc:`Follow the current step, the task route, and who on the team is doing what.`,icon:Oe,color:`blue`},{id:`ide`,zh:`AI IDE`,en:`AI IDE`,zhDesc:`阅读项目文件,查看 Git 状态与 Argus 活动。`,enDesc:`Read project files, Git state, and Argus activity.`,icon:re,color:`emerald`},{id:`runtime`,zh:`运行控制`,en:`Runtime controls`,icon:ne}];function Bt(e){let t=String(e.event_id??e.id??``);if(t)return t;let n=String(e.message_id??``);return n?`${e.type??``}:${n}:${e.kind??``}`:[e.type??``,e.ts??``,e.agent_layer??e.actor??``,e.kind??``,String(e.text??e.title??e.reason??``).slice(0,160)].join(`|`)}function Vt(e,t){let n=[...e],r=new Map(n.map((e,t)=>[Bt(e),t]));return t.forEach(e=>{let t=Bt(e),i=r.get(t);i==null?(r.set(t,n.length),n.push(e)):n[i]={...n[i],...e}}),n.sort((e,t)=>Number(e.ts??0)-Number(t.ts??0)).slice(-600)}function Ht(e=!0){return r({queryKey:[`v2-projects`],queryFn:({signal:e})=>q.projects(e),enabled:e,refetchInterval:1e4})}function Ut(e,t=!0){let n=i(),[o,s]=(0,U.useState)([]),[c,l]=(0,U.useState)(!1),u=(0,U.useRef)(null),d=!!e&&t,f=r({queryKey:[`v2-snapshot`,e],queryFn:({signal:t})=>q.snapshot(e,t),enabled:d,refetchInterval:5e3}),p=r({queryKey:[`v2-status`,e],queryFn:({signal:t})=>q.status(e,t),enabled:d,refetchInterval:6e3}),m=r({queryKey:[`v2-events`,e],queryFn:({signal:t})=>q.events(e,220,t),enabled:d,refetchInterval:15e3});(0,U.useEffect)(()=>{s([]),l(!1)},[e]),(0,U.useEffect)(()=>{!e||!m.data||s(e=>Vt(e,m.data))},[m.data,e]),(0,U.useEffect)(()=>{if(!e||!t){l(!1);return}let r=He(e,t=>{s(e=>Vt(e,[t])),u.current??=window.setTimeout(()=>{u.current=null,n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]})},900)},l);return()=>{r.close(),l(!1),u.current!=null&&(window.clearTimeout(u.current),u.current=null)}},[t,n,e]);let h=async()=>{e&&await Promise.all([n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]}),n.invalidateQueries({queryKey:[`v2-events`,e]})])},g=a({mutationFn:()=>q.startDaemon(e,f.data?.daemon_commands?.revision),onSuccess:h}),_=a({mutationFn:t=>q.stopDaemon(e,t,f.data?.daemon_commands?.revision),onSuccess:h}),v=(0,U.useMemo)(()=>{let e=[f,p,m].find(e=>e.error);return e?.error instanceof Error?e.error:null},[m,f,p]);return{snapshot:f,status:p,events:o,connected:c,refresh:h,controls:{start:g,stop:_},error:v}}function Wt({sid:e,active:t,readOnly:n=!1,runtimeRequest:r=0,onRestored:i}){let{locale:a}=d(),[o,s]=(0,U.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`module`);return zt.find(t=>t.id===e)?.id??`runtime`}),[c,l]=(0,U.useState)(()=>new Set([o])),u=(0,U.useCallback)(e=>{s(e),l(t=>t.has(e)?t:new Set([...t,e]))},[]);(0,U.useEffect)(()=>{r&&u(`runtime`)},[r,u]);let f=Ht(t),p=f.data?.projects??[],m=(0,U.useMemo)(()=>p.find(t=>t.id===e)??null,[p,e]),h=Ut(e,t),g=o,_=h.controls.start.error||h.controls.stop.error,v=m&&h.snapshot.data?{sid:e,active:t,project:m,snapshot:h.snapshot.data,status:h.status.data,events:h.events,connected:h.connected,snapshotUpdatedAt:h.snapshot.dataUpdatedAt,refresh:h.refresh,controls:{start:async()=>{try{return await h.controls.start.mutateAsync()}catch{return null}},stop:async e=>{try{return await h.controls.stop.mutateAsync(e)}catch{return null}},busy:h.controls.start.isPending||h.controls.stop.isPending,error:_ instanceof Error?_.message:``},navigate:u}:null;return(0,Y.jsxs)(`section`,{className:`integrated-workbench flex min-h-0 flex-1 flex-col bg-transparent text-ink`,children:[(0,Y.jsx)(`nav`,{className:`workbench-module-tabs shrink-0 border-b border-line/60 px-3 py-2`,"aria-label":a===`zh-CN`?`工作台模块`:`Workbench modules`,children:(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:zt.map(({id:e,zh:t,en:n,icon:r})=>(0,Y.jsxs)(`button`,{type:`button`,className:`workbench-module-tab`,"data-module":e,"data-selected":g===e,"aria-pressed":g===e,onClick:()=>u(e),children:[(0,Y.jsx)(r,{size:14}),(0,Y.jsx)(`span`,{children:a===`zh-CN`?t:n})]},e))})}),f.isError&&!m||h.snapshot.isError&&!h.snapshot.data?(0,Y.jsx)(Z,{title:a===`zh-CN`?`工作台读取失败`:`Workbench unavailable`,description:`Argus API did not return the selected project.`}):v?zt.filter(({id:e})=>c.has(e)).map(({id:r})=>(0,Y.jsx)(`div`,{className:`ros-content workspace-view-surface min-h-0 flex-1 overflow-x-hidden overflow-y-auto ${g===r?``:`hidden`}`,"aria-hidden":g!==r,children:r===`runtime`?(0,Y.jsx)(Rt,{...v,active:t&&g===r,readOnly:n,onRestored:i}):r===`timeline`?(0,Y.jsx)(Nt,{sid:e}):r===`experiments`?(0,Y.jsx)(ht,{...v,active:t&&g===r}):(0,Y.jsx)(Et,{...v,active:t&&g===r})},`${e}:${r}`)):(0,Y.jsx)(`div`,{className:`boot-state`,children:(0,Y.jsx)(tt,{label:a===`zh-CN`?`正在载入工作台`:`Loading workbench`})})]})}export{Wt as ResearchWorkbenchPanel}; \ No newline at end of file diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-BHFSJIDp.css b/frontend/web/dist/assets/ResearchWorkbenchPanel-BHFSJIDp.css new file mode 100644 index 000000000..56c39d7ca --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-BHFSJIDp.css @@ -0,0 +1 @@ +.readonly-diff{min-width:0;color:rgb(var(--ink))}.readonly-diff__toolbar{flex-wrap:wrap;align-items:center;gap:6px;padding:10px 10px 4px;display:flex}.readonly-diff__toolbar>strong{flex:100%;font-size:11px}.readonly-diff__toolbar>button{border:1px solid rgb(var(--line));background:rgb(var(--panel));min-height:28px;color:rgb(var(--ink-dim));cursor:pointer;border-radius:5px;padding:3px 7px;font-size:10px}.readonly-diff__hint,.readonly-diff__notice{overflow-wrap:anywhere;margin:6px 10px;font-size:10px;line-height:1.5}.readonly-diff__hint{color:rgb(var(--ink-dim))}.readonly-diff__notice{border-left:2px solid rgb(var(--warn));color:rgb(var(--ink));padding-left:7px}.readonly-diff .readonly-diff__text{background:rgb(var(--panel));max-height:min(540px,65vh);color:rgb(var(--ink));font-family:var(--mono);white-space:pre;tab-size:4;margin:0;padding:10px;font-size:10px;line-height:1.6;overflow:auto}.readonly-diff__line--header{color:rgb(var(--ink-dim));background:rgb(var(--line) / .35);font-weight:600}.readonly-diff__line--hunk{color:rgb(var(--blue));background:rgb(var(--blue) / .08);font-weight:600}.readonly-diff__line--addition{color:rgb(var(--ok));background:rgb(var(--ok) / .12)}.readonly-diff__line--deletion{color:rgb(var(--err));background:rgb(var(--err) / .08)}.readonly-diff__line--context{color:rgb(var(--ink))}.readonly-diff :focus-visible{outline:2px solid rgb(var(--blue));outline-offset:-2px}.gpu-device-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,310px),1fr));gap:12px;margin-top:16px;display:grid}.gpu-device-card{border:1px solid rgb(var(--line));background:rgb(var(--bg));border-radius:14px;min-width:0;padding:18px}.gpu-device-header{flex-wrap:wrap;align-items:center;gap:12px;display:flex}.gpu-device-icon{border:1px solid rgb(var(--line));width:48px;height:48px;color:rgb(var(--ink-faint));background:rgb(var(--panel));border-radius:12px;flex-shrink:0;place-items:center;display:grid}.gpu-device-header>div{flex:1;min-width:100px}.gpu-device-number{color:rgb(var(--ink-faint));font-size:10px}.gpu-device-header h4{color:rgb(var(--ink));overflow-wrap:anywhere;margin-top:3px;font-size:14px;font-weight:600}.gpu-device-status{background:rgb(var(--panel));color:rgb(var(--ink-dim));border-radius:99px;align-items:center;gap:5px;padding:5px 8px;font-size:10px;display:inline-flex}.gpu-device-status i{background:currentColor;border-radius:50%;width:5px;height:5px}.gpu-device-card[data-gpu-state=computing]{border-color:rgb(var(--blue) / .4);background:rgb(var(--blue) / .035)}.gpu-device-card[data-gpu-state=computing] .gpu-device-icon,.gpu-device-card[data-gpu-state=computing] .gpu-device-status{color:rgb(var(--blue));background:rgb(var(--blue) / .08)}.gpu-device-card[data-gpu-state=reserved] .gpu-device-status,.gpu-device-card[data-gpu-state=allocated] .gpu-device-status{color:rgb(var(--warn));background:rgb(var(--warn) / .1)}.gpu-device-meter{color:rgb(var(--ink-faint));margin-top:16px;font-size:11px}.gpu-device-meter>div:first-child{justify-content:space-between;gap:8px;margin-bottom:6px;display:flex}.gpu-device-meter strong{font-variant-numeric:tabular-nums;color:rgb(var(--ink-dim));font-weight:500}.gpu-device-meter [role=meter]{background:rgb(var(--line) / .65);border-radius:9px;height:5px;overflow:hidden}.gpu-device-meter [role=meter] i{border-radius:inherit;background:rgb(var(--blue));height:100%;transition:width .24s cubic-bezier(.32,.72,0,1);display:block}.gpu-device-note{color:rgb(var(--ink-faint));margin-top:10px;font-size:10px}@media (prefers-reduced-motion:reduce){.gpu-device-meter [role=meter] i{transition:none}}.runtime-control-page{gap:14px;width:100%;max-width:1120px;margin:0 auto;padding:clamp(14px,3vw,28px);display:grid}.runtime-summary{border:1px solid rgb(var(--line));background:rgb(var(--panel));border-radius:16px;flex-wrap:wrap;align-items:center;gap:18px;padding:22px;display:flex}.runtime-summary-copy{flex:1;min-width:0}.runtime-eyebrow{color:rgb(var(--ink-faint));font-size:11px}.runtime-summary h2{overflow-wrap:anywhere;margin:5px 0 12px;font-size:22px;font-weight:600}.runtime-status-line{color:rgb(var(--ink-faint));flex-wrap:wrap;align-items:center;gap:8px 16px;font-size:12px;display:flex}.runtime-status{color:rgb(var(--ink-dim));align-items:center;gap:7px;display:inline-flex}.runtime-status i{background:rgb(var(--ink-faint));border-radius:50%;width:7px;height:7px}.runtime-status[data-running=true]{color:rgb(var(--ok))}.runtime-status[data-running=true] i{box-shadow:0 0 0 4px rgb(var(--ok) / .1);background:currentColor}.runtime-main-actions{flex-wrap:wrap;gap:8px;display:flex}.runtime-summary-hint{border-top:1px solid rgb(var(--line));color:rgb(var(--ink-faint));flex-basis:100%;padding-top:14px;font-size:12px}.runtime-section{border:1px solid rgb(var(--line));background:rgb(var(--panel));border-radius:12px}.runtime-section>summary{cursor:pointer;align-items:center;gap:10px;padding:16px;font-size:13px;list-style:none;display:flex}.runtime-section>summary::-webkit-details-marker{display:none}.runtime-section>summary:after{content:"+";color:rgb(var(--ink-faint));margin-left:auto}.runtime-section[open]>summary:after{content:"-"}.runtime-section summary small{color:rgb(var(--ink-faint));font-size:11px}.runtime-section-body{border-top:1px solid rgb(var(--line));gap:12px;padding:16px;display:grid}.runtime-section-body label{align-items:center;gap:7px;font-size:12px;display:flex}.runtime-section-body p{color:rgb(var(--ink-faint));overflow-wrap:anywhere;font-size:12px}.runtime-section-body h3{font-size:13px;font-weight:600}.runtime-field-row{flex-wrap:wrap;gap:8px;display:flex}.runtime-field-row input{border:1px solid rgb(var(--line));background:rgb(var(--bg));border-radius:8px;flex:220px;width:100%;min-width:0;min-height:38px;padding:8px 10px;font-size:12px}.runtime-source-update{border-top:1px solid rgb(var(--line));gap:10px;padding-top:16px;display:grid}.runtime-restore-row{align-items:center;gap:12px;font-size:13px;display:flex}.runtime-restore-row>span{overflow-wrap:anywhere;flex:1;min-width:0}.runtime-feedback{border:1px solid rgb(var(--line));border-radius:10px;flex-wrap:wrap;gap:8px;padding:12px 16px;font-size:13px;display:flex}.runtime-control-page pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:320px;font-size:11px;overflow:auto}@media (width<=640px){.runtime-summary{gap:12px;padding:16px}.runtime-main-actions{width:100%}.runtime-section summary small{display:none}}*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:where(.integrated-workbench),:where(.integrated-workbench) *,:where(.integrated-workbench) :before,:where(.integrated-workbench) :after{box-sizing:border-box}:where(.integrated-workbench) button,:where(.integrated-workbench) input,:where(.integrated-workbench) textarea,:where(.integrated-workbench) select{font:inherit;color:inherit}:where(.integrated-workbench) button{border:0}:where(.integrated-workbench) button:not(:disabled),:where(.integrated-workbench) select:not(:disabled){cursor:pointer}:where(.integrated-workbench) button:disabled{cursor:not-allowed;opacity:.48}:where(.integrated-workbench) a{color:inherit}.integrated-workbench{--surface-2:var(--panel-raised);--surface-3:var(--panel);--overlay:var(--panel-raised);--border:var(--line);--border-strong:var(--glass-edge);--text:var(--ink);--muted:var(--ink-dim);--faint:var(--ink-faint);--accent:var(--blue-deep);--accent-fg:255 255 255;--blue-bg:var(--conversation-argus);--green:var(--blue);--green-bg:var(--conversation-argus);--amber:var(--ink-dim);--amber-bg:var(--conversation-user);--red:var(--err);--red-bg:var(--conversation-user);--violet:var(--ink-dim);--violet-bg:var(--conversation-argus);--rose:var(--ink-dim);--rose-bg:var(--conversation-user);--manager:var(--role-manager);--planner:var(--role-planner);--engineer:var(--role-engineer);--reviewer:var(--role-reviewer);--shadow-1:none;--shadow-2:none;--shadow-3:0 20px 60px -32px #00000047;--radius-sm:8px;--radius-md:12px;--radius-lg:16px;--font:"Geist Variable", "PingFang SC", "Microsoft YaHei", sans-serif;--mono:"SFMono-Regular", Consolas, "Liberation Mono", monospace;min-width:0;min-height:0;font-family:var(--font);-webkit-font-smoothing:antialiased;font-size:14px}.integrated-workbench ::selection{background:rgb(var(--blue) / .2)}.integrated-workbench :focus-visible{outline:2px solid rgb(var(--blue) / .62);outline-offset:2px}.integrated-workbench ::-webkit-scrollbar{width:7px;height:7px}.integrated-workbench ::-webkit-scrollbar-track{background:0 0}.integrated-workbench ::-webkit-scrollbar-thumb{background:rgb(var(--faint) / .55);background-clip:padding-box;border:2px solid #0000;border-radius:999px}.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.argus-wordmark{align-items:center;gap:10px;display:inline-flex}.argus-wordmark svg{flex:none}.argus-wordmark__copy{flex-direction:column;align-items:flex-start;line-height:1.05;display:flex}.argus-wordmark__copy strong{letter-spacing:-.025em;font-size:16px;font-weight:720}.argus-wordmark__copy small{color:rgb(var(--muted));margin-top:3px;font-size:9px;font-weight:530}.brand-button{background:0 0;align-items:center;padding:0;display:inline-flex}.\!button{background:rgb(var(--surface-2))!important;min-height:36px!important;color:rgb(var(--text))!important;box-shadow:none!important;border:1px solid #0000!important;border-radius:8px!important;justify-content:center!important;align-items:center!important;gap:7px!important;padding:7px 12px!important;font-size:12px!important;font-weight:590!important;transition:color .15s,background .15s!important;display:inline-flex!important}.button{background:rgb(var(--surface-2));min-height:36px;color:rgb(var(--text));box-shadow:none;border:1px solid #0000;border-radius:8px;justify-content:center;align-items:center;gap:7px;padding:7px 12px;font-size:12px;font-weight:590;transition:color .15s,background .15s;display:inline-flex}.\!button:hover:not(:disabled){background:rgb(var(--border))!important}.button:hover:not(:disabled){background:rgb(var(--border))}.button--primary{border-color:rgb(var(--blue) / .34);background:rgb(var(--blue) / .08);color:rgb(var(--blue))}.button--primary:hover:not(:disabled){border-color:rgb(var(--blue-deep));background:rgb(var(--blue-deep));color:rgb(var(--accent-fg))}.button--secondary{background:rgb(var(--surface-2));box-shadow:none}.button--danger{border-color:rgb(var(--red) / .25);background:rgb(var(--red-bg));color:rgb(var(--red))}.button--ghost{box-shadow:none;background:0 0;border-color:#0000}.button--large{border-radius:11px;min-height:42px;padding:9px 15px}.button--full{width:100%}.icon-button{width:34px;height:34px;color:rgb(var(--muted));background:0 0;border:0;border-radius:8px;flex:0 0 34px;place-items:center;transition:background .15s,color .15s;display:inline-grid}.icon-button:hover:not(:disabled){background:rgb(var(--surface-2));color:rgb(var(--text))}.badge{background:rgb(var(--surface-2));min-height:22px;color:rgb(var(--muted));white-space:nowrap;border:0;border-radius:6px;align-items:center;gap:5px;padding:3px 8px;font-size:10px;font-weight:610;line-height:1.2;display:inline-flex}.badge__dot,.status-dot{background:currentColor;border-radius:50%;width:6px;height:6px}.status-dot{color:rgb(var(--faint));background:rgb(var(--faint));display:inline-block}.status-dot.is-live{color:rgb(var(--green));background:rgb(var(--green));box-shadow:0 0 0 4px rgb(var(--green) / .11)}.is-pulsing{animation:2s infinite livePulse}.ros-card,.panel{border-radius:var(--radius-sm);background:rgb(var(--surface));min-width:0;min-height:0;box-shadow:none;border:0;overflow:hidden}.panel{flex-direction:column;display:flex}.panel__header,.ros-card>header{border-bottom:1px solid rgb(var(--border));justify-content:space-between;align-items:center;gap:12px;min-height:58px;padding:12px 16px;display:flex}.panel__heading,.ros-card>header>div{min-width:0}.panel__title,.ros-card>header h2{color:rgb(var(--text));margin:1px 0 0;font-size:13px;font-weight:650}.ros-card>header span,.panel__header .eyebrow{color:rgb(var(--faint));letter-spacing:.12em;font-size:9px;font-weight:690}.panel__body{min-width:0;min-height:0;padding:16px}.eyebrow{color:rgb(var(--faint));letter-spacing:.15em;margin-bottom:4px;font-size:9px;font-weight:700}.empty-state{text-align:center;flex-direction:column;justify-content:center;align-items:center;min-height:180px;padding:28px;display:flex}.empty-state__icon{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));width:44px;height:44px;color:rgb(var(--faint));border-radius:12px;place-items:center;margin-bottom:12px;display:grid}.empty-state__title{font-size:13px;font-weight:640}.empty-state p{max-width:360px;color:rgb(var(--muted));margin:6px 0 0;font-size:11px;line-height:1.55}.empty-state__action{margin-top:14px}.spinner{color:rgb(var(--muted));align-items:center;gap:7px;font-size:12px;display:inline-flex}.spin{animation:.85s linear infinite spin}.inline-error{border:1px solid rgb(var(--red) / .22);background:rgb(var(--red-bg));color:rgb(var(--red));border-radius:10px;padding:10px 12px;font-size:11px;line-height:1.5}.\!notice{border:1px solid rgb(var(--border))!important;background:rgb(var(--surface))!important;color:rgb(var(--muted))!important;border-radius:11px!important;gap:8px!important;padding:11px 13px!important;font-size:11px!important;display:flex!important}.notice{border:1px solid rgb(var(--border));background:rgb(var(--surface));color:rgb(var(--muted));border-radius:11px;gap:8px;padding:11px 13px;font-size:11px;display:flex}.markdown{min-width:0;font-size:inherit;overflow-wrap:anywhere;line-height:1.68}.markdown>:first-child{margin-top:0}.markdown>:last-child{margin-bottom:0}.markdown p{margin:.55em 0}.markdown h1,.markdown h2,.markdown h3{margin:1.2em 0 .45em;line-height:1.3}.markdown h1{font-size:1.4em}.markdown h2{font-size:1.22em}.markdown h3{font-size:1.08em}.markdown ul,.markdown ol{padding-left:1.55em}.markdown blockquote{border-left:3px solid rgb(var(--blue) / .45);background:rgb(var(--blue-bg));color:rgb(var(--muted));border-radius:0 8px 8px 0;margin:.8em 0;padding:7px 12px}.markdown code{background:rgb(var(--surface-2));font-family:var(--mono);border-radius:5px;padding:.12em .34em;font-size:.88em}.markdown pre{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));border-radius:10px;padding:12px;overflow:auto}.markdown pre code{background:0 0;padding:0}.markdown a{color:rgb(var(--blue));align-items:center;gap:3px;text-decoration:none;display:inline-flex}.markdown a:hover{text-decoration:underline}.markdown table{border-collapse:collapse;width:100%}.markdown th,.markdown td{border:1px solid rgb(var(--border));text-align:left;padding:6px 8px}.search-field{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));min-width:250px;color:rgb(var(--faint));border-radius:10px;align-items:center;gap:7px;padding:0 10px;display:flex}.search-field input{background:0 0;border:0;outline:0;width:100%;height:36px;font-size:12px}.search-field--block{margin:12px}.field{flex-direction:column;gap:6px;display:flex}.field>span,.form-grid label>span{color:rgb(var(--muted));font-size:11px;font-weight:580}.field input,.field textarea,.field select,.form-grid input,.new-project-fields input{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));border-radius:10px;outline:none;width:100%;padding:9px 10px;font-size:12px}.field input:focus,.field textarea:focus,.field select:focus,.form-grid input:focus,.new-project-fields input:focus{border-color:rgb(var(--blue) / .55);box-shadow:0 0 0 3px rgb(var(--blue) / .09)}.field textarea{resize:vertical;line-height:1.55}.field--grow{flex:1;min-height:0}.field--grow textarea{resize:none;flex:1;min-height:220px}.form-grid{grid-template-columns:1fr 1fr;gap:12px;display:grid}.form-grid label{flex-direction:column;gap:6px;display:flex}.file-button{position:relative;overflow:hidden}.file-button input{opacity:0;cursor:pointer;position:absolute;inset:0}.header-badges{flex-wrap:wrap;justify-content:flex-end;gap:7px;display:flex}.manager-mini-result{border-top:1px solid rgb(var(--border));max-height:260px;margin-top:10px;padding-top:10px;overflow:auto}.manager-mini-result .markdown{font-size:11px}.event-list{padding:5px}.event-row{border-radius:8px;grid-template-columns:22px minmax(0,1fr);gap:7px;padding:9px;display:grid;position:relative}.event-row:hover{background:rgb(var(--surface-2))}.event-row__marker{border:2px solid rgb(var(--surface));background:rgb(var(--faint));width:8px;height:8px;box-shadow:0 0 0 1px rgb(var(--border-strong));border-radius:50%;margin:6px auto 0}.event-row__content{min-width:0}.event-row__meta{gap:7px;display:flex}.event-row__meta time{color:rgb(var(--faint));font-family:var(--mono);margin-left:auto;font-size:9px}.role-label{text-transform:uppercase;font-size:9px;font-weight:700}.event-row__title{text-overflow:ellipsis;white-space:nowrap;margin-top:2px;font-size:11px;font-weight:620;overflow:hidden}.event-row__detail{color:rgb(var(--muted));font-family:var(--mono);-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin-top:2px;font-size:9px;line-height:1.45;display:-webkit-box;overflow:hidden}.event-list--dense .event-row{padding-block:7px}.ros-sidebar nav button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg));box-shadow:var(--shadow-1)}.ros-content{min-width:0;min-height:0;overflow:auto}.ros-page,.overview-page,.page{min-width:0;min-height:100%;padding:24px 28px 32px}.ros-page-header{justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:20px;display:flex}.ros-page-header h1{letter-spacing:-.03em;margin:0 0 5px;font-size:24px;font-weight:690}.ros-page-header p{max-width:780px;color:rgb(var(--muted));margin:0;font-size:12px;line-height:1.55}.boot-state{place-content:center;width:100%;height:100%;display:grid}.project-hub{max-width:1240px;margin:0 auto;padding:48px 24px 72px}.project-hub__hero{justify-content:space-between;align-items:flex-start;gap:28px;margin-bottom:30px;display:flex}.project-hub__hero h1{letter-spacing:-.04em;margin:2px 0 7px;font-size:32px;font-weight:710}.project-hub__hero p{max-width:660px;color:rgb(var(--muted));margin:0;font-size:13px;line-height:1.6}.project-hub__summary{grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:34px;display:grid}.project-hub__summary>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:82px;box-shadow:var(--shadow-1);border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto;align-items:center;gap:10px;padding:16px;display:grid}.project-hub__summary svg{color:rgb(var(--muted))}.project-hub__summary span{color:rgb(var(--muted));font-size:11px}.project-hub__summary strong{font-size:21px;font-weight:680}.project-hub__toolbar{justify-content:space-between;align-items:center;gap:16px;margin-bottom:14px;display:flex}.project-hub__toolbar h2{margin:0;font-size:16px}.project-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;display:grid}.project-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:264px;color:rgb(var(--text));text-align:left;box-shadow:var(--shadow-1);border-radius:16px;flex-direction:column;padding:18px;transition:transform .18s,border-color .18s,box-shadow .18s;display:flex}.project-card:hover{border-color:rgb(var(--border-strong));box-shadow:var(--shadow-2)}.project-card--skeleton{background:rgb(var(--surface-2));animation:1.5s infinite skeleton}.project-card__top{justify-content:space-between;align-items:center;display:flex}.project-card__mark{background:rgb(var(--surface-2));width:42px;height:42px;color:rgb(var(--muted));border-radius:12px;place-items:center;display:grid}.project-card__mark.is-live{background:rgb(var(--green-bg));color:rgb(var(--green))}.project-card__copy{min-height:84px;margin-top:16px}.project-card__copy h3{margin:0;font-size:16px;font-weight:660;line-height:1.35}.project-card__copy p{color:rgb(var(--muted));-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:7px 0 0;font-size:11px;line-height:1.5;display:-webkit-box;overflow:hidden}.project-card__facts{grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px;display:grid}.project-card__facts>div{background:rgb(var(--surface-2));border-radius:9px;padding:8px}.project-card__facts span{color:rgb(var(--faint));font-size:8px;display:block}.project-card__facts strong{text-overflow:ellipsis;white-space:nowrap;margin-top:2px;font-size:10px;display:block;overflow:hidden}.project-card__footer{border-top:1px solid rgb(var(--border));align-items:center;gap:10px;margin-top:auto;padding-top:13px;display:flex}.project-card__footer code{min-width:0;color:rgb(var(--faint));font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:8px;overflow:hidden}.project-card__footer span{color:rgb(var(--blue));align-items:center;gap:4px;font-size:10px;font-weight:610;display:flex}.project-inbox-cta{border:1px solid rgb(var(--border));background:rgb(var(--surface));text-align:left;width:100%;box-shadow:var(--shadow-1);border-radius:16px;grid-template-columns:48px minmax(0,1fr) 24px;align-items:center;gap:14px;margin-top:18px;padding:18px;display:grid}.project-inbox-cta>span{background:rgb(var(--rose-bg));width:46px;height:46px;color:rgb(var(--rose));border-radius:13px;place-items:center;display:grid}.project-inbox-cta strong{font-size:13px}.project-inbox-cta p{color:rgb(var(--muted));margin:4px 0 0;font-size:11px}.project-inbox-cta>svg{color:rgb(var(--faint))}.overview-page{max-width:1280px;margin:0 auto}.overview-hero{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:16px;grid-template-columns:minmax(0,1.4fr) minmax(360px,.8fr);gap:18px;padding:26px;display:grid}.overview-hero__copy h1{letter-spacing:-.035em;margin:14px 0 8px;font-size:27px}.overview-hero__copy p{max-width:760px;color:rgb(var(--muted));-webkit-line-clamp:4;-webkit-box-orient:vertical;margin:0 0 14px;font-size:12px;line-height:1.6;display:-webkit-box;overflow:hidden}.overview-hero__copy>code{color:rgb(var(--faint));font-family:var(--mono);font-size:9px}.overview-section-heading{justify-content:space-between;margin:30px 0 12px;display:flex}.overview-section-heading h2{margin:0;font-size:17px}.overview-section-heading p{color:rgb(var(--muted));margin:4px 0 0;font-size:11px}.module-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;display:grid}.module-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));text-align:left;min-height:132px;box-shadow:var(--shadow-1);border-radius:14px;grid-template-columns:44px minmax(0,1fr) 20px;align-items:start;gap:12px;padding:16px;transition:transform .15s,border-color .15s,box-shadow .15s;display:grid}.module-card:hover{border-color:rgb(var(--border-strong));box-shadow:var(--shadow-2);transform:translateY(-2px)}.module-card__icon{background:rgb(var(--surface-2));width:42px;height:42px;color:rgb(var(--muted));border-radius:11px;place-items:center;display:grid}.module-card h3{margin:2px 0 5px;font-size:13px}.module-card p{color:rgb(var(--muted));margin:0;font-size:10px;line-height:1.5}.module-card>svg{color:rgb(var(--faint));margin-top:13px}.copilot-v2{flex-direction:column;height:100%;display:flex;overflow:hidden}.copilot-v2 .ros-page-header{flex:none}.pending-question-banner{border:1px solid rgb(var(--amber) / .22);background:rgb(var(--amber-bg));color:rgb(var(--amber));border-radius:12px;flex:none;align-items:center;gap:10px;margin-bottom:12px;padding:10px 12px;display:flex}.pending-question-banner>div{flex:1}.pending-question-banner strong{font-size:11px}.pending-question-banner p{margin:2px 0 0;font-size:10px}.copilot-v2__layout{flex:1;grid-template-columns:minmax(0,1fr) 330px;gap:12px;min-width:0;min-height:0;display:grid}.copilot-v2__thread{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-width:0;min-height:0;box-shadow:var(--shadow-1);border-radius:16px;flex-direction:column;display:flex;overflow:hidden}.copilot-v2__messages{flex:1;min-height:0;padding:22px 18px 12px;overflow-y:auto}.copilot-empty{text-align:center;max-width:660px;margin:9vh auto 0}.copilot-empty h2{margin:12px 0 4px;font-size:19px}.copilot-empty>p{color:rgb(var(--muted));margin:0 0 18px;font-size:11px}.copilot-empty>div{grid-template-columns:repeat(3,1fr);gap:8px;display:grid}.copilot-empty button{border:1px solid rgb(var(--border));background:rgb(var(--surface));color:rgb(var(--muted));text-align:left;border-radius:11px;padding:11px;font-size:10px;line-height:1.45}.copilot-empty button:hover{border-color:rgb(var(--blue) / .3);background:rgb(var(--blue-bg));color:rgb(var(--text))}.\!message{max-width:820px!important;margin:0 auto 18px!important}.message{max-width:820px;margin:0 auto 18px}.message--user{background:rgb(var(--surface-2));border-radius:16px 5px 16px 16px;max-width:620px;margin-right:max(0px,50% - 410px);padding:11px 14px}.message--user>div:first-child{align-items:center;gap:7px;margin-bottom:4px;display:flex}.message--user span{font-size:10px;font-weight:650}.\!message time{color:rgb(var(--faint))!important;font-family:var(--mono)!important;font-size:8.5px!important}.message time{color:rgb(var(--faint));font-family:var(--mono);font-size:8.5px}.\!message .markdown{font-size:12.5px!important}.message .markdown{font-size:12.5px}.message--argus{grid-template-columns:34px minmax(0,1fr);gap:10px;display:grid}.message--argus>div{min-width:0}.message--argus header{align-items:center;gap:7px;min-height:24px;margin-bottom:5px;display:flex}.message--argus header strong{font-size:11px}.message--stream>div{border-left:2px solid rgb(var(--blue) / .25);padding-left:12px}.phase-trail{margin:5px 0 10px;padding:0;list-style:none}.phase-trail li{color:rgb(var(--faint));font-family:var(--mono);gap:7px;padding:2px 0;font-size:9px;display:flex}.phase-trail li span{color:rgb(var(--green))}.phase-trail li.is-active{color:rgb(var(--blue))}.phase-trail li.is-active span{animation:1s infinite blink}.copilot-composer-dock{border-top:1px solid rgb(var(--border));flex:none;padding:12px 18px 10px}.copilot-composer{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));max-width:820px;box-shadow:var(--shadow-2);border-radius:14px;align-items:flex-end;gap:7px;margin:0 auto;padding:7px;display:flex}.copilot-composer textarea{resize:none;background:0 0;border:0;outline:none;flex:1;min-height:36px;max-height:150px;padding:8px 3px;font-size:12px;line-height:1.5}.composer-tool{width:35px;height:35px;color:rgb(var(--muted));background:0 0;border-radius:9px;flex:0 0 35px;place-items:center;display:grid}.composer-tool:hover{background:rgb(var(--surface-2))}.optimize-button{background:rgb(var(--violet-bg));height:35px;color:rgb(var(--violet));border-radius:9px;align-items:center;gap:5px;padding:0 10px;font-size:10px;font-weight:650;display:flex}.send-button{background:rgb(var(--accent));width:35px;height:35px;color:rgb(var(--accent-fg));border-radius:9px;flex:0 0 35px;place-items:center;display:grid}.send-button.is-stop{background:rgb(var(--red-bg));color:rgb(var(--red))}.copilot-composer-dock>small{max-width:820px;color:rgb(var(--faint));text-align:center;margin:5px auto 0;font-size:8.5px;display:block}.attachment-chips{flex-wrap:wrap;gap:6px;max-width:820px;margin:0 auto 7px;display:flex}.attachment-chips>span{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));border-radius:8px;align-items:center;gap:5px;padding:5px 7px;font-size:9px;display:flex}.attachment-chips button{color:rgb(var(--faint));background:0 0;place-items:center;display:grid}.copilot-v2__aside{min-width:0;min-height:0;overflow:hidden}.copilot-trace{border:1px solid rgb(var(--border));background:rgb(var(--surface));height:100%;box-shadow:var(--shadow-1);border-radius:16px;overflow:hidden}.copilot-trace__header{border-bottom:1px solid rgb(var(--border));justify-content:space-between;align-items:center;min-height:58px;padding:12px 15px;display:flex}.copilot-trace__header>div{flex-direction:column;display:flex}.copilot-trace__header span{color:rgb(var(--faint));letter-spacing:.12em;font-size:8.5px;font-weight:700}.copilot-trace__header strong{margin-top:2px;font-size:13px}.copilot-trace__roles section>button:hover,.copilot-trace__roles section.is-open>button{background:rgb(var(--surface-2))}.copilot-trace__roles section.is-open>button svg{transform:rotate(180deg)}.role-orb{background:rgb(var(--faint));border-radius:50%;width:7px;height:7px}.modal-backdrop{z-index:100;background:#00000052;place-items:center;padding:16px;display:grid;position:fixed;inset:0}.prompt-optimizer{overscroll-behavior:contain;border:1px solid rgb(var(--border-strong) / .8);background:rgb(var(--overlay));border-radius:16px;width:min(980px,96vw);max-height:90vh;animation:.2s cubic-bezier(.2,.8,.2,1) prompt-optimizer-enter;overflow:auto;box-shadow:0 24px 80px #0003,0 2px 10px #00000014}.prompt-optimizer>header{border-bottom:1px solid rgb(var(--border));justify-content:space-between;padding:18px 20px;display:flex}.prompt-optimizer header span{color:rgb(var(--violet));letter-spacing:.13em;font-size:9px;font-weight:700}.prompt-optimizer h2{margin:3px 0;font-size:18px}.prompt-optimizer header p{color:rgb(var(--muted));margin:0;font-size:10px}.prompt-optimizer__compare{grid-template-columns:1fr 1fr;gap:12px;padding:16px;display:grid}.prompt-optimizer__compare>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:12px;flex-direction:column;min-height:280px;display:flex;overflow:hidden}.prompt-optimizer__compare label{border-bottom:1px solid rgb(var(--border));color:rgb(var(--muted));padding:9px 12px;font-size:10px;font-weight:650}.prompt-optimizer__compare pre{font-family:var(--font);white-space:pre-wrap;flex:1;margin:0;padding:13px;font-size:11px;line-height:1.6;overflow:auto}.optimizer-thinking{color:rgb(var(--violet));align-items:center;gap:8px;margin:auto;font-size:11px;display:flex}.optimizer-changes,.optimizer-questions{border:1px solid rgb(var(--border));border-radius:11px;margin:0 16px 12px;padding:10px 12px}.optimizer-changes strong,.optimizer-questions strong{margin-bottom:6px;font-size:10px;display:block}.optimizer-changes span{color:rgb(var(--muted));align-items:center;gap:5px;font-size:9.5px;display:flex}.optimizer-changes svg{color:rgb(var(--green))}.optimizer-questions{border-color:rgb(var(--amber) / .2);background:rgb(var(--amber-bg));color:rgb(var(--amber))}.optimizer-questions p{margin:3px 0;font-size:9.5px}.prompt-optimizer>.inline-error{margin:0 16px 12px}.prompt-optimizer>footer{border-top:1px solid rgb(var(--border));justify-content:flex-end;gap:8px;padding:13px 16px;display:flex}.literature-stats{grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:12px;display:grid}.literature-stats>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:13px;align-items:center;gap:10px;padding:12px;display:flex}.stat-icon{background:rgb(var(--surface-2));width:36px;height:36px;color:rgb(var(--muted));border-radius:10px;place-items:center;display:grid}.stat-icon--blue{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.stat-icon--green{background:rgb(var(--green-bg));color:rgb(var(--green))}.stat-icon--amber{background:rgb(var(--amber-bg));color:rgb(var(--amber))}.stat-icon--violet{background:rgb(var(--violet-bg));color:rgb(var(--violet))}.literature-stats p{color:rgb(var(--muted));margin:0;font-size:9.5px}.literature-stats strong{color:rgb(var(--text));margin-top:2px;font-size:17px;display:block}.literature-v2__layout{grid-template-columns:220px minmax(420px,1fr) 340px;gap:12px;min-width:0;min-height:720px;display:grid}.literature-v2__sidebar{align-self:start}.library-tabs{padding:0 7px 8px}.library-tabs button{width:100%;min-height:38px;color:rgb(var(--muted));background:0 0;border-radius:9px;justify-content:space-between;align-items:center;padding:0 10px;font-size:11px;display:flex}.library-tabs button:hover{background:rgb(var(--surface-2))}.library-tabs button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.library-tabs small{font-family:var(--mono);font-size:9px}.literature-source-note{border-top:1px solid rgb(var(--border));color:rgb(var(--muted));gap:8px;padding:12px;display:flex}.literature-source-note div{min-width:0}.literature-source-note strong{font-size:9px;display:block}.literature-source-note p{font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;margin:3px 0 0;font-size:7.5px;overflow:hidden}.literature-v2__main{min-width:0}.literature-list-header{justify-content:space-between;align-items:center;min-height:58px;margin-bottom:9px;display:flex}.literature-list-header h2{margin:0;font-size:15px}.literature-list-header p{color:rgb(var(--muted));margin:3px 0 0;font-size:9.5px}.paper-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;display:grid}.paper-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:214px;color:rgb(var(--text));text-align:left;box-shadow:var(--shadow-1);border-radius:14px;flex-direction:column;padding:14px;transition:transform .15s,border-color .15s,box-shadow .15s;display:flex}.paper-card:hover{border-color:rgb(var(--border-strong));box-shadow:var(--shadow-2);transform:translateY(-2px)}.paper-card.is-selected{border-color:rgb(var(--blue) / .35);box-shadow:0 0 0 3px rgb(var(--blue) / .07)}.paper-card__meta{justify-content:space-between;align-items:center;gap:8px;display:flex}.paper-card__year{color:rgb(var(--faint));font-size:9px}.paper-card h3{-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:11px 0 5px;font-size:13px;line-height:1.4;display:-webkit-box;overflow:hidden}.paper-card__authors{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:9px;overflow:hidden}.paper-card__summary{color:rgb(var(--muted));-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:8px 0;font-size:9.5px;line-height:1.5;display:-webkit-box;overflow:hidden}.paper-card__footer{border-top:1px solid rgb(var(--border));align-items:center;gap:8px;margin-top:auto;padding-top:9px;display:flex}.paper-card__footer code{min-width:0;color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:7.5px;overflow:hidden}.paper-card__footer span{color:rgb(var(--blue));font-size:9px}.source-file-grid{gap:8px;display:grid}.source-file-grid article{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:12px;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:8px;padding:11px;display:grid}.source-file-grid article>div{flex-direction:column;min-width:0;display:flex}.source-file-grid strong{font-size:10px}.source-file-grid code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8px;overflow:hidden}.source-file-grid time{color:rgb(var(--faint));font-size:8px}.literature-v2__detail{align-content:start;gap:10px;display:grid}.paper-detail{padding-bottom:13px}.paper-detail>:not(.empty-state){margin-inline:14px}.paper-detail__top{justify-content:space-between;align-items:center;padding-top:14px;display:flex}.paper-detail__top>span{color:rgb(var(--faint));font-size:9px}.paper-detail h2{font-size:15px;line-height:1.4;margin:12px 14px 5px!important}.paper-detail__authors{color:rgb(var(--muted));font-size:9px}.paper-detail__body{border-top:1px solid rgb(var(--border));max-height:300px;padding-top:10px;overflow:auto;margin-top:12px!important}.paper-detail__body h3{margin:0 0 5px;font-size:10px}.paper-detail__body p,.paper-detail__body .markdown{color:rgb(var(--muted));font-size:9.5px;line-height:1.55}.paper-detail__source{border-top:1px solid rgb(var(--border));flex-direction:column;padding-top:9px;display:flex;margin-top:11px!important}.paper-detail__source span{color:rgb(var(--faint));font-size:8px}.paper-detail__source code{text-overflow:ellipsis;white-space:nowrap;margin-top:3px;font-size:8px;overflow:hidden}.paper-detail>.button{width:calc(100% - 28px);margin:11px 14px 0!important}.paper-detail>.\!button{width:calc(100% - 28px)!important;margin:11px 14px 0!important}.retrieval-panel>div{max-height:260px;padding:6px;overflow:auto}.retrieval-panel article{border-radius:8px;grid-template-columns:22px minmax(0,1fr) auto;align-items:center;gap:6px;padding:6px;display:grid}.retrieval-panel article:hover{background:rgb(var(--surface-2))}.retrieval-panel article>div{flex-direction:column;min-width:0;display:flex}.retrieval-panel strong,.retrieval-panel code{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.retrieval-panel code,.retrieval-panel time{color:rgb(var(--faint));font-family:var(--mono);font-size:7.5px}.literature-ask{padding-bottom:12px}.literature-ask textarea{resize:vertical;border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));border-radius:9px;outline:0;width:calc(100% - 24px);margin:11px 12px 7px;padding:8px;font-size:10px;line-height:1.45}.literature-ask>.button{width:calc(100% - 24px);margin-inline:12px}.literature-ask>.\!button{width:calc(100% - 24px)!important;margin-inline:12px!important}.literature-ask .manager-mini-result{margin-inline:12px}.intake-steps{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:13px;grid-template-columns:repeat(4,1fr);margin-bottom:12px;padding:8px;display:grid}.intake-steps>div{color:rgb(var(--faint));border-radius:9px;align-items:center;gap:7px;padding:7px 10px;display:flex;position:relative}.intake-steps>div>span{background:rgb(var(--surface-2));border-radius:8px;place-items:center;width:26px;height:26px;display:grid}.intake-steps strong{font-size:10px}.intake-steps>div>svg{color:rgb(var(--faint));position:absolute;right:-7px}.intake-steps .is-active{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.intake-steps .is-done{color:rgb(var(--green))}.intake-steps .is-done>span{background:rgb(var(--green-bg))}.inbox-v2__layout{grid-template-columns:220px minmax(360px,1fr) minmax(340px,.92fr);gap:12px;min-width:0;min-height:700px;display:grid}.inbox-sources{align-self:stretch}.inbox-sources>div{padding:6px}.inbox-sources>div>button{text-align:left;background:0 0;border-radius:10px;grid-template-columns:30px minmax(0,1fr);align-items:center;gap:7px;width:100%;padding:8px;display:grid}.inbox-sources>div>button:hover,.inbox-sources>div>button.is-active{background:rgb(var(--surface-2))}.inbox-item-icon{background:rgb(var(--rose-bg));width:28px;height:28px;color:rgb(var(--rose));border-radius:8px;place-items:center;display:grid}.inbox-sources button>div{flex-direction:column;min-width:0;display:flex}.inbox-sources strong,.inbox-sources small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.inbox-sources strong{font-size:10px}.inbox-sources small{color:rgb(var(--faint));font-size:8px}.inbox-input{flex-direction:column;display:flex}.inbox-input__form{flex-direction:column;flex:1;min-height:0;padding:16px;display:flex}.inbox-input__actions{justify-content:space-between;gap:8px;margin-top:11px;display:flex}.inbox-output{grid-template-rows:minmax(280px,.85fr) minmax(400px,1.15fr);gap:12px;min-width:0;display:grid}.knowledge-grid{max-height:360px;padding:8px;overflow:auto}.knowledge-grid article{border-radius:10px;grid-template-columns:30px minmax(0,1fr);gap:8px;padding:8px;display:grid}.knowledge-grid article:hover{background:rgb(var(--surface-2))}.knowledge-grid article>span{background:rgb(var(--violet-bg));width:28px;height:28px;color:rgb(var(--violet));border-radius:8px;place-items:center;display:grid}.knowledge-grid .markdown{color:rgb(var(--muted));margin-top:3px;font-size:9px;line-height:1.45}.first-prompt{flex-direction:column;display:flex}.first-prompt>textarea{resize:none;background:rgb(var(--surface-2) / .45);min-height:200px;font-family:var(--mono);border:0;outline:0;flex:1;padding:14px;font-size:9.5px;line-height:1.6}.dispatch-mode{border-top:1px solid rgb(var(--border));grid-template-columns:1fr 1fr;gap:4px;padding:8px;display:grid}.dispatch-mode button{color:rgb(var(--muted));background:0 0;border-radius:8px;padding:7px;font-size:9.5px}.dispatch-mode button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.new-project-fields{grid-template-columns:.7fr 1.3fr;gap:7px;padding:0 8px 8px;display:grid}.first-prompt>.button{width:calc(100% - 16px);margin:0 8px 8px}.first-prompt>.\!button{width:calc(100% - 16px)!important;margin:0 8px 8px!important}.first-prompt .manager-mini-result{margin:0 8px 8px}.workspace-tree{flex:1;min-height:0;padding:5px;overflow:auto}.workspace-node>button{width:100%;min-height:28px;color:rgb(var(--muted));text-align:left;background:0 0;border-radius:6px;align-items:center;gap:4px;display:flex}.workspace-node>button:hover,.workspace-node>button.is-selected{background:rgb(var(--surface-2));color:rgb(var(--text))}.workspace-node>button.is-selected{color:rgb(var(--blue))}.workspace-node button>span:not(.node-spacer){font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.workspace-node button>small{color:rgb(var(--faint));margin-left:auto;font-size:7px}.node-spacer{width:13px}.editor-tabs button.is-active{border-bottom-color:rgb(var(--accent));color:rgb(var(--text))}.workspace-pdf{background:#fff;border:0;width:100%;height:100%}.workspace-image{-o-object-fit:contain;object-fit:contain;max-width:100%;max-height:100%;margin:auto;padding:16px;display:block}.editor-loading{color:rgb(var(--muted));padding:20px;font-size:11px}.workspace-git{height:100%;overflow:auto}.coding-response .markdown{font-size:10.5px}.terminal-role{font-weight:500}.paper-v2__files>nav button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.paper-file-list>button:hover,.paper-file-list>button.is-active{background:rgb(var(--surface-2))}.paper-file-list>button.is-active{color:rgb(var(--blue))}.paper-markdown-preview{height:100%;padding:24px 30px 50px;overflow:auto}.paper-markdown-preview .markdown{font-size:12.5px}.paper-ai-output .markdown{font-size:10.5px}.review-mode-tabs{grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px;display:grid}.review-mode-tabs>button{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:72px;color:rgb(var(--muted));text-align:left;box-shadow:var(--shadow-1);border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto;align-items:center;gap:10px;padding:12px 15px;display:grid}.review-mode-tabs>button.is-active{border-color:rgb(var(--blue) / .3);background:rgb(var(--blue-bg) / .45);color:rgb(var(--text));box-shadow:0 0 0 3px rgb(var(--blue) / .06)}.review-mode-tabs>button>svg{color:rgb(var(--blue))}.review-mode-tabs button>div{flex-direction:column;display:flex}.review-mode-tabs strong{font-size:12px}.review-mode-tabs small{color:rgb(var(--muted));margin-top:3px;font-size:9px}.process-review-layout{grid-template-rows:minmax(580px,auto) auto;grid-template-columns:260px minmax(400px,1fr) 330px;gap:12px;display:grid}.review-rounds>div{max-height:650px;padding:5px;overflow:auto}.review-rounds>div>button{text-align:left;background:0 0;border-radius:9px;grid-template-columns:30px minmax(0,1fr);gap:7px;width:100%;padding:8px;display:grid}.review-rounds>div>button:hover,.review-rounds>div>button.is-active{background:rgb(var(--surface-2))}.review-state{background:rgb(var(--surface-2));border-radius:8px;place-items:center;width:28px;height:28px;display:grid}.review-rounds button>div{flex-direction:column;min-width:0;display:flex}.review-rounds small{color:rgb(var(--faint));margin-top:2px;font-size:8px}.process-report{flex-direction:column;display:flex}.process-report>article{padding:18px;overflow:auto}.process-report__meta{border-bottom:1px solid rgb(var(--border));color:rgb(var(--faint));justify-content:space-between;margin-bottom:14px;padding-bottom:9px;font-size:9px;display:flex}.process-report .markdown{font-size:11.5px}.review-live{overflow:auto}.process-verdict-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:14px;grid-column:1/-1;align-items:flex-start;gap:11px;padding:14px;display:flex}.process-verdict-card__icon{background:rgb(var(--surface-2));border-radius:10px;flex:0 0 38px;place-items:center;width:38px;height:38px;display:grid}.process-verdict-card span{color:rgb(var(--faint));font-size:8px}.process-verdict-card strong{margin-top:2px;font-size:13px;display:block}.process-verdict-card p{color:rgb(var(--muted));margin:4px 0 0;font-size:10px}.final-review-layout{grid-template-columns:250px minmax(420px,1fr) 340px;gap:12px;min-height:680px;display:grid}.final-review-files>div{padding:5px}.final-review-files>div>button{text-align:left;background:0 0;border-radius:9px;grid-template-columns:24px minmax(0,1fr);gap:7px;width:100%;padding:8px;display:grid}.final-review-files>div>button:hover,.final-review-files>div>button.is-active{background:rgb(var(--surface-2))}.final-review-files button>div{flex-direction:column;display:flex}.final-review-files strong{font-size:9.5px}.final-review-files small{color:rgb(var(--faint));font-size:8px}.final-review-report{flex-direction:column;display:flex}.final-review-report>article{padding:20px;overflow:auto}.final-review-report .markdown{font-size:11.5px}.final-review-form>div{padding:14px}.final-review-form .field+.field{margin-top:11px}.final-review-warning{border:1px solid rgb(var(--amber) / .2);background:rgb(var(--amber-bg));color:rgb(var(--amber));border-radius:10px;gap:7px;margin:11px 0;padding:9px;display:flex}.final-review-warning p{margin:0;font-size:9px;line-height:1.45}.text-warn{color:rgb(var(--amber))}.task-row:hover,.task-row.is-selected{background:rgb(var(--surface-2))}.current-task h2{margin:10px 0 6px;font-size:16px;line-height:1.38}.current-task>p{color:rgb(var(--muted));margin:0;font-size:10.5px;line-height:1.55}.role-card.is-active{background:rgb(var(--blue-bg))}.diagnosis{border:1px solid rgb(var(--border));color:rgb(var(--muted));border-radius:10px;gap:7px;padding:9px;display:flex}.diagnosis strong{color:rgb(var(--text));font-size:9.5px;display:block}.diagnosis p{margin:3px 0 0;font-size:8.5px}@media (width<=1450px){.metric-grid{grid-template-columns:repeat(3,1fr)}.literature-v2__layout{grid-template-columns:210px minmax(380px,1fr) 310px}.inbox-v2__layout{grid-template-columns:200px minmax(340px,1fr) 320px}.ide-v2__shell{grid-template-columns:210px minmax(360px,1fr) 300px}.paper-v2__shell{grid-template-columns:210px minmax(380px,1fr) 320px}}.integrated-workbench{container-type:inline-size}@container (width<=1100px){.integrated-workbench .overview-hero{grid-template-columns:minmax(0,1fr)}.integrated-workbench .overview-hero__copy{overflow-wrap:anywhere;min-width:0}.integrated-workbench .overview-hero__badges{flex-wrap:wrap}.integrated-workbench .overview-hero__stats{grid-template-columns:repeat(3,minmax(0,1fr))}.integrated-workbench .overview-hero__stats>div{flex-direction:column;align-items:flex-start;min-width:0;display:flex}.integrated-workbench .experiment-v3-grid{grid-template-columns:220px minmax(0,1fr)}.integrated-workbench .experiment-v3-side{grid-column:1/-1;grid-template-columns:1fr 1fr}.integrated-workbench .research-stage-rail{grid-template-columns:repeat(4,minmax(0,1fr));overflow-x:visible}.integrated-workbench .literature-v2__layout,.integrated-workbench .inbox-v2__layout{grid-template-columns:210px minmax(0,1fr)}.integrated-workbench .literature-v2__detail,.integrated-workbench .inbox-output{grid-column:1/-1}.integrated-workbench .vscode-shell{grid-template-rows:minmax(0,1fr) 180px 340px 22px;grid-template-columns:42px 220px minmax(0,1fr);height:820px}.integrated-workbench .vscode-source-control{border-top:1px solid rgb(var(--vscode-line));border-left:0;grid-area:3/2/auto/4;display:flex}.integrated-workbench .vscode-terminal{grid-column:3}.integrated-workbench .vscode-statusbar{grid-area:4/1/auto/4}.integrated-workbench .paper-v3__shell{grid-template-columns:220px minmax(0,1fr);height:auto}.integrated-workbench .paper-v3__sources,.integrated-workbench .paper-v3__source{min-height:720px}.integrated-workbench .paper-v3__outputs{grid-column:1/-1;min-height:720px}.integrated-workbench .process-review-layout,.integrated-workbench .final-review-layout{grid-template-columns:220px minmax(0,1fr)}.integrated-workbench .review-live,.integrated-workbench .final-review-form{grid-column:1/-1}}@container (width<=480px){.integrated-workbench .overview-hero__stats{grid-template-columns:minmax(0,1fr)}}@container (width<=700px){.integrated-workbench .overview-hero{padding:18px}.integrated-workbench .overview-lower{grid-template-columns:minmax(0,1fr)}.integrated-workbench .ros-page,.integrated-workbench .overview-page,.integrated-workbench .page{padding:16px 16px 28px}.integrated-workbench .ros-page-header{flex-direction:column;gap:12px}.integrated-workbench .header-badges{justify-content:flex-start;width:100%}.integrated-workbench .module-grid,.integrated-workbench .copilot-v2__layout{grid-template-columns:1fr}.integrated-workbench .copilot-v2__aside{display:none}.integrated-workbench .experiment-v3-grid,.integrated-workbench .literature-v2__layout,.integrated-workbench .inbox-v2__layout,.integrated-workbench .process-review-layout,.integrated-workbench .final-review-layout{grid-template-columns:1fr}.integrated-workbench .experiment-v3-side,.integrated-workbench .literature-v2__detail,.integrated-workbench .inbox-output,.integrated-workbench .review-live,.integrated-workbench .final-review-form{grid-column:auto}.integrated-workbench .experiment-v3-side,.integrated-workbench .inbox-output,.integrated-workbench .literature-v2__detail{grid-template-columns:1fr}.integrated-workbench .experiment-header-actions{justify-content:flex-start;width:100%}.integrated-workbench .experiment-header-actions .button{flex:96px;justify-content:center;min-width:0}.integrated-workbench .experiment-progress-hero{grid-template-columns:1fr;gap:12px;padding:18px 16px 0}.integrated-workbench .progress-number{align-items:flex-start;padding-right:0}.integrated-workbench .progress-number strong{font-size:38px}.integrated-workbench .truthful-progress__legend span:last-child{width:100%;margin-left:0}.integrated-workbench .progress-metrics{grid-template-columns:repeat(2,minmax(0,1fr));margin-inline:-16px}.integrated-workbench .progress-metrics>div:nth-child(2){border-right:0}.integrated-workbench .progress-metrics>div:nth-child(-n+2){border-bottom:1px solid rgb(var(--border))}.integrated-workbench .checkpoint-list{grid-template-columns:1fr;gap:8px}.integrated-workbench .checkpoint{text-align:left;grid-template-columns:30px minmax(0,1fr);align-items:center;gap:9px;display:grid}.integrated-workbench .checkpoint>div{margin-top:0;padding-inline:0}.integrated-workbench .checkpoint>i{display:none}.integrated-workbench .research-stage-rail,.integrated-workbench .intake-steps{grid-template-columns:repeat(2,minmax(0,1fr))}.integrated-workbench .intake-steps>div>svg,.integrated-workbench .literature-v2__sidebar{display:none}.integrated-workbench .literature-list-header{align-items:flex-start;gap:10px}.integrated-workbench .paper-grid{grid-template-columns:1fr}.integrated-workbench .paper-card{min-height:0}.integrated-workbench .literature-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.integrated-workbench .ide-context-strip{grid-template-columns:18px minmax(0,1fr) auto 28px}.integrated-workbench .ide-context-strip code,.integrated-workbench .ide-context-strip small{display:none}.integrated-workbench .vscode-shell,.integrated-workbench .paper-v3__shell{flex-direction:column;height:auto;display:flex}.integrated-workbench .vscode-activitybar{flex-direction:row;height:44px}.integrated-workbench .vscode-sidebar{min-height:420px}.integrated-workbench .vscode-editor{min-height:680px}.integrated-workbench .vscode-terminal{min-height:240px}.integrated-workbench .vscode-source-control{min-height:420px}.integrated-workbench .vscode-statusbar{min-height:22px}.integrated-workbench .paper-v3__sources{min-height:480px}.integrated-workbench .paper-v3__source,.integrated-workbench .paper-v3__outputs{min-height:720px}.integrated-workbench .review-flow,.integrated-workbench .release-module-grid,.integrated-workbench .review-mode-tabs{grid-template-columns:1fr}.integrated-workbench .review-mode-tabs>button{min-width:0}.integrated-workbench .review-flow b{display:none}.integrated-workbench .release-flow{grid-template-columns:1fr;gap:5px}.integrated-workbench .release-flow>b{transform:rotate(90deg)}.integrated-workbench .experiment-header-actions .\!button{flex:96px!important;justify-content:center!important;min-width:0!important}}@media (width<=1180px){:root{--sidebar:204px}.project-grid,.module-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.overview-hero{grid-template-columns:1fr}.overview-hero__stats{grid-template-columns:repeat(3,1fr)}.overview-hero__stats>div{flex-direction:column;align-items:flex-start;display:flex}.literature-v2__layout{grid-template-columns:210px minmax(0,1fr)}.literature-v2__detail{grid-column:1/-1;grid-template-columns:1.2fr 1fr 1fr}.inbox-v2__layout{grid-template-columns:210px minmax(0,1fr)}.inbox-output{grid-column:1/-1;grid-template-rows:520px;grid-template-columns:1fr 1fr}.ide-v2__shell{grid-template-columns:210px minmax(0,1fr)}.ide-v2__assistant{grid-area:auto/1/auto/-1;min-height:480px}.ide-v2__shell{grid-template-rows:570px 170px auto;height:auto}.ide-v2__explorer{grid-row:1/3}.ide-v2__terminal{grid-column:2}.paper-v2__shell{grid-template-columns:210px minmax(0,1fr);height:auto}.paper-v2__files,.paper-v2__editor{min-height:700px}.paper-v2__assistant{grid-column:1/-1;min-height:500px}.process-review-layout{grid-template-columns:240px minmax(0,1fr)}.review-live{grid-column:1/-1;max-height:500px}.final-review-layout{grid-template-columns:230px minmax(0,1fr)}.final-review-form{grid-column:1/-1}.experiment-workspace{grid-template-columns:220px minmax(0,1fr)}.experiment-side{grid-column:1/-1;grid-template-columns:1fr 1fr}}@media (width<=900px){.ros-topbar__menu{display:inline-grid}.ros-topbar .brand-button,.back-to-projects,.ros-topbar__divider{display:none}.workspace-project-select{min-width:0;max-width:280px}.ros-workspace{grid-template-columns:1fr}.ros-sidebar{inset:var(--topbar) auto 0 0;z-index:60;width:250px;transition:transform .2s;position:fixed;transform:translate(-102%);box-shadow:18px 0 50px #00000047}.ros-sidebar.is-mobile-open{transform:translate(0)}.ros-sidebar__mobile-brand{border-bottom:1px solid rgb(var(--border));justify-content:space-between;align-items:center;margin:-12px -12px 10px;padding:11px 12px;display:flex}.mobile-scrim{inset:var(--topbar) 0 0;z-index:55;background:#0000006b;display:block;position:fixed}.ros-page,.overview-page,.page{padding:20px}.project-hub{padding:34px 20px 60px}.project-hub__hero{flex-direction:column}.project-hub__summary{grid-template-columns:1fr}.project-grid{grid-template-columns:1fr 1fr}.overview-lower,.copilot-v2__layout{grid-template-columns:1fr}.copilot-v2__aside{display:none}.literature-stats{grid-template-columns:1fr 1fr}.literature-v2__layout{grid-template-columns:1fr}.literature-v2__sidebar{display:none}.literature-v2__detail{grid-column:auto;grid-template-columns:1fr}.paper-grid,.inbox-v2__layout{grid-template-columns:1fr}.inbox-sources{min-height:260px}.inbox-input{min-height:600px}.inbox-output{grid-column:auto;grid-template-rows:auto;grid-template-columns:1fr}.knowledge-panel,.first-prompt{min-height:460px}.ide-v2__shell{grid-template-columns:200px minmax(0,1fr)}.ide-v2__assistant{grid-column:1/-1}.paper-v2__shell{grid-template-columns:200px minmax(0,1fr)}.paper-v2__assistant{grid-column:1/-1}.process-review-layout,.final-review-layout{grid-template-columns:1fr}.review-rounds{max-height:360px}.review-live,.process-verdict-card,.final-review-form{grid-column:auto}.experiment-workspace{grid-template-columns:1fr}.experiment-side{grid-column:auto;grid-template-columns:1fr}.mission-hero{flex-direction:column}}@media (width<=640px){.ros-topbar{padding-inline:10px}.ros-topbar>.badge{display:none}.workspace-project-select select{font-size:11px}.ros-page,.overview-page,.page{padding:16px}.ros-page-header{flex-direction:column;gap:8px}.ros-page-header h1{font-size:21px}.project-hub{padding-inline:16px}.project-hub__hero h1{font-size:27px}.project-grid,.module-grid{grid-template-columns:1fr}.project-hub__toolbar{flex-direction:column;align-items:stretch}.search-field{min-width:0}.overview-hero{padding:18px}.overview-hero__stats,.overview-lower{grid-template-columns:1fr}.copilot-v2{height:auto;min-height:100%}.copilot-v2__thread{min-height:720px}.copilot-empty>div{grid-template-columns:1fr}.optimize-button{justify-content:center;width:35px;padding:0;font-size:0}.message--user{margin-left:40px}.prompt-optimizer__compare{grid-template-columns:1fr}.prompt-optimizer{max-height:95vh}.literature-stats,.paper-grid{grid-template-columns:1fr}.intake-steps{grid-template-columns:1fr 1fr}.intake-steps>div>svg{display:none}.form-grid,.new-project-fields{grid-template-columns:1fr}.inbox-input__actions{flex-direction:column}.workspace-connector{grid-template-columns:28px minmax(0,1fr)}.workspace-connector__state{grid-column:2}.workspace-connector>div:nth-child(2)>div{flex-direction:column}.ide-v2__shell{flex-direction:column;height:auto;display:flex}.ide-v2__explorer{min-height:400px}.ide-v2__center{min-height:650px}.ide-v2__terminal{min-height:220px}.ide-v2__assistant{min-height:520px}.paper-v2__shell{flex-direction:column;display:flex}.paper-v2__files{min-height:440px}.paper-v2__editor{min-height:700px}.paper-v2__assistant{min-height:560px}.review-mode-tabs{grid-template-columns:1fr}.process-review-layout,.final-review-layout{flex-direction:column;display:flex}.process-report,.final-review-report{min-height:600px}.metric-grid,.current-task__facts{grid-template-columns:1fr}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}:root{--font:"Inter Variable", "Noto Sans SC Variable", "Geist Variable", "PingFang SC", "Microsoft YaHei", sans-serif}.ros-page:not(.copilot-v2),.overview-page,.page--experiments{font-size:15px}.ros-page:not(.copilot-v2) .ros-page-header h1{font-size:27px}.ros-page:not(.copilot-v2) .ros-page-header p{font-size:13.5px;line-height:1.65}.copilot-v2 .ros-page-header h1{font-size:24px}.copilot-v2 .ros-page-header p{font-size:12px}.ros-page:not(.copilot-v2) .ros-card>header h2,.overview-page .panel__title{font-size:14px}.ros-page:not(.copilot-v2) .ros-card>header span{font-size:9.5px}.project-hub__hero p,.overview-hero__copy p{font-size:13px}.module-card{min-height:148px;padding:19px}.module-card h3{font-size:14px}.module-card p{font-size:11.5px;line-height:1.6}.copilot-v2__layout{grid-template-columns:minmax(0,1fr) 380px}.copilot-trace-v2{flex-direction:column;display:flex}.team-pipeline{flex:none;gap:0;padding:10px 12px;display:grid}.team-pipeline>div{color:rgb(var(--muted));border-radius:9px;grid-template-columns:10px 72px minmax(0,1fr);align-items:center;gap:7px;padding:7px 8px;display:grid;position:relative}.team-pipeline>div.is-active{background:rgb(var(--blue-bg));color:rgb(var(--text))}.team-pipeline>div.is-done{color:rgb(var(--text))}.team-pipeline strong{text-transform:capitalize;font-size:10px}.team-pipeline small{text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.team-pipeline b{display:none}.current-operation{border-block:1px solid rgb(var(--border));background:rgb(var(--green-bg) / .55);flex:none;grid-template-columns:32px minmax(0,1fr);gap:8px;padding:11px 14px;display:grid}.current-operation>span{background:rgb(var(--green-bg));width:30px;height:30px;color:rgb(var(--green));border-radius:9px;place-items:center;display:grid}.current-operation>div{flex-direction:column;min-width:0;display:flex}.current-operation small{color:rgb(var(--green));font-size:8.5px}.current-operation strong{margin:2px 0;font-size:10.5px}.current-operation code{color:rgb(var(--muted));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.activity-filters{border-bottom:1px solid rgb(var(--border));color:rgb(var(--faint));flex:none;align-items:center;gap:4px;padding:8px 10px;display:flex}.activity-filters button{color:rgb(var(--muted));background:0 0;border-radius:7px;padding:5px 8px;font-size:9px}.activity-filters button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.visual-activity-timeline{flex:1;min-height:0;padding:6px;overflow:auto}.visual-activity-timeline>button{text-align:left;background:0 0;border-radius:9px;grid-template-columns:29px minmax(0,1fr);gap:7px;width:100%;padding:7px;display:grid}.visual-activity-timeline>button:hover,.visual-activity-timeline>button.is-open{background:rgb(var(--surface-2))}.activity-icon{background:rgb(var(--surface-2));width:27px;height:27px;color:rgb(var(--muted));border-radius:8px;place-items:center;display:grid}.visual-activity-timeline button>div{min-width:0}.visual-activity-timeline button>div>div{align-items:center;gap:6px;display:flex}.visual-activity-timeline strong{text-overflow:ellipsis;white-space:nowrap;font-size:9.5px;overflow:hidden}.visual-activity-timeline time{color:rgb(var(--faint));font-family:var(--mono);margin-left:auto;font-size:7.5px}.visual-activity-timeline p{color:rgb(var(--muted));font-family:var(--mono);-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin:2px 0 0;font-size:8px;line-height:1.45;display:-webkit-box;overflow:hidden}.visual-activity-timeline button.is-open p{-webkit-line-clamp:8}.visual-activity-timeline button>div>code{border:1px solid rgb(var(--border));background:rgb(var(--surface));max-height:220px;color:rgb(var(--muted));white-space:pre-wrap;border-radius:7px;margin-top:6px;padding:7px;font-size:7.5px;display:block;overflow:auto}.activity-empty{color:rgb(var(--faint));text-align:center;padding:24px;font-size:10px}.literature-v2__layout{grid-template-columns:230px minmax(500px,1fr) 370px;gap:14px}.literature-stats>div{min-height:78px;padding:15px}.literature-stats p{font-size:11px}.literature-stats strong{font-size:20px}.library-tabs button{min-height:43px;font-size:12px}.search-field input{font-size:13px}.literature-list-header h2{font-size:17px}.literature-list-header p{font-size:11px}.paper-grid{gap:12px}.paper-card{min-height:242px;padding:17px}.paper-card h3{margin-top:13px;font-size:14.5px;line-height:1.48}.paper-card__authors{font-size:10.5px}.paper-card__summary{-webkit-line-clamp:4;font-size:11px;line-height:1.6}.paper-card__year{font-size:10px}.paper-card__footer code{font-size:8.5px}.paper-card__footer span{font-size:10.5px}.paper-detail h2{font-size:17px}.paper-detail__authors{font-size:10.5px}.paper-detail__body h3{font-size:11.5px}.paper-detail__body p,.paper-detail__body .markdown{font-size:11px;line-height:1.65}.paper-detail__source code{font-size:9px}.retrieval-panel strong{font-size:9.5px}.retrieval-panel code,.retrieval-panel time{font-size:8px}.inbox-v2__layout{grid-template-columns:230px minmax(430px,1.08fr) minmax(380px,.92fr);gap:14px}.inbox-input__form{padding:18px}.inbox-input .field>span{font-size:12px}.inbox-input textarea{font-size:13px;line-height:1.65}.inbox-upload-types{border:1px dashed rgb(var(--border-strong));background:rgb(var(--surface-2) / .45);border-radius:11px;grid-template-columns:repeat(3,auto) minmax(0,1fr);align-items:center;gap:7px;margin-top:10px;padding:9px 11px;display:grid}.inbox-upload-types>span{background:rgb(var(--surface));color:rgb(var(--muted));border-radius:7px;align-items:center;gap:4px;padding:5px 7px;font-size:9px;display:flex}.inbox-upload-types p{color:rgb(var(--faint));margin:0;font-size:9px;line-height:1.4}.inbox-attachment-list{gap:6px;margin-top:9px;display:grid}.inbox-attachment-list>span{border:1px solid rgb(var(--border));background:rgb(var(--surface));color:rgb(var(--violet));border-radius:9px;grid-template-columns:24px minmax(0,1fr) 24px;align-items:center;gap:7px;padding:7px 9px;display:grid}.inbox-attachment-list>span>div{flex-direction:column;min-width:0;display:flex}.inbox-attachment-list strong{color:rgb(var(--text));text-overflow:ellipsis;white-space:nowrap;font-size:10px;overflow:hidden}.inbox-attachment-list small{color:rgb(var(--faint));font-size:8px}.inbox-attachment-list button{color:rgb(var(--faint));background:0 0;place-items:center;display:grid}.knowledge-grid strong{font-size:11.5px}.knowledge-grid .markdown{font-size:10.5px;line-height:1.55}.first-prompt>textarea{font-size:10.5px}.ide-v3{--vscode-bg:var(--surface);--vscode-side:var(--panel);--vscode-panel:var(--bg);--vscode-line:var(--line);--vscode-text:var(--ink);--vscode-muted:var(--ink-faint);--vscode-blue:var(--blue);--vscode-hover:var(--conversation-user);--vscode-selected:var(--conversation-argus)}.ide-v3 :is(.vscode-shell,.vscode-sidebar,.vscode-editor,.vscode-activitybar,.vscode-terminal,.vscode-code,.vscode-statusbar,.workspace-node>button){transition:background-color .16s,color .16s,border-color .16s}.ide-v3 .workspace-connector{font-size:13px}.vscode-shell{border:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-bg));min-width:0;height:760px;color:rgb(var(--vscode-text));box-shadow:var(--shadow-2);border-radius:12px;grid-template-rows:minmax(0,1fr) 190px 22px;grid-template-columns:44px 245px minmax(480px,1fr) 330px;display:grid;overflow:hidden}.vscode-activitybar{background:rgb(var(--vscode-panel));flex-direction:column;grid-area:1/1/3;align-items:center;gap:3px;padding-top:5px;display:flex}.vscode-activitybar button{width:44px;height:44px;color:rgb(var(--vscode-muted));background:0 0;border-left:2px solid #0000;place-items:center;display:grid;position:relative}.vscode-activitybar button:hover,.vscode-activitybar button.is-active{color:rgb(var(--vscode-blue));background:rgb(var(--vscode-selected))}.vscode-activitybar button.is-active{border-left-color:rgb(var(--vscode-blue))}.vscode-activitybar i{background:rgb(var(--blue-deep));color:#fff;text-align:center;border-radius:999px;min-width:16px;height:16px;font-size:8px;font-style:normal;line-height:16px;position:absolute;bottom:3px;right:3px}.vscode-sidebar{border-right:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-side));flex-direction:column;grid-area:1/2/3;min-width:0;display:flex}.vscode-sidebar>header{justify-content:space-between;align-items:center;height:36px;padding:0 10px 0 14px;display:flex}.vscode-sidebar>header span{letter-spacing:.08em;font-size:9px}.vscode-sidebar>header button{color:rgb(var(--vscode-muted));background:0 0;place-items:center;display:grid}.vscode-root{background:rgb(var(--vscode-panel));text-transform:uppercase;align-items:center;gap:4px;height:25px;padding:0 7px;font-size:9px;display:flex}.vscode-sidebar .workspace-tree{background:rgb(var(--vscode-side))}.vscode-sidebar .workspace-node>button{color:rgb(var(--vscode-text))}.vscode-sidebar .workspace-node>button:hover{background:rgb(var(--vscode-hover))}.vscode-sidebar .workspace-node>button.is-selected{background:rgb(var(--vscode-selected));color:rgb(var(--vscode-blue));box-shadow:inset 2px 0 rgb(var(--vscode-blue))}.vscode-sidebar .workspace-node button>span:not(.node-spacer){font-size:11px}.vscode-changes{padding:4px;overflow:auto}.vscode-changes button{width:100%;color:rgb(var(--vscode-text));text-align:left;background:0 0;border-radius:3px;grid-template-columns:22px minmax(0,1fr);gap:4px;padding:5px;display:grid}.vscode-changes button:hover{background:rgb(var(--vscode-hover))}.vscode-changes b{color:rgb(var(--role-engineer));font-size:9px}.vscode-changes span{text-overflow:ellipsis;white-space:nowrap;font-size:9px;overflow:hidden}.vscode-editor{background:rgb(var(--vscode-bg));flex-direction:column;grid-area:1/3;min-width:0;display:flex}.vscode-tabs{background:rgb(var(--vscode-panel));flex:0 0 36px;height:36px;display:flex}.vscode-tabs button{border-top:1px solid rgb(var(--vscode-blue));background:rgb(var(--vscode-bg));min-width:180px;max-width:60%;color:rgb(var(--vscode-text));align-items:center;gap:6px;padding:0 10px;font-size:9px;display:flex}.vscode-tabs button>span{color:rgb(var(--vscode-muted));margin-left:auto}.vscode-breadcrumbs{border-bottom:1px solid rgb(var(--vscode-line));height:28px;color:rgb(var(--vscode-muted));flex:0 0 28px;align-items:center;padding:0 11px;font-size:8.5px;display:flex;overflow:hidden}.vscode-breadcrumbs span{white-space:nowrap;align-items:center;display:flex}.vscode-editor-surface{flex:1;min-height:0;overflow:hidden}.vscode-editor-surface .empty-state{color:rgb(var(--vscode-text))}.vscode-editor-surface .empty-state__icon{border-color:rgb(var(--vscode-line));background:rgb(var(--vscode-side))}.vscode-code{background:rgb(var(--vscode-bg));height:100%;font-family:var(--mono);grid-template-columns:48px minmax(0,1fr);font-size:12px;line-height:1.7;display:grid;overflow:auto}.vscode-line-numbers{background:rgb(var(--vscode-bg));color:rgb(var(--vscode-muted));-webkit-user-select:none;user-select:none;flex-direction:column;align-items:flex-end;padding:12px 9px;display:flex;position:sticky;left:0}.vscode-line-numbers span{flex:none;height:1.7em}.vscode-code pre{min-width:max-content;color:rgb(var(--vscode-text));tab-size:2;white-space:pre;margin:0;padding:12px 18px 60px 8px}.vscode-editor-surface .workspace-pdf,.vscode-editor-surface .workspace-image{background:rgb(var(--vscode-bg))}.vscode-source-control{border-left:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-side));flex-direction:column;grid-area:1/4;min-width:0;display:flex}.vscode-source-control>header{border-bottom:1px solid rgb(var(--vscode-line));justify-content:space-between;align-items:center;height:49px;padding:0 10px;display:flex}.vscode-source-control>header>div{flex-direction:column;min-width:0;display:flex}.vscode-source-control header span{color:rgb(var(--vscode-muted));letter-spacing:.08em;font-size:8px}.vscode-source-control header strong{margin-top:2px;font-size:10px}.vscode-sc-tabs{border-bottom:1px solid rgb(var(--vscode-line));height:31px;display:flex}.vscode-sc-tabs button{color:rgb(var(--vscode-muted));background:0 0;border-bottom:1px solid #0000;flex:1;font-size:9px}.vscode-sc-tabs button.is-active{border-bottom-color:rgb(var(--vscode-blue));color:rgb(var(--vscode-text))}.vscode-git-content{flex:1;min-height:0;overflow:auto}.vscode-status,.vscode-diff{color:rgb(var(--vscode-text));font-family:var(--mono);white-space:pre-wrap;margin:0;padding:10px;font-size:8.5px;line-height:1.55}.vscode-status{border-bottom:1px solid rgb(var(--vscode-line));color:rgb(var(--vscode-text))}.vscode-commits{padding:5px}.vscode-commits article{grid-template-columns:22px minmax(0,1fr);gap:5px;padding:6px;display:grid}.vscode-commits strong{text-overflow:ellipsis;white-space:nowrap;font-size:9px;display:block;overflow:hidden}.vscode-commits small{color:rgb(var(--vscode-muted));font-size:7.5px}.vscode-terminal{border-top:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-panel));flex-direction:column;grid-area:2/3/auto/5;min-width:0;min-height:0;display:flex}.vscode-terminal>header{flex:0 0 31px;justify-content:space-between;align-items:center;height:31px;padding:0 10px;display:flex}.vscode-terminal header>div{gap:13px;display:flex}.vscode-terminal header button{height:31px;color:rgb(var(--vscode-muted));background:0 0;border-bottom:1px solid #0000;font-size:8px}.vscode-terminal header button.is-active{border-bottom-color:rgb(var(--vscode-blue));color:rgb(var(--vscode-text))}.vscode-terminal header>span{color:rgb(var(--vscode-muted));align-items:center;gap:4px;font-size:8px;display:flex}.vscode-terminal>div{flex:1;min-height:0;padding:5px 10px;overflow:auto}.vscode-terminal article{font-family:var(--mono);grid-template-columns:52px 52px 10px minmax(0,1fr);gap:5px;padding:2px 0;font-size:8.5px;line-height:1.45;display:grid}.vscode-terminal time{color:rgb(var(--vscode-muted));font-variant-numeric:tabular-nums}.vscode-terminal article>span{color:rgb(var(--role-engineer))}.vscode-terminal code{overflow-wrap:anywhere;white-space:pre-wrap}.vscode-terminal p{color:rgb(var(--vscode-muted));font-family:var(--mono);font-size:9px}.vscode-statusbar{border-top:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-panel));color:rgb(var(--vscode-muted));grid-area:3/1/auto/5;align-items:center;gap:15px;padding:0 8px;font-size:8px;display:flex}.vscode-statusbar span{align-items:center;gap:4px;display:flex}.vscode-statusbar span:nth-child(2){margin-right:auto}.paper-root-bar{grid-template-columns:30px minmax(0,1fr) auto 34px;align-items:center;gap:8px;margin-bottom:12px;padding:9px 12px;display:grid}.paper-root-bar>div{flex-direction:column;display:flex}.paper-root-bar span{color:rgb(var(--faint));letter-spacing:.11em;font-size:8.5px;font-weight:700}.paper-root-bar input{font-family:var(--mono);background:0 0;border:0;outline:0;margin-top:2px;font-size:10.5px}.paper-v3__shell{grid-template-columns:245px minmax(470px,1.25fr) minmax(390px,.9fr);gap:14px;min-width:0;height:780px;display:grid}.paper-v3__sources{flex-direction:column;display:flex}.paper-source-group{padding:7px}.paper-source-group+.paper-source-group{border-top:1px solid rgb(var(--border))}.paper-source-group h3{color:rgb(var(--muted));letter-spacing:.08em;align-items:center;gap:5px;margin:3px 5px 7px;font-size:9.5px;display:flex}.paper-source-group>button{width:100%;color:rgb(var(--muted));text-align:left;background:0 0;border-radius:9px;grid-template-columns:22px minmax(0,1fr) auto;align-items:center;gap:6px;padding:8px;display:grid}.paper-source-group>button:hover,.paper-source-group>button.is-active{background:rgb(var(--surface-2))}.paper-source-group>button.is-active{color:rgb(var(--blue))}.paper-source-group button>div{flex-direction:column;min-width:0;display:flex}.paper-source-group strong,.paper-source-group code{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.paper-source-group strong{font-size:10.5px}.paper-source-group code,.paper-source-group small{color:rgb(var(--faint));font-size:8px}.paper-source-group>p{color:rgb(var(--faint));padding:8px;font-size:10px}.paper-v3__sources>footer{border-top:1px solid rgb(var(--border));margin-top:auto;padding:9px 11px}.paper-v3__sources footer span{color:rgb(var(--faint));font-size:8px;display:block}.paper-v3__sources footer code{text-overflow:ellipsis;white-space:nowrap;margin-top:3px;font-size:8px;display:block;overflow:hidden}.paper-v3__source{flex-direction:column;display:flex}.paper-v3__source>header{min-height:50px;padding:8px 12px}.paper-v3__source header>div{flex-direction:column;min-width:0;display:flex}.paper-v3__source header strong{font-size:12px}.paper-v3__source header code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.paper-v3__source header>span{color:rgb(var(--faint));font-size:8.5px}.paper-v3__source>div{flex:1;min-height:0;overflow:hidden}.paper-v3__source>footer,.paper-v3__outputs>footer{border-top:1px solid rgb(var(--border));height:31px;color:rgb(var(--faint));font-family:var(--mono);justify-content:space-between;align-items:center;padding:0 11px;font-size:8.5px;display:flex}.latex-source{background:rgb(var(--surface-2) / .38);height:100%;font-family:var(--mono);grid-template-columns:48px minmax(0,1fr);font-size:10.5px;line-height:1.65;display:grid;overflow:auto}.latex-line-numbers{background:rgb(var(--surface-2));color:rgb(var(--faint));-webkit-user-select:none;user-select:none;flex-direction:column;align-items:flex-end;padding:14px 9px;display:flex;position:sticky;left:0}.latex-line-numbers span{height:17.325px}.latex-source pre{white-space:pre;min-width:max-content;margin:0;padding:14px 18px 50px 8px}.paper-v3__outputs{flex-direction:column;display:flex}.paper-v3__outputs>nav{border-bottom:1px solid rgb(var(--border));grid-template-columns:repeat(3,1fr);padding:6px;display:grid}.paper-v3__outputs>nav button{color:rgb(var(--muted));background:0 0;border-radius:8px;justify-content:center;align-items:center;gap:4px;padding:7px 4px;font-size:10px;display:flex}.paper-v3__outputs>nav button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.paper-v3__outputs nav small{font-family:var(--mono)}.paper-output-surface{flex:1;min-height:0;overflow:hidden}.paper-output-surface>embed{background:#fff;border:0;width:100%;height:calc(100% - 34px)}.pdf-switcher{border-bottom:1px solid rgb(var(--border));height:34px;padding:4px;display:flex;overflow-x:auto}.pdf-switcher button{color:rgb(var(--muted));background:0 0;border-radius:6px;flex:none;padding:0 8px;font-size:8.5px}.pdf-switcher button.is-active{background:rgb(var(--surface-2));color:rgb(var(--text))}.paper-figure-grid{grid-template-columns:1fr 1fr;align-content:start;gap:8px;height:100%;padding:9px;display:grid;overflow:auto}.paper-figure-grid figure,.paper-figure-grid article{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:10px;min-width:0;margin:0;padding:7px}.paper-figure-grid img{-o-object-fit:contain;object-fit:contain;background:rgb(var(--surface-2));width:100%;height:150px}.paper-figure-grid figcaption{text-overflow:ellipsis;white-space:nowrap;margin-top:5px;font-size:8.5px;overflow:hidden}.paper-figure-grid article{min-height:120px;color:rgb(var(--muted));text-align:center;flex-direction:column;justify-content:center;align-items:center;display:flex}.paper-figure-grid article strong{margin:7px 0 3px;font-size:10px}.paper-figure-grid article code{max-width:100%;color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:7.5px;overflow:hidden}.paper-reference-list{padding:7px}.paper-reference-list button{text-align:left;background:0 0;border-radius:8px;grid-template-columns:24px minmax(0,1fr);gap:7px;width:100%;padding:8px;display:grid}.paper-reference-list button:hover{background:rgb(var(--surface-2))}.paper-reference-list button>div{flex-direction:column;min-width:0;display:flex}.paper-reference-list strong{font-size:10px}.paper-reference-list code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8px;overflow:hidden}.review-flow{grid-template-columns:repeat(4,1fr);gap:8px;margin-bottom:12px;display:grid}.review-flow>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:68px;color:rgb(var(--muted));border-radius:12px;grid-template-columns:25px 24px minmax(0,1fr);align-items:center;gap:7px;padding:10px;display:grid;position:relative}.review-flow>div.is-active{border-color:rgb(var(--blue) / .3);background:rgb(var(--blue-bg));color:rgb(var(--blue))}.review-flow>div.is-done{color:rgb(var(--green))}.review-flow>div>span{background:rgb(var(--surface-2));border-radius:7px;place-items:center;width:23px;height:23px;font-size:9px;font-weight:700;display:grid}.review-flow>div>div{flex-direction:column;display:flex}.review-flow strong{color:rgb(var(--text));font-size:11px}.review-flow small{margin-top:2px;font-size:8.5px}.review-flow b{z-index:2;color:rgb(var(--faint));font-weight:400;position:absolute;right:-8px}.process-review-layout,.final-review-layout{min-height:650px}.review-rounds strong{font-size:10.5px}.review-rounds small{font-size:9px}.process-report .markdown,.final-review-report .markdown{font-size:12.5px;line-height:1.72}.final-review-form .field>span{font-size:11.5px}.final-review-form select,.final-review-form textarea{font-size:12px}@media (width<=1450px){.literature-v2__layout{grid-template-columns:220px minmax(440px,1fr) 340px}.inbox-v2__layout{grid-template-columns:210px minmax(390px,1fr) 350px}.vscode-shell{grid-template-columns:42px 225px minmax(420px,1fr) 300px}.paper-v3__shell{grid-template-columns:225px minmax(420px,1fr) 360px}}@media (width<=1180px){.copilot-v2__layout{grid-template-columns:minmax(0,1fr) 340px}.literature-v2__layout{grid-template-columns:220px minmax(0,1fr)}.literature-v2__detail{grid-column:1/-1;grid-template-columns:1.2fr 1fr 1fr}.inbox-v2__layout{grid-template-columns:220px minmax(0,1fr)}.inbox-output{grid-column:1/-1}.vscode-shell{grid-template-rows:minmax(0,1fr) 180px 22px;grid-template-columns:42px 220px minmax(0,1fr);height:820px}.vscode-source-control{display:none}.vscode-terminal{grid-column:3}.vscode-statusbar{grid-column:1/4}.paper-v3__shell{grid-template-columns:220px minmax(0,1fr);height:auto}.paper-v3__sources,.paper-v3__source{min-height:720px}.paper-v3__outputs{grid-column:1/-1;min-height:720px}}@media (width<=900px){.copilot-v2__layout{grid-template-columns:1fr}.copilot-v2__aside{display:none}.literature-v2__layout{grid-template-columns:1fr}.literature-v2__sidebar{display:none}.inbox-v2__layout{grid-template-columns:1fr}.inbox-output{grid-column:auto}.vscode-shell{grid-template-columns:42px 210px minmax(0,1fr)}.paper-v3__shell{grid-template-columns:210px minmax(0,1fr)}.paper-v3__outputs{grid-column:1/-1}}@media (width<=640px){.ros-page:not(.copilot-v2) .ros-page-header h1{font-size:23px}.ros-page:not(.copilot-v2) .ros-page-header p{font-size:12.5px}.vscode-shell{flex-direction:column;height:auto;display:flex}.vscode-activitybar{flex-direction:row;height:44px}.vscode-sidebar{min-height:420px}.vscode-editor{min-height:680px}.vscode-terminal{min-height:240px}.vscode-statusbar{height:22px}.paper-root-bar{grid-template-columns:25px minmax(0,1fr) auto}.paper-root-bar>.icon-button{display:none}.paper-v3__shell{flex-direction:column;display:flex}.paper-v3__sources{min-height:480px}.paper-v3__source,.paper-v3__outputs{min-height:720px}.paper-figure-grid{grid-template-columns:1fr}.review-flow{grid-template-columns:1fr 1fr}.review-flow b{display:none}.inbox-upload-types{grid-template-columns:1fr 1fr 1fr}.inbox-upload-types p{grid-column:1/-1}}.pdf-canvas-viewer{background:#525256;flex-direction:column;height:calc(100% - 34px);display:flex;overflow:hidden}.pdf-canvas-toolbar{background:rgb(var(--surface));flex:0 0 37px;align-items:center;gap:6px;min-height:37px;padding:0 8px;display:flex}.pdf-canvas-toolbar strong{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:9px;overflow:hidden}.pdf-canvas-toolbar span{color:rgb(var(--muted));font-size:8.5px}.pdf-canvas-toolbar button{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));min-width:27px;height:25px;color:rgb(var(--muted));border-radius:6px;padding:0 6px;font-size:8px}.pdf-canvas-scroll{text-align:center;flex:1;min-height:0;padding:14px;overflow:auto}.pdf-canvas-scroll canvas{background:#fff;max-width:none;display:inline-block;box-shadow:0 3px 18px #00000059}.pdf-canvas-viewer>.inline-error{margin:10px}.custom-project-switcher{min-width:280px;max-width:430px;position:relative}.project-switcher-trigger{text-align:left;background:0 0;border:1px solid #0000;border-radius:10px;grid-template-columns:8px minmax(0,1fr) 16px;align-items:center;gap:9px;width:100%;min-height:38px;padding:0 9px;transition:background .15s,border-color .15s;display:grid}.project-switcher-trigger:hover,.project-switcher-trigger.is-open{border-color:rgb(var(--border));background:rgb(var(--surface-2))}.project-switcher-trigger strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.project-switcher-trigger>svg{color:rgb(var(--faint));transition:transform .15s}.project-switcher-trigger.is-open>svg{transform:rotate(180deg)}.project-switcher-popover{z-index:100;border:1px solid rgb(var(--border));background:rgb(var(--overlay));width:min(440px,100vw - 28px);box-shadow:var(--shadow-3);border-radius:14px;animation:.14s ease-out popoverIn;position:absolute;top:calc(100% + 8px);left:0;overflow:hidden}.project-switcher-popover>header{border-bottom:1px solid rgb(var(--border));flex-direction:column;padding:12px 14px;display:flex}.project-switcher-popover header span{color:rgb(var(--faint));letter-spacing:.13em;font-size:8.5px;font-weight:700}.project-switcher-popover header strong{margin-top:2px;font-size:13px}.project-switcher-popover>div{max-height:390px;padding:6px;overflow:auto}.project-switcher-popover>div>button{width:100%;color:rgb(var(--text));text-align:left;background:0 0;border-radius:10px;grid-template-columns:38px minmax(0,1fr) 18px;align-items:center;gap:9px;padding:9px;display:grid}.project-switcher-popover>div>button:hover{background:rgb(var(--surface-2))}.project-switcher-popover>div>button.is-selected{background:rgb(var(--blue-bg))}.project-option-icon{background:rgb(var(--surface-2));width:36px;height:36px;color:rgb(var(--muted));border-radius:10px;place-items:center;display:grid}.project-option-icon.is-live{background:rgb(var(--green-bg));color:rgb(var(--green))}.project-option-copy{grid-template-columns:minmax(0,1fr) auto;gap:2px 8px;min-width:0;display:grid}.project-option-copy strong{text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.project-option-copy small{color:rgb(var(--faint));font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;grid-column:1/-1;font-size:7.5px;overflow:hidden}.project-option-copy em{color:rgb(var(--muted));white-space:nowrap;grid-area:1/2;font-size:8px;font-style:normal}.project-option-status{background:rgb(var(--faint));border-radius:50%;justify-self:center;width:7px;height:7px}.project-option-status.is-live{background:rgb(var(--green));box-shadow:0 0 0 4px rgb(var(--green) / .1)}.project-switcher-popover>footer{border-top:1px solid rgb(var(--border));background:rgb(var(--surface-2) / .55);color:rgb(var(--faint));justify-content:space-between;padding:8px 14px;font-size:8.5px;display:flex}.experiment-v3{max-width:1480px;margin:0 auto}.experiment-header-actions{flex-wrap:wrap;justify-content:flex-end;gap:7px;display:flex}.experiment-progress-hero{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:16px;grid-template-columns:minmax(0,1fr) 170px;gap:18px;padding:22px 24px 0;display:grid;overflow:hidden}.progress-hero-main{min-width:0}.progress-live-line{color:rgb(var(--muted));flex-wrap:wrap;align-items:center;gap:8px;font-size:10px;display:flex}.progress-live-line>span{border-left:1px solid rgb(var(--border));text-transform:capitalize;padding-left:8px}.progress-hero-main h2{letter-spacing:-.025em;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:12px 0 10px;font-size:21px;line-height:1.35;display:-webkit-box;overflow:hidden}.current-step-callout{border:1px solid rgb(var(--green) / .18);background:rgb(var(--green-bg) / .62);border-radius:12px;grid-template-columns:38px minmax(0,1fr);gap:9px;padding:10px 12px;display:grid}.current-step-callout>span{background:rgb(var(--green-bg));width:36px;height:36px;color:rgb(var(--green));border-radius:10px;place-items:center;display:grid}.current-step-callout>div{flex-direction:column;min-width:0;display:flex}.current-step-callout small{color:rgb(var(--green));font-size:9px;font-weight:650}.current-step-callout strong{margin:2px 0;font-size:12px}.current-step-callout code{color:rgb(var(--muted));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.progress-number{flex-direction:column;align-self:center;align-items:flex-end;padding-right:4px;display:flex}.progress-number>span{color:rgb(var(--blue));letter-spacing:.08em;font-size:9px;font-weight:700}.progress-number strong{letter-spacing:-.06em;margin:2px 0;font-size:43px;font-weight:720}.progress-number small{color:rgb(var(--muted));font-size:9.5px}.truthful-progress{grid-column:1/-1;margin-top:3px}.truthful-progress__track{background:rgb(var(--surface-3));border-radius:999px;height:13px;position:relative;overflow:visible}.truthful-progress__track .confirmed{background:rgb(var(--blue));border-radius:999px;transition:width .5s;position:absolute;inset:0 auto 0 0}.truthful-progress__track .\!confirmed{background:rgb(var(--blue))!important;border-radius:999px!important;transition:width .5s!important;position:absolute!important;inset:0 auto 0 0!important}.truthful-progress__track .estimated-range{border:1px dashed rgb(var(--blue) / .65);background:rgb(var(--blue) / .1);border-radius:999px;position:absolute;inset-block:1px}.truthful-progress__track i{background:rgb(var(--accent));width:2px;height:21px;box-shadow:0 0 0 3px rgb(var(--surface));border-radius:2px;transition:left .5s;position:absolute;top:-4px}.progress-metrics{border-top:1px solid rgb(var(--border));grid-column:1/-1;grid-template-columns:repeat(4,1fr);margin-inline:-24px;display:grid}.progress-metrics>div{border-right:1px solid rgb(var(--border));flex-direction:column;min-width:0;padding:13px 18px;display:flex}.progress-metrics>div:last-child{border-right:0}.progress-metrics span{color:rgb(var(--muted));align-items:center;gap:5px;font-size:9px;display:flex}.progress-metrics strong{text-overflow:ellipsis;white-space:nowrap;margin:5px 0 2px;font-size:16px;overflow:hidden}.progress-metrics small{color:rgb(var(--faint));-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:8.5px;line-height:1.4;display:-webkit-box;overflow:hidden}.research-stage-rail{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:14px;grid-template-columns:repeat(7,1fr);gap:5px;margin:12px 0;padding:8px;display:grid}.research-stage-rail>div{color:rgb(var(--faint));border-radius:9px;align-items:center;gap:6px;padding:7px 9px;display:flex;position:relative}.research-stage-rail>div>span{background:rgb(var(--surface-2));border-radius:8px;flex:0 0 24px;place-items:center;width:24px;height:24px;font-size:9px;font-weight:700;display:grid}.research-stage-rail strong{font-size:9px}.research-stage-rail>div>svg{z-index:2;position:absolute;right:-6px}.research-stage-rail>div.is-done{color:rgb(var(--green))}.research-stage-rail>div.is-done>span{background:rgb(var(--green-bg))}.research-stage-rail>div.is-active{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.research-stage-rail>div.is-active>span{background:rgb(var(--blue));color:#fff}.experiment-v3-grid{grid-template-columns:245px minmax(450px,1fr) 315px;align-items:start;gap:12px;display:grid}.experiment-task-route>div{max-height:720px;padding:6px;overflow:auto}.experiment-task-route>div>button{text-align:left;background:0 0;border-radius:10px;grid-template-columns:30px minmax(0,1fr);gap:7px;width:100%;padding:9px;display:grid}.experiment-task-route>div>button:hover,.experiment-task-route>div>button.is-active{background:rgb(var(--surface-2))}.task-state{border:1px solid rgb(var(--border));background:rgb(var(--surface));width:28px;height:28px;color:rgb(var(--faint));border-radius:9px;place-items:center;display:grid}.experiment-task-route button>div{flex-direction:column;min-width:0;display:flex}.experiment-task-route strong{-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:10.5px;line-height:1.4;display:-webkit-box;overflow:hidden}.experiment-task-route small{color:rgb(var(--faint));margin-top:3px;font-size:8.5px}.experiment-v3-center,.experiment-v3-side{gap:12px;min-width:0;display:grid}.checkpoint-list{grid-template-columns:repeat(4,1fr);gap:0;padding:14px;display:grid}.checkpoint{text-align:center;flex-direction:column;align-items:center;min-width:0;display:flex;position:relative}.checkpoint>span{z-index:2;border:2px solid rgb(var(--surface));background:rgb(var(--surface-2));width:30px;height:30px;color:rgb(var(--faint));box-shadow:0 0 0 1px rgb(var(--border));border-radius:50%;place-items:center;font-size:9px;font-weight:700;display:grid;position:relative}.checkpoint>i{background:rgb(var(--border));height:2px;position:absolute;top:15px;left:calc(50% + 15px);right:calc(15px - 50%)}.checkpoint>div{margin-top:8px;padding-inline:4px}.checkpoint strong{font-size:9.5px;display:block}.checkpoint p{color:rgb(var(--muted));margin:3px 0 0;font-size:8px;line-height:1.4}.checkpoint--active>span{background:rgb(var(--blue));color:#fff;animation:2s infinite livePulse}.selected-task-detail{border-top:1px solid rgb(var(--border));background:rgb(var(--surface-2) / .45);padding:12px 15px}.selected-task-detail>span{color:rgb(var(--faint));font-size:8px}.selected-task-detail strong{margin-top:3px;font-size:11px;display:block}.selected-task-detail p{color:rgb(var(--muted));-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:4px 0 0;font-size:9px;line-height:1.5;display:-webkit-box;overflow:hidden}.experiment-live-events{max-height:560px;overflow:auto}.experiment-team>div{padding:6px}.experiment-team article{border-radius:10px;grid-template-columns:10px minmax(0,1fr) auto;align-items:center;gap:8px;padding:9px;display:grid}.experiment-team article.is-active{background:rgb(var(--blue-bg))}.role-dot{background:rgb(var(--faint));border-radius:50%;width:8px;height:8px}.experiment-team article>div{min-width:0}.experiment-team strong{text-transform:capitalize;font-size:10.5px}.experiment-team p{color:rgb(var(--muted));text-overflow:ellipsis;white-space:nowrap;margin:2px 0;font-size:8.5px;overflow:hidden}.experiment-team small{color:rgb(var(--faint));font-size:8px}.estimate-note>div{padding:13px}.estimate-note p{color:rgb(var(--muted));margin:0 0 11px;font-size:9.5px;line-height:1.55}.estimate-note p strong{color:rgb(var(--text));margin-bottom:3px;display:block}@media (width<=1450px){.experiment-v3-grid{grid-template-columns:225px minmax(420px,1fr) 290px}}@media (width<=1180px){.experiment-v3-grid{grid-template-columns:220px minmax(0,1fr)}.experiment-v3-side{grid-column:1/-1;grid-template-columns:1fr 1fr}.research-stage-rail{grid-template-columns:repeat(7,minmax(135px,1fr));overflow-x:auto}}@media (width<=900px){.custom-project-switcher{min-width:0;max-width:320px}.progress-metrics{grid-template-columns:1fr 1fr}.progress-metrics>div:nth-child(2){border-right:0}.progress-metrics>div:nth-child(-n+2){border-bottom:1px solid rgb(var(--border))}.experiment-v3-grid{grid-template-columns:1fr}.experiment-v3-side{grid-column:auto;grid-template-columns:1fr}}@media (width<=640px){.project-switcher-trigger strong{font-size:11px}.project-switcher-popover{top:calc(var(--topbar) + 6px);width:auto;position:fixed;left:8px;right:8px}.experiment-progress-hero{grid-template-columns:1fr;padding:18px 18px 0}.progress-number{align-items:flex-start}.truthful-progress{grid-column:1}.progress-metrics{grid-column:1;margin-inline:-18px}.checkpoint-list{grid-template-columns:1fr;gap:6px}.checkpoint{text-align:left;grid-template-columns:34px minmax(0,1fr);align-items:center;min-height:50px;display:grid}.checkpoint>div{margin-top:0}.checkpoint>i{width:2px;height:auto;top:30px;bottom:-8px;left:15px}.checkpoint p{font-size:8.5px}}.experiment-v3 .experiment-v3-grid{margin-top:16px}.experiment-v3 .work-objective{color:rgb(var(--muted));overflow-wrap:anywhere;margin:0 0 16px;font-size:12px;line-height:1.7}.experiment-v3 .current-step-callout{border-color:rgb(var(--border));background:rgb(var(--surface-2))}.experiment-v3 .current-step-callout>span{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.experiment-v3 .current-step-callout small{color:rgb(var(--muted));font-size:11px}.experiment-v3 .current-step-callout strong{font-size:13px}.experiment-v3 .current-step-callout p{color:rgb(var(--muted));overflow-wrap:anywhere;white-space:pre-wrap;margin:4px 0 0;font-size:12px;line-height:1.6}.experiment-v3 .progress-number em{color:rgb(var(--faint));letter-spacing:-.02em;font-size:22px;font-style:normal;font-weight:450}.experiment-v3 .progress-number>span,.experiment-v3 .progress-number small{letter-spacing:0;font-size:11px}.experiment-v3 .truthful-progress__track{height:7px}.experiment-v3 .work-scope{color:rgb(var(--muted));margin:10px 0 16px;font-size:11px;line-height:1.7}.experiment-v3 .progress-metrics span{font-size:11px}.experiment-v3 .progress-metrics small{color:rgb(var(--muted));font-size:10px;line-height:1.6;display:block;overflow:visible}.work-item-group+.work-item-group{border-top:1px solid rgb(var(--border));margin-top:8px;padding-top:8px}.work-item-group h3{color:rgb(var(--muted));justify-content:space-between;margin:8px 9px;font-size:11px;font-weight:550;display:flex}.work-item-group h3 span{font-variant-numeric:tabular-nums}.work-item-group>button{text-align:left;background:0 0;border-radius:10px;grid-template-columns:30px minmax(0,1fr);gap:8px;width:100%;padding:11px 9px;display:grid}.work-item-group>button:hover,.work-item-group>button.is-active{background:rgb(var(--surface-2))}.experiment-v3 .work-item-group strong{font-size:12px;line-height:1.5}.experiment-v3 .work-item-group small{font-size:10px;line-height:1.5}.work-group-empty{color:rgb(var(--faint));margin:8px 9px 12px;font-size:11px}.work-conclusion>header{flex-wrap:wrap;gap:10px}.work-conclusion>header .badge{white-space:normal}.work-conclusion__body{padding:18px}.work-conclusion__body>p{color:rgb(var(--text));white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-size:13px;line-height:1.8}.work-conclusion__body>div{border-top:1px solid rgb(var(--border));margin-top:16px;padding-top:14px}.work-conclusion__body h3{color:rgb(var(--muted));margin:0 0 6px;font-size:11px;font-weight:650}.work-conclusion__body>div p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-size:12px;line-height:1.8}.experiment-v3 .work-conclusion__body>.work-scope{border-left:2px solid rgb(var(--border));margin:16px 0 0;padding-left:12px}.experiment-v3 .checkpoint strong{font-size:11px}.experiment-v3 .checkpoint p{font-size:10px;line-height:1.5}.experiment-v3 .selected-task-detail strong{font-size:12px}.experiment-v3 .selected-task-detail p{font-size:11px;line-height:1.7;display:block}.experiment-v3 .experiment-team p{white-space:normal;font-size:11px;line-height:1.6;overflow:visible}.experiment-v3 .experiment-team .work-team-note{margin:0;padding:14px 15px 6px}.experiment-v3 .experiment-team strong{font-size:12px}.experiment-v3 .estimate-note p{font-size:12px;line-height:1.7}.work-evidence-note{border-top:1px solid rgb(var(--border));color:rgb(var(--muted));grid-template-columns:16px minmax(0,1fr);align-items:start;gap:8px;padding-top:12px;font-size:11px;line-height:1.7;display:grid}.work-evidence-note>svg{margin-top:2px}.ide-context-strip{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:10px 10px 0 0;grid-template-columns:18px minmax(150px,240px) minmax(0,1fr) auto auto 28px;align-items:center;gap:8px;min-height:40px;margin-bottom:-1px;padding:5px 8px 5px 11px;display:grid}.ide-context-strip>svg{color:rgb(var(--muted))}.ide-context-strip select{background:0 0;border:0;outline:0;width:100%;font-size:10.5px;font-weight:620}.ide-context-strip code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.ide-context-strip small{color:rgb(var(--faint));font-family:var(--mono);font-size:8px}.ide-context-strip>button{background:rgb(var(--surface-2));width:27px;height:27px;color:rgb(var(--muted));border-radius:7px;place-items:center;display:grid}.ide-context-strip+.vscode-shell{border-radius:0 0 12px 12px}.repository-readiness{padding:11px}.repository-readiness h3{color:rgb(var(--vscode-text));margin:0 0 9px;font-size:11px}.repository-readiness dl{gap:5px;margin:0;display:grid}.repository-readiness dl>div{border:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-bg));border-radius:6px;grid-template-columns:110px minmax(0,1fr) 18px;align-items:center;gap:5px;padding:7px;display:grid}.repository-readiness dt{color:rgb(var(--vscode-muted));align-items:center;gap:5px;font-size:8.5px;display:flex}.repository-readiness dd{color:rgb(var(--vscode-text));font-family:var(--mono);text-overflow:ellipsis;white-space:pre-wrap;margin:0;font-size:7.8px;line-height:1.4;overflow:hidden}.repository-readiness i{border-radius:50%;place-items:center;width:17px;height:17px;font-style:normal;display:grid}.repository-readiness i.ok{background:rgb(var(--role-engineer) / .12);color:rgb(var(--role-engineer))}.repository-readiness i.missing{background:rgb(var(--role-reviewer) / .12);color:rgb(var(--role-reviewer))}.repository-readiness>p{border-top:1px solid rgb(var(--vscode-line));color:rgb(var(--vscode-muted));margin:10px 0 0;padding-top:9px;font-size:8.5px;line-height:1.5}.vscode-terminal>header>strong{color:rgb(var(--vscode-text));letter-spacing:.08em;font-size:8.5px}.paper-root-bar>div{min-width:0}.paper-root-bar select{background:0 0;border:0;outline:0;max-width:260px;margin-top:2px;font-size:10.5px;font-weight:620}.paper-root-bar code{color:rgb(var(--faint));font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;font-size:8px;overflow:hidden}.figure-loading{background:rgb(var(--surface-2));height:150px;color:rgb(var(--faint));place-items:center;font-size:9px;display:grid}.review-form-row{grid-template-columns:1fr 1fr;gap:8px;margin-top:11px;display:grid}.review-emphasis{border:1px solid rgb(var(--border));border-radius:10px;grid-template-columns:1fr 1fr;gap:5px;margin:11px 0;padding:10px;display:grid}.review-emphasis legend{color:rgb(var(--muted));padding:0 5px;font-size:10px;font-weight:620}.review-emphasis label{color:rgb(var(--muted));border-radius:7px;align-items:center;gap:5px;padding:4px 5px;font-size:8.5px;display:flex}.review-emphasis label:hover{background:rgb(var(--surface-2))}.review-emphasis input{accent-color:rgb(var(--blue))}.project-intake-start{align-items:center;gap:7px;display:flex}.project-intake-start select{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));border-radius:10px;outline:0;max-width:260px;height:42px;padding:0 9px;font-size:10px}.release-page{max-width:1280px;margin:0 auto}.release-hero{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:16px;grid-template-columns:58px minmax(0,1fr);align-items:center;gap:15px;padding:22px;display:grid}.release-hero>span{background:rgb(var(--surface-2));width:54px;height:54px;color:rgb(var(--text));border-radius:14px;place-items:center;display:grid}.release-hero h2{margin:3px 0 6px;font-size:21px}.release-hero p{max-width:780px;color:rgb(var(--muted));margin:0;font-size:11.5px;line-height:1.6}.release-module-grid{grid-template-columns:repeat(3,1fr);gap:12px;margin:14px 0;display:grid}.release-module{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:290px;box-shadow:var(--shadow-1);border-radius:15px;padding:17px}.release-module>header{justify-content:space-between;align-items:center;display:flex}.release-module header>span{background:rgb(var(--surface-2));width:42px;height:42px;color:rgb(var(--muted));border-radius:11px;place-items:center;display:grid}.release-module h3{margin:16px 0 6px;font-size:15px}.release-module>p{min-height:52px;color:rgb(var(--muted));margin:0;font-size:10.5px;line-height:1.55}.release-module ul{border-top:1px solid rgb(var(--border));gap:7px;margin:13px 0 0;padding:13px 0 0;list-style:none;display:grid}.release-module li{color:rgb(var(--muted));align-items:center;gap:6px;font-size:9.5px;display:flex}.release-module li svg{color:rgb(var(--green))}.release-flow{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:14px;grid-template-columns:1fr 20px 1fr 20px 1fr 20px 1fr;align-items:center;padding:12px;display:grid}.release-flow>div{border-radius:10px;grid-template-columns:32px minmax(0,1fr);gap:7px;padding:9px;display:grid}.release-flow>div>svg{color:rgb(var(--blue));grid-row:1/3;align-self:center}.release-flow strong{font-size:10px}.release-flow small{color:rgb(var(--faint));font-size:8px}.release-flow>b{color:rgb(var(--faint));text-align:center;font-weight:400}.release-boundary{border:1px solid rgb(var(--amber) / .22);background:rgb(var(--amber-bg));color:rgb(var(--amber));border-radius:12px;gap:9px;margin-top:12px;padding:12px;display:flex}.release-boundary strong{font-size:10.5px}.release-boundary p{margin:3px 0 0;font-size:9px;line-height:1.5}@media (width<=900px){.release-module-grid{grid-template-columns:1fr}.release-flow{grid-template-columns:1fr;gap:5px}.release-flow>b{transform:rotate(90deg)}.project-intake-start{flex-direction:column;align-items:stretch}.project-intake-start select{max-width:none}}@media (width<=640px){.ide-context-strip{grid-template-columns:18px minmax(0,1fr) auto 28px}.ide-context-strip code,.ide-context-strip small{display:none}.review-form-row,.review-emphasis,.release-hero{grid-template-columns:1fr}}@media (width<=1180px){.vscode-shell{grid-template-rows:minmax(0,1fr) 180px 340px 22px}.vscode-source-control{border-top:1px solid rgb(var(--vscode-line));border-left:0;grid-area:3/2/auto/4;display:flex}.vscode-statusbar{grid-row:4}}@media (width<=900px){.literature-v2__sidebar{display:block}.literature-v2__sidebar .library-tabs{grid-template-columns:repeat(4,1fr);gap:5px;display:grid}.literature-v2__sidebar .library-tabs button{justify-content:center;gap:7px}.literature-source-note{display:none}}@media (width<=640px){.literature-v2__sidebar .library-tabs{grid-template-columns:1fr 1fr}.vscode-source-control{min-height:420px}}@media (width<=900px){.copilot-v2{height:auto;min-height:100%;overflow:visible}.copilot-v2__layout{flex-direction:column;display:flex}.copilot-v2__thread{min-height:720px}.copilot-v2__aside{min-height:540px;display:block}}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.inset-y-1{top:.25rem;bottom:.25rem}.inset-y-2{top:.5rem;bottom:.5rem}.-bottom-2\.5{bottom:-.625rem}.-left-0\.5{left:-.125rem}.-top-1\.5{top:-.375rem}.-top-2\.5{top:-.625rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-4{left:1rem}.left-\[0\.6875rem\]{left:.6875rem}.left-\[10\%\]{left:10%}.left-\[5px\]{left:5px}.right-0\.5{right:.125rem}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-9{right:2.25rem}.right-\[10\%\]{right:10%}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-2{top:.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-6{top:1.5rem}.isolate{isolation:isolate}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[110\]{z-index:110}.z-\[70\]{z-index:70}.z-\[90\]{z-index:90}.order-2{order:2}.order-3{order:3}.m-1{margin:.25rem}.m-auto{margin:auto}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-1\.5{margin-top:.375rem;margin-bottom:.375rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-9{margin-top:2.25rem}.mt-\[7px\]{margin-top:7px}.mt-auto{margin-top:auto}.mt-px{margin-top:1px}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.flow-root{display:flow-root}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1\.4rem\]{height:1.4rem}.h-\[100dvh\]{height:100dvh}.h-\[68vh\]{height:68vh}.h-\[calc\(100\%-1rem\)\]{height:calc(100% - 1rem)}.h-\[min\(780px\,84dvh\)\]{height:min(780px,84dvh)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-72{max-height:18rem}.max-h-80{max-height:20rem}.max-h-\[100dvh\]{max-height:100dvh}.max-h-\[24vh\]{max-height:24vh}.max-h-\[30vh\]{max-height:30vh}.max-h-\[34rem\]{max-height:34rem}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[52vh\]{max-height:52vh}.max-h-\[600px\]{max-height:600px}.max-h-\[62vh\]{max-height:62vh}.max-h-\[64vh\]{max-height:64vh}.max-h-\[70dvh\]{max-height:70dvh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[72vh\]{max-height:72vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[calc\(100dvh-1\.5rem\)\]{max-height:calc(100dvh - 1.5rem)}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-10{min-height:2.5rem}.min-h-11{min-height:2.75rem}.min-h-14{min-height:3.5rem}.min-h-40{min-height:10rem}.min-h-52{min-height:13rem}.min-h-64{min-height:16rem}.min-h-72{min-height:18rem}.min-h-\[209px\]{min-height:209px}.min-h-\[3\.25rem\]{min-height:3.25rem}.min-h-\[320px\]{min-height:320px}.min-h-\[34rem\]{min-height:34rem}.min-h-\[60vh\]{min-height:60vh}.min-h-dvh{min-height:100dvh}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:.125rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[1\.4rem\]{width:1.4rem}.w-\[min\(30rem\,calc\(100vw-2rem\)\)\]{width:min(30rem,100vw - 2rem)}.w-\[min\(92vw\,42rem\)\]{width:min(92vw,42rem)}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0}.min-w-28{min-width:7rem}.min-w-3\.5{min-width:.875rem}.min-w-32{min-width:8rem}.min-w-44{min-width:11rem}.min-w-full{min-width:100%}.min-w-max{min-width:max-content}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-48{max-width:12rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-64{max-width:16rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[1600px\]{max-width:1600px}.max-w-\[260px\]{max-width:260px}.max-w-\[960px\]{max-width:960px}.max-w-\[calc\(100\%_-_3rem\)\]{max-width:calc(100% - 3rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.basis-full{flex-basis:100%}.table-fixed{table-layout:fixed}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x:-100%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate:-90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes appear{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.animate-appear{animation:.2s cubic-bezier(.4,0,.2,1) appear}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[16px_minmax\(0\,1fr\)\]{grid-template-columns:16px minmax(0,1fr)}.grid-cols-\[72px_minmax\(0\,1fr\)\]{grid-template-columns:72px minmax(0,1fr)}.grid-cols-\[84px_minmax\(0\,1fr\)_auto\]{grid-template-columns:84px minmax(0,1fr) auto}.grid-rows-\[1fr\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-1{row-gap:.25rem}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.justify-self-start{justify-self:start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overscroll-contain{overscroll-behavior:contain}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[18px\]{border-radius:18px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-xl{border-radius:.75rem}.rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.border-blue-deep{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.border-blue-deep\/30{border-color:rgb(var(--blue-deep) / .3)}.border-blue-deep\/50{border-color:rgb(var(--blue-deep) / .5)}.border-blue-deep\/60{border-color:rgb(var(--blue-deep) / .6)}.border-blue\/25{border-color:rgb(var(--blue) / .25)}.border-blue\/30{border-color:rgb(var(--blue) / .3)}.border-blue\/35{border-color:rgb(var(--blue) / .35)}.border-blue\/40{border-color:rgb(var(--blue) / .4)}.border-blue\/45{border-color:rgb(var(--blue) / .45)}.border-blue\/50{border-color:rgb(var(--blue) / .5)}.border-blue\/60{border-color:rgb(var(--blue) / .6)}.border-err{--tw-border-opacity:1;border-color:rgb(var(--err) / var(--tw-border-opacity,1))}.border-err\/30{border-color:rgb(var(--err) / .3)}.border-err\/35{border-color:rgb(var(--err) / .35)}.border-err\/40{border-color:rgb(var(--err) / .4)}.border-err\/50{border-color:rgb(var(--err) / .5)}.border-err\/60{border-color:rgb(var(--err) / .6)}.border-gold\/25{border-color:rgb(var(--gold) / .25)}.border-gold\/30{border-color:rgb(var(--gold) / .3)}.border-gold\/40{border-color:rgb(var(--gold) / .4)}.border-line{--tw-border-opacity:1;border-color:rgb(var(--line) / var(--tw-border-opacity,1))}.border-line\/40{border-color:rgb(var(--line) / .4)}.border-line\/50{border-color:rgb(var(--line) / .5)}.border-line\/60{border-color:rgb(var(--line) / .6)}.border-line\/70{border-color:rgb(var(--line) / .7)}.border-line\/80{border-color:rgb(var(--line) / .8)}.border-ok{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.border-ok\/20{border-color:rgb(var(--ok) / .2)}.border-ok\/30{border-color:rgb(var(--ok) / .3)}.border-ok\/35{border-color:rgb(var(--ok) / .35)}.border-ok\/40{border-color:rgb(var(--ok) / .4)}.border-ok\/45{border-color:rgb(var(--ok) / .45)}.border-ok\/60{border-color:rgb(var(--ok) / .6)}.border-panel{--tw-border-opacity:1;border-color:rgb(var(--panel) / var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-warn\/30{border-color:rgb(var(--warn) / .3)}.border-warn\/35{border-color:rgb(var(--warn) / .35)}.border-warn\/40{border-color:rgb(var(--warn) / .4)}.border-warn\/50{border-color:rgb(var(--warn) / .5)}.border-t-blue{--tw-border-opacity:1;border-top-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.bg-bg{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.bg-bg\/25{background-color:rgb(var(--bg) / .25)}.bg-bg\/30{background-color:rgb(var(--bg) / .3)}.bg-bg\/35{background-color:rgb(var(--bg) / .35)}.bg-bg\/40{background-color:rgb(var(--bg) / .4)}.bg-bg\/50{background-color:rgb(var(--bg) / .5)}.bg-bg\/60{background-color:rgb(var(--bg) / .6)}.bg-bg\/70{background-color:rgb(var(--bg) / .7)}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/20{background-color:#0003}.bg-black\/40{background-color:#0006}.bg-blue{--tw-bg-opacity:1;background-color:rgb(var(--blue) / var(--tw-bg-opacity,1))}.bg-blue-deep{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.bg-blue-deep\/10{background-color:rgb(var(--blue-deep) / .1)}.bg-blue-deep\/20{background-color:rgb(var(--blue-deep) / .2)}.bg-blue-deep\/5{background-color:rgb(var(--blue-deep) / .05)}.bg-blue-sky{--tw-bg-opacity:1;background-color:rgb(var(--blue-sky) / var(--tw-bg-opacity,1))}.bg-blue\/10{background-color:rgb(var(--blue) / .1)}.bg-blue\/5{background-color:rgb(var(--blue) / .05)}.bg-conversation-user{--tw-bg-opacity:1;background-color:rgb(var(--conversation-user) / var(--tw-bg-opacity,1))}.bg-emerald-500{--tw-bg-opacity:1;background-color:rgb(16 185 129/var(--tw-bg-opacity,1))}.bg-engineer{--tw-bg-opacity:1;background-color:rgb(var(--role-engineer) / var(--tw-bg-opacity,1))}.bg-err{--tw-bg-opacity:1;background-color:rgb(var(--err) / var(--tw-bg-opacity,1))}.bg-err\/10{background-color:rgb(var(--err) / .1)}.bg-err\/5{background-color:rgb(var(--err) / .05)}.bg-gold{--tw-bg-opacity:1;background-color:rgb(var(--gold) / var(--tw-bg-opacity,1))}.bg-gold\/5{background-color:rgb(var(--gold) / .05)}.bg-gold\/80{background-color:rgb(var(--gold) / .8)}.bg-ink{--tw-bg-opacity:1;background-color:rgb(var(--ink) / var(--tw-bg-opacity,1))}.bg-ink-faint{--tw-bg-opacity:1;background-color:rgb(var(--ink-faint) / var(--tw-bg-opacity,1))}.bg-ink-faint\/40{background-color:rgb(var(--ink-faint) / .4)}.bg-ink-faint\/45{background-color:rgb(var(--ink-faint) / .45)}.bg-ink-faint\/50{background-color:rgb(var(--ink-faint) / .5)}.bg-ink-faint\/60{background-color:rgb(var(--ink-faint) / .6)}.bg-line{--tw-bg-opacity:1;background-color:rgb(var(--line) / var(--tw-bg-opacity,1))}.bg-line\/30{background-color:rgb(var(--line) / .3)}.bg-line\/40{background-color:rgb(var(--line) / .4)}.bg-line\/55{background-color:rgb(var(--line) / .55)}.bg-line\/60{background-color:rgb(var(--line) / .6)}.bg-line\/70{background-color:rgb(var(--line) / .7)}.bg-line\/80{background-color:rgb(var(--line) / .8)}.bg-ok{--tw-bg-opacity:1;background-color:rgb(var(--ok) / var(--tw-bg-opacity,1))}.bg-ok\/10{background-color:rgb(var(--ok) / .1)}.bg-ok\/15{background-color:rgb(var(--ok) / .15)}.bg-ok\/5{background-color:rgb(var(--ok) / .05)}.bg-panel{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.bg-panel-raised{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.bg-panel\/80{background-color:rgb(var(--panel) / .8)}.bg-panel\/85{background-color:rgb(var(--panel) / .85)}.bg-panel\/95{background-color:rgb(var(--panel) / .95)}.bg-surface{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.bg-surface\/50{background-color:rgb(var(--surface) / .5)}.bg-surface\/60{background-color:rgb(var(--surface) / .6)}.bg-transparent{background-color:#0000}.bg-warn{--tw-bg-opacity:1;background-color:rgb(var(--warn) / var(--tw-bg-opacity,1))}.bg-warn\/10{background-color:rgb(var(--warn) / .1)}.bg-warn\/5{background-color:rgb(var(--warn) / .05)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-white\/\[0\.03\]{background-color:#ffffff08}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-px{padding-top:1px;padding-bottom:1px}.pb-1{padding-bottom:.25rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-0\.5{padding-left:.125rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-3\.5{padding-left:.875rem}.pl-4{padding-left:1rem}.pl-5{padding-left:1.25rem}.pl-7{padding-left:1.75rem}.pl-\[1\.125rem\]{padding-left:1.125rem}.pr-10{padding-right:2.5rem}.pr-14{padding-right:3.5rem}.pr-3{padding-right:.75rem}.pr-\[4\.75rem\]{padding-right:4.75rem}.pt-0\.5{padding-top:.125rem}.pt-1\.5{padding-top:.375rem}.pt-10{padding-top:2.5rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-7{padding-top:1.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace}.font-sans{font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.leading-\[1\.625\]{line-height:1.625}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-\[-0\.01em\]{letter-spacing:-.01em}.tracking-\[0\.06em\]{letter-spacing:.06em}.tracking-\[0\.08em\]{letter-spacing:.08em}.tracking-\[0\.12em\]{letter-spacing:.12em}.tracking-\[0\.14em\]{letter-spacing:.14em}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.16em\]{letter-spacing:.16em}.tracking-\[0\.18em\]{letter-spacing:.18em}.tracking-normal{letter-spacing:0}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-bg{--tw-text-opacity:1;color:rgb(var(--bg) / var(--tw-text-opacity,1))}.text-blue{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.text-blue-sky{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.text-blue\/75{color:rgb(var(--blue) / .75)}.text-err{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.text-err\/80{color:rgb(var(--err) / .8)}.text-gold{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.text-ink{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.text-ink-dim{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.text-ink-faint{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.text-manager{--tw-text-opacity:1;color:rgb(var(--role-manager) / var(--tw-text-opacity,1))}.text-ok{--tw-text-opacity:1;color:rgb(var(--ok) / var(--tw-text-opacity,1))}.text-surface{--tw-text-opacity:1;color:rgb(var(--surface) / var(--tw-text-opacity,1))}.text-warn{--tw-text-opacity:1;color:rgb(var(--warn) / var(--tw-text-opacity,1))}.text-warn\/80{color:rgb(var(--warn) / .8)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-blue\/35{-webkit-text-decoration-color:rgb(var(--blue) / .35);text-decoration-color:rgb(var(--blue) / .35)}.decoration-line{-webkit-text-decoration-color:rgb(var(--line) / 1);text-decoration-color:rgb(var(--line) / 1)}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.accent-blue{accent-color:rgb(var(--blue) / 1)}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-\[0_10px_24px_-20px_rgb\(0_0_0\/0\.2\)\]{--tw-shadow:0 10px 24px -20px #0003;--tw-shadow-colored:0 10px 24px -20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-glow{--tw-shadow:0 16px 44px #00000057;--tw-shadow-colored:0 16px 44px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-4{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-bg{--tw-ring-opacity:1;--tw-ring-color:rgb(var(--bg) / var(--tw-ring-opacity,1))}.ring-err\/30{--tw-ring-color:rgb(var(--err) / .3)}.ring-line\/35{--tw-ring-color:rgb(var(--line) / .35)}.ring-manager\/60{--tw-ring-color:rgb(var(--role-manager) / .6)}.ring-ok\/30{--tw-ring-color:rgb(var(--ok) / .3)}.ring-offset-1{--tw-ring-offset-width:1px}.ring-offset-panel{--tw-ring-offset-color:rgb(var(--panel) / 1)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\!filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\,transform\,visibility\]{transition-property:width,transform,visibility;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-shadow{transition-property:box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-500{transition-duration:.5s}.duration-panel{transition-duration:.22s}.ease-panel{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes prompt-optimizer-enter{0%{opacity:0;transform:translateY(8px)scale(.992)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes livePulse{0%,to{box-shadow:0 0 0 0 rgb(var(--green) / .25)}50%{box-shadow:0 0 0 5px rgb(var(--green) / 0)}}@keyframes blink{50%{opacity:.35}}@keyframes skeleton{to{background-position:-120% 0}}@keyframes popoverIn{0%{opacity:0;transform:translateY(-5px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}.integrated-workbench .literature-v2__sidebar .search-field{width:calc(100% - 24px);min-width:0;max-width:none}.integrated-workbench .literature-v2__main{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:16px;padding:16px;overflow:hidden}.integrated-workbench .literature-list-header{border-bottom:1px solid rgb(var(--border));min-height:0;margin-bottom:14px;padding-bottom:14px}.integrated-workbench .paper-grid{gap:14px}.integrated-workbench button.paper-card{border-color:rgb(var(--border-strong));background:rgb(var(--surface-2) / .42);width:100%;min-width:0;min-height:242px;box-shadow:none;padding:17px;overflow:hidden}.integrated-workbench .paper-card__meta{flex-wrap:wrap;align-items:flex-start;min-width:0}.integrated-workbench .paper-card__year{text-overflow:ellipsis;white-space:nowrap;min-width:0;margin-left:auto;overflow:hidden}.integrated-workbench .paper-card__footer{min-width:0}.integrated-workbench .paper-card__footer>span{white-space:nowrap;flex:none}.integrated-workbench .release-module>header .badge{flex-shrink:0}@container (width<=700px){.integrated-workbench .literature-v2__main{padding:12px}.integrated-workbench .literature-list-header{margin-bottom:12px;padding-bottom:12px}.integrated-workbench button.paper-card{min-height:0;padding:15px}}.overview-hero--plain{grid-template-columns:1fr}.overview-hero--plain .overview-hero__copy h1{margin-top:0}.overview-hero--plain .overview-hero__copy p{-webkit-line-clamp:unset;max-width:none;font-size:14px;line-height:1.7;display:block}.overview-hero--plain .overview-hero__copy>code{text-overflow:ellipsis;white-space:nowrap;font-size:11px;display:block;overflow:hidden}.placeholder\:text-ink-faint::placeholder{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}.last\:border-0:last-child{border-width:0}.last\:border-b-0:last-child{border-bottom-width:0}.last\:pb-0:last-child{padding-bottom:0}.focus-within\:border-blue\/60:focus-within{border-color:rgb(var(--blue) / .6)}.hover\:border-blue:hover{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.hover\:border-blue-deep:hover{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.hover\:border-blue-sky\/60:hover{border-color:rgb(var(--blue-sky) / .6)}.hover\:border-blue\/40:hover{border-color:rgb(var(--blue) / .4)}.hover\:border-blue\/45:hover{border-color:rgb(var(--blue) / .45)}.hover\:border-blue\/50:hover{border-color:rgb(var(--blue) / .5)}.hover\:border-blue\/60:hover{border-color:rgb(var(--blue) / .6)}.hover\:border-err\/50:hover{border-color:rgb(var(--err) / .5)}.hover\:border-ink-faint:hover{--tw-border-opacity:1;border-color:rgb(var(--ink-faint) / var(--tw-border-opacity,1))}.hover\:border-line\/70:hover{border-color:rgb(var(--line) / .7)}.hover\:border-ok:hover{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.hover\:bg-bg:hover{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.hover\:bg-bg\/30:hover{background-color:rgb(var(--bg) / .3)}.hover\:bg-bg\/60:hover{background-color:rgb(var(--bg) / .6)}.hover\:bg-bg\/70:hover{background-color:rgb(var(--bg) / .7)}.hover\:bg-blue-deep:hover{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.hover\:bg-blue-deep\/20:hover{background-color:rgb(var(--blue-deep) / .2)}.hover\:bg-blue-deep\/80:hover{background-color:rgb(var(--blue-deep) / .8)}.hover\:bg-blue\/10:hover{background-color:rgb(var(--blue) / .1)}.hover\:bg-blue\/15:hover{background-color:rgb(var(--blue) / .15)}.hover\:bg-err\/10:hover{background-color:rgb(var(--err) / .1)}.hover\:bg-line\/20:hover{background-color:rgb(var(--line) / .2)}.hover\:bg-ok\/10:hover{background-color:rgb(var(--ok) / .1)}.hover\:bg-ok\/15:hover{background-color:rgb(var(--ok) / .15)}.hover\:bg-panel:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.hover\:bg-panel-raised:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.hover\:bg-panel\/60:hover{background-color:rgb(var(--panel) / .6)}.hover\:bg-panel\/80:hover{background-color:rgb(var(--panel) / .8)}.hover\:bg-surface:hover{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.hover\:bg-warn\/10:hover{background-color:rgb(var(--warn) / .1)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-blue:hover{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.hover\:text-blue-sky:hover{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.hover\:text-err:hover{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.hover\:text-gold:hover{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.hover\:text-gold-soft:hover{--tw-text-opacity:1;color:rgb(var(--gold-soft) / var(--tw-text-opacity,1))}.hover\:text-ink:hover{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.hover\:text-ink-dim:hover{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-blue:hover{-webkit-text-decoration-color:rgb(var(--blue) / 1);text-decoration-color:rgb(var(--blue) / 1)}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.focus\:border-blue:focus{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.focus\:border-blue-deep:focus{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.focus\:border-blue\/60:focus,.focus-visible\:border-blue\/60:focus-visible{border-color:rgb(var(--blue) / .6)}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-blue:focus-visible{outline-color:rgb(var(--blue) / 1)}.focus-visible\:outline-blue-sky:focus-visible{outline-color:rgb(var(--blue-sky) / 1)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-blue-sky\/50:focus-visible{--tw-ring-color:rgb(var(--blue-sky) / .5)}.focus-visible\:ring-blue\/50:focus-visible{--tw-ring-color:rgb(var(--blue) / .5)}.active\:bg-panel-raised:active{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.enabled\:hover\:text-blue-sky:hover:enabled{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.enabled\:focus-visible\:underline:focus-visible:enabled{text-decoration-line:underline}.enabled\:focus-visible\:outline-none:focus-visible:enabled{outline-offset:2px;outline:2px solid #0000}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-35:disabled{opacity:.35}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-45:disabled{opacity:.45}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group:focus-within .group-focus-within\:opacity-100{opacity:1}.group:hover .group-hover\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}.group:hover .group-hover\:bg-ink-faint\/30{background-color:rgb(var(--ink-faint) / .3)}.group:hover .group-hover\:opacity-100{opacity:1}.group:focus .group-focus\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}@media (prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media (width>=640px){.sm\:left-auto{left:auto}.sm\:order-none{order:0}.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mx-8{margin-left:2rem;margin-right:2rem}.sm\:inline{display:inline}.sm\:h-20{height:5rem}.sm\:max-h-\[88dvh\]{max-height:88dvh}.sm\:w-20{width:5rem}.sm\:w-auto{width:auto}.sm\:max-w-48{max-width:12rem}.sm\:max-w-\[82\%\]{max-width:82%}.sm\:max-w-md{max-width:28rem}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-\[100px_minmax\(0\,1fr\)\]{grid-template-columns:100px minmax(0,1fr)}.sm\:grid-cols-\[minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) auto}.sm\:grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.sm\:flex-nowrap{flex-wrap:nowrap}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-5{padding:1.25rem}.sm\:p-6{padding:1.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-5{padding-left:1.25rem;padding-right:1.25rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:px-8{padding-left:2rem;padding-right:2rem}.sm\:pt-14{padding-top:3.5rem}.sm\:text-right{text-align:right}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:opacity-0{opacity:0}.group:focus-within .sm\:group-focus-within\:opacity-100,.group:hover .sm\:group-hover\:opacity-100{opacity:1}}@media (width>=768px){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-80{width:20rem}.md\:shrink-0{flex-shrink:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:border-r{border-right-width:1px}.md\:border-line\/60{border-color:rgb(var(--line) / .6)}}@media (width>=1024px){.lg\:visible{visibility:visible}.lg\:static{position:static}.lg\:z-auto{z-index:auto}.lg\:col-span-2{grid-column:span 2/span 2}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:min-h-0{min-height:0}.lg\:w-\[var\(--preview-width\)\]{width:var(--preview-width)}.lg\:w-\[var\(--sidebar-width\,256px\)\]{width:var(--sidebar-width,256px)}.lg\:max-w-\[61\.8vw\]{max-width:61.8vw}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-\[280px_minmax\(0\,1fr\)\]{grid-template-columns:280px minmax(0,1fr)}.lg\:grid-cols-\[minmax\(0\,1\.15fr\)_minmax\(260px\,0\.85fr\)\]{grid-template-columns:minmax(0,1.15fr) minmax(260px,.85fr)}.lg\:grid-cols-\[minmax\(0\,1\.4fr\)_minmax\(300px\,0\.8fr\)\]{grid-template-columns:minmax(0,1.4fr) minmax(300px,.8fr)}.lg\:grid-cols-\[minmax\(15rem\,0\.72fr\)_minmax\(0\,1\.8fr\)\]{grid-template-columns:minmax(15rem,.72fr) minmax(0,1.8fr)}.lg\:gap-3{gap:.75rem}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:border-b-0{border-bottom-width:0}.lg\:border-r{border-right-width:1px}}@media (width>=1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,1fr\)_minmax\(18rem\,0\.85fr\)\]{grid-template-columns:minmax(0,1fr) minmax(18rem,.85fr)}.xl\:border-b-0{border-bottom-width:0}.xl\:border-r{border-right-width:1px}}.\[\&\>section\>div\>button\:first-child\]\:px-3>section>div>button:first-child{padding-left:.75rem;padding-right:.75rem}.\[\&\>section\]\:mx-2>section{margin-left:.5rem;margin-right:.5rem}.\[\&\>section\]\:border-0>section{border-width:0}.\[\&\>section\]\:py-0>section{padding-top:0;padding-bottom:0} diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-BPQjY3tf.js b/frontend/web/dist/assets/ResearchWorkbenchPanel-BPQjY3tf.js new file mode 100644 index 000000000..aa2241bab --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-BPQjY3tf.js @@ -0,0 +1,12 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,c as i,n as a}from"./query-dCPZk0Xc.js";import{D as o,F as s,H as c,I as l,N as u,O as d,P as f,S as p,V as m}from"./index-Dkv2HM-n.js";import{A as h,C as g,F as _,I as v,L as y,M as b,O as x,S,_ as C,b as w,j as T,n as E,s as D,w as O,x as k}from"./AppearanceControls-DpaE5wy6.js";import{t as A}from"./activity-BmXzrCrJ.js";import{a as j,i as M,n as ee,o as N,r as te,t as ne}from"./sliders-horizontal-BiyUR49M.js";import{t as re}from"./code-xml-xZvprTy7.js";import{a as P,i as F}from"./useWorkbenchTheme-DMn1yhZa.js";import{Ct as ie,Dt as I,Et as ae,F as L,Ft as R,It as z,St as B,Tt as oe,_t as V,at as se,gt as H,it as ce,jt as le,l as ue,m as de,nt as fe,ot as pe,p as me,rt as he,tt as ge,vt as _e,wt as ve,x as ye,xt as be}from"./App-DHmEWeHX.js";var xe=y(`ArrowDownToLine`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Se=y(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ce=y(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),we=y(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),Te=y(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Ee=y(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),De=y(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),Oe=y(`FlaskConical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),ke=y(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ae=y(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),je=y(`LockKeyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Me=y(`Radio`,[[`path`,{d:`M4.9 19.1C1 15.2 1 8.8 4.9 4.9`,key:`1vaf9d`}],[`path`,{d:`M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5`,key:`u1ii0m`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5`,key:`1j5fej`}],[`path`,{d:`M19.1 4.9C23 8.8 23 15.1 19.1 19`,key:`10b0cb`}]]),Ne=y(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Pe=y(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Fe=y(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Ie=y(`UserRound`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Le=y(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),U=e(n(),1),Re=12e3;function W(e=!1){let t={...f()};return e&&(t[`Content-Type`]=`application/json`),t}async function G(e,t={}){await l();let n={...t,headers:{...W(!!t.body),...t.headers??{}},cache:`no-store`},r=String(t.method??`GET`).toUpperCase(),i=async n=>{if(!n.ok){let r=await n.text().catch(()=>``),i=r;try{i=JSON.parse(r).detail??r}catch{}throw Error(i||`${t.method??`GET`} ${e} failed (${n.status})`)}return await n.json()};return r===`GET`?m(e,n,Re,i):i(await fetch(e,n))}var K=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`,ze=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`;function Be(e){let t=e.replaceAll(`\r +`,` +`).split(` + +`),n=t.pop()??``,r=[];return t.forEach(e=>{e.split(` +`).forEach(e=>{if(e.startsWith(`data:`))try{let t=JSON.parse(e.slice(5).trim());r.push(t)}catch{}})}),{frames:r,rest:n}}function Ve(e,t){let n=String(e.type??``);if(n===`phase`)t.onPhase?.(String(e.label??``),String(e.role??`manager`),String(e.detail??``),e.heartbeat===!0);else if(n===`delta`)t.onDelta?.(String(e.text??``),String(e.fragment_mode??`auto`));else if(n===`done`){let n=e.result??{};return t.onDone?.(n),n}else if(n===`error`)throw Error(String(e.error??`Manager stream failed`));return null}var q={timelineExample:()=>G(`/api/research/timeline/example`),timelineEstimate:(e,t)=>G(`/api/research/timeline/estimate`,{method:`POST`,body:JSON.stringify(e),signal:t}),timelineLatest:e=>G(K(e,`/research/timeline`)),timelineSave:(e,t,n,r)=>G(K(e,`/research/timeline`),{method:`POST`,body:JSON.stringify({input:t,expected_version:n,reason:r})}),projects:e=>G(`/api/projects`,{signal:e}),snapshot:(e,t)=>G(K(e,`/snapshot?events_limit=40&compact=false`),{signal:t}),status:(e,t)=>G(K(e,`/status`),{signal:t}),events:(e,t=180,n)=>G(K(e,`/events?limit=${t}&view=ui`),{signal:n}).then(e=>e.events),transcript:(e,t=100,n)=>G(K(e,`/transcript?n=${t}`),{signal:n}).then(e=>e.turns),journal:(e,t=80,n)=>G(K(e,`/journal?n=${t}`),{signal:n}).then(e=>e.journal),artifacts:(e,t)=>G(K(e,`/artifacts`),{signal:t}).then(e=>e.artifacts),counterexamples:(e,t)=>G(K(e,`/counterexamples`),{signal:t}),artifact:(e,t,n)=>G(K(e,`/artifact?${new URLSearchParams({path:t})}`),{signal:n}),artifactBlob:async(e,t,n=!1,r)=>{await l();let i=new URLSearchParams({path:t});n&&i.set(`download`,`true`);let a=K(e,`/artifact/raw?${i}`);return m(a,{headers:W(),signal:r,cache:`no-store`},Re,async e=>{if(!e.ok)throw Error(`Artifact unavailable (${e.status})`);return e.blob()})},gitDiff:(e,t)=>G(K(e,`/git-diff`),{signal:t}),rewritePrompt:(e,t,n)=>G(K(e,`/prompt/rewrite`),{method:`POST`,body:JSON.stringify({text:t}),signal:n}),note:(e,t)=>G(K(e,`/note`),{method:`POST`,body:JSON.stringify({text:t})}),uploadAttachments:async(e,t,n)=>{await l();let r=new FormData;t.forEach(e=>r.append(`files`,e,e.name));let i=await fetch(K(e,`/attachments`),{method:`POST`,headers:W(),body:r,signal:n});if(!i.ok)throw Error(await i.text()||`attachment upload failed (${i.status})`);return await i.json()},createDaemon:(e,t=``,n=``)=>G(`/api/daemons`,{method:`POST`,body:JSON.stringify({objective:e,name:t,workdir:n,command_id:ze()})}),createFinalReview:(e,t)=>G(K(e,`/reviews/final`),{method:`POST`,body:JSON.stringify(t)}),startDaemon:(e,t)=>G(K(e,`/daemon/start`),{method:`POST`,body:JSON.stringify({command_id:ze(),expected_revision:t})}).then(c),stopDaemon:(e,t,n)=>G(K(e,`/daemon/stop`),{method:`POST`,body:JSON.stringify({drain:t,command_id:ze(),expected_revision:n})}).then(c),async messageStream(e,t,n={},r,i=[]){await l();let a=K(e,`/message/stream`),o=await fetch(a,{method:`POST`,headers:W(!0),body:JSON.stringify(i.length?{text:t,attachments:i}:{text:t}),signal:r});if(!o.ok){let e=await o.text().catch(()=>``);throw Error(e||`Manager request failed (${o.status})`)}if(!o.body)throw Error(`Manager returned an empty stream`);let s=o.body.getReader(),c=new TextDecoder,u=``,d={};for(;;){let e=await s.read();if(e.done)break;u+=c.decode(e.value,{stream:!0});let t=Be(u);u=t.rest,t.frames.forEach(e=>{let t=Ve(e,n);t&&(d=t)})}return Be(`${u}\n\n`).frames.forEach(e=>{let t=Ve(e,n);t&&(d=t)}),d}};function He(e,t,n){let r=!1,i=null,a,o=800,c=()=>{if(r)return;let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({replay:`40`,view:`ui`}),d=s();d&&u.set(`token`,d),i=new WebSocket(`${l}//${window.location.host}${K(e,`/stream`)}?${u}`),i.onopen=()=>{o=800,n(!0)},i.onmessage=e=>{try{t(JSON.parse(String(e.data)))}catch{}},i.onerror=()=>i?.close(),i.onclose=e=>{n(!1),!(r||e.code===4401||e.code===4404)&&(a=window.setTimeout(c,o),o=Math.min(o*1.7,8e3))}};return c(),{close:()=>{r=!0,a&&window.clearTimeout(a),i?.close()}}}var Ue={active:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],running:[`进行中`,`In progress`],working:[`进行中`,`In progress`],pending:[`等待中`,`Waiting`],queued:[`等待中`,`Waiting`],waiting:[`等待中`,`Waiting`],idle:[`等待中`,`Waiting`],accepted:[`已完成`,`Completed`],complete:[`已完成`,`Completed`],completed:[`已完成`,`Completed`],done:[`已完成`,`Completed`],success:[`已完成`,`Completed`],blocked:[`已阻塞`,`Blocked`],failed:[`失败`,`Failed`],error:[`失败`,`Failed`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],replan_requested:[`需要重新规划`,`Needs replanning`],incomplete:[`尚未完成`,`Incomplete`],research_incomplete:[`研究尚未完成`,`Research incomplete`],paused_no_breakthrough:[`暂未取得突破,已暂停`,`Paused without a breakthrough`],exhausted_current_methods:[`当前方法已尝试完`,`Current methods exhausted`],no_progress:[`暂无新进展,已暂停`,`Paused without new progress`],max_rounds:[`已到本次轮次上限`,`Round limit reached`],infra_blocked:[`等待运行条件恢复`,`Waiting for the runtime to recover`],supervisor_error:[`执行异常`,`Execution failed`],skipped:[`已跳过`,`Skipped`],paused:[`已暂停`,`Paused`],paused_cost:[`费用待对账`,`Awaiting usage reconciliation`],stopped:[`已暂停`,`Paused`],cancelled:[`已暂停`,`Paused`],aborted:[`已暂停`,`Paused`],not_started:[`等待中`,`Waiting`],healthy:[`状态正常`,`Healthy`],degraded:[`部分受限`,`Limited`]},We={system:[`Argus`,`Argus`],operator:[`你`,`You`],stopped:[`已暂停`,`Paused`],idle:[`等待中`,`Waiting`]};function Ge(e,t,n,r){let i=t[String(e??``).toLowerCase()]??n;return r(i[0],i[1])}function Ke(e,t){return String(e??``).startsWith(`paused_`)&&!Ue[String(e)]?t(`已暂停`,`Paused`):Ge(e,Ue,[`状态已更新`,`Status updated`],t)}function qe(e,t){let n=String(e??``).toLowerCase();return O(n)?g(n,e=>t(o(e,{},`zh-CN`),o(e,{},`en`))):Ge(e,We,[`Argus`,`Argus`],t)}function J(){let{locale:e,t}=d();return{locale:e,text:(0,U.useCallback)((t,n)=>e===`zh-CN`?t:n,[e]),t}}function Je(...e){return e.filter(Boolean).join(` `)}function Ye(e){let t=Math.max(0,Math.floor(Number(e??0)));if(t<60)return`${t}s`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n?`${n}d ${r}h`:r?`${r}h ${i}m`:`${i}m`}function Xe(e,t){return e?new Date(e*1e3).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):`—`}function Ze(e){let t=String(e??``).toLowerCase();return/failed|error|blocked|rejected|stalled|dead|abort/.test(t)?`danger`:/warn|waiting|paused|hold|queued|pending|continue/.test(t)?`warn`:/done|complete|completed|accepted|healthy|success|passed/.test(t)?`success`:/run|active|work|claimed|progress|live/.test(t)?`live`:/research|plan|info|ready/.test(t)?`info`:`neutral`}function Qe(e){let t=String(e.agent_layer??e.actor??``).toLowerCase();if(t===`main`||t.startsWith(`engineer`))return`engineer`;if(t.startsWith(`review`))return`reviewer`;if(t.startsWith(`plan`))return`planner`;if(t.startsWith(`manager`))return`manager`;let n=String(e.type??``);return/review/.test(n)?`reviewer`:/planner/.test(n)?`planner`:/manager/.test(n)?`manager`:/engineer|round/.test(n)?`engineer`:`system`}function $e(e,t){let n=String(e.action_summary??``).trim();if(n)return t?pe(n,t):n;let r=String(e.title??``).trim();if(r)return t?pe(r,t):r;let i=t?ce(String(e.type??``),t):null;if(i)return i;let a=String(e.kind??``).trim();return a?a.replaceAll(`_`,` `):String(e.type??`event`).split(`.`).slice(-2).join(` · `).replaceAll(`_`,` `)}function et(e,t=400){let n=String(e.text??e.reason??e.summary??e.detail??``).trim();return n?n.length>t?`${n.slice(0,t)}…`:n:``}var Y=t();function X({children:e,tone:t=`neutral`,dot:n=!1,className:r}){return(0,Y.jsxs)(`span`,{className:Je(`badge`,`badge--${t}`,r),children:[n?(0,Y.jsx)(`span`,{className:Je(`badge__dot`,t===`live`&&`is-pulsing`)}):null,e]})}function Z({icon:e=Ee,title:t,description:n,action:r}){return(0,Y.jsxs)(`div`,{className:`empty-state`,children:[(0,Y.jsx)(`span`,{className:`empty-state__icon`,children:(0,Y.jsx)(e,{size:19})}),(0,Y.jsx)(`div`,{className:`empty-state__title`,children:t}),n?(0,Y.jsx)(`p`,{children:n}):null,r?(0,Y.jsx)(`div`,{className:`empty-state__action`,children:r}):null]})}function tt({label:e}){let{text:t}=J();return(0,Y.jsxs)(`span`,{className:`spinner`,role:`status`,children:[(0,Y.jsx)(le,{size:15,className:`spin`}),` `,e||t(`加载中`,`Loading`)]})}function nt({events:e,limit:t=24,empty:n,dense:r=!1}){let{locale:i,text:a}=J(),o=e.slice(-t).reverse();return o.length?(0,Y.jsx)(`div`,{className:Je(`event-list`,r&&`event-list--dense`),children:o.map((e,t)=>{let n=Qe(e),o=$e(e,i),s=he(et(e,r?180:480),i).text,c=Ze(String(e.status??e.kind??e.type??``));return(0,Y.jsxs)(`article`,{className:`event-row`,children:[(0,Y.jsx)(`div`,{className:Je(`event-row__marker`,`event-row__marker--${c}`)}),(0,Y.jsxs)(`div`,{className:`event-row__content`,children:[(0,Y.jsxs)(`div`,{className:`event-row__meta`,children:[(0,Y.jsx)(`span`,{className:`role-label`,style:{color:k(n)},children:qe(n,a)}),(0,Y.jsx)(`time`,{children:Xe(e.ts,i)})]}),(0,Y.jsx)(`div`,{className:`event-row__title`,children:o}),s?(0,Y.jsx)(`div`,{className:`event-row__detail`,children:s}):null]})]},`${e.type}-${e.ts}-${e.message_id??t}`)})}):(0,Y.jsx)(Z,{icon:Me,title:n||a(`还没有可展示的实时动态`,`No activity to show yet`)})}var rt=new Set([`done`,`completed`,`accepted`,`success`]),it=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]),at=/continue|replan|reject|blocked|fail|error|incomplete|revoked/,ot=new Set([`assistant_message`,`agent_message`,`message`]),st=new Set([`life.planner.task_added`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.phase.started`,`life.manager.stage_decision`,`round.start`,`round.main.completed`,`round.review.started`,`round.review.completed`,`round.review.deferred`,`round.backend_failure.backoff`,`work.segment`,`work.segment.started`,`work.segment.completed`]);function ct(e){let t=String(e.type??``),n=String(e.kind??``);return n!==`reasoning`&&!p(e)&&(st.has(t)||t===`engineer.progress`&&(ot.has(n)||[`tool_use`,`tool_result`,`command_execution`,`file_change`].includes(n)))}function lt(e){return e.type!==`engineer.progress`||!ot.has(String(e.kind??``))?e:{...e,text:L(String(e.text??``)),action_summary:L(String(e.action_summary??``)),title:L(String(e.title??``))}}function ut(e,t){return t?e.backlog.find(e=>e.id===t)??null:e.backlog.find(e=>it.has(e.status))??e.backlog.find(e=>e.status===`pending`)??e.backlog.at(-1)??null}function dt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function ft(e,t,n=Date.now()/1e3,r=`zh-CN`){let i=(e,t)=>r===`zh-CN`?e:t,a=e.mission_view,o=H(e,a,t,n),s=ut(e,o.taskId||a?.mission.id||``),c=s?.id||a?.mission.id||``,l=!!(c&&c===a?.mission.id),u=a?.dag?.length?a.dag:e.backlog,d=u.filter(e=>rt.has(e.status)).length,f=u.filter(e=>/^(pending|queued|waiting)$/.test(e.status)).length,p=!!(a?.routing?.open_ended||a?.routing?.lifetime===`standing`||e.continuous?.open_ended),m=dt(s?.started_ts)??(l?dt(a?.mission.started_at):null),h=dt(s?.finished_ts)??(l?dt(a?.mission.completed_at):null),g=e.backlog.filter(e=>it.has(e.status)).length>1,_=t.filter(e=>{if(!c||m!==null&&Number(e.ts??0)Number(e.ts??0)-Number(t.ts??0)),v=_.filter(ct).map(lt).filter(e=>!ot.has(String(e.kind??``))||!!(e.text||e.action_summary||e.title)),y=v.at(-1),b=o.state===`running`,x=h??(e.daemon.alive?n:dt(_.at(-1)?.ts)??m),S=m===null||x===null?null:Math.max(0,x-m),C=[..._].reverse().find(e=>V(e)===c&&e.type===`round.start`),w=Math.max(l?Number(a?.round.current??0):0,Number(C?.round_index??0)),T=[..._].reverse().find(e=>V(e)===c&&e.type===`round.start`&&Number(e.round_index)===w),E=_.filter(e=>{if(V(e)!==c||w<=0||T&&Number(e.ts??0)0?t===w:T!=null&&Number(e.ts??0)>=Number(T.ts??0)}),D=[...E].reverse().find(e=>e.type===`round.review.completed`),O=[...E].reverse().find(e=>e.type===`round.review.started`),k=!!(O&&(!D||Number(O.ts)>Number(D.ts))),A=b&&o.role===`reviewer`&&k,j=k?void 0:D,M=String(j?.status??``).toLowerCase(),ee=l?String(a?.review.status??``).toLowerCase():``,N=j?.review_skipped===!0||M===`skipped`,te=j?.review_source===`engineer_self_review`,ne=!j?.review_source||j.review_source===`reviewer`,re=!N&&ne&&M===`done`,P=!N&&(at.test(M)||!j&&!A&&at.test(ee)),F=A?`running`:N?`skipped`:re?`passed`:te&&M===`done`?`self_checked`:P?`needs_work`:`pending`,ie={pending:i(`结论待核对`,`Conclusion awaiting review`),running:i(`正在核对证据`,`Checking the evidence`),passed:i(`本轮工作通过核对`,`This round passed review`),needs_work:i(`仍需补充或修改`,`More work is needed`),skipped:i(`本轮未做审查`,`This round was not reviewed`),self_checked:i(`执行者已自查,待独立核对`,`Self-checked; independent review pending`)},I={pending:i(`尚无能对应到当前工作项和轮次的通过记录。`,`No passing review is linked to the current work item and round.`),running:i(`审阅者正在核对本轮结果及其证据。`,`The Reviewer is checking this round’s results and evidence.`),passed:i(`通过记录仅适用于本轮提交的工作与证据。`,`The passing verdict applies to the work and evidence submitted in this round.`),needs_work:i(`审查发现仍有待处理的问题,需要继续工作。`,`The review found issues that require further work.`),skipped:i(`执行结束并不代表证据已经通过核对。`,`The end of execution does not establish that the evidence passed review.`),self_checked:i(`这条记录来自执行者自查,尚无本轮独立审查通过记录。`,`This record is a self-check by the worker; no independent passing review is recorded for this round.`)},ae={state:F,label:ie[F],detail:String(j?.reason||P&&a?.review.reason||I[F]),scope:i(`当前工作项${w>0?` · 第 ${w} 轮`:``}。整体目标是否成立,仍须核对其完整验收条件。`,`Current work item${w>0?` · Round ${w}`:``}. The overall goal still requires checking its full acceptance criteria.`)},L=[...E].reverse().find(e=>e.type===`round.main.completed`),R=F===`passed`?`done`:F===`running`?`active`:F===`needs_work`?`blocked`:`pending`,z=[{id:`plan`,label:i(`工作项已记录`,`Work item recorded`),detail:s?.title||a?.mission.title||i(`等待任务`,`Waiting for a task`),status:s||l?`done`:`pending`},{id:`start`,label:i(`开始执行`,`Execution started`),detail:m===null?i(`尚无启动记录`,`No start is recorded`):i(`有任务启动时间记录`,`A task start time is recorded`),status:m===null?`pending`:`done`},{id:`handoff`,label:i(`本轮执行已结束`,`Round execution ended`),detail:L?i(`已记录本轮执行结束,结果是否可用仍需核对`,`The round’s execution ended; its results still need to be checked`):i(`尚无本轮执行结束记录`,`No end of execution is recorded for this round`),status:L?`done`:b&&o.role===`engineer`?`active`:`pending`},{id:`review`,label:i(`核对本轮证据`,`Check this round’s evidence`),detail:ae.label,status:R}],B=!!(s&&rt.has(s.status))||l&&[`complete`,`completed`,`done`].includes(a?.mission.status??``),oe=e.daemon.alive?p?i(`开放研究的剩余工作量尚不确定,无法可靠预计整体完成时间。`,`Open research has no known remaining workload, so its overall finish time cannot be reliably estimated.`):P?i(`审查要求继续补充或调整工作范围,暂无法预计完成时间。`,`Review requires further work or a scope change; a finish time is unavailable.`):B?i(`当前工作项已结束;这不提供整体目标的完成时间。`,`The current work item has ended; this does not establish when the overall goal will be reached.`):i(`当前记录没有可比较的固定工作量基线,暂无法可靠预计完成时间。`,`The current records contain no comparable, fixed-workload baseline for a reliable finish-time estimate.`):i(`运行已停止,无法预计完成时间。`,`Execution has stopped; a finish time is unavailable.`);return{workCompletion:u.length?d/u.length:null,workScope:i(`仅统计已记录的工作项;清单可随研究增减,完成比例不代表整体目标已成立。`,`Counts recorded work items only. The list can change during research; its completion fraction does not establish the overall goal.`),currentTask:s?.title||a?.mission.title||i(`等待新任务`,`Waiting for a new task`),currentTaskId:c,currentObjective:s?.objective||(l?a?.mission.objective:``)||``,currentStep:b&&y?$e(y,r):_e(o,r),currentDetail:y?et(y,700):s?.objective||``,currentEvent:y??null,runtime:o,elapsedSeconds:S,etaUnavailableReason:oe,checkpoints:z,completedTasks:d,totalTasks:u.length,pendingTasks:f,openEnded:p,review:ae,acceptanceCriteria:s?.acceptance_check||u.find(e=>e.id===c)?.acceptance_check||``,nextAction:s?.pending_question||String(j?.next_action||``),taskEvents:v}}var pt=new Set([`done`,`completed`,`accepted`,`success`]),mt=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]);function ht(e){let{locale:t,text:n,t:r}=J(),[i,a]=(0,U.useState)(()=>Date.now()/1e3),[o,s]=(0,U.useState)(``);(0,U.useEffect)(()=>{if(!e.active||!e.snapshot.daemon.alive)return;a(Date.now()/1e3);let t=window.setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(t)},[e.active,e.snapshot.daemon.alive]);let c=(0,U.useMemo)(()=>ft(e.snapshot,e.events,i,t),[t,i,e.events,e.snapshot]),l=e.snapshot.mission_view,u=l?.dag?.length?l.dag:e.snapshot.backlog.map(e=>({id:e.id,title:e.title,objective:e.objective,status:e.status,deps:e.deps??[],branch_id:e.id,parent_branch_id:``})),d=u.find(e=>e.id===o)??u.find(e=>e.id===c.currentTaskId),f=se(l?.stage.id,t),p=l?.stage.label&&l.stage.label!==l.stage.id?l.stage.label:f||l?.stage.id||n(`尚未记录`,`Not yet recorded`),m=c.runtime.state===`running`,g=_e(c.runtime,t),_=c.taskEvents.filter(e=>String(e.kind??``)!==`reasoning`&&!fe(String(e.type??``))),y=he(c.currentDetail,t),x=c.currentEvent?ge(c.currentEvent,t):null,C=he(c.review.detail,t),T=[{label:n(`已完成的工作`,`Completed work`),items:u.filter(e=>pt.has(e.status))},{label:n(`进行中与待处理`,`Active and remaining work`),items:u.filter(e=>!pt.has(e.status))}],E=async t=>{let r=t?n(`确认完成当前步骤后停止 Argus?`,`Stop Argus after the current step finishes?`):n(`确认立即停止 Argus?当前步骤可能被中断。`,`Stop Argus now? The current step may be interrupted.`);confirm(r)&&await e.controls.stop(t)};return(0,Y.jsxs)(`div`,{className:`ros-page experiment-v3`,children:[(0,Y.jsxs)(`header`,{className:`ros-page-header`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h1`,{children:n(`任务进展`,`Work progress`)}),(0,Y.jsx)(`p`,{children:n(`看清做了哪些工作、结论核对到了哪里,以及团队接下来要做什么。`,`See what work was done, which conclusions were checked, and what the team needs to do next.`)})]}),(0,Y.jsxs)(`div`,{className:`experiment-header-actions`,children:[(0,Y.jsxs)(`button`,{className:`button button--secondary`,type:`button`,onClick:()=>void e.refresh(),children:[(0,Y.jsx)(b,{size:14}),n(`刷新`,`Refresh`)]}),e.snapshot.daemon.alive&&e.snapshot.daemon.control_available===!1?null:e.snapshot.daemon.alive?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{className:`button button--secondary`,type:`button`,disabled:e.controls.busy,onClick:()=>void E(!0),children:[(0,Y.jsx)(M,{size:14}),n(`当前步后停止`,`Stop after step`)]}),(0,Y.jsxs)(`button`,{className:`button button--danger`,type:`button`,disabled:e.controls.busy,onClick:()=>void E(!1),children:[(0,Y.jsx)(I,{size:13}),n(`立即停止`,`Stop now`)]})]}):(0,Y.jsxs)(`button`,{className:`button button--primary`,type:`button`,disabled:e.controls.busy,onClick:()=>void e.controls.start(),children:[(0,Y.jsx)(te,{size:14}),n(`继续运行`,`Resume`)]})]})]}),(0,Y.jsxs)(`section`,{className:`experiment-progress-hero`,children:[(0,Y.jsxs)(`div`,{className:`progress-hero-main`,children:[(0,Y.jsxs)(`div`,{className:`progress-live-line`,children:[(0,Y.jsx)(X,{tone:m?`live`:`neutral`,dot:m,children:g}),c.runtime.role?(0,Y.jsx)(`span`,{children:qe(c.runtime.role,n)}):null]}),(0,Y.jsx)(`h2`,{children:c.currentTask}),c.currentObjective?(0,Y.jsx)(`p`,{className:`work-objective`,children:c.currentObjective}):null,(0,Y.jsxs)(`div`,{className:`current-step-callout`,children:[(0,Y.jsx)(`span`,{children:(0,Y.jsx)(A,{size:17})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`small`,{children:m?n(`当前动作`,`Current action`):n(`当前状态与最近记录`,`Current state and latest record`)}),(0,Y.jsx)(`strong`,{children:x?.title||c.currentStep}),x?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{children:x.detail}),(0,Y.jsx)(D,{label:n(`原始调用记录`,`Original call record`),children:(0,Y.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs`,children:c.currentDetail})})]}):c.currentDetail?(0,Y.jsx)(`p`,{title:y.technical||void 0,children:y.text}):null]})]})]}),(0,Y.jsxs)(`div`,{className:`progress-number`,children:[(0,Y.jsx)(`span`,{children:n(`已完成的工作项`,`Completed work items`)}),(0,Y.jsxs)(`strong`,{children:[c.completedTasks,(0,Y.jsxs)(`em`,{children:[` / `,c.totalTasks||`—`]})]}),(0,Y.jsx)(`small`,{children:n(`按当前记录计数`,`Counted from current records`)})]}),(0,Y.jsxs)(`div`,{className:`truthful-progress`,children:[c.workCompletion===null?null:(0,Y.jsx)(`div`,{className:`truthful-progress__track`,role:`progressbar`,"aria-label":n(`已记录工作项的完成情况`,`Completion of recorded work items`),"aria-valuemin":0,"aria-valuemax":c.totalTasks,"aria-valuenow":c.completedTasks,"aria-valuetext":n(`${c.totalTasks} 项已记录工作中完成 ${c.completedTasks} 项`,`${c.completedTasks} of ${c.totalTasks} recorded work items completed`),children:(0,Y.jsx)(`span`,{className:`confirmed`,style:{width:`${c.workCompletion*100}%`}})}),(0,Y.jsx)(`p`,{className:`work-scope`,children:c.workScope})]}),(0,Y.jsxs)(`div`,{className:`progress-metrics`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(N,{size:15}),n(`当前工作项已用时间`,`Current work item elapsed`)]}),(0,Y.jsx)(`strong`,{children:c.elapsedSeconds===null?`—`:Ye(c.elapsedSeconds)}),(0,Y.jsx)(`small`,{children:n(`按任务启动与结束记录计算`,`Based on recorded task start and end times`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`实际记录的阶段`,`Recorded stage`)}),(0,Y.jsx)(`strong`,{children:p}),(0,Y.jsx)(`small`,{children:n(`阶段名称不表示前面的工作已通过核验`,`The stage name does not certify earlier work`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`工作范围`,`Work scope`)}),(0,Y.jsx)(`strong`,{children:c.openEnded?n(`开放研究`,`Open research`):n(`当前工作项`,`Current work item`)}),(0,Y.jsx)(`small`,{children:c.openEnded?n(`可能产生新的问题和任务`,`New questions and tasks may emerge`):n(`以该工作项的验收条件为准`,`Defined by this item’s acceptance criteria`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(Le,{size:15}),n(`等待执行的工作`,`Work waiting to start`)]}),(0,Y.jsx)(`strong`,{children:c.pendingTasks}),(0,Y.jsx)(`small`,{children:n(`已记录清单中的等待项`,`Waiting items in the recorded list`)})]})]})]}),(0,Y.jsxs)(`div`,{className:`experiment-v3-grid`,children:[(0,Y.jsxs)(`aside`,{className:`ros-card experiment-task-route`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`工作项`,`Work items`)})}),(0,Y.jsx)(X,{tone:`neutral`,children:u.length})]}),(0,Y.jsx)(`div`,{children:u.length?T.map(e=>(0,Y.jsxs)(`section`,{className:`work-item-group`,children:[(0,Y.jsxs)(`h3`,{children:[e.label,(0,Y.jsx)(`span`,{children:e.items.length})]}),e.items.length?e.items.map(e=>{let t=m&&e.id===c.currentTaskId&&mt.has(e.status),r=mt.has(e.status)&&!t?e.id===c.currentTaskId?g:n(`等待状态确认`,`Awaiting status confirmation`):Ke(e.status,n);return(0,Y.jsxs)(`button`,{type:`button`,className:d?.id===e.id?`is-active`:``,onClick:()=>s(e.id),children:[(0,Y.jsx)(`span`,{className:`task-state task-state--${pt.has(e.status)?`success`:t?`live`:`neutral`}`,children:pt.has(e.status)?(0,Y.jsx)(v,{size:12}):t?(0,Y.jsx)(A,{size:12}):(0,Y.jsx)(Ce,{size:9})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.title||e.objective||n(`未命名任务`,`Untitled task`)}),(0,Y.jsxs)(`small`,{children:[r,e.deps.length?n(` · 前置工作 ${e.deps.length} 项`,` · ${e.deps.length} dependencies`):``]})]})]},e.id)}):(0,Y.jsx)(`p`,{className:`work-group-empty`,children:n(`暂无记录`,`No records yet`)})]},e.label)):(0,Y.jsx)(Z,{icon:Le,title:n(`尚无工作项`,`No work items yet`)})})]}),(0,Y.jsxs)(`main`,{className:`experiment-v3-center`,children:[(0,Y.jsxs)(`section`,{className:`ros-card work-conclusion`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`本轮结论与待核对问题`,`This round’s conclusions and open checks`)})}),(0,Y.jsx)(X,{tone:c.review.state===`passed`?`success`:c.review.state===`running`?`live`:`warn`,children:c.review.label})]}),(0,Y.jsxs)(`div`,{className:`work-conclusion__body`,children:[(0,Y.jsx)(`p`,{title:C.technical||void 0,children:C.text}),c.acceptanceCriteria?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:n(`判断这项工作是否完成的标准`,`How this work item is accepted`)}),(0,Y.jsx)(`p`,{children:c.acceptanceCriteria})]}):null,c.nextAction?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:n(`下一步要处理`,`What needs to happen next`)}),(0,Y.jsx)(`p`,{children:c.nextAction})]}):null,(0,Y.jsx)(`p`,{className:`work-scope`,children:c.review.scope})]})]}),(0,Y.jsxs)(`section`,{className:`ros-card checkpoint-card`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`当前工作项的过程记录`,`Current work item’s recorded steps`)})}),(0,Y.jsx)(X,{tone:`neutral`,children:n(`以记录为准`,`Based on records`)})]}),(0,Y.jsx)(`div`,{className:`checkpoint-list`,children:c.checkpoints.map((e,t)=>(0,Y.jsxs)(`div`,{className:`checkpoint checkpoint--${e.status}`,children:[(0,Y.jsx)(`span`,{children:e.status===`done`?(0,Y.jsx)(v,{size:13}):e.status===`active`?(0,Y.jsx)(A,{size:13}):e.status===`blocked`?(0,Y.jsx)(oe,{size:13}):t+1}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.label}),(0,Y.jsx)(`p`,{children:e.detail})]}),t{let t=m&&c.runtime.role===e;return(0,Y.jsxs)(`article`,{className:t?`is-active`:``,children:[(0,Y.jsx)(`span`,{"data-role-dot":e,className:`role-dot`,style:{backgroundColor:k(e)},"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:qe(e,n)}),(0,Y.jsx)(`p`,{children:S(e,r)})]}),t?(0,Y.jsx)(X,{tone:`live`,dot:!0,children:n(`执行中`,`Working`)}):(0,Y.jsx)(X,{tone:`neutral`,children:n(`未在执行`,`Not working`)})]},e)})})]}),(0,Y.jsxs)(`section`,{className:`ros-card estimate-note`,children:[(0,Y.jsx)(`header`,{children:(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`还需要多久`,`How much longer?`)})})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`strong`,{children:n(`暂无法可靠预计`,`No reliable estimate yet`)}),c.etaUnavailableReason]}),(0,Y.jsxs)(`div`,{className:`work-evidence-note`,children:[(0,Y.jsx)(h,{size:15}),(0,Y.jsx)(`span`,{children:n(`真实已用时间和已完成工作可以统计。读文件、运行命令或审查结束,都不能换算成整体目标的完成百分比。`,`Elapsed time and completed work can be counted. File reads, commands, and the end of a review do not establish a completion percentage for the overall goal.`)})]}),e.controls.error?(0,Y.jsx)(`div`,{className:`inline-error`,children:e.controls.error}):null]})]})]})]})]})}function gt(e){if(!e||e.length>2e5||e.includes(`\0`)||!e.startsWith(`diff --git `)&&!/^--- [^\n]+\n\+\+\+ /.test(e)||/^(?:Binary files |GIT binary patch)/m.test(e))return null;let t=e.match(/[^\n]*\n|[^\n]+$/g)??[];if(t.length>3e3)return null;let n=[],r=0,i=0;for(let e of t){let t=e.replace(/\r?\n$/,``),a,o=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@(?:.*)$/.exec(t);if(t.startsWith(`diff --git `))a=`header`,r=0,i=0;else if(o){if(a=`hunk`,r=Number(o[1]??1),i=Number(o[2]??1),!Number.isSafeInteger(r)||!Number.isSafeInteger(i))return null}else if(t===`\\ No newline at end of file`)a=`header`;else if(r||i){if(t.startsWith(`+`))a=`addition`,i--;else if(t.startsWith(`-`))a=`deletion`,r--;else if(t.startsWith(` `))a=`context`,r--,i--;else return null;if(r<0||i<0)return null}else if(/^(?:--- |\+\+\+ |index |old mode |new mode |new file mode |deleted file mode |similarity index |dissimilarity index |rename from |rename to |copy from |copy to )/.test(t))a=`header`;else return null;n.push({kind:a,text:e})}return n}function _t({diff:e,truncated:t=!1}){let{text:n}=J(),r=(0,U.useMemo)(()=>gt(e),[e]),[i,a]=(0,U.useState)(!1),o=r!==null&&!i;return(0,Y.jsxs)(`section`,{className:`readonly-diff`,"data-readonly-diff":!0,children:[(0,Y.jsxs)(`div`,{className:`readonly-diff__toolbar`,children:[(0,Y.jsx)(`strong`,{children:n(`当前工作区差异`,`Current workspace diff`)}),r&&(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?n(`着色视图`,`Highlighted view`):n(`原始文本`,`Original text`)}),e&&(0,Y.jsx)(C,{text:e,label:n(`复制原始差异`,`Copy original diff`),copiedLabel:n(`已复制`,`Copied`)})]}),(0,Y.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`不代表所有变更都来自当前 Agent 或任务。`,`Changes are not necessarily from this Agent or task.`)}),t&&(0,Y.jsx)(`p`,{role:`status`,className:`readonly-diff__notice`,children:n(`后端返回的差异已截断,当前内容不完整。`,`The backend truncated this diff; the displayed content is incomplete.`)}),e?r?null:(0,Y.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`无法识别、二进制或较大差异:显示原始文本。`,`Unrecognized, binary or large diff: showing original text.`)}):(0,Y.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`没有工作区差异。`,`No workspace diff.`)}),(0,Y.jsx)(`pre`,{className:`readonly-diff__text`,tabIndex:0,"aria-label":n(`工作区差异文本`,`Workspace diff text`),"data-diff-mode":o?`highlighted`:`raw`,children:o?r.map((e,t)=>(0,Y.jsx)(`span`,{"data-diff-kind":e.kind,className:`readonly-diff__line--${e.kind}`,children:e.text},t)):e})]})}async function vt(e,t,n){let r=new URLSearchParams(t),i=await fetch(`${e}?${r}`,{headers:W(),signal:n,cache:`no-store`});if(!i.ok){let t=await i.json().catch(()=>({}));throw Error(t.detail||t.error||`${e} failed (${i.status})`)}return i.json()}var yt=(e,t)=>({sid:e,workspace_id:t}),bt={profiles:(e,t)=>vt(`/api/v2/workspaces`,{sid:e},t),tree:(e,t,n)=>vt(`/api/v2/workspace/tree`,yt(e,t),n),file:(e,t,n,r)=>vt(`/api/v2/workspace/file`,{...yt(e,t),path:n},r),git:(e,t,n)=>vt(`/api/v2/workspace/git`,yt(e,t),n),literature:(e,t,n)=>vt(`/api/v2/workspace/literature`,yt(e,t),n),rawUrl:(e,t,n)=>`/api/v2/workspace/raw?${new URLSearchParams({...yt(e,t),path:n})}`,rawBlob:async(e,t,n,r)=>{let i=await fetch(`/api/v2/workspace/raw?${new URLSearchParams({...yt(e,t),path:n})}`,{headers:W(),signal:r,cache:`no-store`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`raw preview failed (${i.status})`)}return i.blob()}};function xt(e){let t=new Map;e.forEach(e=>t.set(e.path,{...e,children:[]}));let n=[];t.forEach(e=>{let r=e.path.lastIndexOf(`/`),i=r>=0?e.path.slice(0,r):``,a=i?t.get(i):null;a?a.children.push(e):n.push(e)});let r=e=>{e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1),e.forEach(e=>r(e.children))};return r(n),n}function St(e,t,n){let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(``);return(0,U.useEffect)(()=>{if(i(``),o(``),!e||!t||!n)return;let r=new AbortController,a=``;return bt.rawBlob(e,t,n,r.signal).then(e=>{a=URL.createObjectURL(e),i(a)},e=>{r.signal.aborted||o(e.message)}),()=>{r.abort(),a&&URL.revokeObjectURL(a)}},[n,e,t]),{url:r,error:a}}function Ct(e,t,n=!0){let i=r({queryKey:[`workspace-profiles`,e],queryFn:({signal:t})=>bt.profiles(e,t),staleTime:1e4,enabled:!!e&&n}),a=`argus-v2-workspace-profile:${t}:${e}`,[o,s]=(0,U.useState)(()=>F(a)||``),c=(0,U.useMemo)(()=>{let e=i.data?.profiles??[];return e.find(e=>e.id===o)??e.find(e=>e.id===i.data?.default_id)??e.find(e=>e.canonical)??e[0]??null},[i.data,o]);return(0,U.useEffect)(()=>{c&&c.id!==o&&s(c.id)},[c,o]),{profiles:i,active:c,workspaceId:c?.id??``,setWorkspaceId:e=>{s(e),P(a,e)}}}function wt({node:e,depth:t,selected:n,expanded:r,onToggle:i,onSelect:a}){let o=e.type===`directory`,s=r.has(e.path);return(0,Y.jsxs)(`div`,{className:`workspace-node`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:n===e.path?`is-selected`:``,style:{paddingLeft:7+t*13},onClick:()=>o?i(e.path):a(e.path),children:[o?s?(0,Y.jsx)(_,{size:13}):(0,Y.jsx)(z,{size:13}):(0,Y.jsx)(`span`,{className:`node-spacer`}),o?(0,Y.jsx)(ke,{size:14}):(0,Y.jsx)(Te,{size:14}),(0,Y.jsx)(`span`,{children:e.name}),e.skipped?(0,Y.jsx)(`small`,{children:`restricted`}):null]}),o&&s?e.children.map(e=>(0,Y.jsx)(wt,{node:e,depth:t+1,selected:n,expanded:r,onToggle:i,onSelect:a},e.path)):null]})}function Tt({sid:e,workspaceId:t,path:n,active:i}){let{text:a}=J(),o=n.toLowerCase().slice(n.lastIndexOf(`.`)),s=[`.pdf`,`.png`,`.jpg`,`.jpeg`,`.webp`,`.svg`].includes(o),c=r({queryKey:[`workspace-file`,e,t,n],queryFn:({signal:r})=>bt.file(e,t,n,r),enabled:!!(i&&n&&t&&!s),refetchInterval:5e3}),l=St(s?e:``,s?t:``,s?n:``);if(!n)return(0,Y.jsx)(Z,{icon:Ee,title:a(`打开一个文件开始阅读`,`Open a file to start reading`),description:a(`左侧文件树展示所选代码工作区。`,`The file tree shows the selected code workspace.`)});if(s)return l.error?(0,Y.jsx)(Z,{icon:je,title:`Preview unavailable`,description:l.error}):l.url?o===`.pdf`?(0,Y.jsx)(ue,{src:l.url,name:n.split(`/`).at(-1)||n,className:`workspace-pdf`}):(0,Y.jsx)(`img`,{className:`workspace-image`,src:l.url,alt:n}):(0,Y.jsx)(`div`,{className:`editor-loading`,children:`Loading preview…`});if(c.isLoading)return(0,Y.jsxs)(`div`,{className:`editor-loading`,children:[`Opening `,n,`…`]});if(c.isError)return(0,Y.jsx)(Z,{icon:je,title:`Preview unavailable`,description:c.error.message});let u=(c.data?.content??``).split(` +`);return(0,Y.jsxs)(`div`,{className:`vscode-code`,tabIndex:0,"aria-label":a(`文件内容`,`File contents`),children:[(0,Y.jsx)(`div`,{className:`vscode-line-numbers`,children:u.map((e,t)=>(0,Y.jsx)(`span`,{children:t+1},t))}),(0,Y.jsx)(`pre`,{children:(0,Y.jsx)(`code`,{children:c.data?.content})})]})}function Et(e){let{locale:t,text:n}=J(),i=Ct(e.sid,`ide`,e.active),a=i.workspaceId,o=i.active?.path||``,[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(new Set),d=(0,U.useRef)(``),f=(0,U.useRef)(null),p=e=>{c(e);let t=f.current,n=t?.closest(`.vscode-shell`),r=t?.closest(`.ros-content`);t&&n&&r&&getComputedStyle(n).display===`flex`&&r.scrollTo({top:r.scrollTop+t.getBoundingClientRect().top-r.getBoundingClientRect().top-12,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[m,h]=(0,U.useState)(`files`),[g,y]=(0,U.useState)(`repository`),S=r({queryKey:[`workspace-tree`,e.sid,a],queryFn:({signal:t})=>bt.tree(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),C=r({queryKey:[`workspace-git`,e.sid,a],queryFn:({signal:t})=>bt.git(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),w=(0,U.useMemo)(()=>xt(S.data?.entries??[]),[S.data?.entries]);(0,U.useEffect)(()=>{c(``),u(new Set),d.current=``},[a]),(0,U.useEffect)(()=>{!a||!w.length||d.current===a||(d.current=a,u(new Set(w.filter(e=>e.type===`directory`).slice(0,5).map(e=>e.path))))},[w,a]);let T=e.events.filter(e=>[`command_execution`,`tool_use`,`tool_result`,`file_change`].includes(String(e.kind??``))).slice(-100),E=(C.data?.status??``).split(` +`).filter(Boolean),D=(C.data?.log??``).split(` +`).filter(Boolean).map(e=>{let[t,n,r,...i]=e.split(` `);return{hash:t,date:n,author:r,subject:i.join(` `)}}),O=C.data;return(0,Y.jsxs)(`div`,{className:`ros-page ide-v3`,children:[(0,Y.jsxs)(`header`,{className:`ros-page-header`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`eyebrow`,children:`AI IDE`}),(0,Y.jsx)(`h1`,{children:n(`代码工作区`,`Code workspace`)}),(0,Y.jsx)(`p`,{children:n(`此视图只用于浏览文件、Git 状态与 Argus 活动;不限制 Agent 本身的文件写入权限。`,`This view only browses files, Git state and Argus activity; it does not restrict the Agent’s file write permissions.`)})]}),(0,Y.jsxs)(X,{tone:`info`,children:[(0,Y.jsx)(je,{size:12}),n(`此视图只读`,`This view is read-only`)]})]}),(0,Y.jsxs)(`div`,{className:`ide-context-strip`,children:[(0,Y.jsx)(Ne,{size:15}),(0,Y.jsx)(`select`,{"aria-label":n(`选择已批准工作区`,`Select approved workspace`),value:a,onChange:e=>i.setWorkspaceId(e.target.value),children:i.profiles.data?.profiles.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,Y.jsx)(`code`,{children:o}),S.isError?(0,Y.jsx)(X,{tone:`danger`,children:n(`连接失败`,`Connection failed`)}):S.isFetching?(0,Y.jsx)(X,{tone:`live`,dot:!0,children:n(`同步中`,`Syncing`)}):(0,Y.jsxs)(X,{tone:`success`,children:[(0,Y.jsx)(R,{size:11}),`Synced`]}),(0,Y.jsxs)(`small`,{children:[S.data?.entries.length??0,` entries`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{S.refetch(),C.refetch()},"aria-label":n(`刷新工作区`,`Refresh workspace`),children:(0,Y.jsx)(b,{size:14})})]}),(0,Y.jsxs)(`div`,{className:`vscode-shell`,children:[(0,Y.jsxs)(`nav`,{className:`vscode-activitybar`,children:[(0,Y.jsx)(`button`,{type:`button`,className:m===`files`?`is-active`:``,onClick:()=>h(`files`),title:`Explorer`,"aria-label":`Explorer`,children:(0,Y.jsx)(De,{size:21})}),(0,Y.jsxs)(`button`,{type:`button`,className:m===`git`?`is-active`:``,onClick:()=>h(`git`),title:`Source Control`,"aria-label":`Source Control`,children:[(0,Y.jsx)(j,{size:21}),E.length?(0,Y.jsx)(`i`,{children:E.length}):null]})]}),(0,Y.jsxs)(`aside`,{className:`vscode-sidebar`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`span`,{children:m===`git`?`SOURCE CONTROL`:`EXPLORER`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void S.refetch(),"aria-label":n(`刷新文件树`,`Refresh file tree`),children:(0,Y.jsx)(b,{size:14})})]}),m===`files`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`vscode-root`,children:[(0,Y.jsx)(_,{size:13}),(0,Y.jsx)(`strong`,{title:o,children:o.split(/[\\/]/).filter(Boolean).at(-1)||o})]}),(0,Y.jsx)(`div`,{className:`workspace-tree`,children:S.isError?(0,Y.jsx)(Z,{icon:Ne,title:n(`目录连接失败`,`Directory connection failed`),description:S.error.message}):w.map(e=>(0,Y.jsx)(wt,{node:e,depth:0,selected:s,expanded:l,onToggle:e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:p},e.path))})]}):(0,Y.jsx)(`div`,{className:`vscode-changes`,children:E.length?E.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{let t=e.slice(3).trim(),n=t.includes(` -> `)?t.split(` -> `).at(-1):t;n.endsWith(`/`)||p(n)},children:[(0,Y.jsx)(`b`,{children:e.slice(0,2).trim()||`?`}),(0,Y.jsx)(`span`,{children:e.slice(3)})]},e)):(0,Y.jsx)(`p`,{children:`No changes`})})]}),(0,Y.jsxs)(`main`,{className:`vscode-editor`,ref:f,children:[(0,Y.jsx)(`div`,{className:`vscode-tabs`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`is-active`,children:[(0,Y.jsx)(re,{size:13}),s||`Welcome`]})}),(0,Y.jsx)(`div`,{className:`vscode-breadcrumbs`,children:s?s.split(`/`).map((e,t)=>(0,Y.jsxs)(`span`,{children:[e,ty(`changes`),children:`Changes`}),(0,Y.jsx)(`button`,{type:`button`,className:g===`timeline`?`is-active`:``,onClick:()=>y(`timeline`),children:`Timeline`}),(0,Y.jsx)(`button`,{type:`button`,className:g===`repository`?`is-active`:``,onClick:()=>y(`repository`),children:`Repository`})]}),(0,Y.jsx)(`div`,{className:`vscode-git-content`,children:O?.available?g===`changes`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`vscode-status`,children:O.status||`Working tree clean`}),(0,Y.jsx)(_t,{diff:O.diff,truncated:O.truncated})]}):g===`timeline`?(0,Y.jsx)(`div`,{className:`vscode-commits`,children:D.map(e=>(0,Y.jsxs)(`article`,{children:[(0,Y.jsx)(j,{size:13}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.subject}),(0,Y.jsxs)(`small`,{children:[e.author,` · `,e.date?.slice(0,10)]})]})]},e.hash))}):(0,Y.jsxs)(`div`,{className:`repository-readiness`,children:[(0,Y.jsx)(`h3`,{children:`Repository readiness`}),(0,Y.jsxs)(`dl`,{children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(j,{size:13}),`Remote`]}),(0,Y.jsx)(`dd`,{children:O.remotes.length?O.remotes.map(e=>`${e.name}: ${e.fetch}`).join(` +`):`Not configured`}),(0,Y.jsx)(`i`,{className:O.remotes.length?`ok`:`missing`,children:O.remotes.length?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(j,{size:13}),`Upstream`]}),(0,Y.jsxs)(`dd`,{children:[O.upstream||`Not configured`,O.upstream?` · ahead ${O.ahead}, behind ${O.behind}`:``]}),(0,Y.jsx)(`i`,{className:O.upstream?`ok`:`missing`,children:O.upstream?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(Ie,{size:13}),`Commit identity`]}),(0,Y.jsx)(`dd`,{children:O.identity.name&&O.identity.email?`${O.identity.name} <${O.identity.email}>`:`Not configured`}),(0,Y.jsx)(`i`,{className:O.identity.valid?`ok`:`missing`,children:O.identity.valid?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(Ae,{size:13}),`GitHub CLI`]}),(0,Y.jsx)(`dd`,{children:O.github.authenticated?`${O.github.login} · ${O.github.protocol}`:`Not authenticated`}),(0,Y.jsx)(`i`,{className:O.github.authenticated?`ok`:`missing`,children:O.github.authenticated?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]})]}),(0,Y.jsx)(`p`,{children:O.publish_ready?`Repository is ready for an explicitly approved push.`:`Configure the missing items before publishing. No credentials are shown in this UI.`})]}):(0,Y.jsx)(Z,{icon:j,title:`Not a Git repository`})})]}),(0,Y.jsxs)(`section`,{className:`vscode-terminal`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`strong`,{children:`ARGUS ACTIVITY`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(Fe,{size:13}),`read-only`]})]}),(0,Y.jsx)(`div`,{children:T.length?T.map((e,r)=>(0,Y.jsxs)(`article`,{children:[(0,Y.jsx)(`time`,{children:Xe(e.ts,t)}),(0,Y.jsx)(`b`,{className:`terminal-role`,style:{color:k(Qe(e))},children:qe(Qe(e),n)}),(0,Y.jsx)(`span`,{children:`›`}),(0,Y.jsx)(`code`,{children:et(e,800)||$e(e)})]},`${e.ts}-${r}`)):(0,Y.jsx)(`p`,{children:`$ waiting for Argus activity`})})]}),(0,Y.jsxs)(`footer`,{className:`vscode-statusbar`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(j,{size:12}),O?.branch||`no branch`]}),(0,Y.jsx)(`span`,{children:S.isError?`Workspace error`:S.isFetching?`Workspace syncing`:S.data?.truncated?`Tree truncated`:`Workspace synced`}),(0,Y.jsx)(`span`,{children:O?.github.authenticated?`GitHub: ${O.github.login}`:`GitHub: offline`}),(0,Y.jsx)(`span`,{children:`UTF-8`}),(0,Y.jsx)(`span`,{children:s.split(`.`).at(-1)?.toUpperCase()||`Plain Text`})]})]})]})}var Dt=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm`;function Ot({task:e,resources:t,onChange:n,text:r}){let i=e.execution_options??[],a=(e,t)=>n(i.map(n=>n.id===e?{...n,...t}:n));return(0,Y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-dashed border-line p-3 sm:col-span-2`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium`,children:r(`期限紧张时的替代做法`,`Alternative execution options for tighter deadlines`)}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:r(`每种做法都有独立工期、资源和取舍。系统只会选择已声明保留必需验收目标的方案,不自动压缩原估计。`,`Each option has its own estimate, resources and tradeoff. Only options declared to preserve required acceptance scope can be selected.`)}),i.map(o=>(0,Y.jsxs)(`fieldset`,{disabled:e.status!=null&&e.status!==`pending`,className:`grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`text-xs sm:col-span-2`,children:[r(`替代做法`,`Alternative approach`),(0,Y.jsx)(`input`,{className:Dt,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:col-span-2`,children:[r(`替代下限(小时)`,`Option lower (h)`),r(`替代最可能(小时)`,`Option likely (h)`),r(`替代上限(小时)`,`Option upper (h)`)].map((e,t)=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,(0,Y.jsx)(`input`,{className:Dt,type:`number`,min:`0`,step:`any`,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),t.map(e=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,` `,r(`需求`,`required`),(0,Y.jsx)(`input`,{className:Dt,type:`number`,min:`0`,step:`1`,value:o.resources[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e)),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[r(`替代工期依据`,`Option estimate basis`),(0,Y.jsx)(`textarea`,{"aria-label":r(`替代工期依据`,`Option estimate basis`),className:Dt,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[r(`取舍与适用条件`,`Tradeoff and prerequisites`),(0,Y.jsx)(`textarea`,{"aria-label":r(`取舍与适用条件`,`Tradeoff and prerequisites`),className:Dt,value:o.tradeoff,onChange:e=>a(o.id,{tradeoff:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`flex gap-2 text-xs sm:col-span-2`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:o.preserves_acceptance,onChange:e=>a(o.id,{preserves_acceptance:e.target.checked})}),r(`确认条件适用且保留必需验收目标,允许重排时采用`,`Prerequisites apply and required acceptance is preserved; allow automatic selection`)]}),(0,Y.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>n(i.filter(e=>e.id!==o.id)),children:r(`移除替代做法`,`Remove alternative`)})]},o.id)),(0,Y.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-xs`,disabled:i.length>=8||e.status!=null&&e.status!==`pending`,onClick:()=>{let t=i.length+1;for(;i.some(e=>e.id===`option-${t}`);)t++;n([...i,{id:`option-${t}`,title:r(`新的替代做法`,`New alternative`),duration_hours:[...e.duration_hours],resources:{...e.resources},basis:e.basis,tradeoff:r(`待补充适用条件与取舍`,`Specify prerequisites and tradeoffs`),preserves_acceptance:!1}])},children:r(`添加替代做法`,`Add alternative`)})]})}var Q=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm text-ink`;function kt({input:e,onChange:t,text:n,forecast:r}){let i=e.proposals.find(t=>t.id===e.selected_proposal_id),a=(n,r)=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.map(e=>e.id===n?{...e,...r}:e)}:e)});return(0,Y.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`任务与实验`,`Tasks and experiments`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`h3`,{className:`font-medium`,children:n(`任务与实验`,`Tasks and experiments`)}),(0,Y.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-sm`,onClick:()=>{let r=i.tasks.length+1;for(;i.tasks.some(e=>e.id===`task-${r}`);)r++;t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:[...e.tasks,{id:`task-${r}`,title:n(`新增实验`,`New experiment`),phase:`experiment`,duration_hours:[1,2,8],basis:n(`初步估计,待实测校准`,`Preliminary estimate; needs calibration`)}]}:e)})},children:n(`添加任务`,`Add task`)})]}),i.tasks.map(o=>{let s=[`running`,`completed`,`failed`].includes(o.status??`pending`),c=[`completed`,`failed`].includes(o.status??`pending`);return(0,Y.jsxs)(`details`,{className:`rounded-xl border border-line p-3`,children:[(0,Y.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,Y.jsx)(`strong`,{children:o.title}),(0,Y.jsxs)(`span`,{className:`ml-2 text-ink-faint`,children:[o.duration_hours.join(` / `),` h · `,o.id]})]}),(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`任务名称`,`Task name`),(0,Y.jsx)(`input`,{className:Q,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`阶段`,`Phase`),(0,Y.jsx)(`input`,{className:Q,value:o.phase,onChange:e=>a(o.id,{phase:e.target.value})})]}),(0,Y.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`乐观(小时)`,`Lower (hours)`),n(`最可能(小时)`,`Likely (hours)`),n(`悲观(小时)`,`Upper (hours)`)].map((e,t)=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,disabled:s,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`估计依据`,`Estimate basis`),(0,Y.jsx)(`textarea`,{"aria-label":n(`估计依据`,`Estimate basis`),className:Q,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`模型 / 实现难度`,`Model / implementation difficulty`),(0,Y.jsx)(`textarea`,{"aria-label":n(`模型 / 实现难度`,`Model / implementation difficulty`),className:Q,value:o.difficulty??``,onChange:e=>a(o.id,{difficulty:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`前置任务(可多选)`,`Dependencies (multiple)`),(0,Y.jsx)(`select`,{"aria-label":n(`前置任务(可多选)`,`Dependencies (multiple)`),multiple:!0,className:Q,disabled:s,value:o.depends_on??[],onChange:e=>a(o.id,{depends_on:Array.from(e.target.selectedOptions,e=>e.value)}),children:i.tasks.filter(e=>e.id!==o.id).map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.keys(e.resources).map(e=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`占用`,`slots`),(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`1`,className:Q,disabled:s,value:o.resources?.[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e))}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`进展状态`,`Progress status`),(0,Y.jsx)(`select`,{"aria-label":n(`进展状态`,`Progress status`),className:Q,disabled:c||e.adapt_to_deadline&&!s&&!r,value:o.status??`pending`,onChange:t=>{let n=t.target.value,i=r?.schedule.find(e=>e.id===o.id),c=!s&&[`running`,`completed`,`failed`].includes(n)&&i?{duration_hours:i.duration_hours??o.duration_hours,resources:i.resources,execution_option_id:i.execution_option_id??`standard`,basis:i.basis}:{};a(o.id,{status:n,...c,...n===`running`?{actual_start_hours:o.actual_start_hours??e.now_hours,remaining_hours:o.remaining_hours??[...c.duration_hours??o.duration_hours]}:{},...[`completed`,`failed`].includes(n)?{actual_start_hours:o.actual_start_hours??0,actual_finish_hours:e.now_hours}:{}})},children:[[`pending`,`未开始`,`Pending`],[`running`,`运行中`,`Running`],[`completed`,`已完成`,`Completed`],[`failed`,`失败`,`Failed`],[`blocked`,`受阻`,`Blocked`]].filter(([e])=>!s||![`pending`,`blocked`].includes(e)).map(([e,t,r])=>(0,Y.jsx)(`option`,{value:e,children:n(t,r)},e))})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:o.optional??!1,onChange:e=>a(o.id,{optional:e.target.checked})}),n(`可选 / 已退出交付路径`,`Optional / retired from delivery path`)]}),s&&(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`实际开始(项目第几小时)`,`Actual start (project hour)`),(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,value:o.actual_start_hours??0,onChange:e=>a(o.id,{actual_start_hours:Number(e.target.value)})})]}),c&&(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`实际结束(项目第几小时)`,`Actual finish (project hour)`),(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,value:o.actual_finish_hours??0,onChange:e=>a(o.id,{actual_finish_hours:Number(e.target.value)})})]}),o.status===`running`&&(0,Y.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`剩余下限`,`Remaining lower`),n(`剩余最可能`,`Remaining likely`),n(`剩余上限`,`Remaining upper`)].map((e,t)=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,value:o.remaining_hours?.[t]??0,onChange:e=>{let n=[...o.remaining_hours??o.duration_hours];n[t]=Number(e.target.value),a(o.id,{remaining_hours:n})}})]},e))}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`变化 / 延期原因`,`Change / delay reason`),(0,Y.jsx)(`textarea`,{"aria-label":n(`变化 / 延期原因`,`Change / delay reason`),className:Q,value:o.reason??``,onChange:e=>a(o.id,{reason:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`证据引用(每行一个)`,`Evidence references (one per line)`),(0,Y.jsx)(`textarea`,{"aria-label":n(`证据引用(每行一个)`,`Evidence references (one per line)`),className:Q,value:(o.evidence??[]).join(` +`),onChange:e=>a(o.id,{evidence:e.target.value.split(` +`).filter(Boolean)})})]}),(0,Y.jsx)(Ot,{task:o,resources:Object.keys(e.resources),onChange:e=>a(o.id,{execution_options:e}),text:n}),!s&&i.tasks.length>1&&(0,Y.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.filter(e=>e.id!==o.id)}:e)}),children:n(`移除未开始任务`,`Remove unstarted task`)})]})]},o.id)})]})}function At({report:e,selectedId:t,text:n}){let r=e.proposals.find(e=>e.id===t),i=Math.max(1,...r.schedule.map(e=>e.finish_hours));return(0,Y.jsxs)(`div`,{className:`space-y-5`,"aria-label":n(`排期结果`,`Timeline results`),children:[(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:e.proposals.map(e=>(0,Y.jsxs)(`div`,{className:`rounded-xl border p-4 ${e.id===t?`border-blue`:`border-line`}`,children:[(0,Y.jsx)(`div`,{className:`text-xs text-ink-faint`,children:e.id===t?n(`已选方案`,`Selected proposal`):n(`备选方案`,`Alternative`)}),(0,Y.jsx)(`h3`,{className:`mt-1 text-sm font-medium`,children:e.title}),(0,Y.jsx)(`div`,{className:`mt-3 text-2xl font-semibold`,children:e.finish_hours?`${e.finish_hours.expected.toFixed(1)} h`:n(`待重规划`,`Needs replanning`)}),e.finish_hours&&(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[n(`区间`,`Range`),` `,e.finish_hours.lower.toFixed(1),`–`,e.finish_hours.upper.toFixed(1),` h · `,n(`剩余`,`Remaining`),` `,e.remaining_hours?.toFixed(1),` h`]}),e.deadline_gap_hours!=null&&(0,Y.jsxs)(`p`,{className:`mt-2 text-xs ${e.deadline_gap_hours>0?`text-red`:`text-ink-faint`}`,children:[n(`预计超期`,`Forecast overrun`),` `,e.deadline_gap_hours.toFixed(1),` h`]})]},e.id))}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`初步估计,非成功承诺。区间覆盖已列出的工作;验证失败后的新增实验可能超出上限。各方案作为备选单独计算。`,`Preliminary estimates, not success guarantees. New experiments after a failed premise can exceed the range. Proposals are estimated as alternatives.`)}),r.adaptation&&(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-blue/40 bg-blue/5 p-4`,"aria-label":n(`根据期限重排`,`Deadline adaptation`),children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`根据期限重排`,`Deadline adaptation`)}),r.adaptation.baseline_finish_hours&&r.finish_hours&&(0,Y.jsxs)(`p`,{className:`text-sm`,children:[n(`调整前`,`Before`),` `,(0,Y.jsxs)(`strong`,{children:[r.adaptation.baseline_finish_hours.expected.toFixed(1),` h`]}),` → `,n(`当前方案`,`Current plan`),` `,(0,Y.jsxs)(`strong`,{children:[r.finish_hours.expected.toFixed(1),` h`]})]}),r.adaptation.status===`gap`&&(0,Y.jsx)(`p`,{className:`text-sm text-red`,children:n(`已尝试可用的重排方式,仍无法满足期限。需要增加资源、提出新的执行方案,或调整交付目标。`,`Available adjustments still miss the deadline. More resources, another execution option, or a revised deliverable are needed.`)}),r.adaptation.status===`fits`&&r.finish_hours&&r.adaptation.target_hours!=null&&r.finish_hours.upper>r.adaptation.target_hours&&(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`点估计可按期;悲观情景仍可能超期,请留意区间上限。`,`The point estimate fits; the upper scenario can still miss the deadline.`)}),r.adaptation.changes.length===0&&(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`沿用原 proposal 的任务与做法;当前期限无需进一步调整,或尚无可用的替代做法。`,`Keeping the original tasks and approaches; no further adjustment is needed or no usable alternative is available.`)}),r.adaptation.changes.map(e=>(0,Y.jsxs)(`div`,{className:`border-t border-line/60 pt-2 text-xs`,children:[(0,Y.jsxs)(`p`,{className:`font-medium`,children:[e.title,e.option_title?` → ${e.option_title}`:``]}),e.from_duration_hours&&e.to_duration_hours&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[n(`任务估计(下限 / 最可能 / 上限)`,`Task estimate (lower / likely / upper)`),`: `,e.from_duration_hours.join(` / `),` → `,e.to_duration_hours.join(` / `),` h`]}),e.from_start_hours!=null&&e.to_start_hours!=null&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[n(`开始时间`,`Start time`),`: `,e.from_start_hours.toFixed(1),` → `,e.to_start_hours.toFixed(1),` h`]}),(0,Y.jsx)(`p`,{className:`mt-1 text-ink-faint`,children:e.reason}),e.tradeoff&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[n(`取舍 / 条件`,`Tradeoff / prerequisites`),`: `,e.tradeoff]})]},`${e.kind}:${e.id}`))]}),(0,Y.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,Y.jsxs)(`h3`,{className:`mb-4 text-sm font-medium`,children:[n(`实验排布`,`Experiment schedule`),` · `,n(`从项目开始计时`,`Hours from project start`)]}),(0,Y.jsx)(`div`,{className:`space-y-3`,children:r.schedule.map(e=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs`,children:[(0,Y.jsx)(`span`,{children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-ink-faint`,children:[e.start_hours.toFixed(1),`–`,e.finish_hours.toFixed(1),` h`]})]}),(0,Y.jsx)(`div`,{className:`h-2.5 rounded-full bg-line/40`,role:`img`,"aria-label":`${e.title}: ${e.start_hours.toFixed(1)}–${e.finish_hours.toFixed(1)} h`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full ${e.status===`failed`?`bg-red`:e.status===`completed`?`bg-emerald-500`:`bg-blue`}`,style:{marginLeft:`${e.start_hours/i*100}%`,width:`${Math.max(.3,(e.finish_hours-e.start_hours)/i*100)}%`}})})]},e.id))})]}),r.deferred_task_ids.length>0&&(0,Y.jsxs)(`p`,{className:`rounded-lg border border-line p-3 text-sm`,children:[n(`为满足期限延后的可选任务`,`Optional tasks deferred for the deadline`),`: `,r.deferred_task_ids.join(`, `)]}),[...r.failed_tasks,...r.blocked_tasks].map(e=>(0,Y.jsxs)(`p`,{role:`alert`,className:`rounded-lg border border-red/40 p-3 text-sm`,children:[e.id,`: `,e.reason]},e.id)),(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsx)(`tr`,{children:[n(`任务`,`Task`),n(`资源`,`Resources`),n(`排队`,`Queue`),n(`估计依据`,`Estimate basis`)].map(e=>(0,Y.jsx)(`th`,{className:`border-b border-line p-2`,children:e},e))})}),(0,Y.jsx)(`tbody`,{children:r.schedule.map(e=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{className:`border-b border-line p-2`,children:e.title}),(0,Y.jsx)(`td`,{className:`border-b border-line p-2`,children:Object.entries(e.resources).map(([e,t])=>`${e} × ${t}`).join(`, `)||`—`}),(0,Y.jsxs)(`td`,{className:`border-b border-line p-2`,children:[e.resource_wait_hours.toFixed(1),` h`]}),(0,Y.jsx)(`td`,{className:`border-b border-line p-2`,children:e.basis})]},e.id))})]})}),e.revision&&(0,Y.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`版本对照与延期原因`,`Revision and delay reasons`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm`,children:e.revision.reason}),(0,Y.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[n(`初版预计`,`Original forecast`),`: `,e.revision.baseline_finish_hours?.toFixed(1)??`—`,` h · `,n(`相对初版变化`,`Change from original`),`: `,e.revision.baseline_delta_hours?.toFixed(1)??`—`,` h`]}),e.revision.task_variances.map((e,t)=>(0,Y.jsxs)(`p`,{className:`mt-3 text-xs`,children:[e.id,` · `,e.observed?n(`实际延期`,`Observed delay`):n(`预测延期`,`Forecast delay`),` `,e.delay_hours.toFixed(1),` h — `,e.reason,(0,Y.jsx)(`br`,{}),e.evidence.join(`, `)]},`${e.id}-${t}`))]})]})}function jt(e){return{...e,resources:e.resources??{},now_hours:e.now_hours??0,defer_optional:e.defer_optional??!1}}var $=`w-full rounded-lg border border-line bg-transparent px-3 py-2 text-sm text-ink`,Mt=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40`;function Nt({sid:e}){let{locale:t}=d(),n=(e,n)=>t===`zh-CN`?e:n,[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!0),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(``),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(``),[D,O]=(0,U.useState)(``),[k,A]=(0,U.useState)(0),j=!!(r&&JSON.stringify(r)!==JSON.stringify(a?.input));return(0,U.useEffect)(()=>{let t=!0;return u(!0),p(!1),y(``),i(null),o(null),c(null),q.timelineLatest(e).then(({latest:e})=>{if(!t)return;let n=e?{...e,input:jt(e.input)}:null;o(n),i(n?.input??null),c(n?.report??null),T(``),C(``),p(!0)}).catch(e=>{t&&y(e.message)}).finally(()=>{t&&u(!1)}),()=>{t=!1}},[e,k]),(0,U.useEffect)(()=>{if(c(null),x(``),!r){_(!1);return}if(a&&JSON.stringify(r)===JSON.stringify(a.input)){c(a.report),_(!1);return}let e=new AbortController;_(!0);let t=setTimeout(()=>{q.timelineEstimate(r,e.signal).then(t=>{e.signal.aborted||c(t)}).catch(t=>{e.signal.aborted||x(t.message)}).finally(()=>{e.signal.aborted||_(!1)})},350);return()=>{clearTimeout(t),e.abort()}},[r,a]),l?(0,Y.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-ink-faint`,children:n(`正在读取已保存计划…`,`Loading saved timeline…`)}):(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 p-4 sm:p-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-xs text-blue`,children:`PROPOSAL → EXPERIMENT → PAPER`}),(0,Y.jsx)(`h2`,{className:`mt-1 text-xl font-semibold`,children:n(`研究排期`,`Research timeline`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`选择 idea 和期望期限,查看具体工期、实验排布与调整原因。`,`Choose an idea and deadline to see estimates, experiment schedules, and reasons for changes.`)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(`button`,{className:Mt,disabled:m||!f,onClick:async()=>{h(!0),y(``),C(``);try{i(await q.timelineExample()),T(n(`加载演示 proposal`,`Load demonstration proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`加载论文示例`,`Load paper example`)}),(0,Y.jsx)(`button`,{className:Mt,disabled:m,onClick:()=>A(e=>e+1),children:n(`重新载入已保存计划`,`Reload saved timeline`)}),r&&(0,Y.jsx)(`button`,{className:Mt,onClick:()=>E(new Blob([JSON.stringify(r,null,2)],{type:`application/json`}),`proposal.json`),children:n(`导出 proposal`,`Export proposal`)})]})]}),v&&(0,Y.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[v,(0,Y.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n(`若提示版本冲突,先导出当前草稿,再重新载入已保存计划。`,`For a version conflict, export your draft before reloading the saved timeline.`)})]}),S&&(0,Y.jsx)(`p`,{role:`status`,className:`rounded-xl border border-blue/40 p-3 text-sm`,children:S}),!r&&(0,Y.jsxs)(`section`,{className:`rounded-xl border border-dashed border-line p-8 text-center`,children:[(0,Y.jsx)(`h3`,{className:`font-medium`,children:n(`还没有研究排期`,`No research timeline yet`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`点击“加载论文示例”即可验证完整流程,也可以在下方导入自己的 proposal。示例数字仅用于演示。`,`Load the paper example to try the complete flow, or import your proposal below. Example numbers are illustrative.`)})]}),r&&(0,Y.jsxs)(`div`,{className:`grid items-start gap-6`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 360px), 1fr))`},children:[(0,Y.jsxs)(`fieldset`,{disabled:m,className:`min-w-0 space-y-5`,children:[(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[n(`选择 idea / proposal`,`Choose idea / proposal`),(0,Y.jsx)(`select`,{"aria-label":n(`选择 idea / proposal`,`Choose idea / proposal`),className:$,value:r.selected_proposal_id,onChange:e=>i({...r,selected_proposal_id:e.target.value}),children:r.proposals.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[n(`方案名称`,`Proposal title`),(0,Y.jsx)(`input`,{className:$,value:r.proposals.find(e=>e.id===r.selected_proposal_id).title,onChange:e=>i({...r,proposals:r.proposals.map(t=>t.id===r.selected_proposal_id?{...t,title:e.target.value}:t)})})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`期望完成时间(小时)`,`Target finish (hours)`),(0,Y.jsx)(`input`,{className:$,type:`number`,min:`0`,step:`any`,value:r.deadline_hours??``,placeholder:n(`不限`,`No deadline`),onChange:e=>i({...r,deadline_hours:e.target.value===``?null:Number(e.target.value)})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`已过去时间(小时)`,`Elapsed time (hours)`),(0,Y.jsx)(`input`,{className:$,type:`number`,min:`0`,step:`any`,value:r.now_hours,onChange:e=>i({...r,now_hours:Number(e.target.value)})})]}),Object.entries(r.resources).map(([e,t])=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`可用槽位`,`available slots`),(0,Y.jsx)(`input`,{className:$,type:`number`,min:`1`,step:`1`,value:t,onChange:t=>i({...r,resources:{...r.resources,[e]:Number(t.target.value)}})})]},e))]}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`所有时间从项目开始计时;例如 120 小时 = 第 5 天。资源按持续可用计算。`,`All times count from project start; 120 hours means day 5. Resources are assumed continuously available.`)}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r.adapt_to_deadline??!1,onChange:e=>i({...r,adapt_to_deadline:e.target.checked})}),n(`根据期限自动重排任务、选择替代做法并更新区间`,`Adapt task order, execution options and estimate ranges to the deadline`)]}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`缩短期限时优先调整关键路径;延长期限时恢复原做法和可选工作。替代做法可在任务中编辑。`,`Tighter deadlines prioritize the critical path; longer deadlines restore preferred approaches and optional work. Edit alternatives inside each task.`)}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r.defer_optional,onChange:e=>i({...r,defer_optional:e.target.checked})}),n(`超期时延后可选任务,保留必需实验`,`Defer optional tasks when over deadline; keep required experiments`)]}),(0,Y.jsx)(`button`,{className:Mt,onClick:()=>{let e=r.proposals.length+1;for(;r.proposals.some(t=>t.id===`idea-${e}`);)e++;let t=`idea-${e}`;i({...r,selected_proposal_id:t,proposals:[...r.proposals,{id:t,title:n(`新 proposal`,`New proposal`),tasks:[{id:`validation`,title:n(`关键假设验证`,`Validate the key premise`),phase:`validation`,duration_hours:[2,4,16],basis:n(`初步估计,待校准`,`Preliminary, uncalibrated estimate`)}]}]})},children:n(`添加候选方案`,`Add proposal`)})]}),(0,Y.jsx)(kt,{input:r,onChange:i,text:n,forecast:g?void 0:s?.proposals.find(e=>e.id===r.selected_proposal_id)}),(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[n(`本次保存 / 调整原因`,`Reason for this revision`),(0,Y.jsx)(`textarea`,{"aria-label":n(`本次保存 / 调整原因`,`Reason for this revision`),className:$,value:w,onChange:e=>T(e.target.value),placeholder:n(`说明为什么改变计划;延期请在具体任务中填写证据`,`Explain the change; add delay evidence on the affected task`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[a?n(`已保存 v${a.version}`,`Saved v${a.version}`):n(`未保存`,`Not saved`),j?n(` · 有未保存修改`,` · Unsaved changes`):``]}),(0,Y.jsx)(`button`,{className:`${Mt} border-blue bg-blue/10`,disabled:!f||!j||!s||g||!!b||!w.trim(),onClick:async()=>{if(!(!r||!s||g||!w.trim())){h(!0),y(``),C(``);try{let t=await q.timelineSave(e,r,a?.version??0,w);o(t),i(t.input),c(t.report),T(``),C(n(`已保存版本 ${t.version},刷新页面后仍可查看。`,`Version ${t.version} saved. It survives a page refresh.`))}catch(e){y(e.message)}finally{h(!1)}}},children:n(`保存计划版本`,`Save timeline version`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`保存计划不会启动实验。实际进展和失败原因由实验结果或操作者更新。`,`Saving a timeline does not start experiments. Update progress and failure reasons from actual results.`)})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[g&&(0,Y.jsx)(`p`,{role:`status`,className:`text-sm text-ink-faint`,children:n(`正在更新排期…`,`Updating schedule…`)}),b&&(0,Y.jsxs)(`p`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[n(`无法计算,请检查估计区间、依赖和资源:`,`Cannot calculate; check ranges, dependencies, and resources: `),b]}),!g&&s&&(0,Y.jsx)(At,{report:s,selectedId:r.selected_proposal_id,text:n})]})]}),(0,Y.jsxs)(`details`,{className:`rounded-xl border border-line p-4`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:n(`导入自己的 proposal(JSON)`,`Import your proposal (JSON)`)}),(0,Y.jsx)(`textarea`,{className:`${$} mt-3 font-mono`,rows:6,"aria-label":n(`Proposal JSON`,`Proposal JSON`),value:D,onChange:e=>O(e.target.value)}),(0,Y.jsx)(`button`,{className:`${Mt} mt-2`,disabled:!f||m||!D.trim(),onClick:async()=>{h(!0),y(``);try{let e=JSON.parse(D);await q.timelineEstimate(e),i(jt(e)),T(n(`导入 proposal`,`Import proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`校验并导入`,`Validate and import`)})]})]})}function Pt(e){let t=Math.ceil(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}var Ft={available:`bg-ok/10 text-ok`,absent:`bg-bg text-ink-faint`,inaccessible:`bg-warn/10 text-warn`,degraded:`bg-warn/10 text-warn`};function It({status:e,error:t}){let{t:n,locale:r}=d(),i=r===`zh-CN`;return(0,Y.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:n(`resource.title`)}),e?(0,Y.jsx)(`span`,{className:`rounded px-2 py-1 text-[10px] font-semibold uppercase ${e.enforcement===`strict`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:B(e.enforcement,n)}):null]}),t?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-err`,children:t}):null,!e&&!t?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:n(`resource.loading`)}):null,e?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.accelerators.map(e=>(0,Y.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:be(e.kind,n)}),(0,Y.jsxs)(`span`,{className:`rounded px-2 py-0.5 text-[10px] font-medium ${Ft[e.status]}`,children:[ie(e.status,n),` · `,n(`resource.devices`,{count:e.device_count})]})]}),e.detail?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:e.detail}):null]},e.kind))}),(0,Y.jsx)(`div`,{className:`gpu-device-grid`,children:e.accelerators.flatMap(e=>(e.devices??[]).map(t=>{let r=t.utilization_percent>0?`computing`:t.reserved?`reserved`:t.used_memory_mib>0?`allocated`:`quiet`,a=r===`computing`?i?`正在计算`:`Computing`:r===`reserved`?i?`已预留`:`Reserved`:r===`allocated`?i?`仅显存占用`:`Memory occupied`:i?`暂无活动`:`No activity`,o=t.total_memory_mib>0?Math.min(100,t.used_memory_mib/t.total_memory_mib*100):0;return(0,Y.jsxs)(`article`,{className:`gpu-device-card`,"data-gpu-state":r,"aria-label":`GPU ${t.index} · ${t.name} · ${a}`,children:[(0,Y.jsxs)(`div`,{className:`gpu-device-header`,children:[(0,Y.jsx)(`span`,{className:`gpu-device-icon`,"aria-hidden":`true`,children:(0,Y.jsx)(we,{size:26,strokeWidth:1.5})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`gpu-device-number`,children:[be(e.kind,n),` · GPU `,t.index]}),(0,Y.jsx)(`h4`,{children:t.name})]}),(0,Y.jsxs)(`span`,{className:`gpu-device-status`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),a]})]}),(0,Y.jsxs)(`div`,{className:`gpu-device-meter`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:i?`计算负载`:`Compute load`}),(0,Y.jsxs)(`strong`,{children:[t.utilization_percent,`%`]})]}),(0,Y.jsx)(`div`,{role:`meter`,"aria-label":i?`计算负载`:`Compute load`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t.utilization_percent,children:(0,Y.jsx)(`i`,{style:{width:`${t.utilization_percent}%`}})})]}),(0,Y.jsxs)(`div`,{className:`gpu-device-meter`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:i?`显存`:`GPU memory`}),(0,Y.jsxs)(`strong`,{children:[t.used_memory_mib<1024?`${t.used_memory_mib} MiB`:`${(t.used_memory_mib/1024).toFixed(1)} GiB`,` / `,(t.total_memory_mib/1024).toFixed(1),` GiB`]})]}),(0,Y.jsx)(`div`,{role:`meter`,"aria-label":i?`显存占用`:`GPU memory usage`,"aria-valuemin":0,"aria-valuemax":t.total_memory_mib||1,"aria-valuenow":t.used_memory_mib,children:(0,Y.jsx)(`i`,{style:{width:`${o}%`}})})]}),t.reserved&&r!==`reserved`&&(0,Y.jsx)(`p`,{className:`gpu-device-note`,children:i?`已由 Argus 预留`:`Reserved by Argus`})]},`${e.kind}:${t.index}`)}))}),!!e.accelerators.some(e=>e.device_count>0&&!e.devices)&&(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:i?`当前服务尚未提供单卡详情,不能判断各卡使用情况。`:`This server has no per-device details; individual usage is unknown.`}),(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:i?`编号与主机一致。负载和显存包含其他程序,少量显存可能来自驱动;“暂无活动”是采样结果,不保证可独占使用。`:`Numbers match host GPU indices. Load and memory include other programs; small memory use can come from drivers. “No activity” is a sample, not a guarantee of exclusive availability.`}),(0,Y.jsxs)(`details`,{className:`mt-4`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-xs text-ink-dim`,children:i?`Argus 资源预约 ${e.holders.length} · 等待 ${e.queue.length}`:`Argus reservations ${e.holders.length} · Waiting ${e.queue.length}`}),(0,Y.jsxs)(`div`,{className:`mt-3 grid gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.inUse`,{count:e.holders.length})}),(0,Y.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.holders.length===0?(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.holders.map((e,t)=>(0,Y.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.devices`,{count:e.device_count})}),(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:Pt(e.ttl_seconds)})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)}),e.yield_requests.map((e,t)=>(0,Y.jsxs)(`div`,{className:`mt-2 border-l-2 border-warn/50 pl-2 text-ink-faint`,children:[(0,Y.jsx)(`div`,{children:n(`resource.yieldRequest`,{reason:e.reason})}),e.response?(0,Y.jsxs)(`div`,{children:[ve(e.response.decision,n),` · `,e.response.reason]}):null]},t))]},`${e.project}:${e.task_id}:${t}`))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.queue`,{count:e.queue.length})}),(0,Y.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.queue.length===0?(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.queue.map(e=>(0,Y.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.queuePosition`,{position:e.position})}),(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:Pt(e.ttl_seconds)})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)})]},e.position))})]})]})]})]}):null]})}async function Lt(e){let t=await e;if(t&&typeof t==`object`){let e=t;if(Number(e.rc??0)!==0||e.command_status===`failed`||e.command_status===`rejected`)throw Error(String(e.error||`Command ${e.command_status||`failed`}`))}return t}function Rt({sid:e,snapshot:t,active:n,connected:i,controls:a,refresh:o,readOnly:s,onRestored:c}){let{t:l,locale:f}=d(),p=f===`zh-CN`,[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[y,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(t.session.workdir??t.session.cwd??``),[w,E]=(0,U.useState)(``),[O,k]=(0,U.useState)(``),[j,N]=(0,U.useState)(``),ne=(0,U.useRef)(!1),[re,P]=(0,U.useState)(``),[F,ie]=(0,U.useState)(null),I=r({queryKey:[`runtime-resources`],queryFn:({signal:e})=>u.resources(e),enabled:n,refetchInterval:1e4,retry:!1}),L=r({queryKey:[`runtime-trash`,O],queryFn:()=>u.trash(O),enabled:n&&g&&!s,retry:!1}),R=r({queryKey:[`runtime-metrics`],queryFn:()=>u.metrics(),enabled:n&&y,retry:!1}),z=r({queryKey:[`runtime-source-update`],queryFn:({signal:e})=>u.sourceUpdateStatus(e),enabled:n&&m&&!s,retry:!1,refetchInterval:e=>e.state.data?.running?1500:!1});(0,U.useEffect)(()=>{C(t.session.workdir??t.session.cwd??``)},[t.session.workdir,t.session.cwd]);let B=s||!!j||a.busy,oe=t.daemon.alive&&t.daemon.control_available===!1,V=t.daemon.alive&&t.daemon.protocol_compatible===!1,se=async(e,t,n)=>{if(!(s||ne.current||a.busy)){ne.current=!0,N(e),ie(null),P(``);try{await Lt(t()),P(n),await o()}catch(e){ie(me(e,l))}finally{ne.current=!1,N(``)}}},H=(e,t,n,r)=>{!B&&window.confirm(t)&&se(e,n,r)},ce=e=>e?de(e)?l(`operations.unavailableHere`):me(e,l).text:``,le=t.daemon_admission?.running_daemons??[];return(0,Y.jsxs)(`div`,{className:`runtime-control-page`,children:[(0,Y.jsxs)(`section`,{className:`runtime-summary`,children:[(0,Y.jsxs)(`div`,{className:`runtime-summary-copy`,children:[(0,Y.jsx)(`span`,{className:`runtime-eyebrow`,children:p?`运行控制`:`Runtime controls`}),(0,Y.jsx)(`h2`,{children:t.session.display_name||e}),(0,Y.jsxs)(`div`,{className:`runtime-status-line`,children:[(0,Y.jsxs)(`span`,{className:`runtime-status`,"data-running":t.daemon.alive,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),t.daemon.alive?p?`持续运行中`:`Running continuously`:p?`持续运行已暂停`:`Continuous work paused`]}),(0,Y.jsx)(`span`,{children:i?p?`实时连接`:`Live connection`:p?`连接恢复中,状态可能延迟`:`Reconnecting; status may be delayed`}),!!t.manager_requests?.length&&(0,Y.jsx)(`span`,{children:p?`对话处理中`:`Reply in progress`})]})]}),(0,Y.jsxs)(`div`,{className:`runtime-main-actions`,children:[(0,Y.jsxs)(`button`,{className:`button button--primary`,disabled:B||oe||V,onClick:()=>{t.daemon.alive?a.stop(!0):a.start()},children:[t.daemon.alive?(0,Y.jsx)(M,{size:16}):(0,Y.jsx)(te,{size:16}),a.busy?p?`正在处理…`:`Working…`:t.daemon.alive?p?`安全暂停`:`Pause safely`:p?`启动运行`:`Start work`]}),(0,Y.jsxs)(`button`,{className:`button button--ghost`,disabled:I.isFetching,onClick:()=>{I.refetch(),o()},children:[(0,Y.jsx)(b,{size:15}),p?`刷新状态`:`Refresh`]})]}),(0,Y.jsx)(`p`,{className:`runtime-summary-hint`,children:p?`安全暂停会等待当前工作结束。新的任务和调整直接在对话中告诉 Argus。`:`Safe pause waits for current work to finish. Send new tasks and adjustments in the conversation.`}),s&&(0,Y.jsx)(`p`,{children:p?`当前为只读展示,不能执行控制操作。`:`Read-only view; control actions are disabled.`}),oe&&(0,Y.jsx)(`p`,{role:`alert`,children:p?`此运行实例由外部管理,请在其启动端控制。`:`This instance is externally managed. Control it from its host.`}),V&&(0,Y.jsx)(`p`,{role:`alert`,children:p?`运行实例版本不兼容,请展开运行设置进行安全重启。`:`The running version is incompatible. Open settings to restart safely.`}),t.daemon.protocol_error&&(0,Y.jsx)(`p`,{role:`alert`,children:t.daemon.protocol_error}),a.error&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-err`,children:a.error})]}),(0,Y.jsx)(It,{status:I.isError?null:I.data??null,error:ce(I.error)}),F&&(0,Y.jsxs)(`div`,{className:`runtime-feedback`,role:`alert`,children:[(0,Y.jsx)(`p`,{children:F.text}),F.technical&&(0,Y.jsx)(D,{label:l(`operations.technicalDetails`),children:(0,Y.jsx)(`pre`,{children:F.technical})})]}),re&&(0,Y.jsxs)(`p`,{className:`runtime-feedback`,role:`status`,children:[(0,Y.jsx)(v,{size:16}),re]}),!!j&&(0,Y.jsx)(`p`,{role:`status`,className:`text-sm text-ink-dim`,children:p?`正在处理,请稍候…`:`Working, please wait…`}),(0,Y.jsxs)(`details`,{className:`runtime-section`,open:m,onToggle:e=>h(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(Pe,{size:17}),(0,Y.jsx)(`span`,{children:p?`运行设置`:`Runtime settings`}),(0,Y.jsx)(`small`,{children:p?`目录与维护`:`Directory & maintenance`})]}),(0,Y.jsxs)(`div`,{className:`runtime-section-body`,children:[(0,Y.jsxs)(`label`,{htmlFor:`runtime-workdir-${e}`,children:[(0,Y.jsx)(ke,{size:15}),l(`operations.workdir`)]}),(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsx)(`input`,{id:`runtime-workdir-${e}`,value:S,onChange:e=>C(e.target.value),disabled:B}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B||!S.trim()||S===(t.session.workdir??t.session.cwd??``),onClick:()=>H(`cwd`,p?`更改后,后续工作将使用新的会话目录。确认更改?`:`Future work will use the new session directory. Apply?`,()=>u.setWorkdir(e,S),l(`operations.workdirUpdated`)),children:[(0,Y.jsx)(v,{size:15}),p?`应用目录`:`Apply directory`]})]}),(0,Y.jsx)(`p`,{children:p?`这是会话工作目录,不是安全沙箱边界。以下维护操作不删除任务历史。`:`This is the session directory, not a sandbox boundary. Maintenance below preserves task history.`}),(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsxs)(`button`,{className:`button`,disabled:B,onClick:()=>H(`reset`,p?`将清空当前对话的上下文,任务和文件会保留。确认重置?`:`Clear conversation context? Tasks and files are preserved.`,()=>u.resetManager(e),p?`对话上下文已重置。`:`Conversation context reset.`),children:[(0,Y.jsx)(ee,{size:15}),p?`重置对话上下文`:`Reset conversation context`]}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B||oe,onClick:()=>H(`restart`,p?`等待当前工作结束后,使用当前版本重新启动。确认继续?`:`Wait for active work, then restart on the current release?`,()=>u.upgradeDaemon(e,t.daemon_commands?.revision),p?`安全重启请求已提交。`:`Safe restart requested.`),children:[(0,Y.jsx)(b,{size:15}),p?`安全重启`:`Restart safely`]})]}),!s&&(0,Y.jsxs)(`div`,{className:`runtime-source-update`,children:[(0,Y.jsx)(`h3`,{children:l(`operations.sourceUpdate`)}),z.error?(0,Y.jsx)(`p`,{role:`alert`,children:ce(z.error)}):(0,Y.jsx)(`p`,{children:z.data?.error||z.data?.message||(p?`按需检查,不会自动更新或重启。`:`Check on demand. Nothing updates or restarts automatically.`)}),!z.error&&(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsxs)(`button`,{className:`button`,disabled:B||z.data?.running,onClick:()=>void se(`check-update`,async()=>{await u.checkSourceUpdate(),await z.refetch()},p?`已提交更新检查。`:`Update check requested.`),children:[(0,Y.jsx)(b,{size:15}),p?`检查更新`:`Check updates`]}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B||!z.data?.can_update||!z.data.update_available||z.data.running,onClick:()=>H(`update`,p?`将下载并构建新版本;完成后可能需要重启服务。确认更新?`:`Download and build the new release? A service restart may be needed.`,async()=>{await u.applySourceUpdate(),await z.refetch()},p?`更新请求已提交。`:`Update requested.`),children:[(0,Y.jsx)(xe,{size:15}),l(`operations.pullLatest`)]})]}),z.data?.restart_required&&(0,Y.jsx)(`p`,{children:l(`operations.updateRestart`)})]}),!!le.length&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:p?`切换运行名额`:`Switch active session`}),(0,Y.jsx)(`p`,{children:p?`先安全暂停指定项目,再启动当前项目。`:`Safely pause the selected project, then start this one.`}),le.map(n=>(0,Y.jsxs)(`button`,{className:`button`,disabled:B,onClick:()=>H(`replace:${n.id}`,p?`将暂停“${n.label||n.id}”并启动当前项目,确认继续?`:`Pause ${n.label||n.id} and start this project?`,()=>u.replaceDaemon(e,n.id,!!t.continuous?.enabled,t.daemon_commands?.revision),p?`项目切换请求已提交。`:`Session switch requested.`),children:[(0,Y.jsx)(b,{size:15}),n.label||n.id]},n.id))]})]})]}),!s&&(0,Y.jsxs)(`details`,{className:`runtime-section`,open:g,onToggle:e=>_(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(ae,{size:17}),(0,Y.jsx)(`span`,{children:p?`恢复已移除项目`:`Restore removed projects`})]}),(0,Y.jsxs)(`div`,{className:`runtime-section-body`,children:[(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsx)(`input`,{"aria-label":l(`operations.searchTrash`),placeholder:l(`operations.searchTrash`),value:w,onChange:e=>E(e.target.value),onKeyDown:e=>{!ye(e)&&e.key===`Enter`&&(e.preventDefault(),k(w))}}),(0,Y.jsxs)(`button`,{className:`button`,onClick:()=>k(w),children:[(0,Y.jsx)(T,{size:15}),p?`搜索`:`Search`]})]}),L.error?(0,Y.jsx)(`p`,{role:`alert`,children:ce(L.error)}):L.isLoading?(0,Y.jsx)(`p`,{children:l(`common.loading`)}):L.data?.entries.length?L.data.entries.map(e=>(0,Y.jsxs)(`div`,{className:`runtime-restore-row`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B,onClick:()=>void se(`restore:${e.trash_id}`,async()=>{let t=await u.restoreTrash(e.trash_id);await L.refetch(),await c(t.sid)},p?`项目已恢复。`:`Project restored.`),children:[(0,Y.jsx)(ee,{size:15}),p?`恢复`:`Restore`]})]},e.trash_id)):(0,Y.jsx)(`p`,{children:l(`operations.trashEmpty`)}),L.data&&L.data.total>L.data.entries.length&&(0,Y.jsx)(`p`,{children:p?`显示最近 ${L.data.entries.length} 条,请缩小搜索范围。`:`Showing ${L.data.entries.length} recent matches. Narrow the search for more.`})]})]}),(0,Y.jsxs)(`details`,{className:`runtime-section`,open:y,onToggle:e=>x(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(A,{size:17}),(0,Y.jsx)(`span`,{children:p?`技术诊断`:`Technical diagnostics`})]}),(0,Y.jsx)(`div`,{className:`runtime-section-body`,children:R.error?(0,Y.jsx)(`p`,{role:`alert`,children:ce(R.error)}):R.data?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{children:l(R.data.slo?.status===`healthy`?`operations.slo.healthy`:`operations.slo.degraded`)}),(0,Y.jsx)(D,{children:(0,Y.jsx)(`pre`,{children:JSON.stringify(R.data,null,2)})})]}):(0,Y.jsx)(`p`,{children:l(`common.loading`)})})]})]})}var zt=[{id:`timeline`,zh:`研究排期`,en:`Research timeline`,zhDesc:`比较 proposal 工期,安排实验,并追踪延期原因。`,enDesc:`Compare proposal estimates, schedule experiments, and track delays.`,icon:Se,color:`blue`},{id:`experiments`,zh:`运行进程`,en:`Execution`,zhDesc:`查看当前步骤、任务路线,以及团队里谁在做什么。`,enDesc:`Follow the current step, the task route, and who on the team is doing what.`,icon:Oe,color:`blue`},{id:`ide`,zh:`AI IDE`,en:`AI IDE`,zhDesc:`阅读项目文件,查看 Git 状态与 Argus 活动。`,enDesc:`Read project files, Git state, and Argus activity.`,icon:re,color:`emerald`},{id:`runtime`,zh:`运行控制`,en:`Runtime controls`,icon:ne}];function Bt(e){let t=String(e.event_id??e.id??``);if(t)return t;let n=String(e.message_id??``);return n?`${e.type??``}:${n}:${e.kind??``}`:[e.type??``,e.ts??``,e.agent_layer??e.actor??``,e.kind??``,String(e.text??e.title??e.reason??``).slice(0,160)].join(`|`)}function Vt(e,t){let n=[...e],r=new Map(n.map((e,t)=>[Bt(e),t]));return t.forEach(e=>{let t=Bt(e),i=r.get(t);i==null?(r.set(t,n.length),n.push(e)):n[i]={...n[i],...e}}),n.sort((e,t)=>Number(e.ts??0)-Number(t.ts??0)).slice(-600)}function Ht(e=!0){return r({queryKey:[`v2-projects`],queryFn:({signal:e})=>q.projects(e),enabled:e,refetchInterval:1e4})}function Ut(e,t=!0){let n=i(),[o,s]=(0,U.useState)([]),[c,l]=(0,U.useState)(!1),u=(0,U.useRef)(null),d=!!e&&t,f=r({queryKey:[`v2-snapshot`,e],queryFn:({signal:t})=>q.snapshot(e,t),enabled:d,refetchInterval:5e3}),p=r({queryKey:[`v2-status`,e],queryFn:({signal:t})=>q.status(e,t),enabled:d,refetchInterval:6e3}),m=r({queryKey:[`v2-events`,e],queryFn:({signal:t})=>q.events(e,220,t),enabled:d,refetchInterval:15e3});(0,U.useEffect)(()=>{s([]),l(!1)},[e]),(0,U.useEffect)(()=>{!e||!m.data||s(e=>Vt(e,m.data))},[m.data,e]),(0,U.useEffect)(()=>{if(!e||!t){l(!1);return}let r=He(e,t=>{s(e=>Vt(e,[t])),u.current??=window.setTimeout(()=>{u.current=null,n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]})},900)},l);return()=>{r.close(),l(!1),u.current!=null&&(window.clearTimeout(u.current),u.current=null)}},[t,n,e]);let h=async()=>{e&&await Promise.all([n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]}),n.invalidateQueries({queryKey:[`v2-events`,e]})])},g=a({mutationFn:()=>q.startDaemon(e,f.data?.daemon_commands?.revision),onSuccess:h}),_=a({mutationFn:t=>q.stopDaemon(e,t,f.data?.daemon_commands?.revision),onSuccess:h}),v=(0,U.useMemo)(()=>{let e=[f,p,m].find(e=>e.error);return e?.error instanceof Error?e.error:null},[m,f,p]);return{snapshot:f,status:p,events:o,connected:c,refresh:h,controls:{start:g,stop:_},error:v}}function Wt({sid:e,active:t,readOnly:n=!1,runtimeRequest:r=0,onRestored:i}){let{locale:a}=d(),[o,s]=(0,U.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`module`);return zt.find(t=>t.id===e)?.id??`runtime`}),[c,l]=(0,U.useState)(()=>new Set([o])),u=(0,U.useCallback)(e=>{s(e),l(t=>t.has(e)?t:new Set([...t,e]))},[]);(0,U.useEffect)(()=>{r&&u(`runtime`)},[r,u]);let f=Ht(t),p=f.data?.projects??[],m=(0,U.useMemo)(()=>p.find(t=>t.id===e)??null,[p,e]),h=Ut(e,t),g=o,_=h.controls.start.error||h.controls.stop.error,v=m&&h.snapshot.data?{sid:e,active:t,project:m,snapshot:h.snapshot.data,status:h.status.data,events:h.events,connected:h.connected,snapshotUpdatedAt:h.snapshot.dataUpdatedAt,refresh:h.refresh,controls:{start:async()=>{try{return await h.controls.start.mutateAsync()}catch{return null}},stop:async e=>{try{return await h.controls.stop.mutateAsync(e)}catch{return null}},busy:h.controls.start.isPending||h.controls.stop.isPending,error:_ instanceof Error?_.message:``},navigate:u}:null;return(0,Y.jsxs)(`section`,{className:`integrated-workbench flex min-h-0 flex-1 flex-col bg-transparent text-ink`,children:[(0,Y.jsx)(`nav`,{className:`workbench-module-tabs shrink-0 border-b border-line/60 px-3 py-2`,"aria-label":a===`zh-CN`?`工作台模块`:`Workbench modules`,children:(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:zt.map(({id:e,zh:t,en:n,icon:r})=>(0,Y.jsxs)(`button`,{type:`button`,className:`workbench-module-tab`,"data-module":e,"data-selected":g===e,"aria-pressed":g===e,onClick:()=>u(e),children:[(0,Y.jsx)(r,{size:14}),(0,Y.jsx)(`span`,{children:a===`zh-CN`?t:n})]},e))})}),f.isError&&!m||h.snapshot.isError&&!h.snapshot.data?(0,Y.jsx)(Z,{title:a===`zh-CN`?`工作台读取失败`:`Workbench unavailable`,description:`Argus API did not return the selected project.`}):v?zt.filter(({id:e})=>c.has(e)).map(({id:r})=>(0,Y.jsx)(`div`,{className:`ros-content workspace-view-surface min-h-0 flex-1 overflow-x-hidden overflow-y-auto ${g===r?``:`hidden`}`,"aria-hidden":g!==r,children:r===`runtime`?(0,Y.jsx)(Rt,{...v,active:t&&g===r,readOnly:n,onRestored:i}):r===`timeline`?(0,Y.jsx)(Nt,{sid:e}):r===`experiments`?(0,Y.jsx)(ht,{...v,active:t&&g===r}):(0,Y.jsx)(Et,{...v,active:t&&g===r})},`${e}:${r}`)):(0,Y.jsx)(`div`,{className:`boot-state`,children:(0,Y.jsx)(tt,{label:a===`zh-CN`?`正在载入工作台`:`Loading workbench`})})]})}export{Wt as ResearchWorkbenchPanel}; \ No newline at end of file diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-BS5QOR9J.css b/frontend/web/dist/assets/ResearchWorkbenchPanel-BS5QOR9J.css new file mode 100644 index 000000000..69ec0faaf --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-BS5QOR9J.css @@ -0,0 +1 @@ +.readonly-diff{min-width:0;color:rgb(var(--ink))}.readonly-diff__toolbar{flex-wrap:wrap;align-items:center;gap:6px;padding:10px 10px 4px;display:flex}.readonly-diff__toolbar>strong{flex:100%;font-size:11px}.readonly-diff__toolbar>button{border:1px solid rgb(var(--line));background:rgb(var(--panel));min-height:28px;color:rgb(var(--ink-dim));cursor:pointer;border-radius:5px;padding:3px 7px;font-size:10px}.readonly-diff__hint,.readonly-diff__notice{overflow-wrap:anywhere;margin:6px 10px;font-size:10px;line-height:1.5}.readonly-diff__hint{color:rgb(var(--ink-dim))}.readonly-diff__notice{border-left:2px solid rgb(var(--warn));color:rgb(var(--ink));padding-left:7px}.readonly-diff .readonly-diff__text{background:rgb(var(--panel));max-height:min(540px,65vh);color:rgb(var(--ink));font-family:var(--mono);white-space:pre;tab-size:4;margin:0;padding:10px;font-size:10px;line-height:1.6;overflow:auto}.readonly-diff__line--header{color:rgb(var(--ink-dim));background:rgb(var(--line) / .35);font-weight:600}.readonly-diff__line--hunk{color:rgb(var(--blue));background:rgb(var(--blue) / .08);font-weight:600}.readonly-diff__line--addition{color:rgb(var(--ok));background:rgb(var(--ok) / .12)}.readonly-diff__line--deletion{color:rgb(var(--err));background:rgb(var(--err) / .08)}.readonly-diff__line--context{color:rgb(var(--ink))}.readonly-diff :focus-visible{outline:2px solid rgb(var(--blue));outline-offset:-2px}*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:where(.integrated-workbench),:where(.integrated-workbench) *,:where(.integrated-workbench) :before,:where(.integrated-workbench) :after{box-sizing:border-box}:where(.integrated-workbench) button,:where(.integrated-workbench) input,:where(.integrated-workbench) textarea,:where(.integrated-workbench) select{font:inherit;color:inherit}:where(.integrated-workbench) button{border:0}:where(.integrated-workbench) button:not(:disabled),:where(.integrated-workbench) select:not(:disabled){cursor:pointer}:where(.integrated-workbench) button:disabled{cursor:not-allowed;opacity:.48}:where(.integrated-workbench) a{color:inherit}.integrated-workbench{--surface-2:var(--panel-raised);--surface-3:var(--panel);--overlay:var(--panel-raised);--border:var(--line);--border-strong:var(--glass-edge);--text:var(--ink);--muted:var(--ink-dim);--faint:var(--ink-faint);--accent:var(--blue-deep);--accent-fg:255 255 255;--blue-bg:var(--conversation-argus);--green:var(--blue);--green-bg:var(--conversation-argus);--amber:var(--ink-dim);--amber-bg:var(--conversation-user);--red:var(--err);--red-bg:var(--conversation-user);--violet:var(--ink-dim);--violet-bg:var(--conversation-argus);--rose:var(--ink-dim);--rose-bg:var(--conversation-user);--manager:var(--role-manager);--planner:var(--role-planner);--engineer:var(--role-engineer);--reviewer:var(--role-reviewer);--shadow-1:none;--shadow-2:none;--shadow-3:0 20px 60px -32px #00000047;--radius-sm:8px;--radius-md:12px;--radius-lg:16px;--font:"Geist Variable", "PingFang SC", "Microsoft YaHei", sans-serif;--mono:"SFMono-Regular", Consolas, "Liberation Mono", monospace;min-width:0;min-height:0;font-family:var(--font);-webkit-font-smoothing:antialiased;font-size:14px}.integrated-workbench ::selection{background:rgb(var(--blue) / .2)}.integrated-workbench :focus-visible{outline:2px solid rgb(var(--blue) / .62);outline-offset:2px}.integrated-workbench ::-webkit-scrollbar{width:7px;height:7px}.integrated-workbench ::-webkit-scrollbar-track{background:0 0}.integrated-workbench ::-webkit-scrollbar-thumb{background:rgb(var(--faint) / .55);background-clip:padding-box;border:2px solid #0000;border-radius:999px}.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.argus-wordmark{align-items:center;gap:10px;display:inline-flex}.argus-wordmark svg{flex:none}.argus-wordmark__copy{flex-direction:column;align-items:flex-start;line-height:1.05;display:flex}.argus-wordmark__copy strong{letter-spacing:-.025em;font-size:16px;font-weight:720}.argus-wordmark__copy small{color:rgb(var(--muted));margin-top:3px;font-size:9px;font-weight:530}.brand-button{background:0 0;align-items:center;padding:0;display:inline-flex}.\!button{background:rgb(var(--surface-2))!important;min-height:36px!important;color:rgb(var(--text))!important;box-shadow:none!important;border:1px solid #0000!important;border-radius:8px!important;justify-content:center!important;align-items:center!important;gap:7px!important;padding:7px 12px!important;font-size:12px!important;font-weight:590!important;transition:color .15s,background .15s!important;display:inline-flex!important}.button{background:rgb(var(--surface-2));min-height:36px;color:rgb(var(--text));box-shadow:none;border:1px solid #0000;border-radius:8px;justify-content:center;align-items:center;gap:7px;padding:7px 12px;font-size:12px;font-weight:590;transition:color .15s,background .15s;display:inline-flex}.\!button:hover:not(:disabled){background:rgb(var(--border))!important}.button:hover:not(:disabled){background:rgb(var(--border))}.button--primary{border-color:rgb(var(--blue) / .34);background:rgb(var(--blue) / .08);color:rgb(var(--blue))}.button--primary:hover:not(:disabled){border-color:rgb(var(--blue-deep));background:rgb(var(--blue-deep));color:rgb(var(--accent-fg))}.button--secondary{background:rgb(var(--surface-2));box-shadow:none}.button--danger{border-color:rgb(var(--red) / .25);background:rgb(var(--red-bg));color:rgb(var(--red))}.button--large{border-radius:11px;min-height:42px;padding:9px 15px}.button--full{width:100%}.icon-button{width:34px;height:34px;color:rgb(var(--muted));background:0 0;border:0;border-radius:8px;flex:0 0 34px;place-items:center;transition:background .15s,color .15s;display:inline-grid}.icon-button:hover:not(:disabled){background:rgb(var(--surface-2));color:rgb(var(--text))}.badge{background:rgb(var(--surface-2));min-height:22px;color:rgb(var(--muted));white-space:nowrap;border:0;border-radius:6px;align-items:center;gap:5px;padding:3px 8px;font-size:10px;font-weight:610;line-height:1.2;display:inline-flex}.badge__dot,.status-dot{background:currentColor;border-radius:50%;width:6px;height:6px}.status-dot{color:rgb(var(--faint));background:rgb(var(--faint));display:inline-block}.status-dot.is-live{color:rgb(var(--green));background:rgb(var(--green));box-shadow:0 0 0 4px rgb(var(--green) / .11)}.is-pulsing{animation:2s infinite livePulse}.ros-card,.panel{border-radius:var(--radius-sm);background:rgb(var(--surface));min-width:0;min-height:0;box-shadow:none;border:0;overflow:hidden}.panel{flex-direction:column;display:flex}.panel__header,.ros-card>header{border-bottom:1px solid rgb(var(--border));justify-content:space-between;align-items:center;gap:12px;min-height:58px;padding:12px 16px;display:flex}.panel__heading,.ros-card>header>div{min-width:0}.panel__title,.ros-card>header h2{color:rgb(var(--text));margin:1px 0 0;font-size:13px;font-weight:650}.ros-card>header span,.panel__header .eyebrow{color:rgb(var(--faint));letter-spacing:.12em;font-size:9px;font-weight:690}.panel__body{min-width:0;min-height:0;padding:16px}.eyebrow{color:rgb(var(--faint));letter-spacing:.15em;margin-bottom:4px;font-size:9px;font-weight:700}.empty-state{text-align:center;flex-direction:column;justify-content:center;align-items:center;min-height:180px;padding:28px;display:flex}.empty-state__icon{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));width:44px;height:44px;color:rgb(var(--faint));border-radius:12px;place-items:center;margin-bottom:12px;display:grid}.empty-state__title{font-size:13px;font-weight:640}.empty-state p{max-width:360px;color:rgb(var(--muted));margin:6px 0 0;font-size:11px;line-height:1.55}.empty-state__action{margin-top:14px}.spinner{color:rgb(var(--muted));align-items:center;gap:7px;font-size:12px;display:inline-flex}.spin{animation:.85s linear infinite spin}.inline-error{border:1px solid rgb(var(--red) / .22);background:rgb(var(--red-bg));color:rgb(var(--red));border-radius:10px;padding:10px 12px;font-size:11px;line-height:1.5}.\!notice{border:1px solid rgb(var(--border))!important;background:rgb(var(--surface))!important;color:rgb(var(--muted))!important;border-radius:11px!important;gap:8px!important;padding:11px 13px!important;font-size:11px!important;display:flex!important}.notice{border:1px solid rgb(var(--border));background:rgb(var(--surface));color:rgb(var(--muted));border-radius:11px;gap:8px;padding:11px 13px;font-size:11px;display:flex}.markdown{min-width:0;font-size:inherit;overflow-wrap:anywhere;line-height:1.68}.markdown>:first-child{margin-top:0}.markdown>:last-child{margin-bottom:0}.markdown p{margin:.55em 0}.markdown h1,.markdown h2,.markdown h3{margin:1.2em 0 .45em;line-height:1.3}.markdown h1{font-size:1.4em}.markdown h2{font-size:1.22em}.markdown h3{font-size:1.08em}.markdown ul,.markdown ol{padding-left:1.55em}.markdown blockquote{border-left:3px solid rgb(var(--blue) / .45);background:rgb(var(--blue-bg));color:rgb(var(--muted));border-radius:0 8px 8px 0;margin:.8em 0;padding:7px 12px}.markdown code{background:rgb(var(--surface-2));font-family:var(--mono);border-radius:5px;padding:.12em .34em;font-size:.88em}.markdown pre{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));border-radius:10px;padding:12px;overflow:auto}.markdown pre code{background:0 0;padding:0}.markdown a{color:rgb(var(--blue));align-items:center;gap:3px;text-decoration:none;display:inline-flex}.markdown a:hover{text-decoration:underline}.markdown table{border-collapse:collapse;width:100%}.markdown th,.markdown td{border:1px solid rgb(var(--border));text-align:left;padding:6px 8px}.search-field{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));min-width:250px;color:rgb(var(--faint));border-radius:10px;align-items:center;gap:7px;padding:0 10px;display:flex}.search-field input{background:0 0;border:0;outline:0;width:100%;height:36px;font-size:12px}.search-field--block{margin:12px}.field{flex-direction:column;gap:6px;display:flex}.field>span,.form-grid label>span{color:rgb(var(--muted));font-size:11px;font-weight:580}.field input,.field textarea,.field select,.form-grid input,.new-project-fields input{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));border-radius:10px;outline:none;width:100%;padding:9px 10px;font-size:12px}.field input:focus,.field textarea:focus,.field select:focus,.form-grid input:focus,.new-project-fields input:focus{border-color:rgb(var(--blue) / .55);box-shadow:0 0 0 3px rgb(var(--blue) / .09)}.field textarea{resize:vertical;line-height:1.55}.field--grow{flex:1;min-height:0}.field--grow textarea{resize:none;flex:1;min-height:220px}.form-grid{grid-template-columns:1fr 1fr;gap:12px;display:grid}.form-grid label{flex-direction:column;gap:6px;display:flex}.file-button{position:relative;overflow:hidden}.file-button input{opacity:0;cursor:pointer;position:absolute;inset:0}.header-badges{flex-wrap:wrap;justify-content:flex-end;gap:7px;display:flex}.manager-mini-result{border-top:1px solid rgb(var(--border));max-height:260px;margin-top:10px;padding-top:10px;overflow:auto}.manager-mini-result .markdown{font-size:11px}.event-list{padding:5px}.event-row{border-radius:8px;grid-template-columns:22px minmax(0,1fr);gap:7px;padding:9px;display:grid;position:relative}.event-row:hover{background:rgb(var(--surface-2))}.event-row__marker{border:2px solid rgb(var(--surface));background:rgb(var(--faint));width:8px;height:8px;box-shadow:0 0 0 1px rgb(var(--border-strong));border-radius:50%;margin:6px auto 0}.event-row__content{min-width:0}.event-row__meta{gap:7px;display:flex}.event-row__meta time{color:rgb(var(--faint));font-family:var(--mono);margin-left:auto;font-size:9px}.role-label{text-transform:uppercase;font-size:9px;font-weight:700}.event-row__title{text-overflow:ellipsis;white-space:nowrap;margin-top:2px;font-size:11px;font-weight:620;overflow:hidden}.event-row__detail{color:rgb(var(--muted));font-family:var(--mono);-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin-top:2px;font-size:9px;line-height:1.45;display:-webkit-box;overflow:hidden}.event-list--dense .event-row{padding-block:7px}.ros-sidebar nav button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg));box-shadow:var(--shadow-1)}.ros-content{min-width:0;min-height:0;overflow:auto}.ros-page,.overview-page,.page{min-width:0;min-height:100%;padding:24px 28px 32px}.ros-page-header{justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:20px;display:flex}.ros-page-header h1{letter-spacing:-.03em;margin:0 0 5px;font-size:24px;font-weight:690}.ros-page-header p{max-width:780px;color:rgb(var(--muted));margin:0;font-size:12px;line-height:1.55}.boot-state{place-content:center;width:100%;height:100%;display:grid}.project-hub{max-width:1240px;margin:0 auto;padding:48px 24px 72px}.project-hub__hero{justify-content:space-between;align-items:flex-start;gap:28px;margin-bottom:30px;display:flex}.project-hub__hero h1{letter-spacing:-.04em;margin:2px 0 7px;font-size:32px;font-weight:710}.project-hub__hero p{max-width:660px;color:rgb(var(--muted));margin:0;font-size:13px;line-height:1.6}.project-hub__summary{grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:34px;display:grid}.project-hub__summary>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:82px;box-shadow:var(--shadow-1);border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto;align-items:center;gap:10px;padding:16px;display:grid}.project-hub__summary svg{color:rgb(var(--muted))}.project-hub__summary span{color:rgb(var(--muted));font-size:11px}.project-hub__summary strong{font-size:21px;font-weight:680}.project-hub__toolbar{justify-content:space-between;align-items:center;gap:16px;margin-bottom:14px;display:flex}.project-hub__toolbar h2{margin:0;font-size:16px}.project-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;display:grid}.project-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:264px;color:rgb(var(--text));text-align:left;box-shadow:var(--shadow-1);border-radius:16px;flex-direction:column;padding:18px;transition:transform .18s,border-color .18s,box-shadow .18s;display:flex}.project-card:hover{border-color:rgb(var(--border-strong));box-shadow:var(--shadow-2)}.project-card--skeleton{background:rgb(var(--surface-2));animation:1.5s infinite skeleton}.project-card__top{justify-content:space-between;align-items:center;display:flex}.project-card__mark{background:rgb(var(--surface-2));width:42px;height:42px;color:rgb(var(--muted));border-radius:12px;place-items:center;display:grid}.project-card__mark.is-live{background:rgb(var(--green-bg));color:rgb(var(--green))}.project-card__copy{min-height:84px;margin-top:16px}.project-card__copy h3{margin:0;font-size:16px;font-weight:660;line-height:1.35}.project-card__copy p{color:rgb(var(--muted));-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:7px 0 0;font-size:11px;line-height:1.5;display:-webkit-box;overflow:hidden}.project-card__facts{grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px;display:grid}.project-card__facts>div{background:rgb(var(--surface-2));border-radius:9px;padding:8px}.project-card__facts span{color:rgb(var(--faint));font-size:8px;display:block}.project-card__facts strong{text-overflow:ellipsis;white-space:nowrap;margin-top:2px;font-size:10px;display:block;overflow:hidden}.project-card__footer{border-top:1px solid rgb(var(--border));align-items:center;gap:10px;margin-top:auto;padding-top:13px;display:flex}.project-card__footer code{min-width:0;color:rgb(var(--faint));font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:8px;overflow:hidden}.project-card__footer span{color:rgb(var(--blue));align-items:center;gap:4px;font-size:10px;font-weight:610;display:flex}.project-inbox-cta{border:1px solid rgb(var(--border));background:rgb(var(--surface));text-align:left;width:100%;box-shadow:var(--shadow-1);border-radius:16px;grid-template-columns:48px minmax(0,1fr) 24px;align-items:center;gap:14px;margin-top:18px;padding:18px;display:grid}.project-inbox-cta>span{background:rgb(var(--rose-bg));width:46px;height:46px;color:rgb(var(--rose));border-radius:13px;place-items:center;display:grid}.project-inbox-cta strong{font-size:13px}.project-inbox-cta p{color:rgb(var(--muted));margin:4px 0 0;font-size:11px}.project-inbox-cta>svg{color:rgb(var(--faint))}.overview-page{max-width:1280px;margin:0 auto}.overview-hero{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:16px;grid-template-columns:minmax(0,1.4fr) minmax(360px,.8fr);gap:18px;padding:26px;display:grid}.overview-hero__copy h1{letter-spacing:-.035em;margin:14px 0 8px;font-size:27px}.overview-hero__copy p{max-width:760px;color:rgb(var(--muted));-webkit-line-clamp:4;-webkit-box-orient:vertical;margin:0 0 14px;font-size:12px;line-height:1.6;display:-webkit-box;overflow:hidden}.overview-hero__copy>code{color:rgb(var(--faint));font-family:var(--mono);font-size:9px}.overview-section-heading{justify-content:space-between;margin:30px 0 12px;display:flex}.overview-section-heading h2{margin:0;font-size:17px}.overview-section-heading p{color:rgb(var(--muted));margin:4px 0 0;font-size:11px}.module-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;display:grid}.module-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));text-align:left;min-height:132px;box-shadow:var(--shadow-1);border-radius:14px;grid-template-columns:44px minmax(0,1fr) 20px;align-items:start;gap:12px;padding:16px;transition:transform .15s,border-color .15s,box-shadow .15s;display:grid}.module-card:hover{border-color:rgb(var(--border-strong));box-shadow:var(--shadow-2);transform:translateY(-2px)}.module-card__icon{background:rgb(var(--surface-2));width:42px;height:42px;color:rgb(var(--muted));border-radius:11px;place-items:center;display:grid}.module-card h3{margin:2px 0 5px;font-size:13px}.module-card p{color:rgb(var(--muted));margin:0;font-size:10px;line-height:1.5}.module-card>svg{color:rgb(var(--faint));margin-top:13px}.copilot-v2{flex-direction:column;height:100%;display:flex;overflow:hidden}.copilot-v2 .ros-page-header{flex:none}.pending-question-banner{border:1px solid rgb(var(--amber) / .22);background:rgb(var(--amber-bg));color:rgb(var(--amber));border-radius:12px;flex:none;align-items:center;gap:10px;margin-bottom:12px;padding:10px 12px;display:flex}.pending-question-banner>div{flex:1}.pending-question-banner strong{font-size:11px}.pending-question-banner p{margin:2px 0 0;font-size:10px}.copilot-v2__layout{flex:1;grid-template-columns:minmax(0,1fr) 330px;gap:12px;min-width:0;min-height:0;display:grid}.copilot-v2__thread{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-width:0;min-height:0;box-shadow:var(--shadow-1);border-radius:16px;flex-direction:column;display:flex;overflow:hidden}.copilot-v2__messages{flex:1;min-height:0;padding:22px 18px 12px;overflow-y:auto}.copilot-empty{text-align:center;max-width:660px;margin:9vh auto 0}.copilot-empty h2{margin:12px 0 4px;font-size:19px}.copilot-empty>p{color:rgb(var(--muted));margin:0 0 18px;font-size:11px}.copilot-empty>div{grid-template-columns:repeat(3,1fr);gap:8px;display:grid}.copilot-empty button{border:1px solid rgb(var(--border));background:rgb(var(--surface));color:rgb(var(--muted));text-align:left;border-radius:11px;padding:11px;font-size:10px;line-height:1.45}.copilot-empty button:hover{border-color:rgb(var(--blue) / .3);background:rgb(var(--blue-bg));color:rgb(var(--text))}.\!message{max-width:820px!important;margin:0 auto 18px!important}.message{max-width:820px;margin:0 auto 18px}.message--user{background:rgb(var(--surface-2));border-radius:16px 5px 16px 16px;max-width:620px;margin-right:max(0px,50% - 410px);padding:11px 14px}.message--user>div:first-child{align-items:center;gap:7px;margin-bottom:4px;display:flex}.message--user span{font-size:10px;font-weight:650}.\!message time{color:rgb(var(--faint))!important;font-family:var(--mono)!important;font-size:8.5px!important}.message time{color:rgb(var(--faint));font-family:var(--mono);font-size:8.5px}.\!message .markdown{font-size:12.5px!important}.message .markdown{font-size:12.5px}.message--argus{grid-template-columns:34px minmax(0,1fr);gap:10px;display:grid}.message--argus>div{min-width:0}.message--argus header{align-items:center;gap:7px;min-height:24px;margin-bottom:5px;display:flex}.message--argus header strong{font-size:11px}.message--stream>div{border-left:2px solid rgb(var(--blue) / .25);padding-left:12px}.phase-trail{margin:5px 0 10px;padding:0;list-style:none}.phase-trail li{color:rgb(var(--faint));font-family:var(--mono);gap:7px;padding:2px 0;font-size:9px;display:flex}.phase-trail li span{color:rgb(var(--green))}.phase-trail li.is-active{color:rgb(var(--blue))}.phase-trail li.is-active span{animation:1s infinite blink}.copilot-composer-dock{border-top:1px solid rgb(var(--border));flex:none;padding:12px 18px 10px}.copilot-composer{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));max-width:820px;box-shadow:var(--shadow-2);border-radius:14px;align-items:flex-end;gap:7px;margin:0 auto;padding:7px;display:flex}.copilot-composer textarea{resize:none;background:0 0;border:0;outline:none;flex:1;min-height:36px;max-height:150px;padding:8px 3px;font-size:12px;line-height:1.5}.composer-tool{width:35px;height:35px;color:rgb(var(--muted));background:0 0;border-radius:9px;flex:0 0 35px;place-items:center;display:grid}.composer-tool:hover{background:rgb(var(--surface-2))}.optimize-button{background:rgb(var(--violet-bg));height:35px;color:rgb(var(--violet));border-radius:9px;align-items:center;gap:5px;padding:0 10px;font-size:10px;font-weight:650;display:flex}.send-button{background:rgb(var(--accent));width:35px;height:35px;color:rgb(var(--accent-fg));border-radius:9px;flex:0 0 35px;place-items:center;display:grid}.send-button.is-stop{background:rgb(var(--red-bg));color:rgb(var(--red))}.copilot-composer-dock>small{max-width:820px;color:rgb(var(--faint));text-align:center;margin:5px auto 0;font-size:8.5px;display:block}.attachment-chips{flex-wrap:wrap;gap:6px;max-width:820px;margin:0 auto 7px;display:flex}.attachment-chips>span{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));border-radius:8px;align-items:center;gap:5px;padding:5px 7px;font-size:9px;display:flex}.attachment-chips button{color:rgb(var(--faint));background:0 0;place-items:center;display:grid}.copilot-v2__aside{min-width:0;min-height:0;overflow:hidden}.copilot-trace{border:1px solid rgb(var(--border));background:rgb(var(--surface));height:100%;box-shadow:var(--shadow-1);border-radius:16px;overflow:hidden}.copilot-trace__header{border-bottom:1px solid rgb(var(--border));justify-content:space-between;align-items:center;min-height:58px;padding:12px 15px;display:flex}.copilot-trace__header>div{flex-direction:column;display:flex}.copilot-trace__header span{color:rgb(var(--faint));letter-spacing:.12em;font-size:8.5px;font-weight:700}.copilot-trace__header strong{margin-top:2px;font-size:13px}.copilot-trace__roles section>button:hover,.copilot-trace__roles section.is-open>button{background:rgb(var(--surface-2))}.copilot-trace__roles section.is-open>button svg{transform:rotate(180deg)}.role-orb{background:rgb(var(--faint));border-radius:50%;width:7px;height:7px}.modal-backdrop{z-index:100;background:#00000052;place-items:center;padding:16px;display:grid;position:fixed;inset:0}.prompt-optimizer{overscroll-behavior:contain;border:1px solid rgb(var(--border-strong) / .8);background:rgb(var(--overlay));border-radius:16px;width:min(980px,96vw);max-height:90vh;animation:.2s cubic-bezier(.2,.8,.2,1) prompt-optimizer-enter;overflow:auto;box-shadow:0 24px 80px #0003,0 2px 10px #00000014}.prompt-optimizer>header{border-bottom:1px solid rgb(var(--border));justify-content:space-between;padding:18px 20px;display:flex}.prompt-optimizer header span{color:rgb(var(--violet));letter-spacing:.13em;font-size:9px;font-weight:700}.prompt-optimizer h2{margin:3px 0;font-size:18px}.prompt-optimizer header p{color:rgb(var(--muted));margin:0;font-size:10px}.prompt-optimizer__compare{grid-template-columns:1fr 1fr;gap:12px;padding:16px;display:grid}.prompt-optimizer__compare>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:12px;flex-direction:column;min-height:280px;display:flex;overflow:hidden}.prompt-optimizer__compare label{border-bottom:1px solid rgb(var(--border));color:rgb(var(--muted));padding:9px 12px;font-size:10px;font-weight:650}.prompt-optimizer__compare pre{font-family:var(--font);white-space:pre-wrap;flex:1;margin:0;padding:13px;font-size:11px;line-height:1.6;overflow:auto}.optimizer-thinking{color:rgb(var(--violet));align-items:center;gap:8px;margin:auto;font-size:11px;display:flex}.optimizer-changes,.optimizer-questions{border:1px solid rgb(var(--border));border-radius:11px;margin:0 16px 12px;padding:10px 12px}.optimizer-changes strong,.optimizer-questions strong{margin-bottom:6px;font-size:10px;display:block}.optimizer-changes span{color:rgb(var(--muted));align-items:center;gap:5px;font-size:9.5px;display:flex}.optimizer-changes svg{color:rgb(var(--green))}.optimizer-questions{border-color:rgb(var(--amber) / .2);background:rgb(var(--amber-bg));color:rgb(var(--amber))}.optimizer-questions p{margin:3px 0;font-size:9.5px}.prompt-optimizer>.inline-error{margin:0 16px 12px}.prompt-optimizer>footer{border-top:1px solid rgb(var(--border));justify-content:flex-end;gap:8px;padding:13px 16px;display:flex}.literature-stats{grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:12px;display:grid}.literature-stats>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:13px;align-items:center;gap:10px;padding:12px;display:flex}.stat-icon{background:rgb(var(--surface-2));width:36px;height:36px;color:rgb(var(--muted));border-radius:10px;place-items:center;display:grid}.stat-icon--blue{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.stat-icon--green{background:rgb(var(--green-bg));color:rgb(var(--green))}.stat-icon--amber{background:rgb(var(--amber-bg));color:rgb(var(--amber))}.stat-icon--violet{background:rgb(var(--violet-bg));color:rgb(var(--violet))}.literature-stats p{color:rgb(var(--muted));margin:0;font-size:9.5px}.literature-stats strong{color:rgb(var(--text));margin-top:2px;font-size:17px;display:block}.literature-v2__layout{grid-template-columns:220px minmax(420px,1fr) 340px;gap:12px;min-width:0;min-height:720px;display:grid}.literature-v2__sidebar{align-self:start}.library-tabs{padding:0 7px 8px}.library-tabs button{width:100%;min-height:38px;color:rgb(var(--muted));background:0 0;border-radius:9px;justify-content:space-between;align-items:center;padding:0 10px;font-size:11px;display:flex}.library-tabs button:hover{background:rgb(var(--surface-2))}.library-tabs button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.library-tabs small{font-family:var(--mono);font-size:9px}.literature-source-note{border-top:1px solid rgb(var(--border));color:rgb(var(--muted));gap:8px;padding:12px;display:flex}.literature-source-note div{min-width:0}.literature-source-note strong{font-size:9px;display:block}.literature-source-note p{font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;margin:3px 0 0;font-size:7.5px;overflow:hidden}.literature-v2__main{min-width:0}.literature-list-header{justify-content:space-between;align-items:center;min-height:58px;margin-bottom:9px;display:flex}.literature-list-header h2{margin:0;font-size:15px}.literature-list-header p{color:rgb(var(--muted));margin:3px 0 0;font-size:9.5px}.paper-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;display:grid}.paper-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:214px;color:rgb(var(--text));text-align:left;box-shadow:var(--shadow-1);border-radius:14px;flex-direction:column;padding:14px;transition:transform .15s,border-color .15s,box-shadow .15s;display:flex}.paper-card:hover{border-color:rgb(var(--border-strong));box-shadow:var(--shadow-2);transform:translateY(-2px)}.paper-card.is-selected{border-color:rgb(var(--blue) / .35);box-shadow:0 0 0 3px rgb(var(--blue) / .07)}.paper-card__meta{justify-content:space-between;align-items:center;gap:8px;display:flex}.paper-card__year{color:rgb(var(--faint));font-size:9px}.paper-card h3{-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:11px 0 5px;font-size:13px;line-height:1.4;display:-webkit-box;overflow:hidden}.paper-card__authors{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:9px;overflow:hidden}.paper-card__summary{color:rgb(var(--muted));-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:8px 0;font-size:9.5px;line-height:1.5;display:-webkit-box;overflow:hidden}.paper-card__footer{border-top:1px solid rgb(var(--border));align-items:center;gap:8px;margin-top:auto;padding-top:9px;display:flex}.paper-card__footer code{min-width:0;color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:7.5px;overflow:hidden}.paper-card__footer span{color:rgb(var(--blue));font-size:9px}.source-file-grid{gap:8px;display:grid}.source-file-grid article{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:12px;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:8px;padding:11px;display:grid}.source-file-grid article>div{flex-direction:column;min-width:0;display:flex}.source-file-grid strong{font-size:10px}.source-file-grid code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8px;overflow:hidden}.source-file-grid time{color:rgb(var(--faint));font-size:8px}.literature-v2__detail{align-content:start;gap:10px;display:grid}.paper-detail{padding-bottom:13px}.paper-detail>:not(.empty-state){margin-inline:14px}.paper-detail__top{justify-content:space-between;align-items:center;padding-top:14px;display:flex}.paper-detail__top>span{color:rgb(var(--faint));font-size:9px}.paper-detail h2{font-size:15px;line-height:1.4;margin:12px 14px 5px!important}.paper-detail__authors{color:rgb(var(--muted));font-size:9px}.paper-detail__body{border-top:1px solid rgb(var(--border));max-height:300px;padding-top:10px;overflow:auto;margin-top:12px!important}.paper-detail__body h3{margin:0 0 5px;font-size:10px}.paper-detail__body p,.paper-detail__body .markdown{color:rgb(var(--muted));font-size:9.5px;line-height:1.55}.paper-detail__source{border-top:1px solid rgb(var(--border));flex-direction:column;padding-top:9px;display:flex;margin-top:11px!important}.paper-detail__source span{color:rgb(var(--faint));font-size:8px}.paper-detail__source code{text-overflow:ellipsis;white-space:nowrap;margin-top:3px;font-size:8px;overflow:hidden}.paper-detail>.button{width:calc(100% - 28px);margin:11px 14px 0!important}.paper-detail>.\!button{width:calc(100% - 28px)!important;margin:11px 14px 0!important}.retrieval-panel>div{max-height:260px;padding:6px;overflow:auto}.retrieval-panel article{border-radius:8px;grid-template-columns:22px minmax(0,1fr) auto;align-items:center;gap:6px;padding:6px;display:grid}.retrieval-panel article:hover{background:rgb(var(--surface-2))}.retrieval-panel article>div{flex-direction:column;min-width:0;display:flex}.retrieval-panel strong,.retrieval-panel code{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.retrieval-panel code,.retrieval-panel time{color:rgb(var(--faint));font-family:var(--mono);font-size:7.5px}.literature-ask{padding-bottom:12px}.literature-ask textarea{resize:vertical;border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));border-radius:9px;outline:0;width:calc(100% - 24px);margin:11px 12px 7px;padding:8px;font-size:10px;line-height:1.45}.literature-ask>.button{width:calc(100% - 24px);margin-inline:12px}.literature-ask>.\!button{width:calc(100% - 24px)!important;margin-inline:12px!important}.literature-ask .manager-mini-result{margin-inline:12px}.intake-steps{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:13px;grid-template-columns:repeat(4,1fr);margin-bottom:12px;padding:8px;display:grid}.intake-steps>div{color:rgb(var(--faint));border-radius:9px;align-items:center;gap:7px;padding:7px 10px;display:flex;position:relative}.intake-steps>div>span{background:rgb(var(--surface-2));border-radius:8px;place-items:center;width:26px;height:26px;display:grid}.intake-steps strong{font-size:10px}.intake-steps>div>svg{color:rgb(var(--faint));position:absolute;right:-7px}.intake-steps .is-active{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.intake-steps .is-done{color:rgb(var(--green))}.intake-steps .is-done>span{background:rgb(var(--green-bg))}.inbox-v2__layout{grid-template-columns:220px minmax(360px,1fr) minmax(340px,.92fr);gap:12px;min-width:0;min-height:700px;display:grid}.inbox-sources{align-self:stretch}.inbox-sources>div{padding:6px}.inbox-sources>div>button{text-align:left;background:0 0;border-radius:10px;grid-template-columns:30px minmax(0,1fr);align-items:center;gap:7px;width:100%;padding:8px;display:grid}.inbox-sources>div>button:hover,.inbox-sources>div>button.is-active{background:rgb(var(--surface-2))}.inbox-item-icon{background:rgb(var(--rose-bg));width:28px;height:28px;color:rgb(var(--rose));border-radius:8px;place-items:center;display:grid}.inbox-sources button>div{flex-direction:column;min-width:0;display:flex}.inbox-sources strong,.inbox-sources small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.inbox-sources strong{font-size:10px}.inbox-sources small{color:rgb(var(--faint));font-size:8px}.inbox-input{flex-direction:column;display:flex}.inbox-input__form{flex-direction:column;flex:1;min-height:0;padding:16px;display:flex}.inbox-input__actions{justify-content:space-between;gap:8px;margin-top:11px;display:flex}.inbox-output{grid-template-rows:minmax(280px,.85fr) minmax(400px,1.15fr);gap:12px;min-width:0;display:grid}.knowledge-grid{max-height:360px;padding:8px;overflow:auto}.knowledge-grid article{border-radius:10px;grid-template-columns:30px minmax(0,1fr);gap:8px;padding:8px;display:grid}.knowledge-grid article:hover{background:rgb(var(--surface-2))}.knowledge-grid article>span{background:rgb(var(--violet-bg));width:28px;height:28px;color:rgb(var(--violet));border-radius:8px;place-items:center;display:grid}.knowledge-grid .markdown{color:rgb(var(--muted));margin-top:3px;font-size:9px;line-height:1.45}.first-prompt{flex-direction:column;display:flex}.first-prompt>textarea{resize:none;background:rgb(var(--surface-2) / .45);min-height:200px;font-family:var(--mono);border:0;outline:0;flex:1;padding:14px;font-size:9.5px;line-height:1.6}.dispatch-mode{border-top:1px solid rgb(var(--border));grid-template-columns:1fr 1fr;gap:4px;padding:8px;display:grid}.dispatch-mode button{color:rgb(var(--muted));background:0 0;border-radius:8px;padding:7px;font-size:9.5px}.dispatch-mode button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.new-project-fields{grid-template-columns:.7fr 1.3fr;gap:7px;padding:0 8px 8px;display:grid}.first-prompt>.button{width:calc(100% - 16px);margin:0 8px 8px}.first-prompt>.\!button{width:calc(100% - 16px)!important;margin:0 8px 8px!important}.first-prompt .manager-mini-result{margin:0 8px 8px}.workspace-tree{flex:1;min-height:0;padding:5px;overflow:auto}.workspace-node>button{width:100%;min-height:28px;color:rgb(var(--muted));text-align:left;background:0 0;border-radius:6px;align-items:center;gap:4px;display:flex}.workspace-node>button:hover,.workspace-node>button.is-selected{background:rgb(var(--surface-2));color:rgb(var(--text))}.workspace-node>button.is-selected{color:rgb(var(--blue))}.workspace-node button>span:not(.node-spacer){font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.workspace-node button>small{color:rgb(var(--faint));margin-left:auto;font-size:7px}.node-spacer{width:13px}.editor-tabs button.is-active{border-bottom-color:rgb(var(--accent));color:rgb(var(--text))}.workspace-pdf{background:#fff;border:0;width:100%;height:100%}.workspace-image{-o-object-fit:contain;object-fit:contain;max-width:100%;max-height:100%;margin:auto;padding:16px;display:block}.editor-loading{color:rgb(var(--muted));padding:20px;font-size:11px}.workspace-git{height:100%;overflow:auto}.coding-response .markdown{font-size:10.5px}.terminal-role{font-weight:500}.paper-v2__files>nav button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.paper-file-list>button:hover,.paper-file-list>button.is-active{background:rgb(var(--surface-2))}.paper-file-list>button.is-active{color:rgb(var(--blue))}.paper-markdown-preview{height:100%;padding:24px 30px 50px;overflow:auto}.paper-markdown-preview .markdown{font-size:12.5px}.paper-ai-output .markdown{font-size:10.5px}.review-mode-tabs{grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px;display:grid}.review-mode-tabs>button{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:72px;color:rgb(var(--muted));text-align:left;box-shadow:var(--shadow-1);border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto;align-items:center;gap:10px;padding:12px 15px;display:grid}.review-mode-tabs>button.is-active{border-color:rgb(var(--blue) / .3);background:rgb(var(--blue-bg) / .45);color:rgb(var(--text));box-shadow:0 0 0 3px rgb(var(--blue) / .06)}.review-mode-tabs>button>svg{color:rgb(var(--blue))}.review-mode-tabs button>div{flex-direction:column;display:flex}.review-mode-tabs strong{font-size:12px}.review-mode-tabs small{color:rgb(var(--muted));margin-top:3px;font-size:9px}.process-review-layout{grid-template-rows:minmax(580px,auto) auto;grid-template-columns:260px minmax(400px,1fr) 330px;gap:12px;display:grid}.review-rounds>div{max-height:650px;padding:5px;overflow:auto}.review-rounds>div>button{text-align:left;background:0 0;border-radius:9px;grid-template-columns:30px minmax(0,1fr);gap:7px;width:100%;padding:8px;display:grid}.review-rounds>div>button:hover,.review-rounds>div>button.is-active{background:rgb(var(--surface-2))}.review-state{background:rgb(var(--surface-2));border-radius:8px;place-items:center;width:28px;height:28px;display:grid}.review-rounds button>div{flex-direction:column;min-width:0;display:flex}.review-rounds small{color:rgb(var(--faint));margin-top:2px;font-size:8px}.process-report{flex-direction:column;display:flex}.process-report>article{padding:18px;overflow:auto}.process-report__meta{border-bottom:1px solid rgb(var(--border));color:rgb(var(--faint));justify-content:space-between;margin-bottom:14px;padding-bottom:9px;font-size:9px;display:flex}.process-report .markdown{font-size:11.5px}.review-live{overflow:auto}.process-verdict-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:14px;grid-column:1/-1;align-items:flex-start;gap:11px;padding:14px;display:flex}.process-verdict-card__icon{background:rgb(var(--surface-2));border-radius:10px;flex:0 0 38px;place-items:center;width:38px;height:38px;display:grid}.process-verdict-card span{color:rgb(var(--faint));font-size:8px}.process-verdict-card strong{margin-top:2px;font-size:13px;display:block}.process-verdict-card p{color:rgb(var(--muted));margin:4px 0 0;font-size:10px}.final-review-layout{grid-template-columns:250px minmax(420px,1fr) 340px;gap:12px;min-height:680px;display:grid}.final-review-files>div{padding:5px}.final-review-files>div>button{text-align:left;background:0 0;border-radius:9px;grid-template-columns:24px minmax(0,1fr);gap:7px;width:100%;padding:8px;display:grid}.final-review-files>div>button:hover,.final-review-files>div>button.is-active{background:rgb(var(--surface-2))}.final-review-files button>div{flex-direction:column;display:flex}.final-review-files strong{font-size:9.5px}.final-review-files small{color:rgb(var(--faint));font-size:8px}.final-review-report{flex-direction:column;display:flex}.final-review-report>article{padding:20px;overflow:auto}.final-review-report .markdown{font-size:11.5px}.final-review-form>div{padding:14px}.final-review-form .field+.field{margin-top:11px}.final-review-warning{border:1px solid rgb(var(--amber) / .2);background:rgb(var(--amber-bg));color:rgb(var(--amber));border-radius:10px;gap:7px;margin:11px 0;padding:9px;display:flex}.final-review-warning p{margin:0;font-size:9px;line-height:1.45}.text-warn{color:rgb(var(--amber))}.task-row:hover,.task-row.is-selected{background:rgb(var(--surface-2))}.current-task h2{margin:10px 0 6px;font-size:16px;line-height:1.38}.current-task>p{color:rgb(var(--muted));margin:0;font-size:10.5px;line-height:1.55}.role-card.is-active{background:rgb(var(--blue-bg))}.diagnosis{border:1px solid rgb(var(--border));color:rgb(var(--muted));border-radius:10px;gap:7px;padding:9px;display:flex}.diagnosis strong{color:rgb(var(--text));font-size:9.5px;display:block}.diagnosis p{margin:3px 0 0;font-size:8.5px}@media (width<=1450px){.metric-grid{grid-template-columns:repeat(3,1fr)}.literature-v2__layout{grid-template-columns:210px minmax(380px,1fr) 310px}.inbox-v2__layout{grid-template-columns:200px minmax(340px,1fr) 320px}.ide-v2__shell{grid-template-columns:210px minmax(360px,1fr) 300px}.paper-v2__shell{grid-template-columns:210px minmax(380px,1fr) 320px}}.integrated-workbench{container-type:inline-size}@container (width<=1100px){.integrated-workbench .overview-hero{grid-template-columns:minmax(0,1fr)}.integrated-workbench .overview-hero__copy{overflow-wrap:anywhere;min-width:0}.integrated-workbench .overview-hero__badges{flex-wrap:wrap}.integrated-workbench .overview-hero__stats{grid-template-columns:repeat(3,minmax(0,1fr))}.integrated-workbench .overview-hero__stats>div{flex-direction:column;align-items:flex-start;min-width:0;display:flex}.integrated-workbench .experiment-v3-grid{grid-template-columns:220px minmax(0,1fr)}.integrated-workbench .experiment-v3-side{grid-column:1/-1;grid-template-columns:1fr 1fr}.integrated-workbench .research-stage-rail{grid-template-columns:repeat(4,minmax(0,1fr));overflow-x:visible}.integrated-workbench .literature-v2__layout,.integrated-workbench .inbox-v2__layout{grid-template-columns:210px minmax(0,1fr)}.integrated-workbench .literature-v2__detail,.integrated-workbench .inbox-output{grid-column:1/-1}.integrated-workbench .vscode-shell{grid-template-rows:minmax(0,1fr) 180px 340px 22px;grid-template-columns:42px 220px minmax(0,1fr);height:820px}.integrated-workbench .vscode-source-control{border-top:1px solid rgb(var(--vscode-line));border-left:0;grid-area:3/2/auto/4;display:flex}.integrated-workbench .vscode-terminal{grid-column:3}.integrated-workbench .vscode-statusbar{grid-area:4/1/auto/4}.integrated-workbench .paper-v3__shell{grid-template-columns:220px minmax(0,1fr);height:auto}.integrated-workbench .paper-v3__sources,.integrated-workbench .paper-v3__source{min-height:720px}.integrated-workbench .paper-v3__outputs{grid-column:1/-1;min-height:720px}.integrated-workbench .process-review-layout,.integrated-workbench .final-review-layout{grid-template-columns:220px minmax(0,1fr)}.integrated-workbench .review-live,.integrated-workbench .final-review-form{grid-column:1/-1}}@container (width<=480px){.integrated-workbench .overview-hero__stats{grid-template-columns:minmax(0,1fr)}}@container (width<=700px){.integrated-workbench .overview-hero{padding:18px}.integrated-workbench .overview-lower{grid-template-columns:minmax(0,1fr)}.integrated-workbench .ros-page,.integrated-workbench .overview-page,.integrated-workbench .page{padding:16px 16px 28px}.integrated-workbench .ros-page-header{flex-direction:column;gap:12px}.integrated-workbench .header-badges{justify-content:flex-start;width:100%}.integrated-workbench .module-grid,.integrated-workbench .copilot-v2__layout{grid-template-columns:1fr}.integrated-workbench .copilot-v2__aside{display:none}.integrated-workbench .experiment-v3-grid,.integrated-workbench .literature-v2__layout,.integrated-workbench .inbox-v2__layout,.integrated-workbench .process-review-layout,.integrated-workbench .final-review-layout{grid-template-columns:1fr}.integrated-workbench .experiment-v3-side,.integrated-workbench .literature-v2__detail,.integrated-workbench .inbox-output,.integrated-workbench .review-live,.integrated-workbench .final-review-form{grid-column:auto}.integrated-workbench .experiment-v3-side,.integrated-workbench .inbox-output,.integrated-workbench .literature-v2__detail{grid-template-columns:1fr}.integrated-workbench .experiment-header-actions{justify-content:flex-start;width:100%}.integrated-workbench .experiment-header-actions .button{flex:96px;justify-content:center;min-width:0}.integrated-workbench .experiment-progress-hero{grid-template-columns:1fr;gap:12px;padding:18px 16px 0}.integrated-workbench .progress-number{align-items:flex-start;padding-right:0}.integrated-workbench .progress-number strong{font-size:38px}.integrated-workbench .truthful-progress__legend span:last-child{width:100%;margin-left:0}.integrated-workbench .progress-metrics{grid-template-columns:repeat(2,minmax(0,1fr));margin-inline:-16px}.integrated-workbench .progress-metrics>div:nth-child(2){border-right:0}.integrated-workbench .progress-metrics>div:nth-child(-n+2){border-bottom:1px solid rgb(var(--border))}.integrated-workbench .checkpoint-list{grid-template-columns:1fr;gap:8px}.integrated-workbench .checkpoint{text-align:left;grid-template-columns:30px minmax(0,1fr);align-items:center;gap:9px;display:grid}.integrated-workbench .checkpoint>div{margin-top:0;padding-inline:0}.integrated-workbench .checkpoint>i{display:none}.integrated-workbench .research-stage-rail,.integrated-workbench .intake-steps{grid-template-columns:repeat(2,minmax(0,1fr))}.integrated-workbench .intake-steps>div>svg,.integrated-workbench .literature-v2__sidebar{display:none}.integrated-workbench .literature-list-header{align-items:flex-start;gap:10px}.integrated-workbench .paper-grid{grid-template-columns:1fr}.integrated-workbench .paper-card{min-height:0}.integrated-workbench .literature-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.integrated-workbench .ide-context-strip{grid-template-columns:18px minmax(0,1fr) auto 28px}.integrated-workbench .ide-context-strip code,.integrated-workbench .ide-context-strip small{display:none}.integrated-workbench .vscode-shell,.integrated-workbench .paper-v3__shell{flex-direction:column;height:auto;display:flex}.integrated-workbench .vscode-activitybar{flex-direction:row;height:44px}.integrated-workbench .vscode-sidebar{min-height:420px}.integrated-workbench .vscode-editor{min-height:680px}.integrated-workbench .vscode-terminal{min-height:240px}.integrated-workbench .vscode-source-control{min-height:420px}.integrated-workbench .vscode-statusbar{min-height:22px}.integrated-workbench .paper-v3__sources{min-height:480px}.integrated-workbench .paper-v3__source,.integrated-workbench .paper-v3__outputs{min-height:720px}.integrated-workbench .review-flow,.integrated-workbench .release-module-grid,.integrated-workbench .review-mode-tabs{grid-template-columns:1fr}.integrated-workbench .review-mode-tabs>button{min-width:0}.integrated-workbench .review-flow b{display:none}.integrated-workbench .release-flow{grid-template-columns:1fr;gap:5px}.integrated-workbench .release-flow>b{transform:rotate(90deg)}.integrated-workbench .experiment-header-actions .\!button{flex:96px!important;justify-content:center!important;min-width:0!important}}@media (width<=1180px){:root{--sidebar:204px}.project-grid,.module-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.overview-hero{grid-template-columns:1fr}.overview-hero__stats{grid-template-columns:repeat(3,1fr)}.overview-hero__stats>div{flex-direction:column;align-items:flex-start;display:flex}.literature-v2__layout{grid-template-columns:210px minmax(0,1fr)}.literature-v2__detail{grid-column:1/-1;grid-template-columns:1.2fr 1fr 1fr}.inbox-v2__layout{grid-template-columns:210px minmax(0,1fr)}.inbox-output{grid-column:1/-1;grid-template-rows:520px;grid-template-columns:1fr 1fr}.ide-v2__shell{grid-template-columns:210px minmax(0,1fr)}.ide-v2__assistant{grid-area:auto/1/auto/-1;min-height:480px}.ide-v2__shell{grid-template-rows:570px 170px auto;height:auto}.ide-v2__explorer{grid-row:1/3}.ide-v2__terminal{grid-column:2}.paper-v2__shell{grid-template-columns:210px minmax(0,1fr);height:auto}.paper-v2__files,.paper-v2__editor{min-height:700px}.paper-v2__assistant{grid-column:1/-1;min-height:500px}.process-review-layout{grid-template-columns:240px minmax(0,1fr)}.review-live{grid-column:1/-1;max-height:500px}.final-review-layout{grid-template-columns:230px minmax(0,1fr)}.final-review-form{grid-column:1/-1}.experiment-workspace{grid-template-columns:220px minmax(0,1fr)}.experiment-side{grid-column:1/-1;grid-template-columns:1fr 1fr}}@media (width<=900px){.ros-topbar__menu{display:inline-grid}.ros-topbar .brand-button,.back-to-projects,.ros-topbar__divider{display:none}.workspace-project-select{min-width:0;max-width:280px}.ros-workspace{grid-template-columns:1fr}.ros-sidebar{inset:var(--topbar) auto 0 0;z-index:60;width:250px;transition:transform .2s;position:fixed;transform:translate(-102%);box-shadow:18px 0 50px #00000047}.ros-sidebar.is-mobile-open{transform:translate(0)}.ros-sidebar__mobile-brand{border-bottom:1px solid rgb(var(--border));justify-content:space-between;align-items:center;margin:-12px -12px 10px;padding:11px 12px;display:flex}.mobile-scrim{inset:var(--topbar) 0 0;z-index:55;background:#0000006b;display:block;position:fixed}.ros-page,.overview-page,.page{padding:20px}.project-hub{padding:34px 20px 60px}.project-hub__hero{flex-direction:column}.project-hub__summary{grid-template-columns:1fr}.project-grid{grid-template-columns:1fr 1fr}.overview-lower,.copilot-v2__layout{grid-template-columns:1fr}.copilot-v2__aside{display:none}.literature-stats{grid-template-columns:1fr 1fr}.literature-v2__layout{grid-template-columns:1fr}.literature-v2__sidebar{display:none}.literature-v2__detail{grid-column:auto;grid-template-columns:1fr}.paper-grid,.inbox-v2__layout{grid-template-columns:1fr}.inbox-sources{min-height:260px}.inbox-input{min-height:600px}.inbox-output{grid-column:auto;grid-template-rows:auto;grid-template-columns:1fr}.knowledge-panel,.first-prompt{min-height:460px}.ide-v2__shell{grid-template-columns:200px minmax(0,1fr)}.ide-v2__assistant{grid-column:1/-1}.paper-v2__shell{grid-template-columns:200px minmax(0,1fr)}.paper-v2__assistant{grid-column:1/-1}.process-review-layout,.final-review-layout{grid-template-columns:1fr}.review-rounds{max-height:360px}.review-live,.process-verdict-card,.final-review-form{grid-column:auto}.experiment-workspace{grid-template-columns:1fr}.experiment-side{grid-column:auto;grid-template-columns:1fr}.mission-hero{flex-direction:column}}@media (width<=640px){.ros-topbar{padding-inline:10px}.ros-topbar>.badge{display:none}.workspace-project-select select{font-size:11px}.ros-page,.overview-page,.page{padding:16px}.ros-page-header{flex-direction:column;gap:8px}.ros-page-header h1{font-size:21px}.project-hub{padding-inline:16px}.project-hub__hero h1{font-size:27px}.project-grid,.module-grid{grid-template-columns:1fr}.project-hub__toolbar{flex-direction:column;align-items:stretch}.search-field{min-width:0}.overview-hero{padding:18px}.overview-hero__stats,.overview-lower{grid-template-columns:1fr}.copilot-v2{height:auto;min-height:100%}.copilot-v2__thread{min-height:720px}.copilot-empty>div{grid-template-columns:1fr}.optimize-button{justify-content:center;width:35px;padding:0;font-size:0}.message--user{margin-left:40px}.prompt-optimizer__compare{grid-template-columns:1fr}.prompt-optimizer{max-height:95vh}.literature-stats,.paper-grid{grid-template-columns:1fr}.intake-steps{grid-template-columns:1fr 1fr}.intake-steps>div>svg{display:none}.form-grid,.new-project-fields{grid-template-columns:1fr}.inbox-input__actions{flex-direction:column}.workspace-connector{grid-template-columns:28px minmax(0,1fr)}.workspace-connector__state{grid-column:2}.workspace-connector>div:nth-child(2)>div{flex-direction:column}.ide-v2__shell{flex-direction:column;height:auto;display:flex}.ide-v2__explorer{min-height:400px}.ide-v2__center{min-height:650px}.ide-v2__terminal{min-height:220px}.ide-v2__assistant{min-height:520px}.paper-v2__shell{flex-direction:column;display:flex}.paper-v2__files{min-height:440px}.paper-v2__editor{min-height:700px}.paper-v2__assistant{min-height:560px}.review-mode-tabs{grid-template-columns:1fr}.process-review-layout,.final-review-layout{flex-direction:column;display:flex}.process-report,.final-review-report{min-height:600px}.metric-grid,.current-task__facts{grid-template-columns:1fr}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}:root{--font:"Inter Variable", "Noto Sans SC Variable", "Geist Variable", "PingFang SC", "Microsoft YaHei", sans-serif}.ros-page:not(.copilot-v2),.overview-page,.page--experiments{font-size:15px}.ros-page:not(.copilot-v2) .ros-page-header h1{font-size:27px}.ros-page:not(.copilot-v2) .ros-page-header p{font-size:13.5px;line-height:1.65}.copilot-v2 .ros-page-header h1{font-size:24px}.copilot-v2 .ros-page-header p{font-size:12px}.ros-page:not(.copilot-v2) .ros-card>header h2,.overview-page .panel__title{font-size:14px}.ros-page:not(.copilot-v2) .ros-card>header span{font-size:9.5px}.project-hub__hero p,.overview-hero__copy p{font-size:13px}.module-card{min-height:148px;padding:19px}.module-card h3{font-size:14px}.module-card p{font-size:11.5px;line-height:1.6}.copilot-v2__layout{grid-template-columns:minmax(0,1fr) 380px}.copilot-trace-v2{flex-direction:column;display:flex}.team-pipeline{flex:none;gap:0;padding:10px 12px;display:grid}.team-pipeline>div{color:rgb(var(--muted));border-radius:9px;grid-template-columns:10px 72px minmax(0,1fr);align-items:center;gap:7px;padding:7px 8px;display:grid;position:relative}.team-pipeline>div.is-active{background:rgb(var(--blue-bg));color:rgb(var(--text))}.team-pipeline>div.is-done{color:rgb(var(--text))}.team-pipeline strong{text-transform:capitalize;font-size:10px}.team-pipeline small{text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.team-pipeline b{display:none}.current-operation{border-block:1px solid rgb(var(--border));background:rgb(var(--green-bg) / .55);flex:none;grid-template-columns:32px minmax(0,1fr);gap:8px;padding:11px 14px;display:grid}.current-operation>span{background:rgb(var(--green-bg));width:30px;height:30px;color:rgb(var(--green));border-radius:9px;place-items:center;display:grid}.current-operation>div{flex-direction:column;min-width:0;display:flex}.current-operation small{color:rgb(var(--green));font-size:8.5px}.current-operation strong{margin:2px 0;font-size:10.5px}.current-operation code{color:rgb(var(--muted));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.activity-filters{border-bottom:1px solid rgb(var(--border));color:rgb(var(--faint));flex:none;align-items:center;gap:4px;padding:8px 10px;display:flex}.activity-filters button{color:rgb(var(--muted));background:0 0;border-radius:7px;padding:5px 8px;font-size:9px}.activity-filters button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.visual-activity-timeline{flex:1;min-height:0;padding:6px;overflow:auto}.visual-activity-timeline>button{text-align:left;background:0 0;border-radius:9px;grid-template-columns:29px minmax(0,1fr);gap:7px;width:100%;padding:7px;display:grid}.visual-activity-timeline>button:hover,.visual-activity-timeline>button.is-open{background:rgb(var(--surface-2))}.activity-icon{background:rgb(var(--surface-2));width:27px;height:27px;color:rgb(var(--muted));border-radius:8px;place-items:center;display:grid}.visual-activity-timeline button>div{min-width:0}.visual-activity-timeline button>div>div{align-items:center;gap:6px;display:flex}.visual-activity-timeline strong{text-overflow:ellipsis;white-space:nowrap;font-size:9.5px;overflow:hidden}.visual-activity-timeline time{color:rgb(var(--faint));font-family:var(--mono);margin-left:auto;font-size:7.5px}.visual-activity-timeline p{color:rgb(var(--muted));font-family:var(--mono);-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin:2px 0 0;font-size:8px;line-height:1.45;display:-webkit-box;overflow:hidden}.visual-activity-timeline button.is-open p{-webkit-line-clamp:8}.visual-activity-timeline button>div>code{border:1px solid rgb(var(--border));background:rgb(var(--surface));max-height:220px;color:rgb(var(--muted));white-space:pre-wrap;border-radius:7px;margin-top:6px;padding:7px;font-size:7.5px;display:block;overflow:auto}.activity-empty{color:rgb(var(--faint));text-align:center;padding:24px;font-size:10px}.literature-v2__layout{grid-template-columns:230px minmax(500px,1fr) 370px;gap:14px}.literature-stats>div{min-height:78px;padding:15px}.literature-stats p{font-size:11px}.literature-stats strong{font-size:20px}.library-tabs button{min-height:43px;font-size:12px}.search-field input{font-size:13px}.literature-list-header h2{font-size:17px}.literature-list-header p{font-size:11px}.paper-grid{gap:12px}.paper-card{min-height:242px;padding:17px}.paper-card h3{margin-top:13px;font-size:14.5px;line-height:1.48}.paper-card__authors{font-size:10.5px}.paper-card__summary{-webkit-line-clamp:4;font-size:11px;line-height:1.6}.paper-card__year{font-size:10px}.paper-card__footer code{font-size:8.5px}.paper-card__footer span{font-size:10.5px}.paper-detail h2{font-size:17px}.paper-detail__authors{font-size:10.5px}.paper-detail__body h3{font-size:11.5px}.paper-detail__body p,.paper-detail__body .markdown{font-size:11px;line-height:1.65}.paper-detail__source code{font-size:9px}.retrieval-panel strong{font-size:9.5px}.retrieval-panel code,.retrieval-panel time{font-size:8px}.inbox-v2__layout{grid-template-columns:230px minmax(430px,1.08fr) minmax(380px,.92fr);gap:14px}.inbox-input__form{padding:18px}.inbox-input .field>span{font-size:12px}.inbox-input textarea{font-size:13px;line-height:1.65}.inbox-upload-types{border:1px dashed rgb(var(--border-strong));background:rgb(var(--surface-2) / .45);border-radius:11px;grid-template-columns:repeat(3,auto) minmax(0,1fr);align-items:center;gap:7px;margin-top:10px;padding:9px 11px;display:grid}.inbox-upload-types>span{background:rgb(var(--surface));color:rgb(var(--muted));border-radius:7px;align-items:center;gap:4px;padding:5px 7px;font-size:9px;display:flex}.inbox-upload-types p{color:rgb(var(--faint));margin:0;font-size:9px;line-height:1.4}.inbox-attachment-list{gap:6px;margin-top:9px;display:grid}.inbox-attachment-list>span{border:1px solid rgb(var(--border));background:rgb(var(--surface));color:rgb(var(--violet));border-radius:9px;grid-template-columns:24px minmax(0,1fr) 24px;align-items:center;gap:7px;padding:7px 9px;display:grid}.inbox-attachment-list>span>div{flex-direction:column;min-width:0;display:flex}.inbox-attachment-list strong{color:rgb(var(--text));text-overflow:ellipsis;white-space:nowrap;font-size:10px;overflow:hidden}.inbox-attachment-list small{color:rgb(var(--faint));font-size:8px}.inbox-attachment-list button{color:rgb(var(--faint));background:0 0;place-items:center;display:grid}.knowledge-grid strong{font-size:11.5px}.knowledge-grid .markdown{font-size:10.5px;line-height:1.55}.first-prompt>textarea{font-size:10.5px}.ide-v3{--vscode-bg:var(--surface);--vscode-side:var(--panel);--vscode-panel:var(--bg);--vscode-line:var(--line);--vscode-text:var(--ink);--vscode-muted:var(--ink-faint);--vscode-blue:var(--blue);--vscode-hover:var(--conversation-user);--vscode-selected:var(--conversation-argus)}.ide-v3 :is(.vscode-shell,.vscode-sidebar,.vscode-editor,.vscode-activitybar,.vscode-terminal,.vscode-code,.vscode-statusbar,.workspace-node>button){transition:background-color .16s,color .16s,border-color .16s}.ide-v3 .workspace-connector{font-size:13px}.vscode-shell{border:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-bg));min-width:0;height:760px;color:rgb(var(--vscode-text));box-shadow:var(--shadow-2);border-radius:12px;grid-template-rows:minmax(0,1fr) 190px 22px;grid-template-columns:44px 245px minmax(480px,1fr) 330px;display:grid;overflow:hidden}.vscode-activitybar{background:rgb(var(--vscode-panel));flex-direction:column;grid-area:1/1/3;align-items:center;gap:3px;padding-top:5px;display:flex}.vscode-activitybar button{width:44px;height:44px;color:rgb(var(--vscode-muted));background:0 0;border-left:2px solid #0000;place-items:center;display:grid;position:relative}.vscode-activitybar button:hover,.vscode-activitybar button.is-active{color:rgb(var(--vscode-blue));background:rgb(var(--vscode-selected))}.vscode-activitybar button.is-active{border-left-color:rgb(var(--vscode-blue))}.vscode-activitybar i{background:rgb(var(--blue-deep));color:#fff;text-align:center;border-radius:999px;min-width:16px;height:16px;font-size:8px;font-style:normal;line-height:16px;position:absolute;bottom:3px;right:3px}.vscode-sidebar{border-right:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-side));flex-direction:column;grid-area:1/2/3;min-width:0;display:flex}.vscode-sidebar>header{justify-content:space-between;align-items:center;height:36px;padding:0 10px 0 14px;display:flex}.vscode-sidebar>header span{letter-spacing:.08em;font-size:9px}.vscode-sidebar>header button{color:rgb(var(--vscode-muted));background:0 0;place-items:center;display:grid}.vscode-root{background:rgb(var(--vscode-panel));text-transform:uppercase;align-items:center;gap:4px;height:25px;padding:0 7px;font-size:9px;display:flex}.vscode-sidebar .workspace-tree{background:rgb(var(--vscode-side))}.vscode-sidebar .workspace-node>button{color:rgb(var(--vscode-text))}.vscode-sidebar .workspace-node>button:hover{background:rgb(var(--vscode-hover))}.vscode-sidebar .workspace-node>button.is-selected{background:rgb(var(--vscode-selected));color:rgb(var(--vscode-blue));box-shadow:inset 2px 0 rgb(var(--vscode-blue))}.vscode-sidebar .workspace-node button>span:not(.node-spacer){font-size:11px}.vscode-changes{padding:4px;overflow:auto}.vscode-changes button{width:100%;color:rgb(var(--vscode-text));text-align:left;background:0 0;border-radius:3px;grid-template-columns:22px minmax(0,1fr);gap:4px;padding:5px;display:grid}.vscode-changes button:hover{background:rgb(var(--vscode-hover))}.vscode-changes b{color:rgb(var(--role-engineer));font-size:9px}.vscode-changes span{text-overflow:ellipsis;white-space:nowrap;font-size:9px;overflow:hidden}.vscode-editor{background:rgb(var(--vscode-bg));flex-direction:column;grid-area:1/3;min-width:0;display:flex}.vscode-tabs{background:rgb(var(--vscode-panel));flex:0 0 36px;height:36px;display:flex}.vscode-tabs button{border-top:1px solid rgb(var(--vscode-blue));background:rgb(var(--vscode-bg));min-width:180px;max-width:60%;color:rgb(var(--vscode-text));align-items:center;gap:6px;padding:0 10px;font-size:9px;display:flex}.vscode-tabs button>span{color:rgb(var(--vscode-muted));margin-left:auto}.vscode-breadcrumbs{border-bottom:1px solid rgb(var(--vscode-line));height:28px;color:rgb(var(--vscode-muted));flex:0 0 28px;align-items:center;padding:0 11px;font-size:8.5px;display:flex;overflow:hidden}.vscode-breadcrumbs span{white-space:nowrap;align-items:center;display:flex}.vscode-editor-surface{flex:1;min-height:0;overflow:hidden}.vscode-editor-surface .empty-state{color:rgb(var(--vscode-text))}.vscode-editor-surface .empty-state__icon{border-color:rgb(var(--vscode-line));background:rgb(var(--vscode-side))}.vscode-code{background:rgb(var(--vscode-bg));height:100%;font-family:var(--mono);grid-template-columns:48px minmax(0,1fr);font-size:12px;line-height:1.7;display:grid;overflow:auto}.vscode-line-numbers{background:rgb(var(--vscode-bg));color:rgb(var(--vscode-muted));-webkit-user-select:none;user-select:none;flex-direction:column;align-items:flex-end;padding:12px 9px;display:flex;position:sticky;left:0}.vscode-line-numbers span{flex:none;height:1.7em}.vscode-code pre{min-width:max-content;color:rgb(var(--vscode-text));tab-size:2;white-space:pre;margin:0;padding:12px 18px 60px 8px}.vscode-editor-surface .workspace-pdf,.vscode-editor-surface .workspace-image{background:rgb(var(--vscode-bg))}.vscode-source-control{border-left:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-side));flex-direction:column;grid-area:1/4;min-width:0;display:flex}.vscode-source-control>header{border-bottom:1px solid rgb(var(--vscode-line));justify-content:space-between;align-items:center;height:49px;padding:0 10px;display:flex}.vscode-source-control>header>div{flex-direction:column;min-width:0;display:flex}.vscode-source-control header span{color:rgb(var(--vscode-muted));letter-spacing:.08em;font-size:8px}.vscode-source-control header strong{margin-top:2px;font-size:10px}.vscode-sc-tabs{border-bottom:1px solid rgb(var(--vscode-line));height:31px;display:flex}.vscode-sc-tabs button{color:rgb(var(--vscode-muted));background:0 0;border-bottom:1px solid #0000;flex:1;font-size:9px}.vscode-sc-tabs button.is-active{border-bottom-color:rgb(var(--vscode-blue));color:rgb(var(--vscode-text))}.vscode-git-content{flex:1;min-height:0;overflow:auto}.vscode-status,.vscode-diff{color:rgb(var(--vscode-text));font-family:var(--mono);white-space:pre-wrap;margin:0;padding:10px;font-size:8.5px;line-height:1.55}.vscode-status{border-bottom:1px solid rgb(var(--vscode-line));color:rgb(var(--vscode-text))}.vscode-commits{padding:5px}.vscode-commits article{grid-template-columns:22px minmax(0,1fr);gap:5px;padding:6px;display:grid}.vscode-commits strong{text-overflow:ellipsis;white-space:nowrap;font-size:9px;display:block;overflow:hidden}.vscode-commits small{color:rgb(var(--vscode-muted));font-size:7.5px}.vscode-terminal{border-top:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-panel));flex-direction:column;grid-area:2/3/auto/5;min-width:0;min-height:0;display:flex}.vscode-terminal>header{flex:0 0 31px;justify-content:space-between;align-items:center;height:31px;padding:0 10px;display:flex}.vscode-terminal header>div{gap:13px;display:flex}.vscode-terminal header button{height:31px;color:rgb(var(--vscode-muted));background:0 0;border-bottom:1px solid #0000;font-size:8px}.vscode-terminal header button.is-active{border-bottom-color:rgb(var(--vscode-blue));color:rgb(var(--vscode-text))}.vscode-terminal header>span{color:rgb(var(--vscode-muted));align-items:center;gap:4px;font-size:8px;display:flex}.vscode-terminal>div{flex:1;min-height:0;padding:5px 10px;overflow:auto}.vscode-terminal article{font-family:var(--mono);grid-template-columns:52px 52px 10px minmax(0,1fr);gap:5px;padding:2px 0;font-size:8.5px;line-height:1.45;display:grid}.vscode-terminal time{color:rgb(var(--vscode-muted));font-variant-numeric:tabular-nums}.vscode-terminal article>span{color:rgb(var(--role-engineer))}.vscode-terminal code{overflow-wrap:anywhere;white-space:pre-wrap}.vscode-terminal p{color:rgb(var(--vscode-muted));font-family:var(--mono);font-size:9px}.vscode-statusbar{border-top:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-panel));color:rgb(var(--vscode-muted));grid-area:3/1/auto/5;align-items:center;gap:15px;padding:0 8px;font-size:8px;display:flex}.vscode-statusbar span{align-items:center;gap:4px;display:flex}.vscode-statusbar span:nth-child(2){margin-right:auto}.paper-root-bar{grid-template-columns:30px minmax(0,1fr) auto 34px;align-items:center;gap:8px;margin-bottom:12px;padding:9px 12px;display:grid}.paper-root-bar>div{flex-direction:column;display:flex}.paper-root-bar span{color:rgb(var(--faint));letter-spacing:.11em;font-size:8.5px;font-weight:700}.paper-root-bar input{font-family:var(--mono);background:0 0;border:0;outline:0;margin-top:2px;font-size:10.5px}.paper-v3__shell{grid-template-columns:245px minmax(470px,1.25fr) minmax(390px,.9fr);gap:14px;min-width:0;height:780px;display:grid}.paper-v3__sources{flex-direction:column;display:flex}.paper-source-group{padding:7px}.paper-source-group+.paper-source-group{border-top:1px solid rgb(var(--border))}.paper-source-group h3{color:rgb(var(--muted));letter-spacing:.08em;align-items:center;gap:5px;margin:3px 5px 7px;font-size:9.5px;display:flex}.paper-source-group>button{width:100%;color:rgb(var(--muted));text-align:left;background:0 0;border-radius:9px;grid-template-columns:22px minmax(0,1fr) auto;align-items:center;gap:6px;padding:8px;display:grid}.paper-source-group>button:hover,.paper-source-group>button.is-active{background:rgb(var(--surface-2))}.paper-source-group>button.is-active{color:rgb(var(--blue))}.paper-source-group button>div{flex-direction:column;min-width:0;display:flex}.paper-source-group strong,.paper-source-group code{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.paper-source-group strong{font-size:10.5px}.paper-source-group code,.paper-source-group small{color:rgb(var(--faint));font-size:8px}.paper-source-group>p{color:rgb(var(--faint));padding:8px;font-size:10px}.paper-v3__sources>footer{border-top:1px solid rgb(var(--border));margin-top:auto;padding:9px 11px}.paper-v3__sources footer span{color:rgb(var(--faint));font-size:8px;display:block}.paper-v3__sources footer code{text-overflow:ellipsis;white-space:nowrap;margin-top:3px;font-size:8px;display:block;overflow:hidden}.paper-v3__source{flex-direction:column;display:flex}.paper-v3__source>header{min-height:50px;padding:8px 12px}.paper-v3__source header>div{flex-direction:column;min-width:0;display:flex}.paper-v3__source header strong{font-size:12px}.paper-v3__source header code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.paper-v3__source header>span{color:rgb(var(--faint));font-size:8.5px}.paper-v3__source>div{flex:1;min-height:0;overflow:hidden}.paper-v3__source>footer,.paper-v3__outputs>footer{border-top:1px solid rgb(var(--border));height:31px;color:rgb(var(--faint));font-family:var(--mono);justify-content:space-between;align-items:center;padding:0 11px;font-size:8.5px;display:flex}.latex-source{background:rgb(var(--surface-2) / .38);height:100%;font-family:var(--mono);grid-template-columns:48px minmax(0,1fr);font-size:10.5px;line-height:1.65;display:grid;overflow:auto}.latex-line-numbers{background:rgb(var(--surface-2));color:rgb(var(--faint));-webkit-user-select:none;user-select:none;flex-direction:column;align-items:flex-end;padding:14px 9px;display:flex;position:sticky;left:0}.latex-line-numbers span{height:17.325px}.latex-source pre{white-space:pre;min-width:max-content;margin:0;padding:14px 18px 50px 8px}.paper-v3__outputs{flex-direction:column;display:flex}.paper-v3__outputs>nav{border-bottom:1px solid rgb(var(--border));grid-template-columns:repeat(3,1fr);padding:6px;display:grid}.paper-v3__outputs>nav button{color:rgb(var(--muted));background:0 0;border-radius:8px;justify-content:center;align-items:center;gap:4px;padding:7px 4px;font-size:10px;display:flex}.paper-v3__outputs>nav button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.paper-v3__outputs nav small{font-family:var(--mono)}.paper-output-surface{flex:1;min-height:0;overflow:hidden}.paper-output-surface>embed{background:#fff;border:0;width:100%;height:calc(100% - 34px)}.pdf-switcher{border-bottom:1px solid rgb(var(--border));height:34px;padding:4px;display:flex;overflow-x:auto}.pdf-switcher button{color:rgb(var(--muted));background:0 0;border-radius:6px;flex:none;padding:0 8px;font-size:8.5px}.pdf-switcher button.is-active{background:rgb(var(--surface-2));color:rgb(var(--text))}.paper-figure-grid{grid-template-columns:1fr 1fr;align-content:start;gap:8px;height:100%;padding:9px;display:grid;overflow:auto}.paper-figure-grid figure,.paper-figure-grid article{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:10px;min-width:0;margin:0;padding:7px}.paper-figure-grid img{-o-object-fit:contain;object-fit:contain;background:rgb(var(--surface-2));width:100%;height:150px}.paper-figure-grid figcaption{text-overflow:ellipsis;white-space:nowrap;margin-top:5px;font-size:8.5px;overflow:hidden}.paper-figure-grid article{min-height:120px;color:rgb(var(--muted));text-align:center;flex-direction:column;justify-content:center;align-items:center;display:flex}.paper-figure-grid article strong{margin:7px 0 3px;font-size:10px}.paper-figure-grid article code{max-width:100%;color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:7.5px;overflow:hidden}.paper-reference-list{padding:7px}.paper-reference-list button{text-align:left;background:0 0;border-radius:8px;grid-template-columns:24px minmax(0,1fr);gap:7px;width:100%;padding:8px;display:grid}.paper-reference-list button:hover{background:rgb(var(--surface-2))}.paper-reference-list button>div{flex-direction:column;min-width:0;display:flex}.paper-reference-list strong{font-size:10px}.paper-reference-list code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8px;overflow:hidden}.review-flow{grid-template-columns:repeat(4,1fr);gap:8px;margin-bottom:12px;display:grid}.review-flow>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:68px;color:rgb(var(--muted));border-radius:12px;grid-template-columns:25px 24px minmax(0,1fr);align-items:center;gap:7px;padding:10px;display:grid;position:relative}.review-flow>div.is-active{border-color:rgb(var(--blue) / .3);background:rgb(var(--blue-bg));color:rgb(var(--blue))}.review-flow>div.is-done{color:rgb(var(--green))}.review-flow>div>span{background:rgb(var(--surface-2));border-radius:7px;place-items:center;width:23px;height:23px;font-size:9px;font-weight:700;display:grid}.review-flow>div>div{flex-direction:column;display:flex}.review-flow strong{color:rgb(var(--text));font-size:11px}.review-flow small{margin-top:2px;font-size:8.5px}.review-flow b{z-index:2;color:rgb(var(--faint));font-weight:400;position:absolute;right:-8px}.process-review-layout,.final-review-layout{min-height:650px}.review-rounds strong{font-size:10.5px}.review-rounds small{font-size:9px}.process-report .markdown,.final-review-report .markdown{font-size:12.5px;line-height:1.72}.final-review-form .field>span{font-size:11.5px}.final-review-form select,.final-review-form textarea{font-size:12px}@media (width<=1450px){.literature-v2__layout{grid-template-columns:220px minmax(440px,1fr) 340px}.inbox-v2__layout{grid-template-columns:210px minmax(390px,1fr) 350px}.vscode-shell{grid-template-columns:42px 225px minmax(420px,1fr) 300px}.paper-v3__shell{grid-template-columns:225px minmax(420px,1fr) 360px}}@media (width<=1180px){.copilot-v2__layout{grid-template-columns:minmax(0,1fr) 340px}.literature-v2__layout{grid-template-columns:220px minmax(0,1fr)}.literature-v2__detail{grid-column:1/-1;grid-template-columns:1.2fr 1fr 1fr}.inbox-v2__layout{grid-template-columns:220px minmax(0,1fr)}.inbox-output{grid-column:1/-1}.vscode-shell{grid-template-rows:minmax(0,1fr) 180px 22px;grid-template-columns:42px 220px minmax(0,1fr);height:820px}.vscode-source-control{display:none}.vscode-terminal{grid-column:3}.vscode-statusbar{grid-column:1/4}.paper-v3__shell{grid-template-columns:220px minmax(0,1fr);height:auto}.paper-v3__sources,.paper-v3__source{min-height:720px}.paper-v3__outputs{grid-column:1/-1;min-height:720px}}@media (width<=900px){.copilot-v2__layout{grid-template-columns:1fr}.copilot-v2__aside{display:none}.literature-v2__layout{grid-template-columns:1fr}.literature-v2__sidebar{display:none}.inbox-v2__layout{grid-template-columns:1fr}.inbox-output{grid-column:auto}.vscode-shell{grid-template-columns:42px 210px minmax(0,1fr)}.paper-v3__shell{grid-template-columns:210px minmax(0,1fr)}.paper-v3__outputs{grid-column:1/-1}}@media (width<=640px){.ros-page:not(.copilot-v2) .ros-page-header h1{font-size:23px}.ros-page:not(.copilot-v2) .ros-page-header p{font-size:12.5px}.vscode-shell{flex-direction:column;height:auto;display:flex}.vscode-activitybar{flex-direction:row;height:44px}.vscode-sidebar{min-height:420px}.vscode-editor{min-height:680px}.vscode-terminal{min-height:240px}.vscode-statusbar{height:22px}.paper-root-bar{grid-template-columns:25px minmax(0,1fr) auto}.paper-root-bar>.icon-button{display:none}.paper-v3__shell{flex-direction:column;display:flex}.paper-v3__sources{min-height:480px}.paper-v3__source,.paper-v3__outputs{min-height:720px}.paper-figure-grid{grid-template-columns:1fr}.review-flow{grid-template-columns:1fr 1fr}.review-flow b{display:none}.inbox-upload-types{grid-template-columns:1fr 1fr 1fr}.inbox-upload-types p{grid-column:1/-1}}.pdf-canvas-viewer{background:#525256;flex-direction:column;height:calc(100% - 34px);display:flex;overflow:hidden}.pdf-canvas-toolbar{background:rgb(var(--surface));flex:0 0 37px;align-items:center;gap:6px;min-height:37px;padding:0 8px;display:flex}.pdf-canvas-toolbar strong{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:9px;overflow:hidden}.pdf-canvas-toolbar span{color:rgb(var(--muted));font-size:8.5px}.pdf-canvas-toolbar button{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));min-width:27px;height:25px;color:rgb(var(--muted));border-radius:6px;padding:0 6px;font-size:8px}.pdf-canvas-scroll{text-align:center;flex:1;min-height:0;padding:14px;overflow:auto}.pdf-canvas-scroll canvas{background:#fff;max-width:none;display:inline-block;box-shadow:0 3px 18px #00000059}.pdf-canvas-viewer>.inline-error{margin:10px}.custom-project-switcher{min-width:280px;max-width:430px;position:relative}.project-switcher-trigger{text-align:left;background:0 0;border:1px solid #0000;border-radius:10px;grid-template-columns:8px minmax(0,1fr) 16px;align-items:center;gap:9px;width:100%;min-height:38px;padding:0 9px;transition:background .15s,border-color .15s;display:grid}.project-switcher-trigger:hover,.project-switcher-trigger.is-open{border-color:rgb(var(--border));background:rgb(var(--surface-2))}.project-switcher-trigger strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.project-switcher-trigger>svg{color:rgb(var(--faint));transition:transform .15s}.project-switcher-trigger.is-open>svg{transform:rotate(180deg)}.project-switcher-popover{z-index:100;border:1px solid rgb(var(--border));background:rgb(var(--overlay));width:min(440px,100vw - 28px);box-shadow:var(--shadow-3);border-radius:14px;animation:.14s ease-out popoverIn;position:absolute;top:calc(100% + 8px);left:0;overflow:hidden}.project-switcher-popover>header{border-bottom:1px solid rgb(var(--border));flex-direction:column;padding:12px 14px;display:flex}.project-switcher-popover header span{color:rgb(var(--faint));letter-spacing:.13em;font-size:8.5px;font-weight:700}.project-switcher-popover header strong{margin-top:2px;font-size:13px}.project-switcher-popover>div{max-height:390px;padding:6px;overflow:auto}.project-switcher-popover>div>button{width:100%;color:rgb(var(--text));text-align:left;background:0 0;border-radius:10px;grid-template-columns:38px minmax(0,1fr) 18px;align-items:center;gap:9px;padding:9px;display:grid}.project-switcher-popover>div>button:hover{background:rgb(var(--surface-2))}.project-switcher-popover>div>button.is-selected{background:rgb(var(--blue-bg))}.project-option-icon{background:rgb(var(--surface-2));width:36px;height:36px;color:rgb(var(--muted));border-radius:10px;place-items:center;display:grid}.project-option-icon.is-live{background:rgb(var(--green-bg));color:rgb(var(--green))}.project-option-copy{grid-template-columns:minmax(0,1fr) auto;gap:2px 8px;min-width:0;display:grid}.project-option-copy strong{text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.project-option-copy small{color:rgb(var(--faint));font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;grid-column:1/-1;font-size:7.5px;overflow:hidden}.project-option-copy em{color:rgb(var(--muted));white-space:nowrap;grid-area:1/2;font-size:8px;font-style:normal}.project-option-status{background:rgb(var(--faint));border-radius:50%;justify-self:center;width:7px;height:7px}.project-option-status.is-live{background:rgb(var(--green));box-shadow:0 0 0 4px rgb(var(--green) / .1)}.project-switcher-popover>footer{border-top:1px solid rgb(var(--border));background:rgb(var(--surface-2) / .55);color:rgb(var(--faint));justify-content:space-between;padding:8px 14px;font-size:8.5px;display:flex}.experiment-v3{max-width:1480px;margin:0 auto}.experiment-header-actions{flex-wrap:wrap;justify-content:flex-end;gap:7px;display:flex}.experiment-progress-hero{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:16px;grid-template-columns:minmax(0,1fr) 170px;gap:18px;padding:22px 24px 0;display:grid;overflow:hidden}.progress-hero-main{min-width:0}.progress-live-line{color:rgb(var(--muted));flex-wrap:wrap;align-items:center;gap:8px;font-size:10px;display:flex}.progress-live-line>span{border-left:1px solid rgb(var(--border));text-transform:capitalize;padding-left:8px}.progress-hero-main h2{letter-spacing:-.025em;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:12px 0 10px;font-size:21px;line-height:1.35;display:-webkit-box;overflow:hidden}.current-step-callout{border:1px solid rgb(var(--green) / .18);background:rgb(var(--green-bg) / .62);border-radius:12px;grid-template-columns:38px minmax(0,1fr);gap:9px;padding:10px 12px;display:grid}.current-step-callout>span{background:rgb(var(--green-bg));width:36px;height:36px;color:rgb(var(--green));border-radius:10px;place-items:center;display:grid}.current-step-callout>div{flex-direction:column;min-width:0;display:flex}.current-step-callout small{color:rgb(var(--green));font-size:9px;font-weight:650}.current-step-callout strong{margin:2px 0;font-size:12px}.current-step-callout code{color:rgb(var(--muted));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.progress-number{flex-direction:column;align-self:center;align-items:flex-end;padding-right:4px;display:flex}.progress-number>span{color:rgb(var(--blue));letter-spacing:.08em;font-size:9px;font-weight:700}.progress-number strong{letter-spacing:-.06em;margin:2px 0;font-size:43px;font-weight:720}.progress-number small{color:rgb(var(--muted));font-size:9.5px}.truthful-progress{grid-column:1/-1;margin-top:3px}.truthful-progress__track{background:rgb(var(--surface-3));border-radius:999px;height:13px;position:relative;overflow:visible}.truthful-progress__track .confirmed{background:rgb(var(--blue));border-radius:999px;transition:width .5s;position:absolute;inset:0 auto 0 0}.truthful-progress__track .\!confirmed{background:rgb(var(--blue))!important;border-radius:999px!important;transition:width .5s!important;position:absolute!important;inset:0 auto 0 0!important}.truthful-progress__track .estimated-range{border:1px dashed rgb(var(--blue) / .65);background:rgb(var(--blue) / .1);border-radius:999px;position:absolute;inset-block:1px}.truthful-progress__track i{background:rgb(var(--accent));width:2px;height:21px;box-shadow:0 0 0 3px rgb(var(--surface));border-radius:2px;transition:left .5s;position:absolute;top:-4px}.progress-metrics{border-top:1px solid rgb(var(--border));grid-column:1/-1;grid-template-columns:repeat(4,1fr);margin-inline:-24px;display:grid}.progress-metrics>div{border-right:1px solid rgb(var(--border));flex-direction:column;min-width:0;padding:13px 18px;display:flex}.progress-metrics>div:last-child{border-right:0}.progress-metrics span{color:rgb(var(--muted));align-items:center;gap:5px;font-size:9px;display:flex}.progress-metrics strong{text-overflow:ellipsis;white-space:nowrap;margin:5px 0 2px;font-size:16px;overflow:hidden}.progress-metrics small{color:rgb(var(--faint));-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:8.5px;line-height:1.4;display:-webkit-box;overflow:hidden}.research-stage-rail{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:14px;grid-template-columns:repeat(7,1fr);gap:5px;margin:12px 0;padding:8px;display:grid}.research-stage-rail>div{color:rgb(var(--faint));border-radius:9px;align-items:center;gap:6px;padding:7px 9px;display:flex;position:relative}.research-stage-rail>div>span{background:rgb(var(--surface-2));border-radius:8px;flex:0 0 24px;place-items:center;width:24px;height:24px;font-size:9px;font-weight:700;display:grid}.research-stage-rail strong{font-size:9px}.research-stage-rail>div>svg{z-index:2;position:absolute;right:-6px}.research-stage-rail>div.is-done{color:rgb(var(--green))}.research-stage-rail>div.is-done>span{background:rgb(var(--green-bg))}.research-stage-rail>div.is-active{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.research-stage-rail>div.is-active>span{background:rgb(var(--blue));color:#fff}.experiment-v3-grid{grid-template-columns:245px minmax(450px,1fr) 315px;align-items:start;gap:12px;display:grid}.experiment-task-route>div{max-height:720px;padding:6px;overflow:auto}.experiment-task-route>div>button{text-align:left;background:0 0;border-radius:10px;grid-template-columns:30px minmax(0,1fr);gap:7px;width:100%;padding:9px;display:grid}.experiment-task-route>div>button:hover,.experiment-task-route>div>button.is-active{background:rgb(var(--surface-2))}.task-state{border:1px solid rgb(var(--border));background:rgb(var(--surface));width:28px;height:28px;color:rgb(var(--faint));border-radius:9px;place-items:center;display:grid}.experiment-task-route button>div{flex-direction:column;min-width:0;display:flex}.experiment-task-route strong{-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:10.5px;line-height:1.4;display:-webkit-box;overflow:hidden}.experiment-task-route small{color:rgb(var(--faint));margin-top:3px;font-size:8.5px}.experiment-v3-center,.experiment-v3-side{gap:12px;min-width:0;display:grid}.checkpoint-list{grid-template-columns:repeat(4,1fr);gap:0;padding:14px;display:grid}.checkpoint{text-align:center;flex-direction:column;align-items:center;min-width:0;display:flex;position:relative}.checkpoint>span{z-index:2;border:2px solid rgb(var(--surface));background:rgb(var(--surface-2));width:30px;height:30px;color:rgb(var(--faint));box-shadow:0 0 0 1px rgb(var(--border));border-radius:50%;place-items:center;font-size:9px;font-weight:700;display:grid;position:relative}.checkpoint>i{background:rgb(var(--border));height:2px;position:absolute;top:15px;left:calc(50% + 15px);right:calc(15px - 50%)}.checkpoint>div{margin-top:8px;padding-inline:4px}.checkpoint strong{font-size:9.5px;display:block}.checkpoint p{color:rgb(var(--muted));margin:3px 0 0;font-size:8px;line-height:1.4}.checkpoint--active>span{background:rgb(var(--blue));color:#fff;animation:2s infinite livePulse}.selected-task-detail{border-top:1px solid rgb(var(--border));background:rgb(var(--surface-2) / .45);padding:12px 15px}.selected-task-detail>span{color:rgb(var(--faint));font-size:8px}.selected-task-detail strong{margin-top:3px;font-size:11px;display:block}.selected-task-detail p{color:rgb(var(--muted));-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:4px 0 0;font-size:9px;line-height:1.5;display:-webkit-box;overflow:hidden}.experiment-live-events{max-height:560px;overflow:auto}.experiment-team>div{padding:6px}.experiment-team article{border-radius:10px;grid-template-columns:10px minmax(0,1fr) auto;align-items:center;gap:8px;padding:9px;display:grid}.experiment-team article.is-active{background:rgb(var(--blue-bg))}.role-dot{background:rgb(var(--faint));border-radius:50%;width:8px;height:8px}.experiment-team article>div{min-width:0}.experiment-team strong{text-transform:capitalize;font-size:10.5px}.experiment-team p{color:rgb(var(--muted));text-overflow:ellipsis;white-space:nowrap;margin:2px 0;font-size:8.5px;overflow:hidden}.experiment-team small{color:rgb(var(--faint));font-size:8px}.estimate-note>div{padding:13px}.estimate-note p{color:rgb(var(--muted));margin:0 0 11px;font-size:9.5px;line-height:1.55}.estimate-note p strong{color:rgb(var(--text));margin-bottom:3px;display:block}@media (width<=1450px){.experiment-v3-grid{grid-template-columns:225px minmax(420px,1fr) 290px}}@media (width<=1180px){.experiment-v3-grid{grid-template-columns:220px minmax(0,1fr)}.experiment-v3-side{grid-column:1/-1;grid-template-columns:1fr 1fr}.research-stage-rail{grid-template-columns:repeat(7,minmax(135px,1fr));overflow-x:auto}}@media (width<=900px){.custom-project-switcher{min-width:0;max-width:320px}.progress-metrics{grid-template-columns:1fr 1fr}.progress-metrics>div:nth-child(2){border-right:0}.progress-metrics>div:nth-child(-n+2){border-bottom:1px solid rgb(var(--border))}.experiment-v3-grid{grid-template-columns:1fr}.experiment-v3-side{grid-column:auto;grid-template-columns:1fr}}@media (width<=640px){.project-switcher-trigger strong{font-size:11px}.project-switcher-popover{top:calc(var(--topbar) + 6px);width:auto;position:fixed;left:8px;right:8px}.experiment-progress-hero{grid-template-columns:1fr;padding:18px 18px 0}.progress-number{align-items:flex-start}.truthful-progress{grid-column:1}.progress-metrics{grid-column:1;margin-inline:-18px}.checkpoint-list{grid-template-columns:1fr;gap:6px}.checkpoint{text-align:left;grid-template-columns:34px minmax(0,1fr);align-items:center;min-height:50px;display:grid}.checkpoint>div{margin-top:0}.checkpoint>i{width:2px;height:auto;top:30px;bottom:-8px;left:15px}.checkpoint p{font-size:8.5px}}.experiment-v3 .experiment-v3-grid{margin-top:16px}.experiment-v3 .work-objective{color:rgb(var(--muted));overflow-wrap:anywhere;margin:0 0 16px;font-size:12px;line-height:1.7}.experiment-v3 .current-step-callout{border-color:rgb(var(--border));background:rgb(var(--surface-2))}.experiment-v3 .current-step-callout>span{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.experiment-v3 .current-step-callout small{color:rgb(var(--muted));font-size:11px}.experiment-v3 .current-step-callout strong{font-size:13px}.experiment-v3 .current-step-callout p{color:rgb(var(--muted));overflow-wrap:anywhere;white-space:pre-wrap;margin:4px 0 0;font-size:12px;line-height:1.6}.experiment-v3 .progress-number em{color:rgb(var(--faint));letter-spacing:-.02em;font-size:22px;font-style:normal;font-weight:450}.experiment-v3 .progress-number>span,.experiment-v3 .progress-number small{letter-spacing:0;font-size:11px}.experiment-v3 .truthful-progress__track{height:7px}.experiment-v3 .work-scope{color:rgb(var(--muted));margin:10px 0 16px;font-size:11px;line-height:1.7}.experiment-v3 .progress-metrics span{font-size:11px}.experiment-v3 .progress-metrics small{color:rgb(var(--muted));font-size:10px;line-height:1.6;display:block;overflow:visible}.work-item-group+.work-item-group{border-top:1px solid rgb(var(--border));margin-top:8px;padding-top:8px}.work-item-group h3{color:rgb(var(--muted));justify-content:space-between;margin:8px 9px;font-size:11px;font-weight:550;display:flex}.work-item-group h3 span{font-variant-numeric:tabular-nums}.work-item-group>button{text-align:left;background:0 0;border-radius:10px;grid-template-columns:30px minmax(0,1fr);gap:8px;width:100%;padding:11px 9px;display:grid}.work-item-group>button:hover,.work-item-group>button.is-active{background:rgb(var(--surface-2))}.experiment-v3 .work-item-group strong{font-size:12px;line-height:1.5}.experiment-v3 .work-item-group small{font-size:10px;line-height:1.5}.work-group-empty{color:rgb(var(--faint));margin:8px 9px 12px;font-size:11px}.work-conclusion>header{flex-wrap:wrap;gap:10px}.work-conclusion>header .badge{white-space:normal}.work-conclusion__body{padding:18px}.work-conclusion__body>p{color:rgb(var(--text));white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-size:13px;line-height:1.8}.work-conclusion__body>div{border-top:1px solid rgb(var(--border));margin-top:16px;padding-top:14px}.work-conclusion__body h3{color:rgb(var(--muted));margin:0 0 6px;font-size:11px;font-weight:650}.work-conclusion__body>div p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-size:12px;line-height:1.8}.experiment-v3 .work-conclusion__body>.work-scope{border-left:2px solid rgb(var(--border));margin:16px 0 0;padding-left:12px}.experiment-v3 .checkpoint strong{font-size:11px}.experiment-v3 .checkpoint p{font-size:10px;line-height:1.5}.experiment-v3 .selected-task-detail strong{font-size:12px}.experiment-v3 .selected-task-detail p{font-size:11px;line-height:1.7;display:block}.experiment-v3 .experiment-team p{white-space:normal;font-size:11px;line-height:1.6;overflow:visible}.experiment-v3 .experiment-team .work-team-note{margin:0;padding:14px 15px 6px}.experiment-v3 .experiment-team strong{font-size:12px}.experiment-v3 .estimate-note p{font-size:12px;line-height:1.7}.work-evidence-note{border-top:1px solid rgb(var(--border));color:rgb(var(--muted));grid-template-columns:16px minmax(0,1fr);align-items:start;gap:8px;padding-top:12px;font-size:11px;line-height:1.7;display:grid}.work-evidence-note>svg{margin-top:2px}.ide-context-strip{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:10px 10px 0 0;grid-template-columns:18px minmax(150px,240px) minmax(0,1fr) auto auto 28px;align-items:center;gap:8px;min-height:40px;margin-bottom:-1px;padding:5px 8px 5px 11px;display:grid}.ide-context-strip>svg{color:rgb(var(--muted))}.ide-context-strip select{background:0 0;border:0;outline:0;width:100%;font-size:10.5px;font-weight:620}.ide-context-strip code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.ide-context-strip small{color:rgb(var(--faint));font-family:var(--mono);font-size:8px}.ide-context-strip>button{background:rgb(var(--surface-2));width:27px;height:27px;color:rgb(var(--muted));border-radius:7px;place-items:center;display:grid}.ide-context-strip+.vscode-shell{border-radius:0 0 12px 12px}.repository-readiness{padding:11px}.repository-readiness h3{color:rgb(var(--vscode-text));margin:0 0 9px;font-size:11px}.repository-readiness dl{gap:5px;margin:0;display:grid}.repository-readiness dl>div{border:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-bg));border-radius:6px;grid-template-columns:110px minmax(0,1fr) 18px;align-items:center;gap:5px;padding:7px;display:grid}.repository-readiness dt{color:rgb(var(--vscode-muted));align-items:center;gap:5px;font-size:8.5px;display:flex}.repository-readiness dd{color:rgb(var(--vscode-text));font-family:var(--mono);text-overflow:ellipsis;white-space:pre-wrap;margin:0;font-size:7.8px;line-height:1.4;overflow:hidden}.repository-readiness i{border-radius:50%;place-items:center;width:17px;height:17px;font-style:normal;display:grid}.repository-readiness i.ok{background:rgb(var(--role-engineer) / .12);color:rgb(var(--role-engineer))}.repository-readiness i.missing{background:rgb(var(--role-reviewer) / .12);color:rgb(var(--role-reviewer))}.repository-readiness>p{border-top:1px solid rgb(var(--vscode-line));color:rgb(var(--vscode-muted));margin:10px 0 0;padding-top:9px;font-size:8.5px;line-height:1.5}.vscode-terminal>header>strong{color:rgb(var(--vscode-text));letter-spacing:.08em;font-size:8.5px}.paper-root-bar>div{min-width:0}.paper-root-bar select{background:0 0;border:0;outline:0;max-width:260px;margin-top:2px;font-size:10.5px;font-weight:620}.paper-root-bar code{color:rgb(var(--faint));font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;font-size:8px;overflow:hidden}.figure-loading{background:rgb(var(--surface-2));height:150px;color:rgb(var(--faint));place-items:center;font-size:9px;display:grid}.review-form-row{grid-template-columns:1fr 1fr;gap:8px;margin-top:11px;display:grid}.review-emphasis{border:1px solid rgb(var(--border));border-radius:10px;grid-template-columns:1fr 1fr;gap:5px;margin:11px 0;padding:10px;display:grid}.review-emphasis legend{color:rgb(var(--muted));padding:0 5px;font-size:10px;font-weight:620}.review-emphasis label{color:rgb(var(--muted));border-radius:7px;align-items:center;gap:5px;padding:4px 5px;font-size:8.5px;display:flex}.review-emphasis label:hover{background:rgb(var(--surface-2))}.review-emphasis input{accent-color:rgb(var(--blue))}.project-intake-start{align-items:center;gap:7px;display:flex}.project-intake-start select{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));border-radius:10px;outline:0;max-width:260px;height:42px;padding:0 9px;font-size:10px}.release-page{max-width:1280px;margin:0 auto}.release-hero{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:16px;grid-template-columns:58px minmax(0,1fr);align-items:center;gap:15px;padding:22px;display:grid}.release-hero>span{background:rgb(var(--surface-2));width:54px;height:54px;color:rgb(var(--text));border-radius:14px;place-items:center;display:grid}.release-hero h2{margin:3px 0 6px;font-size:21px}.release-hero p{max-width:780px;color:rgb(var(--muted));margin:0;font-size:11.5px;line-height:1.6}.release-module-grid{grid-template-columns:repeat(3,1fr);gap:12px;margin:14px 0;display:grid}.release-module{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:290px;box-shadow:var(--shadow-1);border-radius:15px;padding:17px}.release-module>header{justify-content:space-between;align-items:center;display:flex}.release-module header>span{background:rgb(var(--surface-2));width:42px;height:42px;color:rgb(var(--muted));border-radius:11px;place-items:center;display:grid}.release-module h3{margin:16px 0 6px;font-size:15px}.release-module>p{min-height:52px;color:rgb(var(--muted));margin:0;font-size:10.5px;line-height:1.55}.release-module ul{border-top:1px solid rgb(var(--border));gap:7px;margin:13px 0 0;padding:13px 0 0;list-style:none;display:grid}.release-module li{color:rgb(var(--muted));align-items:center;gap:6px;font-size:9.5px;display:flex}.release-module li svg{color:rgb(var(--green))}.release-flow{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:14px;grid-template-columns:1fr 20px 1fr 20px 1fr 20px 1fr;align-items:center;padding:12px;display:grid}.release-flow>div{border-radius:10px;grid-template-columns:32px minmax(0,1fr);gap:7px;padding:9px;display:grid}.release-flow>div>svg{color:rgb(var(--blue));grid-row:1/3;align-self:center}.release-flow strong{font-size:10px}.release-flow small{color:rgb(var(--faint));font-size:8px}.release-flow>b{color:rgb(var(--faint));text-align:center;font-weight:400}.release-boundary{border:1px solid rgb(var(--amber) / .22);background:rgb(var(--amber-bg));color:rgb(var(--amber));border-radius:12px;gap:9px;margin-top:12px;padding:12px;display:flex}.release-boundary strong{font-size:10.5px}.release-boundary p{margin:3px 0 0;font-size:9px;line-height:1.5}@media (width<=900px){.release-module-grid{grid-template-columns:1fr}.release-flow{grid-template-columns:1fr;gap:5px}.release-flow>b{transform:rotate(90deg)}.project-intake-start{flex-direction:column;align-items:stretch}.project-intake-start select{max-width:none}}@media (width<=640px){.ide-context-strip{grid-template-columns:18px minmax(0,1fr) auto 28px}.ide-context-strip code,.ide-context-strip small{display:none}.review-form-row,.review-emphasis,.release-hero{grid-template-columns:1fr}}@media (width<=1180px){.vscode-shell{grid-template-rows:minmax(0,1fr) 180px 340px 22px}.vscode-source-control{border-top:1px solid rgb(var(--vscode-line));border-left:0;grid-area:3/2/auto/4;display:flex}.vscode-statusbar{grid-row:4}}@media (width<=900px){.literature-v2__sidebar{display:block}.literature-v2__sidebar .library-tabs{grid-template-columns:repeat(4,1fr);gap:5px;display:grid}.literature-v2__sidebar .library-tabs button{justify-content:center;gap:7px}.literature-source-note{display:none}}@media (width<=640px){.literature-v2__sidebar .library-tabs{grid-template-columns:1fr 1fr}.vscode-source-control{min-height:420px}}@media (width<=900px){.copilot-v2{height:auto;min-height:100%;overflow:visible}.copilot-v2__layout{flex-direction:column;display:flex}.copilot-v2__thread{min-height:720px}.copilot-v2__aside{min-height:540px;display:block}}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.inset-y-1{top:.25rem;bottom:.25rem}.inset-y-2{top:.5rem;bottom:.5rem}.-bottom-2\.5{bottom:-.625rem}.-left-0\.5{left:-.125rem}.-top-1\.5{top:-.375rem}.-top-2\.5{top:-.625rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-4{left:1rem}.left-\[0\.6875rem\]{left:.6875rem}.left-\[10\%\]{left:10%}.left-\[5px\]{left:5px}.right-0\.5{right:.125rem}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-9{right:2.25rem}.right-\[10\%\]{right:10%}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-2{top:.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-6{top:1.5rem}.isolate{isolation:isolate}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[110\]{z-index:110}.z-\[70\]{z-index:70}.z-\[90\]{z-index:90}.order-2{order:2}.order-3{order:3}.m-1{margin:.25rem}.m-auto{margin:auto}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-1\.5{margin-top:.375rem;margin-bottom:.375rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-9{margin-top:2.25rem}.mt-\[7px\]{margin-top:7px}.mt-auto{margin-top:auto}.mt-px{margin-top:1px}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.flow-root{display:flow-root}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1\.4rem\]{height:1.4rem}.h-\[100dvh\]{height:100dvh}.h-\[68vh\]{height:68vh}.h-\[calc\(100\%-1rem\)\]{height:calc(100% - 1rem)}.h-\[min\(780px\,84dvh\)\]{height:min(780px,84dvh)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-72{max-height:18rem}.max-h-80{max-height:20rem}.max-h-\[100dvh\]{max-height:100dvh}.max-h-\[24vh\]{max-height:24vh}.max-h-\[30vh\]{max-height:30vh}.max-h-\[34rem\]{max-height:34rem}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[52vh\]{max-height:52vh}.max-h-\[600px\]{max-height:600px}.max-h-\[62vh\]{max-height:62vh}.max-h-\[64vh\]{max-height:64vh}.max-h-\[70dvh\]{max-height:70dvh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[72vh\]{max-height:72vh}.max-h-\[76vh\]{max-height:76vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[calc\(100dvh-1\.5rem\)\]{max-height:calc(100dvh - 1.5rem)}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-10{min-height:2.5rem}.min-h-11{min-height:2.75rem}.min-h-14{min-height:3.5rem}.min-h-40{min-height:10rem}.min-h-52{min-height:13rem}.min-h-64{min-height:16rem}.min-h-72{min-height:18rem}.min-h-\[209px\]{min-height:209px}.min-h-\[3\.25rem\]{min-height:3.25rem}.min-h-\[320px\]{min-height:320px}.min-h-\[34rem\]{min-height:34rem}.min-h-\[60vh\]{min-height:60vh}.min-h-dvh{min-height:100dvh}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:.125rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[1\.4rem\]{width:1.4rem}.w-\[min\(30rem\,calc\(100vw-2rem\)\)\]{width:min(30rem,100vw - 2rem)}.w-\[min\(92vw\,42rem\)\]{width:min(92vw,42rem)}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0}.min-w-28{min-width:7rem}.min-w-3\.5{min-width:.875rem}.min-w-32{min-width:8rem}.min-w-44{min-width:11rem}.min-w-52{min-width:13rem}.min-w-full{min-width:100%}.min-w-max{min-width:max-content}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-48{max-width:12rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-64{max-width:16rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[1600px\]{max-width:1600px}.max-w-\[260px\]{max-width:260px}.max-w-\[960px\]{max-width:960px}.max-w-\[calc\(100\%_-_3rem\)\]{max-width:calc(100% - 3rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.basis-full{flex-basis:100%}.table-fixed{table-layout:fixed}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x:-100%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate:-90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes appear{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.animate-appear{animation:.2s cubic-bezier(.4,0,.2,1) appear}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[16px_minmax\(0\,1fr\)\]{grid-template-columns:16px minmax(0,1fr)}.grid-cols-\[72px_minmax\(0\,1fr\)\]{grid-template-columns:72px minmax(0,1fr)}.grid-cols-\[84px_minmax\(0\,1fr\)_auto\]{grid-template-columns:84px minmax(0,1fr) auto}.grid-rows-\[1fr\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-1{row-gap:.25rem}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.justify-self-start{justify-self:start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overscroll-contain{overscroll-behavior:contain}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[18px\]{border-radius:18px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-xl{border-radius:.75rem}.rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.border-blue-deep{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.border-blue-deep\/30{border-color:rgb(var(--blue-deep) / .3)}.border-blue-deep\/50{border-color:rgb(var(--blue-deep) / .5)}.border-blue-deep\/60{border-color:rgb(var(--blue-deep) / .6)}.border-blue\/25{border-color:rgb(var(--blue) / .25)}.border-blue\/30{border-color:rgb(var(--blue) / .3)}.border-blue\/35{border-color:rgb(var(--blue) / .35)}.border-blue\/40{border-color:rgb(var(--blue) / .4)}.border-blue\/45{border-color:rgb(var(--blue) / .45)}.border-blue\/50{border-color:rgb(var(--blue) / .5)}.border-blue\/60{border-color:rgb(var(--blue) / .6)}.border-err{--tw-border-opacity:1;border-color:rgb(var(--err) / var(--tw-border-opacity,1))}.border-err\/30{border-color:rgb(var(--err) / .3)}.border-err\/35{border-color:rgb(var(--err) / .35)}.border-err\/40{border-color:rgb(var(--err) / .4)}.border-err\/50{border-color:rgb(var(--err) / .5)}.border-err\/60{border-color:rgb(var(--err) / .6)}.border-gold\/25{border-color:rgb(var(--gold) / .25)}.border-gold\/30{border-color:rgb(var(--gold) / .3)}.border-gold\/40{border-color:rgb(var(--gold) / .4)}.border-line{--tw-border-opacity:1;border-color:rgb(var(--line) / var(--tw-border-opacity,1))}.border-line\/40{border-color:rgb(var(--line) / .4)}.border-line\/50{border-color:rgb(var(--line) / .5)}.border-line\/60{border-color:rgb(var(--line) / .6)}.border-line\/70{border-color:rgb(var(--line) / .7)}.border-line\/80{border-color:rgb(var(--line) / .8)}.border-ok{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.border-ok\/20{border-color:rgb(var(--ok) / .2)}.border-ok\/30{border-color:rgb(var(--ok) / .3)}.border-ok\/35{border-color:rgb(var(--ok) / .35)}.border-ok\/40{border-color:rgb(var(--ok) / .4)}.border-ok\/45{border-color:rgb(var(--ok) / .45)}.border-ok\/60{border-color:rgb(var(--ok) / .6)}.border-panel{--tw-border-opacity:1;border-color:rgb(var(--panel) / var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-warn\/30{border-color:rgb(var(--warn) / .3)}.border-warn\/35{border-color:rgb(var(--warn) / .35)}.border-warn\/40{border-color:rgb(var(--warn) / .4)}.border-warn\/50{border-color:rgb(var(--warn) / .5)}.border-t-blue{--tw-border-opacity:1;border-top-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.bg-bg{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.bg-bg\/25{background-color:rgb(var(--bg) / .25)}.bg-bg\/30{background-color:rgb(var(--bg) / .3)}.bg-bg\/35{background-color:rgb(var(--bg) / .35)}.bg-bg\/40{background-color:rgb(var(--bg) / .4)}.bg-bg\/50{background-color:rgb(var(--bg) / .5)}.bg-bg\/60{background-color:rgb(var(--bg) / .6)}.bg-bg\/70{background-color:rgb(var(--bg) / .7)}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/20{background-color:#0003}.bg-black\/40{background-color:#0006}.bg-blue{--tw-bg-opacity:1;background-color:rgb(var(--blue) / var(--tw-bg-opacity,1))}.bg-blue-deep{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.bg-blue-deep\/10{background-color:rgb(var(--blue-deep) / .1)}.bg-blue-deep\/20{background-color:rgb(var(--blue-deep) / .2)}.bg-blue-deep\/5{background-color:rgb(var(--blue-deep) / .05)}.bg-blue-sky{--tw-bg-opacity:1;background-color:rgb(var(--blue-sky) / var(--tw-bg-opacity,1))}.bg-blue\/10{background-color:rgb(var(--blue) / .1)}.bg-blue\/5{background-color:rgb(var(--blue) / .05)}.bg-conversation-user{--tw-bg-opacity:1;background-color:rgb(var(--conversation-user) / var(--tw-bg-opacity,1))}.bg-emerald-500{--tw-bg-opacity:1;background-color:rgb(16 185 129/var(--tw-bg-opacity,1))}.bg-engineer{--tw-bg-opacity:1;background-color:rgb(var(--role-engineer) / var(--tw-bg-opacity,1))}.bg-err{--tw-bg-opacity:1;background-color:rgb(var(--err) / var(--tw-bg-opacity,1))}.bg-err\/10{background-color:rgb(var(--err) / .1)}.bg-err\/5{background-color:rgb(var(--err) / .05)}.bg-gold{--tw-bg-opacity:1;background-color:rgb(var(--gold) / var(--tw-bg-opacity,1))}.bg-gold\/5{background-color:rgb(var(--gold) / .05)}.bg-gold\/80{background-color:rgb(var(--gold) / .8)}.bg-ink{--tw-bg-opacity:1;background-color:rgb(var(--ink) / var(--tw-bg-opacity,1))}.bg-ink-faint{--tw-bg-opacity:1;background-color:rgb(var(--ink-faint) / var(--tw-bg-opacity,1))}.bg-ink-faint\/40{background-color:rgb(var(--ink-faint) / .4)}.bg-ink-faint\/45{background-color:rgb(var(--ink-faint) / .45)}.bg-ink-faint\/50{background-color:rgb(var(--ink-faint) / .5)}.bg-ink-faint\/60{background-color:rgb(var(--ink-faint) / .6)}.bg-line{--tw-bg-opacity:1;background-color:rgb(var(--line) / var(--tw-bg-opacity,1))}.bg-line\/30{background-color:rgb(var(--line) / .3)}.bg-line\/40{background-color:rgb(var(--line) / .4)}.bg-line\/55{background-color:rgb(var(--line) / .55)}.bg-line\/60{background-color:rgb(var(--line) / .6)}.bg-line\/70{background-color:rgb(var(--line) / .7)}.bg-line\/80{background-color:rgb(var(--line) / .8)}.bg-ok{--tw-bg-opacity:1;background-color:rgb(var(--ok) / var(--tw-bg-opacity,1))}.bg-ok\/10{background-color:rgb(var(--ok) / .1)}.bg-ok\/15{background-color:rgb(var(--ok) / .15)}.bg-ok\/5{background-color:rgb(var(--ok) / .05)}.bg-panel{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.bg-panel-raised{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.bg-panel\/80{background-color:rgb(var(--panel) / .8)}.bg-panel\/85{background-color:rgb(var(--panel) / .85)}.bg-panel\/95{background-color:rgb(var(--panel) / .95)}.bg-surface{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.bg-surface\/50{background-color:rgb(var(--surface) / .5)}.bg-surface\/60{background-color:rgb(var(--surface) / .6)}.bg-transparent{background-color:#0000}.bg-warn{--tw-bg-opacity:1;background-color:rgb(var(--warn) / var(--tw-bg-opacity,1))}.bg-warn\/10{background-color:rgb(var(--warn) / .1)}.bg-warn\/5{background-color:rgb(var(--warn) / .05)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-white\/\[0\.03\]{background-color:#ffffff08}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-px{padding-top:1px;padding-bottom:1px}.pb-1{padding-bottom:.25rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-0\.5{padding-left:.125rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-3\.5{padding-left:.875rem}.pl-4{padding-left:1rem}.pl-5{padding-left:1.25rem}.pl-7{padding-left:1.75rem}.pl-\[1\.125rem\]{padding-left:1.125rem}.pr-10{padding-right:2.5rem}.pr-14{padding-right:3.5rem}.pr-3{padding-right:.75rem}.pr-\[4\.75rem\]{padding-right:4.75rem}.pt-0\.5{padding-top:.125rem}.pt-1\.5{padding-top:.375rem}.pt-10{padding-top:2.5rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-7{padding-top:1.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace}.font-sans{font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.leading-\[1\.625\]{line-height:1.625}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-\[-0\.01em\]{letter-spacing:-.01em}.tracking-\[0\.06em\]{letter-spacing:.06em}.tracking-\[0\.08em\]{letter-spacing:.08em}.tracking-\[0\.12em\]{letter-spacing:.12em}.tracking-\[0\.14em\]{letter-spacing:.14em}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.16em\]{letter-spacing:.16em}.tracking-\[0\.18em\]{letter-spacing:.18em}.tracking-normal{letter-spacing:0}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-bg{--tw-text-opacity:1;color:rgb(var(--bg) / var(--tw-text-opacity,1))}.text-blue{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.text-blue-sky{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.text-blue\/75{color:rgb(var(--blue) / .75)}.text-err{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.text-err\/80{color:rgb(var(--err) / .8)}.text-gold{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.text-ink{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.text-ink-dim{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.text-ink-faint{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.text-manager{--tw-text-opacity:1;color:rgb(var(--role-manager) / var(--tw-text-opacity,1))}.text-ok{--tw-text-opacity:1;color:rgb(var(--ok) / var(--tw-text-opacity,1))}.text-surface{--tw-text-opacity:1;color:rgb(var(--surface) / var(--tw-text-opacity,1))}.text-warn{--tw-text-opacity:1;color:rgb(var(--warn) / var(--tw-text-opacity,1))}.text-warn\/80{color:rgb(var(--warn) / .8)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-blue\/35{-webkit-text-decoration-color:rgb(var(--blue) / .35);text-decoration-color:rgb(var(--blue) / .35)}.decoration-line{-webkit-text-decoration-color:rgb(var(--line) / 1);text-decoration-color:rgb(var(--line) / 1)}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.accent-blue{accent-color:rgb(var(--blue) / 1)}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-\[0_10px_24px_-20px_rgb\(0_0_0\/0\.2\)\]{--tw-shadow:0 10px 24px -20px #0003;--tw-shadow-colored:0 10px 24px -20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-glow{--tw-shadow:0 16px 44px #00000057;--tw-shadow-colored:0 16px 44px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-4{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-bg{--tw-ring-opacity:1;--tw-ring-color:rgb(var(--bg) / var(--tw-ring-opacity,1))}.ring-err\/30{--tw-ring-color:rgb(var(--err) / .3)}.ring-line\/35{--tw-ring-color:rgb(var(--line) / .35)}.ring-manager\/60{--tw-ring-color:rgb(var(--role-manager) / .6)}.ring-ok\/30{--tw-ring-color:rgb(var(--ok) / .3)}.ring-offset-1{--tw-ring-offset-width:1px}.ring-offset-panel{--tw-ring-offset-color:rgb(var(--panel) / 1)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\!filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\,transform\,visibility\]{transition-property:width,transform,visibility;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-shadow{transition-property:box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-500{transition-duration:.5s}.duration-panel{transition-duration:.22s}.ease-panel{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes prompt-optimizer-enter{0%{opacity:0;transform:translateY(8px)scale(.992)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes livePulse{0%,to{box-shadow:0 0 0 0 rgb(var(--green) / .25)}50%{box-shadow:0 0 0 5px rgb(var(--green) / 0)}}@keyframes blink{50%{opacity:.35}}@keyframes skeleton{to{background-position:-120% 0}}@keyframes popoverIn{0%{opacity:0;transform:translateY(-5px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}.integrated-workbench .literature-v2__sidebar .search-field{width:calc(100% - 24px);min-width:0;max-width:none}.integrated-workbench .literature-v2__main{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:16px;padding:16px;overflow:hidden}.integrated-workbench .literature-list-header{border-bottom:1px solid rgb(var(--border));min-height:0;margin-bottom:14px;padding-bottom:14px}.integrated-workbench .paper-grid{gap:14px}.integrated-workbench button.paper-card{border-color:rgb(var(--border-strong));background:rgb(var(--surface-2) / .42);width:100%;min-width:0;min-height:242px;box-shadow:none;padding:17px;overflow:hidden}.integrated-workbench .paper-card__meta{flex-wrap:wrap;align-items:flex-start;min-width:0}.integrated-workbench .paper-card__year{text-overflow:ellipsis;white-space:nowrap;min-width:0;margin-left:auto;overflow:hidden}.integrated-workbench .paper-card__footer{min-width:0}.integrated-workbench .paper-card__footer>span{white-space:nowrap;flex:none}.integrated-workbench .release-module>header .badge{flex-shrink:0}@container (width<=700px){.integrated-workbench .literature-v2__main{padding:12px}.integrated-workbench .literature-list-header{margin-bottom:12px;padding-bottom:12px}.integrated-workbench button.paper-card{min-height:0;padding:15px}}.overview-hero--plain{grid-template-columns:1fr}.overview-hero--plain .overview-hero__copy h1{margin-top:0}.overview-hero--plain .overview-hero__copy p{-webkit-line-clamp:unset;max-width:none;font-size:14px;line-height:1.7;display:block}.overview-hero--plain .overview-hero__copy>code{text-overflow:ellipsis;white-space:nowrap;font-size:11px;display:block;overflow:hidden}.placeholder\:text-ink-faint::placeholder{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}.last\:border-0:last-child{border-width:0}.last\:border-b-0:last-child{border-bottom-width:0}.last\:pb-0:last-child{padding-bottom:0}.focus-within\:border-blue\/60:focus-within{border-color:rgb(var(--blue) / .6)}.hover\:border-blue:hover{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.hover\:border-blue-deep:hover{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.hover\:border-blue-sky\/60:hover{border-color:rgb(var(--blue-sky) / .6)}.hover\:border-blue\/40:hover{border-color:rgb(var(--blue) / .4)}.hover\:border-blue\/45:hover{border-color:rgb(var(--blue) / .45)}.hover\:border-blue\/50:hover{border-color:rgb(var(--blue) / .5)}.hover\:border-blue\/60:hover{border-color:rgb(var(--blue) / .6)}.hover\:border-err\/50:hover{border-color:rgb(var(--err) / .5)}.hover\:border-ink-faint:hover{--tw-border-opacity:1;border-color:rgb(var(--ink-faint) / var(--tw-border-opacity,1))}.hover\:border-line\/70:hover{border-color:rgb(var(--line) / .7)}.hover\:border-ok:hover{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.hover\:bg-bg:hover{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.hover\:bg-bg\/30:hover{background-color:rgb(var(--bg) / .3)}.hover\:bg-bg\/60:hover{background-color:rgb(var(--bg) / .6)}.hover\:bg-bg\/70:hover{background-color:rgb(var(--bg) / .7)}.hover\:bg-blue-deep:hover{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.hover\:bg-blue-deep\/20:hover{background-color:rgb(var(--blue-deep) / .2)}.hover\:bg-blue-deep\/80:hover{background-color:rgb(var(--blue-deep) / .8)}.hover\:bg-blue\/10:hover{background-color:rgb(var(--blue) / .1)}.hover\:bg-blue\/15:hover{background-color:rgb(var(--blue) / .15)}.hover\:bg-err\/10:hover{background-color:rgb(var(--err) / .1)}.hover\:bg-line\/20:hover{background-color:rgb(var(--line) / .2)}.hover\:bg-ok\/10:hover{background-color:rgb(var(--ok) / .1)}.hover\:bg-ok\/15:hover{background-color:rgb(var(--ok) / .15)}.hover\:bg-panel:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.hover\:bg-panel-raised:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.hover\:bg-panel\/60:hover{background-color:rgb(var(--panel) / .6)}.hover\:bg-panel\/80:hover{background-color:rgb(var(--panel) / .8)}.hover\:bg-surface:hover{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.hover\:bg-warn\/10:hover{background-color:rgb(var(--warn) / .1)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-blue:hover{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.hover\:text-blue-sky:hover{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.hover\:text-err:hover{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.hover\:text-gold:hover{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.hover\:text-gold-soft:hover{--tw-text-opacity:1;color:rgb(var(--gold-soft) / var(--tw-text-opacity,1))}.hover\:text-ink:hover{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.hover\:text-ink-dim:hover{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-blue:hover{-webkit-text-decoration-color:rgb(var(--blue) / 1);text-decoration-color:rgb(var(--blue) / 1)}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.focus\:border-blue:focus{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.focus\:border-blue-deep:focus{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.focus\:border-blue\/60:focus,.focus-visible\:border-blue\/60:focus-visible{border-color:rgb(var(--blue) / .6)}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-blue:focus-visible{outline-color:rgb(var(--blue) / 1)}.focus-visible\:outline-blue-sky:focus-visible{outline-color:rgb(var(--blue-sky) / 1)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-blue-sky\/50:focus-visible{--tw-ring-color:rgb(var(--blue-sky) / .5)}.focus-visible\:ring-blue\/50:focus-visible{--tw-ring-color:rgb(var(--blue) / .5)}.active\:bg-panel-raised:active{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.enabled\:hover\:text-blue-sky:hover:enabled{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.enabled\:focus-visible\:underline:focus-visible:enabled{text-decoration-line:underline}.enabled\:focus-visible\:outline-none:focus-visible:enabled{outline-offset:2px;outline:2px solid #0000}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-35:disabled{opacity:.35}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-45:disabled{opacity:.45}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group:focus-within .group-focus-within\:opacity-100{opacity:1}.group:hover .group-hover\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}.group:hover .group-hover\:bg-ink-faint\/30{background-color:rgb(var(--ink-faint) / .3)}.group:hover .group-hover\:opacity-100{opacity:1}.group:focus .group-focus\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}@media (prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media (width>=640px){.sm\:left-auto{left:auto}.sm\:order-none{order:0}.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mx-8{margin-left:2rem;margin-right:2rem}.sm\:inline{display:inline}.sm\:h-20{height:5rem}.sm\:max-h-\[88dvh\]{max-height:88dvh}.sm\:w-20{width:5rem}.sm\:w-auto{width:auto}.sm\:max-w-48{max-width:12rem}.sm\:max-w-\[82\%\]{max-width:82%}.sm\:max-w-md{max-width:28rem}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-\[100px_minmax\(0\,1fr\)\]{grid-template-columns:100px minmax(0,1fr)}.sm\:grid-cols-\[minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) auto}.sm\:grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.sm\:flex-nowrap{flex-wrap:nowrap}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-5{padding:1.25rem}.sm\:p-6{padding:1.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-5{padding-left:1.25rem;padding-right:1.25rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:px-8{padding-left:2rem;padding-right:2rem}.sm\:pt-14{padding-top:3.5rem}.sm\:text-right{text-align:right}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:opacity-0{opacity:0}.group:focus-within .sm\:group-focus-within\:opacity-100,.group:hover .sm\:group-hover\:opacity-100{opacity:1}}@media (width>=768px){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-80{width:20rem}.md\:shrink-0{flex-shrink:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:border-r{border-right-width:1px}.md\:border-line\/60{border-color:rgb(var(--line) / .6)}}@media (width>=1024px){.lg\:visible{visibility:visible}.lg\:static{position:static}.lg\:z-auto{z-index:auto}.lg\:col-span-2{grid-column:span 2/span 2}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:min-h-0{min-height:0}.lg\:w-\[var\(--preview-width\)\]{width:var(--preview-width)}.lg\:w-\[var\(--sidebar-width\,256px\)\]{width:var(--sidebar-width,256px)}.lg\:max-w-\[61\.8vw\]{max-width:61.8vw}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-\[280px_minmax\(0\,1fr\)\]{grid-template-columns:280px minmax(0,1fr)}.lg\:grid-cols-\[minmax\(0\,1\.15fr\)_minmax\(260px\,0\.85fr\)\]{grid-template-columns:minmax(0,1.15fr) minmax(260px,.85fr)}.lg\:grid-cols-\[minmax\(0\,1\.4fr\)_minmax\(300px\,0\.8fr\)\]{grid-template-columns:minmax(0,1.4fr) minmax(300px,.8fr)}.lg\:grid-cols-\[minmax\(15rem\,0\.72fr\)_minmax\(0\,1\.8fr\)\]{grid-template-columns:minmax(15rem,.72fr) minmax(0,1.8fr)}.lg\:gap-3{gap:.75rem}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:border-b-0{border-bottom-width:0}.lg\:border-r{border-right-width:1px}}@media (width>=1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,1fr\)_minmax\(18rem\,0\.85fr\)\]{grid-template-columns:minmax(0,1fr) minmax(18rem,.85fr)}.xl\:border-b-0{border-bottom-width:0}.xl\:border-r{border-right-width:1px}}.\[\&\>section\>div\>button\:first-child\]\:px-3>section>div>button:first-child{padding-left:.75rem;padding-right:.75rem}.\[\&\>section\]\:mx-2>section{margin-left:.5rem;margin-right:.5rem}.\[\&\>section\]\:border-0>section{border-width:0}.\[\&\>section\]\:py-0>section{padding-top:0;padding-bottom:0} diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-Bg_Dyv6Z.js b/frontend/web/dist/assets/ResearchWorkbenchPanel-Bg_Dyv6Z.js new file mode 100644 index 000000000..b9a84fef3 --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-Bg_Dyv6Z.js @@ -0,0 +1,12 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i,n as a}from"./query-CUzIxVzm.js";import{C as o,F as s,H as c,I as l,L as u,O as d,U as f,k as p}from"./index-Cb5-aRKO.js";import{A as m,C as h,F as g,I as _,L as v,M as y,O as b,R as x,S,_ as C,b as w,n as T,s as E,w as D,x as O}from"./AppearanceControls-BNJdEiGG.js";import{n as k,t as A}from"./code-xml-C6UZnqwl.js";import{n as j,t as M}from"./play-CBzqX6Qi.js";import{a as ee,i as N}from"./useWorkbenchTheme-Bu46ZOFm.js";import{At as te,Dt as ne,Mt as re,Nt as P,Tt as F,W as ie,_ as ae,_t as oe,bt as se,g as ce,h as le,ht as ue,m as de,mt as fe,pt as pe,r as me,v as he,xt as ge,y as _e,yt as ve}from"./App-D406npOP.js";var ye=x(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),be=x(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),xe=x(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Se=x(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Ce=x(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),we=x(`FlaskConical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Te=x(`FolderKanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),Ee=x(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),De=x(`LockKeyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Oe=x(`Radio`,[[`path`,{d:`M4.9 19.1C1 15.2 1 8.8 4.9 4.9`,key:`1vaf9d`}],[`path`,{d:`M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5`,key:`u1ii0m`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5`,key:`1j5fej`}],[`path`,{d:`M19.1 4.9C23 8.8 23 15.1 19.1 19`,key:`10b0cb`}]]),ke=x(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ae=x(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),je=x(`UserRound`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Me=x(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),I=e(t(),1),Ne=12e3;function L(e=!1){let t={...s()};return e&&(t[`Content-Type`]=`application/json`),t}async function R(e,t={}){await u();let n={...t,headers:{...L(!!t.body),...t.headers??{}},cache:`no-store`},r=String(t.method??`GET`).toUpperCase(),i=async n=>{if(!n.ok){let r=await n.text().catch(()=>``),i=r;try{i=JSON.parse(r).detail??r}catch{}throw Error(i||`${t.method??`GET`} ${e} failed (${n.status})`)}return await n.json()};return r===`GET`?c(e,n,Ne,i):i(await fetch(e,n))}var z=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`,Pe=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`;function Fe(e){let t=e.replaceAll(`\r +`,` +`).split(` + +`),n=t.pop()??``,r=[];return t.forEach(e=>{e.split(` +`).forEach(e=>{if(e.startsWith(`data:`))try{let t=JSON.parse(e.slice(5).trim());r.push(t)}catch{}})}),{frames:r,rest:n}}function Ie(e,t){let n=String(e.type??``);if(n===`phase`)t.onPhase?.(String(e.label??``),String(e.role??`manager`),String(e.detail??``),e.heartbeat===!0);else if(n===`delta`)t.onDelta?.(String(e.text??``),String(e.fragment_mode??`auto`));else if(n===`done`){let n=e.result??{};return t.onDone?.(n),n}else if(n===`error`)throw Error(String(e.error??`Manager stream failed`));return null}var B={timelineExample:()=>R(`/api/research/timeline/example`),timelineEstimate:(e,t)=>R(`/api/research/timeline/estimate`,{method:`POST`,body:JSON.stringify(e),signal:t}),timelineLatest:e=>R(z(e,`/research/timeline`)),timelineSave:(e,t,n,r)=>R(z(e,`/research/timeline`),{method:`POST`,body:JSON.stringify({input:t,expected_version:n,reason:r})}),projects:e=>R(`/api/projects`,{signal:e}),snapshot:(e,t)=>R(z(e,`/snapshot?events_limit=40&compact=false`),{signal:t}),status:(e,t)=>R(z(e,`/status`),{signal:t}),events:(e,t=180,n)=>R(z(e,`/events?limit=${t}&view=ui`),{signal:n}).then(e=>e.events),transcript:(e,t=100,n)=>R(z(e,`/transcript?n=${t}`),{signal:n}).then(e=>e.turns),journal:(e,t=80,n)=>R(z(e,`/journal?n=${t}`),{signal:n}).then(e=>e.journal),artifacts:(e,t)=>R(z(e,`/artifacts`),{signal:t}).then(e=>e.artifacts),counterexamples:(e,t)=>R(z(e,`/counterexamples`),{signal:t}),artifact:(e,t,n)=>R(z(e,`/artifact?${new URLSearchParams({path:t})}`),{signal:n}),artifactBlob:async(e,t,n=!1,r)=>{await u();let i=new URLSearchParams({path:t});n&&i.set(`download`,`true`);let a=z(e,`/artifact/raw?${i}`);return c(a,{headers:L(),signal:r,cache:`no-store`},Ne,async e=>{if(!e.ok)throw Error(`Artifact unavailable (${e.status})`);return e.blob()})},gitDiff:(e,t)=>R(z(e,`/git-diff`),{signal:t}),rewritePrompt:(e,t,n)=>R(z(e,`/prompt/rewrite`),{method:`POST`,body:JSON.stringify({text:t}),signal:n}),note:(e,t)=>R(z(e,`/note`),{method:`POST`,body:JSON.stringify({text:t})}),uploadAttachments:async(e,t,n)=>{await u();let r=new FormData;t.forEach(e=>r.append(`files`,e,e.name));let i=await fetch(z(e,`/attachments`),{method:`POST`,headers:L(),body:r,signal:n});if(!i.ok)throw Error(await i.text()||`attachment upload failed (${i.status})`);return await i.json()},createDaemon:(e,t=``,n=``)=>R(`/api/daemons`,{method:`POST`,body:JSON.stringify({objective:e,name:t,workdir:n,command_id:Pe()})}),createFinalReview:(e,t)=>R(z(e,`/reviews/final`),{method:`POST`,body:JSON.stringify(t)}),startDaemon:(e,t)=>R(z(e,`/daemon/start`),{method:`POST`,body:JSON.stringify({command_id:Pe(),expected_revision:t})}).then(f),stopDaemon:(e,t,n)=>R(z(e,`/daemon/stop`),{method:`POST`,body:JSON.stringify({drain:t,command_id:Pe(),expected_revision:n})}).then(f),async messageStream(e,t,n={},r,i=[]){await u();let a=z(e,`/message/stream`),o=await fetch(a,{method:`POST`,headers:L(!0),body:JSON.stringify(i.length?{text:t,attachments:i}:{text:t}),signal:r});if(!o.ok){let e=await o.text().catch(()=>``);throw Error(e||`Manager request failed (${o.status})`)}if(!o.body)throw Error(`Manager returned an empty stream`);let s=o.body.getReader(),c=new TextDecoder,l=``,d={};for(;;){let e=await s.read();if(e.done)break;l+=c.decode(e.value,{stream:!0});let t=Fe(l);l=t.rest,t.frames.forEach(e=>{let t=Ie(e,n);t&&(d=t)})}return Fe(`${l}\n\n`).frames.forEach(e=>{let t=Ie(e,n);t&&(d=t)}),d}};function Le(e,t,n){let r=!1,i=null,a,o=800,s=()=>{if(r)return;let c=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({replay:`40`,view:`ui`}),d=l();d&&u.set(`token`,d),i=new WebSocket(`${c}//${window.location.host}${z(e,`/stream`)}?${u}`),i.onopen=()=>{o=800,n(!0)},i.onmessage=e=>{try{t(JSON.parse(String(e.data)))}catch{}},i.onerror=()=>i?.close(),i.onclose=e=>{n(!1),!(r||e.code===4401||e.code===4404)&&(a=window.setTimeout(s,o),o=Math.min(o*1.7,8e3))}};return s(),{close:()=>{r=!0,a&&window.clearTimeout(a),i?.close()}}}var Re={active:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],running:[`进行中`,`In progress`],working:[`进行中`,`In progress`],pending:[`等待中`,`Waiting`],queued:[`等待中`,`Waiting`],waiting:[`等待中`,`Waiting`],idle:[`等待中`,`Waiting`],accepted:[`已完成`,`Completed`],complete:[`已完成`,`Completed`],completed:[`已完成`,`Completed`],done:[`已完成`,`Completed`],success:[`已完成`,`Completed`],blocked:[`已阻塞`,`Blocked`],failed:[`失败`,`Failed`],error:[`失败`,`Failed`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],replan_requested:[`需要重新规划`,`Needs replanning`],incomplete:[`尚未完成`,`Incomplete`],research_incomplete:[`研究尚未完成`,`Research incomplete`],paused_no_breakthrough:[`暂未取得突破,已暂停`,`Paused without a breakthrough`],exhausted_current_methods:[`当前方法已尝试完`,`Current methods exhausted`],no_progress:[`暂无新进展,已暂停`,`Paused without new progress`],max_rounds:[`已到本次轮次上限`,`Round limit reached`],infra_blocked:[`等待运行条件恢复`,`Waiting for the runtime to recover`],supervisor_error:[`执行异常`,`Execution failed`],skipped:[`已跳过`,`Skipped`],paused:[`已暂停`,`Paused`],paused_cost:[`费用待对账`,`Awaiting usage reconciliation`],stopped:[`已暂停`,`Paused`],cancelled:[`已暂停`,`Paused`],aborted:[`已暂停`,`Paused`],not_started:[`等待中`,`Waiting`],healthy:[`状态正常`,`Healthy`],degraded:[`部分受限`,`Limited`]},ze={system:[`Argus`,`Argus`],operator:[`你`,`You`],stopped:[`已暂停`,`Paused`],idle:[`等待中`,`Waiting`]};function Be(e,t,n,r){let i=t[String(e??``).toLowerCase()]??n;return r(i[0],i[1])}function Ve(e,t){return String(e??``).startsWith(`paused_`)&&!Re[String(e)]?t(`已暂停`,`Paused`):Be(e,Re,[`状态已更新`,`Status updated`],t)}function V(e,t){let n=String(e??``).toLowerCase();return D(n)?h(n,e=>t(d(e,{},`zh-CN`),d(e,{},`en`))):Be(e,ze,[`Argus`,`Argus`],t)}function H(){let{locale:e,t}=p();return{locale:e,text:(0,I.useCallback)((t,n)=>e===`zh-CN`?t:n,[e]),t}}function He(...e){return e.filter(Boolean).join(` `)}function Ue(e){let t=Math.max(0,Math.floor(Number(e??0)));if(t<60)return`${t}s`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n?`${n}d ${r}h`:r?`${r}h ${i}m`:`${i}m`}function We(e,t){return e?new Date(e*1e3).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):`—`}function Ge(e){let t=String(e??``).toLowerCase();return/failed|error|blocked|rejected|stalled|dead|abort/.test(t)?`danger`:/warn|waiting|paused|hold|queued|pending|continue/.test(t)?`warn`:/done|complete|completed|accepted|healthy|success|passed/.test(t)?`success`:/run|active|work|claimed|progress|live/.test(t)?`live`:/research|plan|info|ready/.test(t)?`info`:`neutral`}function Ke(e){let t=String(e.agent_layer??e.actor??``).toLowerCase();if(t===`main`||t.startsWith(`engineer`))return`engineer`;if(t.startsWith(`review`))return`reviewer`;if(t.startsWith(`plan`))return`planner`;if(t.startsWith(`manager`))return`manager`;let n=String(e.type??``);return/review/.test(n)?`reviewer`:/planner/.test(n)?`planner`:/manager/.test(n)?`manager`:/engineer|round/.test(n)?`engineer`:`system`}function qe(e,t){let n=String(e.action_summary??``).trim();if(n)return t?_e(n,t):n;let r=String(e.title??``).trim();if(r)return t?_e(r,t):r;let i=t?ae(String(e.type??``),t):null;if(i)return i;let a=String(e.kind??``).trim();return a?a.replaceAll(`_`,` `):String(e.type??`event`).split(`.`).slice(-2).join(` · `).replaceAll(`_`,` `)}function Je(e,t=400){let n=String(e.text??e.reason??e.summary??e.detail??``).trim();return n?n.length>t?`${n.slice(0,t)}…`:n:``}var U=n();function W({children:e,tone:t=`neutral`,dot:n=!1,className:r}){return(0,U.jsxs)(`span`,{className:He(`badge`,`badge--${t}`,r),children:[n?(0,U.jsx)(`span`,{className:He(`badge__dot`,t===`live`&&`is-pulsing`)}):null,e]})}function G({icon:e=Se,title:t,description:n,action:r}){return(0,U.jsxs)(`div`,{className:`empty-state`,children:[(0,U.jsx)(`span`,{className:`empty-state__icon`,children:(0,U.jsx)(e,{size:19})}),(0,U.jsx)(`div`,{className:`empty-state__title`,children:t}),n?(0,U.jsx)(`p`,{children:n}):null,r?(0,U.jsx)(`div`,{className:`empty-state__action`,children:r}):null]})}function Ye({label:e}){let{text:t}=H();return(0,U.jsxs)(`span`,{className:`spinner`,role:`status`,children:[(0,U.jsx)(F,{size:15,className:`spin`}),` `,e||t(`加载中`,`Loading`)]})}function Xe({events:e,limit:t=24,empty:n,dense:r=!1}){let{locale:i,text:a}=H(),o=e.slice(-t).reverse();return o.length?(0,U.jsx)(`div`,{className:He(`event-list`,r&&`event-list--dense`),children:o.map((e,t)=>{let n=Ke(e),o=qe(e,i),s=ce(Je(e,r?180:480),i).text,c=Ge(String(e.status??e.kind??e.type??``));return(0,U.jsxs)(`article`,{className:`event-row`,children:[(0,U.jsx)(`div`,{className:He(`event-row__marker`,`event-row__marker--${c}`)}),(0,U.jsxs)(`div`,{className:`event-row__content`,children:[(0,U.jsxs)(`div`,{className:`event-row__meta`,children:[(0,U.jsx)(`span`,{className:`role-label`,style:{color:O(n)},children:V(n,a)}),(0,U.jsx)(`time`,{children:We(e.ts,i)})]}),(0,U.jsx)(`div`,{className:`event-row__title`,children:o}),s?(0,U.jsx)(`div`,{className:`event-row__detail`,children:s}):null]})]},`${e.type}-${e.ts}-${e.message_id??t}`)})}):(0,U.jsx)(G,{icon:Oe,title:n||a(`还没有可展示的实时动态`,`No activity to show yet`)})}var Ze=new Set([`done`,`completed`,`accepted`,`success`]),Qe=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]),$e=/continue|replan|reject|blocked|fail|error|incomplete|revoked/,et=new Set([`assistant_message`,`agent_message`,`message`]),tt=new Set([`life.planner.task_added`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.phase.started`,`life.manager.stage_decision`,`round.start`,`round.main.completed`,`round.review.started`,`round.review.completed`,`round.review.deferred`,`round.backend_failure.backoff`,`work.segment`,`work.segment.started`,`work.segment.completed`]);function nt(e){let t=String(e.type??``),n=String(e.kind??``);return n!==`reasoning`&&!o(e)&&(tt.has(t)||t===`engineer.progress`&&(et.has(n)||[`tool_use`,`tool_result`,`command_execution`,`file_change`].includes(n)))}function rt(e){return e.type!==`engineer.progress`||!et.has(String(e.kind??``))?e:{...e,text:ie(String(e.text??``)),action_summary:ie(String(e.action_summary??``)),title:ie(String(e.title??``))}}function it(e,t){return t?e.backlog.find(e=>e.id===t)??null:e.backlog.find(e=>Qe.has(e.status))??e.backlog.find(e=>e.status===`pending`)??e.backlog.at(-1)??null}function K(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function at(e,t,n=Date.now()/1e3,r=`zh-CN`){let i=(e,t)=>r===`zh-CN`?e:t,a=e.mission_view,o=pe(e,a,t,n),s=it(e,o.taskId||a?.mission.id||``),c=s?.id||a?.mission.id||``,l=!!(c&&c===a?.mission.id),u=a?.dag?.length?a.dag:e.backlog,d=u.filter(e=>Ze.has(e.status)).length,f=u.filter(e=>/^(pending|queued|waiting)$/.test(e.status)).length,p=!!(a?.routing?.open_ended||a?.routing?.lifetime===`standing`||e.continuous?.open_ended),m=K(s?.started_ts)??(l?K(a?.mission.started_at):null),h=K(s?.finished_ts)??(l?K(a?.mission.completed_at):null),g=e.backlog.filter(e=>Qe.has(e.status)).length>1,_=t.filter(e=>{if(!c||m!==null&&Number(e.ts??0)Number(e.ts??0)-Number(t.ts??0)),v=_.filter(nt).map(rt).filter(e=>!et.has(String(e.kind??``))||!!(e.text||e.action_summary||e.title)),y=v.at(-1),b=o.state===`running`,x=h??(e.daemon.alive?n:K(_.at(-1)?.ts)??m),S=m===null||x===null?null:Math.max(0,x-m),C=[..._].reverse().find(e=>fe(e)===c&&e.type===`round.start`),w=Math.max(l?Number(a?.round.current??0):0,Number(C?.round_index??0)),T=[..._].reverse().find(e=>fe(e)===c&&e.type===`round.start`&&Number(e.round_index)===w),E=_.filter(e=>{if(fe(e)!==c||w<=0||T&&Number(e.ts??0)0?t===w:T!=null&&Number(e.ts??0)>=Number(T.ts??0)}),D=[...E].reverse().find(e=>e.type===`round.review.completed`),O=[...E].reverse().find(e=>e.type===`round.review.started`),k=!!(O&&(!D||Number(O.ts)>Number(D.ts))),A=b&&o.role===`reviewer`&&k,j=k?void 0:D,M=String(j?.status??``).toLowerCase(),ee=l?String(a?.review.status??``).toLowerCase():``,N=j?.review_skipped===!0||M===`skipped`,te=j?.review_source===`engineer_self_review`,ne=!j?.review_source||j.review_source===`reviewer`,re=!N&&ne&&M===`done`,P=!N&&($e.test(M)||!j&&!A&&$e.test(ee)),F=A?`running`:N?`skipped`:re?`passed`:te&&M===`done`?`self_checked`:P?`needs_work`:`pending`,ie={pending:i(`结论待核对`,`Conclusion awaiting review`),running:i(`正在核对证据`,`Checking the evidence`),passed:i(`本轮工作通过核对`,`This round passed review`),needs_work:i(`仍需补充或修改`,`More work is needed`),skipped:i(`本轮未做审查`,`This round was not reviewed`),self_checked:i(`执行者已自查,待独立核对`,`Self-checked; independent review pending`)},ae={pending:i(`尚无能对应到当前工作项和轮次的通过记录。`,`No passing review is linked to the current work item and round.`),running:i(`审阅者正在核对本轮结果及其证据。`,`The Reviewer is checking this round’s results and evidence.`),passed:i(`通过记录仅适用于本轮提交的工作与证据。`,`The passing verdict applies to the work and evidence submitted in this round.`),needs_work:i(`审查发现仍有待处理的问题,需要继续工作。`,`The review found issues that require further work.`),skipped:i(`执行结束并不代表证据已经通过核对。`,`The end of execution does not establish that the evidence passed review.`),self_checked:i(`这条记录来自执行者自查,尚无本轮独立审查通过记录。`,`This record is a self-check by the worker; no independent passing review is recorded for this round.`)},oe={state:F,label:ie[F],detail:String(j?.reason||P&&a?.review.reason||ae[F]),scope:i(`当前工作项${w>0?` · 第 ${w} 轮`:``}。整体目标是否成立,仍须核对其完整验收条件。`,`Current work item${w>0?` · Round ${w}`:``}. The overall goal still requires checking its full acceptance criteria.`)},se=[...E].reverse().find(e=>e.type===`round.main.completed`),ce=F===`passed`?`done`:F===`running`?`active`:F===`needs_work`?`blocked`:`pending`,le=[{id:`plan`,label:i(`工作项已记录`,`Work item recorded`),detail:s?.title||a?.mission.title||i(`等待任务`,`Waiting for a task`),status:s||l?`done`:`pending`},{id:`start`,label:i(`开始执行`,`Execution started`),detail:m===null?i(`尚无启动记录`,`No start is recorded`):i(`有任务启动时间记录`,`A task start time is recorded`),status:m===null?`pending`:`done`},{id:`handoff`,label:i(`本轮执行已结束`,`Round execution ended`),detail:se?i(`已记录本轮执行结束,结果是否可用仍需核对`,`The round’s execution ended; its results still need to be checked`):i(`尚无本轮执行结束记录`,`No end of execution is recorded for this round`),status:se?`done`:b&&o.role===`engineer`?`active`:`pending`},{id:`review`,label:i(`核对本轮证据`,`Check this round’s evidence`),detail:oe.label,status:ce}],de=!!(s&&Ze.has(s.status))||l&&[`complete`,`completed`,`done`].includes(a?.mission.status??``),me=e.daemon.alive?p?i(`开放研究的剩余工作量尚不确定,无法可靠预计整体完成时间。`,`Open research has no known remaining workload, so its overall finish time cannot be reliably estimated.`):P?i(`审查要求继续补充或调整工作范围,暂无法预计完成时间。`,`Review requires further work or a scope change; a finish time is unavailable.`):de?i(`当前工作项已结束;这不提供整体目标的完成时间。`,`The current work item has ended; this does not establish when the overall goal will be reached.`):i(`当前记录没有可比较的固定工作量基线,暂无法可靠预计完成时间。`,`The current records contain no comparable, fixed-workload baseline for a reliable finish-time estimate.`):i(`运行已停止,无法预计完成时间。`,`Execution has stopped; a finish time is unavailable.`);return{workCompletion:u.length?d/u.length:null,workScope:i(`仅统计已记录的工作项;清单可随研究增减,完成比例不代表整体目标已成立。`,`Counts recorded work items only. The list can change during research; its completion fraction does not establish the overall goal.`),currentTask:s?.title||a?.mission.title||i(`等待新任务`,`Waiting for a new task`),currentTaskId:c,currentObjective:s?.objective||(l?a?.mission.objective:``)||``,currentStep:b&&y?qe(y,r):ue(o,r),currentDetail:y?Je(y,700):s?.objective||``,currentEvent:y??null,runtime:o,elapsedSeconds:S,etaUnavailableReason:me,checkpoints:le,completedTasks:d,totalTasks:u.length,pendingTasks:f,openEnded:p,review:oe,acceptanceCriteria:s?.acceptance_check||u.find(e=>e.id===c)?.acceptance_check||``,nextAction:s?.pending_question||String(j?.next_action||``),taskEvents:v}}var ot=new Set([`done`,`completed`,`accepted`,`success`]),st=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]);function ct(e){let{locale:t,text:n,t:r}=H(),[i,a]=(0,I.useState)(()=>Date.now()/1e3),[o,s]=(0,I.useState)(``);(0,I.useEffect)(()=>{if(!e.active||!e.snapshot.daemon.alive)return;a(Date.now()/1e3);let t=window.setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(t)},[e.active,e.snapshot.daemon.alive]);let c=(0,I.useMemo)(()=>at(e.snapshot,e.events,i,t),[t,i,e.events,e.snapshot]),l=e.snapshot.mission_view,u=l?.dag?.length?l.dag:e.snapshot.backlog.map(e=>({id:e.id,title:e.title,objective:e.objective,status:e.status,deps:e.deps??[],branch_id:e.id,parent_branch_id:``})),d=u.find(e=>e.id===o)??u.find(e=>e.id===c.currentTaskId),f=he(l?.stage.id,t),p=l?.stage.label&&l.stage.label!==l.stage.id?l.stage.label:f||l?.stage.id||n(`尚未记录`,`Not yet recorded`),h=c.runtime.state===`running`,g=ue(c.runtime,t),b=c.taskEvents.filter(e=>String(e.kind??``)!==`reasoning`&&!le(String(e.type??``))),x=ce(c.currentDetail,t),C=c.currentEvent?de(c.currentEvent,t):null,T=ce(c.review.detail,t),D=[{label:n(`已完成的工作`,`Completed work`),items:u.filter(e=>ot.has(e.status))},{label:n(`进行中与待处理`,`Active and remaining work`),items:u.filter(e=>!ot.has(e.status))}],k=async t=>{let r=t?n(`确认完成当前步骤后停止 Argus?`,`Stop Argus after the current step finishes?`):n(`确认立即停止 Argus?当前步骤可能被中断。`,`Stop Argus now? The current step may be interrupted.`);confirm(r)&&await e.controls.stop(t)};return(0,U.jsxs)(`div`,{className:`ros-page experiment-v3`,children:[(0,U.jsxs)(`header`,{className:`ros-page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{children:n(`任务进展`,`Work progress`)}),(0,U.jsx)(`p`,{children:n(`看清做了哪些工作、结论核对到了哪里,以及团队接下来要做什么。`,`See what work was done, which conclusions were checked, and what the team needs to do next.`)})]}),(0,U.jsxs)(`div`,{className:`experiment-header-actions`,children:[(0,U.jsxs)(`button`,{className:`button button--secondary`,type:`button`,onClick:()=>void e.refresh(),children:[(0,U.jsx)(y,{size:14}),n(`刷新`,`Refresh`)]}),e.snapshot.daemon.alive&&e.snapshot.daemon.control_available===!1?null:e.snapshot.daemon.alive?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{className:`button button--secondary`,type:`button`,disabled:e.controls.busy,onClick:()=>void k(!0),children:[(0,U.jsx)(ge,{size:14}),n(`当前步后停止`,`Stop after step`)]}),(0,U.jsxs)(`button`,{className:`button button--danger`,type:`button`,disabled:e.controls.busy,onClick:()=>void k(!1),children:[(0,U.jsx)(se,{size:13}),n(`立即停止`,`Stop now`)]})]}):(0,U.jsxs)(`button`,{className:`button button--primary`,type:`button`,disabled:e.controls.busy,onClick:()=>void e.controls.start(),children:[(0,U.jsx)(M,{size:14}),n(`继续运行`,`Resume`)]})]})]}),(0,U.jsxs)(`section`,{className:`experiment-progress-hero`,children:[(0,U.jsxs)(`div`,{className:`progress-hero-main`,children:[(0,U.jsxs)(`div`,{className:`progress-live-line`,children:[(0,U.jsx)(W,{tone:h?`live`:`neutral`,dot:h,children:g}),c.runtime.role?(0,U.jsx)(`span`,{children:V(c.runtime.role,n)}):null]}),(0,U.jsx)(`h2`,{children:c.currentTask}),c.currentObjective?(0,U.jsx)(`p`,{className:`work-objective`,children:c.currentObjective}):null,(0,U.jsxs)(`div`,{className:`current-step-callout`,children:[(0,U.jsx)(`span`,{children:(0,U.jsx)(v,{size:17})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`small`,{children:h?n(`当前动作`,`Current action`):n(`当前状态与最近记录`,`Current state and latest record`)}),(0,U.jsx)(`strong`,{children:C?.title||c.currentStep}),C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{children:C.detail}),(0,U.jsx)(E,{label:n(`原始调用记录`,`Original call record`),children:(0,U.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs`,children:c.currentDetail})})]}):c.currentDetail?(0,U.jsx)(`p`,{title:x.technical||void 0,children:x.text}):null]})]})]}),(0,U.jsxs)(`div`,{className:`progress-number`,children:[(0,U.jsx)(`span`,{children:n(`已完成的工作项`,`Completed work items`)}),(0,U.jsxs)(`strong`,{children:[c.completedTasks,(0,U.jsxs)(`em`,{children:[` / `,c.totalTasks||`—`]})]}),(0,U.jsx)(`small`,{children:n(`按当前记录计数`,`Counted from current records`)})]}),(0,U.jsxs)(`div`,{className:`truthful-progress`,children:[c.workCompletion===null?null:(0,U.jsx)(`div`,{className:`truthful-progress__track`,role:`progressbar`,"aria-label":n(`已记录工作项的完成情况`,`Completion of recorded work items`),"aria-valuemin":0,"aria-valuemax":c.totalTasks,"aria-valuenow":c.completedTasks,"aria-valuetext":n(`${c.totalTasks} 项已记录工作中完成 ${c.completedTasks} 项`,`${c.completedTasks} of ${c.totalTasks} recorded work items completed`),children:(0,U.jsx)(`span`,{className:`confirmed`,style:{width:`${c.workCompletion*100}%`}})}),(0,U.jsx)(`p`,{className:`work-scope`,children:c.workScope})]}),(0,U.jsxs)(`div`,{className:`progress-metrics`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(te,{size:15}),n(`当前工作项已用时间`,`Current work item elapsed`)]}),(0,U.jsx)(`strong`,{children:c.elapsedSeconds===null?`—`:Ue(c.elapsedSeconds)}),(0,U.jsx)(`small`,{children:n(`按任务启动与结束记录计算`,`Based on recorded task start and end times`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{children:n(`实际记录的阶段`,`Recorded stage`)}),(0,U.jsx)(`strong`,{children:p}),(0,U.jsx)(`small`,{children:n(`阶段名称不表示前面的工作已通过核验`,`The stage name does not certify earlier work`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{children:n(`工作范围`,`Work scope`)}),(0,U.jsx)(`strong`,{children:c.openEnded?n(`开放研究`,`Open research`):n(`当前工作项`,`Current work item`)}),(0,U.jsx)(`small`,{children:c.openEnded?n(`可能产生新的问题和任务`,`New questions and tasks may emerge`):n(`以该工作项的验收条件为准`,`Defined by this item’s acceptance criteria`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(Me,{size:15}),n(`等待执行的工作`,`Work waiting to start`)]}),(0,U.jsx)(`strong`,{children:c.pendingTasks}),(0,U.jsx)(`small`,{children:n(`已记录清单中的等待项`,`Waiting items in the recorded list`)})]})]})]}),(0,U.jsxs)(`div`,{className:`experiment-v3-grid`,children:[(0,U.jsxs)(`aside`,{className:`ros-card experiment-task-route`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`工作项`,`Work items`)})}),(0,U.jsx)(W,{tone:`neutral`,children:u.length})]}),(0,U.jsx)(`div`,{children:u.length?D.map(e=>(0,U.jsxs)(`section`,{className:`work-item-group`,children:[(0,U.jsxs)(`h3`,{children:[e.label,(0,U.jsx)(`span`,{children:e.items.length})]}),e.items.length?e.items.map(e=>{let t=h&&e.id===c.currentTaskId&&st.has(e.status),r=st.has(e.status)&&!t?e.id===c.currentTaskId?g:n(`等待状态确认`,`Awaiting status confirmation`):Ve(e.status,n);return(0,U.jsxs)(`button`,{type:`button`,className:d?.id===e.id?`is-active`:``,onClick:()=>s(e.id),children:[(0,U.jsx)(`span`,{className:`task-state task-state--${ot.has(e.status)?`success`:t?`live`:`neutral`}`,children:ot.has(e.status)?(0,U.jsx)(_,{size:12}):t?(0,U.jsx)(v,{size:12}):(0,U.jsx)(be,{size:9})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.title||e.objective||n(`未命名任务`,`Untitled task`)}),(0,U.jsxs)(`small`,{children:[r,e.deps.length?n(` · 前置工作 ${e.deps.length} 项`,` · ${e.deps.length} dependencies`):``]})]})]},e.id)}):(0,U.jsx)(`p`,{className:`work-group-empty`,children:n(`暂无记录`,`No records yet`)})]},e.label)):(0,U.jsx)(G,{icon:Me,title:n(`尚无工作项`,`No work items yet`)})})]}),(0,U.jsxs)(`main`,{className:`experiment-v3-center`,children:[(0,U.jsxs)(`section`,{className:`ros-card work-conclusion`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`本轮结论与待核对问题`,`This round’s conclusions and open checks`)})}),(0,U.jsx)(W,{tone:c.review.state===`passed`?`success`:c.review.state===`running`?`live`:`warn`,children:c.review.label})]}),(0,U.jsxs)(`div`,{className:`work-conclusion__body`,children:[(0,U.jsx)(`p`,{title:T.technical||void 0,children:T.text}),c.acceptanceCriteria?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:n(`判断这项工作是否完成的标准`,`How this work item is accepted`)}),(0,U.jsx)(`p`,{children:c.acceptanceCriteria})]}):null,c.nextAction?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:n(`下一步要处理`,`What needs to happen next`)}),(0,U.jsx)(`p`,{children:c.nextAction})]}):null,(0,U.jsx)(`p`,{className:`work-scope`,children:c.review.scope})]})]}),(0,U.jsxs)(`section`,{className:`ros-card checkpoint-card`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`当前工作项的过程记录`,`Current work item’s recorded steps`)})}),(0,U.jsx)(W,{tone:`neutral`,children:n(`以记录为准`,`Based on records`)})]}),(0,U.jsx)(`div`,{className:`checkpoint-list`,children:c.checkpoints.map((e,t)=>(0,U.jsxs)(`div`,{className:`checkpoint checkpoint--${e.status}`,children:[(0,U.jsx)(`span`,{children:e.status===`done`?(0,U.jsx)(_,{size:13}):e.status===`active`?(0,U.jsx)(v,{size:13}):e.status===`blocked`?(0,U.jsx)(ve,{size:13}):t+1}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.label}),(0,U.jsx)(`p`,{children:e.detail})]}),t{let t=h&&c.runtime.role===e;return(0,U.jsxs)(`article`,{className:t?`is-active`:``,children:[(0,U.jsx)(`span`,{"data-role-dot":e,className:`role-dot`,style:{backgroundColor:O(e)},"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:V(e,n)}),(0,U.jsx)(`p`,{children:S(e,r)})]}),t?(0,U.jsx)(W,{tone:`live`,dot:!0,children:n(`执行中`,`Working`)}):(0,U.jsx)(W,{tone:`neutral`,children:n(`未在执行`,`Not working`)})]},e)})})]}),(0,U.jsxs)(`section`,{className:`ros-card estimate-note`,children:[(0,U.jsx)(`header`,{children:(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`还需要多久`,`How much longer?`)})})}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:n(`暂无法可靠预计`,`No reliable estimate yet`)}),c.etaUnavailableReason]}),(0,U.jsxs)(`div`,{className:`work-evidence-note`,children:[(0,U.jsx)(m,{size:15}),(0,U.jsx)(`span`,{children:n(`真实已用时间和已完成工作可以统计。读文件、运行命令或审查结束,都不能换算成整体目标的完成百分比。`,`Elapsed time and completed work can be counted. File reads, commands, and the end of a review do not establish a completion percentage for the overall goal.`)})]}),e.controls.error?(0,U.jsx)(`div`,{className:`inline-error`,children:e.controls.error}):null]})]})]})]})]})}function lt(e){if(!e||e.length>2e5||e.includes(`\0`)||!e.startsWith(`diff --git `)&&!/^--- [^\n]+\n\+\+\+ /.test(e)||/^(?:Binary files |GIT binary patch)/m.test(e))return null;let t=e.match(/[^\n]*\n|[^\n]+$/g)??[];if(t.length>3e3)return null;let n=[],r=0,i=0;for(let e of t){let t=e.replace(/\r?\n$/,``),a,o=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@(?:.*)$/.exec(t);if(t.startsWith(`diff --git `))a=`header`,r=0,i=0;else if(o){if(a=`hunk`,r=Number(o[1]??1),i=Number(o[2]??1),!Number.isSafeInteger(r)||!Number.isSafeInteger(i))return null}else if(t===`\\ No newline at end of file`)a=`header`;else if(r||i){if(t.startsWith(`+`))a=`addition`,i--;else if(t.startsWith(`-`))a=`deletion`,r--;else if(t.startsWith(` `))a=`context`,r--,i--;else return null;if(r<0||i<0)return null}else if(/^(?:--- |\+\+\+ |index |old mode |new mode |new file mode |deleted file mode |similarity index |dissimilarity index |rename from |rename to |copy from |copy to )/.test(t))a=`header`;else return null;n.push({kind:a,text:e})}return n}function ut({diff:e,truncated:t=!1}){let{text:n}=H(),r=(0,I.useMemo)(()=>lt(e),[e]),[i,a]=(0,I.useState)(!1),o=r!==null&&!i;return(0,U.jsxs)(`section`,{className:`readonly-diff`,"data-readonly-diff":!0,children:[(0,U.jsxs)(`div`,{className:`readonly-diff__toolbar`,children:[(0,U.jsx)(`strong`,{children:n(`当前工作区差异`,`Current workspace diff`)}),r&&(0,U.jsx)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?n(`着色视图`,`Highlighted view`):n(`原始文本`,`Original text`)}),e&&(0,U.jsx)(C,{text:e,label:n(`复制原始差异`,`Copy original diff`),copiedLabel:n(`已复制`,`Copied`)})]}),(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`不代表所有变更都来自当前 Agent 或任务。`,`Changes are not necessarily from this Agent or task.`)}),t&&(0,U.jsx)(`p`,{role:`status`,className:`readonly-diff__notice`,children:n(`后端返回的差异已截断,当前内容不完整。`,`The backend truncated this diff; the displayed content is incomplete.`)}),e?r?null:(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`无法识别、二进制或较大差异:显示原始文本。`,`Unrecognized, binary or large diff: showing original text.`)}):(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`没有工作区差异。`,`No workspace diff.`)}),(0,U.jsx)(`pre`,{className:`readonly-diff__text`,tabIndex:0,"aria-label":n(`工作区差异文本`,`Workspace diff text`),"data-diff-mode":o?`highlighted`:`raw`,children:o?r.map((e,t)=>(0,U.jsx)(`span`,{"data-diff-kind":e.kind,className:`readonly-diff__line--${e.kind}`,children:e.text},t)):e})]})}async function q(e,t,n){let r=new URLSearchParams(t),i=await fetch(`${e}?${r}`,{headers:L(),signal:n,cache:`no-store`});if(!i.ok){let t=await i.json().catch(()=>({}));throw Error(t.detail||t.error||`${e} failed (${i.status})`)}return i.json()}var J=(e,t)=>({sid:e,workspace_id:t}),Y={profiles:(e,t)=>q(`/api/v2/workspaces`,{sid:e},t),tree:(e,t,n)=>q(`/api/v2/workspace/tree`,J(e,t),n),file:(e,t,n,r)=>q(`/api/v2/workspace/file`,{...J(e,t),path:n},r),git:(e,t,n)=>q(`/api/v2/workspace/git`,J(e,t),n),literature:(e,t,n)=>q(`/api/v2/workspace/literature`,J(e,t),n),rawUrl:(e,t,n)=>`/api/v2/workspace/raw?${new URLSearchParams({...J(e,t),path:n})}`,rawBlob:async(e,t,n,r)=>{let i=await fetch(`/api/v2/workspace/raw?${new URLSearchParams({...J(e,t),path:n})}`,{headers:L(),signal:r,cache:`no-store`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`raw preview failed (${i.status})`)}return i.blob()}};function dt(e){let t=new Map;e.forEach(e=>t.set(e.path,{...e,children:[]}));let n=[];t.forEach(e=>{let r=e.path.lastIndexOf(`/`),i=r>=0?e.path.slice(0,r):``,a=i?t.get(i):null;a?a.children.push(e):n.push(e)});let r=e=>{e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1),e.forEach(e=>r(e.children))};return r(n),n}function ft(e,t,n){let[r,i]=(0,I.useState)(``),[a,o]=(0,I.useState)(``);return(0,I.useEffect)(()=>{if(i(``),o(``),!e||!t||!n)return;let r=new AbortController,a=``;return Y.rawBlob(e,t,n,r.signal).then(e=>{a=URL.createObjectURL(e),i(a)},e=>{r.signal.aborted||o(e.message)}),()=>{r.abort(),a&&URL.revokeObjectURL(a)}},[n,e,t]),{url:r,error:a}}function pt(e,t,n=!0){let i=r({queryKey:[`workspace-profiles`,e],queryFn:({signal:t})=>Y.profiles(e,t),staleTime:1e4,enabled:!!e&&n}),a=`argus-v2-workspace-profile:${t}:${e}`,[o,s]=(0,I.useState)(()=>N(a)||``),c=(0,I.useMemo)(()=>{let e=i.data?.profiles??[];return e.find(e=>e.id===o)??e.find(e=>e.id===i.data?.default_id)??e.find(e=>e.canonical)??e[0]??null},[i.data,o]);return(0,I.useEffect)(()=>{c&&c.id!==o&&s(c.id)},[c,o]),{profiles:i,active:c,workspaceId:c?.id??``,setWorkspaceId:e=>{s(e),ee(a,e)}}}function mt({node:e,depth:t,selected:n,expanded:r,onToggle:i,onSelect:a}){let o=e.type===`directory`,s=r.has(e.path);return(0,U.jsxs)(`div`,{className:`workspace-node`,children:[(0,U.jsxs)(`button`,{type:`button`,className:n===e.path?`is-selected`:``,style:{paddingLeft:7+t*13},onClick:()=>o?i(e.path):a(e.path),children:[o?s?(0,U.jsx)(g,{size:13}):(0,U.jsx)(P,{size:13}):(0,U.jsx)(`span`,{className:`node-spacer`}),o?(0,U.jsx)(ne,{size:14}):(0,U.jsx)(xe,{size:14}),(0,U.jsx)(`span`,{children:e.name}),e.skipped?(0,U.jsx)(`small`,{children:`restricted`}):null]}),o&&s?e.children.map(e=>(0,U.jsx)(mt,{node:e,depth:t+1,selected:n,expanded:r,onToggle:i,onSelect:a},e.path)):null]})}function ht({sid:e,workspaceId:t,path:n,active:i}){let{text:a}=H(),o=n.toLowerCase().slice(n.lastIndexOf(`.`)),s=[`.pdf`,`.png`,`.jpg`,`.jpeg`,`.webp`,`.svg`].includes(o),c=r({queryKey:[`workspace-file`,e,t,n],queryFn:({signal:r})=>Y.file(e,t,n,r),enabled:!!(i&&n&&t&&!s),refetchInterval:5e3}),l=ft(s?e:``,s?t:``,s?n:``);if(!n)return(0,U.jsx)(G,{icon:Se,title:a(`打开一个文件开始阅读`,`Open a file to start reading`),description:a(`左侧文件树展示所选代码工作区。`,`The file tree shows the selected code workspace.`)});if(s)return l.error?(0,U.jsx)(G,{icon:De,title:`Preview unavailable`,description:l.error}):l.url?o===`.pdf`?(0,U.jsx)(me,{src:l.url,name:n.split(`/`).at(-1)||n,className:`workspace-pdf`}):(0,U.jsx)(`img`,{className:`workspace-image`,src:l.url,alt:n}):(0,U.jsx)(`div`,{className:`editor-loading`,children:`Loading preview…`});if(c.isLoading)return(0,U.jsxs)(`div`,{className:`editor-loading`,children:[`Opening `,n,`…`]});if(c.isError)return(0,U.jsx)(G,{icon:De,title:`Preview unavailable`,description:c.error.message});let u=(c.data?.content??``).split(` +`);return(0,U.jsxs)(`div`,{className:`vscode-code`,tabIndex:0,"aria-label":a(`文件内容`,`File contents`),children:[(0,U.jsx)(`div`,{className:`vscode-line-numbers`,children:u.map((e,t)=>(0,U.jsx)(`span`,{children:t+1},t))}),(0,U.jsx)(`pre`,{children:(0,U.jsx)(`code`,{children:c.data?.content})})]})}function gt(e){let{locale:t,text:n}=H(),i=pt(e.sid,`ide`,e.active),a=i.workspaceId,o=i.active?.path||``,[s,c]=(0,I.useState)(``),[l,u]=(0,I.useState)(new Set),d=(0,I.useRef)(``),f=(0,I.useRef)(null),p=e=>{c(e);let t=f.current,n=t?.closest(`.vscode-shell`),r=t?.closest(`.ros-content`);t&&n&&r&&getComputedStyle(n).display===`flex`&&r.scrollTo({top:r.scrollTop+t.getBoundingClientRect().top-r.getBoundingClientRect().top-12,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[m,h]=(0,I.useState)(`files`),[v,x]=(0,I.useState)(`repository`),S=r({queryKey:[`workspace-tree`,e.sid,a],queryFn:({signal:t})=>Y.tree(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),C=r({queryKey:[`workspace-git`,e.sid,a],queryFn:({signal:t})=>Y.git(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),w=(0,I.useMemo)(()=>dt(S.data?.entries??[]),[S.data?.entries]);(0,I.useEffect)(()=>{c(``),u(new Set),d.current=``},[a]),(0,I.useEffect)(()=>{!a||!w.length||d.current===a||(d.current=a,u(new Set(w.filter(e=>e.type===`directory`).slice(0,5).map(e=>e.path))))},[w,a]);let T=e.events.filter(e=>[`command_execution`,`tool_use`,`tool_result`,`file_change`].includes(String(e.kind??``))).slice(-100),E=(C.data?.status??``).split(` +`).filter(Boolean),D=(C.data?.log??``).split(` +`).filter(Boolean).map(e=>{let[t,n,r,...i]=e.split(` `);return{hash:t,date:n,author:r,subject:i.join(` `)}}),k=C.data;return(0,U.jsxs)(`div`,{className:`ros-page ide-v3`,children:[(0,U.jsxs)(`header`,{className:`ros-page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`eyebrow`,children:`AI IDE`}),(0,U.jsx)(`h1`,{children:n(`代码工作区`,`Code workspace`)}),(0,U.jsx)(`p`,{children:n(`此视图只用于浏览文件、Git 状态与 Argus 活动;不限制 Agent 本身的文件写入权限。`,`This view only browses files, Git state and Argus activity; it does not restrict the Agent’s file write permissions.`)})]}),(0,U.jsxs)(W,{tone:`info`,children:[(0,U.jsx)(De,{size:12}),n(`此视图只读`,`This view is read-only`)]})]}),(0,U.jsxs)(`div`,{className:`ide-context-strip`,children:[(0,U.jsx)(ke,{size:15}),(0,U.jsx)(`select`,{"aria-label":n(`选择已批准工作区`,`Select approved workspace`),value:a,onChange:e=>i.setWorkspaceId(e.target.value),children:i.profiles.data?.profiles.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,U.jsx)(`code`,{children:o}),S.isError?(0,U.jsx)(W,{tone:`danger`,children:n(`连接失败`,`Connection failed`)}):S.isFetching?(0,U.jsx)(W,{tone:`live`,dot:!0,children:n(`同步中`,`Syncing`)}):(0,U.jsxs)(W,{tone:`success`,children:[(0,U.jsx)(re,{size:11}),`Synced`]}),(0,U.jsxs)(`small`,{children:[S.data?.entries.length??0,` entries`]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{S.refetch(),C.refetch()},"aria-label":n(`刷新工作区`,`Refresh workspace`),children:(0,U.jsx)(y,{size:14})})]}),(0,U.jsxs)(`div`,{className:`vscode-shell`,children:[(0,U.jsxs)(`nav`,{className:`vscode-activitybar`,children:[(0,U.jsx)(`button`,{type:`button`,className:m===`files`?`is-active`:``,onClick:()=>h(`files`),title:`Explorer`,"aria-label":`Explorer`,children:(0,U.jsx)(Ce,{size:21})}),(0,U.jsxs)(`button`,{type:`button`,className:m===`git`?`is-active`:``,onClick:()=>h(`git`),title:`Source Control`,"aria-label":`Source Control`,children:[(0,U.jsx)(j,{size:21}),E.length?(0,U.jsx)(`i`,{children:E.length}):null]})]}),(0,U.jsxs)(`aside`,{className:`vscode-sidebar`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`span`,{children:m===`git`?`SOURCE CONTROL`:`EXPLORER`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void S.refetch(),"aria-label":n(`刷新文件树`,`Refresh file tree`),children:(0,U.jsx)(y,{size:14})})]}),m===`files`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`vscode-root`,children:[(0,U.jsx)(g,{size:13}),(0,U.jsx)(`strong`,{title:o,children:o.split(/[\\/]/).filter(Boolean).at(-1)||o})]}),(0,U.jsx)(`div`,{className:`workspace-tree`,children:S.isError?(0,U.jsx)(G,{icon:ke,title:n(`目录连接失败`,`Directory connection failed`),description:S.error.message}):w.map(e=>(0,U.jsx)(mt,{node:e,depth:0,selected:s,expanded:l,onToggle:e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:p},e.path))})]}):(0,U.jsx)(`div`,{className:`vscode-changes`,children:E.length?E.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{let t=e.slice(3).trim(),n=t.includes(` -> `)?t.split(` -> `).at(-1):t;n.endsWith(`/`)||p(n)},children:[(0,U.jsx)(`b`,{children:e.slice(0,2).trim()||`?`}),(0,U.jsx)(`span`,{children:e.slice(3)})]},e)):(0,U.jsx)(`p`,{children:`No changes`})})]}),(0,U.jsxs)(`main`,{className:`vscode-editor`,ref:f,children:[(0,U.jsx)(`div`,{className:`vscode-tabs`,children:(0,U.jsxs)(`button`,{type:`button`,className:`is-active`,children:[(0,U.jsx)(A,{size:13}),s||`Welcome`]})}),(0,U.jsx)(`div`,{className:`vscode-breadcrumbs`,children:s?s.split(`/`).map((e,t)=>(0,U.jsxs)(`span`,{children:[e,tx(`changes`),children:`Changes`}),(0,U.jsx)(`button`,{type:`button`,className:v===`timeline`?`is-active`:``,onClick:()=>x(`timeline`),children:`Timeline`}),(0,U.jsx)(`button`,{type:`button`,className:v===`repository`?`is-active`:``,onClick:()=>x(`repository`),children:`Repository`})]}),(0,U.jsx)(`div`,{className:`vscode-git-content`,children:k?.available?v===`changes`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{className:`vscode-status`,children:k.status||`Working tree clean`}),(0,U.jsx)(ut,{diff:k.diff,truncated:k.truncated})]}):v===`timeline`?(0,U.jsx)(`div`,{className:`vscode-commits`,children:D.map(e=>(0,U.jsxs)(`article`,{children:[(0,U.jsx)(j,{size:13}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.subject}),(0,U.jsxs)(`small`,{children:[e.author,` · `,e.date?.slice(0,10)]})]})]},e.hash))}):(0,U.jsxs)(`div`,{className:`repository-readiness`,children:[(0,U.jsx)(`h3`,{children:`Repository readiness`}),(0,U.jsxs)(`dl`,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(j,{size:13}),`Remote`]}),(0,U.jsx)(`dd`,{children:k.remotes.length?k.remotes.map(e=>`${e.name}: ${e.fetch}`).join(` +`):`Not configured`}),(0,U.jsx)(`i`,{className:k.remotes.length?`ok`:`missing`,children:k.remotes.length?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(j,{size:13}),`Upstream`]}),(0,U.jsxs)(`dd`,{children:[k.upstream||`Not configured`,k.upstream?` · ahead ${k.ahead}, behind ${k.behind}`:``]}),(0,U.jsx)(`i`,{className:k.upstream?`ok`:`missing`,children:k.upstream?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(je,{size:13}),`Commit identity`]}),(0,U.jsx)(`dd`,{children:k.identity.name&&k.identity.email?`${k.identity.name} <${k.identity.email}>`:`Not configured`}),(0,U.jsx)(`i`,{className:k.identity.valid?`ok`:`missing`,children:k.identity.valid?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(Ee,{size:13}),`GitHub CLI`]}),(0,U.jsx)(`dd`,{children:k.github.authenticated?`${k.github.login} · ${k.github.protocol}`:`Not authenticated`}),(0,U.jsx)(`i`,{className:k.github.authenticated?`ok`:`missing`,children:k.github.authenticated?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]})]}),(0,U.jsx)(`p`,{children:k.publish_ready?`Repository is ready for an explicitly approved push.`:`Configure the missing items before publishing. No credentials are shown in this UI.`})]}):(0,U.jsx)(G,{icon:j,title:`Not a Git repository`})})]}),(0,U.jsxs)(`section`,{className:`vscode-terminal`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`strong`,{children:`ARGUS ACTIVITY`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(Ae,{size:13}),`read-only`]})]}),(0,U.jsx)(`div`,{children:T.length?T.map((e,r)=>(0,U.jsxs)(`article`,{children:[(0,U.jsx)(`time`,{children:We(e.ts,t)}),(0,U.jsx)(`b`,{className:`terminal-role`,style:{color:O(Ke(e))},children:V(Ke(e),n)}),(0,U.jsx)(`span`,{children:`›`}),(0,U.jsx)(`code`,{children:Je(e,800)||qe(e)})]},`${e.ts}-${r}`)):(0,U.jsx)(`p`,{children:`$ waiting for Argus activity`})})]}),(0,U.jsxs)(`footer`,{className:`vscode-statusbar`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(j,{size:12}),k?.branch||`no branch`]}),(0,U.jsx)(`span`,{children:S.isError?`Workspace error`:S.isFetching?`Workspace syncing`:S.data?.truncated?`Tree truncated`:`Workspace synced`}),(0,U.jsx)(`span`,{children:k?.github.authenticated?`GitHub: ${k.github.login}`:`GitHub: offline`}),(0,U.jsx)(`span`,{children:`UTF-8`}),(0,U.jsx)(`span`,{children:s.split(`.`).at(-1)?.toUpperCase()||`Plain Text`})]})]})]})}var X=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm`;function _t({task:e,resources:t,onChange:n,text:r}){let i=e.execution_options??[],a=(e,t)=>n(i.map(n=>n.id===e?{...n,...t}:n));return(0,U.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-dashed border-line p-3 sm:col-span-2`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-medium`,children:r(`期限紧张时的替代做法`,`Alternative execution options for tighter deadlines`)}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:r(`每种做法都有独立工期、资源和取舍。系统只会选择已声明保留必需验收目标的方案,不自动压缩原估计。`,`Each option has its own estimate, resources and tradeoff. Only options declared to preserve required acceptance scope can be selected.`)}),i.map(o=>(0,U.jsxs)(`fieldset`,{disabled:e.status!=null&&e.status!==`pending`,className:`grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs sm:col-span-2`,children:[r(`替代做法`,`Alternative approach`),(0,U.jsx)(`input`,{className:X,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:col-span-2`,children:[r(`替代下限(小时)`,`Option lower (h)`),r(`替代最可能(小时)`,`Option likely (h)`),r(`替代上限(小时)`,`Option upper (h)`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{className:X,type:`number`,min:`0`,step:`any`,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),t.map(e=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,r(`需求`,`required`),(0,U.jsx)(`input`,{className:X,type:`number`,min:`0`,step:`1`,value:o.resources[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e)),(0,U.jsxs)(`label`,{className:`text-xs`,children:[r(`替代工期依据`,`Option estimate basis`),(0,U.jsx)(`textarea`,{"aria-label":r(`替代工期依据`,`Option estimate basis`),className:X,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[r(`取舍与适用条件`,`Tradeoff and prerequisites`),(0,U.jsx)(`textarea`,{"aria-label":r(`取舍与适用条件`,`Tradeoff and prerequisites`),className:X,value:o.tradeoff,onChange:e=>a(o.id,{tradeoff:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`flex gap-2 text-xs sm:col-span-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o.preserves_acceptance,onChange:e=>a(o.id,{preserves_acceptance:e.target.checked})}),r(`确认条件适用且保留必需验收目标,允许重排时采用`,`Prerequisites apply and required acceptance is preserved; allow automatic selection`)]}),(0,U.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>n(i.filter(e=>e.id!==o.id)),children:r(`移除替代做法`,`Remove alternative`)})]},o.id)),(0,U.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-xs`,disabled:i.length>=8||e.status!=null&&e.status!==`pending`,onClick:()=>{let t=i.length+1;for(;i.some(e=>e.id===`option-${t}`);)t++;n([...i,{id:`option-${t}`,title:r(`新的替代做法`,`New alternative`),duration_hours:[...e.duration_hours],resources:{...e.resources},basis:e.basis,tradeoff:r(`待补充适用条件与取舍`,`Specify prerequisites and tradeoffs`),preserves_acceptance:!1}])},children:r(`添加替代做法`,`Add alternative`)})]})}var Z=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm text-ink`;function vt({input:e,onChange:t,text:n,forecast:r}){let i=e.proposals.find(t=>t.id===e.selected_proposal_id),a=(n,r)=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.map(e=>e.id===n?{...e,...r}:e)}:e)});return(0,U.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`任务与实验`,`Tasks and experiments`),children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`h3`,{className:`font-medium`,children:n(`任务与实验`,`Tasks and experiments`)}),(0,U.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-sm`,onClick:()=>{let r=i.tasks.length+1;for(;i.tasks.some(e=>e.id===`task-${r}`);)r++;t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:[...e.tasks,{id:`task-${r}`,title:n(`新增实验`,`New experiment`),phase:`experiment`,duration_hours:[1,2,8],basis:n(`初步估计,待实测校准`,`Preliminary estimate; needs calibration`)}]}:e)})},children:n(`添加任务`,`Add task`)})]}),i.tasks.map(o=>{let s=[`running`,`completed`,`failed`].includes(o.status??`pending`),c=[`completed`,`failed`].includes(o.status??`pending`);return(0,U.jsxs)(`details`,{className:`rounded-xl border border-line p-3`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,U.jsx)(`strong`,{children:o.title}),(0,U.jsxs)(`span`,{className:`ml-2 text-ink-faint`,children:[o.duration_hours.join(` / `),` h · `,o.id]})]}),(0,U.jsxs)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`任务名称`,`Task name`),(0,U.jsx)(`input`,{className:Z,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`阶段`,`Phase`),(0,U.jsx)(`input`,{className:Z,value:o.phase,onChange:e=>a(o.id,{phase:e.target.value})})]}),(0,U.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`乐观(小时)`,`Lower (hours)`),n(`最可能(小时)`,`Likely (hours)`),n(`悲观(小时)`,`Upper (hours)`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,disabled:s,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`估计依据`,`Estimate basis`),(0,U.jsx)(`textarea`,{"aria-label":n(`估计依据`,`Estimate basis`),className:Z,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`模型 / 实现难度`,`Model / implementation difficulty`),(0,U.jsx)(`textarea`,{"aria-label":n(`模型 / 实现难度`,`Model / implementation difficulty`),className:Z,value:o.difficulty??``,onChange:e=>a(o.id,{difficulty:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`前置任务(可多选)`,`Dependencies (multiple)`),(0,U.jsx)(`select`,{"aria-label":n(`前置任务(可多选)`,`Dependencies (multiple)`),multiple:!0,className:Z,disabled:s,value:o.depends_on??[],onChange:e=>a(o.id,{depends_on:Array.from(e.target.selectedOptions,e=>e.value)}),children:i.tasks.filter(e=>e.id!==o.id).map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.keys(e.resources).map(e=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`占用`,`slots`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`1`,className:Z,disabled:s,value:o.resources?.[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`进展状态`,`Progress status`),(0,U.jsx)(`select`,{"aria-label":n(`进展状态`,`Progress status`),className:Z,disabled:c||e.adapt_to_deadline&&!s&&!r,value:o.status??`pending`,onChange:t=>{let n=t.target.value,i=r?.schedule.find(e=>e.id===o.id),c=!s&&[`running`,`completed`,`failed`].includes(n)&&i?{duration_hours:i.duration_hours??o.duration_hours,resources:i.resources,execution_option_id:i.execution_option_id??`standard`,basis:i.basis}:{};a(o.id,{status:n,...c,...n===`running`?{actual_start_hours:o.actual_start_hours??e.now_hours,remaining_hours:o.remaining_hours??[...c.duration_hours??o.duration_hours]}:{},...[`completed`,`failed`].includes(n)?{actual_start_hours:o.actual_start_hours??0,actual_finish_hours:e.now_hours}:{}})},children:[[`pending`,`未开始`,`Pending`],[`running`,`运行中`,`Running`],[`completed`,`已完成`,`Completed`],[`failed`,`失败`,`Failed`],[`blocked`,`受阻`,`Blocked`]].filter(([e])=>!s||![`pending`,`blocked`].includes(e)).map(([e,t,r])=>(0,U.jsx)(`option`,{value:e,children:n(t,r)},e))})]}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o.optional??!1,onChange:e=>a(o.id,{optional:e.target.checked})}),n(`可选 / 已退出交付路径`,`Optional / retired from delivery path`)]}),s&&(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`实际开始(项目第几小时)`,`Actual start (project hour)`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.actual_start_hours??0,onChange:e=>a(o.id,{actual_start_hours:Number(e.target.value)})})]}),c&&(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`实际结束(项目第几小时)`,`Actual finish (project hour)`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.actual_finish_hours??0,onChange:e=>a(o.id,{actual_finish_hours:Number(e.target.value)})})]}),o.status===`running`&&(0,U.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`剩余下限`,`Remaining lower`),n(`剩余最可能`,`Remaining likely`),n(`剩余上限`,`Remaining upper`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.remaining_hours?.[t]??0,onChange:e=>{let n=[...o.remaining_hours??o.duration_hours];n[t]=Number(e.target.value),a(o.id,{remaining_hours:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`变化 / 延期原因`,`Change / delay reason`),(0,U.jsx)(`textarea`,{"aria-label":n(`变化 / 延期原因`,`Change / delay reason`),className:Z,value:o.reason??``,onChange:e=>a(o.id,{reason:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`证据引用(每行一个)`,`Evidence references (one per line)`),(0,U.jsx)(`textarea`,{"aria-label":n(`证据引用(每行一个)`,`Evidence references (one per line)`),className:Z,value:(o.evidence??[]).join(` +`),onChange:e=>a(o.id,{evidence:e.target.value.split(` +`).filter(Boolean)})})]}),(0,U.jsx)(_t,{task:o,resources:Object.keys(e.resources),onChange:e=>a(o.id,{execution_options:e}),text:n}),!s&&i.tasks.length>1&&(0,U.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.filter(e=>e.id!==o.id)}:e)}),children:n(`移除未开始任务`,`Remove unstarted task`)})]})]},o.id)})]})}function yt({report:e,selectedId:t,text:n}){let r=e.proposals.find(e=>e.id===t),i=Math.max(1,...r.schedule.map(e=>e.finish_hours));return(0,U.jsxs)(`div`,{className:`space-y-5`,"aria-label":n(`排期结果`,`Timeline results`),children:[(0,U.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:e.proposals.map(e=>(0,U.jsxs)(`div`,{className:`rounded-xl border p-4 ${e.id===t?`border-blue`:`border-line`}`,children:[(0,U.jsx)(`div`,{className:`text-xs text-ink-faint`,children:e.id===t?n(`已选方案`,`Selected proposal`):n(`备选方案`,`Alternative`)}),(0,U.jsx)(`h3`,{className:`mt-1 text-sm font-medium`,children:e.title}),(0,U.jsx)(`div`,{className:`mt-3 text-2xl font-semibold`,children:e.finish_hours?`${e.finish_hours.expected.toFixed(1)} h`:n(`待重规划`,`Needs replanning`)}),e.finish_hours&&(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[n(`区间`,`Range`),` `,e.finish_hours.lower.toFixed(1),`–`,e.finish_hours.upper.toFixed(1),` h · `,n(`剩余`,`Remaining`),` `,e.remaining_hours?.toFixed(1),` h`]}),e.deadline_gap_hours!=null&&(0,U.jsxs)(`p`,{className:`mt-2 text-xs ${e.deadline_gap_hours>0?`text-red`:`text-ink-faint`}`,children:[n(`预计超期`,`Forecast overrun`),` `,e.deadline_gap_hours.toFixed(1),` h`]})]},e.id))}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`初步估计,非成功承诺。区间覆盖已列出的工作;验证失败后的新增实验可能超出上限。各方案作为备选单独计算。`,`Preliminary estimates, not success guarantees. New experiments after a failed premise can exceed the range. Proposals are estimated as alternatives.`)}),r.adaptation&&(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-blue/40 bg-blue/5 p-4`,"aria-label":n(`根据期限重排`,`Deadline adaptation`),children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`根据期限重排`,`Deadline adaptation`)}),r.adaptation.baseline_finish_hours&&r.finish_hours&&(0,U.jsxs)(`p`,{className:`text-sm`,children:[n(`调整前`,`Before`),` `,(0,U.jsxs)(`strong`,{children:[r.adaptation.baseline_finish_hours.expected.toFixed(1),` h`]}),` → `,n(`当前方案`,`Current plan`),` `,(0,U.jsxs)(`strong`,{children:[r.finish_hours.expected.toFixed(1),` h`]})]}),r.adaptation.status===`gap`&&(0,U.jsx)(`p`,{className:`text-sm text-red`,children:n(`已尝试可用的重排方式,仍无法满足期限。需要增加资源、提出新的执行方案,或调整交付目标。`,`Available adjustments still miss the deadline. More resources, another execution option, or a revised deliverable are needed.`)}),r.adaptation.status===`fits`&&r.finish_hours&&r.adaptation.target_hours!=null&&r.finish_hours.upper>r.adaptation.target_hours&&(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`点估计可按期;悲观情景仍可能超期,请留意区间上限。`,`The point estimate fits; the upper scenario can still miss the deadline.`)}),r.adaptation.changes.length===0&&(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`沿用原 proposal 的任务与做法;当前期限无需进一步调整,或尚无可用的替代做法。`,`Keeping the original tasks and approaches; no further adjustment is needed or no usable alternative is available.`)}),r.adaptation.changes.map(e=>(0,U.jsxs)(`div`,{className:`border-t border-line/60 pt-2 text-xs`,children:[(0,U.jsxs)(`p`,{className:`font-medium`,children:[e.title,e.option_title?` → ${e.option_title}`:``]}),e.from_duration_hours&&e.to_duration_hours&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`任务估计(下限 / 最可能 / 上限)`,`Task estimate (lower / likely / upper)`),`: `,e.from_duration_hours.join(` / `),` → `,e.to_duration_hours.join(` / `),` h`]}),e.from_start_hours!=null&&e.to_start_hours!=null&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`开始时间`,`Start time`),`: `,e.from_start_hours.toFixed(1),` → `,e.to_start_hours.toFixed(1),` h`]}),(0,U.jsx)(`p`,{className:`mt-1 text-ink-faint`,children:e.reason}),e.tradeoff&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`取舍 / 条件`,`Tradeoff / prerequisites`),`: `,e.tradeoff]})]},`${e.kind}:${e.id}`))]}),(0,U.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`h3`,{className:`mb-4 text-sm font-medium`,children:[n(`实验排布`,`Experiment schedule`),` · `,n(`从项目开始计时`,`Hours from project start`)]}),(0,U.jsx)(`div`,{className:`space-y-3`,children:r.schedule.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs`,children:[(0,U.jsx)(`span`,{children:e.title}),(0,U.jsxs)(`span`,{className:`shrink-0 text-ink-faint`,children:[e.start_hours.toFixed(1),`–`,e.finish_hours.toFixed(1),` h`]})]}),(0,U.jsx)(`div`,{className:`h-2.5 rounded-full bg-line/40`,role:`img`,"aria-label":`${e.title}: ${e.start_hours.toFixed(1)}–${e.finish_hours.toFixed(1)} h`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full ${e.status===`failed`?`bg-red`:e.status===`completed`?`bg-emerald-500`:`bg-blue`}`,style:{marginLeft:`${e.start_hours/i*100}%`,width:`${Math.max(.3,(e.finish_hours-e.start_hours)/i*100)}%`}})})]},e.id))})]}),r.deferred_task_ids.length>0&&(0,U.jsxs)(`p`,{className:`rounded-lg border border-line p-3 text-sm`,children:[n(`为满足期限延后的可选任务`,`Optional tasks deferred for the deadline`),`: `,r.deferred_task_ids.join(`, `)]}),[...r.failed_tasks,...r.blocked_tasks].map(e=>(0,U.jsxs)(`p`,{role:`alert`,className:`rounded-lg border border-red/40 p-3 text-sm`,children:[e.id,`: `,e.reason]},e.id)),(0,U.jsx)(`div`,{className:`overflow-x-auto`,children:(0,U.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsx)(`tr`,{children:[n(`任务`,`Task`),n(`资源`,`Resources`),n(`排队`,`Queue`),n(`估计依据`,`Estimate basis`)].map(e=>(0,U.jsx)(`th`,{className:`border-b border-line p-2`,children:e},e))})}),(0,U.jsx)(`tbody`,{children:r.schedule.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:e.title}),(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:Object.entries(e.resources).map(([e,t])=>`${e} × ${t}`).join(`, `)||`—`}),(0,U.jsxs)(`td`,{className:`border-b border-line p-2`,children:[e.resource_wait_hours.toFixed(1),` h`]}),(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:e.basis})]},e.id))})]})}),e.revision&&(0,U.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`版本对照与延期原因`,`Revision and delay reasons`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm`,children:e.revision.reason}),(0,U.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[n(`初版预计`,`Original forecast`),`: `,e.revision.baseline_finish_hours?.toFixed(1)??`—`,` h · `,n(`相对初版变化`,`Change from original`),`: `,e.revision.baseline_delta_hours?.toFixed(1)??`—`,` h`]}),e.revision.task_variances.map((e,t)=>(0,U.jsxs)(`p`,{className:`mt-3 text-xs`,children:[e.id,` · `,e.observed?n(`实际延期`,`Observed delay`):n(`预测延期`,`Forecast delay`),` `,e.delay_hours.toFixed(1),` h — `,e.reason,(0,U.jsx)(`br`,{}),e.evidence.join(`, `)]},`${e.id}-${t}`))]})]})}function bt(e){return{...e,resources:e.resources??{},now_hours:e.now_hours??0,defer_optional:e.defer_optional??!1}}var Q=`w-full rounded-lg border border-line bg-transparent px-3 py-2 text-sm text-ink`,$=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40`;function xt({sid:e}){let{locale:t}=p(),n=(e,n)=>t===`zh-CN`?e:n,[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(!0),[d,f]=(0,I.useState)(!1),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(``),[b,x]=(0,I.useState)(``),[S,C]=(0,I.useState)(``),[w,E]=(0,I.useState)(``),[D,O]=(0,I.useState)(``),[k,A]=(0,I.useState)(0),j=!!(r&&JSON.stringify(r)!==JSON.stringify(a?.input));return(0,I.useEffect)(()=>{let t=!0;return u(!0),f(!1),y(``),i(null),o(null),c(null),B.timelineLatest(e).then(({latest:e})=>{if(!t)return;let n=e?{...e,input:bt(e.input)}:null;o(n),i(n?.input??null),c(n?.report??null),E(``),C(``),f(!0)}).catch(e=>{t&&y(e.message)}).finally(()=>{t&&u(!1)}),()=>{t=!1}},[e,k]),(0,I.useEffect)(()=>{if(c(null),x(``),!r){_(!1);return}if(a&&JSON.stringify(r)===JSON.stringify(a.input)){c(a.report),_(!1);return}let e=new AbortController;_(!0);let t=setTimeout(()=>{B.timelineEstimate(r,e.signal).then(t=>{e.signal.aborted||c(t)}).catch(t=>{e.signal.aborted||x(t.message)}).finally(()=>{e.signal.aborted||_(!1)})},350);return()=>{clearTimeout(t),e.abort()}},[r,a]),l?(0,U.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-ink-faint`,children:n(`正在读取已保存计划…`,`Loading saved timeline…`)}):(0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 p-4 sm:p-6`,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs text-blue`,children:`PROPOSAL → EXPERIMENT → PAPER`}),(0,U.jsx)(`h2`,{className:`mt-1 text-xl font-semibold`,children:n(`研究排期`,`Research timeline`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`选择 idea 和期望期限,查看具体工期、实验排布与调整原因。`,`Choose an idea and deadline to see estimates, experiment schedules, and reasons for changes.`)})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(`button`,{className:$,disabled:m||!d,onClick:async()=>{h(!0),y(``),C(``);try{i(await B.timelineExample()),E(n(`加载演示 proposal`,`Load demonstration proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`加载论文示例`,`Load paper example`)}),(0,U.jsx)(`button`,{className:$,disabled:m,onClick:()=>A(e=>e+1),children:n(`重新载入已保存计划`,`Reload saved timeline`)}),r&&(0,U.jsx)(`button`,{className:$,onClick:()=>T(new Blob([JSON.stringify(r,null,2)],{type:`application/json`}),`proposal.json`),children:n(`导出 proposal`,`Export proposal`)})]})]}),v&&(0,U.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[v,(0,U.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n(`若提示版本冲突,先导出当前草稿,再重新载入已保存计划。`,`For a version conflict, export your draft before reloading the saved timeline.`)})]}),S&&(0,U.jsx)(`p`,{role:`status`,className:`rounded-xl border border-blue/40 p-3 text-sm`,children:S}),!r&&(0,U.jsxs)(`section`,{className:`rounded-xl border border-dashed border-line p-8 text-center`,children:[(0,U.jsx)(`h3`,{className:`font-medium`,children:n(`还没有研究排期`,`No research timeline yet`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`点击“加载论文示例”即可验证完整流程,也可以在下方导入自己的 proposal。示例数字仅用于演示。`,`Load the paper example to try the complete flow, or import your proposal below. Example numbers are illustrative.`)})]}),r&&(0,U.jsxs)(`div`,{className:`grid items-start gap-6`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 360px), 1fr))`},children:[(0,U.jsxs)(`fieldset`,{disabled:m,className:`min-w-0 space-y-5`,children:[(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`选择 idea / proposal`,`Choose idea / proposal`),(0,U.jsx)(`select`,{"aria-label":n(`选择 idea / proposal`,`Choose idea / proposal`),className:Q,value:r.selected_proposal_id,onChange:e=>i({...r,selected_proposal_id:e.target.value}),children:r.proposals.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`方案名称`,`Proposal title`),(0,U.jsx)(`input`,{className:Q,value:r.proposals.find(e=>e.id===r.selected_proposal_id).title,onChange:e=>i({...r,proposals:r.proposals.map(t=>t.id===r.selected_proposal_id?{...t,title:e.target.value}:t)})})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`期望完成时间(小时)`,`Target finish (hours)`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`0`,step:`any`,value:r.deadline_hours??``,placeholder:n(`不限`,`No deadline`),onChange:e=>i({...r,deadline_hours:e.target.value===``?null:Number(e.target.value)})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`已过去时间(小时)`,`Elapsed time (hours)`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`0`,step:`any`,value:r.now_hours,onChange:e=>i({...r,now_hours:Number(e.target.value)})})]}),Object.entries(r.resources).map(([e,t])=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`可用槽位`,`available slots`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`1`,step:`1`,value:t,onChange:t=>i({...r,resources:{...r.resources,[e]:Number(t.target.value)}})})]},e))]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`所有时间从项目开始计时;例如 120 小时 = 第 5 天。资源按持续可用计算。`,`All times count from project start; 120 hours means day 5. Resources are assumed continuously available.`)}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:r.adapt_to_deadline??!1,onChange:e=>i({...r,adapt_to_deadline:e.target.checked})}),n(`根据期限自动重排任务、选择替代做法并更新区间`,`Adapt task order, execution options and estimate ranges to the deadline`)]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`缩短期限时优先调整关键路径;延长期限时恢复原做法和可选工作。替代做法可在任务中编辑。`,`Tighter deadlines prioritize the critical path; longer deadlines restore preferred approaches and optional work. Edit alternatives inside each task.`)}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:r.defer_optional,onChange:e=>i({...r,defer_optional:e.target.checked})}),n(`超期时延后可选任务,保留必需实验`,`Defer optional tasks when over deadline; keep required experiments`)]}),(0,U.jsx)(`button`,{className:$,onClick:()=>{let e=r.proposals.length+1;for(;r.proposals.some(t=>t.id===`idea-${e}`);)e++;let t=`idea-${e}`;i({...r,selected_proposal_id:t,proposals:[...r.proposals,{id:t,title:n(`新 proposal`,`New proposal`),tasks:[{id:`validation`,title:n(`关键假设验证`,`Validate the key premise`),phase:`validation`,duration_hours:[2,4,16],basis:n(`初步估计,待校准`,`Preliminary, uncalibrated estimate`)}]}]})},children:n(`添加候选方案`,`Add proposal`)})]}),(0,U.jsx)(vt,{input:r,onChange:i,text:n,forecast:g?void 0:s?.proposals.find(e=>e.id===r.selected_proposal_id)}),(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`本次保存 / 调整原因`,`Reason for this revision`),(0,U.jsx)(`textarea`,{"aria-label":n(`本次保存 / 调整原因`,`Reason for this revision`),className:Q,value:w,onChange:e=>E(e.target.value),placeholder:n(`说明为什么改变计划;延期请在具体任务中填写证据`,`Explain the change; add delay evidence on the affected task`)})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[a?n(`已保存 v${a.version}`,`Saved v${a.version}`):n(`未保存`,`Not saved`),j?n(` · 有未保存修改`,` · Unsaved changes`):``]}),(0,U.jsx)(`button`,{className:`${$} border-blue bg-blue/10`,disabled:!d||!j||!s||g||!!b||!w.trim(),onClick:async()=>{if(!(!r||!s||g||!w.trim())){h(!0),y(``),C(``);try{let t=await B.timelineSave(e,r,a?.version??0,w);o(t),i(t.input),c(t.report),E(``),C(n(`已保存版本 ${t.version},刷新页面后仍可查看。`,`Version ${t.version} saved. It survives a page refresh.`))}catch(e){y(e.message)}finally{h(!1)}}},children:n(`保存计划版本`,`Save timeline version`)})]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`保存计划不会启动实验。实际进展和失败原因由实验结果或操作者更新。`,`Saving a timeline does not start experiments. Update progress and failure reasons from actual results.`)})]})]}),(0,U.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[g&&(0,U.jsx)(`p`,{role:`status`,className:`text-sm text-ink-faint`,children:n(`正在更新排期…`,`Updating schedule…`)}),b&&(0,U.jsxs)(`p`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[n(`无法计算,请检查估计区间、依赖和资源:`,`Cannot calculate; check ranges, dependencies, and resources: `),b]}),!g&&s&&(0,U.jsx)(yt,{report:s,selectedId:r.selected_proposal_id,text:n})]})]}),(0,U.jsxs)(`details`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:n(`导入自己的 proposal(JSON)`,`Import your proposal (JSON)`)}),(0,U.jsx)(`textarea`,{className:`${Q} mt-3 font-mono`,rows:6,"aria-label":n(`Proposal JSON`,`Proposal JSON`),value:D,onChange:e=>O(e.target.value)}),(0,U.jsx)(`button`,{className:`${$} mt-2`,disabled:!d||m||!D.trim(),onClick:async()=>{h(!0),y(``);try{let e=JSON.parse(D);await B.timelineEstimate(e),i(bt(e)),E(n(`导入 proposal`,`Import proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`校验并导入`,`Validate and import`)})]})]})}var St=[{id:`timeline`,zh:`研究排期`,en:`Research timeline`,zhDesc:`比较 proposal 工期,安排实验,并追踪延期原因。`,enDesc:`Compare proposal estimates, schedule experiments, and track delays.`,icon:ye,color:`blue`},{id:`experiments`,zh:`运行进程`,en:`Execution`,zhDesc:`查看当前步骤、任务路线,以及团队里谁在做什么。`,enDesc:`Follow the current step, the task route, and who on the team is doing what.`,icon:we,color:`blue`},{id:`ide`,zh:`AI IDE`,en:`AI IDE`,zhDesc:`阅读项目文件,查看 Git 状态与 Argus 活动。`,enDesc:`Read project files, Git state, and Argus activity.`,icon:A,color:`emerald`}],Ct=[{id:`overview`,zh:`项目概览`,en:`Project overview`,icon:Te},...St];function wt(e){let{text:t}=H(),n=e.snapshot.mission_view?.mission.objective||e.status?.continuous?.objective||e.project.objective||``;return(0,U.jsxs)(`div`,{className:`overview-page`,children:[(0,U.jsx)(`section`,{className:`overview-hero overview-hero--plain`,children:(0,U.jsxs)(`div`,{className:`overview-hero__copy`,children:[(0,U.jsx)(`h1`,{children:e.snapshot.session.display_name||e.project.label}),(0,U.jsx)(`p`,{children:n||t(`尚未设置目标。`,`No objective has been set.`)}),(0,U.jsx)(oe,{session:e.snapshot.session})]})}),(0,U.jsx)(`div`,{className:`overview-section-heading`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{children:t(`项目工作区`,`Project workspace`)}),(0,U.jsx)(`p`,{children:t(`这些入口展示同一项目的排期、运行进程与代码工作区。`,`These views show the same project’s timeline, execution and code workspace.`)})]})}),(0,U.jsx)(`section`,{className:`module-grid`,children:St.map(n=>{let r=n.icon;return(0,U.jsxs)(`button`,{className:`module-card`,type:`button`,onClick:()=>e.navigate(n.id),children:[(0,U.jsx)(`span`,{className:`module-card__icon module-card__icon--${n.color}`,children:(0,U.jsx)(r,{size:20})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:t(n.zh,n.en)}),(0,U.jsx)(`p`,{children:t(n.zhDesc,n.enDesc)})]}),(0,U.jsx)(k,{size:16})]},n.id)})})]})}function Tt(e){let t=String(e.event_id??e.id??``);if(t)return t;let n=String(e.message_id??``);return n?`${e.type??``}:${n}:${e.kind??``}`:[e.type??``,e.ts??``,e.agent_layer??e.actor??``,e.kind??``,String(e.text??e.title??e.reason??``).slice(0,160)].join(`|`)}function Et(e,t){let n=[...e],r=new Map(n.map((e,t)=>[Tt(e),t]));return t.forEach(e=>{let t=Tt(e),i=r.get(t);i==null?(r.set(t,n.length),n.push(e)):n[i]={...n[i],...e}}),n.sort((e,t)=>Number(e.ts??0)-Number(t.ts??0)).slice(-600)}function Dt(e=!0){return r({queryKey:[`v2-projects`],queryFn:({signal:e})=>B.projects(e),enabled:e,refetchInterval:1e4})}function Ot(e,t=!0){let n=i(),[o,s]=(0,I.useState)([]),[c,l]=(0,I.useState)(!1),u=(0,I.useRef)(null),d=!!e&&t,f=r({queryKey:[`v2-snapshot`,e],queryFn:({signal:t})=>B.snapshot(e,t),enabled:d,refetchInterval:5e3}),p=r({queryKey:[`v2-status`,e],queryFn:({signal:t})=>B.status(e,t),enabled:d,refetchInterval:6e3}),m=r({queryKey:[`v2-events`,e],queryFn:({signal:t})=>B.events(e,220,t),enabled:d,refetchInterval:15e3});(0,I.useEffect)(()=>{s([]),l(!1)},[e]),(0,I.useEffect)(()=>{!e||!m.data||s(e=>Et(e,m.data))},[m.data,e]),(0,I.useEffect)(()=>{if(!e||!t){l(!1);return}let r=Le(e,t=>{s(e=>Et(e,[t])),u.current??=window.setTimeout(()=>{u.current=null,n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]})},900)},l);return()=>{r.close(),l(!1),u.current!=null&&(window.clearTimeout(u.current),u.current=null)}},[t,n,e]);let h=async()=>{e&&await Promise.all([n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]}),n.invalidateQueries({queryKey:[`v2-events`,e]})])},g=a({mutationFn:()=>B.startDaemon(e,f.data?.daemon_commands?.revision),onSuccess:h}),_=a({mutationFn:t=>B.stopDaemon(e,t,f.data?.daemon_commands?.revision),onSuccess:h}),v=(0,I.useMemo)(()=>{let e=[f,p,m].find(e=>e.error);return e?.error instanceof Error?e.error:null},[m,f,p]);return{snapshot:f,status:p,events:o,connected:c,refresh:h,controls:{start:g,stop:_},error:v}}function kt({sid:e,active:t}){let{locale:n}=p(),[r,i]=(0,I.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`module`);return Ct.find(t=>t.id===e)?.id??`overview`}),[a,o]=(0,I.useState)(()=>new Set([r])),s=(0,I.useCallback)(e=>{i(e),o(t=>t.has(e)?t:new Set([...t,e]))},[]),c=Dt(t),l=c.data?.projects??[],u=(0,I.useMemo)(()=>l.find(t=>t.id===e)??null,[l,e]),d=Ot(e,t),f=r,m=d.controls.start.error||d.controls.stop.error,h=u&&d.snapshot.data?{sid:e,active:t,project:u,snapshot:d.snapshot.data,status:d.status.data,events:d.events,connected:d.connected,snapshotUpdatedAt:d.snapshot.dataUpdatedAt,refresh:d.refresh,controls:{start:async()=>{try{return await d.controls.start.mutateAsync()}catch{return null}},stop:async e=>{try{return await d.controls.stop.mutateAsync(e)}catch{return null}},busy:d.controls.start.isPending||d.controls.stop.isPending,error:m instanceof Error?m.message:``},navigate:s}:null;return(0,U.jsxs)(`section`,{className:`integrated-workbench flex min-h-0 flex-1 flex-col bg-transparent text-ink`,children:[(0,U.jsx)(`nav`,{className:`workbench-module-tabs shrink-0 border-b border-line/60 px-3 py-2`,"aria-label":n===`zh-CN`?`工作台模块`:`Workbench modules`,children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Ct.map(({id:e,zh:t,en:r,icon:i})=>(0,U.jsxs)(`button`,{type:`button`,className:`workbench-module-tab`,"data-module":e,"data-selected":f===e,"aria-pressed":f===e,onClick:()=>s(e),children:[(0,U.jsx)(i,{size:14}),(0,U.jsx)(`span`,{children:n===`zh-CN`?t:r})]},e))})}),c.isError&&!u||d.snapshot.isError&&!d.snapshot.data?(0,U.jsx)(G,{title:n===`zh-CN`?`工作台读取失败`:`Workbench unavailable`,description:`Argus API did not return the selected project.`}):h?Ct.filter(({id:e})=>a.has(e)).map(({id:n})=>(0,U.jsx)(`div`,{className:`ros-content min-h-0 flex-1 overflow-x-hidden overflow-y-auto ${f===n?``:`hidden`}`,"aria-hidden":f!==n,children:n===`overview`?(0,U.jsx)(wt,{...h,active:t&&f===n}):n===`timeline`?(0,U.jsx)(xt,{sid:e}):n===`experiments`?(0,U.jsx)(ct,{...h,active:t&&f===n}):(0,U.jsx)(gt,{...h,active:t&&f===n})},`${e}:${n}`)):(0,U.jsx)(`div`,{className:`boot-state`,children:(0,U.jsx)(Ye,{label:n===`zh-CN`?`正在载入工作台`:`Loading workbench`})})]})}export{kt as ResearchWorkbenchPanel}; \ No newline at end of file diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-BmPuH7pM.js b/frontend/web/dist/assets/ResearchWorkbenchPanel-BmPuH7pM.js new file mode 100644 index 000000000..fa5040dbe --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-BmPuH7pM.js @@ -0,0 +1,12 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,c as i,n as a}from"./query-dCPZk0Xc.js";import{D as o,F as s,H as c,I as l,N as u,O as d,P as f,S as p,V as m}from"./index-DPfzOfKU.js";import{A as h,C as g,F as _,I as v,L as y,M as b,O as x,S,_ as C,b as w,j as T,n as E,s as D,w as O,x as k}from"./AppearanceControls-Bc1ibrT3.js";import{t as A}from"./activity-BEiyr9-4.js";import{a as j,i as M,n as ee,o as N,r as te,t as ne}from"./sliders-horizontal-CSN_5pyz.js";import{t as re}from"./code-xml-DnBfjec4.js";import{a as P,i as F}from"./useWorkbenchTheme-BqK4B8rm.js";import{Ct as ie,Dt as I,Et as ae,F as L,Ft as R,It as z,St as B,Tt as oe,_t as V,at as se,gt as H,it as ce,jt as le,l as ue,m as de,nt as fe,ot as pe,p as me,rt as he,tt as ge,vt as _e,wt as ve,x as ye,xt as be}from"./App-q-3YCWKy.js";var xe=y(`ArrowDownToLine`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Se=y(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ce=y(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),we=y(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),Te=y(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Ee=y(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),De=y(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),Oe=y(`FlaskConical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),ke=y(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ae=y(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),je=y(`LockKeyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Me=y(`Radio`,[[`path`,{d:`M4.9 19.1C1 15.2 1 8.8 4.9 4.9`,key:`1vaf9d`}],[`path`,{d:`M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5`,key:`u1ii0m`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5`,key:`1j5fej`}],[`path`,{d:`M19.1 4.9C23 8.8 23 15.1 19.1 19`,key:`10b0cb`}]]),Ne=y(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Pe=y(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Fe=y(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Ie=y(`UserRound`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Le=y(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),U=e(n(),1),Re=12e3;function W(e=!1){let t={...f()};return e&&(t[`Content-Type`]=`application/json`),t}async function G(e,t={}){await l();let n={...t,headers:{...W(!!t.body),...t.headers??{}},cache:`no-store`},r=String(t.method??`GET`).toUpperCase(),i=async n=>{if(!n.ok){let r=await n.text().catch(()=>``),i=r;try{i=JSON.parse(r).detail??r}catch{}throw Error(i||`${t.method??`GET`} ${e} failed (${n.status})`)}return await n.json()};return r===`GET`?m(e,n,Re,i):i(await fetch(e,n))}var K=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`,ze=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`;function Be(e){let t=e.replaceAll(`\r +`,` +`).split(` + +`),n=t.pop()??``,r=[];return t.forEach(e=>{e.split(` +`).forEach(e=>{if(e.startsWith(`data:`))try{let t=JSON.parse(e.slice(5).trim());r.push(t)}catch{}})}),{frames:r,rest:n}}function Ve(e,t){let n=String(e.type??``);if(n===`phase`)t.onPhase?.(String(e.label??``),String(e.role??`manager`),String(e.detail??``),e.heartbeat===!0);else if(n===`delta`)t.onDelta?.(String(e.text??``),String(e.fragment_mode??`auto`));else if(n===`done`){let n=e.result??{};return t.onDone?.(n),n}else if(n===`error`)throw Error(String(e.error??`Manager stream failed`));return null}var q={timelineExample:()=>G(`/api/research/timeline/example`),timelineEstimate:(e,t)=>G(`/api/research/timeline/estimate`,{method:`POST`,body:JSON.stringify(e),signal:t}),timelineLatest:e=>G(K(e,`/research/timeline`)),timelineSave:(e,t,n,r)=>G(K(e,`/research/timeline`),{method:`POST`,body:JSON.stringify({input:t,expected_version:n,reason:r})}),projects:e=>G(`/api/projects`,{signal:e}),snapshot:(e,t)=>G(K(e,`/snapshot?events_limit=40&compact=false`),{signal:t}),status:(e,t)=>G(K(e,`/status`),{signal:t}),events:(e,t=180,n)=>G(K(e,`/events?limit=${t}&view=ui`),{signal:n}).then(e=>e.events),transcript:(e,t=100,n)=>G(K(e,`/transcript?n=${t}`),{signal:n}).then(e=>e.turns),journal:(e,t=80,n)=>G(K(e,`/journal?n=${t}`),{signal:n}).then(e=>e.journal),artifacts:(e,t)=>G(K(e,`/artifacts`),{signal:t}).then(e=>e.artifacts),counterexamples:(e,t)=>G(K(e,`/counterexamples`),{signal:t}),artifact:(e,t,n)=>G(K(e,`/artifact?${new URLSearchParams({path:t})}`),{signal:n}),artifactBlob:async(e,t,n=!1,r)=>{await l();let i=new URLSearchParams({path:t});n&&i.set(`download`,`true`);let a=K(e,`/artifact/raw?${i}`);return m(a,{headers:W(),signal:r,cache:`no-store`},Re,async e=>{if(!e.ok)throw Error(`Artifact unavailable (${e.status})`);return e.blob()})},gitDiff:(e,t)=>G(K(e,`/git-diff`),{signal:t}),rewritePrompt:(e,t,n)=>G(K(e,`/prompt/rewrite`),{method:`POST`,body:JSON.stringify({text:t}),signal:n}),note:(e,t)=>G(K(e,`/note`),{method:`POST`,body:JSON.stringify({text:t})}),uploadAttachments:async(e,t,n)=>{await l();let r=new FormData;t.forEach(e=>r.append(`files`,e,e.name));let i=await fetch(K(e,`/attachments`),{method:`POST`,headers:W(),body:r,signal:n});if(!i.ok)throw Error(await i.text()||`attachment upload failed (${i.status})`);return await i.json()},createDaemon:(e,t=``,n=``)=>G(`/api/daemons`,{method:`POST`,body:JSON.stringify({objective:e,name:t,workdir:n,command_id:ze()})}),createFinalReview:(e,t)=>G(K(e,`/reviews/final`),{method:`POST`,body:JSON.stringify(t)}),startDaemon:(e,t)=>G(K(e,`/daemon/start`),{method:`POST`,body:JSON.stringify({command_id:ze(),expected_revision:t})}).then(c),stopDaemon:(e,t,n)=>G(K(e,`/daemon/stop`),{method:`POST`,body:JSON.stringify({drain:t,command_id:ze(),expected_revision:n})}).then(c),async messageStream(e,t,n={},r,i=[]){await l();let a=K(e,`/message/stream`),o=await fetch(a,{method:`POST`,headers:W(!0),body:JSON.stringify(i.length?{text:t,attachments:i}:{text:t}),signal:r});if(!o.ok){let e=await o.text().catch(()=>``);throw Error(e||`Manager request failed (${o.status})`)}if(!o.body)throw Error(`Manager returned an empty stream`);let s=o.body.getReader(),c=new TextDecoder,u=``,d={};for(;;){let e=await s.read();if(e.done)break;u+=c.decode(e.value,{stream:!0});let t=Be(u);u=t.rest,t.frames.forEach(e=>{let t=Ve(e,n);t&&(d=t)})}return Be(`${u}\n\n`).frames.forEach(e=>{let t=Ve(e,n);t&&(d=t)}),d}};function He(e,t,n){let r=!1,i=null,a,o=800,c=()=>{if(r)return;let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({replay:`40`,view:`ui`}),d=s();d&&u.set(`token`,d),i=new WebSocket(`${l}//${window.location.host}${K(e,`/stream`)}?${u}`),i.onopen=()=>{o=800,n(!0)},i.onmessage=e=>{try{t(JSON.parse(String(e.data)))}catch{}},i.onerror=()=>i?.close(),i.onclose=e=>{n(!1),!(r||e.code===4401||e.code===4404)&&(a=window.setTimeout(c,o),o=Math.min(o*1.7,8e3))}};return c(),{close:()=>{r=!0,a&&window.clearTimeout(a),i?.close()}}}var Ue={active:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],running:[`进行中`,`In progress`],working:[`进行中`,`In progress`],pending:[`等待中`,`Waiting`],queued:[`等待中`,`Waiting`],waiting:[`等待中`,`Waiting`],idle:[`等待中`,`Waiting`],accepted:[`已完成`,`Completed`],complete:[`已完成`,`Completed`],completed:[`已完成`,`Completed`],done:[`已完成`,`Completed`],success:[`已完成`,`Completed`],blocked:[`已阻塞`,`Blocked`],failed:[`失败`,`Failed`],error:[`失败`,`Failed`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],replan_requested:[`需要重新规划`,`Needs replanning`],incomplete:[`尚未完成`,`Incomplete`],research_incomplete:[`研究尚未完成`,`Research incomplete`],paused_no_breakthrough:[`暂未取得突破,已暂停`,`Paused without a breakthrough`],exhausted_current_methods:[`当前方法已尝试完`,`Current methods exhausted`],no_progress:[`暂无新进展,已暂停`,`Paused without new progress`],max_rounds:[`已到本次轮次上限`,`Round limit reached`],infra_blocked:[`等待运行条件恢复`,`Waiting for the runtime to recover`],supervisor_error:[`执行异常`,`Execution failed`],skipped:[`已跳过`,`Skipped`],paused:[`已暂停`,`Paused`],paused_cost:[`费用待对账`,`Awaiting usage reconciliation`],stopped:[`已暂停`,`Paused`],cancelled:[`已暂停`,`Paused`],aborted:[`已暂停`,`Paused`],not_started:[`等待中`,`Waiting`],healthy:[`状态正常`,`Healthy`],degraded:[`部分受限`,`Limited`]},We={system:[`Argus`,`Argus`],operator:[`你`,`You`],stopped:[`已暂停`,`Paused`],idle:[`等待中`,`Waiting`]};function Ge(e,t,n,r){let i=t[String(e??``).toLowerCase()]??n;return r(i[0],i[1])}function Ke(e,t){return String(e??``).startsWith(`paused_`)&&!Ue[String(e)]?t(`已暂停`,`Paused`):Ge(e,Ue,[`状态已更新`,`Status updated`],t)}function qe(e,t){let n=String(e??``).toLowerCase();return O(n)?g(n,e=>t(o(e,{},`zh-CN`),o(e,{},`en`))):Ge(e,We,[`Argus`,`Argus`],t)}function J(){let{locale:e,t}=d();return{locale:e,text:(0,U.useCallback)((t,n)=>e===`zh-CN`?t:n,[e]),t}}function Je(...e){return e.filter(Boolean).join(` `)}function Ye(e){let t=Math.max(0,Math.floor(Number(e??0)));if(t<60)return`${t}s`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n?`${n}d ${r}h`:r?`${r}h ${i}m`:`${i}m`}function Xe(e,t){return e?new Date(e*1e3).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):`—`}function Ze(e){let t=String(e??``).toLowerCase();return/failed|error|blocked|rejected|stalled|dead|abort/.test(t)?`danger`:/warn|waiting|paused|hold|queued|pending|continue/.test(t)?`warn`:/done|complete|completed|accepted|healthy|success|passed/.test(t)?`success`:/run|active|work|claimed|progress|live/.test(t)?`live`:/research|plan|info|ready/.test(t)?`info`:`neutral`}function Qe(e){let t=String(e.agent_layer??e.actor??``).toLowerCase();if(t===`main`||t.startsWith(`engineer`))return`engineer`;if(t.startsWith(`review`))return`reviewer`;if(t.startsWith(`plan`))return`planner`;if(t.startsWith(`manager`))return`manager`;let n=String(e.type??``);return/review/.test(n)?`reviewer`:/planner/.test(n)?`planner`:/manager/.test(n)?`manager`:/engineer|round/.test(n)?`engineer`:`system`}function $e(e,t){let n=String(e.action_summary??``).trim();if(n)return t?pe(n,t):n;let r=String(e.title??``).trim();if(r)return t?pe(r,t):r;let i=t?ce(String(e.type??``),t):null;if(i)return i;let a=String(e.kind??``).trim();return a?a.replaceAll(`_`,` `):String(e.type??`event`).split(`.`).slice(-2).join(` · `).replaceAll(`_`,` `)}function et(e,t=400){let n=String(e.text??e.reason??e.summary??e.detail??``).trim();return n?n.length>t?`${n.slice(0,t)}…`:n:``}var Y=t();function X({children:e,tone:t=`neutral`,dot:n=!1,className:r}){return(0,Y.jsxs)(`span`,{className:Je(`badge`,`badge--${t}`,r),children:[n?(0,Y.jsx)(`span`,{className:Je(`badge__dot`,t===`live`&&`is-pulsing`)}):null,e]})}function Z({icon:e=Ee,title:t,description:n,action:r}){return(0,Y.jsxs)(`div`,{className:`empty-state`,children:[(0,Y.jsx)(`span`,{className:`empty-state__icon`,children:(0,Y.jsx)(e,{size:19})}),(0,Y.jsx)(`div`,{className:`empty-state__title`,children:t}),n?(0,Y.jsx)(`p`,{children:n}):null,r?(0,Y.jsx)(`div`,{className:`empty-state__action`,children:r}):null]})}function tt({label:e}){let{text:t}=J();return(0,Y.jsxs)(`span`,{className:`spinner`,role:`status`,children:[(0,Y.jsx)(le,{size:15,className:`spin`}),` `,e||t(`加载中`,`Loading`)]})}function nt({events:e,limit:t=24,empty:n,dense:r=!1}){let{locale:i,text:a}=J(),o=e.slice(-t).reverse();return o.length?(0,Y.jsx)(`div`,{className:Je(`event-list`,r&&`event-list--dense`),children:o.map((e,t)=>{let n=Qe(e),o=$e(e,i),s=he(et(e,r?180:480),i).text,c=Ze(String(e.status??e.kind??e.type??``));return(0,Y.jsxs)(`article`,{className:`event-row`,children:[(0,Y.jsx)(`div`,{className:Je(`event-row__marker`,`event-row__marker--${c}`)}),(0,Y.jsxs)(`div`,{className:`event-row__content`,children:[(0,Y.jsxs)(`div`,{className:`event-row__meta`,children:[(0,Y.jsx)(`span`,{className:`role-label`,style:{color:k(n)},children:qe(n,a)}),(0,Y.jsx)(`time`,{children:Xe(e.ts,i)})]}),(0,Y.jsx)(`div`,{className:`event-row__title`,children:o}),s?(0,Y.jsx)(`div`,{className:`event-row__detail`,children:s}):null]})]},`${e.type}-${e.ts}-${e.message_id??t}`)})}):(0,Y.jsx)(Z,{icon:Me,title:n||a(`还没有可展示的实时动态`,`No activity to show yet`)})}var rt=new Set([`done`,`completed`,`accepted`,`success`]),it=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]),at=/continue|replan|reject|blocked|fail|error|incomplete|revoked/,ot=new Set([`assistant_message`,`agent_message`,`message`]),st=new Set([`life.planner.task_added`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.phase.started`,`life.manager.stage_decision`,`round.start`,`round.main.completed`,`round.review.started`,`round.review.completed`,`round.review.deferred`,`round.backend_failure.backoff`,`work.segment`,`work.segment.started`,`work.segment.completed`]);function ct(e){let t=String(e.type??``),n=String(e.kind??``);return n!==`reasoning`&&!p(e)&&(st.has(t)||t===`engineer.progress`&&(ot.has(n)||[`tool_use`,`tool_result`,`command_execution`,`file_change`].includes(n)))}function lt(e){return e.type!==`engineer.progress`||!ot.has(String(e.kind??``))?e:{...e,text:L(String(e.text??``)),action_summary:L(String(e.action_summary??``)),title:L(String(e.title??``))}}function ut(e,t){return t?e.backlog.find(e=>e.id===t)??null:e.backlog.find(e=>it.has(e.status))??e.backlog.find(e=>e.status===`pending`)??e.backlog.at(-1)??null}function dt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function ft(e,t,n=Date.now()/1e3,r=`zh-CN`){let i=(e,t)=>r===`zh-CN`?e:t,a=e.mission_view,o=H(e,a,t,n),s=ut(e,o.taskId||a?.mission.id||``),c=s?.id||a?.mission.id||``,l=!!(c&&c===a?.mission.id),u=a?.dag?.length?a.dag:e.backlog,d=u.filter(e=>rt.has(e.status)).length,f=u.filter(e=>/^(pending|queued|waiting)$/.test(e.status)).length,p=!!(a?.routing?.open_ended||a?.routing?.lifetime===`standing`||e.continuous?.open_ended),m=dt(s?.started_ts)??(l?dt(a?.mission.started_at):null),h=dt(s?.finished_ts)??(l?dt(a?.mission.completed_at):null),g=e.backlog.filter(e=>it.has(e.status)).length>1,_=t.filter(e=>{if(!c||m!==null&&Number(e.ts??0)Number(e.ts??0)-Number(t.ts??0)),v=_.filter(ct).map(lt).filter(e=>!ot.has(String(e.kind??``))||!!(e.text||e.action_summary||e.title)),y=v.at(-1),b=o.state===`running`,x=h??(e.daemon.alive?n:dt(_.at(-1)?.ts)??m),S=m===null||x===null?null:Math.max(0,x-m),C=[..._].reverse().find(e=>V(e)===c&&e.type===`round.start`),w=Math.max(l?Number(a?.round.current??0):0,Number(C?.round_index??0)),T=[..._].reverse().find(e=>V(e)===c&&e.type===`round.start`&&Number(e.round_index)===w),E=_.filter(e=>{if(V(e)!==c||w<=0||T&&Number(e.ts??0)0?t===w:T!=null&&Number(e.ts??0)>=Number(T.ts??0)}),D=[...E].reverse().find(e=>e.type===`round.review.completed`),O=[...E].reverse().find(e=>e.type===`round.review.started`),k=!!(O&&(!D||Number(O.ts)>Number(D.ts))),A=b&&o.role===`reviewer`&&k,j=k?void 0:D,M=String(j?.status??``).toLowerCase(),ee=l?String(a?.review.status??``).toLowerCase():``,N=j?.review_skipped===!0||M===`skipped`,te=j?.review_source===`engineer_self_review`,ne=!j?.review_source||j.review_source===`reviewer`,re=!N&&ne&&M===`done`,P=!N&&(at.test(M)||!j&&!A&&at.test(ee)),F=A?`running`:N?`skipped`:re?`passed`:te&&M===`done`?`self_checked`:P?`needs_work`:`pending`,ie={pending:i(`结论待核对`,`Conclusion awaiting review`),running:i(`正在核对证据`,`Checking the evidence`),passed:i(`本轮工作通过核对`,`This round passed review`),needs_work:i(`仍需补充或修改`,`More work is needed`),skipped:i(`本轮未做审查`,`This round was not reviewed`),self_checked:i(`执行者已自查,待独立核对`,`Self-checked; independent review pending`)},I={pending:i(`尚无能对应到当前工作项和轮次的通过记录。`,`No passing review is linked to the current work item and round.`),running:i(`审阅者正在核对本轮结果及其证据。`,`The Reviewer is checking this round’s results and evidence.`),passed:i(`通过记录仅适用于本轮提交的工作与证据。`,`The passing verdict applies to the work and evidence submitted in this round.`),needs_work:i(`审查发现仍有待处理的问题,需要继续工作。`,`The review found issues that require further work.`),skipped:i(`执行结束并不代表证据已经通过核对。`,`The end of execution does not establish that the evidence passed review.`),self_checked:i(`这条记录来自执行者自查,尚无本轮独立审查通过记录。`,`This record is a self-check by the worker; no independent passing review is recorded for this round.`)},ae={state:F,label:ie[F],detail:String(j?.reason||P&&a?.review.reason||I[F]),scope:i(`当前工作项${w>0?` · 第 ${w} 轮`:``}。整体目标是否成立,仍须核对其完整验收条件。`,`Current work item${w>0?` · Round ${w}`:``}. The overall goal still requires checking its full acceptance criteria.`)},L=[...E].reverse().find(e=>e.type===`round.main.completed`),R=F===`passed`?`done`:F===`running`?`active`:F===`needs_work`?`blocked`:`pending`,z=[{id:`plan`,label:i(`工作项已记录`,`Work item recorded`),detail:s?.title||a?.mission.title||i(`等待任务`,`Waiting for a task`),status:s||l?`done`:`pending`},{id:`start`,label:i(`开始执行`,`Execution started`),detail:m===null?i(`尚无启动记录`,`No start is recorded`):i(`有任务启动时间记录`,`A task start time is recorded`),status:m===null?`pending`:`done`},{id:`handoff`,label:i(`本轮执行已结束`,`Round execution ended`),detail:L?i(`已记录本轮执行结束,结果是否可用仍需核对`,`The round’s execution ended; its results still need to be checked`):i(`尚无本轮执行结束记录`,`No end of execution is recorded for this round`),status:L?`done`:b&&o.role===`engineer`?`active`:`pending`},{id:`review`,label:i(`核对本轮证据`,`Check this round’s evidence`),detail:ae.label,status:R}],B=!!(s&&rt.has(s.status))||l&&[`complete`,`completed`,`done`].includes(a?.mission.status??``),oe=e.daemon.alive?p?i(`开放研究的剩余工作量尚不确定,无法可靠预计整体完成时间。`,`Open research has no known remaining workload, so its overall finish time cannot be reliably estimated.`):P?i(`审查要求继续补充或调整工作范围,暂无法预计完成时间。`,`Review requires further work or a scope change; a finish time is unavailable.`):B?i(`当前工作项已结束;这不提供整体目标的完成时间。`,`The current work item has ended; this does not establish when the overall goal will be reached.`):i(`当前记录没有可比较的固定工作量基线,暂无法可靠预计完成时间。`,`The current records contain no comparable, fixed-workload baseline for a reliable finish-time estimate.`):i(`运行已停止,无法预计完成时间。`,`Execution has stopped; a finish time is unavailable.`);return{workCompletion:u.length?d/u.length:null,workScope:i(`仅统计已记录的工作项;清单可随研究增减,完成比例不代表整体目标已成立。`,`Counts recorded work items only. The list can change during research; its completion fraction does not establish the overall goal.`),currentTask:s?.title||a?.mission.title||i(`等待新任务`,`Waiting for a new task`),currentTaskId:c,currentObjective:s?.objective||(l?a?.mission.objective:``)||``,currentStep:b&&y?$e(y,r):_e(o,r),currentDetail:y?et(y,700):s?.objective||``,currentEvent:y??null,runtime:o,elapsedSeconds:S,etaUnavailableReason:oe,checkpoints:z,completedTasks:d,totalTasks:u.length,pendingTasks:f,openEnded:p,review:ae,acceptanceCriteria:s?.acceptance_check||u.find(e=>e.id===c)?.acceptance_check||``,nextAction:s?.pending_question||String(j?.next_action||``),taskEvents:v}}var pt=new Set([`done`,`completed`,`accepted`,`success`]),mt=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]);function ht(e){let{locale:t,text:n,t:r}=J(),[i,a]=(0,U.useState)(()=>Date.now()/1e3),[o,s]=(0,U.useState)(``);(0,U.useEffect)(()=>{if(!e.active||!e.snapshot.daemon.alive)return;a(Date.now()/1e3);let t=window.setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(t)},[e.active,e.snapshot.daemon.alive]);let c=(0,U.useMemo)(()=>ft(e.snapshot,e.events,i,t),[t,i,e.events,e.snapshot]),l=e.snapshot.mission_view,u=l?.dag?.length?l.dag:e.snapshot.backlog.map(e=>({id:e.id,title:e.title,objective:e.objective,status:e.status,deps:e.deps??[],branch_id:e.id,parent_branch_id:``})),d=u.find(e=>e.id===o)??u.find(e=>e.id===c.currentTaskId),f=se(l?.stage.id,t),p=l?.stage.label&&l.stage.label!==l.stage.id?l.stage.label:f||l?.stage.id||n(`尚未记录`,`Not yet recorded`),m=c.runtime.state===`running`,g=_e(c.runtime,t),_=c.taskEvents.filter(e=>String(e.kind??``)!==`reasoning`&&!fe(String(e.type??``))),y=he(c.currentDetail,t),x=c.currentEvent?ge(c.currentEvent,t):null,C=he(c.review.detail,t),T=[{label:n(`已完成的工作`,`Completed work`),items:u.filter(e=>pt.has(e.status))},{label:n(`进行中与待处理`,`Active and remaining work`),items:u.filter(e=>!pt.has(e.status))}],E=async t=>{let r=t?n(`确认完成当前步骤后停止 Argus?`,`Stop Argus after the current step finishes?`):n(`确认立即停止 Argus?当前步骤可能被中断。`,`Stop Argus now? The current step may be interrupted.`);confirm(r)&&await e.controls.stop(t)};return(0,Y.jsxs)(`div`,{className:`ros-page experiment-v3`,children:[(0,Y.jsxs)(`header`,{className:`ros-page-header`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h1`,{children:n(`任务进展`,`Work progress`)}),(0,Y.jsx)(`p`,{children:n(`看清做了哪些工作、结论核对到了哪里,以及团队接下来要做什么。`,`See what work was done, which conclusions were checked, and what the team needs to do next.`)})]}),(0,Y.jsxs)(`div`,{className:`experiment-header-actions`,children:[(0,Y.jsxs)(`button`,{className:`button button--secondary`,type:`button`,onClick:()=>void e.refresh(),children:[(0,Y.jsx)(b,{size:14}),n(`刷新`,`Refresh`)]}),e.snapshot.daemon.alive&&e.snapshot.daemon.control_available===!1?null:e.snapshot.daemon.alive?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{className:`button button--secondary`,type:`button`,disabled:e.controls.busy,onClick:()=>void E(!0),children:[(0,Y.jsx)(M,{size:14}),n(`当前步后停止`,`Stop after step`)]}),(0,Y.jsxs)(`button`,{className:`button button--danger`,type:`button`,disabled:e.controls.busy,onClick:()=>void E(!1),children:[(0,Y.jsx)(I,{size:13}),n(`立即停止`,`Stop now`)]})]}):(0,Y.jsxs)(`button`,{className:`button button--primary`,type:`button`,disabled:e.controls.busy,onClick:()=>void e.controls.start(),children:[(0,Y.jsx)(te,{size:14}),n(`继续运行`,`Resume`)]})]})]}),(0,Y.jsxs)(`section`,{className:`experiment-progress-hero`,children:[(0,Y.jsxs)(`div`,{className:`progress-hero-main`,children:[(0,Y.jsxs)(`div`,{className:`progress-live-line`,children:[(0,Y.jsx)(X,{tone:m?`live`:`neutral`,dot:m,children:g}),c.runtime.role?(0,Y.jsx)(`span`,{children:qe(c.runtime.role,n)}):null]}),(0,Y.jsx)(`h2`,{children:c.currentTask}),c.currentObjective?(0,Y.jsx)(`p`,{className:`work-objective`,children:c.currentObjective}):null,(0,Y.jsxs)(`div`,{className:`current-step-callout`,children:[(0,Y.jsx)(`span`,{children:(0,Y.jsx)(A,{size:17})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`small`,{children:m?n(`当前动作`,`Current action`):n(`当前状态与最近记录`,`Current state and latest record`)}),(0,Y.jsx)(`strong`,{children:x?.title||c.currentStep}),x?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{children:x.detail}),(0,Y.jsx)(D,{label:n(`原始调用记录`,`Original call record`),children:(0,Y.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs`,children:c.currentDetail})})]}):c.currentDetail?(0,Y.jsx)(`p`,{title:y.technical||void 0,children:y.text}):null]})]})]}),(0,Y.jsxs)(`div`,{className:`progress-number`,children:[(0,Y.jsx)(`span`,{children:n(`已完成的工作项`,`Completed work items`)}),(0,Y.jsxs)(`strong`,{children:[c.completedTasks,(0,Y.jsxs)(`em`,{children:[` / `,c.totalTasks||`—`]})]}),(0,Y.jsx)(`small`,{children:n(`按当前记录计数`,`Counted from current records`)})]}),(0,Y.jsxs)(`div`,{className:`truthful-progress`,children:[c.workCompletion===null?null:(0,Y.jsx)(`div`,{className:`truthful-progress__track`,role:`progressbar`,"aria-label":n(`已记录工作项的完成情况`,`Completion of recorded work items`),"aria-valuemin":0,"aria-valuemax":c.totalTasks,"aria-valuenow":c.completedTasks,"aria-valuetext":n(`${c.totalTasks} 项已记录工作中完成 ${c.completedTasks} 项`,`${c.completedTasks} of ${c.totalTasks} recorded work items completed`),children:(0,Y.jsx)(`span`,{className:`confirmed`,style:{width:`${c.workCompletion*100}%`}})}),(0,Y.jsx)(`p`,{className:`work-scope`,children:c.workScope})]}),(0,Y.jsxs)(`div`,{className:`progress-metrics`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(N,{size:15}),n(`当前工作项已用时间`,`Current work item elapsed`)]}),(0,Y.jsx)(`strong`,{children:c.elapsedSeconds===null?`—`:Ye(c.elapsedSeconds)}),(0,Y.jsx)(`small`,{children:n(`按任务启动与结束记录计算`,`Based on recorded task start and end times`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`实际记录的阶段`,`Recorded stage`)}),(0,Y.jsx)(`strong`,{children:p}),(0,Y.jsx)(`small`,{children:n(`阶段名称不表示前面的工作已通过核验`,`The stage name does not certify earlier work`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:n(`工作范围`,`Work scope`)}),(0,Y.jsx)(`strong`,{children:c.openEnded?n(`开放研究`,`Open research`):n(`当前工作项`,`Current work item`)}),(0,Y.jsx)(`small`,{children:c.openEnded?n(`可能产生新的问题和任务`,`New questions and tasks may emerge`):n(`以该工作项的验收条件为准`,`Defined by this item’s acceptance criteria`)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(Le,{size:15}),n(`等待执行的工作`,`Work waiting to start`)]}),(0,Y.jsx)(`strong`,{children:c.pendingTasks}),(0,Y.jsx)(`small`,{children:n(`已记录清单中的等待项`,`Waiting items in the recorded list`)})]})]})]}),(0,Y.jsxs)(`div`,{className:`experiment-v3-grid`,children:[(0,Y.jsxs)(`aside`,{className:`ros-card experiment-task-route`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`工作项`,`Work items`)})}),(0,Y.jsx)(X,{tone:`neutral`,children:u.length})]}),(0,Y.jsx)(`div`,{children:u.length?T.map(e=>(0,Y.jsxs)(`section`,{className:`work-item-group`,children:[(0,Y.jsxs)(`h3`,{children:[e.label,(0,Y.jsx)(`span`,{children:e.items.length})]}),e.items.length?e.items.map(e=>{let t=m&&e.id===c.currentTaskId&&mt.has(e.status),r=mt.has(e.status)&&!t?e.id===c.currentTaskId?g:n(`等待状态确认`,`Awaiting status confirmation`):Ke(e.status,n);return(0,Y.jsxs)(`button`,{type:`button`,className:d?.id===e.id?`is-active`:``,onClick:()=>s(e.id),children:[(0,Y.jsx)(`span`,{className:`task-state task-state--${pt.has(e.status)?`success`:t?`live`:`neutral`}`,children:pt.has(e.status)?(0,Y.jsx)(v,{size:12}):t?(0,Y.jsx)(A,{size:12}):(0,Y.jsx)(Ce,{size:9})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.title||e.objective||n(`未命名任务`,`Untitled task`)}),(0,Y.jsxs)(`small`,{children:[r,e.deps.length?n(` · 前置工作 ${e.deps.length} 项`,` · ${e.deps.length} dependencies`):``]})]})]},e.id)}):(0,Y.jsx)(`p`,{className:`work-group-empty`,children:n(`暂无记录`,`No records yet`)})]},e.label)):(0,Y.jsx)(Z,{icon:Le,title:n(`尚无工作项`,`No work items yet`)})})]}),(0,Y.jsxs)(`main`,{className:`experiment-v3-center`,children:[(0,Y.jsxs)(`section`,{className:`ros-card work-conclusion`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`本轮结论与待核对问题`,`This round’s conclusions and open checks`)})}),(0,Y.jsx)(X,{tone:c.review.state===`passed`?`success`:c.review.state===`running`?`live`:`warn`,children:c.review.label})]}),(0,Y.jsxs)(`div`,{className:`work-conclusion__body`,children:[(0,Y.jsx)(`p`,{title:C.technical||void 0,children:C.text}),c.acceptanceCriteria?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:n(`判断这项工作是否完成的标准`,`How this work item is accepted`)}),(0,Y.jsx)(`p`,{children:c.acceptanceCriteria})]}):null,c.nextAction?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:n(`下一步要处理`,`What needs to happen next`)}),(0,Y.jsx)(`p`,{children:c.nextAction})]}):null,(0,Y.jsx)(`p`,{className:`work-scope`,children:c.review.scope})]})]}),(0,Y.jsxs)(`section`,{className:`ros-card checkpoint-card`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`当前工作项的过程记录`,`Current work item’s recorded steps`)})}),(0,Y.jsx)(X,{tone:`neutral`,children:n(`以记录为准`,`Based on records`)})]}),(0,Y.jsx)(`div`,{className:`checkpoint-list`,children:c.checkpoints.map((e,t)=>(0,Y.jsxs)(`div`,{className:`checkpoint checkpoint--${e.status}`,children:[(0,Y.jsx)(`span`,{children:e.status===`done`?(0,Y.jsx)(v,{size:13}):e.status===`active`?(0,Y.jsx)(A,{size:13}):e.status===`blocked`?(0,Y.jsx)(oe,{size:13}):t+1}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.label}),(0,Y.jsx)(`p`,{children:e.detail})]}),t{let t=m&&c.runtime.role===e;return(0,Y.jsxs)(`article`,{className:t?`is-active`:``,children:[(0,Y.jsx)(`span`,{"data-role-dot":e,className:`role-dot`,style:{backgroundColor:k(e)},"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:qe(e,n)}),(0,Y.jsx)(`p`,{children:S(e,r)})]}),t?(0,Y.jsx)(X,{tone:`live`,dot:!0,children:n(`执行中`,`Working`)}):(0,Y.jsx)(X,{tone:`neutral`,children:n(`未在执行`,`Not working`)})]},e)})})]}),(0,Y.jsxs)(`section`,{className:`ros-card estimate-note`,children:[(0,Y.jsx)(`header`,{children:(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h2`,{children:n(`还需要多久`,`How much longer?`)})})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`strong`,{children:n(`暂无法可靠预计`,`No reliable estimate yet`)}),c.etaUnavailableReason]}),(0,Y.jsxs)(`div`,{className:`work-evidence-note`,children:[(0,Y.jsx)(h,{size:15}),(0,Y.jsx)(`span`,{children:n(`真实已用时间和已完成工作可以统计。读文件、运行命令或审查结束,都不能换算成整体目标的完成百分比。`,`Elapsed time and completed work can be counted. File reads, commands, and the end of a review do not establish a completion percentage for the overall goal.`)})]}),e.controls.error?(0,Y.jsx)(`div`,{className:`inline-error`,children:e.controls.error}):null]})]})]})]})]})}function gt(e){if(!e||e.length>2e5||e.includes(`\0`)||!e.startsWith(`diff --git `)&&!/^--- [^\n]+\n\+\+\+ /.test(e)||/^(?:Binary files |GIT binary patch)/m.test(e))return null;let t=e.match(/[^\n]*\n|[^\n]+$/g)??[];if(t.length>3e3)return null;let n=[],r=0,i=0;for(let e of t){let t=e.replace(/\r?\n$/,``),a,o=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@(?:.*)$/.exec(t);if(t.startsWith(`diff --git `))a=`header`,r=0,i=0;else if(o){if(a=`hunk`,r=Number(o[1]??1),i=Number(o[2]??1),!Number.isSafeInteger(r)||!Number.isSafeInteger(i))return null}else if(t===`\\ No newline at end of file`)a=`header`;else if(r||i){if(t.startsWith(`+`))a=`addition`,i--;else if(t.startsWith(`-`))a=`deletion`,r--;else if(t.startsWith(` `))a=`context`,r--,i--;else return null;if(r<0||i<0)return null}else if(/^(?:--- |\+\+\+ |index |old mode |new mode |new file mode |deleted file mode |similarity index |dissimilarity index |rename from |rename to |copy from |copy to )/.test(t))a=`header`;else return null;n.push({kind:a,text:e})}return n}function _t({diff:e,truncated:t=!1}){let{text:n}=J(),r=(0,U.useMemo)(()=>gt(e),[e]),[i,a]=(0,U.useState)(!1),o=r!==null&&!i;return(0,Y.jsxs)(`section`,{className:`readonly-diff`,"data-readonly-diff":!0,children:[(0,Y.jsxs)(`div`,{className:`readonly-diff__toolbar`,children:[(0,Y.jsx)(`strong`,{children:n(`当前工作区差异`,`Current workspace diff`)}),r&&(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?n(`着色视图`,`Highlighted view`):n(`原始文本`,`Original text`)}),e&&(0,Y.jsx)(C,{text:e,label:n(`复制原始差异`,`Copy original diff`),copiedLabel:n(`已复制`,`Copied`)})]}),(0,Y.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`不代表所有变更都来自当前 Agent 或任务。`,`Changes are not necessarily from this Agent or task.`)}),t&&(0,Y.jsx)(`p`,{role:`status`,className:`readonly-diff__notice`,children:n(`后端返回的差异已截断,当前内容不完整。`,`The backend truncated this diff; the displayed content is incomplete.`)}),e?r?null:(0,Y.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`无法识别、二进制或较大差异:显示原始文本。`,`Unrecognized, binary or large diff: showing original text.`)}):(0,Y.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`没有工作区差异。`,`No workspace diff.`)}),(0,Y.jsx)(`pre`,{className:`readonly-diff__text`,tabIndex:0,"aria-label":n(`工作区差异文本`,`Workspace diff text`),"data-diff-mode":o?`highlighted`:`raw`,children:o?r.map((e,t)=>(0,Y.jsx)(`span`,{"data-diff-kind":e.kind,className:`readonly-diff__line--${e.kind}`,children:e.text},t)):e})]})}async function vt(e,t,n){let r=new URLSearchParams(t),i=await fetch(`${e}?${r}`,{headers:W(),signal:n,cache:`no-store`});if(!i.ok){let t=await i.json().catch(()=>({}));throw Error(t.detail||t.error||`${e} failed (${i.status})`)}return i.json()}var yt=(e,t)=>({sid:e,workspace_id:t}),bt={profiles:(e,t)=>vt(`/api/v2/workspaces`,{sid:e},t),tree:(e,t,n)=>vt(`/api/v2/workspace/tree`,yt(e,t),n),file:(e,t,n,r)=>vt(`/api/v2/workspace/file`,{...yt(e,t),path:n},r),git:(e,t,n)=>vt(`/api/v2/workspace/git`,yt(e,t),n),literature:(e,t,n)=>vt(`/api/v2/workspace/literature`,yt(e,t),n),rawUrl:(e,t,n)=>`/api/v2/workspace/raw?${new URLSearchParams({...yt(e,t),path:n})}`,rawBlob:async(e,t,n,r)=>{let i=await fetch(`/api/v2/workspace/raw?${new URLSearchParams({...yt(e,t),path:n})}`,{headers:W(),signal:r,cache:`no-store`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`raw preview failed (${i.status})`)}return i.blob()}};function xt(e){let t=new Map;e.forEach(e=>t.set(e.path,{...e,children:[]}));let n=[];t.forEach(e=>{let r=e.path.lastIndexOf(`/`),i=r>=0?e.path.slice(0,r):``,a=i?t.get(i):null;a?a.children.push(e):n.push(e)});let r=e=>{e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1),e.forEach(e=>r(e.children))};return r(n),n}function St(e,t,n){let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(``);return(0,U.useEffect)(()=>{if(i(``),o(``),!e||!t||!n)return;let r=new AbortController,a=``;return bt.rawBlob(e,t,n,r.signal).then(e=>{a=URL.createObjectURL(e),i(a)},e=>{r.signal.aborted||o(e.message)}),()=>{r.abort(),a&&URL.revokeObjectURL(a)}},[n,e,t]),{url:r,error:a}}function Ct(e,t,n=!0){let i=r({queryKey:[`workspace-profiles`,e],queryFn:({signal:t})=>bt.profiles(e,t),staleTime:1e4,enabled:!!e&&n}),a=`argus-v2-workspace-profile:${t}:${e}`,[o,s]=(0,U.useState)(()=>F(a)||``),c=(0,U.useMemo)(()=>{let e=i.data?.profiles??[];return e.find(e=>e.id===o)??e.find(e=>e.id===i.data?.default_id)??e.find(e=>e.canonical)??e[0]??null},[i.data,o]);return(0,U.useEffect)(()=>{c&&c.id!==o&&s(c.id)},[c,o]),{profiles:i,active:c,workspaceId:c?.id??``,setWorkspaceId:e=>{s(e),P(a,e)}}}function wt({node:e,depth:t,selected:n,expanded:r,onToggle:i,onSelect:a}){let o=e.type===`directory`,s=r.has(e.path);return(0,Y.jsxs)(`div`,{className:`workspace-node`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:n===e.path?`is-selected`:``,style:{paddingLeft:7+t*13},onClick:()=>o?i(e.path):a(e.path),children:[o?s?(0,Y.jsx)(_,{size:13}):(0,Y.jsx)(z,{size:13}):(0,Y.jsx)(`span`,{className:`node-spacer`}),o?(0,Y.jsx)(ke,{size:14}):(0,Y.jsx)(Te,{size:14}),(0,Y.jsx)(`span`,{children:e.name}),e.skipped?(0,Y.jsx)(`small`,{children:`restricted`}):null]}),o&&s?e.children.map(e=>(0,Y.jsx)(wt,{node:e,depth:t+1,selected:n,expanded:r,onToggle:i,onSelect:a},e.path)):null]})}function Tt({sid:e,workspaceId:t,path:n,active:i}){let{text:a}=J(),o=n.toLowerCase().slice(n.lastIndexOf(`.`)),s=[`.pdf`,`.png`,`.jpg`,`.jpeg`,`.webp`,`.svg`].includes(o),c=r({queryKey:[`workspace-file`,e,t,n],queryFn:({signal:r})=>bt.file(e,t,n,r),enabled:!!(i&&n&&t&&!s),refetchInterval:5e3}),l=St(s?e:``,s?t:``,s?n:``);if(!n)return(0,Y.jsx)(Z,{icon:Ee,title:a(`打开一个文件开始阅读`,`Open a file to start reading`),description:a(`左侧文件树展示所选代码工作区。`,`The file tree shows the selected code workspace.`)});if(s)return l.error?(0,Y.jsx)(Z,{icon:je,title:`Preview unavailable`,description:l.error}):l.url?o===`.pdf`?(0,Y.jsx)(ue,{src:l.url,name:n.split(`/`).at(-1)||n,className:`workspace-pdf`}):(0,Y.jsx)(`img`,{className:`workspace-image`,src:l.url,alt:n}):(0,Y.jsx)(`div`,{className:`editor-loading`,children:`Loading preview…`});if(c.isLoading)return(0,Y.jsxs)(`div`,{className:`editor-loading`,children:[`Opening `,n,`…`]});if(c.isError)return(0,Y.jsx)(Z,{icon:je,title:`Preview unavailable`,description:c.error.message});let u=(c.data?.content??``).split(` +`);return(0,Y.jsxs)(`div`,{className:`vscode-code`,tabIndex:0,"aria-label":a(`文件内容`,`File contents`),children:[(0,Y.jsx)(`div`,{className:`vscode-line-numbers`,children:u.map((e,t)=>(0,Y.jsx)(`span`,{children:t+1},t))}),(0,Y.jsx)(`pre`,{children:(0,Y.jsx)(`code`,{children:c.data?.content})})]})}function Et(e){let{locale:t,text:n}=J(),i=Ct(e.sid,`ide`,e.active),a=i.workspaceId,o=i.active?.path||``,[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(new Set),d=(0,U.useRef)(``),f=(0,U.useRef)(null),p=e=>{c(e);let t=f.current,n=t?.closest(`.vscode-shell`),r=t?.closest(`.ros-content`);t&&n&&r&&getComputedStyle(n).display===`flex`&&r.scrollTo({top:r.scrollTop+t.getBoundingClientRect().top-r.getBoundingClientRect().top-12,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[m,h]=(0,U.useState)(`files`),[g,y]=(0,U.useState)(`repository`),S=r({queryKey:[`workspace-tree`,e.sid,a],queryFn:({signal:t})=>bt.tree(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),C=r({queryKey:[`workspace-git`,e.sid,a],queryFn:({signal:t})=>bt.git(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),w=(0,U.useMemo)(()=>xt(S.data?.entries??[]),[S.data?.entries]);(0,U.useEffect)(()=>{c(``),u(new Set),d.current=``},[a]),(0,U.useEffect)(()=>{!a||!w.length||d.current===a||(d.current=a,u(new Set(w.filter(e=>e.type===`directory`).slice(0,5).map(e=>e.path))))},[w,a]);let T=e.events.filter(e=>[`command_execution`,`tool_use`,`tool_result`,`file_change`].includes(String(e.kind??``))).slice(-100),E=(C.data?.status??``).split(` +`).filter(Boolean),D=(C.data?.log??``).split(` +`).filter(Boolean).map(e=>{let[t,n,r,...i]=e.split(` `);return{hash:t,date:n,author:r,subject:i.join(` `)}}),O=C.data;return(0,Y.jsxs)(`div`,{className:`ros-page ide-v3`,children:[(0,Y.jsxs)(`header`,{className:`ros-page-header`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`eyebrow`,children:`AI IDE`}),(0,Y.jsx)(`h1`,{children:n(`代码工作区`,`Code workspace`)}),(0,Y.jsx)(`p`,{children:n(`此视图只用于浏览文件、Git 状态与 Argus 活动;不限制 Agent 本身的文件写入权限。`,`This view only browses files, Git state and Argus activity; it does not restrict the Agent’s file write permissions.`)})]}),(0,Y.jsxs)(X,{tone:`info`,children:[(0,Y.jsx)(je,{size:12}),n(`此视图只读`,`This view is read-only`)]})]}),(0,Y.jsxs)(`div`,{className:`ide-context-strip`,children:[(0,Y.jsx)(Ne,{size:15}),(0,Y.jsx)(`select`,{"aria-label":n(`选择已批准工作区`,`Select approved workspace`),value:a,onChange:e=>i.setWorkspaceId(e.target.value),children:i.profiles.data?.profiles.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,Y.jsx)(`code`,{children:o}),S.isError?(0,Y.jsx)(X,{tone:`danger`,children:n(`连接失败`,`Connection failed`)}):S.isFetching?(0,Y.jsx)(X,{tone:`live`,dot:!0,children:n(`同步中`,`Syncing`)}):(0,Y.jsxs)(X,{tone:`success`,children:[(0,Y.jsx)(R,{size:11}),`Synced`]}),(0,Y.jsxs)(`small`,{children:[S.data?.entries.length??0,` entries`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{S.refetch(),C.refetch()},"aria-label":n(`刷新工作区`,`Refresh workspace`),children:(0,Y.jsx)(b,{size:14})})]}),(0,Y.jsxs)(`div`,{className:`vscode-shell`,children:[(0,Y.jsxs)(`nav`,{className:`vscode-activitybar`,children:[(0,Y.jsx)(`button`,{type:`button`,className:m===`files`?`is-active`:``,onClick:()=>h(`files`),title:`Explorer`,"aria-label":`Explorer`,children:(0,Y.jsx)(De,{size:21})}),(0,Y.jsxs)(`button`,{type:`button`,className:m===`git`?`is-active`:``,onClick:()=>h(`git`),title:`Source Control`,"aria-label":`Source Control`,children:[(0,Y.jsx)(j,{size:21}),E.length?(0,Y.jsx)(`i`,{children:E.length}):null]})]}),(0,Y.jsxs)(`aside`,{className:`vscode-sidebar`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`span`,{children:m===`git`?`SOURCE CONTROL`:`EXPLORER`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void S.refetch(),"aria-label":n(`刷新文件树`,`Refresh file tree`),children:(0,Y.jsx)(b,{size:14})})]}),m===`files`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`vscode-root`,children:[(0,Y.jsx)(_,{size:13}),(0,Y.jsx)(`strong`,{title:o,children:o.split(/[\\/]/).filter(Boolean).at(-1)||o})]}),(0,Y.jsx)(`div`,{className:`workspace-tree`,children:S.isError?(0,Y.jsx)(Z,{icon:Ne,title:n(`目录连接失败`,`Directory connection failed`),description:S.error.message}):w.map(e=>(0,Y.jsx)(wt,{node:e,depth:0,selected:s,expanded:l,onToggle:e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:p},e.path))})]}):(0,Y.jsx)(`div`,{className:`vscode-changes`,children:E.length?E.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{let t=e.slice(3).trim(),n=t.includes(` -> `)?t.split(` -> `).at(-1):t;n.endsWith(`/`)||p(n)},children:[(0,Y.jsx)(`b`,{children:e.slice(0,2).trim()||`?`}),(0,Y.jsx)(`span`,{children:e.slice(3)})]},e)):(0,Y.jsx)(`p`,{children:`No changes`})})]}),(0,Y.jsxs)(`main`,{className:`vscode-editor`,ref:f,children:[(0,Y.jsx)(`div`,{className:`vscode-tabs`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`is-active`,children:[(0,Y.jsx)(re,{size:13}),s||`Welcome`]})}),(0,Y.jsx)(`div`,{className:`vscode-breadcrumbs`,children:s?s.split(`/`).map((e,t)=>(0,Y.jsxs)(`span`,{children:[e,ty(`changes`),children:`Changes`}),(0,Y.jsx)(`button`,{type:`button`,className:g===`timeline`?`is-active`:``,onClick:()=>y(`timeline`),children:`Timeline`}),(0,Y.jsx)(`button`,{type:`button`,className:g===`repository`?`is-active`:``,onClick:()=>y(`repository`),children:`Repository`})]}),(0,Y.jsx)(`div`,{className:`vscode-git-content`,children:O?.available?g===`changes`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`vscode-status`,children:O.status||`Working tree clean`}),(0,Y.jsx)(_t,{diff:O.diff,truncated:O.truncated})]}):g===`timeline`?(0,Y.jsx)(`div`,{className:`vscode-commits`,children:D.map(e=>(0,Y.jsxs)(`article`,{children:[(0,Y.jsx)(j,{size:13}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`strong`,{children:e.subject}),(0,Y.jsxs)(`small`,{children:[e.author,` · `,e.date?.slice(0,10)]})]})]},e.hash))}):(0,Y.jsxs)(`div`,{className:`repository-readiness`,children:[(0,Y.jsx)(`h3`,{children:`Repository readiness`}),(0,Y.jsxs)(`dl`,{children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(j,{size:13}),`Remote`]}),(0,Y.jsx)(`dd`,{children:O.remotes.length?O.remotes.map(e=>`${e.name}: ${e.fetch}`).join(` +`):`Not configured`}),(0,Y.jsx)(`i`,{className:O.remotes.length?`ok`:`missing`,children:O.remotes.length?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(j,{size:13}),`Upstream`]}),(0,Y.jsxs)(`dd`,{children:[O.upstream||`Not configured`,O.upstream?` · ahead ${O.ahead}, behind ${O.behind}`:``]}),(0,Y.jsx)(`i`,{className:O.upstream?`ok`:`missing`,children:O.upstream?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(Ie,{size:13}),`Commit identity`]}),(0,Y.jsx)(`dd`,{children:O.identity.name&&O.identity.email?`${O.identity.name} <${O.identity.email}>`:`Not configured`}),(0,Y.jsx)(`i`,{className:O.identity.valid?`ok`:`missing`,children:O.identity.valid?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`dt`,{children:[(0,Y.jsx)(Ae,{size:13}),`GitHub CLI`]}),(0,Y.jsx)(`dd`,{children:O.github.authenticated?`${O.github.login} · ${O.github.protocol}`:`Not authenticated`}),(0,Y.jsx)(`i`,{className:O.github.authenticated?`ok`:`missing`,children:O.github.authenticated?(0,Y.jsx)(v,{size:12}):(0,Y.jsx)(x,{size:12})})]})]}),(0,Y.jsx)(`p`,{children:O.publish_ready?`Repository is ready for an explicitly approved push.`:`Configure the missing items before publishing. No credentials are shown in this UI.`})]}):(0,Y.jsx)(Z,{icon:j,title:`Not a Git repository`})})]}),(0,Y.jsxs)(`section`,{className:`vscode-terminal`,children:[(0,Y.jsxs)(`header`,{children:[(0,Y.jsx)(`strong`,{children:`ARGUS ACTIVITY`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(Fe,{size:13}),`read-only`]})]}),(0,Y.jsx)(`div`,{children:T.length?T.map((e,r)=>(0,Y.jsxs)(`article`,{children:[(0,Y.jsx)(`time`,{children:Xe(e.ts,t)}),(0,Y.jsx)(`b`,{className:`terminal-role`,style:{color:k(Qe(e))},children:qe(Qe(e),n)}),(0,Y.jsx)(`span`,{children:`›`}),(0,Y.jsx)(`code`,{children:et(e,800)||$e(e)})]},`${e.ts}-${r}`)):(0,Y.jsx)(`p`,{children:`$ waiting for Argus activity`})})]}),(0,Y.jsxs)(`footer`,{className:`vscode-statusbar`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(j,{size:12}),O?.branch||`no branch`]}),(0,Y.jsx)(`span`,{children:S.isError?`Workspace error`:S.isFetching?`Workspace syncing`:S.data?.truncated?`Tree truncated`:`Workspace synced`}),(0,Y.jsx)(`span`,{children:O?.github.authenticated?`GitHub: ${O.github.login}`:`GitHub: offline`}),(0,Y.jsx)(`span`,{children:`UTF-8`}),(0,Y.jsx)(`span`,{children:s.split(`.`).at(-1)?.toUpperCase()||`Plain Text`})]})]})]})}var Dt=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm`;function Ot({task:e,resources:t,onChange:n,text:r}){let i=e.execution_options??[],a=(e,t)=>n(i.map(n=>n.id===e?{...n,...t}:n));return(0,Y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-dashed border-line p-3 sm:col-span-2`,children:[(0,Y.jsx)(`h4`,{className:`text-sm font-medium`,children:r(`期限紧张时的替代做法`,`Alternative execution options for tighter deadlines`)}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:r(`每种做法都有独立工期、资源和取舍。系统只会选择已声明保留必需验收目标的方案,不自动压缩原估计。`,`Each option has its own estimate, resources and tradeoff. Only options declared to preserve required acceptance scope can be selected.`)}),i.map(o=>(0,Y.jsxs)(`fieldset`,{disabled:e.status!=null&&e.status!==`pending`,className:`grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`text-xs sm:col-span-2`,children:[r(`替代做法`,`Alternative approach`),(0,Y.jsx)(`input`,{className:Dt,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:col-span-2`,children:[r(`替代下限(小时)`,`Option lower (h)`),r(`替代最可能(小时)`,`Option likely (h)`),r(`替代上限(小时)`,`Option upper (h)`)].map((e,t)=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,(0,Y.jsx)(`input`,{className:Dt,type:`number`,min:`0`,step:`any`,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),t.map(e=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,` `,r(`需求`,`required`),(0,Y.jsx)(`input`,{className:Dt,type:`number`,min:`0`,step:`1`,value:o.resources[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e)),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[r(`替代工期依据`,`Option estimate basis`),(0,Y.jsx)(`textarea`,{"aria-label":r(`替代工期依据`,`Option estimate basis`),className:Dt,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[r(`取舍与适用条件`,`Tradeoff and prerequisites`),(0,Y.jsx)(`textarea`,{"aria-label":r(`取舍与适用条件`,`Tradeoff and prerequisites`),className:Dt,value:o.tradeoff,onChange:e=>a(o.id,{tradeoff:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`flex gap-2 text-xs sm:col-span-2`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:o.preserves_acceptance,onChange:e=>a(o.id,{preserves_acceptance:e.target.checked})}),r(`确认条件适用且保留必需验收目标,允许重排时采用`,`Prerequisites apply and required acceptance is preserved; allow automatic selection`)]}),(0,Y.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>n(i.filter(e=>e.id!==o.id)),children:r(`移除替代做法`,`Remove alternative`)})]},o.id)),(0,Y.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-xs`,disabled:i.length>=8||e.status!=null&&e.status!==`pending`,onClick:()=>{let t=i.length+1;for(;i.some(e=>e.id===`option-${t}`);)t++;n([...i,{id:`option-${t}`,title:r(`新的替代做法`,`New alternative`),duration_hours:[...e.duration_hours],resources:{...e.resources},basis:e.basis,tradeoff:r(`待补充适用条件与取舍`,`Specify prerequisites and tradeoffs`),preserves_acceptance:!1}])},children:r(`添加替代做法`,`Add alternative`)})]})}var Q=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm text-ink`;function kt({input:e,onChange:t,text:n,forecast:r}){let i=e.proposals.find(t=>t.id===e.selected_proposal_id),a=(n,r)=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.map(e=>e.id===n?{...e,...r}:e)}:e)});return(0,Y.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`任务与实验`,`Tasks and experiments`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`h3`,{className:`font-medium`,children:n(`任务与实验`,`Tasks and experiments`)}),(0,Y.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-sm`,onClick:()=>{let r=i.tasks.length+1;for(;i.tasks.some(e=>e.id===`task-${r}`);)r++;t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:[...e.tasks,{id:`task-${r}`,title:n(`新增实验`,`New experiment`),phase:`experiment`,duration_hours:[1,2,8],basis:n(`初步估计,待实测校准`,`Preliminary estimate; needs calibration`)}]}:e)})},children:n(`添加任务`,`Add task`)})]}),i.tasks.map(o=>{let s=[`running`,`completed`,`failed`].includes(o.status??`pending`),c=[`completed`,`failed`].includes(o.status??`pending`);return(0,Y.jsxs)(`details`,{className:`rounded-xl border border-line p-3`,children:[(0,Y.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,Y.jsx)(`strong`,{children:o.title}),(0,Y.jsxs)(`span`,{className:`ml-2 text-ink-faint`,children:[o.duration_hours.join(` / `),` h · `,o.id]})]}),(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`任务名称`,`Task name`),(0,Y.jsx)(`input`,{className:Q,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`阶段`,`Phase`),(0,Y.jsx)(`input`,{className:Q,value:o.phase,onChange:e=>a(o.id,{phase:e.target.value})})]}),(0,Y.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`乐观(小时)`,`Lower (hours)`),n(`最可能(小时)`,`Likely (hours)`),n(`悲观(小时)`,`Upper (hours)`)].map((e,t)=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,disabled:s,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`估计依据`,`Estimate basis`),(0,Y.jsx)(`textarea`,{"aria-label":n(`估计依据`,`Estimate basis`),className:Q,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`模型 / 实现难度`,`Model / implementation difficulty`),(0,Y.jsx)(`textarea`,{"aria-label":n(`模型 / 实现难度`,`Model / implementation difficulty`),className:Q,value:o.difficulty??``,onChange:e=>a(o.id,{difficulty:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`前置任务(可多选)`,`Dependencies (multiple)`),(0,Y.jsx)(`select`,{"aria-label":n(`前置任务(可多选)`,`Dependencies (multiple)`),multiple:!0,className:Q,disabled:s,value:o.depends_on??[],onChange:e=>a(o.id,{depends_on:Array.from(e.target.selectedOptions,e=>e.value)}),children:i.tasks.filter(e=>e.id!==o.id).map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.keys(e.resources).map(e=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`占用`,`slots`),(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`1`,className:Q,disabled:s,value:o.resources?.[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e))}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`进展状态`,`Progress status`),(0,Y.jsx)(`select`,{"aria-label":n(`进展状态`,`Progress status`),className:Q,disabled:c||e.adapt_to_deadline&&!s&&!r,value:o.status??`pending`,onChange:t=>{let n=t.target.value,i=r?.schedule.find(e=>e.id===o.id),c=!s&&[`running`,`completed`,`failed`].includes(n)&&i?{duration_hours:i.duration_hours??o.duration_hours,resources:i.resources,execution_option_id:i.execution_option_id??`standard`,basis:i.basis}:{};a(o.id,{status:n,...c,...n===`running`?{actual_start_hours:o.actual_start_hours??e.now_hours,remaining_hours:o.remaining_hours??[...c.duration_hours??o.duration_hours]}:{},...[`completed`,`failed`].includes(n)?{actual_start_hours:o.actual_start_hours??0,actual_finish_hours:e.now_hours}:{}})},children:[[`pending`,`未开始`,`Pending`],[`running`,`运行中`,`Running`],[`completed`,`已完成`,`Completed`],[`failed`,`失败`,`Failed`],[`blocked`,`受阻`,`Blocked`]].filter(([e])=>!s||![`pending`,`blocked`].includes(e)).map(([e,t,r])=>(0,Y.jsx)(`option`,{value:e,children:n(t,r)},e))})]}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:o.optional??!1,onChange:e=>a(o.id,{optional:e.target.checked})}),n(`可选 / 已退出交付路径`,`Optional / retired from delivery path`)]}),s&&(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`实际开始(项目第几小时)`,`Actual start (project hour)`),(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,value:o.actual_start_hours??0,onChange:e=>a(o.id,{actual_start_hours:Number(e.target.value)})})]}),c&&(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`实际结束(项目第几小时)`,`Actual finish (project hour)`),(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,value:o.actual_finish_hours??0,onChange:e=>a(o.id,{actual_finish_hours:Number(e.target.value)})})]}),o.status===`running`&&(0,Y.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`剩余下限`,`Remaining lower`),n(`剩余最可能`,`Remaining likely`),n(`剩余上限`,`Remaining upper`)].map((e,t)=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,(0,Y.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Q,value:o.remaining_hours?.[t]??0,onChange:e=>{let n=[...o.remaining_hours??o.duration_hours];n[t]=Number(e.target.value),a(o.id,{remaining_hours:n})}})]},e))}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`变化 / 延期原因`,`Change / delay reason`),(0,Y.jsx)(`textarea`,{"aria-label":n(`变化 / 延期原因`,`Change / delay reason`),className:Q,value:o.reason??``,onChange:e=>a(o.id,{reason:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`证据引用(每行一个)`,`Evidence references (one per line)`),(0,Y.jsx)(`textarea`,{"aria-label":n(`证据引用(每行一个)`,`Evidence references (one per line)`),className:Q,value:(o.evidence??[]).join(` +`),onChange:e=>a(o.id,{evidence:e.target.value.split(` +`).filter(Boolean)})})]}),(0,Y.jsx)(Ot,{task:o,resources:Object.keys(e.resources),onChange:e=>a(o.id,{execution_options:e}),text:n}),!s&&i.tasks.length>1&&(0,Y.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.filter(e=>e.id!==o.id)}:e)}),children:n(`移除未开始任务`,`Remove unstarted task`)})]})]},o.id)})]})}function At({report:e,selectedId:t,text:n}){let r=e.proposals.find(e=>e.id===t),i=Math.max(1,...r.schedule.map(e=>e.finish_hours));return(0,Y.jsxs)(`div`,{className:`space-y-5`,"aria-label":n(`排期结果`,`Timeline results`),children:[(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:e.proposals.map(e=>(0,Y.jsxs)(`div`,{className:`rounded-xl border p-4 ${e.id===t?`border-blue`:`border-line`}`,children:[(0,Y.jsx)(`div`,{className:`text-xs text-ink-faint`,children:e.id===t?n(`已选方案`,`Selected proposal`):n(`备选方案`,`Alternative`)}),(0,Y.jsx)(`h3`,{className:`mt-1 text-sm font-medium`,children:e.title}),(0,Y.jsx)(`div`,{className:`mt-3 text-2xl font-semibold`,children:e.finish_hours?`${e.finish_hours.expected.toFixed(1)} h`:n(`待重规划`,`Needs replanning`)}),e.finish_hours&&(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[n(`区间`,`Range`),` `,e.finish_hours.lower.toFixed(1),`–`,e.finish_hours.upper.toFixed(1),` h · `,n(`剩余`,`Remaining`),` `,e.remaining_hours?.toFixed(1),` h`]}),e.deadline_gap_hours!=null&&(0,Y.jsxs)(`p`,{className:`mt-2 text-xs ${e.deadline_gap_hours>0?`text-red`:`text-ink-faint`}`,children:[n(`预计超期`,`Forecast overrun`),` `,e.deadline_gap_hours.toFixed(1),` h`]})]},e.id))}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`初步估计,非成功承诺。区间覆盖已列出的工作;验证失败后的新增实验可能超出上限。各方案作为备选单独计算。`,`Preliminary estimates, not success guarantees. New experiments after a failed premise can exceed the range. Proposals are estimated as alternatives.`)}),r.adaptation&&(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-blue/40 bg-blue/5 p-4`,"aria-label":n(`根据期限重排`,`Deadline adaptation`),children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`根据期限重排`,`Deadline adaptation`)}),r.adaptation.baseline_finish_hours&&r.finish_hours&&(0,Y.jsxs)(`p`,{className:`text-sm`,children:[n(`调整前`,`Before`),` `,(0,Y.jsxs)(`strong`,{children:[r.adaptation.baseline_finish_hours.expected.toFixed(1),` h`]}),` → `,n(`当前方案`,`Current plan`),` `,(0,Y.jsxs)(`strong`,{children:[r.finish_hours.expected.toFixed(1),` h`]})]}),r.adaptation.status===`gap`&&(0,Y.jsx)(`p`,{className:`text-sm text-red`,children:n(`已尝试可用的重排方式,仍无法满足期限。需要增加资源、提出新的执行方案,或调整交付目标。`,`Available adjustments still miss the deadline. More resources, another execution option, or a revised deliverable are needed.`)}),r.adaptation.status===`fits`&&r.finish_hours&&r.adaptation.target_hours!=null&&r.finish_hours.upper>r.adaptation.target_hours&&(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`点估计可按期;悲观情景仍可能超期,请留意区间上限。`,`The point estimate fits; the upper scenario can still miss the deadline.`)}),r.adaptation.changes.length===0&&(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`沿用原 proposal 的任务与做法;当前期限无需进一步调整,或尚无可用的替代做法。`,`Keeping the original tasks and approaches; no further adjustment is needed or no usable alternative is available.`)}),r.adaptation.changes.map(e=>(0,Y.jsxs)(`div`,{className:`border-t border-line/60 pt-2 text-xs`,children:[(0,Y.jsxs)(`p`,{className:`font-medium`,children:[e.title,e.option_title?` → ${e.option_title}`:``]}),e.from_duration_hours&&e.to_duration_hours&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[n(`任务估计(下限 / 最可能 / 上限)`,`Task estimate (lower / likely / upper)`),`: `,e.from_duration_hours.join(` / `),` → `,e.to_duration_hours.join(` / `),` h`]}),e.from_start_hours!=null&&e.to_start_hours!=null&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[n(`开始时间`,`Start time`),`: `,e.from_start_hours.toFixed(1),` → `,e.to_start_hours.toFixed(1),` h`]}),(0,Y.jsx)(`p`,{className:`mt-1 text-ink-faint`,children:e.reason}),e.tradeoff&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[n(`取舍 / 条件`,`Tradeoff / prerequisites`),`: `,e.tradeoff]})]},`${e.kind}:${e.id}`))]}),(0,Y.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,Y.jsxs)(`h3`,{className:`mb-4 text-sm font-medium`,children:[n(`实验排布`,`Experiment schedule`),` · `,n(`从项目开始计时`,`Hours from project start`)]}),(0,Y.jsx)(`div`,{className:`space-y-3`,children:r.schedule.map(e=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs`,children:[(0,Y.jsx)(`span`,{children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-ink-faint`,children:[e.start_hours.toFixed(1),`–`,e.finish_hours.toFixed(1),` h`]})]}),(0,Y.jsx)(`div`,{className:`h-2.5 rounded-full bg-line/40`,role:`img`,"aria-label":`${e.title}: ${e.start_hours.toFixed(1)}–${e.finish_hours.toFixed(1)} h`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full ${e.status===`failed`?`bg-red`:e.status===`completed`?`bg-emerald-500`:`bg-blue`}`,style:{marginLeft:`${e.start_hours/i*100}%`,width:`${Math.max(.3,(e.finish_hours-e.start_hours)/i*100)}%`}})})]},e.id))})]}),r.deferred_task_ids.length>0&&(0,Y.jsxs)(`p`,{className:`rounded-lg border border-line p-3 text-sm`,children:[n(`为满足期限延后的可选任务`,`Optional tasks deferred for the deadline`),`: `,r.deferred_task_ids.join(`, `)]}),[...r.failed_tasks,...r.blocked_tasks].map(e=>(0,Y.jsxs)(`p`,{role:`alert`,className:`rounded-lg border border-red/40 p-3 text-sm`,children:[e.id,`: `,e.reason]},e.id)),(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsx)(`tr`,{children:[n(`任务`,`Task`),n(`资源`,`Resources`),n(`排队`,`Queue`),n(`估计依据`,`Estimate basis`)].map(e=>(0,Y.jsx)(`th`,{className:`border-b border-line p-2`,children:e},e))})}),(0,Y.jsx)(`tbody`,{children:r.schedule.map(e=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{className:`border-b border-line p-2`,children:e.title}),(0,Y.jsx)(`td`,{className:`border-b border-line p-2`,children:Object.entries(e.resources).map(([e,t])=>`${e} × ${t}`).join(`, `)||`—`}),(0,Y.jsxs)(`td`,{className:`border-b border-line p-2`,children:[e.resource_wait_hours.toFixed(1),` h`]}),(0,Y.jsx)(`td`,{className:`border-b border-line p-2`,children:e.basis})]},e.id))})]})}),e.revision&&(0,Y.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`版本对照与延期原因`,`Revision and delay reasons`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm`,children:e.revision.reason}),(0,Y.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[n(`初版预计`,`Original forecast`),`: `,e.revision.baseline_finish_hours?.toFixed(1)??`—`,` h · `,n(`相对初版变化`,`Change from original`),`: `,e.revision.baseline_delta_hours?.toFixed(1)??`—`,` h`]}),e.revision.task_variances.map((e,t)=>(0,Y.jsxs)(`p`,{className:`mt-3 text-xs`,children:[e.id,` · `,e.observed?n(`实际延期`,`Observed delay`):n(`预测延期`,`Forecast delay`),` `,e.delay_hours.toFixed(1),` h — `,e.reason,(0,Y.jsx)(`br`,{}),e.evidence.join(`, `)]},`${e.id}-${t}`))]})]})}function jt(e){return{...e,resources:e.resources??{},now_hours:e.now_hours??0,defer_optional:e.defer_optional??!1}}var $=`w-full rounded-lg border border-line bg-transparent px-3 py-2 text-sm text-ink`,Mt=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40`;function Nt({sid:e}){let{locale:t}=d(),n=(e,n)=>t===`zh-CN`?e:n,[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!0),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(``),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(``),[D,O]=(0,U.useState)(``),[k,A]=(0,U.useState)(0),j=!!(r&&JSON.stringify(r)!==JSON.stringify(a?.input));return(0,U.useEffect)(()=>{let t=!0;return u(!0),p(!1),y(``),i(null),o(null),c(null),q.timelineLatest(e).then(({latest:e})=>{if(!t)return;let n=e?{...e,input:jt(e.input)}:null;o(n),i(n?.input??null),c(n?.report??null),T(``),C(``),p(!0)}).catch(e=>{t&&y(e.message)}).finally(()=>{t&&u(!1)}),()=>{t=!1}},[e,k]),(0,U.useEffect)(()=>{if(c(null),x(``),!r){_(!1);return}if(a&&JSON.stringify(r)===JSON.stringify(a.input)){c(a.report),_(!1);return}let e=new AbortController;_(!0);let t=setTimeout(()=>{q.timelineEstimate(r,e.signal).then(t=>{e.signal.aborted||c(t)}).catch(t=>{e.signal.aborted||x(t.message)}).finally(()=>{e.signal.aborted||_(!1)})},350);return()=>{clearTimeout(t),e.abort()}},[r,a]),l?(0,Y.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-ink-faint`,children:n(`正在读取已保存计划…`,`Loading saved timeline…`)}):(0,Y.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 p-4 sm:p-6`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-xs text-blue`,children:`PROPOSAL → EXPERIMENT → PAPER`}),(0,Y.jsx)(`h2`,{className:`mt-1 text-xl font-semibold`,children:n(`研究排期`,`Research timeline`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`选择 idea 和期望期限,查看具体工期、实验排布与调整原因。`,`Choose an idea and deadline to see estimates, experiment schedules, and reasons for changes.`)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(`button`,{className:Mt,disabled:m||!f,onClick:async()=>{h(!0),y(``),C(``);try{i(await q.timelineExample()),T(n(`加载演示 proposal`,`Load demonstration proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`加载论文示例`,`Load paper example`)}),(0,Y.jsx)(`button`,{className:Mt,disabled:m,onClick:()=>A(e=>e+1),children:n(`重新载入已保存计划`,`Reload saved timeline`)}),r&&(0,Y.jsx)(`button`,{className:Mt,onClick:()=>E(new Blob([JSON.stringify(r,null,2)],{type:`application/json`}),`proposal.json`),children:n(`导出 proposal`,`Export proposal`)})]})]}),v&&(0,Y.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[v,(0,Y.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n(`若提示版本冲突,先导出当前草稿,再重新载入已保存计划。`,`For a version conflict, export your draft before reloading the saved timeline.`)})]}),S&&(0,Y.jsx)(`p`,{role:`status`,className:`rounded-xl border border-blue/40 p-3 text-sm`,children:S}),!r&&(0,Y.jsxs)(`section`,{className:`rounded-xl border border-dashed border-line p-8 text-center`,children:[(0,Y.jsx)(`h3`,{className:`font-medium`,children:n(`还没有研究排期`,`No research timeline yet`)}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`点击“加载论文示例”即可验证完整流程,也可以在下方导入自己的 proposal。示例数字仅用于演示。`,`Load the paper example to try the complete flow, or import your proposal below. Example numbers are illustrative.`)})]}),r&&(0,Y.jsxs)(`div`,{className:`grid items-start gap-6`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 360px), 1fr))`},children:[(0,Y.jsxs)(`fieldset`,{disabled:m,className:`min-w-0 space-y-5`,children:[(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[n(`选择 idea / proposal`,`Choose idea / proposal`),(0,Y.jsx)(`select`,{"aria-label":n(`选择 idea / proposal`,`Choose idea / proposal`),className:$,value:r.selected_proposal_id,onChange:e=>i({...r,selected_proposal_id:e.target.value}),children:r.proposals.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[n(`方案名称`,`Proposal title`),(0,Y.jsx)(`input`,{className:$,value:r.proposals.find(e=>e.id===r.selected_proposal_id).title,onChange:e=>i({...r,proposals:r.proposals.map(t=>t.id===r.selected_proposal_id?{...t,title:e.target.value}:t)})})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`期望完成时间(小时)`,`Target finish (hours)`),(0,Y.jsx)(`input`,{className:$,type:`number`,min:`0`,step:`any`,value:r.deadline_hours??``,placeholder:n(`不限`,`No deadline`),onChange:e=>i({...r,deadline_hours:e.target.value===``?null:Number(e.target.value)})})]}),(0,Y.jsxs)(`label`,{className:`text-xs`,children:[n(`已过去时间(小时)`,`Elapsed time (hours)`),(0,Y.jsx)(`input`,{className:$,type:`number`,min:`0`,step:`any`,value:r.now_hours,onChange:e=>i({...r,now_hours:Number(e.target.value)})})]}),Object.entries(r.resources).map(([e,t])=>(0,Y.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`可用槽位`,`available slots`),(0,Y.jsx)(`input`,{className:$,type:`number`,min:`1`,step:`1`,value:t,onChange:t=>i({...r,resources:{...r.resources,[e]:Number(t.target.value)}})})]},e))]}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`所有时间从项目开始计时;例如 120 小时 = 第 5 天。资源按持续可用计算。`,`All times count from project start; 120 hours means day 5. Resources are assumed continuously available.`)}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r.adapt_to_deadline??!1,onChange:e=>i({...r,adapt_to_deadline:e.target.checked})}),n(`根据期限自动重排任务、选择替代做法并更新区间`,`Adapt task order, execution options and estimate ranges to the deadline`)]}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`缩短期限时优先调整关键路径;延长期限时恢复原做法和可选工作。替代做法可在任务中编辑。`,`Tighter deadlines prioritize the critical path; longer deadlines restore preferred approaches and optional work. Edit alternatives inside each task.`)}),(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r.defer_optional,onChange:e=>i({...r,defer_optional:e.target.checked})}),n(`超期时延后可选任务,保留必需实验`,`Defer optional tasks when over deadline; keep required experiments`)]}),(0,Y.jsx)(`button`,{className:Mt,onClick:()=>{let e=r.proposals.length+1;for(;r.proposals.some(t=>t.id===`idea-${e}`);)e++;let t=`idea-${e}`;i({...r,selected_proposal_id:t,proposals:[...r.proposals,{id:t,title:n(`新 proposal`,`New proposal`),tasks:[{id:`validation`,title:n(`关键假设验证`,`Validate the key premise`),phase:`validation`,duration_hours:[2,4,16],basis:n(`初步估计,待校准`,`Preliminary, uncalibrated estimate`)}]}]})},children:n(`添加候选方案`,`Add proposal`)})]}),(0,Y.jsx)(kt,{input:r,onChange:i,text:n,forecast:g?void 0:s?.proposals.find(e=>e.id===r.selected_proposal_id)}),(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,Y.jsxs)(`label`,{className:`block text-xs`,children:[n(`本次保存 / 调整原因`,`Reason for this revision`),(0,Y.jsx)(`textarea`,{"aria-label":n(`本次保存 / 调整原因`,`Reason for this revision`),className:$,value:w,onChange:e=>T(e.target.value),placeholder:n(`说明为什么改变计划;延期请在具体任务中填写证据`,`Explain the change; add delay evidence on the affected task`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[a?n(`已保存 v${a.version}`,`Saved v${a.version}`):n(`未保存`,`Not saved`),j?n(` · 有未保存修改`,` · Unsaved changes`):``]}),(0,Y.jsx)(`button`,{className:`${Mt} border-blue bg-blue/10`,disabled:!f||!j||!s||g||!!b||!w.trim(),onClick:async()=>{if(!(!r||!s||g||!w.trim())){h(!0),y(``),C(``);try{let t=await q.timelineSave(e,r,a?.version??0,w);o(t),i(t.input),c(t.report),T(``),C(n(`已保存版本 ${t.version},刷新页面后仍可查看。`,`Version ${t.version} saved. It survives a page refresh.`))}catch(e){y(e.message)}finally{h(!1)}}},children:n(`保存计划版本`,`Save timeline version`)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`保存计划不会启动实验。实际进展和失败原因由实验结果或操作者更新。`,`Saving a timeline does not start experiments. Update progress and failure reasons from actual results.`)})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[g&&(0,Y.jsx)(`p`,{role:`status`,className:`text-sm text-ink-faint`,children:n(`正在更新排期…`,`Updating schedule…`)}),b&&(0,Y.jsxs)(`p`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[n(`无法计算,请检查估计区间、依赖和资源:`,`Cannot calculate; check ranges, dependencies, and resources: `),b]}),!g&&s&&(0,Y.jsx)(At,{report:s,selectedId:r.selected_proposal_id,text:n})]})]}),(0,Y.jsxs)(`details`,{className:`rounded-xl border border-line p-4`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:n(`导入自己的 proposal(JSON)`,`Import your proposal (JSON)`)}),(0,Y.jsx)(`textarea`,{className:`${$} mt-3 font-mono`,rows:6,"aria-label":n(`Proposal JSON`,`Proposal JSON`),value:D,onChange:e=>O(e.target.value)}),(0,Y.jsx)(`button`,{className:`${Mt} mt-2`,disabled:!f||m||!D.trim(),onClick:async()=>{h(!0),y(``);try{let e=JSON.parse(D);await q.timelineEstimate(e),i(jt(e)),T(n(`导入 proposal`,`Import proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`校验并导入`,`Validate and import`)})]})]})}function Pt(e){let t=Math.ceil(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:t<86400?`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`:`${Math.floor(t/86400)}d ${Math.floor(t%86400/3600)}h`}var Ft={available:`bg-ok/10 text-ok`,absent:`bg-bg text-ink-faint`,inaccessible:`bg-warn/10 text-warn`,degraded:`bg-warn/10 text-warn`};function It({status:e,error:t}){let{t:n,locale:r}=d(),i=r===`zh-CN`;return(0,Y.jsxs)(`section`,{className:`rounded-lg border border-line bg-panel p-4 lg:col-span-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-ink-dim`,children:n(`resource.title`)}),e?(0,Y.jsx)(`span`,{className:`rounded px-2 py-1 text-[10px] font-semibold uppercase ${e.enforcement===`strict`?`bg-ok/10 text-ok`:`bg-warn/10 text-warn`}`,children:B(e.enforcement,n)}):null]}),t?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-err`,children:t}):null,!e&&!t?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:n(`resource.loading`)}):null,e?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.accelerators.map(e=>(0,Y.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-semibold text-ink`,children:be(e.kind,n)}),(0,Y.jsxs)(`span`,{className:`rounded px-2 py-0.5 text-[10px] font-medium ${Ft[e.status]}`,children:[ie(e.status,n),` · `,n(`resource.devices`,{count:e.device_count})]})]}),e.detail?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:e.detail}):null]},e.kind))}),(0,Y.jsx)(`div`,{className:`gpu-device-grid`,children:e.accelerators.flatMap(e=>(e.devices??[]).map(t=>{let r=t.utilization_percent>0?`computing`:t.reserved?`reserved`:t.used_memory_mib>0?`allocated`:`quiet`,a=r===`computing`?i?`正在计算`:`Computing`:r===`reserved`?i?`已预留`:`Reserved`:r===`allocated`?i?`仅显存占用`:`Memory occupied`:i?`暂无活动`:`No activity`,o=t.total_memory_mib>0?Math.min(100,t.used_memory_mib/t.total_memory_mib*100):0;return(0,Y.jsxs)(`article`,{className:`gpu-device-card`,"data-gpu-state":r,"aria-label":`GPU ${t.index} · ${t.name} · ${a}`,children:[(0,Y.jsxs)(`div`,{className:`gpu-device-header`,children:[(0,Y.jsx)(`span`,{className:`gpu-device-icon`,"aria-hidden":`true`,children:(0,Y.jsx)(we,{size:26,strokeWidth:1.5})}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`span`,{className:`gpu-device-number`,children:[be(e.kind,n),` · GPU `,t.index]}),(0,Y.jsx)(`h4`,{children:t.name})]}),(0,Y.jsxs)(`span`,{className:`gpu-device-status`,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),a]})]}),(0,Y.jsxs)(`div`,{className:`gpu-device-meter`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:i?`计算负载`:`Compute load`}),(0,Y.jsxs)(`strong`,{children:[t.utilization_percent,`%`]})]}),(0,Y.jsx)(`div`,{role:`meter`,"aria-label":i?`计算负载`:`Compute load`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t.utilization_percent,children:(0,Y.jsx)(`i`,{style:{width:`${t.utilization_percent}%`}})})]}),(0,Y.jsxs)(`div`,{className:`gpu-device-meter`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{children:i?`显存`:`GPU memory`}),(0,Y.jsxs)(`strong`,{children:[t.used_memory_mib<1024?`${t.used_memory_mib} MiB`:`${(t.used_memory_mib/1024).toFixed(1)} GiB`,` / `,(t.total_memory_mib/1024).toFixed(1),` GiB`]})]}),(0,Y.jsx)(`div`,{role:`meter`,"aria-label":i?`显存占用`:`GPU memory usage`,"aria-valuemin":0,"aria-valuemax":t.total_memory_mib||1,"aria-valuenow":t.used_memory_mib,children:(0,Y.jsx)(`i`,{style:{width:`${o}%`}})})]}),t.reserved&&r!==`reserved`&&(0,Y.jsx)(`p`,{className:`gpu-device-note`,children:i?`已由 Argus 预留`:`Reserved by Argus`})]},`${e.kind}:${t.index}`)}))}),!!e.accelerators.some(e=>e.device_count>0&&!e.devices)&&(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:i?`当前服务尚未提供单卡详情,不能判断各卡使用情况。`:`This server has no per-device details; individual usage is unknown.`}),(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-ink-faint`,children:i?`编号与主机一致。负载和显存包含其他程序,少量显存可能来自驱动;“暂无活动”是采样结果,不保证可独占使用。`:`Numbers match host GPU indices. Load and memory include other programs; small memory use can come from drivers. “No activity” is a sample, not a guarantee of exclusive availability.`}),(0,Y.jsxs)(`details`,{className:`mt-4`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer text-xs text-ink-dim`,children:i?`Argus 资源预约 ${e.holders.length} · 等待 ${e.queue.length}`:`Argus reservations ${e.holders.length} · Waiting ${e.queue.length}`}),(0,Y.jsxs)(`div`,{className:`mt-3 grid gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.inUse`,{count:e.holders.length})}),(0,Y.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.holders.length===0?(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.holders.map((e,t)=>(0,Y.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.devices`,{count:e.device_count})}),(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:Pt(e.ttl_seconds)})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)}),e.yield_requests.map((e,t)=>(0,Y.jsxs)(`div`,{className:`mt-2 border-l-2 border-warn/50 pl-2 text-ink-faint`,children:[(0,Y.jsx)(`div`,{children:n(`resource.yieldRequest`,{reason:e.reason})}),e.response?(0,Y.jsxs)(`div`,{children:[ve(e.response.decision,n),` · `,e.response.reason]}):null]},t))]},`${e.project}:${e.task_id}:${t}`))})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h4`,{className:`text-[10px] font-semibold uppercase tracking-wide text-ink-faint`,children:n(`resource.queue`,{count:e.queue.length})}),(0,Y.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.queue.length===0?(0,Y.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`resource.none`)}):e.queue.map(e=>(0,Y.jsxs)(`div`,{className:`rounded border border-line bg-bg p-3 text-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-ink`,children:n(`resource.queuePosition`,{position:e.position})}),(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-ink-faint`,children:n(`resource.timeLeft`,{ttl:Pt(e.ttl_seconds)})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-ink-dim`,children:e.intent||n(`resource.noIntent`)})]},e.position))})]})]})]})]}):null]})}async function Lt(e){let t=await e;if(t&&typeof t==`object`){let e=t;if(Number(e.rc??0)!==0||e.command_status===`failed`||e.command_status===`rejected`)throw Error(String(e.error||`Command ${e.command_status||`failed`}`))}return t}function Rt({sid:e,snapshot:t,active:n,connected:i,controls:a,refresh:o,readOnly:s,onRestored:c}){let{t:l,locale:f}=d(),p=f===`zh-CN`,[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[y,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(t.session.workdir??t.session.cwd??``),[w,E]=(0,U.useState)(``),[O,k]=(0,U.useState)(``),[j,N]=(0,U.useState)(``),ne=(0,U.useRef)(!1),[re,P]=(0,U.useState)(``),[F,ie]=(0,U.useState)(null),I=r({queryKey:[`runtime-resources`],queryFn:({signal:e})=>u.resources(e),enabled:n,refetchInterval:1e4,retry:!1}),L=r({queryKey:[`runtime-trash`,O],queryFn:()=>u.trash(O),enabled:n&&g&&!s,retry:!1}),R=r({queryKey:[`runtime-metrics`],queryFn:()=>u.metrics(),enabled:n&&y,retry:!1}),z=r({queryKey:[`runtime-source-update`],queryFn:({signal:e})=>u.sourceUpdateStatus(e),enabled:n&&m&&!s,retry:!1,refetchInterval:e=>e.state.data?.running?1500:!1});(0,U.useEffect)(()=>{C(t.session.workdir??t.session.cwd??``)},[t.session.workdir,t.session.cwd]);let B=s||!!j||a.busy,oe=t.daemon.alive&&t.daemon.control_available===!1,V=t.daemon.alive&&t.daemon.protocol_compatible===!1,se=async(e,t,n)=>{if(!(s||ne.current||a.busy)){ne.current=!0,N(e),ie(null),P(``);try{await Lt(t()),P(n),await o()}catch(e){ie(me(e,l))}finally{ne.current=!1,N(``)}}},H=(e,t,n,r)=>{!B&&window.confirm(t)&&se(e,n,r)},ce=e=>e?de(e)?l(`operations.unavailableHere`):me(e,l).text:``,le=t.daemon_admission?.running_daemons??[];return(0,Y.jsxs)(`div`,{className:`runtime-control-page`,children:[(0,Y.jsxs)(`section`,{className:`runtime-summary`,children:[(0,Y.jsxs)(`div`,{className:`runtime-summary-copy`,children:[(0,Y.jsx)(`span`,{className:`runtime-eyebrow`,children:p?`运行控制`:`Runtime controls`}),(0,Y.jsx)(`h2`,{children:t.session.display_name||e}),(0,Y.jsxs)(`div`,{className:`runtime-status-line`,children:[(0,Y.jsxs)(`span`,{className:`runtime-status`,"data-running":t.daemon.alive,children:[(0,Y.jsx)(`i`,{"aria-hidden":`true`}),t.daemon.alive?p?`持续运行中`:`Running continuously`:p?`持续运行已暂停`:`Continuous work paused`]}),(0,Y.jsx)(`span`,{children:i?p?`实时连接`:`Live connection`:p?`连接恢复中,状态可能延迟`:`Reconnecting; status may be delayed`}),!!t.manager_requests?.length&&(0,Y.jsx)(`span`,{children:p?`对话处理中`:`Reply in progress`})]})]}),(0,Y.jsxs)(`div`,{className:`runtime-main-actions`,children:[(0,Y.jsxs)(`button`,{className:`button button--primary`,disabled:B||oe||V,onClick:()=>{t.daemon.alive?a.stop(!0):a.start()},children:[t.daemon.alive?(0,Y.jsx)(M,{size:16}):(0,Y.jsx)(te,{size:16}),a.busy?p?`正在处理…`:`Working…`:t.daemon.alive?p?`安全暂停`:`Pause safely`:p?`启动运行`:`Start work`]}),(0,Y.jsxs)(`button`,{className:`button button--ghost`,disabled:I.isFetching,onClick:()=>{I.refetch(),o()},children:[(0,Y.jsx)(b,{size:15}),p?`刷新状态`:`Refresh`]})]}),(0,Y.jsx)(`p`,{className:`runtime-summary-hint`,children:p?`安全暂停会等待当前工作结束。新的任务和调整直接在对话中告诉 Argus。`:`Safe pause waits for current work to finish. Send new tasks and adjustments in the conversation.`}),s&&(0,Y.jsx)(`p`,{children:p?`当前为只读展示,不能执行控制操作。`:`Read-only view; control actions are disabled.`}),oe&&(0,Y.jsx)(`p`,{role:`alert`,children:p?`此运行实例由外部管理,请在其启动端控制。`:`This instance is externally managed. Control it from its host.`}),V&&(0,Y.jsx)(`p`,{role:`alert`,children:p?`运行实例版本不兼容,请展开运行设置进行安全重启。`:`The running version is incompatible. Open settings to restart safely.`}),t.daemon.protocol_error&&(0,Y.jsx)(`p`,{role:`alert`,children:t.daemon.protocol_error}),a.error&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-err`,children:a.error})]}),(0,Y.jsx)(It,{status:I.isError?null:I.data??null,error:ce(I.error)}),F&&(0,Y.jsxs)(`div`,{className:`runtime-feedback`,role:`alert`,children:[(0,Y.jsx)(`p`,{children:F.text}),F.technical&&(0,Y.jsx)(D,{label:l(`operations.technicalDetails`),children:(0,Y.jsx)(`pre`,{children:F.technical})})]}),re&&(0,Y.jsxs)(`p`,{className:`runtime-feedback`,role:`status`,children:[(0,Y.jsx)(v,{size:16}),re]}),!!j&&(0,Y.jsx)(`p`,{role:`status`,className:`text-sm text-ink-dim`,children:p?`正在处理,请稍候…`:`Working, please wait…`}),(0,Y.jsxs)(`details`,{className:`runtime-section`,open:m,onToggle:e=>h(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(Pe,{size:17}),(0,Y.jsx)(`span`,{children:p?`运行设置`:`Runtime settings`}),(0,Y.jsx)(`small`,{children:p?`目录与维护`:`Directory & maintenance`})]}),(0,Y.jsxs)(`div`,{className:`runtime-section-body`,children:[(0,Y.jsxs)(`label`,{htmlFor:`runtime-workdir-${e}`,children:[(0,Y.jsx)(ke,{size:15}),l(`operations.workdir`)]}),(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsx)(`input`,{id:`runtime-workdir-${e}`,value:S,onChange:e=>C(e.target.value),disabled:B}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B||!S.trim()||S===(t.session.workdir??t.session.cwd??``),onClick:()=>H(`cwd`,p?`更改后,后续工作将使用新的会话目录。确认更改?`:`Future work will use the new session directory. Apply?`,()=>u.setWorkdir(e,S),l(`operations.workdirUpdated`)),children:[(0,Y.jsx)(v,{size:15}),p?`应用目录`:`Apply directory`]})]}),(0,Y.jsx)(`p`,{children:p?`这是会话工作目录,不是安全沙箱边界。以下维护操作不删除任务历史。`:`This is the session directory, not a sandbox boundary. Maintenance below preserves task history.`}),(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsxs)(`button`,{className:`button`,disabled:B,onClick:()=>H(`reset`,p?`将清空当前对话的上下文,任务和文件会保留。确认重置?`:`Clear conversation context? Tasks and files are preserved.`,()=>u.resetManager(e),p?`对话上下文已重置。`:`Conversation context reset.`),children:[(0,Y.jsx)(ee,{size:15}),p?`重置对话上下文`:`Reset conversation context`]}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B||oe,onClick:()=>H(`restart`,p?`等待当前工作结束后,使用当前版本重新启动。确认继续?`:`Wait for active work, then restart on the current release?`,()=>u.upgradeDaemon(e,t.daemon_commands?.revision),p?`安全重启请求已提交。`:`Safe restart requested.`),children:[(0,Y.jsx)(b,{size:15}),p?`安全重启`:`Restart safely`]})]}),!s&&(0,Y.jsxs)(`div`,{className:`runtime-source-update`,children:[(0,Y.jsx)(`h3`,{children:l(`operations.sourceUpdate`)}),z.error?(0,Y.jsx)(`p`,{role:`alert`,children:ce(z.error)}):(0,Y.jsx)(`p`,{children:z.data?.error||z.data?.message||(p?`按需检查,不会自动更新或重启。`:`Check on demand. Nothing updates or restarts automatically.`)}),!z.error&&(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsxs)(`button`,{className:`button`,disabled:B||z.data?.running,onClick:()=>void se(`check-update`,async()=>{await u.checkSourceUpdate(),await z.refetch()},p?`已提交更新检查。`:`Update check requested.`),children:[(0,Y.jsx)(b,{size:15}),p?`检查更新`:`Check updates`]}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B||!z.data?.can_update||!z.data.update_available||z.data.running,onClick:()=>H(`update`,p?`将下载并构建新版本;完成后可能需要重启服务。确认更新?`:`Download and build the new release? A service restart may be needed.`,async()=>{await u.applySourceUpdate(),await z.refetch()},p?`更新请求已提交。`:`Update requested.`),children:[(0,Y.jsx)(xe,{size:15}),l(`operations.pullLatest`)]})]}),z.data?.restart_required&&(0,Y.jsx)(`p`,{children:l(`operations.updateRestart`)})]}),!!le.length&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:p?`切换运行名额`:`Switch active session`}),(0,Y.jsx)(`p`,{children:p?`先安全暂停指定项目,再启动当前项目。`:`Safely pause the selected project, then start this one.`}),le.map(n=>(0,Y.jsxs)(`button`,{className:`button`,disabled:B,onClick:()=>H(`replace:${n.id}`,p?`将暂停“${n.label||n.id}”并启动当前项目,确认继续?`:`Pause ${n.label||n.id} and start this project?`,()=>u.replaceDaemon(e,n.id,!!t.continuous?.enabled,t.daemon_commands?.revision),p?`项目切换请求已提交。`:`Session switch requested.`),children:[(0,Y.jsx)(b,{size:15}),n.label||n.id]},n.id))]})]})]}),!s&&(0,Y.jsxs)(`details`,{className:`runtime-section`,open:g,onToggle:e=>_(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(ae,{size:17}),(0,Y.jsx)(`span`,{children:p?`恢复已移除项目`:`Restore removed projects`})]}),(0,Y.jsxs)(`div`,{className:`runtime-section-body`,children:[(0,Y.jsxs)(`div`,{className:`runtime-field-row`,children:[(0,Y.jsx)(`input`,{"aria-label":l(`operations.searchTrash`),placeholder:l(`operations.searchTrash`),value:w,onChange:e=>E(e.target.value),onKeyDown:e=>{!ye(e)&&e.key===`Enter`&&(e.preventDefault(),k(w))}}),(0,Y.jsxs)(`button`,{className:`button`,onClick:()=>k(w),children:[(0,Y.jsx)(T,{size:15}),p?`搜索`:`Search`]})]}),L.error?(0,Y.jsx)(`p`,{role:`alert`,children:ce(L.error)}):L.isLoading?(0,Y.jsx)(`p`,{children:l(`common.loading`)}):L.data?.entries.length?L.data.entries.map(e=>(0,Y.jsxs)(`div`,{className:`runtime-restore-row`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsxs)(`button`,{className:`button`,disabled:B,onClick:()=>void se(`restore:${e.trash_id}`,async()=>{let t=await u.restoreTrash(e.trash_id);await L.refetch(),await c(t.sid)},p?`项目已恢复。`:`Project restored.`),children:[(0,Y.jsx)(ee,{size:15}),p?`恢复`:`Restore`]})]},e.trash_id)):(0,Y.jsx)(`p`,{children:l(`operations.trashEmpty`)}),L.data&&L.data.total>L.data.entries.length&&(0,Y.jsx)(`p`,{children:p?`显示最近 ${L.data.entries.length} 条,请缩小搜索范围。`:`Showing ${L.data.entries.length} recent matches. Narrow the search for more.`})]})]}),(0,Y.jsxs)(`details`,{className:`runtime-section`,open:y,onToggle:e=>x(e.currentTarget.open),children:[(0,Y.jsxs)(`summary`,{children:[(0,Y.jsx)(A,{size:17}),(0,Y.jsx)(`span`,{children:p?`技术诊断`:`Technical diagnostics`})]}),(0,Y.jsx)(`div`,{className:`runtime-section-body`,children:R.error?(0,Y.jsx)(`p`,{role:`alert`,children:ce(R.error)}):R.data?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{children:l(R.data.slo?.status===`healthy`?`operations.slo.healthy`:`operations.slo.degraded`)}),(0,Y.jsx)(D,{children:(0,Y.jsx)(`pre`,{children:JSON.stringify(R.data,null,2)})})]}):(0,Y.jsx)(`p`,{children:l(`common.loading`)})})]})]})}var zt=[{id:`timeline`,zh:`研究排期`,en:`Research timeline`,zhDesc:`比较 proposal 工期,安排实验,并追踪延期原因。`,enDesc:`Compare proposal estimates, schedule experiments, and track delays.`,icon:Se,color:`blue`},{id:`experiments`,zh:`运行进程`,en:`Execution`,zhDesc:`查看当前步骤、任务路线,以及团队里谁在做什么。`,enDesc:`Follow the current step, the task route, and who on the team is doing what.`,icon:Oe,color:`blue`},{id:`ide`,zh:`AI IDE`,en:`AI IDE`,zhDesc:`阅读项目文件,查看 Git 状态与 Argus 活动。`,enDesc:`Read project files, Git state, and Argus activity.`,icon:re,color:`emerald`},{id:`runtime`,zh:`运行控制`,en:`Runtime controls`,icon:ne}];function Bt(e){let t=String(e.event_id??e.id??``);if(t)return t;let n=String(e.message_id??``);return n?`${e.type??``}:${n}:${e.kind??``}`:[e.type??``,e.ts??``,e.agent_layer??e.actor??``,e.kind??``,String(e.text??e.title??e.reason??``).slice(0,160)].join(`|`)}function Vt(e,t){let n=[...e],r=new Map(n.map((e,t)=>[Bt(e),t]));return t.forEach(e=>{let t=Bt(e),i=r.get(t);i==null?(r.set(t,n.length),n.push(e)):n[i]={...n[i],...e}}),n.sort((e,t)=>Number(e.ts??0)-Number(t.ts??0)).slice(-600)}function Ht(e=!0){return r({queryKey:[`v2-projects`],queryFn:({signal:e})=>q.projects(e),enabled:e,refetchInterval:1e4})}function Ut(e,t=!0){let n=i(),[o,s]=(0,U.useState)([]),[c,l]=(0,U.useState)(!1),u=(0,U.useRef)(null),d=!!e&&t,f=r({queryKey:[`v2-snapshot`,e],queryFn:({signal:t})=>q.snapshot(e,t),enabled:d,refetchInterval:5e3}),p=r({queryKey:[`v2-status`,e],queryFn:({signal:t})=>q.status(e,t),enabled:d,refetchInterval:6e3}),m=r({queryKey:[`v2-events`,e],queryFn:({signal:t})=>q.events(e,220,t),enabled:d,refetchInterval:15e3});(0,U.useEffect)(()=>{s([]),l(!1)},[e]),(0,U.useEffect)(()=>{!e||!m.data||s(e=>Vt(e,m.data))},[m.data,e]),(0,U.useEffect)(()=>{if(!e||!t){l(!1);return}let r=He(e,t=>{s(e=>Vt(e,[t])),u.current??=window.setTimeout(()=>{u.current=null,n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]})},900)},l);return()=>{r.close(),l(!1),u.current!=null&&(window.clearTimeout(u.current),u.current=null)}},[t,n,e]);let h=async()=>{e&&await Promise.all([n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]}),n.invalidateQueries({queryKey:[`v2-events`,e]})])},g=a({mutationFn:()=>q.startDaemon(e,f.data?.daemon_commands?.revision),onSuccess:h}),_=a({mutationFn:t=>q.stopDaemon(e,t,f.data?.daemon_commands?.revision),onSuccess:h}),v=(0,U.useMemo)(()=>{let e=[f,p,m].find(e=>e.error);return e?.error instanceof Error?e.error:null},[m,f,p]);return{snapshot:f,status:p,events:o,connected:c,refresh:h,controls:{start:g,stop:_},error:v}}function Wt({sid:e,active:t,readOnly:n=!1,runtimeRequest:r=0,onRestored:i}){let{locale:a}=d(),[o,s]=(0,U.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`module`);return zt.find(t=>t.id===e)?.id??`runtime`}),[c,l]=(0,U.useState)(()=>new Set([o])),u=(0,U.useCallback)(e=>{s(e),l(t=>t.has(e)?t:new Set([...t,e]))},[]);(0,U.useEffect)(()=>{r&&u(`runtime`)},[r,u]);let f=Ht(t),p=f.data?.projects??[],m=(0,U.useMemo)(()=>p.find(t=>t.id===e)??null,[p,e]),h=Ut(e,t),g=o,_=h.controls.start.error||h.controls.stop.error,v=m&&h.snapshot.data?{sid:e,active:t,project:m,snapshot:h.snapshot.data,status:h.status.data,events:h.events,connected:h.connected,snapshotUpdatedAt:h.snapshot.dataUpdatedAt,refresh:h.refresh,controls:{start:async()=>{try{return await h.controls.start.mutateAsync()}catch{return null}},stop:async e=>{try{return await h.controls.stop.mutateAsync(e)}catch{return null}},busy:h.controls.start.isPending||h.controls.stop.isPending,error:_ instanceof Error?_.message:``},navigate:u}:null;return(0,Y.jsxs)(`section`,{className:`integrated-workbench flex min-h-0 flex-1 flex-col bg-transparent text-ink`,children:[(0,Y.jsx)(`nav`,{className:`workbench-module-tabs shrink-0 border-b border-line/60 px-3 py-2`,"aria-label":a===`zh-CN`?`工作台模块`:`Workbench modules`,children:(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:zt.map(({id:e,zh:t,en:n,icon:r})=>(0,Y.jsxs)(`button`,{type:`button`,className:`workbench-module-tab`,"data-module":e,"data-selected":g===e,"aria-pressed":g===e,onClick:()=>u(e),children:[(0,Y.jsx)(r,{size:14}),(0,Y.jsx)(`span`,{children:a===`zh-CN`?t:n})]},e))})}),f.isError&&!m||h.snapshot.isError&&!h.snapshot.data?(0,Y.jsx)(Z,{title:a===`zh-CN`?`工作台读取失败`:`Workbench unavailable`,description:`Argus API did not return the selected project.`}):v?zt.filter(({id:e})=>c.has(e)).map(({id:r})=>(0,Y.jsx)(`div`,{className:`ros-content workspace-view-surface min-h-0 flex-1 overflow-x-hidden overflow-y-auto ${g===r?``:`hidden`}`,"aria-hidden":g!==r,children:r===`runtime`?(0,Y.jsx)(Rt,{...v,active:t&&g===r,readOnly:n,onRestored:i}):r===`timeline`?(0,Y.jsx)(Nt,{sid:e}):r===`experiments`?(0,Y.jsx)(ht,{...v,active:t&&g===r}):(0,Y.jsx)(Et,{...v,active:t&&g===r})},`${e}:${r}`)):(0,Y.jsx)(`div`,{className:`boot-state`,children:(0,Y.jsx)(tt,{label:a===`zh-CN`?`正在载入工作台`:`Loading workbench`})})]})}export{Wt as ResearchWorkbenchPanel}; \ No newline at end of file diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-CZOLmyKI.js b/frontend/web/dist/assets/ResearchWorkbenchPanel-CZOLmyKI.js new file mode 100644 index 000000000..ebe09f399 --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-CZOLmyKI.js @@ -0,0 +1,12 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i,n as a}from"./query-CUzIxVzm.js";import{C as o,F as s,H as c,I as l,L as u,O as d,U as f,k as p}from"./index-DbVni4qR.js";import{A as m,C as h,F as g,I as _,L as v,M as y,O as b,R as x,S,_ as C,b as w,n as T,s as E,w as D,x as O}from"./AppearanceControls-C_eUyO2x.js";import{n as k,t as A}from"./code-xml-CTbPls4H.js";import{n as j,t as M}from"./play-DwGoGarL.js";import{a as ee,i as N}from"./useWorkbenchTheme-CV-C3OBr.js";import{At as te,Dt as ne,Mt as re,Nt as P,Tt as F,W as ie,_ as ae,_t as oe,bt as se,g as ce,h as le,ht as ue,m as de,mt as fe,pt as pe,r as me,v as he,xt as ge,y as _e,yt as ve}from"./App-BzMKY0Y_.js";var ye=x(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),be=x(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),xe=x(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Se=x(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Ce=x(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),we=x(`FlaskConical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Te=x(`FolderKanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),Ee=x(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),De=x(`LockKeyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Oe=x(`Radio`,[[`path`,{d:`M4.9 19.1C1 15.2 1 8.8 4.9 4.9`,key:`1vaf9d`}],[`path`,{d:`M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5`,key:`u1ii0m`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5`,key:`1j5fej`}],[`path`,{d:`M19.1 4.9C23 8.8 23 15.1 19.1 19`,key:`10b0cb`}]]),ke=x(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ae=x(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),je=x(`UserRound`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Me=x(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),I=e(t(),1),Ne=12e3;function L(e=!1){let t={...s()};return e&&(t[`Content-Type`]=`application/json`),t}async function R(e,t={}){await u();let n={...t,headers:{...L(!!t.body),...t.headers??{}},cache:`no-store`},r=String(t.method??`GET`).toUpperCase(),i=async n=>{if(!n.ok){let r=await n.text().catch(()=>``),i=r;try{i=JSON.parse(r).detail??r}catch{}throw Error(i||`${t.method??`GET`} ${e} failed (${n.status})`)}return await n.json()};return r===`GET`?c(e,n,Ne,i):i(await fetch(e,n))}var z=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`,Pe=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`;function Fe(e){let t=e.replaceAll(`\r +`,` +`).split(` + +`),n=t.pop()??``,r=[];return t.forEach(e=>{e.split(` +`).forEach(e=>{if(e.startsWith(`data:`))try{let t=JSON.parse(e.slice(5).trim());r.push(t)}catch{}})}),{frames:r,rest:n}}function Ie(e,t){let n=String(e.type??``);if(n===`phase`)t.onPhase?.(String(e.label??``),String(e.role??`manager`),String(e.detail??``),e.heartbeat===!0);else if(n===`delta`)t.onDelta?.(String(e.text??``),String(e.fragment_mode??`auto`));else if(n===`done`){let n=e.result??{};return t.onDone?.(n),n}else if(n===`error`)throw Error(String(e.error??`Manager stream failed`));return null}var B={timelineExample:()=>R(`/api/research/timeline/example`),timelineEstimate:(e,t)=>R(`/api/research/timeline/estimate`,{method:`POST`,body:JSON.stringify(e),signal:t}),timelineLatest:e=>R(z(e,`/research/timeline`)),timelineSave:(e,t,n,r)=>R(z(e,`/research/timeline`),{method:`POST`,body:JSON.stringify({input:t,expected_version:n,reason:r})}),projects:e=>R(`/api/projects`,{signal:e}),snapshot:(e,t)=>R(z(e,`/snapshot?events_limit=40&compact=false`),{signal:t}),status:(e,t)=>R(z(e,`/status`),{signal:t}),events:(e,t=180,n)=>R(z(e,`/events?limit=${t}&view=ui`),{signal:n}).then(e=>e.events),transcript:(e,t=100,n)=>R(z(e,`/transcript?n=${t}`),{signal:n}).then(e=>e.turns),journal:(e,t=80,n)=>R(z(e,`/journal?n=${t}`),{signal:n}).then(e=>e.journal),artifacts:(e,t)=>R(z(e,`/artifacts`),{signal:t}).then(e=>e.artifacts),counterexamples:(e,t)=>R(z(e,`/counterexamples`),{signal:t}),artifact:(e,t,n)=>R(z(e,`/artifact?${new URLSearchParams({path:t})}`),{signal:n}),artifactBlob:async(e,t,n=!1,r)=>{await u();let i=new URLSearchParams({path:t});n&&i.set(`download`,`true`);let a=z(e,`/artifact/raw?${i}`);return c(a,{headers:L(),signal:r,cache:`no-store`},Ne,async e=>{if(!e.ok)throw Error(`Artifact unavailable (${e.status})`);return e.blob()})},gitDiff:(e,t)=>R(z(e,`/git-diff`),{signal:t}),rewritePrompt:(e,t,n)=>R(z(e,`/prompt/rewrite`),{method:`POST`,body:JSON.stringify({text:t}),signal:n}),note:(e,t)=>R(z(e,`/note`),{method:`POST`,body:JSON.stringify({text:t})}),uploadAttachments:async(e,t,n)=>{await u();let r=new FormData;t.forEach(e=>r.append(`files`,e,e.name));let i=await fetch(z(e,`/attachments`),{method:`POST`,headers:L(),body:r,signal:n});if(!i.ok)throw Error(await i.text()||`attachment upload failed (${i.status})`);return await i.json()},createDaemon:(e,t=``,n=``)=>R(`/api/daemons`,{method:`POST`,body:JSON.stringify({objective:e,name:t,workdir:n,command_id:Pe()})}),createFinalReview:(e,t)=>R(z(e,`/reviews/final`),{method:`POST`,body:JSON.stringify(t)}),startDaemon:(e,t)=>R(z(e,`/daemon/start`),{method:`POST`,body:JSON.stringify({command_id:Pe(),expected_revision:t})}).then(f),stopDaemon:(e,t,n)=>R(z(e,`/daemon/stop`),{method:`POST`,body:JSON.stringify({drain:t,command_id:Pe(),expected_revision:n})}).then(f),async messageStream(e,t,n={},r,i=[]){await u();let a=z(e,`/message/stream`),o=await fetch(a,{method:`POST`,headers:L(!0),body:JSON.stringify(i.length?{text:t,attachments:i}:{text:t}),signal:r});if(!o.ok){let e=await o.text().catch(()=>``);throw Error(e||`Manager request failed (${o.status})`)}if(!o.body)throw Error(`Manager returned an empty stream`);let s=o.body.getReader(),c=new TextDecoder,l=``,d={};for(;;){let e=await s.read();if(e.done)break;l+=c.decode(e.value,{stream:!0});let t=Fe(l);l=t.rest,t.frames.forEach(e=>{let t=Ie(e,n);t&&(d=t)})}return Fe(`${l}\n\n`).frames.forEach(e=>{let t=Ie(e,n);t&&(d=t)}),d}};function Le(e,t,n){let r=!1,i=null,a,o=800,s=()=>{if(r)return;let c=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({replay:`40`,view:`ui`}),d=l();d&&u.set(`token`,d),i=new WebSocket(`${c}//${window.location.host}${z(e,`/stream`)}?${u}`),i.onopen=()=>{o=800,n(!0)},i.onmessage=e=>{try{t(JSON.parse(String(e.data)))}catch{}},i.onerror=()=>i?.close(),i.onclose=e=>{n(!1),!(r||e.code===4401||e.code===4404)&&(a=window.setTimeout(s,o),o=Math.min(o*1.7,8e3))}};return s(),{close:()=>{r=!0,a&&window.clearTimeout(a),i?.close()}}}var Re={active:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],running:[`进行中`,`In progress`],working:[`进行中`,`In progress`],pending:[`等待中`,`Waiting`],queued:[`等待中`,`Waiting`],waiting:[`等待中`,`Waiting`],idle:[`等待中`,`Waiting`],accepted:[`已完成`,`Completed`],complete:[`已完成`,`Completed`],completed:[`已完成`,`Completed`],done:[`已完成`,`Completed`],success:[`已完成`,`Completed`],blocked:[`已阻塞`,`Blocked`],failed:[`失败`,`Failed`],error:[`失败`,`Failed`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],replan_requested:[`需要重新规划`,`Needs replanning`],incomplete:[`尚未完成`,`Incomplete`],research_incomplete:[`研究尚未完成`,`Research incomplete`],paused_no_breakthrough:[`暂未取得突破,已暂停`,`Paused without a breakthrough`],exhausted_current_methods:[`当前方法已尝试完`,`Current methods exhausted`],no_progress:[`暂无新进展,已暂停`,`Paused without new progress`],max_rounds:[`已到本次轮次上限`,`Round limit reached`],infra_blocked:[`等待运行条件恢复`,`Waiting for the runtime to recover`],supervisor_error:[`执行异常`,`Execution failed`],skipped:[`已跳过`,`Skipped`],paused:[`已暂停`,`Paused`],paused_cost:[`费用待对账`,`Awaiting usage reconciliation`],stopped:[`已暂停`,`Paused`],cancelled:[`已暂停`,`Paused`],aborted:[`已暂停`,`Paused`],not_started:[`等待中`,`Waiting`],healthy:[`状态正常`,`Healthy`],degraded:[`部分受限`,`Limited`]},ze={system:[`Argus`,`Argus`],operator:[`你`,`You`],stopped:[`已暂停`,`Paused`],idle:[`等待中`,`Waiting`]};function Be(e,t,n,r){let i=t[String(e??``).toLowerCase()]??n;return r(i[0],i[1])}function Ve(e,t){return String(e??``).startsWith(`paused_`)&&!Re[String(e)]?t(`已暂停`,`Paused`):Be(e,Re,[`状态已更新`,`Status updated`],t)}function V(e,t){let n=String(e??``).toLowerCase();return D(n)?h(n,e=>t(d(e,{},`zh-CN`),d(e,{},`en`))):Be(e,ze,[`Argus`,`Argus`],t)}function H(){let{locale:e,t}=p();return{locale:e,text:(0,I.useCallback)((t,n)=>e===`zh-CN`?t:n,[e]),t}}function He(...e){return e.filter(Boolean).join(` `)}function Ue(e){let t=Math.max(0,Math.floor(Number(e??0)));if(t<60)return`${t}s`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n?`${n}d ${r}h`:r?`${r}h ${i}m`:`${i}m`}function We(e,t){return e?new Date(e*1e3).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):`—`}function Ge(e){let t=String(e??``).toLowerCase();return/failed|error|blocked|rejected|stalled|dead|abort/.test(t)?`danger`:/warn|waiting|paused|hold|queued|pending|continue/.test(t)?`warn`:/done|complete|completed|accepted|healthy|success|passed/.test(t)?`success`:/run|active|work|claimed|progress|live/.test(t)?`live`:/research|plan|info|ready/.test(t)?`info`:`neutral`}function Ke(e){let t=String(e.agent_layer??e.actor??``).toLowerCase();if(t===`main`||t.startsWith(`engineer`))return`engineer`;if(t.startsWith(`review`))return`reviewer`;if(t.startsWith(`plan`))return`planner`;if(t.startsWith(`manager`))return`manager`;let n=String(e.type??``);return/review/.test(n)?`reviewer`:/planner/.test(n)?`planner`:/manager/.test(n)?`manager`:/engineer|round/.test(n)?`engineer`:`system`}function qe(e,t){let n=String(e.action_summary??``).trim();if(n)return t?_e(n,t):n;let r=String(e.title??``).trim();if(r)return t?_e(r,t):r;let i=t?ae(String(e.type??``),t):null;if(i)return i;let a=String(e.kind??``).trim();return a?a.replaceAll(`_`,` `):String(e.type??`event`).split(`.`).slice(-2).join(` · `).replaceAll(`_`,` `)}function Je(e,t=400){let n=String(e.text??e.reason??e.summary??e.detail??``).trim();return n?n.length>t?`${n.slice(0,t)}…`:n:``}var U=n();function W({children:e,tone:t=`neutral`,dot:n=!1,className:r}){return(0,U.jsxs)(`span`,{className:He(`badge`,`badge--${t}`,r),children:[n?(0,U.jsx)(`span`,{className:He(`badge__dot`,t===`live`&&`is-pulsing`)}):null,e]})}function G({icon:e=Se,title:t,description:n,action:r}){return(0,U.jsxs)(`div`,{className:`empty-state`,children:[(0,U.jsx)(`span`,{className:`empty-state__icon`,children:(0,U.jsx)(e,{size:19})}),(0,U.jsx)(`div`,{className:`empty-state__title`,children:t}),n?(0,U.jsx)(`p`,{children:n}):null,r?(0,U.jsx)(`div`,{className:`empty-state__action`,children:r}):null]})}function Ye({label:e}){let{text:t}=H();return(0,U.jsxs)(`span`,{className:`spinner`,role:`status`,children:[(0,U.jsx)(F,{size:15,className:`spin`}),` `,e||t(`加载中`,`Loading`)]})}function Xe({events:e,limit:t=24,empty:n,dense:r=!1}){let{locale:i,text:a}=H(),o=e.slice(-t).reverse();return o.length?(0,U.jsx)(`div`,{className:He(`event-list`,r&&`event-list--dense`),children:o.map((e,t)=>{let n=Ke(e),o=qe(e,i),s=ce(Je(e,r?180:480),i).text,c=Ge(String(e.status??e.kind??e.type??``));return(0,U.jsxs)(`article`,{className:`event-row`,children:[(0,U.jsx)(`div`,{className:He(`event-row__marker`,`event-row__marker--${c}`)}),(0,U.jsxs)(`div`,{className:`event-row__content`,children:[(0,U.jsxs)(`div`,{className:`event-row__meta`,children:[(0,U.jsx)(`span`,{className:`role-label`,style:{color:O(n)},children:V(n,a)}),(0,U.jsx)(`time`,{children:We(e.ts,i)})]}),(0,U.jsx)(`div`,{className:`event-row__title`,children:o}),s?(0,U.jsx)(`div`,{className:`event-row__detail`,children:s}):null]})]},`${e.type}-${e.ts}-${e.message_id??t}`)})}):(0,U.jsx)(G,{icon:Oe,title:n||a(`还没有可展示的实时动态`,`No activity to show yet`)})}var Ze=new Set([`done`,`completed`,`accepted`,`success`]),Qe=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]),$e=/continue|replan|reject|blocked|fail|error|incomplete|revoked/,et=new Set([`assistant_message`,`agent_message`,`message`]),tt=new Set([`life.planner.task_added`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.phase.started`,`life.manager.stage_decision`,`round.start`,`round.main.completed`,`round.review.started`,`round.review.completed`,`round.review.deferred`,`round.backend_failure.backoff`,`work.segment`,`work.segment.started`,`work.segment.completed`]);function nt(e){let t=String(e.type??``),n=String(e.kind??``);return n!==`reasoning`&&!o(e)&&(tt.has(t)||t===`engineer.progress`&&(et.has(n)||[`tool_use`,`tool_result`,`command_execution`,`file_change`].includes(n)))}function rt(e){return e.type!==`engineer.progress`||!et.has(String(e.kind??``))?e:{...e,text:ie(String(e.text??``)),action_summary:ie(String(e.action_summary??``)),title:ie(String(e.title??``))}}function it(e,t){return t?e.backlog.find(e=>e.id===t)??null:e.backlog.find(e=>Qe.has(e.status))??e.backlog.find(e=>e.status===`pending`)??e.backlog.at(-1)??null}function K(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function at(e,t,n=Date.now()/1e3,r=`zh-CN`){let i=(e,t)=>r===`zh-CN`?e:t,a=e.mission_view,o=pe(e,a,t,n),s=it(e,o.taskId||a?.mission.id||``),c=s?.id||a?.mission.id||``,l=!!(c&&c===a?.mission.id),u=a?.dag?.length?a.dag:e.backlog,d=u.filter(e=>Ze.has(e.status)).length,f=u.filter(e=>/^(pending|queued|waiting)$/.test(e.status)).length,p=!!(a?.routing?.open_ended||a?.routing?.lifetime===`standing`||e.continuous?.open_ended),m=K(s?.started_ts)??(l?K(a?.mission.started_at):null),h=K(s?.finished_ts)??(l?K(a?.mission.completed_at):null),g=e.backlog.filter(e=>Qe.has(e.status)).length>1,_=t.filter(e=>{if(!c||m!==null&&Number(e.ts??0)Number(e.ts??0)-Number(t.ts??0)),v=_.filter(nt).map(rt).filter(e=>!et.has(String(e.kind??``))||!!(e.text||e.action_summary||e.title)),y=v.at(-1),b=o.state===`running`,x=h??(e.daemon.alive?n:K(_.at(-1)?.ts)??m),S=m===null||x===null?null:Math.max(0,x-m),C=[..._].reverse().find(e=>fe(e)===c&&e.type===`round.start`),w=Math.max(l?Number(a?.round.current??0):0,Number(C?.round_index??0)),T=[..._].reverse().find(e=>fe(e)===c&&e.type===`round.start`&&Number(e.round_index)===w),E=_.filter(e=>{if(fe(e)!==c||w<=0||T&&Number(e.ts??0)0?t===w:T!=null&&Number(e.ts??0)>=Number(T.ts??0)}),D=[...E].reverse().find(e=>e.type===`round.review.completed`),O=[...E].reverse().find(e=>e.type===`round.review.started`),k=!!(O&&(!D||Number(O.ts)>Number(D.ts))),A=b&&o.role===`reviewer`&&k,j=k?void 0:D,M=String(j?.status??``).toLowerCase(),ee=l?String(a?.review.status??``).toLowerCase():``,N=j?.review_skipped===!0||M===`skipped`,te=j?.review_source===`engineer_self_review`,ne=!j?.review_source||j.review_source===`reviewer`,re=!N&&ne&&M===`done`,P=!N&&($e.test(M)||!j&&!A&&$e.test(ee)),F=A?`running`:N?`skipped`:re?`passed`:te&&M===`done`?`self_checked`:P?`needs_work`:`pending`,ie={pending:i(`结论待核对`,`Conclusion awaiting review`),running:i(`正在核对证据`,`Checking the evidence`),passed:i(`本轮工作通过核对`,`This round passed review`),needs_work:i(`仍需补充或修改`,`More work is needed`),skipped:i(`本轮未做审查`,`This round was not reviewed`),self_checked:i(`执行者已自查,待独立核对`,`Self-checked; independent review pending`)},ae={pending:i(`尚无能对应到当前工作项和轮次的通过记录。`,`No passing review is linked to the current work item and round.`),running:i(`审阅者正在核对本轮结果及其证据。`,`The Reviewer is checking this round’s results and evidence.`),passed:i(`通过记录仅适用于本轮提交的工作与证据。`,`The passing verdict applies to the work and evidence submitted in this round.`),needs_work:i(`审查发现仍有待处理的问题,需要继续工作。`,`The review found issues that require further work.`),skipped:i(`执行结束并不代表证据已经通过核对。`,`The end of execution does not establish that the evidence passed review.`),self_checked:i(`这条记录来自执行者自查,尚无本轮独立审查通过记录。`,`This record is a self-check by the worker; no independent passing review is recorded for this round.`)},oe={state:F,label:ie[F],detail:String(j?.reason||P&&a?.review.reason||ae[F]),scope:i(`当前工作项${w>0?` · 第 ${w} 轮`:``}。整体目标是否成立,仍须核对其完整验收条件。`,`Current work item${w>0?` · Round ${w}`:``}. The overall goal still requires checking its full acceptance criteria.`)},se=[...E].reverse().find(e=>e.type===`round.main.completed`),ce=F===`passed`?`done`:F===`running`?`active`:F===`needs_work`?`blocked`:`pending`,le=[{id:`plan`,label:i(`工作项已记录`,`Work item recorded`),detail:s?.title||a?.mission.title||i(`等待任务`,`Waiting for a task`),status:s||l?`done`:`pending`},{id:`start`,label:i(`开始执行`,`Execution started`),detail:m===null?i(`尚无启动记录`,`No start is recorded`):i(`有任务启动时间记录`,`A task start time is recorded`),status:m===null?`pending`:`done`},{id:`handoff`,label:i(`本轮执行已结束`,`Round execution ended`),detail:se?i(`已记录本轮执行结束,结果是否可用仍需核对`,`The round’s execution ended; its results still need to be checked`):i(`尚无本轮执行结束记录`,`No end of execution is recorded for this round`),status:se?`done`:b&&o.role===`engineer`?`active`:`pending`},{id:`review`,label:i(`核对本轮证据`,`Check this round’s evidence`),detail:oe.label,status:ce}],de=!!(s&&Ze.has(s.status))||l&&[`complete`,`completed`,`done`].includes(a?.mission.status??``),me=e.daemon.alive?p?i(`开放研究的剩余工作量尚不确定,无法可靠预计整体完成时间。`,`Open research has no known remaining workload, so its overall finish time cannot be reliably estimated.`):P?i(`审查要求继续补充或调整工作范围,暂无法预计完成时间。`,`Review requires further work or a scope change; a finish time is unavailable.`):de?i(`当前工作项已结束;这不提供整体目标的完成时间。`,`The current work item has ended; this does not establish when the overall goal will be reached.`):i(`当前记录没有可比较的固定工作量基线,暂无法可靠预计完成时间。`,`The current records contain no comparable, fixed-workload baseline for a reliable finish-time estimate.`):i(`运行已停止,无法预计完成时间。`,`Execution has stopped; a finish time is unavailable.`);return{workCompletion:u.length?d/u.length:null,workScope:i(`仅统计已记录的工作项;清单可随研究增减,完成比例不代表整体目标已成立。`,`Counts recorded work items only. The list can change during research; its completion fraction does not establish the overall goal.`),currentTask:s?.title||a?.mission.title||i(`等待新任务`,`Waiting for a new task`),currentTaskId:c,currentObjective:s?.objective||(l?a?.mission.objective:``)||``,currentStep:b&&y?qe(y,r):ue(o,r),currentDetail:y?Je(y,700):s?.objective||``,currentEvent:y??null,runtime:o,elapsedSeconds:S,etaUnavailableReason:me,checkpoints:le,completedTasks:d,totalTasks:u.length,pendingTasks:f,openEnded:p,review:oe,acceptanceCriteria:s?.acceptance_check||u.find(e=>e.id===c)?.acceptance_check||``,nextAction:s?.pending_question||String(j?.next_action||``),taskEvents:v}}var ot=new Set([`done`,`completed`,`accepted`,`success`]),st=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]);function ct(e){let{locale:t,text:n,t:r}=H(),[i,a]=(0,I.useState)(()=>Date.now()/1e3),[o,s]=(0,I.useState)(``);(0,I.useEffect)(()=>{if(!e.active||!e.snapshot.daemon.alive)return;a(Date.now()/1e3);let t=window.setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(t)},[e.active,e.snapshot.daemon.alive]);let c=(0,I.useMemo)(()=>at(e.snapshot,e.events,i,t),[t,i,e.events,e.snapshot]),l=e.snapshot.mission_view,u=l?.dag?.length?l.dag:e.snapshot.backlog.map(e=>({id:e.id,title:e.title,objective:e.objective,status:e.status,deps:e.deps??[],branch_id:e.id,parent_branch_id:``})),d=u.find(e=>e.id===o)??u.find(e=>e.id===c.currentTaskId),f=he(l?.stage.id,t),p=l?.stage.label&&l.stage.label!==l.stage.id?l.stage.label:f||l?.stage.id||n(`尚未记录`,`Not yet recorded`),h=c.runtime.state===`running`,g=ue(c.runtime,t),b=c.taskEvents.filter(e=>String(e.kind??``)!==`reasoning`&&!le(String(e.type??``))),x=ce(c.currentDetail,t),C=c.currentEvent?de(c.currentEvent,t):null,T=ce(c.review.detail,t),D=[{label:n(`已完成的工作`,`Completed work`),items:u.filter(e=>ot.has(e.status))},{label:n(`进行中与待处理`,`Active and remaining work`),items:u.filter(e=>!ot.has(e.status))}],k=async t=>{let r=t?n(`确认完成当前步骤后停止 Argus?`,`Stop Argus after the current step finishes?`):n(`确认立即停止 Argus?当前步骤可能被中断。`,`Stop Argus now? The current step may be interrupted.`);confirm(r)&&await e.controls.stop(t)};return(0,U.jsxs)(`div`,{className:`ros-page experiment-v3`,children:[(0,U.jsxs)(`header`,{className:`ros-page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{children:n(`任务进展`,`Work progress`)}),(0,U.jsx)(`p`,{children:n(`看清做了哪些工作、结论核对到了哪里,以及团队接下来要做什么。`,`See what work was done, which conclusions were checked, and what the team needs to do next.`)})]}),(0,U.jsxs)(`div`,{className:`experiment-header-actions`,children:[(0,U.jsxs)(`button`,{className:`button button--secondary`,type:`button`,onClick:()=>void e.refresh(),children:[(0,U.jsx)(y,{size:14}),n(`刷新`,`Refresh`)]}),e.snapshot.daemon.alive&&e.snapshot.daemon.control_available===!1?null:e.snapshot.daemon.alive?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{className:`button button--secondary`,type:`button`,disabled:e.controls.busy,onClick:()=>void k(!0),children:[(0,U.jsx)(ge,{size:14}),n(`当前步后停止`,`Stop after step`)]}),(0,U.jsxs)(`button`,{className:`button button--danger`,type:`button`,disabled:e.controls.busy,onClick:()=>void k(!1),children:[(0,U.jsx)(se,{size:13}),n(`立即停止`,`Stop now`)]})]}):(0,U.jsxs)(`button`,{className:`button button--primary`,type:`button`,disabled:e.controls.busy,onClick:()=>void e.controls.start(),children:[(0,U.jsx)(M,{size:14}),n(`继续运行`,`Resume`)]})]})]}),(0,U.jsxs)(`section`,{className:`experiment-progress-hero`,children:[(0,U.jsxs)(`div`,{className:`progress-hero-main`,children:[(0,U.jsxs)(`div`,{className:`progress-live-line`,children:[(0,U.jsx)(W,{tone:h?`live`:`neutral`,dot:h,children:g}),c.runtime.role?(0,U.jsx)(`span`,{children:V(c.runtime.role,n)}):null]}),(0,U.jsx)(`h2`,{children:c.currentTask}),c.currentObjective?(0,U.jsx)(`p`,{className:`work-objective`,children:c.currentObjective}):null,(0,U.jsxs)(`div`,{className:`current-step-callout`,children:[(0,U.jsx)(`span`,{children:(0,U.jsx)(v,{size:17})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`small`,{children:h?n(`当前动作`,`Current action`):n(`当前状态与最近记录`,`Current state and latest record`)}),(0,U.jsx)(`strong`,{children:C?.title||c.currentStep}),C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{children:C.detail}),(0,U.jsx)(E,{label:n(`原始调用记录`,`Original call record`),children:(0,U.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs`,children:c.currentDetail})})]}):c.currentDetail?(0,U.jsx)(`p`,{title:x.technical||void 0,children:x.text}):null]})]})]}),(0,U.jsxs)(`div`,{className:`progress-number`,children:[(0,U.jsx)(`span`,{children:n(`已完成的工作项`,`Completed work items`)}),(0,U.jsxs)(`strong`,{children:[c.completedTasks,(0,U.jsxs)(`em`,{children:[` / `,c.totalTasks||`—`]})]}),(0,U.jsx)(`small`,{children:n(`按当前记录计数`,`Counted from current records`)})]}),(0,U.jsxs)(`div`,{className:`truthful-progress`,children:[c.workCompletion===null?null:(0,U.jsx)(`div`,{className:`truthful-progress__track`,role:`progressbar`,"aria-label":n(`已记录工作项的完成情况`,`Completion of recorded work items`),"aria-valuemin":0,"aria-valuemax":c.totalTasks,"aria-valuenow":c.completedTasks,"aria-valuetext":n(`${c.totalTasks} 项已记录工作中完成 ${c.completedTasks} 项`,`${c.completedTasks} of ${c.totalTasks} recorded work items completed`),children:(0,U.jsx)(`span`,{className:`confirmed`,style:{width:`${c.workCompletion*100}%`}})}),(0,U.jsx)(`p`,{className:`work-scope`,children:c.workScope})]}),(0,U.jsxs)(`div`,{className:`progress-metrics`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(te,{size:15}),n(`当前工作项已用时间`,`Current work item elapsed`)]}),(0,U.jsx)(`strong`,{children:c.elapsedSeconds===null?`—`:Ue(c.elapsedSeconds)}),(0,U.jsx)(`small`,{children:n(`按任务启动与结束记录计算`,`Based on recorded task start and end times`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{children:n(`实际记录的阶段`,`Recorded stage`)}),(0,U.jsx)(`strong`,{children:p}),(0,U.jsx)(`small`,{children:n(`阶段名称不表示前面的工作已通过核验`,`The stage name does not certify earlier work`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{children:n(`工作范围`,`Work scope`)}),(0,U.jsx)(`strong`,{children:c.openEnded?n(`开放研究`,`Open research`):n(`当前工作项`,`Current work item`)}),(0,U.jsx)(`small`,{children:c.openEnded?n(`可能产生新的问题和任务`,`New questions and tasks may emerge`):n(`以该工作项的验收条件为准`,`Defined by this item’s acceptance criteria`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(Me,{size:15}),n(`等待执行的工作`,`Work waiting to start`)]}),(0,U.jsx)(`strong`,{children:c.pendingTasks}),(0,U.jsx)(`small`,{children:n(`已记录清单中的等待项`,`Waiting items in the recorded list`)})]})]})]}),(0,U.jsxs)(`div`,{className:`experiment-v3-grid`,children:[(0,U.jsxs)(`aside`,{className:`ros-card experiment-task-route`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`工作项`,`Work items`)})}),(0,U.jsx)(W,{tone:`neutral`,children:u.length})]}),(0,U.jsx)(`div`,{children:u.length?D.map(e=>(0,U.jsxs)(`section`,{className:`work-item-group`,children:[(0,U.jsxs)(`h3`,{children:[e.label,(0,U.jsx)(`span`,{children:e.items.length})]}),e.items.length?e.items.map(e=>{let t=h&&e.id===c.currentTaskId&&st.has(e.status),r=st.has(e.status)&&!t?e.id===c.currentTaskId?g:n(`等待状态确认`,`Awaiting status confirmation`):Ve(e.status,n);return(0,U.jsxs)(`button`,{type:`button`,className:d?.id===e.id?`is-active`:``,onClick:()=>s(e.id),children:[(0,U.jsx)(`span`,{className:`task-state task-state--${ot.has(e.status)?`success`:t?`live`:`neutral`}`,children:ot.has(e.status)?(0,U.jsx)(_,{size:12}):t?(0,U.jsx)(v,{size:12}):(0,U.jsx)(be,{size:9})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.title||e.objective||n(`未命名任务`,`Untitled task`)}),(0,U.jsxs)(`small`,{children:[r,e.deps.length?n(` · 前置工作 ${e.deps.length} 项`,` · ${e.deps.length} dependencies`):``]})]})]},e.id)}):(0,U.jsx)(`p`,{className:`work-group-empty`,children:n(`暂无记录`,`No records yet`)})]},e.label)):(0,U.jsx)(G,{icon:Me,title:n(`尚无工作项`,`No work items yet`)})})]}),(0,U.jsxs)(`main`,{className:`experiment-v3-center`,children:[(0,U.jsxs)(`section`,{className:`ros-card work-conclusion`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`本轮结论与待核对问题`,`This round’s conclusions and open checks`)})}),(0,U.jsx)(W,{tone:c.review.state===`passed`?`success`:c.review.state===`running`?`live`:`warn`,children:c.review.label})]}),(0,U.jsxs)(`div`,{className:`work-conclusion__body`,children:[(0,U.jsx)(`p`,{title:T.technical||void 0,children:T.text}),c.acceptanceCriteria?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:n(`判断这项工作是否完成的标准`,`How this work item is accepted`)}),(0,U.jsx)(`p`,{children:c.acceptanceCriteria})]}):null,c.nextAction?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:n(`下一步要处理`,`What needs to happen next`)}),(0,U.jsx)(`p`,{children:c.nextAction})]}):null,(0,U.jsx)(`p`,{className:`work-scope`,children:c.review.scope})]})]}),(0,U.jsxs)(`section`,{className:`ros-card checkpoint-card`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`当前工作项的过程记录`,`Current work item’s recorded steps`)})}),(0,U.jsx)(W,{tone:`neutral`,children:n(`以记录为准`,`Based on records`)})]}),(0,U.jsx)(`div`,{className:`checkpoint-list`,children:c.checkpoints.map((e,t)=>(0,U.jsxs)(`div`,{className:`checkpoint checkpoint--${e.status}`,children:[(0,U.jsx)(`span`,{children:e.status===`done`?(0,U.jsx)(_,{size:13}):e.status===`active`?(0,U.jsx)(v,{size:13}):e.status===`blocked`?(0,U.jsx)(ve,{size:13}):t+1}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.label}),(0,U.jsx)(`p`,{children:e.detail})]}),t{let t=h&&c.runtime.role===e;return(0,U.jsxs)(`article`,{className:t?`is-active`:``,children:[(0,U.jsx)(`span`,{"data-role-dot":e,className:`role-dot`,style:{backgroundColor:O(e)},"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:V(e,n)}),(0,U.jsx)(`p`,{children:S(e,r)})]}),t?(0,U.jsx)(W,{tone:`live`,dot:!0,children:n(`执行中`,`Working`)}):(0,U.jsx)(W,{tone:`neutral`,children:n(`未在执行`,`Not working`)})]},e)})})]}),(0,U.jsxs)(`section`,{className:`ros-card estimate-note`,children:[(0,U.jsx)(`header`,{children:(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`还需要多久`,`How much longer?`)})})}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:n(`暂无法可靠预计`,`No reliable estimate yet`)}),c.etaUnavailableReason]}),(0,U.jsxs)(`div`,{className:`work-evidence-note`,children:[(0,U.jsx)(m,{size:15}),(0,U.jsx)(`span`,{children:n(`真实已用时间和已完成工作可以统计。读文件、运行命令或审查结束,都不能换算成整体目标的完成百分比。`,`Elapsed time and completed work can be counted. File reads, commands, and the end of a review do not establish a completion percentage for the overall goal.`)})]}),e.controls.error?(0,U.jsx)(`div`,{className:`inline-error`,children:e.controls.error}):null]})]})]})]})]})}function lt(e){if(!e||e.length>2e5||e.includes(`\0`)||!e.startsWith(`diff --git `)&&!/^--- [^\n]+\n\+\+\+ /.test(e)||/^(?:Binary files |GIT binary patch)/m.test(e))return null;let t=e.match(/[^\n]*\n|[^\n]+$/g)??[];if(t.length>3e3)return null;let n=[],r=0,i=0;for(let e of t){let t=e.replace(/\r?\n$/,``),a,o=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@(?:.*)$/.exec(t);if(t.startsWith(`diff --git `))a=`header`,r=0,i=0;else if(o){if(a=`hunk`,r=Number(o[1]??1),i=Number(o[2]??1),!Number.isSafeInteger(r)||!Number.isSafeInteger(i))return null}else if(t===`\\ No newline at end of file`)a=`header`;else if(r||i){if(t.startsWith(`+`))a=`addition`,i--;else if(t.startsWith(`-`))a=`deletion`,r--;else if(t.startsWith(` `))a=`context`,r--,i--;else return null;if(r<0||i<0)return null}else if(/^(?:--- |\+\+\+ |index |old mode |new mode |new file mode |deleted file mode |similarity index |dissimilarity index |rename from |rename to |copy from |copy to )/.test(t))a=`header`;else return null;n.push({kind:a,text:e})}return n}function ut({diff:e,truncated:t=!1}){let{text:n}=H(),r=(0,I.useMemo)(()=>lt(e),[e]),[i,a]=(0,I.useState)(!1),o=r!==null&&!i;return(0,U.jsxs)(`section`,{className:`readonly-diff`,"data-readonly-diff":!0,children:[(0,U.jsxs)(`div`,{className:`readonly-diff__toolbar`,children:[(0,U.jsx)(`strong`,{children:n(`当前工作区差异`,`Current workspace diff`)}),r&&(0,U.jsx)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?n(`着色视图`,`Highlighted view`):n(`原始文本`,`Original text`)}),e&&(0,U.jsx)(C,{text:e,label:n(`复制原始差异`,`Copy original diff`),copiedLabel:n(`已复制`,`Copied`)})]}),(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`不代表所有变更都来自当前 Agent 或任务。`,`Changes are not necessarily from this Agent or task.`)}),t&&(0,U.jsx)(`p`,{role:`status`,className:`readonly-diff__notice`,children:n(`后端返回的差异已截断,当前内容不完整。`,`The backend truncated this diff; the displayed content is incomplete.`)}),e?r?null:(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`无法识别、二进制或较大差异:显示原始文本。`,`Unrecognized, binary or large diff: showing original text.`)}):(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`没有工作区差异。`,`No workspace diff.`)}),(0,U.jsx)(`pre`,{className:`readonly-diff__text`,tabIndex:0,"aria-label":n(`工作区差异文本`,`Workspace diff text`),"data-diff-mode":o?`highlighted`:`raw`,children:o?r.map((e,t)=>(0,U.jsx)(`span`,{"data-diff-kind":e.kind,className:`readonly-diff__line--${e.kind}`,children:e.text},t)):e})]})}async function q(e,t,n){let r=new URLSearchParams(t),i=await fetch(`${e}?${r}`,{headers:L(),signal:n,cache:`no-store`});if(!i.ok){let t=await i.json().catch(()=>({}));throw Error(t.detail||t.error||`${e} failed (${i.status})`)}return i.json()}var J=(e,t)=>({sid:e,workspace_id:t}),Y={profiles:(e,t)=>q(`/api/v2/workspaces`,{sid:e},t),tree:(e,t,n)=>q(`/api/v2/workspace/tree`,J(e,t),n),file:(e,t,n,r)=>q(`/api/v2/workspace/file`,{...J(e,t),path:n},r),git:(e,t,n)=>q(`/api/v2/workspace/git`,J(e,t),n),literature:(e,t,n)=>q(`/api/v2/workspace/literature`,J(e,t),n),rawUrl:(e,t,n)=>`/api/v2/workspace/raw?${new URLSearchParams({...J(e,t),path:n})}`,rawBlob:async(e,t,n,r)=>{let i=await fetch(`/api/v2/workspace/raw?${new URLSearchParams({...J(e,t),path:n})}`,{headers:L(),signal:r,cache:`no-store`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`raw preview failed (${i.status})`)}return i.blob()}};function dt(e){let t=new Map;e.forEach(e=>t.set(e.path,{...e,children:[]}));let n=[];t.forEach(e=>{let r=e.path.lastIndexOf(`/`),i=r>=0?e.path.slice(0,r):``,a=i?t.get(i):null;a?a.children.push(e):n.push(e)});let r=e=>{e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1),e.forEach(e=>r(e.children))};return r(n),n}function ft(e,t,n){let[r,i]=(0,I.useState)(``),[a,o]=(0,I.useState)(``);return(0,I.useEffect)(()=>{if(i(``),o(``),!e||!t||!n)return;let r=new AbortController,a=``;return Y.rawBlob(e,t,n,r.signal).then(e=>{a=URL.createObjectURL(e),i(a)},e=>{r.signal.aborted||o(e.message)}),()=>{r.abort(),a&&URL.revokeObjectURL(a)}},[n,e,t]),{url:r,error:a}}function pt(e,t,n=!0){let i=r({queryKey:[`workspace-profiles`,e],queryFn:({signal:t})=>Y.profiles(e,t),staleTime:1e4,enabled:!!e&&n}),a=`argus-v2-workspace-profile:${t}:${e}`,[o,s]=(0,I.useState)(()=>N(a)||``),c=(0,I.useMemo)(()=>{let e=i.data?.profiles??[];return e.find(e=>e.id===o)??e.find(e=>e.id===i.data?.default_id)??e.find(e=>e.canonical)??e[0]??null},[i.data,o]);return(0,I.useEffect)(()=>{c&&c.id!==o&&s(c.id)},[c,o]),{profiles:i,active:c,workspaceId:c?.id??``,setWorkspaceId:e=>{s(e),ee(a,e)}}}function mt({node:e,depth:t,selected:n,expanded:r,onToggle:i,onSelect:a}){let o=e.type===`directory`,s=r.has(e.path);return(0,U.jsxs)(`div`,{className:`workspace-node`,children:[(0,U.jsxs)(`button`,{type:`button`,className:n===e.path?`is-selected`:``,style:{paddingLeft:7+t*13},onClick:()=>o?i(e.path):a(e.path),children:[o?s?(0,U.jsx)(g,{size:13}):(0,U.jsx)(P,{size:13}):(0,U.jsx)(`span`,{className:`node-spacer`}),o?(0,U.jsx)(ne,{size:14}):(0,U.jsx)(xe,{size:14}),(0,U.jsx)(`span`,{children:e.name}),e.skipped?(0,U.jsx)(`small`,{children:`restricted`}):null]}),o&&s?e.children.map(e=>(0,U.jsx)(mt,{node:e,depth:t+1,selected:n,expanded:r,onToggle:i,onSelect:a},e.path)):null]})}function ht({sid:e,workspaceId:t,path:n,active:i}){let{text:a}=H(),o=n.toLowerCase().slice(n.lastIndexOf(`.`)),s=[`.pdf`,`.png`,`.jpg`,`.jpeg`,`.webp`,`.svg`].includes(o),c=r({queryKey:[`workspace-file`,e,t,n],queryFn:({signal:r})=>Y.file(e,t,n,r),enabled:!!(i&&n&&t&&!s),refetchInterval:5e3}),l=ft(s?e:``,s?t:``,s?n:``);if(!n)return(0,U.jsx)(G,{icon:Se,title:a(`打开一个文件开始阅读`,`Open a file to start reading`),description:a(`左侧文件树展示所选代码工作区。`,`The file tree shows the selected code workspace.`)});if(s)return l.error?(0,U.jsx)(G,{icon:De,title:`Preview unavailable`,description:l.error}):l.url?o===`.pdf`?(0,U.jsx)(me,{src:l.url,name:n.split(`/`).at(-1)||n,className:`workspace-pdf`}):(0,U.jsx)(`img`,{className:`workspace-image`,src:l.url,alt:n}):(0,U.jsx)(`div`,{className:`editor-loading`,children:`Loading preview…`});if(c.isLoading)return(0,U.jsxs)(`div`,{className:`editor-loading`,children:[`Opening `,n,`…`]});if(c.isError)return(0,U.jsx)(G,{icon:De,title:`Preview unavailable`,description:c.error.message});let u=(c.data?.content??``).split(` +`);return(0,U.jsxs)(`div`,{className:`vscode-code`,tabIndex:0,"aria-label":a(`文件内容`,`File contents`),children:[(0,U.jsx)(`div`,{className:`vscode-line-numbers`,children:u.map((e,t)=>(0,U.jsx)(`span`,{children:t+1},t))}),(0,U.jsx)(`pre`,{children:(0,U.jsx)(`code`,{children:c.data?.content})})]})}function gt(e){let{locale:t,text:n}=H(),i=pt(e.sid,`ide`,e.active),a=i.workspaceId,o=i.active?.path||``,[s,c]=(0,I.useState)(``),[l,u]=(0,I.useState)(new Set),d=(0,I.useRef)(``),f=(0,I.useRef)(null),p=e=>{c(e);let t=f.current,n=t?.closest(`.vscode-shell`),r=t?.closest(`.ros-content`);t&&n&&r&&getComputedStyle(n).display===`flex`&&r.scrollTo({top:r.scrollTop+t.getBoundingClientRect().top-r.getBoundingClientRect().top-12,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[m,h]=(0,I.useState)(`files`),[v,x]=(0,I.useState)(`repository`),S=r({queryKey:[`workspace-tree`,e.sid,a],queryFn:({signal:t})=>Y.tree(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),C=r({queryKey:[`workspace-git`,e.sid,a],queryFn:({signal:t})=>Y.git(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),w=(0,I.useMemo)(()=>dt(S.data?.entries??[]),[S.data?.entries]);(0,I.useEffect)(()=>{c(``),u(new Set),d.current=``},[a]),(0,I.useEffect)(()=>{!a||!w.length||d.current===a||(d.current=a,u(new Set(w.filter(e=>e.type===`directory`).slice(0,5).map(e=>e.path))))},[w,a]);let T=e.events.filter(e=>[`command_execution`,`tool_use`,`tool_result`,`file_change`].includes(String(e.kind??``))).slice(-100),E=(C.data?.status??``).split(` +`).filter(Boolean),D=(C.data?.log??``).split(` +`).filter(Boolean).map(e=>{let[t,n,r,...i]=e.split(` `);return{hash:t,date:n,author:r,subject:i.join(` `)}}),k=C.data;return(0,U.jsxs)(`div`,{className:`ros-page ide-v3`,children:[(0,U.jsxs)(`header`,{className:`ros-page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`eyebrow`,children:`AI IDE`}),(0,U.jsx)(`h1`,{children:n(`代码工作区`,`Code workspace`)}),(0,U.jsx)(`p`,{children:n(`此视图只用于浏览文件、Git 状态与 Argus 活动;不限制 Agent 本身的文件写入权限。`,`This view only browses files, Git state and Argus activity; it does not restrict the Agent’s file write permissions.`)})]}),(0,U.jsxs)(W,{tone:`info`,children:[(0,U.jsx)(De,{size:12}),n(`此视图只读`,`This view is read-only`)]})]}),(0,U.jsxs)(`div`,{className:`ide-context-strip`,children:[(0,U.jsx)(ke,{size:15}),(0,U.jsx)(`select`,{"aria-label":n(`选择已批准工作区`,`Select approved workspace`),value:a,onChange:e=>i.setWorkspaceId(e.target.value),children:i.profiles.data?.profiles.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,U.jsx)(`code`,{children:o}),S.isError?(0,U.jsx)(W,{tone:`danger`,children:n(`连接失败`,`Connection failed`)}):S.isFetching?(0,U.jsx)(W,{tone:`live`,dot:!0,children:n(`同步中`,`Syncing`)}):(0,U.jsxs)(W,{tone:`success`,children:[(0,U.jsx)(re,{size:11}),`Synced`]}),(0,U.jsxs)(`small`,{children:[S.data?.entries.length??0,` entries`]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{S.refetch(),C.refetch()},"aria-label":n(`刷新工作区`,`Refresh workspace`),children:(0,U.jsx)(y,{size:14})})]}),(0,U.jsxs)(`div`,{className:`vscode-shell`,children:[(0,U.jsxs)(`nav`,{className:`vscode-activitybar`,children:[(0,U.jsx)(`button`,{type:`button`,className:m===`files`?`is-active`:``,onClick:()=>h(`files`),title:`Explorer`,"aria-label":`Explorer`,children:(0,U.jsx)(Ce,{size:21})}),(0,U.jsxs)(`button`,{type:`button`,className:m===`git`?`is-active`:``,onClick:()=>h(`git`),title:`Source Control`,"aria-label":`Source Control`,children:[(0,U.jsx)(j,{size:21}),E.length?(0,U.jsx)(`i`,{children:E.length}):null]})]}),(0,U.jsxs)(`aside`,{className:`vscode-sidebar`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`span`,{children:m===`git`?`SOURCE CONTROL`:`EXPLORER`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void S.refetch(),"aria-label":n(`刷新文件树`,`Refresh file tree`),children:(0,U.jsx)(y,{size:14})})]}),m===`files`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`vscode-root`,children:[(0,U.jsx)(g,{size:13}),(0,U.jsx)(`strong`,{title:o,children:o.split(/[\\/]/).filter(Boolean).at(-1)||o})]}),(0,U.jsx)(`div`,{className:`workspace-tree`,children:S.isError?(0,U.jsx)(G,{icon:ke,title:n(`目录连接失败`,`Directory connection failed`),description:S.error.message}):w.map(e=>(0,U.jsx)(mt,{node:e,depth:0,selected:s,expanded:l,onToggle:e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:p},e.path))})]}):(0,U.jsx)(`div`,{className:`vscode-changes`,children:E.length?E.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{let t=e.slice(3).trim(),n=t.includes(` -> `)?t.split(` -> `).at(-1):t;n.endsWith(`/`)||p(n)},children:[(0,U.jsx)(`b`,{children:e.slice(0,2).trim()||`?`}),(0,U.jsx)(`span`,{children:e.slice(3)})]},e)):(0,U.jsx)(`p`,{children:`No changes`})})]}),(0,U.jsxs)(`main`,{className:`vscode-editor`,ref:f,children:[(0,U.jsx)(`div`,{className:`vscode-tabs`,children:(0,U.jsxs)(`button`,{type:`button`,className:`is-active`,children:[(0,U.jsx)(A,{size:13}),s||`Welcome`]})}),(0,U.jsx)(`div`,{className:`vscode-breadcrumbs`,children:s?s.split(`/`).map((e,t)=>(0,U.jsxs)(`span`,{children:[e,tx(`changes`),children:`Changes`}),(0,U.jsx)(`button`,{type:`button`,className:v===`timeline`?`is-active`:``,onClick:()=>x(`timeline`),children:`Timeline`}),(0,U.jsx)(`button`,{type:`button`,className:v===`repository`?`is-active`:``,onClick:()=>x(`repository`),children:`Repository`})]}),(0,U.jsx)(`div`,{className:`vscode-git-content`,children:k?.available?v===`changes`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{className:`vscode-status`,children:k.status||`Working tree clean`}),(0,U.jsx)(ut,{diff:k.diff,truncated:k.truncated})]}):v===`timeline`?(0,U.jsx)(`div`,{className:`vscode-commits`,children:D.map(e=>(0,U.jsxs)(`article`,{children:[(0,U.jsx)(j,{size:13}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.subject}),(0,U.jsxs)(`small`,{children:[e.author,` · `,e.date?.slice(0,10)]})]})]},e.hash))}):(0,U.jsxs)(`div`,{className:`repository-readiness`,children:[(0,U.jsx)(`h3`,{children:`Repository readiness`}),(0,U.jsxs)(`dl`,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(j,{size:13}),`Remote`]}),(0,U.jsx)(`dd`,{children:k.remotes.length?k.remotes.map(e=>`${e.name}: ${e.fetch}`).join(` +`):`Not configured`}),(0,U.jsx)(`i`,{className:k.remotes.length?`ok`:`missing`,children:k.remotes.length?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(j,{size:13}),`Upstream`]}),(0,U.jsxs)(`dd`,{children:[k.upstream||`Not configured`,k.upstream?` · ahead ${k.ahead}, behind ${k.behind}`:``]}),(0,U.jsx)(`i`,{className:k.upstream?`ok`:`missing`,children:k.upstream?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(je,{size:13}),`Commit identity`]}),(0,U.jsx)(`dd`,{children:k.identity.name&&k.identity.email?`${k.identity.name} <${k.identity.email}>`:`Not configured`}),(0,U.jsx)(`i`,{className:k.identity.valid?`ok`:`missing`,children:k.identity.valid?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(Ee,{size:13}),`GitHub CLI`]}),(0,U.jsx)(`dd`,{children:k.github.authenticated?`${k.github.login} · ${k.github.protocol}`:`Not authenticated`}),(0,U.jsx)(`i`,{className:k.github.authenticated?`ok`:`missing`,children:k.github.authenticated?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]})]}),(0,U.jsx)(`p`,{children:k.publish_ready?`Repository is ready for an explicitly approved push.`:`Configure the missing items before publishing. No credentials are shown in this UI.`})]}):(0,U.jsx)(G,{icon:j,title:`Not a Git repository`})})]}),(0,U.jsxs)(`section`,{className:`vscode-terminal`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`strong`,{children:`ARGUS ACTIVITY`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(Ae,{size:13}),`read-only`]})]}),(0,U.jsx)(`div`,{children:T.length?T.map((e,r)=>(0,U.jsxs)(`article`,{children:[(0,U.jsx)(`time`,{children:We(e.ts,t)}),(0,U.jsx)(`b`,{className:`terminal-role`,style:{color:O(Ke(e))},children:V(Ke(e),n)}),(0,U.jsx)(`span`,{children:`›`}),(0,U.jsx)(`code`,{children:Je(e,800)||qe(e)})]},`${e.ts}-${r}`)):(0,U.jsx)(`p`,{children:`$ waiting for Argus activity`})})]}),(0,U.jsxs)(`footer`,{className:`vscode-statusbar`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(j,{size:12}),k?.branch||`no branch`]}),(0,U.jsx)(`span`,{children:S.isError?`Workspace error`:S.isFetching?`Workspace syncing`:S.data?.truncated?`Tree truncated`:`Workspace synced`}),(0,U.jsx)(`span`,{children:k?.github.authenticated?`GitHub: ${k.github.login}`:`GitHub: offline`}),(0,U.jsx)(`span`,{children:`UTF-8`}),(0,U.jsx)(`span`,{children:s.split(`.`).at(-1)?.toUpperCase()||`Plain Text`})]})]})]})}var X=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm`;function _t({task:e,resources:t,onChange:n,text:r}){let i=e.execution_options??[],a=(e,t)=>n(i.map(n=>n.id===e?{...n,...t}:n));return(0,U.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-dashed border-line p-3 sm:col-span-2`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-medium`,children:r(`期限紧张时的替代做法`,`Alternative execution options for tighter deadlines`)}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:r(`每种做法都有独立工期、资源和取舍。系统只会选择已声明保留必需验收目标的方案,不自动压缩原估计。`,`Each option has its own estimate, resources and tradeoff. Only options declared to preserve required acceptance scope can be selected.`)}),i.map(o=>(0,U.jsxs)(`fieldset`,{disabled:e.status!=null&&e.status!==`pending`,className:`grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs sm:col-span-2`,children:[r(`替代做法`,`Alternative approach`),(0,U.jsx)(`input`,{className:X,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:col-span-2`,children:[r(`替代下限(小时)`,`Option lower (h)`),r(`替代最可能(小时)`,`Option likely (h)`),r(`替代上限(小时)`,`Option upper (h)`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{className:X,type:`number`,min:`0`,step:`any`,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),t.map(e=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,r(`需求`,`required`),(0,U.jsx)(`input`,{className:X,type:`number`,min:`0`,step:`1`,value:o.resources[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e)),(0,U.jsxs)(`label`,{className:`text-xs`,children:[r(`替代工期依据`,`Option estimate basis`),(0,U.jsx)(`textarea`,{"aria-label":r(`替代工期依据`,`Option estimate basis`),className:X,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[r(`取舍与适用条件`,`Tradeoff and prerequisites`),(0,U.jsx)(`textarea`,{"aria-label":r(`取舍与适用条件`,`Tradeoff and prerequisites`),className:X,value:o.tradeoff,onChange:e=>a(o.id,{tradeoff:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`flex gap-2 text-xs sm:col-span-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o.preserves_acceptance,onChange:e=>a(o.id,{preserves_acceptance:e.target.checked})}),r(`确认条件适用且保留必需验收目标,允许重排时采用`,`Prerequisites apply and required acceptance is preserved; allow automatic selection`)]}),(0,U.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>n(i.filter(e=>e.id!==o.id)),children:r(`移除替代做法`,`Remove alternative`)})]},o.id)),(0,U.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-xs`,disabled:i.length>=8||e.status!=null&&e.status!==`pending`,onClick:()=>{let t=i.length+1;for(;i.some(e=>e.id===`option-${t}`);)t++;n([...i,{id:`option-${t}`,title:r(`新的替代做法`,`New alternative`),duration_hours:[...e.duration_hours],resources:{...e.resources},basis:e.basis,tradeoff:r(`待补充适用条件与取舍`,`Specify prerequisites and tradeoffs`),preserves_acceptance:!1}])},children:r(`添加替代做法`,`Add alternative`)})]})}var Z=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm text-ink`;function vt({input:e,onChange:t,text:n,forecast:r}){let i=e.proposals.find(t=>t.id===e.selected_proposal_id),a=(n,r)=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.map(e=>e.id===n?{...e,...r}:e)}:e)});return(0,U.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`任务与实验`,`Tasks and experiments`),children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`h3`,{className:`font-medium`,children:n(`任务与实验`,`Tasks and experiments`)}),(0,U.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-sm`,onClick:()=>{let r=i.tasks.length+1;for(;i.tasks.some(e=>e.id===`task-${r}`);)r++;t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:[...e.tasks,{id:`task-${r}`,title:n(`新增实验`,`New experiment`),phase:`experiment`,duration_hours:[1,2,8],basis:n(`初步估计,待实测校准`,`Preliminary estimate; needs calibration`)}]}:e)})},children:n(`添加任务`,`Add task`)})]}),i.tasks.map(o=>{let s=[`running`,`completed`,`failed`].includes(o.status??`pending`),c=[`completed`,`failed`].includes(o.status??`pending`);return(0,U.jsxs)(`details`,{className:`rounded-xl border border-line p-3`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,U.jsx)(`strong`,{children:o.title}),(0,U.jsxs)(`span`,{className:`ml-2 text-ink-faint`,children:[o.duration_hours.join(` / `),` h · `,o.id]})]}),(0,U.jsxs)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`任务名称`,`Task name`),(0,U.jsx)(`input`,{className:Z,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`阶段`,`Phase`),(0,U.jsx)(`input`,{className:Z,value:o.phase,onChange:e=>a(o.id,{phase:e.target.value})})]}),(0,U.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`乐观(小时)`,`Lower (hours)`),n(`最可能(小时)`,`Likely (hours)`),n(`悲观(小时)`,`Upper (hours)`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,disabled:s,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`估计依据`,`Estimate basis`),(0,U.jsx)(`textarea`,{"aria-label":n(`估计依据`,`Estimate basis`),className:Z,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`模型 / 实现难度`,`Model / implementation difficulty`),(0,U.jsx)(`textarea`,{"aria-label":n(`模型 / 实现难度`,`Model / implementation difficulty`),className:Z,value:o.difficulty??``,onChange:e=>a(o.id,{difficulty:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`前置任务(可多选)`,`Dependencies (multiple)`),(0,U.jsx)(`select`,{"aria-label":n(`前置任务(可多选)`,`Dependencies (multiple)`),multiple:!0,className:Z,disabled:s,value:o.depends_on??[],onChange:e=>a(o.id,{depends_on:Array.from(e.target.selectedOptions,e=>e.value)}),children:i.tasks.filter(e=>e.id!==o.id).map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.keys(e.resources).map(e=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`占用`,`slots`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`1`,className:Z,disabled:s,value:o.resources?.[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`进展状态`,`Progress status`),(0,U.jsx)(`select`,{"aria-label":n(`进展状态`,`Progress status`),className:Z,disabled:c||e.adapt_to_deadline&&!s&&!r,value:o.status??`pending`,onChange:t=>{let n=t.target.value,i=r?.schedule.find(e=>e.id===o.id),c=!s&&[`running`,`completed`,`failed`].includes(n)&&i?{duration_hours:i.duration_hours??o.duration_hours,resources:i.resources,execution_option_id:i.execution_option_id??`standard`,basis:i.basis}:{};a(o.id,{status:n,...c,...n===`running`?{actual_start_hours:o.actual_start_hours??e.now_hours,remaining_hours:o.remaining_hours??[...c.duration_hours??o.duration_hours]}:{},...[`completed`,`failed`].includes(n)?{actual_start_hours:o.actual_start_hours??0,actual_finish_hours:e.now_hours}:{}})},children:[[`pending`,`未开始`,`Pending`],[`running`,`运行中`,`Running`],[`completed`,`已完成`,`Completed`],[`failed`,`失败`,`Failed`],[`blocked`,`受阻`,`Blocked`]].filter(([e])=>!s||![`pending`,`blocked`].includes(e)).map(([e,t,r])=>(0,U.jsx)(`option`,{value:e,children:n(t,r)},e))})]}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o.optional??!1,onChange:e=>a(o.id,{optional:e.target.checked})}),n(`可选 / 已退出交付路径`,`Optional / retired from delivery path`)]}),s&&(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`实际开始(项目第几小时)`,`Actual start (project hour)`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.actual_start_hours??0,onChange:e=>a(o.id,{actual_start_hours:Number(e.target.value)})})]}),c&&(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`实际结束(项目第几小时)`,`Actual finish (project hour)`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.actual_finish_hours??0,onChange:e=>a(o.id,{actual_finish_hours:Number(e.target.value)})})]}),o.status===`running`&&(0,U.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`剩余下限`,`Remaining lower`),n(`剩余最可能`,`Remaining likely`),n(`剩余上限`,`Remaining upper`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.remaining_hours?.[t]??0,onChange:e=>{let n=[...o.remaining_hours??o.duration_hours];n[t]=Number(e.target.value),a(o.id,{remaining_hours:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`变化 / 延期原因`,`Change / delay reason`),(0,U.jsx)(`textarea`,{"aria-label":n(`变化 / 延期原因`,`Change / delay reason`),className:Z,value:o.reason??``,onChange:e=>a(o.id,{reason:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`证据引用(每行一个)`,`Evidence references (one per line)`),(0,U.jsx)(`textarea`,{"aria-label":n(`证据引用(每行一个)`,`Evidence references (one per line)`),className:Z,value:(o.evidence??[]).join(` +`),onChange:e=>a(o.id,{evidence:e.target.value.split(` +`).filter(Boolean)})})]}),(0,U.jsx)(_t,{task:o,resources:Object.keys(e.resources),onChange:e=>a(o.id,{execution_options:e}),text:n}),!s&&i.tasks.length>1&&(0,U.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.filter(e=>e.id!==o.id)}:e)}),children:n(`移除未开始任务`,`Remove unstarted task`)})]})]},o.id)})]})}function yt({report:e,selectedId:t,text:n}){let r=e.proposals.find(e=>e.id===t),i=Math.max(1,...r.schedule.map(e=>e.finish_hours));return(0,U.jsxs)(`div`,{className:`space-y-5`,"aria-label":n(`排期结果`,`Timeline results`),children:[(0,U.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:e.proposals.map(e=>(0,U.jsxs)(`div`,{className:`rounded-xl border p-4 ${e.id===t?`border-blue`:`border-line`}`,children:[(0,U.jsx)(`div`,{className:`text-xs text-ink-faint`,children:e.id===t?n(`已选方案`,`Selected proposal`):n(`备选方案`,`Alternative`)}),(0,U.jsx)(`h3`,{className:`mt-1 text-sm font-medium`,children:e.title}),(0,U.jsx)(`div`,{className:`mt-3 text-2xl font-semibold`,children:e.finish_hours?`${e.finish_hours.expected.toFixed(1)} h`:n(`待重规划`,`Needs replanning`)}),e.finish_hours&&(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[n(`区间`,`Range`),` `,e.finish_hours.lower.toFixed(1),`–`,e.finish_hours.upper.toFixed(1),` h · `,n(`剩余`,`Remaining`),` `,e.remaining_hours?.toFixed(1),` h`]}),e.deadline_gap_hours!=null&&(0,U.jsxs)(`p`,{className:`mt-2 text-xs ${e.deadline_gap_hours>0?`text-red`:`text-ink-faint`}`,children:[n(`预计超期`,`Forecast overrun`),` `,e.deadline_gap_hours.toFixed(1),` h`]})]},e.id))}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`初步估计,非成功承诺。区间覆盖已列出的工作;验证失败后的新增实验可能超出上限。各方案作为备选单独计算。`,`Preliminary estimates, not success guarantees. New experiments after a failed premise can exceed the range. Proposals are estimated as alternatives.`)}),r.adaptation&&(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-blue/40 bg-blue/5 p-4`,"aria-label":n(`根据期限重排`,`Deadline adaptation`),children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`根据期限重排`,`Deadline adaptation`)}),r.adaptation.baseline_finish_hours&&r.finish_hours&&(0,U.jsxs)(`p`,{className:`text-sm`,children:[n(`调整前`,`Before`),` `,(0,U.jsxs)(`strong`,{children:[r.adaptation.baseline_finish_hours.expected.toFixed(1),` h`]}),` → `,n(`当前方案`,`Current plan`),` `,(0,U.jsxs)(`strong`,{children:[r.finish_hours.expected.toFixed(1),` h`]})]}),r.adaptation.status===`gap`&&(0,U.jsx)(`p`,{className:`text-sm text-red`,children:n(`已尝试可用的重排方式,仍无法满足期限。需要增加资源、提出新的执行方案,或调整交付目标。`,`Available adjustments still miss the deadline. More resources, another execution option, or a revised deliverable are needed.`)}),r.adaptation.status===`fits`&&r.finish_hours&&r.adaptation.target_hours!=null&&r.finish_hours.upper>r.adaptation.target_hours&&(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`点估计可按期;悲观情景仍可能超期,请留意区间上限。`,`The point estimate fits; the upper scenario can still miss the deadline.`)}),r.adaptation.changes.length===0&&(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`沿用原 proposal 的任务与做法;当前期限无需进一步调整,或尚无可用的替代做法。`,`Keeping the original tasks and approaches; no further adjustment is needed or no usable alternative is available.`)}),r.adaptation.changes.map(e=>(0,U.jsxs)(`div`,{className:`border-t border-line/60 pt-2 text-xs`,children:[(0,U.jsxs)(`p`,{className:`font-medium`,children:[e.title,e.option_title?` → ${e.option_title}`:``]}),e.from_duration_hours&&e.to_duration_hours&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`任务估计(下限 / 最可能 / 上限)`,`Task estimate (lower / likely / upper)`),`: `,e.from_duration_hours.join(` / `),` → `,e.to_duration_hours.join(` / `),` h`]}),e.from_start_hours!=null&&e.to_start_hours!=null&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`开始时间`,`Start time`),`: `,e.from_start_hours.toFixed(1),` → `,e.to_start_hours.toFixed(1),` h`]}),(0,U.jsx)(`p`,{className:`mt-1 text-ink-faint`,children:e.reason}),e.tradeoff&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`取舍 / 条件`,`Tradeoff / prerequisites`),`: `,e.tradeoff]})]},`${e.kind}:${e.id}`))]}),(0,U.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`h3`,{className:`mb-4 text-sm font-medium`,children:[n(`实验排布`,`Experiment schedule`),` · `,n(`从项目开始计时`,`Hours from project start`)]}),(0,U.jsx)(`div`,{className:`space-y-3`,children:r.schedule.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs`,children:[(0,U.jsx)(`span`,{children:e.title}),(0,U.jsxs)(`span`,{className:`shrink-0 text-ink-faint`,children:[e.start_hours.toFixed(1),`–`,e.finish_hours.toFixed(1),` h`]})]}),(0,U.jsx)(`div`,{className:`h-2.5 rounded-full bg-line/40`,role:`img`,"aria-label":`${e.title}: ${e.start_hours.toFixed(1)}–${e.finish_hours.toFixed(1)} h`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full ${e.status===`failed`?`bg-red`:e.status===`completed`?`bg-emerald-500`:`bg-blue`}`,style:{marginLeft:`${e.start_hours/i*100}%`,width:`${Math.max(.3,(e.finish_hours-e.start_hours)/i*100)}%`}})})]},e.id))})]}),r.deferred_task_ids.length>0&&(0,U.jsxs)(`p`,{className:`rounded-lg border border-line p-3 text-sm`,children:[n(`为满足期限延后的可选任务`,`Optional tasks deferred for the deadline`),`: `,r.deferred_task_ids.join(`, `)]}),[...r.failed_tasks,...r.blocked_tasks].map(e=>(0,U.jsxs)(`p`,{role:`alert`,className:`rounded-lg border border-red/40 p-3 text-sm`,children:[e.id,`: `,e.reason]},e.id)),(0,U.jsx)(`div`,{className:`overflow-x-auto`,children:(0,U.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsx)(`tr`,{children:[n(`任务`,`Task`),n(`资源`,`Resources`),n(`排队`,`Queue`),n(`估计依据`,`Estimate basis`)].map(e=>(0,U.jsx)(`th`,{className:`border-b border-line p-2`,children:e},e))})}),(0,U.jsx)(`tbody`,{children:r.schedule.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:e.title}),(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:Object.entries(e.resources).map(([e,t])=>`${e} × ${t}`).join(`, `)||`—`}),(0,U.jsxs)(`td`,{className:`border-b border-line p-2`,children:[e.resource_wait_hours.toFixed(1),` h`]}),(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:e.basis})]},e.id))})]})}),e.revision&&(0,U.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`版本对照与延期原因`,`Revision and delay reasons`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm`,children:e.revision.reason}),(0,U.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[n(`初版预计`,`Original forecast`),`: `,e.revision.baseline_finish_hours?.toFixed(1)??`—`,` h · `,n(`相对初版变化`,`Change from original`),`: `,e.revision.baseline_delta_hours?.toFixed(1)??`—`,` h`]}),e.revision.task_variances.map((e,t)=>(0,U.jsxs)(`p`,{className:`mt-3 text-xs`,children:[e.id,` · `,e.observed?n(`实际延期`,`Observed delay`):n(`预测延期`,`Forecast delay`),` `,e.delay_hours.toFixed(1),` h — `,e.reason,(0,U.jsx)(`br`,{}),e.evidence.join(`, `)]},`${e.id}-${t}`))]})]})}function bt(e){return{...e,resources:e.resources??{},now_hours:e.now_hours??0,defer_optional:e.defer_optional??!1}}var Q=`w-full rounded-lg border border-line bg-transparent px-3 py-2 text-sm text-ink`,$=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40`;function xt({sid:e}){let{locale:t}=p(),n=(e,n)=>t===`zh-CN`?e:n,[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(!0),[d,f]=(0,I.useState)(!1),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(``),[b,x]=(0,I.useState)(``),[S,C]=(0,I.useState)(``),[w,E]=(0,I.useState)(``),[D,O]=(0,I.useState)(``),[k,A]=(0,I.useState)(0),j=!!(r&&JSON.stringify(r)!==JSON.stringify(a?.input));return(0,I.useEffect)(()=>{let t=!0;return u(!0),f(!1),y(``),i(null),o(null),c(null),B.timelineLatest(e).then(({latest:e})=>{if(!t)return;let n=e?{...e,input:bt(e.input)}:null;o(n),i(n?.input??null),c(n?.report??null),E(``),C(``),f(!0)}).catch(e=>{t&&y(e.message)}).finally(()=>{t&&u(!1)}),()=>{t=!1}},[e,k]),(0,I.useEffect)(()=>{if(c(null),x(``),!r){_(!1);return}if(a&&JSON.stringify(r)===JSON.stringify(a.input)){c(a.report),_(!1);return}let e=new AbortController;_(!0);let t=setTimeout(()=>{B.timelineEstimate(r,e.signal).then(t=>{e.signal.aborted||c(t)}).catch(t=>{e.signal.aborted||x(t.message)}).finally(()=>{e.signal.aborted||_(!1)})},350);return()=>{clearTimeout(t),e.abort()}},[r,a]),l?(0,U.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-ink-faint`,children:n(`正在读取已保存计划…`,`Loading saved timeline…`)}):(0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 p-4 sm:p-6`,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs text-blue`,children:`PROPOSAL → EXPERIMENT → PAPER`}),(0,U.jsx)(`h2`,{className:`mt-1 text-xl font-semibold`,children:n(`研究排期`,`Research timeline`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`选择 idea 和期望期限,查看具体工期、实验排布与调整原因。`,`Choose an idea and deadline to see estimates, experiment schedules, and reasons for changes.`)})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(`button`,{className:$,disabled:m||!d,onClick:async()=>{h(!0),y(``),C(``);try{i(await B.timelineExample()),E(n(`加载演示 proposal`,`Load demonstration proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`加载论文示例`,`Load paper example`)}),(0,U.jsx)(`button`,{className:$,disabled:m,onClick:()=>A(e=>e+1),children:n(`重新载入已保存计划`,`Reload saved timeline`)}),r&&(0,U.jsx)(`button`,{className:$,onClick:()=>T(new Blob([JSON.stringify(r,null,2)],{type:`application/json`}),`proposal.json`),children:n(`导出 proposal`,`Export proposal`)})]})]}),v&&(0,U.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[v,(0,U.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n(`若提示版本冲突,先导出当前草稿,再重新载入已保存计划。`,`For a version conflict, export your draft before reloading the saved timeline.`)})]}),S&&(0,U.jsx)(`p`,{role:`status`,className:`rounded-xl border border-blue/40 p-3 text-sm`,children:S}),!r&&(0,U.jsxs)(`section`,{className:`rounded-xl border border-dashed border-line p-8 text-center`,children:[(0,U.jsx)(`h3`,{className:`font-medium`,children:n(`还没有研究排期`,`No research timeline yet`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`点击“加载论文示例”即可验证完整流程,也可以在下方导入自己的 proposal。示例数字仅用于演示。`,`Load the paper example to try the complete flow, or import your proposal below. Example numbers are illustrative.`)})]}),r&&(0,U.jsxs)(`div`,{className:`grid items-start gap-6`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 360px), 1fr))`},children:[(0,U.jsxs)(`fieldset`,{disabled:m,className:`min-w-0 space-y-5`,children:[(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`选择 idea / proposal`,`Choose idea / proposal`),(0,U.jsx)(`select`,{"aria-label":n(`选择 idea / proposal`,`Choose idea / proposal`),className:Q,value:r.selected_proposal_id,onChange:e=>i({...r,selected_proposal_id:e.target.value}),children:r.proposals.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`方案名称`,`Proposal title`),(0,U.jsx)(`input`,{className:Q,value:r.proposals.find(e=>e.id===r.selected_proposal_id).title,onChange:e=>i({...r,proposals:r.proposals.map(t=>t.id===r.selected_proposal_id?{...t,title:e.target.value}:t)})})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`期望完成时间(小时)`,`Target finish (hours)`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`0`,step:`any`,value:r.deadline_hours??``,placeholder:n(`不限`,`No deadline`),onChange:e=>i({...r,deadline_hours:e.target.value===``?null:Number(e.target.value)})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`已过去时间(小时)`,`Elapsed time (hours)`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`0`,step:`any`,value:r.now_hours,onChange:e=>i({...r,now_hours:Number(e.target.value)})})]}),Object.entries(r.resources).map(([e,t])=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`可用槽位`,`available slots`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`1`,step:`1`,value:t,onChange:t=>i({...r,resources:{...r.resources,[e]:Number(t.target.value)}})})]},e))]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`所有时间从项目开始计时;例如 120 小时 = 第 5 天。资源按持续可用计算。`,`All times count from project start; 120 hours means day 5. Resources are assumed continuously available.`)}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:r.adapt_to_deadline??!1,onChange:e=>i({...r,adapt_to_deadline:e.target.checked})}),n(`根据期限自动重排任务、选择替代做法并更新区间`,`Adapt task order, execution options and estimate ranges to the deadline`)]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`缩短期限时优先调整关键路径;延长期限时恢复原做法和可选工作。替代做法可在任务中编辑。`,`Tighter deadlines prioritize the critical path; longer deadlines restore preferred approaches and optional work. Edit alternatives inside each task.`)}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:r.defer_optional,onChange:e=>i({...r,defer_optional:e.target.checked})}),n(`超期时延后可选任务,保留必需实验`,`Defer optional tasks when over deadline; keep required experiments`)]}),(0,U.jsx)(`button`,{className:$,onClick:()=>{let e=r.proposals.length+1;for(;r.proposals.some(t=>t.id===`idea-${e}`);)e++;let t=`idea-${e}`;i({...r,selected_proposal_id:t,proposals:[...r.proposals,{id:t,title:n(`新 proposal`,`New proposal`),tasks:[{id:`validation`,title:n(`关键假设验证`,`Validate the key premise`),phase:`validation`,duration_hours:[2,4,16],basis:n(`初步估计,待校准`,`Preliminary, uncalibrated estimate`)}]}]})},children:n(`添加候选方案`,`Add proposal`)})]}),(0,U.jsx)(vt,{input:r,onChange:i,text:n,forecast:g?void 0:s?.proposals.find(e=>e.id===r.selected_proposal_id)}),(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`本次保存 / 调整原因`,`Reason for this revision`),(0,U.jsx)(`textarea`,{"aria-label":n(`本次保存 / 调整原因`,`Reason for this revision`),className:Q,value:w,onChange:e=>E(e.target.value),placeholder:n(`说明为什么改变计划;延期请在具体任务中填写证据`,`Explain the change; add delay evidence on the affected task`)})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[a?n(`已保存 v${a.version}`,`Saved v${a.version}`):n(`未保存`,`Not saved`),j?n(` · 有未保存修改`,` · Unsaved changes`):``]}),(0,U.jsx)(`button`,{className:`${$} border-blue bg-blue/10`,disabled:!d||!j||!s||g||!!b||!w.trim(),onClick:async()=>{if(!(!r||!s||g||!w.trim())){h(!0),y(``),C(``);try{let t=await B.timelineSave(e,r,a?.version??0,w);o(t),i(t.input),c(t.report),E(``),C(n(`已保存版本 ${t.version},刷新页面后仍可查看。`,`Version ${t.version} saved. It survives a page refresh.`))}catch(e){y(e.message)}finally{h(!1)}}},children:n(`保存计划版本`,`Save timeline version`)})]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`保存计划不会启动实验。实际进展和失败原因由实验结果或操作者更新。`,`Saving a timeline does not start experiments. Update progress and failure reasons from actual results.`)})]})]}),(0,U.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[g&&(0,U.jsx)(`p`,{role:`status`,className:`text-sm text-ink-faint`,children:n(`正在更新排期…`,`Updating schedule…`)}),b&&(0,U.jsxs)(`p`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[n(`无法计算,请检查估计区间、依赖和资源:`,`Cannot calculate; check ranges, dependencies, and resources: `),b]}),!g&&s&&(0,U.jsx)(yt,{report:s,selectedId:r.selected_proposal_id,text:n})]})]}),(0,U.jsxs)(`details`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:n(`导入自己的 proposal(JSON)`,`Import your proposal (JSON)`)}),(0,U.jsx)(`textarea`,{className:`${Q} mt-3 font-mono`,rows:6,"aria-label":n(`Proposal JSON`,`Proposal JSON`),value:D,onChange:e=>O(e.target.value)}),(0,U.jsx)(`button`,{className:`${$} mt-2`,disabled:!d||m||!D.trim(),onClick:async()=>{h(!0),y(``);try{let e=JSON.parse(D);await B.timelineEstimate(e),i(bt(e)),E(n(`导入 proposal`,`Import proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`校验并导入`,`Validate and import`)})]})]})}var St=[{id:`timeline`,zh:`研究排期`,en:`Research timeline`,zhDesc:`比较 proposal 工期,安排实验,并追踪延期原因。`,enDesc:`Compare proposal estimates, schedule experiments, and track delays.`,icon:ye,color:`blue`},{id:`experiments`,zh:`运行进程`,en:`Execution`,zhDesc:`查看当前步骤、任务路线,以及团队里谁在做什么。`,enDesc:`Follow the current step, the task route, and who on the team is doing what.`,icon:we,color:`blue`},{id:`ide`,zh:`AI IDE`,en:`AI IDE`,zhDesc:`阅读项目文件,查看 Git 状态与 Argus 活动。`,enDesc:`Read project files, Git state, and Argus activity.`,icon:A,color:`emerald`}],Ct=[{id:`overview`,zh:`项目概览`,en:`Project overview`,icon:Te},...St];function wt(e){let{text:t}=H(),n=e.snapshot.mission_view?.mission.objective||e.status?.continuous?.objective||e.project.objective||``;return(0,U.jsxs)(`div`,{className:`overview-page`,children:[(0,U.jsx)(`section`,{className:`overview-hero overview-hero--plain`,children:(0,U.jsxs)(`div`,{className:`overview-hero__copy`,children:[(0,U.jsx)(`h1`,{children:e.snapshot.session.display_name||e.project.label}),(0,U.jsx)(`p`,{children:n||t(`尚未设置目标。`,`No objective has been set.`)}),(0,U.jsx)(oe,{session:e.snapshot.session})]})}),(0,U.jsx)(`div`,{className:`overview-section-heading`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{children:t(`项目工作区`,`Project workspace`)}),(0,U.jsx)(`p`,{children:t(`这些入口展示同一项目的排期、运行进程与代码工作区。`,`These views show the same project’s timeline, execution and code workspace.`)})]})}),(0,U.jsx)(`section`,{className:`module-grid`,children:St.map(n=>{let r=n.icon;return(0,U.jsxs)(`button`,{className:`module-card`,type:`button`,onClick:()=>e.navigate(n.id),children:[(0,U.jsx)(`span`,{className:`module-card__icon module-card__icon--${n.color}`,children:(0,U.jsx)(r,{size:20})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:t(n.zh,n.en)}),(0,U.jsx)(`p`,{children:t(n.zhDesc,n.enDesc)})]}),(0,U.jsx)(k,{size:16})]},n.id)})})]})}function Tt(e){let t=String(e.event_id??e.id??``);if(t)return t;let n=String(e.message_id??``);return n?`${e.type??``}:${n}:${e.kind??``}`:[e.type??``,e.ts??``,e.agent_layer??e.actor??``,e.kind??``,String(e.text??e.title??e.reason??``).slice(0,160)].join(`|`)}function Et(e,t){let n=[...e],r=new Map(n.map((e,t)=>[Tt(e),t]));return t.forEach(e=>{let t=Tt(e),i=r.get(t);i==null?(r.set(t,n.length),n.push(e)):n[i]={...n[i],...e}}),n.sort((e,t)=>Number(e.ts??0)-Number(t.ts??0)).slice(-600)}function Dt(e=!0){return r({queryKey:[`v2-projects`],queryFn:({signal:e})=>B.projects(e),enabled:e,refetchInterval:1e4})}function Ot(e,t=!0){let n=i(),[o,s]=(0,I.useState)([]),[c,l]=(0,I.useState)(!1),u=(0,I.useRef)(null),d=!!e&&t,f=r({queryKey:[`v2-snapshot`,e],queryFn:({signal:t})=>B.snapshot(e,t),enabled:d,refetchInterval:5e3}),p=r({queryKey:[`v2-status`,e],queryFn:({signal:t})=>B.status(e,t),enabled:d,refetchInterval:6e3}),m=r({queryKey:[`v2-events`,e],queryFn:({signal:t})=>B.events(e,220,t),enabled:d,refetchInterval:15e3});(0,I.useEffect)(()=>{s([]),l(!1)},[e]),(0,I.useEffect)(()=>{!e||!m.data||s(e=>Et(e,m.data))},[m.data,e]),(0,I.useEffect)(()=>{if(!e||!t){l(!1);return}let r=Le(e,t=>{s(e=>Et(e,[t])),u.current??=window.setTimeout(()=>{u.current=null,n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]})},900)},l);return()=>{r.close(),l(!1),u.current!=null&&(window.clearTimeout(u.current),u.current=null)}},[t,n,e]);let h=async()=>{e&&await Promise.all([n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]}),n.invalidateQueries({queryKey:[`v2-events`,e]})])},g=a({mutationFn:()=>B.startDaemon(e,f.data?.daemon_commands?.revision),onSuccess:h}),_=a({mutationFn:t=>B.stopDaemon(e,t,f.data?.daemon_commands?.revision),onSuccess:h}),v=(0,I.useMemo)(()=>{let e=[f,p,m].find(e=>e.error);return e?.error instanceof Error?e.error:null},[m,f,p]);return{snapshot:f,status:p,events:o,connected:c,refresh:h,controls:{start:g,stop:_},error:v}}function kt({sid:e,active:t}){let{locale:n}=p(),[r,i]=(0,I.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`module`);return Ct.find(t=>t.id===e)?.id??`overview`}),[a,o]=(0,I.useState)(()=>new Set([r])),s=(0,I.useCallback)(e=>{i(e),o(t=>t.has(e)?t:new Set([...t,e]))},[]),c=Dt(t),l=c.data?.projects??[],u=(0,I.useMemo)(()=>l.find(t=>t.id===e)??null,[l,e]),d=Ot(e,t),f=r,m=d.controls.start.error||d.controls.stop.error,h=u&&d.snapshot.data?{sid:e,active:t,project:u,snapshot:d.snapshot.data,status:d.status.data,events:d.events,connected:d.connected,snapshotUpdatedAt:d.snapshot.dataUpdatedAt,refresh:d.refresh,controls:{start:async()=>{try{return await d.controls.start.mutateAsync()}catch{return null}},stop:async e=>{try{return await d.controls.stop.mutateAsync(e)}catch{return null}},busy:d.controls.start.isPending||d.controls.stop.isPending,error:m instanceof Error?m.message:``},navigate:s}:null;return(0,U.jsxs)(`section`,{className:`integrated-workbench flex min-h-0 flex-1 flex-col bg-transparent text-ink`,children:[(0,U.jsx)(`nav`,{className:`workbench-module-tabs shrink-0 border-b border-line/60 px-3 py-2`,"aria-label":n===`zh-CN`?`工作台模块`:`Workbench modules`,children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Ct.map(({id:e,zh:t,en:r,icon:i})=>(0,U.jsxs)(`button`,{type:`button`,className:`workbench-module-tab`,"data-module":e,"data-selected":f===e,"aria-pressed":f===e,onClick:()=>s(e),children:[(0,U.jsx)(i,{size:14}),(0,U.jsx)(`span`,{children:n===`zh-CN`?t:r})]},e))})}),c.isError&&!u||d.snapshot.isError&&!d.snapshot.data?(0,U.jsx)(G,{title:n===`zh-CN`?`工作台读取失败`:`Workbench unavailable`,description:`Argus API did not return the selected project.`}):h?Ct.filter(({id:e})=>a.has(e)).map(({id:n})=>(0,U.jsx)(`div`,{className:`ros-content min-h-0 flex-1 overflow-x-hidden overflow-y-auto ${f===n?``:`hidden`}`,"aria-hidden":f!==n,children:n===`overview`?(0,U.jsx)(wt,{...h,active:t&&f===n}):n===`timeline`?(0,U.jsx)(xt,{sid:e}):n===`experiments`?(0,U.jsx)(ct,{...h,active:t&&f===n}):(0,U.jsx)(gt,{...h,active:t&&f===n})},`${e}:${n}`)):(0,U.jsx)(`div`,{className:`boot-state`,children:(0,U.jsx)(Ye,{label:n===`zh-CN`?`正在载入工作台`:`Loading workbench`})})]})}export{kt as ResearchWorkbenchPanel}; \ No newline at end of file diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-Cc5mx_fm.css b/frontend/web/dist/assets/ResearchWorkbenchPanel-Cc5mx_fm.css new file mode 100644 index 000000000..38309bf11 --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-Cc5mx_fm.css @@ -0,0 +1 @@ +.readonly-diff{min-width:0;color:rgb(var(--ink))}.readonly-diff__toolbar{flex-wrap:wrap;align-items:center;gap:6px;padding:10px 10px 4px;display:flex}.readonly-diff__toolbar>strong{flex:100%;font-size:11px}.readonly-diff__toolbar>button{border:1px solid rgb(var(--line));background:rgb(var(--panel));min-height:28px;color:rgb(var(--ink-dim));cursor:pointer;border-radius:5px;padding:3px 7px;font-size:10px}.readonly-diff__hint,.readonly-diff__notice{overflow-wrap:anywhere;margin:6px 10px;font-size:10px;line-height:1.5}.readonly-diff__hint{color:rgb(var(--ink-dim))}.readonly-diff__notice{border-left:2px solid rgb(var(--warn));color:rgb(var(--ink));padding-left:7px}.readonly-diff .readonly-diff__text{background:rgb(var(--panel));max-height:min(540px,65vh);color:rgb(var(--ink));font-family:var(--mono);white-space:pre;tab-size:4;margin:0;padding:10px;font-size:10px;line-height:1.6;overflow:auto}.readonly-diff__line--header{color:rgb(var(--ink-dim));background:rgb(var(--line) / .35);font-weight:600}.readonly-diff__line--hunk{color:rgb(var(--blue));background:rgb(var(--blue) / .08);font-weight:600}.readonly-diff__line--addition{color:rgb(var(--ok));background:rgb(var(--ok) / .12)}.readonly-diff__line--deletion{color:rgb(var(--err));background:rgb(var(--err) / .08)}.readonly-diff__line--context{color:rgb(var(--ink))}.readonly-diff :focus-visible{outline:2px solid rgb(var(--blue));outline-offset:-2px}.gpu-device-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px;display:grid}.gpu-device-card{border:1px solid rgb(var(--line));background:rgb(var(--bg));border-radius:14px;min-width:0;padding:18px}.gpu-device-header{flex-wrap:wrap;align-items:center;gap:12px;display:flex}.gpu-device-icon{border:1px solid rgb(var(--line));width:48px;height:48px;color:rgb(var(--ink-faint));background:rgb(var(--panel));border-radius:12px;flex-shrink:0;place-items:center;display:grid}.gpu-device-header>div{flex:1;min-width:100px}.gpu-device-number{color:rgb(var(--ink-faint));font-size:10px}.gpu-device-header h4{color:rgb(var(--ink));overflow-wrap:anywhere;margin-top:3px;font-size:14px;font-weight:600}.gpu-device-status{background:rgb(var(--panel));color:rgb(var(--ink-dim));border-radius:99px;align-items:center;gap:5px;padding:5px 8px;font-size:10px;display:inline-flex}.gpu-device-status i{background:currentColor;border-radius:50%;width:5px;height:5px}.gpu-device-card[data-gpu-state=computing]{border-color:rgb(var(--blue) / .4);background:rgb(var(--blue) / .035)}.gpu-device-card[data-gpu-state=computing] .gpu-device-icon,.gpu-device-card[data-gpu-state=computing] .gpu-device-status{color:rgb(var(--blue));background:rgb(var(--blue) / .08)}.gpu-device-card[data-gpu-state=reserved] .gpu-device-status,.gpu-device-card[data-gpu-state=allocated] .gpu-device-status{color:rgb(var(--warn));background:rgb(var(--warn) / .1)}.gpu-device-meter{color:rgb(var(--ink-faint));margin-top:16px;font-size:11px}.gpu-device-meter>div:first-child{justify-content:space-between;gap:8px;margin-bottom:6px;display:flex}.gpu-device-meter strong{font-variant-numeric:tabular-nums;color:rgb(var(--ink-dim));font-weight:500}.gpu-device-meter [role=meter]{background:rgb(var(--line) / .65);border-radius:9px;height:5px;overflow:hidden}.gpu-device-meter [role=meter] i{border-radius:inherit;background:rgb(var(--blue));height:100%;transition:width .24s cubic-bezier(.32,.72,0,1);display:block}.gpu-device-note{color:rgb(var(--ink-faint));margin-top:10px;font-size:10px}@media (width<=640px){.gpu-device-grid{grid-template-columns:minmax(0,1fr)}}@media (prefers-reduced-motion:reduce){.gpu-device-meter [role=meter] i{transition:none}}.runtime-control-page{grid-template-columns:minmax(0,1fr);gap:14px;width:100%;max-width:1120px;margin:0 auto;padding:clamp(14px,3vw,28px);display:grid}.runtime-control-page>*{grid-column:1/-1;min-width:0}.runtime-summary{border:1px solid rgb(var(--line));background:rgb(var(--panel));border-radius:16px;flex-wrap:wrap;align-items:center;gap:18px;padding:22px;display:flex}.runtime-summary-copy{flex:1;min-width:0}.runtime-eyebrow{color:rgb(var(--ink-faint));font-size:11px}.runtime-summary h2{overflow-wrap:anywhere;margin:5px 0 12px;font-size:22px;font-weight:600}.runtime-status-line{color:rgb(var(--ink-faint));flex-wrap:wrap;align-items:center;gap:8px 16px;font-size:12px;display:flex}.runtime-status{color:rgb(var(--ink-dim));align-items:center;gap:7px;display:inline-flex}.runtime-status i{background:rgb(var(--ink-faint));border-radius:50%;width:7px;height:7px}.runtime-status[data-running=true]{color:rgb(var(--ok))}.runtime-status[data-running=true] i{box-shadow:0 0 0 4px rgb(var(--ok) / .1);background:currentColor}.runtime-main-actions{flex-wrap:wrap;gap:8px;display:flex}.runtime-summary-hint{border-top:1px solid rgb(var(--line));color:rgb(var(--ink-faint));flex-basis:100%;padding-top:14px;font-size:12px}.runtime-section{border:1px solid rgb(var(--line));background:rgb(var(--panel));border-radius:12px}.runtime-section>summary{cursor:pointer;align-items:center;gap:10px;padding:16px;font-size:13px;list-style:none;display:flex}.runtime-section>summary::-webkit-details-marker{display:none}.runtime-section>summary:after{content:"+";color:rgb(var(--ink-faint));margin-left:auto}.runtime-section[open]>summary:after{content:"-"}.runtime-section summary small{color:rgb(var(--ink-faint));font-size:11px}.runtime-section-body{border-top:1px solid rgb(var(--line));gap:12px;padding:16px;display:grid}.runtime-section-body label{align-items:center;gap:7px;font-size:12px;display:flex}.runtime-section-body p{color:rgb(var(--ink-faint));overflow-wrap:anywhere;font-size:12px}.runtime-section-body h3{font-size:13px;font-weight:600}.runtime-field-row{flex-wrap:wrap;gap:8px;display:flex}.runtime-field-row input{border:1px solid rgb(var(--line));background:rgb(var(--bg));border-radius:8px;flex:220px;width:100%;min-width:0;min-height:38px;padding:8px 10px;font-size:12px}.runtime-source-update{border-top:1px solid rgb(var(--line));gap:10px;padding-top:16px;display:grid}.runtime-restore-row{align-items:center;gap:12px;font-size:13px;display:flex}.runtime-restore-row>span{overflow-wrap:anywhere;flex:1;min-width:0}.runtime-feedback{border:1px solid rgb(var(--line));border-radius:10px;flex-wrap:wrap;gap:8px;padding:12px 16px;font-size:13px;display:flex}.runtime-control-page pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:320px;font-size:11px;overflow:auto}@media (width<=640px){.runtime-summary{gap:12px;padding:16px}.runtime-main-actions{width:100%}.runtime-section summary small{display:none}}*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:where(.integrated-workbench),:where(.integrated-workbench) *,:where(.integrated-workbench) :before,:where(.integrated-workbench) :after{box-sizing:border-box}:where(.integrated-workbench) button,:where(.integrated-workbench) input,:where(.integrated-workbench) textarea,:where(.integrated-workbench) select{font:inherit;color:inherit}:where(.integrated-workbench) button{border:0}:where(.integrated-workbench) button:not(:disabled),:where(.integrated-workbench) select:not(:disabled){cursor:pointer}:where(.integrated-workbench) button:disabled{cursor:not-allowed;opacity:.48}:where(.integrated-workbench) a{color:inherit}.integrated-workbench{--surface-2:var(--panel-raised);--surface-3:var(--panel);--overlay:var(--panel-raised);--border:var(--line);--border-strong:var(--glass-edge);--text:var(--ink);--muted:var(--ink-dim);--faint:var(--ink-faint);--accent:var(--blue-deep);--accent-fg:255 255 255;--blue-bg:var(--conversation-argus);--green:var(--blue);--green-bg:var(--conversation-argus);--amber:var(--ink-dim);--amber-bg:var(--conversation-user);--red:var(--err);--red-bg:var(--conversation-user);--violet:var(--ink-dim);--violet-bg:var(--conversation-argus);--rose:var(--ink-dim);--rose-bg:var(--conversation-user);--manager:var(--role-manager);--planner:var(--role-planner);--engineer:var(--role-engineer);--reviewer:var(--role-reviewer);--shadow-1:none;--shadow-2:none;--shadow-3:0 20px 60px -32px #00000047;--radius-sm:8px;--radius-md:12px;--radius-lg:16px;--font:"Geist Variable", "PingFang SC", "Microsoft YaHei", sans-serif;--mono:"SFMono-Regular", Consolas, "Liberation Mono", monospace;min-width:0;min-height:0;font-family:var(--font);-webkit-font-smoothing:antialiased;font-size:14px}.integrated-workbench ::selection{background:rgb(var(--blue) / .2)}.integrated-workbench :focus-visible{outline:2px solid rgb(var(--blue) / .62);outline-offset:2px}.integrated-workbench ::-webkit-scrollbar{width:7px;height:7px}.integrated-workbench ::-webkit-scrollbar-track{background:0 0}.integrated-workbench ::-webkit-scrollbar-thumb{background:rgb(var(--faint) / .55);background-clip:padding-box;border:2px solid #0000;border-radius:999px}.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.argus-wordmark{align-items:center;gap:10px;display:inline-flex}.argus-wordmark svg{flex:none}.argus-wordmark__copy{flex-direction:column;align-items:flex-start;line-height:1.05;display:flex}.argus-wordmark__copy strong{letter-spacing:-.025em;font-size:16px;font-weight:720}.argus-wordmark__copy small{color:rgb(var(--muted));margin-top:3px;font-size:9px;font-weight:530}.brand-button{background:0 0;align-items:center;padding:0;display:inline-flex}.\!button{background:rgb(var(--surface-2))!important;min-height:36px!important;color:rgb(var(--text))!important;box-shadow:none!important;border:1px solid #0000!important;border-radius:8px!important;justify-content:center!important;align-items:center!important;gap:7px!important;padding:7px 12px!important;font-size:12px!important;font-weight:590!important;transition:color .15s,background .15s!important;display:inline-flex!important}.button{background:rgb(var(--surface-2));min-height:36px;color:rgb(var(--text));box-shadow:none;border:1px solid #0000;border-radius:8px;justify-content:center;align-items:center;gap:7px;padding:7px 12px;font-size:12px;font-weight:590;transition:color .15s,background .15s;display:inline-flex}.\!button:hover:not(:disabled){background:rgb(var(--border))!important}.button:hover:not(:disabled){background:rgb(var(--border))}.button--primary{border-color:rgb(var(--blue) / .34);background:rgb(var(--blue) / .08);color:rgb(var(--blue))}.button--primary:hover:not(:disabled){border-color:rgb(var(--blue-deep));background:rgb(var(--blue-deep));color:rgb(var(--accent-fg))}.button--secondary{background:rgb(var(--surface-2));box-shadow:none}.button--danger{border-color:rgb(var(--red) / .25);background:rgb(var(--red-bg));color:rgb(var(--red))}.button--ghost{box-shadow:none;background:0 0;border-color:#0000}.button--large{border-radius:11px;min-height:42px;padding:9px 15px}.button--full{width:100%}.icon-button{width:34px;height:34px;color:rgb(var(--muted));background:0 0;border:0;border-radius:8px;flex:0 0 34px;place-items:center;transition:background .15s,color .15s;display:inline-grid}.icon-button:hover:not(:disabled){background:rgb(var(--surface-2));color:rgb(var(--text))}.badge{background:rgb(var(--surface-2));min-height:22px;color:rgb(var(--muted));white-space:nowrap;border:0;border-radius:6px;align-items:center;gap:5px;padding:3px 8px;font-size:10px;font-weight:610;line-height:1.2;display:inline-flex}.badge__dot,.status-dot{background:currentColor;border-radius:50%;width:6px;height:6px}.status-dot{color:rgb(var(--faint));background:rgb(var(--faint));display:inline-block}.status-dot.is-live{color:rgb(var(--green));background:rgb(var(--green));box-shadow:0 0 0 4px rgb(var(--green) / .11)}.is-pulsing{animation:2s infinite livePulse}.ros-card,.panel{border-radius:var(--radius-sm);background:rgb(var(--surface));min-width:0;min-height:0;box-shadow:none;border:0;overflow:hidden}.panel{flex-direction:column;display:flex}.panel__header,.ros-card>header{border-bottom:1px solid rgb(var(--border));justify-content:space-between;align-items:center;gap:12px;min-height:58px;padding:12px 16px;display:flex}.panel__heading,.ros-card>header>div{min-width:0}.panel__title,.ros-card>header h2{color:rgb(var(--text));margin:1px 0 0;font-size:13px;font-weight:650}.ros-card>header span,.panel__header .eyebrow{color:rgb(var(--faint));letter-spacing:.12em;font-size:9px;font-weight:690}.panel__body{min-width:0;min-height:0;padding:16px}.eyebrow{color:rgb(var(--faint));letter-spacing:.15em;margin-bottom:4px;font-size:9px;font-weight:700}.empty-state{text-align:center;flex-direction:column;justify-content:center;align-items:center;min-height:180px;padding:28px;display:flex}.empty-state__icon{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));width:44px;height:44px;color:rgb(var(--faint));border-radius:12px;place-items:center;margin-bottom:12px;display:grid}.empty-state__title{font-size:13px;font-weight:640}.empty-state p{max-width:360px;color:rgb(var(--muted));margin:6px 0 0;font-size:11px;line-height:1.55}.empty-state__action{margin-top:14px}.spinner{color:rgb(var(--muted));align-items:center;gap:7px;font-size:12px;display:inline-flex}.spin{animation:.85s linear infinite spin}.inline-error{border:1px solid rgb(var(--red) / .22);background:rgb(var(--red-bg));color:rgb(var(--red));border-radius:10px;padding:10px 12px;font-size:11px;line-height:1.5}.\!notice{border:1px solid rgb(var(--border))!important;background:rgb(var(--surface))!important;color:rgb(var(--muted))!important;border-radius:11px!important;gap:8px!important;padding:11px 13px!important;font-size:11px!important;display:flex!important}.notice{border:1px solid rgb(var(--border));background:rgb(var(--surface));color:rgb(var(--muted));border-radius:11px;gap:8px;padding:11px 13px;font-size:11px;display:flex}.markdown{min-width:0;font-size:inherit;overflow-wrap:anywhere;line-height:1.68}.markdown>:first-child{margin-top:0}.markdown>:last-child{margin-bottom:0}.markdown p{margin:.55em 0}.markdown h1,.markdown h2,.markdown h3{margin:1.2em 0 .45em;line-height:1.3}.markdown h1{font-size:1.4em}.markdown h2{font-size:1.22em}.markdown h3{font-size:1.08em}.markdown ul,.markdown ol{padding-left:1.55em}.markdown blockquote{border-left:3px solid rgb(var(--blue) / .45);background:rgb(var(--blue-bg));color:rgb(var(--muted));border-radius:0 8px 8px 0;margin:.8em 0;padding:7px 12px}.markdown code{background:rgb(var(--surface-2));font-family:var(--mono);border-radius:5px;padding:.12em .34em;font-size:.88em}.markdown pre{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));border-radius:10px;padding:12px;overflow:auto}.markdown pre code{background:0 0;padding:0}.markdown a{color:rgb(var(--blue));align-items:center;gap:3px;text-decoration:none;display:inline-flex}.markdown a:hover{text-decoration:underline}.markdown table{border-collapse:collapse;width:100%}.markdown th,.markdown td{border:1px solid rgb(var(--border));text-align:left;padding:6px 8px}.search-field{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));min-width:250px;color:rgb(var(--faint));border-radius:10px;align-items:center;gap:7px;padding:0 10px;display:flex}.search-field input{background:0 0;border:0;outline:0;width:100%;height:36px;font-size:12px}.search-field--block{margin:12px}.field{flex-direction:column;gap:6px;display:flex}.field>span,.form-grid label>span{color:rgb(var(--muted));font-size:11px;font-weight:580}.field input,.field textarea,.field select,.form-grid input,.new-project-fields input{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));border-radius:10px;outline:none;width:100%;padding:9px 10px;font-size:12px}.field input:focus,.field textarea:focus,.field select:focus,.form-grid input:focus,.new-project-fields input:focus{border-color:rgb(var(--blue) / .55);box-shadow:0 0 0 3px rgb(var(--blue) / .09)}.field textarea{resize:vertical;line-height:1.55}.field--grow{flex:1;min-height:0}.field--grow textarea{resize:none;flex:1;min-height:220px}.form-grid{grid-template-columns:1fr 1fr;gap:12px;display:grid}.form-grid label{flex-direction:column;gap:6px;display:flex}.file-button{position:relative;overflow:hidden}.file-button input{opacity:0;cursor:pointer;position:absolute;inset:0}.header-badges{flex-wrap:wrap;justify-content:flex-end;gap:7px;display:flex}.manager-mini-result{border-top:1px solid rgb(var(--border));max-height:260px;margin-top:10px;padding-top:10px;overflow:auto}.manager-mini-result .markdown{font-size:11px}.event-list{padding:5px}.event-row{border-radius:8px;grid-template-columns:22px minmax(0,1fr);gap:7px;padding:9px;display:grid;position:relative}.event-row:hover{background:rgb(var(--surface-2))}.event-row__marker{border:2px solid rgb(var(--surface));background:rgb(var(--faint));width:8px;height:8px;box-shadow:0 0 0 1px rgb(var(--border-strong));border-radius:50%;margin:6px auto 0}.event-row__content{min-width:0}.event-row__meta{gap:7px;display:flex}.event-row__meta time{color:rgb(var(--faint));font-family:var(--mono);margin-left:auto;font-size:9px}.role-label{text-transform:uppercase;font-size:9px;font-weight:700}.event-row__title{text-overflow:ellipsis;white-space:nowrap;margin-top:2px;font-size:11px;font-weight:620;overflow:hidden}.event-row__detail{color:rgb(var(--muted));font-family:var(--mono);-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin-top:2px;font-size:9px;line-height:1.45;display:-webkit-box;overflow:hidden}.event-list--dense .event-row{padding-block:7px}.ros-sidebar nav button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg));box-shadow:var(--shadow-1)}.ros-content{min-width:0;min-height:0;overflow:auto}.ros-page,.overview-page,.page{min-width:0;min-height:100%;padding:24px 28px 32px}.ros-page-header{justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:20px;display:flex}.ros-page-header h1{letter-spacing:-.03em;margin:0 0 5px;font-size:24px;font-weight:690}.ros-page-header p{max-width:780px;color:rgb(var(--muted));margin:0;font-size:12px;line-height:1.55}.boot-state{place-content:center;width:100%;height:100%;display:grid}.project-hub{max-width:1240px;margin:0 auto;padding:48px 24px 72px}.project-hub__hero{justify-content:space-between;align-items:flex-start;gap:28px;margin-bottom:30px;display:flex}.project-hub__hero h1{letter-spacing:-.04em;margin:2px 0 7px;font-size:32px;font-weight:710}.project-hub__hero p{max-width:660px;color:rgb(var(--muted));margin:0;font-size:13px;line-height:1.6}.project-hub__summary{grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:34px;display:grid}.project-hub__summary>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:82px;box-shadow:var(--shadow-1);border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto;align-items:center;gap:10px;padding:16px;display:grid}.project-hub__summary svg{color:rgb(var(--muted))}.project-hub__summary span{color:rgb(var(--muted));font-size:11px}.project-hub__summary strong{font-size:21px;font-weight:680}.project-hub__toolbar{justify-content:space-between;align-items:center;gap:16px;margin-bottom:14px;display:flex}.project-hub__toolbar h2{margin:0;font-size:16px}.project-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;display:grid}.project-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:264px;color:rgb(var(--text));text-align:left;box-shadow:var(--shadow-1);border-radius:16px;flex-direction:column;padding:18px;transition:transform .18s,border-color .18s,box-shadow .18s;display:flex}.project-card:hover{border-color:rgb(var(--border-strong));box-shadow:var(--shadow-2)}.project-card--skeleton{background:rgb(var(--surface-2));animation:1.5s infinite skeleton}.project-card__top{justify-content:space-between;align-items:center;display:flex}.project-card__mark{background:rgb(var(--surface-2));width:42px;height:42px;color:rgb(var(--muted));border-radius:12px;place-items:center;display:grid}.project-card__mark.is-live{background:rgb(var(--green-bg));color:rgb(var(--green))}.project-card__copy{min-height:84px;margin-top:16px}.project-card__copy h3{margin:0;font-size:16px;font-weight:660;line-height:1.35}.project-card__copy p{color:rgb(var(--muted));-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:7px 0 0;font-size:11px;line-height:1.5;display:-webkit-box;overflow:hidden}.project-card__facts{grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px;display:grid}.project-card__facts>div{background:rgb(var(--surface-2));border-radius:9px;padding:8px}.project-card__facts span{color:rgb(var(--faint));font-size:8px;display:block}.project-card__facts strong{text-overflow:ellipsis;white-space:nowrap;margin-top:2px;font-size:10px;display:block;overflow:hidden}.project-card__footer{border-top:1px solid rgb(var(--border));align-items:center;gap:10px;margin-top:auto;padding-top:13px;display:flex}.project-card__footer code{min-width:0;color:rgb(var(--faint));font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:8px;overflow:hidden}.project-card__footer span{color:rgb(var(--blue));align-items:center;gap:4px;font-size:10px;font-weight:610;display:flex}.project-inbox-cta{border:1px solid rgb(var(--border));background:rgb(var(--surface));text-align:left;width:100%;box-shadow:var(--shadow-1);border-radius:16px;grid-template-columns:48px minmax(0,1fr) 24px;align-items:center;gap:14px;margin-top:18px;padding:18px;display:grid}.project-inbox-cta>span{background:rgb(var(--rose-bg));width:46px;height:46px;color:rgb(var(--rose));border-radius:13px;place-items:center;display:grid}.project-inbox-cta strong{font-size:13px}.project-inbox-cta p{color:rgb(var(--muted));margin:4px 0 0;font-size:11px}.project-inbox-cta>svg{color:rgb(var(--faint))}.overview-page{max-width:1280px;margin:0 auto}.overview-hero{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:16px;grid-template-columns:minmax(0,1.4fr) minmax(360px,.8fr);gap:18px;padding:26px;display:grid}.overview-hero__copy h1{letter-spacing:-.035em;margin:14px 0 8px;font-size:27px}.overview-hero__copy p{max-width:760px;color:rgb(var(--muted));-webkit-line-clamp:4;-webkit-box-orient:vertical;margin:0 0 14px;font-size:12px;line-height:1.6;display:-webkit-box;overflow:hidden}.overview-hero__copy>code{color:rgb(var(--faint));font-family:var(--mono);font-size:9px}.overview-section-heading{justify-content:space-between;margin:30px 0 12px;display:flex}.overview-section-heading h2{margin:0;font-size:17px}.overview-section-heading p{color:rgb(var(--muted));margin:4px 0 0;font-size:11px}.module-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;display:grid}.module-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));text-align:left;min-height:132px;box-shadow:var(--shadow-1);border-radius:14px;grid-template-columns:44px minmax(0,1fr) 20px;align-items:start;gap:12px;padding:16px;transition:transform .15s,border-color .15s,box-shadow .15s;display:grid}.module-card:hover{border-color:rgb(var(--border-strong));box-shadow:var(--shadow-2);transform:translateY(-2px)}.module-card__icon{background:rgb(var(--surface-2));width:42px;height:42px;color:rgb(var(--muted));border-radius:11px;place-items:center;display:grid}.module-card h3{margin:2px 0 5px;font-size:13px}.module-card p{color:rgb(var(--muted));margin:0;font-size:10px;line-height:1.5}.module-card>svg{color:rgb(var(--faint));margin-top:13px}.copilot-v2{flex-direction:column;height:100%;display:flex;overflow:hidden}.copilot-v2 .ros-page-header{flex:none}.pending-question-banner{border:1px solid rgb(var(--amber) / .22);background:rgb(var(--amber-bg));color:rgb(var(--amber));border-radius:12px;flex:none;align-items:center;gap:10px;margin-bottom:12px;padding:10px 12px;display:flex}.pending-question-banner>div{flex:1}.pending-question-banner strong{font-size:11px}.pending-question-banner p{margin:2px 0 0;font-size:10px}.copilot-v2__layout{flex:1;grid-template-columns:minmax(0,1fr) 330px;gap:12px;min-width:0;min-height:0;display:grid}.copilot-v2__thread{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-width:0;min-height:0;box-shadow:var(--shadow-1);border-radius:16px;flex-direction:column;display:flex;overflow:hidden}.copilot-v2__messages{flex:1;min-height:0;padding:22px 18px 12px;overflow-y:auto}.copilot-empty{text-align:center;max-width:660px;margin:9vh auto 0}.copilot-empty h2{margin:12px 0 4px;font-size:19px}.copilot-empty>p{color:rgb(var(--muted));margin:0 0 18px;font-size:11px}.copilot-empty>div{grid-template-columns:repeat(3,1fr);gap:8px;display:grid}.copilot-empty button{border:1px solid rgb(var(--border));background:rgb(var(--surface));color:rgb(var(--muted));text-align:left;border-radius:11px;padding:11px;font-size:10px;line-height:1.45}.copilot-empty button:hover{border-color:rgb(var(--blue) / .3);background:rgb(var(--blue-bg));color:rgb(var(--text))}.\!message{max-width:820px!important;margin:0 auto 18px!important}.message{max-width:820px;margin:0 auto 18px}.message--user{background:rgb(var(--surface-2));border-radius:16px 5px 16px 16px;max-width:620px;margin-right:max(0px,50% - 410px);padding:11px 14px}.message--user>div:first-child{align-items:center;gap:7px;margin-bottom:4px;display:flex}.message--user span{font-size:10px;font-weight:650}.\!message time{color:rgb(var(--faint))!important;font-family:var(--mono)!important;font-size:8.5px!important}.message time{color:rgb(var(--faint));font-family:var(--mono);font-size:8.5px}.\!message .markdown{font-size:12.5px!important}.message .markdown{font-size:12.5px}.message--argus{grid-template-columns:34px minmax(0,1fr);gap:10px;display:grid}.message--argus>div{min-width:0}.message--argus header{align-items:center;gap:7px;min-height:24px;margin-bottom:5px;display:flex}.message--argus header strong{font-size:11px}.message--stream>div{border-left:2px solid rgb(var(--blue) / .25);padding-left:12px}.phase-trail{margin:5px 0 10px;padding:0;list-style:none}.phase-trail li{color:rgb(var(--faint));font-family:var(--mono);gap:7px;padding:2px 0;font-size:9px;display:flex}.phase-trail li span{color:rgb(var(--green))}.phase-trail li.is-active{color:rgb(var(--blue))}.phase-trail li.is-active span{animation:1s infinite blink}.copilot-composer-dock{border-top:1px solid rgb(var(--border));flex:none;padding:12px 18px 10px}.copilot-composer{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));max-width:820px;box-shadow:var(--shadow-2);border-radius:14px;align-items:flex-end;gap:7px;margin:0 auto;padding:7px;display:flex}.copilot-composer textarea{resize:none;background:0 0;border:0;outline:none;flex:1;min-height:36px;max-height:150px;padding:8px 3px;font-size:12px;line-height:1.5}.composer-tool{width:35px;height:35px;color:rgb(var(--muted));background:0 0;border-radius:9px;flex:0 0 35px;place-items:center;display:grid}.composer-tool:hover{background:rgb(var(--surface-2))}.optimize-button{background:rgb(var(--violet-bg));height:35px;color:rgb(var(--violet));border-radius:9px;align-items:center;gap:5px;padding:0 10px;font-size:10px;font-weight:650;display:flex}.send-button{background:rgb(var(--accent));width:35px;height:35px;color:rgb(var(--accent-fg));border-radius:9px;flex:0 0 35px;place-items:center;display:grid}.send-button.is-stop{background:rgb(var(--red-bg));color:rgb(var(--red))}.copilot-composer-dock>small{max-width:820px;color:rgb(var(--faint));text-align:center;margin:5px auto 0;font-size:8.5px;display:block}.attachment-chips{flex-wrap:wrap;gap:6px;max-width:820px;margin:0 auto 7px;display:flex}.attachment-chips>span{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));border-radius:8px;align-items:center;gap:5px;padding:5px 7px;font-size:9px;display:flex}.attachment-chips button{color:rgb(var(--faint));background:0 0;place-items:center;display:grid}.copilot-v2__aside{min-width:0;min-height:0;overflow:hidden}.copilot-trace{border:1px solid rgb(var(--border));background:rgb(var(--surface));height:100%;box-shadow:var(--shadow-1);border-radius:16px;overflow:hidden}.copilot-trace__header{border-bottom:1px solid rgb(var(--border));justify-content:space-between;align-items:center;min-height:58px;padding:12px 15px;display:flex}.copilot-trace__header>div{flex-direction:column;display:flex}.copilot-trace__header span{color:rgb(var(--faint));letter-spacing:.12em;font-size:8.5px;font-weight:700}.copilot-trace__header strong{margin-top:2px;font-size:13px}.copilot-trace__roles section>button:hover,.copilot-trace__roles section.is-open>button{background:rgb(var(--surface-2))}.copilot-trace__roles section.is-open>button svg{transform:rotate(180deg)}.role-orb{background:rgb(var(--faint));border-radius:50%;width:7px;height:7px}.modal-backdrop{z-index:100;background:#00000052;place-items:center;padding:16px;display:grid;position:fixed;inset:0}.prompt-optimizer{overscroll-behavior:contain;border:1px solid rgb(var(--border-strong) / .8);background:rgb(var(--overlay));border-radius:16px;width:min(980px,96vw);max-height:90vh;animation:.2s cubic-bezier(.2,.8,.2,1) prompt-optimizer-enter;overflow:auto;box-shadow:0 24px 80px #0003,0 2px 10px #00000014}.prompt-optimizer>header{border-bottom:1px solid rgb(var(--border));justify-content:space-between;padding:18px 20px;display:flex}.prompt-optimizer header span{color:rgb(var(--violet));letter-spacing:.13em;font-size:9px;font-weight:700}.prompt-optimizer h2{margin:3px 0;font-size:18px}.prompt-optimizer header p{color:rgb(var(--muted));margin:0;font-size:10px}.prompt-optimizer__compare{grid-template-columns:1fr 1fr;gap:12px;padding:16px;display:grid}.prompt-optimizer__compare>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:12px;flex-direction:column;min-height:280px;display:flex;overflow:hidden}.prompt-optimizer__compare label{border-bottom:1px solid rgb(var(--border));color:rgb(var(--muted));padding:9px 12px;font-size:10px;font-weight:650}.prompt-optimizer__compare pre{font-family:var(--font);white-space:pre-wrap;flex:1;margin:0;padding:13px;font-size:11px;line-height:1.6;overflow:auto}.optimizer-thinking{color:rgb(var(--violet));align-items:center;gap:8px;margin:auto;font-size:11px;display:flex}.optimizer-changes,.optimizer-questions{border:1px solid rgb(var(--border));border-radius:11px;margin:0 16px 12px;padding:10px 12px}.optimizer-changes strong,.optimizer-questions strong{margin-bottom:6px;font-size:10px;display:block}.optimizer-changes span{color:rgb(var(--muted));align-items:center;gap:5px;font-size:9.5px;display:flex}.optimizer-changes svg{color:rgb(var(--green))}.optimizer-questions{border-color:rgb(var(--amber) / .2);background:rgb(var(--amber-bg));color:rgb(var(--amber))}.optimizer-questions p{margin:3px 0;font-size:9.5px}.prompt-optimizer>.inline-error{margin:0 16px 12px}.prompt-optimizer>footer{border-top:1px solid rgb(var(--border));justify-content:flex-end;gap:8px;padding:13px 16px;display:flex}.literature-stats{grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:12px;display:grid}.literature-stats>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:13px;align-items:center;gap:10px;padding:12px;display:flex}.stat-icon{background:rgb(var(--surface-2));width:36px;height:36px;color:rgb(var(--muted));border-radius:10px;place-items:center;display:grid}.stat-icon--blue{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.stat-icon--green{background:rgb(var(--green-bg));color:rgb(var(--green))}.stat-icon--amber{background:rgb(var(--amber-bg));color:rgb(var(--amber))}.stat-icon--violet{background:rgb(var(--violet-bg));color:rgb(var(--violet))}.literature-stats p{color:rgb(var(--muted));margin:0;font-size:9.5px}.literature-stats strong{color:rgb(var(--text));margin-top:2px;font-size:17px;display:block}.literature-v2__layout{grid-template-columns:220px minmax(420px,1fr) 340px;gap:12px;min-width:0;min-height:720px;display:grid}.literature-v2__sidebar{align-self:start}.library-tabs{padding:0 7px 8px}.library-tabs button{width:100%;min-height:38px;color:rgb(var(--muted));background:0 0;border-radius:9px;justify-content:space-between;align-items:center;padding:0 10px;font-size:11px;display:flex}.library-tabs button:hover{background:rgb(var(--surface-2))}.library-tabs button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.library-tabs small{font-family:var(--mono);font-size:9px}.literature-source-note{border-top:1px solid rgb(var(--border));color:rgb(var(--muted));gap:8px;padding:12px;display:flex}.literature-source-note div{min-width:0}.literature-source-note strong{font-size:9px;display:block}.literature-source-note p{font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;margin:3px 0 0;font-size:7.5px;overflow:hidden}.literature-v2__main{min-width:0}.literature-list-header{justify-content:space-between;align-items:center;min-height:58px;margin-bottom:9px;display:flex}.literature-list-header h2{margin:0;font-size:15px}.literature-list-header p{color:rgb(var(--muted));margin:3px 0 0;font-size:9.5px}.paper-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;display:grid}.paper-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:214px;color:rgb(var(--text));text-align:left;box-shadow:var(--shadow-1);border-radius:14px;flex-direction:column;padding:14px;transition:transform .15s,border-color .15s,box-shadow .15s;display:flex}.paper-card:hover{border-color:rgb(var(--border-strong));box-shadow:var(--shadow-2);transform:translateY(-2px)}.paper-card.is-selected{border-color:rgb(var(--blue) / .35);box-shadow:0 0 0 3px rgb(var(--blue) / .07)}.paper-card__meta{justify-content:space-between;align-items:center;gap:8px;display:flex}.paper-card__year{color:rgb(var(--faint));font-size:9px}.paper-card h3{-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:11px 0 5px;font-size:13px;line-height:1.4;display:-webkit-box;overflow:hidden}.paper-card__authors{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:9px;overflow:hidden}.paper-card__summary{color:rgb(var(--muted));-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:8px 0;font-size:9.5px;line-height:1.5;display:-webkit-box;overflow:hidden}.paper-card__footer{border-top:1px solid rgb(var(--border));align-items:center;gap:8px;margin-top:auto;padding-top:9px;display:flex}.paper-card__footer code{min-width:0;color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:7.5px;overflow:hidden}.paper-card__footer span{color:rgb(var(--blue));font-size:9px}.source-file-grid{gap:8px;display:grid}.source-file-grid article{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:12px;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:8px;padding:11px;display:grid}.source-file-grid article>div{flex-direction:column;min-width:0;display:flex}.source-file-grid strong{font-size:10px}.source-file-grid code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8px;overflow:hidden}.source-file-grid time{color:rgb(var(--faint));font-size:8px}.literature-v2__detail{align-content:start;gap:10px;display:grid}.paper-detail{padding-bottom:13px}.paper-detail>:not(.empty-state){margin-inline:14px}.paper-detail__top{justify-content:space-between;align-items:center;padding-top:14px;display:flex}.paper-detail__top>span{color:rgb(var(--faint));font-size:9px}.paper-detail h2{font-size:15px;line-height:1.4;margin:12px 14px 5px!important}.paper-detail__authors{color:rgb(var(--muted));font-size:9px}.paper-detail__body{border-top:1px solid rgb(var(--border));max-height:300px;padding-top:10px;overflow:auto;margin-top:12px!important}.paper-detail__body h3{margin:0 0 5px;font-size:10px}.paper-detail__body p,.paper-detail__body .markdown{color:rgb(var(--muted));font-size:9.5px;line-height:1.55}.paper-detail__source{border-top:1px solid rgb(var(--border));flex-direction:column;padding-top:9px;display:flex;margin-top:11px!important}.paper-detail__source span{color:rgb(var(--faint));font-size:8px}.paper-detail__source code{text-overflow:ellipsis;white-space:nowrap;margin-top:3px;font-size:8px;overflow:hidden}.paper-detail>.button{width:calc(100% - 28px);margin:11px 14px 0!important}.paper-detail>.\!button{width:calc(100% - 28px)!important;margin:11px 14px 0!important}.retrieval-panel>div{max-height:260px;padding:6px;overflow:auto}.retrieval-panel article{border-radius:8px;grid-template-columns:22px minmax(0,1fr) auto;align-items:center;gap:6px;padding:6px;display:grid}.retrieval-panel article:hover{background:rgb(var(--surface-2))}.retrieval-panel article>div{flex-direction:column;min-width:0;display:flex}.retrieval-panel strong,.retrieval-panel code{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.retrieval-panel code,.retrieval-panel time{color:rgb(var(--faint));font-family:var(--mono);font-size:7.5px}.literature-ask{padding-bottom:12px}.literature-ask textarea{resize:vertical;border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));border-radius:9px;outline:0;width:calc(100% - 24px);margin:11px 12px 7px;padding:8px;font-size:10px;line-height:1.45}.literature-ask>.button{width:calc(100% - 24px);margin-inline:12px}.literature-ask>.\!button{width:calc(100% - 24px)!important;margin-inline:12px!important}.literature-ask .manager-mini-result{margin-inline:12px}.intake-steps{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:13px;grid-template-columns:repeat(4,1fr);margin-bottom:12px;padding:8px;display:grid}.intake-steps>div{color:rgb(var(--faint));border-radius:9px;align-items:center;gap:7px;padding:7px 10px;display:flex;position:relative}.intake-steps>div>span{background:rgb(var(--surface-2));border-radius:8px;place-items:center;width:26px;height:26px;display:grid}.intake-steps strong{font-size:10px}.intake-steps>div>svg{color:rgb(var(--faint));position:absolute;right:-7px}.intake-steps .is-active{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.intake-steps .is-done{color:rgb(var(--green))}.intake-steps .is-done>span{background:rgb(var(--green-bg))}.inbox-v2__layout{grid-template-columns:220px minmax(360px,1fr) minmax(340px,.92fr);gap:12px;min-width:0;min-height:700px;display:grid}.inbox-sources{align-self:stretch}.inbox-sources>div{padding:6px}.inbox-sources>div>button{text-align:left;background:0 0;border-radius:10px;grid-template-columns:30px minmax(0,1fr);align-items:center;gap:7px;width:100%;padding:8px;display:grid}.inbox-sources>div>button:hover,.inbox-sources>div>button.is-active{background:rgb(var(--surface-2))}.inbox-item-icon{background:rgb(var(--rose-bg));width:28px;height:28px;color:rgb(var(--rose));border-radius:8px;place-items:center;display:grid}.inbox-sources button>div{flex-direction:column;min-width:0;display:flex}.inbox-sources strong,.inbox-sources small{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.inbox-sources strong{font-size:10px}.inbox-sources small{color:rgb(var(--faint));font-size:8px}.inbox-input{flex-direction:column;display:flex}.inbox-input__form{flex-direction:column;flex:1;min-height:0;padding:16px;display:flex}.inbox-input__actions{justify-content:space-between;gap:8px;margin-top:11px;display:flex}.inbox-output{grid-template-rows:minmax(280px,.85fr) minmax(400px,1.15fr);gap:12px;min-width:0;display:grid}.knowledge-grid{max-height:360px;padding:8px;overflow:auto}.knowledge-grid article{border-radius:10px;grid-template-columns:30px minmax(0,1fr);gap:8px;padding:8px;display:grid}.knowledge-grid article:hover{background:rgb(var(--surface-2))}.knowledge-grid article>span{background:rgb(var(--violet-bg));width:28px;height:28px;color:rgb(var(--violet));border-radius:8px;place-items:center;display:grid}.knowledge-grid .markdown{color:rgb(var(--muted));margin-top:3px;font-size:9px;line-height:1.45}.first-prompt{flex-direction:column;display:flex}.first-prompt>textarea{resize:none;background:rgb(var(--surface-2) / .45);min-height:200px;font-family:var(--mono);border:0;outline:0;flex:1;padding:14px;font-size:9.5px;line-height:1.6}.dispatch-mode{border-top:1px solid rgb(var(--border));grid-template-columns:1fr 1fr;gap:4px;padding:8px;display:grid}.dispatch-mode button{color:rgb(var(--muted));background:0 0;border-radius:8px;padding:7px;font-size:9.5px}.dispatch-mode button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.new-project-fields{grid-template-columns:.7fr 1.3fr;gap:7px;padding:0 8px 8px;display:grid}.first-prompt>.button{width:calc(100% - 16px);margin:0 8px 8px}.first-prompt>.\!button{width:calc(100% - 16px)!important;margin:0 8px 8px!important}.first-prompt .manager-mini-result{margin:0 8px 8px}.workspace-tree{flex:1;min-height:0;padding:5px;overflow:auto}.workspace-node>button{width:100%;min-height:28px;color:rgb(var(--muted));text-align:left;background:0 0;border-radius:6px;align-items:center;gap:4px;display:flex}.workspace-node>button:hover,.workspace-node>button.is-selected{background:rgb(var(--surface-2));color:rgb(var(--text))}.workspace-node>button.is-selected{color:rgb(var(--blue))}.workspace-node button>span:not(.node-spacer){font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.workspace-node button>small{color:rgb(var(--faint));margin-left:auto;font-size:7px}.node-spacer{width:13px}.editor-tabs button.is-active{border-bottom-color:rgb(var(--accent));color:rgb(var(--text))}.workspace-pdf{background:#fff;border:0;width:100%;height:100%}.workspace-image{-o-object-fit:contain;object-fit:contain;max-width:100%;max-height:100%;margin:auto;padding:16px;display:block}.editor-loading{color:rgb(var(--muted));padding:20px;font-size:11px}.workspace-git{height:100%;overflow:auto}.coding-response .markdown{font-size:10.5px}.terminal-role{font-weight:500}.paper-v2__files>nav button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.paper-file-list>button:hover,.paper-file-list>button.is-active{background:rgb(var(--surface-2))}.paper-file-list>button.is-active{color:rgb(var(--blue))}.paper-markdown-preview{height:100%;padding:24px 30px 50px;overflow:auto}.paper-markdown-preview .markdown{font-size:12.5px}.paper-ai-output .markdown{font-size:10.5px}.review-mode-tabs{grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px;display:grid}.review-mode-tabs>button{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:72px;color:rgb(var(--muted));text-align:left;box-shadow:var(--shadow-1);border-radius:14px;grid-template-columns:38px minmax(0,1fr) auto;align-items:center;gap:10px;padding:12px 15px;display:grid}.review-mode-tabs>button.is-active{border-color:rgb(var(--blue) / .3);background:rgb(var(--blue-bg) / .45);color:rgb(var(--text));box-shadow:0 0 0 3px rgb(var(--blue) / .06)}.review-mode-tabs>button>svg{color:rgb(var(--blue))}.review-mode-tabs button>div{flex-direction:column;display:flex}.review-mode-tabs strong{font-size:12px}.review-mode-tabs small{color:rgb(var(--muted));margin-top:3px;font-size:9px}.process-review-layout{grid-template-rows:minmax(580px,auto) auto;grid-template-columns:260px minmax(400px,1fr) 330px;gap:12px;display:grid}.review-rounds>div{max-height:650px;padding:5px;overflow:auto}.review-rounds>div>button{text-align:left;background:0 0;border-radius:9px;grid-template-columns:30px minmax(0,1fr);gap:7px;width:100%;padding:8px;display:grid}.review-rounds>div>button:hover,.review-rounds>div>button.is-active{background:rgb(var(--surface-2))}.review-state{background:rgb(var(--surface-2));border-radius:8px;place-items:center;width:28px;height:28px;display:grid}.review-rounds button>div{flex-direction:column;min-width:0;display:flex}.review-rounds small{color:rgb(var(--faint));margin-top:2px;font-size:8px}.process-report{flex-direction:column;display:flex}.process-report>article{padding:18px;overflow:auto}.process-report__meta{border-bottom:1px solid rgb(var(--border));color:rgb(var(--faint));justify-content:space-between;margin-bottom:14px;padding-bottom:9px;font-size:9px;display:flex}.process-report .markdown{font-size:11.5px}.review-live{overflow:auto}.process-verdict-card{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:14px;grid-column:1/-1;align-items:flex-start;gap:11px;padding:14px;display:flex}.process-verdict-card__icon{background:rgb(var(--surface-2));border-radius:10px;flex:0 0 38px;place-items:center;width:38px;height:38px;display:grid}.process-verdict-card span{color:rgb(var(--faint));font-size:8px}.process-verdict-card strong{margin-top:2px;font-size:13px;display:block}.process-verdict-card p{color:rgb(var(--muted));margin:4px 0 0;font-size:10px}.final-review-layout{grid-template-columns:250px minmax(420px,1fr) 340px;gap:12px;min-height:680px;display:grid}.final-review-files>div{padding:5px}.final-review-files>div>button{text-align:left;background:0 0;border-radius:9px;grid-template-columns:24px minmax(0,1fr);gap:7px;width:100%;padding:8px;display:grid}.final-review-files>div>button:hover,.final-review-files>div>button.is-active{background:rgb(var(--surface-2))}.final-review-files button>div{flex-direction:column;display:flex}.final-review-files strong{font-size:9.5px}.final-review-files small{color:rgb(var(--faint));font-size:8px}.final-review-report{flex-direction:column;display:flex}.final-review-report>article{padding:20px;overflow:auto}.final-review-report .markdown{font-size:11.5px}.final-review-form>div{padding:14px}.final-review-form .field+.field{margin-top:11px}.final-review-warning{border:1px solid rgb(var(--amber) / .2);background:rgb(var(--amber-bg));color:rgb(var(--amber));border-radius:10px;gap:7px;margin:11px 0;padding:9px;display:flex}.final-review-warning p{margin:0;font-size:9px;line-height:1.45}.text-warn{color:rgb(var(--amber))}.task-row:hover,.task-row.is-selected{background:rgb(var(--surface-2))}.current-task h2{margin:10px 0 6px;font-size:16px;line-height:1.38}.current-task>p{color:rgb(var(--muted));margin:0;font-size:10.5px;line-height:1.55}.role-card.is-active{background:rgb(var(--blue-bg))}.diagnosis{border:1px solid rgb(var(--border));color:rgb(var(--muted));border-radius:10px;gap:7px;padding:9px;display:flex}.diagnosis strong{color:rgb(var(--text));font-size:9.5px;display:block}.diagnosis p{margin:3px 0 0;font-size:8.5px}@media (width<=1450px){.metric-grid{grid-template-columns:repeat(3,1fr)}.literature-v2__layout{grid-template-columns:210px minmax(380px,1fr) 310px}.inbox-v2__layout{grid-template-columns:200px minmax(340px,1fr) 320px}.ide-v2__shell{grid-template-columns:210px minmax(360px,1fr) 300px}.paper-v2__shell{grid-template-columns:210px minmax(380px,1fr) 320px}}.integrated-workbench{container-type:inline-size}@container (width<=1100px){.integrated-workbench .overview-hero{grid-template-columns:minmax(0,1fr)}.integrated-workbench .overview-hero__copy{overflow-wrap:anywhere;min-width:0}.integrated-workbench .overview-hero__badges{flex-wrap:wrap}.integrated-workbench .overview-hero__stats{grid-template-columns:repeat(3,minmax(0,1fr))}.integrated-workbench .overview-hero__stats>div{flex-direction:column;align-items:flex-start;min-width:0;display:flex}.integrated-workbench .experiment-v3-grid{grid-template-columns:220px minmax(0,1fr)}.integrated-workbench .experiment-v3-side{grid-column:1/-1;grid-template-columns:1fr 1fr}.integrated-workbench .research-stage-rail{grid-template-columns:repeat(4,minmax(0,1fr));overflow-x:visible}.integrated-workbench .literature-v2__layout,.integrated-workbench .inbox-v2__layout{grid-template-columns:210px minmax(0,1fr)}.integrated-workbench .literature-v2__detail,.integrated-workbench .inbox-output{grid-column:1/-1}.integrated-workbench .vscode-shell{grid-template-rows:minmax(0,1fr) 180px 340px 22px;grid-template-columns:42px 220px minmax(0,1fr);height:820px}.integrated-workbench .vscode-source-control{border-top:1px solid rgb(var(--vscode-line));border-left:0;grid-area:3/2/auto/4;display:flex}.integrated-workbench .vscode-terminal{grid-column:3}.integrated-workbench .vscode-statusbar{grid-area:4/1/auto/4}.integrated-workbench .paper-v3__shell{grid-template-columns:220px minmax(0,1fr);height:auto}.integrated-workbench .paper-v3__sources,.integrated-workbench .paper-v3__source{min-height:720px}.integrated-workbench .paper-v3__outputs{grid-column:1/-1;min-height:720px}.integrated-workbench .process-review-layout,.integrated-workbench .final-review-layout{grid-template-columns:220px minmax(0,1fr)}.integrated-workbench .review-live,.integrated-workbench .final-review-form{grid-column:1/-1}}@container (width<=480px){.integrated-workbench .overview-hero__stats{grid-template-columns:minmax(0,1fr)}}@container (width<=700px){.integrated-workbench .overview-hero{padding:18px}.integrated-workbench .overview-lower{grid-template-columns:minmax(0,1fr)}.integrated-workbench .ros-page,.integrated-workbench .overview-page,.integrated-workbench .page{padding:16px 16px 28px}.integrated-workbench .ros-page-header{flex-direction:column;gap:12px}.integrated-workbench .header-badges{justify-content:flex-start;width:100%}.integrated-workbench .module-grid,.integrated-workbench .copilot-v2__layout{grid-template-columns:1fr}.integrated-workbench .copilot-v2__aside{display:none}.integrated-workbench .experiment-v3-grid,.integrated-workbench .literature-v2__layout,.integrated-workbench .inbox-v2__layout,.integrated-workbench .process-review-layout,.integrated-workbench .final-review-layout{grid-template-columns:1fr}.integrated-workbench .experiment-v3-side,.integrated-workbench .literature-v2__detail,.integrated-workbench .inbox-output,.integrated-workbench .review-live,.integrated-workbench .final-review-form{grid-column:auto}.integrated-workbench .experiment-v3-side,.integrated-workbench .inbox-output,.integrated-workbench .literature-v2__detail{grid-template-columns:1fr}.integrated-workbench .experiment-header-actions{justify-content:flex-start;width:100%}.integrated-workbench .experiment-header-actions .button{flex:96px;justify-content:center;min-width:0}.integrated-workbench .experiment-progress-hero{grid-template-columns:1fr;gap:12px;padding:18px 16px 0}.integrated-workbench .progress-number{align-items:flex-start;padding-right:0}.integrated-workbench .progress-number strong{font-size:38px}.integrated-workbench .truthful-progress__legend span:last-child{width:100%;margin-left:0}.integrated-workbench .progress-metrics{grid-template-columns:repeat(2,minmax(0,1fr));margin-inline:-16px}.integrated-workbench .progress-metrics>div:nth-child(2){border-right:0}.integrated-workbench .progress-metrics>div:nth-child(-n+2){border-bottom:1px solid rgb(var(--border))}.integrated-workbench .checkpoint-list{grid-template-columns:1fr;gap:8px}.integrated-workbench .checkpoint{text-align:left;grid-template-columns:30px minmax(0,1fr);align-items:center;gap:9px;display:grid}.integrated-workbench .checkpoint>div{margin-top:0;padding-inline:0}.integrated-workbench .checkpoint>i{display:none}.integrated-workbench .research-stage-rail,.integrated-workbench .intake-steps{grid-template-columns:repeat(2,minmax(0,1fr))}.integrated-workbench .intake-steps>div>svg,.integrated-workbench .literature-v2__sidebar{display:none}.integrated-workbench .literature-list-header{align-items:flex-start;gap:10px}.integrated-workbench .paper-grid{grid-template-columns:1fr}.integrated-workbench .paper-card{min-height:0}.integrated-workbench .literature-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.integrated-workbench .ide-context-strip{grid-template-columns:18px minmax(0,1fr) auto 28px}.integrated-workbench .ide-context-strip code,.integrated-workbench .ide-context-strip small{display:none}.integrated-workbench .vscode-shell,.integrated-workbench .paper-v3__shell{flex-direction:column;height:auto;display:flex}.integrated-workbench .vscode-activitybar{flex-direction:row;height:44px}.integrated-workbench .vscode-sidebar{min-height:420px}.integrated-workbench .vscode-editor{min-height:680px}.integrated-workbench .vscode-terminal{min-height:240px}.integrated-workbench .vscode-source-control{min-height:420px}.integrated-workbench .vscode-statusbar{min-height:22px}.integrated-workbench .paper-v3__sources{min-height:480px}.integrated-workbench .paper-v3__source,.integrated-workbench .paper-v3__outputs{min-height:720px}.integrated-workbench .review-flow,.integrated-workbench .release-module-grid,.integrated-workbench .review-mode-tabs{grid-template-columns:1fr}.integrated-workbench .review-mode-tabs>button{min-width:0}.integrated-workbench .review-flow b{display:none}.integrated-workbench .release-flow{grid-template-columns:1fr;gap:5px}.integrated-workbench .release-flow>b{transform:rotate(90deg)}.integrated-workbench .experiment-header-actions .\!button{flex:96px!important;justify-content:center!important;min-width:0!important}}@media (width<=1180px){:root{--sidebar:204px}.project-grid,.module-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.overview-hero{grid-template-columns:1fr}.overview-hero__stats{grid-template-columns:repeat(3,1fr)}.overview-hero__stats>div{flex-direction:column;align-items:flex-start;display:flex}.literature-v2__layout{grid-template-columns:210px minmax(0,1fr)}.literature-v2__detail{grid-column:1/-1;grid-template-columns:1.2fr 1fr 1fr}.inbox-v2__layout{grid-template-columns:210px minmax(0,1fr)}.inbox-output{grid-column:1/-1;grid-template-rows:520px;grid-template-columns:1fr 1fr}.ide-v2__shell{grid-template-columns:210px minmax(0,1fr)}.ide-v2__assistant{grid-area:auto/1/auto/-1;min-height:480px}.ide-v2__shell{grid-template-rows:570px 170px auto;height:auto}.ide-v2__explorer{grid-row:1/3}.ide-v2__terminal{grid-column:2}.paper-v2__shell{grid-template-columns:210px minmax(0,1fr);height:auto}.paper-v2__files,.paper-v2__editor{min-height:700px}.paper-v2__assistant{grid-column:1/-1;min-height:500px}.process-review-layout{grid-template-columns:240px minmax(0,1fr)}.review-live{grid-column:1/-1;max-height:500px}.final-review-layout{grid-template-columns:230px minmax(0,1fr)}.final-review-form{grid-column:1/-1}.experiment-workspace{grid-template-columns:220px minmax(0,1fr)}.experiment-side{grid-column:1/-1;grid-template-columns:1fr 1fr}}@media (width<=900px){.ros-topbar__menu{display:inline-grid}.ros-topbar .brand-button,.back-to-projects,.ros-topbar__divider{display:none}.workspace-project-select{min-width:0;max-width:280px}.ros-workspace{grid-template-columns:1fr}.ros-sidebar{inset:var(--topbar) auto 0 0;z-index:60;width:250px;transition:transform .2s;position:fixed;transform:translate(-102%);box-shadow:18px 0 50px #00000047}.ros-sidebar.is-mobile-open{transform:translate(0)}.ros-sidebar__mobile-brand{border-bottom:1px solid rgb(var(--border));justify-content:space-between;align-items:center;margin:-12px -12px 10px;padding:11px 12px;display:flex}.mobile-scrim{inset:var(--topbar) 0 0;z-index:55;background:#0000006b;display:block;position:fixed}.ros-page,.overview-page,.page{padding:20px}.project-hub{padding:34px 20px 60px}.project-hub__hero{flex-direction:column}.project-hub__summary{grid-template-columns:1fr}.project-grid{grid-template-columns:1fr 1fr}.overview-lower,.copilot-v2__layout{grid-template-columns:1fr}.copilot-v2__aside{display:none}.literature-stats{grid-template-columns:1fr 1fr}.literature-v2__layout{grid-template-columns:1fr}.literature-v2__sidebar{display:none}.literature-v2__detail{grid-column:auto;grid-template-columns:1fr}.paper-grid,.inbox-v2__layout{grid-template-columns:1fr}.inbox-sources{min-height:260px}.inbox-input{min-height:600px}.inbox-output{grid-column:auto;grid-template-rows:auto;grid-template-columns:1fr}.knowledge-panel,.first-prompt{min-height:460px}.ide-v2__shell{grid-template-columns:200px minmax(0,1fr)}.ide-v2__assistant{grid-column:1/-1}.paper-v2__shell{grid-template-columns:200px minmax(0,1fr)}.paper-v2__assistant{grid-column:1/-1}.process-review-layout,.final-review-layout{grid-template-columns:1fr}.review-rounds{max-height:360px}.review-live,.process-verdict-card,.final-review-form{grid-column:auto}.experiment-workspace{grid-template-columns:1fr}.experiment-side{grid-column:auto;grid-template-columns:1fr}.mission-hero{flex-direction:column}}@media (width<=640px){.ros-topbar{padding-inline:10px}.ros-topbar>.badge{display:none}.workspace-project-select select{font-size:11px}.ros-page,.overview-page,.page{padding:16px}.ros-page-header{flex-direction:column;gap:8px}.ros-page-header h1{font-size:21px}.project-hub{padding-inline:16px}.project-hub__hero h1{font-size:27px}.project-grid,.module-grid{grid-template-columns:1fr}.project-hub__toolbar{flex-direction:column;align-items:stretch}.search-field{min-width:0}.overview-hero{padding:18px}.overview-hero__stats,.overview-lower{grid-template-columns:1fr}.copilot-v2{height:auto;min-height:100%}.copilot-v2__thread{min-height:720px}.copilot-empty>div{grid-template-columns:1fr}.optimize-button{justify-content:center;width:35px;padding:0;font-size:0}.message--user{margin-left:40px}.prompt-optimizer__compare{grid-template-columns:1fr}.prompt-optimizer{max-height:95vh}.literature-stats,.paper-grid{grid-template-columns:1fr}.intake-steps{grid-template-columns:1fr 1fr}.intake-steps>div>svg{display:none}.form-grid,.new-project-fields{grid-template-columns:1fr}.inbox-input__actions{flex-direction:column}.workspace-connector{grid-template-columns:28px minmax(0,1fr)}.workspace-connector__state{grid-column:2}.workspace-connector>div:nth-child(2)>div{flex-direction:column}.ide-v2__shell{flex-direction:column;height:auto;display:flex}.ide-v2__explorer{min-height:400px}.ide-v2__center{min-height:650px}.ide-v2__terminal{min-height:220px}.ide-v2__assistant{min-height:520px}.paper-v2__shell{flex-direction:column;display:flex}.paper-v2__files{min-height:440px}.paper-v2__editor{min-height:700px}.paper-v2__assistant{min-height:560px}.review-mode-tabs{grid-template-columns:1fr}.process-review-layout,.final-review-layout{flex-direction:column;display:flex}.process-report,.final-review-report{min-height:600px}.metric-grid,.current-task__facts{grid-template-columns:1fr}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}:root{--font:"Inter Variable", "Noto Sans SC Variable", "Geist Variable", "PingFang SC", "Microsoft YaHei", sans-serif}.ros-page:not(.copilot-v2),.overview-page,.page--experiments{font-size:15px}.ros-page:not(.copilot-v2) .ros-page-header h1{font-size:27px}.ros-page:not(.copilot-v2) .ros-page-header p{font-size:13.5px;line-height:1.65}.copilot-v2 .ros-page-header h1{font-size:24px}.copilot-v2 .ros-page-header p{font-size:12px}.ros-page:not(.copilot-v2) .ros-card>header h2,.overview-page .panel__title{font-size:14px}.ros-page:not(.copilot-v2) .ros-card>header span{font-size:9.5px}.project-hub__hero p,.overview-hero__copy p{font-size:13px}.module-card{min-height:148px;padding:19px}.module-card h3{font-size:14px}.module-card p{font-size:11.5px;line-height:1.6}.copilot-v2__layout{grid-template-columns:minmax(0,1fr) 380px}.copilot-trace-v2{flex-direction:column;display:flex}.team-pipeline{flex:none;gap:0;padding:10px 12px;display:grid}.team-pipeline>div{color:rgb(var(--muted));border-radius:9px;grid-template-columns:10px 72px minmax(0,1fr);align-items:center;gap:7px;padding:7px 8px;display:grid;position:relative}.team-pipeline>div.is-active{background:rgb(var(--blue-bg));color:rgb(var(--text))}.team-pipeline>div.is-done{color:rgb(var(--text))}.team-pipeline strong{text-transform:capitalize;font-size:10px}.team-pipeline small{text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.team-pipeline b{display:none}.current-operation{border-block:1px solid rgb(var(--border));background:rgb(var(--green-bg) / .55);flex:none;grid-template-columns:32px minmax(0,1fr);gap:8px;padding:11px 14px;display:grid}.current-operation>span{background:rgb(var(--green-bg));width:30px;height:30px;color:rgb(var(--green));border-radius:9px;place-items:center;display:grid}.current-operation>div{flex-direction:column;min-width:0;display:flex}.current-operation small{color:rgb(var(--green));font-size:8.5px}.current-operation strong{margin:2px 0;font-size:10.5px}.current-operation code{color:rgb(var(--muted));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.activity-filters{border-bottom:1px solid rgb(var(--border));color:rgb(var(--faint));flex:none;align-items:center;gap:4px;padding:8px 10px;display:flex}.activity-filters button{color:rgb(var(--muted));background:0 0;border-radius:7px;padding:5px 8px;font-size:9px}.activity-filters button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.visual-activity-timeline{flex:1;min-height:0;padding:6px;overflow:auto}.visual-activity-timeline>button{text-align:left;background:0 0;border-radius:9px;grid-template-columns:29px minmax(0,1fr);gap:7px;width:100%;padding:7px;display:grid}.visual-activity-timeline>button:hover,.visual-activity-timeline>button.is-open{background:rgb(var(--surface-2))}.activity-icon{background:rgb(var(--surface-2));width:27px;height:27px;color:rgb(var(--muted));border-radius:8px;place-items:center;display:grid}.visual-activity-timeline button>div{min-width:0}.visual-activity-timeline button>div>div{align-items:center;gap:6px;display:flex}.visual-activity-timeline strong{text-overflow:ellipsis;white-space:nowrap;font-size:9.5px;overflow:hidden}.visual-activity-timeline time{color:rgb(var(--faint));font-family:var(--mono);margin-left:auto;font-size:7.5px}.visual-activity-timeline p{color:rgb(var(--muted));font-family:var(--mono);-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin:2px 0 0;font-size:8px;line-height:1.45;display:-webkit-box;overflow:hidden}.visual-activity-timeline button.is-open p{-webkit-line-clamp:8}.visual-activity-timeline button>div>code{border:1px solid rgb(var(--border));background:rgb(var(--surface));max-height:220px;color:rgb(var(--muted));white-space:pre-wrap;border-radius:7px;margin-top:6px;padding:7px;font-size:7.5px;display:block;overflow:auto}.activity-empty{color:rgb(var(--faint));text-align:center;padding:24px;font-size:10px}.literature-v2__layout{grid-template-columns:230px minmax(500px,1fr) 370px;gap:14px}.literature-stats>div{min-height:78px;padding:15px}.literature-stats p{font-size:11px}.literature-stats strong{font-size:20px}.library-tabs button{min-height:43px;font-size:12px}.search-field input{font-size:13px}.literature-list-header h2{font-size:17px}.literature-list-header p{font-size:11px}.paper-grid{gap:12px}.paper-card{min-height:242px;padding:17px}.paper-card h3{margin-top:13px;font-size:14.5px;line-height:1.48}.paper-card__authors{font-size:10.5px}.paper-card__summary{-webkit-line-clamp:4;font-size:11px;line-height:1.6}.paper-card__year{font-size:10px}.paper-card__footer code{font-size:8.5px}.paper-card__footer span{font-size:10.5px}.paper-detail h2{font-size:17px}.paper-detail__authors{font-size:10.5px}.paper-detail__body h3{font-size:11.5px}.paper-detail__body p,.paper-detail__body .markdown{font-size:11px;line-height:1.65}.paper-detail__source code{font-size:9px}.retrieval-panel strong{font-size:9.5px}.retrieval-panel code,.retrieval-panel time{font-size:8px}.inbox-v2__layout{grid-template-columns:230px minmax(430px,1.08fr) minmax(380px,.92fr);gap:14px}.inbox-input__form{padding:18px}.inbox-input .field>span{font-size:12px}.inbox-input textarea{font-size:13px;line-height:1.65}.inbox-upload-types{border:1px dashed rgb(var(--border-strong));background:rgb(var(--surface-2) / .45);border-radius:11px;grid-template-columns:repeat(3,auto) minmax(0,1fr);align-items:center;gap:7px;margin-top:10px;padding:9px 11px;display:grid}.inbox-upload-types>span{background:rgb(var(--surface));color:rgb(var(--muted));border-radius:7px;align-items:center;gap:4px;padding:5px 7px;font-size:9px;display:flex}.inbox-upload-types p{color:rgb(var(--faint));margin:0;font-size:9px;line-height:1.4}.inbox-attachment-list{gap:6px;margin-top:9px;display:grid}.inbox-attachment-list>span{border:1px solid rgb(var(--border));background:rgb(var(--surface));color:rgb(var(--violet));border-radius:9px;grid-template-columns:24px minmax(0,1fr) 24px;align-items:center;gap:7px;padding:7px 9px;display:grid}.inbox-attachment-list>span>div{flex-direction:column;min-width:0;display:flex}.inbox-attachment-list strong{color:rgb(var(--text));text-overflow:ellipsis;white-space:nowrap;font-size:10px;overflow:hidden}.inbox-attachment-list small{color:rgb(var(--faint));font-size:8px}.inbox-attachment-list button{color:rgb(var(--faint));background:0 0;place-items:center;display:grid}.knowledge-grid strong{font-size:11.5px}.knowledge-grid .markdown{font-size:10.5px;line-height:1.55}.first-prompt>textarea{font-size:10.5px}.ide-v3{--vscode-bg:var(--surface);--vscode-side:var(--panel);--vscode-panel:var(--bg);--vscode-line:var(--line);--vscode-text:var(--ink);--vscode-muted:var(--ink-faint);--vscode-blue:var(--blue);--vscode-hover:var(--conversation-user);--vscode-selected:var(--conversation-argus)}.ide-v3 :is(.vscode-shell,.vscode-sidebar,.vscode-editor,.vscode-activitybar,.vscode-terminal,.vscode-code,.vscode-statusbar,.workspace-node>button){transition:background-color .16s,color .16s,border-color .16s}.ide-v3 .workspace-connector{font-size:13px}.vscode-shell{border:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-bg));min-width:0;height:760px;color:rgb(var(--vscode-text));box-shadow:var(--shadow-2);border-radius:12px;grid-template-rows:minmax(0,1fr) 190px 22px;grid-template-columns:44px 245px minmax(480px,1fr) 330px;display:grid;overflow:hidden}.vscode-activitybar{background:rgb(var(--vscode-panel));flex-direction:column;grid-area:1/1/3;align-items:center;gap:3px;padding-top:5px;display:flex}.vscode-activitybar button{width:44px;height:44px;color:rgb(var(--vscode-muted));background:0 0;border-left:2px solid #0000;place-items:center;display:grid;position:relative}.vscode-activitybar button:hover,.vscode-activitybar button.is-active{color:rgb(var(--vscode-blue));background:rgb(var(--vscode-selected))}.vscode-activitybar button.is-active{border-left-color:rgb(var(--vscode-blue))}.vscode-activitybar i{background:rgb(var(--blue-deep));color:#fff;text-align:center;border-radius:999px;min-width:16px;height:16px;font-size:8px;font-style:normal;line-height:16px;position:absolute;bottom:3px;right:3px}.vscode-sidebar{border-right:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-side));flex-direction:column;grid-area:1/2/3;min-width:0;display:flex}.vscode-sidebar>header{justify-content:space-between;align-items:center;height:36px;padding:0 10px 0 14px;display:flex}.vscode-sidebar>header span{letter-spacing:.08em;font-size:9px}.vscode-sidebar>header button{color:rgb(var(--vscode-muted));background:0 0;place-items:center;display:grid}.vscode-root{background:rgb(var(--vscode-panel));text-transform:uppercase;align-items:center;gap:4px;height:25px;padding:0 7px;font-size:9px;display:flex}.vscode-sidebar .workspace-tree{background:rgb(var(--vscode-side))}.vscode-sidebar .workspace-node>button{color:rgb(var(--vscode-text))}.vscode-sidebar .workspace-node>button:hover{background:rgb(var(--vscode-hover))}.vscode-sidebar .workspace-node>button.is-selected{background:rgb(var(--vscode-selected));color:rgb(var(--vscode-blue));box-shadow:inset 2px 0 rgb(var(--vscode-blue))}.vscode-sidebar .workspace-node button>span:not(.node-spacer){font-size:11px}.vscode-changes{padding:4px;overflow:auto}.vscode-changes button{width:100%;color:rgb(var(--vscode-text));text-align:left;background:0 0;border-radius:3px;grid-template-columns:22px minmax(0,1fr);gap:4px;padding:5px;display:grid}.vscode-changes button:hover{background:rgb(var(--vscode-hover))}.vscode-changes b{color:rgb(var(--role-engineer));font-size:9px}.vscode-changes span{text-overflow:ellipsis;white-space:nowrap;font-size:9px;overflow:hidden}.vscode-editor{background:rgb(var(--vscode-bg));flex-direction:column;grid-area:1/3;min-width:0;display:flex}.vscode-tabs{background:rgb(var(--vscode-panel));flex:0 0 36px;height:36px;display:flex}.vscode-tabs button{border-top:1px solid rgb(var(--vscode-blue));background:rgb(var(--vscode-bg));min-width:180px;max-width:60%;color:rgb(var(--vscode-text));align-items:center;gap:6px;padding:0 10px;font-size:9px;display:flex}.vscode-tabs button>span{color:rgb(var(--vscode-muted));margin-left:auto}.vscode-breadcrumbs{border-bottom:1px solid rgb(var(--vscode-line));height:28px;color:rgb(var(--vscode-muted));flex:0 0 28px;align-items:center;padding:0 11px;font-size:8.5px;display:flex;overflow:hidden}.vscode-breadcrumbs span{white-space:nowrap;align-items:center;display:flex}.vscode-editor-surface{flex:1;min-height:0;overflow:hidden}.vscode-editor-surface .empty-state{color:rgb(var(--vscode-text))}.vscode-editor-surface .empty-state__icon{border-color:rgb(var(--vscode-line));background:rgb(var(--vscode-side))}.vscode-code{background:rgb(var(--vscode-bg));height:100%;font-family:var(--mono);grid-template-columns:48px minmax(0,1fr);font-size:12px;line-height:1.7;display:grid;overflow:auto}.vscode-line-numbers{background:rgb(var(--vscode-bg));color:rgb(var(--vscode-muted));-webkit-user-select:none;user-select:none;flex-direction:column;align-items:flex-end;padding:12px 9px;display:flex;position:sticky;left:0}.vscode-line-numbers span{flex:none;height:1.7em}.vscode-code pre{min-width:max-content;color:rgb(var(--vscode-text));tab-size:2;white-space:pre;margin:0;padding:12px 18px 60px 8px}.vscode-editor-surface .workspace-pdf,.vscode-editor-surface .workspace-image{background:rgb(var(--vscode-bg))}.vscode-source-control{border-left:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-side));flex-direction:column;grid-area:1/4;min-width:0;display:flex}.vscode-source-control>header{border-bottom:1px solid rgb(var(--vscode-line));justify-content:space-between;align-items:center;height:49px;padding:0 10px;display:flex}.vscode-source-control>header>div{flex-direction:column;min-width:0;display:flex}.vscode-source-control header span{color:rgb(var(--vscode-muted));letter-spacing:.08em;font-size:8px}.vscode-source-control header strong{margin-top:2px;font-size:10px}.vscode-sc-tabs{border-bottom:1px solid rgb(var(--vscode-line));height:31px;display:flex}.vscode-sc-tabs button{color:rgb(var(--vscode-muted));background:0 0;border-bottom:1px solid #0000;flex:1;font-size:9px}.vscode-sc-tabs button.is-active{border-bottom-color:rgb(var(--vscode-blue));color:rgb(var(--vscode-text))}.vscode-git-content{flex:1;min-height:0;overflow:auto}.vscode-status,.vscode-diff{color:rgb(var(--vscode-text));font-family:var(--mono);white-space:pre-wrap;margin:0;padding:10px;font-size:8.5px;line-height:1.55}.vscode-status{border-bottom:1px solid rgb(var(--vscode-line));color:rgb(var(--vscode-text))}.vscode-commits{padding:5px}.vscode-commits article{grid-template-columns:22px minmax(0,1fr);gap:5px;padding:6px;display:grid}.vscode-commits strong{text-overflow:ellipsis;white-space:nowrap;font-size:9px;display:block;overflow:hidden}.vscode-commits small{color:rgb(var(--vscode-muted));font-size:7.5px}.vscode-terminal{border-top:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-panel));flex-direction:column;grid-area:2/3/auto/5;min-width:0;min-height:0;display:flex}.vscode-terminal>header{flex:0 0 31px;justify-content:space-between;align-items:center;height:31px;padding:0 10px;display:flex}.vscode-terminal header>div{gap:13px;display:flex}.vscode-terminal header button{height:31px;color:rgb(var(--vscode-muted));background:0 0;border-bottom:1px solid #0000;font-size:8px}.vscode-terminal header button.is-active{border-bottom-color:rgb(var(--vscode-blue));color:rgb(var(--vscode-text))}.vscode-terminal header>span{color:rgb(var(--vscode-muted));align-items:center;gap:4px;font-size:8px;display:flex}.vscode-terminal>div{flex:1;min-height:0;padding:5px 10px;overflow:auto}.vscode-terminal article{font-family:var(--mono);grid-template-columns:52px 52px 10px minmax(0,1fr);gap:5px;padding:2px 0;font-size:8.5px;line-height:1.45;display:grid}.vscode-terminal time{color:rgb(var(--vscode-muted));font-variant-numeric:tabular-nums}.vscode-terminal article>span{color:rgb(var(--role-engineer))}.vscode-terminal code{overflow-wrap:anywhere;white-space:pre-wrap}.vscode-terminal p{color:rgb(var(--vscode-muted));font-family:var(--mono);font-size:9px}.vscode-statusbar{border-top:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-panel));color:rgb(var(--vscode-muted));grid-area:3/1/auto/5;align-items:center;gap:15px;padding:0 8px;font-size:8px;display:flex}.vscode-statusbar span{align-items:center;gap:4px;display:flex}.vscode-statusbar span:nth-child(2){margin-right:auto}.paper-root-bar{grid-template-columns:30px minmax(0,1fr) auto 34px;align-items:center;gap:8px;margin-bottom:12px;padding:9px 12px;display:grid}.paper-root-bar>div{flex-direction:column;display:flex}.paper-root-bar span{color:rgb(var(--faint));letter-spacing:.11em;font-size:8.5px;font-weight:700}.paper-root-bar input{font-family:var(--mono);background:0 0;border:0;outline:0;margin-top:2px;font-size:10.5px}.paper-v3__shell{grid-template-columns:245px minmax(470px,1.25fr) minmax(390px,.9fr);gap:14px;min-width:0;height:780px;display:grid}.paper-v3__sources{flex-direction:column;display:flex}.paper-source-group{padding:7px}.paper-source-group+.paper-source-group{border-top:1px solid rgb(var(--border))}.paper-source-group h3{color:rgb(var(--muted));letter-spacing:.08em;align-items:center;gap:5px;margin:3px 5px 7px;font-size:9.5px;display:flex}.paper-source-group>button{width:100%;color:rgb(var(--muted));text-align:left;background:0 0;border-radius:9px;grid-template-columns:22px minmax(0,1fr) auto;align-items:center;gap:6px;padding:8px;display:grid}.paper-source-group>button:hover,.paper-source-group>button.is-active{background:rgb(var(--surface-2))}.paper-source-group>button.is-active{color:rgb(var(--blue))}.paper-source-group button>div{flex-direction:column;min-width:0;display:flex}.paper-source-group strong,.paper-source-group code{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.paper-source-group strong{font-size:10.5px}.paper-source-group code,.paper-source-group small{color:rgb(var(--faint));font-size:8px}.paper-source-group>p{color:rgb(var(--faint));padding:8px;font-size:10px}.paper-v3__sources>footer{border-top:1px solid rgb(var(--border));margin-top:auto;padding:9px 11px}.paper-v3__sources footer span{color:rgb(var(--faint));font-size:8px;display:block}.paper-v3__sources footer code{text-overflow:ellipsis;white-space:nowrap;margin-top:3px;font-size:8px;display:block;overflow:hidden}.paper-v3__source{flex-direction:column;display:flex}.paper-v3__source>header{min-height:50px;padding:8px 12px}.paper-v3__source header>div{flex-direction:column;min-width:0;display:flex}.paper-v3__source header strong{font-size:12px}.paper-v3__source header code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.paper-v3__source header>span{color:rgb(var(--faint));font-size:8.5px}.paper-v3__source>div{flex:1;min-height:0;overflow:hidden}.paper-v3__source>footer,.paper-v3__outputs>footer{border-top:1px solid rgb(var(--border));height:31px;color:rgb(var(--faint));font-family:var(--mono);justify-content:space-between;align-items:center;padding:0 11px;font-size:8.5px;display:flex}.latex-source{background:rgb(var(--surface-2) / .38);height:100%;font-family:var(--mono);grid-template-columns:48px minmax(0,1fr);font-size:10.5px;line-height:1.65;display:grid;overflow:auto}.latex-line-numbers{background:rgb(var(--surface-2));color:rgb(var(--faint));-webkit-user-select:none;user-select:none;flex-direction:column;align-items:flex-end;padding:14px 9px;display:flex;position:sticky;left:0}.latex-line-numbers span{height:17.325px}.latex-source pre{white-space:pre;min-width:max-content;margin:0;padding:14px 18px 50px 8px}.paper-v3__outputs{flex-direction:column;display:flex}.paper-v3__outputs>nav{border-bottom:1px solid rgb(var(--border));grid-template-columns:repeat(3,1fr);padding:6px;display:grid}.paper-v3__outputs>nav button{color:rgb(var(--muted));background:0 0;border-radius:8px;justify-content:center;align-items:center;gap:4px;padding:7px 4px;font-size:10px;display:flex}.paper-v3__outputs>nav button.is-active{background:rgb(var(--accent));color:rgb(var(--accent-fg))}.paper-v3__outputs nav small{font-family:var(--mono)}.paper-output-surface{flex:1;min-height:0;overflow:hidden}.paper-output-surface>embed{background:#fff;border:0;width:100%;height:calc(100% - 34px)}.pdf-switcher{border-bottom:1px solid rgb(var(--border));height:34px;padding:4px;display:flex;overflow-x:auto}.pdf-switcher button{color:rgb(var(--muted));background:0 0;border-radius:6px;flex:none;padding:0 8px;font-size:8.5px}.pdf-switcher button.is-active{background:rgb(var(--surface-2));color:rgb(var(--text))}.paper-figure-grid{grid-template-columns:1fr 1fr;align-content:start;gap:8px;height:100%;padding:9px;display:grid;overflow:auto}.paper-figure-grid figure,.paper-figure-grid article{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:10px;min-width:0;margin:0;padding:7px}.paper-figure-grid img{-o-object-fit:contain;object-fit:contain;background:rgb(var(--surface-2));width:100%;height:150px}.paper-figure-grid figcaption{text-overflow:ellipsis;white-space:nowrap;margin-top:5px;font-size:8.5px;overflow:hidden}.paper-figure-grid article{min-height:120px;color:rgb(var(--muted));text-align:center;flex-direction:column;justify-content:center;align-items:center;display:flex}.paper-figure-grid article strong{margin:7px 0 3px;font-size:10px}.paper-figure-grid article code{max-width:100%;color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:7.5px;overflow:hidden}.paper-reference-list{padding:7px}.paper-reference-list button{text-align:left;background:0 0;border-radius:8px;grid-template-columns:24px minmax(0,1fr);gap:7px;width:100%;padding:8px;display:grid}.paper-reference-list button:hover{background:rgb(var(--surface-2))}.paper-reference-list button>div{flex-direction:column;min-width:0;display:flex}.paper-reference-list strong{font-size:10px}.paper-reference-list code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8px;overflow:hidden}.review-flow{grid-template-columns:repeat(4,1fr);gap:8px;margin-bottom:12px;display:grid}.review-flow>div{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:68px;color:rgb(var(--muted));border-radius:12px;grid-template-columns:25px 24px minmax(0,1fr);align-items:center;gap:7px;padding:10px;display:grid;position:relative}.review-flow>div.is-active{border-color:rgb(var(--blue) / .3);background:rgb(var(--blue-bg));color:rgb(var(--blue))}.review-flow>div.is-done{color:rgb(var(--green))}.review-flow>div>span{background:rgb(var(--surface-2));border-radius:7px;place-items:center;width:23px;height:23px;font-size:9px;font-weight:700;display:grid}.review-flow>div>div{flex-direction:column;display:flex}.review-flow strong{color:rgb(var(--text));font-size:11px}.review-flow small{margin-top:2px;font-size:8.5px}.review-flow b{z-index:2;color:rgb(var(--faint));font-weight:400;position:absolute;right:-8px}.process-review-layout,.final-review-layout{min-height:650px}.review-rounds strong{font-size:10.5px}.review-rounds small{font-size:9px}.process-report .markdown,.final-review-report .markdown{font-size:12.5px;line-height:1.72}.final-review-form .field>span{font-size:11.5px}.final-review-form select,.final-review-form textarea{font-size:12px}@media (width<=1450px){.literature-v2__layout{grid-template-columns:220px minmax(440px,1fr) 340px}.inbox-v2__layout{grid-template-columns:210px minmax(390px,1fr) 350px}.vscode-shell{grid-template-columns:42px 225px minmax(420px,1fr) 300px}.paper-v3__shell{grid-template-columns:225px minmax(420px,1fr) 360px}}@media (width<=1180px){.copilot-v2__layout{grid-template-columns:minmax(0,1fr) 340px}.literature-v2__layout{grid-template-columns:220px minmax(0,1fr)}.literature-v2__detail{grid-column:1/-1;grid-template-columns:1.2fr 1fr 1fr}.inbox-v2__layout{grid-template-columns:220px minmax(0,1fr)}.inbox-output{grid-column:1/-1}.vscode-shell{grid-template-rows:minmax(0,1fr) 180px 22px;grid-template-columns:42px 220px minmax(0,1fr);height:820px}.vscode-source-control{display:none}.vscode-terminal{grid-column:3}.vscode-statusbar{grid-column:1/4}.paper-v3__shell{grid-template-columns:220px minmax(0,1fr);height:auto}.paper-v3__sources,.paper-v3__source{min-height:720px}.paper-v3__outputs{grid-column:1/-1;min-height:720px}}@media (width<=900px){.copilot-v2__layout{grid-template-columns:1fr}.copilot-v2__aside{display:none}.literature-v2__layout{grid-template-columns:1fr}.literature-v2__sidebar{display:none}.inbox-v2__layout{grid-template-columns:1fr}.inbox-output{grid-column:auto}.vscode-shell{grid-template-columns:42px 210px minmax(0,1fr)}.paper-v3__shell{grid-template-columns:210px minmax(0,1fr)}.paper-v3__outputs{grid-column:1/-1}}@media (width<=640px){.ros-page:not(.copilot-v2) .ros-page-header h1{font-size:23px}.ros-page:not(.copilot-v2) .ros-page-header p{font-size:12.5px}.vscode-shell{flex-direction:column;height:auto;display:flex}.vscode-activitybar{flex-direction:row;height:44px}.vscode-sidebar{min-height:420px}.vscode-editor{min-height:680px}.vscode-terminal{min-height:240px}.vscode-statusbar{height:22px}.paper-root-bar{grid-template-columns:25px minmax(0,1fr) auto}.paper-root-bar>.icon-button{display:none}.paper-v3__shell{flex-direction:column;display:flex}.paper-v3__sources{min-height:480px}.paper-v3__source,.paper-v3__outputs{min-height:720px}.paper-figure-grid{grid-template-columns:1fr}.review-flow{grid-template-columns:1fr 1fr}.review-flow b{display:none}.inbox-upload-types{grid-template-columns:1fr 1fr 1fr}.inbox-upload-types p{grid-column:1/-1}}.pdf-canvas-viewer{background:#525256;flex-direction:column;height:calc(100% - 34px);display:flex;overflow:hidden}.pdf-canvas-toolbar{background:rgb(var(--surface));flex:0 0 37px;align-items:center;gap:6px;min-height:37px;padding:0 8px;display:flex}.pdf-canvas-toolbar strong{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:9px;overflow:hidden}.pdf-canvas-toolbar span{color:rgb(var(--muted));font-size:8.5px}.pdf-canvas-toolbar button{border:1px solid rgb(var(--border));background:rgb(var(--surface-2));min-width:27px;height:25px;color:rgb(var(--muted));border-radius:6px;padding:0 6px;font-size:8px}.pdf-canvas-scroll{text-align:center;flex:1;min-height:0;padding:14px;overflow:auto}.pdf-canvas-scroll canvas{background:#fff;max-width:none;display:inline-block;box-shadow:0 3px 18px #00000059}.pdf-canvas-viewer>.inline-error{margin:10px}.custom-project-switcher{min-width:280px;max-width:430px;position:relative}.project-switcher-trigger{text-align:left;background:0 0;border:1px solid #0000;border-radius:10px;grid-template-columns:8px minmax(0,1fr) 16px;align-items:center;gap:9px;width:100%;min-height:38px;padding:0 9px;transition:background .15s,border-color .15s;display:grid}.project-switcher-trigger:hover,.project-switcher-trigger.is-open{border-color:rgb(var(--border));background:rgb(var(--surface-2))}.project-switcher-trigger strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.project-switcher-trigger>svg{color:rgb(var(--faint));transition:transform .15s}.project-switcher-trigger.is-open>svg{transform:rotate(180deg)}.project-switcher-popover{z-index:100;border:1px solid rgb(var(--border));background:rgb(var(--overlay));width:min(440px,100vw - 28px);box-shadow:var(--shadow-3);border-radius:14px;animation:.14s ease-out popoverIn;position:absolute;top:calc(100% + 8px);left:0;overflow:hidden}.project-switcher-popover>header{border-bottom:1px solid rgb(var(--border));flex-direction:column;padding:12px 14px;display:flex}.project-switcher-popover header span{color:rgb(var(--faint));letter-spacing:.13em;font-size:8.5px;font-weight:700}.project-switcher-popover header strong{margin-top:2px;font-size:13px}.project-switcher-popover>div{max-height:390px;padding:6px;overflow:auto}.project-switcher-popover>div>button{width:100%;color:rgb(var(--text));text-align:left;background:0 0;border-radius:10px;grid-template-columns:38px minmax(0,1fr) 18px;align-items:center;gap:9px;padding:9px;display:grid}.project-switcher-popover>div>button:hover{background:rgb(var(--surface-2))}.project-switcher-popover>div>button.is-selected{background:rgb(var(--blue-bg))}.project-option-icon{background:rgb(var(--surface-2));width:36px;height:36px;color:rgb(var(--muted));border-radius:10px;place-items:center;display:grid}.project-option-icon.is-live{background:rgb(var(--green-bg));color:rgb(var(--green))}.project-option-copy{grid-template-columns:minmax(0,1fr) auto;gap:2px 8px;min-width:0;display:grid}.project-option-copy strong{text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;overflow:hidden}.project-option-copy small{color:rgb(var(--faint));font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;grid-column:1/-1;font-size:7.5px;overflow:hidden}.project-option-copy em{color:rgb(var(--muted));white-space:nowrap;grid-area:1/2;font-size:8px;font-style:normal}.project-option-status{background:rgb(var(--faint));border-radius:50%;justify-self:center;width:7px;height:7px}.project-option-status.is-live{background:rgb(var(--green));box-shadow:0 0 0 4px rgb(var(--green) / .1)}.project-switcher-popover>footer{border-top:1px solid rgb(var(--border));background:rgb(var(--surface-2) / .55);color:rgb(var(--faint));justify-content:space-between;padding:8px 14px;font-size:8.5px;display:flex}.experiment-v3{max-width:1480px;margin:0 auto}.experiment-header-actions{flex-wrap:wrap;justify-content:flex-end;gap:7px;display:flex}.experiment-progress-hero{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:16px;grid-template-columns:minmax(0,1fr) 170px;gap:18px;padding:22px 24px 0;display:grid;overflow:hidden}.progress-hero-main{min-width:0}.progress-live-line{color:rgb(var(--muted));flex-wrap:wrap;align-items:center;gap:8px;font-size:10px;display:flex}.progress-live-line>span{border-left:1px solid rgb(var(--border));text-transform:capitalize;padding-left:8px}.progress-hero-main h2{letter-spacing:-.025em;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:12px 0 10px;font-size:21px;line-height:1.35;display:-webkit-box;overflow:hidden}.current-step-callout{border:1px solid rgb(var(--green) / .18);background:rgb(var(--green-bg) / .62);border-radius:12px;grid-template-columns:38px minmax(0,1fr);gap:9px;padding:10px 12px;display:grid}.current-step-callout>span{background:rgb(var(--green-bg));width:36px;height:36px;color:rgb(var(--green));border-radius:10px;place-items:center;display:grid}.current-step-callout>div{flex-direction:column;min-width:0;display:flex}.current-step-callout small{color:rgb(var(--green));font-size:9px;font-weight:650}.current-step-callout strong{margin:2px 0;font-size:12px}.current-step-callout code{color:rgb(var(--muted));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.progress-number{flex-direction:column;align-self:center;align-items:flex-end;padding-right:4px;display:flex}.progress-number>span{color:rgb(var(--blue));letter-spacing:.08em;font-size:9px;font-weight:700}.progress-number strong{letter-spacing:-.06em;margin:2px 0;font-size:43px;font-weight:720}.progress-number small{color:rgb(var(--muted));font-size:9.5px}.truthful-progress{grid-column:1/-1;margin-top:3px}.truthful-progress__track{background:rgb(var(--surface-3));border-radius:999px;height:13px;position:relative;overflow:visible}.truthful-progress__track .confirmed{background:rgb(var(--blue));border-radius:999px;transition:width .5s;position:absolute;inset:0 auto 0 0}.truthful-progress__track .\!confirmed{background:rgb(var(--blue))!important;border-radius:999px!important;transition:width .5s!important;position:absolute!important;inset:0 auto 0 0!important}.truthful-progress__track .estimated-range{border:1px dashed rgb(var(--blue) / .65);background:rgb(var(--blue) / .1);border-radius:999px;position:absolute;inset-block:1px}.truthful-progress__track i{background:rgb(var(--accent));width:2px;height:21px;box-shadow:0 0 0 3px rgb(var(--surface));border-radius:2px;transition:left .5s;position:absolute;top:-4px}.progress-metrics{border-top:1px solid rgb(var(--border));grid-column:1/-1;grid-template-columns:repeat(4,1fr);margin-inline:-24px;display:grid}.progress-metrics>div{border-right:1px solid rgb(var(--border));flex-direction:column;min-width:0;padding:13px 18px;display:flex}.progress-metrics>div:last-child{border-right:0}.progress-metrics span{color:rgb(var(--muted));align-items:center;gap:5px;font-size:9px;display:flex}.progress-metrics strong{text-overflow:ellipsis;white-space:nowrap;margin:5px 0 2px;font-size:16px;overflow:hidden}.progress-metrics small{color:rgb(var(--faint));-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:8.5px;line-height:1.4;display:-webkit-box;overflow:hidden}.research-stage-rail{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:14px;grid-template-columns:repeat(7,1fr);gap:5px;margin:12px 0;padding:8px;display:grid}.research-stage-rail>div{color:rgb(var(--faint));border-radius:9px;align-items:center;gap:6px;padding:7px 9px;display:flex;position:relative}.research-stage-rail>div>span{background:rgb(var(--surface-2));border-radius:8px;flex:0 0 24px;place-items:center;width:24px;height:24px;font-size:9px;font-weight:700;display:grid}.research-stage-rail strong{font-size:9px}.research-stage-rail>div>svg{z-index:2;position:absolute;right:-6px}.research-stage-rail>div.is-done{color:rgb(var(--green))}.research-stage-rail>div.is-done>span{background:rgb(var(--green-bg))}.research-stage-rail>div.is-active{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.research-stage-rail>div.is-active>span{background:rgb(var(--blue));color:#fff}.experiment-v3-grid{grid-template-columns:245px minmax(450px,1fr) 315px;align-items:start;gap:12px;display:grid}.experiment-task-route>div{max-height:720px;padding:6px;overflow:auto}.experiment-task-route>div>button{text-align:left;background:0 0;border-radius:10px;grid-template-columns:30px minmax(0,1fr);gap:7px;width:100%;padding:9px;display:grid}.experiment-task-route>div>button:hover,.experiment-task-route>div>button.is-active{background:rgb(var(--surface-2))}.task-state{border:1px solid rgb(var(--border));background:rgb(var(--surface));width:28px;height:28px;color:rgb(var(--faint));border-radius:9px;place-items:center;display:grid}.experiment-task-route button>div{flex-direction:column;min-width:0;display:flex}.experiment-task-route strong{-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:10.5px;line-height:1.4;display:-webkit-box;overflow:hidden}.experiment-task-route small{color:rgb(var(--faint));margin-top:3px;font-size:8.5px}.experiment-v3-center,.experiment-v3-side{gap:12px;min-width:0;display:grid}.checkpoint-list{grid-template-columns:repeat(4,1fr);gap:0;padding:14px;display:grid}.checkpoint{text-align:center;flex-direction:column;align-items:center;min-width:0;display:flex;position:relative}.checkpoint>span{z-index:2;border:2px solid rgb(var(--surface));background:rgb(var(--surface-2));width:30px;height:30px;color:rgb(var(--faint));box-shadow:0 0 0 1px rgb(var(--border));border-radius:50%;place-items:center;font-size:9px;font-weight:700;display:grid;position:relative}.checkpoint>i{background:rgb(var(--border));height:2px;position:absolute;top:15px;left:calc(50% + 15px);right:calc(15px - 50%)}.checkpoint>div{margin-top:8px;padding-inline:4px}.checkpoint strong{font-size:9.5px;display:block}.checkpoint p{color:rgb(var(--muted));margin:3px 0 0;font-size:8px;line-height:1.4}.checkpoint--active>span{background:rgb(var(--blue));color:#fff;animation:2s infinite livePulse}.selected-task-detail{border-top:1px solid rgb(var(--border));background:rgb(var(--surface-2) / .45);padding:12px 15px}.selected-task-detail>span{color:rgb(var(--faint));font-size:8px}.selected-task-detail strong{margin-top:3px;font-size:11px;display:block}.selected-task-detail p{color:rgb(var(--muted));-webkit-line-clamp:3;-webkit-box-orient:vertical;margin:4px 0 0;font-size:9px;line-height:1.5;display:-webkit-box;overflow:hidden}.experiment-live-events{max-height:560px;overflow:auto}.experiment-team>div{padding:6px}.experiment-team article{border-radius:10px;grid-template-columns:10px minmax(0,1fr) auto;align-items:center;gap:8px;padding:9px;display:grid}.experiment-team article.is-active{background:rgb(var(--blue-bg))}.role-dot{background:rgb(var(--faint));border-radius:50%;width:8px;height:8px}.experiment-team article>div{min-width:0}.experiment-team strong{text-transform:capitalize;font-size:10.5px}.experiment-team p{color:rgb(var(--muted));text-overflow:ellipsis;white-space:nowrap;margin:2px 0;font-size:8.5px;overflow:hidden}.experiment-team small{color:rgb(var(--faint));font-size:8px}.estimate-note>div{padding:13px}.estimate-note p{color:rgb(var(--muted));margin:0 0 11px;font-size:9.5px;line-height:1.55}.estimate-note p strong{color:rgb(var(--text));margin-bottom:3px;display:block}@media (width<=1450px){.experiment-v3-grid{grid-template-columns:225px minmax(420px,1fr) 290px}}@media (width<=1180px){.experiment-v3-grid{grid-template-columns:220px minmax(0,1fr)}.experiment-v3-side{grid-column:1/-1;grid-template-columns:1fr 1fr}.research-stage-rail{grid-template-columns:repeat(7,minmax(135px,1fr));overflow-x:auto}}@media (width<=900px){.custom-project-switcher{min-width:0;max-width:320px}.progress-metrics{grid-template-columns:1fr 1fr}.progress-metrics>div:nth-child(2){border-right:0}.progress-metrics>div:nth-child(-n+2){border-bottom:1px solid rgb(var(--border))}.experiment-v3-grid{grid-template-columns:1fr}.experiment-v3-side{grid-column:auto;grid-template-columns:1fr}}@media (width<=640px){.project-switcher-trigger strong{font-size:11px}.project-switcher-popover{top:calc(var(--topbar) + 6px);width:auto;position:fixed;left:8px;right:8px}.experiment-progress-hero{grid-template-columns:1fr;padding:18px 18px 0}.progress-number{align-items:flex-start}.truthful-progress{grid-column:1}.progress-metrics{grid-column:1;margin-inline:-18px}.checkpoint-list{grid-template-columns:1fr;gap:6px}.checkpoint{text-align:left;grid-template-columns:34px minmax(0,1fr);align-items:center;min-height:50px;display:grid}.checkpoint>div{margin-top:0}.checkpoint>i{width:2px;height:auto;top:30px;bottom:-8px;left:15px}.checkpoint p{font-size:8.5px}}.experiment-v3 .experiment-v3-grid{margin-top:16px}.experiment-v3 .work-objective{color:rgb(var(--muted));overflow-wrap:anywhere;margin:0 0 16px;font-size:12px;line-height:1.7}.experiment-v3 .current-step-callout{border-color:rgb(var(--border));background:rgb(var(--surface-2))}.experiment-v3 .current-step-callout>span{background:rgb(var(--blue-bg));color:rgb(var(--blue))}.experiment-v3 .current-step-callout small{color:rgb(var(--muted));font-size:11px}.experiment-v3 .current-step-callout strong{font-size:13px}.experiment-v3 .current-step-callout p{color:rgb(var(--muted));overflow-wrap:anywhere;white-space:pre-wrap;margin:4px 0 0;font-size:12px;line-height:1.6}.experiment-v3 .progress-number em{color:rgb(var(--faint));letter-spacing:-.02em;font-size:22px;font-style:normal;font-weight:450}.experiment-v3 .progress-number>span,.experiment-v3 .progress-number small{letter-spacing:0;font-size:11px}.experiment-v3 .truthful-progress__track{height:7px}.experiment-v3 .work-scope{color:rgb(var(--muted));margin:10px 0 16px;font-size:11px;line-height:1.7}.experiment-v3 .progress-metrics span{font-size:11px}.experiment-v3 .progress-metrics small{color:rgb(var(--muted));font-size:10px;line-height:1.6;display:block;overflow:visible}.work-item-group+.work-item-group{border-top:1px solid rgb(var(--border));margin-top:8px;padding-top:8px}.work-item-group h3{color:rgb(var(--muted));justify-content:space-between;margin:8px 9px;font-size:11px;font-weight:550;display:flex}.work-item-group h3 span{font-variant-numeric:tabular-nums}.work-item-group>button{text-align:left;background:0 0;border-radius:10px;grid-template-columns:30px minmax(0,1fr);gap:8px;width:100%;padding:11px 9px;display:grid}.work-item-group>button:hover,.work-item-group>button.is-active{background:rgb(var(--surface-2))}.experiment-v3 .work-item-group strong{font-size:12px;line-height:1.5}.experiment-v3 .work-item-group small{font-size:10px;line-height:1.5}.work-group-empty{color:rgb(var(--faint));margin:8px 9px 12px;font-size:11px}.work-conclusion>header{flex-wrap:wrap;gap:10px}.work-conclusion>header .badge{white-space:normal}.work-conclusion__body{padding:18px}.work-conclusion__body>p{color:rgb(var(--text));white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-size:13px;line-height:1.8}.work-conclusion__body>div{border-top:1px solid rgb(var(--border));margin-top:16px;padding-top:14px}.work-conclusion__body h3{color:rgb(var(--muted));margin:0 0 6px;font-size:11px;font-weight:650}.work-conclusion__body>div p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-size:12px;line-height:1.8}.experiment-v3 .work-conclusion__body>.work-scope{border-left:2px solid rgb(var(--border));margin:16px 0 0;padding-left:12px}.experiment-v3 .checkpoint strong{font-size:11px}.experiment-v3 .checkpoint p{font-size:10px;line-height:1.5}.experiment-v3 .selected-task-detail strong{font-size:12px}.experiment-v3 .selected-task-detail p{font-size:11px;line-height:1.7;display:block}.experiment-v3 .experiment-team p{white-space:normal;font-size:11px;line-height:1.6;overflow:visible}.experiment-v3 .experiment-team .work-team-note{margin:0;padding:14px 15px 6px}.experiment-v3 .experiment-team strong{font-size:12px}.experiment-v3 .estimate-note p{font-size:12px;line-height:1.7}.work-evidence-note{border-top:1px solid rgb(var(--border));color:rgb(var(--muted));grid-template-columns:16px minmax(0,1fr);align-items:start;gap:8px;padding-top:12px;font-size:11px;line-height:1.7;display:grid}.work-evidence-note>svg{margin-top:2px}.ide-context-strip{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:10px 10px 0 0;grid-template-columns:18px minmax(150px,240px) minmax(0,1fr) auto auto 28px;align-items:center;gap:8px;min-height:40px;margin-bottom:-1px;padding:5px 8px 5px 11px;display:grid}.ide-context-strip>svg{color:rgb(var(--muted))}.ide-context-strip select{background:0 0;border:0;outline:0;width:100%;font-size:10.5px;font-weight:620}.ide-context-strip code{color:rgb(var(--faint));text-overflow:ellipsis;white-space:nowrap;font-size:8.5px;overflow:hidden}.ide-context-strip small{color:rgb(var(--faint));font-family:var(--mono);font-size:8px}.ide-context-strip>button{background:rgb(var(--surface-2));width:27px;height:27px;color:rgb(var(--muted));border-radius:7px;place-items:center;display:grid}.ide-context-strip+.vscode-shell{border-radius:0 0 12px 12px}.repository-readiness{padding:11px}.repository-readiness h3{color:rgb(var(--vscode-text));margin:0 0 9px;font-size:11px}.repository-readiness dl{gap:5px;margin:0;display:grid}.repository-readiness dl>div{border:1px solid rgb(var(--vscode-line));background:rgb(var(--vscode-bg));border-radius:6px;grid-template-columns:110px minmax(0,1fr) 18px;align-items:center;gap:5px;padding:7px;display:grid}.repository-readiness dt{color:rgb(var(--vscode-muted));align-items:center;gap:5px;font-size:8.5px;display:flex}.repository-readiness dd{color:rgb(var(--vscode-text));font-family:var(--mono);text-overflow:ellipsis;white-space:pre-wrap;margin:0;font-size:7.8px;line-height:1.4;overflow:hidden}.repository-readiness i{border-radius:50%;place-items:center;width:17px;height:17px;font-style:normal;display:grid}.repository-readiness i.ok{background:rgb(var(--role-engineer) / .12);color:rgb(var(--role-engineer))}.repository-readiness i.missing{background:rgb(var(--role-reviewer) / .12);color:rgb(var(--role-reviewer))}.repository-readiness>p{border-top:1px solid rgb(var(--vscode-line));color:rgb(var(--vscode-muted));margin:10px 0 0;padding-top:9px;font-size:8.5px;line-height:1.5}.vscode-terminal>header>strong{color:rgb(var(--vscode-text));letter-spacing:.08em;font-size:8.5px}.paper-root-bar>div{min-width:0}.paper-root-bar select{background:0 0;border:0;outline:0;max-width:260px;margin-top:2px;font-size:10.5px;font-weight:620}.paper-root-bar code{color:rgb(var(--faint));font-family:var(--mono);text-overflow:ellipsis;white-space:nowrap;font-size:8px;overflow:hidden}.figure-loading{background:rgb(var(--surface-2));height:150px;color:rgb(var(--faint));place-items:center;font-size:9px;display:grid}.review-form-row{grid-template-columns:1fr 1fr;gap:8px;margin-top:11px;display:grid}.review-emphasis{border:1px solid rgb(var(--border));border-radius:10px;grid-template-columns:1fr 1fr;gap:5px;margin:11px 0;padding:10px;display:grid}.review-emphasis legend{color:rgb(var(--muted));padding:0 5px;font-size:10px;font-weight:620}.review-emphasis label{color:rgb(var(--muted));border-radius:7px;align-items:center;gap:5px;padding:4px 5px;font-size:8.5px;display:flex}.review-emphasis label:hover{background:rgb(var(--surface-2))}.review-emphasis input{accent-color:rgb(var(--blue))}.project-intake-start{align-items:center;gap:7px;display:flex}.project-intake-start select{border:1px solid rgb(var(--border-strong));background:rgb(var(--surface));border-radius:10px;outline:0;max-width:260px;height:42px;padding:0 9px;font-size:10px}.release-page{max-width:1280px;margin:0 auto}.release-hero{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:16px;grid-template-columns:58px minmax(0,1fr);align-items:center;gap:15px;padding:22px;display:grid}.release-hero>span{background:rgb(var(--surface-2));width:54px;height:54px;color:rgb(var(--text));border-radius:14px;place-items:center;display:grid}.release-hero h2{margin:3px 0 6px;font-size:21px}.release-hero p{max-width:780px;color:rgb(var(--muted));margin:0;font-size:11.5px;line-height:1.6}.release-module-grid{grid-template-columns:repeat(3,1fr);gap:12px;margin:14px 0;display:grid}.release-module{border:1px solid rgb(var(--border));background:rgb(var(--surface));min-height:290px;box-shadow:var(--shadow-1);border-radius:15px;padding:17px}.release-module>header{justify-content:space-between;align-items:center;display:flex}.release-module header>span{background:rgb(var(--surface-2));width:42px;height:42px;color:rgb(var(--muted));border-radius:11px;place-items:center;display:grid}.release-module h3{margin:16px 0 6px;font-size:15px}.release-module>p{min-height:52px;color:rgb(var(--muted));margin:0;font-size:10.5px;line-height:1.55}.release-module ul{border-top:1px solid rgb(var(--border));gap:7px;margin:13px 0 0;padding:13px 0 0;list-style:none;display:grid}.release-module li{color:rgb(var(--muted));align-items:center;gap:6px;font-size:9.5px;display:flex}.release-module li svg{color:rgb(var(--green))}.release-flow{border:1px solid rgb(var(--border));background:rgb(var(--surface));border-radius:14px;grid-template-columns:1fr 20px 1fr 20px 1fr 20px 1fr;align-items:center;padding:12px;display:grid}.release-flow>div{border-radius:10px;grid-template-columns:32px minmax(0,1fr);gap:7px;padding:9px;display:grid}.release-flow>div>svg{color:rgb(var(--blue));grid-row:1/3;align-self:center}.release-flow strong{font-size:10px}.release-flow small{color:rgb(var(--faint));font-size:8px}.release-flow>b{color:rgb(var(--faint));text-align:center;font-weight:400}.release-boundary{border:1px solid rgb(var(--amber) / .22);background:rgb(var(--amber-bg));color:rgb(var(--amber));border-radius:12px;gap:9px;margin-top:12px;padding:12px;display:flex}.release-boundary strong{font-size:10.5px}.release-boundary p{margin:3px 0 0;font-size:9px;line-height:1.5}@media (width<=900px){.release-module-grid{grid-template-columns:1fr}.release-flow{grid-template-columns:1fr;gap:5px}.release-flow>b{transform:rotate(90deg)}.project-intake-start{flex-direction:column;align-items:stretch}.project-intake-start select{max-width:none}}@media (width<=640px){.ide-context-strip{grid-template-columns:18px minmax(0,1fr) auto 28px}.ide-context-strip code,.ide-context-strip small{display:none}.review-form-row,.review-emphasis,.release-hero{grid-template-columns:1fr}}@media (width<=1180px){.vscode-shell{grid-template-rows:minmax(0,1fr) 180px 340px 22px}.vscode-source-control{border-top:1px solid rgb(var(--vscode-line));border-left:0;grid-area:3/2/auto/4;display:flex}.vscode-statusbar{grid-row:4}}@media (width<=900px){.literature-v2__sidebar{display:block}.literature-v2__sidebar .library-tabs{grid-template-columns:repeat(4,1fr);gap:5px;display:grid}.literature-v2__sidebar .library-tabs button{justify-content:center;gap:7px}.literature-source-note{display:none}}@media (width<=640px){.literature-v2__sidebar .library-tabs{grid-template-columns:1fr 1fr}.vscode-source-control{min-height:420px}}@media (width<=900px){.copilot-v2{height:auto;min-height:100%;overflow:visible}.copilot-v2__layout{flex-direction:column;display:flex}.copilot-v2__thread{min-height:720px}.copilot-v2__aside{min-height:540px;display:block}}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.inset-y-1{top:.25rem;bottom:.25rem}.inset-y-2{top:.5rem;bottom:.5rem}.-bottom-2\.5{bottom:-.625rem}.-left-0\.5{left:-.125rem}.-top-1\.5{top:-.375rem}.-top-2\.5{top:-.625rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-4{left:1rem}.left-\[0\.6875rem\]{left:.6875rem}.left-\[10\%\]{left:10%}.left-\[5px\]{left:5px}.right-0\.5{right:.125rem}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-9{right:2.25rem}.right-\[10\%\]{right:10%}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-2{top:.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-6{top:1.5rem}.isolate{isolation:isolate}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[110\]{z-index:110}.z-\[70\]{z-index:70}.z-\[90\]{z-index:90}.order-2{order:2}.order-3{order:3}.m-1{margin:.25rem}.m-auto{margin:auto}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-1\.5{margin-top:.375rem;margin-bottom:.375rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-9{margin-top:2.25rem}.mt-\[7px\]{margin-top:7px}.mt-auto{margin-top:auto}.mt-px{margin-top:1px}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.flow-root{display:flow-root}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1\.4rem\]{height:1.4rem}.h-\[100dvh\]{height:100dvh}.h-\[68vh\]{height:68vh}.h-\[calc\(100\%-1rem\)\]{height:calc(100% - 1rem)}.h-\[min\(780px\,84dvh\)\]{height:min(780px,84dvh)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-72{max-height:18rem}.max-h-80{max-height:20rem}.max-h-\[100dvh\]{max-height:100dvh}.max-h-\[24vh\]{max-height:24vh}.max-h-\[30vh\]{max-height:30vh}.max-h-\[34rem\]{max-height:34rem}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[52vh\]{max-height:52vh}.max-h-\[600px\]{max-height:600px}.max-h-\[62vh\]{max-height:62vh}.max-h-\[64vh\]{max-height:64vh}.max-h-\[70dvh\]{max-height:70dvh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[72vh\]{max-height:72vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[calc\(100dvh-1\.5rem\)\]{max-height:calc(100dvh - 1.5rem)}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-10{min-height:2.5rem}.min-h-11{min-height:2.75rem}.min-h-14{min-height:3.5rem}.min-h-40{min-height:10rem}.min-h-52{min-height:13rem}.min-h-64{min-height:16rem}.min-h-72{min-height:18rem}.min-h-\[209px\]{min-height:209px}.min-h-\[3\.25rem\]{min-height:3.25rem}.min-h-\[320px\]{min-height:320px}.min-h-\[34rem\]{min-height:34rem}.min-h-\[60vh\]{min-height:60vh}.min-h-dvh{min-height:100dvh}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:.125rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[1\.4rem\]{width:1.4rem}.w-\[min\(30rem\,calc\(100vw-2rem\)\)\]{width:min(30rem,100vw - 2rem)}.w-\[min\(92vw\,42rem\)\]{width:min(92vw,42rem)}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0}.min-w-28{min-width:7rem}.min-w-3\.5{min-width:.875rem}.min-w-32{min-width:8rem}.min-w-44{min-width:11rem}.min-w-full{min-width:100%}.min-w-max{min-width:max-content}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-48{max-width:12rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-64{max-width:16rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[1600px\]{max-width:1600px}.max-w-\[260px\]{max-width:260px}.max-w-\[960px\]{max-width:960px}.max-w-\[calc\(100\%_-_3rem\)\]{max-width:calc(100% - 3rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.basis-full{flex-basis:100%}.table-fixed{table-layout:fixed}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x:-100%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate:-90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes appear{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.animate-appear{animation:.2s cubic-bezier(.4,0,.2,1) appear}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[16px_minmax\(0\,1fr\)\]{grid-template-columns:16px minmax(0,1fr)}.grid-cols-\[72px_minmax\(0\,1fr\)\]{grid-template-columns:72px minmax(0,1fr)}.grid-cols-\[84px_minmax\(0\,1fr\)_auto\]{grid-template-columns:84px minmax(0,1fr) auto}.grid-rows-\[1fr\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-1{row-gap:.25rem}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.justify-self-start{justify-self:start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overscroll-contain{overscroll-behavior:contain}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[18px\]{border-radius:18px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-xl{border-radius:.75rem}.rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.border-blue-deep{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.border-blue-deep\/30{border-color:rgb(var(--blue-deep) / .3)}.border-blue-deep\/50{border-color:rgb(var(--blue-deep) / .5)}.border-blue-deep\/60{border-color:rgb(var(--blue-deep) / .6)}.border-blue\/25{border-color:rgb(var(--blue) / .25)}.border-blue\/30{border-color:rgb(var(--blue) / .3)}.border-blue\/35{border-color:rgb(var(--blue) / .35)}.border-blue\/40{border-color:rgb(var(--blue) / .4)}.border-blue\/45{border-color:rgb(var(--blue) / .45)}.border-blue\/50{border-color:rgb(var(--blue) / .5)}.border-blue\/60{border-color:rgb(var(--blue) / .6)}.border-err{--tw-border-opacity:1;border-color:rgb(var(--err) / var(--tw-border-opacity,1))}.border-err\/30{border-color:rgb(var(--err) / .3)}.border-err\/35{border-color:rgb(var(--err) / .35)}.border-err\/40{border-color:rgb(var(--err) / .4)}.border-err\/50{border-color:rgb(var(--err) / .5)}.border-err\/60{border-color:rgb(var(--err) / .6)}.border-gold\/25{border-color:rgb(var(--gold) / .25)}.border-gold\/30{border-color:rgb(var(--gold) / .3)}.border-gold\/40{border-color:rgb(var(--gold) / .4)}.border-line{--tw-border-opacity:1;border-color:rgb(var(--line) / var(--tw-border-opacity,1))}.border-line\/40{border-color:rgb(var(--line) / .4)}.border-line\/50{border-color:rgb(var(--line) / .5)}.border-line\/60{border-color:rgb(var(--line) / .6)}.border-line\/70{border-color:rgb(var(--line) / .7)}.border-line\/80{border-color:rgb(var(--line) / .8)}.border-ok{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.border-ok\/20{border-color:rgb(var(--ok) / .2)}.border-ok\/30{border-color:rgb(var(--ok) / .3)}.border-ok\/35{border-color:rgb(var(--ok) / .35)}.border-ok\/40{border-color:rgb(var(--ok) / .4)}.border-ok\/45{border-color:rgb(var(--ok) / .45)}.border-ok\/60{border-color:rgb(var(--ok) / .6)}.border-panel{--tw-border-opacity:1;border-color:rgb(var(--panel) / var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-warn\/30{border-color:rgb(var(--warn) / .3)}.border-warn\/35{border-color:rgb(var(--warn) / .35)}.border-warn\/40{border-color:rgb(var(--warn) / .4)}.border-warn\/50{border-color:rgb(var(--warn) / .5)}.border-t-blue{--tw-border-opacity:1;border-top-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.bg-bg{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.bg-bg\/25{background-color:rgb(var(--bg) / .25)}.bg-bg\/30{background-color:rgb(var(--bg) / .3)}.bg-bg\/35{background-color:rgb(var(--bg) / .35)}.bg-bg\/40{background-color:rgb(var(--bg) / .4)}.bg-bg\/50{background-color:rgb(var(--bg) / .5)}.bg-bg\/60{background-color:rgb(var(--bg) / .6)}.bg-bg\/70{background-color:rgb(var(--bg) / .7)}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/20{background-color:#0003}.bg-black\/40{background-color:#0006}.bg-blue{--tw-bg-opacity:1;background-color:rgb(var(--blue) / var(--tw-bg-opacity,1))}.bg-blue-deep{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.bg-blue-deep\/10{background-color:rgb(var(--blue-deep) / .1)}.bg-blue-deep\/20{background-color:rgb(var(--blue-deep) / .2)}.bg-blue-deep\/5{background-color:rgb(var(--blue-deep) / .05)}.bg-blue-sky{--tw-bg-opacity:1;background-color:rgb(var(--blue-sky) / var(--tw-bg-opacity,1))}.bg-blue\/10{background-color:rgb(var(--blue) / .1)}.bg-blue\/5{background-color:rgb(var(--blue) / .05)}.bg-conversation-user{--tw-bg-opacity:1;background-color:rgb(var(--conversation-user) / var(--tw-bg-opacity,1))}.bg-emerald-500{--tw-bg-opacity:1;background-color:rgb(16 185 129/var(--tw-bg-opacity,1))}.bg-engineer{--tw-bg-opacity:1;background-color:rgb(var(--role-engineer) / var(--tw-bg-opacity,1))}.bg-err{--tw-bg-opacity:1;background-color:rgb(var(--err) / var(--tw-bg-opacity,1))}.bg-err\/10{background-color:rgb(var(--err) / .1)}.bg-err\/5{background-color:rgb(var(--err) / .05)}.bg-gold{--tw-bg-opacity:1;background-color:rgb(var(--gold) / var(--tw-bg-opacity,1))}.bg-gold\/5{background-color:rgb(var(--gold) / .05)}.bg-gold\/80{background-color:rgb(var(--gold) / .8)}.bg-ink{--tw-bg-opacity:1;background-color:rgb(var(--ink) / var(--tw-bg-opacity,1))}.bg-ink-faint{--tw-bg-opacity:1;background-color:rgb(var(--ink-faint) / var(--tw-bg-opacity,1))}.bg-ink-faint\/40{background-color:rgb(var(--ink-faint) / .4)}.bg-ink-faint\/45{background-color:rgb(var(--ink-faint) / .45)}.bg-ink-faint\/50{background-color:rgb(var(--ink-faint) / .5)}.bg-ink-faint\/60{background-color:rgb(var(--ink-faint) / .6)}.bg-line{--tw-bg-opacity:1;background-color:rgb(var(--line) / var(--tw-bg-opacity,1))}.bg-line\/30{background-color:rgb(var(--line) / .3)}.bg-line\/40{background-color:rgb(var(--line) / .4)}.bg-line\/55{background-color:rgb(var(--line) / .55)}.bg-line\/60{background-color:rgb(var(--line) / .6)}.bg-line\/70{background-color:rgb(var(--line) / .7)}.bg-line\/80{background-color:rgb(var(--line) / .8)}.bg-ok{--tw-bg-opacity:1;background-color:rgb(var(--ok) / var(--tw-bg-opacity,1))}.bg-ok\/10{background-color:rgb(var(--ok) / .1)}.bg-ok\/15{background-color:rgb(var(--ok) / .15)}.bg-ok\/5{background-color:rgb(var(--ok) / .05)}.bg-panel{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.bg-panel-raised{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.bg-panel\/80{background-color:rgb(var(--panel) / .8)}.bg-panel\/85{background-color:rgb(var(--panel) / .85)}.bg-panel\/95{background-color:rgb(var(--panel) / .95)}.bg-surface{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.bg-surface\/50{background-color:rgb(var(--surface) / .5)}.bg-surface\/60{background-color:rgb(var(--surface) / .6)}.bg-transparent{background-color:#0000}.bg-warn{--tw-bg-opacity:1;background-color:rgb(var(--warn) / var(--tw-bg-opacity,1))}.bg-warn\/10{background-color:rgb(var(--warn) / .1)}.bg-warn\/5{background-color:rgb(var(--warn) / .05)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-white\/\[0\.03\]{background-color:#ffffff08}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-px{padding-top:1px;padding-bottom:1px}.pb-1{padding-bottom:.25rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-0\.5{padding-left:.125rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-3\.5{padding-left:.875rem}.pl-4{padding-left:1rem}.pl-5{padding-left:1.25rem}.pl-7{padding-left:1.75rem}.pl-\[1\.125rem\]{padding-left:1.125rem}.pr-10{padding-right:2.5rem}.pr-14{padding-right:3.5rem}.pr-3{padding-right:.75rem}.pr-\[4\.75rem\]{padding-right:4.75rem}.pt-0\.5{padding-top:.125rem}.pt-1\.5{padding-top:.375rem}.pt-10{padding-top:2.5rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-7{padding-top:1.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace}.font-sans{font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.leading-\[1\.625\]{line-height:1.625}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-\[-0\.01em\]{letter-spacing:-.01em}.tracking-\[0\.06em\]{letter-spacing:.06em}.tracking-\[0\.08em\]{letter-spacing:.08em}.tracking-\[0\.12em\]{letter-spacing:.12em}.tracking-\[0\.14em\]{letter-spacing:.14em}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.16em\]{letter-spacing:.16em}.tracking-\[0\.18em\]{letter-spacing:.18em}.tracking-normal{letter-spacing:0}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-bg{--tw-text-opacity:1;color:rgb(var(--bg) / var(--tw-text-opacity,1))}.text-blue{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.text-blue-sky{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.text-blue\/75{color:rgb(var(--blue) / .75)}.text-err{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.text-err\/80{color:rgb(var(--err) / .8)}.text-gold{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.text-ink{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.text-ink-dim{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.text-ink-faint{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.text-manager{--tw-text-opacity:1;color:rgb(var(--role-manager) / var(--tw-text-opacity,1))}.text-ok{--tw-text-opacity:1;color:rgb(var(--ok) / var(--tw-text-opacity,1))}.text-surface{--tw-text-opacity:1;color:rgb(var(--surface) / var(--tw-text-opacity,1))}.text-warn{--tw-text-opacity:1;color:rgb(var(--warn) / var(--tw-text-opacity,1))}.text-warn\/80{color:rgb(var(--warn) / .8)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-blue\/35{-webkit-text-decoration-color:rgb(var(--blue) / .35);text-decoration-color:rgb(var(--blue) / .35)}.decoration-line{-webkit-text-decoration-color:rgb(var(--line) / 1);text-decoration-color:rgb(var(--line) / 1)}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.accent-blue{accent-color:rgb(var(--blue) / 1)}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-\[0_10px_24px_-20px_rgb\(0_0_0\/0\.2\)\]{--tw-shadow:0 10px 24px -20px #0003;--tw-shadow-colored:0 10px 24px -20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-glow{--tw-shadow:0 16px 44px #00000057;--tw-shadow-colored:0 16px 44px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-4{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-bg{--tw-ring-opacity:1;--tw-ring-color:rgb(var(--bg) / var(--tw-ring-opacity,1))}.ring-err\/30{--tw-ring-color:rgb(var(--err) / .3)}.ring-line\/35{--tw-ring-color:rgb(var(--line) / .35)}.ring-manager\/60{--tw-ring-color:rgb(var(--role-manager) / .6)}.ring-ok\/30{--tw-ring-color:rgb(var(--ok) / .3)}.ring-offset-1{--tw-ring-offset-width:1px}.ring-offset-panel{--tw-ring-offset-color:rgb(var(--panel) / 1)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\!filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\,transform\,visibility\]{transition-property:width,transform,visibility;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-shadow{transition-property:box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-500{transition-duration:.5s}.duration-panel{transition-duration:.22s}.ease-panel{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes prompt-optimizer-enter{0%{opacity:0;transform:translateY(8px)scale(.992)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes livePulse{0%,to{box-shadow:0 0 0 0 rgb(var(--green) / .25)}50%{box-shadow:0 0 0 5px rgb(var(--green) / 0)}}@keyframes blink{50%{opacity:.35}}@keyframes skeleton{to{background-position:-120% 0}}@keyframes popoverIn{0%{opacity:0;transform:translateY(-5px)scale(.985)}to{opacity:1;transform:translateY(0)scale(1)}}.integrated-workbench .literature-v2__sidebar .search-field{width:calc(100% - 24px);min-width:0;max-width:none}.integrated-workbench .literature-v2__main{border:1px solid rgb(var(--border));background:rgb(var(--surface));box-shadow:var(--shadow-1);border-radius:16px;padding:16px;overflow:hidden}.integrated-workbench .literature-list-header{border-bottom:1px solid rgb(var(--border));min-height:0;margin-bottom:14px;padding-bottom:14px}.integrated-workbench .paper-grid{gap:14px}.integrated-workbench button.paper-card{border-color:rgb(var(--border-strong));background:rgb(var(--surface-2) / .42);width:100%;min-width:0;min-height:242px;box-shadow:none;padding:17px;overflow:hidden}.integrated-workbench .paper-card__meta{flex-wrap:wrap;align-items:flex-start;min-width:0}.integrated-workbench .paper-card__year{text-overflow:ellipsis;white-space:nowrap;min-width:0;margin-left:auto;overflow:hidden}.integrated-workbench .paper-card__footer{min-width:0}.integrated-workbench .paper-card__footer>span{white-space:nowrap;flex:none}.integrated-workbench .release-module>header .badge{flex-shrink:0}@container (width<=700px){.integrated-workbench .literature-v2__main{padding:12px}.integrated-workbench .literature-list-header{margin-bottom:12px;padding-bottom:12px}.integrated-workbench button.paper-card{min-height:0;padding:15px}}.overview-hero--plain{grid-template-columns:1fr}.overview-hero--plain .overview-hero__copy h1{margin-top:0}.overview-hero--plain .overview-hero__copy p{-webkit-line-clamp:unset;max-width:none;font-size:14px;line-height:1.7;display:block}.overview-hero--plain .overview-hero__copy>code{text-overflow:ellipsis;white-space:nowrap;font-size:11px;display:block;overflow:hidden}.placeholder\:text-ink-faint::placeholder{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}.last\:border-0:last-child{border-width:0}.last\:border-b-0:last-child{border-bottom-width:0}.last\:pb-0:last-child{padding-bottom:0}.focus-within\:border-blue\/60:focus-within{border-color:rgb(var(--blue) / .6)}.hover\:border-blue:hover{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.hover\:border-blue-deep:hover{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.hover\:border-blue-sky\/60:hover{border-color:rgb(var(--blue-sky) / .6)}.hover\:border-blue\/40:hover{border-color:rgb(var(--blue) / .4)}.hover\:border-blue\/45:hover{border-color:rgb(var(--blue) / .45)}.hover\:border-blue\/50:hover{border-color:rgb(var(--blue) / .5)}.hover\:border-blue\/60:hover{border-color:rgb(var(--blue) / .6)}.hover\:border-err\/50:hover{border-color:rgb(var(--err) / .5)}.hover\:border-ink-faint:hover{--tw-border-opacity:1;border-color:rgb(var(--ink-faint) / var(--tw-border-opacity,1))}.hover\:border-line\/70:hover{border-color:rgb(var(--line) / .7)}.hover\:border-ok:hover{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.hover\:bg-bg:hover{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.hover\:bg-bg\/30:hover{background-color:rgb(var(--bg) / .3)}.hover\:bg-bg\/60:hover{background-color:rgb(var(--bg) / .6)}.hover\:bg-bg\/70:hover{background-color:rgb(var(--bg) / .7)}.hover\:bg-blue-deep:hover{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.hover\:bg-blue-deep\/20:hover{background-color:rgb(var(--blue-deep) / .2)}.hover\:bg-blue-deep\/80:hover{background-color:rgb(var(--blue-deep) / .8)}.hover\:bg-blue\/10:hover{background-color:rgb(var(--blue) / .1)}.hover\:bg-blue\/15:hover{background-color:rgb(var(--blue) / .15)}.hover\:bg-err\/10:hover{background-color:rgb(var(--err) / .1)}.hover\:bg-line\/20:hover{background-color:rgb(var(--line) / .2)}.hover\:bg-ok\/10:hover{background-color:rgb(var(--ok) / .1)}.hover\:bg-ok\/15:hover{background-color:rgb(var(--ok) / .15)}.hover\:bg-panel:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.hover\:bg-panel-raised:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.hover\:bg-panel\/60:hover{background-color:rgb(var(--panel) / .6)}.hover\:bg-panel\/80:hover{background-color:rgb(var(--panel) / .8)}.hover\:bg-surface:hover{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.hover\:bg-warn\/10:hover{background-color:rgb(var(--warn) / .1)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-blue:hover{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.hover\:text-blue-sky:hover{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.hover\:text-err:hover{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.hover\:text-gold:hover{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.hover\:text-gold-soft:hover{--tw-text-opacity:1;color:rgb(var(--gold-soft) / var(--tw-text-opacity,1))}.hover\:text-ink:hover{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.hover\:text-ink-dim:hover{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-blue:hover{-webkit-text-decoration-color:rgb(var(--blue) / 1);text-decoration-color:rgb(var(--blue) / 1)}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.focus\:border-blue:focus{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.focus\:border-blue-deep:focus{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.focus\:border-blue\/60:focus,.focus-visible\:border-blue\/60:focus-visible{border-color:rgb(var(--blue) / .6)}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-blue:focus-visible{outline-color:rgb(var(--blue) / 1)}.focus-visible\:outline-blue-sky:focus-visible{outline-color:rgb(var(--blue-sky) / 1)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-blue-sky\/50:focus-visible{--tw-ring-color:rgb(var(--blue-sky) / .5)}.focus-visible\:ring-blue\/50:focus-visible{--tw-ring-color:rgb(var(--blue) / .5)}.active\:bg-panel-raised:active{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.enabled\:hover\:text-blue-sky:hover:enabled{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.enabled\:focus-visible\:underline:focus-visible:enabled{text-decoration-line:underline}.enabled\:focus-visible\:outline-none:focus-visible:enabled{outline-offset:2px;outline:2px solid #0000}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-35:disabled{opacity:.35}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-45:disabled{opacity:.45}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group:focus-within .group-focus-within\:opacity-100{opacity:1}.group:hover .group-hover\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}.group:hover .group-hover\:bg-ink-faint\/30{background-color:rgb(var(--ink-faint) / .3)}.group:hover .group-hover\:opacity-100{opacity:1}.group:focus .group-focus\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}@media (prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media (width>=640px){.sm\:left-auto{left:auto}.sm\:order-none{order:0}.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mx-8{margin-left:2rem;margin-right:2rem}.sm\:inline{display:inline}.sm\:h-20{height:5rem}.sm\:max-h-\[88dvh\]{max-height:88dvh}.sm\:w-20{width:5rem}.sm\:w-auto{width:auto}.sm\:max-w-48{max-width:12rem}.sm\:max-w-\[82\%\]{max-width:82%}.sm\:max-w-md{max-width:28rem}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-\[100px_minmax\(0\,1fr\)\]{grid-template-columns:100px minmax(0,1fr)}.sm\:grid-cols-\[minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) auto}.sm\:grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.sm\:flex-nowrap{flex-wrap:nowrap}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-5{padding:1.25rem}.sm\:p-6{padding:1.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-5{padding-left:1.25rem;padding-right:1.25rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:px-8{padding-left:2rem;padding-right:2rem}.sm\:pt-14{padding-top:3.5rem}.sm\:text-right{text-align:right}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:opacity-0{opacity:0}.group:focus-within .sm\:group-focus-within\:opacity-100,.group:hover .sm\:group-hover\:opacity-100{opacity:1}}@media (width>=768px){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-80{width:20rem}.md\:shrink-0{flex-shrink:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:border-r{border-right-width:1px}.md\:border-line\/60{border-color:rgb(var(--line) / .6)}}@media (width>=1024px){.lg\:visible{visibility:visible}.lg\:static{position:static}.lg\:z-auto{z-index:auto}.lg\:col-span-2{grid-column:span 2/span 2}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:min-h-0{min-height:0}.lg\:w-\[var\(--preview-width\)\]{width:var(--preview-width)}.lg\:w-\[var\(--sidebar-width\,256px\)\]{width:var(--sidebar-width,256px)}.lg\:max-w-\[61\.8vw\]{max-width:61.8vw}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-\[280px_minmax\(0\,1fr\)\]{grid-template-columns:280px minmax(0,1fr)}.lg\:grid-cols-\[minmax\(0\,1\.15fr\)_minmax\(260px\,0\.85fr\)\]{grid-template-columns:minmax(0,1.15fr) minmax(260px,.85fr)}.lg\:grid-cols-\[minmax\(0\,1\.4fr\)_minmax\(300px\,0\.8fr\)\]{grid-template-columns:minmax(0,1.4fr) minmax(300px,.8fr)}.lg\:grid-cols-\[minmax\(15rem\,0\.72fr\)_minmax\(0\,1\.8fr\)\]{grid-template-columns:minmax(15rem,.72fr) minmax(0,1.8fr)}.lg\:gap-3{gap:.75rem}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:border-b-0{border-bottom-width:0}.lg\:border-r{border-right-width:1px}}@media (width>=1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,1fr\)_minmax\(18rem\,0\.85fr\)\]{grid-template-columns:minmax(0,1fr) minmax(18rem,.85fr)}.xl\:border-b-0{border-bottom-width:0}.xl\:border-r{border-right-width:1px}}.\[\&\>section\>div\>button\:first-child\]\:px-3>section>div>button:first-child{padding-left:.75rem;padding-right:.75rem}.\[\&\>section\]\:mx-2>section{margin-left:.5rem;margin-right:.5rem}.\[\&\>section\]\:border-0>section{border-width:0}.\[\&\>section\]\:py-0>section{padding-top:0;padding-bottom:0} diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-Cf8TK3Lj.js b/frontend/web/dist/assets/ResearchWorkbenchPanel-Cf8TK3Lj.js new file mode 100644 index 000000000..f916ecbc9 --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-Cf8TK3Lj.js @@ -0,0 +1,12 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i,n as a}from"./query-CUzIxVzm.js";import{C as o,F as s,H as c,I as l,L as u,O as d,U as f,k as p}from"./index-DbdG0NfU.js";import{A as m,C as h,F as g,I as _,L as v,M as y,O as b,R as x,S,_ as C,b as w,n as T,s as E,w as D,x as O}from"./AppearanceControls-vjVM_spw.js";import{n as k,t as A}from"./code-xml-DMjjpBic.js";import{n as j,t as M}from"./play-utjdE9zp.js";import{a as ee,i as N}from"./useWorkbenchTheme-CXN9ftdE.js";import{At as te,Dt as ne,Mt as re,Nt as P,Tt as F,W as ie,_ as ae,_t as oe,bt as se,g as ce,h as le,ht as ue,m as de,mt as fe,pt as pe,r as me,v as he,xt as ge,y as _e,yt as ve}from"./App-d69nDaHg.js";var ye=x(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),be=x(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),xe=x(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Se=x(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Ce=x(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),we=x(`FlaskConical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Te=x(`FolderKanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),Ee=x(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),De=x(`LockKeyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Oe=x(`Radio`,[[`path`,{d:`M4.9 19.1C1 15.2 1 8.8 4.9 4.9`,key:`1vaf9d`}],[`path`,{d:`M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5`,key:`u1ii0m`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5`,key:`1j5fej`}],[`path`,{d:`M19.1 4.9C23 8.8 23 15.1 19.1 19`,key:`10b0cb`}]]),ke=x(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ae=x(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),je=x(`UserRound`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Me=x(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),I=e(t(),1),Ne=12e3;function L(e=!1){let t={...s()};return e&&(t[`Content-Type`]=`application/json`),t}async function R(e,t={}){await u();let n={...t,headers:{...L(!!t.body),...t.headers??{}},cache:`no-store`},r=String(t.method??`GET`).toUpperCase(),i=async n=>{if(!n.ok){let r=await n.text().catch(()=>``),i=r;try{i=JSON.parse(r).detail??r}catch{}throw Error(i||`${t.method??`GET`} ${e} failed (${n.status})`)}return await n.json()};return r===`GET`?c(e,n,Ne,i):i(await fetch(e,n))}var z=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`,Pe=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`;function Fe(e){let t=e.replaceAll(`\r +`,` +`).split(` + +`),n=t.pop()??``,r=[];return t.forEach(e=>{e.split(` +`).forEach(e=>{if(e.startsWith(`data:`))try{let t=JSON.parse(e.slice(5).trim());r.push(t)}catch{}})}),{frames:r,rest:n}}function Ie(e,t){let n=String(e.type??``);if(n===`phase`)t.onPhase?.(String(e.label??``),String(e.role??`manager`),String(e.detail??``),e.heartbeat===!0);else if(n===`delta`)t.onDelta?.(String(e.text??``),String(e.fragment_mode??`auto`));else if(n===`done`){let n=e.result??{};return t.onDone?.(n),n}else if(n===`error`)throw Error(String(e.error??`Manager stream failed`));return null}var B={timelineExample:()=>R(`/api/research/timeline/example`),timelineEstimate:(e,t)=>R(`/api/research/timeline/estimate`,{method:`POST`,body:JSON.stringify(e),signal:t}),timelineLatest:e=>R(z(e,`/research/timeline`)),timelineSave:(e,t,n,r)=>R(z(e,`/research/timeline`),{method:`POST`,body:JSON.stringify({input:t,expected_version:n,reason:r})}),projects:e=>R(`/api/projects`,{signal:e}),snapshot:(e,t)=>R(z(e,`/snapshot?events_limit=40&compact=false`),{signal:t}),status:(e,t)=>R(z(e,`/status`),{signal:t}),events:(e,t=180,n)=>R(z(e,`/events?limit=${t}&view=ui`),{signal:n}).then(e=>e.events),transcript:(e,t=100,n)=>R(z(e,`/transcript?n=${t}`),{signal:n}).then(e=>e.turns),journal:(e,t=80,n)=>R(z(e,`/journal?n=${t}`),{signal:n}).then(e=>e.journal),artifacts:(e,t)=>R(z(e,`/artifacts`),{signal:t}).then(e=>e.artifacts),counterexamples:(e,t)=>R(z(e,`/counterexamples`),{signal:t}),artifact:(e,t,n)=>R(z(e,`/artifact?${new URLSearchParams({path:t})}`),{signal:n}),artifactBlob:async(e,t,n=!1,r)=>{await u();let i=new URLSearchParams({path:t});n&&i.set(`download`,`true`);let a=z(e,`/artifact/raw?${i}`);return c(a,{headers:L(),signal:r,cache:`no-store`},Ne,async e=>{if(!e.ok)throw Error(`Artifact unavailable (${e.status})`);return e.blob()})},gitDiff:(e,t)=>R(z(e,`/git-diff`),{signal:t}),rewritePrompt:(e,t,n)=>R(z(e,`/prompt/rewrite`),{method:`POST`,body:JSON.stringify({text:t}),signal:n}),note:(e,t)=>R(z(e,`/note`),{method:`POST`,body:JSON.stringify({text:t})}),uploadAttachments:async(e,t,n)=>{await u();let r=new FormData;t.forEach(e=>r.append(`files`,e,e.name));let i=await fetch(z(e,`/attachments`),{method:`POST`,headers:L(),body:r,signal:n});if(!i.ok)throw Error(await i.text()||`attachment upload failed (${i.status})`);return await i.json()},createDaemon:(e,t=``,n=``)=>R(`/api/daemons`,{method:`POST`,body:JSON.stringify({objective:e,name:t,workdir:n,command_id:Pe()})}),createFinalReview:(e,t)=>R(z(e,`/reviews/final`),{method:`POST`,body:JSON.stringify(t)}),startDaemon:(e,t)=>R(z(e,`/daemon/start`),{method:`POST`,body:JSON.stringify({command_id:Pe(),expected_revision:t})}).then(f),stopDaemon:(e,t,n)=>R(z(e,`/daemon/stop`),{method:`POST`,body:JSON.stringify({drain:t,command_id:Pe(),expected_revision:n})}).then(f),async messageStream(e,t,n={},r,i=[]){await u();let a=z(e,`/message/stream`),o=await fetch(a,{method:`POST`,headers:L(!0),body:JSON.stringify(i.length?{text:t,attachments:i}:{text:t}),signal:r});if(!o.ok){let e=await o.text().catch(()=>``);throw Error(e||`Manager request failed (${o.status})`)}if(!o.body)throw Error(`Manager returned an empty stream`);let s=o.body.getReader(),c=new TextDecoder,l=``,d={};for(;;){let e=await s.read();if(e.done)break;l+=c.decode(e.value,{stream:!0});let t=Fe(l);l=t.rest,t.frames.forEach(e=>{let t=Ie(e,n);t&&(d=t)})}return Fe(`${l}\n\n`).frames.forEach(e=>{let t=Ie(e,n);t&&(d=t)}),d}};function Le(e,t,n){let r=!1,i=null,a,o=800,s=()=>{if(r)return;let c=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({replay:`40`,view:`ui`}),d=l();d&&u.set(`token`,d),i=new WebSocket(`${c}//${window.location.host}${z(e,`/stream`)}?${u}`),i.onopen=()=>{o=800,n(!0)},i.onmessage=e=>{try{t(JSON.parse(String(e.data)))}catch{}},i.onerror=()=>i?.close(),i.onclose=e=>{n(!1),!(r||e.code===4401||e.code===4404)&&(a=window.setTimeout(s,o),o=Math.min(o*1.7,8e3))}};return s(),{close:()=>{r=!0,a&&window.clearTimeout(a),i?.close()}}}var Re={active:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],running:[`进行中`,`In progress`],working:[`进行中`,`In progress`],pending:[`等待中`,`Waiting`],queued:[`等待中`,`Waiting`],waiting:[`等待中`,`Waiting`],idle:[`等待中`,`Waiting`],accepted:[`已完成`,`Completed`],complete:[`已完成`,`Completed`],completed:[`已完成`,`Completed`],done:[`已完成`,`Completed`],success:[`已完成`,`Completed`],blocked:[`已阻塞`,`Blocked`],failed:[`失败`,`Failed`],error:[`失败`,`Failed`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],replan_requested:[`需要重新规划`,`Needs replanning`],incomplete:[`尚未完成`,`Incomplete`],research_incomplete:[`研究尚未完成`,`Research incomplete`],paused_no_breakthrough:[`暂未取得突破,已暂停`,`Paused without a breakthrough`],exhausted_current_methods:[`当前方法已尝试完`,`Current methods exhausted`],no_progress:[`暂无新进展,已暂停`,`Paused without new progress`],max_rounds:[`已到本次轮次上限`,`Round limit reached`],infra_blocked:[`等待运行条件恢复`,`Waiting for the runtime to recover`],supervisor_error:[`执行异常`,`Execution failed`],skipped:[`已跳过`,`Skipped`],paused:[`已暂停`,`Paused`],paused_cost:[`费用待对账`,`Awaiting usage reconciliation`],stopped:[`已暂停`,`Paused`],cancelled:[`已暂停`,`Paused`],aborted:[`已暂停`,`Paused`],not_started:[`等待中`,`Waiting`],healthy:[`状态正常`,`Healthy`],degraded:[`部分受限`,`Limited`]},ze={system:[`Argus`,`Argus`],operator:[`你`,`You`],stopped:[`已暂停`,`Paused`],idle:[`等待中`,`Waiting`]};function Be(e,t,n,r){let i=t[String(e??``).toLowerCase()]??n;return r(i[0],i[1])}function Ve(e,t){return String(e??``).startsWith(`paused_`)&&!Re[String(e)]?t(`已暂停`,`Paused`):Be(e,Re,[`状态已更新`,`Status updated`],t)}function V(e,t){let n=String(e??``).toLowerCase();return D(n)?h(n,e=>t(d(e,{},`zh-CN`),d(e,{},`en`))):Be(e,ze,[`Argus`,`Argus`],t)}function H(){let{locale:e,t}=p();return{locale:e,text:(0,I.useCallback)((t,n)=>e===`zh-CN`?t:n,[e]),t}}function He(...e){return e.filter(Boolean).join(` `)}function Ue(e){let t=Math.max(0,Math.floor(Number(e??0)));if(t<60)return`${t}s`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n?`${n}d ${r}h`:r?`${r}h ${i}m`:`${i}m`}function We(e,t){return e?new Date(e*1e3).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):`—`}function Ge(e){let t=String(e??``).toLowerCase();return/failed|error|blocked|rejected|stalled|dead|abort/.test(t)?`danger`:/warn|waiting|paused|hold|queued|pending|continue/.test(t)?`warn`:/done|complete|completed|accepted|healthy|success|passed/.test(t)?`success`:/run|active|work|claimed|progress|live/.test(t)?`live`:/research|plan|info|ready/.test(t)?`info`:`neutral`}function Ke(e){let t=String(e.agent_layer??e.actor??``).toLowerCase();if(t===`main`||t.startsWith(`engineer`))return`engineer`;if(t.startsWith(`review`))return`reviewer`;if(t.startsWith(`plan`))return`planner`;if(t.startsWith(`manager`))return`manager`;let n=String(e.type??``);return/review/.test(n)?`reviewer`:/planner/.test(n)?`planner`:/manager/.test(n)?`manager`:/engineer|round/.test(n)?`engineer`:`system`}function qe(e,t){let n=String(e.action_summary??``).trim();if(n)return t?_e(n,t):n;let r=String(e.title??``).trim();if(r)return t?_e(r,t):r;let i=t?ae(String(e.type??``),t):null;if(i)return i;let a=String(e.kind??``).trim();return a?a.replaceAll(`_`,` `):String(e.type??`event`).split(`.`).slice(-2).join(` · `).replaceAll(`_`,` `)}function Je(e,t=400){let n=String(e.text??e.reason??e.summary??e.detail??``).trim();return n?n.length>t?`${n.slice(0,t)}…`:n:``}var U=n();function W({children:e,tone:t=`neutral`,dot:n=!1,className:r}){return(0,U.jsxs)(`span`,{className:He(`badge`,`badge--${t}`,r),children:[n?(0,U.jsx)(`span`,{className:He(`badge__dot`,t===`live`&&`is-pulsing`)}):null,e]})}function G({icon:e=Se,title:t,description:n,action:r}){return(0,U.jsxs)(`div`,{className:`empty-state`,children:[(0,U.jsx)(`span`,{className:`empty-state__icon`,children:(0,U.jsx)(e,{size:19})}),(0,U.jsx)(`div`,{className:`empty-state__title`,children:t}),n?(0,U.jsx)(`p`,{children:n}):null,r?(0,U.jsx)(`div`,{className:`empty-state__action`,children:r}):null]})}function Ye({label:e}){let{text:t}=H();return(0,U.jsxs)(`span`,{className:`spinner`,role:`status`,children:[(0,U.jsx)(F,{size:15,className:`spin`}),` `,e||t(`加载中`,`Loading`)]})}function Xe({events:e,limit:t=24,empty:n,dense:r=!1}){let{locale:i,text:a}=H(),o=e.slice(-t).reverse();return o.length?(0,U.jsx)(`div`,{className:He(`event-list`,r&&`event-list--dense`),children:o.map((e,t)=>{let n=Ke(e),o=qe(e,i),s=ce(Je(e,r?180:480),i).text,c=Ge(String(e.status??e.kind??e.type??``));return(0,U.jsxs)(`article`,{className:`event-row`,children:[(0,U.jsx)(`div`,{className:He(`event-row__marker`,`event-row__marker--${c}`)}),(0,U.jsxs)(`div`,{className:`event-row__content`,children:[(0,U.jsxs)(`div`,{className:`event-row__meta`,children:[(0,U.jsx)(`span`,{className:`role-label`,style:{color:O(n)},children:V(n,a)}),(0,U.jsx)(`time`,{children:We(e.ts,i)})]}),(0,U.jsx)(`div`,{className:`event-row__title`,children:o}),s?(0,U.jsx)(`div`,{className:`event-row__detail`,children:s}):null]})]},`${e.type}-${e.ts}-${e.message_id??t}`)})}):(0,U.jsx)(G,{icon:Oe,title:n||a(`还没有可展示的实时动态`,`No activity to show yet`)})}var Ze=new Set([`done`,`completed`,`accepted`,`success`]),Qe=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]),$e=/continue|replan|reject|blocked|fail|error|incomplete|revoked/,et=new Set([`assistant_message`,`agent_message`,`message`]),tt=new Set([`life.planner.task_added`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.phase.started`,`life.manager.stage_decision`,`round.start`,`round.main.completed`,`round.review.started`,`round.review.completed`,`round.review.deferred`,`round.backend_failure.backoff`,`work.segment`,`work.segment.started`,`work.segment.completed`]);function nt(e){let t=String(e.type??``),n=String(e.kind??``);return n!==`reasoning`&&!o(e)&&(tt.has(t)||t===`engineer.progress`&&(et.has(n)||[`tool_use`,`tool_result`,`command_execution`,`file_change`].includes(n)))}function rt(e){return e.type!==`engineer.progress`||!et.has(String(e.kind??``))?e:{...e,text:ie(String(e.text??``)),action_summary:ie(String(e.action_summary??``)),title:ie(String(e.title??``))}}function it(e,t){return t?e.backlog.find(e=>e.id===t)??null:e.backlog.find(e=>Qe.has(e.status))??e.backlog.find(e=>e.status===`pending`)??e.backlog.at(-1)??null}function K(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function at(e,t,n=Date.now()/1e3,r=`zh-CN`){let i=(e,t)=>r===`zh-CN`?e:t,a=e.mission_view,o=pe(e,a,t,n),s=it(e,o.taskId||a?.mission.id||``),c=s?.id||a?.mission.id||``,l=!!(c&&c===a?.mission.id),u=a?.dag?.length?a.dag:e.backlog,d=u.filter(e=>Ze.has(e.status)).length,f=u.filter(e=>/^(pending|queued|waiting)$/.test(e.status)).length,p=!!(a?.routing?.open_ended||a?.routing?.lifetime===`standing`||e.continuous?.open_ended),m=K(s?.started_ts)??(l?K(a?.mission.started_at):null),h=K(s?.finished_ts)??(l?K(a?.mission.completed_at):null),g=e.backlog.filter(e=>Qe.has(e.status)).length>1,_=t.filter(e=>{if(!c||m!==null&&Number(e.ts??0)Number(e.ts??0)-Number(t.ts??0)),v=_.filter(nt).map(rt).filter(e=>!et.has(String(e.kind??``))||!!(e.text||e.action_summary||e.title)),y=v.at(-1),b=o.state===`running`,x=h??(e.daemon.alive?n:K(_.at(-1)?.ts)??m),S=m===null||x===null?null:Math.max(0,x-m),C=[..._].reverse().find(e=>fe(e)===c&&e.type===`round.start`),w=Math.max(l?Number(a?.round.current??0):0,Number(C?.round_index??0)),T=[..._].reverse().find(e=>fe(e)===c&&e.type===`round.start`&&Number(e.round_index)===w),E=_.filter(e=>{if(fe(e)!==c||w<=0||T&&Number(e.ts??0)0?t===w:T!=null&&Number(e.ts??0)>=Number(T.ts??0)}),D=[...E].reverse().find(e=>e.type===`round.review.completed`),O=[...E].reverse().find(e=>e.type===`round.review.started`),k=!!(O&&(!D||Number(O.ts)>Number(D.ts))),A=b&&o.role===`reviewer`&&k,j=k?void 0:D,M=String(j?.status??``).toLowerCase(),ee=l?String(a?.review.status??``).toLowerCase():``,N=j?.review_skipped===!0||M===`skipped`,te=j?.review_source===`engineer_self_review`,ne=!j?.review_source||j.review_source===`reviewer`,re=!N&&ne&&M===`done`,P=!N&&($e.test(M)||!j&&!A&&$e.test(ee)),F=A?`running`:N?`skipped`:re?`passed`:te&&M===`done`?`self_checked`:P?`needs_work`:`pending`,ie={pending:i(`结论待核对`,`Conclusion awaiting review`),running:i(`正在核对证据`,`Checking the evidence`),passed:i(`本轮工作通过核对`,`This round passed review`),needs_work:i(`仍需补充或修改`,`More work is needed`),skipped:i(`本轮未做审查`,`This round was not reviewed`),self_checked:i(`执行者已自查,待独立核对`,`Self-checked; independent review pending`)},ae={pending:i(`尚无能对应到当前工作项和轮次的通过记录。`,`No passing review is linked to the current work item and round.`),running:i(`审阅者正在核对本轮结果及其证据。`,`The Reviewer is checking this round’s results and evidence.`),passed:i(`通过记录仅适用于本轮提交的工作与证据。`,`The passing verdict applies to the work and evidence submitted in this round.`),needs_work:i(`审查发现仍有待处理的问题,需要继续工作。`,`The review found issues that require further work.`),skipped:i(`执行结束并不代表证据已经通过核对。`,`The end of execution does not establish that the evidence passed review.`),self_checked:i(`这条记录来自执行者自查,尚无本轮独立审查通过记录。`,`This record is a self-check by the worker; no independent passing review is recorded for this round.`)},oe={state:F,label:ie[F],detail:String(j?.reason||P&&a?.review.reason||ae[F]),scope:i(`当前工作项${w>0?` · 第 ${w} 轮`:``}。整体目标是否成立,仍须核对其完整验收条件。`,`Current work item${w>0?` · Round ${w}`:``}. The overall goal still requires checking its full acceptance criteria.`)},se=[...E].reverse().find(e=>e.type===`round.main.completed`),ce=F===`passed`?`done`:F===`running`?`active`:F===`needs_work`?`blocked`:`pending`,le=[{id:`plan`,label:i(`工作项已记录`,`Work item recorded`),detail:s?.title||a?.mission.title||i(`等待任务`,`Waiting for a task`),status:s||l?`done`:`pending`},{id:`start`,label:i(`开始执行`,`Execution started`),detail:m===null?i(`尚无启动记录`,`No start is recorded`):i(`有任务启动时间记录`,`A task start time is recorded`),status:m===null?`pending`:`done`},{id:`handoff`,label:i(`本轮执行已结束`,`Round execution ended`),detail:se?i(`已记录本轮执行结束,结果是否可用仍需核对`,`The round’s execution ended; its results still need to be checked`):i(`尚无本轮执行结束记录`,`No end of execution is recorded for this round`),status:se?`done`:b&&o.role===`engineer`?`active`:`pending`},{id:`review`,label:i(`核对本轮证据`,`Check this round’s evidence`),detail:oe.label,status:ce}],de=!!(s&&Ze.has(s.status))||l&&[`complete`,`completed`,`done`].includes(a?.mission.status??``),me=e.daemon.alive?p?i(`开放研究的剩余工作量尚不确定,无法可靠预计整体完成时间。`,`Open research has no known remaining workload, so its overall finish time cannot be reliably estimated.`):P?i(`审查要求继续补充或调整工作范围,暂无法预计完成时间。`,`Review requires further work or a scope change; a finish time is unavailable.`):de?i(`当前工作项已结束;这不提供整体目标的完成时间。`,`The current work item has ended; this does not establish when the overall goal will be reached.`):i(`当前记录没有可比较的固定工作量基线,暂无法可靠预计完成时间。`,`The current records contain no comparable, fixed-workload baseline for a reliable finish-time estimate.`):i(`运行已停止,无法预计完成时间。`,`Execution has stopped; a finish time is unavailable.`);return{workCompletion:u.length?d/u.length:null,workScope:i(`仅统计已记录的工作项;清单可随研究增减,完成比例不代表整体目标已成立。`,`Counts recorded work items only. The list can change during research; its completion fraction does not establish the overall goal.`),currentTask:s?.title||a?.mission.title||i(`等待新任务`,`Waiting for a new task`),currentTaskId:c,currentObjective:s?.objective||(l?a?.mission.objective:``)||``,currentStep:b&&y?qe(y,r):ue(o,r),currentDetail:y?Je(y,700):s?.objective||``,currentEvent:y??null,runtime:o,elapsedSeconds:S,etaUnavailableReason:me,checkpoints:le,completedTasks:d,totalTasks:u.length,pendingTasks:f,openEnded:p,review:oe,acceptanceCriteria:s?.acceptance_check||u.find(e=>e.id===c)?.acceptance_check||``,nextAction:s?.pending_question||String(j?.next_action||``),taskEvents:v}}var ot=new Set([`done`,`completed`,`accepted`,`success`]),st=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]);function ct(e){let{locale:t,text:n,t:r}=H(),[i,a]=(0,I.useState)(()=>Date.now()/1e3),[o,s]=(0,I.useState)(``);(0,I.useEffect)(()=>{if(!e.active||!e.snapshot.daemon.alive)return;a(Date.now()/1e3);let t=window.setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(t)},[e.active,e.snapshot.daemon.alive]);let c=(0,I.useMemo)(()=>at(e.snapshot,e.events,i,t),[t,i,e.events,e.snapshot]),l=e.snapshot.mission_view,u=l?.dag?.length?l.dag:e.snapshot.backlog.map(e=>({id:e.id,title:e.title,objective:e.objective,status:e.status,deps:e.deps??[],branch_id:e.id,parent_branch_id:``})),d=u.find(e=>e.id===o)??u.find(e=>e.id===c.currentTaskId),f=he(l?.stage.id,t),p=l?.stage.label&&l.stage.label!==l.stage.id?l.stage.label:f||l?.stage.id||n(`尚未记录`,`Not yet recorded`),h=c.runtime.state===`running`,g=ue(c.runtime,t),b=c.taskEvents.filter(e=>String(e.kind??``)!==`reasoning`&&!le(String(e.type??``))),x=ce(c.currentDetail,t),C=c.currentEvent?de(c.currentEvent,t):null,T=ce(c.review.detail,t),D=[{label:n(`已完成的工作`,`Completed work`),items:u.filter(e=>ot.has(e.status))},{label:n(`进行中与待处理`,`Active and remaining work`),items:u.filter(e=>!ot.has(e.status))}],k=async t=>{let r=t?n(`确认完成当前步骤后停止 Argus?`,`Stop Argus after the current step finishes?`):n(`确认立即停止 Argus?当前步骤可能被中断。`,`Stop Argus now? The current step may be interrupted.`);confirm(r)&&await e.controls.stop(t)};return(0,U.jsxs)(`div`,{className:`ros-page experiment-v3`,children:[(0,U.jsxs)(`header`,{className:`ros-page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{children:n(`任务进展`,`Work progress`)}),(0,U.jsx)(`p`,{children:n(`看清做了哪些工作、结论核对到了哪里,以及团队接下来要做什么。`,`See what work was done, which conclusions were checked, and what the team needs to do next.`)})]}),(0,U.jsxs)(`div`,{className:`experiment-header-actions`,children:[(0,U.jsxs)(`button`,{className:`button button--secondary`,type:`button`,onClick:()=>void e.refresh(),children:[(0,U.jsx)(y,{size:14}),n(`刷新`,`Refresh`)]}),e.snapshot.daemon.alive&&e.snapshot.daemon.control_available===!1?null:e.snapshot.daemon.alive?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{className:`button button--secondary`,type:`button`,disabled:e.controls.busy,onClick:()=>void k(!0),children:[(0,U.jsx)(ge,{size:14}),n(`当前步后停止`,`Stop after step`)]}),(0,U.jsxs)(`button`,{className:`button button--danger`,type:`button`,disabled:e.controls.busy,onClick:()=>void k(!1),children:[(0,U.jsx)(se,{size:13}),n(`立即停止`,`Stop now`)]})]}):(0,U.jsxs)(`button`,{className:`button button--primary`,type:`button`,disabled:e.controls.busy,onClick:()=>void e.controls.start(),children:[(0,U.jsx)(M,{size:14}),n(`继续运行`,`Resume`)]})]})]}),(0,U.jsxs)(`section`,{className:`experiment-progress-hero`,children:[(0,U.jsxs)(`div`,{className:`progress-hero-main`,children:[(0,U.jsxs)(`div`,{className:`progress-live-line`,children:[(0,U.jsx)(W,{tone:h?`live`:`neutral`,dot:h,children:g}),c.runtime.role?(0,U.jsx)(`span`,{children:V(c.runtime.role,n)}):null]}),(0,U.jsx)(`h2`,{children:c.currentTask}),c.currentObjective?(0,U.jsx)(`p`,{className:`work-objective`,children:c.currentObjective}):null,(0,U.jsxs)(`div`,{className:`current-step-callout`,children:[(0,U.jsx)(`span`,{children:(0,U.jsx)(v,{size:17})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`small`,{children:h?n(`当前动作`,`Current action`):n(`当前状态与最近记录`,`Current state and latest record`)}),(0,U.jsx)(`strong`,{children:C?.title||c.currentStep}),C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{children:C.detail}),(0,U.jsx)(E,{label:n(`原始调用记录`,`Original call record`),children:(0,U.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs`,children:c.currentDetail})})]}):c.currentDetail?(0,U.jsx)(`p`,{title:x.technical||void 0,children:x.text}):null]})]})]}),(0,U.jsxs)(`div`,{className:`progress-number`,children:[(0,U.jsx)(`span`,{children:n(`已完成的工作项`,`Completed work items`)}),(0,U.jsxs)(`strong`,{children:[c.completedTasks,(0,U.jsxs)(`em`,{children:[` / `,c.totalTasks||`—`]})]}),(0,U.jsx)(`small`,{children:n(`按当前记录计数`,`Counted from current records`)})]}),(0,U.jsxs)(`div`,{className:`truthful-progress`,children:[c.workCompletion===null?null:(0,U.jsx)(`div`,{className:`truthful-progress__track`,role:`progressbar`,"aria-label":n(`已记录工作项的完成情况`,`Completion of recorded work items`),"aria-valuemin":0,"aria-valuemax":c.totalTasks,"aria-valuenow":c.completedTasks,"aria-valuetext":n(`${c.totalTasks} 项已记录工作中完成 ${c.completedTasks} 项`,`${c.completedTasks} of ${c.totalTasks} recorded work items completed`),children:(0,U.jsx)(`span`,{className:`confirmed`,style:{width:`${c.workCompletion*100}%`}})}),(0,U.jsx)(`p`,{className:`work-scope`,children:c.workScope})]}),(0,U.jsxs)(`div`,{className:`progress-metrics`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(te,{size:15}),n(`当前工作项已用时间`,`Current work item elapsed`)]}),(0,U.jsx)(`strong`,{children:c.elapsedSeconds===null?`—`:Ue(c.elapsedSeconds)}),(0,U.jsx)(`small`,{children:n(`按任务启动与结束记录计算`,`Based on recorded task start and end times`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{children:n(`实际记录的阶段`,`Recorded stage`)}),(0,U.jsx)(`strong`,{children:p}),(0,U.jsx)(`small`,{children:n(`阶段名称不表示前面的工作已通过核验`,`The stage name does not certify earlier work`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{children:n(`工作范围`,`Work scope`)}),(0,U.jsx)(`strong`,{children:c.openEnded?n(`开放研究`,`Open research`):n(`当前工作项`,`Current work item`)}),(0,U.jsx)(`small`,{children:c.openEnded?n(`可能产生新的问题和任务`,`New questions and tasks may emerge`):n(`以该工作项的验收条件为准`,`Defined by this item’s acceptance criteria`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(Me,{size:15}),n(`等待执行的工作`,`Work waiting to start`)]}),(0,U.jsx)(`strong`,{children:c.pendingTasks}),(0,U.jsx)(`small`,{children:n(`已记录清单中的等待项`,`Waiting items in the recorded list`)})]})]})]}),(0,U.jsxs)(`div`,{className:`experiment-v3-grid`,children:[(0,U.jsxs)(`aside`,{className:`ros-card experiment-task-route`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`工作项`,`Work items`)})}),(0,U.jsx)(W,{tone:`neutral`,children:u.length})]}),(0,U.jsx)(`div`,{children:u.length?D.map(e=>(0,U.jsxs)(`section`,{className:`work-item-group`,children:[(0,U.jsxs)(`h3`,{children:[e.label,(0,U.jsx)(`span`,{children:e.items.length})]}),e.items.length?e.items.map(e=>{let t=h&&e.id===c.currentTaskId&&st.has(e.status),r=st.has(e.status)&&!t?e.id===c.currentTaskId?g:n(`等待状态确认`,`Awaiting status confirmation`):Ve(e.status,n);return(0,U.jsxs)(`button`,{type:`button`,className:d?.id===e.id?`is-active`:``,onClick:()=>s(e.id),children:[(0,U.jsx)(`span`,{className:`task-state task-state--${ot.has(e.status)?`success`:t?`live`:`neutral`}`,children:ot.has(e.status)?(0,U.jsx)(_,{size:12}):t?(0,U.jsx)(v,{size:12}):(0,U.jsx)(be,{size:9})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.title||e.objective||n(`未命名任务`,`Untitled task`)}),(0,U.jsxs)(`small`,{children:[r,e.deps.length?n(` · 前置工作 ${e.deps.length} 项`,` · ${e.deps.length} dependencies`):``]})]})]},e.id)}):(0,U.jsx)(`p`,{className:`work-group-empty`,children:n(`暂无记录`,`No records yet`)})]},e.label)):(0,U.jsx)(G,{icon:Me,title:n(`尚无工作项`,`No work items yet`)})})]}),(0,U.jsxs)(`main`,{className:`experiment-v3-center`,children:[(0,U.jsxs)(`section`,{className:`ros-card work-conclusion`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`本轮结论与待核对问题`,`This round’s conclusions and open checks`)})}),(0,U.jsx)(W,{tone:c.review.state===`passed`?`success`:c.review.state===`running`?`live`:`warn`,children:c.review.label})]}),(0,U.jsxs)(`div`,{className:`work-conclusion__body`,children:[(0,U.jsx)(`p`,{title:T.technical||void 0,children:T.text}),c.acceptanceCriteria?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:n(`判断这项工作是否完成的标准`,`How this work item is accepted`)}),(0,U.jsx)(`p`,{children:c.acceptanceCriteria})]}):null,c.nextAction?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:n(`下一步要处理`,`What needs to happen next`)}),(0,U.jsx)(`p`,{children:c.nextAction})]}):null,(0,U.jsx)(`p`,{className:`work-scope`,children:c.review.scope})]})]}),(0,U.jsxs)(`section`,{className:`ros-card checkpoint-card`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`当前工作项的过程记录`,`Current work item’s recorded steps`)})}),(0,U.jsx)(W,{tone:`neutral`,children:n(`以记录为准`,`Based on records`)})]}),(0,U.jsx)(`div`,{className:`checkpoint-list`,children:c.checkpoints.map((e,t)=>(0,U.jsxs)(`div`,{className:`checkpoint checkpoint--${e.status}`,children:[(0,U.jsx)(`span`,{children:e.status===`done`?(0,U.jsx)(_,{size:13}):e.status===`active`?(0,U.jsx)(v,{size:13}):e.status===`blocked`?(0,U.jsx)(ve,{size:13}):t+1}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.label}),(0,U.jsx)(`p`,{children:e.detail})]}),t{let t=h&&c.runtime.role===e;return(0,U.jsxs)(`article`,{className:t?`is-active`:``,children:[(0,U.jsx)(`span`,{"data-role-dot":e,className:`role-dot`,style:{backgroundColor:O(e)},"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:V(e,n)}),(0,U.jsx)(`p`,{children:S(e,r)})]}),t?(0,U.jsx)(W,{tone:`live`,dot:!0,children:n(`执行中`,`Working`)}):(0,U.jsx)(W,{tone:`neutral`,children:n(`未在执行`,`Not working`)})]},e)})})]}),(0,U.jsxs)(`section`,{className:`ros-card estimate-note`,children:[(0,U.jsx)(`header`,{children:(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`还需要多久`,`How much longer?`)})})}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:n(`暂无法可靠预计`,`No reliable estimate yet`)}),c.etaUnavailableReason]}),(0,U.jsxs)(`div`,{className:`work-evidence-note`,children:[(0,U.jsx)(m,{size:15}),(0,U.jsx)(`span`,{children:n(`真实已用时间和已完成工作可以统计。读文件、运行命令或审查结束,都不能换算成整体目标的完成百分比。`,`Elapsed time and completed work can be counted. File reads, commands, and the end of a review do not establish a completion percentage for the overall goal.`)})]}),e.controls.error?(0,U.jsx)(`div`,{className:`inline-error`,children:e.controls.error}):null]})]})]})]})]})}function lt(e){if(!e||e.length>2e5||e.includes(`\0`)||!e.startsWith(`diff --git `)&&!/^--- [^\n]+\n\+\+\+ /.test(e)||/^(?:Binary files |GIT binary patch)/m.test(e))return null;let t=e.match(/[^\n]*\n|[^\n]+$/g)??[];if(t.length>3e3)return null;let n=[],r=0,i=0;for(let e of t){let t=e.replace(/\r?\n$/,``),a,o=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@(?:.*)$/.exec(t);if(t.startsWith(`diff --git `))a=`header`,r=0,i=0;else if(o){if(a=`hunk`,r=Number(o[1]??1),i=Number(o[2]??1),!Number.isSafeInteger(r)||!Number.isSafeInteger(i))return null}else if(t===`\\ No newline at end of file`)a=`header`;else if(r||i){if(t.startsWith(`+`))a=`addition`,i--;else if(t.startsWith(`-`))a=`deletion`,r--;else if(t.startsWith(` `))a=`context`,r--,i--;else return null;if(r<0||i<0)return null}else if(/^(?:--- |\+\+\+ |index |old mode |new mode |new file mode |deleted file mode |similarity index |dissimilarity index |rename from |rename to |copy from |copy to )/.test(t))a=`header`;else return null;n.push({kind:a,text:e})}return n}function ut({diff:e,truncated:t=!1}){let{text:n}=H(),r=(0,I.useMemo)(()=>lt(e),[e]),[i,a]=(0,I.useState)(!1),o=r!==null&&!i;return(0,U.jsxs)(`section`,{className:`readonly-diff`,"data-readonly-diff":!0,children:[(0,U.jsxs)(`div`,{className:`readonly-diff__toolbar`,children:[(0,U.jsx)(`strong`,{children:n(`当前工作区差异`,`Current workspace diff`)}),r&&(0,U.jsx)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?n(`着色视图`,`Highlighted view`):n(`原始文本`,`Original text`)}),e&&(0,U.jsx)(C,{text:e,label:n(`复制原始差异`,`Copy original diff`),copiedLabel:n(`已复制`,`Copied`)})]}),(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`不代表所有变更都来自当前 Agent 或任务。`,`Changes are not necessarily from this Agent or task.`)}),t&&(0,U.jsx)(`p`,{role:`status`,className:`readonly-diff__notice`,children:n(`后端返回的差异已截断,当前内容不完整。`,`The backend truncated this diff; the displayed content is incomplete.`)}),e?r?null:(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`无法识别、二进制或较大差异:显示原始文本。`,`Unrecognized, binary or large diff: showing original text.`)}):(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`没有工作区差异。`,`No workspace diff.`)}),(0,U.jsx)(`pre`,{className:`readonly-diff__text`,tabIndex:0,"aria-label":n(`工作区差异文本`,`Workspace diff text`),"data-diff-mode":o?`highlighted`:`raw`,children:o?r.map((e,t)=>(0,U.jsx)(`span`,{"data-diff-kind":e.kind,className:`readonly-diff__line--${e.kind}`,children:e.text},t)):e})]})}async function q(e,t,n){let r=new URLSearchParams(t),i=await fetch(`${e}?${r}`,{headers:L(),signal:n,cache:`no-store`});if(!i.ok){let t=await i.json().catch(()=>({}));throw Error(t.detail||t.error||`${e} failed (${i.status})`)}return i.json()}var J=(e,t)=>({sid:e,workspace_id:t}),Y={profiles:(e,t)=>q(`/api/v2/workspaces`,{sid:e},t),tree:(e,t,n)=>q(`/api/v2/workspace/tree`,J(e,t),n),file:(e,t,n,r)=>q(`/api/v2/workspace/file`,{...J(e,t),path:n},r),git:(e,t,n)=>q(`/api/v2/workspace/git`,J(e,t),n),literature:(e,t,n)=>q(`/api/v2/workspace/literature`,J(e,t),n),rawUrl:(e,t,n)=>`/api/v2/workspace/raw?${new URLSearchParams({...J(e,t),path:n})}`,rawBlob:async(e,t,n,r)=>{let i=await fetch(`/api/v2/workspace/raw?${new URLSearchParams({...J(e,t),path:n})}`,{headers:L(),signal:r,cache:`no-store`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`raw preview failed (${i.status})`)}return i.blob()}};function dt(e){let t=new Map;e.forEach(e=>t.set(e.path,{...e,children:[]}));let n=[];t.forEach(e=>{let r=e.path.lastIndexOf(`/`),i=r>=0?e.path.slice(0,r):``,a=i?t.get(i):null;a?a.children.push(e):n.push(e)});let r=e=>{e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1),e.forEach(e=>r(e.children))};return r(n),n}function ft(e,t,n){let[r,i]=(0,I.useState)(``),[a,o]=(0,I.useState)(``);return(0,I.useEffect)(()=>{if(i(``),o(``),!e||!t||!n)return;let r=new AbortController,a=``;return Y.rawBlob(e,t,n,r.signal).then(e=>{a=URL.createObjectURL(e),i(a)},e=>{r.signal.aborted||o(e.message)}),()=>{r.abort(),a&&URL.revokeObjectURL(a)}},[n,e,t]),{url:r,error:a}}function pt(e,t,n=!0){let i=r({queryKey:[`workspace-profiles`,e],queryFn:({signal:t})=>Y.profiles(e,t),staleTime:1e4,enabled:!!e&&n}),a=`argus-v2-workspace-profile:${t}:${e}`,[o,s]=(0,I.useState)(()=>N(a)||``),c=(0,I.useMemo)(()=>{let e=i.data?.profiles??[];return e.find(e=>e.id===o)??e.find(e=>e.id===i.data?.default_id)??e.find(e=>e.canonical)??e[0]??null},[i.data,o]);return(0,I.useEffect)(()=>{c&&c.id!==o&&s(c.id)},[c,o]),{profiles:i,active:c,workspaceId:c?.id??``,setWorkspaceId:e=>{s(e),ee(a,e)}}}function mt({node:e,depth:t,selected:n,expanded:r,onToggle:i,onSelect:a}){let o=e.type===`directory`,s=r.has(e.path);return(0,U.jsxs)(`div`,{className:`workspace-node`,children:[(0,U.jsxs)(`button`,{type:`button`,className:n===e.path?`is-selected`:``,style:{paddingLeft:7+t*13},onClick:()=>o?i(e.path):a(e.path),children:[o?s?(0,U.jsx)(g,{size:13}):(0,U.jsx)(P,{size:13}):(0,U.jsx)(`span`,{className:`node-spacer`}),o?(0,U.jsx)(ne,{size:14}):(0,U.jsx)(xe,{size:14}),(0,U.jsx)(`span`,{children:e.name}),e.skipped?(0,U.jsx)(`small`,{children:`restricted`}):null]}),o&&s?e.children.map(e=>(0,U.jsx)(mt,{node:e,depth:t+1,selected:n,expanded:r,onToggle:i,onSelect:a},e.path)):null]})}function ht({sid:e,workspaceId:t,path:n,active:i}){let{text:a}=H(),o=n.toLowerCase().slice(n.lastIndexOf(`.`)),s=[`.pdf`,`.png`,`.jpg`,`.jpeg`,`.webp`,`.svg`].includes(o),c=r({queryKey:[`workspace-file`,e,t,n],queryFn:({signal:r})=>Y.file(e,t,n,r),enabled:!!(i&&n&&t&&!s),refetchInterval:5e3}),l=ft(s?e:``,s?t:``,s?n:``);if(!n)return(0,U.jsx)(G,{icon:Se,title:a(`打开一个文件开始阅读`,`Open a file to start reading`),description:a(`左侧文件树展示所选代码工作区。`,`The file tree shows the selected code workspace.`)});if(s)return l.error?(0,U.jsx)(G,{icon:De,title:`Preview unavailable`,description:l.error}):l.url?o===`.pdf`?(0,U.jsx)(me,{src:l.url,name:n.split(`/`).at(-1)||n,className:`workspace-pdf`}):(0,U.jsx)(`img`,{className:`workspace-image`,src:l.url,alt:n}):(0,U.jsx)(`div`,{className:`editor-loading`,children:`Loading preview…`});if(c.isLoading)return(0,U.jsxs)(`div`,{className:`editor-loading`,children:[`Opening `,n,`…`]});if(c.isError)return(0,U.jsx)(G,{icon:De,title:`Preview unavailable`,description:c.error.message});let u=(c.data?.content??``).split(` +`);return(0,U.jsxs)(`div`,{className:`vscode-code`,tabIndex:0,"aria-label":a(`文件内容`,`File contents`),children:[(0,U.jsx)(`div`,{className:`vscode-line-numbers`,children:u.map((e,t)=>(0,U.jsx)(`span`,{children:t+1},t))}),(0,U.jsx)(`pre`,{children:(0,U.jsx)(`code`,{children:c.data?.content})})]})}function gt(e){let{locale:t,text:n}=H(),i=pt(e.sid,`ide`,e.active),a=i.workspaceId,o=i.active?.path||``,[s,c]=(0,I.useState)(``),[l,u]=(0,I.useState)(new Set),d=(0,I.useRef)(``),f=(0,I.useRef)(null),p=e=>{c(e);let t=f.current,n=t?.closest(`.vscode-shell`),r=t?.closest(`.ros-content`);t&&n&&r&&getComputedStyle(n).display===`flex`&&r.scrollTo({top:r.scrollTop+t.getBoundingClientRect().top-r.getBoundingClientRect().top-12,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[m,h]=(0,I.useState)(`files`),[v,x]=(0,I.useState)(`repository`),S=r({queryKey:[`workspace-tree`,e.sid,a],queryFn:({signal:t})=>Y.tree(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),C=r({queryKey:[`workspace-git`,e.sid,a],queryFn:({signal:t})=>Y.git(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),w=(0,I.useMemo)(()=>dt(S.data?.entries??[]),[S.data?.entries]);(0,I.useEffect)(()=>{c(``),u(new Set),d.current=``},[a]),(0,I.useEffect)(()=>{!a||!w.length||d.current===a||(d.current=a,u(new Set(w.filter(e=>e.type===`directory`).slice(0,5).map(e=>e.path))))},[w,a]);let T=e.events.filter(e=>[`command_execution`,`tool_use`,`tool_result`,`file_change`].includes(String(e.kind??``))).slice(-100),E=(C.data?.status??``).split(` +`).filter(Boolean),D=(C.data?.log??``).split(` +`).filter(Boolean).map(e=>{let[t,n,r,...i]=e.split(` `);return{hash:t,date:n,author:r,subject:i.join(` `)}}),k=C.data;return(0,U.jsxs)(`div`,{className:`ros-page ide-v3`,children:[(0,U.jsxs)(`header`,{className:`ros-page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`eyebrow`,children:`AI IDE`}),(0,U.jsx)(`h1`,{children:n(`代码工作区`,`Code workspace`)}),(0,U.jsx)(`p`,{children:n(`此视图只用于浏览文件、Git 状态与 Argus 活动;不限制 Agent 本身的文件写入权限。`,`This view only browses files, Git state and Argus activity; it does not restrict the Agent’s file write permissions.`)})]}),(0,U.jsxs)(W,{tone:`info`,children:[(0,U.jsx)(De,{size:12}),n(`此视图只读`,`This view is read-only`)]})]}),(0,U.jsxs)(`div`,{className:`ide-context-strip`,children:[(0,U.jsx)(ke,{size:15}),(0,U.jsx)(`select`,{"aria-label":n(`选择已批准工作区`,`Select approved workspace`),value:a,onChange:e=>i.setWorkspaceId(e.target.value),children:i.profiles.data?.profiles.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,U.jsx)(`code`,{children:o}),S.isError?(0,U.jsx)(W,{tone:`danger`,children:n(`连接失败`,`Connection failed`)}):S.isFetching?(0,U.jsx)(W,{tone:`live`,dot:!0,children:n(`同步中`,`Syncing`)}):(0,U.jsxs)(W,{tone:`success`,children:[(0,U.jsx)(re,{size:11}),`Synced`]}),(0,U.jsxs)(`small`,{children:[S.data?.entries.length??0,` entries`]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{S.refetch(),C.refetch()},"aria-label":n(`刷新工作区`,`Refresh workspace`),children:(0,U.jsx)(y,{size:14})})]}),(0,U.jsxs)(`div`,{className:`vscode-shell`,children:[(0,U.jsxs)(`nav`,{className:`vscode-activitybar`,children:[(0,U.jsx)(`button`,{type:`button`,className:m===`files`?`is-active`:``,onClick:()=>h(`files`),title:`Explorer`,"aria-label":`Explorer`,children:(0,U.jsx)(Ce,{size:21})}),(0,U.jsxs)(`button`,{type:`button`,className:m===`git`?`is-active`:``,onClick:()=>h(`git`),title:`Source Control`,"aria-label":`Source Control`,children:[(0,U.jsx)(j,{size:21}),E.length?(0,U.jsx)(`i`,{children:E.length}):null]})]}),(0,U.jsxs)(`aside`,{className:`vscode-sidebar`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`span`,{children:m===`git`?`SOURCE CONTROL`:`EXPLORER`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void S.refetch(),"aria-label":n(`刷新文件树`,`Refresh file tree`),children:(0,U.jsx)(y,{size:14})})]}),m===`files`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`vscode-root`,children:[(0,U.jsx)(g,{size:13}),(0,U.jsx)(`strong`,{title:o,children:o.split(/[\\/]/).filter(Boolean).at(-1)||o})]}),(0,U.jsx)(`div`,{className:`workspace-tree`,children:S.isError?(0,U.jsx)(G,{icon:ke,title:n(`目录连接失败`,`Directory connection failed`),description:S.error.message}):w.map(e=>(0,U.jsx)(mt,{node:e,depth:0,selected:s,expanded:l,onToggle:e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:p},e.path))})]}):(0,U.jsx)(`div`,{className:`vscode-changes`,children:E.length?E.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{let t=e.slice(3).trim(),n=t.includes(` -> `)?t.split(` -> `).at(-1):t;n.endsWith(`/`)||p(n)},children:[(0,U.jsx)(`b`,{children:e.slice(0,2).trim()||`?`}),(0,U.jsx)(`span`,{children:e.slice(3)})]},e)):(0,U.jsx)(`p`,{children:`No changes`})})]}),(0,U.jsxs)(`main`,{className:`vscode-editor`,ref:f,children:[(0,U.jsx)(`div`,{className:`vscode-tabs`,children:(0,U.jsxs)(`button`,{type:`button`,className:`is-active`,children:[(0,U.jsx)(A,{size:13}),s||`Welcome`]})}),(0,U.jsx)(`div`,{className:`vscode-breadcrumbs`,children:s?s.split(`/`).map((e,t)=>(0,U.jsxs)(`span`,{children:[e,tx(`changes`),children:`Changes`}),(0,U.jsx)(`button`,{type:`button`,className:v===`timeline`?`is-active`:``,onClick:()=>x(`timeline`),children:`Timeline`}),(0,U.jsx)(`button`,{type:`button`,className:v===`repository`?`is-active`:``,onClick:()=>x(`repository`),children:`Repository`})]}),(0,U.jsx)(`div`,{className:`vscode-git-content`,children:k?.available?v===`changes`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{className:`vscode-status`,children:k.status||`Working tree clean`}),(0,U.jsx)(ut,{diff:k.diff,truncated:k.truncated})]}):v===`timeline`?(0,U.jsx)(`div`,{className:`vscode-commits`,children:D.map(e=>(0,U.jsxs)(`article`,{children:[(0,U.jsx)(j,{size:13}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.subject}),(0,U.jsxs)(`small`,{children:[e.author,` · `,e.date?.slice(0,10)]})]})]},e.hash))}):(0,U.jsxs)(`div`,{className:`repository-readiness`,children:[(0,U.jsx)(`h3`,{children:`Repository readiness`}),(0,U.jsxs)(`dl`,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(j,{size:13}),`Remote`]}),(0,U.jsx)(`dd`,{children:k.remotes.length?k.remotes.map(e=>`${e.name}: ${e.fetch}`).join(` +`):`Not configured`}),(0,U.jsx)(`i`,{className:k.remotes.length?`ok`:`missing`,children:k.remotes.length?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(j,{size:13}),`Upstream`]}),(0,U.jsxs)(`dd`,{children:[k.upstream||`Not configured`,k.upstream?` · ahead ${k.ahead}, behind ${k.behind}`:``]}),(0,U.jsx)(`i`,{className:k.upstream?`ok`:`missing`,children:k.upstream?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(je,{size:13}),`Commit identity`]}),(0,U.jsx)(`dd`,{children:k.identity.name&&k.identity.email?`${k.identity.name} <${k.identity.email}>`:`Not configured`}),(0,U.jsx)(`i`,{className:k.identity.valid?`ok`:`missing`,children:k.identity.valid?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(Ee,{size:13}),`GitHub CLI`]}),(0,U.jsx)(`dd`,{children:k.github.authenticated?`${k.github.login} · ${k.github.protocol}`:`Not authenticated`}),(0,U.jsx)(`i`,{className:k.github.authenticated?`ok`:`missing`,children:k.github.authenticated?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]})]}),(0,U.jsx)(`p`,{children:k.publish_ready?`Repository is ready for an explicitly approved push.`:`Configure the missing items before publishing. No credentials are shown in this UI.`})]}):(0,U.jsx)(G,{icon:j,title:`Not a Git repository`})})]}),(0,U.jsxs)(`section`,{className:`vscode-terminal`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`strong`,{children:`ARGUS ACTIVITY`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(Ae,{size:13}),`read-only`]})]}),(0,U.jsx)(`div`,{children:T.length?T.map((e,r)=>(0,U.jsxs)(`article`,{children:[(0,U.jsx)(`time`,{children:We(e.ts,t)}),(0,U.jsx)(`b`,{className:`terminal-role`,style:{color:O(Ke(e))},children:V(Ke(e),n)}),(0,U.jsx)(`span`,{children:`›`}),(0,U.jsx)(`code`,{children:Je(e,800)||qe(e)})]},`${e.ts}-${r}`)):(0,U.jsx)(`p`,{children:`$ waiting for Argus activity`})})]}),(0,U.jsxs)(`footer`,{className:`vscode-statusbar`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(j,{size:12}),k?.branch||`no branch`]}),(0,U.jsx)(`span`,{children:S.isError?`Workspace error`:S.isFetching?`Workspace syncing`:S.data?.truncated?`Tree truncated`:`Workspace synced`}),(0,U.jsx)(`span`,{children:k?.github.authenticated?`GitHub: ${k.github.login}`:`GitHub: offline`}),(0,U.jsx)(`span`,{children:`UTF-8`}),(0,U.jsx)(`span`,{children:s.split(`.`).at(-1)?.toUpperCase()||`Plain Text`})]})]})]})}var X=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm`;function _t({task:e,resources:t,onChange:n,text:r}){let i=e.execution_options??[],a=(e,t)=>n(i.map(n=>n.id===e?{...n,...t}:n));return(0,U.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-dashed border-line p-3 sm:col-span-2`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-medium`,children:r(`期限紧张时的替代做法`,`Alternative execution options for tighter deadlines`)}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:r(`每种做法都有独立工期、资源和取舍。系统只会选择已声明保留必需验收目标的方案,不自动压缩原估计。`,`Each option has its own estimate, resources and tradeoff. Only options declared to preserve required acceptance scope can be selected.`)}),i.map(o=>(0,U.jsxs)(`fieldset`,{disabled:e.status!=null&&e.status!==`pending`,className:`grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs sm:col-span-2`,children:[r(`替代做法`,`Alternative approach`),(0,U.jsx)(`input`,{className:X,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:col-span-2`,children:[r(`替代下限(小时)`,`Option lower (h)`),r(`替代最可能(小时)`,`Option likely (h)`),r(`替代上限(小时)`,`Option upper (h)`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{className:X,type:`number`,min:`0`,step:`any`,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),t.map(e=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,r(`需求`,`required`),(0,U.jsx)(`input`,{className:X,type:`number`,min:`0`,step:`1`,value:o.resources[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e)),(0,U.jsxs)(`label`,{className:`text-xs`,children:[r(`替代工期依据`,`Option estimate basis`),(0,U.jsx)(`textarea`,{"aria-label":r(`替代工期依据`,`Option estimate basis`),className:X,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[r(`取舍与适用条件`,`Tradeoff and prerequisites`),(0,U.jsx)(`textarea`,{"aria-label":r(`取舍与适用条件`,`Tradeoff and prerequisites`),className:X,value:o.tradeoff,onChange:e=>a(o.id,{tradeoff:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`flex gap-2 text-xs sm:col-span-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o.preserves_acceptance,onChange:e=>a(o.id,{preserves_acceptance:e.target.checked})}),r(`确认条件适用且保留必需验收目标,允许重排时采用`,`Prerequisites apply and required acceptance is preserved; allow automatic selection`)]}),(0,U.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>n(i.filter(e=>e.id!==o.id)),children:r(`移除替代做法`,`Remove alternative`)})]},o.id)),(0,U.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-xs`,disabled:i.length>=8||e.status!=null&&e.status!==`pending`,onClick:()=>{let t=i.length+1;for(;i.some(e=>e.id===`option-${t}`);)t++;n([...i,{id:`option-${t}`,title:r(`新的替代做法`,`New alternative`),duration_hours:[...e.duration_hours],resources:{...e.resources},basis:e.basis,tradeoff:r(`待补充适用条件与取舍`,`Specify prerequisites and tradeoffs`),preserves_acceptance:!1}])},children:r(`添加替代做法`,`Add alternative`)})]})}var Z=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm text-ink`;function vt({input:e,onChange:t,text:n,forecast:r}){let i=e.proposals.find(t=>t.id===e.selected_proposal_id),a=(n,r)=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.map(e=>e.id===n?{...e,...r}:e)}:e)});return(0,U.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`任务与实验`,`Tasks and experiments`),children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`h3`,{className:`font-medium`,children:n(`任务与实验`,`Tasks and experiments`)}),(0,U.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-sm`,onClick:()=>{let r=i.tasks.length+1;for(;i.tasks.some(e=>e.id===`task-${r}`);)r++;t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:[...e.tasks,{id:`task-${r}`,title:n(`新增实验`,`New experiment`),phase:`experiment`,duration_hours:[1,2,8],basis:n(`初步估计,待实测校准`,`Preliminary estimate; needs calibration`)}]}:e)})},children:n(`添加任务`,`Add task`)})]}),i.tasks.map(o=>{let s=[`running`,`completed`,`failed`].includes(o.status??`pending`),c=[`completed`,`failed`].includes(o.status??`pending`);return(0,U.jsxs)(`details`,{className:`rounded-xl border border-line p-3`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,U.jsx)(`strong`,{children:o.title}),(0,U.jsxs)(`span`,{className:`ml-2 text-ink-faint`,children:[o.duration_hours.join(` / `),` h · `,o.id]})]}),(0,U.jsxs)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`任务名称`,`Task name`),(0,U.jsx)(`input`,{className:Z,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`阶段`,`Phase`),(0,U.jsx)(`input`,{className:Z,value:o.phase,onChange:e=>a(o.id,{phase:e.target.value})})]}),(0,U.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`乐观(小时)`,`Lower (hours)`),n(`最可能(小时)`,`Likely (hours)`),n(`悲观(小时)`,`Upper (hours)`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,disabled:s,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`估计依据`,`Estimate basis`),(0,U.jsx)(`textarea`,{"aria-label":n(`估计依据`,`Estimate basis`),className:Z,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`模型 / 实现难度`,`Model / implementation difficulty`),(0,U.jsx)(`textarea`,{"aria-label":n(`模型 / 实现难度`,`Model / implementation difficulty`),className:Z,value:o.difficulty??``,onChange:e=>a(o.id,{difficulty:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`前置任务(可多选)`,`Dependencies (multiple)`),(0,U.jsx)(`select`,{"aria-label":n(`前置任务(可多选)`,`Dependencies (multiple)`),multiple:!0,className:Z,disabled:s,value:o.depends_on??[],onChange:e=>a(o.id,{depends_on:Array.from(e.target.selectedOptions,e=>e.value)}),children:i.tasks.filter(e=>e.id!==o.id).map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.keys(e.resources).map(e=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`占用`,`slots`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`1`,className:Z,disabled:s,value:o.resources?.[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`进展状态`,`Progress status`),(0,U.jsx)(`select`,{"aria-label":n(`进展状态`,`Progress status`),className:Z,disabled:c||e.adapt_to_deadline&&!s&&!r,value:o.status??`pending`,onChange:t=>{let n=t.target.value,i=r?.schedule.find(e=>e.id===o.id),c=!s&&[`running`,`completed`,`failed`].includes(n)&&i?{duration_hours:i.duration_hours??o.duration_hours,resources:i.resources,execution_option_id:i.execution_option_id??`standard`,basis:i.basis}:{};a(o.id,{status:n,...c,...n===`running`?{actual_start_hours:o.actual_start_hours??e.now_hours,remaining_hours:o.remaining_hours??[...c.duration_hours??o.duration_hours]}:{},...[`completed`,`failed`].includes(n)?{actual_start_hours:o.actual_start_hours??0,actual_finish_hours:e.now_hours}:{}})},children:[[`pending`,`未开始`,`Pending`],[`running`,`运行中`,`Running`],[`completed`,`已完成`,`Completed`],[`failed`,`失败`,`Failed`],[`blocked`,`受阻`,`Blocked`]].filter(([e])=>!s||![`pending`,`blocked`].includes(e)).map(([e,t,r])=>(0,U.jsx)(`option`,{value:e,children:n(t,r)},e))})]}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o.optional??!1,onChange:e=>a(o.id,{optional:e.target.checked})}),n(`可选 / 已退出交付路径`,`Optional / retired from delivery path`)]}),s&&(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`实际开始(项目第几小时)`,`Actual start (project hour)`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.actual_start_hours??0,onChange:e=>a(o.id,{actual_start_hours:Number(e.target.value)})})]}),c&&(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`实际结束(项目第几小时)`,`Actual finish (project hour)`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.actual_finish_hours??0,onChange:e=>a(o.id,{actual_finish_hours:Number(e.target.value)})})]}),o.status===`running`&&(0,U.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`剩余下限`,`Remaining lower`),n(`剩余最可能`,`Remaining likely`),n(`剩余上限`,`Remaining upper`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.remaining_hours?.[t]??0,onChange:e=>{let n=[...o.remaining_hours??o.duration_hours];n[t]=Number(e.target.value),a(o.id,{remaining_hours:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`变化 / 延期原因`,`Change / delay reason`),(0,U.jsx)(`textarea`,{"aria-label":n(`变化 / 延期原因`,`Change / delay reason`),className:Z,value:o.reason??``,onChange:e=>a(o.id,{reason:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`证据引用(每行一个)`,`Evidence references (one per line)`),(0,U.jsx)(`textarea`,{"aria-label":n(`证据引用(每行一个)`,`Evidence references (one per line)`),className:Z,value:(o.evidence??[]).join(` +`),onChange:e=>a(o.id,{evidence:e.target.value.split(` +`).filter(Boolean)})})]}),(0,U.jsx)(_t,{task:o,resources:Object.keys(e.resources),onChange:e=>a(o.id,{execution_options:e}),text:n}),!s&&i.tasks.length>1&&(0,U.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.filter(e=>e.id!==o.id)}:e)}),children:n(`移除未开始任务`,`Remove unstarted task`)})]})]},o.id)})]})}function yt({report:e,selectedId:t,text:n}){let r=e.proposals.find(e=>e.id===t),i=Math.max(1,...r.schedule.map(e=>e.finish_hours));return(0,U.jsxs)(`div`,{className:`space-y-5`,"aria-label":n(`排期结果`,`Timeline results`),children:[(0,U.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:e.proposals.map(e=>(0,U.jsxs)(`div`,{className:`rounded-xl border p-4 ${e.id===t?`border-blue`:`border-line`}`,children:[(0,U.jsx)(`div`,{className:`text-xs text-ink-faint`,children:e.id===t?n(`已选方案`,`Selected proposal`):n(`备选方案`,`Alternative`)}),(0,U.jsx)(`h3`,{className:`mt-1 text-sm font-medium`,children:e.title}),(0,U.jsx)(`div`,{className:`mt-3 text-2xl font-semibold`,children:e.finish_hours?`${e.finish_hours.expected.toFixed(1)} h`:n(`待重规划`,`Needs replanning`)}),e.finish_hours&&(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[n(`区间`,`Range`),` `,e.finish_hours.lower.toFixed(1),`–`,e.finish_hours.upper.toFixed(1),` h · `,n(`剩余`,`Remaining`),` `,e.remaining_hours?.toFixed(1),` h`]}),e.deadline_gap_hours!=null&&(0,U.jsxs)(`p`,{className:`mt-2 text-xs ${e.deadline_gap_hours>0?`text-red`:`text-ink-faint`}`,children:[n(`预计超期`,`Forecast overrun`),` `,e.deadline_gap_hours.toFixed(1),` h`]})]},e.id))}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`初步估计,非成功承诺。区间覆盖已列出的工作;验证失败后的新增实验可能超出上限。各方案作为备选单独计算。`,`Preliminary estimates, not success guarantees. New experiments after a failed premise can exceed the range. Proposals are estimated as alternatives.`)}),r.adaptation&&(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-blue/40 bg-blue/5 p-4`,"aria-label":n(`根据期限重排`,`Deadline adaptation`),children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`根据期限重排`,`Deadline adaptation`)}),r.adaptation.baseline_finish_hours&&r.finish_hours&&(0,U.jsxs)(`p`,{className:`text-sm`,children:[n(`调整前`,`Before`),` `,(0,U.jsxs)(`strong`,{children:[r.adaptation.baseline_finish_hours.expected.toFixed(1),` h`]}),` → `,n(`当前方案`,`Current plan`),` `,(0,U.jsxs)(`strong`,{children:[r.finish_hours.expected.toFixed(1),` h`]})]}),r.adaptation.status===`gap`&&(0,U.jsx)(`p`,{className:`text-sm text-red`,children:n(`已尝试可用的重排方式,仍无法满足期限。需要增加资源、提出新的执行方案,或调整交付目标。`,`Available adjustments still miss the deadline. More resources, another execution option, or a revised deliverable are needed.`)}),r.adaptation.status===`fits`&&r.finish_hours&&r.adaptation.target_hours!=null&&r.finish_hours.upper>r.adaptation.target_hours&&(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`点估计可按期;悲观情景仍可能超期,请留意区间上限。`,`The point estimate fits; the upper scenario can still miss the deadline.`)}),r.adaptation.changes.length===0&&(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`沿用原 proposal 的任务与做法;当前期限无需进一步调整,或尚无可用的替代做法。`,`Keeping the original tasks and approaches; no further adjustment is needed or no usable alternative is available.`)}),r.adaptation.changes.map(e=>(0,U.jsxs)(`div`,{className:`border-t border-line/60 pt-2 text-xs`,children:[(0,U.jsxs)(`p`,{className:`font-medium`,children:[e.title,e.option_title?` → ${e.option_title}`:``]}),e.from_duration_hours&&e.to_duration_hours&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`任务估计(下限 / 最可能 / 上限)`,`Task estimate (lower / likely / upper)`),`: `,e.from_duration_hours.join(` / `),` → `,e.to_duration_hours.join(` / `),` h`]}),e.from_start_hours!=null&&e.to_start_hours!=null&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`开始时间`,`Start time`),`: `,e.from_start_hours.toFixed(1),` → `,e.to_start_hours.toFixed(1),` h`]}),(0,U.jsx)(`p`,{className:`mt-1 text-ink-faint`,children:e.reason}),e.tradeoff&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`取舍 / 条件`,`Tradeoff / prerequisites`),`: `,e.tradeoff]})]},`${e.kind}:${e.id}`))]}),(0,U.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`h3`,{className:`mb-4 text-sm font-medium`,children:[n(`实验排布`,`Experiment schedule`),` · `,n(`从项目开始计时`,`Hours from project start`)]}),(0,U.jsx)(`div`,{className:`space-y-3`,children:r.schedule.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs`,children:[(0,U.jsx)(`span`,{children:e.title}),(0,U.jsxs)(`span`,{className:`shrink-0 text-ink-faint`,children:[e.start_hours.toFixed(1),`–`,e.finish_hours.toFixed(1),` h`]})]}),(0,U.jsx)(`div`,{className:`h-2.5 rounded-full bg-line/40`,role:`img`,"aria-label":`${e.title}: ${e.start_hours.toFixed(1)}–${e.finish_hours.toFixed(1)} h`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full ${e.status===`failed`?`bg-red`:e.status===`completed`?`bg-emerald-500`:`bg-blue`}`,style:{marginLeft:`${e.start_hours/i*100}%`,width:`${Math.max(.3,(e.finish_hours-e.start_hours)/i*100)}%`}})})]},e.id))})]}),r.deferred_task_ids.length>0&&(0,U.jsxs)(`p`,{className:`rounded-lg border border-line p-3 text-sm`,children:[n(`为满足期限延后的可选任务`,`Optional tasks deferred for the deadline`),`: `,r.deferred_task_ids.join(`, `)]}),[...r.failed_tasks,...r.blocked_tasks].map(e=>(0,U.jsxs)(`p`,{role:`alert`,className:`rounded-lg border border-red/40 p-3 text-sm`,children:[e.id,`: `,e.reason]},e.id)),(0,U.jsx)(`div`,{className:`overflow-x-auto`,children:(0,U.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsx)(`tr`,{children:[n(`任务`,`Task`),n(`资源`,`Resources`),n(`排队`,`Queue`),n(`估计依据`,`Estimate basis`)].map(e=>(0,U.jsx)(`th`,{className:`border-b border-line p-2`,children:e},e))})}),(0,U.jsx)(`tbody`,{children:r.schedule.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:e.title}),(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:Object.entries(e.resources).map(([e,t])=>`${e} × ${t}`).join(`, `)||`—`}),(0,U.jsxs)(`td`,{className:`border-b border-line p-2`,children:[e.resource_wait_hours.toFixed(1),` h`]}),(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:e.basis})]},e.id))})]})}),e.revision&&(0,U.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`版本对照与延期原因`,`Revision and delay reasons`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm`,children:e.revision.reason}),(0,U.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[n(`初版预计`,`Original forecast`),`: `,e.revision.baseline_finish_hours?.toFixed(1)??`—`,` h · `,n(`相对初版变化`,`Change from original`),`: `,e.revision.baseline_delta_hours?.toFixed(1)??`—`,` h`]}),e.revision.task_variances.map((e,t)=>(0,U.jsxs)(`p`,{className:`mt-3 text-xs`,children:[e.id,` · `,e.observed?n(`实际延期`,`Observed delay`):n(`预测延期`,`Forecast delay`),` `,e.delay_hours.toFixed(1),` h — `,e.reason,(0,U.jsx)(`br`,{}),e.evidence.join(`, `)]},`${e.id}-${t}`))]})]})}function bt(e){return{...e,resources:e.resources??{},now_hours:e.now_hours??0,defer_optional:e.defer_optional??!1}}var Q=`w-full rounded-lg border border-line bg-transparent px-3 py-2 text-sm text-ink`,$=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40`;function xt({sid:e}){let{locale:t}=p(),n=(e,n)=>t===`zh-CN`?e:n,[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(!0),[d,f]=(0,I.useState)(!1),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(``),[b,x]=(0,I.useState)(``),[S,C]=(0,I.useState)(``),[w,E]=(0,I.useState)(``),[D,O]=(0,I.useState)(``),[k,A]=(0,I.useState)(0),j=!!(r&&JSON.stringify(r)!==JSON.stringify(a?.input));return(0,I.useEffect)(()=>{let t=!0;return u(!0),f(!1),y(``),i(null),o(null),c(null),B.timelineLatest(e).then(({latest:e})=>{if(!t)return;let n=e?{...e,input:bt(e.input)}:null;o(n),i(n?.input??null),c(n?.report??null),E(``),C(``),f(!0)}).catch(e=>{t&&y(e.message)}).finally(()=>{t&&u(!1)}),()=>{t=!1}},[e,k]),(0,I.useEffect)(()=>{if(c(null),x(``),!r){_(!1);return}if(a&&JSON.stringify(r)===JSON.stringify(a.input)){c(a.report),_(!1);return}let e=new AbortController;_(!0);let t=setTimeout(()=>{B.timelineEstimate(r,e.signal).then(t=>{e.signal.aborted||c(t)}).catch(t=>{e.signal.aborted||x(t.message)}).finally(()=>{e.signal.aborted||_(!1)})},350);return()=>{clearTimeout(t),e.abort()}},[r,a]),l?(0,U.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-ink-faint`,children:n(`正在读取已保存计划…`,`Loading saved timeline…`)}):(0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 p-4 sm:p-6`,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs text-blue`,children:`PROPOSAL → EXPERIMENT → PAPER`}),(0,U.jsx)(`h2`,{className:`mt-1 text-xl font-semibold`,children:n(`研究排期`,`Research timeline`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`选择 idea 和期望期限,查看具体工期、实验排布与调整原因。`,`Choose an idea and deadline to see estimates, experiment schedules, and reasons for changes.`)})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(`button`,{className:$,disabled:m||!d,onClick:async()=>{h(!0),y(``),C(``);try{i(await B.timelineExample()),E(n(`加载演示 proposal`,`Load demonstration proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`加载论文示例`,`Load paper example`)}),(0,U.jsx)(`button`,{className:$,disabled:m,onClick:()=>A(e=>e+1),children:n(`重新载入已保存计划`,`Reload saved timeline`)}),r&&(0,U.jsx)(`button`,{className:$,onClick:()=>T(new Blob([JSON.stringify(r,null,2)],{type:`application/json`}),`proposal.json`),children:n(`导出 proposal`,`Export proposal`)})]})]}),v&&(0,U.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[v,(0,U.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n(`若提示版本冲突,先导出当前草稿,再重新载入已保存计划。`,`For a version conflict, export your draft before reloading the saved timeline.`)})]}),S&&(0,U.jsx)(`p`,{role:`status`,className:`rounded-xl border border-blue/40 p-3 text-sm`,children:S}),!r&&(0,U.jsxs)(`section`,{className:`rounded-xl border border-dashed border-line p-8 text-center`,children:[(0,U.jsx)(`h3`,{className:`font-medium`,children:n(`还没有研究排期`,`No research timeline yet`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`点击“加载论文示例”即可验证完整流程,也可以在下方导入自己的 proposal。示例数字仅用于演示。`,`Load the paper example to try the complete flow, or import your proposal below. Example numbers are illustrative.`)})]}),r&&(0,U.jsxs)(`div`,{className:`grid items-start gap-6`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 360px), 1fr))`},children:[(0,U.jsxs)(`fieldset`,{disabled:m,className:`min-w-0 space-y-5`,children:[(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`选择 idea / proposal`,`Choose idea / proposal`),(0,U.jsx)(`select`,{"aria-label":n(`选择 idea / proposal`,`Choose idea / proposal`),className:Q,value:r.selected_proposal_id,onChange:e=>i({...r,selected_proposal_id:e.target.value}),children:r.proposals.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`方案名称`,`Proposal title`),(0,U.jsx)(`input`,{className:Q,value:r.proposals.find(e=>e.id===r.selected_proposal_id).title,onChange:e=>i({...r,proposals:r.proposals.map(t=>t.id===r.selected_proposal_id?{...t,title:e.target.value}:t)})})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`期望完成时间(小时)`,`Target finish (hours)`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`0`,step:`any`,value:r.deadline_hours??``,placeholder:n(`不限`,`No deadline`),onChange:e=>i({...r,deadline_hours:e.target.value===``?null:Number(e.target.value)})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`已过去时间(小时)`,`Elapsed time (hours)`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`0`,step:`any`,value:r.now_hours,onChange:e=>i({...r,now_hours:Number(e.target.value)})})]}),Object.entries(r.resources).map(([e,t])=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`可用槽位`,`available slots`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`1`,step:`1`,value:t,onChange:t=>i({...r,resources:{...r.resources,[e]:Number(t.target.value)}})})]},e))]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`所有时间从项目开始计时;例如 120 小时 = 第 5 天。资源按持续可用计算。`,`All times count from project start; 120 hours means day 5. Resources are assumed continuously available.`)}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:r.adapt_to_deadline??!1,onChange:e=>i({...r,adapt_to_deadline:e.target.checked})}),n(`根据期限自动重排任务、选择替代做法并更新区间`,`Adapt task order, execution options and estimate ranges to the deadline`)]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`缩短期限时优先调整关键路径;延长期限时恢复原做法和可选工作。替代做法可在任务中编辑。`,`Tighter deadlines prioritize the critical path; longer deadlines restore preferred approaches and optional work. Edit alternatives inside each task.`)}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:r.defer_optional,onChange:e=>i({...r,defer_optional:e.target.checked})}),n(`超期时延后可选任务,保留必需实验`,`Defer optional tasks when over deadline; keep required experiments`)]}),(0,U.jsx)(`button`,{className:$,onClick:()=>{let e=r.proposals.length+1;for(;r.proposals.some(t=>t.id===`idea-${e}`);)e++;let t=`idea-${e}`;i({...r,selected_proposal_id:t,proposals:[...r.proposals,{id:t,title:n(`新 proposal`,`New proposal`),tasks:[{id:`validation`,title:n(`关键假设验证`,`Validate the key premise`),phase:`validation`,duration_hours:[2,4,16],basis:n(`初步估计,待校准`,`Preliminary, uncalibrated estimate`)}]}]})},children:n(`添加候选方案`,`Add proposal`)})]}),(0,U.jsx)(vt,{input:r,onChange:i,text:n,forecast:g?void 0:s?.proposals.find(e=>e.id===r.selected_proposal_id)}),(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`本次保存 / 调整原因`,`Reason for this revision`),(0,U.jsx)(`textarea`,{"aria-label":n(`本次保存 / 调整原因`,`Reason for this revision`),className:Q,value:w,onChange:e=>E(e.target.value),placeholder:n(`说明为什么改变计划;延期请在具体任务中填写证据`,`Explain the change; add delay evidence on the affected task`)})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[a?n(`已保存 v${a.version}`,`Saved v${a.version}`):n(`未保存`,`Not saved`),j?n(` · 有未保存修改`,` · Unsaved changes`):``]}),(0,U.jsx)(`button`,{className:`${$} border-blue bg-blue/10`,disabled:!d||!j||!s||g||!!b||!w.trim(),onClick:async()=>{if(!(!r||!s||g||!w.trim())){h(!0),y(``),C(``);try{let t=await B.timelineSave(e,r,a?.version??0,w);o(t),i(t.input),c(t.report),E(``),C(n(`已保存版本 ${t.version},刷新页面后仍可查看。`,`Version ${t.version} saved. It survives a page refresh.`))}catch(e){y(e.message)}finally{h(!1)}}},children:n(`保存计划版本`,`Save timeline version`)})]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`保存计划不会启动实验。实际进展和失败原因由实验结果或操作者更新。`,`Saving a timeline does not start experiments. Update progress and failure reasons from actual results.`)})]})]}),(0,U.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[g&&(0,U.jsx)(`p`,{role:`status`,className:`text-sm text-ink-faint`,children:n(`正在更新排期…`,`Updating schedule…`)}),b&&(0,U.jsxs)(`p`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[n(`无法计算,请检查估计区间、依赖和资源:`,`Cannot calculate; check ranges, dependencies, and resources: `),b]}),!g&&s&&(0,U.jsx)(yt,{report:s,selectedId:r.selected_proposal_id,text:n})]})]}),(0,U.jsxs)(`details`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:n(`导入自己的 proposal(JSON)`,`Import your proposal (JSON)`)}),(0,U.jsx)(`textarea`,{className:`${Q} mt-3 font-mono`,rows:6,"aria-label":n(`Proposal JSON`,`Proposal JSON`),value:D,onChange:e=>O(e.target.value)}),(0,U.jsx)(`button`,{className:`${$} mt-2`,disabled:!d||m||!D.trim(),onClick:async()=>{h(!0),y(``);try{let e=JSON.parse(D);await B.timelineEstimate(e),i(bt(e)),E(n(`导入 proposal`,`Import proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`校验并导入`,`Validate and import`)})]})]})}var St=[{id:`timeline`,zh:`研究排期`,en:`Research timeline`,zhDesc:`比较 proposal 工期,安排实验,并追踪延期原因。`,enDesc:`Compare proposal estimates, schedule experiments, and track delays.`,icon:ye,color:`blue`},{id:`experiments`,zh:`运行进程`,en:`Execution`,zhDesc:`查看当前步骤、任务路线,以及团队里谁在做什么。`,enDesc:`Follow the current step, the task route, and who on the team is doing what.`,icon:we,color:`blue`},{id:`ide`,zh:`AI IDE`,en:`AI IDE`,zhDesc:`阅读项目文件,查看 Git 状态与 Argus 活动。`,enDesc:`Read project files, Git state, and Argus activity.`,icon:A,color:`emerald`}],Ct=[{id:`overview`,zh:`项目概览`,en:`Project overview`,icon:Te},...St];function wt(e){let{text:t}=H(),n=e.snapshot.mission_view?.mission.objective||e.status?.continuous?.objective||e.project.objective||``;return(0,U.jsxs)(`div`,{className:`overview-page`,children:[(0,U.jsx)(`section`,{className:`overview-hero overview-hero--plain`,children:(0,U.jsxs)(`div`,{className:`overview-hero__copy`,children:[(0,U.jsx)(`h1`,{children:e.snapshot.session.display_name||e.project.label}),(0,U.jsx)(`p`,{children:n||t(`尚未设置目标。`,`No objective has been set.`)}),(0,U.jsx)(oe,{session:e.snapshot.session})]})}),(0,U.jsx)(`div`,{className:`overview-section-heading`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{children:t(`项目工作区`,`Project workspace`)}),(0,U.jsx)(`p`,{children:t(`这些入口展示同一项目的排期、运行进程与代码工作区。`,`These views show the same project’s timeline, execution and code workspace.`)})]})}),(0,U.jsx)(`section`,{className:`module-grid`,children:St.map(n=>{let r=n.icon;return(0,U.jsxs)(`button`,{className:`module-card`,type:`button`,onClick:()=>e.navigate(n.id),children:[(0,U.jsx)(`span`,{className:`module-card__icon module-card__icon--${n.color}`,children:(0,U.jsx)(r,{size:20})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:t(n.zh,n.en)}),(0,U.jsx)(`p`,{children:t(n.zhDesc,n.enDesc)})]}),(0,U.jsx)(k,{size:16})]},n.id)})})]})}function Tt(e){let t=String(e.event_id??e.id??``);if(t)return t;let n=String(e.message_id??``);return n?`${e.type??``}:${n}:${e.kind??``}`:[e.type??``,e.ts??``,e.agent_layer??e.actor??``,e.kind??``,String(e.text??e.title??e.reason??``).slice(0,160)].join(`|`)}function Et(e,t){let n=[...e],r=new Map(n.map((e,t)=>[Tt(e),t]));return t.forEach(e=>{let t=Tt(e),i=r.get(t);i==null?(r.set(t,n.length),n.push(e)):n[i]={...n[i],...e}}),n.sort((e,t)=>Number(e.ts??0)-Number(t.ts??0)).slice(-600)}function Dt(e=!0){return r({queryKey:[`v2-projects`],queryFn:({signal:e})=>B.projects(e),enabled:e,refetchInterval:1e4})}function Ot(e,t=!0){let n=i(),[o,s]=(0,I.useState)([]),[c,l]=(0,I.useState)(!1),u=(0,I.useRef)(null),d=!!e&&t,f=r({queryKey:[`v2-snapshot`,e],queryFn:({signal:t})=>B.snapshot(e,t),enabled:d,refetchInterval:5e3}),p=r({queryKey:[`v2-status`,e],queryFn:({signal:t})=>B.status(e,t),enabled:d,refetchInterval:6e3}),m=r({queryKey:[`v2-events`,e],queryFn:({signal:t})=>B.events(e,220,t),enabled:d,refetchInterval:15e3});(0,I.useEffect)(()=>{s([]),l(!1)},[e]),(0,I.useEffect)(()=>{!e||!m.data||s(e=>Et(e,m.data))},[m.data,e]),(0,I.useEffect)(()=>{if(!e||!t){l(!1);return}let r=Le(e,t=>{s(e=>Et(e,[t])),u.current??=window.setTimeout(()=>{u.current=null,n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]})},900)},l);return()=>{r.close(),l(!1),u.current!=null&&(window.clearTimeout(u.current),u.current=null)}},[t,n,e]);let h=async()=>{e&&await Promise.all([n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]}),n.invalidateQueries({queryKey:[`v2-events`,e]})])},g=a({mutationFn:()=>B.startDaemon(e,f.data?.daemon_commands?.revision),onSuccess:h}),_=a({mutationFn:t=>B.stopDaemon(e,t,f.data?.daemon_commands?.revision),onSuccess:h}),v=(0,I.useMemo)(()=>{let e=[f,p,m].find(e=>e.error);return e?.error instanceof Error?e.error:null},[m,f,p]);return{snapshot:f,status:p,events:o,connected:c,refresh:h,controls:{start:g,stop:_},error:v}}function kt({sid:e,active:t}){let{locale:n}=p(),[r,i]=(0,I.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`module`);return Ct.find(t=>t.id===e)?.id??`overview`}),[a,o]=(0,I.useState)(()=>new Set([r])),s=(0,I.useCallback)(e=>{i(e),o(t=>t.has(e)?t:new Set([...t,e]))},[]),c=Dt(t),l=c.data?.projects??[],u=(0,I.useMemo)(()=>l.find(t=>t.id===e)??null,[l,e]),d=Ot(e,t),f=r,m=d.controls.start.error||d.controls.stop.error,h=u&&d.snapshot.data?{sid:e,active:t,project:u,snapshot:d.snapshot.data,status:d.status.data,events:d.events,connected:d.connected,snapshotUpdatedAt:d.snapshot.dataUpdatedAt,refresh:d.refresh,controls:{start:async()=>{try{return await d.controls.start.mutateAsync()}catch{return null}},stop:async e=>{try{return await d.controls.stop.mutateAsync(e)}catch{return null}},busy:d.controls.start.isPending||d.controls.stop.isPending,error:m instanceof Error?m.message:``},navigate:s}:null;return(0,U.jsxs)(`section`,{className:`integrated-workbench flex min-h-0 flex-1 flex-col bg-transparent text-ink`,children:[(0,U.jsx)(`nav`,{className:`workbench-module-tabs shrink-0 border-b border-line/60 px-3 py-2`,"aria-label":n===`zh-CN`?`工作台模块`:`Workbench modules`,children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Ct.map(({id:e,zh:t,en:r,icon:i})=>(0,U.jsxs)(`button`,{type:`button`,className:`workbench-module-tab`,"data-module":e,"data-selected":f===e,"aria-pressed":f===e,onClick:()=>s(e),children:[(0,U.jsx)(i,{size:14}),(0,U.jsx)(`span`,{children:n===`zh-CN`?t:r})]},e))})}),c.isError&&!u||d.snapshot.isError&&!d.snapshot.data?(0,U.jsx)(G,{title:n===`zh-CN`?`工作台读取失败`:`Workbench unavailable`,description:`Argus API did not return the selected project.`}):h?Ct.filter(({id:e})=>a.has(e)).map(({id:n})=>(0,U.jsx)(`div`,{className:`ros-content min-h-0 flex-1 overflow-x-hidden overflow-y-auto ${f===n?``:`hidden`}`,"aria-hidden":f!==n,children:n===`overview`?(0,U.jsx)(wt,{...h,active:t&&f===n}):n===`timeline`?(0,U.jsx)(xt,{sid:e}):n===`experiments`?(0,U.jsx)(ct,{...h,active:t&&f===n}):(0,U.jsx)(gt,{...h,active:t&&f===n})},`${e}:${n}`)):(0,U.jsx)(`div`,{className:`boot-state`,children:(0,U.jsx)(Ye,{label:n===`zh-CN`?`正在载入工作台`:`Loading workbench`})})]})}export{kt as ResearchWorkbenchPanel}; \ No newline at end of file diff --git a/frontend/web/dist/assets/ResearchWorkbenchPanel-JZm5wBvl.js b/frontend/web/dist/assets/ResearchWorkbenchPanel-JZm5wBvl.js new file mode 100644 index 000000000..0e0f9de4a --- /dev/null +++ b/frontend/web/dist/assets/ResearchWorkbenchPanel-JZm5wBvl.js @@ -0,0 +1,12 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i,n as a}from"./query-CUzIxVzm.js";import{C as o,F as s,H as c,I as l,L as u,O as d,U as f,k as p}from"./index-W1lBlVkr.js";import{A as m,C as h,F as g,I as _,L as v,M as y,O as b,R as x,S,_ as C,b as w,n as T,s as E,w as D,x as O}from"./AppearanceControls-BFWF0z-J.js";import{n as k,t as A}from"./code-xml-DwzUAooI.js";import{n as j,t as M}from"./play-CwpVgDoP.js";import{a as ee,i as te}from"./useWorkbenchTheme-D7cPkLzc.js";import{Mt as ne,Tt as re,W as ie,_ as N,_t as P,bt as ae,g as oe,h as se,ht as ce,jt as le,kt as ue,m as de,mt as fe,pt as pe,r as me,v as he,xt as ge,y as _e,yt as ve}from"./App-DaQfrTdA.js";var ye=x(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),be=x(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),xe=x(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Se=x(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Ce=x(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),we=x(`FlaskConical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Te=x(`FolderKanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),Ee=x(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),De=x(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),Oe=x(`LockKeyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),ke=x(`Radio`,[[`path`,{d:`M4.9 19.1C1 15.2 1 8.8 4.9 4.9`,key:`1vaf9d`}],[`path`,{d:`M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5`,key:`u1ii0m`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5`,key:`1j5fej`}],[`path`,{d:`M19.1 4.9C23 8.8 23 15.1 19.1 19`,key:`10b0cb`}]]),Ae=x(`Server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),je=x(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Me=x(`UserRound`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Ne=x(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),F=e(t(),1),Pe=12e3;function I(e=!1){let t={...s()};return e&&(t[`Content-Type`]=`application/json`),t}async function L(e,t={}){await u();let n={...t,headers:{...I(!!t.body),...t.headers??{}},cache:`no-store`},r=String(t.method??`GET`).toUpperCase(),i=async n=>{if(!n.ok){let r=await n.text().catch(()=>``),i=r;try{i=JSON.parse(r).detail??r}catch{}throw Error(i||`${t.method??`GET`} ${e} failed (${n.status})`)}return await n.json()};return r===`GET`?c(e,n,Pe,i):i(await fetch(e,n))}var R=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`,Fe=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`;function Ie(e){let t=e.replaceAll(`\r +`,` +`).split(` + +`),n=t.pop()??``,r=[];return t.forEach(e=>{e.split(` +`).forEach(e=>{if(e.startsWith(`data:`))try{let t=JSON.parse(e.slice(5).trim());r.push(t)}catch{}})}),{frames:r,rest:n}}function Le(e,t){let n=String(e.type??``);if(n===`phase`)t.onPhase?.(String(e.label??``),String(e.role??`manager`),String(e.detail??``),e.heartbeat===!0);else if(n===`delta`)t.onDelta?.(String(e.text??``),String(e.fragment_mode??`auto`));else if(n===`done`){let n=e.result??{};return t.onDone?.(n),n}else if(n===`error`)throw Error(String(e.error??`Manager stream failed`));return null}var z={timelineExample:()=>L(`/api/research/timeline/example`),timelineEstimate:(e,t)=>L(`/api/research/timeline/estimate`,{method:`POST`,body:JSON.stringify(e),signal:t}),timelineLatest:e=>L(R(e,`/research/timeline`)),timelineSave:(e,t,n,r)=>L(R(e,`/research/timeline`),{method:`POST`,body:JSON.stringify({input:t,expected_version:n,reason:r})}),projects:e=>L(`/api/projects`,{signal:e}),snapshot:(e,t)=>L(R(e,`/snapshot?events_limit=40&compact=false`),{signal:t}),status:(e,t)=>L(R(e,`/status`),{signal:t}),events:(e,t=180,n)=>L(R(e,`/events?limit=${t}&view=ui`),{signal:n}).then(e=>e.events),transcript:(e,t=100,n)=>L(R(e,`/transcript?n=${t}`),{signal:n}).then(e=>e.turns),journal:(e,t=80,n)=>L(R(e,`/journal?n=${t}`),{signal:n}).then(e=>e.journal),artifacts:(e,t)=>L(R(e,`/artifacts`),{signal:t}).then(e=>e.artifacts),counterexamples:(e,t)=>L(R(e,`/counterexamples`),{signal:t}),artifact:(e,t,n)=>L(R(e,`/artifact?${new URLSearchParams({path:t})}`),{signal:n}),artifactBlob:async(e,t,n=!1,r)=>{await u();let i=new URLSearchParams({path:t});n&&i.set(`download`,`true`);let a=R(e,`/artifact/raw?${i}`);return c(a,{headers:I(),signal:r,cache:`no-store`},Pe,async e=>{if(!e.ok)throw Error(`Artifact unavailable (${e.status})`);return e.blob()})},gitDiff:(e,t)=>L(R(e,`/git-diff`),{signal:t}),rewritePrompt:(e,t,n)=>L(R(e,`/prompt/rewrite`),{method:`POST`,body:JSON.stringify({text:t}),signal:n}),note:(e,t)=>L(R(e,`/note`),{method:`POST`,body:JSON.stringify({text:t})}),uploadAttachments:async(e,t,n)=>{await u();let r=new FormData;t.forEach(e=>r.append(`files`,e,e.name));let i=await fetch(R(e,`/attachments`),{method:`POST`,headers:I(),body:r,signal:n});if(!i.ok)throw Error(await i.text()||`attachment upload failed (${i.status})`);return await i.json()},createDaemon:(e,t=``,n=``)=>L(`/api/daemons`,{method:`POST`,body:JSON.stringify({objective:e,name:t,workdir:n,command_id:Fe()})}),createFinalReview:(e,t)=>L(R(e,`/reviews/final`),{method:`POST`,body:JSON.stringify(t)}),startDaemon:(e,t)=>L(R(e,`/daemon/start`),{method:`POST`,body:JSON.stringify({command_id:Fe(),expected_revision:t})}).then(f),stopDaemon:(e,t,n)=>L(R(e,`/daemon/stop`),{method:`POST`,body:JSON.stringify({drain:t,command_id:Fe(),expected_revision:n})}).then(f),async messageStream(e,t,n={},r,i=[]){await u();let a=R(e,`/message/stream`),o=await fetch(a,{method:`POST`,headers:I(!0),body:JSON.stringify(i.length?{text:t,attachments:i}:{text:t}),signal:r});if(!o.ok){let e=await o.text().catch(()=>``);throw Error(e||`Manager request failed (${o.status})`)}if(!o.body)throw Error(`Manager returned an empty stream`);let s=o.body.getReader(),c=new TextDecoder,l=``,d={};for(;;){let e=await s.read();if(e.done)break;l+=c.decode(e.value,{stream:!0});let t=Ie(l);l=t.rest,t.frames.forEach(e=>{let t=Le(e,n);t&&(d=t)})}return Ie(`${l}\n\n`).frames.forEach(e=>{let t=Le(e,n);t&&(d=t)}),d}};function Re(e,t,n){let r=!1,i=null,a,o=800,s=()=>{if(r)return;let c=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({replay:`40`,view:`ui`}),d=l();d&&u.set(`token`,d),i=new WebSocket(`${c}//${window.location.host}${R(e,`/stream`)}?${u}`),i.onopen=()=>{o=800,n(!0)},i.onmessage=e=>{try{t(JSON.parse(String(e.data)))}catch{}},i.onerror=()=>i?.close(),i.onclose=e=>{n(!1),!(r||e.code===4401||e.code===4404)&&(a=window.setTimeout(s,o),o=Math.min(o*1.7,8e3))}};return s(),{close:()=>{r=!0,a&&window.clearTimeout(a),i?.close()}}}var ze={active:[`进行中`,`In progress`],claimed:[`进行中`,`In progress`],in_progress:[`进行中`,`In progress`],running:[`进行中`,`In progress`],working:[`进行中`,`In progress`],pending:[`等待中`,`Waiting`],queued:[`等待中`,`Waiting`],waiting:[`等待中`,`Waiting`],idle:[`等待中`,`Waiting`],accepted:[`已完成`,`Completed`],complete:[`已完成`,`Completed`],completed:[`已完成`,`Completed`],done:[`已完成`,`Completed`],success:[`已完成`,`Completed`],blocked:[`已阻塞`,`Blocked`],failed:[`失败`,`Failed`],error:[`失败`,`Failed`],rejected:[`需要修改`,`Needs changes`],continue:[`需要修改`,`Needs changes`],replan:[`需要重新规划`,`Needs replanning`],replan_requested:[`需要重新规划`,`Needs replanning`],incomplete:[`尚未完成`,`Incomplete`],research_incomplete:[`研究尚未完成`,`Research incomplete`],paused_no_breakthrough:[`暂未取得突破,已暂停`,`Paused without a breakthrough`],exhausted_current_methods:[`当前方法已尝试完`,`Current methods exhausted`],no_progress:[`暂无新进展,已暂停`,`Paused without new progress`],max_rounds:[`已到本次轮次上限`,`Round limit reached`],infra_blocked:[`等待运行条件恢复`,`Waiting for the runtime to recover`],supervisor_error:[`执行异常`,`Execution failed`],skipped:[`已跳过`,`Skipped`],paused:[`已暂停`,`Paused`],paused_cost:[`费用待对账`,`Awaiting usage reconciliation`],stopped:[`已暂停`,`Paused`],cancelled:[`已暂停`,`Paused`],aborted:[`已暂停`,`Paused`],not_started:[`等待中`,`Waiting`],healthy:[`状态正常`,`Healthy`],degraded:[`部分受限`,`Limited`]},Be={system:[`Argus`,`Argus`],operator:[`你`,`You`],stopped:[`已暂停`,`Paused`],idle:[`等待中`,`Waiting`]};function Ve(e,t,n,r){let i=t[String(e??``).toLowerCase()]??n;return r(i[0],i[1])}function He(e,t){return String(e??``).startsWith(`paused_`)&&!ze[String(e)]?t(`已暂停`,`Paused`):Ve(e,ze,[`状态已更新`,`Status updated`],t)}function B(e,t){let n=String(e??``).toLowerCase();return D(n)?h(n,e=>t(d(e,{},`zh-CN`),d(e,{},`en`))):Ve(e,Be,[`Argus`,`Argus`],t)}function V(){let{locale:e,t}=p();return{locale:e,text:(0,F.useCallback)((t,n)=>e===`zh-CN`?t:n,[e]),t}}function H(...e){return e.filter(Boolean).join(` `)}function Ue(e){let t=Math.max(0,Math.floor(Number(e??0)));if(t<60)return`${t}s`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n?`${n}d ${r}h`:r?`${r}h ${i}m`:`${i}m`}function We(e,t){return e?new Date(e*1e3).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}):`—`}function Ge(e){let t=String(e??``).toLowerCase();return/failed|error|blocked|rejected|stalled|dead|abort/.test(t)?`danger`:/warn|waiting|paused|hold|queued|pending|continue/.test(t)?`warn`:/done|complete|completed|accepted|healthy|success|passed/.test(t)?`success`:/run|active|work|claimed|progress|live/.test(t)?`live`:/research|plan|info|ready/.test(t)?`info`:`neutral`}function Ke(e){let t=String(e.agent_layer??e.actor??``).toLowerCase();if(t===`main`||t.startsWith(`engineer`))return`engineer`;if(t.startsWith(`review`))return`reviewer`;if(t.startsWith(`plan`))return`planner`;if(t.startsWith(`manager`))return`manager`;let n=String(e.type??``);return/review/.test(n)?`reviewer`:/planner/.test(n)?`planner`:/manager/.test(n)?`manager`:/engineer|round/.test(n)?`engineer`:`system`}function qe(e,t){let n=String(e.action_summary??``).trim();if(n)return t?_e(n,t):n;let r=String(e.title??``).trim();if(r)return t?_e(r,t):r;let i=t?N(String(e.type??``),t):null;if(i)return i;let a=String(e.kind??``).trim();return a?a.replaceAll(`_`,` `):String(e.type??`event`).split(`.`).slice(-2).join(` · `).replaceAll(`_`,` `)}function Je(e,t=400){let n=String(e.text??e.reason??e.summary??e.detail??``).trim();return n?n.length>t?`${n.slice(0,t)}…`:n:``}var U=n();function W({children:e,tone:t=`neutral`,dot:n=!1,className:r}){return(0,U.jsxs)(`span`,{className:H(`badge`,`badge--${t}`,r),children:[n?(0,U.jsx)(`span`,{className:H(`badge__dot`,t===`live`&&`is-pulsing`)}):null,e]})}function G({icon:e=Se,title:t,description:n,action:r}){return(0,U.jsxs)(`div`,{className:`empty-state`,children:[(0,U.jsx)(`span`,{className:`empty-state__icon`,children:(0,U.jsx)(e,{size:19})}),(0,U.jsx)(`div`,{className:`empty-state__title`,children:t}),n?(0,U.jsx)(`p`,{children:n}):null,r?(0,U.jsx)(`div`,{className:`empty-state__action`,children:r}):null]})}function Ye({label:e}){let{text:t}=V();return(0,U.jsxs)(`span`,{className:`spinner`,role:`status`,children:[(0,U.jsx)(re,{size:15,className:`spin`}),` `,e||t(`加载中`,`Loading`)]})}function Xe({events:e,limit:t=24,empty:n,dense:r=!1}){let{locale:i,text:a}=V(),o=e.slice(-t).reverse();return o.length?(0,U.jsx)(`div`,{className:H(`event-list`,r&&`event-list--dense`),children:o.map((e,t)=>{let n=Ke(e),o=qe(e,i),s=oe(Je(e,r?180:480),i).text,c=Ge(String(e.status??e.kind??e.type??``));return(0,U.jsxs)(`article`,{className:`event-row`,children:[(0,U.jsx)(`div`,{className:H(`event-row__marker`,`event-row__marker--${c}`)}),(0,U.jsxs)(`div`,{className:`event-row__content`,children:[(0,U.jsxs)(`div`,{className:`event-row__meta`,children:[(0,U.jsx)(`span`,{className:`role-label`,style:{color:O(n)},children:B(n,a)}),(0,U.jsx)(`time`,{children:We(e.ts,i)})]}),(0,U.jsx)(`div`,{className:`event-row__title`,children:o}),s?(0,U.jsx)(`div`,{className:`event-row__detail`,children:s}):null]})]},`${e.type}-${e.ts}-${e.message_id??t}`)})}):(0,U.jsx)(G,{icon:ke,title:n||a(`还没有可展示的实时动态`,`No activity to show yet`)})}var Ze=new Set([`done`,`completed`,`accepted`,`success`]),Qe=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]),$e=/continue|replan|reject|blocked|fail|error|incomplete|revoked/,et=new Set([`assistant_message`,`agent_message`,`message`]),tt=new Set([`life.planner.task_added`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`life.phase.started`,`life.manager.stage_decision`,`round.start`,`round.main.completed`,`round.review.started`,`round.review.completed`,`round.review.deferred`,`round.backend_failure.backoff`,`work.segment`,`work.segment.started`,`work.segment.completed`]);function nt(e){let t=String(e.type??``),n=String(e.kind??``);return n!==`reasoning`&&!o(e)&&(tt.has(t)||t===`engineer.progress`&&(et.has(n)||[`tool_use`,`tool_result`,`command_execution`,`file_change`].includes(n)))}function rt(e){return e.type!==`engineer.progress`||!et.has(String(e.kind??``))?e:{...e,text:ie(String(e.text??``)),action_summary:ie(String(e.action_summary??``)),title:ie(String(e.title??``))}}function it(e,t){return t?e.backlog.find(e=>e.id===t)??null:e.backlog.find(e=>Qe.has(e.status))??e.backlog.find(e=>e.status===`pending`)??e.backlog.at(-1)??null}function K(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function at(e,t,n=Date.now()/1e3,r=`zh-CN`){let i=(e,t)=>r===`zh-CN`?e:t,a=e.mission_view,o=pe(e,a,t,n),s=it(e,o.taskId||a?.mission.id||``),c=s?.id||a?.mission.id||``,l=!!(c&&c===a?.mission.id),u=a?.dag?.length?a.dag:e.backlog,d=u.filter(e=>Ze.has(e.status)).length,f=u.filter(e=>/^(pending|queued|waiting)$/.test(e.status)).length,p=!!(a?.routing?.open_ended||a?.routing?.lifetime===`standing`||e.continuous?.open_ended),m=K(s?.started_ts)??(l?K(a?.mission.started_at):null),h=K(s?.finished_ts)??(l?K(a?.mission.completed_at):null),g=e.backlog.filter(e=>Qe.has(e.status)).length>1,_=t.filter(e=>{if(!c||m!==null&&Number(e.ts??0)Number(e.ts??0)-Number(t.ts??0)),v=_.filter(nt).map(rt).filter(e=>!et.has(String(e.kind??``))||!!(e.text||e.action_summary||e.title)),y=v.at(-1),b=o.state===`running`,x=h??(e.daemon.alive?n:K(_.at(-1)?.ts)??m),S=m===null||x===null?null:Math.max(0,x-m),C=[..._].reverse().find(e=>fe(e)===c&&e.type===`round.start`),w=Math.max(l?Number(a?.round.current??0):0,Number(C?.round_index??0)),T=[..._].reverse().find(e=>fe(e)===c&&e.type===`round.start`&&Number(e.round_index)===w),E=_.filter(e=>{if(fe(e)!==c||w<=0||T&&Number(e.ts??0)0?t===w:T!=null&&Number(e.ts??0)>=Number(T.ts??0)}),D=[...E].reverse().find(e=>e.type===`round.review.completed`),O=[...E].reverse().find(e=>e.type===`round.review.started`),k=!!(O&&(!D||Number(O.ts)>Number(D.ts))),A=b&&o.role===`reviewer`&&k,j=k?void 0:D,M=String(j?.status??``).toLowerCase(),ee=l?String(a?.review.status??``).toLowerCase():``,te=j?.review_skipped===!0||M===`skipped`,ne=j?.review_source===`engineer_self_review`,re=!j?.review_source||j.review_source===`reviewer`,ie=!te&&re&&M===`done`,N=!te&&($e.test(M)||!j&&!A&&$e.test(ee)),P=A?`running`:te?`skipped`:ie?`passed`:ne&&M===`done`?`self_checked`:N?`needs_work`:`pending`,ae={pending:i(`结论待核对`,`Conclusion awaiting review`),running:i(`正在核对证据`,`Checking the evidence`),passed:i(`本轮工作通过核对`,`This round passed review`),needs_work:i(`仍需补充或修改`,`More work is needed`),skipped:i(`本轮未做审查`,`This round was not reviewed`),self_checked:i(`执行者已自查,待独立核对`,`Self-checked; independent review pending`)},oe={pending:i(`尚无能对应到当前工作项和轮次的通过记录。`,`No passing review is linked to the current work item and round.`),running:i(`审阅者正在核对本轮结果及其证据。`,`The Reviewer is checking this round’s results and evidence.`),passed:i(`通过记录仅适用于本轮提交的工作与证据。`,`The passing verdict applies to the work and evidence submitted in this round.`),needs_work:i(`审查发现仍有待处理的问题,需要继续工作。`,`The review found issues that require further work.`),skipped:i(`执行结束并不代表证据已经通过核对。`,`The end of execution does not establish that the evidence passed review.`),self_checked:i(`这条记录来自执行者自查,尚无本轮独立审查通过记录。`,`This record is a self-check by the worker; no independent passing review is recorded for this round.`)},se={state:P,label:ae[P],detail:String(j?.reason||N&&a?.review.reason||oe[P]),scope:i(`当前工作项${w>0?` · 第 ${w} 轮`:``}。整体目标是否成立,仍须核对其完整验收条件。`,`Current work item${w>0?` · Round ${w}`:``}. The overall goal still requires checking its full acceptance criteria.`)},le=[...E].reverse().find(e=>e.type===`round.main.completed`),ue=P===`passed`?`done`:P===`running`?`active`:P===`needs_work`?`blocked`:`pending`,de=[{id:`plan`,label:i(`工作项已记录`,`Work item recorded`),detail:s?.title||a?.mission.title||i(`等待任务`,`Waiting for a task`),status:s||l?`done`:`pending`},{id:`start`,label:i(`开始执行`,`Execution started`),detail:m===null?i(`尚无启动记录`,`No start is recorded`):i(`有任务启动时间记录`,`A task start time is recorded`),status:m===null?`pending`:`done`},{id:`handoff`,label:i(`本轮执行已结束`,`Round execution ended`),detail:le?i(`已记录本轮执行结束,结果是否可用仍需核对`,`The round’s execution ended; its results still need to be checked`):i(`尚无本轮执行结束记录`,`No end of execution is recorded for this round`),status:le?`done`:b&&o.role===`engineer`?`active`:`pending`},{id:`review`,label:i(`核对本轮证据`,`Check this round’s evidence`),detail:se.label,status:ue}],me=!!(s&&Ze.has(s.status))||l&&[`complete`,`completed`,`done`].includes(a?.mission.status??``),he=e.daemon.alive?p?i(`开放研究的剩余工作量尚不确定,无法可靠预计整体完成时间。`,`Open research has no known remaining workload, so its overall finish time cannot be reliably estimated.`):N?i(`审查要求继续补充或调整工作范围,暂无法预计完成时间。`,`Review requires further work or a scope change; a finish time is unavailable.`):me?i(`当前工作项已结束;这不提供整体目标的完成时间。`,`The current work item has ended; this does not establish when the overall goal will be reached.`):i(`当前记录没有可比较的固定工作量基线,暂无法可靠预计完成时间。`,`The current records contain no comparable, fixed-workload baseline for a reliable finish-time estimate.`):i(`运行已停止,无法预计完成时间。`,`Execution has stopped; a finish time is unavailable.`);return{workCompletion:u.length?d/u.length:null,workScope:i(`仅统计已记录的工作项;清单可随研究增减,完成比例不代表整体目标已成立。`,`Counts recorded work items only. The list can change during research; its completion fraction does not establish the overall goal.`),currentTask:s?.title||a?.mission.title||i(`等待新任务`,`Waiting for a new task`),currentTaskId:c,currentObjective:s?.objective||(l?a?.mission.objective:``)||``,currentStep:b&&y?qe(y,r):ce(o,r),currentDetail:y?Je(y,700):s?.objective||``,currentEvent:y??null,runtime:o,elapsedSeconds:S,etaUnavailableReason:he,checkpoints:de,completedTasks:d,totalTasks:u.length,pendingTasks:f,openEnded:p,review:se,acceptanceCriteria:s?.acceptance_check||u.find(e=>e.id===c)?.acceptance_check||``,nextAction:s?.pending_question||String(j?.next_action||``),taskEvents:v}}var ot=new Set([`done`,`completed`,`accepted`,`success`]),st=new Set([`running`,`in_progress`,`claimed`,`active`,`working`]);function ct(e){let{locale:t,text:n,t:r}=V(),[i,a]=(0,F.useState)(()=>Date.now()/1e3),[o,s]=(0,F.useState)(``);(0,F.useEffect)(()=>{if(!e.active||!e.snapshot.daemon.alive)return;a(Date.now()/1e3);let t=window.setInterval(()=>a(Date.now()/1e3),1e3);return()=>clearInterval(t)},[e.active,e.snapshot.daemon.alive]);let c=(0,F.useMemo)(()=>at(e.snapshot,e.events,i,t),[t,i,e.events,e.snapshot]),l=e.snapshot.mission_view,u=l?.dag?.length?l.dag:e.snapshot.backlog.map(e=>({id:e.id,title:e.title,objective:e.objective,status:e.status,deps:e.deps??[],branch_id:e.id,parent_branch_id:``})),d=u.find(e=>e.id===o)??u.find(e=>e.id===c.currentTaskId),f=he(l?.stage.id,t),p=l?.stage.label&&l.stage.label!==l.stage.id?l.stage.label:f||l?.stage.id||n(`尚未记录`,`Not yet recorded`),h=c.runtime.state===`running`,g=ce(c.runtime,t),b=c.taskEvents.filter(e=>String(e.kind??``)!==`reasoning`&&!se(String(e.type??``))),x=oe(c.currentDetail,t),C=c.currentEvent?de(c.currentEvent,t):null,T=oe(c.review.detail,t),D=[{label:n(`已完成的工作`,`Completed work`),items:u.filter(e=>ot.has(e.status))},{label:n(`进行中与待处理`,`Active and remaining work`),items:u.filter(e=>!ot.has(e.status))}],k=async t=>{let r=t?n(`确认完成当前步骤后停止 Argus?`,`Stop Argus after the current step finishes?`):n(`确认立即停止 Argus?当前步骤可能被中断。`,`Stop Argus now? The current step may be interrupted.`);confirm(r)&&await e.controls.stop(t)};return(0,U.jsxs)(`div`,{className:`ros-page experiment-v3`,children:[(0,U.jsxs)(`header`,{className:`ros-page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{children:n(`任务进展`,`Work progress`)}),(0,U.jsx)(`p`,{children:n(`看清做了哪些工作、结论核对到了哪里,以及团队接下来要做什么。`,`See what work was done, which conclusions were checked, and what the team needs to do next.`)})]}),(0,U.jsxs)(`div`,{className:`experiment-header-actions`,children:[(0,U.jsxs)(`button`,{className:`button button--secondary`,type:`button`,onClick:()=>void e.refresh(),children:[(0,U.jsx)(y,{size:14}),n(`刷新`,`Refresh`)]}),e.snapshot.daemon.alive&&e.snapshot.daemon.control_available===!1?null:e.snapshot.daemon.alive?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{className:`button button--secondary`,type:`button`,disabled:e.controls.busy,onClick:()=>void k(!0),children:[(0,U.jsx)(ge,{size:14}),n(`当前步后停止`,`Stop after step`)]}),(0,U.jsxs)(`button`,{className:`button button--danger`,type:`button`,disabled:e.controls.busy,onClick:()=>void k(!1),children:[(0,U.jsx)(ae,{size:13}),n(`立即停止`,`Stop now`)]})]}):(0,U.jsxs)(`button`,{className:`button button--primary`,type:`button`,disabled:e.controls.busy,onClick:()=>void e.controls.start(),children:[(0,U.jsx)(M,{size:14}),n(`继续运行`,`Resume`)]})]})]}),(0,U.jsxs)(`section`,{className:`experiment-progress-hero`,children:[(0,U.jsxs)(`div`,{className:`progress-hero-main`,children:[(0,U.jsxs)(`div`,{className:`progress-live-line`,children:[(0,U.jsx)(W,{tone:h?`live`:`neutral`,dot:h,children:g}),c.runtime.role?(0,U.jsx)(`span`,{children:B(c.runtime.role,n)}):null]}),(0,U.jsx)(`h2`,{children:c.currentTask}),c.currentObjective?(0,U.jsx)(`p`,{className:`work-objective`,children:c.currentObjective}):null,(0,U.jsxs)(`div`,{className:`current-step-callout`,children:[(0,U.jsx)(`span`,{children:(0,U.jsx)(v,{size:17})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`small`,{children:h?n(`当前动作`,`Current action`):n(`当前状态与最近记录`,`Current state and latest record`)}),(0,U.jsx)(`strong`,{children:C?.title||c.currentStep}),C?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{children:C.detail}),(0,U.jsx)(E,{label:n(`原始调用记录`,`Original call record`),children:(0,U.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs`,children:c.currentDetail})})]}):c.currentDetail?(0,U.jsx)(`p`,{title:x.technical||void 0,children:x.text}):null]})]})]}),(0,U.jsxs)(`div`,{className:`progress-number`,children:[(0,U.jsx)(`span`,{children:n(`已完成的工作项`,`Completed work items`)}),(0,U.jsxs)(`strong`,{children:[c.completedTasks,(0,U.jsxs)(`em`,{children:[` / `,c.totalTasks||`—`]})]}),(0,U.jsx)(`small`,{children:n(`按当前记录计数`,`Counted from current records`)})]}),(0,U.jsxs)(`div`,{className:`truthful-progress`,children:[c.workCompletion===null?null:(0,U.jsx)(`div`,{className:`truthful-progress__track`,role:`progressbar`,"aria-label":n(`已记录工作项的完成情况`,`Completion of recorded work items`),"aria-valuemin":0,"aria-valuemax":c.totalTasks,"aria-valuenow":c.completedTasks,"aria-valuetext":n(`${c.totalTasks} 项已记录工作中完成 ${c.completedTasks} 项`,`${c.completedTasks} of ${c.totalTasks} recorded work items completed`),children:(0,U.jsx)(`span`,{className:`confirmed`,style:{width:`${c.workCompletion*100}%`}})}),(0,U.jsx)(`p`,{className:`work-scope`,children:c.workScope})]}),(0,U.jsxs)(`div`,{className:`progress-metrics`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(ue,{size:15}),n(`当前工作项已用时间`,`Current work item elapsed`)]}),(0,U.jsx)(`strong`,{children:c.elapsedSeconds===null?`—`:Ue(c.elapsedSeconds)}),(0,U.jsx)(`small`,{children:n(`按任务启动与结束记录计算`,`Based on recorded task start and end times`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{children:n(`实际记录的阶段`,`Recorded stage`)}),(0,U.jsx)(`strong`,{children:p}),(0,U.jsx)(`small`,{children:n(`阶段名称不表示前面的工作已通过核验`,`The stage name does not certify earlier work`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{children:n(`工作范围`,`Work scope`)}),(0,U.jsx)(`strong`,{children:c.openEnded?n(`开放研究`,`Open research`):n(`当前工作项`,`Current work item`)}),(0,U.jsx)(`small`,{children:c.openEnded?n(`可能产生新的问题和任务`,`New questions and tasks may emerge`):n(`以该工作项的验收条件为准`,`Defined by this item’s acceptance criteria`)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(Ne,{size:15}),n(`等待执行的工作`,`Work waiting to start`)]}),(0,U.jsx)(`strong`,{children:c.pendingTasks}),(0,U.jsx)(`small`,{children:n(`已记录清单中的等待项`,`Waiting items in the recorded list`)})]})]})]}),(0,U.jsxs)(`div`,{className:`experiment-v3-grid`,children:[(0,U.jsxs)(`aside`,{className:`ros-card experiment-task-route`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`工作项`,`Work items`)})}),(0,U.jsx)(W,{tone:`neutral`,children:u.length})]}),(0,U.jsx)(`div`,{children:u.length?D.map(e=>(0,U.jsxs)(`section`,{className:`work-item-group`,children:[(0,U.jsxs)(`h3`,{children:[e.label,(0,U.jsx)(`span`,{children:e.items.length})]}),e.items.length?e.items.map(e=>{let t=h&&e.id===c.currentTaskId&&st.has(e.status),r=st.has(e.status)&&!t?e.id===c.currentTaskId?g:n(`等待状态确认`,`Awaiting status confirmation`):He(e.status,n);return(0,U.jsxs)(`button`,{type:`button`,className:d?.id===e.id?`is-active`:``,onClick:()=>s(e.id),children:[(0,U.jsx)(`span`,{className:`task-state task-state--${ot.has(e.status)?`success`:t?`live`:`neutral`}`,children:ot.has(e.status)?(0,U.jsx)(_,{size:12}):t?(0,U.jsx)(v,{size:12}):(0,U.jsx)(be,{size:9})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.title||e.objective||n(`未命名任务`,`Untitled task`)}),(0,U.jsxs)(`small`,{children:[r,e.deps.length?n(` · 前置工作 ${e.deps.length} 项`,` · ${e.deps.length} dependencies`):``]})]})]},e.id)}):(0,U.jsx)(`p`,{className:`work-group-empty`,children:n(`暂无记录`,`No records yet`)})]},e.label)):(0,U.jsx)(G,{icon:Ne,title:n(`尚无工作项`,`No work items yet`)})})]}),(0,U.jsxs)(`main`,{className:`experiment-v3-center`,children:[(0,U.jsxs)(`section`,{className:`ros-card work-conclusion`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`本轮结论与待核对问题`,`This round’s conclusions and open checks`)})}),(0,U.jsx)(W,{tone:c.review.state===`passed`?`success`:c.review.state===`running`?`live`:`warn`,children:c.review.label})]}),(0,U.jsxs)(`div`,{className:`work-conclusion__body`,children:[(0,U.jsx)(`p`,{title:T.technical||void 0,children:T.text}),c.acceptanceCriteria?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:n(`判断这项工作是否完成的标准`,`How this work item is accepted`)}),(0,U.jsx)(`p`,{children:c.acceptanceCriteria})]}):null,c.nextAction?(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:n(`下一步要处理`,`What needs to happen next`)}),(0,U.jsx)(`p`,{children:c.nextAction})]}):null,(0,U.jsx)(`p`,{className:`work-scope`,children:c.review.scope})]})]}),(0,U.jsxs)(`section`,{className:`ros-card checkpoint-card`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`当前工作项的过程记录`,`Current work item’s recorded steps`)})}),(0,U.jsx)(W,{tone:`neutral`,children:n(`以记录为准`,`Based on records`)})]}),(0,U.jsx)(`div`,{className:`checkpoint-list`,children:c.checkpoints.map((e,t)=>(0,U.jsxs)(`div`,{className:`checkpoint checkpoint--${e.status}`,children:[(0,U.jsx)(`span`,{children:e.status===`done`?(0,U.jsx)(_,{size:13}):e.status===`active`?(0,U.jsx)(v,{size:13}):e.status===`blocked`?(0,U.jsx)(ve,{size:13}):t+1}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.label}),(0,U.jsx)(`p`,{children:e.detail})]}),t{let t=h&&c.runtime.role===e;return(0,U.jsxs)(`article`,{className:t?`is-active`:``,children:[(0,U.jsx)(`span`,{"data-role-dot":e,className:`role-dot`,style:{backgroundColor:O(e)},"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:B(e,n)}),(0,U.jsx)(`p`,{children:S(e,r)})]}),t?(0,U.jsx)(W,{tone:`live`,dot:!0,children:n(`执行中`,`Working`)}):(0,U.jsx)(W,{tone:`neutral`,children:n(`未在执行`,`Not working`)})]},e)})})]}),(0,U.jsxs)(`section`,{className:`ros-card estimate-note`,children:[(0,U.jsx)(`header`,{children:(0,U.jsx)(`div`,{children:(0,U.jsx)(`h2`,{children:n(`还需要多久`,`How much longer?`)})})}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:n(`暂无法可靠预计`,`No reliable estimate yet`)}),c.etaUnavailableReason]}),(0,U.jsxs)(`div`,{className:`work-evidence-note`,children:[(0,U.jsx)(m,{size:15}),(0,U.jsx)(`span`,{children:n(`真实已用时间和已完成工作可以统计。读文件、运行命令或审查结束,都不能换算成整体目标的完成百分比。`,`Elapsed time and completed work can be counted. File reads, commands, and the end of a review do not establish a completion percentage for the overall goal.`)})]}),e.controls.error?(0,U.jsx)(`div`,{className:`inline-error`,children:e.controls.error}):null]})]})]})]})]})}function lt(e){if(!e||e.length>2e5||e.includes(`\0`)||!e.startsWith(`diff --git `)&&!/^--- [^\n]+\n\+\+\+ /.test(e)||/^(?:Binary files |GIT binary patch)/m.test(e))return null;let t=e.match(/[^\n]*\n|[^\n]+$/g)??[];if(t.length>3e3)return null;let n=[],r=0,i=0;for(let e of t){let t=e.replace(/\r?\n$/,``),a,o=/^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@(?:.*)$/.exec(t);if(t.startsWith(`diff --git `))a=`header`,r=0,i=0;else if(o){if(a=`hunk`,r=Number(o[1]??1),i=Number(o[2]??1),!Number.isSafeInteger(r)||!Number.isSafeInteger(i))return null}else if(t===`\\ No newline at end of file`)a=`header`;else if(r||i){if(t.startsWith(`+`))a=`addition`,i--;else if(t.startsWith(`-`))a=`deletion`,r--;else if(t.startsWith(` `))a=`context`,r--,i--;else return null;if(r<0||i<0)return null}else if(/^(?:--- |\+\+\+ |index |old mode |new mode |new file mode |deleted file mode |similarity index |dissimilarity index |rename from |rename to |copy from |copy to )/.test(t))a=`header`;else return null;n.push({kind:a,text:e})}return n}function ut({diff:e,truncated:t=!1}){let{text:n}=V(),r=(0,F.useMemo)(()=>lt(e),[e]),[i,a]=(0,F.useState)(!1),o=r!==null&&!i;return(0,U.jsxs)(`section`,{className:`readonly-diff`,"data-readonly-diff":!0,children:[(0,U.jsxs)(`div`,{className:`readonly-diff__toolbar`,children:[(0,U.jsx)(`strong`,{children:n(`当前工作区差异`,`Current workspace diff`)}),r&&(0,U.jsx)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?n(`着色视图`,`Highlighted view`):n(`原始文本`,`Original text`)}),e&&(0,U.jsx)(C,{text:e,label:n(`复制原始差异`,`Copy original diff`),copiedLabel:n(`已复制`,`Copied`)})]}),(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`不代表所有变更都来自当前 Agent 或任务。`,`Changes are not necessarily from this Agent or task.`)}),t&&(0,U.jsx)(`p`,{role:`status`,className:`readonly-diff__notice`,children:n(`后端返回的差异已截断,当前内容不完整。`,`The backend truncated this diff; the displayed content is incomplete.`)}),e?r?null:(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`无法识别、二进制或较大差异:显示原始文本。`,`Unrecognized, binary or large diff: showing original text.`)}):(0,U.jsx)(`p`,{className:`readonly-diff__hint`,children:n(`没有工作区差异。`,`No workspace diff.`)}),(0,U.jsx)(`pre`,{className:`readonly-diff__text`,tabIndex:0,"aria-label":n(`工作区差异文本`,`Workspace diff text`),"data-diff-mode":o?`highlighted`:`raw`,children:o?r.map((e,t)=>(0,U.jsx)(`span`,{"data-diff-kind":e.kind,className:`readonly-diff__line--${e.kind}`,children:e.text},t)):e})]})}async function q(e,t,n){let r=new URLSearchParams(t),i=await fetch(`${e}?${r}`,{headers:I(),signal:n,cache:`no-store`});if(!i.ok){let t=await i.json().catch(()=>({}));throw Error(t.detail||t.error||`${e} failed (${i.status})`)}return i.json()}var J=(e,t)=>({sid:e,workspace_id:t}),Y={profiles:(e,t)=>q(`/api/v2/workspaces`,{sid:e},t),tree:(e,t,n)=>q(`/api/v2/workspace/tree`,J(e,t),n),file:(e,t,n,r)=>q(`/api/v2/workspace/file`,{...J(e,t),path:n},r),git:(e,t,n)=>q(`/api/v2/workspace/git`,J(e,t),n),literature:(e,t,n)=>q(`/api/v2/workspace/literature`,J(e,t),n),rawUrl:(e,t,n)=>`/api/v2/workspace/raw?${new URLSearchParams({...J(e,t),path:n})}`,rawBlob:async(e,t,n,r)=>{let i=await fetch(`/api/v2/workspace/raw?${new URLSearchParams({...J(e,t),path:n})}`,{headers:I(),signal:r,cache:`no-store`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`raw preview failed (${i.status})`)}return i.blob()}};function dt(e){let t=new Map;e.forEach(e=>t.set(e.path,{...e,children:[]}));let n=[];t.forEach(e=>{let r=e.path.lastIndexOf(`/`),i=r>=0?e.path.slice(0,r):``,a=i?t.get(i):null;a?a.children.push(e):n.push(e)});let r=e=>{e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1),e.forEach(e=>r(e.children))};return r(n),n}function ft(e,t,n){let[r,i]=(0,F.useState)(``),[a,o]=(0,F.useState)(``);return(0,F.useEffect)(()=>{if(i(``),o(``),!e||!t||!n)return;let r=new AbortController,a=``;return Y.rawBlob(e,t,n,r.signal).then(e=>{a=URL.createObjectURL(e),i(a)},e=>{r.signal.aborted||o(e.message)}),()=>{r.abort(),a&&URL.revokeObjectURL(a)}},[n,e,t]),{url:r,error:a}}function pt(e,t,n=!0){let i=r({queryKey:[`workspace-profiles`,e],queryFn:({signal:t})=>Y.profiles(e,t),staleTime:1e4,enabled:!!e&&n}),a=`argus-v2-workspace-profile:${t}:${e}`,[o,s]=(0,F.useState)(()=>te(a)||``),c=(0,F.useMemo)(()=>{let e=i.data?.profiles??[];return e.find(e=>e.id===o)??e.find(e=>e.id===i.data?.default_id)??e.find(e=>e.canonical)??e[0]??null},[i.data,o]);return(0,F.useEffect)(()=>{c&&c.id!==o&&s(c.id)},[c,o]),{profiles:i,active:c,workspaceId:c?.id??``,setWorkspaceId:e=>{s(e),ee(a,e)}}}function mt({node:e,depth:t,selected:n,expanded:r,onToggle:i,onSelect:a}){let o=e.type===`directory`,s=r.has(e.path);return(0,U.jsxs)(`div`,{className:`workspace-node`,children:[(0,U.jsxs)(`button`,{type:`button`,className:n===e.path?`is-selected`:``,style:{paddingLeft:7+t*13},onClick:()=>o?i(e.path):a(e.path),children:[o?s?(0,U.jsx)(g,{size:13}):(0,U.jsx)(ne,{size:13}):(0,U.jsx)(`span`,{className:`node-spacer`}),o?(0,U.jsx)(Ee,{size:14}):(0,U.jsx)(xe,{size:14}),(0,U.jsx)(`span`,{children:e.name}),e.skipped?(0,U.jsx)(`small`,{children:`restricted`}):null]}),o&&s?e.children.map(e=>(0,U.jsx)(mt,{node:e,depth:t+1,selected:n,expanded:r,onToggle:i,onSelect:a},e.path)):null]})}function ht({sid:e,workspaceId:t,path:n,active:i}){let{text:a}=V(),o=n.toLowerCase().slice(n.lastIndexOf(`.`)),s=[`.pdf`,`.png`,`.jpg`,`.jpeg`,`.webp`,`.svg`].includes(o),c=r({queryKey:[`workspace-file`,e,t,n],queryFn:({signal:r})=>Y.file(e,t,n,r),enabled:!!(i&&n&&t&&!s),refetchInterval:5e3}),l=ft(s?e:``,s?t:``,s?n:``);if(!n)return(0,U.jsx)(G,{icon:Se,title:a(`打开一个文件开始阅读`,`Open a file to start reading`),description:a(`左侧文件树展示所选代码工作区。`,`The file tree shows the selected code workspace.`)});if(s)return l.error?(0,U.jsx)(G,{icon:Oe,title:`Preview unavailable`,description:l.error}):l.url?o===`.pdf`?(0,U.jsx)(me,{src:l.url,name:n.split(`/`).at(-1)||n,className:`workspace-pdf`}):(0,U.jsx)(`img`,{className:`workspace-image`,src:l.url,alt:n}):(0,U.jsx)(`div`,{className:`editor-loading`,children:`Loading preview…`});if(c.isLoading)return(0,U.jsxs)(`div`,{className:`editor-loading`,children:[`Opening `,n,`…`]});if(c.isError)return(0,U.jsx)(G,{icon:Oe,title:`Preview unavailable`,description:c.error.message});let u=(c.data?.content??``).split(` +`);return(0,U.jsxs)(`div`,{className:`vscode-code`,tabIndex:0,"aria-label":a(`文件内容`,`File contents`),children:[(0,U.jsx)(`div`,{className:`vscode-line-numbers`,children:u.map((e,t)=>(0,U.jsx)(`span`,{children:t+1},t))}),(0,U.jsx)(`pre`,{children:(0,U.jsx)(`code`,{children:c.data?.content})})]})}function gt(e){let{locale:t,text:n}=V(),i=pt(e.sid,`ide`,e.active),a=i.workspaceId,o=i.active?.path||``,[s,c]=(0,F.useState)(``),[l,u]=(0,F.useState)(new Set),d=(0,F.useRef)(``),f=(0,F.useRef)(null),p=e=>{c(e);let t=f.current,n=t?.closest(`.vscode-shell`),r=t?.closest(`.ros-content`);t&&n&&r&&getComputedStyle(n).display===`flex`&&r.scrollTo({top:r.scrollTop+t.getBoundingClientRect().top-r.getBoundingClientRect().top-12,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[m,h]=(0,F.useState)(`files`),[v,x]=(0,F.useState)(`repository`),S=r({queryKey:[`workspace-tree`,e.sid,a],queryFn:({signal:t})=>Y.tree(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),C=r({queryKey:[`workspace-git`,e.sid,a],queryFn:({signal:t})=>Y.git(e.sid,a,t),enabled:!!(e.active&&a),refetchInterval:8e3}),w=(0,F.useMemo)(()=>dt(S.data?.entries??[]),[S.data?.entries]);(0,F.useEffect)(()=>{c(``),u(new Set),d.current=``},[a]),(0,F.useEffect)(()=>{!a||!w.length||d.current===a||(d.current=a,u(new Set(w.filter(e=>e.type===`directory`).slice(0,5).map(e=>e.path))))},[w,a]);let T=e.events.filter(e=>[`command_execution`,`tool_use`,`tool_result`,`file_change`].includes(String(e.kind??``))).slice(-100),E=(C.data?.status??``).split(` +`).filter(Boolean),D=(C.data?.log??``).split(` +`).filter(Boolean).map(e=>{let[t,n,r,...i]=e.split(` `);return{hash:t,date:n,author:r,subject:i.join(` `)}}),k=C.data;return(0,U.jsxs)(`div`,{className:`ros-page ide-v3`,children:[(0,U.jsxs)(`header`,{className:`ros-page-header`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`eyebrow`,children:`AI IDE`}),(0,U.jsx)(`h1`,{children:n(`代码工作区`,`Code workspace`)}),(0,U.jsx)(`p`,{children:n(`此视图只用于浏览文件、Git 状态与 Argus 活动;不限制 Agent 本身的文件写入权限。`,`This view only browses files, Git state and Argus activity; it does not restrict the Agent’s file write permissions.`)})]}),(0,U.jsxs)(W,{tone:`info`,children:[(0,U.jsx)(Oe,{size:12}),n(`此视图只读`,`This view is read-only`)]})]}),(0,U.jsxs)(`div`,{className:`ide-context-strip`,children:[(0,U.jsx)(Ae,{size:15}),(0,U.jsx)(`select`,{"aria-label":n(`选择已批准工作区`,`Select approved workspace`),value:a,onChange:e=>i.setWorkspaceId(e.target.value),children:i.profiles.data?.profiles.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,U.jsx)(`code`,{children:o}),S.isError?(0,U.jsx)(W,{tone:`danger`,children:n(`连接失败`,`Connection failed`)}):S.isFetching?(0,U.jsx)(W,{tone:`live`,dot:!0,children:n(`同步中`,`Syncing`)}):(0,U.jsxs)(W,{tone:`success`,children:[(0,U.jsx)(le,{size:11}),`Synced`]}),(0,U.jsxs)(`small`,{children:[S.data?.entries.length??0,` entries`]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{S.refetch(),C.refetch()},"aria-label":n(`刷新工作区`,`Refresh workspace`),children:(0,U.jsx)(y,{size:14})})]}),(0,U.jsxs)(`div`,{className:`vscode-shell`,children:[(0,U.jsxs)(`nav`,{className:`vscode-activitybar`,children:[(0,U.jsx)(`button`,{type:`button`,className:m===`files`?`is-active`:``,onClick:()=>h(`files`),title:`Explorer`,"aria-label":`Explorer`,children:(0,U.jsx)(Ce,{size:21})}),(0,U.jsxs)(`button`,{type:`button`,className:m===`git`?`is-active`:``,onClick:()=>h(`git`),title:`Source Control`,"aria-label":`Source Control`,children:[(0,U.jsx)(j,{size:21}),E.length?(0,U.jsx)(`i`,{children:E.length}):null]})]}),(0,U.jsxs)(`aside`,{className:`vscode-sidebar`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`span`,{children:m===`git`?`SOURCE CONTROL`:`EXPLORER`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void S.refetch(),"aria-label":n(`刷新文件树`,`Refresh file tree`),children:(0,U.jsx)(y,{size:14})})]}),m===`files`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`vscode-root`,children:[(0,U.jsx)(g,{size:13}),(0,U.jsx)(`strong`,{title:o,children:o.split(/[\\/]/).filter(Boolean).at(-1)||o})]}),(0,U.jsx)(`div`,{className:`workspace-tree`,children:S.isError?(0,U.jsx)(G,{icon:Ae,title:n(`目录连接失败`,`Directory connection failed`),description:S.error.message}):w.map(e=>(0,U.jsx)(mt,{node:e,depth:0,selected:s,expanded:l,onToggle:e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:p},e.path))})]}):(0,U.jsx)(`div`,{className:`vscode-changes`,children:E.length?E.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{let t=e.slice(3).trim(),n=t.includes(` -> `)?t.split(` -> `).at(-1):t;n.endsWith(`/`)||p(n)},children:[(0,U.jsx)(`b`,{children:e.slice(0,2).trim()||`?`}),(0,U.jsx)(`span`,{children:e.slice(3)})]},e)):(0,U.jsx)(`p`,{children:`No changes`})})]}),(0,U.jsxs)(`main`,{className:`vscode-editor`,ref:f,children:[(0,U.jsx)(`div`,{className:`vscode-tabs`,children:(0,U.jsxs)(`button`,{type:`button`,className:`is-active`,children:[(0,U.jsx)(A,{size:13}),s||`Welcome`]})}),(0,U.jsx)(`div`,{className:`vscode-breadcrumbs`,children:s?s.split(`/`).map((e,t)=>(0,U.jsxs)(`span`,{children:[e,tx(`changes`),children:`Changes`}),(0,U.jsx)(`button`,{type:`button`,className:v===`timeline`?`is-active`:``,onClick:()=>x(`timeline`),children:`Timeline`}),(0,U.jsx)(`button`,{type:`button`,className:v===`repository`?`is-active`:``,onClick:()=>x(`repository`),children:`Repository`})]}),(0,U.jsx)(`div`,{className:`vscode-git-content`,children:k?.available?v===`changes`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{className:`vscode-status`,children:k.status||`Working tree clean`}),(0,U.jsx)(ut,{diff:k.diff,truncated:k.truncated})]}):v===`timeline`?(0,U.jsx)(`div`,{className:`vscode-commits`,children:D.map(e=>(0,U.jsxs)(`article`,{children:[(0,U.jsx)(j,{size:13}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.subject}),(0,U.jsxs)(`small`,{children:[e.author,` · `,e.date?.slice(0,10)]})]})]},e.hash))}):(0,U.jsxs)(`div`,{className:`repository-readiness`,children:[(0,U.jsx)(`h3`,{children:`Repository readiness`}),(0,U.jsxs)(`dl`,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(j,{size:13}),`Remote`]}),(0,U.jsx)(`dd`,{children:k.remotes.length?k.remotes.map(e=>`${e.name}: ${e.fetch}`).join(` +`):`Not configured`}),(0,U.jsx)(`i`,{className:k.remotes.length?`ok`:`missing`,children:k.remotes.length?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(j,{size:13}),`Upstream`]}),(0,U.jsxs)(`dd`,{children:[k.upstream||`Not configured`,k.upstream?` · ahead ${k.ahead}, behind ${k.behind}`:``]}),(0,U.jsx)(`i`,{className:k.upstream?`ok`:`missing`,children:k.upstream?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(Me,{size:13}),`Commit identity`]}),(0,U.jsx)(`dd`,{children:k.identity.name&&k.identity.email?`${k.identity.name} <${k.identity.email}>`:`Not configured`}),(0,U.jsx)(`i`,{className:k.identity.valid?`ok`:`missing`,children:k.identity.valid?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`dt`,{children:[(0,U.jsx)(De,{size:13}),`GitHub CLI`]}),(0,U.jsx)(`dd`,{children:k.github.authenticated?`${k.github.login} · ${k.github.protocol}`:`Not authenticated`}),(0,U.jsx)(`i`,{className:k.github.authenticated?`ok`:`missing`,children:k.github.authenticated?(0,U.jsx)(_,{size:12}):(0,U.jsx)(b,{size:12})})]})]}),(0,U.jsx)(`p`,{children:k.publish_ready?`Repository is ready for an explicitly approved push.`:`Configure the missing items before publishing. No credentials are shown in this UI.`})]}):(0,U.jsx)(G,{icon:j,title:`Not a Git repository`})})]}),(0,U.jsxs)(`section`,{className:`vscode-terminal`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`strong`,{children:`ARGUS ACTIVITY`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(je,{size:13}),`read-only`]})]}),(0,U.jsx)(`div`,{children:T.length?T.map((e,r)=>(0,U.jsxs)(`article`,{children:[(0,U.jsx)(`time`,{children:We(e.ts,t)}),(0,U.jsx)(`b`,{className:`terminal-role`,style:{color:O(Ke(e))},children:B(Ke(e),n)}),(0,U.jsx)(`span`,{children:`›`}),(0,U.jsx)(`code`,{children:Je(e,800)||qe(e)})]},`${e.ts}-${r}`)):(0,U.jsx)(`p`,{children:`$ waiting for Argus activity`})})]}),(0,U.jsxs)(`footer`,{className:`vscode-statusbar`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(j,{size:12}),k?.branch||`no branch`]}),(0,U.jsx)(`span`,{children:S.isError?`Workspace error`:S.isFetching?`Workspace syncing`:S.data?.truncated?`Tree truncated`:`Workspace synced`}),(0,U.jsx)(`span`,{children:k?.github.authenticated?`GitHub: ${k.github.login}`:`GitHub: offline`}),(0,U.jsx)(`span`,{children:`UTF-8`}),(0,U.jsx)(`span`,{children:s.split(`.`).at(-1)?.toUpperCase()||`Plain Text`})]})]})]})}var X=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm`;function _t({task:e,resources:t,onChange:n,text:r}){let i=e.execution_options??[],a=(e,t)=>n(i.map(n=>n.id===e?{...n,...t}:n));return(0,U.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-dashed border-line p-3 sm:col-span-2`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-medium`,children:r(`期限紧张时的替代做法`,`Alternative execution options for tighter deadlines`)}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:r(`每种做法都有独立工期、资源和取舍。系统只会选择已声明保留必需验收目标的方案,不自动压缩原估计。`,`Each option has its own estimate, resources and tradeoff. Only options declared to preserve required acceptance scope can be selected.`)}),i.map(o=>(0,U.jsxs)(`fieldset`,{disabled:e.status!=null&&e.status!==`pending`,className:`grid gap-2 rounded-lg border border-line p-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs sm:col-span-2`,children:[r(`替代做法`,`Alternative approach`),(0,U.jsx)(`input`,{className:X,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-2 sm:col-span-2`,children:[r(`替代下限(小时)`,`Option lower (h)`),r(`替代最可能(小时)`,`Option likely (h)`),r(`替代上限(小时)`,`Option upper (h)`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{className:X,type:`number`,min:`0`,step:`any`,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),t.map(e=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,r(`需求`,`required`),(0,U.jsx)(`input`,{className:X,type:`number`,min:`0`,step:`1`,value:o.resources[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e)),(0,U.jsxs)(`label`,{className:`text-xs`,children:[r(`替代工期依据`,`Option estimate basis`),(0,U.jsx)(`textarea`,{"aria-label":r(`替代工期依据`,`Option estimate basis`),className:X,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[r(`取舍与适用条件`,`Tradeoff and prerequisites`),(0,U.jsx)(`textarea`,{"aria-label":r(`取舍与适用条件`,`Tradeoff and prerequisites`),className:X,value:o.tradeoff,onChange:e=>a(o.id,{tradeoff:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`flex gap-2 text-xs sm:col-span-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o.preserves_acceptance,onChange:e=>a(o.id,{preserves_acceptance:e.target.checked})}),r(`确认条件适用且保留必需验收目标,允许重排时采用`,`Prerequisites apply and required acceptance is preserved; allow automatic selection`)]}),(0,U.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>n(i.filter(e=>e.id!==o.id)),children:r(`移除替代做法`,`Remove alternative`)})]},o.id)),(0,U.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-xs`,disabled:i.length>=8||e.status!=null&&e.status!==`pending`,onClick:()=>{let t=i.length+1;for(;i.some(e=>e.id===`option-${t}`);)t++;n([...i,{id:`option-${t}`,title:r(`新的替代做法`,`New alternative`),duration_hours:[...e.duration_hours],resources:{...e.resources},basis:e.basis,tradeoff:r(`待补充适用条件与取舍`,`Specify prerequisites and tradeoffs`),preserves_acceptance:!1}])},children:r(`添加替代做法`,`Add alternative`)})]})}var Z=`w-full rounded-lg border border-line bg-transparent px-2 py-1.5 text-sm text-ink`;function vt({input:e,onChange:t,text:n,forecast:r}){let i=e.proposals.find(t=>t.id===e.selected_proposal_id),a=(n,r)=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.map(e=>e.id===n?{...e,...r}:e)}:e)});return(0,U.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`任务与实验`,`Tasks and experiments`),children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`h3`,{className:`font-medium`,children:n(`任务与实验`,`Tasks and experiments`)}),(0,U.jsx)(`button`,{className:`rounded-lg border border-line px-3 py-1.5 text-sm`,onClick:()=>{let r=i.tasks.length+1;for(;i.tasks.some(e=>e.id===`task-${r}`);)r++;t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:[...e.tasks,{id:`task-${r}`,title:n(`新增实验`,`New experiment`),phase:`experiment`,duration_hours:[1,2,8],basis:n(`初步估计,待实测校准`,`Preliminary estimate; needs calibration`)}]}:e)})},children:n(`添加任务`,`Add task`)})]}),i.tasks.map(o=>{let s=[`running`,`completed`,`failed`].includes(o.status??`pending`),c=[`completed`,`failed`].includes(o.status??`pending`);return(0,U.jsxs)(`details`,{className:`rounded-xl border border-line p-3`,children:[(0,U.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,U.jsx)(`strong`,{children:o.title}),(0,U.jsxs)(`span`,{className:`ml-2 text-ink-faint`,children:[o.duration_hours.join(` / `),` h · `,o.id]})]}),(0,U.jsxs)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`任务名称`,`Task name`),(0,U.jsx)(`input`,{className:Z,value:o.title,onChange:e=>a(o.id,{title:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`阶段`,`Phase`),(0,U.jsx)(`input`,{className:Z,value:o.phase,onChange:e=>a(o.id,{phase:e.target.value})})]}),(0,U.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`乐观(小时)`,`Lower (hours)`),n(`最可能(小时)`,`Likely (hours)`),n(`悲观(小时)`,`Upper (hours)`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,disabled:s,value:o.duration_hours[t],onChange:e=>{let n=[...o.duration_hours];n[t]=Number(e.target.value),a(o.id,{duration_hours:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`估计依据`,`Estimate basis`),(0,U.jsx)(`textarea`,{"aria-label":n(`估计依据`,`Estimate basis`),className:Z,value:o.basis,onChange:e=>a(o.id,{basis:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`模型 / 实现难度`,`Model / implementation difficulty`),(0,U.jsx)(`textarea`,{"aria-label":n(`模型 / 实现难度`,`Model / implementation difficulty`),className:Z,value:o.difficulty??``,onChange:e=>a(o.id,{difficulty:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`前置任务(可多选)`,`Dependencies (multiple)`),(0,U.jsx)(`select`,{"aria-label":n(`前置任务(可多选)`,`Dependencies (multiple)`),multiple:!0,className:Z,disabled:s,value:o.depends_on??[],onChange:e=>a(o.id,{depends_on:Array.from(e.target.selectedOptions,e=>e.value)}),children:i.tasks.filter(e=>e.id!==o.id).map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:Object.keys(e.resources).map(e=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`占用`,`slots`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`1`,className:Z,disabled:s,value:o.resources?.[e]??0,onChange:t=>{let n={...o.resources},r=Number(t.target.value);r?n[e]=r:delete n[e],a(o.id,{resources:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`进展状态`,`Progress status`),(0,U.jsx)(`select`,{"aria-label":n(`进展状态`,`Progress status`),className:Z,disabled:c||e.adapt_to_deadline&&!s&&!r,value:o.status??`pending`,onChange:t=>{let n=t.target.value,i=r?.schedule.find(e=>e.id===o.id),c=!s&&[`running`,`completed`,`failed`].includes(n)&&i?{duration_hours:i.duration_hours??o.duration_hours,resources:i.resources,execution_option_id:i.execution_option_id??`standard`,basis:i.basis}:{};a(o.id,{status:n,...c,...n===`running`?{actual_start_hours:o.actual_start_hours??e.now_hours,remaining_hours:o.remaining_hours??[...c.duration_hours??o.duration_hours]}:{},...[`completed`,`failed`].includes(n)?{actual_start_hours:o.actual_start_hours??0,actual_finish_hours:e.now_hours}:{}})},children:[[`pending`,`未开始`,`Pending`],[`running`,`运行中`,`Running`],[`completed`,`已完成`,`Completed`],[`failed`,`失败`,`Failed`],[`blocked`,`受阻`,`Blocked`]].filter(([e])=>!s||![`pending`,`blocked`].includes(e)).map(([e,t,r])=>(0,U.jsx)(`option`,{value:e,children:n(t,r)},e))})]}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o.optional??!1,onChange:e=>a(o.id,{optional:e.target.checked})}),n(`可选 / 已退出交付路径`,`Optional / retired from delivery path`)]}),s&&(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`实际开始(项目第几小时)`,`Actual start (project hour)`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.actual_start_hours??0,onChange:e=>a(o.id,{actual_start_hours:Number(e.target.value)})})]}),c&&(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`实际结束(项目第几小时)`,`Actual finish (project hour)`),(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.actual_finish_hours??0,onChange:e=>a(o.id,{actual_finish_hours:Number(e.target.value)})})]}),o.status===`running`&&(0,U.jsx)(`div`,{className:`sm:col-span-2 grid grid-cols-3 gap-2`,children:[n(`剩余下限`,`Remaining lower`),n(`剩余最可能`,`Remaining likely`),n(`剩余上限`,`Remaining upper`)].map((e,t)=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,(0,U.jsx)(`input`,{type:`number`,min:`0`,step:`any`,className:Z,value:o.remaining_hours?.[t]??0,onChange:e=>{let n=[...o.remaining_hours??o.duration_hours];n[t]=Number(e.target.value),a(o.id,{remaining_hours:n})}})]},e))}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`变化 / 延期原因`,`Change / delay reason`),(0,U.jsx)(`textarea`,{"aria-label":n(`变化 / 延期原因`,`Change / delay reason`),className:Z,value:o.reason??``,onChange:e=>a(o.id,{reason:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`证据引用(每行一个)`,`Evidence references (one per line)`),(0,U.jsx)(`textarea`,{"aria-label":n(`证据引用(每行一个)`,`Evidence references (one per line)`),className:Z,value:(o.evidence??[]).join(` +`),onChange:e=>a(o.id,{evidence:e.target.value.split(` +`).filter(Boolean)})})]}),(0,U.jsx)(_t,{task:o,resources:Object.keys(e.resources),onChange:e=>a(o.id,{execution_options:e}),text:n}),!s&&i.tasks.length>1&&(0,U.jsx)(`button`,{className:`justify-self-start text-xs text-red`,onClick:()=>t({...e,proposals:e.proposals.map(e=>e.id===i.id?{...e,tasks:e.tasks.filter(e=>e.id!==o.id)}:e)}),children:n(`移除未开始任务`,`Remove unstarted task`)})]})]},o.id)})]})}function yt({report:e,selectedId:t,text:n}){let r=e.proposals.find(e=>e.id===t),i=Math.max(1,...r.schedule.map(e=>e.finish_hours));return(0,U.jsxs)(`div`,{className:`space-y-5`,"aria-label":n(`排期结果`,`Timeline results`),children:[(0,U.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:e.proposals.map(e=>(0,U.jsxs)(`div`,{className:`rounded-xl border p-4 ${e.id===t?`border-blue`:`border-line`}`,children:[(0,U.jsx)(`div`,{className:`text-xs text-ink-faint`,children:e.id===t?n(`已选方案`,`Selected proposal`):n(`备选方案`,`Alternative`)}),(0,U.jsx)(`h3`,{className:`mt-1 text-sm font-medium`,children:e.title}),(0,U.jsx)(`div`,{className:`mt-3 text-2xl font-semibold`,children:e.finish_hours?`${e.finish_hours.expected.toFixed(1)} h`:n(`待重规划`,`Needs replanning`)}),e.finish_hours&&(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:[n(`区间`,`Range`),` `,e.finish_hours.lower.toFixed(1),`–`,e.finish_hours.upper.toFixed(1),` h · `,n(`剩余`,`Remaining`),` `,e.remaining_hours?.toFixed(1),` h`]}),e.deadline_gap_hours!=null&&(0,U.jsxs)(`p`,{className:`mt-2 text-xs ${e.deadline_gap_hours>0?`text-red`:`text-ink-faint`}`,children:[n(`预计超期`,`Forecast overrun`),` `,e.deadline_gap_hours.toFixed(1),` h`]})]},e.id))}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`初步估计,非成功承诺。区间覆盖已列出的工作;验证失败后的新增实验可能超出上限。各方案作为备选单独计算。`,`Preliminary estimates, not success guarantees. New experiments after a failed premise can exceed the range. Proposals are estimated as alternatives.`)}),r.adaptation&&(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-blue/40 bg-blue/5 p-4`,"aria-label":n(`根据期限重排`,`Deadline adaptation`),children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`根据期限重排`,`Deadline adaptation`)}),r.adaptation.baseline_finish_hours&&r.finish_hours&&(0,U.jsxs)(`p`,{className:`text-sm`,children:[n(`调整前`,`Before`),` `,(0,U.jsxs)(`strong`,{children:[r.adaptation.baseline_finish_hours.expected.toFixed(1),` h`]}),` → `,n(`当前方案`,`Current plan`),` `,(0,U.jsxs)(`strong`,{children:[r.finish_hours.expected.toFixed(1),` h`]})]}),r.adaptation.status===`gap`&&(0,U.jsx)(`p`,{className:`text-sm text-red`,children:n(`已尝试可用的重排方式,仍无法满足期限。需要增加资源、提出新的执行方案,或调整交付目标。`,`Available adjustments still miss the deadline. More resources, another execution option, or a revised deliverable are needed.`)}),r.adaptation.status===`fits`&&r.finish_hours&&r.adaptation.target_hours!=null&&r.finish_hours.upper>r.adaptation.target_hours&&(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`点估计可按期;悲观情景仍可能超期,请留意区间上限。`,`The point estimate fits; the upper scenario can still miss the deadline.`)}),r.adaptation.changes.length===0&&(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`沿用原 proposal 的任务与做法;当前期限无需进一步调整,或尚无可用的替代做法。`,`Keeping the original tasks and approaches; no further adjustment is needed or no usable alternative is available.`)}),r.adaptation.changes.map(e=>(0,U.jsxs)(`div`,{className:`border-t border-line/60 pt-2 text-xs`,children:[(0,U.jsxs)(`p`,{className:`font-medium`,children:[e.title,e.option_title?` → ${e.option_title}`:``]}),e.from_duration_hours&&e.to_duration_hours&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`任务估计(下限 / 最可能 / 上限)`,`Task estimate (lower / likely / upper)`),`: `,e.from_duration_hours.join(` / `),` → `,e.to_duration_hours.join(` / `),` h`]}),e.from_start_hours!=null&&e.to_start_hours!=null&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`开始时间`,`Start time`),`: `,e.from_start_hours.toFixed(1),` → `,e.to_start_hours.toFixed(1),` h`]}),(0,U.jsx)(`p`,{className:`mt-1 text-ink-faint`,children:e.reason}),e.tradeoff&&(0,U.jsxs)(`p`,{className:`mt-1`,children:[n(`取舍 / 条件`,`Tradeoff / prerequisites`),`: `,e.tradeoff]})]},`${e.kind}:${e.id}`))]}),(0,U.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`h3`,{className:`mb-4 text-sm font-medium`,children:[n(`实验排布`,`Experiment schedule`),` · `,n(`从项目开始计时`,`Hours from project start`)]}),(0,U.jsx)(`div`,{className:`space-y-3`,children:r.schedule.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs`,children:[(0,U.jsx)(`span`,{children:e.title}),(0,U.jsxs)(`span`,{className:`shrink-0 text-ink-faint`,children:[e.start_hours.toFixed(1),`–`,e.finish_hours.toFixed(1),` h`]})]}),(0,U.jsx)(`div`,{className:`h-2.5 rounded-full bg-line/40`,role:`img`,"aria-label":`${e.title}: ${e.start_hours.toFixed(1)}–${e.finish_hours.toFixed(1)} h`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full ${e.status===`failed`?`bg-red`:e.status===`completed`?`bg-emerald-500`:`bg-blue`}`,style:{marginLeft:`${e.start_hours/i*100}%`,width:`${Math.max(.3,(e.finish_hours-e.start_hours)/i*100)}%`}})})]},e.id))})]}),r.deferred_task_ids.length>0&&(0,U.jsxs)(`p`,{className:`rounded-lg border border-line p-3 text-sm`,children:[n(`为满足期限延后的可选任务`,`Optional tasks deferred for the deadline`),`: `,r.deferred_task_ids.join(`, `)]}),[...r.failed_tasks,...r.blocked_tasks].map(e=>(0,U.jsxs)(`p`,{role:`alert`,className:`rounded-lg border border-red/40 p-3 text-sm`,children:[e.id,`: `,e.reason]},e.id)),(0,U.jsx)(`div`,{className:`overflow-x-auto`,children:(0,U.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsx)(`tr`,{children:[n(`任务`,`Task`),n(`资源`,`Resources`),n(`排队`,`Queue`),n(`估计依据`,`Estimate basis`)].map(e=>(0,U.jsx)(`th`,{className:`border-b border-line p-2`,children:e},e))})}),(0,U.jsx)(`tbody`,{children:r.schedule.map(e=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:e.title}),(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:Object.entries(e.resources).map(([e,t])=>`${e} × ${t}`).join(`, `)||`—`}),(0,U.jsxs)(`td`,{className:`border-b border-line p-2`,children:[e.resource_wait_hours.toFixed(1),` h`]}),(0,U.jsx)(`td`,{className:`border-b border-line p-2`,children:e.basis})]},e.id))})]})}),e.revision&&(0,U.jsxs)(`section`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`版本对照与延期原因`,`Revision and delay reasons`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm`,children:e.revision.reason}),(0,U.jsxs)(`p`,{className:`mt-2 text-xs text-ink-faint`,children:[n(`初版预计`,`Original forecast`),`: `,e.revision.baseline_finish_hours?.toFixed(1)??`—`,` h · `,n(`相对初版变化`,`Change from original`),`: `,e.revision.baseline_delta_hours?.toFixed(1)??`—`,` h`]}),e.revision.task_variances.map((e,t)=>(0,U.jsxs)(`p`,{className:`mt-3 text-xs`,children:[e.id,` · `,e.observed?n(`实际延期`,`Observed delay`):n(`预测延期`,`Forecast delay`),` `,e.delay_hours.toFixed(1),` h — `,e.reason,(0,U.jsx)(`br`,{}),e.evidence.join(`, `)]},`${e.id}-${t}`))]})]})}function bt(e){return{...e,resources:e.resources??{},now_hours:e.now_hours??0,defer_optional:e.defer_optional??!1}}var Q=`w-full rounded-lg border border-line bg-transparent px-3 py-2 text-sm text-ink`,$=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40`;function xt({sid:e}){let{locale:t}=p(),n=(e,n)=>t===`zh-CN`?e:n,[r,i]=(0,F.useState)(null),[a,o]=(0,F.useState)(null),[s,c]=(0,F.useState)(null),[l,u]=(0,F.useState)(!0),[d,f]=(0,F.useState)(!1),[m,h]=(0,F.useState)(!1),[g,_]=(0,F.useState)(!1),[v,y]=(0,F.useState)(``),[b,x]=(0,F.useState)(``),[S,C]=(0,F.useState)(``),[w,E]=(0,F.useState)(``),[D,O]=(0,F.useState)(``),[k,A]=(0,F.useState)(0),j=!!(r&&JSON.stringify(r)!==JSON.stringify(a?.input));return(0,F.useEffect)(()=>{let t=!0;return u(!0),f(!1),y(``),i(null),o(null),c(null),z.timelineLatest(e).then(({latest:e})=>{if(!t)return;let n=e?{...e,input:bt(e.input)}:null;o(n),i(n?.input??null),c(n?.report??null),E(``),C(``),f(!0)}).catch(e=>{t&&y(e.message)}).finally(()=>{t&&u(!1)}),()=>{t=!1}},[e,k]),(0,F.useEffect)(()=>{if(c(null),x(``),!r){_(!1);return}if(a&&JSON.stringify(r)===JSON.stringify(a.input)){c(a.report),_(!1);return}let e=new AbortController;_(!0);let t=setTimeout(()=>{z.timelineEstimate(r,e.signal).then(t=>{e.signal.aborted||c(t)}).catch(t=>{e.signal.aborted||x(t.message)}).finally(()=>{e.signal.aborted||_(!1)})},350);return()=>{clearTimeout(t),e.abort()}},[r,a]),l?(0,U.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-ink-faint`,children:n(`正在读取已保存计划…`,`Loading saved timeline…`)}):(0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 p-4 sm:p-6`,children:[(0,U.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs text-blue`,children:`PROPOSAL → EXPERIMENT → PAPER`}),(0,U.jsx)(`h2`,{className:`mt-1 text-xl font-semibold`,children:n(`研究排期`,`Research timeline`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`选择 idea 和期望期限,查看具体工期、实验排布与调整原因。`,`Choose an idea and deadline to see estimates, experiment schedules, and reasons for changes.`)})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(`button`,{className:$,disabled:m||!d,onClick:async()=>{h(!0),y(``),C(``);try{i(await z.timelineExample()),E(n(`加载演示 proposal`,`Load demonstration proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`加载论文示例`,`Load paper example`)}),(0,U.jsx)(`button`,{className:$,disabled:m,onClick:()=>A(e=>e+1),children:n(`重新载入已保存计划`,`Reload saved timeline`)}),r&&(0,U.jsx)(`button`,{className:$,onClick:()=>T(new Blob([JSON.stringify(r,null,2)],{type:`application/json`}),`proposal.json`),children:n(`导出 proposal`,`Export proposal`)})]})]}),v&&(0,U.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[v,(0,U.jsx)(`p`,{className:`mt-2 text-ink-faint`,children:n(`若提示版本冲突,先导出当前草稿,再重新载入已保存计划。`,`For a version conflict, export your draft before reloading the saved timeline.`)})]}),S&&(0,U.jsx)(`p`,{role:`status`,className:`rounded-xl border border-blue/40 p-3 text-sm`,children:S}),!r&&(0,U.jsxs)(`section`,{className:`rounded-xl border border-dashed border-line p-8 text-center`,children:[(0,U.jsx)(`h3`,{className:`font-medium`,children:n(`还没有研究排期`,`No research timeline yet`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm text-ink-faint`,children:n(`点击“加载论文示例”即可验证完整流程,也可以在下方导入自己的 proposal。示例数字仅用于演示。`,`Load the paper example to try the complete flow, or import your proposal below. Example numbers are illustrative.`)})]}),r&&(0,U.jsxs)(`div`,{className:`grid items-start gap-6`,style:{gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 360px), 1fr))`},children:[(0,U.jsxs)(`fieldset`,{disabled:m,className:`min-w-0 space-y-5`,children:[(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`选择 idea / proposal`,`Choose idea / proposal`),(0,U.jsx)(`select`,{"aria-label":n(`选择 idea / proposal`,`Choose idea / proposal`),className:Q,value:r.selected_proposal_id,onChange:e=>i({...r,selected_proposal_id:e.target.value}),children:r.proposals.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`方案名称`,`Proposal title`),(0,U.jsx)(`input`,{className:Q,value:r.proposals.find(e=>e.id===r.selected_proposal_id).title,onChange:e=>i({...r,proposals:r.proposals.map(t=>t.id===r.selected_proposal_id?{...t,title:e.target.value}:t)})})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`期望完成时间(小时)`,`Target finish (hours)`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`0`,step:`any`,value:r.deadline_hours??``,placeholder:n(`不限`,`No deadline`),onChange:e=>i({...r,deadline_hours:e.target.value===``?null:Number(e.target.value)})})]}),(0,U.jsxs)(`label`,{className:`text-xs`,children:[n(`已过去时间(小时)`,`Elapsed time (hours)`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`0`,step:`any`,value:r.now_hours,onChange:e=>i({...r,now_hours:Number(e.target.value)})})]}),Object.entries(r.resources).map(([e,t])=>(0,U.jsxs)(`label`,{className:`text-xs`,children:[e,` `,n(`可用槽位`,`available slots`),(0,U.jsx)(`input`,{className:Q,type:`number`,min:`1`,step:`1`,value:t,onChange:t=>i({...r,resources:{...r.resources,[e]:Number(t.target.value)}})})]},e))]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`所有时间从项目开始计时;例如 120 小时 = 第 5 天。资源按持续可用计算。`,`All times count from project start; 120 hours means day 5. Resources are assumed continuously available.`)}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:r.adapt_to_deadline??!1,onChange:e=>i({...r,adapt_to_deadline:e.target.checked})}),n(`根据期限自动重排任务、选择替代做法并更新区间`,`Adapt task order, execution options and estimate ranges to the deadline`)]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`缩短期限时优先调整关键路径;延长期限时恢复原做法和可选工作。替代做法可在任务中编辑。`,`Tighter deadlines prioritize the critical path; longer deadlines restore preferred approaches and optional work. Edit alternatives inside each task.`)}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:r.defer_optional,onChange:e=>i({...r,defer_optional:e.target.checked})}),n(`超期时延后可选任务,保留必需实验`,`Defer optional tasks when over deadline; keep required experiments`)]}),(0,U.jsx)(`button`,{className:$,onClick:()=>{let e=r.proposals.length+1;for(;r.proposals.some(t=>t.id===`idea-${e}`);)e++;let t=`idea-${e}`;i({...r,selected_proposal_id:t,proposals:[...r.proposals,{id:t,title:n(`新 proposal`,`New proposal`),tasks:[{id:`validation`,title:n(`关键假设验证`,`Validate the key premise`),phase:`validation`,duration_hours:[2,4,16],basis:n(`初步估计,待校准`,`Preliminary, uncalibrated estimate`)}]}]})},children:n(`添加候选方案`,`Add proposal`)})]}),(0,U.jsx)(vt,{input:r,onChange:i,text:n,forecast:g?void 0:s?.proposals.find(e=>e.id===r.selected_proposal_id)}),(0,U.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line p-4`,children:[(0,U.jsxs)(`label`,{className:`block text-xs`,children:[n(`本次保存 / 调整原因`,`Reason for this revision`),(0,U.jsx)(`textarea`,{"aria-label":n(`本次保存 / 调整原因`,`Reason for this revision`),className:Q,value:w,onChange:e=>E(e.target.value),placeholder:n(`说明为什么改变计划;延期请在具体任务中填写证据`,`Explain the change; add delay evidence on the affected task`)})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`text-xs text-ink-faint`,children:[a?n(`已保存 v${a.version}`,`Saved v${a.version}`):n(`未保存`,`Not saved`),j?n(` · 有未保存修改`,` · Unsaved changes`):``]}),(0,U.jsx)(`button`,{className:`${$} border-blue bg-blue/10`,disabled:!d||!j||!s||g||!!b||!w.trim(),onClick:async()=>{if(!(!r||!s||g||!w.trim())){h(!0),y(``),C(``);try{let t=await z.timelineSave(e,r,a?.version??0,w);o(t),i(t.input),c(t.report),E(``),C(n(`已保存版本 ${t.version},刷新页面后仍可查看。`,`Version ${t.version} saved. It survives a page refresh.`))}catch(e){y(e.message)}finally{h(!1)}}},children:n(`保存计划版本`,`Save timeline version`)})]}),(0,U.jsx)(`p`,{className:`text-xs text-ink-faint`,children:n(`保存计划不会启动实验。实际进展和失败原因由实验结果或操作者更新。`,`Saving a timeline does not start experiments. Update progress and failure reasons from actual results.`)})]})]}),(0,U.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[g&&(0,U.jsx)(`p`,{role:`status`,className:`text-sm text-ink-faint`,children:n(`正在更新排期…`,`Updating schedule…`)}),b&&(0,U.jsxs)(`p`,{role:`alert`,className:`rounded-xl border border-red/40 p-3 text-sm`,children:[n(`无法计算,请检查估计区间、依赖和资源:`,`Cannot calculate; check ranges, dependencies, and resources: `),b]}),!g&&s&&(0,U.jsx)(yt,{report:s,selectedId:r.selected_proposal_id,text:n})]})]}),(0,U.jsxs)(`details`,{className:`rounded-xl border border-line p-4`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:n(`导入自己的 proposal(JSON)`,`Import your proposal (JSON)`)}),(0,U.jsx)(`textarea`,{className:`${Q} mt-3 font-mono`,rows:6,"aria-label":n(`Proposal JSON`,`Proposal JSON`),value:D,onChange:e=>O(e.target.value)}),(0,U.jsx)(`button`,{className:`${$} mt-2`,disabled:!d||m||!D.trim(),onClick:async()=>{h(!0),y(``);try{let e=JSON.parse(D);await z.timelineEstimate(e),i(bt(e)),E(n(`导入 proposal`,`Import proposal`))}catch(e){y(e.message)}finally{h(!1)}},children:n(`校验并导入`,`Validate and import`)})]})]})}var St=[{id:`timeline`,zh:`研究排期`,en:`Research timeline`,zhDesc:`比较 proposal 工期,安排实验,并追踪延期原因。`,enDesc:`Compare proposal estimates, schedule experiments, and track delays.`,icon:ye,color:`blue`},{id:`experiments`,zh:`运行进程`,en:`Execution`,zhDesc:`查看当前步骤、任务路线,以及团队里谁在做什么。`,enDesc:`Follow the current step, the task route, and who on the team is doing what.`,icon:we,color:`blue`},{id:`ide`,zh:`AI IDE`,en:`AI IDE`,zhDesc:`阅读项目文件,查看 Git 状态与 Argus 活动。`,enDesc:`Read project files, Git state, and Argus activity.`,icon:A,color:`emerald`}],Ct=[{id:`overview`,zh:`项目概览`,en:`Project overview`,icon:Te},...St];function wt(e){let{text:t}=V(),n=e.snapshot.mission_view?.mission.objective||e.status?.continuous?.objective||e.project.objective||``;return(0,U.jsxs)(`div`,{className:`overview-page`,children:[(0,U.jsx)(`section`,{className:`overview-hero overview-hero--plain`,children:(0,U.jsxs)(`div`,{className:`overview-hero__copy`,children:[(0,U.jsx)(`h1`,{children:e.snapshot.session.display_name||e.project.label}),(0,U.jsx)(`p`,{children:n||t(`尚未设置目标。`,`No objective has been set.`)}),(0,U.jsx)(P,{session:e.snapshot.session})]})}),(0,U.jsx)(`div`,{className:`overview-section-heading`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{children:t(`项目工作区`,`Project workspace`)}),(0,U.jsx)(`p`,{children:t(`这些入口展示同一项目的排期、运行进程与代码工作区。`,`These views show the same project’s timeline, execution and code workspace.`)})]})}),(0,U.jsx)(`section`,{className:`module-grid`,children:St.map(n=>{let r=n.icon;return(0,U.jsxs)(`button`,{className:`module-card`,type:`button`,onClick:()=>e.navigate(n.id),children:[(0,U.jsx)(`span`,{className:`module-card__icon module-card__icon--${n.color}`,children:(0,U.jsx)(r,{size:20})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:t(n.zh,n.en)}),(0,U.jsx)(`p`,{children:t(n.zhDesc,n.enDesc)})]}),(0,U.jsx)(k,{size:16})]},n.id)})})]})}function Tt(e){let t=String(e.event_id??e.id??``);if(t)return t;let n=String(e.message_id??``);return n?`${e.type??``}:${n}:${e.kind??``}`:[e.type??``,e.ts??``,e.agent_layer??e.actor??``,e.kind??``,String(e.text??e.title??e.reason??``).slice(0,160)].join(`|`)}function Et(e,t){let n=[...e],r=new Map(n.map((e,t)=>[Tt(e),t]));return t.forEach(e=>{let t=Tt(e),i=r.get(t);i==null?(r.set(t,n.length),n.push(e)):n[i]={...n[i],...e}}),n.sort((e,t)=>Number(e.ts??0)-Number(t.ts??0)).slice(-600)}function Dt(e=!0){return r({queryKey:[`v2-projects`],queryFn:({signal:e})=>z.projects(e),enabled:e,refetchInterval:1e4})}function Ot(e,t=!0){let n=i(),[o,s]=(0,F.useState)([]),[c,l]=(0,F.useState)(!1),u=(0,F.useRef)(null),d=!!e&&t,f=r({queryKey:[`v2-snapshot`,e],queryFn:({signal:t})=>z.snapshot(e,t),enabled:d,refetchInterval:5e3}),p=r({queryKey:[`v2-status`,e],queryFn:({signal:t})=>z.status(e,t),enabled:d,refetchInterval:6e3}),m=r({queryKey:[`v2-events`,e],queryFn:({signal:t})=>z.events(e,220,t),enabled:d,refetchInterval:15e3});(0,F.useEffect)(()=>{s([]),l(!1)},[e]),(0,F.useEffect)(()=>{!e||!m.data||s(e=>Et(e,m.data))},[m.data,e]),(0,F.useEffect)(()=>{if(!e||!t){l(!1);return}let r=Re(e,t=>{s(e=>Et(e,[t])),u.current??=window.setTimeout(()=>{u.current=null,n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]})},900)},l);return()=>{r.close(),l(!1),u.current!=null&&(window.clearTimeout(u.current),u.current=null)}},[t,n,e]);let h=async()=>{e&&await Promise.all([n.invalidateQueries({queryKey:[`v2-snapshot`,e]}),n.invalidateQueries({queryKey:[`v2-status`,e]}),n.invalidateQueries({queryKey:[`v2-events`,e]})])},g=a({mutationFn:()=>z.startDaemon(e,f.data?.daemon_commands?.revision),onSuccess:h}),_=a({mutationFn:t=>z.stopDaemon(e,t,f.data?.daemon_commands?.revision),onSuccess:h}),v=(0,F.useMemo)(()=>{let e=[f,p,m].find(e=>e.error);return e?.error instanceof Error?e.error:null},[m,f,p]);return{snapshot:f,status:p,events:o,connected:c,refresh:h,controls:{start:g,stop:_},error:v}}function kt({sid:e,active:t}){let{locale:n}=p(),[r,i]=(0,F.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`module`);return Ct.find(t=>t.id===e)?.id??`overview`}),[a,o]=(0,F.useState)(()=>new Set([r])),s=(0,F.useCallback)(e=>{i(e),o(t=>t.has(e)?t:new Set([...t,e]))},[]),c=Dt(t),l=c.data?.projects??[],u=(0,F.useMemo)(()=>l.find(t=>t.id===e)??null,[l,e]),d=Ot(e,t),f=r,m=d.controls.start.error||d.controls.stop.error,h=u&&d.snapshot.data?{sid:e,active:t,project:u,snapshot:d.snapshot.data,status:d.status.data,events:d.events,connected:d.connected,snapshotUpdatedAt:d.snapshot.dataUpdatedAt,refresh:d.refresh,controls:{start:async()=>{try{return await d.controls.start.mutateAsync()}catch{return null}},stop:async e=>{try{return await d.controls.stop.mutateAsync(e)}catch{return null}},busy:d.controls.start.isPending||d.controls.stop.isPending,error:m instanceof Error?m.message:``},navigate:s}:null;return(0,U.jsxs)(`section`,{className:`integrated-workbench flex min-h-0 flex-1 flex-col bg-transparent text-ink`,children:[(0,U.jsx)(`nav`,{className:`workbench-module-tabs shrink-0 border-b border-line/60 px-3 py-2`,"aria-label":n===`zh-CN`?`工作台模块`:`Workbench modules`,children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Ct.map(({id:e,zh:t,en:r,icon:i})=>(0,U.jsxs)(`button`,{type:`button`,className:`workbench-module-tab`,"data-module":e,"data-selected":f===e,"aria-pressed":f===e,onClick:()=>s(e),children:[(0,U.jsx)(i,{size:14}),(0,U.jsx)(`span`,{children:n===`zh-CN`?t:r})]},e))})}),c.isError&&!u||d.snapshot.isError&&!d.snapshot.data?(0,U.jsx)(G,{title:n===`zh-CN`?`工作台读取失败`:`Workbench unavailable`,description:`Argus API did not return the selected project.`}):h?Ct.filter(({id:e})=>a.has(e)).map(({id:n})=>(0,U.jsx)(`div`,{className:`ros-content min-h-0 flex-1 overflow-x-hidden overflow-y-auto ${f===n?``:`hidden`}`,"aria-hidden":f!==n,children:n===`overview`?(0,U.jsx)(wt,{...h,active:t&&f===n}):n===`timeline`?(0,U.jsx)(xt,{sid:e}):n===`experiments`?(0,U.jsx)(ct,{...h,active:t&&f===n}):(0,U.jsx)(gt,{...h,active:t&&f===n})},`${e}:${n}`)):(0,U.jsx)(`div`,{className:`boot-state`,children:(0,U.jsx)(Ye,{label:n===`zh-CN`?`正在载入工作台`:`Loading workbench`})})]})}export{kt as ResearchWorkbenchPanel}; \ No newline at end of file diff --git a/frontend/web/dist/assets/WorkflowWorkbench-ALJfwXlc.js b/frontend/web/dist/assets/WorkflowWorkbench-ALJfwXlc.js new file mode 100644 index 000000000..ebe438d34 --- /dev/null +++ b/frontend/web/dist/assets/WorkflowWorkbench-ALJfwXlc.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,c as i}from"./query-dCPZk0Xc.js";import{N as a,O as o}from"./index-Cr9q41CR.js";import{i as s}from"./format-BNcptKD6.js";import{r as c,t as l}from"./useWorkbenchTheme-Drg51S8W.js";var u=e(n(),1),d=t();function f(){let{locale:e,setLocale:t}=o(),n=(t,n)=>e===`zh-CN`?t:n,{cycleTheme:f}=l(),p=i(),[m,h]=(0,u.useState)(new URLSearchParams(window.location.search).get(`project`)||``),[g,_]=(0,u.useState)({project:``,objective:``,domain:``,profile:``,mode:`design`,timeout_s:600,max_rounds:3}),[v,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(``),[O,k]=(0,u.useState)(null),A=r({queryKey:[`workflow-catalog`],queryFn:a.workflows.catalog}),j=r({queryKey:[`workflow`,m],queryFn:()=>a.workflows.snapshot(m),enabled:!!m,refetchInterval:2e3}),M=j.data,N=M?.jobs.filter(e=>[`starting`,`running`].includes(e.status))??[],P=N.some(e=>e.action!==`chat`)||!!M?.calls.some(e=>e.operation!==`chat`&&e.live),F=N.some(e=>e.action===`chat`),I=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40 hover:bg-panel`,L=`w-full rounded-lg border border-line bg-surface px-3 py-2 text-sm text-ink`;function R(e){h(e),k(null);let t=new URL(window.location.href);t.searchParams.set(`project`,e),window.history.replaceState(null,``,t)}async function z(e,t=!1){T(!0),C(``);try{let n=await e();return t&&R(n.id),await p.invalidateQueries({queryKey:[`workflow`,n.id]}),await p.invalidateQueries({queryKey:[`workflow-catalog`]}),!0}catch(e){return C(s(e)),!1}finally{T(!1)}}let B=e=>z(()=>a.workflows.action(m,e)),V=async e=>{C(``);try{k(await a.workflows.document(m,e))}catch(e){C(s(e))}};return(0,d.jsxs)(`main`,{className:`min-h-screen bg-surface text-ink`,children:[(0,d.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-line px-6 py-4`,children:[(0,d.jsx)(c,{size:36,tag:n(`工程工作台`,`Engineering workbench`)}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsx)(`button`,{className:I,onClick:()=>t(e===`zh-CN`?`en`:`zh-CN`),children:`EN / 中文`}),(0,d.jsx)(`button`,{className:I,onClick:f,children:n(`切换主题`,`Theme`)}),(0,d.jsx)(`button`,{className:I,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`legacy`,`1`),e.searchParams.delete(`project`),window.location.assign(e)},children:n(`Argus 兼容会话`,`Legacy Argus sessions`)})]})]}),(0,d.jsxs)(`div`,{className:`mx-auto grid max-w-[1600px] gap-6 p-6 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,d.jsxs)(`aside`,{className:`space-y-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`工程工单`,`Work orders`)}),A.data?.projects.map(e=>(0,d.jsxs)(`button`,{className:`${I} w-full text-left ${m===e.id?`text-blue`:``}`,onClick:()=>R(e.id),children:[(0,d.jsx)(`span`,{className:`block font-mono`,children:e.id}),(0,d.jsx)(`span`,{className:`block truncate text-xs text-ink-faint`,children:e.project})]},e.id)),(0,d.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),z(()=>a.workflows.create(g),!0)},children:[(0,d.jsx)(`h3`,{className:`font-medium`,children:n(`新建或打开`,`Create or open`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`后端主机上的绝对目录`,`Absolute directory on the backend host`),(0,d.jsx)(`input`,{className:L,value:g.project,required:!0,placeholder:`/path/to/design`,onChange:e=>_({...g,project:e.target.value})})]}),(0,d.jsx)(`button`,{type:`button`,className:I,disabled:w||!g.project.trim(),onClick:()=>void z(()=>a.workflows.open(g.project),!0),children:n(`打开已有 Vulcan 工单`,`Open existing Vulcan work order`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`原始工程目标`,`Original objective`),(0,d.jsx)(`textarea`,{className:L,rows:4,required:!0,value:g.objective,onChange:e=>_({...g,objective:e.target.value})})]}),(0,d.jsxs)(`select`,{"aria-label":n(`领域`,`Domain`),className:L,required:!0,value:g.domain,onChange:e=>_({...g,domain:e.target.value,profile:``}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择硬件领域`,`Choose hardware domain`)}),Object.keys(A.data?.domains??{}).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`配置`,`Profile`),className:L,required:!0,value:g.profile,onChange:e=>_({...g,profile:e.target.value}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择配置`,`Choose profile`)}),(A.data?.domains[g.domain]??[]).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`模式`,`Mode`),className:L,value:g.mode,onChange:e=>_({...g,mode:e.target.value===`verify`?`verify`:`design`}),children:[(0,d.jsx)(`option`,{value:`design`,children:n(`设计与验证`,`Design and verification`)}),(0,d.jsx)(`option`,{value:`verify`,children:n(`仅验证已有设计`,`Verify existing design`)})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`每次角色调用上限(秒)`,`Per-role time limit (seconds)`),(0,d.jsx)(`input`,{type:`number`,min:1,className:L,required:!0,value:g.timeout_s,onChange:e=>_({...g,timeout_s:e.target.valueAsNumber})})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`最大修复轮数`,`Maximum repair rounds`),(0,d.jsx)(`input`,{type:`number`,min:1,max:32,className:L,required:!0,value:g.max_rounds,onChange:e=>_({...g,max_rounds:e.target.valueAsNumber})})]}),(0,d.jsx)(`button`,{className:I,disabled:w,children:n(`创建工单`,`Create work order`)})]})]}),(0,d.jsxs)(`section`,{className:`min-w-0 space-y-5`,children:[(S||A.error||j.error)&&(0,d.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-line p-4 text-err`,children:S||s(A.error||j.error)}),!M&&(0,d.jsx)(`p`,{className:`text-ink-faint`,children:n(`打开工单后查看规格、角色状态、实验和独立审查。创建本身不会调用模型。`,`Open a work order to inspect its specification, roles, experiments and independent reviews. Creation does not call a model.`)}),M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,d.jsx)(`h1`,{className:`text-xl font-semibold`,children:M.objective}),(0,d.jsx)(`span`,{className:`font-mono text-sm`,children:M.independently_accepted?n(`独立审查已接受`,`Independently accepted`):M.status})]}),(0,d.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-ink-faint`,children:M.project}),(0,d.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:A.data?.roles.map(e=>(0,d.jsxs)(`span`,{className:`rounded-full border border-line px-3 py-1 text-xs`,children:[e,e===`designer`&&M.mode===`verify`?n(` · 未启用`,` · not selected`):M.calls.some(t=>t.role===e&&t.live)?n(` · 运行中`,` · active`):``]},e))}),(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsx)(`button`,{className:I,disabled:w||P||[`completed`,`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status),onClick:()=>void B({action:`run`,allow_model:!0}),children:n(`开始模型辅助工程`,`Run with models`)}),(0,d.jsx)(`button`,{className:I,disabled:w||!N.length,onClick:()=>void B({action:`stop`}),children:n(`停止工作台请求`,`Stop workbench requests`)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,onClick:()=>void B({action:`recover`}),children:n(`结算已中断进程`,`Recover interrupted work`)})]}),M.feedback&&(0,d.jsx)(`p`,{className:`mt-4 whitespace-pre-wrap`,children:M.feedback}),[`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status)&&(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),B({action:`resume`,allow_model:!0,reason:b})},children:[(0,d.jsx)(`input`,{className:L,value:b,required:!0,placeholder:n(`说明诊断或恢复原因`,`Explain the diagnosis or recovery`),onChange:e=>x(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,children:n(`继续`,`Resume`)})]})]}),M.plan&&(0,d.jsxs)(`details`,{open:!0,className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`summary`,{className:`font-semibold`,children:n(`路线图与当前规格`,`Roadmap and current specification`)}),(0,d.jsx)(`ol`,{className:`my-3 list-inside list-decimal`,children:M.plan.roadmap.map((e,t)=>(0,d.jsx)(`li`,{children:e},t))}),(0,d.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm`,children:M.plan.spec}),M.plan.checks.map(e=>(0,d.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs`,children:[e.id,`: `,e.argv?.join(` `)??e.provider_stage]},e.id))]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:`Coordinator`}),(0,d.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:n(`对话不派工,工程运行时仍可询问进度。`,`Dialogue does not dispatch work and remains available during execution.`)}),M.messages.map((e,t)=>(0,d.jsxs)(`div`,{className:`my-4 space-y-2 whitespace-pre-wrap text-sm`,children:[(0,d.jsx)(`p`,{className:`font-semibold`,children:e.user}),(0,d.jsx)(`p`,{children:e.reply})]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:async e=>{e.preventDefault(),await B({action:`chat`,allow_model:!0,message:v})&&y(``)},children:[(0,d.jsx)(`textarea`,{className:L,rows:2,required:!0,value:v,"aria-label":n(`询问 Coordinator`,`Ask Coordinator`),onChange:e=>y(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||F,children:n(`发送`,`Send`)})]})]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`实际执行与审查记录`,`Execution and review records`)}),(0,d.jsx)(`p`,{className:`my-2 text-xs text-ink-faint`,children:n(`时长为调用/工具墙钟时间,包含等待,不等于模型推理利用率。`,`Durations are call/tool wall time, including waiting, not inference utilization.`)}),M.calls.map(e=>(0,d.jsxs)(`div`,{className:`border-t border-line py-3 text-sm`,children:[(0,d.jsxs)(`p`,{children:[e.role,` · `,e.operation,` · `,e.status,e.decision?` · ${n(`审查决定`,`review decision`)}: ${e.decision.status}`:``,e.duration_s===null?``:` · ${e.duration_s.toFixed(2)}s`]}),e.detail&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.detail}),e.decision?.reason&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.decision.reason}),(0,d.jsx)(`button`,{className:`mr-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/stdout.log`),children:`stdout`}),(0,d.jsx)(`button`,{className:`text-xs text-blue`,onClick:()=>void V(`${e.folder}/stderr.log`),children:`stderr`}),e.role!==`host`&&(0,d.jsx)(`button`,{className:`ml-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/response.json`),children:n(`角色回复`,`Role response`)})]},e.folder)),M.jobs.filter(e=>e.detail).map(e=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[e.id,` · `,e.action,` · `,e.status,`: `,e.detail,(0,d.jsx)(`br`,{}),(0,d.jsx)(`span`,{className:`font-mono text-xs`,children:e.log})]},e.id)),M.resumes.map((e,t)=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[n(`恢复原因`,`Resume reason`),`: `,e]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),V(E)},children:[(0,d.jsx)(`input`,{className:L,value:E,required:!0,onChange:e=>D(e.target.value),"aria-label":n(`查看源文件或证据`,`Inspect source or evidence`),placeholder:n(`工程内相对路径,例如 rtl/counter4.sv`,`Relative project path, e.g. rtl/counter4.sv`)}),(0,d.jsx)(`button`,{className:I,children:n(`查看文件`,`Read file`)})]})]})]}),O&&(0,d.jsxs)(`section`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`break-all font-mono text-sm`,children:O.path}),O.truncated&&(0,d.jsx)(`p`,{role:`status`,children:n(`仅显示前 128 KiB;完整文件保留在工程目录。`,`Showing the first 128 KiB; the full file remains in the project.`)}),(0,d.jsx)(`pre`,{className:`mt-3 max-h-[600px] overflow-auto whitespace-pre-wrap text-xs`,children:O.text})]})]})]})]})}export{f as default}; \ No newline at end of file diff --git a/frontend/web/dist/assets/WorkflowWorkbench-COIoFnqD.js b/frontend/web/dist/assets/WorkflowWorkbench-COIoFnqD.js new file mode 100644 index 000000000..4fc9d23ea --- /dev/null +++ b/frontend/web/dist/assets/WorkflowWorkbench-COIoFnqD.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,c as i}from"./query-dCPZk0Xc.js";import{N as a,O as o,U as s}from"./index-DPfzOfKU.js";import{i as c}from"./format-D4uyBiG8.js";import{r as l,t as u}from"./useWorkbenchTheme-BqK4B8rm.js";var d=e(n(),1),f=t();function p(){let{locale:e,setLocale:t}=o(),n=(t,n)=>e===`zh-CN`?t:n,{cycleTheme:p}=u(),m=i(),[h,g]=(0,d.useState)(new URLSearchParams(window.location.search).get(`project`)||``),[_,v]=(0,d.useState)({project:``,objective:``,domain:``,profile:``,mode:`design`,timeout_s:600,max_rounds:3}),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)(``),[C,w]=(0,d.useState)(``),[T,E]=(0,d.useState)(!1),[D,O]=(0,d.useState)(``),[k,A]=(0,d.useState)(null),j=r({queryKey:[`workflow-catalog`],queryFn:a.workflows.catalog}),M=r({queryKey:[`workflow`,h],queryFn:()=>a.workflows.snapshot(h),enabled:!!h,refetchInterval:2e3}),N=M.data,P=N?.jobs.filter(e=>[`starting`,`running`].includes(e.status))??[],F=P.some(e=>e.action!==`chat`)||!!N?.calls.some(e=>e.operation!==`chat`&&e.live),I=P.some(e=>e.action===`chat`),L=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40 hover:bg-panel`,R=`w-full rounded-lg border border-line bg-surface px-3 py-2 text-sm text-ink`;function z(e){g(e),A(null);let t=new URL(window.location.href);t.searchParams.set(`project`,e),window.history.replaceState(null,``,t)}async function B(e,t=!1){E(!0),w(``);try{let n=await e();return t&&z(n.id),await m.invalidateQueries({queryKey:[`workflow`,n.id]}),await m.invalidateQueries({queryKey:[`workflow-catalog`]}),!0}catch(e){return w(c(e)),!1}finally{E(!1)}}let V=e=>B(()=>a.workflows.action(h,e)),H=async e=>{w(``);try{A(await a.workflows.document(h,e))}catch(e){w(c(e))}};return(0,f.jsxs)(`main`,{className:`min-h-screen bg-surface text-ink`,children:[(0,f.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-line px-6 py-4`,children:[(0,f.jsx)(l,{size:36,tag:n(`工程工作台`,`Engineering workbench`)}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(`button`,{className:L,onClick:()=>t(e===`zh-CN`?`en`:`zh-CN`),children:`EN / 中文`}),(0,f.jsx)(`button`,{className:L,onClick:p,children:n(`切换主题`,`Theme`)}),(0,f.jsx)(`button`,{className:L,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`legacy`,`1`),e.searchParams.delete(`project`),window.location.assign(e)},children:n(`Argus 兼容会话`,`Legacy Argus sessions`)})]})]}),(0,f.jsxs)(`div`,{className:`mx-auto grid max-w-[1600px] gap-6 p-6 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,f.jsxs)(`aside`,{className:`space-y-5`,children:[(0,f.jsx)(`h2`,{className:`font-semibold`,children:n(`工程工单`,`Work orders`)}),j.data?.projects.map(e=>(0,f.jsxs)(`button`,{className:`${L} w-full text-left ${h===e.id?`text-blue`:``}`,onClick:()=>z(e.id),children:[(0,f.jsx)(`span`,{className:`block font-mono`,children:e.id}),(0,f.jsx)(`span`,{className:`block truncate text-xs text-ink-faint`,children:e.project})]},e.id)),(0,f.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),B(()=>a.workflows.create(_),!0)},children:[(0,f.jsx)(`h3`,{className:`font-medium`,children:n(`新建或打开`,`Create or open`)}),(0,f.jsxs)(`label`,{className:`block text-xs`,children:[n(`后端主机上的绝对目录`,`Absolute directory on the backend host`),(0,f.jsx)(`input`,{className:R,value:_.project,required:!0,placeholder:`/path/to/design`,onChange:e=>v({..._,project:e.target.value})})]}),(0,f.jsx)(`button`,{type:`button`,className:L,disabled:T||!_.project.trim(),onClick:()=>void B(()=>a.workflows.open(_.project),!0),children:n(`打开已有 Vulcan 工单`,`Open existing Vulcan work order`)}),(0,f.jsxs)(`label`,{className:`block text-xs`,children:[n(`原始工程目标`,`Original objective`),(0,f.jsx)(`textarea`,{className:R,rows:4,required:!0,value:_.objective,onChange:e=>v({..._,objective:e.target.value})})]}),(0,f.jsxs)(`select`,{"aria-label":n(`领域`,`Domain`),className:R,required:!0,value:_.domain,onChange:e=>v({..._,domain:e.target.value,profile:``}),children:[(0,f.jsx)(`option`,{value:``,children:n(`选择硬件领域`,`Choose hardware domain`)}),Object.keys(j.data?.domains??{}).map(e=>(0,f.jsx)(`option`,{children:e},e))]}),(0,f.jsxs)(`select`,{"aria-label":n(`配置`,`Profile`),className:R,required:!0,value:_.profile,onChange:e=>v({..._,profile:e.target.value}),children:[(0,f.jsx)(`option`,{value:``,children:n(`选择配置`,`Choose profile`)}),(j.data?.domains[_.domain]??[]).map(e=>(0,f.jsx)(`option`,{children:e},e))]}),(0,f.jsxs)(`select`,{"aria-label":n(`模式`,`Mode`),className:R,value:_.mode,onChange:e=>v({..._,mode:e.target.value===`verify`?`verify`:`design`}),children:[(0,f.jsx)(`option`,{value:`design`,children:n(`设计与验证`,`Design and verification`)}),(0,f.jsx)(`option`,{value:`verify`,children:n(`仅验证已有设计`,`Verify existing design`)})]}),(0,f.jsxs)(`label`,{className:`block text-xs`,children:[n(`每次角色调用上限(秒)`,`Per-role time limit (seconds)`),(0,f.jsx)(`input`,{type:`number`,min:1,className:R,required:!0,value:_.timeout_s,onChange:e=>v({..._,timeout_s:e.target.valueAsNumber})})]}),(0,f.jsxs)(`label`,{className:`block text-xs`,children:[n(`最大修复轮数`,`Maximum repair rounds`),(0,f.jsx)(`input`,{type:`number`,min:1,max:32,className:R,required:!0,value:_.max_rounds,onChange:e=>v({..._,max_rounds:e.target.valueAsNumber})})]}),(0,f.jsx)(`button`,{className:L,disabled:T,children:n(`创建工单`,`Create work order`)})]})]}),(0,f.jsxs)(`section`,{className:`min-w-0 space-y-5`,children:[(C||j.error||M.error)&&(0,f.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-line p-4 text-err`,children:C||c(j.error||M.error)}),!N&&(0,f.jsx)(`p`,{className:`text-ink-faint`,children:n(`打开工单后查看规格、角色状态、实验和独立审查。创建本身不会调用模型。`,`Open a work order to inspect its specification, roles, experiments and independent reviews. Creation does not call a model.`)}),N&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,f.jsx)(`h1`,{className:`text-xl font-semibold`,children:N.objective}),(0,f.jsx)(`span`,{className:`font-mono text-sm`,children:N.independently_accepted?n(`独立审查已接受`,`Independently accepted`):N.status})]}),(0,f.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-ink-faint`,children:N.project}),(0,f.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:j.data?.roles.map(e=>(0,f.jsxs)(`span`,{className:`rounded-full border border-line px-3 py-1 text-xs`,children:[e,e===`designer`&&N.mode===`verify`?n(` · 未启用`,` · not selected`):N.calls.some(t=>t.role===e&&t.live)?n(` · 运行中`,` · active`):``]},e))}),(0,f.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,f.jsx)(`button`,{className:L,disabled:T||F||[`completed`,`blocked`,`no_progress`,`interrupted`,`stale`].includes(N.status),onClick:()=>void V({action:`run`,allow_model:!0}),children:n(`开始模型辅助工程`,`Run with models`)}),(0,f.jsx)(`button`,{className:L,disabled:T||!P.length,onClick:()=>void V({action:`stop`}),children:n(`停止工作台请求`,`Stop workbench requests`)}),(0,f.jsx)(`button`,{className:L,disabled:T||F,onClick:()=>void V({action:`recover`}),children:n(`结算已中断进程`,`Recover interrupted work`)})]}),N.feedback&&(0,f.jsx)(`p`,{className:`mt-4 whitespace-pre-wrap`,children:N.feedback}),[`blocked`,`no_progress`,`interrupted`,`stale`].includes(N.status)&&(0,f.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),V({action:`resume`,allow_model:!0,reason:x})},children:[(0,f.jsx)(`input`,{className:R,value:x,required:!0,placeholder:n(`说明诊断或恢复原因`,`Explain the diagnosis or recovery`),onChange:e=>S(e.target.value)}),(0,f.jsx)(`button`,{className:L,disabled:T||F,children:n(`继续`,`Resume`)})]})]}),N.plan&&(0,f.jsxs)(`details`,{open:!0,className:`rounded-xl border border-line p-5`,children:[(0,f.jsx)(`summary`,{className:`font-semibold`,children:n(`路线图与当前规格`,`Roadmap and current specification`)}),(0,f.jsx)(`ol`,{className:`my-3 list-inside list-decimal`,children:N.plan.roadmap.map((e,t)=>(0,f.jsx)(`li`,{children:e},t))}),(0,f.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm`,children:N.plan.spec}),N.plan.checks.map(e=>(0,f.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs`,children:[e.id,`: `,e.argv?.join(` `)??e.provider_stage]},e.id))]}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,f.jsx)(`h2`,{className:`font-semibold`,children:`Coordinator`}),(0,f.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:n(`对话不派工,工程运行时仍可询问进度。`,`Dialogue does not dispatch work and remains available during execution.`)}),N.messages.map((e,t)=>(0,f.jsxs)(`div`,{className:`my-4 space-y-2 whitespace-pre-wrap text-sm`,children:[(0,f.jsx)(`p`,{className:`font-semibold`,children:e.user}),(0,f.jsx)(`p`,{children:e.reply})]},t)),(0,f.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:async e=>{e.preventDefault(),await V({action:`chat`,allow_model:!0,message:y})&&b(``)},children:[(0,f.jsx)(`textarea`,{className:R,rows:2,required:!0,value:y,"aria-label":n(`询问 Coordinator`,`Ask Coordinator`),onChange:e=>b(e.target.value)}),(0,f.jsx)(`button`,{className:L,disabled:T||I,children:n(`发送`,`Send`)})]})]}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,f.jsx)(`h2`,{className:`font-semibold`,children:n(`实际执行与审查记录`,`Execution and review records`)}),(0,f.jsx)(`p`,{className:`my-2 text-xs text-ink-faint`,children:n(`时长为调用/工具墙钟时间,包含等待,不等于模型推理利用率。`,`Durations are call/tool wall time, including waiting, not inference utilization.`)}),N.calls.map(e=>(0,f.jsxs)(`div`,{className:`border-t border-line py-3 text-sm`,children:[(0,f.jsxs)(`p`,{children:[s(e.role,n(`工具执行`,`Tool execution`)),` · `,e.operation,` · `,e.status,e.decision?` · ${n(`审查决定`,`review decision`)}: ${e.decision.status}`:``,e.duration_s===null?``:` · ${e.duration_s.toFixed(2)}s`]}),e.detail&&(0,f.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.detail}),e.decision?.reason&&(0,f.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.decision.reason}),(0,f.jsx)(`button`,{className:`mr-3 text-xs text-blue`,onClick:()=>void H(`${e.folder}/stdout.log`),children:`stdout`}),(0,f.jsx)(`button`,{className:`text-xs text-blue`,onClick:()=>void H(`${e.folder}/stderr.log`),children:`stderr`}),e.role!==`host`&&(0,f.jsx)(`button`,{className:`ml-3 text-xs text-blue`,onClick:()=>void H(`${e.folder}/response.json`),children:n(`角色回复`,`Role response`)})]},e.folder)),N.jobs.filter(e=>e.detail).map(e=>(0,f.jsxs)(`p`,{className:`my-2 text-sm`,children:[e.id,` · `,e.action,` · `,e.status,`: `,e.detail,(0,f.jsx)(`br`,{}),(0,f.jsx)(`span`,{className:`font-mono text-xs`,children:e.log})]},e.id)),N.resumes.map((e,t)=>(0,f.jsxs)(`p`,{className:`my-2 text-sm`,children:[n(`恢复原因`,`Resume reason`),`: `,e]},t)),(0,f.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),H(D)},children:[(0,f.jsx)(`input`,{className:R,value:D,required:!0,onChange:e=>O(e.target.value),"aria-label":n(`查看源文件或证据`,`Inspect source or evidence`),placeholder:n(`工程内相对路径,例如 rtl/counter4.sv`,`Relative project path, e.g. rtl/counter4.sv`)}),(0,f.jsx)(`button`,{className:L,children:n(`查看文件`,`Read file`)})]})]})]}),k&&(0,f.jsxs)(`section`,{className:`rounded-xl border border-line p-5`,children:[(0,f.jsx)(`h2`,{className:`break-all font-mono text-sm`,children:k.path}),k.truncated&&(0,f.jsx)(`p`,{role:`status`,children:n(`仅显示前 128 KiB;完整文件保留在工程目录。`,`Showing the first 128 KiB; the full file remains in the project.`)}),(0,f.jsx)(`pre`,{className:`mt-3 max-h-[600px] overflow-auto whitespace-pre-wrap text-xs`,children:k.text})]})]})]})]})}export{p as default}; \ No newline at end of file diff --git a/frontend/web/dist/assets/WorkflowWorkbench-CU9bNt08.js b/frontend/web/dist/assets/WorkflowWorkbench-CU9bNt08.js new file mode 100644 index 000000000..6bcef372d --- /dev/null +++ b/frontend/web/dist/assets/WorkflowWorkbench-CU9bNt08.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i}from"./query-CUzIxVzm.js";import{P as a,k as o}from"./index-Cb5-aRKO.js";import{i as s}from"./format-CtVQGh59.js";import{r as c,t as l}from"./useWorkbenchTheme-Bu46ZOFm.js";var u=e(t(),1),d=n();function f(){let{locale:e,setLocale:t}=o(),n=(t,n)=>e===`zh-CN`?t:n,{cycleTheme:f}=l(),p=i(),[m,h]=(0,u.useState)(new URLSearchParams(window.location.search).get(`project`)||``),[g,_]=(0,u.useState)({project:``,objective:``,domain:``,profile:``,mode:`design`,timeout_s:600,max_rounds:3}),[v,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(``),[O,k]=(0,u.useState)(null),A=r({queryKey:[`workflow-catalog`],queryFn:a.workflows.catalog}),j=r({queryKey:[`workflow`,m],queryFn:()=>a.workflows.snapshot(m),enabled:!!m,refetchInterval:2e3}),M=j.data,N=M?.jobs.filter(e=>[`starting`,`running`].includes(e.status))??[],P=N.some(e=>e.action!==`chat`)||!!M?.calls.some(e=>e.operation!==`chat`&&e.live),F=N.some(e=>e.action===`chat`),I=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40 hover:bg-panel`,L=`w-full rounded-lg border border-line bg-surface px-3 py-2 text-sm text-ink`;function R(e){h(e),k(null);let t=new URL(window.location.href);t.searchParams.set(`project`,e),window.history.replaceState(null,``,t)}async function z(e,t=!1){T(!0),C(``);try{let n=await e();return t&&R(n.id),await p.invalidateQueries({queryKey:[`workflow`,n.id]}),await p.invalidateQueries({queryKey:[`workflow-catalog`]}),!0}catch(e){return C(s(e)),!1}finally{T(!1)}}let B=e=>z(()=>a.workflows.action(m,e)),V=async e=>{C(``);try{k(await a.workflows.document(m,e))}catch(e){C(s(e))}};return(0,d.jsxs)(`main`,{className:`min-h-screen bg-surface text-ink`,children:[(0,d.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-line px-6 py-4`,children:[(0,d.jsx)(c,{size:36,tag:n(`工程工作台`,`Engineering workbench`)}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsx)(`button`,{className:I,onClick:()=>t(e===`zh-CN`?`en`:`zh-CN`),children:`EN / 中文`}),(0,d.jsx)(`button`,{className:I,onClick:f,children:n(`切换主题`,`Theme`)}),(0,d.jsx)(`button`,{className:I,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`legacy`,`1`),e.searchParams.delete(`project`),window.location.assign(e)},children:n(`Argus 兼容会话`,`Legacy Argus sessions`)})]})]}),(0,d.jsxs)(`div`,{className:`mx-auto grid max-w-[1600px] gap-6 p-6 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,d.jsxs)(`aside`,{className:`space-y-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`工程工单`,`Work orders`)}),A.data?.projects.map(e=>(0,d.jsxs)(`button`,{className:`${I} w-full text-left ${m===e.id?`text-blue`:``}`,onClick:()=>R(e.id),children:[(0,d.jsx)(`span`,{className:`block font-mono`,children:e.id}),(0,d.jsx)(`span`,{className:`block truncate text-xs text-ink-faint`,children:e.project})]},e.id)),(0,d.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),z(()=>a.workflows.create(g),!0)},children:[(0,d.jsx)(`h3`,{className:`font-medium`,children:n(`新建或打开`,`Create or open`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`后端主机上的绝对目录`,`Absolute directory on the backend host`),(0,d.jsx)(`input`,{className:L,value:g.project,required:!0,placeholder:`/path/to/design`,onChange:e=>_({...g,project:e.target.value})})]}),(0,d.jsx)(`button`,{type:`button`,className:I,disabled:w||!g.project.trim(),onClick:()=>void z(()=>a.workflows.open(g.project),!0),children:n(`打开已有 Vulcan 工单`,`Open existing Vulcan work order`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`原始工程目标`,`Original objective`),(0,d.jsx)(`textarea`,{className:L,rows:4,required:!0,value:g.objective,onChange:e=>_({...g,objective:e.target.value})})]}),(0,d.jsxs)(`select`,{"aria-label":n(`领域`,`Domain`),className:L,required:!0,value:g.domain,onChange:e=>_({...g,domain:e.target.value,profile:``}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择硬件领域`,`Choose hardware domain`)}),Object.keys(A.data?.domains??{}).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`配置`,`Profile`),className:L,required:!0,value:g.profile,onChange:e=>_({...g,profile:e.target.value}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择配置`,`Choose profile`)}),(A.data?.domains[g.domain]??[]).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`模式`,`Mode`),className:L,value:g.mode,onChange:e=>_({...g,mode:e.target.value===`verify`?`verify`:`design`}),children:[(0,d.jsx)(`option`,{value:`design`,children:n(`设计与验证`,`Design and verification`)}),(0,d.jsx)(`option`,{value:`verify`,children:n(`仅验证已有设计`,`Verify existing design`)})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`每次角色调用上限(秒)`,`Per-role time limit (seconds)`),(0,d.jsx)(`input`,{type:`number`,min:1,className:L,required:!0,value:g.timeout_s,onChange:e=>_({...g,timeout_s:e.target.valueAsNumber})})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`最大修复轮数`,`Maximum repair rounds`),(0,d.jsx)(`input`,{type:`number`,min:1,max:32,className:L,required:!0,value:g.max_rounds,onChange:e=>_({...g,max_rounds:e.target.valueAsNumber})})]}),(0,d.jsx)(`button`,{className:I,disabled:w,children:n(`创建工单`,`Create work order`)})]})]}),(0,d.jsxs)(`section`,{className:`min-w-0 space-y-5`,children:[(S||A.error||j.error)&&(0,d.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-line p-4 text-err`,children:S||s(A.error||j.error)}),!M&&(0,d.jsx)(`p`,{className:`text-ink-faint`,children:n(`打开工单后查看规格、角色状态、实验和独立审查。创建本身不会调用模型。`,`Open a work order to inspect its specification, roles, experiments and independent reviews. Creation does not call a model.`)}),M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,d.jsx)(`h1`,{className:`text-xl font-semibold`,children:M.objective}),(0,d.jsx)(`span`,{className:`font-mono text-sm`,children:M.independently_accepted?n(`独立审查已接受`,`Independently accepted`):M.status})]}),(0,d.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-ink-faint`,children:M.project}),(0,d.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:A.data?.roles.map(e=>(0,d.jsxs)(`span`,{className:`rounded-full border border-line px-3 py-1 text-xs`,children:[e,e===`designer`&&M.mode===`verify`?n(` · 未启用`,` · not selected`):M.calls.some(t=>t.role===e&&t.live)?n(` · 运行中`,` · active`):``]},e))}),(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsx)(`button`,{className:I,disabled:w||P||[`completed`,`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status),onClick:()=>void B({action:`run`,allow_model:!0}),children:n(`开始模型辅助工程`,`Run with models`)}),(0,d.jsx)(`button`,{className:I,disabled:w||!N.length,onClick:()=>void B({action:`stop`}),children:n(`停止工作台请求`,`Stop workbench requests`)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,onClick:()=>void B({action:`recover`}),children:n(`结算已中断进程`,`Recover interrupted work`)})]}),M.feedback&&(0,d.jsx)(`p`,{className:`mt-4 whitespace-pre-wrap`,children:M.feedback}),[`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status)&&(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),B({action:`resume`,allow_model:!0,reason:b})},children:[(0,d.jsx)(`input`,{className:L,value:b,required:!0,placeholder:n(`说明诊断或恢复原因`,`Explain the diagnosis or recovery`),onChange:e=>x(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,children:n(`继续`,`Resume`)})]})]}),M.plan&&(0,d.jsxs)(`details`,{open:!0,className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`summary`,{className:`font-semibold`,children:n(`路线图与当前规格`,`Roadmap and current specification`)}),(0,d.jsx)(`ol`,{className:`my-3 list-inside list-decimal`,children:M.plan.roadmap.map((e,t)=>(0,d.jsx)(`li`,{children:e},t))}),(0,d.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm`,children:M.plan.spec}),M.plan.checks.map(e=>(0,d.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs`,children:[e.id,`: `,e.argv?.join(` `)??e.provider_stage]},e.id))]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:`Coordinator`}),(0,d.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:n(`对话不派工,工程运行时仍可询问进度。`,`Dialogue does not dispatch work and remains available during execution.`)}),M.messages.map((e,t)=>(0,d.jsxs)(`div`,{className:`my-4 space-y-2 whitespace-pre-wrap text-sm`,children:[(0,d.jsx)(`p`,{className:`font-semibold`,children:e.user}),(0,d.jsx)(`p`,{children:e.reply})]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:async e=>{e.preventDefault(),await B({action:`chat`,allow_model:!0,message:v})&&y(``)},children:[(0,d.jsx)(`textarea`,{className:L,rows:2,required:!0,value:v,"aria-label":n(`询问 Coordinator`,`Ask Coordinator`),onChange:e=>y(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||F,children:n(`发送`,`Send`)})]})]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`实际执行与审查记录`,`Execution and review records`)}),(0,d.jsx)(`p`,{className:`my-2 text-xs text-ink-faint`,children:n(`时长为调用/工具墙钟时间,包含等待,不等于模型推理利用率。`,`Durations are call/tool wall time, including waiting, not inference utilization.`)}),M.calls.map(e=>(0,d.jsxs)(`div`,{className:`border-t border-line py-3 text-sm`,children:[(0,d.jsxs)(`p`,{children:[e.role,` · `,e.operation,` · `,e.status,e.decision?` · ${n(`审查决定`,`review decision`)}: ${e.decision.status}`:``,e.duration_s===null?``:` · ${e.duration_s.toFixed(2)}s`]}),e.detail&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.detail}),e.decision?.reason&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.decision.reason}),(0,d.jsx)(`button`,{className:`mr-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/stdout.log`),children:`stdout`}),(0,d.jsx)(`button`,{className:`text-xs text-blue`,onClick:()=>void V(`${e.folder}/stderr.log`),children:`stderr`}),e.role!==`host`&&(0,d.jsx)(`button`,{className:`ml-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/response.json`),children:n(`角色回复`,`Role response`)})]},e.folder)),M.jobs.filter(e=>e.detail).map(e=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[e.id,` · `,e.action,` · `,e.status,`: `,e.detail,(0,d.jsx)(`br`,{}),(0,d.jsx)(`span`,{className:`font-mono text-xs`,children:e.log})]},e.id)),M.resumes.map((e,t)=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[n(`恢复原因`,`Resume reason`),`: `,e]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),V(E)},children:[(0,d.jsx)(`input`,{className:L,value:E,required:!0,onChange:e=>D(e.target.value),"aria-label":n(`查看源文件或证据`,`Inspect source or evidence`),placeholder:n(`工程内相对路径,例如 rtl/counter4.sv`,`Relative project path, e.g. rtl/counter4.sv`)}),(0,d.jsx)(`button`,{className:I,children:n(`查看文件`,`Read file`)})]})]})]}),O&&(0,d.jsxs)(`section`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`break-all font-mono text-sm`,children:O.path}),O.truncated&&(0,d.jsx)(`p`,{role:`status`,children:n(`仅显示前 128 KiB;完整文件保留在工程目录。`,`Showing the first 128 KiB; the full file remains in the project.`)}),(0,d.jsx)(`pre`,{className:`mt-3 max-h-[600px] overflow-auto whitespace-pre-wrap text-xs`,children:O.text})]})]})]})]})}export{f as default}; \ No newline at end of file diff --git a/frontend/web/dist/assets/WorkflowWorkbench-DLfSiGqy.js b/frontend/web/dist/assets/WorkflowWorkbench-DLfSiGqy.js new file mode 100644 index 000000000..a6f3d92bd --- /dev/null +++ b/frontend/web/dist/assets/WorkflowWorkbench-DLfSiGqy.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i}from"./query-CUzIxVzm.js";import{P as a,k as o}from"./index-W1lBlVkr.js";import{i as s}from"./format-1SN2SmDZ.js";import{r as c,t as l}from"./useWorkbenchTheme-D7cPkLzc.js";var u=e(t(),1),d=n();function f(){let{locale:e,setLocale:t}=o(),n=(t,n)=>e===`zh-CN`?t:n,{cycleTheme:f}=l(),p=i(),[m,h]=(0,u.useState)(new URLSearchParams(window.location.search).get(`project`)||``),[g,_]=(0,u.useState)({project:``,objective:``,domain:``,profile:``,mode:`design`,timeout_s:600,max_rounds:3}),[v,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(``),[O,k]=(0,u.useState)(null),A=r({queryKey:[`workflow-catalog`],queryFn:a.workflows.catalog}),j=r({queryKey:[`workflow`,m],queryFn:()=>a.workflows.snapshot(m),enabled:!!m,refetchInterval:2e3}),M=j.data,N=M?.jobs.filter(e=>[`starting`,`running`].includes(e.status))??[],P=N.some(e=>e.action!==`chat`)||!!M?.calls.some(e=>e.operation!==`chat`&&e.live),F=N.some(e=>e.action===`chat`),I=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40 hover:bg-panel`,L=`w-full rounded-lg border border-line bg-surface px-3 py-2 text-sm text-ink`;function R(e){h(e),k(null);let t=new URL(window.location.href);t.searchParams.set(`project`,e),window.history.replaceState(null,``,t)}async function z(e,t=!1){T(!0),C(``);try{let n=await e();return t&&R(n.id),await p.invalidateQueries({queryKey:[`workflow`,n.id]}),await p.invalidateQueries({queryKey:[`workflow-catalog`]}),!0}catch(e){return C(s(e)),!1}finally{T(!1)}}let B=e=>z(()=>a.workflows.action(m,e)),V=async e=>{C(``);try{k(await a.workflows.document(m,e))}catch(e){C(s(e))}};return(0,d.jsxs)(`main`,{className:`min-h-screen bg-surface text-ink`,children:[(0,d.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-line px-6 py-4`,children:[(0,d.jsx)(c,{size:36,tag:n(`工程工作台`,`Engineering workbench`)}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsx)(`button`,{className:I,onClick:()=>t(e===`zh-CN`?`en`:`zh-CN`),children:`EN / 中文`}),(0,d.jsx)(`button`,{className:I,onClick:f,children:n(`切换主题`,`Theme`)}),(0,d.jsx)(`button`,{className:I,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`legacy`,`1`),e.searchParams.delete(`project`),window.location.assign(e)},children:n(`Argus 兼容会话`,`Legacy Argus sessions`)})]})]}),(0,d.jsxs)(`div`,{className:`mx-auto grid max-w-[1600px] gap-6 p-6 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,d.jsxs)(`aside`,{className:`space-y-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`工程工单`,`Work orders`)}),A.data?.projects.map(e=>(0,d.jsxs)(`button`,{className:`${I} w-full text-left ${m===e.id?`text-blue`:``}`,onClick:()=>R(e.id),children:[(0,d.jsx)(`span`,{className:`block font-mono`,children:e.id}),(0,d.jsx)(`span`,{className:`block truncate text-xs text-ink-faint`,children:e.project})]},e.id)),(0,d.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),z(()=>a.workflows.create(g),!0)},children:[(0,d.jsx)(`h3`,{className:`font-medium`,children:n(`新建或打开`,`Create or open`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`后端主机上的绝对目录`,`Absolute directory on the backend host`),(0,d.jsx)(`input`,{className:L,value:g.project,required:!0,placeholder:`/path/to/design`,onChange:e=>_({...g,project:e.target.value})})]}),(0,d.jsx)(`button`,{type:`button`,className:I,disabled:w||!g.project.trim(),onClick:()=>void z(()=>a.workflows.open(g.project),!0),children:n(`打开已有 Vulcan 工单`,`Open existing Vulcan work order`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`原始工程目标`,`Original objective`),(0,d.jsx)(`textarea`,{className:L,rows:4,required:!0,value:g.objective,onChange:e=>_({...g,objective:e.target.value})})]}),(0,d.jsxs)(`select`,{"aria-label":n(`领域`,`Domain`),className:L,required:!0,value:g.domain,onChange:e=>_({...g,domain:e.target.value,profile:``}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择硬件领域`,`Choose hardware domain`)}),Object.keys(A.data?.domains??{}).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`配置`,`Profile`),className:L,required:!0,value:g.profile,onChange:e=>_({...g,profile:e.target.value}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择配置`,`Choose profile`)}),(A.data?.domains[g.domain]??[]).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`模式`,`Mode`),className:L,value:g.mode,onChange:e=>_({...g,mode:e.target.value===`verify`?`verify`:`design`}),children:[(0,d.jsx)(`option`,{value:`design`,children:n(`设计与验证`,`Design and verification`)}),(0,d.jsx)(`option`,{value:`verify`,children:n(`仅验证已有设计`,`Verify existing design`)})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`每次角色调用上限(秒)`,`Per-role time limit (seconds)`),(0,d.jsx)(`input`,{type:`number`,min:1,className:L,required:!0,value:g.timeout_s,onChange:e=>_({...g,timeout_s:e.target.valueAsNumber})})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`最大修复轮数`,`Maximum repair rounds`),(0,d.jsx)(`input`,{type:`number`,min:1,max:32,className:L,required:!0,value:g.max_rounds,onChange:e=>_({...g,max_rounds:e.target.valueAsNumber})})]}),(0,d.jsx)(`button`,{className:I,disabled:w,children:n(`创建工单`,`Create work order`)})]})]}),(0,d.jsxs)(`section`,{className:`min-w-0 space-y-5`,children:[(S||A.error||j.error)&&(0,d.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-line p-4 text-err`,children:S||s(A.error||j.error)}),!M&&(0,d.jsx)(`p`,{className:`text-ink-faint`,children:n(`打开工单后查看规格、角色状态、实验和独立审查。创建本身不会调用模型。`,`Open a work order to inspect its specification, roles, experiments and independent reviews. Creation does not call a model.`)}),M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,d.jsx)(`h1`,{className:`text-xl font-semibold`,children:M.objective}),(0,d.jsx)(`span`,{className:`font-mono text-sm`,children:M.independently_accepted?n(`独立审查已接受`,`Independently accepted`):M.status})]}),(0,d.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-ink-faint`,children:M.project}),(0,d.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:A.data?.roles.map(e=>(0,d.jsxs)(`span`,{className:`rounded-full border border-line px-3 py-1 text-xs`,children:[e,e===`designer`&&M.mode===`verify`?n(` · 未启用`,` · not selected`):M.calls.some(t=>t.role===e&&t.live)?n(` · 运行中`,` · active`):``]},e))}),(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsx)(`button`,{className:I,disabled:w||P||[`completed`,`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status),onClick:()=>void B({action:`run`,allow_model:!0}),children:n(`开始模型辅助工程`,`Run with models`)}),(0,d.jsx)(`button`,{className:I,disabled:w||!N.length,onClick:()=>void B({action:`stop`}),children:n(`停止工作台请求`,`Stop workbench requests`)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,onClick:()=>void B({action:`recover`}),children:n(`结算已中断进程`,`Recover interrupted work`)})]}),M.feedback&&(0,d.jsx)(`p`,{className:`mt-4 whitespace-pre-wrap`,children:M.feedback}),[`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status)&&(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),B({action:`resume`,allow_model:!0,reason:b})},children:[(0,d.jsx)(`input`,{className:L,value:b,required:!0,placeholder:n(`说明诊断或恢复原因`,`Explain the diagnosis or recovery`),onChange:e=>x(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,children:n(`继续`,`Resume`)})]})]}),M.plan&&(0,d.jsxs)(`details`,{open:!0,className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`summary`,{className:`font-semibold`,children:n(`路线图与当前规格`,`Roadmap and current specification`)}),(0,d.jsx)(`ol`,{className:`my-3 list-inside list-decimal`,children:M.plan.roadmap.map((e,t)=>(0,d.jsx)(`li`,{children:e},t))}),(0,d.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm`,children:M.plan.spec}),M.plan.checks.map(e=>(0,d.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs`,children:[e.id,`: `,e.argv?.join(` `)??e.provider_stage]},e.id))]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:`Coordinator`}),(0,d.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:n(`对话不派工,工程运行时仍可询问进度。`,`Dialogue does not dispatch work and remains available during execution.`)}),M.messages.map((e,t)=>(0,d.jsxs)(`div`,{className:`my-4 space-y-2 whitespace-pre-wrap text-sm`,children:[(0,d.jsx)(`p`,{className:`font-semibold`,children:e.user}),(0,d.jsx)(`p`,{children:e.reply})]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:async e=>{e.preventDefault(),await B({action:`chat`,allow_model:!0,message:v})&&y(``)},children:[(0,d.jsx)(`textarea`,{className:L,rows:2,required:!0,value:v,"aria-label":n(`询问 Coordinator`,`Ask Coordinator`),onChange:e=>y(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||F,children:n(`发送`,`Send`)})]})]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`实际执行与审查记录`,`Execution and review records`)}),(0,d.jsx)(`p`,{className:`my-2 text-xs text-ink-faint`,children:n(`时长为调用/工具墙钟时间,包含等待,不等于模型推理利用率。`,`Durations are call/tool wall time, including waiting, not inference utilization.`)}),M.calls.map(e=>(0,d.jsxs)(`div`,{className:`border-t border-line py-3 text-sm`,children:[(0,d.jsxs)(`p`,{children:[e.role,` · `,e.operation,` · `,e.status,e.decision?` · ${n(`审查决定`,`review decision`)}: ${e.decision.status}`:``,e.duration_s===null?``:` · ${e.duration_s.toFixed(2)}s`]}),e.detail&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.detail}),e.decision?.reason&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.decision.reason}),(0,d.jsx)(`button`,{className:`mr-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/stdout.log`),children:`stdout`}),(0,d.jsx)(`button`,{className:`text-xs text-blue`,onClick:()=>void V(`${e.folder}/stderr.log`),children:`stderr`}),e.role!==`host`&&(0,d.jsx)(`button`,{className:`ml-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/response.json`),children:n(`角色回复`,`Role response`)})]},e.folder)),M.jobs.filter(e=>e.detail).map(e=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[e.id,` · `,e.action,` · `,e.status,`: `,e.detail,(0,d.jsx)(`br`,{}),(0,d.jsx)(`span`,{className:`font-mono text-xs`,children:e.log})]},e.id)),M.resumes.map((e,t)=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[n(`恢复原因`,`Resume reason`),`: `,e]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),V(E)},children:[(0,d.jsx)(`input`,{className:L,value:E,required:!0,onChange:e=>D(e.target.value),"aria-label":n(`查看源文件或证据`,`Inspect source or evidence`),placeholder:n(`工程内相对路径,例如 rtl/counter4.sv`,`Relative project path, e.g. rtl/counter4.sv`)}),(0,d.jsx)(`button`,{className:I,children:n(`查看文件`,`Read file`)})]})]})]}),O&&(0,d.jsxs)(`section`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`break-all font-mono text-sm`,children:O.path}),O.truncated&&(0,d.jsx)(`p`,{role:`status`,children:n(`仅显示前 128 KiB;完整文件保留在工程目录。`,`Showing the first 128 KiB; the full file remains in the project.`)}),(0,d.jsx)(`pre`,{className:`mt-3 max-h-[600px] overflow-auto whitespace-pre-wrap text-xs`,children:O.text})]})]})]})]})}export{f as default}; \ No newline at end of file diff --git a/frontend/web/dist/assets/WorkflowWorkbench-DfyLETfa.js b/frontend/web/dist/assets/WorkflowWorkbench-DfyLETfa.js new file mode 100644 index 000000000..61e89b4fc --- /dev/null +++ b/frontend/web/dist/assets/WorkflowWorkbench-DfyLETfa.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i}from"./query-CUzIxVzm.js";import{P as a,k as o}from"./index-DbdG0NfU.js";import{i as s}from"./format-DsyV_JEZ.js";import{r as c,t as l}from"./useWorkbenchTheme-CXN9ftdE.js";var u=e(t(),1),d=n();function f(){let{locale:e,setLocale:t}=o(),n=(t,n)=>e===`zh-CN`?t:n,{cycleTheme:f}=l(),p=i(),[m,h]=(0,u.useState)(new URLSearchParams(window.location.search).get(`project`)||``),[g,_]=(0,u.useState)({project:``,objective:``,domain:``,profile:``,mode:`design`,timeout_s:600,max_rounds:3}),[v,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(``),[O,k]=(0,u.useState)(null),A=r({queryKey:[`workflow-catalog`],queryFn:a.workflows.catalog}),j=r({queryKey:[`workflow`,m],queryFn:()=>a.workflows.snapshot(m),enabled:!!m,refetchInterval:2e3}),M=j.data,N=M?.jobs.filter(e=>[`starting`,`running`].includes(e.status))??[],P=N.some(e=>e.action!==`chat`)||!!M?.calls.some(e=>e.operation!==`chat`&&e.live),F=N.some(e=>e.action===`chat`),I=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40 hover:bg-panel`,L=`w-full rounded-lg border border-line bg-surface px-3 py-2 text-sm text-ink`;function R(e){h(e),k(null);let t=new URL(window.location.href);t.searchParams.set(`project`,e),window.history.replaceState(null,``,t)}async function z(e,t=!1){T(!0),C(``);try{let n=await e();return t&&R(n.id),await p.invalidateQueries({queryKey:[`workflow`,n.id]}),await p.invalidateQueries({queryKey:[`workflow-catalog`]}),!0}catch(e){return C(s(e)),!1}finally{T(!1)}}let B=e=>z(()=>a.workflows.action(m,e)),V=async e=>{C(``);try{k(await a.workflows.document(m,e))}catch(e){C(s(e))}};return(0,d.jsxs)(`main`,{className:`min-h-screen bg-surface text-ink`,children:[(0,d.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-line px-6 py-4`,children:[(0,d.jsx)(c,{size:36,tag:n(`工程工作台`,`Engineering workbench`)}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsx)(`button`,{className:I,onClick:()=>t(e===`zh-CN`?`en`:`zh-CN`),children:`EN / 中文`}),(0,d.jsx)(`button`,{className:I,onClick:f,children:n(`切换主题`,`Theme`)}),(0,d.jsx)(`button`,{className:I,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`legacy`,`1`),e.searchParams.delete(`project`),window.location.assign(e)},children:n(`Argus 兼容会话`,`Legacy Argus sessions`)})]})]}),(0,d.jsxs)(`div`,{className:`mx-auto grid max-w-[1600px] gap-6 p-6 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,d.jsxs)(`aside`,{className:`space-y-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`工程工单`,`Work orders`)}),A.data?.projects.map(e=>(0,d.jsxs)(`button`,{className:`${I} w-full text-left ${m===e.id?`text-blue`:``}`,onClick:()=>R(e.id),children:[(0,d.jsx)(`span`,{className:`block font-mono`,children:e.id}),(0,d.jsx)(`span`,{className:`block truncate text-xs text-ink-faint`,children:e.project})]},e.id)),(0,d.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),z(()=>a.workflows.create(g),!0)},children:[(0,d.jsx)(`h3`,{className:`font-medium`,children:n(`新建或打开`,`Create or open`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`后端主机上的绝对目录`,`Absolute directory on the backend host`),(0,d.jsx)(`input`,{className:L,value:g.project,required:!0,placeholder:`/path/to/design`,onChange:e=>_({...g,project:e.target.value})})]}),(0,d.jsx)(`button`,{type:`button`,className:I,disabled:w||!g.project.trim(),onClick:()=>void z(()=>a.workflows.open(g.project),!0),children:n(`打开已有 Vulcan 工单`,`Open existing Vulcan work order`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`原始工程目标`,`Original objective`),(0,d.jsx)(`textarea`,{className:L,rows:4,required:!0,value:g.objective,onChange:e=>_({...g,objective:e.target.value})})]}),(0,d.jsxs)(`select`,{"aria-label":n(`领域`,`Domain`),className:L,required:!0,value:g.domain,onChange:e=>_({...g,domain:e.target.value,profile:``}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择硬件领域`,`Choose hardware domain`)}),Object.keys(A.data?.domains??{}).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`配置`,`Profile`),className:L,required:!0,value:g.profile,onChange:e=>_({...g,profile:e.target.value}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择配置`,`Choose profile`)}),(A.data?.domains[g.domain]??[]).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`模式`,`Mode`),className:L,value:g.mode,onChange:e=>_({...g,mode:e.target.value===`verify`?`verify`:`design`}),children:[(0,d.jsx)(`option`,{value:`design`,children:n(`设计与验证`,`Design and verification`)}),(0,d.jsx)(`option`,{value:`verify`,children:n(`仅验证已有设计`,`Verify existing design`)})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`每次角色调用上限(秒)`,`Per-role time limit (seconds)`),(0,d.jsx)(`input`,{type:`number`,min:1,className:L,required:!0,value:g.timeout_s,onChange:e=>_({...g,timeout_s:e.target.valueAsNumber})})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`最大修复轮数`,`Maximum repair rounds`),(0,d.jsx)(`input`,{type:`number`,min:1,max:32,className:L,required:!0,value:g.max_rounds,onChange:e=>_({...g,max_rounds:e.target.valueAsNumber})})]}),(0,d.jsx)(`button`,{className:I,disabled:w,children:n(`创建工单`,`Create work order`)})]})]}),(0,d.jsxs)(`section`,{className:`min-w-0 space-y-5`,children:[(S||A.error||j.error)&&(0,d.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-line p-4 text-err`,children:S||s(A.error||j.error)}),!M&&(0,d.jsx)(`p`,{className:`text-ink-faint`,children:n(`打开工单后查看规格、角色状态、实验和独立审查。创建本身不会调用模型。`,`Open a work order to inspect its specification, roles, experiments and independent reviews. Creation does not call a model.`)}),M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,d.jsx)(`h1`,{className:`text-xl font-semibold`,children:M.objective}),(0,d.jsx)(`span`,{className:`font-mono text-sm`,children:M.independently_accepted?n(`独立审查已接受`,`Independently accepted`):M.status})]}),(0,d.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-ink-faint`,children:M.project}),(0,d.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:A.data?.roles.map(e=>(0,d.jsxs)(`span`,{className:`rounded-full border border-line px-3 py-1 text-xs`,children:[e,e===`designer`&&M.mode===`verify`?n(` · 未启用`,` · not selected`):M.calls.some(t=>t.role===e&&t.live)?n(` · 运行中`,` · active`):``]},e))}),(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsx)(`button`,{className:I,disabled:w||P||[`completed`,`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status),onClick:()=>void B({action:`run`,allow_model:!0}),children:n(`开始模型辅助工程`,`Run with models`)}),(0,d.jsx)(`button`,{className:I,disabled:w||!N.length,onClick:()=>void B({action:`stop`}),children:n(`停止工作台请求`,`Stop workbench requests`)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,onClick:()=>void B({action:`recover`}),children:n(`结算已中断进程`,`Recover interrupted work`)})]}),M.feedback&&(0,d.jsx)(`p`,{className:`mt-4 whitespace-pre-wrap`,children:M.feedback}),[`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status)&&(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),B({action:`resume`,allow_model:!0,reason:b})},children:[(0,d.jsx)(`input`,{className:L,value:b,required:!0,placeholder:n(`说明诊断或恢复原因`,`Explain the diagnosis or recovery`),onChange:e=>x(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,children:n(`继续`,`Resume`)})]})]}),M.plan&&(0,d.jsxs)(`details`,{open:!0,className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`summary`,{className:`font-semibold`,children:n(`路线图与当前规格`,`Roadmap and current specification`)}),(0,d.jsx)(`ol`,{className:`my-3 list-inside list-decimal`,children:M.plan.roadmap.map((e,t)=>(0,d.jsx)(`li`,{children:e},t))}),(0,d.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm`,children:M.plan.spec}),M.plan.checks.map(e=>(0,d.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs`,children:[e.id,`: `,e.argv?.join(` `)??e.provider_stage]},e.id))]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:`Coordinator`}),(0,d.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:n(`对话不派工,工程运行时仍可询问进度。`,`Dialogue does not dispatch work and remains available during execution.`)}),M.messages.map((e,t)=>(0,d.jsxs)(`div`,{className:`my-4 space-y-2 whitespace-pre-wrap text-sm`,children:[(0,d.jsx)(`p`,{className:`font-semibold`,children:e.user}),(0,d.jsx)(`p`,{children:e.reply})]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:async e=>{e.preventDefault(),await B({action:`chat`,allow_model:!0,message:v})&&y(``)},children:[(0,d.jsx)(`textarea`,{className:L,rows:2,required:!0,value:v,"aria-label":n(`询问 Coordinator`,`Ask Coordinator`),onChange:e=>y(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||F,children:n(`发送`,`Send`)})]})]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`实际执行与审查记录`,`Execution and review records`)}),(0,d.jsx)(`p`,{className:`my-2 text-xs text-ink-faint`,children:n(`时长为调用/工具墙钟时间,包含等待,不等于模型推理利用率。`,`Durations are call/tool wall time, including waiting, not inference utilization.`)}),M.calls.map(e=>(0,d.jsxs)(`div`,{className:`border-t border-line py-3 text-sm`,children:[(0,d.jsxs)(`p`,{children:[e.role,` · `,e.operation,` · `,e.status,e.decision?` · ${n(`审查决定`,`review decision`)}: ${e.decision.status}`:``,e.duration_s===null?``:` · ${e.duration_s.toFixed(2)}s`]}),e.detail&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.detail}),e.decision?.reason&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.decision.reason}),(0,d.jsx)(`button`,{className:`mr-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/stdout.log`),children:`stdout`}),(0,d.jsx)(`button`,{className:`text-xs text-blue`,onClick:()=>void V(`${e.folder}/stderr.log`),children:`stderr`}),e.role!==`host`&&(0,d.jsx)(`button`,{className:`ml-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/response.json`),children:n(`角色回复`,`Role response`)})]},e.folder)),M.jobs.filter(e=>e.detail).map(e=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[e.id,` · `,e.action,` · `,e.status,`: `,e.detail,(0,d.jsx)(`br`,{}),(0,d.jsx)(`span`,{className:`font-mono text-xs`,children:e.log})]},e.id)),M.resumes.map((e,t)=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[n(`恢复原因`,`Resume reason`),`: `,e]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),V(E)},children:[(0,d.jsx)(`input`,{className:L,value:E,required:!0,onChange:e=>D(e.target.value),"aria-label":n(`查看源文件或证据`,`Inspect source or evidence`),placeholder:n(`工程内相对路径,例如 rtl/counter4.sv`,`Relative project path, e.g. rtl/counter4.sv`)}),(0,d.jsx)(`button`,{className:I,children:n(`查看文件`,`Read file`)})]})]})]}),O&&(0,d.jsxs)(`section`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`break-all font-mono text-sm`,children:O.path}),O.truncated&&(0,d.jsx)(`p`,{role:`status`,children:n(`仅显示前 128 KiB;完整文件保留在工程目录。`,`Showing the first 128 KiB; the full file remains in the project.`)}),(0,d.jsx)(`pre`,{className:`mt-3 max-h-[600px] overflow-auto whitespace-pre-wrap text-xs`,children:O.text})]})]})]})]})}export{f as default}; \ No newline at end of file diff --git a/frontend/web/dist/assets/WorkflowWorkbench-LjcBb5YN.js b/frontend/web/dist/assets/WorkflowWorkbench-LjcBb5YN.js new file mode 100644 index 000000000..311071f13 --- /dev/null +++ b/frontend/web/dist/assets/WorkflowWorkbench-LjcBb5YN.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{a as r,c as i}from"./query-dCPZk0Xc.js";import{N as a,O as o}from"./index-Dkv2HM-n.js";import{i as s}from"./format-CB65te2P.js";import{r as c,t as l}from"./useWorkbenchTheme-DMn1yhZa.js";var u=e(n(),1),d=t();function f(){let{locale:e,setLocale:t}=o(),n=(t,n)=>e===`zh-CN`?t:n,{cycleTheme:f}=l(),p=i(),[m,h]=(0,u.useState)(new URLSearchParams(window.location.search).get(`project`)||``),[g,_]=(0,u.useState)({project:``,objective:``,domain:``,profile:``,mode:`design`,timeout_s:600,max_rounds:3}),[v,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(``),[O,k]=(0,u.useState)(null),A=r({queryKey:[`workflow-catalog`],queryFn:a.workflows.catalog}),j=r({queryKey:[`workflow`,m],queryFn:()=>a.workflows.snapshot(m),enabled:!!m,refetchInterval:2e3}),M=j.data,N=M?.jobs.filter(e=>[`starting`,`running`].includes(e.status))??[],P=N.some(e=>e.action!==`chat`)||!!M?.calls.some(e=>e.operation!==`chat`&&e.live),F=N.some(e=>e.action===`chat`),I=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40 hover:bg-panel`,L=`w-full rounded-lg border border-line bg-surface px-3 py-2 text-sm text-ink`;function R(e){h(e),k(null);let t=new URL(window.location.href);t.searchParams.set(`project`,e),window.history.replaceState(null,``,t)}async function z(e,t=!1){T(!0),C(``);try{let n=await e();return t&&R(n.id),await p.invalidateQueries({queryKey:[`workflow`,n.id]}),await p.invalidateQueries({queryKey:[`workflow-catalog`]}),!0}catch(e){return C(s(e)),!1}finally{T(!1)}}let B=e=>z(()=>a.workflows.action(m,e)),V=async e=>{C(``);try{k(await a.workflows.document(m,e))}catch(e){C(s(e))}};return(0,d.jsxs)(`main`,{className:`min-h-screen bg-surface text-ink`,children:[(0,d.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-line px-6 py-4`,children:[(0,d.jsx)(c,{size:36,tag:n(`工程工作台`,`Engineering workbench`)}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsx)(`button`,{className:I,onClick:()=>t(e===`zh-CN`?`en`:`zh-CN`),children:`EN / 中文`}),(0,d.jsx)(`button`,{className:I,onClick:f,children:n(`切换主题`,`Theme`)}),(0,d.jsx)(`button`,{className:I,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`legacy`,`1`),e.searchParams.delete(`project`),window.location.assign(e)},children:n(`Argus 兼容会话`,`Legacy Argus sessions`)})]})]}),(0,d.jsxs)(`div`,{className:`mx-auto grid max-w-[1600px] gap-6 p-6 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,d.jsxs)(`aside`,{className:`space-y-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`工程工单`,`Work orders`)}),A.data?.projects.map(e=>(0,d.jsxs)(`button`,{className:`${I} w-full text-left ${m===e.id?`text-blue`:``}`,onClick:()=>R(e.id),children:[(0,d.jsx)(`span`,{className:`block font-mono`,children:e.id}),(0,d.jsx)(`span`,{className:`block truncate text-xs text-ink-faint`,children:e.project})]},e.id)),(0,d.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),z(()=>a.workflows.create(g),!0)},children:[(0,d.jsx)(`h3`,{className:`font-medium`,children:n(`新建或打开`,`Create or open`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`后端主机上的绝对目录`,`Absolute directory on the backend host`),(0,d.jsx)(`input`,{className:L,value:g.project,required:!0,placeholder:`/path/to/design`,onChange:e=>_({...g,project:e.target.value})})]}),(0,d.jsx)(`button`,{type:`button`,className:I,disabled:w||!g.project.trim(),onClick:()=>void z(()=>a.workflows.open(g.project),!0),children:n(`打开已有 Vulcan 工单`,`Open existing Vulcan work order`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`原始工程目标`,`Original objective`),(0,d.jsx)(`textarea`,{className:L,rows:4,required:!0,value:g.objective,onChange:e=>_({...g,objective:e.target.value})})]}),(0,d.jsxs)(`select`,{"aria-label":n(`领域`,`Domain`),className:L,required:!0,value:g.domain,onChange:e=>_({...g,domain:e.target.value,profile:``}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择硬件领域`,`Choose hardware domain`)}),Object.keys(A.data?.domains??{}).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`配置`,`Profile`),className:L,required:!0,value:g.profile,onChange:e=>_({...g,profile:e.target.value}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择配置`,`Choose profile`)}),(A.data?.domains[g.domain]??[]).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`模式`,`Mode`),className:L,value:g.mode,onChange:e=>_({...g,mode:e.target.value===`verify`?`verify`:`design`}),children:[(0,d.jsx)(`option`,{value:`design`,children:n(`设计与验证`,`Design and verification`)}),(0,d.jsx)(`option`,{value:`verify`,children:n(`仅验证已有设计`,`Verify existing design`)})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`每次角色调用上限(秒)`,`Per-role time limit (seconds)`),(0,d.jsx)(`input`,{type:`number`,min:1,className:L,required:!0,value:g.timeout_s,onChange:e=>_({...g,timeout_s:e.target.valueAsNumber})})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`最大修复轮数`,`Maximum repair rounds`),(0,d.jsx)(`input`,{type:`number`,min:1,max:32,className:L,required:!0,value:g.max_rounds,onChange:e=>_({...g,max_rounds:e.target.valueAsNumber})})]}),(0,d.jsx)(`button`,{className:I,disabled:w,children:n(`创建工单`,`Create work order`)})]})]}),(0,d.jsxs)(`section`,{className:`min-w-0 space-y-5`,children:[(S||A.error||j.error)&&(0,d.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-line p-4 text-err`,children:S||s(A.error||j.error)}),!M&&(0,d.jsx)(`p`,{className:`text-ink-faint`,children:n(`打开工单后查看规格、角色状态、实验和独立审查。创建本身不会调用模型。`,`Open a work order to inspect its specification, roles, experiments and independent reviews. Creation does not call a model.`)}),M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,d.jsx)(`h1`,{className:`text-xl font-semibold`,children:M.objective}),(0,d.jsx)(`span`,{className:`font-mono text-sm`,children:M.independently_accepted?n(`独立审查已接受`,`Independently accepted`):M.status})]}),(0,d.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-ink-faint`,children:M.project}),(0,d.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:A.data?.roles.map(e=>(0,d.jsxs)(`span`,{className:`rounded-full border border-line px-3 py-1 text-xs`,children:[e,e===`designer`&&M.mode===`verify`?n(` · 未启用`,` · not selected`):M.calls.some(t=>t.role===e&&t.live)?n(` · 运行中`,` · active`):``]},e))}),(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsx)(`button`,{className:I,disabled:w||P||[`completed`,`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status),onClick:()=>void B({action:`run`,allow_model:!0}),children:n(`开始模型辅助工程`,`Run with models`)}),(0,d.jsx)(`button`,{className:I,disabled:w||!N.length,onClick:()=>void B({action:`stop`}),children:n(`停止工作台请求`,`Stop workbench requests`)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,onClick:()=>void B({action:`recover`}),children:n(`结算已中断进程`,`Recover interrupted work`)})]}),M.feedback&&(0,d.jsx)(`p`,{className:`mt-4 whitespace-pre-wrap`,children:M.feedback}),[`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status)&&(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),B({action:`resume`,allow_model:!0,reason:b})},children:[(0,d.jsx)(`input`,{className:L,value:b,required:!0,placeholder:n(`说明诊断或恢复原因`,`Explain the diagnosis or recovery`),onChange:e=>x(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,children:n(`继续`,`Resume`)})]})]}),M.plan&&(0,d.jsxs)(`details`,{open:!0,className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`summary`,{className:`font-semibold`,children:n(`路线图与当前规格`,`Roadmap and current specification`)}),(0,d.jsx)(`ol`,{className:`my-3 list-inside list-decimal`,children:M.plan.roadmap.map((e,t)=>(0,d.jsx)(`li`,{children:e},t))}),(0,d.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm`,children:M.plan.spec}),M.plan.checks.map(e=>(0,d.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs`,children:[e.id,`: `,e.argv?.join(` `)??e.provider_stage]},e.id))]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:`Coordinator`}),(0,d.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:n(`对话不派工,工程运行时仍可询问进度。`,`Dialogue does not dispatch work and remains available during execution.`)}),M.messages.map((e,t)=>(0,d.jsxs)(`div`,{className:`my-4 space-y-2 whitespace-pre-wrap text-sm`,children:[(0,d.jsx)(`p`,{className:`font-semibold`,children:e.user}),(0,d.jsx)(`p`,{children:e.reply})]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:async e=>{e.preventDefault(),await B({action:`chat`,allow_model:!0,message:v})&&y(``)},children:[(0,d.jsx)(`textarea`,{className:L,rows:2,required:!0,value:v,"aria-label":n(`询问 Coordinator`,`Ask Coordinator`),onChange:e=>y(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||F,children:n(`发送`,`Send`)})]})]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`实际执行与审查记录`,`Execution and review records`)}),(0,d.jsx)(`p`,{className:`my-2 text-xs text-ink-faint`,children:n(`时长为调用/工具墙钟时间,包含等待,不等于模型推理利用率。`,`Durations are call/tool wall time, including waiting, not inference utilization.`)}),M.calls.map(e=>(0,d.jsxs)(`div`,{className:`border-t border-line py-3 text-sm`,children:[(0,d.jsxs)(`p`,{children:[e.role,` · `,e.operation,` · `,e.status,e.decision?` · ${n(`审查决定`,`review decision`)}: ${e.decision.status}`:``,e.duration_s===null?``:` · ${e.duration_s.toFixed(2)}s`]}),e.detail&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.detail}),e.decision?.reason&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.decision.reason}),(0,d.jsx)(`button`,{className:`mr-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/stdout.log`),children:`stdout`}),(0,d.jsx)(`button`,{className:`text-xs text-blue`,onClick:()=>void V(`${e.folder}/stderr.log`),children:`stderr`}),e.role!==`host`&&(0,d.jsx)(`button`,{className:`ml-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/response.json`),children:n(`角色回复`,`Role response`)})]},e.folder)),M.jobs.filter(e=>e.detail).map(e=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[e.id,` · `,e.action,` · `,e.status,`: `,e.detail,(0,d.jsx)(`br`,{}),(0,d.jsx)(`span`,{className:`font-mono text-xs`,children:e.log})]},e.id)),M.resumes.map((e,t)=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[n(`恢复原因`,`Resume reason`),`: `,e]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),V(E)},children:[(0,d.jsx)(`input`,{className:L,value:E,required:!0,onChange:e=>D(e.target.value),"aria-label":n(`查看源文件或证据`,`Inspect source or evidence`),placeholder:n(`工程内相对路径,例如 rtl/counter4.sv`,`Relative project path, e.g. rtl/counter4.sv`)}),(0,d.jsx)(`button`,{className:I,children:n(`查看文件`,`Read file`)})]})]})]}),O&&(0,d.jsxs)(`section`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`break-all font-mono text-sm`,children:O.path}),O.truncated&&(0,d.jsx)(`p`,{role:`status`,children:n(`仅显示前 128 KiB;完整文件保留在工程目录。`,`Showing the first 128 KiB; the full file remains in the project.`)}),(0,d.jsx)(`pre`,{className:`mt-3 max-h-[600px] overflow-auto whitespace-pre-wrap text-xs`,children:O.text})]})]})]})]})}export{f as default}; \ No newline at end of file diff --git a/frontend/web/dist/assets/WorkflowWorkbench-vw9-WFp2.js b/frontend/web/dist/assets/WorkflowWorkbench-vw9-WFp2.js new file mode 100644 index 000000000..401f118e3 --- /dev/null +++ b/frontend/web/dist/assets/WorkflowWorkbench-vw9-WFp2.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{a as r,c as i}from"./query-CUzIxVzm.js";import{P as a,k as o}from"./index-DbVni4qR.js";import{i as s}from"./format-8giTdXya.js";import{r as c,t as l}from"./useWorkbenchTheme-CV-C3OBr.js";var u=e(t(),1),d=n();function f(){let{locale:e,setLocale:t}=o(),n=(t,n)=>e===`zh-CN`?t:n,{cycleTheme:f}=l(),p=i(),[m,h]=(0,u.useState)(new URLSearchParams(window.location.search).get(`project`)||``),[g,_]=(0,u.useState)({project:``,objective:``,domain:``,profile:``,mode:`design`,timeout_s:600,max_rounds:3}),[v,y]=(0,u.useState)(``),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(``),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(``),[O,k]=(0,u.useState)(null),A=r({queryKey:[`workflow-catalog`],queryFn:a.workflows.catalog}),j=r({queryKey:[`workflow`,m],queryFn:()=>a.workflows.snapshot(m),enabled:!!m,refetchInterval:2e3}),M=j.data,N=M?.jobs.filter(e=>[`starting`,`running`].includes(e.status))??[],P=N.some(e=>e.action!==`chat`)||!!M?.calls.some(e=>e.operation!==`chat`&&e.live),F=N.some(e=>e.action===`chat`),I=`rounded-lg border border-line px-3 py-2 text-sm disabled:opacity-40 hover:bg-panel`,L=`w-full rounded-lg border border-line bg-surface px-3 py-2 text-sm text-ink`;function R(e){h(e),k(null);let t=new URL(window.location.href);t.searchParams.set(`project`,e),window.history.replaceState(null,``,t)}async function z(e,t=!1){T(!0),C(``);try{let n=await e();return t&&R(n.id),await p.invalidateQueries({queryKey:[`workflow`,n.id]}),await p.invalidateQueries({queryKey:[`workflow-catalog`]}),!0}catch(e){return C(s(e)),!1}finally{T(!1)}}let B=e=>z(()=>a.workflows.action(m,e)),V=async e=>{C(``);try{k(await a.workflows.document(m,e))}catch(e){C(s(e))}};return(0,d.jsxs)(`main`,{className:`min-h-screen bg-surface text-ink`,children:[(0,d.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-line px-6 py-4`,children:[(0,d.jsx)(c,{size:36,tag:n(`工程工作台`,`Engineering workbench`)}),(0,d.jsxs)(`div`,{className:`flex gap-2`,children:[(0,d.jsx)(`button`,{className:I,onClick:()=>t(e===`zh-CN`?`en`:`zh-CN`),children:`EN / 中文`}),(0,d.jsx)(`button`,{className:I,onClick:f,children:n(`切换主题`,`Theme`)}),(0,d.jsx)(`button`,{className:I,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`legacy`,`1`),e.searchParams.delete(`project`),window.location.assign(e)},children:n(`Argus 兼容会话`,`Legacy Argus sessions`)})]})]}),(0,d.jsxs)(`div`,{className:`mx-auto grid max-w-[1600px] gap-6 p-6 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,d.jsxs)(`aside`,{className:`space-y-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`工程工单`,`Work orders`)}),A.data?.projects.map(e=>(0,d.jsxs)(`button`,{className:`${I} w-full text-left ${m===e.id?`text-blue`:``}`,onClick:()=>R(e.id),children:[(0,d.jsx)(`span`,{className:`block font-mono`,children:e.id}),(0,d.jsx)(`span`,{className:`block truncate text-xs text-ink-faint`,children:e.project})]},e.id)),(0,d.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),z(()=>a.workflows.create(g),!0)},children:[(0,d.jsx)(`h3`,{className:`font-medium`,children:n(`新建或打开`,`Create or open`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`后端主机上的绝对目录`,`Absolute directory on the backend host`),(0,d.jsx)(`input`,{className:L,value:g.project,required:!0,placeholder:`/path/to/design`,onChange:e=>_({...g,project:e.target.value})})]}),(0,d.jsx)(`button`,{type:`button`,className:I,disabled:w||!g.project.trim(),onClick:()=>void z(()=>a.workflows.open(g.project),!0),children:n(`打开已有 Vulcan 工单`,`Open existing Vulcan work order`)}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`原始工程目标`,`Original objective`),(0,d.jsx)(`textarea`,{className:L,rows:4,required:!0,value:g.objective,onChange:e=>_({...g,objective:e.target.value})})]}),(0,d.jsxs)(`select`,{"aria-label":n(`领域`,`Domain`),className:L,required:!0,value:g.domain,onChange:e=>_({...g,domain:e.target.value,profile:``}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择硬件领域`,`Choose hardware domain`)}),Object.keys(A.data?.domains??{}).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`配置`,`Profile`),className:L,required:!0,value:g.profile,onChange:e=>_({...g,profile:e.target.value}),children:[(0,d.jsx)(`option`,{value:``,children:n(`选择配置`,`Choose profile`)}),(A.data?.domains[g.domain]??[]).map(e=>(0,d.jsx)(`option`,{children:e},e))]}),(0,d.jsxs)(`select`,{"aria-label":n(`模式`,`Mode`),className:L,value:g.mode,onChange:e=>_({...g,mode:e.target.value===`verify`?`verify`:`design`}),children:[(0,d.jsx)(`option`,{value:`design`,children:n(`设计与验证`,`Design and verification`)}),(0,d.jsx)(`option`,{value:`verify`,children:n(`仅验证已有设计`,`Verify existing design`)})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`每次角色调用上限(秒)`,`Per-role time limit (seconds)`),(0,d.jsx)(`input`,{type:`number`,min:1,className:L,required:!0,value:g.timeout_s,onChange:e=>_({...g,timeout_s:e.target.valueAsNumber})})]}),(0,d.jsxs)(`label`,{className:`block text-xs`,children:[n(`最大修复轮数`,`Maximum repair rounds`),(0,d.jsx)(`input`,{type:`number`,min:1,max:32,className:L,required:!0,value:g.max_rounds,onChange:e=>_({...g,max_rounds:e.target.valueAsNumber})})]}),(0,d.jsx)(`button`,{className:I,disabled:w,children:n(`创建工单`,`Create work order`)})]})]}),(0,d.jsxs)(`section`,{className:`min-w-0 space-y-5`,children:[(S||A.error||j.error)&&(0,d.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-line p-4 text-err`,children:S||s(A.error||j.error)}),!M&&(0,d.jsx)(`p`,{className:`text-ink-faint`,children:n(`打开工单后查看规格、角色状态、实验和独立审查。创建本身不会调用模型。`,`Open a work order to inspect its specification, roles, experiments and independent reviews. Creation does not call a model.`)}),M&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,d.jsx)(`h1`,{className:`text-xl font-semibold`,children:M.objective}),(0,d.jsx)(`span`,{className:`font-mono text-sm`,children:M.independently_accepted?n(`独立审查已接受`,`Independently accepted`):M.status})]}),(0,d.jsx)(`p`,{className:`mt-2 break-all font-mono text-xs text-ink-faint`,children:M.project}),(0,d.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:A.data?.roles.map(e=>(0,d.jsxs)(`span`,{className:`rounded-full border border-line px-3 py-1 text-xs`,children:[e,e===`designer`&&M.mode===`verify`?n(` · 未启用`,` · not selected`):M.calls.some(t=>t.role===e&&t.live)?n(` · 运行中`,` · active`):``]},e))}),(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsx)(`button`,{className:I,disabled:w||P||[`completed`,`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status),onClick:()=>void B({action:`run`,allow_model:!0}),children:n(`开始模型辅助工程`,`Run with models`)}),(0,d.jsx)(`button`,{className:I,disabled:w||!N.length,onClick:()=>void B({action:`stop`}),children:n(`停止工作台请求`,`Stop workbench requests`)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,onClick:()=>void B({action:`recover`}),children:n(`结算已中断进程`,`Recover interrupted work`)})]}),M.feedback&&(0,d.jsx)(`p`,{className:`mt-4 whitespace-pre-wrap`,children:M.feedback}),[`blocked`,`no_progress`,`interrupted`,`stale`].includes(M.status)&&(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),B({action:`resume`,allow_model:!0,reason:b})},children:[(0,d.jsx)(`input`,{className:L,value:b,required:!0,placeholder:n(`说明诊断或恢复原因`,`Explain the diagnosis or recovery`),onChange:e=>x(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||P,children:n(`继续`,`Resume`)})]})]}),M.plan&&(0,d.jsxs)(`details`,{open:!0,className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`summary`,{className:`font-semibold`,children:n(`路线图与当前规格`,`Roadmap and current specification`)}),(0,d.jsx)(`ol`,{className:`my-3 list-inside list-decimal`,children:M.plan.roadmap.map((e,t)=>(0,d.jsx)(`li`,{children:e},t))}),(0,d.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm`,children:M.plan.spec}),M.plan.checks.map(e=>(0,d.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs`,children:[e.id,`: `,e.argv?.join(` `)??e.provider_stage]},e.id))]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:`Coordinator`}),(0,d.jsx)(`p`,{className:`mt-1 text-xs text-ink-faint`,children:n(`对话不派工,工程运行时仍可询问进度。`,`Dialogue does not dispatch work and remains available during execution.`)}),M.messages.map((e,t)=>(0,d.jsxs)(`div`,{className:`my-4 space-y-2 whitespace-pre-wrap text-sm`,children:[(0,d.jsx)(`p`,{className:`font-semibold`,children:e.user}),(0,d.jsx)(`p`,{children:e.reply})]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:async e=>{e.preventDefault(),await B({action:`chat`,allow_model:!0,message:v})&&y(``)},children:[(0,d.jsx)(`textarea`,{className:L,rows:2,required:!0,value:v,"aria-label":n(`询问 Coordinator`,`Ask Coordinator`),onChange:e=>y(e.target.value)}),(0,d.jsx)(`button`,{className:I,disabled:w||F,children:n(`发送`,`Send`)})]})]}),(0,d.jsxs)(`div`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`font-semibold`,children:n(`实际执行与审查记录`,`Execution and review records`)}),(0,d.jsx)(`p`,{className:`my-2 text-xs text-ink-faint`,children:n(`时长为调用/工具墙钟时间,包含等待,不等于模型推理利用率。`,`Durations are call/tool wall time, including waiting, not inference utilization.`)}),M.calls.map(e=>(0,d.jsxs)(`div`,{className:`border-t border-line py-3 text-sm`,children:[(0,d.jsxs)(`p`,{children:[e.role,` · `,e.operation,` · `,e.status,e.decision?` · ${n(`审查决定`,`review decision`)}: ${e.decision.status}`:``,e.duration_s===null?``:` · ${e.duration_s.toFixed(2)}s`]}),e.detail&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.detail}),e.decision?.reason&&(0,d.jsx)(`p`,{className:`my-1 whitespace-pre-wrap`,children:e.decision.reason}),(0,d.jsx)(`button`,{className:`mr-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/stdout.log`),children:`stdout`}),(0,d.jsx)(`button`,{className:`text-xs text-blue`,onClick:()=>void V(`${e.folder}/stderr.log`),children:`stderr`}),e.role!==`host`&&(0,d.jsx)(`button`,{className:`ml-3 text-xs text-blue`,onClick:()=>void V(`${e.folder}/response.json`),children:n(`角色回复`,`Role response`)})]},e.folder)),M.jobs.filter(e=>e.detail).map(e=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[e.id,` · `,e.action,` · `,e.status,`: `,e.detail,(0,d.jsx)(`br`,{}),(0,d.jsx)(`span`,{className:`font-mono text-xs`,children:e.log})]},e.id)),M.resumes.map((e,t)=>(0,d.jsxs)(`p`,{className:`my-2 text-sm`,children:[n(`恢复原因`,`Resume reason`),`: `,e]},t)),(0,d.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:e=>{e.preventDefault(),V(E)},children:[(0,d.jsx)(`input`,{className:L,value:E,required:!0,onChange:e=>D(e.target.value),"aria-label":n(`查看源文件或证据`,`Inspect source or evidence`),placeholder:n(`工程内相对路径,例如 rtl/counter4.sv`,`Relative project path, e.g. rtl/counter4.sv`)}),(0,d.jsx)(`button`,{className:I,children:n(`查看文件`,`Read file`)})]})]})]}),O&&(0,d.jsxs)(`section`,{className:`rounded-xl border border-line p-5`,children:[(0,d.jsx)(`h2`,{className:`break-all font-mono text-sm`,children:O.path}),O.truncated&&(0,d.jsx)(`p`,{role:`status`,children:n(`仅显示前 128 KiB;完整文件保留在工程目录。`,`Showing the first 128 KiB; the full file remains in the project.`)}),(0,d.jsx)(`pre`,{className:`mt-3 max-h-[600px] overflow-auto whitespace-pre-wrap text-xs`,children:O.text})]})]})]})]})}export{f as default}; \ No newline at end of file diff --git a/frontend/web/dist/assets/activity-BEiyr9-4.js b/frontend/web/dist/assets/activity-BEiyr9-4.js new file mode 100644 index 000000000..e62fb49d0 --- /dev/null +++ b/frontend/web/dist/assets/activity-BEiyr9-4.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-Bc1ibrT3.js";var t=e(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]);export{t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/activity-BmXzrCrJ.js b/frontend/web/dist/assets/activity-BmXzrCrJ.js new file mode 100644 index 000000000..052222d2e --- /dev/null +++ b/frontend/web/dist/assets/activity-BmXzrCrJ.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-DpaE5wy6.js";var t=e(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]);export{t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/activity-DRTghqfr.js b/frontend/web/dist/assets/activity-DRTghqfr.js new file mode 100644 index 000000000..1f93327f9 --- /dev/null +++ b/frontend/web/dist/assets/activity-DRTghqfr.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-BIflq6l1.js";var t=e(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]);export{t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/code-xml-C6UZnqwl.js b/frontend/web/dist/assets/code-xml-C6UZnqwl.js new file mode 100644 index 000000000..eadef4656 --- /dev/null +++ b/frontend/web/dist/assets/code-xml-C6UZnqwl.js @@ -0,0 +1 @@ +import{R as e}from"./AppearanceControls-BNJdEiGG.js";var t=e(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),n=e(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/code-xml-CTbPls4H.js b/frontend/web/dist/assets/code-xml-CTbPls4H.js new file mode 100644 index 000000000..af0e3e018 --- /dev/null +++ b/frontend/web/dist/assets/code-xml-CTbPls4H.js @@ -0,0 +1 @@ +import{R as e}from"./AppearanceControls-C_eUyO2x.js";var t=e(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),n=e(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/code-xml-Cgb6b1v3.js b/frontend/web/dist/assets/code-xml-Cgb6b1v3.js new file mode 100644 index 000000000..9c1745849 --- /dev/null +++ b/frontend/web/dist/assets/code-xml-Cgb6b1v3.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-BIflq6l1.js";var t=e(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]);export{t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/code-xml-DMjjpBic.js b/frontend/web/dist/assets/code-xml-DMjjpBic.js new file mode 100644 index 000000000..724bace06 --- /dev/null +++ b/frontend/web/dist/assets/code-xml-DMjjpBic.js @@ -0,0 +1 @@ +import{R as e}from"./AppearanceControls-vjVM_spw.js";var t=e(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),n=e(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/code-xml-DnBfjec4.js b/frontend/web/dist/assets/code-xml-DnBfjec4.js new file mode 100644 index 000000000..d2c9bc4ac --- /dev/null +++ b/frontend/web/dist/assets/code-xml-DnBfjec4.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-Bc1ibrT3.js";var t=e(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]);export{t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/code-xml-DwzUAooI.js b/frontend/web/dist/assets/code-xml-DwzUAooI.js new file mode 100644 index 000000000..c63a81318 --- /dev/null +++ b/frontend/web/dist/assets/code-xml-DwzUAooI.js @@ -0,0 +1 @@ +import{R as e}from"./AppearanceControls-BFWF0z-J.js";var t=e(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),n=e(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/code-xml-xZvprTy7.js b/frontend/web/dist/assets/code-xml-xZvprTy7.js new file mode 100644 index 000000000..7810bc663 --- /dev/null +++ b/frontend/web/dist/assets/code-xml-xZvprTy7.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-DpaE5wy6.js";var t=e(`CodeXml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]);export{t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/format-1SN2SmDZ.js b/frontend/web/dist/assets/format-1SN2SmDZ.js new file mode 100644 index 000000000..0c192f6ff --- /dev/null +++ b/frontend/web/dist/assets/format-1SN2SmDZ.js @@ -0,0 +1 @@ +import{O as e}from"./index-W1lBlVkr.js";function t(e){if(!e)return`—`;let t=Date.now()/1e3,n=Math.max(0,t-e);return n<5?`just now`:n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function n(e){if(e==null||e<0)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t?`${t}d ${n}h`:n?`${n}h ${r}m`:r?`${r}m`:`${Math.floor(e)}s`}function r(e,t=2){return e==null||!isFinite(e)?`$0.00`:`$${e.toFixed(t)}`}function i(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function a(t,n=`en`){let r=t instanceof Date?t:new Date(typeof t==`number`&&t<0xe8d4a51000?t*1e3:t);if(Number.isNaN(r.getTime()))return`—`;let i=new Date,a=Math.max(0,Math.floor((i.getTime()-r.getTime())/1e3));if(a<60)return e(`time.justNow`,{},n);if(a<3600)return e(`time.minutesAgo`,{count:Math.floor(a/60)},n);let o=new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return Math.round((Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())-Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()))/864e5)===1?e(`time.yesterdayAt`,{time:o},n):a<86400?e(`time.hoursAgo`,{count:Math.floor(a/3600)},n):a<604800?new Intl.DateTimeFormat(n,{weekday:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function o(e){let t=e.ts??e.time,n=null;if(typeof t==`number`)n=t>0xe8d4a51000?t:t*1e3;else if(typeof t==`string`){let e=Date.parse(t);isNaN(e)||(n=e)}if(n==null||!Number.isFinite(n))return null;let r=new Date(n);return Number.isNaN(r.getTime())?null:r}function s(e){let t=o(e);if(!t)return``;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function c(e){return e instanceof Error?e.message:String(e||`Unknown error`)}function l(e,t){let n=c(e);return t?`Reply interrupted after a partial response: ${n}`:`Message failed before a response was received: ${n}`}export{i as a,r as c,c as i,n as l,s as n,a as o,o as r,l as s,t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/format-8giTdXya.js b/frontend/web/dist/assets/format-8giTdXya.js new file mode 100644 index 000000000..1c83f802f --- /dev/null +++ b/frontend/web/dist/assets/format-8giTdXya.js @@ -0,0 +1 @@ +import{O as e}from"./index-DbVni4qR.js";function t(e){if(!e)return`—`;let t=Date.now()/1e3,n=Math.max(0,t-e);return n<5?`just now`:n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function n(e){if(e==null||e<0)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t?`${t}d ${n}h`:n?`${n}h ${r}m`:r?`${r}m`:`${Math.floor(e)}s`}function r(e,t=2){return e==null||!isFinite(e)?`$0.00`:`$${e.toFixed(t)}`}function i(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function a(t,n=`en`){let r=t instanceof Date?t:new Date(typeof t==`number`&&t<0xe8d4a51000?t*1e3:t);if(Number.isNaN(r.getTime()))return`—`;let i=new Date,a=Math.max(0,Math.floor((i.getTime()-r.getTime())/1e3));if(a<60)return e(`time.justNow`,{},n);if(a<3600)return e(`time.minutesAgo`,{count:Math.floor(a/60)},n);let o=new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return Math.round((Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())-Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()))/864e5)===1?e(`time.yesterdayAt`,{time:o},n):a<86400?e(`time.hoursAgo`,{count:Math.floor(a/3600)},n):a<604800?new Intl.DateTimeFormat(n,{weekday:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function o(e){let t=e.ts??e.time,n=null;if(typeof t==`number`)n=t>0xe8d4a51000?t:t*1e3;else if(typeof t==`string`){let e=Date.parse(t);isNaN(e)||(n=e)}if(n==null||!Number.isFinite(n))return null;let r=new Date(n);return Number.isNaN(r.getTime())?null:r}function s(e){let t=o(e);if(!t)return``;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function c(e){return e instanceof Error?e.message:String(e||`Unknown error`)}function l(e,t){let n=c(e);return t?`Reply interrupted after a partial response: ${n}`:`Message failed before a response was received: ${n}`}export{i as a,r as c,c as i,n as l,s as n,a as o,o as r,l as s,t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/format-BNcptKD6.js b/frontend/web/dist/assets/format-BNcptKD6.js new file mode 100644 index 000000000..91e344df8 --- /dev/null +++ b/frontend/web/dist/assets/format-BNcptKD6.js @@ -0,0 +1 @@ +import{D as e}from"./index-Cr9q41CR.js";function t(e){if(!e)return`—`;let t=Date.now()/1e3,n=Math.max(0,t-e);return n<5?`just now`:n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function n(e){if(e==null||e<0)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t?`${t}d ${n}h`:n?`${n}h ${r}m`:r?`${r}m`:`${Math.floor(e)}s`}function r(e,t=2){return e==null||!isFinite(e)?`$0.00`:`$${e.toFixed(t)}`}function i(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function a(t,n=`en`){let r=t instanceof Date?t:new Date(typeof t==`number`&&t<0xe8d4a51000?t*1e3:t);if(Number.isNaN(r.getTime()))return`—`;let i=new Date,a=Math.max(0,Math.floor((i.getTime()-r.getTime())/1e3));if(a<60)return e(`time.justNow`,{},n);if(a<3600)return e(`time.minutesAgo`,{count:Math.floor(a/60)},n);let o=new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return Math.round((Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())-Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()))/864e5)===1?e(`time.yesterdayAt`,{time:o},n):a<86400?e(`time.hoursAgo`,{count:Math.floor(a/3600)},n):a<604800?new Intl.DateTimeFormat(n,{weekday:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function o(e){let t=e.ts??e.time,n=null;if(typeof t==`number`)n=t>0xe8d4a51000?t:t*1e3;else if(typeof t==`string`){let e=Date.parse(t);isNaN(e)||(n=e)}if(n==null||!Number.isFinite(n))return null;let r=new Date(n);return Number.isNaN(r.getTime())?null:r}function s(e){let t=o(e);if(!t)return``;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function c(e){return e instanceof Error?e.message:String(e||`Unknown error`)}function l(e,t){let n=c(e);return t?`Reply interrupted after a partial response: ${n}`:`Message failed before a response was received: ${n}`}export{i as a,r as c,c as i,n as l,s as n,a as o,o as r,l as s,t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/format-CB65te2P.js b/frontend/web/dist/assets/format-CB65te2P.js new file mode 100644 index 000000000..54b16aa8d --- /dev/null +++ b/frontend/web/dist/assets/format-CB65te2P.js @@ -0,0 +1 @@ +import{D as e}from"./index-Dkv2HM-n.js";function t(e){if(!e)return`—`;let t=Date.now()/1e3,n=Math.max(0,t-e);return n<5?`just now`:n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function n(e){if(e==null||e<0)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t?`${t}d ${n}h`:n?`${n}h ${r}m`:r?`${r}m`:`${Math.floor(e)}s`}function r(e,t=2){return e==null||!isFinite(e)?`$0.00`:`$${e.toFixed(t)}`}function i(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function a(t,n=`en`){let r=t instanceof Date?t:new Date(typeof t==`number`&&t<0xe8d4a51000?t*1e3:t);if(Number.isNaN(r.getTime()))return`—`;let i=new Date,a=Math.max(0,Math.floor((i.getTime()-r.getTime())/1e3));if(a<60)return e(`time.justNow`,{},n);if(a<3600)return e(`time.minutesAgo`,{count:Math.floor(a/60)},n);let o=new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return Math.round((Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())-Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()))/864e5)===1?e(`time.yesterdayAt`,{time:o},n):a<86400?e(`time.hoursAgo`,{count:Math.floor(a/3600)},n):a<604800?new Intl.DateTimeFormat(n,{weekday:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function o(e){let t=e.ts??e.time,n=null;if(typeof t==`number`)n=t>0xe8d4a51000?t:t*1e3;else if(typeof t==`string`){let e=Date.parse(t);isNaN(e)||(n=e)}if(n==null||!Number.isFinite(n))return null;let r=new Date(n);return Number.isNaN(r.getTime())?null:r}function s(e){let t=o(e);if(!t)return``;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function c(e){return e instanceof Error?e.message:String(e||`Unknown error`)}function l(e,t){let n=c(e);return t?`Reply interrupted after a partial response: ${n}`:`Message failed before a response was received: ${n}`}export{i as a,r as c,c as i,n as l,s as n,a as o,o as r,l as s,t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/format-CtVQGh59.js b/frontend/web/dist/assets/format-CtVQGh59.js new file mode 100644 index 000000000..01cc6200b --- /dev/null +++ b/frontend/web/dist/assets/format-CtVQGh59.js @@ -0,0 +1 @@ +import{O as e}from"./index-Cb5-aRKO.js";function t(e){if(!e)return`—`;let t=Date.now()/1e3,n=Math.max(0,t-e);return n<5?`just now`:n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function n(e){if(e==null||e<0)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t?`${t}d ${n}h`:n?`${n}h ${r}m`:r?`${r}m`:`${Math.floor(e)}s`}function r(e,t=2){return e==null||!isFinite(e)?`$0.00`:`$${e.toFixed(t)}`}function i(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function a(t,n=`en`){let r=t instanceof Date?t:new Date(typeof t==`number`&&t<0xe8d4a51000?t*1e3:t);if(Number.isNaN(r.getTime()))return`—`;let i=new Date,a=Math.max(0,Math.floor((i.getTime()-r.getTime())/1e3));if(a<60)return e(`time.justNow`,{},n);if(a<3600)return e(`time.minutesAgo`,{count:Math.floor(a/60)},n);let o=new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return Math.round((Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())-Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()))/864e5)===1?e(`time.yesterdayAt`,{time:o},n):a<86400?e(`time.hoursAgo`,{count:Math.floor(a/3600)},n):a<604800?new Intl.DateTimeFormat(n,{weekday:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function o(e){let t=e.ts??e.time,n=null;if(typeof t==`number`)n=t>0xe8d4a51000?t:t*1e3;else if(typeof t==`string`){let e=Date.parse(t);isNaN(e)||(n=e)}if(n==null||!Number.isFinite(n))return null;let r=new Date(n);return Number.isNaN(r.getTime())?null:r}function s(e){let t=o(e);if(!t)return``;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function c(e){return e instanceof Error?e.message:String(e||`Unknown error`)}function l(e,t){let n=c(e);return t?`Reply interrupted after a partial response: ${n}`:`Message failed before a response was received: ${n}`}export{i as a,r as c,c as i,n as l,s as n,a as o,o as r,l as s,t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/format-D4uyBiG8.js b/frontend/web/dist/assets/format-D4uyBiG8.js new file mode 100644 index 000000000..10fab4108 --- /dev/null +++ b/frontend/web/dist/assets/format-D4uyBiG8.js @@ -0,0 +1 @@ +import{D as e}from"./index-DPfzOfKU.js";function t(e){if(!e)return`—`;let t=Date.now()/1e3,n=Math.max(0,t-e);return n<5?`just now`:n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function n(e){if(e==null||e<0)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t?`${t}d ${n}h`:n?`${n}h ${r}m`:r?`${r}m`:`${Math.floor(e)}s`}function r(e,t=2){return e==null||!isFinite(e)?`$0.00`:`$${e.toFixed(t)}`}function i(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function a(t,n=`en`){let r=t instanceof Date?t:new Date(typeof t==`number`&&t<0xe8d4a51000?t*1e3:t);if(Number.isNaN(r.getTime()))return`—`;let i=new Date,a=Math.max(0,Math.floor((i.getTime()-r.getTime())/1e3));if(a<60)return e(`time.justNow`,{},n);if(a<3600)return e(`time.minutesAgo`,{count:Math.floor(a/60)},n);let o=new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return Math.round((Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())-Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()))/864e5)===1?e(`time.yesterdayAt`,{time:o},n):a<86400?e(`time.hoursAgo`,{count:Math.floor(a/3600)},n):a<604800?new Intl.DateTimeFormat(n,{weekday:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function o(e){let t=e.ts??e.time,n=null;if(typeof t==`number`)n=t>0xe8d4a51000?t:t*1e3;else if(typeof t==`string`){let e=Date.parse(t);isNaN(e)||(n=e)}if(n==null||!Number.isFinite(n))return null;let r=new Date(n);return Number.isNaN(r.getTime())?null:r}function s(e){let t=o(e);if(!t)return``;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function c(e){return e instanceof Error?e.message:String(e||`Unknown error`)}function l(e,t){let n=c(e);return t?`Reply interrupted after a partial response: ${n}`:`Message failed before a response was received: ${n}`}export{i as a,r as c,c as i,n as l,s as n,a as o,o as r,l as s,t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/format-DsyV_JEZ.js b/frontend/web/dist/assets/format-DsyV_JEZ.js new file mode 100644 index 000000000..d11205d0c --- /dev/null +++ b/frontend/web/dist/assets/format-DsyV_JEZ.js @@ -0,0 +1 @@ +import{O as e}from"./index-DbdG0NfU.js";function t(e){if(!e)return`—`;let t=Date.now()/1e3,n=Math.max(0,t-e);return n<5?`just now`:n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function n(e){if(e==null||e<0)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t?`${t}d ${n}h`:n?`${n}h ${r}m`:r?`${r}m`:`${Math.floor(e)}s`}function r(e,t=2){return e==null||!isFinite(e)?`$0.00`:`$${e.toFixed(t)}`}function i(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function a(t,n=`en`){let r=t instanceof Date?t:new Date(typeof t==`number`&&t<0xe8d4a51000?t*1e3:t);if(Number.isNaN(r.getTime()))return`—`;let i=new Date,a=Math.max(0,Math.floor((i.getTime()-r.getTime())/1e3));if(a<60)return e(`time.justNow`,{},n);if(a<3600)return e(`time.minutesAgo`,{count:Math.floor(a/60)},n);let o=new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);return Math.round((Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())-Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()))/864e5)===1?e(`time.yesterdayAt`,{time:o},n):a<86400?e(`time.hoursAgo`,{count:Math.floor(a/3600)},n):a<604800?new Intl.DateTimeFormat(n,{weekday:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r)}function o(e){let t=e.ts??e.time,n=null;if(typeof t==`number`)n=t>0xe8d4a51000?t:t*1e3;else if(typeof t==`string`){let e=Date.parse(t);isNaN(e)||(n=e)}if(n==null||!Number.isFinite(n))return null;let r=new Date(n);return Number.isNaN(r.getTime())?null:r}function s(e){let t=o(e);if(!t)return``;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function c(e){return e instanceof Error?e.message:String(e||`Unknown error`)}function l(e,t){let n=c(e);return t?`Reply interrupted after a partial response: ${n}`:`Message failed before a response was received: ${n}`}export{i as a,r as c,c as i,n as l,s as n,a as o,o as r,l as s,t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/history-B00Gliyq.js b/frontend/web/dist/assets/history-B00Gliyq.js new file mode 100644 index 000000000..3e33c3208 --- /dev/null +++ b/frontend/web/dist/assets/history-B00Gliyq.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-Bc1ibrT3.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=e(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/history-BtuT-8i3.js b/frontend/web/dist/assets/history-BtuT-8i3.js new file mode 100644 index 000000000..8c55f13b0 --- /dev/null +++ b/frontend/web/dist/assets/history-BtuT-8i3.js @@ -0,0 +1 @@ +import{R as e}from"./AppearanceControls-BFWF0z-J.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=e(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/history-BylQ-TOW.js b/frontend/web/dist/assets/history-BylQ-TOW.js new file mode 100644 index 000000000..038e385cc --- /dev/null +++ b/frontend/web/dist/assets/history-BylQ-TOW.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-DpaE5wy6.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=e(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/history-CBChoFHN.js b/frontend/web/dist/assets/history-CBChoFHN.js new file mode 100644 index 000000000..a6f39cde1 --- /dev/null +++ b/frontend/web/dist/assets/history-CBChoFHN.js @@ -0,0 +1 @@ +import{R as e}from"./AppearanceControls-vjVM_spw.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=e(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/history-DKaffr1B.js b/frontend/web/dist/assets/history-DKaffr1B.js new file mode 100644 index 000000000..5251a3a76 --- /dev/null +++ b/frontend/web/dist/assets/history-DKaffr1B.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-BIflq6l1.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=e(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/history-DuGaxgzd.js b/frontend/web/dist/assets/history-DuGaxgzd.js new file mode 100644 index 000000000..ee9304e39 --- /dev/null +++ b/frontend/web/dist/assets/history-DuGaxgzd.js @@ -0,0 +1 @@ +import{R as e}from"./AppearanceControls-BNJdEiGG.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=e(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/history-MzF_RldS.js b/frontend/web/dist/assets/history-MzF_RldS.js new file mode 100644 index 000000000..72481cef5 --- /dev/null +++ b/frontend/web/dist/assets/history-MzF_RldS.js @@ -0,0 +1 @@ +import{R as e}from"./AppearanceControls-C_eUyO2x.js";var t=e(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),n=e(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]);export{t as n,n as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/icons-DHjcpj5P.js b/frontend/web/dist/assets/icons-DHjcpj5P.js new file mode 100644 index 000000000..f8fa86a8a --- /dev/null +++ b/frontend/web/dist/assets/icons-DHjcpj5P.js @@ -0,0 +1,1080 @@ +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";var n=t((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.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`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,ee={current:null},te={key:!0,ref:!0,__self:!0,__source:!0};function C(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!te.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=n()})),i=t((e=>{var t=r(),n=Symbol.for(`react.element`),i=Symbol.for(`react.fragment`),a=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,r){var i,c={},l=null,u=null;for(i in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)a.call(t,i)&&!s.hasOwnProperty(i)&&(c[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps,t)c[i]===void 0&&(c[i]=t[i]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:o.current}}e.Fragment=i,e.jsx=c,e.jsxs=c})),a=t(((e,t)=>{t.exports=i()})),o=e(r(),1);function s(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function m(e,t,n){return(t=te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function g(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function _(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t-1;i--){var a=n[i],o=(a.tagName||``).toUpperCase();[`STYLE`,`LINK`].indexOf(o)>-1&&(r=a)}return k.head.insertBefore(t,r),e}}var un=`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`;function dn(){for(var e=12,t=``;e-->0;)t+=un[Math.random()*62|0];return t}function B(e){for(var t=[],n=(e||[]).length>>>0;n--;)t[n]=e[n];return t}function fn(e){return e.classList?B(e.classList):(e.getAttribute(`class`)||``).split(` `).filter(function(e){return e})}function pn(e){return`${e}`.replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`).replace(//g,`>`)}function mn(e){return Object.keys(e||{}).reduce(function(t,n){return t+`${n}="${pn(e[n])}" `},``).trim()}function hn(e){return Object.keys(e||{}).reduce(function(t,n){return t+`${n}: ${e[n].trim()};`},``)}function gn(e){return e.size!==z.size||e.x!==z.x||e.y!==z.y||e.rotate!==z.rotate||e.flipX||e.flipY}function _n(e){var t=e.transform,n=e.containerWidth,r=e.iconWidth;return{outer:{transform:`translate(${n/2} 256)`},inner:{transform:`${`translate(${t.x*32}, ${t.y*32}) `} ${`scale(${t.size/16*(t.flipX?-1:1)}, ${t.size/16*(t.flipY?-1:1)}) `} ${`rotate(${t.rotate} 0 0)`}`},path:{transform:`translate(${r/2*-1} -256)`}}}function vn(e){var t=e.transform,n=e.width,r=n===void 0?jt:n,i=e.height,a=i===void 0?jt:i,o=e.startCentered,s=o!==void 0&&o,c=``;return c+=s&&se?`translate(${t.x/R-r/2}em, ${t.y/R-a/2}em) `:s?`translate(calc(-50% + ${t.x/R}em), calc(-50% + ${t.y/R}em)) `:`translate(${t.x/R}em, ${t.y/R}em) `,c+=`scale(${t.size/R*(t.flipX?-1:1)}, ${t.size/R*(t.flipY?-1:1)}) `,c+=`rotate(${t.rotate}deg) `,c}var yn=`:root, :host { + --fa-font-solid: normal 900 1em/1 'Font Awesome 7 Free'; + --fa-font-regular: normal 400 1em/1 'Font Awesome 7 Free'; + --fa-font-light: normal 300 1em/1 'Font Awesome 7 Pro'; + --fa-font-thin: normal 100 1em/1 'Font Awesome 7 Pro'; + --fa-font-duotone: normal 900 1em/1 'Font Awesome 7 Duotone'; + --fa-font-duotone-regular: normal 400 1em/1 'Font Awesome 7 Duotone'; + --fa-font-duotone-light: normal 300 1em/1 'Font Awesome 7 Duotone'; + --fa-font-duotone-thin: normal 100 1em/1 'Font Awesome 7 Duotone'; + --fa-font-brands: normal 400 1em/1 'Font Awesome 7 Brands'; + --fa-font-sharp-solid: normal 900 1em/1 'Font Awesome 7 Sharp'; + --fa-font-sharp-regular: normal 400 1em/1 'Font Awesome 7 Sharp'; + --fa-font-sharp-light: normal 300 1em/1 'Font Awesome 7 Sharp'; + --fa-font-sharp-thin: normal 100 1em/1 'Font Awesome 7 Sharp'; + --fa-font-sharp-duotone-solid: normal 900 1em/1 'Font Awesome 7 Sharp Duotone'; + --fa-font-sharp-duotone-regular: normal 400 1em/1 'Font Awesome 7 Sharp Duotone'; + --fa-font-sharp-duotone-light: normal 300 1em/1 'Font Awesome 7 Sharp Duotone'; + --fa-font-sharp-duotone-thin: normal 100 1em/1 'Font Awesome 7 Sharp Duotone'; + --fa-font-slab-regular: normal 400 1em/1 'Font Awesome 7 Slab'; + --fa-font-slab-press-regular: normal 400 1em/1 'Font Awesome 7 Slab Press'; + --fa-font-slab-duo-regular: normal 400 1em/1 'Font Awesome 7 Slab Duo'; + --fa-font-slab-press-duo-regular: normal 400 1em/1 'Font Awesome 7 Slab Press Duo'; + --fa-font-pixel-regular: normal 400 1em/1 'Font Awesome 7 Pixel'; + --fa-font-mosaic-solid: normal 900 1em/1 'Font Awesome 7 Mosaic'; + --fa-font-vellum-solid: normal 900 1em/1 'Font Awesome 7 Vellum'; + --fa-font-whiteboard-semibold: normal 600 1em/1 'Font Awesome 7 Whiteboard'; + --fa-font-thumbprint-light: normal 300 1em/1 'Font Awesome 7 Thumbprint'; + --fa-font-notdog-solid: normal 900 1em/1 'Font Awesome 7 Notdog'; + --fa-font-notdog-duo-solid: normal 900 1em/1 'Font Awesome 7 Notdog Duo'; + --fa-font-etch-solid: normal 900 1em/1 'Font Awesome 7 Etch'; + --fa-font-graphite-thin: normal 100 1em/1 'Font Awesome 7 Graphite'; + --fa-font-jelly-regular: normal 400 1em/1 'Font Awesome 7 Jelly'; + --fa-font-jelly-fill-regular: normal 400 1em/1 'Font Awesome 7 Jelly Fill'; + --fa-font-jelly-duo-regular: normal 400 1em/1 'Font Awesome 7 Jelly Duo'; + --fa-font-chisel-regular: normal 400 1em/1 'Font Awesome 7 Chisel'; + --fa-font-utility-semibold: normal 600 1em/1 'Font Awesome 7 Utility'; + --fa-font-utility-duo-semibold: normal 600 1em/1 'Font Awesome 7 Utility Duo'; + --fa-font-utility-fill-semibold: normal 600 1em/1 'Font Awesome 7 Utility Fill'; +} + +.svg-inline--fa { + box-sizing: content-box; + display: var(--fa-display, inline-block); + height: 1em; + overflow: visible; + vertical-align: -0.125em; + width: var(--fa-width, 1.25em); +} +.svg-inline--fa.fa-2xs { + vertical-align: 0.1em; +} +.svg-inline--fa.fa-xs { + vertical-align: 0em; +} +.svg-inline--fa.fa-sm { + vertical-align: -0.0714285714em; +} +.svg-inline--fa.fa-lg { + vertical-align: -0.2em; +} +.svg-inline--fa.fa-xl { + vertical-align: -0.25em; +} +.svg-inline--fa.fa-2xl { + vertical-align: -0.3125em; +} +.svg-inline--fa.fa-pull-left, +.svg-inline--fa .fa-pull-start { + float: inline-start; + margin-inline-end: var(--fa-pull-margin, 0.3em); +} +.svg-inline--fa.fa-pull-right, +.svg-inline--fa .fa-pull-end { + float: inline-end; + margin-inline-start: var(--fa-pull-margin, 0.3em); +} +.svg-inline--fa.fa-li { + width: var(--fa-li-width, 2em); + inset-inline-start: calc(-1 * var(--fa-li-width, 2em)); + inset-block-start: 0.25em; /* syncing vertical alignment with Web Font rendering */ +} + +.fa-layers-counter, .fa-layers-text { + display: inline-block; + position: absolute; + text-align: center; +} + +.fa-layers { + display: inline-block; + height: 1em; + position: relative; + text-align: center; + vertical-align: -0.125em; + width: var(--fa-width, 1.25em); +} +.fa-layers .svg-inline--fa { + inset: 0; + margin: auto; + position: absolute; + transform-origin: center center; +} + +.fa-layers-text { + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + transform-origin: center center; +} + +.fa-layers-counter { + background-color: var(--fa-counter-background-color, #ff253a); + border-radius: var(--fa-counter-border-radius, 1em); + box-sizing: border-box; + color: var(--fa-inverse, #fff); + line-height: var(--fa-counter-line-height, 1); + max-width: var(--fa-counter-max-width, 5em); + min-width: var(--fa-counter-min-width, 1.5em); + overflow: hidden; + padding: var(--fa-counter-padding, 0.25em 0.5em); + right: var(--fa-right, 0); + text-overflow: ellipsis; + top: var(--fa-top, 0); + transform: scale(var(--fa-counter-scale, 0.25)); + transform-origin: top right; +} + +.fa-layers-bottom-right { + bottom: var(--fa-bottom, 0); + right: var(--fa-right, 0); + top: auto; + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: bottom right; +} + +.fa-layers-bottom-left { + bottom: var(--fa-bottom, 0); + left: var(--fa-left, 0); + right: auto; + top: auto; + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: bottom left; +} + +.fa-layers-top-right { + top: var(--fa-top, 0); + right: var(--fa-right, 0); + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: top right; +} + +.fa-layers-top-left { + left: var(--fa-left, 0); + right: auto; + top: var(--fa-top, 0); + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: top left; +} + +.fa-1x { + font-size: 1em; +} + +.fa-2x { + font-size: 2em; +} + +.fa-3x { + font-size: 3em; +} + +.fa-4x { + font-size: 4em; +} + +.fa-5x { + font-size: 5em; +} + +.fa-6x { + font-size: 6em; +} + +.fa-7x { + font-size: 7em; +} + +.fa-8x { + font-size: 8em; +} + +.fa-9x { + font-size: 9em; +} + +.fa-10x { + font-size: 10em; +} + +.fa-2xs { + font-size: calc(10 / 16 * 1em); /* converts a 10px size into an em-based value that's relative to the scale's 16px base */ + line-height: calc(1 / 10 * 1em); /* sets the line-height of the icon back to that of it's parent */ + vertical-align: calc((6 / 10 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */ +} + +.fa-xs { + font-size: calc(12 / 16 * 1em); /* converts a 12px size into an em-based value that's relative to the scale's 16px base */ + line-height: calc(1 / 12 * 1em); /* sets the line-height of the icon back to that of it's parent */ + vertical-align: calc((6 / 12 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */ +} + +.fa-sm { + font-size: calc(14 / 16 * 1em); /* converts a 14px size into an em-based value that's relative to the scale's 16px base */ + line-height: calc(1 / 14 * 1em); /* sets the line-height of the icon back to that of it's parent */ + vertical-align: calc((6 / 14 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */ +} + +.fa-lg { + font-size: calc(20 / 16 * 1em); /* converts a 20px size into an em-based value that's relative to the scale's 16px base */ + line-height: calc(1 / 20 * 1em); /* sets the line-height of the icon back to that of it's parent */ + vertical-align: calc((6 / 20 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */ +} + +.fa-xl { + font-size: calc(24 / 16 * 1em); /* converts a 24px size into an em-based value that's relative to the scale's 16px base */ + line-height: calc(1 / 24 * 1em); /* sets the line-height of the icon back to that of it's parent */ + vertical-align: calc((6 / 24 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */ +} + +.fa-2xl { + font-size: calc(32 / 16 * 1em); /* converts a 32px size into an em-based value that's relative to the scale's 16px base */ + line-height: calc(1 / 32 * 1em); /* sets the line-height of the icon back to that of it's parent */ + vertical-align: calc((6 / 32 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */ +} + +.fa-width-auto { + --fa-width: auto; +} + +.fa-fw, +.fa-width-fixed { + --fa-width: 1.25em; +} + +.fa-canvas-square { + padding-block: 0.125em; + margin-block-end: -0.125em; +} + +.fa-canvas-roomy { + padding-block: 0.25em; + padding-inline: 0.125em; + margin-block-end: -0.25em; + box-sizing: content-box; +} + +.fa-ul { + list-style-type: none; + margin-inline-start: var(--fa-li-margin, 2.5em); + padding-inline-start: 0; +} +.fa-ul > li { + position: relative; +} + +.fa-li { + inset-inline-start: calc(-1 * var(--fa-li-width, 2em)); + position: absolute; + text-align: center; + width: var(--fa-li-width, 2em); + line-height: inherit; +} + +/* Heads Up: Bordered Icons will not be supported in the future! + - This feature will be deprecated in the next major release of Font Awesome (v8)! + - You may continue to use it in this version *v7), but it will not be supported in Font Awesome v8. +*/ +/* Notes: +* --@{v.$css-prefix}-border-width = 1/16 by default (to render as ~1px based on a 16px default font-size) +* --@{v.$css-prefix}-border-padding = + ** 3/16 for vertical padding (to give ~2px of vertical whitespace around an icon considering it's vertical alignment) + ** 4/16 for horizontal padding (to give ~4px of horizontal whitespace around an icon) +*/ +.fa-border { + border-color: var(--fa-border-color, #eee); + border-radius: var(--fa-border-radius, 0.1em); + border-style: var(--fa-border-style, solid); + border-width: var(--fa-border-width, 0.0625em); + box-sizing: var(--fa-border-box-sizing, content-box); + padding: var(--fa-border-padding, 0.1875em 0.25em); +} + +.fa-pull-left, +.fa-pull-start { + float: inline-start; + margin-inline-end: var(--fa-pull-margin, 0.3em); +} + +.fa-pull-right, +.fa-pull-end { + float: inline-end; + margin-inline-start: var(--fa-pull-margin, 0.3em); +} + +.fa-beat { + animation-name: fa-beat; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-bounce { + animation-name: fa-bounce; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1)); +} + +.fa-fade { + animation-name: fa-fade; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-beat-fade { + animation-name: fa-beat-fade; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-flip { + animation-name: fa-flip; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1.5s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-flip-360 { + animation-name: fa-flip-360; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-shake { + animation-name: fa-shake; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 0.75s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-spin { + animation-name: fa-spin; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 2s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, linear); +} + +.fa-spin-reverse { + --fa-animation-direction: reverse; +} + +.fa-pulse, +.fa-spin-pulse { + animation-name: fa-spin; + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, steps(8)); +} + +.fa-spin-snap { + animation-name: fa-spin-snap; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 3s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, linear); +} + +.fa-spin-snap-4 { + animation-name: fa-spin-snap-4; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 2.4s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, linear); +} + +.fa-spin-snap-8 { + animation-name: fa-spin-snap-8; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 4s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, linear); +} + +.fa-buzz { + animation-name: fa-buzz; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 0.6s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, linear); +} + +.fa-wag { + animation-name: fa-wag; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 0.9s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-out); + transform-origin: bottom center; +} + +.fa-float { + animation-name: fa-float; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 3s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); + will-change: transform; +} + +.fa-swing { + animation-name: fa-swing; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1.2s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-out); + transform-origin: top center; +} + +.fa-jello { + animation-name: fa-jello; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 0.9s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-out); +} + +@media (prefers-reduced-motion: reduce) { + .fa-beat, + .fa-bounce, + .fa-fade, + .fa-beat-fade, + .fa-flip, + .fa-flip-360, + .fa-pulse, + .fa-shake, + .fa-spin, + .fa-spin-pulse, + .fa-buzz, + .fa-float, + .fa-jello, + .fa-spin-snap, + .fa-spin-snap-4, + .fa-spin-snap-8, + .fa-swing, + .fa-wag { + animation: none !important; + transition: none !important; + } +} +@keyframes fa-beat { + 0% { + transform: scale(1); + } + 25% { + transform: scale(calc(1.25 * var(--fa-beat-scale, 1.25))); + } + 45% { + transform: scale(calc(1.22 * var(--fa-beat-scale, 1.22))); + } + 65% { + transform: scale(calc(1.25 * var(--fa-beat-scale, 1.25))); + } + 90% { + transform: scale(1); + } +} +@keyframes fa-bounce { + 0% { + transform: scale(1, 1) translateY(0); + animation-timing-function: var(--fa-animation-timing); + } + 14% { + transform: scale(var(--fa-bounce-start-scale-x, 1.06), var(--fa-bounce-start-scale-y, 0.94)) translateY(var(--fa-bounce-anticipation, 3px)); + animation-timing-function: cubic-bezier(0.33, 0, 0.66, 0.33); + } + 32% { + transform: scale(var(--fa-bounce-jump-scale-x, 0.94), var(--fa-bounce-jump-scale-y, 1.12)) translateY(calc(-1 * var(--fa-bounce-height, 0.5em))); + animation-timing-function: cubic-bezier(0.33, 0.66, 0.66, 1); + } + 52% { + transform: scale(1, 1) translateY(calc(-1 * var(--fa-bounce-height, 0.5em) * 1.1)); + animation-timing-function: cubic-bezier(0.5, 0, 1, 0.5); + } + 70% { + transform: scale(var(--fa-bounce-land-scale-x, 1.06), var(--fa-bounce-land-scale-y, 0.92)) translateY(0); + animation-timing-function: cubic-bezier(0.33, 0.33, 0.66, 1); + } + 85% { + transform: scale(0.98, 1.04) translateY(calc(-2px * var(--fa-bounce-rebound, 1))); + animation-timing-function: cubic-bezier(0.33, 0, 0.66, 1); + } + 100% { + transform: scale(1, 1) translateY(0); + } +} +@keyframes fa-fade { + 0% { + opacity: 1; + transform: scale(1); + animation-timing-function: cubic-bezier(0.2, 0, 0.4, 1); + } + 40% { + opacity: var(--fa-fade-opacity, 0.4); + transform: scale(0.98); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 100% { + opacity: 1; + transform: scale(1); + } +} +@keyframes fa-beat-fade { + 0% { + opacity: var(--fa-beat-fade-opacity, 0.4); + transform: scale(1); + animation-timing-function: cubic-bezier(0.2, 0, 0.4, 1); + } + 25% { + opacity: calc(var(--fa-beat-fade-opacity, 0.4) + 0.4); + transform: scale(var(--fa-beat-fade-scale, 1.28)); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 45% { + opacity: 1; + transform: scale(var(--fa-beat-fade-scale, 1.25)); + animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + } + 65% { + opacity: calc(var(--fa-beat-fade-opacity, 0.4) + 0.4); + transform: scale(var(--fa-beat-fade-scale, 1.28)); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 100% { + opacity: var(--fa-beat-fade-opacity, 0.4); + transform: scale(1); + } +} +@keyframes fa-flip { + 0% { + transform: perspective(2em) scale(1) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), 0deg); + animation-timing-function: cubic-bezier(0.2, 0, 0.4, 1); + } + 8% { + transform: perspective(2em) scale(var(--fa-flip-anticipation-scale, 0.95)) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), 0deg); + animation-timing-function: cubic-bezier(0.33, 0, 0.66, 0.33); + } + 35% { + transform: perspective(2em) scale(1) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), calc(var(--fa-flip-angle, -360deg) * 0.6)); + animation-timing-function: linear; + } + 65% { + transform: perspective(2em) scale(1) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), calc(var(--fa-flip-angle, -360deg) * 0.5)); + animation-timing-function: cubic-bezier(0.33, 0.66, 0.66, 1); + } + 92% { + transform: perspective(2em) scale(1) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), calc(var(--fa-flip-angle, -360deg) * var(--fa-flip-overshoot, 1.04))); + animation-timing-function: cubic-bezier(0.33, 0, 0.66, 1); + } + 100% { + transform: perspective(2em) scale(1) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -360deg)); + } +} +@keyframes fa-flip-360 { + 0% { + transform: perspective(2em) scale(1) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), 0deg); + animation-timing-function: cubic-bezier(0.2, 0, 0.4, 1); + } + 8% { + transform: perspective(2em) scale(var(--fa-flip-anticipation-scale, 0.95)) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), 0deg); + animation-timing-function: cubic-bezier(0.33, 0, 0.66, 0.33); + } + 50% { + transform: perspective(2em) scale(1) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), calc(var(--fa-flip-angle, -360deg) * 0.6)); + animation-timing-function: cubic-bezier(0.33, 0.66, 0.66, 1); + } + 80% { + transform: perspective(2em) scale(1) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), calc(var(--fa-flip-angle, -360deg) * var(--fa-flip-overshoot, 1.04))); + animation-timing-function: cubic-bezier(0.33, 0, 0.66, 1); + } + 100% { + transform: perspective(2em) scale(1) rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -360deg)); + } +} +@keyframes fa-shake { + 0% { + transform: rotate(0deg); + animation-timing-function: cubic-bezier(0.2, 0, 0.8, 1); + } + 8% { + transform: rotate(35deg) translateX(1px); + animation-timing-function: cubic-bezier(0.3, 0, 0.7, 1); + } + 20% { + transform: rotate(-22deg) translateX(-1px); + animation-timing-function: cubic-bezier(0.3, 0, 0.7, 1); + } + 35% { + transform: rotate(15deg) translateX(1px); + animation-timing-function: cubic-bezier(0.3, 0, 0.7, 1); + } + 50% { + transform: rotate(-9deg); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 65% { + transform: rotate(5deg); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 78% { + transform: rotate(-3deg); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 90% { + transform: rotate(1deg); + animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + } + 100% { + transform: rotate(0deg); + } +} +@keyframes fa-spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} +@keyframes fa-spin-snap { + 0% { + transform: rotate(0deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 12% { + transform: rotate(60deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 16.67% { + transform: rotate(60deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 28.67% { + transform: rotate(120deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 33.33% { + transform: rotate(120deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 45.33% { + transform: rotate(180deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 50% { + transform: rotate(180deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 62% { + transform: rotate(240deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 66.67% { + transform: rotate(240deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 78.67% { + transform: rotate(300deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 83.33% { + transform: rotate(300deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 95.33% { + transform: rotate(360deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 100% { + transform: rotate(360deg); + } +} +@keyframes fa-spin-snap-4 { + 0% { + transform: rotate(0deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 15% { + transform: rotate(90deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 25% { + transform: rotate(90deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 40% { + transform: rotate(180deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 50% { + transform: rotate(180deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 65% { + transform: rotate(270deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 75% { + transform: rotate(270deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 90% { + transform: rotate(360deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 100% { + transform: rotate(360deg); + } +} +@keyframes fa-spin-snap-8 { + 0% { + transform: rotate(0deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 9% { + transform: rotate(45deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 12.5% { + transform: rotate(45deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 21.5% { + transform: rotate(90deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 25% { + transform: rotate(90deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 34% { + transform: rotate(135deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 37.5% { + transform: rotate(135deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 46.5% { + transform: rotate(180deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 50% { + transform: rotate(180deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 59% { + transform: rotate(225deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 62.5% { + transform: rotate(225deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 71.5% { + transform: rotate(270deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 75% { + transform: rotate(270deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 84% { + transform: rotate(315deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 87.5% { + transform: rotate(315deg); + animation-timing-function: cubic-bezier(0, 0, 0.2, 1); + } + 96.5% { + transform: rotate(360deg); + animation-timing-function: cubic-bezier(0.8, 0, 1, 1); + } + 100% { + transform: rotate(360deg); + } +} +@keyframes fa-buzz { + 0% { + transform: translateX(0) rotate(0deg); + animation-timing-function: cubic-bezier(0.1, 0, 0.9, 1); + } + 5% { + transform: translateX(var(--fa-buzz-distance, 4px)) rotate(0.5deg); + } + 10% { + transform: translateX(calc(-1 * var(--fa-buzz-distance, 4px))) rotate(-0.5deg); + } + 15% { + transform: translateX(var(--fa-buzz-distance, 4px)) rotate(0.3deg); + } + 20% { + transform: translateX(calc(-1 * var(--fa-buzz-distance, 4px))) rotate(-0.3deg); + } + 25% { + transform: translateX(calc(var(--fa-buzz-distance, 4px) * 0.7)) rotate(0.2deg); + } + 30% { + transform: translateX(calc(-1 * var(--fa-buzz-distance, 4px) * 0.7)) rotate(-0.2deg); + } + 35% { + transform: translateX(calc(var(--fa-buzz-distance, 4px) * 0.4)) rotate(0.1deg); + } + 40% { + transform: translateX(0) rotate(0deg); + } + 100% { + transform: translateX(0) rotate(0deg); + } +} +@keyframes fa-wag { + 0% { + transform: rotate(0deg); + animation-timing-function: cubic-bezier(0.2, 0, 0.6, 1); + } + 12% { + transform: rotate(var(--fa-wag-angle, 12deg)); + animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + } + 24% { + transform: rotate(2deg); + animation-timing-function: cubic-bezier(0.2, 0, 0.6, 1); + } + 36% { + transform: rotate(calc(var(--fa-wag-angle, 12deg) * 0.85)); + animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + } + 48% { + transform: rotate(1deg); + animation-timing-function: cubic-bezier(0.2, 0, 0.6, 1); + } + 58% { + transform: rotate(calc(var(--fa-wag-angle, 12deg) * 0.6)); + animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + } + 68% { + transform: rotate(0deg); + } + 100% { + transform: rotate(0deg); + } +} +@keyframes fa-float { + 0% { + transform: translateY(0) translateX(0) rotate(0deg) scale(var(--fa-float-squash-x, 1.02), var(--fa-float-squash-y, 0.98)); + animation-timing-function: cubic-bezier(0.33, 0, 0.66, 0.33); + } + 15% { + transform: translateY(calc(-0.4 * var(--fa-float-height, 6px))) translateX(var(--fa-float-drift, 1px)) rotate(var(--fa-float-tilt, 1deg)) scale(1, 1); + animation-timing-function: cubic-bezier(0.33, 0.66, 0.66, 1); + } + 35% { + transform: translateY(calc(-1 * var(--fa-float-height, 6px))) translateX(0) rotate(0deg) scale(var(--fa-float-stretch-x, 0.98), var(--fa-float-stretch-y, 1.03)); + animation-timing-function: cubic-bezier(0.5, 0, 0.5, 0); + } + 50% { + transform: translateY(calc(-0.92 * var(--fa-float-height, 6px))) translateX(calc(-0.5 * var(--fa-float-drift, 1px))) rotate(calc(-0.5 * var(--fa-float-tilt, 1deg))) scale(0.995, 1.01); + animation-timing-function: cubic-bezier(0.33, 0, 0.66, 0.33); + } + 70% { + transform: translateY(calc(-0.3 * var(--fa-float-height, 6px))) translateX(calc(-1 * var(--fa-float-drift, 1px))) rotate(calc(-1 * var(--fa-float-tilt, 1deg))) scale(1, 1); + animation-timing-function: cubic-bezier(0.33, 0.66, 0.66, 1); + } + 90% { + transform: translateY(calc(0.05 * var(--fa-float-height, 6px))) translateX(0) rotate(0deg) scale(var(--fa-float-squash-x, 1.02), var(--fa-float-squash-y, 0.98)); + animation-timing-function: cubic-bezier(0.33, 0, 0.66, 1); + } + 100% { + transform: translateY(0) translateX(0) rotate(0deg) scale(var(--fa-float-squash-x, 1.02), var(--fa-float-squash-y, 0.98)); + } +} +@keyframes fa-swing { + 0% { + transform: rotate(0deg); + animation-timing-function: cubic-bezier(0.2, 0, 0.8, 1); + } + 8% { + transform: rotate(var(--fa-swing-angle, 22deg)); + animation-timing-function: cubic-bezier(0.3, 0, 0.7, 1); + } + 18% { + transform: rotate(calc(-1 * var(--fa-swing-angle, 22deg) * 0.85)); + animation-timing-function: cubic-bezier(0.3, 0, 0.7, 1); + } + 28% { + transform: rotate(calc(var(--fa-swing-angle, 22deg) * 0.65)); + animation-timing-function: cubic-bezier(0.35, 0, 0.65, 1); + } + 38% { + transform: rotate(calc(-1 * var(--fa-swing-angle, 22deg) * 0.45)); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 48% { + transform: rotate(calc(var(--fa-swing-angle, 22deg) * 0.25)); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 56% { + transform: rotate(calc(-1 * var(--fa-swing-angle, 22deg) * 0.1)); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 64% { + transform: rotate(0deg); + } + 100% { + transform: rotate(0deg); + } +} +@keyframes fa-jello { + 0% { + transform: scale(1, 1); + animation-timing-function: cubic-bezier(0.2, 0, 0.8, 1); + } + 12% { + transform: scale(var(--fa-jello-scale-x, 1.15), calc(2 - var(--fa-jello-scale-x, 1.15))); + animation-timing-function: cubic-bezier(0.3, 0, 0.7, 1); + } + 24% { + transform: scale(calc(2 - var(--fa-jello-scale-y, 1.12)), var(--fa-jello-scale-y, 1.12)); + animation-timing-function: cubic-bezier(0.3, 0, 0.7, 1); + } + 36% { + transform: scale(calc(1 + (var(--fa-jello-scale-x, 1.15) - 1) * 0.5), calc(2 - (1 + (var(--fa-jello-scale-x, 1.15) - 1) * 0.5))); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 48% { + transform: scale(calc(2 - (1 + (var(--fa-jello-scale-y, 1.12) - 1) * 0.3)), calc(1 + (var(--fa-jello-scale-y, 1.12) - 1) * 0.3)); + animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); + } + 58% { + transform: scale(1.02, 0.98); + animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + } + 68% { + transform: scale(1, 1); + } + 100% { + transform: scale(1, 1); + } +} +.fa-rotate-90 { + transform: rotate(90deg); +} + +.fa-rotate-180 { + transform: rotate(180deg); +} + +.fa-rotate-270 { + transform: rotate(270deg); +} + +.fa-flip-horizontal { + transform: scale(-1, 1); +} + +.fa-flip-vertical { + transform: scale(1, -1); +} + +.fa-flip-both, +.fa-flip-horizontal.fa-flip-vertical { + transform: scale(-1, -1); +} + +.fa-rotate-by { + transform: rotate(var(--fa-rotate-angle, 0)); +} + +.svg-inline--fa .fa-primary { + fill: var(--fa-primary-color, currentColor); + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa .fa-secondary { + fill: var(--fa-secondary-color, currentColor); + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-primary { + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-secondary { + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa mask .fa-primary, +.svg-inline--fa mask .fa-secondary { + fill: black; +} + +.svg-inline--fa.fa-inverse { + fill: var(--fa-inverse, #fff); +} + +.fa-stack { + display: inline-block; + height: 2em; + line-height: 2em; + position: relative; + vertical-align: middle; + width: 2.5em; +} + +.fa-inverse { + color: var(--fa-inverse, #fff); +} + +.svg-inline--fa.fa-stack-1x { + --fa-width: 1.25em; + height: 1em; + width: var(--fa-width); +} +.svg-inline--fa.fa-stack-2x { + --fa-width: 2.5em; + height: 2em; + width: var(--fa-width); +} + +.fa-stack-1x, +.fa-stack-2x { + inset: 0; + margin: auto; + position: absolute; + z-index: var(--fa-stack-z-index, auto); +}`;function bn(){var e=Mt,t=Nt,n=L.cssPrefix,r=L.replacementClass,i=yn;if(n!==e||r!==t){var a=RegExp(`\\.${e}\\-`,`g`),o=RegExp(`\\--${e}\\-`,`g`),s=RegExp(`\\.${t}`,`g`);i=i.replace(a,`.${n}-`).replace(o,`--${n}-`).replace(s,`.${r}`)}return i}var xn=!1;function Sn(){L.autoAddCss&&!xn&&(ln(bn()),xn=!0)}var Cn={mixout:function(){return{dom:{css:bn,insertCss:Sn}}},hooks:function(){return{beforeDOMElementCreation:function(){Sn()},beforeI2svg:function(){Sn()}}}},V=O||{};V[N]||(V[N]={}),V[N].styles||(V[N].styles={}),V[N].hooks||(V[N].hooks={}),V[N].shims||(V[N].shims=[]);var H=V[N],wn=[],Tn=function(){k.removeEventListener(`DOMContentLoaded`,Tn),En=1,wn.map(function(e){return e()})},En=!1;j&&(En=(k.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(k.readyState),En||k.addEventListener(`DOMContentLoaded`,Tn));function Dn(e){j&&(En?setTimeout(e,0):wn.push(e))}function On(e){var t=e.tag,n=e.attributes,r=n===void 0?{}:n,i=e.children,a=i===void 0?[]:i;return typeof e==`string`?pn(e):`<${t} ${mn(r)}>${a.map(On).join(``)}`}function kn(e,t,n){if(e&&e[t]&&e[t][n])return{prefix:t,iconName:n,icon:e[t][n]}}var An=function(e,t){return function(n,r,i,a){return e.call(t,n,r,i,a)}},jn=function(e,t,n,r){var i=Object.keys(e),a=i.length,o=r===void 0?t:An(t,r),s,c,l;for(n===void 0?(s=1,l=e[i[0]]):(s=0,l=n);s2&&arguments[2]!==void 0?arguments[2]:{}).skipHooks,r=n!==void 0&&n,i=Nn(t);typeof H.hooks.addPack==`function`&&!r?H.hooks.addPack(e,Nn(t)):H.styles[e]=b(b({},H.styles[e]||{}),i),e===`fas`&&Pn(`fa`,t)}var Fn=H.styles,In=H.shims,Ln=Object.keys(Yt),Rn=Ln.reduce(function(e,t){return e[t]=Object.keys(Yt[t]),e},{}),zn=null,Bn={},Vn={},Hn={},Un={},Wn={};function Gn(e){return~nn.indexOf(e)}function Kn(e,t){var n=t.split(`-`),r=n[0],i=n.slice(1).join(`-`);return r===e&&i!==``&&!Gn(i)?i:null}var qn=function(){var e=function(e){return jn(Fn,function(t,n,r){return t[r]=jn(n,e,{}),t},{})};Bn=e(function(e,t,n){return t[3]&&(e[t[3]]=n),t[2]&&t[2].filter(function(e){return typeof e==`number`}).forEach(function(t){e[t.toString(16)]=n}),e}),Vn=e(function(e,t,n){return e[n]=n,t[2]&&t[2].filter(function(e){return typeof e==`string`}).forEach(function(t){e[t]=n}),e}),Wn=e(function(e,t,n){var r=t[2];return e[n]=n,r.forEach(function(t){e[t]=n}),e});var t=`far`in Fn||L.autoFetchSvg,n=jn(In,function(e,n){var r=n[0],i=n[1],a=n[2];return i===`far`&&!t&&(i=`fas`),typeof r==`string`&&(e.names[r]={prefix:i,iconName:a}),typeof r==`number`&&(e.unicodes[r.toString(16)]={prefix:i,iconName:a}),e},{names:{},unicodes:{}});Hn=n.names,Un=n.unicodes,zn=er(L.styleDefault,{family:L.familyDefault})};cn(function(e){zn=er(e.styleDefault,{family:L.familyDefault})}),qn();function Jn(e,t){return(Bn[e]||{})[t]}function Yn(e,t){return(Vn[e]||{})[t]}function U(e,t){return(Wn[e]||{})[t]}function Xn(e){return Hn[e]||{prefix:null,iconName:null}}function Zn(e){var t=Un[e],n=Jn(`fas`,e);return t||(n?{prefix:`fas`,iconName:n}:null)||{prefix:null,iconName:null}}function W(){return zn}var Qn=function(){return{prefix:null,iconName:null,rest:[]}};function $n(e){var t=M,n=Ln.reduce(function(e,t){return e[t]=`${L.cssPrefix}-${t}`,e},{});return st.forEach(function(r){(e.includes(n[r])||e.some(function(e){return Rn[r].includes(e)}))&&(t=r)}),t}function er(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).family,n=t===void 0?M:t,r=Gt[n][e];if(n===me&&!e)return`fad`;var i=qt[n][e]||qt[n][r],a=e in H.styles?e:null;return i||a||null}function tr(e){var t=[],n=null;return e.forEach(function(e){var r=Kn(L.cssPrefix,e);r?n=r:e&&t.push(e)}),{iconName:n,rest:t}}function nr(e){return e.sort().filter(function(e,t,n){return n.indexOf(e)===t})}var rr=Tt.concat(ft);function ir(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).skipLookups,n=t!==void 0&&t,r=null,i=nr(e.filter(function(e){return rr.includes(e)})),a=nr(e.filter(function(e){return!rr.includes(e)})),o=x(i.filter(function(e){return r=e,!pe.includes(e)}),1)[0],s=o===void 0?null:o,c=$n(i),l=b(b({},tr(a)),{},{prefix:er(s,{family:c})});return b(b(b({},l),cr({values:e,family:c,styles:Fn,config:L,canonical:l,givenPrefix:r})),ar(n,r,l))}function ar(e,t,n){var r=n.prefix,i=n.iconName;if(e||!r||!i)return{prefix:r,iconName:i};var a=t===`fa`?Xn(i):{},o=U(r,i);return i=a.iconName||o||i,r=a.prefix||r,r===`far`&&!Fn.far&&Fn.fas&&!L.autoFetchSvg&&(r=`fas`),{prefix:r,iconName:i}}var or=st.filter(function(e){return e!==M||e!==me}),sr=Object.keys(wt).filter(function(e){return e!==M}).map(function(e){return Object.keys(wt[e])}).flat();function cr(e){var t=e.values,n=e.family,r=e.canonical,i=e.givenPrefix,a=i===void 0?``:i,o=e.styles,s=o===void 0?{}:o,c=e.config,l=c===void 0?{}:c,u=n===me,d=t.includes(`fa-duotone`)||t.includes(`fad`),f=l.familyDefault===`duotone`,p=r.prefix===`fad`||r.prefix===`fa-duotone`;return!u&&(d||f||p)&&(r.prefix=`fad`),(t.includes(`fa-brands`)||t.includes(`fab`))&&(r.prefix=`fab`),!r.prefix&&or.includes(n)&&(Object.keys(s).find(function(e){return sr.includes(e)})||l.autoFetchSvg)&&(r.prefix=ut.get(n).defaultShortPrefixId,r.iconName=U(r.prefix,r.iconName)||r.iconName),(r.prefix===`fa`||a===`fa`)&&(r.prefix=W()||`fas`),r}var lr=function(){function e(){u(this,e),this.definitions={}}return f(e,[{key:`add`,value:function(){var e=this,t=[...arguments].reduce(this._pullDefinitions,{});Object.keys(t).forEach(function(n){e.definitions[n]=b(b({},e.definitions[n]||{}),t[n]),Pn(n,t[n]);var r=Yt[M][n];r&&Pn(r,t[n]),qn()})}},{key:`reset`,value:function(){this.definitions={}}},{key:`_pullDefinitions`,value:function(e,t){var n=t.prefix&&t.iconName&&t.icon?{0:t}:t;return Object.keys(n).map(function(t){var r=n[t],i=r.prefix,a=r.iconName,o=r.icon,s=o[2];e[i]||(e[i]={}),s.length>0&&s.forEach(function(t){typeof t==`string`&&(e[i][t]=o)}),e[i][a]=o}),e}}])}(),ur=[],G={},K={},dr=Object.keys(K);function fr(e,t){var n=t.mixoutsTo;return ur=e,G={},Object.keys(K).forEach(function(e){dr.indexOf(e)===-1&&delete K[e]}),ur.forEach(function(e){var t=e.mixout?e.mixout():{};if(Object.keys(t).forEach(function(e){typeof t[e]==`function`&&(n[e]=t[e]),C(t[e])===`object`&&Object.keys(t[e]).forEach(function(r){n[e]||(n[e]={}),n[e][r]=t[e][r]})}),e.hooks){var r=e.hooks();Object.keys(r).forEach(function(e){G[e]||(G[e]=[]),G[e].push(r[e])})}e.provides&&e.provides(K)}),n}function pr(e,t){var n=[...arguments].slice(2);return(G[e]||[]).forEach(function(e){t=e.apply(null,[t].concat(n))}),t}function q(e){var t=[...arguments].slice(1);(G[e]||[]).forEach(function(e){e.apply(null,t)})}function J(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return K[e]?K[e].apply(null,t):void 0}function mr(e){e.prefix===`fa`&&(e.prefix=`fas`);var t=e.iconName,n=e.prefix||W();if(t)return t=U(n,t)||t,kn(hr.definitions,n,t)||kn(H.styles,n,t)}var hr=new lr,Y={noAuto:function(){L.autoReplaceSvg=!1,L.observeMutations=!1,q(`noAuto`)},config:L,dom:{i2svg:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return j?(q(`beforeI2svg`,e),J(`pseudoElements2svg`,e),J(`i2svg`,e)):Promise.reject(Error(`Operation requires a DOM of some kind.`))},watch:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.autoReplaceSvgRoot;L.autoReplaceSvg===!1&&(L.autoReplaceSvg=!0),L.observeMutations=!0,Dn(function(){gr({autoReplaceSvgRoot:t}),q(`watch`,e)})}},parse:{icon:function(e){if(e===null)return null;if(C(e)===`object`&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:U(e.prefix,e.iconName)||e.iconName};if(Array.isArray(e)&&e.length===2){var t=e[1].indexOf(`fa-`)===0?e[1].slice(3):e[1],n=er(e[0]);return{prefix:n,iconName:U(n,t)||t}}if(typeof e==`string`&&(e.indexOf(`${L.cssPrefix}-`)>-1||e.match(Zt))){var r=ir(e.split(` `),{skipLookups:!0});return{prefix:r.prefix||W(),iconName:U(r.prefix,r.iconName)||r.iconName}}if(typeof e==`string`){var i=W();return{prefix:i,iconName:U(i,e)||e}}}},library:hr,findIconDefinition:mr,toHtml:On},gr=function(){var e=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).autoReplaceSvgRoot,t=e===void 0?k:e;(Object.keys(H.styles).length>0||L.autoFetchSvg)&&j&&L.autoReplaceSvg&&Y.dom.i2svg({node:t})};function _r(e,t){return Object.defineProperty(e,"abstract",{get:t}),Object.defineProperty(e,"html",{get:function(){return e.abstract.map(function(e){return On(e)})}}),Object.defineProperty(e,"node",{get:function(){if(j){var t=k.createElement(`div`);return t.innerHTML=e.html,t.children}}}),e}function vr(e){var t=e.children,n=e.main,r=e.mask,i=e.attributes,a=e.styles,o=e.transform;if(gn(o)&&n.found&&!r.found){var s={x:n.width/n.height/2,y:.5};i.style=hn(b(b({},a),{},{"transform-origin":`${s.x+o.x/16}em ${s.y+o.y/16}em`}))}return[{tag:`svg`,attributes:i,children:t}]}function yr(e){var t=e.prefix,n=e.iconName,r=e.children,i=e.attributes,a=e.symbol,o=a===!0?`${t}-${L.cssPrefix}-${n}`:a;return[{tag:`svg`,attributes:{style:`display: none;`},children:[{tag:`symbol`,attributes:b(b({},i),{},{id:o}),children:r}]}]}function br(e){return[`aria-label`,`aria-labelledby`,`title`,`role`].some(function(t){return t in e})}function xr(e){var t=e.icons,n=t.main,r=t.mask,i=e.prefix,a=e.iconName,o=e.transform,s=e.symbol,c=e.maskId,l=e.extra,u=e.watchable,d=u!==void 0&&u,f=r.found?r:n,p=f.width,m=f.height,h=[L.replacementClass,a?`${L.cssPrefix}-${a}`:``].filter(function(e){return l.classes.indexOf(e)===-1}).filter(function(e){return e!==``||!!e}).concat(l.classes).join(` `),g={children:[],attributes:b(b({},l.attributes),{},{"data-prefix":i,"data-icon":a,class:h,role:l.attributes.role||`img`,viewBox:`0 0 ${p} ${m}`})};!br(l.attributes)&&!l.attributes[`aria-hidden`]&&(g.attributes[`aria-hidden`]=`true`),d&&(g.attributes[P]=``);var _=b(b({},g),{},{prefix:i,iconName:a,main:n,mask:r,maskId:c,transform:o,symbol:s,styles:b({},l.styles)}),v=r.found&&n.found?J(`generateAbstractMask`,_)||{children:[],attributes:{}}:J(`generateAbstractIcon`,_)||{children:[],attributes:{}},y=v.children,x=v.attributes;return _.children=y,_.attributes=x,s?yr(_):vr(_)}function Sr(e){var t=e.content,n=e.width,r=e.height,i=e.transform,a=e.extra,o=e.watchable,s=o!==void 0&&o,c=b(b({},a.attributes),{},{class:a.classes.join(` `)});s&&(c[P]=``);var l=b({},a.styles);gn(i)&&(l.transform=vn({transform:i,startCentered:!0,width:n,height:r}),l[`-webkit-transform`]=l.transform);var u=hn(l);u.length>0&&(c.style=u);var d=[];return d.push({tag:`span`,attributes:c,children:[t]}),d}function Cr(e){var t=e.content,n=e.extra,r=b(b({},n.attributes),{},{class:n.classes.join(` `)}),i=hn(n.styles);i.length>0&&(r.style=i);var a=[];return a.push({tag:`span`,attributes:r,children:[t]}),a}var wr=H.styles;function Tr(e){var t=e[0],n=e[1],r=x(e.slice(4),1)[0],i=null;return i=Array.isArray(r)?{tag:`g`,attributes:{class:`${L.cssPrefix}-${tn.GROUP}`},children:[{tag:`path`,attributes:{class:`${L.cssPrefix}-${tn.SECONDARY}`,fill:`currentColor`,d:r[0]}},{tag:`path`,attributes:{class:`${L.cssPrefix}-${tn.PRIMARY}`,fill:`currentColor`,d:r[1]}}]}:{tag:`path`,attributes:{fill:`currentColor`,d:r}},{found:!0,width:t,height:n,icon:i}}var Er={found:!1,width:512,height:512};function Dr(e,t){!Ht&&!L.showMissingIcons&&e&&console.error(`Icon with name "${e}" and prefix "${t}" is missing.`)}function Or(e,t){var n=t;return t===`fa`&&L.styleDefault!==null&&(t=W()),new Promise(function(r,i){if(n===`fa`){var a=Xn(e)||{};e=a.iconName||e,t=a.prefix||t}if(e&&t&&wr[t]&&wr[t][e]){var o=wr[t][e];return r(Tr(o))}Dr(e,t),r(b(b({},Er),{},{icon:L.showMissingIcons&&e&&J(`missingIconAbstract`)||{}}))})}var kr=function(){},Ar=L.measurePerformance&&A&&A.mark&&A.measure?A:{mark:kr,measure:kr},jr=`FA "7.3.1"`,Mr=function(e){return Ar.mark(`${jr} ${e} begins`),function(){return Nr(e)}},Nr=function(e){Ar.mark(`${jr} ${e} ends`),Ar.measure(`${jr} ${e}`,`${jr} ${e} begins`,`${jr} ${e} ends`)},Pr={begin:Mr,end:Nr},Fr=function(){};function Ir(e){return typeof(e.getAttribute?e.getAttribute(P):null)==`string`}function Lr(e){var t=e.getAttribute?e.getAttribute(It):null,n=e.getAttribute?e.getAttribute(Lt):null;return t&&n}function Rr(e){return e&&e.classList&&e.classList.contains&&e.classList.contains(L.replacementClass)}function zr(){return L.autoReplaceSvg===!0?Wr.replace:Wr[L.autoReplaceSvg]||Wr.replace}function Br(e){return k.createElementNS(`http://www.w3.org/2000/svg`,e)}function Vr(e){return k.createElement(e)}function Hr(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).ceFn,n=t===void 0?e.tag===`svg`?Br:Vr:t;if(typeof e==`string`)return k.createTextNode(e);var r=n(e.tag);return Object.keys(e.attributes||[]).forEach(function(t){r.setAttribute(t,e.attributes[t])}),(e.children||[]).forEach(function(e){r.appendChild(Hr(e,{ceFn:n}))}),r}function Ur(e){var t=` ${e.outerHTML} `;return t=`${t}Font Awesome fontawesome.com `,t}var Wr={replace:function(e){var t=e[0];if(t.parentNode){if(e[1].forEach(function(e){t.parentNode.insertBefore(Hr(e),t)}),t.getAttribute(P)===null&&L.keepOriginalSource){var n=k.createComment(Ur(t));t.parentNode.replaceChild(n,t)}else t.remove()}},nest:function(e){var t=e[0],n=e[1];if(~fn(t).indexOf(L.replacementClass))return Wr.replace(e);var r=RegExp(`${L.cssPrefix}-.*`);if(delete n[0].attributes.id,n[0].attributes.class){var i=n[0].attributes.class.split(` `).reduce(function(e,t){return t===L.replacementClass||t.match(r)?e.toSvg.push(t):e.toNode.push(t),e},{toNode:[],toSvg:[]});n[0].attributes.class=i.toSvg.join(` `),i.toNode.length===0?t.removeAttribute(`class`):t.setAttribute(`class`,i.toNode.join(` `))}var a=n.map(function(e){return On(e)}).join(` +`);t.setAttribute(P,``),t.innerHTML=a}};function Gr(e){e()}function Kr(e,t){var n=typeof t==`function`?t:Fr;if(e.length===0)n();else{var r=Gr;L.mutateApproach===zt&&(r=O.requestAnimationFrame||Gr),r(function(){var t=zr(),r=Pr.begin(`mutate`);e.map(t),r(),n()})}}var qr=!1;function Jr(){qr=!0}function Yr(){qr=!1}var Xr=null;function Zr(e){if(oe&&L.observeMutations){var t=e.treeCallback,n=t===void 0?Fr:t,r=e.nodeCallback,i=r===void 0?Fr:r,a=e.pseudoElementsCallback,o=a===void 0?Fr:a,s=e.observeMutationsRoot,c=s===void 0?k:s;Xr=new oe(function(e){if(!qr){var t=W();B(e).forEach(function(e){if(e.type===`childList`&&e.addedNodes.length>0&&!Ir(e.addedNodes[0])&&(L.searchPseudoElements&&o(e.target),n(e.target)),e.type===`attributes`&&e.target.parentNode&&L.searchPseudoElements&&o([e.target],!0),e.type===`attributes`&&Ir(e.target)&&~en.indexOf(e.attributeName)){if(e.attributeName===`class`&&Lr(e.target)){var r=ir(fn(e.target)),a=r.prefix,s=r.iconName;e.target.setAttribute(It,a||t),s&&e.target.setAttribute(Lt,s)}else Rr(e.target)&&i(e.target)}})}}),j&&Xr.observe(c,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}}function Qr(){Xr&&Xr.disconnect()}function $r(e){var t=e.getAttribute(`style`),n=[];return t&&(n=t.split(`;`).reduce(function(e,t){var n=t.split(`:`),r=n[0],i=n.slice(1);return r&&i.length>0&&(e[r]=i.join(`:`).trim()),e},{})),n}function ei(e){var t=e.getAttribute(`data-prefix`),n=e.getAttribute(`data-icon`),r=e.innerText===void 0?``:e.innerText.trim(),i=ir(fn(e));return i.prefix||=W(),t&&n&&(i.prefix=t,i.iconName=n),i.iconName&&i.prefix?i:(i.prefix&&r.length>0&&(i.iconName=Yn(i.prefix,e.innerText)||Jn(i.prefix,Mn(e.innerText))),!i.iconName&&L.autoFetchSvg&&e.firstChild&&e.firstChild.nodeType===Node.TEXT_NODE&&(i.iconName=e.firstChild.data),i)}function ti(e){return B(e.attributes).reduce(function(e,t){return e.name!==`class`&&e.name!==`style`&&(e[t.name]=t.value),e},{})}function ni(){return{iconName:null,prefix:null,transform:z,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function ri(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0},n=ei(e),r=n.iconName,i=n.prefix,a=n.rest,o=ti(e),s=pr(`parseNodeAttributes`,{},e);return b({iconName:r,prefix:i,transform:z,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:a,styles:t.styleParser?$r(e):[],attributes:o}},s)}var ii=H.styles;function ai(e){var t=L.autoReplaceSvg===`nest`?ri(e,{styleParser:!1}):ri(e);return~t.extra.classes.indexOf(Qt)?J(`generateLayersText`,e,t):J(`generateSvgReplacementMutation`,e,t)}function oi(){return[].concat(S(ft),S(Tt))}function si(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!j)return Promise.resolve();var n=k.documentElement.classList,r=function(e){return n.add(`${Rt}-${e}`)},i=function(e){return n.remove(`${Rt}-${e}`)},a=L.autoFetchSvg?oi():pe.concat(Object.keys(ii));a.includes(`fa`)||a.push(`fa`);var o=[`.${Qt}:not([${P}])`].concat(a.map(function(e){return`.${e}:not([${P}])`})).join(`, `);if(o.length===0)return Promise.resolve();var s=[];try{s=B(e.querySelectorAll(o))}catch{}if(s.length>0)r(`pending`),i(`complete`);else return Promise.resolve();var c=Pr.begin(`onTree`),l=s.reduce(function(e,t){try{var n=ai(t);n&&e.push(n)}catch(e){Ht||e.name===`MissingIcon`&&console.error(e)}return e},[]);return new Promise(function(e,n){Promise.all(l).then(function(n){Kr(n,function(){r(`active`),r(`complete`),i(`pending`),typeof t==`function`&&t(),c(),e()})}).catch(function(e){c(),n(e)})})}function ci(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;ai(e).then(function(e){e&&Kr([e],t)})}function li(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=(t||{}).icon?t:mr(t||{}),i=n.mask;return i&&=(i||{}).icon?i:mr(i||{}),e(r,b(b({},n),{},{mask:i}))}}var ui=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.transform,r=n===void 0?z:n,i=t.symbol,a=i!==void 0&&i,o=t.mask,s=o===void 0?null:o,c=t.maskId,l=c===void 0?null:c,u=t.classes,d=u===void 0?[]:u,f=t.attributes,p=f===void 0?{}:f,m=t.styles,h=m===void 0?{}:m;if(e){var g=e.prefix,_=e.iconName,v=e.icon;return _r(b({type:`icon`},e),function(){return q(`beforeDOMElementCreation`,{iconDefinition:e,params:t}),xr({icons:{main:Tr(v),mask:s?Tr(s.icon):{found:!1,width:null,height:null,icon:{}}},prefix:g,iconName:_,transform:b(b({},z),r),symbol:a,maskId:l,extra:{attributes:p,styles:h,classes:d}})})}},di={mixout:function(){return{icon:li(ui)}},hooks:function(){return{mutationObserverCallbacks:function(e){return e.treeCallback=si,e.nodeCallback=ci,e}}},provides:function(e){e.i2svg=function(e){var t=e.node,n=t===void 0?k:t,r=e.callback;return si(n,r===void 0?function(){}:r)},e.generateSvgReplacementMutation=function(e,t){var n=t.iconName,r=t.prefix,i=t.transform,a=t.symbol,o=t.mask,s=t.maskId,c=t.extra;return new Promise(function(t,l){Promise.all([Or(n,r),o.iconName?Or(o.iconName,o.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(function(o){var l=x(o,2),u=l[0],d=l[1];t([e,xr({icons:{main:u,mask:d},prefix:r,iconName:n,transform:i,symbol:a,maskId:s,extra:c,watchable:!0})])}).catch(l)})},e.generateAbstractIcon=function(e){var t=e.children,n=e.attributes,r=e.main,i=e.transform,a=e.styles,o=hn(a);o.length>0&&(n.style=o);var s;return gn(i)&&(s=J(`generateAbstractTransformGrouping`,{main:r,transform:i,containerWidth:r.width,iconWidth:r.width})),t.push(s||r.icon),{children:t,attributes:n}}}},fi={mixout:function(){return{layer:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.classes,r=n===void 0?[]:n;return _r({type:`layer`},function(){q(`beforeDOMElementCreation`,{assembler:e,params:t});var n=[];return e(function(e){Array.isArray(e)?e.map(function(e){n=n.concat(e.abstract)}):n=n.concat(e.abstract)}),[{tag:`span`,attributes:{class:[`${L.cssPrefix}-layers`].concat(S(r)).join(` `)},children:n}]})}}}},pi={mixout:function(){return{counter:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.title,r=n===void 0?null:n,i=t.classes,a=i===void 0?[]:i,o=t.attributes,s=o===void 0?{}:o,c=t.styles,l=c===void 0?{}:c;return _r({type:`counter`,content:e},function(){return q(`beforeDOMElementCreation`,{content:e,params:t}),Cr({content:e.toString(),title:r,extra:{attributes:s,styles:l,classes:[`${L.cssPrefix}-layers-counter`].concat(S(a))}})})}}}},mi={mixout:function(){return{text:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.transform,r=n===void 0?z:n,i=t.classes,a=i===void 0?[]:i,o=t.attributes,s=o===void 0?{}:o,c=t.styles,l=c===void 0?{}:c;return _r({type:`text`,content:e},function(){return q(`beforeDOMElementCreation`,{content:e,params:t}),Sr({content:e,transform:b(b({},z),r),extra:{attributes:s,styles:l,classes:[`${L.cssPrefix}-layers-text`].concat(S(a))}})})}}},provides:function(e){e.generateLayersText=function(e,t){var n=t.transform,r=t.extra,i=null,a=null;if(se){var o=parseInt(getComputedStyle(e).fontSize,10),s=e.getBoundingClientRect();i=s.width/o,a=s.height/o}return Promise.resolve([e,Sr({content:e.innerHTML,width:i,height:a,transform:n,extra:r,watchable:!0})])}}},hi=RegExp(`"`,`ug`),gi=[1105920,1112319],_i=b(b(b(b({},{FontAwesome:{normal:`fas`,400:`fas`}}),lt),At),gt),vi=Object.keys(_i).reduce(function(e,t){return e[t.toLowerCase()]=_i[t],e},{}),yi=Object.keys(vi).reduce(function(e,t){var n=vi[t];return e[t]=n[900]||S(Object.entries(n))[0][1],e},{});function bi(e){return Mn(S(e.replace(hi,``))[0]||``)}function xi(e){var t=e.getPropertyValue(`font-feature-settings`).includes(`ss01`),n=e.getPropertyValue(`content`).replace(hi,``),r=n.codePointAt(0),i=r>=gi[0]&&r<=gi[1],a=n.length===2&&n[0]===n[1];return i||a||t}function Si(e,t){var n=e.replace(/^['"]|['"]$/g,``).toLowerCase(),r=parseInt(t),i=isNaN(r)?`normal`:r;return(vi[n]||{})[i]||yi[n]}function Ci(e,t){var n=`${Ft}${t.replace(`:`,`-`)}`;return new Promise(function(r,i){if(e.getAttribute(n)!==null)return r();var a=B(e.children).filter(function(e){return e.getAttribute(Pt)===t})[0],o=O.getComputedStyle(e,t),s=o.getPropertyValue(`font-family`),c=s.match($t),l=o.getPropertyValue(`font-weight`),u=o.getPropertyValue(`content`);if(a&&!c)return e.removeChild(a),r();if(c&&u!==`none`&&u!==``){var d=o.getPropertyValue(`content`),f=Si(s,l),p=bi(d),m=c[0].startsWith(`FontAwesome`),h=xi(o),g=Jn(f,p),_=g;if(m){var v=Zn(p);v.iconName&&v.prefix&&(g=v.iconName,f=v.prefix)}if(g&&!h&&(!a||a.getAttribute(It)!==f||a.getAttribute(Lt)!==_)){e.setAttribute(n,_),a&&e.removeChild(a);var y=ni(),x=y.extra;x.attributes[Pt]=t,Or(g,f).then(function(i){var a=xr(b(b({},y),{},{icons:{main:i,mask:Qn()},prefix:f,iconName:_,extra:x,watchable:!0})),o=k.createElementNS(`http://www.w3.org/2000/svg`,`svg`);t===`::before`?e.insertBefore(o,e.firstChild):e.appendChild(o),o.outerHTML=a.map(function(e){return On(e)}).join(` +`),e.removeAttribute(n),r()}).catch(i)}else r()}else r()})}function wi(e){return Promise.all([Ci(e,`::before`),Ci(e,`::after`)])}function Ti(e){return e.parentNode!==document.head&&!~Bt.indexOf(e.tagName.toUpperCase())&&!e.getAttribute(Pt)&&(!e.parentNode||e.parentNode.tagName!==`svg`)}var Ei=function(e){return!!e&&Vt.some(function(t){return e.includes(t)})},Di=function(e){if(!e)return[];var t=new Set,n=e.split(/,(?![^()]*\))/).map(function(e){return e.trim()});n=n.flatMap(function(e){return e.includes(`(`)?e:e.split(`,`).map(function(e){return e.trim()})});var r=p(n),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;if(Ei(a)){var o=Vt.reduce(function(e,t){return e.replace(t,``)},a);o!==``&&o!==`*`&&t.add(o)}}}catch(e){r.e(e)}finally{r.f()}return t};function Oi(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(j){var n;if(t)n=e;else if(L.searchPseudoElementsFullScan)n=e.querySelectorAll(`*`);else{var r=new Set,i=p(document.styleSheets),a;try{for(i.s();!(a=i.n()).done;){var o=a.value;try{var s=p(o.cssRules),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=p(Di(l.selectorText)),d;try{for(u.s();!(d=u.n()).done;){var f=d.value;r.add(f)}}catch(e){u.e(e)}finally{u.f()}}}catch(e){s.e(e)}finally{s.f()}}catch(e){L.searchPseudoElementsWarnings&&console.warn(`Font Awesome: cannot parse stylesheet: ${o.href} (${e.message}) +If it declares any Font Awesome CSS pseudo-elements, they will not be rendered as SVG icons. Add crossorigin="anonymous" to the , enable searchPseudoElementsFullScan for slower but more thorough DOM parsing, or suppress this warning by setting searchPseudoElementsWarnings to false.`)}}}catch(e){i.e(e)}finally{i.f()}if(!r.size)return;var m=Array.from(r).join(`, `);try{n=e.querySelectorAll(m)}catch{}}return new Promise(function(e,t){var r=B(n).filter(Ti).map(wi),i=Pr.begin(`searchPseudoElements`);Jr(),Promise.all(r).then(function(){i(),Yr(),e()}).catch(function(){i(),Yr(),t()})})}}var ki={hooks:function(){return{mutationObserverCallbacks:function(e){return e.pseudoElementsCallback=Oi,e}}},provides:function(e){e.pseudoElements2svg=function(e){var t=e.node,n=t===void 0?k:t;L.searchPseudoElements&&Oi(n)}}},Ai=!1,ji={mixout:function(){return{dom:{unwatch:function(){Jr(),Ai=!0}}}},hooks:function(){return{bootstrap:function(){Zr(pr(`mutationObserverCallbacks`,{}))},noAuto:function(){Qr()},watch:function(e){var t=e.observeMutationsRoot;Ai?Yr():Zr(pr(`mutationObserverCallbacks`,{observeMutationsRoot:t}))}}}},Mi=function(e){return e.toLowerCase().split(` `).reduce(function(e,t){var n=t.toLowerCase().split(`-`),r=n[0],i=n.slice(1).join(`-`);if(r&&i===`h`)return e.flipX=!0,e;if(r&&i===`v`)return e.flipY=!0,e;if(i=parseFloat(i),isNaN(i))return e;switch(r){case`grow`:e.size+=i;break;case`shrink`:e.size-=i;break;case`left`:e.x-=i;break;case`right`:e.x+=i;break;case`up`:e.y-=i;break;case`down`:e.y+=i;break;case`rotate`:e.rotate+=i}return e},{size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0})},Ni={mixout:function(){return{parse:{transform:function(e){return Mi(e)}}}},hooks:function(){return{parseNodeAttributes:function(e,t){var n=t.getAttribute(`data-fa-transform`);return n&&(e.transform=Mi(n)),e}}},provides:function(e){e.generateAbstractTransformGrouping=function(e){var t=e.main,n=e.transform,r=e.containerWidth,i=e.iconWidth,a={outer:{transform:`translate(${r/2} 256)`},inner:{transform:`${`translate(${n.x*32}, ${n.y*32}) `} ${`scale(${n.size/16*(n.flipX?-1:1)}, ${n.size/16*(n.flipY?-1:1)}) `} ${`rotate(${n.rotate} 0 0)`}`},path:{transform:`translate(${i/2*-1} -256)`}};return{tag:`g`,attributes:b({},a.outer),children:[{tag:`g`,attributes:b({},a.inner),children:[{tag:t.icon.tag,children:t.icon.children,attributes:b(b({},t.icon.attributes),a.path)}]}]}}}},Pi={x:0,y:0,width:`100%`,height:`100%`};function Fi(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return e.attributes&&(e.attributes.fill||t)&&(e.attributes.fill=`black`),e}function Ii(e){return e.tag===`g`?e.children:[e]}fr([Cn,di,fi,pi,mi,ki,ji,Ni,{hooks:function(){return{parseNodeAttributes:function(e,t){var n=t.getAttribute(`data-fa-mask`),r=n?ir(n.split(` `).map(function(e){return e.trim()})):Qn();return r.prefix||=W(),e.mask=r,e.maskId=t.getAttribute(`data-fa-mask-id`),e}}},provides:function(e){e.generateAbstractMask=function(e){var t=e.children,n=e.attributes,r=e.main,i=e.mask,a=e.maskId,o=e.transform,s=r.width,c=r.icon,l=i.width,u=i.icon,d=_n({transform:o,containerWidth:l,iconWidth:s}),f={tag:`rect`,attributes:b(b({},Pi),{},{fill:`white`})},p=c.children?{children:c.children.map(Fi)}:{},m={tag:`g`,attributes:b({},d.inner),children:[Fi(b({tag:c.tag,attributes:b(b({},c.attributes),d.path)},p))]},h={tag:`g`,attributes:b({},d.outer),children:[m]},g=`mask-${a||dn()}`,_=`clip-${a||dn()}`,v={tag:`mask`,attributes:b(b({},Pi),{},{id:g,maskUnits:`userSpaceOnUse`,maskContentUnits:`userSpaceOnUse`}),children:[f,h]},y={tag:`defs`,children:[{tag:`clipPath`,attributes:{id:_},children:Ii(u)},v]};return t.push(y,{tag:`rect`,attributes:b({fill:`currentColor`,"clip-path":`url(#${_})`,mask:`url(#${g})`},Pi)}),{children:t,attributes:n}}}},{provides:function(e){var t=!1;O.matchMedia&&(t=O.matchMedia(`(prefers-reduced-motion: reduce)`).matches),e.missingIconAbstract=function(){var e=[],n={fill:`currentColor`},r={attributeType:`XML`,repeatCount:`indefinite`,dur:`2s`};e.push({tag:`path`,attributes:b(b({},n),{},{d:`M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z`})});var i=b(b({},r),{},{attributeName:`opacity`}),a={tag:`circle`,attributes:b(b({},n),{},{cx:`256`,cy:`364`,r:`28`}),children:[]};return t||a.children.push({tag:`animate`,attributes:b(b({},r),{},{attributeName:`r`,values:`28;14;28;28;14;28;`})},{tag:`animate`,attributes:b(b({},i),{},{values:`1;0;1;1;0;1;`})}),e.push(a),e.push({tag:`path`,attributes:b(b({},n),{},{opacity:`1`,d:`M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z`}),children:t?[]:[{tag:`animate`,attributes:b(b({},i),{},{values:`1;0;0;0;0;1;`})}]}),t||e.push({tag:`path`,attributes:b(b({},n),{},{opacity:`0`,d:`M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z`}),children:[{tag:`animate`,attributes:b(b({},i),{},{values:`0;0;1;1;0;0;`})}]}),{tag:`g`,attributes:{class:`missing`},children:e}}}},{hooks:function(){return{parseNodeAttributes:function(e,t){var n=t.getAttribute(`data-fa-symbol`);return e.symbol=n===null?!1:n===``||n,e}}}}],{mixoutsTo:Y}),Y.noAuto;var X=Y.config;Y.library,Y.dom;var Li=Y.parse;Y.findIconDefinition,Y.toHtml;var Ri=Y.icon;Y.layer,Y.text,Y.counter,a();function zi(e){return e-=0,e===e}function Bi(e){return zi(e)?e:(e=e.replace(/[_-]+(.)?/g,(e,t)=>t?t.toUpperCase():``),e.charAt(0).toLowerCase()+e.slice(1))}var Vi=(e,t)=>o.createElement(`stop`,{key:`${t}-${e.offset}`,offset:e.offset,stopColor:e.color,...e.opacity!==void 0&&{stopOpacity:e.opacity}});function Hi(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Z=new Map,Ui=1e3;function Wi(e){if(Z.has(e))return Z.get(e);let t={},n=0,r=e.length;for(;n0){let n=o.slice(0,e).trim(),r=o.slice(e+1).trim();if(n&&r){let e=Bi(n);t[e.startsWith(`webkit`)?Hi(e):e]=r}}}n=a+1}if(Z.size===Ui){let e=Z.keys().next().value;e&&Z.delete(e)}return Z.set(e,t),t}function Gi(e,t,n={}){if(typeof t==`string`)return t;let r=(t.children||[]).map(t=>{let r=t;return(`fill`in n||n.gradientFill)&&t.tag===`path`&&`fill`in t.attributes&&(r={...t,attributes:{...t.attributes,fill:void 0}}),Gi(e,r)}),i=t.attributes||{},a={};for(let[e,t]of Object.entries(i))switch(!0){case e===`class`:a.className=t;break;case e===`style`:a.style=Wi(String(t));break;case e.startsWith(`aria-`):case e.startsWith(`data-`):a[e.toLowerCase()]=t;break;default:a[Bi(e)]=t}let{style:o,role:s,"aria-label":c,gradientFill:l,...u}=n;if(o&&(a.style=a.style?{...a.style,...o}:o),s&&(a.role=s),c&&(a[`aria-label`]=c,a[`aria-hidden`]=`false`),l){a.fill=`url(#${l.id})`;let{type:t,stops:n=[],...i}=l;r.unshift(e(t===`linear`?`linearGradient`:`radialGradient`,{...i,id:l.id},n.map(Vi)))}return e(t.tag,{...a,...u},...r)}var Ki=Gi.bind(null,o.createElement),qi=(e,t)=>{let n=(0,o.useId)();return e||(t?n:void 0)},Ji=class{constructor(e=`react-fontawesome`){this.enabled=!1;let t=!1;try{t=typeof process<`u`&&!1}catch{}this.scope=e,this.enabled=t}log(...e){this.enabled&&console.log(`[${this.scope}]`,...e)}warn(...e){this.enabled&&console.warn(`[${this.scope}]`,...e)}error(...e){this.enabled&&console.error(`[${this.scope}]`,...e)}};typeof process<`u`&&{}.FA_VERSION;var Yi=`searchPseudoElementsFullScan`in X&&typeof X.searchPseudoElementsFullScan==`boolean`?`7.0.0`:`6.0.0`,Xi=Number.parseInt(Yi)>=7,Zi=()=>Xi,Qi=`fa`,Q={beat:`fa-beat`,fade:`fa-fade`,beatFade:`fa-beat-fade`,bounce:`fa-bounce`,shake:`fa-shake`,spin:`fa-spin`,spinPulse:`fa-spin-pulse`,spinReverse:`fa-spin-reverse`,pulse:`fa-pulse`,flip360:`fa-flip-360`,buzz:`fa-buzz`,float:`fa-float`,jello:`fa-jello`,spinSnap:`fa-spin-snap`,spinSnap4:`fa-spin-snap-4`,spinSnap8:`fa-spin-snap-8`,swing:`fa-swing`,wag:`fa-wag`},$i={left:`fa-pull-left`,right:`fa-pull-right`},ea={90:`fa-rotate-90`,180:`fa-rotate-180`,270:`fa-rotate-270`},ta={"2xs":`fa-2xs`,xs:`fa-xs`,sm:`fa-sm`,lg:`fa-lg`,xl:`fa-xl`,"2xl":`fa-2xl`,"1x":`fa-1x`,"2x":`fa-2x`,"3x":`fa-3x`,"4x":`fa-4x`,"5x":`fa-5x`,"6x":`fa-6x`,"7x":`fa-7x`,"8x":`fa-8x`,"9x":`fa-9x`,"10x":`fa-10x`},$={border:`fa-border`,fixedWidth:`fa-fw`,flip:`fa-flip`,flipHorizontal:`fa-flip-horizontal`,flipVertical:`fa-flip-vertical`,inverse:`fa-inverse`,rotateBy:`fa-rotate-by`,swapOpacity:`fa-swap-opacity`,widthAuto:`fa-width-auto`,canvasSquare:`fa-canvas-square`,canvasRoomy:`fa-canvas-roomy`},na={default:`fa-layers`};function ra(e){let t=X.cssPrefix||X.familyPrefix||Qi;return t===Qi?e:e.replace(new RegExp(String.raw`(?<=^|\s)${Qi}-`,`g`),`${t}-`)}function ia(e){let{beat:t,fade:n,beatFade:r,bounce:i,shake:a,spin:o,spinPulse:s,spinReverse:c,pulse:l,fixedWidth:u,inverse:d,border:f,flip:p,size:m,rotation:h,pull:g,swapOpacity:_,rotateBy:v,widthAuto:y,canvasSquare:b,canvasRoomy:x,flip360:S,buzz:ee,float:te,jello:C,spinSnap:ne,spinSnap4:w,spinSnap8:re,swing:ie,wag:T,className:E}=e,D=[];return E&&D.push(...E.split(` `)),t&&D.push(Q.beat),n&&D.push(Q.fade),r&&D.push(Q.beatFade),i&&D.push(Q.bounce),a&&D.push(Q.shake),o&&D.push(Q.spin),c&&D.push(Q.spinReverse),s&&D.push(Q.spinPulse),l&&D.push(Q.pulse),u&&D.push($.fixedWidth),d&&D.push($.inverse),f&&D.push($.border),p===!0&&D.push($.flip),(p===`horizontal`||p===`both`)&&D.push($.flipHorizontal),(p===`vertical`||p===`both`)&&D.push($.flipVertical),m!=null&&D.push(ta[m]),h!=null&&h!==0&&D.push(ea[h]),g!=null&&D.push($i[g]),_&&D.push($.swapOpacity),Zi()?(v&&D.push($.rotateBy),y&&D.push($.widthAuto),b&&D.push($.canvasSquare),x&&D.push($.canvasRoomy),S&&D.push(Q.flip360),ee&&D.push(Q.buzz),te&&D.push(Q.float),C&&D.push(Q.jello),ne&&D.push(Q.spinSnap),w&&D.push(Q.spinSnap4),re&&D.push(Q.spinSnap8),ie&&D.push(Q.swing),T&&D.push(Q.wag),(X.cssPrefix||X.familyPrefix||Qi)===Qi?D:D.map(ra)):D}var aa=e=>typeof e==`object`&&`icon`in e&&!!e.icon;function oa(e){if(e)return aa(e)?e:Li.icon(e)}function sa(e){return Object.keys(e)}var ca=new Ji(`FontAwesomeIcon`),la={border:!1,className:``,mask:void 0,maskId:void 0,fixedWidth:!1,inverse:!1,flip:!1,icon:void 0,listItem:!1,pull:void 0,pulse:!1,rotation:void 0,rotateBy:!1,size:void 0,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:``,titleId:void 0,transform:void 0,swapOpacity:!1,widthAuto:!1,canvasSquare:!1,canvasRoomy:!1,flip360:!1,buzz:!1,float:!1,jello:!1,spinSnap:!1,spinSnap4:!1,spinSnap8:!1,swing:!1,wag:!1},ua=new Set(Object.keys(la)),da=o.forwardRef((e,t)=>{let n={...la,...e},{icon:r,mask:i,symbol:a,title:o,titleId:s,maskId:c,transform:l}=n,u=qi(c,!!i),d=qi(s,!!o),f=oa(r);if(!f)return ca.error(`Icon lookup is undefined`,r),null;let p=ia(n),m=typeof l==`string`?Li.transform(l):l,h=oa(i),g=Ri(f,{...p.length>0&&{classes:p},...m&&{transform:m},...h&&{mask:h},symbol:a,title:o,titleId:d,maskId:u});if(!g)return ca.error(`Could not find icon`,f),null;let{abstract:_}=g,v={ref:t};for(let e of sa(n))ua.has(e)||(v[e]=n[e]);return Ki(_[0],v)});da.displayName=`FontAwesomeIcon`,`${na.default}${$.fixedWidth}`;var fa={prefix:`fas`,iconName:`ellipsis`,icon:[448,512,[`ellipsis-h`],`f141`,`M0 256a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm168 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm224-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z`]},pa={prefix:`fas`,iconName:`floppy-disk`,icon:[448,512,[128190,128426,`save`],`f0c7`,`M64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-242.7c0-17-6.7-33.3-18.7-45.3L352 50.7C340 38.7 323.7 32 306.7 32L64 32zm32 96c0-17.7 14.3-32 32-32l160 0c17.7 0 32 14.3 32 32l0 64c0 17.7-14.3 32-32 32l-160 0c-17.7 0-32-14.3-32-32l0-64zM224 288a64 64 0 1 1 0 128 64 64 0 1 1 0-128z`]},ma={prefix:`fas`,iconName:`flask`,icon:[448,512,[],`f0c3`,`M288 0L128 0C110.3 0 96 14.3 96 32s14.3 32 32 32L128 215.5 7.5 426.3C2.6 435 0 444.7 0 454.7 0 486.4 25.6 512 57.3 512l333.4 0c31.6 0 57.3-25.6 57.3-57.3 0-10-2.6-19.8-7.5-28.4L320 215.5 320 64c17.7 0 32-14.3 32-32S337.7 0 320 0L288 0zM192 215.5l0-151.5 64 0 0 151.5c0 11.1 2.9 22.1 8.4 31.8l41.6 72.7-164 0 41.6-72.7c5.5-9.7 8.4-20.6 8.4-31.8z`]},ha={prefix:`fas`,iconName:`diagram-project`,icon:[512,512,[`project-diagram`],`f542`,`M0 80C0 53.5 21.5 32 48 32l96 0c26.5 0 48 21.5 48 48l0 16 128 0 0-16c0-26.5 21.5-48 48-48l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-16-128 0 0 16c0 7.3-1.7 14.3-4.6 20.5l68.6 91.5 80 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96c0-7.3 1.7-14.3 4.6-20.5L128 224 48 224c-26.5 0-48-21.5-48-48L0 80z`]},ga={prefix:`fas`,iconName:`folder`,icon:[512,512,[128193,128447,61716,`folder-blank`],`f07b`,`M64 448l384 0c35.3 0 64-28.7 64-64l0-240c0-35.3-28.7-64-64-64L298.7 80c-6.9 0-13.7-2.2-19.2-6.4L241.1 44.8C230 36.5 216.5 32 202.7 32L64 32C28.7 32 0 60.7 0 96L0 384c0 35.3 28.7 64 64 64z`]},_a={prefix:`fas`,iconName:`gear`,icon:[512,512,[9881,`cog`],`f013`,`M195.1 9.5C198.1-5.3 211.2-16 226.4-16l59.8 0c15.2 0 28.3 10.7 31.3 25.5L332 79.5c14.1 6 27.3 13.7 39.3 22.8l67.8-22.5c14.4-4.8 30.2 1.2 37.8 14.4l29.9 51.8c7.6 13.2 4.9 29.8-6.5 39.9L447 233.3c.9 7.4 1.3 15 1.3 22.7s-.5 15.3-1.3 22.7l53.4 47.5c11.4 10.1 14 26.8 6.5 39.9l-29.9 51.8c-7.6 13.1-23.4 19.2-37.8 14.4l-67.8-22.5c-12.1 9.1-25.3 16.7-39.3 22.8l-14.4 69.9c-3.1 14.9-16.2 25.5-31.3 25.5l-59.8 0c-15.2 0-28.3-10.7-31.3-25.5l-14.4-69.9c-14.1-6-27.2-13.7-39.3-22.8L73.5 432.3c-14.4 4.8-30.2-1.2-37.8-14.4L5.8 366.1c-7.6-13.2-4.9-29.8 6.5-39.9l53.4-47.5c-.9-7.4-1.3-15-1.3-22.7s.5-15.3 1.3-22.7L12.3 185.8c-11.4-10.1-14-26.8-6.5-39.9L35.7 94.1c7.6-13.2 23.4-19.2 37.8-14.4l67.8 22.5c12.1-9.1 25.3-16.7 39.3-22.8L195.1 9.5zM256.3 336a80 80 0 1 0 -.6-160 80 80 0 1 0 .6 160z`]},va={prefix:`fas`,iconName:`play`,icon:[448,512,[9654],`f04b`,`M91.2 36.9c-12.4-6.8-27.4-6.5-39.6 .7S32 57.9 32 72l0 368c0 14.1 7.5 27.2 19.6 34.4s27.2 7.5 39.6 .7l336-184c12.8-7 20.8-20.5 20.8-35.1s-8-28.1-20.8-35.1l-336-184z`]},ya={prefix:`fas`,iconName:`check`,icon:[448,512,[10003,10004],`f00c`,`M434.8 70.1c14.3 10.4 17.5 30.4 7.1 44.7l-256 352c-5.5 7.6-14 12.3-23.4 13.1s-18.5-2.7-25.1-9.3l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l101.5 101.5 234-321.7c10.4-14.3 30.4-17.5 44.7-7.1z`]},ba={prefix:`fas`,iconName:`chevron-down`,icon:[448,512,[],`f078`,`M201.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 338.7 54.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z`]},xa={prefix:`fas`,iconName:`window-maximize`,icon:[512,512,[128470],`f2d0`,`M64 64C28.7 64 0 92.7 0 128L0 384c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64L64 64zm24 64l336 0c13.3 0 24 10.7 24 24s-10.7 24-24 24L88 176c-13.3 0-24-10.7-24-24s10.7-24 24-24z`]},Sa={prefix:`fas`,iconName:`pause`,icon:[384,512,[9208],`f04c`,`M48 32C21.5 32 0 53.5 0 80L0 432c0 26.5 21.5 48 48 48l64 0c26.5 0 48-21.5 48-48l0-352c0-26.5-21.5-48-48-48L48 32zm224 0c-26.5 0-48 21.5-48 48l0 352c0 26.5 21.5 48 48 48l64 0c26.5 0 48-21.5 48-48l0-352c0-26.5-21.5-48-48-48l-64 0z`]},Ca={prefix:`fas`,iconName:`angles-right`,icon:[448,512,[187,`angle-double-right`],`f101`,`M439.1 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L371.2 256 233.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L179.2 256 41.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z`]},wa={prefix:`fas`,iconName:`bars`,icon:[448,512,[`navicon`],`f0c9`,`M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z`]},Ta={prefix:`fas`,iconName:`angles-left`,icon:[448,512,[171,`angle-double-left`],`f100`,`M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L269.3 256 406.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z`]},Ea={prefix:`fas`,iconName:`list-ul`,icon:[512,512,[`list-dots`],`f0ca`,`M48 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM48 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM96 256a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z`]};export{a as _,ba as a,ma as c,_a as d,Ea as f,da as g,xa as h,ya as i,pa as l,va as m,Ca as n,ha as o,Sa as p,wa as r,fa as s,Ta as t,ga as u,r as v}; \ No newline at end of file diff --git a/frontend/web/dist/assets/index-CNuZH30Y.css b/frontend/web/dist/assets/index-CNuZH30Y.css new file mode 100644 index 000000000..9b6cc4041 --- /dev/null +++ b/frontend/web/dist/assets/index-CNuZH30Y.css @@ -0,0 +1 @@ +@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-cyrillic-ext-wght-normal-DjL33-gN.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-cyrillic-wght-normal-BEAKL7Jp.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-vietnamese-wght-normal-6IgcOCM7.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-latin-ext-wght-normal-DC-KSUi6.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-latin-wght-normal-BgDaEnEv.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-symbols2-wght-normal-CO5SzqOn.woff2)format("woff2-variations");unicode-range:U+2000-2001,U+2004-2008,U+200A,U+23B8-23BD,U+2500-259F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-vietnamese-wght-normal-DadHysG0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-latin-wght-normal-XN7g48iV.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.\!card,.card{background:rgb(var(--surface));box-shadow:none;border:0;border-radius:.5rem}.chip{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1));border-radius:.375rem;align-items:center;gap:.25rem;padding:.125rem .375rem;font-size:.75rem;line-height:1rem;display:inline-flex}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.inset-y-1{top:.25rem;bottom:.25rem}.inset-y-2{top:.5rem;bottom:.5rem}.-bottom-2\.5{bottom:-.625rem}.-left-0\.5{left:-.125rem}.-top-1\.5{top:-.375rem}.-top-2\.5{top:-.625rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-4{left:1rem}.left-\[0\.6875rem\]{left:.6875rem}.left-\[10\%\]{left:10%}.left-\[5px\]{left:5px}.right-0\.5{right:.125rem}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-9{right:2.25rem}.right-\[10\%\]{right:10%}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-2{top:.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-6{top:1.5rem}.isolate{isolation:isolate}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[110\]{z-index:110}.z-\[70\]{z-index:70}.z-\[90\]{z-index:90}.order-2{order:2}.order-3{order:3}.m-1{margin:.25rem}.m-auto{margin:auto}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-1\.5{margin-top:.375rem;margin-bottom:.375rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-9{margin-top:2.25rem}.mt-\[7px\]{margin-top:7px}.mt-auto{margin-top:auto}.mt-px{margin-top:1px}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.flow-root{display:flow-root}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1\.4rem\]{height:1.4rem}.h-\[100dvh\]{height:100dvh}.h-\[68vh\]{height:68vh}.h-\[calc\(100\%-1rem\)\]{height:calc(100% - 1rem)}.h-\[min\(780px\,84dvh\)\]{height:min(780px,84dvh)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-72{max-height:18rem}.max-h-80{max-height:20rem}.max-h-\[100dvh\]{max-height:100dvh}.max-h-\[24vh\]{max-height:24vh}.max-h-\[30vh\]{max-height:30vh}.max-h-\[34rem\]{max-height:34rem}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[52vh\]{max-height:52vh}.max-h-\[600px\]{max-height:600px}.max-h-\[62vh\]{max-height:62vh}.max-h-\[64vh\]{max-height:64vh}.max-h-\[70dvh\]{max-height:70dvh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[72vh\]{max-height:72vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[calc\(100dvh-1\.5rem\)\]{max-height:calc(100dvh - 1.5rem)}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-10{min-height:2.5rem}.min-h-11{min-height:2.75rem}.min-h-14{min-height:3.5rem}.min-h-40{min-height:10rem}.min-h-52{min-height:13rem}.min-h-64{min-height:16rem}.min-h-72{min-height:18rem}.min-h-\[209px\]{min-height:209px}.min-h-\[3\.25rem\]{min-height:3.25rem}.min-h-\[320px\]{min-height:320px}.min-h-\[34rem\]{min-height:34rem}.min-h-\[60vh\]{min-height:60vh}.min-h-dvh{min-height:100dvh}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:.125rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[1\.4rem\]{width:1.4rem}.w-\[min\(30rem\,calc\(100vw-2rem\)\)\]{width:min(30rem,100vw - 2rem)}.w-\[min\(92vw\,42rem\)\]{width:min(92vw,42rem)}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0}.min-w-28{min-width:7rem}.min-w-3\.5{min-width:.875rem}.min-w-32{min-width:8rem}.min-w-44{min-width:11rem}.min-w-full{min-width:100%}.min-w-max{min-width:max-content}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-48{max-width:12rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-64{max-width:16rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[1600px\]{max-width:1600px}.max-w-\[260px\]{max-width:260px}.max-w-\[960px\]{max-width:960px}.max-w-\[calc\(100\%_-_3rem\)\]{max-width:calc(100% - 3rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.basis-full{flex-basis:100%}.table-fixed{table-layout:fixed}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x:-100%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate:-90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes appear{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.animate-appear{animation:.2s cubic-bezier(.4,0,.2,1) appear}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[16px_minmax\(0\,1fr\)\]{grid-template-columns:16px minmax(0,1fr)}.grid-cols-\[72px_minmax\(0\,1fr\)\]{grid-template-columns:72px minmax(0,1fr)}.grid-cols-\[84px_minmax\(0\,1fr\)_auto\]{grid-template-columns:84px minmax(0,1fr) auto}.grid-rows-\[1fr\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-1{row-gap:.25rem}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.justify-self-start{justify-self:start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overscroll-contain{overscroll-behavior:contain}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[18px\]{border-radius:18px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-xl{border-radius:.75rem}.rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.border-blue-deep{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.border-blue-deep\/30{border-color:rgb(var(--blue-deep) / .3)}.border-blue-deep\/50{border-color:rgb(var(--blue-deep) / .5)}.border-blue-deep\/60{border-color:rgb(var(--blue-deep) / .6)}.border-blue\/25{border-color:rgb(var(--blue) / .25)}.border-blue\/30{border-color:rgb(var(--blue) / .3)}.border-blue\/35{border-color:rgb(var(--blue) / .35)}.border-blue\/40{border-color:rgb(var(--blue) / .4)}.border-blue\/45{border-color:rgb(var(--blue) / .45)}.border-blue\/50{border-color:rgb(var(--blue) / .5)}.border-blue\/60{border-color:rgb(var(--blue) / .6)}.border-err{--tw-border-opacity:1;border-color:rgb(var(--err) / var(--tw-border-opacity,1))}.border-err\/30{border-color:rgb(var(--err) / .3)}.border-err\/35{border-color:rgb(var(--err) / .35)}.border-err\/40{border-color:rgb(var(--err) / .4)}.border-err\/50{border-color:rgb(var(--err) / .5)}.border-err\/60{border-color:rgb(var(--err) / .6)}.border-gold\/25{border-color:rgb(var(--gold) / .25)}.border-gold\/30{border-color:rgb(var(--gold) / .3)}.border-gold\/40{border-color:rgb(var(--gold) / .4)}.border-line{--tw-border-opacity:1;border-color:rgb(var(--line) / var(--tw-border-opacity,1))}.border-line\/40{border-color:rgb(var(--line) / .4)}.border-line\/50{border-color:rgb(var(--line) / .5)}.border-line\/60{border-color:rgb(var(--line) / .6)}.border-line\/70{border-color:rgb(var(--line) / .7)}.border-line\/80{border-color:rgb(var(--line) / .8)}.border-ok{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.border-ok\/20{border-color:rgb(var(--ok) / .2)}.border-ok\/30{border-color:rgb(var(--ok) / .3)}.border-ok\/35{border-color:rgb(var(--ok) / .35)}.border-ok\/40{border-color:rgb(var(--ok) / .4)}.border-ok\/45{border-color:rgb(var(--ok) / .45)}.border-ok\/60{border-color:rgb(var(--ok) / .6)}.border-panel{--tw-border-opacity:1;border-color:rgb(var(--panel) / var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-warn\/30{border-color:rgb(var(--warn) / .3)}.border-warn\/35{border-color:rgb(var(--warn) / .35)}.border-warn\/40{border-color:rgb(var(--warn) / .4)}.border-warn\/50{border-color:rgb(var(--warn) / .5)}.border-t-blue{--tw-border-opacity:1;border-top-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.bg-bg{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.bg-bg\/25{background-color:rgb(var(--bg) / .25)}.bg-bg\/30{background-color:rgb(var(--bg) / .3)}.bg-bg\/35{background-color:rgb(var(--bg) / .35)}.bg-bg\/40{background-color:rgb(var(--bg) / .4)}.bg-bg\/50{background-color:rgb(var(--bg) / .5)}.bg-bg\/60{background-color:rgb(var(--bg) / .6)}.bg-bg\/70{background-color:rgb(var(--bg) / .7)}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/20{background-color:#0003}.bg-black\/40{background-color:#0006}.bg-blue{--tw-bg-opacity:1;background-color:rgb(var(--blue) / var(--tw-bg-opacity,1))}.bg-blue-deep{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.bg-blue-deep\/10{background-color:rgb(var(--blue-deep) / .1)}.bg-blue-deep\/20{background-color:rgb(var(--blue-deep) / .2)}.bg-blue-deep\/5{background-color:rgb(var(--blue-deep) / .05)}.bg-blue-sky{--tw-bg-opacity:1;background-color:rgb(var(--blue-sky) / var(--tw-bg-opacity,1))}.bg-blue\/10{background-color:rgb(var(--blue) / .1)}.bg-blue\/5{background-color:rgb(var(--blue) / .05)}.bg-conversation-user{--tw-bg-opacity:1;background-color:rgb(var(--conversation-user) / var(--tw-bg-opacity,1))}.bg-emerald-500{--tw-bg-opacity:1;background-color:rgb(16 185 129/var(--tw-bg-opacity,1))}.bg-engineer{--tw-bg-opacity:1;background-color:rgb(var(--role-engineer) / var(--tw-bg-opacity,1))}.bg-err{--tw-bg-opacity:1;background-color:rgb(var(--err) / var(--tw-bg-opacity,1))}.bg-err\/10{background-color:rgb(var(--err) / .1)}.bg-err\/5{background-color:rgb(var(--err) / .05)}.bg-gold{--tw-bg-opacity:1;background-color:rgb(var(--gold) / var(--tw-bg-opacity,1))}.bg-gold\/5{background-color:rgb(var(--gold) / .05)}.bg-gold\/80{background-color:rgb(var(--gold) / .8)}.bg-ink{--tw-bg-opacity:1;background-color:rgb(var(--ink) / var(--tw-bg-opacity,1))}.bg-ink-faint{--tw-bg-opacity:1;background-color:rgb(var(--ink-faint) / var(--tw-bg-opacity,1))}.bg-ink-faint\/40{background-color:rgb(var(--ink-faint) / .4)}.bg-ink-faint\/45{background-color:rgb(var(--ink-faint) / .45)}.bg-ink-faint\/50{background-color:rgb(var(--ink-faint) / .5)}.bg-ink-faint\/60{background-color:rgb(var(--ink-faint) / .6)}.bg-line{--tw-bg-opacity:1;background-color:rgb(var(--line) / var(--tw-bg-opacity,1))}.bg-line\/30{background-color:rgb(var(--line) / .3)}.bg-line\/40{background-color:rgb(var(--line) / .4)}.bg-line\/55{background-color:rgb(var(--line) / .55)}.bg-line\/60{background-color:rgb(var(--line) / .6)}.bg-line\/70{background-color:rgb(var(--line) / .7)}.bg-line\/80{background-color:rgb(var(--line) / .8)}.bg-ok{--tw-bg-opacity:1;background-color:rgb(var(--ok) / var(--tw-bg-opacity,1))}.bg-ok\/10{background-color:rgb(var(--ok) / .1)}.bg-ok\/15{background-color:rgb(var(--ok) / .15)}.bg-ok\/5{background-color:rgb(var(--ok) / .05)}.bg-panel{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.bg-panel-raised{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.bg-panel\/80{background-color:rgb(var(--panel) / .8)}.bg-panel\/85{background-color:rgb(var(--panel) / .85)}.bg-panel\/95{background-color:rgb(var(--panel) / .95)}.bg-surface{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.bg-surface\/50{background-color:rgb(var(--surface) / .5)}.bg-surface\/60{background-color:rgb(var(--surface) / .6)}.bg-transparent{background-color:#0000}.bg-warn{--tw-bg-opacity:1;background-color:rgb(var(--warn) / var(--tw-bg-opacity,1))}.bg-warn\/10{background-color:rgb(var(--warn) / .1)}.bg-warn\/5{background-color:rgb(var(--warn) / .05)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-white\/\[0\.03\]{background-color:#ffffff08}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-px{padding-top:1px;padding-bottom:1px}.pb-1{padding-bottom:.25rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-0\.5{padding-left:.125rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-3\.5{padding-left:.875rem}.pl-4{padding-left:1rem}.pl-5{padding-left:1.25rem}.pl-7{padding-left:1.75rem}.pl-\[1\.125rem\]{padding-left:1.125rem}.pr-10{padding-right:2.5rem}.pr-14{padding-right:3.5rem}.pr-3{padding-right:.75rem}.pr-\[4\.75rem\]{padding-right:4.75rem}.pt-0\.5{padding-top:.125rem}.pt-1\.5{padding-top:.375rem}.pt-10{padding-top:2.5rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-7{padding-top:1.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace}.font-sans{font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.leading-\[1\.625\]{line-height:1.625}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-\[-0\.01em\]{letter-spacing:-.01em}.tracking-\[0\.06em\]{letter-spacing:.06em}.tracking-\[0\.08em\]{letter-spacing:.08em}.tracking-\[0\.12em\]{letter-spacing:.12em}.tracking-\[0\.14em\]{letter-spacing:.14em}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.16em\]{letter-spacing:.16em}.tracking-\[0\.18em\]{letter-spacing:.18em}.tracking-normal{letter-spacing:0}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-bg{--tw-text-opacity:1;color:rgb(var(--bg) / var(--tw-text-opacity,1))}.text-blue{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.text-blue-sky{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.text-blue\/75{color:rgb(var(--blue) / .75)}.text-err{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.text-err\/80{color:rgb(var(--err) / .8)}.text-gold{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.text-ink{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.text-ink-dim{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.text-ink-faint{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.text-manager{--tw-text-opacity:1;color:rgb(var(--role-manager) / var(--tw-text-opacity,1))}.text-ok{--tw-text-opacity:1;color:rgb(var(--ok) / var(--tw-text-opacity,1))}.text-surface{--tw-text-opacity:1;color:rgb(var(--surface) / var(--tw-text-opacity,1))}.text-warn{--tw-text-opacity:1;color:rgb(var(--warn) / var(--tw-text-opacity,1))}.text-warn\/80{color:rgb(var(--warn) / .8)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-blue\/35{-webkit-text-decoration-color:rgb(var(--blue) / .35);text-decoration-color:rgb(var(--blue) / .35)}.decoration-line{-webkit-text-decoration-color:rgb(var(--line) / 1);text-decoration-color:rgb(var(--line) / 1)}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.accent-blue{accent-color:rgb(var(--blue) / 1)}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-\[0_10px_24px_-20px_rgb\(0_0_0\/0\.2\)\]{--tw-shadow:0 10px 24px -20px #0003;--tw-shadow-colored:0 10px 24px -20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-glow{--tw-shadow:0 16px 44px #00000057;--tw-shadow-colored:0 16px 44px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-4{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-bg{--tw-ring-opacity:1;--tw-ring-color:rgb(var(--bg) / var(--tw-ring-opacity,1))}.ring-err\/30{--tw-ring-color:rgb(var(--err) / .3)}.ring-line\/35{--tw-ring-color:rgb(var(--line) / .35)}.ring-manager\/60{--tw-ring-color:rgb(var(--role-manager) / .6)}.ring-ok\/30{--tw-ring-color:rgb(var(--ok) / .3)}.ring-offset-1{--tw-ring-offset-width:1px}.ring-offset-panel{--tw-ring-offset-color:rgb(var(--panel) / 1)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\!filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\,transform\,visibility\]{transition-property:width,transform,visibility;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-shadow{transition-property:box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-500{transition-duration:.5s}.duration-panel{transition-duration:.22s}.ease-panel{transition-timing-function:cubic-bezier(.4,0,.2,1)}:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--bg:245 245 247;--surface:255 255 255;--panel:255 255 255;--panel-raised:255 255 255;--line:232 232 235;--ink:29 29 31;--ink-dim:80 80 84;--ink-faint:99 99 102;--blue:0 102 204;--blue-deep:0 82 172;--blue-sky:0 102 204;--gold:0 102 204;--gold-soft:0 102 204;--gold-deep:0 82 172;--ok:0 102 204;--warn:99 99 102;--err:29 29 31;--role-manager:37 99 235;--role-planner:124 58 237;--role-engineer:15 118 110;--role-reviewer:180 83 9;--conversation-user:238 238 240;--conversation-argus:246 248 252;--glass:255 255 255;--glass-raised:255 255 255;--glass-edge:224 224 228;--chrome-surface:255 255 255;--brand-body:0 0 0;--brand-eye:255 255 255;--brand-pupil:0 0 0;--brand-highlight:255 255 255}:root[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--bg:0 0 0;--surface:22 22 24;--panel:28 28 30;--panel-raised:36 36 38;--line:58 58 60;--ink:245 245 247;--ink-dim:199 199 204;--ink-faint:162 162 167;--blue:64 156 255;--blue-deep:10 102 194;--blue-sky:100 175 255;--gold:64 156 255;--gold-soft:64 156 255;--gold-deep:10 102 194;--ok:64 156 255;--warn:174 174 178;--err:245 245 247;--role-manager:96 165 250;--role-planner:196 181 253;--role-engineer:52 211 153;--role-reviewer:251 191 36;--conversation-user:44 44 46;--conversation-argus:25 31 40;--glass:28 28 30;--glass-raised:36 36 38;--glass-edge:72 72 74;--chrome-surface:22 22 24;--brand-body:215 217 220;--brand-eye:255 255 255;--brand-pupil:32 35 38;--brand-highlight:255 255 255;font-synthesis:none}:root[data-theme-style=gradient]{--ambient-blue:7 95 228;--ambient-gold:207 153 49}:root[data-theme=dark][data-theme-style=gradient]{--ambient-blue:110 168 255;--ambient-gold:237 201 111}html,body,#root{height:100%}body{background:rgb(var(--bg) / 1);color:rgb(var(--ink) / 1);font-optical-sizing:auto;font-feature-settings:"ss01" 1, "cv02" 1, "cv03" 1, "cv04" 1;-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility;margin:0;font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif;overflow:hidden}.katex-display{max-width:100%;overflow:auto hidden}select:not([multiple]){appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m5 6.5 3 3 3-3' stroke='%236e6e73' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-position:right .6rem center;background-repeat:no-repeat;background-size:1rem;transition:border-color .14s,background-color .14s,box-shadow .14s;padding-right:1.9rem!important}:root[data-theme=dark] select:not([multiple]){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m5 6.5 3 3 3-3' stroke='%23a2a2a7' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}select:not([multiple]):focus-visible{box-shadow:0 0 0 3px rgb(var(--blue) / 10%);border-color:rgb(var(--blue) / 58%)!important}select option,select optgroup{background:rgb(var(--panel-raised));color:rgb(var(--ink))}.workbench-shell{isolation:isolate;background:rgb(var(--bg));height:100dvh}.workbench-shell[data-resizing] [data-resizable-panel]{transition-duration:0s!important}:root[data-theme=dark] .workbench-shell{background:rgb(var(--bg))}:root[data-theme-style=gradient] .workbench-shell{background:radial-gradient(circle at 8% 0%, rgb(var(--ambient-blue) / 15%), transparent 36rem), radial-gradient(circle at 92% 100%, rgb(var(--ambient-gold) / 14%), transparent 34rem), rgb(var(--bg))}:root[data-theme=dark][data-theme-style=gradient] .workbench-shell{background:radial-gradient(circle at 8% 0%, rgb(var(--ambient-blue) / 20%), transparent 38rem), radial-gradient(circle at 92% 100%, rgb(var(--ambient-gold) / 17%), transparent 36rem), rgb(var(--bg))}.ambient-canvas{position:relative}.ambient-canvas:before{content:none}.glass-panel,.glass-panel--side,.glass-panel--main,.glass-panel--raised{border-color:rgb(var(--line));background:rgb(var(--panel));box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none}.glass-panel--side{background:rgb(var(--surface) / 94%)}.glass-panel--main{background:rgb(var(--panel) / 96%)}.glass-panel--raised{background:rgb(var(--panel-raised));box-shadow:none}.chrome-seam-surface{background:rgb(var(--chrome-surface));box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none}.glass-card{background:rgb(var(--surface));box-shadow:none;border:0}.mission-status-line{--mission-status-color:var(--blue);box-shadow:none;margin-top:1rem;padding:.25rem 0}.mission-status-line__signal{color:rgb(var(--ink));align-items:center;gap:.625rem;font-size:.875rem;font-weight:600;line-height:1.4;display:flex}.mission-status-line__marker{background:rgb(var(--mission-status-color));border-radius:999px;flex:none;width:.5rem;height:.5rem}.mission-status-line__subtitle{color:rgb(var(--ink-dim));margin-top:.375rem;padding-left:1.125rem;font-size:.75rem;line-height:1.5}.mission-status-line[data-tone=done]{--mission-status-color:var(--blue)}.mission-status-line[data-tone=error]{--mission-status-color:var(--err)}.mission-status-line[data-tone=waiting]{--mission-status-color:var(--ink-faint)}.brand-button{z-index:0;isolation:isolate;border:1px solid #0000;border-radius:8px;min-height:32px;padding:.3rem .7rem;font-size:.75rem;font-weight:600;transition:color .18s,box-shadow .18s,filter .18s;position:relative;overflow:hidden}.brand-button:before,.brand-button:after{content:none}.brand-button-primary{border-color:rgb(var(--blue) / 34%);background:rgb(var(--blue) / 8%);color:rgb(var(--blue));box-shadow:none}.brand-button-ghost{color:rgb(var(--ink-dim));background:0 0}.brand-button-danger{border-color:rgb(var(--ink));background:rgb(var(--ink));color:rgb(var(--bg))}.brand-button:disabled{cursor:not-allowed;filter:grayscale(.45);opacity:.42}.panel-header{border-color:rgb(var(--line) / 70%);background:0 0}.modal-scrim{background:#00000052}.brand-modal{border:1px solid rgb(var(--glass-edge) / 80%);background:rgb(var(--panel-raised));box-shadow:0 24px 80px #0000002e,0 2px 10px #00000012}:root[data-theme=dark] .brand-modal{border-color:rgb(var(--glass-edge) / 72%);box-shadow:0 28px 90px #0000008c,0 2px 10px #00000047}.modal-close{z-index:2;background:rgb(var(--conversation-user) / 78%);width:2rem;height:2rem;color:rgb(var(--ink-faint));border:1px solid #0000;border-radius:999px;place-items:center;transition:border-color .14s,background-color .14s,color .14s,transform .14s;display:grid;position:absolute;top:.75rem;right:.75rem}.modal-close svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-width:1.4px;width:.9rem;height:.9rem}.modal-close:hover{border-color:rgb(var(--line));background:rgb(var(--ink));color:rgb(var(--bg))}.modal-close:active{transform:scale(.94)}.modal-close:focus-visible{outline:2px solid rgb(var(--blue) / 65%);outline-offset:2px}.handshake-mark{color:rgb(var(--ink));box-shadow:none}.handshake-line{background:rgb(var(--blue))}.handshake-node{border-color:rgb(var(--line));background:rgb(var(--surface));box-shadow:none}.icon-control,.compact-control,.send-control{color:rgb(var(--ink-faint));box-shadow:none;background:0 0;border:1px solid #0000;border-radius:8px;transition:border-color .18s,background-color .18s,color .18s,box-shadow .18s}.compact-control{font-size:.75rem}.composer-runtime{color:rgb(var(--ink-dim));flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 12px;padding:6px 4px;font-size:11px;line-height:1.5;display:flex}.composer-runtime-model{overflow-wrap:anywhere;min-width:0}.composer-runtime button{color:rgb(var(--blue));text-underline-offset:3px;flex-shrink:0;text-decoration:underline}.composer-runtime button:focus-visible{outline:2px solid rgb(var(--blue));outline-offset:3px}.composer-runtime button.composer-runtime-model{color:inherit;text-align:left;cursor:pointer;flex-shrink:1;text-decoration:none}.composer-runtime button.composer-runtime-model:hover{color:rgb(var(--blue));text-decoration:underline}.composer-runtime-next{color:rgb(var(--gold))}.send-control{border-color:rgb(var(--blue) / 34%);background:rgb(var(--blue) / 8%);color:rgb(var(--blue));box-shadow:none}.session-card{background:0 0;border:1px solid #0000}.session-card[data-active=true]{background:rgb(var(--blue) / 8%);box-shadow:inset 2px 0 0 rgb(var(--blue));border-color:#0000}.workspace-tabs{align-self:stretch;gap:1.5rem;display:flex}.workspace-tab{color:rgb(var(--ink-faint));border-bottom:2px solid #0000;padding:0 .25rem;font-size:.875rem;transition:color .18s,border-color .18s}.workspace-tab[data-selected=true]{color:rgb(var(--ink));border-bottom-color:rgb(var(--ink))}.workspace-more{color:rgb(var(--ink-dim));font-size:.875rem;position:relative}.workspace-more>summary{cursor:pointer;border-radius:6px;padding:.5rem}.workspace-more>summary:focus-visible{outline:2px solid rgb(var(--blue));outline-offset:2px}.workspace-more-menu{z-index:60;border:1px solid rgb(var(--line));background:rgb(var(--surface));border-radius:8px;min-width:210px;padding:6px;position:absolute;top:100%;left:0;box-shadow:0 6px 20px #00000014}.workspace-more-menu button{text-align:left;border-radius:4px;align-items:center;gap:8px;width:100%;min-height:40px;padding:8px 10px;display:flex}.workspace-more-menu button:hover{background:rgb(var(--bg))}.mobile-more>summary{flex-direction:column;justify-content:center;align-items:center;gap:2px;font-size:10px;list-style:none;display:flex}.mobile-more>summary::-webkit-details-marker{display:none}.mobile-more>summary[aria-current=page]{color:rgb(var(--blue))}.mobile-more .workspace-more-menu{font-size:14px;inset:auto 8px calc(100% + 8px) auto}.mission-detail-records>summary::marker{color:rgb(var(--ink-faint))}.workbench-module-tab{min-height:30px;color:rgb(var(--ink-faint));border:1px solid #0000;border-radius:.5rem;align-items:center;gap:.35rem;padding:.35rem .6rem;font-size:.72rem;transition:border-color .16s,background .16s,color .16s;display:inline-flex}.workbench-module-tab:hover{border-color:rgb(var(--glass-edge) / 55%);background:rgb(var(--glass-raised) / 45%);color:rgb(var(--ink))}.workbench-module-tab[data-selected=true]{border-color:rgb(var(--blue) / 35%);background:rgb(var(--blue) / 8%);color:rgb(var(--ink));box-shadow:none}@keyframes workspace-surface-enter{0%{opacity:.4;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.workspace-view-surface:not(.hidden){animation:.24s cubic-bezier(.32,.72,0,1) workspace-surface-enter}.runtime-control-page .button{transition:transform .16s cubic-bezier(.32,.72,0,1),background-color .16s,color .16s}.runtime-control-page .button:not(:disabled):active{transform:scale(.97)}@media (prefers-reduced-motion:reduce){.workspace-view-surface:not(.hidden){animation:none}.runtime-control-page .button{transition:none;transform:none!important}}.role-log-group{transition:background-color .2s,box-shadow .2s;position:relative}.role-log-group:before{content:"";opacity:0;background:rgb(var(--blue));border-radius:999px;width:2px;transition:opacity .2s,box-shadow .2s;position:absolute;inset:5px auto 5px 0}.role-log-group[data-open=true]{background:rgb(var(--blue) / 4%)}.role-log-group[data-open=true]:before{opacity:1}.role-log-group[data-active=true]:before{box-shadow:none}@media (hover:hover) and (pointer:fine){.icon-control:hover,.compact-control:hover{background-color:rgb(var(--conversation-user));color:rgb(var(--ink));box-shadow:none;border-color:#0000}.session-card:hover{background:rgb(var(--conversation-user) / 55%);border-color:#0000}.brand-button:hover{background:rgb(var(--conversation-user));box-shadow:none;border-color:#0000}.brand-button-primary:hover,.send-control:hover{border-color:rgb(var(--blue-deep));background:rgb(var(--blue-deep));color:#fff}}@media (hover:none),(pointer:coarse){.brand-button:active{filter:brightness(.92)}}.theme-style-option{border:1px solid rgb(var(--line));background:rgb(var(--surface));min-height:72px;color:rgb(var(--ink));text-align:left;border-radius:10px;grid-template-columns:44px minmax(0,1fr) 18px;align-items:center;gap:.75rem;padding:.75rem;transition:border-color .16s,background-color .16s;display:grid;position:relative}.theme-style-option[data-selected=true]{border-color:rgb(var(--blue) / 58%);background:rgb(var(--blue) / 5%)}.theme-style-preview{border:1px solid rgb(var(--line));border-radius:8px;width:44px;height:32px}.theme-style-preview--standard{background:linear-gradient(135deg, rgb(var(--ink)) 0 48%, rgb(var(--blue)) 48% 100%)}.theme-style-preview--gradient{background:linear-gradient(135deg,#075fe4,#0b2e68 54%,#cf9931)}.theme-style-check{border:1px solid rgb(var(--line));color:#0000;border-radius:999px;place-items:center;width:18px;height:18px;font-size:9px;display:grid}.theme-style-option[data-selected=true] .theme-style-check{border-color:rgb(var(--blue));background:rgb(var(--blue));color:#fff}:root{--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--safe-right:env(safe-area-inset-right,0px);--mobile-tabbar-height:calc(3.25rem + var(--safe-bottom));--keyboard-inset:0px}.safe-inset-x{padding-left:var(--safe-left);padding-right:var(--safe-right)}.safe-inset-top{padding-top:var(--safe-top)}.safe-inset-bottom{padding-bottom:var(--safe-bottom)}@media (pointer:coarse){.icon-control,.compact-control,.workspace-tab{position:relative}.icon-control:after,.compact-control:after,.workspace-tab:after{content:"";width:max(100%,44px);height:max(100%,44px);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}}@media (width<=1023px){.mobile-scroll-region{padding-bottom:calc(var(--mobile-tabbar-height) + .5rem)}}.mobile-tabbar{bottom:var(--keyboard-inset);padding-bottom:var(--safe-bottom);padding-left:var(--safe-left);padding-right:var(--safe-right);transition:bottom .12s ease-out}.composer-dock{padding-bottom:calc(var(--keyboard-inset) + 1.5rem);transition:padding-bottom .12s ease-out}@media (width<=1023px){.composer-dock{padding-bottom:calc(var(--mobile-tabbar-height) + var(--keyboard-inset) + 1.5rem)}}[data-compact-viewport=true] .composer-dock{padding-top:6px;padding-bottom:calc(var(--mobile-tabbar-height) + var(--keyboard-inset) + .5rem)}[data-compact-viewport=true] .composer-dock .map-composer{padding-top:6px;padding-bottom:6px}[data-compact-viewport=true] .composer-dock .map-composer textarea{max-height:56px}[data-compact-viewport=true] .composer-dock .composer-controls{padding-top:0}[data-compact-viewport=true] .composer-dock .composer-runtime{padding-top:2px;padding-bottom:2px}@media (prefers-reduced-motion:reduce){.composer-dock,.mobile-tabbar{transition:none}}::selection{color:rgb(var(--ink) / 1);background:#3f6f9f8c}button,input,textarea{font:inherit}button{-webkit-tap-highlight-color:transparent}:where(button,input,textarea):focus-visible{outline:2px solid rgb(var(--blue-sky) / 1);outline-offset:2px}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}.scroll-smooth{scroll-behavior:auto!important}.ambient-canvas:before{animation:none!important}}.scroll-thin::-webkit-scrollbar{width:7px;height:7px}.scroll-thin{scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:rgb(var(--ink-faint) / 45%) transparent}.scroll-thin::-webkit-scrollbar-thumb{background:rgb(var(--ink-faint) / 38%);border:1px solid rgb(var(--panel) / 80%);border-radius:9999px}.scroll-thin::-webkit-scrollbar-thumb:hover{background:rgb(var(--ink-faint) / 65%)}.scroll-thin::-webkit-scrollbar-track{background:0 0;border-radius:9999px}.slash-completion-menu{overscroll-behavior:contain;max-height:min(22rem,42dvh);overflow-y:auto}:root[data-argus-embedded=true] .ambient-canvas:before{will-change:auto;animation:none;transform:translate(0,0)scale(1.04)}:root[data-argus-embedded=true] :is(.glass-panel,.glass-panel--side,.glass-panel--main,.glass-panel--raised){-webkit-backdrop-filter:blur(8px)saturate(1.06);backdrop-filter:blur(8px)saturate(1.06)}@supports (content-visibility:auto){:root[data-argus-embedded=true] .conversation-thread{content-visibility:auto;contain-intrinsic-size:auto 180px}:root[data-argus-embedded=true] .event-activity-row{content-visibility:auto;contain-intrinsic-size:auto 56px}}.delivery-toast{z-index:60;background:rgb(var(--panel-raised));width:max-content;max-width:min(420px,100vw - 32px);color:rgb(var(--ink));border:1px solid rgb(var(--line));border-radius:10px;align-items:center;gap:10px;padding:10px 12px;font-size:13px;display:flex;position:fixed;top:68px;left:50%;transform:translate(-50%);box-shadow:0 8px 24px #0000002e}.delivery-toast span{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.delivery-toast button{color:inherit;cursor:pointer;font:inherit;background:0 0;border:0}.delivery-toast button:first-of-type{color:rgb(var(--blue));font-weight:600}.app-brand-image .app-brand-dark,[data-theme=dark] .app-brand-image .app-brand-light{display:none}[data-theme=dark] .app-brand-image .app-brand-dark{display:block}.placeholder\:text-ink-faint::placeholder{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}.last\:border-0:last-child{border-width:0}.last\:border-b-0:last-child{border-bottom-width:0}.last\:pb-0:last-child{padding-bottom:0}.focus-within\:border-blue\/60:focus-within{border-color:rgb(var(--blue) / .6)}.hover\:border-blue:hover{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.hover\:border-blue-deep:hover{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.hover\:border-blue-sky\/60:hover{border-color:rgb(var(--blue-sky) / .6)}.hover\:border-blue\/40:hover{border-color:rgb(var(--blue) / .4)}.hover\:border-blue\/45:hover{border-color:rgb(var(--blue) / .45)}.hover\:border-blue\/50:hover{border-color:rgb(var(--blue) / .5)}.hover\:border-blue\/60:hover{border-color:rgb(var(--blue) / .6)}.hover\:border-err\/50:hover{border-color:rgb(var(--err) / .5)}.hover\:border-ink-faint:hover{--tw-border-opacity:1;border-color:rgb(var(--ink-faint) / var(--tw-border-opacity,1))}.hover\:border-line\/70:hover{border-color:rgb(var(--line) / .7)}.hover\:border-ok:hover{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.hover\:bg-bg:hover{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.hover\:bg-bg\/30:hover{background-color:rgb(var(--bg) / .3)}.hover\:bg-bg\/60:hover{background-color:rgb(var(--bg) / .6)}.hover\:bg-bg\/70:hover{background-color:rgb(var(--bg) / .7)}.hover\:bg-blue-deep:hover{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.hover\:bg-blue-deep\/20:hover{background-color:rgb(var(--blue-deep) / .2)}.hover\:bg-blue-deep\/80:hover{background-color:rgb(var(--blue-deep) / .8)}.hover\:bg-blue\/10:hover{background-color:rgb(var(--blue) / .1)}.hover\:bg-blue\/15:hover{background-color:rgb(var(--blue) / .15)}.hover\:bg-err\/10:hover{background-color:rgb(var(--err) / .1)}.hover\:bg-line\/20:hover{background-color:rgb(var(--line) / .2)}.hover\:bg-ok\/10:hover{background-color:rgb(var(--ok) / .1)}.hover\:bg-ok\/15:hover{background-color:rgb(var(--ok) / .15)}.hover\:bg-panel:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.hover\:bg-panel-raised:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.hover\:bg-panel\/60:hover{background-color:rgb(var(--panel) / .6)}.hover\:bg-panel\/80:hover{background-color:rgb(var(--panel) / .8)}.hover\:bg-surface:hover{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.hover\:bg-warn\/10:hover{background-color:rgb(var(--warn) / .1)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-blue:hover{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.hover\:text-blue-sky:hover{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.hover\:text-err:hover{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.hover\:text-gold:hover{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.hover\:text-gold-soft:hover{--tw-text-opacity:1;color:rgb(var(--gold-soft) / var(--tw-text-opacity,1))}.hover\:text-ink:hover{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.hover\:text-ink-dim:hover{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-blue:hover{-webkit-text-decoration-color:rgb(var(--blue) / 1);text-decoration-color:rgb(var(--blue) / 1)}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.focus\:border-blue:focus{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.focus\:border-blue-deep:focus{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.focus\:border-blue\/60:focus,.focus-visible\:border-blue\/60:focus-visible{border-color:rgb(var(--blue) / .6)}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-blue:focus-visible{outline-color:rgb(var(--blue) / 1)}.focus-visible\:outline-blue-sky:focus-visible{outline-color:rgb(var(--blue-sky) / 1)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-blue-sky\/50:focus-visible{--tw-ring-color:rgb(var(--blue-sky) / .5)}.focus-visible\:ring-blue\/50:focus-visible{--tw-ring-color:rgb(var(--blue) / .5)}.active\:bg-panel-raised:active{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.enabled\:hover\:text-blue-sky:hover:enabled{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.enabled\:focus-visible\:underline:focus-visible:enabled{text-decoration-line:underline}.enabled\:focus-visible\:outline-none:focus-visible:enabled{outline-offset:2px;outline:2px solid #0000}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-35:disabled{opacity:.35}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-45:disabled{opacity:.45}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group:focus-within .group-focus-within\:opacity-100{opacity:1}.group:hover .group-hover\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}.group:hover .group-hover\:bg-ink-faint\/30{background-color:rgb(var(--ink-faint) / .3)}.group:hover .group-hover\:opacity-100{opacity:1}.group:focus .group-focus\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}@media (prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media (width>=640px){.sm\:left-auto{left:auto}.sm\:order-none{order:0}.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mx-8{margin-left:2rem;margin-right:2rem}.sm\:inline{display:inline}.sm\:h-20{height:5rem}.sm\:max-h-\[88dvh\]{max-height:88dvh}.sm\:w-20{width:5rem}.sm\:w-auto{width:auto}.sm\:max-w-48{max-width:12rem}.sm\:max-w-\[82\%\]{max-width:82%}.sm\:max-w-md{max-width:28rem}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-\[100px_minmax\(0\,1fr\)\]{grid-template-columns:100px minmax(0,1fr)}.sm\:grid-cols-\[minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) auto}.sm\:grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.sm\:flex-nowrap{flex-wrap:nowrap}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-5{padding:1.25rem}.sm\:p-6{padding:1.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-5{padding-left:1.25rem;padding-right:1.25rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:px-8{padding-left:2rem;padding-right:2rem}.sm\:pt-14{padding-top:3.5rem}.sm\:text-right{text-align:right}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:opacity-0{opacity:0}.group:focus-within .sm\:group-focus-within\:opacity-100,.group:hover .sm\:group-hover\:opacity-100{opacity:1}}@media (width>=768px){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-80{width:20rem}.md\:shrink-0{flex-shrink:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:border-r{border-right-width:1px}.md\:border-line\/60{border-color:rgb(var(--line) / .6)}}@media (width>=1024px){.lg\:visible{visibility:visible}.lg\:static{position:static}.lg\:z-auto{z-index:auto}.lg\:col-span-2{grid-column:span 2/span 2}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:min-h-0{min-height:0}.lg\:w-\[var\(--preview-width\)\]{width:var(--preview-width)}.lg\:w-\[var\(--sidebar-width\,256px\)\]{width:var(--sidebar-width,256px)}.lg\:max-w-\[61\.8vw\]{max-width:61.8vw}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-\[280px_minmax\(0\,1fr\)\]{grid-template-columns:280px minmax(0,1fr)}.lg\:grid-cols-\[minmax\(0\,1\.15fr\)_minmax\(260px\,0\.85fr\)\]{grid-template-columns:minmax(0,1.15fr) minmax(260px,.85fr)}.lg\:grid-cols-\[minmax\(0\,1\.4fr\)_minmax\(300px\,0\.8fr\)\]{grid-template-columns:minmax(0,1.4fr) minmax(300px,.8fr)}.lg\:grid-cols-\[minmax\(15rem\,0\.72fr\)_minmax\(0\,1\.8fr\)\]{grid-template-columns:minmax(15rem,.72fr) minmax(0,1.8fr)}.lg\:gap-3{gap:.75rem}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:border-b-0{border-bottom-width:0}.lg\:border-r{border-right-width:1px}}@media (width>=1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,1fr\)_minmax\(18rem\,0\.85fr\)\]{grid-template-columns:minmax(0,1fr) minmax(18rem,.85fr)}.xl\:border-b-0{border-bottom-width:0}.xl\:border-r{border-right-width:1px}}.\[\&\>section\>div\>button\:first-child\]\:px-3>section>div>button:first-child{padding-left:.75rem;padding-right:.75rem}.\[\&\>section\]\:mx-2>section{margin-left:.5rem;margin-right:.5rem}.\[\&\>section\]\:border-0>section{border-width:0}.\[\&\>section\]\:py-0>section{padding-top:0;padding-bottom:0} diff --git a/frontend/web/dist/assets/index-Cb5-aRKO.js b/frontend/web/dist/assets/index-Cb5-aRKO.js new file mode 100644 index 000000000..94e9de944 --- /dev/null +++ b/frontend/web/dist/assets/index-Cb5-aRKO.js @@ -0,0 +1,13 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-D406npOP.js","./rolldown-runtime-hePW80VL.js","./icons-DRlFT_ri.js","./query-CUzIxVzm.js","./markdown-D-35pK1E.js","./markdown-DvoRHisr.css","./AppearanceControls-BNJdEiGG.js","./format-CtVQGh59.js","./useWorkbenchTheme-Bu46ZOFm.js","./App-Cp4qzJN7.css","./WorkflowWorkbench-CU9bNt08.js","./AdminDataApp-BdHngqo1.js","./history-DuGaxgzd.js","./code-xml-C6UZnqwl.js","./AdminDataApp--AL95rdz.css"])))=>i.map(i=>d[i]); +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{D as n,E as r}from"./icons-DRlFT_ri.js";import{C as i,S as a,_ as o,a as s,c,d as l,f as u,g as d,h as f,l as p,m,n as h,p as g,s as _,u as v,v as y,w as ee,x as te,y as b}from"./query-CUzIxVzm.js";import"./markdown-D-35pK1E.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ne=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,x(te);else{var t=n(l);t!==null&&de(ee,t.startTime-e)}}}function te(t,i){m=!1,h&&(h=!1,_(re),re=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!oe());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&de(ee,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var b=!1,ne=null,re=-1,ie=5,ae=-1;function oe(){return!(e.unstable_now()-aee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(re),re=-1):h=!0,de(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x(te))),r},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=t(((e,t)=>{t.exports=ne()})),ie=t((e=>{var t=n(),r=re();function i(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),u=Object.prototype.hasOwnProperty,d=/^[: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]*$/,f={},p={};function m(e){return u.call(p,e)?!0:u.call(f,e)?!1:d.test(e)?p[e]=!0:(f[e]=!0,!1)}function h(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?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(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){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function ee(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function te(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ve(e):``}function xe(e){switch(e.tag){case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 2:case 15:return e=be(e.type,!1),e;case 11:return e=be(e.type.render,!1),e;case 1:return e=be(e.type,!0),e;default:return``}}function Se(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 ae:return`Fragment`;case ie:return`Portal`;case se:return`Profiler`;case oe:return`StrictMode`;case x:return`Suspense`;case de:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case le:return(e.displayName||`Context`)+`.Consumer`;case ce:return(e._context.displayName||`Context`)+`.Provider`;case ue:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case fe:return t=e.displayName||null,t===null?Se(e.type)||`Memo`:t;case pe:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}function Ce(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`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return Se(t);case 8:return t===oe?`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 we(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ee(e){var t=Te(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function De(e){e._valueTracker||=Ee(e)}function Oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Te(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ke(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ae(e,t){var n=t.checked;return S({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function je(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=we(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Me(e,t){t=t.checked,t!=null&&te(e,`checked`,t,!1)}function Ne(e,t){Me(e,t);var n=we(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`)?Fe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Fe(e,t.type,we(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pe(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 Fe(e,t,n){(t!==`number`||ke(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ie=Array.isArray;function Le(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=We.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qe={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},Je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(qe).forEach(function(e){Je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),qe[t]=qe[e]})});function Ye(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||qe.hasOwnProperty(e)&&qe[e]?(``+t).trim():t+`px`}function C(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ye(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Xe=S({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 w(e,t){if(t){if(Xe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(i(62))}}function Ze(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 Qe=null;function $e(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var et=null,T=null,tt=null;function nt(e){if(e=Zi(e)){if(typeof et!=`function`)throw Error(i(280));var t=e.stateNode;t&&(t=$i(t),et(e.stateNode,e.type,t))}}function rt(e){T?tt?tt.push(e):tt=[e]:T=e}function it(){if(T){var e=T,t=tt;if(tt=T=null,nt(e),t)for(e=0;e>>=0,e===0?32:31-(Lt(e)/Rt|0)|0}var Bt=64,Vt=4194304;function Ht(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 Ut(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Ht(a))):r=Ht(s)}else o=n&~i,o===0?a!==0&&(r=Ht(a)):r=Ht(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))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 Yt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=n}function Xt(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=dr),mr=` `,hr=!1;function gr(e,t){switch(e){case`keyup`:return lr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function _r(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var vr=!1;function yr(e,t){switch(e){case`compositionend`:return _r(t);case`keypress`:return t.which===32?(hr=!0,mr):null;case`textInput`:return e=t.data,e===mr&&hr?null:e;default:return null}}function br(e,t){if(vr)return e===`compositionend`||!ur&&gr(e,t)?(e=Pn(),Nn=Mn=jn=null,vr=!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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Hr(n)}}function Wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gr(){for(var e=window,t=ke();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ke(e.document)}return t}function Kr(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 qr(e){var t=Gr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Wr(n.ownerDocument.documentElement,n)){if(r!==null&&Kr(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 i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ur(n,a);var o=Ur(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Yr=null,Xr=null,Zr=null,Qr=!1;function $r(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qr||Yr==null||Yr!==ke(r)||(r=Yr,`selectionStart`in r&&Kr(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}),Zr&&Vr(Zr,r)||(Zr=r,r=wi(Xr,`onSelect`),0ta||(e.current=ea[ta],ea[ta]=null,ta--)}function N(e,t){ta++,ea[ta]=e.current,e.current=t}var ra={},P=na(ra),ia=na(!1),aa=ra;function oa(e,t){var n=e.type.contextTypes;if(!n)return ra;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function sa(e){return e=e.childContextTypes,e!=null}function ca(){M(ia),M(P)}function la(e,t,n){if(P.current!==ra)throw Error(i(168));N(P,t),N(ia,n)}function ua(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!=`function`)return n;for(var a in r=r.getChildContext(),r)if(!(a in t))throw Error(i(108,Ce(e)||`Unknown`,a));return S({},n,r)}function da(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ra,aa=P.current,N(P,e),N(ia,ia.current),!0}function fa(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=ua(e,t,aa),r.__reactInternalMemoizedMergedChildContext=e,M(ia),M(P),N(P,e)):M(ia),N(ia,n)}var pa=null,ma=!1,ha=!1;function ga(e){pa===null?pa=[e]:pa.push(e)}function _a(e){ma=!0,ga(e)}function va(){if(!ha&&pa!==null){ha=!0;var e=0,t=A;try{var n=pa;for(A=1;e>=o,i-=o,Ea=1<<32-It(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),F&&Oa(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),F&&Oa(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return F&&Oa(a,g),u}for(h=r(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),F&&Oa(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===ae&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case ne:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===ae){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===pe&&qa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ga(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===ae?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Ga(e,r,i),o.return=e,e=o)}return s(e);case ie:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case pe:return l=i._init,_(e,r,l(i._payload),o)}if(Ie(i))return h(e,r,i,o);if(ge(i))return g(e,r,i,o);Ka(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ya=Ja(!0),Xa=Ja(!1),Za=na(null),Qa=null,$a=null,eo=null;function to(){eo=$a=Qa=null}function no(e){var t=Za.current;M(Za),e._currentValue=t}function ro(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function io(e,t){Qa=e,eo=$a=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Us=!0),e.firstContext=null)}function ao(e){var t=e._currentValue;if(eo!==e){if(e={context:e,memoizedValue:t,next:null},$a===null){if(Qa===null)throw Error(i(308));$a=e,Qa.dependencies={lanes:0,firstContext:e}}else $a=$a.next=e}return t}var oo=null;function so(e){oo===null?oo=[e]:oo.push(e)}function co(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,so(t)):(n.next=i.next,i.next=n),t.interleaved=n,lo(e,r)}function lo(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 uo=!1;function fo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function po(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 mo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ho(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,lo(e,n)}return i=r.interleaved,i===null?(t.next=t,so(r)):(t.next=i.next,i.next=t),r.interleaved=t,lo(e,n)}function go(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}function _o(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 vo(e,t,n,r){var i=e.updateQueue;uo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=S({},d,f);break a;case 2:uo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Zc|=o,e.lanes=o,e.memoizedState=d}}function yo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=No.transition;No.transition={};try{e(!1),t()}finally{A=n,No.transition=r}}function gs(){return Uo().memoizedState}function _s(e,t,n){var r=hl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ys(e))bs(t,n);else if(n=co(e,t,n,r),n!==null){var i=Z();gl(n,e,r,i),xs(n,t,r)}}function vs(e,t,n){var r=hl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ys(e))bs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Br(s,o)){var c=t.interleaved;c===null?(i.next=i,so(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=co(e,t,i,r),n!==null&&(i=Z(),gl(n,e,r,i),xs(n,t,r))}}function ys(e){var t=e.alternate;return e===L||t!==null&&t===L}function bs(e,t){Io=Fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}var Ss={readContext:ao,useCallback:B,useContext:B,useEffect:B,useImperativeHandle:B,useInsertionEffect:B,useLayoutEffect:B,useMemo:B,useReducer:B,useRef:B,useState:B,useDebugValue:B,useDeferredValue:B,useTransition:B,useMutableSource:B,useSyncExternalStore:B,useId:B,unstable_isNewReconciler:!1},Cs={readContext:ao,useCallback:function(e,t){return Ho().memoizedState=[e,t===void 0?null:t],e},useContext:ao,useEffect:as,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),rs(4194308,4,ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){return rs(4,2,e,t)},useMemo:function(e,t){var n=Ho();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ho();return t=n===void 0?t:n(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=_s.bind(null,L,e),[r.memoizedState,e]},useRef:function(e){var t=Ho();return e={current:e},t.memoizedState=e},useState:es,useDebugValue:ds,useDeferredValue:function(e){return Ho().memoizedState=e},useTransition:function(){var e=es(!1),t=e[0];return e=hs.bind(null,e[1]),Ho().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=L,a=Ho();if(F){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),q===null)throw Error(i(349));Po&30||Yo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Zo.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,Xo.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ho(),t=q.identifierPrefix;if(F){var n=Da,r=Ea;n=(r&~(1<<32-It(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Lo++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof r.is==`string`?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),n===`select`&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Wi]=t,e[Gi]=r,fc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ze(n,r),n){case`dialog`:j(`cancel`,e),j(`close`,e),a=r;break;case`iframe`:case`object`:case`embed`:j(`load`,e),a=r;break;case`video`:case`audio`:for(a=0;arl&&(t.flags|=128,r=!0,hc(s,!1),t.lanes=4194304)}}else{if(!r){if(e=ko(c),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),hc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!F)return H(t),null}else 2*O()-s.renderingStartTime>rl&&n!==1073741824&&(t.flags|=128,r=!0,hc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(H(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=O(),t.sibling=null,n=I.current,N(I,r?n&1|2:n&1),t);case 22:case 23:return Tl(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Jc&1073741824&&(H(t),t.subtreeFlags&6&&(t.flags|=8192)):H(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function _c(e,t){switch(ja(t),t.tag){case 1:return sa(t.type)&&ca(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Eo(),M(ia),M(P),jo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Oo(t),null;case 13:if(M(I),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(I),null;case 4:return Eo(),null;case 10:return no(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var vc=!1,U=!1,yc=typeof WeakSet==`function`?WeakSet:Set,W=null;function bc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function xc(e,t,n){try{n()}catch(n){$(e,t,n)}}var Sc=!1;function Cc(e,t){if(Mi=wn,e=Gr(),Kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},wn=!1,W=t;W!==null;)if(t=W,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Es(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return h=Sc,Sc=!1,h}function wc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&xc(t,n,a)}i=i.next}while(i!==r)}}function Tc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,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 Ec(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 Dc(e){var t=e.alternate;t!==null&&(e.alternate=null,Dc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wi],delete t[Gi],delete t[qi],delete t[Ji],delete t[Yi])),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 Oc(e){return e.tag===5||e.tag===3||e.tag===4}function kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Oc(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 a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ac(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=ji));else if(r!==4&&(e=e.child,e!==null))for(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}function jc(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(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}var G=null,Mc=!1;function Nc(e,t,n){for(n=n.child;n!==null;)Pc(e,t,n),n=n.sibling}function Pc(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount==`function`)try{Pt.onCommitFiberUnmount(Nt,n)}catch{}switch(n.tag){case 5:U||bc(n,t);case 6:var r=G,i=Mc;G=null,Nc(e,t,n),G=r,Mc=i,G!==null&&(Mc?(e=G,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):G.removeChild(n.stateNode));break;case 18:G!==null&&(Mc?(e=G,n=n.stateNode,e.nodeType===8?Bi(e.parentNode,n):e.nodeType===1&&Bi(e,n),Sn(e)):Bi(G,n.stateNode));break;case 4:r=G,i=Mc,G=n.stateNode.containerInfo,Mc=!0,Nc(e,t,n),G=r,Mc=i;break;case 0:case 11:case 14:case 15:if(!U&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&xc(n,t,o),i=i.next}while(i!==r)}Nc(e,t,n);break;case 1:if(!U&&(bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Nc(e,t,n);break;case 21:Nc(e,t,n);break;case 22:n.mode&1?(U=(r=U)||n.memoizedState!==null,Nc(e,t,n),U=r):Nc(e,t,n);break;default:Nc(e,t,n)}}function Fc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ic(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=s),r&=~o}if(r=a,r=O()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wc(r/1960))-r,10e?16:e,ll===null)var r=!1;else{if(e=ll,ll=null,ul=0,K&6)throw Error(i(331));var a=K;for(K|=4,W=e.current;W!==null;){var o=W,s=o.child;if(W.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lO()-nl?El(e,0):$c|=n),Q(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Vt,Vt<<=1,!(Vt&130023424)&&(Vt=4194304)):t=1);var n=Z();e=lo(e,t),e!==null&&(Yt(e,t,n),Q(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||ia.current)Us=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Us=!1,dc(e,t,n);Us=!!(e.flags&131072)}}else Us=!1,F&&t.flags&1048576&&ka(t,Sa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;lc(e,t),e=t.pendingProps;var a=oa(t,P.current);io(t,n),a=Bo(null,t,r,e,a,n);var o=Vo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,sa(r)?(o=!0,da(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,fo(t),a.updater=Os,t.stateNode=a,a._reactInternals=t,Ms(t,r,e,n),t=Zs(null,t,r,!0,o,n)):(t.tag=0,F&&o&&Aa(t),V(null,t,a,n),t=t.child),t;case 16:r=t.elementType;a:{switch(lc(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Jl(r),e=Es(r,e),a){case 0:t=Ys(null,t,r,e,n);break a;case 1:t=Xs(null,t,r,e,n);break a;case 11:t=Ws(null,t,r,e,n);break a;case 14:t=Gs(null,t,r,Es(r.type,e),n);break a}throw Error(i(306,r,``))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Ys(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Xs(e,t,r,a,n);case 3:a:{if(Qs(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,a=o.element,po(e,t),vo(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ns(Error(i(423)),t),t=$s(e,t,r,n,a);break a}if(r!==a){a=Ns(Error(i(424)),t),t=$s(e,t,r,n,a);break a}for(Na=Vi(t.stateNode.containerInfo.firstChild),Ma=t,F=!0,Pa=null,n=Xa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ha(),r===a){t=uc(e,t,n);break a}V(e,t,r,n)}t=t.child}return t;case 5:return Do(t),e===null&&Ra(t),r=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Pi(r,a)?s=null:o!==null&&Pi(r,o)&&(t.flags|=32),Js(e,t),V(e,t,s,n),t.child;case 6:return e===null&&Ra(t),null;case 13:return nc(e,t,n);case 4:return To(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ya(t,null,r,n):V(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Ws(e,t,r,a,n);case 7:return V(e,t,t.pendingProps,n),t.child;case 8:return V(e,t,t.pendingProps.children,n),t.child;case 12:return V(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,N(Za,r._currentValue),r._currentValue=s,o!==null){if(Br(o.value,s)){if(o.children===a.children&&!ia.current){t=uc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=mo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),ro(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(i(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),ro(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}V(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,io(t,n),a=ao(a),r=r(a),t.flags|=1,V(e,t,r,n),t.child;case 14:return r=t.type,a=Es(r,t.pendingProps),a=Es(r.type,a),Gs(e,t,r,a,n);case 15:return Ks(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),lc(e,t),t.tag=1,sa(r)?(e=!0,da(t)):e=!1,io(t,n),As(t,r,a),Ms(t,r,a,n),Zs(null,t,r,!0,e,n);case 19:return cc(e,t,n);case 22:return qs(e,t,n)}throw Error(i(156,t.tag))};function Wl(e,t){return wt(e,t)}function Gl(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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===fe)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(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 Xl(e,t,n,r,a,o){var s=2;if(r=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ae:return Zl(n.children,a,o,t);case oe:s=8,a|=8;break;case se:return e=Kl(12,n,t,a|2),e.elementType=se,e.lanes=o,e;case x:return e=Kl(13,n,t,a),e.elementType=x,e.lanes=o,e;case de:return e=Kl(19,n,t,a),e.elementType=de,e.lanes=o,e;case me:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ce:s=10;break a;case le:s=9;break a;case ue:s=11;break a;case fe:s=14;break a;case pe:s=16,r=null;break a}throw Error(i(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){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=Jt(0),this.expirationTimes=Jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},fo(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ie()})),oe=t((e=>{var t=ae();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),se=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new p({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ce(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){u.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>d(t,e))}findAll(e={}){return this.getAll().filter(t=>d(e,t))}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return u.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function ce(e){return e.options.scope?.id}var le=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new v({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){u.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){u.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){u.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new le,this.#t=e.mutationCache||new se,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=i.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=l.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(te(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return u.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;u.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return u.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=u.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return u.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=u.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(te(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return l.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(m(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{b(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(m(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{b(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=f(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===a&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},x=e(n(),1),de=e(oe(),1),fe=class extends Error{status;method;path;code;detail;constructor(e,t,n,r,i=``,a=``){super(e),this.name=`ApiError`,this.status=t,this.method=n,this.path=r,this.code=i,this.detail=a}};function pe(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{detail:``,code:``};try{let t=JSON.parse(e),n=t.detail&&typeof t.detail==`object`&&!Array.isArray(t.detail)?t.detail:void 0,r=typeof t.code==`string`&&t.code.trim()?t.code.trim():typeof n?.code==`string`?n.code.trim():``;if(n)for(let e of[`message`,`detail`]){let t=n[e];if(typeof t==`string`&&t.trim())return{detail:t.trim(),code:r}}for(let e of[`detail`,`error`,`message`]){let n=t[e];if(typeof n==`string`&&n.trim())return{detail:n.trim(),code:r};if(Array.isArray(n)){let e=n.map(e=>e&&typeof e==`object`?String(e.msg??``):``).filter(Boolean);if(e.length)return{detail:e.join(`; `),code:r}}}return{detail:``,code:r}}catch{}return{detail:t.startsWith(``u`?``:window.location.search).get(`reader_preview`);return e===`source-first`||e===`learning-path`||e===`question-foundation`?e:null}function S(e,t,n,r,i=ge(),a){let o=[`map-copy`,e,t,n,r];return i===`question-foundation`?[...o,i,a??null]:i?[...o,i]:o}var _e=`0.1.8+e27ef5d920bdac81`,ve=!1,ye=new Set,be=()=>ve,xe=e=>(ye.add(e),()=>{ye.delete(e)});function Se(e){ve||!e||e===`unknown`||e===`0.1.8+e27ef5d920bdac81`||(ve=!0,ye.forEach(e=>e()))}var Ce=class extends Error{constructor(){super(`页面已更新,请刷新后继续。 / This page has been updated. Refresh to continue.`),this.name=`PageUpdateRequiredError`}};function we(){if(ve)throw new Ce}var Te={name:`argus.webapi`,major:1,minServerMinor:16},Ee=[`daemon.admission.v1`,`daemon.status.protocol.v1`,`daemon.command.v1`,`daemon.upgrade-schedule.v1`,`cost.admission.v1`,`event.catalog.v1`,`event.payload-schema.v1`,`manager.sse.v1`,`manager.request-cancel.v1`,`advisor.config.v1`,`metrics.slo.v2`,`mission.view.v1`,`mission.abort.v1`,`project.attachments.v1`,`project.git-diff.v1`,`project.cost-feed.v1`,`project.counterexamples.v1`,`project.workdir.v1`,`research.events.v1`,`release.identity.v1`,`snapshot.schema.v1`,`source.update.v1`,`usage.recorded.v2`,`verticals.store.v1`],De=`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`;function Oe(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function ke(e){return typeof e==`number`&&Number.isInteger(e)?e:null}function Ae(e,t){let n=Oe(e),r=Oe(n?.protocol),i=Oe(n?.runtime),a=Array.isArray(n?.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],o=ke(r?.major),s=ke(r?.minor);if(!n||!r||!i)return{compatible:!1,reason:`malformed /api/meta response`};if(typeof i.source_root!=`string`||ke(i.pid)===null||typeof i.package_version!=`string`||typeof i.release_id!=`string`)return{compatible:!1,reason:`malformed /api/meta runtime identity`};if(n.service!==`argus-skill-webapi`)return{compatible:!1,reason:`unexpected service ${String(n.service||`unknown`)}`};let c=e;if(r.name!==Te.name||o!==Te.major)return{compatible:!1,reason:`protocol ${String(r.name||`unknown`)}/${String(o)} is incompatible with client ${Te.name}/${Te.major}`,meta:c};if(s===null||s!a.includes(e));if(l.length>0)return{compatible:!1,reason:`missing capabilities: ${l.join(`, `)}`,meta:c};if(i.source_root_matches_config===!1)return{compatible:!1,reason:`backend is running from a different installation than configured`,meta:c};if(t&&i.release_id!==t.releaseId)return{compatible:!1,reason:`backend and client installations are out of sync; restart or reinstall Argus`,meta:c};if(t?.sourceDigest){if(typeof i.runtime_source_digest!=`string`||!i.runtime_source_digest)return{compatible:!1,reason:`backend cannot verify this local installation; restart it from the current checkout`,meta:c};if(i.runtime_source_digest!==t.sourceDigest)return{compatible:!1,reason:`backend is running code from a different local installation; restart it`,meta:c}}let u=i.release_matches_source===!1?De:void 0;return{compatible:!0,reason:``,...u?{warning:u}:{},meta:c}}function je(e,t,n){let r=Ae(e,t);if(!r.compatible||!r.meta)throw Error(`incompatible Argus API: ${r.reason}`);return r.warning&&n?.(r.warning),r.meta}function Me(e){let t=Oe(e),n=Oe(t?.daemon);if(!t||t.schema_version!==7)throw Error(`incompatible snapshot schema: expected 7, got ${String(t?.schema_version??`missing`)}`);if(!n)throw Error(`invalid snapshot: daemon section is missing`);let r=[`read_status`,`read_error`,`protocol_compatible`,`protocol_error`].filter(e=>!Object.hasOwn(n,e));if(r.length>0)throw Error(`invalid snapshot: daemon fields missing: ${r.join(`, `)}`);let i=[`spend_usd`,`spend_status`,`usage_summary`,`daemon_commands`,`observability`,`mission_view`,`partial`,`diagnostics`].filter(e=>!Object.hasOwn(t,e));if(i.length>0)throw Error(`invalid snapshot: fields missing: ${i.join(`, `)}`);if(!Array.isArray(t.diagnostics))throw Error(`invalid snapshot: diagnostics must be an array`);return e}function Ne(e,t){return je(e,{releaseId:_e},t)}function Pe(e,t){let n=`/api/application-workflows`,r=e=>`${n}/${encodeURIComponent(e)}`;return{catalog:()=>e(n),create:e=>t(n,e),open:e=>t(`${n}/open`,{project:e}),snapshot:t=>e(r(t)),action:(e,n)=>t(r(e),n),document:(t,n)=>e(`${r(t)}/document?path=${encodeURIComponent(n)}`)}}var Fe=`verticals.store.v1`,Ie=`argus_web_token`,Le=null;function Re(){let e;try{e=new URLSearchParams(window.location.search)}catch{return}let t=e.get(`token`);if(t){Le=t;try{localStorage.setItem(Ie,t)}catch{}try{e.delete(`token`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)}catch{}}}var ze=()=>{if(Le)return Le;try{return new URLSearchParams(window.location.search).get(`token`)||localStorage.getItem(Ie)}catch{return null}};function Be(){let e=ze();return e?{Authorization:`Bearer ${e}`}:{}}function Ve(){return ze()??``}var He=8e3,Ue=12e3,We=class extends Error{constructor(){super(`This browser is not paired with Argus. Open a valid pairing link or enter a pairing token.`),this.name=`PairingRequiredError`}},Ge=class extends Error{method;path;constructor(e,t,n=`could not reach the local Argus service`){super(`${e.toUpperCase()} ${t} ${n}. Make sure Argus Desktop is running, then retry.`),this.name=`LocalArgusUnavailableError`,this.method=e.toUpperCase(),this.path=t}};function Ke(e){return e instanceof We||!!(e&&typeof e==`object`&&Number(e.status)===401)}function qe(e){return Ke(e)||e instanceof Ge}async function Je(e,t){let n;try{n=await fetch(e,t)}catch(n){throw t.signal?.aborted?n:new Ge(String(t.method??`GET`),e)}return n.ok&&(Se(n.headers.get(`X-Argus-Release`)),(!t.method||t.method===`GET`)&&we()),n}async function Ye(e,t,n,r){let i=new AbortController,a=t.signal??void 0,o=!1,s=()=>{};if(a){let e=()=>i.abort(a.reason);a.aborted?e():(a.addEventListener(`abort`,e,{once:!0}),s=()=>a.removeEventListener(`abort`,e))}let c,l=(async()=>await r(await Je(e,{...t,signal:i.signal})))(),u=new Promise((e,t)=>{c=setTimeout(()=>{o=!0;let e=Error(`request timed out after ${n}ms`);i.abort(e),t(e)},n)});try{return await Promise.race([l,u])}catch(r){if(o){let r=Math.round(n/1e3);throw new Ge(String(t.method??`GET`),e,`timed out after ${r}s because the local Argus service did not respond`)}throw r}finally{c&&clearTimeout(c),s()}}async function C(e,t,n){return Ye(e,{headers:Be(),signal:t},n??Ue,async t=>(await he(t,`GET`,e),await t.json()))}async function Xe(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:t===void 0?void 0:JSON.stringify(t),signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),r}async function w(e,t,n){return await(await Xe(e,t,n)).json()}async function Ze(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:Be(),body:t,signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),await r.json()}function Qe(e){let t=e&&typeof e==`object`?e:{},n=String(t.command_status??``);if(Number(t.rc??0)!==0||n===`failed`||n===`rejected`)throw Error(String(t.error||`daemon command ${n||`failed`}`));return e}async function $e(e,t,n){we();let r=await fetch(t,{method:e,headers:{"Content-Type":`application/json`,...Be()},body:n===void 0?void 0:JSON.stringify(n)});return await he(r,e,t),Se(r.headers.get(`X-Argus-Release`)),await r.json()}async function et(e,t){let n=await fetch(e,{headers:Be(),signal:t});return await he(n,`GET`,e),n.blob()}var T=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`;function tt(e,t){let n=new URLSearchParams({path:t}),r=Ve();return r&&n.set(`token`,r),T(e,`/artifact/preview/page?${n.toString()}`)}var nt=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,rt=nt,it;function at(e){return!!(e&&typeof e==`object`&&`aborted`in e&&typeof e.aborted==`boolean`)}function ot(e,t,n,r){let i={text:e};return t?.length&&(i.attachments=t),n&&n!==`auto`&&(i.route_override=n),r&&(i.request_id=r),i}function st(){if(!it){let e=(async()=>{let e=`/api/meta`,t=await Ye(e,{headers:Be()},He,async t=>{if(t.status===404)throw Error(`incompatible Argus API: service does not expose /api/meta`);await he(t,`GET`,e);let n=await t.json();return Se(n?.runtime?.release_id),Ne(n,e=>{e!==`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`&&console.warn(`Argus API compatibility warning: ${e}`)})});if(t.authentication?.required&&!t.authentication.authenticated)throw new We;return t})();it=e,e.catch(t=>{it===e&&!(t instanceof We)&&(it=void 0)})}return it}var ct=new Set([`waiting_for_source`,`planning`,`writing`,`reviewing`]);function lt(e){let t=[],n;for(;n=/\r?\n\r?\n/.exec(e);){let r=e.slice(0,n.index);e=e.slice(n.index+n[0].length);for(let e of r.split(` +`)){let n=e.trim();if(n.startsWith(`data:`))try{t.push(JSON.parse(n.slice(5).trim()))}catch{}}}return{frames:t,rest:e}}async function ut(e,t,n,r){if(!e.body)throw Error(`${t} returned no response body`);let i=e.body.getReader(),a=new TextDecoder,o=``,s,c=!1;try{for(;;){r?.throwIfAborted();let{done:e,value:l}=await i.read();c=e,r?.throwIfAborted(),o+=e?a.decode()+` + +`:a.decode(l,{stream:!0});let u=lt(o);o=u.rest;for(let e of u.frames)n?.(e),(e.type===`done`||e.type===`error`)&&(s=e);if(e){if(!s)throw Error(`${t} ended before a terminal event`);return s}}}finally{c||await i.cancel().catch(()=>{}),i.releaseLock()}}var dt=null;function ft(e,t,n,r,i=ge(),a){let o=new URLSearchParams(n);return r&&o.set(`session_id`,r),i===`source-first`&&o.set(`preview`,`true`),i===`learning-path`&&o.set(`preview`,`learning-path`),i===`question-foundation`&&(o.set(`preview`,`question-foundation`),a&&o.set(`foundation_id`,a)),`/api/map-copy/${e}/${encodeURIComponent(t)}?${o}`}async function pt(e,t,n,r){let i=await Xe(e,t,n),a=!1,o=await ut(i,`Explanation stream`,e=>{(e.type===`done`||e.type===`error`)&&(a=!0),!a&&e.type===`progress`&&ct.has(e.phase)&&r?.(e.phase)},n);if(o.type===`error`){let t=o.error&&typeof o.error==`object`?o.error:void 0;throw new fe(String(t?.message??o.error??`Explanation failed`),typeof o.status==`number`?o.status:0,`POST`,e,typeof t?.code==`string`?t.code:``)}return o.result}var E={workflows:Pe(C,w),advisorSettings:(e,t)=>C(T(e,`/advisor/config`),t),saveAdvisorSettings:(e,t)=>w(T(e,`/advisor/config`),t),liveMap:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r?.mode===`current`&&(i.set(`since`,String(r.since)),i.set(`event_since`,String(r.eventSince)),r.taskId&&i.set(`start_task`,r.taskId)),C(T(e,`/map`)+(i.size?`?${i}`:``),t)},mapInfo:(e,t)=>C(T(e,`/map-info`),t),mapHistory:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r&&i.set(`task_after`,r),C(T(e,`/map-history`)+(i.size?`?${i}`:``),t)},mapCopy:(e,t,n,r,i,a,o)=>C(ft(e,t,{locale:n},i,a,o),r),mapCardWords:(e,t,n,r,i)=>w(`/api/map-cards/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapLines:(e,t,n,r,i)=>w(`/api/map-lines/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapQuestionSource:(e,t,n)=>w(`/api/map-question-source/project/${encodeURIComponent(e)}?session_id=${encodeURIComponent(e)}`,{...t,preview:t.preview===`source-first`?!0:t.preview??!1},n),generateMapCopy:(e,t,n,r,i,a,o)=>pt(ft(e,t,{stream:`true`},i,a,n.foundation_id),n,r,o),generateReaderFoundation:(e,t,n)=>pt(T(e,`/reader-foundation?stream=true`),t,void 0,n),askReaderFoundation:(e,t,n,r)=>pt(T(e,`/reader-foundation/${encodeURIComponent(t)}/question?stream=true`),n,void 0,r),mapDatasets:e=>C(`/api/map-datasets`,e),mapDataset:(e,t)=>C(`/api/map-datasets/${encodeURIComponent(e)}`,t),meta:st,projectIndex:async()=>(await st(),C(`/api/projects`,void 0,Ue)),listProjects:async()=>(await st(),C(`/api/projects`,void 0,Ue).then(e=>e.projects)),projectCosts:async e=>(await st(),C(`/api/projects/costs`,e)),createDaemon:async(e,t=``,n=``,r)=>{let i=`/api/daemons`,a={objective:e,name:t,workdir:n,command_id:rt(),expected_revision:r},o=()=>fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify(a),cache:`no-store`}),s=await o();return s.status===400&&/Invalid HTTP request received/i.test(await s.clone().text())&&(s=await o()),await he(s,`POST`,i),Qe(await s.json())},updateProject:(e,t)=>$e(`PATCH`,T(e),{name:t}),deleteProject:e=>$e(`DELETE`,T(e)),snapshot:async(e,t,n=!1)=>(await st(),Me(await C(T(e,`/snapshot?compact=true&events_limit=1${n?`&prewarm=true`:``}`),t,Ue))),activeSnapshot:async(e,t)=>{let n=dt!==e;n&&(dt=e);try{return await E.snapshot(e,t,n)}catch(t){throw n&&dt===e&&(dt=null),t}},prefetchSnapshot:(e,t)=>E.snapshot(e,t,!1),status:(e,t)=>C(T(e,`/status`),t),journal:(e,t=20,n)=>C(T(e,`/journal?n=${t}`),n).then(e=>e.journal),doctor:(e,t)=>C(T(e,`/doctor`),t),config:(e,t)=>C(T(e,`/config`),t),identity:(e,t)=>C(T(e,`/identity`),t).then(e=>e.identity),transcript:(e,t=30,n)=>C(T(e,`/transcript?n=${t}`),n).then(e=>e.turns),events:(e,t=80,n)=>C(T(e,`/events?limit=${t}&view=ui`),n).then(e=>e.events),workRecord:(e,t,n,r)=>C(T(e,`/work-record?role=${encodeURIComponent(t)}&record_id=${encodeURIComponent(n)}`),r),downloadWorkLog:async(e,t,n=``)=>{let r=T(e,`/work-log/download?role=${encodeURIComponent(t)}&task_id=${encodeURIComponent(n)}`),i=await fetch(r,{headers:Be(),cache:`no-store`});await he(i,`GET`,r);let a=URL.createObjectURL(await i.blob()),o=document.createElement(`a`);o.href=a,o.download=`work-records.md`,o.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)},backlogItem:(e,t,n)=>C(T(e,`/backlog/${encodeURIComponent(t)}`),n).then(e=>e.item),artifacts:(e,t,n=!1)=>C(T(e,`/artifacts${n?`?include_reading=true`:``}`),t).then(e=>e.artifacts),artifact:(e,t,n)=>C(T(e,`/artifact?${new URLSearchParams({path:t})}`),n),artifactPreview:(e,t,n)=>C(T(e,`/artifact/preview?${new URLSearchParams({path:t})}`),n),artifactBundle:(e,t,n)=>et(T(e,`/artifact/bundle?${new URLSearchParams({path:t})}`),n),artifactBlob:(e,t,n=!1,r)=>{let i=new URLSearchParams({path:t});return n&&i.set(`download`,`true`),et(T(e,`/artifact/raw?${i}`),r)},gitDiff:(e,t)=>C(T(e,`/git-diff`),t),deliveryDiff:(e,t,n)=>C(T(e,`/delivery-diff?${new URLSearchParams(t)}`),n),metrics:e=>C(`/api/metrics`,e),sourceUpdateStatus:e=>C(`/api/runtime/source-update`,e),checkSourceUpdate:()=>w(`/api/runtime/source-update/check`),applySourceUpdate:()=>w(`/api/runtime/source-update/apply`),resources:e=>C(`/api/system/resources`,e),trash:(e=``,t=100,n=0,r)=>C(`/api/trash?${new URLSearchParams({query:e,limit:String(t),offset:String(n)})}`,r),restoreTrash:e=>w(`/api/trash/${encodeURIComponent(e)}/restore`),verticals:e=>C(`/api/verticals`,e),refreshVerticalCatalog:()=>w(`/api/verticals/catalog/refresh`),manageVertical:(e,t,n={})=>w(`/api/verticals/${encodeURIComponent(e)}/manage/${t}`,n.force?{force:!0}:{}),verticalOperation:(e,t)=>C(`/api/verticals/${encodeURIComponent(e)}/operation`,t),addTask:(e,t)=>w(T(e,`/tasks`),{text:t}).then(e=>e.item),abortMission:(e,t)=>w(T(e,`/mission/abort`),{reason:t}),mapNotes:(e,t)=>C(T(e,`/map-notes`),t),addMapNote:(e,t)=>w(T(e,`/map-notes`),t),answerPending:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/answer`),{text:n}),resolveDecision:(e,t,n,r)=>w(T(e,`/decisions/${encodeURIComponent(t)}/resolve`),{option_id:n,note:r}),uploadAttachments:async(e,t,n)=>{await st();let r=new FormData;return t.forEach(e=>r.append(`files`,e,e.name)),Ze(T(e,`/attachments`),r,n)},answerDomain:(e,t,n,r)=>w(T(e,`/message`),{text:r||n,domain_answer:{id:t,option_id:n,note:r}}),message:(e,t,n)=>{let r=at(n)?n:n?.signal,i=at(n)?void 0:n?.attachments,a=at(n)?void 0:n?.routeOverride,o=at(n)?void 0:n?.requestId;return w(T(e,`/message`),ot(t,i,a,o),r)},cancelMessage:(e,t)=>Ye(T(e,`/message/cancel`),{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify({request_id:t})},5e3,async t=>(await he(t,`POST`,T(e,`/message/cancel`)),await t.json())),messageStream:async(e,t,n,r)=>{let i=at(r)?r:r?.signal,a=at(r)?void 0:r?.attachments,o=at(r)?void 0:r?.routeOverride,s=at(r)?void 0:r?.requestId;await ut(await Xe(T(e,`/message/stream`),ot(t,a,o,s),i),`Manager stream`,e=>{if(!i?.aborted){if(e.type===`phase`){let t=Number(e.quiet_s??0);n.onPhase?.(String(e.label??``),String(e.role??`manager`),{heartbeat:e.heartbeat===!0,quietS:Number.isFinite(t)?t:0,kind:String(e.kind??``),detail:String(e.detail??``),tool:String(e.tool??``),toolKind:String(e.tool_kind??``),callId:String(e.call_id??``),status:String(e.status??``),output:String(e.output??``)})}else e.type===`delta`?n.onDelta?.(String(e.text??``),String(e.message_id??``),String(e.fragment_mode??`auto`)):e.type===`done`?n.onDone?.(e.result??{}):e.type===`error`&&n.onError?.(Error(String(e.error??`stream error`)))}},i)},nudge:(e,t)=>w(T(e,`/nudge`),{text:t}),queueFollowup:(e,t,n=`auto`)=>w(T(e,`/message/followup`),{text:t,route_override:n}),note:(e,t)=>w(T(e,`/note`),{text:t}),previewPlan:(e,t)=>w(T(e,`/plan`),{text:t}),rewritePrompt:(e,t)=>w(T(e,`/prompt/rewrite`),{text:t}),setConfig:(e,t,n,r=!1)=>w(T(e,`/config/set`),r?{name:t,value:n,apply_to_roles:!0}:{name:t,value:n}),setIdentity:(e,t)=>w(T(e,`/identity`),{text:t}),resetManager:e=>w(T(e,`/reset`)),skills:(e,t=`ls`)=>w(T(e,`/skills`),{args:t}).then(e=>e.text),skillLibrary:(e,t)=>C(`/api/skill-library${e?`?sid=${encodeURIComponent(e)}`:``}`,t),skillDocument:(e,t,n,r)=>C(`/api/skill-library/document?${new URLSearchParams({library:t,path:n,...e?{sid:e}:{}})}`,r),researchMethod:(e,t)=>C(T(e,`/research/method`),t),wiki:(e,t)=>C(T(e,`/wiki`),t),wikiPage:(e,t,n)=>C(T(e,`/wiki/page?${new URLSearchParams({path:t})}`),n),wikiLibrary:(e,t)=>C(`/api/wiki${e?`?sid=${encodeURIComponent(e)}`:``}`,t),wikiDocument:(e,t,n,r,i)=>C(`/api/wiki/page?${new URLSearchParams({scope:t,vertical:n,path:r,...e?{sid:e}:{}})}`,i),knowledgeFeed:(e=50,t)=>C(`/api/knowledge/feed?${new URLSearchParams({limit:String(e)})}`,t),learningStatus:(e,t)=>C(T(e,`/learning`),t),retryLearning:(e,t)=>w(T(e,`/learning/${encodeURIComponent(t)}/retry`),{}),setLaunchCwd:(e,t)=>w(T(e,`/launch-cwd`),{launch_cwd:t}),setWorkdir:(e,t)=>w(T(e,`/workdir`),{workdir:t}),disposeBacklog:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/dispose`),{op:n}),stopBacklog:(e,t)=>w(T(e,`/backlog/${encodeURIComponent(t)}/stop`)),setContinuous:(e,t,n=``)=>w(T(e,`/continuous`),{enabled:t,objective:n}).then(e=>{if(!t)return e;if(!e.daemon)throw Error(`daemon start returned no result`);return Qe(e.daemon),e}),startDaemon:(e,t)=>w(T(e,`/daemon/start`),{command_id:rt(),expected_revision:t}).then(Qe),stopDaemon:(e,t=!1,n,r=!1)=>w(T(e,`/daemon/stop`),{drain:t,force:r,command_id:rt(),expected_revision:n}).then(Qe),replaceDaemon:(e,t,n=!1,r)=>w(T(e,`/daemon/replace`),{victim_sid:t,resume_continuous:n,command_id:rt(),expected_revision:r}).then(Qe),upgradeDaemon:(e,t)=>w(T(e,`/daemon/upgrade`),{command_id:rt(),expected_revision:t}).then(Qe)},mt=new Set([4401,4404]);function ht(e,t,n={}){let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=new URLSearchParams;n.replay!=null&&i.set(`replay`,String(n.replay)),i.set(`view`,`ui`);let a=ze();a&&i.set(`token`,a);let o=`${r}//${window.location.host}${T(e,`/stream`)}?${i}`,s=null,c=!1,l,u=()=>{c||(s=new WebSocket(o),s.onopen=()=>n.onOpen?.(),s.onmessage=e=>{try{let n=JSON.parse(e.data);n&&typeof n==`object`&&t(n)}catch{}},s.onclose=e=>{let t=!mt.has(e.code);n.onClose?.({code:e.code,reason:e.reason,retryable:t}),!c&&t&&(l=setTimeout(u,1e3))},s.onerror=()=>s?.close())};return u(),()=>{c=!0,l&&clearTimeout(l),s?.close()}}var gt={schema:1,id:`argus`,name:`Argus`,tagline:`Autonomous Work Lab`,terminal_wordmark:`argus`,assets:{}};function _t(e){if(!e||typeof e!=`object`)throw Error(`Invalid application brand`);let t=e;if(t.schema!==1||typeof t.id!=`string`||!/^[a-z][a-z0-9-]{0,39}$/.test(t.id))throw Error(`Invalid application brand identity`);for(let[e,n]of[[`name`,48],[`tagline`,100],[`terminal_wordmark`,24]]){let r=t[e];if(typeof r!=`string`||!r.trim()||r.length>n||/[\x00-\x1f\x7f-\x9f]/.test(r))throw Error(`Invalid application brand ${e}`)}if(!/^[a-z0-9 -]+$/.test(String(t.terminal_wordmark)))throw Error(`Invalid terminal wordmark`);if(!t.assets||typeof t.assets!=`object`||Array.isArray(t.assets))throw Error(`Invalid application brand assets`);let n={};for(let e of[`mark`,`mark_dark`,`logo`,`logo_dark`,`icon`,`icon_dark`]){let r=t.assets[e];if(r!==void 0&&r!==`/api/application-brand/assets/${e}`)throw Error(`Invalid application brand asset ${e}`);if(typeof r==`string`)n[e]=r;else if(t.id!==`argus`)throw Error(`Missing application brand asset ${e}`)}return{schema:1,id:t.id,name:String(t.name),tagline:String(t.tagline),terminal_wordmark:String(t.terminal_wordmark),assets:n}}var vt=gt,yt=()=>vt;async function bt(){let e=await fetch(`/api/application-brand`,{cache:`no-store`});if(!e.ok)throw Error(`Application identity unavailable (${e.status})`);if(vt=_t(await e.json()),vt.id!==`argus`){document.title=`${vt.name} · Workbench`,document.querySelector(`meta[name="apple-mobile-web-app-title"]`)?.setAttribute(`content`,vt.name),document.querySelector(`link[rel="manifest"]`)?.setAttribute(`href`,`/api/application-brand/manifest.webmanifest`);for(let e of document.querySelectorAll(`link[rel="icon"], link[rel="apple-touch-icon"]`))e.href=e.media.includes(`dark`)?vt.assets.icon_dark:vt.assets.icon,e.removeAttribute(`type`)}}var D=r(),xt=`argus.locale`,St={"language.english":`English`,"handshake.connecting":`Getting Argus ready`,"handshake.service":`Service`,"handshake.project":`Project`,"handshake.ready":`Ready`,"handshake.title":`Getting Argus ready`,"handshake.detail":`Reopening your workspace…`,"splash.starting":`Argus starting`,"rail.workbench":`Workbench`,"rail.sessionsShortcut":`Sessions · Ctrl/⌘ P`,"panel.backlog":`Backlog`,"panel.activity":`Activity`,"panel.journal":`Journal`,"panel.roles":`Roles`,"panel.project":`Project`,"panel.liveView":`Manager live project view`,"stream.jumpToLatest":`Jump to latest`,"stream.toggleReasoning":`Show or hide agent reasoning (⌘T)`,"stream.reasoning":`Reasoning`,"stream.noLogs":`No activity yet`,"stream.system":`Argus updates`,"stream.autonomous":`Background activity`,"stream.backgroundWork":`Argus is working in the background`,"stream.ready":`Argus is ready. Ask a question or assign work.`,"stream.historyLoading":`Loading conversation history…`,"stream.historyError":`Could not load conversation history.`,"stream.historyRetry":`Retry`,"stream.fold.read":`Read {count} files`,"stream.fold.search":`Searched {count} times`,"stream.fold.fetch":`Looked up {count} web pages`,"stream.fold.edit":`Edited {count} files`,"stream.fold.tool":`Used {tool} {count} times`,"stream.fold.failed":`{count} failed`,"stream.fold.expand":`Show each step`,"stream.fold.collapse":`Hide the steps`,"stream.repeated":`Repeated {count} times; showing the latest`,"stream.stepFailed":`failed`,"stream.stepResult":`Result`,"common.showRaw":`Show raw output`,"doctor.lastEntry":`Last entry`,"operations.metric.calls":`model calls today`,"operations.metric.failed":`failed`,"operations.metric.slowest":`slowest typical call`,"operations.slo.healthy":`Healthy`,"operations.slo.degraded":`Needs attention`,"operations.slo.loading":`Loading…`,"operations.validationFailures":`{count} malformed events today`,"operations.outputLines":`{count} lines of output`,"operations.done":`Done.`,"newDaemon.workdirPlaceholder":`Blank → ~/.argus-skill/workspaces/`,"operations.resetManager":`Reset Manager context`,"language.chinese":`中文`,"language.switchTo":`Switch to {language}`,"common.loading":`Loading…`,"common.retry":`Retry`,"common.save":`Save`,"common.cancel":`Cancel`,"common.close":`Close`,"common.settings":`Settings`,"common.ready":`Ready`,"common.live":`Live`,"common.reconnecting":`Reconnecting`,"common.stale":`Snapshot stale`,"common.degraded":`Snapshot degraded`,"common.external":`External`,"common.pause":`Pause`,"common.run":`Run`,"common.working":`Working`,"common.local":`Local`,"common.all":`All`,"common.unassigned":`Unassigned`,"common.closeSessions":`Close sessions`,"common.resizeSessions":`Resize sessions`,"common.resizePreview":`Resize preview`,"common.expandPreview":`Expand preview`,"time.justNow":`just now`,"time.minutesAgo":`{count}m ago`,"time.hoursAgo":`{count}h ago`,"time.yesterdayAt":`Yesterday at {time}`,"connection.pairingTitle":`This browser is not paired with Argus`,"connection.pairingDetail":`Open a valid pairing link for this Argus site, or paste the link or token below.`,"connection.pairAgain":`Pair again`,"connection.pairingInput":`Pairing link or token`,"connection.pairingPlaceholder":`Paste a fresh pairing link or token`,"connection.pairingInvalid":`Enter a valid pairing link or token.`,"connection.connect":`Connect`,"connection.unreachableTitle":`The local Argus service is unavailable`,"connection.unreachableDetail":`Keep Argus Desktop running, wait for the local service to become ready, then retry.`,"sidebar.collapse":`Collapse sessions`,"sidebar.expand":`Expand sessions`,"sidebar.create":`Create project`,"sidebar.find":`Find a project`,"sidebar.clearSearch":`Clear search`,"sidebar.refreshFailed":`Refresh failed · retry`,"sidebar.noSessions":`No sessions`,"sidebar.noMatches":`No sessions matching "{query}"`,"sidebar.unnamedSession":`Unnamed session`,"sidebar.daemonAlive":`Argus background is online`,"sidebar.updateRequired":`Update required`,"sidebar.updateAvailable":`Update available`,"sidebar.updateAvailableHint":`The executor is still running with a different release from this page.`,"sidebar.stopped":`Background stopped`,"sidebar.runningFor":`Background online · {uptime}`,"sidebar.lastActive":`Last active {time}`,"sidebar.manage":`Manage {name}`,"sidebar.manageHint":`Rename, pause, or delete`,"sidebar.resume":`Resume`,"sidebar.resumeHint":`Resume work in {workdir}`,"sidebar.resumeSuccess":`Session resumed.`,"sidebar.resumeFailed":`Could not resume session: {error}`,"sidebar.modelLoading":`Loading backend and model…`,"sidebar.modelUnavailable":`Backend and model unavailable`,"sidebar.defaultModel":`default model`,"sidebar.openSettings":`Open settings`,"sidebar.compute":`Compute queue & allowance`,"sidebar.theme":`{current} theme; switch to {next}`,"landing.selectOrCreate":`Select a session from the sidebar, or create a new one.`,"landing.noSessions":`No sessions yet. Create one to begin.`,"landing.select":`Select project`,"landing.new":`New project`,"landing.menu":`Open menu`,"project.missingSwitched":`Project “{requested}” was not found. Switched to {fallback}.`,"project.missingCreate":`Project “{requested}” was not found. Create a project to continue.`,"topbar.openSessions":`Open projects`,"topbar.externallyManaged":`Externally managed`,"topbar.pauseDaemon":`Pause Argus`,"topbar.runDaemon":`Run Argus`,"topbar.working":`Argus is working on your request`,"topbar.roleActive":`{role} is active`,"topbar.roleIdle":`{role} is idle`,"topbar.externalDaemonHint":`Argus is managed outside this app and must be controlled there.`,"topbar.manageSession":`Manage session`,"topbar.showPreview":`Show preview`,"topbar.showActivity":`Show activity`,"mobile.views":`Views`,"mobile.sessions":`Projects`,"mobile.mission":`Mission`,"mobile.activity":`Conversation`,"mobile.workbench":`Workbench`,"mobile.map":`Map`,"mobile.preview":`Files`,"chat.working":`Argus is working on your message`,"chat.workingQuiet":`Argus is working on your message · Still working; no new update for {quiet}s`,"chat.stopWaitingHint":`Esc stop reply · Enter sends a follow-up`,"chat.queuedWhileRunning":`Queued · answered right after this reply; a running task can be steered by it`,"chat.attachWhileRunning":`Attachments can be sent once this reply finishes`,"chat.stepsLive":`Working · {count} steps so far`,"chat.stepsDone":`{count} steps · {seconds}`,"chat.stepFailed":`failed`,"chat.stepRaw":`raw`,"chat.messageArgus":`message Argus`,"chat.selectSession":`Select a session…`,"chat.placeholder":`Ask a question or assign work`,"chat.routeLabel":`message category`,"chat.routeHint":`For this message only. Argus chooses one worker or a team based on the request; greetings stay in conversation.`,"chat.routeTask":`Task`,"chat.routeAuto":`Auto`,"chat.routeChat":`Chat`,"chat.attach":`attach files`,"chat.attachHint":`PNG, JPEG, WebP, PDF, Markdown/text, JSON, CSV · up to {count} files, {perFile} each, {total} total`,"chat.attachDrop":`Drop files to attach`,"chat.attachRemove":`remove attachment {name}`,"chat.attachUnsupported":`{name} is not supported. Use PNG, JPEG, WebP, PDF, Markdown/text, JSON, or CSV.`,"chat.attachTooLarge":`{name} exceeds the {size} per-file limit.`,"chat.attachTooMany":`You can attach up to {count} files per message.`,"chat.attachTotalTooLarge":`Attachments exceed the {size} total limit.`,"chat.attachmentUploadFailed":`Attachment upload failed: {error}`,"chat.uploadingAttachments":`Uploading attachments`,"chat.rewriteHint":`Let the Manager rewrite this prompt into a brief the team can act on. Nothing is sent — the rewrite lands back in this box for you to edit.`,"chat.rewriteLabel":`rewrite prompt with the Manager`,"chat.rewriting":`rewriting`,"chat.rewrite":`Rewrite text`,"chat.stopWaiting":`stop reply`,"chat.stopWaitingTitle":`Stop this Manager request`,"chat.stoppingReply":`Stopping this reply…`,"chat.stopReplyRequested":`Stop requested. You can send another message.`,"chat.replyAlreadyFinished":`This reply has already finished.`,"chat.stopReplyFailed":`Could not stop the server request: {error}`,"chat.send":`send message`,"copy.message":`Copy`,"copy.code":`Copy code`,"copy.copied":`Copied`,"help.title":`Keyboard shortcuts`,"help.commands":`Commands`,"help.palette":`command palette`,"help.sessions":`toggle sessions`,"help.managerChat":`focus Manager chat`,"help.rewrite":`rewrite the current prompt before sending`,"help.reasoning":`toggle agent reasoning`,"help.kiosk":`toggle kiosk (read-only) mode`,"help.composer":`focus the composer`,"help.send":`send message`,"help.newline":`insert newline`,"help.thisHelp":`this help`,"help.escape":`close overlay / stop waiting in composer`,"palette.placeholder":`Type a command or search…`,"palette.noMatches":`no matching commands`,"palette.navigate":`↑↓ navigate`,"palette.run":`↵ run`,"palette.close":`esc close`,"palette.view":`View`,"palette.action":`Action`,"palette.project":`Project`,"palette.newDaemon":`New session`,"palette.openTranscript":`Open Transcript`,"palette.openProject":`Open Project`,"palette.projectHint":`work · memory · agents`,"palette.openOperations":`Open Operations`,"palette.operationsHint":`session controls`,"palette.hideReasoning":`Hide reasoning`,"palette.showReasoning":`Show reasoning`,"palette.exitKiosk":`Exit kiosk mode`,"palette.enterKiosk":`Enter kiosk mode`,"palette.messageArgus":`Message Argus…`,"palette.stopWaiting":`Stop Manager reply`,"palette.stopContinuous":`Stop continuous campaign`,"palette.startContinuous":`Start continuous campaign`,"palette.stopDaemon":`Pause Argus`,"palette.startDaemon":`Run Argus`,"slash.suggestions":`Slash command suggestions`,"mission.roleActive":`{role} active`,"mission.overview":`mission overview`,"mission.operations":`Operations`,"role.manager":`Manager`,"role.manager.description":`Understands your goal and coordinates work`,"role.planner":`Planner`,"role.planner.description":`Breaks down the problem, schedules work, and revises the plan`,"role.engineer":`Engineer`,"role.engineer.description":`Researches, writes proofs or code, and uses tools to check the work`,"role.reviewer":`Reviewer`,"role.reviewer.description":`Checks results and evidence and identifies gaps`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`You`,"doctor.title":`Doctor`,"doctor.subtitle":`Argus status checks + recommended root-cause fix`,"doctor.recommended":`recommended fix`,"doctor.loadError":`Couldn’t load diagnostics.`,"doctor.empty":`No diagnostic data available`,"doctor.daemonLog":`Daemon log`,"settings.subtitle":`effective roles, budgets, and essential controls`,"settings.loadError":`Couldn’t load configuration.`,"settings.empty":`No configuration found`,"settings.quickConfig":`Quick Config`,"settings.appearance":`Appearance`,"settings.appearanceHint":`Choose the interface colour treatment. Logos and icons always remain monochrome.`,"settings.themeStyle":`Theme colour`,"settings.themeStyle.standard":`Standard`,"settings.themeStyle.standardHint":`Quiet black, white, grey, and blue.`,"settings.themeStyle.gradient":`Gradient`,"settings.themeStyle.gradientHint":`The classic Argus blue-to-gold background.`,"settings.backend":`Backend`,"settings.backendSource.env":`set by the server environment`,"settings.backendSource.persisted":`saved setting`,"settings.backendSource.default":`built-in default`,"settings.backendWillSave":`Apply saves {backend}.`,"settings.backendWillReplace":`Apply replaces the saved {saved} with {backend}.`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`Backend saved as {backend}. Restart Argus to apply.`,"settings.backendUnsupported":`Unsupported backend ({backend})`,"settings.backendUnavailable":`Backend unavailable`,"settings.model":`Model`,"settings.trialAccount":`Trial account`,"settings.trialKeyHint":`Replace your Key here when its allowance runs out. Your projects and conversations stay in place.`,"settings.changeTrialKey":`Change Key`,"settings.applyModel":`Apply`,"settings.modelPlaceholder":`auto (backend default)`,"settings.connection":`Connection`,"settings.webApi":`Web + REST API`,"settings.eventStream":`Live updates`,"settings.taskDaemon":`Background work`,"settings.taskDaemonValue":`Local process · events.jsonl · no TCP port`,"chat.messageTooLong":`Message exceeds 32,000 characters. Shorten it or upload a file. Your draft is preserved.`,"settings.required":`{field} is required`,"settings.advanced":`Advanced`,"settings.advancedHint":`Budgets, the advisor model, explanation effort, connection details and raw configuration`,"settings.mapModel":`Map`,"settings.mapModelFollows":`Follows the front-door model`,"settings.mapModelSet":`Map explanations now use {model}.`,"settings.overrideTitle":`Environment override`,"settings.overrideHint":`Set a specific config alias or environment-variable key.`,"settings.namePlaceholder":`name or alias, e.g. manager_model`,"settings.valuePlaceholder":`value`,"settings.applyAdvanced":`Apply environment override`,"settings.applied":`Applied. Restart affected sessions to use the new settings.`,"settings.modelAppliedToRoles":`Every role now uses {model}. Sessions already running keep their model until they restart.`,"settings.rolesRunning":`Roles now run:`,"settings.applyUnifies":`Apply sets all of them to the model above.`,"settings.rolesTitle":`Effective roles`,"settings.rawConfig":`Raw configuration`,"settings.group.limits":`Limits`,"settings.group.safety":`Safety`,"settings.group.interface":`Interface`,"settings.knob.activeDaemons":`Active session limit`,"settings.knob.activeDaemonsDoc":`Maximum background sessions running on this host.`,"settings.knob.safeMode":`Safe mode`,"settings.knob.safeModeDoc":`Enable extra-conservative runtime guardrails.`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`Enable the Telegram notification bridge.`,"settings.knob.showReasoning":`Show reasoning`,"settings.knob.showReasoningDoc":`Stream role reasoning into the activity view.`,"settings.knob.operatorAvailable":`Operator available`,"settings.knob.operatorAvailableDoc":`Off suppresses operator questions: Argus decides on recorded assumptions and blocks on operator-only actions.`,"noOperator.banner":`No-operator mode: questions suppressed. Argus decides on recorded assumptions instead of asking you.`,"noOperator.turnOff":`Ask me again`,"settings.source.notApplicable":`Not applicable for this model`,"settings.source.vaultDefault":`Capability vault / default`,"settings.source.default":`Default`,"settings.modelUnavailable":`unavailable`,"settings.modelOfflineList":`Offline list: the backend did not return its live models, showing the harness catalog.`,"settings.source.saved":`Saved override`,"settings.source.environment":`Environment variable`,"settings.source.hostConfig":`Host configuration`,"settings.source.other":`Resolved configuration`,"settings.value.enabled":`Enabled`,"settings.value.disabled":`Disabled`,"settings.effort.low":`Low effort`,"settings.effort.medium":`Medium effort`,"settings.effort.high":`High effort`,"settings.effort.xhigh":`Extra-high effort`,"settings.role.curator":`Curator`,"settings.role.curatorDoc":`Maintains and distills the reusable skill pool.`,"settings.footer":`Human-readable labels are shown with raw keys. The full registry remains available via`,"identity.title":`Identity`,"identity.subtitle":`who argus is working for on this project`,"identity.placeholder":`Describe who Argus is working for and durable preferences…`,"identity.save":`Save identity`,"identity.saved":`Identity saved.`,"transcript.title":`Transcript`,"transcript.subtitle":`recent operator ↔ argus turns · reply from the composer`,"transcript.empty":`no conversation turns yet`,"transcript.operator":`operator`,"new.createDaemon":`Create session`,"new.createdIdle":`New session ready. Say what it is for and the work begins.`,"new.createdStarting":`New session ready; the work is starting in the background.`,"new.subtitle":`Creates an isolated timeline and Manager context.`,"new.close":`close create session`,"new.name":`Name`,"new.optional":`(optional)`,"new.namePlaceholder":`e.g. AAAI embodiment paper`,"new.workdir":`Output workdir`,"new.workdirHint":`Agents write code, papers, reports, and experiment outputs here. Internal memory stays under the session state directory.`,"new.objective":`Objective`,"new.objectivePlaceholder":`Leave blank to start with a conversation, or describe a campaign to start immediately.`,"new.startsAfterCreate":`Campaign starts after session creation`,"new.idleUntilMessage":`Idle until the first message`,"new.startsHint":`The session opens immediately while Argus prepares the work in the background.`,"new.idleHint":`Background work starts after your first message, when needed.`,"new.shortcut":`Ctrl/⌘+Enter to create`,"new.creating":`Creating…`,"new.createAndStart":`Create and start`,"manage.daemon":`Manage session`,"manage.displayName":`Display name`,"manage.executor":`Background work`,"manage.running":`Running`,"manage.runningExternally":`Running externally`,"manage.paused":`Stopped`,"manage.pauseHint":`Interrupt the current operation and keep progress resumable.`,"manage.stopNow":`Stop now`,"manage.stopNowHint":`Immediately interrupt this verified daemon so the session can be deleted.`,"manage.externalHint":`This session is managed outside this app.`,"manage.resumeHint":`Resume queued research work.`,"manage.working":`Working…`,"manage.resume":`Resume`,"manage.deleteSession":`Delete session`,"manage.deleteHint":`Deleted sessions move to the trash and remain recoverable. Stop background work first.`,"manage.delete":`Delete…`,"manage.confirmQuestion":`Move this session to trash?`,"manage.confirmDelete":`Confirm delete`,"decision.operator":`Operator decision`,"decision.required":`Decision required`,"decision.whyBlocked":`Recorded reason this task needs input`,"decision.currentTask":`Current task`,"decision.taskName":`Task: {title}`,"decision.otherTask":`Another task awaiting input`,"decision.awaitingReply":`Awaiting your reply`,"decision.askedAt":`Asked {time}`,"decision.evidence":`Evidence`,"decision.notePlaceholder":`Add the guidance the Manager should apply…`,"decision.resumeHint":`Your answer applies to this task. The Manager checks its next step.`,"decision.later":`Later`,"decision.applying":`Submitted; Argus is starting on it…`,"decision.closeContinue":`Close, keep working`,"decision.stopCampaign":`Stop campaign`,"decision.useOption":`Use this option`,"decision.sendAnswer":`Send answer`,"decision.noteRequired":`Add the required details before sending this choice.`,"artifact.preview":`Result preview`,"artifact.title":`Result`,"artifact.approvedEvidence":`evidence the Reviewer has checked`,"artifact.downloading":`Downloading…`,"artifact.download":`Download`,"artifact.open":`Open`,"artifact.close":`close result preview`,"artifact.unavailable":`preview unavailable`,"artifact.empty":`(empty file)`,"artifact.truncated":`preview truncated · download to inspect the complete file`,"artifact.htmlTooLarge":`HTML preview is too large to render safely. Download the complete file.`,"artifact.pdfDisabled":`Inline PDF preview is disabled by this browser.`,"artifact.openPdf":`Open PDF`,"artifact.noPreview":`This file type has no safe inline preview.`,"artifact.downloadHint":`Download it to inspect with a local application.`,"task.details":`Task details`,"task.stopLoop":`stop loop`,"task.done":`done`,"task.skip":`skip`,"task.close":`close task details`,"task.waitingOnYou":`Waiting on you`,"task.objective":`Objective`,"task.noObjective":`(no objective recorded)`,"task.untitled":`Untitled task`,"task.priority":`priority`,"task.started":`started`,"task.finished":`finished`,"task.outcome":`Outcome`,"task.iteration":`Iteration`,"task.mode":`mode`,"task.autoIterate":`auto-iterate`,"task.singlePass":`single pass`,"task.cycles":`cycles`,"task.cost":`cost`,"task.lastError":`Last error`,"task.notes":`Notes`,"task.dependsOn":`depends on`,"task.dependsOnCount":`Depends on {count} earlier tasks`,"pending.reviewRespond":`Review and respond`,"pending.showOnMap":`Show on map`,"backlog.active":`Active · {count}`,"backlog.history":`History · {count}`,"backlog.noHistory":`No completed work yet`,"backlog.empty":`Nothing queued. Argus is ready for new work.`,"backlog.viewDetails":`View full task details`,"backlog.iterating":`Repeating`,"backlog.stopIterating":`Stop repeating`,"backlog.stop":`Stop`,"backlog.markDone":`Mark done`,"backlog.remove":`Remove`,"mission.achievement":`Argus achievement`,"mission.elapsed":`Elapsed`,"mission.rejectedAttempts":`{count} rejected attempts`,"mission.skillsLearned":`{count} skills learned`,"mission.artifacts":`{count} files produced`,"mission.waiting":`Waiting for a mission`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`Ready when you are — assign a mission to begin.`,"mission.statusDone":`This task: {outcome} — finished in {elapsed}.`,"mission.nextAfterReply":`Reply to this task’s question first, then decide its next step.`,"mission.continuousDone":`Continuous run finished`,"mission.resumeContinuous":`Resume`,"mission.control":`Mission control`,"mission.attentionHealth":`System error — health is degraded.`,"mission.attentionFailed":`Mission failed — check the task below.`,"mission.deliveryFailed":`Task failed at delivery — execution could not start or finish.`,"mission.attentionStepFailed":`A step failed — check the task below.`,"mission.attentionPaused":`Mission is paused — waiting for your input.`,"mission.showObjective":`Show full objective`,"mission.showFullOutput":`View full output`,"mission.stage":`Stage`,"mission.campaign":`Campaign`,"mission.totalElapsed":`Total elapsed`,"mission.round":`Round`,"mission.mode":`Mode`,"mission.summary":`Mission summary`,"mission.deliveryCertified":`Delivery approved`,"mission.taskCompleted":`Task completed`,"mission.openResult":`Open result`,"mission.viewTask":`View task`,"mission.taskPlan":`Task plan`,"mission.team":`Team`,"mission.waitingShort":`Waiting`,"mission.roleWork":`Role work`,"mission.showMore":`Show more`,"mission.showLess":`Show less`,"mission.done":`Done`,"mission.inProgress":`In progress`,"mission.failed":`Failed`,"mission.bannerPaused":`Mission is paused — waiting for your input.`,"mission.bannerError":`System error — health is degraded.`,"mission.bannerStepFailed":`A step failed: {step}`,"mission.elapsedAgo":`{elapsed} ago`,"mission.filteredBy":`filtered by {task} · clear`,"mission.allVisible":`all visible missions`,"mission.roundNumber":`round {count}`,"mission.noRoleWork":`No persisted {role} work for this selection yet.`,"mission.researchDag":`Task route`,"mission.active":`active`,"mission.noDag":`The Planner has not added tasks to the route yet.`,"mission.workingHypothesis":`Working hypothesis · can be revised`,"mission.goalContribution":`How this supports the goal`,"mission.temporaryRegressions":`Expected temporary tradeoffs`,"mission.decisionRule":`When to revise, split, or stop`,"mission.acceptance":`What counts as done`,"mission.nonGoals":`Non-goals`,"mission.capabilities":`Capabilities`,"mission.capabilitiesUnlocked":`Capabilities unlocked`,"mission.learnedCapability":`Learned capability`,"mission.learnedDuring":`Learned during {mission}`,"mission.skillUnavailable":`Skill content is not available in this snapshot.`,"mission.contentTruncated":`Content preview truncated`,"mission.knowledgeRetained":`Knowledge retained`,"mission.selfEvolution":`Saved project knowledge`,"mission.knowledgeSaved":`Argus saved these capabilities and notes for future work on this project.`,"mission.noCapabilities":`No capabilities learned yet.`,"mission.replay":`Mission replay`,"mission.replayTimeline":`Replay mission timeline`,"mission.roleFailed":`{role} failed`,"mission.showingLatestEvent":`Showing latest event`,"mission.showingLastEvents":`Showing last {count} events`,"mission.waitingEvents":`Waiting for structured research events.`,"mission.startsAfter":`Starts after {count} earlier tasks`,"mission.hiddenTasks":`{count} earlier tasks hidden · {failed} blocked or failed · {skipped} skipped`,"mission.projectFilesChanged":`Project files changed`,"mission.reviewInIde":`Open the IDE to review the diff`,"research.currentWork":`Current work`,"research.dagProgress":`Task route progress`,"research.verifiedOutputs":`Verified outputs`,"research.recentMilestones":`Recent milestones`,"research.liveProgress":`Task progress`,"research.artifact":`Research result`,"research.canvas":`Manager live research canvas`,"research.previewArtifact":`Preview the result`,"research.openLarge":`Open large preview`,"research.collapse":`Collapse preview`,"research.unavailable":`Manager live view is temporarily unavailable.`,"research.noPreview":`No preview`,"research.waiting":`Waiting…`,"research.updating":`Updating…`,"research.fileUnavailable":`This file is ready to download using the button above.`,"research.eventSourced":`event-sourced mission state`,"research.downloadFailed":`download failed`,"operations.title":`Operations`,"operations.work":`Work`,"operations.runtime":`Runtime`,"operations.system":`System`,"operations.recovery":`Recovery`,"operations.workInput":`Work input`,"operations.workHint":`Queue work, guide the active task, save a note, or preview a plan without dispatching it.`,"operations.action.task":`Task`,"operations.action.nudge":`Guide`,"operations.action.note":`Note`,"operations.action.plan":`Plan`,"operations.planPlaceholder":`Objective to preview; preview never queues work`,"operations.actionPlaceholder":`{action} text`,"operations.previewPlan":`Preview plan`,"operations.submitAction":`Submit {action}`,"operations.runtimeHint":`Change where this session runs, reset Manager context, or safely restart the session.`,"operations.workdir":`Working directory`,"operations.workdirUpdated":`Working directory updated.`,"operations.applyWorkdir":`Apply working directory`,"operations.replaceSlot":`Replace an active session`,"operations.sourceUpdate":`Argus source version`,"operations.pullLatest":`Pull latest version`,"operations.updateChecking":`Checking published branch…`,"operations.updateRunning":`Updating…`,"operations.updateAvailable":`Update available`,"operations.updateCurrent":`Up to date`,"operations.updateUnavailable":`This checkout cannot be updated safely.`,"operations.currentRevision":`Current`,"operations.latestRevision":`Latest`,"operations.updatePhase":`Phase`,"operations.updateRestart":`Source updated. Restart the cockpit, then use the reload button to move active daemons to the new release at a safe task boundary.`,"operations.skills":`Skills`,"operations.runSkill":`Run skill command`,"operations.metrics":`System metrics`,"operations.trash":`Recoverable trash`,"operations.searchTrash":`Search trash`,"operations.trashEmpty":`Trash is empty.`,"resource.title":`Resources`,"resource.loading":`Loading resource status…`,"resource.devices":`Devices: {count}`,"resource.inUse":`In use · {count}`,"resource.queue":`Queue · {count}`,"resource.none":`None`,"resource.timeLeft":`{ttl} left`,"resource.noIntent":`No purpose recorded`,"resource.yieldRequest":`Resource release requested · {reason}`,"resource.queuePosition":`Queue position {position}`,"label.status.inProgress":`In progress`,"label.status.waiting":`Waiting`,"label.status.completed":`Completed`,"label.status.blocked":`Blocked`,"label.status.failed":`Failed`,"label.status.needsChanges":`Needs changes`,"label.status.skipped":`Skipped`,"label.status.paused":`Paused`,"label.status.cancelled":`Cancelled`,"label.status.available":`Available`,"label.status.unavailable":`Unavailable`,"label.status.inaccessible":`Not accessible`,"label.status.limited":`Limited`,"label.status.healthy":`Healthy`,"label.status.updated":`Status updated`,"label.role.argus":`Argus`,"label.role.you":`You`,"label.work.task":`Task`,"label.work.action":`Work step`,"label.work.handoff":`Notes for the next step`,"label.work.review":`Review`,"label.work.planning":`Planning`,"label.work.update":`Update`,"label.stage.scope":`Scope`,"label.stage.research":`Research`,"label.stage.implementation":`Implementation`,"label.stage.experiment":`Experiments`,"label.stage.analysis":`Analysis`,"label.stage.writing":`Writing`,"label.stage.review":`Final review`,"label.stage.delivery":`Delivery`,"label.stage.unstaged":`Unstaged`,"label.frontier.reopened":`An earlier task was reopened`,"label.frontier.added":`A new task was added`,"label.frontier.completed":`A task path was completed`,"label.frontier.revised":`The task plan was revised`,"label.frontier.narrowed":`The task scope was narrowed`,"label.frontier.expanded":`The task scope was expanded`,"label.frontier.updated":`The task plan was updated`,"label.priority":`Priority {priority}`,"label.outcome.workCompleted":`Work completed`,"label.outcome.workPaused":`Work paused`,"label.outcome.workBlocked":`Work blocked`,"label.outcome.workFailed":`Work failed`,"label.outcome.workEnded":`Work ended`,"label.outcome.workIncomplete":`Work incomplete`,"label.outcome.workStalled":`Work stalled`,"label.outcome.workUpdated":`Work status updated`,"label.outcome.reviewPassed":`Review passed`,"label.outcome.reviewNeedsChanges":`Review requested changes`,"label.outcome.reviewBlocked":`Review blocked`,"label.outcome.reviewOutdated":`Review is out of date`,"label.outcome.reviewPending":`Review pending`,"label.outcome.stageApproved":`Stage approved`,"label.outcome.stageNotApproved":`Stage not approved`,"label.outcome.stageRevoked":`Stage approval revoked`,"label.outcome.stageNotNeeded":`Stage decision not needed`,"label.outcome.stagePending":`Stage decision pending`,"label.outcome.budgetPaused":`Paused by budget limit`,"label.outcome.costUnreconciled":`Awaiting provider usage reconciliation`,"label.outcome.waitingForYou":`Waiting for your response`,"label.outcome.stoppedByYou":`Stopped by you`,"label.outcome.pausedByYou":`Paused by you`,"label.outcome.sessionPaused":`Session paused`,"label.outcome.serviceUnavailable":`Service unavailable`,"label.outcome.serviceCoolingDown":`Service temporarily paused`,"label.outcome.temporaryIssue":`Paused by a temporary issue`,"label.outcome.serviceError":`Stopped by a service error`,"label.outcome.needsPlan":`A new plan is needed`,"label.outcome.canResume":`Can resume`,"label.routing.team":`Team workflow`,"label.routing.individual":`Individual workflow`,"label.routing.research":`Research`,"label.routing.software":`Software work`,"label.routing.staged":`Step by step`,"label.routing.flexible":`Flexible workflow`,"label.routing.ongoing":`Ongoing`,"label.routing.defined":`Defined scope`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`Accelerator`,"label.resource.enforced":`Limits enforced`,"label.resource.advisory":`Recommendations only`,"label.resource.released":`Resources released`,"label.resource.kept":`Resources kept`,"mission.lastProgress":`Progress recorded before the stop`,"mission.nextResume":`The progress is saved. Run Argus again and it continues from where it stopped.`,"mission.nextResumeLive":`Argus will continue from the saved progress.`,"research.totalTime":`Total time`,"research.optionDelivery":`Delivery`,"research.optionCheckpoint":`Checkpoint`,"research.optionPending":`being written`,"operations.unavailableHere":`This is not available on this Argus.`,"operations.requestFailed":`That did not go through.`,"operations.technicalDetails":`Technical details`,"verticals.title":`Vertical Store`,"verticals.entry":`Verticals`,"verticals.openStore":`Open Vertical Store`,"verticals.paletteHint":`install · enable · update`,"verticals.intro":`A vertical gives Argus a research domain: its stages, roles, skills and checks. Install what your projects need and enable it per workspace.`,"verticals.hostedNote":`Verticals are provided by the host; you can enable or disable them for your workspace.`,"verticals.close":`Close vertical store`,"verticals.search":`Search verticals`,"verticals.searchPlaceholder":`Search by name, purpose or tag…`,"verticals.refreshCatalog":`Refresh catalog`,"verticals.refreshing":`Refreshing…`,"verticals.catalogSource":`Catalog: {source}`,"verticals.catalogRelease":`Release {tag}`,"verticals.catalogFetched":`Fetched {time}`,"verticals.catalogNever":`Catalog not fetched yet`,"verticals.catalogError":`The catalog could not be refreshed: {error}`,"verticals.kindFilter":`Filter by kind`,"verticals.tagFilter":`Filter by tag`,"verticals.clearFilters":`Clear filters`,"verticals.count":`{shown} of {total}`,"verticals.filter.all":`All`,"verticals.routingPath":`Category / domain / specialty`,"verticals.filter.installed":`Installed`,"verticals.filter.available":`Available`,"verticals.filter.builtin":`Built-in`,"verticals.kind.builtin":`Built-in`,"verticals.kind.package":`Bundled`,"verticals.kind.installed":`Installed`,"verticals.kind.available":`Available`,"verticals.enabled":`Enabled`,"verticals.disabledState":`Disabled`,"verticals.updateAvailable":`Update available`,"verticals.updateTo":`Update to {version}`,"verticals.installedVersion":`Installed {version}`,"verticals.catalogVersion":`Catalog {version}`,"verticals.requires":`Requires`,"verticals.shared":`Shares resources with`,"verticals.size":`Size`,"verticals.jumpTo":`Go to {name}`,"verticals.missingPython":`Needs: {packages} — install them into the Python environment Argus runs from.`,"verticals.runtimeIssues":`Installed version is incompatible with this Argus runtime: {issues}`,"verticals.installIssues":`Catalog installation/update is blocked by runtime requirements: {issues}`,"verticals.usedByOne":`Used by 1 project`,"verticals.usedBy":`Used by {count} projects`,"verticals.action.install":`Install`,"verticals.action.update":`Update`,"verticals.action.enable":`Enable`,"verticals.action.disable":`Disable`,"verticals.action.uninstall":`Uninstall`,"verticals.confirmUninstall":`Confirm uninstall`,"verticals.confirmUninstallHint":`Removes {name} from this Argus.`,"verticals.removeAnyway":`Remove anyway`,"verticals.operation.install":`Installing…`,"verticals.operation.update":`Updating…`,"verticals.operation.enable":`Enabling…`,"verticals.operation.disable":`Disabling…`,"verticals.operation.uninstall":`Uninstalling…`,"verticals.operationRunning":`Working…`,"verticals.operationFailed":`{action} failed`,"verticals.loading":`Loading verticals…`,"verticals.noMatches":`No verticals match these filters.`,"verticals.none":`No verticals are listed yet.`,"verticals.loadFailed":`Could not read the vertical list.`,"verticals.actionFailed":`That did not go through.`,"verticals.tooOld":`This Argus backend predates the vertical store. Update Argus, then reopen this page to manage verticals.`},Ct={"language.english":`English`,"handshake.connecting":`正在准备 Argus`,"handshake.service":`服务`,"handshake.project":`项目`,"handshake.ready":`就绪`,"handshake.title":`正在准备 Argus`,"handshake.detail":`正在恢复你的工作区…`,"splash.starting":`Argus 启动中`,"rail.workbench":`工作台`,"rail.sessionsShortcut":`会话 · Ctrl/⌘ P`,"panel.backlog":`待办`,"panel.activity":`对话与进展`,"panel.journal":`日志`,"panel.roles":`角色`,"panel.project":`项目`,"panel.liveView":`Manager 实时项目视图`,"stream.jumpToLatest":`跳到最新`,"stream.toggleReasoning":`显示或隐藏 Agent 推理(⌘T)`,"stream.reasoning":`推理`,"stream.noLogs":`暂无活动`,"stream.system":`Argus 动态`,"stream.autonomous":`后台活动`,"stream.backgroundWork":`Argus 正在后台工作`,"stream.ready":`Argus 已就绪。你可以提问或安排下一项工作。`,"stream.historyLoading":`正在读取对话记录…`,"stream.historyError":`对话记录暂时读取失败。`,"stream.historyRetry":`重试`,"stream.fold.read":`读取了 {count} 个文件`,"stream.fold.search":`搜索了 {count} 次`,"stream.fold.fetch":`查阅了 {count} 个网页`,"stream.fold.edit":`修改了 {count} 个文件`,"stream.fold.tool":`使用了 {count} 次 {tool}`,"stream.fold.failed":`{count} 次失败`,"stream.fold.expand":`展开每一步`,"stream.fold.collapse":`收起`,"stream.repeated":`重复了 {count} 次,显示最近一次`,"stream.stepFailed":`失败`,"stream.stepResult":`结果`,"common.showRaw":`显示原始输出`,"doctor.lastEntry":`最近一条`,"operations.metric.calls":`今日模型调用`,"operations.metric.failed":`失败`,"operations.metric.slowest":`最慢的常规调用`,"operations.slo.healthy":`正常`,"operations.slo.degraded":`需要留意`,"operations.slo.loading":`加载中…`,"operations.validationFailures":`今日 {count} 条格式异常的事件`,"operations.outputLines":`共 {count} 行输出`,"operations.done":`已完成。`,"newDaemon.workdirPlaceholder":`留空 → ~/.argus-skill/workspaces/`,"operations.resetManager":`重新开始理解这段对话`,"language.chinese":`中文`,"language.switchTo":`切换到{language}`,"common.loading":`加载中…`,"common.retry":`重试`,"common.save":`保存`,"common.cancel":`取消`,"common.close":`关闭`,"common.settings":`设置`,"common.ready":`就绪`,"common.live":`实时`,"common.reconnecting":`正在重连`,"common.stale":`快照已过期`,"common.degraded":`快照异常`,"common.external":`外部`,"common.pause":`暂停`,"common.run":`运行`,"common.working":`处理中`,"common.local":`本地`,"common.all":`全部`,"common.unassigned":`未分配`,"common.closeSessions":`关闭会话列表`,"common.resizeSessions":`调整会话列表宽度`,"common.resizePreview":`调整预览区域宽度`,"common.expandPreview":`展开预览`,"time.justNow":`刚刚`,"time.minutesAgo":`{count}分钟前`,"time.hoursAgo":`{count}小时前`,"time.yesterdayAt":`昨天 {time}`,"connection.pairingTitle":`此浏览器尚未与 Argus 配对`,"connection.pairingDetail":`请打开这个站点的有效配对链接,或在下方粘贴配对链接或令牌。`,"connection.pairAgain":`重新配对`,"connection.pairingInput":`配对链接或令牌`,"connection.pairingPlaceholder":`粘贴新的配对链接或令牌`,"connection.pairingInvalid":`请输入有效的配对链接或令牌。`,"connection.connect":`连接`,"connection.unreachableTitle":`Argus 本地服务当前不可达`,"connection.unreachableDetail":`请保持 Argus Desktop 运行,等待本地服务就绪后再重试。`,"sidebar.collapse":`收起会话`,"sidebar.expand":`展开会话`,"sidebar.create":`创建项目`,"sidebar.find":`查找项目`,"sidebar.clearSearch":`清除搜索`,"sidebar.refreshFailed":`刷新失败 · 重试`,"sidebar.noSessions":`暂无会话`,"sidebar.noMatches":`没有匹配"{query}"的会话`,"sidebar.unnamedSession":`未命名会话`,"sidebar.daemonAlive":`Argus 后台在线`,"sidebar.updateRequired":`需要更新`,"sidebar.updateAvailable":`可更新`,"sidebar.updateAvailableHint":`后台仍在运行,执行器与网页版本不同。`,"sidebar.stopped":`后台已停止`,"sidebar.runningFor":`后台在线 · {uptime}`,"sidebar.lastActive":`上次活动 {time}`,"sidebar.manage":`管理 {name}`,"sidebar.manageHint":`重命名、暂停或删除`,"sidebar.resume":`继续`,"sidebar.resumeHint":`在 {workdir} 中继续工作`,"sidebar.resumeSuccess":`会话已恢复。`,"sidebar.resumeFailed":`无法恢复会话:{error}`,"sidebar.modelLoading":`正在加载后端和模型…`,"sidebar.modelUnavailable":`后端和模型信息不可用`,"sidebar.defaultModel":`默认模型`,"sidebar.openSettings":`打开设置`,"sidebar.compute":`算力队列与账户额度`,"sidebar.theme":`{current}主题;切换到{next}主题`,"landing.selectOrCreate":`从侧边栏选择一个会话,或创建新会话。`,"landing.noSessions":`还没有会话。创建一个即可开始。`,"landing.select":`选择项目`,"landing.new":`新建项目`,"landing.menu":`打开菜单`,"project.missingSwitched":`找不到项目“{requested}”,已切换到 {fallback}。`,"project.missingCreate":`找不到项目“{requested}”,请新建一个项目继续。`,"topbar.openSessions":`打开项目列表`,"topbar.externallyManaged":`由外部管理`,"topbar.pauseDaemon":`暂停 Argus`,"topbar.runDaemon":`运行 Argus`,"topbar.working":`Argus 正在处理你的请求`,"topbar.roleActive":`{role} 活跃中`,"topbar.roleIdle":`{role} 空闲`,"topbar.externalDaemonHint":`Argus 由此应用之外的服务管理,请前往相应位置控制。`,"topbar.manageSession":`管理会话`,"topbar.showPreview":`显示预览`,"topbar.showActivity":`显示动态`,"mobile.views":`视图`,"mobile.sessions":`项目`,"mobile.mission":`任务`,"mobile.activity":`对话`,"mobile.workbench":`工作台`,"mobile.map":`地图`,"mobile.preview":`文件`,"chat.working":`Argus 正在处理你的消息`,"chat.workingQuiet":`Argus 正在处理你的消息 · 仍在处理中,{quiet} 秒暂无新进展`,"chat.stopWaitingHint":`按 Esc 停止回复 · 按 Enter 追加消息`,"chat.queuedWhileRunning":`已排队 · 这条回复结束后立即处理;正在运行的任务会据此调整`,"chat.attachWhileRunning":`附件要等这条回复结束后再发送`,"chat.stepsLive":`正在工作 · 已 {count} 步`,"chat.stepsDone":`过程 {count} 步 · {seconds}`,"chat.stepFailed":`失败`,"chat.stepRaw":`原始参数`,"chat.messageArgus":`向 Argus 发送消息`,"chat.selectSession":`请选择会话…`,"chat.placeholder":`提问或安排工作`,"chat.routeLabel":`消息类型`,"chat.routeHint":`仅用于本条消息。Argus 根据实际需要选择单智能体或团队,问候直接回复。`,"chat.routeTask":`任务`,"chat.routeAuto":`自动`,"chat.routeChat":`对话`,"chat.attach":`添加文件`,"chat.attachHint":`支持 PNG、JPEG、WebP、PDF、Markdown/文本、JSON、CSV · 每条消息最多 {count} 个文件,单个 {perFile},总计 {total}`,"chat.attachDrop":`拖放文件以添加附件`,"chat.attachRemove":`移除附件 {name}`,"chat.attachUnsupported":`{name} 不受支持。请使用 PNG、JPEG、WebP、PDF、Markdown/文本、JSON 或 CSV。`,"chat.attachTooLarge":`{name} 超过单文件大小限制 {size}。`,"chat.attachTooMany":`每条消息最多只能附带 {count} 个文件。`,"chat.attachTotalTooLarge":`附件总大小超过 {size} 限制。`,"chat.attachmentUploadFailed":`附件上传失败:{error}`,"chat.uploadingAttachments":`正在上传附件`,"chat.rewriteHint":`把这段话整理得更清楚。改写结果会回到输入框,由你检查后发送。`,"chat.rewriteLabel":`整理这段话`,"chat.rewriting":`正在改写`,"chat.rewrite":`改写文字`,"chat.stopWaiting":`停止回复`,"chat.stopWaitingTitle":`停止处理这条消息`,"chat.stoppingReply":`正在停止当前回复…`,"chat.stopReplyRequested":`已收到停止请求,可以发送新消息。`,"chat.replyAlreadyFinished":`这次回复已经结束。`,"chat.stopReplyFailed":`服务端未能停止这次请求:{error}`,"chat.send":`发送消息`,"copy.message":`复制`,"copy.code":`复制代码`,"copy.copied":`已复制`,"help.title":`键盘快捷键`,"help.commands":`命令`,"help.palette":`打开命令面板`,"help.sessions":`展开或收起会话`,"help.managerChat":`聚焦 Manager 对话框`,"help.rewrite":`发送前改写当前提示词`,"help.reasoning":`显示或隐藏 Agent 推理`,"help.kiosk":`切换只读展示模式`,"help.composer":`聚焦输入框`,"help.send":`发送消息`,"help.newline":`插入换行`,"help.thisHelp":`打开此帮助`,"help.escape":`关闭浮层或停止等待`,"palette.placeholder":`输入命令或搜索…`,"palette.noMatches":`没有匹配的命令`,"palette.navigate":`↑↓ 导航`,"palette.run":`↵ 执行`,"palette.close":`Esc 关闭`,"palette.view":`视图`,"palette.action":`操作`,"palette.project":`项目`,"palette.newDaemon":`新建会话`,"palette.openTranscript":`打开对话记录`,"palette.openProject":`打开项目`,"palette.projectHint":`工作 · 记忆 · Agent`,"palette.openOperations":`打开运行控制`,"palette.operationsHint":`会话控制`,"palette.hideReasoning":`隐藏推理`,"palette.showReasoning":`显示推理`,"palette.exitKiosk":`退出展示模式`,"palette.enterKiosk":`进入展示模式`,"palette.messageArgus":`向 Argus 发送消息…`,"palette.stopWaiting":`停止当前回复`,"palette.stopContinuous":`停止持续任务`,"palette.startContinuous":`启动持续任务`,"palette.stopDaemon":`暂停 Argus`,"palette.startDaemon":`运行 Argus`,"slash.suggestions":`Slash 命令建议`,"mission.roleActive":`{role} 正在工作`,"mission.overview":`任务概览`,"mission.operations":`运行控制`,"role.manager":`统筹`,"role.manager.description":`理解你的目标,协调工作`,"role.planner":`规划`,"role.planner.description":`拆解问题,安排后续工作并调整计划`,"role.engineer":`执行`,"role.engineer.description":`查资料、写证明或代码,调用工具验证`,"role.reviewer":`复核`,"role.reviewer.description":`检查结果与证据,指出缺口`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`你`,"doctor.title":`诊断`,"doctor.subtitle":`Argus 状态检查与推荐的根因修复方案`,"doctor.recommended":`推荐修复`,"doctor.loadError":`无法加载诊断数据。`,"doctor.empty":`诊断暂无数据`,"doctor.daemonLog":`后台进程日志`,"settings.subtitle":`生效中的角色、预算和关键控制项`,"settings.loadError":`无法加载配置。`,"settings.empty":`未找到配置`,"settings.quickConfig":`快速配置`,"settings.appearance":`外观`,"settings.appearanceHint":`选择界面主题色。Logo 与图标始终保持黑白,不参与渐变。`,"settings.themeStyle":`主题色`,"settings.themeStyle.standard":`标准`,"settings.themeStyle.standardHint":`克制的黑、白、灰与蓝色。`,"settings.themeStyle.gradient":`渐变`,"settings.themeStyle.gradientHint":`经典 Argus 蓝金渐变背景。`,"settings.backend":`后端`,"settings.backendSource.env":`由服务器环境设置`,"settings.backendSource.persisted":`已保存的设置`,"settings.backendSource.default":`内置默认值`,"settings.backendWillSave":`应用后保存为{backend}。`,"settings.backendWillReplace":`应用后把已保存的{saved}改为{backend}。`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`后端已保存为{backend}。重启 Argus 后生效。`,"settings.backendUnsupported":`不支持的后端({backend})`,"settings.backendUnavailable":`后端信息不可用`,"settings.model":`模型`,"settings.trialAccount":`试用账号`,"settings.trialKeyHint":`额度用完后可在这里更换 Key,项目和对话会保留。`,"settings.changeTrialKey":`更换 Key`,"settings.applyModel":`应用`,"settings.modelPlaceholder":`auto(后端默认模型)`,"settings.connection":`连接`,"settings.webApi":`Web + REST API`,"settings.eventStream":`实时动态`,"settings.taskDaemon":`后台工作`,"settings.taskDaemonValue":`本地进程 · events.jsonl · 无 TCP 端口`,"chat.messageTooLong":`消息超过 32,000 字符,请缩短或作为附件上传。草稿已保留。`,"settings.required":`必须填写{field}`,"settings.advanced":`高级设置`,"settings.advancedHint":`预算、顾问模型、讲解强度、连接详情与原始配置`,"settings.mapModel":`地图`,"settings.mapModelFollows":`跟随前台模型`,"settings.mapModelSet":`地图讲解现在用 {model}。`,"settings.overrideTitle":`环境变量覆盖`,"settings.overrideHint":`设置特定的配置别名或环境变量键。`,"settings.namePlaceholder":`名称或别名,例如 manager_model`,"settings.valuePlaceholder":`值`,"settings.applyAdvanced":`应用环境变量覆盖`,"settings.applied":`设置已应用。请重启受影响的会话以使用新设置。`,"settings.modelAppliedToRoles":`所有角色现在都用 {model}。正在运行的会话要重启后才换。`,"settings.rolesRunning":`各角色当前实际使用:`,"settings.applyUnifies":`点“应用”会把它们统一成上面的模型。`,"settings.rolesTitle":`生效中的角色`,"settings.rawConfig":`原始配置`,"settings.group.limits":`限制`,"settings.group.safety":`安全`,"settings.group.interface":`界面`,"settings.knob.activeDaemons":`活动会话上限`,"settings.knob.activeDaemonsDoc":`此主机上可同时运行的后台会话数量上限。`,"settings.knob.safeMode":`安全模式`,"settings.knob.safeModeDoc":`启用更保守的运行时保护措施。`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`启用 Telegram 通知桥接。`,"settings.knob.showReasoning":`显示推理`,"settings.knob.showReasoningDoc":`在活动视图中显示角色推理过程。`,"settings.knob.operatorAvailable":`有人值守`,"settings.knob.operatorAvailableDoc":`关闭后不再向你提问:Argus 依据记录的假设自行决定,需要你授权的操作会直接停下。`,"noOperator.banner":`无人值守模式:已停止提问。Argus 会依据记录的假设自行决定,而不是问你。`,"noOperator.turnOff":`恢复提问`,"settings.source.notApplicable":`不适用于此模型`,"settings.source.vaultDefault":`能力库 / 默认值`,"settings.source.default":`默认值`,"settings.modelUnavailable":`不可用`,"settings.modelOfflineList":`离线列表:后端没有返回实时模型列表,显示的是本地目录。`,"settings.source.saved":`已保存的覆盖值`,"settings.source.environment":`环境变量`,"settings.source.hostConfig":`主机配置`,"settings.source.other":`解析后的配置`,"settings.value.enabled":`已启用`,"settings.value.disabled":`已停用`,"settings.effort.low":`低推理强度`,"settings.effort.medium":`中等推理强度`,"settings.effort.high":`高推理强度`,"settings.effort.xhigh":`超高推理强度`,"settings.role.curator":`知识维护`,"settings.role.curatorDoc":`维护并提炼可复用技能库。`,"settings.footer":`配置项同时显示易读标签和原始键。完整配置仍可通过以下命令查看:`,"identity.title":`身份`,"identity.subtitle":`本项目中 Argus 服务的对象`,"identity.placeholder":`描述 Argus 正在为谁工作,以及需要长期遵循的偏好…`,"identity.save":`保存身份`,"identity.saved":`身份已保存。`,"transcript.title":`对话记录`,"transcript.subtitle":`近期操作者 ↔ Argus 对话 · 请从输入框继续回复`,"transcript.empty":`暂无对话记录`,"transcript.operator":`操作者`,"new.createDaemon":`创建会话`,"new.createdIdle":`新会话已就绪。说一句你想做什么,工作就开始了。`,"new.createdStarting":`新会话已就绪,工作正在后台开始。`,"new.subtitle":`在这里保存你的对话和任务进度。`,"new.close":`关闭创建会话窗口`,"new.name":`名称`,"new.optional":`(可选)`,"new.namePlaceholder":`例如:AAAI 具身智能论文`,"new.workdir":`输出工作目录`,"new.workdirHint":`Agent 会在这里写入代码、论文、报告和实验结果。内部记忆仍保存在会话状态目录中。`,"new.objective":`目标`,"new.objectivePlaceholder":`留空则从对话开始,也可以填写一个立即启动的持续任务。`,"new.startsAfterCreate":`创建会话后立即启动任务`,"new.idleUntilMessage":`收到第一条消息前保持空闲`,"new.startsHint":`会话会立即打开,Argus 将在后台准备相关工作。`,"new.idleHint":`收到第一条消息后,Argus 会按需启动后台工作。`,"new.shortcut":`按 Ctrl/⌘+Enter 创建`,"new.creating":`正在创建…`,"new.createAndStart":`创建并启动`,"manage.daemon":`管理会话`,"manage.displayName":`显示名称`,"manage.executor":`后台工作`,"manage.running":`运行中`,"manage.runningExternally":`由外部运行`,"manage.paused":`未运行`,"manage.pauseHint":`中断当前操作并保留可恢复的进度。`,"manage.stopNow":`立即停止`,"manage.stopNowHint":`立即中断这个已验证的 daemon,停止后即可删除会话。`,"manage.externalHint":`此会话由此应用之外的服务管理。`,"manage.resumeHint":`继续执行队列中的研究工作。`,"manage.working":`处理中…`,"manage.resume":`继续`,"manage.deleteSession":`删除会话`,"manage.deleteHint":`删除的会话会移入回收站,之后仍可恢复。请先停止后台工作。`,"manage.delete":`删除…`,"manage.confirmQuestion":`将此会话移入回收站?`,"manage.confirmDelete":`确认删除`,"decision.operator":`操作者决策`,"decision.required":`需要你的决策`,"decision.whyBlocked":`这项任务记录的待答原因`,"decision.currentTask":`当前任务`,"decision.taskName":`任务:{title}`,"decision.otherTask":`其他待处理任务`,"decision.awaitingReply":`等待你的回复`,"decision.askedAt":`提问于 {time}`,"decision.evidence":`证据`,"decision.notePlaceholder":`添加 Manager 应采用的指导…`,"decision.resumeHint":`回答只针对这项任务,Manager 会据此检查它的下一步。`,"decision.later":`稍后处理`,"decision.applying":`已提交,Argus 正在开始处理…`,"decision.closeContinue":`关闭,后台继续`,"decision.stopCampaign":`停止持续任务`,"decision.useOption":`使用此选项`,"decision.sendAnswer":`发送回答`,"decision.noteRequired":`这个选项需要补充说明后才能提交。`,"artifact.preview":`结果预览`,"artifact.title":`结果`,"artifact.approvedEvidence":`已经检查确认的依据`,"artifact.downloading":`正在下载…`,"artifact.download":`下载`,"artifact.open":`打开`,"artifact.close":`关闭结果预览`,"artifact.unavailable":`无法预览`,"artifact.empty":`(空文件)`,"artifact.truncated":`预览已截断 · 请下载完整文件查看`,"artifact.htmlTooLarge":`HTML 文件过大,无法安全预览。请下载完整文件。`,"artifact.pdfDisabled":`此浏览器已禁用内嵌 PDF 预览。`,"artifact.openPdf":`打开 PDF`,"artifact.noPreview":`此文件类型无法安全地在线预览。`,"artifact.downloadHint":`请下载后使用本地应用查看。`,"task.details":`任务详情`,"task.stopLoop":`停止循环`,"task.done":`完成`,"task.skip":`跳过`,"task.close":`关闭任务详情`,"task.waitingOnYou":`等待你的回复`,"task.objective":`目标`,"task.noObjective":`(未记录目标)`,"task.untitled":`未命名任务`,"task.priority":`优先级`,"task.started":`开始时间`,"task.finished":`完成时间`,"task.outcome":`结果`,"task.iteration":`迭代`,"task.mode":`模式`,"task.autoIterate":`自动迭代`,"task.singlePass":`单次执行`,"task.cycles":`轮次`,"task.cost":`成本`,"task.lastError":`最近错误`,"task.notes":`备注`,"task.dependsOn":`依赖`,"task.dependsOnCount":`依赖前置任务 {count} 项`,"pending.reviewRespond":`查看并回复`,"pending.showOnMap":`在地图上查看`,"backlog.active":`进行中 · {count}`,"backlog.history":`历史记录 · {count}`,"backlog.noHistory":`暂无已完成工作`,"backlog.empty":`队列中没有工作。Argus 已准备好接收新任务。`,"backlog.viewDetails":`查看完整任务详情`,"backlog.iterating":`重复执行中`,"backlog.stopIterating":`停止重复执行`,"backlog.stop":`停止`,"backlog.markDone":`标记为完成`,"backlog.remove":`移除`,"mission.achievement":`Argus 成果`,"mission.elapsed":`耗时`,"mission.rejectedAttempts":`{count} 次方案被拒绝`,"mission.skillsLearned":`学习了 {count} 个 Skill`,"mission.artifacts":`产出 {count} 个文件`,"mission.waiting":`等待任务`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`已准备就绪,请分配一个任务开始工作。`,"mission.statusDone":`本次任务:{outcome} — 用时 {elapsed}。`,"mission.nextAfterReply":`请先回复这项任务的问题,再决定它的下一步。`,"mission.continuousDone":`连续运行已完成`,"mission.resumeContinuous":`恢复`,"mission.control":`任务控制`,"mission.attentionHealth":`系统出错——运行状态异常。`,"mission.attentionFailed":`任务失败——请查看下方详情。`,"mission.deliveryFailed":`任务在交付阶段失败——执行未能启动或完成。`,"mission.attentionStepFailed":`有一个步骤失败——请查看下方任务。`,"mission.attentionPaused":`任务已暂停——正在等待你的输入。`,"mission.showObjective":`显示完整目标`,"mission.showFullOutput":`查看完整输出`,"mission.stage":`阶段`,"mission.campaign":`持续任务`,"mission.totalElapsed":`总耗时`,"mission.round":`轮次`,"mission.mode":`模式`,"mission.summary":`本次完成`,"mission.deliveryCertified":`交付成果已通过审核`,"mission.taskCompleted":`任务已完成`,"mission.openResult":`打开成果`,"mission.viewTask":`查看任务`,"mission.taskPlan":`任务计划`,"mission.team":`团队`,"mission.waitingShort":`等待中`,"mission.roleWork":`角色工作`,"mission.showMore":`显示更多`,"mission.showLess":`收起`,"mission.done":`已完成`,"mission.inProgress":`进行中`,"mission.failed":`失败`,"mission.bannerPaused":`任务已暂停 — 等待你的操作。`,"mission.bannerError":`系统异常 — 健康状态已降级。`,"mission.bannerStepFailed":`某步骤失败:{step}`,"mission.elapsedAgo":`{elapsed} 前`,"mission.filteredBy":`按 {task} 筛选 · 清除`,"mission.allVisible":`全部可见任务`,"mission.roundNumber":`第 {count} 轮`,"mission.noRoleWork":`当前筛选下还没有持久化的 {role} 工作记录。`,"mission.researchDag":`任务路线`,"mission.active":`进行中`,"mission.noDag":`Planner 尚未向路线中添加任务。`,"mission.workingHypothesis":`当前假设 · 可随证据调整`,"mission.goalContribution":`对目标的作用`,"mission.temporaryRegressions":`预期的暂时取舍`,"mission.decisionRule":`何时调整、拆分或停止`,"mission.acceptance":`完成的标准`,"mission.nonGoals":`非目标`,"mission.capabilities":`能力`,"mission.capabilitiesUnlocked":`已解锁能力`,"mission.learnedCapability":`已学习能力`,"mission.learnedDuring":`在“{mission}”期间学习`,"mission.skillUnavailable":`当前快照中没有此 Skill 的内容。`,"mission.contentTruncated":`内容预览已截断`,"mission.knowledgeRetained":`已保留知识`,"mission.selfEvolution":`已保存的项目知识`,"mission.knowledgeSaved":`Argus 已保存这些能力和笔记,供本项目后续工作使用。`,"mission.noCapabilities":`尚未学习新能力。`,"mission.replay":`任务回放`,"mission.replayTimeline":`回放任务时间线`,"mission.roleFailed":`{role} 执行失败`,"mission.showingLatestEvent":`显示最近一条事件`,"mission.showingLastEvents":`显示最近 {count} 条事件`,"mission.waitingEvents":`等待结构化研究事件。`,"mission.startsAfter":`需等待前置任务 {count} 项`,"mission.hiddenTasks":`已隐藏前序任务 {count} 项 · 阻塞或失败 {failed} 项 · 已跳过 {skipped} 项`,"mission.projectFilesChanged":`项目文件有变更`,"mission.reviewInIde":`可打开 IDE 查看差异`,"research.currentWork":`当前工作`,"research.dagProgress":`任务路线进度`,"research.verifiedOutputs":`已验证输出`,"research.recentMilestones":`近期里程碑`,"research.liveProgress":`任务进展`,"research.artifact":`研究成果`,"research.canvas":`Manager 实时研究面板`,"research.previewArtifact":`预览成果`,"research.openLarge":`打开大尺寸预览`,"research.collapse":`收起预览`,"research.unavailable":`Manager 实时视图暂时不可用。`,"research.noPreview":`暂无预览`,"research.waiting":`等待中…`,"research.updating":`正在更新…`,"research.fileUnavailable":`文件已就绪,可点击上方下载按钮获取。`,"research.eventSourced":`基于事件的任务状态`,"research.downloadFailed":`下载失败`,"operations.title":`运行控制`,"operations.work":`工作`,"operations.runtime":`运行时`,"operations.system":`系统`,"operations.recovery":`恢复`,"operations.workInput":`工作输入`,"operations.workHint":`加入工作、指导当前任务、保存备注,或仅预览计划而不分派。`,"operations.action.task":`任务`,"operations.action.nudge":`指导`,"operations.action.note":`备注`,"operations.action.plan":`计划`,"operations.planPlaceholder":`要预览的目标;预览不会加入任务队列`,"operations.actionPlaceholder":`输入 {action} 内容`,"operations.previewPlan":`预览计划`,"operations.submitAction":`提交 {action}`,"operations.runtimeHint":`更改会话运行位置、重置 Manager 上下文,或安全重启会话。`,"operations.workdir":`工作目录`,"operations.workdirUpdated":`工作目录已更新。`,"operations.applyWorkdir":`应用工作目录`,"operations.replaceSlot":`替换活动会话`,"operations.sourceUpdate":`Argus 源码版本`,"operations.pullLatest":`拉取最新版本`,"operations.updateChecking":`正在检查已发布分支…`,"operations.updateRunning":`正在更新…`,"operations.updateAvailable":`有可用更新`,"operations.updateCurrent":`已是最新`,"operations.updateUnavailable":`当前工作树无法安全更新。`,"operations.currentRevision":`当前`,"operations.latestRevision":`最新`,"operations.updatePhase":`阶段`,"operations.updateRestart":`源码已更新。请重启工作台,再使用重载按钮让活动 daemon 在安全任务边界切换到新版本。`,"operations.skills":`Skills`,"operations.runSkill":`运行 Skill 命令`,"operations.metrics":`系统指标`,"operations.trash":`可恢复的回收站`,"operations.searchTrash":`搜索回收站`,"operations.trashEmpty":`回收站为空。`,"resource.title":`资源`,"resource.loading":`正在加载资源状态…`,"resource.devices":`设备:{count}`,"resource.inUse":`使用中 · {count}`,"resource.queue":`等待队列 · {count}`,"resource.none":`无`,"resource.timeLeft":`剩余 {ttl}`,"resource.noIntent":`未记录用途`,"resource.yieldRequest":`收到释放资源请求 · {reason}`,"resource.queuePosition":`队列第 {position} 位`,"label.status.inProgress":`进行中`,"label.status.waiting":`等待中`,"label.status.completed":`已完成`,"label.status.blocked":`暂时无法继续`,"label.status.failed":`失败`,"label.status.needsChanges":`需要修改`,"label.status.skipped":`已跳过`,"label.status.paused":`已暂停`,"label.status.cancelled":`已取消`,"label.status.available":`可用`,"label.status.unavailable":`不可用`,"label.status.inaccessible":`无法访问`,"label.status.limited":`部分受限`,"label.status.healthy":`状态正常`,"label.status.updated":`状态已更新`,"label.role.argus":`Argus`,"label.role.you":`你`,"label.work.task":`任务`,"label.work.action":`工作步骤`,"label.work.handoff":`给下一步的说明`,"label.work.review":`审核`,"label.work.planning":`规划`,"label.work.update":`动态`,"label.stage.scope":`范围定义`,"label.stage.research":`研究`,"label.stage.implementation":`方法实现`,"label.stage.experiment":`实验验证`,"label.stage.analysis":`结果分析`,"label.stage.writing":`论文写作`,"label.stage.review":`最终审核`,"label.stage.delivery":`成果交付`,"label.stage.unstaged":`未分阶段`,"label.frontier.reopened":`已重新开启一项前序任务`,"label.frontier.added":`已添加一项新任务`,"label.frontier.completed":`这部分工作已完成`,"label.frontier.revised":`已调整任务计划`,"label.frontier.narrowed":`已缩小任务范围`,"label.frontier.expanded":`已扩大任务范围`,"label.frontier.updated":`任务计划已更新`,"label.priority":`优先级 {priority}`,"label.outcome.workCompleted":`工作已完成`,"label.outcome.workPaused":`工作已暂停`,"label.outcome.workBlocked":`工作暂时无法继续`,"label.outcome.workFailed":`工作失败`,"label.outcome.workEnded":`工作已结束`,"label.outcome.workIncomplete":`工作尚未完成`,"label.outcome.workStalled":`工作停滞`,"label.outcome.workUpdated":`工作状态已更新`,"label.outcome.reviewPassed":`结果检查通过`,"label.outcome.reviewNeedsChanges":`检查后发现需要修改`,"label.outcome.reviewBlocked":`结果检查暂时无法继续`,"label.outcome.reviewOutdated":`审核结果已过期`,"label.outcome.reviewPending":`等待审核`,"label.outcome.stageApproved":`可以进入下一步`,"label.outcome.stageNotApproved":`还不能进入下一步`,"label.outcome.stageRevoked":`阶段批准已撤回`,"label.outcome.stageNotNeeded":`无需阶段审核`,"label.outcome.stagePending":`还没确定能否进入下一步`,"label.outcome.budgetPaused":`因预算上限暂停`,"label.outcome.costUnreconciled":`调用费用待对账(并非预算耗尽)`,"label.outcome.waitingForYou":`正在等待你的回复`,"label.outcome.stoppedByYou":`已由你停止`,"label.outcome.pausedByYou":`已由你暂停`,"label.outcome.sessionPaused":`会话已暂停`,"label.outcome.serviceUnavailable":`服务暂不可用`,"label.outcome.serviceCoolingDown":`服务暂时暂停`,"label.outcome.temporaryIssue":`因临时问题暂停`,"label.outcome.serviceError":`因服务错误停止`,"label.outcome.needsPlan":`需要制定新计划`,"label.outcome.canResume":`可以继续`,"label.routing.team":`团队协作`,"label.routing.individual":`单独执行`,"label.routing.research":`研究任务`,"label.routing.software":`软件工作`,"label.routing.staged":`分步执行`,"label.routing.flexible":`灵活流程`,"label.routing.ongoing":`持续进行`,"label.routing.defined":`范围明确`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`加速设备`,"label.resource.enforced":`强制执行限制`,"label.resource.advisory":`仅提供建议`,"label.resource.released":`已释放资源`,"label.resource.kept":`继续占用资源`,"mission.lastProgress":`停下之前记录的进展`,"mission.nextResume":`进度已保存,重新运行 Argus 就会从停下的地方继续。`,"mission.nextResumeLive":`Argus 会从已保存的进度继续。`,"research.totalTime":`累计用时`,"research.optionDelivery":`交付`,"research.optionCheckpoint":`检查点`,"research.optionPending":`生成中`,"operations.unavailableHere":`这项功能在当前的 Argus 上不提供。`,"operations.requestFailed":`这次操作没有成功。`,"operations.technicalDetails":`技术细节`,"verticals.title":`垂域商店`,"verticals.entry":`垂域商店`,"verticals.openStore":`打开垂域商店`,"verticals.paletteHint":`安装 · 启用 · 更新`,"verticals.intro":`垂域为 Argus 提供一个研究领域的阶段、角色、技能与检查项。按项目需要安装,并为各工作区分别启用。`,"verticals.hostedNote":`垂域由服务方提供;你可以为自己的工作区启用或停用。`,"verticals.close":`关闭垂域商店`,"verticals.search":`搜索垂域`,"verticals.searchPlaceholder":`按名称、用途或标签搜索…`,"verticals.refreshCatalog":`刷新目录`,"verticals.refreshing":`正在刷新…`,"verticals.catalogSource":`目录来源:{source}`,"verticals.catalogRelease":`版本 {tag}`,"verticals.catalogFetched":`{time} 获取`,"verticals.catalogNever":`尚未获取目录`,"verticals.catalogError":`目录刷新失败:{error}`,"verticals.kindFilter":`按类型筛选`,"verticals.tagFilter":`按标签筛选`,"verticals.clearFilters":`清除筛选`,"verticals.count":`显示 {shown} / {total}`,"verticals.filter.all":`全部`,"verticals.routingPath":`分类 / 领域 / 专项`,"verticals.filter.installed":`已安装`,"verticals.filter.available":`可安装`,"verticals.filter.builtin":`内置`,"verticals.kind.builtin":`内置`,"verticals.kind.package":`随包提供`,"verticals.kind.installed":`已安装`,"verticals.kind.available":`可安装`,"verticals.enabled":`已启用`,"verticals.disabledState":`已停用`,"verticals.updateAvailable":`有新版本`,"verticals.updateTo":`更新至 {version}`,"verticals.installedVersion":`已安装 {version}`,"verticals.catalogVersion":`目录版本 {version}`,"verticals.requires":`依赖`,"verticals.shared":`共享资源`,"verticals.size":`大小`,"verticals.jumpTo":`查看 {name}`,"verticals.missingPython":`缺少 Python 包:{packages}。请把它们安装到运行 Argus 的那个 Python 环境里。`,"verticals.runtimeIssues":`已安装版本与当前 Argus 运行时不兼容:{issues}`,"verticals.installIssues":`目录版本的安装/更新被运行时要求阻止:{issues}`,"verticals.usedByOne":`1 个项目在用`,"verticals.usedBy":`{count} 个项目在用`,"verticals.action.install":`安装`,"verticals.action.update":`更新`,"verticals.action.enable":`启用`,"verticals.action.disable":`停用`,"verticals.action.uninstall":`卸载`,"verticals.confirmUninstall":`确认卸载`,"verticals.confirmUninstallHint":`将从这台 Argus 移除 {name}。`,"verticals.removeAnyway":`仍要移除`,"verticals.operation.install":`正在安装…`,"verticals.operation.update":`正在更新…`,"verticals.operation.enable":`正在启用…`,"verticals.operation.disable":`正在停用…`,"verticals.operation.uninstall":`正在卸载…`,"verticals.operationRunning":`处理中…`,"verticals.operationFailed":`{action}失败`,"verticals.loading":`正在读取垂域…`,"verticals.noMatches":`没有符合筛选条件的垂域。`,"verticals.none":`目前还没有可用的垂域。`,"verticals.loadFailed":`无法读取垂域列表。`,"verticals.actionFailed":`这次操作没有成功。`,"verticals.tooOld":`当前的 Argus 后端还没有垂域商店。请先更新 Argus,再打开这里管理垂域。`};function wt(){try{let e=localStorage.getItem(xt);if(e===`en`||e===`zh-CN`)return e}catch{}return navigator.language.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}function Tt(e,t={},n=wt()){let r=(n===`zh-CN`?Ct[e]:St[e])??e;return Et.has(e)&&(r=r.replace(/\bArgus\b/g,yt().name)),r.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??`{${n}}`))}var Et=new Set([`handshake.connecting`,`handshake.title`,`splash.starting`,`connection.pairingTitle`,`topbar.pauseDaemon`,`topbar.runDaemon`,`chat.messageArgus`,`palette.messageArgus`,`palette.stopDaemon`,`palette.startDaemon`,`role.system`,`label.role.argus`]),Dt=(0,x.createContext)({locale:`en`,setLocale:()=>void 0,t:(e,t)=>Tt(e,t,`en`)});function O({children:e}){let[t,n]=(0,x.useState)(wt),r=e=>{try{localStorage.setItem(xt,e)}catch{}n(e)};(0,x.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,x.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Tt(e,n,t)}),[t]);return(0,D.jsx)(Dt.Provider,{value:i,children:e})}function Ot(){return(0,x.useContext)(Dt)}var kt=class extends x.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){if(!this.state.failed)return this.props.children;let e=this.props.locale===`zh-CN`;return(0,D.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-bg p-8 text-ink`,role:`alert`,children:(0,D.jsxs)(`section`,{className:`max-w-lg rounded-xl border border-line bg-panel p-8 shadow-lg`,children:[(0,D.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-widest text-blue`,children:yt().name}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:e?`工作台暂时无法显示`:`The workspace could not be displayed`}),(0,D.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`页面资源未能正确加载。后端任务不会因此被停止;你仍可使用桌面菜单查看日志或设置。重新加载会丢弃页面中尚未发送的输入。`:`A page resource failed to load. Backend work has not been stopped. Desktop menus remain available for logs and settings. Reloading discards unsent input on this page.`}),(0,D.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,D.jsx)(`button`,{type:`button`,className:`rounded-md bg-blue px-4 py-2 text-sm text-white`,onClick:()=>window.location.reload(),children:e?`重新加载工作台`:`Reload workspace`}),(0,D.jsx)(`button`,{type:`button`,className:`rounded-md border border-line px-4 py-2 text-sm`,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`view`,`activity`),window.location.assign(e.toString())},children:e?`返回对话页面`:`Return to conversation`})]})]})})}};function At(){let e=(0,x.useSyncExternalStore)(xe,be,()=>!1),{locale:t}=Ot();if(!e)return null;let n=t===`zh-CN`;return(0,D.jsxs)(`div`,{role:`status`,className:`fixed left-1/2 top-3 z-[110] flex w-[min(92vw,42rem)] -translate-x-1/2 items-center gap-3 rounded-xl border border-blue/40 bg-panel px-4 py-3 text-sm text-ink shadow-xl`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`strong`,{children:n?`页面已更新`:`Page update available`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:n?`刷新后显示最新选项和功能。请先复制未发送的内容。`:`Refresh for the latest options and features. Copy any unsent text first.`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`shrink-0 rounded-md border border-blue/40 px-3 py-2 text-xs text-blue`,children:n?`刷新页面`:`Refresh page`})]})}var k={ADVISOR_CONSULTATION_REQUESTED:`advisor.consultation.requested`,ADVISOR_CONSULTATION_COMPLETED:`advisor.consultation.completed`,ADVISOR_CONSULTATION_FAILED:`advisor.consultation.failed`,ADVISOR_CONSULTATION_CANCELLED:`advisor.consultation.cancelled`,ADVISOR_CONSULTATION_TIMED_OUT:`advisor.consultation.timed_out`,ADVISOR_CONSULTATION_MODEL_MISMATCH:`advisor.consultation.model_mismatch`,LIFE_MANAGER_SUPERVISION_ISSUED:`life.manager.supervision.issued`,LIFE_MANAGER_SUPERVISION_APPLIED:`life.manager.supervision.applied`,LIFE_MANAGER_SUPERVISION_FAILED:`life.manager.supervision.failed`,LIFE_PEER_MESSAGE_PROCESSED:`life.peer.message.processed`,LIFE_CONFIG_PARSE_FAILED:`life.config.parse_failed`,AGENT_IO_START:`agent.io.start`,AGENT_IO_STREAM:`agent.io.stream`,AGENT_IO_COMPLETE:`agent.io.complete`,AGENT_IO_ERROR:`agent.io.error`,USAGE_RECORDED:`usage.recorded`,ACCOUNTING_JOURNAL_REPAIRED:`accounting.journal_repaired`,PROVIDER_REQUEST_STARTED:`provider.request.started`,PROVIDER_REQUEST_COMPLETED:`provider.request.completed`,PROVIDER_REQUEST_DENIED:`provider.request.denied`,CODEX_UTIL_COMPLETED:`codex.util.completed`,SKILL_COST_COMPLETED:`skill.cost.completed`,BUDGET_RESERVATION_CREATED:`budget.reservation.created`,BUDGET_RESERVATION_DENIED:`budget.reservation.denied`,BUDGET_RESERVATION_SETTLED:`budget.reservation.settled`,BUDGET_RESERVATION_RELEASED:`budget.reservation.released`,BUDGET_UNPRICED_BLOCKED:`budget.unpriced.blocked`,BUDGET_UNPRICED_ACKNOWLEDGED:`budget.unpriced.acknowledged`,LOOP_START:`loop.start`,LOOP_DONE:`loop.done`,ROUND_START:`round.start`,ROUND_MAIN_COMPLETED:`round.main.completed`,ROUND_REVIEW_STARTED:`round.review.started`,ROUND_REVIEW_DEFERRED:`round.review.deferred`,ROUND_REVIEW_COMPLETED:`round.review.completed`,ROUND_CHECKPOINT_RECORDED:`round.checkpoint.recorded`,ROUND_CHECKPOINT_FAILED:`round.checkpoint.failed`,ROUND_SECRET_REDACTED:`round.secret_redacted`,ROUND_ESCALATED:`round.escalated`,ROUND_STALL:`round.stall`,ROUND_REVIEWER_BACKEND_FAILURE:`round.reviewer_backend_failure`,ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF:`round.reviewer_backend_failure.backoff`,ROUND_BACKEND_FAILURE_BACKOFF:`round.backend_failure.backoff`,ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED:`round.backend_failure.hold_interrupted`,ROUND_WATCHDOG_RETRY:`round.watchdog.retry`,ROUND_WATCHDOG_RETRY_EXHAUSTED:`round.watchdog.retry_exhausted`,ROUND_MODEL_CONFIGURATION_ERROR:`round.model_configuration_error`,ROUND_PROVIDER_TURN_CAP_RESTART:`round.provider_turn_cap.restart`,ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART:`round.provider_turn_cap.reviewer_restart`,ROUND_ORPHAN_PROCESS_GROUP:`round.orphan_process_group`,ROUND_EXTERNAL_WORK_WAIT_STARTED:`round.external_work_wait.started`,ROUND_EXTERNAL_WORK_WAIT_COMPLETED:`round.external_work_wait.completed`,ROUND_EXTERNAL_WORK_REVIEW_REQUIRED:`round.external_work_review.required`,ROUND_EXTERNAL_WORK_REVIEW_COMPLETED:`round.external_work_review.completed`,ROLE_SESSION_TURN:`role.session.turn`,ENGINEER_PROGRESS:`engineer.progress`,ENGINEER_SKILL_MAINTENANCE_COMPLETED:`engineer.skill_maintenance.completed`,LIFE_STATUS:`life.status`,LIFE_PHASE_STARTED:`life.phase.started`,LIFE_MISSION_STARTED:`life.mission.started`,LIFE_MISSION_COMPLETED:`life.mission.completed`,LIFE_MISSION_FAILED:`life.mission.failed`,LIFE_MISSION_SKIPPED:`life.mission.skipped`,LIFE_MISSION_ORPHANED:`life.mission.orphaned`,LIFE_MISSION_REQUEUED:`life.mission.requeued`,LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED:`life.mission.provider_configuration_disabled`,LIFE_ITERATION_CONTINUED:`life.iteration.continued`,LIFE_REVIEW_WAIVED:`life.review.waived`,LIFE_POST_MISSION_STOP:`life.post_mission.stop`,LIFE_EXECUTION_HOST_BLOCKED:`life.execution_host.blocked`,LIFE_AUTH_FAILURE:`life.auth_failure`,LIFE_SUPERVISOR_ERROR:`life.supervisor.error`,LIFE_LEARNED_VERTICAL_PROMOTED:`life.learned_vertical.promoted`,LIFE_LEARNED_VERTICAL_PROMOTION_FAILED:`life.learned_vertical.promotion_failed`,LIFE_MANAGER_INTENT_STARTED:`life.manager.intent.started`,LIFE_MANAGER_INTENT_COMPLETED:`life.manager.intent.completed`,LIFE_MANAGER_INTENT_FAILED:`life.manager.intent.failed`,LIFE_MANAGER_INTENT_SUPERSEDED:`life.manager.intent.superseded`,LIFE_MANAGER_GOAL_CONTRACT_FAILED:`life.manager.goal_contract.failed`,LIFE_MANAGER_STAGE_DECISION:`life.manager.stage_decision`,LIFE_MANAGER_PLAN_CHALLENGE_DECIDED:`life.manager.plan_challenge.decided`,LIFE_MANAGER_FEEDBACK_PERSISTED:`life.manager.feedback.persisted`,LIFE_MANAGER_FEEDBACK_UNRESOLVED:`life.manager.feedback.unresolved`,LIFE_MANAGER_FEEDBACK_EXHAUSTED:`life.manager.feedback.exhausted`,LIFE_MANAGER_PROJECT_REPORT:`life.manager.project_report`,LIFE_MANAGER_PROJECT_REPORT_FAILED:`life.manager.project_report.failed`,LIFE_VERTICAL_RESOLVED:`life.vertical.resolved`,LIFE_MANAGER_BACKEND_RESOLVED:`life.manager.backend_resolved`,LIFE_PLANNER_BACKEND_RESOLVED:`life.planner.backend_resolved`,LIFE_ENGINEER_BACKEND_RESOLVED:`life.engineer.backend_resolved`,LIFE_REVIEWER_BACKEND_RESOLVED:`life.reviewer.backend_resolved`,LIFE_CURATOR_BACKEND_RESOLVED:`life.curator.backend_resolved`,LIFE_PLANNER_START:`life.planner.start`,LIFE_PLANNER_PREVIEW_SKIPPED:`life.planner.preview_skipped`,LIFE_PLANNER_NORMALIZED:`life.planner.normalized`,LIFE_PLANNER_TASK_ADDED:`life.planner.task_added`,LIFE_PLANNER_TASK_SKIPPED:`life.planner.task_skipped`,LIFE_PLANNER_VERDICT:`life.planner.verdict`,LIFE_PLANNER_WAITING:`life.planner.waiting`,LIFE_PLANNER_WAITING_WOKEN:`life.planner.waiting_woken`,LIFE_PLANNER_TERMINAL_IDLE:`life.planner.terminal_idle`,LIFE_PLANNER_VERIFICATION_PROBE:`life.planner.verification_probe`,LIFE_PLANNER_STALL_ESCALATION:`life.planner.stall_escalation`,LIFE_PLANNER_DEPENDENCY_DROPPED:`life.planner.dependency_dropped`,LIFE_PLANNER_PARALLEL_DROPPED:`life.planner.parallel_dropped`,LIFE_PLANNER_ERROR:`life.planner.error`,LIFE_PLANNER_DEFERRED:`life.planner.deferred`,LIFE_PLANNER_SUPERSEDED:`life.planner.superseded`,LIFE_PLANNER_WAIT_OVERRIDDEN:`life.planner.wait_overridden`,LIFE_PLANNER_WAITING_CONTRACT_NORMALIZED:`life.planner.waiting_contract.normalized`,LIFE_PLANNER_EXTERNAL_POLL_SUPPRESSED:`life.planner.external_poll_suppressed`,LIFE_PLANNER_VERDICT_DISCARDED:`life.planner.verdict.discarded`,LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED:`life.planner.final_submission_skipped`,LIFE_PLANNER_CONTINUATION_REQUIRED:`life.planner.continuation_required`,LIFE_PLANNER_COMPLETION_REJECTED:`life.planner.completion_rejected`,LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED:`life.planner.completion_circuit_opened`,LIFE_PLANNER_COMPLETION_CIRCUIT_HOLDING:`life.planner.completion_circuit_holding`,LIFE_PLANNER_COMPLETION_CIRCUIT_NOTIFY_FAILED:`life.planner.completion_circuit.notify_failed`,PLAN_DRAFT_START:`plan.draft.start`,PLAN_DRAFT_DONE:`plan.draft.done`,PLAN_DRAFT_FAILED:`plan.draft.failed`,LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED:`life.runtime_failure.circuit_opened`,LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED:`life.runtime_failure.circuit_blocked`,LIFE_RUNTIME_FAILURE_CANARY_PASSED:`life.runtime_failure.canary_passed`,LIFE_RUNTIME_INCIDENT_DETECTED:`life.runtime.incident.detected`,LIFE_RUNTIME_INCIDENT_RECOVERED:`life.runtime.incident.recovered`,LIFE_RUNTIME_INCIDENT_ESCALATED:`life.runtime.incident.escalated`,LIFE_PLAN_REVISION_PROPOSED:`life.plan.revision.proposed`,LIFE_PLAN_REVISION_REJECTED:`life.plan.revision.rejected`,LIFE_PLAN_REVISION_COMMITTED:`life.plan.revision.committed`,LIFE_PLAN_NODE_SUPERSEDED:`life.plan.node.superseded`,LIFE_PLAN_REVISION_ROLLED_BACK:`life.plan.revision.rolled_back`,LIFE_RESEARCH_SECOND_READING:`life.research.second_reading`,LIFE_LETTER_WRITTEN:`life.letter.written`,LIFE_BUDGET_PAUSE:`life.budget.pause`,LIFE_LIFECYCLE_BLOCK:`life.lifecycle.block`,LIFE_LIFECYCLE_TRANSITION:`life.lifecycle.transition`,LIFE_INBOX_QUEUED:`life.inbox.queued`,LIFE_INBOX_DRAINED:`life.inbox.drained`,LIFE_OPERATOR_QUESTION_PENDING:`life.operator_question.pending`,LIFE_OPERATOR_QUESTION_ANSWERED:`life.operator_question.answered`,LIFE_DAEMON_IDLE_TIMEOUT:`life.daemon.idle_timeout`,LIFE_DAEMON_READY:`life.daemon.ready`,LIFE_DAEMON_DEGRADED:`life.daemon.degraded`,PROJECT_COMPLETED:`project.completed`,PROJECT_COMPLETION_REFUSED:`project.completion_refused`,DAEMON_PARKED:`daemon.parked`,DAEMON_COMMAND_SUBMITTED:`daemon.command.submitted`,DAEMON_COMMAND_COMPLETED:`daemon.command.completed`,DAEMON_COMMAND_REJECTED:`daemon.command.rejected`,IDEA_SEARCH_STARTED:`idea.search.started`,IDEA_SEARCH_COMPLETED:`idea.search.completed`,IDEA_SEARCH_SKIPPED:`idea.search.skipped`,IDEA_PORTFOLIO_FORMED:`idea.portfolio.formed`,IDEA_PORTFOLIO_NESTED_SKIPPED:`idea.portfolio.nested_skipped`,VENUE_RESEARCH_STARTED:`venue.research.started`,VENUE_RESEARCH_COMPLETED:`venue.research.completed`,RESEARCH_ACHIEVEMENT_CERTIFIED:`research.achievement.certified`,SKILL_LIBRARY_AVAILABLE:`skill.library.available`,SKILL_CREATED:`skill.created`,SKILL_UPDATED:`skill.updated`,SKILL_ARCHIVED:`skill.archived`,SKILL_TIDIED:`skill.tidied`,SKILL_HISTORY_COMPRESSED:`skill.history.compressed`,SKILL_EVOLUTION_COMPLETED:`skill.evolution.completed`,TEAM_LEARNING_REVIEW_STARTED:`team.learning.review.started`,TEAM_LEARNING_REVIEW_SKIPPED:`team.learning.review.skipped`,TEAM_LEARNING_REVIEW_COMPLETED:`team.learning.review.completed`,TEAM_LEARNING_REVIEW_FAILED:`team.learning.review.failed`,TEAM_LEARNING_PROMOTION_QUARANTINED:`team.learning.promotion.quarantined`,SELF_LEARNING_REVIEW_STARTED:`self.learning.review.started`,SELF_LEARNING_REVIEW_COMPLETED:`self.learning.review.completed`,SELF_LEARNING_REVIEW_FAILED:`self.learning.review.failed`,DOMAIN_PROMOTION:`domain.promotion`,WIKI_INITIALIZED:`wiki.initialized`,WIKI_HOOK_WARNING:`wiki.hook.warning`,WIKI_CREATED:`wiki.created`,WIKI_UPDATED:`wiki.updated`,WIKI_RETIRED:`wiki.retired`,WIKI_PROMOTION_PROMOTED:`wiki.promotion.promoted`,WIKI_PROMOTION_DEMOTED:`wiki.promotion.demoted`,WIKI_RETIRED_COMPRESSED:`wiki.retired.compressed`,WIKI_EVOLUTION_COMPLETED:`wiki.evolution.completed`,KNOWLEDGE_LEARNED:`knowledge.learned`,KNOWLEDGE_RECALLED:`knowledge.recalled`,OPERATOR_ALERT:`operator_alert`,MANAGER_LIVE_VIEW_UPDATED:`manager.live_view.updated`,MANAGER_LIVE_VIEW_REJECTED:`manager.live_view.rejected`,MANAGER_TURN_STARTED:`manager.turn.started`,MANAGER_TURN_CANCELLED:`manager.turn.cancelled`,USER_NOTE:`user.note`,UI_OPERATOR:`ui.operator`,UI_ARGUS:`ui.argus`},jt={"loop.started":k.LOOP_START,"loop.completed":k.LOOP_DONE,"round.started":k.ROUND_START,"mission.started":k.LIFE_MISSION_STARTED,"mission.completed":k.LIFE_MISSION_COMPLETED,"mission.error":k.LIFE_MISSION_FAILED};k.ADVISOR_CONSULTATION_COMPLETED,k.ADVISOR_CONSULTATION_FAILED,k.ADVISOR_CONSULTATION_CANCELLED,k.ADVISOR_CONSULTATION_TIMED_OUT,k.ADVISOR_CONSULTATION_MODEL_MISMATCH,k.LIFE_MANAGER_SUPERVISION_APPLIED,k.LIFE_MANAGER_SUPERVISION_FAILED,k.LIFE_PEER_MESSAGE_PROCESSED,k.LIFE_CONFIG_PARSE_FAILED,k.LIFE_MANAGER_BACKEND_RESOLVED,k.LIFE_PLANNER_BACKEND_RESOLVED,k.LIFE_ENGINEER_BACKEND_RESOLVED,k.LIFE_REVIEWER_BACKEND_RESOLVED,k.LIFE_CURATOR_BACKEND_RESOLVED,k.LOOP_START,k.LOOP_DONE,k.ROUND_START,k.ROUND_MAIN_COMPLETED,k.ROUND_REVIEW_DEFERRED,k.ROUND_REVIEW_COMPLETED,k.ROUND_CHECKPOINT_RECORDED,k.ROUND_CHECKPOINT_FAILED,k.ROUND_SECRET_REDACTED,k.ROUND_ESCALATED,k.ROUND_STALL,k.ROUND_REVIEWER_BACKEND_FAILURE,k.ENGINEER_SKILL_MAINTENANCE_COMPLETED,k.SKILL_LIBRARY_AVAILABLE,k.SKILL_CREATED,k.SKILL_UPDATED,k.SKILL_ARCHIVED,k.SKILL_TIDIED,k.SKILL_HISTORY_COMPRESSED,k.SKILL_EVOLUTION_COMPLETED,k.WIKI_INITIALIZED,k.WIKI_HOOK_WARNING,k.WIKI_CREATED,k.WIKI_UPDATED,k.WIKI_RETIRED,k.WIKI_PROMOTION_PROMOTED,k.WIKI_PROMOTION_DEMOTED,k.WIKI_RETIRED_COMPRESSED,k.WIKI_EVOLUTION_COMPLETED,k.KNOWLEDGE_LEARNED,k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MANAGER_INTENT_STARTED,k.LIFE_MANAGER_INTENT_COMPLETED,k.LIFE_MANAGER_INTENT_FAILED,k.LIFE_MANAGER_STAGE_DECISION,k.LIFE_MANAGER_PLAN_CHALLENGE_DECIDED,k.LIFE_VERTICAL_RESOLVED,k.LIFE_PLANNER_START,k.LIFE_PLANNER_PREVIEW_SKIPPED,k.LIFE_PLANNER_TASK_ADDED,k.LIFE_PLANNER_TASK_SKIPPED,k.LIFE_PLANNER_DEPENDENCY_DROPPED,k.LIFE_PLANNER_PARALLEL_DROPPED,k.LIFE_PLANNER_VERDICT,k.LIFE_PLANNER_WAITING,k.LIFE_PLANNER_WAITING_WOKEN,k.LIFE_PLANNER_TERMINAL_IDLE,k.LIFE_PLANNER_VERIFICATION_PROBE,k.LIFE_PLANNER_STALL_ESCALATION,k.LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED,k.LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED,k.LIFE_RUNTIME_FAILURE_CANARY_PASSED,k.LIFE_RUNTIME_INCIDENT_DETECTED,k.LIFE_RUNTIME_INCIDENT_RECOVERED,k.LIFE_RUNTIME_INCIDENT_ESCALATED,k.LIFE_PLAN_REVISION_PROPOSED,k.LIFE_PLAN_REVISION_REJECTED,k.LIFE_PLAN_REVISION_COMMITTED,k.LIFE_PLAN_NODE_SUPERSEDED,k.LIFE_RESEARCH_SECOND_READING,k.LIFE_LETTER_WRITTEN,k.LIFE_BUDGET_PAUSE,k.BUDGET_RESERVATION_DENIED,k.BUDGET_UNPRICED_BLOCKED,k.LIFE_LIFECYCLE_BLOCK,k.LIFE_LIFECYCLE_TRANSITION,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.LIFE_INBOX_QUEUED,k.LIFE_INBOX_DRAINED,k.LIFE_DAEMON_IDLE_TIMEOUT,k.PROJECT_COMPLETED,k.PROJECT_COMPLETION_REFUSED,k.DAEMON_PARKED,k.DAEMON_COMMAND_COMPLETED,k.DAEMON_COMMAND_REJECTED,k.IDEA_SEARCH_STARTED,k.IDEA_SEARCH_COMPLETED,k.IDEA_SEARCH_SKIPPED,k.VENUE_RESEARCH_STARTED,k.VENUE_RESEARCH_COMPLETED,k.RESEARCH_ACHIEVEMENT_CERTIFIED,k.LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED,k.LIFE_ITERATION_CONTINUED,k.LIFE_REVIEW_WAIVED,k.LIFE_POST_MISSION_STOP,k.LIFE_EXECUTION_HOST_BLOCKED,k.LIFE_AUTH_FAILURE,k.LIFE_SUPERVISOR_ERROR,k.LIFE_LEARNED_VERTICAL_PROMOTED,k.LIFE_LEARNED_VERTICAL_PROMOTION_FAILED,k.LIFE_MANAGER_INTENT_SUPERSEDED,k.LIFE_MANAGER_GOAL_CONTRACT_FAILED,k.LIFE_MANAGER_FEEDBACK_PERSISTED,k.LIFE_MANAGER_FEEDBACK_EXHAUSTED,k.LIFE_MANAGER_PROJECT_REPORT_FAILED,k.LIFE_PLANNER_DEFERRED,k.LIFE_PLANNER_SUPERSEDED,k.LIFE_PLANNER_WAIT_OVERRIDDEN,k.LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED,k.LIFE_PLANNER_CONTINUATION_REQUIRED,k.LIFE_PLANNER_COMPLETION_REJECTED,k.LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED,k.PLAN_DRAFT_DONE,k.PLAN_DRAFT_FAILED,k.LIFE_PLAN_REVISION_ROLLED_BACK,k.ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED,k.ROUND_WATCHDOG_RETRY,k.ROUND_WATCHDOG_RETRY_EXHAUSTED,k.ROUND_MODEL_CONFIGURATION_ERROR,k.ROUND_PROVIDER_TURN_CAP_RESTART,k.ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART,k.ROUND_ORPHAN_PROCESS_GROUP,k.ROUND_EXTERNAL_WORK_WAIT_STARTED,k.ROUND_EXTERNAL_WORK_WAIT_COMPLETED,k.ROUND_EXTERNAL_WORK_REVIEW_REQUIRED,k.ROUND_EXTERNAL_WORK_REVIEW_COMPLETED,k.LIFE_DAEMON_DEGRADED,k.IDEA_PORTFOLIO_FORMED,k.TEAM_LEARNING_REVIEW_STARTED,k.TEAM_LEARNING_REVIEW_COMPLETED,k.TEAM_LEARNING_REVIEW_FAILED,k.TEAM_LEARNING_PROMOTION_QUARANTINED,k.DOMAIN_PROMOTION,k.MANAGER_LIVE_VIEW_UPDATED,k.MANAGER_TURN_STARTED,k.MANAGER_TURN_CANCELLED,k.USER_NOTE,k.UI_OPERATOR,k.UI_ARGUS,k.OPERATOR_ALERT,k.AGENT_IO_START,k.AGENT_IO_COMPLETE,k.AGENT_IO_ERROR,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.USAGE_RECORDED;function Mt(e){let t=String(e??``).trim();return Object.hasOwn(jt,t)?jt[t]:t}function Nt(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Nt).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Nt(t[e])}`).join(`,`)}}`}function Pt(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function Ft(e){let t=e.event_id??e.id??e.seq??e._offset,n=String(e.type??`event`);return t!=null&&t!==``?`${n}-${String(t)}`:`${n}-${String(e.ts??e.time??``)}-${Pt(Nt(e))}`}function It(e){return e.type===k.ENGINEER_PROGRESS&&e.kind===`reasoning`}function Lt(e){if(e.type!==k.ENGINEER_PROGRESS||![`assistant_message`,`agent_message`,`message`].includes(String(e.kind??``)))return!1;let t=String(e.agent_layer??e.actor??``);return String(e.text??``).trimStart().startsWith(`{`)?t===`reviewer`||t===`planner`:!1}var Rt=/^(?:[-*+]\s*)?[`*_]*(?:ARGUS_)?(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS|ROLE_DECISION)[`*_]*\s*[:=]|^(?:final\s+)?decision\s*:\s*$/i;function zt(e){return String(e??``).split(/\r?\n/).filter(e=>!Rt.test(e.trim())).join(` +`).trim()}function Bt(e){let t=String(e.fragment_mode??``);return t===`append`||t===`snapshot`?t:e.replace===!0?`snapshot`:`auto`}function Vt(e,t){let n=Math.min(e.length,t.length);for(let r=n;r>=8;--r)if(e.endsWith(t.slice(0,r)))return r;return 0}function Ht(e,t,n=`auto`){let r=(e||``).trim(),i=(t||``).trim();if(!r)return i;if(!i)return r;if(n===`snapshot`)return i;if(r.includes(i))return r;if(n===`append`)return`${r}\n${i}`;if(i.includes(r))return i;let a=Vt(r,i);return a?`${r}${i.slice(a)}`:`${r}\n${i}`}var Ut=[`all`,`attention`,`milestones`,`messages`],Wt=new Set([k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MISSION_FAILED,k.LOOP_START,k.LOOP_DONE,k.LIFE_PLANNER_VERDICT,k.LIFE_BUDGET_PAUSE,k.LIFE_LIFECYCLE_BLOCK]);function Gt(e,t,n=`all`,r=``){let i=Mt(e.canonical_type??e.type),a=String(e.kind??``);if(n===`attention`&&![`warn`,`err`].includes(String(t.tone??``))&&e.operator_alert!==!0||n===`milestones`&&!(t.rule&&!i.startsWith(`ui.`))&&!Wt.has(i)||n===`messages`&&t.tone!==`bright`&&![`assistant_message`,`agent_message`,`message`].includes(a)&&![`ui.operator`,`ui.argus`].includes(i))return!1;let o=r.trim().toLocaleLowerCase();return!o||[i,a,t.role,t.label,t.text,e.title,e.objective,e.text,e.summary,e.reason,e.error,e.status,e.action_summary,e.command,e.path,Array.isArray(e.tags)?e.tags.join(` `):e.tags].some(e=>String(e??``).toLocaleLowerCase().includes(o))}function Kt(e,t,n){e.setQueryData([`snapshot`,t],e=>e&&{...e,session:{...e.session,display_name:n}}),e.setQueryData([`projects`],e=>e&&{...e,projects:e.projects.map(e=>e.id===t?{...e,display_name:n,label:n||e.objective||e.id}:e)})}var qt=15e3,Jt=5e3,Yt=8e3,Xt=2e3,Zt=1e4,A=1e4;function Qt(e,t){return!Ke(t)&&!(t instanceof Ce)&&e<1}function $t(e){return!Ke(e)&&Jt}function en(e){return e?.projects.some(e=>e.daemon_alive)?Xt:qt}function tn(e){return e?.daemon.alive||e?.manager_requests?.some(e=>e.status===`running`)?Xt:Yt}var nn=()=>s({queryKey:[`projects`],queryFn:E.projectIndex,refetchInterval:e=>en(e.state.data)}),rn=()=>s({queryKey:[`project-costs`],queryFn:({signal:e})=>E.projectCosts(e),retry:Qt,refetchInterval:e=>$t(e.state.error),refetchIntervalInBackground:!1}),an=e=>s({queryKey:[`snapshot`,e],queryFn:({signal:t})=>E.activeSnapshot(e,t),enabled:!!e,refetchInterval:e=>tn(e.state.data)}),on=(e,t=30,n=!0)=>s({queryKey:[`journal`,e,t],queryFn:({signal:n})=>E.journal(e,t,n),enabled:!!e&&n,refetchInterval:n?8e3:!1}),sn=(e,t)=>s({queryKey:[`doctor`,e],queryFn:({signal:t})=>E.doctor(e,t),enabled:!!e&&t}),cn=(e,t)=>s({queryKey:[`config`,e],queryFn:({signal:t})=>E.config(e,t),enabled:!!e&&t}),ln=(e,t)=>s({queryKey:[`identity`,e],queryFn:({signal:t})=>E.identity(e,t),enabled:!!e&&t}),un=(e,t,n=30)=>s({queryKey:[`transcript`,e,n],queryFn:({signal:t})=>E.transcript(e,n,t),enabled:!!e&&t}),dn=(e,t=!0)=>s({queryKey:[`artifacts`,e],queryFn:({signal:t})=>E.artifacts(e,t),enabled:!!e&&t,refetchInterval:t?Zt:!1}),fn=(e,t,n=null)=>s({queryKey:[`artifact`,e,t,n],queryFn:({signal:n})=>E.artifact(e,t,n),enabled:!!e&&!!t,refetchInterval:e=>t&&/(?:^|[\\/])REVIEW\.md$/i.test(t)&&!Ke(e.state.error)?2e3:!1}),pn=(e,t=!0)=>s({queryKey:[`git-diff`,e],queryFn:({signal:t})=>E.gitDiff(e,t),enabled:!!e&&t,refetchInterval:t?A:!1}),mn=(e,t)=>s({queryKey:[`backlog-item`,e,t],queryFn:({signal:n})=>E.backlogItem(e,t,n),enabled:!!e&&!!t});function hn(e,t){let n=c(),r=e=>{n.invalidateQueries({queryKey:[`snapshot`,e]}),n.invalidateQueries({queryKey:[`status`,e]}),n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`backlog-item`,e]})},i=()=>r(e);return{addTask:h({mutationFn:t=>E.addTask(e,t),onSuccess:i}),nudge:h({mutationFn:t=>E.nudge(e,t)}),note:h({mutationFn:t=>E.note(e,t)}),startDaemon:h({mutationFn:()=>E.startDaemon(e,t),onSuccess:i}),stopDaemon:h({mutationFn:n=>E.stopDaemon(e,n,t),onSuccess:i}),forceStopDaemon:h({mutationFn:()=>E.stopDaemon(e,!1,t,!0),onSuccess:i}),updateProject:h({mutationFn:e=>E.updateProject(e.sid,e.name),onSuccess:e=>{Kt(n,e.sid,e.name),r(e.sid)}}),deleteProject:h({mutationFn:()=>E.deleteProject(e),onSuccess:async()=>{let t=e;if(t){let e=e=>e.queryKey.some(e=>e===t);await n.cancelQueries({predicate:e}),n.removeQueries({predicate:e})}await n.invalidateQueries({queryKey:[`projects`]})}}),disposeBacklog:h({mutationFn:t=>E.disposeBacklog(e,t.id,t.op),onSuccess:i}),stopBacklog:h({mutationFn:t=>E.stopBacklog(e,t),onSuccess:i}),setContinuous:h({mutationFn:t=>E.setContinuous(e,t.enabled,t.objective??``),onSuccess:i})}}var gn=2e3;function _n(e,t){if(t.kind===`reset`)return{sid:t.sid,events:[],seen:new Set};if(t.sid!==e.sid)return e;if(t.kind===`seed`){let n=new Set,r=[];[...t.events,...e.events].forEach(e=>{let t=Ft(e);n.has(t)||(n.add(t),r.push(e))});let i=r.slice(-2e3);return{sid:e.sid,events:i,seen:new Set(i.map(e=>Ft(e)))}}let n=t.kind===`push`?[t.ev]:t.events,r=null,i=null;for(let t of n){let n=i??e.seen,a=Ft(t);n.has(a)||((!r||!i)&&(r=[...e.events],i=new Set(e.seen)),i.add(a),r.push(t))}return!r||!i?e:(r.length>gn&&r.splice(0,r.length-gn).forEach(e=>i.delete(Ft(e))),{sid:e.sid,events:r,seen:i})}var vn=new Set([`manager.live_view.updated`,`round.review.completed`,`life.mission.completed`]);function yn(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=String(n.type??``);if(vn.has(r)||r===`engineer.progress`&&n.kind===`file_change`)return Ft(n)}return``}var bn=new Set([`life.operator_question.pending`,`life.operator_question.answered`,`life.planner.task_added`,`life.planner.verdict`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`round.review.completed`]);function xn(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(bn.has(String(n.type??``)))return Ft(n)}return``}function Sn(e,t=0){let[n,r]=(0,x.useState)(()=>typeof navigator>`u`||navigator.onLine!==!1);(0,x.useEffect)(()=>{let e=()=>r(navigator.onLine!==!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),e(),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]);let[i,a]=(0,x.useReducer)(_n,{sid:null,events:[],seen:new Set}),[o,s]=(0,x.useState)({sid:null,connected:!1}),c=(0,x.useRef)(e);return c.current=e,(0,x.useEffect)(()=>{if(a({kind:`reset`,sid:e}),s({sid:e,connected:!1}),!e)return;let t=!1,n=new AbortController,r=[],i,o=()=>{if(i=void 0,t||c.current!==e||r.length===0){r=[];return}let n=r;r=[],a({kind:`push-many`,sid:e,events:n})};E.events(e,120,n.signal).then(n=>{!t&&c.current===e&&a({kind:`seed`,sid:e,events:n})}).catch(()=>{});let l=ht(e,n=>{!t&&c.current===e&&(r.push(n),i===void 0&&(i=window.setTimeout(o,40)))},{replay:40,onOpen:()=>{!t&&c.current===e&&s({sid:e,connected:!0})},onClose:()=>{!t&&c.current===e&&s({sid:e,connected:!1})}});return()=>{t=!0,n.abort(),i!==void 0&&window.clearTimeout(i),r=[],l()}},[e,t]),{events:i.sid===e?i.events:[],connected:n&&o.sid===e&&o.connected}}function Cn(e,t,n){let r=!1;e.addEventListener(`vite:preloadError`,e=>{let i=e.payload,a=i instanceof Error?i.message:String(i??``);if(!/\/(?:pdf[.-]|pdfjs)[^/\s]*\.(?:m?js)(?:[?#\s]|$)/i.test(a)&&/failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed|loading chunk .+ failed|unable to preload css/i.test(a)){if(r){e.preventDefault();return}try{let e=n.storage(),t=`argus.stale-chunk-reloaded`;if(e.getItem(t)===n.buildId)return;e.setItem(t,n.buildId)}catch{return}e.preventDefault(),r=!0,t()}})}var wn=`modulepreload`,Tn=function(e,t){return new URL(e,t).href},En={},Dn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Tn(t,n),t=s(t),t in En)return;En[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:wn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},On=window.location.pathname===`/admin/data`||window.location.pathname.startsWith(`/admin/data/`),kn=(0,x.lazy)(()=>Dn(()=>import(`./App-D406npOP.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)),An=(0,x.lazy)(()=>Dn(()=>import(`./WorkflowWorkbench-CU9bNt08.js`),__vite__mapDeps([10,1,2,3,7,8]),import.meta.url)),jn=(0,x.lazy)(()=>Dn(()=>import(`./AdminDataApp-BdHngqo1.js`),__vite__mapDeps([11,1,2,3,6,4,5,12,13,8,14]),import.meta.url));Cn(window,()=>window.location.reload(),{buildId:_e,storage:()=>window.sessionStorage}),On||Re();var Mn=window.parent!==window;document.documentElement.dataset.argusEmbedded=String(Mn);var Nn=new ue({defaultOptions:{queries:{staleTime:3e3,retry:Qt,refetchOnWindowFocus:!1}}});function Pn(){let e=s({queryKey:[`api-meta`],queryFn:E.meta}),{locale:t}=Ot();return e.error?(0,D.jsxs)(`div`,{role:`alert`,className:`p-8`,children:[e.error.message,(0,D.jsx)(`button`,{className:`ml-4 underline`,onClick:()=>void e.refetch(),children:t===`zh-CN`?`重新连接`:`Reconnect`})]}):e.data?e.data.capabilities.includes(`application.workflows.v1`)&&new URLSearchParams(window.location.search).get(`legacy`)!==`1`?(0,D.jsx)(An,{}):(0,D.jsx)(kn,{}):(0,D.jsx)(`div`,{className:`p-8`,children:t===`zh-CN`?`正在连接…`:`Connecting…`})}function Fn(){let{locale:e}=Ot();return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(At,{}),(0,D.jsx)(kt,{locale:e,children:(0,D.jsx)(x.Suspense,{fallback:(0,D.jsx)(`div`,{className:`grid min-h-screen place-items-center text-sm text-ink-faint`,children:e===`zh-CN`?`正在加载工作台…`:`Loading workbench…`}),children:On?(0,D.jsx)(jn,{}):(0,D.jsx)(Pn,{})})})]})}(On?Promise.resolve():bt()).then(()=>de.createRoot(document.getElementById(`root`)).render((0,D.jsx)(x.StrictMode,{children:(0,D.jsx)(_,{client:Nn,children:(0,D.jsx)(O,{children:(0,D.jsx)(Fn,{})})})}))).catch(e=>{let t=document.getElementById(`root`);t.setAttribute(`role`,`alert`),t.textContent=`Cannot open workbench: ${e instanceof Error?e.message:String(e)}`});export{yt as A,nt as B,Lt as C,Mt as D,k as E,Be as F,ge as G,Ye as H,Ve as I,ae as J,fe as K,st as L,We as M,Fe as N,Tt as O,E as P,Ke as R,It as S,zt as T,Qe as U,tt as V,S as W,un as _,dn as a,Gt as b,sn as c,ln as d,on as f,an as g,nn as h,fn as i,Ge as j,Ot as k,Sn as l,rn as m,yn as n,mn as o,hn as p,he as q,xn as r,cn as s,Dn as t,pn as u,Ut as v,Ht as w,Bt as x,Ft as y,qe as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/index-Cr9q41CR.js b/frontend/web/dist/assets/index-Cr9q41CR.js new file mode 100644 index 000000000..a7fcaf6c9 --- /dev/null +++ b/frontend/web/dist/assets/index-Cr9q41CR.js @@ -0,0 +1,13 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-ButSXpk-.js","./rolldown-runtime-hePW80VL.js","./icons-DHjcpj5P.js","./query-dCPZk0Xc.js","./markdown-BGG43fCg.js","./markdown-DvoRHisr.css","./AppearanceControls-BIflq6l1.js","./format-BNcptKD6.js","./useWorkbenchTheme-Drg51S8W.js","./App-DCNDn7WF.css","./WorkflowWorkbench-ALJfwXlc.js","./AdminDataApp-g0GVVQx7.js","./activity-DRTghqfr.js","./history-DKaffr1B.js","./code-xml-Cgb6b1v3.js","./AdminDataApp--AL95rdz.css"])))=>i.map(i=>d[i]); +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,v as r}from"./icons-DHjcpj5P.js";import{C as i,S as a,_ as o,a as s,c,d as l,f as u,g as d,h as f,l as p,m,n as h,p as g,s as _,u as v,v as y,w as ee,x as te,y as b}from"./query-dCPZk0Xc.js";import"./markdown-BGG43fCg.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ne=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,x(te);else{var t=n(l);t!==null&&de(ee,t.startTime-e)}}}function te(t,i){m=!1,h&&(h=!1,_(re),re=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!oe());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&de(ee,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var b=!1,ne=null,re=-1,ie=5,ae=-1;function oe(){return!(e.unstable_now()-aee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(re),re=-1):h=!0,de(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x(te))),r},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=t(((e,t)=>{t.exports=ne()})),ie=t((e=>{var t=r(),n=re();function i(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),u=Object.prototype.hasOwnProperty,d=/^[: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]*$/,f={},p={};function m(e){return u.call(p,e)?!0:u.call(f,e)?!1:d.test(e)?p[e]=!0:(f[e]=!0,!1)}function h(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?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(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){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function ee(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function te(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ve(e):``}function xe(e){switch(e.tag){case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 2:case 15:return e=be(e.type,!1),e;case 11:return e=be(e.type.render,!1),e;case 1:return e=be(e.type,!0),e;default:return``}}function Se(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 ae:return`Fragment`;case ie:return`Portal`;case se:return`Profiler`;case oe:return`StrictMode`;case x:return`Suspense`;case de:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case le:return(e.displayName||`Context`)+`.Consumer`;case ce:return(e._context.displayName||`Context`)+`.Provider`;case ue:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case fe:return t=e.displayName||null,t===null?Se(e.type)||`Memo`:t;case pe:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}function Ce(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`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return Se(t);case 8:return t===oe?`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 we(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ee(e){var t=Te(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function De(e){e._valueTracker||=Ee(e)}function Oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Te(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ke(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ae(e,t){var n=t.checked;return S({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function je(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=we(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Me(e,t){t=t.checked,t!=null&&te(e,`checked`,t,!1)}function Ne(e,t){Me(e,t);var n=we(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`)?Fe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Fe(e,t.type,we(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pe(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 Fe(e,t,n){(t!==`number`||ke(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ie=Array.isArray;function Le(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=We.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qe={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},Je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(qe).forEach(function(e){Je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),qe[t]=qe[e]})});function Ye(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||qe.hasOwnProperty(e)&&qe[e]?(``+t).trim():t+`px`}function C(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ye(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Xe=S({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 w(e,t){if(t){if(Xe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(i(62))}}function Ze(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 Qe=null;function $e(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var et=null,T=null,tt=null;function nt(e){if(e=Zi(e)){if(typeof et!=`function`)throw Error(i(280));var t=e.stateNode;t&&(t=$i(t),et(e.stateNode,e.type,t))}}function rt(e){T?tt?tt.push(e):tt=[e]:T=e}function it(){if(T){var e=T,t=tt;if(tt=T=null,nt(e),t)for(e=0;e>>=0,e===0?32:31-(Lt(e)/Rt|0)|0}var Bt=64,Vt=4194304;function Ht(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 Ut(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Ht(a))):r=Ht(s)}else o=n&~i,o===0?a!==0&&(r=Ht(a)):r=Ht(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))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 Yt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=n}function Xt(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=dr),mr=` `,hr=!1;function gr(e,t){switch(e){case`keyup`:return lr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function _r(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var vr=!1;function yr(e,t){switch(e){case`compositionend`:return _r(t);case`keypress`:return t.which===32?(hr=!0,mr):null;case`textInput`:return e=t.data,e===mr&&hr?null:e;default:return null}}function br(e,t){if(vr)return e===`compositionend`||!ur&&gr(e,t)?(e=Pn(),Nn=Mn=jn=null,vr=!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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Hr(n)}}function Wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gr(){for(var e=window,t=ke();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ke(e.document)}return t}function Kr(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 qr(e){var t=Gr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Wr(n.ownerDocument.documentElement,n)){if(r!==null&&Kr(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 i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ur(n,a);var o=Ur(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Yr=null,Xr=null,Zr=null,Qr=!1;function $r(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qr||Yr==null||Yr!==ke(r)||(r=Yr,`selectionStart`in r&&Kr(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}),Zr&&Vr(Zr,r)||(Zr=r,r=wi(Xr,`onSelect`),0ta||(e.current=ea[ta],ea[ta]=null,ta--)}function N(e,t){ta++,ea[ta]=e.current,e.current=t}var ra={},P=na(ra),F=na(!1),ia=ra;function aa(e,t){var n=e.type.contextTypes;if(!n)return ra;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function oa(e){return e=e.childContextTypes,e!=null}function sa(){M(F),M(P)}function ca(e,t,n){if(P.current!==ra)throw Error(i(168));N(P,t),N(F,n)}function la(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!=`function`)return n;for(var a in r=r.getChildContext(),r)if(!(a in t))throw Error(i(108,Ce(e)||`Unknown`,a));return S({},n,r)}function ua(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ra,ia=P.current,N(P,e),N(F,F.current),!0}function da(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=la(e,t,ia),r.__reactInternalMemoizedMergedChildContext=e,M(F),M(P),N(P,e)):M(F),N(F,n)}var fa=null,pa=!1,ma=!1;function ha(e){fa===null?fa=[e]:fa.push(e)}function ga(e){pa=!0,ha(e)}function _a(){if(!ma&&fa!==null){ma=!0;var e=0,t=A;try{var n=fa;for(A=1;e>=o,i-=o,Ta=1<<32-It(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),I&&Da(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),I&&Da(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return I&&Da(a,g),u}for(h=r(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),I&&Da(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===ae&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case ne:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===ae){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===pe&&Ka(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Wa(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===ae?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Wa(e,r,i),o.return=e,e=o)}return s(e);case ie:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case pe:return l=i._init,_(e,r,l(i._payload),o)}if(Ie(i))return h(e,r,i,o);if(ge(i))return g(e,r,i,o);Ga(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ja=qa(!0),Ya=qa(!1),Xa=na(null),Za=null,Qa=null,$a=null;function eo(){$a=Qa=Za=null}function to(e){var t=Xa.current;M(Xa),e._currentValue=t}function no(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ro(e,t){Za=e,$a=Qa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Hs=!0),e.firstContext=null)}function io(e){var t=e._currentValue;if($a!==e){if(e={context:e,memoizedValue:t,next:null},Qa===null){if(Za===null)throw Error(i(308));Qa=e,Za.dependencies={lanes:0,firstContext:e}}else Qa=Qa.next=e}return t}var ao=null;function oo(e){ao===null?ao=[e]:ao.push(e)}function so(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,oo(t)):(n.next=i.next,i.next=n),t.interleaved=n,co(e,r)}function co(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 lo=!1;function uo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fo(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 po(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,co(e,n)}return i=r.interleaved,i===null?(t.next=t,oo(r)):(t.next=i.next,i.next=t),r.interleaved=t,co(e,n)}function ho(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}function go(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 _o(e,t,n,r){var i=e.updateQueue;lo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=S({},d,f);break a;case 2:lo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Xc|=o,e.lanes=o,e.memoizedState=d}}function vo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Mo.transition;Mo.transition={};try{e(!1),t()}finally{A=n,Mo.transition=r}}function hs(){return Ho().memoizedState}function gs(e,t,n){var r=ml(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vs(e))ys(t,n);else if(n=so(e,t,n,r),n!==null){var i=Q();hl(n,e,r,i),bs(n,t,r)}}function _s(e,t,n){var r=ml(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vs(e))ys(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Br(s,o)){var c=t.interleaved;c===null?(i.next=i,oo(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=so(e,t,i,r),n!==null&&(i=Q(),hl(n,e,r,i),bs(n,t,r))}}function vs(e){var t=e.alternate;return e===R||t!==null&&t===R}function ys(e,t){Fo=Po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}var xs={readContext:io,useCallback:V,useContext:V,useEffect:V,useImperativeHandle:V,useInsertionEffect:V,useLayoutEffect:V,useMemo:V,useReducer:V,useRef:V,useState:V,useDebugValue:V,useDeferredValue:V,useTransition:V,useMutableSource:V,useSyncExternalStore:V,useId:V,unstable_isNewReconciler:!1},Ss={readContext:io,useCallback:function(e,t){return Vo().memoizedState=[e,t===void 0?null:t],e},useContext:io,useEffect:is,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),ns(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){return ns(4,2,e,t)},useMemo:function(e,t){var n=Vo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vo();return t=n===void 0?t:n(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=gs.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=Vo();return e={current:e},t.memoizedState=e},useState:$o,useDebugValue:us,useDeferredValue:function(e){return Vo().memoizedState=e},useTransition:function(){var e=$o(!1),t=e[0];return e=ms.bind(null,e[1]),Vo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=R,a=Vo();if(I){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),J===null)throw Error(i(349));No&30||Jo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Xo.bind(null,r,o,e),[e]),r.flags|=2048,es(9,Yo.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Vo(),t=J.identifierPrefix;if(I){var n=Ea,r=Ta;n=(r&~(1<<32-It(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Io++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof r.is==`string`?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),n===`select`&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Wi]=t,e[Gi]=r,dc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ze(n,r),n){case`dialog`:j(`cancel`,e),j(`close`,e),a=r;break;case`iframe`:case`object`:case`embed`:j(`load`,e),a=r;break;case`video`:case`audio`:for(a=0;anl&&(t.flags|=128,r=!0,mc(s,!1),t.lanes=4194304)}}else{if(!r){if(e=Oo(c),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!I)return U(t),null}else 2*O()-s.renderingStartTime>nl&&n!==1073741824&&(t.flags|=128,r=!0,mc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(U(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=O(),t.sibling=null,n=L.current,N(L,r?n&1|2:n&1),t);case 22:case 23:return Tl(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?qc&1073741824&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function gc(e,t){switch(Aa(t),t.tag){case 1:return oa(t.type)&&sa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return To(),M(F),M(P),Ao(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Do(t),null;case 13:if(M(L),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(L),null;case 4:return To(),null;case 10:return to(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var _c=!1,W=!1,vc=typeof WeakSet==`function`?WeakSet:Set,G=null;function yc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function bc(e,t,n){try{n()}catch(n){$(e,t,n)}}var xc=!1;function Sc(e,t){if(Mi=wn,e=Gr(),Kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},wn=!1,G=t;G!==null;)if(t=G,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ts(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return h=xc,xc=!1,h}function Cc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&bc(t,n,a)}i=i.next}while(i!==r)}}function wc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,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 Tc(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 Ec(e){var t=e.alternate;t!==null&&(e.alternate=null,Ec(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wi],delete t[Gi],delete t[qi],delete t[Ji],delete t[Yi])),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 Dc(e){return e.tag===5||e.tag===3||e.tag===4}function Oc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Dc(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 a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function kc(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=ji));else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}function Ac(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(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}var K=null,jc=!1;function Mc(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount==`function`)try{Pt.onCommitFiberUnmount(Nt,n)}catch{}switch(n.tag){case 5:W||yc(n,t);case 6:var r=K,i=jc;K=null,Mc(e,t,n),K=r,jc=i,K!==null&&(jc?(e=K,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):K.removeChild(n.stateNode));break;case 18:K!==null&&(jc?(e=K,n=n.stateNode,e.nodeType===8?Bi(e.parentNode,n):e.nodeType===1&&Bi(e,n),Sn(e)):Bi(K,n.stateNode));break;case 4:r=K,i=jc,K=n.stateNode.containerInfo,jc=!0,Mc(e,t,n),K=r,jc=i;break;case 0:case 11:case 14:case 15:if(!W&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&bc(n,t,o),i=i.next}while(i!==r)}Mc(e,t,n);break;case 1:if(!W&&(yc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Mc(e,t,n);break;case 21:Mc(e,t,n);break;case 22:n.mode&1?(W=(r=W)||n.memoizedState!==null,Mc(e,t,n),W=r):Mc(e,t,n);break;default:Mc(e,t,n)}}function Pc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Fc(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=s),r&=~o}if(r=a,r=O()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Uc(r/1960))-r,10e?16:e,cl===null)var r=!1;else{if(e=cl,cl=null,ll=0,q&6)throw Error(i(331));var a=q;for(q|=4,G=e.current;G!==null;){var o=G,s=o.child;if(G.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lO()-tl?El(e,0):Qc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Vt,Vt<<=1,!(Vt&130023424)&&(Vt=4194304)):t=1);var n=Q();e=co(e,t),e!==null&&(Yt(e,t,n),gl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||F.current)Hs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Hs=!1,uc(e,t,n);Hs=!!(e.flags&131072)}}else Hs=!1,I&&t.flags&1048576&&Oa(t,xa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;cc(e,t),e=t.pendingProps;var a=aa(t,P.current);ro(t,n),a=zo(null,t,r,e,a,n);var o=Bo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,oa(r)?(o=!0,ua(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,uo(t),a.updater=Ds,t.stateNode=a,a._reactInternals=t,js(t,r,e,n),t=Xs(null,t,r,!0,o,n)):(t.tag=0,I&&o&&ka(t),H(null,t,a,n),t=t.child),t;case 16:r=t.elementType;a:{switch(cc(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Jl(r),e=Ts(r,e),a){case 0:t=Js(null,t,r,e,n);break a;case 1:t=Ys(null,t,r,e,n);break a;case 11:t=Us(null,t,r,e,n);break a;case 14:t=Ws(null,t,r,Ts(r.type,e),n);break a}throw Error(i(306,r,``))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),Js(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),Ys(e,t,r,a,n);case 3:a:{if(Zs(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,a=o.element,fo(e,t),_o(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ms(Error(i(423)),t),t=Qs(e,t,r,n,a);break a}if(r!==a){a=Ms(Error(i(424)),t),t=Qs(e,t,r,n,a);break a}for(Ma=Vi(t.stateNode.containerInfo.firstChild),ja=t,I=!0,Na=null,n=Ya(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Va(),r===a){t=lc(e,t,n);break a}H(e,t,r,n)}t=t.child}return t;case 5:return Eo(t),e===null&&La(t),r=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Pi(r,a)?s=null:o!==null&&Pi(r,o)&&(t.flags|=32),qs(e,t),H(e,t,s,n),t.child;case 6:return e===null&&La(t),null;case 13:return tc(e,t,n);case 4:return wo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ja(t,null,r,n):H(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),Us(e,t,r,a,n);case 7:return H(e,t,t.pendingProps,n),t.child;case 8:return H(e,t,t.pendingProps.children,n),t.child;case 12:return H(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,N(Xa,r._currentValue),r._currentValue=s,o!==null){if(Br(o.value,s)){if(o.children===a.children&&!F.current){t=lc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=po(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),no(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(i(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),no(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}H(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,ro(t,n),a=io(a),r=r(a),t.flags|=1,H(e,t,r,n),t.child;case 14:return r=t.type,a=Ts(r,t.pendingProps),a=Ts(r.type,a),Ws(e,t,r,a,n);case 15:return Gs(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),cc(e,t),t.tag=1,oa(r)?(e=!0,ua(t)):e=!1,ro(t,n),ks(t,r,a),js(t,r,a,n),Xs(null,t,r,!0,e,n);case 19:return sc(e,t,n);case 22:return Ks(e,t,n)}throw Error(i(156,t.tag))};function Wl(e,t){return wt(e,t)}function Gl(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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===fe)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(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 Xl(e,t,n,r,a,o){var s=2;if(r=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ae:return Zl(n.children,a,o,t);case oe:s=8,a|=8;break;case se:return e=Kl(12,n,t,a|2),e.elementType=se,e.lanes=o,e;case x:return e=Kl(13,n,t,a),e.elementType=x,e.lanes=o,e;case de:return e=Kl(19,n,t,a),e.elementType=de,e.lanes=o,e;case me:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ce:s=10;break a;case le:s=9;break a;case ue:s=11;break a;case fe:s=14;break a;case pe:s=16,r=null;break a}throw Error(i(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){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=Jt(0),this.expirationTimes=Jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},uo(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ie()})),oe=t((e=>{var t=ae();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),se=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new p({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ce(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){u.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>d(t,e))}findAll(e={}){return this.getAll().filter(t=>d(e,t))}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return u.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function ce(e){return e.options.scope?.id}var le=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new v({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){u.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){u.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){u.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new le,this.#t=e.mutationCache||new se,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=i.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=l.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(te(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return u.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;u.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return u.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=u.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return u.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=u.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(te(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return l.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(m(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{b(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(m(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{b(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=f(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===a&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},x=e(r(),1),de=e(oe(),1),fe=class extends Error{status;method;path;code;detail;constructor(e,t,n,r,i=``,a=``){super(e),this.name=`ApiError`,this.status=t,this.method=n,this.path=r,this.code=i,this.detail=a}};function pe(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{detail:``,code:``};try{let t=JSON.parse(e),n=t.detail&&typeof t.detail==`object`&&!Array.isArray(t.detail)?t.detail:void 0,r=typeof t.code==`string`&&t.code.trim()?t.code.trim():typeof n?.code==`string`?n.code.trim():``;if(n)for(let e of[`message`,`detail`]){let t=n[e];if(typeof t==`string`&&t.trim())return{detail:t.trim(),code:r}}for(let e of[`detail`,`error`,`message`]){let n=t[e];if(typeof n==`string`&&n.trim())return{detail:n.trim(),code:r};if(Array.isArray(n)){let e=n.map(e=>e&&typeof e==`object`?String(e.msg??``):``).filter(Boolean);if(e.length)return{detail:e.join(`; `),code:r}}}return{detail:``,code:r}}catch{}return{detail:t.startsWith(``u`?``:window.location.search).get(`reader_preview`);return e===`source-first`||e===`learning-path`||e===`question-foundation`?e:null}function S(e,t,n,r,i=ge(),a){let o=[`map-copy`,e,t,n,r];return i===`question-foundation`?[...o,i,a??null]:i?[...o,i]:o}var _e=`0.1.8+5f8aeb93de47076f`,ve=!1,ye=new Set,be=()=>ve,xe=e=>(ye.add(e),()=>{ye.delete(e)});function Se(e){ve||!e||e===`unknown`||e===`0.1.8+5f8aeb93de47076f`||(ve=!0,ye.forEach(e=>e()))}var Ce=class extends Error{constructor(){super(`页面已更新,请刷新后继续。 / This page has been updated. Refresh to continue.`),this.name=`PageUpdateRequiredError`}};function we(){if(ve)throw new Ce}var Te={name:`argus.webapi`,major:1,minServerMinor:16},Ee=[`daemon.admission.v1`,`daemon.status.protocol.v1`,`daemon.command.v1`,`daemon.upgrade-schedule.v1`,`cost.admission.v1`,`event.catalog.v1`,`event.payload-schema.v1`,`manager.sse.v1`,`manager.request-cancel.v1`,`advisor.config.v1`,`metrics.slo.v2`,`mission.view.v1`,`mission.abort.v1`,`project.attachments.v1`,`project.git-diff.v1`,`project.cost-feed.v1`,`project.counterexamples.v1`,`project.workdir.v1`,`research.events.v1`,`release.identity.v1`,`snapshot.schema.v1`,`source.update.v1`,`usage.recorded.v2`,`verticals.store.v1`],De=`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`;function Oe(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function ke(e){return typeof e==`number`&&Number.isInteger(e)?e:null}function Ae(e,t){let n=Oe(e),r=Oe(n?.protocol),i=Oe(n?.runtime),a=Array.isArray(n?.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],o=ke(r?.major),s=ke(r?.minor);if(!n||!r||!i)return{compatible:!1,reason:`malformed /api/meta response`};if(typeof i.source_root!=`string`||ke(i.pid)===null||typeof i.package_version!=`string`||typeof i.release_id!=`string`)return{compatible:!1,reason:`malformed /api/meta runtime identity`};if(n.service!==`argus-skill-webapi`)return{compatible:!1,reason:`unexpected service ${String(n.service||`unknown`)}`};let c=e;if(r.name!==Te.name||o!==Te.major)return{compatible:!1,reason:`protocol ${String(r.name||`unknown`)}/${String(o)} is incompatible with client ${Te.name}/${Te.major}`,meta:c};if(s===null||s!a.includes(e));if(l.length>0)return{compatible:!1,reason:`missing capabilities: ${l.join(`, `)}`,meta:c};if(i.source_root_matches_config===!1)return{compatible:!1,reason:`backend is running from a different installation than configured`,meta:c};if(t&&i.release_id!==t.releaseId)return{compatible:!1,reason:`backend and client installations are out of sync; restart or reinstall Argus`,meta:c};if(t?.sourceDigest){if(typeof i.runtime_source_digest!=`string`||!i.runtime_source_digest)return{compatible:!1,reason:`backend cannot verify this local installation; restart it from the current checkout`,meta:c};if(i.runtime_source_digest!==t.sourceDigest)return{compatible:!1,reason:`backend is running code from a different local installation; restart it`,meta:c}}let u=i.release_matches_source===!1?De:void 0;return{compatible:!0,reason:``,...u?{warning:u}:{},meta:c}}function je(e,t,n){let r=Ae(e,t);if(!r.compatible||!r.meta)throw Error(`incompatible Argus API: ${r.reason}`);return r.warning&&n?.(r.warning),r.meta}function Me(e){let t=Oe(e),n=Oe(t?.daemon);if(!t||t.schema_version!==7)throw Error(`incompatible snapshot schema: expected 7, got ${String(t?.schema_version??`missing`)}`);if(!n)throw Error(`invalid snapshot: daemon section is missing`);let r=[`read_status`,`read_error`,`protocol_compatible`,`protocol_error`].filter(e=>!Object.hasOwn(n,e));if(r.length>0)throw Error(`invalid snapshot: daemon fields missing: ${r.join(`, `)}`);let i=[`spend_usd`,`spend_status`,`usage_summary`,`daemon_commands`,`observability`,`mission_view`,`partial`,`diagnostics`].filter(e=>!Object.hasOwn(t,e));if(i.length>0)throw Error(`invalid snapshot: fields missing: ${i.join(`, `)}`);if(!Array.isArray(t.diagnostics))throw Error(`invalid snapshot: diagnostics must be an array`);return e}function Ne(e,t){return je(e,{releaseId:_e},t)}function Pe(e,t){let n=`/api/application-workflows`,r=e=>`${n}/${encodeURIComponent(e)}`;return{catalog:()=>e(n),create:e=>t(n,e),open:e=>t(`${n}/open`,{project:e}),snapshot:t=>e(r(t)),action:(e,n)=>t(r(e),n),document:(t,n)=>e(`${r(t)}/document?path=${encodeURIComponent(n)}`)}}var Fe=`verticals.store.v1`,Ie=`argus_web_token`,Le=null;function Re(){let e;try{e=new URLSearchParams(window.location.search)}catch{return}let t=e.get(`token`);if(t){Le=t;try{localStorage.setItem(Ie,t)}catch{}try{e.delete(`token`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)}catch{}}}var ze=()=>{if(Le)return Le;try{return new URLSearchParams(window.location.search).get(`token`)||localStorage.getItem(Ie)}catch{return null}};function Be(){let e=ze();return e?{Authorization:`Bearer ${e}`}:{}}function Ve(){return ze()??``}var He=8e3,Ue=12e3,We=class extends Error{constructor(){super(`This browser is not paired with Argus. Open a valid pairing link or enter a pairing token.`),this.name=`PairingRequiredError`}},Ge=class extends Error{method;path;constructor(e,t,n=`could not reach the local Argus service`){super(`${e.toUpperCase()} ${t} ${n}. Make sure Argus Desktop is running, then retry.`),this.name=`LocalArgusUnavailableError`,this.method=e.toUpperCase(),this.path=t}};function Ke(e){return e instanceof We||!!(e&&typeof e==`object`&&Number(e.status)===401)}function qe(e){return Ke(e)||e instanceof Ge}async function Je(e,t){let n;try{n=await fetch(e,t)}catch(n){throw t.signal?.aborted?n:new Ge(String(t.method??`GET`),e)}return n.ok&&(Se(n.headers.get(`X-Argus-Release`)),(!t.method||t.method===`GET`)&&we()),n}async function Ye(e,t,n,r){let i=new AbortController,a=t.signal??void 0,o=!1,s=()=>{};if(a){let e=()=>i.abort(a.reason);a.aborted?e():(a.addEventListener(`abort`,e,{once:!0}),s=()=>a.removeEventListener(`abort`,e))}let c,l=(async()=>await r(await Je(e,{...t,signal:i.signal})))(),u=new Promise((e,t)=>{c=setTimeout(()=>{o=!0;let e=Error(`request timed out after ${n}ms`);i.abort(e),t(e)},n)});try{return await Promise.race([l,u])}catch(r){if(o){let r=Math.round(n/1e3);throw new Ge(String(t.method??`GET`),e,`timed out after ${r}s because the local Argus service did not respond`)}throw r}finally{c&&clearTimeout(c),s()}}async function C(e,t,n){return Ye(e,{headers:Be(),signal:t},n??Ue,async t=>(await he(t,`GET`,e),await t.json()))}async function Xe(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:t===void 0?void 0:JSON.stringify(t),signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),r}async function w(e,t,n){return await(await Xe(e,t,n)).json()}async function Ze(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:Be(),body:t,signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),await r.json()}function Qe(e){let t=e&&typeof e==`object`?e:{},n=String(t.command_status??``);if(Number(t.rc??0)!==0||n===`failed`||n===`rejected`)throw Error(String(t.error||`daemon command ${n||`failed`}`));return e}async function $e(e,t,n){we();let r=await fetch(t,{method:e,headers:{"Content-Type":`application/json`,...Be()},body:n===void 0?void 0:JSON.stringify(n)});return await he(r,e,t),Se(r.headers.get(`X-Argus-Release`)),await r.json()}async function et(e,t){let n=await fetch(e,{headers:Be(),signal:t});return await he(n,`GET`,e),n.blob()}var T=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`;function tt(e,t){let n=new URLSearchParams({path:t}),r=Ve();return r&&n.set(`token`,r),T(e,`/artifact/preview/page?${n.toString()}`)}var nt=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,rt=nt,it;function at(e){return!!(e&&typeof e==`object`&&`aborted`in e&&typeof e.aborted==`boolean`)}function ot(e,t,n,r){let i={text:e};return t?.length&&(i.attachments=t),n&&n!==`auto`&&(i.route_override=n),r&&(i.request_id=r),i}function st(){if(!it){let e=(async()=>{let e=`/api/meta`,t=await Ye(e,{headers:Be()},He,async t=>{if(t.status===404)throw Error(`incompatible Argus API: service does not expose /api/meta`);await he(t,`GET`,e);let n=await t.json();return Se(n?.runtime?.release_id),Ne(n,e=>{e!==`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`&&console.warn(`Argus API compatibility warning: ${e}`)})});if(t.authentication?.required&&!t.authentication.authenticated)throw new We;return t})();it=e,e.catch(t=>{it===e&&!(t instanceof We)&&(it=void 0)})}return it}var ct=new Set([`waiting_for_source`,`planning`,`writing`,`reviewing`]);function lt(e){let t=[],n;for(;n=/\r?\n\r?\n/.exec(e);){let r=e.slice(0,n.index);e=e.slice(n.index+n[0].length);for(let e of r.split(` +`)){let n=e.trim();if(n.startsWith(`data:`))try{t.push(JSON.parse(n.slice(5).trim()))}catch{}}}return{frames:t,rest:e}}async function ut(e,t,n,r){if(!e.body)throw Error(`${t} returned no response body`);let i=e.body.getReader(),a=new TextDecoder,o=``,s,c=!1;try{for(;;){r?.throwIfAborted();let{done:e,value:l}=await i.read();c=e,r?.throwIfAborted(),o+=e?a.decode()+` + +`:a.decode(l,{stream:!0});let u=lt(o);o=u.rest;for(let e of u.frames)n?.(e),(e.type===`done`||e.type===`error`)&&(s=e);if(e){if(!s)throw Error(`${t} ended before a terminal event`);return s}}}finally{c||await i.cancel().catch(()=>{}),i.releaseLock()}}var dt=null;function ft(e,t,n,r,i=ge(),a){let o=new URLSearchParams(n);return r&&o.set(`session_id`,r),i===`source-first`&&o.set(`preview`,`true`),i===`learning-path`&&o.set(`preview`,`learning-path`),i===`question-foundation`&&(o.set(`preview`,`question-foundation`),a&&o.set(`foundation_id`,a)),`/api/map-copy/${e}/${encodeURIComponent(t)}?${o}`}async function pt(e,t,n,r){let i=await Xe(e,t,n),a=!1,o=await ut(i,`Explanation stream`,e=>{(e.type===`done`||e.type===`error`)&&(a=!0),!a&&e.type===`progress`&&ct.has(e.phase)&&r?.(e.phase)},n);if(o.type===`error`){let t=o.error&&typeof o.error==`object`?o.error:void 0;throw new fe(String(t?.message??o.error??`Explanation failed`),typeof o.status==`number`?o.status:0,`POST`,e,typeof t?.code==`string`?t.code:``)}return o.result}var E={workflows:Pe(C,w),advisorSettings:(e,t)=>C(T(e,`/advisor/config`),t),saveAdvisorSettings:(e,t)=>w(T(e,`/advisor/config`),t),liveMap:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r?.mode===`current`&&(i.set(`since`,String(r.since)),i.set(`event_since`,String(r.eventSince)),r.taskId&&i.set(`start_task`,r.taskId)),C(T(e,`/map`)+(i.size?`?${i}`:``),t)},mapInfo:(e,t)=>C(T(e,`/map-info`),t),mapHistory:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r&&i.set(`task_after`,r),C(T(e,`/map-history`)+(i.size?`?${i}`:``),t)},mapCopy:(e,t,n,r,i,a,o)=>C(ft(e,t,{locale:n},i,a,o),r),mapCardWords:(e,t,n,r,i)=>w(`/api/map-cards/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapLines:(e,t,n,r,i)=>w(`/api/map-lines/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapQuestionSource:(e,t,n)=>w(`/api/map-question-source/project/${encodeURIComponent(e)}?session_id=${encodeURIComponent(e)}`,{...t,preview:t.preview===`source-first`?!0:t.preview??!1},n),generateMapCopy:(e,t,n,r,i,a,o)=>pt(ft(e,t,{stream:`true`},i,a,n.foundation_id),n,r,o),generateReaderFoundation:(e,t,n)=>pt(T(e,`/reader-foundation?stream=true`),t,void 0,n),askReaderFoundation:(e,t,n,r)=>pt(T(e,`/reader-foundation/${encodeURIComponent(t)}/question?stream=true`),n,void 0,r),mapDatasets:e=>C(`/api/map-datasets`,e),mapDataset:(e,t)=>C(`/api/map-datasets/${encodeURIComponent(e)}`,t),meta:st,projectIndex:async()=>(await st(),C(`/api/projects`,void 0,Ue)),listProjects:async()=>(await st(),C(`/api/projects`,void 0,Ue).then(e=>e.projects)),projectCosts:async e=>(await st(),C(`/api/projects/costs`,e)),createDaemon:async(e,t=``,n=``,r)=>{let i=`/api/daemons`,a={objective:e,name:t,workdir:n,command_id:rt(),expected_revision:r},o=()=>fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify(a),cache:`no-store`}),s=await o();return s.status===400&&/Invalid HTTP request received/i.test(await s.clone().text())&&(s=await o()),await he(s,`POST`,i),Qe(await s.json())},updateProject:(e,t)=>$e(`PATCH`,T(e),{name:t}),deleteProject:e=>$e(`DELETE`,T(e)),snapshot:async(e,t,n=!1)=>(await st(),Me(await C(T(e,`/snapshot?compact=true&events_limit=1${n?`&prewarm=true`:``}`),t,Ue))),activeSnapshot:async(e,t)=>{let n=dt!==e;n&&(dt=e);try{return await E.snapshot(e,t,n)}catch(t){throw n&&dt===e&&(dt=null),t}},prefetchSnapshot:(e,t)=>E.snapshot(e,t,!1),status:(e,t)=>C(T(e,`/status`),t),journal:(e,t=20,n)=>C(T(e,`/journal?n=${t}`),n).then(e=>e.journal),doctor:(e,t)=>C(T(e,`/doctor`),t),config:(e,t)=>C(T(e,`/config`),t),identity:(e,t)=>C(T(e,`/identity`),t).then(e=>e.identity),transcript:(e,t=30,n)=>C(T(e,`/transcript?n=${t}`),n).then(e=>e.turns),events:(e,t=80,n)=>C(T(e,`/events?limit=${t}&view=ui`),n).then(e=>e.events),workRecord:(e,t,n,r)=>C(T(e,`/work-record?role=${encodeURIComponent(t)}&record_id=${encodeURIComponent(n)}`),r),downloadWorkLog:async(e,t,n=``)=>{let r=T(e,`/work-log/download?role=${encodeURIComponent(t)}&task_id=${encodeURIComponent(n)}`),i=await fetch(r,{headers:Be(),cache:`no-store`});await he(i,`GET`,r);let a=URL.createObjectURL(await i.blob()),o=document.createElement(`a`);o.href=a,o.download=`work-records.md`,o.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)},backlogItem:(e,t,n)=>C(T(e,`/backlog/${encodeURIComponent(t)}`),n).then(e=>e.item),artifacts:(e,t,n=!1)=>C(T(e,`/artifacts${n?`?include_reading=true`:``}`),t).then(e=>e.artifacts),artifact:(e,t,n)=>C(T(e,`/artifact?${new URLSearchParams({path:t})}`),n),artifactPreview:(e,t,n)=>C(T(e,`/artifact/preview?${new URLSearchParams({path:t})}`),n),artifactBundle:(e,t,n)=>et(T(e,`/artifact/bundle?${new URLSearchParams({path:t})}`),n),artifactBlob:(e,t,n=!1,r)=>{let i=new URLSearchParams({path:t});return n&&i.set(`download`,`true`),et(T(e,`/artifact/raw?${i}`),r)},gitDiff:(e,t)=>C(T(e,`/git-diff`),t),deliveryDiff:(e,t,n)=>C(T(e,`/delivery-diff?${new URLSearchParams(t)}`),n),metrics:e=>C(`/api/metrics`,e),sourceUpdateStatus:e=>C(`/api/runtime/source-update`,e),checkSourceUpdate:()=>w(`/api/runtime/source-update/check`),applySourceUpdate:()=>w(`/api/runtime/source-update/apply`),resources:e=>C(`/api/system/resources`,e),trash:(e=``,t=100,n=0,r)=>C(`/api/trash?${new URLSearchParams({query:e,limit:String(t),offset:String(n)})}`,r),restoreTrash:e=>w(`/api/trash/${encodeURIComponent(e)}/restore`),verticals:e=>C(`/api/verticals`,e),refreshVerticalCatalog:()=>w(`/api/verticals/catalog/refresh`),manageVertical:(e,t,n={})=>w(`/api/verticals/${encodeURIComponent(e)}/manage/${t}`,n.force?{force:!0}:{}),verticalOperation:(e,t)=>C(`/api/verticals/${encodeURIComponent(e)}/operation`,t),addTask:(e,t)=>w(T(e,`/tasks`),{text:t}).then(e=>e.item),abortMission:(e,t)=>w(T(e,`/mission/abort`),{reason:t}),mapNotes:(e,t)=>C(T(e,`/map-notes`),t),addMapNote:(e,t)=>w(T(e,`/map-notes`),t),answerPending:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/answer`),{text:n}),resolveDecision:(e,t,n,r)=>w(T(e,`/decisions/${encodeURIComponent(t)}/resolve`),{option_id:n,note:r}),uploadAttachments:async(e,t,n)=>{await st();let r=new FormData;return t.forEach(e=>r.append(`files`,e,e.name)),Ze(T(e,`/attachments`),r,n)},answerDomain:(e,t,n,r)=>w(T(e,`/message`),{text:r||n,domain_answer:{id:t,option_id:n,note:r}}),message:(e,t,n)=>{let r=at(n)?n:n?.signal,i=at(n)?void 0:n?.attachments,a=at(n)?void 0:n?.routeOverride,o=at(n)?void 0:n?.requestId;return w(T(e,`/message`),ot(t,i,a,o),r)},cancelMessage:(e,t)=>Ye(T(e,`/message/cancel`),{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify({request_id:t})},5e3,async t=>(await he(t,`POST`,T(e,`/message/cancel`)),await t.json())),messageStream:async(e,t,n,r)=>{let i=at(r)?r:r?.signal,a=at(r)?void 0:r?.attachments,o=at(r)?void 0:r?.routeOverride,s=at(r)?void 0:r?.requestId;await ut(await Xe(T(e,`/message/stream`),ot(t,a,o,s),i),`Manager stream`,e=>{if(!i?.aborted){if(e.type===`phase`){let t=Number(e.quiet_s??0);n.onPhase?.(String(e.label??``),String(e.role??`manager`),{heartbeat:e.heartbeat===!0,quietS:Number.isFinite(t)?t:0,kind:String(e.kind??``),detail:String(e.detail??``),tool:String(e.tool??``),toolKind:String(e.tool_kind??``),callId:String(e.call_id??``),status:String(e.status??``),output:String(e.output??``)})}else e.type===`delta`?n.onDelta?.(String(e.text??``),String(e.message_id??``),String(e.fragment_mode??`auto`)):e.type===`done`?n.onDone?.(e.result??{}):e.type===`error`&&n.onError?.(Error(String(e.error??`stream error`)))}},i)},nudge:(e,t)=>w(T(e,`/nudge`),{text:t}),queueFollowup:(e,t,n=`auto`)=>w(T(e,`/message/followup`),{text:t,route_override:n}),note:(e,t)=>w(T(e,`/note`),{text:t}),previewPlan:(e,t)=>w(T(e,`/plan`),{text:t}),rewritePrompt:(e,t)=>w(T(e,`/prompt/rewrite`),{text:t}),setConfig:(e,t,n,r=!1)=>w(T(e,`/config/set`),r?{name:t,value:n,apply_to_roles:!0}:{name:t,value:n}),setIdentity:(e,t)=>w(T(e,`/identity`),{text:t}),resetManager:e=>w(T(e,`/reset`)),skills:(e,t=`ls`)=>w(T(e,`/skills`),{args:t}).then(e=>e.text),skillLibrary:(e,t)=>C(`/api/skill-library${e?`?sid=${encodeURIComponent(e)}`:``}`,t),skillDocument:(e,t,n,r)=>C(`/api/skill-library/document?${new URLSearchParams({library:t,path:n,...e?{sid:e}:{}})}`,r),researchMethod:(e,t)=>C(T(e,`/research/method`),t),wiki:(e,t)=>C(T(e,`/wiki`),t),wikiPage:(e,t,n)=>C(T(e,`/wiki/page?${new URLSearchParams({path:t})}`),n),wikiLibrary:(e,t)=>C(`/api/wiki${e?`?sid=${encodeURIComponent(e)}`:``}`,t),wikiDocument:(e,t,n,r,i)=>C(`/api/wiki/page?${new URLSearchParams({scope:t,vertical:n,path:r,...e?{sid:e}:{}})}`,i),knowledgeFeed:(e=50,t)=>C(`/api/knowledge/feed?${new URLSearchParams({limit:String(e)})}`,t),learningStatus:(e,t)=>C(T(e,`/learning`),t),retryLearning:(e,t)=>w(T(e,`/learning/${encodeURIComponent(t)}/retry`),{}),setLaunchCwd:(e,t)=>w(T(e,`/launch-cwd`),{launch_cwd:t}),setWorkdir:(e,t)=>w(T(e,`/workdir`),{workdir:t}),disposeBacklog:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/dispose`),{op:n}),stopBacklog:(e,t)=>w(T(e,`/backlog/${encodeURIComponent(t)}/stop`)),setContinuous:(e,t,n=``)=>w(T(e,`/continuous`),{enabled:t,objective:n}).then(e=>{if(!t)return e;if(!e.daemon)throw Error(`daemon start returned no result`);return Qe(e.daemon),e}),startDaemon:(e,t)=>w(T(e,`/daemon/start`),{command_id:rt(),expected_revision:t}).then(Qe),stopDaemon:(e,t=!1,n,r=!1)=>w(T(e,`/daemon/stop`),{drain:t,force:r,command_id:rt(),expected_revision:n}).then(Qe),replaceDaemon:(e,t,n=!1,r)=>w(T(e,`/daemon/replace`),{victim_sid:t,resume_continuous:n,command_id:rt(),expected_revision:r}).then(Qe),upgradeDaemon:(e,t)=>w(T(e,`/daemon/upgrade`),{command_id:rt(),expected_revision:t}).then(Qe)},mt=new Set([4401,4404]);function ht(e,t,n={}){let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=new URLSearchParams;n.replay!=null&&i.set(`replay`,String(n.replay)),i.set(`view`,`ui`);let a=ze();a&&i.set(`token`,a);let o=`${r}//${window.location.host}${T(e,`/stream`)}?${i}`,s=null,c=!1,l,u=()=>{c||(s=new WebSocket(o),s.onopen=()=>n.onOpen?.(),s.onmessage=e=>{try{let n=JSON.parse(e.data);n&&typeof n==`object`&&t(n)}catch{}},s.onclose=e=>{let t=!mt.has(e.code);n.onClose?.({code:e.code,reason:e.reason,retryable:t}),!c&&t&&(l=setTimeout(u,1e3))},s.onerror=()=>s?.close())};return u(),()=>{c=!0,l&&clearTimeout(l),s?.close()}}var gt={schema:1,id:`argus`,name:`Argus`,tagline:`Autonomous Work Lab`,terminal_wordmark:`argus`,assets:{}};function _t(e){if(!e||typeof e!=`object`)throw Error(`Invalid application brand`);let t=e;if(t.schema!==1||typeof t.id!=`string`||!/^[a-z][a-z0-9-]{0,39}$/.test(t.id))throw Error(`Invalid application brand identity`);for(let[e,n]of[[`name`,48],[`tagline`,100],[`terminal_wordmark`,24]]){let r=t[e];if(typeof r!=`string`||!r.trim()||r.length>n||/[\x00-\x1f\x7f-\x9f]/.test(r))throw Error(`Invalid application brand ${e}`)}if(!/^[a-z0-9 -]+$/.test(String(t.terminal_wordmark)))throw Error(`Invalid terminal wordmark`);if(!t.assets||typeof t.assets!=`object`||Array.isArray(t.assets))throw Error(`Invalid application brand assets`);let n={};for(let e of[`mark`,`mark_dark`,`logo`,`logo_dark`,`icon`,`icon_dark`]){let r=t.assets[e];if(r!==void 0&&r!==`/api/application-brand/assets/${e}`)throw Error(`Invalid application brand asset ${e}`);if(typeof r==`string`)n[e]=r;else if(t.id!==`argus`)throw Error(`Missing application brand asset ${e}`)}return{schema:1,id:t.id,name:String(t.name),tagline:String(t.tagline),terminal_wordmark:String(t.terminal_wordmark),assets:n}}var vt=gt,yt=()=>vt;async function bt(){let e=await fetch(`/api/application-brand`,{cache:`no-store`});if(!e.ok)throw Error(`Application identity unavailable (${e.status})`);if(vt=_t(await e.json()),vt.id!==`argus`){document.title=`${vt.name} · Workbench`,document.querySelector(`meta[name="apple-mobile-web-app-title"]`)?.setAttribute(`content`,vt.name),document.querySelector(`link[rel="manifest"]`)?.setAttribute(`href`,`/api/application-brand/manifest.webmanifest`);for(let e of document.querySelectorAll(`link[rel="icon"], link[rel="apple-touch-icon"]`))e.href=e.media.includes(`dark`)?vt.assets.icon_dark:vt.assets.icon,e.removeAttribute(`type`)}}var D=n(),xt=`argus.locale`,St={"language.english":`English`,"handshake.connecting":`Getting Argus ready`,"handshake.service":`Service`,"handshake.project":`Project`,"handshake.ready":`Ready`,"handshake.title":`Getting Argus ready`,"handshake.detail":`Reopening your workspace…`,"splash.starting":`Argus starting`,"rail.workbench":`Workbench`,"rail.sessionsShortcut":`Sessions · Ctrl/⌘ P`,"panel.backlog":`Backlog`,"panel.activity":`Activity`,"panel.journal":`Journal`,"panel.roles":`Roles`,"panel.project":`Project`,"panel.liveView":`Manager live project view`,"stream.jumpToLatest":`Jump to latest`,"stream.toggleReasoning":`Show or hide agent reasoning (⌘T)`,"stream.reasoning":`Reasoning`,"stream.noLogs":`No activity yet`,"stream.system":`Argus updates`,"stream.autonomous":`Background activity`,"stream.backgroundWork":`Argus is working in the background`,"stream.ready":`Argus is ready. Ask a question or assign work.`,"stream.historyLoading":`Loading conversation history…`,"stream.historyError":`Could not load conversation history.`,"stream.historyRetry":`Retry`,"stream.fold.read":`Read {count} files`,"stream.fold.search":`Searched {count} times`,"stream.fold.fetch":`Looked up {count} web pages`,"stream.fold.edit":`Edited {count} files`,"stream.fold.tool":`Used {tool} {count} times`,"stream.fold.failed":`{count} failed`,"stream.fold.expand":`Show each step`,"stream.fold.collapse":`Hide the steps`,"stream.repeated":`Repeated {count} times; showing the latest`,"stream.stepFailed":`failed`,"stream.stepResult":`Result`,"common.showRaw":`Show raw output`,"doctor.lastEntry":`Last entry`,"operations.metric.calls":`model calls today`,"operations.metric.failed":`failed`,"operations.metric.slowest":`slowest typical call`,"operations.slo.healthy":`Healthy`,"operations.slo.degraded":`Needs attention`,"operations.slo.loading":`Loading…`,"operations.validationFailures":`{count} malformed events today`,"operations.outputLines":`{count} lines of output`,"operations.done":`Done.`,"newDaemon.workdirPlaceholder":`Blank → ~/.argus-skill/workspaces/`,"operations.resetManager":`Reset Manager context`,"language.chinese":`中文`,"language.switchTo":`Switch to {language}`,"common.loading":`Loading…`,"common.retry":`Retry`,"common.save":`Save`,"common.cancel":`Cancel`,"common.close":`Close`,"common.settings":`Settings`,"common.ready":`Ready`,"common.live":`Live`,"common.reconnecting":`Reconnecting`,"common.stale":`Snapshot stale`,"common.degraded":`Snapshot degraded`,"common.external":`External`,"common.pause":`Pause`,"common.run":`Run`,"common.working":`Working`,"common.local":`Local`,"common.all":`All`,"common.unassigned":`Unassigned`,"common.closeSessions":`Close sessions`,"common.resizeSessions":`Resize sessions`,"common.resizePreview":`Resize preview`,"common.expandPreview":`Expand preview`,"time.justNow":`just now`,"time.minutesAgo":`{count}m ago`,"time.hoursAgo":`{count}h ago`,"time.yesterdayAt":`Yesterday at {time}`,"connection.pairingTitle":`This browser is not paired with Argus`,"connection.pairingDetail":`Open a valid pairing link for this Argus site, or paste the link or token below.`,"connection.pairAgain":`Pair again`,"connection.pairingInput":`Pairing link or token`,"connection.pairingPlaceholder":`Paste a fresh pairing link or token`,"connection.pairingInvalid":`Enter a valid pairing link or token.`,"connection.connect":`Connect`,"connection.unreachableTitle":`The local Argus service is unavailable`,"connection.unreachableDetail":`Keep Argus Desktop running, wait for the local service to become ready, then retry.`,"sidebar.collapse":`Collapse sessions`,"sidebar.expand":`Expand sessions`,"sidebar.create":`Create project`,"sidebar.find":`Find a project`,"sidebar.clearSearch":`Clear search`,"sidebar.refreshFailed":`Refresh failed · retry`,"sidebar.noSessions":`No sessions`,"sidebar.noMatches":`No sessions matching "{query}"`,"sidebar.unnamedSession":`Unnamed session`,"sidebar.daemonAlive":`Argus background is online`,"sidebar.updateRequired":`Update required`,"sidebar.updateAvailable":`Update available`,"sidebar.updateAvailableHint":`The executor is still running with a different release from this page.`,"sidebar.stopped":`Background stopped`,"sidebar.runningFor":`Background online · {uptime}`,"sidebar.lastActive":`Last active {time}`,"sidebar.manage":`Manage {name}`,"sidebar.manageHint":`Rename, pause, or delete`,"sidebar.resume":`Resume`,"sidebar.resumeHint":`Resume work in {workdir}`,"sidebar.resumeSuccess":`Session resumed.`,"sidebar.resumeFailed":`Could not resume session: {error}`,"sidebar.modelLoading":`Loading backend and model…`,"sidebar.modelUnavailable":`Backend and model unavailable`,"sidebar.defaultModel":`default model`,"sidebar.openSettings":`Open settings`,"sidebar.compute":`Compute queue & allowance`,"sidebar.theme":`{current} theme; switch to {next}`,"landing.selectOrCreate":`Select a session from the sidebar, or create a new one.`,"landing.noSessions":`No sessions yet. Create one to begin.`,"landing.select":`Select project`,"landing.new":`New project`,"landing.menu":`Open menu`,"project.missingSwitched":`Project “{requested}” was not found. Switched to {fallback}.`,"project.missingCreate":`Project “{requested}” was not found. Create a project to continue.`,"topbar.openSessions":`Open projects`,"topbar.externallyManaged":`Externally managed`,"topbar.pauseDaemon":`Pause Argus`,"topbar.runDaemon":`Run Argus`,"topbar.working":`Argus is working on your request`,"topbar.roleActive":`{role} is active`,"topbar.roleIdle":`{role} is idle`,"topbar.externalDaemonHint":`Argus is managed outside this app and must be controlled there.`,"topbar.manageSession":`Manage session`,"topbar.showPreview":`Show preview`,"topbar.showActivity":`Show activity`,"mobile.views":`Views`,"mobile.sessions":`Projects`,"mobile.mission":`Mission`,"mobile.activity":`Conversation`,"mobile.workbench":`Workbench`,"mobile.map":`Map`,"mobile.preview":`Files`,"chat.working":`Argus is working on your message`,"chat.workingQuiet":`Argus is working on your message · Still working; no new update for {quiet}s`,"chat.stopWaitingHint":`Esc stop reply · Enter sends a follow-up`,"chat.queuedWhileRunning":`Queued · answered right after this reply; a running task can be steered by it`,"chat.attachWhileRunning":`Attachments can be sent once this reply finishes`,"chat.stepsLive":`Working · {count} steps so far`,"chat.stepsDone":`{count} steps · {seconds}`,"chat.stepFailed":`failed`,"chat.stepRaw":`raw`,"chat.messageArgus":`message Argus`,"chat.selectSession":`Select a session…`,"chat.placeholder":`Ask a question or assign work`,"chat.routeLabel":`message category`,"chat.routeHint":`For this message only. Argus chooses one worker or a team based on the request; greetings stay in conversation.`,"chat.routeTask":`Task`,"chat.routeAuto":`Auto`,"chat.routeChat":`Chat`,"chat.attach":`attach files`,"chat.attachHint":`PNG, JPEG, WebP, PDF, Markdown/text, JSON, CSV · up to {count} files, {perFile} each, {total} total`,"chat.attachDrop":`Drop files to attach`,"chat.attachRemove":`remove attachment {name}`,"chat.attachUnsupported":`{name} is not supported. Use PNG, JPEG, WebP, PDF, Markdown/text, JSON, or CSV.`,"chat.attachTooLarge":`{name} exceeds the {size} per-file limit.`,"chat.attachTooMany":`You can attach up to {count} files per message.`,"chat.attachTotalTooLarge":`Attachments exceed the {size} total limit.`,"chat.attachmentUploadFailed":`Attachment upload failed: {error}`,"chat.uploadingAttachments":`Uploading attachments`,"chat.rewriteHint":`Let the Manager rewrite this prompt into a brief the team can act on. Nothing is sent — the rewrite lands back in this box for you to edit.`,"chat.rewriteLabel":`rewrite prompt with the Manager`,"chat.rewriting":`rewriting`,"chat.rewrite":`Rewrite text`,"chat.stopWaiting":`stop reply`,"chat.stopWaitingTitle":`Stop this Manager request`,"chat.stoppingReply":`Stopping this reply…`,"chat.stopReplyRequested":`Stop requested. You can send another message.`,"chat.replyAlreadyFinished":`This reply has already finished.`,"chat.stopReplyFailed":`Could not stop the server request: {error}`,"chat.send":`send message`,"copy.message":`Copy`,"copy.code":`Copy code`,"copy.copied":`Copied`,"help.title":`Keyboard shortcuts`,"help.commands":`Commands`,"help.palette":`command palette`,"help.sessions":`toggle sessions`,"help.managerChat":`focus Manager chat`,"help.rewrite":`rewrite the current prompt before sending`,"help.reasoning":`toggle agent reasoning`,"help.kiosk":`toggle kiosk (read-only) mode`,"help.composer":`focus the composer`,"help.send":`send message`,"help.newline":`insert newline`,"help.thisHelp":`this help`,"help.escape":`close overlay / stop waiting in composer`,"palette.placeholder":`Type a command or search…`,"palette.noMatches":`no matching commands`,"palette.navigate":`↑↓ navigate`,"palette.run":`↵ run`,"palette.close":`esc close`,"palette.view":`View`,"palette.action":`Action`,"palette.project":`Project`,"palette.newDaemon":`New session`,"palette.openTranscript":`Open Transcript`,"palette.openProject":`Open Project`,"palette.projectHint":`work · memory · agents`,"palette.openOperations":`Open Operations`,"palette.operationsHint":`session controls`,"palette.hideReasoning":`Hide reasoning`,"palette.showReasoning":`Show reasoning`,"palette.exitKiosk":`Exit kiosk mode`,"palette.enterKiosk":`Enter kiosk mode`,"palette.messageArgus":`Message Argus…`,"palette.stopWaiting":`Stop Manager reply`,"palette.stopContinuous":`Stop continuous campaign`,"palette.startContinuous":`Start continuous campaign`,"palette.stopDaemon":`Pause Argus`,"palette.startDaemon":`Run Argus`,"slash.suggestions":`Slash command suggestions`,"mission.roleActive":`{role} active`,"mission.overview":`mission overview`,"mission.operations":`Operations`,"role.manager":`Manager`,"role.manager.description":`Understands your goal and coordinates work`,"role.planner":`Planner`,"role.planner.description":`Breaks down the problem, schedules work, and revises the plan`,"role.engineer":`Engineer`,"role.engineer.description":`Researches, writes proofs or code, and uses tools to check the work`,"role.reviewer":`Reviewer`,"role.reviewer.description":`Checks results and evidence and identifies gaps`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`You`,"doctor.title":`Doctor`,"doctor.subtitle":`Argus status checks + recommended root-cause fix`,"doctor.recommended":`recommended fix`,"doctor.loadError":`Couldn’t load diagnostics.`,"doctor.empty":`No diagnostic data available`,"doctor.daemonLog":`Daemon log`,"settings.subtitle":`effective roles, budgets, and essential controls`,"settings.loadError":`Couldn’t load configuration.`,"settings.empty":`No configuration found`,"settings.quickConfig":`Quick Config`,"settings.appearance":`Appearance`,"settings.appearanceHint":`Choose the interface colour treatment. Logos and icons always remain monochrome.`,"settings.themeStyle":`Theme colour`,"settings.themeStyle.standard":`Standard`,"settings.themeStyle.standardHint":`Quiet black, white, grey, and blue.`,"settings.themeStyle.gradient":`Gradient`,"settings.themeStyle.gradientHint":`The classic Argus blue-to-gold background.`,"settings.backend":`Backend`,"settings.backendSource.env":`set by the server environment`,"settings.backendSource.persisted":`saved setting`,"settings.backendSource.default":`built-in default`,"settings.backendWillSave":`Apply saves {backend}.`,"settings.backendWillReplace":`Apply replaces the saved {saved} with {backend}.`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`Backend saved as {backend}. Restart Argus to apply.`,"settings.backendUnsupported":`Unsupported backend ({backend})`,"settings.backendUnavailable":`Backend unavailable`,"settings.model":`Model`,"settings.trialAccount":`Trial account`,"settings.trialKeyHint":`Replace your Key here when its allowance runs out. Your projects and conversations stay in place.`,"settings.changeTrialKey":`Change Key`,"settings.applyModel":`Apply`,"settings.modelPlaceholder":`auto (backend default)`,"settings.connection":`Connection`,"settings.webApi":`Web + REST API`,"settings.eventStream":`Live updates`,"settings.taskDaemon":`Background work`,"settings.taskDaemonValue":`Local process · events.jsonl · no TCP port`,"chat.messageTooLong":`Message exceeds 32,000 characters. Shorten it or upload a file. Your draft is preserved.`,"settings.required":`{field} is required`,"settings.advanced":`Advanced`,"settings.advancedHint":`Budgets, the advisor model, explanation effort, connection details and raw configuration`,"settings.mapModel":`Map`,"settings.mapModelFollows":`Follows the front-door model`,"settings.mapModelSet":`Map explanations now use {model}.`,"settings.overrideTitle":`Environment override`,"settings.overrideHint":`Set a specific config alias or environment-variable key.`,"settings.namePlaceholder":`name or alias, e.g. manager_model`,"settings.valuePlaceholder":`value`,"settings.applyAdvanced":`Apply environment override`,"settings.applied":`Applied. Restart affected sessions to use the new settings.`,"settings.modelAppliedToRoles":`Every role now uses {model}. Sessions already running keep their model until they restart.`,"settings.rolesRunning":`Roles now run:`,"settings.applyUnifies":`Apply sets all of them to the model above.`,"settings.rolesTitle":`Effective roles`,"settings.rawConfig":`Raw configuration`,"settings.group.limits":`Limits`,"settings.group.safety":`Safety`,"settings.group.interface":`Interface`,"settings.knob.activeDaemons":`Active session limit`,"settings.knob.activeDaemonsDoc":`Maximum background sessions running on this host.`,"settings.knob.safeMode":`Safe mode`,"settings.knob.safeModeDoc":`Enable extra-conservative runtime guardrails.`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`Enable the Telegram notification bridge.`,"settings.knob.showReasoning":`Show reasoning`,"settings.knob.showReasoningDoc":`Stream role reasoning into the activity view.`,"settings.knob.operatorAvailable":`Operator available`,"settings.knob.operatorAvailableDoc":`Off suppresses operator questions: Argus decides on recorded assumptions and blocks on operator-only actions.`,"noOperator.banner":`No-operator mode: questions suppressed. Argus decides on recorded assumptions instead of asking you.`,"noOperator.turnOff":`Ask me again`,"settings.source.notApplicable":`Not applicable for this model`,"settings.source.vaultDefault":`Capability vault / default`,"settings.source.default":`Default`,"settings.modelUnavailable":`unavailable`,"settings.modelOfflineList":`Offline list: the backend did not return its live models, showing the harness catalog.`,"settings.source.saved":`Saved override`,"settings.source.environment":`Environment variable`,"settings.source.hostConfig":`Host configuration`,"settings.source.other":`Resolved configuration`,"settings.value.enabled":`Enabled`,"settings.value.disabled":`Disabled`,"settings.effort.low":`Low effort`,"settings.effort.medium":`Medium effort`,"settings.effort.high":`High effort`,"settings.effort.xhigh":`Extra-high effort`,"settings.role.curator":`Curator`,"settings.role.curatorDoc":`Maintains and distills the reusable skill pool.`,"settings.footer":`Human-readable labels are shown with raw keys. The full registry remains available via`,"identity.title":`Identity`,"identity.subtitle":`who argus is working for on this project`,"identity.placeholder":`Describe who Argus is working for and durable preferences…`,"identity.save":`Save identity`,"identity.saved":`Identity saved.`,"transcript.title":`Transcript`,"transcript.subtitle":`recent operator ↔ argus turns · reply from the composer`,"transcript.empty":`no conversation turns yet`,"transcript.operator":`operator`,"new.createDaemon":`Create session`,"new.createdIdle":`New session ready. Say what it is for and the work begins.`,"new.createdStarting":`New session ready; the work is starting in the background.`,"new.subtitle":`Creates an isolated timeline and Manager context.`,"new.close":`close create session`,"new.name":`Name`,"new.optional":`(optional)`,"new.namePlaceholder":`e.g. AAAI embodiment paper`,"new.workdir":`Output workdir`,"new.workdirHint":`Agents write code, papers, reports, and experiment outputs here. Internal memory stays under the session state directory.`,"new.objective":`Objective`,"new.objectivePlaceholder":`Leave blank to start with a conversation, or describe a campaign to start immediately.`,"new.startsAfterCreate":`Campaign starts after session creation`,"new.idleUntilMessage":`Idle until the first message`,"new.startsHint":`The session opens immediately while Argus prepares the work in the background.`,"new.idleHint":`Background work starts after your first message, when needed.`,"new.shortcut":`Ctrl/⌘+Enter to create`,"new.creating":`Creating…`,"new.createAndStart":`Create and start`,"manage.daemon":`Manage session`,"manage.displayName":`Display name`,"manage.executor":`Background work`,"manage.running":`Running`,"manage.runningExternally":`Running externally`,"manage.paused":`Stopped`,"manage.pauseHint":`Interrupt the current operation and keep progress resumable.`,"manage.stopNow":`Stop now`,"manage.stopNowHint":`Immediately interrupt this verified daemon so the session can be deleted.`,"manage.externalHint":`This session is managed outside this app.`,"manage.resumeHint":`Resume queued research work.`,"manage.working":`Working…`,"manage.resume":`Resume`,"manage.deleteSession":`Delete session`,"manage.deleteHint":`Deleted sessions move to the trash and remain recoverable. Stop background work first.`,"manage.delete":`Delete…`,"manage.confirmQuestion":`Move this session to trash?`,"manage.confirmDelete":`Confirm delete`,"decision.operator":`Operator decision`,"decision.required":`Decision required`,"decision.whyBlocked":`Recorded reason this task needs input`,"decision.currentTask":`Current task`,"decision.taskName":`Task: {title}`,"decision.otherTask":`Another task awaiting input`,"decision.awaitingReply":`Awaiting your reply`,"decision.askedAt":`Asked {time}`,"decision.evidence":`Evidence`,"decision.notePlaceholder":`Add the guidance the Manager should apply…`,"decision.resumeHint":`Your answer applies to this task. The Manager checks its next step.`,"decision.later":`Later`,"decision.applying":`Submitted; Argus is starting on it…`,"decision.closeContinue":`Close, keep working`,"decision.stopCampaign":`Stop campaign`,"decision.useOption":`Use this option`,"decision.sendAnswer":`Send answer`,"decision.noteRequired":`Add the required details before sending this choice.`,"artifact.preview":`Result preview`,"artifact.title":`Result`,"artifact.approvedEvidence":`evidence the Reviewer has checked`,"artifact.downloading":`Downloading…`,"artifact.download":`Download`,"artifact.open":`Open`,"artifact.close":`close result preview`,"artifact.unavailable":`preview unavailable`,"artifact.empty":`(empty file)`,"artifact.truncated":`preview truncated · download to inspect the complete file`,"artifact.htmlTooLarge":`HTML preview is too large to render safely. Download the complete file.`,"artifact.pdfDisabled":`Inline PDF preview is disabled by this browser.`,"artifact.openPdf":`Open PDF`,"artifact.noPreview":`This file type has no safe inline preview.`,"artifact.downloadHint":`Download it to inspect with a local application.`,"task.details":`Task details`,"task.stopLoop":`stop loop`,"task.done":`done`,"task.skip":`skip`,"task.close":`close task details`,"task.waitingOnYou":`Waiting on you`,"task.objective":`Objective`,"task.noObjective":`(no objective recorded)`,"task.untitled":`Untitled task`,"task.priority":`priority`,"task.started":`started`,"task.finished":`finished`,"task.outcome":`Outcome`,"task.iteration":`Iteration`,"task.mode":`mode`,"task.autoIterate":`auto-iterate`,"task.singlePass":`single pass`,"task.cycles":`cycles`,"task.cost":`cost`,"task.lastError":`Last error`,"task.notes":`Notes`,"task.dependsOn":`depends on`,"task.dependsOnCount":`Depends on {count} earlier tasks`,"pending.reviewRespond":`Review and respond`,"pending.showOnMap":`Show on map`,"backlog.active":`Active · {count}`,"backlog.history":`History · {count}`,"backlog.noHistory":`No completed work yet`,"backlog.empty":`Nothing queued. Argus is ready for new work.`,"backlog.viewDetails":`View full task details`,"backlog.iterating":`Repeating`,"backlog.stopIterating":`Stop repeating`,"backlog.stop":`Stop`,"backlog.markDone":`Mark done`,"backlog.remove":`Remove`,"mission.achievement":`Argus achievement`,"mission.elapsed":`Elapsed`,"mission.rejectedAttempts":`{count} rejected attempts`,"mission.skillsLearned":`{count} skills learned`,"mission.artifacts":`{count} files produced`,"mission.waiting":`Waiting for a mission`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`Ready when you are — assign a mission to begin.`,"mission.statusDone":`This task: {outcome} — finished in {elapsed}.`,"mission.nextAfterReply":`Reply to this task’s question first, then decide its next step.`,"mission.continuousDone":`Continuous run finished`,"mission.resumeContinuous":`Resume`,"mission.control":`Mission control`,"mission.attentionHealth":`System error — health is degraded.`,"mission.attentionFailed":`Mission failed — check the task below.`,"mission.deliveryFailed":`Task failed at delivery — execution could not start or finish.`,"mission.attentionStepFailed":`A step failed — check the task below.`,"mission.attentionPaused":`Mission is paused — waiting for your input.`,"mission.showObjective":`Show full objective`,"mission.showFullOutput":`View full output`,"mission.stage":`Stage`,"mission.campaign":`Campaign`,"mission.totalElapsed":`Total elapsed`,"mission.round":`Round`,"mission.mode":`Mode`,"mission.summary":`Mission summary`,"mission.deliveryCertified":`Delivery approved`,"mission.taskCompleted":`Task completed`,"mission.openResult":`Open result`,"mission.viewTask":`View task`,"mission.taskPlan":`Task plan`,"mission.team":`Team`,"mission.waitingShort":`Waiting`,"mission.roleWork":`Role work`,"mission.showMore":`Show more`,"mission.showLess":`Show less`,"mission.done":`Done`,"mission.inProgress":`In progress`,"mission.failed":`Failed`,"mission.bannerPaused":`Mission is paused — waiting for your input.`,"mission.bannerError":`System error — health is degraded.`,"mission.bannerStepFailed":`A step failed: {step}`,"mission.elapsedAgo":`{elapsed} ago`,"mission.filteredBy":`filtered by {task} · clear`,"mission.allVisible":`all visible missions`,"mission.roundNumber":`round {count}`,"mission.noRoleWork":`No persisted {role} work for this selection yet.`,"mission.researchDag":`Task route`,"mission.active":`active`,"mission.noDag":`The Planner has not added tasks to the route yet.`,"mission.workingHypothesis":`Working hypothesis · can be revised`,"mission.goalContribution":`How this supports the goal`,"mission.temporaryRegressions":`Expected temporary tradeoffs`,"mission.decisionRule":`When to revise, split, or stop`,"mission.acceptance":`What counts as done`,"mission.nonGoals":`Non-goals`,"mission.capabilities":`Capabilities`,"mission.capabilitiesUnlocked":`Capabilities unlocked`,"mission.learnedCapability":`Learned capability`,"mission.learnedDuring":`Learned during {mission}`,"mission.skillUnavailable":`Skill content is not available in this snapshot.`,"mission.contentTruncated":`Content preview truncated`,"mission.knowledgeRetained":`Knowledge retained`,"mission.selfEvolution":`Saved project knowledge`,"mission.knowledgeSaved":`Argus saved these capabilities and notes for future work on this project.`,"mission.noCapabilities":`No capabilities learned yet.`,"mission.replay":`Mission replay`,"mission.replayTimeline":`Replay mission timeline`,"mission.roleFailed":`{role} failed`,"mission.showingLatestEvent":`Showing latest event`,"mission.showingLastEvents":`Showing last {count} events`,"mission.waitingEvents":`Waiting for structured research events.`,"mission.startsAfter":`Starts after {count} earlier tasks`,"mission.hiddenTasks":`{count} earlier tasks hidden · {failed} blocked or failed · {skipped} skipped`,"mission.projectFilesChanged":`Project files changed`,"mission.reviewInIde":`Open the IDE to review the diff`,"research.currentWork":`Current work`,"research.dagProgress":`Task route progress`,"research.verifiedOutputs":`Verified outputs`,"research.recentMilestones":`Recent milestones`,"research.liveProgress":`Task progress`,"research.artifact":`Research result`,"research.canvas":`Manager live research canvas`,"research.previewArtifact":`Preview the result`,"research.openLarge":`Open large preview`,"research.collapse":`Collapse preview`,"research.unavailable":`Manager live view is temporarily unavailable.`,"research.noPreview":`No preview`,"research.waiting":`Waiting…`,"research.updating":`Updating…`,"research.fileUnavailable":`This file is ready to download using the button above.`,"research.eventSourced":`event-sourced mission state`,"research.downloadFailed":`download failed`,"operations.title":`Operations`,"operations.work":`Work`,"operations.runtime":`Runtime`,"operations.system":`System`,"operations.recovery":`Recovery`,"operations.workInput":`Work input`,"operations.workHint":`Queue work, guide the active task, save a note, or preview a plan without dispatching it.`,"operations.action.task":`Task`,"operations.action.nudge":`Guide`,"operations.action.note":`Note`,"operations.action.plan":`Plan`,"operations.planPlaceholder":`Objective to preview; preview never queues work`,"operations.actionPlaceholder":`{action} text`,"operations.previewPlan":`Preview plan`,"operations.submitAction":`Submit {action}`,"operations.runtimeHint":`Change where this session runs, reset Manager context, or safely restart the session.`,"operations.workdir":`Working directory`,"operations.workdirUpdated":`Working directory updated.`,"operations.applyWorkdir":`Apply working directory`,"operations.replaceSlot":`Replace an active session`,"operations.sourceUpdate":`Argus source version`,"operations.pullLatest":`Pull latest version`,"operations.updateChecking":`Checking published branch…`,"operations.updateRunning":`Updating…`,"operations.updateAvailable":`Update available`,"operations.updateCurrent":`Up to date`,"operations.updateUnavailable":`This checkout cannot be updated safely.`,"operations.currentRevision":`Current`,"operations.latestRevision":`Latest`,"operations.updatePhase":`Phase`,"operations.updateRestart":`Source updated. Restart the cockpit, then use the reload button to move active daemons to the new release at a safe task boundary.`,"operations.skills":`Skills`,"operations.runSkill":`Run skill command`,"operations.metrics":`System metrics`,"operations.trash":`Recoverable trash`,"operations.searchTrash":`Search trash`,"operations.trashEmpty":`Trash is empty.`,"resource.title":`Resources`,"resource.loading":`Loading resource status…`,"resource.devices":`Devices: {count}`,"resource.inUse":`In use · {count}`,"resource.queue":`Queue · {count}`,"resource.none":`None`,"resource.timeLeft":`{ttl} left`,"resource.noIntent":`No purpose recorded`,"resource.yieldRequest":`Resource release requested · {reason}`,"resource.queuePosition":`Queue position {position}`,"label.status.inProgress":`In progress`,"label.status.waiting":`Waiting`,"label.status.completed":`Completed`,"label.status.blocked":`Blocked`,"label.status.failed":`Failed`,"label.status.needsChanges":`Needs changes`,"label.status.skipped":`Skipped`,"label.status.paused":`Paused`,"label.status.cancelled":`Cancelled`,"label.status.available":`Available`,"label.status.unavailable":`Unavailable`,"label.status.inaccessible":`Not accessible`,"label.status.limited":`Limited`,"label.status.healthy":`Healthy`,"label.status.updated":`Status updated`,"label.role.argus":`Argus`,"label.role.you":`You`,"label.work.task":`Task`,"label.work.action":`Work step`,"label.work.handoff":`Notes for the next step`,"label.work.review":`Review`,"label.work.planning":`Planning`,"label.work.update":`Update`,"label.stage.scope":`Scope`,"label.stage.research":`Research`,"label.stage.implementation":`Implementation`,"label.stage.experiment":`Experiments`,"label.stage.analysis":`Analysis`,"label.stage.writing":`Writing`,"label.stage.review":`Final review`,"label.stage.delivery":`Delivery`,"label.stage.unstaged":`Unstaged`,"label.frontier.reopened":`An earlier task was reopened`,"label.frontier.added":`A new task was added`,"label.frontier.completed":`A task path was completed`,"label.frontier.revised":`The task plan was revised`,"label.frontier.narrowed":`The task scope was narrowed`,"label.frontier.expanded":`The task scope was expanded`,"label.frontier.updated":`The task plan was updated`,"label.priority":`Priority {priority}`,"label.outcome.workCompleted":`Work completed`,"label.outcome.workPaused":`Work paused`,"label.outcome.workBlocked":`Work blocked`,"label.outcome.workFailed":`Work failed`,"label.outcome.workEnded":`Work ended`,"label.outcome.workIncomplete":`Work incomplete`,"label.outcome.workStalled":`Work stalled`,"label.outcome.workUpdated":`Work status updated`,"label.outcome.reviewPassed":`Review passed`,"label.outcome.reviewNeedsChanges":`Review requested changes`,"label.outcome.reviewBlocked":`Review blocked`,"label.outcome.reviewOutdated":`Review is out of date`,"label.outcome.reviewPending":`Review pending`,"label.outcome.stageApproved":`Stage approved`,"label.outcome.stageNotApproved":`Stage not approved`,"label.outcome.stageRevoked":`Stage approval revoked`,"label.outcome.stageNotNeeded":`Stage decision not needed`,"label.outcome.stagePending":`Stage decision pending`,"label.outcome.budgetPaused":`Paused by budget limit`,"label.outcome.costUnreconciled":`Awaiting provider usage reconciliation`,"label.outcome.waitingForYou":`Waiting for your response`,"label.outcome.stoppedByYou":`Stopped by you`,"label.outcome.pausedByYou":`Paused by you`,"label.outcome.sessionPaused":`Session paused`,"label.outcome.serviceUnavailable":`Service unavailable`,"label.outcome.serviceCoolingDown":`Service temporarily paused`,"label.outcome.temporaryIssue":`Paused by a temporary issue`,"label.outcome.serviceError":`Stopped by a service error`,"label.outcome.needsPlan":`A new plan is needed`,"label.outcome.canResume":`Can resume`,"label.routing.team":`Team workflow`,"label.routing.individual":`Individual workflow`,"label.routing.research":`Research`,"label.routing.software":`Software work`,"label.routing.staged":`Step by step`,"label.routing.flexible":`Flexible workflow`,"label.routing.ongoing":`Ongoing`,"label.routing.defined":`Defined scope`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`Accelerator`,"label.resource.enforced":`Limits enforced`,"label.resource.advisory":`Recommendations only`,"label.resource.released":`Resources released`,"label.resource.kept":`Resources kept`,"mission.lastProgress":`Progress recorded before the stop`,"mission.nextResume":`The progress is saved. Run Argus again and it continues from where it stopped.`,"mission.nextResumeLive":`Argus will continue from the saved progress.`,"research.totalTime":`Total time`,"research.optionDelivery":`Delivery`,"research.optionCheckpoint":`Checkpoint`,"research.optionPending":`being written`,"operations.unavailableHere":`This is not available on this Argus.`,"operations.requestFailed":`That did not go through.`,"operations.technicalDetails":`Technical details`,"verticals.title":`Vertical Store`,"verticals.entry":`Verticals`,"verticals.openStore":`Open Vertical Store`,"verticals.paletteHint":`install · enable · update`,"verticals.intro":`A vertical gives Argus a research domain: its stages, roles, skills and checks. Install what your projects need and enable it per workspace.`,"verticals.hostedNote":`Verticals are provided by the host; you can enable or disable them for your workspace.`,"verticals.close":`Close vertical store`,"verticals.search":`Search verticals`,"verticals.searchPlaceholder":`Search by name, purpose or tag…`,"verticals.refreshCatalog":`Refresh catalog`,"verticals.refreshing":`Refreshing…`,"verticals.catalogSource":`Catalog: {source}`,"verticals.catalogRelease":`Release {tag}`,"verticals.catalogFetched":`Fetched {time}`,"verticals.catalogNever":`Catalog not fetched yet`,"verticals.catalogError":`The catalog could not be refreshed: {error}`,"verticals.kindFilter":`Filter by kind`,"verticals.tagFilter":`Filter by tag`,"verticals.clearFilters":`Clear filters`,"verticals.count":`{shown} of {total}`,"verticals.filter.all":`All`,"verticals.routingPath":`Category / domain / specialty`,"verticals.filter.installed":`Installed`,"verticals.filter.available":`Available`,"verticals.filter.builtin":`Built-in`,"verticals.kind.builtin":`Built-in`,"verticals.kind.package":`Bundled`,"verticals.kind.installed":`Installed`,"verticals.kind.available":`Available`,"verticals.enabled":`Enabled`,"verticals.disabledState":`Disabled`,"verticals.updateAvailable":`Update available`,"verticals.updateTo":`Update to {version}`,"verticals.installedVersion":`Installed {version}`,"verticals.catalogVersion":`Catalog {version}`,"verticals.requires":`Requires`,"verticals.shared":`Shares resources with`,"verticals.size":`Size`,"verticals.jumpTo":`Go to {name}`,"verticals.missingPython":`Needs: {packages} — install them into the Python environment Argus runs from.`,"verticals.runtimeIssues":`Installed version is incompatible with this Argus runtime: {issues}`,"verticals.installIssues":`Catalog installation/update is blocked by runtime requirements: {issues}`,"verticals.usedByOne":`Used by 1 project`,"verticals.usedBy":`Used by {count} projects`,"verticals.action.install":`Install`,"verticals.action.update":`Update`,"verticals.action.enable":`Enable`,"verticals.action.disable":`Disable`,"verticals.action.uninstall":`Uninstall`,"verticals.confirmUninstall":`Confirm uninstall`,"verticals.confirmUninstallHint":`Removes {name} from this Argus.`,"verticals.removeAnyway":`Remove anyway`,"verticals.operation.install":`Installing…`,"verticals.operation.update":`Updating…`,"verticals.operation.enable":`Enabling…`,"verticals.operation.disable":`Disabling…`,"verticals.operation.uninstall":`Uninstalling…`,"verticals.operationRunning":`Working…`,"verticals.operationFailed":`{action} failed`,"verticals.loading":`Loading verticals…`,"verticals.noMatches":`No verticals match these filters.`,"verticals.none":`No verticals are listed yet.`,"verticals.loadFailed":`Could not read the vertical list.`,"verticals.actionFailed":`That did not go through.`,"verticals.tooOld":`This Argus backend predates the vertical store. Update Argus, then reopen this page to manage verticals.`},Ct={"language.english":`English`,"handshake.connecting":`正在准备 Argus`,"handshake.service":`服务`,"handshake.project":`项目`,"handshake.ready":`就绪`,"handshake.title":`正在准备 Argus`,"handshake.detail":`正在恢复你的工作区…`,"splash.starting":`Argus 启动中`,"rail.workbench":`工作台`,"rail.sessionsShortcut":`会话 · Ctrl/⌘ P`,"panel.backlog":`待办`,"panel.activity":`对话与进展`,"panel.journal":`日志`,"panel.roles":`角色`,"panel.project":`项目`,"panel.liveView":`Manager 实时项目视图`,"stream.jumpToLatest":`跳到最新`,"stream.toggleReasoning":`显示或隐藏 Agent 推理(⌘T)`,"stream.reasoning":`推理`,"stream.noLogs":`暂无活动`,"stream.system":`Argus 动态`,"stream.autonomous":`后台活动`,"stream.backgroundWork":`Argus 正在后台工作`,"stream.ready":`Argus 已就绪。你可以提问或安排下一项工作。`,"stream.historyLoading":`正在读取对话记录…`,"stream.historyError":`对话记录暂时读取失败。`,"stream.historyRetry":`重试`,"stream.fold.read":`读取了 {count} 个文件`,"stream.fold.search":`搜索了 {count} 次`,"stream.fold.fetch":`查阅了 {count} 个网页`,"stream.fold.edit":`修改了 {count} 个文件`,"stream.fold.tool":`使用了 {count} 次 {tool}`,"stream.fold.failed":`{count} 次失败`,"stream.fold.expand":`展开每一步`,"stream.fold.collapse":`收起`,"stream.repeated":`重复了 {count} 次,显示最近一次`,"stream.stepFailed":`失败`,"stream.stepResult":`结果`,"common.showRaw":`显示原始输出`,"doctor.lastEntry":`最近一条`,"operations.metric.calls":`今日模型调用`,"operations.metric.failed":`失败`,"operations.metric.slowest":`最慢的常规调用`,"operations.slo.healthy":`正常`,"operations.slo.degraded":`需要留意`,"operations.slo.loading":`加载中…`,"operations.validationFailures":`今日 {count} 条格式异常的事件`,"operations.outputLines":`共 {count} 行输出`,"operations.done":`已完成。`,"newDaemon.workdirPlaceholder":`留空 → ~/.argus-skill/workspaces/`,"operations.resetManager":`重新开始理解这段对话`,"language.chinese":`中文`,"language.switchTo":`切换到{language}`,"common.loading":`加载中…`,"common.retry":`重试`,"common.save":`保存`,"common.cancel":`取消`,"common.close":`关闭`,"common.settings":`设置`,"common.ready":`就绪`,"common.live":`实时`,"common.reconnecting":`正在重连`,"common.stale":`快照已过期`,"common.degraded":`快照异常`,"common.external":`外部`,"common.pause":`暂停`,"common.run":`运行`,"common.working":`处理中`,"common.local":`本地`,"common.all":`全部`,"common.unassigned":`未分配`,"common.closeSessions":`关闭会话列表`,"common.resizeSessions":`调整会话列表宽度`,"common.resizePreview":`调整预览区域宽度`,"common.expandPreview":`展开预览`,"time.justNow":`刚刚`,"time.minutesAgo":`{count}分钟前`,"time.hoursAgo":`{count}小时前`,"time.yesterdayAt":`昨天 {time}`,"connection.pairingTitle":`此浏览器尚未与 Argus 配对`,"connection.pairingDetail":`请打开这个站点的有效配对链接,或在下方粘贴配对链接或令牌。`,"connection.pairAgain":`重新配对`,"connection.pairingInput":`配对链接或令牌`,"connection.pairingPlaceholder":`粘贴新的配对链接或令牌`,"connection.pairingInvalid":`请输入有效的配对链接或令牌。`,"connection.connect":`连接`,"connection.unreachableTitle":`Argus 本地服务当前不可达`,"connection.unreachableDetail":`请保持 Argus Desktop 运行,等待本地服务就绪后再重试。`,"sidebar.collapse":`收起会话`,"sidebar.expand":`展开会话`,"sidebar.create":`创建项目`,"sidebar.find":`查找项目`,"sidebar.clearSearch":`清除搜索`,"sidebar.refreshFailed":`刷新失败 · 重试`,"sidebar.noSessions":`暂无会话`,"sidebar.noMatches":`没有匹配"{query}"的会话`,"sidebar.unnamedSession":`未命名会话`,"sidebar.daemonAlive":`Argus 后台在线`,"sidebar.updateRequired":`需要更新`,"sidebar.updateAvailable":`可更新`,"sidebar.updateAvailableHint":`后台仍在运行,执行器与网页版本不同。`,"sidebar.stopped":`后台已停止`,"sidebar.runningFor":`后台在线 · {uptime}`,"sidebar.lastActive":`上次活动 {time}`,"sidebar.manage":`管理 {name}`,"sidebar.manageHint":`重命名、暂停或删除`,"sidebar.resume":`继续`,"sidebar.resumeHint":`在 {workdir} 中继续工作`,"sidebar.resumeSuccess":`会话已恢复。`,"sidebar.resumeFailed":`无法恢复会话:{error}`,"sidebar.modelLoading":`正在加载后端和模型…`,"sidebar.modelUnavailable":`后端和模型信息不可用`,"sidebar.defaultModel":`默认模型`,"sidebar.openSettings":`打开设置`,"sidebar.compute":`算力队列与账户额度`,"sidebar.theme":`{current}主题;切换到{next}主题`,"landing.selectOrCreate":`从侧边栏选择一个会话,或创建新会话。`,"landing.noSessions":`还没有会话。创建一个即可开始。`,"landing.select":`选择项目`,"landing.new":`新建项目`,"landing.menu":`打开菜单`,"project.missingSwitched":`找不到项目“{requested}”,已切换到 {fallback}。`,"project.missingCreate":`找不到项目“{requested}”,请新建一个项目继续。`,"topbar.openSessions":`打开项目列表`,"topbar.externallyManaged":`由外部管理`,"topbar.pauseDaemon":`暂停 Argus`,"topbar.runDaemon":`运行 Argus`,"topbar.working":`Argus 正在处理你的请求`,"topbar.roleActive":`{role} 活跃中`,"topbar.roleIdle":`{role} 空闲`,"topbar.externalDaemonHint":`Argus 由此应用之外的服务管理,请前往相应位置控制。`,"topbar.manageSession":`管理会话`,"topbar.showPreview":`显示预览`,"topbar.showActivity":`显示动态`,"mobile.views":`视图`,"mobile.sessions":`项目`,"mobile.mission":`任务`,"mobile.activity":`对话`,"mobile.workbench":`工作台`,"mobile.map":`地图`,"mobile.preview":`文件`,"chat.working":`Argus 正在处理你的消息`,"chat.workingQuiet":`Argus 正在处理你的消息 · 仍在处理中,{quiet} 秒暂无新进展`,"chat.stopWaitingHint":`按 Esc 停止回复 · 按 Enter 追加消息`,"chat.queuedWhileRunning":`已排队 · 这条回复结束后立即处理;正在运行的任务会据此调整`,"chat.attachWhileRunning":`附件要等这条回复结束后再发送`,"chat.stepsLive":`正在工作 · 已 {count} 步`,"chat.stepsDone":`过程 {count} 步 · {seconds}`,"chat.stepFailed":`失败`,"chat.stepRaw":`原始参数`,"chat.messageArgus":`向 Argus 发送消息`,"chat.selectSession":`请选择会话…`,"chat.placeholder":`提问或安排工作`,"chat.routeLabel":`消息类型`,"chat.routeHint":`仅用于本条消息。Argus 根据实际需要选择单智能体或团队,问候直接回复。`,"chat.routeTask":`任务`,"chat.routeAuto":`自动`,"chat.routeChat":`对话`,"chat.attach":`添加文件`,"chat.attachHint":`支持 PNG、JPEG、WebP、PDF、Markdown/文本、JSON、CSV · 每条消息最多 {count} 个文件,单个 {perFile},总计 {total}`,"chat.attachDrop":`拖放文件以添加附件`,"chat.attachRemove":`移除附件 {name}`,"chat.attachUnsupported":`{name} 不受支持。请使用 PNG、JPEG、WebP、PDF、Markdown/文本、JSON 或 CSV。`,"chat.attachTooLarge":`{name} 超过单文件大小限制 {size}。`,"chat.attachTooMany":`每条消息最多只能附带 {count} 个文件。`,"chat.attachTotalTooLarge":`附件总大小超过 {size} 限制。`,"chat.attachmentUploadFailed":`附件上传失败:{error}`,"chat.uploadingAttachments":`正在上传附件`,"chat.rewriteHint":`把这段话整理得更清楚。改写结果会回到输入框,由你检查后发送。`,"chat.rewriteLabel":`整理这段话`,"chat.rewriting":`正在改写`,"chat.rewrite":`改写文字`,"chat.stopWaiting":`停止回复`,"chat.stopWaitingTitle":`停止处理这条消息`,"chat.stoppingReply":`正在停止当前回复…`,"chat.stopReplyRequested":`已收到停止请求,可以发送新消息。`,"chat.replyAlreadyFinished":`这次回复已经结束。`,"chat.stopReplyFailed":`服务端未能停止这次请求:{error}`,"chat.send":`发送消息`,"copy.message":`复制`,"copy.code":`复制代码`,"copy.copied":`已复制`,"help.title":`键盘快捷键`,"help.commands":`命令`,"help.palette":`打开命令面板`,"help.sessions":`展开或收起会话`,"help.managerChat":`聚焦 Manager 对话框`,"help.rewrite":`发送前改写当前提示词`,"help.reasoning":`显示或隐藏 Agent 推理`,"help.kiosk":`切换只读展示模式`,"help.composer":`聚焦输入框`,"help.send":`发送消息`,"help.newline":`插入换行`,"help.thisHelp":`打开此帮助`,"help.escape":`关闭浮层或停止等待`,"palette.placeholder":`输入命令或搜索…`,"palette.noMatches":`没有匹配的命令`,"palette.navigate":`↑↓ 导航`,"palette.run":`↵ 执行`,"palette.close":`Esc 关闭`,"palette.view":`视图`,"palette.action":`操作`,"palette.project":`项目`,"palette.newDaemon":`新建会话`,"palette.openTranscript":`打开对话记录`,"palette.openProject":`打开项目`,"palette.projectHint":`工作 · 记忆 · Agent`,"palette.openOperations":`打开运行控制`,"palette.operationsHint":`会话控制`,"palette.hideReasoning":`隐藏推理`,"palette.showReasoning":`显示推理`,"palette.exitKiosk":`退出展示模式`,"palette.enterKiosk":`进入展示模式`,"palette.messageArgus":`向 Argus 发送消息…`,"palette.stopWaiting":`停止当前回复`,"palette.stopContinuous":`停止持续任务`,"palette.startContinuous":`启动持续任务`,"palette.stopDaemon":`暂停 Argus`,"palette.startDaemon":`运行 Argus`,"slash.suggestions":`Slash 命令建议`,"mission.roleActive":`{role} 正在工作`,"mission.overview":`任务概览`,"mission.operations":`运行控制`,"role.manager":`统筹`,"role.manager.description":`理解你的目标,协调工作`,"role.planner":`规划`,"role.planner.description":`拆解问题,安排后续工作并调整计划`,"role.engineer":`执行`,"role.engineer.description":`查资料、写证明或代码,调用工具验证`,"role.reviewer":`复核`,"role.reviewer.description":`检查结果与证据,指出缺口`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`你`,"doctor.title":`诊断`,"doctor.subtitle":`Argus 状态检查与推荐的根因修复方案`,"doctor.recommended":`推荐修复`,"doctor.loadError":`无法加载诊断数据。`,"doctor.empty":`诊断暂无数据`,"doctor.daemonLog":`后台进程日志`,"settings.subtitle":`生效中的角色、预算和关键控制项`,"settings.loadError":`无法加载配置。`,"settings.empty":`未找到配置`,"settings.quickConfig":`快速配置`,"settings.appearance":`外观`,"settings.appearanceHint":`选择界面主题色。Logo 与图标始终保持黑白,不参与渐变。`,"settings.themeStyle":`主题色`,"settings.themeStyle.standard":`标准`,"settings.themeStyle.standardHint":`克制的黑、白、灰与蓝色。`,"settings.themeStyle.gradient":`渐变`,"settings.themeStyle.gradientHint":`经典 Argus 蓝金渐变背景。`,"settings.backend":`后端`,"settings.backendSource.env":`由服务器环境设置`,"settings.backendSource.persisted":`已保存的设置`,"settings.backendSource.default":`内置默认值`,"settings.backendWillSave":`应用后保存为{backend}。`,"settings.backendWillReplace":`应用后把已保存的{saved}改为{backend}。`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`后端已保存为{backend}。重启 Argus 后生效。`,"settings.backendUnsupported":`不支持的后端({backend})`,"settings.backendUnavailable":`后端信息不可用`,"settings.model":`模型`,"settings.trialAccount":`试用账号`,"settings.trialKeyHint":`额度用完后可在这里更换 Key,项目和对话会保留。`,"settings.changeTrialKey":`更换 Key`,"settings.applyModel":`应用`,"settings.modelPlaceholder":`auto(后端默认模型)`,"settings.connection":`连接`,"settings.webApi":`Web + REST API`,"settings.eventStream":`实时动态`,"settings.taskDaemon":`后台工作`,"settings.taskDaemonValue":`本地进程 · events.jsonl · 无 TCP 端口`,"chat.messageTooLong":`消息超过 32,000 字符,请缩短或作为附件上传。草稿已保留。`,"settings.required":`必须填写{field}`,"settings.advanced":`高级设置`,"settings.advancedHint":`预算、顾问模型、讲解强度、连接详情与原始配置`,"settings.mapModel":`地图`,"settings.mapModelFollows":`跟随前台模型`,"settings.mapModelSet":`地图讲解现在用 {model}。`,"settings.overrideTitle":`环境变量覆盖`,"settings.overrideHint":`设置特定的配置别名或环境变量键。`,"settings.namePlaceholder":`名称或别名,例如 manager_model`,"settings.valuePlaceholder":`值`,"settings.applyAdvanced":`应用环境变量覆盖`,"settings.applied":`设置已应用。请重启受影响的会话以使用新设置。`,"settings.modelAppliedToRoles":`所有角色现在都用 {model}。正在运行的会话要重启后才换。`,"settings.rolesRunning":`各角色当前实际使用:`,"settings.applyUnifies":`点“应用”会把它们统一成上面的模型。`,"settings.rolesTitle":`生效中的角色`,"settings.rawConfig":`原始配置`,"settings.group.limits":`限制`,"settings.group.safety":`安全`,"settings.group.interface":`界面`,"settings.knob.activeDaemons":`活动会话上限`,"settings.knob.activeDaemonsDoc":`此主机上可同时运行的后台会话数量上限。`,"settings.knob.safeMode":`安全模式`,"settings.knob.safeModeDoc":`启用更保守的运行时保护措施。`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`启用 Telegram 通知桥接。`,"settings.knob.showReasoning":`显示推理`,"settings.knob.showReasoningDoc":`在活动视图中显示角色推理过程。`,"settings.knob.operatorAvailable":`有人值守`,"settings.knob.operatorAvailableDoc":`关闭后不再向你提问:Argus 依据记录的假设自行决定,需要你授权的操作会直接停下。`,"noOperator.banner":`无人值守模式:已停止提问。Argus 会依据记录的假设自行决定,而不是问你。`,"noOperator.turnOff":`恢复提问`,"settings.source.notApplicable":`不适用于此模型`,"settings.source.vaultDefault":`能力库 / 默认值`,"settings.source.default":`默认值`,"settings.modelUnavailable":`不可用`,"settings.modelOfflineList":`离线列表:后端没有返回实时模型列表,显示的是本地目录。`,"settings.source.saved":`已保存的覆盖值`,"settings.source.environment":`环境变量`,"settings.source.hostConfig":`主机配置`,"settings.source.other":`解析后的配置`,"settings.value.enabled":`已启用`,"settings.value.disabled":`已停用`,"settings.effort.low":`低推理强度`,"settings.effort.medium":`中等推理强度`,"settings.effort.high":`高推理强度`,"settings.effort.xhigh":`超高推理强度`,"settings.role.curator":`知识维护`,"settings.role.curatorDoc":`维护并提炼可复用技能库。`,"settings.footer":`配置项同时显示易读标签和原始键。完整配置仍可通过以下命令查看:`,"identity.title":`身份`,"identity.subtitle":`本项目中 Argus 服务的对象`,"identity.placeholder":`描述 Argus 正在为谁工作,以及需要长期遵循的偏好…`,"identity.save":`保存身份`,"identity.saved":`身份已保存。`,"transcript.title":`对话记录`,"transcript.subtitle":`近期操作者 ↔ Argus 对话 · 请从输入框继续回复`,"transcript.empty":`暂无对话记录`,"transcript.operator":`操作者`,"new.createDaemon":`创建会话`,"new.createdIdle":`新会话已就绪。说一句你想做什么,工作就开始了。`,"new.createdStarting":`新会话已就绪,工作正在后台开始。`,"new.subtitle":`在这里保存你的对话和任务进度。`,"new.close":`关闭创建会话窗口`,"new.name":`名称`,"new.optional":`(可选)`,"new.namePlaceholder":`例如:AAAI 具身智能论文`,"new.workdir":`输出工作目录`,"new.workdirHint":`Agent 会在这里写入代码、论文、报告和实验结果。内部记忆仍保存在会话状态目录中。`,"new.objective":`目标`,"new.objectivePlaceholder":`留空则从对话开始,也可以填写一个立即启动的持续任务。`,"new.startsAfterCreate":`创建会话后立即启动任务`,"new.idleUntilMessage":`收到第一条消息前保持空闲`,"new.startsHint":`会话会立即打开,Argus 将在后台准备相关工作。`,"new.idleHint":`收到第一条消息后,Argus 会按需启动后台工作。`,"new.shortcut":`按 Ctrl/⌘+Enter 创建`,"new.creating":`正在创建…`,"new.createAndStart":`创建并启动`,"manage.daemon":`管理会话`,"manage.displayName":`显示名称`,"manage.executor":`后台工作`,"manage.running":`运行中`,"manage.runningExternally":`由外部运行`,"manage.paused":`未运行`,"manage.pauseHint":`中断当前操作并保留可恢复的进度。`,"manage.stopNow":`立即停止`,"manage.stopNowHint":`立即中断这个已验证的 daemon,停止后即可删除会话。`,"manage.externalHint":`此会话由此应用之外的服务管理。`,"manage.resumeHint":`继续执行队列中的研究工作。`,"manage.working":`处理中…`,"manage.resume":`继续`,"manage.deleteSession":`删除会话`,"manage.deleteHint":`删除的会话会移入回收站,之后仍可恢复。请先停止后台工作。`,"manage.delete":`删除…`,"manage.confirmQuestion":`将此会话移入回收站?`,"manage.confirmDelete":`确认删除`,"decision.operator":`操作者决策`,"decision.required":`需要你的决策`,"decision.whyBlocked":`这项任务记录的待答原因`,"decision.currentTask":`当前任务`,"decision.taskName":`任务:{title}`,"decision.otherTask":`其他待处理任务`,"decision.awaitingReply":`等待你的回复`,"decision.askedAt":`提问于 {time}`,"decision.evidence":`证据`,"decision.notePlaceholder":`添加 Manager 应采用的指导…`,"decision.resumeHint":`回答只针对这项任务,Manager 会据此检查它的下一步。`,"decision.later":`稍后处理`,"decision.applying":`已提交,Argus 正在开始处理…`,"decision.closeContinue":`关闭,后台继续`,"decision.stopCampaign":`停止持续任务`,"decision.useOption":`使用此选项`,"decision.sendAnswer":`发送回答`,"decision.noteRequired":`这个选项需要补充说明后才能提交。`,"artifact.preview":`结果预览`,"artifact.title":`结果`,"artifact.approvedEvidence":`已经检查确认的依据`,"artifact.downloading":`正在下载…`,"artifact.download":`下载`,"artifact.open":`打开`,"artifact.close":`关闭结果预览`,"artifact.unavailable":`无法预览`,"artifact.empty":`(空文件)`,"artifact.truncated":`预览已截断 · 请下载完整文件查看`,"artifact.htmlTooLarge":`HTML 文件过大,无法安全预览。请下载完整文件。`,"artifact.pdfDisabled":`此浏览器已禁用内嵌 PDF 预览。`,"artifact.openPdf":`打开 PDF`,"artifact.noPreview":`此文件类型无法安全地在线预览。`,"artifact.downloadHint":`请下载后使用本地应用查看。`,"task.details":`任务详情`,"task.stopLoop":`停止循环`,"task.done":`完成`,"task.skip":`跳过`,"task.close":`关闭任务详情`,"task.waitingOnYou":`等待你的回复`,"task.objective":`目标`,"task.noObjective":`(未记录目标)`,"task.untitled":`未命名任务`,"task.priority":`优先级`,"task.started":`开始时间`,"task.finished":`完成时间`,"task.outcome":`结果`,"task.iteration":`迭代`,"task.mode":`模式`,"task.autoIterate":`自动迭代`,"task.singlePass":`单次执行`,"task.cycles":`轮次`,"task.cost":`成本`,"task.lastError":`最近错误`,"task.notes":`备注`,"task.dependsOn":`依赖`,"task.dependsOnCount":`依赖前置任务 {count} 项`,"pending.reviewRespond":`查看并回复`,"pending.showOnMap":`在地图上查看`,"backlog.active":`进行中 · {count}`,"backlog.history":`历史记录 · {count}`,"backlog.noHistory":`暂无已完成工作`,"backlog.empty":`队列中没有工作。Argus 已准备好接收新任务。`,"backlog.viewDetails":`查看完整任务详情`,"backlog.iterating":`重复执行中`,"backlog.stopIterating":`停止重复执行`,"backlog.stop":`停止`,"backlog.markDone":`标记为完成`,"backlog.remove":`移除`,"mission.achievement":`Argus 成果`,"mission.elapsed":`耗时`,"mission.rejectedAttempts":`{count} 次方案被拒绝`,"mission.skillsLearned":`学习了 {count} 个 Skill`,"mission.artifacts":`产出 {count} 个文件`,"mission.waiting":`等待任务`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`已准备就绪,请分配一个任务开始工作。`,"mission.statusDone":`本次任务:{outcome} — 用时 {elapsed}。`,"mission.nextAfterReply":`请先回复这项任务的问题,再决定它的下一步。`,"mission.continuousDone":`连续运行已完成`,"mission.resumeContinuous":`恢复`,"mission.control":`任务控制`,"mission.attentionHealth":`系统出错——运行状态异常。`,"mission.attentionFailed":`任务失败——请查看下方详情。`,"mission.deliveryFailed":`任务在交付阶段失败——执行未能启动或完成。`,"mission.attentionStepFailed":`有一个步骤失败——请查看下方任务。`,"mission.attentionPaused":`任务已暂停——正在等待你的输入。`,"mission.showObjective":`显示完整目标`,"mission.showFullOutput":`查看完整输出`,"mission.stage":`阶段`,"mission.campaign":`持续任务`,"mission.totalElapsed":`总耗时`,"mission.round":`轮次`,"mission.mode":`模式`,"mission.summary":`本次完成`,"mission.deliveryCertified":`交付成果已通过审核`,"mission.taskCompleted":`任务已完成`,"mission.openResult":`打开成果`,"mission.viewTask":`查看任务`,"mission.taskPlan":`任务计划`,"mission.team":`团队`,"mission.waitingShort":`等待中`,"mission.roleWork":`角色工作`,"mission.showMore":`显示更多`,"mission.showLess":`收起`,"mission.done":`已完成`,"mission.inProgress":`进行中`,"mission.failed":`失败`,"mission.bannerPaused":`任务已暂停 — 等待你的操作。`,"mission.bannerError":`系统异常 — 健康状态已降级。`,"mission.bannerStepFailed":`某步骤失败:{step}`,"mission.elapsedAgo":`{elapsed} 前`,"mission.filteredBy":`按 {task} 筛选 · 清除`,"mission.allVisible":`全部可见任务`,"mission.roundNumber":`第 {count} 轮`,"mission.noRoleWork":`当前筛选下还没有持久化的 {role} 工作记录。`,"mission.researchDag":`任务路线`,"mission.active":`进行中`,"mission.noDag":`Planner 尚未向路线中添加任务。`,"mission.workingHypothesis":`当前假设 · 可随证据调整`,"mission.goalContribution":`对目标的作用`,"mission.temporaryRegressions":`预期的暂时取舍`,"mission.decisionRule":`何时调整、拆分或停止`,"mission.acceptance":`完成的标准`,"mission.nonGoals":`非目标`,"mission.capabilities":`能力`,"mission.capabilitiesUnlocked":`已解锁能力`,"mission.learnedCapability":`已学习能力`,"mission.learnedDuring":`在“{mission}”期间学习`,"mission.skillUnavailable":`当前快照中没有此 Skill 的内容。`,"mission.contentTruncated":`内容预览已截断`,"mission.knowledgeRetained":`已保留知识`,"mission.selfEvolution":`已保存的项目知识`,"mission.knowledgeSaved":`Argus 已保存这些能力和笔记,供本项目后续工作使用。`,"mission.noCapabilities":`尚未学习新能力。`,"mission.replay":`任务回放`,"mission.replayTimeline":`回放任务时间线`,"mission.roleFailed":`{role} 执行失败`,"mission.showingLatestEvent":`显示最近一条事件`,"mission.showingLastEvents":`显示最近 {count} 条事件`,"mission.waitingEvents":`等待结构化研究事件。`,"mission.startsAfter":`需等待前置任务 {count} 项`,"mission.hiddenTasks":`已隐藏前序任务 {count} 项 · 阻塞或失败 {failed} 项 · 已跳过 {skipped} 项`,"mission.projectFilesChanged":`项目文件有变更`,"mission.reviewInIde":`可打开 IDE 查看差异`,"research.currentWork":`当前工作`,"research.dagProgress":`任务路线进度`,"research.verifiedOutputs":`已验证输出`,"research.recentMilestones":`近期里程碑`,"research.liveProgress":`任务进展`,"research.artifact":`研究成果`,"research.canvas":`Manager 实时研究面板`,"research.previewArtifact":`预览成果`,"research.openLarge":`打开大尺寸预览`,"research.collapse":`收起预览`,"research.unavailable":`Manager 实时视图暂时不可用。`,"research.noPreview":`暂无预览`,"research.waiting":`等待中…`,"research.updating":`正在更新…`,"research.fileUnavailable":`文件已就绪,可点击上方下载按钮获取。`,"research.eventSourced":`基于事件的任务状态`,"research.downloadFailed":`下载失败`,"operations.title":`运行控制`,"operations.work":`工作`,"operations.runtime":`运行时`,"operations.system":`系统`,"operations.recovery":`恢复`,"operations.workInput":`工作输入`,"operations.workHint":`加入工作、指导当前任务、保存备注,或仅预览计划而不分派。`,"operations.action.task":`任务`,"operations.action.nudge":`指导`,"operations.action.note":`备注`,"operations.action.plan":`计划`,"operations.planPlaceholder":`要预览的目标;预览不会加入任务队列`,"operations.actionPlaceholder":`输入 {action} 内容`,"operations.previewPlan":`预览计划`,"operations.submitAction":`提交 {action}`,"operations.runtimeHint":`更改会话运行位置、重置 Manager 上下文,或安全重启会话。`,"operations.workdir":`工作目录`,"operations.workdirUpdated":`工作目录已更新。`,"operations.applyWorkdir":`应用工作目录`,"operations.replaceSlot":`替换活动会话`,"operations.sourceUpdate":`Argus 源码版本`,"operations.pullLatest":`拉取最新版本`,"operations.updateChecking":`正在检查已发布分支…`,"operations.updateRunning":`正在更新…`,"operations.updateAvailable":`有可用更新`,"operations.updateCurrent":`已是最新`,"operations.updateUnavailable":`当前工作树无法安全更新。`,"operations.currentRevision":`当前`,"operations.latestRevision":`最新`,"operations.updatePhase":`阶段`,"operations.updateRestart":`源码已更新。请重启工作台,再使用重载按钮让活动 daemon 在安全任务边界切换到新版本。`,"operations.skills":`Skills`,"operations.runSkill":`运行 Skill 命令`,"operations.metrics":`系统指标`,"operations.trash":`可恢复的回收站`,"operations.searchTrash":`搜索回收站`,"operations.trashEmpty":`回收站为空。`,"resource.title":`资源`,"resource.loading":`正在加载资源状态…`,"resource.devices":`设备:{count}`,"resource.inUse":`使用中 · {count}`,"resource.queue":`等待队列 · {count}`,"resource.none":`无`,"resource.timeLeft":`剩余 {ttl}`,"resource.noIntent":`未记录用途`,"resource.yieldRequest":`收到释放资源请求 · {reason}`,"resource.queuePosition":`队列第 {position} 位`,"label.status.inProgress":`进行中`,"label.status.waiting":`等待中`,"label.status.completed":`已完成`,"label.status.blocked":`暂时无法继续`,"label.status.failed":`失败`,"label.status.needsChanges":`需要修改`,"label.status.skipped":`已跳过`,"label.status.paused":`已暂停`,"label.status.cancelled":`已取消`,"label.status.available":`可用`,"label.status.unavailable":`不可用`,"label.status.inaccessible":`无法访问`,"label.status.limited":`部分受限`,"label.status.healthy":`状态正常`,"label.status.updated":`状态已更新`,"label.role.argus":`Argus`,"label.role.you":`你`,"label.work.task":`任务`,"label.work.action":`工作步骤`,"label.work.handoff":`给下一步的说明`,"label.work.review":`审核`,"label.work.planning":`规划`,"label.work.update":`动态`,"label.stage.scope":`范围定义`,"label.stage.research":`研究`,"label.stage.implementation":`方法实现`,"label.stage.experiment":`实验验证`,"label.stage.analysis":`结果分析`,"label.stage.writing":`论文写作`,"label.stage.review":`最终审核`,"label.stage.delivery":`成果交付`,"label.stage.unstaged":`未分阶段`,"label.frontier.reopened":`已重新开启一项前序任务`,"label.frontier.added":`已添加一项新任务`,"label.frontier.completed":`这部分工作已完成`,"label.frontier.revised":`已调整任务计划`,"label.frontier.narrowed":`已缩小任务范围`,"label.frontier.expanded":`已扩大任务范围`,"label.frontier.updated":`任务计划已更新`,"label.priority":`优先级 {priority}`,"label.outcome.workCompleted":`工作已完成`,"label.outcome.workPaused":`工作已暂停`,"label.outcome.workBlocked":`工作暂时无法继续`,"label.outcome.workFailed":`工作失败`,"label.outcome.workEnded":`工作已结束`,"label.outcome.workIncomplete":`工作尚未完成`,"label.outcome.workStalled":`工作停滞`,"label.outcome.workUpdated":`工作状态已更新`,"label.outcome.reviewPassed":`结果检查通过`,"label.outcome.reviewNeedsChanges":`检查后发现需要修改`,"label.outcome.reviewBlocked":`结果检查暂时无法继续`,"label.outcome.reviewOutdated":`审核结果已过期`,"label.outcome.reviewPending":`等待审核`,"label.outcome.stageApproved":`可以进入下一步`,"label.outcome.stageNotApproved":`还不能进入下一步`,"label.outcome.stageRevoked":`阶段批准已撤回`,"label.outcome.stageNotNeeded":`无需阶段审核`,"label.outcome.stagePending":`还没确定能否进入下一步`,"label.outcome.budgetPaused":`因预算上限暂停`,"label.outcome.costUnreconciled":`调用费用待对账(并非预算耗尽)`,"label.outcome.waitingForYou":`正在等待你的回复`,"label.outcome.stoppedByYou":`已由你停止`,"label.outcome.pausedByYou":`已由你暂停`,"label.outcome.sessionPaused":`会话已暂停`,"label.outcome.serviceUnavailable":`服务暂不可用`,"label.outcome.serviceCoolingDown":`服务暂时暂停`,"label.outcome.temporaryIssue":`因临时问题暂停`,"label.outcome.serviceError":`因服务错误停止`,"label.outcome.needsPlan":`需要制定新计划`,"label.outcome.canResume":`可以继续`,"label.routing.team":`团队协作`,"label.routing.individual":`单独执行`,"label.routing.research":`研究任务`,"label.routing.software":`软件工作`,"label.routing.staged":`分步执行`,"label.routing.flexible":`灵活流程`,"label.routing.ongoing":`持续进行`,"label.routing.defined":`范围明确`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`加速设备`,"label.resource.enforced":`强制执行限制`,"label.resource.advisory":`仅提供建议`,"label.resource.released":`已释放资源`,"label.resource.kept":`继续占用资源`,"mission.lastProgress":`停下之前记录的进展`,"mission.nextResume":`进度已保存,重新运行 Argus 就会从停下的地方继续。`,"mission.nextResumeLive":`Argus 会从已保存的进度继续。`,"research.totalTime":`累计用时`,"research.optionDelivery":`交付`,"research.optionCheckpoint":`检查点`,"research.optionPending":`生成中`,"operations.unavailableHere":`这项功能在当前的 Argus 上不提供。`,"operations.requestFailed":`这次操作没有成功。`,"operations.technicalDetails":`技术细节`,"verticals.title":`垂域商店`,"verticals.entry":`垂域商店`,"verticals.openStore":`打开垂域商店`,"verticals.paletteHint":`安装 · 启用 · 更新`,"verticals.intro":`垂域为 Argus 提供一个研究领域的阶段、角色、技能与检查项。按项目需要安装,并为各工作区分别启用。`,"verticals.hostedNote":`垂域由服务方提供;你可以为自己的工作区启用或停用。`,"verticals.close":`关闭垂域商店`,"verticals.search":`搜索垂域`,"verticals.searchPlaceholder":`按名称、用途或标签搜索…`,"verticals.refreshCatalog":`刷新目录`,"verticals.refreshing":`正在刷新…`,"verticals.catalogSource":`目录来源:{source}`,"verticals.catalogRelease":`版本 {tag}`,"verticals.catalogFetched":`{time} 获取`,"verticals.catalogNever":`尚未获取目录`,"verticals.catalogError":`目录刷新失败:{error}`,"verticals.kindFilter":`按类型筛选`,"verticals.tagFilter":`按标签筛选`,"verticals.clearFilters":`清除筛选`,"verticals.count":`显示 {shown} / {total}`,"verticals.filter.all":`全部`,"verticals.routingPath":`分类 / 领域 / 专项`,"verticals.filter.installed":`已安装`,"verticals.filter.available":`可安装`,"verticals.filter.builtin":`内置`,"verticals.kind.builtin":`内置`,"verticals.kind.package":`随包提供`,"verticals.kind.installed":`已安装`,"verticals.kind.available":`可安装`,"verticals.enabled":`已启用`,"verticals.disabledState":`已停用`,"verticals.updateAvailable":`有新版本`,"verticals.updateTo":`更新至 {version}`,"verticals.installedVersion":`已安装 {version}`,"verticals.catalogVersion":`目录版本 {version}`,"verticals.requires":`依赖`,"verticals.shared":`共享资源`,"verticals.size":`大小`,"verticals.jumpTo":`查看 {name}`,"verticals.missingPython":`缺少 Python 包:{packages}。请把它们安装到运行 Argus 的那个 Python 环境里。`,"verticals.runtimeIssues":`已安装版本与当前 Argus 运行时不兼容:{issues}`,"verticals.installIssues":`目录版本的安装/更新被运行时要求阻止:{issues}`,"verticals.usedByOne":`1 个项目在用`,"verticals.usedBy":`{count} 个项目在用`,"verticals.action.install":`安装`,"verticals.action.update":`更新`,"verticals.action.enable":`启用`,"verticals.action.disable":`停用`,"verticals.action.uninstall":`卸载`,"verticals.confirmUninstall":`确认卸载`,"verticals.confirmUninstallHint":`将从这台 Argus 移除 {name}。`,"verticals.removeAnyway":`仍要移除`,"verticals.operation.install":`正在安装…`,"verticals.operation.update":`正在更新…`,"verticals.operation.enable":`正在启用…`,"verticals.operation.disable":`正在停用…`,"verticals.operation.uninstall":`正在卸载…`,"verticals.operationRunning":`处理中…`,"verticals.operationFailed":`{action}失败`,"verticals.loading":`正在读取垂域…`,"verticals.noMatches":`没有符合筛选条件的垂域。`,"verticals.none":`目前还没有可用的垂域。`,"verticals.loadFailed":`无法读取垂域列表。`,"verticals.actionFailed":`这次操作没有成功。`,"verticals.tooOld":`当前的 Argus 后端还没有垂域商店。请先更新 Argus,再打开这里管理垂域。`};function wt(){try{let e=localStorage.getItem(xt);if(e===`en`||e===`zh-CN`)return e}catch{}return navigator.language.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}function Tt(e,t={},n=wt()){let r=(n===`zh-CN`?Ct[e]:St[e])??e;return Et.has(e)&&(r=r.replace(/\bArgus\b/g,yt().name)),r.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??`{${n}}`))}var Et=new Set([`handshake.connecting`,`handshake.title`,`splash.starting`,`connection.pairingTitle`,`topbar.pauseDaemon`,`topbar.runDaemon`,`chat.messageArgus`,`palette.messageArgus`,`palette.stopDaemon`,`palette.startDaemon`,`role.system`,`label.role.argus`]),Dt=(0,x.createContext)({locale:`en`,setLocale:()=>void 0,t:(e,t)=>Tt(e,t,`en`)});function O({children:e}){let[t,n]=(0,x.useState)(wt),r=e=>{try{localStorage.setItem(xt,e)}catch{}n(e)};(0,x.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,x.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Tt(e,n,t)}),[t]);return(0,D.jsx)(Dt.Provider,{value:i,children:e})}function Ot(){return(0,x.useContext)(Dt)}var kt=class extends x.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){if(!this.state.failed)return this.props.children;let e=this.props.locale===`zh-CN`;return(0,D.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-bg p-8 text-ink`,role:`alert`,children:(0,D.jsxs)(`section`,{className:`max-w-lg rounded-xl border border-line bg-panel p-8 shadow-lg`,children:[(0,D.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-widest text-blue`,children:yt().name}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:e?`工作台暂时无法显示`:`The workspace could not be displayed`}),(0,D.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`页面资源未能正确加载。后端任务不会因此被停止;你仍可使用桌面菜单查看日志或设置。重新加载会丢弃页面中尚未发送的输入。`:`A page resource failed to load. Backend work has not been stopped. Desktop menus remain available for logs and settings. Reloading discards unsent input on this page.`}),(0,D.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,D.jsx)(`button`,{type:`button`,className:`rounded-md bg-blue px-4 py-2 text-sm text-white`,onClick:()=>window.location.reload(),children:e?`重新加载工作台`:`Reload workspace`}),(0,D.jsx)(`button`,{type:`button`,className:`rounded-md border border-line px-4 py-2 text-sm`,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`view`,`activity`),window.location.assign(e.toString())},children:e?`返回对话页面`:`Return to conversation`})]})]})})}};function At(){let e=(0,x.useSyncExternalStore)(xe,be,()=>!1),{locale:t}=Ot();if(!e)return null;let n=t===`zh-CN`;return(0,D.jsxs)(`div`,{role:`status`,className:`fixed left-1/2 top-3 z-[110] flex w-[min(92vw,42rem)] -translate-x-1/2 items-center gap-3 rounded-xl border border-blue/40 bg-panel px-4 py-3 text-sm text-ink shadow-xl`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`strong`,{children:n?`页面已更新`:`Page update available`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:n?`刷新后显示最新选项和功能。请先复制未发送的内容。`:`Refresh for the latest options and features. Copy any unsent text first.`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`shrink-0 rounded-md border border-blue/40 px-3 py-2 text-xs text-blue`,children:n?`刷新页面`:`Refresh page`})]})}var k={ADVISOR_CONSULTATION_REQUESTED:`advisor.consultation.requested`,ADVISOR_CONSULTATION_COMPLETED:`advisor.consultation.completed`,ADVISOR_CONSULTATION_FAILED:`advisor.consultation.failed`,ADVISOR_CONSULTATION_CANCELLED:`advisor.consultation.cancelled`,ADVISOR_CONSULTATION_TIMED_OUT:`advisor.consultation.timed_out`,ADVISOR_CONSULTATION_MODEL_MISMATCH:`advisor.consultation.model_mismatch`,LIFE_MANAGER_SUPERVISION_ISSUED:`life.manager.supervision.issued`,LIFE_MANAGER_SUPERVISION_APPLIED:`life.manager.supervision.applied`,LIFE_MANAGER_SUPERVISION_FAILED:`life.manager.supervision.failed`,LIFE_PEER_MESSAGE_PROCESSED:`life.peer.message.processed`,LIFE_CONFIG_PARSE_FAILED:`life.config.parse_failed`,AGENT_IO_START:`agent.io.start`,AGENT_IO_STREAM:`agent.io.stream`,AGENT_IO_COMPLETE:`agent.io.complete`,AGENT_IO_ERROR:`agent.io.error`,USAGE_RECORDED:`usage.recorded`,ACCOUNTING_JOURNAL_REPAIRED:`accounting.journal_repaired`,PROVIDER_REQUEST_STARTED:`provider.request.started`,PROVIDER_REQUEST_COMPLETED:`provider.request.completed`,PROVIDER_REQUEST_DENIED:`provider.request.denied`,CODEX_UTIL_COMPLETED:`codex.util.completed`,SKILL_COST_COMPLETED:`skill.cost.completed`,BUDGET_RESERVATION_CREATED:`budget.reservation.created`,BUDGET_RESERVATION_DENIED:`budget.reservation.denied`,BUDGET_RESERVATION_SETTLED:`budget.reservation.settled`,BUDGET_RESERVATION_RELEASED:`budget.reservation.released`,BUDGET_UNPRICED_BLOCKED:`budget.unpriced.blocked`,BUDGET_UNPRICED_ACKNOWLEDGED:`budget.unpriced.acknowledged`,LOOP_START:`loop.start`,LOOP_DONE:`loop.done`,ROUND_START:`round.start`,ROUND_MAIN_COMPLETED:`round.main.completed`,ROUND_REVIEW_STARTED:`round.review.started`,ROUND_REVIEW_DEFERRED:`round.review.deferred`,ROUND_REVIEW_COMPLETED:`round.review.completed`,ROUND_CHECKPOINT_RECORDED:`round.checkpoint.recorded`,ROUND_CHECKPOINT_FAILED:`round.checkpoint.failed`,ROUND_SECRET_REDACTED:`round.secret_redacted`,ROUND_ESCALATED:`round.escalated`,ROUND_STALL:`round.stall`,ROUND_REVIEWER_BACKEND_FAILURE:`round.reviewer_backend_failure`,ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF:`round.reviewer_backend_failure.backoff`,ROUND_BACKEND_FAILURE_BACKOFF:`round.backend_failure.backoff`,ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED:`round.backend_failure.hold_interrupted`,ROUND_WATCHDOG_RETRY:`round.watchdog.retry`,ROUND_WATCHDOG_RETRY_EXHAUSTED:`round.watchdog.retry_exhausted`,ROUND_MODEL_CONFIGURATION_ERROR:`round.model_configuration_error`,ROUND_PROVIDER_TURN_CAP_RESTART:`round.provider_turn_cap.restart`,ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART:`round.provider_turn_cap.reviewer_restart`,ROUND_ORPHAN_PROCESS_GROUP:`round.orphan_process_group`,ROUND_EXTERNAL_WORK_WAIT_STARTED:`round.external_work_wait.started`,ROUND_EXTERNAL_WORK_WAIT_COMPLETED:`round.external_work_wait.completed`,ROUND_EXTERNAL_WORK_REVIEW_REQUIRED:`round.external_work_review.required`,ROUND_EXTERNAL_WORK_REVIEW_COMPLETED:`round.external_work_review.completed`,ROLE_SESSION_TURN:`role.session.turn`,ENGINEER_PROGRESS:`engineer.progress`,ENGINEER_SKILL_MAINTENANCE_COMPLETED:`engineer.skill_maintenance.completed`,LIFE_STATUS:`life.status`,LIFE_PHASE_STARTED:`life.phase.started`,LIFE_MISSION_STARTED:`life.mission.started`,LIFE_MISSION_COMPLETED:`life.mission.completed`,LIFE_MISSION_FAILED:`life.mission.failed`,LIFE_MISSION_SKIPPED:`life.mission.skipped`,LIFE_MISSION_ORPHANED:`life.mission.orphaned`,LIFE_MISSION_REQUEUED:`life.mission.requeued`,LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED:`life.mission.provider_configuration_disabled`,LIFE_ITERATION_CONTINUED:`life.iteration.continued`,LIFE_REVIEW_WAIVED:`life.review.waived`,LIFE_POST_MISSION_STOP:`life.post_mission.stop`,LIFE_EXECUTION_HOST_BLOCKED:`life.execution_host.blocked`,LIFE_AUTH_FAILURE:`life.auth_failure`,LIFE_SUPERVISOR_ERROR:`life.supervisor.error`,LIFE_LEARNED_VERTICAL_PROMOTED:`life.learned_vertical.promoted`,LIFE_LEARNED_VERTICAL_PROMOTION_FAILED:`life.learned_vertical.promotion_failed`,LIFE_MANAGER_INTENT_STARTED:`life.manager.intent.started`,LIFE_MANAGER_INTENT_COMPLETED:`life.manager.intent.completed`,LIFE_MANAGER_INTENT_FAILED:`life.manager.intent.failed`,LIFE_MANAGER_INTENT_SUPERSEDED:`life.manager.intent.superseded`,LIFE_MANAGER_GOAL_CONTRACT_FAILED:`life.manager.goal_contract.failed`,LIFE_MANAGER_STAGE_DECISION:`life.manager.stage_decision`,LIFE_MANAGER_PLAN_CHALLENGE_DECIDED:`life.manager.plan_challenge.decided`,LIFE_MANAGER_FEEDBACK_PERSISTED:`life.manager.feedback.persisted`,LIFE_MANAGER_FEEDBACK_UNRESOLVED:`life.manager.feedback.unresolved`,LIFE_MANAGER_FEEDBACK_EXHAUSTED:`life.manager.feedback.exhausted`,LIFE_MANAGER_PROJECT_REPORT:`life.manager.project_report`,LIFE_MANAGER_PROJECT_REPORT_FAILED:`life.manager.project_report.failed`,LIFE_VERTICAL_RESOLVED:`life.vertical.resolved`,LIFE_MANAGER_BACKEND_RESOLVED:`life.manager.backend_resolved`,LIFE_PLANNER_BACKEND_RESOLVED:`life.planner.backend_resolved`,LIFE_ENGINEER_BACKEND_RESOLVED:`life.engineer.backend_resolved`,LIFE_REVIEWER_BACKEND_RESOLVED:`life.reviewer.backend_resolved`,LIFE_CURATOR_BACKEND_RESOLVED:`life.curator.backend_resolved`,LIFE_PLANNER_START:`life.planner.start`,LIFE_PLANNER_PREVIEW_SKIPPED:`life.planner.preview_skipped`,LIFE_PLANNER_NORMALIZED:`life.planner.normalized`,LIFE_PLANNER_TASK_ADDED:`life.planner.task_added`,LIFE_PLANNER_TASK_SKIPPED:`life.planner.task_skipped`,LIFE_PLANNER_VERDICT:`life.planner.verdict`,LIFE_PLANNER_WAITING:`life.planner.waiting`,LIFE_PLANNER_WAITING_WOKEN:`life.planner.waiting_woken`,LIFE_PLANNER_TERMINAL_IDLE:`life.planner.terminal_idle`,LIFE_PLANNER_VERIFICATION_PROBE:`life.planner.verification_probe`,LIFE_PLANNER_STALL_ESCALATION:`life.planner.stall_escalation`,LIFE_PLANNER_DEPENDENCY_DROPPED:`life.planner.dependency_dropped`,LIFE_PLANNER_PARALLEL_DROPPED:`life.planner.parallel_dropped`,LIFE_PLANNER_ERROR:`life.planner.error`,LIFE_PLANNER_DEFERRED:`life.planner.deferred`,LIFE_PLANNER_SUPERSEDED:`life.planner.superseded`,LIFE_PLANNER_WAIT_OVERRIDDEN:`life.planner.wait_overridden`,LIFE_PLANNER_WAITING_CONTRACT_NORMALIZED:`life.planner.waiting_contract.normalized`,LIFE_PLANNER_EXTERNAL_POLL_SUPPRESSED:`life.planner.external_poll_suppressed`,LIFE_PLANNER_VERDICT_DISCARDED:`life.planner.verdict.discarded`,LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED:`life.planner.final_submission_skipped`,LIFE_PLANNER_CONTINUATION_REQUIRED:`life.planner.continuation_required`,LIFE_PLANNER_COMPLETION_REJECTED:`life.planner.completion_rejected`,LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED:`life.planner.completion_circuit_opened`,LIFE_PLANNER_COMPLETION_CIRCUIT_HOLDING:`life.planner.completion_circuit_holding`,LIFE_PLANNER_COMPLETION_CIRCUIT_NOTIFY_FAILED:`life.planner.completion_circuit.notify_failed`,PLAN_DRAFT_START:`plan.draft.start`,PLAN_DRAFT_DONE:`plan.draft.done`,PLAN_DRAFT_FAILED:`plan.draft.failed`,LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED:`life.runtime_failure.circuit_opened`,LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED:`life.runtime_failure.circuit_blocked`,LIFE_RUNTIME_FAILURE_CANARY_PASSED:`life.runtime_failure.canary_passed`,LIFE_RUNTIME_INCIDENT_DETECTED:`life.runtime.incident.detected`,LIFE_RUNTIME_INCIDENT_RECOVERED:`life.runtime.incident.recovered`,LIFE_RUNTIME_INCIDENT_ESCALATED:`life.runtime.incident.escalated`,LIFE_PLAN_REVISION_PROPOSED:`life.plan.revision.proposed`,LIFE_PLAN_REVISION_REJECTED:`life.plan.revision.rejected`,LIFE_PLAN_REVISION_COMMITTED:`life.plan.revision.committed`,LIFE_PLAN_NODE_SUPERSEDED:`life.plan.node.superseded`,LIFE_PLAN_REVISION_ROLLED_BACK:`life.plan.revision.rolled_back`,LIFE_RESEARCH_SECOND_READING:`life.research.second_reading`,LIFE_LETTER_WRITTEN:`life.letter.written`,LIFE_BUDGET_PAUSE:`life.budget.pause`,LIFE_LIFECYCLE_BLOCK:`life.lifecycle.block`,LIFE_LIFECYCLE_TRANSITION:`life.lifecycle.transition`,LIFE_INBOX_QUEUED:`life.inbox.queued`,LIFE_INBOX_DRAINED:`life.inbox.drained`,LIFE_OPERATOR_QUESTION_PENDING:`life.operator_question.pending`,LIFE_OPERATOR_QUESTION_ANSWERED:`life.operator_question.answered`,LIFE_DAEMON_IDLE_TIMEOUT:`life.daemon.idle_timeout`,LIFE_DAEMON_READY:`life.daemon.ready`,LIFE_DAEMON_DEGRADED:`life.daemon.degraded`,PROJECT_COMPLETED:`project.completed`,PROJECT_COMPLETION_REFUSED:`project.completion_refused`,DAEMON_PARKED:`daemon.parked`,DAEMON_COMMAND_SUBMITTED:`daemon.command.submitted`,DAEMON_COMMAND_COMPLETED:`daemon.command.completed`,DAEMON_COMMAND_REJECTED:`daemon.command.rejected`,IDEA_SEARCH_STARTED:`idea.search.started`,IDEA_SEARCH_COMPLETED:`idea.search.completed`,IDEA_SEARCH_SKIPPED:`idea.search.skipped`,IDEA_PORTFOLIO_FORMED:`idea.portfolio.formed`,IDEA_PORTFOLIO_NESTED_SKIPPED:`idea.portfolio.nested_skipped`,VENUE_RESEARCH_STARTED:`venue.research.started`,VENUE_RESEARCH_COMPLETED:`venue.research.completed`,RESEARCH_ACHIEVEMENT_CERTIFIED:`research.achievement.certified`,SKILL_LIBRARY_AVAILABLE:`skill.library.available`,SKILL_CREATED:`skill.created`,SKILL_UPDATED:`skill.updated`,SKILL_ARCHIVED:`skill.archived`,SKILL_TIDIED:`skill.tidied`,SKILL_HISTORY_COMPRESSED:`skill.history.compressed`,SKILL_EVOLUTION_COMPLETED:`skill.evolution.completed`,TEAM_LEARNING_REVIEW_STARTED:`team.learning.review.started`,TEAM_LEARNING_REVIEW_SKIPPED:`team.learning.review.skipped`,TEAM_LEARNING_REVIEW_COMPLETED:`team.learning.review.completed`,TEAM_LEARNING_REVIEW_FAILED:`team.learning.review.failed`,TEAM_LEARNING_PROMOTION_QUARANTINED:`team.learning.promotion.quarantined`,SELF_LEARNING_REVIEW_STARTED:`self.learning.review.started`,SELF_LEARNING_REVIEW_COMPLETED:`self.learning.review.completed`,SELF_LEARNING_REVIEW_FAILED:`self.learning.review.failed`,DOMAIN_PROMOTION:`domain.promotion`,WIKI_INITIALIZED:`wiki.initialized`,WIKI_HOOK_WARNING:`wiki.hook.warning`,WIKI_CREATED:`wiki.created`,WIKI_UPDATED:`wiki.updated`,WIKI_RETIRED:`wiki.retired`,WIKI_PROMOTION_PROMOTED:`wiki.promotion.promoted`,WIKI_PROMOTION_DEMOTED:`wiki.promotion.demoted`,WIKI_RETIRED_COMPRESSED:`wiki.retired.compressed`,WIKI_EVOLUTION_COMPLETED:`wiki.evolution.completed`,KNOWLEDGE_LEARNED:`knowledge.learned`,KNOWLEDGE_RECALLED:`knowledge.recalled`,OPERATOR_ALERT:`operator_alert`,MANAGER_LIVE_VIEW_UPDATED:`manager.live_view.updated`,MANAGER_LIVE_VIEW_REJECTED:`manager.live_view.rejected`,MANAGER_TURN_STARTED:`manager.turn.started`,MANAGER_TURN_CANCELLED:`manager.turn.cancelled`,USER_NOTE:`user.note`,UI_OPERATOR:`ui.operator`,UI_ARGUS:`ui.argus`},jt={"loop.started":k.LOOP_START,"loop.completed":k.LOOP_DONE,"round.started":k.ROUND_START,"mission.started":k.LIFE_MISSION_STARTED,"mission.completed":k.LIFE_MISSION_COMPLETED,"mission.error":k.LIFE_MISSION_FAILED};k.ADVISOR_CONSULTATION_COMPLETED,k.ADVISOR_CONSULTATION_FAILED,k.ADVISOR_CONSULTATION_CANCELLED,k.ADVISOR_CONSULTATION_TIMED_OUT,k.ADVISOR_CONSULTATION_MODEL_MISMATCH,k.LIFE_MANAGER_SUPERVISION_APPLIED,k.LIFE_MANAGER_SUPERVISION_FAILED,k.LIFE_PEER_MESSAGE_PROCESSED,k.LIFE_CONFIG_PARSE_FAILED,k.LIFE_MANAGER_BACKEND_RESOLVED,k.LIFE_PLANNER_BACKEND_RESOLVED,k.LIFE_ENGINEER_BACKEND_RESOLVED,k.LIFE_REVIEWER_BACKEND_RESOLVED,k.LIFE_CURATOR_BACKEND_RESOLVED,k.LOOP_START,k.LOOP_DONE,k.ROUND_START,k.ROUND_MAIN_COMPLETED,k.ROUND_REVIEW_DEFERRED,k.ROUND_REVIEW_COMPLETED,k.ROUND_CHECKPOINT_RECORDED,k.ROUND_CHECKPOINT_FAILED,k.ROUND_SECRET_REDACTED,k.ROUND_ESCALATED,k.ROUND_STALL,k.ROUND_REVIEWER_BACKEND_FAILURE,k.ENGINEER_SKILL_MAINTENANCE_COMPLETED,k.SKILL_LIBRARY_AVAILABLE,k.SKILL_CREATED,k.SKILL_UPDATED,k.SKILL_ARCHIVED,k.SKILL_TIDIED,k.SKILL_HISTORY_COMPRESSED,k.SKILL_EVOLUTION_COMPLETED,k.WIKI_INITIALIZED,k.WIKI_HOOK_WARNING,k.WIKI_CREATED,k.WIKI_UPDATED,k.WIKI_RETIRED,k.WIKI_PROMOTION_PROMOTED,k.WIKI_PROMOTION_DEMOTED,k.WIKI_RETIRED_COMPRESSED,k.WIKI_EVOLUTION_COMPLETED,k.KNOWLEDGE_LEARNED,k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MANAGER_INTENT_STARTED,k.LIFE_MANAGER_INTENT_COMPLETED,k.LIFE_MANAGER_INTENT_FAILED,k.LIFE_MANAGER_STAGE_DECISION,k.LIFE_MANAGER_PLAN_CHALLENGE_DECIDED,k.LIFE_VERTICAL_RESOLVED,k.LIFE_PLANNER_START,k.LIFE_PLANNER_PREVIEW_SKIPPED,k.LIFE_PLANNER_TASK_ADDED,k.LIFE_PLANNER_TASK_SKIPPED,k.LIFE_PLANNER_DEPENDENCY_DROPPED,k.LIFE_PLANNER_PARALLEL_DROPPED,k.LIFE_PLANNER_VERDICT,k.LIFE_PLANNER_WAITING,k.LIFE_PLANNER_WAITING_WOKEN,k.LIFE_PLANNER_TERMINAL_IDLE,k.LIFE_PLANNER_VERIFICATION_PROBE,k.LIFE_PLANNER_STALL_ESCALATION,k.LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED,k.LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED,k.LIFE_RUNTIME_FAILURE_CANARY_PASSED,k.LIFE_RUNTIME_INCIDENT_DETECTED,k.LIFE_RUNTIME_INCIDENT_RECOVERED,k.LIFE_RUNTIME_INCIDENT_ESCALATED,k.LIFE_PLAN_REVISION_PROPOSED,k.LIFE_PLAN_REVISION_REJECTED,k.LIFE_PLAN_REVISION_COMMITTED,k.LIFE_PLAN_NODE_SUPERSEDED,k.LIFE_RESEARCH_SECOND_READING,k.LIFE_LETTER_WRITTEN,k.LIFE_BUDGET_PAUSE,k.BUDGET_RESERVATION_DENIED,k.BUDGET_UNPRICED_BLOCKED,k.LIFE_LIFECYCLE_BLOCK,k.LIFE_LIFECYCLE_TRANSITION,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.LIFE_INBOX_QUEUED,k.LIFE_INBOX_DRAINED,k.LIFE_DAEMON_IDLE_TIMEOUT,k.PROJECT_COMPLETED,k.PROJECT_COMPLETION_REFUSED,k.DAEMON_PARKED,k.DAEMON_COMMAND_COMPLETED,k.DAEMON_COMMAND_REJECTED,k.IDEA_SEARCH_STARTED,k.IDEA_SEARCH_COMPLETED,k.IDEA_SEARCH_SKIPPED,k.VENUE_RESEARCH_STARTED,k.VENUE_RESEARCH_COMPLETED,k.RESEARCH_ACHIEVEMENT_CERTIFIED,k.LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED,k.LIFE_ITERATION_CONTINUED,k.LIFE_REVIEW_WAIVED,k.LIFE_POST_MISSION_STOP,k.LIFE_EXECUTION_HOST_BLOCKED,k.LIFE_AUTH_FAILURE,k.LIFE_SUPERVISOR_ERROR,k.LIFE_LEARNED_VERTICAL_PROMOTED,k.LIFE_LEARNED_VERTICAL_PROMOTION_FAILED,k.LIFE_MANAGER_INTENT_SUPERSEDED,k.LIFE_MANAGER_GOAL_CONTRACT_FAILED,k.LIFE_MANAGER_FEEDBACK_PERSISTED,k.LIFE_MANAGER_FEEDBACK_EXHAUSTED,k.LIFE_MANAGER_PROJECT_REPORT_FAILED,k.LIFE_PLANNER_DEFERRED,k.LIFE_PLANNER_SUPERSEDED,k.LIFE_PLANNER_WAIT_OVERRIDDEN,k.LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED,k.LIFE_PLANNER_CONTINUATION_REQUIRED,k.LIFE_PLANNER_COMPLETION_REJECTED,k.LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED,k.PLAN_DRAFT_DONE,k.PLAN_DRAFT_FAILED,k.LIFE_PLAN_REVISION_ROLLED_BACK,k.ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED,k.ROUND_WATCHDOG_RETRY,k.ROUND_WATCHDOG_RETRY_EXHAUSTED,k.ROUND_MODEL_CONFIGURATION_ERROR,k.ROUND_PROVIDER_TURN_CAP_RESTART,k.ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART,k.ROUND_ORPHAN_PROCESS_GROUP,k.ROUND_EXTERNAL_WORK_WAIT_STARTED,k.ROUND_EXTERNAL_WORK_WAIT_COMPLETED,k.ROUND_EXTERNAL_WORK_REVIEW_REQUIRED,k.ROUND_EXTERNAL_WORK_REVIEW_COMPLETED,k.LIFE_DAEMON_DEGRADED,k.IDEA_PORTFOLIO_FORMED,k.TEAM_LEARNING_REVIEW_STARTED,k.TEAM_LEARNING_REVIEW_COMPLETED,k.TEAM_LEARNING_REVIEW_FAILED,k.TEAM_LEARNING_PROMOTION_QUARANTINED,k.DOMAIN_PROMOTION,k.MANAGER_LIVE_VIEW_UPDATED,k.MANAGER_TURN_STARTED,k.MANAGER_TURN_CANCELLED,k.USER_NOTE,k.UI_OPERATOR,k.UI_ARGUS,k.OPERATOR_ALERT,k.AGENT_IO_START,k.AGENT_IO_COMPLETE,k.AGENT_IO_ERROR,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.USAGE_RECORDED;function Mt(e){let t=String(e??``).trim();return Object.hasOwn(jt,t)?jt[t]:t}function Nt(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Nt).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Nt(t[e])}`).join(`,`)}}`}function Pt(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function Ft(e){let t=e.event_id??e.id??e.seq??e._offset,n=String(e.type??`event`);return t!=null&&t!==``?`${n}-${String(t)}`:`${n}-${String(e.ts??e.time??``)}-${Pt(Nt(e))}`}function It(e){return e.type===k.ENGINEER_PROGRESS&&e.kind===`reasoning`}function Lt(e){if(e.type!==k.ENGINEER_PROGRESS||![`assistant_message`,`agent_message`,`message`].includes(String(e.kind??``)))return!1;let t=String(e.agent_layer??e.actor??``);return String(e.text??``).trimStart().startsWith(`{`)?t===`reviewer`||t===`planner`:!1}var Rt=/^(?:[-*+]\s*)?[`*_]*(?:ARGUS_)?(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS|ROLE_DECISION)[`*_]*\s*[:=]|^(?:final\s+)?decision\s*:\s*$/i;function zt(e){return String(e??``).split(/\r?\n/).filter(e=>!Rt.test(e.trim())).join(` +`).trim()}function Bt(e){let t=String(e.fragment_mode??``);return t===`append`||t===`snapshot`?t:e.replace===!0?`snapshot`:`auto`}function Vt(e,t){let n=Math.min(e.length,t.length);for(let r=n;r>=8;--r)if(e.endsWith(t.slice(0,r)))return r;return 0}function Ht(e,t,n=`auto`){let r=(e||``).trim(),i=(t||``).trim();if(!r)return i;if(!i)return r;if(n===`snapshot`)return i;if(r.includes(i))return r;if(n===`append`)return`${r}\n${i}`;if(i.includes(r))return i;let a=Vt(r,i);return a?`${r}${i.slice(a)}`:`${r}\n${i}`}var Ut=[`all`,`attention`,`milestones`,`messages`],Wt=new Set([k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MISSION_FAILED,k.LOOP_START,k.LOOP_DONE,k.LIFE_PLANNER_VERDICT,k.LIFE_BUDGET_PAUSE,k.LIFE_LIFECYCLE_BLOCK]);function Gt(e,t,n=`all`,r=``){let i=Mt(e.canonical_type??e.type),a=String(e.kind??``);if(n===`attention`&&![`warn`,`err`].includes(String(t.tone??``))&&e.operator_alert!==!0||n===`milestones`&&!(t.rule&&!i.startsWith(`ui.`))&&!Wt.has(i)||n===`messages`&&t.tone!==`bright`&&![`assistant_message`,`agent_message`,`message`].includes(a)&&![`ui.operator`,`ui.argus`].includes(i))return!1;let o=r.trim().toLocaleLowerCase();return!o||[i,a,t.role,t.label,t.text,e.title,e.objective,e.text,e.summary,e.reason,e.error,e.status,e.action_summary,e.command,e.path,Array.isArray(e.tags)?e.tags.join(` `):e.tags].some(e=>String(e??``).toLocaleLowerCase().includes(o))}function Kt(e,t,n){e.setQueryData([`snapshot`,t],e=>e&&{...e,session:{...e.session,display_name:n}}),e.setQueryData([`projects`],e=>e&&{...e,projects:e.projects.map(e=>e.id===t?{...e,display_name:n,label:n||e.objective||e.id}:e)})}var qt=15e3,Jt=5e3,Yt=8e3,Xt=2e3,Zt=1e4;function A(e,t){return!Ke(t)&&!(t instanceof Ce)&&e<1}function Qt(e){return!Ke(e)&&Jt}function $t(e){return e?.projects.some(e=>e.daemon_alive)?Xt:qt}function en(e){return e?.daemon.alive||e?.manager_requests?.some(e=>e.status===`running`)?Xt:Yt}var tn=()=>s({queryKey:[`projects`],queryFn:E.projectIndex,refetchInterval:e=>$t(e.state.data)}),nn=()=>s({queryKey:[`project-costs`],queryFn:({signal:e})=>E.projectCosts(e),retry:A,refetchInterval:e=>Qt(e.state.error),refetchIntervalInBackground:!1}),rn=e=>s({queryKey:[`snapshot`,e],queryFn:({signal:t})=>E.activeSnapshot(e,t),enabled:!!e,refetchInterval:e=>en(e.state.data)}),an=(e,t=30,n=!0)=>s({queryKey:[`journal`,e,t],queryFn:({signal:n})=>E.journal(e,t,n),enabled:!!e&&n,refetchInterval:n?8e3:!1}),on=(e,t)=>s({queryKey:[`doctor`,e],queryFn:({signal:t})=>E.doctor(e,t),enabled:!!e&&t}),sn=(e,t)=>s({queryKey:[`config`,e],queryFn:({signal:t})=>E.config(e,t),enabled:!!e&&t}),cn=(e,t)=>s({queryKey:[`identity`,e],queryFn:({signal:t})=>E.identity(e,t),enabled:!!e&&t}),ln=(e,t,n=30)=>s({queryKey:[`transcript`,e,n],queryFn:({signal:t})=>E.transcript(e,n,t),enabled:!!e&&t}),un=(e,t=!0)=>s({queryKey:[`artifacts`,e],queryFn:({signal:t})=>E.artifacts(e,t),enabled:!!e&&t,refetchInterval:t?Zt:!1}),dn=(e,t,n=null)=>s({queryKey:[`artifact`,e,t,n],queryFn:({signal:n})=>E.artifact(e,t,n),enabled:!!e&&!!t,refetchInterval:e=>t&&/(?:^|[\\/])REVIEW\.md$/i.test(t)&&!Ke(e.state.error)?2e3:!1}),fn=(e,t)=>s({queryKey:[`backlog-item`,e,t],queryFn:({signal:n})=>E.backlogItem(e,t,n),enabled:!!e&&!!t});function pn(e,t){let n=c(),r=e=>{n.invalidateQueries({queryKey:[`snapshot`,e]}),n.invalidateQueries({queryKey:[`status`,e]}),n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`backlog-item`,e]})},i=()=>r(e);return{addTask:h({mutationFn:t=>E.addTask(e,t),onSuccess:i}),nudge:h({mutationFn:t=>E.nudge(e,t)}),note:h({mutationFn:t=>E.note(e,t)}),startDaemon:h({mutationFn:()=>E.startDaemon(e,t),onSuccess:i}),stopDaemon:h({mutationFn:n=>E.stopDaemon(e,n,t),onSuccess:i}),forceStopDaemon:h({mutationFn:()=>E.stopDaemon(e,!1,t,!0),onSuccess:i}),updateProject:h({mutationFn:e=>E.updateProject(e.sid,e.name),onSuccess:e=>{Kt(n,e.sid,e.name),r(e.sid)}}),deleteProject:h({mutationFn:()=>E.deleteProject(e),onSuccess:async()=>{let t=e;if(t){let e=e=>e.queryKey.some(e=>e===t);await n.cancelQueries({predicate:e}),n.removeQueries({predicate:e})}await n.invalidateQueries({queryKey:[`projects`]})}}),disposeBacklog:h({mutationFn:t=>E.disposeBacklog(e,t.id,t.op),onSuccess:i}),stopBacklog:h({mutationFn:t=>E.stopBacklog(e,t),onSuccess:i}),setContinuous:h({mutationFn:t=>E.setContinuous(e,t.enabled,t.objective??``),onSuccess:i})}}var mn=2e3;function hn(e,t){if(t.kind===`reset`)return{sid:t.sid,events:[],seen:new Set};if(t.sid!==e.sid)return e;if(t.kind===`seed`){let n=new Set,r=[];[...t.events,...e.events].forEach(e=>{let t=Ft(e);n.has(t)||(n.add(t),r.push(e))});let i=r.slice(-2e3);return{sid:e.sid,events:i,seen:new Set(i.map(e=>Ft(e)))}}let n=t.kind===`push`?[t.ev]:t.events,r=null,i=null;for(let t of n){let n=i??e.seen,a=Ft(t);n.has(a)||((!r||!i)&&(r=[...e.events],i=new Set(e.seen)),i.add(a),r.push(t))}return!r||!i?e:(r.length>mn&&r.splice(0,r.length-mn).forEach(e=>i.delete(Ft(e))),{sid:e.sid,events:r,seen:i})}var gn=new Set([`manager.live_view.updated`,`round.review.completed`,`life.mission.completed`]);function _n(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=String(n.type??``);if(gn.has(r)||r===`engineer.progress`&&n.kind===`file_change`)return Ft(n)}return``}var vn=new Set([`life.operator_question.pending`,`life.operator_question.answered`,`life.planner.task_added`,`life.planner.verdict`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`round.review.completed`]);function yn(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(vn.has(String(n.type??``)))return Ft(n)}return``}function bn(e,t=0){let[n,r]=(0,x.useState)(()=>typeof navigator>`u`||navigator.onLine!==!1);(0,x.useEffect)(()=>{let e=()=>r(navigator.onLine!==!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),e(),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]);let[i,a]=(0,x.useReducer)(hn,{sid:null,events:[],seen:new Set}),[o,s]=(0,x.useState)({sid:null,connected:!1}),c=(0,x.useRef)(e);return c.current=e,(0,x.useEffect)(()=>{if(a({kind:`reset`,sid:e}),s({sid:e,connected:!1}),!e)return;let t=!1,n=new AbortController,r=[],i,o=()=>{if(i=void 0,t||c.current!==e||r.length===0){r=[];return}let n=r;r=[],a({kind:`push-many`,sid:e,events:n})};E.events(e,120,n.signal).then(n=>{!t&&c.current===e&&a({kind:`seed`,sid:e,events:n})}).catch(()=>{});let l=ht(e,n=>{!t&&c.current===e&&(r.push(n),i===void 0&&(i=window.setTimeout(o,40)))},{replay:40,onOpen:()=>{!t&&c.current===e&&s({sid:e,connected:!0})},onClose:()=>{!t&&c.current===e&&s({sid:e,connected:!1})}});return()=>{t=!0,n.abort(),i!==void 0&&window.clearTimeout(i),r=[],l()}},[e,t]),{events:i.sid===e?i.events:[],connected:n&&o.sid===e&&o.connected}}function xn(e,t,n){let r=!1;e.addEventListener(`vite:preloadError`,e=>{let i=e.payload,a=i instanceof Error?i.message:String(i??``);if(!/\/(?:pdf[.-]|pdfjs)[^/\s]*\.(?:m?js)(?:[?#\s]|$)/i.test(a)&&/failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed|loading chunk .+ failed|unable to preload css/i.test(a)){if(r){e.preventDefault();return}try{let e=n.storage(),t=`argus.stale-chunk-reloaded`;if(e.getItem(t)===n.buildId)return;e.setItem(t,n.buildId)}catch{return}e.preventDefault(),r=!0,t()}})}var Sn=`modulepreload`,Cn=function(e,t){return new URL(e,t).href},wn={},Tn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Cn(t,n),t=s(t),t in wn)return;wn[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Sn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},En=window.location.pathname===`/admin/data`||window.location.pathname.startsWith(`/admin/data/`),Dn=(0,x.lazy)(()=>Tn(()=>import(`./App-ButSXpk-.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)),On=(0,x.lazy)(()=>Tn(()=>import(`./WorkflowWorkbench-ALJfwXlc.js`),__vite__mapDeps([10,1,2,3,7,8]),import.meta.url)),kn=(0,x.lazy)(()=>Tn(()=>import(`./AdminDataApp-g0GVVQx7.js`),__vite__mapDeps([11,1,2,3,6,4,5,12,13,14,8,15]),import.meta.url));xn(window,()=>window.location.reload(),{buildId:_e,storage:()=>window.sessionStorage}),En||Re();var An=window.parent!==window;document.documentElement.dataset.argusEmbedded=String(An);var jn=new ue({defaultOptions:{queries:{staleTime:3e3,retry:A,refetchOnWindowFocus:!1}}});function Mn(){let e=s({queryKey:[`api-meta`],queryFn:E.meta}),{locale:t}=Ot();return e.error?(0,D.jsxs)(`div`,{role:`alert`,className:`p-8`,children:[e.error.message,(0,D.jsx)(`button`,{className:`ml-4 underline`,onClick:()=>void e.refetch(),children:t===`zh-CN`?`重新连接`:`Reconnect`})]}):e.data?e.data.capabilities.includes(`application.workflows.v1`)&&new URLSearchParams(window.location.search).get(`legacy`)!==`1`?(0,D.jsx)(On,{}):(0,D.jsx)(Dn,{}):(0,D.jsx)(`div`,{className:`p-8`,children:t===`zh-CN`?`正在连接…`:`Connecting…`})}function Nn(){let{locale:e}=Ot();return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(At,{}),(0,D.jsx)(kt,{locale:e,children:(0,D.jsx)(x.Suspense,{fallback:(0,D.jsx)(`div`,{className:`grid min-h-screen place-items-center text-sm text-ink-faint`,children:e===`zh-CN`?`正在加载工作台…`:`Loading workbench…`}),children:En?(0,D.jsx)(kn,{}):(0,D.jsx)(Mn,{})})})]})}(En?Promise.resolve():bt()).then(()=>de.createRoot(document.getElementById(`root`)).render((0,D.jsx)(x.StrictMode,{children:(0,D.jsx)(_,{client:jn,children:(0,D.jsx)(O,{children:(0,D.jsx)(Nn,{})})})}))).catch(e=>{let t=document.getElementById(`root`);t.setAttribute(`role`,`alert`),t.textContent=`Cannot open workbench: ${e instanceof Error?e.message:String(e)}`});export{Ge as A,tt as B,Ht as C,Tt as D,Mt as E,Ve as F,fe as G,Qe as H,st as I,he as K,Ke as L,Fe as M,E as N,Ot as O,Be as P,qe as R,Lt as S,k as T,S as U,Ye as V,ge as W,Ut as _,un as a,Bt as b,on as c,an as d,pn as f,ln as g,rn as h,dn as i,We as j,yt as k,bn as l,tn as m,_n as n,fn as o,nn as p,ae as q,yn as r,sn as s,Tn as t,cn as u,Ft as v,zt as w,It as x,Gt as y,nt as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/index-DPfzOfKU.js b/frontend/web/dist/assets/index-DPfzOfKU.js new file mode 100644 index 000000000..0c311b82a --- /dev/null +++ b/frontend/web/dist/assets/index-DPfzOfKU.js @@ -0,0 +1,13 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-q-3YCWKy.js","./rolldown-runtime-hePW80VL.js","./icons-DHjcpj5P.js","./query-dCPZk0Xc.js","./markdown-BGG43fCg.js","./markdown-DvoRHisr.css","./AppearanceControls-Bc1ibrT3.js","./format-D4uyBiG8.js","./useWorkbenchTheme-BqK4B8rm.js","./App-DCNDn7WF.css","./WorkflowWorkbench-COIoFnqD.js","./AdminDataApp-C6QkHG3T.js","./activity-BEiyr9-4.js","./history-B00Gliyq.js","./code-xml-DnBfjec4.js","./AdminDataApp--AL95rdz.css"])))=>i.map(i=>d[i]); +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,v as r}from"./icons-DHjcpj5P.js";import{C as i,S as a,_ as o,a as s,c,d as l,f as u,g as d,h as f,l as p,m,n as h,p as g,s as _,u as v,v as y,w as ee,x as te,y as b}from"./query-dCPZk0Xc.js";import"./markdown-BGG43fCg.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ne=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,x(te);else{var t=n(l);t!==null&&de(ee,t.startTime-e)}}}function te(t,i){m=!1,h&&(h=!1,_(re),re=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!oe());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&de(ee,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var b=!1,ne=null,re=-1,ie=5,ae=-1;function oe(){return!(e.unstable_now()-aee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(re),re=-1):h=!0,de(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x(te))),r},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=t(((e,t)=>{t.exports=ne()})),ie=t((e=>{var t=r(),n=re();function i(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),u=Object.prototype.hasOwnProperty,d=/^[: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]*$/,f={},p={};function m(e){return u.call(p,e)?!0:u.call(f,e)?!1:d.test(e)?p[e]=!0:(f[e]=!0,!1)}function h(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?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(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){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function ee(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function te(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ve(e):``}function xe(e){switch(e.tag){case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 2:case 15:return e=be(e.type,!1),e;case 11:return e=be(e.type.render,!1),e;case 1:return e=be(e.type,!0),e;default:return``}}function Se(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 ae:return`Fragment`;case ie:return`Portal`;case se:return`Profiler`;case oe:return`StrictMode`;case x:return`Suspense`;case de:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case le:return(e.displayName||`Context`)+`.Consumer`;case ce:return(e._context.displayName||`Context`)+`.Provider`;case ue:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case fe:return t=e.displayName||null,t===null?Se(e.type)||`Memo`:t;case pe:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}function Ce(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`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return Se(t);case 8:return t===oe?`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 we(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ee(e){var t=Te(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function De(e){e._valueTracker||=Ee(e)}function Oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Te(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ke(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ae(e,t){var n=t.checked;return S({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function je(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=we(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Me(e,t){t=t.checked,t!=null&&te(e,`checked`,t,!1)}function Ne(e,t){Me(e,t);var n=we(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`)?Fe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Fe(e,t.type,we(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pe(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 Fe(e,t,n){(t!==`number`||ke(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ie=Array.isArray;function Le(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=We.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qe={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},Je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(qe).forEach(function(e){Je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),qe[t]=qe[e]})});function Ye(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||qe.hasOwnProperty(e)&&qe[e]?(``+t).trim():t+`px`}function Xe(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ye(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var C=S({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 Ze(e,t){if(t){if(C[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(i(62))}}function w(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 Qe=null;function $e(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var et=null,tt=null,T=null;function nt(e){if(e=Xi(e)){if(typeof et!=`function`)throw Error(i(280));var t=e.stateNode;t&&(t=Qi(t),et(e.stateNode,e.type,t))}}function rt(e){tt?T?T.push(e):T=[e]:tt=e}function it(){if(tt){var e=tt,t=T;if(T=tt=null,nt(e),t)for(e=0;e>>=0,e===0?32:31-(It(e)/Lt|0)|0}var zt=64,Bt=4194304;function Vt(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 Ht(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Vt(a))):r=Vt(s)}else o=n&~i,o===0?a!==0&&(r=Vt(a)):r=Vt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))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 Jt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-A(t),e[t]=n}function Yt(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=ur),pr=` `,mr=!1;function hr(e,t){switch(e){case`keyup`:return cr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function gr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var _r=!1;function vr(e,t){switch(e){case`compositionend`:return gr(t);case`keypress`:return t.which===32?(mr=!0,pr):null;case`textInput`:return e=t.data,e===pr&&mr?null:e;default:return null}}function yr(e,t){if(_r)return e===`compositionend`||!lr&&hr(e,t)?(e=Nn(),Mn=jn=An=null,_r=!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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Vr(n)}}function Ur(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ur(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wr(){for(var e=window,t=ke();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ke(e.document)}return t}function Gr(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 Kr(e){var t=Wr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ur(n.ownerDocument.documentElement,n)){if(r!==null&&Gr(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 i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Hr(n,a);var o=Hr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Jr=null,Yr=null,Xr=null,Zr=!1;function Qr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Zr||Jr==null||Jr!==ke(r)||(r=Jr,`selectionStart`in r&&Gr(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}),Xr&&Br(Xr,r)||(Xr=r,r=Ci(Yr,`onSelect`),0ea||(e.current=$i[ea],$i[ea]=null,ea--)}function P(e,t){ea++,$i[ea]=e.current,e.current=t}var na={},F=ta(na),ra=ta(!1),ia=na;function aa(e,t){var n=e.type.contextTypes;if(!n)return na;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function oa(e){return e=e.childContextTypes,e!=null}function sa(){N(ra),N(F)}function ca(e,t,n){if(F.current!==na)throw Error(i(168));P(F,t),P(ra,n)}function la(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!=`function`)return n;for(var a in r=r.getChildContext(),r)if(!(a in t))throw Error(i(108,Ce(e)||`Unknown`,a));return S({},n,r)}function ua(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||na,ia=F.current,P(F,e),P(ra,ra.current),!0}function da(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=la(e,t,ia),r.__reactInternalMemoizedMergedChildContext=e,N(ra),N(F),P(F,e)):N(ra),P(ra,n)}var fa=null,pa=!1,ma=!1;function ha(e){fa===null?fa=[e]:fa.push(e)}function ga(e){pa=!0,ha(e)}function _a(){if(!ma&&fa!==null){ma=!0;var e=0,t=j;try{var n=fa;for(j=1;e>=o,i-=o,Ta=1<<32-A(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),I&&Da(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),I&&Da(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return I&&Da(a,g),u}for(h=r(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),I&&Da(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===ae&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case ne:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===ae){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===pe&&Ka(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Wa(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===ae?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Wa(e,r,i),o.return=e,e=o)}return s(e);case ie:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case pe:return l=i._init,_(e,r,l(i._payload),o)}if(Ie(i))return h(e,r,i,o);if(ge(i))return g(e,r,i,o);Ga(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ja=qa(!0),Ya=qa(!1),Xa=ta(null),Za=null,Qa=null,$a=null;function eo(){$a=Qa=Za=null}function to(e){var t=Xa.current;N(Xa),e._currentValue=t}function no(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ro(e,t){Za=e,$a=Qa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Hs=!0),e.firstContext=null)}function io(e){var t=e._currentValue;if($a!==e){if(e={context:e,memoizedValue:t,next:null},Qa===null){if(Za===null)throw Error(i(308));Qa=e,Za.dependencies={lanes:0,firstContext:e}}else Qa=Qa.next=e}return t}var ao=null;function oo(e){ao===null?ao=[e]:ao.push(e)}function so(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,oo(t)):(n.next=i.next,i.next=n),t.interleaved=n,co(e,r)}function co(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 lo=!1;function uo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fo(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 po(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,co(e,n)}return i=r.interleaved,i===null?(t.next=t,oo(r)):(t.next=i.next,i.next=t),r.interleaved=t,co(e,n)}function ho(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xt(e,n)}}function go(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 _o(e,t,n,r){var i=e.updateQueue;lo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=S({},d,f);break a;case 2:lo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Xc|=o,e.lanes=o,e.memoizedState=d}}function vo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Mo.transition;Mo.transition={};try{e(!1),t()}finally{j=n,Mo.transition=r}}function hs(){return Ho().memoizedState}function gs(e,t,n){var r=ml(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vs(e))ys(t,n);else if(n=so(e,t,n,r),n!==null){var i=Q();hl(n,e,r,i),bs(n,t,r)}}function _s(e,t,n){var r=ml(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vs(e))ys(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,zr(s,o)){var c=t.interleaved;c===null?(i.next=i,oo(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=so(e,t,i,r),n!==null&&(i=Q(),hl(n,e,r,i),bs(n,t,r))}}function vs(e){var t=e.alternate;return e===R||t!==null&&t===R}function ys(e,t){Fo=Po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xt(e,n)}}var xs={readContext:io,useCallback:V,useContext:V,useEffect:V,useImperativeHandle:V,useInsertionEffect:V,useLayoutEffect:V,useMemo:V,useReducer:V,useRef:V,useState:V,useDebugValue:V,useDeferredValue:V,useTransition:V,useMutableSource:V,useSyncExternalStore:V,useId:V,unstable_isNewReconciler:!1},Ss={readContext:io,useCallback:function(e,t){return Vo().memoizedState=[e,t===void 0?null:t],e},useContext:io,useEffect:is,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),ns(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){return ns(4,2,e,t)},useMemo:function(e,t){var n=Vo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vo();return t=n===void 0?t:n(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=gs.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=Vo();return e={current:e},t.memoizedState=e},useState:$o,useDebugValue:us,useDeferredValue:function(e){return Vo().memoizedState=e},useTransition:function(){var e=$o(!1),t=e[0];return e=ms.bind(null,e[1]),Vo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=R,a=Vo();if(I){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),J===null)throw Error(i(349));No&30||Jo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Xo.bind(null,r,o,e),[e]),r.flags|=2048,es(9,Yo.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Vo(),t=J.identifierPrefix;if(I){var n=Ea,r=Ta;n=(r&~(1<<32-A(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Io++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof r.is==`string`?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),n===`select`&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Ui]=t,e[Wi]=r,dc(e,t,!1,!1),t.stateNode=e;a:{switch(c=w(n,r),n){case`dialog`:M(`cancel`,e),M(`close`,e),a=r;break;case`iframe`:case`object`:case`embed`:M(`load`,e),a=r;break;case`video`:case`audio`:for(a=0;anl&&(t.flags|=128,r=!0,mc(s,!1),t.lanes=4194304)}}else{if(!r){if(e=Oo(c),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!I)return U(t),null}else 2*O()-s.renderingStartTime>nl&&n!==1073741824&&(t.flags|=128,r=!0,mc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(U(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=O(),t.sibling=null,n=L.current,P(L,r?n&1|2:n&1),t);case 22:case 23:return Tl(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?qc&1073741824&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function gc(e,t){switch(Aa(t),t.tag){case 1:return oa(t.type)&&sa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return To(),N(ra),N(F),Ao(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Do(t),null;case 13:if(N(L),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return N(L),null;case 4:return To(),null;case 10:return to(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var _c=!1,W=!1,vc=typeof WeakSet==`function`?WeakSet:Set,G=null;function yc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function bc(e,t,n){try{n()}catch(n){$(e,t,n)}}var xc=!1;function Sc(e,t){if(ji=Cn,e=Wr(),Gr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Mi={focusedElem:e,selectionRange:n},Cn=!1,G=t;G!==null;)if(t=G,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ts(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return h=xc,xc=!1,h}function Cc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&bc(t,n,a)}i=i.next}while(i!==r)}}function wc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,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 Tc(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 Ec(e){var t=e.alternate;t!==null&&(e.alternate=null,Ec(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ui],delete t[Wi],delete t[Ki],delete t[qi],delete t[Ji])),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 Dc(e){return e.tag===5||e.tag===3||e.tag===4}function Oc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Dc(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 a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function kc(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=Ai));else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}function Ac(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(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}var K=null,jc=!1;function Mc(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount==`function`)try{Pt.onCommitFiberUnmount(Nt,n)}catch{}switch(n.tag){case 5:W||yc(n,t);case 6:var r=K,i=jc;K=null,Mc(e,t,n),K=r,jc=i,K!==null&&(jc?(e=K,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):K.removeChild(n.stateNode));break;case 18:K!==null&&(jc?(e=K,n=n.stateNode,e.nodeType===8?zi(e.parentNode,n):e.nodeType===1&&zi(e,n),xn(e)):zi(K,n.stateNode));break;case 4:r=K,i=jc,K=n.stateNode.containerInfo,jc=!0,Mc(e,t,n),K=r,jc=i;break;case 0:case 11:case 14:case 15:if(!W&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&bc(n,t,o),i=i.next}while(i!==r)}Mc(e,t,n);break;case 1:if(!W&&(yc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Mc(e,t,n);break;case 21:Mc(e,t,n);break;case 22:n.mode&1?(W=(r=W)||n.memoizedState!==null,Mc(e,t,n),W=r):Mc(e,t,n);break;default:Mc(e,t,n)}}function Pc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Fc(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=s),r&=~o}if(r=a,r=O()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Uc(r/1960))-r,10e?16:e,cl===null)var r=!1;else{if(e=cl,cl=null,ll=0,q&6)throw Error(i(331));var a=q;for(q|=4,G=e.current;G!==null;){var o=G,s=o.child;if(G.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lO()-tl?El(e,0):Qc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Bt,Bt<<=1,!(Bt&130023424)&&(Bt=4194304)):t=1);var n=Q();e=co(e,t),e!==null&&(Jt(e,t,n),gl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||ra.current)Hs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Hs=!1,uc(e,t,n);Hs=!!(e.flags&131072)}}else Hs=!1,I&&t.flags&1048576&&Oa(t,xa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;cc(e,t),e=t.pendingProps;var a=aa(t,F.current);ro(t,n),a=zo(null,t,r,e,a,n);var o=Bo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,oa(r)?(o=!0,ua(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,uo(t),a.updater=Ds,t.stateNode=a,a._reactInternals=t,js(t,r,e,n),t=Xs(null,t,r,!0,o,n)):(t.tag=0,I&&o&&ka(t),H(null,t,a,n),t=t.child),t;case 16:r=t.elementType;a:{switch(cc(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Jl(r),e=Ts(r,e),a){case 0:t=Js(null,t,r,e,n);break a;case 1:t=Ys(null,t,r,e,n);break a;case 11:t=Us(null,t,r,e,n);break a;case 14:t=Ws(null,t,r,Ts(r.type,e),n);break a}throw Error(i(306,r,``))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),Js(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),Ys(e,t,r,a,n);case 3:a:{if(Zs(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,a=o.element,fo(e,t),_o(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ms(Error(i(423)),t),t=Qs(e,t,r,n,a);break a}if(r!==a){a=Ms(Error(i(424)),t),t=Qs(e,t,r,n,a);break a}for(Ma=Bi(t.stateNode.containerInfo.firstChild),ja=t,I=!0,Na=null,n=Ya(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Va(),r===a){t=lc(e,t,n);break a}H(e,t,r,n)}t=t.child}return t;case 5:return Eo(t),e===null&&La(t),r=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Ni(r,a)?s=null:o!==null&&Ni(r,o)&&(t.flags|=32),qs(e,t),H(e,t,s,n),t.child;case 6:return e===null&&La(t),null;case 13:return tc(e,t,n);case 4:return wo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ja(t,null,r,n):H(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),Us(e,t,r,a,n);case 7:return H(e,t,t.pendingProps,n),t.child;case 8:return H(e,t,t.pendingProps.children,n),t.child;case 12:return H(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,P(Xa,r._currentValue),r._currentValue=s,o!==null){if(zr(o.value,s)){if(o.children===a.children&&!ra.current){t=lc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=po(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),no(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(i(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),no(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}H(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,ro(t,n),a=io(a),r=r(a),t.flags|=1,H(e,t,r,n),t.child;case 14:return r=t.type,a=Ts(r,t.pendingProps),a=Ts(r.type,a),Ws(e,t,r,a,n);case 15:return Gs(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),cc(e,t),t.tag=1,oa(r)?(e=!0,ua(t)):e=!1,ro(t,n),ks(t,r,a),js(t,r,a,n),Xs(null,t,r,!0,e,n);case 19:return sc(e,t,n);case 22:return Ks(e,t,n)}throw Error(i(156,t.tag))};function Wl(e,t){return wt(e,t)}function Gl(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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===fe)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(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 Xl(e,t,n,r,a,o){var s=2;if(r=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ae:return Zl(n.children,a,o,t);case oe:s=8,a|=8;break;case se:return e=Kl(12,n,t,a|2),e.elementType=se,e.lanes=o,e;case x:return e=Kl(13,n,t,a),e.elementType=x,e.lanes=o,e;case de:return e=Kl(19,n,t,a),e.elementType=de,e.lanes=o,e;case me:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ce:s=10;break a;case le:s=9;break a;case ue:s=11;break a;case fe:s=14;break a;case pe:s=16,r=null;break a}throw Error(i(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){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=qt(0),this.expirationTimes=qt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},uo(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ie()})),oe=t((e=>{var t=ae();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),se=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new p({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ce(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){u.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>d(t,e))}findAll(e={}){return this.getAll().filter(t=>d(e,t))}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return u.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function ce(e){return e.options.scope?.id}var le=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new v({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){u.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){u.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){u.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new le,this.#t=e.mutationCache||new se,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=i.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=l.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(te(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return u.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;u.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return u.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=u.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return u.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=u.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(te(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return l.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(m(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{b(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(m(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{b(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=f(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===a&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},x=e(r(),1),de=e(oe(),1),fe=class extends Error{status;method;path;code;detail;constructor(e,t,n,r,i=``,a=``){super(e),this.name=`ApiError`,this.status=t,this.method=n,this.path=r,this.code=i,this.detail=a}};function pe(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{detail:``,code:``};try{let t=JSON.parse(e),n=t.detail&&typeof t.detail==`object`&&!Array.isArray(t.detail)?t.detail:void 0,r=typeof t.code==`string`&&t.code.trim()?t.code.trim():typeof n?.code==`string`?n.code.trim():``;if(n)for(let e of[`message`,`detail`]){let t=n[e];if(typeof t==`string`&&t.trim())return{detail:t.trim(),code:r}}for(let e of[`detail`,`error`,`message`]){let n=t[e];if(typeof n==`string`&&n.trim())return{detail:n.trim(),code:r};if(Array.isArray(n)){let e=n.map(e=>e&&typeof e==`object`?String(e.msg??``):``).filter(Boolean);if(e.length)return{detail:e.join(`; `),code:r}}}return{detail:``,code:r}}catch{}return{detail:t.startsWith(``u`?``:window.location.search).get(`reader_preview`);return e===`source-first`||e===`learning-path`||e===`question-foundation`?e:null}function S(e,t,n,r,i=ge(),a){let o=[`map-copy`,e,t,n,r];return i===`question-foundation`?[...o,i,a??null]:i?[...o,i]:o}var _e=`0.1.8+057b2aeae2b5e64e`,ve=!1,ye=new Set,be=()=>ve,xe=e=>(ye.add(e),()=>{ye.delete(e)});function Se(e){ve||!e||e===`unknown`||e===`0.1.8+057b2aeae2b5e64e`||(ve=!0,ye.forEach(e=>e()))}var Ce=class extends Error{constructor(){super(`页面已更新,请刷新后继续。 / This page has been updated. Refresh to continue.`),this.name=`PageUpdateRequiredError`}};function we(){if(ve)throw new Ce}var Te={name:`argus.webapi`,major:1,minServerMinor:16},Ee=[`daemon.admission.v1`,`daemon.status.protocol.v1`,`daemon.command.v1`,`daemon.upgrade-schedule.v1`,`cost.admission.v1`,`event.catalog.v1`,`event.payload-schema.v1`,`manager.sse.v1`,`manager.request-cancel.v1`,`advisor.config.v1`,`metrics.slo.v2`,`mission.view.v1`,`mission.abort.v1`,`project.attachments.v1`,`project.git-diff.v1`,`project.cost-feed.v1`,`project.counterexamples.v1`,`project.workdir.v1`,`research.events.v1`,`release.identity.v1`,`snapshot.schema.v1`,`source.update.v1`,`usage.recorded.v2`,`verticals.store.v1`],De=`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`;function Oe(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function ke(e){return typeof e==`number`&&Number.isInteger(e)?e:null}function Ae(e,t){let n=Oe(e),r=Oe(n?.protocol),i=Oe(n?.runtime),a=Array.isArray(n?.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],o=ke(r?.major),s=ke(r?.minor);if(!n||!r||!i)return{compatible:!1,reason:`malformed /api/meta response`};if(typeof i.source_root!=`string`||ke(i.pid)===null||typeof i.package_version!=`string`||typeof i.release_id!=`string`)return{compatible:!1,reason:`malformed /api/meta runtime identity`};if(n.service!==`argus-skill-webapi`)return{compatible:!1,reason:`unexpected service ${String(n.service||`unknown`)}`};let c=e;if(r.name!==Te.name||o!==Te.major)return{compatible:!1,reason:`protocol ${String(r.name||`unknown`)}/${String(o)} is incompatible with client ${Te.name}/${Te.major}`,meta:c};if(s===null||s!a.includes(e));if(l.length>0)return{compatible:!1,reason:`missing capabilities: ${l.join(`, `)}`,meta:c};if(i.source_root_matches_config===!1)return{compatible:!1,reason:`backend is running from a different installation than configured`,meta:c};if(t&&i.release_id!==t.releaseId)return{compatible:!1,reason:`backend and client installations are out of sync; restart or reinstall Argus`,meta:c};if(t?.sourceDigest){if(typeof i.runtime_source_digest!=`string`||!i.runtime_source_digest)return{compatible:!1,reason:`backend cannot verify this local installation; restart it from the current checkout`,meta:c};if(i.runtime_source_digest!==t.sourceDigest)return{compatible:!1,reason:`backend is running code from a different local installation; restart it`,meta:c}}let u=i.release_matches_source===!1?De:void 0;return{compatible:!0,reason:``,...u?{warning:u}:{},meta:c}}function je(e,t,n){let r=Ae(e,t);if(!r.compatible||!r.meta)throw Error(`incompatible Argus API: ${r.reason}`);return r.warning&&n?.(r.warning),r.meta}function Me(e){let t=Oe(e),n=Oe(t?.daemon);if(!t||t.schema_version!==7)throw Error(`incompatible snapshot schema: expected 7, got ${String(t?.schema_version??`missing`)}`);if(!n)throw Error(`invalid snapshot: daemon section is missing`);let r=[`read_status`,`read_error`,`protocol_compatible`,`protocol_error`].filter(e=>!Object.hasOwn(n,e));if(r.length>0)throw Error(`invalid snapshot: daemon fields missing: ${r.join(`, `)}`);let i=[`spend_usd`,`spend_status`,`usage_summary`,`daemon_commands`,`observability`,`mission_view`,`partial`,`diagnostics`].filter(e=>!Object.hasOwn(t,e));if(i.length>0)throw Error(`invalid snapshot: fields missing: ${i.join(`, `)}`);if(!Array.isArray(t.diagnostics))throw Error(`invalid snapshot: diagnostics must be an array`);return e}function Ne(e,t){return je(e,{releaseId:_e},t)}function Pe(e,t=`Tool execution`){return e===`host`?t:e}function Fe(e,t){let n=`/api/application-workflows`,r=e=>`${n}/${encodeURIComponent(e)}`;return{catalog:()=>e(n),create:e=>t(n,e),open:e=>t(`${n}/open`,{project:e}),snapshot:t=>e(r(t)),action:(e,n)=>t(r(e),n),document:(t,n)=>e(`${r(t)}/document?path=${encodeURIComponent(n)}`)}}var Ie=`verticals.store.v1`,Le=`argus_web_token`,Re=null;function ze(){let e;try{e=new URLSearchParams(window.location.search)}catch{return}let t=e.get(`token`);if(t){Re=t;try{localStorage.setItem(Le,t)}catch{}try{e.delete(`token`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)}catch{}}}var Be=()=>{if(Re)return Re;try{return new URLSearchParams(window.location.search).get(`token`)||localStorage.getItem(Le)}catch{return null}};function Ve(){let e=Be();return e?{Authorization:`Bearer ${e}`}:{}}function He(){return Be()??``}var Ue=8e3,We=12e3,Ge=class extends Error{constructor(){super(`This browser is not paired with Argus. Open a valid pairing link or enter a pairing token.`),this.name=`PairingRequiredError`}},Ke=class extends Error{method;path;constructor(e,t,n=`could not reach the local Argus service`){super(`${e.toUpperCase()} ${t} ${n}. Make sure Argus Desktop is running, then retry.`),this.name=`LocalArgusUnavailableError`,this.method=e.toUpperCase(),this.path=t}};function qe(e){return e instanceof Ge||!!(e&&typeof e==`object`&&Number(e.status)===401)}function Je(e){return qe(e)||e instanceof Ke}async function Ye(e,t){let n;try{n=await fetch(e,t)}catch(n){throw t.signal?.aborted?n:new Ke(String(t.method??`GET`),e)}return n.ok&&(Se(n.headers.get(`X-Argus-Release`)),(!t.method||t.method===`GET`)&&we()),n}async function Xe(e,t,n,r){let i=new AbortController,a=t.signal??void 0,o=!1,s=()=>{};if(a){let e=()=>i.abort(a.reason);a.aborted?e():(a.addEventListener(`abort`,e,{once:!0}),s=()=>a.removeEventListener(`abort`,e))}let c,l=(async()=>await r(await Ye(e,{...t,signal:i.signal})))(),u=new Promise((e,t)=>{c=setTimeout(()=>{o=!0;let e=Error(`request timed out after ${n}ms`);i.abort(e),t(e)},n)});try{return await Promise.race([l,u])}catch(r){if(o){let r=Math.round(n/1e3);throw new Ke(String(t.method??`GET`),e,`timed out after ${r}s because the local Argus service did not respond`)}throw r}finally{c&&clearTimeout(c),s()}}async function C(e,t,n){return Xe(e,{headers:Ve(),signal:t},n??We,async t=>(await he(t,`GET`,e),await t.json()))}async function Ze(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...Ve()},body:t===void 0?void 0:JSON.stringify(t),signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),r}async function w(e,t,n){return await(await Ze(e,t,n)).json()}async function Qe(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:Ve(),body:t,signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),await r.json()}function $e(e){let t=e&&typeof e==`object`?e:{},n=String(t.command_status??``);if(Number(t.rc??0)!==0||n===`failed`||n===`rejected`)throw Error(String(t.error||`daemon command ${n||`failed`}`));return e}async function et(e,t,n){we();let r=await fetch(t,{method:e,headers:{"Content-Type":`application/json`,...Ve()},body:n===void 0?void 0:JSON.stringify(n)});return await he(r,e,t),Se(r.headers.get(`X-Argus-Release`)),await r.json()}async function tt(e,t){let n=await fetch(e,{headers:Ve(),signal:t});return await he(n,`GET`,e),n.blob()}var T=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`;function nt(e,t){let n=new URLSearchParams({path:t}),r=He();return r&&n.set(`token`,r),T(e,`/artifact/preview/page?${n.toString()}`)}var rt=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,it=rt,at;function ot(e){return!!(e&&typeof e==`object`&&`aborted`in e&&typeof e.aborted==`boolean`)}function st(e,t,n,r){let i={text:e};return t?.length&&(i.attachments=t),n&&n!==`auto`&&(i.route_override=n),r&&(i.request_id=r),i}function ct(){if(!at){let e=(async()=>{let e=`/api/meta`,t=await Xe(e,{headers:Ve()},Ue,async t=>{if(t.status===404)throw Error(`incompatible Argus API: service does not expose /api/meta`);await he(t,`GET`,e);let n=await t.json();return Se(n?.runtime?.release_id),Ne(n,e=>{e!==`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`&&console.warn(`Argus API compatibility warning: ${e}`)})});if(t.authentication?.required&&!t.authentication.authenticated)throw new Ge;return t})();at=e,e.catch(t=>{at===e&&!(t instanceof Ge)&&(at=void 0)})}return at}var lt=new Set([`waiting_for_source`,`planning`,`writing`,`reviewing`]);function ut(e){let t=[],n;for(;n=/\r?\n\r?\n/.exec(e);){let r=e.slice(0,n.index);e=e.slice(n.index+n[0].length);for(let e of r.split(` +`)){let n=e.trim();if(n.startsWith(`data:`))try{t.push(JSON.parse(n.slice(5).trim()))}catch{}}}return{frames:t,rest:e}}async function dt(e,t,n,r){if(!e.body)throw Error(`${t} returned no response body`);let i=e.body.getReader(),a=new TextDecoder,o=``,s,c=!1;try{for(;;){r?.throwIfAborted();let{done:e,value:l}=await i.read();c=e,r?.throwIfAborted(),o+=e?a.decode()+` + +`:a.decode(l,{stream:!0});let u=ut(o);o=u.rest;for(let e of u.frames)n?.(e),(e.type===`done`||e.type===`error`)&&(s=e);if(e){if(!s)throw Error(`${t} ended before a terminal event`);return s}}}finally{c||await i.cancel().catch(()=>{}),i.releaseLock()}}var ft=null;function pt(e,t,n,r,i=ge(),a){let o=new URLSearchParams(n);return r&&o.set(`session_id`,r),i===`source-first`&&o.set(`preview`,`true`),i===`learning-path`&&o.set(`preview`,`learning-path`),i===`question-foundation`&&(o.set(`preview`,`question-foundation`),a&&o.set(`foundation_id`,a)),`/api/map-copy/${e}/${encodeURIComponent(t)}?${o}`}async function mt(e,t,n,r){let i=await Ze(e,t,n),a=!1,o=await dt(i,`Explanation stream`,e=>{(e.type===`done`||e.type===`error`)&&(a=!0),!a&&e.type===`progress`&<.has(e.phase)&&r?.(e.phase)},n);if(o.type===`error`){let t=o.error&&typeof o.error==`object`?o.error:void 0;throw new fe(String(t?.message??o.error??`Explanation failed`),typeof o.status==`number`?o.status:0,`POST`,e,typeof t?.code==`string`?t.code:``)}return o.result}var E={workflows:Fe(C,w),advisorSettings:(e,t)=>C(T(e,`/advisor/config`),t),saveAdvisorSettings:(e,t)=>w(T(e,`/advisor/config`),t),liveMap:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r?.mode===`current`&&(i.set(`since`,String(r.since)),i.set(`event_since`,String(r.eventSince)),r.taskId&&i.set(`start_task`,r.taskId)),C(T(e,`/map`)+(i.size?`?${i}`:``),t)},mapInfo:(e,t)=>C(T(e,`/map-info`),t),mapHistory:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r&&i.set(`task_after`,r),C(T(e,`/map-history`)+(i.size?`?${i}`:``),t)},mapCopy:(e,t,n,r,i,a,o)=>C(pt(e,t,{locale:n},i,a,o),r),mapCardWords:(e,t,n,r,i)=>w(`/api/map-cards/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapLines:(e,t,n,r,i)=>w(`/api/map-lines/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapQuestionSource:(e,t,n)=>w(`/api/map-question-source/project/${encodeURIComponent(e)}?session_id=${encodeURIComponent(e)}`,{...t,preview:t.preview===`source-first`?!0:t.preview??!1},n),generateMapCopy:(e,t,n,r,i,a,o)=>mt(pt(e,t,{stream:`true`},i,a,n.foundation_id),n,r,o),generateReaderFoundation:(e,t,n)=>mt(T(e,`/reader-foundation?stream=true`),t,void 0,n),askReaderFoundation:(e,t,n,r)=>mt(T(e,`/reader-foundation/${encodeURIComponent(t)}/question?stream=true`),n,void 0,r),mapDatasets:e=>C(`/api/map-datasets`,e),mapDataset:(e,t)=>C(`/api/map-datasets/${encodeURIComponent(e)}`,t),meta:ct,projectIndex:async()=>(await ct(),C(`/api/projects`,void 0,We)),listProjects:async()=>(await ct(),C(`/api/projects`,void 0,We).then(e=>e.projects)),projectCosts:async e=>(await ct(),C(`/api/projects/costs`,e)),createDaemon:async(e,t=``,n=``,r)=>{let i=`/api/daemons`,a={objective:e,name:t,workdir:n,command_id:it(),expected_revision:r},o=()=>fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,...Ve()},body:JSON.stringify(a),cache:`no-store`}),s=await o();return s.status===400&&/Invalid HTTP request received/i.test(await s.clone().text())&&(s=await o()),await he(s,`POST`,i),$e(await s.json())},updateProject:(e,t)=>et(`PATCH`,T(e),{name:t}),deleteProject:e=>et(`DELETE`,T(e)),snapshot:async(e,t,n=!1)=>(await ct(),Me(await C(T(e,`/snapshot?compact=true&events_limit=1${n?`&prewarm=true`:``}`),t,We))),activeSnapshot:async(e,t)=>{let n=ft!==e;n&&(ft=e);try{return await E.snapshot(e,t,n)}catch(t){throw n&&ft===e&&(ft=null),t}},prefetchSnapshot:(e,t)=>E.snapshot(e,t,!1),status:(e,t)=>C(T(e,`/status`),t),journal:(e,t=20,n)=>C(T(e,`/journal?n=${t}`),n).then(e=>e.journal),doctor:(e,t)=>C(T(e,`/doctor`),t),config:(e,t)=>C(T(e,`/config`),t),identity:(e,t)=>C(T(e,`/identity`),t).then(e=>e.identity),transcript:(e,t=30,n)=>C(T(e,`/transcript?n=${t}`),n).then(e=>e.turns),events:(e,t=80,n)=>C(T(e,`/events?limit=${t}&view=ui`),n).then(e=>e.events),workRecord:(e,t,n,r)=>C(T(e,`/work-record?role=${encodeURIComponent(t)}&record_id=${encodeURIComponent(n)}`),r),downloadWorkLog:async(e,t,n=``)=>{let r=T(e,`/work-log/download?role=${encodeURIComponent(t)}&task_id=${encodeURIComponent(n)}`),i=await fetch(r,{headers:Ve(),cache:`no-store`});await he(i,`GET`,r);let a=URL.createObjectURL(await i.blob()),o=document.createElement(`a`);o.href=a,o.download=`work-records.md`,o.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)},backlogItem:(e,t,n)=>C(T(e,`/backlog/${encodeURIComponent(t)}`),n).then(e=>e.item),artifacts:(e,t,n=!1)=>C(T(e,`/artifacts${n?`?include_reading=true`:``}`),t).then(e=>e.artifacts),artifact:(e,t,n)=>C(T(e,`/artifact?${new URLSearchParams({path:t})}`),n),artifactPreview:(e,t,n)=>C(T(e,`/artifact/preview?${new URLSearchParams({path:t})}`),n),artifactBundle:(e,t,n)=>tt(T(e,`/artifact/bundle?${new URLSearchParams({path:t})}`),n),artifactBlob:(e,t,n=!1,r)=>{let i=new URLSearchParams({path:t});return n&&i.set(`download`,`true`),tt(T(e,`/artifact/raw?${i}`),r)},gitDiff:(e,t)=>C(T(e,`/git-diff`),t),deliveryDiff:(e,t,n)=>C(T(e,`/delivery-diff?${new URLSearchParams(t)}`),n),metrics:e=>C(`/api/metrics`,e),sourceUpdateStatus:e=>C(`/api/runtime/source-update`,e),checkSourceUpdate:()=>w(`/api/runtime/source-update/check`),applySourceUpdate:()=>w(`/api/runtime/source-update/apply`),resources:e=>C(`/api/system/resources`,e),trash:(e=``,t=100,n=0,r)=>C(`/api/trash?${new URLSearchParams({query:e,limit:String(t),offset:String(n)})}`,r),restoreTrash:e=>w(`/api/trash/${encodeURIComponent(e)}/restore`),verticals:e=>C(`/api/verticals`,e),refreshVerticalCatalog:()=>w(`/api/verticals/catalog/refresh`),manageVertical:(e,t,n={})=>w(`/api/verticals/${encodeURIComponent(e)}/manage/${t}`,n.force?{force:!0}:{}),verticalOperation:(e,t)=>C(`/api/verticals/${encodeURIComponent(e)}/operation`,t),addTask:(e,t)=>w(T(e,`/tasks`),{text:t}).then(e=>e.item),abortMission:(e,t)=>w(T(e,`/mission/abort`),{reason:t}),mapNotes:(e,t)=>C(T(e,`/map-notes`),t),addMapNote:(e,t)=>w(T(e,`/map-notes`),t),answerPending:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/answer`),{text:n}),resolveDecision:(e,t,n,r)=>w(T(e,`/decisions/${encodeURIComponent(t)}/resolve`),{option_id:n,note:r}),uploadAttachments:async(e,t,n)=>{await ct();let r=new FormData;return t.forEach(e=>r.append(`files`,e,e.name)),Qe(T(e,`/attachments`),r,n)},answerDomain:(e,t,n,r)=>w(T(e,`/message`),{text:r||n,domain_answer:{id:t,option_id:n,note:r}}),message:(e,t,n)=>{let r=ot(n)?n:n?.signal,i=ot(n)?void 0:n?.attachments,a=ot(n)?void 0:n?.routeOverride,o=ot(n)?void 0:n?.requestId;return w(T(e,`/message`),st(t,i,a,o),r)},cancelMessage:(e,t)=>Xe(T(e,`/message/cancel`),{method:`POST`,headers:{"Content-Type":`application/json`,...Ve()},body:JSON.stringify({request_id:t})},5e3,async t=>(await he(t,`POST`,T(e,`/message/cancel`)),await t.json())),messageStream:async(e,t,n,r)=>{let i=ot(r)?r:r?.signal,a=ot(r)?void 0:r?.attachments,o=ot(r)?void 0:r?.routeOverride,s=ot(r)?void 0:r?.requestId;await dt(await Ze(T(e,`/message/stream`),st(t,a,o,s),i),`Manager stream`,e=>{if(!i?.aborted){if(e.type===`phase`){let t=Number(e.quiet_s??0);n.onPhase?.(String(e.label??``),String(e.role??`manager`),{heartbeat:e.heartbeat===!0,quietS:Number.isFinite(t)?t:0,kind:String(e.kind??``),detail:String(e.detail??``),tool:String(e.tool??``),toolKind:String(e.tool_kind??``),callId:String(e.call_id??``),status:String(e.status??``),output:String(e.output??``)})}else e.type===`delta`?n.onDelta?.(String(e.text??``),String(e.message_id??``),String(e.fragment_mode??`auto`)):e.type===`done`?n.onDone?.(e.result??{}):e.type===`error`&&n.onError?.(Error(String(e.error??`stream error`)))}},i)},nudge:(e,t)=>w(T(e,`/nudge`),{text:t}),queueFollowup:(e,t,n=`auto`)=>w(T(e,`/message/followup`),{text:t,route_override:n}),note:(e,t)=>w(T(e,`/note`),{text:t}),previewPlan:(e,t)=>w(T(e,`/plan`),{text:t}),rewritePrompt:(e,t)=>w(T(e,`/prompt/rewrite`),{text:t}),setConfig:(e,t,n,r=!1)=>w(T(e,`/config/set`),r?{name:t,value:n,apply_to_roles:!0}:{name:t,value:n}),setIdentity:(e,t)=>w(T(e,`/identity`),{text:t}),resetManager:e=>w(T(e,`/reset`)),skills:(e,t=`ls`)=>w(T(e,`/skills`),{args:t}).then(e=>e.text),skillLibrary:(e,t)=>C(`/api/skill-library${e?`?sid=${encodeURIComponent(e)}`:``}`,t),skillDocument:(e,t,n,r)=>C(`/api/skill-library/document?${new URLSearchParams({library:t,path:n,...e?{sid:e}:{}})}`,r),researchMethod:(e,t)=>C(T(e,`/research/method`),t),wiki:(e,t)=>C(T(e,`/wiki`),t),wikiPage:(e,t,n)=>C(T(e,`/wiki/page?${new URLSearchParams({path:t})}`),n),wikiLibrary:(e,t)=>C(`/api/wiki${e?`?sid=${encodeURIComponent(e)}`:``}`,t),wikiDocument:(e,t,n,r,i)=>C(`/api/wiki/page?${new URLSearchParams({scope:t,vertical:n,path:r,...e?{sid:e}:{}})}`,i),knowledgeFeed:(e=50,t)=>C(`/api/knowledge/feed?${new URLSearchParams({limit:String(e)})}`,t),learningStatus:(e,t)=>C(T(e,`/learning`),t),retryLearning:(e,t)=>w(T(e,`/learning/${encodeURIComponent(t)}/retry`),{}),setLaunchCwd:(e,t)=>w(T(e,`/launch-cwd`),{launch_cwd:t}),setWorkdir:(e,t)=>w(T(e,`/workdir`),{workdir:t}),disposeBacklog:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/dispose`),{op:n}),stopBacklog:(e,t)=>w(T(e,`/backlog/${encodeURIComponent(t)}/stop`)),setContinuous:(e,t,n=``)=>w(T(e,`/continuous`),{enabled:t,objective:n}).then(e=>{if(!t)return e;if(!e.daemon)throw Error(`daemon start returned no result`);return $e(e.daemon),e}),startDaemon:(e,t)=>w(T(e,`/daemon/start`),{command_id:it(),expected_revision:t}).then($e),stopDaemon:(e,t=!1,n,r=!1)=>w(T(e,`/daemon/stop`),{drain:t,force:r,command_id:it(),expected_revision:n}).then($e),replaceDaemon:(e,t,n=!1,r)=>w(T(e,`/daemon/replace`),{victim_sid:t,resume_continuous:n,command_id:it(),expected_revision:r}).then($e),upgradeDaemon:(e,t)=>w(T(e,`/daemon/upgrade`),{command_id:it(),expected_revision:t}).then($e)},ht=new Set([4401,4404]);function gt(e,t,n={}){let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=new URLSearchParams;n.replay!=null&&i.set(`replay`,String(n.replay)),i.set(`view`,`ui`);let a=Be();a&&i.set(`token`,a);let o=`${r}//${window.location.host}${T(e,`/stream`)}?${i}`,s=null,c=!1,l,u=()=>{c||(s=new WebSocket(o),s.onopen=()=>n.onOpen?.(),s.onmessage=e=>{try{let n=JSON.parse(e.data);n&&typeof n==`object`&&t(n)}catch{}},s.onclose=e=>{let t=!ht.has(e.code);n.onClose?.({code:e.code,reason:e.reason,retryable:t}),!c&&t&&(l=setTimeout(u,1e3))},s.onerror=()=>s?.close())};return u(),()=>{c=!0,l&&clearTimeout(l),s?.close()}}var _t={schema:1,id:`argus`,name:`Argus`,tagline:`Autonomous Work Lab`,terminal_wordmark:`argus`,assets:{}};function vt(e){if(!e||typeof e!=`object`)throw Error(`Invalid application brand`);let t=e;if(t.schema!==1||typeof t.id!=`string`||!/^[a-z][a-z0-9-]{0,39}$/.test(t.id))throw Error(`Invalid application brand identity`);for(let[e,n]of[[`name`,48],[`tagline`,100],[`terminal_wordmark`,24]]){let r=t[e];if(typeof r!=`string`||!r.trim()||r.length>n||/[\x00-\x1f\x7f-\x9f]/.test(r))throw Error(`Invalid application brand ${e}`)}if(!/^[a-z0-9 -]+$/.test(String(t.terminal_wordmark)))throw Error(`Invalid terminal wordmark`);if(!t.assets||typeof t.assets!=`object`||Array.isArray(t.assets))throw Error(`Invalid application brand assets`);let n={};for(let e of[`mark`,`mark_dark`,`logo`,`logo_dark`,`icon`,`icon_dark`]){let r=t.assets[e];if(r!==void 0&&r!==`/api/application-brand/assets/${e}`)throw Error(`Invalid application brand asset ${e}`);if(typeof r==`string`)n[e]=r;else if(t.id!==`argus`)throw Error(`Missing application brand asset ${e}`)}return{schema:1,id:t.id,name:String(t.name),tagline:String(t.tagline),terminal_wordmark:String(t.terminal_wordmark),assets:n}}var yt=_t,bt=()=>yt;async function xt(){let e=await fetch(`/api/application-brand`,{cache:`no-store`});if(!e.ok)throw Error(`Application identity unavailable (${e.status})`);if(yt=vt(await e.json()),yt.id!==`argus`){document.title=`${yt.name} · Workbench`,document.querySelector(`meta[name="apple-mobile-web-app-title"]`)?.setAttribute(`content`,yt.name),document.querySelector(`link[rel="manifest"]`)?.setAttribute(`href`,`/api/application-brand/manifest.webmanifest`);for(let e of document.querySelectorAll(`link[rel="icon"], link[rel="apple-touch-icon"]`))e.href=e.media.includes(`dark`)?yt.assets.icon_dark:yt.assets.icon,e.removeAttribute(`type`)}}var D=n(),St=`argus.locale`,Ct={"language.english":`English`,"handshake.connecting":`Getting Argus ready`,"handshake.service":`Service`,"handshake.project":`Project`,"handshake.ready":`Ready`,"handshake.title":`Getting Argus ready`,"handshake.detail":`Reopening your workspace…`,"splash.starting":`Argus starting`,"rail.workbench":`Workbench`,"rail.sessionsShortcut":`Sessions · Ctrl/⌘ P`,"panel.backlog":`Backlog`,"panel.activity":`Activity`,"panel.journal":`Journal`,"panel.roles":`Roles`,"panel.project":`Project`,"panel.liveView":`Manager live project view`,"stream.jumpToLatest":`Jump to latest`,"stream.toggleReasoning":`Show or hide agent reasoning (⌘T)`,"stream.reasoning":`Reasoning`,"stream.noLogs":`No activity yet`,"stream.system":`Argus updates`,"stream.autonomous":`Background activity`,"stream.backgroundWork":`Argus is working in the background`,"stream.ready":`Argus is ready. Ask a question or assign work.`,"stream.historyLoading":`Loading conversation history…`,"stream.historyError":`Could not load conversation history.`,"stream.historyRetry":`Retry`,"stream.fold.read":`Read {count} files`,"stream.fold.search":`Searched {count} times`,"stream.fold.fetch":`Looked up {count} web pages`,"stream.fold.edit":`Edited {count} files`,"stream.fold.tool":`Used {tool} {count} times`,"stream.fold.failed":`{count} failed`,"stream.fold.expand":`Show each step`,"stream.fold.collapse":`Hide the steps`,"stream.repeated":`Repeated {count} times; showing the latest`,"stream.stepFailed":`failed`,"stream.stepResult":`Result`,"common.showRaw":`Show raw output`,"doctor.lastEntry":`Last entry`,"operations.metric.calls":`model calls today`,"operations.metric.failed":`failed`,"operations.metric.slowest":`slowest typical call`,"operations.slo.healthy":`Healthy`,"operations.slo.degraded":`Needs attention`,"operations.slo.loading":`Loading…`,"operations.validationFailures":`{count} malformed events today`,"operations.outputLines":`{count} lines of output`,"operations.done":`Done.`,"newDaemon.workdirPlaceholder":`Blank → ~/.argus-skill/workspaces/`,"operations.resetManager":`Reset Manager context`,"language.chinese":`中文`,"language.switchTo":`Switch to {language}`,"common.loading":`Loading…`,"common.retry":`Retry`,"common.save":`Save`,"common.cancel":`Cancel`,"common.close":`Close`,"common.settings":`Settings`,"common.ready":`Ready`,"common.live":`Live`,"common.reconnecting":`Reconnecting`,"common.stale":`Snapshot stale`,"common.degraded":`Snapshot degraded`,"common.external":`External`,"common.pause":`Pause`,"common.run":`Run`,"common.working":`Working`,"common.local":`Local`,"common.all":`All`,"common.unassigned":`Unassigned`,"common.closeSessions":`Close sessions`,"common.resizeSessions":`Resize sessions`,"common.resizePreview":`Resize preview`,"common.expandPreview":`Expand preview`,"time.justNow":`just now`,"time.minutesAgo":`{count}m ago`,"time.hoursAgo":`{count}h ago`,"time.yesterdayAt":`Yesterday at {time}`,"connection.pairingTitle":`This browser is not paired with Argus`,"connection.pairingDetail":`Open a valid pairing link for this Argus site, or paste the link or token below.`,"connection.pairAgain":`Pair again`,"connection.pairingInput":`Pairing link or token`,"connection.pairingPlaceholder":`Paste a fresh pairing link or token`,"connection.pairingInvalid":`Enter a valid pairing link or token.`,"connection.connect":`Connect`,"connection.unreachableTitle":`The local Argus service is unavailable`,"connection.unreachableDetail":`Keep Argus Desktop running, wait for the local service to become ready, then retry.`,"sidebar.collapse":`Collapse sessions`,"sidebar.expand":`Expand sessions`,"sidebar.create":`Create project`,"sidebar.find":`Find a project`,"sidebar.clearSearch":`Clear search`,"sidebar.refreshFailed":`Refresh failed · retry`,"sidebar.noSessions":`No sessions`,"sidebar.noMatches":`No sessions matching "{query}"`,"sidebar.unnamedSession":`Unnamed session`,"sidebar.daemonAlive":`Argus background is online`,"sidebar.updateRequired":`Update required`,"sidebar.updateAvailable":`Update available`,"sidebar.updateAvailableHint":`The executor is still running with a different release from this page.`,"sidebar.stopped":`Background stopped`,"sidebar.runningFor":`Background online · {uptime}`,"sidebar.lastActive":`Last active {time}`,"sidebar.manage":`Manage {name}`,"sidebar.manageHint":`Rename, pause, or delete`,"sidebar.resume":`Resume`,"sidebar.resumeHint":`Resume work in {workdir}`,"sidebar.resumeSuccess":`Session resumed.`,"sidebar.resumeFailed":`Could not resume session: {error}`,"sidebar.modelLoading":`Loading backend and model…`,"sidebar.modelUnavailable":`Backend and model unavailable`,"sidebar.defaultModel":`default model`,"sidebar.openSettings":`Open settings`,"sidebar.compute":`Compute queue & allowance`,"sidebar.theme":`{current} theme; switch to {next}`,"landing.selectOrCreate":`Select a session from the sidebar, or create a new one.`,"landing.noSessions":`No sessions yet. Create one to begin.`,"landing.select":`Select project`,"landing.new":`New project`,"landing.menu":`Open menu`,"project.missingSwitched":`Project “{requested}” was not found. Switched to {fallback}.`,"project.missingCreate":`Project “{requested}” was not found. Create a project to continue.`,"topbar.openSessions":`Open projects`,"topbar.externallyManaged":`Externally managed`,"topbar.pauseDaemon":`Pause Argus`,"topbar.runDaemon":`Run Argus`,"topbar.working":`Argus is working on your request`,"topbar.roleActive":`{role} is active`,"topbar.roleIdle":`{role} is idle`,"topbar.externalDaemonHint":`Argus is managed outside this app and must be controlled there.`,"topbar.manageSession":`Manage session`,"topbar.showPreview":`Show preview`,"topbar.showActivity":`Show activity`,"mobile.views":`Views`,"mobile.sessions":`Projects`,"mobile.mission":`Mission`,"mobile.activity":`Conversation`,"mobile.workbench":`Workbench`,"mobile.map":`Map`,"mobile.preview":`Files`,"chat.working":`Argus is working on your message`,"chat.workingQuiet":`Argus is working on your message · Still working; no new update for {quiet}s`,"chat.stopWaitingHint":`Esc stop reply · Enter sends a follow-up`,"chat.queuedWhileRunning":`Queued · answered right after this reply; a running task can be steered by it`,"chat.attachWhileRunning":`Attachments can be sent once this reply finishes`,"chat.stepsLive":`Working · {count} steps so far`,"chat.stepsDone":`{count} steps · {seconds}`,"chat.stepFailed":`failed`,"chat.stepRaw":`raw`,"chat.messageArgus":`message Argus`,"chat.selectSession":`Select a session…`,"chat.placeholder":`Ask a question or assign work`,"chat.routeLabel":`message category`,"chat.routeHint":`For this message only. Argus chooses one worker or a team based on the request; greetings stay in conversation.`,"chat.routeTask":`Task`,"chat.routeAuto":`Auto`,"chat.routeChat":`Chat`,"chat.attach":`attach files`,"chat.attachHint":`PNG, JPEG, WebP, PDF, Markdown/text, JSON, CSV · up to {count} files, {perFile} each, {total} total`,"chat.attachDrop":`Drop files to attach`,"chat.attachRemove":`remove attachment {name}`,"chat.attachUnsupported":`{name} is not supported. Use PNG, JPEG, WebP, PDF, Markdown/text, JSON, or CSV.`,"chat.attachTooLarge":`{name} exceeds the {size} per-file limit.`,"chat.attachTooMany":`You can attach up to {count} files per message.`,"chat.attachTotalTooLarge":`Attachments exceed the {size} total limit.`,"chat.attachmentUploadFailed":`Attachment upload failed: {error}`,"chat.uploadingAttachments":`Uploading attachments`,"chat.rewriteHint":`Let the Manager rewrite this prompt into a brief the team can act on. Nothing is sent — the rewrite lands back in this box for you to edit.`,"chat.rewriteLabel":`rewrite prompt with the Manager`,"chat.rewriting":`rewriting`,"chat.rewrite":`Rewrite text`,"chat.stopWaiting":`stop reply`,"chat.stopWaitingTitle":`Stop this Manager request`,"chat.stoppingReply":`Stopping this reply…`,"chat.stopReplyRequested":`Stop requested. You can send another message.`,"chat.replyAlreadyFinished":`This reply has already finished.`,"chat.stopReplyFailed":`Could not stop the server request: {error}`,"chat.send":`send message`,"copy.message":`Copy`,"copy.code":`Copy code`,"copy.copied":`Copied`,"help.title":`Keyboard shortcuts`,"help.commands":`Commands`,"help.palette":`command palette`,"help.sessions":`toggle sessions`,"help.managerChat":`focus Manager chat`,"help.rewrite":`rewrite the current prompt before sending`,"help.reasoning":`toggle agent reasoning`,"help.kiosk":`toggle kiosk (read-only) mode`,"help.composer":`focus the composer`,"help.send":`send message`,"help.newline":`insert newline`,"help.thisHelp":`this help`,"help.escape":`close overlay / stop waiting in composer`,"palette.placeholder":`Type a command or search…`,"palette.noMatches":`no matching commands`,"palette.navigate":`↑↓ navigate`,"palette.run":`↵ run`,"palette.close":`esc close`,"palette.view":`View`,"palette.action":`Action`,"palette.project":`Project`,"palette.newDaemon":`New session`,"palette.openTranscript":`Open Transcript`,"palette.openProject":`Open Project`,"palette.projectHint":`work · memory · agents`,"palette.openOperations":`Open Operations`,"palette.operationsHint":`session controls`,"palette.hideReasoning":`Hide reasoning`,"palette.showReasoning":`Show reasoning`,"palette.exitKiosk":`Exit kiosk mode`,"palette.enterKiosk":`Enter kiosk mode`,"palette.messageArgus":`Message Argus…`,"palette.stopWaiting":`Stop Manager reply`,"palette.stopContinuous":`Stop continuous campaign`,"palette.startContinuous":`Start continuous campaign`,"palette.stopDaemon":`Pause Argus`,"palette.startDaemon":`Run Argus`,"slash.suggestions":`Slash command suggestions`,"mission.roleActive":`{role} active`,"mission.overview":`mission overview`,"mission.operations":`Operations`,"role.manager":`Manager`,"role.manager.description":`Understands your goal and coordinates work`,"role.planner":`Planner`,"role.planner.description":`Breaks down the problem, schedules work, and revises the plan`,"role.engineer":`Engineer`,"role.engineer.description":`Researches, writes proofs or code, and uses tools to check the work`,"role.reviewer":`Reviewer`,"role.reviewer.description":`Checks results and evidence and identifies gaps`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`You`,"doctor.title":`Doctor`,"doctor.subtitle":`Argus status checks + recommended root-cause fix`,"doctor.recommended":`recommended fix`,"doctor.loadError":`Couldn’t load diagnostics.`,"doctor.empty":`No diagnostic data available`,"doctor.daemonLog":`Daemon log`,"settings.subtitle":`effective roles, budgets, and essential controls`,"settings.loadError":`Couldn’t load configuration.`,"settings.empty":`No configuration found`,"settings.quickConfig":`Quick Config`,"settings.appearance":`Appearance`,"settings.appearanceHint":`Choose the interface colour treatment. Logos and icons always remain monochrome.`,"settings.themeStyle":`Theme colour`,"settings.themeStyle.standard":`Standard`,"settings.themeStyle.standardHint":`Quiet black, white, grey, and blue.`,"settings.themeStyle.gradient":`Gradient`,"settings.themeStyle.gradientHint":`The classic Argus blue-to-gold background.`,"settings.backend":`Backend`,"settings.backendSource.env":`set by the server environment`,"settings.backendSource.persisted":`saved setting`,"settings.backendSource.default":`built-in default`,"settings.backendWillSave":`Apply saves {backend}.`,"settings.backendWillReplace":`Apply replaces the saved {saved} with {backend}.`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`Backend saved as {backend}. Restart Argus to apply.`,"settings.backendUnsupported":`Unsupported backend ({backend})`,"settings.backendUnavailable":`Backend unavailable`,"settings.model":`Model`,"settings.trialAccount":`Trial account`,"settings.trialKeyHint":`Replace your Key here when its allowance runs out. Your projects and conversations stay in place.`,"settings.changeTrialKey":`Change Key`,"settings.applyModel":`Apply`,"settings.modelPlaceholder":`auto (backend default)`,"settings.connection":`Connection`,"settings.webApi":`Web + REST API`,"settings.eventStream":`Live updates`,"settings.taskDaemon":`Background work`,"settings.taskDaemonValue":`Local process · events.jsonl · no TCP port`,"chat.messageTooLong":`Message exceeds 32,000 characters. Shorten it or upload a file. Your draft is preserved.`,"settings.required":`{field} is required`,"settings.advanced":`Advanced`,"settings.advancedHint":`Budgets, the advisor model, explanation effort, connection details and raw configuration`,"settings.mapModel":`Map`,"settings.mapModelFollows":`Follows the front-door model`,"settings.mapModelSet":`Map explanations now use {model}.`,"settings.overrideTitle":`Environment override`,"settings.overrideHint":`Set a specific config alias or environment-variable key.`,"settings.namePlaceholder":`name or alias, e.g. manager_model`,"settings.valuePlaceholder":`value`,"settings.applyAdvanced":`Apply environment override`,"settings.applied":`Applied. Restart affected sessions to use the new settings.`,"settings.modelAppliedToRoles":`Every role now uses {model}. Sessions already running keep their model until they restart.`,"settings.rolesRunning":`Roles now run:`,"settings.applyUnifies":`Apply sets all of them to the model above.`,"settings.rolesTitle":`Effective roles`,"settings.rawConfig":`Raw configuration`,"settings.group.limits":`Limits`,"settings.group.safety":`Safety`,"settings.group.interface":`Interface`,"settings.knob.activeDaemons":`Active session limit`,"settings.knob.activeDaemonsDoc":`Maximum background sessions running on this host.`,"settings.knob.safeMode":`Safe mode`,"settings.knob.safeModeDoc":`Enable extra-conservative runtime guardrails.`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`Enable the Telegram notification bridge.`,"settings.knob.showReasoning":`Show reasoning`,"settings.knob.showReasoningDoc":`Stream role reasoning into the activity view.`,"settings.knob.operatorAvailable":`Operator available`,"settings.knob.operatorAvailableDoc":`Off suppresses operator questions: Argus decides on recorded assumptions and blocks on operator-only actions.`,"noOperator.banner":`No-operator mode: questions suppressed. Argus decides on recorded assumptions instead of asking you.`,"noOperator.turnOff":`Ask me again`,"settings.source.notApplicable":`Not applicable for this model`,"settings.source.vaultDefault":`Capability vault / default`,"settings.source.default":`Default`,"settings.modelUnavailable":`unavailable`,"settings.modelOfflineList":`Offline list: the backend did not return its live models, showing the harness catalog.`,"settings.source.saved":`Saved override`,"settings.source.environment":`Environment variable`,"settings.source.hostConfig":`Host configuration`,"settings.source.other":`Resolved configuration`,"settings.value.enabled":`Enabled`,"settings.value.disabled":`Disabled`,"settings.effort.low":`Low effort`,"settings.effort.medium":`Medium effort`,"settings.effort.high":`High effort`,"settings.effort.xhigh":`Extra-high effort`,"settings.role.curator":`Curator`,"settings.role.curatorDoc":`Maintains and distills the reusable skill pool.`,"settings.footer":`Human-readable labels are shown with raw keys. The full registry remains available via`,"identity.title":`Identity`,"identity.subtitle":`who argus is working for on this project`,"identity.placeholder":`Describe who Argus is working for and durable preferences…`,"identity.save":`Save identity`,"identity.saved":`Identity saved.`,"transcript.title":`Transcript`,"transcript.subtitle":`recent operator ↔ argus turns · reply from the composer`,"transcript.empty":`no conversation turns yet`,"transcript.operator":`operator`,"new.createDaemon":`Create session`,"new.createdIdle":`New session ready. Say what it is for and the work begins.`,"new.createdStarting":`New session ready; the work is starting in the background.`,"new.subtitle":`Creates an isolated timeline and Manager context.`,"new.close":`close create session`,"new.name":`Name`,"new.optional":`(optional)`,"new.namePlaceholder":`e.g. AAAI embodiment paper`,"new.workdir":`Output workdir`,"new.workdirHint":`Agents write code, papers, reports, and experiment outputs here. Internal memory stays under the session state directory.`,"new.objective":`Objective`,"new.objectivePlaceholder":`Leave blank to start with a conversation, or describe a campaign to start immediately.`,"new.startsAfterCreate":`Campaign starts after session creation`,"new.idleUntilMessage":`Idle until the first message`,"new.startsHint":`The session opens immediately while Argus prepares the work in the background.`,"new.idleHint":`Background work starts after your first message, when needed.`,"new.shortcut":`Ctrl/⌘+Enter to create`,"new.creating":`Creating…`,"new.createAndStart":`Create and start`,"manage.daemon":`Manage session`,"manage.displayName":`Display name`,"manage.executor":`Background work`,"manage.running":`Running`,"manage.runningExternally":`Running externally`,"manage.paused":`Stopped`,"manage.pauseHint":`Interrupt the current operation and keep progress resumable.`,"manage.stopNow":`Stop now`,"manage.stopNowHint":`Immediately interrupt this verified daemon so the session can be deleted.`,"manage.externalHint":`This session is managed outside this app.`,"manage.resumeHint":`Resume queued research work.`,"manage.working":`Working…`,"manage.resume":`Resume`,"manage.deleteSession":`Delete session`,"manage.deleteHint":`Deleted sessions move to the trash and remain recoverable. Stop background work first.`,"manage.delete":`Delete…`,"manage.confirmQuestion":`Move this session to trash?`,"manage.confirmDelete":`Confirm delete`,"decision.operator":`Operator decision`,"decision.required":`Decision required`,"decision.whyBlocked":`Recorded reason this task needs input`,"decision.currentTask":`Current task`,"decision.taskName":`Task: {title}`,"decision.otherTask":`Another task awaiting input`,"decision.awaitingReply":`Awaiting your reply`,"decision.askedAt":`Asked {time}`,"decision.evidence":`Evidence`,"decision.notePlaceholder":`Add the guidance the Manager should apply…`,"decision.resumeHint":`Your answer applies to this task. The Manager checks its next step.`,"decision.later":`Later`,"decision.applying":`Submitted; Argus is starting on it…`,"decision.closeContinue":`Close, keep working`,"decision.stopCampaign":`Stop campaign`,"decision.useOption":`Use this option`,"decision.sendAnswer":`Send answer`,"decision.noteRequired":`Add the required details before sending this choice.`,"artifact.preview":`Result preview`,"artifact.title":`Result`,"artifact.approvedEvidence":`evidence the Reviewer has checked`,"artifact.downloading":`Downloading…`,"artifact.download":`Download`,"artifact.open":`Open`,"artifact.close":`close result preview`,"artifact.unavailable":`preview unavailable`,"artifact.empty":`(empty file)`,"artifact.truncated":`preview truncated · download to inspect the complete file`,"artifact.htmlTooLarge":`HTML preview is too large to render safely. Download the complete file.`,"artifact.pdfDisabled":`Inline PDF preview is disabled by this browser.`,"artifact.openPdf":`Open PDF`,"artifact.noPreview":`This file type has no safe inline preview.`,"artifact.downloadHint":`Download it to inspect with a local application.`,"task.details":`Task details`,"task.stopLoop":`stop loop`,"task.done":`done`,"task.skip":`skip`,"task.close":`close task details`,"task.waitingOnYou":`Waiting on you`,"task.objective":`Objective`,"task.noObjective":`(no objective recorded)`,"task.untitled":`Untitled task`,"task.priority":`priority`,"task.started":`started`,"task.finished":`finished`,"task.outcome":`Outcome`,"task.iteration":`Iteration`,"task.mode":`mode`,"task.autoIterate":`auto-iterate`,"task.singlePass":`single pass`,"task.cycles":`cycles`,"task.cost":`cost`,"task.lastError":`Last error`,"task.notes":`Notes`,"task.dependsOn":`depends on`,"task.dependsOnCount":`Depends on {count} earlier tasks`,"pending.reviewRespond":`Review and respond`,"pending.showOnMap":`Show on map`,"backlog.active":`Active · {count}`,"backlog.history":`History · {count}`,"backlog.noHistory":`No completed work yet`,"backlog.empty":`Nothing queued. Argus is ready for new work.`,"backlog.viewDetails":`View full task details`,"backlog.iterating":`Repeating`,"backlog.stopIterating":`Stop repeating`,"backlog.stop":`Stop`,"backlog.markDone":`Mark done`,"backlog.remove":`Remove`,"mission.achievement":`Argus achievement`,"mission.elapsed":`Elapsed`,"mission.rejectedAttempts":`{count} rejected attempts`,"mission.skillsLearned":`{count} skills learned`,"mission.artifacts":`{count} files produced`,"mission.waiting":`Waiting for a mission`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`Ready when you are — assign a mission to begin.`,"mission.statusDone":`This task: {outcome} — finished in {elapsed}.`,"mission.nextAfterReply":`Reply to this task’s question first, then decide its next step.`,"mission.continuousDone":`Continuous run finished`,"mission.resumeContinuous":`Resume`,"mission.control":`Mission control`,"mission.attentionHealth":`System error — health is degraded.`,"mission.attentionFailed":`Mission failed — check the task below.`,"mission.deliveryFailed":`Task failed at delivery — execution could not start or finish.`,"mission.attentionStepFailed":`A step failed — check the task below.`,"mission.attentionPaused":`Mission is paused — waiting for your input.`,"mission.showObjective":`Show full objective`,"mission.showFullOutput":`View full output`,"mission.stage":`Stage`,"mission.campaign":`Campaign`,"mission.totalElapsed":`Total elapsed`,"mission.round":`Round`,"mission.mode":`Mode`,"mission.summary":`Mission summary`,"mission.deliveryCertified":`Delivery approved`,"mission.taskCompleted":`Task completed`,"mission.openResult":`Open result`,"mission.viewTask":`View task`,"mission.taskPlan":`Task plan`,"mission.team":`Team`,"mission.waitingShort":`Waiting`,"mission.roleWork":`Role work`,"mission.showMore":`Show more`,"mission.showLess":`Show less`,"mission.done":`Done`,"mission.inProgress":`In progress`,"mission.failed":`Failed`,"mission.bannerPaused":`Mission is paused — waiting for your input.`,"mission.bannerError":`System error — health is degraded.`,"mission.bannerStepFailed":`A step failed: {step}`,"mission.elapsedAgo":`{elapsed} ago`,"mission.filteredBy":`filtered by {task} · clear`,"mission.allVisible":`all visible missions`,"mission.roundNumber":`round {count}`,"mission.noRoleWork":`No persisted {role} work for this selection yet.`,"mission.researchDag":`Task route`,"mission.active":`active`,"mission.noDag":`The Planner has not added tasks to the route yet.`,"mission.workingHypothesis":`Working hypothesis · can be revised`,"mission.goalContribution":`How this supports the goal`,"mission.temporaryRegressions":`Expected temporary tradeoffs`,"mission.decisionRule":`When to revise, split, or stop`,"mission.acceptance":`What counts as done`,"mission.nonGoals":`Non-goals`,"mission.capabilities":`Capabilities`,"mission.capabilitiesUnlocked":`Capabilities unlocked`,"mission.learnedCapability":`Learned capability`,"mission.learnedDuring":`Learned during {mission}`,"mission.skillUnavailable":`Skill content is not available in this snapshot.`,"mission.contentTruncated":`Content preview truncated`,"mission.knowledgeRetained":`Knowledge retained`,"mission.selfEvolution":`Saved project knowledge`,"mission.knowledgeSaved":`Argus saved these capabilities and notes for future work on this project.`,"mission.noCapabilities":`No capabilities learned yet.`,"mission.replay":`Mission replay`,"mission.replayTimeline":`Replay mission timeline`,"mission.roleFailed":`{role} failed`,"mission.showingLatestEvent":`Showing latest event`,"mission.showingLastEvents":`Showing last {count} events`,"mission.waitingEvents":`Waiting for structured research events.`,"mission.startsAfter":`Starts after {count} earlier tasks`,"mission.hiddenTasks":`{count} earlier tasks hidden · {failed} blocked or failed · {skipped} skipped`,"mission.projectFilesChanged":`Project files changed`,"mission.reviewInIde":`Open the IDE to review the diff`,"research.currentWork":`Current work`,"research.dagProgress":`Task route progress`,"research.verifiedOutputs":`Verified outputs`,"research.recentMilestones":`Recent milestones`,"research.liveProgress":`Task progress`,"research.artifact":`Research result`,"research.canvas":`Manager live research canvas`,"research.previewArtifact":`Preview the result`,"research.openLarge":`Open large preview`,"research.collapse":`Collapse preview`,"research.unavailable":`Manager live view is temporarily unavailable.`,"research.noPreview":`No preview`,"research.waiting":`Waiting…`,"research.updating":`Updating…`,"research.fileUnavailable":`This file is ready to download using the button above.`,"research.eventSourced":`event-sourced mission state`,"research.downloadFailed":`download failed`,"operations.title":`Operations`,"operations.work":`Work`,"operations.runtime":`Runtime`,"operations.system":`System`,"operations.recovery":`Recovery`,"operations.workInput":`Work input`,"operations.workHint":`Queue work, guide the active task, save a note, or preview a plan without dispatching it.`,"operations.action.task":`Task`,"operations.action.nudge":`Guide`,"operations.action.note":`Note`,"operations.action.plan":`Plan`,"operations.planPlaceholder":`Objective to preview; preview never queues work`,"operations.actionPlaceholder":`{action} text`,"operations.previewPlan":`Preview plan`,"operations.submitAction":`Submit {action}`,"operations.runtimeHint":`Change where this session runs, reset Manager context, or safely restart the session.`,"operations.workdir":`Working directory`,"operations.workdirUpdated":`Working directory updated.`,"operations.applyWorkdir":`Apply working directory`,"operations.replaceSlot":`Replace an active session`,"operations.sourceUpdate":`Argus source version`,"operations.pullLatest":`Pull latest version`,"operations.updateChecking":`Checking published branch…`,"operations.updateRunning":`Updating…`,"operations.updateAvailable":`Update available`,"operations.updateCurrent":`Up to date`,"operations.updateUnavailable":`This checkout cannot be updated safely.`,"operations.currentRevision":`Current`,"operations.latestRevision":`Latest`,"operations.updatePhase":`Phase`,"operations.updateRestart":`Source updated. Restart the cockpit, then use the reload button to move active daemons to the new release at a safe task boundary.`,"operations.skills":`Skills`,"operations.runSkill":`Run skill command`,"operations.metrics":`System metrics`,"operations.trash":`Recoverable trash`,"operations.searchTrash":`Search trash`,"operations.trashEmpty":`Trash is empty.`,"resource.title":`Resources`,"resource.loading":`Loading resource status…`,"resource.devices":`Devices: {count}`,"resource.inUse":`In use · {count}`,"resource.queue":`Queue · {count}`,"resource.none":`None`,"resource.timeLeft":`{ttl} left`,"resource.noIntent":`No purpose recorded`,"resource.yieldRequest":`Resource release requested · {reason}`,"resource.queuePosition":`Queue position {position}`,"label.status.inProgress":`In progress`,"label.status.waiting":`Waiting`,"label.status.completed":`Completed`,"label.status.blocked":`Blocked`,"label.status.failed":`Failed`,"label.status.needsChanges":`Needs changes`,"label.status.skipped":`Skipped`,"label.status.paused":`Paused`,"label.status.cancelled":`Cancelled`,"label.status.available":`Available`,"label.status.unavailable":`Unavailable`,"label.status.inaccessible":`Not accessible`,"label.status.limited":`Limited`,"label.status.healthy":`Healthy`,"label.status.updated":`Status updated`,"label.role.argus":`Argus`,"label.role.you":`You`,"label.work.task":`Task`,"label.work.action":`Work step`,"label.work.handoff":`Notes for the next step`,"label.work.review":`Review`,"label.work.planning":`Planning`,"label.work.update":`Update`,"label.stage.scope":`Scope`,"label.stage.research":`Research`,"label.stage.implementation":`Implementation`,"label.stage.experiment":`Experiments`,"label.stage.analysis":`Analysis`,"label.stage.writing":`Writing`,"label.stage.review":`Final review`,"label.stage.delivery":`Delivery`,"label.stage.unstaged":`Unstaged`,"label.frontier.reopened":`An earlier task was reopened`,"label.frontier.added":`A new task was added`,"label.frontier.completed":`A task path was completed`,"label.frontier.revised":`The task plan was revised`,"label.frontier.narrowed":`The task scope was narrowed`,"label.frontier.expanded":`The task scope was expanded`,"label.frontier.updated":`The task plan was updated`,"label.priority":`Priority {priority}`,"label.outcome.workCompleted":`Work completed`,"label.outcome.workPaused":`Work paused`,"label.outcome.workBlocked":`Work blocked`,"label.outcome.workFailed":`Work failed`,"label.outcome.workEnded":`Work ended`,"label.outcome.workIncomplete":`Work incomplete`,"label.outcome.workStalled":`Work stalled`,"label.outcome.workUpdated":`Work status updated`,"label.outcome.reviewPassed":`Review passed`,"label.outcome.reviewNeedsChanges":`Review requested changes`,"label.outcome.reviewBlocked":`Review blocked`,"label.outcome.reviewOutdated":`Review is out of date`,"label.outcome.reviewPending":`Review pending`,"label.outcome.stageApproved":`Stage approved`,"label.outcome.stageNotApproved":`Stage not approved`,"label.outcome.stageRevoked":`Stage approval revoked`,"label.outcome.stageNotNeeded":`Stage decision not needed`,"label.outcome.stagePending":`Stage decision pending`,"label.outcome.budgetPaused":`Paused by budget limit`,"label.outcome.costUnreconciled":`Awaiting provider usage reconciliation`,"label.outcome.waitingForYou":`Waiting for your response`,"label.outcome.stoppedByYou":`Stopped by you`,"label.outcome.pausedByYou":`Paused by you`,"label.outcome.sessionPaused":`Session paused`,"label.outcome.serviceUnavailable":`Service unavailable`,"label.outcome.serviceCoolingDown":`Service temporarily paused`,"label.outcome.temporaryIssue":`Paused by a temporary issue`,"label.outcome.serviceError":`Stopped by a service error`,"label.outcome.needsPlan":`A new plan is needed`,"label.outcome.canResume":`Can resume`,"label.routing.team":`Team workflow`,"label.routing.individual":`Individual workflow`,"label.routing.research":`Research`,"label.routing.software":`Software work`,"label.routing.staged":`Step by step`,"label.routing.flexible":`Flexible workflow`,"label.routing.ongoing":`Ongoing`,"label.routing.defined":`Defined scope`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`Accelerator`,"label.resource.enforced":`Limits enforced`,"label.resource.advisory":`Recommendations only`,"label.resource.released":`Resources released`,"label.resource.kept":`Resources kept`,"mission.lastProgress":`Progress recorded before the stop`,"mission.nextResume":`The progress is saved. Run Argus again and it continues from where it stopped.`,"mission.nextResumeLive":`Argus will continue from the saved progress.`,"research.totalTime":`Total time`,"research.optionDelivery":`Delivery`,"research.optionCheckpoint":`Checkpoint`,"research.optionPending":`being written`,"operations.unavailableHere":`This is not available on this Argus.`,"operations.requestFailed":`That did not go through.`,"operations.technicalDetails":`Technical details`,"verticals.title":`Vertical Store`,"verticals.entry":`Verticals`,"verticals.openStore":`Open Vertical Store`,"verticals.paletteHint":`install · enable · update`,"verticals.intro":`A vertical gives Argus a research domain: its stages, roles, skills and checks. Install what your projects need and enable it per workspace.`,"verticals.hostedNote":`Verticals are provided by the host; you can enable or disable them for your workspace.`,"verticals.close":`Close vertical store`,"verticals.search":`Search verticals`,"verticals.searchPlaceholder":`Search by name, purpose or tag…`,"verticals.refreshCatalog":`Refresh catalog`,"verticals.refreshing":`Refreshing…`,"verticals.catalogSource":`Catalog: {source}`,"verticals.catalogRelease":`Release {tag}`,"verticals.catalogFetched":`Fetched {time}`,"verticals.catalogNever":`Catalog not fetched yet`,"verticals.catalogError":`The catalog could not be refreshed: {error}`,"verticals.kindFilter":`Filter by kind`,"verticals.tagFilter":`Filter by tag`,"verticals.clearFilters":`Clear filters`,"verticals.count":`{shown} of {total}`,"verticals.filter.all":`All`,"verticals.routingPath":`Category / domain / specialty`,"verticals.filter.installed":`Installed`,"verticals.filter.available":`Available`,"verticals.filter.builtin":`Built-in`,"verticals.kind.builtin":`Built-in`,"verticals.kind.package":`Bundled`,"verticals.kind.installed":`Installed`,"verticals.kind.available":`Available`,"verticals.enabled":`Enabled`,"verticals.disabledState":`Disabled`,"verticals.updateAvailable":`Update available`,"verticals.updateTo":`Update to {version}`,"verticals.installedVersion":`Installed {version}`,"verticals.catalogVersion":`Catalog {version}`,"verticals.requires":`Requires`,"verticals.shared":`Shares resources with`,"verticals.size":`Size`,"verticals.jumpTo":`Go to {name}`,"verticals.missingPython":`Needs: {packages} — install them into the Python environment Argus runs from.`,"verticals.runtimeIssues":`Installed version is incompatible with this Argus runtime: {issues}`,"verticals.installIssues":`Catalog installation/update is blocked by runtime requirements: {issues}`,"verticals.usedByOne":`Used by 1 project`,"verticals.usedBy":`Used by {count} projects`,"verticals.action.install":`Install`,"verticals.action.update":`Update`,"verticals.action.enable":`Enable`,"verticals.action.disable":`Disable`,"verticals.action.uninstall":`Uninstall`,"verticals.confirmUninstall":`Confirm uninstall`,"verticals.confirmUninstallHint":`Removes {name} from this Argus.`,"verticals.removeAnyway":`Remove anyway`,"verticals.operation.install":`Installing…`,"verticals.operation.update":`Updating…`,"verticals.operation.enable":`Enabling…`,"verticals.operation.disable":`Disabling…`,"verticals.operation.uninstall":`Uninstalling…`,"verticals.operationRunning":`Working…`,"verticals.operationFailed":`{action} failed`,"verticals.loading":`Loading verticals…`,"verticals.noMatches":`No verticals match these filters.`,"verticals.none":`No verticals are listed yet.`,"verticals.loadFailed":`Could not read the vertical list.`,"verticals.actionFailed":`That did not go through.`,"verticals.tooOld":`This Argus backend predates the vertical store. Update Argus, then reopen this page to manage verticals.`},wt={"language.english":`English`,"handshake.connecting":`正在准备 Argus`,"handshake.service":`服务`,"handshake.project":`项目`,"handshake.ready":`就绪`,"handshake.title":`正在准备 Argus`,"handshake.detail":`正在恢复你的工作区…`,"splash.starting":`Argus 启动中`,"rail.workbench":`工作台`,"rail.sessionsShortcut":`会话 · Ctrl/⌘ P`,"panel.backlog":`待办`,"panel.activity":`对话与进展`,"panel.journal":`日志`,"panel.roles":`角色`,"panel.project":`项目`,"panel.liveView":`Manager 实时项目视图`,"stream.jumpToLatest":`跳到最新`,"stream.toggleReasoning":`显示或隐藏 Agent 推理(⌘T)`,"stream.reasoning":`推理`,"stream.noLogs":`暂无活动`,"stream.system":`Argus 动态`,"stream.autonomous":`后台活动`,"stream.backgroundWork":`Argus 正在后台工作`,"stream.ready":`Argus 已就绪。你可以提问或安排下一项工作。`,"stream.historyLoading":`正在读取对话记录…`,"stream.historyError":`对话记录暂时读取失败。`,"stream.historyRetry":`重试`,"stream.fold.read":`读取了 {count} 个文件`,"stream.fold.search":`搜索了 {count} 次`,"stream.fold.fetch":`查阅了 {count} 个网页`,"stream.fold.edit":`修改了 {count} 个文件`,"stream.fold.tool":`使用了 {count} 次 {tool}`,"stream.fold.failed":`{count} 次失败`,"stream.fold.expand":`展开每一步`,"stream.fold.collapse":`收起`,"stream.repeated":`重复了 {count} 次,显示最近一次`,"stream.stepFailed":`失败`,"stream.stepResult":`结果`,"common.showRaw":`显示原始输出`,"doctor.lastEntry":`最近一条`,"operations.metric.calls":`今日模型调用`,"operations.metric.failed":`失败`,"operations.metric.slowest":`最慢的常规调用`,"operations.slo.healthy":`正常`,"operations.slo.degraded":`需要留意`,"operations.slo.loading":`加载中…`,"operations.validationFailures":`今日 {count} 条格式异常的事件`,"operations.outputLines":`共 {count} 行输出`,"operations.done":`已完成。`,"newDaemon.workdirPlaceholder":`留空 → ~/.argus-skill/workspaces/`,"operations.resetManager":`重新开始理解这段对话`,"language.chinese":`中文`,"language.switchTo":`切换到{language}`,"common.loading":`加载中…`,"common.retry":`重试`,"common.save":`保存`,"common.cancel":`取消`,"common.close":`关闭`,"common.settings":`设置`,"common.ready":`就绪`,"common.live":`实时`,"common.reconnecting":`正在重连`,"common.stale":`快照已过期`,"common.degraded":`快照异常`,"common.external":`外部`,"common.pause":`暂停`,"common.run":`运行`,"common.working":`处理中`,"common.local":`本地`,"common.all":`全部`,"common.unassigned":`未分配`,"common.closeSessions":`关闭会话列表`,"common.resizeSessions":`调整会话列表宽度`,"common.resizePreview":`调整预览区域宽度`,"common.expandPreview":`展开预览`,"time.justNow":`刚刚`,"time.minutesAgo":`{count}分钟前`,"time.hoursAgo":`{count}小时前`,"time.yesterdayAt":`昨天 {time}`,"connection.pairingTitle":`此浏览器尚未与 Argus 配对`,"connection.pairingDetail":`请打开这个站点的有效配对链接,或在下方粘贴配对链接或令牌。`,"connection.pairAgain":`重新配对`,"connection.pairingInput":`配对链接或令牌`,"connection.pairingPlaceholder":`粘贴新的配对链接或令牌`,"connection.pairingInvalid":`请输入有效的配对链接或令牌。`,"connection.connect":`连接`,"connection.unreachableTitle":`Argus 本地服务当前不可达`,"connection.unreachableDetail":`请保持 Argus Desktop 运行,等待本地服务就绪后再重试。`,"sidebar.collapse":`收起会话`,"sidebar.expand":`展开会话`,"sidebar.create":`创建项目`,"sidebar.find":`查找项目`,"sidebar.clearSearch":`清除搜索`,"sidebar.refreshFailed":`刷新失败 · 重试`,"sidebar.noSessions":`暂无会话`,"sidebar.noMatches":`没有匹配"{query}"的会话`,"sidebar.unnamedSession":`未命名会话`,"sidebar.daemonAlive":`Argus 后台在线`,"sidebar.updateRequired":`需要更新`,"sidebar.updateAvailable":`可更新`,"sidebar.updateAvailableHint":`后台仍在运行,执行器与网页版本不同。`,"sidebar.stopped":`后台已停止`,"sidebar.runningFor":`后台在线 · {uptime}`,"sidebar.lastActive":`上次活动 {time}`,"sidebar.manage":`管理 {name}`,"sidebar.manageHint":`重命名、暂停或删除`,"sidebar.resume":`继续`,"sidebar.resumeHint":`在 {workdir} 中继续工作`,"sidebar.resumeSuccess":`会话已恢复。`,"sidebar.resumeFailed":`无法恢复会话:{error}`,"sidebar.modelLoading":`正在加载后端和模型…`,"sidebar.modelUnavailable":`后端和模型信息不可用`,"sidebar.defaultModel":`默认模型`,"sidebar.openSettings":`打开设置`,"sidebar.compute":`算力队列与账户额度`,"sidebar.theme":`{current}主题;切换到{next}主题`,"landing.selectOrCreate":`从侧边栏选择一个会话,或创建新会话。`,"landing.noSessions":`还没有会话。创建一个即可开始。`,"landing.select":`选择项目`,"landing.new":`新建项目`,"landing.menu":`打开菜单`,"project.missingSwitched":`找不到项目“{requested}”,已切换到 {fallback}。`,"project.missingCreate":`找不到项目“{requested}”,请新建一个项目继续。`,"topbar.openSessions":`打开项目列表`,"topbar.externallyManaged":`由外部管理`,"topbar.pauseDaemon":`暂停 Argus`,"topbar.runDaemon":`运行 Argus`,"topbar.working":`Argus 正在处理你的请求`,"topbar.roleActive":`{role} 活跃中`,"topbar.roleIdle":`{role} 空闲`,"topbar.externalDaemonHint":`Argus 由此应用之外的服务管理,请前往相应位置控制。`,"topbar.manageSession":`管理会话`,"topbar.showPreview":`显示预览`,"topbar.showActivity":`显示动态`,"mobile.views":`视图`,"mobile.sessions":`项目`,"mobile.mission":`任务`,"mobile.activity":`对话`,"mobile.workbench":`工作台`,"mobile.map":`地图`,"mobile.preview":`文件`,"chat.working":`Argus 正在处理你的消息`,"chat.workingQuiet":`Argus 正在处理你的消息 · 仍在处理中,{quiet} 秒暂无新进展`,"chat.stopWaitingHint":`按 Esc 停止回复 · 按 Enter 追加消息`,"chat.queuedWhileRunning":`已排队 · 这条回复结束后立即处理;正在运行的任务会据此调整`,"chat.attachWhileRunning":`附件要等这条回复结束后再发送`,"chat.stepsLive":`正在工作 · 已 {count} 步`,"chat.stepsDone":`过程 {count} 步 · {seconds}`,"chat.stepFailed":`失败`,"chat.stepRaw":`原始参数`,"chat.messageArgus":`向 Argus 发送消息`,"chat.selectSession":`请选择会话…`,"chat.placeholder":`提问或安排工作`,"chat.routeLabel":`消息类型`,"chat.routeHint":`仅用于本条消息。Argus 根据实际需要选择单智能体或团队,问候直接回复。`,"chat.routeTask":`任务`,"chat.routeAuto":`自动`,"chat.routeChat":`对话`,"chat.attach":`添加文件`,"chat.attachHint":`支持 PNG、JPEG、WebP、PDF、Markdown/文本、JSON、CSV · 每条消息最多 {count} 个文件,单个 {perFile},总计 {total}`,"chat.attachDrop":`拖放文件以添加附件`,"chat.attachRemove":`移除附件 {name}`,"chat.attachUnsupported":`{name} 不受支持。请使用 PNG、JPEG、WebP、PDF、Markdown/文本、JSON 或 CSV。`,"chat.attachTooLarge":`{name} 超过单文件大小限制 {size}。`,"chat.attachTooMany":`每条消息最多只能附带 {count} 个文件。`,"chat.attachTotalTooLarge":`附件总大小超过 {size} 限制。`,"chat.attachmentUploadFailed":`附件上传失败:{error}`,"chat.uploadingAttachments":`正在上传附件`,"chat.rewriteHint":`把这段话整理得更清楚。改写结果会回到输入框,由你检查后发送。`,"chat.rewriteLabel":`整理这段话`,"chat.rewriting":`正在改写`,"chat.rewrite":`改写文字`,"chat.stopWaiting":`停止回复`,"chat.stopWaitingTitle":`停止处理这条消息`,"chat.stoppingReply":`正在停止当前回复…`,"chat.stopReplyRequested":`已收到停止请求,可以发送新消息。`,"chat.replyAlreadyFinished":`这次回复已经结束。`,"chat.stopReplyFailed":`服务端未能停止这次请求:{error}`,"chat.send":`发送消息`,"copy.message":`复制`,"copy.code":`复制代码`,"copy.copied":`已复制`,"help.title":`键盘快捷键`,"help.commands":`命令`,"help.palette":`打开命令面板`,"help.sessions":`展开或收起会话`,"help.managerChat":`聚焦 Manager 对话框`,"help.rewrite":`发送前改写当前提示词`,"help.reasoning":`显示或隐藏 Agent 推理`,"help.kiosk":`切换只读展示模式`,"help.composer":`聚焦输入框`,"help.send":`发送消息`,"help.newline":`插入换行`,"help.thisHelp":`打开此帮助`,"help.escape":`关闭浮层或停止等待`,"palette.placeholder":`输入命令或搜索…`,"palette.noMatches":`没有匹配的命令`,"palette.navigate":`↑↓ 导航`,"palette.run":`↵ 执行`,"palette.close":`Esc 关闭`,"palette.view":`视图`,"palette.action":`操作`,"palette.project":`项目`,"palette.newDaemon":`新建会话`,"palette.openTranscript":`打开对话记录`,"palette.openProject":`打开项目`,"palette.projectHint":`工作 · 记忆 · Agent`,"palette.openOperations":`打开运行控制`,"palette.operationsHint":`会话控制`,"palette.hideReasoning":`隐藏推理`,"palette.showReasoning":`显示推理`,"palette.exitKiosk":`退出展示模式`,"palette.enterKiosk":`进入展示模式`,"palette.messageArgus":`向 Argus 发送消息…`,"palette.stopWaiting":`停止当前回复`,"palette.stopContinuous":`停止持续任务`,"palette.startContinuous":`启动持续任务`,"palette.stopDaemon":`暂停 Argus`,"palette.startDaemon":`运行 Argus`,"slash.suggestions":`Slash 命令建议`,"mission.roleActive":`{role} 正在工作`,"mission.overview":`任务概览`,"mission.operations":`运行控制`,"role.manager":`统筹`,"role.manager.description":`理解你的目标,协调工作`,"role.planner":`规划`,"role.planner.description":`拆解问题,安排后续工作并调整计划`,"role.engineer":`执行`,"role.engineer.description":`查资料、写证明或代码,调用工具验证`,"role.reviewer":`复核`,"role.reviewer.description":`检查结果与证据,指出缺口`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`你`,"doctor.title":`诊断`,"doctor.subtitle":`Argus 状态检查与推荐的根因修复方案`,"doctor.recommended":`推荐修复`,"doctor.loadError":`无法加载诊断数据。`,"doctor.empty":`诊断暂无数据`,"doctor.daemonLog":`后台进程日志`,"settings.subtitle":`生效中的角色、预算和关键控制项`,"settings.loadError":`无法加载配置。`,"settings.empty":`未找到配置`,"settings.quickConfig":`快速配置`,"settings.appearance":`外观`,"settings.appearanceHint":`选择界面主题色。Logo 与图标始终保持黑白,不参与渐变。`,"settings.themeStyle":`主题色`,"settings.themeStyle.standard":`标准`,"settings.themeStyle.standardHint":`克制的黑、白、灰与蓝色。`,"settings.themeStyle.gradient":`渐变`,"settings.themeStyle.gradientHint":`经典 Argus 蓝金渐变背景。`,"settings.backend":`后端`,"settings.backendSource.env":`由服务器环境设置`,"settings.backendSource.persisted":`已保存的设置`,"settings.backendSource.default":`内置默认值`,"settings.backendWillSave":`应用后保存为{backend}。`,"settings.backendWillReplace":`应用后把已保存的{saved}改为{backend}。`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`后端已保存为{backend}。重启 Argus 后生效。`,"settings.backendUnsupported":`不支持的后端({backend})`,"settings.backendUnavailable":`后端信息不可用`,"settings.model":`模型`,"settings.trialAccount":`试用账号`,"settings.trialKeyHint":`额度用完后可在这里更换 Key,项目和对话会保留。`,"settings.changeTrialKey":`更换 Key`,"settings.applyModel":`应用`,"settings.modelPlaceholder":`auto(后端默认模型)`,"settings.connection":`连接`,"settings.webApi":`Web + REST API`,"settings.eventStream":`实时动态`,"settings.taskDaemon":`后台工作`,"settings.taskDaemonValue":`本地进程 · events.jsonl · 无 TCP 端口`,"chat.messageTooLong":`消息超过 32,000 字符,请缩短或作为附件上传。草稿已保留。`,"settings.required":`必须填写{field}`,"settings.advanced":`高级设置`,"settings.advancedHint":`预算、顾问模型、讲解强度、连接详情与原始配置`,"settings.mapModel":`地图`,"settings.mapModelFollows":`跟随前台模型`,"settings.mapModelSet":`地图讲解现在用 {model}。`,"settings.overrideTitle":`环境变量覆盖`,"settings.overrideHint":`设置特定的配置别名或环境变量键。`,"settings.namePlaceholder":`名称或别名,例如 manager_model`,"settings.valuePlaceholder":`值`,"settings.applyAdvanced":`应用环境变量覆盖`,"settings.applied":`设置已应用。请重启受影响的会话以使用新设置。`,"settings.modelAppliedToRoles":`所有角色现在都用 {model}。正在运行的会话要重启后才换。`,"settings.rolesRunning":`各角色当前实际使用:`,"settings.applyUnifies":`点“应用”会把它们统一成上面的模型。`,"settings.rolesTitle":`生效中的角色`,"settings.rawConfig":`原始配置`,"settings.group.limits":`限制`,"settings.group.safety":`安全`,"settings.group.interface":`界面`,"settings.knob.activeDaemons":`活动会话上限`,"settings.knob.activeDaemonsDoc":`此主机上可同时运行的后台会话数量上限。`,"settings.knob.safeMode":`安全模式`,"settings.knob.safeModeDoc":`启用更保守的运行时保护措施。`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`启用 Telegram 通知桥接。`,"settings.knob.showReasoning":`显示推理`,"settings.knob.showReasoningDoc":`在活动视图中显示角色推理过程。`,"settings.knob.operatorAvailable":`有人值守`,"settings.knob.operatorAvailableDoc":`关闭后不再向你提问:Argus 依据记录的假设自行决定,需要你授权的操作会直接停下。`,"noOperator.banner":`无人值守模式:已停止提问。Argus 会依据记录的假设自行决定,而不是问你。`,"noOperator.turnOff":`恢复提问`,"settings.source.notApplicable":`不适用于此模型`,"settings.source.vaultDefault":`能力库 / 默认值`,"settings.source.default":`默认值`,"settings.modelUnavailable":`不可用`,"settings.modelOfflineList":`离线列表:后端没有返回实时模型列表,显示的是本地目录。`,"settings.source.saved":`已保存的覆盖值`,"settings.source.environment":`环境变量`,"settings.source.hostConfig":`主机配置`,"settings.source.other":`解析后的配置`,"settings.value.enabled":`已启用`,"settings.value.disabled":`已停用`,"settings.effort.low":`低推理强度`,"settings.effort.medium":`中等推理强度`,"settings.effort.high":`高推理强度`,"settings.effort.xhigh":`超高推理强度`,"settings.role.curator":`知识维护`,"settings.role.curatorDoc":`维护并提炼可复用技能库。`,"settings.footer":`配置项同时显示易读标签和原始键。完整配置仍可通过以下命令查看:`,"identity.title":`身份`,"identity.subtitle":`本项目中 Argus 服务的对象`,"identity.placeholder":`描述 Argus 正在为谁工作,以及需要长期遵循的偏好…`,"identity.save":`保存身份`,"identity.saved":`身份已保存。`,"transcript.title":`对话记录`,"transcript.subtitle":`近期操作者 ↔ Argus 对话 · 请从输入框继续回复`,"transcript.empty":`暂无对话记录`,"transcript.operator":`操作者`,"new.createDaemon":`创建会话`,"new.createdIdle":`新会话已就绪。说一句你想做什么,工作就开始了。`,"new.createdStarting":`新会话已就绪,工作正在后台开始。`,"new.subtitle":`在这里保存你的对话和任务进度。`,"new.close":`关闭创建会话窗口`,"new.name":`名称`,"new.optional":`(可选)`,"new.namePlaceholder":`例如:AAAI 具身智能论文`,"new.workdir":`输出工作目录`,"new.workdirHint":`Agent 会在这里写入代码、论文、报告和实验结果。内部记忆仍保存在会话状态目录中。`,"new.objective":`目标`,"new.objectivePlaceholder":`留空则从对话开始,也可以填写一个立即启动的持续任务。`,"new.startsAfterCreate":`创建会话后立即启动任务`,"new.idleUntilMessage":`收到第一条消息前保持空闲`,"new.startsHint":`会话会立即打开,Argus 将在后台准备相关工作。`,"new.idleHint":`收到第一条消息后,Argus 会按需启动后台工作。`,"new.shortcut":`按 Ctrl/⌘+Enter 创建`,"new.creating":`正在创建…`,"new.createAndStart":`创建并启动`,"manage.daemon":`管理会话`,"manage.displayName":`显示名称`,"manage.executor":`后台工作`,"manage.running":`运行中`,"manage.runningExternally":`由外部运行`,"manage.paused":`未运行`,"manage.pauseHint":`中断当前操作并保留可恢复的进度。`,"manage.stopNow":`立即停止`,"manage.stopNowHint":`立即中断这个已验证的 daemon,停止后即可删除会话。`,"manage.externalHint":`此会话由此应用之外的服务管理。`,"manage.resumeHint":`继续执行队列中的研究工作。`,"manage.working":`处理中…`,"manage.resume":`继续`,"manage.deleteSession":`删除会话`,"manage.deleteHint":`删除的会话会移入回收站,之后仍可恢复。请先停止后台工作。`,"manage.delete":`删除…`,"manage.confirmQuestion":`将此会话移入回收站?`,"manage.confirmDelete":`确认删除`,"decision.operator":`操作者决策`,"decision.required":`需要你的决策`,"decision.whyBlocked":`这项任务记录的待答原因`,"decision.currentTask":`当前任务`,"decision.taskName":`任务:{title}`,"decision.otherTask":`其他待处理任务`,"decision.awaitingReply":`等待你的回复`,"decision.askedAt":`提问于 {time}`,"decision.evidence":`证据`,"decision.notePlaceholder":`添加 Manager 应采用的指导…`,"decision.resumeHint":`回答只针对这项任务,Manager 会据此检查它的下一步。`,"decision.later":`稍后处理`,"decision.applying":`已提交,Argus 正在开始处理…`,"decision.closeContinue":`关闭,后台继续`,"decision.stopCampaign":`停止持续任务`,"decision.useOption":`使用此选项`,"decision.sendAnswer":`发送回答`,"decision.noteRequired":`这个选项需要补充说明后才能提交。`,"artifact.preview":`结果预览`,"artifact.title":`结果`,"artifact.approvedEvidence":`已经检查确认的依据`,"artifact.downloading":`正在下载…`,"artifact.download":`下载`,"artifact.open":`打开`,"artifact.close":`关闭结果预览`,"artifact.unavailable":`无法预览`,"artifact.empty":`(空文件)`,"artifact.truncated":`预览已截断 · 请下载完整文件查看`,"artifact.htmlTooLarge":`HTML 文件过大,无法安全预览。请下载完整文件。`,"artifact.pdfDisabled":`此浏览器已禁用内嵌 PDF 预览。`,"artifact.openPdf":`打开 PDF`,"artifact.noPreview":`此文件类型无法安全地在线预览。`,"artifact.downloadHint":`请下载后使用本地应用查看。`,"task.details":`任务详情`,"task.stopLoop":`停止循环`,"task.done":`完成`,"task.skip":`跳过`,"task.close":`关闭任务详情`,"task.waitingOnYou":`等待你的回复`,"task.objective":`目标`,"task.noObjective":`(未记录目标)`,"task.untitled":`未命名任务`,"task.priority":`优先级`,"task.started":`开始时间`,"task.finished":`完成时间`,"task.outcome":`结果`,"task.iteration":`迭代`,"task.mode":`模式`,"task.autoIterate":`自动迭代`,"task.singlePass":`单次执行`,"task.cycles":`轮次`,"task.cost":`成本`,"task.lastError":`最近错误`,"task.notes":`备注`,"task.dependsOn":`依赖`,"task.dependsOnCount":`依赖前置任务 {count} 项`,"pending.reviewRespond":`查看并回复`,"pending.showOnMap":`在地图上查看`,"backlog.active":`进行中 · {count}`,"backlog.history":`历史记录 · {count}`,"backlog.noHistory":`暂无已完成工作`,"backlog.empty":`队列中没有工作。Argus 已准备好接收新任务。`,"backlog.viewDetails":`查看完整任务详情`,"backlog.iterating":`重复执行中`,"backlog.stopIterating":`停止重复执行`,"backlog.stop":`停止`,"backlog.markDone":`标记为完成`,"backlog.remove":`移除`,"mission.achievement":`Argus 成果`,"mission.elapsed":`耗时`,"mission.rejectedAttempts":`{count} 次方案被拒绝`,"mission.skillsLearned":`学习了 {count} 个 Skill`,"mission.artifacts":`产出 {count} 个文件`,"mission.waiting":`等待任务`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`已准备就绪,请分配一个任务开始工作。`,"mission.statusDone":`本次任务:{outcome} — 用时 {elapsed}。`,"mission.nextAfterReply":`请先回复这项任务的问题,再决定它的下一步。`,"mission.continuousDone":`连续运行已完成`,"mission.resumeContinuous":`恢复`,"mission.control":`任务控制`,"mission.attentionHealth":`系统出错——运行状态异常。`,"mission.attentionFailed":`任务失败——请查看下方详情。`,"mission.deliveryFailed":`任务在交付阶段失败——执行未能启动或完成。`,"mission.attentionStepFailed":`有一个步骤失败——请查看下方任务。`,"mission.attentionPaused":`任务已暂停——正在等待你的输入。`,"mission.showObjective":`显示完整目标`,"mission.showFullOutput":`查看完整输出`,"mission.stage":`阶段`,"mission.campaign":`持续任务`,"mission.totalElapsed":`总耗时`,"mission.round":`轮次`,"mission.mode":`模式`,"mission.summary":`本次完成`,"mission.deliveryCertified":`交付成果已通过审核`,"mission.taskCompleted":`任务已完成`,"mission.openResult":`打开成果`,"mission.viewTask":`查看任务`,"mission.taskPlan":`任务计划`,"mission.team":`团队`,"mission.waitingShort":`等待中`,"mission.roleWork":`角色工作`,"mission.showMore":`显示更多`,"mission.showLess":`收起`,"mission.done":`已完成`,"mission.inProgress":`进行中`,"mission.failed":`失败`,"mission.bannerPaused":`任务已暂停 — 等待你的操作。`,"mission.bannerError":`系统异常 — 健康状态已降级。`,"mission.bannerStepFailed":`某步骤失败:{step}`,"mission.elapsedAgo":`{elapsed} 前`,"mission.filteredBy":`按 {task} 筛选 · 清除`,"mission.allVisible":`全部可见任务`,"mission.roundNumber":`第 {count} 轮`,"mission.noRoleWork":`当前筛选下还没有持久化的 {role} 工作记录。`,"mission.researchDag":`任务路线`,"mission.active":`进行中`,"mission.noDag":`Planner 尚未向路线中添加任务。`,"mission.workingHypothesis":`当前假设 · 可随证据调整`,"mission.goalContribution":`对目标的作用`,"mission.temporaryRegressions":`预期的暂时取舍`,"mission.decisionRule":`何时调整、拆分或停止`,"mission.acceptance":`完成的标准`,"mission.nonGoals":`非目标`,"mission.capabilities":`能力`,"mission.capabilitiesUnlocked":`已解锁能力`,"mission.learnedCapability":`已学习能力`,"mission.learnedDuring":`在“{mission}”期间学习`,"mission.skillUnavailable":`当前快照中没有此 Skill 的内容。`,"mission.contentTruncated":`内容预览已截断`,"mission.knowledgeRetained":`已保留知识`,"mission.selfEvolution":`已保存的项目知识`,"mission.knowledgeSaved":`Argus 已保存这些能力和笔记,供本项目后续工作使用。`,"mission.noCapabilities":`尚未学习新能力。`,"mission.replay":`任务回放`,"mission.replayTimeline":`回放任务时间线`,"mission.roleFailed":`{role} 执行失败`,"mission.showingLatestEvent":`显示最近一条事件`,"mission.showingLastEvents":`显示最近 {count} 条事件`,"mission.waitingEvents":`等待结构化研究事件。`,"mission.startsAfter":`需等待前置任务 {count} 项`,"mission.hiddenTasks":`已隐藏前序任务 {count} 项 · 阻塞或失败 {failed} 项 · 已跳过 {skipped} 项`,"mission.projectFilesChanged":`项目文件有变更`,"mission.reviewInIde":`可打开 IDE 查看差异`,"research.currentWork":`当前工作`,"research.dagProgress":`任务路线进度`,"research.verifiedOutputs":`已验证输出`,"research.recentMilestones":`近期里程碑`,"research.liveProgress":`任务进展`,"research.artifact":`研究成果`,"research.canvas":`Manager 实时研究面板`,"research.previewArtifact":`预览成果`,"research.openLarge":`打开大尺寸预览`,"research.collapse":`收起预览`,"research.unavailable":`Manager 实时视图暂时不可用。`,"research.noPreview":`暂无预览`,"research.waiting":`等待中…`,"research.updating":`正在更新…`,"research.fileUnavailable":`文件已就绪,可点击上方下载按钮获取。`,"research.eventSourced":`基于事件的任务状态`,"research.downloadFailed":`下载失败`,"operations.title":`运行控制`,"operations.work":`工作`,"operations.runtime":`运行时`,"operations.system":`系统`,"operations.recovery":`恢复`,"operations.workInput":`工作输入`,"operations.workHint":`加入工作、指导当前任务、保存备注,或仅预览计划而不分派。`,"operations.action.task":`任务`,"operations.action.nudge":`指导`,"operations.action.note":`备注`,"operations.action.plan":`计划`,"operations.planPlaceholder":`要预览的目标;预览不会加入任务队列`,"operations.actionPlaceholder":`输入 {action} 内容`,"operations.previewPlan":`预览计划`,"operations.submitAction":`提交 {action}`,"operations.runtimeHint":`更改会话运行位置、重置 Manager 上下文,或安全重启会话。`,"operations.workdir":`工作目录`,"operations.workdirUpdated":`工作目录已更新。`,"operations.applyWorkdir":`应用工作目录`,"operations.replaceSlot":`替换活动会话`,"operations.sourceUpdate":`Argus 源码版本`,"operations.pullLatest":`拉取最新版本`,"operations.updateChecking":`正在检查已发布分支…`,"operations.updateRunning":`正在更新…`,"operations.updateAvailable":`有可用更新`,"operations.updateCurrent":`已是最新`,"operations.updateUnavailable":`当前工作树无法安全更新。`,"operations.currentRevision":`当前`,"operations.latestRevision":`最新`,"operations.updatePhase":`阶段`,"operations.updateRestart":`源码已更新。请重启工作台,再使用重载按钮让活动 daemon 在安全任务边界切换到新版本。`,"operations.skills":`Skills`,"operations.runSkill":`运行 Skill 命令`,"operations.metrics":`系统指标`,"operations.trash":`可恢复的回收站`,"operations.searchTrash":`搜索回收站`,"operations.trashEmpty":`回收站为空。`,"resource.title":`资源`,"resource.loading":`正在加载资源状态…`,"resource.devices":`设备:{count}`,"resource.inUse":`使用中 · {count}`,"resource.queue":`等待队列 · {count}`,"resource.none":`无`,"resource.timeLeft":`剩余 {ttl}`,"resource.noIntent":`未记录用途`,"resource.yieldRequest":`收到释放资源请求 · {reason}`,"resource.queuePosition":`队列第 {position} 位`,"label.status.inProgress":`进行中`,"label.status.waiting":`等待中`,"label.status.completed":`已完成`,"label.status.blocked":`暂时无法继续`,"label.status.failed":`失败`,"label.status.needsChanges":`需要修改`,"label.status.skipped":`已跳过`,"label.status.paused":`已暂停`,"label.status.cancelled":`已取消`,"label.status.available":`可用`,"label.status.unavailable":`不可用`,"label.status.inaccessible":`无法访问`,"label.status.limited":`部分受限`,"label.status.healthy":`状态正常`,"label.status.updated":`状态已更新`,"label.role.argus":`Argus`,"label.role.you":`你`,"label.work.task":`任务`,"label.work.action":`工作步骤`,"label.work.handoff":`给下一步的说明`,"label.work.review":`审核`,"label.work.planning":`规划`,"label.work.update":`动态`,"label.stage.scope":`范围定义`,"label.stage.research":`研究`,"label.stage.implementation":`方法实现`,"label.stage.experiment":`实验验证`,"label.stage.analysis":`结果分析`,"label.stage.writing":`论文写作`,"label.stage.review":`最终审核`,"label.stage.delivery":`成果交付`,"label.stage.unstaged":`未分阶段`,"label.frontier.reopened":`已重新开启一项前序任务`,"label.frontier.added":`已添加一项新任务`,"label.frontier.completed":`这部分工作已完成`,"label.frontier.revised":`已调整任务计划`,"label.frontier.narrowed":`已缩小任务范围`,"label.frontier.expanded":`已扩大任务范围`,"label.frontier.updated":`任务计划已更新`,"label.priority":`优先级 {priority}`,"label.outcome.workCompleted":`工作已完成`,"label.outcome.workPaused":`工作已暂停`,"label.outcome.workBlocked":`工作暂时无法继续`,"label.outcome.workFailed":`工作失败`,"label.outcome.workEnded":`工作已结束`,"label.outcome.workIncomplete":`工作尚未完成`,"label.outcome.workStalled":`工作停滞`,"label.outcome.workUpdated":`工作状态已更新`,"label.outcome.reviewPassed":`结果检查通过`,"label.outcome.reviewNeedsChanges":`检查后发现需要修改`,"label.outcome.reviewBlocked":`结果检查暂时无法继续`,"label.outcome.reviewOutdated":`审核结果已过期`,"label.outcome.reviewPending":`等待审核`,"label.outcome.stageApproved":`可以进入下一步`,"label.outcome.stageNotApproved":`还不能进入下一步`,"label.outcome.stageRevoked":`阶段批准已撤回`,"label.outcome.stageNotNeeded":`无需阶段审核`,"label.outcome.stagePending":`还没确定能否进入下一步`,"label.outcome.budgetPaused":`因预算上限暂停`,"label.outcome.costUnreconciled":`调用费用待对账(并非预算耗尽)`,"label.outcome.waitingForYou":`正在等待你的回复`,"label.outcome.stoppedByYou":`已由你停止`,"label.outcome.pausedByYou":`已由你暂停`,"label.outcome.sessionPaused":`会话已暂停`,"label.outcome.serviceUnavailable":`服务暂不可用`,"label.outcome.serviceCoolingDown":`服务暂时暂停`,"label.outcome.temporaryIssue":`因临时问题暂停`,"label.outcome.serviceError":`因服务错误停止`,"label.outcome.needsPlan":`需要制定新计划`,"label.outcome.canResume":`可以继续`,"label.routing.team":`团队协作`,"label.routing.individual":`单独执行`,"label.routing.research":`研究任务`,"label.routing.software":`软件工作`,"label.routing.staged":`分步执行`,"label.routing.flexible":`灵活流程`,"label.routing.ongoing":`持续进行`,"label.routing.defined":`范围明确`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`加速设备`,"label.resource.enforced":`强制执行限制`,"label.resource.advisory":`仅提供建议`,"label.resource.released":`已释放资源`,"label.resource.kept":`继续占用资源`,"mission.lastProgress":`停下之前记录的进展`,"mission.nextResume":`进度已保存,重新运行 Argus 就会从停下的地方继续。`,"mission.nextResumeLive":`Argus 会从已保存的进度继续。`,"research.totalTime":`累计用时`,"research.optionDelivery":`交付`,"research.optionCheckpoint":`检查点`,"research.optionPending":`生成中`,"operations.unavailableHere":`这项功能在当前的 Argus 上不提供。`,"operations.requestFailed":`这次操作没有成功。`,"operations.technicalDetails":`技术细节`,"verticals.title":`垂域商店`,"verticals.entry":`垂域商店`,"verticals.openStore":`打开垂域商店`,"verticals.paletteHint":`安装 · 启用 · 更新`,"verticals.intro":`垂域为 Argus 提供一个研究领域的阶段、角色、技能与检查项。按项目需要安装,并为各工作区分别启用。`,"verticals.hostedNote":`垂域由服务方提供;你可以为自己的工作区启用或停用。`,"verticals.close":`关闭垂域商店`,"verticals.search":`搜索垂域`,"verticals.searchPlaceholder":`按名称、用途或标签搜索…`,"verticals.refreshCatalog":`刷新目录`,"verticals.refreshing":`正在刷新…`,"verticals.catalogSource":`目录来源:{source}`,"verticals.catalogRelease":`版本 {tag}`,"verticals.catalogFetched":`{time} 获取`,"verticals.catalogNever":`尚未获取目录`,"verticals.catalogError":`目录刷新失败:{error}`,"verticals.kindFilter":`按类型筛选`,"verticals.tagFilter":`按标签筛选`,"verticals.clearFilters":`清除筛选`,"verticals.count":`显示 {shown} / {total}`,"verticals.filter.all":`全部`,"verticals.routingPath":`分类 / 领域 / 专项`,"verticals.filter.installed":`已安装`,"verticals.filter.available":`可安装`,"verticals.filter.builtin":`内置`,"verticals.kind.builtin":`内置`,"verticals.kind.package":`随包提供`,"verticals.kind.installed":`已安装`,"verticals.kind.available":`可安装`,"verticals.enabled":`已启用`,"verticals.disabledState":`已停用`,"verticals.updateAvailable":`有新版本`,"verticals.updateTo":`更新至 {version}`,"verticals.installedVersion":`已安装 {version}`,"verticals.catalogVersion":`目录版本 {version}`,"verticals.requires":`依赖`,"verticals.shared":`共享资源`,"verticals.size":`大小`,"verticals.jumpTo":`查看 {name}`,"verticals.missingPython":`缺少 Python 包:{packages}。请把它们安装到运行 Argus 的那个 Python 环境里。`,"verticals.runtimeIssues":`已安装版本与当前 Argus 运行时不兼容:{issues}`,"verticals.installIssues":`目录版本的安装/更新被运行时要求阻止:{issues}`,"verticals.usedByOne":`1 个项目在用`,"verticals.usedBy":`{count} 个项目在用`,"verticals.action.install":`安装`,"verticals.action.update":`更新`,"verticals.action.enable":`启用`,"verticals.action.disable":`停用`,"verticals.action.uninstall":`卸载`,"verticals.confirmUninstall":`确认卸载`,"verticals.confirmUninstallHint":`将从这台 Argus 移除 {name}。`,"verticals.removeAnyway":`仍要移除`,"verticals.operation.install":`正在安装…`,"verticals.operation.update":`正在更新…`,"verticals.operation.enable":`正在启用…`,"verticals.operation.disable":`正在停用…`,"verticals.operation.uninstall":`正在卸载…`,"verticals.operationRunning":`处理中…`,"verticals.operationFailed":`{action}失败`,"verticals.loading":`正在读取垂域…`,"verticals.noMatches":`没有符合筛选条件的垂域。`,"verticals.none":`目前还没有可用的垂域。`,"verticals.loadFailed":`无法读取垂域列表。`,"verticals.actionFailed":`这次操作没有成功。`,"verticals.tooOld":`当前的 Argus 后端还没有垂域商店。请先更新 Argus,再打开这里管理垂域。`};function Tt(){try{let e=localStorage.getItem(St);if(e===`en`||e===`zh-CN`)return e}catch{}return navigator.language.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}function Et(e,t={},n=Tt()){let r=(n===`zh-CN`?wt[e]:Ct[e])??e;return Dt.has(e)&&(r=r.replace(/\bArgus\b/g,bt().name)),r.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??`{${n}}`))}var Dt=new Set([`handshake.connecting`,`handshake.title`,`splash.starting`,`connection.pairingTitle`,`topbar.pauseDaemon`,`topbar.runDaemon`,`chat.messageArgus`,`palette.messageArgus`,`palette.stopDaemon`,`palette.startDaemon`,`role.system`,`label.role.argus`]),O=(0,x.createContext)({locale:`en`,setLocale:()=>void 0,t:(e,t)=>Et(e,t,`en`)});function Ot({children:e}){let[t,n]=(0,x.useState)(Tt),r=e=>{try{localStorage.setItem(St,e)}catch{}n(e)};(0,x.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,x.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Et(e,n,t)}),[t]);return(0,D.jsx)(O.Provider,{value:i,children:e})}function kt(){return(0,x.useContext)(O)}var At=class extends x.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){if(!this.state.failed)return this.props.children;let e=this.props.locale===`zh-CN`;return(0,D.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-bg p-8 text-ink`,role:`alert`,children:(0,D.jsxs)(`section`,{className:`max-w-lg rounded-xl border border-line bg-panel p-8 shadow-lg`,children:[(0,D.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-widest text-blue`,children:bt().name}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:e?`工作台暂时无法显示`:`The workspace could not be displayed`}),(0,D.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`页面资源未能正确加载。后端任务不会因此被停止;你仍可使用桌面菜单查看日志或设置。重新加载会丢弃页面中尚未发送的输入。`:`A page resource failed to load. Backend work has not been stopped. Desktop menus remain available for logs and settings. Reloading discards unsent input on this page.`}),(0,D.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,D.jsx)(`button`,{type:`button`,className:`rounded-md bg-blue px-4 py-2 text-sm text-white`,onClick:()=>window.location.reload(),children:e?`重新加载工作台`:`Reload workspace`}),(0,D.jsx)(`button`,{type:`button`,className:`rounded-md border border-line px-4 py-2 text-sm`,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`view`,`activity`),window.location.assign(e.toString())},children:e?`返回对话页面`:`Return to conversation`})]})]})})}};function jt(){let e=(0,x.useSyncExternalStore)(xe,be,()=>!1),{locale:t}=kt();if(!e)return null;let n=t===`zh-CN`;return(0,D.jsxs)(`div`,{role:`status`,className:`fixed left-1/2 top-3 z-[110] flex w-[min(92vw,42rem)] -translate-x-1/2 items-center gap-3 rounded-xl border border-blue/40 bg-panel px-4 py-3 text-sm text-ink shadow-xl`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`strong`,{children:n?`页面已更新`:`Page update available`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:n?`刷新后显示最新选项和功能。请先复制未发送的内容。`:`Refresh for the latest options and features. Copy any unsent text first.`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`shrink-0 rounded-md border border-blue/40 px-3 py-2 text-xs text-blue`,children:n?`刷新页面`:`Refresh page`})]})}var k={ADVISOR_CONSULTATION_REQUESTED:`advisor.consultation.requested`,ADVISOR_CONSULTATION_COMPLETED:`advisor.consultation.completed`,ADVISOR_CONSULTATION_FAILED:`advisor.consultation.failed`,ADVISOR_CONSULTATION_CANCELLED:`advisor.consultation.cancelled`,ADVISOR_CONSULTATION_TIMED_OUT:`advisor.consultation.timed_out`,ADVISOR_CONSULTATION_MODEL_MISMATCH:`advisor.consultation.model_mismatch`,LIFE_MANAGER_SUPERVISION_ISSUED:`life.manager.supervision.issued`,LIFE_MANAGER_SUPERVISION_APPLIED:`life.manager.supervision.applied`,LIFE_MANAGER_SUPERVISION_FAILED:`life.manager.supervision.failed`,LIFE_PEER_MESSAGE_PROCESSED:`life.peer.message.processed`,LIFE_CONFIG_PARSE_FAILED:`life.config.parse_failed`,AGENT_IO_START:`agent.io.start`,AGENT_IO_STREAM:`agent.io.stream`,AGENT_IO_COMPLETE:`agent.io.complete`,AGENT_IO_ERROR:`agent.io.error`,USAGE_RECORDED:`usage.recorded`,ACCOUNTING_JOURNAL_REPAIRED:`accounting.journal_repaired`,PROVIDER_REQUEST_STARTED:`provider.request.started`,PROVIDER_REQUEST_COMPLETED:`provider.request.completed`,PROVIDER_REQUEST_DENIED:`provider.request.denied`,CODEX_UTIL_COMPLETED:`codex.util.completed`,SKILL_COST_COMPLETED:`skill.cost.completed`,BUDGET_RESERVATION_CREATED:`budget.reservation.created`,BUDGET_RESERVATION_DENIED:`budget.reservation.denied`,BUDGET_RESERVATION_SETTLED:`budget.reservation.settled`,BUDGET_RESERVATION_RELEASED:`budget.reservation.released`,BUDGET_UNPRICED_BLOCKED:`budget.unpriced.blocked`,BUDGET_UNPRICED_ACKNOWLEDGED:`budget.unpriced.acknowledged`,LOOP_START:`loop.start`,LOOP_DONE:`loop.done`,ROUND_START:`round.start`,ROUND_MAIN_COMPLETED:`round.main.completed`,ROUND_REVIEW_STARTED:`round.review.started`,ROUND_REVIEW_DEFERRED:`round.review.deferred`,ROUND_REVIEW_COMPLETED:`round.review.completed`,ROUND_CHECKPOINT_RECORDED:`round.checkpoint.recorded`,ROUND_CHECKPOINT_FAILED:`round.checkpoint.failed`,ROUND_SECRET_REDACTED:`round.secret_redacted`,ROUND_ESCALATED:`round.escalated`,ROUND_STALL:`round.stall`,ROUND_REVIEWER_BACKEND_FAILURE:`round.reviewer_backend_failure`,ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF:`round.reviewer_backend_failure.backoff`,ROUND_BACKEND_FAILURE_BACKOFF:`round.backend_failure.backoff`,ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED:`round.backend_failure.hold_interrupted`,ROUND_WATCHDOG_RETRY:`round.watchdog.retry`,ROUND_WATCHDOG_RETRY_EXHAUSTED:`round.watchdog.retry_exhausted`,ROUND_MODEL_CONFIGURATION_ERROR:`round.model_configuration_error`,ROUND_PROVIDER_TURN_CAP_RESTART:`round.provider_turn_cap.restart`,ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART:`round.provider_turn_cap.reviewer_restart`,ROUND_ORPHAN_PROCESS_GROUP:`round.orphan_process_group`,ROUND_EXTERNAL_WORK_WAIT_STARTED:`round.external_work_wait.started`,ROUND_EXTERNAL_WORK_WAIT_COMPLETED:`round.external_work_wait.completed`,ROUND_EXTERNAL_WORK_REVIEW_REQUIRED:`round.external_work_review.required`,ROUND_EXTERNAL_WORK_REVIEW_COMPLETED:`round.external_work_review.completed`,ROLE_SESSION_TURN:`role.session.turn`,ENGINEER_PROGRESS:`engineer.progress`,ENGINEER_SKILL_MAINTENANCE_COMPLETED:`engineer.skill_maintenance.completed`,LIFE_STATUS:`life.status`,LIFE_PHASE_STARTED:`life.phase.started`,LIFE_MISSION_STARTED:`life.mission.started`,LIFE_MISSION_COMPLETED:`life.mission.completed`,LIFE_MISSION_FAILED:`life.mission.failed`,LIFE_MISSION_SKIPPED:`life.mission.skipped`,LIFE_MISSION_ORPHANED:`life.mission.orphaned`,LIFE_MISSION_REQUEUED:`life.mission.requeued`,LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED:`life.mission.provider_configuration_disabled`,LIFE_ITERATION_CONTINUED:`life.iteration.continued`,LIFE_REVIEW_WAIVED:`life.review.waived`,LIFE_POST_MISSION_STOP:`life.post_mission.stop`,LIFE_EXECUTION_HOST_BLOCKED:`life.execution_host.blocked`,LIFE_AUTH_FAILURE:`life.auth_failure`,LIFE_SUPERVISOR_ERROR:`life.supervisor.error`,LIFE_LEARNED_VERTICAL_PROMOTED:`life.learned_vertical.promoted`,LIFE_LEARNED_VERTICAL_PROMOTION_FAILED:`life.learned_vertical.promotion_failed`,LIFE_MANAGER_INTENT_STARTED:`life.manager.intent.started`,LIFE_MANAGER_INTENT_COMPLETED:`life.manager.intent.completed`,LIFE_MANAGER_INTENT_FAILED:`life.manager.intent.failed`,LIFE_MANAGER_INTENT_SUPERSEDED:`life.manager.intent.superseded`,LIFE_MANAGER_GOAL_CONTRACT_FAILED:`life.manager.goal_contract.failed`,LIFE_MANAGER_STAGE_DECISION:`life.manager.stage_decision`,LIFE_MANAGER_PLAN_CHALLENGE_DECIDED:`life.manager.plan_challenge.decided`,LIFE_MANAGER_FEEDBACK_PERSISTED:`life.manager.feedback.persisted`,LIFE_MANAGER_FEEDBACK_UNRESOLVED:`life.manager.feedback.unresolved`,LIFE_MANAGER_FEEDBACK_EXHAUSTED:`life.manager.feedback.exhausted`,LIFE_MANAGER_PROJECT_REPORT:`life.manager.project_report`,LIFE_MANAGER_PROJECT_REPORT_FAILED:`life.manager.project_report.failed`,LIFE_VERTICAL_RESOLVED:`life.vertical.resolved`,LIFE_MANAGER_BACKEND_RESOLVED:`life.manager.backend_resolved`,LIFE_PLANNER_BACKEND_RESOLVED:`life.planner.backend_resolved`,LIFE_ENGINEER_BACKEND_RESOLVED:`life.engineer.backend_resolved`,LIFE_REVIEWER_BACKEND_RESOLVED:`life.reviewer.backend_resolved`,LIFE_CURATOR_BACKEND_RESOLVED:`life.curator.backend_resolved`,LIFE_PLANNER_START:`life.planner.start`,LIFE_PLANNER_PREVIEW_SKIPPED:`life.planner.preview_skipped`,LIFE_PLANNER_NORMALIZED:`life.planner.normalized`,LIFE_PLANNER_TASK_ADDED:`life.planner.task_added`,LIFE_PLANNER_TASK_SKIPPED:`life.planner.task_skipped`,LIFE_PLANNER_VERDICT:`life.planner.verdict`,LIFE_PLANNER_WAITING:`life.planner.waiting`,LIFE_PLANNER_WAITING_WOKEN:`life.planner.waiting_woken`,LIFE_PLANNER_TERMINAL_IDLE:`life.planner.terminal_idle`,LIFE_PLANNER_VERIFICATION_PROBE:`life.planner.verification_probe`,LIFE_PLANNER_STALL_ESCALATION:`life.planner.stall_escalation`,LIFE_PLANNER_DEPENDENCY_DROPPED:`life.planner.dependency_dropped`,LIFE_PLANNER_PARALLEL_DROPPED:`life.planner.parallel_dropped`,LIFE_PLANNER_ERROR:`life.planner.error`,LIFE_PLANNER_DEFERRED:`life.planner.deferred`,LIFE_PLANNER_SUPERSEDED:`life.planner.superseded`,LIFE_PLANNER_WAIT_OVERRIDDEN:`life.planner.wait_overridden`,LIFE_PLANNER_WAITING_CONTRACT_NORMALIZED:`life.planner.waiting_contract.normalized`,LIFE_PLANNER_EXTERNAL_POLL_SUPPRESSED:`life.planner.external_poll_suppressed`,LIFE_PLANNER_VERDICT_DISCARDED:`life.planner.verdict.discarded`,LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED:`life.planner.final_submission_skipped`,LIFE_PLANNER_CONTINUATION_REQUIRED:`life.planner.continuation_required`,LIFE_PLANNER_COMPLETION_REJECTED:`life.planner.completion_rejected`,LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED:`life.planner.completion_circuit_opened`,LIFE_PLANNER_COMPLETION_CIRCUIT_HOLDING:`life.planner.completion_circuit_holding`,LIFE_PLANNER_COMPLETION_CIRCUIT_NOTIFY_FAILED:`life.planner.completion_circuit.notify_failed`,PLAN_DRAFT_START:`plan.draft.start`,PLAN_DRAFT_DONE:`plan.draft.done`,PLAN_DRAFT_FAILED:`plan.draft.failed`,LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED:`life.runtime_failure.circuit_opened`,LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED:`life.runtime_failure.circuit_blocked`,LIFE_RUNTIME_FAILURE_CANARY_PASSED:`life.runtime_failure.canary_passed`,LIFE_RUNTIME_INCIDENT_DETECTED:`life.runtime.incident.detected`,LIFE_RUNTIME_INCIDENT_RECOVERED:`life.runtime.incident.recovered`,LIFE_RUNTIME_INCIDENT_ESCALATED:`life.runtime.incident.escalated`,LIFE_PLAN_REVISION_PROPOSED:`life.plan.revision.proposed`,LIFE_PLAN_REVISION_REJECTED:`life.plan.revision.rejected`,LIFE_PLAN_REVISION_COMMITTED:`life.plan.revision.committed`,LIFE_PLAN_NODE_SUPERSEDED:`life.plan.node.superseded`,LIFE_PLAN_REVISION_ROLLED_BACK:`life.plan.revision.rolled_back`,LIFE_RESEARCH_SECOND_READING:`life.research.second_reading`,LIFE_LETTER_WRITTEN:`life.letter.written`,LIFE_BUDGET_PAUSE:`life.budget.pause`,LIFE_LIFECYCLE_BLOCK:`life.lifecycle.block`,LIFE_LIFECYCLE_TRANSITION:`life.lifecycle.transition`,LIFE_INBOX_QUEUED:`life.inbox.queued`,LIFE_INBOX_DRAINED:`life.inbox.drained`,LIFE_OPERATOR_QUESTION_PENDING:`life.operator_question.pending`,LIFE_OPERATOR_QUESTION_ANSWERED:`life.operator_question.answered`,LIFE_DAEMON_IDLE_TIMEOUT:`life.daemon.idle_timeout`,LIFE_DAEMON_READY:`life.daemon.ready`,LIFE_DAEMON_DEGRADED:`life.daemon.degraded`,PROJECT_COMPLETED:`project.completed`,PROJECT_COMPLETION_REFUSED:`project.completion_refused`,DAEMON_PARKED:`daemon.parked`,DAEMON_COMMAND_SUBMITTED:`daemon.command.submitted`,DAEMON_COMMAND_COMPLETED:`daemon.command.completed`,DAEMON_COMMAND_REJECTED:`daemon.command.rejected`,IDEA_SEARCH_STARTED:`idea.search.started`,IDEA_SEARCH_COMPLETED:`idea.search.completed`,IDEA_SEARCH_SKIPPED:`idea.search.skipped`,IDEA_PORTFOLIO_FORMED:`idea.portfolio.formed`,IDEA_PORTFOLIO_NESTED_SKIPPED:`idea.portfolio.nested_skipped`,VENUE_RESEARCH_STARTED:`venue.research.started`,VENUE_RESEARCH_COMPLETED:`venue.research.completed`,RESEARCH_ACHIEVEMENT_CERTIFIED:`research.achievement.certified`,SKILL_LIBRARY_AVAILABLE:`skill.library.available`,SKILL_CREATED:`skill.created`,SKILL_UPDATED:`skill.updated`,SKILL_ARCHIVED:`skill.archived`,SKILL_TIDIED:`skill.tidied`,SKILL_HISTORY_COMPRESSED:`skill.history.compressed`,SKILL_EVOLUTION_COMPLETED:`skill.evolution.completed`,TEAM_LEARNING_REVIEW_STARTED:`team.learning.review.started`,TEAM_LEARNING_REVIEW_SKIPPED:`team.learning.review.skipped`,TEAM_LEARNING_REVIEW_COMPLETED:`team.learning.review.completed`,TEAM_LEARNING_REVIEW_FAILED:`team.learning.review.failed`,TEAM_LEARNING_PROMOTION_QUARANTINED:`team.learning.promotion.quarantined`,SELF_LEARNING_REVIEW_STARTED:`self.learning.review.started`,SELF_LEARNING_REVIEW_COMPLETED:`self.learning.review.completed`,SELF_LEARNING_REVIEW_FAILED:`self.learning.review.failed`,DOMAIN_PROMOTION:`domain.promotion`,WIKI_INITIALIZED:`wiki.initialized`,WIKI_HOOK_WARNING:`wiki.hook.warning`,WIKI_CREATED:`wiki.created`,WIKI_UPDATED:`wiki.updated`,WIKI_RETIRED:`wiki.retired`,WIKI_PROMOTION_PROMOTED:`wiki.promotion.promoted`,WIKI_PROMOTION_DEMOTED:`wiki.promotion.demoted`,WIKI_RETIRED_COMPRESSED:`wiki.retired.compressed`,WIKI_EVOLUTION_COMPLETED:`wiki.evolution.completed`,KNOWLEDGE_LEARNED:`knowledge.learned`,KNOWLEDGE_RECALLED:`knowledge.recalled`,OPERATOR_ALERT:`operator_alert`,MANAGER_LIVE_VIEW_UPDATED:`manager.live_view.updated`,MANAGER_LIVE_VIEW_REJECTED:`manager.live_view.rejected`,MANAGER_TURN_STARTED:`manager.turn.started`,MANAGER_TURN_CANCELLED:`manager.turn.cancelled`,USER_NOTE:`user.note`,UI_OPERATOR:`ui.operator`,UI_ARGUS:`ui.argus`},Mt={"loop.started":k.LOOP_START,"loop.completed":k.LOOP_DONE,"round.started":k.ROUND_START,"mission.started":k.LIFE_MISSION_STARTED,"mission.completed":k.LIFE_MISSION_COMPLETED,"mission.error":k.LIFE_MISSION_FAILED};k.ADVISOR_CONSULTATION_COMPLETED,k.ADVISOR_CONSULTATION_FAILED,k.ADVISOR_CONSULTATION_CANCELLED,k.ADVISOR_CONSULTATION_TIMED_OUT,k.ADVISOR_CONSULTATION_MODEL_MISMATCH,k.LIFE_MANAGER_SUPERVISION_APPLIED,k.LIFE_MANAGER_SUPERVISION_FAILED,k.LIFE_PEER_MESSAGE_PROCESSED,k.LIFE_CONFIG_PARSE_FAILED,k.LIFE_MANAGER_BACKEND_RESOLVED,k.LIFE_PLANNER_BACKEND_RESOLVED,k.LIFE_ENGINEER_BACKEND_RESOLVED,k.LIFE_REVIEWER_BACKEND_RESOLVED,k.LIFE_CURATOR_BACKEND_RESOLVED,k.LOOP_START,k.LOOP_DONE,k.ROUND_START,k.ROUND_MAIN_COMPLETED,k.ROUND_REVIEW_DEFERRED,k.ROUND_REVIEW_COMPLETED,k.ROUND_CHECKPOINT_RECORDED,k.ROUND_CHECKPOINT_FAILED,k.ROUND_SECRET_REDACTED,k.ROUND_ESCALATED,k.ROUND_STALL,k.ROUND_REVIEWER_BACKEND_FAILURE,k.ENGINEER_SKILL_MAINTENANCE_COMPLETED,k.SKILL_LIBRARY_AVAILABLE,k.SKILL_CREATED,k.SKILL_UPDATED,k.SKILL_ARCHIVED,k.SKILL_TIDIED,k.SKILL_HISTORY_COMPRESSED,k.SKILL_EVOLUTION_COMPLETED,k.WIKI_INITIALIZED,k.WIKI_HOOK_WARNING,k.WIKI_CREATED,k.WIKI_UPDATED,k.WIKI_RETIRED,k.WIKI_PROMOTION_PROMOTED,k.WIKI_PROMOTION_DEMOTED,k.WIKI_RETIRED_COMPRESSED,k.WIKI_EVOLUTION_COMPLETED,k.KNOWLEDGE_LEARNED,k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MANAGER_INTENT_STARTED,k.LIFE_MANAGER_INTENT_COMPLETED,k.LIFE_MANAGER_INTENT_FAILED,k.LIFE_MANAGER_STAGE_DECISION,k.LIFE_MANAGER_PLAN_CHALLENGE_DECIDED,k.LIFE_VERTICAL_RESOLVED,k.LIFE_PLANNER_START,k.LIFE_PLANNER_PREVIEW_SKIPPED,k.LIFE_PLANNER_TASK_ADDED,k.LIFE_PLANNER_TASK_SKIPPED,k.LIFE_PLANNER_DEPENDENCY_DROPPED,k.LIFE_PLANNER_PARALLEL_DROPPED,k.LIFE_PLANNER_VERDICT,k.LIFE_PLANNER_WAITING,k.LIFE_PLANNER_WAITING_WOKEN,k.LIFE_PLANNER_TERMINAL_IDLE,k.LIFE_PLANNER_VERIFICATION_PROBE,k.LIFE_PLANNER_STALL_ESCALATION,k.LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED,k.LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED,k.LIFE_RUNTIME_FAILURE_CANARY_PASSED,k.LIFE_RUNTIME_INCIDENT_DETECTED,k.LIFE_RUNTIME_INCIDENT_RECOVERED,k.LIFE_RUNTIME_INCIDENT_ESCALATED,k.LIFE_PLAN_REVISION_PROPOSED,k.LIFE_PLAN_REVISION_REJECTED,k.LIFE_PLAN_REVISION_COMMITTED,k.LIFE_PLAN_NODE_SUPERSEDED,k.LIFE_RESEARCH_SECOND_READING,k.LIFE_LETTER_WRITTEN,k.LIFE_BUDGET_PAUSE,k.BUDGET_RESERVATION_DENIED,k.BUDGET_UNPRICED_BLOCKED,k.LIFE_LIFECYCLE_BLOCK,k.LIFE_LIFECYCLE_TRANSITION,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.LIFE_INBOX_QUEUED,k.LIFE_INBOX_DRAINED,k.LIFE_DAEMON_IDLE_TIMEOUT,k.PROJECT_COMPLETED,k.PROJECT_COMPLETION_REFUSED,k.DAEMON_PARKED,k.DAEMON_COMMAND_COMPLETED,k.DAEMON_COMMAND_REJECTED,k.IDEA_SEARCH_STARTED,k.IDEA_SEARCH_COMPLETED,k.IDEA_SEARCH_SKIPPED,k.VENUE_RESEARCH_STARTED,k.VENUE_RESEARCH_COMPLETED,k.RESEARCH_ACHIEVEMENT_CERTIFIED,k.LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED,k.LIFE_ITERATION_CONTINUED,k.LIFE_REVIEW_WAIVED,k.LIFE_POST_MISSION_STOP,k.LIFE_EXECUTION_HOST_BLOCKED,k.LIFE_AUTH_FAILURE,k.LIFE_SUPERVISOR_ERROR,k.LIFE_LEARNED_VERTICAL_PROMOTED,k.LIFE_LEARNED_VERTICAL_PROMOTION_FAILED,k.LIFE_MANAGER_INTENT_SUPERSEDED,k.LIFE_MANAGER_GOAL_CONTRACT_FAILED,k.LIFE_MANAGER_FEEDBACK_PERSISTED,k.LIFE_MANAGER_FEEDBACK_EXHAUSTED,k.LIFE_MANAGER_PROJECT_REPORT_FAILED,k.LIFE_PLANNER_DEFERRED,k.LIFE_PLANNER_SUPERSEDED,k.LIFE_PLANNER_WAIT_OVERRIDDEN,k.LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED,k.LIFE_PLANNER_CONTINUATION_REQUIRED,k.LIFE_PLANNER_COMPLETION_REJECTED,k.LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED,k.PLAN_DRAFT_DONE,k.PLAN_DRAFT_FAILED,k.LIFE_PLAN_REVISION_ROLLED_BACK,k.ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED,k.ROUND_WATCHDOG_RETRY,k.ROUND_WATCHDOG_RETRY_EXHAUSTED,k.ROUND_MODEL_CONFIGURATION_ERROR,k.ROUND_PROVIDER_TURN_CAP_RESTART,k.ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART,k.ROUND_ORPHAN_PROCESS_GROUP,k.ROUND_EXTERNAL_WORK_WAIT_STARTED,k.ROUND_EXTERNAL_WORK_WAIT_COMPLETED,k.ROUND_EXTERNAL_WORK_REVIEW_REQUIRED,k.ROUND_EXTERNAL_WORK_REVIEW_COMPLETED,k.LIFE_DAEMON_DEGRADED,k.IDEA_PORTFOLIO_FORMED,k.TEAM_LEARNING_REVIEW_STARTED,k.TEAM_LEARNING_REVIEW_COMPLETED,k.TEAM_LEARNING_REVIEW_FAILED,k.TEAM_LEARNING_PROMOTION_QUARANTINED,k.DOMAIN_PROMOTION,k.MANAGER_LIVE_VIEW_UPDATED,k.MANAGER_TURN_STARTED,k.MANAGER_TURN_CANCELLED,k.USER_NOTE,k.UI_OPERATOR,k.UI_ARGUS,k.OPERATOR_ALERT,k.AGENT_IO_START,k.AGENT_IO_COMPLETE,k.AGENT_IO_ERROR,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.USAGE_RECORDED;function Nt(e){let t=String(e??``).trim();return Object.hasOwn(Mt,t)?Mt[t]:t}function Pt(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Pt).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Pt(t[e])}`).join(`,`)}}`}function Ft(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function A(e){let t=e.event_id??e.id??e.seq??e._offset,n=String(e.type??`event`);return t!=null&&t!==``?`${n}-${String(t)}`:`${n}-${String(e.ts??e.time??``)}-${Ft(Pt(e))}`}function It(e){return e.type===k.ENGINEER_PROGRESS&&e.kind===`reasoning`}function Lt(e){if(e.type!==k.ENGINEER_PROGRESS||![`assistant_message`,`agent_message`,`message`].includes(String(e.kind??``)))return!1;let t=String(e.agent_layer??e.actor??``);return String(e.text??``).trimStart().startsWith(`{`)?t===`reviewer`||t===`planner`:!1}var Rt=/^(?:[-*+]\s*)?[`*_]*(?:ARGUS_)?(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS|ROLE_DECISION)[`*_]*\s*[:=]|^(?:final\s+)?decision\s*:\s*$/i;function zt(e){return String(e??``).split(/\r?\n/).filter(e=>!Rt.test(e.trim())).join(` +`).trim()}function Bt(e){let t=String(e.fragment_mode??``);return t===`append`||t===`snapshot`?t:e.replace===!0?`snapshot`:`auto`}function Vt(e,t){let n=Math.min(e.length,t.length);for(let r=n;r>=8;--r)if(e.endsWith(t.slice(0,r)))return r;return 0}function Ht(e,t,n=`auto`){let r=(e||``).trim(),i=(t||``).trim();if(!r)return i;if(!i)return r;if(n===`snapshot`)return i;if(r.includes(i))return r;if(n===`append`)return`${r}\n${i}`;if(i.includes(r))return i;let a=Vt(r,i);return a?`${r}${i.slice(a)}`:`${r}\n${i}`}var Ut=[`all`,`attention`,`milestones`,`messages`],Wt=new Set([k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MISSION_FAILED,k.LOOP_START,k.LOOP_DONE,k.LIFE_PLANNER_VERDICT,k.LIFE_BUDGET_PAUSE,k.LIFE_LIFECYCLE_BLOCK]);function Gt(e,t,n=`all`,r=``){let i=Nt(e.canonical_type??e.type),a=String(e.kind??``);if(n===`attention`&&![`warn`,`err`].includes(String(t.tone??``))&&e.operator_alert!==!0||n===`milestones`&&!(t.rule&&!i.startsWith(`ui.`))&&!Wt.has(i)||n===`messages`&&t.tone!==`bright`&&![`assistant_message`,`agent_message`,`message`].includes(a)&&![`ui.operator`,`ui.argus`].includes(i))return!1;let o=r.trim().toLocaleLowerCase();return!o||[i,a,t.role,t.label,t.text,e.title,e.objective,e.text,e.summary,e.reason,e.error,e.status,e.action_summary,e.command,e.path,Array.isArray(e.tags)?e.tags.join(` `):e.tags].some(e=>String(e??``).toLocaleLowerCase().includes(o))}function Kt(e,t,n){e.setQueryData([`snapshot`,t],e=>e&&{...e,session:{...e.session,display_name:n}}),e.setQueryData([`projects`],e=>e&&{...e,projects:e.projects.map(e=>e.id===t?{...e,display_name:n,label:n||e.objective||e.id}:e)})}var qt=15e3,Jt=5e3,Yt=8e3,Xt=2e3,j=1e4;function Zt(e,t){return!qe(t)&&!(t instanceof Ce)&&e<1}function Qt(e){return!qe(e)&&Jt}function $t(e){return e?.projects.some(e=>e.daemon_alive)?Xt:qt}function en(e){return e?.daemon.alive||e?.manager_requests?.some(e=>e.status===`running`)?Xt:Yt}var tn=()=>s({queryKey:[`projects`],queryFn:E.projectIndex,refetchInterval:e=>$t(e.state.data)}),nn=()=>s({queryKey:[`project-costs`],queryFn:({signal:e})=>E.projectCosts(e),retry:Zt,refetchInterval:e=>Qt(e.state.error),refetchIntervalInBackground:!1}),rn=e=>s({queryKey:[`snapshot`,e],queryFn:({signal:t})=>E.activeSnapshot(e,t),enabled:!!e,refetchInterval:e=>en(e.state.data)}),an=(e,t=30,n=!0)=>s({queryKey:[`journal`,e,t],queryFn:({signal:n})=>E.journal(e,t,n),enabled:!!e&&n,refetchInterval:n?8e3:!1}),on=(e,t)=>s({queryKey:[`doctor`,e],queryFn:({signal:t})=>E.doctor(e,t),enabled:!!e&&t}),sn=(e,t)=>s({queryKey:[`config`,e],queryFn:({signal:t})=>E.config(e,t),enabled:!!e&&t}),cn=(e,t)=>s({queryKey:[`identity`,e],queryFn:({signal:t})=>E.identity(e,t),enabled:!!e&&t}),ln=(e,t,n=30)=>s({queryKey:[`transcript`,e,n],queryFn:({signal:t})=>E.transcript(e,n,t),enabled:!!e&&t}),un=(e,t=!0)=>s({queryKey:[`artifacts`,e],queryFn:({signal:t})=>E.artifacts(e,t),enabled:!!e&&t,refetchInterval:t?j:!1}),dn=(e,t,n=null)=>s({queryKey:[`artifact`,e,t,n],queryFn:({signal:n})=>E.artifact(e,t,n),enabled:!!e&&!!t,refetchInterval:e=>t&&/(?:^|[\\/])REVIEW\.md$/i.test(t)&&!qe(e.state.error)?2e3:!1}),fn=(e,t)=>s({queryKey:[`backlog-item`,e,t],queryFn:({signal:n})=>E.backlogItem(e,t,n),enabled:!!e&&!!t});function pn(e,t){let n=c(),r=e=>{n.invalidateQueries({queryKey:[`snapshot`,e]}),n.invalidateQueries({queryKey:[`status`,e]}),n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`backlog-item`,e]})},i=()=>r(e);return{addTask:h({mutationFn:t=>E.addTask(e,t),onSuccess:i}),nudge:h({mutationFn:t=>E.nudge(e,t)}),note:h({mutationFn:t=>E.note(e,t)}),startDaemon:h({mutationFn:()=>E.startDaemon(e,t),onSuccess:i}),stopDaemon:h({mutationFn:n=>E.stopDaemon(e,n,t),onSuccess:i}),forceStopDaemon:h({mutationFn:()=>E.stopDaemon(e,!1,t,!0),onSuccess:i}),updateProject:h({mutationFn:e=>E.updateProject(e.sid,e.name),onSuccess:e=>{Kt(n,e.sid,e.name),r(e.sid)}}),deleteProject:h({mutationFn:()=>E.deleteProject(e),onSuccess:async()=>{let t=e;if(t){let e=e=>e.queryKey.some(e=>e===t);await n.cancelQueries({predicate:e}),n.removeQueries({predicate:e})}await n.invalidateQueries({queryKey:[`projects`]})}}),disposeBacklog:h({mutationFn:t=>E.disposeBacklog(e,t.id,t.op),onSuccess:i}),stopBacklog:h({mutationFn:t=>E.stopBacklog(e,t),onSuccess:i}),setContinuous:h({mutationFn:t=>E.setContinuous(e,t.enabled,t.objective??``),onSuccess:i})}}var mn=2e3;function hn(e,t){if(t.kind===`reset`)return{sid:t.sid,events:[],seen:new Set};if(t.sid!==e.sid)return e;if(t.kind===`seed`){let n=new Set,r=[];[...t.events,...e.events].forEach(e=>{let t=A(e);n.has(t)||(n.add(t),r.push(e))});let i=r.slice(-2e3);return{sid:e.sid,events:i,seen:new Set(i.map(e=>A(e)))}}let n=t.kind===`push`?[t.ev]:t.events,r=null,i=null;for(let t of n){let n=i??e.seen,a=A(t);n.has(a)||((!r||!i)&&(r=[...e.events],i=new Set(e.seen)),i.add(a),r.push(t))}return!r||!i?e:(r.length>mn&&r.splice(0,r.length-mn).forEach(e=>i.delete(A(e))),{sid:e.sid,events:r,seen:i})}var gn=new Set([`manager.live_view.updated`,`round.review.completed`,`life.mission.completed`]);function _n(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=String(n.type??``);if(gn.has(r)||r===`engineer.progress`&&n.kind===`file_change`)return A(n)}return``}var vn=new Set([`life.operator_question.pending`,`life.operator_question.answered`,`life.planner.task_added`,`life.planner.verdict`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`round.review.completed`]);function yn(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(vn.has(String(n.type??``)))return A(n)}return``}function bn(e,t=0){let[n,r]=(0,x.useState)(()=>typeof navigator>`u`||navigator.onLine!==!1);(0,x.useEffect)(()=>{let e=()=>r(navigator.onLine!==!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),e(),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]);let[i,a]=(0,x.useReducer)(hn,{sid:null,events:[],seen:new Set}),[o,s]=(0,x.useState)({sid:null,connected:!1}),c=(0,x.useRef)(e);return c.current=e,(0,x.useEffect)(()=>{if(a({kind:`reset`,sid:e}),s({sid:e,connected:!1}),!e)return;let t=!1,n=new AbortController,r=[],i,o=()=>{if(i=void 0,t||c.current!==e||r.length===0){r=[];return}let n=r;r=[],a({kind:`push-many`,sid:e,events:n})};E.events(e,120,n.signal).then(n=>{!t&&c.current===e&&a({kind:`seed`,sid:e,events:n})}).catch(()=>{});let l=gt(e,n=>{!t&&c.current===e&&(r.push(n),i===void 0&&(i=window.setTimeout(o,40)))},{replay:40,onOpen:()=>{!t&&c.current===e&&s({sid:e,connected:!0})},onClose:()=>{!t&&c.current===e&&s({sid:e,connected:!1})}});return()=>{t=!0,n.abort(),i!==void 0&&window.clearTimeout(i),r=[],l()}},[e,t]),{events:i.sid===e?i.events:[],connected:n&&o.sid===e&&o.connected}}function xn(e,t,n){let r=!1;e.addEventListener(`vite:preloadError`,e=>{let i=e.payload,a=i instanceof Error?i.message:String(i??``);if(!/\/(?:pdf[.-]|pdfjs)[^/\s]*\.(?:m?js)(?:[?#\s]|$)/i.test(a)&&/failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed|loading chunk .+ failed|unable to preload css/i.test(a)){if(r){e.preventDefault();return}try{let e=n.storage(),t=`argus.stale-chunk-reloaded`;if(e.getItem(t)===n.buildId)return;e.setItem(t,n.buildId)}catch{return}e.preventDefault(),r=!0,t()}})}var Sn=`modulepreload`,Cn=function(e,t){return new URL(e,t).href},wn={},Tn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Cn(t,n),t=s(t),t in wn)return;wn[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Sn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},En=window.location.pathname===`/admin/data`||window.location.pathname.startsWith(`/admin/data/`),Dn=(0,x.lazy)(()=>Tn(()=>import(`./App-q-3YCWKy.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)),On=(0,x.lazy)(()=>Tn(()=>import(`./WorkflowWorkbench-COIoFnqD.js`),__vite__mapDeps([10,1,2,3,7,8]),import.meta.url)),kn=(0,x.lazy)(()=>Tn(()=>import(`./AdminDataApp-C6QkHG3T.js`),__vite__mapDeps([11,1,2,3,6,4,5,12,13,14,8,15]),import.meta.url));xn(window,()=>window.location.reload(),{buildId:_e,storage:()=>window.sessionStorage}),En||ze();var An=window.parent!==window;document.documentElement.dataset.argusEmbedded=String(An);var jn=new ue({defaultOptions:{queries:{staleTime:3e3,retry:Zt,refetchOnWindowFocus:!1}}});function Mn(){let e=s({queryKey:[`api-meta`],queryFn:E.meta}),{locale:t}=kt();return e.error?(0,D.jsxs)(`div`,{role:`alert`,className:`p-8`,children:[e.error.message,(0,D.jsx)(`button`,{className:`ml-4 underline`,onClick:()=>void e.refetch(),children:t===`zh-CN`?`重新连接`:`Reconnect`})]}):e.data?e.data.capabilities.includes(`application.workflows.v1`)&&new URLSearchParams(window.location.search).get(`legacy`)!==`1`?(0,D.jsx)(On,{}):(0,D.jsx)(Dn,{}):(0,D.jsx)(`div`,{className:`p-8`,children:t===`zh-CN`?`正在连接…`:`Connecting…`})}function Nn(){let{locale:e}=kt();return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(jt,{}),(0,D.jsx)(At,{locale:e,children:(0,D.jsx)(x.Suspense,{fallback:(0,D.jsx)(`div`,{className:`grid min-h-screen place-items-center text-sm text-ink-faint`,children:e===`zh-CN`?`正在加载工作台…`:`Loading workbench…`}),children:En?(0,D.jsx)(kn,{}):(0,D.jsx)(Mn,{})})})]})}(En?Promise.resolve():xt()).then(()=>de.createRoot(document.getElementById(`root`)).render((0,D.jsx)(x.StrictMode,{children:(0,D.jsx)(_,{client:jn,children:(0,D.jsx)(Ot,{children:(0,D.jsx)(Nn,{})})})}))).catch(e=>{let t=document.getElementById(`root`);t.setAttribute(`role`,`alert`),t.textContent=`Cannot open workbench: ${e instanceof Error?e.message:String(e)}`});export{Ke as A,nt as B,Ht as C,Et as D,Nt as E,He as F,ge as G,$e as H,ct as I,ae as J,fe as K,qe as L,Ie as M,E as N,kt as O,Ve as P,Je as R,Lt as S,k as T,Pe as U,Xe as V,S as W,Ut as _,un as a,Bt as b,on as c,an as d,pn as f,ln as g,rn as h,dn as i,Ge as j,bt as k,bn as l,tn as m,_n as n,fn as o,nn as p,he as q,yn as r,sn as s,Tn as t,cn as u,A as v,zt as w,It as x,Gt as y,rt as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/index-DbVni4qR.js b/frontend/web/dist/assets/index-DbVni4qR.js new file mode 100644 index 000000000..4a764010d --- /dev/null +++ b/frontend/web/dist/assets/index-DbVni4qR.js @@ -0,0 +1,13 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-BzMKY0Y_.js","./rolldown-runtime-hePW80VL.js","./icons-DRlFT_ri.js","./query-CUzIxVzm.js","./markdown-D-35pK1E.js","./markdown-DvoRHisr.css","./AppearanceControls-C_eUyO2x.js","./format-8giTdXya.js","./useWorkbenchTheme-CV-C3OBr.js","./App-Cp4qzJN7.css","./WorkflowWorkbench-vw9-WFp2.js","./AdminDataApp-D7m1m69B.js","./history-MzF_RldS.js","./code-xml-CTbPls4H.js","./AdminDataApp--AL95rdz.css"])))=>i.map(i=>d[i]); +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{D as n,E as r}from"./icons-DRlFT_ri.js";import{C as i,S as a,_ as o,a as s,c,d as l,f as u,g as d,h as f,l as p,m,n as h,p as g,s as _,u as v,v as y,w as ee,x as te,y as b}from"./query-CUzIxVzm.js";import"./markdown-D-35pK1E.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ne=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,x(te);else{var t=n(l);t!==null&&de(ee,t.startTime-e)}}}function te(t,i){m=!1,h&&(h=!1,_(re),re=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!oe());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&de(ee,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var b=!1,ne=null,re=-1,ie=5,ae=-1;function oe(){return!(e.unstable_now()-aee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(re),re=-1):h=!0,de(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x(te))),r},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=t(((e,t)=>{t.exports=ne()})),ie=t((e=>{var t=n(),r=re();function i(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),u=Object.prototype.hasOwnProperty,d=/^[: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]*$/,f={},p={};function m(e){return u.call(p,e)?!0:u.call(f,e)?!1:d.test(e)?p[e]=!0:(f[e]=!0,!1)}function h(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?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(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){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function ee(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function te(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ve(e):``}function xe(e){switch(e.tag){case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 2:case 15:return e=be(e.type,!1),e;case 11:return e=be(e.type.render,!1),e;case 1:return e=be(e.type,!0),e;default:return``}}function Se(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 ae:return`Fragment`;case ie:return`Portal`;case se:return`Profiler`;case oe:return`StrictMode`;case x:return`Suspense`;case de:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case le:return(e.displayName||`Context`)+`.Consumer`;case ce:return(e._context.displayName||`Context`)+`.Provider`;case ue:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case fe:return t=e.displayName||null,t===null?Se(e.type)||`Memo`:t;case pe:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}function Ce(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`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return Se(t);case 8:return t===oe?`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 we(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ee(e){var t=Te(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function De(e){e._valueTracker||=Ee(e)}function Oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Te(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ke(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ae(e,t){var n=t.checked;return S({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function je(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=we(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Me(e,t){t=t.checked,t!=null&&te(e,`checked`,t,!1)}function Ne(e,t){Me(e,t);var n=we(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`)?Fe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Fe(e,t.type,we(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pe(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 Fe(e,t,n){(t!==`number`||ke(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ie=Array.isArray;function Le(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=We.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qe={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},Je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(qe).forEach(function(e){Je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),qe[t]=qe[e]})});function Ye(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||qe.hasOwnProperty(e)&&qe[e]?(``+t).trim():t+`px`}function C(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ye(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Xe=S({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 w(e,t){if(t){if(Xe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(i(62))}}function Ze(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 Qe=null;function $e(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var et=null,T=null,tt=null;function nt(e){if(e=Zi(e)){if(typeof et!=`function`)throw Error(i(280));var t=e.stateNode;t&&(t=$i(t),et(e.stateNode,e.type,t))}}function rt(e){T?tt?tt.push(e):tt=[e]:T=e}function it(){if(T){var e=T,t=tt;if(tt=T=null,nt(e),t)for(e=0;e>>=0,e===0?32:31-(Lt(e)/Rt|0)|0}var Bt=64,Vt=4194304;function Ht(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 Ut(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Ht(a))):r=Ht(s)}else o=n&~i,o===0?a!==0&&(r=Ht(a)):r=Ht(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))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 Yt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=n}function Xt(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=dr),mr=` `,hr=!1;function gr(e,t){switch(e){case`keyup`:return lr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function _r(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var vr=!1;function yr(e,t){switch(e){case`compositionend`:return _r(t);case`keypress`:return t.which===32?(hr=!0,mr):null;case`textInput`:return e=t.data,e===mr&&hr?null:e;default:return null}}function br(e,t){if(vr)return e===`compositionend`||!ur&&gr(e,t)?(e=Pn(),Nn=Mn=jn=null,vr=!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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Hr(n)}}function Wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gr(){for(var e=window,t=ke();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ke(e.document)}return t}function Kr(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 qr(e){var t=Gr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Wr(n.ownerDocument.documentElement,n)){if(r!==null&&Kr(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 i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ur(n,a);var o=Ur(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Yr=null,Xr=null,Zr=null,Qr=!1;function $r(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qr||Yr==null||Yr!==ke(r)||(r=Yr,`selectionStart`in r&&Kr(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}),Zr&&Vr(Zr,r)||(Zr=r,r=wi(Xr,`onSelect`),0ta||(e.current=ea[ta],ea[ta]=null,ta--)}function N(e,t){ta++,ea[ta]=e.current,e.current=t}var ra={},P=na(ra),ia=na(!1),aa=ra;function oa(e,t){var n=e.type.contextTypes;if(!n)return ra;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function sa(e){return e=e.childContextTypes,e!=null}function ca(){M(ia),M(P)}function la(e,t,n){if(P.current!==ra)throw Error(i(168));N(P,t),N(ia,n)}function ua(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!=`function`)return n;for(var a in r=r.getChildContext(),r)if(!(a in t))throw Error(i(108,Ce(e)||`Unknown`,a));return S({},n,r)}function da(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ra,aa=P.current,N(P,e),N(ia,ia.current),!0}function fa(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=ua(e,t,aa),r.__reactInternalMemoizedMergedChildContext=e,M(ia),M(P),N(P,e)):M(ia),N(ia,n)}var pa=null,ma=!1,ha=!1;function ga(e){pa===null?pa=[e]:pa.push(e)}function _a(e){ma=!0,ga(e)}function va(){if(!ha&&pa!==null){ha=!0;var e=0,t=A;try{var n=pa;for(A=1;e>=o,i-=o,Ea=1<<32-It(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),F&&Oa(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),F&&Oa(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return F&&Oa(a,g),u}for(h=r(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),F&&Oa(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===ae&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case ne:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===ae){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===pe&&qa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ga(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===ae?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Ga(e,r,i),o.return=e,e=o)}return s(e);case ie:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case pe:return l=i._init,_(e,r,l(i._payload),o)}if(Ie(i))return h(e,r,i,o);if(ge(i))return g(e,r,i,o);Ka(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ya=Ja(!0),Xa=Ja(!1),Za=na(null),Qa=null,$a=null,eo=null;function to(){eo=$a=Qa=null}function no(e){var t=Za.current;M(Za),e._currentValue=t}function ro(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function io(e,t){Qa=e,eo=$a=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Us=!0),e.firstContext=null)}function ao(e){var t=e._currentValue;if(eo!==e){if(e={context:e,memoizedValue:t,next:null},$a===null){if(Qa===null)throw Error(i(308));$a=e,Qa.dependencies={lanes:0,firstContext:e}}else $a=$a.next=e}return t}var oo=null;function so(e){oo===null?oo=[e]:oo.push(e)}function co(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,so(t)):(n.next=i.next,i.next=n),t.interleaved=n,lo(e,r)}function lo(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 uo=!1;function fo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function po(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 mo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ho(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,lo(e,n)}return i=r.interleaved,i===null?(t.next=t,so(r)):(t.next=i.next,i.next=t),r.interleaved=t,lo(e,n)}function go(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}function _o(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 vo(e,t,n,r){var i=e.updateQueue;uo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=S({},d,f);break a;case 2:uo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Zc|=o,e.lanes=o,e.memoizedState=d}}function yo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=No.transition;No.transition={};try{e(!1),t()}finally{A=n,No.transition=r}}function gs(){return Uo().memoizedState}function _s(e,t,n){var r=hl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ys(e))bs(t,n);else if(n=co(e,t,n,r),n!==null){var i=Z();gl(n,e,r,i),xs(n,t,r)}}function vs(e,t,n){var r=hl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ys(e))bs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Br(s,o)){var c=t.interleaved;c===null?(i.next=i,so(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=co(e,t,i,r),n!==null&&(i=Z(),gl(n,e,r,i),xs(n,t,r))}}function ys(e){var t=e.alternate;return e===L||t!==null&&t===L}function bs(e,t){Io=Fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}var Ss={readContext:ao,useCallback:B,useContext:B,useEffect:B,useImperativeHandle:B,useInsertionEffect:B,useLayoutEffect:B,useMemo:B,useReducer:B,useRef:B,useState:B,useDebugValue:B,useDeferredValue:B,useTransition:B,useMutableSource:B,useSyncExternalStore:B,useId:B,unstable_isNewReconciler:!1},Cs={readContext:ao,useCallback:function(e,t){return Ho().memoizedState=[e,t===void 0?null:t],e},useContext:ao,useEffect:as,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),rs(4194308,4,ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){return rs(4,2,e,t)},useMemo:function(e,t){var n=Ho();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ho();return t=n===void 0?t:n(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=_s.bind(null,L,e),[r.memoizedState,e]},useRef:function(e){var t=Ho();return e={current:e},t.memoizedState=e},useState:es,useDebugValue:ds,useDeferredValue:function(e){return Ho().memoizedState=e},useTransition:function(){var e=es(!1),t=e[0];return e=hs.bind(null,e[1]),Ho().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=L,a=Ho();if(F){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),q===null)throw Error(i(349));Po&30||Yo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Zo.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,Xo.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ho(),t=q.identifierPrefix;if(F){var n=Da,r=Ea;n=(r&~(1<<32-It(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Lo++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof r.is==`string`?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),n===`select`&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Wi]=t,e[Gi]=r,fc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ze(n,r),n){case`dialog`:j(`cancel`,e),j(`close`,e),a=r;break;case`iframe`:case`object`:case`embed`:j(`load`,e),a=r;break;case`video`:case`audio`:for(a=0;arl&&(t.flags|=128,r=!0,hc(s,!1),t.lanes=4194304)}}else{if(!r){if(e=ko(c),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),hc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!F)return H(t),null}else 2*O()-s.renderingStartTime>rl&&n!==1073741824&&(t.flags|=128,r=!0,hc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(H(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=O(),t.sibling=null,n=I.current,N(I,r?n&1|2:n&1),t);case 22:case 23:return Tl(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Jc&1073741824&&(H(t),t.subtreeFlags&6&&(t.flags|=8192)):H(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function _c(e,t){switch(ja(t),t.tag){case 1:return sa(t.type)&&ca(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Eo(),M(ia),M(P),jo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Oo(t),null;case 13:if(M(I),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(I),null;case 4:return Eo(),null;case 10:return no(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var vc=!1,U=!1,yc=typeof WeakSet==`function`?WeakSet:Set,W=null;function bc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function xc(e,t,n){try{n()}catch(n){$(e,t,n)}}var Sc=!1;function Cc(e,t){if(Mi=wn,e=Gr(),Kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},wn=!1,W=t;W!==null;)if(t=W,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Es(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return h=Sc,Sc=!1,h}function wc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&xc(t,n,a)}i=i.next}while(i!==r)}}function Tc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,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 Ec(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 Dc(e){var t=e.alternate;t!==null&&(e.alternate=null,Dc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wi],delete t[Gi],delete t[qi],delete t[Ji],delete t[Yi])),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 Oc(e){return e.tag===5||e.tag===3||e.tag===4}function kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Oc(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 a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ac(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=ji));else if(r!==4&&(e=e.child,e!==null))for(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}function jc(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(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}var G=null,Mc=!1;function Nc(e,t,n){for(n=n.child;n!==null;)Pc(e,t,n),n=n.sibling}function Pc(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount==`function`)try{Pt.onCommitFiberUnmount(Nt,n)}catch{}switch(n.tag){case 5:U||bc(n,t);case 6:var r=G,i=Mc;G=null,Nc(e,t,n),G=r,Mc=i,G!==null&&(Mc?(e=G,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):G.removeChild(n.stateNode));break;case 18:G!==null&&(Mc?(e=G,n=n.stateNode,e.nodeType===8?Bi(e.parentNode,n):e.nodeType===1&&Bi(e,n),Sn(e)):Bi(G,n.stateNode));break;case 4:r=G,i=Mc,G=n.stateNode.containerInfo,Mc=!0,Nc(e,t,n),G=r,Mc=i;break;case 0:case 11:case 14:case 15:if(!U&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&xc(n,t,o),i=i.next}while(i!==r)}Nc(e,t,n);break;case 1:if(!U&&(bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Nc(e,t,n);break;case 21:Nc(e,t,n);break;case 22:n.mode&1?(U=(r=U)||n.memoizedState!==null,Nc(e,t,n),U=r):Nc(e,t,n);break;default:Nc(e,t,n)}}function Fc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ic(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=s),r&=~o}if(r=a,r=O()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wc(r/1960))-r,10e?16:e,ll===null)var r=!1;else{if(e=ll,ll=null,ul=0,K&6)throw Error(i(331));var a=K;for(K|=4,W=e.current;W!==null;){var o=W,s=o.child;if(W.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lO()-nl?El(e,0):$c|=n),Q(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Vt,Vt<<=1,!(Vt&130023424)&&(Vt=4194304)):t=1);var n=Z();e=lo(e,t),e!==null&&(Yt(e,t,n),Q(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||ia.current)Us=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Us=!1,dc(e,t,n);Us=!!(e.flags&131072)}}else Us=!1,F&&t.flags&1048576&&ka(t,Sa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;lc(e,t),e=t.pendingProps;var a=oa(t,P.current);io(t,n),a=Bo(null,t,r,e,a,n);var o=Vo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,sa(r)?(o=!0,da(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,fo(t),a.updater=Os,t.stateNode=a,a._reactInternals=t,Ms(t,r,e,n),t=Zs(null,t,r,!0,o,n)):(t.tag=0,F&&o&&Aa(t),V(null,t,a,n),t=t.child),t;case 16:r=t.elementType;a:{switch(lc(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Jl(r),e=Es(r,e),a){case 0:t=Ys(null,t,r,e,n);break a;case 1:t=Xs(null,t,r,e,n);break a;case 11:t=Ws(null,t,r,e,n);break a;case 14:t=Gs(null,t,r,Es(r.type,e),n);break a}throw Error(i(306,r,``))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Ys(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Xs(e,t,r,a,n);case 3:a:{if(Qs(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,a=o.element,po(e,t),vo(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ns(Error(i(423)),t),t=$s(e,t,r,n,a);break a}if(r!==a){a=Ns(Error(i(424)),t),t=$s(e,t,r,n,a);break a}for(Na=Vi(t.stateNode.containerInfo.firstChild),Ma=t,F=!0,Pa=null,n=Xa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ha(),r===a){t=uc(e,t,n);break a}V(e,t,r,n)}t=t.child}return t;case 5:return Do(t),e===null&&Ra(t),r=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Pi(r,a)?s=null:o!==null&&Pi(r,o)&&(t.flags|=32),Js(e,t),V(e,t,s,n),t.child;case 6:return e===null&&Ra(t),null;case 13:return nc(e,t,n);case 4:return To(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ya(t,null,r,n):V(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Ws(e,t,r,a,n);case 7:return V(e,t,t.pendingProps,n),t.child;case 8:return V(e,t,t.pendingProps.children,n),t.child;case 12:return V(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,N(Za,r._currentValue),r._currentValue=s,o!==null){if(Br(o.value,s)){if(o.children===a.children&&!ia.current){t=uc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=mo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),ro(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(i(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),ro(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}V(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,io(t,n),a=ao(a),r=r(a),t.flags|=1,V(e,t,r,n),t.child;case 14:return r=t.type,a=Es(r,t.pendingProps),a=Es(r.type,a),Gs(e,t,r,a,n);case 15:return Ks(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),lc(e,t),t.tag=1,sa(r)?(e=!0,da(t)):e=!1,io(t,n),As(t,r,a),Ms(t,r,a,n),Zs(null,t,r,!0,e,n);case 19:return cc(e,t,n);case 22:return qs(e,t,n)}throw Error(i(156,t.tag))};function Wl(e,t){return wt(e,t)}function Gl(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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===fe)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(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 Xl(e,t,n,r,a,o){var s=2;if(r=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ae:return Zl(n.children,a,o,t);case oe:s=8,a|=8;break;case se:return e=Kl(12,n,t,a|2),e.elementType=se,e.lanes=o,e;case x:return e=Kl(13,n,t,a),e.elementType=x,e.lanes=o,e;case de:return e=Kl(19,n,t,a),e.elementType=de,e.lanes=o,e;case me:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ce:s=10;break a;case le:s=9;break a;case ue:s=11;break a;case fe:s=14;break a;case pe:s=16,r=null;break a}throw Error(i(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){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=Jt(0),this.expirationTimes=Jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},fo(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ie()})),oe=t((e=>{var t=ae();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),se=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new p({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ce(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){u.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>d(t,e))}findAll(e={}){return this.getAll().filter(t=>d(e,t))}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return u.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function ce(e){return e.options.scope?.id}var le=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new v({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){u.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){u.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){u.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new le,this.#t=e.mutationCache||new se,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=i.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=l.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(te(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return u.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;u.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return u.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=u.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return u.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=u.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(te(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return l.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(m(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{b(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(m(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{b(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=f(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===a&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},x=e(n(),1),de=e(oe(),1),fe=class extends Error{status;method;path;code;detail;constructor(e,t,n,r,i=``,a=``){super(e),this.name=`ApiError`,this.status=t,this.method=n,this.path=r,this.code=i,this.detail=a}};function pe(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{detail:``,code:``};try{let t=JSON.parse(e),n=t.detail&&typeof t.detail==`object`&&!Array.isArray(t.detail)?t.detail:void 0,r=typeof t.code==`string`&&t.code.trim()?t.code.trim():typeof n?.code==`string`?n.code.trim():``;if(n)for(let e of[`message`,`detail`]){let t=n[e];if(typeof t==`string`&&t.trim())return{detail:t.trim(),code:r}}for(let e of[`detail`,`error`,`message`]){let n=t[e];if(typeof n==`string`&&n.trim())return{detail:n.trim(),code:r};if(Array.isArray(n)){let e=n.map(e=>e&&typeof e==`object`?String(e.msg??``):``).filter(Boolean);if(e.length)return{detail:e.join(`; `),code:r}}}return{detail:``,code:r}}catch{}return{detail:t.startsWith(``u`?``:window.location.search).get(`reader_preview`);return e===`source-first`||e===`learning-path`||e===`question-foundation`?e:null}function S(e,t,n,r,i=ge(),a){let o=[`map-copy`,e,t,n,r];return i===`question-foundation`?[...o,i,a??null]:i?[...o,i]:o}var _e=`0.1.8+01546a516a22667c`,ve=!1,ye=new Set,be=()=>ve,xe=e=>(ye.add(e),()=>{ye.delete(e)});function Se(e){ve||!e||e===`unknown`||e===`0.1.8+01546a516a22667c`||(ve=!0,ye.forEach(e=>e()))}var Ce=class extends Error{constructor(){super(`页面已更新,请刷新后继续。 / This page has been updated. Refresh to continue.`),this.name=`PageUpdateRequiredError`}};function we(){if(ve)throw new Ce}var Te={name:`argus.webapi`,major:1,minServerMinor:16},Ee=[`daemon.admission.v1`,`daemon.status.protocol.v1`,`daemon.command.v1`,`daemon.upgrade-schedule.v1`,`cost.admission.v1`,`event.catalog.v1`,`event.payload-schema.v1`,`manager.sse.v1`,`manager.request-cancel.v1`,`advisor.config.v1`,`metrics.slo.v2`,`mission.view.v1`,`mission.abort.v1`,`project.attachments.v1`,`project.git-diff.v1`,`project.cost-feed.v1`,`project.counterexamples.v1`,`project.workdir.v1`,`research.events.v1`,`release.identity.v1`,`snapshot.schema.v1`,`source.update.v1`,`usage.recorded.v2`,`verticals.store.v1`],De=`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`;function Oe(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function ke(e){return typeof e==`number`&&Number.isInteger(e)?e:null}function Ae(e,t){let n=Oe(e),r=Oe(n?.protocol),i=Oe(n?.runtime),a=Array.isArray(n?.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],o=ke(r?.major),s=ke(r?.minor);if(!n||!r||!i)return{compatible:!1,reason:`malformed /api/meta response`};if(typeof i.source_root!=`string`||ke(i.pid)===null||typeof i.package_version!=`string`||typeof i.release_id!=`string`)return{compatible:!1,reason:`malformed /api/meta runtime identity`};if(n.service!==`argus-skill-webapi`)return{compatible:!1,reason:`unexpected service ${String(n.service||`unknown`)}`};let c=e;if(r.name!==Te.name||o!==Te.major)return{compatible:!1,reason:`protocol ${String(r.name||`unknown`)}/${String(o)} is incompatible with client ${Te.name}/${Te.major}`,meta:c};if(s===null||s!a.includes(e));if(l.length>0)return{compatible:!1,reason:`missing capabilities: ${l.join(`, `)}`,meta:c};if(i.source_root_matches_config===!1)return{compatible:!1,reason:`backend is running from a different installation than configured`,meta:c};if(t&&i.release_id!==t.releaseId)return{compatible:!1,reason:`backend and client installations are out of sync; restart or reinstall Argus`,meta:c};if(t?.sourceDigest){if(typeof i.runtime_source_digest!=`string`||!i.runtime_source_digest)return{compatible:!1,reason:`backend cannot verify this local installation; restart it from the current checkout`,meta:c};if(i.runtime_source_digest!==t.sourceDigest)return{compatible:!1,reason:`backend is running code from a different local installation; restart it`,meta:c}}let u=i.release_matches_source===!1?De:void 0;return{compatible:!0,reason:``,...u?{warning:u}:{},meta:c}}function je(e,t,n){let r=Ae(e,t);if(!r.compatible||!r.meta)throw Error(`incompatible Argus API: ${r.reason}`);return r.warning&&n?.(r.warning),r.meta}function Me(e){let t=Oe(e),n=Oe(t?.daemon);if(!t||t.schema_version!==7)throw Error(`incompatible snapshot schema: expected 7, got ${String(t?.schema_version??`missing`)}`);if(!n)throw Error(`invalid snapshot: daemon section is missing`);let r=[`read_status`,`read_error`,`protocol_compatible`,`protocol_error`].filter(e=>!Object.hasOwn(n,e));if(r.length>0)throw Error(`invalid snapshot: daemon fields missing: ${r.join(`, `)}`);let i=[`spend_usd`,`spend_status`,`usage_summary`,`daemon_commands`,`observability`,`mission_view`,`partial`,`diagnostics`].filter(e=>!Object.hasOwn(t,e));if(i.length>0)throw Error(`invalid snapshot: fields missing: ${i.join(`, `)}`);if(!Array.isArray(t.diagnostics))throw Error(`invalid snapshot: diagnostics must be an array`);return e}function Ne(e,t){return je(e,{releaseId:_e},t)}function Pe(e,t){let n=`/api/application-workflows`,r=e=>`${n}/${encodeURIComponent(e)}`;return{catalog:()=>e(n),create:e=>t(n,e),open:e=>t(`${n}/open`,{project:e}),snapshot:t=>e(r(t)),action:(e,n)=>t(r(e),n),document:(t,n)=>e(`${r(t)}/document?path=${encodeURIComponent(n)}`)}}var Fe=`verticals.store.v1`,Ie=`argus_web_token`,Le=null;function Re(){let e;try{e=new URLSearchParams(window.location.search)}catch{return}let t=e.get(`token`);if(t){Le=t;try{localStorage.setItem(Ie,t)}catch{}try{e.delete(`token`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)}catch{}}}var ze=()=>{if(Le)return Le;try{return new URLSearchParams(window.location.search).get(`token`)||localStorage.getItem(Ie)}catch{return null}};function Be(){let e=ze();return e?{Authorization:`Bearer ${e}`}:{}}function Ve(){return ze()??``}var He=8e3,Ue=12e3,We=class extends Error{constructor(){super(`This browser is not paired with Argus. Open a valid pairing link or enter a pairing token.`),this.name=`PairingRequiredError`}},Ge=class extends Error{method;path;constructor(e,t,n=`could not reach the local Argus service`){super(`${e.toUpperCase()} ${t} ${n}. Make sure Argus Desktop is running, then retry.`),this.name=`LocalArgusUnavailableError`,this.method=e.toUpperCase(),this.path=t}};function Ke(e){return e instanceof We||!!(e&&typeof e==`object`&&Number(e.status)===401)}function qe(e){return Ke(e)||e instanceof Ge}async function Je(e,t){let n;try{n=await fetch(e,t)}catch(n){throw t.signal?.aborted?n:new Ge(String(t.method??`GET`),e)}return n.ok&&(Se(n.headers.get(`X-Argus-Release`)),(!t.method||t.method===`GET`)&&we()),n}async function Ye(e,t,n,r){let i=new AbortController,a=t.signal??void 0,o=!1,s=()=>{};if(a){let e=()=>i.abort(a.reason);a.aborted?e():(a.addEventListener(`abort`,e,{once:!0}),s=()=>a.removeEventListener(`abort`,e))}let c,l=(async()=>await r(await Je(e,{...t,signal:i.signal})))(),u=new Promise((e,t)=>{c=setTimeout(()=>{o=!0;let e=Error(`request timed out after ${n}ms`);i.abort(e),t(e)},n)});try{return await Promise.race([l,u])}catch(r){if(o){let r=Math.round(n/1e3);throw new Ge(String(t.method??`GET`),e,`timed out after ${r}s because the local Argus service did not respond`)}throw r}finally{c&&clearTimeout(c),s()}}async function C(e,t,n){return Ye(e,{headers:Be(),signal:t},n??Ue,async t=>(await he(t,`GET`,e),await t.json()))}async function Xe(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:t===void 0?void 0:JSON.stringify(t),signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),r}async function w(e,t,n){return await(await Xe(e,t,n)).json()}async function Ze(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:Be(),body:t,signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),await r.json()}function Qe(e){let t=e&&typeof e==`object`?e:{},n=String(t.command_status??``);if(Number(t.rc??0)!==0||n===`failed`||n===`rejected`)throw Error(String(t.error||`daemon command ${n||`failed`}`));return e}async function $e(e,t,n){we();let r=await fetch(t,{method:e,headers:{"Content-Type":`application/json`,...Be()},body:n===void 0?void 0:JSON.stringify(n)});return await he(r,e,t),Se(r.headers.get(`X-Argus-Release`)),await r.json()}async function et(e,t){let n=await fetch(e,{headers:Be(),signal:t});return await he(n,`GET`,e),n.blob()}var T=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`;function tt(e,t){let n=new URLSearchParams({path:t}),r=Ve();return r&&n.set(`token`,r),T(e,`/artifact/preview/page?${n.toString()}`)}var nt=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,rt=nt,it;function at(e){return!!(e&&typeof e==`object`&&`aborted`in e&&typeof e.aborted==`boolean`)}function ot(e,t,n,r){let i={text:e};return t?.length&&(i.attachments=t),n&&n!==`auto`&&(i.route_override=n),r&&(i.request_id=r),i}function st(){if(!it){let e=(async()=>{let e=`/api/meta`,t=await Ye(e,{headers:Be()},He,async t=>{if(t.status===404)throw Error(`incompatible Argus API: service does not expose /api/meta`);await he(t,`GET`,e);let n=await t.json();return Se(n?.runtime?.release_id),Ne(n,e=>{e!==`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`&&console.warn(`Argus API compatibility warning: ${e}`)})});if(t.authentication?.required&&!t.authentication.authenticated)throw new We;return t})();it=e,e.catch(t=>{it===e&&!(t instanceof We)&&(it=void 0)})}return it}var ct=new Set([`waiting_for_source`,`planning`,`writing`,`reviewing`]);function lt(e){let t=[],n;for(;n=/\r?\n\r?\n/.exec(e);){let r=e.slice(0,n.index);e=e.slice(n.index+n[0].length);for(let e of r.split(` +`)){let n=e.trim();if(n.startsWith(`data:`))try{t.push(JSON.parse(n.slice(5).trim()))}catch{}}}return{frames:t,rest:e}}async function ut(e,t,n,r){if(!e.body)throw Error(`${t} returned no response body`);let i=e.body.getReader(),a=new TextDecoder,o=``,s,c=!1;try{for(;;){r?.throwIfAborted();let{done:e,value:l}=await i.read();c=e,r?.throwIfAborted(),o+=e?a.decode()+` + +`:a.decode(l,{stream:!0});let u=lt(o);o=u.rest;for(let e of u.frames)n?.(e),(e.type===`done`||e.type===`error`)&&(s=e);if(e){if(!s)throw Error(`${t} ended before a terminal event`);return s}}}finally{c||await i.cancel().catch(()=>{}),i.releaseLock()}}var dt=null;function ft(e,t,n,r,i=ge(),a){let o=new URLSearchParams(n);return r&&o.set(`session_id`,r),i===`source-first`&&o.set(`preview`,`true`),i===`learning-path`&&o.set(`preview`,`learning-path`),i===`question-foundation`&&(o.set(`preview`,`question-foundation`),a&&o.set(`foundation_id`,a)),`/api/map-copy/${e}/${encodeURIComponent(t)}?${o}`}async function pt(e,t,n,r){let i=await Xe(e,t,n),a=!1,o=await ut(i,`Explanation stream`,e=>{(e.type===`done`||e.type===`error`)&&(a=!0),!a&&e.type===`progress`&&ct.has(e.phase)&&r?.(e.phase)},n);if(o.type===`error`){let t=o.error&&typeof o.error==`object`?o.error:void 0;throw new fe(String(t?.message??o.error??`Explanation failed`),typeof o.status==`number`?o.status:0,`POST`,e,typeof t?.code==`string`?t.code:``)}return o.result}var E={workflows:Pe(C,w),advisorSettings:(e,t)=>C(T(e,`/advisor/config`),t),saveAdvisorSettings:(e,t)=>w(T(e,`/advisor/config`),t),liveMap:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r?.mode===`current`&&(i.set(`since`,String(r.since)),i.set(`event_since`,String(r.eventSince)),r.taskId&&i.set(`start_task`,r.taskId)),C(T(e,`/map`)+(i.size?`?${i}`:``),t)},mapInfo:(e,t)=>C(T(e,`/map-info`),t),mapHistory:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r&&i.set(`task_after`,r),C(T(e,`/map-history`)+(i.size?`?${i}`:``),t)},mapCopy:(e,t,n,r,i,a,o)=>C(ft(e,t,{locale:n},i,a,o),r),mapCardWords:(e,t,n,r,i)=>w(`/api/map-cards/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapLines:(e,t,n,r,i)=>w(`/api/map-lines/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapQuestionSource:(e,t,n)=>w(`/api/map-question-source/project/${encodeURIComponent(e)}?session_id=${encodeURIComponent(e)}`,{...t,preview:t.preview===`source-first`?!0:t.preview??!1},n),generateMapCopy:(e,t,n,r,i,a,o)=>pt(ft(e,t,{stream:`true`},i,a,n.foundation_id),n,r,o),generateReaderFoundation:(e,t,n)=>pt(T(e,`/reader-foundation?stream=true`),t,void 0,n),askReaderFoundation:(e,t,n,r)=>pt(T(e,`/reader-foundation/${encodeURIComponent(t)}/question?stream=true`),n,void 0,r),mapDatasets:e=>C(`/api/map-datasets`,e),mapDataset:(e,t)=>C(`/api/map-datasets/${encodeURIComponent(e)}`,t),meta:st,projectIndex:async()=>(await st(),C(`/api/projects`,void 0,Ue)),listProjects:async()=>(await st(),C(`/api/projects`,void 0,Ue).then(e=>e.projects)),projectCosts:async e=>(await st(),C(`/api/projects/costs`,e)),createDaemon:async(e,t=``,n=``,r)=>{let i=`/api/daemons`,a={objective:e,name:t,workdir:n,command_id:rt(),expected_revision:r},o=()=>fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify(a),cache:`no-store`}),s=await o();return s.status===400&&/Invalid HTTP request received/i.test(await s.clone().text())&&(s=await o()),await he(s,`POST`,i),Qe(await s.json())},updateProject:(e,t)=>$e(`PATCH`,T(e),{name:t}),deleteProject:e=>$e(`DELETE`,T(e)),snapshot:async(e,t,n=!1)=>(await st(),Me(await C(T(e,`/snapshot?compact=true&events_limit=1${n?`&prewarm=true`:``}`),t,Ue))),activeSnapshot:async(e,t)=>{let n=dt!==e;n&&(dt=e);try{return await E.snapshot(e,t,n)}catch(t){throw n&&dt===e&&(dt=null),t}},prefetchSnapshot:(e,t)=>E.snapshot(e,t,!1),status:(e,t)=>C(T(e,`/status`),t),journal:(e,t=20,n)=>C(T(e,`/journal?n=${t}`),n).then(e=>e.journal),doctor:(e,t)=>C(T(e,`/doctor`),t),config:(e,t)=>C(T(e,`/config`),t),identity:(e,t)=>C(T(e,`/identity`),t).then(e=>e.identity),transcript:(e,t=30,n)=>C(T(e,`/transcript?n=${t}`),n).then(e=>e.turns),events:(e,t=80,n)=>C(T(e,`/events?limit=${t}&view=ui`),n).then(e=>e.events),workRecord:(e,t,n,r)=>C(T(e,`/work-record?role=${encodeURIComponent(t)}&record_id=${encodeURIComponent(n)}`),r),downloadWorkLog:async(e,t,n=``)=>{let r=T(e,`/work-log/download?role=${encodeURIComponent(t)}&task_id=${encodeURIComponent(n)}`),i=await fetch(r,{headers:Be(),cache:`no-store`});await he(i,`GET`,r);let a=URL.createObjectURL(await i.blob()),o=document.createElement(`a`);o.href=a,o.download=`work-records.md`,o.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)},backlogItem:(e,t,n)=>C(T(e,`/backlog/${encodeURIComponent(t)}`),n).then(e=>e.item),artifacts:(e,t,n=!1)=>C(T(e,`/artifacts${n?`?include_reading=true`:``}`),t).then(e=>e.artifacts),artifact:(e,t,n)=>C(T(e,`/artifact?${new URLSearchParams({path:t})}`),n),artifactPreview:(e,t,n)=>C(T(e,`/artifact/preview?${new URLSearchParams({path:t})}`),n),artifactBundle:(e,t,n)=>et(T(e,`/artifact/bundle?${new URLSearchParams({path:t})}`),n),artifactBlob:(e,t,n=!1,r)=>{let i=new URLSearchParams({path:t});return n&&i.set(`download`,`true`),et(T(e,`/artifact/raw?${i}`),r)},gitDiff:(e,t)=>C(T(e,`/git-diff`),t),deliveryDiff:(e,t,n)=>C(T(e,`/delivery-diff?${new URLSearchParams(t)}`),n),metrics:e=>C(`/api/metrics`,e),sourceUpdateStatus:e=>C(`/api/runtime/source-update`,e),checkSourceUpdate:()=>w(`/api/runtime/source-update/check`),applySourceUpdate:()=>w(`/api/runtime/source-update/apply`),resources:e=>C(`/api/system/resources`,e),trash:(e=``,t=100,n=0,r)=>C(`/api/trash?${new URLSearchParams({query:e,limit:String(t),offset:String(n)})}`,r),restoreTrash:e=>w(`/api/trash/${encodeURIComponent(e)}/restore`),verticals:e=>C(`/api/verticals`,e),refreshVerticalCatalog:()=>w(`/api/verticals/catalog/refresh`),manageVertical:(e,t,n={})=>w(`/api/verticals/${encodeURIComponent(e)}/manage/${t}`,n.force?{force:!0}:{}),verticalOperation:(e,t)=>C(`/api/verticals/${encodeURIComponent(e)}/operation`,t),addTask:(e,t)=>w(T(e,`/tasks`),{text:t}).then(e=>e.item),abortMission:(e,t)=>w(T(e,`/mission/abort`),{reason:t}),mapNotes:(e,t)=>C(T(e,`/map-notes`),t),addMapNote:(e,t)=>w(T(e,`/map-notes`),t),answerPending:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/answer`),{text:n}),resolveDecision:(e,t,n,r)=>w(T(e,`/decisions/${encodeURIComponent(t)}/resolve`),{option_id:n,note:r}),uploadAttachments:async(e,t,n)=>{await st();let r=new FormData;return t.forEach(e=>r.append(`files`,e,e.name)),Ze(T(e,`/attachments`),r,n)},answerDomain:(e,t,n,r)=>w(T(e,`/message`),{text:r||n,domain_answer:{id:t,option_id:n,note:r}}),message:(e,t,n)=>{let r=at(n)?n:n?.signal,i=at(n)?void 0:n?.attachments,a=at(n)?void 0:n?.routeOverride,o=at(n)?void 0:n?.requestId;return w(T(e,`/message`),ot(t,i,a,o),r)},cancelMessage:(e,t)=>Ye(T(e,`/message/cancel`),{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify({request_id:t})},5e3,async t=>(await he(t,`POST`,T(e,`/message/cancel`)),await t.json())),messageStream:async(e,t,n,r)=>{let i=at(r)?r:r?.signal,a=at(r)?void 0:r?.attachments,o=at(r)?void 0:r?.routeOverride,s=at(r)?void 0:r?.requestId;await ut(await Xe(T(e,`/message/stream`),ot(t,a,o,s),i),`Manager stream`,e=>{if(!i?.aborted){if(e.type===`phase`){let t=Number(e.quiet_s??0);n.onPhase?.(String(e.label??``),String(e.role??`manager`),{heartbeat:e.heartbeat===!0,quietS:Number.isFinite(t)?t:0,kind:String(e.kind??``),detail:String(e.detail??``),tool:String(e.tool??``),toolKind:String(e.tool_kind??``),callId:String(e.call_id??``),status:String(e.status??``),output:String(e.output??``)})}else e.type===`delta`?n.onDelta?.(String(e.text??``),String(e.message_id??``),String(e.fragment_mode??`auto`)):e.type===`done`?n.onDone?.(e.result??{}):e.type===`error`&&n.onError?.(Error(String(e.error??`stream error`)))}},i)},nudge:(e,t)=>w(T(e,`/nudge`),{text:t}),queueFollowup:(e,t,n=`auto`)=>w(T(e,`/message/followup`),{text:t,route_override:n}),note:(e,t)=>w(T(e,`/note`),{text:t}),previewPlan:(e,t)=>w(T(e,`/plan`),{text:t}),rewritePrompt:(e,t)=>w(T(e,`/prompt/rewrite`),{text:t}),setConfig:(e,t,n,r=!1)=>w(T(e,`/config/set`),r?{name:t,value:n,apply_to_roles:!0}:{name:t,value:n}),setIdentity:(e,t)=>w(T(e,`/identity`),{text:t}),resetManager:e=>w(T(e,`/reset`)),skills:(e,t=`ls`)=>w(T(e,`/skills`),{args:t}).then(e=>e.text),skillLibrary:(e,t)=>C(`/api/skill-library${e?`?sid=${encodeURIComponent(e)}`:``}`,t),skillDocument:(e,t,n,r)=>C(`/api/skill-library/document?${new URLSearchParams({library:t,path:n,...e?{sid:e}:{}})}`,r),researchMethod:(e,t)=>C(T(e,`/research/method`),t),wiki:(e,t)=>C(T(e,`/wiki`),t),wikiPage:(e,t,n)=>C(T(e,`/wiki/page?${new URLSearchParams({path:t})}`),n),wikiLibrary:(e,t)=>C(`/api/wiki${e?`?sid=${encodeURIComponent(e)}`:``}`,t),wikiDocument:(e,t,n,r,i)=>C(`/api/wiki/page?${new URLSearchParams({scope:t,vertical:n,path:r,...e?{sid:e}:{}})}`,i),knowledgeFeed:(e=50,t)=>C(`/api/knowledge/feed?${new URLSearchParams({limit:String(e)})}`,t),learningStatus:(e,t)=>C(T(e,`/learning`),t),retryLearning:(e,t)=>w(T(e,`/learning/${encodeURIComponent(t)}/retry`),{}),setLaunchCwd:(e,t)=>w(T(e,`/launch-cwd`),{launch_cwd:t}),setWorkdir:(e,t)=>w(T(e,`/workdir`),{workdir:t}),disposeBacklog:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/dispose`),{op:n}),stopBacklog:(e,t)=>w(T(e,`/backlog/${encodeURIComponent(t)}/stop`)),setContinuous:(e,t,n=``)=>w(T(e,`/continuous`),{enabled:t,objective:n}).then(e=>{if(!t)return e;if(!e.daemon)throw Error(`daemon start returned no result`);return Qe(e.daemon),e}),startDaemon:(e,t)=>w(T(e,`/daemon/start`),{command_id:rt(),expected_revision:t}).then(Qe),stopDaemon:(e,t=!1,n,r=!1)=>w(T(e,`/daemon/stop`),{drain:t,force:r,command_id:rt(),expected_revision:n}).then(Qe),replaceDaemon:(e,t,n=!1,r)=>w(T(e,`/daemon/replace`),{victim_sid:t,resume_continuous:n,command_id:rt(),expected_revision:r}).then(Qe),upgradeDaemon:(e,t)=>w(T(e,`/daemon/upgrade`),{command_id:rt(),expected_revision:t}).then(Qe)},mt=new Set([4401,4404]);function ht(e,t,n={}){let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=new URLSearchParams;n.replay!=null&&i.set(`replay`,String(n.replay)),i.set(`view`,`ui`);let a=ze();a&&i.set(`token`,a);let o=`${r}//${window.location.host}${T(e,`/stream`)}?${i}`,s=null,c=!1,l,u=()=>{c||(s=new WebSocket(o),s.onopen=()=>n.onOpen?.(),s.onmessage=e=>{try{let n=JSON.parse(e.data);n&&typeof n==`object`&&t(n)}catch{}},s.onclose=e=>{let t=!mt.has(e.code);n.onClose?.({code:e.code,reason:e.reason,retryable:t}),!c&&t&&(l=setTimeout(u,1e3))},s.onerror=()=>s?.close())};return u(),()=>{c=!0,l&&clearTimeout(l),s?.close()}}var gt={schema:1,id:`argus`,name:`Argus`,tagline:`Autonomous Work Lab`,terminal_wordmark:`argus`,assets:{}};function _t(e){if(!e||typeof e!=`object`)throw Error(`Invalid application brand`);let t=e;if(t.schema!==1||typeof t.id!=`string`||!/^[a-z][a-z0-9-]{0,39}$/.test(t.id))throw Error(`Invalid application brand identity`);for(let[e,n]of[[`name`,48],[`tagline`,100],[`terminal_wordmark`,24]]){let r=t[e];if(typeof r!=`string`||!r.trim()||r.length>n||/[\x00-\x1f\x7f-\x9f]/.test(r))throw Error(`Invalid application brand ${e}`)}if(!/^[a-z0-9 -]+$/.test(String(t.terminal_wordmark)))throw Error(`Invalid terminal wordmark`);if(!t.assets||typeof t.assets!=`object`||Array.isArray(t.assets))throw Error(`Invalid application brand assets`);let n={};for(let e of[`mark`,`mark_dark`,`logo`,`logo_dark`,`icon`,`icon_dark`]){let r=t.assets[e];if(r!==void 0&&r!==`/api/application-brand/assets/${e}`)throw Error(`Invalid application brand asset ${e}`);if(typeof r==`string`)n[e]=r;else if(t.id!==`argus`)throw Error(`Missing application brand asset ${e}`)}return{schema:1,id:t.id,name:String(t.name),tagline:String(t.tagline),terminal_wordmark:String(t.terminal_wordmark),assets:n}}var vt=gt,yt=()=>vt;async function bt(){let e=await fetch(`/api/application-brand`,{cache:`no-store`});if(!e.ok)throw Error(`Application identity unavailable (${e.status})`);if(vt=_t(await e.json()),vt.id!==`argus`){document.title=`${vt.name} · Workbench`,document.querySelector(`meta[name="apple-mobile-web-app-title"]`)?.setAttribute(`content`,vt.name),document.querySelector(`link[rel="manifest"]`)?.setAttribute(`href`,`/api/application-brand/manifest.webmanifest`);for(let e of document.querySelectorAll(`link[rel="icon"], link[rel="apple-touch-icon"]`))e.href=e.media.includes(`dark`)?vt.assets.icon_dark:vt.assets.icon,e.removeAttribute(`type`)}}var D=r(),xt=`argus.locale`,St={"language.english":`English`,"handshake.connecting":`Getting Argus ready`,"handshake.service":`Service`,"handshake.project":`Project`,"handshake.ready":`Ready`,"handshake.title":`Getting Argus ready`,"handshake.detail":`Reopening your workspace…`,"splash.starting":`Argus starting`,"rail.workbench":`Workbench`,"rail.sessionsShortcut":`Sessions · Ctrl/⌘ P`,"panel.backlog":`Backlog`,"panel.activity":`Activity`,"panel.journal":`Journal`,"panel.roles":`Roles`,"panel.project":`Project`,"panel.liveView":`Manager live project view`,"stream.jumpToLatest":`Jump to latest`,"stream.toggleReasoning":`Show or hide agent reasoning (⌘T)`,"stream.reasoning":`Reasoning`,"stream.noLogs":`No activity yet`,"stream.system":`Argus updates`,"stream.autonomous":`Background activity`,"stream.backgroundWork":`Argus is working in the background`,"stream.ready":`Argus is ready. Ask a question or assign work.`,"stream.historyLoading":`Loading conversation history…`,"stream.historyError":`Could not load conversation history.`,"stream.historyRetry":`Retry`,"stream.fold.read":`Read {count} files`,"stream.fold.search":`Searched {count} times`,"stream.fold.fetch":`Looked up {count} web pages`,"stream.fold.edit":`Edited {count} files`,"stream.fold.tool":`Used {tool} {count} times`,"stream.fold.failed":`{count} failed`,"stream.fold.expand":`Show each step`,"stream.fold.collapse":`Hide the steps`,"stream.repeated":`Repeated {count} times; showing the latest`,"stream.stepFailed":`failed`,"stream.stepResult":`Result`,"common.showRaw":`Show raw output`,"doctor.lastEntry":`Last entry`,"operations.metric.calls":`model calls today`,"operations.metric.failed":`failed`,"operations.metric.slowest":`slowest typical call`,"operations.slo.healthy":`Healthy`,"operations.slo.degraded":`Needs attention`,"operations.slo.loading":`Loading…`,"operations.validationFailures":`{count} malformed events today`,"operations.outputLines":`{count} lines of output`,"operations.done":`Done.`,"newDaemon.workdirPlaceholder":`Blank → ~/.argus-skill/workspaces/`,"operations.resetManager":`Reset Manager context`,"language.chinese":`中文`,"language.switchTo":`Switch to {language}`,"common.loading":`Loading…`,"common.retry":`Retry`,"common.save":`Save`,"common.cancel":`Cancel`,"common.close":`Close`,"common.settings":`Settings`,"common.ready":`Ready`,"common.live":`Live`,"common.reconnecting":`Reconnecting`,"common.stale":`Snapshot stale`,"common.degraded":`Snapshot degraded`,"common.external":`External`,"common.pause":`Pause`,"common.run":`Run`,"common.working":`Working`,"common.local":`Local`,"common.all":`All`,"common.unassigned":`Unassigned`,"common.closeSessions":`Close sessions`,"common.resizeSessions":`Resize sessions`,"common.resizePreview":`Resize preview`,"common.expandPreview":`Expand preview`,"time.justNow":`just now`,"time.minutesAgo":`{count}m ago`,"time.hoursAgo":`{count}h ago`,"time.yesterdayAt":`Yesterday at {time}`,"connection.pairingTitle":`This browser is not paired with Argus`,"connection.pairingDetail":`Open a valid pairing link for this Argus site, or paste the link or token below.`,"connection.pairAgain":`Pair again`,"connection.pairingInput":`Pairing link or token`,"connection.pairingPlaceholder":`Paste a fresh pairing link or token`,"connection.pairingInvalid":`Enter a valid pairing link or token.`,"connection.connect":`Connect`,"connection.unreachableTitle":`The local Argus service is unavailable`,"connection.unreachableDetail":`Keep Argus Desktop running, wait for the local service to become ready, then retry.`,"sidebar.collapse":`Collapse sessions`,"sidebar.expand":`Expand sessions`,"sidebar.create":`Create project`,"sidebar.find":`Find a project`,"sidebar.clearSearch":`Clear search`,"sidebar.refreshFailed":`Refresh failed · retry`,"sidebar.noSessions":`No sessions`,"sidebar.noMatches":`No sessions matching "{query}"`,"sidebar.unnamedSession":`Unnamed session`,"sidebar.daemonAlive":`Argus background is online`,"sidebar.updateRequired":`Update required`,"sidebar.updateAvailable":`Update available`,"sidebar.updateAvailableHint":`The executor is still running with a different release from this page.`,"sidebar.stopped":`Background stopped`,"sidebar.runningFor":`Background online · {uptime}`,"sidebar.lastActive":`Last active {time}`,"sidebar.manage":`Manage {name}`,"sidebar.manageHint":`Rename, pause, or delete`,"sidebar.resume":`Resume`,"sidebar.resumeHint":`Resume work in {workdir}`,"sidebar.resumeSuccess":`Session resumed.`,"sidebar.resumeFailed":`Could not resume session: {error}`,"sidebar.modelLoading":`Loading backend and model…`,"sidebar.modelUnavailable":`Backend and model unavailable`,"sidebar.defaultModel":`default model`,"sidebar.openSettings":`Open settings`,"sidebar.compute":`Compute queue & allowance`,"sidebar.theme":`{current} theme; switch to {next}`,"landing.selectOrCreate":`Select a session from the sidebar, or create a new one.`,"landing.noSessions":`No sessions yet. Create one to begin.`,"landing.select":`Select project`,"landing.new":`New project`,"landing.menu":`Open menu`,"project.missingSwitched":`Project “{requested}” was not found. Switched to {fallback}.`,"project.missingCreate":`Project “{requested}” was not found. Create a project to continue.`,"topbar.openSessions":`Open projects`,"topbar.externallyManaged":`Externally managed`,"topbar.pauseDaemon":`Pause Argus`,"topbar.runDaemon":`Run Argus`,"topbar.working":`Argus is working on your request`,"topbar.roleActive":`{role} is active`,"topbar.roleIdle":`{role} is idle`,"topbar.externalDaemonHint":`Argus is managed outside this app and must be controlled there.`,"topbar.manageSession":`Manage session`,"topbar.showPreview":`Show preview`,"topbar.showActivity":`Show activity`,"mobile.views":`Views`,"mobile.sessions":`Projects`,"mobile.mission":`Mission`,"mobile.activity":`Conversation`,"mobile.workbench":`Workbench`,"mobile.map":`Map`,"mobile.preview":`Files`,"chat.working":`Argus is working on your message`,"chat.workingQuiet":`Argus is working on your message · Still working; no new update for {quiet}s`,"chat.stopWaitingHint":`Esc stop reply · Enter sends a follow-up`,"chat.queuedWhileRunning":`Queued · answered right after this reply; a running task can be steered by it`,"chat.attachWhileRunning":`Attachments can be sent once this reply finishes`,"chat.stepsLive":`Working · {count} steps so far`,"chat.stepsDone":`{count} steps · {seconds}`,"chat.stepFailed":`failed`,"chat.stepRaw":`raw`,"chat.messageArgus":`message Argus`,"chat.selectSession":`Select a session…`,"chat.placeholder":`Ask a question or assign work`,"chat.routeLabel":`message category`,"chat.routeHint":`For this message only. Argus chooses one worker or a team based on the request; greetings stay in conversation.`,"chat.routeTask":`Task`,"chat.routeAuto":`Auto`,"chat.routeChat":`Chat`,"chat.attach":`attach files`,"chat.attachHint":`PNG, JPEG, WebP, PDF, Markdown/text, JSON, CSV · up to {count} files, {perFile} each, {total} total`,"chat.attachDrop":`Drop files to attach`,"chat.attachRemove":`remove attachment {name}`,"chat.attachUnsupported":`{name} is not supported. Use PNG, JPEG, WebP, PDF, Markdown/text, JSON, or CSV.`,"chat.attachTooLarge":`{name} exceeds the {size} per-file limit.`,"chat.attachTooMany":`You can attach up to {count} files per message.`,"chat.attachTotalTooLarge":`Attachments exceed the {size} total limit.`,"chat.attachmentUploadFailed":`Attachment upload failed: {error}`,"chat.uploadingAttachments":`Uploading attachments`,"chat.rewriteHint":`Let the Manager rewrite this prompt into a brief the team can act on. Nothing is sent — the rewrite lands back in this box for you to edit.`,"chat.rewriteLabel":`rewrite prompt with the Manager`,"chat.rewriting":`rewriting`,"chat.rewrite":`Rewrite text`,"chat.stopWaiting":`stop reply`,"chat.stopWaitingTitle":`Stop this Manager request`,"chat.stoppingReply":`Stopping this reply…`,"chat.stopReplyRequested":`Stop requested. You can send another message.`,"chat.replyAlreadyFinished":`This reply has already finished.`,"chat.stopReplyFailed":`Could not stop the server request: {error}`,"chat.send":`send message`,"copy.message":`Copy`,"copy.code":`Copy code`,"copy.copied":`Copied`,"help.title":`Keyboard shortcuts`,"help.commands":`Commands`,"help.palette":`command palette`,"help.sessions":`toggle sessions`,"help.managerChat":`focus Manager chat`,"help.rewrite":`rewrite the current prompt before sending`,"help.reasoning":`toggle agent reasoning`,"help.kiosk":`toggle kiosk (read-only) mode`,"help.composer":`focus the composer`,"help.send":`send message`,"help.newline":`insert newline`,"help.thisHelp":`this help`,"help.escape":`close overlay / stop waiting in composer`,"palette.placeholder":`Type a command or search…`,"palette.noMatches":`no matching commands`,"palette.navigate":`↑↓ navigate`,"palette.run":`↵ run`,"palette.close":`esc close`,"palette.view":`View`,"palette.action":`Action`,"palette.project":`Project`,"palette.newDaemon":`New session`,"palette.openTranscript":`Open Transcript`,"palette.openProject":`Open Project`,"palette.projectHint":`work · memory · agents`,"palette.openOperations":`Open Operations`,"palette.operationsHint":`session controls`,"palette.hideReasoning":`Hide reasoning`,"palette.showReasoning":`Show reasoning`,"palette.exitKiosk":`Exit kiosk mode`,"palette.enterKiosk":`Enter kiosk mode`,"palette.messageArgus":`Message Argus…`,"palette.stopWaiting":`Stop Manager reply`,"palette.stopContinuous":`Stop continuous campaign`,"palette.startContinuous":`Start continuous campaign`,"palette.stopDaemon":`Pause Argus`,"palette.startDaemon":`Run Argus`,"slash.suggestions":`Slash command suggestions`,"mission.roleActive":`{role} active`,"mission.overview":`mission overview`,"mission.operations":`Operations`,"role.manager":`Manager`,"role.manager.description":`Understands your goal and coordinates work`,"role.planner":`Planner`,"role.planner.description":`Breaks down the problem, schedules work, and revises the plan`,"role.engineer":`Engineer`,"role.engineer.description":`Researches, writes proofs or code, and uses tools to check the work`,"role.reviewer":`Reviewer`,"role.reviewer.description":`Checks results and evidence and identifies gaps`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`You`,"doctor.title":`Doctor`,"doctor.subtitle":`Argus status checks + recommended root-cause fix`,"doctor.recommended":`recommended fix`,"doctor.loadError":`Couldn’t load diagnostics.`,"doctor.empty":`No diagnostic data available`,"doctor.daemonLog":`Daemon log`,"settings.subtitle":`effective roles, budgets, and essential controls`,"settings.loadError":`Couldn’t load configuration.`,"settings.empty":`No configuration found`,"settings.quickConfig":`Quick Config`,"settings.appearance":`Appearance`,"settings.appearanceHint":`Choose the interface colour treatment. Logos and icons always remain monochrome.`,"settings.themeStyle":`Theme colour`,"settings.themeStyle.standard":`Standard`,"settings.themeStyle.standardHint":`Quiet black, white, grey, and blue.`,"settings.themeStyle.gradient":`Gradient`,"settings.themeStyle.gradientHint":`The classic Argus blue-to-gold background.`,"settings.backend":`Backend`,"settings.backendSource.env":`set by the server environment`,"settings.backendSource.persisted":`saved setting`,"settings.backendSource.default":`built-in default`,"settings.backendWillSave":`Apply saves {backend}.`,"settings.backendWillReplace":`Apply replaces the saved {saved} with {backend}.`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`Backend saved as {backend}. Restart Argus to apply.`,"settings.backendUnsupported":`Unsupported backend ({backend})`,"settings.backendUnavailable":`Backend unavailable`,"settings.model":`Model`,"settings.trialAccount":`Trial account`,"settings.trialKeyHint":`Replace your Key here when its allowance runs out. Your projects and conversations stay in place.`,"settings.changeTrialKey":`Change Key`,"settings.applyModel":`Apply`,"settings.modelPlaceholder":`auto (backend default)`,"settings.connection":`Connection`,"settings.webApi":`Web + REST API`,"settings.eventStream":`Live updates`,"settings.taskDaemon":`Background work`,"settings.taskDaemonValue":`Local process · events.jsonl · no TCP port`,"chat.messageTooLong":`Message exceeds 32,000 characters. Shorten it or upload a file. Your draft is preserved.`,"settings.required":`{field} is required`,"settings.advanced":`Advanced`,"settings.advancedHint":`Budgets, the advisor model, explanation effort, connection details and raw configuration`,"settings.mapModel":`Map`,"settings.mapModelFollows":`Follows the front-door model`,"settings.mapModelSet":`Map explanations now use {model}.`,"settings.overrideTitle":`Environment override`,"settings.overrideHint":`Set a specific config alias or environment-variable key.`,"settings.namePlaceholder":`name or alias, e.g. manager_model`,"settings.valuePlaceholder":`value`,"settings.applyAdvanced":`Apply environment override`,"settings.applied":`Applied. Restart affected sessions to use the new settings.`,"settings.modelAppliedToRoles":`Every role now uses {model}. Sessions already running keep their model until they restart.`,"settings.rolesRunning":`Roles now run:`,"settings.applyUnifies":`Apply sets all of them to the model above.`,"settings.rolesTitle":`Effective roles`,"settings.rawConfig":`Raw configuration`,"settings.group.limits":`Limits`,"settings.group.safety":`Safety`,"settings.group.interface":`Interface`,"settings.knob.activeDaemons":`Active session limit`,"settings.knob.activeDaemonsDoc":`Maximum background sessions running on this host.`,"settings.knob.safeMode":`Safe mode`,"settings.knob.safeModeDoc":`Enable extra-conservative runtime guardrails.`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`Enable the Telegram notification bridge.`,"settings.knob.showReasoning":`Show reasoning`,"settings.knob.showReasoningDoc":`Stream role reasoning into the activity view.`,"settings.knob.operatorAvailable":`Operator available`,"settings.knob.operatorAvailableDoc":`Off suppresses operator questions: Argus decides on recorded assumptions and blocks on operator-only actions.`,"noOperator.banner":`No-operator mode: questions suppressed. Argus decides on recorded assumptions instead of asking you.`,"noOperator.turnOff":`Ask me again`,"settings.source.notApplicable":`Not applicable for this model`,"settings.source.vaultDefault":`Capability vault / default`,"settings.source.default":`Default`,"settings.modelUnavailable":`unavailable`,"settings.modelOfflineList":`Offline list: the backend did not return its live models, showing the harness catalog.`,"settings.source.saved":`Saved override`,"settings.source.environment":`Environment variable`,"settings.source.hostConfig":`Host configuration`,"settings.source.other":`Resolved configuration`,"settings.value.enabled":`Enabled`,"settings.value.disabled":`Disabled`,"settings.effort.low":`Low effort`,"settings.effort.medium":`Medium effort`,"settings.effort.high":`High effort`,"settings.effort.xhigh":`Extra-high effort`,"settings.role.curator":`Curator`,"settings.role.curatorDoc":`Maintains and distills the reusable skill pool.`,"settings.footer":`Human-readable labels are shown with raw keys. The full registry remains available via`,"identity.title":`Identity`,"identity.subtitle":`who argus is working for on this project`,"identity.placeholder":`Describe who Argus is working for and durable preferences…`,"identity.save":`Save identity`,"identity.saved":`Identity saved.`,"transcript.title":`Transcript`,"transcript.subtitle":`recent operator ↔ argus turns · reply from the composer`,"transcript.empty":`no conversation turns yet`,"transcript.operator":`operator`,"new.createDaemon":`Create session`,"new.createdIdle":`New session ready. Say what it is for and the work begins.`,"new.createdStarting":`New session ready; the work is starting in the background.`,"new.subtitle":`Creates an isolated timeline and Manager context.`,"new.close":`close create session`,"new.name":`Name`,"new.optional":`(optional)`,"new.namePlaceholder":`e.g. AAAI embodiment paper`,"new.workdir":`Output workdir`,"new.workdirHint":`Agents write code, papers, reports, and experiment outputs here. Internal memory stays under the session state directory.`,"new.objective":`Objective`,"new.objectivePlaceholder":`Leave blank to start with a conversation, or describe a campaign to start immediately.`,"new.startsAfterCreate":`Campaign starts after session creation`,"new.idleUntilMessage":`Idle until the first message`,"new.startsHint":`The session opens immediately while Argus prepares the work in the background.`,"new.idleHint":`Background work starts after your first message, when needed.`,"new.shortcut":`Ctrl/⌘+Enter to create`,"new.creating":`Creating…`,"new.createAndStart":`Create and start`,"manage.daemon":`Manage session`,"manage.displayName":`Display name`,"manage.executor":`Background work`,"manage.running":`Running`,"manage.runningExternally":`Running externally`,"manage.paused":`Stopped`,"manage.pauseHint":`Interrupt the current operation and keep progress resumable.`,"manage.stopNow":`Stop now`,"manage.stopNowHint":`Immediately interrupt this verified daemon so the session can be deleted.`,"manage.externalHint":`This session is managed outside this app.`,"manage.resumeHint":`Resume queued research work.`,"manage.working":`Working…`,"manage.resume":`Resume`,"manage.deleteSession":`Delete session`,"manage.deleteHint":`Deleted sessions move to the trash and remain recoverable. Stop background work first.`,"manage.delete":`Delete…`,"manage.confirmQuestion":`Move this session to trash?`,"manage.confirmDelete":`Confirm delete`,"decision.operator":`Operator decision`,"decision.required":`Decision required`,"decision.whyBlocked":`Recorded reason this task needs input`,"decision.currentTask":`Current task`,"decision.taskName":`Task: {title}`,"decision.otherTask":`Another task awaiting input`,"decision.awaitingReply":`Awaiting your reply`,"decision.askedAt":`Asked {time}`,"decision.evidence":`Evidence`,"decision.notePlaceholder":`Add the guidance the Manager should apply…`,"decision.resumeHint":`Your answer applies to this task. The Manager checks its next step.`,"decision.later":`Later`,"decision.applying":`Submitted; Argus is starting on it…`,"decision.closeContinue":`Close, keep working`,"decision.stopCampaign":`Stop campaign`,"decision.useOption":`Use this option`,"decision.sendAnswer":`Send answer`,"decision.noteRequired":`Add the required details before sending this choice.`,"artifact.preview":`Result preview`,"artifact.title":`Result`,"artifact.approvedEvidence":`evidence the Reviewer has checked`,"artifact.downloading":`Downloading…`,"artifact.download":`Download`,"artifact.open":`Open`,"artifact.close":`close result preview`,"artifact.unavailable":`preview unavailable`,"artifact.empty":`(empty file)`,"artifact.truncated":`preview truncated · download to inspect the complete file`,"artifact.htmlTooLarge":`HTML preview is too large to render safely. Download the complete file.`,"artifact.pdfDisabled":`Inline PDF preview is disabled by this browser.`,"artifact.openPdf":`Open PDF`,"artifact.noPreview":`This file type has no safe inline preview.`,"artifact.downloadHint":`Download it to inspect with a local application.`,"task.details":`Task details`,"task.stopLoop":`stop loop`,"task.done":`done`,"task.skip":`skip`,"task.close":`close task details`,"task.waitingOnYou":`Waiting on you`,"task.objective":`Objective`,"task.noObjective":`(no objective recorded)`,"task.untitled":`Untitled task`,"task.priority":`priority`,"task.started":`started`,"task.finished":`finished`,"task.outcome":`Outcome`,"task.iteration":`Iteration`,"task.mode":`mode`,"task.autoIterate":`auto-iterate`,"task.singlePass":`single pass`,"task.cycles":`cycles`,"task.cost":`cost`,"task.lastError":`Last error`,"task.notes":`Notes`,"task.dependsOn":`depends on`,"task.dependsOnCount":`Depends on {count} earlier tasks`,"pending.reviewRespond":`Review and respond`,"pending.showOnMap":`Show on map`,"backlog.active":`Active · {count}`,"backlog.history":`History · {count}`,"backlog.noHistory":`No completed work yet`,"backlog.empty":`Nothing queued. Argus is ready for new work.`,"backlog.viewDetails":`View full task details`,"backlog.iterating":`Repeating`,"backlog.stopIterating":`Stop repeating`,"backlog.stop":`Stop`,"backlog.markDone":`Mark done`,"backlog.remove":`Remove`,"mission.achievement":`Argus achievement`,"mission.elapsed":`Elapsed`,"mission.rejectedAttempts":`{count} rejected attempts`,"mission.skillsLearned":`{count} skills learned`,"mission.artifacts":`{count} files produced`,"mission.waiting":`Waiting for a mission`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`Ready when you are — assign a mission to begin.`,"mission.statusDone":`This task: {outcome} — finished in {elapsed}.`,"mission.nextAfterReply":`Reply to this task’s question first, then decide its next step.`,"mission.continuousDone":`Continuous run finished`,"mission.resumeContinuous":`Resume`,"mission.control":`Mission control`,"mission.attentionHealth":`System error — health is degraded.`,"mission.attentionFailed":`Mission failed — check the task below.`,"mission.deliveryFailed":`Task failed at delivery — execution could not start or finish.`,"mission.attentionStepFailed":`A step failed — check the task below.`,"mission.attentionPaused":`Mission is paused — waiting for your input.`,"mission.showObjective":`Show full objective`,"mission.showFullOutput":`View full output`,"mission.stage":`Stage`,"mission.campaign":`Campaign`,"mission.totalElapsed":`Total elapsed`,"mission.round":`Round`,"mission.mode":`Mode`,"mission.summary":`Mission summary`,"mission.deliveryCertified":`Delivery approved`,"mission.taskCompleted":`Task completed`,"mission.openResult":`Open result`,"mission.viewTask":`View task`,"mission.taskPlan":`Task plan`,"mission.team":`Team`,"mission.waitingShort":`Waiting`,"mission.roleWork":`Role work`,"mission.showMore":`Show more`,"mission.showLess":`Show less`,"mission.done":`Done`,"mission.inProgress":`In progress`,"mission.failed":`Failed`,"mission.bannerPaused":`Mission is paused — waiting for your input.`,"mission.bannerError":`System error — health is degraded.`,"mission.bannerStepFailed":`A step failed: {step}`,"mission.elapsedAgo":`{elapsed} ago`,"mission.filteredBy":`filtered by {task} · clear`,"mission.allVisible":`all visible missions`,"mission.roundNumber":`round {count}`,"mission.noRoleWork":`No persisted {role} work for this selection yet.`,"mission.researchDag":`Task route`,"mission.active":`active`,"mission.noDag":`The Planner has not added tasks to the route yet.`,"mission.workingHypothesis":`Working hypothesis · can be revised`,"mission.goalContribution":`How this supports the goal`,"mission.temporaryRegressions":`Expected temporary tradeoffs`,"mission.decisionRule":`When to revise, split, or stop`,"mission.acceptance":`What counts as done`,"mission.nonGoals":`Non-goals`,"mission.capabilities":`Capabilities`,"mission.capabilitiesUnlocked":`Capabilities unlocked`,"mission.learnedCapability":`Learned capability`,"mission.learnedDuring":`Learned during {mission}`,"mission.skillUnavailable":`Skill content is not available in this snapshot.`,"mission.contentTruncated":`Content preview truncated`,"mission.knowledgeRetained":`Knowledge retained`,"mission.selfEvolution":`Saved project knowledge`,"mission.knowledgeSaved":`Argus saved these capabilities and notes for future work on this project.`,"mission.noCapabilities":`No capabilities learned yet.`,"mission.replay":`Mission replay`,"mission.replayTimeline":`Replay mission timeline`,"mission.roleFailed":`{role} failed`,"mission.showingLatestEvent":`Showing latest event`,"mission.showingLastEvents":`Showing last {count} events`,"mission.waitingEvents":`Waiting for structured research events.`,"mission.startsAfter":`Starts after {count} earlier tasks`,"mission.hiddenTasks":`{count} earlier tasks hidden · {failed} blocked or failed · {skipped} skipped`,"mission.projectFilesChanged":`Project files changed`,"mission.reviewInIde":`Open the IDE to review the diff`,"research.currentWork":`Current work`,"research.dagProgress":`Task route progress`,"research.verifiedOutputs":`Verified outputs`,"research.recentMilestones":`Recent milestones`,"research.liveProgress":`Task progress`,"research.artifact":`Research result`,"research.canvas":`Manager live research canvas`,"research.previewArtifact":`Preview the result`,"research.openLarge":`Open large preview`,"research.collapse":`Collapse preview`,"research.unavailable":`Manager live view is temporarily unavailable.`,"research.noPreview":`No preview`,"research.waiting":`Waiting…`,"research.updating":`Updating…`,"research.fileUnavailable":`This file is ready to download using the button above.`,"research.eventSourced":`event-sourced mission state`,"research.downloadFailed":`download failed`,"operations.title":`Operations`,"operations.work":`Work`,"operations.runtime":`Runtime`,"operations.system":`System`,"operations.recovery":`Recovery`,"operations.workInput":`Work input`,"operations.workHint":`Queue work, guide the active task, save a note, or preview a plan without dispatching it.`,"operations.action.task":`Task`,"operations.action.nudge":`Guide`,"operations.action.note":`Note`,"operations.action.plan":`Plan`,"operations.planPlaceholder":`Objective to preview; preview never queues work`,"operations.actionPlaceholder":`{action} text`,"operations.previewPlan":`Preview plan`,"operations.submitAction":`Submit {action}`,"operations.runtimeHint":`Change where this session runs, reset Manager context, or safely restart the session.`,"operations.workdir":`Working directory`,"operations.workdirUpdated":`Working directory updated.`,"operations.applyWorkdir":`Apply working directory`,"operations.replaceSlot":`Replace an active session`,"operations.sourceUpdate":`Argus source version`,"operations.pullLatest":`Pull latest version`,"operations.updateChecking":`Checking published branch…`,"operations.updateRunning":`Updating…`,"operations.updateAvailable":`Update available`,"operations.updateCurrent":`Up to date`,"operations.updateUnavailable":`This checkout cannot be updated safely.`,"operations.currentRevision":`Current`,"operations.latestRevision":`Latest`,"operations.updatePhase":`Phase`,"operations.updateRestart":`Source updated. Restart the cockpit, then use the reload button to move active daemons to the new release at a safe task boundary.`,"operations.skills":`Skills`,"operations.runSkill":`Run skill command`,"operations.metrics":`System metrics`,"operations.trash":`Recoverable trash`,"operations.searchTrash":`Search trash`,"operations.trashEmpty":`Trash is empty.`,"resource.title":`Resources`,"resource.loading":`Loading resource status…`,"resource.devices":`Devices: {count}`,"resource.inUse":`In use · {count}`,"resource.queue":`Queue · {count}`,"resource.none":`None`,"resource.timeLeft":`{ttl} left`,"resource.noIntent":`No purpose recorded`,"resource.yieldRequest":`Resource release requested · {reason}`,"resource.queuePosition":`Queue position {position}`,"label.status.inProgress":`In progress`,"label.status.waiting":`Waiting`,"label.status.completed":`Completed`,"label.status.blocked":`Blocked`,"label.status.failed":`Failed`,"label.status.needsChanges":`Needs changes`,"label.status.skipped":`Skipped`,"label.status.paused":`Paused`,"label.status.cancelled":`Cancelled`,"label.status.available":`Available`,"label.status.unavailable":`Unavailable`,"label.status.inaccessible":`Not accessible`,"label.status.limited":`Limited`,"label.status.healthy":`Healthy`,"label.status.updated":`Status updated`,"label.role.argus":`Argus`,"label.role.you":`You`,"label.work.task":`Task`,"label.work.action":`Work step`,"label.work.handoff":`Notes for the next step`,"label.work.review":`Review`,"label.work.planning":`Planning`,"label.work.update":`Update`,"label.stage.scope":`Scope`,"label.stage.research":`Research`,"label.stage.implementation":`Implementation`,"label.stage.experiment":`Experiments`,"label.stage.analysis":`Analysis`,"label.stage.writing":`Writing`,"label.stage.review":`Final review`,"label.stage.delivery":`Delivery`,"label.stage.unstaged":`Unstaged`,"label.frontier.reopened":`An earlier task was reopened`,"label.frontier.added":`A new task was added`,"label.frontier.completed":`A task path was completed`,"label.frontier.revised":`The task plan was revised`,"label.frontier.narrowed":`The task scope was narrowed`,"label.frontier.expanded":`The task scope was expanded`,"label.frontier.updated":`The task plan was updated`,"label.priority":`Priority {priority}`,"label.outcome.workCompleted":`Work completed`,"label.outcome.workPaused":`Work paused`,"label.outcome.workBlocked":`Work blocked`,"label.outcome.workFailed":`Work failed`,"label.outcome.workEnded":`Work ended`,"label.outcome.workIncomplete":`Work incomplete`,"label.outcome.workStalled":`Work stalled`,"label.outcome.workUpdated":`Work status updated`,"label.outcome.reviewPassed":`Review passed`,"label.outcome.reviewNeedsChanges":`Review requested changes`,"label.outcome.reviewBlocked":`Review blocked`,"label.outcome.reviewOutdated":`Review is out of date`,"label.outcome.reviewPending":`Review pending`,"label.outcome.stageApproved":`Stage approved`,"label.outcome.stageNotApproved":`Stage not approved`,"label.outcome.stageRevoked":`Stage approval revoked`,"label.outcome.stageNotNeeded":`Stage decision not needed`,"label.outcome.stagePending":`Stage decision pending`,"label.outcome.budgetPaused":`Paused by budget limit`,"label.outcome.costUnreconciled":`Awaiting provider usage reconciliation`,"label.outcome.waitingForYou":`Waiting for your response`,"label.outcome.stoppedByYou":`Stopped by you`,"label.outcome.pausedByYou":`Paused by you`,"label.outcome.sessionPaused":`Session paused`,"label.outcome.serviceUnavailable":`Service unavailable`,"label.outcome.serviceCoolingDown":`Service temporarily paused`,"label.outcome.temporaryIssue":`Paused by a temporary issue`,"label.outcome.serviceError":`Stopped by a service error`,"label.outcome.needsPlan":`A new plan is needed`,"label.outcome.canResume":`Can resume`,"label.routing.team":`Team workflow`,"label.routing.individual":`Individual workflow`,"label.routing.research":`Research`,"label.routing.software":`Software work`,"label.routing.staged":`Step by step`,"label.routing.flexible":`Flexible workflow`,"label.routing.ongoing":`Ongoing`,"label.routing.defined":`Defined scope`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`Accelerator`,"label.resource.enforced":`Limits enforced`,"label.resource.advisory":`Recommendations only`,"label.resource.released":`Resources released`,"label.resource.kept":`Resources kept`,"mission.lastProgress":`Progress recorded before the stop`,"mission.nextResume":`The progress is saved. Run Argus again and it continues from where it stopped.`,"mission.nextResumeLive":`Argus will continue from the saved progress.`,"research.totalTime":`Total time`,"research.optionDelivery":`Delivery`,"research.optionCheckpoint":`Checkpoint`,"research.optionPending":`being written`,"operations.unavailableHere":`This is not available on this Argus.`,"operations.requestFailed":`That did not go through.`,"operations.technicalDetails":`Technical details`,"verticals.title":`Vertical Store`,"verticals.entry":`Verticals`,"verticals.openStore":`Open Vertical Store`,"verticals.paletteHint":`install · enable · update`,"verticals.intro":`A vertical gives Argus a research domain: its stages, roles, skills and checks. Install what your projects need and enable it per workspace.`,"verticals.hostedNote":`Verticals are provided by the host; you can enable or disable them for your workspace.`,"verticals.close":`Close vertical store`,"verticals.search":`Search verticals`,"verticals.searchPlaceholder":`Search by name, purpose or tag…`,"verticals.refreshCatalog":`Refresh catalog`,"verticals.refreshing":`Refreshing…`,"verticals.catalogSource":`Catalog: {source}`,"verticals.catalogRelease":`Release {tag}`,"verticals.catalogFetched":`Fetched {time}`,"verticals.catalogNever":`Catalog not fetched yet`,"verticals.catalogError":`The catalog could not be refreshed: {error}`,"verticals.kindFilter":`Filter by kind`,"verticals.tagFilter":`Filter by tag`,"verticals.clearFilters":`Clear filters`,"verticals.count":`{shown} of {total}`,"verticals.filter.all":`All`,"verticals.routingPath":`Category / domain / specialty`,"verticals.filter.installed":`Installed`,"verticals.filter.available":`Available`,"verticals.filter.builtin":`Built-in`,"verticals.kind.builtin":`Built-in`,"verticals.kind.package":`Bundled`,"verticals.kind.installed":`Installed`,"verticals.kind.available":`Available`,"verticals.enabled":`Enabled`,"verticals.disabledState":`Disabled`,"verticals.updateAvailable":`Update available`,"verticals.updateTo":`Update to {version}`,"verticals.installedVersion":`Installed {version}`,"verticals.catalogVersion":`Catalog {version}`,"verticals.requires":`Requires`,"verticals.shared":`Shares resources with`,"verticals.size":`Size`,"verticals.jumpTo":`Go to {name}`,"verticals.missingPython":`Needs: {packages} — install them into the Python environment Argus runs from.`,"verticals.runtimeIssues":`Installed version is incompatible with this Argus runtime: {issues}`,"verticals.installIssues":`Catalog installation/update is blocked by runtime requirements: {issues}`,"verticals.usedByOne":`Used by 1 project`,"verticals.usedBy":`Used by {count} projects`,"verticals.action.install":`Install`,"verticals.action.update":`Update`,"verticals.action.enable":`Enable`,"verticals.action.disable":`Disable`,"verticals.action.uninstall":`Uninstall`,"verticals.confirmUninstall":`Confirm uninstall`,"verticals.confirmUninstallHint":`Removes {name} from this Argus.`,"verticals.removeAnyway":`Remove anyway`,"verticals.operation.install":`Installing…`,"verticals.operation.update":`Updating…`,"verticals.operation.enable":`Enabling…`,"verticals.operation.disable":`Disabling…`,"verticals.operation.uninstall":`Uninstalling…`,"verticals.operationRunning":`Working…`,"verticals.operationFailed":`{action} failed`,"verticals.loading":`Loading verticals…`,"verticals.noMatches":`No verticals match these filters.`,"verticals.none":`No verticals are listed yet.`,"verticals.loadFailed":`Could not read the vertical list.`,"verticals.actionFailed":`That did not go through.`,"verticals.tooOld":`This Argus backend predates the vertical store. Update Argus, then reopen this page to manage verticals.`},Ct={"language.english":`English`,"handshake.connecting":`正在准备 Argus`,"handshake.service":`服务`,"handshake.project":`项目`,"handshake.ready":`就绪`,"handshake.title":`正在准备 Argus`,"handshake.detail":`正在恢复你的工作区…`,"splash.starting":`Argus 启动中`,"rail.workbench":`工作台`,"rail.sessionsShortcut":`会话 · Ctrl/⌘ P`,"panel.backlog":`待办`,"panel.activity":`对话与进展`,"panel.journal":`日志`,"panel.roles":`角色`,"panel.project":`项目`,"panel.liveView":`Manager 实时项目视图`,"stream.jumpToLatest":`跳到最新`,"stream.toggleReasoning":`显示或隐藏 Agent 推理(⌘T)`,"stream.reasoning":`推理`,"stream.noLogs":`暂无活动`,"stream.system":`Argus 动态`,"stream.autonomous":`后台活动`,"stream.backgroundWork":`Argus 正在后台工作`,"stream.ready":`Argus 已就绪。你可以提问或安排下一项工作。`,"stream.historyLoading":`正在读取对话记录…`,"stream.historyError":`对话记录暂时读取失败。`,"stream.historyRetry":`重试`,"stream.fold.read":`读取了 {count} 个文件`,"stream.fold.search":`搜索了 {count} 次`,"stream.fold.fetch":`查阅了 {count} 个网页`,"stream.fold.edit":`修改了 {count} 个文件`,"stream.fold.tool":`使用了 {count} 次 {tool}`,"stream.fold.failed":`{count} 次失败`,"stream.fold.expand":`展开每一步`,"stream.fold.collapse":`收起`,"stream.repeated":`重复了 {count} 次,显示最近一次`,"stream.stepFailed":`失败`,"stream.stepResult":`结果`,"common.showRaw":`显示原始输出`,"doctor.lastEntry":`最近一条`,"operations.metric.calls":`今日模型调用`,"operations.metric.failed":`失败`,"operations.metric.slowest":`最慢的常规调用`,"operations.slo.healthy":`正常`,"operations.slo.degraded":`需要留意`,"operations.slo.loading":`加载中…`,"operations.validationFailures":`今日 {count} 条格式异常的事件`,"operations.outputLines":`共 {count} 行输出`,"operations.done":`已完成。`,"newDaemon.workdirPlaceholder":`留空 → ~/.argus-skill/workspaces/`,"operations.resetManager":`重新开始理解这段对话`,"language.chinese":`中文`,"language.switchTo":`切换到{language}`,"common.loading":`加载中…`,"common.retry":`重试`,"common.save":`保存`,"common.cancel":`取消`,"common.close":`关闭`,"common.settings":`设置`,"common.ready":`就绪`,"common.live":`实时`,"common.reconnecting":`正在重连`,"common.stale":`快照已过期`,"common.degraded":`快照异常`,"common.external":`外部`,"common.pause":`暂停`,"common.run":`运行`,"common.working":`处理中`,"common.local":`本地`,"common.all":`全部`,"common.unassigned":`未分配`,"common.closeSessions":`关闭会话列表`,"common.resizeSessions":`调整会话列表宽度`,"common.resizePreview":`调整预览区域宽度`,"common.expandPreview":`展开预览`,"time.justNow":`刚刚`,"time.minutesAgo":`{count}分钟前`,"time.hoursAgo":`{count}小时前`,"time.yesterdayAt":`昨天 {time}`,"connection.pairingTitle":`此浏览器尚未与 Argus 配对`,"connection.pairingDetail":`请打开这个站点的有效配对链接,或在下方粘贴配对链接或令牌。`,"connection.pairAgain":`重新配对`,"connection.pairingInput":`配对链接或令牌`,"connection.pairingPlaceholder":`粘贴新的配对链接或令牌`,"connection.pairingInvalid":`请输入有效的配对链接或令牌。`,"connection.connect":`连接`,"connection.unreachableTitle":`Argus 本地服务当前不可达`,"connection.unreachableDetail":`请保持 Argus Desktop 运行,等待本地服务就绪后再重试。`,"sidebar.collapse":`收起会话`,"sidebar.expand":`展开会话`,"sidebar.create":`创建项目`,"sidebar.find":`查找项目`,"sidebar.clearSearch":`清除搜索`,"sidebar.refreshFailed":`刷新失败 · 重试`,"sidebar.noSessions":`暂无会话`,"sidebar.noMatches":`没有匹配"{query}"的会话`,"sidebar.unnamedSession":`未命名会话`,"sidebar.daemonAlive":`Argus 后台在线`,"sidebar.updateRequired":`需要更新`,"sidebar.updateAvailable":`可更新`,"sidebar.updateAvailableHint":`后台仍在运行,执行器与网页版本不同。`,"sidebar.stopped":`后台已停止`,"sidebar.runningFor":`后台在线 · {uptime}`,"sidebar.lastActive":`上次活动 {time}`,"sidebar.manage":`管理 {name}`,"sidebar.manageHint":`重命名、暂停或删除`,"sidebar.resume":`继续`,"sidebar.resumeHint":`在 {workdir} 中继续工作`,"sidebar.resumeSuccess":`会话已恢复。`,"sidebar.resumeFailed":`无法恢复会话:{error}`,"sidebar.modelLoading":`正在加载后端和模型…`,"sidebar.modelUnavailable":`后端和模型信息不可用`,"sidebar.defaultModel":`默认模型`,"sidebar.openSettings":`打开设置`,"sidebar.compute":`算力队列与账户额度`,"sidebar.theme":`{current}主题;切换到{next}主题`,"landing.selectOrCreate":`从侧边栏选择一个会话,或创建新会话。`,"landing.noSessions":`还没有会话。创建一个即可开始。`,"landing.select":`选择项目`,"landing.new":`新建项目`,"landing.menu":`打开菜单`,"project.missingSwitched":`找不到项目“{requested}”,已切换到 {fallback}。`,"project.missingCreate":`找不到项目“{requested}”,请新建一个项目继续。`,"topbar.openSessions":`打开项目列表`,"topbar.externallyManaged":`由外部管理`,"topbar.pauseDaemon":`暂停 Argus`,"topbar.runDaemon":`运行 Argus`,"topbar.working":`Argus 正在处理你的请求`,"topbar.roleActive":`{role} 活跃中`,"topbar.roleIdle":`{role} 空闲`,"topbar.externalDaemonHint":`Argus 由此应用之外的服务管理,请前往相应位置控制。`,"topbar.manageSession":`管理会话`,"topbar.showPreview":`显示预览`,"topbar.showActivity":`显示动态`,"mobile.views":`视图`,"mobile.sessions":`项目`,"mobile.mission":`任务`,"mobile.activity":`对话`,"mobile.workbench":`工作台`,"mobile.map":`地图`,"mobile.preview":`文件`,"chat.working":`Argus 正在处理你的消息`,"chat.workingQuiet":`Argus 正在处理你的消息 · 仍在处理中,{quiet} 秒暂无新进展`,"chat.stopWaitingHint":`按 Esc 停止回复 · 按 Enter 追加消息`,"chat.queuedWhileRunning":`已排队 · 这条回复结束后立即处理;正在运行的任务会据此调整`,"chat.attachWhileRunning":`附件要等这条回复结束后再发送`,"chat.stepsLive":`正在工作 · 已 {count} 步`,"chat.stepsDone":`过程 {count} 步 · {seconds}`,"chat.stepFailed":`失败`,"chat.stepRaw":`原始参数`,"chat.messageArgus":`向 Argus 发送消息`,"chat.selectSession":`请选择会话…`,"chat.placeholder":`提问或安排工作`,"chat.routeLabel":`消息类型`,"chat.routeHint":`仅用于本条消息。Argus 根据实际需要选择单智能体或团队,问候直接回复。`,"chat.routeTask":`任务`,"chat.routeAuto":`自动`,"chat.routeChat":`对话`,"chat.attach":`添加文件`,"chat.attachHint":`支持 PNG、JPEG、WebP、PDF、Markdown/文本、JSON、CSV · 每条消息最多 {count} 个文件,单个 {perFile},总计 {total}`,"chat.attachDrop":`拖放文件以添加附件`,"chat.attachRemove":`移除附件 {name}`,"chat.attachUnsupported":`{name} 不受支持。请使用 PNG、JPEG、WebP、PDF、Markdown/文本、JSON 或 CSV。`,"chat.attachTooLarge":`{name} 超过单文件大小限制 {size}。`,"chat.attachTooMany":`每条消息最多只能附带 {count} 个文件。`,"chat.attachTotalTooLarge":`附件总大小超过 {size} 限制。`,"chat.attachmentUploadFailed":`附件上传失败:{error}`,"chat.uploadingAttachments":`正在上传附件`,"chat.rewriteHint":`把这段话整理得更清楚。改写结果会回到输入框,由你检查后发送。`,"chat.rewriteLabel":`整理这段话`,"chat.rewriting":`正在改写`,"chat.rewrite":`改写文字`,"chat.stopWaiting":`停止回复`,"chat.stopWaitingTitle":`停止处理这条消息`,"chat.stoppingReply":`正在停止当前回复…`,"chat.stopReplyRequested":`已收到停止请求,可以发送新消息。`,"chat.replyAlreadyFinished":`这次回复已经结束。`,"chat.stopReplyFailed":`服务端未能停止这次请求:{error}`,"chat.send":`发送消息`,"copy.message":`复制`,"copy.code":`复制代码`,"copy.copied":`已复制`,"help.title":`键盘快捷键`,"help.commands":`命令`,"help.palette":`打开命令面板`,"help.sessions":`展开或收起会话`,"help.managerChat":`聚焦 Manager 对话框`,"help.rewrite":`发送前改写当前提示词`,"help.reasoning":`显示或隐藏 Agent 推理`,"help.kiosk":`切换只读展示模式`,"help.composer":`聚焦输入框`,"help.send":`发送消息`,"help.newline":`插入换行`,"help.thisHelp":`打开此帮助`,"help.escape":`关闭浮层或停止等待`,"palette.placeholder":`输入命令或搜索…`,"palette.noMatches":`没有匹配的命令`,"palette.navigate":`↑↓ 导航`,"palette.run":`↵ 执行`,"palette.close":`Esc 关闭`,"palette.view":`视图`,"palette.action":`操作`,"palette.project":`项目`,"palette.newDaemon":`新建会话`,"palette.openTranscript":`打开对话记录`,"palette.openProject":`打开项目`,"palette.projectHint":`工作 · 记忆 · Agent`,"palette.openOperations":`打开运行控制`,"palette.operationsHint":`会话控制`,"palette.hideReasoning":`隐藏推理`,"palette.showReasoning":`显示推理`,"palette.exitKiosk":`退出展示模式`,"palette.enterKiosk":`进入展示模式`,"palette.messageArgus":`向 Argus 发送消息…`,"palette.stopWaiting":`停止当前回复`,"palette.stopContinuous":`停止持续任务`,"palette.startContinuous":`启动持续任务`,"palette.stopDaemon":`暂停 Argus`,"palette.startDaemon":`运行 Argus`,"slash.suggestions":`Slash 命令建议`,"mission.roleActive":`{role} 正在工作`,"mission.overview":`任务概览`,"mission.operations":`运行控制`,"role.manager":`统筹`,"role.manager.description":`理解你的目标,协调工作`,"role.planner":`规划`,"role.planner.description":`拆解问题,安排后续工作并调整计划`,"role.engineer":`执行`,"role.engineer.description":`查资料、写证明或代码,调用工具验证`,"role.reviewer":`复核`,"role.reviewer.description":`检查结果与证据,指出缺口`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`你`,"doctor.title":`诊断`,"doctor.subtitle":`Argus 状态检查与推荐的根因修复方案`,"doctor.recommended":`推荐修复`,"doctor.loadError":`无法加载诊断数据。`,"doctor.empty":`诊断暂无数据`,"doctor.daemonLog":`后台进程日志`,"settings.subtitle":`生效中的角色、预算和关键控制项`,"settings.loadError":`无法加载配置。`,"settings.empty":`未找到配置`,"settings.quickConfig":`快速配置`,"settings.appearance":`外观`,"settings.appearanceHint":`选择界面主题色。Logo 与图标始终保持黑白,不参与渐变。`,"settings.themeStyle":`主题色`,"settings.themeStyle.standard":`标准`,"settings.themeStyle.standardHint":`克制的黑、白、灰与蓝色。`,"settings.themeStyle.gradient":`渐变`,"settings.themeStyle.gradientHint":`经典 Argus 蓝金渐变背景。`,"settings.backend":`后端`,"settings.backendSource.env":`由服务器环境设置`,"settings.backendSource.persisted":`已保存的设置`,"settings.backendSource.default":`内置默认值`,"settings.backendWillSave":`应用后保存为{backend}。`,"settings.backendWillReplace":`应用后把已保存的{saved}改为{backend}。`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`后端已保存为{backend}。重启 Argus 后生效。`,"settings.backendUnsupported":`不支持的后端({backend})`,"settings.backendUnavailable":`后端信息不可用`,"settings.model":`模型`,"settings.trialAccount":`试用账号`,"settings.trialKeyHint":`额度用完后可在这里更换 Key,项目和对话会保留。`,"settings.changeTrialKey":`更换 Key`,"settings.applyModel":`应用`,"settings.modelPlaceholder":`auto(后端默认模型)`,"settings.connection":`连接`,"settings.webApi":`Web + REST API`,"settings.eventStream":`实时动态`,"settings.taskDaemon":`后台工作`,"settings.taskDaemonValue":`本地进程 · events.jsonl · 无 TCP 端口`,"chat.messageTooLong":`消息超过 32,000 字符,请缩短或作为附件上传。草稿已保留。`,"settings.required":`必须填写{field}`,"settings.advanced":`高级设置`,"settings.advancedHint":`预算、顾问模型、讲解强度、连接详情与原始配置`,"settings.mapModel":`地图`,"settings.mapModelFollows":`跟随前台模型`,"settings.mapModelSet":`地图讲解现在用 {model}。`,"settings.overrideTitle":`环境变量覆盖`,"settings.overrideHint":`设置特定的配置别名或环境变量键。`,"settings.namePlaceholder":`名称或别名,例如 manager_model`,"settings.valuePlaceholder":`值`,"settings.applyAdvanced":`应用环境变量覆盖`,"settings.applied":`设置已应用。请重启受影响的会话以使用新设置。`,"settings.modelAppliedToRoles":`所有角色现在都用 {model}。正在运行的会话要重启后才换。`,"settings.rolesRunning":`各角色当前实际使用:`,"settings.applyUnifies":`点“应用”会把它们统一成上面的模型。`,"settings.rolesTitle":`生效中的角色`,"settings.rawConfig":`原始配置`,"settings.group.limits":`限制`,"settings.group.safety":`安全`,"settings.group.interface":`界面`,"settings.knob.activeDaemons":`活动会话上限`,"settings.knob.activeDaemonsDoc":`此主机上可同时运行的后台会话数量上限。`,"settings.knob.safeMode":`安全模式`,"settings.knob.safeModeDoc":`启用更保守的运行时保护措施。`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`启用 Telegram 通知桥接。`,"settings.knob.showReasoning":`显示推理`,"settings.knob.showReasoningDoc":`在活动视图中显示角色推理过程。`,"settings.knob.operatorAvailable":`有人值守`,"settings.knob.operatorAvailableDoc":`关闭后不再向你提问:Argus 依据记录的假设自行决定,需要你授权的操作会直接停下。`,"noOperator.banner":`无人值守模式:已停止提问。Argus 会依据记录的假设自行决定,而不是问你。`,"noOperator.turnOff":`恢复提问`,"settings.source.notApplicable":`不适用于此模型`,"settings.source.vaultDefault":`能力库 / 默认值`,"settings.source.default":`默认值`,"settings.modelUnavailable":`不可用`,"settings.modelOfflineList":`离线列表:后端没有返回实时模型列表,显示的是本地目录。`,"settings.source.saved":`已保存的覆盖值`,"settings.source.environment":`环境变量`,"settings.source.hostConfig":`主机配置`,"settings.source.other":`解析后的配置`,"settings.value.enabled":`已启用`,"settings.value.disabled":`已停用`,"settings.effort.low":`低推理强度`,"settings.effort.medium":`中等推理强度`,"settings.effort.high":`高推理强度`,"settings.effort.xhigh":`超高推理强度`,"settings.role.curator":`知识维护`,"settings.role.curatorDoc":`维护并提炼可复用技能库。`,"settings.footer":`配置项同时显示易读标签和原始键。完整配置仍可通过以下命令查看:`,"identity.title":`身份`,"identity.subtitle":`本项目中 Argus 服务的对象`,"identity.placeholder":`描述 Argus 正在为谁工作,以及需要长期遵循的偏好…`,"identity.save":`保存身份`,"identity.saved":`身份已保存。`,"transcript.title":`对话记录`,"transcript.subtitle":`近期操作者 ↔ Argus 对话 · 请从输入框继续回复`,"transcript.empty":`暂无对话记录`,"transcript.operator":`操作者`,"new.createDaemon":`创建会话`,"new.createdIdle":`新会话已就绪。说一句你想做什么,工作就开始了。`,"new.createdStarting":`新会话已就绪,工作正在后台开始。`,"new.subtitle":`在这里保存你的对话和任务进度。`,"new.close":`关闭创建会话窗口`,"new.name":`名称`,"new.optional":`(可选)`,"new.namePlaceholder":`例如:AAAI 具身智能论文`,"new.workdir":`输出工作目录`,"new.workdirHint":`Agent 会在这里写入代码、论文、报告和实验结果。内部记忆仍保存在会话状态目录中。`,"new.objective":`目标`,"new.objectivePlaceholder":`留空则从对话开始,也可以填写一个立即启动的持续任务。`,"new.startsAfterCreate":`创建会话后立即启动任务`,"new.idleUntilMessage":`收到第一条消息前保持空闲`,"new.startsHint":`会话会立即打开,Argus 将在后台准备相关工作。`,"new.idleHint":`收到第一条消息后,Argus 会按需启动后台工作。`,"new.shortcut":`按 Ctrl/⌘+Enter 创建`,"new.creating":`正在创建…`,"new.createAndStart":`创建并启动`,"manage.daemon":`管理会话`,"manage.displayName":`显示名称`,"manage.executor":`后台工作`,"manage.running":`运行中`,"manage.runningExternally":`由外部运行`,"manage.paused":`未运行`,"manage.pauseHint":`中断当前操作并保留可恢复的进度。`,"manage.stopNow":`立即停止`,"manage.stopNowHint":`立即中断这个已验证的 daemon,停止后即可删除会话。`,"manage.externalHint":`此会话由此应用之外的服务管理。`,"manage.resumeHint":`继续执行队列中的研究工作。`,"manage.working":`处理中…`,"manage.resume":`继续`,"manage.deleteSession":`删除会话`,"manage.deleteHint":`删除的会话会移入回收站,之后仍可恢复。请先停止后台工作。`,"manage.delete":`删除…`,"manage.confirmQuestion":`将此会话移入回收站?`,"manage.confirmDelete":`确认删除`,"decision.operator":`操作者决策`,"decision.required":`需要你的决策`,"decision.whyBlocked":`这项任务记录的待答原因`,"decision.currentTask":`当前任务`,"decision.taskName":`任务:{title}`,"decision.otherTask":`其他待处理任务`,"decision.awaitingReply":`等待你的回复`,"decision.askedAt":`提问于 {time}`,"decision.evidence":`证据`,"decision.notePlaceholder":`添加 Manager 应采用的指导…`,"decision.resumeHint":`回答只针对这项任务,Manager 会据此检查它的下一步。`,"decision.later":`稍后处理`,"decision.applying":`已提交,Argus 正在开始处理…`,"decision.closeContinue":`关闭,后台继续`,"decision.stopCampaign":`停止持续任务`,"decision.useOption":`使用此选项`,"decision.sendAnswer":`发送回答`,"decision.noteRequired":`这个选项需要补充说明后才能提交。`,"artifact.preview":`结果预览`,"artifact.title":`结果`,"artifact.approvedEvidence":`已经检查确认的依据`,"artifact.downloading":`正在下载…`,"artifact.download":`下载`,"artifact.open":`打开`,"artifact.close":`关闭结果预览`,"artifact.unavailable":`无法预览`,"artifact.empty":`(空文件)`,"artifact.truncated":`预览已截断 · 请下载完整文件查看`,"artifact.htmlTooLarge":`HTML 文件过大,无法安全预览。请下载完整文件。`,"artifact.pdfDisabled":`此浏览器已禁用内嵌 PDF 预览。`,"artifact.openPdf":`打开 PDF`,"artifact.noPreview":`此文件类型无法安全地在线预览。`,"artifact.downloadHint":`请下载后使用本地应用查看。`,"task.details":`任务详情`,"task.stopLoop":`停止循环`,"task.done":`完成`,"task.skip":`跳过`,"task.close":`关闭任务详情`,"task.waitingOnYou":`等待你的回复`,"task.objective":`目标`,"task.noObjective":`(未记录目标)`,"task.untitled":`未命名任务`,"task.priority":`优先级`,"task.started":`开始时间`,"task.finished":`完成时间`,"task.outcome":`结果`,"task.iteration":`迭代`,"task.mode":`模式`,"task.autoIterate":`自动迭代`,"task.singlePass":`单次执行`,"task.cycles":`轮次`,"task.cost":`成本`,"task.lastError":`最近错误`,"task.notes":`备注`,"task.dependsOn":`依赖`,"task.dependsOnCount":`依赖前置任务 {count} 项`,"pending.reviewRespond":`查看并回复`,"pending.showOnMap":`在地图上查看`,"backlog.active":`进行中 · {count}`,"backlog.history":`历史记录 · {count}`,"backlog.noHistory":`暂无已完成工作`,"backlog.empty":`队列中没有工作。Argus 已准备好接收新任务。`,"backlog.viewDetails":`查看完整任务详情`,"backlog.iterating":`重复执行中`,"backlog.stopIterating":`停止重复执行`,"backlog.stop":`停止`,"backlog.markDone":`标记为完成`,"backlog.remove":`移除`,"mission.achievement":`Argus 成果`,"mission.elapsed":`耗时`,"mission.rejectedAttempts":`{count} 次方案被拒绝`,"mission.skillsLearned":`学习了 {count} 个 Skill`,"mission.artifacts":`产出 {count} 个文件`,"mission.waiting":`等待任务`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`已准备就绪,请分配一个任务开始工作。`,"mission.statusDone":`本次任务:{outcome} — 用时 {elapsed}。`,"mission.nextAfterReply":`请先回复这项任务的问题,再决定它的下一步。`,"mission.continuousDone":`连续运行已完成`,"mission.resumeContinuous":`恢复`,"mission.control":`任务控制`,"mission.attentionHealth":`系统出错——运行状态异常。`,"mission.attentionFailed":`任务失败——请查看下方详情。`,"mission.deliveryFailed":`任务在交付阶段失败——执行未能启动或完成。`,"mission.attentionStepFailed":`有一个步骤失败——请查看下方任务。`,"mission.attentionPaused":`任务已暂停——正在等待你的输入。`,"mission.showObjective":`显示完整目标`,"mission.showFullOutput":`查看完整输出`,"mission.stage":`阶段`,"mission.campaign":`持续任务`,"mission.totalElapsed":`总耗时`,"mission.round":`轮次`,"mission.mode":`模式`,"mission.summary":`本次完成`,"mission.deliveryCertified":`交付成果已通过审核`,"mission.taskCompleted":`任务已完成`,"mission.openResult":`打开成果`,"mission.viewTask":`查看任务`,"mission.taskPlan":`任务计划`,"mission.team":`团队`,"mission.waitingShort":`等待中`,"mission.roleWork":`角色工作`,"mission.showMore":`显示更多`,"mission.showLess":`收起`,"mission.done":`已完成`,"mission.inProgress":`进行中`,"mission.failed":`失败`,"mission.bannerPaused":`任务已暂停 — 等待你的操作。`,"mission.bannerError":`系统异常 — 健康状态已降级。`,"mission.bannerStepFailed":`某步骤失败:{step}`,"mission.elapsedAgo":`{elapsed} 前`,"mission.filteredBy":`按 {task} 筛选 · 清除`,"mission.allVisible":`全部可见任务`,"mission.roundNumber":`第 {count} 轮`,"mission.noRoleWork":`当前筛选下还没有持久化的 {role} 工作记录。`,"mission.researchDag":`任务路线`,"mission.active":`进行中`,"mission.noDag":`Planner 尚未向路线中添加任务。`,"mission.workingHypothesis":`当前假设 · 可随证据调整`,"mission.goalContribution":`对目标的作用`,"mission.temporaryRegressions":`预期的暂时取舍`,"mission.decisionRule":`何时调整、拆分或停止`,"mission.acceptance":`完成的标准`,"mission.nonGoals":`非目标`,"mission.capabilities":`能力`,"mission.capabilitiesUnlocked":`已解锁能力`,"mission.learnedCapability":`已学习能力`,"mission.learnedDuring":`在“{mission}”期间学习`,"mission.skillUnavailable":`当前快照中没有此 Skill 的内容。`,"mission.contentTruncated":`内容预览已截断`,"mission.knowledgeRetained":`已保留知识`,"mission.selfEvolution":`已保存的项目知识`,"mission.knowledgeSaved":`Argus 已保存这些能力和笔记,供本项目后续工作使用。`,"mission.noCapabilities":`尚未学习新能力。`,"mission.replay":`任务回放`,"mission.replayTimeline":`回放任务时间线`,"mission.roleFailed":`{role} 执行失败`,"mission.showingLatestEvent":`显示最近一条事件`,"mission.showingLastEvents":`显示最近 {count} 条事件`,"mission.waitingEvents":`等待结构化研究事件。`,"mission.startsAfter":`需等待前置任务 {count} 项`,"mission.hiddenTasks":`已隐藏前序任务 {count} 项 · 阻塞或失败 {failed} 项 · 已跳过 {skipped} 项`,"mission.projectFilesChanged":`项目文件有变更`,"mission.reviewInIde":`可打开 IDE 查看差异`,"research.currentWork":`当前工作`,"research.dagProgress":`任务路线进度`,"research.verifiedOutputs":`已验证输出`,"research.recentMilestones":`近期里程碑`,"research.liveProgress":`任务进展`,"research.artifact":`研究成果`,"research.canvas":`Manager 实时研究面板`,"research.previewArtifact":`预览成果`,"research.openLarge":`打开大尺寸预览`,"research.collapse":`收起预览`,"research.unavailable":`Manager 实时视图暂时不可用。`,"research.noPreview":`暂无预览`,"research.waiting":`等待中…`,"research.updating":`正在更新…`,"research.fileUnavailable":`文件已就绪,可点击上方下载按钮获取。`,"research.eventSourced":`基于事件的任务状态`,"research.downloadFailed":`下载失败`,"operations.title":`运行控制`,"operations.work":`工作`,"operations.runtime":`运行时`,"operations.system":`系统`,"operations.recovery":`恢复`,"operations.workInput":`工作输入`,"operations.workHint":`加入工作、指导当前任务、保存备注,或仅预览计划而不分派。`,"operations.action.task":`任务`,"operations.action.nudge":`指导`,"operations.action.note":`备注`,"operations.action.plan":`计划`,"operations.planPlaceholder":`要预览的目标;预览不会加入任务队列`,"operations.actionPlaceholder":`输入 {action} 内容`,"operations.previewPlan":`预览计划`,"operations.submitAction":`提交 {action}`,"operations.runtimeHint":`更改会话运行位置、重置 Manager 上下文,或安全重启会话。`,"operations.workdir":`工作目录`,"operations.workdirUpdated":`工作目录已更新。`,"operations.applyWorkdir":`应用工作目录`,"operations.replaceSlot":`替换活动会话`,"operations.sourceUpdate":`Argus 源码版本`,"operations.pullLatest":`拉取最新版本`,"operations.updateChecking":`正在检查已发布分支…`,"operations.updateRunning":`正在更新…`,"operations.updateAvailable":`有可用更新`,"operations.updateCurrent":`已是最新`,"operations.updateUnavailable":`当前工作树无法安全更新。`,"operations.currentRevision":`当前`,"operations.latestRevision":`最新`,"operations.updatePhase":`阶段`,"operations.updateRestart":`源码已更新。请重启工作台,再使用重载按钮让活动 daemon 在安全任务边界切换到新版本。`,"operations.skills":`Skills`,"operations.runSkill":`运行 Skill 命令`,"operations.metrics":`系统指标`,"operations.trash":`可恢复的回收站`,"operations.searchTrash":`搜索回收站`,"operations.trashEmpty":`回收站为空。`,"resource.title":`资源`,"resource.loading":`正在加载资源状态…`,"resource.devices":`设备:{count}`,"resource.inUse":`使用中 · {count}`,"resource.queue":`等待队列 · {count}`,"resource.none":`无`,"resource.timeLeft":`剩余 {ttl}`,"resource.noIntent":`未记录用途`,"resource.yieldRequest":`收到释放资源请求 · {reason}`,"resource.queuePosition":`队列第 {position} 位`,"label.status.inProgress":`进行中`,"label.status.waiting":`等待中`,"label.status.completed":`已完成`,"label.status.blocked":`暂时无法继续`,"label.status.failed":`失败`,"label.status.needsChanges":`需要修改`,"label.status.skipped":`已跳过`,"label.status.paused":`已暂停`,"label.status.cancelled":`已取消`,"label.status.available":`可用`,"label.status.unavailable":`不可用`,"label.status.inaccessible":`无法访问`,"label.status.limited":`部分受限`,"label.status.healthy":`状态正常`,"label.status.updated":`状态已更新`,"label.role.argus":`Argus`,"label.role.you":`你`,"label.work.task":`任务`,"label.work.action":`工作步骤`,"label.work.handoff":`给下一步的说明`,"label.work.review":`审核`,"label.work.planning":`规划`,"label.work.update":`动态`,"label.stage.scope":`范围定义`,"label.stage.research":`研究`,"label.stage.implementation":`方法实现`,"label.stage.experiment":`实验验证`,"label.stage.analysis":`结果分析`,"label.stage.writing":`论文写作`,"label.stage.review":`最终审核`,"label.stage.delivery":`成果交付`,"label.stage.unstaged":`未分阶段`,"label.frontier.reopened":`已重新开启一项前序任务`,"label.frontier.added":`已添加一项新任务`,"label.frontier.completed":`这部分工作已完成`,"label.frontier.revised":`已调整任务计划`,"label.frontier.narrowed":`已缩小任务范围`,"label.frontier.expanded":`已扩大任务范围`,"label.frontier.updated":`任务计划已更新`,"label.priority":`优先级 {priority}`,"label.outcome.workCompleted":`工作已完成`,"label.outcome.workPaused":`工作已暂停`,"label.outcome.workBlocked":`工作暂时无法继续`,"label.outcome.workFailed":`工作失败`,"label.outcome.workEnded":`工作已结束`,"label.outcome.workIncomplete":`工作尚未完成`,"label.outcome.workStalled":`工作停滞`,"label.outcome.workUpdated":`工作状态已更新`,"label.outcome.reviewPassed":`结果检查通过`,"label.outcome.reviewNeedsChanges":`检查后发现需要修改`,"label.outcome.reviewBlocked":`结果检查暂时无法继续`,"label.outcome.reviewOutdated":`审核结果已过期`,"label.outcome.reviewPending":`等待审核`,"label.outcome.stageApproved":`可以进入下一步`,"label.outcome.stageNotApproved":`还不能进入下一步`,"label.outcome.stageRevoked":`阶段批准已撤回`,"label.outcome.stageNotNeeded":`无需阶段审核`,"label.outcome.stagePending":`还没确定能否进入下一步`,"label.outcome.budgetPaused":`因预算上限暂停`,"label.outcome.costUnreconciled":`调用费用待对账(并非预算耗尽)`,"label.outcome.waitingForYou":`正在等待你的回复`,"label.outcome.stoppedByYou":`已由你停止`,"label.outcome.pausedByYou":`已由你暂停`,"label.outcome.sessionPaused":`会话已暂停`,"label.outcome.serviceUnavailable":`服务暂不可用`,"label.outcome.serviceCoolingDown":`服务暂时暂停`,"label.outcome.temporaryIssue":`因临时问题暂停`,"label.outcome.serviceError":`因服务错误停止`,"label.outcome.needsPlan":`需要制定新计划`,"label.outcome.canResume":`可以继续`,"label.routing.team":`团队协作`,"label.routing.individual":`单独执行`,"label.routing.research":`研究任务`,"label.routing.software":`软件工作`,"label.routing.staged":`分步执行`,"label.routing.flexible":`灵活流程`,"label.routing.ongoing":`持续进行`,"label.routing.defined":`范围明确`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`加速设备`,"label.resource.enforced":`强制执行限制`,"label.resource.advisory":`仅提供建议`,"label.resource.released":`已释放资源`,"label.resource.kept":`继续占用资源`,"mission.lastProgress":`停下之前记录的进展`,"mission.nextResume":`进度已保存,重新运行 Argus 就会从停下的地方继续。`,"mission.nextResumeLive":`Argus 会从已保存的进度继续。`,"research.totalTime":`累计用时`,"research.optionDelivery":`交付`,"research.optionCheckpoint":`检查点`,"research.optionPending":`生成中`,"operations.unavailableHere":`这项功能在当前的 Argus 上不提供。`,"operations.requestFailed":`这次操作没有成功。`,"operations.technicalDetails":`技术细节`,"verticals.title":`垂域商店`,"verticals.entry":`垂域商店`,"verticals.openStore":`打开垂域商店`,"verticals.paletteHint":`安装 · 启用 · 更新`,"verticals.intro":`垂域为 Argus 提供一个研究领域的阶段、角色、技能与检查项。按项目需要安装,并为各工作区分别启用。`,"verticals.hostedNote":`垂域由服务方提供;你可以为自己的工作区启用或停用。`,"verticals.close":`关闭垂域商店`,"verticals.search":`搜索垂域`,"verticals.searchPlaceholder":`按名称、用途或标签搜索…`,"verticals.refreshCatalog":`刷新目录`,"verticals.refreshing":`正在刷新…`,"verticals.catalogSource":`目录来源:{source}`,"verticals.catalogRelease":`版本 {tag}`,"verticals.catalogFetched":`{time} 获取`,"verticals.catalogNever":`尚未获取目录`,"verticals.catalogError":`目录刷新失败:{error}`,"verticals.kindFilter":`按类型筛选`,"verticals.tagFilter":`按标签筛选`,"verticals.clearFilters":`清除筛选`,"verticals.count":`显示 {shown} / {total}`,"verticals.filter.all":`全部`,"verticals.routingPath":`分类 / 领域 / 专项`,"verticals.filter.installed":`已安装`,"verticals.filter.available":`可安装`,"verticals.filter.builtin":`内置`,"verticals.kind.builtin":`内置`,"verticals.kind.package":`随包提供`,"verticals.kind.installed":`已安装`,"verticals.kind.available":`可安装`,"verticals.enabled":`已启用`,"verticals.disabledState":`已停用`,"verticals.updateAvailable":`有新版本`,"verticals.updateTo":`更新至 {version}`,"verticals.installedVersion":`已安装 {version}`,"verticals.catalogVersion":`目录版本 {version}`,"verticals.requires":`依赖`,"verticals.shared":`共享资源`,"verticals.size":`大小`,"verticals.jumpTo":`查看 {name}`,"verticals.missingPython":`缺少 Python 包:{packages}。请把它们安装到运行 Argus 的那个 Python 环境里。`,"verticals.runtimeIssues":`已安装版本与当前 Argus 运行时不兼容:{issues}`,"verticals.installIssues":`目录版本的安装/更新被运行时要求阻止:{issues}`,"verticals.usedByOne":`1 个项目在用`,"verticals.usedBy":`{count} 个项目在用`,"verticals.action.install":`安装`,"verticals.action.update":`更新`,"verticals.action.enable":`启用`,"verticals.action.disable":`停用`,"verticals.action.uninstall":`卸载`,"verticals.confirmUninstall":`确认卸载`,"verticals.confirmUninstallHint":`将从这台 Argus 移除 {name}。`,"verticals.removeAnyway":`仍要移除`,"verticals.operation.install":`正在安装…`,"verticals.operation.update":`正在更新…`,"verticals.operation.enable":`正在启用…`,"verticals.operation.disable":`正在停用…`,"verticals.operation.uninstall":`正在卸载…`,"verticals.operationRunning":`处理中…`,"verticals.operationFailed":`{action}失败`,"verticals.loading":`正在读取垂域…`,"verticals.noMatches":`没有符合筛选条件的垂域。`,"verticals.none":`目前还没有可用的垂域。`,"verticals.loadFailed":`无法读取垂域列表。`,"verticals.actionFailed":`这次操作没有成功。`,"verticals.tooOld":`当前的 Argus 后端还没有垂域商店。请先更新 Argus,再打开这里管理垂域。`};function wt(){try{let e=localStorage.getItem(xt);if(e===`en`||e===`zh-CN`)return e}catch{}return navigator.language.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}function Tt(e,t={},n=wt()){let r=(n===`zh-CN`?Ct[e]:St[e])??e;return Et.has(e)&&(r=r.replace(/\bArgus\b/g,yt().name)),r.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??`{${n}}`))}var Et=new Set([`handshake.connecting`,`handshake.title`,`splash.starting`,`connection.pairingTitle`,`topbar.pauseDaemon`,`topbar.runDaemon`,`chat.messageArgus`,`palette.messageArgus`,`palette.stopDaemon`,`palette.startDaemon`,`role.system`,`label.role.argus`]),Dt=(0,x.createContext)({locale:`en`,setLocale:()=>void 0,t:(e,t)=>Tt(e,t,`en`)});function O({children:e}){let[t,n]=(0,x.useState)(wt),r=e=>{try{localStorage.setItem(xt,e)}catch{}n(e)};(0,x.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,x.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Tt(e,n,t)}),[t]);return(0,D.jsx)(Dt.Provider,{value:i,children:e})}function Ot(){return(0,x.useContext)(Dt)}var kt=class extends x.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){if(!this.state.failed)return this.props.children;let e=this.props.locale===`zh-CN`;return(0,D.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-bg p-8 text-ink`,role:`alert`,children:(0,D.jsxs)(`section`,{className:`max-w-lg rounded-xl border border-line bg-panel p-8 shadow-lg`,children:[(0,D.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-widest text-blue`,children:yt().name}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:e?`工作台暂时无法显示`:`The workspace could not be displayed`}),(0,D.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`页面资源未能正确加载。后端任务不会因此被停止;你仍可使用桌面菜单查看日志或设置。重新加载会丢弃页面中尚未发送的输入。`:`A page resource failed to load. Backend work has not been stopped. Desktop menus remain available for logs and settings. Reloading discards unsent input on this page.`}),(0,D.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,D.jsx)(`button`,{type:`button`,className:`rounded-md bg-blue px-4 py-2 text-sm text-white`,onClick:()=>window.location.reload(),children:e?`重新加载工作台`:`Reload workspace`}),(0,D.jsx)(`button`,{type:`button`,className:`rounded-md border border-line px-4 py-2 text-sm`,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`view`,`activity`),window.location.assign(e.toString())},children:e?`返回对话页面`:`Return to conversation`})]})]})})}};function At(){let e=(0,x.useSyncExternalStore)(xe,be,()=>!1),{locale:t}=Ot();if(!e)return null;let n=t===`zh-CN`;return(0,D.jsxs)(`div`,{role:`status`,className:`fixed left-1/2 top-3 z-[110] flex w-[min(92vw,42rem)] -translate-x-1/2 items-center gap-3 rounded-xl border border-blue/40 bg-panel px-4 py-3 text-sm text-ink shadow-xl`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`strong`,{children:n?`页面已更新`:`Page update available`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:n?`刷新后显示最新选项和功能。请先复制未发送的内容。`:`Refresh for the latest options and features. Copy any unsent text first.`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`shrink-0 rounded-md border border-blue/40 px-3 py-2 text-xs text-blue`,children:n?`刷新页面`:`Refresh page`})]})}var k={ADVISOR_CONSULTATION_REQUESTED:`advisor.consultation.requested`,ADVISOR_CONSULTATION_COMPLETED:`advisor.consultation.completed`,ADVISOR_CONSULTATION_FAILED:`advisor.consultation.failed`,ADVISOR_CONSULTATION_CANCELLED:`advisor.consultation.cancelled`,ADVISOR_CONSULTATION_TIMED_OUT:`advisor.consultation.timed_out`,ADVISOR_CONSULTATION_MODEL_MISMATCH:`advisor.consultation.model_mismatch`,LIFE_MANAGER_SUPERVISION_ISSUED:`life.manager.supervision.issued`,LIFE_MANAGER_SUPERVISION_APPLIED:`life.manager.supervision.applied`,LIFE_MANAGER_SUPERVISION_FAILED:`life.manager.supervision.failed`,LIFE_PEER_MESSAGE_PROCESSED:`life.peer.message.processed`,LIFE_CONFIG_PARSE_FAILED:`life.config.parse_failed`,AGENT_IO_START:`agent.io.start`,AGENT_IO_STREAM:`agent.io.stream`,AGENT_IO_COMPLETE:`agent.io.complete`,AGENT_IO_ERROR:`agent.io.error`,USAGE_RECORDED:`usage.recorded`,ACCOUNTING_JOURNAL_REPAIRED:`accounting.journal_repaired`,PROVIDER_REQUEST_STARTED:`provider.request.started`,PROVIDER_REQUEST_COMPLETED:`provider.request.completed`,PROVIDER_REQUEST_DENIED:`provider.request.denied`,CODEX_UTIL_COMPLETED:`codex.util.completed`,SKILL_COST_COMPLETED:`skill.cost.completed`,BUDGET_RESERVATION_CREATED:`budget.reservation.created`,BUDGET_RESERVATION_DENIED:`budget.reservation.denied`,BUDGET_RESERVATION_SETTLED:`budget.reservation.settled`,BUDGET_RESERVATION_RELEASED:`budget.reservation.released`,BUDGET_UNPRICED_BLOCKED:`budget.unpriced.blocked`,BUDGET_UNPRICED_ACKNOWLEDGED:`budget.unpriced.acknowledged`,LOOP_START:`loop.start`,LOOP_DONE:`loop.done`,ROUND_START:`round.start`,ROUND_MAIN_COMPLETED:`round.main.completed`,ROUND_REVIEW_STARTED:`round.review.started`,ROUND_REVIEW_DEFERRED:`round.review.deferred`,ROUND_REVIEW_COMPLETED:`round.review.completed`,ROUND_CHECKPOINT_RECORDED:`round.checkpoint.recorded`,ROUND_CHECKPOINT_FAILED:`round.checkpoint.failed`,ROUND_SECRET_REDACTED:`round.secret_redacted`,ROUND_ESCALATED:`round.escalated`,ROUND_STALL:`round.stall`,ROUND_REVIEWER_BACKEND_FAILURE:`round.reviewer_backend_failure`,ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF:`round.reviewer_backend_failure.backoff`,ROUND_BACKEND_FAILURE_BACKOFF:`round.backend_failure.backoff`,ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED:`round.backend_failure.hold_interrupted`,ROUND_WATCHDOG_RETRY:`round.watchdog.retry`,ROUND_WATCHDOG_RETRY_EXHAUSTED:`round.watchdog.retry_exhausted`,ROUND_MODEL_CONFIGURATION_ERROR:`round.model_configuration_error`,ROUND_PROVIDER_TURN_CAP_RESTART:`round.provider_turn_cap.restart`,ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART:`round.provider_turn_cap.reviewer_restart`,ROUND_ORPHAN_PROCESS_GROUP:`round.orphan_process_group`,ROUND_EXTERNAL_WORK_WAIT_STARTED:`round.external_work_wait.started`,ROUND_EXTERNAL_WORK_WAIT_COMPLETED:`round.external_work_wait.completed`,ROUND_EXTERNAL_WORK_REVIEW_REQUIRED:`round.external_work_review.required`,ROUND_EXTERNAL_WORK_REVIEW_COMPLETED:`round.external_work_review.completed`,ROLE_SESSION_TURN:`role.session.turn`,ENGINEER_PROGRESS:`engineer.progress`,ENGINEER_SKILL_MAINTENANCE_COMPLETED:`engineer.skill_maintenance.completed`,LIFE_STATUS:`life.status`,LIFE_PHASE_STARTED:`life.phase.started`,LIFE_MISSION_STARTED:`life.mission.started`,LIFE_MISSION_COMPLETED:`life.mission.completed`,LIFE_MISSION_FAILED:`life.mission.failed`,LIFE_MISSION_SKIPPED:`life.mission.skipped`,LIFE_MISSION_ORPHANED:`life.mission.orphaned`,LIFE_MISSION_REQUEUED:`life.mission.requeued`,LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED:`life.mission.provider_configuration_disabled`,LIFE_ITERATION_CONTINUED:`life.iteration.continued`,LIFE_REVIEW_WAIVED:`life.review.waived`,LIFE_POST_MISSION_STOP:`life.post_mission.stop`,LIFE_EXECUTION_HOST_BLOCKED:`life.execution_host.blocked`,LIFE_AUTH_FAILURE:`life.auth_failure`,LIFE_SUPERVISOR_ERROR:`life.supervisor.error`,LIFE_LEARNED_VERTICAL_PROMOTED:`life.learned_vertical.promoted`,LIFE_LEARNED_VERTICAL_PROMOTION_FAILED:`life.learned_vertical.promotion_failed`,LIFE_MANAGER_INTENT_STARTED:`life.manager.intent.started`,LIFE_MANAGER_INTENT_COMPLETED:`life.manager.intent.completed`,LIFE_MANAGER_INTENT_FAILED:`life.manager.intent.failed`,LIFE_MANAGER_INTENT_SUPERSEDED:`life.manager.intent.superseded`,LIFE_MANAGER_GOAL_CONTRACT_FAILED:`life.manager.goal_contract.failed`,LIFE_MANAGER_STAGE_DECISION:`life.manager.stage_decision`,LIFE_MANAGER_PLAN_CHALLENGE_DECIDED:`life.manager.plan_challenge.decided`,LIFE_MANAGER_FEEDBACK_PERSISTED:`life.manager.feedback.persisted`,LIFE_MANAGER_FEEDBACK_UNRESOLVED:`life.manager.feedback.unresolved`,LIFE_MANAGER_FEEDBACK_EXHAUSTED:`life.manager.feedback.exhausted`,LIFE_MANAGER_PROJECT_REPORT:`life.manager.project_report`,LIFE_MANAGER_PROJECT_REPORT_FAILED:`life.manager.project_report.failed`,LIFE_VERTICAL_RESOLVED:`life.vertical.resolved`,LIFE_MANAGER_BACKEND_RESOLVED:`life.manager.backend_resolved`,LIFE_PLANNER_BACKEND_RESOLVED:`life.planner.backend_resolved`,LIFE_ENGINEER_BACKEND_RESOLVED:`life.engineer.backend_resolved`,LIFE_REVIEWER_BACKEND_RESOLVED:`life.reviewer.backend_resolved`,LIFE_CURATOR_BACKEND_RESOLVED:`life.curator.backend_resolved`,LIFE_PLANNER_START:`life.planner.start`,LIFE_PLANNER_PREVIEW_SKIPPED:`life.planner.preview_skipped`,LIFE_PLANNER_NORMALIZED:`life.planner.normalized`,LIFE_PLANNER_TASK_ADDED:`life.planner.task_added`,LIFE_PLANNER_TASK_SKIPPED:`life.planner.task_skipped`,LIFE_PLANNER_VERDICT:`life.planner.verdict`,LIFE_PLANNER_WAITING:`life.planner.waiting`,LIFE_PLANNER_WAITING_WOKEN:`life.planner.waiting_woken`,LIFE_PLANNER_TERMINAL_IDLE:`life.planner.terminal_idle`,LIFE_PLANNER_VERIFICATION_PROBE:`life.planner.verification_probe`,LIFE_PLANNER_STALL_ESCALATION:`life.planner.stall_escalation`,LIFE_PLANNER_DEPENDENCY_DROPPED:`life.planner.dependency_dropped`,LIFE_PLANNER_PARALLEL_DROPPED:`life.planner.parallel_dropped`,LIFE_PLANNER_ERROR:`life.planner.error`,LIFE_PLANNER_DEFERRED:`life.planner.deferred`,LIFE_PLANNER_SUPERSEDED:`life.planner.superseded`,LIFE_PLANNER_WAIT_OVERRIDDEN:`life.planner.wait_overridden`,LIFE_PLANNER_WAITING_CONTRACT_NORMALIZED:`life.planner.waiting_contract.normalized`,LIFE_PLANNER_EXTERNAL_POLL_SUPPRESSED:`life.planner.external_poll_suppressed`,LIFE_PLANNER_VERDICT_DISCARDED:`life.planner.verdict.discarded`,LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED:`life.planner.final_submission_skipped`,LIFE_PLANNER_CONTINUATION_REQUIRED:`life.planner.continuation_required`,LIFE_PLANNER_COMPLETION_REJECTED:`life.planner.completion_rejected`,LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED:`life.planner.completion_circuit_opened`,LIFE_PLANNER_COMPLETION_CIRCUIT_HOLDING:`life.planner.completion_circuit_holding`,LIFE_PLANNER_COMPLETION_CIRCUIT_NOTIFY_FAILED:`life.planner.completion_circuit.notify_failed`,PLAN_DRAFT_START:`plan.draft.start`,PLAN_DRAFT_DONE:`plan.draft.done`,PLAN_DRAFT_FAILED:`plan.draft.failed`,LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED:`life.runtime_failure.circuit_opened`,LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED:`life.runtime_failure.circuit_blocked`,LIFE_RUNTIME_FAILURE_CANARY_PASSED:`life.runtime_failure.canary_passed`,LIFE_RUNTIME_INCIDENT_DETECTED:`life.runtime.incident.detected`,LIFE_RUNTIME_INCIDENT_RECOVERED:`life.runtime.incident.recovered`,LIFE_RUNTIME_INCIDENT_ESCALATED:`life.runtime.incident.escalated`,LIFE_PLAN_REVISION_PROPOSED:`life.plan.revision.proposed`,LIFE_PLAN_REVISION_REJECTED:`life.plan.revision.rejected`,LIFE_PLAN_REVISION_COMMITTED:`life.plan.revision.committed`,LIFE_PLAN_NODE_SUPERSEDED:`life.plan.node.superseded`,LIFE_PLAN_REVISION_ROLLED_BACK:`life.plan.revision.rolled_back`,LIFE_RESEARCH_SECOND_READING:`life.research.second_reading`,LIFE_LETTER_WRITTEN:`life.letter.written`,LIFE_BUDGET_PAUSE:`life.budget.pause`,LIFE_LIFECYCLE_BLOCK:`life.lifecycle.block`,LIFE_LIFECYCLE_TRANSITION:`life.lifecycle.transition`,LIFE_INBOX_QUEUED:`life.inbox.queued`,LIFE_INBOX_DRAINED:`life.inbox.drained`,LIFE_OPERATOR_QUESTION_PENDING:`life.operator_question.pending`,LIFE_OPERATOR_QUESTION_ANSWERED:`life.operator_question.answered`,LIFE_DAEMON_IDLE_TIMEOUT:`life.daemon.idle_timeout`,LIFE_DAEMON_READY:`life.daemon.ready`,LIFE_DAEMON_DEGRADED:`life.daemon.degraded`,PROJECT_COMPLETED:`project.completed`,PROJECT_COMPLETION_REFUSED:`project.completion_refused`,DAEMON_PARKED:`daemon.parked`,DAEMON_COMMAND_SUBMITTED:`daemon.command.submitted`,DAEMON_COMMAND_COMPLETED:`daemon.command.completed`,DAEMON_COMMAND_REJECTED:`daemon.command.rejected`,IDEA_SEARCH_STARTED:`idea.search.started`,IDEA_SEARCH_COMPLETED:`idea.search.completed`,IDEA_SEARCH_SKIPPED:`idea.search.skipped`,IDEA_PORTFOLIO_FORMED:`idea.portfolio.formed`,IDEA_PORTFOLIO_NESTED_SKIPPED:`idea.portfolio.nested_skipped`,VENUE_RESEARCH_STARTED:`venue.research.started`,VENUE_RESEARCH_COMPLETED:`venue.research.completed`,RESEARCH_ACHIEVEMENT_CERTIFIED:`research.achievement.certified`,SKILL_LIBRARY_AVAILABLE:`skill.library.available`,SKILL_CREATED:`skill.created`,SKILL_UPDATED:`skill.updated`,SKILL_ARCHIVED:`skill.archived`,SKILL_TIDIED:`skill.tidied`,SKILL_HISTORY_COMPRESSED:`skill.history.compressed`,SKILL_EVOLUTION_COMPLETED:`skill.evolution.completed`,TEAM_LEARNING_REVIEW_STARTED:`team.learning.review.started`,TEAM_LEARNING_REVIEW_SKIPPED:`team.learning.review.skipped`,TEAM_LEARNING_REVIEW_COMPLETED:`team.learning.review.completed`,TEAM_LEARNING_REVIEW_FAILED:`team.learning.review.failed`,TEAM_LEARNING_PROMOTION_QUARANTINED:`team.learning.promotion.quarantined`,SELF_LEARNING_REVIEW_STARTED:`self.learning.review.started`,SELF_LEARNING_REVIEW_COMPLETED:`self.learning.review.completed`,SELF_LEARNING_REVIEW_FAILED:`self.learning.review.failed`,DOMAIN_PROMOTION:`domain.promotion`,WIKI_INITIALIZED:`wiki.initialized`,WIKI_HOOK_WARNING:`wiki.hook.warning`,WIKI_CREATED:`wiki.created`,WIKI_UPDATED:`wiki.updated`,WIKI_RETIRED:`wiki.retired`,WIKI_PROMOTION_PROMOTED:`wiki.promotion.promoted`,WIKI_PROMOTION_DEMOTED:`wiki.promotion.demoted`,WIKI_RETIRED_COMPRESSED:`wiki.retired.compressed`,WIKI_EVOLUTION_COMPLETED:`wiki.evolution.completed`,KNOWLEDGE_LEARNED:`knowledge.learned`,KNOWLEDGE_RECALLED:`knowledge.recalled`,OPERATOR_ALERT:`operator_alert`,MANAGER_LIVE_VIEW_UPDATED:`manager.live_view.updated`,MANAGER_LIVE_VIEW_REJECTED:`manager.live_view.rejected`,MANAGER_TURN_STARTED:`manager.turn.started`,MANAGER_TURN_CANCELLED:`manager.turn.cancelled`,USER_NOTE:`user.note`,UI_OPERATOR:`ui.operator`,UI_ARGUS:`ui.argus`},jt={"loop.started":k.LOOP_START,"loop.completed":k.LOOP_DONE,"round.started":k.ROUND_START,"mission.started":k.LIFE_MISSION_STARTED,"mission.completed":k.LIFE_MISSION_COMPLETED,"mission.error":k.LIFE_MISSION_FAILED};k.ADVISOR_CONSULTATION_COMPLETED,k.ADVISOR_CONSULTATION_FAILED,k.ADVISOR_CONSULTATION_CANCELLED,k.ADVISOR_CONSULTATION_TIMED_OUT,k.ADVISOR_CONSULTATION_MODEL_MISMATCH,k.LIFE_MANAGER_SUPERVISION_APPLIED,k.LIFE_MANAGER_SUPERVISION_FAILED,k.LIFE_PEER_MESSAGE_PROCESSED,k.LIFE_CONFIG_PARSE_FAILED,k.LIFE_MANAGER_BACKEND_RESOLVED,k.LIFE_PLANNER_BACKEND_RESOLVED,k.LIFE_ENGINEER_BACKEND_RESOLVED,k.LIFE_REVIEWER_BACKEND_RESOLVED,k.LIFE_CURATOR_BACKEND_RESOLVED,k.LOOP_START,k.LOOP_DONE,k.ROUND_START,k.ROUND_MAIN_COMPLETED,k.ROUND_REVIEW_DEFERRED,k.ROUND_REVIEW_COMPLETED,k.ROUND_CHECKPOINT_RECORDED,k.ROUND_CHECKPOINT_FAILED,k.ROUND_SECRET_REDACTED,k.ROUND_ESCALATED,k.ROUND_STALL,k.ROUND_REVIEWER_BACKEND_FAILURE,k.ENGINEER_SKILL_MAINTENANCE_COMPLETED,k.SKILL_LIBRARY_AVAILABLE,k.SKILL_CREATED,k.SKILL_UPDATED,k.SKILL_ARCHIVED,k.SKILL_TIDIED,k.SKILL_HISTORY_COMPRESSED,k.SKILL_EVOLUTION_COMPLETED,k.WIKI_INITIALIZED,k.WIKI_HOOK_WARNING,k.WIKI_CREATED,k.WIKI_UPDATED,k.WIKI_RETIRED,k.WIKI_PROMOTION_PROMOTED,k.WIKI_PROMOTION_DEMOTED,k.WIKI_RETIRED_COMPRESSED,k.WIKI_EVOLUTION_COMPLETED,k.KNOWLEDGE_LEARNED,k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MANAGER_INTENT_STARTED,k.LIFE_MANAGER_INTENT_COMPLETED,k.LIFE_MANAGER_INTENT_FAILED,k.LIFE_MANAGER_STAGE_DECISION,k.LIFE_MANAGER_PLAN_CHALLENGE_DECIDED,k.LIFE_VERTICAL_RESOLVED,k.LIFE_PLANNER_START,k.LIFE_PLANNER_PREVIEW_SKIPPED,k.LIFE_PLANNER_TASK_ADDED,k.LIFE_PLANNER_TASK_SKIPPED,k.LIFE_PLANNER_DEPENDENCY_DROPPED,k.LIFE_PLANNER_PARALLEL_DROPPED,k.LIFE_PLANNER_VERDICT,k.LIFE_PLANNER_WAITING,k.LIFE_PLANNER_WAITING_WOKEN,k.LIFE_PLANNER_TERMINAL_IDLE,k.LIFE_PLANNER_VERIFICATION_PROBE,k.LIFE_PLANNER_STALL_ESCALATION,k.LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED,k.LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED,k.LIFE_RUNTIME_FAILURE_CANARY_PASSED,k.LIFE_RUNTIME_INCIDENT_DETECTED,k.LIFE_RUNTIME_INCIDENT_RECOVERED,k.LIFE_RUNTIME_INCIDENT_ESCALATED,k.LIFE_PLAN_REVISION_PROPOSED,k.LIFE_PLAN_REVISION_REJECTED,k.LIFE_PLAN_REVISION_COMMITTED,k.LIFE_PLAN_NODE_SUPERSEDED,k.LIFE_RESEARCH_SECOND_READING,k.LIFE_LETTER_WRITTEN,k.LIFE_BUDGET_PAUSE,k.BUDGET_RESERVATION_DENIED,k.BUDGET_UNPRICED_BLOCKED,k.LIFE_LIFECYCLE_BLOCK,k.LIFE_LIFECYCLE_TRANSITION,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.LIFE_INBOX_QUEUED,k.LIFE_INBOX_DRAINED,k.LIFE_DAEMON_IDLE_TIMEOUT,k.PROJECT_COMPLETED,k.PROJECT_COMPLETION_REFUSED,k.DAEMON_PARKED,k.DAEMON_COMMAND_COMPLETED,k.DAEMON_COMMAND_REJECTED,k.IDEA_SEARCH_STARTED,k.IDEA_SEARCH_COMPLETED,k.IDEA_SEARCH_SKIPPED,k.VENUE_RESEARCH_STARTED,k.VENUE_RESEARCH_COMPLETED,k.RESEARCH_ACHIEVEMENT_CERTIFIED,k.LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED,k.LIFE_ITERATION_CONTINUED,k.LIFE_REVIEW_WAIVED,k.LIFE_POST_MISSION_STOP,k.LIFE_EXECUTION_HOST_BLOCKED,k.LIFE_AUTH_FAILURE,k.LIFE_SUPERVISOR_ERROR,k.LIFE_LEARNED_VERTICAL_PROMOTED,k.LIFE_LEARNED_VERTICAL_PROMOTION_FAILED,k.LIFE_MANAGER_INTENT_SUPERSEDED,k.LIFE_MANAGER_GOAL_CONTRACT_FAILED,k.LIFE_MANAGER_FEEDBACK_PERSISTED,k.LIFE_MANAGER_FEEDBACK_EXHAUSTED,k.LIFE_MANAGER_PROJECT_REPORT_FAILED,k.LIFE_PLANNER_DEFERRED,k.LIFE_PLANNER_SUPERSEDED,k.LIFE_PLANNER_WAIT_OVERRIDDEN,k.LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED,k.LIFE_PLANNER_CONTINUATION_REQUIRED,k.LIFE_PLANNER_COMPLETION_REJECTED,k.LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED,k.PLAN_DRAFT_DONE,k.PLAN_DRAFT_FAILED,k.LIFE_PLAN_REVISION_ROLLED_BACK,k.ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED,k.ROUND_WATCHDOG_RETRY,k.ROUND_WATCHDOG_RETRY_EXHAUSTED,k.ROUND_MODEL_CONFIGURATION_ERROR,k.ROUND_PROVIDER_TURN_CAP_RESTART,k.ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART,k.ROUND_ORPHAN_PROCESS_GROUP,k.ROUND_EXTERNAL_WORK_WAIT_STARTED,k.ROUND_EXTERNAL_WORK_WAIT_COMPLETED,k.ROUND_EXTERNAL_WORK_REVIEW_REQUIRED,k.ROUND_EXTERNAL_WORK_REVIEW_COMPLETED,k.LIFE_DAEMON_DEGRADED,k.IDEA_PORTFOLIO_FORMED,k.TEAM_LEARNING_REVIEW_STARTED,k.TEAM_LEARNING_REVIEW_COMPLETED,k.TEAM_LEARNING_REVIEW_FAILED,k.TEAM_LEARNING_PROMOTION_QUARANTINED,k.DOMAIN_PROMOTION,k.MANAGER_LIVE_VIEW_UPDATED,k.MANAGER_TURN_STARTED,k.MANAGER_TURN_CANCELLED,k.USER_NOTE,k.UI_OPERATOR,k.UI_ARGUS,k.OPERATOR_ALERT,k.AGENT_IO_START,k.AGENT_IO_COMPLETE,k.AGENT_IO_ERROR,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.USAGE_RECORDED;function Mt(e){let t=String(e??``).trim();return Object.hasOwn(jt,t)?jt[t]:t}function Nt(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Nt).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Nt(t[e])}`).join(`,`)}}`}function Pt(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function Ft(e){let t=e.event_id??e.id??e.seq??e._offset,n=String(e.type??`event`);return t!=null&&t!==``?`${n}-${String(t)}`:`${n}-${String(e.ts??e.time??``)}-${Pt(Nt(e))}`}function It(e){return e.type===k.ENGINEER_PROGRESS&&e.kind===`reasoning`}function Lt(e){if(e.type!==k.ENGINEER_PROGRESS||![`assistant_message`,`agent_message`,`message`].includes(String(e.kind??``)))return!1;let t=String(e.agent_layer??e.actor??``);return String(e.text??``).trimStart().startsWith(`{`)?t===`reviewer`||t===`planner`:!1}var Rt=/^(?:[-*+]\s*)?[`*_]*(?:ARGUS_)?(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS|ROLE_DECISION)[`*_]*\s*[:=]|^(?:final\s+)?decision\s*:\s*$/i;function zt(e){return String(e??``).split(/\r?\n/).filter(e=>!Rt.test(e.trim())).join(` +`).trim()}function Bt(e){let t=String(e.fragment_mode??``);return t===`append`||t===`snapshot`?t:e.replace===!0?`snapshot`:`auto`}function Vt(e,t){let n=Math.min(e.length,t.length);for(let r=n;r>=8;--r)if(e.endsWith(t.slice(0,r)))return r;return 0}function Ht(e,t,n=`auto`){let r=(e||``).trim(),i=(t||``).trim();if(!r)return i;if(!i)return r;if(n===`snapshot`)return i;if(r.includes(i))return r;if(n===`append`)return`${r}\n${i}`;if(i.includes(r))return i;let a=Vt(r,i);return a?`${r}${i.slice(a)}`:`${r}\n${i}`}var Ut=[`all`,`attention`,`milestones`,`messages`],Wt=new Set([k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MISSION_FAILED,k.LOOP_START,k.LOOP_DONE,k.LIFE_PLANNER_VERDICT,k.LIFE_BUDGET_PAUSE,k.LIFE_LIFECYCLE_BLOCK]);function Gt(e,t,n=`all`,r=``){let i=Mt(e.canonical_type??e.type),a=String(e.kind??``);if(n===`attention`&&![`warn`,`err`].includes(String(t.tone??``))&&e.operator_alert!==!0||n===`milestones`&&!(t.rule&&!i.startsWith(`ui.`))&&!Wt.has(i)||n===`messages`&&t.tone!==`bright`&&![`assistant_message`,`agent_message`,`message`].includes(a)&&![`ui.operator`,`ui.argus`].includes(i))return!1;let o=r.trim().toLocaleLowerCase();return!o||[i,a,t.role,t.label,t.text,e.title,e.objective,e.text,e.summary,e.reason,e.error,e.status,e.action_summary,e.command,e.path,Array.isArray(e.tags)?e.tags.join(` `):e.tags].some(e=>String(e??``).toLocaleLowerCase().includes(o))}function Kt(e,t,n){e.setQueryData([`snapshot`,t],e=>e&&{...e,session:{...e.session,display_name:n}}),e.setQueryData([`projects`],e=>e&&{...e,projects:e.projects.map(e=>e.id===t?{...e,display_name:n,label:n||e.objective||e.id}:e)})}var qt=15e3,Jt=5e3,Yt=8e3,Xt=2e3,Zt=1e4,A=1e4;function Qt(e,t){return!Ke(t)&&!(t instanceof Ce)&&e<1}function $t(e){return!Ke(e)&&Jt}function en(e){return e?.projects.some(e=>e.daemon_alive)?Xt:qt}function tn(e){return e?.daemon.alive||e?.manager_requests?.some(e=>e.status===`running`)?Xt:Yt}var nn=()=>s({queryKey:[`projects`],queryFn:E.projectIndex,refetchInterval:e=>en(e.state.data)}),rn=()=>s({queryKey:[`project-costs`],queryFn:({signal:e})=>E.projectCosts(e),retry:Qt,refetchInterval:e=>$t(e.state.error),refetchIntervalInBackground:!1}),an=e=>s({queryKey:[`snapshot`,e],queryFn:({signal:t})=>E.activeSnapshot(e,t),enabled:!!e,refetchInterval:e=>tn(e.state.data)}),on=(e,t=30,n=!0)=>s({queryKey:[`journal`,e,t],queryFn:({signal:n})=>E.journal(e,t,n),enabled:!!e&&n,refetchInterval:n?8e3:!1}),sn=(e,t)=>s({queryKey:[`doctor`,e],queryFn:({signal:t})=>E.doctor(e,t),enabled:!!e&&t}),cn=(e,t)=>s({queryKey:[`config`,e],queryFn:({signal:t})=>E.config(e,t),enabled:!!e&&t}),ln=(e,t)=>s({queryKey:[`identity`,e],queryFn:({signal:t})=>E.identity(e,t),enabled:!!e&&t}),un=(e,t,n=30)=>s({queryKey:[`transcript`,e,n],queryFn:({signal:t})=>E.transcript(e,n,t),enabled:!!e&&t}),dn=(e,t=!0)=>s({queryKey:[`artifacts`,e],queryFn:({signal:t})=>E.artifacts(e,t),enabled:!!e&&t,refetchInterval:t?Zt:!1}),fn=(e,t,n=null)=>s({queryKey:[`artifact`,e,t,n],queryFn:({signal:n})=>E.artifact(e,t,n),enabled:!!e&&!!t,refetchInterval:e=>t&&/(?:^|[\\/])REVIEW\.md$/i.test(t)&&!Ke(e.state.error)?2e3:!1}),pn=(e,t=!0)=>s({queryKey:[`git-diff`,e],queryFn:({signal:t})=>E.gitDiff(e,t),enabled:!!e&&t,refetchInterval:t?A:!1}),mn=(e,t)=>s({queryKey:[`backlog-item`,e,t],queryFn:({signal:n})=>E.backlogItem(e,t,n),enabled:!!e&&!!t});function hn(e,t){let n=c(),r=e=>{n.invalidateQueries({queryKey:[`snapshot`,e]}),n.invalidateQueries({queryKey:[`status`,e]}),n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`backlog-item`,e]})},i=()=>r(e);return{addTask:h({mutationFn:t=>E.addTask(e,t),onSuccess:i}),nudge:h({mutationFn:t=>E.nudge(e,t)}),note:h({mutationFn:t=>E.note(e,t)}),startDaemon:h({mutationFn:()=>E.startDaemon(e,t),onSuccess:i}),stopDaemon:h({mutationFn:n=>E.stopDaemon(e,n,t),onSuccess:i}),forceStopDaemon:h({mutationFn:()=>E.stopDaemon(e,!1,t,!0),onSuccess:i}),updateProject:h({mutationFn:e=>E.updateProject(e.sid,e.name),onSuccess:e=>{Kt(n,e.sid,e.name),r(e.sid)}}),deleteProject:h({mutationFn:()=>E.deleteProject(e),onSuccess:async()=>{let t=e;if(t){let e=e=>e.queryKey.some(e=>e===t);await n.cancelQueries({predicate:e}),n.removeQueries({predicate:e})}await n.invalidateQueries({queryKey:[`projects`]})}}),disposeBacklog:h({mutationFn:t=>E.disposeBacklog(e,t.id,t.op),onSuccess:i}),stopBacklog:h({mutationFn:t=>E.stopBacklog(e,t),onSuccess:i}),setContinuous:h({mutationFn:t=>E.setContinuous(e,t.enabled,t.objective??``),onSuccess:i})}}var gn=2e3;function _n(e,t){if(t.kind===`reset`)return{sid:t.sid,events:[],seen:new Set};if(t.sid!==e.sid)return e;if(t.kind===`seed`){let n=new Set,r=[];[...t.events,...e.events].forEach(e=>{let t=Ft(e);n.has(t)||(n.add(t),r.push(e))});let i=r.slice(-2e3);return{sid:e.sid,events:i,seen:new Set(i.map(e=>Ft(e)))}}let n=t.kind===`push`?[t.ev]:t.events,r=null,i=null;for(let t of n){let n=i??e.seen,a=Ft(t);n.has(a)||((!r||!i)&&(r=[...e.events],i=new Set(e.seen)),i.add(a),r.push(t))}return!r||!i?e:(r.length>gn&&r.splice(0,r.length-gn).forEach(e=>i.delete(Ft(e))),{sid:e.sid,events:r,seen:i})}var vn=new Set([`manager.live_view.updated`,`round.review.completed`,`life.mission.completed`]);function yn(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=String(n.type??``);if(vn.has(r)||r===`engineer.progress`&&n.kind===`file_change`)return Ft(n)}return``}var bn=new Set([`life.operator_question.pending`,`life.operator_question.answered`,`life.planner.task_added`,`life.planner.verdict`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`round.review.completed`]);function xn(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(bn.has(String(n.type??``)))return Ft(n)}return``}function Sn(e,t=0){let[n,r]=(0,x.useState)(()=>typeof navigator>`u`||navigator.onLine!==!1);(0,x.useEffect)(()=>{let e=()=>r(navigator.onLine!==!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),e(),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]);let[i,a]=(0,x.useReducer)(_n,{sid:null,events:[],seen:new Set}),[o,s]=(0,x.useState)({sid:null,connected:!1}),c=(0,x.useRef)(e);return c.current=e,(0,x.useEffect)(()=>{if(a({kind:`reset`,sid:e}),s({sid:e,connected:!1}),!e)return;let t=!1,n=new AbortController,r=[],i,o=()=>{if(i=void 0,t||c.current!==e||r.length===0){r=[];return}let n=r;r=[],a({kind:`push-many`,sid:e,events:n})};E.events(e,120,n.signal).then(n=>{!t&&c.current===e&&a({kind:`seed`,sid:e,events:n})}).catch(()=>{});let l=ht(e,n=>{!t&&c.current===e&&(r.push(n),i===void 0&&(i=window.setTimeout(o,40)))},{replay:40,onOpen:()=>{!t&&c.current===e&&s({sid:e,connected:!0})},onClose:()=>{!t&&c.current===e&&s({sid:e,connected:!1})}});return()=>{t=!0,n.abort(),i!==void 0&&window.clearTimeout(i),r=[],l()}},[e,t]),{events:i.sid===e?i.events:[],connected:n&&o.sid===e&&o.connected}}function Cn(e,t,n){let r=!1;e.addEventListener(`vite:preloadError`,e=>{let i=e.payload,a=i instanceof Error?i.message:String(i??``);if(!/\/(?:pdf[.-]|pdfjs)[^/\s]*\.(?:m?js)(?:[?#\s]|$)/i.test(a)&&/failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed|loading chunk .+ failed|unable to preload css/i.test(a)){if(r){e.preventDefault();return}try{let e=n.storage(),t=`argus.stale-chunk-reloaded`;if(e.getItem(t)===n.buildId)return;e.setItem(t,n.buildId)}catch{return}e.preventDefault(),r=!0,t()}})}var wn=`modulepreload`,Tn=function(e,t){return new URL(e,t).href},En={},Dn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Tn(t,n),t=s(t),t in En)return;En[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:wn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},On=window.location.pathname===`/admin/data`||window.location.pathname.startsWith(`/admin/data/`),kn=(0,x.lazy)(()=>Dn(()=>import(`./App-BzMKY0Y_.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)),An=(0,x.lazy)(()=>Dn(()=>import(`./WorkflowWorkbench-vw9-WFp2.js`),__vite__mapDeps([10,1,2,3,7,8]),import.meta.url)),jn=(0,x.lazy)(()=>Dn(()=>import(`./AdminDataApp-D7m1m69B.js`),__vite__mapDeps([11,1,2,3,6,4,5,12,13,8,14]),import.meta.url));Cn(window,()=>window.location.reload(),{buildId:_e,storage:()=>window.sessionStorage}),On||Re();var Mn=window.parent!==window;document.documentElement.dataset.argusEmbedded=String(Mn);var Nn=new ue({defaultOptions:{queries:{staleTime:3e3,retry:Qt,refetchOnWindowFocus:!1}}});function Pn(){let e=s({queryKey:[`api-meta`],queryFn:E.meta}),{locale:t}=Ot();return e.error?(0,D.jsxs)(`div`,{role:`alert`,className:`p-8`,children:[e.error.message,(0,D.jsx)(`button`,{className:`ml-4 underline`,onClick:()=>void e.refetch(),children:t===`zh-CN`?`重新连接`:`Reconnect`})]}):e.data?e.data.capabilities.includes(`application.workflows.v1`)&&new URLSearchParams(window.location.search).get(`legacy`)!==`1`?(0,D.jsx)(An,{}):(0,D.jsx)(kn,{}):(0,D.jsx)(`div`,{className:`p-8`,children:t===`zh-CN`?`正在连接…`:`Connecting…`})}function Fn(){let{locale:e}=Ot();return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(At,{}),(0,D.jsx)(kt,{locale:e,children:(0,D.jsx)(x.Suspense,{fallback:(0,D.jsx)(`div`,{className:`grid min-h-screen place-items-center text-sm text-ink-faint`,children:e===`zh-CN`?`正在加载工作台…`:`Loading workbench…`}),children:On?(0,D.jsx)(jn,{}):(0,D.jsx)(Pn,{})})})]})}(On?Promise.resolve():bt()).then(()=>de.createRoot(document.getElementById(`root`)).render((0,D.jsx)(x.StrictMode,{children:(0,D.jsx)(_,{client:Nn,children:(0,D.jsx)(O,{children:(0,D.jsx)(Fn,{})})})}))).catch(e=>{let t=document.getElementById(`root`);t.setAttribute(`role`,`alert`),t.textContent=`Cannot open workbench: ${e instanceof Error?e.message:String(e)}`});export{yt as A,nt as B,Lt as C,Mt as D,k as E,Be as F,ge as G,Ye as H,Ve as I,ae as J,fe as K,st as L,We as M,Fe as N,Tt as O,E as P,Ke as R,It as S,zt as T,Qe as U,tt as V,S as W,un as _,dn as a,Gt as b,sn as c,ln as d,on as f,an as g,nn as h,fn as i,Ge as j,Ot as k,Sn as l,rn as m,yn as n,mn as o,hn as p,he as q,xn as r,cn as s,Dn as t,pn as u,Ut as v,Ht as w,Bt as x,Ft as y,qe as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/index-DbdG0NfU.js b/frontend/web/dist/assets/index-DbdG0NfU.js new file mode 100644 index 000000000..5223a535b --- /dev/null +++ b/frontend/web/dist/assets/index-DbdG0NfU.js @@ -0,0 +1,13 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-d69nDaHg.js","./rolldown-runtime-hePW80VL.js","./icons-DRlFT_ri.js","./query-CUzIxVzm.js","./markdown-D-35pK1E.js","./markdown-DvoRHisr.css","./AppearanceControls-vjVM_spw.js","./format-DsyV_JEZ.js","./useWorkbenchTheme-CXN9ftdE.js","./App-Cp4qzJN7.css","./WorkflowWorkbench-DfyLETfa.js","./AdminDataApp-Bcx_5Da8.js","./history-CBChoFHN.js","./code-xml-DMjjpBic.js","./AdminDataApp--AL95rdz.css"])))=>i.map(i=>d[i]); +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{D as n,E as r}from"./icons-DRlFT_ri.js";import{C as i,S as a,_ as o,a as s,c,d as l,f as u,g as d,h as f,l as p,m,n as h,p as g,s as _,u as v,v as y,w as ee,x as te,y as b}from"./query-CUzIxVzm.js";import"./markdown-D-35pK1E.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ne=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,x(te);else{var t=n(l);t!==null&&de(ee,t.startTime-e)}}}function te(t,i){m=!1,h&&(h=!1,_(re),re=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!oe());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&de(ee,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var b=!1,ne=null,re=-1,ie=5,ae=-1;function oe(){return!(e.unstable_now()-aee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(re),re=-1):h=!0,de(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x(te))),r},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=t(((e,t)=>{t.exports=ne()})),ie=t((e=>{var t=n(),r=re();function i(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),u=Object.prototype.hasOwnProperty,d=/^[: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]*$/,f={},p={};function m(e){return u.call(p,e)?!0:u.call(f,e)?!1:d.test(e)?p[e]=!0:(f[e]=!0,!1)}function h(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?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(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){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function ee(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function te(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ve(e):``}function xe(e){switch(e.tag){case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 2:case 15:return e=be(e.type,!1),e;case 11:return e=be(e.type.render,!1),e;case 1:return e=be(e.type,!0),e;default:return``}}function Se(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 ae:return`Fragment`;case ie:return`Portal`;case se:return`Profiler`;case oe:return`StrictMode`;case x:return`Suspense`;case de:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case le:return(e.displayName||`Context`)+`.Consumer`;case ce:return(e._context.displayName||`Context`)+`.Provider`;case ue:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case fe:return t=e.displayName||null,t===null?Se(e.type)||`Memo`:t;case pe:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}function Ce(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`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return Se(t);case 8:return t===oe?`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 we(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ee(e){var t=Te(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function De(e){e._valueTracker||=Ee(e)}function Oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Te(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ke(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ae(e,t){var n=t.checked;return S({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function je(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=we(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Me(e,t){t=t.checked,t!=null&&te(e,`checked`,t,!1)}function Ne(e,t){Me(e,t);var n=we(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`)?Fe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Fe(e,t.type,we(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pe(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 Fe(e,t,n){(t!==`number`||ke(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ie=Array.isArray;function Le(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=We.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qe={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},Je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(qe).forEach(function(e){Je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),qe[t]=qe[e]})});function Ye(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||qe.hasOwnProperty(e)&&qe[e]?(``+t).trim():t+`px`}function C(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ye(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Xe=S({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 w(e,t){if(t){if(Xe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(i(62))}}function Ze(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 Qe=null;function $e(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var et=null,T=null,tt=null;function nt(e){if(e=Zi(e)){if(typeof et!=`function`)throw Error(i(280));var t=e.stateNode;t&&(t=$i(t),et(e.stateNode,e.type,t))}}function rt(e){T?tt?tt.push(e):tt=[e]:T=e}function it(){if(T){var e=T,t=tt;if(tt=T=null,nt(e),t)for(e=0;e>>=0,e===0?32:31-(Lt(e)/Rt|0)|0}var Bt=64,Vt=4194304;function Ht(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 Ut(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Ht(a))):r=Ht(s)}else o=n&~i,o===0?a!==0&&(r=Ht(a)):r=Ht(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))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 Yt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=n}function Xt(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=dr),mr=` `,hr=!1;function gr(e,t){switch(e){case`keyup`:return lr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function _r(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var vr=!1;function yr(e,t){switch(e){case`compositionend`:return _r(t);case`keypress`:return t.which===32?(hr=!0,mr):null;case`textInput`:return e=t.data,e===mr&&hr?null:e;default:return null}}function br(e,t){if(vr)return e===`compositionend`||!ur&&gr(e,t)?(e=Pn(),Nn=Mn=jn=null,vr=!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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Hr(n)}}function Wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gr(){for(var e=window,t=ke();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ke(e.document)}return t}function Kr(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 qr(e){var t=Gr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Wr(n.ownerDocument.documentElement,n)){if(r!==null&&Kr(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 i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ur(n,a);var o=Ur(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Yr=null,Xr=null,Zr=null,Qr=!1;function $r(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qr||Yr==null||Yr!==ke(r)||(r=Yr,`selectionStart`in r&&Kr(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}),Zr&&Vr(Zr,r)||(Zr=r,r=wi(Xr,`onSelect`),0ta||(e.current=ea[ta],ea[ta]=null,ta--)}function N(e,t){ta++,ea[ta]=e.current,e.current=t}var ra={},P=na(ra),ia=na(!1),aa=ra;function oa(e,t){var n=e.type.contextTypes;if(!n)return ra;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function sa(e){return e=e.childContextTypes,e!=null}function ca(){M(ia),M(P)}function la(e,t,n){if(P.current!==ra)throw Error(i(168));N(P,t),N(ia,n)}function ua(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!=`function`)return n;for(var a in r=r.getChildContext(),r)if(!(a in t))throw Error(i(108,Ce(e)||`Unknown`,a));return S({},n,r)}function da(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ra,aa=P.current,N(P,e),N(ia,ia.current),!0}function fa(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=ua(e,t,aa),r.__reactInternalMemoizedMergedChildContext=e,M(ia),M(P),N(P,e)):M(ia),N(ia,n)}var pa=null,ma=!1,ha=!1;function ga(e){pa===null?pa=[e]:pa.push(e)}function _a(e){ma=!0,ga(e)}function va(){if(!ha&&pa!==null){ha=!0;var e=0,t=A;try{var n=pa;for(A=1;e>=o,i-=o,Ea=1<<32-It(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),F&&Oa(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),F&&Oa(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return F&&Oa(a,g),u}for(h=r(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),F&&Oa(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===ae&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case ne:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===ae){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===pe&&qa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ga(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===ae?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Ga(e,r,i),o.return=e,e=o)}return s(e);case ie:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case pe:return l=i._init,_(e,r,l(i._payload),o)}if(Ie(i))return h(e,r,i,o);if(ge(i))return g(e,r,i,o);Ka(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ya=Ja(!0),Xa=Ja(!1),Za=na(null),Qa=null,$a=null,eo=null;function to(){eo=$a=Qa=null}function no(e){var t=Za.current;M(Za),e._currentValue=t}function ro(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function io(e,t){Qa=e,eo=$a=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Us=!0),e.firstContext=null)}function ao(e){var t=e._currentValue;if(eo!==e){if(e={context:e,memoizedValue:t,next:null},$a===null){if(Qa===null)throw Error(i(308));$a=e,Qa.dependencies={lanes:0,firstContext:e}}else $a=$a.next=e}return t}var oo=null;function so(e){oo===null?oo=[e]:oo.push(e)}function co(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,so(t)):(n.next=i.next,i.next=n),t.interleaved=n,lo(e,r)}function lo(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 uo=!1;function fo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function po(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 mo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ho(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,lo(e,n)}return i=r.interleaved,i===null?(t.next=t,so(r)):(t.next=i.next,i.next=t),r.interleaved=t,lo(e,n)}function go(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}function _o(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 vo(e,t,n,r){var i=e.updateQueue;uo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=S({},d,f);break a;case 2:uo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Zc|=o,e.lanes=o,e.memoizedState=d}}function yo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=No.transition;No.transition={};try{e(!1),t()}finally{A=n,No.transition=r}}function gs(){return Uo().memoizedState}function _s(e,t,n){var r=hl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ys(e))bs(t,n);else if(n=co(e,t,n,r),n!==null){var i=Z();gl(n,e,r,i),xs(n,t,r)}}function vs(e,t,n){var r=hl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ys(e))bs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Br(s,o)){var c=t.interleaved;c===null?(i.next=i,so(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=co(e,t,i,r),n!==null&&(i=Z(),gl(n,e,r,i),xs(n,t,r))}}function ys(e){var t=e.alternate;return e===L||t!==null&&t===L}function bs(e,t){Io=Fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}var Ss={readContext:ao,useCallback:B,useContext:B,useEffect:B,useImperativeHandle:B,useInsertionEffect:B,useLayoutEffect:B,useMemo:B,useReducer:B,useRef:B,useState:B,useDebugValue:B,useDeferredValue:B,useTransition:B,useMutableSource:B,useSyncExternalStore:B,useId:B,unstable_isNewReconciler:!1},Cs={readContext:ao,useCallback:function(e,t){return Ho().memoizedState=[e,t===void 0?null:t],e},useContext:ao,useEffect:as,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),rs(4194308,4,ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){return rs(4,2,e,t)},useMemo:function(e,t){var n=Ho();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ho();return t=n===void 0?t:n(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=_s.bind(null,L,e),[r.memoizedState,e]},useRef:function(e){var t=Ho();return e={current:e},t.memoizedState=e},useState:es,useDebugValue:ds,useDeferredValue:function(e){return Ho().memoizedState=e},useTransition:function(){var e=es(!1),t=e[0];return e=hs.bind(null,e[1]),Ho().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=L,a=Ho();if(F){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),q===null)throw Error(i(349));Po&30||Yo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Zo.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,Xo.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ho(),t=q.identifierPrefix;if(F){var n=Da,r=Ea;n=(r&~(1<<32-It(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Lo++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof r.is==`string`?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),n===`select`&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Wi]=t,e[Gi]=r,fc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ze(n,r),n){case`dialog`:j(`cancel`,e),j(`close`,e),a=r;break;case`iframe`:case`object`:case`embed`:j(`load`,e),a=r;break;case`video`:case`audio`:for(a=0;arl&&(t.flags|=128,r=!0,hc(s,!1),t.lanes=4194304)}}else{if(!r){if(e=ko(c),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),hc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!F)return H(t),null}else 2*O()-s.renderingStartTime>rl&&n!==1073741824&&(t.flags|=128,r=!0,hc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(H(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=O(),t.sibling=null,n=I.current,N(I,r?n&1|2:n&1),t);case 22:case 23:return Tl(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Jc&1073741824&&(H(t),t.subtreeFlags&6&&(t.flags|=8192)):H(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function _c(e,t){switch(ja(t),t.tag){case 1:return sa(t.type)&&ca(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Eo(),M(ia),M(P),jo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Oo(t),null;case 13:if(M(I),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(I),null;case 4:return Eo(),null;case 10:return no(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var vc=!1,U=!1,yc=typeof WeakSet==`function`?WeakSet:Set,W=null;function bc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function xc(e,t,n){try{n()}catch(n){$(e,t,n)}}var Sc=!1;function Cc(e,t){if(Mi=wn,e=Gr(),Kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},wn=!1,W=t;W!==null;)if(t=W,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Es(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return h=Sc,Sc=!1,h}function wc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&xc(t,n,a)}i=i.next}while(i!==r)}}function Tc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,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 Ec(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 Dc(e){var t=e.alternate;t!==null&&(e.alternate=null,Dc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wi],delete t[Gi],delete t[qi],delete t[Ji],delete t[Yi])),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 Oc(e){return e.tag===5||e.tag===3||e.tag===4}function kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Oc(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 a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ac(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=ji));else if(r!==4&&(e=e.child,e!==null))for(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}function jc(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(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}var G=null,Mc=!1;function Nc(e,t,n){for(n=n.child;n!==null;)Pc(e,t,n),n=n.sibling}function Pc(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount==`function`)try{Pt.onCommitFiberUnmount(Nt,n)}catch{}switch(n.tag){case 5:U||bc(n,t);case 6:var r=G,i=Mc;G=null,Nc(e,t,n),G=r,Mc=i,G!==null&&(Mc?(e=G,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):G.removeChild(n.stateNode));break;case 18:G!==null&&(Mc?(e=G,n=n.stateNode,e.nodeType===8?Bi(e.parentNode,n):e.nodeType===1&&Bi(e,n),Sn(e)):Bi(G,n.stateNode));break;case 4:r=G,i=Mc,G=n.stateNode.containerInfo,Mc=!0,Nc(e,t,n),G=r,Mc=i;break;case 0:case 11:case 14:case 15:if(!U&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&xc(n,t,o),i=i.next}while(i!==r)}Nc(e,t,n);break;case 1:if(!U&&(bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Nc(e,t,n);break;case 21:Nc(e,t,n);break;case 22:n.mode&1?(U=(r=U)||n.memoizedState!==null,Nc(e,t,n),U=r):Nc(e,t,n);break;default:Nc(e,t,n)}}function Fc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ic(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=s),r&=~o}if(r=a,r=O()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wc(r/1960))-r,10e?16:e,ll===null)var r=!1;else{if(e=ll,ll=null,ul=0,K&6)throw Error(i(331));var a=K;for(K|=4,W=e.current;W!==null;){var o=W,s=o.child;if(W.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lO()-nl?El(e,0):$c|=n),Q(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Vt,Vt<<=1,!(Vt&130023424)&&(Vt=4194304)):t=1);var n=Z();e=lo(e,t),e!==null&&(Yt(e,t,n),Q(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||ia.current)Us=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Us=!1,dc(e,t,n);Us=!!(e.flags&131072)}}else Us=!1,F&&t.flags&1048576&&ka(t,Sa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;lc(e,t),e=t.pendingProps;var a=oa(t,P.current);io(t,n),a=Bo(null,t,r,e,a,n);var o=Vo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,sa(r)?(o=!0,da(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,fo(t),a.updater=Os,t.stateNode=a,a._reactInternals=t,Ms(t,r,e,n),t=Zs(null,t,r,!0,o,n)):(t.tag=0,F&&o&&Aa(t),V(null,t,a,n),t=t.child),t;case 16:r=t.elementType;a:{switch(lc(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Jl(r),e=Es(r,e),a){case 0:t=Ys(null,t,r,e,n);break a;case 1:t=Xs(null,t,r,e,n);break a;case 11:t=Ws(null,t,r,e,n);break a;case 14:t=Gs(null,t,r,Es(r.type,e),n);break a}throw Error(i(306,r,``))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Ys(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Xs(e,t,r,a,n);case 3:a:{if(Qs(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,a=o.element,po(e,t),vo(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ns(Error(i(423)),t),t=$s(e,t,r,n,a);break a}if(r!==a){a=Ns(Error(i(424)),t),t=$s(e,t,r,n,a);break a}for(Na=Vi(t.stateNode.containerInfo.firstChild),Ma=t,F=!0,Pa=null,n=Xa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ha(),r===a){t=uc(e,t,n);break a}V(e,t,r,n)}t=t.child}return t;case 5:return Do(t),e===null&&Ra(t),r=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Pi(r,a)?s=null:o!==null&&Pi(r,o)&&(t.flags|=32),Js(e,t),V(e,t,s,n),t.child;case 6:return e===null&&Ra(t),null;case 13:return nc(e,t,n);case 4:return To(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ya(t,null,r,n):V(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Ws(e,t,r,a,n);case 7:return V(e,t,t.pendingProps,n),t.child;case 8:return V(e,t,t.pendingProps.children,n),t.child;case 12:return V(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,N(Za,r._currentValue),r._currentValue=s,o!==null){if(Br(o.value,s)){if(o.children===a.children&&!ia.current){t=uc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=mo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),ro(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(i(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),ro(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}V(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,io(t,n),a=ao(a),r=r(a),t.flags|=1,V(e,t,r,n),t.child;case 14:return r=t.type,a=Es(r,t.pendingProps),a=Es(r.type,a),Gs(e,t,r,a,n);case 15:return Ks(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),lc(e,t),t.tag=1,sa(r)?(e=!0,da(t)):e=!1,io(t,n),As(t,r,a),Ms(t,r,a,n),Zs(null,t,r,!0,e,n);case 19:return cc(e,t,n);case 22:return qs(e,t,n)}throw Error(i(156,t.tag))};function Wl(e,t){return wt(e,t)}function Gl(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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===fe)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(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 Xl(e,t,n,r,a,o){var s=2;if(r=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ae:return Zl(n.children,a,o,t);case oe:s=8,a|=8;break;case se:return e=Kl(12,n,t,a|2),e.elementType=se,e.lanes=o,e;case x:return e=Kl(13,n,t,a),e.elementType=x,e.lanes=o,e;case de:return e=Kl(19,n,t,a),e.elementType=de,e.lanes=o,e;case me:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ce:s=10;break a;case le:s=9;break a;case ue:s=11;break a;case fe:s=14;break a;case pe:s=16,r=null;break a}throw Error(i(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){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=Jt(0),this.expirationTimes=Jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},fo(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ie()})),oe=t((e=>{var t=ae();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),se=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new p({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ce(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){u.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>d(t,e))}findAll(e={}){return this.getAll().filter(t=>d(e,t))}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return u.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function ce(e){return e.options.scope?.id}var le=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new v({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){u.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){u.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){u.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new le,this.#t=e.mutationCache||new se,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=i.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=l.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(te(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return u.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;u.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return u.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=u.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return u.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=u.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(te(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return l.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(m(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{b(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(m(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{b(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=f(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===a&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},x=e(n(),1),de=e(oe(),1),fe=class extends Error{status;method;path;code;detail;constructor(e,t,n,r,i=``,a=``){super(e),this.name=`ApiError`,this.status=t,this.method=n,this.path=r,this.code=i,this.detail=a}};function pe(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{detail:``,code:``};try{let t=JSON.parse(e),n=t.detail&&typeof t.detail==`object`&&!Array.isArray(t.detail)?t.detail:void 0,r=typeof t.code==`string`&&t.code.trim()?t.code.trim():typeof n?.code==`string`?n.code.trim():``;if(n)for(let e of[`message`,`detail`]){let t=n[e];if(typeof t==`string`&&t.trim())return{detail:t.trim(),code:r}}for(let e of[`detail`,`error`,`message`]){let n=t[e];if(typeof n==`string`&&n.trim())return{detail:n.trim(),code:r};if(Array.isArray(n)){let e=n.map(e=>e&&typeof e==`object`?String(e.msg??``):``).filter(Boolean);if(e.length)return{detail:e.join(`; `),code:r}}}return{detail:``,code:r}}catch{}return{detail:t.startsWith(``u`?``:window.location.search).get(`reader_preview`);return e===`source-first`||e===`learning-path`||e===`question-foundation`?e:null}function S(e,t,n,r,i=ge(),a){let o=[`map-copy`,e,t,n,r];return i===`question-foundation`?[...o,i,a??null]:i?[...o,i]:o}var _e=`0.1.8+1044a0e5ca7c4885`,ve=!1,ye=new Set,be=()=>ve,xe=e=>(ye.add(e),()=>{ye.delete(e)});function Se(e){ve||!e||e===`unknown`||e===`0.1.8+1044a0e5ca7c4885`||(ve=!0,ye.forEach(e=>e()))}var Ce=class extends Error{constructor(){super(`页面已更新,请刷新后继续。 / This page has been updated. Refresh to continue.`),this.name=`PageUpdateRequiredError`}};function we(){if(ve)throw new Ce}var Te={name:`argus.webapi`,major:1,minServerMinor:16},Ee=[`daemon.admission.v1`,`daemon.status.protocol.v1`,`daemon.command.v1`,`daemon.upgrade-schedule.v1`,`cost.admission.v1`,`event.catalog.v1`,`event.payload-schema.v1`,`manager.sse.v1`,`manager.request-cancel.v1`,`advisor.config.v1`,`metrics.slo.v2`,`mission.view.v1`,`mission.abort.v1`,`project.attachments.v1`,`project.git-diff.v1`,`project.cost-feed.v1`,`project.counterexamples.v1`,`project.workdir.v1`,`research.events.v1`,`release.identity.v1`,`snapshot.schema.v1`,`source.update.v1`,`usage.recorded.v2`,`verticals.store.v1`],De=`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`;function Oe(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function ke(e){return typeof e==`number`&&Number.isInteger(e)?e:null}function Ae(e,t){let n=Oe(e),r=Oe(n?.protocol),i=Oe(n?.runtime),a=Array.isArray(n?.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],o=ke(r?.major),s=ke(r?.minor);if(!n||!r||!i)return{compatible:!1,reason:`malformed /api/meta response`};if(typeof i.source_root!=`string`||ke(i.pid)===null||typeof i.package_version!=`string`||typeof i.release_id!=`string`)return{compatible:!1,reason:`malformed /api/meta runtime identity`};if(n.service!==`argus-skill-webapi`)return{compatible:!1,reason:`unexpected service ${String(n.service||`unknown`)}`};let c=e;if(r.name!==Te.name||o!==Te.major)return{compatible:!1,reason:`protocol ${String(r.name||`unknown`)}/${String(o)} is incompatible with client ${Te.name}/${Te.major}`,meta:c};if(s===null||s!a.includes(e));if(l.length>0)return{compatible:!1,reason:`missing capabilities: ${l.join(`, `)}`,meta:c};if(i.source_root_matches_config===!1)return{compatible:!1,reason:`backend is running from a different installation than configured`,meta:c};if(t&&i.release_id!==t.releaseId)return{compatible:!1,reason:`backend and client installations are out of sync; restart or reinstall Argus`,meta:c};if(t?.sourceDigest){if(typeof i.runtime_source_digest!=`string`||!i.runtime_source_digest)return{compatible:!1,reason:`backend cannot verify this local installation; restart it from the current checkout`,meta:c};if(i.runtime_source_digest!==t.sourceDigest)return{compatible:!1,reason:`backend is running code from a different local installation; restart it`,meta:c}}let u=i.release_matches_source===!1?De:void 0;return{compatible:!0,reason:``,...u?{warning:u}:{},meta:c}}function je(e,t,n){let r=Ae(e,t);if(!r.compatible||!r.meta)throw Error(`incompatible Argus API: ${r.reason}`);return r.warning&&n?.(r.warning),r.meta}function Me(e){let t=Oe(e),n=Oe(t?.daemon);if(!t||t.schema_version!==7)throw Error(`incompatible snapshot schema: expected 7, got ${String(t?.schema_version??`missing`)}`);if(!n)throw Error(`invalid snapshot: daemon section is missing`);let r=[`read_status`,`read_error`,`protocol_compatible`,`protocol_error`].filter(e=>!Object.hasOwn(n,e));if(r.length>0)throw Error(`invalid snapshot: daemon fields missing: ${r.join(`, `)}`);let i=[`spend_usd`,`spend_status`,`usage_summary`,`daemon_commands`,`observability`,`mission_view`,`partial`,`diagnostics`].filter(e=>!Object.hasOwn(t,e));if(i.length>0)throw Error(`invalid snapshot: fields missing: ${i.join(`, `)}`);if(!Array.isArray(t.diagnostics))throw Error(`invalid snapshot: diagnostics must be an array`);return e}function Ne(e,t){return je(e,{releaseId:_e},t)}function Pe(e,t){let n=`/api/application-workflows`,r=e=>`${n}/${encodeURIComponent(e)}`;return{catalog:()=>e(n),create:e=>t(n,e),open:e=>t(`${n}/open`,{project:e}),snapshot:t=>e(r(t)),action:(e,n)=>t(r(e),n),document:(t,n)=>e(`${r(t)}/document?path=${encodeURIComponent(n)}`)}}var Fe=`verticals.store.v1`,Ie=`argus_web_token`,Le=null;function Re(){let e;try{e=new URLSearchParams(window.location.search)}catch{return}let t=e.get(`token`);if(t){Le=t;try{localStorage.setItem(Ie,t)}catch{}try{e.delete(`token`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)}catch{}}}var ze=()=>{if(Le)return Le;try{return new URLSearchParams(window.location.search).get(`token`)||localStorage.getItem(Ie)}catch{return null}};function Be(){let e=ze();return e?{Authorization:`Bearer ${e}`}:{}}function Ve(){return ze()??``}var He=8e3,Ue=12e3,We=class extends Error{constructor(){super(`This browser is not paired with Argus. Open a valid pairing link or enter a pairing token.`),this.name=`PairingRequiredError`}},Ge=class extends Error{method;path;constructor(e,t,n=`could not reach the local Argus service`){super(`${e.toUpperCase()} ${t} ${n}. Make sure Argus Desktop is running, then retry.`),this.name=`LocalArgusUnavailableError`,this.method=e.toUpperCase(),this.path=t}};function Ke(e){return e instanceof We||!!(e&&typeof e==`object`&&Number(e.status)===401)}function qe(e){return Ke(e)||e instanceof Ge}async function Je(e,t){let n;try{n=await fetch(e,t)}catch(n){throw t.signal?.aborted?n:new Ge(String(t.method??`GET`),e)}return n.ok&&(Se(n.headers.get(`X-Argus-Release`)),(!t.method||t.method===`GET`)&&we()),n}async function Ye(e,t,n,r){let i=new AbortController,a=t.signal??void 0,o=!1,s=()=>{};if(a){let e=()=>i.abort(a.reason);a.aborted?e():(a.addEventListener(`abort`,e,{once:!0}),s=()=>a.removeEventListener(`abort`,e))}let c,l=(async()=>await r(await Je(e,{...t,signal:i.signal})))(),u=new Promise((e,t)=>{c=setTimeout(()=>{o=!0;let e=Error(`request timed out after ${n}ms`);i.abort(e),t(e)},n)});try{return await Promise.race([l,u])}catch(r){if(o){let r=Math.round(n/1e3);throw new Ge(String(t.method??`GET`),e,`timed out after ${r}s because the local Argus service did not respond`)}throw r}finally{c&&clearTimeout(c),s()}}async function C(e,t,n){return Ye(e,{headers:Be(),signal:t},n??Ue,async t=>(await he(t,`GET`,e),await t.json()))}async function Xe(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:t===void 0?void 0:JSON.stringify(t),signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),r}async function w(e,t,n){return await(await Xe(e,t,n)).json()}async function Ze(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:Be(),body:t,signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),await r.json()}function Qe(e){let t=e&&typeof e==`object`?e:{},n=String(t.command_status??``);if(Number(t.rc??0)!==0||n===`failed`||n===`rejected`)throw Error(String(t.error||`daemon command ${n||`failed`}`));return e}async function $e(e,t,n){we();let r=await fetch(t,{method:e,headers:{"Content-Type":`application/json`,...Be()},body:n===void 0?void 0:JSON.stringify(n)});return await he(r,e,t),Se(r.headers.get(`X-Argus-Release`)),await r.json()}async function et(e,t){let n=await fetch(e,{headers:Be(),signal:t});return await he(n,`GET`,e),n.blob()}var T=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`;function tt(e,t){let n=new URLSearchParams({path:t}),r=Ve();return r&&n.set(`token`,r),T(e,`/artifact/preview/page?${n.toString()}`)}var nt=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,rt=nt,it;function at(e){return!!(e&&typeof e==`object`&&`aborted`in e&&typeof e.aborted==`boolean`)}function ot(e,t,n,r){let i={text:e};return t?.length&&(i.attachments=t),n&&n!==`auto`&&(i.route_override=n),r&&(i.request_id=r),i}function st(){if(!it){let e=(async()=>{let e=`/api/meta`,t=await Ye(e,{headers:Be()},He,async t=>{if(t.status===404)throw Error(`incompatible Argus API: service does not expose /api/meta`);await he(t,`GET`,e);let n=await t.json();return Se(n?.runtime?.release_id),Ne(n,e=>{e!==`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`&&console.warn(`Argus API compatibility warning: ${e}`)})});if(t.authentication?.required&&!t.authentication.authenticated)throw new We;return t})();it=e,e.catch(t=>{it===e&&!(t instanceof We)&&(it=void 0)})}return it}var ct=new Set([`waiting_for_source`,`planning`,`writing`,`reviewing`]);function lt(e){let t=[],n;for(;n=/\r?\n\r?\n/.exec(e);){let r=e.slice(0,n.index);e=e.slice(n.index+n[0].length);for(let e of r.split(` +`)){let n=e.trim();if(n.startsWith(`data:`))try{t.push(JSON.parse(n.slice(5).trim()))}catch{}}}return{frames:t,rest:e}}async function ut(e,t,n,r){if(!e.body)throw Error(`${t} returned no response body`);let i=e.body.getReader(),a=new TextDecoder,o=``,s,c=!1;try{for(;;){r?.throwIfAborted();let{done:e,value:l}=await i.read();c=e,r?.throwIfAborted(),o+=e?a.decode()+` + +`:a.decode(l,{stream:!0});let u=lt(o);o=u.rest;for(let e of u.frames)n?.(e),(e.type===`done`||e.type===`error`)&&(s=e);if(e){if(!s)throw Error(`${t} ended before a terminal event`);return s}}}finally{c||await i.cancel().catch(()=>{}),i.releaseLock()}}var dt=null;function ft(e,t,n,r,i=ge(),a){let o=new URLSearchParams(n);return r&&o.set(`session_id`,r),i===`source-first`&&o.set(`preview`,`true`),i===`learning-path`&&o.set(`preview`,`learning-path`),i===`question-foundation`&&(o.set(`preview`,`question-foundation`),a&&o.set(`foundation_id`,a)),`/api/map-copy/${e}/${encodeURIComponent(t)}?${o}`}async function pt(e,t,n,r){let i=await Xe(e,t,n),a=!1,o=await ut(i,`Explanation stream`,e=>{(e.type===`done`||e.type===`error`)&&(a=!0),!a&&e.type===`progress`&&ct.has(e.phase)&&r?.(e.phase)},n);if(o.type===`error`){let t=o.error&&typeof o.error==`object`?o.error:void 0;throw new fe(String(t?.message??o.error??`Explanation failed`),typeof o.status==`number`?o.status:0,`POST`,e,typeof t?.code==`string`?t.code:``)}return o.result}var E={workflows:Pe(C,w),advisorSettings:(e,t)=>C(T(e,`/advisor/config`),t),saveAdvisorSettings:(e,t)=>w(T(e,`/advisor/config`),t),liveMap:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r?.mode===`current`&&(i.set(`since`,String(r.since)),i.set(`event_since`,String(r.eventSince)),r.taskId&&i.set(`start_task`,r.taskId)),C(T(e,`/map`)+(i.size?`?${i}`:``),t)},mapInfo:(e,t)=>C(T(e,`/map-info`),t),mapHistory:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r&&i.set(`task_after`,r),C(T(e,`/map-history`)+(i.size?`?${i}`:``),t)},mapCopy:(e,t,n,r,i,a,o)=>C(ft(e,t,{locale:n},i,a,o),r),mapCardWords:(e,t,n,r,i)=>w(`/api/map-cards/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapLines:(e,t,n,r,i)=>w(`/api/map-lines/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapQuestionSource:(e,t,n)=>w(`/api/map-question-source/project/${encodeURIComponent(e)}?session_id=${encodeURIComponent(e)}`,{...t,preview:t.preview===`source-first`?!0:t.preview??!1},n),generateMapCopy:(e,t,n,r,i,a,o)=>pt(ft(e,t,{stream:`true`},i,a,n.foundation_id),n,r,o),generateReaderFoundation:(e,t,n)=>pt(T(e,`/reader-foundation?stream=true`),t,void 0,n),askReaderFoundation:(e,t,n,r)=>pt(T(e,`/reader-foundation/${encodeURIComponent(t)}/question?stream=true`),n,void 0,r),mapDatasets:e=>C(`/api/map-datasets`,e),mapDataset:(e,t)=>C(`/api/map-datasets/${encodeURIComponent(e)}`,t),meta:st,projectIndex:async()=>(await st(),C(`/api/projects`,void 0,Ue)),listProjects:async()=>(await st(),C(`/api/projects`,void 0,Ue).then(e=>e.projects)),projectCosts:async e=>(await st(),C(`/api/projects/costs`,e)),createDaemon:async(e,t=``,n=``,r)=>{let i=`/api/daemons`,a={objective:e,name:t,workdir:n,command_id:rt(),expected_revision:r},o=()=>fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify(a),cache:`no-store`}),s=await o();return s.status===400&&/Invalid HTTP request received/i.test(await s.clone().text())&&(s=await o()),await he(s,`POST`,i),Qe(await s.json())},updateProject:(e,t)=>$e(`PATCH`,T(e),{name:t}),deleteProject:e=>$e(`DELETE`,T(e)),snapshot:async(e,t,n=!1)=>(await st(),Me(await C(T(e,`/snapshot?compact=true&events_limit=1${n?`&prewarm=true`:``}`),t,Ue))),activeSnapshot:async(e,t)=>{let n=dt!==e;n&&(dt=e);try{return await E.snapshot(e,t,n)}catch(t){throw n&&dt===e&&(dt=null),t}},prefetchSnapshot:(e,t)=>E.snapshot(e,t,!1),status:(e,t)=>C(T(e,`/status`),t),journal:(e,t=20,n)=>C(T(e,`/journal?n=${t}`),n).then(e=>e.journal),doctor:(e,t)=>C(T(e,`/doctor`),t),config:(e,t)=>C(T(e,`/config`),t),identity:(e,t)=>C(T(e,`/identity`),t).then(e=>e.identity),transcript:(e,t=30,n)=>C(T(e,`/transcript?n=${t}`),n).then(e=>e.turns),events:(e,t=80,n)=>C(T(e,`/events?limit=${t}&view=ui`),n).then(e=>e.events),workRecord:(e,t,n,r)=>C(T(e,`/work-record?role=${encodeURIComponent(t)}&record_id=${encodeURIComponent(n)}`),r),downloadWorkLog:async(e,t,n=``)=>{let r=T(e,`/work-log/download?role=${encodeURIComponent(t)}&task_id=${encodeURIComponent(n)}`),i=await fetch(r,{headers:Be(),cache:`no-store`});await he(i,`GET`,r);let a=URL.createObjectURL(await i.blob()),o=document.createElement(`a`);o.href=a,o.download=`work-records.md`,o.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)},backlogItem:(e,t,n)=>C(T(e,`/backlog/${encodeURIComponent(t)}`),n).then(e=>e.item),artifacts:(e,t,n=!1)=>C(T(e,`/artifacts${n?`?include_reading=true`:``}`),t).then(e=>e.artifacts),artifact:(e,t,n)=>C(T(e,`/artifact?${new URLSearchParams({path:t})}`),n),artifactPreview:(e,t,n)=>C(T(e,`/artifact/preview?${new URLSearchParams({path:t})}`),n),artifactBundle:(e,t,n)=>et(T(e,`/artifact/bundle?${new URLSearchParams({path:t})}`),n),artifactBlob:(e,t,n=!1,r)=>{let i=new URLSearchParams({path:t});return n&&i.set(`download`,`true`),et(T(e,`/artifact/raw?${i}`),r)},gitDiff:(e,t)=>C(T(e,`/git-diff`),t),deliveryDiff:(e,t,n)=>C(T(e,`/delivery-diff?${new URLSearchParams(t)}`),n),metrics:e=>C(`/api/metrics`,e),sourceUpdateStatus:e=>C(`/api/runtime/source-update`,e),checkSourceUpdate:()=>w(`/api/runtime/source-update/check`),applySourceUpdate:()=>w(`/api/runtime/source-update/apply`),resources:e=>C(`/api/system/resources`,e),trash:(e=``,t=100,n=0,r)=>C(`/api/trash?${new URLSearchParams({query:e,limit:String(t),offset:String(n)})}`,r),restoreTrash:e=>w(`/api/trash/${encodeURIComponent(e)}/restore`),verticals:e=>C(`/api/verticals`,e),refreshVerticalCatalog:()=>w(`/api/verticals/catalog/refresh`),manageVertical:(e,t,n={})=>w(`/api/verticals/${encodeURIComponent(e)}/manage/${t}`,n.force?{force:!0}:{}),verticalOperation:(e,t)=>C(`/api/verticals/${encodeURIComponent(e)}/operation`,t),addTask:(e,t)=>w(T(e,`/tasks`),{text:t}).then(e=>e.item),abortMission:(e,t)=>w(T(e,`/mission/abort`),{reason:t}),mapNotes:(e,t)=>C(T(e,`/map-notes`),t),addMapNote:(e,t)=>w(T(e,`/map-notes`),t),answerPending:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/answer`),{text:n}),resolveDecision:(e,t,n,r)=>w(T(e,`/decisions/${encodeURIComponent(t)}/resolve`),{option_id:n,note:r}),uploadAttachments:async(e,t,n)=>{await st();let r=new FormData;return t.forEach(e=>r.append(`files`,e,e.name)),Ze(T(e,`/attachments`),r,n)},answerDomain:(e,t,n,r)=>w(T(e,`/message`),{text:r||n,domain_answer:{id:t,option_id:n,note:r}}),message:(e,t,n)=>{let r=at(n)?n:n?.signal,i=at(n)?void 0:n?.attachments,a=at(n)?void 0:n?.routeOverride,o=at(n)?void 0:n?.requestId;return w(T(e,`/message`),ot(t,i,a,o),r)},cancelMessage:(e,t)=>Ye(T(e,`/message/cancel`),{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify({request_id:t})},5e3,async t=>(await he(t,`POST`,T(e,`/message/cancel`)),await t.json())),messageStream:async(e,t,n,r)=>{let i=at(r)?r:r?.signal,a=at(r)?void 0:r?.attachments,o=at(r)?void 0:r?.routeOverride,s=at(r)?void 0:r?.requestId;await ut(await Xe(T(e,`/message/stream`),ot(t,a,o,s),i),`Manager stream`,e=>{if(!i?.aborted){if(e.type===`phase`){let t=Number(e.quiet_s??0);n.onPhase?.(String(e.label??``),String(e.role??`manager`),{heartbeat:e.heartbeat===!0,quietS:Number.isFinite(t)?t:0,kind:String(e.kind??``),detail:String(e.detail??``),tool:String(e.tool??``),toolKind:String(e.tool_kind??``),callId:String(e.call_id??``),status:String(e.status??``),output:String(e.output??``)})}else e.type===`delta`?n.onDelta?.(String(e.text??``),String(e.message_id??``),String(e.fragment_mode??`auto`)):e.type===`done`?n.onDone?.(e.result??{}):e.type===`error`&&n.onError?.(Error(String(e.error??`stream error`)))}},i)},nudge:(e,t)=>w(T(e,`/nudge`),{text:t}),queueFollowup:(e,t,n=`auto`)=>w(T(e,`/message/followup`),{text:t,route_override:n}),note:(e,t)=>w(T(e,`/note`),{text:t}),previewPlan:(e,t)=>w(T(e,`/plan`),{text:t}),rewritePrompt:(e,t)=>w(T(e,`/prompt/rewrite`),{text:t}),setConfig:(e,t,n,r=!1)=>w(T(e,`/config/set`),r?{name:t,value:n,apply_to_roles:!0}:{name:t,value:n}),setIdentity:(e,t)=>w(T(e,`/identity`),{text:t}),resetManager:e=>w(T(e,`/reset`)),skills:(e,t=`ls`)=>w(T(e,`/skills`),{args:t}).then(e=>e.text),skillLibrary:(e,t)=>C(`/api/skill-library${e?`?sid=${encodeURIComponent(e)}`:``}`,t),skillDocument:(e,t,n,r)=>C(`/api/skill-library/document?${new URLSearchParams({library:t,path:n,...e?{sid:e}:{}})}`,r),researchMethod:(e,t)=>C(T(e,`/research/method`),t),wiki:(e,t)=>C(T(e,`/wiki`),t),wikiPage:(e,t,n)=>C(T(e,`/wiki/page?${new URLSearchParams({path:t})}`),n),wikiLibrary:(e,t)=>C(`/api/wiki${e?`?sid=${encodeURIComponent(e)}`:``}`,t),wikiDocument:(e,t,n,r,i)=>C(`/api/wiki/page?${new URLSearchParams({scope:t,vertical:n,path:r,...e?{sid:e}:{}})}`,i),knowledgeFeed:(e=50,t)=>C(`/api/knowledge/feed?${new URLSearchParams({limit:String(e)})}`,t),learningStatus:(e,t)=>C(T(e,`/learning`),t),retryLearning:(e,t)=>w(T(e,`/learning/${encodeURIComponent(t)}/retry`),{}),setLaunchCwd:(e,t)=>w(T(e,`/launch-cwd`),{launch_cwd:t}),setWorkdir:(e,t)=>w(T(e,`/workdir`),{workdir:t}),disposeBacklog:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/dispose`),{op:n}),stopBacklog:(e,t)=>w(T(e,`/backlog/${encodeURIComponent(t)}/stop`)),setContinuous:(e,t,n=``)=>w(T(e,`/continuous`),{enabled:t,objective:n}).then(e=>{if(!t)return e;if(!e.daemon)throw Error(`daemon start returned no result`);return Qe(e.daemon),e}),startDaemon:(e,t)=>w(T(e,`/daemon/start`),{command_id:rt(),expected_revision:t}).then(Qe),stopDaemon:(e,t=!1,n,r=!1)=>w(T(e,`/daemon/stop`),{drain:t,force:r,command_id:rt(),expected_revision:n}).then(Qe),replaceDaemon:(e,t,n=!1,r)=>w(T(e,`/daemon/replace`),{victim_sid:t,resume_continuous:n,command_id:rt(),expected_revision:r}).then(Qe),upgradeDaemon:(e,t)=>w(T(e,`/daemon/upgrade`),{command_id:rt(),expected_revision:t}).then(Qe)},mt=new Set([4401,4404]);function ht(e,t,n={}){let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=new URLSearchParams;n.replay!=null&&i.set(`replay`,String(n.replay)),i.set(`view`,`ui`);let a=ze();a&&i.set(`token`,a);let o=`${r}//${window.location.host}${T(e,`/stream`)}?${i}`,s=null,c=!1,l,u=()=>{c||(s=new WebSocket(o),s.onopen=()=>n.onOpen?.(),s.onmessage=e=>{try{let n=JSON.parse(e.data);n&&typeof n==`object`&&t(n)}catch{}},s.onclose=e=>{let t=!mt.has(e.code);n.onClose?.({code:e.code,reason:e.reason,retryable:t}),!c&&t&&(l=setTimeout(u,1e3))},s.onerror=()=>s?.close())};return u(),()=>{c=!0,l&&clearTimeout(l),s?.close()}}var gt={schema:1,id:`argus`,name:`Argus`,tagline:`Autonomous Work Lab`,terminal_wordmark:`argus`,assets:{}};function _t(e){if(!e||typeof e!=`object`)throw Error(`Invalid application brand`);let t=e;if(t.schema!==1||typeof t.id!=`string`||!/^[a-z][a-z0-9-]{0,39}$/.test(t.id))throw Error(`Invalid application brand identity`);for(let[e,n]of[[`name`,48],[`tagline`,100],[`terminal_wordmark`,24]]){let r=t[e];if(typeof r!=`string`||!r.trim()||r.length>n||/[\x00-\x1f\x7f-\x9f]/.test(r))throw Error(`Invalid application brand ${e}`)}if(!/^[a-z0-9 -]+$/.test(String(t.terminal_wordmark)))throw Error(`Invalid terminal wordmark`);if(!t.assets||typeof t.assets!=`object`||Array.isArray(t.assets))throw Error(`Invalid application brand assets`);let n={};for(let e of[`mark`,`mark_dark`,`logo`,`logo_dark`,`icon`,`icon_dark`]){let r=t.assets[e];if(r!==void 0&&r!==`/api/application-brand/assets/${e}`)throw Error(`Invalid application brand asset ${e}`);if(typeof r==`string`)n[e]=r;else if(t.id!==`argus`)throw Error(`Missing application brand asset ${e}`)}return{schema:1,id:t.id,name:String(t.name),tagline:String(t.tagline),terminal_wordmark:String(t.terminal_wordmark),assets:n}}var vt=gt,yt=()=>vt;async function bt(){let e=await fetch(`/api/application-brand`,{cache:`no-store`});if(!e.ok)throw Error(`Application identity unavailable (${e.status})`);if(vt=_t(await e.json()),vt.id!==`argus`){document.title=`${vt.name} · Workbench`,document.querySelector(`meta[name="apple-mobile-web-app-title"]`)?.setAttribute(`content`,vt.name),document.querySelector(`link[rel="manifest"]`)?.setAttribute(`href`,`/api/application-brand/manifest.webmanifest`);for(let e of document.querySelectorAll(`link[rel="icon"], link[rel="apple-touch-icon"]`))e.href=e.media.includes(`dark`)?vt.assets.icon_dark:vt.assets.icon,e.removeAttribute(`type`)}}var D=r(),xt=`argus.locale`,St={"language.english":`English`,"handshake.connecting":`Getting Argus ready`,"handshake.service":`Service`,"handshake.project":`Project`,"handshake.ready":`Ready`,"handshake.title":`Getting Argus ready`,"handshake.detail":`Reopening your workspace…`,"splash.starting":`Argus starting`,"rail.workbench":`Workbench`,"rail.sessionsShortcut":`Sessions · Ctrl/⌘ P`,"panel.backlog":`Backlog`,"panel.activity":`Activity`,"panel.journal":`Journal`,"panel.roles":`Roles`,"panel.project":`Project`,"panel.liveView":`Manager live project view`,"stream.jumpToLatest":`Jump to latest`,"stream.toggleReasoning":`Show or hide agent reasoning (⌘T)`,"stream.reasoning":`Reasoning`,"stream.noLogs":`No activity yet`,"stream.system":`Argus updates`,"stream.autonomous":`Background activity`,"stream.backgroundWork":`Argus is working in the background`,"stream.ready":`Argus is ready. Ask a question or assign work.`,"stream.historyLoading":`Loading conversation history…`,"stream.historyError":`Could not load conversation history.`,"stream.historyRetry":`Retry`,"stream.fold.read":`Read {count} files`,"stream.fold.search":`Searched {count} times`,"stream.fold.fetch":`Looked up {count} web pages`,"stream.fold.edit":`Edited {count} files`,"stream.fold.tool":`Used {tool} {count} times`,"stream.fold.failed":`{count} failed`,"stream.fold.expand":`Show each step`,"stream.fold.collapse":`Hide the steps`,"stream.repeated":`Repeated {count} times; showing the latest`,"stream.stepFailed":`failed`,"stream.stepResult":`Result`,"common.showRaw":`Show raw output`,"doctor.lastEntry":`Last entry`,"operations.metric.calls":`model calls today`,"operations.metric.failed":`failed`,"operations.metric.slowest":`slowest typical call`,"operations.slo.healthy":`Healthy`,"operations.slo.degraded":`Needs attention`,"operations.slo.loading":`Loading…`,"operations.validationFailures":`{count} malformed events today`,"operations.outputLines":`{count} lines of output`,"operations.done":`Done.`,"newDaemon.workdirPlaceholder":`Blank → ~/.argus-skill/workspaces/`,"operations.resetManager":`Reset Manager context`,"language.chinese":`中文`,"language.switchTo":`Switch to {language}`,"common.loading":`Loading…`,"common.retry":`Retry`,"common.save":`Save`,"common.cancel":`Cancel`,"common.close":`Close`,"common.settings":`Settings`,"common.ready":`Ready`,"common.live":`Live`,"common.reconnecting":`Reconnecting`,"common.stale":`Snapshot stale`,"common.degraded":`Snapshot degraded`,"common.external":`External`,"common.pause":`Pause`,"common.run":`Run`,"common.working":`Working`,"common.local":`Local`,"common.all":`All`,"common.unassigned":`Unassigned`,"common.closeSessions":`Close sessions`,"common.resizeSessions":`Resize sessions`,"common.resizePreview":`Resize preview`,"common.expandPreview":`Expand preview`,"time.justNow":`just now`,"time.minutesAgo":`{count}m ago`,"time.hoursAgo":`{count}h ago`,"time.yesterdayAt":`Yesterday at {time}`,"connection.pairingTitle":`This browser is not paired with Argus`,"connection.pairingDetail":`Open a valid pairing link for this Argus site, or paste the link or token below.`,"connection.pairAgain":`Pair again`,"connection.pairingInput":`Pairing link or token`,"connection.pairingPlaceholder":`Paste a fresh pairing link or token`,"connection.pairingInvalid":`Enter a valid pairing link or token.`,"connection.connect":`Connect`,"connection.unreachableTitle":`The local Argus service is unavailable`,"connection.unreachableDetail":`Keep Argus Desktop running, wait for the local service to become ready, then retry.`,"sidebar.collapse":`Collapse sessions`,"sidebar.expand":`Expand sessions`,"sidebar.create":`Create project`,"sidebar.find":`Find a project`,"sidebar.clearSearch":`Clear search`,"sidebar.refreshFailed":`Refresh failed · retry`,"sidebar.noSessions":`No sessions`,"sidebar.noMatches":`No sessions matching "{query}"`,"sidebar.unnamedSession":`Unnamed session`,"sidebar.daemonAlive":`Argus background is online`,"sidebar.updateRequired":`Update required`,"sidebar.updateAvailable":`Update available`,"sidebar.updateAvailableHint":`The executor is still running with a different release from this page.`,"sidebar.stopped":`Background stopped`,"sidebar.runningFor":`Background online · {uptime}`,"sidebar.lastActive":`Last active {time}`,"sidebar.manage":`Manage {name}`,"sidebar.manageHint":`Rename, pause, or delete`,"sidebar.resume":`Resume`,"sidebar.resumeHint":`Resume work in {workdir}`,"sidebar.resumeSuccess":`Session resumed.`,"sidebar.resumeFailed":`Could not resume session: {error}`,"sidebar.modelLoading":`Loading backend and model…`,"sidebar.modelUnavailable":`Backend and model unavailable`,"sidebar.defaultModel":`default model`,"sidebar.openSettings":`Open settings`,"sidebar.compute":`Compute queue & allowance`,"sidebar.theme":`{current} theme; switch to {next}`,"landing.selectOrCreate":`Select a session from the sidebar, or create a new one.`,"landing.noSessions":`No sessions yet. Create one to begin.`,"landing.select":`Select project`,"landing.new":`New project`,"landing.menu":`Open menu`,"project.missingSwitched":`Project “{requested}” was not found. Switched to {fallback}.`,"project.missingCreate":`Project “{requested}” was not found. Create a project to continue.`,"topbar.openSessions":`Open projects`,"topbar.externallyManaged":`Externally managed`,"topbar.pauseDaemon":`Pause Argus`,"topbar.runDaemon":`Run Argus`,"topbar.working":`Argus is working on your request`,"topbar.roleActive":`{role} is active`,"topbar.roleIdle":`{role} is idle`,"topbar.externalDaemonHint":`Argus is managed outside this app and must be controlled there.`,"topbar.manageSession":`Manage session`,"topbar.showPreview":`Show preview`,"topbar.showActivity":`Show activity`,"mobile.views":`Views`,"mobile.sessions":`Projects`,"mobile.mission":`Mission`,"mobile.activity":`Conversation`,"mobile.workbench":`Workbench`,"mobile.map":`Map`,"mobile.preview":`Files`,"chat.working":`Argus is working on your message`,"chat.workingQuiet":`Argus is working on your message · Still working; no new update for {quiet}s`,"chat.stopWaitingHint":`Esc stop reply · Enter sends a follow-up`,"chat.queuedWhileRunning":`Queued · answered right after this reply; a running task can be steered by it`,"chat.attachWhileRunning":`Attachments can be sent once this reply finishes`,"chat.stepsLive":`Working · {count} steps so far`,"chat.stepsDone":`{count} steps · {seconds}`,"chat.stepFailed":`failed`,"chat.stepRaw":`raw`,"chat.messageArgus":`message Argus`,"chat.selectSession":`Select a session…`,"chat.placeholder":`Ask a question or assign work`,"chat.routeLabel":`message category`,"chat.routeHint":`For this message only. Argus chooses one worker or a team based on the request; greetings stay in conversation.`,"chat.routeTask":`Task`,"chat.routeAuto":`Auto`,"chat.routeChat":`Chat`,"chat.attach":`attach files`,"chat.attachHint":`PNG, JPEG, WebP, PDF, Markdown/text, JSON, CSV · up to {count} files, {perFile} each, {total} total`,"chat.attachDrop":`Drop files to attach`,"chat.attachRemove":`remove attachment {name}`,"chat.attachUnsupported":`{name} is not supported. Use PNG, JPEG, WebP, PDF, Markdown/text, JSON, or CSV.`,"chat.attachTooLarge":`{name} exceeds the {size} per-file limit.`,"chat.attachTooMany":`You can attach up to {count} files per message.`,"chat.attachTotalTooLarge":`Attachments exceed the {size} total limit.`,"chat.attachmentUploadFailed":`Attachment upload failed: {error}`,"chat.uploadingAttachments":`Uploading attachments`,"chat.rewriteHint":`Let the Manager rewrite this prompt into a brief the team can act on. Nothing is sent — the rewrite lands back in this box for you to edit.`,"chat.rewriteLabel":`rewrite prompt with the Manager`,"chat.rewriting":`rewriting`,"chat.rewrite":`Rewrite text`,"chat.stopWaiting":`stop reply`,"chat.stopWaitingTitle":`Stop this Manager request`,"chat.stoppingReply":`Stopping this reply…`,"chat.stopReplyRequested":`Stop requested. You can send another message.`,"chat.replyAlreadyFinished":`This reply has already finished.`,"chat.stopReplyFailed":`Could not stop the server request: {error}`,"chat.send":`send message`,"copy.message":`Copy`,"copy.code":`Copy code`,"copy.copied":`Copied`,"help.title":`Keyboard shortcuts`,"help.commands":`Commands`,"help.palette":`command palette`,"help.sessions":`toggle sessions`,"help.managerChat":`focus Manager chat`,"help.rewrite":`rewrite the current prompt before sending`,"help.reasoning":`toggle agent reasoning`,"help.kiosk":`toggle kiosk (read-only) mode`,"help.composer":`focus the composer`,"help.send":`send message`,"help.newline":`insert newline`,"help.thisHelp":`this help`,"help.escape":`close overlay / stop waiting in composer`,"palette.placeholder":`Type a command or search…`,"palette.noMatches":`no matching commands`,"palette.navigate":`↑↓ navigate`,"palette.run":`↵ run`,"palette.close":`esc close`,"palette.view":`View`,"palette.action":`Action`,"palette.project":`Project`,"palette.newDaemon":`New session`,"palette.openTranscript":`Open Transcript`,"palette.openProject":`Open Project`,"palette.projectHint":`work · memory · agents`,"palette.openOperations":`Open Operations`,"palette.operationsHint":`session controls`,"palette.hideReasoning":`Hide reasoning`,"palette.showReasoning":`Show reasoning`,"palette.exitKiosk":`Exit kiosk mode`,"palette.enterKiosk":`Enter kiosk mode`,"palette.messageArgus":`Message Argus…`,"palette.stopWaiting":`Stop Manager reply`,"palette.stopContinuous":`Stop continuous campaign`,"palette.startContinuous":`Start continuous campaign`,"palette.stopDaemon":`Pause Argus`,"palette.startDaemon":`Run Argus`,"slash.suggestions":`Slash command suggestions`,"mission.roleActive":`{role} active`,"mission.overview":`mission overview`,"mission.operations":`Operations`,"role.manager":`Manager`,"role.manager.description":`Understands your goal and coordinates work`,"role.planner":`Planner`,"role.planner.description":`Breaks down the problem, schedules work, and revises the plan`,"role.engineer":`Engineer`,"role.engineer.description":`Researches, writes proofs or code, and uses tools to check the work`,"role.reviewer":`Reviewer`,"role.reviewer.description":`Checks results and evidence and identifies gaps`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`You`,"doctor.title":`Doctor`,"doctor.subtitle":`Argus status checks + recommended root-cause fix`,"doctor.recommended":`recommended fix`,"doctor.loadError":`Couldn’t load diagnostics.`,"doctor.empty":`No diagnostic data available`,"doctor.daemonLog":`Daemon log`,"settings.subtitle":`effective roles, budgets, and essential controls`,"settings.loadError":`Couldn’t load configuration.`,"settings.empty":`No configuration found`,"settings.quickConfig":`Quick Config`,"settings.appearance":`Appearance`,"settings.appearanceHint":`Choose the interface colour treatment. Logos and icons always remain monochrome.`,"settings.themeStyle":`Theme colour`,"settings.themeStyle.standard":`Standard`,"settings.themeStyle.standardHint":`Quiet black, white, grey, and blue.`,"settings.themeStyle.gradient":`Gradient`,"settings.themeStyle.gradientHint":`The classic Argus blue-to-gold background.`,"settings.backend":`Backend`,"settings.backendSource.env":`set by the server environment`,"settings.backendSource.persisted":`saved setting`,"settings.backendSource.default":`built-in default`,"settings.backendWillSave":`Apply saves {backend}.`,"settings.backendWillReplace":`Apply replaces the saved {saved} with {backend}.`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`Backend saved as {backend}. Restart Argus to apply.`,"settings.backendUnsupported":`Unsupported backend ({backend})`,"settings.backendUnavailable":`Backend unavailable`,"settings.model":`Model`,"settings.trialAccount":`Trial account`,"settings.trialKeyHint":`Replace your Key here when its allowance runs out. Your projects and conversations stay in place.`,"settings.changeTrialKey":`Change Key`,"settings.applyModel":`Apply`,"settings.modelPlaceholder":`auto (backend default)`,"settings.connection":`Connection`,"settings.webApi":`Web + REST API`,"settings.eventStream":`Live updates`,"settings.taskDaemon":`Background work`,"settings.taskDaemonValue":`Local process · events.jsonl · no TCP port`,"chat.messageTooLong":`Message exceeds 32,000 characters. Shorten it or upload a file. Your draft is preserved.`,"settings.required":`{field} is required`,"settings.advanced":`Advanced`,"settings.advancedHint":`Budgets, the advisor model, explanation effort, connection details and raw configuration`,"settings.mapModel":`Map`,"settings.mapModelFollows":`Follows the front-door model`,"settings.mapModelSet":`Map explanations now use {model}.`,"settings.overrideTitle":`Environment override`,"settings.overrideHint":`Set a specific config alias or environment-variable key.`,"settings.namePlaceholder":`name or alias, e.g. manager_model`,"settings.valuePlaceholder":`value`,"settings.applyAdvanced":`Apply environment override`,"settings.applied":`Applied. Restart affected sessions to use the new settings.`,"settings.modelAppliedToRoles":`Every role now uses {model}. Sessions already running keep their model until they restart.`,"settings.rolesRunning":`Roles now run:`,"settings.applyUnifies":`Apply sets all of them to the model above.`,"settings.rolesTitle":`Effective roles`,"settings.rawConfig":`Raw configuration`,"settings.group.limits":`Limits`,"settings.group.safety":`Safety`,"settings.group.interface":`Interface`,"settings.knob.activeDaemons":`Active session limit`,"settings.knob.activeDaemonsDoc":`Maximum background sessions running on this host.`,"settings.knob.safeMode":`Safe mode`,"settings.knob.safeModeDoc":`Enable extra-conservative runtime guardrails.`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`Enable the Telegram notification bridge.`,"settings.knob.showReasoning":`Show reasoning`,"settings.knob.showReasoningDoc":`Stream role reasoning into the activity view.`,"settings.knob.operatorAvailable":`Operator available`,"settings.knob.operatorAvailableDoc":`Off suppresses operator questions: Argus decides on recorded assumptions and blocks on operator-only actions.`,"noOperator.banner":`No-operator mode: questions suppressed. Argus decides on recorded assumptions instead of asking you.`,"noOperator.turnOff":`Ask me again`,"settings.source.notApplicable":`Not applicable for this model`,"settings.source.vaultDefault":`Capability vault / default`,"settings.source.default":`Default`,"settings.modelUnavailable":`unavailable`,"settings.modelOfflineList":`Offline list: the backend did not return its live models, showing the harness catalog.`,"settings.source.saved":`Saved override`,"settings.source.environment":`Environment variable`,"settings.source.hostConfig":`Host configuration`,"settings.source.other":`Resolved configuration`,"settings.value.enabled":`Enabled`,"settings.value.disabled":`Disabled`,"settings.effort.low":`Low effort`,"settings.effort.medium":`Medium effort`,"settings.effort.high":`High effort`,"settings.effort.xhigh":`Extra-high effort`,"settings.role.curator":`Curator`,"settings.role.curatorDoc":`Maintains and distills the reusable skill pool.`,"settings.footer":`Human-readable labels are shown with raw keys. The full registry remains available via`,"identity.title":`Identity`,"identity.subtitle":`who argus is working for on this project`,"identity.placeholder":`Describe who Argus is working for and durable preferences…`,"identity.save":`Save identity`,"identity.saved":`Identity saved.`,"transcript.title":`Transcript`,"transcript.subtitle":`recent operator ↔ argus turns · reply from the composer`,"transcript.empty":`no conversation turns yet`,"transcript.operator":`operator`,"new.createDaemon":`Create session`,"new.createdIdle":`New session ready. Say what it is for and the work begins.`,"new.createdStarting":`New session ready; the work is starting in the background.`,"new.subtitle":`Creates an isolated timeline and Manager context.`,"new.close":`close create session`,"new.name":`Name`,"new.optional":`(optional)`,"new.namePlaceholder":`e.g. AAAI embodiment paper`,"new.workdir":`Output workdir`,"new.workdirHint":`Agents write code, papers, reports, and experiment outputs here. Internal memory stays under the session state directory.`,"new.objective":`Objective`,"new.objectivePlaceholder":`Leave blank to start with a conversation, or describe a campaign to start immediately.`,"new.startsAfterCreate":`Campaign starts after session creation`,"new.idleUntilMessage":`Idle until the first message`,"new.startsHint":`The session opens immediately while Argus prepares the work in the background.`,"new.idleHint":`Background work starts after your first message, when needed.`,"new.shortcut":`Ctrl/⌘+Enter to create`,"new.creating":`Creating…`,"new.createAndStart":`Create and start`,"manage.daemon":`Manage session`,"manage.displayName":`Display name`,"manage.executor":`Background work`,"manage.running":`Running`,"manage.runningExternally":`Running externally`,"manage.paused":`Stopped`,"manage.pauseHint":`Interrupt the current operation and keep progress resumable.`,"manage.stopNow":`Stop now`,"manage.stopNowHint":`Immediately interrupt this verified daemon so the session can be deleted.`,"manage.externalHint":`This session is managed outside this app.`,"manage.resumeHint":`Resume queued research work.`,"manage.working":`Working…`,"manage.resume":`Resume`,"manage.deleteSession":`Delete session`,"manage.deleteHint":`Deleted sessions move to the trash and remain recoverable. Stop background work first.`,"manage.delete":`Delete…`,"manage.confirmQuestion":`Move this session to trash?`,"manage.confirmDelete":`Confirm delete`,"decision.operator":`Operator decision`,"decision.required":`Decision required`,"decision.whyBlocked":`Recorded reason this task needs input`,"decision.currentTask":`Current task`,"decision.taskName":`Task: {title}`,"decision.otherTask":`Another task awaiting input`,"decision.awaitingReply":`Awaiting your reply`,"decision.askedAt":`Asked {time}`,"decision.evidence":`Evidence`,"decision.notePlaceholder":`Add the guidance the Manager should apply…`,"decision.resumeHint":`Your answer applies to this task. The Manager checks its next step.`,"decision.later":`Later`,"decision.applying":`Submitted; Argus is starting on it…`,"decision.closeContinue":`Close, keep working`,"decision.stopCampaign":`Stop campaign`,"decision.useOption":`Use this option`,"decision.sendAnswer":`Send answer`,"decision.noteRequired":`Add the required details before sending this choice.`,"artifact.preview":`Result preview`,"artifact.title":`Result`,"artifact.approvedEvidence":`evidence the Reviewer has checked`,"artifact.downloading":`Downloading…`,"artifact.download":`Download`,"artifact.open":`Open`,"artifact.close":`close result preview`,"artifact.unavailable":`preview unavailable`,"artifact.empty":`(empty file)`,"artifact.truncated":`preview truncated · download to inspect the complete file`,"artifact.htmlTooLarge":`HTML preview is too large to render safely. Download the complete file.`,"artifact.pdfDisabled":`Inline PDF preview is disabled by this browser.`,"artifact.openPdf":`Open PDF`,"artifact.noPreview":`This file type has no safe inline preview.`,"artifact.downloadHint":`Download it to inspect with a local application.`,"task.details":`Task details`,"task.stopLoop":`stop loop`,"task.done":`done`,"task.skip":`skip`,"task.close":`close task details`,"task.waitingOnYou":`Waiting on you`,"task.objective":`Objective`,"task.noObjective":`(no objective recorded)`,"task.untitled":`Untitled task`,"task.priority":`priority`,"task.started":`started`,"task.finished":`finished`,"task.outcome":`Outcome`,"task.iteration":`Iteration`,"task.mode":`mode`,"task.autoIterate":`auto-iterate`,"task.singlePass":`single pass`,"task.cycles":`cycles`,"task.cost":`cost`,"task.lastError":`Last error`,"task.notes":`Notes`,"task.dependsOn":`depends on`,"task.dependsOnCount":`Depends on {count} earlier tasks`,"pending.reviewRespond":`Review and respond`,"pending.showOnMap":`Show on map`,"backlog.active":`Active · {count}`,"backlog.history":`History · {count}`,"backlog.noHistory":`No completed work yet`,"backlog.empty":`Nothing queued. Argus is ready for new work.`,"backlog.viewDetails":`View full task details`,"backlog.iterating":`Repeating`,"backlog.stopIterating":`Stop repeating`,"backlog.stop":`Stop`,"backlog.markDone":`Mark done`,"backlog.remove":`Remove`,"mission.achievement":`Argus achievement`,"mission.elapsed":`Elapsed`,"mission.rejectedAttempts":`{count} rejected attempts`,"mission.skillsLearned":`{count} skills learned`,"mission.artifacts":`{count} files produced`,"mission.waiting":`Waiting for a mission`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`Ready when you are — assign a mission to begin.`,"mission.statusDone":`This task: {outcome} — finished in {elapsed}.`,"mission.nextAfterReply":`Reply to this task’s question first, then decide its next step.`,"mission.continuousDone":`Continuous run finished`,"mission.resumeContinuous":`Resume`,"mission.control":`Mission control`,"mission.attentionHealth":`System error — health is degraded.`,"mission.attentionFailed":`Mission failed — check the task below.`,"mission.deliveryFailed":`Task failed at delivery — execution could not start or finish.`,"mission.attentionStepFailed":`A step failed — check the task below.`,"mission.attentionPaused":`Mission is paused — waiting for your input.`,"mission.showObjective":`Show full objective`,"mission.showFullOutput":`View full output`,"mission.stage":`Stage`,"mission.campaign":`Campaign`,"mission.totalElapsed":`Total elapsed`,"mission.round":`Round`,"mission.mode":`Mode`,"mission.summary":`Mission summary`,"mission.deliveryCertified":`Delivery approved`,"mission.taskCompleted":`Task completed`,"mission.openResult":`Open result`,"mission.viewTask":`View task`,"mission.taskPlan":`Task plan`,"mission.team":`Team`,"mission.waitingShort":`Waiting`,"mission.roleWork":`Role work`,"mission.showMore":`Show more`,"mission.showLess":`Show less`,"mission.done":`Done`,"mission.inProgress":`In progress`,"mission.failed":`Failed`,"mission.bannerPaused":`Mission is paused — waiting for your input.`,"mission.bannerError":`System error — health is degraded.`,"mission.bannerStepFailed":`A step failed: {step}`,"mission.elapsedAgo":`{elapsed} ago`,"mission.filteredBy":`filtered by {task} · clear`,"mission.allVisible":`all visible missions`,"mission.roundNumber":`round {count}`,"mission.noRoleWork":`No persisted {role} work for this selection yet.`,"mission.researchDag":`Task route`,"mission.active":`active`,"mission.noDag":`The Planner has not added tasks to the route yet.`,"mission.workingHypothesis":`Working hypothesis · can be revised`,"mission.goalContribution":`How this supports the goal`,"mission.temporaryRegressions":`Expected temporary tradeoffs`,"mission.decisionRule":`When to revise, split, or stop`,"mission.acceptance":`What counts as done`,"mission.nonGoals":`Non-goals`,"mission.capabilities":`Capabilities`,"mission.capabilitiesUnlocked":`Capabilities unlocked`,"mission.learnedCapability":`Learned capability`,"mission.learnedDuring":`Learned during {mission}`,"mission.skillUnavailable":`Skill content is not available in this snapshot.`,"mission.contentTruncated":`Content preview truncated`,"mission.knowledgeRetained":`Knowledge retained`,"mission.selfEvolution":`Saved project knowledge`,"mission.knowledgeSaved":`Argus saved these capabilities and notes for future work on this project.`,"mission.noCapabilities":`No capabilities learned yet.`,"mission.replay":`Mission replay`,"mission.replayTimeline":`Replay mission timeline`,"mission.roleFailed":`{role} failed`,"mission.showingLatestEvent":`Showing latest event`,"mission.showingLastEvents":`Showing last {count} events`,"mission.waitingEvents":`Waiting for structured research events.`,"mission.startsAfter":`Starts after {count} earlier tasks`,"mission.hiddenTasks":`{count} earlier tasks hidden · {failed} blocked or failed · {skipped} skipped`,"mission.projectFilesChanged":`Project files changed`,"mission.reviewInIde":`Open the IDE to review the diff`,"research.currentWork":`Current work`,"research.dagProgress":`Task route progress`,"research.verifiedOutputs":`Verified outputs`,"research.recentMilestones":`Recent milestones`,"research.liveProgress":`Task progress`,"research.artifact":`Research result`,"research.canvas":`Manager live research canvas`,"research.previewArtifact":`Preview the result`,"research.openLarge":`Open large preview`,"research.collapse":`Collapse preview`,"research.unavailable":`Manager live view is temporarily unavailable.`,"research.noPreview":`No preview`,"research.waiting":`Waiting…`,"research.updating":`Updating…`,"research.fileUnavailable":`This file is ready to download using the button above.`,"research.eventSourced":`event-sourced mission state`,"research.downloadFailed":`download failed`,"operations.title":`Operations`,"operations.work":`Work`,"operations.runtime":`Runtime`,"operations.system":`System`,"operations.recovery":`Recovery`,"operations.workInput":`Work input`,"operations.workHint":`Queue work, guide the active task, save a note, or preview a plan without dispatching it.`,"operations.action.task":`Task`,"operations.action.nudge":`Guide`,"operations.action.note":`Note`,"operations.action.plan":`Plan`,"operations.planPlaceholder":`Objective to preview; preview never queues work`,"operations.actionPlaceholder":`{action} text`,"operations.previewPlan":`Preview plan`,"operations.submitAction":`Submit {action}`,"operations.runtimeHint":`Change where this session runs, reset Manager context, or safely restart the session.`,"operations.workdir":`Working directory`,"operations.workdirUpdated":`Working directory updated.`,"operations.applyWorkdir":`Apply working directory`,"operations.replaceSlot":`Replace an active session`,"operations.sourceUpdate":`Argus source version`,"operations.pullLatest":`Pull latest version`,"operations.updateChecking":`Checking published branch…`,"operations.updateRunning":`Updating…`,"operations.updateAvailable":`Update available`,"operations.updateCurrent":`Up to date`,"operations.updateUnavailable":`This checkout cannot be updated safely.`,"operations.currentRevision":`Current`,"operations.latestRevision":`Latest`,"operations.updatePhase":`Phase`,"operations.updateRestart":`Source updated. Restart the cockpit, then use the reload button to move active daemons to the new release at a safe task boundary.`,"operations.skills":`Skills`,"operations.runSkill":`Run skill command`,"operations.metrics":`System metrics`,"operations.trash":`Recoverable trash`,"operations.searchTrash":`Search trash`,"operations.trashEmpty":`Trash is empty.`,"resource.title":`Resources`,"resource.loading":`Loading resource status…`,"resource.devices":`Devices: {count}`,"resource.inUse":`In use · {count}`,"resource.queue":`Queue · {count}`,"resource.none":`None`,"resource.timeLeft":`{ttl} left`,"resource.noIntent":`No purpose recorded`,"resource.yieldRequest":`Resource release requested · {reason}`,"resource.queuePosition":`Queue position {position}`,"label.status.inProgress":`In progress`,"label.status.waiting":`Waiting`,"label.status.completed":`Completed`,"label.status.blocked":`Blocked`,"label.status.failed":`Failed`,"label.status.needsChanges":`Needs changes`,"label.status.skipped":`Skipped`,"label.status.paused":`Paused`,"label.status.cancelled":`Cancelled`,"label.status.available":`Available`,"label.status.unavailable":`Unavailable`,"label.status.inaccessible":`Not accessible`,"label.status.limited":`Limited`,"label.status.healthy":`Healthy`,"label.status.updated":`Status updated`,"label.role.argus":`Argus`,"label.role.you":`You`,"label.work.task":`Task`,"label.work.action":`Work step`,"label.work.handoff":`Notes for the next step`,"label.work.review":`Review`,"label.work.planning":`Planning`,"label.work.update":`Update`,"label.stage.scope":`Scope`,"label.stage.research":`Research`,"label.stage.implementation":`Implementation`,"label.stage.experiment":`Experiments`,"label.stage.analysis":`Analysis`,"label.stage.writing":`Writing`,"label.stage.review":`Final review`,"label.stage.delivery":`Delivery`,"label.stage.unstaged":`Unstaged`,"label.frontier.reopened":`An earlier task was reopened`,"label.frontier.added":`A new task was added`,"label.frontier.completed":`A task path was completed`,"label.frontier.revised":`The task plan was revised`,"label.frontier.narrowed":`The task scope was narrowed`,"label.frontier.expanded":`The task scope was expanded`,"label.frontier.updated":`The task plan was updated`,"label.priority":`Priority {priority}`,"label.outcome.workCompleted":`Work completed`,"label.outcome.workPaused":`Work paused`,"label.outcome.workBlocked":`Work blocked`,"label.outcome.workFailed":`Work failed`,"label.outcome.workEnded":`Work ended`,"label.outcome.workIncomplete":`Work incomplete`,"label.outcome.workStalled":`Work stalled`,"label.outcome.workUpdated":`Work status updated`,"label.outcome.reviewPassed":`Review passed`,"label.outcome.reviewNeedsChanges":`Review requested changes`,"label.outcome.reviewBlocked":`Review blocked`,"label.outcome.reviewOutdated":`Review is out of date`,"label.outcome.reviewPending":`Review pending`,"label.outcome.stageApproved":`Stage approved`,"label.outcome.stageNotApproved":`Stage not approved`,"label.outcome.stageRevoked":`Stage approval revoked`,"label.outcome.stageNotNeeded":`Stage decision not needed`,"label.outcome.stagePending":`Stage decision pending`,"label.outcome.budgetPaused":`Paused by budget limit`,"label.outcome.costUnreconciled":`Awaiting provider usage reconciliation`,"label.outcome.waitingForYou":`Waiting for your response`,"label.outcome.stoppedByYou":`Stopped by you`,"label.outcome.pausedByYou":`Paused by you`,"label.outcome.sessionPaused":`Session paused`,"label.outcome.serviceUnavailable":`Service unavailable`,"label.outcome.serviceCoolingDown":`Service temporarily paused`,"label.outcome.temporaryIssue":`Paused by a temporary issue`,"label.outcome.serviceError":`Stopped by a service error`,"label.outcome.needsPlan":`A new plan is needed`,"label.outcome.canResume":`Can resume`,"label.routing.team":`Team workflow`,"label.routing.individual":`Individual workflow`,"label.routing.research":`Research`,"label.routing.software":`Software work`,"label.routing.staged":`Step by step`,"label.routing.flexible":`Flexible workflow`,"label.routing.ongoing":`Ongoing`,"label.routing.defined":`Defined scope`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`Accelerator`,"label.resource.enforced":`Limits enforced`,"label.resource.advisory":`Recommendations only`,"label.resource.released":`Resources released`,"label.resource.kept":`Resources kept`,"mission.lastProgress":`Progress recorded before the stop`,"mission.nextResume":`The progress is saved. Run Argus again and it continues from where it stopped.`,"mission.nextResumeLive":`Argus will continue from the saved progress.`,"research.totalTime":`Total time`,"research.optionDelivery":`Delivery`,"research.optionCheckpoint":`Checkpoint`,"research.optionPending":`being written`,"operations.unavailableHere":`This is not available on this Argus.`,"operations.requestFailed":`That did not go through.`,"operations.technicalDetails":`Technical details`,"verticals.title":`Vertical Store`,"verticals.entry":`Verticals`,"verticals.openStore":`Open Vertical Store`,"verticals.paletteHint":`install · enable · update`,"verticals.intro":`A vertical gives Argus a research domain: its stages, roles, skills and checks. Install what your projects need and enable it per workspace.`,"verticals.hostedNote":`Verticals are provided by the host; you can enable or disable them for your workspace.`,"verticals.close":`Close vertical store`,"verticals.search":`Search verticals`,"verticals.searchPlaceholder":`Search by name, purpose or tag…`,"verticals.refreshCatalog":`Refresh catalog`,"verticals.refreshing":`Refreshing…`,"verticals.catalogSource":`Catalog: {source}`,"verticals.catalogRelease":`Release {tag}`,"verticals.catalogFetched":`Fetched {time}`,"verticals.catalogNever":`Catalog not fetched yet`,"verticals.catalogError":`The catalog could not be refreshed: {error}`,"verticals.kindFilter":`Filter by kind`,"verticals.tagFilter":`Filter by tag`,"verticals.clearFilters":`Clear filters`,"verticals.count":`{shown} of {total}`,"verticals.filter.all":`All`,"verticals.routingPath":`Category / domain / specialty`,"verticals.filter.installed":`Installed`,"verticals.filter.available":`Available`,"verticals.filter.builtin":`Built-in`,"verticals.kind.builtin":`Built-in`,"verticals.kind.package":`Bundled`,"verticals.kind.installed":`Installed`,"verticals.kind.available":`Available`,"verticals.enabled":`Enabled`,"verticals.disabledState":`Disabled`,"verticals.updateAvailable":`Update available`,"verticals.updateTo":`Update to {version}`,"verticals.installedVersion":`Installed {version}`,"verticals.catalogVersion":`Catalog {version}`,"verticals.requires":`Requires`,"verticals.shared":`Shares resources with`,"verticals.size":`Size`,"verticals.jumpTo":`Go to {name}`,"verticals.missingPython":`Needs: {packages} — install them into the Python environment Argus runs from.`,"verticals.runtimeIssues":`Installed version is incompatible with this Argus runtime: {issues}`,"verticals.installIssues":`Catalog installation/update is blocked by runtime requirements: {issues}`,"verticals.usedByOne":`Used by 1 project`,"verticals.usedBy":`Used by {count} projects`,"verticals.action.install":`Install`,"verticals.action.update":`Update`,"verticals.action.enable":`Enable`,"verticals.action.disable":`Disable`,"verticals.action.uninstall":`Uninstall`,"verticals.confirmUninstall":`Confirm uninstall`,"verticals.confirmUninstallHint":`Removes {name} from this Argus.`,"verticals.removeAnyway":`Remove anyway`,"verticals.operation.install":`Installing…`,"verticals.operation.update":`Updating…`,"verticals.operation.enable":`Enabling…`,"verticals.operation.disable":`Disabling…`,"verticals.operation.uninstall":`Uninstalling…`,"verticals.operationRunning":`Working…`,"verticals.operationFailed":`{action} failed`,"verticals.loading":`Loading verticals…`,"verticals.noMatches":`No verticals match these filters.`,"verticals.none":`No verticals are listed yet.`,"verticals.loadFailed":`Could not read the vertical list.`,"verticals.actionFailed":`That did not go through.`,"verticals.tooOld":`This Argus backend predates the vertical store. Update Argus, then reopen this page to manage verticals.`},Ct={"language.english":`English`,"handshake.connecting":`正在准备 Argus`,"handshake.service":`服务`,"handshake.project":`项目`,"handshake.ready":`就绪`,"handshake.title":`正在准备 Argus`,"handshake.detail":`正在恢复你的工作区…`,"splash.starting":`Argus 启动中`,"rail.workbench":`工作台`,"rail.sessionsShortcut":`会话 · Ctrl/⌘ P`,"panel.backlog":`待办`,"panel.activity":`对话与进展`,"panel.journal":`日志`,"panel.roles":`角色`,"panel.project":`项目`,"panel.liveView":`Manager 实时项目视图`,"stream.jumpToLatest":`跳到最新`,"stream.toggleReasoning":`显示或隐藏 Agent 推理(⌘T)`,"stream.reasoning":`推理`,"stream.noLogs":`暂无活动`,"stream.system":`Argus 动态`,"stream.autonomous":`后台活动`,"stream.backgroundWork":`Argus 正在后台工作`,"stream.ready":`Argus 已就绪。你可以提问或安排下一项工作。`,"stream.historyLoading":`正在读取对话记录…`,"stream.historyError":`对话记录暂时读取失败。`,"stream.historyRetry":`重试`,"stream.fold.read":`读取了 {count} 个文件`,"stream.fold.search":`搜索了 {count} 次`,"stream.fold.fetch":`查阅了 {count} 个网页`,"stream.fold.edit":`修改了 {count} 个文件`,"stream.fold.tool":`使用了 {count} 次 {tool}`,"stream.fold.failed":`{count} 次失败`,"stream.fold.expand":`展开每一步`,"stream.fold.collapse":`收起`,"stream.repeated":`重复了 {count} 次,显示最近一次`,"stream.stepFailed":`失败`,"stream.stepResult":`结果`,"common.showRaw":`显示原始输出`,"doctor.lastEntry":`最近一条`,"operations.metric.calls":`今日模型调用`,"operations.metric.failed":`失败`,"operations.metric.slowest":`最慢的常规调用`,"operations.slo.healthy":`正常`,"operations.slo.degraded":`需要留意`,"operations.slo.loading":`加载中…`,"operations.validationFailures":`今日 {count} 条格式异常的事件`,"operations.outputLines":`共 {count} 行输出`,"operations.done":`已完成。`,"newDaemon.workdirPlaceholder":`留空 → ~/.argus-skill/workspaces/`,"operations.resetManager":`重新开始理解这段对话`,"language.chinese":`中文`,"language.switchTo":`切换到{language}`,"common.loading":`加载中…`,"common.retry":`重试`,"common.save":`保存`,"common.cancel":`取消`,"common.close":`关闭`,"common.settings":`设置`,"common.ready":`就绪`,"common.live":`实时`,"common.reconnecting":`正在重连`,"common.stale":`快照已过期`,"common.degraded":`快照异常`,"common.external":`外部`,"common.pause":`暂停`,"common.run":`运行`,"common.working":`处理中`,"common.local":`本地`,"common.all":`全部`,"common.unassigned":`未分配`,"common.closeSessions":`关闭会话列表`,"common.resizeSessions":`调整会话列表宽度`,"common.resizePreview":`调整预览区域宽度`,"common.expandPreview":`展开预览`,"time.justNow":`刚刚`,"time.minutesAgo":`{count}分钟前`,"time.hoursAgo":`{count}小时前`,"time.yesterdayAt":`昨天 {time}`,"connection.pairingTitle":`此浏览器尚未与 Argus 配对`,"connection.pairingDetail":`请打开这个站点的有效配对链接,或在下方粘贴配对链接或令牌。`,"connection.pairAgain":`重新配对`,"connection.pairingInput":`配对链接或令牌`,"connection.pairingPlaceholder":`粘贴新的配对链接或令牌`,"connection.pairingInvalid":`请输入有效的配对链接或令牌。`,"connection.connect":`连接`,"connection.unreachableTitle":`Argus 本地服务当前不可达`,"connection.unreachableDetail":`请保持 Argus Desktop 运行,等待本地服务就绪后再重试。`,"sidebar.collapse":`收起会话`,"sidebar.expand":`展开会话`,"sidebar.create":`创建项目`,"sidebar.find":`查找项目`,"sidebar.clearSearch":`清除搜索`,"sidebar.refreshFailed":`刷新失败 · 重试`,"sidebar.noSessions":`暂无会话`,"sidebar.noMatches":`没有匹配"{query}"的会话`,"sidebar.unnamedSession":`未命名会话`,"sidebar.daemonAlive":`Argus 后台在线`,"sidebar.updateRequired":`需要更新`,"sidebar.updateAvailable":`可更新`,"sidebar.updateAvailableHint":`后台仍在运行,执行器与网页版本不同。`,"sidebar.stopped":`后台已停止`,"sidebar.runningFor":`后台在线 · {uptime}`,"sidebar.lastActive":`上次活动 {time}`,"sidebar.manage":`管理 {name}`,"sidebar.manageHint":`重命名、暂停或删除`,"sidebar.resume":`继续`,"sidebar.resumeHint":`在 {workdir} 中继续工作`,"sidebar.resumeSuccess":`会话已恢复。`,"sidebar.resumeFailed":`无法恢复会话:{error}`,"sidebar.modelLoading":`正在加载后端和模型…`,"sidebar.modelUnavailable":`后端和模型信息不可用`,"sidebar.defaultModel":`默认模型`,"sidebar.openSettings":`打开设置`,"sidebar.compute":`算力队列与账户额度`,"sidebar.theme":`{current}主题;切换到{next}主题`,"landing.selectOrCreate":`从侧边栏选择一个会话,或创建新会话。`,"landing.noSessions":`还没有会话。创建一个即可开始。`,"landing.select":`选择项目`,"landing.new":`新建项目`,"landing.menu":`打开菜单`,"project.missingSwitched":`找不到项目“{requested}”,已切换到 {fallback}。`,"project.missingCreate":`找不到项目“{requested}”,请新建一个项目继续。`,"topbar.openSessions":`打开项目列表`,"topbar.externallyManaged":`由外部管理`,"topbar.pauseDaemon":`暂停 Argus`,"topbar.runDaemon":`运行 Argus`,"topbar.working":`Argus 正在处理你的请求`,"topbar.roleActive":`{role} 活跃中`,"topbar.roleIdle":`{role} 空闲`,"topbar.externalDaemonHint":`Argus 由此应用之外的服务管理,请前往相应位置控制。`,"topbar.manageSession":`管理会话`,"topbar.showPreview":`显示预览`,"topbar.showActivity":`显示动态`,"mobile.views":`视图`,"mobile.sessions":`项目`,"mobile.mission":`任务`,"mobile.activity":`对话`,"mobile.workbench":`工作台`,"mobile.map":`地图`,"mobile.preview":`文件`,"chat.working":`Argus 正在处理你的消息`,"chat.workingQuiet":`Argus 正在处理你的消息 · 仍在处理中,{quiet} 秒暂无新进展`,"chat.stopWaitingHint":`按 Esc 停止回复 · 按 Enter 追加消息`,"chat.queuedWhileRunning":`已排队 · 这条回复结束后立即处理;正在运行的任务会据此调整`,"chat.attachWhileRunning":`附件要等这条回复结束后再发送`,"chat.stepsLive":`正在工作 · 已 {count} 步`,"chat.stepsDone":`过程 {count} 步 · {seconds}`,"chat.stepFailed":`失败`,"chat.stepRaw":`原始参数`,"chat.messageArgus":`向 Argus 发送消息`,"chat.selectSession":`请选择会话…`,"chat.placeholder":`提问或安排工作`,"chat.routeLabel":`消息类型`,"chat.routeHint":`仅用于本条消息。Argus 根据实际需要选择单智能体或团队,问候直接回复。`,"chat.routeTask":`任务`,"chat.routeAuto":`自动`,"chat.routeChat":`对话`,"chat.attach":`添加文件`,"chat.attachHint":`支持 PNG、JPEG、WebP、PDF、Markdown/文本、JSON、CSV · 每条消息最多 {count} 个文件,单个 {perFile},总计 {total}`,"chat.attachDrop":`拖放文件以添加附件`,"chat.attachRemove":`移除附件 {name}`,"chat.attachUnsupported":`{name} 不受支持。请使用 PNG、JPEG、WebP、PDF、Markdown/文本、JSON 或 CSV。`,"chat.attachTooLarge":`{name} 超过单文件大小限制 {size}。`,"chat.attachTooMany":`每条消息最多只能附带 {count} 个文件。`,"chat.attachTotalTooLarge":`附件总大小超过 {size} 限制。`,"chat.attachmentUploadFailed":`附件上传失败:{error}`,"chat.uploadingAttachments":`正在上传附件`,"chat.rewriteHint":`把这段话整理得更清楚。改写结果会回到输入框,由你检查后发送。`,"chat.rewriteLabel":`整理这段话`,"chat.rewriting":`正在改写`,"chat.rewrite":`改写文字`,"chat.stopWaiting":`停止回复`,"chat.stopWaitingTitle":`停止处理这条消息`,"chat.stoppingReply":`正在停止当前回复…`,"chat.stopReplyRequested":`已收到停止请求,可以发送新消息。`,"chat.replyAlreadyFinished":`这次回复已经结束。`,"chat.stopReplyFailed":`服务端未能停止这次请求:{error}`,"chat.send":`发送消息`,"copy.message":`复制`,"copy.code":`复制代码`,"copy.copied":`已复制`,"help.title":`键盘快捷键`,"help.commands":`命令`,"help.palette":`打开命令面板`,"help.sessions":`展开或收起会话`,"help.managerChat":`聚焦 Manager 对话框`,"help.rewrite":`发送前改写当前提示词`,"help.reasoning":`显示或隐藏 Agent 推理`,"help.kiosk":`切换只读展示模式`,"help.composer":`聚焦输入框`,"help.send":`发送消息`,"help.newline":`插入换行`,"help.thisHelp":`打开此帮助`,"help.escape":`关闭浮层或停止等待`,"palette.placeholder":`输入命令或搜索…`,"palette.noMatches":`没有匹配的命令`,"palette.navigate":`↑↓ 导航`,"palette.run":`↵ 执行`,"palette.close":`Esc 关闭`,"palette.view":`视图`,"palette.action":`操作`,"palette.project":`项目`,"palette.newDaemon":`新建会话`,"palette.openTranscript":`打开对话记录`,"palette.openProject":`打开项目`,"palette.projectHint":`工作 · 记忆 · Agent`,"palette.openOperations":`打开运行控制`,"palette.operationsHint":`会话控制`,"palette.hideReasoning":`隐藏推理`,"palette.showReasoning":`显示推理`,"palette.exitKiosk":`退出展示模式`,"palette.enterKiosk":`进入展示模式`,"palette.messageArgus":`向 Argus 发送消息…`,"palette.stopWaiting":`停止当前回复`,"palette.stopContinuous":`停止持续任务`,"palette.startContinuous":`启动持续任务`,"palette.stopDaemon":`暂停 Argus`,"palette.startDaemon":`运行 Argus`,"slash.suggestions":`Slash 命令建议`,"mission.roleActive":`{role} 正在工作`,"mission.overview":`任务概览`,"mission.operations":`运行控制`,"role.manager":`统筹`,"role.manager.description":`理解你的目标,协调工作`,"role.planner":`规划`,"role.planner.description":`拆解问题,安排后续工作并调整计划`,"role.engineer":`执行`,"role.engineer.description":`查资料、写证明或代码,调用工具验证`,"role.reviewer":`复核`,"role.reviewer.description":`检查结果与证据,指出缺口`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`你`,"doctor.title":`诊断`,"doctor.subtitle":`Argus 状态检查与推荐的根因修复方案`,"doctor.recommended":`推荐修复`,"doctor.loadError":`无法加载诊断数据。`,"doctor.empty":`诊断暂无数据`,"doctor.daemonLog":`后台进程日志`,"settings.subtitle":`生效中的角色、预算和关键控制项`,"settings.loadError":`无法加载配置。`,"settings.empty":`未找到配置`,"settings.quickConfig":`快速配置`,"settings.appearance":`外观`,"settings.appearanceHint":`选择界面主题色。Logo 与图标始终保持黑白,不参与渐变。`,"settings.themeStyle":`主题色`,"settings.themeStyle.standard":`标准`,"settings.themeStyle.standardHint":`克制的黑、白、灰与蓝色。`,"settings.themeStyle.gradient":`渐变`,"settings.themeStyle.gradientHint":`经典 Argus 蓝金渐变背景。`,"settings.backend":`后端`,"settings.backendSource.env":`由服务器环境设置`,"settings.backendSource.persisted":`已保存的设置`,"settings.backendSource.default":`内置默认值`,"settings.backendWillSave":`应用后保存为{backend}。`,"settings.backendWillReplace":`应用后把已保存的{saved}改为{backend}。`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`后端已保存为{backend}。重启 Argus 后生效。`,"settings.backendUnsupported":`不支持的后端({backend})`,"settings.backendUnavailable":`后端信息不可用`,"settings.model":`模型`,"settings.trialAccount":`试用账号`,"settings.trialKeyHint":`额度用完后可在这里更换 Key,项目和对话会保留。`,"settings.changeTrialKey":`更换 Key`,"settings.applyModel":`应用`,"settings.modelPlaceholder":`auto(后端默认模型)`,"settings.connection":`连接`,"settings.webApi":`Web + REST API`,"settings.eventStream":`实时动态`,"settings.taskDaemon":`后台工作`,"settings.taskDaemonValue":`本地进程 · events.jsonl · 无 TCP 端口`,"chat.messageTooLong":`消息超过 32,000 字符,请缩短或作为附件上传。草稿已保留。`,"settings.required":`必须填写{field}`,"settings.advanced":`高级设置`,"settings.advancedHint":`预算、顾问模型、讲解强度、连接详情与原始配置`,"settings.mapModel":`地图`,"settings.mapModelFollows":`跟随前台模型`,"settings.mapModelSet":`地图讲解现在用 {model}。`,"settings.overrideTitle":`环境变量覆盖`,"settings.overrideHint":`设置特定的配置别名或环境变量键。`,"settings.namePlaceholder":`名称或别名,例如 manager_model`,"settings.valuePlaceholder":`值`,"settings.applyAdvanced":`应用环境变量覆盖`,"settings.applied":`设置已应用。请重启受影响的会话以使用新设置。`,"settings.modelAppliedToRoles":`所有角色现在都用 {model}。正在运行的会话要重启后才换。`,"settings.rolesRunning":`各角色当前实际使用:`,"settings.applyUnifies":`点“应用”会把它们统一成上面的模型。`,"settings.rolesTitle":`生效中的角色`,"settings.rawConfig":`原始配置`,"settings.group.limits":`限制`,"settings.group.safety":`安全`,"settings.group.interface":`界面`,"settings.knob.activeDaemons":`活动会话上限`,"settings.knob.activeDaemonsDoc":`此主机上可同时运行的后台会话数量上限。`,"settings.knob.safeMode":`安全模式`,"settings.knob.safeModeDoc":`启用更保守的运行时保护措施。`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`启用 Telegram 通知桥接。`,"settings.knob.showReasoning":`显示推理`,"settings.knob.showReasoningDoc":`在活动视图中显示角色推理过程。`,"settings.knob.operatorAvailable":`有人值守`,"settings.knob.operatorAvailableDoc":`关闭后不再向你提问:Argus 依据记录的假设自行决定,需要你授权的操作会直接停下。`,"noOperator.banner":`无人值守模式:已停止提问。Argus 会依据记录的假设自行决定,而不是问你。`,"noOperator.turnOff":`恢复提问`,"settings.source.notApplicable":`不适用于此模型`,"settings.source.vaultDefault":`能力库 / 默认值`,"settings.source.default":`默认值`,"settings.modelUnavailable":`不可用`,"settings.modelOfflineList":`离线列表:后端没有返回实时模型列表,显示的是本地目录。`,"settings.source.saved":`已保存的覆盖值`,"settings.source.environment":`环境变量`,"settings.source.hostConfig":`主机配置`,"settings.source.other":`解析后的配置`,"settings.value.enabled":`已启用`,"settings.value.disabled":`已停用`,"settings.effort.low":`低推理强度`,"settings.effort.medium":`中等推理强度`,"settings.effort.high":`高推理强度`,"settings.effort.xhigh":`超高推理强度`,"settings.role.curator":`知识维护`,"settings.role.curatorDoc":`维护并提炼可复用技能库。`,"settings.footer":`配置项同时显示易读标签和原始键。完整配置仍可通过以下命令查看:`,"identity.title":`身份`,"identity.subtitle":`本项目中 Argus 服务的对象`,"identity.placeholder":`描述 Argus 正在为谁工作,以及需要长期遵循的偏好…`,"identity.save":`保存身份`,"identity.saved":`身份已保存。`,"transcript.title":`对话记录`,"transcript.subtitle":`近期操作者 ↔ Argus 对话 · 请从输入框继续回复`,"transcript.empty":`暂无对话记录`,"transcript.operator":`操作者`,"new.createDaemon":`创建会话`,"new.createdIdle":`新会话已就绪。说一句你想做什么,工作就开始了。`,"new.createdStarting":`新会话已就绪,工作正在后台开始。`,"new.subtitle":`在这里保存你的对话和任务进度。`,"new.close":`关闭创建会话窗口`,"new.name":`名称`,"new.optional":`(可选)`,"new.namePlaceholder":`例如:AAAI 具身智能论文`,"new.workdir":`输出工作目录`,"new.workdirHint":`Agent 会在这里写入代码、论文、报告和实验结果。内部记忆仍保存在会话状态目录中。`,"new.objective":`目标`,"new.objectivePlaceholder":`留空则从对话开始,也可以填写一个立即启动的持续任务。`,"new.startsAfterCreate":`创建会话后立即启动任务`,"new.idleUntilMessage":`收到第一条消息前保持空闲`,"new.startsHint":`会话会立即打开,Argus 将在后台准备相关工作。`,"new.idleHint":`收到第一条消息后,Argus 会按需启动后台工作。`,"new.shortcut":`按 Ctrl/⌘+Enter 创建`,"new.creating":`正在创建…`,"new.createAndStart":`创建并启动`,"manage.daemon":`管理会话`,"manage.displayName":`显示名称`,"manage.executor":`后台工作`,"manage.running":`运行中`,"manage.runningExternally":`由外部运行`,"manage.paused":`未运行`,"manage.pauseHint":`中断当前操作并保留可恢复的进度。`,"manage.stopNow":`立即停止`,"manage.stopNowHint":`立即中断这个已验证的 daemon,停止后即可删除会话。`,"manage.externalHint":`此会话由此应用之外的服务管理。`,"manage.resumeHint":`继续执行队列中的研究工作。`,"manage.working":`处理中…`,"manage.resume":`继续`,"manage.deleteSession":`删除会话`,"manage.deleteHint":`删除的会话会移入回收站,之后仍可恢复。请先停止后台工作。`,"manage.delete":`删除…`,"manage.confirmQuestion":`将此会话移入回收站?`,"manage.confirmDelete":`确认删除`,"decision.operator":`操作者决策`,"decision.required":`需要你的决策`,"decision.whyBlocked":`这项任务记录的待答原因`,"decision.currentTask":`当前任务`,"decision.taskName":`任务:{title}`,"decision.otherTask":`其他待处理任务`,"decision.awaitingReply":`等待你的回复`,"decision.askedAt":`提问于 {time}`,"decision.evidence":`证据`,"decision.notePlaceholder":`添加 Manager 应采用的指导…`,"decision.resumeHint":`回答只针对这项任务,Manager 会据此检查它的下一步。`,"decision.later":`稍后处理`,"decision.applying":`已提交,Argus 正在开始处理…`,"decision.closeContinue":`关闭,后台继续`,"decision.stopCampaign":`停止持续任务`,"decision.useOption":`使用此选项`,"decision.sendAnswer":`发送回答`,"decision.noteRequired":`这个选项需要补充说明后才能提交。`,"artifact.preview":`结果预览`,"artifact.title":`结果`,"artifact.approvedEvidence":`已经检查确认的依据`,"artifact.downloading":`正在下载…`,"artifact.download":`下载`,"artifact.open":`打开`,"artifact.close":`关闭结果预览`,"artifact.unavailable":`无法预览`,"artifact.empty":`(空文件)`,"artifact.truncated":`预览已截断 · 请下载完整文件查看`,"artifact.htmlTooLarge":`HTML 文件过大,无法安全预览。请下载完整文件。`,"artifact.pdfDisabled":`此浏览器已禁用内嵌 PDF 预览。`,"artifact.openPdf":`打开 PDF`,"artifact.noPreview":`此文件类型无法安全地在线预览。`,"artifact.downloadHint":`请下载后使用本地应用查看。`,"task.details":`任务详情`,"task.stopLoop":`停止循环`,"task.done":`完成`,"task.skip":`跳过`,"task.close":`关闭任务详情`,"task.waitingOnYou":`等待你的回复`,"task.objective":`目标`,"task.noObjective":`(未记录目标)`,"task.untitled":`未命名任务`,"task.priority":`优先级`,"task.started":`开始时间`,"task.finished":`完成时间`,"task.outcome":`结果`,"task.iteration":`迭代`,"task.mode":`模式`,"task.autoIterate":`自动迭代`,"task.singlePass":`单次执行`,"task.cycles":`轮次`,"task.cost":`成本`,"task.lastError":`最近错误`,"task.notes":`备注`,"task.dependsOn":`依赖`,"task.dependsOnCount":`依赖前置任务 {count} 项`,"pending.reviewRespond":`查看并回复`,"pending.showOnMap":`在地图上查看`,"backlog.active":`进行中 · {count}`,"backlog.history":`历史记录 · {count}`,"backlog.noHistory":`暂无已完成工作`,"backlog.empty":`队列中没有工作。Argus 已准备好接收新任务。`,"backlog.viewDetails":`查看完整任务详情`,"backlog.iterating":`重复执行中`,"backlog.stopIterating":`停止重复执行`,"backlog.stop":`停止`,"backlog.markDone":`标记为完成`,"backlog.remove":`移除`,"mission.achievement":`Argus 成果`,"mission.elapsed":`耗时`,"mission.rejectedAttempts":`{count} 次方案被拒绝`,"mission.skillsLearned":`学习了 {count} 个 Skill`,"mission.artifacts":`产出 {count} 个文件`,"mission.waiting":`等待任务`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`已准备就绪,请分配一个任务开始工作。`,"mission.statusDone":`本次任务:{outcome} — 用时 {elapsed}。`,"mission.nextAfterReply":`请先回复这项任务的问题,再决定它的下一步。`,"mission.continuousDone":`连续运行已完成`,"mission.resumeContinuous":`恢复`,"mission.control":`任务控制`,"mission.attentionHealth":`系统出错——运行状态异常。`,"mission.attentionFailed":`任务失败——请查看下方详情。`,"mission.deliveryFailed":`任务在交付阶段失败——执行未能启动或完成。`,"mission.attentionStepFailed":`有一个步骤失败——请查看下方任务。`,"mission.attentionPaused":`任务已暂停——正在等待你的输入。`,"mission.showObjective":`显示完整目标`,"mission.showFullOutput":`查看完整输出`,"mission.stage":`阶段`,"mission.campaign":`持续任务`,"mission.totalElapsed":`总耗时`,"mission.round":`轮次`,"mission.mode":`模式`,"mission.summary":`本次完成`,"mission.deliveryCertified":`交付成果已通过审核`,"mission.taskCompleted":`任务已完成`,"mission.openResult":`打开成果`,"mission.viewTask":`查看任务`,"mission.taskPlan":`任务计划`,"mission.team":`团队`,"mission.waitingShort":`等待中`,"mission.roleWork":`角色工作`,"mission.showMore":`显示更多`,"mission.showLess":`收起`,"mission.done":`已完成`,"mission.inProgress":`进行中`,"mission.failed":`失败`,"mission.bannerPaused":`任务已暂停 — 等待你的操作。`,"mission.bannerError":`系统异常 — 健康状态已降级。`,"mission.bannerStepFailed":`某步骤失败:{step}`,"mission.elapsedAgo":`{elapsed} 前`,"mission.filteredBy":`按 {task} 筛选 · 清除`,"mission.allVisible":`全部可见任务`,"mission.roundNumber":`第 {count} 轮`,"mission.noRoleWork":`当前筛选下还没有持久化的 {role} 工作记录。`,"mission.researchDag":`任务路线`,"mission.active":`进行中`,"mission.noDag":`Planner 尚未向路线中添加任务。`,"mission.workingHypothesis":`当前假设 · 可随证据调整`,"mission.goalContribution":`对目标的作用`,"mission.temporaryRegressions":`预期的暂时取舍`,"mission.decisionRule":`何时调整、拆分或停止`,"mission.acceptance":`完成的标准`,"mission.nonGoals":`非目标`,"mission.capabilities":`能力`,"mission.capabilitiesUnlocked":`已解锁能力`,"mission.learnedCapability":`已学习能力`,"mission.learnedDuring":`在“{mission}”期间学习`,"mission.skillUnavailable":`当前快照中没有此 Skill 的内容。`,"mission.contentTruncated":`内容预览已截断`,"mission.knowledgeRetained":`已保留知识`,"mission.selfEvolution":`已保存的项目知识`,"mission.knowledgeSaved":`Argus 已保存这些能力和笔记,供本项目后续工作使用。`,"mission.noCapabilities":`尚未学习新能力。`,"mission.replay":`任务回放`,"mission.replayTimeline":`回放任务时间线`,"mission.roleFailed":`{role} 执行失败`,"mission.showingLatestEvent":`显示最近一条事件`,"mission.showingLastEvents":`显示最近 {count} 条事件`,"mission.waitingEvents":`等待结构化研究事件。`,"mission.startsAfter":`需等待前置任务 {count} 项`,"mission.hiddenTasks":`已隐藏前序任务 {count} 项 · 阻塞或失败 {failed} 项 · 已跳过 {skipped} 项`,"mission.projectFilesChanged":`项目文件有变更`,"mission.reviewInIde":`可打开 IDE 查看差异`,"research.currentWork":`当前工作`,"research.dagProgress":`任务路线进度`,"research.verifiedOutputs":`已验证输出`,"research.recentMilestones":`近期里程碑`,"research.liveProgress":`任务进展`,"research.artifact":`研究成果`,"research.canvas":`Manager 实时研究面板`,"research.previewArtifact":`预览成果`,"research.openLarge":`打开大尺寸预览`,"research.collapse":`收起预览`,"research.unavailable":`Manager 实时视图暂时不可用。`,"research.noPreview":`暂无预览`,"research.waiting":`等待中…`,"research.updating":`正在更新…`,"research.fileUnavailable":`文件已就绪,可点击上方下载按钮获取。`,"research.eventSourced":`基于事件的任务状态`,"research.downloadFailed":`下载失败`,"operations.title":`运行控制`,"operations.work":`工作`,"operations.runtime":`运行时`,"operations.system":`系统`,"operations.recovery":`恢复`,"operations.workInput":`工作输入`,"operations.workHint":`加入工作、指导当前任务、保存备注,或仅预览计划而不分派。`,"operations.action.task":`任务`,"operations.action.nudge":`指导`,"operations.action.note":`备注`,"operations.action.plan":`计划`,"operations.planPlaceholder":`要预览的目标;预览不会加入任务队列`,"operations.actionPlaceholder":`输入 {action} 内容`,"operations.previewPlan":`预览计划`,"operations.submitAction":`提交 {action}`,"operations.runtimeHint":`更改会话运行位置、重置 Manager 上下文,或安全重启会话。`,"operations.workdir":`工作目录`,"operations.workdirUpdated":`工作目录已更新。`,"operations.applyWorkdir":`应用工作目录`,"operations.replaceSlot":`替换活动会话`,"operations.sourceUpdate":`Argus 源码版本`,"operations.pullLatest":`拉取最新版本`,"operations.updateChecking":`正在检查已发布分支…`,"operations.updateRunning":`正在更新…`,"operations.updateAvailable":`有可用更新`,"operations.updateCurrent":`已是最新`,"operations.updateUnavailable":`当前工作树无法安全更新。`,"operations.currentRevision":`当前`,"operations.latestRevision":`最新`,"operations.updatePhase":`阶段`,"operations.updateRestart":`源码已更新。请重启工作台,再使用重载按钮让活动 daemon 在安全任务边界切换到新版本。`,"operations.skills":`Skills`,"operations.runSkill":`运行 Skill 命令`,"operations.metrics":`系统指标`,"operations.trash":`可恢复的回收站`,"operations.searchTrash":`搜索回收站`,"operations.trashEmpty":`回收站为空。`,"resource.title":`资源`,"resource.loading":`正在加载资源状态…`,"resource.devices":`设备:{count}`,"resource.inUse":`使用中 · {count}`,"resource.queue":`等待队列 · {count}`,"resource.none":`无`,"resource.timeLeft":`剩余 {ttl}`,"resource.noIntent":`未记录用途`,"resource.yieldRequest":`收到释放资源请求 · {reason}`,"resource.queuePosition":`队列第 {position} 位`,"label.status.inProgress":`进行中`,"label.status.waiting":`等待中`,"label.status.completed":`已完成`,"label.status.blocked":`暂时无法继续`,"label.status.failed":`失败`,"label.status.needsChanges":`需要修改`,"label.status.skipped":`已跳过`,"label.status.paused":`已暂停`,"label.status.cancelled":`已取消`,"label.status.available":`可用`,"label.status.unavailable":`不可用`,"label.status.inaccessible":`无法访问`,"label.status.limited":`部分受限`,"label.status.healthy":`状态正常`,"label.status.updated":`状态已更新`,"label.role.argus":`Argus`,"label.role.you":`你`,"label.work.task":`任务`,"label.work.action":`工作步骤`,"label.work.handoff":`给下一步的说明`,"label.work.review":`审核`,"label.work.planning":`规划`,"label.work.update":`动态`,"label.stage.scope":`范围定义`,"label.stage.research":`研究`,"label.stage.implementation":`方法实现`,"label.stage.experiment":`实验验证`,"label.stage.analysis":`结果分析`,"label.stage.writing":`论文写作`,"label.stage.review":`最终审核`,"label.stage.delivery":`成果交付`,"label.stage.unstaged":`未分阶段`,"label.frontier.reopened":`已重新开启一项前序任务`,"label.frontier.added":`已添加一项新任务`,"label.frontier.completed":`这部分工作已完成`,"label.frontier.revised":`已调整任务计划`,"label.frontier.narrowed":`已缩小任务范围`,"label.frontier.expanded":`已扩大任务范围`,"label.frontier.updated":`任务计划已更新`,"label.priority":`优先级 {priority}`,"label.outcome.workCompleted":`工作已完成`,"label.outcome.workPaused":`工作已暂停`,"label.outcome.workBlocked":`工作暂时无法继续`,"label.outcome.workFailed":`工作失败`,"label.outcome.workEnded":`工作已结束`,"label.outcome.workIncomplete":`工作尚未完成`,"label.outcome.workStalled":`工作停滞`,"label.outcome.workUpdated":`工作状态已更新`,"label.outcome.reviewPassed":`结果检查通过`,"label.outcome.reviewNeedsChanges":`检查后发现需要修改`,"label.outcome.reviewBlocked":`结果检查暂时无法继续`,"label.outcome.reviewOutdated":`审核结果已过期`,"label.outcome.reviewPending":`等待审核`,"label.outcome.stageApproved":`可以进入下一步`,"label.outcome.stageNotApproved":`还不能进入下一步`,"label.outcome.stageRevoked":`阶段批准已撤回`,"label.outcome.stageNotNeeded":`无需阶段审核`,"label.outcome.stagePending":`还没确定能否进入下一步`,"label.outcome.budgetPaused":`因预算上限暂停`,"label.outcome.costUnreconciled":`调用费用待对账(并非预算耗尽)`,"label.outcome.waitingForYou":`正在等待你的回复`,"label.outcome.stoppedByYou":`已由你停止`,"label.outcome.pausedByYou":`已由你暂停`,"label.outcome.sessionPaused":`会话已暂停`,"label.outcome.serviceUnavailable":`服务暂不可用`,"label.outcome.serviceCoolingDown":`服务暂时暂停`,"label.outcome.temporaryIssue":`因临时问题暂停`,"label.outcome.serviceError":`因服务错误停止`,"label.outcome.needsPlan":`需要制定新计划`,"label.outcome.canResume":`可以继续`,"label.routing.team":`团队协作`,"label.routing.individual":`单独执行`,"label.routing.research":`研究任务`,"label.routing.software":`软件工作`,"label.routing.staged":`分步执行`,"label.routing.flexible":`灵活流程`,"label.routing.ongoing":`持续进行`,"label.routing.defined":`范围明确`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`加速设备`,"label.resource.enforced":`强制执行限制`,"label.resource.advisory":`仅提供建议`,"label.resource.released":`已释放资源`,"label.resource.kept":`继续占用资源`,"mission.lastProgress":`停下之前记录的进展`,"mission.nextResume":`进度已保存,重新运行 Argus 就会从停下的地方继续。`,"mission.nextResumeLive":`Argus 会从已保存的进度继续。`,"research.totalTime":`累计用时`,"research.optionDelivery":`交付`,"research.optionCheckpoint":`检查点`,"research.optionPending":`生成中`,"operations.unavailableHere":`这项功能在当前的 Argus 上不提供。`,"operations.requestFailed":`这次操作没有成功。`,"operations.technicalDetails":`技术细节`,"verticals.title":`垂域商店`,"verticals.entry":`垂域商店`,"verticals.openStore":`打开垂域商店`,"verticals.paletteHint":`安装 · 启用 · 更新`,"verticals.intro":`垂域为 Argus 提供一个研究领域的阶段、角色、技能与检查项。按项目需要安装,并为各工作区分别启用。`,"verticals.hostedNote":`垂域由服务方提供;你可以为自己的工作区启用或停用。`,"verticals.close":`关闭垂域商店`,"verticals.search":`搜索垂域`,"verticals.searchPlaceholder":`按名称、用途或标签搜索…`,"verticals.refreshCatalog":`刷新目录`,"verticals.refreshing":`正在刷新…`,"verticals.catalogSource":`目录来源:{source}`,"verticals.catalogRelease":`版本 {tag}`,"verticals.catalogFetched":`{time} 获取`,"verticals.catalogNever":`尚未获取目录`,"verticals.catalogError":`目录刷新失败:{error}`,"verticals.kindFilter":`按类型筛选`,"verticals.tagFilter":`按标签筛选`,"verticals.clearFilters":`清除筛选`,"verticals.count":`显示 {shown} / {total}`,"verticals.filter.all":`全部`,"verticals.routingPath":`分类 / 领域 / 专项`,"verticals.filter.installed":`已安装`,"verticals.filter.available":`可安装`,"verticals.filter.builtin":`内置`,"verticals.kind.builtin":`内置`,"verticals.kind.package":`随包提供`,"verticals.kind.installed":`已安装`,"verticals.kind.available":`可安装`,"verticals.enabled":`已启用`,"verticals.disabledState":`已停用`,"verticals.updateAvailable":`有新版本`,"verticals.updateTo":`更新至 {version}`,"verticals.installedVersion":`已安装 {version}`,"verticals.catalogVersion":`目录版本 {version}`,"verticals.requires":`依赖`,"verticals.shared":`共享资源`,"verticals.size":`大小`,"verticals.jumpTo":`查看 {name}`,"verticals.missingPython":`缺少 Python 包:{packages}。请把它们安装到运行 Argus 的那个 Python 环境里。`,"verticals.runtimeIssues":`已安装版本与当前 Argus 运行时不兼容:{issues}`,"verticals.installIssues":`目录版本的安装/更新被运行时要求阻止:{issues}`,"verticals.usedByOne":`1 个项目在用`,"verticals.usedBy":`{count} 个项目在用`,"verticals.action.install":`安装`,"verticals.action.update":`更新`,"verticals.action.enable":`启用`,"verticals.action.disable":`停用`,"verticals.action.uninstall":`卸载`,"verticals.confirmUninstall":`确认卸载`,"verticals.confirmUninstallHint":`将从这台 Argus 移除 {name}。`,"verticals.removeAnyway":`仍要移除`,"verticals.operation.install":`正在安装…`,"verticals.operation.update":`正在更新…`,"verticals.operation.enable":`正在启用…`,"verticals.operation.disable":`正在停用…`,"verticals.operation.uninstall":`正在卸载…`,"verticals.operationRunning":`处理中…`,"verticals.operationFailed":`{action}失败`,"verticals.loading":`正在读取垂域…`,"verticals.noMatches":`没有符合筛选条件的垂域。`,"verticals.none":`目前还没有可用的垂域。`,"verticals.loadFailed":`无法读取垂域列表。`,"verticals.actionFailed":`这次操作没有成功。`,"verticals.tooOld":`当前的 Argus 后端还没有垂域商店。请先更新 Argus,再打开这里管理垂域。`};function wt(){try{let e=localStorage.getItem(xt);if(e===`en`||e===`zh-CN`)return e}catch{}return navigator.language.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}function Tt(e,t={},n=wt()){let r=(n===`zh-CN`?Ct[e]:St[e])??e;return Et.has(e)&&(r=r.replace(/\bArgus\b/g,yt().name)),r.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??`{${n}}`))}var Et=new Set([`handshake.connecting`,`handshake.title`,`splash.starting`,`connection.pairingTitle`,`topbar.pauseDaemon`,`topbar.runDaemon`,`chat.messageArgus`,`palette.messageArgus`,`palette.stopDaemon`,`palette.startDaemon`,`role.system`,`label.role.argus`]),Dt=(0,x.createContext)({locale:`en`,setLocale:()=>void 0,t:(e,t)=>Tt(e,t,`en`)});function O({children:e}){let[t,n]=(0,x.useState)(wt),r=e=>{try{localStorage.setItem(xt,e)}catch{}n(e)};(0,x.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,x.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Tt(e,n,t)}),[t]);return(0,D.jsx)(Dt.Provider,{value:i,children:e})}function Ot(){return(0,x.useContext)(Dt)}var kt=class extends x.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){if(!this.state.failed)return this.props.children;let e=this.props.locale===`zh-CN`;return(0,D.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-bg p-8 text-ink`,role:`alert`,children:(0,D.jsxs)(`section`,{className:`max-w-lg rounded-xl border border-line bg-panel p-8 shadow-lg`,children:[(0,D.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-widest text-blue`,children:yt().name}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:e?`工作台暂时无法显示`:`The workspace could not be displayed`}),(0,D.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`页面资源未能正确加载。后端任务不会因此被停止;你仍可使用桌面菜单查看日志或设置。重新加载会丢弃页面中尚未发送的输入。`:`A page resource failed to load. Backend work has not been stopped. Desktop menus remain available for logs and settings. Reloading discards unsent input on this page.`}),(0,D.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,D.jsx)(`button`,{type:`button`,className:`rounded-md bg-blue px-4 py-2 text-sm text-white`,onClick:()=>window.location.reload(),children:e?`重新加载工作台`:`Reload workspace`}),(0,D.jsx)(`button`,{type:`button`,className:`rounded-md border border-line px-4 py-2 text-sm`,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`view`,`activity`),window.location.assign(e.toString())},children:e?`返回对话页面`:`Return to conversation`})]})]})})}};function At(){let e=(0,x.useSyncExternalStore)(xe,be,()=>!1),{locale:t}=Ot();if(!e)return null;let n=t===`zh-CN`;return(0,D.jsxs)(`div`,{role:`status`,className:`fixed left-1/2 top-3 z-[110] flex w-[min(92vw,42rem)] -translate-x-1/2 items-center gap-3 rounded-xl border border-blue/40 bg-panel px-4 py-3 text-sm text-ink shadow-xl`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`strong`,{children:n?`页面已更新`:`Page update available`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:n?`刷新后显示最新选项和功能。请先复制未发送的内容。`:`Refresh for the latest options and features. Copy any unsent text first.`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`shrink-0 rounded-md border border-blue/40 px-3 py-2 text-xs text-blue`,children:n?`刷新页面`:`Refresh page`})]})}var k={ADVISOR_CONSULTATION_REQUESTED:`advisor.consultation.requested`,ADVISOR_CONSULTATION_COMPLETED:`advisor.consultation.completed`,ADVISOR_CONSULTATION_FAILED:`advisor.consultation.failed`,ADVISOR_CONSULTATION_CANCELLED:`advisor.consultation.cancelled`,ADVISOR_CONSULTATION_TIMED_OUT:`advisor.consultation.timed_out`,ADVISOR_CONSULTATION_MODEL_MISMATCH:`advisor.consultation.model_mismatch`,LIFE_MANAGER_SUPERVISION_ISSUED:`life.manager.supervision.issued`,LIFE_MANAGER_SUPERVISION_APPLIED:`life.manager.supervision.applied`,LIFE_MANAGER_SUPERVISION_FAILED:`life.manager.supervision.failed`,LIFE_PEER_MESSAGE_PROCESSED:`life.peer.message.processed`,LIFE_CONFIG_PARSE_FAILED:`life.config.parse_failed`,AGENT_IO_START:`agent.io.start`,AGENT_IO_STREAM:`agent.io.stream`,AGENT_IO_COMPLETE:`agent.io.complete`,AGENT_IO_ERROR:`agent.io.error`,USAGE_RECORDED:`usage.recorded`,ACCOUNTING_JOURNAL_REPAIRED:`accounting.journal_repaired`,PROVIDER_REQUEST_STARTED:`provider.request.started`,PROVIDER_REQUEST_COMPLETED:`provider.request.completed`,PROVIDER_REQUEST_DENIED:`provider.request.denied`,CODEX_UTIL_COMPLETED:`codex.util.completed`,SKILL_COST_COMPLETED:`skill.cost.completed`,BUDGET_RESERVATION_CREATED:`budget.reservation.created`,BUDGET_RESERVATION_DENIED:`budget.reservation.denied`,BUDGET_RESERVATION_SETTLED:`budget.reservation.settled`,BUDGET_RESERVATION_RELEASED:`budget.reservation.released`,BUDGET_UNPRICED_BLOCKED:`budget.unpriced.blocked`,BUDGET_UNPRICED_ACKNOWLEDGED:`budget.unpriced.acknowledged`,LOOP_START:`loop.start`,LOOP_DONE:`loop.done`,ROUND_START:`round.start`,ROUND_MAIN_COMPLETED:`round.main.completed`,ROUND_REVIEW_STARTED:`round.review.started`,ROUND_REVIEW_DEFERRED:`round.review.deferred`,ROUND_REVIEW_COMPLETED:`round.review.completed`,ROUND_CHECKPOINT_RECORDED:`round.checkpoint.recorded`,ROUND_CHECKPOINT_FAILED:`round.checkpoint.failed`,ROUND_SECRET_REDACTED:`round.secret_redacted`,ROUND_ESCALATED:`round.escalated`,ROUND_STALL:`round.stall`,ROUND_REVIEWER_BACKEND_FAILURE:`round.reviewer_backend_failure`,ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF:`round.reviewer_backend_failure.backoff`,ROUND_BACKEND_FAILURE_BACKOFF:`round.backend_failure.backoff`,ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED:`round.backend_failure.hold_interrupted`,ROUND_WATCHDOG_RETRY:`round.watchdog.retry`,ROUND_WATCHDOG_RETRY_EXHAUSTED:`round.watchdog.retry_exhausted`,ROUND_MODEL_CONFIGURATION_ERROR:`round.model_configuration_error`,ROUND_PROVIDER_TURN_CAP_RESTART:`round.provider_turn_cap.restart`,ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART:`round.provider_turn_cap.reviewer_restart`,ROUND_ORPHAN_PROCESS_GROUP:`round.orphan_process_group`,ROUND_EXTERNAL_WORK_WAIT_STARTED:`round.external_work_wait.started`,ROUND_EXTERNAL_WORK_WAIT_COMPLETED:`round.external_work_wait.completed`,ROUND_EXTERNAL_WORK_REVIEW_REQUIRED:`round.external_work_review.required`,ROUND_EXTERNAL_WORK_REVIEW_COMPLETED:`round.external_work_review.completed`,ROLE_SESSION_TURN:`role.session.turn`,ENGINEER_PROGRESS:`engineer.progress`,ENGINEER_SKILL_MAINTENANCE_COMPLETED:`engineer.skill_maintenance.completed`,LIFE_STATUS:`life.status`,LIFE_PHASE_STARTED:`life.phase.started`,LIFE_MISSION_STARTED:`life.mission.started`,LIFE_MISSION_COMPLETED:`life.mission.completed`,LIFE_MISSION_FAILED:`life.mission.failed`,LIFE_MISSION_SKIPPED:`life.mission.skipped`,LIFE_MISSION_ORPHANED:`life.mission.orphaned`,LIFE_MISSION_REQUEUED:`life.mission.requeued`,LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED:`life.mission.provider_configuration_disabled`,LIFE_ITERATION_CONTINUED:`life.iteration.continued`,LIFE_REVIEW_WAIVED:`life.review.waived`,LIFE_POST_MISSION_STOP:`life.post_mission.stop`,LIFE_EXECUTION_HOST_BLOCKED:`life.execution_host.blocked`,LIFE_AUTH_FAILURE:`life.auth_failure`,LIFE_SUPERVISOR_ERROR:`life.supervisor.error`,LIFE_LEARNED_VERTICAL_PROMOTED:`life.learned_vertical.promoted`,LIFE_LEARNED_VERTICAL_PROMOTION_FAILED:`life.learned_vertical.promotion_failed`,LIFE_MANAGER_INTENT_STARTED:`life.manager.intent.started`,LIFE_MANAGER_INTENT_COMPLETED:`life.manager.intent.completed`,LIFE_MANAGER_INTENT_FAILED:`life.manager.intent.failed`,LIFE_MANAGER_INTENT_SUPERSEDED:`life.manager.intent.superseded`,LIFE_MANAGER_GOAL_CONTRACT_FAILED:`life.manager.goal_contract.failed`,LIFE_MANAGER_STAGE_DECISION:`life.manager.stage_decision`,LIFE_MANAGER_PLAN_CHALLENGE_DECIDED:`life.manager.plan_challenge.decided`,LIFE_MANAGER_FEEDBACK_PERSISTED:`life.manager.feedback.persisted`,LIFE_MANAGER_FEEDBACK_UNRESOLVED:`life.manager.feedback.unresolved`,LIFE_MANAGER_FEEDBACK_EXHAUSTED:`life.manager.feedback.exhausted`,LIFE_MANAGER_PROJECT_REPORT:`life.manager.project_report`,LIFE_MANAGER_PROJECT_REPORT_FAILED:`life.manager.project_report.failed`,LIFE_VERTICAL_RESOLVED:`life.vertical.resolved`,LIFE_MANAGER_BACKEND_RESOLVED:`life.manager.backend_resolved`,LIFE_PLANNER_BACKEND_RESOLVED:`life.planner.backend_resolved`,LIFE_ENGINEER_BACKEND_RESOLVED:`life.engineer.backend_resolved`,LIFE_REVIEWER_BACKEND_RESOLVED:`life.reviewer.backend_resolved`,LIFE_CURATOR_BACKEND_RESOLVED:`life.curator.backend_resolved`,LIFE_PLANNER_START:`life.planner.start`,LIFE_PLANNER_PREVIEW_SKIPPED:`life.planner.preview_skipped`,LIFE_PLANNER_NORMALIZED:`life.planner.normalized`,LIFE_PLANNER_TASK_ADDED:`life.planner.task_added`,LIFE_PLANNER_TASK_SKIPPED:`life.planner.task_skipped`,LIFE_PLANNER_VERDICT:`life.planner.verdict`,LIFE_PLANNER_WAITING:`life.planner.waiting`,LIFE_PLANNER_WAITING_WOKEN:`life.planner.waiting_woken`,LIFE_PLANNER_TERMINAL_IDLE:`life.planner.terminal_idle`,LIFE_PLANNER_VERIFICATION_PROBE:`life.planner.verification_probe`,LIFE_PLANNER_STALL_ESCALATION:`life.planner.stall_escalation`,LIFE_PLANNER_DEPENDENCY_DROPPED:`life.planner.dependency_dropped`,LIFE_PLANNER_PARALLEL_DROPPED:`life.planner.parallel_dropped`,LIFE_PLANNER_ERROR:`life.planner.error`,LIFE_PLANNER_DEFERRED:`life.planner.deferred`,LIFE_PLANNER_SUPERSEDED:`life.planner.superseded`,LIFE_PLANNER_WAIT_OVERRIDDEN:`life.planner.wait_overridden`,LIFE_PLANNER_WAITING_CONTRACT_NORMALIZED:`life.planner.waiting_contract.normalized`,LIFE_PLANNER_EXTERNAL_POLL_SUPPRESSED:`life.planner.external_poll_suppressed`,LIFE_PLANNER_VERDICT_DISCARDED:`life.planner.verdict.discarded`,LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED:`life.planner.final_submission_skipped`,LIFE_PLANNER_CONTINUATION_REQUIRED:`life.planner.continuation_required`,LIFE_PLANNER_COMPLETION_REJECTED:`life.planner.completion_rejected`,LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED:`life.planner.completion_circuit_opened`,LIFE_PLANNER_COMPLETION_CIRCUIT_HOLDING:`life.planner.completion_circuit_holding`,LIFE_PLANNER_COMPLETION_CIRCUIT_NOTIFY_FAILED:`life.planner.completion_circuit.notify_failed`,PLAN_DRAFT_START:`plan.draft.start`,PLAN_DRAFT_DONE:`plan.draft.done`,PLAN_DRAFT_FAILED:`plan.draft.failed`,LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED:`life.runtime_failure.circuit_opened`,LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED:`life.runtime_failure.circuit_blocked`,LIFE_RUNTIME_FAILURE_CANARY_PASSED:`life.runtime_failure.canary_passed`,LIFE_RUNTIME_INCIDENT_DETECTED:`life.runtime.incident.detected`,LIFE_RUNTIME_INCIDENT_RECOVERED:`life.runtime.incident.recovered`,LIFE_RUNTIME_INCIDENT_ESCALATED:`life.runtime.incident.escalated`,LIFE_PLAN_REVISION_PROPOSED:`life.plan.revision.proposed`,LIFE_PLAN_REVISION_REJECTED:`life.plan.revision.rejected`,LIFE_PLAN_REVISION_COMMITTED:`life.plan.revision.committed`,LIFE_PLAN_NODE_SUPERSEDED:`life.plan.node.superseded`,LIFE_PLAN_REVISION_ROLLED_BACK:`life.plan.revision.rolled_back`,LIFE_RESEARCH_SECOND_READING:`life.research.second_reading`,LIFE_LETTER_WRITTEN:`life.letter.written`,LIFE_BUDGET_PAUSE:`life.budget.pause`,LIFE_LIFECYCLE_BLOCK:`life.lifecycle.block`,LIFE_LIFECYCLE_TRANSITION:`life.lifecycle.transition`,LIFE_INBOX_QUEUED:`life.inbox.queued`,LIFE_INBOX_DRAINED:`life.inbox.drained`,LIFE_OPERATOR_QUESTION_PENDING:`life.operator_question.pending`,LIFE_OPERATOR_QUESTION_ANSWERED:`life.operator_question.answered`,LIFE_DAEMON_IDLE_TIMEOUT:`life.daemon.idle_timeout`,LIFE_DAEMON_READY:`life.daemon.ready`,LIFE_DAEMON_DEGRADED:`life.daemon.degraded`,PROJECT_COMPLETED:`project.completed`,PROJECT_COMPLETION_REFUSED:`project.completion_refused`,DAEMON_PARKED:`daemon.parked`,DAEMON_COMMAND_SUBMITTED:`daemon.command.submitted`,DAEMON_COMMAND_COMPLETED:`daemon.command.completed`,DAEMON_COMMAND_REJECTED:`daemon.command.rejected`,IDEA_SEARCH_STARTED:`idea.search.started`,IDEA_SEARCH_COMPLETED:`idea.search.completed`,IDEA_SEARCH_SKIPPED:`idea.search.skipped`,IDEA_PORTFOLIO_FORMED:`idea.portfolio.formed`,IDEA_PORTFOLIO_NESTED_SKIPPED:`idea.portfolio.nested_skipped`,VENUE_RESEARCH_STARTED:`venue.research.started`,VENUE_RESEARCH_COMPLETED:`venue.research.completed`,RESEARCH_ACHIEVEMENT_CERTIFIED:`research.achievement.certified`,SKILL_LIBRARY_AVAILABLE:`skill.library.available`,SKILL_CREATED:`skill.created`,SKILL_UPDATED:`skill.updated`,SKILL_ARCHIVED:`skill.archived`,SKILL_TIDIED:`skill.tidied`,SKILL_HISTORY_COMPRESSED:`skill.history.compressed`,SKILL_EVOLUTION_COMPLETED:`skill.evolution.completed`,TEAM_LEARNING_REVIEW_STARTED:`team.learning.review.started`,TEAM_LEARNING_REVIEW_SKIPPED:`team.learning.review.skipped`,TEAM_LEARNING_REVIEW_COMPLETED:`team.learning.review.completed`,TEAM_LEARNING_REVIEW_FAILED:`team.learning.review.failed`,TEAM_LEARNING_PROMOTION_QUARANTINED:`team.learning.promotion.quarantined`,SELF_LEARNING_REVIEW_STARTED:`self.learning.review.started`,SELF_LEARNING_REVIEW_COMPLETED:`self.learning.review.completed`,SELF_LEARNING_REVIEW_FAILED:`self.learning.review.failed`,DOMAIN_PROMOTION:`domain.promotion`,WIKI_INITIALIZED:`wiki.initialized`,WIKI_HOOK_WARNING:`wiki.hook.warning`,WIKI_CREATED:`wiki.created`,WIKI_UPDATED:`wiki.updated`,WIKI_RETIRED:`wiki.retired`,WIKI_PROMOTION_PROMOTED:`wiki.promotion.promoted`,WIKI_PROMOTION_DEMOTED:`wiki.promotion.demoted`,WIKI_RETIRED_COMPRESSED:`wiki.retired.compressed`,WIKI_EVOLUTION_COMPLETED:`wiki.evolution.completed`,KNOWLEDGE_LEARNED:`knowledge.learned`,KNOWLEDGE_RECALLED:`knowledge.recalled`,OPERATOR_ALERT:`operator_alert`,MANAGER_LIVE_VIEW_UPDATED:`manager.live_view.updated`,MANAGER_LIVE_VIEW_REJECTED:`manager.live_view.rejected`,MANAGER_TURN_STARTED:`manager.turn.started`,MANAGER_TURN_CANCELLED:`manager.turn.cancelled`,USER_NOTE:`user.note`,UI_OPERATOR:`ui.operator`,UI_ARGUS:`ui.argus`},jt={"loop.started":k.LOOP_START,"loop.completed":k.LOOP_DONE,"round.started":k.ROUND_START,"mission.started":k.LIFE_MISSION_STARTED,"mission.completed":k.LIFE_MISSION_COMPLETED,"mission.error":k.LIFE_MISSION_FAILED};k.ADVISOR_CONSULTATION_COMPLETED,k.ADVISOR_CONSULTATION_FAILED,k.ADVISOR_CONSULTATION_CANCELLED,k.ADVISOR_CONSULTATION_TIMED_OUT,k.ADVISOR_CONSULTATION_MODEL_MISMATCH,k.LIFE_MANAGER_SUPERVISION_APPLIED,k.LIFE_MANAGER_SUPERVISION_FAILED,k.LIFE_PEER_MESSAGE_PROCESSED,k.LIFE_CONFIG_PARSE_FAILED,k.LIFE_MANAGER_BACKEND_RESOLVED,k.LIFE_PLANNER_BACKEND_RESOLVED,k.LIFE_ENGINEER_BACKEND_RESOLVED,k.LIFE_REVIEWER_BACKEND_RESOLVED,k.LIFE_CURATOR_BACKEND_RESOLVED,k.LOOP_START,k.LOOP_DONE,k.ROUND_START,k.ROUND_MAIN_COMPLETED,k.ROUND_REVIEW_DEFERRED,k.ROUND_REVIEW_COMPLETED,k.ROUND_CHECKPOINT_RECORDED,k.ROUND_CHECKPOINT_FAILED,k.ROUND_SECRET_REDACTED,k.ROUND_ESCALATED,k.ROUND_STALL,k.ROUND_REVIEWER_BACKEND_FAILURE,k.ENGINEER_SKILL_MAINTENANCE_COMPLETED,k.SKILL_LIBRARY_AVAILABLE,k.SKILL_CREATED,k.SKILL_UPDATED,k.SKILL_ARCHIVED,k.SKILL_TIDIED,k.SKILL_HISTORY_COMPRESSED,k.SKILL_EVOLUTION_COMPLETED,k.WIKI_INITIALIZED,k.WIKI_HOOK_WARNING,k.WIKI_CREATED,k.WIKI_UPDATED,k.WIKI_RETIRED,k.WIKI_PROMOTION_PROMOTED,k.WIKI_PROMOTION_DEMOTED,k.WIKI_RETIRED_COMPRESSED,k.WIKI_EVOLUTION_COMPLETED,k.KNOWLEDGE_LEARNED,k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MANAGER_INTENT_STARTED,k.LIFE_MANAGER_INTENT_COMPLETED,k.LIFE_MANAGER_INTENT_FAILED,k.LIFE_MANAGER_STAGE_DECISION,k.LIFE_MANAGER_PLAN_CHALLENGE_DECIDED,k.LIFE_VERTICAL_RESOLVED,k.LIFE_PLANNER_START,k.LIFE_PLANNER_PREVIEW_SKIPPED,k.LIFE_PLANNER_TASK_ADDED,k.LIFE_PLANNER_TASK_SKIPPED,k.LIFE_PLANNER_DEPENDENCY_DROPPED,k.LIFE_PLANNER_PARALLEL_DROPPED,k.LIFE_PLANNER_VERDICT,k.LIFE_PLANNER_WAITING,k.LIFE_PLANNER_WAITING_WOKEN,k.LIFE_PLANNER_TERMINAL_IDLE,k.LIFE_PLANNER_VERIFICATION_PROBE,k.LIFE_PLANNER_STALL_ESCALATION,k.LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED,k.LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED,k.LIFE_RUNTIME_FAILURE_CANARY_PASSED,k.LIFE_RUNTIME_INCIDENT_DETECTED,k.LIFE_RUNTIME_INCIDENT_RECOVERED,k.LIFE_RUNTIME_INCIDENT_ESCALATED,k.LIFE_PLAN_REVISION_PROPOSED,k.LIFE_PLAN_REVISION_REJECTED,k.LIFE_PLAN_REVISION_COMMITTED,k.LIFE_PLAN_NODE_SUPERSEDED,k.LIFE_RESEARCH_SECOND_READING,k.LIFE_LETTER_WRITTEN,k.LIFE_BUDGET_PAUSE,k.BUDGET_RESERVATION_DENIED,k.BUDGET_UNPRICED_BLOCKED,k.LIFE_LIFECYCLE_BLOCK,k.LIFE_LIFECYCLE_TRANSITION,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.LIFE_INBOX_QUEUED,k.LIFE_INBOX_DRAINED,k.LIFE_DAEMON_IDLE_TIMEOUT,k.PROJECT_COMPLETED,k.PROJECT_COMPLETION_REFUSED,k.DAEMON_PARKED,k.DAEMON_COMMAND_COMPLETED,k.DAEMON_COMMAND_REJECTED,k.IDEA_SEARCH_STARTED,k.IDEA_SEARCH_COMPLETED,k.IDEA_SEARCH_SKIPPED,k.VENUE_RESEARCH_STARTED,k.VENUE_RESEARCH_COMPLETED,k.RESEARCH_ACHIEVEMENT_CERTIFIED,k.LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED,k.LIFE_ITERATION_CONTINUED,k.LIFE_REVIEW_WAIVED,k.LIFE_POST_MISSION_STOP,k.LIFE_EXECUTION_HOST_BLOCKED,k.LIFE_AUTH_FAILURE,k.LIFE_SUPERVISOR_ERROR,k.LIFE_LEARNED_VERTICAL_PROMOTED,k.LIFE_LEARNED_VERTICAL_PROMOTION_FAILED,k.LIFE_MANAGER_INTENT_SUPERSEDED,k.LIFE_MANAGER_GOAL_CONTRACT_FAILED,k.LIFE_MANAGER_FEEDBACK_PERSISTED,k.LIFE_MANAGER_FEEDBACK_EXHAUSTED,k.LIFE_MANAGER_PROJECT_REPORT_FAILED,k.LIFE_PLANNER_DEFERRED,k.LIFE_PLANNER_SUPERSEDED,k.LIFE_PLANNER_WAIT_OVERRIDDEN,k.LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED,k.LIFE_PLANNER_CONTINUATION_REQUIRED,k.LIFE_PLANNER_COMPLETION_REJECTED,k.LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED,k.PLAN_DRAFT_DONE,k.PLAN_DRAFT_FAILED,k.LIFE_PLAN_REVISION_ROLLED_BACK,k.ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED,k.ROUND_WATCHDOG_RETRY,k.ROUND_WATCHDOG_RETRY_EXHAUSTED,k.ROUND_MODEL_CONFIGURATION_ERROR,k.ROUND_PROVIDER_TURN_CAP_RESTART,k.ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART,k.ROUND_ORPHAN_PROCESS_GROUP,k.ROUND_EXTERNAL_WORK_WAIT_STARTED,k.ROUND_EXTERNAL_WORK_WAIT_COMPLETED,k.ROUND_EXTERNAL_WORK_REVIEW_REQUIRED,k.ROUND_EXTERNAL_WORK_REVIEW_COMPLETED,k.LIFE_DAEMON_DEGRADED,k.IDEA_PORTFOLIO_FORMED,k.TEAM_LEARNING_REVIEW_STARTED,k.TEAM_LEARNING_REVIEW_COMPLETED,k.TEAM_LEARNING_REVIEW_FAILED,k.TEAM_LEARNING_PROMOTION_QUARANTINED,k.DOMAIN_PROMOTION,k.MANAGER_LIVE_VIEW_UPDATED,k.MANAGER_TURN_STARTED,k.MANAGER_TURN_CANCELLED,k.USER_NOTE,k.UI_OPERATOR,k.UI_ARGUS,k.OPERATOR_ALERT,k.AGENT_IO_START,k.AGENT_IO_COMPLETE,k.AGENT_IO_ERROR,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.USAGE_RECORDED;function Mt(e){let t=String(e??``).trim();return Object.hasOwn(jt,t)?jt[t]:t}function Nt(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Nt).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Nt(t[e])}`).join(`,`)}}`}function Pt(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function Ft(e){let t=e.event_id??e.id??e.seq??e._offset,n=String(e.type??`event`);return t!=null&&t!==``?`${n}-${String(t)}`:`${n}-${String(e.ts??e.time??``)}-${Pt(Nt(e))}`}function It(e){return e.type===k.ENGINEER_PROGRESS&&e.kind===`reasoning`}function Lt(e){if(e.type!==k.ENGINEER_PROGRESS||![`assistant_message`,`agent_message`,`message`].includes(String(e.kind??``)))return!1;let t=String(e.agent_layer??e.actor??``);return String(e.text??``).trimStart().startsWith(`{`)?t===`reviewer`||t===`planner`:!1}var Rt=/^(?:[-*+]\s*)?[`*_]*(?:ARGUS_)?(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS|ROLE_DECISION)[`*_]*\s*[:=]|^(?:final\s+)?decision\s*:\s*$/i;function zt(e){return String(e??``).split(/\r?\n/).filter(e=>!Rt.test(e.trim())).join(` +`).trim()}function Bt(e){let t=String(e.fragment_mode??``);return t===`append`||t===`snapshot`?t:e.replace===!0?`snapshot`:`auto`}function Vt(e,t){let n=Math.min(e.length,t.length);for(let r=n;r>=8;--r)if(e.endsWith(t.slice(0,r)))return r;return 0}function Ht(e,t,n=`auto`){let r=(e||``).trim(),i=(t||``).trim();if(!r)return i;if(!i)return r;if(n===`snapshot`)return i;if(r.includes(i))return r;if(n===`append`)return`${r}\n${i}`;if(i.includes(r))return i;let a=Vt(r,i);return a?`${r}${i.slice(a)}`:`${r}\n${i}`}var Ut=[`all`,`attention`,`milestones`,`messages`],Wt=new Set([k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MISSION_FAILED,k.LOOP_START,k.LOOP_DONE,k.LIFE_PLANNER_VERDICT,k.LIFE_BUDGET_PAUSE,k.LIFE_LIFECYCLE_BLOCK]);function Gt(e,t,n=`all`,r=``){let i=Mt(e.canonical_type??e.type),a=String(e.kind??``);if(n===`attention`&&![`warn`,`err`].includes(String(t.tone??``))&&e.operator_alert!==!0||n===`milestones`&&!(t.rule&&!i.startsWith(`ui.`))&&!Wt.has(i)||n===`messages`&&t.tone!==`bright`&&![`assistant_message`,`agent_message`,`message`].includes(a)&&![`ui.operator`,`ui.argus`].includes(i))return!1;let o=r.trim().toLocaleLowerCase();return!o||[i,a,t.role,t.label,t.text,e.title,e.objective,e.text,e.summary,e.reason,e.error,e.status,e.action_summary,e.command,e.path,Array.isArray(e.tags)?e.tags.join(` `):e.tags].some(e=>String(e??``).toLocaleLowerCase().includes(o))}function Kt(e,t,n){e.setQueryData([`snapshot`,t],e=>e&&{...e,session:{...e.session,display_name:n}}),e.setQueryData([`projects`],e=>e&&{...e,projects:e.projects.map(e=>e.id===t?{...e,display_name:n,label:n||e.objective||e.id}:e)})}var qt=15e3,Jt=5e3,Yt=8e3,Xt=2e3,Zt=1e4,A=1e4;function Qt(e,t){return!Ke(t)&&!(t instanceof Ce)&&e<1}function $t(e){return!Ke(e)&&Jt}function en(e){return e?.projects.some(e=>e.daemon_alive)?Xt:qt}function tn(e){return e?.daemon.alive||e?.manager_requests?.some(e=>e.status===`running`)?Xt:Yt}var nn=()=>s({queryKey:[`projects`],queryFn:E.projectIndex,refetchInterval:e=>en(e.state.data)}),rn=()=>s({queryKey:[`project-costs`],queryFn:({signal:e})=>E.projectCosts(e),retry:Qt,refetchInterval:e=>$t(e.state.error),refetchIntervalInBackground:!1}),an=e=>s({queryKey:[`snapshot`,e],queryFn:({signal:t})=>E.activeSnapshot(e,t),enabled:!!e,refetchInterval:e=>tn(e.state.data)}),on=(e,t=30,n=!0)=>s({queryKey:[`journal`,e,t],queryFn:({signal:n})=>E.journal(e,t,n),enabled:!!e&&n,refetchInterval:n?8e3:!1}),sn=(e,t)=>s({queryKey:[`doctor`,e],queryFn:({signal:t})=>E.doctor(e,t),enabled:!!e&&t}),cn=(e,t)=>s({queryKey:[`config`,e],queryFn:({signal:t})=>E.config(e,t),enabled:!!e&&t}),ln=(e,t)=>s({queryKey:[`identity`,e],queryFn:({signal:t})=>E.identity(e,t),enabled:!!e&&t}),un=(e,t,n=30)=>s({queryKey:[`transcript`,e,n],queryFn:({signal:t})=>E.transcript(e,n,t),enabled:!!e&&t}),dn=(e,t=!0)=>s({queryKey:[`artifacts`,e],queryFn:({signal:t})=>E.artifacts(e,t),enabled:!!e&&t,refetchInterval:t?Zt:!1}),fn=(e,t,n=null)=>s({queryKey:[`artifact`,e,t,n],queryFn:({signal:n})=>E.artifact(e,t,n),enabled:!!e&&!!t,refetchInterval:e=>t&&/(?:^|[\\/])REVIEW\.md$/i.test(t)&&!Ke(e.state.error)?2e3:!1}),pn=(e,t=!0)=>s({queryKey:[`git-diff`,e],queryFn:({signal:t})=>E.gitDiff(e,t),enabled:!!e&&t,refetchInterval:t?A:!1}),mn=(e,t)=>s({queryKey:[`backlog-item`,e,t],queryFn:({signal:n})=>E.backlogItem(e,t,n),enabled:!!e&&!!t});function hn(e,t){let n=c(),r=e=>{n.invalidateQueries({queryKey:[`snapshot`,e]}),n.invalidateQueries({queryKey:[`status`,e]}),n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`backlog-item`,e]})},i=()=>r(e);return{addTask:h({mutationFn:t=>E.addTask(e,t),onSuccess:i}),nudge:h({mutationFn:t=>E.nudge(e,t)}),note:h({mutationFn:t=>E.note(e,t)}),startDaemon:h({mutationFn:()=>E.startDaemon(e,t),onSuccess:i}),stopDaemon:h({mutationFn:n=>E.stopDaemon(e,n,t),onSuccess:i}),forceStopDaemon:h({mutationFn:()=>E.stopDaemon(e,!1,t,!0),onSuccess:i}),updateProject:h({mutationFn:e=>E.updateProject(e.sid,e.name),onSuccess:e=>{Kt(n,e.sid,e.name),r(e.sid)}}),deleteProject:h({mutationFn:()=>E.deleteProject(e),onSuccess:async()=>{let t=e;if(t){let e=e=>e.queryKey.some(e=>e===t);await n.cancelQueries({predicate:e}),n.removeQueries({predicate:e})}await n.invalidateQueries({queryKey:[`projects`]})}}),disposeBacklog:h({mutationFn:t=>E.disposeBacklog(e,t.id,t.op),onSuccess:i}),stopBacklog:h({mutationFn:t=>E.stopBacklog(e,t),onSuccess:i}),setContinuous:h({mutationFn:t=>E.setContinuous(e,t.enabled,t.objective??``),onSuccess:i})}}var gn=2e3;function _n(e,t){if(t.kind===`reset`)return{sid:t.sid,events:[],seen:new Set};if(t.sid!==e.sid)return e;if(t.kind===`seed`){let n=new Set,r=[];[...t.events,...e.events].forEach(e=>{let t=Ft(e);n.has(t)||(n.add(t),r.push(e))});let i=r.slice(-2e3);return{sid:e.sid,events:i,seen:new Set(i.map(e=>Ft(e)))}}let n=t.kind===`push`?[t.ev]:t.events,r=null,i=null;for(let t of n){let n=i??e.seen,a=Ft(t);n.has(a)||((!r||!i)&&(r=[...e.events],i=new Set(e.seen)),i.add(a),r.push(t))}return!r||!i?e:(r.length>gn&&r.splice(0,r.length-gn).forEach(e=>i.delete(Ft(e))),{sid:e.sid,events:r,seen:i})}var vn=new Set([`manager.live_view.updated`,`round.review.completed`,`life.mission.completed`]);function yn(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=String(n.type??``);if(vn.has(r)||r===`engineer.progress`&&n.kind===`file_change`)return Ft(n)}return``}var bn=new Set([`life.operator_question.pending`,`life.operator_question.answered`,`life.planner.task_added`,`life.planner.verdict`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`round.review.completed`]);function xn(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(bn.has(String(n.type??``)))return Ft(n)}return``}function Sn(e,t=0){let[n,r]=(0,x.useState)(()=>typeof navigator>`u`||navigator.onLine!==!1);(0,x.useEffect)(()=>{let e=()=>r(navigator.onLine!==!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),e(),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]);let[i,a]=(0,x.useReducer)(_n,{sid:null,events:[],seen:new Set}),[o,s]=(0,x.useState)({sid:null,connected:!1}),c=(0,x.useRef)(e);return c.current=e,(0,x.useEffect)(()=>{if(a({kind:`reset`,sid:e}),s({sid:e,connected:!1}),!e)return;let t=!1,n=new AbortController,r=[],i,o=()=>{if(i=void 0,t||c.current!==e||r.length===0){r=[];return}let n=r;r=[],a({kind:`push-many`,sid:e,events:n})};E.events(e,120,n.signal).then(n=>{!t&&c.current===e&&a({kind:`seed`,sid:e,events:n})}).catch(()=>{});let l=ht(e,n=>{!t&&c.current===e&&(r.push(n),i===void 0&&(i=window.setTimeout(o,40)))},{replay:40,onOpen:()=>{!t&&c.current===e&&s({sid:e,connected:!0})},onClose:()=>{!t&&c.current===e&&s({sid:e,connected:!1})}});return()=>{t=!0,n.abort(),i!==void 0&&window.clearTimeout(i),r=[],l()}},[e,t]),{events:i.sid===e?i.events:[],connected:n&&o.sid===e&&o.connected}}function Cn(e,t,n){let r=!1;e.addEventListener(`vite:preloadError`,e=>{let i=e.payload,a=i instanceof Error?i.message:String(i??``);if(!/\/(?:pdf[.-]|pdfjs)[^/\s]*\.(?:m?js)(?:[?#\s]|$)/i.test(a)&&/failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed|loading chunk .+ failed|unable to preload css/i.test(a)){if(r){e.preventDefault();return}try{let e=n.storage(),t=`argus.stale-chunk-reloaded`;if(e.getItem(t)===n.buildId)return;e.setItem(t,n.buildId)}catch{return}e.preventDefault(),r=!0,t()}})}var wn=`modulepreload`,Tn=function(e,t){return new URL(e,t).href},En={},Dn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Tn(t,n),t=s(t),t in En)return;En[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:wn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},On=window.location.pathname===`/admin/data`||window.location.pathname.startsWith(`/admin/data/`),kn=(0,x.lazy)(()=>Dn(()=>import(`./App-d69nDaHg.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)),An=(0,x.lazy)(()=>Dn(()=>import(`./WorkflowWorkbench-DfyLETfa.js`),__vite__mapDeps([10,1,2,3,7,8]),import.meta.url)),jn=(0,x.lazy)(()=>Dn(()=>import(`./AdminDataApp-Bcx_5Da8.js`),__vite__mapDeps([11,1,2,3,6,4,5,12,13,8,14]),import.meta.url));Cn(window,()=>window.location.reload(),{buildId:_e,storage:()=>window.sessionStorage}),On||Re();var Mn=window.parent!==window;document.documentElement.dataset.argusEmbedded=String(Mn);var Nn=new ue({defaultOptions:{queries:{staleTime:3e3,retry:Qt,refetchOnWindowFocus:!1}}});function Pn(){let e=s({queryKey:[`api-meta`],queryFn:E.meta}),{locale:t}=Ot();return e.error?(0,D.jsxs)(`div`,{role:`alert`,className:`p-8`,children:[e.error.message,(0,D.jsx)(`button`,{className:`ml-4 underline`,onClick:()=>void e.refetch(),children:t===`zh-CN`?`重新连接`:`Reconnect`})]}):e.data?e.data.capabilities.includes(`application.workflows.v1`)&&new URLSearchParams(window.location.search).get(`legacy`)!==`1`?(0,D.jsx)(An,{}):(0,D.jsx)(kn,{}):(0,D.jsx)(`div`,{className:`p-8`,children:t===`zh-CN`?`正在连接…`:`Connecting…`})}function Fn(){let{locale:e}=Ot();return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(At,{}),(0,D.jsx)(kt,{locale:e,children:(0,D.jsx)(x.Suspense,{fallback:(0,D.jsx)(`div`,{className:`grid min-h-screen place-items-center text-sm text-ink-faint`,children:e===`zh-CN`?`正在加载工作台…`:`Loading workbench…`}),children:On?(0,D.jsx)(jn,{}):(0,D.jsx)(Pn,{})})})]})}(On?Promise.resolve():bt()).then(()=>de.createRoot(document.getElementById(`root`)).render((0,D.jsx)(x.StrictMode,{children:(0,D.jsx)(_,{client:Nn,children:(0,D.jsx)(O,{children:(0,D.jsx)(Fn,{})})})}))).catch(e=>{let t=document.getElementById(`root`);t.setAttribute(`role`,`alert`),t.textContent=`Cannot open workbench: ${e instanceof Error?e.message:String(e)}`});export{yt as A,nt as B,Lt as C,Mt as D,k as E,Be as F,ge as G,Ye as H,Ve as I,ae as J,fe as K,st as L,We as M,Fe as N,Tt as O,E as P,Ke as R,It as S,zt as T,Qe as U,tt as V,S as W,un as _,dn as a,Gt as b,sn as c,ln as d,on as f,an as g,nn as h,fn as i,Ge as j,Ot as k,Sn as l,rn as m,yn as n,mn as o,hn as p,he as q,xn as r,cn as s,Dn as t,pn as u,Ut as v,Ht as w,Bt as x,Ft as y,qe as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/index-Diz-_RXt.css b/frontend/web/dist/assets/index-Diz-_RXt.css new file mode 100644 index 000000000..0cb599732 --- /dev/null +++ b/frontend/web/dist/assets/index-Diz-_RXt.css @@ -0,0 +1 @@ +@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-cyrillic-ext-wght-normal-DjL33-gN.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-cyrillic-wght-normal-BEAKL7Jp.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-vietnamese-wght-normal-6IgcOCM7.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-latin-ext-wght-normal-DC-KSUi6.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-latin-wght-normal-BgDaEnEv.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-symbols2-wght-normal-CO5SzqOn.woff2)format("woff2-variations");unicode-range:U+2000-2001,U+2004-2008,U+200A,U+23B8-23BD,U+2500-259F}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-vietnamese-wght-normal-DadHysG0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Geist Mono Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./geist-mono-latin-wght-normal-XN7g48iV.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.\!card,.card{background:rgb(var(--surface));box-shadow:none;border:0;border-radius:.5rem}.chip{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1));border-radius:.375rem;align-items:center;gap:.25rem;padding:.125rem .375rem;font-size:.75rem;line-height:1rem;display:inline-flex}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.inset-y-1{top:.25rem;bottom:.25rem}.inset-y-2{top:.5rem;bottom:.5rem}.-bottom-2\.5{bottom:-.625rem}.-left-0\.5{left:-.125rem}.-top-1\.5{top:-.375rem}.-top-2\.5{top:-.625rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-4{left:1rem}.left-\[0\.6875rem\]{left:.6875rem}.left-\[10\%\]{left:10%}.left-\[5px\]{left:5px}.right-0\.5{right:.125rem}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-9{right:2.25rem}.right-\[10\%\]{right:10%}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-2{top:.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-6{top:1.5rem}.isolate{isolation:isolate}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[110\]{z-index:110}.z-\[70\]{z-index:70}.z-\[90\]{z-index:90}.order-2{order:2}.order-3{order:3}.m-1{margin:.25rem}.m-auto{margin:auto}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-5{margin-left:1.25rem;margin-right:1.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-1\.5{margin-top:.375rem;margin-bottom:.375rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-9{margin-top:2.25rem}.mt-\[7px\]{margin-top:7px}.mt-auto{margin-top:auto}.mt-px{margin-top:1px}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.flow-root{display:flow-root}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1\.4rem\]{height:1.4rem}.h-\[100dvh\]{height:100dvh}.h-\[68vh\]{height:68vh}.h-\[calc\(100\%-1rem\)\]{height:calc(100% - 1rem)}.h-\[min\(780px\,84dvh\)\]{height:min(780px,84dvh)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-72{max-height:18rem}.max-h-80{max-height:20rem}.max-h-\[100dvh\]{max-height:100dvh}.max-h-\[24vh\]{max-height:24vh}.max-h-\[30vh\]{max-height:30vh}.max-h-\[34rem\]{max-height:34rem}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[52vh\]{max-height:52vh}.max-h-\[600px\]{max-height:600px}.max-h-\[62vh\]{max-height:62vh}.max-h-\[64vh\]{max-height:64vh}.max-h-\[70dvh\]{max-height:70dvh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[72vh\]{max-height:72vh}.max-h-\[76vh\]{max-height:76vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[calc\(100dvh-1\.5rem\)\]{max-height:calc(100dvh - 1.5rem)}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-10{min-height:2.5rem}.min-h-11{min-height:2.75rem}.min-h-14{min-height:3.5rem}.min-h-40{min-height:10rem}.min-h-52{min-height:13rem}.min-h-64{min-height:16rem}.min-h-72{min-height:18rem}.min-h-\[209px\]{min-height:209px}.min-h-\[3\.25rem\]{min-height:3.25rem}.min-h-\[320px\]{min-height:320px}.min-h-\[34rem\]{min-height:34rem}.min-h-\[60vh\]{min-height:60vh}.min-h-dvh{min-height:100dvh}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:.125rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[1\.4rem\]{width:1.4rem}.w-\[min\(30rem\,calc\(100vw-2rem\)\)\]{width:min(30rem,100vw - 2rem)}.w-\[min\(92vw\,42rem\)\]{width:min(92vw,42rem)}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.w-screen{width:100vw}.min-w-0{min-width:0}.min-w-28{min-width:7rem}.min-w-3\.5{min-width:.875rem}.min-w-32{min-width:8rem}.min-w-44{min-width:11rem}.min-w-52{min-width:13rem}.min-w-full{min-width:100%}.min-w-max{min-width:max-content}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-48{max-width:12rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-64{max-width:16rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[1600px\]{max-width:1600px}.max-w-\[260px\]{max-width:260px}.max-w-\[960px\]{max-width:960px}.max-w-\[calc\(100\%_-_3rem\)\]{max-width:calc(100% - 3rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.basis-full{flex-basis:100%}.table-fixed{table-layout:fixed}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x:-100%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate:-90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes appear{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.animate-appear{animation:.2s cubic-bezier(.4,0,.2,1) appear}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[16px_minmax\(0\,1fr\)\]{grid-template-columns:16px minmax(0,1fr)}.grid-cols-\[72px_minmax\(0\,1fr\)\]{grid-template-columns:72px minmax(0,1fr)}.grid-cols-\[84px_minmax\(0\,1fr\)_auto\]{grid-template-columns:84px minmax(0,1fr) auto}.grid-rows-\[1fr\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-1{row-gap:.25rem}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.justify-self-start{justify-self:start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overscroll-contain{overscroll-behavior:contain}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[18px\]{border-radius:18px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-xl{border-radius:.75rem}.rounded-r-md{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.border-blue-deep{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.border-blue-deep\/30{border-color:rgb(var(--blue-deep) / .3)}.border-blue-deep\/50{border-color:rgb(var(--blue-deep) / .5)}.border-blue-deep\/60{border-color:rgb(var(--blue-deep) / .6)}.border-blue\/25{border-color:rgb(var(--blue) / .25)}.border-blue\/30{border-color:rgb(var(--blue) / .3)}.border-blue\/35{border-color:rgb(var(--blue) / .35)}.border-blue\/40{border-color:rgb(var(--blue) / .4)}.border-blue\/45{border-color:rgb(var(--blue) / .45)}.border-blue\/50{border-color:rgb(var(--blue) / .5)}.border-blue\/60{border-color:rgb(var(--blue) / .6)}.border-err{--tw-border-opacity:1;border-color:rgb(var(--err) / var(--tw-border-opacity,1))}.border-err\/30{border-color:rgb(var(--err) / .3)}.border-err\/35{border-color:rgb(var(--err) / .35)}.border-err\/40{border-color:rgb(var(--err) / .4)}.border-err\/50{border-color:rgb(var(--err) / .5)}.border-err\/60{border-color:rgb(var(--err) / .6)}.border-gold\/25{border-color:rgb(var(--gold) / .25)}.border-gold\/30{border-color:rgb(var(--gold) / .3)}.border-gold\/40{border-color:rgb(var(--gold) / .4)}.border-line{--tw-border-opacity:1;border-color:rgb(var(--line) / var(--tw-border-opacity,1))}.border-line\/40{border-color:rgb(var(--line) / .4)}.border-line\/50{border-color:rgb(var(--line) / .5)}.border-line\/60{border-color:rgb(var(--line) / .6)}.border-line\/70{border-color:rgb(var(--line) / .7)}.border-line\/80{border-color:rgb(var(--line) / .8)}.border-ok{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.border-ok\/20{border-color:rgb(var(--ok) / .2)}.border-ok\/30{border-color:rgb(var(--ok) / .3)}.border-ok\/35{border-color:rgb(var(--ok) / .35)}.border-ok\/40{border-color:rgb(var(--ok) / .4)}.border-ok\/45{border-color:rgb(var(--ok) / .45)}.border-ok\/60{border-color:rgb(var(--ok) / .6)}.border-panel{--tw-border-opacity:1;border-color:rgb(var(--panel) / var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-warn\/30{border-color:rgb(var(--warn) / .3)}.border-warn\/35{border-color:rgb(var(--warn) / .35)}.border-warn\/40{border-color:rgb(var(--warn) / .4)}.border-warn\/50{border-color:rgb(var(--warn) / .5)}.border-t-blue{--tw-border-opacity:1;border-top-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.bg-bg{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.bg-bg\/25{background-color:rgb(var(--bg) / .25)}.bg-bg\/30{background-color:rgb(var(--bg) / .3)}.bg-bg\/35{background-color:rgb(var(--bg) / .35)}.bg-bg\/40{background-color:rgb(var(--bg) / .4)}.bg-bg\/50{background-color:rgb(var(--bg) / .5)}.bg-bg\/60{background-color:rgb(var(--bg) / .6)}.bg-bg\/70{background-color:rgb(var(--bg) / .7)}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/20{background-color:#0003}.bg-black\/40{background-color:#0006}.bg-blue{--tw-bg-opacity:1;background-color:rgb(var(--blue) / var(--tw-bg-opacity,1))}.bg-blue-deep{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.bg-blue-deep\/10{background-color:rgb(var(--blue-deep) / .1)}.bg-blue-deep\/20{background-color:rgb(var(--blue-deep) / .2)}.bg-blue-deep\/5{background-color:rgb(var(--blue-deep) / .05)}.bg-blue-sky{--tw-bg-opacity:1;background-color:rgb(var(--blue-sky) / var(--tw-bg-opacity,1))}.bg-blue\/10{background-color:rgb(var(--blue) / .1)}.bg-blue\/5{background-color:rgb(var(--blue) / .05)}.bg-conversation-user{--tw-bg-opacity:1;background-color:rgb(var(--conversation-user) / var(--tw-bg-opacity,1))}.bg-emerald-500{--tw-bg-opacity:1;background-color:rgb(16 185 129/var(--tw-bg-opacity,1))}.bg-engineer{--tw-bg-opacity:1;background-color:rgb(var(--role-engineer) / var(--tw-bg-opacity,1))}.bg-err{--tw-bg-opacity:1;background-color:rgb(var(--err) / var(--tw-bg-opacity,1))}.bg-err\/10{background-color:rgb(var(--err) / .1)}.bg-err\/5{background-color:rgb(var(--err) / .05)}.bg-gold{--tw-bg-opacity:1;background-color:rgb(var(--gold) / var(--tw-bg-opacity,1))}.bg-gold\/5{background-color:rgb(var(--gold) / .05)}.bg-gold\/80{background-color:rgb(var(--gold) / .8)}.bg-ink{--tw-bg-opacity:1;background-color:rgb(var(--ink) / var(--tw-bg-opacity,1))}.bg-ink-faint{--tw-bg-opacity:1;background-color:rgb(var(--ink-faint) / var(--tw-bg-opacity,1))}.bg-ink-faint\/40{background-color:rgb(var(--ink-faint) / .4)}.bg-ink-faint\/45{background-color:rgb(var(--ink-faint) / .45)}.bg-ink-faint\/50{background-color:rgb(var(--ink-faint) / .5)}.bg-ink-faint\/60{background-color:rgb(var(--ink-faint) / .6)}.bg-line{--tw-bg-opacity:1;background-color:rgb(var(--line) / var(--tw-bg-opacity,1))}.bg-line\/30{background-color:rgb(var(--line) / .3)}.bg-line\/40{background-color:rgb(var(--line) / .4)}.bg-line\/55{background-color:rgb(var(--line) / .55)}.bg-line\/60{background-color:rgb(var(--line) / .6)}.bg-line\/70{background-color:rgb(var(--line) / .7)}.bg-line\/80{background-color:rgb(var(--line) / .8)}.bg-ok{--tw-bg-opacity:1;background-color:rgb(var(--ok) / var(--tw-bg-opacity,1))}.bg-ok\/10{background-color:rgb(var(--ok) / .1)}.bg-ok\/15{background-color:rgb(var(--ok) / .15)}.bg-ok\/5{background-color:rgb(var(--ok) / .05)}.bg-panel{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.bg-panel-raised{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.bg-panel\/80{background-color:rgb(var(--panel) / .8)}.bg-panel\/85{background-color:rgb(var(--panel) / .85)}.bg-panel\/95{background-color:rgb(var(--panel) / .95)}.bg-surface{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.bg-surface\/50{background-color:rgb(var(--surface) / .5)}.bg-surface\/60{background-color:rgb(var(--surface) / .6)}.bg-transparent{background-color:#0000}.bg-warn{--tw-bg-opacity:1;background-color:rgb(var(--warn) / var(--tw-bg-opacity,1))}.bg-warn\/10{background-color:rgb(var(--warn) / .1)}.bg-warn\/5{background-color:rgb(var(--warn) / .05)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-white\/\[0\.03\]{background-color:#ffffff08}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-px{padding-top:1px;padding-bottom:1px}.pb-1{padding-bottom:.25rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-6{padding-bottom:1.5rem}.pl-0\.5{padding-left:.125rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-3\.5{padding-left:.875rem}.pl-4{padding-left:1rem}.pl-5{padding-left:1.25rem}.pl-7{padding-left:1.75rem}.pl-\[1\.125rem\]{padding-left:1.125rem}.pr-10{padding-right:2.5rem}.pr-14{padding-right:3.5rem}.pr-3{padding-right:.75rem}.pr-\[4\.75rem\]{padding-right:4.75rem}.pt-0\.5{padding-top:.125rem}.pt-1\.5{padding-top:.375rem}.pt-10{padding-top:2.5rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-7{padding-top:1.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:Geist Mono Variable,SFMono-Regular,Menlo,ui-monospace,monospace}.font-sans{font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.leading-\[1\.625\]{line-height:1.625}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-\[-0\.01em\]{letter-spacing:-.01em}.tracking-\[0\.06em\]{letter-spacing:.06em}.tracking-\[0\.08em\]{letter-spacing:.08em}.tracking-\[0\.12em\]{letter-spacing:.12em}.tracking-\[0\.14em\]{letter-spacing:.14em}.tracking-\[0\.15em\]{letter-spacing:.15em}.tracking-\[0\.16em\]{letter-spacing:.16em}.tracking-\[0\.18em\]{letter-spacing:.18em}.tracking-normal{letter-spacing:0}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-bg{--tw-text-opacity:1;color:rgb(var(--bg) / var(--tw-text-opacity,1))}.text-blue{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.text-blue-sky{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.text-blue\/75{color:rgb(var(--blue) / .75)}.text-err{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.text-err\/80{color:rgb(var(--err) / .8)}.text-gold{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.text-ink{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.text-ink-dim{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.text-ink-faint{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.text-manager{--tw-text-opacity:1;color:rgb(var(--role-manager) / var(--tw-text-opacity,1))}.text-ok{--tw-text-opacity:1;color:rgb(var(--ok) / var(--tw-text-opacity,1))}.text-surface{--tw-text-opacity:1;color:rgb(var(--surface) / var(--tw-text-opacity,1))}.text-warn{--tw-text-opacity:1;color:rgb(var(--warn) / var(--tw-text-opacity,1))}.text-warn\/80{color:rgb(var(--warn) / .8)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.decoration-blue\/35{-webkit-text-decoration-color:rgb(var(--blue) / .35);text-decoration-color:rgb(var(--blue) / .35)}.decoration-line{-webkit-text-decoration-color:rgb(var(--line) / 1);text-decoration-color:rgb(var(--line) / 1)}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.accent-blue{accent-color:rgb(var(--blue) / 1)}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-\[0_10px_24px_-20px_rgb\(0_0_0\/0\.2\)\]{--tw-shadow:0 10px 24px -20px #0003;--tw-shadow-colored:0 10px 24px -20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-glow{--tw-shadow:0 16px 44px #00000057;--tw-shadow-colored:0 16px 44px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-4{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-bg{--tw-ring-opacity:1;--tw-ring-color:rgb(var(--bg) / var(--tw-ring-opacity,1))}.ring-err\/30{--tw-ring-color:rgb(var(--err) / .3)}.ring-line\/35{--tw-ring-color:rgb(var(--line) / .35)}.ring-manager\/60{--tw-ring-color:rgb(var(--role-manager) / .6)}.ring-ok\/30{--tw-ring-color:rgb(var(--ok) / .3)}.ring-offset-1{--tw-ring-offset-width:1px}.ring-offset-panel{--tw-ring-offset-color:rgb(var(--panel) / 1)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\!filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\,transform\,visibility\]{transition-property:width,transform,visibility;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-shadow{transition-property:box-shadow;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-500{transition-duration:.5s}.duration-panel{transition-duration:.22s}.ease-panel{transition-timing-function:cubic-bezier(.4,0,.2,1)}:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--bg:245 245 247;--surface:255 255 255;--panel:255 255 255;--panel-raised:255 255 255;--line:232 232 235;--ink:29 29 31;--ink-dim:80 80 84;--ink-faint:99 99 102;--blue:0 102 204;--blue-deep:0 82 172;--blue-sky:0 102 204;--gold:0 102 204;--gold-soft:0 102 204;--gold-deep:0 82 172;--ok:0 102 204;--warn:99 99 102;--err:29 29 31;--role-manager:37 99 235;--role-planner:124 58 237;--role-engineer:15 118 110;--role-reviewer:180 83 9;--conversation-user:238 238 240;--conversation-argus:246 248 252;--glass:255 255 255;--glass-raised:255 255 255;--glass-edge:224 224 228;--chrome-surface:255 255 255;--brand-body:0 0 0;--brand-eye:255 255 255;--brand-pupil:0 0 0;--brand-highlight:255 255 255}:root[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--bg:0 0 0;--surface:22 22 24;--panel:28 28 30;--panel-raised:36 36 38;--line:58 58 60;--ink:245 245 247;--ink-dim:199 199 204;--ink-faint:162 162 167;--blue:64 156 255;--blue-deep:10 102 194;--blue-sky:100 175 255;--gold:64 156 255;--gold-soft:64 156 255;--gold-deep:10 102 194;--ok:64 156 255;--warn:174 174 178;--err:245 245 247;--role-manager:96 165 250;--role-planner:196 181 253;--role-engineer:52 211 153;--role-reviewer:251 191 36;--conversation-user:44 44 46;--conversation-argus:25 31 40;--glass:28 28 30;--glass-raised:36 36 38;--glass-edge:72 72 74;--chrome-surface:22 22 24;--brand-body:215 217 220;--brand-eye:255 255 255;--brand-pupil:32 35 38;--brand-highlight:255 255 255;font-synthesis:none}:root[data-theme-style=gradient]{--ambient-blue:7 95 228;--ambient-gold:207 153 49}:root[data-theme=dark][data-theme-style=gradient]{--ambient-blue:110 168 255;--ambient-gold:237 201 111}html,body,#root{height:100%}body{background:rgb(var(--bg) / 1);color:rgb(var(--ink) / 1);font-optical-sizing:auto;font-feature-settings:"ss01" 1, "cv02" 1, "cv03" 1, "cv04" 1;-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility;margin:0;font-family:Geist Variable,PingFang SC,Microsoft YaHei,Noto Sans CJK SC,ui-sans-serif,system-ui,sans-serif;overflow:hidden}.katex-display{max-width:100%;overflow:auto hidden}select:not([multiple]){appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m5 6.5 3 3 3-3' stroke='%236e6e73' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-position:right .6rem center;background-repeat:no-repeat;background-size:1rem;transition:border-color .14s,background-color .14s,box-shadow .14s;padding-right:1.9rem!important}:root[data-theme=dark] select:not([multiple]){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m5 6.5 3 3 3-3' stroke='%23a2a2a7' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}select:not([multiple]):focus-visible{box-shadow:0 0 0 3px rgb(var(--blue) / 10%);border-color:rgb(var(--blue) / 58%)!important}select option,select optgroup{background:rgb(var(--panel-raised));color:rgb(var(--ink))}.workbench-shell{isolation:isolate;background:rgb(var(--bg));height:100dvh}.workbench-shell[data-resizing] [data-resizable-panel]{transition-duration:0s!important}:root[data-theme=dark] .workbench-shell{background:rgb(var(--bg))}:root[data-theme-style=gradient] .workbench-shell{background:radial-gradient(circle at 8% 0%, rgb(var(--ambient-blue) / 15%), transparent 36rem), radial-gradient(circle at 92% 100%, rgb(var(--ambient-gold) / 14%), transparent 34rem), rgb(var(--bg))}:root[data-theme=dark][data-theme-style=gradient] .workbench-shell{background:radial-gradient(circle at 8% 0%, rgb(var(--ambient-blue) / 20%), transparent 38rem), radial-gradient(circle at 92% 100%, rgb(var(--ambient-gold) / 17%), transparent 36rem), rgb(var(--bg))}.ambient-canvas{position:relative}.ambient-canvas:before{content:none}.glass-panel,.glass-panel--side,.glass-panel--main,.glass-panel--raised{border-color:rgb(var(--line));background:rgb(var(--panel));box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none}.glass-panel--side{background:rgb(var(--surface) / 94%)}.glass-panel--main{background:rgb(var(--panel) / 96%)}.glass-panel--raised{background:rgb(var(--panel-raised));box-shadow:none}.chrome-seam-surface{background:rgb(var(--chrome-surface));box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none}.glass-card{background:rgb(var(--surface));box-shadow:none;border:0}.mission-status-line{--mission-status-color:var(--blue);box-shadow:none;margin-top:1rem;padding:.25rem 0}.mission-status-line__signal{color:rgb(var(--ink));align-items:center;gap:.625rem;font-size:.875rem;font-weight:600;line-height:1.4;display:flex}.mission-status-line__marker{background:rgb(var(--mission-status-color));border-radius:999px;flex:none;width:.5rem;height:.5rem}.mission-status-line__subtitle{color:rgb(var(--ink-dim));margin-top:.375rem;padding-left:1.125rem;font-size:.75rem;line-height:1.5}.mission-status-line[data-tone=done]{--mission-status-color:var(--blue)}.mission-status-line[data-tone=error]{--mission-status-color:var(--err)}.mission-status-line[data-tone=waiting]{--mission-status-color:var(--ink-faint)}.brand-button{z-index:0;isolation:isolate;border:1px solid #0000;border-radius:8px;min-height:32px;padding:.3rem .7rem;font-size:.75rem;font-weight:600;transition:color .18s,box-shadow .18s,filter .18s;position:relative;overflow:hidden}.brand-button:before,.brand-button:after{content:none}.brand-button-primary{border-color:rgb(var(--blue) / 34%);background:rgb(var(--blue) / 8%);color:rgb(var(--blue));box-shadow:none}.brand-button-ghost{color:rgb(var(--ink-dim));background:0 0}.brand-button-danger{border-color:rgb(var(--ink));background:rgb(var(--ink));color:rgb(var(--bg))}.brand-button:disabled{cursor:not-allowed;filter:grayscale(.45);opacity:.42}.panel-header{border-color:rgb(var(--line) / 70%);background:0 0}.modal-scrim{background:#00000052}.brand-modal{border:1px solid rgb(var(--glass-edge) / 80%);background:rgb(var(--panel-raised));box-shadow:0 24px 80px #0000002e,0 2px 10px #00000012}:root[data-theme=dark] .brand-modal{border-color:rgb(var(--glass-edge) / 72%);box-shadow:0 28px 90px #0000008c,0 2px 10px #00000047}.modal-close{z-index:2;background:rgb(var(--conversation-user) / 78%);width:2rem;height:2rem;color:rgb(var(--ink-faint));border:1px solid #0000;border-radius:999px;place-items:center;transition:border-color .14s,background-color .14s,color .14s,transform .14s;display:grid;position:absolute;top:.75rem;right:.75rem}.modal-close svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-width:1.4px;width:.9rem;height:.9rem}.modal-close:hover{border-color:rgb(var(--line));background:rgb(var(--ink));color:rgb(var(--bg))}.modal-close:active{transform:scale(.94)}.modal-close:focus-visible{outline:2px solid rgb(var(--blue) / 65%);outline-offset:2px}.handshake-mark{color:rgb(var(--ink));box-shadow:none}.handshake-line{background:rgb(var(--blue))}.handshake-node{border-color:rgb(var(--line));background:rgb(var(--surface));box-shadow:none}.icon-control,.compact-control,.send-control{color:rgb(var(--ink-faint));box-shadow:none;background:0 0;border:1px solid #0000;border-radius:8px;transition:border-color .18s,background-color .18s,color .18s,box-shadow .18s}.compact-control{font-size:.75rem}.composer-runtime{color:rgb(var(--ink-dim));flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 12px;padding:6px 4px;font-size:11px;line-height:1.5;display:flex}.composer-runtime-model{overflow-wrap:anywhere;min-width:0}.composer-runtime button{color:rgb(var(--blue));text-underline-offset:3px;flex-shrink:0;text-decoration:underline}.composer-runtime button:focus-visible{outline:2px solid rgb(var(--blue));outline-offset:3px}.composer-runtime button.composer-runtime-model{color:inherit;text-align:left;cursor:pointer;flex-shrink:1;text-decoration:none}.composer-runtime button.composer-runtime-model:hover{color:rgb(var(--blue));text-decoration:underline}.composer-runtime-next{color:rgb(var(--gold))}.send-control{border-color:rgb(var(--blue) / 34%);background:rgb(var(--blue) / 8%);color:rgb(var(--blue));box-shadow:none}.session-card{background:0 0;border:1px solid #0000}.session-card[data-active=true]{background:rgb(var(--blue) / 8%);box-shadow:inset 2px 0 0 rgb(var(--blue));border-color:#0000}.workspace-tabs{align-self:stretch;gap:1.5rem;display:flex}.workspace-tab{color:rgb(var(--ink-faint));border-bottom:2px solid #0000;padding:0 .25rem;font-size:.875rem;transition:color .2s}.workspace-tab[data-selected=true]{color:rgb(var(--ink));border-bottom-color:rgb(var(--ink))}.workspace-more{color:rgb(var(--ink-dim));font-size:.875rem;position:relative}.workspace-more>summary{cursor:pointer;border-radius:6px;padding:.5rem}.workspace-more>summary:focus-visible{outline:2px solid rgb(var(--blue));outline-offset:2px}.workspace-more-menu{z-index:60;border:1px solid rgb(var(--line));background:rgb(var(--surface));border-radius:8px;min-width:210px;padding:6px;position:absolute;top:100%;left:0;box-shadow:0 6px 20px #00000014}.workspace-more-menu button{text-align:left;border-radius:4px;align-items:center;gap:8px;width:100%;min-height:40px;padding:8px 10px;display:flex}.workspace-more-menu button:hover{background:rgb(var(--bg))}.mobile-more>summary{flex-direction:column;justify-content:center;align-items:center;gap:2px;font-size:10px;list-style:none;display:flex}.mobile-more>summary::-webkit-details-marker{display:none}.mobile-more>summary[aria-current=page]{color:rgb(var(--blue))}.mobile-more .workspace-more-menu{font-size:14px;inset:auto 8px calc(100% + 8px) auto}.mission-detail-records>summary::marker{color:rgb(var(--ink-faint))}.workbench-module-tab{min-height:30px;color:rgb(var(--ink-faint));border:1px solid #0000;border-radius:.5rem;align-items:center;gap:.35rem;padding:.35rem .6rem;font-size:.72rem;transition:border-color .16s,background .16s,color .16s;display:inline-flex}.workbench-module-tab:hover{border-color:rgb(var(--glass-edge) / 55%);background:rgb(var(--glass-raised) / 45%);color:rgb(var(--ink))}.workbench-module-tab[data-selected=true]{border-color:rgb(var(--blue) / 35%);background:rgb(var(--blue) / 8%);color:rgb(var(--ink));box-shadow:none}.role-log-group{transition:background-color .2s,box-shadow .2s;position:relative}.role-log-group:before{content:"";opacity:0;background:rgb(var(--blue));border-radius:999px;width:2px;transition:opacity .2s,box-shadow .2s;position:absolute;inset:5px auto 5px 0}.role-log-group[data-open=true]{background:rgb(var(--blue) / 4%)}.role-log-group[data-open=true]:before{opacity:1}.role-log-group[data-active=true]:before{box-shadow:none}@media (hover:hover) and (pointer:fine){.icon-control:hover,.compact-control:hover{background-color:rgb(var(--conversation-user));color:rgb(var(--ink));box-shadow:none;border-color:#0000}.session-card:hover{background:rgb(var(--conversation-user) / 55%);border-color:#0000}.brand-button:hover{background:rgb(var(--conversation-user));box-shadow:none;border-color:#0000}.brand-button-primary:hover,.send-control:hover{border-color:rgb(var(--blue-deep));background:rgb(var(--blue-deep));color:#fff}}@media (hover:none),(pointer:coarse){.brand-button:active{filter:brightness(.92)}}.theme-style-option{border:1px solid rgb(var(--line));background:rgb(var(--surface));min-height:72px;color:rgb(var(--ink));text-align:left;border-radius:10px;grid-template-columns:44px minmax(0,1fr) 18px;align-items:center;gap:.75rem;padding:.75rem;transition:border-color .16s,background-color .16s;display:grid;position:relative}.theme-style-option[data-selected=true]{border-color:rgb(var(--blue) / 58%);background:rgb(var(--blue) / 5%)}.theme-style-preview{border:1px solid rgb(var(--line));border-radius:8px;width:44px;height:32px}.theme-style-preview--standard{background:linear-gradient(135deg, rgb(var(--ink)) 0 48%, rgb(var(--blue)) 48% 100%)}.theme-style-preview--gradient{background:linear-gradient(135deg,#075fe4,#0b2e68 54%,#cf9931)}.theme-style-check{border:1px solid rgb(var(--line));color:#0000;border-radius:999px;place-items:center;width:18px;height:18px;font-size:9px;display:grid}.theme-style-option[data-selected=true] .theme-style-check{border-color:rgb(var(--blue));background:rgb(var(--blue));color:#fff}:root{--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--safe-right:env(safe-area-inset-right,0px);--mobile-tabbar-height:calc(3.25rem + var(--safe-bottom));--keyboard-inset:0px}.safe-inset-x{padding-left:var(--safe-left);padding-right:var(--safe-right)}.safe-inset-top{padding-top:var(--safe-top)}.safe-inset-bottom{padding-bottom:var(--safe-bottom)}@media (pointer:coarse){.icon-control,.compact-control,.workspace-tab{position:relative}.icon-control:after,.compact-control:after,.workspace-tab:after{content:"";width:max(100%,44px);height:max(100%,44px);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}}@media (width<=1023px){.mobile-scroll-region{padding-bottom:calc(var(--mobile-tabbar-height) + .5rem)}}.mobile-tabbar{bottom:var(--keyboard-inset);padding-bottom:var(--safe-bottom);padding-left:var(--safe-left);padding-right:var(--safe-right);transition:bottom .12s ease-out}.composer-dock{padding-bottom:calc(var(--keyboard-inset) + 1.5rem);transition:padding-bottom .12s ease-out}@media (width<=1023px){.composer-dock{padding-bottom:calc(var(--mobile-tabbar-height) + var(--keyboard-inset) + 1.5rem)}}[data-compact-viewport=true] .composer-dock{padding-top:6px;padding-bottom:calc(var(--mobile-tabbar-height) + var(--keyboard-inset) + .5rem)}[data-compact-viewport=true] .composer-dock .map-composer{padding-top:6px;padding-bottom:6px}[data-compact-viewport=true] .composer-dock .map-composer textarea{max-height:56px}[data-compact-viewport=true] .composer-dock .composer-controls{padding-top:0}[data-compact-viewport=true] .composer-dock .composer-runtime{padding-top:2px;padding-bottom:2px}@media (prefers-reduced-motion:reduce){.composer-dock,.mobile-tabbar{transition:none}}::selection{color:rgb(var(--ink) / 1);background:#3f6f9f8c}button,input,textarea{font:inherit}button{-webkit-tap-highlight-color:transparent}:where(button,input,textarea):focus-visible{outline:2px solid rgb(var(--blue-sky) / 1);outline-offset:2px}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}.scroll-smooth{scroll-behavior:auto!important}.ambient-canvas:before{animation:none!important}}.scroll-thin::-webkit-scrollbar{width:7px;height:7px}.scroll-thin{scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:rgb(var(--ink-faint) / 45%) transparent}.scroll-thin::-webkit-scrollbar-thumb{background:rgb(var(--ink-faint) / 38%);border:1px solid rgb(var(--panel) / 80%);border-radius:9999px}.scroll-thin::-webkit-scrollbar-thumb:hover{background:rgb(var(--ink-faint) / 65%)}.scroll-thin::-webkit-scrollbar-track{background:0 0;border-radius:9999px}.slash-completion-menu{overscroll-behavior:contain;max-height:min(22rem,42dvh);overflow-y:auto}:root[data-argus-embedded=true] .ambient-canvas:before{will-change:auto;animation:none;transform:translate(0,0)scale(1.04)}:root[data-argus-embedded=true] :is(.glass-panel,.glass-panel--side,.glass-panel--main,.glass-panel--raised){-webkit-backdrop-filter:blur(8px)saturate(1.06);backdrop-filter:blur(8px)saturate(1.06)}@supports (content-visibility:auto){:root[data-argus-embedded=true] .conversation-thread{content-visibility:auto;contain-intrinsic-size:auto 180px}:root[data-argus-embedded=true] .event-activity-row{content-visibility:auto;contain-intrinsic-size:auto 56px}}.delivery-toast{z-index:60;background:rgb(var(--panel-raised));width:max-content;max-width:min(420px,100vw - 32px);color:rgb(var(--ink));border:1px solid rgb(var(--line));border-radius:10px;align-items:center;gap:10px;padding:10px 12px;font-size:13px;display:flex;position:fixed;top:68px;left:50%;transform:translate(-50%);box-shadow:0 8px 24px #0000002e}.delivery-toast span{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.delivery-toast button{color:inherit;cursor:pointer;font:inherit;background:0 0;border:0}.delivery-toast button:first-of-type{color:rgb(var(--blue));font-weight:600}.app-brand-image .app-brand-dark,[data-theme=dark] .app-brand-image .app-brand-light{display:none}[data-theme=dark] .app-brand-image .app-brand-dark{display:block}.placeholder\:text-ink-faint::placeholder{--tw-text-opacity:1;color:rgb(var(--ink-faint) / var(--tw-text-opacity,1))}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}.last\:border-0:last-child{border-width:0}.last\:border-b-0:last-child{border-bottom-width:0}.last\:pb-0:last-child{padding-bottom:0}.focus-within\:border-blue\/60:focus-within{border-color:rgb(var(--blue) / .6)}.hover\:border-blue:hover{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.hover\:border-blue-deep:hover{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.hover\:border-blue-sky\/60:hover{border-color:rgb(var(--blue-sky) / .6)}.hover\:border-blue\/40:hover{border-color:rgb(var(--blue) / .4)}.hover\:border-blue\/45:hover{border-color:rgb(var(--blue) / .45)}.hover\:border-blue\/50:hover{border-color:rgb(var(--blue) / .5)}.hover\:border-blue\/60:hover{border-color:rgb(var(--blue) / .6)}.hover\:border-err\/50:hover{border-color:rgb(var(--err) / .5)}.hover\:border-ink-faint:hover{--tw-border-opacity:1;border-color:rgb(var(--ink-faint) / var(--tw-border-opacity,1))}.hover\:border-line\/70:hover{border-color:rgb(var(--line) / .7)}.hover\:border-ok:hover{--tw-border-opacity:1;border-color:rgb(var(--ok) / var(--tw-border-opacity,1))}.hover\:bg-bg:hover{--tw-bg-opacity:1;background-color:rgb(var(--bg) / var(--tw-bg-opacity,1))}.hover\:bg-bg\/30:hover{background-color:rgb(var(--bg) / .3)}.hover\:bg-bg\/60:hover{background-color:rgb(var(--bg) / .6)}.hover\:bg-bg\/70:hover{background-color:rgb(var(--bg) / .7)}.hover\:bg-blue-deep:hover{--tw-bg-opacity:1;background-color:rgb(var(--blue-deep) / var(--tw-bg-opacity,1))}.hover\:bg-blue-deep\/20:hover{background-color:rgb(var(--blue-deep) / .2)}.hover\:bg-blue-deep\/80:hover{background-color:rgb(var(--blue-deep) / .8)}.hover\:bg-blue\/10:hover{background-color:rgb(var(--blue) / .1)}.hover\:bg-blue\/15:hover{background-color:rgb(var(--blue) / .15)}.hover\:bg-err\/10:hover{background-color:rgb(var(--err) / .1)}.hover\:bg-line\/20:hover{background-color:rgb(var(--line) / .2)}.hover\:bg-ok\/10:hover{background-color:rgb(var(--ok) / .1)}.hover\:bg-ok\/15:hover{background-color:rgb(var(--ok) / .15)}.hover\:bg-panel:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel) / var(--tw-bg-opacity,1))}.hover\:bg-panel-raised:hover{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.hover\:bg-panel\/60:hover{background-color:rgb(var(--panel) / .6)}.hover\:bg-panel\/80:hover{background-color:rgb(var(--panel) / .8)}.hover\:bg-surface:hover{--tw-bg-opacity:1;background-color:rgb(var(--surface) / var(--tw-bg-opacity,1))}.hover\:bg-warn\/10:hover{background-color:rgb(var(--warn) / .1)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-blue:hover{--tw-text-opacity:1;color:rgb(var(--blue) / var(--tw-text-opacity,1))}.hover\:text-blue-sky:hover{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.hover\:text-err:hover{--tw-text-opacity:1;color:rgb(var(--err) / var(--tw-text-opacity,1))}.hover\:text-gold:hover{--tw-text-opacity:1;color:rgb(var(--gold) / var(--tw-text-opacity,1))}.hover\:text-gold-soft:hover{--tw-text-opacity:1;color:rgb(var(--gold-soft) / var(--tw-text-opacity,1))}.hover\:text-ink:hover{--tw-text-opacity:1;color:rgb(var(--ink) / var(--tw-text-opacity,1))}.hover\:text-ink-dim:hover{--tw-text-opacity:1;color:rgb(var(--ink-dim) / var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-blue:hover{-webkit-text-decoration-color:rgb(var(--blue) / 1);text-decoration-color:rgb(var(--blue) / 1)}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.focus\:border-blue:focus{--tw-border-opacity:1;border-color:rgb(var(--blue) / var(--tw-border-opacity,1))}.focus\:border-blue-deep:focus{--tw-border-opacity:1;border-color:rgb(var(--blue-deep) / var(--tw-border-opacity,1))}.focus\:border-blue\/60:focus,.focus-visible\:border-blue\/60:focus-visible{border-color:rgb(var(--blue) / .6)}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-blue:focus-visible{outline-color:rgb(var(--blue) / 1)}.focus-visible\:outline-blue-sky:focus-visible{outline-color:rgb(var(--blue-sky) / 1)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-blue-sky\/50:focus-visible{--tw-ring-color:rgb(var(--blue-sky) / .5)}.focus-visible\:ring-blue\/50:focus-visible{--tw-ring-color:rgb(var(--blue) / .5)}.active\:bg-panel-raised:active{--tw-bg-opacity:1;background-color:rgb(var(--panel-raised) / var(--tw-bg-opacity,1))}.enabled\:hover\:text-blue-sky:hover:enabled{--tw-text-opacity:1;color:rgb(var(--blue-sky) / var(--tw-text-opacity,1))}.enabled\:focus-visible\:underline:focus-visible:enabled{text-decoration-line:underline}.enabled\:focus-visible\:outline-none:focus-visible:enabled{outline-offset:2px;outline:2px solid #0000}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:cursor-wait:disabled{cursor:wait}.disabled\:opacity-35:disabled{opacity:.35}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-45:disabled{opacity:.45}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group:focus-within .group-focus-within\:opacity-100{opacity:1}.group:hover .group-hover\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}.group:hover .group-hover\:bg-ink-faint\/30{background-color:rgb(var(--ink-faint) / .3)}.group:hover .group-hover\:opacity-100{opacity:1}.group:focus .group-focus\:bg-blue\/70{background-color:rgb(var(--blue) / .7)}@media (prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media (width>=640px){.sm\:left-auto{left:auto}.sm\:order-none{order:0}.sm\:col-span-2{grid-column:span 2/span 2}.sm\:mx-8{margin-left:2rem;margin-right:2rem}.sm\:inline{display:inline}.sm\:h-20{height:5rem}.sm\:max-h-\[88dvh\]{max-height:88dvh}.sm\:w-20{width:5rem}.sm\:w-auto{width:auto}.sm\:max-w-48{max-width:12rem}.sm\:max-w-\[82\%\]{max-width:82%}.sm\:max-w-md{max-width:28rem}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-\[100px_minmax\(0\,1fr\)\]{grid-template-columns:100px minmax(0,1fr)}.sm\:grid-cols-\[minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) auto}.sm\:grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.sm\:flex-nowrap{flex-wrap:nowrap}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-5{padding:1.25rem}.sm\:p-6{padding:1.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-5{padding-left:1.25rem;padding-right:1.25rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:px-8{padding-left:2rem;padding-right:2rem}.sm\:pt-14{padding-top:3.5rem}.sm\:text-right{text-align:right}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:opacity-0{opacity:0}.group:focus-within .sm\:group-focus-within\:opacity-100,.group:hover .sm\:group-hover\:opacity-100{opacity:1}}@media (width>=768px){.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-80{width:20rem}.md\:shrink-0{flex-shrink:0}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:border-r{border-right-width:1px}.md\:border-line\/60{border-color:rgb(var(--line) / .6)}}@media (width>=1024px){.lg\:visible{visibility:visible}.lg\:static{position:static}.lg\:z-auto{z-index:auto}.lg\:col-span-2{grid-column:span 2/span 2}.lg\:flex{display:flex}.lg\:grid{display:grid}.lg\:hidden{display:none}.lg\:min-h-0{min-height:0}.lg\:w-\[var\(--preview-width\)\]{width:var(--preview-width)}.lg\:w-\[var\(--sidebar-width\,256px\)\]{width:var(--sidebar-width,256px)}.lg\:max-w-\[61\.8vw\]{max-width:61.8vw}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-\[280px_minmax\(0\,1fr\)\]{grid-template-columns:280px minmax(0,1fr)}.lg\:grid-cols-\[minmax\(0\,1\.15fr\)_minmax\(260px\,0\.85fr\)\]{grid-template-columns:minmax(0,1.15fr) minmax(260px,.85fr)}.lg\:grid-cols-\[minmax\(0\,1\.4fr\)_minmax\(300px\,0\.8fr\)\]{grid-template-columns:minmax(0,1.4fr) minmax(300px,.8fr)}.lg\:grid-cols-\[minmax\(15rem\,0\.72fr\)_minmax\(0\,1\.8fr\)\]{grid-template-columns:minmax(15rem,.72fr) minmax(0,1.8fr)}.lg\:gap-3{gap:.75rem}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:border-b-0{border-bottom-width:0}.lg\:border-r{border-right-width:1px}}@media (width>=1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-\[minmax\(0\,1fr\)_minmax\(18rem\,0\.85fr\)\]{grid-template-columns:minmax(0,1fr) minmax(18rem,.85fr)}.xl\:border-b-0{border-bottom-width:0}.xl\:border-r{border-right-width:1px}}.\[\&\>section\>div\>button\:first-child\]\:px-3>section>div>button:first-child{padding-left:.75rem;padding-right:.75rem}.\[\&\>section\]\:mx-2>section{margin-left:.5rem;margin-right:.5rem}.\[\&\>section\]\:border-0>section{border-width:0}.\[\&\>section\]\:py-0>section{padding-top:0;padding-bottom:0} diff --git a/frontend/web/dist/assets/index-Dkv2HM-n.js b/frontend/web/dist/assets/index-Dkv2HM-n.js new file mode 100644 index 000000000..a35988b78 --- /dev/null +++ b/frontend/web/dist/assets/index-Dkv2HM-n.js @@ -0,0 +1,13 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-DHmEWeHX.js","./rolldown-runtime-hePW80VL.js","./icons-DHjcpj5P.js","./query-dCPZk0Xc.js","./markdown-BGG43fCg.js","./markdown-DvoRHisr.css","./AppearanceControls-DpaE5wy6.js","./format-CB65te2P.js","./useWorkbenchTheme-DMn1yhZa.js","./App-DCNDn7WF.css","./WorkflowWorkbench-LjcBb5YN.js","./AdminDataApp-sFLn0VsP.js","./activity-BmXzrCrJ.js","./history-BylQ-TOW.js","./code-xml-xZvprTy7.js","./AdminDataApp--AL95rdz.css"])))=>i.map(i=>d[i]); +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,v as r}from"./icons-DHjcpj5P.js";import{C as i,S as a,_ as o,a as s,c,d as l,f as u,g as d,h as f,l as p,m,n as h,p as g,s as _,u as v,v as y,w as ee,x as te,y as b}from"./query-dCPZk0Xc.js";import"./markdown-BGG43fCg.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ne=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,x(te);else{var t=n(l);t!==null&&de(ee,t.startTime-e)}}}function te(t,i){m=!1,h&&(h=!1,_(re),re=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!oe());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&de(ee,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var b=!1,ne=null,re=-1,ie=5,ae=-1;function oe(){return!(e.unstable_now()-aee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(re),re=-1):h=!0,de(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x(te))),r},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=t(((e,t)=>{t.exports=ne()})),ie=t((e=>{var t=r(),n=re();function i(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),u=Object.prototype.hasOwnProperty,d=/^[: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]*$/,f={},p={};function m(e){return u.call(p,e)?!0:u.call(f,e)?!1:d.test(e)?p[e]=!0:(f[e]=!0,!1)}function h(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?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(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){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function ee(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function te(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ve(e):``}function xe(e){switch(e.tag){case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 2:case 15:return e=be(e.type,!1),e;case 11:return e=be(e.type.render,!1),e;case 1:return e=be(e.type,!0),e;default:return``}}function Se(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 ae:return`Fragment`;case ie:return`Portal`;case se:return`Profiler`;case oe:return`StrictMode`;case x:return`Suspense`;case de:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case le:return(e.displayName||`Context`)+`.Consumer`;case ce:return(e._context.displayName||`Context`)+`.Provider`;case ue:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case fe:return t=e.displayName||null,t===null?Se(e.type)||`Memo`:t;case pe:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}function Ce(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`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return Se(t);case 8:return t===oe?`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 we(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ee(e){var t=Te(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function De(e){e._valueTracker||=Ee(e)}function Oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Te(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ke(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ae(e,t){var n=t.checked;return S({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function je(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=we(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Me(e,t){t=t.checked,t!=null&&te(e,`checked`,t,!1)}function Ne(e,t){Me(e,t);var n=we(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`)?Fe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Fe(e,t.type,we(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pe(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 Fe(e,t,n){(t!==`number`||ke(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ie=Array.isArray;function Le(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=We.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qe={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},Je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(qe).forEach(function(e){Je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),qe[t]=qe[e]})});function Ye(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||qe.hasOwnProperty(e)&&qe[e]?(``+t).trim():t+`px`}function C(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ye(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Xe=S({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 w(e,t){if(t){if(Xe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(i(62))}}function Ze(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 Qe=null;function $e(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var et=null,T=null,tt=null;function nt(e){if(e=Zi(e)){if(typeof et!=`function`)throw Error(i(280));var t=e.stateNode;t&&(t=$i(t),et(e.stateNode,e.type,t))}}function rt(e){T?tt?tt.push(e):tt=[e]:T=e}function it(){if(T){var e=T,t=tt;if(tt=T=null,nt(e),t)for(e=0;e>>=0,e===0?32:31-(Lt(e)/Rt|0)|0}var Bt=64,Vt=4194304;function Ht(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 Ut(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Ht(a))):r=Ht(s)}else o=n&~i,o===0?a!==0&&(r=Ht(a)):r=Ht(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))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 Yt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=n}function Xt(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=dr),mr=` `,hr=!1;function gr(e,t){switch(e){case`keyup`:return lr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function _r(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var vr=!1;function yr(e,t){switch(e){case`compositionend`:return _r(t);case`keypress`:return t.which===32?(hr=!0,mr):null;case`textInput`:return e=t.data,e===mr&&hr?null:e;default:return null}}function br(e,t){if(vr)return e===`compositionend`||!ur&&gr(e,t)?(e=Pn(),Nn=Mn=jn=null,vr=!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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Hr(n)}}function Wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gr(){for(var e=window,t=ke();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ke(e.document)}return t}function Kr(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 qr(e){var t=Gr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Wr(n.ownerDocument.documentElement,n)){if(r!==null&&Kr(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 i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ur(n,a);var o=Ur(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Yr=null,Xr=null,Zr=null,Qr=!1;function $r(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qr||Yr==null||Yr!==ke(r)||(r=Yr,`selectionStart`in r&&Kr(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}),Zr&&Vr(Zr,r)||(Zr=r,r=wi(Xr,`onSelect`),0ta||(e.current=ea[ta],ea[ta]=null,ta--)}function N(e,t){ta++,ea[ta]=e.current,e.current=t}var ra={},P=na(ra),F=na(!1),ia=ra;function aa(e,t){var n=e.type.contextTypes;if(!n)return ra;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function oa(e){return e=e.childContextTypes,e!=null}function sa(){M(F),M(P)}function ca(e,t,n){if(P.current!==ra)throw Error(i(168));N(P,t),N(F,n)}function la(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!=`function`)return n;for(var a in r=r.getChildContext(),r)if(!(a in t))throw Error(i(108,Ce(e)||`Unknown`,a));return S({},n,r)}function ua(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ra,ia=P.current,N(P,e),N(F,F.current),!0}function da(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=la(e,t,ia),r.__reactInternalMemoizedMergedChildContext=e,M(F),M(P),N(P,e)):M(F),N(F,n)}var fa=null,pa=!1,ma=!1;function ha(e){fa===null?fa=[e]:fa.push(e)}function ga(e){pa=!0,ha(e)}function _a(){if(!ma&&fa!==null){ma=!0;var e=0,t=A;try{var n=fa;for(A=1;e>=o,i-=o,Ta=1<<32-It(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),I&&Da(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),I&&Da(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return I&&Da(a,g),u}for(h=r(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),I&&Da(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===ae&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case ne:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===ae){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===pe&&Ka(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Wa(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===ae?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Wa(e,r,i),o.return=e,e=o)}return s(e);case ie:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case pe:return l=i._init,_(e,r,l(i._payload),o)}if(Ie(i))return h(e,r,i,o);if(ge(i))return g(e,r,i,o);Ga(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ja=qa(!0),Ya=qa(!1),Xa=na(null),Za=null,Qa=null,$a=null;function eo(){$a=Qa=Za=null}function to(e){var t=Xa.current;M(Xa),e._currentValue=t}function no(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ro(e,t){Za=e,$a=Qa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Hs=!0),e.firstContext=null)}function io(e){var t=e._currentValue;if($a!==e){if(e={context:e,memoizedValue:t,next:null},Qa===null){if(Za===null)throw Error(i(308));Qa=e,Za.dependencies={lanes:0,firstContext:e}}else Qa=Qa.next=e}return t}var ao=null;function oo(e){ao===null?ao=[e]:ao.push(e)}function so(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,oo(t)):(n.next=i.next,i.next=n),t.interleaved=n,co(e,r)}function co(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 lo=!1;function uo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fo(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 po(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,co(e,n)}return i=r.interleaved,i===null?(t.next=t,oo(r)):(t.next=i.next,i.next=t),r.interleaved=t,co(e,n)}function ho(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}function go(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 _o(e,t,n,r){var i=e.updateQueue;lo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=S({},d,f);break a;case 2:lo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Xc|=o,e.lanes=o,e.memoizedState=d}}function vo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Mo.transition;Mo.transition={};try{e(!1),t()}finally{A=n,Mo.transition=r}}function hs(){return Ho().memoizedState}function gs(e,t,n){var r=ml(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vs(e))ys(t,n);else if(n=so(e,t,n,r),n!==null){var i=Q();hl(n,e,r,i),bs(n,t,r)}}function _s(e,t,n){var r=ml(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vs(e))ys(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Br(s,o)){var c=t.interleaved;c===null?(i.next=i,oo(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=so(e,t,i,r),n!==null&&(i=Q(),hl(n,e,r,i),bs(n,t,r))}}function vs(e){var t=e.alternate;return e===R||t!==null&&t===R}function ys(e,t){Fo=Po=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}var xs={readContext:io,useCallback:V,useContext:V,useEffect:V,useImperativeHandle:V,useInsertionEffect:V,useLayoutEffect:V,useMemo:V,useReducer:V,useRef:V,useState:V,useDebugValue:V,useDeferredValue:V,useTransition:V,useMutableSource:V,useSyncExternalStore:V,useId:V,unstable_isNewReconciler:!1},Ss={readContext:io,useCallback:function(e,t){return Vo().memoizedState=[e,t===void 0?null:t],e},useContext:io,useEffect:is,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),ns(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){return ns(4,2,e,t)},useMemo:function(e,t){var n=Vo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vo();return t=n===void 0?t:n(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=gs.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=Vo();return e={current:e},t.memoizedState=e},useState:$o,useDebugValue:us,useDeferredValue:function(e){return Vo().memoizedState=e},useTransition:function(){var e=$o(!1),t=e[0];return e=ms.bind(null,e[1]),Vo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=R,a=Vo();if(I){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),J===null)throw Error(i(349));No&30||Jo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Xo.bind(null,r,o,e),[e]),r.flags|=2048,es(9,Yo.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Vo(),t=J.identifierPrefix;if(I){var n=Ea,r=Ta;n=(r&~(1<<32-It(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Io++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof r.is==`string`?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),n===`select`&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Wi]=t,e[Gi]=r,dc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ze(n,r),n){case`dialog`:j(`cancel`,e),j(`close`,e),a=r;break;case`iframe`:case`object`:case`embed`:j(`load`,e),a=r;break;case`video`:case`audio`:for(a=0;anl&&(t.flags|=128,r=!0,mc(s,!1),t.lanes=4194304)}}else{if(!r){if(e=Oo(c),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!I)return U(t),null}else 2*O()-s.renderingStartTime>nl&&n!==1073741824&&(t.flags|=128,r=!0,mc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(U(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=O(),t.sibling=null,n=L.current,N(L,r?n&1|2:n&1),t);case 22:case 23:return Tl(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?qc&1073741824&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function gc(e,t){switch(Aa(t),t.tag){case 1:return oa(t.type)&&sa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return To(),M(F),M(P),Ao(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Do(t),null;case 13:if(M(L),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(L),null;case 4:return To(),null;case 10:return to(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var _c=!1,W=!1,vc=typeof WeakSet==`function`?WeakSet:Set,G=null;function yc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function bc(e,t,n){try{n()}catch(n){$(e,t,n)}}var xc=!1;function Sc(e,t){if(Mi=wn,e=Gr(),Kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},wn=!1,G=t;G!==null;)if(t=G,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ts(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return h=xc,xc=!1,h}function Cc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&bc(t,n,a)}i=i.next}while(i!==r)}}function wc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,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 Tc(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 Ec(e){var t=e.alternate;t!==null&&(e.alternate=null,Ec(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wi],delete t[Gi],delete t[qi],delete t[Ji],delete t[Yi])),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 Dc(e){return e.tag===5||e.tag===3||e.tag===4}function Oc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Dc(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 a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function kc(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=ji));else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}function Ac(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(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}var K=null,jc=!1;function Mc(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount==`function`)try{Pt.onCommitFiberUnmount(Nt,n)}catch{}switch(n.tag){case 5:W||yc(n,t);case 6:var r=K,i=jc;K=null,Mc(e,t,n),K=r,jc=i,K!==null&&(jc?(e=K,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):K.removeChild(n.stateNode));break;case 18:K!==null&&(jc?(e=K,n=n.stateNode,e.nodeType===8?Bi(e.parentNode,n):e.nodeType===1&&Bi(e,n),Sn(e)):Bi(K,n.stateNode));break;case 4:r=K,i=jc,K=n.stateNode.containerInfo,jc=!0,Mc(e,t,n),K=r,jc=i;break;case 0:case 11:case 14:case 15:if(!W&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&bc(n,t,o),i=i.next}while(i!==r)}Mc(e,t,n);break;case 1:if(!W&&(yc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Mc(e,t,n);break;case 21:Mc(e,t,n);break;case 22:n.mode&1?(W=(r=W)||n.memoizedState!==null,Mc(e,t,n),W=r):Mc(e,t,n);break;default:Mc(e,t,n)}}function Pc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Fc(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=s),r&=~o}if(r=a,r=O()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Uc(r/1960))-r,10e?16:e,cl===null)var r=!1;else{if(e=cl,cl=null,ll=0,q&6)throw Error(i(331));var a=q;for(q|=4,G=e.current;G!==null;){var o=G,s=o.child;if(G.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lO()-tl?El(e,0):Qc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Vt,Vt<<=1,!(Vt&130023424)&&(Vt=4194304)):t=1);var n=Q();e=co(e,t),e!==null&&(Yt(e,t,n),gl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||F.current)Hs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Hs=!1,uc(e,t,n);Hs=!!(e.flags&131072)}}else Hs=!1,I&&t.flags&1048576&&Oa(t,xa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;cc(e,t),e=t.pendingProps;var a=aa(t,P.current);ro(t,n),a=zo(null,t,r,e,a,n);var o=Bo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,oa(r)?(o=!0,ua(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,uo(t),a.updater=Ds,t.stateNode=a,a._reactInternals=t,js(t,r,e,n),t=Xs(null,t,r,!0,o,n)):(t.tag=0,I&&o&&ka(t),H(null,t,a,n),t=t.child),t;case 16:r=t.elementType;a:{switch(cc(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Jl(r),e=Ts(r,e),a){case 0:t=Js(null,t,r,e,n);break a;case 1:t=Ys(null,t,r,e,n);break a;case 11:t=Us(null,t,r,e,n);break a;case 14:t=Ws(null,t,r,Ts(r.type,e),n);break a}throw Error(i(306,r,``))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),Js(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),Ys(e,t,r,a,n);case 3:a:{if(Zs(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,a=o.element,fo(e,t),_o(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ms(Error(i(423)),t),t=Qs(e,t,r,n,a);break a}if(r!==a){a=Ms(Error(i(424)),t),t=Qs(e,t,r,n,a);break a}for(Ma=Vi(t.stateNode.containerInfo.firstChild),ja=t,I=!0,Na=null,n=Ya(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Va(),r===a){t=lc(e,t,n);break a}H(e,t,r,n)}t=t.child}return t;case 5:return Eo(t),e===null&&La(t),r=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Pi(r,a)?s=null:o!==null&&Pi(r,o)&&(t.flags|=32),qs(e,t),H(e,t,s,n),t.child;case 6:return e===null&&La(t),null;case 13:return tc(e,t,n);case 4:return wo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ja(t,null,r,n):H(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),Us(e,t,r,a,n);case 7:return H(e,t,t.pendingProps,n),t.child;case 8:return H(e,t,t.pendingProps.children,n),t.child;case 12:return H(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,N(Xa,r._currentValue),r._currentValue=s,o!==null){if(Br(o.value,s)){if(o.children===a.children&&!F.current){t=lc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=po(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),no(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(i(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),no(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}H(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,ro(t,n),a=io(a),r=r(a),t.flags|=1,H(e,t,r,n),t.child;case 14:return r=t.type,a=Ts(r,t.pendingProps),a=Ts(r.type,a),Ws(e,t,r,a,n);case 15:return Gs(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ts(r,a),cc(e,t),t.tag=1,oa(r)?(e=!0,ua(t)):e=!1,ro(t,n),ks(t,r,a),js(t,r,a,n),Xs(null,t,r,!0,e,n);case 19:return sc(e,t,n);case 22:return Ks(e,t,n)}throw Error(i(156,t.tag))};function Wl(e,t){return wt(e,t)}function Gl(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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===fe)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(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 Xl(e,t,n,r,a,o){var s=2;if(r=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ae:return Zl(n.children,a,o,t);case oe:s=8,a|=8;break;case se:return e=Kl(12,n,t,a|2),e.elementType=se,e.lanes=o,e;case x:return e=Kl(13,n,t,a),e.elementType=x,e.lanes=o,e;case de:return e=Kl(19,n,t,a),e.elementType=de,e.lanes=o,e;case me:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ce:s=10;break a;case le:s=9;break a;case ue:s=11;break a;case fe:s=14;break a;case pe:s=16,r=null;break a}throw Error(i(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){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=Jt(0),this.expirationTimes=Jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},uo(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ie()})),oe=t((e=>{var t=ae();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),se=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new p({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ce(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){u.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>d(t,e))}findAll(e={}){return this.getAll().filter(t=>d(e,t))}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return u.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function ce(e){return e.options.scope?.id}var le=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new v({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){u.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){u.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){u.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new le,this.#t=e.mutationCache||new se,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=i.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=l.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(te(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return u.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;u.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return u.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=u.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return u.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=u.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(te(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return l.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(m(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{b(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(m(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{b(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=f(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===a&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},x=e(r(),1),de=e(oe(),1),fe=class extends Error{status;method;path;code;detail;constructor(e,t,n,r,i=``,a=``){super(e),this.name=`ApiError`,this.status=t,this.method=n,this.path=r,this.code=i,this.detail=a}};function pe(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{detail:``,code:``};try{let t=JSON.parse(e),n=t.detail&&typeof t.detail==`object`&&!Array.isArray(t.detail)?t.detail:void 0,r=typeof t.code==`string`&&t.code.trim()?t.code.trim():typeof n?.code==`string`?n.code.trim():``;if(n)for(let e of[`message`,`detail`]){let t=n[e];if(typeof t==`string`&&t.trim())return{detail:t.trim(),code:r}}for(let e of[`detail`,`error`,`message`]){let n=t[e];if(typeof n==`string`&&n.trim())return{detail:n.trim(),code:r};if(Array.isArray(n)){let e=n.map(e=>e&&typeof e==`object`?String(e.msg??``):``).filter(Boolean);if(e.length)return{detail:e.join(`; `),code:r}}}return{detail:``,code:r}}catch{}return{detail:t.startsWith(``u`?``:window.location.search).get(`reader_preview`);return e===`source-first`||e===`learning-path`||e===`question-foundation`?e:null}function S(e,t,n,r,i=ge(),a){let o=[`map-copy`,e,t,n,r];return i===`question-foundation`?[...o,i,a??null]:i?[...o,i]:o}var _e=`0.1.8+bc12d12d3456db98`,ve=!1,ye=new Set,be=()=>ve,xe=e=>(ye.add(e),()=>{ye.delete(e)});function Se(e){ve||!e||e===`unknown`||e===`0.1.8+bc12d12d3456db98`||(ve=!0,ye.forEach(e=>e()))}var Ce=class extends Error{constructor(){super(`页面已更新,请刷新后继续。 / This page has been updated. Refresh to continue.`),this.name=`PageUpdateRequiredError`}};function we(){if(ve)throw new Ce}var Te={name:`argus.webapi`,major:1,minServerMinor:16},Ee=[`daemon.admission.v1`,`daemon.status.protocol.v1`,`daemon.command.v1`,`daemon.upgrade-schedule.v1`,`cost.admission.v1`,`event.catalog.v1`,`event.payload-schema.v1`,`manager.sse.v1`,`manager.request-cancel.v1`,`advisor.config.v1`,`metrics.slo.v2`,`mission.view.v1`,`mission.abort.v1`,`project.attachments.v1`,`project.git-diff.v1`,`project.cost-feed.v1`,`project.counterexamples.v1`,`project.workdir.v1`,`research.events.v1`,`release.identity.v1`,`snapshot.schema.v1`,`source.update.v1`,`usage.recorded.v2`,`verticals.store.v1`],De=`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`;function Oe(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function ke(e){return typeof e==`number`&&Number.isInteger(e)?e:null}function Ae(e,t){let n=Oe(e),r=Oe(n?.protocol),i=Oe(n?.runtime),a=Array.isArray(n?.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],o=ke(r?.major),s=ke(r?.minor);if(!n||!r||!i)return{compatible:!1,reason:`malformed /api/meta response`};if(typeof i.source_root!=`string`||ke(i.pid)===null||typeof i.package_version!=`string`||typeof i.release_id!=`string`)return{compatible:!1,reason:`malformed /api/meta runtime identity`};if(n.service!==`argus-skill-webapi`)return{compatible:!1,reason:`unexpected service ${String(n.service||`unknown`)}`};let c=e;if(r.name!==Te.name||o!==Te.major)return{compatible:!1,reason:`protocol ${String(r.name||`unknown`)}/${String(o)} is incompatible with client ${Te.name}/${Te.major}`,meta:c};if(s===null||s!a.includes(e));if(l.length>0)return{compatible:!1,reason:`missing capabilities: ${l.join(`, `)}`,meta:c};if(i.source_root_matches_config===!1)return{compatible:!1,reason:`backend is running from a different installation than configured`,meta:c};if(t&&i.release_id!==t.releaseId)return{compatible:!1,reason:`backend and client installations are out of sync; restart or reinstall Argus`,meta:c};if(t?.sourceDigest){if(typeof i.runtime_source_digest!=`string`||!i.runtime_source_digest)return{compatible:!1,reason:`backend cannot verify this local installation; restart it from the current checkout`,meta:c};if(i.runtime_source_digest!==t.sourceDigest)return{compatible:!1,reason:`backend is running code from a different local installation; restart it`,meta:c}}let u=i.release_matches_source===!1?De:void 0;return{compatible:!0,reason:``,...u?{warning:u}:{},meta:c}}function je(e,t,n){let r=Ae(e,t);if(!r.compatible||!r.meta)throw Error(`incompatible Argus API: ${r.reason}`);return r.warning&&n?.(r.warning),r.meta}function Me(e){let t=Oe(e),n=Oe(t?.daemon);if(!t||t.schema_version!==7)throw Error(`incompatible snapshot schema: expected 7, got ${String(t?.schema_version??`missing`)}`);if(!n)throw Error(`invalid snapshot: daemon section is missing`);let r=[`read_status`,`read_error`,`protocol_compatible`,`protocol_error`].filter(e=>!Object.hasOwn(n,e));if(r.length>0)throw Error(`invalid snapshot: daemon fields missing: ${r.join(`, `)}`);let i=[`spend_usd`,`spend_status`,`usage_summary`,`daemon_commands`,`observability`,`mission_view`,`partial`,`diagnostics`].filter(e=>!Object.hasOwn(t,e));if(i.length>0)throw Error(`invalid snapshot: fields missing: ${i.join(`, `)}`);if(!Array.isArray(t.diagnostics))throw Error(`invalid snapshot: diagnostics must be an array`);return e}function Ne(e,t){return je(e,{releaseId:_e},t)}function Pe(e,t){let n=`/api/application-workflows`,r=e=>`${n}/${encodeURIComponent(e)}`;return{catalog:()=>e(n),create:e=>t(n,e),open:e=>t(`${n}/open`,{project:e}),snapshot:t=>e(r(t)),action:(e,n)=>t(r(e),n),document:(t,n)=>e(`${r(t)}/document?path=${encodeURIComponent(n)}`)}}var Fe=`verticals.store.v1`,Ie=`argus_web_token`,Le=null;function Re(){let e;try{e=new URLSearchParams(window.location.search)}catch{return}let t=e.get(`token`);if(t){Le=t;try{localStorage.setItem(Ie,t)}catch{}try{e.delete(`token`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)}catch{}}}var ze=()=>{if(Le)return Le;try{return new URLSearchParams(window.location.search).get(`token`)||localStorage.getItem(Ie)}catch{return null}};function Be(){let e=ze();return e?{Authorization:`Bearer ${e}`}:{}}function Ve(){return ze()??``}var He=8e3,Ue=12e3,We=class extends Error{constructor(){super(`This browser is not paired with Argus. Open a valid pairing link or enter a pairing token.`),this.name=`PairingRequiredError`}},Ge=class extends Error{method;path;constructor(e,t,n=`could not reach the local Argus service`){super(`${e.toUpperCase()} ${t} ${n}. Make sure Argus Desktop is running, then retry.`),this.name=`LocalArgusUnavailableError`,this.method=e.toUpperCase(),this.path=t}};function Ke(e){return e instanceof We||!!(e&&typeof e==`object`&&Number(e.status)===401)}function qe(e){return Ke(e)||e instanceof Ge}async function Je(e,t){let n;try{n=await fetch(e,t)}catch(n){throw t.signal?.aborted?n:new Ge(String(t.method??`GET`),e)}return n.ok&&(Se(n.headers.get(`X-Argus-Release`)),(!t.method||t.method===`GET`)&&we()),n}async function Ye(e,t,n,r){let i=new AbortController,a=t.signal??void 0,o=!1,s=()=>{};if(a){let e=()=>i.abort(a.reason);a.aborted?e():(a.addEventListener(`abort`,e,{once:!0}),s=()=>a.removeEventListener(`abort`,e))}let c,l=(async()=>await r(await Je(e,{...t,signal:i.signal})))(),u=new Promise((e,t)=>{c=setTimeout(()=>{o=!0;let e=Error(`request timed out after ${n}ms`);i.abort(e),t(e)},n)});try{return await Promise.race([l,u])}catch(r){if(o){let r=Math.round(n/1e3);throw new Ge(String(t.method??`GET`),e,`timed out after ${r}s because the local Argus service did not respond`)}throw r}finally{c&&clearTimeout(c),s()}}async function C(e,t,n){return Ye(e,{headers:Be(),signal:t},n??Ue,async t=>(await he(t,`GET`,e),await t.json()))}async function Xe(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:t===void 0?void 0:JSON.stringify(t),signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),r}async function w(e,t,n){return await(await Xe(e,t,n)).json()}async function Ze(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:Be(),body:t,signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),await r.json()}function Qe(e){let t=e&&typeof e==`object`?e:{},n=String(t.command_status??``);if(Number(t.rc??0)!==0||n===`failed`||n===`rejected`)throw Error(String(t.error||`daemon command ${n||`failed`}`));return e}async function $e(e,t,n){we();let r=await fetch(t,{method:e,headers:{"Content-Type":`application/json`,...Be()},body:n===void 0?void 0:JSON.stringify(n)});return await he(r,e,t),Se(r.headers.get(`X-Argus-Release`)),await r.json()}async function et(e,t){let n=await fetch(e,{headers:Be(),signal:t});return await he(n,`GET`,e),n.blob()}var T=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`;function tt(e,t){let n=new URLSearchParams({path:t}),r=Ve();return r&&n.set(`token`,r),T(e,`/artifact/preview/page?${n.toString()}`)}var nt=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,rt=nt,it;function at(e){return!!(e&&typeof e==`object`&&`aborted`in e&&typeof e.aborted==`boolean`)}function ot(e,t,n,r){let i={text:e};return t?.length&&(i.attachments=t),n&&n!==`auto`&&(i.route_override=n),r&&(i.request_id=r),i}function st(){if(!it){let e=(async()=>{let e=`/api/meta`,t=await Ye(e,{headers:Be()},He,async t=>{if(t.status===404)throw Error(`incompatible Argus API: service does not expose /api/meta`);await he(t,`GET`,e);let n=await t.json();return Se(n?.runtime?.release_id),Ne(n,e=>{e!==`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`&&console.warn(`Argus API compatibility warning: ${e}`)})});if(t.authentication?.required&&!t.authentication.authenticated)throw new We;return t})();it=e,e.catch(t=>{it===e&&!(t instanceof We)&&(it=void 0)})}return it}var ct=new Set([`waiting_for_source`,`planning`,`writing`,`reviewing`]);function lt(e){let t=[],n;for(;n=/\r?\n\r?\n/.exec(e);){let r=e.slice(0,n.index);e=e.slice(n.index+n[0].length);for(let e of r.split(` +`)){let n=e.trim();if(n.startsWith(`data:`))try{t.push(JSON.parse(n.slice(5).trim()))}catch{}}}return{frames:t,rest:e}}async function ut(e,t,n,r){if(!e.body)throw Error(`${t} returned no response body`);let i=e.body.getReader(),a=new TextDecoder,o=``,s,c=!1;try{for(;;){r?.throwIfAborted();let{done:e,value:l}=await i.read();c=e,r?.throwIfAborted(),o+=e?a.decode()+` + +`:a.decode(l,{stream:!0});let u=lt(o);o=u.rest;for(let e of u.frames)n?.(e),(e.type===`done`||e.type===`error`)&&(s=e);if(e){if(!s)throw Error(`${t} ended before a terminal event`);return s}}}finally{c||await i.cancel().catch(()=>{}),i.releaseLock()}}var dt=null;function ft(e,t,n,r,i=ge(),a){let o=new URLSearchParams(n);return r&&o.set(`session_id`,r),i===`source-first`&&o.set(`preview`,`true`),i===`learning-path`&&o.set(`preview`,`learning-path`),i===`question-foundation`&&(o.set(`preview`,`question-foundation`),a&&o.set(`foundation_id`,a)),`/api/map-copy/${e}/${encodeURIComponent(t)}?${o}`}async function pt(e,t,n,r){let i=await Xe(e,t,n),a=!1,o=await ut(i,`Explanation stream`,e=>{(e.type===`done`||e.type===`error`)&&(a=!0),!a&&e.type===`progress`&&ct.has(e.phase)&&r?.(e.phase)},n);if(o.type===`error`){let t=o.error&&typeof o.error==`object`?o.error:void 0;throw new fe(String(t?.message??o.error??`Explanation failed`),typeof o.status==`number`?o.status:0,`POST`,e,typeof t?.code==`string`?t.code:``)}return o.result}var E={workflows:Pe(C,w),advisorSettings:(e,t)=>C(T(e,`/advisor/config`),t),saveAdvisorSettings:(e,t)=>w(T(e,`/advisor/config`),t),liveMap:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r?.mode===`current`&&(i.set(`since`,String(r.since)),i.set(`event_since`,String(r.eventSince)),r.taskId&&i.set(`start_task`,r.taskId)),C(T(e,`/map`)+(i.size?`?${i}`:``),t)},mapInfo:(e,t)=>C(T(e,`/map-info`),t),mapHistory:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r&&i.set(`task_after`,r),C(T(e,`/map-history`)+(i.size?`?${i}`:``),t)},mapCopy:(e,t,n,r,i,a,o)=>C(ft(e,t,{locale:n},i,a,o),r),mapCardWords:(e,t,n,r,i)=>w(`/api/map-cards/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapLines:(e,t,n,r,i)=>w(`/api/map-lines/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapQuestionSource:(e,t,n)=>w(`/api/map-question-source/project/${encodeURIComponent(e)}?session_id=${encodeURIComponent(e)}`,{...t,preview:t.preview===`source-first`?!0:t.preview??!1},n),generateMapCopy:(e,t,n,r,i,a,o)=>pt(ft(e,t,{stream:`true`},i,a,n.foundation_id),n,r,o),generateReaderFoundation:(e,t,n)=>pt(T(e,`/reader-foundation?stream=true`),t,void 0,n),askReaderFoundation:(e,t,n,r)=>pt(T(e,`/reader-foundation/${encodeURIComponent(t)}/question?stream=true`),n,void 0,r),mapDatasets:e=>C(`/api/map-datasets`,e),mapDataset:(e,t)=>C(`/api/map-datasets/${encodeURIComponent(e)}`,t),meta:st,projectIndex:async()=>(await st(),C(`/api/projects`,void 0,Ue)),listProjects:async()=>(await st(),C(`/api/projects`,void 0,Ue).then(e=>e.projects)),projectCosts:async e=>(await st(),C(`/api/projects/costs`,e)),createDaemon:async(e,t=``,n=``,r)=>{let i=`/api/daemons`,a={objective:e,name:t,workdir:n,command_id:rt(),expected_revision:r},o=()=>fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify(a),cache:`no-store`}),s=await o();return s.status===400&&/Invalid HTTP request received/i.test(await s.clone().text())&&(s=await o()),await he(s,`POST`,i),Qe(await s.json())},updateProject:(e,t)=>$e(`PATCH`,T(e),{name:t}),deleteProject:e=>$e(`DELETE`,T(e)),snapshot:async(e,t,n=!1)=>(await st(),Me(await C(T(e,`/snapshot?compact=true&events_limit=1${n?`&prewarm=true`:``}`),t,Ue))),activeSnapshot:async(e,t)=>{let n=dt!==e;n&&(dt=e);try{return await E.snapshot(e,t,n)}catch(t){throw n&&dt===e&&(dt=null),t}},prefetchSnapshot:(e,t)=>E.snapshot(e,t,!1),status:(e,t)=>C(T(e,`/status`),t),journal:(e,t=20,n)=>C(T(e,`/journal?n=${t}`),n).then(e=>e.journal),doctor:(e,t)=>C(T(e,`/doctor`),t),config:(e,t)=>C(T(e,`/config`),t),identity:(e,t)=>C(T(e,`/identity`),t).then(e=>e.identity),transcript:(e,t=30,n)=>C(T(e,`/transcript?n=${t}`),n).then(e=>e.turns),events:(e,t=80,n)=>C(T(e,`/events?limit=${t}&view=ui`),n).then(e=>e.events),workRecord:(e,t,n,r)=>C(T(e,`/work-record?role=${encodeURIComponent(t)}&record_id=${encodeURIComponent(n)}`),r),downloadWorkLog:async(e,t,n=``)=>{let r=T(e,`/work-log/download?role=${encodeURIComponent(t)}&task_id=${encodeURIComponent(n)}`),i=await fetch(r,{headers:Be(),cache:`no-store`});await he(i,`GET`,r);let a=URL.createObjectURL(await i.blob()),o=document.createElement(`a`);o.href=a,o.download=`work-records.md`,o.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)},backlogItem:(e,t,n)=>C(T(e,`/backlog/${encodeURIComponent(t)}`),n).then(e=>e.item),artifacts:(e,t,n=!1)=>C(T(e,`/artifacts${n?`?include_reading=true`:``}`),t).then(e=>e.artifacts),artifact:(e,t,n)=>C(T(e,`/artifact?${new URLSearchParams({path:t})}`),n),artifactPreview:(e,t,n)=>C(T(e,`/artifact/preview?${new URLSearchParams({path:t})}`),n),artifactBundle:(e,t,n)=>et(T(e,`/artifact/bundle?${new URLSearchParams({path:t})}`),n),artifactBlob:(e,t,n=!1,r)=>{let i=new URLSearchParams({path:t});return n&&i.set(`download`,`true`),et(T(e,`/artifact/raw?${i}`),r)},gitDiff:(e,t)=>C(T(e,`/git-diff`),t),deliveryDiff:(e,t,n)=>C(T(e,`/delivery-diff?${new URLSearchParams(t)}`),n),metrics:e=>C(`/api/metrics`,e),sourceUpdateStatus:e=>C(`/api/runtime/source-update`,e),checkSourceUpdate:()=>w(`/api/runtime/source-update/check`),applySourceUpdate:()=>w(`/api/runtime/source-update/apply`),resources:e=>C(`/api/system/resources`,e),trash:(e=``,t=100,n=0,r)=>C(`/api/trash?${new URLSearchParams({query:e,limit:String(t),offset:String(n)})}`,r),restoreTrash:e=>w(`/api/trash/${encodeURIComponent(e)}/restore`),verticals:e=>C(`/api/verticals`,e),refreshVerticalCatalog:()=>w(`/api/verticals/catalog/refresh`),manageVertical:(e,t,n={})=>w(`/api/verticals/${encodeURIComponent(e)}/manage/${t}`,n.force?{force:!0}:{}),verticalOperation:(e,t)=>C(`/api/verticals/${encodeURIComponent(e)}/operation`,t),addTask:(e,t)=>w(T(e,`/tasks`),{text:t}).then(e=>e.item),abortMission:(e,t)=>w(T(e,`/mission/abort`),{reason:t}),mapNotes:(e,t)=>C(T(e,`/map-notes`),t),addMapNote:(e,t)=>w(T(e,`/map-notes`),t),answerPending:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/answer`),{text:n}),resolveDecision:(e,t,n,r)=>w(T(e,`/decisions/${encodeURIComponent(t)}/resolve`),{option_id:n,note:r}),uploadAttachments:async(e,t,n)=>{await st();let r=new FormData;return t.forEach(e=>r.append(`files`,e,e.name)),Ze(T(e,`/attachments`),r,n)},answerDomain:(e,t,n,r)=>w(T(e,`/message`),{text:r||n,domain_answer:{id:t,option_id:n,note:r}}),message:(e,t,n)=>{let r=at(n)?n:n?.signal,i=at(n)?void 0:n?.attachments,a=at(n)?void 0:n?.routeOverride,o=at(n)?void 0:n?.requestId;return w(T(e,`/message`),ot(t,i,a,o),r)},cancelMessage:(e,t)=>Ye(T(e,`/message/cancel`),{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify({request_id:t})},5e3,async t=>(await he(t,`POST`,T(e,`/message/cancel`)),await t.json())),messageStream:async(e,t,n,r)=>{let i=at(r)?r:r?.signal,a=at(r)?void 0:r?.attachments,o=at(r)?void 0:r?.routeOverride,s=at(r)?void 0:r?.requestId;await ut(await Xe(T(e,`/message/stream`),ot(t,a,o,s),i),`Manager stream`,e=>{if(!i?.aborted){if(e.type===`phase`){let t=Number(e.quiet_s??0);n.onPhase?.(String(e.label??``),String(e.role??`manager`),{heartbeat:e.heartbeat===!0,quietS:Number.isFinite(t)?t:0,kind:String(e.kind??``),detail:String(e.detail??``),tool:String(e.tool??``),toolKind:String(e.tool_kind??``),callId:String(e.call_id??``),status:String(e.status??``),output:String(e.output??``)})}else e.type===`delta`?n.onDelta?.(String(e.text??``),String(e.message_id??``),String(e.fragment_mode??`auto`)):e.type===`done`?n.onDone?.(e.result??{}):e.type===`error`&&n.onError?.(Error(String(e.error??`stream error`)))}},i)},nudge:(e,t)=>w(T(e,`/nudge`),{text:t}),queueFollowup:(e,t,n=`auto`)=>w(T(e,`/message/followup`),{text:t,route_override:n}),note:(e,t)=>w(T(e,`/note`),{text:t}),previewPlan:(e,t)=>w(T(e,`/plan`),{text:t}),rewritePrompt:(e,t)=>w(T(e,`/prompt/rewrite`),{text:t}),setConfig:(e,t,n,r=!1)=>w(T(e,`/config/set`),r?{name:t,value:n,apply_to_roles:!0}:{name:t,value:n}),setIdentity:(e,t)=>w(T(e,`/identity`),{text:t}),resetManager:e=>w(T(e,`/reset`)),skills:(e,t=`ls`)=>w(T(e,`/skills`),{args:t}).then(e=>e.text),skillLibrary:(e,t)=>C(`/api/skill-library${e?`?sid=${encodeURIComponent(e)}`:``}`,t),skillDocument:(e,t,n,r)=>C(`/api/skill-library/document?${new URLSearchParams({library:t,path:n,...e?{sid:e}:{}})}`,r),researchMethod:(e,t)=>C(T(e,`/research/method`),t),wiki:(e,t)=>C(T(e,`/wiki`),t),wikiPage:(e,t,n)=>C(T(e,`/wiki/page?${new URLSearchParams({path:t})}`),n),wikiLibrary:(e,t)=>C(`/api/wiki${e?`?sid=${encodeURIComponent(e)}`:``}`,t),wikiDocument:(e,t,n,r,i)=>C(`/api/wiki/page?${new URLSearchParams({scope:t,vertical:n,path:r,...e?{sid:e}:{}})}`,i),knowledgeFeed:(e=50,t)=>C(`/api/knowledge/feed?${new URLSearchParams({limit:String(e)})}`,t),learningStatus:(e,t)=>C(T(e,`/learning`),t),retryLearning:(e,t)=>w(T(e,`/learning/${encodeURIComponent(t)}/retry`),{}),setLaunchCwd:(e,t)=>w(T(e,`/launch-cwd`),{launch_cwd:t}),setWorkdir:(e,t)=>w(T(e,`/workdir`),{workdir:t}),disposeBacklog:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/dispose`),{op:n}),stopBacklog:(e,t)=>w(T(e,`/backlog/${encodeURIComponent(t)}/stop`)),setContinuous:(e,t,n=``)=>w(T(e,`/continuous`),{enabled:t,objective:n}).then(e=>{if(!t)return e;if(!e.daemon)throw Error(`daemon start returned no result`);return Qe(e.daemon),e}),startDaemon:(e,t)=>w(T(e,`/daemon/start`),{command_id:rt(),expected_revision:t}).then(Qe),stopDaemon:(e,t=!1,n,r=!1)=>w(T(e,`/daemon/stop`),{drain:t,force:r,command_id:rt(),expected_revision:n}).then(Qe),replaceDaemon:(e,t,n=!1,r)=>w(T(e,`/daemon/replace`),{victim_sid:t,resume_continuous:n,command_id:rt(),expected_revision:r}).then(Qe),upgradeDaemon:(e,t)=>w(T(e,`/daemon/upgrade`),{command_id:rt(),expected_revision:t}).then(Qe)},mt=new Set([4401,4404]);function ht(e,t,n={}){let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=new URLSearchParams;n.replay!=null&&i.set(`replay`,String(n.replay)),i.set(`view`,`ui`);let a=ze();a&&i.set(`token`,a);let o=`${r}//${window.location.host}${T(e,`/stream`)}?${i}`,s=null,c=!1,l,u=()=>{c||(s=new WebSocket(o),s.onopen=()=>n.onOpen?.(),s.onmessage=e=>{try{let n=JSON.parse(e.data);n&&typeof n==`object`&&t(n)}catch{}},s.onclose=e=>{let t=!mt.has(e.code);n.onClose?.({code:e.code,reason:e.reason,retryable:t}),!c&&t&&(l=setTimeout(u,1e3))},s.onerror=()=>s?.close())};return u(),()=>{c=!0,l&&clearTimeout(l),s?.close()}}var gt={schema:1,id:`argus`,name:`Argus`,tagline:`Autonomous Work Lab`,terminal_wordmark:`argus`,assets:{}};function _t(e){if(!e||typeof e!=`object`)throw Error(`Invalid application brand`);let t=e;if(t.schema!==1||typeof t.id!=`string`||!/^[a-z][a-z0-9-]{0,39}$/.test(t.id))throw Error(`Invalid application brand identity`);for(let[e,n]of[[`name`,48],[`tagline`,100],[`terminal_wordmark`,24]]){let r=t[e];if(typeof r!=`string`||!r.trim()||r.length>n||/[\x00-\x1f\x7f-\x9f]/.test(r))throw Error(`Invalid application brand ${e}`)}if(!/^[a-z0-9 -]+$/.test(String(t.terminal_wordmark)))throw Error(`Invalid terminal wordmark`);if(!t.assets||typeof t.assets!=`object`||Array.isArray(t.assets))throw Error(`Invalid application brand assets`);let n={};for(let e of[`mark`,`mark_dark`,`logo`,`logo_dark`,`icon`,`icon_dark`]){let r=t.assets[e];if(r!==void 0&&r!==`/api/application-brand/assets/${e}`)throw Error(`Invalid application brand asset ${e}`);if(typeof r==`string`)n[e]=r;else if(t.id!==`argus`)throw Error(`Missing application brand asset ${e}`)}return{schema:1,id:t.id,name:String(t.name),tagline:String(t.tagline),terminal_wordmark:String(t.terminal_wordmark),assets:n}}var vt=gt,yt=()=>vt;async function bt(){let e=await fetch(`/api/application-brand`,{cache:`no-store`});if(!e.ok)throw Error(`Application identity unavailable (${e.status})`);if(vt=_t(await e.json()),vt.id!==`argus`){document.title=`${vt.name} · Workbench`,document.querySelector(`meta[name="apple-mobile-web-app-title"]`)?.setAttribute(`content`,vt.name),document.querySelector(`link[rel="manifest"]`)?.setAttribute(`href`,`/api/application-brand/manifest.webmanifest`);for(let e of document.querySelectorAll(`link[rel="icon"], link[rel="apple-touch-icon"]`))e.href=e.media.includes(`dark`)?vt.assets.icon_dark:vt.assets.icon,e.removeAttribute(`type`)}}var D=n(),xt=`argus.locale`,St={"language.english":`English`,"handshake.connecting":`Getting Argus ready`,"handshake.service":`Service`,"handshake.project":`Project`,"handshake.ready":`Ready`,"handshake.title":`Getting Argus ready`,"handshake.detail":`Reopening your workspace…`,"splash.starting":`Argus starting`,"rail.workbench":`Workbench`,"rail.sessionsShortcut":`Sessions · Ctrl/⌘ P`,"panel.backlog":`Backlog`,"panel.activity":`Activity`,"panel.journal":`Journal`,"panel.roles":`Roles`,"panel.project":`Project`,"panel.liveView":`Manager live project view`,"stream.jumpToLatest":`Jump to latest`,"stream.toggleReasoning":`Show or hide agent reasoning (⌘T)`,"stream.reasoning":`Reasoning`,"stream.noLogs":`No activity yet`,"stream.system":`Argus updates`,"stream.autonomous":`Background activity`,"stream.backgroundWork":`Argus is working in the background`,"stream.ready":`Argus is ready. Ask a question or assign work.`,"stream.historyLoading":`Loading conversation history…`,"stream.historyError":`Could not load conversation history.`,"stream.historyRetry":`Retry`,"stream.fold.read":`Read {count} files`,"stream.fold.search":`Searched {count} times`,"stream.fold.fetch":`Looked up {count} web pages`,"stream.fold.edit":`Edited {count} files`,"stream.fold.tool":`Used {tool} {count} times`,"stream.fold.failed":`{count} failed`,"stream.fold.expand":`Show each step`,"stream.fold.collapse":`Hide the steps`,"stream.repeated":`Repeated {count} times; showing the latest`,"stream.stepFailed":`failed`,"stream.stepResult":`Result`,"common.showRaw":`Show raw output`,"doctor.lastEntry":`Last entry`,"operations.metric.calls":`model calls today`,"operations.metric.failed":`failed`,"operations.metric.slowest":`slowest typical call`,"operations.slo.healthy":`Healthy`,"operations.slo.degraded":`Needs attention`,"operations.slo.loading":`Loading…`,"operations.validationFailures":`{count} malformed events today`,"operations.outputLines":`{count} lines of output`,"operations.done":`Done.`,"newDaemon.workdirPlaceholder":`Blank → ~/.argus-skill/workspaces/`,"operations.resetManager":`Reset Manager context`,"language.chinese":`中文`,"language.switchTo":`Switch to {language}`,"common.loading":`Loading…`,"common.retry":`Retry`,"common.save":`Save`,"common.cancel":`Cancel`,"common.close":`Close`,"common.settings":`Settings`,"common.ready":`Ready`,"common.live":`Live`,"common.reconnecting":`Reconnecting`,"common.stale":`Snapshot stale`,"common.degraded":`Snapshot degraded`,"common.external":`External`,"common.pause":`Pause`,"common.run":`Run`,"common.working":`Working`,"common.local":`Local`,"common.all":`All`,"common.unassigned":`Unassigned`,"common.closeSessions":`Close sessions`,"common.resizeSessions":`Resize sessions`,"common.resizePreview":`Resize preview`,"common.expandPreview":`Expand preview`,"time.justNow":`just now`,"time.minutesAgo":`{count}m ago`,"time.hoursAgo":`{count}h ago`,"time.yesterdayAt":`Yesterday at {time}`,"connection.pairingTitle":`This browser is not paired with Argus`,"connection.pairingDetail":`Open a valid pairing link for this Argus site, or paste the link or token below.`,"connection.pairAgain":`Pair again`,"connection.pairingInput":`Pairing link or token`,"connection.pairingPlaceholder":`Paste a fresh pairing link or token`,"connection.pairingInvalid":`Enter a valid pairing link or token.`,"connection.connect":`Connect`,"connection.unreachableTitle":`The local Argus service is unavailable`,"connection.unreachableDetail":`Keep Argus Desktop running, wait for the local service to become ready, then retry.`,"sidebar.collapse":`Collapse sessions`,"sidebar.expand":`Expand sessions`,"sidebar.create":`Create project`,"sidebar.find":`Find a project`,"sidebar.clearSearch":`Clear search`,"sidebar.refreshFailed":`Refresh failed · retry`,"sidebar.noSessions":`No sessions`,"sidebar.noMatches":`No sessions matching "{query}"`,"sidebar.unnamedSession":`Unnamed session`,"sidebar.daemonAlive":`Argus background is online`,"sidebar.updateRequired":`Update required`,"sidebar.updateAvailable":`Update available`,"sidebar.updateAvailableHint":`The executor is still running with a different release from this page.`,"sidebar.stopped":`Background stopped`,"sidebar.runningFor":`Background online · {uptime}`,"sidebar.lastActive":`Last active {time}`,"sidebar.manage":`Manage {name}`,"sidebar.manageHint":`Rename, pause, or delete`,"sidebar.resume":`Resume`,"sidebar.resumeHint":`Resume work in {workdir}`,"sidebar.resumeSuccess":`Session resumed.`,"sidebar.resumeFailed":`Could not resume session: {error}`,"sidebar.modelLoading":`Loading backend and model…`,"sidebar.modelUnavailable":`Backend and model unavailable`,"sidebar.defaultModel":`default model`,"sidebar.openSettings":`Open settings`,"sidebar.compute":`Compute queue & allowance`,"sidebar.theme":`{current} theme; switch to {next}`,"landing.selectOrCreate":`Select a session from the sidebar, or create a new one.`,"landing.noSessions":`No sessions yet. Create one to begin.`,"landing.select":`Select project`,"landing.new":`New project`,"landing.menu":`Open menu`,"project.missingSwitched":`Project “{requested}” was not found. Switched to {fallback}.`,"project.missingCreate":`Project “{requested}” was not found. Create a project to continue.`,"topbar.openSessions":`Open projects`,"topbar.externallyManaged":`Externally managed`,"topbar.pauseDaemon":`Pause Argus`,"topbar.runDaemon":`Run Argus`,"topbar.working":`Argus is working on your request`,"topbar.roleActive":`{role} is active`,"topbar.roleIdle":`{role} is idle`,"topbar.externalDaemonHint":`Argus is managed outside this app and must be controlled there.`,"topbar.manageSession":`Manage session`,"topbar.showPreview":`Show preview`,"topbar.showActivity":`Show activity`,"mobile.views":`Views`,"mobile.sessions":`Projects`,"mobile.mission":`Mission`,"mobile.activity":`Conversation`,"mobile.workbench":`Workbench`,"mobile.map":`Map`,"mobile.preview":`Files`,"chat.working":`Argus is working on your message`,"chat.workingQuiet":`Argus is working on your message · Still working; no new update for {quiet}s`,"chat.stopWaitingHint":`Esc stop reply · Enter sends a follow-up`,"chat.queuedWhileRunning":`Queued · answered right after this reply; a running task can be steered by it`,"chat.attachWhileRunning":`Attachments can be sent once this reply finishes`,"chat.stepsLive":`Working · {count} steps so far`,"chat.stepsDone":`{count} steps · {seconds}`,"chat.stepFailed":`failed`,"chat.stepRaw":`raw`,"chat.messageArgus":`message Argus`,"chat.selectSession":`Select a session…`,"chat.placeholder":`Ask a question or assign work`,"chat.routeLabel":`message category`,"chat.routeHint":`For this message only. Argus chooses one worker or a team based on the request; greetings stay in conversation.`,"chat.routeTask":`Task`,"chat.routeAuto":`Auto`,"chat.routeChat":`Chat`,"chat.attach":`attach files`,"chat.attachHint":`PNG, JPEG, WebP, PDF, Markdown/text, JSON, CSV · up to {count} files, {perFile} each, {total} total`,"chat.attachDrop":`Drop files to attach`,"chat.attachRemove":`remove attachment {name}`,"chat.attachUnsupported":`{name} is not supported. Use PNG, JPEG, WebP, PDF, Markdown/text, JSON, or CSV.`,"chat.attachTooLarge":`{name} exceeds the {size} per-file limit.`,"chat.attachTooMany":`You can attach up to {count} files per message.`,"chat.attachTotalTooLarge":`Attachments exceed the {size} total limit.`,"chat.attachmentUploadFailed":`Attachment upload failed: {error}`,"chat.uploadingAttachments":`Uploading attachments`,"chat.rewriteHint":`Let the Manager rewrite this prompt into a brief the team can act on. Nothing is sent — the rewrite lands back in this box for you to edit.`,"chat.rewriteLabel":`rewrite prompt with the Manager`,"chat.rewriting":`rewriting`,"chat.rewrite":`Rewrite text`,"chat.stopWaiting":`stop reply`,"chat.stopWaitingTitle":`Stop this Manager request`,"chat.stoppingReply":`Stopping this reply…`,"chat.stopReplyRequested":`Stop requested. You can send another message.`,"chat.replyAlreadyFinished":`This reply has already finished.`,"chat.stopReplyFailed":`Could not stop the server request: {error}`,"chat.send":`send message`,"copy.message":`Copy`,"copy.code":`Copy code`,"copy.copied":`Copied`,"help.title":`Keyboard shortcuts`,"help.commands":`Commands`,"help.palette":`command palette`,"help.sessions":`toggle sessions`,"help.managerChat":`focus Manager chat`,"help.rewrite":`rewrite the current prompt before sending`,"help.reasoning":`toggle agent reasoning`,"help.kiosk":`toggle kiosk (read-only) mode`,"help.composer":`focus the composer`,"help.send":`send message`,"help.newline":`insert newline`,"help.thisHelp":`this help`,"help.escape":`close overlay / stop waiting in composer`,"palette.placeholder":`Type a command or search…`,"palette.noMatches":`no matching commands`,"palette.navigate":`↑↓ navigate`,"palette.run":`↵ run`,"palette.close":`esc close`,"palette.view":`View`,"palette.action":`Action`,"palette.project":`Project`,"palette.newDaemon":`New session`,"palette.openTranscript":`Open Transcript`,"palette.openProject":`Open Project`,"palette.projectHint":`work · memory · agents`,"palette.openOperations":`Open Operations`,"palette.operationsHint":`session controls`,"palette.hideReasoning":`Hide reasoning`,"palette.showReasoning":`Show reasoning`,"palette.exitKiosk":`Exit kiosk mode`,"palette.enterKiosk":`Enter kiosk mode`,"palette.messageArgus":`Message Argus…`,"palette.stopWaiting":`Stop Manager reply`,"palette.stopContinuous":`Stop continuous campaign`,"palette.startContinuous":`Start continuous campaign`,"palette.stopDaemon":`Pause Argus`,"palette.startDaemon":`Run Argus`,"slash.suggestions":`Slash command suggestions`,"mission.roleActive":`{role} active`,"mission.overview":`mission overview`,"mission.operations":`Operations`,"role.manager":`Manager`,"role.manager.description":`Understands your goal and coordinates work`,"role.planner":`Planner`,"role.planner.description":`Breaks down the problem, schedules work, and revises the plan`,"role.engineer":`Engineer`,"role.engineer.description":`Researches, writes proofs or code, and uses tools to check the work`,"role.reviewer":`Reviewer`,"role.reviewer.description":`Checks results and evidence and identifies gaps`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`You`,"doctor.title":`Doctor`,"doctor.subtitle":`Argus status checks + recommended root-cause fix`,"doctor.recommended":`recommended fix`,"doctor.loadError":`Couldn’t load diagnostics.`,"doctor.empty":`No diagnostic data available`,"doctor.daemonLog":`Daemon log`,"settings.subtitle":`effective roles, budgets, and essential controls`,"settings.loadError":`Couldn’t load configuration.`,"settings.empty":`No configuration found`,"settings.quickConfig":`Quick Config`,"settings.appearance":`Appearance`,"settings.appearanceHint":`Choose the interface colour treatment. Logos and icons always remain monochrome.`,"settings.themeStyle":`Theme colour`,"settings.themeStyle.standard":`Standard`,"settings.themeStyle.standardHint":`Quiet black, white, grey, and blue.`,"settings.themeStyle.gradient":`Gradient`,"settings.themeStyle.gradientHint":`The classic Argus blue-to-gold background.`,"settings.backend":`Backend`,"settings.backendSource.env":`set by the server environment`,"settings.backendSource.persisted":`saved setting`,"settings.backendSource.default":`built-in default`,"settings.backendWillSave":`Apply saves {backend}.`,"settings.backendWillReplace":`Apply replaces the saved {saved} with {backend}.`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`Backend saved as {backend}. Restart Argus to apply.`,"settings.backendUnsupported":`Unsupported backend ({backend})`,"settings.backendUnavailable":`Backend unavailable`,"settings.model":`Model`,"settings.trialAccount":`Trial account`,"settings.trialKeyHint":`Replace your Key here when its allowance runs out. Your projects and conversations stay in place.`,"settings.changeTrialKey":`Change Key`,"settings.applyModel":`Apply`,"settings.modelPlaceholder":`auto (backend default)`,"settings.connection":`Connection`,"settings.webApi":`Web + REST API`,"settings.eventStream":`Live updates`,"settings.taskDaemon":`Background work`,"settings.taskDaemonValue":`Local process · events.jsonl · no TCP port`,"chat.messageTooLong":`Message exceeds 32,000 characters. Shorten it or upload a file. Your draft is preserved.`,"settings.required":`{field} is required`,"settings.advanced":`Advanced`,"settings.advancedHint":`Budgets, the advisor model, explanation effort, connection details and raw configuration`,"settings.mapModel":`Map`,"settings.mapModelFollows":`Follows the front-door model`,"settings.mapModelSet":`Map explanations now use {model}.`,"settings.overrideTitle":`Environment override`,"settings.overrideHint":`Set a specific config alias or environment-variable key.`,"settings.namePlaceholder":`name or alias, e.g. manager_model`,"settings.valuePlaceholder":`value`,"settings.applyAdvanced":`Apply environment override`,"settings.applied":`Applied. Restart affected sessions to use the new settings.`,"settings.modelAppliedToRoles":`Every role now uses {model}. Sessions already running keep their model until they restart.`,"settings.rolesRunning":`Roles now run:`,"settings.applyUnifies":`Apply sets all of them to the model above.`,"settings.rolesTitle":`Effective roles`,"settings.rawConfig":`Raw configuration`,"settings.group.limits":`Limits`,"settings.group.safety":`Safety`,"settings.group.interface":`Interface`,"settings.knob.activeDaemons":`Active session limit`,"settings.knob.activeDaemonsDoc":`Maximum background sessions running on this host.`,"settings.knob.safeMode":`Safe mode`,"settings.knob.safeModeDoc":`Enable extra-conservative runtime guardrails.`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`Enable the Telegram notification bridge.`,"settings.knob.showReasoning":`Show reasoning`,"settings.knob.showReasoningDoc":`Stream role reasoning into the activity view.`,"settings.knob.operatorAvailable":`Operator available`,"settings.knob.operatorAvailableDoc":`Off suppresses operator questions: Argus decides on recorded assumptions and blocks on operator-only actions.`,"noOperator.banner":`No-operator mode: questions suppressed. Argus decides on recorded assumptions instead of asking you.`,"noOperator.turnOff":`Ask me again`,"settings.source.notApplicable":`Not applicable for this model`,"settings.source.vaultDefault":`Capability vault / default`,"settings.source.default":`Default`,"settings.modelUnavailable":`unavailable`,"settings.modelOfflineList":`Offline list: the backend did not return its live models, showing the harness catalog.`,"settings.source.saved":`Saved override`,"settings.source.environment":`Environment variable`,"settings.source.hostConfig":`Host configuration`,"settings.source.other":`Resolved configuration`,"settings.value.enabled":`Enabled`,"settings.value.disabled":`Disabled`,"settings.effort.low":`Low effort`,"settings.effort.medium":`Medium effort`,"settings.effort.high":`High effort`,"settings.effort.xhigh":`Extra-high effort`,"settings.role.curator":`Curator`,"settings.role.curatorDoc":`Maintains and distills the reusable skill pool.`,"settings.footer":`Human-readable labels are shown with raw keys. The full registry remains available via`,"identity.title":`Identity`,"identity.subtitle":`who argus is working for on this project`,"identity.placeholder":`Describe who Argus is working for and durable preferences…`,"identity.save":`Save identity`,"identity.saved":`Identity saved.`,"transcript.title":`Transcript`,"transcript.subtitle":`recent operator ↔ argus turns · reply from the composer`,"transcript.empty":`no conversation turns yet`,"transcript.operator":`operator`,"new.createDaemon":`Create session`,"new.createdIdle":`New session ready. Say what it is for and the work begins.`,"new.createdStarting":`New session ready; the work is starting in the background.`,"new.subtitle":`Creates an isolated timeline and Manager context.`,"new.close":`close create session`,"new.name":`Name`,"new.optional":`(optional)`,"new.namePlaceholder":`e.g. AAAI embodiment paper`,"new.workdir":`Output workdir`,"new.workdirHint":`Agents write code, papers, reports, and experiment outputs here. Internal memory stays under the session state directory.`,"new.objective":`Objective`,"new.objectivePlaceholder":`Leave blank to start with a conversation, or describe a campaign to start immediately.`,"new.startsAfterCreate":`Campaign starts after session creation`,"new.idleUntilMessage":`Idle until the first message`,"new.startsHint":`The session opens immediately while Argus prepares the work in the background.`,"new.idleHint":`Background work starts after your first message, when needed.`,"new.shortcut":`Ctrl/⌘+Enter to create`,"new.creating":`Creating…`,"new.createAndStart":`Create and start`,"manage.daemon":`Manage session`,"manage.displayName":`Display name`,"manage.executor":`Background work`,"manage.running":`Running`,"manage.runningExternally":`Running externally`,"manage.paused":`Stopped`,"manage.pauseHint":`Interrupt the current operation and keep progress resumable.`,"manage.stopNow":`Stop now`,"manage.stopNowHint":`Immediately interrupt this verified daemon so the session can be deleted.`,"manage.externalHint":`This session is managed outside this app.`,"manage.resumeHint":`Resume queued research work.`,"manage.working":`Working…`,"manage.resume":`Resume`,"manage.deleteSession":`Delete session`,"manage.deleteHint":`Deleted sessions move to the trash and remain recoverable. Stop background work first.`,"manage.delete":`Delete…`,"manage.confirmQuestion":`Move this session to trash?`,"manage.confirmDelete":`Confirm delete`,"decision.operator":`Operator decision`,"decision.required":`Decision required`,"decision.whyBlocked":`Recorded reason this task needs input`,"decision.currentTask":`Current task`,"decision.taskName":`Task: {title}`,"decision.otherTask":`Another task awaiting input`,"decision.awaitingReply":`Awaiting your reply`,"decision.askedAt":`Asked {time}`,"decision.evidence":`Evidence`,"decision.notePlaceholder":`Add the guidance the Manager should apply…`,"decision.resumeHint":`Your answer applies to this task. The Manager checks its next step.`,"decision.later":`Later`,"decision.applying":`Submitted; Argus is starting on it…`,"decision.closeContinue":`Close, keep working`,"decision.stopCampaign":`Stop campaign`,"decision.useOption":`Use this option`,"decision.sendAnswer":`Send answer`,"decision.noteRequired":`Add the required details before sending this choice.`,"artifact.preview":`Result preview`,"artifact.title":`Result`,"artifact.approvedEvidence":`evidence the Reviewer has checked`,"artifact.downloading":`Downloading…`,"artifact.download":`Download`,"artifact.open":`Open`,"artifact.close":`close result preview`,"artifact.unavailable":`preview unavailable`,"artifact.empty":`(empty file)`,"artifact.truncated":`preview truncated · download to inspect the complete file`,"artifact.htmlTooLarge":`HTML preview is too large to render safely. Download the complete file.`,"artifact.pdfDisabled":`Inline PDF preview is disabled by this browser.`,"artifact.openPdf":`Open PDF`,"artifact.noPreview":`This file type has no safe inline preview.`,"artifact.downloadHint":`Download it to inspect with a local application.`,"task.details":`Task details`,"task.stopLoop":`stop loop`,"task.done":`done`,"task.skip":`skip`,"task.close":`close task details`,"task.waitingOnYou":`Waiting on you`,"task.objective":`Objective`,"task.noObjective":`(no objective recorded)`,"task.untitled":`Untitled task`,"task.priority":`priority`,"task.started":`started`,"task.finished":`finished`,"task.outcome":`Outcome`,"task.iteration":`Iteration`,"task.mode":`mode`,"task.autoIterate":`auto-iterate`,"task.singlePass":`single pass`,"task.cycles":`cycles`,"task.cost":`cost`,"task.lastError":`Last error`,"task.notes":`Notes`,"task.dependsOn":`depends on`,"task.dependsOnCount":`Depends on {count} earlier tasks`,"pending.reviewRespond":`Review and respond`,"pending.showOnMap":`Show on map`,"backlog.active":`Active · {count}`,"backlog.history":`History · {count}`,"backlog.noHistory":`No completed work yet`,"backlog.empty":`Nothing queued. Argus is ready for new work.`,"backlog.viewDetails":`View full task details`,"backlog.iterating":`Repeating`,"backlog.stopIterating":`Stop repeating`,"backlog.stop":`Stop`,"backlog.markDone":`Mark done`,"backlog.remove":`Remove`,"mission.achievement":`Argus achievement`,"mission.elapsed":`Elapsed`,"mission.rejectedAttempts":`{count} rejected attempts`,"mission.skillsLearned":`{count} skills learned`,"mission.artifacts":`{count} files produced`,"mission.waiting":`Waiting for a mission`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`Ready when you are — assign a mission to begin.`,"mission.statusDone":`This task: {outcome} — finished in {elapsed}.`,"mission.nextAfterReply":`Reply to this task’s question first, then decide its next step.`,"mission.continuousDone":`Continuous run finished`,"mission.resumeContinuous":`Resume`,"mission.control":`Mission control`,"mission.attentionHealth":`System error — health is degraded.`,"mission.attentionFailed":`Mission failed — check the task below.`,"mission.deliveryFailed":`Task failed at delivery — execution could not start or finish.`,"mission.attentionStepFailed":`A step failed — check the task below.`,"mission.attentionPaused":`Mission is paused — waiting for your input.`,"mission.showObjective":`Show full objective`,"mission.showFullOutput":`View full output`,"mission.stage":`Stage`,"mission.campaign":`Campaign`,"mission.totalElapsed":`Total elapsed`,"mission.round":`Round`,"mission.mode":`Mode`,"mission.summary":`Mission summary`,"mission.deliveryCertified":`Delivery approved`,"mission.taskCompleted":`Task completed`,"mission.openResult":`Open result`,"mission.viewTask":`View task`,"mission.taskPlan":`Task plan`,"mission.team":`Team`,"mission.waitingShort":`Waiting`,"mission.roleWork":`Role work`,"mission.showMore":`Show more`,"mission.showLess":`Show less`,"mission.done":`Done`,"mission.inProgress":`In progress`,"mission.failed":`Failed`,"mission.bannerPaused":`Mission is paused — waiting for your input.`,"mission.bannerError":`System error — health is degraded.`,"mission.bannerStepFailed":`A step failed: {step}`,"mission.elapsedAgo":`{elapsed} ago`,"mission.filteredBy":`filtered by {task} · clear`,"mission.allVisible":`all visible missions`,"mission.roundNumber":`round {count}`,"mission.noRoleWork":`No persisted {role} work for this selection yet.`,"mission.researchDag":`Task route`,"mission.active":`active`,"mission.noDag":`The Planner has not added tasks to the route yet.`,"mission.workingHypothesis":`Working hypothesis · can be revised`,"mission.goalContribution":`How this supports the goal`,"mission.temporaryRegressions":`Expected temporary tradeoffs`,"mission.decisionRule":`When to revise, split, or stop`,"mission.acceptance":`What counts as done`,"mission.nonGoals":`Non-goals`,"mission.capabilities":`Capabilities`,"mission.capabilitiesUnlocked":`Capabilities unlocked`,"mission.learnedCapability":`Learned capability`,"mission.learnedDuring":`Learned during {mission}`,"mission.skillUnavailable":`Skill content is not available in this snapshot.`,"mission.contentTruncated":`Content preview truncated`,"mission.knowledgeRetained":`Knowledge retained`,"mission.selfEvolution":`Saved project knowledge`,"mission.knowledgeSaved":`Argus saved these capabilities and notes for future work on this project.`,"mission.noCapabilities":`No capabilities learned yet.`,"mission.replay":`Mission replay`,"mission.replayTimeline":`Replay mission timeline`,"mission.roleFailed":`{role} failed`,"mission.showingLatestEvent":`Showing latest event`,"mission.showingLastEvents":`Showing last {count} events`,"mission.waitingEvents":`Waiting for structured research events.`,"mission.startsAfter":`Starts after {count} earlier tasks`,"mission.hiddenTasks":`{count} earlier tasks hidden · {failed} blocked or failed · {skipped} skipped`,"mission.projectFilesChanged":`Project files changed`,"mission.reviewInIde":`Open the IDE to review the diff`,"research.currentWork":`Current work`,"research.dagProgress":`Task route progress`,"research.verifiedOutputs":`Verified outputs`,"research.recentMilestones":`Recent milestones`,"research.liveProgress":`Task progress`,"research.artifact":`Research result`,"research.canvas":`Manager live research canvas`,"research.previewArtifact":`Preview the result`,"research.openLarge":`Open large preview`,"research.collapse":`Collapse preview`,"research.unavailable":`Manager live view is temporarily unavailable.`,"research.noPreview":`No preview`,"research.waiting":`Waiting…`,"research.updating":`Updating…`,"research.fileUnavailable":`This file is ready to download using the button above.`,"research.eventSourced":`event-sourced mission state`,"research.downloadFailed":`download failed`,"operations.title":`Operations`,"operations.work":`Work`,"operations.runtime":`Runtime`,"operations.system":`System`,"operations.recovery":`Recovery`,"operations.workInput":`Work input`,"operations.workHint":`Queue work, guide the active task, save a note, or preview a plan without dispatching it.`,"operations.action.task":`Task`,"operations.action.nudge":`Guide`,"operations.action.note":`Note`,"operations.action.plan":`Plan`,"operations.planPlaceholder":`Objective to preview; preview never queues work`,"operations.actionPlaceholder":`{action} text`,"operations.previewPlan":`Preview plan`,"operations.submitAction":`Submit {action}`,"operations.runtimeHint":`Change where this session runs, reset Manager context, or safely restart the session.`,"operations.workdir":`Working directory`,"operations.workdirUpdated":`Working directory updated.`,"operations.applyWorkdir":`Apply working directory`,"operations.replaceSlot":`Replace an active session`,"operations.sourceUpdate":`Argus source version`,"operations.pullLatest":`Pull latest version`,"operations.updateChecking":`Checking published branch…`,"operations.updateRunning":`Updating…`,"operations.updateAvailable":`Update available`,"operations.updateCurrent":`Up to date`,"operations.updateUnavailable":`This checkout cannot be updated safely.`,"operations.currentRevision":`Current`,"operations.latestRevision":`Latest`,"operations.updatePhase":`Phase`,"operations.updateRestart":`Source updated. Restart the cockpit, then use the reload button to move active daemons to the new release at a safe task boundary.`,"operations.skills":`Skills`,"operations.runSkill":`Run skill command`,"operations.metrics":`System metrics`,"operations.trash":`Recoverable trash`,"operations.searchTrash":`Search trash`,"operations.trashEmpty":`Trash is empty.`,"resource.title":`Resources`,"resource.loading":`Loading resource status…`,"resource.devices":`Devices: {count}`,"resource.inUse":`In use · {count}`,"resource.queue":`Queue · {count}`,"resource.none":`None`,"resource.timeLeft":`{ttl} left`,"resource.noIntent":`No purpose recorded`,"resource.yieldRequest":`Resource release requested · {reason}`,"resource.queuePosition":`Queue position {position}`,"label.status.inProgress":`In progress`,"label.status.waiting":`Waiting`,"label.status.completed":`Completed`,"label.status.blocked":`Blocked`,"label.status.failed":`Failed`,"label.status.needsChanges":`Needs changes`,"label.status.skipped":`Skipped`,"label.status.paused":`Paused`,"label.status.cancelled":`Cancelled`,"label.status.available":`Available`,"label.status.unavailable":`Unavailable`,"label.status.inaccessible":`Not accessible`,"label.status.limited":`Limited`,"label.status.healthy":`Healthy`,"label.status.updated":`Status updated`,"label.role.argus":`Argus`,"label.role.you":`You`,"label.work.task":`Task`,"label.work.action":`Work step`,"label.work.handoff":`Notes for the next step`,"label.work.review":`Review`,"label.work.planning":`Planning`,"label.work.update":`Update`,"label.stage.scope":`Scope`,"label.stage.research":`Research`,"label.stage.implementation":`Implementation`,"label.stage.experiment":`Experiments`,"label.stage.analysis":`Analysis`,"label.stage.writing":`Writing`,"label.stage.review":`Final review`,"label.stage.delivery":`Delivery`,"label.stage.unstaged":`Unstaged`,"label.frontier.reopened":`An earlier task was reopened`,"label.frontier.added":`A new task was added`,"label.frontier.completed":`A task path was completed`,"label.frontier.revised":`The task plan was revised`,"label.frontier.narrowed":`The task scope was narrowed`,"label.frontier.expanded":`The task scope was expanded`,"label.frontier.updated":`The task plan was updated`,"label.priority":`Priority {priority}`,"label.outcome.workCompleted":`Work completed`,"label.outcome.workPaused":`Work paused`,"label.outcome.workBlocked":`Work blocked`,"label.outcome.workFailed":`Work failed`,"label.outcome.workEnded":`Work ended`,"label.outcome.workIncomplete":`Work incomplete`,"label.outcome.workStalled":`Work stalled`,"label.outcome.workUpdated":`Work status updated`,"label.outcome.reviewPassed":`Review passed`,"label.outcome.reviewNeedsChanges":`Review requested changes`,"label.outcome.reviewBlocked":`Review blocked`,"label.outcome.reviewOutdated":`Review is out of date`,"label.outcome.reviewPending":`Review pending`,"label.outcome.stageApproved":`Stage approved`,"label.outcome.stageNotApproved":`Stage not approved`,"label.outcome.stageRevoked":`Stage approval revoked`,"label.outcome.stageNotNeeded":`Stage decision not needed`,"label.outcome.stagePending":`Stage decision pending`,"label.outcome.budgetPaused":`Paused by budget limit`,"label.outcome.costUnreconciled":`Awaiting provider usage reconciliation`,"label.outcome.waitingForYou":`Waiting for your response`,"label.outcome.stoppedByYou":`Stopped by you`,"label.outcome.pausedByYou":`Paused by you`,"label.outcome.sessionPaused":`Session paused`,"label.outcome.serviceUnavailable":`Service unavailable`,"label.outcome.serviceCoolingDown":`Service temporarily paused`,"label.outcome.temporaryIssue":`Paused by a temporary issue`,"label.outcome.serviceError":`Stopped by a service error`,"label.outcome.needsPlan":`A new plan is needed`,"label.outcome.canResume":`Can resume`,"label.routing.team":`Team workflow`,"label.routing.individual":`Individual workflow`,"label.routing.research":`Research`,"label.routing.software":`Software work`,"label.routing.staged":`Step by step`,"label.routing.flexible":`Flexible workflow`,"label.routing.ongoing":`Ongoing`,"label.routing.defined":`Defined scope`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`Accelerator`,"label.resource.enforced":`Limits enforced`,"label.resource.advisory":`Recommendations only`,"label.resource.released":`Resources released`,"label.resource.kept":`Resources kept`,"mission.lastProgress":`Progress recorded before the stop`,"mission.nextResume":`The progress is saved. Run Argus again and it continues from where it stopped.`,"mission.nextResumeLive":`Argus will continue from the saved progress.`,"research.totalTime":`Total time`,"research.optionDelivery":`Delivery`,"research.optionCheckpoint":`Checkpoint`,"research.optionPending":`being written`,"operations.unavailableHere":`This is not available on this Argus.`,"operations.requestFailed":`That did not go through.`,"operations.technicalDetails":`Technical details`,"verticals.title":`Vertical Store`,"verticals.entry":`Verticals`,"verticals.openStore":`Open Vertical Store`,"verticals.paletteHint":`install · enable · update`,"verticals.intro":`A vertical gives Argus a research domain: its stages, roles, skills and checks. Install what your projects need and enable it per workspace.`,"verticals.hostedNote":`Verticals are provided by the host; you can enable or disable them for your workspace.`,"verticals.close":`Close vertical store`,"verticals.search":`Search verticals`,"verticals.searchPlaceholder":`Search by name, purpose or tag…`,"verticals.refreshCatalog":`Refresh catalog`,"verticals.refreshing":`Refreshing…`,"verticals.catalogSource":`Catalog: {source}`,"verticals.catalogRelease":`Release {tag}`,"verticals.catalogFetched":`Fetched {time}`,"verticals.catalogNever":`Catalog not fetched yet`,"verticals.catalogError":`The catalog could not be refreshed: {error}`,"verticals.kindFilter":`Filter by kind`,"verticals.tagFilter":`Filter by tag`,"verticals.clearFilters":`Clear filters`,"verticals.count":`{shown} of {total}`,"verticals.filter.all":`All`,"verticals.routingPath":`Category / domain / specialty`,"verticals.filter.installed":`Installed`,"verticals.filter.available":`Available`,"verticals.filter.builtin":`Built-in`,"verticals.kind.builtin":`Built-in`,"verticals.kind.package":`Bundled`,"verticals.kind.installed":`Installed`,"verticals.kind.available":`Available`,"verticals.enabled":`Enabled`,"verticals.disabledState":`Disabled`,"verticals.updateAvailable":`Update available`,"verticals.updateTo":`Update to {version}`,"verticals.installedVersion":`Installed {version}`,"verticals.catalogVersion":`Catalog {version}`,"verticals.requires":`Requires`,"verticals.shared":`Shares resources with`,"verticals.size":`Size`,"verticals.jumpTo":`Go to {name}`,"verticals.missingPython":`Needs: {packages} — install them into the Python environment Argus runs from.`,"verticals.runtimeIssues":`Installed version is incompatible with this Argus runtime: {issues}`,"verticals.installIssues":`Catalog installation/update is blocked by runtime requirements: {issues}`,"verticals.usedByOne":`Used by 1 project`,"verticals.usedBy":`Used by {count} projects`,"verticals.action.install":`Install`,"verticals.action.update":`Update`,"verticals.action.enable":`Enable`,"verticals.action.disable":`Disable`,"verticals.action.uninstall":`Uninstall`,"verticals.confirmUninstall":`Confirm uninstall`,"verticals.confirmUninstallHint":`Removes {name} from this Argus.`,"verticals.removeAnyway":`Remove anyway`,"verticals.operation.install":`Installing…`,"verticals.operation.update":`Updating…`,"verticals.operation.enable":`Enabling…`,"verticals.operation.disable":`Disabling…`,"verticals.operation.uninstall":`Uninstalling…`,"verticals.operationRunning":`Working…`,"verticals.operationFailed":`{action} failed`,"verticals.loading":`Loading verticals…`,"verticals.noMatches":`No verticals match these filters.`,"verticals.none":`No verticals are listed yet.`,"verticals.loadFailed":`Could not read the vertical list.`,"verticals.actionFailed":`That did not go through.`,"verticals.tooOld":`This Argus backend predates the vertical store. Update Argus, then reopen this page to manage verticals.`},Ct={"language.english":`English`,"handshake.connecting":`正在准备 Argus`,"handshake.service":`服务`,"handshake.project":`项目`,"handshake.ready":`就绪`,"handshake.title":`正在准备 Argus`,"handshake.detail":`正在恢复你的工作区…`,"splash.starting":`Argus 启动中`,"rail.workbench":`工作台`,"rail.sessionsShortcut":`会话 · Ctrl/⌘ P`,"panel.backlog":`待办`,"panel.activity":`对话与进展`,"panel.journal":`日志`,"panel.roles":`角色`,"panel.project":`项目`,"panel.liveView":`Manager 实时项目视图`,"stream.jumpToLatest":`跳到最新`,"stream.toggleReasoning":`显示或隐藏 Agent 推理(⌘T)`,"stream.reasoning":`推理`,"stream.noLogs":`暂无活动`,"stream.system":`Argus 动态`,"stream.autonomous":`后台活动`,"stream.backgroundWork":`Argus 正在后台工作`,"stream.ready":`Argus 已就绪。你可以提问或安排下一项工作。`,"stream.historyLoading":`正在读取对话记录…`,"stream.historyError":`对话记录暂时读取失败。`,"stream.historyRetry":`重试`,"stream.fold.read":`读取了 {count} 个文件`,"stream.fold.search":`搜索了 {count} 次`,"stream.fold.fetch":`查阅了 {count} 个网页`,"stream.fold.edit":`修改了 {count} 个文件`,"stream.fold.tool":`使用了 {count} 次 {tool}`,"stream.fold.failed":`{count} 次失败`,"stream.fold.expand":`展开每一步`,"stream.fold.collapse":`收起`,"stream.repeated":`重复了 {count} 次,显示最近一次`,"stream.stepFailed":`失败`,"stream.stepResult":`结果`,"common.showRaw":`显示原始输出`,"doctor.lastEntry":`最近一条`,"operations.metric.calls":`今日模型调用`,"operations.metric.failed":`失败`,"operations.metric.slowest":`最慢的常规调用`,"operations.slo.healthy":`正常`,"operations.slo.degraded":`需要留意`,"operations.slo.loading":`加载中…`,"operations.validationFailures":`今日 {count} 条格式异常的事件`,"operations.outputLines":`共 {count} 行输出`,"operations.done":`已完成。`,"newDaemon.workdirPlaceholder":`留空 → ~/.argus-skill/workspaces/`,"operations.resetManager":`重新开始理解这段对话`,"language.chinese":`中文`,"language.switchTo":`切换到{language}`,"common.loading":`加载中…`,"common.retry":`重试`,"common.save":`保存`,"common.cancel":`取消`,"common.close":`关闭`,"common.settings":`设置`,"common.ready":`就绪`,"common.live":`实时`,"common.reconnecting":`正在重连`,"common.stale":`快照已过期`,"common.degraded":`快照异常`,"common.external":`外部`,"common.pause":`暂停`,"common.run":`运行`,"common.working":`处理中`,"common.local":`本地`,"common.all":`全部`,"common.unassigned":`未分配`,"common.closeSessions":`关闭会话列表`,"common.resizeSessions":`调整会话列表宽度`,"common.resizePreview":`调整预览区域宽度`,"common.expandPreview":`展开预览`,"time.justNow":`刚刚`,"time.minutesAgo":`{count}分钟前`,"time.hoursAgo":`{count}小时前`,"time.yesterdayAt":`昨天 {time}`,"connection.pairingTitle":`此浏览器尚未与 Argus 配对`,"connection.pairingDetail":`请打开这个站点的有效配对链接,或在下方粘贴配对链接或令牌。`,"connection.pairAgain":`重新配对`,"connection.pairingInput":`配对链接或令牌`,"connection.pairingPlaceholder":`粘贴新的配对链接或令牌`,"connection.pairingInvalid":`请输入有效的配对链接或令牌。`,"connection.connect":`连接`,"connection.unreachableTitle":`Argus 本地服务当前不可达`,"connection.unreachableDetail":`请保持 Argus Desktop 运行,等待本地服务就绪后再重试。`,"sidebar.collapse":`收起会话`,"sidebar.expand":`展开会话`,"sidebar.create":`创建项目`,"sidebar.find":`查找项目`,"sidebar.clearSearch":`清除搜索`,"sidebar.refreshFailed":`刷新失败 · 重试`,"sidebar.noSessions":`暂无会话`,"sidebar.noMatches":`没有匹配"{query}"的会话`,"sidebar.unnamedSession":`未命名会话`,"sidebar.daemonAlive":`Argus 后台在线`,"sidebar.updateRequired":`需要更新`,"sidebar.updateAvailable":`可更新`,"sidebar.updateAvailableHint":`后台仍在运行,执行器与网页版本不同。`,"sidebar.stopped":`后台已停止`,"sidebar.runningFor":`后台在线 · {uptime}`,"sidebar.lastActive":`上次活动 {time}`,"sidebar.manage":`管理 {name}`,"sidebar.manageHint":`重命名、暂停或删除`,"sidebar.resume":`继续`,"sidebar.resumeHint":`在 {workdir} 中继续工作`,"sidebar.resumeSuccess":`会话已恢复。`,"sidebar.resumeFailed":`无法恢复会话:{error}`,"sidebar.modelLoading":`正在加载后端和模型…`,"sidebar.modelUnavailable":`后端和模型信息不可用`,"sidebar.defaultModel":`默认模型`,"sidebar.openSettings":`打开设置`,"sidebar.compute":`算力队列与账户额度`,"sidebar.theme":`{current}主题;切换到{next}主题`,"landing.selectOrCreate":`从侧边栏选择一个会话,或创建新会话。`,"landing.noSessions":`还没有会话。创建一个即可开始。`,"landing.select":`选择项目`,"landing.new":`新建项目`,"landing.menu":`打开菜单`,"project.missingSwitched":`找不到项目“{requested}”,已切换到 {fallback}。`,"project.missingCreate":`找不到项目“{requested}”,请新建一个项目继续。`,"topbar.openSessions":`打开项目列表`,"topbar.externallyManaged":`由外部管理`,"topbar.pauseDaemon":`暂停 Argus`,"topbar.runDaemon":`运行 Argus`,"topbar.working":`Argus 正在处理你的请求`,"topbar.roleActive":`{role} 活跃中`,"topbar.roleIdle":`{role} 空闲`,"topbar.externalDaemonHint":`Argus 由此应用之外的服务管理,请前往相应位置控制。`,"topbar.manageSession":`管理会话`,"topbar.showPreview":`显示预览`,"topbar.showActivity":`显示动态`,"mobile.views":`视图`,"mobile.sessions":`项目`,"mobile.mission":`任务`,"mobile.activity":`对话`,"mobile.workbench":`工作台`,"mobile.map":`地图`,"mobile.preview":`文件`,"chat.working":`Argus 正在处理你的消息`,"chat.workingQuiet":`Argus 正在处理你的消息 · 仍在处理中,{quiet} 秒暂无新进展`,"chat.stopWaitingHint":`按 Esc 停止回复 · 按 Enter 追加消息`,"chat.queuedWhileRunning":`已排队 · 这条回复结束后立即处理;正在运行的任务会据此调整`,"chat.attachWhileRunning":`附件要等这条回复结束后再发送`,"chat.stepsLive":`正在工作 · 已 {count} 步`,"chat.stepsDone":`过程 {count} 步 · {seconds}`,"chat.stepFailed":`失败`,"chat.stepRaw":`原始参数`,"chat.messageArgus":`向 Argus 发送消息`,"chat.selectSession":`请选择会话…`,"chat.placeholder":`提问或安排工作`,"chat.routeLabel":`消息类型`,"chat.routeHint":`仅用于本条消息。Argus 根据实际需要选择单智能体或团队,问候直接回复。`,"chat.routeTask":`任务`,"chat.routeAuto":`自动`,"chat.routeChat":`对话`,"chat.attach":`添加文件`,"chat.attachHint":`支持 PNG、JPEG、WebP、PDF、Markdown/文本、JSON、CSV · 每条消息最多 {count} 个文件,单个 {perFile},总计 {total}`,"chat.attachDrop":`拖放文件以添加附件`,"chat.attachRemove":`移除附件 {name}`,"chat.attachUnsupported":`{name} 不受支持。请使用 PNG、JPEG、WebP、PDF、Markdown/文本、JSON 或 CSV。`,"chat.attachTooLarge":`{name} 超过单文件大小限制 {size}。`,"chat.attachTooMany":`每条消息最多只能附带 {count} 个文件。`,"chat.attachTotalTooLarge":`附件总大小超过 {size} 限制。`,"chat.attachmentUploadFailed":`附件上传失败:{error}`,"chat.uploadingAttachments":`正在上传附件`,"chat.rewriteHint":`把这段话整理得更清楚。改写结果会回到输入框,由你检查后发送。`,"chat.rewriteLabel":`整理这段话`,"chat.rewriting":`正在改写`,"chat.rewrite":`改写文字`,"chat.stopWaiting":`停止回复`,"chat.stopWaitingTitle":`停止处理这条消息`,"chat.stoppingReply":`正在停止当前回复…`,"chat.stopReplyRequested":`已收到停止请求,可以发送新消息。`,"chat.replyAlreadyFinished":`这次回复已经结束。`,"chat.stopReplyFailed":`服务端未能停止这次请求:{error}`,"chat.send":`发送消息`,"copy.message":`复制`,"copy.code":`复制代码`,"copy.copied":`已复制`,"help.title":`键盘快捷键`,"help.commands":`命令`,"help.palette":`打开命令面板`,"help.sessions":`展开或收起会话`,"help.managerChat":`聚焦 Manager 对话框`,"help.rewrite":`发送前改写当前提示词`,"help.reasoning":`显示或隐藏 Agent 推理`,"help.kiosk":`切换只读展示模式`,"help.composer":`聚焦输入框`,"help.send":`发送消息`,"help.newline":`插入换行`,"help.thisHelp":`打开此帮助`,"help.escape":`关闭浮层或停止等待`,"palette.placeholder":`输入命令或搜索…`,"palette.noMatches":`没有匹配的命令`,"palette.navigate":`↑↓ 导航`,"palette.run":`↵ 执行`,"palette.close":`Esc 关闭`,"palette.view":`视图`,"palette.action":`操作`,"palette.project":`项目`,"palette.newDaemon":`新建会话`,"palette.openTranscript":`打开对话记录`,"palette.openProject":`打开项目`,"palette.projectHint":`工作 · 记忆 · Agent`,"palette.openOperations":`打开运行控制`,"palette.operationsHint":`会话控制`,"palette.hideReasoning":`隐藏推理`,"palette.showReasoning":`显示推理`,"palette.exitKiosk":`退出展示模式`,"palette.enterKiosk":`进入展示模式`,"palette.messageArgus":`向 Argus 发送消息…`,"palette.stopWaiting":`停止当前回复`,"palette.stopContinuous":`停止持续任务`,"palette.startContinuous":`启动持续任务`,"palette.stopDaemon":`暂停 Argus`,"palette.startDaemon":`运行 Argus`,"slash.suggestions":`Slash 命令建议`,"mission.roleActive":`{role} 正在工作`,"mission.overview":`任务概览`,"mission.operations":`运行控制`,"role.manager":`统筹`,"role.manager.description":`理解你的目标,协调工作`,"role.planner":`规划`,"role.planner.description":`拆解问题,安排后续工作并调整计划`,"role.engineer":`执行`,"role.engineer.description":`查资料、写证明或代码,调用工具验证`,"role.reviewer":`复核`,"role.reviewer.description":`检查结果与证据,指出缺口`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`你`,"doctor.title":`诊断`,"doctor.subtitle":`Argus 状态检查与推荐的根因修复方案`,"doctor.recommended":`推荐修复`,"doctor.loadError":`无法加载诊断数据。`,"doctor.empty":`诊断暂无数据`,"doctor.daemonLog":`后台进程日志`,"settings.subtitle":`生效中的角色、预算和关键控制项`,"settings.loadError":`无法加载配置。`,"settings.empty":`未找到配置`,"settings.quickConfig":`快速配置`,"settings.appearance":`外观`,"settings.appearanceHint":`选择界面主题色。Logo 与图标始终保持黑白,不参与渐变。`,"settings.themeStyle":`主题色`,"settings.themeStyle.standard":`标准`,"settings.themeStyle.standardHint":`克制的黑、白、灰与蓝色。`,"settings.themeStyle.gradient":`渐变`,"settings.themeStyle.gradientHint":`经典 Argus 蓝金渐变背景。`,"settings.backend":`后端`,"settings.backendSource.env":`由服务器环境设置`,"settings.backendSource.persisted":`已保存的设置`,"settings.backendSource.default":`内置默认值`,"settings.backendWillSave":`应用后保存为{backend}。`,"settings.backendWillReplace":`应用后把已保存的{saved}改为{backend}。`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`后端已保存为{backend}。重启 Argus 后生效。`,"settings.backendUnsupported":`不支持的后端({backend})`,"settings.backendUnavailable":`后端信息不可用`,"settings.model":`模型`,"settings.trialAccount":`试用账号`,"settings.trialKeyHint":`额度用完后可在这里更换 Key,项目和对话会保留。`,"settings.changeTrialKey":`更换 Key`,"settings.applyModel":`应用`,"settings.modelPlaceholder":`auto(后端默认模型)`,"settings.connection":`连接`,"settings.webApi":`Web + REST API`,"settings.eventStream":`实时动态`,"settings.taskDaemon":`后台工作`,"settings.taskDaemonValue":`本地进程 · events.jsonl · 无 TCP 端口`,"chat.messageTooLong":`消息超过 32,000 字符,请缩短或作为附件上传。草稿已保留。`,"settings.required":`必须填写{field}`,"settings.advanced":`高级设置`,"settings.advancedHint":`预算、顾问模型、讲解强度、连接详情与原始配置`,"settings.mapModel":`地图`,"settings.mapModelFollows":`跟随前台模型`,"settings.mapModelSet":`地图讲解现在用 {model}。`,"settings.overrideTitle":`环境变量覆盖`,"settings.overrideHint":`设置特定的配置别名或环境变量键。`,"settings.namePlaceholder":`名称或别名,例如 manager_model`,"settings.valuePlaceholder":`值`,"settings.applyAdvanced":`应用环境变量覆盖`,"settings.applied":`设置已应用。请重启受影响的会话以使用新设置。`,"settings.modelAppliedToRoles":`所有角色现在都用 {model}。正在运行的会话要重启后才换。`,"settings.rolesRunning":`各角色当前实际使用:`,"settings.applyUnifies":`点“应用”会把它们统一成上面的模型。`,"settings.rolesTitle":`生效中的角色`,"settings.rawConfig":`原始配置`,"settings.group.limits":`限制`,"settings.group.safety":`安全`,"settings.group.interface":`界面`,"settings.knob.activeDaemons":`活动会话上限`,"settings.knob.activeDaemonsDoc":`此主机上可同时运行的后台会话数量上限。`,"settings.knob.safeMode":`安全模式`,"settings.knob.safeModeDoc":`启用更保守的运行时保护措施。`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`启用 Telegram 通知桥接。`,"settings.knob.showReasoning":`显示推理`,"settings.knob.showReasoningDoc":`在活动视图中显示角色推理过程。`,"settings.knob.operatorAvailable":`有人值守`,"settings.knob.operatorAvailableDoc":`关闭后不再向你提问:Argus 依据记录的假设自行决定,需要你授权的操作会直接停下。`,"noOperator.banner":`无人值守模式:已停止提问。Argus 会依据记录的假设自行决定,而不是问你。`,"noOperator.turnOff":`恢复提问`,"settings.source.notApplicable":`不适用于此模型`,"settings.source.vaultDefault":`能力库 / 默认值`,"settings.source.default":`默认值`,"settings.modelUnavailable":`不可用`,"settings.modelOfflineList":`离线列表:后端没有返回实时模型列表,显示的是本地目录。`,"settings.source.saved":`已保存的覆盖值`,"settings.source.environment":`环境变量`,"settings.source.hostConfig":`主机配置`,"settings.source.other":`解析后的配置`,"settings.value.enabled":`已启用`,"settings.value.disabled":`已停用`,"settings.effort.low":`低推理强度`,"settings.effort.medium":`中等推理强度`,"settings.effort.high":`高推理强度`,"settings.effort.xhigh":`超高推理强度`,"settings.role.curator":`知识维护`,"settings.role.curatorDoc":`维护并提炼可复用技能库。`,"settings.footer":`配置项同时显示易读标签和原始键。完整配置仍可通过以下命令查看:`,"identity.title":`身份`,"identity.subtitle":`本项目中 Argus 服务的对象`,"identity.placeholder":`描述 Argus 正在为谁工作,以及需要长期遵循的偏好…`,"identity.save":`保存身份`,"identity.saved":`身份已保存。`,"transcript.title":`对话记录`,"transcript.subtitle":`近期操作者 ↔ Argus 对话 · 请从输入框继续回复`,"transcript.empty":`暂无对话记录`,"transcript.operator":`操作者`,"new.createDaemon":`创建会话`,"new.createdIdle":`新会话已就绪。说一句你想做什么,工作就开始了。`,"new.createdStarting":`新会话已就绪,工作正在后台开始。`,"new.subtitle":`在这里保存你的对话和任务进度。`,"new.close":`关闭创建会话窗口`,"new.name":`名称`,"new.optional":`(可选)`,"new.namePlaceholder":`例如:AAAI 具身智能论文`,"new.workdir":`输出工作目录`,"new.workdirHint":`Agent 会在这里写入代码、论文、报告和实验结果。内部记忆仍保存在会话状态目录中。`,"new.objective":`目标`,"new.objectivePlaceholder":`留空则从对话开始,也可以填写一个立即启动的持续任务。`,"new.startsAfterCreate":`创建会话后立即启动任务`,"new.idleUntilMessage":`收到第一条消息前保持空闲`,"new.startsHint":`会话会立即打开,Argus 将在后台准备相关工作。`,"new.idleHint":`收到第一条消息后,Argus 会按需启动后台工作。`,"new.shortcut":`按 Ctrl/⌘+Enter 创建`,"new.creating":`正在创建…`,"new.createAndStart":`创建并启动`,"manage.daemon":`管理会话`,"manage.displayName":`显示名称`,"manage.executor":`后台工作`,"manage.running":`运行中`,"manage.runningExternally":`由外部运行`,"manage.paused":`未运行`,"manage.pauseHint":`中断当前操作并保留可恢复的进度。`,"manage.stopNow":`立即停止`,"manage.stopNowHint":`立即中断这个已验证的 daemon,停止后即可删除会话。`,"manage.externalHint":`此会话由此应用之外的服务管理。`,"manage.resumeHint":`继续执行队列中的研究工作。`,"manage.working":`处理中…`,"manage.resume":`继续`,"manage.deleteSession":`删除会话`,"manage.deleteHint":`删除的会话会移入回收站,之后仍可恢复。请先停止后台工作。`,"manage.delete":`删除…`,"manage.confirmQuestion":`将此会话移入回收站?`,"manage.confirmDelete":`确认删除`,"decision.operator":`操作者决策`,"decision.required":`需要你的决策`,"decision.whyBlocked":`这项任务记录的待答原因`,"decision.currentTask":`当前任务`,"decision.taskName":`任务:{title}`,"decision.otherTask":`其他待处理任务`,"decision.awaitingReply":`等待你的回复`,"decision.askedAt":`提问于 {time}`,"decision.evidence":`证据`,"decision.notePlaceholder":`添加 Manager 应采用的指导…`,"decision.resumeHint":`回答只针对这项任务,Manager 会据此检查它的下一步。`,"decision.later":`稍后处理`,"decision.applying":`已提交,Argus 正在开始处理…`,"decision.closeContinue":`关闭,后台继续`,"decision.stopCampaign":`停止持续任务`,"decision.useOption":`使用此选项`,"decision.sendAnswer":`发送回答`,"decision.noteRequired":`这个选项需要补充说明后才能提交。`,"artifact.preview":`结果预览`,"artifact.title":`结果`,"artifact.approvedEvidence":`已经检查确认的依据`,"artifact.downloading":`正在下载…`,"artifact.download":`下载`,"artifact.open":`打开`,"artifact.close":`关闭结果预览`,"artifact.unavailable":`无法预览`,"artifact.empty":`(空文件)`,"artifact.truncated":`预览已截断 · 请下载完整文件查看`,"artifact.htmlTooLarge":`HTML 文件过大,无法安全预览。请下载完整文件。`,"artifact.pdfDisabled":`此浏览器已禁用内嵌 PDF 预览。`,"artifact.openPdf":`打开 PDF`,"artifact.noPreview":`此文件类型无法安全地在线预览。`,"artifact.downloadHint":`请下载后使用本地应用查看。`,"task.details":`任务详情`,"task.stopLoop":`停止循环`,"task.done":`完成`,"task.skip":`跳过`,"task.close":`关闭任务详情`,"task.waitingOnYou":`等待你的回复`,"task.objective":`目标`,"task.noObjective":`(未记录目标)`,"task.untitled":`未命名任务`,"task.priority":`优先级`,"task.started":`开始时间`,"task.finished":`完成时间`,"task.outcome":`结果`,"task.iteration":`迭代`,"task.mode":`模式`,"task.autoIterate":`自动迭代`,"task.singlePass":`单次执行`,"task.cycles":`轮次`,"task.cost":`成本`,"task.lastError":`最近错误`,"task.notes":`备注`,"task.dependsOn":`依赖`,"task.dependsOnCount":`依赖前置任务 {count} 项`,"pending.reviewRespond":`查看并回复`,"pending.showOnMap":`在地图上查看`,"backlog.active":`进行中 · {count}`,"backlog.history":`历史记录 · {count}`,"backlog.noHistory":`暂无已完成工作`,"backlog.empty":`队列中没有工作。Argus 已准备好接收新任务。`,"backlog.viewDetails":`查看完整任务详情`,"backlog.iterating":`重复执行中`,"backlog.stopIterating":`停止重复执行`,"backlog.stop":`停止`,"backlog.markDone":`标记为完成`,"backlog.remove":`移除`,"mission.achievement":`Argus 成果`,"mission.elapsed":`耗时`,"mission.rejectedAttempts":`{count} 次方案被拒绝`,"mission.skillsLearned":`学习了 {count} 个 Skill`,"mission.artifacts":`产出 {count} 个文件`,"mission.waiting":`等待任务`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`已准备就绪,请分配一个任务开始工作。`,"mission.statusDone":`本次任务:{outcome} — 用时 {elapsed}。`,"mission.nextAfterReply":`请先回复这项任务的问题,再决定它的下一步。`,"mission.continuousDone":`连续运行已完成`,"mission.resumeContinuous":`恢复`,"mission.control":`任务控制`,"mission.attentionHealth":`系统出错——运行状态异常。`,"mission.attentionFailed":`任务失败——请查看下方详情。`,"mission.deliveryFailed":`任务在交付阶段失败——执行未能启动或完成。`,"mission.attentionStepFailed":`有一个步骤失败——请查看下方任务。`,"mission.attentionPaused":`任务已暂停——正在等待你的输入。`,"mission.showObjective":`显示完整目标`,"mission.showFullOutput":`查看完整输出`,"mission.stage":`阶段`,"mission.campaign":`持续任务`,"mission.totalElapsed":`总耗时`,"mission.round":`轮次`,"mission.mode":`模式`,"mission.summary":`本次完成`,"mission.deliveryCertified":`交付成果已通过审核`,"mission.taskCompleted":`任务已完成`,"mission.openResult":`打开成果`,"mission.viewTask":`查看任务`,"mission.taskPlan":`任务计划`,"mission.team":`团队`,"mission.waitingShort":`等待中`,"mission.roleWork":`角色工作`,"mission.showMore":`显示更多`,"mission.showLess":`收起`,"mission.done":`已完成`,"mission.inProgress":`进行中`,"mission.failed":`失败`,"mission.bannerPaused":`任务已暂停 — 等待你的操作。`,"mission.bannerError":`系统异常 — 健康状态已降级。`,"mission.bannerStepFailed":`某步骤失败:{step}`,"mission.elapsedAgo":`{elapsed} 前`,"mission.filteredBy":`按 {task} 筛选 · 清除`,"mission.allVisible":`全部可见任务`,"mission.roundNumber":`第 {count} 轮`,"mission.noRoleWork":`当前筛选下还没有持久化的 {role} 工作记录。`,"mission.researchDag":`任务路线`,"mission.active":`进行中`,"mission.noDag":`Planner 尚未向路线中添加任务。`,"mission.workingHypothesis":`当前假设 · 可随证据调整`,"mission.goalContribution":`对目标的作用`,"mission.temporaryRegressions":`预期的暂时取舍`,"mission.decisionRule":`何时调整、拆分或停止`,"mission.acceptance":`完成的标准`,"mission.nonGoals":`非目标`,"mission.capabilities":`能力`,"mission.capabilitiesUnlocked":`已解锁能力`,"mission.learnedCapability":`已学习能力`,"mission.learnedDuring":`在“{mission}”期间学习`,"mission.skillUnavailable":`当前快照中没有此 Skill 的内容。`,"mission.contentTruncated":`内容预览已截断`,"mission.knowledgeRetained":`已保留知识`,"mission.selfEvolution":`已保存的项目知识`,"mission.knowledgeSaved":`Argus 已保存这些能力和笔记,供本项目后续工作使用。`,"mission.noCapabilities":`尚未学习新能力。`,"mission.replay":`任务回放`,"mission.replayTimeline":`回放任务时间线`,"mission.roleFailed":`{role} 执行失败`,"mission.showingLatestEvent":`显示最近一条事件`,"mission.showingLastEvents":`显示最近 {count} 条事件`,"mission.waitingEvents":`等待结构化研究事件。`,"mission.startsAfter":`需等待前置任务 {count} 项`,"mission.hiddenTasks":`已隐藏前序任务 {count} 项 · 阻塞或失败 {failed} 项 · 已跳过 {skipped} 项`,"mission.projectFilesChanged":`项目文件有变更`,"mission.reviewInIde":`可打开 IDE 查看差异`,"research.currentWork":`当前工作`,"research.dagProgress":`任务路线进度`,"research.verifiedOutputs":`已验证输出`,"research.recentMilestones":`近期里程碑`,"research.liveProgress":`任务进展`,"research.artifact":`研究成果`,"research.canvas":`Manager 实时研究面板`,"research.previewArtifact":`预览成果`,"research.openLarge":`打开大尺寸预览`,"research.collapse":`收起预览`,"research.unavailable":`Manager 实时视图暂时不可用。`,"research.noPreview":`暂无预览`,"research.waiting":`等待中…`,"research.updating":`正在更新…`,"research.fileUnavailable":`文件已就绪,可点击上方下载按钮获取。`,"research.eventSourced":`基于事件的任务状态`,"research.downloadFailed":`下载失败`,"operations.title":`运行控制`,"operations.work":`工作`,"operations.runtime":`运行时`,"operations.system":`系统`,"operations.recovery":`恢复`,"operations.workInput":`工作输入`,"operations.workHint":`加入工作、指导当前任务、保存备注,或仅预览计划而不分派。`,"operations.action.task":`任务`,"operations.action.nudge":`指导`,"operations.action.note":`备注`,"operations.action.plan":`计划`,"operations.planPlaceholder":`要预览的目标;预览不会加入任务队列`,"operations.actionPlaceholder":`输入 {action} 内容`,"operations.previewPlan":`预览计划`,"operations.submitAction":`提交 {action}`,"operations.runtimeHint":`更改会话运行位置、重置 Manager 上下文,或安全重启会话。`,"operations.workdir":`工作目录`,"operations.workdirUpdated":`工作目录已更新。`,"operations.applyWorkdir":`应用工作目录`,"operations.replaceSlot":`替换活动会话`,"operations.sourceUpdate":`Argus 源码版本`,"operations.pullLatest":`拉取最新版本`,"operations.updateChecking":`正在检查已发布分支…`,"operations.updateRunning":`正在更新…`,"operations.updateAvailable":`有可用更新`,"operations.updateCurrent":`已是最新`,"operations.updateUnavailable":`当前工作树无法安全更新。`,"operations.currentRevision":`当前`,"operations.latestRevision":`最新`,"operations.updatePhase":`阶段`,"operations.updateRestart":`源码已更新。请重启工作台,再使用重载按钮让活动 daemon 在安全任务边界切换到新版本。`,"operations.skills":`Skills`,"operations.runSkill":`运行 Skill 命令`,"operations.metrics":`系统指标`,"operations.trash":`可恢复的回收站`,"operations.searchTrash":`搜索回收站`,"operations.trashEmpty":`回收站为空。`,"resource.title":`资源`,"resource.loading":`正在加载资源状态…`,"resource.devices":`设备:{count}`,"resource.inUse":`使用中 · {count}`,"resource.queue":`等待队列 · {count}`,"resource.none":`无`,"resource.timeLeft":`剩余 {ttl}`,"resource.noIntent":`未记录用途`,"resource.yieldRequest":`收到释放资源请求 · {reason}`,"resource.queuePosition":`队列第 {position} 位`,"label.status.inProgress":`进行中`,"label.status.waiting":`等待中`,"label.status.completed":`已完成`,"label.status.blocked":`暂时无法继续`,"label.status.failed":`失败`,"label.status.needsChanges":`需要修改`,"label.status.skipped":`已跳过`,"label.status.paused":`已暂停`,"label.status.cancelled":`已取消`,"label.status.available":`可用`,"label.status.unavailable":`不可用`,"label.status.inaccessible":`无法访问`,"label.status.limited":`部分受限`,"label.status.healthy":`状态正常`,"label.status.updated":`状态已更新`,"label.role.argus":`Argus`,"label.role.you":`你`,"label.work.task":`任务`,"label.work.action":`工作步骤`,"label.work.handoff":`给下一步的说明`,"label.work.review":`审核`,"label.work.planning":`规划`,"label.work.update":`动态`,"label.stage.scope":`范围定义`,"label.stage.research":`研究`,"label.stage.implementation":`方法实现`,"label.stage.experiment":`实验验证`,"label.stage.analysis":`结果分析`,"label.stage.writing":`论文写作`,"label.stage.review":`最终审核`,"label.stage.delivery":`成果交付`,"label.stage.unstaged":`未分阶段`,"label.frontier.reopened":`已重新开启一项前序任务`,"label.frontier.added":`已添加一项新任务`,"label.frontier.completed":`这部分工作已完成`,"label.frontier.revised":`已调整任务计划`,"label.frontier.narrowed":`已缩小任务范围`,"label.frontier.expanded":`已扩大任务范围`,"label.frontier.updated":`任务计划已更新`,"label.priority":`优先级 {priority}`,"label.outcome.workCompleted":`工作已完成`,"label.outcome.workPaused":`工作已暂停`,"label.outcome.workBlocked":`工作暂时无法继续`,"label.outcome.workFailed":`工作失败`,"label.outcome.workEnded":`工作已结束`,"label.outcome.workIncomplete":`工作尚未完成`,"label.outcome.workStalled":`工作停滞`,"label.outcome.workUpdated":`工作状态已更新`,"label.outcome.reviewPassed":`结果检查通过`,"label.outcome.reviewNeedsChanges":`检查后发现需要修改`,"label.outcome.reviewBlocked":`结果检查暂时无法继续`,"label.outcome.reviewOutdated":`审核结果已过期`,"label.outcome.reviewPending":`等待审核`,"label.outcome.stageApproved":`可以进入下一步`,"label.outcome.stageNotApproved":`还不能进入下一步`,"label.outcome.stageRevoked":`阶段批准已撤回`,"label.outcome.stageNotNeeded":`无需阶段审核`,"label.outcome.stagePending":`还没确定能否进入下一步`,"label.outcome.budgetPaused":`因预算上限暂停`,"label.outcome.costUnreconciled":`调用费用待对账(并非预算耗尽)`,"label.outcome.waitingForYou":`正在等待你的回复`,"label.outcome.stoppedByYou":`已由你停止`,"label.outcome.pausedByYou":`已由你暂停`,"label.outcome.sessionPaused":`会话已暂停`,"label.outcome.serviceUnavailable":`服务暂不可用`,"label.outcome.serviceCoolingDown":`服务暂时暂停`,"label.outcome.temporaryIssue":`因临时问题暂停`,"label.outcome.serviceError":`因服务错误停止`,"label.outcome.needsPlan":`需要制定新计划`,"label.outcome.canResume":`可以继续`,"label.routing.team":`团队协作`,"label.routing.individual":`单独执行`,"label.routing.research":`研究任务`,"label.routing.software":`软件工作`,"label.routing.staged":`分步执行`,"label.routing.flexible":`灵活流程`,"label.routing.ongoing":`持续进行`,"label.routing.defined":`范围明确`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`加速设备`,"label.resource.enforced":`强制执行限制`,"label.resource.advisory":`仅提供建议`,"label.resource.released":`已释放资源`,"label.resource.kept":`继续占用资源`,"mission.lastProgress":`停下之前记录的进展`,"mission.nextResume":`进度已保存,重新运行 Argus 就会从停下的地方继续。`,"mission.nextResumeLive":`Argus 会从已保存的进度继续。`,"research.totalTime":`累计用时`,"research.optionDelivery":`交付`,"research.optionCheckpoint":`检查点`,"research.optionPending":`生成中`,"operations.unavailableHere":`这项功能在当前的 Argus 上不提供。`,"operations.requestFailed":`这次操作没有成功。`,"operations.technicalDetails":`技术细节`,"verticals.title":`垂域商店`,"verticals.entry":`垂域商店`,"verticals.openStore":`打开垂域商店`,"verticals.paletteHint":`安装 · 启用 · 更新`,"verticals.intro":`垂域为 Argus 提供一个研究领域的阶段、角色、技能与检查项。按项目需要安装,并为各工作区分别启用。`,"verticals.hostedNote":`垂域由服务方提供;你可以为自己的工作区启用或停用。`,"verticals.close":`关闭垂域商店`,"verticals.search":`搜索垂域`,"verticals.searchPlaceholder":`按名称、用途或标签搜索…`,"verticals.refreshCatalog":`刷新目录`,"verticals.refreshing":`正在刷新…`,"verticals.catalogSource":`目录来源:{source}`,"verticals.catalogRelease":`版本 {tag}`,"verticals.catalogFetched":`{time} 获取`,"verticals.catalogNever":`尚未获取目录`,"verticals.catalogError":`目录刷新失败:{error}`,"verticals.kindFilter":`按类型筛选`,"verticals.tagFilter":`按标签筛选`,"verticals.clearFilters":`清除筛选`,"verticals.count":`显示 {shown} / {total}`,"verticals.filter.all":`全部`,"verticals.routingPath":`分类 / 领域 / 专项`,"verticals.filter.installed":`已安装`,"verticals.filter.available":`可安装`,"verticals.filter.builtin":`内置`,"verticals.kind.builtin":`内置`,"verticals.kind.package":`随包提供`,"verticals.kind.installed":`已安装`,"verticals.kind.available":`可安装`,"verticals.enabled":`已启用`,"verticals.disabledState":`已停用`,"verticals.updateAvailable":`有新版本`,"verticals.updateTo":`更新至 {version}`,"verticals.installedVersion":`已安装 {version}`,"verticals.catalogVersion":`目录版本 {version}`,"verticals.requires":`依赖`,"verticals.shared":`共享资源`,"verticals.size":`大小`,"verticals.jumpTo":`查看 {name}`,"verticals.missingPython":`缺少 Python 包:{packages}。请把它们安装到运行 Argus 的那个 Python 环境里。`,"verticals.runtimeIssues":`已安装版本与当前 Argus 运行时不兼容:{issues}`,"verticals.installIssues":`目录版本的安装/更新被运行时要求阻止:{issues}`,"verticals.usedByOne":`1 个项目在用`,"verticals.usedBy":`{count} 个项目在用`,"verticals.action.install":`安装`,"verticals.action.update":`更新`,"verticals.action.enable":`启用`,"verticals.action.disable":`停用`,"verticals.action.uninstall":`卸载`,"verticals.confirmUninstall":`确认卸载`,"verticals.confirmUninstallHint":`将从这台 Argus 移除 {name}。`,"verticals.removeAnyway":`仍要移除`,"verticals.operation.install":`正在安装…`,"verticals.operation.update":`正在更新…`,"verticals.operation.enable":`正在启用…`,"verticals.operation.disable":`正在停用…`,"verticals.operation.uninstall":`正在卸载…`,"verticals.operationRunning":`处理中…`,"verticals.operationFailed":`{action}失败`,"verticals.loading":`正在读取垂域…`,"verticals.noMatches":`没有符合筛选条件的垂域。`,"verticals.none":`目前还没有可用的垂域。`,"verticals.loadFailed":`无法读取垂域列表。`,"verticals.actionFailed":`这次操作没有成功。`,"verticals.tooOld":`当前的 Argus 后端还没有垂域商店。请先更新 Argus,再打开这里管理垂域。`};function wt(){try{let e=localStorage.getItem(xt);if(e===`en`||e===`zh-CN`)return e}catch{}return navigator.language.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}function Tt(e,t={},n=wt()){let r=(n===`zh-CN`?Ct[e]:St[e])??e;return Et.has(e)&&(r=r.replace(/\bArgus\b/g,yt().name)),r.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??`{${n}}`))}var Et=new Set([`handshake.connecting`,`handshake.title`,`splash.starting`,`connection.pairingTitle`,`topbar.pauseDaemon`,`topbar.runDaemon`,`chat.messageArgus`,`palette.messageArgus`,`palette.stopDaemon`,`palette.startDaemon`,`role.system`,`label.role.argus`]),Dt=(0,x.createContext)({locale:`en`,setLocale:()=>void 0,t:(e,t)=>Tt(e,t,`en`)});function O({children:e}){let[t,n]=(0,x.useState)(wt),r=e=>{try{localStorage.setItem(xt,e)}catch{}n(e)};(0,x.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,x.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Tt(e,n,t)}),[t]);return(0,D.jsx)(Dt.Provider,{value:i,children:e})}function Ot(){return(0,x.useContext)(Dt)}var kt=class extends x.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){if(!this.state.failed)return this.props.children;let e=this.props.locale===`zh-CN`;return(0,D.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-bg p-8 text-ink`,role:`alert`,children:(0,D.jsxs)(`section`,{className:`max-w-lg rounded-xl border border-line bg-panel p-8 shadow-lg`,children:[(0,D.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-widest text-blue`,children:yt().name}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:e?`工作台暂时无法显示`:`The workspace could not be displayed`}),(0,D.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`页面资源未能正确加载。后端任务不会因此被停止;你仍可使用桌面菜单查看日志或设置。重新加载会丢弃页面中尚未发送的输入。`:`A page resource failed to load. Backend work has not been stopped. Desktop menus remain available for logs and settings. Reloading discards unsent input on this page.`}),(0,D.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,D.jsx)(`button`,{type:`button`,className:`rounded-md bg-blue px-4 py-2 text-sm text-white`,onClick:()=>window.location.reload(),children:e?`重新加载工作台`:`Reload workspace`}),(0,D.jsx)(`button`,{type:`button`,className:`rounded-md border border-line px-4 py-2 text-sm`,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`view`,`activity`),window.location.assign(e.toString())},children:e?`返回对话页面`:`Return to conversation`})]})]})})}};function At(){let e=(0,x.useSyncExternalStore)(xe,be,()=>!1),{locale:t}=Ot();if(!e)return null;let n=t===`zh-CN`;return(0,D.jsxs)(`div`,{role:`status`,className:`fixed left-1/2 top-3 z-[110] flex w-[min(92vw,42rem)] -translate-x-1/2 items-center gap-3 rounded-xl border border-blue/40 bg-panel px-4 py-3 text-sm text-ink shadow-xl`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`strong`,{children:n?`页面已更新`:`Page update available`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:n?`刷新后显示最新选项和功能。请先复制未发送的内容。`:`Refresh for the latest options and features. Copy any unsent text first.`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`shrink-0 rounded-md border border-blue/40 px-3 py-2 text-xs text-blue`,children:n?`刷新页面`:`Refresh page`})]})}var k={ADVISOR_CONSULTATION_REQUESTED:`advisor.consultation.requested`,ADVISOR_CONSULTATION_COMPLETED:`advisor.consultation.completed`,ADVISOR_CONSULTATION_FAILED:`advisor.consultation.failed`,ADVISOR_CONSULTATION_CANCELLED:`advisor.consultation.cancelled`,ADVISOR_CONSULTATION_TIMED_OUT:`advisor.consultation.timed_out`,ADVISOR_CONSULTATION_MODEL_MISMATCH:`advisor.consultation.model_mismatch`,LIFE_MANAGER_SUPERVISION_ISSUED:`life.manager.supervision.issued`,LIFE_MANAGER_SUPERVISION_APPLIED:`life.manager.supervision.applied`,LIFE_MANAGER_SUPERVISION_FAILED:`life.manager.supervision.failed`,LIFE_PEER_MESSAGE_PROCESSED:`life.peer.message.processed`,LIFE_CONFIG_PARSE_FAILED:`life.config.parse_failed`,AGENT_IO_START:`agent.io.start`,AGENT_IO_STREAM:`agent.io.stream`,AGENT_IO_COMPLETE:`agent.io.complete`,AGENT_IO_ERROR:`agent.io.error`,USAGE_RECORDED:`usage.recorded`,ACCOUNTING_JOURNAL_REPAIRED:`accounting.journal_repaired`,PROVIDER_REQUEST_STARTED:`provider.request.started`,PROVIDER_REQUEST_COMPLETED:`provider.request.completed`,PROVIDER_REQUEST_DENIED:`provider.request.denied`,CODEX_UTIL_COMPLETED:`codex.util.completed`,SKILL_COST_COMPLETED:`skill.cost.completed`,BUDGET_RESERVATION_CREATED:`budget.reservation.created`,BUDGET_RESERVATION_DENIED:`budget.reservation.denied`,BUDGET_RESERVATION_SETTLED:`budget.reservation.settled`,BUDGET_RESERVATION_RELEASED:`budget.reservation.released`,BUDGET_UNPRICED_BLOCKED:`budget.unpriced.blocked`,BUDGET_UNPRICED_ACKNOWLEDGED:`budget.unpriced.acknowledged`,LOOP_START:`loop.start`,LOOP_DONE:`loop.done`,ROUND_START:`round.start`,ROUND_MAIN_COMPLETED:`round.main.completed`,ROUND_REVIEW_STARTED:`round.review.started`,ROUND_REVIEW_DEFERRED:`round.review.deferred`,ROUND_REVIEW_COMPLETED:`round.review.completed`,ROUND_CHECKPOINT_RECORDED:`round.checkpoint.recorded`,ROUND_CHECKPOINT_FAILED:`round.checkpoint.failed`,ROUND_SECRET_REDACTED:`round.secret_redacted`,ROUND_ESCALATED:`round.escalated`,ROUND_STALL:`round.stall`,ROUND_REVIEWER_BACKEND_FAILURE:`round.reviewer_backend_failure`,ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF:`round.reviewer_backend_failure.backoff`,ROUND_BACKEND_FAILURE_BACKOFF:`round.backend_failure.backoff`,ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED:`round.backend_failure.hold_interrupted`,ROUND_WATCHDOG_RETRY:`round.watchdog.retry`,ROUND_WATCHDOG_RETRY_EXHAUSTED:`round.watchdog.retry_exhausted`,ROUND_MODEL_CONFIGURATION_ERROR:`round.model_configuration_error`,ROUND_PROVIDER_TURN_CAP_RESTART:`round.provider_turn_cap.restart`,ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART:`round.provider_turn_cap.reviewer_restart`,ROUND_ORPHAN_PROCESS_GROUP:`round.orphan_process_group`,ROUND_EXTERNAL_WORK_WAIT_STARTED:`round.external_work_wait.started`,ROUND_EXTERNAL_WORK_WAIT_COMPLETED:`round.external_work_wait.completed`,ROUND_EXTERNAL_WORK_REVIEW_REQUIRED:`round.external_work_review.required`,ROUND_EXTERNAL_WORK_REVIEW_COMPLETED:`round.external_work_review.completed`,ROLE_SESSION_TURN:`role.session.turn`,ENGINEER_PROGRESS:`engineer.progress`,ENGINEER_SKILL_MAINTENANCE_COMPLETED:`engineer.skill_maintenance.completed`,LIFE_STATUS:`life.status`,LIFE_PHASE_STARTED:`life.phase.started`,LIFE_MISSION_STARTED:`life.mission.started`,LIFE_MISSION_COMPLETED:`life.mission.completed`,LIFE_MISSION_FAILED:`life.mission.failed`,LIFE_MISSION_SKIPPED:`life.mission.skipped`,LIFE_MISSION_ORPHANED:`life.mission.orphaned`,LIFE_MISSION_REQUEUED:`life.mission.requeued`,LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED:`life.mission.provider_configuration_disabled`,LIFE_ITERATION_CONTINUED:`life.iteration.continued`,LIFE_REVIEW_WAIVED:`life.review.waived`,LIFE_POST_MISSION_STOP:`life.post_mission.stop`,LIFE_EXECUTION_HOST_BLOCKED:`life.execution_host.blocked`,LIFE_AUTH_FAILURE:`life.auth_failure`,LIFE_SUPERVISOR_ERROR:`life.supervisor.error`,LIFE_LEARNED_VERTICAL_PROMOTED:`life.learned_vertical.promoted`,LIFE_LEARNED_VERTICAL_PROMOTION_FAILED:`life.learned_vertical.promotion_failed`,LIFE_MANAGER_INTENT_STARTED:`life.manager.intent.started`,LIFE_MANAGER_INTENT_COMPLETED:`life.manager.intent.completed`,LIFE_MANAGER_INTENT_FAILED:`life.manager.intent.failed`,LIFE_MANAGER_INTENT_SUPERSEDED:`life.manager.intent.superseded`,LIFE_MANAGER_GOAL_CONTRACT_FAILED:`life.manager.goal_contract.failed`,LIFE_MANAGER_STAGE_DECISION:`life.manager.stage_decision`,LIFE_MANAGER_PLAN_CHALLENGE_DECIDED:`life.manager.plan_challenge.decided`,LIFE_MANAGER_FEEDBACK_PERSISTED:`life.manager.feedback.persisted`,LIFE_MANAGER_FEEDBACK_UNRESOLVED:`life.manager.feedback.unresolved`,LIFE_MANAGER_FEEDBACK_EXHAUSTED:`life.manager.feedback.exhausted`,LIFE_MANAGER_PROJECT_REPORT:`life.manager.project_report`,LIFE_MANAGER_PROJECT_REPORT_FAILED:`life.manager.project_report.failed`,LIFE_VERTICAL_RESOLVED:`life.vertical.resolved`,LIFE_MANAGER_BACKEND_RESOLVED:`life.manager.backend_resolved`,LIFE_PLANNER_BACKEND_RESOLVED:`life.planner.backend_resolved`,LIFE_ENGINEER_BACKEND_RESOLVED:`life.engineer.backend_resolved`,LIFE_REVIEWER_BACKEND_RESOLVED:`life.reviewer.backend_resolved`,LIFE_CURATOR_BACKEND_RESOLVED:`life.curator.backend_resolved`,LIFE_PLANNER_START:`life.planner.start`,LIFE_PLANNER_PREVIEW_SKIPPED:`life.planner.preview_skipped`,LIFE_PLANNER_NORMALIZED:`life.planner.normalized`,LIFE_PLANNER_TASK_ADDED:`life.planner.task_added`,LIFE_PLANNER_TASK_SKIPPED:`life.planner.task_skipped`,LIFE_PLANNER_VERDICT:`life.planner.verdict`,LIFE_PLANNER_WAITING:`life.planner.waiting`,LIFE_PLANNER_WAITING_WOKEN:`life.planner.waiting_woken`,LIFE_PLANNER_TERMINAL_IDLE:`life.planner.terminal_idle`,LIFE_PLANNER_VERIFICATION_PROBE:`life.planner.verification_probe`,LIFE_PLANNER_STALL_ESCALATION:`life.planner.stall_escalation`,LIFE_PLANNER_DEPENDENCY_DROPPED:`life.planner.dependency_dropped`,LIFE_PLANNER_PARALLEL_DROPPED:`life.planner.parallel_dropped`,LIFE_PLANNER_ERROR:`life.planner.error`,LIFE_PLANNER_DEFERRED:`life.planner.deferred`,LIFE_PLANNER_SUPERSEDED:`life.planner.superseded`,LIFE_PLANNER_WAIT_OVERRIDDEN:`life.planner.wait_overridden`,LIFE_PLANNER_WAITING_CONTRACT_NORMALIZED:`life.planner.waiting_contract.normalized`,LIFE_PLANNER_EXTERNAL_POLL_SUPPRESSED:`life.planner.external_poll_suppressed`,LIFE_PLANNER_VERDICT_DISCARDED:`life.planner.verdict.discarded`,LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED:`life.planner.final_submission_skipped`,LIFE_PLANNER_CONTINUATION_REQUIRED:`life.planner.continuation_required`,LIFE_PLANNER_COMPLETION_REJECTED:`life.planner.completion_rejected`,LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED:`life.planner.completion_circuit_opened`,LIFE_PLANNER_COMPLETION_CIRCUIT_HOLDING:`life.planner.completion_circuit_holding`,LIFE_PLANNER_COMPLETION_CIRCUIT_NOTIFY_FAILED:`life.planner.completion_circuit.notify_failed`,PLAN_DRAFT_START:`plan.draft.start`,PLAN_DRAFT_DONE:`plan.draft.done`,PLAN_DRAFT_FAILED:`plan.draft.failed`,LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED:`life.runtime_failure.circuit_opened`,LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED:`life.runtime_failure.circuit_blocked`,LIFE_RUNTIME_FAILURE_CANARY_PASSED:`life.runtime_failure.canary_passed`,LIFE_RUNTIME_INCIDENT_DETECTED:`life.runtime.incident.detected`,LIFE_RUNTIME_INCIDENT_RECOVERED:`life.runtime.incident.recovered`,LIFE_RUNTIME_INCIDENT_ESCALATED:`life.runtime.incident.escalated`,LIFE_PLAN_REVISION_PROPOSED:`life.plan.revision.proposed`,LIFE_PLAN_REVISION_REJECTED:`life.plan.revision.rejected`,LIFE_PLAN_REVISION_COMMITTED:`life.plan.revision.committed`,LIFE_PLAN_NODE_SUPERSEDED:`life.plan.node.superseded`,LIFE_PLAN_REVISION_ROLLED_BACK:`life.plan.revision.rolled_back`,LIFE_RESEARCH_SECOND_READING:`life.research.second_reading`,LIFE_LETTER_WRITTEN:`life.letter.written`,LIFE_BUDGET_PAUSE:`life.budget.pause`,LIFE_LIFECYCLE_BLOCK:`life.lifecycle.block`,LIFE_LIFECYCLE_TRANSITION:`life.lifecycle.transition`,LIFE_INBOX_QUEUED:`life.inbox.queued`,LIFE_INBOX_DRAINED:`life.inbox.drained`,LIFE_OPERATOR_QUESTION_PENDING:`life.operator_question.pending`,LIFE_OPERATOR_QUESTION_ANSWERED:`life.operator_question.answered`,LIFE_DAEMON_IDLE_TIMEOUT:`life.daemon.idle_timeout`,LIFE_DAEMON_READY:`life.daemon.ready`,LIFE_DAEMON_DEGRADED:`life.daemon.degraded`,PROJECT_COMPLETED:`project.completed`,PROJECT_COMPLETION_REFUSED:`project.completion_refused`,DAEMON_PARKED:`daemon.parked`,DAEMON_COMMAND_SUBMITTED:`daemon.command.submitted`,DAEMON_COMMAND_COMPLETED:`daemon.command.completed`,DAEMON_COMMAND_REJECTED:`daemon.command.rejected`,IDEA_SEARCH_STARTED:`idea.search.started`,IDEA_SEARCH_COMPLETED:`idea.search.completed`,IDEA_SEARCH_SKIPPED:`idea.search.skipped`,IDEA_PORTFOLIO_FORMED:`idea.portfolio.formed`,IDEA_PORTFOLIO_NESTED_SKIPPED:`idea.portfolio.nested_skipped`,VENUE_RESEARCH_STARTED:`venue.research.started`,VENUE_RESEARCH_COMPLETED:`venue.research.completed`,RESEARCH_ACHIEVEMENT_CERTIFIED:`research.achievement.certified`,SKILL_LIBRARY_AVAILABLE:`skill.library.available`,SKILL_CREATED:`skill.created`,SKILL_UPDATED:`skill.updated`,SKILL_ARCHIVED:`skill.archived`,SKILL_TIDIED:`skill.tidied`,SKILL_HISTORY_COMPRESSED:`skill.history.compressed`,SKILL_EVOLUTION_COMPLETED:`skill.evolution.completed`,TEAM_LEARNING_REVIEW_STARTED:`team.learning.review.started`,TEAM_LEARNING_REVIEW_SKIPPED:`team.learning.review.skipped`,TEAM_LEARNING_REVIEW_COMPLETED:`team.learning.review.completed`,TEAM_LEARNING_REVIEW_FAILED:`team.learning.review.failed`,TEAM_LEARNING_PROMOTION_QUARANTINED:`team.learning.promotion.quarantined`,SELF_LEARNING_REVIEW_STARTED:`self.learning.review.started`,SELF_LEARNING_REVIEW_COMPLETED:`self.learning.review.completed`,SELF_LEARNING_REVIEW_FAILED:`self.learning.review.failed`,DOMAIN_PROMOTION:`domain.promotion`,WIKI_INITIALIZED:`wiki.initialized`,WIKI_HOOK_WARNING:`wiki.hook.warning`,WIKI_CREATED:`wiki.created`,WIKI_UPDATED:`wiki.updated`,WIKI_RETIRED:`wiki.retired`,WIKI_PROMOTION_PROMOTED:`wiki.promotion.promoted`,WIKI_PROMOTION_DEMOTED:`wiki.promotion.demoted`,WIKI_RETIRED_COMPRESSED:`wiki.retired.compressed`,WIKI_EVOLUTION_COMPLETED:`wiki.evolution.completed`,KNOWLEDGE_LEARNED:`knowledge.learned`,KNOWLEDGE_RECALLED:`knowledge.recalled`,OPERATOR_ALERT:`operator_alert`,MANAGER_LIVE_VIEW_UPDATED:`manager.live_view.updated`,MANAGER_LIVE_VIEW_REJECTED:`manager.live_view.rejected`,MANAGER_TURN_STARTED:`manager.turn.started`,MANAGER_TURN_CANCELLED:`manager.turn.cancelled`,USER_NOTE:`user.note`,UI_OPERATOR:`ui.operator`,UI_ARGUS:`ui.argus`},jt={"loop.started":k.LOOP_START,"loop.completed":k.LOOP_DONE,"round.started":k.ROUND_START,"mission.started":k.LIFE_MISSION_STARTED,"mission.completed":k.LIFE_MISSION_COMPLETED,"mission.error":k.LIFE_MISSION_FAILED};k.ADVISOR_CONSULTATION_COMPLETED,k.ADVISOR_CONSULTATION_FAILED,k.ADVISOR_CONSULTATION_CANCELLED,k.ADVISOR_CONSULTATION_TIMED_OUT,k.ADVISOR_CONSULTATION_MODEL_MISMATCH,k.LIFE_MANAGER_SUPERVISION_APPLIED,k.LIFE_MANAGER_SUPERVISION_FAILED,k.LIFE_PEER_MESSAGE_PROCESSED,k.LIFE_CONFIG_PARSE_FAILED,k.LIFE_MANAGER_BACKEND_RESOLVED,k.LIFE_PLANNER_BACKEND_RESOLVED,k.LIFE_ENGINEER_BACKEND_RESOLVED,k.LIFE_REVIEWER_BACKEND_RESOLVED,k.LIFE_CURATOR_BACKEND_RESOLVED,k.LOOP_START,k.LOOP_DONE,k.ROUND_START,k.ROUND_MAIN_COMPLETED,k.ROUND_REVIEW_DEFERRED,k.ROUND_REVIEW_COMPLETED,k.ROUND_CHECKPOINT_RECORDED,k.ROUND_CHECKPOINT_FAILED,k.ROUND_SECRET_REDACTED,k.ROUND_ESCALATED,k.ROUND_STALL,k.ROUND_REVIEWER_BACKEND_FAILURE,k.ENGINEER_SKILL_MAINTENANCE_COMPLETED,k.SKILL_LIBRARY_AVAILABLE,k.SKILL_CREATED,k.SKILL_UPDATED,k.SKILL_ARCHIVED,k.SKILL_TIDIED,k.SKILL_HISTORY_COMPRESSED,k.SKILL_EVOLUTION_COMPLETED,k.WIKI_INITIALIZED,k.WIKI_HOOK_WARNING,k.WIKI_CREATED,k.WIKI_UPDATED,k.WIKI_RETIRED,k.WIKI_PROMOTION_PROMOTED,k.WIKI_PROMOTION_DEMOTED,k.WIKI_RETIRED_COMPRESSED,k.WIKI_EVOLUTION_COMPLETED,k.KNOWLEDGE_LEARNED,k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MANAGER_INTENT_STARTED,k.LIFE_MANAGER_INTENT_COMPLETED,k.LIFE_MANAGER_INTENT_FAILED,k.LIFE_MANAGER_STAGE_DECISION,k.LIFE_MANAGER_PLAN_CHALLENGE_DECIDED,k.LIFE_VERTICAL_RESOLVED,k.LIFE_PLANNER_START,k.LIFE_PLANNER_PREVIEW_SKIPPED,k.LIFE_PLANNER_TASK_ADDED,k.LIFE_PLANNER_TASK_SKIPPED,k.LIFE_PLANNER_DEPENDENCY_DROPPED,k.LIFE_PLANNER_PARALLEL_DROPPED,k.LIFE_PLANNER_VERDICT,k.LIFE_PLANNER_WAITING,k.LIFE_PLANNER_WAITING_WOKEN,k.LIFE_PLANNER_TERMINAL_IDLE,k.LIFE_PLANNER_VERIFICATION_PROBE,k.LIFE_PLANNER_STALL_ESCALATION,k.LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED,k.LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED,k.LIFE_RUNTIME_FAILURE_CANARY_PASSED,k.LIFE_RUNTIME_INCIDENT_DETECTED,k.LIFE_RUNTIME_INCIDENT_RECOVERED,k.LIFE_RUNTIME_INCIDENT_ESCALATED,k.LIFE_PLAN_REVISION_PROPOSED,k.LIFE_PLAN_REVISION_REJECTED,k.LIFE_PLAN_REVISION_COMMITTED,k.LIFE_PLAN_NODE_SUPERSEDED,k.LIFE_RESEARCH_SECOND_READING,k.LIFE_LETTER_WRITTEN,k.LIFE_BUDGET_PAUSE,k.BUDGET_RESERVATION_DENIED,k.BUDGET_UNPRICED_BLOCKED,k.LIFE_LIFECYCLE_BLOCK,k.LIFE_LIFECYCLE_TRANSITION,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.LIFE_INBOX_QUEUED,k.LIFE_INBOX_DRAINED,k.LIFE_DAEMON_IDLE_TIMEOUT,k.PROJECT_COMPLETED,k.PROJECT_COMPLETION_REFUSED,k.DAEMON_PARKED,k.DAEMON_COMMAND_COMPLETED,k.DAEMON_COMMAND_REJECTED,k.IDEA_SEARCH_STARTED,k.IDEA_SEARCH_COMPLETED,k.IDEA_SEARCH_SKIPPED,k.VENUE_RESEARCH_STARTED,k.VENUE_RESEARCH_COMPLETED,k.RESEARCH_ACHIEVEMENT_CERTIFIED,k.LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED,k.LIFE_ITERATION_CONTINUED,k.LIFE_REVIEW_WAIVED,k.LIFE_POST_MISSION_STOP,k.LIFE_EXECUTION_HOST_BLOCKED,k.LIFE_AUTH_FAILURE,k.LIFE_SUPERVISOR_ERROR,k.LIFE_LEARNED_VERTICAL_PROMOTED,k.LIFE_LEARNED_VERTICAL_PROMOTION_FAILED,k.LIFE_MANAGER_INTENT_SUPERSEDED,k.LIFE_MANAGER_GOAL_CONTRACT_FAILED,k.LIFE_MANAGER_FEEDBACK_PERSISTED,k.LIFE_MANAGER_FEEDBACK_EXHAUSTED,k.LIFE_MANAGER_PROJECT_REPORT_FAILED,k.LIFE_PLANNER_DEFERRED,k.LIFE_PLANNER_SUPERSEDED,k.LIFE_PLANNER_WAIT_OVERRIDDEN,k.LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED,k.LIFE_PLANNER_CONTINUATION_REQUIRED,k.LIFE_PLANNER_COMPLETION_REJECTED,k.LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED,k.PLAN_DRAFT_DONE,k.PLAN_DRAFT_FAILED,k.LIFE_PLAN_REVISION_ROLLED_BACK,k.ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED,k.ROUND_WATCHDOG_RETRY,k.ROUND_WATCHDOG_RETRY_EXHAUSTED,k.ROUND_MODEL_CONFIGURATION_ERROR,k.ROUND_PROVIDER_TURN_CAP_RESTART,k.ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART,k.ROUND_ORPHAN_PROCESS_GROUP,k.ROUND_EXTERNAL_WORK_WAIT_STARTED,k.ROUND_EXTERNAL_WORK_WAIT_COMPLETED,k.ROUND_EXTERNAL_WORK_REVIEW_REQUIRED,k.ROUND_EXTERNAL_WORK_REVIEW_COMPLETED,k.LIFE_DAEMON_DEGRADED,k.IDEA_PORTFOLIO_FORMED,k.TEAM_LEARNING_REVIEW_STARTED,k.TEAM_LEARNING_REVIEW_COMPLETED,k.TEAM_LEARNING_REVIEW_FAILED,k.TEAM_LEARNING_PROMOTION_QUARANTINED,k.DOMAIN_PROMOTION,k.MANAGER_LIVE_VIEW_UPDATED,k.MANAGER_TURN_STARTED,k.MANAGER_TURN_CANCELLED,k.USER_NOTE,k.UI_OPERATOR,k.UI_ARGUS,k.OPERATOR_ALERT,k.AGENT_IO_START,k.AGENT_IO_COMPLETE,k.AGENT_IO_ERROR,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.USAGE_RECORDED;function Mt(e){let t=String(e??``).trim();return Object.hasOwn(jt,t)?jt[t]:t}function Nt(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Nt).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Nt(t[e])}`).join(`,`)}}`}function Pt(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function Ft(e){let t=e.event_id??e.id??e.seq??e._offset,n=String(e.type??`event`);return t!=null&&t!==``?`${n}-${String(t)}`:`${n}-${String(e.ts??e.time??``)}-${Pt(Nt(e))}`}function It(e){return e.type===k.ENGINEER_PROGRESS&&e.kind===`reasoning`}function Lt(e){if(e.type!==k.ENGINEER_PROGRESS||![`assistant_message`,`agent_message`,`message`].includes(String(e.kind??``)))return!1;let t=String(e.agent_layer??e.actor??``);return String(e.text??``).trimStart().startsWith(`{`)?t===`reviewer`||t===`planner`:!1}var Rt=/^(?:[-*+]\s*)?[`*_]*(?:ARGUS_)?(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS|ROLE_DECISION)[`*_]*\s*[:=]|^(?:final\s+)?decision\s*:\s*$/i;function zt(e){return String(e??``).split(/\r?\n/).filter(e=>!Rt.test(e.trim())).join(` +`).trim()}function Bt(e){let t=String(e.fragment_mode??``);return t===`append`||t===`snapshot`?t:e.replace===!0?`snapshot`:`auto`}function Vt(e,t){let n=Math.min(e.length,t.length);for(let r=n;r>=8;--r)if(e.endsWith(t.slice(0,r)))return r;return 0}function Ht(e,t,n=`auto`){let r=(e||``).trim(),i=(t||``).trim();if(!r)return i;if(!i)return r;if(n===`snapshot`)return i;if(r.includes(i))return r;if(n===`append`)return`${r}\n${i}`;if(i.includes(r))return i;let a=Vt(r,i);return a?`${r}${i.slice(a)}`:`${r}\n${i}`}var Ut=[`all`,`attention`,`milestones`,`messages`],Wt=new Set([k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MISSION_FAILED,k.LOOP_START,k.LOOP_DONE,k.LIFE_PLANNER_VERDICT,k.LIFE_BUDGET_PAUSE,k.LIFE_LIFECYCLE_BLOCK]);function Gt(e,t,n=`all`,r=``){let i=Mt(e.canonical_type??e.type),a=String(e.kind??``);if(n===`attention`&&![`warn`,`err`].includes(String(t.tone??``))&&e.operator_alert!==!0||n===`milestones`&&!(t.rule&&!i.startsWith(`ui.`))&&!Wt.has(i)||n===`messages`&&t.tone!==`bright`&&![`assistant_message`,`agent_message`,`message`].includes(a)&&![`ui.operator`,`ui.argus`].includes(i))return!1;let o=r.trim().toLocaleLowerCase();return!o||[i,a,t.role,t.label,t.text,e.title,e.objective,e.text,e.summary,e.reason,e.error,e.status,e.action_summary,e.command,e.path,Array.isArray(e.tags)?e.tags.join(` `):e.tags].some(e=>String(e??``).toLocaleLowerCase().includes(o))}function Kt(e,t,n){e.setQueryData([`snapshot`,t],e=>e&&{...e,session:{...e.session,display_name:n}}),e.setQueryData([`projects`],e=>e&&{...e,projects:e.projects.map(e=>e.id===t?{...e,display_name:n,label:n||e.objective||e.id}:e)})}var qt=15e3,Jt=5e3,Yt=8e3,Xt=2e3,Zt=1e4;function A(e,t){return!Ke(t)&&!(t instanceof Ce)&&e<1}function Qt(e){return!Ke(e)&&Jt}function $t(e){return e?.projects.some(e=>e.daemon_alive)?Xt:qt}function en(e){return e?.daemon.alive||e?.manager_requests?.some(e=>e.status===`running`)?Xt:Yt}var tn=()=>s({queryKey:[`projects`],queryFn:E.projectIndex,refetchInterval:e=>$t(e.state.data)}),nn=()=>s({queryKey:[`project-costs`],queryFn:({signal:e})=>E.projectCosts(e),retry:A,refetchInterval:e=>Qt(e.state.error),refetchIntervalInBackground:!1}),rn=e=>s({queryKey:[`snapshot`,e],queryFn:({signal:t})=>E.activeSnapshot(e,t),enabled:!!e,refetchInterval:e=>en(e.state.data)}),an=(e,t=30,n=!0)=>s({queryKey:[`journal`,e,t],queryFn:({signal:n})=>E.journal(e,t,n),enabled:!!e&&n,refetchInterval:n?8e3:!1}),on=(e,t)=>s({queryKey:[`doctor`,e],queryFn:({signal:t})=>E.doctor(e,t),enabled:!!e&&t}),sn=(e,t)=>s({queryKey:[`config`,e],queryFn:({signal:t})=>E.config(e,t),enabled:!!e&&t}),cn=(e,t)=>s({queryKey:[`identity`,e],queryFn:({signal:t})=>E.identity(e,t),enabled:!!e&&t}),ln=(e,t,n=30)=>s({queryKey:[`transcript`,e,n],queryFn:({signal:t})=>E.transcript(e,n,t),enabled:!!e&&t}),un=(e,t=!0)=>s({queryKey:[`artifacts`,e],queryFn:({signal:t})=>E.artifacts(e,t),enabled:!!e&&t,refetchInterval:t?Zt:!1}),dn=(e,t,n=null)=>s({queryKey:[`artifact`,e,t,n],queryFn:({signal:n})=>E.artifact(e,t,n),enabled:!!e&&!!t,refetchInterval:e=>t&&/(?:^|[\\/])REVIEW\.md$/i.test(t)&&!Ke(e.state.error)?2e3:!1}),fn=(e,t)=>s({queryKey:[`backlog-item`,e,t],queryFn:({signal:n})=>E.backlogItem(e,t,n),enabled:!!e&&!!t});function pn(e,t){let n=c(),r=e=>{n.invalidateQueries({queryKey:[`snapshot`,e]}),n.invalidateQueries({queryKey:[`status`,e]}),n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`backlog-item`,e]})},i=()=>r(e);return{addTask:h({mutationFn:t=>E.addTask(e,t),onSuccess:i}),nudge:h({mutationFn:t=>E.nudge(e,t)}),note:h({mutationFn:t=>E.note(e,t)}),startDaemon:h({mutationFn:()=>E.startDaemon(e,t),onSuccess:i}),stopDaemon:h({mutationFn:n=>E.stopDaemon(e,n,t),onSuccess:i}),forceStopDaemon:h({mutationFn:()=>E.stopDaemon(e,!1,t,!0),onSuccess:i}),updateProject:h({mutationFn:e=>E.updateProject(e.sid,e.name),onSuccess:e=>{Kt(n,e.sid,e.name),r(e.sid)}}),deleteProject:h({mutationFn:()=>E.deleteProject(e),onSuccess:async()=>{let t=e;if(t){let e=e=>e.queryKey.some(e=>e===t);await n.cancelQueries({predicate:e}),n.removeQueries({predicate:e})}await n.invalidateQueries({queryKey:[`projects`]})}}),disposeBacklog:h({mutationFn:t=>E.disposeBacklog(e,t.id,t.op),onSuccess:i}),stopBacklog:h({mutationFn:t=>E.stopBacklog(e,t),onSuccess:i}),setContinuous:h({mutationFn:t=>E.setContinuous(e,t.enabled,t.objective??``),onSuccess:i})}}var mn=2e3;function hn(e,t){if(t.kind===`reset`)return{sid:t.sid,events:[],seen:new Set};if(t.sid!==e.sid)return e;if(t.kind===`seed`){let n=new Set,r=[];[...t.events,...e.events].forEach(e=>{let t=Ft(e);n.has(t)||(n.add(t),r.push(e))});let i=r.slice(-2e3);return{sid:e.sid,events:i,seen:new Set(i.map(e=>Ft(e)))}}let n=t.kind===`push`?[t.ev]:t.events,r=null,i=null;for(let t of n){let n=i??e.seen,a=Ft(t);n.has(a)||((!r||!i)&&(r=[...e.events],i=new Set(e.seen)),i.add(a),r.push(t))}return!r||!i?e:(r.length>mn&&r.splice(0,r.length-mn).forEach(e=>i.delete(Ft(e))),{sid:e.sid,events:r,seen:i})}var gn=new Set([`manager.live_view.updated`,`round.review.completed`,`life.mission.completed`]);function _n(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=String(n.type??``);if(gn.has(r)||r===`engineer.progress`&&n.kind===`file_change`)return Ft(n)}return``}var vn=new Set([`life.operator_question.pending`,`life.operator_question.answered`,`life.planner.task_added`,`life.planner.verdict`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`round.review.completed`]);function yn(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(vn.has(String(n.type??``)))return Ft(n)}return``}function bn(e,t=0){let[n,r]=(0,x.useState)(()=>typeof navigator>`u`||navigator.onLine!==!1);(0,x.useEffect)(()=>{let e=()=>r(navigator.onLine!==!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),e(),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]);let[i,a]=(0,x.useReducer)(hn,{sid:null,events:[],seen:new Set}),[o,s]=(0,x.useState)({sid:null,connected:!1}),c=(0,x.useRef)(e);return c.current=e,(0,x.useEffect)(()=>{if(a({kind:`reset`,sid:e}),s({sid:e,connected:!1}),!e)return;let t=!1,n=new AbortController,r=[],i,o=()=>{if(i=void 0,t||c.current!==e||r.length===0){r=[];return}let n=r;r=[],a({kind:`push-many`,sid:e,events:n})};E.events(e,120,n.signal).then(n=>{!t&&c.current===e&&a({kind:`seed`,sid:e,events:n})}).catch(()=>{});let l=ht(e,n=>{!t&&c.current===e&&(r.push(n),i===void 0&&(i=window.setTimeout(o,40)))},{replay:40,onOpen:()=>{!t&&c.current===e&&s({sid:e,connected:!0})},onClose:()=>{!t&&c.current===e&&s({sid:e,connected:!1})}});return()=>{t=!0,n.abort(),i!==void 0&&window.clearTimeout(i),r=[],l()}},[e,t]),{events:i.sid===e?i.events:[],connected:n&&o.sid===e&&o.connected}}function xn(e,t,n){let r=!1;e.addEventListener(`vite:preloadError`,e=>{let i=e.payload,a=i instanceof Error?i.message:String(i??``);if(!/\/(?:pdf[.-]|pdfjs)[^/\s]*\.(?:m?js)(?:[?#\s]|$)/i.test(a)&&/failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed|loading chunk .+ failed|unable to preload css/i.test(a)){if(r){e.preventDefault();return}try{let e=n.storage(),t=`argus.stale-chunk-reloaded`;if(e.getItem(t)===n.buildId)return;e.setItem(t,n.buildId)}catch{return}e.preventDefault(),r=!0,t()}})}var Sn=`modulepreload`,Cn=function(e,t){return new URL(e,t).href},wn={},Tn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Cn(t,n),t=s(t),t in wn)return;wn[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Sn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},En=window.location.pathname===`/admin/data`||window.location.pathname.startsWith(`/admin/data/`),Dn=(0,x.lazy)(()=>Tn(()=>import(`./App-DHmEWeHX.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)),On=(0,x.lazy)(()=>Tn(()=>import(`./WorkflowWorkbench-LjcBb5YN.js`),__vite__mapDeps([10,1,2,3,7,8]),import.meta.url)),kn=(0,x.lazy)(()=>Tn(()=>import(`./AdminDataApp-sFLn0VsP.js`),__vite__mapDeps([11,1,2,3,6,4,5,12,13,14,8,15]),import.meta.url));xn(window,()=>window.location.reload(),{buildId:_e,storage:()=>window.sessionStorage}),En||Re();var An=window.parent!==window;document.documentElement.dataset.argusEmbedded=String(An);var jn=new ue({defaultOptions:{queries:{staleTime:3e3,retry:A,refetchOnWindowFocus:!1}}});function Mn(){let e=s({queryKey:[`api-meta`],queryFn:E.meta}),{locale:t}=Ot();return e.error?(0,D.jsxs)(`div`,{role:`alert`,className:`p-8`,children:[e.error.message,(0,D.jsx)(`button`,{className:`ml-4 underline`,onClick:()=>void e.refetch(),children:t===`zh-CN`?`重新连接`:`Reconnect`})]}):e.data?e.data.capabilities.includes(`application.workflows.v1`)&&new URLSearchParams(window.location.search).get(`legacy`)!==`1`?(0,D.jsx)(On,{}):(0,D.jsx)(Dn,{}):(0,D.jsx)(`div`,{className:`p-8`,children:t===`zh-CN`?`正在连接…`:`Connecting…`})}function Nn(){let{locale:e}=Ot();return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(At,{}),(0,D.jsx)(kt,{locale:e,children:(0,D.jsx)(x.Suspense,{fallback:(0,D.jsx)(`div`,{className:`grid min-h-screen place-items-center text-sm text-ink-faint`,children:e===`zh-CN`?`正在加载工作台…`:`Loading workbench…`}),children:En?(0,D.jsx)(kn,{}):(0,D.jsx)(Mn,{})})})]})}(En?Promise.resolve():bt()).then(()=>de.createRoot(document.getElementById(`root`)).render((0,D.jsx)(x.StrictMode,{children:(0,D.jsx)(_,{client:jn,children:(0,D.jsx)(O,{children:(0,D.jsx)(Nn,{})})})}))).catch(e=>{let t=document.getElementById(`root`);t.setAttribute(`role`,`alert`),t.textContent=`Cannot open workbench: ${e instanceof Error?e.message:String(e)}`});export{Ge as A,tt as B,Ht as C,Tt as D,Mt as E,Ve as F,fe as G,Qe as H,st as I,he as K,Ke as L,Fe as M,E as N,Ot as O,Be as P,qe as R,Lt as S,k as T,S as U,Ye as V,ge as W,Ut as _,un as a,Bt as b,on as c,an as d,pn as f,ln as g,rn as h,dn as i,We as j,yt as k,bn as l,tn as m,_n as n,fn as o,nn as p,ae as q,yn as r,sn as s,Tn as t,cn as u,Ft as v,zt as w,It as x,Gt as y,nt as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/index-W1lBlVkr.js b/frontend/web/dist/assets/index-W1lBlVkr.js new file mode 100644 index 000000000..9b7ee508d --- /dev/null +++ b/frontend/web/dist/assets/index-W1lBlVkr.js @@ -0,0 +1,13 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./App-DaQfrTdA.js","./rolldown-runtime-hePW80VL.js","./icons-DRlFT_ri.js","./query-CUzIxVzm.js","./markdown-D-35pK1E.js","./markdown-DvoRHisr.css","./AppearanceControls-BFWF0z-J.js","./format-1SN2SmDZ.js","./useWorkbenchTheme-D7cPkLzc.js","./App-Cp4qzJN7.css","./WorkflowWorkbench-DLfSiGqy.js","./AdminDataApp-BonVgDiU.js","./history-BtuT-8i3.js","./code-xml-DwzUAooI.js","./AdminDataApp--AL95rdz.css"])))=>i.map(i=>d[i]); +import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{D as n,E as r}from"./icons-DRlFT_ri.js";import{C as i,S as a,_ as o,a as s,c,d as l,f as u,g as d,h as f,l as p,m,n as h,p as g,s as _,u as v,v as y,w as ee,x as te,y as b}from"./query-CUzIxVzm.js";import"./markdown-D-35pK1E.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ne=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,x(te);else{var t=n(l);t!==null&&de(ee,t.startTime-e)}}}function te(t,i){m=!1,h&&(h=!1,_(re),re=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!oe());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&de(ee,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var b=!1,ne=null,re=-1,ie=5,ae=-1;function oe(){return!(e.unstable_now()-aee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(re),re=-1):h=!0,de(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x(te))),r},e.unstable_shouldYield=oe,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),re=t(((e,t)=>{t.exports=ne()})),ie=t((e=>{var t=n(),r=re();function i(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),u=Object.prototype.hasOwnProperty,d=/^[: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]*$/,f={},p={};function m(e){return u.call(p,e)?!0:u.call(f,e)?!1:d.test(e)?p[e]=!0:(f[e]=!0,!1)}function h(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?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(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){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function ee(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(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(y,ee);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function te(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ve(e):``}function xe(e){switch(e.tag){case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 2:case 15:return e=be(e.type,!1),e;case 11:return e=be(e.type.render,!1),e;case 1:return e=be(e.type,!0),e;default:return``}}function Se(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 ae:return`Fragment`;case ie:return`Portal`;case se:return`Profiler`;case oe:return`StrictMode`;case x:return`Suspense`;case de:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case le:return(e.displayName||`Context`)+`.Consumer`;case ce:return(e._context.displayName||`Context`)+`.Provider`;case ue:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case fe:return t=e.displayName||null,t===null?Se(e.type)||`Memo`:t;case pe:t=e._payload,e=e._init;try{return Se(e(t))}catch{}}return null}function Ce(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`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return Se(t);case 8:return t===oe?`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 we(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ee(e){var t=Te(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function De(e){e._valueTracker||=Ee(e)}function Oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Te(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ke(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ae(e,t){var n=t.checked;return S({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function je(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=we(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Me(e,t){t=t.checked,t!=null&&te(e,`checked`,t,!1)}function Ne(e,t){Me(e,t);var n=we(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`)?Fe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Fe(e,t.type,we(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Pe(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 Fe(e,t,n){(t!==`number`||ke(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ie=Array.isArray;function Le(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=We.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qe={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},Je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(qe).forEach(function(e){Je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),qe[t]=qe[e]})});function Ye(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||qe.hasOwnProperty(e)&&qe[e]?(``+t).trim():t+`px`}function C(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ye(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Xe=S({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 w(e,t){if(t){if(Xe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(i(62))}}function Ze(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 Qe=null;function $e(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var et=null,T=null,tt=null;function nt(e){if(e=Zi(e)){if(typeof et!=`function`)throw Error(i(280));var t=e.stateNode;t&&(t=$i(t),et(e.stateNode,e.type,t))}}function rt(e){T?tt?tt.push(e):tt=[e]:T=e}function it(){if(T){var e=T,t=tt;if(tt=T=null,nt(e),t)for(e=0;e>>=0,e===0?32:31-(Lt(e)/Rt|0)|0}var Bt=64,Vt=4194304;function Ht(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 Ut(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Ht(a))):r=Ht(s)}else o=n&~i,o===0?a!==0&&(r=Ht(a)):r=Ht(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))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 Yt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-It(t),e[t]=n}function Xt(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=dr),mr=` `,hr=!1;function gr(e,t){switch(e){case`keyup`:return lr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function _r(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var vr=!1;function yr(e,t){switch(e){case`compositionend`:return _r(t);case`keypress`:return t.which===32?(hr=!0,mr):null;case`textInput`:return e=t.data,e===mr&&hr?null:e;default:return null}}function br(e,t){if(vr)return e===`compositionend`||!ur&&gr(e,t)?(e=Pn(),Nn=Mn=jn=null,vr=!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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Hr(n)}}function Wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gr(){for(var e=window,t=ke();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ke(e.document)}return t}function Kr(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 qr(e){var t=Gr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Wr(n.ownerDocument.documentElement,n)){if(r!==null&&Kr(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 i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ur(n,a);var o=Ur(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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,Yr=null,Xr=null,Zr=null,Qr=!1;function $r(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qr||Yr==null||Yr!==ke(r)||(r=Yr,`selectionStart`in r&&Kr(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}),Zr&&Vr(Zr,r)||(Zr=r,r=wi(Xr,`onSelect`),0ta||(e.current=ea[ta],ea[ta]=null,ta--)}function N(e,t){ta++,ea[ta]=e.current,e.current=t}var ra={},P=na(ra),ia=na(!1),aa=ra;function oa(e,t){var n=e.type.contextTypes;if(!n)return ra;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function sa(e){return e=e.childContextTypes,e!=null}function ca(){M(ia),M(P)}function la(e,t,n){if(P.current!==ra)throw Error(i(168));N(P,t),N(ia,n)}function ua(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!=`function`)return n;for(var a in r=r.getChildContext(),r)if(!(a in t))throw Error(i(108,Ce(e)||`Unknown`,a));return S({},n,r)}function da(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ra,aa=P.current,N(P,e),N(ia,ia.current),!0}function fa(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=ua(e,t,aa),r.__reactInternalMemoizedMergedChildContext=e,M(ia),M(P),N(P,e)):M(ia),N(ia,n)}var pa=null,ma=!1,ha=!1;function ga(e){pa===null?pa=[e]:pa.push(e)}function _a(e){ma=!0,ga(e)}function va(){if(!ha&&pa!==null){ha=!0;var e=0,t=A;try{var n=pa;for(A=1;e>=o,i-=o,Ea=1<<32-It(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),F&&Oa(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),F&&Oa(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return F&&Oa(a,g),u}for(h=r(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),F&&Oa(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===ae&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case ne:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===ae){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===pe&&qa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ga(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===ae?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=Ga(e,r,i),o.return=e,e=o)}return s(e);case ie:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case pe:return l=i._init,_(e,r,l(i._payload),o)}if(Ie(i))return h(e,r,i,o);if(ge(i))return g(e,r,i,o);Ka(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ya=Ja(!0),Xa=Ja(!1),Za=na(null),Qa=null,$a=null,eo=null;function to(){eo=$a=Qa=null}function no(e){var t=Za.current;M(Za),e._currentValue=t}function ro(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function io(e,t){Qa=e,eo=$a=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Us=!0),e.firstContext=null)}function ao(e){var t=e._currentValue;if(eo!==e){if(e={context:e,memoizedValue:t,next:null},$a===null){if(Qa===null)throw Error(i(308));$a=e,Qa.dependencies={lanes:0,firstContext:e}}else $a=$a.next=e}return t}var oo=null;function so(e){oo===null?oo=[e]:oo.push(e)}function co(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,so(t)):(n.next=i.next,i.next=n),t.interleaved=n,lo(e,r)}function lo(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 uo=!1;function fo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function po(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 mo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ho(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,lo(e,n)}return i=r.interleaved,i===null?(t.next=t,so(r)):(t.next=i.next,i.next=t),r.interleaved=t,lo(e,n)}function go(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}function _o(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,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 vo(e,t,n,r){var i=e.updateQueue;uo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=S({},d,f);break a;case 2:uo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Zc|=o,e.lanes=o,e.memoizedState=d}}function yo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=No.transition;No.transition={};try{e(!1),t()}finally{A=n,No.transition=r}}function gs(){return Uo().memoizedState}function _s(e,t,n){var r=hl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ys(e))bs(t,n);else if(n=co(e,t,n,r),n!==null){var i=Z();gl(n,e,r,i),xs(n,t,r)}}function vs(e,t,n){var r=hl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ys(e))bs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Br(s,o)){var c=t.interleaved;c===null?(i.next=i,so(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=co(e,t,i,r),n!==null&&(i=Z(),gl(n,e,r,i),xs(n,t,r))}}function ys(e){var t=e.alternate;return e===L||t!==null&&t===L}function bs(e,t){Io=Fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zt(e,n)}}var Ss={readContext:ao,useCallback:B,useContext:B,useEffect:B,useImperativeHandle:B,useInsertionEffect:B,useLayoutEffect:B,useMemo:B,useReducer:B,useRef:B,useState:B,useDebugValue:B,useDeferredValue:B,useTransition:B,useMutableSource:B,useSyncExternalStore:B,useId:B,unstable_isNewReconciler:!1},Cs={readContext:ao,useCallback:function(e,t){return Ho().memoizedState=[e,t===void 0?null:t],e},useContext:ao,useEffect:as,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),rs(4194308,4,ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){return rs(4,2,e,t)},useMemo:function(e,t){var n=Ho();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ho();return t=n===void 0?t:n(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=_s.bind(null,L,e),[r.memoizedState,e]},useRef:function(e){var t=Ho();return e={current:e},t.memoizedState=e},useState:es,useDebugValue:ds,useDeferredValue:function(e){return Ho().memoizedState=e},useTransition:function(){var e=es(!1),t=e[0];return e=hs.bind(null,e[1]),Ho().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=L,a=Ho();if(F){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),q===null)throw Error(i(349));Po&30||Yo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Zo.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,Xo.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ho(),t=q.identifierPrefix;if(F){var n=Da,r=Ea;n=(r&~(1<<32-It(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Lo++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof r.is==`string`?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),n===`select`&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Wi]=t,e[Gi]=r,fc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ze(n,r),n){case`dialog`:j(`cancel`,e),j(`close`,e),a=r;break;case`iframe`:case`object`:case`embed`:j(`load`,e),a=r;break;case`video`:case`audio`:for(a=0;arl&&(t.flags|=128,r=!0,hc(s,!1),t.lanes=4194304)}}else{if(!r){if(e=ko(c),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),hc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!F)return H(t),null}else 2*O()-s.renderingStartTime>rl&&n!==1073741824&&(t.flags|=128,r=!0,hc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(H(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=O(),t.sibling=null,n=I.current,N(I,r?n&1|2:n&1),t);case 22:case 23:return Tl(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Jc&1073741824&&(H(t),t.subtreeFlags&6&&(t.flags|=8192)):H(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function _c(e,t){switch(ja(t),t.tag){case 1:return sa(t.type)&&ca(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Eo(),M(ia),M(P),jo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Oo(t),null;case 13:if(M(I),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(I),null;case 4:return Eo(),null;case 10:return no(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var vc=!1,U=!1,yc=typeof WeakSet==`function`?WeakSet:Set,W=null;function bc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function xc(e,t,n){try{n()}catch(n){$(e,t,n)}}var Sc=!1;function Cc(e,t){if(Mi=wn,e=Gr(),Kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ni={focusedElem:e,selectionRange:n},wn=!1,W=t;W!==null;)if(t=W,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Es(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return h=Sc,Sc=!1,h}function wc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&xc(t,n,a)}i=i.next}while(i!==r)}}function Tc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,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 Ec(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 Dc(e){var t=e.alternate;t!==null&&(e.alternate=null,Dc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wi],delete t[Gi],delete t[qi],delete t[Ji],delete t[Yi])),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 Oc(e){return e.tag===5||e.tag===3||e.tag===4}function kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Oc(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 a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ac(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=ji));else if(r!==4&&(e=e.child,e!==null))for(Ac(e,t,n),e=e.sibling;e!==null;)Ac(e,t,n),e=e.sibling}function jc(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(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}var G=null,Mc=!1;function Nc(e,t,n){for(n=n.child;n!==null;)Pc(e,t,n),n=n.sibling}function Pc(e,t,n){if(Pt&&typeof Pt.onCommitFiberUnmount==`function`)try{Pt.onCommitFiberUnmount(Nt,n)}catch{}switch(n.tag){case 5:U||bc(n,t);case 6:var r=G,i=Mc;G=null,Nc(e,t,n),G=r,Mc=i,G!==null&&(Mc?(e=G,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):G.removeChild(n.stateNode));break;case 18:G!==null&&(Mc?(e=G,n=n.stateNode,e.nodeType===8?Bi(e.parentNode,n):e.nodeType===1&&Bi(e,n),Sn(e)):Bi(G,n.stateNode));break;case 4:r=G,i=Mc,G=n.stateNode.containerInfo,Mc=!0,Nc(e,t,n),G=r,Mc=i;break;case 0:case 11:case 14:case 15:if(!U&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&xc(n,t,o),i=i.next}while(i!==r)}Nc(e,t,n);break;case 1:if(!U&&(bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Nc(e,t,n);break;case 21:Nc(e,t,n);break;case 22:n.mode&1?(U=(r=U)||n.memoizedState!==null,Nc(e,t,n),U=r):Nc(e,t,n);break;default:Nc(e,t,n)}}function Fc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Ic(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=s),r&=~o}if(r=a,r=O()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wc(r/1960))-r,10e?16:e,ll===null)var r=!1;else{if(e=ll,ll=null,ul=0,K&6)throw Error(i(331));var a=K;for(K|=4,W=e.current;W!==null;){var o=W,s=o.child;if(W.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lO()-nl?El(e,0):$c|=n),Q(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Vt,Vt<<=1,!(Vt&130023424)&&(Vt=4194304)):t=1);var n=Z();e=lo(e,t),e!==null&&(Yt(e,t,n),Q(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||ia.current)Us=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Us=!1,dc(e,t,n);Us=!!(e.flags&131072)}}else Us=!1,F&&t.flags&1048576&&ka(t,Sa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;lc(e,t),e=t.pendingProps;var a=oa(t,P.current);io(t,n),a=Bo(null,t,r,e,a,n);var o=Vo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,sa(r)?(o=!0,da(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,fo(t),a.updater=Os,t.stateNode=a,a._reactInternals=t,Ms(t,r,e,n),t=Zs(null,t,r,!0,o,n)):(t.tag=0,F&&o&&Aa(t),V(null,t,a,n),t=t.child),t;case 16:r=t.elementType;a:{switch(lc(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Jl(r),e=Es(r,e),a){case 0:t=Ys(null,t,r,e,n);break a;case 1:t=Xs(null,t,r,e,n);break a;case 11:t=Ws(null,t,r,e,n);break a;case 14:t=Gs(null,t,r,Es(r.type,e),n);break a}throw Error(i(306,r,``))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Ys(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Xs(e,t,r,a,n);case 3:a:{if(Qs(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,a=o.element,po(e,t),vo(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ns(Error(i(423)),t),t=$s(e,t,r,n,a);break a}if(r!==a){a=Ns(Error(i(424)),t),t=$s(e,t,r,n,a);break a}for(Na=Vi(t.stateNode.containerInfo.firstChild),Ma=t,F=!0,Pa=null,n=Xa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ha(),r===a){t=uc(e,t,n);break a}V(e,t,r,n)}t=t.child}return t;case 5:return Do(t),e===null&&Ra(t),r=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Pi(r,a)?s=null:o!==null&&Pi(r,o)&&(t.flags|=32),Js(e,t),V(e,t,s,n),t.child;case 6:return e===null&&Ra(t),null;case 13:return nc(e,t,n);case 4:return To(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ya(t,null,r,n):V(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),Ws(e,t,r,a,n);case 7:return V(e,t,t.pendingProps,n),t.child;case 8:return V(e,t,t.pendingProps.children,n),t.child;case 12:return V(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,N(Za,r._currentValue),r._currentValue=s,o!==null){if(Br(o.value,s)){if(o.children===a.children&&!ia.current){t=uc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=mo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),ro(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(i(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),ro(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}V(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,io(t,n),a=ao(a),r=r(a),t.flags|=1,V(e,t,r,n),t.child;case 14:return r=t.type,a=Es(r,t.pendingProps),a=Es(r.type,a),Gs(e,t,r,a,n);case 15:return Ks(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Es(r,a),lc(e,t),t.tag=1,sa(r)?(e=!0,da(t)):e=!1,io(t,n),As(t,r,a),Ms(t,r,a,n),Zs(null,t,r,!0,e,n);case 19:return cc(e,t,n);case 22:return qs(e,t,n)}throw Error(i(156,t.tag))};function Wl(e,t){return wt(e,t)}function Gl(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 Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===fe)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(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 Xl(e,t,n,r,a,o){var s=2;if(r=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ae:return Zl(n.children,a,o,t);case oe:s=8,a|=8;break;case se:return e=Kl(12,n,t,a|2),e.elementType=se,e.lanes=o,e;case x:return e=Kl(13,n,t,a),e.elementType=x,e.lanes=o,e;case de:return e=Kl(19,n,t,a),e.elementType=de,e.lanes=o,e;case me:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ce:s=10;break a;case le:s=9;break a;case ue:s=11;break a;case fe:s=14;break a;case pe:s=16,r=null;break a}throw Error(i(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){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=Jt(0),this.expirationTimes=Jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},fo(a),e}function ru(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ie()})),oe=t((e=>{var t=ae();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),se=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new p({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ce(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ce(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){u.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>d(t,e))}findAll(e={}){return this.getAll().filter(t=>d(e,t))}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return u.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function ce(e){return e.options.scope?.id}var le=class extends ee{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new v({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){u.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){u.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){u.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){u.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new le,this.#t=e.mutationCache||new se,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=i.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=l.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(te(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return u.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;u.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return u.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=u.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return u.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=u.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(te(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return l.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(m(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{b(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(m(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{b(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=f(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===a&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},x=e(n(),1),de=e(oe(),1),fe=class extends Error{status;method;path;code;detail;constructor(e,t,n,r,i=``,a=``){super(e),this.name=`ApiError`,this.status=t,this.method=n,this.path=r,this.code=i,this.detail=a}};function pe(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return{detail:``,code:``};try{let t=JSON.parse(e),n=t.detail&&typeof t.detail==`object`&&!Array.isArray(t.detail)?t.detail:void 0,r=typeof t.code==`string`&&t.code.trim()?t.code.trim():typeof n?.code==`string`?n.code.trim():``;if(n)for(let e of[`message`,`detail`]){let t=n[e];if(typeof t==`string`&&t.trim())return{detail:t.trim(),code:r}}for(let e of[`detail`,`error`,`message`]){let n=t[e];if(typeof n==`string`&&n.trim())return{detail:n.trim(),code:r};if(Array.isArray(n)){let e=n.map(e=>e&&typeof e==`object`?String(e.msg??``):``).filter(Boolean);if(e.length)return{detail:e.join(`; `),code:r}}}return{detail:``,code:r}}catch{}return{detail:t.startsWith(``u`?``:window.location.search).get(`reader_preview`);return e===`source-first`||e===`learning-path`||e===`question-foundation`?e:null}function S(e,t,n,r,i=ge(),a){let o=[`map-copy`,e,t,n,r];return i===`question-foundation`?[...o,i,a??null]:i?[...o,i]:o}var _e=`0.1.8+ca776a3acf1efb3b`,ve=!1,ye=new Set,be=()=>ve,xe=e=>(ye.add(e),()=>{ye.delete(e)});function Se(e){ve||!e||e===`unknown`||e===`0.1.8+ca776a3acf1efb3b`||(ve=!0,ye.forEach(e=>e()))}var Ce=class extends Error{constructor(){super(`页面已更新,请刷新后继续。 / This page has been updated. Refresh to continue.`),this.name=`PageUpdateRequiredError`}};function we(){if(ve)throw new Ce}var Te={name:`argus.webapi`,major:1,minServerMinor:16},Ee=[`daemon.admission.v1`,`daemon.status.protocol.v1`,`daemon.command.v1`,`daemon.upgrade-schedule.v1`,`cost.admission.v1`,`event.catalog.v1`,`event.payload-schema.v1`,`manager.sse.v1`,`manager.request-cancel.v1`,`advisor.config.v1`,`metrics.slo.v2`,`mission.view.v1`,`mission.abort.v1`,`project.attachments.v1`,`project.git-diff.v1`,`project.cost-feed.v1`,`project.counterexamples.v1`,`project.workdir.v1`,`research.events.v1`,`release.identity.v1`,`snapshot.schema.v1`,`source.update.v1`,`usage.recorded.v2`,`verticals.store.v1`],De=`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`;function Oe(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function ke(e){return typeof e==`number`&&Number.isInteger(e)?e:null}function Ae(e,t){let n=Oe(e),r=Oe(n?.protocol),i=Oe(n?.runtime),a=Array.isArray(n?.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],o=ke(r?.major),s=ke(r?.minor);if(!n||!r||!i)return{compatible:!1,reason:`malformed /api/meta response`};if(typeof i.source_root!=`string`||ke(i.pid)===null||typeof i.package_version!=`string`||typeof i.release_id!=`string`)return{compatible:!1,reason:`malformed /api/meta runtime identity`};if(n.service!==`argus-skill-webapi`)return{compatible:!1,reason:`unexpected service ${String(n.service||`unknown`)}`};let c=e;if(r.name!==Te.name||o!==Te.major)return{compatible:!1,reason:`protocol ${String(r.name||`unknown`)}/${String(o)} is incompatible with client ${Te.name}/${Te.major}`,meta:c};if(s===null||s!a.includes(e));if(l.length>0)return{compatible:!1,reason:`missing capabilities: ${l.join(`, `)}`,meta:c};if(i.source_root_matches_config===!1)return{compatible:!1,reason:`backend is running from a different installation than configured`,meta:c};if(t&&i.release_id!==t.releaseId)return{compatible:!1,reason:`backend and client installations are out of sync; restart or reinstall Argus`,meta:c};if(t?.sourceDigest){if(typeof i.runtime_source_digest!=`string`||!i.runtime_source_digest)return{compatible:!1,reason:`backend cannot verify this local installation; restart it from the current checkout`,meta:c};if(i.runtime_source_digest!==t.sourceDigest)return{compatible:!1,reason:`backend is running code from a different local installation; restart it`,meta:c}}let u=i.release_matches_source===!1?De:void 0;return{compatible:!0,reason:``,...u?{warning:u}:{},meta:c}}function je(e,t,n){let r=Ae(e,t);if(!r.compatible||!r.meta)throw Error(`incompatible Argus API: ${r.reason}`);return r.warning&&n?.(r.warning),r.meta}function Me(e){let t=Oe(e),n=Oe(t?.daemon);if(!t||t.schema_version!==7)throw Error(`incompatible snapshot schema: expected 7, got ${String(t?.schema_version??`missing`)}`);if(!n)throw Error(`invalid snapshot: daemon section is missing`);let r=[`read_status`,`read_error`,`protocol_compatible`,`protocol_error`].filter(e=>!Object.hasOwn(n,e));if(r.length>0)throw Error(`invalid snapshot: daemon fields missing: ${r.join(`, `)}`);let i=[`spend_usd`,`spend_status`,`usage_summary`,`daemon_commands`,`observability`,`mission_view`,`partial`,`diagnostics`].filter(e=>!Object.hasOwn(t,e));if(i.length>0)throw Error(`invalid snapshot: fields missing: ${i.join(`, `)}`);if(!Array.isArray(t.diagnostics))throw Error(`invalid snapshot: diagnostics must be an array`);return e}function Ne(e,t){return je(e,{releaseId:_e},t)}function Pe(e,t){let n=`/api/application-workflows`,r=e=>`${n}/${encodeURIComponent(e)}`;return{catalog:()=>e(n),create:e=>t(n,e),open:e=>t(`${n}/open`,{project:e}),snapshot:t=>e(r(t)),action:(e,n)=>t(r(e),n),document:(t,n)=>e(`${r(t)}/document?path=${encodeURIComponent(n)}`)}}var Fe=`verticals.store.v1`,Ie=`argus_web_token`,Le=null;function Re(){let e;try{e=new URLSearchParams(window.location.search)}catch{return}let t=e.get(`token`);if(t){Le=t;try{localStorage.setItem(Ie,t)}catch{}try{e.delete(`token`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)}catch{}}}var ze=()=>{if(Le)return Le;try{return new URLSearchParams(window.location.search).get(`token`)||localStorage.getItem(Ie)}catch{return null}};function Be(){let e=ze();return e?{Authorization:`Bearer ${e}`}:{}}function Ve(){return ze()??``}var He=8e3,Ue=12e3,We=class extends Error{constructor(){super(`This browser is not paired with Argus. Open a valid pairing link or enter a pairing token.`),this.name=`PairingRequiredError`}},Ge=class extends Error{method;path;constructor(e,t,n=`could not reach the local Argus service`){super(`${e.toUpperCase()} ${t} ${n}. Make sure Argus Desktop is running, then retry.`),this.name=`LocalArgusUnavailableError`,this.method=e.toUpperCase(),this.path=t}};function Ke(e){return e instanceof We||!!(e&&typeof e==`object`&&Number(e.status)===401)}function qe(e){return Ke(e)||e instanceof Ge}async function Je(e,t){let n;try{n=await fetch(e,t)}catch(n){throw t.signal?.aborted?n:new Ge(String(t.method??`GET`),e)}return n.ok&&(Se(n.headers.get(`X-Argus-Release`)),(!t.method||t.method===`GET`)&&we()),n}async function Ye(e,t,n,r){let i=new AbortController,a=t.signal??void 0,o=!1,s=()=>{};if(a){let e=()=>i.abort(a.reason);a.aborted?e():(a.addEventListener(`abort`,e,{once:!0}),s=()=>a.removeEventListener(`abort`,e))}let c,l=(async()=>await r(await Je(e,{...t,signal:i.signal})))(),u=new Promise((e,t)=>{c=setTimeout(()=>{o=!0;let e=Error(`request timed out after ${n}ms`);i.abort(e),t(e)},n)});try{return await Promise.race([l,u])}catch(r){if(o){let r=Math.round(n/1e3);throw new Ge(String(t.method??`GET`),e,`timed out after ${r}s because the local Argus service did not respond`)}throw r}finally{c&&clearTimeout(c),s()}}async function C(e,t,n){return Ye(e,{headers:Be(),signal:t},n??Ue,async t=>(await he(t,`GET`,e),await t.json()))}async function Xe(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:t===void 0?void 0:JSON.stringify(t),signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),r}async function w(e,t,n){return await(await Xe(e,t,n)).json()}async function Ze(e,t,n){we();let r=await fetch(e,{method:`POST`,headers:Be(),body:t,signal:n});return await he(r,`POST`,e),Se(r.headers.get(`X-Argus-Release`)),await r.json()}function Qe(e){let t=e&&typeof e==`object`?e:{},n=String(t.command_status??``);if(Number(t.rc??0)!==0||n===`failed`||n===`rejected`)throw Error(String(t.error||`daemon command ${n||`failed`}`));return e}async function $e(e,t,n){we();let r=await fetch(t,{method:e,headers:{"Content-Type":`application/json`,...Be()},body:n===void 0?void 0:JSON.stringify(n)});return await he(r,e,t),Se(r.headers.get(`X-Argus-Release`)),await r.json()}async function et(e,t){let n=await fetch(e,{headers:Be(),signal:t});return await he(n,`GET`,e),n.blob()}var T=(e,t=``)=>`/api/projects/${encodeURIComponent(e)}${t}`;function tt(e,t){let n=new URLSearchParams({path:t}),r=Ve();return r&&n.set(`token`,r),T(e,`/artifact/preview/page?${n.toString()}`)}var nt=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,rt=nt,it;function at(e){return!!(e&&typeof e==`object`&&`aborted`in e&&typeof e.aborted==`boolean`)}function ot(e,t,n,r){let i={text:e};return t?.length&&(i.attachments=t),n&&n!==`auto`&&(i.route_override=n),r&&(i.request_id=r),i}function st(){if(!it){let e=(async()=>{let e=`/api/meta`,t=await Ye(e,{headers:Be()},He,async t=>{if(t.status===404)throw Error(`incompatible Argus API: service does not expose /api/meta`);await he(t,`GET`,e);let n=await t.json();return Se(n?.runtime?.release_id),Ne(n,e=>{e!==`the Argus source checkout has changed since its release bundle was built; before publishing, rebuild it with "python -m argus.release_tools.build_release" or reinstall Argus`&&console.warn(`Argus API compatibility warning: ${e}`)})});if(t.authentication?.required&&!t.authentication.authenticated)throw new We;return t})();it=e,e.catch(t=>{it===e&&!(t instanceof We)&&(it=void 0)})}return it}var ct=new Set([`waiting_for_source`,`planning`,`writing`,`reviewing`]);function lt(e){let t=[],n;for(;n=/\r?\n\r?\n/.exec(e);){let r=e.slice(0,n.index);e=e.slice(n.index+n[0].length);for(let e of r.split(` +`)){let n=e.trim();if(n.startsWith(`data:`))try{t.push(JSON.parse(n.slice(5).trim()))}catch{}}}return{frames:t,rest:e}}async function ut(e,t,n,r){if(!e.body)throw Error(`${t} returned no response body`);let i=e.body.getReader(),a=new TextDecoder,o=``,s,c=!1;try{for(;;){r?.throwIfAborted();let{done:e,value:l}=await i.read();c=e,r?.throwIfAborted(),o+=e?a.decode()+` + +`:a.decode(l,{stream:!0});let u=lt(o);o=u.rest;for(let e of u.frames)n?.(e),(e.type===`done`||e.type===`error`)&&(s=e);if(e){if(!s)throw Error(`${t} ended before a terminal event`);return s}}}finally{c||await i.cancel().catch(()=>{}),i.releaseLock()}}var dt=null;function ft(e,t,n,r,i=ge(),a){let o=new URLSearchParams(n);return r&&o.set(`session_id`,r),i===`source-first`&&o.set(`preview`,`true`),i===`learning-path`&&o.set(`preview`,`learning-path`),i===`question-foundation`&&(o.set(`preview`,`question-foundation`),a&&o.set(`foundation_id`,a)),`/api/map-copy/${e}/${encodeURIComponent(t)}?${o}`}async function pt(e,t,n,r){let i=await Xe(e,t,n),a=!1,o=await ut(i,`Explanation stream`,e=>{(e.type===`done`||e.type===`error`)&&(a=!0),!a&&e.type===`progress`&&ct.has(e.phase)&&r?.(e.phase)},n);if(o.type===`error`){let t=o.error&&typeof o.error==`object`?o.error:void 0;throw new fe(String(t?.message??o.error??`Explanation failed`),typeof o.status==`number`?o.status:0,`POST`,e,typeof t?.code==`string`?t.code:``)}return o.result}var E={workflows:Pe(C,w),advisorSettings:(e,t)=>C(T(e,`/advisor/config`),t),saveAdvisorSettings:(e,t)=>w(T(e,`/advisor/config`),t),liveMap:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r?.mode===`current`&&(i.set(`since`,String(r.since)),i.set(`event_since`,String(r.eventSince)),r.taskId&&i.set(`start_task`,r.taskId)),C(T(e,`/map`)+(i.size?`?${i}`:``),t)},mapInfo:(e,t)=>C(T(e,`/map-info`),t),mapHistory:(e,t,n,r)=>{let i=new URLSearchParams;return n&&i.set(`after`,n),r&&i.set(`task_after`,r),C(T(e,`/map-history`)+(i.size?`?${i}`:``),t)},mapCopy:(e,t,n,r,i,a,o)=>C(ft(e,t,{locale:n},i,a,o),r),mapCardWords:(e,t,n,r,i)=>w(`/api/map-cards/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapLines:(e,t,n,r,i)=>w(`/api/map-lines/${e}/${encodeURIComponent(t)}${i?`?session_id=${encodeURIComponent(i)}`:``}`,n,r),mapQuestionSource:(e,t,n)=>w(`/api/map-question-source/project/${encodeURIComponent(e)}?session_id=${encodeURIComponent(e)}`,{...t,preview:t.preview===`source-first`?!0:t.preview??!1},n),generateMapCopy:(e,t,n,r,i,a,o)=>pt(ft(e,t,{stream:`true`},i,a,n.foundation_id),n,r,o),generateReaderFoundation:(e,t,n)=>pt(T(e,`/reader-foundation?stream=true`),t,void 0,n),askReaderFoundation:(e,t,n,r)=>pt(T(e,`/reader-foundation/${encodeURIComponent(t)}/question?stream=true`),n,void 0,r),mapDatasets:e=>C(`/api/map-datasets`,e),mapDataset:(e,t)=>C(`/api/map-datasets/${encodeURIComponent(e)}`,t),meta:st,projectIndex:async()=>(await st(),C(`/api/projects`,void 0,Ue)),listProjects:async()=>(await st(),C(`/api/projects`,void 0,Ue).then(e=>e.projects)),projectCosts:async e=>(await st(),C(`/api/projects/costs`,e)),createDaemon:async(e,t=``,n=``,r)=>{let i=`/api/daemons`,a={objective:e,name:t,workdir:n,command_id:rt(),expected_revision:r},o=()=>fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify(a),cache:`no-store`}),s=await o();return s.status===400&&/Invalid HTTP request received/i.test(await s.clone().text())&&(s=await o()),await he(s,`POST`,i),Qe(await s.json())},updateProject:(e,t)=>$e(`PATCH`,T(e),{name:t}),deleteProject:e=>$e(`DELETE`,T(e)),snapshot:async(e,t,n=!1)=>(await st(),Me(await C(T(e,`/snapshot?compact=true&events_limit=1${n?`&prewarm=true`:``}`),t,Ue))),activeSnapshot:async(e,t)=>{let n=dt!==e;n&&(dt=e);try{return await E.snapshot(e,t,n)}catch(t){throw n&&dt===e&&(dt=null),t}},prefetchSnapshot:(e,t)=>E.snapshot(e,t,!1),status:(e,t)=>C(T(e,`/status`),t),journal:(e,t=20,n)=>C(T(e,`/journal?n=${t}`),n).then(e=>e.journal),doctor:(e,t)=>C(T(e,`/doctor`),t),config:(e,t)=>C(T(e,`/config`),t),identity:(e,t)=>C(T(e,`/identity`),t).then(e=>e.identity),transcript:(e,t=30,n)=>C(T(e,`/transcript?n=${t}`),n).then(e=>e.turns),events:(e,t=80,n)=>C(T(e,`/events?limit=${t}&view=ui`),n).then(e=>e.events),workRecord:(e,t,n,r)=>C(T(e,`/work-record?role=${encodeURIComponent(t)}&record_id=${encodeURIComponent(n)}`),r),downloadWorkLog:async(e,t,n=``)=>{let r=T(e,`/work-log/download?role=${encodeURIComponent(t)}&task_id=${encodeURIComponent(n)}`),i=await fetch(r,{headers:Be(),cache:`no-store`});await he(i,`GET`,r);let a=URL.createObjectURL(await i.blob()),o=document.createElement(`a`);o.href=a,o.download=`work-records.md`,o.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)},backlogItem:(e,t,n)=>C(T(e,`/backlog/${encodeURIComponent(t)}`),n).then(e=>e.item),artifacts:(e,t,n=!1)=>C(T(e,`/artifacts${n?`?include_reading=true`:``}`),t).then(e=>e.artifacts),artifact:(e,t,n)=>C(T(e,`/artifact?${new URLSearchParams({path:t})}`),n),artifactPreview:(e,t,n)=>C(T(e,`/artifact/preview?${new URLSearchParams({path:t})}`),n),artifactBundle:(e,t,n)=>et(T(e,`/artifact/bundle?${new URLSearchParams({path:t})}`),n),artifactBlob:(e,t,n=!1,r)=>{let i=new URLSearchParams({path:t});return n&&i.set(`download`,`true`),et(T(e,`/artifact/raw?${i}`),r)},gitDiff:(e,t)=>C(T(e,`/git-diff`),t),deliveryDiff:(e,t,n)=>C(T(e,`/delivery-diff?${new URLSearchParams(t)}`),n),metrics:e=>C(`/api/metrics`,e),sourceUpdateStatus:e=>C(`/api/runtime/source-update`,e),checkSourceUpdate:()=>w(`/api/runtime/source-update/check`),applySourceUpdate:()=>w(`/api/runtime/source-update/apply`),resources:e=>C(`/api/system/resources`,e),trash:(e=``,t=100,n=0,r)=>C(`/api/trash?${new URLSearchParams({query:e,limit:String(t),offset:String(n)})}`,r),restoreTrash:e=>w(`/api/trash/${encodeURIComponent(e)}/restore`),verticals:e=>C(`/api/verticals`,e),refreshVerticalCatalog:()=>w(`/api/verticals/catalog/refresh`),manageVertical:(e,t,n={})=>w(`/api/verticals/${encodeURIComponent(e)}/manage/${t}`,n.force?{force:!0}:{}),verticalOperation:(e,t)=>C(`/api/verticals/${encodeURIComponent(e)}/operation`,t),addTask:(e,t)=>w(T(e,`/tasks`),{text:t}).then(e=>e.item),abortMission:(e,t)=>w(T(e,`/mission/abort`),{reason:t}),mapNotes:(e,t)=>C(T(e,`/map-notes`),t),addMapNote:(e,t)=>w(T(e,`/map-notes`),t),answerPending:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/answer`),{text:n}),resolveDecision:(e,t,n,r)=>w(T(e,`/decisions/${encodeURIComponent(t)}/resolve`),{option_id:n,note:r}),uploadAttachments:async(e,t,n)=>{await st();let r=new FormData;return t.forEach(e=>r.append(`files`,e,e.name)),Ze(T(e,`/attachments`),r,n)},answerDomain:(e,t,n,r)=>w(T(e,`/message`),{text:r||n,domain_answer:{id:t,option_id:n,note:r}}),message:(e,t,n)=>{let r=at(n)?n:n?.signal,i=at(n)?void 0:n?.attachments,a=at(n)?void 0:n?.routeOverride,o=at(n)?void 0:n?.requestId;return w(T(e,`/message`),ot(t,i,a,o),r)},cancelMessage:(e,t)=>Ye(T(e,`/message/cancel`),{method:`POST`,headers:{"Content-Type":`application/json`,...Be()},body:JSON.stringify({request_id:t})},5e3,async t=>(await he(t,`POST`,T(e,`/message/cancel`)),await t.json())),messageStream:async(e,t,n,r)=>{let i=at(r)?r:r?.signal,a=at(r)?void 0:r?.attachments,o=at(r)?void 0:r?.routeOverride,s=at(r)?void 0:r?.requestId;await ut(await Xe(T(e,`/message/stream`),ot(t,a,o,s),i),`Manager stream`,e=>{if(!i?.aborted){if(e.type===`phase`){let t=Number(e.quiet_s??0);n.onPhase?.(String(e.label??``),String(e.role??`manager`),{heartbeat:e.heartbeat===!0,quietS:Number.isFinite(t)?t:0,kind:String(e.kind??``),detail:String(e.detail??``),tool:String(e.tool??``),toolKind:String(e.tool_kind??``),callId:String(e.call_id??``),status:String(e.status??``),output:String(e.output??``)})}else e.type===`delta`?n.onDelta?.(String(e.text??``),String(e.message_id??``),String(e.fragment_mode??`auto`)):e.type===`done`?n.onDone?.(e.result??{}):e.type===`error`&&n.onError?.(Error(String(e.error??`stream error`)))}},i)},nudge:(e,t)=>w(T(e,`/nudge`),{text:t}),queueFollowup:(e,t,n=`auto`)=>w(T(e,`/message/followup`),{text:t,route_override:n}),note:(e,t)=>w(T(e,`/note`),{text:t}),previewPlan:(e,t)=>w(T(e,`/plan`),{text:t}),rewritePrompt:(e,t)=>w(T(e,`/prompt/rewrite`),{text:t}),setConfig:(e,t,n,r=!1)=>w(T(e,`/config/set`),r?{name:t,value:n,apply_to_roles:!0}:{name:t,value:n}),setIdentity:(e,t)=>w(T(e,`/identity`),{text:t}),resetManager:e=>w(T(e,`/reset`)),skills:(e,t=`ls`)=>w(T(e,`/skills`),{args:t}).then(e=>e.text),skillLibrary:(e,t)=>C(`/api/skill-library${e?`?sid=${encodeURIComponent(e)}`:``}`,t),skillDocument:(e,t,n,r)=>C(`/api/skill-library/document?${new URLSearchParams({library:t,path:n,...e?{sid:e}:{}})}`,r),researchMethod:(e,t)=>C(T(e,`/research/method`),t),wiki:(e,t)=>C(T(e,`/wiki`),t),wikiPage:(e,t,n)=>C(T(e,`/wiki/page?${new URLSearchParams({path:t})}`),n),wikiLibrary:(e,t)=>C(`/api/wiki${e?`?sid=${encodeURIComponent(e)}`:``}`,t),wikiDocument:(e,t,n,r,i)=>C(`/api/wiki/page?${new URLSearchParams({scope:t,vertical:n,path:r,...e?{sid:e}:{}})}`,i),knowledgeFeed:(e=50,t)=>C(`/api/knowledge/feed?${new URLSearchParams({limit:String(e)})}`,t),learningStatus:(e,t)=>C(T(e,`/learning`),t),retryLearning:(e,t)=>w(T(e,`/learning/${encodeURIComponent(t)}/retry`),{}),setLaunchCwd:(e,t)=>w(T(e,`/launch-cwd`),{launch_cwd:t}),setWorkdir:(e,t)=>w(T(e,`/workdir`),{workdir:t}),disposeBacklog:(e,t,n)=>w(T(e,`/backlog/${encodeURIComponent(t)}/dispose`),{op:n}),stopBacklog:(e,t)=>w(T(e,`/backlog/${encodeURIComponent(t)}/stop`)),setContinuous:(e,t,n=``)=>w(T(e,`/continuous`),{enabled:t,objective:n}).then(e=>{if(!t)return e;if(!e.daemon)throw Error(`daemon start returned no result`);return Qe(e.daemon),e}),startDaemon:(e,t)=>w(T(e,`/daemon/start`),{command_id:rt(),expected_revision:t}).then(Qe),stopDaemon:(e,t=!1,n,r=!1)=>w(T(e,`/daemon/stop`),{drain:t,force:r,command_id:rt(),expected_revision:n}).then(Qe),replaceDaemon:(e,t,n=!1,r)=>w(T(e,`/daemon/replace`),{victim_sid:t,resume_continuous:n,command_id:rt(),expected_revision:r}).then(Qe),upgradeDaemon:(e,t)=>w(T(e,`/daemon/upgrade`),{command_id:rt(),expected_revision:t}).then(Qe)},mt=new Set([4401,4404]);function ht(e,t,n={}){let r=window.location.protocol===`https:`?`wss:`:`ws:`,i=new URLSearchParams;n.replay!=null&&i.set(`replay`,String(n.replay)),i.set(`view`,`ui`);let a=ze();a&&i.set(`token`,a);let o=`${r}//${window.location.host}${T(e,`/stream`)}?${i}`,s=null,c=!1,l,u=()=>{c||(s=new WebSocket(o),s.onopen=()=>n.onOpen?.(),s.onmessage=e=>{try{let n=JSON.parse(e.data);n&&typeof n==`object`&&t(n)}catch{}},s.onclose=e=>{let t=!mt.has(e.code);n.onClose?.({code:e.code,reason:e.reason,retryable:t}),!c&&t&&(l=setTimeout(u,1e3))},s.onerror=()=>s?.close())};return u(),()=>{c=!0,l&&clearTimeout(l),s?.close()}}var gt={schema:1,id:`argus`,name:`Argus`,tagline:`Autonomous Work Lab`,terminal_wordmark:`argus`,assets:{}};function _t(e){if(!e||typeof e!=`object`)throw Error(`Invalid application brand`);let t=e;if(t.schema!==1||typeof t.id!=`string`||!/^[a-z][a-z0-9-]{0,39}$/.test(t.id))throw Error(`Invalid application brand identity`);for(let[e,n]of[[`name`,48],[`tagline`,100],[`terminal_wordmark`,24]]){let r=t[e];if(typeof r!=`string`||!r.trim()||r.length>n||/[\x00-\x1f\x7f-\x9f]/.test(r))throw Error(`Invalid application brand ${e}`)}if(!/^[a-z0-9 -]+$/.test(String(t.terminal_wordmark)))throw Error(`Invalid terminal wordmark`);if(!t.assets||typeof t.assets!=`object`||Array.isArray(t.assets))throw Error(`Invalid application brand assets`);let n={};for(let e of[`mark`,`mark_dark`,`logo`,`logo_dark`,`icon`,`icon_dark`]){let r=t.assets[e];if(r!==void 0&&r!==`/api/application-brand/assets/${e}`)throw Error(`Invalid application brand asset ${e}`);if(typeof r==`string`)n[e]=r;else if(t.id!==`argus`)throw Error(`Missing application brand asset ${e}`)}return{schema:1,id:t.id,name:String(t.name),tagline:String(t.tagline),terminal_wordmark:String(t.terminal_wordmark),assets:n}}var vt=gt,yt=()=>vt;async function bt(){let e=await fetch(`/api/application-brand`,{cache:`no-store`});if(!e.ok)throw Error(`Application identity unavailable (${e.status})`);if(vt=_t(await e.json()),vt.id!==`argus`){document.title=`${vt.name} · Workbench`,document.querySelector(`meta[name="apple-mobile-web-app-title"]`)?.setAttribute(`content`,vt.name),document.querySelector(`link[rel="manifest"]`)?.setAttribute(`href`,`/api/application-brand/manifest.webmanifest`);for(let e of document.querySelectorAll(`link[rel="icon"], link[rel="apple-touch-icon"]`))e.href=e.media.includes(`dark`)?vt.assets.icon_dark:vt.assets.icon,e.removeAttribute(`type`)}}var D=r(),xt=`argus.locale`,St={"language.english":`English`,"handshake.connecting":`Getting Argus ready`,"handshake.service":`Service`,"handshake.project":`Project`,"handshake.ready":`Ready`,"handshake.title":`Getting Argus ready`,"handshake.detail":`Reopening your workspace…`,"splash.starting":`Argus starting`,"rail.workbench":`Workbench`,"rail.sessionsShortcut":`Sessions · Ctrl/⌘ P`,"panel.backlog":`Backlog`,"panel.activity":`Activity`,"panel.journal":`Journal`,"panel.roles":`Roles`,"panel.project":`Project`,"panel.liveView":`Manager live project view`,"stream.jumpToLatest":`Jump to latest`,"stream.toggleReasoning":`Show or hide agent reasoning (⌘T)`,"stream.reasoning":`Reasoning`,"stream.noLogs":`No activity yet`,"stream.system":`Argus updates`,"stream.autonomous":`Background activity`,"stream.backgroundWork":`Argus is working in the background`,"stream.ready":`Argus is ready. Ask a question or assign work.`,"stream.historyLoading":`Loading conversation history…`,"stream.historyError":`Could not load conversation history.`,"stream.historyRetry":`Retry`,"stream.fold.read":`Read {count} files`,"stream.fold.search":`Searched {count} times`,"stream.fold.fetch":`Looked up {count} web pages`,"stream.fold.edit":`Edited {count} files`,"stream.fold.tool":`Used {tool} {count} times`,"stream.fold.failed":`{count} failed`,"stream.fold.expand":`Show each step`,"stream.fold.collapse":`Hide the steps`,"stream.repeated":`Repeated {count} times; showing the latest`,"stream.stepFailed":`failed`,"stream.stepResult":`Result`,"common.showRaw":`Show raw output`,"doctor.lastEntry":`Last entry`,"operations.metric.calls":`model calls today`,"operations.metric.failed":`failed`,"operations.metric.slowest":`slowest typical call`,"operations.slo.healthy":`Healthy`,"operations.slo.degraded":`Needs attention`,"operations.slo.loading":`Loading…`,"operations.validationFailures":`{count} malformed events today`,"operations.outputLines":`{count} lines of output`,"operations.done":`Done.`,"newDaemon.workdirPlaceholder":`Blank → ~/.argus-skill/workspaces/`,"operations.resetManager":`Reset Manager context`,"language.chinese":`中文`,"language.switchTo":`Switch to {language}`,"common.loading":`Loading…`,"common.retry":`Retry`,"common.save":`Save`,"common.cancel":`Cancel`,"common.close":`Close`,"common.settings":`Settings`,"common.ready":`Ready`,"common.live":`Live`,"common.reconnecting":`Reconnecting`,"common.stale":`Snapshot stale`,"common.degraded":`Snapshot degraded`,"common.external":`External`,"common.pause":`Pause`,"common.run":`Run`,"common.working":`Working`,"common.local":`Local`,"common.all":`All`,"common.unassigned":`Unassigned`,"common.closeSessions":`Close sessions`,"common.resizeSessions":`Resize sessions`,"common.resizePreview":`Resize preview`,"common.expandPreview":`Expand preview`,"time.justNow":`just now`,"time.minutesAgo":`{count}m ago`,"time.hoursAgo":`{count}h ago`,"time.yesterdayAt":`Yesterday at {time}`,"connection.pairingTitle":`This browser is not paired with Argus`,"connection.pairingDetail":`Open a valid pairing link for this Argus site, or paste the link or token below.`,"connection.pairAgain":`Pair again`,"connection.pairingInput":`Pairing link or token`,"connection.pairingPlaceholder":`Paste a fresh pairing link or token`,"connection.pairingInvalid":`Enter a valid pairing link or token.`,"connection.connect":`Connect`,"connection.unreachableTitle":`The local Argus service is unavailable`,"connection.unreachableDetail":`Keep Argus Desktop running, wait for the local service to become ready, then retry.`,"sidebar.collapse":`Collapse sessions`,"sidebar.expand":`Expand sessions`,"sidebar.create":`Create project`,"sidebar.find":`Find a project`,"sidebar.clearSearch":`Clear search`,"sidebar.refreshFailed":`Refresh failed · retry`,"sidebar.noSessions":`No sessions`,"sidebar.noMatches":`No sessions matching "{query}"`,"sidebar.unnamedSession":`Unnamed session`,"sidebar.daemonAlive":`Argus background is online`,"sidebar.updateRequired":`Update required`,"sidebar.updateAvailable":`Update available`,"sidebar.updateAvailableHint":`The executor is still running with a different release from this page.`,"sidebar.stopped":`Background stopped`,"sidebar.runningFor":`Background online · {uptime}`,"sidebar.lastActive":`Last active {time}`,"sidebar.manage":`Manage {name}`,"sidebar.manageHint":`Rename, pause, or delete`,"sidebar.resume":`Resume`,"sidebar.resumeHint":`Resume work in {workdir}`,"sidebar.resumeSuccess":`Session resumed.`,"sidebar.resumeFailed":`Could not resume session: {error}`,"sidebar.modelLoading":`Loading backend and model…`,"sidebar.modelUnavailable":`Backend and model unavailable`,"sidebar.defaultModel":`default model`,"sidebar.openSettings":`Open settings`,"sidebar.compute":`Compute queue & allowance`,"sidebar.theme":`{current} theme; switch to {next}`,"landing.selectOrCreate":`Select a session from the sidebar, or create a new one.`,"landing.noSessions":`No sessions yet. Create one to begin.`,"landing.select":`Select project`,"landing.new":`New project`,"landing.menu":`Open menu`,"project.missingSwitched":`Project “{requested}” was not found. Switched to {fallback}.`,"project.missingCreate":`Project “{requested}” was not found. Create a project to continue.`,"topbar.openSessions":`Open projects`,"topbar.externallyManaged":`Externally managed`,"topbar.pauseDaemon":`Pause Argus`,"topbar.runDaemon":`Run Argus`,"topbar.working":`Argus is working on your request`,"topbar.roleActive":`{role} is active`,"topbar.roleIdle":`{role} is idle`,"topbar.externalDaemonHint":`Argus is managed outside this app and must be controlled there.`,"topbar.manageSession":`Manage session`,"topbar.showPreview":`Show preview`,"topbar.showActivity":`Show activity`,"mobile.views":`Views`,"mobile.sessions":`Projects`,"mobile.mission":`Mission`,"mobile.activity":`Conversation`,"mobile.workbench":`Workbench`,"mobile.map":`Map`,"mobile.preview":`Files`,"chat.working":`Argus is working on your message`,"chat.workingQuiet":`Argus is working on your message · Still working; no new update for {quiet}s`,"chat.stopWaitingHint":`Esc stop reply · Enter sends a follow-up`,"chat.queuedWhileRunning":`Queued · answered right after this reply; a running task can be steered by it`,"chat.attachWhileRunning":`Attachments can be sent once this reply finishes`,"chat.stepsLive":`Working · {count} steps so far`,"chat.stepsDone":`{count} steps · {seconds}`,"chat.stepFailed":`failed`,"chat.stepRaw":`raw`,"chat.messageArgus":`message Argus`,"chat.selectSession":`Select a session…`,"chat.placeholder":`Ask a question or assign work`,"chat.routeLabel":`message category`,"chat.routeHint":`For this message only. Argus chooses one worker or a team based on the request; greetings stay in conversation.`,"chat.routeTask":`Task`,"chat.routeAuto":`Auto`,"chat.routeChat":`Chat`,"chat.attach":`attach files`,"chat.attachHint":`PNG, JPEG, WebP, PDF, Markdown/text, JSON, CSV · up to {count} files, {perFile} each, {total} total`,"chat.attachDrop":`Drop files to attach`,"chat.attachRemove":`remove attachment {name}`,"chat.attachUnsupported":`{name} is not supported. Use PNG, JPEG, WebP, PDF, Markdown/text, JSON, or CSV.`,"chat.attachTooLarge":`{name} exceeds the {size} per-file limit.`,"chat.attachTooMany":`You can attach up to {count} files per message.`,"chat.attachTotalTooLarge":`Attachments exceed the {size} total limit.`,"chat.attachmentUploadFailed":`Attachment upload failed: {error}`,"chat.uploadingAttachments":`Uploading attachments`,"chat.rewriteHint":`Let the Manager rewrite this prompt into a brief the team can act on. Nothing is sent — the rewrite lands back in this box for you to edit.`,"chat.rewriteLabel":`rewrite prompt with the Manager`,"chat.rewriting":`rewriting`,"chat.rewrite":`Rewrite text`,"chat.stopWaiting":`stop reply`,"chat.stopWaitingTitle":`Stop this Manager request`,"chat.stoppingReply":`Stopping this reply…`,"chat.stopReplyRequested":`Stop requested. You can send another message.`,"chat.replyAlreadyFinished":`This reply has already finished.`,"chat.stopReplyFailed":`Could not stop the server request: {error}`,"chat.send":`send message`,"copy.message":`Copy`,"copy.code":`Copy code`,"copy.copied":`Copied`,"help.title":`Keyboard shortcuts`,"help.commands":`Commands`,"help.palette":`command palette`,"help.sessions":`toggle sessions`,"help.managerChat":`focus Manager chat`,"help.rewrite":`rewrite the current prompt before sending`,"help.reasoning":`toggle agent reasoning`,"help.kiosk":`toggle kiosk (read-only) mode`,"help.composer":`focus the composer`,"help.send":`send message`,"help.newline":`insert newline`,"help.thisHelp":`this help`,"help.escape":`close overlay / stop waiting in composer`,"palette.placeholder":`Type a command or search…`,"palette.noMatches":`no matching commands`,"palette.navigate":`↑↓ navigate`,"palette.run":`↵ run`,"palette.close":`esc close`,"palette.view":`View`,"palette.action":`Action`,"palette.project":`Project`,"palette.newDaemon":`New session`,"palette.openTranscript":`Open Transcript`,"palette.openProject":`Open Project`,"palette.projectHint":`work · memory · agents`,"palette.openOperations":`Open Operations`,"palette.operationsHint":`session controls`,"palette.hideReasoning":`Hide reasoning`,"palette.showReasoning":`Show reasoning`,"palette.exitKiosk":`Exit kiosk mode`,"palette.enterKiosk":`Enter kiosk mode`,"palette.messageArgus":`Message Argus…`,"palette.stopWaiting":`Stop Manager reply`,"palette.stopContinuous":`Stop continuous campaign`,"palette.startContinuous":`Start continuous campaign`,"palette.stopDaemon":`Pause Argus`,"palette.startDaemon":`Run Argus`,"slash.suggestions":`Slash command suggestions`,"mission.roleActive":`{role} active`,"mission.overview":`mission overview`,"mission.operations":`Operations`,"role.manager":`Manager`,"role.manager.description":`Understands your goal and coordinates work`,"role.planner":`Planner`,"role.planner.description":`Breaks down the problem, schedules work, and revises the plan`,"role.engineer":`Engineer`,"role.engineer.description":`Researches, writes proofs or code, and uses tools to check the work`,"role.reviewer":`Reviewer`,"role.reviewer.description":`Checks results and evidence and identifies gaps`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`You`,"doctor.title":`Doctor`,"doctor.subtitle":`Argus status checks + recommended root-cause fix`,"doctor.recommended":`recommended fix`,"doctor.loadError":`Couldn’t load diagnostics.`,"doctor.empty":`No diagnostic data available`,"doctor.daemonLog":`Daemon log`,"settings.subtitle":`effective roles, budgets, and essential controls`,"settings.loadError":`Couldn’t load configuration.`,"settings.empty":`No configuration found`,"settings.quickConfig":`Quick Config`,"settings.appearance":`Appearance`,"settings.appearanceHint":`Choose the interface colour treatment. Logos and icons always remain monochrome.`,"settings.themeStyle":`Theme colour`,"settings.themeStyle.standard":`Standard`,"settings.themeStyle.standardHint":`Quiet black, white, grey, and blue.`,"settings.themeStyle.gradient":`Gradient`,"settings.themeStyle.gradientHint":`The classic Argus blue-to-gold background.`,"settings.backend":`Backend`,"settings.backendSource.env":`set by the server environment`,"settings.backendSource.persisted":`saved setting`,"settings.backendSource.default":`built-in default`,"settings.backendWillSave":`Apply saves {backend}.`,"settings.backendWillReplace":`Apply replaces the saved {saved} with {backend}.`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`Backend saved as {backend}. Restart Argus to apply.`,"settings.backendUnsupported":`Unsupported backend ({backend})`,"settings.backendUnavailable":`Backend unavailable`,"settings.model":`Model`,"settings.trialAccount":`Trial account`,"settings.trialKeyHint":`Replace your Key here when its allowance runs out. Your projects and conversations stay in place.`,"settings.changeTrialKey":`Change Key`,"settings.applyModel":`Apply`,"settings.modelPlaceholder":`auto (backend default)`,"settings.connection":`Connection`,"settings.webApi":`Web + REST API`,"settings.eventStream":`Live updates`,"settings.taskDaemon":`Background work`,"settings.taskDaemonValue":`Local process · events.jsonl · no TCP port`,"chat.messageTooLong":`Message exceeds 32,000 characters. Shorten it or upload a file. Your draft is preserved.`,"settings.required":`{field} is required`,"settings.advanced":`Advanced`,"settings.advancedHint":`Budgets, the advisor model, explanation effort, connection details and raw configuration`,"settings.mapModel":`Map`,"settings.mapModelFollows":`Follows the front-door model`,"settings.mapModelSet":`Map explanations now use {model}.`,"settings.overrideTitle":`Environment override`,"settings.overrideHint":`Set a specific config alias or environment-variable key.`,"settings.namePlaceholder":`name or alias, e.g. manager_model`,"settings.valuePlaceholder":`value`,"settings.applyAdvanced":`Apply environment override`,"settings.applied":`Applied. Restart affected sessions to use the new settings.`,"settings.modelAppliedToRoles":`Every role now uses {model}. Sessions already running keep their model until they restart.`,"settings.rolesRunning":`Roles now run:`,"settings.applyUnifies":`Apply sets all of them to the model above.`,"settings.rolesTitle":`Effective roles`,"settings.rawConfig":`Raw configuration`,"settings.group.limits":`Limits`,"settings.group.safety":`Safety`,"settings.group.interface":`Interface`,"settings.knob.activeDaemons":`Active session limit`,"settings.knob.activeDaemonsDoc":`Maximum background sessions running on this host.`,"settings.knob.safeMode":`Safe mode`,"settings.knob.safeModeDoc":`Enable extra-conservative runtime guardrails.`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`Enable the Telegram notification bridge.`,"settings.knob.showReasoning":`Show reasoning`,"settings.knob.showReasoningDoc":`Stream role reasoning into the activity view.`,"settings.knob.operatorAvailable":`Operator available`,"settings.knob.operatorAvailableDoc":`Off suppresses operator questions: Argus decides on recorded assumptions and blocks on operator-only actions.`,"noOperator.banner":`No-operator mode: questions suppressed. Argus decides on recorded assumptions instead of asking you.`,"noOperator.turnOff":`Ask me again`,"settings.source.notApplicable":`Not applicable for this model`,"settings.source.vaultDefault":`Capability vault / default`,"settings.source.default":`Default`,"settings.modelUnavailable":`unavailable`,"settings.modelOfflineList":`Offline list: the backend did not return its live models, showing the harness catalog.`,"settings.source.saved":`Saved override`,"settings.source.environment":`Environment variable`,"settings.source.hostConfig":`Host configuration`,"settings.source.other":`Resolved configuration`,"settings.value.enabled":`Enabled`,"settings.value.disabled":`Disabled`,"settings.effort.low":`Low effort`,"settings.effort.medium":`Medium effort`,"settings.effort.high":`High effort`,"settings.effort.xhigh":`Extra-high effort`,"settings.role.curator":`Curator`,"settings.role.curatorDoc":`Maintains and distills the reusable skill pool.`,"settings.footer":`Human-readable labels are shown with raw keys. The full registry remains available via`,"identity.title":`Identity`,"identity.subtitle":`who argus is working for on this project`,"identity.placeholder":`Describe who Argus is working for and durable preferences…`,"identity.save":`Save identity`,"identity.saved":`Identity saved.`,"transcript.title":`Transcript`,"transcript.subtitle":`recent operator ↔ argus turns · reply from the composer`,"transcript.empty":`no conversation turns yet`,"transcript.operator":`operator`,"new.createDaemon":`Create session`,"new.createdIdle":`New session ready. Say what it is for and the work begins.`,"new.createdStarting":`New session ready; the work is starting in the background.`,"new.subtitle":`Creates an isolated timeline and Manager context.`,"new.close":`close create session`,"new.name":`Name`,"new.optional":`(optional)`,"new.namePlaceholder":`e.g. AAAI embodiment paper`,"new.workdir":`Output workdir`,"new.workdirHint":`Agents write code, papers, reports, and experiment outputs here. Internal memory stays under the session state directory.`,"new.objective":`Objective`,"new.objectivePlaceholder":`Leave blank to start with a conversation, or describe a campaign to start immediately.`,"new.startsAfterCreate":`Campaign starts after session creation`,"new.idleUntilMessage":`Idle until the first message`,"new.startsHint":`The session opens immediately while Argus prepares the work in the background.`,"new.idleHint":`Background work starts after your first message, when needed.`,"new.shortcut":`Ctrl/⌘+Enter to create`,"new.creating":`Creating…`,"new.createAndStart":`Create and start`,"manage.daemon":`Manage session`,"manage.displayName":`Display name`,"manage.executor":`Background work`,"manage.running":`Running`,"manage.runningExternally":`Running externally`,"manage.paused":`Stopped`,"manage.pauseHint":`Interrupt the current operation and keep progress resumable.`,"manage.stopNow":`Stop now`,"manage.stopNowHint":`Immediately interrupt this verified daemon so the session can be deleted.`,"manage.externalHint":`This session is managed outside this app.`,"manage.resumeHint":`Resume queued research work.`,"manage.working":`Working…`,"manage.resume":`Resume`,"manage.deleteSession":`Delete session`,"manage.deleteHint":`Deleted sessions move to the trash and remain recoverable. Stop background work first.`,"manage.delete":`Delete…`,"manage.confirmQuestion":`Move this session to trash?`,"manage.confirmDelete":`Confirm delete`,"decision.operator":`Operator decision`,"decision.required":`Decision required`,"decision.whyBlocked":`Recorded reason this task needs input`,"decision.currentTask":`Current task`,"decision.taskName":`Task: {title}`,"decision.otherTask":`Another task awaiting input`,"decision.awaitingReply":`Awaiting your reply`,"decision.askedAt":`Asked {time}`,"decision.evidence":`Evidence`,"decision.notePlaceholder":`Add the guidance the Manager should apply…`,"decision.resumeHint":`Your answer applies to this task. The Manager checks its next step.`,"decision.later":`Later`,"decision.applying":`Submitted; Argus is starting on it…`,"decision.closeContinue":`Close, keep working`,"decision.stopCampaign":`Stop campaign`,"decision.useOption":`Use this option`,"decision.sendAnswer":`Send answer`,"decision.noteRequired":`Add the required details before sending this choice.`,"artifact.preview":`Result preview`,"artifact.title":`Result`,"artifact.approvedEvidence":`evidence the Reviewer has checked`,"artifact.downloading":`Downloading…`,"artifact.download":`Download`,"artifact.open":`Open`,"artifact.close":`close result preview`,"artifact.unavailable":`preview unavailable`,"artifact.empty":`(empty file)`,"artifact.truncated":`preview truncated · download to inspect the complete file`,"artifact.htmlTooLarge":`HTML preview is too large to render safely. Download the complete file.`,"artifact.pdfDisabled":`Inline PDF preview is disabled by this browser.`,"artifact.openPdf":`Open PDF`,"artifact.noPreview":`This file type has no safe inline preview.`,"artifact.downloadHint":`Download it to inspect with a local application.`,"task.details":`Task details`,"task.stopLoop":`stop loop`,"task.done":`done`,"task.skip":`skip`,"task.close":`close task details`,"task.waitingOnYou":`Waiting on you`,"task.objective":`Objective`,"task.noObjective":`(no objective recorded)`,"task.untitled":`Untitled task`,"task.priority":`priority`,"task.started":`started`,"task.finished":`finished`,"task.outcome":`Outcome`,"task.iteration":`Iteration`,"task.mode":`mode`,"task.autoIterate":`auto-iterate`,"task.singlePass":`single pass`,"task.cycles":`cycles`,"task.cost":`cost`,"task.lastError":`Last error`,"task.notes":`Notes`,"task.dependsOn":`depends on`,"task.dependsOnCount":`Depends on {count} earlier tasks`,"pending.reviewRespond":`Review and respond`,"pending.showOnMap":`Show on map`,"backlog.active":`Active · {count}`,"backlog.history":`History · {count}`,"backlog.noHistory":`No completed work yet`,"backlog.empty":`Nothing queued. Argus is ready for new work.`,"backlog.viewDetails":`View full task details`,"backlog.iterating":`Repeating`,"backlog.stopIterating":`Stop repeating`,"backlog.stop":`Stop`,"backlog.markDone":`Mark done`,"backlog.remove":`Remove`,"mission.achievement":`Argus achievement`,"mission.elapsed":`Elapsed`,"mission.rejectedAttempts":`{count} rejected attempts`,"mission.skillsLearned":`{count} skills learned`,"mission.artifacts":`{count} files produced`,"mission.waiting":`Waiting for a mission`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`Ready when you are — assign a mission to begin.`,"mission.statusDone":`This task: {outcome} — finished in {elapsed}.`,"mission.nextAfterReply":`Reply to this task’s question first, then decide its next step.`,"mission.continuousDone":`Continuous run finished`,"mission.resumeContinuous":`Resume`,"mission.control":`Mission control`,"mission.attentionHealth":`System error — health is degraded.`,"mission.attentionFailed":`Mission failed — check the task below.`,"mission.deliveryFailed":`Task failed at delivery — execution could not start or finish.`,"mission.attentionStepFailed":`A step failed — check the task below.`,"mission.attentionPaused":`Mission is paused — waiting for your input.`,"mission.showObjective":`Show full objective`,"mission.showFullOutput":`View full output`,"mission.stage":`Stage`,"mission.campaign":`Campaign`,"mission.totalElapsed":`Total elapsed`,"mission.round":`Round`,"mission.mode":`Mode`,"mission.summary":`Mission summary`,"mission.deliveryCertified":`Delivery approved`,"mission.taskCompleted":`Task completed`,"mission.openResult":`Open result`,"mission.viewTask":`View task`,"mission.taskPlan":`Task plan`,"mission.team":`Team`,"mission.waitingShort":`Waiting`,"mission.roleWork":`Role work`,"mission.showMore":`Show more`,"mission.showLess":`Show less`,"mission.done":`Done`,"mission.inProgress":`In progress`,"mission.failed":`Failed`,"mission.bannerPaused":`Mission is paused — waiting for your input.`,"mission.bannerError":`System error — health is degraded.`,"mission.bannerStepFailed":`A step failed: {step}`,"mission.elapsedAgo":`{elapsed} ago`,"mission.filteredBy":`filtered by {task} · clear`,"mission.allVisible":`all visible missions`,"mission.roundNumber":`round {count}`,"mission.noRoleWork":`No persisted {role} work for this selection yet.`,"mission.researchDag":`Task route`,"mission.active":`active`,"mission.noDag":`The Planner has not added tasks to the route yet.`,"mission.workingHypothesis":`Working hypothesis · can be revised`,"mission.goalContribution":`How this supports the goal`,"mission.temporaryRegressions":`Expected temporary tradeoffs`,"mission.decisionRule":`When to revise, split, or stop`,"mission.acceptance":`What counts as done`,"mission.nonGoals":`Non-goals`,"mission.capabilities":`Capabilities`,"mission.capabilitiesUnlocked":`Capabilities unlocked`,"mission.learnedCapability":`Learned capability`,"mission.learnedDuring":`Learned during {mission}`,"mission.skillUnavailable":`Skill content is not available in this snapshot.`,"mission.contentTruncated":`Content preview truncated`,"mission.knowledgeRetained":`Knowledge retained`,"mission.selfEvolution":`Saved project knowledge`,"mission.knowledgeSaved":`Argus saved these capabilities and notes for future work on this project.`,"mission.noCapabilities":`No capabilities learned yet.`,"mission.replay":`Mission replay`,"mission.replayTimeline":`Replay mission timeline`,"mission.roleFailed":`{role} failed`,"mission.showingLatestEvent":`Showing latest event`,"mission.showingLastEvents":`Showing last {count} events`,"mission.waitingEvents":`Waiting for structured research events.`,"mission.startsAfter":`Starts after {count} earlier tasks`,"mission.hiddenTasks":`{count} earlier tasks hidden · {failed} blocked or failed · {skipped} skipped`,"mission.projectFilesChanged":`Project files changed`,"mission.reviewInIde":`Open the IDE to review the diff`,"research.currentWork":`Current work`,"research.dagProgress":`Task route progress`,"research.verifiedOutputs":`Verified outputs`,"research.recentMilestones":`Recent milestones`,"research.liveProgress":`Task progress`,"research.artifact":`Research result`,"research.canvas":`Manager live research canvas`,"research.previewArtifact":`Preview the result`,"research.openLarge":`Open large preview`,"research.collapse":`Collapse preview`,"research.unavailable":`Manager live view is temporarily unavailable.`,"research.noPreview":`No preview`,"research.waiting":`Waiting…`,"research.updating":`Updating…`,"research.fileUnavailable":`This file is ready to download using the button above.`,"research.eventSourced":`event-sourced mission state`,"research.downloadFailed":`download failed`,"operations.title":`Operations`,"operations.work":`Work`,"operations.runtime":`Runtime`,"operations.system":`System`,"operations.recovery":`Recovery`,"operations.workInput":`Work input`,"operations.workHint":`Queue work, guide the active task, save a note, or preview a plan without dispatching it.`,"operations.action.task":`Task`,"operations.action.nudge":`Guide`,"operations.action.note":`Note`,"operations.action.plan":`Plan`,"operations.planPlaceholder":`Objective to preview; preview never queues work`,"operations.actionPlaceholder":`{action} text`,"operations.previewPlan":`Preview plan`,"operations.submitAction":`Submit {action}`,"operations.runtimeHint":`Change where this session runs, reset Manager context, or safely restart the session.`,"operations.workdir":`Working directory`,"operations.workdirUpdated":`Working directory updated.`,"operations.applyWorkdir":`Apply working directory`,"operations.replaceSlot":`Replace an active session`,"operations.sourceUpdate":`Argus source version`,"operations.pullLatest":`Pull latest version`,"operations.updateChecking":`Checking published branch…`,"operations.updateRunning":`Updating…`,"operations.updateAvailable":`Update available`,"operations.updateCurrent":`Up to date`,"operations.updateUnavailable":`This checkout cannot be updated safely.`,"operations.currentRevision":`Current`,"operations.latestRevision":`Latest`,"operations.updatePhase":`Phase`,"operations.updateRestart":`Source updated. Restart the cockpit, then use the reload button to move active daemons to the new release at a safe task boundary.`,"operations.skills":`Skills`,"operations.runSkill":`Run skill command`,"operations.metrics":`System metrics`,"operations.trash":`Recoverable trash`,"operations.searchTrash":`Search trash`,"operations.trashEmpty":`Trash is empty.`,"resource.title":`Resources`,"resource.loading":`Loading resource status…`,"resource.devices":`Devices: {count}`,"resource.inUse":`In use · {count}`,"resource.queue":`Queue · {count}`,"resource.none":`None`,"resource.timeLeft":`{ttl} left`,"resource.noIntent":`No purpose recorded`,"resource.yieldRequest":`Resource release requested · {reason}`,"resource.queuePosition":`Queue position {position}`,"label.status.inProgress":`In progress`,"label.status.waiting":`Waiting`,"label.status.completed":`Completed`,"label.status.blocked":`Blocked`,"label.status.failed":`Failed`,"label.status.needsChanges":`Needs changes`,"label.status.skipped":`Skipped`,"label.status.paused":`Paused`,"label.status.cancelled":`Cancelled`,"label.status.available":`Available`,"label.status.unavailable":`Unavailable`,"label.status.inaccessible":`Not accessible`,"label.status.limited":`Limited`,"label.status.healthy":`Healthy`,"label.status.updated":`Status updated`,"label.role.argus":`Argus`,"label.role.you":`You`,"label.work.task":`Task`,"label.work.action":`Work step`,"label.work.handoff":`Notes for the next step`,"label.work.review":`Review`,"label.work.planning":`Planning`,"label.work.update":`Update`,"label.stage.scope":`Scope`,"label.stage.research":`Research`,"label.stage.implementation":`Implementation`,"label.stage.experiment":`Experiments`,"label.stage.analysis":`Analysis`,"label.stage.writing":`Writing`,"label.stage.review":`Final review`,"label.stage.delivery":`Delivery`,"label.stage.unstaged":`Unstaged`,"label.frontier.reopened":`An earlier task was reopened`,"label.frontier.added":`A new task was added`,"label.frontier.completed":`A task path was completed`,"label.frontier.revised":`The task plan was revised`,"label.frontier.narrowed":`The task scope was narrowed`,"label.frontier.expanded":`The task scope was expanded`,"label.frontier.updated":`The task plan was updated`,"label.priority":`Priority {priority}`,"label.outcome.workCompleted":`Work completed`,"label.outcome.workPaused":`Work paused`,"label.outcome.workBlocked":`Work blocked`,"label.outcome.workFailed":`Work failed`,"label.outcome.workEnded":`Work ended`,"label.outcome.workIncomplete":`Work incomplete`,"label.outcome.workStalled":`Work stalled`,"label.outcome.workUpdated":`Work status updated`,"label.outcome.reviewPassed":`Review passed`,"label.outcome.reviewNeedsChanges":`Review requested changes`,"label.outcome.reviewBlocked":`Review blocked`,"label.outcome.reviewOutdated":`Review is out of date`,"label.outcome.reviewPending":`Review pending`,"label.outcome.stageApproved":`Stage approved`,"label.outcome.stageNotApproved":`Stage not approved`,"label.outcome.stageRevoked":`Stage approval revoked`,"label.outcome.stageNotNeeded":`Stage decision not needed`,"label.outcome.stagePending":`Stage decision pending`,"label.outcome.budgetPaused":`Paused by budget limit`,"label.outcome.costUnreconciled":`Awaiting provider usage reconciliation`,"label.outcome.waitingForYou":`Waiting for your response`,"label.outcome.stoppedByYou":`Stopped by you`,"label.outcome.pausedByYou":`Paused by you`,"label.outcome.sessionPaused":`Session paused`,"label.outcome.serviceUnavailable":`Service unavailable`,"label.outcome.serviceCoolingDown":`Service temporarily paused`,"label.outcome.temporaryIssue":`Paused by a temporary issue`,"label.outcome.serviceError":`Stopped by a service error`,"label.outcome.needsPlan":`A new plan is needed`,"label.outcome.canResume":`Can resume`,"label.routing.team":`Team workflow`,"label.routing.individual":`Individual workflow`,"label.routing.research":`Research`,"label.routing.software":`Software work`,"label.routing.staged":`Step by step`,"label.routing.flexible":`Flexible workflow`,"label.routing.ongoing":`Ongoing`,"label.routing.defined":`Defined scope`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`Accelerator`,"label.resource.enforced":`Limits enforced`,"label.resource.advisory":`Recommendations only`,"label.resource.released":`Resources released`,"label.resource.kept":`Resources kept`,"mission.lastProgress":`Progress recorded before the stop`,"mission.nextResume":`The progress is saved. Run Argus again and it continues from where it stopped.`,"mission.nextResumeLive":`Argus will continue from the saved progress.`,"research.totalTime":`Total time`,"research.optionDelivery":`Delivery`,"research.optionCheckpoint":`Checkpoint`,"research.optionPending":`being written`,"operations.unavailableHere":`This is not available on this Argus.`,"operations.requestFailed":`That did not go through.`,"operations.technicalDetails":`Technical details`,"verticals.title":`Vertical Store`,"verticals.entry":`Verticals`,"verticals.openStore":`Open Vertical Store`,"verticals.paletteHint":`install · enable · update`,"verticals.intro":`A vertical gives Argus a research domain: its stages, roles, skills and checks. Install what your projects need and enable it per workspace.`,"verticals.hostedNote":`Verticals are provided by the host; you can enable or disable them for your workspace.`,"verticals.close":`Close vertical store`,"verticals.search":`Search verticals`,"verticals.searchPlaceholder":`Search by name, purpose or tag…`,"verticals.refreshCatalog":`Refresh catalog`,"verticals.refreshing":`Refreshing…`,"verticals.catalogSource":`Catalog: {source}`,"verticals.catalogRelease":`Release {tag}`,"verticals.catalogFetched":`Fetched {time}`,"verticals.catalogNever":`Catalog not fetched yet`,"verticals.catalogError":`The catalog could not be refreshed: {error}`,"verticals.kindFilter":`Filter by kind`,"verticals.tagFilter":`Filter by tag`,"verticals.clearFilters":`Clear filters`,"verticals.count":`{shown} of {total}`,"verticals.filter.all":`All`,"verticals.routingPath":`Category / domain / specialty`,"verticals.filter.installed":`Installed`,"verticals.filter.available":`Available`,"verticals.filter.builtin":`Built-in`,"verticals.kind.builtin":`Built-in`,"verticals.kind.package":`Bundled`,"verticals.kind.installed":`Installed`,"verticals.kind.available":`Available`,"verticals.enabled":`Enabled`,"verticals.disabledState":`Disabled`,"verticals.updateAvailable":`Update available`,"verticals.updateTo":`Update to {version}`,"verticals.installedVersion":`Installed {version}`,"verticals.catalogVersion":`Catalog {version}`,"verticals.requires":`Requires`,"verticals.shared":`Shares resources with`,"verticals.size":`Size`,"verticals.jumpTo":`Go to {name}`,"verticals.missingPython":`Needs: {packages} — install them into the Python environment Argus runs from.`,"verticals.runtimeIssues":`Installed version is incompatible with this Argus runtime: {issues}`,"verticals.installIssues":`Catalog installation/update is blocked by runtime requirements: {issues}`,"verticals.usedByOne":`Used by 1 project`,"verticals.usedBy":`Used by {count} projects`,"verticals.action.install":`Install`,"verticals.action.update":`Update`,"verticals.action.enable":`Enable`,"verticals.action.disable":`Disable`,"verticals.action.uninstall":`Uninstall`,"verticals.confirmUninstall":`Confirm uninstall`,"verticals.confirmUninstallHint":`Removes {name} from this Argus.`,"verticals.removeAnyway":`Remove anyway`,"verticals.operation.install":`Installing…`,"verticals.operation.update":`Updating…`,"verticals.operation.enable":`Enabling…`,"verticals.operation.disable":`Disabling…`,"verticals.operation.uninstall":`Uninstalling…`,"verticals.operationRunning":`Working…`,"verticals.operationFailed":`{action} failed`,"verticals.loading":`Loading verticals…`,"verticals.noMatches":`No verticals match these filters.`,"verticals.none":`No verticals are listed yet.`,"verticals.loadFailed":`Could not read the vertical list.`,"verticals.actionFailed":`That did not go through.`,"verticals.tooOld":`This Argus backend predates the vertical store. Update Argus, then reopen this page to manage verticals.`},Ct={"language.english":`English`,"handshake.connecting":`正在准备 Argus`,"handshake.service":`服务`,"handshake.project":`项目`,"handshake.ready":`就绪`,"handshake.title":`正在准备 Argus`,"handshake.detail":`正在恢复你的工作区…`,"splash.starting":`Argus 启动中`,"rail.workbench":`工作台`,"rail.sessionsShortcut":`会话 · Ctrl/⌘ P`,"panel.backlog":`待办`,"panel.activity":`对话与进展`,"panel.journal":`日志`,"panel.roles":`角色`,"panel.project":`项目`,"panel.liveView":`Manager 实时项目视图`,"stream.jumpToLatest":`跳到最新`,"stream.toggleReasoning":`显示或隐藏 Agent 推理(⌘T)`,"stream.reasoning":`推理`,"stream.noLogs":`暂无活动`,"stream.system":`Argus 动态`,"stream.autonomous":`后台活动`,"stream.backgroundWork":`Argus 正在后台工作`,"stream.ready":`Argus 已就绪。你可以提问或安排下一项工作。`,"stream.historyLoading":`正在读取对话记录…`,"stream.historyError":`对话记录暂时读取失败。`,"stream.historyRetry":`重试`,"stream.fold.read":`读取了 {count} 个文件`,"stream.fold.search":`搜索了 {count} 次`,"stream.fold.fetch":`查阅了 {count} 个网页`,"stream.fold.edit":`修改了 {count} 个文件`,"stream.fold.tool":`使用了 {count} 次 {tool}`,"stream.fold.failed":`{count} 次失败`,"stream.fold.expand":`展开每一步`,"stream.fold.collapse":`收起`,"stream.repeated":`重复了 {count} 次,显示最近一次`,"stream.stepFailed":`失败`,"stream.stepResult":`结果`,"common.showRaw":`显示原始输出`,"doctor.lastEntry":`最近一条`,"operations.metric.calls":`今日模型调用`,"operations.metric.failed":`失败`,"operations.metric.slowest":`最慢的常规调用`,"operations.slo.healthy":`正常`,"operations.slo.degraded":`需要留意`,"operations.slo.loading":`加载中…`,"operations.validationFailures":`今日 {count} 条格式异常的事件`,"operations.outputLines":`共 {count} 行输出`,"operations.done":`已完成。`,"newDaemon.workdirPlaceholder":`留空 → ~/.argus-skill/workspaces/`,"operations.resetManager":`重新开始理解这段对话`,"language.chinese":`中文`,"language.switchTo":`切换到{language}`,"common.loading":`加载中…`,"common.retry":`重试`,"common.save":`保存`,"common.cancel":`取消`,"common.close":`关闭`,"common.settings":`设置`,"common.ready":`就绪`,"common.live":`实时`,"common.reconnecting":`正在重连`,"common.stale":`快照已过期`,"common.degraded":`快照异常`,"common.external":`外部`,"common.pause":`暂停`,"common.run":`运行`,"common.working":`处理中`,"common.local":`本地`,"common.all":`全部`,"common.unassigned":`未分配`,"common.closeSessions":`关闭会话列表`,"common.resizeSessions":`调整会话列表宽度`,"common.resizePreview":`调整预览区域宽度`,"common.expandPreview":`展开预览`,"time.justNow":`刚刚`,"time.minutesAgo":`{count}分钟前`,"time.hoursAgo":`{count}小时前`,"time.yesterdayAt":`昨天 {time}`,"connection.pairingTitle":`此浏览器尚未与 Argus 配对`,"connection.pairingDetail":`请打开这个站点的有效配对链接,或在下方粘贴配对链接或令牌。`,"connection.pairAgain":`重新配对`,"connection.pairingInput":`配对链接或令牌`,"connection.pairingPlaceholder":`粘贴新的配对链接或令牌`,"connection.pairingInvalid":`请输入有效的配对链接或令牌。`,"connection.connect":`连接`,"connection.unreachableTitle":`Argus 本地服务当前不可达`,"connection.unreachableDetail":`请保持 Argus Desktop 运行,等待本地服务就绪后再重试。`,"sidebar.collapse":`收起会话`,"sidebar.expand":`展开会话`,"sidebar.create":`创建项目`,"sidebar.find":`查找项目`,"sidebar.clearSearch":`清除搜索`,"sidebar.refreshFailed":`刷新失败 · 重试`,"sidebar.noSessions":`暂无会话`,"sidebar.noMatches":`没有匹配"{query}"的会话`,"sidebar.unnamedSession":`未命名会话`,"sidebar.daemonAlive":`Argus 后台在线`,"sidebar.updateRequired":`需要更新`,"sidebar.updateAvailable":`可更新`,"sidebar.updateAvailableHint":`后台仍在运行,执行器与网页版本不同。`,"sidebar.stopped":`后台已停止`,"sidebar.runningFor":`后台在线 · {uptime}`,"sidebar.lastActive":`上次活动 {time}`,"sidebar.manage":`管理 {name}`,"sidebar.manageHint":`重命名、暂停或删除`,"sidebar.resume":`继续`,"sidebar.resumeHint":`在 {workdir} 中继续工作`,"sidebar.resumeSuccess":`会话已恢复。`,"sidebar.resumeFailed":`无法恢复会话:{error}`,"sidebar.modelLoading":`正在加载后端和模型…`,"sidebar.modelUnavailable":`后端和模型信息不可用`,"sidebar.defaultModel":`默认模型`,"sidebar.openSettings":`打开设置`,"sidebar.compute":`算力队列与账户额度`,"sidebar.theme":`{current}主题;切换到{next}主题`,"landing.selectOrCreate":`从侧边栏选择一个会话,或创建新会话。`,"landing.noSessions":`还没有会话。创建一个即可开始。`,"landing.select":`选择项目`,"landing.new":`新建项目`,"landing.menu":`打开菜单`,"project.missingSwitched":`找不到项目“{requested}”,已切换到 {fallback}。`,"project.missingCreate":`找不到项目“{requested}”,请新建一个项目继续。`,"topbar.openSessions":`打开项目列表`,"topbar.externallyManaged":`由外部管理`,"topbar.pauseDaemon":`暂停 Argus`,"topbar.runDaemon":`运行 Argus`,"topbar.working":`Argus 正在处理你的请求`,"topbar.roleActive":`{role} 活跃中`,"topbar.roleIdle":`{role} 空闲`,"topbar.externalDaemonHint":`Argus 由此应用之外的服务管理,请前往相应位置控制。`,"topbar.manageSession":`管理会话`,"topbar.showPreview":`显示预览`,"topbar.showActivity":`显示动态`,"mobile.views":`视图`,"mobile.sessions":`项目`,"mobile.mission":`任务`,"mobile.activity":`对话`,"mobile.workbench":`工作台`,"mobile.map":`地图`,"mobile.preview":`文件`,"chat.working":`Argus 正在处理你的消息`,"chat.workingQuiet":`Argus 正在处理你的消息 · 仍在处理中,{quiet} 秒暂无新进展`,"chat.stopWaitingHint":`按 Esc 停止回复 · 按 Enter 追加消息`,"chat.queuedWhileRunning":`已排队 · 这条回复结束后立即处理;正在运行的任务会据此调整`,"chat.attachWhileRunning":`附件要等这条回复结束后再发送`,"chat.stepsLive":`正在工作 · 已 {count} 步`,"chat.stepsDone":`过程 {count} 步 · {seconds}`,"chat.stepFailed":`失败`,"chat.stepRaw":`原始参数`,"chat.messageArgus":`向 Argus 发送消息`,"chat.selectSession":`请选择会话…`,"chat.placeholder":`提问或安排工作`,"chat.routeLabel":`消息类型`,"chat.routeHint":`仅用于本条消息。Argus 根据实际需要选择单智能体或团队,问候直接回复。`,"chat.routeTask":`任务`,"chat.routeAuto":`自动`,"chat.routeChat":`对话`,"chat.attach":`添加文件`,"chat.attachHint":`支持 PNG、JPEG、WebP、PDF、Markdown/文本、JSON、CSV · 每条消息最多 {count} 个文件,单个 {perFile},总计 {total}`,"chat.attachDrop":`拖放文件以添加附件`,"chat.attachRemove":`移除附件 {name}`,"chat.attachUnsupported":`{name} 不受支持。请使用 PNG、JPEG、WebP、PDF、Markdown/文本、JSON 或 CSV。`,"chat.attachTooLarge":`{name} 超过单文件大小限制 {size}。`,"chat.attachTooMany":`每条消息最多只能附带 {count} 个文件。`,"chat.attachTotalTooLarge":`附件总大小超过 {size} 限制。`,"chat.attachmentUploadFailed":`附件上传失败:{error}`,"chat.uploadingAttachments":`正在上传附件`,"chat.rewriteHint":`把这段话整理得更清楚。改写结果会回到输入框,由你检查后发送。`,"chat.rewriteLabel":`整理这段话`,"chat.rewriting":`正在改写`,"chat.rewrite":`改写文字`,"chat.stopWaiting":`停止回复`,"chat.stopWaitingTitle":`停止处理这条消息`,"chat.stoppingReply":`正在停止当前回复…`,"chat.stopReplyRequested":`已收到停止请求,可以发送新消息。`,"chat.replyAlreadyFinished":`这次回复已经结束。`,"chat.stopReplyFailed":`服务端未能停止这次请求:{error}`,"chat.send":`发送消息`,"copy.message":`复制`,"copy.code":`复制代码`,"copy.copied":`已复制`,"help.title":`键盘快捷键`,"help.commands":`命令`,"help.palette":`打开命令面板`,"help.sessions":`展开或收起会话`,"help.managerChat":`聚焦 Manager 对话框`,"help.rewrite":`发送前改写当前提示词`,"help.reasoning":`显示或隐藏 Agent 推理`,"help.kiosk":`切换只读展示模式`,"help.composer":`聚焦输入框`,"help.send":`发送消息`,"help.newline":`插入换行`,"help.thisHelp":`打开此帮助`,"help.escape":`关闭浮层或停止等待`,"palette.placeholder":`输入命令或搜索…`,"palette.noMatches":`没有匹配的命令`,"palette.navigate":`↑↓ 导航`,"palette.run":`↵ 执行`,"palette.close":`Esc 关闭`,"palette.view":`视图`,"palette.action":`操作`,"palette.project":`项目`,"palette.newDaemon":`新建会话`,"palette.openTranscript":`打开对话记录`,"palette.openProject":`打开项目`,"palette.projectHint":`工作 · 记忆 · Agent`,"palette.openOperations":`打开运行控制`,"palette.operationsHint":`会话控制`,"palette.hideReasoning":`隐藏推理`,"palette.showReasoning":`显示推理`,"palette.exitKiosk":`退出展示模式`,"palette.enterKiosk":`进入展示模式`,"palette.messageArgus":`向 Argus 发送消息…`,"palette.stopWaiting":`停止当前回复`,"palette.stopContinuous":`停止持续任务`,"palette.startContinuous":`启动持续任务`,"palette.stopDaemon":`暂停 Argus`,"palette.startDaemon":`运行 Argus`,"slash.suggestions":`Slash 命令建议`,"mission.roleActive":`{role} 正在工作`,"mission.overview":`任务概览`,"mission.operations":`运行控制`,"role.manager":`统筹`,"role.manager.description":`理解你的目标,协调工作`,"role.planner":`规划`,"role.planner.description":`拆解问题,安排后续工作并调整计划`,"role.engineer":`执行`,"role.engineer.description":`查资料、写证明或代码,调用工具验证`,"role.reviewer":`复核`,"role.reviewer.description":`检查结果与证据,指出缺口`,"role.critic":`Critic`,"role.system":`Argus`,"role.operator":`你`,"doctor.title":`诊断`,"doctor.subtitle":`Argus 状态检查与推荐的根因修复方案`,"doctor.recommended":`推荐修复`,"doctor.loadError":`无法加载诊断数据。`,"doctor.empty":`诊断暂无数据`,"doctor.daemonLog":`后台进程日志`,"settings.subtitle":`生效中的角色、预算和关键控制项`,"settings.loadError":`无法加载配置。`,"settings.empty":`未找到配置`,"settings.quickConfig":`快速配置`,"settings.appearance":`外观`,"settings.appearanceHint":`选择界面主题色。Logo 与图标始终保持黑白,不参与渐变。`,"settings.themeStyle":`主题色`,"settings.themeStyle.standard":`标准`,"settings.themeStyle.standardHint":`克制的黑、白、灰与蓝色。`,"settings.themeStyle.gradient":`渐变`,"settings.themeStyle.gradientHint":`经典 Argus 蓝金渐变背景。`,"settings.backend":`后端`,"settings.backendSource.env":`由服务器环境设置`,"settings.backendSource.persisted":`已保存的设置`,"settings.backendSource.default":`内置默认值`,"settings.backendWillSave":`应用后保存为{backend}。`,"settings.backendWillReplace":`应用后把已保存的{saved}改为{backend}。`,"settings.backendLabel.copilot":`GitHub Copilot`,"settings.backendLabel.codex":`Codex`,"settings.backendLabel.claude":`Claude`,"settings.backendLabel.cursor":`Cursor`,"settings.backendLabel.opencode":`OpenCode`,"settings.backendLabel.pi":`Pi`,"settings.backendLabel.grok":`Grok`,"settings.backendLabel.qoder":`Qoder`,"settings.backendLabel.dsh":`DSH`,"settings.backendSwitched":`后端已保存为{backend}。重启 Argus 后生效。`,"settings.backendUnsupported":`不支持的后端({backend})`,"settings.backendUnavailable":`后端信息不可用`,"settings.model":`模型`,"settings.trialAccount":`试用账号`,"settings.trialKeyHint":`额度用完后可在这里更换 Key,项目和对话会保留。`,"settings.changeTrialKey":`更换 Key`,"settings.applyModel":`应用`,"settings.modelPlaceholder":`auto(后端默认模型)`,"settings.connection":`连接`,"settings.webApi":`Web + REST API`,"settings.eventStream":`实时动态`,"settings.taskDaemon":`后台工作`,"settings.taskDaemonValue":`本地进程 · events.jsonl · 无 TCP 端口`,"chat.messageTooLong":`消息超过 32,000 字符,请缩短或作为附件上传。草稿已保留。`,"settings.required":`必须填写{field}`,"settings.advanced":`高级设置`,"settings.advancedHint":`预算、顾问模型、讲解强度、连接详情与原始配置`,"settings.mapModel":`地图`,"settings.mapModelFollows":`跟随前台模型`,"settings.mapModelSet":`地图讲解现在用 {model}。`,"settings.overrideTitle":`环境变量覆盖`,"settings.overrideHint":`设置特定的配置别名或环境变量键。`,"settings.namePlaceholder":`名称或别名,例如 manager_model`,"settings.valuePlaceholder":`值`,"settings.applyAdvanced":`应用环境变量覆盖`,"settings.applied":`设置已应用。请重启受影响的会话以使用新设置。`,"settings.modelAppliedToRoles":`所有角色现在都用 {model}。正在运行的会话要重启后才换。`,"settings.rolesRunning":`各角色当前实际使用:`,"settings.applyUnifies":`点“应用”会把它们统一成上面的模型。`,"settings.rolesTitle":`生效中的角色`,"settings.rawConfig":`原始配置`,"settings.group.limits":`限制`,"settings.group.safety":`安全`,"settings.group.interface":`界面`,"settings.knob.activeDaemons":`活动会话上限`,"settings.knob.activeDaemonsDoc":`此主机上可同时运行的后台会话数量上限。`,"settings.knob.safeMode":`安全模式`,"settings.knob.safeModeDoc":`启用更保守的运行时保护措施。`,"settings.knob.telegram":`Telegram`,"settings.knob.telegramDoc":`启用 Telegram 通知桥接。`,"settings.knob.showReasoning":`显示推理`,"settings.knob.showReasoningDoc":`在活动视图中显示角色推理过程。`,"settings.knob.operatorAvailable":`有人值守`,"settings.knob.operatorAvailableDoc":`关闭后不再向你提问:Argus 依据记录的假设自行决定,需要你授权的操作会直接停下。`,"noOperator.banner":`无人值守模式:已停止提问。Argus 会依据记录的假设自行决定,而不是问你。`,"noOperator.turnOff":`恢复提问`,"settings.source.notApplicable":`不适用于此模型`,"settings.source.vaultDefault":`能力库 / 默认值`,"settings.source.default":`默认值`,"settings.modelUnavailable":`不可用`,"settings.modelOfflineList":`离线列表:后端没有返回实时模型列表,显示的是本地目录。`,"settings.source.saved":`已保存的覆盖值`,"settings.source.environment":`环境变量`,"settings.source.hostConfig":`主机配置`,"settings.source.other":`解析后的配置`,"settings.value.enabled":`已启用`,"settings.value.disabled":`已停用`,"settings.effort.low":`低推理强度`,"settings.effort.medium":`中等推理强度`,"settings.effort.high":`高推理强度`,"settings.effort.xhigh":`超高推理强度`,"settings.role.curator":`知识维护`,"settings.role.curatorDoc":`维护并提炼可复用技能库。`,"settings.footer":`配置项同时显示易读标签和原始键。完整配置仍可通过以下命令查看:`,"identity.title":`身份`,"identity.subtitle":`本项目中 Argus 服务的对象`,"identity.placeholder":`描述 Argus 正在为谁工作,以及需要长期遵循的偏好…`,"identity.save":`保存身份`,"identity.saved":`身份已保存。`,"transcript.title":`对话记录`,"transcript.subtitle":`近期操作者 ↔ Argus 对话 · 请从输入框继续回复`,"transcript.empty":`暂无对话记录`,"transcript.operator":`操作者`,"new.createDaemon":`创建会话`,"new.createdIdle":`新会话已就绪。说一句你想做什么,工作就开始了。`,"new.createdStarting":`新会话已就绪,工作正在后台开始。`,"new.subtitle":`在这里保存你的对话和任务进度。`,"new.close":`关闭创建会话窗口`,"new.name":`名称`,"new.optional":`(可选)`,"new.namePlaceholder":`例如:AAAI 具身智能论文`,"new.workdir":`输出工作目录`,"new.workdirHint":`Agent 会在这里写入代码、论文、报告和实验结果。内部记忆仍保存在会话状态目录中。`,"new.objective":`目标`,"new.objectivePlaceholder":`留空则从对话开始,也可以填写一个立即启动的持续任务。`,"new.startsAfterCreate":`创建会话后立即启动任务`,"new.idleUntilMessage":`收到第一条消息前保持空闲`,"new.startsHint":`会话会立即打开,Argus 将在后台准备相关工作。`,"new.idleHint":`收到第一条消息后,Argus 会按需启动后台工作。`,"new.shortcut":`按 Ctrl/⌘+Enter 创建`,"new.creating":`正在创建…`,"new.createAndStart":`创建并启动`,"manage.daemon":`管理会话`,"manage.displayName":`显示名称`,"manage.executor":`后台工作`,"manage.running":`运行中`,"manage.runningExternally":`由外部运行`,"manage.paused":`未运行`,"manage.pauseHint":`中断当前操作并保留可恢复的进度。`,"manage.stopNow":`立即停止`,"manage.stopNowHint":`立即中断这个已验证的 daemon,停止后即可删除会话。`,"manage.externalHint":`此会话由此应用之外的服务管理。`,"manage.resumeHint":`继续执行队列中的研究工作。`,"manage.working":`处理中…`,"manage.resume":`继续`,"manage.deleteSession":`删除会话`,"manage.deleteHint":`删除的会话会移入回收站,之后仍可恢复。请先停止后台工作。`,"manage.delete":`删除…`,"manage.confirmQuestion":`将此会话移入回收站?`,"manage.confirmDelete":`确认删除`,"decision.operator":`操作者决策`,"decision.required":`需要你的决策`,"decision.whyBlocked":`这项任务记录的待答原因`,"decision.currentTask":`当前任务`,"decision.taskName":`任务:{title}`,"decision.otherTask":`其他待处理任务`,"decision.awaitingReply":`等待你的回复`,"decision.askedAt":`提问于 {time}`,"decision.evidence":`证据`,"decision.notePlaceholder":`添加 Manager 应采用的指导…`,"decision.resumeHint":`回答只针对这项任务,Manager 会据此检查它的下一步。`,"decision.later":`稍后处理`,"decision.applying":`已提交,Argus 正在开始处理…`,"decision.closeContinue":`关闭,后台继续`,"decision.stopCampaign":`停止持续任务`,"decision.useOption":`使用此选项`,"decision.sendAnswer":`发送回答`,"decision.noteRequired":`这个选项需要补充说明后才能提交。`,"artifact.preview":`结果预览`,"artifact.title":`结果`,"artifact.approvedEvidence":`已经检查确认的依据`,"artifact.downloading":`正在下载…`,"artifact.download":`下载`,"artifact.open":`打开`,"artifact.close":`关闭结果预览`,"artifact.unavailable":`无法预览`,"artifact.empty":`(空文件)`,"artifact.truncated":`预览已截断 · 请下载完整文件查看`,"artifact.htmlTooLarge":`HTML 文件过大,无法安全预览。请下载完整文件。`,"artifact.pdfDisabled":`此浏览器已禁用内嵌 PDF 预览。`,"artifact.openPdf":`打开 PDF`,"artifact.noPreview":`此文件类型无法安全地在线预览。`,"artifact.downloadHint":`请下载后使用本地应用查看。`,"task.details":`任务详情`,"task.stopLoop":`停止循环`,"task.done":`完成`,"task.skip":`跳过`,"task.close":`关闭任务详情`,"task.waitingOnYou":`等待你的回复`,"task.objective":`目标`,"task.noObjective":`(未记录目标)`,"task.untitled":`未命名任务`,"task.priority":`优先级`,"task.started":`开始时间`,"task.finished":`完成时间`,"task.outcome":`结果`,"task.iteration":`迭代`,"task.mode":`模式`,"task.autoIterate":`自动迭代`,"task.singlePass":`单次执行`,"task.cycles":`轮次`,"task.cost":`成本`,"task.lastError":`最近错误`,"task.notes":`备注`,"task.dependsOn":`依赖`,"task.dependsOnCount":`依赖前置任务 {count} 项`,"pending.reviewRespond":`查看并回复`,"pending.showOnMap":`在地图上查看`,"backlog.active":`进行中 · {count}`,"backlog.history":`历史记录 · {count}`,"backlog.noHistory":`暂无已完成工作`,"backlog.empty":`队列中没有工作。Argus 已准备好接收新任务。`,"backlog.viewDetails":`查看完整任务详情`,"backlog.iterating":`重复执行中`,"backlog.stopIterating":`停止重复执行`,"backlog.stop":`停止`,"backlog.markDone":`标记为完成`,"backlog.remove":`移除`,"mission.achievement":`Argus 成果`,"mission.elapsed":`耗时`,"mission.rejectedAttempts":`{count} 次方案被拒绝`,"mission.skillsLearned":`学习了 {count} 个 Skill`,"mission.artifacts":`产出 {count} 个文件`,"mission.waiting":`等待任务`,"mission.statusActive":`{role} — {work}`,"mission.statusWaiting":`已准备就绪,请分配一个任务开始工作。`,"mission.statusDone":`本次任务:{outcome} — 用时 {elapsed}。`,"mission.nextAfterReply":`请先回复这项任务的问题,再决定它的下一步。`,"mission.continuousDone":`连续运行已完成`,"mission.resumeContinuous":`恢复`,"mission.control":`任务控制`,"mission.attentionHealth":`系统出错——运行状态异常。`,"mission.attentionFailed":`任务失败——请查看下方详情。`,"mission.deliveryFailed":`任务在交付阶段失败——执行未能启动或完成。`,"mission.attentionStepFailed":`有一个步骤失败——请查看下方任务。`,"mission.attentionPaused":`任务已暂停——正在等待你的输入。`,"mission.showObjective":`显示完整目标`,"mission.showFullOutput":`查看完整输出`,"mission.stage":`阶段`,"mission.campaign":`持续任务`,"mission.totalElapsed":`总耗时`,"mission.round":`轮次`,"mission.mode":`模式`,"mission.summary":`本次完成`,"mission.deliveryCertified":`交付成果已通过审核`,"mission.taskCompleted":`任务已完成`,"mission.openResult":`打开成果`,"mission.viewTask":`查看任务`,"mission.taskPlan":`任务计划`,"mission.team":`团队`,"mission.waitingShort":`等待中`,"mission.roleWork":`角色工作`,"mission.showMore":`显示更多`,"mission.showLess":`收起`,"mission.done":`已完成`,"mission.inProgress":`进行中`,"mission.failed":`失败`,"mission.bannerPaused":`任务已暂停 — 等待你的操作。`,"mission.bannerError":`系统异常 — 健康状态已降级。`,"mission.bannerStepFailed":`某步骤失败:{step}`,"mission.elapsedAgo":`{elapsed} 前`,"mission.filteredBy":`按 {task} 筛选 · 清除`,"mission.allVisible":`全部可见任务`,"mission.roundNumber":`第 {count} 轮`,"mission.noRoleWork":`当前筛选下还没有持久化的 {role} 工作记录。`,"mission.researchDag":`任务路线`,"mission.active":`进行中`,"mission.noDag":`Planner 尚未向路线中添加任务。`,"mission.workingHypothesis":`当前假设 · 可随证据调整`,"mission.goalContribution":`对目标的作用`,"mission.temporaryRegressions":`预期的暂时取舍`,"mission.decisionRule":`何时调整、拆分或停止`,"mission.acceptance":`完成的标准`,"mission.nonGoals":`非目标`,"mission.capabilities":`能力`,"mission.capabilitiesUnlocked":`已解锁能力`,"mission.learnedCapability":`已学习能力`,"mission.learnedDuring":`在“{mission}”期间学习`,"mission.skillUnavailable":`当前快照中没有此 Skill 的内容。`,"mission.contentTruncated":`内容预览已截断`,"mission.knowledgeRetained":`已保留知识`,"mission.selfEvolution":`已保存的项目知识`,"mission.knowledgeSaved":`Argus 已保存这些能力和笔记,供本项目后续工作使用。`,"mission.noCapabilities":`尚未学习新能力。`,"mission.replay":`任务回放`,"mission.replayTimeline":`回放任务时间线`,"mission.roleFailed":`{role} 执行失败`,"mission.showingLatestEvent":`显示最近一条事件`,"mission.showingLastEvents":`显示最近 {count} 条事件`,"mission.waitingEvents":`等待结构化研究事件。`,"mission.startsAfter":`需等待前置任务 {count} 项`,"mission.hiddenTasks":`已隐藏前序任务 {count} 项 · 阻塞或失败 {failed} 项 · 已跳过 {skipped} 项`,"mission.projectFilesChanged":`项目文件有变更`,"mission.reviewInIde":`可打开 IDE 查看差异`,"research.currentWork":`当前工作`,"research.dagProgress":`任务路线进度`,"research.verifiedOutputs":`已验证输出`,"research.recentMilestones":`近期里程碑`,"research.liveProgress":`任务进展`,"research.artifact":`研究成果`,"research.canvas":`Manager 实时研究面板`,"research.previewArtifact":`预览成果`,"research.openLarge":`打开大尺寸预览`,"research.collapse":`收起预览`,"research.unavailable":`Manager 实时视图暂时不可用。`,"research.noPreview":`暂无预览`,"research.waiting":`等待中…`,"research.updating":`正在更新…`,"research.fileUnavailable":`文件已就绪,可点击上方下载按钮获取。`,"research.eventSourced":`基于事件的任务状态`,"research.downloadFailed":`下载失败`,"operations.title":`运行控制`,"operations.work":`工作`,"operations.runtime":`运行时`,"operations.system":`系统`,"operations.recovery":`恢复`,"operations.workInput":`工作输入`,"operations.workHint":`加入工作、指导当前任务、保存备注,或仅预览计划而不分派。`,"operations.action.task":`任务`,"operations.action.nudge":`指导`,"operations.action.note":`备注`,"operations.action.plan":`计划`,"operations.planPlaceholder":`要预览的目标;预览不会加入任务队列`,"operations.actionPlaceholder":`输入 {action} 内容`,"operations.previewPlan":`预览计划`,"operations.submitAction":`提交 {action}`,"operations.runtimeHint":`更改会话运行位置、重置 Manager 上下文,或安全重启会话。`,"operations.workdir":`工作目录`,"operations.workdirUpdated":`工作目录已更新。`,"operations.applyWorkdir":`应用工作目录`,"operations.replaceSlot":`替换活动会话`,"operations.sourceUpdate":`Argus 源码版本`,"operations.pullLatest":`拉取最新版本`,"operations.updateChecking":`正在检查已发布分支…`,"operations.updateRunning":`正在更新…`,"operations.updateAvailable":`有可用更新`,"operations.updateCurrent":`已是最新`,"operations.updateUnavailable":`当前工作树无法安全更新。`,"operations.currentRevision":`当前`,"operations.latestRevision":`最新`,"operations.updatePhase":`阶段`,"operations.updateRestart":`源码已更新。请重启工作台,再使用重载按钮让活动 daemon 在安全任务边界切换到新版本。`,"operations.skills":`Skills`,"operations.runSkill":`运行 Skill 命令`,"operations.metrics":`系统指标`,"operations.trash":`可恢复的回收站`,"operations.searchTrash":`搜索回收站`,"operations.trashEmpty":`回收站为空。`,"resource.title":`资源`,"resource.loading":`正在加载资源状态…`,"resource.devices":`设备:{count}`,"resource.inUse":`使用中 · {count}`,"resource.queue":`等待队列 · {count}`,"resource.none":`无`,"resource.timeLeft":`剩余 {ttl}`,"resource.noIntent":`未记录用途`,"resource.yieldRequest":`收到释放资源请求 · {reason}`,"resource.queuePosition":`队列第 {position} 位`,"label.status.inProgress":`进行中`,"label.status.waiting":`等待中`,"label.status.completed":`已完成`,"label.status.blocked":`暂时无法继续`,"label.status.failed":`失败`,"label.status.needsChanges":`需要修改`,"label.status.skipped":`已跳过`,"label.status.paused":`已暂停`,"label.status.cancelled":`已取消`,"label.status.available":`可用`,"label.status.unavailable":`不可用`,"label.status.inaccessible":`无法访问`,"label.status.limited":`部分受限`,"label.status.healthy":`状态正常`,"label.status.updated":`状态已更新`,"label.role.argus":`Argus`,"label.role.you":`你`,"label.work.task":`任务`,"label.work.action":`工作步骤`,"label.work.handoff":`给下一步的说明`,"label.work.review":`审核`,"label.work.planning":`规划`,"label.work.update":`动态`,"label.stage.scope":`范围定义`,"label.stage.research":`研究`,"label.stage.implementation":`方法实现`,"label.stage.experiment":`实验验证`,"label.stage.analysis":`结果分析`,"label.stage.writing":`论文写作`,"label.stage.review":`最终审核`,"label.stage.delivery":`成果交付`,"label.stage.unstaged":`未分阶段`,"label.frontier.reopened":`已重新开启一项前序任务`,"label.frontier.added":`已添加一项新任务`,"label.frontier.completed":`这部分工作已完成`,"label.frontier.revised":`已调整任务计划`,"label.frontier.narrowed":`已缩小任务范围`,"label.frontier.expanded":`已扩大任务范围`,"label.frontier.updated":`任务计划已更新`,"label.priority":`优先级 {priority}`,"label.outcome.workCompleted":`工作已完成`,"label.outcome.workPaused":`工作已暂停`,"label.outcome.workBlocked":`工作暂时无法继续`,"label.outcome.workFailed":`工作失败`,"label.outcome.workEnded":`工作已结束`,"label.outcome.workIncomplete":`工作尚未完成`,"label.outcome.workStalled":`工作停滞`,"label.outcome.workUpdated":`工作状态已更新`,"label.outcome.reviewPassed":`结果检查通过`,"label.outcome.reviewNeedsChanges":`检查后发现需要修改`,"label.outcome.reviewBlocked":`结果检查暂时无法继续`,"label.outcome.reviewOutdated":`审核结果已过期`,"label.outcome.reviewPending":`等待审核`,"label.outcome.stageApproved":`可以进入下一步`,"label.outcome.stageNotApproved":`还不能进入下一步`,"label.outcome.stageRevoked":`阶段批准已撤回`,"label.outcome.stageNotNeeded":`无需阶段审核`,"label.outcome.stagePending":`还没确定能否进入下一步`,"label.outcome.budgetPaused":`因预算上限暂停`,"label.outcome.costUnreconciled":`调用费用待对账(并非预算耗尽)`,"label.outcome.waitingForYou":`正在等待你的回复`,"label.outcome.stoppedByYou":`已由你停止`,"label.outcome.pausedByYou":`已由你暂停`,"label.outcome.sessionPaused":`会话已暂停`,"label.outcome.serviceUnavailable":`服务暂不可用`,"label.outcome.serviceCoolingDown":`服务暂时暂停`,"label.outcome.temporaryIssue":`因临时问题暂停`,"label.outcome.serviceError":`因服务错误停止`,"label.outcome.needsPlan":`需要制定新计划`,"label.outcome.canResume":`可以继续`,"label.routing.team":`团队协作`,"label.routing.individual":`单独执行`,"label.routing.research":`研究任务`,"label.routing.software":`软件工作`,"label.routing.staged":`分步执行`,"label.routing.flexible":`灵活流程`,"label.routing.ongoing":`持续进行`,"label.routing.defined":`范围明确`,"label.resource.nvidiaGpu":`NVIDIA GPU`,"label.resource.amdGpu":`AMD GPU`,"label.resource.appleGpu":`Apple GPU`,"label.resource.cpu":`CPU`,"label.resource.accelerator":`加速设备`,"label.resource.enforced":`强制执行限制`,"label.resource.advisory":`仅提供建议`,"label.resource.released":`已释放资源`,"label.resource.kept":`继续占用资源`,"mission.lastProgress":`停下之前记录的进展`,"mission.nextResume":`进度已保存,重新运行 Argus 就会从停下的地方继续。`,"mission.nextResumeLive":`Argus 会从已保存的进度继续。`,"research.totalTime":`累计用时`,"research.optionDelivery":`交付`,"research.optionCheckpoint":`检查点`,"research.optionPending":`生成中`,"operations.unavailableHere":`这项功能在当前的 Argus 上不提供。`,"operations.requestFailed":`这次操作没有成功。`,"operations.technicalDetails":`技术细节`,"verticals.title":`垂域商店`,"verticals.entry":`垂域商店`,"verticals.openStore":`打开垂域商店`,"verticals.paletteHint":`安装 · 启用 · 更新`,"verticals.intro":`垂域为 Argus 提供一个研究领域的阶段、角色、技能与检查项。按项目需要安装,并为各工作区分别启用。`,"verticals.hostedNote":`垂域由服务方提供;你可以为自己的工作区启用或停用。`,"verticals.close":`关闭垂域商店`,"verticals.search":`搜索垂域`,"verticals.searchPlaceholder":`按名称、用途或标签搜索…`,"verticals.refreshCatalog":`刷新目录`,"verticals.refreshing":`正在刷新…`,"verticals.catalogSource":`目录来源:{source}`,"verticals.catalogRelease":`版本 {tag}`,"verticals.catalogFetched":`{time} 获取`,"verticals.catalogNever":`尚未获取目录`,"verticals.catalogError":`目录刷新失败:{error}`,"verticals.kindFilter":`按类型筛选`,"verticals.tagFilter":`按标签筛选`,"verticals.clearFilters":`清除筛选`,"verticals.count":`显示 {shown} / {total}`,"verticals.filter.all":`全部`,"verticals.routingPath":`分类 / 领域 / 专项`,"verticals.filter.installed":`已安装`,"verticals.filter.available":`可安装`,"verticals.filter.builtin":`内置`,"verticals.kind.builtin":`内置`,"verticals.kind.package":`随包提供`,"verticals.kind.installed":`已安装`,"verticals.kind.available":`可安装`,"verticals.enabled":`已启用`,"verticals.disabledState":`已停用`,"verticals.updateAvailable":`有新版本`,"verticals.updateTo":`更新至 {version}`,"verticals.installedVersion":`已安装 {version}`,"verticals.catalogVersion":`目录版本 {version}`,"verticals.requires":`依赖`,"verticals.shared":`共享资源`,"verticals.size":`大小`,"verticals.jumpTo":`查看 {name}`,"verticals.missingPython":`缺少 Python 包:{packages}。请把它们安装到运行 Argus 的那个 Python 环境里。`,"verticals.runtimeIssues":`已安装版本与当前 Argus 运行时不兼容:{issues}`,"verticals.installIssues":`目录版本的安装/更新被运行时要求阻止:{issues}`,"verticals.usedByOne":`1 个项目在用`,"verticals.usedBy":`{count} 个项目在用`,"verticals.action.install":`安装`,"verticals.action.update":`更新`,"verticals.action.enable":`启用`,"verticals.action.disable":`停用`,"verticals.action.uninstall":`卸载`,"verticals.confirmUninstall":`确认卸载`,"verticals.confirmUninstallHint":`将从这台 Argus 移除 {name}。`,"verticals.removeAnyway":`仍要移除`,"verticals.operation.install":`正在安装…`,"verticals.operation.update":`正在更新…`,"verticals.operation.enable":`正在启用…`,"verticals.operation.disable":`正在停用…`,"verticals.operation.uninstall":`正在卸载…`,"verticals.operationRunning":`处理中…`,"verticals.operationFailed":`{action}失败`,"verticals.loading":`正在读取垂域…`,"verticals.noMatches":`没有符合筛选条件的垂域。`,"verticals.none":`目前还没有可用的垂域。`,"verticals.loadFailed":`无法读取垂域列表。`,"verticals.actionFailed":`这次操作没有成功。`,"verticals.tooOld":`当前的 Argus 后端还没有垂域商店。请先更新 Argus,再打开这里管理垂域。`};function wt(){try{let e=localStorage.getItem(xt);if(e===`en`||e===`zh-CN`)return e}catch{}return navigator.language.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}function Tt(e,t={},n=wt()){let r=(n===`zh-CN`?Ct[e]:St[e])??e;return Et.has(e)&&(r=r.replace(/\bArgus\b/g,yt().name)),r.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??`{${n}}`))}var Et=new Set([`handshake.connecting`,`handshake.title`,`splash.starting`,`connection.pairingTitle`,`topbar.pauseDaemon`,`topbar.runDaemon`,`chat.messageArgus`,`palette.messageArgus`,`palette.stopDaemon`,`palette.startDaemon`,`role.system`,`label.role.argus`]),Dt=(0,x.createContext)({locale:`en`,setLocale:()=>void 0,t:(e,t)=>Tt(e,t,`en`)});function O({children:e}){let[t,n]=(0,x.useState)(wt),r=e=>{try{localStorage.setItem(xt,e)}catch{}n(e)};(0,x.useEffect)(()=>{document.documentElement.lang=t},[t]);let i=(0,x.useMemo)(()=>({locale:t,setLocale:r,t:(e,n)=>Tt(e,n,t)}),[t]);return(0,D.jsx)(Dt.Provider,{value:i,children:e})}function Ot(){return(0,x.useContext)(Dt)}var kt=class extends x.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){if(!this.state.failed)return this.props.children;let e=this.props.locale===`zh-CN`;return(0,D.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-bg p-8 text-ink`,role:`alert`,children:(0,D.jsxs)(`section`,{className:`max-w-lg rounded-xl border border-line bg-panel p-8 shadow-lg`,children:[(0,D.jsx)(`p`,{className:`mb-3 text-xs font-semibold uppercase tracking-widest text-blue`,children:yt().name}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:e?`工作台暂时无法显示`:`The workspace could not be displayed`}),(0,D.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-ink-dim`,children:e?`页面资源未能正确加载。后端任务不会因此被停止;你仍可使用桌面菜单查看日志或设置。重新加载会丢弃页面中尚未发送的输入。`:`A page resource failed to load. Backend work has not been stopped. Desktop menus remain available for logs and settings. Reloading discards unsent input on this page.`}),(0,D.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,D.jsx)(`button`,{type:`button`,className:`rounded-md bg-blue px-4 py-2 text-sm text-white`,onClick:()=>window.location.reload(),children:e?`重新加载工作台`:`Reload workspace`}),(0,D.jsx)(`button`,{type:`button`,className:`rounded-md border border-line px-4 py-2 text-sm`,onClick:()=>{let e=new URL(window.location.href);e.searchParams.set(`view`,`activity`),window.location.assign(e.toString())},children:e?`返回对话页面`:`Return to conversation`})]})]})})}};function At(){let e=(0,x.useSyncExternalStore)(xe,be,()=>!1),{locale:t}=Ot();if(!e)return null;let n=t===`zh-CN`;return(0,D.jsxs)(`div`,{role:`status`,className:`fixed left-1/2 top-3 z-[110] flex w-[min(92vw,42rem)] -translate-x-1/2 items-center gap-3 rounded-xl border border-blue/40 bg-panel px-4 py-3 text-sm text-ink shadow-xl`,children:[(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`strong`,{children:n?`页面已更新`:`Page update available`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-ink-dim`,children:n?`刷新后显示最新选项和功能。请先复制未发送的内容。`:`Refresh for the latest options and features. Copy any unsent text first.`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`shrink-0 rounded-md border border-blue/40 px-3 py-2 text-xs text-blue`,children:n?`刷新页面`:`Refresh page`})]})}var k={ADVISOR_CONSULTATION_REQUESTED:`advisor.consultation.requested`,ADVISOR_CONSULTATION_COMPLETED:`advisor.consultation.completed`,ADVISOR_CONSULTATION_FAILED:`advisor.consultation.failed`,ADVISOR_CONSULTATION_CANCELLED:`advisor.consultation.cancelled`,ADVISOR_CONSULTATION_TIMED_OUT:`advisor.consultation.timed_out`,ADVISOR_CONSULTATION_MODEL_MISMATCH:`advisor.consultation.model_mismatch`,LIFE_MANAGER_SUPERVISION_ISSUED:`life.manager.supervision.issued`,LIFE_MANAGER_SUPERVISION_APPLIED:`life.manager.supervision.applied`,LIFE_MANAGER_SUPERVISION_FAILED:`life.manager.supervision.failed`,LIFE_PEER_MESSAGE_PROCESSED:`life.peer.message.processed`,LIFE_CONFIG_PARSE_FAILED:`life.config.parse_failed`,AGENT_IO_START:`agent.io.start`,AGENT_IO_STREAM:`agent.io.stream`,AGENT_IO_COMPLETE:`agent.io.complete`,AGENT_IO_ERROR:`agent.io.error`,USAGE_RECORDED:`usage.recorded`,ACCOUNTING_JOURNAL_REPAIRED:`accounting.journal_repaired`,PROVIDER_REQUEST_STARTED:`provider.request.started`,PROVIDER_REQUEST_COMPLETED:`provider.request.completed`,PROVIDER_REQUEST_DENIED:`provider.request.denied`,CODEX_UTIL_COMPLETED:`codex.util.completed`,SKILL_COST_COMPLETED:`skill.cost.completed`,BUDGET_RESERVATION_CREATED:`budget.reservation.created`,BUDGET_RESERVATION_DENIED:`budget.reservation.denied`,BUDGET_RESERVATION_SETTLED:`budget.reservation.settled`,BUDGET_RESERVATION_RELEASED:`budget.reservation.released`,BUDGET_UNPRICED_BLOCKED:`budget.unpriced.blocked`,BUDGET_UNPRICED_ACKNOWLEDGED:`budget.unpriced.acknowledged`,LOOP_START:`loop.start`,LOOP_DONE:`loop.done`,ROUND_START:`round.start`,ROUND_MAIN_COMPLETED:`round.main.completed`,ROUND_REVIEW_STARTED:`round.review.started`,ROUND_REVIEW_DEFERRED:`round.review.deferred`,ROUND_REVIEW_COMPLETED:`round.review.completed`,ROUND_CHECKPOINT_RECORDED:`round.checkpoint.recorded`,ROUND_CHECKPOINT_FAILED:`round.checkpoint.failed`,ROUND_SECRET_REDACTED:`round.secret_redacted`,ROUND_ESCALATED:`round.escalated`,ROUND_STALL:`round.stall`,ROUND_REVIEWER_BACKEND_FAILURE:`round.reviewer_backend_failure`,ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF:`round.reviewer_backend_failure.backoff`,ROUND_BACKEND_FAILURE_BACKOFF:`round.backend_failure.backoff`,ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED:`round.backend_failure.hold_interrupted`,ROUND_WATCHDOG_RETRY:`round.watchdog.retry`,ROUND_WATCHDOG_RETRY_EXHAUSTED:`round.watchdog.retry_exhausted`,ROUND_MODEL_CONFIGURATION_ERROR:`round.model_configuration_error`,ROUND_PROVIDER_TURN_CAP_RESTART:`round.provider_turn_cap.restart`,ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART:`round.provider_turn_cap.reviewer_restart`,ROUND_ORPHAN_PROCESS_GROUP:`round.orphan_process_group`,ROUND_EXTERNAL_WORK_WAIT_STARTED:`round.external_work_wait.started`,ROUND_EXTERNAL_WORK_WAIT_COMPLETED:`round.external_work_wait.completed`,ROUND_EXTERNAL_WORK_REVIEW_REQUIRED:`round.external_work_review.required`,ROUND_EXTERNAL_WORK_REVIEW_COMPLETED:`round.external_work_review.completed`,ROLE_SESSION_TURN:`role.session.turn`,ENGINEER_PROGRESS:`engineer.progress`,ENGINEER_SKILL_MAINTENANCE_COMPLETED:`engineer.skill_maintenance.completed`,LIFE_STATUS:`life.status`,LIFE_PHASE_STARTED:`life.phase.started`,LIFE_MISSION_STARTED:`life.mission.started`,LIFE_MISSION_COMPLETED:`life.mission.completed`,LIFE_MISSION_FAILED:`life.mission.failed`,LIFE_MISSION_SKIPPED:`life.mission.skipped`,LIFE_MISSION_ORPHANED:`life.mission.orphaned`,LIFE_MISSION_REQUEUED:`life.mission.requeued`,LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED:`life.mission.provider_configuration_disabled`,LIFE_ITERATION_CONTINUED:`life.iteration.continued`,LIFE_REVIEW_WAIVED:`life.review.waived`,LIFE_POST_MISSION_STOP:`life.post_mission.stop`,LIFE_EXECUTION_HOST_BLOCKED:`life.execution_host.blocked`,LIFE_AUTH_FAILURE:`life.auth_failure`,LIFE_SUPERVISOR_ERROR:`life.supervisor.error`,LIFE_LEARNED_VERTICAL_PROMOTED:`life.learned_vertical.promoted`,LIFE_LEARNED_VERTICAL_PROMOTION_FAILED:`life.learned_vertical.promotion_failed`,LIFE_MANAGER_INTENT_STARTED:`life.manager.intent.started`,LIFE_MANAGER_INTENT_COMPLETED:`life.manager.intent.completed`,LIFE_MANAGER_INTENT_FAILED:`life.manager.intent.failed`,LIFE_MANAGER_INTENT_SUPERSEDED:`life.manager.intent.superseded`,LIFE_MANAGER_GOAL_CONTRACT_FAILED:`life.manager.goal_contract.failed`,LIFE_MANAGER_STAGE_DECISION:`life.manager.stage_decision`,LIFE_MANAGER_PLAN_CHALLENGE_DECIDED:`life.manager.plan_challenge.decided`,LIFE_MANAGER_FEEDBACK_PERSISTED:`life.manager.feedback.persisted`,LIFE_MANAGER_FEEDBACK_UNRESOLVED:`life.manager.feedback.unresolved`,LIFE_MANAGER_FEEDBACK_EXHAUSTED:`life.manager.feedback.exhausted`,LIFE_MANAGER_PROJECT_REPORT:`life.manager.project_report`,LIFE_MANAGER_PROJECT_REPORT_FAILED:`life.manager.project_report.failed`,LIFE_VERTICAL_RESOLVED:`life.vertical.resolved`,LIFE_MANAGER_BACKEND_RESOLVED:`life.manager.backend_resolved`,LIFE_PLANNER_BACKEND_RESOLVED:`life.planner.backend_resolved`,LIFE_ENGINEER_BACKEND_RESOLVED:`life.engineer.backend_resolved`,LIFE_REVIEWER_BACKEND_RESOLVED:`life.reviewer.backend_resolved`,LIFE_CURATOR_BACKEND_RESOLVED:`life.curator.backend_resolved`,LIFE_PLANNER_START:`life.planner.start`,LIFE_PLANNER_PREVIEW_SKIPPED:`life.planner.preview_skipped`,LIFE_PLANNER_NORMALIZED:`life.planner.normalized`,LIFE_PLANNER_TASK_ADDED:`life.planner.task_added`,LIFE_PLANNER_TASK_SKIPPED:`life.planner.task_skipped`,LIFE_PLANNER_VERDICT:`life.planner.verdict`,LIFE_PLANNER_WAITING:`life.planner.waiting`,LIFE_PLANNER_WAITING_WOKEN:`life.planner.waiting_woken`,LIFE_PLANNER_TERMINAL_IDLE:`life.planner.terminal_idle`,LIFE_PLANNER_VERIFICATION_PROBE:`life.planner.verification_probe`,LIFE_PLANNER_STALL_ESCALATION:`life.planner.stall_escalation`,LIFE_PLANNER_DEPENDENCY_DROPPED:`life.planner.dependency_dropped`,LIFE_PLANNER_PARALLEL_DROPPED:`life.planner.parallel_dropped`,LIFE_PLANNER_ERROR:`life.planner.error`,LIFE_PLANNER_DEFERRED:`life.planner.deferred`,LIFE_PLANNER_SUPERSEDED:`life.planner.superseded`,LIFE_PLANNER_WAIT_OVERRIDDEN:`life.planner.wait_overridden`,LIFE_PLANNER_WAITING_CONTRACT_NORMALIZED:`life.planner.waiting_contract.normalized`,LIFE_PLANNER_EXTERNAL_POLL_SUPPRESSED:`life.planner.external_poll_suppressed`,LIFE_PLANNER_VERDICT_DISCARDED:`life.planner.verdict.discarded`,LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED:`life.planner.final_submission_skipped`,LIFE_PLANNER_CONTINUATION_REQUIRED:`life.planner.continuation_required`,LIFE_PLANNER_COMPLETION_REJECTED:`life.planner.completion_rejected`,LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED:`life.planner.completion_circuit_opened`,LIFE_PLANNER_COMPLETION_CIRCUIT_HOLDING:`life.planner.completion_circuit_holding`,LIFE_PLANNER_COMPLETION_CIRCUIT_NOTIFY_FAILED:`life.planner.completion_circuit.notify_failed`,PLAN_DRAFT_START:`plan.draft.start`,PLAN_DRAFT_DONE:`plan.draft.done`,PLAN_DRAFT_FAILED:`plan.draft.failed`,LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED:`life.runtime_failure.circuit_opened`,LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED:`life.runtime_failure.circuit_blocked`,LIFE_RUNTIME_FAILURE_CANARY_PASSED:`life.runtime_failure.canary_passed`,LIFE_RUNTIME_INCIDENT_DETECTED:`life.runtime.incident.detected`,LIFE_RUNTIME_INCIDENT_RECOVERED:`life.runtime.incident.recovered`,LIFE_RUNTIME_INCIDENT_ESCALATED:`life.runtime.incident.escalated`,LIFE_PLAN_REVISION_PROPOSED:`life.plan.revision.proposed`,LIFE_PLAN_REVISION_REJECTED:`life.plan.revision.rejected`,LIFE_PLAN_REVISION_COMMITTED:`life.plan.revision.committed`,LIFE_PLAN_NODE_SUPERSEDED:`life.plan.node.superseded`,LIFE_PLAN_REVISION_ROLLED_BACK:`life.plan.revision.rolled_back`,LIFE_RESEARCH_SECOND_READING:`life.research.second_reading`,LIFE_LETTER_WRITTEN:`life.letter.written`,LIFE_BUDGET_PAUSE:`life.budget.pause`,LIFE_LIFECYCLE_BLOCK:`life.lifecycle.block`,LIFE_LIFECYCLE_TRANSITION:`life.lifecycle.transition`,LIFE_INBOX_QUEUED:`life.inbox.queued`,LIFE_INBOX_DRAINED:`life.inbox.drained`,LIFE_OPERATOR_QUESTION_PENDING:`life.operator_question.pending`,LIFE_OPERATOR_QUESTION_ANSWERED:`life.operator_question.answered`,LIFE_DAEMON_IDLE_TIMEOUT:`life.daemon.idle_timeout`,LIFE_DAEMON_READY:`life.daemon.ready`,LIFE_DAEMON_DEGRADED:`life.daemon.degraded`,PROJECT_COMPLETED:`project.completed`,PROJECT_COMPLETION_REFUSED:`project.completion_refused`,DAEMON_PARKED:`daemon.parked`,DAEMON_COMMAND_SUBMITTED:`daemon.command.submitted`,DAEMON_COMMAND_COMPLETED:`daemon.command.completed`,DAEMON_COMMAND_REJECTED:`daemon.command.rejected`,IDEA_SEARCH_STARTED:`idea.search.started`,IDEA_SEARCH_COMPLETED:`idea.search.completed`,IDEA_SEARCH_SKIPPED:`idea.search.skipped`,IDEA_PORTFOLIO_FORMED:`idea.portfolio.formed`,IDEA_PORTFOLIO_NESTED_SKIPPED:`idea.portfolio.nested_skipped`,VENUE_RESEARCH_STARTED:`venue.research.started`,VENUE_RESEARCH_COMPLETED:`venue.research.completed`,RESEARCH_ACHIEVEMENT_CERTIFIED:`research.achievement.certified`,SKILL_LIBRARY_AVAILABLE:`skill.library.available`,SKILL_CREATED:`skill.created`,SKILL_UPDATED:`skill.updated`,SKILL_ARCHIVED:`skill.archived`,SKILL_TIDIED:`skill.tidied`,SKILL_HISTORY_COMPRESSED:`skill.history.compressed`,SKILL_EVOLUTION_COMPLETED:`skill.evolution.completed`,TEAM_LEARNING_REVIEW_STARTED:`team.learning.review.started`,TEAM_LEARNING_REVIEW_SKIPPED:`team.learning.review.skipped`,TEAM_LEARNING_REVIEW_COMPLETED:`team.learning.review.completed`,TEAM_LEARNING_REVIEW_FAILED:`team.learning.review.failed`,TEAM_LEARNING_PROMOTION_QUARANTINED:`team.learning.promotion.quarantined`,SELF_LEARNING_REVIEW_STARTED:`self.learning.review.started`,SELF_LEARNING_REVIEW_COMPLETED:`self.learning.review.completed`,SELF_LEARNING_REVIEW_FAILED:`self.learning.review.failed`,DOMAIN_PROMOTION:`domain.promotion`,WIKI_INITIALIZED:`wiki.initialized`,WIKI_HOOK_WARNING:`wiki.hook.warning`,WIKI_CREATED:`wiki.created`,WIKI_UPDATED:`wiki.updated`,WIKI_RETIRED:`wiki.retired`,WIKI_PROMOTION_PROMOTED:`wiki.promotion.promoted`,WIKI_PROMOTION_DEMOTED:`wiki.promotion.demoted`,WIKI_RETIRED_COMPRESSED:`wiki.retired.compressed`,WIKI_EVOLUTION_COMPLETED:`wiki.evolution.completed`,KNOWLEDGE_LEARNED:`knowledge.learned`,KNOWLEDGE_RECALLED:`knowledge.recalled`,OPERATOR_ALERT:`operator_alert`,MANAGER_LIVE_VIEW_UPDATED:`manager.live_view.updated`,MANAGER_LIVE_VIEW_REJECTED:`manager.live_view.rejected`,MANAGER_TURN_STARTED:`manager.turn.started`,MANAGER_TURN_CANCELLED:`manager.turn.cancelled`,USER_NOTE:`user.note`,UI_OPERATOR:`ui.operator`,UI_ARGUS:`ui.argus`},jt={"loop.started":k.LOOP_START,"loop.completed":k.LOOP_DONE,"round.started":k.ROUND_START,"mission.started":k.LIFE_MISSION_STARTED,"mission.completed":k.LIFE_MISSION_COMPLETED,"mission.error":k.LIFE_MISSION_FAILED};k.ADVISOR_CONSULTATION_COMPLETED,k.ADVISOR_CONSULTATION_FAILED,k.ADVISOR_CONSULTATION_CANCELLED,k.ADVISOR_CONSULTATION_TIMED_OUT,k.ADVISOR_CONSULTATION_MODEL_MISMATCH,k.LIFE_MANAGER_SUPERVISION_APPLIED,k.LIFE_MANAGER_SUPERVISION_FAILED,k.LIFE_PEER_MESSAGE_PROCESSED,k.LIFE_CONFIG_PARSE_FAILED,k.LIFE_MANAGER_BACKEND_RESOLVED,k.LIFE_PLANNER_BACKEND_RESOLVED,k.LIFE_ENGINEER_BACKEND_RESOLVED,k.LIFE_REVIEWER_BACKEND_RESOLVED,k.LIFE_CURATOR_BACKEND_RESOLVED,k.LOOP_START,k.LOOP_DONE,k.ROUND_START,k.ROUND_MAIN_COMPLETED,k.ROUND_REVIEW_DEFERRED,k.ROUND_REVIEW_COMPLETED,k.ROUND_CHECKPOINT_RECORDED,k.ROUND_CHECKPOINT_FAILED,k.ROUND_SECRET_REDACTED,k.ROUND_ESCALATED,k.ROUND_STALL,k.ROUND_REVIEWER_BACKEND_FAILURE,k.ENGINEER_SKILL_MAINTENANCE_COMPLETED,k.SKILL_LIBRARY_AVAILABLE,k.SKILL_CREATED,k.SKILL_UPDATED,k.SKILL_ARCHIVED,k.SKILL_TIDIED,k.SKILL_HISTORY_COMPRESSED,k.SKILL_EVOLUTION_COMPLETED,k.WIKI_INITIALIZED,k.WIKI_HOOK_WARNING,k.WIKI_CREATED,k.WIKI_UPDATED,k.WIKI_RETIRED,k.WIKI_PROMOTION_PROMOTED,k.WIKI_PROMOTION_DEMOTED,k.WIKI_RETIRED_COMPRESSED,k.WIKI_EVOLUTION_COMPLETED,k.KNOWLEDGE_LEARNED,k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MANAGER_INTENT_STARTED,k.LIFE_MANAGER_INTENT_COMPLETED,k.LIFE_MANAGER_INTENT_FAILED,k.LIFE_MANAGER_STAGE_DECISION,k.LIFE_MANAGER_PLAN_CHALLENGE_DECIDED,k.LIFE_VERTICAL_RESOLVED,k.LIFE_PLANNER_START,k.LIFE_PLANNER_PREVIEW_SKIPPED,k.LIFE_PLANNER_TASK_ADDED,k.LIFE_PLANNER_TASK_SKIPPED,k.LIFE_PLANNER_DEPENDENCY_DROPPED,k.LIFE_PLANNER_PARALLEL_DROPPED,k.LIFE_PLANNER_VERDICT,k.LIFE_PLANNER_WAITING,k.LIFE_PLANNER_WAITING_WOKEN,k.LIFE_PLANNER_TERMINAL_IDLE,k.LIFE_PLANNER_VERIFICATION_PROBE,k.LIFE_PLANNER_STALL_ESCALATION,k.LIFE_RUNTIME_FAILURE_CIRCUIT_OPENED,k.LIFE_RUNTIME_FAILURE_CIRCUIT_BLOCKED,k.LIFE_RUNTIME_FAILURE_CANARY_PASSED,k.LIFE_RUNTIME_INCIDENT_DETECTED,k.LIFE_RUNTIME_INCIDENT_RECOVERED,k.LIFE_RUNTIME_INCIDENT_ESCALATED,k.LIFE_PLAN_REVISION_PROPOSED,k.LIFE_PLAN_REVISION_REJECTED,k.LIFE_PLAN_REVISION_COMMITTED,k.LIFE_PLAN_NODE_SUPERSEDED,k.LIFE_RESEARCH_SECOND_READING,k.LIFE_LETTER_WRITTEN,k.LIFE_BUDGET_PAUSE,k.BUDGET_RESERVATION_DENIED,k.BUDGET_UNPRICED_BLOCKED,k.LIFE_LIFECYCLE_BLOCK,k.LIFE_LIFECYCLE_TRANSITION,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.LIFE_INBOX_QUEUED,k.LIFE_INBOX_DRAINED,k.LIFE_DAEMON_IDLE_TIMEOUT,k.PROJECT_COMPLETED,k.PROJECT_COMPLETION_REFUSED,k.DAEMON_PARKED,k.DAEMON_COMMAND_COMPLETED,k.DAEMON_COMMAND_REJECTED,k.IDEA_SEARCH_STARTED,k.IDEA_SEARCH_COMPLETED,k.IDEA_SEARCH_SKIPPED,k.VENUE_RESEARCH_STARTED,k.VENUE_RESEARCH_COMPLETED,k.RESEARCH_ACHIEVEMENT_CERTIFIED,k.LIFE_MISSION_PROVIDER_CONFIGURATION_DISABLED,k.LIFE_ITERATION_CONTINUED,k.LIFE_REVIEW_WAIVED,k.LIFE_POST_MISSION_STOP,k.LIFE_EXECUTION_HOST_BLOCKED,k.LIFE_AUTH_FAILURE,k.LIFE_SUPERVISOR_ERROR,k.LIFE_LEARNED_VERTICAL_PROMOTED,k.LIFE_LEARNED_VERTICAL_PROMOTION_FAILED,k.LIFE_MANAGER_INTENT_SUPERSEDED,k.LIFE_MANAGER_GOAL_CONTRACT_FAILED,k.LIFE_MANAGER_FEEDBACK_PERSISTED,k.LIFE_MANAGER_FEEDBACK_EXHAUSTED,k.LIFE_MANAGER_PROJECT_REPORT_FAILED,k.LIFE_PLANNER_DEFERRED,k.LIFE_PLANNER_SUPERSEDED,k.LIFE_PLANNER_WAIT_OVERRIDDEN,k.LIFE_PLANNER_FINAL_SUBMISSION_SKIPPED,k.LIFE_PLANNER_CONTINUATION_REQUIRED,k.LIFE_PLANNER_COMPLETION_REJECTED,k.LIFE_PLANNER_COMPLETION_CIRCUIT_OPENED,k.PLAN_DRAFT_DONE,k.PLAN_DRAFT_FAILED,k.LIFE_PLAN_REVISION_ROLLED_BACK,k.ROUND_REVIEWER_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_BACKOFF,k.ROUND_BACKEND_FAILURE_HOLD_INTERRUPTED,k.ROUND_WATCHDOG_RETRY,k.ROUND_WATCHDOG_RETRY_EXHAUSTED,k.ROUND_MODEL_CONFIGURATION_ERROR,k.ROUND_PROVIDER_TURN_CAP_RESTART,k.ROUND_PROVIDER_TURN_CAP_REVIEWER_RESTART,k.ROUND_ORPHAN_PROCESS_GROUP,k.ROUND_EXTERNAL_WORK_WAIT_STARTED,k.ROUND_EXTERNAL_WORK_WAIT_COMPLETED,k.ROUND_EXTERNAL_WORK_REVIEW_REQUIRED,k.ROUND_EXTERNAL_WORK_REVIEW_COMPLETED,k.LIFE_DAEMON_DEGRADED,k.IDEA_PORTFOLIO_FORMED,k.TEAM_LEARNING_REVIEW_STARTED,k.TEAM_LEARNING_REVIEW_COMPLETED,k.TEAM_LEARNING_REVIEW_FAILED,k.TEAM_LEARNING_PROMOTION_QUARANTINED,k.DOMAIN_PROMOTION,k.MANAGER_LIVE_VIEW_UPDATED,k.MANAGER_TURN_STARTED,k.MANAGER_TURN_CANCELLED,k.USER_NOTE,k.UI_OPERATOR,k.UI_ARGUS,k.OPERATOR_ALERT,k.AGENT_IO_START,k.AGENT_IO_COMPLETE,k.AGENT_IO_ERROR,k.PROVIDER_REQUEST_STARTED,k.PROVIDER_REQUEST_COMPLETED,k.PROVIDER_REQUEST_DENIED,k.USAGE_RECORDED;function Mt(e){let t=String(e??``).trim();return Object.hasOwn(jt,t)?jt[t]:t}function Nt(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Nt).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Nt(t[e])}`).join(`,`)}}`}function Pt(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function Ft(e){let t=e.event_id??e.id??e.seq??e._offset,n=String(e.type??`event`);return t!=null&&t!==``?`${n}-${String(t)}`:`${n}-${String(e.ts??e.time??``)}-${Pt(Nt(e))}`}function It(e){return e.type===k.ENGINEER_PROGRESS&&e.kind===`reasoning`}function Lt(e){if(e.type!==k.ENGINEER_PROGRESS||![`assistant_message`,`agent_message`,`message`].includes(String(e.kind??``)))return!1;let t=String(e.agent_layer??e.actor??``);return String(e.text??``).trimStart().startsWith(`{`)?t===`reviewer`||t===`planner`:!1}var Rt=/^(?:[-*+]\s*)?[`*_]*(?:ARGUS_)?(?:MILESTONE_STATUS|NEXT_OWNER|OPERATOR_QUESTION|OPERATOR_OPTIONS|ROLE_DECISION)[`*_]*\s*[:=]|^(?:final\s+)?decision\s*:\s*$/i;function zt(e){return String(e??``).split(/\r?\n/).filter(e=>!Rt.test(e.trim())).join(` +`).trim()}function Bt(e){let t=String(e.fragment_mode??``);return t===`append`||t===`snapshot`?t:e.replace===!0?`snapshot`:`auto`}function Vt(e,t){let n=Math.min(e.length,t.length);for(let r=n;r>=8;--r)if(e.endsWith(t.slice(0,r)))return r;return 0}function Ht(e,t,n=`auto`){let r=(e||``).trim(),i=(t||``).trim();if(!r)return i;if(!i)return r;if(n===`snapshot`)return i;if(r.includes(i))return r;if(n===`append`)return`${r}\n${i}`;if(i.includes(r))return i;let a=Vt(r,i);return a?`${r}${i.slice(a)}`:`${r}\n${i}`}var Ut=[`all`,`attention`,`milestones`,`messages`],Wt=new Set([k.LIFE_MISSION_STARTED,k.LIFE_MISSION_COMPLETED,k.LIFE_MISSION_FAILED,k.LOOP_START,k.LOOP_DONE,k.LIFE_PLANNER_VERDICT,k.LIFE_BUDGET_PAUSE,k.LIFE_LIFECYCLE_BLOCK]);function Gt(e,t,n=`all`,r=``){let i=Mt(e.canonical_type??e.type),a=String(e.kind??``);if(n===`attention`&&![`warn`,`err`].includes(String(t.tone??``))&&e.operator_alert!==!0||n===`milestones`&&!(t.rule&&!i.startsWith(`ui.`))&&!Wt.has(i)||n===`messages`&&t.tone!==`bright`&&![`assistant_message`,`agent_message`,`message`].includes(a)&&![`ui.operator`,`ui.argus`].includes(i))return!1;let o=r.trim().toLocaleLowerCase();return!o||[i,a,t.role,t.label,t.text,e.title,e.objective,e.text,e.summary,e.reason,e.error,e.status,e.action_summary,e.command,e.path,Array.isArray(e.tags)?e.tags.join(` `):e.tags].some(e=>String(e??``).toLocaleLowerCase().includes(o))}function Kt(e,t,n){e.setQueryData([`snapshot`,t],e=>e&&{...e,session:{...e.session,display_name:n}}),e.setQueryData([`projects`],e=>e&&{...e,projects:e.projects.map(e=>e.id===t?{...e,display_name:n,label:n||e.objective||e.id}:e)})}var qt=15e3,Jt=5e3,Yt=8e3,Xt=2e3,Zt=1e4,A=1e4;function Qt(e,t){return!Ke(t)&&!(t instanceof Ce)&&e<1}function $t(e){return!Ke(e)&&Jt}function en(e){return e?.projects.some(e=>e.daemon_alive)?Xt:qt}function tn(e){return e?.daemon.alive||e?.manager_requests?.some(e=>e.status===`running`)?Xt:Yt}var nn=()=>s({queryKey:[`projects`],queryFn:E.projectIndex,refetchInterval:e=>en(e.state.data)}),rn=()=>s({queryKey:[`project-costs`],queryFn:({signal:e})=>E.projectCosts(e),retry:Qt,refetchInterval:e=>$t(e.state.error),refetchIntervalInBackground:!1}),an=e=>s({queryKey:[`snapshot`,e],queryFn:({signal:t})=>E.activeSnapshot(e,t),enabled:!!e,refetchInterval:e=>tn(e.state.data)}),on=(e,t=30,n=!0)=>s({queryKey:[`journal`,e,t],queryFn:({signal:n})=>E.journal(e,t,n),enabled:!!e&&n,refetchInterval:n?8e3:!1}),sn=(e,t)=>s({queryKey:[`doctor`,e],queryFn:({signal:t})=>E.doctor(e,t),enabled:!!e&&t}),cn=(e,t)=>s({queryKey:[`config`,e],queryFn:({signal:t})=>E.config(e,t),enabled:!!e&&t}),ln=(e,t)=>s({queryKey:[`identity`,e],queryFn:({signal:t})=>E.identity(e,t),enabled:!!e&&t}),un=(e,t,n=30)=>s({queryKey:[`transcript`,e,n],queryFn:({signal:t})=>E.transcript(e,n,t),enabled:!!e&&t}),dn=(e,t=!0)=>s({queryKey:[`artifacts`,e],queryFn:({signal:t})=>E.artifacts(e,t),enabled:!!e&&t,refetchInterval:t?Zt:!1}),fn=(e,t,n=null)=>s({queryKey:[`artifact`,e,t,n],queryFn:({signal:n})=>E.artifact(e,t,n),enabled:!!e&&!!t,refetchInterval:e=>t&&/(?:^|[\\/])REVIEW\.md$/i.test(t)&&!Ke(e.state.error)?2e3:!1}),pn=(e,t=!0)=>s({queryKey:[`git-diff`,e],queryFn:({signal:t})=>E.gitDiff(e,t),enabled:!!e&&t,refetchInterval:t?A:!1}),mn=(e,t)=>s({queryKey:[`backlog-item`,e,t],queryFn:({signal:n})=>E.backlogItem(e,t,n),enabled:!!e&&!!t});function hn(e,t){let n=c(),r=e=>{n.invalidateQueries({queryKey:[`snapshot`,e]}),n.invalidateQueries({queryKey:[`status`,e]}),n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`backlog-item`,e]})},i=()=>r(e);return{addTask:h({mutationFn:t=>E.addTask(e,t),onSuccess:i}),nudge:h({mutationFn:t=>E.nudge(e,t)}),note:h({mutationFn:t=>E.note(e,t)}),startDaemon:h({mutationFn:()=>E.startDaemon(e,t),onSuccess:i}),stopDaemon:h({mutationFn:n=>E.stopDaemon(e,n,t),onSuccess:i}),forceStopDaemon:h({mutationFn:()=>E.stopDaemon(e,!1,t,!0),onSuccess:i}),updateProject:h({mutationFn:e=>E.updateProject(e.sid,e.name),onSuccess:e=>{Kt(n,e.sid,e.name),r(e.sid)}}),deleteProject:h({mutationFn:()=>E.deleteProject(e),onSuccess:async()=>{let t=e;if(t){let e=e=>e.queryKey.some(e=>e===t);await n.cancelQueries({predicate:e}),n.removeQueries({predicate:e})}await n.invalidateQueries({queryKey:[`projects`]})}}),disposeBacklog:h({mutationFn:t=>E.disposeBacklog(e,t.id,t.op),onSuccess:i}),stopBacklog:h({mutationFn:t=>E.stopBacklog(e,t),onSuccess:i}),setContinuous:h({mutationFn:t=>E.setContinuous(e,t.enabled,t.objective??``),onSuccess:i})}}var gn=2e3;function _n(e,t){if(t.kind===`reset`)return{sid:t.sid,events:[],seen:new Set};if(t.sid!==e.sid)return e;if(t.kind===`seed`){let n=new Set,r=[];[...t.events,...e.events].forEach(e=>{let t=Ft(e);n.has(t)||(n.add(t),r.push(e))});let i=r.slice(-2e3);return{sid:e.sid,events:i,seen:new Set(i.map(e=>Ft(e)))}}let n=t.kind===`push`?[t.ev]:t.events,r=null,i=null;for(let t of n){let n=i??e.seen,a=Ft(t);n.has(a)||((!r||!i)&&(r=[...e.events],i=new Set(e.seen)),i.add(a),r.push(t))}return!r||!i?e:(r.length>gn&&r.splice(0,r.length-gn).forEach(e=>i.delete(Ft(e))),{sid:e.sid,events:r,seen:i})}var vn=new Set([`manager.live_view.updated`,`round.review.completed`,`life.mission.completed`]);function yn(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=String(n.type??``);if(vn.has(r)||r===`engineer.progress`&&n.kind===`file_change`)return Ft(n)}return``}var bn=new Set([`life.operator_question.pending`,`life.operator_question.answered`,`life.planner.task_added`,`life.planner.verdict`,`life.mission.started`,`life.mission.completed`,`life.mission.failed`,`round.review.completed`]);function xn(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(bn.has(String(n.type??``)))return Ft(n)}return``}function Sn(e,t=0){let[n,r]=(0,x.useState)(()=>typeof navigator>`u`||navigator.onLine!==!1);(0,x.useEffect)(()=>{let e=()=>r(navigator.onLine!==!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),e(),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]);let[i,a]=(0,x.useReducer)(_n,{sid:null,events:[],seen:new Set}),[o,s]=(0,x.useState)({sid:null,connected:!1}),c=(0,x.useRef)(e);return c.current=e,(0,x.useEffect)(()=>{if(a({kind:`reset`,sid:e}),s({sid:e,connected:!1}),!e)return;let t=!1,n=new AbortController,r=[],i,o=()=>{if(i=void 0,t||c.current!==e||r.length===0){r=[];return}let n=r;r=[],a({kind:`push-many`,sid:e,events:n})};E.events(e,120,n.signal).then(n=>{!t&&c.current===e&&a({kind:`seed`,sid:e,events:n})}).catch(()=>{});let l=ht(e,n=>{!t&&c.current===e&&(r.push(n),i===void 0&&(i=window.setTimeout(o,40)))},{replay:40,onOpen:()=>{!t&&c.current===e&&s({sid:e,connected:!0})},onClose:()=>{!t&&c.current===e&&s({sid:e,connected:!1})}});return()=>{t=!0,n.abort(),i!==void 0&&window.clearTimeout(i),r=[],l()}},[e,t]),{events:i.sid===e?i.events:[],connected:n&&o.sid===e&&o.connected}}function Cn(e,t,n){let r=!1;e.addEventListener(`vite:preloadError`,e=>{let i=e.payload,a=i instanceof Error?i.message:String(i??``);if(!/\/(?:pdf[.-]|pdfjs)[^/\s]*\.(?:m?js)(?:[?#\s]|$)/i.test(a)&&/failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed|loading chunk .+ failed|unable to preload css/i.test(a)){if(r){e.preventDefault();return}try{let e=n.storage(),t=`argus.stale-chunk-reloaded`;if(e.getItem(t)===n.buildId)return;e.setItem(t,n.buildId)}catch{return}e.preventDefault(),r=!0,t()}})}var wn=`modulepreload`,Tn=function(e,t){return new URL(e,t).href},En={},Dn=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Tn(t,n),t=s(t),t in En)return;En[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:wn,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},On=window.location.pathname===`/admin/data`||window.location.pathname.startsWith(`/admin/data/`),kn=(0,x.lazy)(()=>Dn(()=>import(`./App-DaQfrTdA.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)),An=(0,x.lazy)(()=>Dn(()=>import(`./WorkflowWorkbench-DLfSiGqy.js`),__vite__mapDeps([10,1,2,3,7,8]),import.meta.url)),jn=(0,x.lazy)(()=>Dn(()=>import(`./AdminDataApp-BonVgDiU.js`),__vite__mapDeps([11,1,2,3,6,4,5,12,13,8,14]),import.meta.url));Cn(window,()=>window.location.reload(),{buildId:_e,storage:()=>window.sessionStorage}),On||Re();var Mn=window.parent!==window;document.documentElement.dataset.argusEmbedded=String(Mn);var Nn=new ue({defaultOptions:{queries:{staleTime:3e3,retry:Qt,refetchOnWindowFocus:!1}}});function Pn(){let e=s({queryKey:[`api-meta`],queryFn:E.meta}),{locale:t}=Ot();return e.error?(0,D.jsxs)(`div`,{role:`alert`,className:`p-8`,children:[e.error.message,(0,D.jsx)(`button`,{className:`ml-4 underline`,onClick:()=>void e.refetch(),children:t===`zh-CN`?`重新连接`:`Reconnect`})]}):e.data?e.data.capabilities.includes(`application.workflows.v1`)&&new URLSearchParams(window.location.search).get(`legacy`)!==`1`?(0,D.jsx)(An,{}):(0,D.jsx)(kn,{}):(0,D.jsx)(`div`,{className:`p-8`,children:t===`zh-CN`?`正在连接…`:`Connecting…`})}function Fn(){let{locale:e}=Ot();return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(At,{}),(0,D.jsx)(kt,{locale:e,children:(0,D.jsx)(x.Suspense,{fallback:(0,D.jsx)(`div`,{className:`grid min-h-screen place-items-center text-sm text-ink-faint`,children:e===`zh-CN`?`正在加载工作台…`:`Loading workbench…`}),children:On?(0,D.jsx)(jn,{}):(0,D.jsx)(Pn,{})})})]})}(On?Promise.resolve():bt()).then(()=>de.createRoot(document.getElementById(`root`)).render((0,D.jsx)(x.StrictMode,{children:(0,D.jsx)(_,{client:Nn,children:(0,D.jsx)(O,{children:(0,D.jsx)(Fn,{})})})}))).catch(e=>{let t=document.getElementById(`root`);t.setAttribute(`role`,`alert`),t.textContent=`Cannot open workbench: ${e instanceof Error?e.message:String(e)}`});export{yt as A,nt as B,Lt as C,Mt as D,k as E,Be as F,ge as G,Ye as H,Ve as I,ae as J,fe as K,st as L,We as M,Fe as N,Tt as O,E as P,Ke as R,It as S,zt as T,Qe as U,tt as V,S as W,un as _,dn as a,Gt as b,sn as c,ln as d,on as f,an as g,nn as h,fn as i,Ge as j,Ot as k,Sn as l,rn as m,yn as n,mn as o,hn as p,he as q,xn as r,cn as s,Dn as t,pn as u,Ut as v,Ht as w,Bt as x,Ft as y,qe as z}; \ No newline at end of file diff --git a/frontend/web/dist/assets/markdown-BGG43fCg.js b/frontend/web/dist/assets/markdown-BGG43fCg.js new file mode 100644 index 000000000..d5d8a2a0a --- /dev/null +++ b/frontend/web/dist/assets/markdown-BGG43fCg.js @@ -0,0 +1,291 @@ +import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{_ as r,v as i}from"./icons-DHjcpj5P.js";function a(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function o(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var s=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,l={};function u(e,t){return((t||l).jsx?c:s).test(e)}var d=/[ \t\n\f\r]/g;function f(e){return typeof e==`object`?e.type===`text`&&p(e.value):p(e)}function p(e){return e.replace(d,``)===``}var m=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};m.prototype.normal={},m.prototype.property={},m.prototype.space=void 0;function h(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new m(n,r,t)}function g(e){return e.toLowerCase()}var _=class{constructor(e,t){this.attribute=t,this.property=e}};_.prototype.attribute=``,_.prototype.booleanish=!1,_.prototype.boolean=!1,_.prototype.commaOrSpaceSeparated=!1,_.prototype.commaSeparated=!1,_.prototype.defined=!1,_.prototype.mustUseProperty=!1,_.prototype.number=!1,_.prototype.overloadedBoolean=!1,_.prototype.property=``,_.prototype.spaceSeparated=!1,_.prototype.space=void 0;var v=e({boolean:()=>b,booleanish:()=>x,commaOrSpaceSeparated:()=>E,commaSeparated:()=>T,number:()=>C,overloadedBoolean:()=>S,spaceSeparated:()=>w}),y=0,b=ee(),x=ee(),S=ee(),C=ee(),w=ee(),T=ee(),E=ee();function ee(){return 2**++y}var D=Object.keys(v),te=class extends _{constructor(e,t,n,r){let i=-1;if(super(e,t),ne(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&he.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(me,ve);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!me.test(e)){let n=e.replace(pe,_e);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=te}return new i(r,t)}function _e(e){return`-`+e.toLowerCase()}function ve(e){return e.charAt(1).toUpperCase()}var ye=h([ie,se,le,ue,de],`html`),be=h([ie,ce,le,ue,de],`svg`);function xe(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Se(e){return e.join(` `).trim()}var Ce=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` +`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),we=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Ce());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Te=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Ee=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(we()),r=Te();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),De=ke(`end`),Oe=ke(`start`);function ke(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Ae(e){let t=Oe(e),n=De(e);if(t&&n)return{start:t,end:n}}function je(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ne(e.position):`start`in e||`end`in e?Ne(e):`line`in e||`column`in e?Me(e):``}function Me(e){return Pe(e&&e.line)+`:`+Pe(e&&e.column)}function Ne(e){return Me(e&&e.start)+`-`+Me(e&&e.end)}function Pe(e){return e&&typeof e==`number`?e:1}var Fe=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let 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=r,this.line=o?o.line:void 0,this.name=je(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}};Fe.prototype.file=``,Fe.prototype.name=``,Fe.prototype.reason=``,Fe.prototype.message=``,Fe.prototype.stack=``,Fe.prototype.column=void 0,Fe.prototype.line=void 0,Fe.prototype.ancestors=void 0,Fe.prototype.cause=void 0,Fe.prototype.fatal=void 0,Fe.prototype.place=void 0,Fe.prototype.ruleId=void 0,Fe.prototype.source=void 0;var Ie=t(Ee(),1),Le={}.hasOwnProperty,Re=new Map,ze=/[A-Z]/g,Be=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Ve=new Set([`td`,`th`]);function He(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=$e(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Qe(n,t.jsx,t.jsxs)}let i={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`?be:ye,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Ue(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Ue(e,t,n){if(t.type===`element`)return We(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ge(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return qe(e,t,n);if(t.type===`mdxjsEsm`)return Ke(e,t);if(t.type===`root`)return Je(e,t,n);if(t.type===`text`)return Ye(e,t)}function We(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=be,e.schema=i),e.ancestors.push(t);let a=at(e,t.tagName,!1),o=et(e,t),s=nt(e,t);return Be.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!f(e)})),Xe(e,o,a,t),Ze(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ge(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}ot(e,t.position)}function Ke(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ot(e,t.position)}function qe(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=be,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:at(e,t.name,!0),o=tt(e,t),s=nt(e,t);return Xe(e,o,a,t),Ze(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Je(e,t,n){let r={};return Ze(r,nt(e,t)),e.create(t,e.Fragment,r,n)}function Ye(e,t){return t.value}function Xe(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ze(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Qe(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function $e(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Oe(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function et(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Le.call(t.properties,i)){let a=rt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Ve.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function tt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ot(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else ot(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function nt(e,t){let n=[],r=-1,i=e.passKeys?new Map:Re;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(vt(e,e.length,0,t),e):t}var bt={}.hasOwnProperty;function xt(e){let t={},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 Tt(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Et=Ft(/[A-Za-z]/),Dt=Ft(/[\dA-Za-z]/),Ot=Ft(/[#-'*+\--9=?A-Z^-~]/);function kt(e){return e!==null&&(e<32||e===127)}var At=Ft(/\d/),jt=Ft(/[\dA-Fa-f]/),Mt=Ft(/[!-/:-@[-`{-~]/);function O(e){return e!==null&&e<-2}function k(e){return e!==null&&(e<0||e===32)}function A(e){return e===-2||e===-1||e===32}var Nt=Ft(/\p{P}|\p{S}/u),Pt=Ft(/\s/);function Ft(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function It(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function j(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return A(r)?(e.enter(n),s(r)):t(r)}function s(r){return A(r)&&a++o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ht(e,t,n){return j(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Ut(e){if(e===null||k(e)||Pt(e))return 1;if(Nt(e))return 2}function Wt(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Jt(d,-c),Jt(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=yt(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=yt(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=yt(l,Wt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=yt(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=yt(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,vt(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n0&&A(t)?j(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||O(t)?e.check(cn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||O(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),A(t)?j(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),A(t)?j(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||O(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function dn(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var fn={name:`codeIndented`,tokenize:mn},pn={partial:!0,tokenize:hn};function mn(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),j(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):O(t)?e.attempt(pn,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||O(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function hn(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):O(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):j(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):O(e)?i(e):n(e)}}var gn={name:`codeText`,previous:vn,resolve:_n,tokenize:yn};function _n(e){let t=e.length-4,n=3,r,i;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 RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&xn(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),xn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),xn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function kn(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||kt(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||O(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||k(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):O(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||O(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!A(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function jn(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):O(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||O(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Mn(e,t){let n;return r;function r(i){return O(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):A(i)?j(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Nn={name:`definition`,tokenize:Fn},Pn={partial:!0,tokenize:In};function Fn(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return An.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Tt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return k(t)?Mn(e,l)(t):l(t)}function l(t){return kn(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Pn,d,d)(t)}function d(t){return A(t)?j(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||O(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function In(e,t,n){return r;function r(t){return k(t)?Mn(e,i)(t):n(t)}function i(t){return jn(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return A(t)?j(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||O(e)?t(e):n(e)}}var Ln={name:`hardBreakEscape`,tokenize:Rn};function Rn(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return O(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var zn={name:`headingAtx`,resolve:Bn,tokenize:Vn};function Bn(e,t){let n=e.length-2,r=3,i,a;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&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},vt(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Vn(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||k(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||O(n)?(e.exit(`atxHeading`),t(n)):A(n)?j(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||k(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Hn=`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`.split(`.`),Un=[`pre`,`script`,`style`,`textarea`],Wn={concrete:!0,name:`htmlFlow`,resolveTo:qn,tokenize:Jn},Gn={partial:!0,tokenize:Xn},Kn={partial:!0,tokenize:Yn};function qn(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 Jn(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):Et(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Et(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return Et(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||k(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Un.includes(l)?(i=1,r.interrupt?t(s):D(s)):Hn.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Dt(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return A(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Et(t)?(e.consume(t),b):A(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Dt(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):A(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):A(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||O(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||k(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||A(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||O(t)?D(t):A(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),ie):t===60&&i===1?(e.consume(t),ae):t===62&&i===4?(e.consume(t),le):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):O(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Gn,ue,te)(t)):t===null||O(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),D)}function te(t){return e.check(Kn,ne,ue)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||O(t)?te(t):(e.enter(`htmlFlowData`),D(t))}function ie(t){return t===45?(e.consume(t),ce):D(t)}function ae(t){return t===47?(e.consume(t),o=``,oe):D(t)}function oe(t){if(t===62){let n=o.toLowerCase();return Un.includes(n)?(e.consume(t),le):D(t)}return Et(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):D(t)}function se(t){return t===93?(e.consume(t),ce):D(t)}function ce(t){return t===62?(e.consume(t),le):t===45&&i===2?(e.consume(t),ce):D(t)}function le(t){return t===null||O(t)?(e.exit(`htmlFlowData`),ue(t)):(e.consume(t),le)}function ue(n){return e.exit(`htmlFlow`),t(n)}}function Yn(e,t,n){let r=this;return i;function i(t){return O(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Xn(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Zt,t,n)}}var Zn={name:`htmlText`,tokenize:Qn};function Qn(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Et(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Et(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):O(t)?(o=d,ae(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ie(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):O(t)?(o=h,ae(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ie(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ie(t):O(t)?(o=v,ae(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):O(t)?(o=y,ae(t)):(e.consume(t),y)}function b(e){return e===62?ie(e):y(e)}function x(t){return Et(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Dt(t)?(e.consume(t),S):C(t)}function C(t){return O(t)?(o=C,ae(t)):A(t)?(e.consume(t),C):ie(t)}function w(t){return t===45||Dt(t)?(e.consume(t),w):t===47||t===62||k(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ie):t===58||t===95||Et(t)?(e.consume(t),E):O(t)?(o=T,ae(t)):A(t)?(e.consume(t),T):ie(t)}function E(t){return t===45||t===46||t===58||t===95||Dt(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):O(t)?(o=ee,ae(t)):A(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,te):O(t)?(o=D,ae(t)):A(t)?(e.consume(t),D):(e.consume(t),ne)}function te(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):O(t)?(o=te,ae(t)):(e.consume(t),te)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||k(t)?T(t):(e.consume(t),ne)}function re(e){return e===47||e===62||k(e)?T(e):n(e)}function ie(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ae(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return A(t)?j(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}var $n={name:`labelEnd`,resolveAll:rr,resolveTo:ir,tokenize:ar},er={tokenize:or},tr={tokenize:sr},nr={tokenize:cr};function rr(e){let t=-1,n=[];for(;++t=3&&(a===null||O(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),A(t)?j(e,s,`whitespace`)(t):s(t))}}var _r={continuation:{tokenize:xr},exit:Cr,name:`list`,tokenize:br},vr={partial:!0,tokenize:wr},yr={partial:!0,tokenize:Sr};function br(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:At(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(hr,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return At(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Zt,r.interrupt?n:u,e.attempt(vr,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return A(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function xr(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Zt,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,j(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!A(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(yr,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,j(e,e.attempt(_r,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Sr(e,t,n){let r=this;return j(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Cr(e){e.exit(this.containerState.type)}function wr(e,t,n){let r=this;return j(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!A(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Tr={name:`setextUnderline`,resolveTo:Er,tokenize:Dr};function Er(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Dr(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),A(t)?j(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||O(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Or={tokenize:kr};function kr(e){let t=this,n=e.attempt(Zt,r,e.attempt(this.parser.constructs.flowInitial,i,j(e,e.attempt(this.parser.constructs.flow,i,e.attempt(wn,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Ar={resolveAll:Pr()},jr=Nr(`string`),Mr=Nr(`text`);function Nr(e){return{resolveAll:Pr(e===`text`?Fr:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iWr,contentInitial:()=>Rr,disable:()=>Gr,document:()=>Lr,flow:()=>Br,flowInitial:()=>zr,insideSpan:()=>Ur,string:()=>Vr,text:()=>Hr}),Lr={42:_r,43:_r,45:_r,48:_r,49:_r,50:_r,51:_r,52:_r,53:_r,54:_r,55:_r,56:_r,57:_r,62:$t},Rr={91:Nn},zr={[-2]:fn,[-1]:fn,32:fn},Br={35:zn,42:hr,45:[Tr,hr],60:Wn,61:Tr,95:hr,96:ln,126:ln},Vr={38:on,92:rn},Hr={[-5]:pr,[-4]:pr,[-3]:pr,33:lr,38:on,42:Gt,60:[Yt,Zn],91:dr,92:[Ln,rn],93:$n,95:Gt,96:gn},Ur={null:[Gt,Ar]},Wr={null:[42,95]},Gr={null:[]};function Kr(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=yt(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Wt(a,l.events,l),l.events):[]}function f(e,t){return Jr(p(e),t)}function p(e){return qr(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Jr(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||ci).call(a,void 0,e[0])}for(r.position={start:ai(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ai(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function pi(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mi(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hi(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=It(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function gi(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _i(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function vi(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function yi(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vi(e,t);let i={src:It(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function bi(e,t){let n={src:It(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function xi(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Si(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vi(e,t);let i={href:It(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Ci(e,t){let n={href:It(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wi(e,t,n){let r=e.all(t),i=n?Ti(n):Ei(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s1}function Di(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Oe(t.children[1]),o=De(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Mi(e,t,n){let 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,s=-1,c=[];for(;++s0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Li(t.slice(i),i>0,!1)),a.join(``)}function Li(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Pi||t===Fi;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Pi||t===Fi;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Ri(e,t){let n={type:`text`,value:Ii(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function zi(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Bi={blockquote:ui,break:di,code:fi,delete:pi,emphasis:mi,footnoteReference:hi,heading:gi,html:_i,imageReference:yi,image:bi,inlineCode:xi,linkReference:Si,link:Ci,listItem:wi,list:Di,paragraph:Oi,root:ki,strong:Ai,table:ji,tableCell:Ni,tableRow:Mi,text:Ri,thematicBreak:zi,toml:Vi,yaml:Vi,definition:Vi,footnoteDefinition:Vi};function Vi(){}var Hi=typeof self==`object`?self:globalThis,Ui=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new Hi[e](t)},Wi=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof Hi[e]==`function`?Ui(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(Ui(a,o),i)};return r},Gi=e=>Wi(new Map,e)(0),Ki=``,{toString:qi}={},{keys:Ji}=Object,Yi=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=qi.call(e).slice(8,-1);switch(n){case`Array`:return[1,Ki];case`Object`:return[2,Ki];case`Date`:return[3,Ki];case`RegExp`:return[4,Ki];case`Map`:return[5,Ki];case`Set`:return[6,Ki];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},Xi=([e,t])=>e===0&&(t===`function`||t===`symbol`),Zi=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Yi(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Ji(r))(e||!Xi(Yi(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?Ki:r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(Xi(Yi(n))||Xi(Yi(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Xi(Yi(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},Qi=(e,{json:t,lossy:n}={})=>{let r=[];return Zi(!(t||n),!!t,new Map,r)(e),r},$i=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Gi(Qi(e,t)):structuredClone(e):(e,t)=>Gi(Qi(e,t));function ea(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function ta(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function na(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||ea,r=e.options.footnoteBackLabel||ta,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...$i(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:` +`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:` +`}]}}var ra=(function(e){if(e==null)return ca;if(typeof e==`function`)return sa(e);if(typeof e==`object`)return Array.isArray(e)?ia(e):aa(e);if(typeof e==`string`)return oa(e);throw Error(`Expected function, string, or object as test`)});function ia(e){let t=[],n=-1;for(;++n`:``))+`)`})}return u;function u(){let l=da,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=ma(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d0&&n.push({type:`text`,value:` +`}),n}function Ca(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function wa(e,t){let n=va(e,t),r=n.one(e,void 0),i=na(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:` +`},i)),a}function Ta(e,t){return e&&`run`in e?async function(n,r){let i=wa(n,{file:r,...t});await e.run(i,r)}:function(n,r){return wa(n,{file:r,...e||t})}}function Ea(e){if(e)throw e}var Da=t(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var ja={basename:Ma,dirname:Na,extname:Pa,join:Fa,sep:`/`};function Ma(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Ra(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Na(e){if(Ra(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||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Pa(e){Ra(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Fa(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function La(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Ra(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var za={cwd:Ba};function Ba(){return`/`}function Va(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Ha(e){if(typeof e==`string`)e=new URL(e);else if(!Va(e)){let t=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:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Ua(e)}function Ua(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];Oa(o)&&Oa(r)&&(r=(0,Da.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function $a(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function eo(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function to(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function no(e){if(!Oa(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function ro(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function io(e){return ao(e)?e:new Ga(e)}function ao(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function oo(e){return typeof e==`string`||so(e)}function so(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var co=r();i();var lo=[],uo={allowDangerousHtml:!0},fo=/^(https?|ircs?|mailto|xmpp)$/i,po=[{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:`className`,id:`remove-classname`},{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 mo(e){let t=ho(e),n=go(e);return _o(t.runSync(t.parse(n),n),e)}function ho(e){let t=e.rehypePlugins||lo,n=e.remarkPlugins||lo,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...uo}:uo;return Qa().use(li).use(n).use(Ta,r).use(t)}function go(e){let t=e.children||``,n=new Ga;return typeof t==`string`?n.value=t:``+t,n}function _o(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||vo;for(let e of po)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return ha(e,l),He(e,{Fragment:co.Fragment,components:i,ignoreInvalidStyle:!0,jsx:co.jsx,jsxs:co.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in ut)if(Object.hasOwn(ut,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=ut[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function vo(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||fo.test(e.slice(0,t))?e:``}function yo(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function bo(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function xo(e,t,n){let r=ra((n||{}).ignore||[]),i=So(t),a=-1;for(;++a0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=yo(e,`(`),a=yo(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Bo(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Pt(n)||Nt(n))&&(!t||n!==47)}Xo.peek=Yo;function Vo(){this.buffer()}function Ho(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Uo(){this.buffer()}function Wo(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Go(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Tt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ko(e){this.exit(e)}function qo(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Tt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Jo(e){this.exit(e)}function Yo(){return`[`}function Xo(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Zo(){return{enter:{gfmFootnoteCallString:Vo,gfmFootnoteCall:Ho,gfmFootnoteDefinitionLabelString:Uo,gfmFootnoteDefinition:Wo},exit:{gfmFootnoteCallString:Go,gfmFootnoteCall:Ko,gfmFootnoteDefinitionLabelString:qo,gfmFootnoteDefinition:Jo}}}function Qo(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Xo},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?` +`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?es:$o))),s(),o}}function $o(e,t,n){return t===0?e:es(e,t,n)}function es(e,t,n){return(n?``:` `)+e}var ts=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];os.peek=ss;function ns(){return{canContainEols:[`delete`],enter:{strikethrough:is},exit:{strikethrough:as}}}function rs(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:ts}],handlers:{delete:os}}}function is(e){this.enter({type:`delete`,children:[]},e)}function as(e){this.exit(e)}function os(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function ss(){return`~`}function cs(e){return e.length}function ls(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||cs,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++ul&&(l=e[u].length);++ac[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++dc[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),ps);return i(),o}function ps(e,t,n){return`>`+(n?``:` `)+e}function ms(e,t){return hs(e,t.inConstruct,!0)&&!hs(e,t.notInConstruct,!1)}function hs(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ro&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function vs(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 ys(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function bs(e,t,n,r){let i=ys(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(vs(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,xs);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(_s(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:` +`,encode:["`"],...s.current()})),t()}return u+=s.move(` +`),a&&(u+=s.move(a+` +`)),u+=s.move(c),l(),u}function xs(e,t,n){return(n?``:` `)+e}function Ss(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Cs(e,t,n,r){let i=Ss(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:` +`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function ws(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ts(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function Es(e,t,n){let r=Ut(e),i=Ut(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ds.peek=Os;function Ds(e,t,n,r){let i=ws(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Es(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Ts(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Es(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Ts(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Os(e,t,n){return n.options.emphasis||`*`}function ks(e,t){let n=!1;return ha(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&ft(e)&&(t.options.setext||n))}function As(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(ks(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:` +`,after:` +`});return r(),t(),o+` +`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(` +`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:` +`,...a.current()});return/^[\t ]/.test(l)&&(l=Ts(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}js.peek=Ms;function js(e){return e.value||``}function Ms(){return`<`}Ns.peek=Ps;function Ns(e,t,n,r){let i=Ss(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Ps(){return`!`}Fs.peek=Is;function Fs(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Is(){return`!`}Ls.peek=Rs;function Ls(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}Bs.peek=Vs;function Bs(e,t,n,r){let i=Ss(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(zs(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Vs(e,t,n){return zs(e,n)?`<`:`[`}Hs.peek=Us;function Hs(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Us(){return`[`}function Ws(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Gs(e){let t=Ws(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Ks(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function qs(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Js(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Ks(n):Ws(n),s=e.ordered?o===`.`?`)`:`.`:Gs(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.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),qs(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Zs(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var Qs=ra([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function $s(e,t,n,r){return(e.children.some(function(e){return Qs(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function ec(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}tc.peek=nc;function tc(e,t,n,r){let i=ec(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Es(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Ts(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Es(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Ts(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function nc(e,t,n){return n.options.strong||`*`}function rc(e,t,n,r){return n.safe(e.value,r)}function ic(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function ac(e,t,n){let r=(qs(n)+(n.options.ruleSpaces?` `:``)).repeat(ic(n));return n.options.ruleSpaces?r.slice(0,-1):r}var oc={blockquote:fs,break:gs,code:bs,definition:Cs,emphasis:Ds,hardBreak:gs,heading:As,html:js,image:Ns,imageReference:Fs,inlineCode:Ls,link:Bs,linkReference:Hs,list:Js,listItem:Xs,paragraph:Zs,root:$s,strong:tc,text:rc,thematicBreak:ac};function sc(){return{enter:{table:cc,tableData:fc,tableHeader:fc,tableRow:uc},exit:{codeText:pc,table:lc,tableData:dc,tableHeader:dc,tableRow:dc}}}function cc(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function lc(e){this.exit(e),this.data.inTable=void 0}function uc(e){this.enter({type:`tableRow`,children:[]},e)}function dc(e){this.exit(e)}function fc(e){this.enter({type:`tableCell`,children:[]},e)}function pc(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,mc));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function mc(e,t){return t===`|`?t:e}function hc(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=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:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(` +`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return ls(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var qc={tokenize:tl,partial:!0};function Jc(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Qc,continuation:{tokenize:$c},exit:el}},text:{91:{name:`gfmFootnoteCall`,tokenize:Zc},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Yc,resolveTo:Xc}}}}function Yc(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Tt(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Xc(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`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Zc(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||k(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Tt(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return k(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Qc(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||k(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Tt(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return k(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),j(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function $c(e,t,n){return e.check(Zt,t,e.attempt(qc,t,n))}function el(e){e.exit(`gfmFootnoteDefinition`)}function tl(e,t,n){let r=this;return j(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function nl(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Ut(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var rl=class{constructor(){this.map=[]}add(e,t,n){il(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function il(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):O(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):A(t)?j(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||k(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,A(t)?j(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return A(t)?j(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||O(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return A(t)?j(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||O(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||O(n)?(e.exit(`tableRow`),t(n)):A(n)?j(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||k(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function cl(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new rl;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},dl(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function ul(e,t,n,r,i){let a=[],o=dl(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function dl(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var fl={name:`tasklistCheck`,tokenize:ml};function pl(){return{text:{91:fl}}}function ml(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return k(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return O(r)?t(r):A(r)?e.check({tokenize:hl},t,n)(r):n(r)}}function hl(e,t,n){return j(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function gl(e){return xt([Mc(),Jc(),nl(e),ol(),pl()])}var _l={};function vl(e){let t=this,n=e||_l,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(gl(n)),a.push(xc()),o.push(Sc(n))}function yl(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:s,mathText:o,mathTextData:s}};function e(e){this.enter({type:`math`,meta:null,value:``,data:{hName:`pre`,hChildren:[{type:`element`,tagName:`code`,properties:{className:[`language-math`,`math-display`]},children:[]}]}},e)}function t(){this.buffer()}function n(){let e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;let r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:`text`,value:t}),this.data.mathFlowInside=void 0}function a(e){this.enter({type:`inlineMath`,value:``,data:{hName:`code`,hProperties:{className:[`language-math`,`math-inline`]},hChildren:[]}},e),this.buffer()}function o(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t,n.data.hChildren.push({type:`text`,value:t})}function s(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}function bl(e){let t=(e||{}).singleDollarTextMath;return t??=!0,r.peek=i,{unsafe:[{character:`\r`,inConstruct:`mathFlowMeta`},{character:` +`,inConstruct:`mathFlowMeta`},{character:`$`,after:t?void 0:`\\$`,inConstruct:`phrasing`},{character:`$`,inConstruct:`mathFlowMeta`},{atBreak:!0,character:`$`,after:`\\$`}],handlers:{math:n,inlineMath:r}};function n(e,t,n,r){let i=e.value||``,a=n.createTracker(r),o=`$`.repeat(Math.max(_s(i,`$`)+1,2)),s=n.enter(`mathFlow`),c=a.move(o);if(e.meta){let t=n.enter(`mathFlowMeta`);c+=a.move(n.safe(e.meta,{after:` +`,before:c,encode:[`$`],...a.current()})),t()}return c+=a.move(` +`),i&&(c+=a.move(i+` +`)),c+=a.move(o),s(),c}function r(e,n,r){let i=e.value||``,a=1;for(t||a++;RegExp(`(^|[^$])`+`\\$`.repeat(a)+`([^$]|$)`).test(i);)a++;let o=`$`.repeat(a);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` `+i+` `);let s=-1;for(;++sl&&(l=e):e&&(l!==void 0&&l>-1&&c.push(` +`.repeat(l)||` `),l=-1,c.push(e))}return c.join(``)}function Cu(e,t,n){return e.type===`element`?wu(e,t,n):e.type===`text`?n.whitespace===`normal`?Tu(e,n):Eu(e):[]}function wu(e,t,n){let r=Ou(e,n),i=e.children||[],a=-1,o=[];if(bu(e))return o;let s,c;for(gu(e)||yu(e)&&su(t,e,yu)?c=` +`:vu(e)?(s=2,c=2):xu(e)&&(s=1,c=1);++a15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15e.replace(Mu,`-$1`).toLowerCase(),Pu={"&":`&`,">":`>`,"<":`<`,'"':`"`,"'":`'`},Fu=/[&><"']/g,Iu=e=>String(e).replace(Fu,e=>Pu[e]),Lu=e=>e.type===`ordgroup`||e.type===`color`?e.body.length===1?Lu(e.body[0]):e:e.type===`font`?Lu(e.body):e,Ru=new Set([`mathord`,`textord`,`atom`]),zu=e=>Ru.has(Lu(e).type),Bu=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},Vu={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format `},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color `,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro `,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness `,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size `,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand `,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}};function Hu(e){if(typeof e!=`string`)return e.enum[0];switch(e){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{};default:throw Error(`Unexpected schema type; settings must declare an explicit default.`)}}function Uu(e){return e.default===void 0?Hu(Array.isArray(e.type)?e.type[0]:e.type):e.default}function Wu(e,t,n,r){var i=n[t];e[t]=i===void 0?Uu(r):r.processor?r.processor(i):i}var Gu=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={};for(var t of Object.keys(Vu)){var n=Vu[t];n&&Wu(this,t,e,n)}}reportNonstrict(e,t,n){var r=this.strict;if(typeof r==`function`&&(r=r(e,t,n)),!(!r||r===`ignore`)){if(r===!0||r===`error`)throw new M(`LaTeX-incompatible input and strict mode is set to 'error': `+(t+` [`+e+`]`),n);r===`warn`?typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)):typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`))}}useStrictBehavior(e,t,n){var r=this.strict;if(typeof r==`function`)try{r=r(e,t,n)}catch{r=`error`}return!r||r===`ignore`?!1:r===!0||r===`error`?!0:r===`warn`?(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)),!1):(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`)),!1)}isTrusted(e){if(`url`in e&&e.url&&!e.protocol){var t=Bu(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},Ku=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return td[nd[this.id]]}sub(){return td[rd[this.id]]}fracNum(){return td[id[this.id]]}fracDen(){return td[ad[this.id]]}cramp(){return td[od[this.id]]}text(){return td[sd[this.id]]}isTight(){return this.size>=2}},qu=0,Ju=1,Yu=2,Xu=3,Zu=4,Qu=5,$u=6,ed=7,td=[new Ku(qu,0,!1),new Ku(Ju,0,!0),new Ku(Yu,1,!1),new Ku(Xu,1,!0),new Ku(Zu,2,!1),new Ku(Qu,2,!0),new Ku($u,3,!1),new Ku(ed,3,!0)],nd=[Zu,Qu,Zu,Qu,$u,ed,$u,ed],rd=[Qu,Qu,Qu,Qu,ed,ed,ed,ed],id=[Yu,Xu,Zu,Qu,$u,ed,$u,ed],ad=[Xu,Xu,Qu,Qu,ed,ed,ed,ed],od=[Ju,Ju,Xu,Xu,Qu,Qu,ed,ed],sd=[qu,Ju,Yu,Xu,Yu,Xu,Yu,Xu],N={DISPLAY:td[qu],TEXT:td[Yu],SCRIPT:td[Zu],SCRIPTSCRIPT:td[$u]},cd=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}];function ld(e){for(var t=0;t=i[0]&&e<=i[1])return n.name}return null}var ud=[];cd.forEach(e=>e.blocks.forEach(e=>ud.push(...e)));function dd(e){for(var t=0;t=ud[t]&&e<=ud[t+1])return!0;return!1}var fd=e=>e+` `+e,pd=80,md=function(e,t){return`M95,`+(622+e+t)+` +c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 +c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 +c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 +s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 +c69,-144,104.5,-217.7,106.5,-221 +l`+e/2.075+` -`+e+` +c5.3,-9.3,12,-14,20,-14 +H400000v`+(40+e)+`H845.2724 +s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 +c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z +M`+(834+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},hd=function(e,t){return`M263,`+(601+e+t)+`c0.7,0,18,39.7,52,119 +c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 +c340,-704.7,510.7,-1060.3,512,-1067 +l`+e/2.084+` -`+e+` +c4.7,-7.3,11,-11,19,-11 +H40000v`+(40+e)+`H1012.3 +s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 +c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 +s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 +c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z +M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},gd=function(e,t){return`M983 `+(10+e+t)+` +l`+e/3.13+` -`+e+` +c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+` +H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 +s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 +c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 +c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 +c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 +c53.7,-170.3,84.5,-266.8,92.5,-289.5z +M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},_d=function(e,t){return`M424,`+(2398+e+t)+` +c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 +c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 +s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 +s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 +l`+e/4.223+` -`+e+`c4,-6.7,10,-10,18,-10 H400000 +v`+(40+e)+`H1014.6 +s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 +c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+` `+t+` +h400000v`+(40+e)+`h-400000z`},vd=function(e,t){return`M473,`+(2713+e+t)+` +c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+` -`+e+` +c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7 +s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 +c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 +s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, +606zM`+(1001+e)+` `+t+`h400000v`+(40+e)+`H1017.7z`},yd=function(e){var t=e/2;return`M400000 `+e+` H0 L`+t+` 0 l65 45 L145 `+(e-80)+` H400000z`},bd=function(e,t,n){var r=n-54-t-e;return`M702 `+(e+t)+`H400000`+(40+e)+` +H742v`+r+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 +h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 +c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 +219 661 l218 661zM702 `+t+`H400000v`+(40+e)+`H742z`},xd=function(e,t,n){t=1e3*t;var r=``;switch(e){case`sqrtMain`:r=md(t,pd);break;case`sqrtSize1`:r=hd(t,pd);break;case`sqrtSize2`:r=gd(t,pd);break;case`sqrtSize3`:r=_d(t,pd);break;case`sqrtSize4`:r=vd(t,pd);break;case`sqrtTall`:r=bd(t,pd,n)}return r},Sd=function(e,t){switch(e){case`⎜`:return fd(`M291 0 H417 V`+t+` H291z`);case`∣`:return fd(`M145 0 H188 V`+t+` H145z`);case`∥`:return fd(`M145 0 H188 V`+t+` H145z`)+fd(`M367 0 H410 V`+t+` H367z`);case`⎟`:return fd(`M457 0 H583 V`+t+` H457z`);case`⎢`:return fd(`M319 0 H403 V`+t+` H319z`);case`⎥`:return fd(`M263 0 H347 V`+t+` H263z`);case`⎪`:return fd(`M384 0 H504 V`+t+` H384z`);case`⏐`:return fd(`M312 0 H355 V`+t+` H312z`);case`‖`:return fd(`M257 0 H300 V`+t+` H257z`)+fd(`M478 0 H521 V`+t+` H478z`);default:return``}},Cd={doubleleftarrow:`M262 157 +l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 + 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 + 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 +c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 + 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 +-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 +-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z +m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l +-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 + 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 +-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 +-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 +-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 +c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 +-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 + 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 +-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 +c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 + 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 + 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 + l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 +-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 + 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 + 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 + 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 +-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 +H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 + 435 0h399565z`,leftgroupunder:`M400000 262 +H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 + 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 +-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 +-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 +-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 + 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 +-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 +-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z +m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 + 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 + 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 +-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 + 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 +-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 +v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 +-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 +-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 + 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:fd(`M40 281 V428 H0 V94 H40 V241 H400000 v40z`),leftbracketunder:fd(`M0 0 h120 V290 H399995 v120 H0z`),leftbracketover:fd(`M0 440 h120 V150 H399995 v-120 H0z`),leftmapsto:fd(`M40 281 V448H0V74H40V241H400000v40z`),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 +-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 +c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 + 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:fd(`M0 50 h400000 v40H0z m0 194h40000v40H0z`),midbrace:`M200428 334 +c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 +-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 + 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 + 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 +c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 + 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 + 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 +-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 +-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z +m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 +60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 +-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z +m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 +c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 +-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z +m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 +85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 +-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z +m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 +c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 +-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 + 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 + 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 +-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 + 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l +-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 +s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 +c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 + 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 +-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 + 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 + 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 +-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 +-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 + 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 +-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 + 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z +m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 + 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 +-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 +-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 + 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 + 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 +-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z +m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 + 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 +-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 + 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:fd(`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`),rightbracketunder:fd(`M399995 0 h-120 V290 H0 v120 H400000z`),rightbracketover:fd(`M399995 440 h-120 V150 H0 v-120 H399995z`),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 + 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 +-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 +-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 + 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 +-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 +-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 +-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 + 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 +c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 + 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 + 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 +-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 + 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 +-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 + 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 + 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 +-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 +-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 + 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 +c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 + 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 +-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 + 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 + 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 + -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 +-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 + 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 + 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 + -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 +3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 +10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 +-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 +-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 +H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 +c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 +c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, +-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 +c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 +c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 +s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 +121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 +s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 +c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z +M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 +-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 +13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 +-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 +-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 +151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 +c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 +c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 +c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z +M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, +1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, +-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z +M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},wd=function(e,t){switch(e){case`lbrack`:return`M403 1759 V84 H666 V0 H319 V1759 v`+t+` v1759 v84 h347 v-84 +H403z M403 1759 V0 H319 V1759 v`+t+` v1759 v84 h84z`;case`rbrack`:return`M347 1759 V0 H0 V84 H263 V1759 v`+t+` v1759 H0 v84 H347z +M347 1759 V0 H263 V1759 v`+t+` v1759 h84z`;case`vert`:return`M145 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+` v585 h43z`;case`doublevert`:return`M145 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+` v585 h43z +M367 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+t+` v585 h43z`;case`lfloor`:return`M319 602 V0 H403 V602 v`+t+` v1715 h263 v84 H319z +MM319 602 V0 H403 V602 v`+t+` v1715 H319z`;case`rfloor`:return`M319 602 V0 H403 V602 v`+t+` v1799 H0 v-84 H319z +MM319 602 V0 H403 V602 v`+t+` v1715 H319z`;case`lceil`:return`M403 1759 V84 H666 V0 H319 V1759 v`+t+` v602 h84z +M403 1759 V0 H319 V1759 v`+t+` v602 h84z`;case`rceil`:return`M347 1759 V0 H0 V84 H263 V1759 v`+t+` v602 h84z +M347 1759 V0 h-84 V1759 v`+t+` v602 h84z`;case`lparen`:return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 +c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, +-36,557 l0,`+(t+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, +949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 +c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, +-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 +l0,-`+(t+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, +-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case`rparen`:return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, +63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 +c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(t+9)+` +c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 +c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 +c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 +c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 +l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw Error(`Unknown stretchy delimiter.`)}};function Td(e){return`toText`in e}var Ed=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t{if(Td(e))return e.toText();throw Error(`Expected MathDomNode with toText, got `+e.constructor.name)}).join(``)}},Dd={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Od={ex:!0,em:!0,mu:!0},kd=function(e){return typeof e!=`string`&&(e=e.unit),e in Dd||e in Od||e===`ex`},Ad=function(e,t){var n;if(e.unit in Dd)n=Dd[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit===`mu`)n=t.fontMetrics().cssEmPerMu;else{var r=t.style.isTight()?t.havingStyle(t.style.text()):t;if(e.unit===`ex`)n=r.fontMetrics().xHeight;else if(e.unit===`em`)n=r.fontMetrics().quad;else throw new M(`Invalid unit: '`+e.unit+`'`);r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},P=function(e){return+e.toFixed(4)+`em`},jd=function(e){return e.filter(e=>e).join(` `)},Md=function(e){var t=``;for(var n of Object.keys(e)){var r=e[n];r!==void 0&&(t+=Nu(n)+`:`+r+`;`)}return t},Nd=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push(`mtight`);var r=t.getColor();r&&(this.style.color=r)}},Pd=function(e){var t=document.createElement(e);t.className=jd(this.classes),Object.assign(t.style,this.style);for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);for(var r=0;r/=\x00-\x1f]/,Id=function(e){var t=`<`+e;this.classes.length&&(t+=` class="`+Iu(jd(this.classes))+`"`);var n=Md(this.style);n&&(t+=` style="`+Iu(n)+`"`);for(var r of Object.keys(this.attributes)){if(Fd.test(r))throw new M(`Invalid attribute name '`+r+`'`);t+=` `+r+`="`+Iu(this.attributes[r])+`"`}t+=`>`;for(var i=0;i`,t},Ld=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,Nd.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Pd.call(this,`span`)}toMarkup(){return Id.call(this,`span`)}},Rd=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Nd.call(this,t,r),this.children=n||[],this.setAttribute(`href`,e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Pd.call(this,`a`)}toMarkup(){return Id.call(this,`a`)}},zd=class{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=[`mord`],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement(`img`);return e.src=this.src,e.alt=this.alt,e.className=`mord`,Object.assign(e.style,this.style),e}toMarkup(){var e=``+Iu(this.alt)+``,e}},Bd={î:`ı̂`,ï:`ı̈`,í:`ı́`,ì:`ı̀`},Vd=class{constructor(e,t,n,r,i,a,o,s){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=i||0,this.width=a||0,this.classes=o||[],this.style=s||{},this.maxFontSize=0;var c=ld(this.text.charCodeAt(0));c&&this.classes.push(c+`_fallback`),/[îïíì]/.test(this.text)&&(this.text=Bd[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;return this.italic>0&&(t=document.createElement(`span`),t.style.marginRight=P(this.italic)),this.classes.length>0&&(t||=document.createElement(`span`),t.className=jd(this.classes)),Object.keys(this.style).length>0&&(t||=document.createElement(`span`),Object.assign(t.style,this.style)),t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t=`0&&(n+=`margin-right:`+P(this.italic)+`;`),n+=Md(this.style),n&&(e=!0,t+=` style="`+Iu(n)+`"`);var r=Iu(this.text);return e?(t+=`>`,t+=r,t+=``,t):r}},Hd=class{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);for(var n=0;n`;for(var n=0;n`,e}},Ud=class{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return this.alternate?e.setAttribute(`d`,this.alternate):e.setAttribute(`d`,Cd[this.pathName]),e}toMarkup(){return this.alternate?``:``}},Wd=class{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e=``,e}};function Gd(e){if(e instanceof Vd)return e;throw Error(`Expected symbolNode but got `+String(e)+`.`)}function Kd(e){if(e instanceof Ld)return e;throw Error(`Expected span but got `+String(e)+`.`)}var qd=e=>e instanceof Ld||e instanceof Rd||e instanceof Ed,Jd={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Yd={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Xd={Å:`A`,Ð:`D`,Þ:`o`,å:`a`,ð:`d`,þ:`o`,А:`A`,Б:`B`,В:`B`,Г:`F`,Д:`A`,Е:`E`,Ж:`K`,З:`3`,И:`N`,Й:`N`,К:`K`,Л:`N`,М:`M`,Н:`H`,О:`O`,П:`N`,Р:`P`,С:`C`,Т:`T`,У:`y`,Ф:`O`,Х:`X`,Ц:`U`,Ч:`h`,Ш:`W`,Щ:`W`,Ъ:`B`,Ы:`X`,Ь:`B`,Э:`3`,Ю:`X`,Я:`R`,а:`a`,б:`b`,в:`a`,г:`r`,д:`y`,е:`e`,ж:`m`,з:`e`,и:`n`,й:`n`,к:`n`,л:`n`,м:`m`,н:`n`,о:`o`,п:`n`,р:`p`,с:`c`,т:`o`,у:`y`,ф:`b`,х:`x`,ц:`n`,ч:`n`,ш:`w`,щ:`w`,ъ:`a`,ы:`m`,ь:`a`,э:`e`,ю:`m`,я:`r`};function Zd(e,t){Jd[e]=t}function Qd(e,t,n){if(!Jd[t])throw Error(`Font metrics not found for font: `+t+`.`);var r=e.charCodeAt(0),i=Jd[t][r];if(!i&&e[0]in Xd&&(r=Xd[e[0]].charCodeAt(0),i=Jd[t][r]),!i&&n===`text`&&dd(r)&&(i=Jd[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var $d={};function ef(e){var t=e>=5?0:e>=3?1:2;if(!$d[t]){var n=$d[t]={cssEmPerMu:Yd.quad[t]/18};for(var r in Yd)Yd.hasOwnProperty(r)&&(n[r]=Yd[r][t])}return $d[t]}var tf={math:{},text:{}};function F(e,t,n,r,i,a){tf[e][i]={font:t,group:n,replace:r},a&&r&&(tf[e][r]=tf[e][i])}var I=`math`,L=`text`,R=`main`,z=`ams`,B=`accent-token`,V=`bin`,nf=`close`,rf=`inner`,H=`mathord`,af=`op-token`,of=`open`,sf=`punct`,U=`rel`,cf=`spacing`,W=`textord`;F(I,R,U,`≡`,`\\equiv`,!0),F(I,R,U,`≺`,`\\prec`,!0),F(I,R,U,`≻`,`\\succ`,!0),F(I,R,U,`∼`,`\\sim`,!0),F(I,R,U,`⊥`,`\\perp`),F(I,R,U,`⪯`,`\\preceq`,!0),F(I,R,U,`⪰`,`\\succeq`,!0),F(I,R,U,`≃`,`\\simeq`,!0),F(I,R,U,`∣`,`\\mid`,!0),F(I,R,U,`≪`,`\\ll`,!0),F(I,R,U,`≫`,`\\gg`,!0),F(I,R,U,`≍`,`\\asymp`,!0),F(I,R,U,`∥`,`\\parallel`),F(I,R,U,`⋈`,`\\bowtie`,!0),F(I,R,U,`⌣`,`\\smile`,!0),F(I,R,U,`⊑`,`\\sqsubseteq`,!0),F(I,R,U,`⊒`,`\\sqsupseteq`,!0),F(I,R,U,`≐`,`\\doteq`,!0),F(I,R,U,`⌢`,`\\frown`,!0),F(I,R,U,`∋`,`\\ni`,!0),F(I,R,U,`∝`,`\\propto`,!0),F(I,R,U,`⊢`,`\\vdash`,!0),F(I,R,U,`⊣`,`\\dashv`,!0),F(I,R,U,`∋`,`\\owns`),F(I,R,sf,`.`,`\\ldotp`),F(I,R,sf,`⋅`,`\\cdotp`),F(I,R,sf,`⋅`,`·`),F(L,R,W,`⋅`,`·`),F(I,R,W,`#`,`\\#`),F(L,R,W,`#`,`\\#`),F(I,R,W,`&`,`\\&`),F(L,R,W,`&`,`\\&`),F(I,R,W,`ℵ`,`\\aleph`,!0),F(I,R,W,`∀`,`\\forall`,!0),F(I,R,W,`ℏ`,`\\hbar`,!0),F(I,R,W,`∃`,`\\exists`,!0),F(I,R,W,`∇`,`\\nabla`,!0),F(I,R,W,`♭`,`\\flat`,!0),F(I,R,W,`ℓ`,`\\ell`,!0),F(I,R,W,`♮`,`\\natural`,!0),F(I,R,W,`♣`,`\\clubsuit`,!0),F(I,R,W,`℘`,`\\wp`,!0),F(I,R,W,`♯`,`\\sharp`,!0),F(I,R,W,`♢`,`\\diamondsuit`,!0),F(I,R,W,`ℜ`,`\\Re`,!0),F(I,R,W,`♡`,`\\heartsuit`,!0),F(I,R,W,`ℑ`,`\\Im`,!0),F(I,R,W,`♠`,`\\spadesuit`,!0),F(I,R,W,`§`,`\\S`,!0),F(L,R,W,`§`,`\\S`),F(I,R,W,`¶`,`\\P`,!0),F(L,R,W,`¶`,`\\P`),F(I,R,W,`†`,`\\dag`),F(L,R,W,`†`,`\\dag`),F(L,R,W,`†`,`\\textdagger`),F(I,R,W,`‡`,`\\ddag`),F(L,R,W,`‡`,`\\ddag`),F(L,R,W,`‡`,`\\textdaggerdbl`),F(I,R,nf,`⎱`,`\\rmoustache`,!0),F(I,R,of,`⎰`,`\\lmoustache`,!0),F(I,R,nf,`⟯`,`\\rgroup`,!0),F(I,R,of,`⟮`,`\\lgroup`,!0),F(I,R,V,`∓`,`\\mp`,!0),F(I,R,V,`⊖`,`\\ominus`,!0),F(I,R,V,`⊎`,`\\uplus`,!0),F(I,R,V,`⊓`,`\\sqcap`,!0),F(I,R,V,`∗`,`\\ast`),F(I,R,V,`⊔`,`\\sqcup`,!0),F(I,R,V,`◯`,`\\bigcirc`,!0),F(I,R,V,`∙`,`\\bullet`,!0),F(I,R,V,`‡`,`\\ddagger`),F(I,R,V,`≀`,`\\wr`,!0),F(I,R,V,`⨿`,`\\amalg`),F(I,R,V,`&`,`\\And`),F(I,R,U,`⟵`,`\\longleftarrow`,!0),F(I,R,U,`⇐`,`\\Leftarrow`,!0),F(I,R,U,`⟸`,`\\Longleftarrow`,!0),F(I,R,U,`⟶`,`\\longrightarrow`,!0),F(I,R,U,`⇒`,`\\Rightarrow`,!0),F(I,R,U,`⟹`,`\\Longrightarrow`,!0),F(I,R,U,`↔`,`\\leftrightarrow`,!0),F(I,R,U,`⟷`,`\\longleftrightarrow`,!0),F(I,R,U,`⇔`,`\\Leftrightarrow`,!0),F(I,R,U,`⟺`,`\\Longleftrightarrow`,!0),F(I,R,U,`↦`,`\\mapsto`,!0),F(I,R,U,`⟼`,`\\longmapsto`,!0),F(I,R,U,`↗`,`\\nearrow`,!0),F(I,R,U,`↩`,`\\hookleftarrow`,!0),F(I,R,U,`↪`,`\\hookrightarrow`,!0),F(I,R,U,`↘`,`\\searrow`,!0),F(I,R,U,`↼`,`\\leftharpoonup`,!0),F(I,R,U,`⇀`,`\\rightharpoonup`,!0),F(I,R,U,`↙`,`\\swarrow`,!0),F(I,R,U,`↽`,`\\leftharpoondown`,!0),F(I,R,U,`⇁`,`\\rightharpoondown`,!0),F(I,R,U,`↖`,`\\nwarrow`,!0),F(I,R,U,`⇌`,`\\rightleftharpoons`,!0),F(I,z,U,`≮`,`\\nless`,!0),F(I,z,U,``,`\\@nleqslant`),F(I,z,U,``,`\\@nleqq`),F(I,z,U,`⪇`,`\\lneq`,!0),F(I,z,U,`≨`,`\\lneqq`,!0),F(I,z,U,``,`\\@lvertneqq`),F(I,z,U,`⋦`,`\\lnsim`,!0),F(I,z,U,`⪉`,`\\lnapprox`,!0),F(I,z,U,`⊀`,`\\nprec`,!0),F(I,z,U,`⋠`,`\\npreceq`,!0),F(I,z,U,`⋨`,`\\precnsim`,!0),F(I,z,U,`⪹`,`\\precnapprox`,!0),F(I,z,U,`≁`,`\\nsim`,!0),F(I,z,U,``,`\\@nshortmid`),F(I,z,U,`∤`,`\\nmid`,!0),F(I,z,U,`⊬`,`\\nvdash`,!0),F(I,z,U,`⊭`,`\\nvDash`,!0),F(I,z,U,`⋪`,`\\ntriangleleft`),F(I,z,U,`⋬`,`\\ntrianglelefteq`,!0),F(I,z,U,`⊊`,`\\subsetneq`,!0),F(I,z,U,``,`\\@varsubsetneq`),F(I,z,U,`⫋`,`\\subsetneqq`,!0),F(I,z,U,``,`\\@varsubsetneqq`),F(I,z,U,`≯`,`\\ngtr`,!0),F(I,z,U,``,`\\@ngeqslant`),F(I,z,U,``,`\\@ngeqq`),F(I,z,U,`⪈`,`\\gneq`,!0),F(I,z,U,`≩`,`\\gneqq`,!0),F(I,z,U,``,`\\@gvertneqq`),F(I,z,U,`⋧`,`\\gnsim`,!0),F(I,z,U,`⪊`,`\\gnapprox`,!0),F(I,z,U,`⊁`,`\\nsucc`,!0),F(I,z,U,`⋡`,`\\nsucceq`,!0),F(I,z,U,`⋩`,`\\succnsim`,!0),F(I,z,U,`⪺`,`\\succnapprox`,!0),F(I,z,U,`≆`,`\\ncong`,!0),F(I,z,U,``,`\\@nshortparallel`),F(I,z,U,`∦`,`\\nparallel`,!0),F(I,z,U,`⊯`,`\\nVDash`,!0),F(I,z,U,`⋫`,`\\ntriangleright`),F(I,z,U,`⋭`,`\\ntrianglerighteq`,!0),F(I,z,U,``,`\\@nsupseteqq`),F(I,z,U,`⊋`,`\\supsetneq`,!0),F(I,z,U,``,`\\@varsupsetneq`),F(I,z,U,`⫌`,`\\supsetneqq`,!0),F(I,z,U,``,`\\@varsupsetneqq`),F(I,z,U,`⊮`,`\\nVdash`,!0),F(I,z,U,`⪵`,`\\precneqq`,!0),F(I,z,U,`⪶`,`\\succneqq`,!0),F(I,z,U,``,`\\@nsubseteqq`),F(I,z,V,`⊴`,`\\unlhd`),F(I,z,V,`⊵`,`\\unrhd`),F(I,z,U,`↚`,`\\nleftarrow`,!0),F(I,z,U,`↛`,`\\nrightarrow`,!0),F(I,z,U,`⇍`,`\\nLeftarrow`,!0),F(I,z,U,`⇏`,`\\nRightarrow`,!0),F(I,z,U,`↮`,`\\nleftrightarrow`,!0),F(I,z,U,`⇎`,`\\nLeftrightarrow`,!0),F(I,z,U,`△`,`\\vartriangle`),F(I,z,W,`ℏ`,`\\hslash`),F(I,z,W,`▽`,`\\triangledown`),F(I,z,W,`◊`,`\\lozenge`),F(I,z,W,`Ⓢ`,`\\circledS`),F(I,z,W,`®`,`\\circledR`),F(L,z,W,`®`,`\\circledR`),F(I,z,W,`∡`,`\\measuredangle`,!0),F(I,z,W,`∄`,`\\nexists`),F(I,z,W,`℧`,`\\mho`),F(I,z,W,`Ⅎ`,`\\Finv`,!0),F(I,z,W,`⅁`,`\\Game`,!0),F(I,z,W,`‵`,`\\backprime`),F(I,z,W,`▲`,`\\blacktriangle`),F(I,z,W,`▼`,`\\blacktriangledown`),F(I,z,W,`■`,`\\blacksquare`),F(I,z,W,`⧫`,`\\blacklozenge`),F(I,z,W,`★`,`\\bigstar`),F(I,z,W,`∢`,`\\sphericalangle`,!0),F(I,z,W,`∁`,`\\complement`,!0),F(I,z,W,`ð`,`\\eth`,!0),F(L,R,W,`ð`,`ð`),F(I,z,W,`╱`,`\\diagup`),F(I,z,W,`╲`,`\\diagdown`),F(I,z,W,`□`,`\\square`),F(I,z,W,`□`,`\\Box`),F(I,z,W,`◊`,`\\Diamond`),F(I,z,W,`¥`,`\\yen`,!0),F(L,z,W,`¥`,`\\yen`,!0),F(I,z,W,`✓`,`\\checkmark`,!0),F(L,z,W,`✓`,`\\checkmark`),F(I,z,W,`ℶ`,`\\beth`,!0),F(I,z,W,`ℸ`,`\\daleth`,!0),F(I,z,W,`ℷ`,`\\gimel`,!0),F(I,z,W,`ϝ`,`\\digamma`,!0),F(I,z,W,`ϰ`,`\\varkappa`),F(I,z,of,`┌`,`\\@ulcorner`,!0),F(I,z,nf,`┐`,`\\@urcorner`,!0),F(I,z,of,`└`,`\\@llcorner`,!0),F(I,z,nf,`┘`,`\\@lrcorner`,!0),F(I,z,U,`≦`,`\\leqq`,!0),F(I,z,U,`⩽`,`\\leqslant`,!0),F(I,z,U,`⪕`,`\\eqslantless`,!0),F(I,z,U,`≲`,`\\lesssim`,!0),F(I,z,U,`⪅`,`\\lessapprox`,!0),F(I,z,U,`≊`,`\\approxeq`,!0),F(I,z,V,`⋖`,`\\lessdot`),F(I,z,U,`⋘`,`\\lll`,!0),F(I,z,U,`≶`,`\\lessgtr`,!0),F(I,z,U,`⋚`,`\\lesseqgtr`,!0),F(I,z,U,`⪋`,`\\lesseqqgtr`,!0),F(I,z,U,`≑`,`\\doteqdot`),F(I,z,U,`≓`,`\\risingdotseq`,!0),F(I,z,U,`≒`,`\\fallingdotseq`,!0),F(I,z,U,`∽`,`\\backsim`,!0),F(I,z,U,`⋍`,`\\backsimeq`,!0),F(I,z,U,`⫅`,`\\subseteqq`,!0),F(I,z,U,`⋐`,`\\Subset`,!0),F(I,z,U,`⊏`,`\\sqsubset`,!0),F(I,z,U,`≼`,`\\preccurlyeq`,!0),F(I,z,U,`⋞`,`\\curlyeqprec`,!0),F(I,z,U,`≾`,`\\precsim`,!0),F(I,z,U,`⪷`,`\\precapprox`,!0),F(I,z,U,`⊲`,`\\vartriangleleft`),F(I,z,U,`⊴`,`\\trianglelefteq`),F(I,z,U,`⊨`,`\\vDash`,!0),F(I,z,U,`⊪`,`\\Vvdash`,!0),F(I,z,U,`⌣`,`\\smallsmile`),F(I,z,U,`⌢`,`\\smallfrown`),F(I,z,U,`≏`,`\\bumpeq`,!0),F(I,z,U,`≎`,`\\Bumpeq`,!0),F(I,z,U,`≧`,`\\geqq`,!0),F(I,z,U,`⩾`,`\\geqslant`,!0),F(I,z,U,`⪖`,`\\eqslantgtr`,!0),F(I,z,U,`≳`,`\\gtrsim`,!0),F(I,z,U,`⪆`,`\\gtrapprox`,!0),F(I,z,V,`⋗`,`\\gtrdot`),F(I,z,U,`⋙`,`\\ggg`,!0),F(I,z,U,`≷`,`\\gtrless`,!0),F(I,z,U,`⋛`,`\\gtreqless`,!0),F(I,z,U,`⪌`,`\\gtreqqless`,!0),F(I,z,U,`≖`,`\\eqcirc`,!0),F(I,z,U,`≗`,`\\circeq`,!0),F(I,z,U,`≜`,`\\triangleq`,!0),F(I,z,U,`∼`,`\\thicksim`),F(I,z,U,`≈`,`\\thickapprox`),F(I,z,U,`⫆`,`\\supseteqq`,!0),F(I,z,U,`⋑`,`\\Supset`,!0),F(I,z,U,`⊐`,`\\sqsupset`,!0),F(I,z,U,`≽`,`\\succcurlyeq`,!0),F(I,z,U,`⋟`,`\\curlyeqsucc`,!0),F(I,z,U,`≿`,`\\succsim`,!0),F(I,z,U,`⪸`,`\\succapprox`,!0),F(I,z,U,`⊳`,`\\vartriangleright`),F(I,z,U,`⊵`,`\\trianglerighteq`),F(I,z,U,`⊩`,`\\Vdash`,!0),F(I,z,U,`∣`,`\\shortmid`),F(I,z,U,`∥`,`\\shortparallel`),F(I,z,U,`≬`,`\\between`,!0),F(I,z,U,`⋔`,`\\pitchfork`,!0),F(I,z,U,`∝`,`\\varpropto`),F(I,z,U,`◀`,`\\blacktriangleleft`),F(I,z,U,`∴`,`\\therefore`,!0),F(I,z,U,`∍`,`\\backepsilon`),F(I,z,U,`▶`,`\\blacktriangleright`),F(I,z,U,`∵`,`\\because`,!0),F(I,z,U,`⋘`,`\\llless`),F(I,z,U,`⋙`,`\\gggtr`),F(I,z,V,`⊲`,`\\lhd`),F(I,z,V,`⊳`,`\\rhd`),F(I,z,U,`≂`,`\\eqsim`,!0),F(I,R,U,`⋈`,`\\Join`),F(I,z,U,`≑`,`\\Doteq`,!0),F(I,z,V,`∔`,`\\dotplus`,!0),F(I,z,V,`∖`,`\\smallsetminus`),F(I,z,V,`⋒`,`\\Cap`,!0),F(I,z,V,`⋓`,`\\Cup`,!0),F(I,z,V,`⩞`,`\\doublebarwedge`,!0),F(I,z,V,`⊟`,`\\boxminus`,!0),F(I,z,V,`⊞`,`\\boxplus`,!0),F(I,z,V,`⋇`,`\\divideontimes`,!0),F(I,z,V,`⋉`,`\\ltimes`,!0),F(I,z,V,`⋊`,`\\rtimes`,!0),F(I,z,V,`⋋`,`\\leftthreetimes`,!0),F(I,z,V,`⋌`,`\\rightthreetimes`,!0),F(I,z,V,`⋏`,`\\curlywedge`,!0),F(I,z,V,`⋎`,`\\curlyvee`,!0),F(I,z,V,`⊝`,`\\circleddash`,!0),F(I,z,V,`⊛`,`\\circledast`,!0),F(I,z,V,`⋅`,`\\centerdot`),F(I,z,V,`⊺`,`\\intercal`,!0),F(I,z,V,`⋒`,`\\doublecap`),F(I,z,V,`⋓`,`\\doublecup`),F(I,z,V,`⊠`,`\\boxtimes`,!0),F(I,z,U,`⇢`,`\\dashrightarrow`,!0),F(I,z,U,`⇠`,`\\dashleftarrow`,!0),F(I,z,U,`⇇`,`\\leftleftarrows`,!0),F(I,z,U,`⇆`,`\\leftrightarrows`,!0),F(I,z,U,`⇚`,`\\Lleftarrow`,!0),F(I,z,U,`↞`,`\\twoheadleftarrow`,!0),F(I,z,U,`↢`,`\\leftarrowtail`,!0),F(I,z,U,`↫`,`\\looparrowleft`,!0),F(I,z,U,`⇋`,`\\leftrightharpoons`,!0),F(I,z,U,`↶`,`\\curvearrowleft`,!0),F(I,z,U,`↺`,`\\circlearrowleft`,!0),F(I,z,U,`↰`,`\\Lsh`,!0),F(I,z,U,`⇈`,`\\upuparrows`,!0),F(I,z,U,`↿`,`\\upharpoonleft`,!0),F(I,z,U,`⇃`,`\\downharpoonleft`,!0),F(I,R,U,`⊶`,`\\origof`,!0),F(I,R,U,`⊷`,`\\imageof`,!0),F(I,z,U,`⊸`,`\\multimap`,!0),F(I,z,U,`↭`,`\\leftrightsquigarrow`,!0),F(I,z,U,`⇉`,`\\rightrightarrows`,!0),F(I,z,U,`⇄`,`\\rightleftarrows`,!0),F(I,z,U,`↠`,`\\twoheadrightarrow`,!0),F(I,z,U,`↣`,`\\rightarrowtail`,!0),F(I,z,U,`↬`,`\\looparrowright`,!0),F(I,z,U,`↷`,`\\curvearrowright`,!0),F(I,z,U,`↻`,`\\circlearrowright`,!0),F(I,z,U,`↱`,`\\Rsh`,!0),F(I,z,U,`⇊`,`\\downdownarrows`,!0),F(I,z,U,`↾`,`\\upharpoonright`,!0),F(I,z,U,`⇂`,`\\downharpoonright`,!0),F(I,z,U,`⇝`,`\\rightsquigarrow`,!0),F(I,z,U,`⇝`,`\\leadsto`),F(I,z,U,`⇛`,`\\Rrightarrow`,!0),F(I,z,U,`↾`,`\\restriction`),F(I,R,W,`‘`,"`"),F(I,R,W,`$`,`\\$`),F(L,R,W,`$`,`\\$`),F(L,R,W,`$`,`\\textdollar`),F(I,R,W,`%`,`\\%`),F(L,R,W,`%`,`\\%`),F(I,R,W,`_`,`\\_`),F(L,R,W,`_`,`\\_`),F(L,R,W,`_`,`\\textunderscore`),F(I,R,W,`∠`,`\\angle`,!0),F(I,R,W,`∞`,`\\infty`,!0),F(I,R,W,`′`,`\\prime`),F(I,R,W,`△`,`\\triangle`),F(I,R,W,`Γ`,`\\Gamma`,!0),F(I,R,W,`Δ`,`\\Delta`,!0),F(I,R,W,`Θ`,`\\Theta`,!0),F(I,R,W,`Λ`,`\\Lambda`,!0),F(I,R,W,`Ξ`,`\\Xi`,!0),F(I,R,W,`Π`,`\\Pi`,!0),F(I,R,W,`Σ`,`\\Sigma`,!0),F(I,R,W,`Υ`,`\\Upsilon`,!0),F(I,R,W,`Φ`,`\\Phi`,!0),F(I,R,W,`Ψ`,`\\Psi`,!0),F(I,R,W,`Ω`,`\\Omega`,!0),F(I,R,W,`A`,`Α`),F(I,R,W,`B`,`Β`),F(I,R,W,`E`,`Ε`),F(I,R,W,`Z`,`Ζ`),F(I,R,W,`H`,`Η`),F(I,R,W,`I`,`Ι`),F(I,R,W,`K`,`Κ`),F(I,R,W,`M`,`Μ`),F(I,R,W,`N`,`Ν`),F(I,R,W,`O`,`Ο`),F(I,R,W,`P`,`Ρ`),F(I,R,W,`T`,`Τ`),F(I,R,W,`X`,`Χ`),F(I,R,W,`¬`,`\\neg`,!0),F(I,R,W,`¬`,`\\lnot`),F(I,R,W,`⊤`,`\\top`),F(I,R,W,`⊥`,`\\bot`),F(I,R,W,`∅`,`\\emptyset`),F(I,z,W,`∅`,`\\varnothing`),F(I,R,H,`α`,`\\alpha`,!0),F(I,R,H,`β`,`\\beta`,!0),F(I,R,H,`γ`,`\\gamma`,!0),F(I,R,H,`δ`,`\\delta`,!0),F(I,R,H,`ϵ`,`\\epsilon`,!0),F(I,R,H,`ζ`,`\\zeta`,!0),F(I,R,H,`η`,`\\eta`,!0),F(I,R,H,`θ`,`\\theta`,!0),F(I,R,H,`ι`,`\\iota`,!0),F(I,R,H,`κ`,`\\kappa`,!0),F(I,R,H,`λ`,`\\lambda`,!0),F(I,R,H,`μ`,`\\mu`,!0),F(I,R,H,`ν`,`\\nu`,!0),F(I,R,H,`ξ`,`\\xi`,!0),F(I,R,H,`ο`,`\\omicron`,!0),F(I,R,H,`π`,`\\pi`,!0),F(I,R,H,`ρ`,`\\rho`,!0),F(I,R,H,`σ`,`\\sigma`,!0),F(I,R,H,`τ`,`\\tau`,!0),F(I,R,H,`υ`,`\\upsilon`,!0),F(I,R,H,`ϕ`,`\\phi`,!0),F(I,R,H,`χ`,`\\chi`,!0),F(I,R,H,`ψ`,`\\psi`,!0),F(I,R,H,`ω`,`\\omega`,!0),F(I,R,H,`ε`,`\\varepsilon`,!0),F(I,R,H,`ϑ`,`\\vartheta`,!0),F(I,R,H,`ϖ`,`\\varpi`,!0),F(I,R,H,`ϱ`,`\\varrho`,!0),F(I,R,H,`ς`,`\\varsigma`,!0),F(I,R,H,`φ`,`\\varphi`,!0),F(I,R,V,`∗`,`*`,!0),F(I,R,V,`+`,`+`),F(I,R,V,`−`,`-`,!0),F(I,R,V,`⋅`,`\\cdot`,!0),F(I,R,V,`∘`,`\\circ`,!0),F(I,R,V,`÷`,`\\div`,!0),F(I,R,V,`±`,`\\pm`,!0),F(I,R,V,`×`,`\\times`,!0),F(I,R,V,`∩`,`\\cap`,!0),F(I,R,V,`∪`,`\\cup`,!0),F(I,R,V,`∖`,`\\setminus`,!0),F(I,R,V,`∧`,`\\land`),F(I,R,V,`∨`,`\\lor`),F(I,R,V,`∧`,`\\wedge`,!0),F(I,R,V,`∨`,`\\vee`,!0),F(I,R,W,`√`,`\\surd`),F(I,R,of,`⟨`,`\\langle`,!0),F(I,R,of,`∣`,`\\lvert`),F(I,R,of,`∥`,`\\lVert`),F(I,R,nf,`?`,`?`),F(I,R,nf,`!`,`!`),F(I,R,nf,`⟩`,`\\rangle`,!0),F(I,R,nf,`∣`,`\\rvert`),F(I,R,nf,`∥`,`\\rVert`),F(I,R,U,`=`,`=`),F(I,R,U,`:`,`:`),F(I,R,U,`≈`,`\\approx`,!0),F(I,R,U,`≅`,`\\cong`,!0),F(I,R,U,`≥`,`\\ge`),F(I,R,U,`≥`,`\\geq`,!0),F(I,R,U,`←`,`\\gets`),F(I,R,U,`>`,`\\gt`,!0),F(I,R,U,`∈`,`\\in`,!0),F(I,R,U,``,`\\@not`),F(I,R,U,`⊂`,`\\subset`,!0),F(I,R,U,`⊃`,`\\supset`,!0),F(I,R,U,`⊆`,`\\subseteq`,!0),F(I,R,U,`⊇`,`\\supseteq`,!0),F(I,z,U,`⊈`,`\\nsubseteq`,!0),F(I,z,U,`⊉`,`\\nsupseteq`,!0),F(I,R,U,`⊨`,`\\models`),F(I,R,U,`←`,`\\leftarrow`,!0),F(I,R,U,`≤`,`\\le`),F(I,R,U,`≤`,`\\leq`,!0),F(I,R,U,`<`,`\\lt`,!0),F(I,R,U,`→`,`\\rightarrow`,!0),F(I,R,U,`→`,`\\to`),F(I,z,U,`≱`,`\\ngeq`,!0),F(I,z,U,`≰`,`\\nleq`,!0),F(I,R,cf,`\xA0`,`\\ `),F(I,R,cf,`\xA0`,`\\space`),F(I,R,cf,`\xA0`,`\\nobreakspace`),F(L,R,cf,`\xA0`,`\\ `),F(L,R,cf,`\xA0`,` `),F(L,R,cf,`\xA0`,`\\space`),F(L,R,cf,`\xA0`,`\\nobreakspace`),F(I,R,cf,``,`\\nobreak`),F(I,R,cf,``,`\\allowbreak`),F(I,R,sf,`,`,`,`),F(I,R,sf,`;`,`;`),F(I,z,V,`⊼`,`\\barwedge`,!0),F(I,z,V,`⊻`,`\\veebar`,!0),F(I,R,V,`⊙`,`\\odot`,!0),F(I,R,V,`⊕`,`\\oplus`,!0),F(I,R,V,`⊗`,`\\otimes`,!0),F(I,R,W,`∂`,`\\partial`,!0),F(I,R,V,`⊘`,`\\oslash`,!0),F(I,z,V,`⊚`,`\\circledcirc`,!0),F(I,z,V,`⊡`,`\\boxdot`,!0),F(I,R,V,`△`,`\\bigtriangleup`),F(I,R,V,`▽`,`\\bigtriangledown`),F(I,R,V,`†`,`\\dagger`),F(I,R,V,`⋄`,`\\diamond`),F(I,R,V,`⋆`,`\\star`),F(I,R,V,`◃`,`\\triangleleft`),F(I,R,V,`▹`,`\\triangleright`),F(I,R,of,`{`,`\\{`),F(L,R,W,`{`,`\\{`),F(L,R,W,`{`,`\\textbraceleft`),F(I,R,nf,`}`,`\\}`),F(L,R,W,`}`,`\\}`),F(L,R,W,`}`,`\\textbraceright`),F(I,R,of,`{`,`\\lbrace`),F(I,R,nf,`}`,`\\rbrace`),F(I,R,of,`[`,`\\lbrack`,!0),F(L,R,W,`[`,`\\lbrack`,!0),F(I,R,nf,`]`,`\\rbrack`,!0),F(L,R,W,`]`,`\\rbrack`,!0),F(I,R,of,`(`,`\\lparen`,!0),F(I,R,nf,`)`,`\\rparen`,!0),F(L,R,W,`<`,`\\textless`,!0),F(L,R,W,`>`,`\\textgreater`,!0),F(I,R,of,`⌊`,`\\lfloor`,!0),F(I,R,nf,`⌋`,`\\rfloor`,!0),F(I,R,of,`⌈`,`\\lceil`,!0),F(I,R,nf,`⌉`,`\\rceil`,!0),F(I,R,W,`\\`,`\\backslash`),F(I,R,W,`∣`,`|`),F(I,R,W,`∣`,`\\vert`),F(L,R,W,`|`,`\\textbar`,!0),F(I,R,W,`∥`,`\\|`),F(I,R,W,`∥`,`\\Vert`),F(L,R,W,`∥`,`\\textbardbl`),F(L,R,W,`~`,`\\textasciitilde`),F(L,R,W,`\\`,`\\textbackslash`),F(L,R,W,`^`,`\\textasciicircum`),F(I,R,U,`↑`,`\\uparrow`,!0),F(I,R,U,`⇑`,`\\Uparrow`,!0),F(I,R,U,`↓`,`\\downarrow`,!0),F(I,R,U,`⇓`,`\\Downarrow`,!0),F(I,R,U,`↕`,`\\updownarrow`,!0),F(I,R,U,`⇕`,`\\Updownarrow`,!0),F(I,R,af,`∐`,`\\coprod`),F(I,R,af,`⋁`,`\\bigvee`),F(I,R,af,`⋀`,`\\bigwedge`),F(I,R,af,`⨄`,`\\biguplus`),F(I,R,af,`⋂`,`\\bigcap`),F(I,R,af,`⋃`,`\\bigcup`),F(I,R,af,`∫`,`\\int`),F(I,R,af,`∫`,`\\intop`),F(I,R,af,`∬`,`\\iint`),F(I,R,af,`∭`,`\\iiint`),F(I,R,af,`∏`,`\\prod`),F(I,R,af,`∑`,`\\sum`),F(I,R,af,`⨂`,`\\bigotimes`),F(I,R,af,`⨁`,`\\bigoplus`),F(I,R,af,`⨀`,`\\bigodot`),F(I,R,af,`∮`,`\\oint`),F(I,R,af,`∯`,`\\oiint`),F(I,R,af,`∰`,`\\oiiint`),F(I,R,af,`⨆`,`\\bigsqcup`),F(I,R,af,`∫`,`\\smallint`),F(L,R,rf,`…`,`\\textellipsis`),F(I,R,rf,`…`,`\\mathellipsis`),F(L,R,rf,`…`,`\\ldots`,!0),F(I,R,rf,`…`,`\\ldots`,!0),F(I,R,rf,`⋯`,`\\@cdots`,!0),F(I,R,rf,`⋱`,`\\ddots`,!0),F(I,R,W,`⋮`,`\\varvdots`),F(L,R,W,`⋮`,`\\varvdots`),F(I,R,B,`ˊ`,`\\acute`),F(I,R,B,`ˋ`,`\\grave`),F(I,R,B,`¨`,`\\ddot`),F(I,R,B,`~`,`\\tilde`),F(I,R,B,`ˉ`,`\\bar`),F(I,R,B,`˘`,`\\breve`),F(I,R,B,`ˇ`,`\\check`),F(I,R,B,`^`,`\\hat`),F(I,R,B,`⃗`,`\\vec`),F(I,R,B,`˙`,`\\dot`),F(I,R,B,`˚`,`\\mathring`),F(I,R,H,``,`\\@imath`),F(I,R,H,``,`\\@jmath`),F(I,R,W,`ı`,`ı`),F(I,R,W,`ȷ`,`ȷ`),F(L,R,W,`ı`,`\\i`,!0),F(L,R,W,`ȷ`,`\\j`,!0),F(L,R,W,`ß`,`\\ss`,!0),F(L,R,W,`æ`,`\\ae`,!0),F(L,R,W,`œ`,`\\oe`,!0),F(L,R,W,`ø`,`\\o`,!0),F(L,R,W,`Æ`,`\\AE`,!0),F(L,R,W,`Œ`,`\\OE`,!0),F(L,R,W,`Ø`,`\\O`,!0),F(L,R,B,`ˊ`,`\\'`),F(L,R,B,`ˋ`,"\\`"),F(L,R,B,`ˆ`,`\\^`),F(L,R,B,`˜`,`\\~`),F(L,R,B,`ˉ`,`\\=`),F(L,R,B,`˘`,`\\u`),F(L,R,B,`˙`,`\\.`),F(L,R,B,`¸`,`\\c`),F(L,R,B,`˚`,`\\r`),F(L,R,B,`ˇ`,`\\v`),F(L,R,B,`¨`,`\\"`),F(L,R,B,`˝`,`\\H`),F(L,R,B,`◯`,`\\textcircled`);var lf={"--":!0,"---":!0,"``":!0,"''":!0};F(L,R,W,`–`,`--`,!0),F(L,R,W,`–`,`\\textendash`),F(L,R,W,`—`,`---`,!0),F(L,R,W,`—`,`\\textemdash`),F(L,R,W,`‘`,"`",!0),F(L,R,W,`‘`,`\\textquoteleft`),F(L,R,W,`’`,`'`,!0),F(L,R,W,`’`,`\\textquoteright`),F(L,R,W,`“`,"``",!0),F(L,R,W,`“`,`\\textquotedblleft`),F(L,R,W,`”`,`''`,!0),F(L,R,W,`”`,`\\textquotedblright`),F(I,R,W,`°`,`\\degree`,!0),F(L,R,W,`°`,`\\degree`),F(L,R,W,`°`,`\\textdegree`,!0),F(I,R,W,`£`,`\\pounds`),F(I,R,W,`£`,`\\mathsterling`,!0),F(L,R,W,`£`,`\\pounds`),F(L,R,W,`£`,`\\textsterling`,!0),F(I,z,W,`✠`,`\\maltese`),F(L,z,W,`✠`,`\\maltese`);for(var uf=`0123456789/@."`,df=0;df{var t=e.charCodeAt(0),n=e.charCodeAt(1),r=(t-55296)*1024+(n-56320)+65536;if(119808<=r&&r<120484)return Rf[Math.floor((r-119808)/26)];if(120782<=r&&r<=120831)return zf[Math.floor((r-120782)/10)];if(r===120485||r===120486)return Rf[0];if(120486{if(jd(e.classes)!==jd(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass(`mathnormal`))return!1;if(e.classes.length===1){var n=e.classes[0];if(n===`mbin`||n===`mord`)return!1}for(var r of Object.keys(e.style))if(e.style[r]!==t.style[r])return!1;for(var i of Object.keys(t.style))if(e.style[i]!==t.style[i])return!1;return!0},qf=e=>{for(var t=0;tt&&(t=a.height),a.depth>n&&(n=a.depth),a.maxFontSize>r&&(r=a.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},K=function(e,t,n,r){var i=new Ld(e,t,n,r);return Jf(i),i},Yf=(e,t,n,r)=>new Ld(e,t,n,r),Xf=function(e,t,n){var r=K([e],[],t);return r.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),r.style.borderBottomWidth=P(r.height),r.maxFontSize=1,r},Zf=function(e,t,n,r){var i=new Rd(e,t,n,r);return Jf(i),i},Qf=function(e){var t=new Ed(e);return Jf(t),t},$f=function(e,t){return e instanceof Ed?K([],[e],t):e},ep=function(e){if(e.positionType===`individualShift`){for(var t=e.children,n=[t[0]],r=-t[0].shift-t[0].elem.depth,i=r,a=1;a{var n=K([`mspace`],[],t),r=Ad(e,t);return n.style.marginRight=P(r),n},np=(e,t,n)=>{var r,i;switch(e){case`amsrm`:r=`AMS`;break;case`textrm`:r=`Main`;break;case`textsf`:r=`SansSerif`;break;case`texttt`:r=`Typewriter`;break;default:r=e}return i=t===`textbf`&&n===`textit`?`BoldItalic`:t===`textbf`?`Bold`:n===`textit`?`Italic`:`Regular`,r+`-`+i},rp={mathbf:{variant:`bold`,fontName:`Main-Bold`},mathrm:{variant:`normal`,fontName:`Main-Regular`},textit:{variant:`italic`,fontName:`Main-Italic`},mathit:{variant:`italic`,fontName:`Main-Italic`},mathnormal:{variant:`italic`,fontName:`Math-Italic`},mathsfit:{variant:`sans-serif-italic`,fontName:`SansSerif-Italic`},mathbb:{variant:`double-struck`,fontName:`AMS-Regular`},mathcal:{variant:`script`,fontName:`Caligraphic-Regular`},mathfrak:{variant:`fraktur`,fontName:`Fraktur-Regular`},mathscr:{variant:`script`,fontName:`Script-Regular`},mathsf:{variant:`sans-serif`,fontName:`SansSerif-Regular`},mathtt:{variant:`monospace`,fontName:`Typewriter-Regular`}},ip={vec:[`vec`,.471,.714],oiintSize1:[`oiintSize1`,.957,.499],oiintSize2:[`oiintSize2`,1.472,.659],oiiintSize1:[`oiiintSize1`,1.304,.499],oiiintSize2:[`oiiintSize2`,1.98,.659]},ap=function(e,t){var[n,r,i]=ip[e],a=Yf([`overlay`],[new Hd([new Ud(n)],{width:P(r),height:P(i),style:`width:`+P(r),viewBox:`0 0 `+1e3*r+` `+1e3*i,preserveAspectRatio:`xMinYMin`})],t);return a.height=i,a.style.height=P(i),a.style.width=P(r),a},op={number:3,unit:`mu`},sp={number:4,unit:`mu`},cp={number:5,unit:`mu`},lp={mord:{mop:op,mbin:sp,mrel:cp,minner:op},mop:{mord:op,mop:op,mrel:cp,minner:op},mbin:{mord:sp,mop:sp,mopen:sp,minner:sp},mrel:{mord:cp,mop:cp,mopen:cp,minner:cp},mopen:{},mclose:{mop:op,mbin:sp,mrel:cp,minner:op},mpunct:{mord:op,mop:op,mrel:cp,mopen:op,mclose:op,mpunct:op,minner:op},minner:{mord:op,mop:op,mbin:sp,mrel:cp,mopen:op,mpunct:op,minner:op}},up={mord:{mop:op},mop:{mord:op,mop:op},mbin:{},mrel:{},mopen:{},mclose:{mop:op},mpunct:{},minner:{mop:op}},dp={},fp={},pp={};function J(e){for(var{type:t,names:n,props:r,handler:i,htmlBuilder:a,mathmlBuilder:o}=e,s={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:i},c=0;c{var n=t.classes[0],r=e.classes[0];n===`mbin`&&vp.has(r)?t.classes[0]=`mord`:r===`mbin`&&_p.has(n)&&(e.classes[0]=`mord`)},{node:u},d,f),Sp(i,(e,t)=>{var n=Tp(t),r=Tp(e),i=n&&r?e.hasClass(`mtight`)?up[n]?.[r]:lp[n]?.[r]:null;if(i)return tp(i,c)},{node:u},d,f),i},Sp=function(e,t,n,r,i){r&&e.push(r);for(var a=0;an=>{e.splice(t+1,0,n),a++})(a)}r&&e.pop()},Cp=function(e){return e instanceof Ed||e instanceof Rd||e instanceof Ld&&e.hasClass(`enclosing`)?e:null},wp=function(e,t){var n=Cp(e);if(n){var r=n.children;if(r.length){if(t===`right`)return wp(r[r.length-1],`right`);if(t===`left`)return wp(r[0],`left`)}}return e},Tp=function(e,t){return e?(t&&(e=wp(e,t)),bp[e.classes[0]]||null):null},Ep=function(e,t){var n=[`nulldelimiter`].concat(e.baseSizingClasses());return K(t.concat(n))},Y=function(e,t,n){if(!e)return K();if(fp[e.type]){var r=fp[e.type](e,t);if(n&&t.size!==n.size){r=K(t.sizingClasses(n),[r],t);var i=t.sizeMultiplier/n.sizeMultiplier;r.height*=i,r.depth*=i}return r}throw new M(`Got group of unknown type: '`+e.type+`'`)};function Dp(e,t){var n=K([`base`],e,t),r=K([`strut`]);return r.style.height=P(n.height+n.depth),n.depth&&(r.style.verticalAlign=P(-n.depth)),n.children.unshift(r),n}function Op(e,t){var n=null;e.length===1&&e[0].type===`tag`&&(n=e[0].tag,e=e[0].body);var r=xp(e,t,`root`),i;r.length===2&&r[1].hasClass(`tag`)&&(i=r.pop());for(var a=[],o=[],s=0;s0&&(a.push(Dp(o,t)),o=[]),a.push(r[s]));o.length>0&&a.push(Dp(o,t));var l;n?(l=Dp(xp(n,t,!0),t),l.classes=[`tag`],a.push(l)):i&&a.push(i);var u=K([`katex-html`],a);if(u.setAttribute(`aria-hidden`,`true`),l){var d=l.children[0];d.style.height=P(u.height+u.depth),u.depth&&(d.style.verticalAlign=P(-u.depth))}return u}function kp(e){return new Ed(e)}var X=class{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=jd(this.classes));for(var n=0;n0&&(e+=` class ="`+Iu(jd(this.classes))+`"`),e+=`>`;for(var n=0;n`,e}toText(){return this.children.map(e=>e.toText()).join(``)}},Ap=class{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Iu(this.toText())}toText(){return this.text}},jp=class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?` `:e>=.1666&&e<=.1667?` `:e>=.2222&&e<=.2223?` `:e>=.2777&&e<=.2778?`  `:e>=-.05556&&e<=-.05555?` ⁣`:e>=-.1667&&e<=-.1666?` ⁣`:e>=-.2223&&e<=-.2222?` ⁣`:e>=-.2778&&e<=-.2777?` ⁣`:null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`mspace`);return e.setAttribute(`width`,P(this.width)),e}toMarkup(){return this.character?``+this.character+``:``}toText(){return this.character?this.character:` `}},Mp=new Set([`\\imath`,`\\jmath`]),Np=new Set([`mrow`,`mtable`]),Pp=function(e,t,n){return tf[t][e]&&tf[t][e].replace&&e.charCodeAt(0)!==55349&&!(lf.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)===`tt`||n.font&&n.font.slice(4,6)===`tt`))&&(e=tf[t][e].replace),new Ap(e)},Fp=function(e){return e.length===1?e[0]:new X(`mrow`,e)},Ip={mathit:`italic`,boldsymbol:e=>e.type===`textord`?`bold`:`bold-italic`,mathbf:`bold`,mathbb:`double-struck`,mathsfit:`sans-serif-italic`,mathfrak:`fraktur`,mathscr:`script`,mathcal:`script`,mathsf:`sans-serif`,mathtt:`monospace`},Lp=(e,t)=>{if(e.mode===`text`){if(t.fontFamily===`texttt`)return`monospace`;if(t.fontFamily===`textsf`)return t.fontShape===`textit`&&t.fontWeight===`textbf`?`sans-serif-bold-italic`:t.fontShape===`textit`?`sans-serif-italic`:t.fontWeight===`textbf`?`bold-sans-serif`:`sans-serif`;if(t.fontShape===`textit`&&t.fontWeight===`textbf`)return`bold-italic`;if(t.fontShape===`textit`)return`italic`;if(t.fontWeight===`textbf`)return`bold`}var n=t.font;if(!n||n===`mathnormal`)return null;var r=e.mode,i=Ip[n];if(i)return typeof i==`function`?i(e):i;var a=e.text;if(Mp.has(a))return null;if(tf[r][a]){var o=tf[r][a].replace;o&&(a=o)}var s=rp[n].fontName;return Qd(a,s,r)?rp[n].variant:null};function Rp(e){if(!e)return!1;if(e.type===`mi`&&e.children.length===1){var t=e.children[0];return t instanceof Ap&&t.text===`.`}if(e.type===`mo`&&e.children.length===1&&e.getAttribute(`separator`)===`true`&&e.getAttribute(`lspace`)===`0em`&&e.getAttribute(`rspace`)===`0em`){var n=e.children[0];return n instanceof Ap&&n.text===`,`}return!1}var zp=function(e,t,n){if(e.length===1){var r=Z(e[0],t);return n&&r instanceof X&&r.type===`mo`&&(r.setAttribute(`lspace`,`0em`),r.setAttribute(`rspace`,`0em`)),[r]}for(var i=[],a,o=0;o=1&&(a.type===`mn`||Rp(a))){var c=s.children[0];c instanceof X&&c.type===`mn`&&(c.children=[...a.children,...c.children],i.pop())}else if(a.type===`mi`&&a.children.length===1){var l=a.children[0];if(l instanceof Ap&&l.text===`̸`&&(s.type===`mo`||s.type===`mi`||s.type===`mn`)){var u=s.children[0];u instanceof Ap&&u.text.length>0&&(u.text=u.text.slice(0,1)+`̸`+u.text.slice(1),i.pop())}}}i.push(s),a=s}return i},Bp=function(e,t,n){return Fp(zp(e,t,n))},Z=function(e,t){if(!e)return new X(`mrow`);if(pp[e.type])return pp[e.type](e,t);throw new M(`Got group of unknown type: '`+e.type+`'`)};function Vp(e,t,n,r,i){var a=zp(e,n),o=a.length===1&&a[0]instanceof X&&Np.has(a[0].type)?a[0]:new X(`mrow`,a),s=new X(`annotation`,[new Ap(t)]);s.setAttribute(`encoding`,`application/x-tex`);var c=new X(`math`,[new X(`semantics`,[o,s])]);return c.setAttribute(`xmlns`,`http://www.w3.org/1998/Math/MathML`),r&&c.setAttribute(`display`,`block`),K([i?`katex`:`katex-mathml`],[c])}var Hp=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Up=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Wp=function(e,t){return t.size<2?e:Hp[e-1][t.size-1]},Gp=class e{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||``,this.fontFamily=t.fontFamily||``,this.fontWeight=t.fontWeight||``,this.fontShape=t.fontShape||``,this.sizeMultiplier=Up[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(n,t),new e(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Wp(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Up[e-1]})}havingBaseStyle(t){t||=this.style.text();var n=Wp(e.BASESIZE,t);return this.size===n&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:``})}withTextFontWeight(e){return this.extend({fontWeight:e,font:``})}withTextFontShape(e){return this.extend({fontShape:e,font:``})}sizingClasses(e){return e.size===this.size?[]:[`sizing`,`reset-size`+e.size,`size`+this.size]}baseSizingClasses(){return this.size===e.BASESIZE?[]:[`sizing`,`reset-size`+this.size,`size`+e.BASESIZE]}fontMetrics(){return this._fontMetrics||=ef(this.size),this._fontMetrics}getColor(){return this.phantom?`transparent`:this.color}};Gp.BASESIZE=6;var Kp=function(e){return new Gp({style:e.displayMode?N.DISPLAY:N.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},qp=function(e,t){if(t.displayMode){var n=[`katex-display`];t.leqno&&n.push(`leqno`),t.fleqn&&n.push(`fleqn`),e=K(n,[e])}return e},Jp=function(e,t,n){var r=Kp(n),i;return n.output===`mathml`?Vp(e,t,r,n.displayMode,!0):(i=n.output===`html`?K([`katex`],[Op(e,r)]):K([`katex`],[Vp(e,t,r,n.displayMode,!1),Op(e,r)]),qp(i,n))},Yp=function(e,t,n){return qp(K([`katex`],[Op(e,Kp(n))]),n)},Xp={widehat:`^`,widecheck:`ˇ`,widetilde:`~`,utilde:`~`,overleftarrow:`←`,underleftarrow:`←`,xleftarrow:`←`,overrightarrow:`→`,underrightarrow:`→`,xrightarrow:`→`,underbrace:`⏟`,overbrace:`⏞`,underbracket:`⎵`,overbracket:`⎴`,overgroup:`⏠`,undergroup:`⏡`,overleftrightarrow:`↔`,underleftrightarrow:`↔`,xleftrightarrow:`↔`,Overrightarrow:`⇒`,xRightarrow:`⇒`,overleftharpoon:`↼`,xleftharpoonup:`↼`,overrightharpoon:`⇀`,xrightharpoonup:`⇀`,xLeftarrow:`⇐`,xLeftrightarrow:`⇔`,xhookleftarrow:`↩`,xhookrightarrow:`↪`,xmapsto:`↦`,xrightharpoondown:`⇁`,xleftharpoondown:`↽`,xrightleftharpoons:`⇌`,xleftrightharpoons:`⇋`,xtwoheadleftarrow:`↞`,xtwoheadrightarrow:`↠`,xlongequal:`=`,xtofrom:`⇄`,xrightleftarrows:`⇄`,xrightequilibrium:`⇌`,xleftequilibrium:`⇋`,"\\cdrightarrow":`→`,"\\cdleftarrow":`←`,"\\cdlongequal":`=`},Zp=function(e){var t=new X(`mo`,[new Ap(Xp[e.replace(/^\\/,``)])]);return t.setAttribute(`stretchy`,`true`),t},Qp={overrightarrow:[[`rightarrow`],.888,522,`xMaxYMin`],overleftarrow:[[`leftarrow`],.888,522,`xMinYMin`],underrightarrow:[[`rightarrow`],.888,522,`xMaxYMin`],underleftarrow:[[`leftarrow`],.888,522,`xMinYMin`],xrightarrow:[[`rightarrow`],1.469,522,`xMaxYMin`],"\\cdrightarrow":[[`rightarrow`],3,522,`xMaxYMin`],xleftarrow:[[`leftarrow`],1.469,522,`xMinYMin`],"\\cdleftarrow":[[`leftarrow`],3,522,`xMinYMin`],Overrightarrow:[[`doublerightarrow`],.888,560,`xMaxYMin`],xRightarrow:[[`doublerightarrow`],1.526,560,`xMaxYMin`],xLeftarrow:[[`doubleleftarrow`],1.526,560,`xMinYMin`],overleftharpoon:[[`leftharpoon`],.888,522,`xMinYMin`],xleftharpoonup:[[`leftharpoon`],.888,522,`xMinYMin`],xleftharpoondown:[[`leftharpoondown`],.888,522,`xMinYMin`],overrightharpoon:[[`rightharpoon`],.888,522,`xMaxYMin`],xrightharpoonup:[[`rightharpoon`],.888,522,`xMaxYMin`],xrightharpoondown:[[`rightharpoondown`],.888,522,`xMaxYMin`],xlongequal:[[`longequal`],.888,334,`xMinYMin`],"\\cdlongequal":[[`longequal`],3,334,`xMinYMin`],xtwoheadleftarrow:[[`twoheadleftarrow`],.888,334,`xMinYMin`],xtwoheadrightarrow:[[`twoheadrightarrow`],.888,334,`xMaxYMin`],overleftrightarrow:[[`leftarrow`,`rightarrow`],.888,522],overbrace:[[`leftbrace`,`midbrace`,`rightbrace`],1.6,548],underbrace:[[`leftbraceunder`,`midbraceunder`,`rightbraceunder`],1.6,548],underleftrightarrow:[[`leftarrow`,`rightarrow`],.888,522],xleftrightarrow:[[`leftarrow`,`rightarrow`],1.75,522],xLeftrightarrow:[[`doubleleftarrow`,`doublerightarrow`],1.75,560],xrightleftharpoons:[[`leftharpoondownplus`,`rightharpoonplus`],1.75,716],xleftrightharpoons:[[`leftharpoonplus`,`rightharpoondownplus`],1.75,716],xhookleftarrow:[[`leftarrow`,`righthook`],1.08,522],xhookrightarrow:[[`lefthook`,`rightarrow`],1.08,522],overlinesegment:[[`leftlinesegment`,`rightlinesegment`],.888,522],underlinesegment:[[`leftlinesegment`,`rightlinesegment`],.888,522],overbracket:[[`leftbracketover`,`rightbracketover`],1.6,440],underbracket:[[`leftbracketunder`,`rightbracketunder`],1.6,410],overgroup:[[`leftgroup`,`rightgroup`],.888,342],undergroup:[[`leftgroupunder`,`rightgroupunder`],.888,342],xmapsto:[[`leftmapsto`,`rightarrow`],1.5,522],xtofrom:[[`leftToFrom`,`rightToFrom`],1.75,528],xrightleftarrows:[[`baraboveleftarrow`,`rightarrowabovebar`],1.75,901],xrightequilibrium:[[`baraboveshortleftharpoon`,`rightharpoonaboveshortbar`],1.75,716],xleftequilibrium:[[`shortbaraboveleftharpoon`,`shortrightharpoonabovebar`],1.75,716]},$p=new Set([`widehat`,`widecheck`,`widetilde`,`utilde`]),em=function(e,t){function n(){var n=4e5,r=e.label.slice(1);if($p.has(r)&&`base`in e){var i=e.base.type===`ordgroup`?e.base.body.length:1,a,o,s;if(i>5)r===`widehat`||r===`widecheck`?(a=420,n=2364,s=.42,o=r+`4`):(a=312,n=2340,s=.34,o=`tilde4`);else{var c=[1,1,2,2,3,3][i];r===`widehat`||r===`widecheck`?(n=[0,1062,2364,2364,2364][c],a=[0,239,300,360,420][c],s=[0,.24,.3,.3,.36,.42][c],o=r+c):(n=[0,600,1033,2339,2340][c],a=[0,260,286,306,312][c],s=[0,.26,.286,.3,.306,.34][c],o=`tilde`+c)}return{span:Yf([],[new Hd([new Ud(o)],{width:`100%`,height:P(s),viewBox:`0 0 `+n+` `+a,preserveAspectRatio:`none`})],t),minWidth:0,height:s}}var l=[],u=Qp[r];if(!u)throw Error(`No SVG data for "`+r+`".`);var[d,f,p]=u,m=p/1e3,h=d.length,g,_;if(h===1){if(u.length!==4)throw Error(`Expected 4-tuple for single-path SVG data "`+r+`".`);g=[`hide-tail`],_=[u[3]]}else if(h===2)g=[`halfarrow-left`,`halfarrow-right`],_=[`xMinYMin`,`xMaxYMin`];else if(h===3)g=[`brace-left`,`brace-center`,`brace-right`],_=[`xMinYMin`,`xMidYMin`,`xMaxYMin`];else throw Error(`Correct katexImagesData or update code here to support + `+h+` children.`);for(var v=0;v0&&(r.style.minWidth=P(i)),r},tm=function(e,t,n,r,i){var a,o=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(a=K([`stretchy`,t],[],i),t===`fbox`){var s=i.color&&i.getColor();s&&(a.style.borderColor=s)}}else{var c=[];/^[bx]cancel$/.test(t)&&c.push(new Wd({x1:`0`,y1:`0`,x2:`100%`,y2:`100%`,"stroke-width":`0.046em`})),/^x?cancel$/.test(t)&&c.push(new Wd({x1:`0`,y1:`100%`,x2:`100%`,y2:`0`,"stroke-width":`0.046em`})),a=Yf([],[new Hd(c,{width:`100%`,height:P(o)})],i)}return a.height=o,a.style.height=P(o),a},nm={bin:1,close:1,inner:1,open:1,punct:1,rel:1},rm={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function im(e){return e in nm}function Q(e,t){if(!e||e.type!==t)throw Error(`Expected node of type `+t+`, but got `+(e?`node of type `+e.type:String(e)));return e}function am(e){var t=om(e);if(!t)throw Error(`Expected node of symbol group type, but got `+(e?`node of type `+e.type:String(e)));return t}function om(e){return e&&(e.type===`atom`||rm.hasOwnProperty(e.type))?e:null}var sm=e=>{if(e instanceof Vd)return e;if(qd(e)&&e.children.length===1)return sm(e.children[0])},cm=(e,t)=>{var n,r,i;e&&e.type===`supsub`?(r=Q(e.base,`accent`),n=r.base,e.base=n,i=Kd(Y(e,t)),e.base=r):(r=Q(e,`accent`),n=r.base);var a=Y(n,t.havingCrampedStyle()),o=r.isShifty&&zu(n),s=0;o&&(s=sm(a)?.skew??0);var c=r.label===`\\c`,l=c?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),u;if(r.isStretchy)u=em(r,t),u=q({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`elem`,elem:u,wrapperClasses:[`svg-align`],wrapperStyle:s>0?{width:`calc(100% - `+P(2*s)+`)`,marginLeft:P(2*s)}:void 0}]});else{var d,f;r.label===`\\vec`?(d=ap(`vec`,t),f=ip.vec[1]):(d=Gf({type:`textord`,mode:r.mode,text:r.label},t,`textord`),d=Gd(d),d.italic=0,f=d.width,c&&(l+=d.depth)),u=K([`accent-body`],[d]);var p=r.label===`\\textcircled`;p&&(u.classes.push(`accent-full`),l=a.height);var m=s;p||(m-=f/2),u.style.left=P(m),r.label===`\\textcircled`&&(u.style.top=`.2em`),u=q({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`kern`,size:-l},{type:`elem`,elem:u}]})}var h=K([`mord`,`accent`],[u],t);return i?(i.children[0]=h,i.height=Math.max(h.height,i.height),i.classes[0]=`mord`,i):h},lm=(e,t)=>{var n=e.isStretchy?Zp(e.label):new X(`mo`,[Pp(e.label,e.mode)]),r=new X(`mover`,[Z(e.base,t),n]);return r.setAttribute(`accent`,`true`),r},um=new RegExp([`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`].map(e=>`\\`+e).join(`|`));J({type:`accent`,names:[`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`,`\\widecheck`,`\\widehat`,`\\widetilde`,`\\overrightarrow`,`\\overleftarrow`,`\\Overrightarrow`,`\\overleftrightarrow`,`\\overgroup`,`\\overlinesegment`,`\\overleftharpoon`,`\\overrightharpoon`],props:{numArgs:1},handler:(e,t)=>{var n=hp(t[0]),r=!um.test(e.funcName),i=!r||e.funcName===`\\widehat`||e.funcName===`\\widetilde`||e.funcName===`\\widecheck`;return{type:`accent`,mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:cm,mathmlBuilder:lm}),J({type:`accent`,names:[`\\'`,"\\`",`\\^`,`\\~`,`\\=`,`\\u`,`\\.`,`\\"`,`\\c`,`\\r`,`\\H`,`\\v`,`\\textcircled`],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`primitive`]},handler:(e,t)=>{var n=t[0],r=e.parser.mode;return r===`math`&&(e.parser.settings.reportNonstrict(`mathVsTextAccents`,`LaTeX's accent `+e.funcName+` works only in text mode`),r=`text`),{type:`accent`,mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:cm,mathmlBuilder:lm}),J({type:`accentUnder`,names:[`\\underleftarrow`,`\\underrightarrow`,`\\underleftrightarrow`,`\\undergroup`,`\\underlinesegment`,`\\utilde`],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:`accentUnder`,mode:n.mode,label:r,base:i}},htmlBuilder:(e,t)=>{var n=Y(e.base,t),r=em(e,t),i=e.label===`\\utilde`?.12:0;return K([`mord`,`accentunder`],[q({positionType:`top`,positionData:n.height,children:[{type:`elem`,elem:r,wrapperClasses:[`svg-align`]},{type:`kern`,size:i},{type:`elem`,elem:n}]})],t)},mathmlBuilder:(e,t)=>{var n=Zp(e.label),r=new X(`munder`,[Z(e.base,t),n]);return r.setAttribute(`accentunder`,`true`),r}});var dm=e=>{var t=new X(`mpadded`,e?[e]:[]);return t.setAttribute(`width`,`+0.6em`),t.setAttribute(`lspace`,`0.3em`),t};J({type:`xArrow`,names:[`\\xleftarrow`,`\\xrightarrow`,`\\xLeftarrow`,`\\xRightarrow`,`\\xleftrightarrow`,`\\xLeftrightarrow`,`\\xhookleftarrow`,`\\xhookrightarrow`,`\\xmapsto`,`\\xrightharpoondown`,`\\xrightharpoonup`,`\\xleftharpoondown`,`\\xleftharpoonup`,`\\xrightleftharpoons`,`\\xleftrightharpoons`,`\\xlongequal`,`\\xtwoheadrightarrow`,`\\xtwoheadleftarrow`,`\\xtofrom`,`\\xrightleftarrows`,`\\xrightequilibrium`,`\\xleftequilibrium`,`\\\\cdrightarrow`,`\\\\cdleftarrow`,`\\\\cdlongequal`],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r,funcName:i}=e;return{type:`xArrow`,mode:r.mode,label:i,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,r=t.havingStyle(n.sup()),i=$f(Y(e.body,r,t),t),a=e.label.slice(0,2)===`\\x`?`x`:`cd`;i.classes.push(a+`-arrow-pad`);var o;e.below&&(r=t.havingStyle(n.sub()),o=$f(Y(e.below,r,t),t),o.classes.push(a+`-arrow-pad`));var s=em(e,t),c=-t.fontMetrics().axisHeight+.5*s.height,l=-t.fontMetrics().axisHeight-.5*s.height-.111;(i.depth>.25||e.label===`\\xleftequilibrium`)&&(l-=i.depth);var u;if(o){var d=-t.fontMetrics().axisHeight+o.height+.5*s.height+.111;u=q({positionType:`individualShift`,children:[{type:`elem`,elem:i,shift:l},{type:`elem`,elem:s,shift:c,wrapperClasses:[`svg-align`]},{type:`elem`,elem:o,shift:d}]})}else u=q({positionType:`individualShift`,children:[{type:`elem`,elem:i,shift:l},{type:`elem`,elem:s,shift:c,wrapperClasses:[`svg-align`]}]});return K([`mrel`,`x-arrow`],[u],t)},mathmlBuilder(e,t){var n=Zp(e.label);n.setAttribute(`minsize`,e.label.charAt(0)===`x`?`1.75em`:`3.0em`);var r;if(e.body){var i=dm(Z(e.body,t));r=e.below?new X(`munderover`,[n,dm(Z(e.below,t)),i]):new X(`mover`,[n,i])}else e.below?r=new X(`munder`,[n,dm(Z(e.below,t))]):(r=dm(),r=new X(`mover`,[n,r]));return r}});function fm(e,t){var n=xp(e.body,t,!0);return K([e.mclass],n,t)}function pm(e,t){var n,r=zp(e.body,t);return e.mclass===`minner`?n=new X(`mpadded`,r):e.mclass===`mord`?e.isCharacterBox?(n=r[0],n.type=`mi`):n=new X(`mi`,r):(e.isCharacterBox?(n=r[0],n.type=`mo`):n=new X(`mo`,r),e.mclass===`mbin`?(n.attributes.lspace=`0.22em`,n.attributes.rspace=`0.22em`):e.mclass===`mpunct`?(n.attributes.lspace=`0em`,n.attributes.rspace=`0.17em`):e.mclass===`mopen`||e.mclass===`mclose`?(n.attributes.lspace=`0em`,n.attributes.rspace=`0em`):e.mclass===`minner`&&(n.attributes.lspace=`0.0556em`,n.attributes.width=`+0.1111em`)),n}J({type:`mclass`,names:[`\\mathord`,`\\mathbin`,`\\mathrel`,`\\mathopen`,`\\mathclose`,`\\mathpunct`,`\\mathinner`],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:`mclass`,mode:n.mode,mclass:`m`+r.slice(5),body:gp(i),isCharacterBox:zu(i)}},htmlBuilder:fm,mathmlBuilder:pm});var mm=e=>{var t=e.type===`ordgroup`&&e.body.length?e.body[0]:e;return t.type===`atom`&&(t.family===`bin`||t.family===`rel`)?`m`+t.family:`mord`};J({type:`mclass`,names:[`\\@binrel`],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:`mclass`,mode:n.mode,mclass:mm(t[0]),body:gp(t[1]),isCharacterBox:zu(t[1])}}}),J({type:`mclass`,names:[`\\stackrel`,`\\overset`,`\\underset`],props:{numArgs:2},handler(e,t){var{parser:n,funcName:r}=e,i=t[1],a=t[0],o=r===`\\stackrel`?`mrel`:mm(i),s={type:`op`,mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!==`\\stackrel`,body:gp(i)},c={type:`supsub`,mode:a.mode,base:s,sup:r===`\\underset`?null:a,sub:r===`\\underset`?a:null};return{type:`mclass`,mode:n.mode,mclass:o,body:[c],isCharacterBox:zu(c)}},htmlBuilder:fm,mathmlBuilder:pm}),J({type:`pmb`,names:[`\\pmb`],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:`pmb`,mode:n.mode,mclass:mm(t[0]),body:gp(t[0])}},htmlBuilder(e,t){var n=xp(e.body,t,!0),r=K([e.mclass],n,t);return r.style.textShadow=`0.02em 0.01em 0.04px`,r},mathmlBuilder(e,t){var n=new X(`mstyle`,zp(e.body,t));return n.setAttribute(`style`,`text-shadow: 0.02em 0.01em 0.04px`),n}});var hm={">":`\\\\cdrightarrow`,"<":`\\\\cdleftarrow`,"=":`\\\\cdlongequal`,A:`\\uparrow`,V:`\\downarrow`,"|":`\\Vert`,".":`no arrow`},gm=()=>({type:`styling`,body:[],mode:`math`,style:`display`,resetFont:!0}),_m=e=>e.type===`textord`&&e.text===`@`,vm=(e,t)=>(e.type===`mathord`||e.type===`atom`)&&e.text===t;function ym(e,t,n){var r=hm[e];switch(r){case`\\\\cdrightarrow`:case`\\\\cdleftarrow`:return n.callFunction(r,[t[0]],[t[1]]);case`\\uparrow`:case`\\downarrow`:var i=n.callFunction(`\\\\cdleft`,[t[0]],[]),a={type:`atom`,text:r,mode:`math`,family:`rel`},o={type:`ordgroup`,mode:`math`,body:[i,n.callFunction(`\\Big`,[a],[]),n.callFunction(`\\\\cdright`,[t[1]],[])]};return n.callFunction(`\\\\cdparent`,[o],[]);case`\\\\cdlongequal`:return n.callFunction(`\\\\cdlongequal`,[],[]);case`\\Vert`:return n.callFunction(`\\Big`,[{type:`textord`,text:`\\Vert`,mode:`math`}],[]);default:return{type:`textord`,text:` `,mode:`math`}}}function bm(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set(`\\cr`,`\\\\\\relax`),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,`\\\\`)),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n===`&`||n===`\\\\`)e.consume();else if(n===`\\end`){t[t.length-1].length===0&&t.pop();break}else throw new M(`Expected \\\\ or \\cr or \\end`,e.nextToken)}for(var r=[],i=[r],a=0;aAV`.includes(l))for(var d=0;d<2;d++){for(var f=!0,p=c+1;pAV=|." after @`,o[c])}var m={type:`styling`,body:[ym(l,u,e)],mode:`math`,style:`display`,resetFont:!0};r.push(m),s=gm()}a%2==0?r.push(s):r.shift(),r=[],i.push(r)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:`array`,mode:`math`,body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:Array(i[0].length).fill({type:`align`,align:`c`,pregap:.25,postgap:.25}),colSeparationType:`CD`,hLinesBeforeRow:Array(i.length+1).fill([])}}J({type:`cdlabel`,names:[`\\\\cdleft`,`\\\\cdright`],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:`cdlabel`,mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=$f(Y(e.label,n,t),t);return r.classes.push(`cd-label-`+e.side),r.style.bottom=P(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new X(`mrow`,[Z(e.label,t)]);return n=new X(`mpadded`,[n]),n.setAttribute(`width`,`0`),e.side===`left`&&n.setAttribute(`lspace`,`-1width`),n.setAttribute(`voffset`,`0.7em`),n=new X(`mstyle`,[n]),n.setAttribute(`displaystyle`,`false`),n.setAttribute(`scriptlevel`,`1`),n}}),J({type:`cdlabelparent`,names:[`\\\\cdparent`],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:`cdlabelparent`,mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=$f(Y(e.fragment,t),t);return n.classes.push(`cd-vert-arrow`),n},mathmlBuilder(e,t){return new X(`mrow`,[Z(e.fragment,t)])}}),J({type:`textord`,names:[`\\@char`],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=Q(t[0],`ordgroup`).body,i=``,a=0;a=1114111)throw new M(`\\@char with invalid code point `+i);return s<=65535?c=String.fromCharCode(s):(s-=65536,c=String.fromCharCode((s>>10)+55296,(s&1023)+56320)),{type:`textord`,mode:n.mode,text:c}}});var xm=(e,t)=>Qf(xp(e.body,t.withColor(e.color),!1)),Sm=(e,t)=>{var n=new X(`mstyle`,zp(e.body,t.withColor(e.color)));return n.setAttribute(`mathcolor`,e.color),n};J({type:`color`,names:[`\\textcolor`],props:{numArgs:2,allowedInText:!0,argTypes:[`color`,`original`]},handler(e,t){var{parser:n}=e,r=Q(t[0],`color-token`).color,i=t[1];return{type:`color`,mode:n.mode,color:r,body:gp(i)}},htmlBuilder:xm,mathmlBuilder:Sm}),J({type:`color`,names:[`\\color`],props:{numArgs:1,allowedInText:!0,argTypes:[`color`]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,i=Q(t[0],`color-token`).color;n.gullet.macros.set(`\\current@color`,i);var a=n.parseExpression(!0,r);return{type:`color`,mode:n.mode,color:i,body:a}},htmlBuilder:xm,mathmlBuilder:Sm}),J({type:`cr`,names:[`\\\\`],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:r}=e,i=r.gullet.future().text===`[`?r.parseSizeGroup(!0):null,a=!r.settings.displayMode||!r.settings.useStrictBehavior(`newLineInDisplayMode`,`In LaTeX, \\\\ or \\newline does nothing in display mode`);return{type:`cr`,mode:r.mode,newLine:a,size:i&&Q(i,`size`).value}},htmlBuilder(e,t){var n=K([`mspace`],[],t);return e.newLine&&(n.classes.push(`newline`),e.size&&(n.style.marginTop=P(Ad(e.size,t)))),n},mathmlBuilder(e,t){var n=new X(`mspace`);return e.newLine&&(n.setAttribute(`linebreak`,`newline`),e.size&&n.setAttribute(`height`,P(Ad(e.size,t)))),n}});var Cm={"\\global":`\\global`,"\\long":`\\\\globallong`,"\\\\globallong":`\\\\globallong`,"\\def":`\\gdef`,"\\gdef":`\\gdef`,"\\edef":`\\xdef`,"\\xdef":`\\xdef`,"\\let":`\\\\globallet`,"\\futurelet":`\\\\globalfuture`},wm=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new M(`Expected a control sequence`,e);return t},Tm=e=>{var t=e.gullet.popToken();return t.text===`=`&&(t=e.gullet.popToken(),t.text===` `&&(t=e.gullet.popToken())),t},Em=(e,t,n,r)=>{var i=e.gullet.macros.get(n.text);i??=(n.noexpand=!0,{tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,i,r)};J({type:`internal`,names:[`\\global`,`\\long`,`\\\\globallong`],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if(Cm[r.text])return(n===`\\global`||n===`\\\\globallong`)&&(r.text=Cm[r.text]),Q(t.parseFunction(),`internal`);throw new M(`Invalid token after macro prefix`,r)}}),J({type:`internal`,names:[`\\def`,`\\gdef`,`\\edef`,`\\xdef`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new M(`Expected a control sequence`,r);for(var a=0,o,s=[[]];t.gullet.future().text!==`{`;)if(r=t.gullet.popToken(),r.text===`#`){if(t.gullet.future().text===`{`){o=t.gullet.future(),s[a].push(`{`);break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new M(`Invalid argument number "`+r.text+`"`);if(parseInt(r.text)!==a+1)throw new M(`Argument number "`+r.text+`" out of order`);a++,s.push([])}else if(r.text===`EOF`)throw new M(`Expected a macro definition`);else s[a].push(r.text);var{tokens:c}=t.gullet.consumeArg();return o&&c.unshift(o),(n===`\\edef`||n===`\\xdef`)&&(c=t.gullet.expandTokens(c),c.reverse()),t.gullet.macros.set(i,{tokens:c,numArgs:a,delimiters:s},n===Cm[n]),{type:`internal`,mode:t.mode}}}),J({type:`internal`,names:[`\\let`,`\\\\globallet`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=wm(t.gullet.popToken());return t.gullet.consumeSpaces(),Em(t,r,Tm(t),n===`\\\\globallet`),{type:`internal`,mode:t.mode}}}),J({type:`internal`,names:[`\\futurelet`,`\\\\globalfuture`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=wm(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return Em(t,r,a,n===`\\\\globalfuture`),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:`internal`,mode:t.mode}}});var Dm=function(e,t,n){var r=Qd(tf.math[e]&&tf.math[e].replace||e,t,n);if(!r)throw Error(`Unsupported symbol `+e+` and font size `+t+`.`);return r},Om=function(e,t,n,r){var i=n.havingBaseStyle(t),a=K(r.concat(i.sizingClasses(n)),[e],n),o=i.sizeMultiplier/n.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=i.sizeMultiplier,a},km=function(e,t,n){var r=t.havingBaseStyle(n),i=(1-t.sizeMultiplier/r.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push(`delimcenter`),e.style.top=P(i),e.height-=i,e.depth+=i},Am=function(e,t,n,r,i,a){var o=Om(Hf(e,`Main-Regular`,i,r),t,r,a);return n&&km(o,r,t),o},jm=function(e,t,n,r){return Hf(e,`Size`+t+`-Regular`,n,r)},Mm=function(e,t,n,r,i,a){var o=jm(e,t,i,r),s=Om(K([`delimsizing`,`size`+t],[o],r),N.TEXT,r,a);return n&&km(s,r,N.TEXT),s},Nm=function(e,t,n){return{type:`elem`,elem:K([`delimsizinginner`,t===`Size1-Regular`?`delim-size1`:`delim-size4`],[K([],[Hf(e,t,n)])])}},Pm=function(e,t,n){var r=Jd[`Size4-Regular`][e.charCodeAt(0)]?Jd[`Size4-Regular`][e.charCodeAt(0)][4]:Jd[`Size1-Regular`][e.charCodeAt(0)][4],i=Yf([],[new Hd([new Ud(`inner`,Sd(e,Math.round(1e3*t)))],{width:P(r),height:P(t),style:`width:`+P(r),viewBox:`0 0 `+1e3*r+` `+Math.round(1e3*t),preserveAspectRatio:`xMinYMin`})],n);return i.height=t,i.style.height=P(t),i.style.width=P(r),{type:`elem`,elem:i}},Fm=.008,Im={type:`kern`,size:-1*Fm},Lm=new Set([`|`,`\\lvert`,`\\rvert`,`\\vert`]),Rm=new Set([`\\|`,`\\lVert`,`\\rVert`,`\\Vert`]),zm=function(e,t,n,r,i,a){var o,s,c,l,u=``,d=0;o=c=l=e,s=null;var f=`Size1-Regular`;e===`\\uparrow`?c=l=`⏐`:e===`\\Uparrow`?c=l=`‖`:e===`\\downarrow`?o=c=`⏐`:e===`\\Downarrow`?o=c=`‖`:e===`\\updownarrow`?(o=`\\uparrow`,c=`⏐`,l=`\\downarrow`):e===`\\Updownarrow`?(o=`\\Uparrow`,c=`‖`,l=`\\Downarrow`):Lm.has(e)?(c=`∣`,u=`vert`,d=333):Rm.has(e)?(c=`∥`,u=`doublevert`,d=556):e===`[`||e===`\\lbrack`?(o=`⎡`,c=`⎢`,l=`⎣`,f=`Size4-Regular`,u=`lbrack`,d=667):e===`]`||e===`\\rbrack`?(o=`⎤`,c=`⎥`,l=`⎦`,f=`Size4-Regular`,u=`rbrack`,d=667):e===`\\lfloor`||e===`⌊`?(c=o=`⎢`,l=`⎣`,f=`Size4-Regular`,u=`lfloor`,d=667):e===`\\lceil`||e===`⌈`?(o=`⎡`,c=l=`⎢`,f=`Size4-Regular`,u=`lceil`,d=667):e===`\\rfloor`||e===`⌋`?(c=o=`⎥`,l=`⎦`,f=`Size4-Regular`,u=`rfloor`,d=667):e===`\\rceil`||e===`⌉`?(o=`⎤`,c=l=`⎥`,f=`Size4-Regular`,u=`rceil`,d=667):e===`(`||e===`\\lparen`?(o=`⎛`,c=`⎜`,l=`⎝`,f=`Size4-Regular`,u=`lparen`,d=875):e===`)`||e===`\\rparen`?(o=`⎞`,c=`⎟`,l=`⎠`,f=`Size4-Regular`,u=`rparen`,d=875):e===`\\{`||e===`\\lbrace`?(o=`⎧`,s=`⎨`,l=`⎩`,c=`⎪`,f=`Size4-Regular`):e===`\\}`||e===`\\rbrace`?(o=`⎫`,s=`⎬`,l=`⎭`,c=`⎪`,f=`Size4-Regular`):e===`\\lgroup`||e===`⟮`?(o=`⎧`,l=`⎩`,c=`⎪`,f=`Size4-Regular`):e===`\\rgroup`||e===`⟯`?(o=`⎫`,l=`⎭`,c=`⎪`,f=`Size4-Regular`):e===`\\lmoustache`||e===`⎰`?(o=`⎧`,l=`⎭`,c=`⎪`,f=`Size4-Regular`):(e===`\\rmoustache`||e===`⎱`)&&(o=`⎫`,l=`⎩`,c=`⎪`,f=`Size4-Regular`);var p=Dm(o,f,i),m=p.height+p.depth,h=Dm(c,f,i),g=h.height+h.depth,_=Dm(l,f,i),v=_.height+_.depth,y=0,b=1;if(s!==null){var x=Dm(s,f,i);y=x.height+x.depth,b=2}var S=m+v+y,C=S+Math.max(0,Math.ceil((t-S)/(b*g)))*b*g,w=r.fontMetrics().axisHeight;n&&(w*=r.sizeMultiplier);var T=C/2-w,E=[];if(u.length>0){var ee=C-m-v,D=Math.round(C*1e3),te=wd(u,Math.round(ee*1e3)),ne=new Ud(u,te),re=P(d/1e3),ie=P(D/1e3),ae=Yf([],[new Hd([ne],{width:re,height:ie,viewBox:`0 0 `+d+` `+D})],r);ae.height=D/1e3,ae.style.width=re,ae.style.height=ie,E.push({type:`elem`,elem:ae})}else{if(E.push(Nm(l,f,i)),E.push(Im),s===null){var oe=C-m-v+2*Fm;E.push(Pm(c,oe,r))}else{var se=(C-m-v-y)/2+2*Fm;E.push(Pm(c,se,r)),E.push(Im),E.push(Nm(s,f,i)),E.push(Im),E.push(Pm(c,se,r))}E.push(Im),E.push(Nm(o,f,i))}var ce=r.havingBaseStyle(N.TEXT);return Om(K([`delimsizing`,`mult`],[q({positionType:`bottom`,positionData:T,children:E})],ce),N.TEXT,r,a)},Bm=80,Vm=.08,Hm=function(e,t,n,r,i){return Yf([`hide-tail`],[new Hd([new Ud(e,xd(e,r,n))],{width:`400em`,height:P(t),viewBox:`0 0 400000 `+n,preserveAspectRatio:`xMinYMin slice`})],i)},Um=function(e,t){var n=t.havingBaseSizing(),r=$m(`\\surd`,e*n.sizeMultiplier,Zm,n),i=n.sizeMultiplier,a=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),o,s,c,l,u;return r.type===`small`?(l=1e3+1e3*a+Bm,e<1?i=1:e<1.4&&(i=.7),s=(1+a+Vm)/i,c=(1+a)/i,o=Hm(`sqrtMain`,s,l,a,t),o.style.minWidth=`0.853em`,u=.833/i):r.type===`large`?(l=(1e3+Bm)*qm[r.size],c=(qm[r.size]+a)/i,s=(qm[r.size]+a+Vm)/i,o=Hm(`sqrtSize`+r.size,s,l,a,t),o.style.minWidth=`1.02em`,u=1/i):(s=e+a+Vm,c=e+a,l=Math.floor(1e3*e+a)+Bm,o=Hm(`sqrtTall`,s,l,a,t),o.style.minWidth=`0.742em`,u=1.056),o.height=c,o.style.height=P(s),{span:o,advanceWidth:u,ruleWidth:(t.fontMetrics().sqrtRuleThickness+a)*i}},Wm=new Set([`(`,`\\lparen`,`)`,`\\rparen`,`[`,`\\lbrack`,`]`,`\\rbrack`,`\\{`,`\\lbrace`,`\\}`,`\\rbrace`,`\\lfloor`,`\\rfloor`,`⌊`,`⌋`,`\\lceil`,`\\rceil`,`⌈`,`⌉`,`\\surd`]),Gm=new Set([`\\uparrow`,`\\downarrow`,`\\updownarrow`,`\\Uparrow`,`\\Downarrow`,`\\Updownarrow`,`|`,`\\|`,`\\vert`,`\\Vert`,`\\lvert`,`\\rvert`,`\\lVert`,`\\rVert`,`\\lgroup`,`\\rgroup`,`⟮`,`⟯`,`\\lmoustache`,`\\rmoustache`,`⎰`,`⎱`]),Km=new Set([`<`,`>`,`\\langle`,`\\rangle`,`/`,`\\backslash`,`\\lt`,`\\gt`]),qm=[0,1.2,1.8,2.4,3],Jm=function(e,t,n,r,i){if(e===`<`||e===`\\lt`||e===`⟨`?e=`\\langle`:(e===`>`||e===`\\gt`||e===`⟩`)&&(e=`\\rangle`),Wm.has(e)||Km.has(e))return Mm(e,t,!1,n,r,i);if(Gm.has(e))return zm(e,qm[t],!1,n,r,i);throw new M(`Illegal delimiter: '`+e+`'`)},Ym=[{type:`small`,style:N.SCRIPTSCRIPT},{type:`small`,style:N.SCRIPT},{type:`small`,style:N.TEXT},{type:`large`,size:1},{type:`large`,size:2},{type:`large`,size:3},{type:`large`,size:4}],Xm=[{type:`small`,style:N.SCRIPTSCRIPT},{type:`small`,style:N.SCRIPT},{type:`small`,style:N.TEXT},{type:`stack`}],Zm=[{type:`small`,style:N.SCRIPTSCRIPT},{type:`small`,style:N.SCRIPT},{type:`small`,style:N.TEXT},{type:`large`,size:1},{type:`large`,size:2},{type:`large`,size:3},{type:`large`,size:4},{type:`stack`}],Qm=function(e){if(e.type===`small`)return`Main-Regular`;if(e.type===`large`)return`Size`+e.size+`-Regular`;if(e.type===`stack`)return`Size4-Regular`;var t=e.type;throw Error(`Add support for delim type '`+t+`' here.`)},$m=function(e,t,n,r){for(var i=Math.min(2,3-r.style.size);it)return a}return n[n.length-1]},eh=function(e,t,n,r,i,a){e===`<`||e===`\\lt`||e===`⟨`?e=`\\langle`:(e===`>`||e===`\\gt`||e===`⟩`)&&(e=`\\rangle`);var o=Km.has(e)?Ym:Wm.has(e)?Zm:Xm,s=$m(e,t,o,r);return s.type===`small`?Am(e,s.style,n,r,i,a):s.type===`large`?Mm(e,s.size,n,r,i,a):zm(e,t,n,r,i,a)},th=function(e,t,n,r,i,a){var o=r.fontMetrics().axisHeight*r.sizeMultiplier,s=901,c=5/r.fontMetrics().ptPerEm,l=Math.max(t-o,n+o);return eh(e,Math.max(l/500*s,2*l-c),!0,r,i,a)},nh={"\\bigl":{mclass:`mopen`,size:1},"\\Bigl":{mclass:`mopen`,size:2},"\\biggl":{mclass:`mopen`,size:3},"\\Biggl":{mclass:`mopen`,size:4},"\\bigr":{mclass:`mclose`,size:1},"\\Bigr":{mclass:`mclose`,size:2},"\\biggr":{mclass:`mclose`,size:3},"\\Biggr":{mclass:`mclose`,size:4},"\\bigm":{mclass:`mrel`,size:1},"\\Bigm":{mclass:`mrel`,size:2},"\\biggm":{mclass:`mrel`,size:3},"\\Biggm":{mclass:`mrel`,size:4},"\\big":{mclass:`mord`,size:1},"\\Big":{mclass:`mord`,size:2},"\\bigg":{mclass:`mord`,size:3},"\\Bigg":{mclass:`mord`,size:4}},rh=new Set(`(,\\lparen,),\\rparen,[,\\lbrack,],\\rbrack,\\{,\\lbrace,\\},\\rbrace,\\lfloor,\\rfloor,⌊,⌋,\\lceil,\\rceil,⌈,⌉,<,>,\\langle,⟨,\\rangle,⟩,\\lt,\\gt,\\lvert,\\rvert,\\lVert,\\rVert,\\lgroup,\\rgroup,⟮,⟯,\\lmoustache,\\rmoustache,⎰,⎱,/,\\backslash,|,\\vert,\\|,\\Vert,\\uparrow,\\Uparrow,\\downarrow,\\Downarrow,\\updownarrow,\\Updownarrow,.`.split(`,`));function ih(e){return`isMiddle`in e}function ah(e,t){var n=om(e);if(n&&rh.has(n.text))return n;throw n?new M(`Invalid delimiter '`+n.text+`' after '`+t.funcName+`'`,e):new M(`Invalid delimiter type '`+e.type+`'`,e)}J({type:`delimsizing`,names:[`\\bigl`,`\\Bigl`,`\\biggl`,`\\Biggl`,`\\bigr`,`\\Bigr`,`\\biggr`,`\\Biggr`,`\\bigm`,`\\Bigm`,`\\biggm`,`\\Biggm`,`\\big`,`\\Big`,`\\bigg`,`\\Bigg`],props:{numArgs:1,argTypes:[`primitive`]},handler:(e,t)=>{var n=ah(t[0],e);return{type:`delimsizing`,mode:e.parser.mode,size:nh[e.funcName].size,mclass:nh[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim===`.`?K([e.mclass]):Jm(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!==`.`&&t.push(Pp(e.delim,e.mode));var n=new X(`mo`,t);e.mclass===`mopen`||e.mclass===`mclose`?n.setAttribute(`fence`,`true`):n.setAttribute(`fence`,`false`),n.setAttribute(`stretchy`,`true`);var r=P(qm[e.size]);return n.setAttribute(`minsize`,r),n.setAttribute(`maxsize`,r),n}});function oh(e){if(!e.body)throw Error(`Bug: The leftright ParseNode wasn't fully parsed.`)}J({type:`leftright-right`,names:[`\\right`],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get(`\\current@color`);if(n&&typeof n!=`string`)throw new M(`\\current@color set to non-string in \\right`);return{type:`leftright-right`,mode:e.parser.mode,delim:ah(t[0],e).text,color:n}}}),J({type:`leftright`,names:[`\\left`],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=ah(t[0],e),r=e.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect(`\\right`,!1);var a=Q(r.parseFunction(),`leftright-right`);return{type:`leftright`,mode:r.mode,body:i,left:n.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{oh(e);for(var n=xp(e.body,t,!0,[`mopen`,`mclose`]),r=0,i=0,a=!1,o=0;o{oh(e);var n=zp(e.body,t);if(e.left!==`.`){var r=new X(`mo`,[Pp(e.left,e.mode)]);r.setAttribute(`fence`,`true`),n.unshift(r)}if(e.right!==`.`){var i=new X(`mo`,[Pp(e.right,e.mode)]);i.setAttribute(`fence`,`true`),e.rightColor&&i.setAttribute(`mathcolor`,e.rightColor),n.push(i)}return Fp(n)}}),J({type:`middle`,names:[`\\middle`],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=ah(t[0],e);if(!e.parser.leftrightDepth)throw new M(`\\middle without preceding \\left`,n);return{type:`middle`,mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim===`.`?n=Ep(t,[]):(n=Jm(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=new X(`mo`,[e.delim===`\\vert`||e.delim===`|`?Pp(`|`,`text`):Pp(e.delim,e.mode)]);return n.setAttribute(`fence`,`true`),n.setAttribute(`lspace`,`0.05em`),n.setAttribute(`rspace`,`0.05em`),n}});var sh=(e,t)=>{var n=$f(Y(e.body,t),t),r=e.label.slice(1),i=t.sizeMultiplier,a,o,s=zu(e.body);if(r===`sout`)a=K([`stretchy`,`sout`]),a.height=t.fontMetrics().defaultRuleThickness/i,o=-.5*t.fontMetrics().xHeight;else if(r===`phase`){var c=Ad({number:.6,unit:`pt`},t),l=Ad({number:.35,unit:`ex`},t),u=t.havingBaseSizing();i/=u.sizeMultiplier;var d=n.height+n.depth+c+l;n.style.paddingLeft=P(d/2+c);var f=Math.floor(1e3*d*i);a=Yf([`hide-tail`],[new Hd([new Ud(`phase`,yd(f))],{width:`400em`,height:P(f/1e3),viewBox:`0 0 400000 `+f,preserveAspectRatio:`xMinYMin slice`})],t),a.style.height=P(d),o=n.depth+c+l}else{/cancel/.test(r)?s||n.classes.push(`cancel-pad`):r===`angl`?n.classes.push(`anglpad`):n.classes.push(`boxpad`);var p,m,h=0;/box/.test(r)?(h=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),p=t.fontMetrics().fboxsep+(r===`colorbox`?0:h),m=p):r===`angl`?(h=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),p=4*h,m=Math.max(0,.25-n.depth)):(p=s?.2:0,m=p),a=tm(n,r,p,m,t),/fbox|boxed|fcolorbox/.test(r)?(a.style.borderStyle=`solid`,a.style.borderWidth=P(h)):r===`angl`&&h!==.049&&(a.style.borderTopWidth=P(h),a.style.borderRightWidth=P(h)),o=n.depth+m,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var g;if(e.backgroundColor)g=q({positionType:`individualShift`,children:[{type:`elem`,elem:a,shift:o},{type:`elem`,elem:n,shift:0}]});else{var _=/cancel|phase/.test(r)?[`svg-align`]:[];g=q({positionType:`individualShift`,children:[{type:`elem`,elem:n,shift:0},{type:`elem`,elem:a,shift:o,wrapperClasses:_}]})}return/cancel/.test(r)&&(g.height=n.height,g.depth=n.depth),/cancel/.test(r)&&!s?K([`mord`,`cancel-lap`],[g],t):K([`mord`],[g],t)},ch=(e,t)=>{var n,r=new X(e.label.includes(`colorbox`)?`mpadded`:`menclose`,[Z(e.body,t)]);switch(e.label){case`\\cancel`:r.setAttribute(`notation`,`updiagonalstrike`);break;case`\\bcancel`:r.setAttribute(`notation`,`downdiagonalstrike`);break;case`\\phase`:r.setAttribute(`notation`,`phasorangle`);break;case`\\sout`:r.setAttribute(`notation`,`horizontalstrike`);break;case`\\fbox`:r.setAttribute(`notation`,`box`);break;case`\\angl`:r.setAttribute(`notation`,`actuarial`);break;case`\\fcolorbox`:case`\\colorbox`:if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute(`width`,`+`+2*n+`pt`),r.setAttribute(`height`,`+`+2*n+`pt`),r.setAttribute(`lspace`,n+`pt`),r.setAttribute(`voffset`,n+`pt`),e.label===`\\fcolorbox`){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute(`style`,`border: `+P(i)+` solid `+e.borderColor)}break;case`\\xcancel`:r.setAttribute(`notation`,`updiagonalstrike downdiagonalstrike`)}return e.backgroundColor&&r.setAttribute(`mathbackground`,e.backgroundColor),r};J({type:`enclose`,names:[`\\colorbox`],props:{numArgs:2,allowedInText:!0,argTypes:[`color`,`hbox`]},handler(e,t,n){var{parser:r,funcName:i}=e,a=Q(t[0],`color-token`).color,o=t[1];return{type:`enclose`,mode:r.mode,label:i,backgroundColor:a,body:o}},htmlBuilder:sh,mathmlBuilder:ch}),J({type:`enclose`,names:[`\\fcolorbox`],props:{numArgs:3,allowedInText:!0,argTypes:[`color`,`color`,`hbox`]},handler(e,t,n){var{parser:r,funcName:i}=e,a=Q(t[0],`color-token`).color,o=Q(t[1],`color-token`).color,s=t[2];return{type:`enclose`,mode:r.mode,label:i,backgroundColor:o,borderColor:a,body:s}},htmlBuilder:sh,mathmlBuilder:ch}),J({type:`enclose`,names:[`\\fbox`],props:{numArgs:1,argTypes:[`hbox`],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:`enclose`,mode:n.mode,label:`\\fbox`,body:t[0]}}}),J({type:`enclose`,names:[`\\cancel`,`\\bcancel`,`\\xcancel`,`\\phase`],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:`enclose`,mode:n.mode,label:r,body:i}},htmlBuilder:sh,mathmlBuilder:ch}),J({type:`enclose`,names:[`\\sout`],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e;n.mode===`math`&&n.settings.reportNonstrict(`mathVsSout`,`LaTeX's \\sout works only in text mode`);var i=t[0];return{type:`enclose`,mode:n.mode,label:r,body:i}},htmlBuilder:sh,mathmlBuilder:ch}),J({type:`enclose`,names:[`\\angl`],props:{numArgs:1,argTypes:[`hbox`],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:`enclose`,mode:n.mode,label:`\\angl`,body:t[0]}}});var lh={};function uh(e){for(var{type:t,names:n,props:r,handler:i,htmlBuilder:a,mathmlBuilder:o}=e,s={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},c=0;c{if(!e.parser.settings.displayMode)throw new M(`{`+e.envName+`} can be used only in display mode.`)},gh=new Set([`gather`,`gather*`]);function _h(e){if(!e.includes(`ed`))return!e.includes(`*`)}function vh(e,t,n){var{hskipBeforeAndAfter:r,addJot:i,cols:a,arraystretch:o,colSeparationType:s,autoTag:c,singleRow:l,emptySingleRow:u,maxNumCols:d,leqno:f}=t;if(e.gullet.beginGroup(),l||e.gullet.macros.set(`\\cr`,`\\\\\\relax`),!o){var p=e.gullet.expandMacroAsText(`\\arraystretch`);if(p==null)o=1;else if(o=parseFloat(p),!o||o<0)throw new M(`Invalid \\arraystretch: `+p)}e.gullet.beginGroup();var m=[],h=[m],g=[],_=[],v=c==null?void 0:[];function y(){c&&e.gullet.macros.set(`\\@eqnsw`,`1`,!0)}function b(){v&&(e.gullet.macros.get(`\\df@tag`)?(v.push(e.subparse([new ph(`\\df@tag`)])),e.gullet.macros.set(`\\df@tag`,void 0,!0)):v.push(!!c&&e.gullet.macros.get(`\\@eqnsw`)===`1`))}for(y(),_.push(mh(e));;){var x=e.parseExpression(!1,l?`\\end`:`\\\\`);e.gullet.endGroup(),e.gullet.beginGroup();var S={type:`ordgroup`,mode:e.mode,body:x};n&&(S={type:`styling`,mode:e.mode,style:n,resetFont:!0,body:[S]}),m.push(S);var C=e.fetch().text;if(C===`&`){if(d&&m.length===d){if(l||s)throw new M(`Too many tab characters: &`,e.nextToken);e.settings.reportNonstrict(`textEnv`,`Too few columns specified in the {array} column argument.`)}e.consume()}else if(C===`\\end`){b(),m.length===1&&S.type===`styling`&&S.body.length===1&&S.body[0].type===`ordgroup`&&S.body[0].body.length===0&&(h.length>1||!u)&&h.pop(),_.length0&&(_+=.25),c.push({pos:_,isDashed:e[t]})}for(v(a[0]),n=0;n0&&(T+=g,xe))for(n=0;n=o)){var me=void 0;(r>0||e.hskipBeforeAndAfter)&&(me=ce?.pregap??d,me!==0&&(te=K([`arraycolsep`],[]),te.style.width=P(me),D.push(te)));var he=[];for(n=0;n0){for(var Se=Xf(`hline`,t,l),Ce=Xf(`hdashline`,t,l),we=[{type:`elem`,elem:xe,shift:0}];c.length>0;){var Te=c.pop(),Ee=Te.pos-E;Te.isDashed?we.push({type:`elem`,elem:Ce,shift:Ee}):we.push({type:`elem`,elem:Se,shift:Ee})}xe=q({positionType:`individualShift`,children:we})}if(re.length===0)return K([`mord`],[xe],t);var De=K([`tag`],[q({positionType:`individualShift`,children:re})],t);return Qf([xe,De])},xh={c:`center `,l:`left `,r:`right `},Sh=function(e,t){for(var n=[],r=new X(`mtd`,[],[`mtr-glue`]),i=new X(`mtd`,[],[`mml-eqn-num`]),a=0;a0){var p=e.cols,m=``,h=!1,g=0,_=p.length;p[0].type===`separator`&&(d+=`top `,g=1),p[p.length-1].type===`separator`&&(d+=`bottom `,--_);for(var v=g;v<_;v++){var y=p[v];y.type===`align`?(f+=xh[y.align],h&&(m+=`none `),h=!0):y.type===`separator`&&(h&&=(m+=y.separator===`|`?`solid `:`dashed `,!1))}l.setAttribute(`columnalign`,f.trim()),/[sd]/.test(m)&&l.setAttribute(`columnlines`,m.trim())}if(e.colSeparationType===`align`){for(var b=e.cols||[],x=``,S=1;S0?`left `:``,d+=w[w.length-1].length>0?`right `:``;for(var T=1;T0&&f&&(h=1),n[p]={type:`align`,align:m,pregap:h,postgap:0}}return a.colSeparationType=f?`align`:`alignat`,a};uh({type:`array`,names:[`array`,`darray`],props:{numArgs:1},handler(e,t){var n=(om(t[0])?[t[0]]:Q(t[0],`ordgroup`).body).map(function(e){var t=am(e).text;if(`lcr`.includes(t))return{type:`align`,align:t};if(t===`|`)return{type:`separator`,separator:`|`};if(t===`:`)return{type:`separator`,separator:`:`};throw new M(`Unknown column alignment: `+t,e)}),r={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return vh(e.parser,r,yh(e.envName))},htmlBuilder:bh,mathmlBuilder:Sh}),uh({type:`array`,names:[`matrix`,`pmatrix`,`bmatrix`,`Bmatrix`,`vmatrix`,`Vmatrix`,`matrix*`,`pmatrix*`,`bmatrix*`,`Bmatrix*`,`vmatrix*`,`Vmatrix*`],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:[`(`,`)`],bmatrix:[`[`,`]`],Bmatrix:[`\\{`,`\\}`],vmatrix:[`|`,`|`],Vmatrix:[`\\Vert`,`\\Vert`]}[e.envName.replace(`*`,``)],n=`c`,r={hskipBeforeAndAfter:!1,cols:[{type:`align`,align:n}]};if(e.envName.charAt(e.envName.length-1)===`*`){var i=e.parser;if(i.consumeSpaces(),i.fetch().text===`[`){if(i.consume(),i.consumeSpaces(),n=i.fetch().text,!`lcr`.includes(n))throw new M(`Expected l or c or r`,i.nextToken);i.consume(),i.consumeSpaces(),i.expect(`]`),i.consume(),r.cols=[{type:`align`,align:n}]}}var a=vh(e.parser,r,yh(e.envName)),o=Math.max(0,...a.body.map(e=>e.length));return a.cols=Array(o).fill({type:`align`,align:n}),t?{type:`leftright`,mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:bh,mathmlBuilder:Sh}),uh({type:`array`,names:[`smallmatrix`],props:{numArgs:0},handler(e){var t=vh(e.parser,{arraystretch:.5},`script`);return t.colSeparationType=`small`,t},htmlBuilder:bh,mathmlBuilder:Sh}),uh({type:`array`,names:[`subarray`],props:{numArgs:1},handler(e,t){var n=(om(t[0])?[t[0]]:Q(t[0],`ordgroup`).body).map(function(e){var t=am(e).text;if(`lc`.includes(t))return{type:`align`,align:t};throw new M(`Unknown column alignment: `+t,e)});if(n.length>1)throw new M(`{subarray} can contain only one column`);var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5},i=vh(e.parser,r,`script`);if(i.body.length>0&&i.body[0].length>1)throw new M(`{subarray} can contain only one column`);return i},htmlBuilder:bh,mathmlBuilder:Sh}),uh({type:`array`,names:[`cases`,`dcases`,`rcases`,`drcases`],props:{numArgs:0},handler(e){var t=vh(e.parser,{arraystretch:1.2,cols:[{type:`align`,align:`l`,pregap:0,postgap:1},{type:`align`,align:`l`,pregap:0,postgap:0}]},yh(e.envName));return{type:`leftright`,mode:e.mode,body:[t],left:e.envName.includes(`r`)?`.`:`\\{`,right:e.envName.includes(`r`)?`\\}`:`.`,rightColor:void 0}},htmlBuilder:bh,mathmlBuilder:Sh}),uh({type:`array`,names:[`align`,`align*`,`aligned`,`split`],props:{numArgs:0},handler:Ch,htmlBuilder:bh,mathmlBuilder:Sh}),uh({type:`array`,names:[`gathered`,`gather`,`gather*`],props:{numArgs:0},handler(e){gh.has(e.envName)&&hh(e);var t={cols:[{type:`align`,align:`c`}],addJot:!0,colSeparationType:`gather`,autoTag:_h(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return vh(e.parser,t,`display`)},htmlBuilder:bh,mathmlBuilder:Sh}),uh({type:`array`,names:[`alignat`,`alignat*`,`alignedat`],props:{numArgs:1},handler:Ch,htmlBuilder:bh,mathmlBuilder:Sh}),uh({type:`array`,names:[`equation`,`equation*`],props:{numArgs:0},handler(e){hh(e);var t={autoTag:_h(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return vh(e.parser,t,`display`)},htmlBuilder:bh,mathmlBuilder:Sh}),uh({type:`array`,names:[`CD`],props:{numArgs:0},handler(e){return hh(e),bm(e.parser)},htmlBuilder:bh,mathmlBuilder:Sh}),$(`\\nonumber`,`\\gdef\\@eqnsw{0}`),$(`\\notag`,`\\nonumber`),J({type:`text`,names:[`\\hline`,`\\hdashline`],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new M(e.funcName+` valid only within array environment`)}});var wh=lh;J({type:`environment`,names:[`\\begin`,`\\end`],props:{numArgs:1,argTypes:[`text`]},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];if(i.type!==`ordgroup`)throw new M(`Invalid environment name`,i);for(var a=``,o=0;o{var n=e.font,r=t.withFont(n);return Y(e.body,r)},Eh=(e,t)=>{var n=e.font,r=t.withFont(n);return Z(e.body,r)},Dh={"\\Bbb":`\\mathbb`,"\\bold":`\\mathbf`,"\\frak":`\\mathfrak`};J({type:`font`,names:[`\\mathrm`,`\\mathit`,`\\mathbf`,`\\mathnormal`,`\\mathsfit`,`\\mathbb`,`\\mathcal`,`\\mathfrak`,`\\mathscr`,`\\mathsf`,`\\mathtt`,`\\Bbb`,`\\bold`,`\\frak`],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=hp(t[0]),a=r;return a in Dh&&(a=Dh[a]),{type:`font`,mode:n.mode,font:a.slice(1),body:i}},htmlBuilder:Th,mathmlBuilder:Eh}),J({type:`mclass`,names:[`\\boldsymbol`,`\\bm`],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:`mclass`,mode:n.mode,mclass:mm(r),body:[{type:`font`,mode:n.mode,font:`boldsymbol`,body:r}],isCharacterBox:zu(r)}}}),J({type:`font`,names:[`\\rm`,`\\sf`,`\\tt`,`\\bf`,`\\it`,`\\cal`],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:i}=e,{mode:a}=n,o=n.parseExpression(!0,i);return{type:`font`,mode:a,font:`math`+r.slice(1),body:{type:`ordgroup`,mode:n.mode,body:o}}},htmlBuilder:Th,mathmlBuilder:Eh});var Oh=(e,t)=>{var n=t.style,r=n.fracNum(),i=n.fracDen(),a=t.havingStyle(r),o=Y(e.numer,a,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,c=3.5/t.fontMetrics().ptPerEm;o.height=o.height0?3*f:7*f,h=t.fontMetrics().denom1):(d>0?(p=t.fontMetrics().num2,m=f):(p=t.fontMetrics().num3,m=3*f),h=t.fontMetrics().denom2);var g;if(u){var _=t.fontMetrics().axisHeight;p-o.depth-(_+.5*d){var n=new X(`mfrac`,[Z(e.numer,t),Z(e.denom,t)]);if(!e.hasBarLine)n.setAttribute(`linethickness`,`0px`);else if(e.barSize){var r=Ad(e.barSize,t);n.setAttribute(`linethickness`,P(r))}if(e.leftDelim!=null||e.rightDelim!=null){var i=[];if(e.leftDelim!=null){var a=new X(`mo`,[new Ap(e.leftDelim.replace(`\\`,``))]);a.setAttribute(`fence`,`true`),i.push(a)}if(i.push(n),e.rightDelim!=null){var o=new X(`mo`,[new Ap(e.rightDelim.replace(`\\`,``))]);o.setAttribute(`fence`,`true`),i.push(o)}return Fp(i)}return n},Ah=(e,t)=>t?{type:`styling`,mode:e.mode,style:t,body:[e]}:e;J({type:`genfrac`,names:[`\\cfrac`,`\\dfrac`,`\\frac`,`\\tfrac`,`\\dbinom`,`\\binom`,`\\tbinom`,`\\\\atopfrac`,`\\\\bracefrac`,`\\\\brackfrac`],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0],a=t[1],o,s=null,c=null;switch(r){case`\\cfrac`:case`\\dfrac`:case`\\frac`:case`\\tfrac`:o=!0;break;case`\\\\atopfrac`:o=!1;break;case`\\dbinom`:case`\\binom`:case`\\tbinom`:o=!1,s=`(`,c=`)`;break;case`\\\\bracefrac`:o=!1,s=`\\{`,c=`\\}`;break;case`\\\\brackfrac`:o=!1,s=`[`,c=`]`;break;default:throw Error(`Unrecognized genfrac command`)}var l=r===`\\cfrac`,u=null;return l||r.startsWith(`\\d`)?u=`display`:r.startsWith(`\\t`)&&(u=`text`),Ah({type:`genfrac`,mode:n.mode,numer:i,denom:a,continued:l,hasBarLine:o,leftDelim:s,rightDelim:c,barSize:null},u)},htmlBuilder:Oh,mathmlBuilder:kh}),J({type:`infix`,names:[`\\over`,`\\choose`,`\\atop`,`\\brace`,`\\brack`],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:r}=e,i;switch(n){case`\\over`:i=`\\frac`;break;case`\\choose`:i=`\\binom`;break;case`\\atop`:i=`\\\\atopfrac`;break;case`\\brace`:i=`\\\\bracefrac`;break;case`\\brack`:i=`\\\\brackfrac`;break;default:throw Error(`Unrecognized infix genfrac command`)}return{type:`infix`,mode:t.mode,replaceWith:i,token:r}}});var jh=[`display`,`text`,`script`,`scriptscript`],Mh=function(e){var t=null;return e.length>0&&(t=e,t=t===`.`?null:t),t};J({type:`genfrac`,names:[`\\genfrac`],props:{numArgs:6,allowedInArgument:!0,argTypes:[`math`,`math`,`size`,`text`,`math`,`math`]},handler(e,t){var{parser:n}=e,r=t[4],i=t[5],a=hp(t[0]),o=a.type===`atom`&&a.family===`open`?Mh(a.text):null,s=hp(t[1]),c=s.type===`atom`&&s.family===`close`?Mh(s.text):null,l=Q(t[2],`size`),u,d=null;l.isBlank?u=!0:(d=l.value,u=d.number>0);var f=null,p=t[3];if(p.type===`ordgroup`){if(p.body.length>0){var m=Q(p.body[0],`textord`);f=jh[Number(m.text)]}}else p=Q(p,`textord`),f=jh[Number(p.text)];return Ah({type:`genfrac`,mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:u,barSize:d,leftDelim:o,rightDelim:c},f)}}),J({type:`infix`,names:[`\\above`],props:{numArgs:1,argTypes:[`size`],infix:!0},handler(e,t){var{parser:n,funcName:r,token:i}=e;return{type:`infix`,mode:n.mode,replaceWith:`\\\\abovefrac`,size:Q(t[0],`size`).value,token:i}}}),J({type:`genfrac`,names:[`\\\\abovefrac`],props:{numArgs:3,argTypes:[`math`,`size`,`math`]},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0],a=Q(t[1],`infix`).size;if(!a)throw Error(`\\\\abovefrac expected size, but got `+String(a));var o=t[2],s=a.number>0;return{type:`genfrac`,mode:n.mode,numer:i,denom:o,continued:!1,hasBarLine:s,barSize:a,leftDelim:null,rightDelim:null}}});var Nh=(e,t)=>{var n=t.style,r,i;e.type===`supsub`?(r=e.sup?Y(e.sup,t.havingStyle(n.sup()),t):Y(e.sub,t.havingStyle(n.sub()),t),i=Q(e.base,`horizBrace`)):i=Q(e,`horizBrace`);var a=Y(i.base,t.havingBaseStyle(N.DISPLAY)),o=em(i,t),s=i.isOver?q({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`kern`,size:.1},{type:`elem`,elem:o,wrapperClasses:[`svg-align`]}]}):q({positionType:`bottom`,positionData:a.depth+.1+o.height,children:[{type:`elem`,elem:o,wrapperClasses:[`svg-align`]},{type:`kern`,size:.1},{type:`elem`,elem:a}]});if(r){var c=K([`minner`,i.isOver?`mover`:`munder`],[s],t);s=i.isOver?q({positionType:`firstBaseline`,children:[{type:`elem`,elem:c},{type:`kern`,size:.2},{type:`elem`,elem:r}]}):q({positionType:`bottom`,positionData:c.depth+.2+r.height+r.depth,children:[{type:`elem`,elem:r},{type:`kern`,size:.2},{type:`elem`,elem:c}]})}return K([`minner`,i.isOver?`mover`:`munder`],[s],t)};J({type:`horizBrace`,names:[`\\overbrace`,`\\underbrace`,`\\overbracket`,`\\underbracket`],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:`horizBrace`,mode:n.mode,label:r,isOver:r.includes(`\\over`),base:t[0]}},htmlBuilder:Nh,mathmlBuilder:(e,t)=>{var n=Zp(e.label);return new X(e.isOver?`mover`:`munder`,[Z(e.base,t),n])}}),J({type:`href`,names:[`\\href`],props:{numArgs:2,argTypes:[`url`,`original`],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],i=Q(t[0],`url`).url;return n.settings.isTrusted({command:`\\href`,url:i})?{type:`href`,mode:n.mode,href:i,body:gp(r)}:n.formatUnsupportedCmd(`\\href`)},htmlBuilder:(e,t)=>{var n=xp(e.body,t,!1);return Zf(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Bp(e.body,t);return n instanceof X||(n=new X(`mrow`,[n])),n.setAttribute(`href`,e.href),n}}),J({type:`href`,names:[`\\url`],props:{numArgs:1,argTypes:[`url`],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=Q(t[0],`url`).url;if(!n.settings.isTrusted({command:`\\url`,url:r}))return n.formatUnsupportedCmd(`\\url`);for(var i=[],a=0;a{var{parser:n,funcName:r,token:i}=e,a=Q(t[0],`raw`).string,o=t[1];n.settings.strict&&n.settings.reportNonstrict(`htmlExtension`,`HTML extension is disabled on strict mode`);var s,c={};switch(r){case`\\htmlClass`:c.class=a,s={command:`\\htmlClass`,class:a};break;case`\\htmlId`:c.id=a,s={command:`\\htmlId`,id:a};break;case`\\htmlStyle`:c.style=a,s={command:`\\htmlStyle`,style:a};break;case`\\htmlData`:for(var l=a.split(`,`),u=0;u{var n=xp(e.body,t,!1),r=[`enclosing`];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var i=K(r,n,t);for(var a in e.attributes)a!==`class`&&e.attributes.hasOwnProperty(a)&&i.setAttribute(a,e.attributes[a]);return i},mathmlBuilder:(e,t)=>Bp(e.body,t)}),J({type:`htmlmathml`,names:[`\\html@mathml`],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:`htmlmathml`,mode:n.mode,html:gp(t[0]),mathml:gp(t[1])}},htmlBuilder:(e,t)=>Qf(xp(e.html,t,!1)),mathmlBuilder:(e,t)=>Bp(e.mathml,t)});var Ph=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:`bp`};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new M(`Invalid size: '`+e+`' in \\includegraphics`);var n={number:+(t[1]+t[2]),unit:t[3]};if(!kd(n))throw new M(`Invalid unit: '`+n.unit+`' in \\includegraphics.`);return n};J({type:`includegraphics`,names:[`\\includegraphics`],props:{numArgs:1,numOptionalArgs:1,argTypes:[`raw`,`url`],allowedInText:!1},handler:(e,t,n)=>{var{parser:r}=e,i={number:0,unit:`em`},a={number:.9,unit:`em`},o={number:0,unit:`em`},s=``;if(n[0])for(var c=Q(n[0],`raw`).string.split(`,`),l=0;l{var n=Ad(e.height,t),r=0;e.totalheight.number>0&&(r=Ad(e.totalheight,t)-n);var i=0;e.width.number>0&&(i=Ad(e.width,t));var a={height:P(n+r)};i>0&&(a.width=P(i)),r>0&&(a.verticalAlign=P(-r));var o=new zd(e.src,e.alt,a);return o.height=n,o.depth=r,o},mathmlBuilder:(e,t)=>{var n=new X(`mglyph`,[]);n.setAttribute(`alt`,e.alt);var r=Ad(e.height,t),i=0;if(e.totalheight.number>0&&(i=Ad(e.totalheight,t)-r,n.setAttribute(`valign`,P(-i))),n.setAttribute(`height`,P(r+i)),e.width.number>0){var a=Ad(e.width,t);n.setAttribute(`width`,P(a))}return n.setAttribute(`src`,e.src),n}}),J({type:`kern`,names:[`\\kern`,`\\mkern`,`\\hskip`,`\\mskip`],props:{numArgs:1,argTypes:[`size`],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,i=Q(t[0],`size`);if(n.settings.strict){var a=r[1]===`m`,o=i.value.unit===`mu`;a?(o||n.settings.reportNonstrict(`mathVsTextUnits`,`LaTeX's `+r+` supports only mu units, `+(`not `+i.value.unit+` units`)),n.mode!==`math`&&n.settings.reportNonstrict(`mathVsTextUnits`,`LaTeX's `+r+` works only in math mode`)):o&&n.settings.reportNonstrict(`mathVsTextUnits`,`LaTeX's `+r+` doesn't support mu units`)}return{type:`kern`,mode:n.mode,dimension:i.value}},htmlBuilder(e,t){return tp(e.dimension,t)},mathmlBuilder(e,t){return new jp(Ad(e.dimension,t))}}),J({type:`lap`,names:[`\\mathllap`,`\\mathrlap`,`\\mathclap`],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=t[0];return{type:`lap`,mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:(e,t)=>{var n;e.alignment===`clap`?(n=K([],[Y(e.body,t)]),n=K([`inner`],[n],t)):n=K([`inner`],[Y(e.body,t)]);var r=K([`fix`],[]),i=K([e.alignment],[n,r],t),a=K([`strut`]);return a.style.height=P(i.height+i.depth),i.depth&&(a.style.verticalAlign=P(-i.depth)),i.children.unshift(a),i=K([`thinbox`],[i],t),K([`mord`,`vbox`],[i],t)},mathmlBuilder:(e,t)=>{var n=new X(`mpadded`,[Z(e.body,t)]);if(e.alignment!==`rlap`){var r=e.alignment===`llap`?`-1`:`-0.5`;n.setAttribute(`lspace`,r+`width`)}return n.setAttribute(`width`,`0px`),n}}),J({type:`styling`,names:[`\\(`,`$`],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,i=r.mode;r.switchMode(`math`);var a=n===`\\(`?`\\)`:`$`,o=r.parseExpression(!1,a);return r.expect(a),r.switchMode(i),{type:`styling`,mode:r.mode,style:`text`,resetFont:!0,body:o}}}),J({type:`text`,names:[`\\)`,`\\]`],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new M(`Mismatched `+e.funcName)}});var Fh=(e,t)=>{switch(t.style.size){case N.DISPLAY.size:return e.display;case N.TEXT.size:return e.text;case N.SCRIPT.size:return e.script;case N.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};J({type:`mathchoice`,names:[`\\mathchoice`],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:`mathchoice`,mode:n.mode,display:gp(t[0]),text:gp(t[1]),script:gp(t[2]),scriptscript:gp(t[3])}},htmlBuilder:(e,t)=>Qf(xp(Fh(e,t),t,!1)),mathmlBuilder:(e,t)=>Bp(Fh(e,t),t)});var Ih=(e,t,n,r,i,a,o)=>{e=K([],[e]);var s=n&&zu(n),c,l;if(t){var u=Y(t,r.havingStyle(i.sup()),r);l={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=Y(n,r.havingStyle(i.sub()),r);c={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}var f;if(l&&c)f=q({positionType:`bottom`,positionData:r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+e.depth+o,children:[{type:`kern`,size:r.fontMetrics().bigOpSpacing5},{type:`elem`,elem:c.elem,marginLeft:P(-a)},{type:`kern`,size:c.kern},{type:`elem`,elem:e},{type:`kern`,size:l.kern},{type:`elem`,elem:l.elem,marginLeft:P(a)},{type:`kern`,size:r.fontMetrics().bigOpSpacing5}]});else if(c)f=q({positionType:`top`,positionData:e.height-o,children:[{type:`kern`,size:r.fontMetrics().bigOpSpacing5},{type:`elem`,elem:c.elem,marginLeft:P(-a)},{type:`kern`,size:c.kern},{type:`elem`,elem:e}]});else if(l)f=q({positionType:`bottom`,positionData:e.depth+o,children:[{type:`elem`,elem:e},{type:`kern`,size:l.kern},{type:`elem`,elem:l.elem,marginLeft:P(a)},{type:`kern`,size:r.fontMetrics().bigOpSpacing5}]});else return e;var p=[f];if(c&&a!==0&&!s){var m=K([`mspace`],[],r);m.style.marginRight=P(a),p.unshift(m)}return K([`mop`,`op-limits`],p,r)},Lh=new Set([`\\smallint`]),Rh=(e,t)=>{var n,r,i=!1,a;e.type===`supsub`?(n=e.sup,r=e.sub,a=Q(e.base,`op`),i=!0):a=Q(e,`op`);var o=t.style,s=!1;o.size===N.DISPLAY.size&&a.symbol&&!Lh.has(a.name)&&(s=!0);var c,l;if(a.symbol){var u=s?`Size2-Regular`:`Size1-Regular`,d=``;if((a.name===`\\oiint`||a.name===`\\oiiint`)&&(d=a.name.slice(1),a.name=d===`oiint`?`\\iint`:`\\iiint`),c=Hf(a.name,u,`math`,t,[`mop`,`op-symbol`,s?`large-op`:`small-op`]),l=c.italic,d.length>0){var f=ap(d+`Size`+(s?`2`:`1`),t);c=q({positionType:`individualShift`,children:[{type:`elem`,elem:c,shift:0},{type:`elem`,elem:f,shift:s?.08:0}]}),a.name=`\\`+d,c.classes.unshift(`mop`),c.italic=l}}else if(a.body){var p=xp(a.body,t,!0);p.length===1&&p[0]instanceof Vd?(c=p[0],c.classes[0]=`mop`):c=K([`mop`],p,t)}else{for(var m=[],h=1;h{var n;if(e.symbol)n=new X(`mo`,[Pp(e.name,e.mode)]),Lh.has(e.name)&&n.setAttribute(`largeop`,`false`);else if(e.body)n=new X(`mo`,zp(e.body,t));else{n=new X(`mi`,[new Ap(e.name.slice(1))]);var r=new X(`mo`,[Pp(`⁡`,`text`)]);n=e.parentIsSupSub?new X(`mrow`,[n,r]):kp([n,r])}return n},Bh={"∏":`\\prod`,"∐":`\\coprod`,"∑":`\\sum`,"⋀":`\\bigwedge`,"⋁":`\\bigvee`,"⋂":`\\bigcap`,"⋃":`\\bigcup`,"⨀":`\\bigodot`,"⨁":`\\bigoplus`,"⨂":`\\bigotimes`,"⨄":`\\biguplus`,"⨆":`\\bigsqcup`};J({type:`op`,names:`\\coprod.\\bigvee.\\bigwedge.\\biguplus.\\bigcap.\\bigcup.\\intop.\\prod.\\sum.\\bigotimes.\\bigoplus.\\bigodot.\\bigsqcup.\\smallint.∏.∐.∑.⋀.⋁.⋂.⋃.⨀.⨁.⨂.⨄.⨆`.split(`.`),props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:r}=e,i=r;return i.length===1&&(i=Bh[i]),{type:`op`,mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Rh,mathmlBuilder:zh}),J({type:`op`,names:[`\\mathop`],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:`op`,mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:gp(r)}},htmlBuilder:Rh,mathmlBuilder:zh});var Vh={"∫":`\\int`,"∬":`\\iint`,"∭":`\\iiint`,"∮":`\\oint`,"∯":`\\oiint`,"∰":`\\oiiint`};J({type:`op`,names:`\\arcsin.\\arccos.\\arctan.\\arctg.\\arcctg.\\arg.\\ch.\\cos.\\cosec.\\cosh.\\cot.\\cotg.\\coth.\\csc.\\ctg.\\cth.\\deg.\\dim.\\exp.\\hom.\\ker.\\lg.\\ln.\\log.\\sec.\\sin.\\sinh.\\sh.\\tan.\\tanh.\\tg.\\th`.split(`.`),props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:`op`,mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Rh,mathmlBuilder:zh}),J({type:`op`,names:[`\\det`,`\\gcd`,`\\inf`,`\\lim`,`\\max`,`\\min`,`\\Pr`,`\\sup`],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:`op`,mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Rh,mathmlBuilder:zh}),J({type:`op`,names:[`\\int`,`\\iint`,`\\iiint`,`\\oint`,`\\oiint`,`\\oiiint`,`∫`,`∬`,`∭`,`∮`,`∯`,`∰`],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:n}=e,r=n;return r.length===1&&(r=Vh[r]),{type:`op`,mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Rh,mathmlBuilder:zh});var Hh=(e,t)=>{var n,r,i=!1,a;e.type===`supsub`?(n=e.sup,r=e.sub,a=Q(e.base,`operatorname`),i=!0):a=Q(e,`operatorname`);var o;if(a.body.length>0){for(var s=xp(a.body.map(e=>{var t=`text`in e?e.text:void 0;return typeof t==`string`?{type:`textord`,mode:e.mode,text:t}:e}),t.withFont(`mathrm`),!0),c=0;c{var{parser:n,funcName:r}=e,i=t[0];return{type:`operatorname`,mode:n.mode,body:gp(i),alwaysHandleSupSub:r===`\\operatornamewithlimits`,limits:!1,parentIsSupSub:!1}},htmlBuilder:Hh,mathmlBuilder:(e,t)=>{for(var n=zp(e.body,t.withFont(`mathrm`)),r=!0,i=0;ie.toText()).join(``))]);var s=new X(`mi`,n);s.setAttribute(`mathvariant`,`normal`);var c=new X(`mo`,[Pp(`⁡`,`text`)]);return e.parentIsSupSub?new X(`mrow`,[s,c]):kp([s,c])}}),$(`\\operatorname`,`\\@ifstar\\operatornamewithlimits\\operatorname@`),mp({type:`ordgroup`,htmlBuilder(e,t){return e.semisimple?Qf(xp(e.body,t,!1)):K([`mord`],xp(e.body,t,!0),t)},mathmlBuilder(e,t){return Bp(e.body,t,!0)}}),J({type:`overline`,names:[`\\overline`],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:`overline`,mode:n.mode,body:r}},htmlBuilder(e,t){var n=Y(e.body,t.havingCrampedStyle()),r=Xf(`overline-line`,t),i=t.fontMetrics().defaultRuleThickness;return K([`mord`,`overline`],[q({positionType:`firstBaseline`,children:[{type:`elem`,elem:n},{type:`kern`,size:3*i},{type:`elem`,elem:r},{type:`kern`,size:i}]})],t)},mathmlBuilder(e,t){var n=new X(`mo`,[new Ap(`‾`)]);n.setAttribute(`stretchy`,`true`);var r=new X(`mover`,[Z(e.body,t),n]);return r.setAttribute(`accent`,`true`),r}}),J({type:`phantom`,names:[`\\phantom`],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:`phantom`,mode:n.mode,body:gp(r)}},htmlBuilder:(e,t)=>Qf(xp(e.body,t.withPhantom(),!1)),mathmlBuilder:(e,t)=>new X(`mphantom`,zp(e.body,t))}),$(`\\hphantom`,`\\smash{\\phantom{#1}}`),J({type:`vphantom`,names:[`\\vphantom`],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:`vphantom`,mode:n.mode,body:r}},htmlBuilder:(e,t)=>K([`mord`,`rlap`],[K([`inner`],[Y(e.body,t.withPhantom())]),K([`fix`],[])],t),mathmlBuilder:(e,t)=>{var n=new X(`mpadded`,[new X(`mphantom`,zp(gp(e.body),t))]);return n.setAttribute(`width`,`0px`),n}}),J({type:`raisebox`,names:[`\\raisebox`],props:{numArgs:2,argTypes:[`size`,`hbox`],allowedInText:!0},handler(e,t){var{parser:n}=e,r=Q(t[0],`size`).value,i=t[1];return{type:`raisebox`,mode:n.mode,dy:r,body:i}},htmlBuilder(e,t){var n=Y(e.body,t);return q({positionType:`shift`,positionData:-Ad(e.dy,t),children:[{type:`elem`,elem:n}]})},mathmlBuilder(e,t){var n=new X(`mpadded`,[Z(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute(`voffset`,r),n}}),J({type:`internal`,names:[`\\relax`],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:`internal`,mode:t.mode}}}),J({type:`rule`,names:[`\\rule`],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`size`,`size`,`size`]},handler(e,t,n){var{parser:r}=e,i=n[0],a=Q(t[0],`size`),o=Q(t[1],`size`);return{type:`rule`,mode:r.mode,shift:i&&Q(i,`size`).value,width:a.value,height:o.value}},htmlBuilder(e,t){var n=K([`mord`,`rule`],[],t),r=Ad(e.width,t),i=Ad(e.height,t),a=e.shift?Ad(e.shift,t):0;return n.style.borderRightWidth=P(r),n.style.borderTopWidth=P(i),n.style.bottom=P(a),n.width=r,n.height=i+a,n.depth=-a,n.maxFontSize=i*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=Ad(e.width,t),r=Ad(e.height,t),i=e.shift?Ad(e.shift,t):0,a=t.color&&t.getColor()||`black`,o=new X(`mspace`);o.setAttribute(`mathbackground`,a),o.setAttribute(`width`,P(n)),o.setAttribute(`height`,P(r));var s=new X(`mpadded`,[o]);return i>=0?s.setAttribute(`height`,P(i)):(s.setAttribute(`height`,P(i)),s.setAttribute(`depth`,P(-i))),s.setAttribute(`voffset`,P(i)),s}});function Uh(e,t,n){for(var r=xp(e,t,!1),i=t.sizeMultiplier/n.sizeMultiplier,a=0;a{var{breakOnTokenText:n,funcName:r,parser:i}=e,a=i.parseExpression(!1,n);return{type:`sizing`,mode:i.mode,size:Wh.indexOf(r)+1,body:a}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return Uh(e.body,n,t)},mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=new X(`mstyle`,zp(e.body,n));return r.setAttribute(`mathsize`,P(n.sizeMultiplier)),r}}),J({type:`smash`,names:[`\\smash`],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,i=!1,a=!1,o=n[0]&&Q(n[0],`ordgroup`);if(o)for(var s,c=0;c{var n=K([],[Y(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0),e.smashDepth&&(n.depth=0),e.smashHeight&&e.smashDepth)return K([`mord`,`smash`],[n],t);if(n.children)for(var r=0;r{var n=new X(`mpadded`,[Z(e.body,t)]);return e.smashHeight&&n.setAttribute(`height`,`0px`),e.smashDepth&&n.setAttribute(`depth`,`0px`),n}}),J({type:`sqrt`,names:[`\\sqrt`],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r}=e,i=n[0],a=t[0];return{type:`sqrt`,mode:r.mode,body:a,index:i}},htmlBuilder(e,t){var n=Y(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=$f(n,t);var r=t.fontMetrics().defaultRuleThickness,i=r;t.style.idn.height+n.depth+a&&(a=(a+l-n.height-n.depth)/2);var u=o.height-n.height-a-s;n.style.paddingLeft=P(c);var d=q({positionType:`firstBaseline`,children:[{type:`elem`,elem:n,wrapperClasses:[`svg-align`]},{type:`kern`,size:-(n.height+u)},{type:`elem`,elem:o},{type:`kern`,size:s}]});if(e.index){var f=t.havingStyle(N.SCRIPTSCRIPT),p=Y(e.index,f,t);return K([`mord`,`sqrt`],[K([`root`],[q({positionType:`shift`,positionData:-(.6*(d.height-d.depth)),children:[{type:`elem`,elem:p}]})]),d],t)}return K([`mord`,`sqrt`],[d],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new X(`mroot`,[Z(n,t),Z(r,t)]):new X(`msqrt`,[Z(n,t)])}});var Gh={display:N.DISPLAY,text:N.TEXT,script:N.SCRIPT,scriptscript:N.SCRIPTSCRIPT};function Kh(e){return e in Gh}J({type:`styling`,names:[`\\displaystyle`,`\\textstyle`,`\\scriptstyle`,`\\scriptscriptstyle`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:r,parser:i}=e,a=i.parseExpression(!0,n),o=r.slice(1,r.length-5);if(!Kh(o))throw Error(`Unknown style: `+o);return{type:`styling`,mode:i.mode,style:o,body:a}},htmlBuilder(e,t){var n=Gh[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont(``)),Uh(e.body,r,t)},mathmlBuilder(e,t){var n=Gh[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(``));var i=new X(`mstyle`,zp(e.body,r)),a={display:[`0`,`true`],text:[`0`,`false`],script:[`1`,`false`],scriptscript:[`2`,`false`]}[e.style];return i.setAttribute(`scriptlevel`,a[0]),i.setAttribute(`displaystyle`,a[1]),i}});var qh=function(e,t){var n=e.base;return n?n.type===`op`?n.limits&&(t.style.size===N.DISPLAY.size||n.alwaysHandleSupSub)?Rh:null:n.type===`operatorname`?n.alwaysHandleSupSub&&(t.style.size===N.DISPLAY.size||n.limits)?Hh:null:n.type===`accent`?zu(n.base)?cm:null:n.type===`horizBrace`&&!e.sub===n.isOver?Nh:null:null};mp({type:`supsub`,htmlBuilder(e,t){var n=qh(e,t);if(n)return n(e,t);var{base:r,sup:i,sub:a}=e,o=Y(r,t),s,c,l=t.fontMetrics(),u=0,d=0,f=r&&zu(r);if(i){var p=t.havingStyle(t.style.sup());s=Y(i,p,t),f||(u=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(a){var m=t.havingStyle(t.style.sub());c=Y(a,m,t),f||(d=o.depth+m.fontMetrics().subDrop*m.sizeMultiplier/t.sizeMultiplier)}var h=t.style===N.DISPLAY?l.sup1:t.style.cramped?l.sup3:l.sup2,g=t.sizeMultiplier,_=P(.5/l.ptPerEm/g),v=null;if(c){var y=e.base&&e.base.type===`op`&&e.base.name&&(e.base.name===`\\oiint`||e.base.name===`\\oiiint`);(o instanceof Vd||y)&&(v=P(-(o.italic??0)))}var b;if(s&&c){u=Math.max(u,h,s.depth+.25*l.xHeight),d=Math.max(d,l.sub2);var x=4*l.defaultRuleThickness;if(u-s.depth-(c.height-d)0&&(u+=S,d-=S)}b=q({positionType:`individualShift`,children:[{type:`elem`,elem:c,shift:d,marginRight:_,marginLeft:v},{type:`elem`,elem:s,shift:-u,marginRight:_}]})}else if(c)d=Math.max(d,l.sub1,c.height-.8*l.xHeight),b=q({positionType:`shift`,positionData:d,children:[{type:`elem`,elem:c,marginLeft:v,marginRight:_}]});else if(s)u=Math.max(u,h,s.depth+.25*l.xHeight),b=q({positionType:`shift`,positionData:-u,children:[{type:`elem`,elem:s,marginRight:_}]});else throw Error(`supsub must have either sup or sub.`);return K([Tp(o,`right`)||`mord`],[o,K([`msupsub`],[b])],t)},mathmlBuilder(e,t){var n=!1,r,i;e.base&&e.base.type===`horizBrace`&&(i=!!e.sup,i===e.base.isOver&&(n=!0,r=e.base.isOver)),e.base&&(e.base.type===`op`||e.base.type===`operatorname`)&&(e.base.parentIsSupSub=!0);var a=[Z(e.base,t)];e.sub&&a.push(Z(e.sub,t)),e.sup&&a.push(Z(e.sup,t));var o;if(n)o=r?`mover`:`munder`;else if(!e.sub){var s=e.base;o=s&&s.type===`op`&&s.limits&&(t.style===N.DISPLAY||s.alwaysHandleSupSub)||s&&s.type===`operatorname`&&s.alwaysHandleSupSub&&(s.limits||t.style===N.DISPLAY)?`mover`:`msup`}else if(e.sup){var c=e.base;o=c&&c.type===`op`&&c.limits&&t.style===N.DISPLAY||c&&c.type===`operatorname`&&c.alwaysHandleSupSub&&(t.style===N.DISPLAY||c.limits)?`munderover`:`msubsup`}else{var l=e.base;o=l&&l.type===`op`&&l.limits&&(t.style===N.DISPLAY||l.alwaysHandleSupSub)||l&&l.type===`operatorname`&&l.alwaysHandleSupSub&&(l.limits||t.style===N.DISPLAY)?`munder`:`msub`}return new X(o,a)}}),mp({type:`atom`,htmlBuilder(e,t){return Uf(e.text,e.mode,t,[`m`+e.family])},mathmlBuilder(e,t){var n=new X(`mo`,[Pp(e.text,e.mode)]);if(e.family===`bin`){var r=Lp(e,t);r===`bold-italic`&&n.setAttribute(`mathvariant`,r)}else e.family===`punct`?n.setAttribute(`separator`,`true`):(e.family===`open`||e.family===`close`)&&n.setAttribute(`stretchy`,`false`);return n}});var Jh={mi:`italic`,mn:`normal`,mtext:`normal`};mp({type:`mathord`,htmlBuilder(e,t){return Gf(e,t,`mathord`)},mathmlBuilder(e,t){var n=new X(`mi`,[Pp(e.text,e.mode,t)]),r=Lp(e,t)||`italic`;return r!==Jh[n.type]&&n.setAttribute(`mathvariant`,r),n}}),mp({type:`textord`,htmlBuilder(e,t){return Gf(e,t,`textord`)},mathmlBuilder(e,t){var n=Pp(e.text,e.mode,t),r=Lp(e,t)||`normal`,i=e.mode===`text`?new X(`mtext`,[n]):/[0-9]/.test(e.text)?new X(`mn`,[n]):e.text===`\\prime`?new X(`mo`,[n]):new X(`mi`,[n]);return r!==Jh[i.type]&&i.setAttribute(`mathvariant`,r),i}});var Yh={"\\nobreak":`nobreak`,"\\allowbreak":`allowbreak`},Xh={" ":{},"\\ ":{},"~":{className:`nobreak`},"\\space":{},"\\nobreakspace":{className:`nobreak`}};mp({type:`spacing`,htmlBuilder(e,t){if(Xh.hasOwnProperty(e.text)){var n=Xh[e.text].className||``;if(e.mode===`text`){var r=Gf(e,t,`textord`);return r.classes.push(n),r}return K([`mspace`,n],[Uf(e.text,e.mode,t)],t)}if(Yh.hasOwnProperty(e.text))return K([`mspace`,Yh[e.text]],[],t);throw new M(`Unknown type of space "`+e.text+`"`)},mathmlBuilder(e,t){var n;if(Xh.hasOwnProperty(e.text))n=new X(`mtext`,[new Ap(`\xA0`)]);else if(Yh.hasOwnProperty(e.text))return new X(`mspace`);else throw new M(`Unknown type of space "`+e.text+`"`);return n}});var Zh=()=>{var e=new X(`mtd`,[]);return e.setAttribute(`width`,`50%`),e};mp({type:`tag`,mathmlBuilder(e,t){var n=new X(`mtable`,[new X(`mtr`,[Zh(),new X(`mtd`,[Bp(e.body,t)]),Zh(),new X(`mtd`,[Bp(e.tag,t)])])]);return n.setAttribute(`width`,`100%`),n}});var Qh={"\\text":void 0,"\\textrm":`textrm`,"\\textsf":`textsf`,"\\texttt":`texttt`,"\\textnormal":`textrm`},$h={"\\textbf":`textbf`,"\\textmd":`textmd`},eg={"\\textit":`textit`,"\\textup":`textup`},tg=(e,t)=>{var n=e.font;return n?Qh[n]?t.withTextFontFamily(Qh[n]):$h[n]?t.withTextFontWeight($h[n]):n===`\\emph`?t.fontShape===`textit`?t.withTextFontShape(`textup`):t.withTextFontShape(`textit`):t.withTextFontShape(eg[n]):t};J({type:`text`,names:[`\\text`,`\\textrm`,`\\textsf`,`\\texttt`,`\\textnormal`,`\\textbf`,`\\textmd`,`\\textit`,`\\textup`,`\\emph`],props:{numArgs:1,argTypes:[`text`],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,i=t[0];return{type:`text`,mode:n.mode,body:gp(i),font:r}},htmlBuilder(e,t){var n=tg(e,t);return K([`mord`,`text`],xp(e.body,n,!0),n)},mathmlBuilder(e,t){var n=tg(e,t);return Bp(e.body,n)}}),J({type:`underline`,names:[`\\underline`],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:`underline`,mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Y(e.body,t),r=Xf(`underline-line`,t),i=t.fontMetrics().defaultRuleThickness;return K([`mord`,`underline`],[q({positionType:`top`,positionData:n.height,children:[{type:`kern`,size:i},{type:`elem`,elem:r},{type:`kern`,size:3*i},{type:`elem`,elem:n}]})],t)},mathmlBuilder(e,t){var n=new X(`mo`,[new Ap(`‾`)]);n.setAttribute(`stretchy`,`true`);var r=new X(`munder`,[Z(e.body,t),n]);return r.setAttribute(`accentunder`,`true`),r}}),J({type:`vcenter`,names:[`\\vcenter`],props:{numArgs:1,argTypes:[`original`],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:`vcenter`,mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=Y(e.body,t),r=t.fontMetrics().axisHeight;return q({positionType:`shift`,positionData:.5*(n.height-r-(n.depth+r)),children:[{type:`elem`,elem:n}]})},mathmlBuilder(e,t){return new X(`mrow`,[new X(`mpadded`,[Z(e.body,t)],[`vcenter`])])}}),J({type:`verb`,names:[`\\verb`],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new M(`\\verb ended by end of line instead of matching delimiter`)},htmlBuilder(e,t){for(var n=ng(e),r=[],i=t.havingStyle(t.style.text()),a=0;ae.body.replace(/ /g,e.star?`␣`:`\xA0`),rg=dp,ig=`[ \r + ]`,ag=`\\\\[a-zA-Z@]+`,og=`\\\\[^\ud800-\udfff]`,sg=`(`+ag+`)`+ig+`*`,cg=`\\\\( +|[ \r ]+ +?)[ \r ]*`,lg=`[̀-ͯ]`,ug=RegExp(lg+`+$`),dg=`(`+ig+`+)|`+(cg+`|`)+`([!-\\[\\]-‧‪-퟿豈-￿]`+(lg+`*`)+`|[\ud800-\udbff][\udc00-\udfff]`+(lg+`*`)+`|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5`+(`|`+sg)+(`|`+og+`)`),fg=class{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(dg,`g`),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new ph(`EOF`,new fh(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new M(`Unexpected character: '`+e[t]+`'`,new ph(e[t],new fh(this,t,t+1)));var r=n[6]||n[3]||(n[2]?`\\ `:` `);if(this.catcodes[r]===14){var i=e.indexOf(` +`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict(`commentAtEnd`,`% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)`)):this.tokenRegex.lastIndex=i+1,this.lex()}return new ph(r,new fh(this,t,this.tokenRegex.lastIndex))}},pg=class{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new M(`Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug`);var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var r=0;r0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}},mg=dh;$(`\\noexpand`,function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),$(`\\expandafter`,function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),$(`\\@firstoftwo`,function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),$(`\\@secondoftwo`,function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),$(`\\@ifnextchar`,function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),$(`\\@ifstar`,`\\@ifnextchar *{\\@firstoftwo{#1}}`),$(`\\TextOrMath`,function(e){var t=e.consumeArgs(2);return e.mode===`text`?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var hg={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};$(`\\char`,function(e){var t=e.popToken(),n,r=0;if(t.text===`'`)n=8,t=e.popToken();else if(t.text===`"`)n=16,t=e.popToken();else if(t.text==="`"){if(t=e.popToken(),t.text[0]===`\\`)r=t.text.charCodeAt(1);else if(t.text===`EOF`)throw new M("\\char` missing argument");else r=t.text.charCodeAt(0)}else n=10;if(n){if(r=hg[t.text],r==null||r>=n)throw new M(`Invalid base-`+n+` digit `+t.text);for(var i;(i=hg[e.future().text])!=null&&i{var i=e.consumeArg().tokens;if(i.length!==1)throw new M(`\\newcommand's first argument must be a macro name`);var a=i[0].text,o=e.isDefined(a);if(o&&!t)throw new M(`\\newcommand{`+a+`} attempting to redefine `+(a+`; use \\renewcommand`));if(!o&&!n)throw new M(`\\renewcommand{`+a+`} when command `+a+` does not yet exist; use \\newcommand`);var s=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text===`[`){for(var c=``,l=e.expandNextToken();l.text!==`]`&&l.text!==`EOF`;)c+=l.text,l=e.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new M(`Invalid number of arguments: `+c);s=parseInt(c),i=e.consumeArg().tokens}return o&&r||e.macros.set(a,{tokens:i,numArgs:s}),``};$(`\\newcommand`,e=>gg(e,!1,!0,!1)),$(`\\renewcommand`,e=>gg(e,!0,!1,!1)),$(`\\providecommand`,e=>gg(e,!0,!0,!0)),$(`\\message`,e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(e=>e.text).join(``)),``}),$(`\\errmessage`,e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(e=>e.text).join(``)),``}),$(`\\show`,e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),rg[n],tf.math[n],tf.text[n]),``}),$(`\\bgroup`,`{`),$(`\\egroup`,`}`),$(`~`,`\\nobreakspace`),$(`\\lq`,"`"),$(`\\rq`,`'`),$(`\\aa`,`\\r a`),$(`\\AA`,`\\r A`),$(`\\textcopyright`,"\\html@mathml{\\textcircled{c}}{\\char`©}"),$(`\\copyright`,`\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}`),$(`\\textregistered`,"\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),$(`ℬ`,`\\mathscr{B}`),$(`ℰ`,`\\mathscr{E}`),$(`ℱ`,`\\mathscr{F}`),$(`ℋ`,`\\mathscr{H}`),$(`ℐ`,`\\mathscr{I}`),$(`ℒ`,`\\mathscr{L}`),$(`ℳ`,`\\mathscr{M}`),$(`ℛ`,`\\mathscr{R}`),$(`ℭ`,`\\mathfrak{C}`),$(`ℌ`,`\\mathfrak{H}`),$(`ℨ`,`\\mathfrak{Z}`),$(`\\Bbbk`,`\\Bbb{k}`),$(`\\llap`,`\\mathllap{\\textrm{#1}}`),$(`\\rlap`,`\\mathrlap{\\textrm{#1}}`),$(`\\clap`,`\\mathclap{\\textrm{#1}}`),$(`\\mathstrut`,`\\vphantom{(}`),$(`\\underbar`,`\\underline{\\text{#1}}`),$(`\\not`,`\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}`),$(`\\neq`,"\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),$(`\\ne`,`\\neq`),$(`≠`,`\\neq`),$(`\\notin`,"\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),$(`∉`,`\\notin`),$(`≘`,"\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),$(`≙`,"\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),$(`≚`,"\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),$(`≛`,"\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),$(`≝`,"\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),$(`≞`,"\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),$(`≟`,"\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),$(`⟂`,`\\perp`),$(`‼`,`\\mathclose{!\\mkern-0.8mu!}`),$(`∌`,`\\notni`),$(`⌜`,`\\ulcorner`),$(`⌝`,`\\urcorner`),$(`⌞`,`\\llcorner`),$(`⌟`,`\\lrcorner`),$(`©`,`\\copyright`),$(`®`,`\\textregistered`),$(`\\ulcorner`,`\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}`),$(`\\urcorner`,`\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}`),$(`\\llcorner`,`\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}`),$(`\\lrcorner`,`\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}`),$(`\\vdots`,`{\\varvdots\\rule{0pt}{15pt}}`),$(`⋮`,`\\vdots`),$(`\\varGamma`,`\\mathit{\\Gamma}`),$(`\\varDelta`,`\\mathit{\\Delta}`),$(`\\varTheta`,`\\mathit{\\Theta}`),$(`\\varLambda`,`\\mathit{\\Lambda}`),$(`\\varXi`,`\\mathit{\\Xi}`),$(`\\varPi`,`\\mathit{\\Pi}`),$(`\\varSigma`,`\\mathit{\\Sigma}`),$(`\\varUpsilon`,`\\mathit{\\Upsilon}`),$(`\\varPhi`,`\\mathit{\\Phi}`),$(`\\varPsi`,`\\mathit{\\Psi}`),$(`\\varOmega`,`\\mathit{\\Omega}`),$(`\\substack`,`\\begin{subarray}{c}#1\\end{subarray}`),$(`\\colon`,`\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax`),$(`\\boxed`,`\\fbox{$\\displaystyle{#1}$}`),$(`\\iff`,`\\DOTSB\\;\\Longleftrightarrow\\;`),$(`\\implies`,`\\DOTSB\\;\\Longrightarrow\\;`),$(`\\impliedby`,`\\DOTSB\\;\\Longleftarrow\\;`),$(`\\dddot`,`{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}`),$(`\\ddddot`,`{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}`);var _g={",":`\\dotsc`,"\\not":`\\dotsb`,"+":`\\dotsb`,"=":`\\dotsb`,"<":`\\dotsb`,">":`\\dotsb`,"-":`\\dotsb`,"*":`\\dotsb`,":":`\\dotsb`,"\\DOTSB":`\\dotsb`,"\\coprod":`\\dotsb`,"\\bigvee":`\\dotsb`,"\\bigwedge":`\\dotsb`,"\\biguplus":`\\dotsb`,"\\bigcap":`\\dotsb`,"\\bigcup":`\\dotsb`,"\\prod":`\\dotsb`,"\\sum":`\\dotsb`,"\\bigotimes":`\\dotsb`,"\\bigoplus":`\\dotsb`,"\\bigodot":`\\dotsb`,"\\bigsqcup":`\\dotsb`,"\\And":`\\dotsb`,"\\longrightarrow":`\\dotsb`,"\\Longrightarrow":`\\dotsb`,"\\longleftarrow":`\\dotsb`,"\\Longleftarrow":`\\dotsb`,"\\longleftrightarrow":`\\dotsb`,"\\Longleftrightarrow":`\\dotsb`,"\\mapsto":`\\dotsb`,"\\longmapsto":`\\dotsb`,"\\hookrightarrow":`\\dotsb`,"\\doteq":`\\dotsb`,"\\mathbin":`\\dotsb`,"\\mathrel":`\\dotsb`,"\\relbar":`\\dotsb`,"\\Relbar":`\\dotsb`,"\\xrightarrow":`\\dotsb`,"\\xleftarrow":`\\dotsb`,"\\DOTSI":`\\dotsi`,"\\int":`\\dotsi`,"\\oint":`\\dotsi`,"\\iint":`\\dotsi`,"\\iiint":`\\dotsi`,"\\iiiint":`\\dotsi`,"\\idotsint":`\\dotsi`,"\\DOTSX":`\\dotsx`},vg=new Set([`bin`,`rel`]);$(`\\dots`,function(e){var t=`\\dotso`,n=e.expandAfterFuture().text;return n in _g?t=_g[n]:(n.slice(0,4)===`\\not`||n in tf.math&&vg.has(tf.math[n].group))&&(t=`\\dotsb`),t});var yg={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};$(`\\dotso`,function(e){return e.future().text in yg?`\\ldots\\,`:`\\ldots`}),$(`\\dotsc`,function(e){var t=e.future().text;return t in yg&&t!==`,`?`\\ldots\\,`:`\\ldots`}),$(`\\cdots`,function(e){return e.future().text in yg?`\\@cdots\\,`:`\\@cdots`}),$(`\\dotsb`,`\\cdots`),$(`\\dotsm`,`\\cdots`),$(`\\dotsi`,`\\!\\cdots`),$(`\\dotsx`,`\\ldots\\,`),$(`\\DOTSI`,`\\relax`),$(`\\DOTSB`,`\\relax`),$(`\\DOTSX`,`\\relax`),$(`\\tmspace`,`\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax`),$(`\\,`,`\\tmspace+{3mu}{.1667em}`),$(`\\thinspace`,`\\,`),$(`\\>`,`\\mskip{4mu}`),$(`\\:`,`\\tmspace+{4mu}{.2222em}`),$(`\\medspace`,`\\:`),$(`\\;`,`\\tmspace+{5mu}{.2777em}`),$(`\\thickspace`,`\\;`),$(`\\!`,`\\tmspace-{3mu}{.1667em}`),$(`\\negthinspace`,`\\!`),$(`\\negmedspace`,`\\tmspace-{4mu}{.2222em}`),$(`\\negthickspace`,`\\tmspace-{5mu}{.277em}`),$(`\\enspace`,`\\kern.5em `),$(`\\enskip`,`\\hskip.5em\\relax`),$(`\\quad`,`\\hskip1em\\relax`),$(`\\qquad`,`\\hskip2em\\relax`),$(`\\tag`,`\\@ifstar\\tag@literal\\tag@paren`),$(`\\tag@paren`,`\\tag@literal{({#1})}`),$(`\\tag@literal`,e=>{if(e.macros.get(`\\df@tag`))throw new M(`Multiple \\tag`);return`\\gdef\\df@tag{\\text{#1}}`}),$(`\\bmod`,`\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}`),$(`\\pod`,`\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)`),$(`\\pmod`,`\\pod{{\\rm mod}\\mkern6mu#1}`),$(`\\mod`,`\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1`),$(`\\newline`,`\\\\\\relax`),$(`\\TeX`,`\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}`);var bg=P(Jd[`Main-Regular`][84][1]-.7*Jd[`Main-Regular`][65][1]);$(`\\LaTeX`,`\\textrm{\\html@mathml{`+(`L\\kern-.36em\\raisebox{`+bg+`}{\\scriptstyle A}`)+`\\kern-.15em\\TeX}{LaTeX}}`),$(`\\KaTeX`,`\\textrm{\\html@mathml{`+(`K\\kern-.17em\\raisebox{`+bg+`}{\\scriptstyle A}`)+`\\kern-.15em\\TeX}{KaTeX}}`),$(`\\hspace`,`\\@ifstar\\@hspacer\\@hspace`),$(`\\@hspace`,`\\hskip #1\\relax`),$(`\\@hspacer`,`\\rule{0pt}{0pt}\\hskip #1\\relax`),$(`\\ordinarycolon`,`:`),$(`\\vcentcolon`,`\\mathrel{\\mathop\\ordinarycolon}`),$(`\\dblcolon`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}`),$(`\\coloneqq`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}`),$(`\\Coloneqq`,`\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}`),$(`\\coloneq`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}`),$(`\\Coloneq`,`\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}`),$(`\\eqqcolon`,`\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}`),$(`\\Eqqcolon`,`\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}`),$(`\\eqcolon`,`\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}`),$(`\\Eqcolon`,`\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}`),$(`\\colonapprox`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}`),$(`\\Colonapprox`,`\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}`),$(`\\colonsim`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}`),$(`\\Colonsim`,`\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}`),$(`∷`,`\\dblcolon`),$(`∹`,`\\eqcolon`),$(`≔`,`\\coloneqq`),$(`≕`,`\\eqqcolon`),$(`⩴`,`\\Coloneqq`),$(`\\ratio`,`\\vcentcolon`),$(`\\coloncolon`,`\\dblcolon`),$(`\\colonequals`,`\\coloneqq`),$(`\\coloncolonequals`,`\\Coloneqq`),$(`\\equalscolon`,`\\eqqcolon`),$(`\\equalscoloncolon`,`\\Eqqcolon`),$(`\\colonminus`,`\\coloneq`),$(`\\coloncolonminus`,`\\Coloneq`),$(`\\minuscolon`,`\\eqcolon`),$(`\\minuscoloncolon`,`\\Eqcolon`),$(`\\coloncolonapprox`,`\\Colonapprox`),$(`\\coloncolonsim`,`\\Colonsim`),$(`\\simcolon`,`\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}`),$(`\\simcoloncolon`,`\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}`),$(`\\approxcolon`,`\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}`),$(`\\approxcoloncolon`,`\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}`),$(`\\notni`,"\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),$(`\\limsup`,`\\DOTSB\\operatorname*{lim\\,sup}`),$(`\\liminf`,`\\DOTSB\\operatorname*{lim\\,inf}`),$(`\\injlim`,`\\DOTSB\\operatorname*{inj\\,lim}`),$(`\\projlim`,`\\DOTSB\\operatorname*{proj\\,lim}`),$(`\\varlimsup`,`\\DOTSB\\operatorname*{\\overline{lim}}`),$(`\\varliminf`,`\\DOTSB\\operatorname*{\\underline{lim}}`),$(`\\varinjlim`,`\\DOTSB\\operatorname*{\\underrightarrow{lim}}`),$(`\\varprojlim`,`\\DOTSB\\operatorname*{\\underleftarrow{lim}}`),$(`\\gvertneqq`,`\\html@mathml{\\@gvertneqq}{≩}`),$(`\\lvertneqq`,`\\html@mathml{\\@lvertneqq}{≨}`),$(`\\ngeqq`,`\\html@mathml{\\@ngeqq}{≱}`),$(`\\ngeqslant`,`\\html@mathml{\\@ngeqslant}{≱}`),$(`\\nleqq`,`\\html@mathml{\\@nleqq}{≰}`),$(`\\nleqslant`,`\\html@mathml{\\@nleqslant}{≰}`),$(`\\nshortmid`,`\\html@mathml{\\@nshortmid}{∤}`),$(`\\nshortparallel`,`\\html@mathml{\\@nshortparallel}{∦}`),$(`\\nsubseteqq`,`\\html@mathml{\\@nsubseteqq}{⊈}`),$(`\\nsupseteqq`,`\\html@mathml{\\@nsupseteqq}{⊉}`),$(`\\varsubsetneq`,`\\html@mathml{\\@varsubsetneq}{⊊}`),$(`\\varsubsetneqq`,`\\html@mathml{\\@varsubsetneqq}{⫋}`),$(`\\varsupsetneq`,`\\html@mathml{\\@varsupsetneq}{⊋}`),$(`\\varsupsetneqq`,`\\html@mathml{\\@varsupsetneqq}{⫌}`),$(`\\imath`,`\\html@mathml{\\@imath}{ı}`),$(`\\jmath`,`\\html@mathml{\\@jmath}{ȷ}`),$(`\\llbracket`,"\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),$(`\\rrbracket`,"\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),$(`⟦`,`\\llbracket`),$(`⟧`,`\\rrbracket`),$(`\\lBrace`,"\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),$(`\\rBrace`,"\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),$(`⦃`,`\\lBrace`),$(`⦄`,`\\rBrace`),$(`\\minuso`,"\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),$(`⦵`,`\\minuso`),$(`\\darr`,`\\downarrow`),$(`\\dArr`,`\\Downarrow`),$(`\\Darr`,`\\Downarrow`),$(`\\lang`,`\\langle`),$(`\\rang`,`\\rangle`),$(`\\uarr`,`\\uparrow`),$(`\\uArr`,`\\Uparrow`),$(`\\Uarr`,`\\Uparrow`),$(`\\N`,`\\mathbb{N}`),$(`\\R`,`\\mathbb{R}`),$(`\\Z`,`\\mathbb{Z}`),$(`\\alef`,`\\aleph`),$(`\\alefsym`,`\\aleph`),$(`\\Alpha`,`\\mathrm{A}`),$(`\\Beta`,`\\mathrm{B}`),$(`\\bull`,`\\bullet`),$(`\\Chi`,`\\mathrm{X}`),$(`\\clubs`,`\\clubsuit`),$(`\\cnums`,`\\mathbb{C}`),$(`\\Complex`,`\\mathbb{C}`),$(`\\Dagger`,`\\ddagger`),$(`\\diamonds`,`\\diamondsuit`),$(`\\empty`,`\\emptyset`),$(`\\Epsilon`,`\\mathrm{E}`),$(`\\Eta`,`\\mathrm{H}`),$(`\\exist`,`\\exists`),$(`\\harr`,`\\leftrightarrow`),$(`\\hArr`,`\\Leftrightarrow`),$(`\\Harr`,`\\Leftrightarrow`),$(`\\hearts`,`\\heartsuit`),$(`\\image`,`\\Im`),$(`\\infin`,`\\infty`),$(`\\Iota`,`\\mathrm{I}`),$(`\\isin`,`\\in`),$(`\\Kappa`,`\\mathrm{K}`),$(`\\larr`,`\\leftarrow`),$(`\\lArr`,`\\Leftarrow`),$(`\\Larr`,`\\Leftarrow`),$(`\\lrarr`,`\\leftrightarrow`),$(`\\lrArr`,`\\Leftrightarrow`),$(`\\Lrarr`,`\\Leftrightarrow`),$(`\\Mu`,`\\mathrm{M}`),$(`\\natnums`,`\\mathbb{N}`),$(`\\Nu`,`\\mathrm{N}`),$(`\\Omicron`,`\\mathrm{O}`),$(`\\plusmn`,`\\pm`),$(`\\rarr`,`\\rightarrow`),$(`\\rArr`,`\\Rightarrow`),$(`\\Rarr`,`\\Rightarrow`),$(`\\real`,`\\Re`),$(`\\reals`,`\\mathbb{R}`),$(`\\Reals`,`\\mathbb{R}`),$(`\\Rho`,`\\mathrm{P}`),$(`\\sdot`,`\\cdot`),$(`\\sect`,`\\S`),$(`\\spades`,`\\spadesuit`),$(`\\sub`,`\\subset`),$(`\\sube`,`\\subseteq`),$(`\\supe`,`\\supseteq`),$(`\\Tau`,`\\mathrm{T}`),$(`\\thetasym`,`\\vartheta`),$(`\\weierp`,`\\wp`),$(`\\Zeta`,`\\mathrm{Z}`),$(`\\argmin`,`\\DOTSB\\operatorname*{arg\\,min}`),$(`\\argmax`,`\\DOTSB\\operatorname*{arg\\,max}`),$(`\\plim`,`\\DOTSB\\mathop{\\operatorname{plim}}\\limits`),$(`\\bra`,`\\mathinner{\\langle{#1}|}`),$(`\\ket`,`\\mathinner{|{#1}\\rangle}`),$(`\\braket`,`\\mathinner{\\langle{#1}\\rangle}`),$(`\\Bra`,`\\left\\langle#1\\right|`),$(`\\Ket`,`\\left|#1\\right\\rangle`);var xg=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,o=t.macros.get(`|`),s=t.macros.get(`\\|`);t.macros.beginGroup();var c=t=>n=>{e&&(n.macros.set(`|`,o),i.length&&n.macros.set(`\\|`,s));var a=t;return!t&&i.length&&n.future().text===`|`&&(n.popToken(),a=!0),{tokens:a?i:r,numArgs:0}};t.macros.set(`|`,c(!1)),i.length&&t.macros.set(`\\|`,c(!0));var l=t.consumeArg().tokens,u=t.expandTokens([...a,...l,...n]);return t.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};$(`\\bra@ket`,xg(!1)),$(`\\bra@set`,xg(!0)),$(`\\Braket`,`\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}`),$(`\\Set`,`\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}`),$(`\\set`,`\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}`),$(`\\angln`,`{\\angl n}`),$(`\\blue`,`\\textcolor{##6495ed}{#1}`),$(`\\orange`,`\\textcolor{##ffa500}{#1}`),$(`\\pink`,`\\textcolor{##ff00af}{#1}`),$(`\\red`,`\\textcolor{##df0030}{#1}`),$(`\\green`,`\\textcolor{##28ae7b}{#1}`),$(`\\gray`,`\\textcolor{gray}{#1}`),$(`\\purple`,`\\textcolor{##9d38bd}{#1}`),$(`\\blueA`,`\\textcolor{##ccfaff}{#1}`),$(`\\blueB`,`\\textcolor{##80f6ff}{#1}`),$(`\\blueC`,`\\textcolor{##63d9ea}{#1}`),$(`\\blueD`,`\\textcolor{##11accd}{#1}`),$(`\\blueE`,`\\textcolor{##0c7f99}{#1}`),$(`\\tealA`,`\\textcolor{##94fff5}{#1}`),$(`\\tealB`,`\\textcolor{##26edd5}{#1}`),$(`\\tealC`,`\\textcolor{##01d1c1}{#1}`),$(`\\tealD`,`\\textcolor{##01a995}{#1}`),$(`\\tealE`,`\\textcolor{##208170}{#1}`),$(`\\greenA`,`\\textcolor{##b6ffb0}{#1}`),$(`\\greenB`,`\\textcolor{##8af281}{#1}`),$(`\\greenC`,`\\textcolor{##74cf70}{#1}`),$(`\\greenD`,`\\textcolor{##1fab54}{#1}`),$(`\\greenE`,`\\textcolor{##0d923f}{#1}`),$(`\\goldA`,`\\textcolor{##ffd0a9}{#1}`),$(`\\goldB`,`\\textcolor{##ffbb71}{#1}`),$(`\\goldC`,`\\textcolor{##ff9c39}{#1}`),$(`\\goldD`,`\\textcolor{##e07d10}{#1}`),$(`\\goldE`,`\\textcolor{##a75a05}{#1}`),$(`\\redA`,`\\textcolor{##fca9a9}{#1}`),$(`\\redB`,`\\textcolor{##ff8482}{#1}`),$(`\\redC`,`\\textcolor{##f9685d}{#1}`),$(`\\redD`,`\\textcolor{##e84d39}{#1}`),$(`\\redE`,`\\textcolor{##bc2612}{#1}`),$(`\\maroonA`,`\\textcolor{##ffbde0}{#1}`),$(`\\maroonB`,`\\textcolor{##ff92c6}{#1}`),$(`\\maroonC`,`\\textcolor{##ed5fa6}{#1}`),$(`\\maroonD`,`\\textcolor{##ca337c}{#1}`),$(`\\maroonE`,`\\textcolor{##9e034e}{#1}`),$(`\\purpleA`,`\\textcolor{##ddd7ff}{#1}`),$(`\\purpleB`,`\\textcolor{##c6b9fc}{#1}`),$(`\\purpleC`,`\\textcolor{##aa87ff}{#1}`),$(`\\purpleD`,`\\textcolor{##7854ab}{#1}`),$(`\\purpleE`,`\\textcolor{##543b78}{#1}`),$(`\\mintA`,`\\textcolor{##f5f9e8}{#1}`),$(`\\mintB`,`\\textcolor{##edf2df}{#1}`),$(`\\mintC`,`\\textcolor{##e0e5cc}{#1}`),$(`\\grayA`,`\\textcolor{##f6f7f7}{#1}`),$(`\\grayB`,`\\textcolor{##f0f1f2}{#1}`),$(`\\grayC`,`\\textcolor{##e3e5e6}{#1}`),$(`\\grayD`,`\\textcolor{##d6d8da}{#1}`),$(`\\grayE`,`\\textcolor{##babec2}{#1}`),$(`\\grayF`,`\\textcolor{##888d93}{#1}`),$(`\\grayG`,`\\textcolor{##626569}{#1}`),$(`\\grayH`,`\\textcolor{##3b3e40}{#1}`),$(`\\grayI`,`\\textcolor{##21242c}{#1}`),$(`\\kaBlue`,`\\textcolor{##314453}{#1}`),$(`\\kaGreen`,`\\textcolor{##71B307}{#1}`);var Sg={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},Cg=class{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new pg(mg,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new fg(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,r;if(e){if(this.consumeSpaces(),this.future().text!==`[`)return null;t=this.popToken(),{tokens:r,end:n}=this.consumeArg([`]`])}else({tokens:r,start:t,end:n}=this.consumeArg());return this.pushToken(new ph(`EOF`,n.loc)),this.pushTokens(r),new ph(``,fh.range(t,n))}consumeSpaces(){for(;this.future().text===` `;)this.stack.pop()}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var r=this.future(),i,a=0,o=0;do{if(i=this.popToken(),t.push(i),i.text===`{`)++a;else if(i.text===`}`){if(--a,a===-1)throw new M(`Extra }`,i)}else if(i.text===`EOF`)throw new M(`Unexpected end of input in a macro argument, expected '`+(e&&n?e[o]:`}`)+`'`,i);if(e&&n){if((a===0||a===1&&e[o]===`{`)&&i.text===e[o]){if(++o,o===e.length){t.splice(-o,o);break}}else o=0}}while(a!==0||n);return r.text===`{`&&t[t.length-1].text===`}`&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:r,end:i}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new M(`The length of delimiters doesn't match the number of args!`);for(var n=t[0],r=0;rthis.settings.maxExpand)throw new M(`Too many expansions: infinite loop or need to increase maxExpand setting`)}expandOnce(e){var t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(r==null||e&&r.unexpandable){if(e&&r==null&&n[0]===`\\`&&!this.isDefined(n))throw new M(`Undefined control sequence: `+n);return this.pushToken(t),!1}this.countExpansion(1);var i=r.tokens,a=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs){i=i.slice();for(var o=i.length-1;o>=0;--o){var s=i[o];if(s.text===`#`){if(o===0)throw new M(`Incomplete placeholder at end of macro body`,s);if(s=i[--o],s.text===`#`)i.splice(o+1,1);else if(/^[1-9]$/.test(s.text))i.splice(o,2,...a[s.text-1]);else throw new M(`Not a valid argument number`,s)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text=`\\relax`),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new ph(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var r=this.stack.pop();r.treatAsRelax&&=(r.noexpand=!1,!1),t.push(r)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(e=>e.text).join(``)}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var r=typeof t==`function`?t(this):t;if(typeof r==`string`){var i=0;if(r.includes(`#`))for(var a=r.replace(/##/g,``);a.includes(`#`+(i+1));)++i;for(var o=new fg(r,this.settings),s=[],c=o.lex();c.text!==`EOF`;)s.push(c),c=o.lex();return s.reverse(),{tokens:s,numArgs:i}}return r}isDefined(e){return this.macros.has(e)||rg.hasOwnProperty(e)||tf.math.hasOwnProperty(e)||tf.text.hasOwnProperty(e)||Sg.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t==null?rg.hasOwnProperty(e)&&!rg[e].primitive:typeof t==`string`||typeof t==`function`||!t.unexpandable}},wg=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Tg=Object.freeze({"₊":`+`,"₋":`-`,"₌":`=`,"₍":`(`,"₎":`)`,"₀":`0`,"₁":`1`,"₂":`2`,"₃":`3`,"₄":`4`,"₅":`5`,"₆":`6`,"₇":`7`,"₈":`8`,"₉":`9`,ₐ:`a`,ₑ:`e`,ₕ:`h`,ᵢ:`i`,ⱼ:`j`,ₖ:`k`,ₗ:`l`,ₘ:`m`,ₙ:`n`,ₒ:`o`,ₚ:`p`,ᵣ:`r`,ₛ:`s`,ₜ:`t`,ᵤ:`u`,ᵥ:`v`,ₓ:`x`,ᵦ:`β`,ᵧ:`γ`,ᵨ:`ρ`,ᵩ:`ϕ`,ᵪ:`χ`,"⁺":`+`,"⁻":`-`,"⁼":`=`,"⁽":`(`,"⁾":`)`,"⁰":`0`,"¹":`1`,"²":`2`,"³":`3`,"⁴":`4`,"⁵":`5`,"⁶":`6`,"⁷":`7`,"⁸":`8`,"⁹":`9`,ᴬ:`A`,ᴮ:`B`,ᴰ:`D`,ᴱ:`E`,ᴳ:`G`,ᴴ:`H`,ᴵ:`I`,ᴶ:`J`,ᴷ:`K`,ᴸ:`L`,ᴹ:`M`,ᴺ:`N`,ᴼ:`O`,ᴾ:`P`,ᴿ:`R`,ᵀ:`T`,ᵁ:`U`,ⱽ:`V`,ᵂ:`W`,ᵃ:`a`,ᵇ:`b`,ᶜ:`c`,ᵈ:`d`,ᵉ:`e`,ᶠ:`f`,ᵍ:`g`,ʰ:`h`,ⁱ:`i`,ʲ:`j`,ᵏ:`k`,ˡ:`l`,ᵐ:`m`,ⁿ:`n`,ᵒ:`o`,ᵖ:`p`,ʳ:`r`,ˢ:`s`,ᵗ:`t`,ᵘ:`u`,ᵛ:`v`,ʷ:`w`,ˣ:`x`,ʸ:`y`,ᶻ:`z`,ᵝ:`β`,ᵞ:`γ`,ᵟ:`δ`,ᵠ:`ϕ`,ᵡ:`χ`,ᶿ:`θ`}),Eg={"́":{text:`\\'`,math:`\\acute`},"̀":{text:"\\`",math:`\\grave`},"̈":{text:`\\"`,math:`\\ddot`},"̃":{text:`\\~`,math:`\\tilde`},"̄":{text:`\\=`,math:`\\bar`},"̆":{text:`\\u`,math:`\\breve`},"̌":{text:`\\v`,math:`\\check`},"̂":{text:`\\^`,math:`\\hat`},"̇":{text:`\\.`,math:`\\dot`},"̊":{text:`\\r`,math:`\\mathring`},"̋":{text:`\\H`},"̧":{text:`\\c`}},Dg={á:`á`,à:`à`,ä:`ä`,ǟ:`ǟ`,ã:`ã`,ā:`ā`,ă:`ă`,ắ:`ắ`,ằ:`ằ`,ẵ:`ẵ`,ǎ:`ǎ`,â:`â`,ấ:`ấ`,ầ:`ầ`,ẫ:`ẫ`,ȧ:`ȧ`,ǡ:`ǡ`,å:`å`,ǻ:`ǻ`,ḃ:`ḃ`,ć:`ć`,ḉ:`ḉ`,č:`č`,ĉ:`ĉ`,ċ:`ċ`,ç:`ç`,ď:`ď`,ḋ:`ḋ`,ḑ:`ḑ`,é:`é`,è:`è`,ë:`ë`,ẽ:`ẽ`,ē:`ē`,ḗ:`ḗ`,ḕ:`ḕ`,ĕ:`ĕ`,ḝ:`ḝ`,ě:`ě`,ê:`ê`,ế:`ế`,ề:`ề`,ễ:`ễ`,ė:`ė`,ȩ:`ȩ`,ḟ:`ḟ`,ǵ:`ǵ`,ḡ:`ḡ`,ğ:`ğ`,ǧ:`ǧ`,ĝ:`ĝ`,ġ:`ġ`,ģ:`ģ`,ḧ:`ḧ`,ȟ:`ȟ`,ĥ:`ĥ`,ḣ:`ḣ`,ḩ:`ḩ`,í:`í`,ì:`ì`,ï:`ï`,ḯ:`ḯ`,ĩ:`ĩ`,ī:`ī`,ĭ:`ĭ`,ǐ:`ǐ`,î:`î`,ǰ:`ǰ`,ĵ:`ĵ`,ḱ:`ḱ`,ǩ:`ǩ`,ķ:`ķ`,ĺ:`ĺ`,ľ:`ľ`,ļ:`ļ`,ḿ:`ḿ`,ṁ:`ṁ`,ń:`ń`,ǹ:`ǹ`,ñ:`ñ`,ň:`ň`,ṅ:`ṅ`,ņ:`ņ`,ó:`ó`,ò:`ò`,ö:`ö`,ȫ:`ȫ`,õ:`õ`,ṍ:`ṍ`,ṏ:`ṏ`,ȭ:`ȭ`,ō:`ō`,ṓ:`ṓ`,ṑ:`ṑ`,ŏ:`ŏ`,ǒ:`ǒ`,ô:`ô`,ố:`ố`,ồ:`ồ`,ỗ:`ỗ`,ȯ:`ȯ`,ȱ:`ȱ`,ő:`ő`,ṕ:`ṕ`,ṗ:`ṗ`,ŕ:`ŕ`,ř:`ř`,ṙ:`ṙ`,ŗ:`ŗ`,ś:`ś`,ṥ:`ṥ`,š:`š`,ṧ:`ṧ`,ŝ:`ŝ`,ṡ:`ṡ`,ş:`ş`,ẗ:`ẗ`,ť:`ť`,ṫ:`ṫ`,ţ:`ţ`,ú:`ú`,ù:`ù`,ü:`ü`,ǘ:`ǘ`,ǜ:`ǜ`,ǖ:`ǖ`,ǚ:`ǚ`,ũ:`ũ`,ṹ:`ṹ`,ū:`ū`,ṻ:`ṻ`,ŭ:`ŭ`,ǔ:`ǔ`,û:`û`,ů:`ů`,ű:`ű`,ṽ:`ṽ`,ẃ:`ẃ`,ẁ:`ẁ`,ẅ:`ẅ`,ŵ:`ŵ`,ẇ:`ẇ`,ẘ:`ẘ`,ẍ:`ẍ`,ẋ:`ẋ`,ý:`ý`,ỳ:`ỳ`,ÿ:`ÿ`,ỹ:`ỹ`,ȳ:`ȳ`,ŷ:`ŷ`,ẏ:`ẏ`,ẙ:`ẙ`,ź:`ź`,ž:`ž`,ẑ:`ẑ`,ż:`ż`,Á:`Á`,À:`À`,Ä:`Ä`,Ǟ:`Ǟ`,Ã:`Ã`,Ā:`Ā`,Ă:`Ă`,Ắ:`Ắ`,Ằ:`Ằ`,Ẵ:`Ẵ`,Ǎ:`Ǎ`,Â:`Â`,Ấ:`Ấ`,Ầ:`Ầ`,Ẫ:`Ẫ`,Ȧ:`Ȧ`,Ǡ:`Ǡ`,Å:`Å`,Ǻ:`Ǻ`,Ḃ:`Ḃ`,Ć:`Ć`,Ḉ:`Ḉ`,Č:`Č`,Ĉ:`Ĉ`,Ċ:`Ċ`,Ç:`Ç`,Ď:`Ď`,Ḋ:`Ḋ`,Ḑ:`Ḑ`,É:`É`,È:`È`,Ë:`Ë`,Ẽ:`Ẽ`,Ē:`Ē`,Ḗ:`Ḗ`,Ḕ:`Ḕ`,Ĕ:`Ĕ`,Ḝ:`Ḝ`,Ě:`Ě`,Ê:`Ê`,Ế:`Ế`,Ề:`Ề`,Ễ:`Ễ`,Ė:`Ė`,Ȩ:`Ȩ`,Ḟ:`Ḟ`,Ǵ:`Ǵ`,Ḡ:`Ḡ`,Ğ:`Ğ`,Ǧ:`Ǧ`,Ĝ:`Ĝ`,Ġ:`Ġ`,Ģ:`Ģ`,Ḧ:`Ḧ`,Ȟ:`Ȟ`,Ĥ:`Ĥ`,Ḣ:`Ḣ`,Ḩ:`Ḩ`,Í:`Í`,Ì:`Ì`,Ï:`Ï`,Ḯ:`Ḯ`,Ĩ:`Ĩ`,Ī:`Ī`,Ĭ:`Ĭ`,Ǐ:`Ǐ`,Î:`Î`,İ:`İ`,Ĵ:`Ĵ`,Ḱ:`Ḱ`,Ǩ:`Ǩ`,Ķ:`Ķ`,Ĺ:`Ĺ`,Ľ:`Ľ`,Ļ:`Ļ`,Ḿ:`Ḿ`,Ṁ:`Ṁ`,Ń:`Ń`,Ǹ:`Ǹ`,Ñ:`Ñ`,Ň:`Ň`,Ṅ:`Ṅ`,Ņ:`Ņ`,Ó:`Ó`,Ò:`Ò`,Ö:`Ö`,Ȫ:`Ȫ`,Õ:`Õ`,Ṍ:`Ṍ`,Ṏ:`Ṏ`,Ȭ:`Ȭ`,Ō:`Ō`,Ṓ:`Ṓ`,Ṑ:`Ṑ`,Ŏ:`Ŏ`,Ǒ:`Ǒ`,Ô:`Ô`,Ố:`Ố`,Ồ:`Ồ`,Ỗ:`Ỗ`,Ȯ:`Ȯ`,Ȱ:`Ȱ`,Ő:`Ő`,Ṕ:`Ṕ`,Ṗ:`Ṗ`,Ŕ:`Ŕ`,Ř:`Ř`,Ṙ:`Ṙ`,Ŗ:`Ŗ`,Ś:`Ś`,Ṥ:`Ṥ`,Š:`Š`,Ṧ:`Ṧ`,Ŝ:`Ŝ`,Ṡ:`Ṡ`,Ş:`Ş`,Ť:`Ť`,Ṫ:`Ṫ`,Ţ:`Ţ`,Ú:`Ú`,Ù:`Ù`,Ü:`Ü`,Ǘ:`Ǘ`,Ǜ:`Ǜ`,Ǖ:`Ǖ`,Ǚ:`Ǚ`,Ũ:`Ũ`,Ṹ:`Ṹ`,Ū:`Ū`,Ṻ:`Ṻ`,Ŭ:`Ŭ`,Ǔ:`Ǔ`,Û:`Û`,Ů:`Ů`,Ű:`Ű`,Ṽ:`Ṽ`,Ẃ:`Ẃ`,Ẁ:`Ẁ`,Ẅ:`Ẅ`,Ŵ:`Ŵ`,Ẇ:`Ẇ`,Ẍ:`Ẍ`,Ẋ:`Ẋ`,Ý:`Ý`,Ỳ:`Ỳ`,Ÿ:`Ÿ`,Ỹ:`Ỹ`,Ȳ:`Ȳ`,Ŷ:`Ŷ`,Ẏ:`Ẏ`,Ź:`Ź`,Ž:`Ž`,Ẑ:`Ẑ`,Ż:`Ż`,ά:`ά`,ὰ:`ὰ`,ᾱ:`ᾱ`,ᾰ:`ᾰ`,έ:`έ`,ὲ:`ὲ`,ή:`ή`,ὴ:`ὴ`,ί:`ί`,ὶ:`ὶ`,ϊ:`ϊ`,ΐ:`ΐ`,ῒ:`ῒ`,ῑ:`ῑ`,ῐ:`ῐ`,ό:`ό`,ὸ:`ὸ`,ύ:`ύ`,ὺ:`ὺ`,ϋ:`ϋ`,ΰ:`ΰ`,ῢ:`ῢ`,ῡ:`ῡ`,ῠ:`ῠ`,ώ:`ώ`,ὼ:`ὼ`,Ύ:`Ύ`,Ὺ:`Ὺ`,Ϋ:`Ϋ`,Ῡ:`Ῡ`,Ῠ:`Ῠ`,Ώ:`Ώ`,Ὼ:`Ὼ`},Og=class e{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode=`math`,this.gullet=new Cg(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new M(`Expected '`+e+`', got '`+this.fetch().text+`'`,this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken??=this.gullet.expandNextToken(),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set(`\\color`,`\\textcolor`);try{var e=this.parseExpression(!1);return this.expect(`EOF`),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new ph(`}`)),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect(`}`),this.nextToken=t,n}parseExpression(t,n){for(var r=[];;){this.mode===`math`&&this.consumeSpaces();var i=this.fetch();if(e.endOfExpression.has(i.text)||n&&i.text===n||t&&rg[i.text]&&rg[i.text].infix)break;var a=this.parseAtom(n);if(!a)break;a.type!==`internal`&&r.push(a)}return this.mode===`text`&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var t=-1,n,r=0;r=128)this.settings.strict&&(dd(t.charCodeAt(0))?this.mode===`math`&&this.settings.reportNonstrict(`unicodeTextInMathMode`,`Unicode text character "`+t[0]+`" used in math mode`,e):this.settings.reportNonstrict(`unknownSymbol`,`Unrecognized Unicode character "`+t[0]+`"`+(` (`+t.charCodeAt(0)+`)`),e)),a={type:`textord`,mode:`text`,loc:fh.range(e),text:t};else return null;if(this.consume(),i)for(var c=0;c{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},i=new class extends r{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},a={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},o=new class{#e=a;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function s(e){setTimeout(e,0)}var c=typeof window>`u`||`Deno`in globalThis;function l(){}function u(e,t){return typeof e==`function`?e(t):e}function d(e){return typeof e==`number`&&e>=0&&e!==1/0}function f(e,t){return Math.max(e+(t||0)-Date.now(),0)}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==_(o,t.options))return!1}else if(!y(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function g(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(v(t.options.mutationKey)!==v(a))return!1}else if(!y(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _(e,t){return(t?.queryKeyHashFn||v)(e)}function v(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function y(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n500)return t;let r=C(e)&&C(t);if(!r&&!(w(e)&&w(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{o.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:x(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var E=Symbol();function D(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===E?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function O(e,t){return typeof e==`function`?e(...t):!!e}function ie(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var k=(()=>{let e=()=>c;return{isServer(){return e()},setIsServer(t){e=t}}})();function A(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ae=s;function oe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ae,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var j=oe(),M=new class extends r{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function se(e){return Math.min(1e3*2**e,3e4)}function N(e){return(e??`online`)!==`online`||M.isOnline()}var P=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function F(e){let t=!1,n=0,r,a=A(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new P(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>i.isFocused()&&(e.networkMode===`always`||M.isOnline())&&e.canRun(),d=()=>N(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),a.resolve(e))},p=e=>{o()||(r?.(),a.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let i=e.retry??(k.isServer()?0:3),a=e.retryDelay??se,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&nu()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var I=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),d(this.gcTime)&&(this.#e=o.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(k.isServer()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(o.clearTimeout(this.#e),this.#e=void 0)}};function ce(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ie(e,()=>t.signal,()=>n=!0)},u=D(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?re:ne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?R:L,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:L(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function L(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function R(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function le(e,t){return t?L(e,t)!=null:!1}function ue(e,t){return!t||!e.getPreviousPageParam?!1:R(e,t)!=null}var de=class extends I{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=V(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=V(this.options);e.data!==void 0&&(this.setState(B(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=T(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(l).catch(l):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>m(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===E||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>p(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!f(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=D(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ce(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=F({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof P&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof P){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...z(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...B(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),j.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function z(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:N(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function B(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function V(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var H=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=A(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),U(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return W(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return W(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof m(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!S(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&G(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||p(this.options.staleTime,this.#t)!==p(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return pe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l)),t}#g(){this.#b();let e=p(this.options.staleTime,this.#t);if(k.isServer()||this.#r.isStale||!d(e))return;let t=f(this.#r.dataUpdatedAt,e)+1;this.#d=o.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(k.isServer()||m(this.options.enabled,this.#t)===!1||!d(this.#p)||this.#p===0)&&(this.#f=o.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(o.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(o.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&U(e,t),o=i&&G(e,n,t,r);(a||o)&&(l={...l,...z(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:h}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=T(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g){if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=T(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),h=`error`);let _=l.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=d!==void 0,S={status:h,fetchStatus:l.fetchStatus,isPending:v,isSuccess:h===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:K(e,t),refetch:this.refetch,promise:this.#o,isEnabled:m(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=A();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a()}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!S(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){j.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function fe(e,t){return m(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||m(t.retryOnMount,e)!==!1)}function U(e,t){return fe(e,t)||e.state.data!==void 0&&W(e,t,t.refetchOnMount)}function W(e,t,n){if(m(t.enabled,e)!==!1&&p(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&K(e,t)}return!1}function G(e,t,n,r){return(e!==t||m(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&K(e,n)}function K(e,t){return m(t.enabled,e)!==!1&&e.isStaleByTime(p(t.staleTime,e))}function pe(e,t){return!S(e.getCurrentResult(),t)}var me=class extends H{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:le(t,n.data),hasPreviousPage:ue(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},he=class extends I{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||q(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=F({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),j.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function q(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ge=class extends r{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),S(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&v(t.mutationKey)!==v(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??q();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){j.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function _e(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function ve(e,t,n){let r=e.slice(0);return r[t]=n,r}var ye=class extends r{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,j.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!S(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(_e(e,n).forEach(e=>{e.destroy()}),_e(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=x(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new H(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=ve(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&j.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},J=e(n(),1),be=t(),Y=J.createContext(void 0),X=e=>{let t=J.useContext(Y);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},xe=({client:e,children:t})=>(J.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,be.jsx)(Y.Provider,{value:e,children:t})),Se=J.createContext(!1),Ce=()=>J.useContext(Se);Se.Provider;function we(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Te=J.createContext(we()),Ee=()=>J.useContext(Te),De=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?O(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Oe=e=>{J.useEffect(()=>{e.clearReset()},[e])},ke=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||O(n,[e.error,r])),Z=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ae=(e,t)=>e.isLoading&&e.isFetching&&!t,Q=(e,t)=>e?.suspense&&t.isPending,$=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function je({queries:e,...t},n){let r=X(n),i=Ce(),a=Ee(),o=J.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Z(e);let t=r.getQueryCache().get(e.queryHash);De(e,a,t)}),Oe(a);let[s]=J.useState(()=>new ye(r,o,t)),[c,u,d]=s.getOptimisticResult(o,t.combine),f=!i&&t.subscribed!==!1;J.useSyncExternalStore(J.useCallback(e=>f?s.subscribe(j.batchCalls(e)):l,[s,f]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),J.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let p=c.some((e,t)=>Q(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Q(n,e)?$(n,new H(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=c.find((e,t)=>{let n=o[t];return n&&ke({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return u(d())}function Me(e,t,n){let r=Ce(),i=Ee(),a=X(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Z(o),De(o,i,s),Oe(i);let u=!a.getQueryCache().get(o.queryHash),[d]=J.useState(()=>new t(a,o)),f=d.getOptimisticResult(o),p=!r&&c;if(J.useSyncExternalStore(J.useCallback(e=>{let t=p?d.subscribe(j.batchCalls(e)):l;return d.updateResult(),t},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),J.useEffect(()=>{d.setOptions(o)},[o,d]),Q(o,f))throw $(o,d,i);if(ke({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!k.isServer()&&Ae(f,r)&&(u?$(o,d,i):s?.promise)?.catch(l).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?f:d.trackResult(f)}function Ne(e,t){return Me(e,H,t)}function Pe(e,t){let n=X(t),r=n.getQueryCache();return J.useSyncExternalStore(J.useCallback(e=>r.subscribe(j.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function Fe(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function Ie(e={},t){let n=X(t).getMutationCache(),r=J.useRef(e),i=J.useRef(null);return i.current===null&&(i.current=Fe(n,e)),J.useEffect(()=>{r.current=e}),J.useSyncExternalStore(J.useCallback(e=>n.subscribe(()=>{let t=x(i.current,Fe(n,r.current));i.current!==t&&(i.current=t,j.schedule(e))}),[n]),()=>i.current,()=>i.current)}function Le(e,t){let n=X(t),[r]=J.useState(()=>new ge(n,e));J.useEffect(()=>{r.setOptions(e)},[r,e]);let i=J.useSyncExternalStore(J.useCallback(e=>r.subscribe(j.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=J.useCallback((e,t)=>{r.mutate(e,t).catch(l)},[r]);if(i.error&&O(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Re(e,t){return Me(e,me,t)}export{i as C,E as S,h as _,Ne as a,x as b,X as c,M as d,j as f,g,_ as h,Pe as i,he as l,v as m,Le as n,je as o,u as p,Ie as r,xe as s,Re as t,de as u,l as v,r as w,p as x,y}; \ No newline at end of file diff --git a/frontend/web/dist/assets/sliders-horizontal-BIXOePK5.js b/frontend/web/dist/assets/sliders-horizontal-BIXOePK5.js new file mode 100644 index 000000000..1e52eb4be --- /dev/null +++ b/frontend/web/dist/assets/sliders-horizontal-BIXOePK5.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-BIflq6l1.js";var t=e(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),n=e(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),r=e(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),i=e(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),a=e(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),o=e(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]);export{n as a,r as i,a as n,t as o,i as r,o as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/sliders-horizontal-BiyUR49M.js b/frontend/web/dist/assets/sliders-horizontal-BiyUR49M.js new file mode 100644 index 000000000..a5bac6a4f --- /dev/null +++ b/frontend/web/dist/assets/sliders-horizontal-BiyUR49M.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-DpaE5wy6.js";var t=e(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),n=e(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),r=e(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),i=e(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),a=e(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),o=e(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]);export{n as a,r as i,a as n,t as o,i as r,o as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/sliders-horizontal-CSN_5pyz.js b/frontend/web/dist/assets/sliders-horizontal-CSN_5pyz.js new file mode 100644 index 000000000..0a68bf8e8 --- /dev/null +++ b/frontend/web/dist/assets/sliders-horizontal-CSN_5pyz.js @@ -0,0 +1 @@ +import{L as e}from"./AppearanceControls-Bc1ibrT3.js";var t=e(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),n=e(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),r=e(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),i=e(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),a=e(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),o=e(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]);export{n as a,r as i,a as n,t as o,i as r,o as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/useWorkbenchTheme-BqK4B8rm.js b/frontend/web/dist/assets/useWorkbenchTheme-BqK4B8rm.js new file mode 100644 index 000000000..67bda2a99 --- /dev/null +++ b/frontend/web/dist/assets/useWorkbenchTheme-BqK4B8rm.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{k as r}from"./index-DPfzOfKU.js";var i=e(n(),1),a=t();function o(e){try{return globalThis.localStorage?.getItem(e)??null}catch{return null}}function s(e,t){try{return globalThis.localStorage?.setItem(e,t),!!globalThis.localStorage}catch{return!1}}function c({kind:e,size:t,className:n=``}){let i=r();return(0,a.jsxs)(`span`,{className:`app-brand-image shrink-0 ${n}`,style:{display:`inline-flex`,height:t},children:[(0,a.jsx)(`img`,{className:`app-brand-light`,src:i.assets[e],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}}),(0,a.jsx)(`img`,{className:`app-brand-dark`,src:i.assets[`${e}_dark`],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}})]})}function l({size:e,className:t=`text-ink`}){return r().assets.mark?(0,a.jsx)(c,{kind:`mark`,size:e,className:t}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-mark`,viewBox:`0 0 512 512`,role:`img`,"aria-label":`Argus`,style:{width:e,height:e},className:`argus-brand-mark shrink-0 ${t}`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsxs)(`g`,{className:`argus-mark-eye`,children:[(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]})]})}function u({size:e}){return r().assets.logo?(0,a.jsx)(c,{kind:`logo`,size:e}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-horizontal`,viewBox:`150 40 1160 390`,role:`img`,"aria-label":`Argus`,style:{width:e*2.75,height:e},className:`shrink-0 text-ink`,children:[(0,a.jsxs)(`g`,{className:`argus-brand-mark`,transform:`translate(180 92) scale(.54)`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]}),(0,a.jsxs)(`g`,{fill:`rgb(var(--brand-body))`,children:[(0,a.jsx)(`path`,{d:`M383 556Q394 556 409 555Q424 554 433 552L422 412Q415 414 401.5 415.5Q388 417 378 417Q340 417 305 403.5Q270 390 248.5 360Q227 330 227 278V0H78V546H191L213 454H220Q244 496 286 526Q328 556 383 556Z`,transform:`translate(444 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M255 556Q356 556 413 476H417L429 546H555V-1Q555-118 486-179Q417-240 282-240Q224-240 174.5-233Q125-226 78-208V-89Q179-131 291-131Q406-131 406-7V4Q406 21 407.5 39Q409 57 410 71H406Q378 28 339 9Q300-10 251-10Q154-10 99.5 64.5Q45 139 45 272Q45 406 101 481Q157 556 255 556ZM302 435Q197 435 197 270Q197 107 304 107Q361 107 388.5 139.5Q416 172 416 253V271Q416 359 389 397Q362 435 302 435Z`,transform:`translate(617.52 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M579 546V0H465L445 70H437Q411 28 365.5 9Q320-10 269-10Q181-10 128 37.5Q75 85 75 190V546H224V227Q224 169 245 139Q266 109 312 109Q380 109 405 155.5Q430 202 430 289V546Z`,transform:`translate(855.48 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M459 162Q459 79 400.5 34.5Q342-10 226-10Q169-10 128-2.5Q87 5 46 22V145Q90 125 141 112Q192 99 231 99Q275 99 293.5 112Q312 125 312 146Q312 160 304.5 171Q297 182 272 196Q247 210 194 232Q143 254 110 275.5Q77 297 61 327.5Q45 358 45 404Q45 480 104 518Q163 556 261 556Q312 556 358 546Q404 536 453 513L408 406Q368 423 332 434.5Q296 446 259 446Q193 446 193 410Q193 397 201.5 386.5Q210 376 234.5 364Q259 352 307 332Q354 313 388 292.5Q422 272 440.5 241.5Q459 211 459 162Z`,transform:`translate(1102.08 334) scale(.36 -.36)`})]})]})}function d({size:e=20,tag:t,compact:n=!1}){return(0,a.jsxs)(`span`,{className:`inline-flex select-none items-center gap-2.5`,children:[n?(0,a.jsx)(l,{size:e}):(0,a.jsx)(u,{size:e}),t&&!n?(0,a.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-ink-faint`,children:t}):null]})}var f=`argus.themeStyle`;function p(){return`standard`}function m(){s(f,`standard`)}function h(e){document.documentElement.dataset.theme=e,window.parent!==window&&window.parent.postMessage({type:`argus:theme-changed`,payload:e},`*`)}function g(){let[e,t]=(0,i.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`desktopTheme`);if(e===`light`||e===`dark`)return e;let t=o(`argus.theme`);return t===`light`||t===`dark`?t:null}),[n,r]=(0,i.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches),a=p(),c=e??(n?`dark`:`light`),l=(0,i.useRef)(c);return(0,i.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{let e=e=>{if(e.key!==`argus.theme`&&e.key!==null)return;let n=o(`argus.theme`);t(n===`light`||n===`dark`?n:null)};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,i.useEffect)(()=>{l.current=c,h(c)},[c]),(0,i.useEffect)(()=>{document.documentElement.dataset.themeStyle=a,m()},[a]),(0,i.useEffect)(()=>{window.parent!==window&&window.parent.postMessage({type:`argus:theme-preference`,payload:e||`system`},`*`)},[e]),{themeMode:c,themeStyle:a,cycleTheme:(0,i.useCallback)(()=>{let e=l.current===`light`?`dark`:`light`;l.current=e,h(e),s(`argus.theme`,e);let n=new URL(window.location.href);n.searchParams.has(`desktopTheme`)&&(n.searchParams.set(`desktopTheme`,e),window.history.replaceState(window.history.state,``,n.toString())),(0,i.startTransition)(()=>t(e))},[])}}export{s as a,o as i,l as n,d as r,g as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/useWorkbenchTheme-Bu46ZOFm.js b/frontend/web/dist/assets/useWorkbenchTheme-Bu46ZOFm.js new file mode 100644 index 000000000..cf1b9eeaa --- /dev/null +++ b/frontend/web/dist/assets/useWorkbenchTheme-Bu46ZOFm.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{A as r}from"./index-Cb5-aRKO.js";var i=e(t(),1),a=n();function o(e){try{return globalThis.localStorage?.getItem(e)??null}catch{return null}}function s(e,t){try{return globalThis.localStorage?.setItem(e,t),!!globalThis.localStorage}catch{return!1}}function c({kind:e,size:t,className:n=``}){let i=r();return(0,a.jsxs)(`span`,{className:`app-brand-image shrink-0 ${n}`,style:{display:`inline-flex`,height:t},children:[(0,a.jsx)(`img`,{className:`app-brand-light`,src:i.assets[e],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}}),(0,a.jsx)(`img`,{className:`app-brand-dark`,src:i.assets[`${e}_dark`],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}})]})}function l({size:e,className:t=`text-ink`}){return r().assets.mark?(0,a.jsx)(c,{kind:`mark`,size:e,className:t}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-mark`,viewBox:`0 0 512 512`,role:`img`,"aria-label":`Argus`,style:{width:e,height:e},className:`argus-brand-mark shrink-0 ${t}`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsxs)(`g`,{className:`argus-mark-eye`,children:[(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]})]})}function u({size:e}){return r().assets.logo?(0,a.jsx)(c,{kind:`logo`,size:e}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-horizontal`,viewBox:`150 40 1160 390`,role:`img`,"aria-label":`Argus`,style:{width:e*2.75,height:e},className:`shrink-0 text-ink`,children:[(0,a.jsxs)(`g`,{className:`argus-brand-mark`,transform:`translate(180 92) scale(.54)`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]}),(0,a.jsxs)(`g`,{fill:`rgb(var(--brand-body))`,children:[(0,a.jsx)(`path`,{d:`M383 556Q394 556 409 555Q424 554 433 552L422 412Q415 414 401.5 415.5Q388 417 378 417Q340 417 305 403.5Q270 390 248.5 360Q227 330 227 278V0H78V546H191L213 454H220Q244 496 286 526Q328 556 383 556Z`,transform:`translate(444 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M255 556Q356 556 413 476H417L429 546H555V-1Q555-118 486-179Q417-240 282-240Q224-240 174.5-233Q125-226 78-208V-89Q179-131 291-131Q406-131 406-7V4Q406 21 407.5 39Q409 57 410 71H406Q378 28 339 9Q300-10 251-10Q154-10 99.5 64.5Q45 139 45 272Q45 406 101 481Q157 556 255 556ZM302 435Q197 435 197 270Q197 107 304 107Q361 107 388.5 139.5Q416 172 416 253V271Q416 359 389 397Q362 435 302 435Z`,transform:`translate(617.52 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M579 546V0H465L445 70H437Q411 28 365.5 9Q320-10 269-10Q181-10 128 37.5Q75 85 75 190V546H224V227Q224 169 245 139Q266 109 312 109Q380 109 405 155.5Q430 202 430 289V546Z`,transform:`translate(855.48 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M459 162Q459 79 400.5 34.5Q342-10 226-10Q169-10 128-2.5Q87 5 46 22V145Q90 125 141 112Q192 99 231 99Q275 99 293.5 112Q312 125 312 146Q312 160 304.5 171Q297 182 272 196Q247 210 194 232Q143 254 110 275.5Q77 297 61 327.5Q45 358 45 404Q45 480 104 518Q163 556 261 556Q312 556 358 546Q404 536 453 513L408 406Q368 423 332 434.5Q296 446 259 446Q193 446 193 410Q193 397 201.5 386.5Q210 376 234.5 364Q259 352 307 332Q354 313 388 292.5Q422 272 440.5 241.5Q459 211 459 162Z`,transform:`translate(1102.08 334) scale(.36 -.36)`})]})]})}function d({size:e=20,tag:t,compact:n=!1}){return(0,a.jsxs)(`span`,{className:`inline-flex select-none items-center gap-2.5`,children:[n?(0,a.jsx)(l,{size:e}):(0,a.jsx)(u,{size:e}),t&&!n?(0,a.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-ink-faint`,children:t}):null]})}var f=`argus.themeStyle`;function p(){return`standard`}function m(){s(f,`standard`)}function h(e){document.documentElement.dataset.theme=e,window.parent!==window&&window.parent.postMessage({type:`argus:theme-changed`,payload:e},`*`)}function g(){let[e,t]=(0,i.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`desktopTheme`);if(e===`light`||e===`dark`)return e;let t=o(`argus.theme`);return t===`light`||t===`dark`?t:null}),[n,r]=(0,i.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches),a=p(),c=e??(n?`dark`:`light`),l=(0,i.useRef)(c);return(0,i.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{let e=e=>{if(e.key!==`argus.theme`&&e.key!==null)return;let n=o(`argus.theme`);t(n===`light`||n===`dark`?n:null)};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,i.useEffect)(()=>{l.current=c,h(c)},[c]),(0,i.useEffect)(()=>{document.documentElement.dataset.themeStyle=a,m()},[a]),(0,i.useEffect)(()=>{window.parent!==window&&window.parent.postMessage({type:`argus:theme-preference`,payload:e||`system`},`*`)},[e]),{themeMode:c,themeStyle:a,cycleTheme:(0,i.useCallback)(()=>{let e=l.current===`light`?`dark`:`light`;l.current=e,h(e),s(`argus.theme`,e);let n=new URL(window.location.href);n.searchParams.has(`desktopTheme`)&&(n.searchParams.set(`desktopTheme`,e),window.history.replaceState(window.history.state,``,n.toString())),(0,i.startTransition)(()=>t(e))},[])}}export{s as a,o as i,l as n,d as r,g as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/useWorkbenchTheme-CV-C3OBr.js b/frontend/web/dist/assets/useWorkbenchTheme-CV-C3OBr.js new file mode 100644 index 000000000..365073dbd --- /dev/null +++ b/frontend/web/dist/assets/useWorkbenchTheme-CV-C3OBr.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{A as r}from"./index-DbVni4qR.js";var i=e(t(),1),a=n();function o(e){try{return globalThis.localStorage?.getItem(e)??null}catch{return null}}function s(e,t){try{return globalThis.localStorage?.setItem(e,t),!!globalThis.localStorage}catch{return!1}}function c({kind:e,size:t,className:n=``}){let i=r();return(0,a.jsxs)(`span`,{className:`app-brand-image shrink-0 ${n}`,style:{display:`inline-flex`,height:t},children:[(0,a.jsx)(`img`,{className:`app-brand-light`,src:i.assets[e],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}}),(0,a.jsx)(`img`,{className:`app-brand-dark`,src:i.assets[`${e}_dark`],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}})]})}function l({size:e,className:t=`text-ink`}){return r().assets.mark?(0,a.jsx)(c,{kind:`mark`,size:e,className:t}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-mark`,viewBox:`0 0 512 512`,role:`img`,"aria-label":`Argus`,style:{width:e,height:e},className:`argus-brand-mark shrink-0 ${t}`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsxs)(`g`,{className:`argus-mark-eye`,children:[(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]})]})}function u({size:e}){return r().assets.logo?(0,a.jsx)(c,{kind:`logo`,size:e}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-horizontal`,viewBox:`150 40 1160 390`,role:`img`,"aria-label":`Argus`,style:{width:e*2.75,height:e},className:`shrink-0 text-ink`,children:[(0,a.jsxs)(`g`,{className:`argus-brand-mark`,transform:`translate(180 92) scale(.54)`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]}),(0,a.jsxs)(`g`,{fill:`rgb(var(--brand-body))`,children:[(0,a.jsx)(`path`,{d:`M383 556Q394 556 409 555Q424 554 433 552L422 412Q415 414 401.5 415.5Q388 417 378 417Q340 417 305 403.5Q270 390 248.5 360Q227 330 227 278V0H78V546H191L213 454H220Q244 496 286 526Q328 556 383 556Z`,transform:`translate(444 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M255 556Q356 556 413 476H417L429 546H555V-1Q555-118 486-179Q417-240 282-240Q224-240 174.5-233Q125-226 78-208V-89Q179-131 291-131Q406-131 406-7V4Q406 21 407.5 39Q409 57 410 71H406Q378 28 339 9Q300-10 251-10Q154-10 99.5 64.5Q45 139 45 272Q45 406 101 481Q157 556 255 556ZM302 435Q197 435 197 270Q197 107 304 107Q361 107 388.5 139.5Q416 172 416 253V271Q416 359 389 397Q362 435 302 435Z`,transform:`translate(617.52 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M579 546V0H465L445 70H437Q411 28 365.5 9Q320-10 269-10Q181-10 128 37.5Q75 85 75 190V546H224V227Q224 169 245 139Q266 109 312 109Q380 109 405 155.5Q430 202 430 289V546Z`,transform:`translate(855.48 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M459 162Q459 79 400.5 34.5Q342-10 226-10Q169-10 128-2.5Q87 5 46 22V145Q90 125 141 112Q192 99 231 99Q275 99 293.5 112Q312 125 312 146Q312 160 304.5 171Q297 182 272 196Q247 210 194 232Q143 254 110 275.5Q77 297 61 327.5Q45 358 45 404Q45 480 104 518Q163 556 261 556Q312 556 358 546Q404 536 453 513L408 406Q368 423 332 434.5Q296 446 259 446Q193 446 193 410Q193 397 201.5 386.5Q210 376 234.5 364Q259 352 307 332Q354 313 388 292.5Q422 272 440.5 241.5Q459 211 459 162Z`,transform:`translate(1102.08 334) scale(.36 -.36)`})]})]})}function d({size:e=20,tag:t,compact:n=!1}){return(0,a.jsxs)(`span`,{className:`inline-flex select-none items-center gap-2.5`,children:[n?(0,a.jsx)(l,{size:e}):(0,a.jsx)(u,{size:e}),t&&!n?(0,a.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-ink-faint`,children:t}):null]})}var f=`argus.themeStyle`;function p(){return`standard`}function m(){s(f,`standard`)}function h(e){document.documentElement.dataset.theme=e,window.parent!==window&&window.parent.postMessage({type:`argus:theme-changed`,payload:e},`*`)}function g(){let[e,t]=(0,i.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`desktopTheme`);if(e===`light`||e===`dark`)return e;let t=o(`argus.theme`);return t===`light`||t===`dark`?t:null}),[n,r]=(0,i.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches),a=p(),c=e??(n?`dark`:`light`),l=(0,i.useRef)(c);return(0,i.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{let e=e=>{if(e.key!==`argus.theme`&&e.key!==null)return;let n=o(`argus.theme`);t(n===`light`||n===`dark`?n:null)};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,i.useEffect)(()=>{l.current=c,h(c)},[c]),(0,i.useEffect)(()=>{document.documentElement.dataset.themeStyle=a,m()},[a]),(0,i.useEffect)(()=>{window.parent!==window&&window.parent.postMessage({type:`argus:theme-preference`,payload:e||`system`},`*`)},[e]),{themeMode:c,themeStyle:a,cycleTheme:(0,i.useCallback)(()=>{let e=l.current===`light`?`dark`:`light`;l.current=e,h(e),s(`argus.theme`,e);let n=new URL(window.location.href);n.searchParams.has(`desktopTheme`)&&(n.searchParams.set(`desktopTheme`,e),window.history.replaceState(window.history.state,``,n.toString())),(0,i.startTransition)(()=>t(e))},[])}}export{s as a,o as i,l as n,d as r,g as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/useWorkbenchTheme-CXN9ftdE.js b/frontend/web/dist/assets/useWorkbenchTheme-CXN9ftdE.js new file mode 100644 index 000000000..ac5070611 --- /dev/null +++ b/frontend/web/dist/assets/useWorkbenchTheme-CXN9ftdE.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{A as r}from"./index-DbdG0NfU.js";var i=e(t(),1),a=n();function o(e){try{return globalThis.localStorage?.getItem(e)??null}catch{return null}}function s(e,t){try{return globalThis.localStorage?.setItem(e,t),!!globalThis.localStorage}catch{return!1}}function c({kind:e,size:t,className:n=``}){let i=r();return(0,a.jsxs)(`span`,{className:`app-brand-image shrink-0 ${n}`,style:{display:`inline-flex`,height:t},children:[(0,a.jsx)(`img`,{className:`app-brand-light`,src:i.assets[e],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}}),(0,a.jsx)(`img`,{className:`app-brand-dark`,src:i.assets[`${e}_dark`],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}})]})}function l({size:e,className:t=`text-ink`}){return r().assets.mark?(0,a.jsx)(c,{kind:`mark`,size:e,className:t}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-mark`,viewBox:`0 0 512 512`,role:`img`,"aria-label":`Argus`,style:{width:e,height:e},className:`argus-brand-mark shrink-0 ${t}`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsxs)(`g`,{className:`argus-mark-eye`,children:[(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]})]})}function u({size:e}){return r().assets.logo?(0,a.jsx)(c,{kind:`logo`,size:e}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-horizontal`,viewBox:`150 40 1160 390`,role:`img`,"aria-label":`Argus`,style:{width:e*2.75,height:e},className:`shrink-0 text-ink`,children:[(0,a.jsxs)(`g`,{className:`argus-brand-mark`,transform:`translate(180 92) scale(.54)`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]}),(0,a.jsxs)(`g`,{fill:`rgb(var(--brand-body))`,children:[(0,a.jsx)(`path`,{d:`M383 556Q394 556 409 555Q424 554 433 552L422 412Q415 414 401.5 415.5Q388 417 378 417Q340 417 305 403.5Q270 390 248.5 360Q227 330 227 278V0H78V546H191L213 454H220Q244 496 286 526Q328 556 383 556Z`,transform:`translate(444 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M255 556Q356 556 413 476H417L429 546H555V-1Q555-118 486-179Q417-240 282-240Q224-240 174.5-233Q125-226 78-208V-89Q179-131 291-131Q406-131 406-7V4Q406 21 407.5 39Q409 57 410 71H406Q378 28 339 9Q300-10 251-10Q154-10 99.5 64.5Q45 139 45 272Q45 406 101 481Q157 556 255 556ZM302 435Q197 435 197 270Q197 107 304 107Q361 107 388.5 139.5Q416 172 416 253V271Q416 359 389 397Q362 435 302 435Z`,transform:`translate(617.52 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M579 546V0H465L445 70H437Q411 28 365.5 9Q320-10 269-10Q181-10 128 37.5Q75 85 75 190V546H224V227Q224 169 245 139Q266 109 312 109Q380 109 405 155.5Q430 202 430 289V546Z`,transform:`translate(855.48 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M459 162Q459 79 400.5 34.5Q342-10 226-10Q169-10 128-2.5Q87 5 46 22V145Q90 125 141 112Q192 99 231 99Q275 99 293.5 112Q312 125 312 146Q312 160 304.5 171Q297 182 272 196Q247 210 194 232Q143 254 110 275.5Q77 297 61 327.5Q45 358 45 404Q45 480 104 518Q163 556 261 556Q312 556 358 546Q404 536 453 513L408 406Q368 423 332 434.5Q296 446 259 446Q193 446 193 410Q193 397 201.5 386.5Q210 376 234.5 364Q259 352 307 332Q354 313 388 292.5Q422 272 440.5 241.5Q459 211 459 162Z`,transform:`translate(1102.08 334) scale(.36 -.36)`})]})]})}function d({size:e=20,tag:t,compact:n=!1}){return(0,a.jsxs)(`span`,{className:`inline-flex select-none items-center gap-2.5`,children:[n?(0,a.jsx)(l,{size:e}):(0,a.jsx)(u,{size:e}),t&&!n?(0,a.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-ink-faint`,children:t}):null]})}var f=`argus.themeStyle`;function p(){return`standard`}function m(){s(f,`standard`)}function h(e){document.documentElement.dataset.theme=e,window.parent!==window&&window.parent.postMessage({type:`argus:theme-changed`,payload:e},`*`)}function g(){let[e,t]=(0,i.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`desktopTheme`);if(e===`light`||e===`dark`)return e;let t=o(`argus.theme`);return t===`light`||t===`dark`?t:null}),[n,r]=(0,i.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches),a=p(),c=e??(n?`dark`:`light`),l=(0,i.useRef)(c);return(0,i.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{let e=e=>{if(e.key!==`argus.theme`&&e.key!==null)return;let n=o(`argus.theme`);t(n===`light`||n===`dark`?n:null)};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,i.useEffect)(()=>{l.current=c,h(c)},[c]),(0,i.useEffect)(()=>{document.documentElement.dataset.themeStyle=a,m()},[a]),(0,i.useEffect)(()=>{window.parent!==window&&window.parent.postMessage({type:`argus:theme-preference`,payload:e||`system`},`*`)},[e]),{themeMode:c,themeStyle:a,cycleTheme:(0,i.useCallback)(()=>{let e=l.current===`light`?`dark`:`light`;l.current=e,h(e),s(`argus.theme`,e);let n=new URL(window.location.href);n.searchParams.has(`desktopTheme`)&&(n.searchParams.set(`desktopTheme`,e),window.history.replaceState(window.history.state,``,n.toString())),(0,i.startTransition)(()=>t(e))},[])}}export{s as a,o as i,l as n,d as r,g as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/useWorkbenchTheme-D7cPkLzc.js b/frontend/web/dist/assets/useWorkbenchTheme-D7cPkLzc.js new file mode 100644 index 000000000..06a2cc8bb --- /dev/null +++ b/frontend/web/dist/assets/useWorkbenchTheme-D7cPkLzc.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n}from"./icons-DRlFT_ri.js";import{A as r}from"./index-W1lBlVkr.js";var i=e(t(),1),a=n();function o(e){try{return globalThis.localStorage?.getItem(e)??null}catch{return null}}function s(e,t){try{return globalThis.localStorage?.setItem(e,t),!!globalThis.localStorage}catch{return!1}}function c({kind:e,size:t,className:n=``}){let i=r();return(0,a.jsxs)(`span`,{className:`app-brand-image shrink-0 ${n}`,style:{display:`inline-flex`,height:t},children:[(0,a.jsx)(`img`,{className:`app-brand-light`,src:i.assets[e],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}}),(0,a.jsx)(`img`,{className:`app-brand-dark`,src:i.assets[`${e}_dark`],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}})]})}function l({size:e,className:t=`text-ink`}){return r().assets.mark?(0,a.jsx)(c,{kind:`mark`,size:e,className:t}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-mark`,viewBox:`0 0 512 512`,role:`img`,"aria-label":`Argus`,style:{width:e,height:e},className:`argus-brand-mark shrink-0 ${t}`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsxs)(`g`,{className:`argus-mark-eye`,children:[(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]})]})}function u({size:e}){return r().assets.logo?(0,a.jsx)(c,{kind:`logo`,size:e}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-horizontal`,viewBox:`150 40 1160 390`,role:`img`,"aria-label":`Argus`,style:{width:e*2.75,height:e},className:`shrink-0 text-ink`,children:[(0,a.jsxs)(`g`,{className:`argus-brand-mark`,transform:`translate(180 92) scale(.54)`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]}),(0,a.jsxs)(`g`,{fill:`rgb(var(--brand-body))`,children:[(0,a.jsx)(`path`,{d:`M383 556Q394 556 409 555Q424 554 433 552L422 412Q415 414 401.5 415.5Q388 417 378 417Q340 417 305 403.5Q270 390 248.5 360Q227 330 227 278V0H78V546H191L213 454H220Q244 496 286 526Q328 556 383 556Z`,transform:`translate(444 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M255 556Q356 556 413 476H417L429 546H555V-1Q555-118 486-179Q417-240 282-240Q224-240 174.5-233Q125-226 78-208V-89Q179-131 291-131Q406-131 406-7V4Q406 21 407.5 39Q409 57 410 71H406Q378 28 339 9Q300-10 251-10Q154-10 99.5 64.5Q45 139 45 272Q45 406 101 481Q157 556 255 556ZM302 435Q197 435 197 270Q197 107 304 107Q361 107 388.5 139.5Q416 172 416 253V271Q416 359 389 397Q362 435 302 435Z`,transform:`translate(617.52 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M579 546V0H465L445 70H437Q411 28 365.5 9Q320-10 269-10Q181-10 128 37.5Q75 85 75 190V546H224V227Q224 169 245 139Q266 109 312 109Q380 109 405 155.5Q430 202 430 289V546Z`,transform:`translate(855.48 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M459 162Q459 79 400.5 34.5Q342-10 226-10Q169-10 128-2.5Q87 5 46 22V145Q90 125 141 112Q192 99 231 99Q275 99 293.5 112Q312 125 312 146Q312 160 304.5 171Q297 182 272 196Q247 210 194 232Q143 254 110 275.5Q77 297 61 327.5Q45 358 45 404Q45 480 104 518Q163 556 261 556Q312 556 358 546Q404 536 453 513L408 406Q368 423 332 434.5Q296 446 259 446Q193 446 193 410Q193 397 201.5 386.5Q210 376 234.5 364Q259 352 307 332Q354 313 388 292.5Q422 272 440.5 241.5Q459 211 459 162Z`,transform:`translate(1102.08 334) scale(.36 -.36)`})]})]})}function d({size:e=20,tag:t,compact:n=!1}){return(0,a.jsxs)(`span`,{className:`inline-flex select-none items-center gap-2.5`,children:[n?(0,a.jsx)(l,{size:e}):(0,a.jsx)(u,{size:e}),t&&!n?(0,a.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-ink-faint`,children:t}):null]})}var f=`argus.themeStyle`;function p(){return`standard`}function m(){s(f,`standard`)}function h(e){document.documentElement.dataset.theme=e,window.parent!==window&&window.parent.postMessage({type:`argus:theme-changed`,payload:e},`*`)}function g(){let[e,t]=(0,i.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`desktopTheme`);if(e===`light`||e===`dark`)return e;let t=o(`argus.theme`);return t===`light`||t===`dark`?t:null}),[n,r]=(0,i.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches),a=p(),c=e??(n?`dark`:`light`),l=(0,i.useRef)(c);return(0,i.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{let e=e=>{if(e.key!==`argus.theme`&&e.key!==null)return;let n=o(`argus.theme`);t(n===`light`||n===`dark`?n:null)};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,i.useEffect)(()=>{l.current=c,h(c)},[c]),(0,i.useEffect)(()=>{document.documentElement.dataset.themeStyle=a,m()},[a]),(0,i.useEffect)(()=>{window.parent!==window&&window.parent.postMessage({type:`argus:theme-preference`,payload:e||`system`},`*`)},[e]),{themeMode:c,themeStyle:a,cycleTheme:(0,i.useCallback)(()=>{let e=l.current===`light`?`dark`:`light`;l.current=e,h(e),s(`argus.theme`,e);let n=new URL(window.location.href);n.searchParams.has(`desktopTheme`)&&(n.searchParams.set(`desktopTheme`,e),window.history.replaceState(window.history.state,``,n.toString())),(0,i.startTransition)(()=>t(e))},[])}}export{s as a,o as i,l as n,d as r,g as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/useWorkbenchTheme-DMn1yhZa.js b/frontend/web/dist/assets/useWorkbenchTheme-DMn1yhZa.js new file mode 100644 index 000000000..ee572205a --- /dev/null +++ b/frontend/web/dist/assets/useWorkbenchTheme-DMn1yhZa.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{k as r}from"./index-Dkv2HM-n.js";var i=e(n(),1),a=t();function o(e){try{return globalThis.localStorage?.getItem(e)??null}catch{return null}}function s(e,t){try{return globalThis.localStorage?.setItem(e,t),!!globalThis.localStorage}catch{return!1}}function c({kind:e,size:t,className:n=``}){let i=r();return(0,a.jsxs)(`span`,{className:`app-brand-image shrink-0 ${n}`,style:{display:`inline-flex`,height:t},children:[(0,a.jsx)(`img`,{className:`app-brand-light`,src:i.assets[e],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}}),(0,a.jsx)(`img`,{className:`app-brand-dark`,src:i.assets[`${e}_dark`],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}})]})}function l({size:e,className:t=`text-ink`}){return r().assets.mark?(0,a.jsx)(c,{kind:`mark`,size:e,className:t}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-mark`,viewBox:`0 0 512 512`,role:`img`,"aria-label":`Argus`,style:{width:e,height:e},className:`argus-brand-mark shrink-0 ${t}`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsxs)(`g`,{className:`argus-mark-eye`,children:[(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]})]})}function u({size:e}){return r().assets.logo?(0,a.jsx)(c,{kind:`logo`,size:e}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-horizontal`,viewBox:`150 40 1160 390`,role:`img`,"aria-label":`Argus`,style:{width:e*2.75,height:e},className:`shrink-0 text-ink`,children:[(0,a.jsxs)(`g`,{className:`argus-brand-mark`,transform:`translate(180 92) scale(.54)`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]}),(0,a.jsxs)(`g`,{fill:`rgb(var(--brand-body))`,children:[(0,a.jsx)(`path`,{d:`M383 556Q394 556 409 555Q424 554 433 552L422 412Q415 414 401.5 415.5Q388 417 378 417Q340 417 305 403.5Q270 390 248.5 360Q227 330 227 278V0H78V546H191L213 454H220Q244 496 286 526Q328 556 383 556Z`,transform:`translate(444 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M255 556Q356 556 413 476H417L429 546H555V-1Q555-118 486-179Q417-240 282-240Q224-240 174.5-233Q125-226 78-208V-89Q179-131 291-131Q406-131 406-7V4Q406 21 407.5 39Q409 57 410 71H406Q378 28 339 9Q300-10 251-10Q154-10 99.5 64.5Q45 139 45 272Q45 406 101 481Q157 556 255 556ZM302 435Q197 435 197 270Q197 107 304 107Q361 107 388.5 139.5Q416 172 416 253V271Q416 359 389 397Q362 435 302 435Z`,transform:`translate(617.52 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M579 546V0H465L445 70H437Q411 28 365.5 9Q320-10 269-10Q181-10 128 37.5Q75 85 75 190V546H224V227Q224 169 245 139Q266 109 312 109Q380 109 405 155.5Q430 202 430 289V546Z`,transform:`translate(855.48 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M459 162Q459 79 400.5 34.5Q342-10 226-10Q169-10 128-2.5Q87 5 46 22V145Q90 125 141 112Q192 99 231 99Q275 99 293.5 112Q312 125 312 146Q312 160 304.5 171Q297 182 272 196Q247 210 194 232Q143 254 110 275.5Q77 297 61 327.5Q45 358 45 404Q45 480 104 518Q163 556 261 556Q312 556 358 546Q404 536 453 513L408 406Q368 423 332 434.5Q296 446 259 446Q193 446 193 410Q193 397 201.5 386.5Q210 376 234.5 364Q259 352 307 332Q354 313 388 292.5Q422 272 440.5 241.5Q459 211 459 162Z`,transform:`translate(1102.08 334) scale(.36 -.36)`})]})]})}function d({size:e=20,tag:t,compact:n=!1}){return(0,a.jsxs)(`span`,{className:`inline-flex select-none items-center gap-2.5`,children:[n?(0,a.jsx)(l,{size:e}):(0,a.jsx)(u,{size:e}),t&&!n?(0,a.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-ink-faint`,children:t}):null]})}var f=`argus.themeStyle`;function p(){return`standard`}function m(){s(f,`standard`)}function h(e){document.documentElement.dataset.theme=e,window.parent!==window&&window.parent.postMessage({type:`argus:theme-changed`,payload:e},`*`)}function g(){let[e,t]=(0,i.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`desktopTheme`);if(e===`light`||e===`dark`)return e;let t=o(`argus.theme`);return t===`light`||t===`dark`?t:null}),[n,r]=(0,i.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches),a=p(),c=e??(n?`dark`:`light`),l=(0,i.useRef)(c);return(0,i.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{let e=e=>{if(e.key!==`argus.theme`&&e.key!==null)return;let n=o(`argus.theme`);t(n===`light`||n===`dark`?n:null)};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,i.useEffect)(()=>{l.current=c,h(c)},[c]),(0,i.useEffect)(()=>{document.documentElement.dataset.themeStyle=a,m()},[a]),(0,i.useEffect)(()=>{window.parent!==window&&window.parent.postMessage({type:`argus:theme-preference`,payload:e||`system`},`*`)},[e]),{themeMode:c,themeStyle:a,cycleTheme:(0,i.useCallback)(()=>{let e=l.current===`light`?`dark`:`light`;l.current=e,h(e),s(`argus.theme`,e);let n=new URL(window.location.href);n.searchParams.has(`desktopTheme`)&&(n.searchParams.set(`desktopTheme`,e),window.history.replaceState(window.history.state,``,n.toString())),(0,i.startTransition)(()=>t(e))},[])}}export{s as a,o as i,l as n,d as r,g as t}; \ No newline at end of file diff --git a/frontend/web/dist/assets/useWorkbenchTheme-Drg51S8W.js b/frontend/web/dist/assets/useWorkbenchTheme-Drg51S8W.js new file mode 100644 index 000000000..cee049057 --- /dev/null +++ b/frontend/web/dist/assets/useWorkbenchTheme-Drg51S8W.js @@ -0,0 +1 @@ +import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,v as n}from"./icons-DHjcpj5P.js";import{k as r}from"./index-Cr9q41CR.js";var i=e(n(),1),a=t();function o(e){try{return globalThis.localStorage?.getItem(e)??null}catch{return null}}function s(e,t){try{return globalThis.localStorage?.setItem(e,t),!!globalThis.localStorage}catch{return!1}}function c({kind:e,size:t,className:n=``}){let i=r();return(0,a.jsxs)(`span`,{className:`app-brand-image shrink-0 ${n}`,style:{display:`inline-flex`,height:t},children:[(0,a.jsx)(`img`,{className:`app-brand-light`,src:i.assets[e],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}}),(0,a.jsx)(`img`,{className:`app-brand-dark`,src:i.assets[`${e}_dark`],alt:i.name,style:{height:t,width:e===`mark`?t:`auto`}})]})}function l({size:e,className:t=`text-ink`}){return r().assets.mark?(0,a.jsx)(c,{kind:`mark`,size:e,className:t}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-mark`,viewBox:`0 0 512 512`,role:`img`,"aria-label":`Argus`,style:{width:e,height:e},className:`argus-brand-mark shrink-0 ${t}`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsxs)(`g`,{className:`argus-mark-eye`,children:[(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]})]})}function u({size:e}){return r().assets.logo?(0,a.jsx)(c,{kind:`logo`,size:e}):(0,a.jsxs)(`svg`,{"data-logo":`rounded-horizontal`,viewBox:`150 40 1160 390`,role:`img`,"aria-label":`Argus`,style:{width:e*2.75,height:e},className:`shrink-0 text-ink`,children:[(0,a.jsxs)(`g`,{className:`argus-brand-mark`,transform:`translate(180 92) scale(.54)`,children:[(0,a.jsx)(`path`,{d:`M352 112q0-30 30-30h28q30 0 30 30v320h-88v-52q-46 62-129 62Q66 442 66 266T228 88q80 0 124 56v-32ZM140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-body))`,fillRule:`evenodd`}),(0,a.jsx)(`path`,{d:`M140 266q46-80 102-80t110 80q-54 80-110 80t-102-80Z`,fill:`rgb(var(--brand-eye))`}),(0,a.jsx)(`circle`,{cx:`244`,cy:`266`,r:`42`,fill:`rgb(var(--brand-pupil))`}),(0,a.jsx)(`circle`,{cx:`262`,cy:`248`,r:`12`,fill:`rgb(var(--brand-highlight))`})]}),(0,a.jsxs)(`g`,{fill:`rgb(var(--brand-body))`,children:[(0,a.jsx)(`path`,{d:`M383 556Q394 556 409 555Q424 554 433 552L422 412Q415 414 401.5 415.5Q388 417 378 417Q340 417 305 403.5Q270 390 248.5 360Q227 330 227 278V0H78V546H191L213 454H220Q244 496 286 526Q328 556 383 556Z`,transform:`translate(444 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M255 556Q356 556 413 476H417L429 546H555V-1Q555-118 486-179Q417-240 282-240Q224-240 174.5-233Q125-226 78-208V-89Q179-131 291-131Q406-131 406-7V4Q406 21 407.5 39Q409 57 410 71H406Q378 28 339 9Q300-10 251-10Q154-10 99.5 64.5Q45 139 45 272Q45 406 101 481Q157 556 255 556ZM302 435Q197 435 197 270Q197 107 304 107Q361 107 388.5 139.5Q416 172 416 253V271Q416 359 389 397Q362 435 302 435Z`,transform:`translate(617.52 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M579 546V0H465L445 70H437Q411 28 365.5 9Q320-10 269-10Q181-10 128 37.5Q75 85 75 190V546H224V227Q224 169 245 139Q266 109 312 109Q380 109 405 155.5Q430 202 430 289V546Z`,transform:`translate(855.48 334) scale(.36 -.36)`}),(0,a.jsx)(`path`,{d:`M459 162Q459 79 400.5 34.5Q342-10 226-10Q169-10 128-2.5Q87 5 46 22V145Q90 125 141 112Q192 99 231 99Q275 99 293.5 112Q312 125 312 146Q312 160 304.5 171Q297 182 272 196Q247 210 194 232Q143 254 110 275.5Q77 297 61 327.5Q45 358 45 404Q45 480 104 518Q163 556 261 556Q312 556 358 546Q404 536 453 513L408 406Q368 423 332 434.5Q296 446 259 446Q193 446 193 410Q193 397 201.5 386.5Q210 376 234.5 364Q259 352 307 332Q354 313 388 292.5Q422 272 440.5 241.5Q459 211 459 162Z`,transform:`translate(1102.08 334) scale(.36 -.36)`})]})]})}function d({size:e=20,tag:t,compact:n=!1}){return(0,a.jsxs)(`span`,{className:`inline-flex select-none items-center gap-2.5`,children:[n?(0,a.jsx)(l,{size:e}):(0,a.jsx)(u,{size:e}),t&&!n?(0,a.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-ink-faint`,children:t}):null]})}var f=`argus.themeStyle`;function p(){return`standard`}function m(){s(f,`standard`)}function h(e){document.documentElement.dataset.theme=e,window.parent!==window&&window.parent.postMessage({type:`argus:theme-changed`,payload:e},`*`)}function g(){let[e,t]=(0,i.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`desktopTheme`);if(e===`light`||e===`dark`)return e;let t=o(`argus.theme`);return t===`light`||t===`dark`?t:null}),[n,r]=(0,i.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches),a=p(),c=e??(n?`dark`:`light`),l=(0,i.useRef)(c);return(0,i.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{let e=e=>{if(e.key!==`argus.theme`&&e.key!==null)return;let n=o(`argus.theme`);t(n===`light`||n===`dark`?n:null)};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,i.useEffect)(()=>{l.current=c,h(c)},[c]),(0,i.useEffect)(()=>{document.documentElement.dataset.themeStyle=a,m()},[a]),(0,i.useEffect)(()=>{window.parent!==window&&window.parent.postMessage({type:`argus:theme-preference`,payload:e||`system`},`*`)},[e]),{themeMode:c,themeStyle:a,cycleTheme:(0,i.useCallback)(()=>{let e=l.current===`light`?`dark`:`light`;l.current=e,h(e),s(`argus.theme`,e);let n=new URL(window.location.href);n.searchParams.has(`desktopTheme`)&&(n.searchParams.set(`desktopTheme`,e),window.history.replaceState(window.history.state,``,n.toString())),(0,i.startTransition)(()=>t(e))},[])}}export{s as a,o as i,l as n,d as r,g as t}; \ No newline at end of file diff --git a/frontend/web/dist/index.html b/frontend/web/dist/index.html index 33c0f7053..efae954ff 100644 --- a/frontend/web/dist/index.html +++ b/frontend/web/dist/index.html @@ -38,13 +38,13 @@ document.documentElement.dataset.themeStyle = style; })(); - + - - - + + + - +
diff --git a/frontend/web/src/App.tsx b/frontend/web/src/App.tsx index edb5b7e10..df4a0da41 100644 --- a/frontend/web/src/App.tsx +++ b/frontend/web/src/App.tsx @@ -1,15 +1,13 @@ import type { DispatchObserver, MapSendOptions } from './map/submission'; import { lazy, Suspense, useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'react'; -import { artifactRefreshEventKey, snapshotRefreshEventKey, useProjects, useProjectCosts, useSnapshot, useEventStream, useProjectActions, useArtifacts, useJournal, useGitDiff } from './hooks'; +import { artifactRefreshEventKey, snapshotRefreshEventKey, useProjects, useProjectCosts, useSnapshot, useEventStream, useProjectActions, useArtifacts, useJournal } from './hooks'; import { useConversationHistory } from './useConversationHistory'; import { api, isConnectionError, newRequestId, type EventMsg, type MessageRouteOverride, type SkillLibraryItem, type SkillScope, type WikiLibraryItem, PairingRequiredError } from './api'; -import { SkillLibrary } from './components/SkillLibrary'; -import { WikiLibrary } from './components/WikiLibrary'; +import { LearningLibrary, type LearningScope, type LearningSelection } from './components/LearningLibrary'; import { LearningStatus } from './components/LearningStatus'; import { ComposerRuntime } from './components/ComposerRuntime'; import { TopBar } from './components/TopBar'; import { WorkspaceShell } from './components/WorkspaceShell'; -import ResearchBrief from './research-brief'; import { EventStream, latestConversationDelivery } from './components/EventStream'; import { ChatBox } from './components/ChatBox'; import { appendPhaseStep, closePhaseTrail, type PhaseStep, trailToTurnSteps, turnStepsFrom } from '../../core/src/phaseTrail'; @@ -22,9 +20,7 @@ import { GuardianBanner } from './components/GuardianBanner'; import { NoOperatorBanner } from './components/NoOperatorBanner'; import { hasHumanProjectLabel, rankProjects } from '../../core/src/projects'; import { ArtifactModal } from './components/ArtifactModal'; -import { QuestionFoundation } from './research-brief/QuestionFoundation'; -import { ProgressQuestionsProvider, ProgressQuestionHistoryButton } from './research-brief/ProgressQuestions'; -import { readerPreview } from './map/copyMode'; +import { ProgressQuestionsProvider } from './research-brief/ProgressQuestions'; import { missionIsComplete, ResearchCanvas, @@ -37,9 +33,7 @@ import { ProjectInspectorModal } from './components/ProjectInspectorModal'; import { TaskDetailModal } from './components/TaskDetailModal'; import { currentWorkStatus } from './lib/workStatus'; import { SplitHandle } from './components/SplitHandle'; -import { Modal, ModalHeader } from './components/Modal'; -import { MissionControl } from './components/MissionControl'; -import { OperationsModal } from './components/OperationsModal'; +import { Modal } from './components/Modal'; import { VerticalStore } from './components/VerticalStore'; import { Landing } from './components/Landing'; import { MobileTabBar } from './components/MobileTabBar'; @@ -82,7 +76,7 @@ import { subscribeDesktopNewChat, } from './lib/desktopBridge'; -type Overlay = 'none' | 'palette' | 'help' | 'doctor' | 'config' | 'identity' | 'transcript' | 'inspector' | 'operations' | 'reading' | 'skills' | 'wiki' | 'verticals'; +type Overlay = 'none' | 'palette' | 'help' | 'doctor' | 'config' | 'identity' | 'transcript' | 'inspector' | 'learning' | 'verticals'; interface ActiveMessageRequest { id: number; serverRequestId: string; @@ -156,17 +150,22 @@ export default function App() { .find((error) => isConnectionError(error)); const [overlay, setOverlay] = useState('none'); - const [skillSelection, setSkillSelection] = useState(null); - const [skillScope, setSkillScope] = useState('recent'); + const [learningSelection, setLearningSelection] = useState(null); + const [learningScope, setLearningScope] = useState('feed'); + const openLearningLibrary = useCallback((scope: LearningScope) => { + setLearningSelection(null); + setLearningScope(scope); + setOverlay('learning'); + }, []); const openSkillLibrary = useCallback((item?: SkillLibraryItem, scope: SkillScope | 'recent' = 'recent') => { - setSkillSelection(item ?? null); - setSkillScope(scope); - setOverlay('skills'); + setLearningSelection(item ? { kind: 'skill', item } : null); + setLearningScope(item?.scope ?? (scope === 'recent' ? 'feed' : scope)); + setOverlay('learning'); }, []); - const [wikiSelection, setWikiSelection] = useState(null); const openWiki = useCallback((page?: WikiLibraryItem) => { - setWikiSelection(page ?? null); - setOverlay('wiki'); + setLearningSelection(page ? { kind: 'knowledge', item: page } : null); + setLearningScope(page?.scope === 'private' ? 'global' : page?.scope ?? 'feed'); + setOverlay('learning'); }, []); const { cycleTheme, @@ -193,17 +192,18 @@ export default function App() { themeMode, workspaceView, } = useWorkbenchLayout(); - const [standardWorkspaceView, setStandardWorkspaceView] = useState<'mission' | 'activity'>( - () => workspaceView === 'mission' ? 'mission' : 'activity', - ); const [workbenchOpened, setWorkbenchOpened] = useState(workspaceView === 'workbench'); + const [runtimeRequest, setRuntimeRequest] = useState(0); + const openRuntimeControls = useCallback(() => { + setOverlay('none'); + setMobileView('activity'); + setWorkspaceView('workbench'); + setRuntimeRequest(value => value + 1); + }, [setMobileView, setWorkspaceView]); useEffect(() => { if (workspaceView === 'workbench') { setWorkbenchOpened(true); - return; } - if (workspaceView === 'map') return; - setStandardWorkspaceView(workspaceView); }, [workspaceView]); // Share the visible-height decision with the reading card and composer. const compactViewport = useVisualViewport(); @@ -375,7 +375,6 @@ export default function App() { const loadedSid = snap?.session.id === activeSid ? activeSid : null; const continuous = snap?.continuous; const artifactsQ = useArtifacts(loadedSid, true); - const gitDiffQ = useGitDiff(loadedSid, standardWorkspaceView === 'mission'); const { events, connected } = useEventStream(loadedSid, eventView.reconnectKey); const artifactRefreshKey = useMemo(() => artifactRefreshEventKey(events), [events]); const snapshotRefreshKey = useMemo(() => snapshotRefreshEventKey(events), [events]); @@ -404,7 +403,7 @@ export default function App() { }, [loadedSid, queryClient, snapshotRefreshKey]); const guardianAlert = useMemo(() => activeGuardianAlert(events), [events]); const { query: transcriptQ, events: activityEvents, status: historyStatus } = useConversationHistory( - loadedSid, standardWorkspaceView === 'activity', events, localConversationEvents, localConversationSid.current, + loadedSid, true, events, localConversationEvents, localConversationSid.current, ); const activeManagerRequestId = loadedSid ? snap?.manager_requests?.filter(request => request.status === 'running').at(-1)?.request_id || '' @@ -496,11 +495,14 @@ export default function App() { if (userInitiated) setWorkspaceView('map'); return; } - if (workspaceView === 'map') { setArtifactPath(target); return; } + if (workspaceView === 'map' || !artifactsQ.data?.some(file => file.path === target && file.exists)) { + setArtifactPath(target); + return; + } setRightPanelOpen(true); setMobileView('preview'); setPreviewPathRequest((current) => ({ path: target, token: current.token + 1 })); - }, [setMobileView, setRightPanelOpen, setWorkspaceView, workspaceView]); + }, [artifactsQ.data, setMobileView, setRightPanelOpen, setWorkspaceView, workspaceView]); const deliveryCenter = useDeliveryCenter(loadedSid, Boolean(snap) && !transcriptQ.isPending, delivery, !artifactPath && !hasPendingDeliveryDependents(snap?.backlog ?? [], delivery?.item_id)); const openDelivery = deliveryCenter.open; const deliveryHistory = useMemo(() => { @@ -638,7 +640,7 @@ export default function App() { onOpenIdentity: () => setOverlay('identity'), onOpenInspector: () => setOverlay('inspector'), onOpenNewDaemon: startNewSession, - onOpenOperations: () => setOverlay('operations'), + onOpenOperations: openRuntimeControls, onOpenSidebar: () => setSidebarOpen(true), onOpenSkills: () => openSkillLibrary(undefined, 'global'), onReconnectEvents: () => dispatchEventView({ kind: 'reconnect' }), @@ -659,6 +661,7 @@ export default function App() { notify, openPreview, openSkillLibrary, + openRuntimeControls, renameCurrentProject, requestDispose, requestStopIteration, @@ -749,10 +752,10 @@ export default function App() { } const sameConversation = localConversationSid.current === requestSid; localConversationSid.current = requestSid; - setLocalConversationEvents((current) => [ + setLocalConversationEvents((current) => mergeOptimisticManagerSteps([ ...(sameConversation ? current : []), optimisticOperatorEvent(requestSid, requestId, text), - ]); + ], requestSid, requestId, [])); const showManagerText = ( reply: unknown, @@ -796,6 +799,7 @@ export default function App() { const finishMessage = (result: Record) => { if (!isCurrent()) return; + void queryClient.invalidateQueries({ queryKey: ['artifacts', requestSid] }); finishManagerMessage(result, { dispatchTask, notifyError: (error) => notify('error', error), @@ -863,7 +867,7 @@ export default function App() { const journaled = turnStepsFrom(result.steps); const steps = journaled.length ? journaled : trailToTurnSteps(trail, Date.now() / 1000, true); setLocalConversationEvents((current) => mergeOptimisticManagerSteps( - current, requestSid, requestId, steps, Date.now(), false, + current, requestSid, requestId, steps, Date.now(), false, result.kind === 'error' ? 'failed' : 'completed', )); showManagerText(result.reply, '', 'snapshot'); finishMessage(result); @@ -895,7 +899,9 @@ export default function App() { } } finally { // Whatever ended the turn, nothing in it is live any more. - setLocalConversationEvents((current) => settleOptimisticManagerTurn(current, requestId, Date.now())); + setLocalConversationEvents((current) => settleOptimisticManagerTurn( + current, requestId, Date.now(), streamErr && !controller.signal.aborted ? 'failed' : 'stopped', + )); if (controller.signal.aborted) observe?.({ type: 'settled', outcome: 'cancelled' }); resetCurrentRequest(); } @@ -958,7 +964,7 @@ export default function App() { ...(kiosk ? [] : [{ id: 'new', label: t('palette.newDaemon'), hint: '+', group: t('palette.view'), run: startNewSession }]), { id: 'transcript', label: t('palette.openTranscript'), hint: '/transcript', group: t('palette.view'), run: () => setOverlay('transcript') }, { id: 'inspector', label: t('palette.openProject'), hint: t('palette.projectHint'), group: t('palette.view'), run: () => setOverlay('inspector') }, - { id: 'operations', label: t('palette.openOperations'), hint: t('palette.operationsHint'), group: t('palette.view'), run: () => setOverlay('operations') }, + { id: 'operations', label: t('palette.openOperations'), hint: t('palette.operationsHint'), group: t('palette.view'), run: openRuntimeControls }, { id: 'verticals', label: t('verticals.openStore'), hint: t('verticals.paletteHint'), group: t('palette.view'), run: () => setOverlay('verticals') }, { id: 'help', label: t('help.title'), hint: '?', group: t('palette.view'), run: () => setOverlay('help') }, { @@ -1068,8 +1074,7 @@ export default function App() { onResume={(sid) => void resumeSession(sid)} resumingId={resumingSid} onOpenPanel={(panel) => setOverlay(panel)} - onOpenSkills={openSkillLibrary} - onOpenWiki={openWiki} + onOpenLearning={openLearningLibrary} onOpenVerticals={() => setOverlay('verticals')} onNew={startNewSession} loading={projectsQ.isLoading} @@ -1116,20 +1121,8 @@ export default function App() {
+
-
{ - if (event.key === 'Escape') { event.currentTarget.open = false; event.currentTarget.querySelector('summary')?.focus(); } - }}> - {workspaceView === 'mission' ? t('mobile.mission') : workspaceView === 'workbench' ? t('mobile.workbench') : locale === 'zh-CN' ? '更多' : 'More'} -
{ - if ((event.target as HTMLElement).closest('button')) event.currentTarget.closest('details')?.removeAttribute('open'); - }}> - - - - {!kiosk ? : null} -
-